@jsenv/core 38.0.2 → 38.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/jsenv_core.js
CHANGED
|
@@ -12327,6 +12327,7 @@ const createUrlInfo = (url, context) => {
|
|
|
12327
12327
|
|
|
12328
12328
|
sourcemap: null,
|
|
12329
12329
|
sourcemapIsWrong: false,
|
|
12330
|
+
sourcemapReference: null,
|
|
12330
12331
|
|
|
12331
12332
|
generatedUrl: null,
|
|
12332
12333
|
sourcemapGeneratedUrl: null,
|
|
@@ -13101,14 +13102,10 @@ const createUrlInfoTransformer = ({
|
|
|
13101
13102
|
sourcemapsComment,
|
|
13102
13103
|
sourcemapsSources,
|
|
13103
13104
|
sourcemapsSourcesProtocol,
|
|
13104
|
-
sourcemapsSourcesContent,
|
|
13105
|
+
sourcemapsSourcesContent = true,
|
|
13105
13106
|
outDirectoryUrl,
|
|
13106
13107
|
supervisor,
|
|
13107
13108
|
}) => {
|
|
13108
|
-
if (sourcemapsSourcesContent === undefined) {
|
|
13109
|
-
sourcemapsSourcesContent = true;
|
|
13110
|
-
}
|
|
13111
|
-
|
|
13112
13109
|
const formatSourcemapSource =
|
|
13113
13110
|
typeof sourcemapsSources === "function"
|
|
13114
13111
|
? (source, urlInfo) => {
|
|
@@ -13167,6 +13164,7 @@ const createUrlInfoTransformer = ({
|
|
|
13167
13164
|
urlInfo.content = undefined;
|
|
13168
13165
|
urlInfo.sourcemap = null;
|
|
13169
13166
|
urlInfo.sourcemapIsWrong = null;
|
|
13167
|
+
urlInfo.sourcemapReference = null;
|
|
13170
13168
|
};
|
|
13171
13169
|
|
|
13172
13170
|
const setContentProperties = (
|
|
@@ -13231,6 +13229,10 @@ const createUrlInfoTransformer = ({
|
|
|
13231
13229
|
generatedUrlObject.searchParams.delete("js_module_fallback");
|
|
13232
13230
|
generatedUrlObject.searchParams.delete("as_js_module");
|
|
13233
13231
|
generatedUrlObject.searchParams.delete("as_js_classic");
|
|
13232
|
+
generatedUrlObject.searchParams.delete("as_css_module");
|
|
13233
|
+
generatedUrlObject.searchParams.delete("as_json_module");
|
|
13234
|
+
generatedUrlObject.searchParams.delete("as_text_module");
|
|
13235
|
+
generatedUrlObject.searchParams.delete("dynamic_import");
|
|
13234
13236
|
const urlForSourcemap = generatedUrlObject.href;
|
|
13235
13237
|
urlInfo.sourcemapGeneratedUrl = generateSourcemapFileUrl(urlForSourcemap);
|
|
13236
13238
|
|
|
@@ -13257,6 +13259,7 @@ const createUrlInfoTransformer = ({
|
|
|
13257
13259
|
specifierLine: line,
|
|
13258
13260
|
specifierColumn: column,
|
|
13259
13261
|
});
|
|
13262
|
+
urlInfo.sourcemapReference = sourcemapReference;
|
|
13260
13263
|
try {
|
|
13261
13264
|
await sourcemapReference.urlInfo.cook();
|
|
13262
13265
|
const sourcemapRaw = JSON.parse(sourcemapReference.urlInfo.content);
|
|
@@ -13370,11 +13373,11 @@ const createUrlInfoTransformer = ({
|
|
|
13370
13373
|
if (!contentIsInlined) {
|
|
13371
13374
|
writeFileSync(new URL(generatedUrl), urlInfo.content);
|
|
13372
13375
|
}
|
|
13373
|
-
const { sourcemapGeneratedUrl,
|
|
13374
|
-
if (sourcemapGeneratedUrl &&
|
|
13376
|
+
const { sourcemapGeneratedUrl, sourcemapReference } = urlInfo;
|
|
13377
|
+
if (sourcemapGeneratedUrl && sourcemapReference) {
|
|
13375
13378
|
writeFileSync(
|
|
13376
13379
|
new URL(sourcemapGeneratedUrl),
|
|
13377
|
-
|
|
13380
|
+
sourcemapReference.urlInfo.content,
|
|
13378
13381
|
);
|
|
13379
13382
|
}
|
|
13380
13383
|
};
|
|
@@ -13393,25 +13396,28 @@ const createUrlInfoTransformer = ({
|
|
|
13393
13396
|
// in this scenarion we don't want to inject sourcemap reference
|
|
13394
13397
|
// just update the content
|
|
13395
13398
|
|
|
13396
|
-
let sourcemapReference =
|
|
13397
|
-
for (const referenceToOther of urlInfo.referenceToOthersSet) {
|
|
13398
|
-
if (referenceToOther.type === "sourcemap_comment") {
|
|
13399
|
-
sourcemapReference = referenceToOther;
|
|
13400
|
-
break;
|
|
13401
|
-
}
|
|
13402
|
-
}
|
|
13399
|
+
let sourcemapReference = urlInfo.sourcemapReference;
|
|
13403
13400
|
if (!sourcemapReference) {
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
}
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13401
|
+
for (const referenceToOther of urlInfo.referenceToOthersSet) {
|
|
13402
|
+
if (referenceToOther.type === "sourcemap_comment") {
|
|
13403
|
+
sourcemapReference = referenceToOther;
|
|
13404
|
+
break;
|
|
13405
|
+
}
|
|
13406
|
+
}
|
|
13407
|
+
if (!sourcemapReference) {
|
|
13408
|
+
sourcemapReference = urlInfo.dependencies.inject({
|
|
13409
|
+
trace: {
|
|
13410
|
+
message: `sourcemap comment placeholder`,
|
|
13411
|
+
url: urlInfo.url,
|
|
13412
|
+
},
|
|
13413
|
+
type: "sourcemap_comment",
|
|
13414
|
+
subtype: urlInfo.contentType === "text/javascript" ? "js" : "css",
|
|
13415
|
+
expectedType: "sourcemap",
|
|
13416
|
+
specifier: urlInfo.sourcemapGeneratedUrl,
|
|
13417
|
+
isInline: sourcemaps === "inline",
|
|
13418
|
+
});
|
|
13419
|
+
}
|
|
13420
|
+
urlInfo.sourcemapReference = sourcemapReference;
|
|
13415
13421
|
}
|
|
13416
13422
|
const sourcemapUrlInfo = sourcemapReference.urlInfo;
|
|
13417
13423
|
// It's possible urlInfo content to be modified after being finalized
|
|
@@ -14324,6 +14330,9 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
|
|
|
14324
14330
|
|
|
14325
14331
|
// urlInfo objects are reused, they must be "reset" before cooking them again
|
|
14326
14332
|
if (urlInfo.error || urlInfo.content !== undefined) {
|
|
14333
|
+
if (urlInfo.isInline) {
|
|
14334
|
+
return;
|
|
14335
|
+
}
|
|
14327
14336
|
urlInfo.error = null;
|
|
14328
14337
|
urlInfo.type = null;
|
|
14329
14338
|
urlInfo.subtype = null;
|
package/package.json
CHANGED
package/src/kitchen/kitchen.js
CHANGED
|
@@ -456,6 +456,9 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
|
|
|
456
456
|
|
|
457
457
|
// urlInfo objects are reused, they must be "reset" before cooking them again
|
|
458
458
|
if (urlInfo.error || urlInfo.content !== undefined) {
|
|
459
|
+
if (urlInfo.isInline) {
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
459
462
|
urlInfo.error = null;
|
|
460
463
|
urlInfo.type = null;
|
|
461
464
|
urlInfo.subtype = null;
|
|
@@ -18,14 +18,10 @@ export const createUrlInfoTransformer = ({
|
|
|
18
18
|
sourcemapsComment,
|
|
19
19
|
sourcemapsSources,
|
|
20
20
|
sourcemapsSourcesProtocol,
|
|
21
|
-
sourcemapsSourcesContent,
|
|
21
|
+
sourcemapsSourcesContent = true,
|
|
22
22
|
outDirectoryUrl,
|
|
23
23
|
supervisor,
|
|
24
24
|
}) => {
|
|
25
|
-
if (sourcemapsSourcesContent === undefined) {
|
|
26
|
-
sourcemapsSourcesContent = true;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
25
|
const formatSourcemapSource =
|
|
30
26
|
typeof sourcemapsSources === "function"
|
|
31
27
|
? (source, urlInfo) => {
|
|
@@ -84,6 +80,7 @@ export const createUrlInfoTransformer = ({
|
|
|
84
80
|
urlInfo.content = undefined;
|
|
85
81
|
urlInfo.sourcemap = null;
|
|
86
82
|
urlInfo.sourcemapIsWrong = null;
|
|
83
|
+
urlInfo.sourcemapReference = null;
|
|
87
84
|
};
|
|
88
85
|
|
|
89
86
|
const setContentProperties = (
|
|
@@ -148,6 +145,10 @@ export const createUrlInfoTransformer = ({
|
|
|
148
145
|
generatedUrlObject.searchParams.delete("js_module_fallback");
|
|
149
146
|
generatedUrlObject.searchParams.delete("as_js_module");
|
|
150
147
|
generatedUrlObject.searchParams.delete("as_js_classic");
|
|
148
|
+
generatedUrlObject.searchParams.delete("as_css_module");
|
|
149
|
+
generatedUrlObject.searchParams.delete("as_json_module");
|
|
150
|
+
generatedUrlObject.searchParams.delete("as_text_module");
|
|
151
|
+
generatedUrlObject.searchParams.delete("dynamic_import");
|
|
151
152
|
const urlForSourcemap = generatedUrlObject.href;
|
|
152
153
|
urlInfo.sourcemapGeneratedUrl = generateSourcemapFileUrl(urlForSourcemap);
|
|
153
154
|
|
|
@@ -174,6 +175,7 @@ export const createUrlInfoTransformer = ({
|
|
|
174
175
|
specifierLine: line,
|
|
175
176
|
specifierColumn: column,
|
|
176
177
|
});
|
|
178
|
+
urlInfo.sourcemapReference = sourcemapReference;
|
|
177
179
|
try {
|
|
178
180
|
await sourcemapReference.urlInfo.cook();
|
|
179
181
|
const sourcemapRaw = JSON.parse(sourcemapReference.urlInfo.content);
|
|
@@ -287,11 +289,11 @@ export const createUrlInfoTransformer = ({
|
|
|
287
289
|
if (!contentIsInlined) {
|
|
288
290
|
writeFileSync(new URL(generatedUrl), urlInfo.content);
|
|
289
291
|
}
|
|
290
|
-
const { sourcemapGeneratedUrl,
|
|
291
|
-
if (sourcemapGeneratedUrl &&
|
|
292
|
+
const { sourcemapGeneratedUrl, sourcemapReference } = urlInfo;
|
|
293
|
+
if (sourcemapGeneratedUrl && sourcemapReference) {
|
|
292
294
|
writeFileSync(
|
|
293
295
|
new URL(sourcemapGeneratedUrl),
|
|
294
|
-
|
|
296
|
+
sourcemapReference.urlInfo.content,
|
|
295
297
|
);
|
|
296
298
|
}
|
|
297
299
|
};
|
|
@@ -310,25 +312,28 @@ export const createUrlInfoTransformer = ({
|
|
|
310
312
|
// in this scenarion we don't want to inject sourcemap reference
|
|
311
313
|
// just update the content
|
|
312
314
|
|
|
313
|
-
let sourcemapReference =
|
|
314
|
-
for (const referenceToOther of urlInfo.referenceToOthersSet) {
|
|
315
|
-
if (referenceToOther.type === "sourcemap_comment") {
|
|
316
|
-
sourcemapReference = referenceToOther;
|
|
317
|
-
break;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
315
|
+
let sourcemapReference = urlInfo.sourcemapReference;
|
|
320
316
|
if (!sourcemapReference) {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
317
|
+
for (const referenceToOther of urlInfo.referenceToOthersSet) {
|
|
318
|
+
if (referenceToOther.type === "sourcemap_comment") {
|
|
319
|
+
sourcemapReference = referenceToOther;
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (!sourcemapReference) {
|
|
324
|
+
sourcemapReference = urlInfo.dependencies.inject({
|
|
325
|
+
trace: {
|
|
326
|
+
message: `sourcemap comment placeholder`,
|
|
327
|
+
url: urlInfo.url,
|
|
328
|
+
},
|
|
329
|
+
type: "sourcemap_comment",
|
|
330
|
+
subtype: urlInfo.contentType === "text/javascript" ? "js" : "css",
|
|
331
|
+
expectedType: "sourcemap",
|
|
332
|
+
specifier: urlInfo.sourcemapGeneratedUrl,
|
|
333
|
+
isInline: sourcemaps === "inline",
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
urlInfo.sourcemapReference = sourcemapReference;
|
|
332
337
|
}
|
|
333
338
|
const sourcemapUrlInfo = sourcemapReference.urlInfo;
|
|
334
339
|
// It's possible urlInfo content to be modified after being finalized
|