@nuxt/nitro-server-nightly 4.5.0-29703714.2f094acc → 4.5.0-29705236.f2ca6ea5
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
|
@@ -21,10 +21,25 @@ import { hasTTY, isCI, isWindows } from "std-env";
|
|
|
21
21
|
import { ImpoundPlugin } from "impound";
|
|
22
22
|
import { resolveModulePath } from "exsolve";
|
|
23
23
|
import { runtimeDependencies } from "nitropack/runtime/meta";
|
|
24
|
-
var version = "4.5.0-
|
|
24
|
+
var version = "4.5.0-29705236.f2ca6ea5";
|
|
25
25
|
function toArray(value) {
|
|
26
26
|
return Array.isArray(value) ? value : [value];
|
|
27
27
|
}
|
|
28
|
+
const NODE_MODULES_RE = /\/node_modules\//g;
|
|
29
|
+
function getLayerNodeModulesExcludePattern(layerRoots) {
|
|
30
|
+
const excludePaths = [];
|
|
31
|
+
for (const layerRoot of layerRoots) {
|
|
32
|
+
const root = layerRoot.replace(/\/$/, "");
|
|
33
|
+
NODE_MODULES_RE.lastIndex = 0;
|
|
34
|
+
let match;
|
|
35
|
+
while (match = NODE_MODULES_RE.exec(root)) {
|
|
36
|
+
const suffix = root.slice(match.index + match[0].length);
|
|
37
|
+
if (suffix) excludePaths.push(escapeRE(suffix));
|
|
38
|
+
NODE_MODULES_RE.lastIndex = match.index + 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return excludePaths.length ? new RegExp(`node_modules\\/(?!${excludePaths.join("|")})`) : /node_modules/;
|
|
42
|
+
}
|
|
28
43
|
let _distDir = dirname(fileURLToPath(import.meta.url));
|
|
29
44
|
if (/(?:chunks|shared)$/.test(_distDir)) _distDir = dirname(_distDir);
|
|
30
45
|
const distDir = _distDir;
|
|
@@ -181,18 +196,11 @@ const logLevelMapReverse = {
|
|
|
181
196
|
info: 3,
|
|
182
197
|
verbose: 3
|
|
183
198
|
};
|
|
184
|
-
const NODE_MODULES_RE = /(?<=\/)node_modules\/(.+)$/;
|
|
185
|
-
const PNPM_NODE_MODULES_RE = /\.pnpm\/.+\/node_modules\/(.+)$/;
|
|
186
199
|
async function bundle(nuxt) {
|
|
187
200
|
const layerDirs = getLayerDirectories(nuxt);
|
|
188
|
-
const
|
|
189
|
-
for (const dirs of layerDirs) {
|
|
190
|
-
const paths = [dirs.root.match(NODE_MODULES_RE)?.[1]?.replace(/\/$/, ""), dirs.root.match(PNPM_NODE_MODULES_RE)?.[1]?.replace(/\/$/, "")];
|
|
191
|
-
for (const dir of paths) if (dir) excludePaths.push(escapeRE(dir));
|
|
192
|
-
}
|
|
201
|
+
const excludePattern = [getLayerNodeModulesExcludePattern(layerDirs.map((dirs) => dirs.root))];
|
|
193
202
|
const layerPublicAssetsDirs = [];
|
|
194
203
|
for (const dirs of layerDirs) if (existsSync(dirs.public)) layerPublicAssetsDirs.push({ dir: dirs.public });
|
|
195
|
-
const excludePattern = excludePaths.length ? [new RegExp(`node_modules\\/(?!${excludePaths.join("|")})`)] : [/node_modules/];
|
|
196
204
|
const rootDirWithSlash = withTrailingSlash(nuxt.options.rootDir);
|
|
197
205
|
const moduleEntryPaths = [];
|
|
198
206
|
for (const m of nuxt.options._installedModules) {
|
|
@@ -560,63 +568,73 @@ async function bundle(nuxt) {
|
|
|
560
568
|
nitroConfig.virtual["#build/dist/server/server.mjs"] = "export default () => {}";
|
|
561
569
|
if (process.platform === "win32") nitroConfig.virtual["#build/dist/server/server.mjs".replace(FORWARD_SLASH_RE, "\\")] = "export default () => {}";
|
|
562
570
|
}
|
|
563
|
-
if (nuxt.options.dev) {
|
|
571
|
+
if (nuxt.options.dev || !nuxt.options.ssr) {
|
|
564
572
|
nitroConfig.virtual["#build/dist/server/styles.mjs"] = "export default {}";
|
|
565
573
|
if (process.platform === "win32") nitroConfig.virtual["#build/dist/server/styles.mjs".replace(FORWARD_SLASH_RE, "\\")] = "export default {}";
|
|
566
574
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
logger.
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
575
|
+
const nitroDecoratorSetup = /* @__PURE__ */ new WeakMap();
|
|
576
|
+
const setupNitroDecorators = (nitroConfig) => {
|
|
577
|
+
const existingSetup = nitroDecoratorSetup.get(nitroConfig);
|
|
578
|
+
if (existingSetup) return existingSetup;
|
|
579
|
+
const setup = (async () => {
|
|
580
|
+
const nitroDecoratorDeps = [
|
|
581
|
+
"@rollup/plugin-babel",
|
|
582
|
+
"@babel/plugin-proposal-decorators",
|
|
583
|
+
"@babel/plugin-syntax-typescript"
|
|
584
|
+
];
|
|
585
|
+
let hasDeps = true;
|
|
586
|
+
for (const pkg of nitroDecoratorDeps) try {
|
|
587
|
+
await import(pkg);
|
|
588
|
+
} catch (_err) {
|
|
589
|
+
const err = _err;
|
|
590
|
+
if (err.code !== "ERR_MODULE_NOT_FOUND" && err.code !== "MODULE_NOT_FOUND") throw err;
|
|
591
|
+
if (!isCI && hasTTY) {
|
|
592
|
+
logger.info("Decorator support requires additional dependencies.");
|
|
593
|
+
if (await logger.prompt(`Install \`${nitroDecoratorDeps.join("` and `")}\`?`, {
|
|
594
|
+
type: "confirm",
|
|
595
|
+
initial: true
|
|
596
|
+
})) {
|
|
597
|
+
logger.start(`Installing ${nitroDecoratorDeps.map((d) => `\`${d}\``).join(" and ")}...`);
|
|
598
|
+
await addDependency(nitroDecoratorDeps, {
|
|
599
|
+
dev: true,
|
|
600
|
+
cwd: nuxt.options.rootDir,
|
|
601
|
+
silent: true
|
|
602
|
+
});
|
|
603
|
+
logger.info("Rerun Nuxt to enable decorator support.");
|
|
604
|
+
process.exit(1);
|
|
605
|
+
}
|
|
593
606
|
}
|
|
607
|
+
logger.warn(`Cannot find \`${pkg}\`. Install \`${nitroDecoratorDeps.join("` and `")}\` to enable decorator support.`);
|
|
608
|
+
hasDeps = false;
|
|
609
|
+
break;
|
|
594
610
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
"
|
|
608
|
-
|
|
609
|
-
"
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
}
|
|
611
|
+
if (hasDeps) {
|
|
612
|
+
const { babel } = await import("@rollup/plugin-babel");
|
|
613
|
+
nitroConfig.rollupConfig.plugins = toArray(await nitroConfig.rollupConfig.plugins || []);
|
|
614
|
+
nitroConfig.rollupConfig.plugins.unshift(babel({
|
|
615
|
+
babelHelpers: "bundled",
|
|
616
|
+
configFile: false,
|
|
617
|
+
extensions: [
|
|
618
|
+
".ts",
|
|
619
|
+
".js",
|
|
620
|
+
".mjs",
|
|
621
|
+
".mts"
|
|
622
|
+
],
|
|
623
|
+
plugins: [["@babel/plugin-syntax-typescript", { isTSX: false }], ["@babel/plugin-proposal-decorators", { version: "2023-11" }]]
|
|
624
|
+
}), babel({
|
|
625
|
+
babelHelpers: "bundled",
|
|
626
|
+
configFile: false,
|
|
627
|
+
extensions: [".tsx", ".jsx"],
|
|
628
|
+
plugins: [["@babel/plugin-syntax-typescript", { isTSX: true }], ["@babel/plugin-proposal-decorators", { version: "2023-11" }]]
|
|
629
|
+
}));
|
|
630
|
+
}
|
|
631
|
+
})();
|
|
632
|
+
nitroDecoratorSetup.set(nitroConfig, setup);
|
|
633
|
+
setup.catch(() => nitroDecoratorSetup.delete(nitroConfig));
|
|
634
|
+
return setup;
|
|
635
|
+
};
|
|
636
|
+
if (nuxt.options.experimental.decorators) if (nuxt.options.dev) nuxt.hook("nitro:build:before", (nitro) => setupNitroDecorators(nitro.options));
|
|
637
|
+
else await setupNitroDecorators(nitroConfig);
|
|
620
638
|
nitroConfig.rollupConfig.plugins = await nitroConfig.rollupConfig.plugins || [];
|
|
621
639
|
nitroConfig.rollupConfig.plugins = toArray(nitroConfig.rollupConfig.plugins);
|
|
622
640
|
const sharedDir = withTrailingSlash(resolve(nuxt.options.rootDir, nuxt.options.dir.shared));
|
|
@@ -4,7 +4,7 @@ import { createError, defineEventHandler, getQuery, readBody, setResponseHeader,
|
|
|
4
4
|
import { VueResolver, walkResolver } from "@unhead/vue/utils";
|
|
5
5
|
import { getRequestDependencies } from "vue-bundle-renderer/runtime";
|
|
6
6
|
import { getQuery as getURLQuery } from "ufo";
|
|
7
|
-
import { computeIslandHash
|
|
7
|
+
import { computeIslandHash } from "#app/island-hash";
|
|
8
8
|
import { islandCache, islandPropCache } from "../utils/cache.mjs";
|
|
9
9
|
import { createSSRContext } from "../utils/renderer/app.mjs";
|
|
10
10
|
import { getSSRRenderer } from "../utils/renderer/build-files.mjs";
|
|
@@ -146,8 +146,7 @@ async function getIslandContext(event) {
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
const rawContext = event.method === "GET" ? getQuery(event) : await readBody(event);
|
|
149
|
-
const
|
|
150
|
-
const filteredProps = filterIslandProps(rawProps);
|
|
149
|
+
const serializedProps = typeof rawContext?.props === "string" ? rawContext.props : "{}";
|
|
151
150
|
|
|
152
151
|
|
|
153
152
|
const clientContext = {};
|
|
@@ -160,18 +159,19 @@ async function getIslandContext(event) {
|
|
|
160
159
|
}
|
|
161
160
|
|
|
162
161
|
|
|
163
|
-
const expectedHash = computeIslandHash(componentName,
|
|
162
|
+
const expectedHash = computeIslandHash(componentName, serializedProps, clientContext, undefined);
|
|
164
163
|
if (!hashId || hashId !== expectedHash) {
|
|
165
164
|
throw createError({
|
|
166
165
|
statusCode: 400,
|
|
167
166
|
statusMessage: "Invalid island request hash"
|
|
168
167
|
});
|
|
169
168
|
}
|
|
169
|
+
const parsedProps = destr(serializedProps) || {};
|
|
170
170
|
return {
|
|
171
171
|
url: typeof rawContext?.url === "string" ? rawContext.url : "/",
|
|
172
172
|
id: hashId,
|
|
173
173
|
name: componentName,
|
|
174
|
-
props:
|
|
174
|
+
props: parsedProps,
|
|
175
175
|
slots: {},
|
|
176
176
|
components: {}
|
|
177
177
|
};
|
|
@@ -258,13 +258,9 @@ async function renderRoute(event, ssrError) {
|
|
|
258
258
|
|
|
259
259
|
|
|
260
260
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
ssrContext.head.push({ link: getPreloadLinks(ssrContext, renderer.rendererContext) });
|
|
267
|
-
ssrContext.head.push({ link: getPrefetchLinks(ssrContext, renderer.rendererContext) });
|
|
261
|
+
const dependencyOptions = ssrContext["~lazyHydratedModules"]?.size ? { exclude: ssrContext["~lazyHydratedModules"] } : undefined;
|
|
262
|
+
ssrContext.head.push({ link: getPreloadLinks(ssrContext, renderer.rendererContext, dependencyOptions) });
|
|
263
|
+
ssrContext.head.push({ link: getPrefetchLinks(ssrContext, renderer.rendererContext, dependencyOptions) });
|
|
268
264
|
|
|
269
265
|
ssrContext.head.push({ script: _PAYLOAD_INLINE ? NUXT_JSON_PAYLOADS ? renderPayloadJsonScript({
|
|
270
266
|
ssrContext,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/nitro-server-nightly",
|
|
3
|
-
"version": "4.5.0-
|
|
3
|
+
"version": "4.5.0-29705236.f2ca6ea5",
|
|
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
|
"@nuxt/devalue": "^2.0.2",
|
|
30
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.5.0-
|
|
30
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.5.0-29705236.f2ca6ea5",
|
|
31
31
|
"@unhead/vue": "^3.1.3",
|
|
32
32
|
"@vue/shared": "^3.5.35",
|
|
33
33
|
"consola": "^3.4.2",
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
"unctx": "^2.5.0",
|
|
52
52
|
"unstorage": "^1.17.5",
|
|
53
53
|
"vue": "^3.5.35",
|
|
54
|
-
"vue-bundle-renderer": "^2.
|
|
54
|
+
"vue-bundle-renderer": "^2.3.1",
|
|
55
55
|
"vue-devtools-stub": "^0.1.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@babel/plugin-proposal-decorators": "^7.25.0",
|
|
59
59
|
"@babel/plugin-syntax-typescript": "^7.25.0",
|
|
60
60
|
"@rollup/plugin-babel": "^6.0.0 || ^7.0.0",
|
|
61
|
-
"nuxt": "npm:nuxt-nightly@4.5.0-
|
|
61
|
+
"nuxt": "npm:nuxt-nightly@4.5.0-29705236.f2ca6ea5"
|
|
62
62
|
},
|
|
63
63
|
"peerDependenciesMeta": {
|
|
64
64
|
"@babel/plugin-proposal-decorators": {
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@babel/plugin-proposal-decorators": "7.29.7",
|
|
76
76
|
"@babel/plugin-syntax-typescript": "7.29.7",
|
|
77
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.5.0-
|
|
77
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.5.0-29705236.f2ca6ea5",
|
|
78
78
|
"@rollup/plugin-babel": "7.1.0",
|
|
79
|
-
"nuxt": "npm:nuxt-nightly@4.5.0-
|
|
79
|
+
"nuxt": "npm:nuxt-nightly@4.5.0-29705236.f2ca6ea5",
|
|
80
80
|
"obuild": "0.4.36",
|
|
81
81
|
"vitest": "4.1.8"
|
|
82
82
|
},
|