@atlaspack/cli 2.12.1-dev.3401 → 2.12.1-dev.3450

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.
Files changed (3) hide show
  1. package/lib/cli.js +34 -0
  2. package/package.json +15 -15
  3. package/src/cli.js +47 -0
package/lib/cli.js CHANGED
@@ -225,6 +225,40 @@ applyOptions(watch, hmrOptions);
225
225
  applyOptions(watch, commonOptions);
226
226
  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
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());
228
262
  program.command('help [command]').description('display help information for a command').action(function (command) {
229
263
  let cmd = program.commands.find(c => c.name() === command) || program;
230
264
  cmd.help();
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@atlaspack/cli",
3
- "version": "2.12.1-dev.3401+b483af77f",
3
+ "version": "2.12.1-dev.3450+58845ef87",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
- "license": "MIT",
5
+ "license": "(MIT OR Apache-2.0)",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -23,18 +23,18 @@
23
23
  "node": ">= 16.0.0"
24
24
  },
25
25
  "dependencies": {
26
- "@atlaspack/config-default": "2.12.1-dev.3401+b483af77f",
27
- "@atlaspack/core": "2.12.1-dev.3401+b483af77f",
28
- "@atlaspack/diagnostic": "2.12.1-dev.3401+b483af77f",
29
- "@atlaspack/events": "2.12.1-dev.3401+b483af77f",
30
- "@atlaspack/feature-flags": "2.12.1-dev.3401+b483af77f",
31
- "@atlaspack/fs": "2.12.1-dev.3401+b483af77f",
32
- "@atlaspack/logger": "2.12.1-dev.3401+b483af77f",
33
- "@atlaspack/package-manager": "2.12.1-dev.3401+b483af77f",
34
- "@atlaspack/reporter-cli": "2.12.1-dev.3401+b483af77f",
35
- "@atlaspack/reporter-dev-server": "2.12.1-dev.3401+b483af77f",
36
- "@atlaspack/reporter-tracer": "2.12.1-dev.3401+b483af77f",
37
- "@atlaspack/utils": "2.12.1-dev.3401+b483af77f",
26
+ "@atlaspack/config-default": "2.12.1-dev.3450+58845ef87",
27
+ "@atlaspack/core": "2.12.1-dev.3450+58845ef87",
28
+ "@atlaspack/diagnostic": "2.12.1-dev.3450+58845ef87",
29
+ "@atlaspack/events": "2.12.1-dev.3450+58845ef87",
30
+ "@atlaspack/feature-flags": "2.12.1-dev.3450+58845ef87",
31
+ "@atlaspack/fs": "2.12.1-dev.3450+58845ef87",
32
+ "@atlaspack/logger": "2.12.1-dev.3450+58845ef87",
33
+ "@atlaspack/package-manager": "2.12.1-dev.3450+58845ef87",
34
+ "@atlaspack/reporter-cli": "2.12.1-dev.3450+58845ef87",
35
+ "@atlaspack/reporter-dev-server": "2.12.1-dev.3450+58845ef87",
36
+ "@atlaspack/reporter-tracer": "2.12.1-dev.3450+58845ef87",
37
+ "@atlaspack/utils": "2.12.1-dev.3450+58845ef87",
38
38
  "chalk": "^4.1.0",
39
39
  "commander": "^7.0.0",
40
40
  "get-port": "^4.2.0"
@@ -44,5 +44,5 @@
44
44
  "@babel/core": "^7.22.11",
45
45
  "rimraf": "^5.0.5"
46
46
  },
47
- "gitHead": "b483af77f02d1258c8dad156e097b94f83671d8e"
47
+ "gitHead": "58845ef87446fcedb7d7d8876440c64184645cbb"
48
48
  }
package/src/cli.js CHANGED
@@ -230,6 +230,53 @@ let build = program
230
230
 
231
231
  applyOptions(build, commonOptions);
232
232
 
233
+ function makeDebugCommand() {
234
+ const debug = new commander.Command('debug').description(
235
+ 'Debug commands for atlaspack',
236
+ );
237
+
238
+ const invalidate = debug
239
+ .command('invalidate [input...]')
240
+ .description('Run cache invalidation, then exit')
241
+ .action(async (entries, opts, command: any) => {
242
+ try {
243
+ if (entries.length === 0) {
244
+ entries = ['.'];
245
+ }
246
+ entries = entries.map(entry => path.resolve(entry));
247
+
248
+ Object.assign(command, opts);
249
+
250
+ const Atlaspack = require('@atlaspack/core').default;
251
+ const fs = new NodeFS();
252
+ const options = await normalizeOptions(command, fs);
253
+
254
+ console.log(command.featureFlag);
255
+ const atlaspack = new Atlaspack({
256
+ entries,
257
+ defaultConfig: require.resolve('@atlaspack/config-default', {
258
+ paths: [fs.cwd(), __dirname],
259
+ }),
260
+ shouldPatchConsole: false,
261
+ ...options,
262
+ shouldBuildLazily: true,
263
+ watchBackend: 'watchman',
264
+ });
265
+ console.log('Created atlaspack instance');
266
+
267
+ await atlaspack.unstable_invalidate();
268
+ console.log('Done invalidating cache');
269
+ } catch (err) {
270
+ handleUncaughtException(err);
271
+ }
272
+ });
273
+ applyOptions(invalidate, commonOptions);
274
+
275
+ return debug;
276
+ }
277
+
278
+ program.addCommand(makeDebugCommand());
279
+
233
280
  program
234
281
  .command('help [command]')
235
282
  .description('display help information for a command')