@atlaspack/runtime-js 2.19.9 → 2.20.0
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/CHANGELOG.md +13 -0
- package/dist/JSRuntime.js +274 -0
- package/lib/JSRuntime.js +330 -1
- package/package.json +4 -4
- package/src/JSRuntime.ts +305 -0
- package/tsconfig.tsbuildinfo +1 -1
package/lib/JSRuntime.js
CHANGED
|
@@ -172,6 +172,14 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
172
172
|
dependency,
|
|
173
173
|
env: {
|
|
174
174
|
sourceType: 'module'
|
|
175
|
+
},
|
|
176
|
+
// Pre-computed symbols: exports Promise, no external dependencies (uses global)
|
|
177
|
+
symbolData: {
|
|
178
|
+
symbols: new Map([['default', {
|
|
179
|
+
local: 'module.exports',
|
|
180
|
+
loc: null
|
|
181
|
+
}]]),
|
|
182
|
+
dependencies: []
|
|
175
183
|
}
|
|
176
184
|
});
|
|
177
185
|
}
|
|
@@ -186,6 +194,14 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
186
194
|
dependency,
|
|
187
195
|
env: {
|
|
188
196
|
sourceType: 'module'
|
|
197
|
+
},
|
|
198
|
+
// Pre-computed symbols: exports Promise, no external dependencies
|
|
199
|
+
symbolData: {
|
|
200
|
+
symbols: new Map([['default', {
|
|
201
|
+
local: 'module.exports',
|
|
202
|
+
loc: null
|
|
203
|
+
}]]),
|
|
204
|
+
dependencies: []
|
|
189
205
|
}
|
|
190
206
|
});
|
|
191
207
|
continue;
|
|
@@ -238,6 +254,30 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
238
254
|
dependency: cond.ifFalseDependency,
|
|
239
255
|
env: {
|
|
240
256
|
sourceType: 'module'
|
|
257
|
+
},
|
|
258
|
+
// Pre-computed symbols: conditional loader with potential sync-js-loader fallback
|
|
259
|
+
symbolData: {
|
|
260
|
+
symbols: new Map([['default', {
|
|
261
|
+
local: 'module.exports',
|
|
262
|
+
loc: null
|
|
263
|
+
}]]),
|
|
264
|
+
dependencies: [{
|
|
265
|
+
specifier: loaderPath,
|
|
266
|
+
symbols: new Map([['default', {
|
|
267
|
+
local: 'default',
|
|
268
|
+
loc: null,
|
|
269
|
+
isWeak: false
|
|
270
|
+
}]]),
|
|
271
|
+
usedSymbols: new Set(['default'])
|
|
272
|
+
}, ...(shouldUseFallback ? [{
|
|
273
|
+
specifier: './helpers/browser/sync-js-loader',
|
|
274
|
+
symbols: new Map([['default', {
|
|
275
|
+
local: 'l',
|
|
276
|
+
loc: null,
|
|
277
|
+
isWeak: false
|
|
278
|
+
}]]),
|
|
279
|
+
usedSymbols: new Set(['default'])
|
|
280
|
+
}] : [])]
|
|
241
281
|
}
|
|
242
282
|
});
|
|
243
283
|
}
|
|
@@ -253,6 +293,14 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
253
293
|
dependency,
|
|
254
294
|
env: {
|
|
255
295
|
sourceType: 'module'
|
|
296
|
+
},
|
|
297
|
+
// Pre-computed symbols: simple export with no dependencies
|
|
298
|
+
symbolData: {
|
|
299
|
+
symbols: new Map([['default', {
|
|
300
|
+
local: 'module.exports',
|
|
301
|
+
loc: null
|
|
302
|
+
}]]),
|
|
303
|
+
dependencies: []
|
|
256
304
|
}
|
|
257
305
|
});
|
|
258
306
|
continue;
|
|
@@ -270,6 +318,14 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
270
318
|
dependency,
|
|
271
319
|
env: {
|
|
272
320
|
sourceType: 'module'
|
|
321
|
+
},
|
|
322
|
+
// Pre-computed symbols: simple export with no dependencies
|
|
323
|
+
symbolData: {
|
|
324
|
+
symbols: new Map([['default', {
|
|
325
|
+
local: 'module.exports',
|
|
326
|
+
loc: null
|
|
327
|
+
}]]),
|
|
328
|
+
dependencies: []
|
|
273
329
|
}
|
|
274
330
|
});
|
|
275
331
|
continue;
|
|
@@ -315,6 +371,20 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
315
371
|
isEntry: true,
|
|
316
372
|
env: {
|
|
317
373
|
sourceType: 'module'
|
|
374
|
+
},
|
|
375
|
+
// Pre-computed symbols: lazy bundle loader, requires specific loader helper
|
|
376
|
+
symbolData: {
|
|
377
|
+
symbols: new Map(),
|
|
378
|
+
// No exports, just side effects
|
|
379
|
+
dependencies: [{
|
|
380
|
+
specifier: loader,
|
|
381
|
+
symbols: new Map([['default', {
|
|
382
|
+
local: 'default',
|
|
383
|
+
loc: null,
|
|
384
|
+
isWeak: false
|
|
385
|
+
}]]),
|
|
386
|
+
usedSymbols: new Set(['default'])
|
|
387
|
+
}]
|
|
318
388
|
}
|
|
319
389
|
});
|
|
320
390
|
}
|
|
@@ -328,7 +398,21 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
328
398
|
sourceType: 'module'
|
|
329
399
|
},
|
|
330
400
|
runtimeAssetRequiringExecutionOnLoad: true,
|
|
331
|
-
priority: getManifestBundlePriority(bundleGraph, bundle, config.splitManifestThreshold)
|
|
401
|
+
priority: getManifestBundlePriority(bundleGraph, bundle, config.splitManifestThreshold),
|
|
402
|
+
// Pre-computed symbols: requires bundle-manifest helper
|
|
403
|
+
symbolData: {
|
|
404
|
+
symbols: new Map(),
|
|
405
|
+
// No exports, just executes
|
|
406
|
+
dependencies: [{
|
|
407
|
+
specifier: './helpers/bundle-manifest',
|
|
408
|
+
symbols: new Map([['register', {
|
|
409
|
+
local: 'register',
|
|
410
|
+
loc: null,
|
|
411
|
+
isWeak: false
|
|
412
|
+
}]]),
|
|
413
|
+
usedSymbols: new Set(['register'])
|
|
414
|
+
}]
|
|
415
|
+
}
|
|
332
416
|
});
|
|
333
417
|
}
|
|
334
418
|
return assets;
|
|
@@ -535,6 +619,22 @@ function getLoaderRuntime({
|
|
|
535
619
|
dependency,
|
|
536
620
|
env: {
|
|
537
621
|
sourceType: 'module'
|
|
622
|
+
},
|
|
623
|
+
// Pre-computed symbols: ESM loader with retry, requires esm-js-loader-retry helper
|
|
624
|
+
symbolData: {
|
|
625
|
+
symbols: new Map([['default', {
|
|
626
|
+
local: 'module.exports',
|
|
627
|
+
loc: null
|
|
628
|
+
}]]),
|
|
629
|
+
dependencies: [{
|
|
630
|
+
specifier: './helpers/browser/esm-js-loader-retry',
|
|
631
|
+
symbols: new Map([['default', {
|
|
632
|
+
local: 'default',
|
|
633
|
+
loc: null,
|
|
634
|
+
isWeak: false
|
|
635
|
+
}]]),
|
|
636
|
+
usedSymbols: new Set(['default'])
|
|
637
|
+
}]
|
|
538
638
|
}
|
|
539
639
|
};
|
|
540
640
|
}
|
|
@@ -544,12 +644,165 @@ function getLoaderRuntime({
|
|
|
544
644
|
code.push(preludeLoad);
|
|
545
645
|
}
|
|
546
646
|
code.push(`module.exports = ${loaderCode};`);
|
|
647
|
+
|
|
648
|
+
// Collect all potential helper dependencies used in loader runtime
|
|
649
|
+
let helperDependencies = [];
|
|
650
|
+
|
|
651
|
+
// Always potential dependencies based on the code patterns
|
|
652
|
+
if (needsEsmLoadPrelude) {
|
|
653
|
+
if (shardingConfig) {
|
|
654
|
+
helperDependencies.push({
|
|
655
|
+
specifier: './helpers/browser/esm-js-loader-shards',
|
|
656
|
+
symbols: new Map([['default', {
|
|
657
|
+
local: 'default',
|
|
658
|
+
loc: null,
|
|
659
|
+
isWeak: false
|
|
660
|
+
}]]),
|
|
661
|
+
usedSymbols: new Set(['default'])
|
|
662
|
+
});
|
|
663
|
+
} else {
|
|
664
|
+
helperDependencies.push({
|
|
665
|
+
specifier: './helpers/browser/esm-js-loader',
|
|
666
|
+
symbols: new Map([['default', {
|
|
667
|
+
local: 'default',
|
|
668
|
+
loc: null,
|
|
669
|
+
isWeak: false
|
|
670
|
+
}]]),
|
|
671
|
+
usedSymbols: new Set(['default'])
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// Bundle manifest dependency if using runtime manifest
|
|
677
|
+
if (shouldUseRuntimeManifest(bundle, options)) {
|
|
678
|
+
helperDependencies.push({
|
|
679
|
+
specifier: './helpers/bundle-manifest',
|
|
680
|
+
symbols: new Map([['resolve', {
|
|
681
|
+
local: 'resolve',
|
|
682
|
+
loc: null,
|
|
683
|
+
isWeak: false
|
|
684
|
+
}]]),
|
|
685
|
+
usedSymbols: new Set(['resolve'])
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// Domain sharding dependency if configured
|
|
690
|
+
if (shardingConfig) {
|
|
691
|
+
helperDependencies.push({
|
|
692
|
+
specifier: '@atlaspack/domain-sharding',
|
|
693
|
+
symbols: new Map([['shardUrl', {
|
|
694
|
+
local: 'shardUrl',
|
|
695
|
+
loc: null,
|
|
696
|
+
isWeak: false
|
|
697
|
+
}]]),
|
|
698
|
+
usedSymbols: new Set(['shardUrl'])
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
// Various loader dependencies based on bundle types in externalBundles
|
|
703
|
+
for (let to of externalBundles) {
|
|
704
|
+
let loader = loaders[to.type];
|
|
705
|
+
if (loader && typeof loader === 'string') {
|
|
706
|
+
helperDependencies.push({
|
|
707
|
+
specifier: loader,
|
|
708
|
+
symbols: new Map([['default', {
|
|
709
|
+
local: 'default',
|
|
710
|
+
loc: null,
|
|
711
|
+
isWeak: false
|
|
712
|
+
}]]),
|
|
713
|
+
usedSymbols: new Set(['default'])
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
// Import polyfill if needed
|
|
719
|
+
if (needsDynamicImportPolyfill && loaders !== null && loaders !== void 0 && loaders.IMPORT_POLYFILL) {
|
|
720
|
+
helperDependencies.push({
|
|
721
|
+
specifier: loaders.IMPORT_POLYFILL,
|
|
722
|
+
symbols: new Map([['default', {
|
|
723
|
+
local: 'default',
|
|
724
|
+
loc: null,
|
|
725
|
+
isWeak: false
|
|
726
|
+
}]]),
|
|
727
|
+
usedSymbols: new Set(['default'])
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// Conditional loaders if using conditional bundling
|
|
732
|
+
if ((0, _featureFlags().getFeatureFlag)('conditionalBundlingApi')) {
|
|
733
|
+
const loaderPath = `./helpers/conditional-loader${options.mode === 'development' ? '-dev' : ''}`;
|
|
734
|
+
helperDependencies.push({
|
|
735
|
+
specifier: loaderPath,
|
|
736
|
+
symbols: new Map([['default', {
|
|
737
|
+
local: 'default',
|
|
738
|
+
loc: null,
|
|
739
|
+
isWeak: false
|
|
740
|
+
}]]),
|
|
741
|
+
usedSymbols: new Set(['default'])
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
// Sync loader for fallback
|
|
745
|
+
if (options.mode === 'development') {
|
|
746
|
+
helperDependencies.push({
|
|
747
|
+
specifier: './helpers/browser/sync-js-loader',
|
|
748
|
+
symbols: new Map([['default', {
|
|
749
|
+
local: 'default',
|
|
750
|
+
loc: null,
|
|
751
|
+
isWeak: false
|
|
752
|
+
}]]),
|
|
753
|
+
usedSymbols: new Set(['default'])
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// Preload/prefetch loaders for browser context
|
|
759
|
+
if (bundle.env.context === 'browser') {
|
|
760
|
+
helperDependencies.push({
|
|
761
|
+
specifier: BROWSER_PRELOAD_LOADER,
|
|
762
|
+
symbols: new Map([['default', {
|
|
763
|
+
local: 'default',
|
|
764
|
+
loc: null,
|
|
765
|
+
isWeak: false
|
|
766
|
+
}]]),
|
|
767
|
+
usedSymbols: new Set(['default'])
|
|
768
|
+
});
|
|
769
|
+
helperDependencies.push({
|
|
770
|
+
specifier: BROWSER_PREFETCH_LOADER,
|
|
771
|
+
symbols: new Map([['default', {
|
|
772
|
+
local: 'default',
|
|
773
|
+
loc: null,
|
|
774
|
+
isWeak: false
|
|
775
|
+
}]]),
|
|
776
|
+
usedSymbols: new Set(['default'])
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// ESM loader retry if using import retry feature
|
|
781
|
+
if (needsEsmLoadPrelude && options.featureFlags.importRetry) {
|
|
782
|
+
helperDependencies.push({
|
|
783
|
+
specifier: './helpers/browser/esm-js-loader-retry',
|
|
784
|
+
symbols: new Map([['default', {
|
|
785
|
+
local: 'default',
|
|
786
|
+
loc: null,
|
|
787
|
+
isWeak: false
|
|
788
|
+
}]]),
|
|
789
|
+
usedSymbols: new Set(['default'])
|
|
790
|
+
});
|
|
791
|
+
}
|
|
547
792
|
return {
|
|
548
793
|
filePath: __filename,
|
|
549
794
|
code: code.join('\n'),
|
|
550
795
|
dependency,
|
|
551
796
|
env: {
|
|
552
797
|
sourceType: 'module'
|
|
798
|
+
},
|
|
799
|
+
// Pre-computed symbols: loader runtime with comprehensive helper dependencies
|
|
800
|
+
symbolData: {
|
|
801
|
+
symbols: new Map([['default', {
|
|
802
|
+
local: 'module.exports',
|
|
803
|
+
loc: null
|
|
804
|
+
}]]),
|
|
805
|
+
dependencies: helperDependencies
|
|
553
806
|
}
|
|
554
807
|
};
|
|
555
808
|
}
|
|
@@ -628,12 +881,88 @@ function getURLRuntime(dependency, from, to, options, shardingConfig) {
|
|
|
628
881
|
} else {
|
|
629
882
|
code = `module.exports = ${getAbsoluteUrlExpr(relativePathExpr, from, shardingConfig)};`;
|
|
630
883
|
}
|
|
884
|
+
|
|
885
|
+
// Collect dependencies based on the URL runtime code patterns
|
|
886
|
+
let urlRuntimeDependencies = [];
|
|
887
|
+
if (dependency.meta.webworker === true && !from.env.isLibrary) {
|
|
888
|
+
// Web worker runtime requires get-worker-url helper
|
|
889
|
+
urlRuntimeDependencies.push({
|
|
890
|
+
specifier: './helpers/get-worker-url',
|
|
891
|
+
symbols: new Map([['default', {
|
|
892
|
+
local: 'workerURL',
|
|
893
|
+
loc: null,
|
|
894
|
+
isWeak: false
|
|
895
|
+
}]]),
|
|
896
|
+
usedSymbols: new Set(['default'])
|
|
897
|
+
});
|
|
898
|
+
if (!(from.env.outputFormat === 'esmodule' && from.env.supports('import-meta-url'))) {
|
|
899
|
+
// Also requires bundle-url helper in non-ESM environments
|
|
900
|
+
urlRuntimeDependencies.push({
|
|
901
|
+
specifier: './helpers/bundle-url',
|
|
902
|
+
symbols: new Map([['getBundleURL', {
|
|
903
|
+
local: 'getBundleURL',
|
|
904
|
+
loc: null,
|
|
905
|
+
isWeak: false
|
|
906
|
+
}], ['getOrigin', {
|
|
907
|
+
local: 'getOrigin',
|
|
908
|
+
loc: null,
|
|
909
|
+
isWeak: false
|
|
910
|
+
}]]),
|
|
911
|
+
usedSymbols: new Set(['getBundleURL', 'getOrigin'])
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
// Domain sharding if configured
|
|
915
|
+
if (shardingConfig) {
|
|
916
|
+
urlRuntimeDependencies.push({
|
|
917
|
+
specifier: '@atlaspack/domain-sharding',
|
|
918
|
+
symbols: new Map([['shardUrl', {
|
|
919
|
+
local: 'shardUrl',
|
|
920
|
+
loc: null,
|
|
921
|
+
isWeak: false
|
|
922
|
+
}]]),
|
|
923
|
+
usedSymbols: new Set(['shardUrl'])
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
} else {
|
|
928
|
+
// Regular URL runtime may use bundle-url helper
|
|
929
|
+
if (!(from.env.outputFormat === 'esmodule' && from.env.supports('import-meta-url')) && !(from.env.outputFormat === 'commonjs')) {
|
|
930
|
+
urlRuntimeDependencies.push({
|
|
931
|
+
specifier: './helpers/bundle-url',
|
|
932
|
+
symbols: new Map([['getBundleURL', {
|
|
933
|
+
local: 'getBundleURL',
|
|
934
|
+
loc: null,
|
|
935
|
+
isWeak: false
|
|
936
|
+
}]]),
|
|
937
|
+
usedSymbols: new Set(['getBundleURL'])
|
|
938
|
+
});
|
|
939
|
+
if (shardingConfig) {
|
|
940
|
+
urlRuntimeDependencies.push({
|
|
941
|
+
specifier: '@atlaspack/domain-sharding',
|
|
942
|
+
symbols: new Map([['shardUrl', {
|
|
943
|
+
local: 'shardUrl',
|
|
944
|
+
loc: null,
|
|
945
|
+
isWeak: false
|
|
946
|
+
}]]),
|
|
947
|
+
usedSymbols: new Set(['shardUrl'])
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}
|
|
631
952
|
return {
|
|
632
953
|
filePath: __filename,
|
|
633
954
|
code,
|
|
634
955
|
dependency,
|
|
635
956
|
env: {
|
|
636
957
|
sourceType: 'module'
|
|
958
|
+
},
|
|
959
|
+
// Pre-computed symbols: URL runtime with helper dependencies
|
|
960
|
+
symbolData: {
|
|
961
|
+
symbols: new Map([['default', {
|
|
962
|
+
local: 'module.exports',
|
|
963
|
+
loc: null
|
|
964
|
+
}]]),
|
|
965
|
+
dependencies: urlRuntimeDependencies
|
|
637
966
|
}
|
|
638
967
|
};
|
|
639
968
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/runtime-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"@atlaspack/diagnostic": "2.14.4",
|
|
20
20
|
"@atlaspack/domain-sharding": "2.14.4",
|
|
21
21
|
"@atlaspack/feature-flags": "2.27.3",
|
|
22
|
-
"@atlaspack/plugin": "2.14.
|
|
23
|
-
"@atlaspack/utils": "3.2.
|
|
24
|
-
"@atlaspack/types-internal": "2.
|
|
22
|
+
"@atlaspack/plugin": "2.14.43",
|
|
23
|
+
"@atlaspack/utils": "3.2.4",
|
|
24
|
+
"@atlaspack/types-internal": "2.22.0",
|
|
25
25
|
"nullthrows": "^1.1.1"
|
|
26
26
|
},
|
|
27
27
|
"type": "commonjs",
|