@jsenv/core 40.0.7 → 40.0.8
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/build/build.js +10684 -0
- package/dist/jsenv_core.js +24 -14
- package/dist/jsenv_core_packages.js +16773 -7081
- package/dist/{js → start_build_server}/start_build_server.js +6 -7
- package/dist/{plugins.js → start_dev_server/start_dev_server.js} +953 -25
- package/package.json +9 -9
- package/src/build/build.js +12 -14
- package/src/build/build_specifier_manager.js +4 -0
- package/src/build/build_urls_generator.js +4 -0
- package/src/build/jsenv_plugin_subbuilds.js +4 -0
- package/src/kitchen/out_directory_url.js +1 -0
- package/src/plugins/protocol_http/jsenv_plugin_protocol_http.js +6 -0
- package/src/plugins/reference_analysis/html/jsenv_plugin_html_reference_analysis.js +6 -1
- package/dist/js/build.js +0 -2636
- package/dist/js/start_dev_server.js +0 -840
- package/dist/main.js +0 -117
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "40.0.
|
|
3
|
+
"version": "40.0.8",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -78,22 +78,22 @@
|
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
80
80
|
"@jsenv/abort": "4.3.1",
|
|
81
|
-
"@jsenv/ast": "6.6.
|
|
82
|
-
"@jsenv/filesystem": "4.14.
|
|
81
|
+
"@jsenv/ast": "6.6.6",
|
|
82
|
+
"@jsenv/filesystem": "4.14.4",
|
|
83
83
|
"@jsenv/humanize": "1.3.1",
|
|
84
84
|
"@jsenv/importmap": "1.2.2",
|
|
85
85
|
"@jsenv/integrity": "0.0.2",
|
|
86
|
-
"@jsenv/js-module-fallback": "1.4.
|
|
86
|
+
"@jsenv/js-module-fallback": "1.4.4",
|
|
87
87
|
"@jsenv/node-esm-resolution": "1.1.0",
|
|
88
|
-
"@jsenv/plugin-bundling": "2.8.
|
|
88
|
+
"@jsenv/plugin-bundling": "2.8.5",
|
|
89
89
|
"@jsenv/plugin-minification": "1.6.2",
|
|
90
|
-
"@jsenv/plugin-supervisor": "1.6.
|
|
91
|
-
"@jsenv/plugin-transpilation": "1.5.
|
|
90
|
+
"@jsenv/plugin-supervisor": "1.6.11",
|
|
91
|
+
"@jsenv/plugin-transpilation": "1.5.7",
|
|
92
92
|
"@jsenv/runtime-compat": "1.3.4",
|
|
93
93
|
"@jsenv/server": "16.0.4",
|
|
94
|
-
"@jsenv/sourcemap": "1.3.
|
|
94
|
+
"@jsenv/sourcemap": "1.3.3",
|
|
95
95
|
"@jsenv/url-meta": "8.5.5",
|
|
96
|
-
"@jsenv/urls": "2.
|
|
96
|
+
"@jsenv/urls": "2.7.0",
|
|
97
97
|
"@jsenv/utils": "2.2.1",
|
|
98
98
|
"string-width": "7.2.0"
|
|
99
99
|
},
|
package/src/build/build.js
CHANGED
|
@@ -179,7 +179,7 @@ export const build = async ({
|
|
|
179
179
|
outDirectoryUrl = `${packageDirectoryUrl}.jsenv/`;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
} else if (outDirectoryUrl
|
|
182
|
+
} else if (outDirectoryUrl) {
|
|
183
183
|
outDirectoryUrl = assertAndNormalizeDirectoryUrl(
|
|
184
184
|
outDirectoryUrl,
|
|
185
185
|
"outDirectoryUrl",
|
|
@@ -307,6 +307,7 @@ build ${entryPointKeys.length} entry points`);
|
|
|
307
307
|
minification,
|
|
308
308
|
versioning,
|
|
309
309
|
versioningMethod,
|
|
310
|
+
outDirectoryUrl,
|
|
310
311
|
},
|
|
311
312
|
onCustomBuildDirectory: (subBuildRelativeUrl) => {
|
|
312
313
|
buildDirectoryCleanPatterns = {
|
|
@@ -528,30 +529,27 @@ build ${entryPointKeys.length} entry points`);
|
|
|
528
529
|
}
|
|
529
530
|
const referencedUrlInfo = referenceToOther.urlInfo;
|
|
530
531
|
if (referencedUrlInfo.isInline) {
|
|
531
|
-
if (referencedUrlInfo.type
|
|
532
|
-
|
|
533
|
-
referencedUrlInfo.referenceToOthersSet.forEach(
|
|
534
|
-
(jsModuleReferenceToOther) => {
|
|
535
|
-
if (jsModuleReferenceToOther.type === "js_import") {
|
|
536
|
-
const inlineUrlInfo = jsModuleReferenceToOther.urlInfo;
|
|
537
|
-
addToBundlerIfAny(inlineUrlInfo);
|
|
538
|
-
}
|
|
539
|
-
},
|
|
540
|
-
);
|
|
532
|
+
if (referencedUrlInfo.type !== "js_module") {
|
|
533
|
+
continue;
|
|
541
534
|
}
|
|
542
|
-
|
|
535
|
+
addToBundlerIfAny(referencedUrlInfo);
|
|
543
536
|
continue;
|
|
544
537
|
}
|
|
545
538
|
addToBundlerIfAny(referencedUrlInfo);
|
|
546
539
|
}
|
|
547
540
|
return;
|
|
548
541
|
}
|
|
549
|
-
// File referenced with
|
|
542
|
+
// File referenced with
|
|
543
|
+
// - new URL("./file.js", import.meta.url)
|
|
544
|
+
// - import.meta.resolve("./file.js")
|
|
550
545
|
// are entry points that should be bundled
|
|
551
546
|
// For instance we will bundle service worker/workers detected like this
|
|
552
547
|
if (rawUrlInfo.type === "js_module") {
|
|
553
548
|
for (const referenceToOther of rawUrlInfo.referenceToOthersSet) {
|
|
554
|
-
if (
|
|
549
|
+
if (
|
|
550
|
+
referenceToOther.type === "js_url" ||
|
|
551
|
+
referenceToOther.subtype === "import_meta_resolve"
|
|
552
|
+
) {
|
|
555
553
|
const referencedUrlInfo = referenceToOther.urlInfo;
|
|
556
554
|
let isAlreadyBundled = false;
|
|
557
555
|
for (const referenceFromOther of referencedUrlInfo.referenceFromOthersSet) {
|
|
@@ -238,6 +238,7 @@ export const createBuildSpecifierManager = ({
|
|
|
238
238
|
js_classic: undefined, // TODO: add comment to explain who is using this
|
|
239
239
|
entry_point: undefined,
|
|
240
240
|
dynamic_import: undefined,
|
|
241
|
+
dynamic_import_id: undefined,
|
|
241
242
|
};
|
|
242
243
|
},
|
|
243
244
|
formatReference: (reference) => {
|
|
@@ -276,6 +277,9 @@ export const createBuildSpecifierManager = ({
|
|
|
276
277
|
const bundleInfo = bundleInfoMap.get(rawUrl);
|
|
277
278
|
if (bundleInfo) {
|
|
278
279
|
finalUrlInfo.remapReference = bundleInfo.remapReference;
|
|
280
|
+
if (!finalUrlInfo.filenameHint && bundleInfo.data.bundleRelativeUrl) {
|
|
281
|
+
finalUrlInfo.filenameHint = bundleInfo.data.bundleRelativeUrl;
|
|
282
|
+
}
|
|
279
283
|
return {
|
|
280
284
|
// url: bundleInfo.url,
|
|
281
285
|
originalUrl: bundleInfo.originalUrl,
|
|
@@ -131,6 +131,10 @@ const determineDirectoryPath = ({
|
|
|
131
131
|
});
|
|
132
132
|
return parentDirectoryPath;
|
|
133
133
|
}
|
|
134
|
+
const dynamicImportId = urlInfo.searchParams.get("dynamic_import_id");
|
|
135
|
+
if (dynamicImportId) {
|
|
136
|
+
return `${assetsDirectory}${dynamicImportId}/`;
|
|
137
|
+
}
|
|
134
138
|
if (urlInfo.isEntryPoint && !urlInfo.isDynamicEntryPoint) {
|
|
135
139
|
return "";
|
|
136
140
|
}
|
|
@@ -18,6 +18,10 @@ export const jsenvPluginSubbuilds = (
|
|
|
18
18
|
},
|
|
19
19
|
...defaultChildBuildParams,
|
|
20
20
|
...subBuildParams,
|
|
21
|
+
outDirectoryUrl: new URL(
|
|
22
|
+
`./subbuild_${index}/`,
|
|
23
|
+
parentBuildParams.outDirectoryUrl,
|
|
24
|
+
),
|
|
21
25
|
};
|
|
22
26
|
const subBuildDirectoryUrl = subBuildParams.buildDirectoryUrl;
|
|
23
27
|
if (subBuildDirectoryUrl) {
|
|
@@ -40,6 +40,7 @@ export const determineSourcemapFileUrl = (urlInfo) => {
|
|
|
40
40
|
generatedUrlObject.searchParams.delete("as_json_module");
|
|
41
41
|
generatedUrlObject.searchParams.delete("as_text_module");
|
|
42
42
|
generatedUrlObject.searchParams.delete("dynamic_import");
|
|
43
|
+
generatedUrlObject.searchParams.delete("dynamic_import_id");
|
|
43
44
|
generatedUrlObject.searchParams.delete("cjs_as_js_module");
|
|
44
45
|
const urlForSourcemap = generatedUrlObject.href;
|
|
45
46
|
return generateSourcemapFileUrl(urlForSourcemap);
|
|
@@ -36,6 +36,12 @@ export const jsenvPluginProtocolHttp = ({ include }) => {
|
|
|
36
36
|
// }
|
|
37
37
|
// return null;
|
|
38
38
|
// },
|
|
39
|
+
init: (context) => {
|
|
40
|
+
const outDirectoryUrl = context.outDirectoryUrl;
|
|
41
|
+
if (!outDirectoryUrl) {
|
|
42
|
+
throw new Error(`need outDirectoryUrl to write http files`);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
39
45
|
redirectReference: (reference) => {
|
|
40
46
|
if (!reference.url.startsWith("http")) {
|
|
41
47
|
return null;
|
|
@@ -315,7 +315,12 @@ export const jsenvPluginHtmlReferenceAnalysis = ({
|
|
|
315
315
|
});
|
|
316
316
|
} else {
|
|
317
317
|
setHtmlNodeText(node, inlineUrlInfo.content, {
|
|
318
|
-
indentation:
|
|
318
|
+
indentation:
|
|
319
|
+
inlineUrlInfo.type === "js_classic" ||
|
|
320
|
+
inlineUrlInfo.type === "js_module"
|
|
321
|
+
? // indentation would mess with stack trace and sourcemap
|
|
322
|
+
false
|
|
323
|
+
: "auto",
|
|
319
324
|
});
|
|
320
325
|
setHtmlNodeAttributes(node, {
|
|
321
326
|
"jsenv-cooked-by": "jsenv:html_inline_content_analysis",
|