@parcel/utils 2.0.0-nightly.944 → 2.0.0-nightly.951

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/lib/collection.js CHANGED
@@ -7,6 +7,8 @@ exports.unique = unique;
7
7
  exports.objectSortedEntries = objectSortedEntries;
8
8
  exports.objectSortedEntriesDeep = objectSortedEntriesDeep;
9
9
  exports.setDifference = setDifference;
10
+ exports.setIntersect = setIntersect;
11
+ exports.setUnion = setUnion;
10
12
 
11
13
  function unique(array) {
12
14
  return [...new Set(array)];
@@ -48,4 +50,16 @@ function setDifference(a, b) {
48
50
  }
49
51
 
50
52
  return difference;
53
+ }
54
+
55
+ function setIntersect(a, b) {
56
+ for (let entry of a) {
57
+ if (!b.has(entry)) {
58
+ a.delete(entry);
59
+ }
60
+ }
61
+ }
62
+
63
+ function setUnion(a, b) {
64
+ return new Set([...a, ...b]);
51
65
  }
package/lib/index.js CHANGED
@@ -171,6 +171,18 @@ Object.defineProperty(exports, "setDifference", {
171
171
  return _collection.setDifference;
172
172
  }
173
173
  });
174
+ Object.defineProperty(exports, "setIntersect", {
175
+ enumerable: true,
176
+ get: function () {
177
+ return _collection.setIntersect;
178
+ }
179
+ });
180
+ Object.defineProperty(exports, "setUnion", {
181
+ enumerable: true,
182
+ get: function () {
183
+ return _collection.setUnion;
184
+ }
185
+ });
174
186
  Object.defineProperty(exports, "resolveConfig", {
175
187
  enumerable: true,
176
188
  get: function () {
@@ -92,7 +92,7 @@ function replaceURLReferences({
92
92
  continue;
93
93
  }
94
94
 
95
- if (!resolved || resolved.bundleBehavior === 'inline') {
95
+ if (resolved.bundleBehavior === 'inline') {
96
96
  // If a bundle is inline, it should be replaced with inline contents,
97
97
  // not a URL.
98
98
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/utils",
3
- "version": "2.0.0-nightly.944+8ee562ae",
3
+ "version": "2.0.0-nightly.951+f5ab4677",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -21,11 +21,11 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@iarna/toml": "^2.2.0",
24
- "@parcel/codeframe": "2.0.0-nightly.944+8ee562ae",
25
- "@parcel/diagnostic": "2.0.0-nightly.944+8ee562ae",
26
- "@parcel/hash": "2.0.2-nightly.2566+8ee562ae",
27
- "@parcel/logger": "2.0.0-nightly.944+8ee562ae",
28
- "@parcel/markdown-ansi": "2.0.0-nightly.944+8ee562ae",
24
+ "@parcel/codeframe": "2.0.0-nightly.951+f5ab4677",
25
+ "@parcel/diagnostic": "2.0.0-nightly.951+f5ab4677",
26
+ "@parcel/hash": "2.0.2-nightly.2573+f5ab4677",
27
+ "@parcel/logger": "2.0.0-nightly.951+f5ab4677",
28
+ "@parcel/markdown-ansi": "2.0.0-nightly.951+f5ab4677",
29
29
  "@parcel/source-map": "^2.0.0",
30
30
  "ansi-html-community": "0.0.8",
31
31
  "chalk": "^4.1.0",
@@ -51,5 +51,5 @@
51
51
  "./src/http-server.js": false,
52
52
  "./src/openInBrowser.js": false
53
53
  },
54
- "gitHead": "8ee562aefc03a8ae4f3008109581f4170d7bda66"
54
+ "gitHead": "f5ab4677f0b01c317756b0bc0e8f759f1da49988"
55
55
  }
package/src/collection.js CHANGED
@@ -43,3 +43,15 @@ export function setDifference<T>(a: Set<T>, b: Set<T>): Set<T> {
43
43
  }
44
44
  return difference;
45
45
  }
46
+
47
+ export function setIntersect<T>(a: Set<T>, b: Set<T>): void {
48
+ for (let entry of a) {
49
+ if (!b.has(entry)) {
50
+ a.delete(entry);
51
+ }
52
+ }
53
+ }
54
+
55
+ export function setUnion<T>(a: Iterable<T>, b: Iterable<T>): Set<T> {
56
+ return new Set([...a, ...b]);
57
+ }
package/src/index.js CHANGED
@@ -35,6 +35,8 @@ export {
35
35
  objectSortedEntries,
36
36
  objectSortedEntriesDeep,
37
37
  setDifference,
38
+ setIntersect,
39
+ setUnion,
38
40
  } from './collection';
39
41
  export {resolveConfig, resolveConfigSync, loadConfig} from './config';
40
42
  export {DefaultMap, DefaultWeakMap} from './DefaultMap';
@@ -66,7 +66,7 @@ export function replaceURLReferences({
66
66
  continue;
67
67
  }
68
68
 
69
- if (!resolved || resolved.bundleBehavior === 'inline') {
69
+ if (resolved.bundleBehavior === 'inline') {
70
70
  // If a bundle is inline, it should be replaced with inline contents,
71
71
  // not a URL.
72
72
  continue;