@atlaspack/core 2.14.1-canary.26 → 2.14.1-canary.27

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.
@@ -139,8 +139,19 @@ async function resolveOptions(initialOptions) {
139
139
  // where symlinked dependencies outside the project root need to trigger HMR
140
140
  // updates. Default to the project root if not provided.
141
141
  let watchDir = initialOptions.watchDir != null ? _path().default.resolve(initialOptions.watchDir) : projectRoot;
142
- const needsRustLmdbCache = (0, _featureFlags().getFeatureFlag)('useLmdbJsLite') || (0, _featureFlags().getFeatureFlag)('atlaspackV3');
143
- let cache = needsRustLmdbCache ? new (_cache().LMDBLiteCache)(cacheDir) : outputFS instanceof _fs().NodeFS ? new (_cache().LMDBCache)(cacheDir) : new (_cache().FSCache)(outputFS, cacheDir);
142
+ let cache = function createCache() {
143
+ if (initialOptions.cache) {
144
+ return initialOptions.cache;
145
+ }
146
+ const needsRustLmdbCache = (0, _featureFlags().getFeatureFlag)('atlaspackV3');
147
+ if (!needsRustLmdbCache && !(outputFS instanceof _fs().NodeFS)) {
148
+ return new (_cache().FSCache)(outputFS, cacheDir);
149
+ }
150
+ if (needsRustLmdbCache || (0, _featureFlags().getFeatureFlag)('useLmdbJsLite')) {
151
+ return new (_cache().LMDBLiteCache)(cacheDir);
152
+ }
153
+ return new (_cache().LMDBCache)(cacheDir);
154
+ }();
144
155
  let mode = initialOptions.mode ?? 'development';
145
156
  let shouldOptimize = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau = initialOptions.defaultTargetOptions) === null || _initialOptions$defau === void 0 ? void 0 : _initialOptions$defau.shouldOptimize) ?? mode === 'production';
146
157
  let publicUrl = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau2 = initialOptions.defaultTargetOptions) === null || _initialOptions$defau2 === void 0 ? void 0 : _initialOptions$defau2.publicUrl) ?? '/';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.14.1-canary.26+c7726ccfb",
3
+ "version": "2.14.1-canary.27+4aab0605c",
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.26+c7726ccfb",
24
- "@atlaspack/cache": "2.13.3-canary.26+c7726ccfb",
25
- "@atlaspack/diagnostic": "2.14.1-canary.26+c7726ccfb",
26
- "@atlaspack/events": "2.14.1-canary.26+c7726ccfb",
27
- "@atlaspack/feature-flags": "2.14.1-canary.26+c7726ccfb",
28
- "@atlaspack/fs": "2.14.1-canary.26+c7726ccfb",
29
- "@atlaspack/graph": "3.4.1-canary.26+c7726ccfb",
30
- "@atlaspack/logger": "2.14.1-canary.26+c7726ccfb",
31
- "@atlaspack/package-manager": "2.14.1-canary.26+c7726ccfb",
32
- "@atlaspack/plugin": "2.14.1-canary.26+c7726ccfb",
33
- "@atlaspack/profiler": "2.14.1-canary.26+c7726ccfb",
34
- "@atlaspack/rust": "3.0.1-canary.26+c7726ccfb",
35
- "@atlaspack/types": "2.14.1-canary.26+c7726ccfb",
36
- "@atlaspack/utils": "2.14.1-canary.26+c7726ccfb",
37
- "@atlaspack/workers": "2.14.1-canary.26+c7726ccfb",
23
+ "@atlaspack/build-cache": "2.13.3-canary.27+4aab0605c",
24
+ "@atlaspack/cache": "2.13.3-canary.27+4aab0605c",
25
+ "@atlaspack/diagnostic": "2.14.1-canary.27+4aab0605c",
26
+ "@atlaspack/events": "2.14.1-canary.27+4aab0605c",
27
+ "@atlaspack/feature-flags": "2.14.1-canary.27+4aab0605c",
28
+ "@atlaspack/fs": "2.14.1-canary.27+4aab0605c",
29
+ "@atlaspack/graph": "3.4.1-canary.27+4aab0605c",
30
+ "@atlaspack/logger": "2.14.1-canary.27+4aab0605c",
31
+ "@atlaspack/package-manager": "2.14.1-canary.27+4aab0605c",
32
+ "@atlaspack/plugin": "2.14.1-canary.27+4aab0605c",
33
+ "@atlaspack/profiler": "2.14.1-canary.27+4aab0605c",
34
+ "@atlaspack/rust": "3.0.1-canary.27+4aab0605c",
35
+ "@atlaspack/types": "2.14.1-canary.27+4aab0605c",
36
+ "@atlaspack/utils": "2.14.1-canary.27+4aab0605c",
37
+ "@atlaspack/workers": "2.14.1-canary.27+4aab0605c",
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": "c7726ccfbde03bad9f19e103d6b4ed0d279d837d"
70
+ "gitHead": "4aab0605c0d4ee8e0dcc3ffa1162eae5b360b677"
71
71
  }
@@ -146,14 +146,25 @@ export default async function resolveOptions(
146
146
  ? path.resolve(initialOptions.watchDir)
147
147
  : projectRoot;
148
148
 
149
- const needsRustLmdbCache =
150
- getFeatureFlag('useLmdbJsLite') || getFeatureFlag('atlaspackV3');
151
-
152
- let cache = needsRustLmdbCache
153
- ? new LMDBLiteCache(cacheDir)
154
- : outputFS instanceof NodeFS
155
- ? new LMDBCache(cacheDir)
156
- : new FSCache(outputFS, cacheDir);
149
+ function createCache() {
150
+ if (initialOptions.cache) {
151
+ return initialOptions.cache;
152
+ }
153
+
154
+ const needsRustLmdbCache = getFeatureFlag('atlaspackV3');
155
+
156
+ if (!needsRustLmdbCache && !(outputFS instanceof NodeFS)) {
157
+ return new FSCache(outputFS, cacheDir);
158
+ }
159
+
160
+ if (needsRustLmdbCache || getFeatureFlag('useLmdbJsLite')) {
161
+ return new LMDBLiteCache(cacheDir);
162
+ }
163
+
164
+ return new LMDBCache(cacheDir);
165
+ }
166
+
167
+ let cache = createCache();
157
168
 
158
169
  let mode = initialOptions.mode ?? 'development';
159
170
  let shouldOptimize =