@jsenv/core 29.1.9 → 29.1.10
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/main.js +26 -4
- package/package.json +1 -1
- package/src/build/build.js +24 -4
package/dist/main.js
CHANGED
|
@@ -24414,15 +24414,37 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
24414
24414
|
return;
|
|
24415
24415
|
}
|
|
24416
24416
|
} // File referenced with new URL('./file.js', import.meta.url)
|
|
24417
|
-
// are entry points that
|
|
24417
|
+
// are entry points that should be bundled
|
|
24418
24418
|
// For instance we will bundle service worker/workers detected like this
|
|
24419
24419
|
|
|
24420
24420
|
|
|
24421
24421
|
if (rawUrlInfo.type === "js_module") {
|
|
24422
24422
|
rawUrlInfo.references.forEach(reference => {
|
|
24423
|
-
if (reference.type
|
|
24424
|
-
|
|
24425
|
-
|
|
24423
|
+
if (reference.type !== "js_url_specifier") {
|
|
24424
|
+
return;
|
|
24425
|
+
}
|
|
24426
|
+
|
|
24427
|
+
const referencedUrlInfo = rawGraph.getUrlInfo(reference.url);
|
|
24428
|
+
const bundler = bundlers[referencedUrlInfo.type];
|
|
24429
|
+
|
|
24430
|
+
if (!bundler) {
|
|
24431
|
+
return;
|
|
24432
|
+
}
|
|
24433
|
+
|
|
24434
|
+
let willAlreadyBeBundled = true;
|
|
24435
|
+
|
|
24436
|
+
for (const dependent of referencedUrlInfo.dependents) {
|
|
24437
|
+
const dependentUrlInfo = rawGraph.getUrlInfo(dependent);
|
|
24438
|
+
|
|
24439
|
+
for (const reference of dependentUrlInfo.references) {
|
|
24440
|
+
if (reference.url === referencedUrlInfo.url) {
|
|
24441
|
+
willAlreadyBeBundled = reference.type === "js_import_export" && reference.subtype === "import_dynamic" || reference.type === "script_src";
|
|
24442
|
+
}
|
|
24443
|
+
}
|
|
24444
|
+
}
|
|
24445
|
+
|
|
24446
|
+
if (!willAlreadyBeBundled) {
|
|
24447
|
+
bundler.urlInfos.push(referencedUrlInfo);
|
|
24426
24448
|
}
|
|
24427
24449
|
});
|
|
24428
24450
|
}
|
package/package.json
CHANGED
package/src/build/build.js
CHANGED
|
@@ -686,13 +686,33 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
// File referenced with new URL('./file.js', import.meta.url)
|
|
689
|
-
// are entry points that
|
|
689
|
+
// are entry points that should be bundled
|
|
690
690
|
// For instance we will bundle service worker/workers detected like this
|
|
691
691
|
if (rawUrlInfo.type === "js_module") {
|
|
692
692
|
rawUrlInfo.references.forEach((reference) => {
|
|
693
|
-
if (reference.type
|
|
694
|
-
|
|
695
|
-
|
|
693
|
+
if (reference.type !== "js_url_specifier") {
|
|
694
|
+
return
|
|
695
|
+
}
|
|
696
|
+
const referencedUrlInfo = rawGraph.getUrlInfo(reference.url)
|
|
697
|
+
const bundler = bundlers[referencedUrlInfo.type]
|
|
698
|
+
if (!bundler) {
|
|
699
|
+
return
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
let willAlreadyBeBundled = true
|
|
703
|
+
for (const dependent of referencedUrlInfo.dependents) {
|
|
704
|
+
const dependentUrlInfo = rawGraph.getUrlInfo(dependent)
|
|
705
|
+
for (const reference of dependentUrlInfo.references) {
|
|
706
|
+
if (reference.url === referencedUrlInfo.url) {
|
|
707
|
+
willAlreadyBeBundled =
|
|
708
|
+
(reference.type === "js_import_export" &&
|
|
709
|
+
reference.subtype === "import_dynamic") ||
|
|
710
|
+
reference.type === "script_src"
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
if (!willAlreadyBeBundled) {
|
|
715
|
+
bundler.urlInfos.push(referencedUrlInfo)
|
|
696
716
|
}
|
|
697
717
|
})
|
|
698
718
|
}
|