@atlaspack/core 2.33.1 → 2.35.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 (68) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/dist/AssetGraph.js +4 -72
  3. package/dist/BundleGraph.js +34 -0
  4. package/dist/PackagerRunner.js +13 -88
  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/applyRuntimes.js +2 -1
  9. package/dist/atlaspack-v3/AtlaspackV3.js +6 -2
  10. package/dist/requests/AssetGraphRequest.js +6 -15
  11. package/dist/requests/AssetGraphRequestRust.js +119 -22
  12. package/dist/requests/AtlaspackBuildRequest.js +8 -2
  13. package/dist/requests/BundleGraphRequest.js +9 -15
  14. package/dist/requests/BundleGraphRequestRust.js +1 -2
  15. package/dist/requests/PackageRequest.js +1 -1
  16. package/dist/requests/TargetRequest.js +5 -0
  17. package/dist/requests/WriteBundleRequest.js +129 -12
  18. package/dist/requests/WriteBundlesRequest.js +15 -9
  19. package/dist/resolveOptions.js +2 -4
  20. package/lib/AssetGraph.js +3 -62
  21. package/lib/BundleGraph.js +38 -0
  22. package/lib/PackagerRunner.js +13 -77
  23. package/lib/RequestTracker.js +15 -69
  24. package/lib/TargetDescriptor.schema.js +3 -0
  25. package/lib/UncommittedAsset.js +0 -11
  26. package/lib/applyRuntimes.js +1 -1
  27. package/lib/atlaspack-v3/AtlaspackV3.js +6 -2
  28. package/lib/requests/AssetGraphRequest.js +4 -18
  29. package/lib/requests/AssetGraphRequestRust.js +88 -23
  30. package/lib/requests/AtlaspackBuildRequest.js +8 -2
  31. package/lib/requests/BundleGraphRequest.js +12 -16
  32. package/lib/requests/BundleGraphRequestRust.js +2 -3
  33. package/lib/requests/PackageRequest.js +3 -1
  34. package/lib/requests/TargetRequest.js +5 -0
  35. package/lib/requests/WriteBundleRequest.js +131 -8
  36. package/lib/requests/WriteBundlesRequest.js +12 -5
  37. package/lib/resolveOptions.js +2 -4
  38. package/lib/types/AssetGraph.d.ts +2 -27
  39. package/lib/types/BundleGraph.d.ts +5 -0
  40. package/lib/types/atlaspack-v3/AtlaspackV3.d.ts +3 -2
  41. package/lib/types/requests/BundleGraphRequest.d.ts +1 -1
  42. package/lib/types/requests/WriteBundleRequest.d.ts +20 -1
  43. package/lib/types/types.d.ts +1 -0
  44. package/package.json +15 -15
  45. package/src/AssetGraph.ts +4 -72
  46. package/src/BundleGraph.ts +39 -0
  47. package/src/PackagerRunner.ts +15 -101
  48. package/src/RequestTracker.ts +24 -110
  49. package/src/TargetDescriptor.schema.ts +3 -0
  50. package/src/UncommittedAsset.ts +1 -11
  51. package/src/applyRuntimes.ts +3 -1
  52. package/src/atlaspack-v3/AtlaspackV3.ts +19 -3
  53. package/src/requests/AssetGraphRequest.ts +8 -20
  54. package/src/requests/AssetGraphRequestRust.ts +96 -23
  55. package/src/requests/AtlaspackBuildRequest.ts +16 -8
  56. package/src/requests/BundleGraphRequest.ts +12 -30
  57. package/src/requests/BundleGraphRequestRust.ts +1 -2
  58. package/src/requests/PackageRequest.ts +1 -1
  59. package/src/requests/TargetRequest.ts +5 -0
  60. package/src/requests/WriteBundleRequest.ts +177 -13
  61. package/src/requests/WriteBundlesRequest.ts +25 -13
  62. package/src/resolveOptions.ts +2 -4
  63. package/src/types.ts +1 -0
  64. package/test/AssetGraph.test.ts +0 -32
  65. package/test/RequestTracker.test.ts +0 -165
  66. package/test/TargetRequest.test.ts +25 -0
  67. package/test/requests/WriteBundleRequest.test.ts +239 -0
  68. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,77 @@
1
1
  # @atlaspack/core
2
2
 
