@nuxt/nitro-server-nightly 4.2.0-29359950.ef108bf4 → 4.2.1-29360021.ff37598b
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/README.md +4 -4
- package/dist/index.d.mts +38 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.mjs +71 -35
- package/dist/runtime/handlers/error.d.ts +1 -1
- package/dist/runtime/handlers/error.js +1 -2
- package/dist/runtime/handlers/island.d.ts +1 -1
- package/dist/runtime/handlers/island.js +1 -3
- package/dist/runtime/handlers/renderer.d.ts +1 -1
- package/dist/runtime/handlers/renderer.js +1 -1
- package/dist/runtime/plugins/dev-server-logs.d.ts +1 -1
- package/dist/runtime/plugins/dev-server-logs.js +1 -1
- package/dist/runtime/templates/error-500.d.ts +1 -1
- package/dist/runtime/templates/error-500.js +2 -2
- package/dist/runtime/utils/app-config.d.ts +2 -0
- package/dist/runtime/utils/app-config.js +25 -0
- package/dist/runtime/utils/cache.d.ts +3 -3
- package/dist/runtime/utils/cache.js +1 -1
- package/dist/runtime/utils/error.d.ts +1 -1
- package/dist/runtime/utils/paths.js +1 -1
- package/dist/runtime/utils/renderer/app.js +1 -1
- package/dist/runtime/utils/renderer/build-files.js +1 -1
- package/dist/runtime/utils/renderer/payload.d.ts +2 -2
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -93,13 +93,13 @@ Discover our [list of modules](https://nuxt.com/modules) to supercharge your Nux
|
|
|
93
93
|
We invite you to contribute and help improve Nuxt 💚
|
|
94
94
|
|
|
95
95
|
Here are a few ways you can get involved:
|
|
96
|
-
- **Reporting Bugs:** If you come across any bugs or issues, please check out the [reporting bugs guide](https://nuxt.com/docs/community/reporting-bugs) to learn how to submit a bug report.
|
|
97
|
-
- **Suggestions:** Have ideas to enhance Nuxt? We'd love to hear them! Check out the [contribution guide](https://nuxt.com/docs/community/contribution) to share your suggestions.
|
|
98
|
-
- **Questions:** If you have questions or need assistance, the [getting help guide](https://nuxt.com/docs/community/getting-help) provides resources to help you out.
|
|
96
|
+
- **Reporting Bugs:** If you come across any bugs or issues, please check out the [reporting bugs guide](https://nuxt.com/docs/4.x/community/reporting-bugs) to learn how to submit a bug report.
|
|
97
|
+
- **Suggestions:** Have ideas to enhance Nuxt? We'd love to hear them! Check out the [contribution guide](https://nuxt.com/docs/4.x/community/contribution) to share your suggestions.
|
|
98
|
+
- **Questions:** If you have questions or need assistance, the [getting help guide](https://nuxt.com/docs/4.x/community/getting-help) provides resources to help you out.
|
|
99
99
|
|
|
100
100
|
## <a name="local-development">🏠 Local Development</a>
|
|
101
101
|
|
|
102
|
-
Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/community/framework-contribution#setup) to contribute to the framework and documentation.
|
|
102
|
+
Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/4.x/community/framework-contribution#setup) to contribute to the framework and documentation.
|
|
103
103
|
|
|
104
104
|
## <a name="professional-support">🛟 Professional Support</a>
|
|
105
105
|
|
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,15 @@ declare module 'nitropack' {
|
|
|
10
10
|
buildAssetsDir: string;
|
|
11
11
|
cdnURL: string;
|
|
12
12
|
}
|
|
13
|
+
interface NitroRouteRules {
|
|
14
|
+
ssr?: boolean;
|
|
15
|
+
noScripts?: boolean;
|
|
16
|
+
/** @deprecated Use `noScripts` instead */
|
|
17
|
+
experimentalNoScripts?: boolean;
|
|
18
|
+
appMiddleware?: Record<string, boolean>;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
declare module 'nitropack' {
|
|
13
22
|
interface NitroRuntimeConfig extends RuntimeConfig {
|
|
14
23
|
}
|
|
15
24
|
interface NitroRouteConfig {
|
|
@@ -18,6 +27,25 @@ declare module 'nitropack' {
|
|
|
18
27
|
/** @deprecated Use `noScripts` instead */
|
|
19
28
|
experimentalNoScripts?: boolean;
|
|
20
29
|
}
|
|
30
|
+
interface NitroRuntimeHooks {
|
|
31
|
+
'dev:ssr-logs': (ctx: {
|
|
32
|
+
logs: LogObject[];
|
|
33
|
+
path: string;
|
|
34
|
+
}) => void | Promise<void>;
|
|
35
|
+
'render:html': (htmlContext: NuxtRenderHTMLContext, context: {
|
|
36
|
+
event: H3Event;
|
|
37
|
+
}) => void | Promise<void>;
|
|
38
|
+
'render:island': (islandResponse: NuxtIslandResponse, context: {
|
|
39
|
+
event: H3Event;
|
|
40
|
+
islandContext: NuxtIslandContext;
|
|
41
|
+
}) => void | Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
declare module 'nitropack/types' {
|
|
45
|
+
interface NitroRuntimeConfigApp {
|
|
46
|
+
buildAssetsDir: string;
|
|
47
|
+
cdnURL: string;
|
|
48
|
+
}
|
|
21
49
|
interface NitroRouteRules {
|
|
22
50
|
ssr?: boolean;
|
|
23
51
|
noScripts?: boolean;
|
|
@@ -25,6 +53,16 @@ declare module 'nitropack' {
|
|
|
25
53
|
experimentalNoScripts?: boolean;
|
|
26
54
|
appMiddleware?: Record<string, boolean>;
|
|
27
55
|
}
|
|
56
|
+
}
|
|
57
|
+
declare module 'nitropack/types' {
|
|
58
|
+
interface NitroRuntimeConfig extends RuntimeConfig {
|
|
59
|
+
}
|
|
60
|
+
interface NitroRouteConfig {
|
|
61
|
+
ssr?: boolean;
|
|
62
|
+
noScripts?: boolean;
|
|
63
|
+
/** @deprecated Use `noScripts` instead */
|
|
64
|
+
experimentalNoScripts?: boolean;
|
|
65
|
+
}
|
|
28
66
|
interface NitroRuntimeHooks {
|
|
29
67
|
'dev:ssr-logs': (ctx: {
|
|
30
68
|
logs: LogObject[];
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,15 @@ declare module 'nitropack' {
|
|
|
10
10
|
buildAssetsDir: string;
|
|
11
11
|
cdnURL: string;
|
|
12
12
|
}
|
|
13
|
+
interface NitroRouteRules {
|
|
14
|
+
ssr?: boolean;
|
|
15
|
+
noScripts?: boolean;
|
|
16
|
+
/** @deprecated Use `noScripts` instead */
|
|
17
|
+
experimentalNoScripts?: boolean;
|
|
18
|
+
appMiddleware?: Record<string, boolean>;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
declare module 'nitropack' {
|
|
13
22
|
interface NitroRuntimeConfig extends RuntimeConfig {
|
|
14
23
|
}
|
|
15
24
|
interface NitroRouteConfig {
|
|
@@ -18,6 +27,25 @@ declare module 'nitropack' {
|
|
|
18
27
|
/** @deprecated Use `noScripts` instead */
|
|
19
28
|
experimentalNoScripts?: boolean;
|
|
20
29
|
}
|
|
30
|
+
interface NitroRuntimeHooks {
|
|
31
|
+
'dev:ssr-logs': (ctx: {
|
|
32
|
+
logs: LogObject[];
|
|
33
|
+
path: string;
|
|
34
|
+
}) => void | Promise<void>;
|
|
35
|
+
'render:html': (htmlContext: NuxtRenderHTMLContext, context: {
|
|
36
|
+
event: H3Event;
|
|
37
|
+
}) => void | Promise<void>;
|
|
38
|
+
'render:island': (islandResponse: NuxtIslandResponse, context: {
|
|
39
|
+
event: H3Event;
|
|
40
|
+
islandContext: NuxtIslandContext;
|
|
41
|
+
}) => void | Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
declare module 'nitropack/types' {
|
|
45
|
+
interface NitroRuntimeConfigApp {
|
|
46
|
+
buildAssetsDir: string;
|
|
47
|
+
cdnURL: string;
|
|
48
|
+
}
|
|
21
49
|
interface NitroRouteRules {
|
|
22
50
|
ssr?: boolean;
|
|
23
51
|
noScripts?: boolean;
|
|
@@ -25,6 +53,16 @@ declare module 'nitropack' {
|
|
|
25
53
|
experimentalNoScripts?: boolean;
|
|
26
54
|
appMiddleware?: Record<string, boolean>;
|
|
27
55
|
}
|
|
56
|
+
}
|
|
57
|
+
declare module 'nitropack/types' {
|
|
58
|
+
interface NitroRuntimeConfig extends RuntimeConfig {
|
|
59
|
+
}
|
|
60
|
+
interface NitroRouteConfig {
|
|
61
|
+
ssr?: boolean;
|
|
62
|
+
noScripts?: boolean;
|
|
63
|
+
/** @deprecated Use `noScripts` instead */
|
|
64
|
+
experimentalNoScripts?: boolean;
|
|
65
|
+
}
|
|
28
66
|
interface NitroRuntimeHooks {
|
|
29
67
|
'dev:ssr-logs': (ctx: {
|
|
30
68
|
logs: LogObject[];
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import { isWindows } from 'std-env';
|
|
|
16
16
|
import { ImpoundPlugin } from 'impound';
|
|
17
17
|
import { resolveModulePath } from 'exsolve';
|
|
18
18
|
|
|
19
|
-
const version = "4.2.
|
|
19
|
+
const version = "4.2.1-29360021.ff37598b";
|
|
20
20
|
|
|
21
21
|
function toArray(value) {
|
|
22
22
|
return Array.isArray(value) ? value : [value];
|
|
@@ -28,7 +28,7 @@ if (/(?:chunks|shared)$/.test(_distDir)) {
|
|
|
28
28
|
const distDir = _distDir;
|
|
29
29
|
|
|
30
30
|
const template = () => {
|
|
31
|
-
return '<svg xmlns="http://www.w3.org/2000/svg" width="80" fill="none" class="nuxt-spa-loading" viewBox="0 0 37 25"><path d="M24.236 22.006h10.742L25.563 5.822l-8.979 14.31a4 4 0 0 1-3.388 1.874H2.978l11.631-20 5.897 10.567"/></svg><style>.nuxt-spa-loading{left:50%;position:fixed;top:50%;transform:translate(-50%,-50%)}.nuxt-spa-loading>path{fill:none;stroke:#00dc82;stroke-
|
|
31
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" width="80" fill="none" class="nuxt-spa-loading" viewBox="0 0 37 25"><path d="M24.236 22.006h10.742L25.563 5.822l-8.979 14.31a4 4 0 0 1-3.388 1.874H2.978l11.631-20 5.897 10.567"/></svg><style>.nuxt-spa-loading{left:50%;position:fixed;top:50%;transform:translate(-50%,-50%)}.nuxt-spa-loading>path{animation:nuxt-spa-loading-move 3s linear infinite;fill:none;stroke:#00dc82;stroke-dasharray:128;stroke-dashoffset:128;stroke-linecap:round;stroke-linejoin:round;stroke-width:4px}@keyframes nuxt-spa-loading-move{to{stroke-dashoffset:-128}}</style>';
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
function createImportProtectionPatterns(nuxt, options) {
|
|
@@ -91,7 +91,6 @@ const nitroSchemaTemplate = {
|
|
|
91
91
|
/* typescript */
|
|
92
92
|
`
|
|
93
93
|
${lines.join("\n")}
|
|
94
|
-
/// <reference path="./schema.d.ts" />
|
|
95
94
|
|
|
96
95
|
import type { RuntimeConfig } from 'nuxt/schema'
|
|
97
96
|
import type { H3Event } from 'h3'
|
|
@@ -123,6 +122,31 @@ declare module 'nitropack' {
|
|
|
123
122
|
'render:island': (islandResponse: NuxtIslandResponse, context: { event: H3Event, islandContext: NuxtIslandContext }) => void | Promise<void>
|
|
124
123
|
}
|
|
125
124
|
}
|
|
125
|
+
declare module 'nitropack/types' {
|
|
126
|
+
interface NitroRuntimeConfigApp {
|
|
127
|
+
buildAssetsDir: string
|
|
128
|
+
cdnURL: string
|
|
129
|
+
}
|
|
130
|
+
interface NitroRuntimeConfig extends RuntimeConfig {}
|
|
131
|
+
interface NitroRouteConfig {
|
|
132
|
+
ssr?: boolean
|
|
133
|
+
noScripts?: boolean
|
|
134
|
+
/** @deprecated Use \`noScripts\` instead */
|
|
135
|
+
experimentalNoScripts?: boolean
|
|
136
|
+
}
|
|
137
|
+
interface NitroRouteRules {
|
|
138
|
+
ssr?: boolean
|
|
139
|
+
noScripts?: boolean
|
|
140
|
+
/** @deprecated Use \`noScripts\` instead */
|
|
141
|
+
experimentalNoScripts?: boolean
|
|
142
|
+
appMiddleware?: Record<string, boolean>
|
|
143
|
+
}
|
|
144
|
+
interface NitroRuntimeHooks {
|
|
145
|
+
'dev:ssr-logs': (ctx: { logs: LogObject[], path: string }) => void | Promise<void>
|
|
146
|
+
'render:html': (htmlContext: NuxtRenderHTMLContext, context: { event: H3Event }) => void | Promise<void>
|
|
147
|
+
'render:island': (islandResponse: NuxtIslandResponse, context: { event: H3Event, islandContext: NuxtIslandContext }) => void | Promise<void>
|
|
148
|
+
}
|
|
149
|
+
}
|
|
126
150
|
`
|
|
127
151
|
);
|
|
128
152
|
}
|
|
@@ -177,8 +201,7 @@ async function bundle(nuxt) {
|
|
|
177
201
|
const modules = await resolveNuxtModule(rootDirWithSlash, moduleEntryPaths);
|
|
178
202
|
addTemplate(nitroSchemaTemplate);
|
|
179
203
|
const sharedDirs = /* @__PURE__ */ new Set();
|
|
180
|
-
|
|
181
|
-
if (isNuxtV4 && (nuxt.options.nitro.imports !== false && nuxt.options.imports.scan !== false)) {
|
|
204
|
+
if (nuxt.options.nitro.imports !== false && nuxt.options.imports.scan !== false) {
|
|
182
205
|
for (const layer of nuxt.options._layers) {
|
|
183
206
|
if (layer.config?.imports?.scan === false) {
|
|
184
207
|
continue;
|
|
@@ -269,13 +292,13 @@ async function bundle(nuxt) {
|
|
|
269
292
|
} : false,
|
|
270
293
|
scanDirs: layerDirs.map((dirs) => dirs.server),
|
|
271
294
|
renderer: resolve(distDir, "runtime/handlers/renderer"),
|
|
272
|
-
errorHandler: resolve(distDir, "runtime/handlers/error"),
|
|
273
295
|
nodeModulesDirs: nuxt.options.modulesDir,
|
|
274
296
|
handlers: nuxt.options.serverHandlers,
|
|
275
297
|
devHandlers: [],
|
|
276
298
|
baseURL: nuxt.options.app.baseURL,
|
|
277
299
|
virtual: {
|
|
278
|
-
"#internal/nuxt.config.mjs": () => nuxt.vfs["#build/nuxt.config.mjs"],
|
|
300
|
+
"#internal/nuxt.config.mjs": () => nuxt.vfs["#build/nuxt.config.mjs"] || "",
|
|
301
|
+
"#internal/nuxt/app-config": () => nuxt.vfs["#build/app.config.mjs"]?.replace(/\/\*\* client \*\*\/[\s\S]*\/\*\* client-end \*\*\//, "") || "",
|
|
279
302
|
"#spa-template": async () => `export const template = ${JSON.stringify(await spaLoadingTemplate(nuxt))}`,
|
|
280
303
|
// this will be overridden in vite plugin
|
|
281
304
|
"#internal/entry-chunk.mjs": () => `export const entryFileName = undefined`,
|
|
@@ -292,7 +315,8 @@ async function bundle(nuxt) {
|
|
|
292
315
|
tsconfigPath: "tsconfig.server.json",
|
|
293
316
|
tsConfig: {
|
|
294
317
|
compilerOptions: {
|
|
295
|
-
lib: ["esnext", "webworker", "dom.iterable"]
|
|
318
|
+
lib: ["esnext", "webworker", "dom.iterable"],
|
|
319
|
+
skipLibCheck: true
|
|
296
320
|
},
|
|
297
321
|
include: [
|
|
298
322
|
join(nuxt.options.buildDir, "types/nitro-nuxt.d.ts"),
|
|
@@ -307,7 +331,6 @@ async function bundle(nuxt) {
|
|
|
307
331
|
],
|
|
308
332
|
exclude: [
|
|
309
333
|
...nuxt.options.modulesDir.map((m) => relativeWithDot(nuxt.options.buildDir, m)),
|
|
310
|
-
// nitro generate output: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/core/nitro.ts#L186
|
|
311
334
|
relativeWithDot(nuxt.options.buildDir, resolve(nuxt.options.rootDir, "dist"))
|
|
312
335
|
]
|
|
313
336
|
}
|
|
@@ -371,16 +394,16 @@ async function bundle(nuxt) {
|
|
|
371
394
|
"#internal/nuxt/paths": resolve(distDir, "runtime/utils/paths")
|
|
372
395
|
},
|
|
373
396
|
replace: {
|
|
374
|
-
"process.env.NUXT_NO_SSR": nuxt.options.ssr === false,
|
|
375
|
-
"process.env.NUXT_EARLY_HINTS": nuxt.options.experimental.writeEarlyHints !== false,
|
|
397
|
+
"process.env.NUXT_NO_SSR": String(nuxt.options.ssr === false),
|
|
398
|
+
"process.env.NUXT_EARLY_HINTS": String(nuxt.options.experimental.writeEarlyHints !== false),
|
|
376
399
|
"process.env.NUXT_NO_SCRIPTS": String(nuxt.options.features.noScripts === "all" || !!nuxt.options.features.noScripts && !nuxt.options.dev),
|
|
377
|
-
"process.env.NUXT_INLINE_STYLES": !!nuxt.options.features.inlineStyles,
|
|
400
|
+
"process.env.NUXT_INLINE_STYLES": String(!!nuxt.options.features.inlineStyles),
|
|
378
401
|
"process.env.PARSE_ERROR_DATA": String(!!nuxt.options.experimental.parseErrorData),
|
|
379
|
-
"process.env.NUXT_JSON_PAYLOADS": !!nuxt.options.experimental.renderJsonPayloads,
|
|
380
|
-
"process.env.NUXT_ASYNC_CONTEXT": !!nuxt.options.experimental.asyncContext,
|
|
381
|
-
"process.env.NUXT_SHARED_DATA": !!nuxt.options.experimental.sharedPrerenderData,
|
|
382
|
-
"process.dev": nuxt.options.dev,
|
|
383
|
-
"__VUE_PROD_DEVTOOLS__": false
|
|
402
|
+
"process.env.NUXT_JSON_PAYLOADS": String(!!nuxt.options.experimental.renderJsonPayloads),
|
|
403
|
+
"process.env.NUXT_ASYNC_CONTEXT": String(!!nuxt.options.experimental.asyncContext),
|
|
404
|
+
"process.env.NUXT_SHARED_DATA": String(!!nuxt.options.experimental.sharedPrerenderData),
|
|
405
|
+
"process.dev": String(nuxt.options.dev),
|
|
406
|
+
"__VUE_PROD_DEVTOOLS__": String(false)
|
|
384
407
|
},
|
|
385
408
|
rollupConfig: {
|
|
386
409
|
output: {
|
|
@@ -393,6 +416,17 @@ async function bundle(nuxt) {
|
|
|
393
416
|
},
|
|
394
417
|
logLevel: logLevelMapReverse[nuxt.options.logLevel]
|
|
395
418
|
});
|
|
419
|
+
if (nuxt.options.experimental.serverAppConfig && nitroConfig.imports) {
|
|
420
|
+
nitroConfig.imports.imports ||= [];
|
|
421
|
+
nitroConfig.imports.imports.push({
|
|
422
|
+
name: "useAppConfig",
|
|
423
|
+
from: resolve(distDir, "runtime/utils/app-config"),
|
|
424
|
+
priority: -1
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
if (!nitroConfig.errorHandler && (nuxt.options.dev || !nuxt.options.experimental.noVueServer)) {
|
|
428
|
+
nitroConfig.errorHandler = resolve(distDir, "runtime/handlers/error");
|
|
429
|
+
}
|
|
396
430
|
nitroConfig.srcDir = resolve(nuxt.options.rootDir, nuxt.options.srcDir, nitroConfig.srcDir);
|
|
397
431
|
nitroConfig.ignore ||= [];
|
|
398
432
|
nitroConfig.ignore.push(
|
|
@@ -428,16 +462,6 @@ async function bundle(nuxt) {
|
|
|
428
462
|
await promises.writeFile(join(tempDir, `meta/${buildId}.json`), JSON.stringify({}));
|
|
429
463
|
});
|
|
430
464
|
}
|
|
431
|
-
if (nuxt.options.future.compatibilityVersion !== 4) {
|
|
432
|
-
nuxt.hook("nitro:config", (config) => {
|
|
433
|
-
for (const value of Object.values(config.routeRules || {})) {
|
|
434
|
-
if ("experimentalNoScripts" in value) {
|
|
435
|
-
value.noScripts = value.experimentalNoScripts;
|
|
436
|
-
delete value.experimentalNoScripts;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
465
|
nuxt.hook("nitro:config", (config) => {
|
|
442
466
|
config.alias ||= {};
|
|
443
467
|
config.alias["#app-manifest"] = join(tempDir, `meta/${buildId}.json`);
|
|
@@ -531,13 +555,6 @@ async function bundle(nuxt) {
|
|
|
531
555
|
nitroConfig.virtual["#build/dist/server/styles.mjs".replace(FORWARD_SLASH_RE, "\\")] = "export default {}";
|
|
532
556
|
}
|
|
533
557
|
}
|
|
534
|
-
if (nuxt.options.experimental.respectNoSSRHeader) {
|
|
535
|
-
nitroConfig.handlers ||= [];
|
|
536
|
-
nitroConfig.handlers.push({
|
|
537
|
-
handler: resolve(distDir, "runtime/middleware/no-ssr"),
|
|
538
|
-
middleware: true
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
558
|
nitroConfig.rollupConfig.plugins = await nitroConfig.rollupConfig.plugins || [];
|
|
542
559
|
nitroConfig.rollupConfig.plugins = toArray(nitroConfig.rollupConfig.plugins);
|
|
543
560
|
const sharedDir = withTrailingSlash(resolve(nuxt.options.rootDir, nuxt.options.dir.shared));
|
|
@@ -684,6 +701,7 @@ async function bundle(nuxt) {
|
|
|
684
701
|
if (!nuxt.options.dev && nuxt.options.experimental.noVueServer) {
|
|
685
702
|
nitro.hooks.hook("rollup:before", (nitro2) => {
|
|
686
703
|
if (nitro2.options.preset === "nitro-prerender") {
|
|
704
|
+
nitro2.options.errorHandler = resolve(distDir, "runtime/handlers/error");
|
|
687
705
|
return;
|
|
688
706
|
}
|
|
689
707
|
const nuxtErrorHandler = nitro2.options.handlers.findIndex((h) => h.route === "/__nuxt_error");
|
|
@@ -691,9 +709,13 @@ async function bundle(nuxt) {
|
|
|
691
709
|
nitro2.options.handlers.splice(nuxtErrorHandler, 1);
|
|
692
710
|
}
|
|
693
711
|
nitro2.options.renderer = void 0;
|
|
694
|
-
nitro2.options.errorHandler = "#internal/nitro/error";
|
|
695
712
|
});
|
|
696
713
|
}
|
|
714
|
+
nitro.hooks.hook("types:extend", (types) => {
|
|
715
|
+
types.tsConfig ||= {};
|
|
716
|
+
const rootDirGlob = relativeWithDot(nuxt.options.buildDir, join(nuxt.options.rootDir, "**/*"));
|
|
717
|
+
types.tsConfig.include = types.tsConfig.include?.filter((i) => i !== rootDirGlob);
|
|
718
|
+
});
|
|
697
719
|
nuxt.hook("prepare:types", async (opts) => {
|
|
698
720
|
if (!nuxt.options.dev) {
|
|
699
721
|
await scanHandlers(nitro);
|
|
@@ -701,7 +723,21 @@ async function bundle(nuxt) {
|
|
|
701
723
|
}
|
|
702
724
|
opts.tsConfig.exclude ||= [];
|
|
703
725
|
opts.tsConfig.exclude.push(relative(nuxt.options.buildDir, resolve(nuxt.options.rootDir, nitro.options.output.dir)));
|
|
726
|
+
opts.tsConfig.exclude.push(relative(nuxt.options.buildDir, resolve(nuxt.options.rootDir, nuxt.options.serverDir)));
|
|
704
727
|
opts.references.push({ path: resolve(nuxt.options.buildDir, "types/nitro.d.ts") });
|
|
728
|
+
opts.sharedTsConfig.compilerOptions ||= {};
|
|
729
|
+
opts.sharedTsConfig.compilerOptions.paths ||= {};
|
|
730
|
+
for (const key in nuxt.options.alias) {
|
|
731
|
+
if (nitro.options.alias[key] && nitro.options.alias[key] === nuxt.options.alias[key]) {
|
|
732
|
+
const dirKey = join(key, "*");
|
|
733
|
+
if (opts.tsConfig.compilerOptions?.paths[key]) {
|
|
734
|
+
opts.sharedTsConfig.compilerOptions.paths[key] = opts.tsConfig.compilerOptions.paths[key];
|
|
735
|
+
}
|
|
736
|
+
if (opts.tsConfig.compilerOptions?.paths[dirKey]) {
|
|
737
|
+
opts.sharedTsConfig.compilerOptions.paths[dirKey] = opts.tsConfig.compilerOptions.paths[dirKey];
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
705
741
|
});
|
|
706
742
|
if (nitro.options.static) {
|
|
707
743
|
nitro.hooks.hook("prerender:routes", (routes) => {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { joinURL, withQuery, withoutBase } from "ufo";
|
|
2
2
|
import { appendResponseHeader, getRequestHeaders, send, setResponseHeader, setResponseHeaders, setResponseStatus } from "h3";
|
|
3
|
+
import { useNitroApp, useRuntimeConfig } from "nitropack/runtime";
|
|
3
4
|
import { isJsonRequest } from "../utils/error.js";
|
|
4
|
-
import { useRuntimeConfig } from "#internal/nitro";
|
|
5
|
-
import { useNitroApp } from "#internal/nitro/app";
|
|
6
5
|
import { generateErrorOverlayHTML } from "../utils/dev.js";
|
|
7
6
|
export default (async function errorhandler(error, event, { defaultHandler }) {
|
|
8
7
|
if (event.handled || isJsonRequest(event)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RenderResponse } from 'nitropack';
|
|
1
|
+
import type { RenderResponse } from 'nitropack/types';
|
|
2
2
|
import type { NuxtIslandResponse } from 'nuxt/app';
|
|
3
3
|
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<NuxtIslandResponse | Partial<RenderResponse>>>;
|
|
4
4
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useNitroApp } from "nitropack/runtime";
|
|
1
2
|
import { destr } from "destr";
|
|
2
3
|
import { defineEventHandler, getQuery, readBody, setResponseHeaders } from "h3";
|
|
3
4
|
import { resolveUnrefHeadInput } from "@unhead/vue";
|
|
@@ -8,7 +9,6 @@ import { createSSRContext } from "../utils/renderer/app.js";
|
|
|
8
9
|
import { getSSRRenderer } from "../utils/renderer/build-files.js";
|
|
9
10
|
import { renderInlineStyles } from "../utils/renderer/inline-styles.js";
|
|
10
11
|
import { getClientIslandResponse, getServerComponentHTML, getSlotIslandResponse } from "../utils/renderer/islands.js";
|
|
11
|
-
import { useNitroApp } from "#internal/nitro";
|
|
12
12
|
const ISLAND_SUFFIX_RE = /\.json(?:\?.*)?$/;
|
|
13
13
|
export default defineEventHandler(async (event) => {
|
|
14
14
|
const nitroApp = useNitroApp();
|
|
@@ -64,8 +64,6 @@ export default defineEventHandler(async (event) => {
|
|
|
64
64
|
islandHead[key] = value;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
islandHead.link ||= [];
|
|
68
|
-
islandHead.style ||= [];
|
|
69
67
|
const islandResponse = {
|
|
70
68
|
id: islandContext.id,
|
|
71
69
|
head: islandHead,
|
|
@@ -9,13 +9,13 @@ import { appendResponseHeader, createError, getQuery, getResponseStatus, getResp
|
|
|
9
9
|
import { getQuery as getURLQuery, joinURL } from "ufo";
|
|
10
10
|
import { propsToString, renderSSRHead } from "@unhead/vue/server";
|
|
11
11
|
import destr from "destr";
|
|
12
|
+
import { defineRenderHandler, getRouteRules, useNitroApp } from "nitropack/runtime";
|
|
12
13
|
import { getRenderer } from "../utils/renderer/build-files.js";
|
|
13
14
|
import { payloadCache } from "../utils/cache.js";
|
|
14
15
|
import { renderPayloadJsonScript, renderPayloadResponse, renderPayloadScript, splitPayload } from "../utils/renderer/payload.js";
|
|
15
16
|
import { createSSRContext, setSSRError } from "../utils/renderer/app.js";
|
|
16
17
|
import { renderInlineStyles } from "../utils/renderer/inline-styles.js";
|
|
17
18
|
import { replaceIslandTeleports } from "../utils/renderer/islands.js";
|
|
18
|
-
import { defineRenderHandler, getRouteRules, useNitroApp } from "#internal/nitro";
|
|
19
19
|
import { renderSSRHeadOptions } from "#internal/unhead.config.mjs";
|
|
20
20
|
import { appHead, appTeleportAttrs, appTeleportTag, componentIslands, appManifest as isAppManifestEnabled } from "#internal/nuxt.config.mjs";
|
|
21
21
|
import entryIds from "#internal/nuxt/entry-ids.mjs";
|
|
@@ -67,7 +67,7 @@ export default (nitroApp) => {
|
|
|
67
67
|
htmlContext.bodyAppend.unshift(`<script type="application/json" data-nuxt-logs="${appId}">${stringify(ctx.logs, reducers)}<\/script>`);
|
|
68
68
|
} catch (e) {
|
|
69
69
|
const shortError = e instanceof Error && "toString" in e ? ` Received \`${e.toString()}\`.` : "";
|
|
70
|
-
console.warn(`[nuxt] Failed to stringify dev server logs.${shortError} You can define your own reducer/reviver for rich types following the instructions in https://nuxt.com/docs/api/composables/use-nuxt-app#payload.`);
|
|
70
|
+
console.warn(`[nuxt] Failed to stringify dev server logs.${shortError} You can define your own reducer/reviver for rich types following the instructions in https://nuxt.com/docs/4.x/api/composables/use-nuxt-app#payload.`);
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type DefaultMessages = Record<"appName" | "
|
|
1
|
+
export type DefaultMessages = Record<"appName" | "statusCode" | "statusMessage" | "description" | "refresh", string | boolean | number>;
|
|
2
2
|
export declare const template: (messages: Partial<DefaultMessages>) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { escapeHtml } from "@vue/shared";
|
|
2
|
-
const _messages = { "appName": "Nuxt", "
|
|
2
|
+
const _messages = { "appName": "Nuxt", "statusCode": 500, "statusMessage": "Internal server error", "description": "This page is temporarily unavailable.", "refresh": "Refresh this page" };
|
|
3
3
|
export const template = (messages) => {
|
|
4
4
|
messages = { ..._messages, ...messages };
|
|
5
|
-
return '<!DOCTYPE html><html lang="en"><head><title>' + escapeHtml(messages.statusCode) + " - " + escapeHtml(messages.statusMessage) + " | " + escapeHtml(messages.appName) + `</title><meta charset="utf-8"><meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0" name="viewport"><
|
|
5
|
+
return '<!DOCTYPE html><html lang="en"><head><title>' + escapeHtml(messages.statusCode) + " - " + escapeHtml(messages.statusMessage) + " | " + escapeHtml(messages.appName) + `</title><meta charset="utf-8"><meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0" name="viewport"><script>!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver(e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)}).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();<\/script><style>*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}h1,h2,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.grid{display:grid}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.max-w-520px{max-width:520px}.min-h-screen{min-height:100vh}.place-content-center{place-content:center}.overflow-hidden{overflow:hidden}.bg-white{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2{padding-left:.5rem;padding-right:.5rem}.text-center{text-align:center}.text-\\[80px\\]{font-size:80px}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\\[\\#020420\\]{--un-text-opacity:1;color:rgb(2 4 32/var(--un-text-opacity))}.text-\\[\\#64748B\\]{--un-text-opacity:1;color:rgb(100 116 139/var(--un-text-opacity))}.font-semibold{font-weight:600}.leading-none{line-height:1}.tracking-wide{letter-spacing:.025em}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\\:bg-\\[\\#020420\\]{--un-bg-opacity:1;background-color:rgb(2 4 32/var(--un-bg-opacity))}.dark\\:text-white{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(min-width:640px){.sm\\:text-\\[110px\\]{font-size:110px}.sm\\:text-3xl{font-size:1.875rem;line-height:2.25rem}}</style></head><body class="antialiased bg-white dark:bg-[#020420] dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-[#020420] tracking-wide"><div class="max-w-520px text-center"><h1 class="font-semibold leading-none mb-4 sm:text-[110px] tabular-nums text-[80px]">` + escapeHtml(messages.statusCode) + '</h1><h2 class="font-semibold mb-2 sm:text-3xl text-2xl">' + escapeHtml(messages.statusMessage) + '</h2><p class="mb-4 px-2 text-[#64748B] text-md">' + escapeHtml(messages.description) + "</p></div></body></html>";
|
|
6
6
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { klona } from "klona";
|
|
2
|
+
import _inlineAppConfig from "#internal/nuxt/app-config";
|
|
3
|
+
const _sharedAppConfig = _deepFreeze(klona(_inlineAppConfig));
|
|
4
|
+
export function useAppConfig(event) {
|
|
5
|
+
if (!event) {
|
|
6
|
+
return _sharedAppConfig;
|
|
7
|
+
}
|
|
8
|
+
event.context.nuxt ||= {};
|
|
9
|
+
if (event.context.nuxt.appConfig) {
|
|
10
|
+
return event.context.nuxt.appConfig;
|
|
11
|
+
}
|
|
12
|
+
const appConfig = klona(_inlineAppConfig);
|
|
13
|
+
event.context.nuxt.appConfig = appConfig;
|
|
14
|
+
return appConfig;
|
|
15
|
+
}
|
|
16
|
+
function _deepFreeze(object) {
|
|
17
|
+
const propNames = Object.getOwnPropertyNames(object);
|
|
18
|
+
for (const name of propNames) {
|
|
19
|
+
const value = object[name];
|
|
20
|
+
if (value && typeof value === "object") {
|
|
21
|
+
_deepFreeze(value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return Object.freeze(object);
|
|
25
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const payloadCache:
|
|
2
|
-
export declare const islandCache:
|
|
3
|
-
export declare const islandPropCache:
|
|
1
|
+
export declare const payloadCache: import("unstorage").Storage<import("unstorage").StorageValue> | null;
|
|
2
|
+
export declare const islandCache: import("unstorage").Storage<import("unstorage").StorageValue> | null;
|
|
3
|
+
export declare const islandPropCache: import("unstorage").Storage<import("unstorage").StorageValue> | null;
|
|
4
4
|
export declare const sharedPrerenderPromises: Map<string, Promise<any>> | null;
|
|
5
5
|
export declare const sharedPrerenderCache: {
|
|
6
6
|
get<T = unknown>(key: string): Promise<T> | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useStorage } from "
|
|
1
|
+
import { useStorage } from "nitropack/runtime";
|
|
2
2
|
export const payloadCache = import.meta.prerender ? useStorage("internal:nuxt:prerender:payload") : null;
|
|
3
3
|
export const islandCache = import.meta.prerender ? useStorage("internal:nuxt:prerender:island") : null;
|
|
4
4
|
export const islandPropCache = import.meta.prerender ? useStorage("internal:nuxt:prerender:island-props") : null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { H3Event } from 'h3';
|
|
2
2
|
/**
|
|
3
|
-
* Nitro internal functions extracted from https://github.com/nitrojs/nitro/blob/
|
|
3
|
+
* Nitro internal functions extracted from https://github.com/nitrojs/nitro/blob/main/src/runtime/internal/utils.ts
|
|
4
4
|
*/
|
|
5
5
|
export declare function isJsonRequest(event: H3Event): boolean;
|
|
6
6
|
export declare function hasReqHeader(event: H3Event, name: string, includes: string): boolean | "" | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "nitropack/runtime";
|
|
1
2
|
import { createHead } from "@unhead/vue/server";
|
|
2
3
|
import { sharedPrerenderCache } from "../cache.js";
|
|
3
|
-
import { useRuntimeConfig } from "#internal/nitro";
|
|
4
4
|
import unheadOptions from "#internal/unhead-options.mjs";
|
|
5
5
|
const PRERENDER_NO_SSR_ROUTES = /* @__PURE__ */ new Set(["/index.html", "/200.html", "/404.html"]);
|
|
6
6
|
export function createSSRContext(event) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRenderer } from "vue-bundle-renderer/runtime";
|
|
2
2
|
import { renderToString as _renderToString } from "vue/server-renderer";
|
|
3
3
|
import { propsToString } from "@unhead/vue/server";
|
|
4
|
-
import { useRuntimeConfig } from "
|
|
4
|
+
import { useRuntimeConfig } from "nitropack/runtime";
|
|
5
5
|
import { appRootAttrs, appRootTag, appSpaLoaderAttrs, appSpaLoaderTag, spaLoadingTemplateOutside } from "#internal/nuxt.config.mjs";
|
|
6
6
|
import { buildAssetsURL } from "#internal/nuxt/paths";
|
|
7
7
|
const APP_ROOT_OPEN_TAG = `<${appRootTag}${propsToString(appRootAttrs)}>`;
|
|
@@ -27,8 +27,8 @@ export declare function splitPayload(ssrContext: NuxtSSRContext): {
|
|
|
27
27
|
state?: Record<string, any> | undefined;
|
|
28
28
|
once?: Set<string> | undefined;
|
|
29
29
|
config?: Pick<import("nuxt/schema").RuntimeConfig, "public" | "app"> | undefined;
|
|
30
|
-
error?:
|
|
31
|
-
_errors?: Record<string, import("nuxt/app").NuxtError<unknown> |
|
|
30
|
+
error?: import("nuxt/app").NuxtError<unknown> | undefined;
|
|
31
|
+
_errors?: Record<string, import("nuxt/app").NuxtError<unknown> | undefined> | undefined;
|
|
32
32
|
};
|
|
33
33
|
payload: {
|
|
34
34
|
data: Record<string, any> | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/nitro-server-nightly",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1-29360021.ff37598b",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@nuxt/devalue": "^2.0.2",
|
|
22
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@
|
|
23
|
-
"@unhead/vue": "^2.0.
|
|
22
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.2.1-29360021.ff37598b",
|
|
23
|
+
"@unhead/vue": "^2.0.19",
|
|
24
24
|
"@vue/shared": "^3.5.22",
|
|
25
25
|
"consola": "^3.4.2",
|
|
26
26
|
"defu": "^6.1.4",
|
|
27
27
|
"destr": "^2.0.5",
|
|
28
|
-
"devalue": "^5.
|
|
28
|
+
"devalue": "^5.4.2",
|
|
29
29
|
"errx": "^0.1.0",
|
|
30
30
|
"escape-string-regexp": "^5.0.0",
|
|
31
31
|
"exsolve": "^1.0.7",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"pathe": "^2.0.3",
|
|
38
38
|
"pkg-types": "^2.3.0",
|
|
39
39
|
"radix3": "^1.1.2",
|
|
40
|
-
"std-env": "^3.
|
|
40
|
+
"std-env": "^3.10.0",
|
|
41
41
|
"ufo": "^1.6.1",
|
|
42
42
|
"unctx": "^2.4.1",
|
|
43
43
|
"unstorage": "^1.17.1",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"vue-devtools-stub": "^0.1.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"nuxt": "npm:nuxt-nightly@
|
|
49
|
+
"nuxt": "npm:nuxt-nightly@4.2.1-29360021.ff37598b"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@
|
|
53
|
-
"nuxt": "npm:nuxt-nightly@
|
|
52
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.1-29360021.ff37598b",
|
|
53
|
+
"nuxt": "npm:nuxt-nightly@4.2.1-29360021.ff37598b",
|
|
54
54
|
"unbuild": "3.6.1",
|
|
55
55
|
"vitest": "3.2.4"
|
|
56
56
|
},
|