Skip to content

Add a third parameter to SourceNode.fromStringWithSourceMap - #105

Closed
lydell wants to merge 1 commit into
mozilla:masterfrom
lydell:concat-relative-paths
Closed

lydell wants to merge 1 commit into
mozilla:masterfrom
lydell:concat-relative-paths

Conversation

@lydell

@lydell lydell commented Mar 14, 2014

Copy link
Copy Markdown
Contributor

An important use case for SourceNodes, and especially for
SourceNode.fromStringWithSourceMap, is to concatenate files with
source map support. This works well as long as all the input source maps
and the concatenated file¿s source map are next to each other. That’s
because any relative source paths in any input source map have to be
rewritten to be relative to the concatenated file’s source map. This
commit adds a third parameter to SourceNode.fromStringWithSourceMap
allowing you to do this.

@lydell

lydell commented Mar 23, 2014

Copy link
Copy Markdown
Contributor Author

I use this PR in source-map-concat.

Comment thread lib/source-map/source-node.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as how I commented in the other PR, this should probably be:

if (aRelativePath != null) {

Just in case someone has a directory "0" for whatever reason.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You didn’t say anything about this when the third parameter of .applySourceMap() was implemented. Isn’t the same issue present there?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes! Good catch!

@fitzgen

fitzgen commented Jun 2, 2014

Copy link
Copy Markdown
Contributor

Looks good, will merge with update mentioned above. Thanks!

@lydell

lydell commented Jun 15, 2014

Copy link
Copy Markdown
Contributor Author

Fixed.

@fitzgen

fitzgen commented Jun 25, 2014

Copy link
Copy Markdown
Contributor

Sweet, rebase and I'll merge :)

(Sorry, I should have got to your PRs first so you didn't have to rebase all of them)

An important use case for `SourceNode`s, and especially for
`SourceNode.fromStringWithSourceMap`, is to concatenate files with
source map support. This works well as long as all the input source maps
and the concatenated file¿s source map are next to each other. That’s
because any relative source paths in any input source map have to be
rewritten to be relative to the concatenated file’s source map. This
commit adds a third parameter to `SourceNode.fromStringWithSourceMap`
allowing you to do this.
@lydell

lydell commented Jun 26, 2014

Copy link
Copy Markdown
Contributor Author

Rebased.

@fitzgen

fitzgen commented Jun 26, 2014

Copy link
Copy Markdown
Contributor

Fixed in 6be13d9

@fitzgen fitzgen closed this Jun 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants