parcel 2.9.3 → 2.10.1
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 +1 -1
- package/lib/cli.js +10 -5
- package/package.json +15 -15
- package/src/cli.js +16 -6
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Parcel is a zero configuration build tool for the web. It combines a great out-o
|
|
|
16
16
|
## Features
|
|
17
17
|
|
|
18
18
|
- 😍 **Zero config** – Parcel supports many languages and file types out of the box, from web technologies like HTML, CSS, and JavaScript, to assets like images, fonts, videos, and more. It has a built-in dev server with hot reloading, beautiful error diagnostics, and much more. No configuration needed!
|
|
19
|
-
- ⚡️ **
|
|
19
|
+
- ⚡️ **Lightning fast** – Parcel's JavaScript compiler is written in Rust for native performance. Your code is built in parallel using worker threads, utilizing all of the cores on your machine. Everything is cached, so you never build the same code twice. It's like using watch mode, but even when you restart Parcel!
|
|
20
20
|
- 🚀 **Automatic production optimization** – Parcel optimizes your whole app for production automatically. This includes tree-shaking and minifying your JavaScript, CSS, and HTML, resizing and optimizing images, content hashing, automatic code splitting, and much more.
|
|
21
21
|
- 🎯 **Ship for any target** – Parcel automatically transforms your code for your target environments. From modern and legacy browser support, to zero config JSX and TypeScript compilation, Parcel makes it easy to build for any target – or many!
|
|
22
22
|
- 🌍 **Scalable** – Parcel requires zero configuration to get started. But as your application grows and your build requirements become more complex, it's possible to extend Parcel in just about every way. A simple configuration format and powerful plugin system that's designed from the ground up for performance means Parcel can support projects of any size.
|
package/lib/cli.js
CHANGED
|
@@ -165,7 +165,7 @@ function applyOptions(cmd, options) {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
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);
|
|
168
|
+
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);
|
|
169
169
|
applyOptions(serve, hmrOptions);
|
|
170
170
|
applyOptions(serve, commonOptions);
|
|
171
171
|
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);
|
|
@@ -213,7 +213,6 @@ command) {
|
|
|
213
213
|
let options = await normalizeOptions(command, fs);
|
|
214
214
|
let parcel = new Parcel({
|
|
215
215
|
entries,
|
|
216
|
-
// $FlowFixMe[extra-arg] - flow doesn't know about the `paths` option (added in Node v8.9.0)
|
|
217
216
|
defaultConfig: require.resolve('@parcel/config-default', {
|
|
218
217
|
paths: [fs.cwd(), __dirname]
|
|
219
218
|
}),
|
|
@@ -301,8 +300,8 @@ command) {
|
|
|
301
300
|
|
|
302
301
|
// In non-tty cases, respond to SIGINT by cleaning up. Since we're watching,
|
|
303
302
|
// a 0 success code is acceptable.
|
|
304
|
-
process.on('SIGINT', exit);
|
|
305
|
-
process.on('SIGTERM', exit);
|
|
303
|
+
process.on('SIGINT', () => exit());
|
|
304
|
+
process.on('SIGTERM', () => exit());
|
|
306
305
|
} else {
|
|
307
306
|
try {
|
|
308
307
|
await parcel.run();
|
|
@@ -425,6 +424,10 @@ async function normalizeOptions(command, inputFS) {
|
|
|
425
424
|
});
|
|
426
425
|
}
|
|
427
426
|
let mode = command.name() === 'build' ? 'production' : 'development';
|
|
427
|
+
const normalizeIncludeExcludeList = input => {
|
|
428
|
+
if (typeof input !== 'string') return [];
|
|
429
|
+
return input.split(',').map(value => value.trim());
|
|
430
|
+
};
|
|
428
431
|
return {
|
|
429
432
|
shouldDisableCache: command.cache === false,
|
|
430
433
|
cacheDir: command.cacheDir,
|
|
@@ -438,7 +441,9 @@ async function normalizeOptions(command, inputFS) {
|
|
|
438
441
|
logLevel: command.logLevel,
|
|
439
442
|
shouldProfile: command.profile,
|
|
440
443
|
shouldTrace: command.trace,
|
|
441
|
-
shouldBuildLazily: command.lazy,
|
|
444
|
+
shouldBuildLazily: typeof command.lazy !== 'undefined',
|
|
445
|
+
lazyIncludes: normalizeIncludeExcludeList(command.lazy),
|
|
446
|
+
lazyExcludes: normalizeIncludeExcludeList(command.lazyExclude),
|
|
442
447
|
shouldBundleIncrementally: process.env.PARCEL_INCREMENTAL_BUNDLING === 'false' ? false : true,
|
|
443
448
|
detailedReport: command.detailedReport != null ? {
|
|
444
449
|
assetsPerBundle: parseInt(command.detailedReport, 10)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parcel",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -21,24 +21,24 @@
|
|
|
21
21
|
"node": ">= 12.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@parcel/config-default": "2.
|
|
25
|
-
"@parcel/core": "2.
|
|
26
|
-
"@parcel/diagnostic": "2.
|
|
27
|
-
"@parcel/events": "2.
|
|
28
|
-
"@parcel/fs": "2.
|
|
29
|
-
"@parcel/logger": "2.
|
|
30
|
-
"@parcel/package-manager": "2.
|
|
31
|
-
"@parcel/reporter-cli": "2.
|
|
32
|
-
"@parcel/reporter-dev-server": "2.
|
|
33
|
-
"@parcel/reporter-tracer": "2.
|
|
34
|
-
"@parcel/utils": "2.
|
|
24
|
+
"@parcel/config-default": "2.10.1",
|
|
25
|
+
"@parcel/core": "2.10.1",
|
|
26
|
+
"@parcel/diagnostic": "2.10.1",
|
|
27
|
+
"@parcel/events": "2.10.1",
|
|
28
|
+
"@parcel/fs": "2.10.1",
|
|
29
|
+
"@parcel/logger": "2.10.1",
|
|
30
|
+
"@parcel/package-manager": "2.10.1",
|
|
31
|
+
"@parcel/reporter-cli": "2.10.1",
|
|
32
|
+
"@parcel/reporter-dev-server": "2.10.1",
|
|
33
|
+
"@parcel/reporter-tracer": "2.10.1",
|
|
34
|
+
"@parcel/utils": "2.10.1",
|
|
35
35
|
"chalk": "^4.1.0",
|
|
36
36
|
"commander": "^7.0.0",
|
|
37
37
|
"get-port": "^4.2.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@babel/core": "^7.
|
|
41
|
-
"@parcel/babel-register": "2.
|
|
40
|
+
"@babel/core": "^7.22.11",
|
|
41
|
+
"@parcel/babel-register": "2.10.1"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "bba0417f68159b1f71c747cfd06fa3fe2dd374b5"
|
|
44
44
|
}
|
package/src/cli.js
CHANGED
|
@@ -139,8 +139,12 @@ let serve = program
|
|
|
139
139
|
)
|
|
140
140
|
.option('--watch-for-stdin', 'exit when stdin closes')
|
|
141
141
|
.option(
|
|
142
|
-
'--lazy',
|
|
143
|
-
'Build async bundles on demand, when requested in the browser',
|
|
142
|
+
'--lazy [includes]',
|
|
143
|
+
'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',
|
|
144
|
+
)
|
|
145
|
+
.option(
|
|
146
|
+
'--lazy-exclude <excludes>',
|
|
147
|
+
'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',
|
|
144
148
|
)
|
|
145
149
|
.action(runCommand);
|
|
146
150
|
|
|
@@ -228,7 +232,6 @@ async function run(
|
|
|
228
232
|
let options = await normalizeOptions(command, fs);
|
|
229
233
|
let parcel = new Parcel({
|
|
230
234
|
entries,
|
|
231
|
-
// $FlowFixMe[extra-arg] - flow doesn't know about the `paths` option (added in Node v8.9.0)
|
|
232
235
|
defaultConfig: require.resolve('@parcel/config-default', {
|
|
233
236
|
paths: [fs.cwd(), __dirname],
|
|
234
237
|
}),
|
|
@@ -339,8 +342,8 @@ async function run(
|
|
|
339
342
|
|
|
340
343
|
// In non-tty cases, respond to SIGINT by cleaning up. Since we're watching,
|
|
341
344
|
// a 0 success code is acceptable.
|
|
342
|
-
process.on('SIGINT', exit);
|
|
343
|
-
process.on('SIGTERM', exit);
|
|
345
|
+
process.on('SIGINT', () => exit());
|
|
346
|
+
process.on('SIGTERM', () => exit());
|
|
344
347
|
} else {
|
|
345
348
|
try {
|
|
346
349
|
await parcel.run();
|
|
@@ -471,6 +474,11 @@ async function normalizeOptions(
|
|
|
471
474
|
}
|
|
472
475
|
|
|
473
476
|
let mode = command.name() === 'build' ? 'production' : 'development';
|
|
477
|
+
|
|
478
|
+
const normalizeIncludeExcludeList = (input?: string): string[] => {
|
|
479
|
+
if (typeof input !== 'string') return [];
|
|
480
|
+
return input.split(',').map(value => value.trim());
|
|
481
|
+
};
|
|
474
482
|
return {
|
|
475
483
|
shouldDisableCache: command.cache === false,
|
|
476
484
|
cacheDir: command.cacheDir,
|
|
@@ -484,7 +492,9 @@ async function normalizeOptions(
|
|
|
484
492
|
logLevel: command.logLevel,
|
|
485
493
|
shouldProfile: command.profile,
|
|
486
494
|
shouldTrace: command.trace,
|
|
487
|
-
shouldBuildLazily: command.lazy,
|
|
495
|
+
shouldBuildLazily: typeof command.lazy !== 'undefined',
|
|
496
|
+
lazyIncludes: normalizeIncludeExcludeList(command.lazy),
|
|
497
|
+
lazyExcludes: normalizeIncludeExcludeList(command.lazyExclude),
|
|
488
498
|
shouldBundleIncrementally:
|
|
489
499
|
process.env.PARCEL_INCREMENTAL_BUNDLING === 'false' ? false : true,
|
|
490
500
|
detailedReport:
|