Repository navigation
fix(jsc): give require(esm) its own namespace marker - #1
Merged
Merged
Conversation
Adapt the own-property handling from oven-sh#279 by @robobun (c28e418). Create a separate live namespace facade for require(esm), leaving imports untouched and all JavaScript writes subject to namespace invariants. Facade lifetime and reuse belong to the embedder require cache.
Run a read-only native Linux check for engine pull requests. Verify JSC stress results explicitly and exercise namespace regressions with the matching Bun adapter before publication qualification. Publishing remains in the separate manually approved artifact workflow.
|
Dependency limit exceeded — report not shown. This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report. Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard. Socket is always free for open source. If this is a non-commercial open source project, contact us to request a free Team account. |
Keep the namespace qualification adapter on the corrected parent pipeline, which clears outer CI revision variables for nested Bun builds and verifies both source revisions.
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.
Bun's inherited
__esModuleaccessor makes tsx unwrap an ordinary ESM namespace and lose explicit exports such aszod.z. This adds a nativerequire(esm)facade with an own enumerable marker, null prototype, and live export bindings. Imported namespaces stay unmarked; explicit marker exports and normal namespace mutation rules are preserved.Adapts the own-property work in oven-sh/WebKit#279 by @robobun, together with oven-sh/bun#33894. The paired Bun adapter removes the prototype override, covers normal require and require-cache materialization, preserves explicit CJS markers, and keeps native namespaces forwarded through CJS intact. Bun's existing ESM cache invalidation policy is unchanged.
The read-only PR workflow builds the unchanged Linux engine lane, checks JSC results, and qualifies the matching Bun adapter. Publication remains in the separate manual artifact workflow. Engine and Bun must be rebuilt together.
Validation on one AWS Linux c7a.24xlarge:
zod.z, patched Bun 2/2.ABBA performance uses eight measured samples per arm. Warm namespace reads are unchanged (-0.03%); cached require/import are +0.13%/+0.69%. Fresh CJS imports are +2.09%. First ESM require costs +5.87% (47.69 → 50.49 ms per 1,024 modules), and reflection costs +14.42% (52.11 → 59.62 ms per 300,000 iterations) while exposing the additional own marker. The extra facade allocation and enumerable property have a measurable cost on these paths.