@atlaspack/core 2.34.0 → 2.36.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/AssetGraph.js +4 -72
  3. package/dist/BundleGraph.js +34 -0
  4. package/dist/PackagerRunner.js +8 -53
  5. package/dist/RequestTracker.js +17 -80
  6. package/dist/TargetDescriptor.schema.js +3 -0
  7. package/dist/UncommittedAsset.js +0 -5
  8. package/dist/atlaspack-v3/AtlaspackV3.js +6 -2
  9. package/dist/requests/AssetGraphRequest.js +6 -15
  10. package/dist/requests/AssetGraphRequestRust.js +51 -7
  11. package/dist/requests/AtlaspackBuildRequest.js +8 -2
  12. package/dist/requests/BundleGraphRequest.js +17 -21
  13. package/dist/requests/BundleGraphRequestRust.js +2 -2
  14. package/dist/requests/BundleGraphRequestUtils.js +133 -2
  15. package/dist/requests/PackageRequest.js +1 -1
  16. package/dist/requests/TargetRequest.js +5 -0
  17. package/dist/requests/WriteBundleRequest.js +169 -24
  18. package/dist/resolveOptions.js +2 -4
  19. package/lib/AssetGraph.js +3 -62
  20. package/lib/BundleGraph.js +38 -0
  21. package/lib/PackagerRunner.js +8 -42
  22. package/lib/RequestTracker.js +15 -69
  23. package/lib/TargetDescriptor.schema.js +3 -0
  24. package/lib/UncommittedAsset.js +0 -11
  25. package/lib/atlaspack-v3/AtlaspackV3.js +6 -2
  26. package/lib/requests/AssetGraphRequest.js +4 -18
  27. package/lib/requests/AssetGraphRequestRust.js +51 -7
  28. package/lib/requests/AtlaspackBuildRequest.js +8 -2
  29. package/lib/requests/BundleGraphRequest.js +20 -22
  30. package/lib/requests/BundleGraphRequestRust.js +3 -3
  31. package/lib/requests/BundleGraphRequestUtils.js +132 -2
  32. package/lib/requests/PackageRequest.js +3 -1
  33. package/lib/requests/TargetRequest.js +5 -0
  34. package/lib/requests/WriteBundleRequest.js +182 -14
  35. package/lib/resolveOptions.js +2 -4
  36. package/lib/types/AssetGraph.d.ts +2 -27
  37. package/lib/types/BundleGraph.d.ts +5 -0
  38. package/lib/types/atlaspack-v3/AtlaspackV3.d.ts +3 -2
  39. package/lib/types/requests/BundleGraphRequest.d.ts +1 -1
  40. package/lib/types/requests/BundleGraphRequestUtils.d.ts +7 -0
  41. package/lib/types/requests/WriteBundleRequest.d.ts +33 -0
  42. package/lib/types/types.d.ts +1 -0
  43. package/package.json +15 -15
  44. package/src/AssetGraph.ts +4 -72
  45. package/src/BundleGraph.ts +39 -0
  46. package/src/PackagerRunner.ts +9 -55
  47. package/src/RequestTracker.ts +24 -110
  48. package/src/TargetDescriptor.schema.ts +3 -0
  49. package/src/UncommittedAsset.ts +1 -11
  50. package/src/atlaspack-v3/AtlaspackV3.ts +19 -3
  51. package/src/requests/AssetGraphRequest.ts +8 -20
  52. package/src/requests/AssetGraphRequestRust.ts +59 -7
  53. package/src/requests/AtlaspackBuildRequest.ts +16 -8
  54. package/src/requests/BundleGraphRequest.ts +22 -36
  55. package/src/requests/BundleGraphRequestRust.ts +4 -2
  56. package/src/requests/BundleGraphRequestUtils.ts +157 -1
  57. package/src/requests/PackageRequest.ts +1 -1
  58. package/src/requests/TargetRequest.ts +5 -0
  59. package/src/requests/WriteBundleRequest.ts +203 -29
  60. package/src/resolveOptions.ts +2 -4
  61. package/src/types.ts +1 -0
  62. package/test/AssetGraph.test.ts +0 -32
  63. package/test/RequestTracker.test.ts +0 -165
  64. package/test/TargetRequest.test.ts +25 -0
  65. package/test/requests/WriteBundleRequest.test.ts +363 -0
  66. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,75 @@
1
1
  # @atlaspack/core
2
2
 
