Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

fix(@angular/build): handle regex literals in source-map comment scanner - #34591

Open
alan-agius4 wants to merge 3 commits into
angular:mainfrom
alan-agius4:fix/source-map-regex-scanner
Open

alan-agius4 wants to merge 3 commits into
angular:mainfrom
alan-agius4:fix/source-map-regex-scanner

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Previously, removeSourceMappingURL did not track regular expression literals in its state machine. A quote character (", ', or `) inside a regex literal (such as /"/) was misinterpreted as the start of a string literal, inverting string boundaries for the remainder of the file and corrupting valid JavaScript when a subsequent string contained //# sourceMappingURL=.

Closes #34590

Previously, `removeSourceMappingURL` did not track regular expression
literals in its state machine. A quote character (`"`, `'`, or `` ` ``)
inside a regex literal (such as `/"/`) was misinterpreted as the start
of a string literal, inverting string boundaries for the remainder of
the file and corrupting valid JavaScript when a subsequent string
contained `//# sourceMappingURL=`.

Closes angular#34590

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the source-map utility to safely ignore regex literals when stripping source map comments, preventing corruption of string boundaries. It introduces a state machine that tracks preceding keywords and punctuation to distinguish division from regex literals, along with comprehensive unit tests. The review feedback highlights three important edge cases to address: handling postfix/prefix operators like ++ and -- to avoid incorrect regex parsing, supporting Unicode characters in identifiers, and adding the missing default keyword to the list of preceding keywords.

@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Oct 30, 2026
@alan-agius4
alan-agius4 requested a review from clydin October 30, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@angular/build: source-map comment scanner corrupts valid JS containing a regex literal

1 participant