nitro-nightly 3.0.1-20251127-112821-2989d6be → 3.0.1-20251201-104553-0f08396c
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
CHANGED
|
@@ -23,7 +23,7 @@ import { n as writeBuildInfo } from "./common.mjs";
|
|
|
23
23
|
import { a as watch$1 } from "../_libs/chokidar.mjs";
|
|
24
24
|
import "../_libs/estree-walker.mjs";
|
|
25
25
|
import "../_libs/plugin-commonjs.mjs";
|
|
26
|
-
import { n as getChunkName, r as baseBuildConfig, t as baseBuildPlugins } from "../_chunks/
|
|
26
|
+
import { n as getChunkName, r as baseBuildConfig, t as baseBuildPlugins } from "../_chunks/Qe19FNKf.mjs";
|
|
27
27
|
import "../_libs/remapping.mjs";
|
|
28
28
|
import "../_libs/unwasm.mjs";
|
|
29
29
|
import "../_libs/plugin-replace.mjs";
|
package/dist/_build/rollup.mjs
CHANGED
|
@@ -25,7 +25,7 @@ import { t as alias } from "../_libs/plugin-alias.mjs";
|
|
|
25
25
|
import "../_libs/estree-walker.mjs";
|
|
26
26
|
import { t as commonjs } from "../_libs/plugin-commonjs.mjs";
|
|
27
27
|
import { t as inject } from "../_libs/plugin-inject.mjs";
|
|
28
|
-
import { n as getChunkName, r as baseBuildConfig, t as baseBuildPlugins } from "../_chunks/
|
|
28
|
+
import { n as getChunkName, r as baseBuildConfig, t as baseBuildPlugins } from "../_chunks/Qe19FNKf.mjs";
|
|
29
29
|
import "../_libs/remapping.mjs";
|
|
30
30
|
import "../_libs/unwasm.mjs";
|
|
31
31
|
import "../_libs/plugin-replace.mjs";
|
|
@@ -47,26 +47,26 @@ import "../_libs/is-core-module.mjs";
|
|
|
47
47
|
import { watch } from "node:fs";
|
|
48
48
|
import { defu } from "defu";
|
|
49
49
|
import { transform } from "oxc-transform";
|
|
50
|
-
import {
|
|
50
|
+
import { minifySync } from "oxc-minify";
|
|
51
51
|
|
|
52
52
|
//#region src/build/plugins/oxc.ts
|
|
53
53
|
function oxc(options) {
|
|
54
|
-
const filter = (id) => !/node_modules/.test(id) && /\.[mj]?[jt]sx?$/.test(id);
|
|
55
54
|
return {
|
|
56
55
|
name: "nitro:oxc",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
transform: {
|
|
57
|
+
filter: { id: /^(?!.*\/node_modules\/).*\.m?[jt]sx?$/ },
|
|
58
|
+
handler(code, id) {
|
|
59
|
+
return transform(id, code, {
|
|
60
|
+
sourcemap: options.sourcemap,
|
|
61
|
+
...options.transform
|
|
62
|
+
});
|
|
63
|
+
}
|
|
63
64
|
},
|
|
64
|
-
|
|
65
|
-
if (options.minify) return
|
|
65
|
+
renderChunk(code, chunk) {
|
|
66
|
+
if (options.minify) return minifySync(chunk.fileName, code, {
|
|
66
67
|
sourcemap: options.sourcemap,
|
|
67
68
|
...typeof options.minify === "object" ? options.minify : {}
|
|
68
69
|
});
|
|
69
|
-
return null;
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
}
|
|
@@ -33,7 +33,7 @@ import "../_libs/plugin-alias.mjs";
|
|
|
33
33
|
import "../_libs/estree-walker.mjs";
|
|
34
34
|
import "../_libs/plugin-commonjs.mjs";
|
|
35
35
|
import "../_libs/plugin-inject.mjs";
|
|
36
|
-
import "../_chunks/
|
|
36
|
+
import "../_chunks/Qe19FNKf.mjs";
|
|
37
37
|
import "../_libs/remapping.mjs";
|
|
38
38
|
import "../_libs/unwasm.mjs";
|
|
39
39
|
import "../_libs/plugin-replace.mjs";
|
|
@@ -10,7 +10,7 @@ import { i as NodeDevWorker, r as NitroDevApp } from "../_dev.mjs";
|
|
|
10
10
|
import { a as watch$1 } from "../_libs/chokidar.mjs";
|
|
11
11
|
import { t as alias } from "../_libs/plugin-alias.mjs";
|
|
12
12
|
import { t as inject } from "../_libs/plugin-inject.mjs";
|
|
13
|
-
import { n as getChunkName, r as baseBuildConfig, t as baseBuildPlugins } from "../_chunks/
|
|
13
|
+
import { n as getChunkName, r as baseBuildConfig, t as baseBuildPlugins } from "../_chunks/Qe19FNKf.mjs";
|
|
14
14
|
import { t as assetsPlugin } from "../_libs/vite-plugin-fullstack.mjs";
|
|
15
15
|
import consola$1 from "consola";
|
|
16
16
|
import { join, resolve } from "node:path";
|
|
@@ -137,40 +137,53 @@ function routeToFsPath(route) {
|
|
|
137
137
|
return route.split("/").slice(1).map((s) => `${s.replace(/[:*]+/g, "$").replace(/[^$a-zA-Z0-9_.[\]/]/g, "_")}`).join("/") || "index";
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/utils/regex.ts
|
|
142
|
+
function escapeRegExp(string) {
|
|
143
|
+
return string.replace(/[-\\^$*+?.()|[\]{}]/g, String.raw`\$&`);
|
|
144
|
+
}
|
|
145
|
+
|
|
140
146
|
//#endregion
|
|
141
147
|
//#region src/build/plugins/route-meta.ts
|
|
142
|
-
const
|
|
148
|
+
const PREFIX$2 = "\0nitro:route-meta:";
|
|
143
149
|
function routeMeta(nitro) {
|
|
144
150
|
return {
|
|
145
151
|
name: "nitro:route-meta",
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
resolveId: {
|
|
153
|
+
filter: { id: /^(?!\u0000)(.+)\?meta$/ },
|
|
154
|
+
async handler(id, importer, resolveOpts) {
|
|
155
|
+
if (id.endsWith("?meta")) {
|
|
156
|
+
const resolved = await this.resolve(id.replace("?meta", ""), importer, resolveOpts);
|
|
157
|
+
if (!resolved) return;
|
|
158
|
+
return PREFIX$2 + resolved.id;
|
|
159
|
+
}
|
|
152
160
|
}
|
|
153
161
|
},
|
|
154
|
-
load
|
|
155
|
-
|
|
162
|
+
load: {
|
|
163
|
+
filter: { id: /* @__PURE__ */ new RegExp(`^${escapeRegExp(PREFIX$2)}`) },
|
|
164
|
+
handler(id) {
|
|
165
|
+
if (id.startsWith(PREFIX$2)) return readFile(id.slice(18), { encoding: "utf8" });
|
|
166
|
+
}
|
|
156
167
|
},
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
transform: {
|
|
169
|
+
filter: { id: /* @__PURE__ */ new RegExp(`^${escapeRegExp(PREFIX$2)}`) },
|
|
170
|
+
async handler(code, id) {
|
|
171
|
+
let meta = null;
|
|
172
|
+
try {
|
|
173
|
+
const jsCode = transformSync(id, code).code;
|
|
174
|
+
const ast = this.parse(jsCode);
|
|
175
|
+
for (const node of ast.body) if (node.type === "ExpressionStatement" && node.expression.type === "CallExpression" && node.expression.callee.type === "Identifier" && node.expression.callee.name === "defineRouteMeta" && node.expression.arguments.length === 1) {
|
|
176
|
+
meta = astToObject(node.expression.arguments[0]);
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
} catch (error) {
|
|
180
|
+
nitro.logger.warn(`[handlers-meta] Cannot extra route meta for: ${id}: ${error}`);
|
|
166
181
|
}
|
|
167
|
-
|
|
168
|
-
|
|
182
|
+
return {
|
|
183
|
+
code: `export default ${JSON.stringify(meta)};`,
|
|
184
|
+
map: null
|
|
185
|
+
};
|
|
169
186
|
}
|
|
170
|
-
return {
|
|
171
|
-
code: `export default ${JSON.stringify(meta)};`,
|
|
172
|
-
map: null
|
|
173
|
-
};
|
|
174
187
|
}
|
|
175
188
|
};
|
|
176
189
|
}
|
|
@@ -203,15 +216,9 @@ function serverMain(nitro) {
|
|
|
203
216
|
};
|
|
204
217
|
}
|
|
205
218
|
|
|
206
|
-
//#endregion
|
|
207
|
-
//#region src/utils/regex.ts
|
|
208
|
-
function escapeRegExp(string) {
|
|
209
|
-
return string.replace(/[-\\^$*+?.()|[\]{}]/g, String.raw`\$&`);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
219
|
//#endregion
|
|
213
220
|
//#region src/build/plugins/virtual.ts
|
|
214
|
-
const PREFIX = "\
|
|
221
|
+
const PREFIX$1 = "\0nitro:virtual:";
|
|
215
222
|
function virtual(input) {
|
|
216
223
|
const modules = /* @__PURE__ */ new Map();
|
|
217
224
|
for (const mod of input) {
|
|
@@ -226,21 +233,21 @@ function virtual(input) {
|
|
|
226
233
|
api: { modules },
|
|
227
234
|
resolveId: {
|
|
228
235
|
order: "pre",
|
|
229
|
-
filter: { id:
|
|
236
|
+
filter: { id: /* @__PURE__ */ new RegExp(`^(${[...modules.keys()].map((id) => escapeRegExp(id)).join("|")})$`) },
|
|
230
237
|
handler: (id) => {
|
|
231
238
|
const mod = modules.get(id);
|
|
232
239
|
if (!mod) return null;
|
|
233
240
|
return {
|
|
234
|
-
id: PREFIX + id,
|
|
241
|
+
id: PREFIX$1 + id,
|
|
235
242
|
moduleSideEffects: mod.module.moduleSideEffects ?? false
|
|
236
243
|
};
|
|
237
244
|
}
|
|
238
245
|
},
|
|
239
246
|
load: {
|
|
240
247
|
order: "pre",
|
|
241
|
-
filter: { id: /* @__PURE__ */ new RegExp(`^${escapeRegExp(PREFIX)}`) },
|
|
248
|
+
filter: { id: /* @__PURE__ */ new RegExp(`^${escapeRegExp(PREFIX$1)}`) },
|
|
242
249
|
handler: async (id) => {
|
|
243
|
-
const idNoPrefix = id.slice(
|
|
250
|
+
const idNoPrefix = id.slice(15);
|
|
244
251
|
const mod = modules.get(idNoPrefix);
|
|
245
252
|
if (!mod) throw new Error(`Virtual module ${idNoPrefix} not found.`);
|
|
246
253
|
return {
|
|
@@ -265,7 +272,7 @@ function nitroResolveIds() {
|
|
|
265
272
|
resolveId: {
|
|
266
273
|
order: "pre",
|
|
267
274
|
handler(id, importer, rOpts) {
|
|
268
|
-
if (importer && importer.startsWith("\
|
|
275
|
+
if (importer && importer.startsWith("\0nitro:virtual:#nitro-internal-virtual")) return this.resolve(id, runtimeDir, { skipSelf: true });
|
|
269
276
|
const mappedId = subpathMap[id];
|
|
270
277
|
if (mappedId) return this.resolve(mappedId, runtimeDir, { skipSelf: true });
|
|
271
278
|
}
|
|
@@ -293,30 +300,37 @@ function sourcemapMinify() {
|
|
|
293
300
|
|
|
294
301
|
//#endregion
|
|
295
302
|
//#region src/build/plugins/raw.ts
|
|
296
|
-
const HELPER_ID = "
|
|
297
|
-
const
|
|
303
|
+
const HELPER_ID = "\0nitro-raw-helpers";
|
|
304
|
+
const RESOLVED_PREFIX = "\0nitro:raw:";
|
|
305
|
+
const PREFIX = "raw:";
|
|
298
306
|
function raw() {
|
|
299
307
|
return {
|
|
300
|
-
name: "raw",
|
|
308
|
+
name: "nitro:raw",
|
|
301
309
|
resolveId: {
|
|
302
310
|
order: "pre",
|
|
311
|
+
filter: { id: [/* @__PURE__ */ new RegExp(`^${HELPER_ID}$`), /* @__PURE__ */ new RegExp(`^${PREFIX}`)] },
|
|
303
312
|
async handler(id, importer, resolveOpts) {
|
|
304
313
|
if (id === HELPER_ID) return id;
|
|
305
|
-
if (id.startsWith(
|
|
314
|
+
if (id.startsWith(PREFIX)) {
|
|
315
|
+
const resolvedId = (await this.resolve(id.slice(4), importer, resolveOpts))?.id;
|
|
316
|
+
if (!resolvedId) return null;
|
|
317
|
+
return { id: RESOLVED_PREFIX + resolvedId };
|
|
318
|
+
}
|
|
306
319
|
}
|
|
307
320
|
},
|
|
308
321
|
load: {
|
|
309
322
|
order: "pre",
|
|
323
|
+
filter: { id: [/* @__PURE__ */ new RegExp(`^${HELPER_ID}$`), /* @__PURE__ */ new RegExp(`^${RESOLVED_PREFIX}`)] },
|
|
310
324
|
handler(id) {
|
|
311
325
|
if (id === HELPER_ID) return getHelpers();
|
|
312
|
-
if (id.startsWith(
|
|
326
|
+
if (id.startsWith(RESOLVED_PREFIX)) return promises.readFile(id.slice(11), isBinary(id) ? "binary" : "utf8");
|
|
313
327
|
}
|
|
314
328
|
},
|
|
315
329
|
transform: {
|
|
316
330
|
order: "pre",
|
|
331
|
+
filter: { id: /* @__PURE__ */ new RegExp(`^${RESOLVED_PREFIX}`) },
|
|
317
332
|
handler(code, id) {
|
|
318
|
-
|
|
319
|
-
const path = id.slice(12);
|
|
333
|
+
const path = id.slice(11);
|
|
320
334
|
if (isBinary(id)) return {
|
|
321
335
|
code: `import {base64ToUint8Array } from "${HELPER_ID}" \n export default base64ToUint8Array("${Buffer.from(code, "binary").toString("base64")}")`,
|
|
322
336
|
map: rawAssetMap(path)
|
|
@@ -337,7 +351,7 @@ function isBinary(id) {
|
|
|
337
351
|
return true;
|
|
338
352
|
}
|
|
339
353
|
function getHelpers() {
|
|
340
|
-
return
|
|
354
|
+
return `
|
|
341
355
|
export function base64ToUint8Array(str) {
|
|
342
356
|
const data = atob(str);
|
|
343
357
|
const size = data.length;
|
package/dist/vite.mjs
CHANGED
|
@@ -33,7 +33,7 @@ import "./_libs/plugin-alias.mjs";
|
|
|
33
33
|
import "./_libs/estree-walker.mjs";
|
|
34
34
|
import "./_libs/plugin-commonjs.mjs";
|
|
35
35
|
import "./_libs/plugin-inject.mjs";
|
|
36
|
-
import "./_chunks/
|
|
36
|
+
import "./_chunks/Qe19FNKf.mjs";
|
|
37
37
|
import "./_libs/remapping.mjs";
|
|
38
38
|
import "./_libs/unwasm.mjs";
|
|
39
39
|
import "./_libs/plugin-replace.mjs";
|
package/package.json
CHANGED