@atlaspack/cli 2.13.25-typescript-5b4d3ad41.0 → 2.13.25
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/CHANGELOG.md +15 -0
- package/lib/applyOptions.js +0 -3
- package/lib/cli.js +3 -6
- package/lib/handleUncaughtException.js +1 -3
- package/lib/makeDebugCommand.js +0 -2
- package/lib/normalizeOptions.js +4 -5
- package/lib/options.js +0 -2
- package/package.json +19 -21
- package/src/{applyOptions.ts → applyOptions.js} +8 -5
- package/src/{cli.ts → cli.js} +8 -8
- package/src/{handleUncaughtException.ts → handleUncaughtException.js} +6 -8
- package/src/{makeDebugCommand.ts → makeDebugCommand.js} +9 -12
- package/src/{normalizeOptions.ts → normalizeOptions.js} +7 -7
- package/src/{options.ts → options.js} +5 -5
- package/LICENSE +0 -201
- package/lib/applyOptions.d.ts +0 -5
- package/lib/cli.d.ts +0 -1
- package/lib/handleUncaughtException.d.ts +0 -2
- package/lib/makeDebugCommand.d.ts +0 -2
- package/lib/normalizeOptions.d.ts +0 -40
- package/lib/options.d.ts +0 -4
- package/tsconfig.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaspack/cli
|
|
2
2
|
|
|
3
|
+
## 2.13.25
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd)]:
|
|
8
|
+
- @atlaspack/feature-flags@2.20.0
|
|
9
|
+
- @atlaspack/core@2.20.0
|
|
10
|
+
- @atlaspack/fs@2.15.16
|
|
11
|
+
- @atlaspack/utils@2.17.3
|
|
12
|
+
- @atlaspack/reporter-cli@2.17.3
|
|
13
|
+
- @atlaspack/config-default@3.1.23
|
|
14
|
+
- @atlaspack/package-manager@2.14.21
|
|
15
|
+
- @atlaspack/reporter-dev-server@2.14.21
|
|
16
|
+
- @atlaspack/reporter-tracer@2.14.21
|
|
17
|
+
|
|
3
18
|
## 2.13.24
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/lib/applyOptions.js
CHANGED
|
@@ -12,15 +12,12 @@ function _commander() {
|
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
// @ts-expect-error TS2305
|
|
16
|
-
|
|
17
15
|
function applyOptions(cmd, options) {
|
|
18
16
|
for (let opt in options) {
|
|
19
17
|
const option = options[opt];
|
|
20
18
|
if (option instanceof _commander().default.Option) {
|
|
21
19
|
cmd.addOption(option);
|
|
22
20
|
} else if (Array.isArray(option)) {
|
|
23
|
-
// @ts-expect-error TS2345
|
|
24
21
|
cmd.option(opt, ...option);
|
|
25
22
|
} else if (typeof option === 'string') {
|
|
26
23
|
cmd.option(opt, option);
|
package/lib/cli.js
CHANGED
|
@@ -92,6 +92,7 @@ program.on('--help', function () {
|
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
// Override to output option description if argument was missing
|
|
95
|
+
// $FlowFixMe[prop-missing]
|
|
95
96
|
_commander().default.Command.prototype.optionMissingArgument = function (option) {
|
|
96
97
|
_logger().INTERNAL_ORIGINAL_CONSOLE.error("error: option `%s' argument missing", option.flags);
|
|
97
98
|
_logger().INTERNAL_ORIGINAL_CONSOLE.log(program.createHelp().optionDescription(option));
|
|
@@ -105,10 +106,7 @@ if (!args[2] || !program.commands.some(c => c.name() === args[2])) {
|
|
|
105
106
|
args.splice(2, 0, 'serve');
|
|
106
107
|
}
|
|
107
108
|
program.parse(args);
|
|
108
|
-
|
|
109
|
-
// @ts-expect-error TS7019
|
|
110
109
|
function runCommand(...args) {
|
|
111
|
-
// @ts-expect-error TS2556
|
|
112
110
|
run(...args).catch(_handleUncaughtException.handleUncaughtException);
|
|
113
111
|
}
|
|
114
112
|
async function run(entries, _opts,
|
|
@@ -131,10 +129,8 @@ command) {
|
|
|
131
129
|
});
|
|
132
130
|
let disposable = new (_events().Disposable)();
|
|
133
131
|
let unsubscribe;
|
|
134
|
-
// @ts-expect-error TS7034
|
|
135
132
|
let isExiting;
|
|
136
133
|
async function exit(exitCode = 0) {
|
|
137
|
-
// @ts-expect-error TS7005
|
|
138
134
|
if (isExiting) {
|
|
139
135
|
return;
|
|
140
136
|
}
|
|
@@ -145,6 +141,7 @@ command) {
|
|
|
145
141
|
await atlaspack.stopProfiling();
|
|
146
142
|
}
|
|
147
143
|
if (process.stdin.isTTY && process.stdin.isRaw) {
|
|
144
|
+
// $FlowFixMe
|
|
148
145
|
process.stdin.setRawMode(false);
|
|
149
146
|
}
|
|
150
147
|
disposable.dispose();
|
|
@@ -152,6 +149,7 @@ command) {
|
|
|
152
149
|
}
|
|
153
150
|
const isWatching = command.name() === 'watch' || command.name() === 'serve';
|
|
154
151
|
if (process.stdin.isTTY) {
|
|
152
|
+
// $FlowFixMe
|
|
155
153
|
process.stdin.setRawMode(true);
|
|
156
154
|
require('readline').emitKeypressEvents(process.stdin);
|
|
157
155
|
let stream = process.stdin.on('keypress', async (char, key) => {
|
|
@@ -187,7 +185,6 @@ command) {
|
|
|
187
185
|
});
|
|
188
186
|
}
|
|
189
187
|
if (isWatching) {
|
|
190
|
-
// @ts-expect-error TS7006
|
|
191
188
|
({
|
|
192
189
|
unsubscribe
|
|
193
190
|
} = await atlaspack.watch(err => {
|
|
@@ -65,9 +65,7 @@ async function logUncaughtError(e) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// A hack to definitely ensure we logged the uncaught exception
|
|
68
|
-
await new Promise(resolve =>
|
|
69
|
-
// @ts-expect-error TS2304
|
|
70
|
-
setTimeout(resolve, 100));
|
|
68
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
71
69
|
}
|
|
72
70
|
async function handleUncaughtException(exception) {
|
|
73
71
|
try {
|
package/lib/makeDebugCommand.js
CHANGED
|
@@ -37,8 +37,6 @@ var _applyOptions = require("./applyOptions");
|
|
|
37
37
|
var _options = require("./options");
|
|
38
38
|
var _handleUncaughtException = require("./handleUncaughtException");
|
|
39
39
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
40
|
-
// @ts-expect-error TS2305
|
|
41
|
-
|
|
42
40
|
function makeDebugCommand() {
|
|
43
41
|
const debug = new (_commander().default.Command)('debug').description('Debug commands for atlaspack');
|
|
44
42
|
const getInstance = async (args, opts, command) => {
|
package/lib/normalizeOptions.js
CHANGED
|
@@ -42,6 +42,10 @@ function parsePort(portValue) {
|
|
|
42
42
|
}
|
|
43
43
|
return parsedPort;
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
// $FlowFixMe
|
|
47
|
+
|
|
48
|
+
// $FlowFixMe
|
|
45
49
|
function shouldUseProductionDefaults(command) {
|
|
46
50
|
return command.name() === 'build' || command.production === true;
|
|
47
51
|
}
|
|
@@ -60,7 +64,6 @@ async function normalizeOptions(command, inputFS) {
|
|
|
60
64
|
process.env.NODE_ENV = nodeEnv;
|
|
61
65
|
let https = !!command.https;
|
|
62
66
|
if (command.cert != null && command.key != null) {
|
|
63
|
-
// @ts-expect-error TS2322
|
|
64
67
|
https = {
|
|
65
68
|
cert: command.cert,
|
|
66
69
|
key: command.key
|
|
@@ -104,8 +107,6 @@ async function normalizeOptions(command, inputFS) {
|
|
|
104
107
|
let {
|
|
105
108
|
publicUrl
|
|
106
109
|
} = command;
|
|
107
|
-
|
|
108
|
-
// @ts-expect-error TS2322
|
|
109
110
|
serveOptions = {
|
|
110
111
|
https,
|
|
111
112
|
port,
|
|
@@ -153,7 +154,6 @@ async function normalizeOptions(command, inputFS) {
|
|
|
153
154
|
mode,
|
|
154
155
|
hmrOptions,
|
|
155
156
|
shouldContentHash: hmrOptions ? false : command.contentHash,
|
|
156
|
-
// @ts-expect-error TS2322
|
|
157
157
|
serveOptions,
|
|
158
158
|
targets: command.target.length > 0 ? command.target : null,
|
|
159
159
|
shouldAutoInstall: command.autoinstall ?? true,
|
|
@@ -165,7 +165,6 @@ async function normalizeOptions(command, inputFS) {
|
|
|
165
165
|
lazyExcludes: normalizeIncludeExcludeList(command.lazyExclude),
|
|
166
166
|
shouldBundleIncrementally: process.env.ATLASPACK_INCREMENTAL_BUNDLING === 'false' ? false : true,
|
|
167
167
|
detailedReport: command.detailedReport != null ? {
|
|
168
|
-
// @ts-expect-error TS2345
|
|
169
168
|
assetsPerBundle: parseInt(command.detailedReport, 10)
|
|
170
169
|
} : null,
|
|
171
170
|
env: {
|
package/lib/options.js
CHANGED
|
@@ -44,7 +44,6 @@ switch (process.platform) {
|
|
|
44
44
|
watcherBackendChoices.push('watchman', 'windows');
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
|
-
// @ts-expect-error TS2367
|
|
48
47
|
case 'freebsd' || 'openbsd':
|
|
49
48
|
{
|
|
50
49
|
watcherBackendChoices.push('watchman');
|
|
@@ -80,7 +79,6 @@ const commonOptions = exports.commonOptions = {
|
|
|
80
79
|
let [name, val] = value.split('=');
|
|
81
80
|
if (name in _featureFlags().DEFAULT_FEATURE_FLAGS) {
|
|
82
81
|
let featureFlagValue;
|
|
83
|
-
// @ts-expect-error TS7053
|
|
84
82
|
if (typeof _featureFlags().DEFAULT_FEATURE_FLAGS[name] === 'boolean') {
|
|
85
83
|
if (val !== 'true' && val !== 'false') {
|
|
86
84
|
throw new Error(`Feature flag ${name} must be set to true or false`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/cli",
|
|
3
|
-
"version": "2.13.25
|
|
3
|
+
"version": "2.13.25",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -14,36 +14,34 @@
|
|
|
14
14
|
"bin": {
|
|
15
15
|
"atlaspack": "bin/atlaspack.js"
|
|
16
16
|
},
|
|
17
|
-
"main": "
|
|
18
|
-
"source": "
|
|
19
|
-
"types": "./lib/bin.d.ts",
|
|
17
|
+
"main": "lib/bin.js",
|
|
18
|
+
"source": "src/bin.js",
|
|
20
19
|
"scripts": {
|
|
21
|
-
"
|
|
20
|
+
"prepack": "./ensure-no-dev-lib.sh"
|
|
22
21
|
},
|
|
23
22
|
"engines": {
|
|
24
23
|
"node": ">= 16.0.0"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"@atlaspack/config-default": "3.1.23
|
|
28
|
-
"@atlaspack/core": "2.
|
|
29
|
-
"@atlaspack/diagnostic": "2.14.
|
|
30
|
-
"@atlaspack/events": "2.14.
|
|
31
|
-
"@atlaspack/feature-flags": "2.
|
|
32
|
-
"@atlaspack/fs": "2.15.16
|
|
33
|
-
"@atlaspack/logger": "2.14.
|
|
34
|
-
"@atlaspack/package-manager": "2.14.21
|
|
35
|
-
"@atlaspack/reporter-cli": "2.17.3
|
|
36
|
-
"@atlaspack/reporter-dev-server": "2.14.21
|
|
37
|
-
"@atlaspack/reporter-tracer": "2.14.21
|
|
38
|
-
"@atlaspack/utils": "2.17.3
|
|
26
|
+
"@atlaspack/config-default": "3.1.23",
|
|
27
|
+
"@atlaspack/core": "2.20.0",
|
|
28
|
+
"@atlaspack/diagnostic": "2.14.1",
|
|
29
|
+
"@atlaspack/events": "2.14.1",
|
|
30
|
+
"@atlaspack/feature-flags": "2.20.0",
|
|
31
|
+
"@atlaspack/fs": "2.15.16",
|
|
32
|
+
"@atlaspack/logger": "2.14.13",
|
|
33
|
+
"@atlaspack/package-manager": "2.14.21",
|
|
34
|
+
"@atlaspack/reporter-cli": "2.17.3",
|
|
35
|
+
"@atlaspack/reporter-dev-server": "2.14.21",
|
|
36
|
+
"@atlaspack/reporter-tracer": "2.14.21",
|
|
37
|
+
"@atlaspack/utils": "2.17.3",
|
|
39
38
|
"chalk": "^4.1.0",
|
|
40
39
|
"commander": "^7.0.0",
|
|
41
40
|
"get-port": "^4.2.0"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
|
-
"@atlaspack/babel-register": "2.14.2-typescript-5b4d3ad41.0",
|
|
45
43
|
"@babel/core": "^7.22.11",
|
|
44
|
+
"@atlaspack/babel-register": "2.14.1",
|
|
46
45
|
"rimraf": "^5.0.5"
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
// @
|
|
2
|
-
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
|
|
3
|
+
import commander, {
|
|
4
|
+
type commander$Command,
|
|
5
|
+
type commander$Option,
|
|
6
|
+
} from 'commander';
|
|
3
7
|
|
|
4
8
|
export interface OptionsDefinition {
|
|
5
|
-
[key: string]: string |
|
|
9
|
+
[key: string]: string | mixed[] | commander$Option;
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
export function applyOptions(
|
|
9
|
-
cmd: commander
|
|
13
|
+
cmd: commander$Command,
|
|
10
14
|
options: OptionsDefinition,
|
|
11
15
|
) {
|
|
12
16
|
for (let opt in options) {
|
|
@@ -14,7 +18,6 @@ export function applyOptions(
|
|
|
14
18
|
if (option instanceof commander.Option) {
|
|
15
19
|
cmd.addOption(option);
|
|
16
20
|
} else if (Array.isArray(option)) {
|
|
17
|
-
// @ts-expect-error TS2345
|
|
18
21
|
cmd.option(opt, ...option);
|
|
19
22
|
} else if (typeof option === 'string') {
|
|
20
23
|
cmd.option(opt, option);
|
package/src/{cli.ts → cli.js}
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
1
3
|
import {BuildError} from '@atlaspack/core';
|
|
2
4
|
import {NodeFS} from '@atlaspack/fs';
|
|
3
5
|
import {openInBrowser} from '@atlaspack/utils';
|
|
@@ -95,7 +97,8 @@ program.on('--help', function () {
|
|
|
95
97
|
});
|
|
96
98
|
|
|
97
99
|
// Override to output option description if argument was missing
|
|
98
|
-
|
|
100
|
+
// $FlowFixMe[prop-missing]
|
|
101
|
+
commander.Command.prototype.optionMissingArgument = function (option) {
|
|
99
102
|
INTERNAL_ORIGINAL_CONSOLE.error(
|
|
100
103
|
"error: option `%s' argument missing",
|
|
101
104
|
option.flags,
|
|
@@ -114,9 +117,7 @@ if (!args[2] || !program.commands.some((c) => c.name() === args[2])) {
|
|
|
114
117
|
|
|
115
118
|
program.parse(args);
|
|
116
119
|
|
|
117
|
-
// @ts-expect-error TS7019
|
|
118
120
|
function runCommand(...args) {
|
|
119
|
-
// @ts-expect-error TS2556
|
|
120
121
|
run(...args).catch(handleUncaughtException);
|
|
121
122
|
}
|
|
122
123
|
|
|
@@ -144,11 +145,9 @@ async function run(
|
|
|
144
145
|
});
|
|
145
146
|
|
|
146
147
|
let disposable = new Disposable();
|
|
147
|
-
let unsubscribe: () => Promise<
|
|
148
|
-
// @ts-expect-error TS7034
|
|
148
|
+
let unsubscribe: () => Promise<mixed>;
|
|
149
149
|
let isExiting;
|
|
150
150
|
async function exit(exitCode: number = 0) {
|
|
151
|
-
// @ts-expect-error TS7005
|
|
152
151
|
if (isExiting) {
|
|
153
152
|
return;
|
|
154
153
|
}
|
|
@@ -161,6 +160,7 @@ async function run(
|
|
|
161
160
|
}
|
|
162
161
|
|
|
163
162
|
if (process.stdin.isTTY && process.stdin.isRaw) {
|
|
163
|
+
// $FlowFixMe
|
|
164
164
|
process.stdin.setRawMode(false);
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -170,6 +170,7 @@ async function run(
|
|
|
170
170
|
|
|
171
171
|
const isWatching = command.name() === 'watch' || command.name() === 'serve';
|
|
172
172
|
if (process.stdin.isTTY) {
|
|
173
|
+
// $FlowFixMe
|
|
173
174
|
process.stdin.setRawMode(true);
|
|
174
175
|
require('readline').emitKeypressEvents(process.stdin);
|
|
175
176
|
|
|
@@ -211,7 +212,6 @@ async function run(
|
|
|
211
212
|
}
|
|
212
213
|
|
|
213
214
|
if (isWatching) {
|
|
214
|
-
// @ts-expect-error TS7006
|
|
215
215
|
({unsubscribe} = await atlaspack.watch((err) => {
|
|
216
216
|
if (err) {
|
|
217
217
|
throw err;
|
|
@@ -243,7 +243,7 @@ async function run(
|
|
|
243
243
|
} else {
|
|
244
244
|
try {
|
|
245
245
|
await atlaspack.run();
|
|
246
|
-
} catch (err
|
|
246
|
+
} catch (err) {
|
|
247
247
|
// If an exception is thrown during Atlaspack.build, it is given to reporters in a
|
|
248
248
|
// buildFailure event, and has been shown to the user.
|
|
249
249
|
if (!(err instanceof BuildError)) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
|
|
1
3
|
import ThrowableDiagnostic from '@atlaspack/diagnostic';
|
|
2
4
|
import {prettyDiagnostic} from '@atlaspack/utils';
|
|
3
5
|
import {INTERNAL_ORIGINAL_CONSOLE} from '@atlaspack/logger';
|
|
4
6
|
import chalk from 'chalk';
|
|
5
7
|
|
|
6
|
-
export async function logUncaughtError(e:
|
|
8
|
+
export async function logUncaughtError(e: mixed) {
|
|
7
9
|
if (e instanceof ThrowableDiagnostic) {
|
|
8
10
|
for (let diagnostic of e.diagnostics) {
|
|
9
11
|
let {message, codeframe, stack, hints, documentation} =
|
|
@@ -29,17 +31,13 @@ export async function logUncaughtError(e: unknown) {
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
// A hack to definitely ensure we logged the uncaught exception
|
|
32
|
-
await new Promise(
|
|
33
|
-
(resolve: (result: Promise<undefined> | undefined) => void) =>
|
|
34
|
-
// @ts-expect-error TS2304
|
|
35
|
-
setTimeout(resolve, 100),
|
|
36
|
-
);
|
|
34
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
export async function handleUncaughtException(exception:
|
|
37
|
+
export async function handleUncaughtException(exception: mixed) {
|
|
40
38
|
try {
|
|
41
39
|
await logUncaughtError(exception);
|
|
42
|
-
} catch (err
|
|
40
|
+
} catch (err) {
|
|
43
41
|
console.error(exception);
|
|
44
42
|
console.error(err);
|
|
45
43
|
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
|
|
1
3
|
import {NodeFS} from '@atlaspack/fs';
|
|
2
4
|
import logger from '@atlaspack/logger';
|
|
3
|
-
|
|
4
|
-
import commander, {commander$Command} from 'commander';
|
|
5
|
+
import commander, {type commander$Command} from 'commander';
|
|
5
6
|
import path from 'path';
|
|
6
|
-
import {normalizeOptions, Options} from './normalizeOptions';
|
|
7
|
+
import {normalizeOptions, type Options} from './normalizeOptions';
|
|
7
8
|
import type {CommandExt} from './normalizeOptions';
|
|
8
9
|
import {applyOptions} from './applyOptions';
|
|
9
10
|
import {commonOptions} from './options';
|
|
10
11
|
import {handleUncaughtException} from './handleUncaughtException';
|
|
11
12
|
|
|
12
|
-
export function makeDebugCommand(): commander
|
|
13
|
+
export function makeDebugCommand(): commander$Command {
|
|
13
14
|
const debug = new commander.Command('debug').description(
|
|
14
15
|
'Debug commands for atlaspack',
|
|
15
16
|
);
|
|
16
|
-
const getInstance = async (
|
|
17
|
-
args: Array<string>,
|
|
18
|
-
opts: Options,
|
|
19
|
-
command: CommandExt,
|
|
20
|
-
) => {
|
|
17
|
+
const getInstance = async (args, opts, command) => {
|
|
21
18
|
let entries = args;
|
|
22
19
|
|
|
23
20
|
if (entries.length === 0) {
|
|
@@ -61,7 +58,7 @@ export function makeDebugCommand(): commander.Command {
|
|
|
61
58
|
message: 'Done invalidating cache',
|
|
62
59
|
origin: '@atlaspack/cli',
|
|
63
60
|
});
|
|
64
|
-
} catch (err
|
|
61
|
+
} catch (err) {
|
|
65
62
|
handleUncaughtException(err);
|
|
66
63
|
}
|
|
67
64
|
});
|
|
@@ -80,7 +77,7 @@ export function makeDebugCommand(): commander.Command {
|
|
|
80
77
|
origin: '@atlaspack/cli',
|
|
81
78
|
});
|
|
82
79
|
process.exit(0);
|
|
83
|
-
} catch (err
|
|
80
|
+
} catch (err) {
|
|
84
81
|
handleUncaughtException(err);
|
|
85
82
|
}
|
|
86
83
|
});
|
|
@@ -98,7 +95,7 @@ export function makeDebugCommand(): commander.Command {
|
|
|
98
95
|
origin: '@atlaspack/cli',
|
|
99
96
|
});
|
|
100
97
|
process.exit(0);
|
|
101
|
-
} catch (err
|
|
98
|
+
} catch (err) {
|
|
102
99
|
handleUncaughtException(err);
|
|
103
100
|
}
|
|
104
101
|
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
|
|
1
3
|
import ThrowableDiagnostic from '@atlaspack/diagnostic';
|
|
2
4
|
import commander from 'commander';
|
|
3
5
|
import getPort from 'get-port';
|
|
@@ -47,7 +49,7 @@ export interface Options {
|
|
|
47
49
|
logLevel?: LogLevel;
|
|
48
50
|
profile?: boolean;
|
|
49
51
|
contentHash?: boolean;
|
|
50
|
-
featureFlag?: Partial<FeatureFlags>;
|
|
52
|
+
featureFlag?: $Partial<FeatureFlags>;
|
|
51
53
|
optimize?: boolean;
|
|
52
54
|
sourceMaps?: boolean;
|
|
53
55
|
scopeHoist?: boolean;
|
|
@@ -57,8 +59,10 @@ export interface Options {
|
|
|
57
59
|
target: string[];
|
|
58
60
|
}
|
|
59
61
|
|
|
62
|
+
// $FlowFixMe
|
|
60
63
|
export interface CommandExt extends commander.Command, Options {}
|
|
61
64
|
|
|
65
|
+
// $FlowFixMe
|
|
62
66
|
function shouldUseProductionDefaults(command: CommandExt) {
|
|
63
67
|
return command.name() === 'build' || command.production === true;
|
|
64
68
|
}
|
|
@@ -82,7 +86,6 @@ export async function normalizeOptions(
|
|
|
82
86
|
|
|
83
87
|
let https = !!command.https;
|
|
84
88
|
if (command.cert != null && command.key != null) {
|
|
85
|
-
// @ts-expect-error TS2322
|
|
86
89
|
https = {
|
|
87
90
|
cert: command.cert,
|
|
88
91
|
key: command.key,
|
|
@@ -101,7 +104,7 @@ export async function normalizeOptions(
|
|
|
101
104
|
) {
|
|
102
105
|
try {
|
|
103
106
|
port = await getPort({port, host});
|
|
104
|
-
} catch (err
|
|
107
|
+
} catch (err) {
|
|
105
108
|
throw new ThrowableDiagnostic({
|
|
106
109
|
diagnostic: {
|
|
107
110
|
message: `Could not get available port: ${err.message}`,
|
|
@@ -126,7 +129,6 @@ export async function normalizeOptions(
|
|
|
126
129
|
if (command.name() === 'serve') {
|
|
127
130
|
let {publicUrl} = command;
|
|
128
131
|
|
|
129
|
-
// @ts-expect-error TS2322
|
|
130
132
|
serveOptions = {
|
|
131
133
|
https,
|
|
132
134
|
port,
|
|
@@ -152,7 +154,7 @@ export async function normalizeOptions(
|
|
|
152
154
|
|
|
153
155
|
let additionalReporters = [
|
|
154
156
|
{packageName: '@atlaspack/reporter-cli', resolveFrom: __filename},
|
|
155
|
-
...(command.reporter
|
|
157
|
+
...(command.reporter: Array<string>).map((packageName) => ({
|
|
156
158
|
packageName,
|
|
157
159
|
resolveFrom: path.join(inputFS.cwd(), 'index'),
|
|
158
160
|
})),
|
|
@@ -184,7 +186,6 @@ export async function normalizeOptions(
|
|
|
184
186
|
mode,
|
|
185
187
|
hmrOptions,
|
|
186
188
|
shouldContentHash: hmrOptions ? false : command.contentHash,
|
|
187
|
-
// @ts-expect-error TS2322
|
|
188
189
|
serveOptions,
|
|
189
190
|
targets: command.target.length > 0 ? command.target : null,
|
|
190
191
|
shouldAutoInstall: command.autoinstall ?? true,
|
|
@@ -199,7 +200,6 @@ export async function normalizeOptions(
|
|
|
199
200
|
detailedReport:
|
|
200
201
|
command.detailedReport != null
|
|
201
202
|
? {
|
|
202
|
-
// @ts-expect-error TS2345
|
|
203
203
|
assetsPerBundle: parseInt(command.detailedReport, 10),
|
|
204
204
|
}
|
|
205
205
|
: null,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
|
|
1
3
|
import {INTERNAL_ORIGINAL_CONSOLE} from '@atlaspack/logger';
|
|
2
4
|
import commander from 'commander';
|
|
3
5
|
import {DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
|
|
@@ -18,7 +20,6 @@ switch (process.platform) {
|
|
|
18
20
|
watcherBackendChoices.push('watchman', 'windows');
|
|
19
21
|
break;
|
|
20
22
|
}
|
|
21
|
-
// @ts-expect-error TS2367
|
|
22
23
|
case 'freebsd' || 'openbsd': {
|
|
23
24
|
watcherBackendChoices.push('watchman');
|
|
24
25
|
break;
|
|
@@ -47,7 +48,7 @@ export const commonOptions: OptionsDefinition = {
|
|
|
47
48
|
'--no-source-maps': 'disable sourcemaps',
|
|
48
49
|
'--target [name]': [
|
|
49
50
|
'only build given target(s)',
|
|
50
|
-
(val
|
|
51
|
+
(val, list) => list.concat([val]),
|
|
51
52
|
[],
|
|
52
53
|
],
|
|
53
54
|
'--log-level <level>': new commander.Option(
|
|
@@ -66,7 +67,7 @@ export const commonOptions: OptionsDefinition = {
|
|
|
66
67
|
],
|
|
67
68
|
'--reporter <name>': [
|
|
68
69
|
'additional reporters to run',
|
|
69
|
-
(val
|
|
70
|
+
(val, acc) => {
|
|
70
71
|
acc.push(val);
|
|
71
72
|
return acc;
|
|
72
73
|
},
|
|
@@ -74,11 +75,10 @@ export const commonOptions: OptionsDefinition = {
|
|
|
74
75
|
],
|
|
75
76
|
'--feature-flag <name=value>': [
|
|
76
77
|
'sets the value of a feature flag',
|
|
77
|
-
(value
|
|
78
|
+
(value, previousValue) => {
|
|
78
79
|
let [name, val] = value.split('=');
|
|
79
80
|
if (name in DEFAULT_FEATURE_FLAGS) {
|
|
80
81
|
let featureFlagValue;
|
|
81
|
-
// @ts-expect-error TS7053
|
|
82
82
|
if (typeof DEFAULT_FEATURE_FLAGS[name] === 'boolean') {
|
|
83
83
|
if (val !== 'true' && val !== 'false') {
|
|
84
84
|
throw new Error(
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright (c) 2024 Atlassian US., Inc.
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
package/lib/applyOptions.d.ts
DELETED
package/lib/cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import commander from 'commander';
|
|
2
|
-
import type { FileSystem } from '@atlaspack/fs';
|
|
3
|
-
import type { FeatureFlags } from '@atlaspack/feature-flags';
|
|
4
|
-
import type { InitialAtlaspackOptions, LogLevel } from '@atlaspack/types';
|
|
5
|
-
export interface Options {
|
|
6
|
-
production?: boolean;
|
|
7
|
-
autoinstall?: boolean;
|
|
8
|
-
https?: boolean;
|
|
9
|
-
cert?: string;
|
|
10
|
-
key?: string;
|
|
11
|
-
host: string;
|
|
12
|
-
port?: string;
|
|
13
|
-
hmr?: boolean;
|
|
14
|
-
hmrPort?: string;
|
|
15
|
-
hmrHost?: string;
|
|
16
|
-
publicUrl?: string;
|
|
17
|
-
detailedReport?: boolean | string;
|
|
18
|
-
reporter: string[];
|
|
19
|
-
trace?: boolean;
|
|
20
|
-
cache?: boolean;
|
|
21
|
-
cacheDir?: string;
|
|
22
|
-
watchDir?: string;
|
|
23
|
-
watchBackend?: 'watchman' | 'fs-events' | 'inotify' | 'brute-force' | 'windows';
|
|
24
|
-
watchIgnore?: string[];
|
|
25
|
-
config?: string;
|
|
26
|
-
logLevel?: LogLevel;
|
|
27
|
-
profile?: boolean;
|
|
28
|
-
contentHash?: boolean;
|
|
29
|
-
featureFlag?: Partial<FeatureFlags>;
|
|
30
|
-
optimize?: boolean;
|
|
31
|
-
sourceMaps?: boolean;
|
|
32
|
-
scopeHoist?: boolean;
|
|
33
|
-
distDir?: string;
|
|
34
|
-
lazy?: string;
|
|
35
|
-
lazyExclude?: string;
|
|
36
|
-
target: string[];
|
|
37
|
-
}
|
|
38
|
-
export interface CommandExt extends commander.Command, Options {
|
|
39
|
-
}
|
|
40
|
-
export declare function normalizeOptions(command: CommandExt, inputFS: FileSystem): Promise<InitialAtlaspackOptions>;
|
package/lib/options.d.ts
DELETED
package/tsconfig.json
DELETED