@atlaspack/cli 2.12.1-dev.3478 → 2.12.1-dev.3520

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.
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.applyOptions = applyOptions;
7
+ function _commander() {
8
+ const data = _interopRequireDefault(require("commander"));
9
+ _commander = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function applyOptions(cmd, options) {
16
+ for (let opt in options) {
17
+ const option = options[opt];
18
+ if (option instanceof _commander().default.Option) {
19
+ cmd.addOption(option);
20
+ } else if (Array.isArray(option)) {
21
+ cmd.option(opt, ...option);
22
+ } else if (typeof option === 'string') {
23
+ cmd.option(opt, option);
24
+ }
25
+ }
26
+ }
package/lib/cli.js CHANGED
@@ -14,13 +14,6 @@ function _fs() {
14
14
  };
15
15
  return data;
16
16
  }
17
- function _diagnostic() {
18
- const data = _interopRequireDefault(require("@atlaspack/diagnostic"));
19
- _diagnostic = function () {
20
- return data;
21
- };
22
- return data;
23
- }
24
17
  function _utils() {
25
18
  const data = require("@atlaspack/utils");
26
19
  _utils = function () {
@@ -63,21 +56,12 @@ function _path() {
63
56
  };
64
57
  return data;
65
58
  }
66
- function _getPort() {
67
- const data = _interopRequireDefault(require("get-port"));
68
- _getPort = function () {
69
- return data;
70
- };
71
- return data;
72
- }
73
59
  var _package = require("../package.json");
74
- function _featureFlags() {
75
- const data = require("@atlaspack/feature-flags");
76
- _featureFlags = function () {
77
- return data;
78
- };
79
- return data;
80
- }
60
+ var _applyOptions = require("./applyOptions");
61
+ var _makeDebugCommand = require("./makeDebugCommand");
62
+ var _normalizeOptions = require("./normalizeOptions");
63
+ var _handleUncaughtException = require("./handleUncaughtException");
64
+ var _options = require("./options");
81
65
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
82
66
  const program = new (_commander().default.Command)();
83
67
 
@@ -85,180 +69,18 @@ const program = new (_commander().default.Command)();
85
69
  // 128 + signal value
86
70
  // https://tldp.org/LDP/abs/html/exitcodes.html
87
71
  const SIGINT_EXIT_CODE = 130;
88
- async function logUncaughtError(e) {
89
- if (e instanceof _diagnostic().default) {
90
- for (let diagnostic of e.diagnostics) {
91
- let {
92
- message,
93
- codeframe,
94
- stack,
95
- hints,
96
- documentation
97
- } = await (0, _utils().prettyDiagnostic)(diagnostic);
98
- _logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.red(message));
99
- if (codeframe || stack) {
100
- _logger().INTERNAL_ORIGINAL_CONSOLE.error('');
101
- }
102
- _logger().INTERNAL_ORIGINAL_CONSOLE.error(codeframe);
103
- _logger().INTERNAL_ORIGINAL_CONSOLE.error(stack);
104
- if ((stack || codeframe) && hints.length > 0) {
105
- _logger().INTERNAL_ORIGINAL_CONSOLE.error('');
106
- }
107
- for (let h of hints) {
108
- _logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.blue(h));
109
- }
110
- if (documentation) {
111
- _logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.magenta.bold(documentation));
112
- }
113
- }
114
- } else {
115
- _logger().INTERNAL_ORIGINAL_CONSOLE.error(e);
116
- }
117
-
118
- // A hack to definitely ensure we logged the uncaught exception
119
- await new Promise(resolve => setTimeout(resolve, 100));
120
- }
121
- const handleUncaughtException = async exception => {
122
- try {
123
- await logUncaughtError(exception);
124
- } catch (err) {
125
- console.error(exception);
126
- console.error(err);
127
- }
128
- process.exit(1);
129
- };
130
- process.on('unhandledRejection', handleUncaughtException);
72
+ process.on('unhandledRejection', _handleUncaughtException.handleUncaughtException);
131
73
  program.storeOptionsAsProperties();
