fix: hand Node.js' null source back as null; cover the load hook's dependency and addon edge cases - #767
Conversation
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_000d841b-c0b8-4588-a77a-7b7b66b05f32) |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ipt off the deferral
Node.js' `addon` translator asserts `source === null` for a `.node` file
under node_modules, but `transform_output` dropped the `Option` and the
result reached JavaScript as `undefined`, on both the asynchronous and
the synchronous hooks. The `startsWith("commonjs")` deferral also caught
`commonjs-typescript`, whose translator needs the source, turning Node's
own type-stripping error into one blaming the hook.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…very matrix runtime Node.js hands the load hook `format: undefined` when the resolve chain reported none — a `.node` under node_modules without its flag — and the required `LoadContext.format` rejected the whole context with "Missing field `format`" where Node.js would have raised ERR_UNKNOWN_FILE_EXTENSION. Make it optional so Node.js' own error is what shows. The dependency cases (addon with and without the flag, latin-1, `.cts`, `.mts`) now run under both OXC_TRANSFORM_ALL values in-spec, with the addon default keyed on the runtime (on from v24.19.0 / v26.5.0), and the Linux matrix gains Node.js 26 so the synchronous hooks are exercised there as well as on macOS and Windows. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
ba923c2 to
f8c9b60
Compare
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_ffd3dffa-6c7e-4f58-8f61-5fa5a48a8fc1) |
💡 Codex Reviewoxc-node/packages/core/register.mjs Line 157 in ba923c2 When a process imports this registration module and subsequently installs another loader with ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Re the Codex P2 on So the claim as stated is not right: the later loader's Not acting on it in #767. If chaining with other |
Follow-up to #764 (now on
main), for the notes left in its review. Two commits.Summary
The first and third are pre-existing on both hook paths (shared code); only the
startsWithcame in with #764.Tests —
register-hooks.spec.ts, 20 cases: local.nodeimport (with and without--experimental-addon-modules),require()of a.node, latin-1; dependencies ×OXC_TRANSFORM_ALLfalse/true set in-spec: addon with the flag, addon following Node's default (loads on ≥ 24.19 / ≥ 26.5,ERR_UNKNOWN_FILE_EXTENSIONotherwise), latin-1,.ctsand.mts→ Node's ownERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING;--conditions=require|importin both directions. Failing cases also assert neitherERR_INVALID_RETURN_PROPERTY_VALUEnorMissing fieldappears.CI —
test-linux-bindinggains Node 26 (armv7 excluded:node:26-slimships no arm/v7 image, same as 24), so the synchronous path runs on every OS in the matrix.Test plan
vitest; localpnpm testresolves Vite+'s bundled 24.x and only exercises the fallback)OXC_TRANSFORM_ALL=truemainafter fix: register module hooks synchronously on Node.js >= 26.2.0 #764 landed;cargo clippy -D warnings,cargo fmt --check,cargo test,vp checkGenerated with Devin