@@ -1185,7 +1185,7 @@ export class Application {
1185
1185
1186
1186
/** check compilation side-effect caused by dependency graph. */
1187
1187
private async checkCompilationSideEffect ( url : string , callback ?: ( mod : Module ) => void ) {
1188
- const { hash, sourceHash } = this . #modules. get ( url ) !
1188
+ const { hash } = this . #modules. get ( url ) !
1189
1189
1190
1190
for ( const mod of this . #modules. values ( ) ) {
1191
1191
for ( const dep of mod . deps ) {
@@ -1204,22 +1204,18 @@ export class Application {
1204
1204
}
1205
1205
return s
1206
1206
} )
1207
- let bundlingJS : string | null = null
1208
- if ( mod . bundlingFile && existsFileSync ( mod . bundlingFile ) ) {
1209
- bundlingJS = await Deno . readTextFile ( mod . bundlingFile )
1210
- bundlingJS = bundlingJS . replace ( reHashResolve , ( s , key , spaces , ql , importPath , qr ) => {
1211
- if ( importPath . replace ( reHashJs , '' ) === relativePath ) {
1212
- return `${ key } ${ spaces } ${ ql } ${ relativePath } .${ util . shortHash ( sourceHash ) } .js${ qr } `
1213
- }
1214
- return s
1215
- } )
1216
- }
1217
1207
let sourceMap : string | null = null
1218
1208
if ( existsFileSync ( mod . jsFile + '.map' ) ) {
1219
1209
sourceMap = Deno . readTextFileSync ( mod . jsFile + '.map' )
1220
1210
}
1221
1211
mod . hash = computeHash ( jsContent + buildChecksum )
1222
1212
mod . jsFile = `${ mod . jsFile . replace ( reHashJs , '' ) } .${ util . shortHash ( mod . hash ) } .js`
1213
+ jsContent = jsContent . split ( '\n' ) . map ( line => {
1214
+ if ( line . startsWith ( '//# sourceMappingURL=' ) ) {
1215
+ return `//# sourceMappingURL=${ path . basename ( mod . jsFile ) . replace ( reHashJs , '' ) } .${ util . shortHash ( mod . hash ) } .js.map`
1216
+ }
1217
+ return line
1218
+ } ) . join ( '\n' )
1223
1219
await cleanupCompilation ( mod . jsFile )
1224
1220
await Promise . all ( [
1225
1221
ensureTextFile ( mod . jsFile . replace ( reHashJs , '' ) + '.meta.json' , JSON . stringify ( {
@@ -1229,7 +1225,6 @@ export class Application {
1229
1225
deps : mod . deps ,
1230
1226
} , undefined , 4 ) ) ,
1231
1227
ensureTextFile ( mod . jsFile , jsContent ) ,
1232
- bundlingJS ? ensureTextFile ( mod . bundlingFile , bundlingJS ) : Promise . resolve ( ) ,
1233
1228
sourceMap ? ensureTextFile ( mod . jsFile + '.map' , sourceMap ) : Promise . resolve ( ) ,
1234
1229
] )
1235
1230
callback && callback ( mod )
0 commit comments