parcel 2.0.0-dev.1526 → 2.0.0-dev.1555

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/bin/parcel.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../lib/bin');
package/lib/cli.js CHANGED
@@ -131,14 +131,42 @@ process.on('unhandledRejection', handleUncaughtException);
131
131
  program.storeOptionsAsProperties();
132
132
  program.version(_package.version);
133
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
+
134
161
  // --no-cache, --cache-dir, --no-source-maps, --no-autoinstall, --global?, --public-url, --log-level
135
162
  // --no-content-hash, --experimental-scope-hoisting, --detailed-report
136
-
137
163
  const commonOptions = {
138
164
  '--no-cache': 'disable the filesystem cache',
139
165
  '--config <path>': 'specify which config to use. can be a path or a package name',
140
166
  '--cache-dir <path>': 'set the cache directory. defaults to ".parcel-cache"',
141
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),
142
170
  '--no-source-maps': 'disable sourcemaps',
143
171
  '--target [name]': ['only build given target(s)', (val, list) => list.concat([val]), []],
144
172
  '--log-level <level>': new (_commander().default.Option)('--log-level <level>', 'set the log level').choices(['none', 'error', 'warn', 'info', 'verbose']),
@@ -155,15 +183,14 @@ const commonOptions = {
155
183
  '--feature-flag <name=value>': ['sets the value of a feature flag', (value, previousValue) => {
156
184
  let [name, val] = value.split('=');
157
185
  if (name in _featureFlags().DEFAULT_FEATURE_FLAGS) {
158
- var _featureFlagValue;
159
186
  let featureFlagValue;
160
187
  if (typeof _featureFlags().DEFAULT_FEATURE_FLAGS[name] === 'boolean') {
161
188
  if (val !== 'true' && val !== 'false') {
162
189
  throw new Error(`Feature flag ${name} must be set to true or false`);
163
190
  }
164
- featureFlagValue = val;
191
+ featureFlagValue = val === 'true';
165
192
  }
166
- previousValue[name] = (_featureFlagValue = featureFlagValue) !== null && _featureFlagValue !== void 0 ? _featureFlagValue : String(val);
193
+ previousValue[name] = featureFlagValue ?? String(val);
167
194
  } else {
168
195
  _logger().INTERNAL_ORIGINAL_CONSOLE.warn(`Unknown feature flag ${name} specified, it will be ignored`);
169
196
  }
@@ -355,7 +382,6 @@ function parseOptionInt(value) {
355
382
  return parsedValue;
356
383
  }
357
384
  async function normalizeOptions(command, inputFS) {
358
- var _command$autoinstall, _command$sourceMaps;
359
385
  let nodeEnv;
360
386
  if (command.name() === 'build') {
361
387
  nodeEnv = process.env.NODE_ENV || 'production';
@@ -454,13 +480,15 @@ async function normalizeOptions(command, inputFS) {
454
480
  shouldDisableCache: command.cache === false,
455
481
  cacheDir: command.cacheDir,
456
482
  watchDir: command.watchDir,
483
+ watchBackend: command.watchBackend,
484
+ watchIgnore: command.watchIgnore,
457
485
  config: command.config,
458
486
  mode,
459
487
  hmrOptions,
460
488
  shouldContentHash: hmrOptions ? false : command.contentHash,
461
489
  serveOptions,
462
490
  targets: command.target.length > 0 ? command.target : null,
463
- shouldAutoInstall: (_command$autoinstall = command.autoinstall) !== null && _command$autoinstall !== void 0 ? _command$autoinstall : true,
491
+ shouldAutoInstall: command.autoinstall ?? true,
464
492
  logLevel: command.logLevel,
465
493
  shouldProfile: command.profile,
466
494
  shouldTrace: command.trace,
@@ -477,7 +505,7 @@ async function normalizeOptions(command, inputFS) {
477
505
  additionalReporters,
478
506
  defaultTargetOptions: {
479
507
  shouldOptimize: command.optimize != null ? command.optimize : mode === 'production',
480
- sourceMaps: (_command$sourceMaps = command.sourceMaps) !== null && _command$sourceMaps !== void 0 ? _command$sourceMaps : true,
508
+ sourceMaps: command.sourceMaps ?? true,
481
509
  shouldScopeHoist: command.scopeHoist,
482
510
  publicUrl: command.publicUrl,
483
511
  distDir: command.distDir
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parcel",
3
- "version": "2.0.0-dev.1526+70889ca07",
3
+ "version": "2.0.0-dev.1555+e87c13686",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -14,32 +14,37 @@
14
14
  "type": "git",
15
15
  "url": "https://github.com/parcel-bundler/parcel.git"
16
16
  },
17
- "bin": "lib/bin.js",
17
+ "bin": "bin/parcel.js",
18
18
  "main": "lib/bin.js",
19
19
  "source": "src/bin.js",
20
+ "scripts": {
21
+ "prepack": "./ensure-no-dev-lib.sh",
22
+ "dev:prepare": "rimraf ./lib/ && mkdir -p lib && cp ./bin/dev-bin.js ./lib/bin.js"
23
+ },
20
24
  "engines": {
21
- "node": ">= 12.0.0"
25
+ "node": ">= 16.0.0"
22
26
  },
23
27
  "dependencies": {
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",
28
+ "@parcel/config-default": "2.0.0-dev.1557+e87c13686",
29
+ "@parcel/core": "2.0.0-dev.1555+e87c13686",
30
+ "@parcel/diagnostic": "2.0.0-dev.1557+e87c13686",
31
+ "@parcel/events": "2.0.0-dev.1557+e87c13686",
32
+ "@parcel/feature-flags": "2.12.1-dev.3204+e87c13686",
33
+ "@parcel/fs": "2.0.0-dev.1557+e87c13686",
34
+ "@parcel/logger": "2.0.0-dev.1557+e87c13686",
35
+ "@parcel/package-manager": "2.0.0-dev.1557+e87c13686",
36
+ "@parcel/reporter-cli": "2.0.0-dev.1557+e87c13686",
37
+ "@parcel/reporter-dev-server": "2.0.0-dev.1557+e87c13686",
38
+ "@parcel/reporter-tracer": "2.12.1-dev.3204+e87c13686",
39
+ "@parcel/utils": "2.0.0-dev.1557+e87c13686",
36
40
  "chalk": "^4.1.0",
37
41
  "commander": "^7.0.0",
38
42
  "get-port": "^4.2.0"
39
43
  },
40
44
  "devDependencies": {
41
45
  "@babel/core": "^7.22.11",
42
- "@parcel/babel-register": "2.12.0"
46
+ "@parcel/babel-register": "2.12.0",
47
+ "rimraf": "^5.0.5"
43
48
  },
44
- "gitHead": "70889ca07dccb95e21e4c6a2844d632e3723faf4"
45
- }
49
+ "gitHead": "e87c13686e8fa4ad96cc61c19d9e4fcf9c372f2e"
50
+ }
package/src/cli.js CHANGED
@@ -66,9 +66,31 @@ process.on('unhandledRejection', handleUncaughtException);
66
66
  program.storeOptionsAsProperties();
67
67
  program.version(version);
68
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
+
69
92
  // --no-cache, --cache-dir, --no-source-maps, --no-autoinstall, --global?, --public-url, --log-level
70
93
  // --no-content-hash, --experimental-scope-hoisting, --detailed-report
71
-
72
94
  const commonOptions = {
73
95
  '--no-cache': 'disable the filesystem cache',
74
96
  '--config <path>':
@@ -76,6 +98,14 @@ const commonOptions = {
76
98
  '--cache-dir <path>': 'set the cache directory. defaults to ".parcel-cache"',
77
99
  '--watch-dir <path>':
78
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),
79
109
  '--no-source-maps': 'disable sourcemaps',
80
110
  '--target [name]': [
81
111
  'only build given target(s)',
@@ -116,7 +146,7 @@ const commonOptions = {
116
146
  `Feature flag ${name} must be set to true or false`,
117
147
  );
118
148
  }
119
- featureFlagValue = val;
149
+ featureFlagValue = val === 'true';
120
150
  }
121
151
  previousValue[name] = featureFlagValue ?? String(val);
122
152
  } else {
@@ -497,10 +527,13 @@ async function normalizeOptions(
497
527
  if (typeof input !== 'string') return [];
498
528
  return input.split(',').map(value => value.trim());
499
529
  };
530
+
500
531
  return {
501
532
  shouldDisableCache: command.cache === false,
502
533
  cacheDir: command.cacheDir,
503
534
  watchDir: command.watchDir,
535
+ watchBackend: command.watchBackend,
536
+ watchIgnore: command.watchIgnore,
504
537
  config: command.config,
505
538
  mode,
506
539
  hmrOptions,