nitro-nightly 3.0.1-20260119-145349-d0c4950f → 3.0.1-20260120-020848-6786d069
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/rolldown.mjs +13 -8
- package/dist/_build/vite.build.mjs +1 -1
- package/dist/_chunks/dev.mjs +5 -3
- package/dist/_chunks/nitro.mjs +24 -1183
- package/dist/_chunks/nitro2.mjs +248 -91
- package/dist/_chunks/nitro3.mjs +2696 -0
- package/dist/_chunks/nitro4.mjs +176 -0
- package/dist/_chunks/nitro5.mjs +733 -0
- package/dist/_chunks/nitro6.mjs +1458 -0
- package/dist/_chunks/nitro7.mjs +7561 -0
- package/dist/_chunks/nitro8.mjs +3524 -0
- package/dist/_chunks/nitro9.mjs +1729 -0
- package/dist/_libs/_.mjs +3 -0
- package/dist/_libs/_2.mjs +3 -0
- package/dist/_libs/_3.mjs +4 -0
- package/dist/_libs/_4.mjs +6 -0
- package/dist/_libs/_5.mjs +3 -0
- package/dist/_libs/_6.mjs +3 -0
- package/dist/_libs/acorn+confbox+js-tokens+magic-string+mlly+pkg-types+sourcemap-codec+strip-literal+unimport.mjs +8900 -0
- package/dist/_libs/{c12.mjs → c12+dotenv+rc9.mjs} +12 -105
- package/dist/_libs/{chokidar.mjs → chokidar+readdirp.mjs} +2 -9
- package/dist/_libs/confbox+exsolve+pkg-types.mjs +1249 -0
- package/dist/_libs/confbox.mjs +70 -2488
- package/dist/_libs/confbox2.mjs +786 -0
- package/dist/_libs/confbox3.mjs +404 -0
- package/dist/_libs/confbox4.mjs +3 -0
- package/dist/_libs/estree-walker+unimport.mjs +378 -0
- package/dist/_libs/fdir+picomatch+tinyglobby.mjs +2471 -0
- package/dist/_libs/gen-mapping+remapping+resolve-uri+trace-mapping+unimport+unplugin+unplugin-utils+webpack-virtual-modules.mjs +2150 -0
- package/dist/_libs/giget+node-fetch-native.mjs +2692 -0
- package/dist/_libs/httpxy.mjs +1 -6
- package/dist/_libs/local-pkg+quansync+unimport.mjs +1526 -0
- package/dist/_libs/nypm+tinyexec.mjs +858 -0
- package/dist/_libs/pathe.mjs +164 -0
- package/dist/_libs/perfect-debounce.mjs +89 -0
- package/dist/_libs/{@rollup/plugin-inject.mjs → plugin-alias+plugin-inject.mjs} +65 -2
- package/dist/_libs/std-env.mjs +158 -0
- package/dist/_libs/unimport.mjs +5 -1781
- package/dist/_libs/vite-plugin-fullstack.mjs +26 -0
- package/dist/_presets.mjs +8 -3
- package/dist/builder.mjs +8 -6
- package/dist/cli/_chunks/build.mjs +1 -1
- package/dist/cli/_chunks/dev.mjs +3 -2
- package/dist/cli/_chunks/list.mjs +1 -1
- package/dist/cli/_chunks/prepare.mjs +1 -1
- package/dist/cli/_chunks/run.mjs +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/types/index.d.mts +2410 -1174
- package/dist/vite.d.mts +13 -13
- package/dist/vite.mjs +640 -16
- package/package.json +9 -9
- package/dist/_build/common.mjs +0 -24931
- package/dist/_build/rollup.mjs +0 -201
- package/dist/_chunks/utils.mjs +0 -254
- package/dist/_common.mjs +0 -45
- package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +0 -652
- package/dist/_libs/@jridgewell/gen-mapping.mjs +0 -448
- package/dist/_libs/@jridgewell/remapping.mjs +0 -117
- package/dist/_libs/@rollup/plugin-alias.mjs +0 -64
- package/dist/_libs/@rollup/plugin-commonjs.mjs +0 -1300
- package/dist/_libs/@rollup/plugin-json.mjs +0 -36
- package/dist/_libs/@rollup/plugin-node-resolve.mjs +0 -1972
- package/dist/_libs/escape-string-regexp.mjs +0 -8
- package/dist/_libs/estree-walker.mjs +0 -187
- package/dist/_libs/giget.mjs +0 -3550
- package/dist/_libs/klona.mjs +0 -38
- package/dist/_libs/rou3.mjs +0 -322
- package/dist/_libs/tsconfck.mjs +0 -832
- package/dist/_libs/ultrahtml.mjs +0 -138
- package/dist/cli/_chunks/task.mjs +0 -16
package/dist/_chunks/nitro2.mjs
CHANGED
|
@@ -1,101 +1,258 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as __require, r as __toESM, t as __commonJSMin } from "./nitro.mjs";
|
|
2
|
+
import { l as relative, n as dirname, u as resolve } from "../_libs/pathe.mjs";
|
|
3
|
+
import { a as readGitConfig, c as resolvePackageJSON, i as parseGitConfig, n as findNearestFile, o as readPackageJSON, r as findWorkspaceDir, s as resolveGitConfig, t as findFile } from "../_libs/confbox+exsolve+pkg-types.mjs";
|
|
4
|
+
import { i as a } from "../_libs/std-env.mjs";
|
|
5
|
+
import { t as glob } from "../_libs/fdir+picomatch+tinyglobby.mjs";
|
|
6
|
+
import { t as runParallel } from "./nitro5.mjs";
|
|
7
|
+
import fs, { promises } from "node:fs";
|
|
8
|
+
import { promisify } from "node:util";
|
|
9
|
+
import { colors } from "consola/utils";
|
|
10
|
+
import zlib from "node:zlib";
|
|
11
|
+
import "node:stream";
|
|
3
12
|
|
|
4
|
-
//#region
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
//#region node_modules/.pnpm/duplexer@0.1.2/node_modules/duplexer/index.js
|
|
14
|
+
var require_duplexer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15
|
+
var Stream = __require("stream");
|
|
16
|
+
var writeMethods = [
|
|
17
|
+
"write",
|
|
18
|
+
"end",
|
|
19
|
+
"destroy"
|
|
20
|
+
];
|
|
21
|
+
var readMethods = ["resume", "pause"];
|
|
22
|
+
var readEvents = ["data", "close"];
|
|
23
|
+
var slice = Array.prototype.slice;
|
|
24
|
+
module.exports = duplex;
|
|
25
|
+
function forEach(arr, fn) {
|
|
26
|
+
if (arr.forEach) return arr.forEach(fn);
|
|
27
|
+
for (var i = 0; i < arr.length; i++) fn(arr[i], i);
|
|
18
28
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
async function scanServerRoutes(nitro, dir, prefix = "/") {
|
|
41
|
-
return (await scanFiles(nitro, dir)).map((file) => {
|
|
42
|
-
let route = file.path.replace(/\.[A-Za-z]+$/, "").replace(/\(([^(/\\]+)\)[/\\]/g, "").replace(/\[\.{3}]/g, "**").replace(/\[\.{3}(\w+)]/g, "**:$1").replace(/\[([^/\]]+)]/g, ":$1");
|
|
43
|
-
route = withLeadingSlash(withoutTrailingSlash(withBase(route, prefix)));
|
|
44
|
-
const suffixMatch = route.match(suffixRegex);
|
|
45
|
-
let method;
|
|
46
|
-
let env;
|
|
47
|
-
if (suffixMatch?.index && suffixMatch?.index >= 0) {
|
|
48
|
-
route = route.slice(0, suffixMatch.index);
|
|
49
|
-
method = suffixMatch.groups?.method;
|
|
50
|
-
env = suffixMatch.groups?.env;
|
|
29
|
+
function duplex(writer, reader) {
|
|
30
|
+
var stream = new Stream();
|
|
31
|
+
var ended = false;
|
|
32
|
+
forEach(writeMethods, proxyWriter);
|
|
33
|
+
forEach(readMethods, proxyReader);
|
|
34
|
+
forEach(readEvents, proxyStream);
|
|
35
|
+
reader.on("end", handleEnd);
|
|
36
|
+
writer.on("drain", function() {
|
|
37
|
+
stream.emit("drain");
|
|
38
|
+
});
|
|
39
|
+
writer.on("error", reemit);
|
|
40
|
+
reader.on("error", reemit);
|
|
41
|
+
stream.writable = writer.writable;
|
|
42
|
+
stream.readable = reader.readable;
|
|
43
|
+
return stream;
|
|
44
|
+
function proxyWriter(methodName) {
|
|
45
|
+
stream[methodName] = method;
|
|
46
|
+
function method() {
|
|
47
|
+
return writer[methodName].apply(writer, arguments);
|
|
48
|
+
}
|
|
51
49
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
50
|
+
function proxyReader(methodName) {
|
|
51
|
+
stream[methodName] = method;
|
|
52
|
+
function method() {
|
|
53
|
+
stream.emit(methodName);
|
|
54
|
+
var func = reader[methodName];
|
|
55
|
+
if (func) return func.apply(reader, arguments);
|
|
56
|
+
reader.emit(methodName);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function proxyStream(methodName) {
|
|
60
|
+
reader.on(methodName, reemit$1);
|
|
61
|
+
function reemit$1() {
|
|
62
|
+
var args = slice.call(arguments);
|
|
63
|
+
args.unshift(methodName);
|
|
64
|
+
stream.emit.apply(stream, args);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function handleEnd() {
|
|
68
|
+
if (ended) return;
|
|
69
|
+
ended = true;
|
|
70
|
+
var args = slice.call(arguments);
|
|
71
|
+
args.unshift("end");
|
|
72
|
+
stream.emit.apply(stream, args);
|
|
73
|
+
}
|
|
74
|
+
function reemit(err) {
|
|
75
|
+
stream.emit("error", err);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region node_modules/.pnpm/gzip-size@7.0.0/node_modules/gzip-size/index.js
|
|
82
|
+
var import_duplexer = /* @__PURE__ */ __toESM(require_duplexer(), 1);
|
|
83
|
+
const getOptions = (options) => ({
|
|
84
|
+
level: 9,
|
|
85
|
+
...options
|
|
86
|
+
});
|
|
87
|
+
const gzip = promisify(zlib.gzip);
|
|
88
|
+
async function gzipSize(input, options) {
|
|
89
|
+
if (!input) return 0;
|
|
90
|
+
return (await gzip(input, getOptions(options))).length;
|
|
76
91
|
}
|
|
77
|
-
|
|
78
|
-
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region node_modules/.pnpm/pretty-bytes@7.1.0/node_modules/pretty-bytes/index.js
|
|
95
|
+
const BYTE_UNITS = [
|
|
96
|
+
"B",
|
|
97
|
+
"kB",
|
|
98
|
+
"MB",
|
|
99
|
+
"GB",
|
|
100
|
+
"TB",
|
|
101
|
+
"PB",
|
|
102
|
+
"EB",
|
|
103
|
+
"ZB",
|
|
104
|
+
"YB"
|
|
105
|
+
];
|
|
106
|
+
const BIBYTE_UNITS = [
|
|
107
|
+
"B",
|
|
108
|
+
"KiB",
|
|
109
|
+
"MiB",
|
|
110
|
+
"GiB",
|
|
111
|
+
"TiB",
|
|
112
|
+
"PiB",
|
|
113
|
+
"EiB",
|
|
114
|
+
"ZiB",
|
|
115
|
+
"YiB"
|
|
116
|
+
];
|
|
117
|
+
const BIT_UNITS = [
|
|
118
|
+
"b",
|
|
119
|
+
"kbit",
|
|
120
|
+
"Mbit",
|
|
121
|
+
"Gbit",
|
|
122
|
+
"Tbit",
|
|
123
|
+
"Pbit",
|
|
124
|
+
"Ebit",
|
|
125
|
+
"Zbit",
|
|
126
|
+
"Ybit"
|
|
127
|
+
];
|
|
128
|
+
const BIBIT_UNITS = [
|
|
129
|
+
"b",
|
|
130
|
+
"kibit",
|
|
131
|
+
"Mibit",
|
|
132
|
+
"Gibit",
|
|
133
|
+
"Tibit",
|
|
134
|
+
"Pibit",
|
|
135
|
+
"Eibit",
|
|
136
|
+
"Zibit",
|
|
137
|
+
"Yibit"
|
|
138
|
+
];
|
|
139
|
+
const toLocaleString = (number, locale, options) => {
|
|
140
|
+
let result = number;
|
|
141
|
+
if (typeof locale === "string" || Array.isArray(locale)) result = number.toLocaleString(locale, options);
|
|
142
|
+
else if (locale === true || options !== void 0) result = number.toLocaleString(void 0, options);
|
|
143
|
+
return result;
|
|
144
|
+
};
|
|
145
|
+
const log10 = (numberOrBigInt) => {
|
|
146
|
+
if (typeof numberOrBigInt === "number") return Math.log10(numberOrBigInt);
|
|
147
|
+
const string = numberOrBigInt.toString(10);
|
|
148
|
+
return string.length + Math.log10(`0.${string.slice(0, 15)}`);
|
|
149
|
+
};
|
|
150
|
+
const log = (numberOrBigInt) => {
|
|
151
|
+
if (typeof numberOrBigInt === "number") return Math.log(numberOrBigInt);
|
|
152
|
+
return log10(numberOrBigInt) * Math.log(10);
|
|
153
|
+
};
|
|
154
|
+
const divide = (numberOrBigInt, divisor) => {
|
|
155
|
+
if (typeof numberOrBigInt === "number") return numberOrBigInt / divisor;
|
|
156
|
+
const integerPart = numberOrBigInt / BigInt(divisor);
|
|
157
|
+
const remainder = numberOrBigInt % BigInt(divisor);
|
|
158
|
+
return Number(integerPart) + Number(remainder) / divisor;
|
|
159
|
+
};
|
|
160
|
+
const applyFixedWidth = (result, fixedWidth) => {
|
|
161
|
+
if (fixedWidth === void 0) return result;
|
|
162
|
+
if (typeof fixedWidth !== "number" || !Number.isSafeInteger(fixedWidth) || fixedWidth < 0) throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof fixedWidth}: ${fixedWidth}`);
|
|
163
|
+
if (fixedWidth === 0) return result;
|
|
164
|
+
return result.length < fixedWidth ? result.padStart(fixedWidth, " ") : result;
|
|
165
|
+
};
|
|
166
|
+
const buildLocaleOptions = (options) => {
|
|
167
|
+
const { minimumFractionDigits, maximumFractionDigits } = options;
|
|
168
|
+
if (minimumFractionDigits === void 0 && maximumFractionDigits === void 0) return;
|
|
169
|
+
return {
|
|
170
|
+
...minimumFractionDigits !== void 0 && { minimumFractionDigits },
|
|
171
|
+
...maximumFractionDigits !== void 0 && { maximumFractionDigits },
|
|
172
|
+
roundingMode: "trunc"
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
function prettyBytes(number, options) {
|
|
176
|
+
if (typeof number !== "bigint" && !Number.isFinite(number)) throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
177
|
+
options = {
|
|
178
|
+
bits: false,
|
|
179
|
+
binary: false,
|
|
180
|
+
space: true,
|
|
181
|
+
nonBreakingSpace: false,
|
|
182
|
+
...options
|
|
183
|
+
};
|
|
184
|
+
const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
185
|
+
const separator = options.space ? options.nonBreakingSpace ? "\xA0" : " " : "";
|
|
186
|
+
const isZero = typeof number === "number" ? number === 0 : number === 0n;
|
|
187
|
+
if (options.signed && isZero) return applyFixedWidth(` 0${separator}${UNITS[0]}`, options.fixedWidth);
|
|
188
|
+
const isNegative = number < 0;
|
|
189
|
+
const prefix = isNegative ? "-" : options.signed ? "+" : "";
|
|
190
|
+
if (isNegative) number = -number;
|
|
191
|
+
const localeOptions = buildLocaleOptions(options);
|
|
192
|
+
let result;
|
|
193
|
+
if (number < 1) result = prefix + toLocaleString(number, options.locale, localeOptions) + separator + UNITS[0];
|
|
194
|
+
else {
|
|
195
|
+
const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
|
|
196
|
+
number = divide(number, (options.binary ? 1024 : 1e3) ** exponent);
|
|
197
|
+
if (!localeOptions) {
|
|
198
|
+
const minPrecision = Math.max(3, Math.floor(number).toString().length);
|
|
199
|
+
number = number.toPrecision(minPrecision);
|
|
200
|
+
}
|
|
201
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
202
|
+
const unit = UNITS[exponent];
|
|
203
|
+
result = prefix + numberString + separator + unit;
|
|
204
|
+
}
|
|
205
|
+
return applyFixedWidth(result, options.fixedWidth);
|
|
79
206
|
}
|
|
80
|
-
|
|
81
|
-
|
|
207
|
+
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/utils/fs-tree.ts
|
|
210
|
+
async function generateFSTree(dir, options = {}) {
|
|
211
|
+
if (a) return;
|
|
212
|
+
const files = await glob("**/*.*", {
|
|
82
213
|
cwd: dir,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
214
|
+
ignore: ["*.map"]
|
|
215
|
+
});
|
|
216
|
+
const items = [];
|
|
217
|
+
await runParallel(new Set(files), async (file) => {
|
|
218
|
+
const path = resolve(dir, file);
|
|
219
|
+
const src = await promises.readFile(path);
|
|
220
|
+
const size = src.byteLength;
|
|
221
|
+
const gzip$1 = options.compressedSizes ? await gzipSize(src) : 0;
|
|
222
|
+
items.push({
|
|
223
|
+
file,
|
|
224
|
+
path,
|
|
225
|
+
size,
|
|
226
|
+
gzip: gzip$1
|
|
227
|
+
});
|
|
228
|
+
}, { concurrency: 10 });
|
|
229
|
+
items.sort((a$1, b) => a$1.path.localeCompare(b.path));
|
|
230
|
+
let totalSize = 0;
|
|
231
|
+
let totalGzip = 0;
|
|
232
|
+
let totalNodeModulesSize = 0;
|
|
233
|
+
let totalNodeModulesGzip = 0;
|
|
234
|
+
let treeText = "";
|
|
235
|
+
for (const [index, item] of items.entries()) {
|
|
236
|
+
let dir$1 = dirname(item.file);
|
|
237
|
+
if (dir$1 === ".") dir$1 = "";
|
|
238
|
+
const rpath = relative(process.cwd(), item.path);
|
|
239
|
+
const treeChar = index === items.length - 1 ? "└─" : "├─";
|
|
240
|
+
if (item.file.includes("node_modules")) {
|
|
241
|
+
totalNodeModulesSize += item.size;
|
|
242
|
+
totalNodeModulesGzip += item.gzip;
|
|
243
|
+
continue;
|
|
90
244
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
245
|
+
treeText += colors.gray(` ${treeChar} ${rpath} (${prettyBytes(item.size)})`);
|
|
246
|
+
if (options.compressedSizes) treeText += colors.gray(` (${prettyBytes(item.gzip)} gzip)`);
|
|
247
|
+
treeText += "\n";
|
|
248
|
+
totalSize += item.size;
|
|
249
|
+
totalGzip += item.gzip;
|
|
250
|
+
}
|
|
251
|
+
treeText += `${colors.cyan("Σ Total size:")} ${prettyBytes(totalSize + totalNodeModulesSize)}`;
|
|
252
|
+
if (options.compressedSizes) treeText += ` (${prettyBytes(totalGzip + totalNodeModulesGzip)} gzip)`;
|
|
253
|
+
treeText += "\n";
|
|
254
|
+
return treeText;
|
|
98
255
|
}
|
|
99
256
|
|
|
100
257
|
//#endregion
|
|
101
|
-
export {
|
|
258
|
+
export { readPackageJSON, generateFSTree as t };
|