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
support non-inline sourcemaps #7
Comments
I'm running into a similar issue with my plug-in into the mimosa build system The non-inline input source maps get ignored. Input that uses the new sourcemap syntax ( |
I created mold-source-map to give you more power over sourcemaps.
The scope of combine sourcemap is limited, so converting non-inline to inline should be done in a separate module. Once that module exists we have the option to have combine-source-map call into it, but am not sure if it should even do that at all. IMO, instead of combine-source-map having any part in that at all, that should be done by running each file through that module before it reaches combine-source-map so it can do exactly and only what it is designed for combine the source maps. |
Then it probably should not try to attempt parsing comment at all (what about CSS maps - '/*# map */`?) var fooFile = {
source: '(function() {\n\n console.log(require(\'./bar.js\'));\n\n}).call(this);\n' + '\n' + fooComment
, sourceFile: 'foo.js'
, map: fooMapObj // somebody else created map or extracted from comment.
// It's also somebody else's responsibility to strip comment
};
var barFile = {
source: '(function() {\n\n console.log(alert(\'alerts suck\'));\n\n}).call(this);\n' + '\n' + barComment
, sourceFile: 'bar.js'
, map: barMapObj
};
var offset = { line: 2 };
var base64 = combine
.create('bundle.js')
.addFile(fooFile, offset)
.addFile(barFile, { line: offset.line + 8 })
.base64(); |
@sidorares keep in mind that this was created for source maps adhering to the source map v3 proposal. The CSS maps you are mentioning don't look like they follow that standard. This module is quite small and I want to keep its focus on standard source maps, so I'd suggest you create a separate module that works with CSS source maps. You probably want to start by creating a CSS source map version of convert-source-map. |
The map itself in CSS is the same v3 standard see page 7:
My point is this module should just combine v3 maps (no matter if it's js or css), and not attempt to parse comments. There is no need for separate CSS combiner, maps format is identical to js sourcemap |
Ah, I see your problem now, the CSS sourcemap is using the newer However so far I have been reluctant to switch over to this upgraded version since it's not implemented in enough browsers yet (Chrome even removed a warning about upgrading recently). Additionally most source map generators still generate sourcemap comment according to the initial spec (with the |
The involved modules have been updated to the latest specs. I hope this fixes your problem, see here. I'm also working on properly removing source map file comments. This change will land as a patch to convert-source-map and combine-source-map within the next day or so. |
So with your update non-inline sourcmaps will be just ignored? |
My use case: I'm trying to use spine with browserify, and resulting bundle contains multiple original non-inline sourcemap comments instead of expected one combined inline. Example compiled js and map files: spine/lib
My current workaround - preprocess generated files and convert non-inline maps to inline. I'm using https://github.com/sidorares/embed-source-map
Ideally this should be handled by combine-source-map without external preprocessing
The text was updated successfully, but these errors were encountered: