-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Some missing source maps variants and options in TypeScript compiler #2887
Comments
What are some of those use cases?
While this is an interesting suggestion, it springs two questions:
This sounds interesting; when is this handy?
I believe this is being covered in #2484. |
I think this is not so useful anymore both for the SASS and TS project. It was a hack to support "source map" in browsers, before source map got standardized and used widely.
I guess the use case here is by supporting referencing by HTTP header |
sourceMapEmbed is also covered by #2484. |
sourceComments --> how would u uses this? |
Interesting; here's the relevant part of the spec:
Are there any actual advantages between one or the other though? |
@DanielRosenwasser I can't see any advantages. |
then why even bother commenting here? @tinganho, if you try hard, you can dismiss about any argument in the world. Try the other way around and find the reason and perhaps some solace in life. So take it easy! Advantages: sourceComments:
omitSourceMapUrl:Zoon-out and think beyond web browser.
If there is no such option to prevent omit sourceMappingURL generation, like present, then this is what happens:
I think similar extensions for sublime are also doing the same thing. Another user-case is, if you are building a production release, and you don't want to emit source-mapping-url, but still want to generate maps for future reference. This one is weak, and many will start advocating against it, but we use it in our environment and it helps! sourceMapContents:Your source files are inaccessible from network and browser can't reach it, enabling this option will prevent browser from loading individual sources. sourceMapEmbed:If you are the bundle-lover; and hate browser loading extra stuff after the fact, you will probably be the heaviest user of this option. It packs the mapping info into the generated code. Enabling source-map-content with this option even saves more file loading! |
Let's all take it easy - I think we can agree that everybody here has quality in mind for TypeScript. 😄
I'm still not personally sold on I'm admittedly on the fence on |
regarding omitSourceMapURL i am still not clear about the value of adding this option. the web essential scenario you list above is better achieved using the compiler API to generate these. i think this is what you want to do generally. I will have to see more compelling scenarios to be convinced. as for, sourceComments, we will have to decline this request. We put a lot of effort to make sure the output code is similar to the input as much as possible. This has been one of the TypeScript axioms from the beginning and still is. Even with renamed variables or generate temporary names, the compiler bases them on user defined variables to make sure the generate .js code is readable and recognizable. For debugging, TypeScript has supported source maps since 0.8 time. and almost all browsers and developer tools do support them as well; so i do not see the need for yet another form of mapping. |
The only exception being one cannot figure out to which file, certain portion of generated source belongs. |
that is a different request then.. you want a comment with the original file name when using --out. is this accurate? |
It is related to |
Still not convinced :) |
@jasonwilliams200OK I'm trying to have a meaningful discussion :). Also you know that those comments where invented because there weren't anyway to map compiled CSS code to the original SASS code. Then, developers saw a huge demand for source map and almost every source map vendor adopted it. So in other words, source map deprecates those comments. |
Please consider the following in your on going efforts:
From node-sass readme https://github.com/sass/node-sass/#sourcecomments:
omitSourceMapUrl
Type:
Boolean
Default:false
true
values disable the inclusion of source map information in the output file.sourceComments
Type:
Boolean
Default:false
true
enables additional debugging information in the output file as CSS commentssourceMapContents
Type:
Boolean
Default:false
true
includes thecontents
in the source map informationsourceMapEmbed
Type:
Boolean
Default:false
true
embeds the source map as a data URINotes:
omitSourceMapUrl
sounds crazy, but there really are use cases when you want the transpiler to generate.map
file while ignoring thesourceMappingURI
in JS.With
sourceComments
, it does not generate the real, cryptic source-maps, but instead put a comment on each line like/* Line: _, Column:_, File:_ */
in generated code pointing to the source file. Turning on this option has no effect on regular source-map; both options can be enabled and hence the map file produced also keep the line comments into consideration (both can be generated in parallel with little trickery, as you can preemptively determine where the debug comments will appear).sourceMapContents
: this embeds contents of all source (.ts) files in .map ascontents
array. The order of this array corresponds tosources
array.sourceMapEmbed
: compiler generates the source-maps in-memory and instead of stamping out to.map
file, it applies the base64 text encoding and append it as a value ofsourceMappingURI
.The text was updated successfully, but these errors were encountered: