nitro-nightly 3.1.0-20251028-004953-57503e42 → 3.1.0-20251028-110430-e607b753
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/dist/_build/assets.mjs +235 -0
- package/dist/_build/build.mjs +21 -0
- package/dist/_build/config.mjs +124 -0
- package/dist/_build/info.mjs +39 -0
- package/dist/_build/plugins.mjs +1041 -0
- package/dist/_build/prepare.mjs +17 -0
- package/dist/{_chunks/build2.mjs → _build/rolldown.mjs} +238 -64
- package/dist/_build/rollup.mjs +404 -0
- package/dist/_build/snapshot.mjs +61 -0
- package/dist/_build/types.mjs +268 -0
- package/dist/_build/vite.mjs +3266 -0
- package/dist/{cli → _cli}/build.mjs +2 -3
- package/dist/_cli/dev.mjs +205 -0
- package/dist/{cli/index2.mjs → _cli/index.mjs} +1 -2
- package/dist/{cli → _cli}/list.mjs +2 -3
- package/dist/{cli → _cli}/prepare.mjs +2 -3
- package/dist/{cli → _cli}/run.mjs +2 -3
- package/dist/_deps/@jridgewell/gen-mapping.mjs +189 -0
- package/dist/_deps/@jridgewell/remapping.mjs +137 -0
- package/dist/_deps/@jridgewell/resolve-uri.mjs +231 -0
- package/dist/_deps/@jridgewell/sourcemap-codec.mjs +173 -0
- package/dist/_deps/@jridgewell/trace-mapping.mjs +170 -0
- package/dist/_deps/@pi0/vite-plugin-fullstack.mjs +575 -0
- package/dist/_deps/@rollup/plugin-alias.mjs +89 -0
- package/dist/_deps/@rollup/plugin-commonjs.mjs +2376 -0
- package/dist/{_chunks/index2.mjs → _deps/@rollup/plugin-inject.mjs} +5 -90
- package/dist/_deps/@rollup/plugin-json.mjs +37 -0
- package/dist/_deps/@rollup/plugin-node-resolve.mjs +1386 -0
- package/dist/_deps/@rollup/plugin-replace.mjs +133 -0
- package/dist/_deps/@rollup/pluginutils.mjs +346 -0
- package/dist/_deps/acorn.mjs +6225 -0
- package/dist/_deps/c12.mjs +510 -0
- package/dist/_deps/chokidar.mjs +1428 -0
- package/dist/_deps/citty.mjs +460 -0
- package/dist/_deps/commondir.mjs +77 -0
- package/dist/_deps/compatx.mjs +76 -0
- package/dist/_deps/confbox.mjs +300 -0
- package/dist/_deps/debug.mjs +885 -0
- package/dist/_deps/deepmerge.mjs +147 -0
- package/dist/_deps/depd.mjs +550 -0
- package/dist/_deps/dot-prop.mjs +282 -0
- package/dist/_deps/dotenv.mjs +555 -0
- package/dist/_deps/duplexer.mjs +1 -0
- package/dist/_deps/ee-first.mjs +104 -0
- package/dist/_deps/encodeurl.mjs +69 -0
- package/dist/_deps/escape-html.mjs +87 -0
- package/dist/_deps/escape-string-regexp.mjs +13 -0
- package/dist/_deps/estree-walker.mjs +433 -0
- package/dist/_deps/etag.mjs +147 -0
- package/dist/_deps/exsolve.mjs +1416 -0
- package/dist/_deps/fdir.mjs +569 -0
- package/dist/_deps/fresh.mjs +145 -0
- package/dist/_deps/function-bind.mjs +106 -0
- package/dist/{_chunks/index4.mjs → _deps/giget.mjs} +21 -776
- package/dist/_deps/gzip-size.mjs +19 -0
- package/dist/_deps/hasown.mjs +19 -0
- package/dist/_deps/http-errors.mjs +307 -0
- package/dist/_deps/httpxy.mjs +580 -0
- package/dist/_deps/inherits.mjs +57 -0
- package/dist/_deps/is-core-module.mjs +596 -0
- package/dist/_deps/is-module.mjs +25 -0
- package/dist/_deps/is-reference.mjs +31 -0
- package/dist/_deps/js-tokens.mjs +411 -0
- package/dist/_deps/knitwork.mjs +172 -0
- package/dist/_deps/local-pkg.mjs +163 -0
- package/dist/_deps/magic-string.mjs +1296 -0
- package/dist/_deps/mime-db.mjs +11685 -0
- package/dist/_deps/mime-types.mjs +287 -0
- package/dist/_deps/mime.mjs +1172 -0
- package/dist/_deps/mlly.mjs +2413 -0
- package/dist/_deps/ms.mjs +172 -0
- package/dist/_deps/node-fetch-native.mjs +3 -0
- package/dist/_deps/nypm.mjs +219 -0
- package/dist/_deps/on-finished.mjs +246 -0
- package/dist/_deps/parseurl.mjs +168 -0
- package/dist/_deps/path-parse.mjs +85 -0
- package/dist/{_chunks/pathe.M-eThtNZ.mjs → _deps/pathe.mjs} +48 -1
- package/dist/_deps/perfect-debounce.mjs +88 -0
- package/dist/_deps/picomatch.mjs +2144 -0
- package/dist/_deps/pkg-types.mjs +247 -0
- package/dist/_deps/pretty-bytes.mjs +180 -0
- package/dist/_deps/quansync.mjs +99 -0
- package/dist/_deps/range-parser.mjs +171 -0
- package/dist/_deps/rc9.mjs +219 -0
- package/dist/_deps/readdirp.mjs +245 -0
- package/dist/_deps/resolve.mjs +1260 -0
- package/dist/_deps/rou3.mjs +326 -0
- package/dist/_deps/send.mjs +1022 -0
- package/dist/_deps/serve-static.mjs +228 -0
- package/dist/_deps/setprototypeof.mjs +26 -0
- package/dist/_deps/statuses.mjs +457 -0
- package/dist/_deps/strip-literal.mjs +67 -0
- package/dist/_deps/supports-color.mjs +44 -0
- package/dist/_deps/tinyexec.mjs +552 -0
- package/dist/_deps/tinyglobby.mjs +293 -0
- package/dist/_deps/toidentifier.mjs +41 -0
- package/dist/_deps/ultrahtml.mjs +3 -0
- package/dist/_deps/unimport.mjs +2267 -0
- package/dist/_deps/unplugin-utils.mjs +65 -0
- package/dist/_deps/unplugin.mjs +1294 -0
- package/dist/_deps/untyped.mjs +375 -0
- package/dist/{_chunks/info.mjs → _deps/unwasm.mjs} +8 -4122
- package/dist/_deps/webpack-virtual-modules.mjs +360 -0
- package/dist/_presets/_all.mjs +59 -0
- package/dist/_presets/_nitro.mjs +74 -0
- package/dist/_presets/_resolve.mjs +64 -0
- package/dist/_presets/_static.mjs +69 -0
- package/dist/_presets/_types.mjs +3 -0
- package/dist/_presets/_utils.mjs +31 -0
- package/dist/_presets/alwaysdata.mjs +17 -0
- package/dist/_presets/aws-amplify.mjs +111 -0
- package/dist/_presets/aws-lambda.mjs +23 -0
- package/dist/_presets/azure.mjs +162 -0
- package/dist/_presets/bun.mjs +19 -0
- package/dist/_presets/cleavr.mjs +15 -0
- package/dist/_presets/cloudflare.mjs +608 -0
- package/dist/_presets/deno.mjs +196 -0
- package/dist/_presets/digitalocean.mjs +14 -0
- package/dist/_presets/firebase.mjs +47 -0
- package/dist/_presets/flightcontrol.mjs +14 -0
- package/dist/_presets/genezio.mjs +13 -0
- package/dist/_presets/heroku.mjs +14 -0
- package/dist/_presets/iis.mjs +194 -0
- package/dist/_presets/index.mjs +62 -0
- package/dist/_presets/koyeb.mjs +14 -0
- package/dist/_presets/netlify.mjs +241 -0
- package/dist/_presets/node.mjs +54 -0
- package/dist/_presets/platform.mjs +14 -0
- package/dist/_presets/render.mjs +14 -0
- package/dist/_presets/standard.mjs +23 -0
- package/dist/_presets/stormkit.mjs +18 -0
- package/dist/_presets/vercel.mjs +365 -0
- package/dist/_presets/winterjs.mjs +22 -0
- package/dist/_presets/zeabur.mjs +69 -0
- package/dist/_presets/zerops.mjs +27 -0
- package/dist/cli/index.mjs +7 -464
- package/dist/index.mjs +122 -34
- package/dist/vite.mjs +118 -44
- package/package.json +1 -1
- package/dist/_chunks/app.mjs +0 -19797
- package/dist/_chunks/build.mjs +0 -86
- package/dist/_chunks/build3.mjs +0 -6538
- package/dist/_chunks/detect-acorn.mjs +0 -503
- package/dist/_chunks/index.mjs +0 -22256
- package/dist/_chunks/index3.mjs +0 -1062
- package/dist/_chunks/json5.mjs +0 -68
- package/dist/_chunks/jsonc.mjs +0 -51
- package/dist/_chunks/plugin.mjs +0 -1560
- package/dist/_chunks/server.mjs +0 -254
- package/dist/_chunks/snapshot.mjs +0 -376
- package/dist/_chunks/toml.mjs +0 -259
- package/dist/_chunks/yaml.mjs +0 -86
- package/dist/cli/dev.mjs +0 -95
- package/dist/presets.mjs +0 -2494
- /package/dist/{cli → _cli}/common.mjs +0 -0
package/dist/cli/index.mjs
CHANGED
|
@@ -1,463 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { colors } from 'consola/utils';
|
|
2
|
+
import { r as runMain, d as defineCommand } from '../_deps/citty.mjs';
|
|
4
3
|
import { version } from 'nitro/meta';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (Array.isArray(val)) {
|
|
8
|
-
return val;
|
|
9
|
-
}
|
|
10
|
-
return val === void 0 ? [] : [val];
|
|
11
|
-
}
|
|
12
|
-
function formatLineColumns(lines, linePrefix = "") {
|
|
13
|
-
const maxLengh = [];
|
|
14
|
-
for (const line of lines) {
|
|
15
|
-
for (const [i, element] of line.entries()) {
|
|
16
|
-
maxLengh[i] = Math.max(maxLengh[i] || 0, element.length);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return lines.map(
|
|
20
|
-
(l) => l.map(
|
|
21
|
-
(c, i) => linePrefix + c[i === 0 ? "padStart" : "padEnd"](maxLengh[i])
|
|
22
|
-
).join(" ")
|
|
23
|
-
).join("\n");
|
|
24
|
-
}
|
|
25
|
-
function resolveValue(input) {
|
|
26
|
-
return typeof input === "function" ? input() : input;
|
|
27
|
-
}
|
|
28
|
-
class CLIError extends Error {
|
|
29
|
-
constructor(message, code) {
|
|
30
|
-
super(message);
|
|
31
|
-
this.code = code;
|
|
32
|
-
this.name = "CLIError";
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const NUMBER_CHAR_RE = /\d/;
|
|
37
|
-
const STR_SPLITTERS = ["-", "_", "/", "."];
|
|
38
|
-
function isUppercase(char = "") {
|
|
39
|
-
if (NUMBER_CHAR_RE.test(char)) {
|
|
40
|
-
return void 0;
|
|
41
|
-
}
|
|
42
|
-
return char !== char.toLowerCase();
|
|
43
|
-
}
|
|
44
|
-
function splitByCase(str, separators) {
|
|
45
|
-
const splitters = STR_SPLITTERS;
|
|
46
|
-
const parts = [];
|
|
47
|
-
if (!str || typeof str !== "string") {
|
|
48
|
-
return parts;
|
|
49
|
-
}
|
|
50
|
-
let buff = "";
|
|
51
|
-
let previousUpper;
|
|
52
|
-
let previousSplitter;
|
|
53
|
-
for (const char of str) {
|
|
54
|
-
const isSplitter = splitters.includes(char);
|
|
55
|
-
if (isSplitter === true) {
|
|
56
|
-
parts.push(buff);
|
|
57
|
-
buff = "";
|
|
58
|
-
previousUpper = void 0;
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
const isUpper = isUppercase(char);
|
|
62
|
-
if (previousSplitter === false) {
|
|
63
|
-
if (previousUpper === false && isUpper === true) {
|
|
64
|
-
parts.push(buff);
|
|
65
|
-
buff = char;
|
|
66
|
-
previousUpper = isUpper;
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (previousUpper === true && isUpper === false && buff.length > 1) {
|
|
70
|
-
const lastChar = buff.at(-1);
|
|
71
|
-
parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
|
|
72
|
-
buff = lastChar + char;
|
|
73
|
-
previousUpper = isUpper;
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
buff += char;
|
|
78
|
-
previousUpper = isUpper;
|
|
79
|
-
previousSplitter = isSplitter;
|
|
80
|
-
}
|
|
81
|
-
parts.push(buff);
|
|
82
|
-
return parts;
|
|
83
|
-
}
|
|
84
|
-
function upperFirst(str) {
|
|
85
|
-
return str ? str[0].toUpperCase() + str.slice(1) : "";
|
|
86
|
-
}
|
|
87
|
-
function lowerFirst(str) {
|
|
88
|
-
return str ? str[0].toLowerCase() + str.slice(1) : "";
|
|
89
|
-
}
|
|
90
|
-
function pascalCase(str, opts) {
|
|
91
|
-
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(p)).join("") : "";
|
|
92
|
-
}
|
|
93
|
-
function camelCase(str, opts) {
|
|
94
|
-
return lowerFirst(pascalCase(str || ""));
|
|
95
|
-
}
|
|
96
|
-
function kebabCase(str, joiner) {
|
|
97
|
-
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join("-") : "";
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function toArr(any) {
|
|
101
|
-
return any == void 0 ? [] : Array.isArray(any) ? any : [any];
|
|
102
|
-
}
|
|
103
|
-
function toVal(out, key, val, opts) {
|
|
104
|
-
let x;
|
|
105
|
-
const old = out[key];
|
|
106
|
-
const nxt = ~opts.string.indexOf(key) ? val == void 0 || val === true ? "" : String(val) : typeof val === "boolean" ? val : ~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
|
|
107
|
-
out[key] = old == void 0 ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
|
108
|
-
}
|
|
109
|
-
function parseRawArgs(args = [], opts = {}) {
|
|
110
|
-
let k;
|
|
111
|
-
let arr;
|
|
112
|
-
let arg;
|
|
113
|
-
let name;
|
|
114
|
-
let val;
|
|
115
|
-
const out = { _: [] };
|
|
116
|
-
let i = 0;
|
|
117
|
-
let j = 0;
|
|
118
|
-
let idx = 0;
|
|
119
|
-
const len = args.length;
|
|
120
|
-
const alibi = opts.alias !== void 0;
|
|
121
|
-
const strict = opts.unknown !== void 0;
|
|
122
|
-
const defaults = opts.default !== void 0;
|
|
123
|
-
opts.alias = opts.alias || {};
|
|
124
|
-
opts.string = toArr(opts.string);
|
|
125
|
-
opts.boolean = toArr(opts.boolean);
|
|
126
|
-
if (alibi) {
|
|
127
|
-
for (k in opts.alias) {
|
|
128
|
-
arr = opts.alias[k] = toArr(opts.alias[k]);
|
|
129
|
-
for (i = 0; i < arr.length; i++) {
|
|
130
|
-
(opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
for (i = opts.boolean.length; i-- > 0; ) {
|
|
135
|
-
arr = opts.alias[opts.boolean[i]] || [];
|
|
136
|
-
for (j = arr.length; j-- > 0; ) {
|
|
137
|
-
opts.boolean.push(arr[j]);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
for (i = opts.string.length; i-- > 0; ) {
|
|
141
|
-
arr = opts.alias[opts.string[i]] || [];
|
|
142
|
-
for (j = arr.length; j-- > 0; ) {
|
|
143
|
-
opts.string.push(arr[j]);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (defaults) {
|
|
147
|
-
for (k in opts.default) {
|
|
148
|
-
name = typeof opts.default[k];
|
|
149
|
-
arr = opts.alias[k] = opts.alias[k] || [];
|
|
150
|
-
if (opts[name] !== void 0) {
|
|
151
|
-
opts[name].push(k);
|
|
152
|
-
for (i = 0; i < arr.length; i++) {
|
|
153
|
-
opts[name].push(arr[i]);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
const keys = strict ? Object.keys(opts.alias) : [];
|
|
159
|
-
for (i = 0; i < len; i++) {
|
|
160
|
-
arg = args[i];
|
|
161
|
-
if (arg === "--") {
|
|
162
|
-
out._ = out._.concat(args.slice(++i));
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
for (j = 0; j < arg.length; j++) {
|
|
166
|
-
if (arg.charCodeAt(j) !== 45) {
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (j === 0) {
|
|
171
|
-
out._.push(arg);
|
|
172
|
-
} else if (arg.substring(j, j + 3) === "no-") {
|
|
173
|
-
name = arg.slice(Math.max(0, j + 3));
|
|
174
|
-
if (strict && !~keys.indexOf(name)) {
|
|
175
|
-
return opts.unknown(arg);
|
|
176
|
-
}
|
|
177
|
-
out[name] = false;
|
|
178
|
-
} else {
|
|
179
|
-
for (idx = j + 1; idx < arg.length; idx++) {
|
|
180
|
-
if (arg.charCodeAt(idx) === 61) {
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
name = arg.substring(j, idx);
|
|
185
|
-
val = arg.slice(Math.max(0, ++idx)) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
|
|
186
|
-
arr = j === 2 ? [name] : name;
|
|
187
|
-
for (idx = 0; idx < arr.length; idx++) {
|
|
188
|
-
name = arr[idx];
|
|
189
|
-
if (strict && !~keys.indexOf(name)) {
|
|
190
|
-
return opts.unknown("-".repeat(j) + name);
|
|
191
|
-
}
|
|
192
|
-
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
if (defaults) {
|
|
197
|
-
for (k in opts.default) {
|
|
198
|
-
if (out[k] === void 0) {
|
|
199
|
-
out[k] = opts.default[k];
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (alibi) {
|
|
204
|
-
for (k in out) {
|
|
205
|
-
arr = opts.alias[k] || [];
|
|
206
|
-
while (arr.length > 0) {
|
|
207
|
-
out[arr.shift()] = out[k];
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
return out;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function parseArgs(rawArgs, argsDef) {
|
|
215
|
-
const parseOptions = {
|
|
216
|
-
boolean: [],
|
|
217
|
-
string: [],
|
|
218
|
-
mixed: [],
|
|
219
|
-
alias: {},
|
|
220
|
-
default: {}
|
|
221
|
-
};
|
|
222
|
-
const args = resolveArgs(argsDef);
|
|
223
|
-
for (const arg of args) {
|
|
224
|
-
if (arg.type === "positional") {
|
|
225
|
-
continue;
|
|
226
|
-
}
|
|
227
|
-
if (arg.type === "string") {
|
|
228
|
-
parseOptions.string.push(arg.name);
|
|
229
|
-
} else if (arg.type === "boolean") {
|
|
230
|
-
parseOptions.boolean.push(arg.name);
|
|
231
|
-
}
|
|
232
|
-
if (arg.default !== void 0) {
|
|
233
|
-
parseOptions.default[arg.name] = arg.default;
|
|
234
|
-
}
|
|
235
|
-
if (arg.alias) {
|
|
236
|
-
parseOptions.alias[arg.name] = arg.alias;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
const parsed = parseRawArgs(rawArgs, parseOptions);
|
|
240
|
-
const [...positionalArguments] = parsed._;
|
|
241
|
-
const parsedArgsProxy = new Proxy(parsed, {
|
|
242
|
-
get(target, prop) {
|
|
243
|
-
return target[prop] ?? target[camelCase(prop)] ?? target[kebabCase(prop)];
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
for (const [, arg] of args.entries()) {
|
|
247
|
-
if (arg.type === "positional") {
|
|
248
|
-
const nextPositionalArgument = positionalArguments.shift();
|
|
249
|
-
if (nextPositionalArgument !== void 0) {
|
|
250
|
-
parsedArgsProxy[arg.name] = nextPositionalArgument;
|
|
251
|
-
} else if (arg.default === void 0 && arg.required !== false) {
|
|
252
|
-
throw new CLIError(
|
|
253
|
-
`Missing required positional argument: ${arg.name.toUpperCase()}`,
|
|
254
|
-
"EARG"
|
|
255
|
-
);
|
|
256
|
-
} else {
|
|
257
|
-
parsedArgsProxy[arg.name] = arg.default;
|
|
258
|
-
}
|
|
259
|
-
} else if (arg.required && parsedArgsProxy[arg.name] === void 0) {
|
|
260
|
-
throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return parsedArgsProxy;
|
|
264
|
-
}
|
|
265
|
-
function resolveArgs(argsDef) {
|
|
266
|
-
const args = [];
|
|
267
|
-
for (const [name, argDef] of Object.entries(argsDef || {})) {
|
|
268
|
-
args.push({
|
|
269
|
-
...argDef,
|
|
270
|
-
name,
|
|
271
|
-
alias: toArray(argDef.alias)
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
return args;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
function defineCommand(def) {
|
|
278
|
-
return def;
|
|
279
|
-
}
|
|
280
|
-
async function runCommand(cmd, opts) {
|
|
281
|
-
const cmdArgs = await resolveValue(cmd.args || {});
|
|
282
|
-
const parsedArgs = parseArgs(opts.rawArgs, cmdArgs);
|
|
283
|
-
const context = {
|
|
284
|
-
rawArgs: opts.rawArgs,
|
|
285
|
-
args: parsedArgs,
|
|
286
|
-
data: opts.data,
|
|
287
|
-
cmd
|
|
288
|
-
};
|
|
289
|
-
if (typeof cmd.setup === "function") {
|
|
290
|
-
await cmd.setup(context);
|
|
291
|
-
}
|
|
292
|
-
let result;
|
|
293
|
-
try {
|
|
294
|
-
const subCommands = await resolveValue(cmd.subCommands);
|
|
295
|
-
if (subCommands && Object.keys(subCommands).length > 0) {
|
|
296
|
-
const subCommandArgIndex = opts.rawArgs.findIndex(
|
|
297
|
-
(arg) => !arg.startsWith("-")
|
|
298
|
-
);
|
|
299
|
-
const subCommandName = opts.rawArgs[subCommandArgIndex];
|
|
300
|
-
if (subCommandName) {
|
|
301
|
-
if (!subCommands[subCommandName]) {
|
|
302
|
-
throw new CLIError(
|
|
303
|
-
`Unknown command \`${subCommandName}\``,
|
|
304
|
-
"E_UNKNOWN_COMMAND"
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
const subCommand = await resolveValue(subCommands[subCommandName]);
|
|
308
|
-
if (subCommand) {
|
|
309
|
-
await runCommand(subCommand, {
|
|
310
|
-
rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1)
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
} else if (!cmd.run) {
|
|
314
|
-
throw new CLIError(`No command specified.`, "E_NO_COMMAND");
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
if (typeof cmd.run === "function") {
|
|
318
|
-
result = await cmd.run(context);
|
|
319
|
-
}
|
|
320
|
-
} finally {
|
|
321
|
-
if (typeof cmd.cleanup === "function") {
|
|
322
|
-
await cmd.cleanup(context);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
return { result };
|
|
326
|
-
}
|
|
327
|
-
async function resolveSubCommand(cmd, rawArgs, parent) {
|
|
328
|
-
const subCommands = await resolveValue(cmd.subCommands);
|
|
329
|
-
if (subCommands && Object.keys(subCommands).length > 0) {
|
|
330
|
-
const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
|
|
331
|
-
const subCommandName = rawArgs[subCommandArgIndex];
|
|
332
|
-
const subCommand = await resolveValue(subCommands[subCommandName]);
|
|
333
|
-
if (subCommand) {
|
|
334
|
-
return resolveSubCommand(
|
|
335
|
-
subCommand,
|
|
336
|
-
rawArgs.slice(subCommandArgIndex + 1),
|
|
337
|
-
cmd
|
|
338
|
-
);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
return [cmd, parent];
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
async function showUsage(cmd, parent) {
|
|
345
|
-
try {
|
|
346
|
-
consola.log(await renderUsage(cmd, parent) + "\n");
|
|
347
|
-
} catch (error) {
|
|
348
|
-
consola.error(error);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
async function renderUsage(cmd, parent) {
|
|
352
|
-
const cmdMeta = await resolveValue(cmd.meta || {});
|
|
353
|
-
const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
|
|
354
|
-
const parentMeta = await resolveValue(parent?.meta || {});
|
|
355
|
-
const commandName = `${parentMeta.name ? `${parentMeta.name} ` : ""}` + (cmdMeta.name || process.argv[1]);
|
|
356
|
-
const argLines = [];
|
|
357
|
-
const posLines = [];
|
|
358
|
-
const commandsLines = [];
|
|
359
|
-
const usageLine = [];
|
|
360
|
-
for (const arg of cmdArgs) {
|
|
361
|
-
if (arg.type === "positional") {
|
|
362
|
-
const name = arg.name.toUpperCase();
|
|
363
|
-
const isRequired = arg.required !== false && arg.default === void 0;
|
|
364
|
-
const defaultHint = arg.default ? `="${arg.default}"` : "";
|
|
365
|
-
posLines.push([
|
|
366
|
-
"`" + name + defaultHint + "`",
|
|
367
|
-
arg.description || "",
|
|
368
|
-
arg.valueHint ? `<${arg.valueHint}>` : ""
|
|
369
|
-
]);
|
|
370
|
-
usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
|
|
371
|
-
} else {
|
|
372
|
-
const isRequired = arg.required === true && arg.default === void 0;
|
|
373
|
-
const argStr = (arg.type === "boolean" && arg.default === true ? [
|
|
374
|
-
...(arg.alias || []).map((a) => `--no-${a}`),
|
|
375
|
-
`--no-${arg.name}`
|
|
376
|
-
].join(", ") : [...(arg.alias || []).map((a) => `-${a}`), `--${arg.name}`].join(
|
|
377
|
-
", "
|
|
378
|
-
)) + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "");
|
|
379
|
-
argLines.push([
|
|
380
|
-
"`" + argStr + (isRequired ? " (required)" : "") + "`",
|
|
381
|
-
arg.description || ""
|
|
382
|
-
]);
|
|
383
|
-
if (isRequired) {
|
|
384
|
-
usageLine.push(argStr);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
if (cmd.subCommands) {
|
|
389
|
-
const commandNames = [];
|
|
390
|
-
const subCommands = await resolveValue(cmd.subCommands);
|
|
391
|
-
for (const [name, sub] of Object.entries(subCommands)) {
|
|
392
|
-
const subCmd = await resolveValue(sub);
|
|
393
|
-
const meta = await resolveValue(subCmd?.meta);
|
|
394
|
-
commandsLines.push([`\`${name}\``, meta?.description || ""]);
|
|
395
|
-
commandNames.push(name);
|
|
396
|
-
}
|
|
397
|
-
usageLine.push(commandNames.join("|"));
|
|
398
|
-
}
|
|
399
|
-
const usageLines = [];
|
|
400
|
-
const version = cmdMeta.version || parentMeta.version;
|
|
401
|
-
usageLines.push(
|
|
402
|
-
colors.gray(
|
|
403
|
-
`${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`
|
|
404
|
-
),
|
|
405
|
-
""
|
|
406
|
-
);
|
|
407
|
-
const hasOptions = argLines.length > 0 || posLines.length > 0;
|
|
408
|
-
usageLines.push(
|
|
409
|
-
`${colors.underline(colors.bold("USAGE"))} \`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}\``,
|
|
410
|
-
""
|
|
411
|
-
);
|
|
412
|
-
if (posLines.length > 0) {
|
|
413
|
-
usageLines.push(colors.underline(colors.bold("ARGUMENTS")), "");
|
|
414
|
-
usageLines.push(formatLineColumns(posLines, " "));
|
|
415
|
-
usageLines.push("");
|
|
416
|
-
}
|
|
417
|
-
if (argLines.length > 0) {
|
|
418
|
-
usageLines.push(colors.underline(colors.bold("OPTIONS")), "");
|
|
419
|
-
usageLines.push(formatLineColumns(argLines, " "));
|
|
420
|
-
usageLines.push("");
|
|
421
|
-
}
|
|
422
|
-
if (commandsLines.length > 0) {
|
|
423
|
-
usageLines.push(colors.underline(colors.bold("COMMANDS")), "");
|
|
424
|
-
usageLines.push(formatLineColumns(commandsLines, " "));
|
|
425
|
-
usageLines.push(
|
|
426
|
-
"",
|
|
427
|
-
`Use \`${commandName} <command> --help\` for more information about a command.`
|
|
428
|
-
);
|
|
429
|
-
}
|
|
430
|
-
return usageLines.filter((l) => typeof l === "string").join("\n");
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
async function runMain(cmd, opts = {}) {
|
|
434
|
-
const rawArgs = opts.rawArgs || process.argv.slice(2);
|
|
435
|
-
const showUsage$1 = opts.showUsage || showUsage;
|
|
436
|
-
try {
|
|
437
|
-
if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
|
|
438
|
-
await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
|
|
439
|
-
process.exit(0);
|
|
440
|
-
} else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
|
|
441
|
-
const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
|
|
442
|
-
if (!meta?.version) {
|
|
443
|
-
throw new CLIError("No version specified", "E_NO_VERSION");
|
|
444
|
-
}
|
|
445
|
-
consola.log(meta.version);
|
|
446
|
-
} else {
|
|
447
|
-
await runCommand(cmd, { rawArgs });
|
|
448
|
-
}
|
|
449
|
-
} catch (error) {
|
|
450
|
-
const isCLIError = error instanceof CLIError;
|
|
451
|
-
if (!isCLIError) {
|
|
452
|
-
consola.error(error, "\n");
|
|
453
|
-
}
|
|
454
|
-
if (isCLIError) {
|
|
455
|
-
await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
|
|
456
|
-
}
|
|
457
|
-
consola.error(error.message);
|
|
458
|
-
process.exit(1);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
4
|
+
import 'consola';
|
|
5
|
+
import 'consola/utils';
|
|
461
6
|
|
|
462
7
|
const main = defineCommand({
|
|
463
8
|
meta: {
|
|
@@ -466,12 +11,10 @@ const main = defineCommand({
|
|
|
466
11
|
version: version
|
|
467
12
|
},
|
|
468
13
|
subCommands: {
|
|
469
|
-
dev: () => import('
|
|
470
|
-
build: () => import('
|
|
471
|
-
prepare: () => import('
|
|
472
|
-
task: () => import('
|
|
14
|
+
dev: () => import('../_cli/dev.mjs').then((r) => r.default),
|
|
15
|
+
build: () => import('../_cli/build.mjs').then((r) => r.default),
|
|
16
|
+
prepare: () => import('../_cli/prepare.mjs').then((r) => r.default),
|
|
17
|
+
task: () => import('../_cli/index.mjs').then((r) => r.default)
|
|
473
18
|
}
|
|
474
19
|
});
|
|
475
20
|
runMain(main);
|
|
476
|
-
|
|
477
|
-
export { defineCommand as d };
|
package/dist/index.mjs
CHANGED
|
@@ -1,55 +1,143 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { b as build
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import 'node:fs';
|
|
7
|
-
import 'node:fs/promises';
|
|
1
|
+
export { a as createDevServer, c as createNitro, b as listTasks, l as loadOptions, p as prerender, r as runTask } from './_build/vite.mjs';
|
|
2
|
+
export { b as build } from './_build/build.mjs';
|
|
3
|
+
export { a as copyPublicAssets } from './_build/assets.mjs';
|
|
4
|
+
export { p as prepare } from './_build/prepare.mjs';
|
|
5
|
+
export { w as writeTypes } from './_build/types.mjs';
|
|
8
6
|
import 'node:url';
|
|
9
|
-
import '
|
|
7
|
+
import 'consola/utils';
|
|
8
|
+
import 'defu';
|
|
9
|
+
import './_deps/mime.mjs';
|
|
10
|
+
import './_deps/rou3.mjs';
|
|
11
|
+
import 'ufo';
|
|
12
|
+
import './_build/rolldown.mjs';
|
|
13
|
+
import './_deps/mlly.mjs';
|
|
14
|
+
import './_deps/acorn.mjs';
|
|
15
|
+
import 'node:module';
|
|
16
|
+
import 'node:fs';
|
|
17
|
+
import './_deps/pkg-types.mjs';
|
|
18
|
+
import './_deps/confbox.mjs';
|
|
19
|
+
import './_deps/pathe.mjs';
|
|
20
|
+
import './_deps/exsolve.mjs';
|
|
10
21
|
import 'node:path';
|
|
11
22
|
import 'node:assert';
|
|
12
23
|
import 'node:process';
|
|
13
24
|
import 'node:v8';
|
|
14
25
|
import 'node:util';
|
|
15
|
-
import '
|
|
16
|
-
import '
|
|
17
|
-
import '
|
|
18
|
-
import '
|
|
19
|
-
import '
|
|
26
|
+
import 'node:fs/promises';
|
|
27
|
+
import 'nitro/runtime/meta';
|
|
28
|
+
import './_build/config.mjs';
|
|
29
|
+
import 'unenv';
|
|
30
|
+
import './_build/plugins.mjs';
|
|
31
|
+
import './_deps/@rollup/plugin-replace.mjs';
|
|
32
|
+
import './_deps/magic-string.mjs';
|
|
33
|
+
import './_deps/@jridgewell/sourcemap-codec.mjs';
|
|
34
|
+
import './_deps/@rollup/pluginutils.mjs';
|
|
20
35
|
import 'path';
|
|
21
|
-
import '
|
|
36
|
+
import './_deps/estree-walker.mjs';
|
|
37
|
+
import './_deps/picomatch.mjs';
|
|
38
|
+
import './_deps/commondir.mjs';
|
|
39
|
+
import 'ohash';
|
|
40
|
+
import './_deps/unimport.mjs';
|
|
41
|
+
import 'scule';
|
|
42
|
+
import 'node:os';
|
|
43
|
+
import './_deps/unplugin.mjs';
|
|
44
|
+
import 'node:buffer';
|
|
45
|
+
import './_deps/@jridgewell/remapping.mjs';
|
|
46
|
+
import './_deps/@jridgewell/trace-mapping.mjs';
|
|
47
|
+
import './_deps/@jridgewell/resolve-uri.mjs';
|
|
48
|
+
import './_deps/@jridgewell/gen-mapping.mjs';
|
|
49
|
+
import 'node:querystring';
|
|
50
|
+
import './_deps/webpack-virtual-modules.mjs';
|
|
51
|
+
import 'constants';
|
|
52
|
+
import './_deps/unplugin-utils.mjs';
|
|
53
|
+
import './_deps/tinyglobby.mjs';
|
|
54
|
+
import 'fs';
|
|
55
|
+
import 'url';
|
|
56
|
+
import './_deps/fdir.mjs';
|
|
57
|
+
import 'module';
|
|
58
|
+
import './_deps/local-pkg.mjs';
|
|
59
|
+
import './_deps/quansync.mjs';
|
|
60
|
+
import './_deps/strip-literal.mjs';
|
|
61
|
+
import './_deps/js-tokens.mjs';
|
|
62
|
+
import './_deps/unwasm.mjs';
|
|
63
|
+
import 'node:crypto';
|
|
64
|
+
import './_deps/knitwork.mjs';
|
|
65
|
+
import 'db0';
|
|
66
|
+
import 'esbuild';
|
|
67
|
+
import './_deps/etag.mjs';
|
|
22
68
|
import 'crypto';
|
|
23
|
-
import '
|
|
24
|
-
import '
|
|
25
|
-
import '
|
|
69
|
+
import 'unstorage';
|
|
70
|
+
import 'nf3';
|
|
71
|
+
import 'rendu';
|
|
72
|
+
import './_deps/chokidar.mjs';
|
|
26
73
|
import 'fs/promises';
|
|
27
74
|
import 'events';
|
|
75
|
+
import './_deps/readdirp.mjs';
|
|
28
76
|
import 'node:stream';
|
|
77
|
+
import 'os';
|
|
78
|
+
import './_deps/perfect-debounce.mjs';
|
|
79
|
+
import './_deps/compatx.mjs';
|
|
80
|
+
import './_deps/gzip-size.mjs';
|
|
81
|
+
import 'node:zlib';
|
|
82
|
+
import 'stream';
|
|
83
|
+
import './_deps/pretty-bytes.mjs';
|
|
84
|
+
import 'std-env';
|
|
85
|
+
import './_build/snapshot.mjs';
|
|
86
|
+
import 'klona';
|
|
87
|
+
import './_build/info.mjs';
|
|
88
|
+
import 'nitro/meta';
|
|
89
|
+
import './_presets/_types.mjs';
|
|
90
|
+
import './_deps/ultrahtml.mjs';
|
|
29
91
|
import 'h3';
|
|
30
|
-
import '
|
|
92
|
+
import 'consola';
|
|
93
|
+
import 'srvx/node';
|
|
94
|
+
import 'hookable';
|
|
95
|
+
import './_deps/c12.mjs';
|
|
96
|
+
import 'jiti';
|
|
97
|
+
import './_deps/rc9.mjs';
|
|
98
|
+
import 'destr';
|
|
99
|
+
import './_deps/dotenv.mjs';
|
|
100
|
+
import 'klona/full';
|
|
101
|
+
import './_deps/escape-string-regexp.mjs';
|
|
102
|
+
import 'ofetch';
|
|
103
|
+
import 'node:worker_threads';
|
|
104
|
+
import 'undici';
|
|
105
|
+
import './_deps/serve-static.mjs';
|
|
106
|
+
import './_deps/encodeurl.mjs';
|
|
107
|
+
import './_deps/escape-html.mjs';
|
|
108
|
+
import './_deps/parseurl.mjs';
|
|
109
|
+
import './_deps/send.mjs';
|
|
110
|
+
import './_deps/http-errors.mjs';
|
|
111
|
+
import './_deps/depd.mjs';
|
|
112
|
+
import './_deps/setprototypeof.mjs';
|
|
113
|
+
import './_deps/statuses.mjs';
|
|
114
|
+
import './_deps/inherits.mjs';
|
|
115
|
+
import './_deps/toidentifier.mjs';
|
|
116
|
+
import './_deps/debug.mjs';
|
|
31
117
|
import 'tty';
|
|
32
118
|
import 'util';
|
|
33
|
-
import '
|
|
34
|
-
import '
|
|
119
|
+
import './_deps/ms.mjs';
|
|
120
|
+
import './_deps/supports-color.mjs';
|
|
121
|
+
import './_deps/fresh.mjs';
|
|
122
|
+
import './_deps/mime-types.mjs';
|
|
123
|
+
import './_deps/mime-db.mjs';
|
|
124
|
+
import './_deps/on-finished.mjs';
|
|
125
|
+
import './_deps/ee-first.mjs';
|
|
126
|
+
import './_deps/range-parser.mjs';
|
|
127
|
+
import './_deps/httpxy.mjs';
|
|
35
128
|
import 'node:http';
|
|
36
129
|
import 'node:https';
|
|
37
130
|
import 'node:events';
|
|
38
|
-
import 'undici';
|
|
39
131
|
import 'youch-core';
|
|
40
132
|
import 'youch';
|
|
41
133
|
import 'source-map';
|
|
42
134
|
import 'srvx';
|
|
43
|
-
import '
|
|
44
|
-
import '
|
|
45
|
-
import '
|
|
46
|
-
import '
|
|
47
|
-
import '
|
|
48
|
-
import '
|
|
49
|
-
import '
|
|
50
|
-
import '
|
|
51
|
-
import '
|
|
52
|
-
import 'consola/utils';
|
|
53
|
-
import 'node:zlib';
|
|
54
|
-
import 'nitro/meta';
|
|
55
|
-
import 'srvx/node';
|
|
135
|
+
import './_deps/@rollup/plugin-alias.mjs';
|
|
136
|
+
import './_deps/@rollup/plugin-inject.mjs';
|
|
137
|
+
import 'vite';
|
|
138
|
+
import 'get-port-please';
|
|
139
|
+
import 'node:child_process';
|
|
140
|
+
import './_deps/@pi0/vite-plugin-fullstack.mjs';
|
|
141
|
+
import 'node:assert/strict';
|
|
142
|
+
import './_deps/dot-prop.mjs';
|
|
143
|
+
import './_deps/untyped.mjs';
|