GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — fix(@angular/build): use oxc-parser fallback when stripping source-map comments by clydin · Pull Request #34632 · angular/angular-cli Conversation
Member
Previously, Extend the single-trailing-comment fast path to string inputs and pass raw byte buffers directly from the Vite memory plugin so standard chunks slice trailing source-map comments without invoking a parser. When a file contains multiple or non-trailing Closes #34590
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code ReviewThis pull request refactors the sourcemap comment removal logic by replacing a custom state-machine parser with
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page.
alan-agius4
reviewed
Uh oh!
There was an error while loading. Please reload this page.
alan-agius4
approved these changes
…p comments Previously, `removeSourceMappingURL` relied on a custom character-by-character state machine to strip top-level `//# sourceMappingURL=` comments from JavaScript strings. Because that scanner did not track regular expression literals, quote characters or backticks inside a regex literal (such as `/"/`) inverted string boundaries for the remainder of the file. When a subsequent string literal contained `//# sourceMappingURL=`, the scanner misidentified it as a top-level comment and truncated valid JavaScript, or failed to strip the actual trailing comment at the end of the chunk. Extend the single-trailing-comment fast path to string inputs and pass raw byte buffers directly from the Vite memory plugin so standard chunks slice trailing source-map comments without invoking a parser. When a file contains multiple or non-trailing `//# sourceMappingURL=` occurrences, lazily load `oxc-parser` and read only the `comments` of the parse result, avoiding JS-side AST deserialization while delegating full ECMAScript lexical handling (including regex literals, templates, and escapes) to Oxc. This keeps main-thread startup free of eager native or WASM parser loading. The fallback removes whitespace consistently with the fast path, removing comment-only lines entirely while preserving line terminators for comments that follow code. Also harden trailing URL and base64 validation so block comments or template literals closing on the same line are never misclassified by the fast path. Closes angular#34590 …urce-map comments …ASI shim
Replace side-effect imports of `oxc-wasi-shim` with a centralized
`loadOxcParser()` helper across `@angular/build` consumers.
Because `oxc-parser` evaluates its WASI bindings synchronously during
`require('oxc-parser')`, `loadOxcParser()` restores `Module._resolveFilename`
in a `finally` block immediately after loading. This avoids leaving
`@emnapi/core` and `@emnapi/runtime` resolution permanently overridden on the
main thread where `rolldown` and `vite` resolve their own `@emnapi/*` versions.
clydin
force-pushed
the
fix/source-map-oxc-comment-stripping
branch
from
a2e3e69 to
69e3051
Compare
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
alan-agius4
pushed a commit
that referenced
this pull request
…p comments (#34632) Previously, `removeSourceMappingURL` relied on a custom character-by-character state machine to strip top-level `//# sourceMappingURL=` comments from JavaScript strings. Because that scanner did not track regular expression literals, quote characters or backticks inside a regex literal (such as `/"/`) inverted string boundaries for the remainder of the file. When a subsequent string literal contained `//# sourceMappingURL=`, the scanner misidentified it as a top-level comment and truncated valid JavaScript, or failed to strip the actual trailing comment at the end of the chunk. Extend the single-trailing-comment fast path to string inputs and pass raw byte buffers directly from the Vite memory plugin so standard chunks slice trailing source-map comments without invoking a parser. When a file contains multiple or non-trailing `//# sourceMappingURL=` occurrences, lazily load `oxc-parser` and read only the `comments` of the parse result, avoiding JS-side AST deserialization while delegating full ECMAScript lexical handling (including regex literals, templates, and escapes) to Oxc. This keeps main-thread startup free of eager native or WASM parser loading. The fallback removes whitespace consistently with the fast path, removing comment-only lines entirely while preserving line terminators for comments that follow code. Also harden trailing URL and base64 validation so block comments or template literals closing on the same line are never misclassified by the fast path. Closes #34590 PR Close #34632
alan-agius4
pushed a commit
that referenced
this pull request
…ASI shim (#34632) Replace side-effect imports of `oxc-wasi-shim` with a centralized `loadOxcParser()` helper across `@angular/build` consumers. Because `oxc-parser` evaluates its WASI bindings synchronously during `require('oxc-parser')`, `loadOxcParser()` restores `Module._resolveFilename` in a `finally` block immediately after loading. This avoids leaving `@emnapi/core` and `@emnapi/runtime` resolution permanently overridden on the main thread where `rolldown` and `vite` resolve their own `@emnapi/*` versions. PR Close #34632
alan-agius4
pushed a commit
to alan-agius4/angular-cli
that referenced
this pull request
…ASI shim (angular#34632) Replace side-effect imports of `oxc-wasi-shim` with a centralized `loadOxcParser()` helper across `@angular/build` consumers. Because `oxc-parser` evaluates its WASI bindings synchronously during `require('oxc-parser')`, `loadOxcParser()` restores `Module._resolveFilename` in a `finally` block immediately after loading. This avoids leaving `@emnapi/core` and `@emnapi/runtime` resolution permanently overridden on the main thread where `rolldown` and `vite` resolve their own `@emnapi/*` versions. PR Close angular#34632
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reviewers+1 more reviewerUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
action: merge
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. @angular/build: source-map comment scanner corrupts valid JS containing a regex literalUh oh!
There was an error while loading. Please reload this page. 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. | |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |