@nuxt/nitro-server-nightly 5.0.0-29800730.fb02c57e → 5.0.0-29801675.c10bc95f

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.
Files changed (2) hide show
  1. package/dist/index.mjs +18 -78
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -5,11 +5,11 @@ import { cpus } from "node:os";
5
5
  import { mkdir, readFile, writeFile } from "node:fs/promises";
6
6
  import { randomBytes, randomUUID } from "node:crypto";
7
7
  import { dirname, isAbsolute, join, relative, resolve } from "pathe";
8
- import { getQuery, joinURL, withTrailingSlash } from "ufo";
8
+ import { getQuery, joinURL, withTrailingSlash, withoutTrailingSlash } from "ufo";
9
9
  import nuxtPkg from "nuxt/package.json" with { type: "json" };
10
10
  import { build, copyPublicAssets, createDevServer, createNitro, prepare, prerender, writeTypes } from "nitro/builder";
11
11
  import { addPlugin, addTemplate, addVitePlugin, createIsIgnored, directoryToURL, ensureDependencyInstalled, findPath, getAddDependencyCommand, getDirectory, getLayerDirectories, logger, resolveAlias, resolveIgnorePatterns, resolveNuxtModule } from "@nuxt/kit";
12
- import { bundlerDiagnostics, resolveModuleExportNames } from "@nuxt/kit/internal";
12
+ import { bundlerDiagnostics, resolveModuleExportNames, setServerBuild } from "@nuxt/kit/internal";
13
13
  import escapeRE from "escape-string-regexp";
14
14
  import { defu } from "defu";
15
15
  import { defineEventHandler, dynamicEventHandler, handleCors } from "nitro/h3";
@@ -25,7 +25,7 @@ import remapping from "@ampproject/remapping";
25
25
  import { addRoute, createRouter } from "rou3";
26
26
  import { compileRouterToString } from "rou3/compiler";
27
27
  //#region package.json
28
- var version = "5.0.0-29800730.fb02c57e";
28
+ var version = "5.0.0-29801675.c10bc95f";
29
29
  //#endregion
30
30
  //#region src/utils.ts
31
31
  function toArray(value) {
@@ -1039,81 +1039,6 @@ async function bundle(nuxt) {
1039
1039
  nitroConfig.serverDir = resolve(nuxt.options.rootDir, nuxt.options.srcDir, nitroConfig.serverDir);
1040
1040
  nitroConfig.ignore ||= [];
1041
1041
  nitroConfig.ignore.push(...resolveIgnorePatterns(nitroConfig.serverDir));
1042
- const validManifestKeys = [
1043
- "prerender",
1044
- "redirect",
1045
- "appMiddleware",
1046
- "appLayout",
1047
- "cache",
1048
- "isr",
1049
- "swr",
1050
- "ssr",
1051
- "noScripts"
1052
- ];
1053
- const warnedKeyCollisions = /* @__PURE__ */ new Set();
1054
- addTemplate({
1055
- filename: "route-rules.mjs",
1056
- dependsOn: nuxt.options.experimental.inlineRouteRules ? ["pages"] : [],
1057
- getContents() {
1058
- if (!nuxt._nitro) return `export default () => ({})`;
1059
- const caseSensitiveRouteRules = !!nuxt.options.router.options.sensitive;
1060
- const sourceRouter = nuxt._nitro.routing.routeRules;
1061
- const getNormalizedRouter = (fold) => createNormalizedRouteRulesRouter(sourceRouter, nuxt._nitro.options.baseURL, fold, (existing, route, key) => {
1062
- if (fold === caseSensitiveRouteRules || warnedKeyCollisions.has(key)) return;
1063
- warnedKeyCollisions.add(key);
1064
- bundlerDiagnostics.NUXT_B7022({
1065
- existing,
1066
- route,
1067
- canFold: fold
1068
- });
1069
- });
1070
- const compileOptions = {
1071
- matchAll: true,
1072
- serialize(routeRules) {
1073
- return `{${Object.entries(routeRules).filter(([name, value]) => value !== void 0 && validManifestKeys.includes(name)).map(([name, value]) => {
1074
- if (name === "redirect") {
1075
- const redirectOptions = value;
1076
- value = typeof redirectOptions === "string" ? redirectOptions : redirectOptions.to;
1077
- }
1078
- if (name === "appMiddleware") {
1079
- const appMiddlewareOptions = value;
1080
- if (typeof appMiddlewareOptions === "string") value = { [appMiddlewareOptions]: true };
1081
- else if (Array.isArray(appMiddlewareOptions)) {
1082
- const normalizedRules = {};
1083
- for (const middleware of appMiddlewareOptions) normalizedRules[middleware] = true;
1084
- value = normalizedRules;
1085
- }
1086
- }
1087
- if (name === "cache" || name === "isr" || name === "swr") {
1088
- name = "payload";
1089
- value = Boolean(value);
1090
- }
1091
- return `${name}: ${JSON.stringify(value)}`;
1092
- }).join(",")}}`;
1093
- }
1094
- };
1095
- const sensitiveMatcher = getNormalizedRouter(false).compileToString(compileOptions);
1096
- const foldedMatcher = getNormalizedRouter(true).compileToString(compileOptions);
1097
- const needsRouterOptions = foldedMatcher !== sensitiveMatcher || caseSensitiveRouteRules;
1098
- return [
1099
- `import { defu } from 'defu'`,
1100
- needsRouterOptions ? `import routerOptions from '#build/router.options.mjs'` : ``,
1101
- needsRouterOptions ? `const sensitiveMatcher = ${sensitiveMatcher}` : ``,
1102
- needsRouterOptions ? foldedMatcher === sensitiveMatcher ? `const foldedMatcher = sensitiveMatcher` : `const foldedMatcher = ${foldedMatcher}` : `const foldedMatcher = ${foldedMatcher}`,
1103
- `const decodeRoutePath = ${decodeRoutePath.toString()}`,
1104
- `const normalizePath = (path, fold) => {`,
1105
- ` if (typeof path !== 'string') { return path }`,
1106
- ` const decoded = decodeRoutePath(path)`,
1107
- ` return fold ? decoded.toLowerCase() : decoded`,
1108
- `}`,
1109
- needsRouterOptions ? [
1110
- `export default (path) => routerOptions.sensitive`,
1111
- ` ? defu({}, ...sensitiveMatcher('', normalizePath(path, false)).map(r => r.data).reverse())`,
1112
- ` : defu({}, ...foldedMatcher('', normalizePath(path, true)).map(r => r.data).reverse())`
1113
- ].join("\n") : `export default path => defu({}, ...foldedMatcher('', normalizePath(path, true)).map(r => r.data).reverse())`
1114
- ].filter(Boolean).join("\n");
1115
- }
1116
- });
1117
1042
  if (nuxt.options.experimental.payloadExtraction) {
1118
1043
  if (nuxt.options.dev) nuxt.hook("nitro:config", (nitroConfig) => {
1119
1044
  nitroConfig.prerender ||= {};
@@ -1393,6 +1318,21 @@ async function bundle(nuxt) {
1393
1318
  base: cacheDir
1394
1319
  } });
1395
1320
  nuxt._nitro = nitro;
1321
+ setServerBuild({
1322
+ name: "nitro",
1323
+ label: "Nitro",
1324
+ target: () => nitro.options.preset,
1325
+ targetLabel: "preset",
1326
+ output: {
1327
+ dir: () => withoutTrailingSlash(nitro.options.output.dir),
1328
+ publicDir: () => withoutTrailingSlash(nitro.options.output.publicDir)
1329
+ },
1330
+ capabilities: {
1331
+ server: true,
1332
+ dev: true
1333
+ },
1334
+ preview: { command: () => nitro.options.commands.preview }
1335
+ }, nuxt);
1396
1336
  await nuxt.callHook("nitro:init", nitro);
1397
1337
  if (nuxt._perf) nitro.hooks.hook("rollup:before", (_nitro, rollupConfig) => {
1398
1338
  const plugins = rollupConfig.plugins || [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/nitro-server-nightly",
3
- "version": "5.0.0-29800730.fb02c57e",
3
+ "version": "5.0.0-29801675.c10bc95f",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -32,7 +32,7 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@ampproject/remapping": "^2.3.0",
35
- "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29800730.fb02c57e",
35
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29801675.c10bc95f",
36
36
  "@unhead/vue": "^3.4.0",
37
37
  "@vue/shared": "^3.5.42",
38
38
  "consola": "^3.4.2",
@@ -66,7 +66,7 @@
66
66
  "@babel/plugin-proposal-decorators": "^7.25.0 || ^8.0.0",
67
67
  "@babel/plugin-syntax-typescript": "^7.25.0 || ^8.0.0",
68
68
  "@rollup/plugin-babel": "^6.0.0 || ^7.0.0",
69
- "nuxt": "npm:nuxt-nightly@5.0.0-29800730.fb02c57e"
69
+ "nuxt": "npm:nuxt-nightly@5.0.0-29801675.c10bc95f"
70
70
  },
71
71
  "peerDependenciesMeta": {
72
72
  "@babel/plugin-proposal-decorators": {
@@ -82,10 +82,10 @@
82
82
  "devDependencies": {
83
83
  "@babel/plugin-proposal-decorators": "8.0.2",
84
84
  "@babel/plugin-syntax-typescript": "8.0.3",
85
- "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29800730.fb02c57e",
85
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29801675.c10bc95f",
86
86
  "@rollup/plugin-babel": "7.1.0",
87
87
  "hookable": "^6.1.1",
88
- "nuxt": "npm:nuxt-nightly@5.0.0-29800730.fb02c57e",
88
+ "nuxt": "npm:nuxt-nightly@5.0.0-29801675.c10bc95f",
89
89
  "tsdown": "0.22.14",
90
90
  "vitest": "4.1.11"
91
91
  },