@atlaspack/runtime-js 2.14.1-dev.91 → 2.14.1
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 +15 -0
- package/lib/JSRuntime.js +14 -40
- package/package.json +7 -11
- package/src/JSRuntime.js +17 -41
- package/src/helpers/browser/analytics/analytics.js.flow +4 -2
- package/LICENSE +0 -201
- package/lib/helpers/browser/esm-js-loader-shards-super.js +0 -7
- package/src/helpers/browser/esm-js-loader-shards-super.js +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaspack/runtime-js
|
|
2
2
|
|
|
3
|
+
## 2.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#450](https://github.com/atlassian-labs/atlaspack/pull/450) [`b9d41b1`](https://github.com/atlassian-labs/atlaspack/commit/b9d41b175ad5771651a5b0278a5a0147e669234a) Thanks [@benjervis](https://github.com/benjervis)! - Remove the Atlaspack engines compatibility check
|
|
8
|
+
|
|
9
|
+
- [#478](https://github.com/atlassian-labs/atlaspack/pull/478) [`570493b`](https://github.com/atlassian-labs/atlaspack/commit/570493beaf754e7985aebc7daaaf6dfcfa8fe56b) Thanks [@yamadapc](https://github.com/yamadapc)! - The first attempt at Version Packages didn't include the built artifacts.
|
|
10
|
+
This has hopefully been fixed, so this change will force those packages to re-release.
|
|
11
|
+
- Updated dependencies [[`b9d41b1`](https://github.com/atlassian-labs/atlaspack/commit/b9d41b175ad5771651a5b0278a5a0147e669234a), [`ce13d5e`](https://github.com/atlassian-labs/atlaspack/commit/ce13d5e885d55518ee6318e7a72e3a6e4e5126f2), [`4aab060`](https://github.com/atlassian-labs/atlaspack/commit/4aab0605c0d4ee8e0dcc3ffa1162eae5b360b677), [`e1422ad`](https://github.com/atlassian-labs/atlaspack/commit/e1422ad0a801faaa4bc4f1023bed042ffe236e9b), [`570493b`](https://github.com/atlassian-labs/atlaspack/commit/570493beaf754e7985aebc7daaaf6dfcfa8fe56b)]:
|
|
12
|
+
- @atlaspack/domain-sharding@2.14.1
|
|
13
|
+
- @atlaspack/utils@2.14.1
|
|
14
|
+
- @atlaspack/feature-flags@2.14.1
|
|
15
|
+
- @atlaspack/diagnostic@2.14.1
|
|
16
|
+
- @atlaspack/plugin@2.14.1
|
|
17
|
+
|
|
3
18
|
## 2.14.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/lib/JSRuntime.js
CHANGED
|
@@ -46,24 +46,7 @@ function _featureFlags() {
|
|
|
46
46
|
};
|
|
47
47
|
return data;
|
|
48
48
|
}
|
|
49
|
-
function _core() {
|
|
50
|
-
const data = require("@atlaspack/core");
|
|
51
|
-
_core = function () {
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
return data;
|
|
55
|
-
}
|
|
56
49
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
57
|
-
const domainShardingImports = (0, _core().isSuperPackage)() ? {
|
|
58
|
-
specifier: '@atlaspack/super/lib/domain-sharding.js',
|
|
59
|
-
helper: './helpers/browser/esm-js-loader-shards-super.js'
|
|
60
|
-
} : {
|
|
61
|
-
specifier: '@atlaspack/domain-sharding',
|
|
62
|
-
helper: './helpers/browser/esm-js-loader-shards.js'
|
|
63
|
-
};
|
|
64
|
-
const filename = /*#__ATLASPACK_IGNORE__*/__filename;
|
|
65
|
-
const dirname = /*#__ATLASPACK_IGNORE__*/__dirname;
|
|
66
|
-
|
|
67
50
|
// Used for as="" in preload/prefetch
|
|
68
51
|
const TYPE_TO_RESOURCE_PRIORITY = {
|
|
69
52
|
css: 'style',
|
|
@@ -180,7 +163,7 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
180
163
|
// return a simple runtime of `Promise.resolve(internalRequire(assetId))`.
|
|
181
164
|
// The linker handles this for scope-hoisting.
|
|
182
165
|
assets.push({
|
|
183
|
-
filePath:
|
|
166
|
+
filePath: __filename,
|
|
184
167
|
code: `module.exports = Promise.resolve(module.bundle.root(${JSON.stringify(bundleGraph.getAssetPublicId(resolved.value))}))`,
|
|
185
168
|
dependency,
|
|
186
169
|
env: {
|
|
@@ -194,7 +177,7 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
194
177
|
let referencedBundle = bundleGraph.getReferencedBundle(dependency, bundle);
|
|
195
178
|
if ((referencedBundle === null || referencedBundle === void 0 ? void 0 : referencedBundle.bundleBehavior) === 'inline') {
|
|
196
179
|
assets.push({
|
|
197
|
-
filePath: _path().default.join(
|
|
180
|
+
filePath: _path().default.join(__dirname, `/bundles/${referencedBundle.id}.js`),
|
|
198
181
|
code: `module.exports = Promise.resolve(${JSON.stringify(dependency.id)});`,
|
|
199
182
|
dependency,
|
|
200
183
|
env: {
|
|
@@ -225,7 +208,7 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
225
208
|
const requireName = bundle.env.shouldScopeHoist ? 'parcelRequire' : '__parcel__require__';
|
|
226
209
|
const assetCode = `module.exports = require('../helpers/conditional-loader${options.mode === 'development' ? '-dev' : ''}')('${cond.key}', function (){return ${requireName}('${cond.ifTrueAssetId}')}, function (){return ${requireName}('${cond.ifFalseAssetId}')})`;
|
|
227
210
|
assets.push({
|
|
228
|
-
filePath: _path().default.join(
|
|
211
|
+
filePath: _path().default.join(__dirname, `/conditions/${cond.publicId}.js`),
|
|
229
212
|
code: assetCode,
|
|
230
213
|
// This dependency is important, as it's the last symbol handled in scope hoisting.
|
|
231
214
|
// That means that scope hoisting will use the module id for this asset to replace the symbol
|
|
@@ -243,7 +226,7 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
243
226
|
let referencedBundle = bundleGraph.getReferencedBundle(dependency, bundle);
|
|
244
227
|
if ((referencedBundle === null || referencedBundle === void 0 ? void 0 : referencedBundle.bundleBehavior) === 'inline') {
|
|
245
228
|
assets.push({
|
|
246
|
-
filePath: _path().default.join(
|
|
229
|
+
filePath: _path().default.join(__dirname, `/bundles/${referencedBundle.id}.js`),
|
|
247
230
|
code: `module.exports = ${JSON.stringify(dependency.id)};`,
|
|
248
231
|
dependency,
|
|
249
232
|
env: {
|
|
@@ -260,7 +243,7 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
260
243
|
// If a URL dependency was not able to be resolved, add a runtime that
|
|
261
244
|
// exports the original specifier.
|
|
262
245
|
assets.push({
|
|
263
|
-
filePath:
|
|
246
|
+
filePath: __filename,
|
|
264
247
|
code: `module.exports = ${JSON.stringify(dependency.specifier)}`,
|
|
265
248
|
dependency,
|
|
266
249
|
env: {
|
|
@@ -278,15 +261,6 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
278
261
|
return entries.some(e => bundleGroup.entryAssetId === e.id);
|
|
279
262
|
}));
|
|
280
263
|
|
|
281
|
-
// Skip URL runtime for native node imports as they need to be require
|
|
282
|
-
// directly
|
|
283
|
-
// Currently enabled only for internal builds
|
|
284
|
-
if (process.env.ATLASPACK_SUPER_BUILD === 'true') {
|
|
285
|
-
if (mainBundle.bundleBehavior === 'isolated' && mainBundle.env.context === 'node' && mainBundle.type === 'node') {
|
|
286
|
-
continue;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
264
|
// Skip URL runtimes for library builds. This is handled in packaging so that
|
|
291
265
|
// the url is inlined and statically analyzable.
|
|
292
266
|
if (bundle.env.isLibrary && mainBundle.bundleBehavior !== 'isolated') {
|
|
@@ -314,7 +288,7 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
314
288
|
let relativePathExpr = getRelativePathExpr(bundle, referencedBundle, options);
|
|
315
289
|
let loaderCode = `require(${JSON.stringify(loader)})(${getAbsoluteUrlExpr(relativePathExpr, bundle, config.domainSharding)})`;
|
|
316
290
|
assets.push({
|
|
317
|
-
filePath:
|
|
291
|
+
filePath: __filename,
|
|
318
292
|
code: loaderCode,
|
|
319
293
|
isEntry: true,
|
|
320
294
|
env: {
|
|
@@ -325,7 +299,7 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
325
299
|
}
|
|
326
300
|
if (shouldUseRuntimeManifest(bundle, options) && bundleGraph.getChildBundles(bundle).some(b => b.bundleBehavior !== 'inline') && isNewContext(bundle, bundleGraph)) {
|
|
327
301
|
assets.push({
|
|
328
|
-
filePath:
|
|
302
|
+
filePath: __filename,
|
|
329
303
|
code: getRegisterCode(bundle, bundleGraph),
|
|
330
304
|
isEntry: true,
|
|
331
305
|
env: {
|
|
@@ -435,7 +409,7 @@ function getLoaderRuntime({
|
|
|
435
409
|
let publicId = JSON.stringify(to.publicId);
|
|
436
410
|
absoluteUrlExpr = `require('./helpers/bundle-manifest').resolve(${publicId})`;
|
|
437
411
|
if (shardingConfig) {
|
|
438
|
-
absoluteUrlExpr = `require('
|
|
412
|
+
absoluteUrlExpr = `require('@atlaspack/domain-sharding').shardUrl(${absoluteUrlExpr}, ${shardingConfig.maxShards})`;
|
|
439
413
|
}
|
|
440
414
|
} else {
|
|
441
415
|
absoluteUrlExpr = getAbsoluteUrlExpr(relativePathExpr, bundle, shardingConfig);
|
|
@@ -527,7 +501,7 @@ function getLoaderRuntime({
|
|
|
527
501
|
});
|
|
528
502
|
}})`;
|
|
529
503
|
return {
|
|
530
|
-
filePath:
|
|
504
|
+
filePath: __filename,
|
|
531
505
|
code: loaderCode,
|
|
532
506
|
dependency,
|
|
533
507
|
env: {
|
|
@@ -537,12 +511,12 @@ function getLoaderRuntime({
|
|
|
537
511
|
}
|
|
538
512
|
let code = [];
|
|
539
513
|
if (needsEsmLoadPrelude) {
|
|
540
|
-
let preludeLoad = shardingConfig ? `let load = require('
|
|
514
|
+
let preludeLoad = shardingConfig ? `let load = require('./helpers/browser/esm-js-loader-shards')(${shardingConfig.maxShards});` : `let load = require('./helpers/browser/esm-js-loader');`;
|
|
541
515
|
code.push(preludeLoad);
|
|
542
516
|
}
|
|
543
517
|
code.push(`module.exports = ${loaderCode};`);
|
|
544
518
|
return {
|
|
545
|
-
filePath:
|
|
519
|
+
filePath: __filename,
|
|
546
520
|
code: code.join('\n'),
|
|
547
521
|
dependency,
|
|
548
522
|
env: {
|
|
@@ -608,7 +582,7 @@ function getURLRuntime(dependency, from, to, options, shardingConfig) {
|
|
|
608
582
|
code += `let bundleURL = require('./helpers/bundle-url');\n`;
|
|
609
583
|
code += `let url = bundleURL.getBundleURL('${from.publicId}') + ${relativePathExpr};`;
|
|
610
584
|
if (shardingConfig) {
|
|
611
|
-
code += `url = require('
|
|
585
|
+
code += `url = require('@atlaspack/domain-sharding').shardUrl(url, ${shardingConfig.maxShards});`;
|
|
612
586
|
}
|
|
613
587
|
code += `module.exports = workerURL(url, bundleURL.getOrigin(url), ${String(from.env.outputFormat === 'esmodule')});`;
|
|
614
588
|
}
|
|
@@ -616,7 +590,7 @@ function getURLRuntime(dependency, from, to, options, shardingConfig) {
|
|
|
616
590
|
code = `module.exports = ${getAbsoluteUrlExpr(relativePathExpr, from, shardingConfig)};`;
|
|
617
591
|
}
|
|
618
592
|
return {
|
|
619
|
-
filePath:
|
|
593
|
+
filePath: __filename,
|
|
620
594
|
code,
|
|
621
595
|
dependency,
|
|
622
596
|
env: {
|
|
@@ -670,7 +644,7 @@ function getAbsoluteUrlExpr(relativePathExpr, fromBundle, shardingConfig) {
|
|
|
670
644
|
if (!shardingConfig) {
|
|
671
645
|
return regularBundleUrl;
|
|
672
646
|
}
|
|
673
|
-
return `require('
|
|
647
|
+
return `require('@atlaspack/domain-sharding').shardUrl(${regularBundleUrl}, ${shardingConfig.maxShards})`;
|
|
674
648
|
}
|
|
675
649
|
function shouldUseRuntimeManifest(bundle, options) {
|
|
676
650
|
let env = bundle.env;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/runtime-js",
|
|
3
|
-
"version": "2.14.1
|
|
3
|
+
"version": "2.14.1",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -11,20 +11,16 @@
|
|
|
11
11
|
},
|
|
12
12
|
"main": "lib/JSRuntime.js",
|
|
13
13
|
"source": "src/JSRuntime.js",
|
|
14
|
-
"atlaspackReferences": [
|
|
15
|
-
"./src/helpers/**/*"
|
|
16
|
-
],
|
|
17
14
|
"engines": {
|
|
18
15
|
"node": ">= 16.0.0"
|
|
19
16
|
},
|
|
20
17
|
"dependencies": {
|
|
21
|
-
"@atlaspack/diagnostic": "2.14.1
|
|
22
|
-
"@atlaspack/domain-sharding": "2.14.1
|
|
23
|
-
"@atlaspack/feature-flags": "2.14.1
|
|
24
|
-
"@atlaspack/plugin": "2.14.1
|
|
25
|
-
"@atlaspack/utils": "2.14.1
|
|
18
|
+
"@atlaspack/diagnostic": "2.14.1",
|
|
19
|
+
"@atlaspack/domain-sharding": "2.14.1",
|
|
20
|
+
"@atlaspack/feature-flags": "2.14.1",
|
|
21
|
+
"@atlaspack/plugin": "2.14.1",
|
|
22
|
+
"@atlaspack/utils": "2.14.1",
|
|
26
23
|
"nullthrows": "^1.1.1"
|
|
27
24
|
},
|
|
28
|
-
"type": "commonjs"
|
|
29
|
-
"gitHead": "08020e0e18819f3e15e74726f9ffa697892f7bfa"
|
|
25
|
+
"type": "commonjs"
|
|
30
26
|
}
|
package/src/JSRuntime.js
CHANGED
|
@@ -19,20 +19,6 @@ import {encodeJSONKeyComponent} from '@atlaspack/diagnostic';
|
|
|
19
19
|
import path from 'path';
|
|
20
20
|
import nullthrows from 'nullthrows';
|
|
21
21
|
import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
22
|
-
import {isSuperPackage} from '@atlaspack/core';
|
|
23
|
-
|
|
24
|
-
const domainShardingImports = isSuperPackage()
|
|
25
|
-
? {
|
|
26
|
-
specifier: '@atlaspack/super/lib/domain-sharding.js',
|
|
27
|
-
helper: './helpers/browser/esm-js-loader-shards-super.js',
|
|
28
|
-
}
|
|
29
|
-
: {
|
|
30
|
-
specifier: '@atlaspack/domain-sharding',
|
|
31
|
-
helper: './helpers/browser/esm-js-loader-shards.js',
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const filename = /*#__ATLASPACK_IGNORE__*/ __filename;
|
|
35
|
-
const dirname = /*#__ATLASPACK_IGNORE__*/ __dirname;
|
|
36
22
|
|
|
37
23
|
// Used for as="" in preload/prefetch
|
|
38
24
|
const TYPE_TO_RESOURCE_PRIORITY = {
|
|
@@ -171,7 +157,7 @@ export default (new Runtime({
|
|
|
171
157
|
// return a simple runtime of `Promise.resolve(internalRequire(assetId))`.
|
|
172
158
|
// The linker handles this for scope-hoisting.
|
|
173
159
|
assets.push({
|
|
174
|
-
filePath:
|
|
160
|
+
filePath: __filename,
|
|
175
161
|
code: `module.exports = Promise.resolve(module.bundle.root(${JSON.stringify(
|
|
176
162
|
bundleGraph.getAssetPublicId(resolved.value),
|
|
177
163
|
)}))`,
|
|
@@ -188,7 +174,10 @@ export default (new Runtime({
|
|
|
188
174
|
);
|
|
189
175
|
if (referencedBundle?.bundleBehavior === 'inline') {
|
|
190
176
|
assets.push({
|
|
191
|
-
filePath: path.join(
|
|
177
|
+
filePath: path.join(
|
|
178
|
+
__dirname,
|
|
179
|
+
`/bundles/${referencedBundle.id}.js`,
|
|
180
|
+
),
|
|
192
181
|
code: `module.exports = Promise.resolve(${JSON.stringify(
|
|
193
182
|
dependency.id,
|
|
194
183
|
)});`,
|
|
@@ -233,7 +222,7 @@ export default (new Runtime({
|
|
|
233
222
|
}')}, function (){return ${requireName}('${cond.ifFalseAssetId}')})`;
|
|
234
223
|
|
|
235
224
|
assets.push({
|
|
236
|
-
filePath: path.join(
|
|
225
|
+
filePath: path.join(__dirname, `/conditions/${cond.publicId}.js`),
|
|
237
226
|
code: assetCode,
|
|
238
227
|
// This dependency is important, as it's the last symbol handled in scope hoisting.
|
|
239
228
|
// That means that scope hoisting will use the module id for this asset to replace the symbol
|
|
@@ -253,7 +242,7 @@ export default (new Runtime({
|
|
|
253
242
|
);
|
|
254
243
|
if (referencedBundle?.bundleBehavior === 'inline') {
|
|
255
244
|
assets.push({
|
|
256
|
-
filePath: path.join(
|
|
245
|
+
filePath: path.join(__dirname, `/bundles/${referencedBundle.id}.js`),
|
|
257
246
|
code: `module.exports = ${JSON.stringify(dependency.id)};`,
|
|
258
247
|
dependency,
|
|
259
248
|
env: {sourceType: 'module'},
|
|
@@ -268,7 +257,7 @@ export default (new Runtime({
|
|
|
268
257
|
// If a URL dependency was not able to be resolved, add a runtime that
|
|
269
258
|
// exports the original specifier.
|
|
270
259
|
assets.push({
|
|
271
|
-
filePath:
|
|
260
|
+
filePath: __filename,
|
|
272
261
|
code: `module.exports = ${JSON.stringify(dependency.specifier)}`,
|
|
273
262
|
dependency,
|
|
274
263
|
env: {sourceType: 'module'},
|
|
@@ -288,19 +277,6 @@ export default (new Runtime({
|
|
|
288
277
|
}),
|
|
289
278
|
);
|
|
290
279
|
|
|
291
|
-
// Skip URL runtime for native node imports as they need to be require
|
|
292
|
-
// directly
|
|
293
|
-
// Currently enabled only for internal builds
|
|
294
|
-
if (process.env.ATLASPACK_SUPER_BUILD === 'true') {
|
|
295
|
-
if (
|
|
296
|
-
mainBundle.bundleBehavior === 'isolated' &&
|
|
297
|
-
mainBundle.env.context === 'node' &&
|
|
298
|
-
mainBundle.type === 'node'
|
|
299
|
-
) {
|
|
300
|
-
continue;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
280
|
// Skip URL runtimes for library builds. This is handled in packaging so that
|
|
305
281
|
// the url is inlined and statically analyzable.
|
|
306
282
|
if (bundle.env.isLibrary && mainBundle.bundleBehavior !== 'isolated') {
|
|
@@ -348,7 +324,7 @@ export default (new Runtime({
|
|
|
348
324
|
config.domainSharding,
|
|
349
325
|
)})`;
|
|
350
326
|
assets.push({
|
|
351
|
-
filePath:
|
|
327
|
+
filePath: __filename,
|
|
352
328
|
code: loaderCode,
|
|
353
329
|
isEntry: true,
|
|
354
330
|
env: {sourceType: 'module'},
|
|
@@ -364,7 +340,7 @@ export default (new Runtime({
|
|
|
364
340
|
isNewContext(bundle, bundleGraph)
|
|
365
341
|
) {
|
|
366
342
|
assets.push({
|
|
367
|
-
filePath:
|
|
343
|
+
filePath: __filename,
|
|
368
344
|
code: getRegisterCode(bundle, bundleGraph),
|
|
369
345
|
isEntry: true,
|
|
370
346
|
env: {sourceType: 'module'},
|
|
@@ -513,7 +489,7 @@ function getLoaderRuntime({
|
|
|
513
489
|
absoluteUrlExpr = `require('./helpers/bundle-manifest').resolve(${publicId})`;
|
|
514
490
|
|
|
515
491
|
if (shardingConfig) {
|
|
516
|
-
absoluteUrlExpr = `require('
|
|
492
|
+
absoluteUrlExpr = `require('@atlaspack/domain-sharding').shardUrl(${absoluteUrlExpr}, ${shardingConfig.maxShards})`;
|
|
517
493
|
}
|
|
518
494
|
} else {
|
|
519
495
|
absoluteUrlExpr = getAbsoluteUrlExpr(
|
|
@@ -709,7 +685,7 @@ function getLoaderRuntime({
|
|
|
709
685
|
}})`;
|
|
710
686
|
|
|
711
687
|
return {
|
|
712
|
-
filePath:
|
|
688
|
+
filePath: __filename,
|
|
713
689
|
code: loaderCode,
|
|
714
690
|
dependency,
|
|
715
691
|
env: {sourceType: 'module'},
|
|
@@ -720,7 +696,7 @@ function getLoaderRuntime({
|
|
|
720
696
|
|
|
721
697
|
if (needsEsmLoadPrelude) {
|
|
722
698
|
let preludeLoad = shardingConfig
|
|
723
|
-
? `let load = require('
|
|
699
|
+
? `let load = require('./helpers/browser/esm-js-loader-shards')(${shardingConfig.maxShards});`
|
|
724
700
|
: `let load = require('./helpers/browser/esm-js-loader');`;
|
|
725
701
|
|
|
726
702
|
code.push(preludeLoad);
|
|
@@ -729,7 +705,7 @@ function getLoaderRuntime({
|
|
|
729
705
|
code.push(`module.exports = ${loaderCode};`);
|
|
730
706
|
|
|
731
707
|
return {
|
|
732
|
-
filePath:
|
|
708
|
+
filePath: __filename,
|
|
733
709
|
code: code.join('\n'),
|
|
734
710
|
dependency,
|
|
735
711
|
env: {sourceType: 'module'},
|
|
@@ -842,7 +818,7 @@ function getURLRuntime(
|
|
|
842
818
|
code += `let bundleURL = require('./helpers/bundle-url');\n`;
|
|
843
819
|
code += `let url = bundleURL.getBundleURL('${from.publicId}') + ${relativePathExpr};`;
|
|
844
820
|
if (shardingConfig) {
|
|
845
|
-
code += `url = require('
|
|
821
|
+
code += `url = require('@atlaspack/domain-sharding').shardUrl(url, ${shardingConfig.maxShards});`;
|
|
846
822
|
}
|
|
847
823
|
code += `module.exports = workerURL(url, bundleURL.getOrigin(url), ${String(
|
|
848
824
|
from.env.outputFormat === 'esmodule',
|
|
@@ -857,7 +833,7 @@ function getURLRuntime(
|
|
|
857
833
|
}
|
|
858
834
|
|
|
859
835
|
return {
|
|
860
|
-
filePath:
|
|
836
|
+
filePath: __filename,
|
|
861
837
|
code,
|
|
862
838
|
dependency,
|
|
863
839
|
env: {sourceType: 'module'},
|
|
@@ -943,7 +919,7 @@ function getAbsoluteUrlExpr(
|
|
|
943
919
|
return regularBundleUrl;
|
|
944
920
|
}
|
|
945
921
|
|
|
946
|
-
return `require('
|
|
922
|
+
return `require('@atlaspack/domain-sharding').shardUrl(${regularBundleUrl}, ${shardingConfig.maxShards})`;
|
|
947
923
|
}
|
|
948
924
|
|
|
949
925
|
function shouldUseRuntimeManifest(
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
export type AtlaspackAnalyticsEvent = {|
|
|
4
4
|
action: string,
|
|
5
|
-
attributes?: {
|
|
5
|
+
attributes?: {[key: string]: string | number | boolean},
|
|
6
6
|
|};
|
|
7
7
|
|
|
8
|
-
declare export function sendAnalyticsEvent(
|
|
8
|
+
declare export function sendAnalyticsEvent(
|
|
9
|
+
event: AtlaspackAnalyticsEvent,
|
|
10
|
+
): void;
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright (c) 2024 Atlassian US., Inc.
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
let load = (maxShards) => (id) => {
|
|
2
|
-
// eslint-disable-next-line no-undef
|
|
3
|
-
return __parcel__import__(
|
|
4
|
-
require('@atlaspack/super/lib/domain-sharding').shardUrl(
|
|
5
|
-
require('../bundle-manifest').resolve(id),
|
|
6
|
-
maxShards,
|
|
7
|
-
),
|
|
8
|
-
);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
module.exports = load;
|