Align sourceFilename across core, parser, and generator#17869
Draft
nicolo-ribaudo wants to merge 1 commit intobabel:mainfrom
Draft
Align sourceFilename across core, parser, and generator#17869nicolo-ribaudo wants to merge 1 commit intobabel:mainfrom
sourceFilename across core, parser, and generator#17869nicolo-ribaudo wants to merge 1 commit intobabel:mainfrom
Conversation
nicolo-ribaudo
commented
Mar 12, 2026
Comment on lines
+32
to
+44
| // The source filename used in the source map's "sources" array. | ||
| // This is the "normalized" version: if sourceRoot is set, it's | ||
| // relative to sourceRoot; if the path is absolute with no sourceRoot, | ||
| // it's reduced to its basename. Relative paths are kept as-is. | ||
| #sourceFilename: string | undefined; | ||
|
|
||
| // The original absolute filename (opts.filename, or opts.sourceFilename | ||
| // as a fallback), converted to a POSIX path. | ||
| // This is used in #resolveSourceFilename to detect when a node's | ||
| // loc.filename refers to the main source file, so we can map it back | ||
| // to the normalized #sourceFilename instead of creating a duplicate | ||
| // source entry. | ||
| #rawSourceFilename: string | undefined; |
Member
Author
There was a problem hiding this comment.
This is a mess, but I was trying to minimize disruption 😅
The problem is that right now we are very inconsistent about how we use relative paths, absolute paths, and basenames. @babel/generator needs to accept a mix of those to put the right things in the source map.
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61169 |
|
commit: |
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.
Fixes #1, Fixes #2Closes #15917 and closes #15911.
Marking as draft because I want to add getters for the old spelling for legacy compatibility.