132
74
  program.version(_package.version);
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
-
161
- // --no-cache, --cache-dir, --no-source-maps, --no-autoinstall, --global?, --public-url, --log-level
162
- // --no-content-hash, --experimental-scope-hoisting, --detailed-report
163
- const commonOptions = {
164
- '--no-cache': 'disable the filesystem cache',
165
- '--config <path>': 'specify which config to use. can be a path or a package name',
166
- '--cache-dir <path>': 'set the cache directory. defaults to ".parcel-cache"',
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),
170
- '--no-source-maps': 'disable sourcemaps',
171
- '--target [name]': ['only build given target(s)', (val, list) => list.concat([val]), []],
172
- '--log-level <level>': new (_commander().default.Option)('--log-level <level>', 'set the log level').choices(['none', 'error', 'warn', 'info', 'verbose']),
173
- '--dist-dir <dir>': 'output directory to write to when unspecified by targets',
174
- '--no-autoinstall': 'disable autoinstall',
175
- '--profile': 'enable sampling build profiling',
176
- '--trace': 'enable build tracing',
177
- '-V, --version': 'output the version number',
178
- '--detailed-report [count]': ['print the asset timings and sizes in the build report', parseOptionInt],
179
- '--reporter <name>': ['additional reporters to run', (val, acc) => {
180
- acc.push(val);
181
- return acc;
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
- let featureFlagValue;
187
- if (typeof _featureFlags().DEFAULT_FEATURE_FLAGS[name] === 'boolean') {
188
- if (val !== 'true' && val !== 'false') {
189
- throw new Error(`Feature flag ${name} must be set to true or false`);
190
- }
191
- featureFlagValue = val === 'true';
192
- }
193
- previousValue[name] = featureFlagValue ?? String(val);
194
- } else {
195
- _logger().INTERNAL_ORIGINAL_CONSOLE.warn(`Unknown feature flag ${name} specified, it will be ignored`);
196
- }
197
- return previousValue;
198
- }, {}]
199
- };
200
- var hmrOptions = {
201
- '--no-hmr': 'disable hot module replacement',
202
- '-p, --port <port>': ['set the port to serve on. defaults to $PORT or 1234', process.env.PORT],
203
- '--host <host>': 'set the host to listen on, defaults to listening on all interfaces',
204
- '--https': 'serves files over HTTPS',
205
- '--cert <path>': 'path to certificate to use with HTTPS',
206
- '--key <path>': 'path to private key to use with HTTPS',
207
- '--hmr-port <port>': ['hot module replacement port', process.env.HMR_PORT],
208
- '--hmr-host <host>': ['hot module replacement host', process.env.HMR_HOST]
209
- };
210
- function applyOptions(cmd, options) {
211
- for (let opt in options) {
212
- const option = options[opt];
213
- if (option instanceof _commander().default.Option) {
214
- cmd.addOption(option);
215
- } else {
216
- cmd.option(opt, ...(Array.isArray(option) ? option : [option]));
217
- }
218
- }
219
- }
220
75
  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').option('--production', 'Run with production mode defaults').action(runCommand);
221
- applyOptions(serve, hmrOptions);
222
- applyOptions(serve, commonOptions);
76
+ (0, _applyOptions.applyOptions)(serve, _options.hmrOptions);
77
+ (0, _applyOptions.applyOptions)(serve, _options.commonOptions);
223
78
  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').option('--production', 'Run with production mode defaults').action(runCommand);
224
- applyOptions(watch, hmrOptions);
225
- applyOptions(watch, commonOptions);
79
+ (0, _applyOptions.applyOptions)(watch, _options.hmrOptions);
80
+ (0, _applyOptions.applyOptions)(watch, _options.commonOptions);
226
81
  let build = program.command('build [input...]').description('bundles for production').option('--no-optimize', 'disable minification').option('--no-scope-hoist', 'disable scope-hoisting').option('--public-url <url>', 'the path prefix for absolute urls').option('--no-content-hash', 'disable content hashing').action(runCommand);
