@parcel/utils 2.0.0-nightly.941 → 2.0.0-nightly.949
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 +14 -0
- package/lib/config.js +0 -1
- package/lib/index.js +12 -0
- package/lib/replaceBundleReferences.js +1 -1
- package/package.json +7 -7
- package/src/collection.js +12 -0
- package/src/config.js +0 -1
- package/src/index.js +2 -0
- package/src/replaceBundleReferences.js +1 -1
- package/test/config.test.js +50 -0
- package/test/input/config/config.json +3 -0
- package/test/input/config/empty.json +0 -0
- package/test/input/config/empty.toml +0 -0
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/config.js
CHANGED
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 (
|
|
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.
|
|
3
|
+
"version": "2.0.0-nightly.949+588bf4c0",
|
|
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.
|
|
25
|
-
"@parcel/diagnostic": "2.0.0-nightly.
|
|
26
|
-
"@parcel/hash": "2.0.2-nightly.
|
|
27
|
-
"@parcel/logger": "2.0.0-nightly.
|
|
28
|
-
"@parcel/markdown-ansi": "2.0.0-nightly.
|
|
24
|
+
"@parcel/codeframe": "2.0.0-nightly.949+588bf4c0",
|
|
25
|
+
"@parcel/diagnostic": "2.0.0-nightly.949+588bf4c0",
|
|
26
|
+
"@parcel/hash": "2.0.2-nightly.2571+588bf4c0",
|
|
27
|
+
"@parcel/logger": "2.0.0-nightly.949+588bf4c0",
|
|
28
|
+
"@parcel/markdown-ansi": "2.0.0-nightly.949+588bf4c0",
|
|
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": "
|
|
54
|
+
"gitHead": "588bf4c0d6d9dac65a9bf89bf734d7684b523ca2"
|
|
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/config.js
CHANGED
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 (
|
|
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;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
|
|
3
|
+
import assert from 'assert';
|
|
4
|
+
import {loadConfig} from '../src/config';
|
|
5
|
+
import {inputFS as fs} from '@parcel/test-utils';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
|
|
8
|
+
describe('loadConfig', () => {
|
|
9
|
+
it('load config with json', async () => {
|
|
10
|
+
assert.deepEqual(
|
|
11
|
+
(
|
|
12
|
+
await loadConfig(
|
|
13
|
+
fs,
|
|
14
|
+
path.join(__dirname, './input/config/config.json'),
|
|
15
|
+
['config.json'],
|
|
16
|
+
path.join(__dirname, './input/config/'),
|
|
17
|
+
)
|
|
18
|
+
)?.config,
|
|
19
|
+
{
|
|
20
|
+
hoge: 'fuga',
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should throw error with empty string json', async () => {
|
|
26
|
+
// $FlowFixMe[prop-missing]
|
|
27
|
+
await assert.rejects(async () => {
|
|
28
|
+
await loadConfig(
|
|
29
|
+
fs,
|
|
30
|
+
path.join(__dirname, './input/config/empty.json'),
|
|
31
|
+
['empty.json'],
|
|
32
|
+
path.join(__dirname, './input/config/'),
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should load with empty string config toml', async () => {
|
|
38
|
+
assert.deepEqual(
|
|
39
|
+
(
|
|
40
|
+
await loadConfig(
|
|
41
|
+
fs,
|
|
42
|
+
path.join(__dirname, './input/config/empty.toml'),
|
|
43
|
+
['empty.toml'],
|
|
44
|
+
path.join(__dirname, './input/config/'),
|
|
45
|
+
)
|
|
46
|
+
)?.config,
|
|
47
|
+
{},
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
File without changes
|
|
File without changes
|