@parcel/utils 2.0.0-nightly.1267 → 2.0.0-nightly.1273
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/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
- package/src/collection.js +6 -3
- package/src/hash.js +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/utils",
|
|
3
|
-
"version": "2.0.0-nightly.
|
|
3
|
+
"version": "2.0.0-nightly.1273+f65889ebd",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@parcel/codeframe": "2.0.0-nightly.
|
|
37
|
-
"@parcel/diagnostic": "2.0.0-nightly.
|
|
38
|
-
"@parcel/hash": "2.8.4-nightly.
|
|
39
|
-
"@parcel/logger": "2.0.0-nightly.
|
|
40
|
-
"@parcel/markdown-ansi": "2.0.0-nightly.
|
|
36
|
+
"@parcel/codeframe": "2.0.0-nightly.1273+f65889ebd",
|
|
37
|
+
"@parcel/diagnostic": "2.0.0-nightly.1273+f65889ebd",
|
|
38
|
+
"@parcel/hash": "2.8.4-nightly.2896+f65889ebd",
|
|
39
|
+
"@parcel/logger": "2.0.0-nightly.1273+f65889ebd",
|
|
40
|
+
"@parcel/markdown-ansi": "2.0.0-nightly.1273+f65889ebd",
|
|
41
41
|
"@parcel/source-map": "^2.1.1",
|
|
42
42
|
"chalk": "^4.1.0",
|
|
43
43
|
"nullthrows": "^1.1.1"
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"./src/http-server.js": false,
|
|
66
66
|
"./src/openInBrowser.js": false
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "f65889ebd768e9b2e146537b47d4d5d82ff177b8"
|
|
69
69
|
}
|
package/src/collection.js
CHANGED
|
@@ -34,7 +34,10 @@ function sortEntry(entry: mixed) {
|
|
|
34
34
|
return entry;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export function setDifference<T>(
|
|
37
|
+
export function setDifference<T>(
|
|
38
|
+
a: $ReadOnlySet<T>,
|
|
39
|
+
b: $ReadOnlySet<T>,
|
|
40
|
+
): Set<T> {
|
|
38
41
|
let difference = new Set();
|
|
39
42
|
for (let e of a) {
|
|
40
43
|
if (!b.has(e)) {
|
|
@@ -49,7 +52,7 @@ export function setDifference<T>(a: Set<T>, b: Set<T>): Set<T> {
|
|
|
49
52
|
return difference;
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
export function setIntersect<T>(a: Set<T>, b:
|
|
55
|
+
export function setIntersect<T>(a: Set<T>, b: $ReadOnlySet<T>): void {
|
|
53
56
|
for (let entry of a) {
|
|
54
57
|
if (!b.has(entry)) {
|
|
55
58
|
a.delete(entry);
|
|
@@ -61,7 +64,7 @@ export function setUnion<T>(a: Iterable<T>, b: Iterable<T>): Set<T> {
|
|
|
61
64
|
return new Set([...a, ...b]);
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
export function setEqual<T>(a:
|
|
67
|
+
export function setEqual<T>(a: $ReadOnlySet<T>, b: $ReadOnlySet<T>): boolean {
|
|
65
68
|
if (a.size != b.size) {
|
|
66
69
|
return false;
|
|
67
70
|
}
|
package/src/hash.js
CHANGED
|
@@ -29,6 +29,21 @@ export function hashObject(obj: {+[string]: mixed, ...}): string {
|
|
|
29
29
|
return hashString(JSON.stringify(objectSortedEntriesDeep(obj)));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
let testCache: {|[string]: Promise<string>|} = {
|
|
33
|
+
/*:: ...null */
|
|
34
|
+
};
|
|
32
35
|
export function hashFile(fs: FileSystem, filePath: string): Promise<string> {
|
|
36
|
+
if (process.env.PARCEL_BUILD_ENV === 'test') {
|
|
37
|
+
// Development builds of these native modules are especially big and slow to hash.
|
|
38
|
+
if (
|
|
39
|
+
/parcel-swc\.[^\\/]+\.node$|lightningcss.[^\\/]+.node$/.test(filePath)
|
|
40
|
+
) {
|
|
41
|
+
let cacheEntry = testCache[filePath];
|
|
42
|
+
if (cacheEntry) return cacheEntry;
|
|
43
|
+
let v = hashStream(fs.createReadStream(filePath));
|
|
44
|
+
testCache[filePath] = v;
|
|
45
|
+
return v;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
33
48
|
return hashStream(fs.createReadStream(filePath));
|
|
34
49
|
}
|