parcel 2.0.0-beta.3.1 → 2.0.0-dev.1513
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/README.md +36 -1510
- package/lib/cli.js +80 -144
- package/package.json +16 -15
- package/src/bin.js +4 -1
- package/src/cli.js +64 -38
package/lib/cli.js
CHANGED
|
@@ -2,147 +2,115 @@
|
|
|
2
2
|
|
|
3
3
|
function _core() {
|
|
4
4
|
const data = require("@parcel/core");
|
|
5
|
-
|
|
6
5
|
_core = function () {
|
|
7
6
|
return data;
|
|
8
7
|
};
|
|
9
|
-
|
|
10
8
|
return data;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
10
|
function _fs() {
|
|
14
11
|
const data = require("@parcel/fs");
|
|
15
|
-
|
|
16
12
|
_fs = function () {
|
|
17
13
|
return data;
|
|
18
14
|
};
|
|
19
|
-
|
|
20
15
|
return data;
|
|
21
16
|
}
|
|
22
|
-
|
|
23
17
|
function _diagnostic() {
|
|
24
18
|
const data = _interopRequireDefault(require("@parcel/diagnostic"));
|
|
25
|
-
|
|
26
19
|
_diagnostic = function () {
|
|
27
20
|
return data;
|
|
28
21
|
};
|
|
29
|
-
|
|
30
22
|
return data;
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
function _utils() {
|
|
34
25
|
const data = require("@parcel/utils");
|
|
35
|
-
|
|
36
26
|
_utils = function () {
|
|
37
27
|
return data;
|
|
38
28
|
};
|
|
39
|
-
|
|
40
29
|
return data;
|
|
41
30
|
}
|
|
42
|
-
|
|
43
31
|
function _events() {
|
|
44
32
|
const data = require("@parcel/events");
|
|
45
|
-
|
|
46
33
|
_events = function () {
|
|
47
34
|
return data;
|
|
48
35
|
};
|
|
49
|
-
|
|
50
36
|
return data;
|
|
51
37
|
}
|
|
52
|
-
|
|
53
38
|
function _logger() {
|
|
54
39
|
const data = require("@parcel/logger");
|
|
55
|
-
|
|
56
40
|
_logger = function () {
|
|
57
41
|
return data;
|
|
58
42
|
};
|
|
59
|
-
|
|
60
43
|
return data;
|
|
61
44
|
}
|
|
62
|
-
|
|
63
45
|
function _chalk() {
|
|
64
46
|
const data = _interopRequireDefault(require("chalk"));
|
|
65
|
-
|
|
66
47
|
_chalk = function () {
|
|
67
48
|
return data;
|
|
68
49
|
};
|
|
69
|
-
|
|
70
50
|
return data;
|
|
71
51
|
}
|
|
72
|
-
|
|
73
52
|
function _commander() {
|
|
74
53
|
const data = _interopRequireDefault(require("commander"));
|
|
75
|
-
|
|
76
54
|
_commander = function () {
|
|
77
55
|
return data;
|
|
78
56
|
};
|
|
79
|
-
|
|
80
57
|
return data;
|
|
81
58
|
}
|
|
82
|
-
|
|
83
59
|
function _path() {
|
|
84
60
|
const data = _interopRequireDefault(require("path"));
|
|
85
|
-
|
|
86
61
|
_path = function () {
|
|
87
62
|
return data;
|
|
88
63
|
};
|
|
89
|
-
|
|
90
64
|
return data;
|
|
91
65
|
}
|
|
92
|
-
|
|
93
66
|
function _getPort() {
|
|
94
67
|
const data = _interopRequireDefault(require("get-port"));
|
|
95
|
-
|
|
96
68
|
_getPort = function () {
|
|
97
69
|
return data;
|
|
98
70
|
};
|
|
99
|
-
|
|
100
|
-
return data;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function _package() {
|
|
104
|
-
const data = require("../package.json");
|
|
105
|
-
|
|
106
|
-
_package = function () {
|
|
107
|
-
return data;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
71
|
return data;
|
|
111
72
|
}
|
|
112
|
-
|
|
73
|
+
var _package = require("../package.json");
|
|
113
74
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
75
|
+
const program = new (_commander().default.Command)();
|
|
114
76
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const program = new (_commander().default.Command)(); // Exit codes in response to signals are traditionally
|
|
77
|
+
// Exit codes in response to signals are traditionally
|
|
118
78
|
// 128 + signal value
|
|
119
79
|
// https://tldp.org/LDP/abs/html/exitcodes.html
|
|
120
|
-
|
|
121
80
|
const SIGINT_EXIT_CODE = 130;
|
|
122
|
-
|
|
123
81
|
async function logUncaughtError(e) {
|
|
124
82
|
if (e instanceof _diagnostic().default) {
|
|
125
83
|
for (let diagnostic of e.diagnostics) {
|
|
126
|
-
let
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
_logger().INTERNAL_ORIGINAL_CONSOLE.error(
|
|
84
|
+
let {
|
|
85
|
+
message,
|
|
86
|
+
codeframe,
|
|
87
|
+
stack,
|
|
88
|
+
hints,
|
|
89
|
+
documentation
|
|
90
|
+
} = await (0, _utils().prettyDiagnostic)(diagnostic);
|
|
91
|
+
_logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.red(message));
|
|
92
|
+
if (codeframe || stack) {
|
|
93
|
+
_logger().INTERNAL_ORIGINAL_CONSOLE.error('');
|
|
94
|
+
}
|
|
95
|
+
_logger().INTERNAL_ORIGINAL_CONSOLE.error(codeframe);
|
|
96
|
+
_logger().INTERNAL_ORIGINAL_CONSOLE.error(stack);
|
|
97
|
+
if ((stack || codeframe) && hints.length > 0) {
|
|
98
|
+
_logger().INTERNAL_ORIGINAL_CONSOLE.error('');
|
|
99
|
+
}
|
|
100
|
+
for (let h of hints) {
|
|
101
|
+
_logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.blue(h));
|
|
102
|
+
}
|
|
103
|
+
if (documentation) {
|
|
104
|
+
_logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.magenta.bold(documentation));
|
|
136
105
|
}
|
|
137
106
|
}
|
|
138
107
|
} else {
|
|
139
108
|
_logger().INTERNAL_ORIGINAL_CONSOLE.error(e);
|
|
140
|
-
}
|
|
141
|
-
|
|
109
|
+
}
|
|
142
110
|
|
|
111
|
+
// A hack to definitely ensure we logged the uncaught exception
|
|
143
112
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
144
113
|
}
|
|
145
|
-
|
|
146
114
|
const handleUncaughtException = async exception => {
|
|
147
115
|
try {
|
|
148
116
|
await logUncaughtError(exception);
|
|
@@ -150,25 +118,27 @@ const handleUncaughtException = async exception => {
|
|
|
150
118
|
console.error(exception);
|
|
151
119
|
console.error(err);
|
|
152
120
|
}
|
|
153
|
-
|
|
154
121
|
process.exit(1);
|
|
155
122
|
};
|
|
156
|
-
|
|
157
123
|
process.on('unhandledRejection', handleUncaughtException);
|
|
158
124
|
program.storeOptionsAsProperties();
|
|
159
|
-
program.version(_package
|
|
125
|
+
program.version(_package.version);
|
|
126
|
+
|
|
127
|
+
// --no-cache, --cache-dir, --no-source-maps, --no-autoinstall, --global?, --public-url, --log-level
|
|
160
128
|
// --no-content-hash, --experimental-scope-hoisting, --detailed-report
|
|
161
129
|
|
|
162
130
|
const commonOptions = {
|
|
163
131
|
'--no-cache': 'disable the filesystem cache',
|
|
164
132
|
'--config <path>': 'specify which config to use. can be a path or a package name',
|
|
165
133
|
'--cache-dir <path>': 'set the cache directory. defaults to ".parcel-cache"',
|
|
134
|
+
'--watch-dir <path>': 'set the root watch directory. defaults to nearest lockfile or source control dir.',
|
|
166
135
|
'--no-source-maps': 'disable sourcemaps',
|
|
167
136
|
'--target [name]': ['only build given target(s)', (val, list) => list.concat([val]), []],
|
|
168
137
|
'--log-level <level>': new (_commander().default.Option)('--log-level <level>', 'set the log level').choices(['none', 'error', 'warn', 'info', 'verbose']),
|
|
169
138
|
'--dist-dir <dir>': 'output directory to write to when unspecified by targets',
|
|
170
139
|
'--no-autoinstall': 'disable autoinstall',
|
|
171
|
-
'--profile': 'enable build profiling',
|
|
140
|
+
'--profile': 'enable sampling build profiling',
|
|
141
|
+
'--trace': 'enable build tracing',
|
|
172
142
|
'-V, --version': 'output the version number',
|
|
173
143
|
'--detailed-report [count]': ['print the asset timings and sizes in the build report', parseOptionInt],
|
|
174
144
|
'--reporter <name>': ['additional reporters to run', (val, acc) => {
|
|
@@ -183,13 +153,12 @@ var hmrOptions = {
|
|
|
183
153
|
'--https': 'serves files over HTTPS',
|
|
184
154
|
'--cert <path>': 'path to certificate to use with HTTPS',
|
|
185
155
|
'--key <path>': 'path to private key to use with HTTPS',
|
|
186
|
-
'--hmr-port <port>': ['hot module replacement port', process.env.HMR_PORT]
|
|
156
|
+
'--hmr-port <port>': ['hot module replacement port', process.env.HMR_PORT],
|
|
157
|
+
'--hmr-host <host>': ['hot module replacement host', process.env.HMR_HOST]
|
|
187
158
|
};
|
|
188
|
-
|
|
189
159
|
function applyOptions(cmd, options) {
|
|
190
160
|
for (let opt in options) {
|
|
191
161
|
const option = options[opt];
|
|
192
|
-
|
|
193
162
|
if (option instanceof _commander().default.Option) {
|
|
194
163
|
cmd.addOption(option);
|
|
195
164
|
} else {
|
|
@@ -197,8 +166,7 @@ function applyOptions(cmd, options) {
|
|
|
197
166
|
}
|
|
198
167
|
}
|
|
199
168
|
}
|
|
200
|
-
|
|
201
|
-
let serve = program.command('serve [input...]').description('starts a development server').option('--public-url <url>', 'the path prefix for absolute urls').option('--open [browser]', 'automatically open in specified browser, defaults to default browser').option('--watch-for-stdin', 'exit when stdin closes').option('--lazy', 'Build async bundles on demand, when requested in the browser').action(runCommand);
|
|
169
|
+
let serve = program.command('serve [input...]').description('starts a development server').option('--public-url <url>', 'the path prefix for absolute urls').option('--open [browser]', 'automatically open in specified browser, defaults to default browser').option('--watch-for-stdin', 'exit when stdin closes').option('--lazy [includes]', 'Build async bundles on demand, when requested in the browser. Defaults to all async bundles, unless a comma separated list of source file globs is provided. Only async bundles whose entry points match these globs will be built lazily').option('--lazy-exclude <excludes>', 'Can only be used in combination with --lazy. Comma separated list of source file globs, async bundles whose entry points match these globs will not be built lazily').action(runCommand);
|
|
202
170
|
applyOptions(serve, hmrOptions);
|
|
203
171
|
applyOptions(serve, commonOptions);
|
|
204
172
|
let watch = program.command('watch [input...]').description('starts the bundler in watch mode').option('--public-url <url>', 'the path prefix for absolute urls').option('--no-content-hash', 'disable content hashing').option('--watch-for-stdin', 'exit when stdin closes').action(runCommand);
|
|
@@ -212,97 +180,75 @@ program.command('help [command]').description('display help information for a co
|
|
|
212
180
|
});
|
|
213
181
|
program.on('--help', function () {
|
|
214
182
|
_logger().INTERNAL_ORIGINAL_CONSOLE.log('');
|
|
215
|
-
|
|
216
183
|
_logger().INTERNAL_ORIGINAL_CONSOLE.log(' Run `' + _chalk().default.bold('parcel help <command>') + '` for more information on specific commands');
|
|
217
|
-
|
|
218
184
|
_logger().INTERNAL_ORIGINAL_CONSOLE.log('');
|
|
219
|
-
});
|
|
185
|
+
});
|
|
220
186
|
|
|
187
|
+
// Override to output option description if argument was missing
|
|
188
|
+
// $FlowFixMe[prop-missing]
|
|
221
189
|
_commander().default.Command.prototype.optionMissingArgument = function (option) {
|
|
222
190
|
_logger().INTERNAL_ORIGINAL_CONSOLE.error("error: option `%s' argument missing", option.flags);
|
|
223
|
-
|
|
224
191
|
_logger().INTERNAL_ORIGINAL_CONSOLE.log(program.createHelp().optionDescription(option));
|
|
225
|
-
|
|
226
192
|
process.exit(1);
|
|
227
|
-
};
|
|
228
|
-
|
|
193
|
+
};
|
|
229
194
|
|
|
195
|
+
// Make serve the default command except for --help
|
|
230
196
|
var args = process.argv;
|
|
231
197
|
if (args[2] === '--help' || args[2] === '-h') args[2] = 'help';
|
|
232
|
-
|
|
233
198
|
if (!args[2] || !program.commands.some(c => c.name() === args[2])) {
|
|
234
199
|
args.splice(2, 0, 'serve');
|
|
235
200
|
}
|
|
236
|
-
|
|
237
201
|
program.parse(args);
|
|
238
|
-
|
|
239
202
|
function runCommand(...args) {
|
|
240
203
|
run(...args).catch(handleUncaughtException);
|
|
241
204
|
}
|
|
242
|
-
|
|
243
|
-
|
|
205
|
+
async function run(entries, _opts,
|
|
206
|
+
// using pre v7 Commander options as properties
|
|
244
207
|
command) {
|
|
245
|
-
entries = entries.map(entry => _path().default.resolve(entry));
|
|
246
|
-
|
|
247
208
|
if (entries.length === 0) {
|
|
248
|
-
|
|
249
|
-
_logger().INTERNAL_ORIGINAL_CONSOLE.log('No entries found');
|
|
250
|
-
|
|
251
|
-
return;
|
|
209
|
+
entries = ['.'];
|
|
252
210
|
}
|
|
253
|
-
|
|
211
|
+
entries = entries.map(entry => _path().default.resolve(entry));
|
|
254
212
|
let Parcel = require('@parcel/core').default;
|
|
255
|
-
|
|
256
213
|
let fs = new (_fs().NodeFS)();
|
|
257
214
|
let options = await normalizeOptions(command, fs);
|
|
258
215
|
let parcel = new Parcel({
|
|
259
216
|
entries,
|
|
260
|
-
// $FlowFixMe[extra-arg] - flow doesn't know about the `paths` option (added in Node v8.9.0)
|
|
261
217
|
defaultConfig: require.resolve('@parcel/config-default', {
|
|
262
218
|
paths: [fs.cwd(), __dirname]
|
|
263
219
|
}),
|
|
264
|
-
shouldPatchConsole:
|
|
220
|
+
shouldPatchConsole: false,
|
|
265
221
|
...options
|
|
266
222
|
});
|
|
267
223
|
let disposable = new (_events().Disposable)();
|
|
268
224
|
let unsubscribe;
|
|
269
225
|
let isExiting;
|
|
270
|
-
|
|
271
226
|
async function exit(exitCode = 0) {
|
|
272
227
|
if (isExiting) {
|
|
273
228
|
return;
|
|
274
229
|
}
|
|
275
|
-
|
|
276
230
|
isExiting = true;
|
|
277
|
-
|
|
278
231
|
if (unsubscribe != null) {
|
|
279
232
|
await unsubscribe();
|
|
280
233
|
} else if (parcel.isProfiling) {
|
|
281
234
|
await parcel.stopProfiling();
|
|
282
235
|
}
|
|
283
|
-
|
|
284
236
|
if (process.stdin.isTTY && process.stdin.isRaw) {
|
|
285
237
|
// $FlowFixMe
|
|
286
238
|
process.stdin.setRawMode(false);
|
|
287
239
|
}
|
|
288
|
-
|
|
289
240
|
disposable.dispose();
|
|
290
241
|
process.exit(exitCode);
|
|
291
242
|
}
|
|
292
|
-
|
|
293
243
|
const isWatching = command.name() === 'watch' || command.name() === 'serve';
|
|
294
|
-
|
|
295
244
|
if (process.stdin.isTTY) {
|
|
296
245
|
// $FlowFixMe
|
|
297
246
|
process.stdin.setRawMode(true);
|
|
298
|
-
|
|
299
247
|
require('readline').emitKeypressEvents(process.stdin);
|
|
300
|
-
|
|
301
248
|
let stream = process.stdin.on('keypress', async (char, key) => {
|
|
302
249
|
if (!key.ctrl) {
|
|
303
250
|
return;
|
|
304
251
|
}
|
|
305
|
-
|
|
306
252
|
switch (key.name) {
|
|
307
253
|
case 'c':
|
|
308
254
|
// Detect the ctrl+c key, and gracefully exit after writing the asset graph to the cache.
|
|
@@ -314,18 +260,14 @@ command) {
|
|
|
314
260
|
// We don't use the SIGINT event for this because when run inside yarn, the parent
|
|
315
261
|
// yarn process ends before Parcel and it appears that Parcel has ended while it may still
|
|
316
262
|
// be cleaning up. Handling events from stdin prevents this impression.
|
|
317
|
-
//
|
|
318
|
-
//
|
|
319
|
-
setTimeout(() => _logger().INTERNAL_ORIGINAL_CONSOLE.log(_chalk().default.bold.yellowBright('Parcel is shutting down...')), 500); // When watching, a 0 success code is acceptable when Parcel is interrupted with ctrl-c.
|
|
263
|
+
//
|
|
264
|
+
// When watching, a 0 success code is acceptable when Parcel is interrupted with ctrl-c.
|
|
320
265
|
// When building, fail with a code as if we received a SIGINT.
|
|
321
|
-
|
|
322
266
|
await exit(isWatching ? 0 : SIGINT_EXIT_CODE);
|
|
323
267
|
break;
|
|
324
|
-
|
|
325
268
|
case 'e':
|
|
326
269
|
await (parcel.isProfiling ? parcel.stopProfiling() : parcel.startProfiling());
|
|
327
270
|
break;
|
|
328
|
-
|
|
329
271
|
case 'y':
|
|
330
272
|
await parcel.takeHeapSnapshot();
|
|
331
273
|
break;
|
|
@@ -335,7 +277,6 @@ command) {
|
|
|
335
277
|
stream.destroy();
|
|
336
278
|
});
|
|
337
279
|
}
|
|
338
|
-
|
|
339
280
|
if (isWatching) {
|
|
340
281
|
({
|
|
341
282
|
unsubscribe
|
|
@@ -344,24 +285,21 @@ command) {
|
|
|
344
285
|
throw err;
|
|
345
286
|
}
|
|
346
287
|
}));
|
|
347
|
-
|
|
348
288
|
if (command.open && options.serveOptions) {
|
|
349
289
|
await (0, _utils().openInBrowser)(`${options.serveOptions.https ? 'https' : 'http'}://${options.serveOptions.host || 'localhost'}:${options.serveOptions.port}`, command.open);
|
|
350
290
|
}
|
|
351
|
-
|
|
352
291
|
if (command.watchForStdin) {
|
|
353
292
|
process.stdin.on('end', async () => {
|
|
354
293
|
_logger().INTERNAL_ORIGINAL_CONSOLE.log('STDIN closed, ending');
|
|
355
|
-
|
|
356
294
|
await exit();
|
|
357
295
|
});
|
|
358
296
|
process.stdin.resume();
|
|
359
|
-
}
|
|
360
|
-
// a 0 success code is acceptable.
|
|
361
|
-
|
|
297
|
+
}
|
|
362
298
|
|
|
363
|
-
|
|
364
|
-
|
|
299
|
+
// In non-tty cases, respond to SIGINT by cleaning up. Since we're watching,
|
|
300
|
+
// a 0 success code is acceptable.
|
|
301
|
+
process.on('SIGINT', () => exit());
|
|
302
|
+
process.on('SIGTERM', () => exit());
|
|
365
303
|
} else {
|
|
366
304
|
try {
|
|
367
305
|
await parcel.run();
|
|
@@ -371,67 +309,56 @@ command) {
|
|
|
371
309
|
if (!(err instanceof _core().BuildError)) {
|
|
372
310
|
await logUncaughtError(err);
|
|
373
311
|
}
|
|
374
|
-
|
|
375
312
|
await exit(1);
|
|
376
313
|
}
|
|
377
|
-
|
|
378
314
|
await exit();
|
|
379
315
|
}
|
|
380
316
|
}
|
|
381
|
-
|
|
382
317
|
function parsePort(portValue) {
|
|
383
|
-
let parsedPort = Number(portValue);
|
|
318
|
+
let parsedPort = Number(portValue);
|
|
384
319
|
|
|
320
|
+
// Throw an error if port value is invalid...
|
|
385
321
|
if (!Number.isInteger(parsedPort)) {
|
|
386
322
|
throw new Error(`Port ${portValue} is not a valid integer.`);
|
|
387
323
|
}
|
|
388
|
-
|
|
389
324
|
return parsedPort;
|
|
390
325
|
}
|
|
391
|
-
|
|
392
326
|
function parseOptionInt(value) {
|
|
393
327
|
const parsedValue = parseInt(value, 10);
|
|
394
|
-
|
|
395
328
|
if (isNaN(parsedValue)) {
|
|
396
329
|
throw new (_commander().default.InvalidOptionArgumentError)('Must be an integer.');
|
|
397
330
|
}
|
|
398
|
-
|
|
399
331
|
return parsedValue;
|
|
400
332
|
}
|
|
401
|
-
|
|
402
333
|
async function normalizeOptions(command, inputFS) {
|
|
403
334
|
var _command$autoinstall, _command$sourceMaps;
|
|
404
|
-
|
|
405
335
|
let nodeEnv;
|
|
406
|
-
|
|
407
336
|
if (command.name() === 'build') {
|
|
408
|
-
nodeEnv = process.env.NODE_ENV || 'production';
|
|
409
|
-
|
|
337
|
+
nodeEnv = process.env.NODE_ENV || 'production';
|
|
338
|
+
// Autoinstall unless explicitly disabled or we detect a CI environment.
|
|
410
339
|
command.autoinstall = !(command.autoinstall === false || process.env.CI);
|
|
411
340
|
} else {
|
|
412
341
|
nodeEnv = process.env.NODE_ENV || 'development';
|
|
413
|
-
}
|
|
414
|
-
// available in JS configs and plugins.
|
|
415
|
-
|
|
342
|
+
}
|
|
416
343
|
|
|
344
|
+
// Set process.env.NODE_ENV to a default if undefined so that it is
|
|
345
|
+
// available in JS configs and plugins.
|
|
417
346
|
process.env.NODE_ENV = nodeEnv;
|
|
418
347
|
let https = !!command.https;
|
|
419
|
-
|
|
420
348
|
if (command.cert && command.key) {
|
|
421
349
|
https = {
|
|
422
350
|
cert: command.cert,
|
|
423
351
|
key: command.key
|
|
424
352
|
};
|
|
425
353
|
}
|
|
426
|
-
|
|
427
354
|
let serveOptions = false;
|
|
428
355
|
let {
|
|
429
356
|
host
|
|
430
|
-
} = command;
|
|
357
|
+
} = command;
|
|
431
358
|
|
|
359
|
+
// Ensure port is valid and available
|
|
432
360
|
let port = parsePort(command.port || '1234');
|
|
433
361
|
let originalPort = port;
|
|
434
|
-
|
|
435
362
|
if (command.name() === 'serve' || command.hmr) {
|
|
436
363
|
try {
|
|
437
364
|
port = await (0, _getPort().default)({
|
|
@@ -443,15 +370,12 @@ async function normalizeOptions(command, inputFS) {
|
|
|
443
370
|
diagnostic: {
|
|
444
371
|
message: `Could not get available port: ${err.message}`,
|
|
445
372
|
origin: 'parcel',
|
|
446
|
-
filePath: __filename,
|
|
447
373
|
stack: err.stack
|
|
448
374
|
}
|
|
449
375
|
});
|
|
450
376
|
}
|
|
451
|
-
|
|
452
377
|
if (port !== originalPort) {
|
|
453
378
|
let errorMessage = `Port "${originalPort}" could not be used`;
|
|
454
|
-
|
|
455
379
|
if (command.port != null) {
|
|
456
380
|
// Throw the error if the user defined a custom port
|
|
457
381
|
throw new Error(errorMessage);
|
|
@@ -461,7 +385,6 @@ async function normalizeOptions(command, inputFS) {
|
|
|
461
385
|
}
|
|
462
386
|
}
|
|
463
387
|
}
|
|
464
|
-
|
|
465
388
|
if (command.name() === 'serve') {
|
|
466
389
|
let {
|
|
467
390
|
publicUrl
|
|
@@ -473,21 +396,18 @@ async function normalizeOptions(command, inputFS) {
|
|
|
473
396
|
publicUrl
|
|
474
397
|
};
|
|
475
398
|
}
|
|
476
|
-
|
|
477
399
|
let hmrOptions = null;
|
|
478
|
-
|
|
479
400
|
if (command.name() !== 'build' && command.hmr !== false) {
|
|
480
401
|
let hmrport = command.hmrPort ? parsePort(command.hmrPort) : port;
|
|
402
|
+
let hmrhost = command.hmrHost ? command.hmrHost : host;
|
|
481
403
|
hmrOptions = {
|
|
482
404
|
port: hmrport,
|
|
483
|
-
host
|
|
405
|
+
host: hmrhost
|
|
484
406
|
};
|
|
485
407
|
}
|
|
486
|
-
|
|
487
408
|
if (command.detailedReport === true) {
|
|
488
409
|
command.detailedReport = '10';
|
|
489
410
|
}
|
|
490
|
-
|
|
491
411
|
let additionalReporters = [{
|
|
492
412
|
packageName: '@parcel/reporter-cli',
|
|
493
413
|
resolveFrom: __filename
|
|
@@ -495,10 +415,22 @@ async function normalizeOptions(command, inputFS) {
|
|
|
495
415
|
packageName,
|
|
496
416
|
resolveFrom: _path().default.join(inputFS.cwd(), 'index')
|
|
497
417
|
}))];
|
|
418
|
+
if (command.trace) {
|
|
419
|
+
additionalReporters.unshift({
|
|
420
|
+
packageName: '@parcel/reporter-tracer',
|
|
421
|
+
resolveFrom: __filename
|
|
422
|
+
});
|
|
423
|
+
}
|
|
498
424
|
let mode = command.name() === 'build' ? 'production' : 'development';
|
|
425
|
+
const normalizeIncludeExcludeList = input => {
|
|
426
|
+
if (typeof input !== 'string') return [];
|
|
427
|
+
return input.split(',').map(value => value.trim());
|
|
428
|
+
};
|
|
499
429
|
return {
|
|
500
430
|
shouldDisableCache: command.cache === false,
|
|
501
431
|
cacheDir: command.cacheDir,
|
|
432
|
+
watchDir: command.watchDir,
|
|
433
|
+
config: command.config,
|
|
502
434
|
mode,
|
|
503
435
|
hmrOptions,
|
|
504
436
|
shouldContentHash: hmrOptions ? false : command.contentHash,
|
|
@@ -507,7 +439,11 @@ async function normalizeOptions(command, inputFS) {
|
|
|
507
439
|
shouldAutoInstall: (_command$autoinstall = command.autoinstall) !== null && _command$autoinstall !== void 0 ? _command$autoinstall : true,
|
|
508
440
|
logLevel: command.logLevel,
|
|
509
441
|
shouldProfile: command.profile,
|
|
510
|
-
|
|
442
|
+
shouldTrace: command.trace,
|
|
443
|
+
shouldBuildLazily: typeof command.lazy !== 'undefined',
|
|
444
|
+
lazyIncludes: normalizeIncludeExcludeList(command.lazy),
|
|
445
|
+
lazyExcludes: normalizeIncludeExcludeList(command.lazyExclude),
|
|
446
|
+
shouldBundleIncrementally: process.env.PARCEL_INCREMENTAL_BUNDLING === 'false' ? false : true,
|
|
511
447
|
detailedReport: command.detailedReport != null ? {
|
|
512
448
|
assetsPerBundle: parseInt(command.detailedReport, 10)
|
|
513
449
|
} : null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parcel",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-dev.1513+9d5643b9b",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -21,23 +21,24 @@
|
|
|
21
21
|
"node": ">= 12.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@parcel/config-default": "2.0.0-
|
|
25
|
-
"@parcel/core": "2.0.0-
|
|
26
|
-
"@parcel/diagnostic": "2.0.0-
|
|
27
|
-
"@parcel/events": "2.0.0-
|
|
28
|
-
"@parcel/fs": "2.0.0-
|
|
29
|
-
"@parcel/logger": "2.0.0-
|
|
30
|
-
"@parcel/package-manager": "2.0.0-
|
|
31
|
-
"@parcel/reporter-cli": "2.0.0-
|
|
32
|
-
"@parcel/reporter-dev-server": "2.0.0-
|
|
33
|
-
"@parcel/
|
|
24
|
+
"@parcel/config-default": "2.0.0-dev.1515+9d5643b9b",
|
|
25
|
+
"@parcel/core": "2.0.0-dev.1513+9d5643b9b",
|
|
26
|
+
"@parcel/diagnostic": "2.0.0-dev.1515+9d5643b9b",
|
|
27
|
+
"@parcel/events": "2.0.0-dev.1515+9d5643b9b",
|
|
28
|
+
"@parcel/fs": "2.0.0-dev.1515+9d5643b9b",
|
|
29
|
+
"@parcel/logger": "2.0.0-dev.1515+9d5643b9b",
|
|
30
|
+
"@parcel/package-manager": "2.0.0-dev.1515+9d5643b9b",
|
|
31
|
+
"@parcel/reporter-cli": "2.0.0-dev.1515+9d5643b9b",
|
|
32
|
+
"@parcel/reporter-dev-server": "2.0.0-dev.1515+9d5643b9b",
|
|
33
|
+
"@parcel/reporter-tracer": "2.12.1-dev.3138+9d5643b9b",
|
|
34
|
+
"@parcel/utils": "2.0.0-dev.1515+9d5643b9b",
|
|
34
35
|
"chalk": "^4.1.0",
|
|
35
36
|
"commander": "^7.0.0",
|
|
36
|
-
"get-port": "^4.2.0"
|
|
37
|
-
"v8-compile-cache": "^2.0.0"
|
|
37
|
+
"get-port": "^4.2.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@
|
|
40
|
+
"@babel/core": "^7.22.11",
|
|
41
|
+
"@parcel/babel-register": "2.12.0"
|
|
41
42
|
},
|
|
42
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "9d5643b9b5ba1a6ff638b4ae32024222e46b8133"
|
|
43
44
|
}
|