@atlaspack/core 2.16.2-canary.5 → 2.16.2-canary.51

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 CHANGED
@@ -1,5 +1,91 @@
1
1
  # @atlaspack/core
2
2
 
3
+ ## 2.17.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+
9
+ - [#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
10
+
11
+ - [#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
12
+
13
+ - 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)]:
14
+ - @atlaspack/feature-flags@2.15.1
15
+ - @atlaspack/fs@2.15.3
16
+ - @atlaspack/rust@3.3.3
17
+ - @atlaspack/cache@3.2.3
18
+ - @atlaspack/graph@3.4.6
19
+ - @atlaspack/utils@2.14.8
20
+ - @atlaspack/package-manager@2.14.8
21
+ - @atlaspack/logger@2.14.8
22
+ - @atlaspack/profiler@2.14.6
23
+ - @atlaspack/types@2.14.8
24
+ - @atlaspack/workers@2.14.8
25
+ - @atlaspack/plugin@2.14.8
26
+
27
+ ## 2.17.2
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [[`a1773d2`](https://github.com/atlassian-labs/atlaspack/commit/a1773d2a62d0ef7805ac7524621dcabcc1afe929), [`556d6ab`](https://github.com/atlassian-labs/atlaspack/commit/556d6ab8ede759fa7f37fcd3f4da336ef1c55e8f)]:
32
+ - @atlaspack/feature-flags@2.15.0
33
+ - @atlaspack/logger@2.14.7
34
+ - @atlaspack/rust@3.3.2
35
+ - @atlaspack/cache@3.2.2
36
+ - @atlaspack/fs@2.15.2
37
+ - @atlaspack/graph@3.4.5
38
+ - @atlaspack/utils@2.14.7
39
+ - @atlaspack/package-manager@2.14.7
40
+ - @atlaspack/workers@2.14.7
41
+ - @atlaspack/profiler@2.14.5
42
+ - @atlaspack/types@2.14.7
43
+ - @atlaspack/plugin@2.14.7
44
+
45
+ ## 2.17.1
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [[`e0f5337`](https://github.com/atlassian-labs/atlaspack/commit/e0f533757bd1019dbd108a04952c87da15286e09)]:
50
+ - @atlaspack/feature-flags@2.14.4
51
+ - @atlaspack/rust@3.3.1
52
+ - @atlaspack/cache@3.2.1
53
+ - @atlaspack/fs@2.15.1
54
+ - @atlaspack/graph@3.4.4
55
+ - @atlaspack/utils@2.14.6
56
+ - @atlaspack/logger@2.14.6
57
+ - @atlaspack/package-manager@2.14.6
58
+ - @atlaspack/profiler@2.14.4
59
+ - @atlaspack/types@2.14.6
60
+ - @atlaspack/workers@2.14.6
61
+ - @atlaspack/plugin@2.14.6
62
+
63
+ ## 2.17.0
64
+
65
+ ### Minor Changes
66
+
67
+ - [#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
68
+
69
+ ### Patch Changes
70
+
71
+ - [#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
72
+
73
+ - [#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
74
+
75
+ - 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)]:
76
+ - @atlaspack/feature-flags@2.14.3
77
+ - @atlaspack/rust@3.3.0
78
+ - @atlaspack/cache@3.2.0
79
+ - @atlaspack/fs@2.15.0
80
+ - @atlaspack/graph@3.4.3
81
+ - @atlaspack/utils@2.14.5
82
+ - @atlaspack/logger@2.14.5
83
+ - @atlaspack/package-manager@2.14.5
84
+ - @atlaspack/profiler@2.14.3
85
+ - @atlaspack/types@2.14.5
86
+ - @atlaspack/workers@2.14.5
87
+ - @atlaspack/plugin@2.14.5
88
+
3
89
  ## 2.16.1
4
90
 
5
91
  ### 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: process.env.NODE_ENV === 'test' ? 2 : undefined,
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 isInvalid = await this.#requestTracker.respondToFSEvents(events, Number.POSITIVE_INFINITY);
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) {
@@ -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 = false;
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
- isLargeBlob = true;
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
- await this.options.cache.setBlob(cacheKeys.content, buffer);
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
- await this.options.cache.setBlob(cacheKeys.content, contents);
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
- await this.options.cache.setBlob(cacheKeys.map, map);
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
  }