parcel 2.0.0-dev.1516 → 2.0.0-dev.1526
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/cli.js +27 -2
- package/package.json +14 -13
- package/src/cli.js +26 -0
package/lib/cli.js
CHANGED
|
@@ -71,6 +71,13 @@ function _getPort() {
|
|
|
71
71
|
return data;
|
|
72
72
|
}
|
|
73
73
|
var _package = require("../package.json");
|
|
74
|
+
function _featureFlags() {
|
|
75
|
+
const data = require("@parcel/feature-flags");
|
|
76
|
+
_featureFlags = function () {
|
|
77
|
+
return data;
|
|
78
|
+
};
|
|
79
|
+
return data;
|
|
80
|
+
}
|
|
74
81
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
75
82
|
const program = new (_commander().default.Command)();
|
|
76
83
|
|
|
@@ -144,7 +151,24 @@ const commonOptions = {
|
|
|
144
151
|
'--reporter <name>': ['additional reporters to run', (val, acc) => {
|
|
145
152
|
acc.push(val);
|
|
146
153
|
return acc;
|
|
147
|
-
}, []]
|
|
154
|
+
}, []],
|
|
155
|
+
'--feature-flag <name=value>': ['sets the value of a feature flag', (value, previousValue) => {
|
|
156
|
+
let [name, val] = value.split('=');
|
|
157
|
+
if (name in _featureFlags().DEFAULT_FEATURE_FLAGS) {
|
|
158
|
+
var _featureFlagValue;
|
|
159
|
+
let featureFlagValue;
|
|
160
|
+
if (typeof _featureFlags().DEFAULT_FEATURE_FLAGS[name] === 'boolean') {
|
|
161
|
+
if (val !== 'true' && val !== 'false') {
|
|
162
|
+
throw new Error(`Feature flag ${name} must be set to true or false`);
|
|
163
|
+
}
|
|
164
|
+
featureFlagValue = val;
|
|
165
|
+
}
|
|
166
|
+
previousValue[name] = (_featureFlagValue = featureFlagValue) !== null && _featureFlagValue !== void 0 ? _featureFlagValue : String(val);
|
|
167
|
+
} else {
|
|
168
|
+
_logger().INTERNAL_ORIGINAL_CONSOLE.warn(`Unknown feature flag ${name} specified, it will be ignored`);
|
|
169
|
+
}
|
|
170
|
+
return previousValue;
|
|
171
|
+
}, {}]
|
|
148
172
|
};
|
|
149
173
|
var hmrOptions = {
|
|
150
174
|
'--no-hmr': 'disable hot module replacement',
|
|
@@ -457,6 +481,7 @@ async function normalizeOptions(command, inputFS) {
|
|
|
457
481
|
shouldScopeHoist: command.scopeHoist,
|
|
458
482
|
publicUrl: command.publicUrl,
|
|
459
483
|
distDir: command.distDir
|
|
460
|
-
}
|
|
484
|
+
},
|
|
485
|
+
featureFlags: command.featureFlag
|
|
461
486
|
};
|
|
462
487
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parcel",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.1526+70889ca07",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -21,17 +21,18 @@
|
|
|
21
21
|
"node": ">= 12.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@parcel/config-default": "2.0.0-dev.
|
|
25
|
-
"@parcel/core": "2.0.0-dev.
|
|
26
|
-
"@parcel/diagnostic": "2.0.0-dev.
|
|
27
|
-
"@parcel/events": "2.0.0-dev.
|
|
28
|
-
"@parcel/
|
|
29
|
-
"@parcel/
|
|
30
|
-
"@parcel/
|
|
31
|
-
"@parcel/
|
|
32
|
-
"@parcel/reporter-
|
|
33
|
-
"@parcel/reporter-
|
|
34
|
-
"@parcel/
|
|
24
|
+
"@parcel/config-default": "2.0.0-dev.1528+70889ca07",
|
|
25
|
+
"@parcel/core": "2.0.0-dev.1526+70889ca07",
|
|
26
|
+
"@parcel/diagnostic": "2.0.0-dev.1528+70889ca07",
|
|
27
|
+
"@parcel/events": "2.0.0-dev.1528+70889ca07",
|
|
28
|
+
"@parcel/feature-flags": "2.12.1-dev.3151+70889ca07",
|
|
29
|
+
"@parcel/fs": "2.0.0-dev.1528+70889ca07",
|
|
30
|
+
"@parcel/logger": "2.0.0-dev.1528+70889ca07",
|
|
31
|
+
"@parcel/package-manager": "2.0.0-dev.1528+70889ca07",
|
|
32
|
+
"@parcel/reporter-cli": "2.0.0-dev.1528+70889ca07",
|
|
33
|
+
"@parcel/reporter-dev-server": "2.0.0-dev.1528+70889ca07",
|
|
34
|
+
"@parcel/reporter-tracer": "2.12.1-dev.3151+70889ca07",
|
|
35
|
+
"@parcel/utils": "2.0.0-dev.1528+70889ca07",
|
|
35
36
|
"chalk": "^4.1.0",
|
|
36
37
|
"commander": "^7.0.0",
|
|
37
38
|
"get-port": "^4.2.0"
|
|
@@ -40,5 +41,5 @@
|
|
|
40
41
|
"@babel/core": "^7.22.11",
|
|
41
42
|
"@parcel/babel-register": "2.12.0"
|
|
42
43
|
},
|
|
43
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "70889ca07dccb95e21e4c6a2844d632e3723faf4"
|
|
44
45
|
}
|
package/src/cli.js
CHANGED
|
@@ -12,6 +12,7 @@ import commander from 'commander';
|
|
|
12
12
|
import path from 'path';
|
|
13
13
|
import getPort from 'get-port';
|
|
14
14
|
import {version} from '../package.json';
|
|
15
|
+
import {DEFAULT_FEATURE_FLAGS} from '@parcel/feature-flags';
|
|
15
16
|
|
|
16
17
|
const program = new commander.Command();
|
|
17
18
|
|
|
@@ -103,6 +104,30 @@ const commonOptions = {
|
|
|
103
104
|
},
|
|
104
105
|
[],
|
|
105
106
|
],
|
|
107
|
+
'--feature-flag <name=value>': [
|
|
108
|
+
'sets the value of a feature flag',
|
|
109
|
+
(value, previousValue) => {
|
|
110
|
+
let [name, val] = value.split('=');
|
|
111
|
+
if (name in DEFAULT_FEATURE_FLAGS) {
|
|
112
|
+
let featureFlagValue;
|
|
113
|
+
if (typeof DEFAULT_FEATURE_FLAGS[name] === 'boolean') {
|
|
114
|
+
if (val !== 'true' && val !== 'false') {
|
|
115
|
+
throw new Error(
|
|
116
|
+
`Feature flag ${name} must be set to true or false`,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
featureFlagValue = val;
|
|
120
|
+
}
|
|
121
|
+
previousValue[name] = featureFlagValue ?? String(val);
|
|
122
|
+
} else {
|
|
123
|
+
INTERNAL_ORIGINAL_CONSOLE.warn(
|
|
124
|
+
`Unknown feature flag ${name} specified, it will be ignored`,
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
return previousValue;
|
|
128
|
+
},
|
|
129
|
+
{},
|
|
130
|
+
],
|
|
106
131
|
};
|
|
107
132
|
|
|
108
133
|
var hmrOptions = {
|
|
@@ -509,5 +534,6 @@ async function normalizeOptions(
|
|
|
509
534
|
publicUrl: command.publicUrl,
|
|
510
535
|
distDir: command.distDir,
|
|
511
536
|
},
|
|
537
|
+
featureFlags: command.featureFlag,
|
|
512
538
|
};
|
|
513
539
|
}
|