@atlaspack/core 2.16.2-dev.14 → 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 +86 -0
- package/lib/Atlaspack.js +10 -2
- package/lib/AtlaspackConfig.schema.js +7 -1
- package/lib/BundleGraph.js +2 -100
- 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 -8
- 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 +13 -5
- package/src/BundleGraph.js +0 -167
- 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 -15
- 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,91 @@
|
|
|
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
|
+
|
|
3
89
|
## 2.17.0
|
|
4
90
|
|
|
5
91
|
### Minor 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();
|
|
@@ -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
|
@@ -822,86 +822,6 @@ class BundleGraph {
|
|
|
822
822
|
traverseAssets(bundle, visit, startAsset) {
|
|
823
823
|
return this.traverseBundle(bundle, (0, _graph().mapVisitor)(node => node.type === 'asset' ? node.value : null, visit), startAsset);
|
|
824
824
|
}
|
|
825
|
-
getReferencedAssets(bundle, cache) {
|
|
826
|
-
const result = new Set();
|
|
827
|
-
const siblingBundles = new Set(this.getBundleGroupsContainingBundle(bundle).flatMap(bundleGroup => this.getBundlesInBundleGroup(bundleGroup, {
|
|
828
|
-
includeInline: true
|
|
829
|
-
})));
|
|
830
|
-
const candidates = new Map();
|
|
831
|
-
this.traverseAssets(bundle, asset => {
|
|
832
|
-
// If the asset is available in multiple bundles in the same target, it's referenced.
|
|
833
|
-
const bundlesWithAsset = this.getBundlesWithAsset(asset);
|
|
834
|
-
if (bundlesWithAsset.filter(b => b.target.name === bundle.target.name && b.target.distDir === bundle.target.distDir).length > 1) {
|
|
835
|
-
result.add(asset.id);
|
|
836
|
-
return;
|
|
837
|
-
}
|
|
838
|
-
const assetNodeId = (0, _nullthrows().default)(this._graph.getNodeIdByContentKey(asset.id));
|
|
839
|
-
if (this._graph.getNodeIdsConnectedTo(assetNodeId, bundleGraphEdgeTypes.references).map(id => this._graph.getNode(id)).some(node => (node === null || node === void 0 ? void 0 : node.type) === 'dependency' && (node.value.priority === _types.Priority.lazy || node.value.priority === _types.Priority.conditional) && node.value.specifierType !== _types.SpecifierType.url)) {
|
|
840
|
-
// If this asset is referenced by any async dependency, it's referenced.
|
|
841
|
-
result.add(asset.id);
|
|
842
|
-
return;
|
|
843
|
-
}
|
|
844
|
-
const dependencies = this._graph.getNodeIdsConnectedTo(assetNodeId).map(id => (0, _nullthrows().default)(this._graph.getNode(id))).filter(node => node.type === 'dependency').map(node => {
|
|
845
|
-
(0, _assert().default)(node.type === 'dependency');
|
|
846
|
-
return node.value;
|
|
847
|
-
});
|
|
848
|
-
candidates.set(asset.id, {
|
|
849
|
-
asset,
|
|
850
|
-
dependencies,
|
|
851
|
-
bundlesWithAsset
|
|
852
|
-
});
|
|
853
|
-
});
|
|
854
|
-
const visitedBundles = new Set();
|
|
855
|
-
|
|
856
|
-
// Check if any of this bundle's descendants, referencers, bundles referenced
|
|
857
|
-
// by referencers, or descendants of its referencers use the asset without
|
|
858
|
-
// an explicit reference edge. This can happen if e.g. the asset has been
|
|
859
|
-
// deduplicated.
|
|
860
|
-
[...siblingBundles].forEach(referencer => {
|
|
861
|
-
this.traverseBundles((descendant, _, actions) => {
|
|
862
|
-
if (descendant.id === bundle.id) {
|
|
863
|
-
return;
|
|
864
|
-
}
|
|
865
|
-
if (visitedBundles.has(descendant)) {
|
|
866
|
-
actions.skipChildren();
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
visitedBundles.add(descendant);
|
|
870
|
-
if (descendant.type !== bundle.type || descendant.env.context !== bundle.env.context) {
|
|
871
|
-
actions.skipChildren();
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
for (let assetId of this.getBundleDirectReferences(descendant, cache)) {
|
|
875
|
-
if (candidates.has(assetId)) {
|
|
876
|
-
result.add(assetId);
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
}, referencer);
|
|
880
|
-
});
|
|
881
|
-
return result;
|
|
882
|
-
}
|
|
883
|
-
getBundleDirectReferences(bundle, cache) {
|
|
884
|
-
const cachedResult = cache.get(bundle);
|
|
885
|
-
if (cachedResult != null) {
|
|
886
|
-
return cachedResult;
|
|
887
|
-
}
|
|
888
|
-
const directReferences = new Set();
|
|
889
|
-
const bundleAssets = this.getBundleContainedAssets(bundle);
|
|
890
|
-
const bundleDependencies = this.getBundleContainedDependencies(bundle);
|
|
891
|
-
for (const dependency of bundleDependencies) {
|
|
892
|
-
this._graph.forEachNodeIdConnectedFrom(this._graph.getNodeIdByContentKey(dependency), assetId => {
|
|
893
|
-
const asset = (0, _nullthrows().default)(this._graph.getNode(assetId));
|
|
894
|
-
if (asset.type !== 'asset') {
|
|
895
|
-
return;
|
|
896
|
-
}
|
|
897
|
-
if (!bundleAssets.has(asset.id)) {
|
|
898
|
-
directReferences.add(asset.id);
|
|
899
|
-
}
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
cache.set(bundle, directReferences);
|
|
903
|
-
return directReferences;
|
|
904
|
-
}
|
|
905
825
|
isAssetReferenced(bundle, asset) {
|
|
906
826
|
// If the asset is available in multiple bundles in the same target, it's referenced.
|
|
907
827
|
if (this.getBundlesWithAsset(asset).filter(b => b.target.name === bundle.target.name && b.target.distDir === bundle.target.distDir).length > 1) {
|
|
@@ -946,6 +866,7 @@ class BundleGraph {
|
|
|
946
866
|
if (bundleHasReference(descendant)) {
|
|
947
867
|
isReferenced = true;
|
|
948
868
|
actions.stop();
|
|
869
|
+
return;
|
|
949
870
|
}
|
|
950
871
|
}, referencer);
|
|
951
872
|
return isReferenced;
|
|
@@ -1004,6 +925,7 @@ class BundleGraph {
|
|
|
1004
925
|
let childBundles = this.getBundlesInBundleGroup(node.value);
|
|
1005
926
|
if (childBundles.some(b => b.id !== bundle.id && b.bundleBehavior !== _types.BundleBehavior.isolated && b.bundleBehavior !== _types.BundleBehavior.inline && this.bundleHasAsset(b, asset))) {
|
|
1006
927
|
actions.skipChildren();
|
|
928
|
+
return;
|
|
1007
929
|
}
|
|
1008
930
|
}
|
|
1009
931
|
}, [bundleGraphEdgeTypes.references, bundleGraphEdgeTypes.bundle]);
|
|
@@ -1220,26 +1142,6 @@ class BundleGraph {
|
|
|
1220
1142
|
let dependencyNodeId = this._graph.getNodeIdByContentKey(dependency.id);
|
|
1221
1143
|
return this._graph.hasEdge(bundleNodeId, dependencyNodeId, bundleGraphEdgeTypes.contains);
|
|
1222
1144
|
}
|
|
1223
|
-
getBundleContainedAssets(bundle) {
|
|
1224
|
-
const assets = new Set();
|
|
1225
|
-
this._graph.forEachNodeIdConnectedFrom(this._graph.getNodeIdByContentKey(bundle.id), nodeId => {
|
|
1226
|
-
const node = (0, _nullthrows().default)(this._graph.getNode(nodeId));
|
|
1227
|
-
if (node.type === 'asset') {
|
|
1228
|
-
assets.add(node.value.id);
|
|
1229
|
-
}
|
|
1230
|
-
}, bundleGraphEdgeTypes.contains);
|
|
1231
|
-
return assets;
|
|
1232
|
-
}
|
|
1233
|
-
getBundleContainedDependencies(bundle) {
|
|
1234
|
-
const dependencies = new Set();
|
|
1235
|
-
this._graph.forEachNodeIdConnectedFrom(this._graph.getNodeIdByContentKey(bundle.id), nodeId => {
|
|
1236
|
-
const node = (0, _nullthrows().default)(this._graph.getNode(nodeId));
|
|
1237
|
-
if (node.type === 'dependency') {
|
|
1238
|
-
dependencies.add(node.value.id);
|
|
1239
|
-
}
|
|
1240
|
-
}, bundleGraphEdgeTypes.contains);
|
|
1241
|
-
return dependencies;
|
|
1242
|
-
}
|
|
1243
1145
|
filteredTraverse(bundleNodeId, filter, visit) {
|
|
1244
1146
|
return this._graph.filteredTraverse(filter, visit, bundleNodeId);
|
|
1245
1147
|
}
|
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
|
}
|