3
+ ## 2.35.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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
8
+
9
+ ### Patch Changes
10
+
11
+ - [#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.
12
+
13
+ This enables proper symbol propagation through barrel files that use star re-exports,
14
+ allowing tree-shaking to work correctly for these patterns. Includes support for:
15
+ - Chained star re-exports (multiple levels of `export *`)
16
+ - Diamond patterns (multiple paths to the same symbol through different star re-exports)
17
+ - Speculative requirement cleanup (efficient tracking and removal of unsatisfied paths)
18
+
19
+ Note: This does not yet handle the ambiguous re-export case where multiple star re-exports
20
+ provide the same symbol name. That case currently requires runtime namespace fallback and
21
+ will be addressed in a future update.
22
+
23
+ - [#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
24
+
25
+ - [#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.
26
+
27
+ - [#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
28
+
29
+ - [#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
30
+
31
+ - [#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
32
+
33
+ - 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)]:
34
+ - @atlaspack/rust@3.24.0
35
+ - @atlaspack/feature-flags@2.30.1
36
+ - @atlaspack/cache@3.2.50
37
+ - @atlaspack/fs@2.15.50
38
+ - @atlaspack/logger@2.14.47
39
+ - @atlaspack/source-map@3.2.10
40
+ - @atlaspack/utils@3.3.7
41
+ - @atlaspack/build-cache@2.13.13
42
+ - @atlaspack/graph@3.6.17
43
+ - @atlaspack/plugin@2.14.55
44
+ - @atlaspack/profiler@2.15.16
45
+ - @atlaspack/types@2.15.45
46
+ - @atlaspack/workers@2.14.55
47
+ - @atlaspack/package-manager@2.14.55
48
+
49
+ ## 2.34.0
50
+
51
+ ### Minor Changes
52
+
53
+ - [#1010](https://github.com/atlassian-labs/atlaspack/pull/1010) [`45a0dc5`](https://github.com/atlassian-labs/atlaspack/commit/45a0dc530fd9472dbfdebcbb05f1aad812ab3b23) Thanks [@benjervis](https://github.com/benjervis)! - Add initial implementation of native symbol propagation
54
+
55
+ ### Patch Changes
56
+
57
+ - [#1027](https://github.com/atlassian-labs/atlaspack/pull/1027) [`d8e984b`](https://github.com/atlassian-labs/atlaspack/commit/d8e984b7f6d04fa03707fa299bfd8b8bf9f58280) Thanks [@marcins](https://github.com/marcins)! - Improve source map quality through various accuracy fixes.
58
+
59
+ - Updated dependencies [[`c4082ba`](https://github.com/atlassian-labs/atlaspack/commit/c4082ba3fc1a9328a2e5f23195d5972fbc5d10c8), [`d8e984b`](https://github.com/atlassian-labs/atlaspack/commit/d8e984b7f6d04fa03707fa299bfd8b8bf9f58280), [`ca78e1d`](https://github.com/atlassian-labs/atlaspack/commit/ca78e1d2007bfecd267b283d66a73f3695da4234), [`94e1a58`](https://github.com/atlassian-labs/atlaspack/commit/94e1a58a1a8ed5a4e329745d8a7e6a9530b5cb11), [`3ad8e88`](https://github.com/atlassian-labs/atlaspack/commit/3ad8e880c4c2b9126cbfb6963a3862a75306a26f), [`4c1f39a`](https://github.com/atlassian-labs/atlaspack/commit/4c1f39a911acaefd630d877af1ae5a039931662f), [`fcf7ec5`](https://github.com/atlassian-labs/atlaspack/commit/fcf7ec56fea644e21f7a67d649e6efd1f03c4a6e), [`45a0dc5`](https://github.com/atlassian-labs/atlaspack/commit/45a0dc530fd9472dbfdebcbb05f1aad812ab3b23)]:
60
+ - @atlaspack/rust@3.23.0
61
+ - @atlaspack/package-manager@2.14.54
62
+ - @atlaspack/feature-flags@2.30.0
63
+ - @atlaspack/utils@3.3.6
64
+ - @atlaspack/cache@3.2.49
65
+ - @atlaspack/fs@2.15.49
66
+ - @atlaspack/logger@2.14.46
67
+ - @atlaspack/source-map@3.2.9
68
+ - @atlaspack/build-cache@2.13.12
69
+ - @atlaspack/graph@3.6.16
70
+ - @atlaspack/profiler@2.15.15
71
+ - @atlaspack/workers@2.14.54
72
+ - @atlaspack/plugin@2.14.54
73
+ - @atlaspack/types@2.15.44
74
+
3
75
  ## 2.33.1
4
76
 
5
77
  ### Patch 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.
@@ -44,7 +44,6 @@ const diagnostic_1 = __importStar(require("@atlaspack/diagnostic"));
44
44
  const stream_1 = require("stream");
45
45
  const nullthrows_1 = __importDefault(require("nullthrows"));
46
46
  const path_1 = __importDefault(require("path"));
47
- const url_1 = __importDefault(require("url"));
48
47
  const rust_1 = require("@atlaspack/rust");
49
48
  const Bundle_1 = require("./public/Bundle");
50
49
  const BundleGraph_1 = __importStar(require("./public/BundleGraph"));
@@ -58,9 +57,9 @@ const DevDepRequest_1 = require("./requests/DevDepRequest");
58
57
  const assetUtils_1 = require("./assetUtils");
59
58
  const utils_2 = require("./utils");
60
59
  const DevDepRequest_2 = require("./requests/DevDepRequest");
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.
@@ -330,48 +329,18 @@ class PackagerRunner {
330
329
  return optimized;
331
330
  }
332
331
  async generateSourceMap(bundle, map) {
333
- // sourceRoot should be a relative path between outDir and rootDir for node.js targets
332
+ let sourceRoot = (0, WriteBundleRequest_1.computeSourceMapRoot)(bundle, this.options);
333
+ let inlineSources = sourceRoot === undefined;
334
334
  let filePath = (0, projectPath_1.joinProjectPath)(bundle.target.distDir, (0, nullthrows_1.default)(bundle.name));
335
335
  let fullPath = (0, projectPath_1.fromProjectPath)(this.options.projectRoot, filePath);
336
- let sourceRoot = path_1.default.relative(path_1.default.dirname(fullPath), this.options.projectRoot);
337
- let inlineSources = false;
338
- const bundleEnv = (0, EnvironmentManager_1.fromEnvironmentId)(bundle.env);
339
- if (bundle.target) {
340
- const bundleTargetEnv = (0, EnvironmentManager_1.fromEnvironmentId)(bundle.target.env);
341
- if (bundleEnv.sourceMap && bundleEnv.sourceMap.sourceRoot !== undefined) {
342
- sourceRoot = bundleEnv.sourceMap.sourceRoot;
343
- }
344
- else if (this.options.serveOptions &&
345
- bundleTargetEnv.context === 'browser') {
346
- sourceRoot = '/__parcel_source_root';
347
- }
348
- if (bundleEnv.sourceMap &&
349
- bundleEnv.sourceMap.inlineSources !== undefined) {
350
- inlineSources = bundleEnv.sourceMap.inlineSources;
351
- }
352
- else if (bundleTargetEnv.context !== 'node') {
353
- // inlining should only happen in production for browser targets by default
354
- inlineSources = this.options.mode === 'production';
355
- }
356
- }
357
336
  let mapFilename = fullPath + '.map';
337
+ const bundleEnv = (0, EnvironmentManager_1.fromEnvironmentId)(bundle.env);
358
338
  let isInlineMap = bundleEnv.sourceMap && bundleEnv.sourceMap.inline;
359
- if ((0, feature_flags_1.getFeatureFlag)('omitSourcesContentInMemory') && !isInlineMap) {
360
- if (!(bundleEnv.sourceMap && bundleEnv.sourceMap.inlineSources === false)) {
361
- /*
362
- We're omitting sourcesContent during transformation to allow GC to run.
363
- Ensure sources are still inlined into the final source maps written to disk. UNLESS the user explicitly disabled inlineSources.
364
- */
365
- inlineSources = true;
366
- }
367
- }
368
339
  let stringified = await map.stringify({
369
340
  file: path_1.default.basename(mapFilename),
370
341
  fs: this.options.inputFS,
371
342
  rootDir: this.options.projectRoot,
372
- sourceRoot: !inlineSources
373
- ? url_1.default.format(url_1.default.parse(sourceRoot + '/'))
374
- : undefined,
343
+ sourceRoot,
375
344
  inlineSources,
376
345
  format: isInlineMap ? 'inline' : 'string',
377
346
  });
@@ -396,18 +365,6 @@ class PackagerRunner {
396
365
  devDepHashes += await this.getDevDepHashes(inlineBundle);
397
366
  }
398
367
  let invalidationHash = await (0, assetUtils_1.getInvalidationHash)(invalidations, this.options);
399
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
400
- const hash = (0, rust_1.hashString)(constants_1.ATLASPACK_VERSION +
401
- devDepHashes +
402
- invalidationHash +
403
- bundle.target.publicUrl +
404
- bundleGraph.getHash(bundle) +
405
- JSON.stringify(configResults) +
406
- JSON.stringify(globalInfoResults) +
407
- this.options.mode +
408
- (this.options.shouldBuildLazily ? 'lazy' : 'eager'));
409
- return path_1.default.join(bundle.displayName ?? bundle.name ?? bundle.id, hash);
410
- }
411
368
  return (0, rust_1.hashString)(constants_1.ATLASPACK_VERSION +
412
369
  devDepHashes +
413
370
  invalidationHash +
@@ -437,23 +394,17 @@ class PackagerRunner {
437
394
  let contentKey = PackagerRunner.getContentKey(cacheKey);
438
395
  let mapKey = PackagerRunner.getMapKey(cacheKey);
439
396
  let isLargeBlob = await this.options.cache.hasLargeBlob(contentKey);
440
- let contentExists = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
441
- ? isLargeBlob
442
- : isLargeBlob || (await this.options.cache.has(contentKey));
397
+ let contentExists = isLargeBlob || (await this.options.cache.has(contentKey));
443
398
  if (!contentExists) {
444
399
  return null;
445
400
  }
446
- let mapExists = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
447
- ? await this.options.cache.hasLargeBlob(mapKey)
448
- : await this.options.cache.has(mapKey);
401
+ let mapExists = await this.options.cache.has(mapKey);
449
402
  return {
450
403
  contents: isLargeBlob
451
404
  ? this.options.cache.getStream(contentKey)
452
405
  : (0, utils_1.blobToStream)(await this.options.cache.getBlob(contentKey)),
453
406
  map: mapExists
454
- ? (0, utils_1.blobToStream)((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')
455
- ? await this.options.cache.getLargeBlob(mapKey)
456
- : await this.options.cache.getBlob(mapKey))
407
+ ? (0, utils_1.blobToStream)(await this.options.cache.getBlob(mapKey))
457
408
  : null,
458
409
  };
459
410
  }
@@ -462,12 +413,10 @@ class PackagerRunner {
462
413
  let hash;
463
414
  // @ts-expect-error TS2702
464
415
  let hashReferences = [];
465
- let isLargeBlob = (0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements');
416
+ let isLargeBlob = false;
466
417
  // TODO: don't replace hash references in binary files??
467
418
  if (contents instanceof stream_1.Readable) {
468
- if (!(0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
469
- isLargeBlob = true;
470
- }
419
+ isLargeBlob = true;
471
420
  let boundaryStr = '';
472
421
  let h = new rust_1.Hash();
473
422
  await this.options.cache.setStream(cacheKeys.content, (0, utils_1.blobToStream)(contents).pipe(
@@ -486,31 +435,16 @@ class PackagerRunner {
486
435
  size = buffer.byteLength;
487
436
  hash = (0, rust_1.hashBuffer)(buffer);
488
437
  hashReferences = contents.match(constants_1.HASH_REF_REGEX) ?? [];
489
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
490
- await this.options.cache.setLargeBlob(cacheKeys.content, buffer);
491
- }
492
- else {
493
- await this.options.cache.setBlob(cacheKeys.content, buffer);
494
- }
438
+ await this.options.cache.setBlob(cacheKeys.content, buffer);
495
439
  }
496
440
  else {
497
441
  size = contents.length;
498
442
  hash = (0, rust_1.hashBuffer)(contents);
499
443
  hashReferences = contents.toString().match(constants_1.HASH_REF_REGEX) ?? [];
500
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
501
- await this.options.cache.setLargeBlob(cacheKeys.content, contents);
502
- }
503
- else {
504
- await this.options.cache.setBlob(cacheKeys.content, contents);
505
- }
444
+ await this.options.cache.setBlob(cacheKeys.content, contents);
506
445
  }
507
446
  if (map != null) {
508
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
509
- await this.options.cache.setLargeBlob(cacheKeys.map, map);
510
- }
511
- else {
512
- await this.options.cache.setBlob(cacheKeys.map, map);
513
- }
447
+ await this.options.cache.setBlob(cacheKeys.map, map);
514
448
  }
515
449
  let info = {
516
450
  type,
@@ -524,21 +458,12 @@ class PackagerRunner {
524
458
  return info;
525
459
  }
526
460
  static getContentKey(cacheKey) {
527
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
528
- return `PackagerRunner/${constants_1.ATLASPACK_VERSION}/${cacheKey}/content`;
529
- }
530
461
  return (0, rust_1.hashString)(`${cacheKey}:content`);
531
462
  }
532
463
  static getMapKey(cacheKey) {
533
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
534
- return `PackagerRunner/${constants_1.ATLASPACK_VERSION}/${cacheKey}/map`;
535
- }
536
464
  return (0, rust_1.hashString)(`${cacheKey}:map`);
537
465
  }
538
466
  static getInfoKey(cacheKey) {
539
- if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
540
- return `PackagerRunner/${constants_1.ATLASPACK_VERSION}/${cacheKey}/info`;
541
- }
542
467
  return (0, rust_1.hashString)(`${cacheKey}:info`);
543
468
  }
544
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) {
@@ -376,7 +376,8 @@ function reconcileNewRuntimes(api, connections, optionsRef) {
376
376
  name: 'Runtimes',
377
377
  assetGroups,
378
378
  optionsRef,
379
- skipSymbolProp: (0, feature_flags_1.getFeatureFlag)('skipRuntimeSymbolProp'),
379
+ skipSymbolProp: (0, feature_flags_1.getFeatureFlag)('skipRuntimeSymbolProp') ||
380
+ (0, feature_flags_1.getFeatureFlag)('rustSymbolTracker'),
380
381
  });
381
382
  // rebuild the graph
382
383
  return api.runRequest(request, { force: true });