@nuxt/nitro-server-nightly 4.3.0-29441750.a63d4a01 → 4.3.0-29442002.5d974989
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
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
<a href="https://nuxt.com"><img src="https://img.shields.io/badge/Nuxt%20Docs-18181B?logo=nuxt" alt="Website"></a>
|
|
11
11
|
<a href="https://chat.nuxt.dev"><img src="https://img.shields.io/badge/Nuxt%20Discord-18181B?logo=discord" alt="Discord"></a>
|
|
12
12
|
<a href="https://securityscorecards.dev/"><img src="https://api.securityscorecards.dev/projects/github.com/nuxt/nuxt/badge" alt="Nuxt openssf scorecard score"></a>
|
|
13
|
+
<a href="https://deepwiki.com/nuxt/nuxt"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
|
|
13
14
|
</p>
|
|
14
15
|
|
|
15
16
|
Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.
|
package/dist/index.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import { isWindows } from 'std-env';
|
|
|
19
19
|
import { ImpoundPlugin } from 'impound';
|
|
20
20
|
import { resolveModulePath } from 'exsolve';
|
|
21
21
|
|
|
22
|
-
const version = "4.3.0-
|
|
22
|
+
const version = "4.3.0-29442002.5d974989";
|
|
23
23
|
const nitroBuilder = {
|
|
24
24
|
version: version};
|
|
25
25
|
|
|
@@ -316,17 +316,21 @@ async function bundle(nuxt) {
|
|
|
316
316
|
// this will be overridden in vite plugin
|
|
317
317
|
"#internal/entry-chunk.mjs": () => `export const entryFileName = undefined`,
|
|
318
318
|
"#internal/nuxt/entry-ids.mjs": () => `export default []`,
|
|
319
|
-
"#internal/nuxt/nitro-config.mjs": () =>
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
319
|
+
"#internal/nuxt/nitro-config.mjs": () => {
|
|
320
|
+
const hasCachedRoutes = Object.values(nitro.options.routeRules).some((r) => r.isr || r.cache);
|
|
321
|
+
return [
|
|
322
|
+
`export const NUXT_NO_SSR = ${nuxt.options.ssr === false}`,
|
|
323
|
+
`export const NUXT_EARLY_HINTS = ${nuxt.options.experimental.writeEarlyHints !== false}`,
|
|
324
|
+
`export const NUXT_NO_SCRIPTS = ${nuxt.options.features.noScripts === "all" || !!nuxt.options.features.noScripts && !nuxt.options.dev}`,
|
|
325
|
+
`export const NUXT_INLINE_STYLES = ${!!nuxt.options.features.inlineStyles}`,
|
|
326
|
+
`export const PARSE_ERROR_DATA = ${!!nuxt.options.experimental.parseErrorData}`,
|
|
327
|
+
`export const NUXT_JSON_PAYLOADS = ${!!nuxt.options.experimental.renderJsonPayloads}`,
|
|
328
|
+
`export const NUXT_ASYNC_CONTEXT = ${!!nuxt.options.experimental.asyncContext}`,
|
|
329
|
+
`export const NUXT_SHARED_DATA = ${!!nuxt.options.experimental.sharedPrerenderData}`,
|
|
330
|
+
`export const NUXT_PAYLOAD_EXTRACTION = ${!!nuxt.options.experimental.payloadExtraction}`,
|
|
331
|
+
`export const NUXT_RUNTIME_PAYLOAD_EXTRACTION = ${hasCachedRoutes}`
|
|
332
|
+
].join("\n");
|
|
333
|
+
}
|
|
330
334
|
},
|
|
331
335
|
routeRules: {
|
|
332
336
|
"/__nuxt_error": { cache: false }
|
|
@@ -493,6 +497,10 @@ async function bundle(nuxt) {
|
|
|
493
497
|
value = normalizedRules;
|
|
494
498
|
}
|
|
495
499
|
}
|
|
500
|
+
if (name === "cache" || name === "isr") {
|
|
501
|
+
name = "payload";
|
|
502
|
+
value = Boolean(value);
|
|
503
|
+
}
|
|
496
504
|
return `${name}: ${JSON.stringify(value)}`;
|
|
497
505
|
}).join(",")}}`;
|
|
498
506
|
}
|
|
@@ -504,6 +512,24 @@ async function bundle(nuxt) {
|
|
|
504
512
|
`;
|
|
505
513
|
}
|
|
506
514
|
});
|
|
515
|
+
if (nuxt.options.experimental.payloadExtraction) {
|
|
516
|
+
nuxt.hook("nitro:init", (nitro2) => {
|
|
517
|
+
nitro2.hooks.hook("build:before", (nitro3) => {
|
|
518
|
+
for (const [route, value] of Object.entries(nitro3.options.routeRules)) {
|
|
519
|
+
if ((value.isr || value.cache) && !route.endsWith("*") && !route.endsWith("/_payload.json")) {
|
|
520
|
+
const payloadKey = route + "/_payload.json";
|
|
521
|
+
const defaults = {};
|
|
522
|
+
for (const key of ["isr", "cache"]) {
|
|
523
|
+
if (key in value) {
|
|
524
|
+
defaults[key] = value[key];
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
nitro3.options.routeRules[payloadKey] = defu(nitro3.options.routeRules[payloadKey], defaults);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
});
|
|
532
|
+
}
|
|
507
533
|
if (nuxt.options.experimental.appManifest) {
|
|
508
534
|
const buildId = nuxt.options.runtimeConfig.app.buildId ||= nuxt.options.buildId;
|
|
509
535
|
const buildTimestamp = Date.now();
|
|
@@ -12,7 +12,7 @@ import { createSSRContext, setSSRError } from "../utils/renderer/app.js";
|
|
|
12
12
|
import { renderInlineStyles } from "../utils/renderer/inline-styles.js";
|
|
13
13
|
import { replaceIslandTeleports } from "../utils/renderer/islands.js";
|
|
14
14
|
import { renderSSRHeadOptions } from "#internal/unhead.config.mjs";
|
|
15
|
-
import { NUXT_ASYNC_CONTEXT, NUXT_EARLY_HINTS, NUXT_INLINE_STYLES, NUXT_JSON_PAYLOADS, NUXT_NO_SCRIPTS, NUXT_PAYLOAD_EXTRACTION, PARSE_ERROR_DATA } from "#internal/nuxt/nitro-config.mjs";
|
|
15
|
+
import { NUXT_ASYNC_CONTEXT, NUXT_EARLY_HINTS, NUXT_INLINE_STYLES, NUXT_JSON_PAYLOADS, NUXT_NO_SCRIPTS, NUXT_PAYLOAD_EXTRACTION, NUXT_RUNTIME_PAYLOAD_EXTRACTION, PARSE_ERROR_DATA } from "#internal/nuxt/nitro-config.mjs";
|
|
16
16
|
import { appHead, appTeleportAttrs, appTeleportTag, componentIslands, appManifest as isAppManifestEnabled } from "#internal/nuxt.config.mjs";
|
|
17
17
|
import entryIds from "#internal/nuxt/entry-ids.mjs";
|
|
18
18
|
import { entryFileName } from "#internal/entry-chunk.mjs";
|
|
@@ -55,7 +55,9 @@ export default defineRenderHandler(async (event) => {
|
|
|
55
55
|
}
|
|
56
56
|
setSSRError(ssrContext, ssrError);
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const routeOptions = getRouteRules(event);
|
|
59
|
+
const _PAYLOAD_EXTRACTION = !ssrContext.noSSR && (import.meta.prerender && NUXT_PAYLOAD_EXTRACTION || NUXT_RUNTIME_PAYLOAD_EXTRACTION && (routeOptions.isr || routeOptions.cache));
|
|
60
|
+
const isRenderingPayload = _PAYLOAD_EXTRACTION && PAYLOAD_URL_RE.test(ssrContext.url);
|
|
59
61
|
if (isRenderingPayload) {
|
|
60
62
|
const url = ssrContext.url.substring(0, ssrContext.url.lastIndexOf("/")) || "/";
|
|
61
63
|
ssrContext.url = url;
|
|
@@ -64,11 +66,9 @@ export default defineRenderHandler(async (event) => {
|
|
|
64
66
|
return payloadCache.getItem(url);
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
|
-
const routeOptions = getRouteRules(event);
|
|
68
69
|
if (routeOptions.ssr === false) {
|
|
69
70
|
ssrContext.noSSR = true;
|
|
70
71
|
}
|
|
71
|
-
const _PAYLOAD_EXTRACTION = import.meta.prerender && NUXT_PAYLOAD_EXTRACTION && !ssrContext.noSSR;
|
|
72
72
|
const payloadURL = _PAYLOAD_EXTRACTION ? joinURL(ssrContext.runtimeConfig.app.cdnURL || ssrContext.runtimeConfig.app.baseURL, ssrContext.url.replace(/\?.*$/, ""), PAYLOAD_FILENAME) + "?" + ssrContext.runtimeConfig.app.buildId : void 0;
|
|
73
73
|
const renderer = await getRenderer(ssrContext);
|
|
74
74
|
if (NUXT_EARLY_HINTS && !isRenderingPayload && !import.meta.prerender) {
|
|
@@ -105,7 +105,7 @@ export default defineRenderHandler(async (event) => {
|
|
|
105
105
|
}
|
|
106
106
|
return response;
|
|
107
107
|
}
|
|
108
|
-
if (_PAYLOAD_EXTRACTION) {
|
|
108
|
+
if (_PAYLOAD_EXTRACTION && import.meta.prerender) {
|
|
109
109
|
appendResponseHeader(event, "x-nitro-prerender", joinURL(ssrContext.url.replace(/\?.*$/, ""), PAYLOAD_FILENAME));
|
|
110
110
|
await payloadCache.setItem(ssrContext.url === "/" ? "/" : ssrContext.url.replace(/\/$/, ""), renderPayloadResponse(ssrContext));
|
|
111
111
|
}
|
|
@@ -168,7 +168,7 @@ export default defineRenderHandler(async (event) => {
|
|
|
168
168
|
link: getPrefetchLinks(ssrContext, renderer.rendererContext)
|
|
169
169
|
}, headEntryOptions);
|
|
170
170
|
ssrContext.head.push({
|
|
171
|
-
script: _PAYLOAD_EXTRACTION ? NUXT_JSON_PAYLOADS ? renderPayloadJsonScript({ ssrContext, data: splitPayload(ssrContext).initial, src: payloadURL }) : renderPayloadScript({ ssrContext, data: splitPayload(ssrContext).initial, src: payloadURL }) : NUXT_JSON_PAYLOADS ? renderPayloadJsonScript({ ssrContext, data: ssrContext.payload }) : renderPayloadScript({ ssrContext, data: ssrContext.payload })
|
|
171
|
+
script: _PAYLOAD_EXTRACTION ? NUXT_JSON_PAYLOADS ? renderPayloadJsonScript({ ssrContext, data: splitPayload(ssrContext).initial, src: payloadURL }) : renderPayloadScript({ ssrContext, data: splitPayload(ssrContext).initial, routeOptions, src: payloadURL }) : NUXT_JSON_PAYLOADS ? renderPayloadJsonScript({ ssrContext, data: ssrContext.payload }) : renderPayloadScript({ ssrContext, data: ssrContext.payload, routeOptions })
|
|
172
172
|
}, {
|
|
173
173
|
...headEntryOptions,
|
|
174
174
|
// this should come before another end of body scripts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RenderResponse } from 'nitropack/types';
|
|
1
|
+
import type { NitroRouteRules, RenderResponse } from 'nitropack/types';
|
|
2
2
|
import type { Script } from '@unhead/vue';
|
|
3
3
|
import type { NuxtPayload, NuxtSSRContext } from 'nuxt/app';
|
|
4
4
|
export declare function renderPayloadResponse(ssrContext: NuxtSSRContext): RenderResponse;
|
|
@@ -9,6 +9,7 @@ export declare function renderPayloadJsonScript(opts: {
|
|
|
9
9
|
}): Script[];
|
|
10
10
|
export declare function renderPayloadScript(opts: {
|
|
11
11
|
ssrContext: NuxtSSRContext;
|
|
12
|
+
routeOptions: NitroRouteRules;
|
|
12
13
|
data?: any;
|
|
13
14
|
src?: string;
|
|
14
15
|
}): Script[];
|
|
@@ -2,7 +2,7 @@ import { getResponseStatus, getResponseStatusText } from "h3";
|
|
|
2
2
|
import devalue from "@nuxt/devalue";
|
|
3
3
|
import { stringify, uneval } from "devalue";
|
|
4
4
|
import { appId, multiApp } from "#internal/nuxt.config.mjs";
|
|
5
|
-
import { NUXT_JSON_PAYLOADS, NUXT_NO_SSR, NUXT_PAYLOAD_EXTRACTION } from "#internal/nuxt/nitro-config.mjs";
|
|
5
|
+
import { NUXT_JSON_PAYLOADS, NUXT_NO_SSR, NUXT_PAYLOAD_EXTRACTION, NUXT_RUNTIME_PAYLOAD_EXTRACTION } from "#internal/nuxt/nitro-config.mjs";
|
|
6
6
|
export function renderPayloadResponse(ssrContext) {
|
|
7
7
|
return {
|
|
8
8
|
body: NUXT_JSON_PAYLOADS ? stringify(splitPayload(ssrContext).payload, ssrContext["~payloadReducers"]) : `export default ${devalue(splitPayload(ssrContext).payload)}`,
|
|
@@ -38,7 +38,7 @@ export function renderPayloadJsonScript(opts) {
|
|
|
38
38
|
}
|
|
39
39
|
export function renderPayloadScript(opts) {
|
|
40
40
|
opts.data.config = opts.ssrContext.config;
|
|
41
|
-
const _PAYLOAD_EXTRACTION = import.meta.prerender && NUXT_PAYLOAD_EXTRACTION &&
|
|
41
|
+
const _PAYLOAD_EXTRACTION = !opts.ssrContext.noSSR && (import.meta.prerender && NUXT_PAYLOAD_EXTRACTION || NUXT_RUNTIME_PAYLOAD_EXTRACTION && (opts.routeOptions.isr || opts.routeOptions.cache));
|
|
42
42
|
const nuxtData = devalue(opts.data);
|
|
43
43
|
if (_PAYLOAD_EXTRACTION) {
|
|
44
44
|
const singleAppPayload2 = `import p from "${opts.src}";window.__NUXT__={...p,...(${nuxtData})}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/nitro-server-nightly",
|
|
3
|
-
"version": "4.3.0-
|
|
3
|
+
"version": "4.3.0-29442002.5d974989",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@nuxt/devalue": "^2.0.2",
|
|
22
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-
|
|
22
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-29442002.5d974989",
|
|
23
23
|
"@unhead/vue": "^2.0.19",
|
|
24
24
|
"@vue/shared": "^3.5.26",
|
|
25
25
|
"consola": "^3.4.2",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"vue-devtools-stub": "^0.1.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"nuxt": "npm:nuxt-nightly@4.3.0-
|
|
50
|
+
"nuxt": "npm:nuxt-nightly@4.3.0-29442002.5d974989"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-
|
|
54
|
-
"nuxt": "npm:nuxt-nightly@4.3.0-
|
|
53
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29442002.5d974989",
|
|
54
|
+
"nuxt": "npm:nuxt-nightly@4.3.0-29442002.5d974989",
|
|
55
55
|
"unbuild": "3.6.1",
|
|
56
56
|
"vitest": "3.2.4"
|
|
57
57
|
},
|