@atlaspack/core 2.16.2-canary.0 → 2.16.2-canary.11

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/lib/Atlaspack.js CHANGED
@@ -166,9 +166,7 @@ class Atlaspack {
166
166
  ...this.#initialOptions.featureFlags
167
167
  };
168
168
  (0, _featureFlags().setFeatureFlags)(featureFlags);
169
- if ((0, _featureFlags().getFeatureFlag)('enableRustWorkerThreadDylibHack')) {
170
- (0, _rustWorkerThreadDylibHack.loadRustWorkerThreadDylibHack)();
171
- }
169
+ (0, _rustWorkerThreadDylibHack.loadRustWorkerThreadDylibHack)();
172
170
  await _sourceMap().init;
173
171
  await (_rust().init === null || _rust().init === void 0 ? void 0 : (0, _rust().init)());
174
172
  this.#disposable = new (_events().Disposable)();
@@ -603,6 +601,19 @@ class Atlaspack {
603
601
  }
604
602
  return result;
605
603
  }
604
+
605
+ /**
606
+ * Copy the cache to a new directory and compact it.
607
+ */
608
+ async unstable_compactCache() {
609
+ await this._init();
610
+ const cache = (0, _nullthrows().default)(this.#resolvedOptions).cache;
611
+ if (cache instanceof _cache().LMDBLiteCache) {
612
+ await cache.compact('parcel-cache-compacted');
613
+ } else {
614
+ throw new Error('Cache is not an LMDBLiteCache');
615
+ }
616
+ }
606
617
  async unstable_transform(options) {
607
618
  var _options$env;
608
619
  if (!this.#initialized) {
@@ -1030,6 +1030,13 @@ class RequestTracker {
1030
1030
  nodeCountsPerBlob,
1031
1031
  nodes: undefined
1032
1032
  });
1033
+ await runCacheImprovements(() => serialiseAndSet(`request_tracker:cache_metadata:${cacheKey}`, {
1034
+ version: _constants.ATLASPACK_VERSION,
1035
+ entries: this.options.entries,
1036
+ mode: this.options.mode,
1037
+ shouldBuildLazily: this.options.shouldBuildLazily,
1038
+ watchBackend: this.options.watchBackend
1039
+ }), () => Promise.resolve());
1033
1040
  let opts = getWatcherOptions(this.options);
1034
1041
  let snapshotPath = _path2().default.join(this.options.cacheDir, `snapshot-${cacheKey}` + '.txt');
1035
1042
  await this.options.outputFS.writeSnapshot(this.options.watchDir, snapshotPath, opts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.16.2-canary.0+56fd82cd5",
3
+ "version": "2.16.2-canary.11+e2ba0f697",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,21 +20,21 @@
20
20
  "check-ts": "tsc --noEmit index.d.ts"
21
21
  },
22
22
  "dependencies": {
23
- "@atlaspack/build-cache": "2.13.3-canary.68+56fd82cd5",
24
- "@atlaspack/cache": "3.1.1-canary.0+56fd82cd5",
25
- "@atlaspack/diagnostic": "2.14.1-canary.68+56fd82cd5",
26
- "@atlaspack/events": "2.14.1-canary.68+56fd82cd5",
27
- "@atlaspack/feature-flags": "2.14.1-canary.68+56fd82cd5",
28
- "@atlaspack/fs": "2.14.5-canary.0+56fd82cd5",
29
- "@atlaspack/graph": "3.4.1-canary.68+56fd82cd5",
30
- "@atlaspack/logger": "2.14.5-canary.0+56fd82cd5",
31
- "@atlaspack/package-manager": "2.14.5-canary.0+56fd82cd5",
32
- "@atlaspack/plugin": "2.14.5-canary.0+56fd82cd5",
33
- "@atlaspack/profiler": "2.14.1-canary.68+56fd82cd5",
34
- "@atlaspack/rust": "3.2.1-canary.0+56fd82cd5",
35
- "@atlaspack/types": "2.14.5-canary.0+56fd82cd5",
36
- "@atlaspack/utils": "2.14.5-canary.0+56fd82cd5",
37
- "@atlaspack/workers": "2.14.5-canary.0+56fd82cd5",
23
+ "@atlaspack/build-cache": "2.13.3-canary.79+e2ba0f697",
24
+ "@atlaspack/cache": "3.1.1-canary.11+e2ba0f697",
25
+ "@atlaspack/diagnostic": "2.14.1-canary.79+e2ba0f697",
26
+ "@atlaspack/events": "2.14.1-canary.79+e2ba0f697",
27
+ "@atlaspack/feature-flags": "2.14.1-canary.79+e2ba0f697",
28
+ "@atlaspack/fs": "2.14.5-canary.11+e2ba0f697",
29
+ "@atlaspack/graph": "3.4.1-canary.79+e2ba0f697",
30
+ "@atlaspack/logger": "2.14.5-canary.11+e2ba0f697",
31
+ "@atlaspack/package-manager": "2.14.5-canary.11+e2ba0f697",
32
+ "@atlaspack/plugin": "2.14.5-canary.11+e2ba0f697",
33
+ "@atlaspack/profiler": "2.14.1-canary.79+e2ba0f697",
34
+ "@atlaspack/rust": "3.2.1-canary.11+e2ba0f697",
35
+ "@atlaspack/types": "2.14.5-canary.11+e2ba0f697",
36
+ "@atlaspack/utils": "2.14.5-canary.11+e2ba0f697",
37
+ "@atlaspack/workers": "2.14.5-canary.11+e2ba0f697",
38
38
  "@mischnic/json-sourcemap": "^0.1.0",
39
39
  "@parcel/source-map": "^2.1.1",
40
40
  "base-x": "^3.0.8",
@@ -67,5 +67,5 @@
67
67
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
68
68
  },
69
69
  "type": "commonjs",
70
- "gitHead": "56fd82cd544c4c9096be6ebea8261e714435de09"
70
+ "gitHead": "e2ba0f69702656f3d1ce95ab1454e35062b13b39"
71
71
  }
package/src/Atlaspack.js CHANGED
@@ -58,11 +58,7 @@ import {
58
58
  fromProjectPathRelative,
59
59
  } from './projectPath';
60
60
  import {tracer} from '@atlaspack/profiler';
61
- import {
62
- getFeatureFlag,
63
- setFeatureFlags,
64
- DEFAULT_FEATURE_FLAGS,
65
- } from '@atlaspack/feature-flags';
61
+ import {setFeatureFlags, DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
66
62
  import {AtlaspackV3, FileSystemV3} from './atlaspack-v3';
67
63
  import createAssetGraphRequestJS from './requests/AssetGraphRequest';
68
64
  import {createAssetGraphRequestRust} from './requests/AssetGraphRequestRust';
@@ -122,9 +118,7 @@ export default class Atlaspack {
122
118
  };
123
119
  setFeatureFlags(featureFlags);
124
120
 
125
- if (getFeatureFlag('enableRustWorkerThreadDylibHack')) {
126
- loadRustWorkerThreadDylibHack();
127
- }
121
+ loadRustWorkerThreadDylibHack();
128
122
 
129
123
  await initSourcemaps;
130
124
  await initRust?.();
@@ -645,6 +639,20 @@ export default class Atlaspack {
645
639
  return result;
646
640
  }
647
641
 
642
+ /**
643
+ * Copy the cache to a new directory and compact it.
644
+ */
645
+ async unstable_compactCache(): Promise<void> {
646
+ await this._init();
647
+
648
+ const cache = nullthrows(this.#resolvedOptions).cache;
649
+ if (cache instanceof LMDBLiteCache) {
650
+ await cache.compact('parcel-cache-compacted');
651
+ } else {
652
+ throw new Error('Cache is not an LMDBLiteCache');
653
+ }
654
+ }
655
+
648
656
  async unstable_transform(
649
657
  options: AtlaspackTransformOptions,
650
658
  ): Promise<Array<Asset>> {
@@ -1605,6 +1605,18 @@ export default class RequestTracker {
1605
1605
  nodes: undefined,
1606
1606
  });
1607
1607
 
1608
+ await runCacheImprovements(
1609
+ () =>
1610
+ serialiseAndSet(`request_tracker:cache_metadata:${cacheKey}`, {
1611
+ version: ATLASPACK_VERSION,
1612
+ entries: this.options.entries,
1613
+ mode: this.options.mode,
1614
+ shouldBuildLazily: this.options.shouldBuildLazily,
1615
+ watchBackend: this.options.watchBackend,
1616
+ }),
1617
+ () => Promise.resolve(),
1618
+ );
1619
+
1608
1620
  let opts = getWatcherOptions(this.options);
1609
1621
  let snapshotPath = path.join(this.options.cacheDir, snapshotKey + '.txt');
1610
1622