@atlaspack/core 2.17.2 → 2.17.4
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 +50 -0
- package/lib/Atlaspack.js +10 -2
- package/lib/PackagerRunner.js +42 -8
- package/lib/RequestTracker.js +288 -88
- package/lib/UncommittedAsset.js +17 -0
- package/lib/atlaspack-v3/worker/worker.js +8 -0
- 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 +4 -2
- package/package.json +18 -14
- package/src/Atlaspack.js +13 -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 +115 -3
- package/test/test-utils.js +1 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
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
|
+
|
|
3
53
|
## 2.17.2
|
|
4
54
|
|
|
5
55
|
### 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();
|
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 }; }
|
|
@@ -434,6 +441,10 @@ class PackagerRunner {
|
|
|
434
441
|
devDepHashes += await this.getDevDepHashes(inlineBundle);
|
|
435
442
|
}
|
|
436
443
|
let invalidationHash = await (0, _assetUtils.getInvalidationHash)(invalidations, this.options);
|
|
444
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
445
|
+
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'));
|
|
446
|
+
return _path().default.join(bundle.displayName ?? bundle.name ?? bundle.id, hash);
|
|
447
|
+
}
|
|
437
448
|
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
449
|
}
|
|
439
450
|
async getDevDepHashes(bundle) {
|
|
@@ -457,25 +468,27 @@ class PackagerRunner {
|
|
|
457
468
|
let contentKey = PackagerRunner.getContentKey(cacheKey);
|
|
458
469
|
let mapKey = PackagerRunner.getMapKey(cacheKey);
|
|
459
470
|
let isLargeBlob = await this.options.cache.hasLargeBlob(contentKey);
|
|
460
|
-
let contentExists = isLargeBlob || (await this.options.cache.has(contentKey));
|
|
471
|
+
let contentExists = (0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements') ? isLargeBlob : isLargeBlob || (await this.options.cache.has(contentKey));
|
|
461
472
|
if (!contentExists) {
|
|
462
473
|
return null;
|
|
463
474
|
}
|
|
464
|
-
let mapExists = await this.options.cache.has(mapKey);
|
|
475
|
+
let mapExists = (0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements') ? await this.options.cache.hasLargeBlob(mapKey) : await this.options.cache.has(mapKey);
|
|
465
476
|
return {
|
|
466
477
|
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
|
|
478
|
+
map: mapExists ? (0, _utils().blobToStream)((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements') ? await this.options.cache.getLargeBlob(mapKey) : await this.options.cache.getBlob(mapKey)) : null
|
|
468
479
|
};
|
|
469
480
|
}
|
|
470
481
|
async writeToCache(cacheKeys, type, contents, map) {
|
|
471
482
|
let size = 0;
|
|
472
483
|
let hash;
|
|
473
484
|
let hashReferences = [];
|
|
474
|
-
let isLargeBlob =
|
|
485
|
+
let isLargeBlob = (0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements');
|
|
475
486
|
|
|
476
487
|
// TODO: don't replace hash references in binary files??
|
|
477
488
|
if (contents instanceof _stream().Readable) {
|
|
478
|
-
|
|
489
|
+
if (!(0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
490
|
+
isLargeBlob = true;
|
|
491
|
+
}
|
|
479
492
|
let boundaryStr = '';
|
|
480
493
|
let h = new (_rust().Hash)();
|
|
481
494
|
await this.options.cache.setStream(cacheKeys.content, (0, _utils().blobToStream)(contents).pipe(new (_utils().TapStream)(buf => {
|
|
@@ -491,15 +504,27 @@ class PackagerRunner {
|
|
|
491
504
|
size = buffer.byteLength;
|
|
492
505
|
hash = (0, _rust().hashBuffer)(buffer);
|
|
493
506
|
hashReferences = contents.match(_constants.HASH_REF_REGEX) ?? [];
|
|
494
|
-
|
|
507
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
508
|
+
await this.options.cache.setLargeBlob(cacheKeys.content, buffer);
|
|
509
|
+
} else {
|
|
510
|
+
await this.options.cache.setBlob(cacheKeys.content, buffer);
|
|
511
|
+
}
|
|
495
512
|
} else {
|
|
496
513
|
size = contents.length;
|
|
497
514
|
hash = (0, _rust().hashBuffer)(contents);
|
|
498
515
|
hashReferences = contents.toString().match(_constants.HASH_REF_REGEX) ?? [];
|
|
499
|
-
|
|
516
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
517
|
+
await this.options.cache.setLargeBlob(cacheKeys.content, contents);
|
|
518
|
+
} else {
|
|
519
|
+
await this.options.cache.setBlob(cacheKeys.content, contents);
|
|
520
|
+
}
|
|
500
521
|
}
|
|
501
522
|
if (map != null) {
|
|
502
|
-
|
|
523
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
524
|
+
await this.options.cache.setLargeBlob(cacheKeys.map, map);
|
|
525
|
+
} else {
|
|
526
|
+
await this.options.cache.setBlob(cacheKeys.map, map);
|
|
527
|
+
}
|
|
503
528
|
}
|
|
504
529
|
let info = {
|
|
505
530
|
type,
|
|
@@ -513,12 +538,21 @@ class PackagerRunner {
|
|
|
513
538
|
return info;
|
|
514
539
|
}
|
|
515
540
|
static getContentKey(cacheKey) {
|
|
541
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
542
|
+
return `PackagerRunner/${_constants.ATLASPACK_VERSION}/${cacheKey}/content`;
|
|
543
|
+
}
|
|
516
544
|
return (0, _rust().hashString)(`${cacheKey}:content`);
|
|
517
545
|
}
|
|
518
546
|
static getMapKey(cacheKey) {
|
|
547
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
548
|
+
return `PackagerRunner/${_constants.ATLASPACK_VERSION}/${cacheKey}/map`;
|
|
549
|
+
}
|
|
519
550
|
return (0, _rust().hashString)(`${cacheKey}:map`);
|
|
520
551
|
}
|
|
521
552
|
static getInfoKey(cacheKey) {
|
|
553
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
554
|
+
return `PackagerRunner/${_constants.ATLASPACK_VERSION}/${cacheKey}/info`;
|
|
555
|
+
}
|
|
522
556
|
return (0, _rust().hashString)(`${cacheKey}:info`);
|
|
523
557
|
}
|
|
524
558
|
}
|