@atlaspack/runtime-js 2.12.1-canary.3596 → 2.12.1-canary.3598
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/lib/JSRuntime.js +5 -5
- package/package.json +8 -8
- package/src/JSRuntime.js +0 -5
package/lib/JSRuntime.js
CHANGED
|
@@ -286,7 +286,7 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
286
286
|
continue;
|
|
287
287
|
}
|
|
288
288
|
let relativePathExpr = getRelativePathExpr(bundle, referencedBundle, options);
|
|
289
|
-
let loaderCode = `require(${JSON.stringify(loader)})(${getAbsoluteUrlExpr(relativePathExpr, bundle,
|
|
289
|
+
let loaderCode = `require(${JSON.stringify(loader)})(${getAbsoluteUrlExpr(relativePathExpr, bundle, config.domainSharding)})`;
|
|
290
290
|
assets.push({
|
|
291
291
|
filePath: __filename,
|
|
292
292
|
code: loaderCode,
|
|
@@ -412,7 +412,7 @@ function getLoaderRuntime({
|
|
|
412
412
|
absoluteUrlExpr = `require('@atlaspack/domain-sharding').shardUrl(${absoluteUrlExpr}, ${shardingConfig.maxShards})`;
|
|
413
413
|
}
|
|
414
414
|
} else {
|
|
415
|
-
absoluteUrlExpr = getAbsoluteUrlExpr(relativePathExpr, bundle,
|
|
415
|
+
absoluteUrlExpr = getAbsoluteUrlExpr(relativePathExpr, bundle, shardingConfig);
|
|
416
416
|
}
|
|
417
417
|
let code = `require(${JSON.stringify(loader)})(${absoluteUrlExpr})`;
|
|
418
418
|
|
|
@@ -535,7 +535,7 @@ function getHintLoaders(bundleGraph, from, bundleGroups, loader, options) {
|
|
|
535
535
|
for (let bundleToPreload of bundlesToPreload) {
|
|
536
536
|
let relativePathExpr = getRelativePathExpr(from, bundleToPreload, options);
|
|
537
537
|
let priority = TYPE_TO_RESOURCE_PRIORITY[bundleToPreload.type];
|
|
538
|
-
hintLoaders.push(`require(${JSON.stringify(loader)})(${getAbsoluteUrlExpr(relativePathExpr, from
|
|
538
|
+
hintLoaders.push(`require(${JSON.stringify(loader)})(${getAbsoluteUrlExpr(relativePathExpr, from)}, ${priority ? JSON.stringify(priority) : 'null'}, ${JSON.stringify(bundleToPreload.target.env.outputFormat === 'esmodule')})`);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
541
|
return hintLoaders;
|
|
@@ -562,7 +562,7 @@ function getURLRuntime(dependency, from, to, options, shardingConfig) {
|
|
|
562
562
|
code += `module.exports = workerURL(url, bundleURL.getOrigin(url), ${String(from.env.outputFormat === 'esmodule')});`;
|
|
563
563
|
}
|
|
564
564
|
} else {
|
|
565
|
-
code = `module.exports = ${getAbsoluteUrlExpr(relativePathExpr, from,
|
|
565
|
+
code = `module.exports = ${getAbsoluteUrlExpr(relativePathExpr, from, shardingConfig)};`;
|
|
566
566
|
}
|
|
567
567
|
return {
|
|
568
568
|
filePath: __filename,
|
|
@@ -610,7 +610,7 @@ function getRelativePathExpr(from, to, options) {
|
|
|
610
610
|
}
|
|
611
611
|
return res;
|
|
612
612
|
}
|
|
613
|
-
function getAbsoluteUrlExpr(relativePathExpr, fromBundle,
|
|
613
|
+
function getAbsoluteUrlExpr(relativePathExpr, fromBundle, shardingConfig) {
|
|
614
614
|
if (fromBundle.env.outputFormat === 'esmodule' && fromBundle.env.supports('import-meta-url') || fromBundle.env.outputFormat === 'commonjs') {
|
|
615
615
|
// This will be compiled to new URL(url, import.meta.url) or new URL(url, 'file:' + __filename).
|
|
616
616
|
return `new __parcel__URL__(${relativePathExpr}).toString()`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/runtime-js",
|
|
3
|
-
"version": "2.12.1-canary.
|
|
3
|
+
"version": "2.12.1-canary.3598+43565eabc",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
"main": "lib/JSRuntime.js",
|
|
13
13
|
"source": "src/JSRuntime.js",
|
|
14
14
|
"engines": {
|
|
15
|
-
"atlaspack": "2.12.1-canary.
|
|
15
|
+
"atlaspack": "2.12.1-canary.3598+43565eabc",
|
|
16
16
|
"node": ">= 16.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atlaspack/diagnostic": "2.12.1-canary.
|
|
20
|
-
"@atlaspack/domain-sharding": "2.12.1-canary.
|
|
21
|
-
"@atlaspack/feature-flags": "2.12.1-canary.
|
|
22
|
-
"@atlaspack/plugin": "2.12.1-canary.
|
|
23
|
-
"@atlaspack/utils": "2.12.1-canary.
|
|
19
|
+
"@atlaspack/diagnostic": "2.12.1-canary.3598+43565eabc",
|
|
20
|
+
"@atlaspack/domain-sharding": "2.12.1-canary.3598+43565eabc",
|
|
21
|
+
"@atlaspack/feature-flags": "2.12.1-canary.3598+43565eabc",
|
|
22
|
+
"@atlaspack/plugin": "2.12.1-canary.3598+43565eabc",
|
|
23
|
+
"@atlaspack/utils": "2.12.1-canary.3598+43565eabc",
|
|
24
24
|
"nullthrows": "^1.1.1"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "43565eabcda613c67cbf579d38b1093a7c629955"
|
|
27
27
|
}
|
package/src/JSRuntime.js
CHANGED
|
@@ -322,7 +322,6 @@ export default (new Runtime({
|
|
|
322
322
|
)})(${getAbsoluteUrlExpr(
|
|
323
323
|
relativePathExpr,
|
|
324
324
|
bundle,
|
|
325
|
-
referencedBundle,
|
|
326
325
|
config.domainSharding,
|
|
327
326
|
)})`;
|
|
328
327
|
assets.push({
|
|
@@ -497,7 +496,6 @@ function getLoaderRuntime({
|
|
|
497
496
|
absoluteUrlExpr = getAbsoluteUrlExpr(
|
|
498
497
|
relativePathExpr,
|
|
499
498
|
bundle,
|
|
500
|
-
to,
|
|
501
499
|
shardingConfig,
|
|
502
500
|
);
|
|
503
501
|
}
|
|
@@ -696,7 +694,6 @@ function getHintLoaders(
|
|
|
696
694
|
`require(${JSON.stringify(loader)})(${getAbsoluteUrlExpr(
|
|
697
695
|
relativePathExpr,
|
|
698
696
|
from,
|
|
699
|
-
bundleToPreload,
|
|
700
697
|
)}, ${priority ? JSON.stringify(priority) : 'null'}, ${JSON.stringify(
|
|
701
698
|
bundleToPreload.target.env.outputFormat === 'esmodule',
|
|
702
699
|
)})`,
|
|
@@ -759,7 +756,6 @@ function getURLRuntime(
|
|
|
759
756
|
code = `module.exports = ${getAbsoluteUrlExpr(
|
|
760
757
|
relativePathExpr,
|
|
761
758
|
from,
|
|
762
|
-
to,
|
|
763
759
|
shardingConfig,
|
|
764
760
|
)};`;
|
|
765
761
|
}
|
|
@@ -834,7 +830,6 @@ function getRelativePathExpr(
|
|
|
834
830
|
function getAbsoluteUrlExpr(
|
|
835
831
|
relativePathExpr: string,
|
|
836
832
|
fromBundle: NamedBundle,
|
|
837
|
-
toBundle: NamedBundle,
|
|
838
833
|
shardingConfig: JSRuntimeConfig['domainSharding'],
|
|
839
834
|
) {
|
|
840
835
|
if (
|