Skip to content

Add a third parameter to SourceNode.fromStringWithSourceMap #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

lydell
Copy link
Contributor

@lydell lydell commented Mar 14, 2014

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
Copy link
Contributor Author

lydell commented Mar 23, 2014

I use this PR in source-map-concat.

@@ -116,6 +118,9 @@ define(function (require, exports, module) {
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content) {
if (aRelativePath) {
Copy link
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
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
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
Copy link
Contributor

fitzgen commented Jun 2, 2014

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

@lydell
Copy link
Contributor Author

lydell commented Jun 15, 2014

Fixed.

@fitzgen
Copy link
Contributor

fitzgen commented Jun 25, 2014

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
Copy link
Contributor Author

lydell commented Jun 26, 2014

Rebased.

@fitzgen
Copy link
Contributor

fitzgen commented Jun 26, 2014

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