@jsenv/core 38.0.3 → 38.0.5
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 +37 -27
- package/package.json +9 -9
- package/src/build/build.js +14 -6
- package/src/build/build_urls_generator.js +6 -1
package/dist/jsenv_core.js
CHANGED
|
@@ -400,13 +400,28 @@ const injectQueryParams = (url, params) => {
|
|
|
400
400
|
const urlWithParams = urlObject.href;
|
|
401
401
|
return normalizeUrl(urlWithParams);
|
|
402
402
|
};
|
|
403
|
+
|
|
404
|
+
const injectQueryParamWithoutEncoding = (url, key, value) => {
|
|
405
|
+
const urlObject = new URL(url);
|
|
406
|
+
let { origin, pathname, search, hash } = urlObject;
|
|
407
|
+
// origin is "null" for "file://" urls with Node.js
|
|
408
|
+
if (origin === "null" && urlObject.href.startsWith("file:")) {
|
|
409
|
+
origin = "file://";
|
|
410
|
+
}
|
|
411
|
+
if (search === "") {
|
|
412
|
+
search = `?${key}=${value}`;
|
|
413
|
+
} else {
|
|
414
|
+
search += `${key}=${value}`;
|
|
415
|
+
}
|
|
416
|
+
return `${origin}${pathname}${search}${hash}`;
|
|
417
|
+
};
|
|
403
418
|
const injectQueryParamIntoSpecifierWithoutEncoding = (
|
|
404
419
|
specifier,
|
|
405
420
|
key,
|
|
406
421
|
value,
|
|
407
422
|
) => {
|
|
408
423
|
if (isValidUrl$1(specifier)) {
|
|
409
|
-
return
|
|
424
|
+
return injectQueryParamWithoutEncoding(specifier, key, value);
|
|
410
425
|
}
|
|
411
426
|
const [beforeQuestion, afterQuestion = ""] = specifier.split("?");
|
|
412
427
|
const searchParams = new URLSearchParams(afterQuestion);
|
|
@@ -8258,19 +8273,6 @@ const versionToBits$2 = (version) => {
|
|
|
8258
8273
|
return (major << 16) | (minor << 8) | patch;
|
|
8259
8274
|
};
|
|
8260
8275
|
|
|
8261
|
-
/*
|
|
8262
|
-
* TODO:
|
|
8263
|
-
* js classic might contain importScripts or self.importScripts calls
|
|
8264
|
-
* (when it's inside worker, service worker, etc...)
|
|
8265
|
-
* ideally we should bundle it when urlInfo.subtype === "worker"
|
|
8266
|
-
*/
|
|
8267
|
-
|
|
8268
|
-
// import { createMagicSource } from "@jsenv/utils/sourcemap/magic_source.js"
|
|
8269
|
-
|
|
8270
|
-
const bundleJsClassic = () => {
|
|
8271
|
-
return {};
|
|
8272
|
-
};
|
|
8273
|
-
|
|
8274
8276
|
const bundleJsModules = async (
|
|
8275
8277
|
jsModuleUrlInfos,
|
|
8276
8278
|
{
|
|
@@ -8707,11 +8709,6 @@ const jsenvPluginBundling = ({
|
|
|
8707
8709
|
return bundleCss(cssUrlInfos);
|
|
8708
8710
|
};
|
|
8709
8711
|
}
|
|
8710
|
-
if (js_classic) {
|
|
8711
|
-
bundle.js_classic = (jsClassicUrlInfos) => {
|
|
8712
|
-
return bundleJsClassic();
|
|
8713
|
-
};
|
|
8714
|
-
}
|
|
8715
8712
|
if (js_module) {
|
|
8716
8713
|
if (js_module === true) {
|
|
8717
8714
|
js_module = {};
|
|
@@ -9231,7 +9228,7 @@ export default inlineContent.text;`,
|
|
|
9231
9228
|
*
|
|
9232
9229
|
*/
|
|
9233
9230
|
const babelHelperClientDirectoryUrl = new URL(
|
|
9234
|
-
"
|
|
9231
|
+
"./babel_helpers/",
|
|
9235
9232
|
import.meta.url,
|
|
9236
9233
|
).href;
|
|
9237
9234
|
|
|
@@ -19780,7 +19777,12 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
19780
19777
|
return buildUrlFromCache;
|
|
19781
19778
|
}
|
|
19782
19779
|
if (urlInfo.type === "directory") {
|
|
19783
|
-
|
|
19780
|
+
let directoryPath;
|
|
19781
|
+
if (urlInfo.filenameHint) {
|
|
19782
|
+
directoryPath = urlInfo.filenameHint;
|
|
19783
|
+
} else {
|
|
19784
|
+
directoryPath = urlToRelativeUrl(url, sourceDirectoryUrl);
|
|
19785
|
+
}
|
|
19784
19786
|
const { search } = new URL(url);
|
|
19785
19787
|
const buildUrl = `${buildDirectoryUrl}${directoryPath}${search}`;
|
|
19786
19788
|
associateBuildUrl(url, buildUrl);
|
|
@@ -21356,9 +21358,17 @@ build "${entryPointKeys[0]}"`);
|
|
|
21356
21358
|
logger.info(`
|
|
21357
21359
|
build ${entryPointKeys.length} entry points`);
|
|
21358
21360
|
}
|
|
21359
|
-
|
|
21360
|
-
|
|
21361
|
-
|
|
21361
|
+
let explicitJsModuleConversion = false;
|
|
21362
|
+
for (const entryPointKey of entryPointKeys) {
|
|
21363
|
+
if (entryPointKey.includes("?js_module_fallback")) {
|
|
21364
|
+
explicitJsModuleConversion = true;
|
|
21365
|
+
break;
|
|
21366
|
+
}
|
|
21367
|
+
if (entryPointKey.includes("?as_js_classic")) {
|
|
21368
|
+
explicitJsModuleConversion = true;
|
|
21369
|
+
break;
|
|
21370
|
+
}
|
|
21371
|
+
}
|
|
21362
21372
|
const rawRedirections = new Map();
|
|
21363
21373
|
const entryUrls = [];
|
|
21364
21374
|
const contextSharedDuringBuild = {
|
|
@@ -21403,7 +21413,7 @@ build ${entryPointKeys.length} entry points`);
|
|
|
21403
21413
|
magicDirectoryIndex,
|
|
21404
21414
|
directoryReferenceAllowed,
|
|
21405
21415
|
transpilation: {
|
|
21406
|
-
babelHelpersAsImport: !
|
|
21416
|
+
babelHelpersAsImport: !explicitJsModuleConversion,
|
|
21407
21417
|
...transpilation,
|
|
21408
21418
|
jsModuleFallback: false,
|
|
21409
21419
|
},
|
|
@@ -21472,8 +21482,8 @@ build ${entryPointKeys.length} entry points`);
|
|
|
21472
21482
|
? [jsenvPluginLineBreakNormalization()]
|
|
21473
21483
|
: []),
|
|
21474
21484
|
jsenvPluginJsModuleFallback({
|
|
21475
|
-
remapImportSpecifier: (specifier) => {
|
|
21476
|
-
return buildSpecifierManager.remapPlaceholder(specifier);
|
|
21485
|
+
remapImportSpecifier: (specifier, parentUrl) => {
|
|
21486
|
+
return buildSpecifierManager.remapPlaceholder(specifier, parentUrl);
|
|
21477
21487
|
},
|
|
21478
21488
|
}),
|
|
21479
21489
|
jsenvPluginInlining(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "38.0.
|
|
3
|
+
"version": "38.0.5",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -61,22 +61,22 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
63
63
|
"@jsenv/abort": "4.2.4",
|
|
64
|
-
"@jsenv/ast": "5.1.
|
|
65
|
-
"@jsenv/filesystem": "4.2.
|
|
64
|
+
"@jsenv/ast": "5.1.1",
|
|
65
|
+
"@jsenv/filesystem": "4.2.6",
|
|
66
66
|
"@jsenv/importmap": "1.2.1",
|
|
67
67
|
"@jsenv/integrity": "0.0.1",
|
|
68
68
|
"@jsenv/log": "3.4.0",
|
|
69
69
|
"@jsenv/node-esm-resolution": "1.0.1",
|
|
70
|
-
"@jsenv/js-module-fallback": "1.3.
|
|
70
|
+
"@jsenv/js-module-fallback": "1.3.2",
|
|
71
71
|
"@jsenv/runtime-compat": "1.2.0",
|
|
72
72
|
"@jsenv/server": "15.1.0",
|
|
73
|
-
"@jsenv/sourcemap": "1.2.
|
|
74
|
-
"@jsenv/plugin-bundling": "2.5.
|
|
73
|
+
"@jsenv/sourcemap": "1.2.1",
|
|
74
|
+
"@jsenv/plugin-bundling": "2.5.1",
|
|
75
75
|
"@jsenv/plugin-minification": "1.5.0",
|
|
76
|
-
"@jsenv/plugin-transpilation": "1.3.
|
|
77
|
-
"@jsenv/plugin-supervisor": "1.3.
|
|
76
|
+
"@jsenv/plugin-transpilation": "1.3.1",
|
|
77
|
+
"@jsenv/plugin-supervisor": "1.3.1",
|
|
78
78
|
"@jsenv/url-meta": "8.1.0",
|
|
79
|
-
"@jsenv/urls": "2.2.
|
|
79
|
+
"@jsenv/urls": "2.2.1",
|
|
80
80
|
"@jsenv/utils": "2.0.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
package/src/build/build.js
CHANGED
|
@@ -237,9 +237,17 @@ build "${entryPointKeys[0]}"`);
|
|
|
237
237
|
logger.info(`
|
|
238
238
|
build ${entryPointKeys.length} entry points`);
|
|
239
239
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
let explicitJsModuleConversion = false;
|
|
241
|
+
for (const entryPointKey of entryPointKeys) {
|
|
242
|
+
if (entryPointKey.includes("?js_module_fallback")) {
|
|
243
|
+
explicitJsModuleConversion = true;
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
if (entryPointKey.includes("?as_js_classic")) {
|
|
247
|
+
explicitJsModuleConversion = true;
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
243
251
|
const rawRedirections = new Map();
|
|
244
252
|
const entryUrls = [];
|
|
245
253
|
const contextSharedDuringBuild = {
|
|
@@ -284,7 +292,7 @@ build ${entryPointKeys.length} entry points`);
|
|
|
284
292
|
magicDirectoryIndex,
|
|
285
293
|
directoryReferenceAllowed,
|
|
286
294
|
transpilation: {
|
|
287
|
-
babelHelpersAsImport: !
|
|
295
|
+
babelHelpersAsImport: !explicitJsModuleConversion,
|
|
288
296
|
...transpilation,
|
|
289
297
|
jsModuleFallback: false,
|
|
290
298
|
},
|
|
@@ -353,8 +361,8 @@ build ${entryPointKeys.length} entry points`);
|
|
|
353
361
|
? [jsenvPluginLineBreakNormalization()]
|
|
354
362
|
: []),
|
|
355
363
|
jsenvPluginJsModuleFallback({
|
|
356
|
-
remapImportSpecifier: (specifier) => {
|
|
357
|
-
return buildSpecifierManager.remapPlaceholder(specifier);
|
|
364
|
+
remapImportSpecifier: (specifier, parentUrl) => {
|
|
365
|
+
return buildSpecifierManager.remapPlaceholder(specifier, parentUrl);
|
|
358
366
|
},
|
|
359
367
|
}),
|
|
360
368
|
jsenvPluginInlining(),
|
|
@@ -34,7 +34,12 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
34
34
|
return buildUrlFromCache;
|
|
35
35
|
}
|
|
36
36
|
if (urlInfo.type === "directory") {
|
|
37
|
-
|
|
37
|
+
let directoryPath;
|
|
38
|
+
if (urlInfo.filenameHint) {
|
|
39
|
+
directoryPath = urlInfo.filenameHint;
|
|
40
|
+
} else {
|
|
41
|
+
directoryPath = urlToRelativeUrl(url, sourceDirectoryUrl);
|
|
42
|
+
}
|
|
38
43
|
const { search } = new URL(url);
|
|
39
44
|
const buildUrl = `${buildDirectoryUrl}${directoryPath}${search}`;
|
|
40
45
|
associateBuildUrl(url, buildUrl);
|