You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In TypeScript, there are three compiler options that relate to source maps:
sourceMap, which controls whether external source maps should be emitted
inlineSourceMap, which controls whether inline source maps should be emitted
inlineSources, which controls whether the original source code should be embedded in the source maps
There are interplay and incompatibilities between these options. Those are not properly taken into account in deno_emit.
I first encountered this when working on #98, which is meant to solve a few source map issues. I found that deno_emit sets inlineSourceMap to true by default and pretty much ignores everything else until it is manually set to false.
I ran a program that automatically runs deno bundle, tsc and deno_emit on the same module for all combinations of the aforementioned options and looked at the output. The results are reported in the table below.
My proposal: I think deno_emit should follow the behavior of tsc. By default this will also match deno bundle as deno bundle never emits source maps and tsc doesn't when no options are provided.
Legend:
⬜️: no source map
🔳: inline source map
🔲: external source map
❌: errors
sourceMap
inlineSourceMap
inlineSources
deno bundle
tsc
deno_emit¹
not set
not set
not set
⬜️
⬜️
🔳
true
not set
not set
⬜️
🔲
🔳
false
not set
not set
⬜️
⬜️
🔳
not set
true
not set
⬜️
🔳
🔳
not set
false
not set
⬜️
⬜️
⬜️
true
true
not set
⬜️
❌²
🔳
true
false
not set
⬜️
🔲
🔲
false
true
not set
⬜️
🔳
🔳
false
false
not set
⬜️
⬜️
⬜️
not set
not set
true
⬜️
❌³
🔳
not set
not set
false
⬜️
⬜️
🔳
true
not set
true
⬜️
🔲
🔳
true
not set
false
⬜️
🔲
🔳
false
not set
true
⬜️
❌³
🔳
false
not set
false
⬜️
⬜️
🔳
not set
true
true
⬜️
🔳
🔳
not set
true
false
⬜️
🔳
🔳
not set
false
true
⬜️
❌³
⬜️
not set
false
false
⬜️
⬜️
⬜️
true
true
true
⬜️
❌²
🔳
true
true
false
⬜️
❌²
🔳
true
false
true
⬜️
🔲
🔲
true
false
false
⬜️
🔲
🔲
false
true
true
⬜️
🔳
🔳
false
true
false
⬜️
🔳
🔳
false
false
true
⬜️
❌³
⬜️
false
false
false
⬜️
⬜️
⬜️
¹ The output of bundle() in deno_emit; this is assuming that the compiler options are properly forwarded, per #98, as the current version always emit inline source maps.
² error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
³ error TS5051: Option 'inlineSources can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.
The text was updated successfully, but these errors were encountered:
I think deno_emit should follow the behavior of tsc. By default this will also match deno bundle as deno bundle never emits source maps and tsc doesn't when no options are provided.
@dsherret What do you think? I have already written the tests to ensure this. Waiting for a go to implement.
In TypeScript, there are three compiler options that relate to source maps:
sourceMap
, which controls whether external source maps should be emittedinlineSourceMap
, which controls whether inline source maps should be emittedinlineSources
, which controls whether the original source code should be embedded in the source mapsThere are interplay and incompatibilities between these options. Those are not properly taken into account in
deno_emit
.I first encountered this when working on #98, which is meant to solve a few source map issues. I found that
deno_emit
setsinlineSourceMap
totrue
by default and pretty much ignores everything else until it is manually set tofalse
.I suggested that
deno_emit
stop emitting inline source maps by default; @dsherret told me that, if it changes, then it is preferable for the default behavior to be consistent withdeno bundle
, until it is properly sunset.I ran a program that automatically runs
deno bundle
,tsc
anddeno_emit
on the same module for all combinations of the aforementioned options and looked at the output. The results are reported in the table below.My proposal: I think
deno_emit
should follow the behavior oftsc
. By default this will also matchdeno bundle
asdeno bundle
never emits source maps andtsc
doesn't when no options are provided.Legend:
sourceMap
inlineSourceMap
inlineSources
deno bundle
tsc
deno_emit
¹true
false
true
false
true
true
true
false
false
true
false
false
true
false
true
true
true
false
false
true
false
false
true
true
true
false
false
true
false
false
true
true
true
true
true
false
true
false
true
true
false
false
false
true
true
false
true
false
false
false
true
false
false
false
¹ The output of
bundle()
indeno_emit
; this is assuming that the compiler options are properly forwarded, per #98, as the current version always emit inline source maps.² error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
³ error TS5051: Option 'inlineSources can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.
The text was updated successfully, but these errors were encountered: