Repository navigation
Use node: prefixes for Node builtins - #24
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request standardizes Node.js builtin module specifiers to use the explicit node: protocol across the @taffyjs/node build outputs and repository code, addressing generated-loader bare specifiers and enforcing the convention via linting, tests, and PCR documentation.
Changes:
- Adds an Oxlint rule to enforce
node:protocol for Node builtin imports in authored code. - Introduces a build step to normalize builtin specifiers in the napi-rs–generated
binding.jsbefore formatting/bundling. - Adds a regression test to ensure the public
@taffyjs/nodeentry contains no bare builtin specifiers, and records the repository-wide rule in PCR docs.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vite.config.ts | Adds unicorn/prefer-node-protocol and inserts a normalization task into the Node build graph before formatting. |
| tools/taffy-node/normalize-node-builtin-specifiers.ts | New script that rewrites bare builtin specifiers in the generated native loader to node: and asserts none remain. |
| tests/taffyjs-node/tests/package/node-builtin-specifiers.test.mts | New regression test scanning the public package entry for bare builtin import/require patterns. |
| packages/taffyjs-node/index.js | Updates builtin references to use node: protocol in the distributed entry output. |
| packages/taffyjs-node/binding.js | Updates generated loader’s builtin imports/requires to use node: protocol. |
| .agents/docs/tooling-decisions.md | Records and vouches the repository-wide “Node builtin module protocol” rule in the tooling decisions ledger. |
| .agents/docs/technology-stack.md | Documents the normalization step as part of the native loader build pipeline and the Node target constraints. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+14
to
+17
| const bareBuiltinReference = new RegExp( | ||
| String.raw`(?:\bfrom\s+|\bimport\s+|\brequire(?:\.resolve)?\s*\(\s*|\bimport\s*\(\s*)(["'])(${bareBuiltinAlternatives})\1`, | ||
| "g", | ||
| ); |
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
node:for authored code with Oxlint and cover the public package entry with a regression testRoot cause
@napi-rs/cli@3.8.2intentionally emits baremodule,fs, andchild_processspecifiers to keep its loader compatible with Node 12. TaffyJS requires Node 22.18 or newer, so that compatibility tradeoff is unnecessary here, and the baremoduleentry fails Deno 2.2.15's default resolution.The build now normalizes the generated artifact at the repository-owned boundary instead of patching the dependency. This change does not declare Deno or Bun support; it enforces the package artifact's
node:builtin convention.Tests
vp run readypnpm dlx deno@2.2.15 eval --node-modules-dir=manual 'await import("@taffyjs/node")'pnpm dlx bun@1.2.15 -e 'await import("@taffyjs/node")'