@atlaspack/packager-js 2.24.9-dev-swc44-53cdb819f.0 → 2.24.9
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 +16 -0
- package/dist/ScopeHoistingPackager.js +10 -19
- package/lib/ScopeHoistingPackager.js +12 -18
- package/package.json +9 -10
- package/src/ScopeHoistingPackager.ts +12 -18
- package/tsconfig.tsbuildinfo +1 -1
- package/LICENSE +0 -201
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaspack/packager-js
|
|
2
2
|
|
|
3
|
+
## 2.24.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#953](https://github.com/atlassian-labs/atlaspack/pull/953) [`c31090c`](https://github.com/atlassian-labs/atlaspack/commit/c31090c9025f35d3fa8561b42dca170853a32e6f) Thanks [@marcins](https://github.com/marcins)! - Cleanup feature flag precomputeReferencedAssets
|
|
8
|
+
|
|
9
|
+
- [#950](https://github.com/atlassian-labs/atlaspack/pull/950) [`cd7e2c2`](https://github.com/atlassian-labs/atlaspack/commit/cd7e2c2bbaad08f3f045a86691bfd4f9879b0b44) Thanks [@marcins](https://github.com/marcins)! - Improve error message when asset is not found in packaging.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`47aa84e`](https://github.com/atlassian-labs/atlaspack/commit/47aa84e44c61066072a5bf3d57678565b9d2c5a3), [`564fb4f`](https://github.com/atlassian-labs/atlaspack/commit/564fb4fecc2a20bdeb951863a8fac29b618d91b7), [`9df722c`](https://github.com/atlassian-labs/atlaspack/commit/9df722c38b225054883693ba9731344f701767a7), [`c31090c`](https://github.com/atlassian-labs/atlaspack/commit/c31090c9025f35d3fa8561b42dca170853a32e6f), [`565bab3`](https://github.com/atlassian-labs/atlaspack/commit/565bab3771cc334659d873cabff4cdfac0860cc7), [`34b01ec`](https://github.com/atlassian-labs/atlaspack/commit/34b01ec03e2264bd617be000465821e1ed11eae5), [`6e5fec1`](https://github.com/atlassian-labs/atlaspack/commit/6e5fec1406c53257be7e7fbe06c028beda70fcf1), [`e4e5522`](https://github.com/atlassian-labs/atlaspack/commit/e4e55222422d8c73653d3ea09f1a0d13946345b9)]:
|
|
12
|
+
- @atlaspack/utils@3.3.0
|
|
13
|
+
- @atlaspack/rust@3.18.0
|
|
14
|
+
- @atlaspack/feature-flags@2.27.6
|
|
15
|
+
- @atlaspack/source-map@3.2.3
|
|
16
|
+
- @atlaspack/types@2.15.38
|
|
17
|
+
- @atlaspack/plugin@2.14.48
|
|
18
|
+
|
|
3
19
|
## 2.24.8
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -304,13 +304,11 @@ class ScopeHoistingPackager {
|
|
|
304
304
|
// Helper to check if an asset is referenced, with cache-first + fast-check hybrid approach
|
|
305
305
|
isAssetReferencedInBundle(bundle, asset) {
|
|
306
306
|
// STEP 1: Check expensive computation cache first (fastest when it hits)
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
return referencedAssets.has(asset);
|
|
313
|
-
}
|
|
307
|
+
let bundleId = bundle.id;
|
|
308
|
+
let referencedAssets = this.referencedAssetsCache.get(bundleId);
|
|
309
|
+
if (referencedAssets) {
|
|
310
|
+
// Cache hit - fastest path (~0.001ms)
|
|
311
|
+
return referencedAssets.has(asset);
|
|
314
312
|
}
|
|
315
313
|
// STEP 2: Cache miss - try fast checks (~0.01ms)
|
|
316
314
|
let fastCheckResult = this.bundleGraph.isAssetReferencedFastCheck(bundle, asset);
|
|
@@ -319,17 +317,10 @@ class ScopeHoistingPackager {
|
|
|
319
317
|
return true;
|
|
320
318
|
}
|
|
321
319
|
// STEP 3: Need expensive computation (~20-2000ms)
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
this.referencedAssetsCache.set(bundleId, referencedAssets);
|
|
327
|
-
return referencedAssets.has(asset);
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
// No caching - fall back to original expensive method
|
|
331
|
-
return this.bundleGraph.isAssetReferenced(bundle, asset);
|
|
332
|
-
}
|
|
320
|
+
// Compute and cache expensive results for this bundle
|
|
321
|
+
referencedAssets = this.bundleGraph.getReferencedAssets(bundle);
|
|
322
|
+
this.referencedAssetsCache.set(bundleId, referencedAssets);
|
|
323
|
+
return referencedAssets.has(asset);
|
|
333
324
|
}
|
|
334
325
|
async loadAssets() {
|
|
335
326
|
let queue = new utils_1.PromiseQueue({
|
|
@@ -1056,7 +1047,7 @@ ${code}
|
|
|
1056
1047
|
'<unknown>';
|
|
1057
1048
|
let resolvedPath = path_1.default.relative(this.options.projectRoot, resolvedAsset.filePath) ||
|
|
1058
1049
|
'<unknown>';
|
|
1059
|
-
(0, assert_1.default)(false, `Asset was skipped or not found.\nSearching for exported symbol "${imported}" (resolved as "${exportSymbol}") in asset with id "${resolvedAsset.meta.id}" (public id: "${publicId}", path: "${resolvedPath}") from parent asset "${parentAsset.meta.id}" (path: "${parentPath}").`);
|
|
1050
|
+
(0, assert_1.default)(false, `Asset was skipped or not found when packaging ${this.bundle.name}.\nSearching for exported symbol "${imported}" (resolved as "${exportSymbol}") in asset with id "${resolvedAsset.meta.id}" (public id: "${publicId}", path: "${resolvedPath}") from parent asset "${parentAsset.meta.id}" (path: "${parentPath}").`);
|
|
1060
1051
|
}
|
|
1061
1052
|
else {
|
|
1062
1053
|
return replacements?.get(symbol) || symbol;
|
|
@@ -304,13 +304,12 @@ class ScopeHoistingPackager {
|
|
|
304
304
|
// Helper to check if an asset is referenced, with cache-first + fast-check hybrid approach
|
|
305
305
|
isAssetReferencedInBundle(bundle, asset) {
|
|
306
306
|
// STEP 1: Check expensive computation cache first (fastest when it hits)
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
307
|
+
|
|
308
|
+
let bundleId = bundle.id;
|
|
309
|
+
let referencedAssets = this.referencedAssetsCache.get(bundleId);
|
|
310
|
+
if (referencedAssets) {
|
|
311
|
+
// Cache hit - fastest path (~0.001ms)
|
|
312
|
+
return referencedAssets.has(asset);
|
|
314
313
|
}
|
|
315
314
|
|
|
316
315
|
// STEP 2: Cache miss - try fast checks (~0.01ms)
|
|
@@ -321,16 +320,11 @@ class ScopeHoistingPackager {
|
|
|
321
320
|
}
|
|
322
321
|
|
|
323
322
|
// STEP 3: Need expensive computation (~20-2000ms)
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
return referencedAssets.has(asset);
|
|
330
|
-
} else {
|
|
331
|
-
// No caching - fall back to original expensive method
|
|
332
|
-
return this.bundleGraph.isAssetReferenced(bundle, asset);
|
|
333
|
-
}
|
|
323
|
+
|
|
324
|
+
// Compute and cache expensive results for this bundle
|
|
325
|
+
referencedAssets = this.bundleGraph.getReferencedAssets(bundle);
|
|
326
|
+
this.referencedAssetsCache.set(bundleId, referencedAssets);
|
|
327
|
+
return referencedAssets.has(asset);
|
|
334
328
|
}
|
|
335
329
|
async loadAssets() {
|
|
336
330
|
let queue = new (_utils().PromiseQueue)({
|
|
@@ -1003,7 +997,7 @@ ${code}
|
|
|
1003
997
|
} else if (!symbol) {
|
|
1004
998
|
let parentPath = _path().default.relative(this.options.projectRoot, parentAsset.filePath) || '<unknown>';
|
|
1005
999
|
let resolvedPath = _path().default.relative(this.options.projectRoot, resolvedAsset.filePath) || '<unknown>';
|
|
1006
|
-
(0, _assert().default)(false, `Asset was skipped or not found.\nSearching for exported symbol "${imported}" (resolved as "${exportSymbol}") in asset with id "${resolvedAsset.meta.id}" (public id: "${publicId}", path: "${resolvedPath}") from parent asset "${parentAsset.meta.id}" (path: "${parentPath}").`);
|
|
1000
|
+
(0, _assert().default)(false, `Asset was skipped or not found when packaging ${this.bundle.name}.\nSearching for exported symbol "${imported}" (resolved as "${exportSymbol}") in asset with id "${resolvedAsset.meta.id}" (public id: "${publicId}", path: "${resolvedPath}") from parent asset "${parentAsset.meta.id}" (path: "${parentPath}").`);
|
|
1007
1001
|
} else {
|
|
1008
1002
|
return (replacements === null || replacements === void 0 ? void 0 : replacements.get(symbol)) || symbol;
|
|
1009
1003
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/packager-js",
|
|
3
|
-
"version": "2.24.9
|
|
3
|
+
"version": "2.24.9",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"node": ">= 16.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atlaspack/diagnostic": "2.14.
|
|
20
|
-
"@atlaspack/feature-flags": "2.27.6
|
|
21
|
-
"@atlaspack/plugin": "2.14.48
|
|
22
|
-
"@atlaspack/rust": "3.
|
|
23
|
-
"@atlaspack/source-map": "3.2.3
|
|
24
|
-
"@atlaspack/types": "2.15.38
|
|
25
|
-
"@atlaspack/utils": "3.
|
|
19
|
+
"@atlaspack/diagnostic": "2.14.4",
|
|
20
|
+
"@atlaspack/feature-flags": "2.27.6",
|
|
21
|
+
"@atlaspack/plugin": "2.14.48",
|
|
22
|
+
"@atlaspack/rust": "3.18.0",
|
|
23
|
+
"@atlaspack/source-map": "3.2.3",
|
|
24
|
+
"@atlaspack/types": "2.15.38",
|
|
25
|
+
"@atlaspack/utils": "3.3.0",
|
|
26
26
|
"globals": "^13.2.0",
|
|
27
27
|
"nullthrows": "^1.1.1",
|
|
28
28
|
"outdent": "^0.8.0"
|
|
@@ -30,6 +30,5 @@
|
|
|
30
30
|
"type": "commonjs",
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
33
|
-
}
|
|
34
|
-
"gitHead": "53cdb819f1739c63fb7dc9769cdd64352c097f9a"
|
|
33
|
+
}
|
|
35
34
|
}
|
|
@@ -415,14 +415,13 @@ export class ScopeHoistingPackager {
|
|
|
415
415
|
// Helper to check if an asset is referenced, with cache-first + fast-check hybrid approach
|
|
416
416
|
isAssetReferencedInBundle(bundle: NamedBundle, asset: Asset): boolean {
|
|
417
417
|
// STEP 1: Check expensive computation cache first (fastest when it hits)
|
|
418
|
-
if (getFeatureFlag('precomputeReferencedAssets')) {
|
|
419
|
-
let bundleId = bundle.id;
|
|
420
|
-
let referencedAssets = this.referencedAssetsCache.get(bundleId);
|
|
421
418
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
419
|
+
let bundleId = bundle.id;
|
|
420
|
+
let referencedAssets = this.referencedAssetsCache.get(bundleId);
|
|
421
|
+
|
|
422
|
+
if (referencedAssets) {
|
|
423
|
+
// Cache hit - fastest path (~0.001ms)
|
|
424
|
+
return referencedAssets.has(asset);
|
|
426
425
|
}
|
|
427
426
|
|
|
428
427
|
// STEP 2: Cache miss - try fast checks (~0.01ms)
|
|
@@ -437,17 +436,12 @@ export class ScopeHoistingPackager {
|
|
|
437
436
|
}
|
|
438
437
|
|
|
439
438
|
// STEP 3: Need expensive computation (~20-2000ms)
|
|
440
|
-
if (getFeatureFlag('precomputeReferencedAssets')) {
|
|
441
|
-
// Compute and cache expensive results for this bundle
|
|
442
|
-
let bundleId = bundle.id;
|
|
443
|
-
let referencedAssets = this.bundleGraph.getReferencedAssets(bundle);
|
|
444
|
-
this.referencedAssetsCache.set(bundleId, referencedAssets);
|
|
445
439
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
440
|
+
// Compute and cache expensive results for this bundle
|
|
441
|
+
referencedAssets = this.bundleGraph.getReferencedAssets(bundle);
|
|
442
|
+
this.referencedAssetsCache.set(bundleId, referencedAssets);
|
|
443
|
+
|
|
444
|
+
return referencedAssets.has(asset);
|
|
451
445
|
}
|
|
452
446
|
|
|
453
447
|
async loadAssets() {
|
|
@@ -1395,7 +1389,7 @@ ${code}
|
|
|
1395
1389
|
'<unknown>';
|
|
1396
1390
|
invariant(
|
|
1397
1391
|
false,
|
|
1398
|
-
`Asset was skipped or not found.\nSearching for exported symbol "${imported}" (resolved as "${exportSymbol}") in asset with id "${resolvedAsset.meta.id}" (public id: "${publicId}", path: "${resolvedPath}") from parent asset "${parentAsset.meta.id}" (path: "${parentPath}").`,
|
|
1392
|
+
`Asset was skipped or not found when packaging ${this.bundle.name}.\nSearching for exported symbol "${imported}" (resolved as "${exportSymbol}") in asset with id "${resolvedAsset.meta.id}" (public id: "${publicId}", path: "${resolvedPath}") from parent asset "${parentAsset.meta.id}" (path: "${parentPath}").`,
|
|
1399
1393
|
);
|
|
1400
1394
|
} else {
|
|
1401
1395
|
return replacements?.get(symbol) || symbol;
|