@atlaspack/cli 2.13.23 → 2.13.25-typescript-08dcc1c9b.0
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/LICENSE +201 -0
- package/lib/applyOptions.js +3 -0
- package/lib/cli.js +6 -3
- package/lib/handleUncaughtException.js +3 -1
- package/lib/makeDebugCommand.js +2 -0
- package/lib/normalizeOptions.js +5 -4
- package/lib/options.js +2 -0
- package/package.json +19 -17
- package/src/{applyOptions.js → applyOptions.ts} +5 -8
- package/src/{cli.js → cli.ts} +8 -8
- package/src/{handleUncaughtException.js → handleUncaughtException.ts} +8 -6
- package/src/{makeDebugCommand.js → makeDebugCommand.ts} +12 -9
- package/src/{normalizeOptions.js → normalizeOptions.ts} +7 -7
- package/src/{options.js → options.ts} +5 -5
- package/tsconfig.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaspack/cli
|
|
2
2
|
|
|
3
|
+
## 2.13.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`1c7865a`](https://github.com/atlassian-labs/atlaspack/commit/1c7865a64451116d94015e248302435839d347c0), [`a0b959f`](https://github.com/atlassian-labs/atlaspack/commit/a0b959fbf61fc3f820ff03c7e8988945fe40a91a)]:
|
|
8
|
+
- @atlaspack/feature-flags@2.19.2
|
|
9
|
+
- @atlaspack/core@2.19.2
|
|
10
|
+
- @atlaspack/config-default@3.1.22
|
|
11
|
+
- @atlaspack/reporter-cli@2.17.2
|
|
12
|
+
- @atlaspack/reporter-dev-server@2.14.20
|
|
13
|
+
- @atlaspack/reporter-tracer@2.14.20
|
|
14
|
+
- @atlaspack/fs@2.15.15
|
|
15
|
+
- @atlaspack/utils@2.17.2
|
|
16
|
+
- @atlaspack/package-manager@2.14.20
|
|
17
|
+
|
|
3
18
|
## 2.13.23
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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.js
CHANGED
|
@@ -12,12 +12,15 @@ 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
|
+
|
|
15
17
|
function applyOptions(cmd, options) {
|
|
16
18
|
for (let opt in options) {
|
|
17
19
|
const option = options[opt];
|
|
18
20
|
if (option instanceof _commander().default.Option) {
|
|
19
21
|
cmd.addOption(option);
|
|
20
22
|
} else if (Array.isArray(option)) {
|
|
23
|
+
// @ts-expect-error TS2345
|
|
21
24
|
cmd.option(opt, ...option);
|
|
22
25
|
} else if (typeof option === 'string') {
|
|
23
26
|
cmd.option(opt, option);
|
package/lib/cli.js
CHANGED
|
@@ -92,7 +92,6 @@ program.on('--help', function () {
|
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
// Override to output option description if argument was missing
|
|
95
|
-
// $FlowFixMe[prop-missing]
|
|
96
95
|
_commander().default.Command.prototype.optionMissingArgument = function (option) {
|
|
97
96
|
_logger().INTERNAL_ORIGINAL_CONSOLE.error("error: option `%s' argument missing", option.flags);
|
|
98
97
|
_logger().INTERNAL_ORIGINAL_CONSOLE.log(program.createHelp().optionDescription(option));
|
|
@@ -106,7 +105,10 @@ if (!args[2] || !program.commands.some(c => c.name() === args[2])) {
|
|
|
106
105
|
args.splice(2, 0, 'serve');
|
|
107
106
|
}
|
|
108
107
|
program.parse(args);
|
|
108
|
+
|
|
109
|
+
// @ts-expect-error TS7019
|
|
109
110
|
function runCommand(...args) {
|
|
111
|
+
// @ts-expect-error TS2556
|
|
110
112
|
run(...args).catch(_handleUncaughtException.handleUncaughtException);
|
|
111
113
|
}
|
|
112
114
|
async function run(entries, _opts,
|
|
@@ -129,8 +131,10 @@ command) {
|
|
|
129
131
|
});
|
|
130
132
|
let disposable = new (_events().Disposable)();
|
|
131
133
|
let unsubscribe;
|
|
134
|
+
// @ts-expect-error TS7034
|
|
132
135
|
let isExiting;
|
|
133
136
|
async function exit(exitCode = 0) {
|
|
137
|
+
// @ts-expect-error TS7005
|
|
134
138
|
if (isExiting) {
|
|
135
139
|
return;
|
|
136
140
|
}
|
|
@@ -141,7 +145,6 @@ command) {
|
|
|
141
145
|
await atlaspack.stopProfiling();
|
|
142
146
|
}
|
|
143
147
|
if (process.stdin.isTTY && process.stdin.isRaw) {
|
|
144
|
-
// $FlowFixMe
|
|
145
148
|
process.stdin.setRawMode(false);
|
|
146
149
|
}
|
|
147
150
|
disposable.dispose();
|
|
@@ -149,7 +152,6 @@ command) {
|
|
|
149
152
|
}
|
|
150
153
|
const isWatching = command.name() === 'watch' || command.name() === 'serve';
|
|
151
154
|
if (process.stdin.isTTY) {
|
|
152
|
-
// $FlowFixMe
|
|
153
155
|
process.stdin.setRawMode(true);
|
|
154
156
|
require('readline').emitKeypressEvents(process.stdin);
|
|
155
157
|
let stream = process.stdin.on('keypress', async (char, key) => {
|
|
@@ -185,6 +187,7 @@ command) {
|
|
|
185
187
|
});
|
|
186
188
|
}
|
|
187
189
|
if (isWatching) {
|
|
190
|
+
// @ts-expect-error TS7006
|
|
188
191
|
({
|
|
189
192
|
unsubscribe
|
|
190
193
|
} = await atlaspack.watch(err => {
|
|
@@ -65,7 +65,9 @@ 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 =>
|
|
68
|
+
await new Promise(resolve =>
|
|
69
|
+
// @ts-expect-error TS2304
|
|
70
|
+
setTimeout(resolve, 100));
|
|
69
71
|
}
|
|
70
72
|
async function handleUncaughtException(exception) {
|
|
71
73
|
try {
|
package/lib/makeDebugCommand.js
CHANGED
|
@@ -37,6 +37,8 @@ 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
|
+
|
|
40
42
|
function makeDebugCommand() {
|
|
41
43
|
const debug = new (_commander().default.Command)('debug').description('Debug commands for atlaspack');
|
|
42
44
|
const getInstance = async (args, opts, command) => {
|
package/lib/normalizeOptions.js
CHANGED
|
@@ -42,10 +42,6 @@ function parsePort(portValue) {
|
|
|
42
42
|
}
|
|
43
43
|
return parsedPort;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
// $FlowFixMe
|
|
47
|
-
|
|
48
|
-
// $FlowFixMe
|
|
49
45
|
function shouldUseProductionDefaults(command) {
|
|
50
46
|
return command.name() === 'build' || command.production === true;
|
|
51
47
|
}
|
|
@@ -64,6 +60,7 @@ async function normalizeOptions(command, inputFS) {
|
|
|
64
60
|
process.env.NODE_ENV = nodeEnv;
|
|
65
61
|
let https = !!command.https;
|
|
66
62
|
if (command.cert != null && command.key != null) {
|
|
63
|
+
// @ts-expect-error TS2322
|
|
67
64
|
https = {
|
|
68
65
|
cert: command.cert,
|
|
69
66
|
key: command.key
|
|
@@ -107,6 +104,8 @@ async function normalizeOptions(command, inputFS) {
|
|
|
107
104
|
let {
|
|
108
105
|
publicUrl
|
|
109
106
|
} = command;
|
|
107
|
+
|
|
108
|
+
// @ts-expect-error TS2322
|
|
110
109
|
serveOptions = {
|
|
111
110
|
https,
|
|
112
111
|
port,
|
|
@@ -154,6 +153,7 @@ async function normalizeOptions(command, inputFS) {
|
|
|
154
153
|
mode,
|
|
155
154
|
hmrOptions,
|
|
156
155
|
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,6 +165,7 @@ 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
|
|
168
169
|
assetsPerBundle: parseInt(command.detailedReport, 10)
|
|
169
170
|
} : null,
|
|
170
171
|
env: {
|
package/lib/options.js
CHANGED
|
@@ -44,6 +44,7 @@ switch (process.platform) {
|
|
|
44
44
|
watcherBackendChoices.push('watchman', 'windows');
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
|
+
// @ts-expect-error TS2367
|
|
47
48
|
case 'freebsd' || 'openbsd':
|
|
48
49
|
{
|
|
49
50
|
watcherBackendChoices.push('watchman');
|
|
@@ -79,6 +80,7 @@ const commonOptions = exports.commonOptions = {
|
|
|
79
80
|
let [name, val] = value.split('=');
|
|
80
81
|
if (name in _featureFlags().DEFAULT_FEATURE_FLAGS) {
|
|
81
82
|
let featureFlagValue;
|
|
83
|
+
// @ts-expect-error TS7053
|
|
82
84
|
if (typeof _featureFlags().DEFAULT_FEATURE_FLAGS[name] === 'boolean') {
|
|
83
85
|
if (val !== 'true' && val !== 'false') {
|
|
84
86
|
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.
|
|
3
|
+
"version": "2.13.25-typescript-08dcc1c9b.0",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -15,33 +15,35 @@
|
|
|
15
15
|
"atlaspack": "bin/atlaspack.js"
|
|
16
16
|
},
|
|
17
17
|
"main": "lib/bin.js",
|
|
18
|
-
"source": "src/bin.
|
|
18
|
+
"source": "src/bin.ts",
|
|
19
19
|
"scripts": {
|
|
20
|
-
"
|
|
20
|
+
"check-ts": "tsc --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">= 16.0.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@atlaspack/config-default": "3.1.
|
|
27
|
-
"@atlaspack/core": "2.19.
|
|
28
|
-
"@atlaspack/diagnostic": "2.14.
|
|
29
|
-
"@atlaspack/events": "2.14.
|
|
30
|
-
"@atlaspack/feature-flags": "2.19.
|
|
31
|
-
"@atlaspack/fs": "2.15.
|
|
32
|
-
"@atlaspack/logger": "2.14.
|
|
33
|
-
"@atlaspack/package-manager": "2.14.
|
|
34
|
-
"@atlaspack/reporter-cli": "2.17.
|
|
35
|
-
"@atlaspack/reporter-dev-server": "2.14.
|
|
36
|
-
"@atlaspack/reporter-tracer": "2.14.
|
|
37
|
-
"@atlaspack/utils": "2.17.
|
|
26
|
+
"@atlaspack/config-default": "3.1.23-typescript-08dcc1c9b.0",
|
|
27
|
+
"@atlaspack/core": "2.19.3-typescript-08dcc1c9b.0",
|
|
28
|
+
"@atlaspack/diagnostic": "2.14.2-typescript-08dcc1c9b.0",
|
|
29
|
+
"@atlaspack/events": "2.14.2-typescript-08dcc1c9b.0",
|
|
30
|
+
"@atlaspack/feature-flags": "2.19.3-typescript-08dcc1c9b.0",
|
|
31
|
+
"@atlaspack/fs": "2.15.16-typescript-08dcc1c9b.0",
|
|
32
|
+
"@atlaspack/logger": "2.14.14-typescript-08dcc1c9b.0",
|
|
33
|
+
"@atlaspack/package-manager": "2.14.21-typescript-08dcc1c9b.0",
|
|
34
|
+
"@atlaspack/reporter-cli": "2.17.3-typescript-08dcc1c9b.0",
|
|
35
|
+
"@atlaspack/reporter-dev-server": "2.14.21-typescript-08dcc1c9b.0",
|
|
36
|
+
"@atlaspack/reporter-tracer": "2.14.21-typescript-08dcc1c9b.0",
|
|
37
|
+
"@atlaspack/utils": "2.17.3-typescript-08dcc1c9b.0",
|
|
38
38
|
"chalk": "^4.1.0",
|
|
39
39
|
"commander": "^7.0.0",
|
|
40
40
|
"get-port": "^4.2.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
+
"@atlaspack/babel-register": "2.14.2-typescript-08dcc1c9b.0",
|
|
43
44
|
"@babel/core": "^7.22.11",
|
|
44
|
-
"@atlaspack/babel-register": "2.14.1",
|
|
45
45
|
"rimraf": "^5.0.5"
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"types": "src/bin.ts",
|
|
48
|
+
"gitHead": "08dcc1c9bcdc6ab931d55e05ccc0f45669de2f22"
|
|
47
49
|
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
// @
|
|
2
|
-
|
|
3
|
-
import commander, {
|
|
4
|
-
type commander$Command,
|
|
5
|
-
type commander$Option,
|
|
6
|
-
} from 'commander';
|
|
1
|
+
// @ts-expect-error TS2305
|
|
2
|
+
import commander, {commander$Command, commander$Option} from 'commander';
|
|
7
3
|
|
|
8
4
|
export interface OptionsDefinition {
|
|
9
|
-
[key: string]: string |
|
|
5
|
+
[key: string]: string | unknown[] | commander.Option;
|
|
10
6
|
}
|
|
11
7
|
|
|
12
8
|
export function applyOptions(
|
|
13
|
-
cmd: commander
|
|
9
|
+
cmd: commander.Command,
|
|
14
10
|
options: OptionsDefinition,
|
|
15
11
|
) {
|
|
16
12
|
for (let opt in options) {
|
|
@@ -18,6 +14,7 @@ export function applyOptions(
|
|
|
18
14
|
if (option instanceof commander.Option) {
|
|
19
15
|
cmd.addOption(option);
|
|
20
16
|
} else if (Array.isArray(option)) {
|
|
17
|
+
// @ts-expect-error TS2345
|
|
21
18
|
cmd.option(opt, ...option);
|
|
22
19
|
} else if (typeof option === 'string') {
|
|
23
20
|
cmd.option(opt, option);
|
package/src/{cli.js → cli.ts}
RENAMED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
1
|
import {BuildError} from '@atlaspack/core';
|
|
4
2
|
import {NodeFS} from '@atlaspack/fs';
|
|
5
3
|
import {openInBrowser} from '@atlaspack/utils';
|
|
@@ -97,8 +95,7 @@ program.on('--help', function () {
|
|
|
97
95
|
});
|
|
98
96
|
|
|
99
97
|
// Override to output option description if argument was missing
|
|
100
|
-
|
|
101
|
-
commander.Command.prototype.optionMissingArgument = function (option) {
|
|
98
|
+
commander.Command.prototype.optionMissingArgument = function (option: any) {
|
|
102
99
|
INTERNAL_ORIGINAL_CONSOLE.error(
|
|
103
100
|
"error: option `%s' argument missing",
|
|
104
101
|
option.flags,
|
|
@@ -117,7 +114,9 @@ if (!args[2] || !program.commands.some((c) => c.name() === args[2])) {
|
|
|
117
114
|
|
|
118
115
|
program.parse(args);
|
|
119
116
|
|
|
117
|
+
// @ts-expect-error TS7019
|
|
120
118
|
function runCommand(...args) {
|
|
119
|
+
// @ts-expect-error TS2556
|
|
121
120
|
run(...args).catch(handleUncaughtException);
|
|
122
121
|
}
|
|
123
122
|
|
|
@@ -145,9 +144,11 @@ async function run(
|
|
|
145
144
|
});
|
|
146
145
|
|
|
147
146
|
let disposable = new Disposable();
|
|
148
|
-
let unsubscribe: () => Promise<
|
|
147
|
+
let unsubscribe: () => Promise<unknown>;
|
|
148
|
+
// @ts-expect-error TS7034
|
|
149
149
|
let isExiting;
|
|
150
150
|
async function exit(exitCode: number = 0) {
|
|
151
|
+
// @ts-expect-error TS7005
|
|
151
152
|
if (isExiting) {
|
|
152
153
|
return;
|
|
153
154
|
}
|
|
@@ -160,7 +161,6 @@ async function run(
|
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
if (process.stdin.isTTY && process.stdin.isRaw) {
|
|
163
|
-
// $FlowFixMe
|
|
164
164
|
process.stdin.setRawMode(false);
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -170,7 +170,6 @@ async function run(
|
|
|
170
170
|
|
|
171
171
|
const isWatching = command.name() === 'watch' || command.name() === 'serve';
|
|
172
172
|
if (process.stdin.isTTY) {
|
|
173
|
-
// $FlowFixMe
|
|
174
173
|
process.stdin.setRawMode(true);
|
|
175
174
|
require('readline').emitKeypressEvents(process.stdin);
|
|
176
175
|
|
|
@@ -212,6 +211,7 @@ async function run(
|
|
|
212
211
|
}
|
|
213
212
|
|
|
214
213
|
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: any) {
|
|
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,11 +1,9 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
|
-
|
|
3
1
|
import ThrowableDiagnostic from '@atlaspack/diagnostic';
|
|
4
2
|
import {prettyDiagnostic} from '@atlaspack/utils';
|
|
5
3
|
import {INTERNAL_ORIGINAL_CONSOLE} from '@atlaspack/logger';
|
|
6
4
|
import chalk from 'chalk';
|
|
7
5
|
|
|
8
|
-
export async function logUncaughtError(e:
|
|
6
|
+
export async function logUncaughtError(e: unknown) {
|
|
9
7
|
if (e instanceof ThrowableDiagnostic) {
|
|
10
8
|
for (let diagnostic of e.diagnostics) {
|
|
11
9
|
let {message, codeframe, stack, hints, documentation} =
|
|
@@ -31,13 +29,17 @@ export async function logUncaughtError(e: mixed) {
|
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
// A hack to definitely ensure we logged the uncaught exception
|
|
34
|
-
await new Promise(
|
|
32
|
+
await new Promise(
|
|
33
|
+
(resolve: (result: Promise<undefined> | undefined) => void) =>
|
|
34
|
+
// @ts-expect-error TS2304
|
|
35
|
+
setTimeout(resolve, 100),
|
|
36
|
+
);
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
export async function handleUncaughtException(exception:
|
|
39
|
+
export async function handleUncaughtException(exception: unknown) {
|
|
38
40
|
try {
|
|
39
41
|
await logUncaughtError(exception);
|
|
40
|
-
} catch (err) {
|
|
42
|
+
} catch (err: any) {
|
|
41
43
|
console.error(exception);
|
|
42
44
|
console.error(err);
|
|
43
45
|
}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
|
-
|
|
3
1
|
import {NodeFS} from '@atlaspack/fs';
|
|
4
2
|
import logger from '@atlaspack/logger';
|
|
5
|
-
|
|
3
|
+
// @ts-expect-error TS2305
|
|
4
|
+
import commander, {commander$Command} from 'commander';
|
|
6
5
|
import path from 'path';
|
|
7
|
-
import {normalizeOptions,
|
|
6
|
+
import {normalizeOptions, Options} from './normalizeOptions';
|
|
8
7
|
import type {CommandExt} from './normalizeOptions';
|
|
9
8
|
import {applyOptions} from './applyOptions';
|
|
10
9
|
import {commonOptions} from './options';
|
|
11
10
|
import {handleUncaughtException} from './handleUncaughtException';
|
|
12
11
|
|
|
13
|
-
export function makeDebugCommand(): commander
|
|
12
|
+
export function makeDebugCommand(): commander.Command {
|
|
14
13
|
const debug = new commander.Command('debug').description(
|
|
15
14
|
'Debug commands for atlaspack',
|
|
16
15
|
);
|
|
17
|
-
const getInstance = async (
|
|
16
|
+
const getInstance = async (
|
|
17
|
+
args: Array<string>,
|
|
18
|
+
opts: Options,
|
|
19
|
+
command: CommandExt,
|
|
20
|
+
) => {
|
|
18
21
|
let entries = args;
|
|
19
22
|
|
|
20
23
|
if (entries.length === 0) {
|
|
@@ -58,7 +61,7 @@ export function makeDebugCommand(): commander$Command {
|
|
|
58
61
|
message: 'Done invalidating cache',
|
|
59
62
|
origin: '@atlaspack/cli',
|
|
60
63
|
});
|
|
61
|
-
} catch (err) {
|
|
64
|
+
} catch (err: any) {
|
|
62
65
|
handleUncaughtException(err);
|
|
63
66
|
}
|
|
64
67
|
});
|
|
@@ -77,7 +80,7 @@ export function makeDebugCommand(): commander$Command {
|
|
|
77
80
|
origin: '@atlaspack/cli',
|
|
78
81
|
});
|
|
79
82
|
process.exit(0);
|
|
80
|
-
} catch (err) {
|
|
83
|
+
} catch (err: any) {
|
|
81
84
|
handleUncaughtException(err);
|
|
82
85
|
}
|
|
83
86
|
});
|
|
@@ -95,7 +98,7 @@ export function makeDebugCommand(): commander$Command {
|
|
|
95
98
|
origin: '@atlaspack/cli',
|
|
96
99
|
});
|
|
97
100
|
process.exit(0);
|
|
98
|
-
} catch (err) {
|
|
101
|
+
} catch (err: any) {
|
|
99
102
|
handleUncaughtException(err);
|
|
100
103
|
}
|
|
101
104
|
});
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
|
-
|
|
3
1
|
import ThrowableDiagnostic from '@atlaspack/diagnostic';
|
|
4
2
|
import commander from 'commander';
|
|
5
3
|
import getPort from 'get-port';
|
|
@@ -49,7 +47,7 @@ export interface Options {
|
|
|
49
47
|
logLevel?: LogLevel;
|
|
50
48
|
profile?: boolean;
|
|
51
49
|
contentHash?: boolean;
|
|
52
|
-
featureFlag?:
|
|
50
|
+
featureFlag?: Partial<FeatureFlags>;
|
|
53
51
|
optimize?: boolean;
|
|
54
52
|
sourceMaps?: boolean;
|
|
55
53
|
scopeHoist?: boolean;
|
|
@@ -59,10 +57,8 @@ export interface Options {
|
|
|
59
57
|
target: string[];
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
// $FlowFixMe
|
|
63
60
|
export interface CommandExt extends commander.Command, Options {}
|
|
64
61
|
|
|
65
|
-
// $FlowFixMe
|
|
66
62
|
function shouldUseProductionDefaults(command: CommandExt) {
|
|
67
63
|
return command.name() === 'build' || command.production === true;
|
|
68
64
|
}
|
|
@@ -86,6 +82,7 @@ export async function normalizeOptions(
|
|
|
86
82
|
|
|
87
83
|
let https = !!command.https;
|
|
88
84
|
if (command.cert != null && command.key != null) {
|
|
85
|
+
// @ts-expect-error TS2322
|
|
89
86
|
https = {
|
|
90
87
|
cert: command.cert,
|
|
91
88
|
key: command.key,
|
|
@@ -104,7 +101,7 @@ export async function normalizeOptions(
|
|
|
104
101
|
) {
|
|
105
102
|
try {
|
|
106
103
|
port = await getPort({port, host});
|
|
107
|
-
} catch (err) {
|
|
104
|
+
} catch (err: any) {
|
|
108
105
|
throw new ThrowableDiagnostic({
|
|
109
106
|
diagnostic: {
|
|
110
107
|
message: `Could not get available port: ${err.message}`,
|
|
@@ -129,6 +126,7 @@ export async function normalizeOptions(
|
|
|
129
126
|
if (command.name() === 'serve') {
|
|
130
127
|
let {publicUrl} = command;
|
|
131
128
|
|
|
129
|
+
// @ts-expect-error TS2322
|
|
132
130
|
serveOptions = {
|
|
133
131
|
https,
|
|
134
132
|
port,
|
|
@@ -154,7 +152,7 @@ export async function normalizeOptions(
|
|
|
154
152
|
|
|
155
153
|
let additionalReporters = [
|
|
156
154
|
{packageName: '@atlaspack/reporter-cli', resolveFrom: __filename},
|
|
157
|
-
...(command.reporter
|
|
155
|
+
...(command.reporter as Array<string>).map((packageName) => ({
|
|
158
156
|
packageName,
|
|
159
157
|
resolveFrom: path.join(inputFS.cwd(), 'index'),
|
|
160
158
|
})),
|
|
@@ -186,6 +184,7 @@ export async function normalizeOptions(
|
|
|
186
184
|
mode,
|
|
187
185
|
hmrOptions,
|
|
188
186
|
shouldContentHash: hmrOptions ? false : command.contentHash,
|
|
187
|
+
// @ts-expect-error TS2322
|
|
189
188
|
serveOptions,
|
|
190
189
|
targets: command.target.length > 0 ? command.target : null,
|
|
191
190
|
shouldAutoInstall: command.autoinstall ?? true,
|
|
@@ -200,6 +199,7 @@ export async function normalizeOptions(
|
|
|
200
199
|
detailedReport:
|
|
201
200
|
command.detailedReport != null
|
|
202
201
|
? {
|
|
202
|
+
// @ts-expect-error TS2345
|
|
203
203
|
assetsPerBundle: parseInt(command.detailedReport, 10),
|
|
204
204
|
}
|
|
205
205
|
: null,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
|
-
|
|
3
1
|
import {INTERNAL_ORIGINAL_CONSOLE} from '@atlaspack/logger';
|
|
4
2
|
import commander from 'commander';
|
|
5
3
|
import {DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
|
|
@@ -20,6 +18,7 @@ switch (process.platform) {
|
|
|
20
18
|
watcherBackendChoices.push('watchman', 'windows');
|
|
21
19
|
break;
|
|
22
20
|
}
|
|
21
|
+
// @ts-expect-error TS2367
|
|
23
22
|
case 'freebsd' || 'openbsd': {
|
|
24
23
|
watcherBackendChoices.push('watchman');
|
|
25
24
|
break;
|
|
@@ -48,7 +47,7 @@ export const commonOptions: OptionsDefinition = {
|
|
|
48
47
|
'--no-source-maps': 'disable sourcemaps',
|
|
49
48
|
'--target [name]': [
|
|
50
49
|
'only build given target(s)',
|
|
51
|
-
(val, list) => list.concat([val]),
|
|
50
|
+
(val: any, list: any) => list.concat([val]),
|
|
52
51
|
[],
|
|
53
52
|
],
|
|
54
53
|
'--log-level <level>': new commander.Option(
|
|
@@ -67,7 +66,7 @@ export const commonOptions: OptionsDefinition = {
|
|
|
67
66
|
],
|
|
68
67
|
'--reporter <name>': [
|
|
69
68
|
'additional reporters to run',
|
|
70
|
-
(val, acc) => {
|
|
69
|
+
(val: any, acc: any) => {
|
|
71
70
|
acc.push(val);
|
|
72
71
|
return acc;
|
|
73
72
|
},
|
|
@@ -75,10 +74,11 @@ export const commonOptions: OptionsDefinition = {
|
|
|
75
74
|
],
|
|
76
75
|
'--feature-flag <name=value>': [
|
|
77
76
|
'sets the value of a feature flag',
|
|
78
|
-
(value, previousValue) => {
|
|
77
|
+
(value: any, previousValue: any) => {
|
|
79
78
|
let [name, val] = value.split('=');
|
|
80
79
|
if (name in DEFAULT_FEATURE_FLAGS) {
|
|
81
80
|
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/tsconfig.json
ADDED