@atlaspack/core 2.16.2-canary.9 → 2.16.2-dev.55
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 +112 -0
- package/lib/Atlaspack.js +23 -2
- package/lib/AtlaspackConfig.schema.js +7 -1
- package/lib/BundleGraph.js +2 -0
- package/lib/PackagerRunner.js +44 -9
- package/lib/RequestTracker.js +326 -121
- package/lib/Transformation.js +2 -2
- package/lib/UncommittedAsset.js +17 -0
- package/lib/atlaspack-v3/worker/compat/environment.js +2 -2
- package/lib/atlaspack-v3/worker/compat/mutable-asset.js +6 -6
- package/lib/atlaspack-v3/worker/compat/plugin-config.js +5 -5
- package/lib/atlaspack-v3/worker/index.js +3 -0
- package/lib/atlaspack-v3/worker/worker.js +8 -0
- package/lib/dumpGraphToGraphViz.js +1 -1
- package/lib/public/BundleGraph.js +21 -5
- package/lib/public/Config.js +28 -0
- package/lib/requests/AssetGraphRequest.js +13 -1
- package/lib/requests/BundleGraphRequest.js +13 -1
- package/lib/requests/WriteBundleRequest.js +11 -2
- package/lib/resolveOptions.js +7 -4
- package/lib/worker.js +18 -1
- package/package.json +23 -19
- package/src/Atlaspack.js +27 -5
- package/src/PackagerRunner.js +60 -9
- package/src/RequestTracker.js +491 -137
- package/src/UncommittedAsset.js +16 -1
- package/src/atlaspack-v3/worker/compat/plugin-config.js +9 -5
- package/src/atlaspack-v3/worker/worker.js +7 -0
- package/src/public/BundleGraph.js +22 -5
- package/src/public/Config.js +39 -5
- package/src/requests/AssetGraphRequest.js +13 -3
- package/src/requests/BundleGraphRequest.js +13 -3
- package/src/requests/WriteBundleRequest.js +9 -2
- package/src/resolveOptions.js +4 -2
- package/test/RequestTracker.test.js +120 -5
- package/test/test-utils.js +1 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,117 @@
|
|
|
1
1
|
# @atlaspack/core
|
|
2
2
|
|
|
3
|
+
## 2.17.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#588](https://github.com/atlassian-labs/atlaspack/pull/588) [`1940859`](https://github.com/atlassian-labs/atlaspack/commit/194085942f0e86532e9d039fc3f8039badce4594) Thanks [@yamadapc](https://github.com/yamadapc)! - Do not invalidate all javascript files when tsconfig files change
|
|
8
|
+
|
|
9
|
+
- [#592](https://github.com/atlassian-labs/atlaspack/pull/592) [`15b6155`](https://github.com/atlassian-labs/atlaspack/commit/15b61556e9114203ebbc9de94b864118ca764598) Thanks [@yamadapc](https://github.com/yamadapc)! - Report large file invalidations
|
|
10
|
+
|
|
11
|
+
- [#503](https://github.com/atlassian-labs/atlaspack/pull/503) [`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818) Thanks [@JakeLane](https://github.com/JakeLane)! - Fix conditional bundling reporter when condition is reused
|
|
12
|
+
|
|
13
|
+
- [#562](https://github.com/atlassian-labs/atlaspack/pull/562) [`d04de26`](https://github.com/atlassian-labs/atlaspack/commit/d04de26af684d7abfba5091fbe3df16a12cd0ebc) Thanks [@yamadapc](https://github.com/yamadapc)! - Update with feature-flagged change to write packages into files rather than LMDB
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`124b7ff`](https://github.com/atlassian-labs/atlaspack/commit/124b7fff44f71aac9fbad289a9a9509b3dfc9aaa), [`e052521`](https://github.com/atlassian-labs/atlaspack/commit/e0525210850ed1606146eb86991049cf567c5dec), [`15c6d70`](https://github.com/atlassian-labs/atlaspack/commit/15c6d7000bd89da876bc590aa75b17a619a41896), [`e4d966c`](https://github.com/atlassian-labs/atlaspack/commit/e4d966c3c9c4292c5013372ae65b10d19d4bacc6), [`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818), [`42a775d`](https://github.com/atlassian-labs/atlaspack/commit/42a775de8eec638ad188f3271964170d8c04d84b), [`29c2f10`](https://github.com/atlassian-labs/atlaspack/commit/29c2f106de9679adfb5afa04e1910471dc65a427), [`f4da1e1`](https://github.com/atlassian-labs/atlaspack/commit/f4da1e120e73eeb5e8b8927f05e88f04d6148c7b), [`1ef91fc`](https://github.com/atlassian-labs/atlaspack/commit/1ef91fcc863fdd2831511937083dbbc1263b3d9d)]:
|
|
16
|
+
- @atlaspack/cache@3.2.4
|
|
17
|
+
- @atlaspack/rust@3.3.4
|
|
18
|
+
- @atlaspack/fs@2.15.4
|
|
19
|
+
- @atlaspack/feature-flags@2.16.0
|
|
20
|
+
- @atlaspack/logger@2.14.9
|
|
21
|
+
- @atlaspack/utils@2.14.9
|
|
22
|
+
- @atlaspack/package-manager@2.14.9
|
|
23
|
+
- @atlaspack/graph@3.4.7
|
|
24
|
+
- @atlaspack/workers@2.14.9
|
|
25
|
+
- @atlaspack/profiler@2.14.7
|
|
26
|
+
- @atlaspack/types@2.14.9
|
|
27
|
+
- @atlaspack/plugin@2.14.9
|
|
28
|
+
|
|
29
|
+
## 2.17.3
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- [#551](https://github.com/atlassian-labs/atlaspack/pull/551) [`30f6017`](https://github.com/atlassian-labs/atlaspack/commit/30f60175ba4d272c5fc193973c63bc298584775b) Thanks [@yamadapc](https://github.com/yamadapc)! - Log request tracker invalidation counts on start-up
|
|
34
|
+
|
|
35
|
+
- [#550](https://github.com/atlassian-labs/atlaspack/pull/550) [`3a3e8e7`](https://github.com/atlassian-labs/atlaspack/commit/3a3e8e7be9e2dffd7304436d792f0f595d59665a) Thanks [@yamadapc](https://github.com/yamadapc)! - Fix typescript declaration files
|
|
36
|
+
|
|
37
|
+
- [#555](https://github.com/atlassian-labs/atlaspack/pull/555) [`15c1e3c`](https://github.com/atlassian-labs/atlaspack/commit/15c1e3c0628bae4c768d76cf3afc53d6d0d7ce7c) Thanks [@alshdavid](https://github.com/alshdavid)! - Added ATLASPACK_NATIVE_THREADS env variable to control the number of threads used by the native thread schedular
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [[`30f6017`](https://github.com/atlassian-labs/atlaspack/commit/30f60175ba4d272c5fc193973c63bc298584775b), [`3a3e8e7`](https://github.com/atlassian-labs/atlaspack/commit/3a3e8e7be9e2dffd7304436d792f0f595d59665a), [`1ab0a27`](https://github.com/atlassian-labs/atlaspack/commit/1ab0a275aeca40350415e2b03e7440d1dddc6228), [`b8a4ae8`](https://github.com/atlassian-labs/atlaspack/commit/b8a4ae8f83dc0a83d8b145c5f729936ce52080a3)]:
|
|
40
|
+
- @atlaspack/feature-flags@2.15.1
|
|
41
|
+
- @atlaspack/fs@2.15.3
|
|
42
|
+
- @atlaspack/rust@3.3.3
|
|
43
|
+
- @atlaspack/cache@3.2.3
|
|
44
|
+
- @atlaspack/graph@3.4.6
|
|
45
|
+
- @atlaspack/utils@2.14.8
|
|
46
|
+
- @atlaspack/package-manager@2.14.8
|
|
47
|
+
- @atlaspack/logger@2.14.8
|
|
48
|
+
- @atlaspack/profiler@2.14.6
|
|
49
|
+
- @atlaspack/types@2.14.8
|
|
50
|
+
- @atlaspack/workers@2.14.8
|
|
51
|
+
- @atlaspack/plugin@2.14.8
|
|
52
|
+
|
|
53
|
+
## 2.17.2
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [[`a1773d2`](https://github.com/atlassian-labs/atlaspack/commit/a1773d2a62d0ef7805ac7524621dcabcc1afe929), [`556d6ab`](https://github.com/atlassian-labs/atlaspack/commit/556d6ab8ede759fa7f37fcd3f4da336ef1c55e8f)]:
|
|
58
|
+
- @atlaspack/feature-flags@2.15.0
|
|
59
|
+
- @atlaspack/logger@2.14.7
|
|
60
|
+
- @atlaspack/rust@3.3.2
|
|
61
|
+
- @atlaspack/cache@3.2.2
|
|
62
|
+
- @atlaspack/fs@2.15.2
|
|
63
|
+
- @atlaspack/graph@3.4.5
|
|
64
|
+
- @atlaspack/utils@2.14.7
|
|
65
|
+
- @atlaspack/package-manager@2.14.7
|
|
66
|
+
- @atlaspack/workers@2.14.7
|
|
67
|
+
- @atlaspack/profiler@2.14.5
|
|
68
|
+
- @atlaspack/types@2.14.7
|
|
69
|
+
- @atlaspack/plugin@2.14.7
|
|
70
|
+
|
|
71
|
+
## 2.17.1
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- Updated dependencies [[`e0f5337`](https://github.com/atlassian-labs/atlaspack/commit/e0f533757bd1019dbd108a04952c87da15286e09)]:
|
|
76
|
+
- @atlaspack/feature-flags@2.14.4
|
|
77
|
+
- @atlaspack/rust@3.3.1
|
|
78
|
+
- @atlaspack/cache@3.2.1
|
|
79
|
+
- @atlaspack/fs@2.15.1
|
|
80
|
+
- @atlaspack/graph@3.4.4
|
|
81
|
+
- @atlaspack/utils@2.14.6
|
|
82
|
+
- @atlaspack/logger@2.14.6
|
|
83
|
+
- @atlaspack/package-manager@2.14.6
|
|
84
|
+
- @atlaspack/profiler@2.14.4
|
|
85
|
+
- @atlaspack/types@2.14.6
|
|
86
|
+
- @atlaspack/workers@2.14.6
|
|
87
|
+
- @atlaspack/plugin@2.14.6
|
|
88
|
+
|
|
89
|
+
## 2.17.0
|
|
90
|
+
|
|
91
|
+
### Minor Changes
|
|
92
|
+
|
|
93
|
+
- [#541](https://github.com/atlassian-labs/atlaspack/pull/541) [`e2ba0f6`](https://github.com/atlassian-labs/atlaspack/commit/e2ba0f69702656f3d1ce95ab1454e35062b13b39) Thanks [@yamadapc](https://github.com/yamadapc)! - Add database compaction debug command
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- [#530](https://github.com/atlassian-labs/atlaspack/pull/530) [`2e90c9b`](https://github.com/atlassian-labs/atlaspack/commit/2e90c9bd07d7eb52645f9d84ccbb7f82685cbc8c) Thanks [@yamadapc](https://github.com/yamadapc)! - Write metadata about the cache in a new entry
|
|
98
|
+
|
|
99
|
+
- [#511](https://github.com/atlassian-labs/atlaspack/pull/511) [`11d6f16`](https://github.com/atlassian-labs/atlaspack/commit/11d6f16b6397dee2f217167e5c98b39edb63f7a7) Thanks [@yamadapc](https://github.com/yamadapc)! - Clean-up dylib worker threads segmentation fault bug fix feature-flag
|
|
100
|
+
|
|
101
|
+
- Updated dependencies [[`11d6f16`](https://github.com/atlassian-labs/atlaspack/commit/11d6f16b6397dee2f217167e5c98b39edb63f7a7), [`e2ba0f6`](https://github.com/atlassian-labs/atlaspack/commit/e2ba0f69702656f3d1ce95ab1454e35062b13b39), [`d2c50c2`](https://github.com/atlassian-labs/atlaspack/commit/d2c50c2c020888b33bb25b8690d9320c2b69e2a6), [`46a90dc`](https://github.com/atlassian-labs/atlaspack/commit/46a90dccd019a26b222c878a92d23acc75dc67c5), [`4c17141`](https://github.com/atlassian-labs/atlaspack/commit/4c1714103dab2aa9039c488f381551d2b65d1d01)]:
|
|
102
|
+
- @atlaspack/feature-flags@2.14.3
|
|
103
|
+
- @atlaspack/rust@3.3.0
|
|
104
|
+
- @atlaspack/cache@3.2.0
|
|
105
|
+
- @atlaspack/fs@2.15.0
|
|
106
|
+
- @atlaspack/graph@3.4.3
|
|
107
|
+
- @atlaspack/utils@2.14.5
|
|
108
|
+
- @atlaspack/logger@2.14.5
|
|
109
|
+
- @atlaspack/package-manager@2.14.5
|
|
110
|
+
- @atlaspack/profiler@2.14.3
|
|
111
|
+
- @atlaspack/types@2.14.5
|
|
112
|
+
- @atlaspack/workers@2.14.5
|
|
113
|
+
- @atlaspack/plugin@2.14.5
|
|
114
|
+
|
|
3
115
|
## 2.16.1
|
|
4
116
|
|
|
5
117
|
### Patch Changes
|
package/lib/Atlaspack.js
CHANGED
|
@@ -207,10 +207,16 @@ class Atlaspack {
|
|
|
207
207
|
// $FlowFixMe
|
|
208
208
|
const version = require('../package.json').version;
|
|
209
209
|
await lmdb.put('current_session_version', Buffer.from(version));
|
|
210
|
+
let threads = undefined;
|
|
211
|
+
if (process.env.ATLASPACK_NATIVE_THREADS !== undefined) {
|
|
212
|
+
threads = parseInt(process.env.ATLASPACK_NATIVE_THREADS, 10);
|
|
213
|
+
} else if (process.env.NODE_ENV === 'test') {
|
|
214
|
+
threads = 2;
|
|
215
|
+
}
|
|
210
216
|
rustAtlaspack = await _atlaspackV.AtlaspackV3.create({
|
|
211
217
|
...options,
|
|
212
218
|
corePath: _path().default.join(__dirname, '..'),
|
|
213
|
-
threads
|
|
219
|
+
threads,
|
|
214
220
|
entries: Array.isArray(entries) ? entries : entries == null ? undefined : [entries],
|
|
215
221
|
env: resolvedOptions.env,
|
|
216
222
|
fs: inputFS && new _atlaspackV.FileSystemV3(inputFS),
|
|
@@ -504,7 +510,9 @@ class Atlaspack {
|
|
|
504
510
|
if (this.rustAtlaspack) {
|
|
505
511
|
nativeInvalid = await this.rustAtlaspack.respondToFsEvents(events);
|
|
506
512
|
}
|
|
507
|
-
let
|
|
513
|
+
let {
|
|
514
|
+
didInvalidate: isInvalid
|
|
515
|
+
} = await this.#requestTracker.respondToFSEvents(events, Number.POSITIVE_INFINITY);
|
|
508
516
|
if ((nativeInvalid || isInvalid) && this.#watchQueue.getNumWaiting() === 0) {
|
|
509
517
|
if (this.#watchAbortController) {
|
|
510
518
|
this.#watchAbortController.abort();
|
|
@@ -601,6 +609,19 @@ class Atlaspack {
|
|
|
601
609
|
}
|
|
602
610
|
return result;
|
|
603
611
|
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Copy the cache to a new directory and compact it.
|
|
615
|
+
*/
|
|
616
|
+
async unstable_compactCache() {
|
|
617
|
+
await this._init();
|
|
618
|
+
const cache = (0, _nullthrows().default)(this.#resolvedOptions).cache;
|
|
619
|
+
if (cache instanceof _cache().LMDBLiteCache) {
|
|
620
|
+
await cache.compact('parcel-cache-compacted');
|
|
621
|
+
} else {
|
|
622
|
+
throw new Error('Cache is not an LMDBLiteCache');
|
|
623
|
+
}
|
|
624
|
+
}
|
|
604
625
|
async unstable_transform(options) {
|
|
605
626
|
var _options$env;
|
|
606
627
|
if (!this.#initialized) {
|
|
@@ -14,7 +14,13 @@ exports.validatePackageName = validatePackageName;
|
|
|
14
14
|
// * We do not care about package names
|
|
15
15
|
// * Validation makes interop between parcel/atlaspack confusing.
|
|
16
16
|
//
|
|
17
|
-
function validatePackageName(
|
|
17
|
+
function validatePackageName(
|
|
18
|
+
// eslint-disable-next-line no-unused-vars
|
|
19
|
+
pkg,
|
|
20
|
+
// eslint-disable-next-line no-unused-vars
|
|
21
|
+
pluginType,
|
|
22
|
+
// eslint-disable-next-line no-unused-vars
|
|
23
|
+
key) {}
|
|
18
24
|
const validatePluginName = (pluginType, key) => {
|
|
19
25
|
return val => {
|
|
20
26
|
// allow plugin spread...
|
package/lib/BundleGraph.js
CHANGED
|
@@ -866,6 +866,7 @@ class BundleGraph {
|
|
|
866
866
|
if (bundleHasReference(descendant)) {
|
|
867
867
|
isReferenced = true;
|
|
868
868
|
actions.stop();
|
|
869
|
+
return;
|
|
869
870
|
}
|
|
870
871
|
}, referencer);
|
|
871
872
|
return isReferenced;
|
|
@@ -924,6 +925,7 @@ class BundleGraph {
|
|
|
924
925
|
let childBundles = this.getBundlesInBundleGroup(node.value);
|
|
925
926
|
if (childBundles.some(b => b.id !== bundle.id && b.bundleBehavior !== _types.BundleBehavior.isolated && b.bundleBehavior !== _types.BundleBehavior.inline && this.bundleHasAsset(b, asset))) {
|
|
926
927
|
actions.skipChildren();
|
|
928
|
+
return;
|
|
927
929
|
}
|
|
928
930
|
}
|
|
929
931
|
}, [bundleGraphEdgeTypes.references, bundleGraphEdgeTypes.bundle]);
|
package/lib/PackagerRunner.js
CHANGED
|
@@ -92,6 +92,13 @@ function _profiler() {
|
|
|
92
92
|
};
|
|
93
93
|
return data;
|
|
94
94
|
}
|
|
95
|
+
function _featureFlags() {
|
|
96
|
+
const data = require("@atlaspack/feature-flags");
|
|
97
|
+
_featureFlags = function () {
|
|
98
|
+
return data;
|
|
99
|
+
};
|
|
100
|
+
return data;
|
|
101
|
+
}
|
|
95
102
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
96
103
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
97
104
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -403,9 +410,10 @@ class PackagerRunner {
|
|
|
403
410
|
inlineSources = this.options.mode === 'production';
|
|
404
411
|
}
|
|
405
412
|
}
|
|
413
|
+
let mapFilename = fullPath + '.map';
|
|
406
414
|
let isInlineMap = bundle.env.sourceMap && bundle.env.sourceMap.inline;
|
|
407
415
|
let stringified = await map.stringify({
|
|
408
|
-
file: _path().default.basename(
|
|
416
|
+
file: _path().default.basename(mapFilename),
|
|
409
417
|
// $FlowFixMe
|
|
410
418
|
fs: this.options.inputFS,
|
|
411
419
|
rootDir: this.options.projectRoot,
|
|
@@ -434,6 +442,10 @@ class PackagerRunner {
|
|
|
434
442
|
devDepHashes += await this.getDevDepHashes(inlineBundle);
|
|
435
443
|
}
|
|
436
444
|
let invalidationHash = await (0, _assetUtils.getInvalidationHash)(invalidations, this.options);
|
|
445
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
446
|
+
const hash = (0, _rust().hashString)(_constants.ATLASPACK_VERSION + devDepHashes + invalidationHash + bundle.target.publicUrl + bundleGraph.getHash(bundle) + JSON.stringify(configResults) + JSON.stringify(globalInfoResults) + this.options.mode + (this.options.shouldBuildLazily ? 'lazy' : 'eager'));
|
|
447
|
+
return _path().default.join(bundle.displayName ?? bundle.name ?? bundle.id, hash);
|
|
448
|
+
}
|
|
437
449
|
return (0, _rust().hashString)(_constants.ATLASPACK_VERSION + devDepHashes + invalidationHash + bundle.target.publicUrl + bundleGraph.getHash(bundle) + JSON.stringify(configResults) + JSON.stringify(globalInfoResults) + this.options.mode + (this.options.shouldBuildLazily ? 'lazy' : 'eager'));
|
|
438
450
|
}
|
|
439
451
|
async getDevDepHashes(bundle) {
|
|
@@ -457,25 +469,27 @@ class PackagerRunner {
|
|
|
457
469
|
let contentKey = PackagerRunner.getContentKey(cacheKey);
|
|
458
470
|
let mapKey = PackagerRunner.getMapKey(cacheKey);
|
|
459
471
|
let isLargeBlob = await this.options.cache.hasLargeBlob(contentKey);
|
|
460
|
-
let contentExists = isLargeBlob || (await this.options.cache.has(contentKey));
|
|
472
|
+
let contentExists = (0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements') ? isLargeBlob : isLargeBlob || (await this.options.cache.has(contentKey));
|
|
461
473
|
if (!contentExists) {
|
|
462
474
|
return null;
|
|
463
475
|
}
|
|
464
|
-
let mapExists = await this.options.cache.has(mapKey);
|
|
476
|
+
let mapExists = (0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements') ? await this.options.cache.hasLargeBlob(mapKey) : await this.options.cache.has(mapKey);
|
|
465
477
|
return {
|
|
466
478
|
contents: isLargeBlob ? this.options.cache.getStream(contentKey) : (0, _utils().blobToStream)(await this.options.cache.getBlob(contentKey)),
|
|
467
|
-
map: mapExists ? (0, _utils().blobToStream)(await this.options.cache.getBlob(mapKey)) : null
|
|
479
|
+
map: mapExists ? (0, _utils().blobToStream)((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements') ? await this.options.cache.getLargeBlob(mapKey) : await this.options.cache.getBlob(mapKey)) : null
|
|
468
480
|
};
|
|
469
481
|
}
|
|
470
482
|
async writeToCache(cacheKeys, type, contents, map) {
|
|
471
483
|
let size = 0;
|
|
472
484
|
let hash;
|
|
473
485
|
let hashReferences = [];
|
|
474
|
-
let isLargeBlob =
|
|
486
|
+
let isLargeBlob = (0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements');
|
|
475
487
|
|
|
476
488
|
// TODO: don't replace hash references in binary files??
|
|
477
489
|
if (contents instanceof _stream().Readable) {
|
|
478
|
-
|
|
490
|
+
if (!(0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
491
|
+
isLargeBlob = true;
|
|
492
|
+
}
|
|
479
493
|
let boundaryStr = '';
|
|
480
494
|
let h = new (_rust().Hash)();
|
|
481
495
|
await this.options.cache.setStream(cacheKeys.content, (0, _utils().blobToStream)(contents).pipe(new (_utils().TapStream)(buf => {
|
|
@@ -491,15 +505,27 @@ class PackagerRunner {
|
|
|
491
505
|
size = buffer.byteLength;
|
|
492
506
|
hash = (0, _rust().hashBuffer)(buffer);
|
|
493
507
|
hashReferences = contents.match(_constants.HASH_REF_REGEX) ?? [];
|
|
494
|
-
|
|
508
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
509
|
+
await this.options.cache.setLargeBlob(cacheKeys.content, buffer);
|
|
510
|
+
} else {
|
|
511
|
+
await this.options.cache.setBlob(cacheKeys.content, buffer);
|
|
512
|
+
}
|
|
495
513
|
} else {
|
|
496
514
|
size = contents.length;
|
|
497
515
|
hash = (0, _rust().hashBuffer)(contents);
|
|
498
516
|
hashReferences = contents.toString().match(_constants.HASH_REF_REGEX) ?? [];
|
|
499
|
-
|
|
517
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
518
|
+
await this.options.cache.setLargeBlob(cacheKeys.content, contents);
|
|
519
|
+
} else {
|
|
520
|
+
await this.options.cache.setBlob(cacheKeys.content, contents);
|
|
521
|
+
}
|
|
500
522
|
}
|
|
501
523
|
if (map != null) {
|
|
502
|
-
|
|
524
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
525
|
+
await this.options.cache.setLargeBlob(cacheKeys.map, map);
|
|
526
|
+
} else {
|
|
527
|
+
await this.options.cache.setBlob(cacheKeys.map, map);
|
|
528
|
+
}
|
|
503
529
|
}
|
|
504
530
|
let info = {
|
|
505
531
|
type,
|
|
@@ -513,12 +539,21 @@ class PackagerRunner {
|
|
|
513
539
|
return info;
|
|
514
540
|
}
|
|
515
541
|
static getContentKey(cacheKey) {
|
|
542
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
543
|
+
return `PackagerRunner/${_constants.ATLASPACK_VERSION}/${cacheKey}/content`;
|
|
544
|
+
}
|
|
516
545
|
return (0, _rust().hashString)(`${cacheKey}:content`);
|
|
517
546
|
}
|
|
518
547
|
static getMapKey(cacheKey) {
|
|
548
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
549
|
+
return `PackagerRunner/${_constants.ATLASPACK_VERSION}/${cacheKey}/map`;
|
|
550
|
+
}
|
|
519
551
|
return (0, _rust().hashString)(`${cacheKey}:map`);
|
|
520
552
|
}
|
|
521
553
|
static getInfoKey(cacheKey) {
|
|
554
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
555
|
+
return `PackagerRunner/${_constants.ATLASPACK_VERSION}/${cacheKey}/info`;
|
|
556
|
+
}
|
|
522
557
|
return (0, _rust().hashString)(`${cacheKey}:info`);
|
|
523
558
|
}
|
|
524
559
|
}
|