Repository navigation
Keep inline Wasm staging package scoped - #20
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Restores the inline Wasm staging identity to the scoped napi-rs name while tightening the “fully inlined” guarantee (no runtime require.resolve, no binding package references/deps, no standalone .wasm in the published tarball) and documenting the scoped exception in PCR records.
Changes:
- Update the inline Wasm loader template replacement to match napi-rs’s scoped staging fallback and adjust forbidden-token checks accordingly.
- Strengthen package-contents verification to ensure
distcontains norequire.resolveand no binding-wasm references, and broaden dependency scanning across all*Dependenciesmaps. - Record the scoped Wasm staging exception in
.agents/docs/decision ledgers and package design documentation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/taffy-wasm/generate-inline-wasm-runtime-files.ts | Updates exact-match replacement of napi-rs fallback block and validates the generated inline Node loader output. |
| tests/taffyjs-wasm/tests/package-contents.ts | Expands package inspection assertions to catch resolver calls, binding strings, and binding dependencies. |
| packages/taffyjs-wasm/package.json | Aligns napi.packageName with the scoped binding identity. |
| .agents/docs/tooling-decisions.md | Updates scope-boundary ruling to include the explicit inline Wasm staging scoped exception. |
| .agents/docs/taffyjs-wasm-package.md | Clarifies how the scoped staging fallback is removed during inlining and updates the verification contract. |
Suppressed comments (1)
tests/taffyjs-wasm/tests/package-contents.ts:90
dependencyNamestreats any key ending withDependenciesas a dependency map, but some of these fields can legally be arrays (notablybundledDependencies/bundleDependencies). UsingObject.keys()on an array yields numeric indices, which can hide an accidentalbinding-wasmentry. Handle arrays by returning their string values so the check can’t miss bundled dependency names.
const dependencyNames = Object.entries(manifest.default).flatMap(([key, dependencies]) => {
const isDependencyMap = key === "dependencies" || key.endsWith("Dependencies");
if (!isDependencyMap || typeof dependencies !== "object" || dependencies === null) {
return [];
}
return Object.keys(dependencies);
});
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
121
to
130
| for (const forbidden of [ | ||
| "node:fs", | ||
| "node:path", | ||
| "node:wasi", | ||
| "process.env", | ||
| "preopens", | ||
| "__wasmFilePath", | ||
| "@taffyjs/binding-wasm", | ||
| "taffyjs-binding-wasm", | ||
| "require('./taffyjs.wasm-base64", | ||
| ]) { |
Comment on lines
71
to
+76
| assert.equal(nodeGraph.includes("WebAssembly.compile("), false); | ||
| assert.equal(/\bawait\b/.test(nodeGraph), false); | ||
| assert.equal(nodeGraph.includes("instantiateNapiModuleSync"), true); | ||
| assert.equal(nodeGraph.includes("initial: 4000"), true); | ||
| assert.equal(nodeGraph.includes("require.resolve("), false); | ||
| assert.equal(nodeGraph.includes("@taffyjs/binding-wasm"), false); |
hyfdev
added a commit
that referenced
this pull request
Aug 16, 2026
hyfdev
added a commit
that referenced
this pull request
Aug 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@taffyjs/binding-wasm32-wasip1require.resolveappears only in napi-rs template source and is removed when the Wasm binary is inlined.wasmfileWhy
The Wasm build is special: it uses napi-rs's scoped staging identity while assembling
@taffyjs/wasm, but the staging package is not a runtime or published dependency. The previous change incorrectly treated the staging identity itself as an ordinary unpublished package.Impact
The final
@taffyjs/wasmpackage remains fully inline. Consumer imports and runtime behavior do not change, and no binding package is installed or resolved at runtime.Validation
vp fmt --checkvp lint --deny-warningsvp run checkvp run check:wasm.napi-buildcontains the scoped napi-rs template fallback while finaldistcontains norequire.resolve, binding package name, or.wasmfiledependenciesand all*Dependencies, for accidental binding dependencies