Skip to content
Open
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
10 changes: 1 addition & 9 deletions crates/node/npm/wasm32-wasi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,5 @@
"@tybys/wasm-util": "^0.10.3",
"@emnapi/wasi-threads": "^1.2.3",
"tslib": "^2.8.1"
},
"bundledDependencies": [
"@napi-rs/wasm-runtime",
"@emnapi/core",
"@emnapi/runtime",
"@tybys/wasm-util",
"@emnapi/wasi-threads",
"tslib"
]
}
}
12 changes: 12 additions & 0 deletions crates/node/scripts/move-artifacts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,15 @@ for (let file of await fs.readdir(tailwindcssOxideRoot)) {
)
console.log(`Moved ${file} to npm/wasm32-wasi`)
}

// Strip bundledDependencies from wasm32-wasi/package.json to prevent npm unmet dependency errors
// (napi-rs adds this automatically but it breaks installations in pnpm workspaces/monorepos)
let wasmPkgPath = path.join(tailwindcssOxideRoot, 'npm', 'wasm32-wasi', 'package.json')
if (await fs.stat(wasmPkgPath).then(() => true).catch(() => false)) {
let wasmPkg = JSON.parse(await fs.readFile(wasmPkgPath, 'utf8'))
if (wasmPkg.bundledDependencies) {
delete wasmPkg.bundledDependencies
await fs.writeFile(wasmPkgPath, JSON.stringify(wasmPkg, null, 2) + '\n')
Comment on lines +44 to +46

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Npm fix lacks regression coverage

The existing WASM tests install through pnpm and check that the runtime loads. They do not test the npm installation error this change addresses. A test that packs the built WASM package, installs it with npm, and runs npm ls would catch a release tarball that still causes unmet-dependency errors.

console.log(`Stripped bundledDependencies from npm/wasm32-wasi/package.json`)
}
}