@atlaspack/cli 2.13.2-canary.3634 → 2.13.2-canary.3636
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/lib/makeDebugCommand.js +43 -46
- package/package.json +14 -14
- package/src/makeDebugCommand.js +42 -54
package/lib/makeDebugCommand.js
CHANGED
|
@@ -11,6 +11,13 @@ function _fs() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
+
function _logger() {
|
|
15
|
+
const data = _interopRequireDefault(require("@atlaspack/logger"));
|
|
16
|
+
_logger = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
14
21
|
function _commander() {
|
|
15
22
|
const data = _interopRequireDefault(require("commander"));
|
|
16
23
|
_commander = function () {
|
|
@@ -32,30 +39,40 @@ var _handleUncaughtException = require("./handleUncaughtException");
|
|
|
32
39
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
40
|
function makeDebugCommand() {
|
|
34
41
|
const debug = new (_commander().default.Command)('debug').description('Debug commands for atlaspack');
|
|
42
|
+
const getInstance = async (args, opts, command) => {
|
|
43
|
+
let entries = args;
|
|
44
|
+
if (entries.length === 0) {
|
|
45
|
+
entries = ['.'];
|
|
46
|
+
}
|
|
47
|
+
entries = entries.map(entry => _path().default.resolve(entry));
|
|
48
|
+
Object.assign(command, opts);
|
|
49
|
+
const fs = new (_fs().NodeFS)();
|
|
50
|
+
const options = await (0, _normalizeOptions.normalizeOptions)(command, fs);
|
|
51
|
+
const Atlaspack = require('@atlaspack/core').default;
|
|
52
|
+
const atlaspack = new Atlaspack({
|
|
53
|
+
entries,
|
|
54
|
+
defaultConfig: require.resolve('@atlaspack/config-default', {
|
|
55
|
+
paths: [fs.cwd(), __dirname]
|
|
56
|
+
}),
|
|
57
|
+
shouldPatchConsole: false,
|
|
58
|
+
...options,
|
|
59
|
+
shouldBuildLazily: true,
|
|
60
|
+
watchBackend: 'watchman'
|
|
61
|
+
});
|
|
62
|
+
_logger().default.info({
|
|
63
|
+
message: 'Created atlaspack instance',
|
|
64
|
+
origin: '@atlaspack/cli'
|
|
65
|
+
});
|
|
66
|
+
return atlaspack;
|
|
67
|
+
};
|
|
35
68
|
const invalidate = debug.command('invalidate [input...]').description('Run cache invalidation, then exit').action(async (args, opts, command) => {
|
|
36
69
|
try {
|
|
37
|
-
|
|
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');
|
|
70
|
+
const atlaspack = await getInstance(args, opts, command);
|
|
57
71
|
await atlaspack.unstable_invalidate();
|
|
58
|
-
|
|
72
|
+
_logger().default.info({
|
|
73
|
+
message: 'Done invalidating cache',
|
|
74
|
+
origin: '@atlaspack/cli'
|
|
75
|
+
});
|
|
59
76
|
} catch (err) {
|
|
60
77
|
(0, _handleUncaughtException.handleUncaughtException)(err);
|
|
61
78
|
}
|
|
@@ -63,32 +80,12 @@ function makeDebugCommand() {
|
|
|
63
80
|
(0, _applyOptions.applyOptions)(invalidate, _options.commonOptions);
|
|
64
81
|
const buildAssetGraph = debug.command('build-asset-graph [input...]').description('Build the asset graph then exit').action(async (args, opts, command) => {
|
|
65
82
|
try {
|
|
66
|
-
|
|
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');
|
|
83
|
+
const atlaspack = await getInstance(args, opts, command);
|
|
91
84
|
await atlaspack.unstable_buildAssetGraph();
|
|
85
|
+
_logger().default.info({
|
|
86
|
+
message: 'Done building asset graph',
|
|
87
|
+
origin: '@atlaspack/cli'
|
|
88
|
+
});
|
|
92
89
|
process.exit(0);
|
|
93
90
|
} catch (err) {
|
|
94
91
|
(0, _handleUncaughtException.handleUncaughtException)(err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/cli",
|
|
3
|
-
"version": "2.13.2-canary.
|
|
3
|
+
"version": "2.13.2-canary.3636+cd1b0d935",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"publishConfig": {
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"node": ">= 16.0.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@atlaspack/config-default": "3.0.2-canary.
|
|
27
|
-
"@atlaspack/core": "2.13.2-canary.
|
|
28
|
-
"@atlaspack/diagnostic": "2.13.2-canary.
|
|
29
|
-
"@atlaspack/events": "2.13.2-canary.
|
|
30
|
-
"@atlaspack/feature-flags": "2.13.2-canary.
|
|
31
|
-
"@atlaspack/fs": "2.13.2-canary.
|
|
32
|
-
"@atlaspack/logger": "2.13.2-canary.
|
|
33
|
-
"@atlaspack/package-manager": "2.13.2-canary.
|
|
34
|
-
"@atlaspack/reporter-cli": "2.13.2-canary.
|
|
35
|
-
"@atlaspack/reporter-dev-server": "2.13.2-canary.
|
|
36
|
-
"@atlaspack/reporter-tracer": "2.13.2-canary.
|
|
37
|
-
"@atlaspack/utils": "2.13.2-canary.
|
|
26
|
+
"@atlaspack/config-default": "3.0.2-canary.3636+cd1b0d935",
|
|
27
|
+
"@atlaspack/core": "2.13.2-canary.3636+cd1b0d935",
|
|
28
|
+
"@atlaspack/diagnostic": "2.13.2-canary.3636+cd1b0d935",
|
|
29
|
+
"@atlaspack/events": "2.13.2-canary.3636+cd1b0d935",
|
|
30
|
+
"@atlaspack/feature-flags": "2.13.2-canary.3636+cd1b0d935",
|
|
31
|
+
"@atlaspack/fs": "2.13.2-canary.3636+cd1b0d935",
|
|
32
|
+
"@atlaspack/logger": "2.13.2-canary.3636+cd1b0d935",
|
|
33
|
+
"@atlaspack/package-manager": "2.13.2-canary.3636+cd1b0d935",
|
|
34
|
+
"@atlaspack/reporter-cli": "2.13.2-canary.3636+cd1b0d935",
|
|
35
|
+
"@atlaspack/reporter-dev-server": "2.13.2-canary.3636+cd1b0d935",
|
|
36
|
+
"@atlaspack/reporter-tracer": "2.13.2-canary.3636+cd1b0d935",
|
|
37
|
+
"@atlaspack/utils": "2.13.2-canary.3636+cd1b0d935",
|
|
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": "
|
|
47
|
+
"gitHead": "cd1b0d9353fa362a07582d045fb6f1eb0faee7ff"
|
|
48
48
|
}
|
package/src/makeDebugCommand.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow strict-local
|
|
2
2
|
|
|
3
3
|
import {NodeFS} from '@atlaspack/fs';
|
|
4
|
+
import logger from '@atlaspack/logger';
|
|
4
5
|
import commander, {type commander$Command} from 'commander';
|
|
5
6
|
import path from 'path';
|
|
6
7
|
import {normalizeOptions, type Options} from './normalizeOptions';
|
|
@@ -13,38 +14,50 @@ export function makeDebugCommand(): commander$Command {
|
|
|
13
14
|
const debug = new commander.Command('debug').description(
|
|
14
15
|
'Debug commands for atlaspack',
|
|
15
16
|
);
|
|
17
|
+
const getInstance = async (args, opts, command) => {
|
|
18
|
+
let entries = args;
|
|
19
|
+
|
|
20
|
+
if (entries.length === 0) {
|
|
21
|
+
entries = ['.'];
|
|
22
|
+
}
|
|
23
|
+
entries = entries.map((entry) => path.resolve(entry));
|
|
24
|
+
|
|
25
|
+
Object.assign(command, opts);
|
|
26
|
+
const fs = new NodeFS();
|
|
27
|
+
const options = await normalizeOptions(command, fs);
|
|
28
|
+
|
|
29
|
+
const Atlaspack = require('@atlaspack/core').default;
|
|
30
|
+
|
|
31
|
+
const atlaspack = new Atlaspack({
|
|
32
|
+
entries,
|
|
33
|
+
defaultConfig: require.resolve('@atlaspack/config-default', {
|
|
34
|
+
paths: [fs.cwd(), __dirname],
|
|
35
|
+
}),
|
|
36
|
+
shouldPatchConsole: false,
|
|
37
|
+
...options,
|
|
38
|
+
shouldBuildLazily: true,
|
|
39
|
+
watchBackend: 'watchman',
|
|
40
|
+
});
|
|
41
|
+
logger.info({
|
|
42
|
+
message: 'Created atlaspack instance',
|
|
43
|
+
origin: '@atlaspack/cli',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return atlaspack;
|
|
47
|
+
};
|
|
16
48
|
|
|
17
49
|
const invalidate = debug
|
|
18
50
|
.command('invalidate [input...]')
|
|
19
51
|
.description('Run cache invalidation, then exit')
|
|
20
52
|
.action(async (args: string[], opts: Options, command: CommandExt) => {
|
|
21
53
|
try {
|
|
22
|
-
|
|
23
|
-
if (entries.length === 0) {
|
|
24
|
-
entries = ['.'];
|
|
25
|
-
}
|
|
26
|
-
entries = entries.map((entry) => path.resolve(entry));
|
|
27
|
-
Object.assign(command, opts);
|
|
28
|
-
|
|
29
|
-
const fs = new NodeFS();
|
|
30
|
-
const options = await normalizeOptions(command, fs);
|
|
31
|
-
|
|
32
|
-
const Atlaspack = require('@atlaspack/core').default;
|
|
33
|
-
|
|
34
|
-
const atlaspack = new Atlaspack({
|
|
35
|
-
entries,
|
|
36
|
-
defaultConfig: require.resolve('@atlaspack/config-default', {
|
|
37
|
-
paths: [fs.cwd(), __dirname],
|
|
38
|
-
}),
|
|
39
|
-
shouldPatchConsole: false,
|
|
40
|
-
...options,
|
|
41
|
-
shouldBuildLazily: true,
|
|
42
|
-
watchBackend: 'watchman',
|
|
43
|
-
});
|
|
44
|
-
console.log('Created atlaspack instance');
|
|
54
|
+
const atlaspack = await getInstance(args, opts, command);
|
|
45
55
|
|
|
46
56
|
await atlaspack.unstable_invalidate();
|
|
47
|
-
|
|
57
|
+
logger.info({
|
|
58
|
+
message: 'Done invalidating cache',
|
|
59
|
+
origin: '@atlaspack/cli',
|
|
60
|
+
});
|
|
48
61
|
} catch (err) {
|
|
49
62
|
handleUncaughtException(err);
|
|
50
63
|
}
|
|
@@ -56,38 +69,13 @@ export function makeDebugCommand(): commander$Command {
|
|
|
56
69
|
.description('Build the asset graph then exit')
|
|
57
70
|
.action(async (args: string[], opts: Options, command: CommandExt) => {
|
|
58
71
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (entries.length === 0) {
|
|
62
|
-
entries = ['.'];
|
|
63
|
-
}
|
|
64
|
-
entries = entries.map((entry) => path.resolve(entry));
|
|
65
|
-
|
|
66
|
-
Object.assign(command, opts);
|
|
67
|
-
const fs = new NodeFS();
|
|
68
|
-
const options = await normalizeOptions(command, fs);
|
|
69
|
-
|
|
70
|
-
const Atlaspack = require('@atlaspack/core').default;
|
|
71
|
-
|
|
72
|
-
const atlaspack = new Atlaspack({
|
|
73
|
-
entries,
|
|
74
|
-
defaultConfig: require.resolve('@atlaspack/config-default', {
|
|
75
|
-
paths: [fs.cwd(), __dirname],
|
|
76
|
-
}),
|
|
77
|
-
shouldPatchConsole: false,
|
|
78
|
-
...options,
|
|
79
|
-
shouldBuildLazily: true,
|
|
80
|
-
watchBackend: 'watchman',
|
|
81
|
-
featureFlags: {
|
|
82
|
-
...options.featureFlags,
|
|
83
|
-
fixQuadraticCacheInvalidation: 'NEW',
|
|
84
|
-
useLmdbJsLite: true,
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
console.log('Created atlaspack instance');
|
|
72
|
+
const atlaspack = await getInstance(args, opts, command);
|
|
89
73
|
|
|
90
74
|
await atlaspack.unstable_buildAssetGraph();
|
|
75
|
+
logger.info({
|
|
76
|
+
message: 'Done building asset graph',
|
|
77
|
+
origin: '@atlaspack/cli',
|
|
78
|
+
});
|
|
91
79
|
process.exit(0);
|
|
92
80
|
} catch (err) {
|
|
93
81
|
handleUncaughtException(err);
|