@nuxt/nitro-server-nightly 5.0.0-29686587.d1cef6bf → 5.0.0-29686852.b57dfef9
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.d.mts +34 -1
- package/dist/index.mjs +1 -1
- package/dist/runtime/handlers/island.mjs +7 -1
- package/dist/runtime/handlers/renderer.mjs +22 -10
- package/dist/runtime/nuxt/src/app/internal/tracing.mjs +17 -0
- package/dist/runtime/plugins/dev-server-logs.mjs +1 -1
- package/dist/runtime/utils/renderer/build-files.mjs +1 -1
- package/dist/runtime/utils/renderer/payload.mjs +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { EventHandler, H3Event } from "nitro/h3";
|
|
2
2
|
import { Nuxt } from "@nuxt/schema";
|
|
3
|
-
import { Nitro, NitroConfig, NitroDevEventHandler, NitroEventHandler, NitroOptions, NitroRouteConfig, NitroRuntimeConfig, NitroRuntimeConfigApp } from "nitro/types";
|
|
3
|
+
import { Nitro, NitroConfig, NitroDevEventHandler, NitroEventHandler, NitroOptions, NitroRouteConfig, NitroRuntimeConfig, NitroRuntimeConfigApp, TracingOptions } from "nitro/types";
|
|
4
4
|
import { LogObject } from "consola";
|
|
5
5
|
import { NuxtIslandContext, NuxtIslandResponse, NuxtRenderChunkContext, NuxtRenderCloseContext, NuxtRenderHTMLContext, NuxtRenderRouteContext } from "nuxt/app";
|
|
6
6
|
import { HookResult, RuntimeConfig, TSReference } from "nuxt/schema";
|
|
7
7
|
|
|
8
8
|
//#region src/augments.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Per-channel toggles for `tracingChannel`. Extends Nitro's own
|
|
11
|
+
* {@link TracingOptions} with a `nuxt` key for Nuxt-owned channels
|
|
12
|
+
* (`nuxt.render`, `nuxt.island`, `nuxt.data`, `nuxt.plugin`). Channel names
|
|
13
|
+
* follow the [untracing](https://github.com/unjs/untracing) naming convention
|
|
14
|
+
* (`{namespace}.{operation}`).
|
|
15
|
+
*
|
|
16
|
+
* @experimental Channel names, payload shapes, and option keys may change.
|
|
17
|
+
*/
|
|
18
|
+
interface NuxtTracingChannelOptions extends TracingOptions {
|
|
19
|
+
/** Enable Nuxt-owned channels (`nuxt.render`, `nuxt.island`, `nuxt.data`, `nuxt.plugin`). */
|
|
20
|
+
nuxt?: boolean;
|
|
21
|
+
}
|
|
9
22
|
declare module "nitro/types" {
|
|
10
23
|
interface NitroRuntimeConfigApp {
|
|
11
24
|
baseURL: string;
|
|
@@ -139,6 +152,16 @@ declare module "@nuxt/schema" {
|
|
|
139
152
|
* @see [Nitro server routes documentation](https://nitro.build/guide/routing)
|
|
140
153
|
*/
|
|
141
154
|
devServerHandlers: NitroDevEventHandler[];
|
|
155
|
+
/**
|
|
156
|
+
* Enable [diagnostics-channel](https://nodejs.org/api/diagnostics_channel.html)
|
|
157
|
+
* tracing for Nuxt-owned subsystems and forward the corresponding Nitro-level
|
|
158
|
+
* channels (`srvx.request`, `h3.request`, `unstorage.*`).
|
|
159
|
+
*
|
|
160
|
+
* @experimental Channel names, payload shapes, and option keys may change.
|
|
161
|
+
*
|
|
162
|
+
* @see [Untracing naming registry](https://github.com/unjs/untracing)
|
|
163
|
+
*/
|
|
164
|
+
tracingChannel: boolean | NuxtTracingChannelOptions;
|
|
142
165
|
}
|
|
143
166
|
interface NuxtConfig {
|
|
144
167
|
nitro?: NitroConfig;
|
|
@@ -241,6 +264,16 @@ declare module "nuxt/schema" {
|
|
|
241
264
|
* @see [Nitro server routes documentation](https://nitro.build/guide/routing)
|
|
242
265
|
*/
|
|
243
266
|
devServerHandlers: NitroDevEventHandler[];
|
|
267
|
+
/**
|
|
268
|
+
* Enable [diagnostics-channel](https://nodejs.org/api/diagnostics_channel.html)
|
|
269
|
+
* tracing for Nuxt-owned subsystems and forward the corresponding Nitro-level
|
|
270
|
+
* channels (`srvx.request`, `h3.request`, `unstorage.*`).
|
|
271
|
+
*
|
|
272
|
+
* @experimental Channel names, payload shapes, and option keys may change.
|
|
273
|
+
*
|
|
274
|
+
* @see [Untracing naming registry](https://github.com/unjs/untracing)
|
|
275
|
+
*/
|
|
276
|
+
tracingChannel: boolean | NuxtTracingChannelOptions;
|
|
244
277
|
}
|
|
245
278
|
interface NuxtConfig {
|
|
246
279
|
nitro?: NitroConfig;
|
package/dist/index.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import { resolveModulePath } from "exsolve";
|
|
|
19
19
|
import { runtimeDependencies } from "nitro/meta";
|
|
20
20
|
import { resolveModuleExportNames } from "mlly";
|
|
21
21
|
//#region package.json
|
|
22
|
-
var version = "5.0.0-
|
|
22
|
+
var version = "5.0.0-29686852.b57dfef9";
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/utils.ts
|
|
25
25
|
function toArray(value) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computeIslandHash, filterIslandProps } from "../nuxt/src/app/island-hash.mjs";
|
|
2
|
+
import { traceAsync } from "../nuxt/src/app/internal/tracing.mjs";
|
|
2
3
|
import { islandCache, islandPropCache } from "../utils/cache.mjs";
|
|
3
4
|
import { createSSRContext } from "../utils/renderer/app.mjs";
|
|
4
5
|
import { getSSRRenderer } from "../utils/renderer/build-files.mjs";
|
|
@@ -10,6 +11,7 @@ import { destr } from "destr";
|
|
|
10
11
|
import { HTTPError, defineEventHandler, getQuery as getQuery$1, readBody } from "nitro/h3";
|
|
11
12
|
import { VueResolver, walkResolver } from "@unhead/vue/utils";
|
|
12
13
|
import { getRequestDependencies } from "vue-bundle-renderer/runtime";
|
|
14
|
+
import { tracingChannelNuxt } from "#internal/nuxt.config.mjs";
|
|
13
15
|
//#region src/runtime/handlers/island.ts
|
|
14
16
|
const ISLAND_SUFFIX_RE = /\.json(?:\?.*)?$/;
|
|
15
17
|
const handler = defineEventHandler(async (event) => {
|
|
@@ -25,7 +27,11 @@ const handler = defineEventHandler(async (event) => {
|
|
|
25
27
|
url: islandContext.url
|
|
26
28
|
};
|
|
27
29
|
const renderer = await getSSRRenderer();
|
|
28
|
-
const renderResult = await
|
|
30
|
+
const renderResult = await (tracingChannelNuxt ? traceAsync("nuxt.island", {
|
|
31
|
+
event,
|
|
32
|
+
ssrContext,
|
|
33
|
+
islandContext
|
|
34
|
+
}, () => renderer.renderToString(ssrContext)) : renderer.renderToString(ssrContext)).catch(async (err) => {
|
|
29
35
|
if (ssrContext["~renderResponse"] && err?.message === "skipping render") return {};
|
|
30
36
|
await ssrContext.nuxt?.hooks.callHook("app:error", err);
|
|
31
37
|
throw err;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { traceAsync } from "../nuxt/src/app/internal/tracing.mjs";
|
|
1
2
|
import { payloadCache, prerenderRenderingURLs } from "../utils/cache.mjs";
|
|
2
3
|
import { createSSRContext, setSSRError } from "../utils/renderer/app.mjs";
|
|
3
4
|
import { buildAssetsURL, publicAssetsURL } from "../utils/paths.mjs";
|
|
@@ -10,11 +11,11 @@ import { getRouteRules, useNitroHooks } from "nitro/app";
|
|
|
10
11
|
import destr$1 from "destr";
|
|
11
12
|
import { HTTPError, defineEventHandler, getQuery as getQuery$1, writeEarlyHints } from "nitro/h3";
|
|
12
13
|
import { getPrefetchLinks, getPreloadLinks, getRequestDependencies, renderResourceHeaders } from "vue-bundle-renderer/runtime";
|
|
14
|
+
import { appHead, appTeleportAttrs, appTeleportTag, componentIslands, componentIslandsActive, tracingChannelNuxt } from "#internal/nuxt.config.mjs";
|
|
13
15
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
14
16
|
import { NUXT_ASYNC_CONTEXT, NUXT_EARLY_HINTS, NUXT_INLINE_STYLES, NUXT_NO_SCRIPTS, NUXT_PAYLOAD_EXTRACTION, NUXT_PAYLOAD_INLINE, NUXT_RUNTIME_PAYLOAD_EXTRACTION, NUXT_SSR_STREAMING, NUXT_SSR_STREAMING_BOT_RE, PARSE_ERROR_DATA } from "#internal/nuxt/nitro-config.mjs";
|
|
15
17
|
import { propsToString, renderSSRHead } from "@unhead/vue/server";
|
|
16
18
|
import { renderToWebStream } from "vue/server-renderer";
|
|
17
|
-
import { appHead, appTeleportAttrs, appTeleportTag, componentIslands, componentIslandsActive } from "#internal/nuxt.config.mjs";
|
|
18
19
|
import { createBootstrapScript, renderSSRHeadSuspenseChunk, renderShell } from "@unhead/vue/stream/server";
|
|
19
20
|
import { streamingIifeCode } from "@unhead/vue/stream/iife";
|
|
20
21
|
import { relative } from "pathe";
|
|
@@ -85,17 +86,28 @@ async function renderRoute(event, ssrError) {
|
|
|
85
86
|
const nitroHooks = useNitroHooks();
|
|
86
87
|
const renderRouteResult = nitroHooks.callHook("render:route", renderRouteContext, { event });
|
|
87
88
|
if (renderRouteResult instanceof Promise) await renderRouteResult;
|
|
88
|
-
if (NUXT_SSR_STREAMING && canStream && renderRouteContext.prefersStream)
|
|
89
|
+
if (NUXT_SSR_STREAMING && canStream && renderRouteContext.prefersStream) {
|
|
90
|
+
const streamArgs = {
|
|
91
|
+
event,
|
|
92
|
+
ssrContext,
|
|
93
|
+
renderer,
|
|
94
|
+
routeOptions,
|
|
95
|
+
ssrError,
|
|
96
|
+
_PAYLOAD_EXTRACTION,
|
|
97
|
+
_PAYLOAD_INLINE,
|
|
98
|
+
payloadURL
|
|
99
|
+
};
|
|
100
|
+
return tracingChannelNuxt ? traceAsync("nuxt.render", {
|
|
101
|
+
event,
|
|
102
|
+
ssrContext,
|
|
103
|
+
streaming: true
|
|
104
|
+
}, () => renderStreamedResponse(streamArgs)) : renderStreamedResponse(streamArgs);
|
|
105
|
+
}
|
|
106
|
+
const _rendered = await (tracingChannelNuxt ? traceAsync("nuxt.render", {
|
|
89
107
|
event,
|
|
90
108
|
ssrContext,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
ssrError,
|
|
94
|
-
_PAYLOAD_EXTRACTION,
|
|
95
|
-
_PAYLOAD_INLINE,
|
|
96
|
-
payloadURL
|
|
97
|
-
});
|
|
98
|
-
const _rendered = await renderer.renderToString(ssrContext).catch(async (error) => {
|
|
109
|
+
streaming: false
|
|
110
|
+
}, () => renderer.renderToString(ssrContext)) : renderer.renderToString(ssrContext)).catch(async (error) => {
|
|
99
111
|
if (ssrContext["~renderResponse"] && error.message === "skipping render") return {};
|
|
100
112
|
const _err = !ssrError && ssrContext.payload?.error || error;
|
|
101
113
|
const r = ssrContext.nuxt?.hooks.callHook("app:error", _err);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region ../nuxt/src/app/internal/tracing.ts
|
|
2
|
+
let _channels;
|
|
3
|
+
function getChannel(name) {
|
|
4
|
+
_channels ??= {};
|
|
5
|
+
if (name in _channels) return _channels[name];
|
|
6
|
+
const dc = globalThis.process?.getBuiltinModule?.("node:diagnostics_channel");
|
|
7
|
+
const channel = dc?.tracingChannel ? dc.tracingChannel(name) : null;
|
|
8
|
+
_channels[name] = channel;
|
|
9
|
+
return channel;
|
|
10
|
+
}
|
|
11
|
+
function traceAsync(name, context, fn) {
|
|
12
|
+
const channel = getChannel(name);
|
|
13
|
+
if (!channel || channel.hasSubscribers === false) return fn();
|
|
14
|
+
return channel.tracePromise(fn, context);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { traceAsync };
|
|
@@ -2,8 +2,8 @@ import { withTrailingSlash } from "ufo";
|
|
|
2
2
|
import { definePlugin } from "nitro";
|
|
3
3
|
import { useNitroHooks } from "nitro/app";
|
|
4
4
|
import { toRequest } from "nitro/h3";
|
|
5
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
5
|
import { appId } from "#internal/nuxt.config.mjs";
|
|
6
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { stringify } from "devalue";
|
|
8
8
|
import { consola } from "consola";
|
|
9
9
|
import { getContext } from "unctx";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { buildAssetsURL, publicAssetsURL } from "../paths.mjs";
|
|
2
2
|
import { createRenderer } from "vue-bundle-renderer/runtime";
|
|
3
|
+
import { appRootAttrs, appRootTag, appSpaLoaderAttrs, appSpaLoaderTag, spaLoadingTemplateOutside } from "#internal/nuxt.config.mjs";
|
|
3
4
|
import { NUXT_NO_SSR } from "#internal/nuxt/nitro-config.mjs";
|
|
4
5
|
import { useRuntimeConfig } from "nitro/runtime-config";
|
|
5
6
|
import { propsToString } from "@unhead/vue/server";
|
|
6
7
|
import { renderToString } from "vue/server-renderer";
|
|
7
|
-
import { appRootAttrs, appRootTag, appSpaLoaderAttrs, appSpaLoaderTag, spaLoadingTemplateOutside } from "#internal/nuxt.config.mjs";
|
|
8
8
|
//#region src/runtime/utils/renderer/build-files.ts
|
|
9
9
|
globalThis.__buildAssetsURL = buildAssetsURL;
|
|
10
10
|
globalThis.__publicAssetsURL = publicAssetsURL;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NUXT_NO_SSR } from "#internal/nuxt/nitro-config.mjs";
|
|
2
1
|
import { appId, multiApp } from "#internal/nuxt.config.mjs";
|
|
2
|
+
import { NUXT_NO_SSR } from "#internal/nuxt/nitro-config.mjs";
|
|
3
3
|
import { stringify, uneval } from "devalue";
|
|
4
4
|
//#region src/runtime/utils/renderer/payload.ts
|
|
5
5
|
function renderPayloadResponse(ssrContext) {
|
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-29686852.b57dfef9",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-
|
|
30
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29686852.b57dfef9",
|
|
31
31
|
"@unhead/vue": "^3.1.3",
|
|
32
32
|
"@vue/shared": "3.5.35",
|
|
33
33
|
"consola": "^3.4.2",
|
|
@@ -58,7 +58,7 @@
|
|
|
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@5.0.0-
|
|
61
|
+
"nuxt": "npm:nuxt-nightly@5.0.0-29686852.b57dfef9"
|
|
62
62
|
},
|
|
63
63
|
"peerDependenciesMeta": {
|
|
64
64
|
"@babel/plugin-proposal-decorators": {
|
|
@@ -74,10 +74,10 @@
|
|
|
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@5.0.0-
|
|
77
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29686852.b57dfef9",
|
|
78
78
|
"@rollup/plugin-babel": "7.1.0",
|
|
79
79
|
"hookable": "6.1.1",
|
|
80
|
-
"nuxt": "npm:nuxt-nightly@5.0.0-
|
|
80
|
+
"nuxt": "npm:nuxt-nightly@5.0.0-29686852.b57dfef9",
|
|
81
81
|
"tsdown": "0.22.2",
|
|
82
82
|
"vitest": "4.1.8"
|
|
83
83
|
},
|