Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/node/npm/wasm32-wasi/.npmrc

This file was deleted.

8 changes: 7 additions & 1 deletion integrations/cli/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,12 @@ describe.each([
// Only ignore files called ignore-*.html in the actual git repo
'home/project/.gitignore': 'ignore-*.html',

'pnpm-workspace.yaml': yaml`
#
packages:
- home/project
`,

'home/project/package.json': json`
{
"type": "module",
Expand Down Expand Up @@ -596,7 +602,7 @@ describe.each([
installDependencies: false,
},
async ({ fs, root, exec }) => {
await exec(`pnpm install --ignore-workspace`, {
await exec(`pnpm install`, {
cwd: path.join(root, 'home/project'),
})

Expand Down
3 changes: 2 additions & 1 deletion integrations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"devDependencies": {
"dedent": "catalog:",
"fast-glob": "^3.3.3",
"source-map-js": "^1.2.1"
"source-map-js": "^1.2.1",
"yaml": "^2.6.0"
}
}
37 changes: 27 additions & 10 deletions integrations/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ import path from 'node:path'
import { promisify, stripVTControlCharacters } from 'node:util'
import { RawSourceMap, SourceMapConsumer } from 'source-map-js'
import { test as defaultTest, type ExpectStatic } from 'vitest'
import * as Yaml from 'yaml'
import { createLineTable } from '../packages/tailwindcss/src/source-maps/line-table'
import { escape } from '../packages/tailwindcss/src/utils/escape'

const REPO_ROOT = path.join(__dirname, '..')
const ROOT_PNPM_WORKSPACE = Yaml.parse(
await fs.readFile(path.join(REPO_ROOT, 'pnpm-workspace.yaml'), 'utf8'),
)
const PUBLIC_PACKAGES = (await fs.readdir(path.join(REPO_ROOT, 'dist'))).map((name) =>
name.replace('tailwindcss-', '@tailwindcss/').replace('.tgz', ''),
)
Expand Down Expand Up @@ -308,6 +312,8 @@ export function test(

if (filename.endsWith('package.json')) {
content = await overwriteVersionsInPackageJson(content)
} else if (filename.endsWith('pnpm-workspace.yaml')) {
content = overwriteVersionsInPnpmWorkspace(content)
}

// Ensure that files written on Windows use \r\n line ending
Expand Down Expand Up @@ -409,6 +415,7 @@ export function test(
config.fs['.gitignore'] ??= txt`
node_modules/
`
config.fs['pnpm-workspace.yaml'] ??= ''

for (let [filename, content] of Object.entries(config.fs)) {
await context.fs.write(filename, content)
Expand Down Expand Up @@ -502,28 +509,38 @@ async function overwriteVersionsInPackageJson(content: string): Promise<string>
}
}

return JSON.stringify(json, null, 2)
}

function overwriteVersionsInPnpmWorkspace(content: string): string {
let workspace = content.trim() === '' ? {} : Yaml.parse(content)

workspace.allowBuilds = {
...ROOT_PNPM_WORKSPACE.allowBuilds,
...workspace.allowBuilds,
}
workspace.overrides ||= {}

// Inject transitive dependency overwrite. This is necessary because
// @tailwindcss/vite internally depends on a specific version of
// @tailwindcss/oxide and we instead want to resolve it to the locally built
// version.
json.pnpm ||= {}
json.pnpm.overrides ||= {}
for (let pkg of PUBLIC_PACKAGES) {
if (pkg === 'tailwindcss') {
// We want to be explicit about the `tailwindcss` package so our tests can
// also import v3 without conflicting v4 tarballs.
json.pnpm.overrides['@tailwindcss/node>tailwindcss'] = resolveVersion(pkg)
json.pnpm.overrides['@tailwindcss/upgrade>tailwindcss'] = resolveVersion(pkg)
json.pnpm.overrides['@tailwindcss/cli>tailwindcss'] = resolveVersion(pkg)
json.pnpm.overrides['@tailwindcss/postcss>tailwindcss'] = resolveVersion(pkg)
json.pnpm.overrides['@tailwindcss/vite>tailwindcss'] = resolveVersion(pkg)
json.pnpm.overrides['@tailwindcss/webpack>tailwindcss'] = resolveVersion(pkg)
workspace.overrides['@tailwindcss/node>tailwindcss'] = resolveVersion(pkg)
workspace.overrides['@tailwindcss/upgrade>tailwindcss'] = resolveVersion(pkg)
workspace.overrides['@tailwindcss/cli>tailwindcss'] = resolveVersion(pkg)
workspace.overrides['@tailwindcss/postcss>tailwindcss'] = resolveVersion(pkg)
workspace.overrides['@tailwindcss/vite>tailwindcss'] = resolveVersion(pkg)
workspace.overrides['@tailwindcss/webpack>tailwindcss'] = resolveVersion(pkg)
} else {
json.pnpm.overrides[pkg] = resolveVersion(pkg)
workspace.overrides[pkg] = resolveVersion(pkg)
}
}

return JSON.stringify(json, null, 2)
return Yaml.stringify(workspace)
}

function resolveVersion(dependency: string) {
Expand Down
5 changes: 5 additions & 0 deletions integrations/vite/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,11 @@ test(
}
}
`,
'pnpm-workspace.yaml': yaml`
#
allowBuilds:
es5-ext: true
`,
'vite.config.ts': ts`
import tailwindcss from '@tailwindcss/vite'
import { defineConfig } from 'vite'
Expand Down
11 changes: 6 additions & 5 deletions integrations/vite/nuxt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
retryAssertion,
test,
ts,
yaml,
} from '../utils'

const SETUP = {
Expand All @@ -21,14 +22,14 @@ const SETUP = {
"nitropack": "2.11.0",
"tailwindcss": "workspace:^",
"vue": "latest"
},
"pnpm": {
"overrides": {
"nuxi": "3.28.0"
}
}
}
`,
'pnpm-workspace.yaml': yaml`
#
overrides:
nuxi: 3.28.0
`,
'nuxt.config.ts': ts`
import tailwindcss from '@tailwindcss/vite'

Expand Down
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,11 @@
"prettier": "catalog:",
"prettier-plugin-embed": "^0.5.1",
"prettier-plugin-organize-imports": "^4.3.0",
"tailwindcss": "workspace:*",
"tsup": "^8.5.1",
"turbo": "^2.9.14",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary for pnpm v11 compatibility. See: https://github.com/vercel/turborepo/releases/tag/v2.9.7

We only needed to bump 1 patch version, but using the latest version to get other fixes.

"typescript": "^5.9.3",
"vitest": "^4.1.7"
},
"packageManager": "pnpm@9.6.0",
"pnpm": {
"patchedDependencies": {
"@parcel/watcher@2.5.1": "patches/@parcel__watcher@2.5.1.patch",
"lightningcss@1.32.0": "patches/lightningcss@1.32.0.patch"
}
}
Comment on lines -64 to -69

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is moved to the pnpm-workspace.yaml file

"packageManager": "pnpm@11.1.3"
}
11 changes: 5 additions & 6 deletions packages/@tailwindcss-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,15 @@
".": {
"types": "./src/index.ts",
"import": "./src/index.ts",
"require": "./src/index.cts"
"require": "./dist/index.js"
},
"./require-cache": {
"types": "./src/require-cache.ts",
"import": "./src/require-cache.ts",
"require": "./src/require-cache.cts"
"types": "./dist/require-cache.d.ts",
"default": "./dist/require-cache.js"
},
"./esm-cache-loader": {
"types": "./src/esm-cache.loader.mts",
"default": "./src/esm-cache.loader.mts"
"types": "./dist/esm-cache.loader.d.mts",
"default": "./dist/esm-cache.loader.mjs"
}
},
"dependencies": {
Expand Down
Loading
Loading