@jsenv/plugin-bundling 2.8.6 → 2.8.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/plugin-bundling",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
],
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@jsenv/humanize": "1.
|
|
25
|
+
"@jsenv/humanize": "1.4.0",
|
|
26
26
|
"@jsenv/url-meta": "8.5.6",
|
|
27
|
-
"@jsenv/urls": "2.7.
|
|
28
|
-
"@jsenv/sourcemap": "1.3.
|
|
27
|
+
"@jsenv/urls": "2.7.1",
|
|
28
|
+
"@jsenv/sourcemap": "1.3.4",
|
|
29
29
|
"lightningcss": "1.29.2",
|
|
30
30
|
"rollup": "4.35.0"
|
|
31
31
|
},
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
injectQueryParams,
|
|
8
8
|
isFileSystemPath,
|
|
9
9
|
urlToBasename,
|
|
10
|
+
urlToRelativeUrl,
|
|
10
11
|
} from "@jsenv/urls";
|
|
11
12
|
import { readFileSync } from "node:fs";
|
|
12
13
|
import { fileUrlConverter } from "../file_url_converter.js";
|
|
@@ -36,6 +37,7 @@ export const bundleJsModules = async (
|
|
|
36
37
|
isSupportedOnCurrentClients,
|
|
37
38
|
getPluginMeta,
|
|
38
39
|
kitchen,
|
|
40
|
+
assetsDirectory,
|
|
39
41
|
} = jsModuleUrlInfos[0].context;
|
|
40
42
|
const graph = jsModuleUrlInfos[0].graph;
|
|
41
43
|
if (buildDirectoryUrl === undefined) {
|
|
@@ -79,8 +81,8 @@ export const bundleJsModules = async (
|
|
|
79
81
|
workspaces = packageJSON.workspaces;
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
|
-
let nodeModuleChunkName =
|
|
83
|
-
let packagesChunkName =
|
|
84
|
+
let nodeModuleChunkName = `node_modules`;
|
|
85
|
+
let packagesChunkName = `packages`;
|
|
84
86
|
|
|
85
87
|
if (packageName) {
|
|
86
88
|
let packageNameAsFilename = packageName
|
|
@@ -90,6 +92,11 @@ export const bundleJsModules = async (
|
|
|
90
92
|
nodeModuleChunkName = `${packageNameAsFilename}_node_modules`;
|
|
91
93
|
packagesChunkName = `${packageNameAsFilename}_packages`;
|
|
92
94
|
}
|
|
95
|
+
if (assetsDirectory) {
|
|
96
|
+
nodeModuleChunkName = `${assetsDirectory}${nodeModuleChunkName}`;
|
|
97
|
+
packagesChunkName = `${assetsDirectory}${packagesChunkName}`;
|
|
98
|
+
}
|
|
99
|
+
|
|
93
100
|
chunks[nodeModuleChunkName] = {
|
|
94
101
|
"file:///**/node_modules/": true,
|
|
95
102
|
...chunks.vendors,
|
|
@@ -487,7 +494,22 @@ const rollupPluginJsenv = ({
|
|
|
487
494
|
continue;
|
|
488
495
|
}
|
|
489
496
|
const importUrl = getOriginalUrl(importRollupFileInfo);
|
|
490
|
-
const
|
|
497
|
+
const importerBuildUrl = new URL(
|
|
498
|
+
rollupFileInfo.fileName,
|
|
499
|
+
buildDirectoryUrl,
|
|
500
|
+
).href;
|
|
501
|
+
const urlToImport = new URL(
|
|
502
|
+
importRollupFileInfo.fileName,
|
|
503
|
+
buildDirectoryUrl,
|
|
504
|
+
).href;
|
|
505
|
+
const specifierRelative = urlToRelativeUrl(
|
|
506
|
+
urlToImport,
|
|
507
|
+
importerBuildUrl,
|
|
508
|
+
);
|
|
509
|
+
const rollupSpecifier =
|
|
510
|
+
specifierRelative[0] === "."
|
|
511
|
+
? specifierRelative
|
|
512
|
+
: `./${specifierRelative}`;
|
|
491
513
|
specifierToUrlMap.set(rollupSpecifier, importUrl);
|
|
492
514
|
}
|
|
493
515
|
}
|
|
@@ -506,7 +528,22 @@ const rollupPluginJsenv = ({
|
|
|
506
528
|
const dynamicImportUrl = getOriginalUrl(
|
|
507
529
|
dynamicImportRollupFileInfo,
|
|
508
530
|
);
|
|
509
|
-
const
|
|
531
|
+
const importerBuildUrl = new URL(
|
|
532
|
+
rollupFileInfo.fileName,
|
|
533
|
+
buildDirectoryUrl,
|
|
534
|
+
).href;
|
|
535
|
+
const urlToImport = new URL(
|
|
536
|
+
dynamicImportRollupFileInfo.fileName,
|
|
537
|
+
buildDirectoryUrl,
|
|
538
|
+
).href;
|
|
539
|
+
const specifierRelative = urlToRelativeUrl(
|
|
540
|
+
urlToImport,
|
|
541
|
+
importerBuildUrl,
|
|
542
|
+
);
|
|
543
|
+
const rollupSpecifier =
|
|
544
|
+
specifierRelative[0] === "."
|
|
545
|
+
? specifierRelative
|
|
546
|
+
: `./${specifierRelative}`;
|
|
510
547
|
specifierToUrlMap.set(rollupSpecifier, dynamicImportUrl);
|
|
511
548
|
}
|
|
512
549
|
}
|
|
@@ -557,6 +594,7 @@ const rollupPluginJsenv = ({
|
|
|
557
594
|
reference.specifier,
|
|
558
595
|
);
|
|
559
596
|
if (!specifierBeforeRollup) {
|
|
597
|
+
// process.emitWarning?
|
|
560
598
|
console.warn(
|
|
561
599
|
`cannot remap "${reference.specifier}" back to specifier before rollup, this is unexpected.`,
|
|
562
600
|
);
|
|
@@ -711,6 +749,14 @@ const rollupPluginJsenv = ({
|
|
|
711
749
|
};
|
|
712
750
|
}
|
|
713
751
|
}
|
|
752
|
+
const urlInfo = graph.getUrlInfo(resolvedUrl);
|
|
753
|
+
if (urlInfo.type === "entry_build") {
|
|
754
|
+
return {
|
|
755
|
+
id: resolvedUrl,
|
|
756
|
+
external: true,
|
|
757
|
+
moduleSideEffects: getModuleSideEffects(resolvedUrl, importer),
|
|
758
|
+
};
|
|
759
|
+
}
|
|
714
760
|
return {
|
|
715
761
|
id: PATH_AND_URL_CONVERTER.asFilePath(resolvedUrl),
|
|
716
762
|
external: false,
|