@nuxt/nitro-server-nightly 5.0.0-29554128.cf84c6e7 → 5.0.0-29554201.c0bbb6ec
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/index.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { ImpoundPlugin } from "impound";
|
|
|
22
22
|
import { resolveModulePath } from "exsolve";
|
|
23
23
|
import { runtimeDependencies } from "nitropack/runtime/meta";
|
|
24
24
|
//#region package.json
|
|
25
|
-
var version = "5.0.0-
|
|
25
|
+
var version = "5.0.0-29554201.c0bbb6ec";
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/utils.ts
|
|
28
28
|
function toArray(value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useNitroApp } from "nitropack/runtime";
|
|
2
2
|
import { destr } from "destr";
|
|
3
|
-
import { defineEventHandler, getQuery, readBody, setResponseHeaders } from "h3";
|
|
3
|
+
import { createError, defineEventHandler, getQuery, readBody, setResponseHeaders } from "h3";
|
|
4
4
|
import { resolveUnrefHeadInput } from "@unhead/vue";
|
|
5
5
|
import { getRequestDependencies } from "vue-bundle-renderer/runtime";
|
|
6
6
|
import { getQuery as getURLQuery } from "ufo";
|
|
@@ -96,26 +96,37 @@ const handler = defineEventHandler(async (event) => {
|
|
|
96
96
|
return islandResponse;
|
|
97
97
|
});
|
|
98
98
|
export default handler;
|
|
99
|
+
const ISLAND_PATH_PREFIX = "/__nuxt_island/";
|
|
100
|
+
const VALID_COMPONENT_NAME_RE = /^[a-z][\w.-]*$/i;
|
|
99
101
|
async function getIslandContext(event) {
|
|
100
|
-
// TODO: Strict validation for url
|
|
101
102
|
let url = event.path || "";
|
|
102
103
|
if (import.meta.prerender && event.path && await islandPropCache.hasItem(event.path)) {
|
|
103
104
|
// rehydrate props from cache so we can rerender island if cache does not have it any more
|
|
104
105
|
url = await islandPropCache.getItem(event.path);
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
+
if (!url.startsWith(ISLAND_PATH_PREFIX)) {
|
|
108
|
+
throw createError({
|
|
109
|
+
statusCode: 400,
|
|
110
|
+
statusMessage: "Invalid island request path"
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const componentParts = url.substring(ISLAND_PATH_PREFIX.length).replace(ISLAND_SUFFIX_RE, "").split("_");
|
|
107
114
|
const hashId = componentParts.length > 1 ? componentParts.pop() : undefined;
|
|
108
115
|
const componentName = componentParts.join("_");
|
|
109
|
-
|
|
116
|
+
if (!componentName || !VALID_COMPONENT_NAME_RE.test(componentName)) {
|
|
117
|
+
throw createError({
|
|
118
|
+
statusCode: 400,
|
|
119
|
+
statusMessage: "Invalid island component name"
|
|
120
|
+
});
|
|
121
|
+
}
|
|
110
122
|
const context = event.method === "GET" ? getQuery(event) : await readBody(event);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
123
|
+
// Only extract known context fields to prevent arbitrary data injection
|
|
124
|
+
return {
|
|
125
|
+
url: typeof context?.url === "string" ? context.url : "/",
|
|
114
126
|
id: hashId,
|
|
115
127
|
name: componentName,
|
|
116
128
|
props: destr(context.props) || {},
|
|
117
129
|
slots: {},
|
|
118
130
|
components: {}
|
|
119
131
|
};
|
|
120
|
-
return ctx;
|
|
121
132
|
}
|
|
@@ -16,7 +16,7 @@ import { renderSSRHeadOptions } from "#internal/unhead.config.mjs";
|
|
|
16
16
|
// @ts-expect-error virtual file
|
|
17
17
|
import { NUXT_ASYNC_CONTEXT, NUXT_EARLY_HINTS, NUXT_INLINE_STYLES, NUXT_NO_SCRIPTS, NUXT_PAYLOAD_EXTRACTION, NUXT_PAYLOAD_INLINE, NUXT_RUNTIME_PAYLOAD_EXTRACTION, PARSE_ERROR_DATA } from "#internal/nuxt/nitro-config.mjs";
|
|
18
18
|
// @ts-expect-error virtual file
|
|
19
|
-
import { appHead, appTeleportAttrs, appTeleportTag, componentIslands
|
|
19
|
+
import { appHead, appTeleportAttrs, appTeleportTag, componentIslands } from "#internal/nuxt.config.mjs";
|
|
20
20
|
// @ts-expect-error virtual file
|
|
21
21
|
import entryIds from "#internal/nuxt/entry-ids.mjs";
|
|
22
22
|
// @ts-expect-error virtual file
|
|
@@ -185,18 +185,6 @@ const handler = defineRenderHandler(async (event) => {
|
|
|
185
185
|
href: payloadURL
|
|
186
186
|
}] }, headEntryOptions);
|
|
187
187
|
}
|
|
188
|
-
if (isAppManifestEnabled && ssrContext["~preloadManifest"] && !NO_SCRIPTS) {
|
|
189
|
-
ssrContext.head.push({ link: [{
|
|
190
|
-
rel: "preload",
|
|
191
|
-
as: "fetch",
|
|
192
|
-
fetchpriority: "low",
|
|
193
|
-
crossorigin: "anonymous",
|
|
194
|
-
href: buildAssetsURL(`builds/meta/${ssrContext.runtimeConfig.app.buildId}.json`)
|
|
195
|
-
}] }, {
|
|
196
|
-
...headEntryOptions,
|
|
197
|
-
tagPriority: "low"
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
188
|
// 2. Styles
|
|
201
189
|
if (inlinedStyles.length) {
|
|
202
190
|
ssrContext.head.push({ style: inlinedStyles });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/nitro-server-nightly",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-29554201.c0bbb6ec",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/plugin-syntax-typescript": "^7.28.6",
|
|
30
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-
|
|
30
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29554201.c0bbb6ec",
|
|
31
31
|
"@unhead/vue": "^2.1.12",
|
|
32
32
|
"@vue/shared": "^3.5.30",
|
|
33
33
|
"consola": "^3.4.2",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@babel/plugin-proposal-decorators": "^7.25.0",
|
|
60
60
|
"@rollup/plugin-babel": "^6.0.0 || ^7.0.0",
|
|
61
|
-
"nuxt": "npm:nuxt-nightly@5.0.0-
|
|
61
|
+
"nuxt": "npm:nuxt-nightly@5.0.0-29554201.c0bbb6ec"
|
|
62
62
|
},
|
|
63
63
|
"peerDependenciesMeta": {
|
|
64
64
|
"@babel/plugin-proposal-decorators": {
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@babel/plugin-proposal-decorators": "7.29.0",
|
|
73
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-
|
|
73
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29554201.c0bbb6ec",
|
|
74
74
|
"@rollup/plugin-babel": "7.0.0",
|
|
75
|
-
"nuxt": "npm:nuxt-nightly@5.0.0-
|
|
75
|
+
"nuxt": "npm:nuxt-nightly@5.0.0-29554201.c0bbb6ec",
|
|
76
76
|
"obuild": "0.4.32",
|
|
77
77
|
"vitest": "4.0.18"
|
|
78
78
|
},
|