Repository navigation
fix(standalone): load fetched plugins in typed AOT builds - #183756
Conversation
Let anonymous module scopes inherit their enclosing native runtime owner so original-TypeScript AOT preserves lazy conditional package resolution after pruning. Keep named package boundaries and platform filtering intact.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review endedClawSweeper stopped reviewing this revision because the pull request closed. |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd090ae381
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| if (manifest.name) { | ||
| found = register(directory, manifest); | ||
| break; | ||
| } | ||
| // Anonymous module scopes, including typed contexts, share their enclosing owner. |
There was a problem hiding this comment.
Preserve anonymous scopes when determining module format
For a dependency with a named "type":"module" root and an anonymous cjs/package.json containing {"type":"commonjs"}, skipping the anonymous scope now makes ownerOf(cjs/index.js) return the ESM owner. Consequently, collectRuntimeReferences() passes "module" to isCommonJsEntry() and omits this opaque require target from commonJsEntries. The standalone require adapter then skips its loaded.default ?? loaded unwrapping, so callers receive a module namespace instead of the CommonJS export (breaking callable exports, for example). Previously the undefined owner caused this .js target to be classified as CommonJS. Share package ownership across anonymous scopes, but retain their effective module type for entry classification.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
…83756) Let anonymous module scopes inherit their enclosing native runtime owner so original-TypeScript AOT preserves lazy conditional package resolution after pruning. Keep named package boundaries and platform filtering intact.
What Problem This Solves
Fixes fetched plugins failing to load in original-TypeScript AOT standalone builds with
Cannot find package 'acorn', even when plugin installation and dependency checks succeed.User Impact
Typed AOT builds preserve the same lazy package loading as emitted-JavaScript builds after the runtime's package-manager tree is removed. This repairs the packaging prerequisite for fetched plugin setup and loading; rebuilt signed-artifact qualification remains pending.
Why This Change Was Made
Original-source build contexts contain anonymous module-type scopes that share the runtime package. Native resolution stopped at those scopes and skipped the existing static package-resolution transform. Continue to the enclosing owner for anonymous scopes while preserving named package boundaries and platform filtering. The regression uses an actual typed source context and checks conditional exports, lazy evaluation, pruning, and relocation.
Evidence
ERR_MODULE_NOT_FOUNDon its first lazy package load after pruning and relocation.