3
+ ## 2.36.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1047](https://github.com/atlassian-labs/atlaspack/pull/1047) [`de388ff`](https://github.com/atlassian-labs/atlaspack/commit/de388ff76d39dece97ad475fcccdb6efb6283bfc) Thanks [@marcins](https://github.com/marcins)! - Change approach to source map offset for hashRefs - use a streaming approach to avoid loading large sourcemaps into memory.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#1025](https://github.com/atlassian-labs/atlaspack/pull/1025) [`f7878b2`](https://github.com/atlassian-labs/atlaspack/commit/f7878b2f19a0a3bbd0e79d0b4a4e1479646043b7) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Add native ideal graph bundling algorithm behind nativeBundling feature flag
12
+
13
+ - Updated dependencies [[`f7878b2`](https://github.com/atlassian-labs/atlaspack/commit/f7878b2f19a0a3bbd0e79d0b4a4e1479646043b7), [`22bb49c`](https://github.com/atlassian-labs/atlaspack/commit/22bb49c5708798d259f98c8b5c10850b2f4f5f1b), [`bddd21a`](https://github.com/atlassian-labs/atlaspack/commit/bddd21a5313974ca333c02b2da1c6f85d1afaaea), [`de388ff`](https://github.com/atlassian-labs/atlaspack/commit/de388ff76d39dece97ad475fcccdb6efb6283bfc)]:
14
+ - @atlaspack/rust@3.24.1
15
+ - @atlaspack/source-map@3.3.0
16
+ - @atlaspack/cache@3.2.51
17
+ - @atlaspack/fs@2.15.51
18
+ - @atlaspack/logger@2.14.48
19
+ - @atlaspack/utils@3.3.8
20
+ - @atlaspack/package-manager@2.14.56
21
+ - @atlaspack/profiler@2.15.17
22
+ - @atlaspack/workers@2.14.56
23
+ - @atlaspack/graph@3.6.18
24
+ - @atlaspack/plugin@2.14.56
25
+ - @atlaspack/types@2.15.46
26
+
27
+ ## 2.35.0
28
+
29
+ ### Minor Changes
30
+
31
+ - [#1042](https://github.com/atlassian-labs/atlaspack/pull/1042) [`857962a`](https://github.com/atlassian-labs/atlaspack/commit/857962a352bb0aebaf74a8765e8c44d7e875a4e9) Thanks [@marcins](https://github.com/marcins)! - Implement inlineRequires in native packager, add new option to target descriptor
32
+
33
+ ### Patch Changes
34
+
35
+ - [#1040](https://github.com/atlassian-labs/atlaspack/pull/1040) [`f9aec27`](https://github.com/atlassian-labs/atlaspack/commit/f9aec2736d27afa7a1f2a9701d46e29e566ab352) Thanks [@benjervis](https://github.com/benjervis)! - Add support for star re-exports (`export * from './dep'`) in the Rust symbol tracker.
36
+
37
+ This enables proper symbol propagation through barrel files that use star re-exports,
38
+ allowing tree-shaking to work correctly for these patterns. Includes support for:
39
+ - Chained star re-exports (multiple levels of `export *`)
40
+ - Diamond patterns (multiple paths to the same symbol through different star re-exports)
41
+ - Speculative requirement cleanup (efficient tracking and removal of unsatisfied paths)
42
+
43
+ Note: This does not yet handle the ambiguous re-export case where multiple star re-exports
44
+ provide the same symbol name. That case currently requires runtime namespace fallback and
45
+ will be addressed in a future update.
46
+
47
+ - [#1034](https://github.com/atlassian-labs/atlaspack/pull/1034) [`93ec107`](https://github.com/atlassian-labs/atlaspack/commit/93ec10729ad5a328b4320955357339746cd472f3) Thanks [@vykimnguyen](https://github.com/vykimnguyen)! - adding incremental bundle graph update for packaging
48
+
49
+ - [#1036](https://github.com/atlassian-labs/atlaspack/pull/1036) [`e88b258`](https://github.com/atlassian-labs/atlaspack/commit/e88b25808a181fafbe98e5ca278b35bfc0197caf) Thanks [@benjervis](https://github.com/benjervis)! - Fix Rust symbol tracker to correctly handle renamed exports during symbol propagation through barrel files.
50
+
51
+ - [#1046](https://github.com/atlassian-labs/atlaspack/pull/1046) [`cbc815a`](https://github.com/atlassian-labs/atlaspack/commit/cbc815a23907e081b7203bdea37bd57befdd4b9e) Thanks [@matt-koko](https://github.com/matt-koko)! - we do a little logging for the duplicate content key thing yup
52
+
53
+ - [#1044](https://github.com/atlassian-labs/atlaspack/pull/1044) [`ad3c822`](https://github.com/atlassian-labs/atlaspack/commit/ad3c8223ab1abce9e8da81239cc56f27d37c7cad) Thanks [@vykimnguyen](https://github.com/vykimnguyen)! - cleanup incrementalBundlingVersioning flag
54
+
55
+ - [#1035](https://github.com/atlassian-labs/atlaspack/pull/1035) [`936209f`](https://github.com/atlassian-labs/atlaspack/commit/936209f3c6c201288720dd62b61e1f538368268c) Thanks [@marcins](https://github.com/marcins)! - Remove `cachePerformanceImprovements` feature flag
56
+
57
+ - Updated dependencies [[`06bb8c1`](https://github.com/atlassian-labs/atlaspack/commit/06bb8c14657722658c55283835f23ed7e7c6ecb4), [`a2d8e7a`](https://github.com/atlassian-labs/atlaspack/commit/a2d8e7a2444a1d6502239de8b8ceab4227270ec7), [`f9aec27`](https://github.com/atlassian-labs/atlaspack/commit/f9aec2736d27afa7a1f2a9701d46e29e566ab352), [`ecf8b79`](https://github.com/atlassian-labs/atlaspack/commit/ecf8b7931c5516df2117d525cefff5d7e1d20bee), [`93ec107`](https://github.com/atlassian-labs/atlaspack/commit/93ec10729ad5a328b4320955357339746cd472f3), [`a2c5747`](https://github.com/atlassian-labs/atlaspack/commit/a2c574770d2e616576e817801842576ead072532), [`f216e22`](https://github.com/atlassian-labs/atlaspack/commit/f216e227e0aca8a3944f66267d3f75238c732802), [`e88b258`](https://github.com/atlassian-labs/atlaspack/commit/e88b25808a181fafbe98e5ca278b35bfc0197caf), [`ad3c822`](https://github.com/atlassian-labs/atlaspack/commit/ad3c8223ab1abce9e8da81239cc56f27d37c7cad), [`936209f`](https://github.com/atlassian-labs/atlaspack/commit/936209f3c6c201288720dd62b61e1f538368268c), [`857962a`](https://github.com/atlassian-labs/atlaspack/commit/857962a352bb0aebaf74a8765e8c44d7e875a4e9)]:
58
+ - @atlaspack/rust@3.24.0
59
+ - @atlaspack/feature-flags@2.30.1
60
+ - @atlaspack/cache@3.2.50
61
+ - @atlaspack/fs@2.15.50
62
+ - @atlaspack/logger@2.14.47
63
+ - @atlaspack/source-map@3.2.10
64
+ - @atlaspack/utils@3.3.7
65
+ - @atlaspack/build-cache@2.13.13
66
+ - @atlaspack/graph@3.6.17
67
+ - @atlaspack/plugin@2.14.55
68
+ - @atlaspack/profiler@2.15.16
69
+ - @atlaspack/types@2.15.45
70
+ - @atlaspack/workers@2.14.55
71
+ - @atlaspack/package-manager@2.14.55
72
+
3
73
  ## 2.34.0
4
74
 
5
75
  ### Minor Changes
@@ -1,19 +1,7 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
16
- var _AssetGraph_bundlingVersion, _AssetGraph_disableIncrementalBundling;
17
5
  Object.defineProperty(exports, "__esModule", { value: true });
18
6
  exports.nodeFromDep = nodeFromDep;
19
7
  exports.nodeFromAssetGroup = nodeFromAssetGroup;
@@ -89,25 +77,12 @@ function nodeFromEntryFile(entry) {
89
77
  // @ts-expect-error TS2417
90
78
  class AssetGraph extends graph_1.ContentGraph {
91
79
  constructor(opts) {
92
- /**
93
- * Incremented when the asset graph is modified such that it requires a bundling pass.
94
- */
95
- _AssetGraph_bundlingVersion.set(this, 0);
96
- /**
97
- * Force incremental bundling to be disabled.
98
- */
99
- _AssetGraph_disableIncrementalBundling.set(this, false);
100
- /**
101
- * @deprecated
102
- */
103
80
  this.safeToIncrementallyBundle = true;
104
81
  if (opts) {
105
- let { hash, bundlingVersion, disableIncrementalBundling, ...rest } = opts;
82
+ let { hash, ...rest } = opts;
106
83
  // @ts-expect-error TS2345
107
84
  super(rest);
108
85
  this.hash = hash;
109
- __classPrivateFieldSet(this, _AssetGraph_bundlingVersion, bundlingVersion ?? 0, "f");
110
- __classPrivateFieldSet(this, _AssetGraph_disableIncrementalBundling, disableIncrementalBundling ?? false, "f");
111
86
  }
112
87
  else {
113
88
  super();
@@ -126,55 +101,15 @@ class AssetGraph extends graph_1.ContentGraph {
126
101
  serialize() {
127
102
  return {
128
103
  ...super.serialize(),
129
- bundlingVersion: __classPrivateFieldGet(this, _AssetGraph_bundlingVersion, "f"),
130
- disableIncrementalBundling: __classPrivateFieldGet(this, _AssetGraph_disableIncrementalBundling, "f"),
131
104
  hash: this.hash,
132
105
  };
133
106
  }
134
107
  /**
135
- * Force incremental bundling to be disabled.
136
- */
137
- setDisableIncrementalBundling(disable) {
138
- __classPrivateFieldSet(this, _AssetGraph_disableIncrementalBundling, disable, "f");
139
- }
140
- testing_getDisableIncrementalBundling() {
141
- return __classPrivateFieldGet(this, _AssetGraph_disableIncrementalBundling, "f");
142
- }
143
- /**
144
- * Make sure this asset graph is marked as needing a full bundling pass.
145
- */
146
- setNeedsBundling() {
147
- if (!(0, feature_flags_1.getFeatureFlag)('incrementalBundlingVersioning')) {
148
- // In legacy mode, we rely solely on safeToIncrementallyBundle to
149
- // invalidate incremental bundling, so we skip bumping the version.
150
- return;
151
- }
152
- __classPrivateFieldSet(this, _AssetGraph_bundlingVersion, __classPrivateFieldGet(this, _AssetGraph_bundlingVersion, "f") + 1, "f");
153
- }
154
- /**
155
- * Get the current bundling version.
156
- *
157
- * Each bundle pass should keep this version around. Whenever an asset graph has a new version,
158
- * bundling should be re-run.
159
- */
160
- getBundlingVersion() {
161
- if (!(0, feature_flags_1.getFeatureFlag)('incrementalBundlingVersioning')) {
162
- return 0;
163
- }
164
- return __classPrivateFieldGet(this, _AssetGraph_bundlingVersion, "f");
165
- }
166
- /**
167
- * If the `bundlingVersion` has not changed since the last bundling pass,
168
- * we can incrementally bundle, which will not require a full bundling pass
108
+ * Determine if we can incrementally bundle, which will not require a full bundling pass
169
109
  * but just update assets into the bundle graph output.
170
110
  */
171
- canIncrementallyBundle(lastVersion) {
172
- if (!(0, feature_flags_1.getFeatureFlag)('incrementalBundlingVersioning')) {
173
- return (this.safeToIncrementallyBundle && !__classPrivateFieldGet(this, _AssetGraph_disableIncrementalBundling, "f"));
174
- }
175
- return (this.safeToIncrementallyBundle &&
176
- __classPrivateFieldGet(this, _AssetGraph_bundlingVersion, "f") === lastVersion &&
177
- !__classPrivateFieldGet(this, _AssetGraph_disableIncrementalBundling, "f"));
111
+ canIncrementallyBundle() {
112
+ return this.safeToIncrementallyBundle;
178
113
  }
179
114
  // Deduplicates Environments by making them referentially equal
180
115
  normalizeEnvironment(input) {
@@ -350,14 +285,12 @@ class AssetGraph extends graph_1.ContentGraph {
350
285
  // @ts-expect-error TS2339
351
286
  if (!ctx?.hasDeferred) {
352
287
  this.safeToIncrementallyBundle = false;
353
- this.setNeedsBundling();
354
288
  delete traversedNode.hasDeferred;
355
289
  }
356
290
  actions.skipChildren();
357
291
  }
358
292
  else if (traversedNode.type === 'dependency') {
359
293
  this.safeToIncrementallyBundle = false;
360
- this.setNeedsBundling();
361
294
  traversedNode.hasDeferred = false;
362
295
  }
363
296
  else if (nodeId !== traversedNodeId) {
@@ -587,5 +520,4 @@ class AssetGraph extends graph_1.ContentGraph {
587
520
  return this.hash;
588
521
  }
589
522
  }
590
- _AssetGraph_bundlingVersion = new WeakMap(), _AssetGraph_disableIncrementalBundling = new WeakMap();
591
523
  exports.default = AssetGraph;
@@ -449,6 +449,40 @@ class BundleGraph {
449
449
  });
450
450
  return { nodesJson, edges, publicIdByAssetId, environmentsJson };
451
451
  }
452
+ /**
453
+ * Serialize only the given asset nodes for native incremental update.
454
+ * Same node shape and env/omit logic as serializeForNative.
455
+ */
456
+ serializeAssetNodesForNative(assetIds) {
457
+ const start = performance.now();
458
+ if (assetIds.length === 0) {
459
+ return '[]';
460
+ }
461
+ const nodes = [];
462
+ for (const assetId of assetIds) {
463
+ const node = this._graph.getNodeByContentKey(assetId);
464
+ if (node?.type !== 'asset') {
465
+ continue;
466
+ }
467
+ const processedNode = { ...node };
468
+ if (node.value?.env) {
469
+ processedNode.value = {
470
+ ...node.value,
471
+ env: (0, EnvironmentManager_1.fromEnvironmentId)(node.value.env).id,
472
+ };
473
+ }
474
+ nodes.push(processedNode);
475
+ }
476
+ const optimizedNodes = nodes.map((node) => this._omitNulls(node));
477
+ const nodesJson = JSON.stringify(optimizedNodes);
478
+ const duration = performance.now() - start;
479
+ const nodesSizeMB = (nodesJson.length / (1024 * 1024)).toFixed(2);
480
+ logger_1.default.verbose({
481
+ origin: '@atlaspack/core',
482
+ message: `serializeAssetNodesForNative: ${duration.toFixed(1)}ms, ${nodesSizeMB}MB nodes, ${nodes.length} nodes`,
483
+ });
484
+ return nodesJson;
485
+ }
452
486
  /**
453
487
  * Remove null and undefined values from an object to reduce JSON size.
454
488
  * Preserves false, 0, empty strings, and arrays.
@@ -60,7 +60,6 @@ const DevDepRequest_2 = require("./requests/DevDepRequest");
60
60
  const WriteBundleRequest_1 = require("./requests/WriteBundleRequest");
61
61
  const profiler_1 = require("@atlaspack/profiler");
62
62
  const EnvironmentManager_1 = require("./EnvironmentManager");
63
- const feature_flags_1 = require("@atlaspack/feature-flags");
64
63
  const BOUNDARY_LENGTH = constants_1.HASH_REF_PREFIX.length + 32 - 1;
65
64
  // Packager/optimizer configs are not bundle-specific, so we only need to
66
65
  // load them once per build.
@@ -366,18 +365,6 @@ class PackagerRunner {
366
365
  devDepHashes += await this.getDevDepHashes(inlineBundle);
367
366
  }
368
367
  let invalidationHash = await (0, assetUtils_1.getInvalidationHash)(invalidations, this.options);
369
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
370
- const hash = (0, rust_1.hashString)(constants_1.ATLASPACK_VERSION +
371
- devDepHashes +
372
- invalidationHash +
373
- bundle.target.publicUrl +
374
- bundleGraph.getHash(bundle) +
375
- JSON.stringify(configResults) +
376
- JSON.stringify(globalInfoResults) +
377
- this.options.mode +
378
- (this.options.shouldBuildLazily ? 'lazy' : 'eager'));
379
- return path_1.default.join(bundle.displayName ?? bundle.name ?? bundle.id, hash);
380
- }
381
368
  return (0, rust_1.hashString)(constants_1.ATLASPACK_VERSION +
382
369
  devDepHashes +
383
370
  invalidationHash +
@@ -407,23 +394,17 @@ class PackagerRunner {
407
394
  let contentKey = PackagerRunner.getContentKey(cacheKey);
408
395
  let mapKey = PackagerRunner.getMapKey(cacheKey);
409
396
  let isLargeBlob = await this.options.cache.hasLargeBlob(contentKey);
410
- let contentExists = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
411
- ? isLargeBlob
412
- : isLargeBlob || (await this.options.cache.has(contentKey));
397
+ let contentExists = isLargeBlob || (await this.options.cache.has(contentKey));
413
398
  if (!contentExists) {
414
399
  return null;
415
400
  }
416
- let mapExists = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
417
- ? await this.options.cache.hasLargeBlob(mapKey)
418
- : await this.options.cache.has(mapKey);
401
+ let mapExists = await this.options.cache.has(mapKey);
419
402
  return {
420
403
  contents: isLargeBlob
421
404
  ? this.options.cache.getStream(contentKey)
422
405
  : (0, utils_1.blobToStream)(await this.options.cache.getBlob(contentKey)),
423
406
  map: mapExists
424
- ? (0, utils_1.blobToStream)((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
425
- ? await this.options.cache.getLargeBlob(mapKey)
426
- : await this.options.cache.getBlob(mapKey))
407
+ ? (0, utils_1.blobToStream)(await this.options.cache.getBlob(mapKey))
427
408
  : null,
428
409
  };
429
410
  }
@@ -432,12 +413,10 @@ class PackagerRunner {
432
413
  let hash;
433
414
  // @ts-expect-error TS2702
434
415
  let hashReferences = [];
435
- let isLargeBlob = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements');
416
+ let isLargeBlob = false;
436
417
  // TODO: don't replace hash references in binary files??
437
418
  if (contents instanceof stream_1.Readable) {
438
- if (!(0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
439
- isLargeBlob = true;
440
- }
419
+ isLargeBlob = true;
441
420
  let boundaryStr = '';
442
421
  let h = new rust_1.Hash();
443
422
  await this.options.cache.setStream(cacheKeys.content, (0, utils_1.blobToStream)(contents).pipe(
@@ -456,31 +435,16 @@ class PackagerRunner {
456
435
  size = buffer.byteLength;
457
436
  hash = (0, rust_1.hashBuffer)(buffer);
458
437
  hashReferences = contents.match(constants_1.HASH_REF_REGEX) ?? [];
459
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
460
- await this.options.cache.setLargeBlob(cacheKeys.content, buffer);
461
- }
462
- else {
463
- await this.options.cache.setBlob(cacheKeys.content, buffer);
464
- }
438
+ await this.options.cache.setBlob(cacheKeys.content, buffer);
465
439
  }
466
440
  else {
467
441
  size = contents.length;
468
442
  hash = (0, rust_1.hashBuffer)(contents);
469
443
  hashReferences = contents.toString().match(constants_1.HASH_REF_REGEX) ?? [];
470
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
471
- await this.options.cache.setLargeBlob(cacheKeys.content, contents);
472
- }
473
- else {
474
- await this.options.cache.setBlob(cacheKeys.content, contents);
475
- }
444
+ await this.options.cache.setBlob(cacheKeys.content, contents);
476
445
  }
477
446
  if (map != null) {
478
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
479
- await this.options.cache.setLargeBlob(cacheKeys.map, map);
480
- }
481
- else {
482
- await this.options.cache.setBlob(cacheKeys.map, map);
483
- }
447
+ await this.options.cache.setBlob(cacheKeys.map, map);
484
448
  }
485
449
  let info = {
486
450
  type,
@@ -494,21 +458,12 @@ class PackagerRunner {
494
458
  return info;
495
459
  }
496
460
  static getContentKey(cacheKey) {
497
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
498
- return `PackagerRunner/${constants_1.ATLASPACK_VERSION}/${cacheKey}/content`;
499
- }
500
461
  return (0, rust_1.hashString)(`${cacheKey}:content`);
501
462
  }
502
463
  static getMapKey(cacheKey) {
503
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
504
- return `PackagerRunner/${constants_1.ATLASPACK_VERSION}/${cacheKey}/map`;
505
- }
506
464
  return (0, rust_1.hashString)(`${cacheKey}:map`);
507
465
  }
508
466
  static getInfoKey(cacheKey) {
509
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
510
- return `PackagerRunner/${constants_1.ATLASPACK_VERSION}/${cacheKey}/info`;
511
- }
512
467
  return (0, rust_1.hashString)(`${cacheKey}:info`);
513
468
  }
514
469
  }
@@ -47,10 +47,9 @@ exports.getBiggestFSEventsInvalidations = getBiggestFSEventsInvalidations;
47
47
  const assert_1 = __importStar(require("assert"));
48
48
  const path_1 = __importDefault(require("path"));
49
49
  const build_cache_1 = require("@atlaspack/build-cache");
50
- const cache_1 = require("@atlaspack/cache");
51
50
  const feature_flags_1 = require("@atlaspack/feature-flags");
52
51
  const graph_1 = require("@atlaspack/graph");
53
- const logger_1 = __importStar(require("@atlaspack/logger"));
52
+ const logger_1 = __importDefault(require("@atlaspack/logger"));
54
53
  const rust_1 = require("@atlaspack/rust");
55
54
  const utils_1 = require("@atlaspack/utils");
56
55
  const nullthrows_1 = __importDefault(require("nullthrows"));
@@ -782,12 +781,8 @@ class RequestTracker {
782
781
  }
783
782
  else if (node.resultCacheKey != null && ifMatch == null) {
784
783
  let key = node.resultCacheKey;
785
- if (!(0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
786
- (0, assert_1.default)(this.options.cache.hasLargeBlob(key));
787
- }
788
- let cachedResult = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
789
- ? (0, nullthrows_1.default)(await this.options.cache.get(key))
790
- : (0, build_cache_1.deserialize)(await this.options.cache.getLargeBlob(key));
784
+ (0, assert_1.default)(this.options.cache.hasLargeBlob(key));
785
+ let cachedResult = (0, build_cache_1.deserialize)(await this.options.cache.getLargeBlob(key));
791
786
  node.result = cachedResult;
792
787
  return cachedResult;
793
788
  }
@@ -952,32 +947,13 @@ class RequestTracker {
952
947
  return { api, subRequestContentKeys };
953
948
  }
954
949
  async writeToCache(signal) {
955
- const options = this.options;
956
- async function runCacheImprovements(newPath, oldPath) {
957
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
958
- (0, assert_1.default)(options.cache instanceof cache_1.LMDBLiteCache);
959
- const result = await newPath(options.cache);
960
- return result;
961
- }
962
- else {
963
- const result = await oldPath();
964
- return result;
965
- }
966
- }
967
950
  let cacheKey = getCacheKey(this.options);
968
- let requestGraphKey = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
969
- ? `${cacheKey}/RequestGraph`
970
- : `requestGraph-${cacheKey}`;
971
- let snapshotKey = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
972
- ? `${cacheKey}/snapshot`
973
- : `snapshot-${cacheKey}`;
951
+ let requestGraphKey = `requestGraph-${cacheKey}`;
952
+ let snapshotKey = `snapshot-${cacheKey}`;
974
953
  if (this.options.shouldDisableCache) {
975
954
  return;
976
955
  }
977
956
  let total = 0;
978
- await runCacheImprovements(async (cache) => {
979
- await cache.getNativeRef().startWriteTransaction();
980
- }, () => Promise.resolve());
981
957
  try {
982
958
  (0, ReporterRunner_1.report)({
983
959
  type: 'cache',
@@ -986,7 +962,7 @@ class RequestTracker {
986
962
  size: this.graph.nodes.length,
987
963
  });
988
964
  if ((0, feature_flags_1.getFeatureFlag)('environmentDeduplication')) {
989
- await (0, EnvironmentManager_1.writeEnvironmentsToCache)(options.cache);
965
+ await (0, EnvironmentManager_1.writeEnvironmentsToCache)(this.options.cache);
990
966
  }
991
967
  let serialisedGraph = this.graph.serialize();
992
968
  // Delete an existing request graph cache, to prevent invalid states
@@ -995,18 +971,11 @@ class RequestTracker {
995
971
  if (signal?.aborted) {
996
972
  throw new Error('Serialization was aborted');
997
973
  }
998
- await runCacheImprovements((cache) => {
999
- (0, logger_1.instrument)(`RequestTracker::writeToCache::cache.put(${key})`, () => {
1000
- cache.getNativeRef().putNoConfirm(key, (0, build_cache_1.serialize)(contents));
1001
- });
1002
- return Promise.resolve();
1003
- }, async () => {
1004
- await this.options.cache.setLargeBlob(key, (0, build_cache_1.serialize)(contents), signal
1005
- ? {
1006
- signal: signal,
1007
- }
1008
- : undefined);
1009
- });
974
+ await this.options.cache.setLargeBlob(key, (0, build_cache_1.serialize)(contents), signal
975
+ ? {
976
+ signal: signal,
977
+ }
978
+ : undefined);
1010
979
  total += 1;
1011
980
  (0, ReporterRunner_1.report)({
1012
981
  type: 'cache',
@@ -1057,13 +1026,6 @@ class RequestTracker {
1057
1026
  nodeCountsPerBlob,
1058
1027
  nodes: undefined,
1059
1028
  });
1060
- await runCacheImprovements(() => serialiseAndSet(`${cacheKey}/cache_metadata`, {
1061
- version: constants_1.ATLASPACK_VERSION,
1062
- entries: this.options.entries,
1063
- mode: this.options.mode,
1064
- shouldBuildLazily: this.options.shouldBuildLazily,
1065
- watchBackend: this.options.watchBackend,
1066
- }), () => Promise.resolve());
1067
1029
  let opts = getWatcherOptions(this.options);
1068
1030
  let snapshotPath = path_1.default.join(this.options.cacheDir, snapshotKey + '.txt');
1069
1031
  await this.options.outputFS.writeSnapshot(this.options.watchDir, snapshotPath, opts);
@@ -1073,11 +1035,6 @@ class RequestTracker {
1073
1035
  if (!signal?.aborted)
1074
1036
  throw err;
1075
1037
  }
1076
- finally {
1077
- await runCacheImprovements(async (cache) => {
1078
- await cache.getNativeRef().commitWriteTransaction();
1079
- }, () => Promise.resolve());
1080
- }
1081
1038
  (0, ReporterRunner_1.report)({ type: 'cache', phase: 'end', total, size: this.graph.nodes.length });
1082
1039
  }
1083
1040
  static async init({ farm, options, rustAtlaspack, }) {
@@ -1093,31 +1050,17 @@ function getWatcherOptions({ watchIgnore = [], cacheDir, watchDir, watchBackend,
1093
1050
  return { ignore, backend: watchBackend };
1094
1051
  }
1095
1052
  function getCacheKey(options) {
1096
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
1097
- const hash = (0, rust_1.hashString)(`${constants_1.ATLASPACK_VERSION}:${JSON.stringify(options.entries)}:${options.mode}:${options.shouldBuildLazily ? 'lazy' : 'eager'}:${options.watchBackend ?? ''}`);
1098
- return `RequestTracker/${constants_1.ATLASPACK_VERSION}/${hash}`;
1099
- }
1100
1053
  return (0, rust_1.hashString)(`${constants_1.ATLASPACK_VERSION}:${JSON.stringify(options.entries)}:${options.mode}:${options.shouldBuildLazily ? 'lazy' : 'eager'}:${options.watchBackend ?? ''}`);
1101
1054
  }
1102
1055
  function getRequestGraphNodeKey(index, cacheKey) {
1103
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
1104
- return `${cacheKey}/RequestGraph/nodes/${index}`;
1105
- }
1106
1056
  return `requestGraph-nodes-${index}-${cacheKey}`;
1107
1057
  }
1108
1058
  async function readAndDeserializeRequestGraph(cache, requestGraphKey, cacheKey) {
1109
1059
  let bufferLength = 0;
1110
1060
  const getAndDeserialize = async (key) => {
1111
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
1112
- const buffer = await cache.getBlob(key);
1113
- bufferLength += Buffer.byteLength(buffer);
1114
- return (0, build_cache_1.deserialize)(buffer);
1115
- }
1116
- else {
1117
- const buffer = await cache.getLargeBlob(key);
1118
- bufferLength += Buffer.byteLength(buffer);
1119
- return (0, build_cache_1.deserialize)(buffer);
1120
- }
1061
+ const buffer = await cache.getLargeBlob(key);
1062
+ bufferLength += Buffer.byteLength(buffer);
1063
+ return (0, build_cache_1.deserialize)(buffer);
1121
1064
  };
1122
1065
  let serializedRequestGraph = await getAndDeserialize(requestGraphKey);
1123
1066
  let nodePromises = serializedRequestGraph.nodeCountsPerBlob.map(
@@ -1141,13 +1084,9 @@ async function loadRequestGraph(options) {
1141
1084
  return new RequestGraph();
1142
1085
  }
1143
1086
  let cacheKey = getCacheKey(options);
1144
- let requestGraphKey = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
1145
- ? `${cacheKey}/RequestGraph`
1146
- : `requestGraph-${cacheKey}`;
1087
+ let requestGraphKey = `requestGraph-${cacheKey}`;
1147
1088
  let timeout;
1148
- const snapshotKey = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
1149
- ? `${cacheKey}/snapshot`
1150
- : `snapshot-${cacheKey}`;
1089
+ const snapshotKey = `snapshot-${cacheKey}`;
1151
1090
  const snapshotPath = path_1.default.join(options.cacheDir, snapshotKey + '.txt');
1152
1091
  const commonMeta = {
1153
1092
  cacheKey,
@@ -1170,9 +1109,7 @@ async function loadRequestGraph(options) {
1170
1109
  if ((0, feature_flags_1.getFeatureFlag)('environmentDeduplication')) {
1171
1110
  await (0, EnvironmentManager_1.loadEnvironmentsFromCache)(options.cache);
1172
1111
  }
1173
- const hasRequestGraphInCache = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
1174
- ? await options.cache.has(requestGraphKey)
1175
- : await options.cache.hasLargeBlob(requestGraphKey);
1112
+ const hasRequestGraphInCache = await options.cache.hasLargeBlob(requestGraphKey);
1176
1113
  if (hasRequestGraphInCache) {
1177
1114
  try {
1178
1115
  let { requestGraph } = await readAndDeserializeRequestGraph(options.cache, requestGraphKey, cacheKey);
@@ -121,6 +121,9 @@ exports.PACKAGE_DESCRIPTOR_SCHEMA = {
121
121
  type: 'string',
122
122
  },
123
123
  },
124
+ inlineRequires: {
125
+ type: 'boolean',
126
+ },
124
127
  },
125
128
  additionalProperties: false,
126
129
  };
@@ -16,7 +16,6 @@ const assetUtils_1 = require("./assetUtils");
16
16
  const types_1 = require("./types");
17
17
  const utils_2 = require("./utils");
18
18
  const projectPath_1 = require("./projectPath");
19
- const feature_flags_1 = require("@atlaspack/feature-flags");
20
19
  const EnvironmentManager_1 = require("./EnvironmentManager");
21
20
  class UncommittedAsset {
22
21
  constructor({ value, options, content, mapBuffer, ast, isASTDirty, code, invalidations, }) {
@@ -209,10 +208,6 @@ class UncommittedAsset {
209
208
  this.value.astGenerator = null;
210
209
  }
211
210
  getCacheKey(key) {
212
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
213
- const filePath = (0, projectPath_1.fromProjectPathRelative)(this.value.filePath);
214
- return `Asset/${constants_1.ATLASPACK_VERSION}/${filePath}/${this.value.id}/${key}`;
215
- }
216
211
  return (0, rust_1.hashString)(constants_1.ATLASPACK_VERSION + key + this.value.id);
217
212
  }
218
213
  addDependency(opts) {
@@ -58,8 +58,12 @@ class AtlaspackV3 {
58
58
  const { nodesJson, edges, publicIdByAssetId, environmentsJson } = bundleGraph.serializeForNative();
59
59
  return (0, rust_1.atlaspackNapiLoadBundleGraph)(this._atlaspack_napi, nodesJson, edges, publicIdByAssetId, environmentsJson);
60
60
  }
61
- package(bundleId) {
62
- return (0, rust_1.atlaspackNapiPackage)(this._atlaspack_napi, bundleId);
61
+ updateBundleGraph(bundleGraph, changedAssetIds) {
62
+ const nodesJson = bundleGraph.serializeAssetNodesForNative(changedAssetIds);
63
+ return (0, rust_1.atlaspackNapiUpdateBundleGraph)(this._atlaspack_napi, nodesJson);
64
+ }
65
+ package(bundleId, options) {
66
+ return (0, rust_1.atlaspackNapiPackage)(this._atlaspack_napi, bundleId, options);
63
67
  }
64
68
  async respondToFsEvents(events) {
65
69
  // @ts-expect-error TS2488