227
- applyOptions(build, commonOptions);
228
- function makeDebugCommand() {
229
- const debug = new (_commander().default.Command)('debug').description('Debug commands for atlaspack');
230
- const invalidate = debug.command('invalidate [input...]').description('Run cache invalidation, then exit').action(async (entries, opts, command) => {
231
- try {
232
- if (entries.length === 0) {
233
- entries = ['.'];
234
- }
235
- entries = entries.map(entry => _path().default.resolve(entry));
236
- Object.assign(command, opts);
237
- const Atlaspack = require('@atlaspack/core').default;
238
- const fs = new (_fs().NodeFS)();
239
- const options = await normalizeOptions(command, fs);
240
- console.log(command.featureFlag);
241
- const atlaspack = new Atlaspack({
242
- entries,
243
- defaultConfig: require.resolve('@atlaspack/config-default', {
244
- paths: [fs.cwd(), __dirname]
245
- }),
246
- shouldPatchConsole: false,
247
- ...options,
248
- shouldBuildLazily: true,
249
- watchBackend: 'watchman'
250
- });
251
- console.log('Created atlaspack instance');
252
- await atlaspack.unstable_invalidate();
253
- console.log('Done invalidating cache');
254
- } catch (err) {
255
- handleUncaughtException(err);
256
- }
257
- });
258
- applyOptions(invalidate, commonOptions);
259
- return debug;
260
- }
261
- program.addCommand(makeDebugCommand());
82
+ (0, _applyOptions.applyOptions)(build, _options.commonOptions);
83
+ program.addCommand((0, _makeDebugCommand.makeDebugCommand)());
262
84
  program.command('help [command]').description('display help information for a command').action(function (command) {
263
85
  let cmd = program.commands.find(c => c.name() === command) || program;
264
86
  cmd.help();
@@ -285,7 +107,7 @@ if (!args[2] || !program.commands.some(c => c.name() === args[2])) {
285
107
  }
286
108
  program.parse(args);
287
109
  function runCommand(...args) {
288
- run(...args).catch(handleUncaughtException);
110
+ run(...args).catch(_handleUncaughtException.handleUncaughtException);
289
111
  }
290
112
  async function run(entries, _opts,
291
113
  // using pre v7 Commander options as properties
@@ -296,7 +118,7 @@ command) {
296
118
  entries = entries.map(entry => _path().default.resolve(entry));
297
119
  let Atlaspack = require('@atlaspack/core').default;
298
120
  let fs = new (_fs().NodeFS)();
299
- let options = await normalizeOptions(command, fs);
121
+ let options = await (0, _normalizeOptions.normalizeOptions)(command, fs);
300
122
  let atlaspack = new Atlaspack({
301
123
  entries,
302
124
  defaultConfig: require.resolve('@atlaspack/config-default', {
@@ -392,161 +214,10 @@ command) {
392
214
  // If an exception is thrown during Atlaspack.build, it is given to reporters in a
393
215
  // buildFailure event, and has been shown to the user.
394
216
  if (!(err instanceof _core().BuildError)) {
395
- await logUncaughtError(err);
217
+ await (0, _handleUncaughtException.logUncaughtError)(err);
396
218
  }
397
219
  await exit(1);
398
220
  }
399
221
  await exit();
400
222
  }
401
- }
402
- function parsePort(portValue) {
403
- let parsedPort = Number(portValue);
404
-
405
- // Throw an error if port value is invalid...
406
- if (!Number.isInteger(parsedPort)) {
407
- throw new Error(`Port ${portValue} is not a valid integer.`);
408
- }
409
- return parsedPort;
410
- }
411
- function parseOptionInt(value) {
412
- const parsedValue = parseInt(value, 10);
413
- if (isNaN(parsedValue)) {
414
- throw new (_commander().default.InvalidOptionArgumentError)('Must be an integer.');
415
- }
416
- return parsedValue;
417
- }
418
- function shouldUseProductionDefaults(command) {
419
- return command.name() === 'build' || command.production === true;
420
- }
421
- async function normalizeOptions(command, inputFS) {
422
- let nodeEnv;
423
- if (shouldUseProductionDefaults(command)) {
424
- nodeEnv = process.env.NODE_ENV || 'production';
425
- // Autoinstall unless explicitly disabled or we detect a CI environment.
426
- command.autoinstall = !(command.autoinstall === false || process.env.CI);
427
- } else {
428
- nodeEnv = process.env.NODE_ENV || 'development';
429
- }
430
-
431
- // Set process.env.NODE_ENV to a default if undefined so that it is
432
- // available in JS configs and plugins.
433
- process.env.NODE_ENV = nodeEnv;
434
- let https = !!command.https;
435
- if (command.cert && command.key) {
436
- https = {
437
- cert: command.cert,
438
- key: command.key
439
- };
440
- }
441
- let serveOptions = false;
442
- let {
443
- host
444
- } = command;
445
-
446
- // Ensure port is valid and available
447
- let port = parsePort(command.port || '1234');
448
- let originalPort = port;
449
- if (!shouldUseProductionDefaults(command) && (command.name() === 'serve' || command.hmr)) {
450
- try {
451
- port = await (0, _getPort().default)({
452
- port,
453
- host
454
- });
455
- } catch (err) {
456
- throw new (_diagnostic().default)({
457
- diagnostic: {
458
- message: `Could not get available port: ${err.message}`,
459
- origin: 'atlaspack',
460
- stack: err.stack
461
- }
462
- });
463
- }
464
- if (port !== originalPort) {
465
- let errorMessage = `Port "${originalPort}" could not be used`;
466
- if (command.port != null) {
467
- // Throw the error if the user defined a custom port
468
- throw new Error(errorMessage);
469
- } else {
470
- // Atlaspack logger is not set up at this point, so just use native INTERNAL_ORIGINAL_CONSOLE
471
- _logger().INTERNAL_ORIGINAL_CONSOLE.warn(errorMessage);
472
- }
473
- }
474
- }
475
- if (command.name() === 'serve') {
476
- let {
477
- publicUrl
478
- } = command;
479
- serveOptions = {
480
- https,
481
- port,
482
- host,
483
- publicUrl
484
- };
485
- }
486
- let hmrOptions = null;
487
- if (!shouldUseProductionDefaults(command) && command.hmr !== false) {
488
- let hmrport = command.hmrPort ? parsePort(command.hmrPort) : port;
489
- let hmrhost = command.hmrHost ? command.hmrHost : host;
490
- hmrOptions = {
491
- port: hmrport,
492
- host: hmrhost
493
- };
494
- }
495
- if (command.detailedReport === true) {
496
- command.detailedReport = '10';
497
- }
498
- let additionalReporters = [{
499
- packageName: '@atlaspack/reporter-cli',
500
- resolveFrom: __filename
501
- }, ...command.reporter.map(packageName => ({
502
- packageName,
503
- resolveFrom: _path().default.join(inputFS.cwd(), 'index')
504
- }))];
505
- if (command.trace) {
506
- additionalReporters.unshift({
507
- packageName: '@atlaspack/reporter-tracer',
508
- resolveFrom: __filename
509
- });
510
- }
511
- let mode = shouldUseProductionDefaults(command) ? 'production' : 'development';
512
- const normalizeIncludeExcludeList = input => {
513
- if (typeof input !== 'string') return [];
514
- return input.split(',').map(value => value.trim());
515
- };
516
- return {
517
- shouldDisableCache: command.cache === false,
518
- cacheDir: command.cacheDir,
519
- watchDir: command.watchDir,
520
- watchBackend: command.watchBackend,
521
- watchIgnore: command.watchIgnore,
522
- config: command.config,
523
- mode,
524
- hmrOptions,
525
- shouldContentHash: hmrOptions ? false : command.contentHash,
526
- serveOptions,
527
- targets: command.target.length > 0 ? command.target : null,
528
- shouldAutoInstall: command.autoinstall ?? true,
529
- logLevel: command.logLevel,
530
- shouldProfile: command.profile,
531
- shouldTrace: command.trace,
532
- shouldBuildLazily: typeof command.lazy !== 'undefined',
533
- lazyIncludes: normalizeIncludeExcludeList(command.lazy),
534
- lazyExcludes: normalizeIncludeExcludeList(command.lazyExclude),
535
- shouldBundleIncrementally: process.env.ATLASPACK_INCREMENTAL_BUNDLING === 'false' ? false : true,
536
- detailedReport: command.detailedReport != null ? {
537
- assetsPerBundle: parseInt(command.detailedReport, 10)
538
- } : null,
539
- env: {
540
- NODE_ENV: nodeEnv
541
- },
542
- additionalReporters,
543
- defaultTargetOptions: {
544
- shouldOptimize: command.optimize != null ? command.optimize : mode === 'production',
545
- sourceMaps: command.sourceMaps ?? true,
546
- shouldScopeHoist: command.scopeHoist,
547
- publicUrl: command.publicUrl,
548
- distDir: command.distDir
549
- },
550
- featureFlags: command.featureFlag
551
- };
552
223
  }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.handleUncaughtException = handleUncaughtException;
7
+ exports.logUncaughtError = logUncaughtError;
8
+ function _diagnostic() {
9
+ const data = _interopRequireDefault(require("@atlaspack/diagnostic"));
10
+ _diagnostic = function () {
11
+ return data;
12
+ };
13
+ return data;
14
+ }
15
+ function _utils() {
16
+ const data = require("@atlaspack/utils");
17
+ _utils = function () {
18
+ return data;
19
+ };
20
+ return data;
21
+ }
22
+ function _logger() {
23
+ const data = require("@atlaspack/logger");
24
+ _logger = function () {
25
+ return data;
26
+ };
27
+ return data;
28
+ }
29
+ function _chalk() {
30
+ const data = _interopRequireDefault(require("chalk"));
31
+ _chalk = function () {
32
+ return data;
33
+ };
34
+ return data;
35
+ }
36
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
+ async function logUncaughtError(e) {
38
+ if (e instanceof _diagnostic().default) {
39
+ for (let diagnostic of e.diagnostics) {
40
+ let {
41
+ message,
42
+ codeframe,
43
+ stack,
44
+ hints,
45
+ documentation
46
+ } = await (0, _utils().prettyDiagnostic)(diagnostic);
47
+ _logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.red(message));
48
+ if (codeframe || stack) {
49
+ _logger().INTERNAL_ORIGINAL_CONSOLE.error('');
50
+ }
51
+ _logger().INTERNAL_ORIGINAL_CONSOLE.error(codeframe);
52
+ _logger().INTERNAL_ORIGINAL_CONSOLE.error(stack);
53
+ if ((stack || codeframe) && hints.length > 0) {
54
+ _logger().INTERNAL_ORIGINAL_CONSOLE.error('');
55
+ }
56
+ for (let h of hints) {
57
+ _logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.blue(h));
58
+ }
59
+ if (documentation) {
60
+ _logger().INTERNAL_ORIGINAL_CONSOLE.error(_chalk().default.magenta.bold(documentation));
61
+ }
62
+ }
63
+ } else {
64
+ _logger().INTERNAL_ORIGINAL_CONSOLE.error(e);
65
+ }
66
+
67
+ // A hack to definitely ensure we logged the uncaught exception
68
+ await new Promise(resolve => setTimeout(resolve, 100));
69
+ }
70
+ async function handleUncaughtException(exception) {
71
+ try {
72
+ await logUncaughtError(exception);
73
+ } catch (err) {
74
+ console.error(exception);
75
+ console.error(err);
76
+ }
77
+ process.exit(1);
78
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.makeDebugCommand = makeDebugCommand;
7
+ function _fs() {
8
+ const data = require("@atlaspack/fs");
9
+ _fs = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _commander() {
15
+ const data = _interopRequireDefault(require("commander"));
16
+ _commander = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _path() {
22
+ const data = _interopRequireDefault(require("path"));
23
+ _path = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ var _normalizeOptions = require("./normalizeOptions");
29
+ var _applyOptions = require("./applyOptions");
30
+ var _options = require("./options");
31
+ var _handleUncaughtException = require("./handleUncaughtException");
32
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
+ function makeDebugCommand() {
34
+ const debug = new (_commander().default.Command)('debug').description('Debug commands for atlaspack');
35
+ const invalidate = debug.command('invalidate [input...]').description('Run cache invalidation, then exit').action(async (args, opts, command) => {
36
+ try {
37
+ let entries = args;
38
+ if (entries.length === 0) {
39
+ entries = ['.'];
40
+ }
41
+ entries = entries.map(entry => _path().default.resolve(entry));
42
+ Object.assign(command, opts);
43
+ const fs = new (_fs().NodeFS)();
44
+ const options = await (0, _normalizeOptions.normalizeOptions)(command, fs);
45
+ const Atlaspack = require('@atlaspack/core').default;
46
+ const atlaspack = new Atlaspack({
47
+ entries,
48
+ defaultConfig: require.resolve('@atlaspack/config-default', {
49
+ paths: [fs.cwd(), __dirname]
50
+ }),
51
+ shouldPatchConsole: false,
52
+ ...options,
53
+ shouldBuildLazily: true,
54
+ watchBackend: 'watchman'
55
+ });
56
+ console.log('Created atlaspack instance');
57
+ await atlaspack.unstable_invalidate();
58
+ console.log('Done invalidating cache');
59
+ } catch (err) {
60
+ (0, _handleUncaughtException.handleUncaughtException)(err);
61
+ }
62
+ });
63
+ (0, _applyOptions.applyOptions)(invalidate, _options.commonOptions);
64
+ const buildAssetGraph = debug.command('build-asset-graph [input...]').description('Build the asset graph then exit').action(async (args, opts, command) => {
65
+ try {
66
+ let entries = args;
67
+ if (entries.length === 0) {
68
+ entries = ['.'];
69
+ }
70
+ entries = entries.map(entry => _path().default.resolve(entry));
71
+ Object.assign(command, opts);
72
+ const fs = new (_fs().NodeFS)();
73
+ const options = await (0, _normalizeOptions.normalizeOptions)(command, fs);
74
+ const Atlaspack = require('@atlaspack/core').default;
75
+ const atlaspack = new Atlaspack({
76
+ entries,
77
+ defaultConfig: require.resolve('@atlaspack/config-default', {
78
+ paths: [fs.cwd(), __dirname]
79
+ }),
80
+ shouldPatchConsole: false,
81
+ ...options,
82
+ shouldBuildLazily: true,
83
+ watchBackend: 'watchman',
84
+ featureFlags: {
85
+ ...options.featureFlags,
86
+ fixQuadraticCacheInvalidation: 'NEW',
87
+ useLmdbJsLite: true
88
+ }
89
+ });
90
+ console.log('Created atlaspack instance');
91
+ await atlaspack.unstable_buildAssetGraph();
92
+ console.log('Done building asset graph');
93
+ process.exit(0);
94
+ } catch (err) {
95
+ (0, _handleUncaughtException.handleUncaughtException)(err);
96
+ }
97
+ });
98
+ (0, _applyOptions.applyOptions)(buildAssetGraph, _options.commonOptions);
99
+ return debug;
100
+ }