@jsenv/plugin-bundling 2.8.6 → 2.8.7
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.7",
|
|
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
|
}
|
|
@@ -557,6 +579,7 @@ const rollupPluginJsenv = ({
|
|
|
557
579
|
reference.specifier,
|
|
558
580
|
);
|
|
559
581
|
if (!specifierBeforeRollup) {
|
|
582
|
+
// process.emitWarning?
|
|
560
583
|
console.warn(
|
|
561
584
|
`cannot remap "${reference.specifier}" back to specifier before rollup, this is unexpected.`,
|
|
562
585
|
);
|
|
@@ -711,6 +734,14 @@ const rollupPluginJsenv = ({
|
|
|
711
734
|
};
|
|
712
735
|
}
|
|
713
736
|
}
|
|
737
|
+
const urlInfo = graph.getUrlInfo(resolvedUrl);
|
|
738
|
+
if (urlInfo.type === "entry_build") {
|
|
739
|
+
return {
|
|
740
|
+
id: resolvedUrl,
|
|
741
|
+
external: true,
|
|
742
|
+
moduleSideEffects: getModuleSideEffects(resolvedUrl, importer),
|
|
743
|
+
};
|
|
744
|
+
}
|
|
714
745
|
return {
|
|
715
746
|
id: PATH_AND_URL_CONVERTER.asFilePath(resolvedUrl),
|
|
716
747
|
external: false,
|