parcel 2.0.0-dev.1516 → 2.0.0-dev.1546
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 +58 -3
- package/package.json +14 -13
- package/src/cli.js +60 -1
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
|
|
|
@@ -124,14 +131,42 @@ process.on('unhandledRejection', handleUncaughtException);
|
|
|
124
131
|
program.storeOptionsAsProperties();
|
|
125
132
|
program.version(_package.version);
|
|
126
133
|
|
|
134
|
+
// Only display choices available to callers OS
|
|
135
|
+
let watcherBackendChoices = ['brute-force'];
|
|
136
|
+
switch (process.platform) {
|
|
137
|
+
case 'darwin':
|
|
138
|
+
{
|
|
139
|
+
watcherBackendChoices.push('watchman', 'fs-events');
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
case 'linux':
|
|
143
|
+
{
|
|
144
|
+
watcherBackendChoices.push('watchman', 'inotify');
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
case 'win32':
|
|
148
|
+
{
|
|
149
|
+
watcherBackendChoices.push('watchman', 'windows');
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
case 'freebsd' || 'openbsd':
|
|
153
|
+
{
|
|
154
|
+
watcherBackendChoices.push('watchman');
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
default:
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
|
|
127
161
|
// --no-cache, --cache-dir, --no-source-maps, --no-autoinstall, --global?, --public-url, --log-level
|
|
128
162
|
// --no-content-hash, --experimental-scope-hoisting, --detailed-report
|
|
129
|
-
|
|
130
163
|
const commonOptions = {
|
|
131
164
|
'--no-cache': 'disable the filesystem cache',
|
|
132
165
|
'--config <path>': 'specify which config to use. can be a path or a package name',
|
|
133
166
|
'--cache-dir <path>': 'set the cache directory. defaults to ".parcel-cache"',
|
|
134
167
|
'--watch-dir <path>': 'set the root watch directory. defaults to nearest lockfile or source control dir.',
|
|
168
|
+
'--watch-ignore [path]': [`list of directories watcher should not be tracking for changes. defaults to ['.git', '.hg']`, dirs => dirs.split(',')],
|
|
169
|
+
'--watch-backend': new (_commander().default.Option)('--watch-backend <name>', 'set watcher backend').choices(watcherBackendChoices),
|
|
135
170
|
'--no-source-maps': 'disable sourcemaps',
|
|
136
171
|
'--target [name]': ['only build given target(s)', (val, list) => list.concat([val]), []],
|
|
137
172
|
'--log-level <level>': new (_commander().default.Option)('--log-level <level>', 'set the log level').choices(['none', 'error', 'warn', 'info', 'verbose']),
|
|
@@ -144,7 +179,24 @@ const commonOptions = {
|
|
|
144
179
|
'--reporter <name>': ['additional reporters to run', (val, acc) => {
|
|
145
180
|
acc.push(val);
|
|
146
181
|
return acc;
|
|
147
|
-
}, []]
|
|
182
|
+
}, []],
|
|
183
|
+
'--feature-flag <name=value>': ['sets the value of a feature flag', (value, previousValue) => {
|
|
184
|
+
let [name, val] = value.split('=');
|
|
185
|
+
if (name in _featureFlags().DEFAULT_FEATURE_FLAGS) {
|
|
186
|
+
var _featureFlagValue;
|
|
187
|
+
let featureFlagValue;
|
|
188
|
+
if (typeof _featureFlags().DEFAULT_FEATURE_FLAGS[name] === 'boolean') {
|
|
189
|
+
if (val !== 'true' && val !== 'false') {
|
|
190
|
+
throw new Error(`Feature flag ${name} must be set to true or false`);
|
|
191
|
+
}
|
|
192
|
+
featureFlagValue = val;
|
|
193
|
+
}
|
|
194
|
+
previousValue[name] = (_featureFlagValue = featureFlagValue) !== null && _featureFlagValue !== void 0 ? _featureFlagValue : String(val);
|
|
195
|
+
} else {
|
|
196
|
+
_logger().INTERNAL_ORIGINAL_CONSOLE.warn(`Unknown feature flag ${name} specified, it will be ignored`);
|
|
197
|
+
}
|
|
198
|
+
return previousValue;
|
|
199
|
+
}, {}]
|
|
148
200
|
};
|
|
149
201
|
var hmrOptions = {
|
|
150
202
|
'--no-hmr': 'disable hot module replacement',
|
|
@@ -430,6 +482,8 @@ async function normalizeOptions(command, inputFS) {
|
|
|
430
482
|
shouldDisableCache: command.cache === false,
|
|
431
483
|
cacheDir: command.cacheDir,
|
|
432
484
|
watchDir: command.watchDir,
|
|
485
|
+
watchBackend: command.watchBackend,
|
|
486
|
+
watchIgnore: command.watchIgnore,
|
|
433
487
|
config: command.config,
|
|
434
488
|
mode,
|
|
435
489
|
hmrOptions,
|
|
@@ -457,6 +511,7 @@ async function normalizeOptions(command, inputFS) {
|
|
|
457
511
|
shouldScopeHoist: command.scopeHoist,
|
|
458
512
|
publicUrl: command.publicUrl,
|
|
459
513
|
distDir: command.distDir
|
|
460
|
-
}
|
|
514
|
+
},
|
|
515
|
+
featureFlags: command.featureFlag
|
|
461
516
|
};
|
|
462
517
|
}
|
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.1546+79b158883",
|
|
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.1548+79b158883",
|
|
25
|
+
"@parcel/core": "2.0.0-dev.1546+79b158883",
|
|
26
|
+
"@parcel/diagnostic": "2.0.0-dev.1548+79b158883",
|
|
27
|
+
"@parcel/events": "2.0.0-dev.1548+79b158883",
|
|
28
|
+
"@parcel/feature-flags": "2.12.1-dev.3171+79b158883",
|
|
29
|
+
"@parcel/fs": "2.0.0-dev.1548+79b158883",
|
|
30
|
+
"@parcel/logger": "2.0.0-dev.1548+79b158883",
|
|
31
|
+
"@parcel/package-manager": "2.0.0-dev.1548+79b158883",
|
|
32
|
+
"@parcel/reporter-cli": "2.0.0-dev.1548+79b158883",
|
|
33
|
+
"@parcel/reporter-dev-server": "2.0.0-dev.1548+79b158883",
|
|
34
|
+
"@parcel/reporter-tracer": "2.12.1-dev.3171+79b158883",
|
|
35
|
+
"@parcel/utils": "2.0.0-dev.1548+79b158883",
|
|
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": "79b158883170daac9cd17bdecfebff163bc99e52"
|
|
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
|
|
|
@@ -65,9 +66,31 @@ process.on('unhandledRejection', handleUncaughtException);
|
|
|
65
66
|
program.storeOptionsAsProperties();
|
|
66
67
|
program.version(version);
|
|
67
68
|
|
|
69
|
+
// Only display choices available to callers OS
|
|
70
|
+
let watcherBackendChoices = ['brute-force'];
|
|
71
|
+
switch (process.platform) {
|
|
72
|
+
case 'darwin': {
|
|
73
|
+
watcherBackendChoices.push('watchman', 'fs-events');
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case 'linux': {
|
|
77
|
+
watcherBackendChoices.push('watchman', 'inotify');
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case 'win32': {
|
|
81
|
+
watcherBackendChoices.push('watchman', 'windows');
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
case 'freebsd' || 'openbsd': {
|
|
85
|
+
watcherBackendChoices.push('watchman');
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
default:
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
|
|
68
92
|
// --no-cache, --cache-dir, --no-source-maps, --no-autoinstall, --global?, --public-url, --log-level
|
|
69
93
|
// --no-content-hash, --experimental-scope-hoisting, --detailed-report
|
|
70
|
-
|
|
71
94
|
const commonOptions = {
|
|
72
95
|
'--no-cache': 'disable the filesystem cache',
|
|
73
96
|
'--config <path>':
|
|
@@ -75,6 +98,14 @@ const commonOptions = {
|
|
|
75
98
|
'--cache-dir <path>': 'set the cache directory. defaults to ".parcel-cache"',
|
|
76
99
|
'--watch-dir <path>':
|
|
77
100
|
'set the root watch directory. defaults to nearest lockfile or source control dir.',
|
|
101
|
+
'--watch-ignore [path]': [
|
|
102
|
+
`list of directories watcher should not be tracking for changes. defaults to ['.git', '.hg']`,
|
|
103
|
+
dirs => dirs.split(','),
|
|
104
|
+
],
|
|
105
|
+
'--watch-backend': new commander.Option(
|
|
106
|
+
'--watch-backend <name>',
|
|
107
|
+
'set watcher backend',
|
|
108
|
+
).choices(watcherBackendChoices),
|
|
78
109
|
'--no-source-maps': 'disable sourcemaps',
|
|
79
110
|
'--target [name]': [
|
|
80
111
|
'only build given target(s)',
|
|
@@ -103,6 +134,30 @@ const commonOptions = {
|
|
|
103
134
|
},
|
|
104
135
|
[],
|
|
105
136
|
],
|
|
137
|
+
'--feature-flag <name=value>': [
|
|
138
|
+
'sets the value of a feature flag',
|
|
139
|
+
(value, previousValue) => {
|
|
140
|
+
let [name, val] = value.split('=');
|
|
141
|
+
if (name in DEFAULT_FEATURE_FLAGS) {
|
|
142
|
+
let featureFlagValue;
|
|
143
|
+
if (typeof DEFAULT_FEATURE_FLAGS[name] === 'boolean') {
|
|
144
|
+
if (val !== 'true' && val !== 'false') {
|
|
145
|
+
throw new Error(
|
|
146
|
+
`Feature flag ${name} must be set to true or false`,
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
featureFlagValue = val;
|
|
150
|
+
}
|
|
151
|
+
previousValue[name] = featureFlagValue ?? String(val);
|
|
152
|
+
} else {
|
|
153
|
+
INTERNAL_ORIGINAL_CONSOLE.warn(
|
|
154
|
+
`Unknown feature flag ${name} specified, it will be ignored`,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
return previousValue;
|
|
158
|
+
},
|
|
159
|
+
{},
|
|
160
|
+
],
|
|
106
161
|
};
|
|
107
162
|
|
|
108
163
|
var hmrOptions = {
|
|
@@ -472,10 +527,13 @@ async function normalizeOptions(
|
|
|
472
527
|
if (typeof input !== 'string') return [];
|
|
473
528
|
return input.split(',').map(value => value.trim());
|
|
474
529
|
};
|
|
530
|
+
|
|
475
531
|
return {
|
|
476
532
|
shouldDisableCache: command.cache === false,
|
|
477
533
|
cacheDir: command.cacheDir,
|
|
478
534
|
watchDir: command.watchDir,
|
|
535
|
+
watchBackend: command.watchBackend,
|
|
536
|
+
watchIgnore: command.watchIgnore,
|
|
479
537
|
config: command.config,
|
|
480
538
|
mode,
|
|
481
539
|
hmrOptions,
|
|
@@ -509,5 +567,6 @@ async function normalizeOptions(
|
|
|
509
567
|
publicUrl: command.publicUrl,
|
|
510
568
|
distDir: command.distDir,
|
|
511
569
|
},
|
|
570
|
+
featureFlags: command.featureFlag,
|
|
512
571
|
};
|
|
513
572
|
}
|