@atlaspack/utils 2.14.5-dev.73 → 2.14.5-dev.95

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,31 @@
1
1
  # @atlaspack/utils
2
2
 
3
+ ## 2.15.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`644b157`](https://github.com/atlassian-labs/atlaspack/commit/644b157dee72a871acc2d0facf0b87b8eea51956)]:
8
+ - @atlaspack/feature-flags@2.18.2
9
+
10
+ ## 2.15.1
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb), [`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b), [`0501255`](https://github.com/atlassian-labs/atlaspack/commit/05012550da35b05ce7d356a8cc29311e7f9afdca)]:
15
+ - @atlaspack/logger@2.14.11
16
+ - @atlaspack/feature-flags@2.18.1
17
+
18
+ ## 2.15.0
19
+
20
+ ### Minor Changes
21
+
22
+ - [#622](https://github.com/atlassian-labs/atlaspack/pull/622) [`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c) Thanks [@benjervis](https://github.com/benjervis)! - Add the `setIntersectStatic` method that doesn't mutate the passed in Sets
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [[`10fbcfb`](https://github.com/atlassian-labs/atlaspack/commit/10fbcfbfa49c7a83da5d7c40983e36e87f524a75), [`85c52d3`](https://github.com/atlassian-labs/atlaspack/commit/85c52d3f7717b3c84a118d18ab98cfbfd71dcbd2)]:
27
+ - @atlaspack/feature-flags@2.18.0
28
+
3
29
  ## 2.14.11
4
30
 
5
31
  ### Patch Changes
package/benchmark.js ADDED
@@ -0,0 +1,23 @@
1
+ require('@atlaspack/babel-register');
2
+ const b = require('benny');
3
+
4
+ const {setIntersect, setIntersectStatic} = require('./src/collection.js');
5
+
6
+ const setA = new Set([
7
+ 23, 25, 29, 29, 12, 16, 14, 23, 18, 19, 16, 24, 9, 29, 26,
8
+ ]);
9
+ const setB = new Set([24, 1, 3, 6, 1, 3, 1, 5, 20, 15, 21, 23, 13, 16, 6]);
10
+
11
+ b.suite(
12
+ 'Collection - set intersection',
13
+ b.add('Control', () => {
14
+ const setClone = new Set(setA);
15
+ return () => setIntersect(setClone, setB);
16
+ }),
17
+ b.add('setIntersectStatic', () => {
18
+ setIntersectStatic(setA, setB);
19
+ }),
20
+ b.configure({minSamples: 100}),
21
+ b.cycle(),
22
+ b.complete(),
23
+ );
package/lib/index.js CHANGED
@@ -3447,6 +3447,7 @@ $parcel$export(module.exports, "setDifference", () => $2ee306eb47a905ca$export$8
3447
3447
  $parcel$export(module.exports, "setSymmetricDifference", () => $2ee306eb47a905ca$export$be646fbd7a3fda37);
3448
3448
  $parcel$export(module.exports, "setEqual", () => $2ee306eb47a905ca$export$dd7d5a65a6b6780f);
3449
3449
  $parcel$export(module.exports, "setIntersect", () => $2ee306eb47a905ca$export$9404cfefeb010e68);
3450
+ $parcel$export(module.exports, "setIntersectStatic", () => $2ee306eb47a905ca$export$25266bb285978950);
3450
3451
  $parcel$export(module.exports, "setUnion", () => $2ee306eb47a905ca$export$667066422fa0af46);
3451
3452
  $parcel$export(module.exports, "resolveConfig", () => $cc7044c885d3b7c6$export$7eca4ea16d4c8343);
3452
3453
  $parcel$export(module.exports, "resolveConfigSync", () => $cc7044c885d3b7c6$export$d175e66e9fcd7b75);
@@ -33886,7 +33887,7 @@ async function $d8ed9adb8bea7573$export$2e2bcd8739ae039(diagnostic, options, ter
33886
33887
  let { origin: origin, message: message, stack: stack, codeFrames: codeFrames, hints: hints, skipFormatting: skipFormatting, documentationURL: documentationURL } = diagnostic;
33887
33888
  const md = format === 'ansi' ? (0, ($parcel$interopDefault($iBiQ5$atlaspackmarkdownansi))) : (0, $96d5d01cd0db6227$export$2e2bcd8739ae039);
33888
33889
  const terminalLink = format === 'ansi' ? (0, (/*@__PURE__*/$parcel$interopDefault($b071885206b3ac48$exports))) : // eslint-disable-next-line no-unused-vars
33889
- (text, url)=>`<a href="${url}">${text}</a>`;
33890
+ (text, url, _)=>`<a href="${url}">${text}</a>`;
33890
33891
  const chalk = format === 'ansi' ? (0, ($parcel$interopDefault($iBiQ5$chalk))) : {
33891
33892
  gray: {
33892
33893
  underline: (v)=>`<span style="color: grey; text-decoration: underline;">${v}</span>`
@@ -33974,13 +33975,14 @@ class $8b0b2852bcb1a5b2$export$2e2bcd8739ae039 {
33974
33975
  add(fn) {
33975
33976
  new Promise((resolve, reject)=>{
33976
33977
  let i = this._count++;
33977
- this._queue.push(()=>fn().then((result)=>{
33978
+ let wrapped = ()=>fn().then((result)=>{
33978
33979
  this._results[i] = result;
33979
33980
  resolve(result);
33980
33981
  }, (err)=>{
33981
33982
  reject(err);
33982
33983
  throw err;
33983
- }));
33984
+ });
33985
+ this._queue.push(wrapped);
33984
33986
  for (const addFn of this._addSubscriptions)addFn();
33985
33987
  if (this._numRunning > 0 && this._numRunning < this._maxConcurrent) this._next();
33986
33988
  }).catch(()=>{});
@@ -34491,7 +34493,7 @@ function $7eb0d819da9341a5$export$2e2bcd8739ae039(fn, delay) {
34491
34493
 
34492
34494
  function $3817081e001856b1$export$2e2bcd8739ae039(fn, delay) {
34493
34495
  let lastCalled;
34494
- return function(...args) {
34496
+ return function throttled(...args) {
34495
34497
  if (lastCalled == null || lastCalled + delay <= Date.now()) {
34496
34498
  fn.call(this, ...args);
34497
34499
  lastCalled = Date.now();
@@ -36716,6 +36718,11 @@ function $2ee306eb47a905ca$export$be646fbd7a3fda37(a, b) {
36716
36718
  function $2ee306eb47a905ca$export$9404cfefeb010e68(a, b) {
36717
36719
  for (let entry of a)if (!b.has(entry)) a.delete(entry);
36718
36720
  }
36721
+ function $2ee306eb47a905ca$export$25266bb285978950(a, b) {
36722
+ let intersection = new Set();
36723
+ for (let entry of a)if (b.has(entry)) intersection.add(entry);
36724
+ return intersection;
36725
+ }
36719
36726
  function $2ee306eb47a905ca$export$667066422fa0af46(a, b) {
36720
36727
  return new Set([
36721
36728
  ...a,
@@ -36807,6 +36814,16 @@ function $1e1fa42764ee5f95$export$3477f9615e12f61d(obj) {
36807
36814
  let $1e1fa42764ee5f95$var$testCache = {
36808
36815
  };
36809
36816
  function $1e1fa42764ee5f95$export$42462553d605d8cd(fs, filePath) {
36817
+ if (process.env.ATLASPACK_BUILD_ENV === 'test') // Development builds of these native modules are especially big and slow to hash.
36818
+ {
36819
+ if (/parcel-swc\.[^\\/]+\.node$|lightningcss.[^\\/]+.node$/.test(filePath)) {
36820
+ let cacheEntry = $1e1fa42764ee5f95$var$testCache[filePath];
36821
+ if (cacheEntry) return cacheEntry;
36822
+ let v = $1e1fa42764ee5f95$export$8a9ede1a78d6a1fe(fs.createReadStream(filePath));
36823
+ $1e1fa42764ee5f95$var$testCache[filePath] = v;
36824
+ return v;
36825
+ }
36826
+ }
36810
36827
  return $1e1fa42764ee5f95$export$8a9ede1a78d6a1fe(fs.createReadStream(filePath));
36811
36828
  }
36812
36829