nitro-nightly 3.0.1-20251212-103723-5f37156f → 3.0.1-20251212-112541-0939a38d
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/_build/rolldown.mjs +4 -5
- package/dist/_build/rollup.mjs +1 -6
- package/dist/_build/shared3.mjs +7 -1
- package/dist/_build/vite.plugin.mjs +3 -0
- package/dist/runtime/internal/app.d.mts +3 -3
- package/dist/runtime/internal/app.mjs +25 -19
- package/dist/runtime/nitro.mjs +1 -1
- package/package.json +1 -1
package/dist/_build/rolldown.mjs
CHANGED
|
@@ -53,11 +53,10 @@ const getRolldownConfig = (nitro) => {
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
onwarn(warning, warn) {
|
|
56
|
-
if (!
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
].includes(warning.code || "") && !warning.message.includes("Unsupported source map comment")) warn(warning);
|
|
56
|
+
if (!base.ignoreWarningCodes.has(warning.code || "")) {
|
|
57
|
+
console.log(warning.code);
|
|
58
|
+
warn(warning);
|
|
59
|
+
}
|
|
61
60
|
},
|
|
62
61
|
treeshake: { moduleSideEffects(id) {
|
|
63
62
|
return nitro.options.moduleSideEffects.some((p) => id.startsWith(p));
|
package/dist/_build/rollup.mjs
CHANGED
|
@@ -91,12 +91,7 @@ const getRollupConfig = (nitro) => {
|
|
|
91
91
|
inject(base.env.inject)
|
|
92
92
|
],
|
|
93
93
|
onwarn(warning, rollupWarn) {
|
|
94
|
-
if (!
|
|
95
|
-
"EVAL",
|
|
96
|
-
"CIRCULAR_DEPENDENCY",
|
|
97
|
-
"THIS_IS_UNDEFINED",
|
|
98
|
-
"EMPTY_CHUNK"
|
|
99
|
-
].includes(warning.code || "") && !warning.message.includes("Unsupported source map comment")) rollupWarn(warning);
|
|
94
|
+
if (!base.ignoreWarningCodes.has(warning.code || "")) rollupWarn(warning);
|
|
100
95
|
},
|
|
101
96
|
treeshake: { moduleSideEffects(id) {
|
|
102
97
|
return nitro.options.moduleSideEffects.some((p) => id.startsWith(p));
|
package/dist/_build/shared3.mjs
CHANGED
|
@@ -79,7 +79,13 @@ function baseBuildConfig(nitro) {
|
|
|
79
79
|
replacements,
|
|
80
80
|
env,
|
|
81
81
|
aliases: resolveAliases({ ...env.alias }),
|
|
82
|
-
noExternal: getNoExternals(nitro)
|
|
82
|
+
noExternal: getNoExternals(nitro),
|
|
83
|
+
ignoreWarningCodes: new Set([
|
|
84
|
+
"EVAL",
|
|
85
|
+
"CIRCULAR_DEPENDENCY",
|
|
86
|
+
"THIS_IS_UNDEFINED",
|
|
87
|
+
"EMPTY_BUNDLE"
|
|
88
|
+
])
|
|
83
89
|
};
|
|
84
90
|
}
|
|
85
91
|
function getNoExternals(nitro) {
|
|
@@ -39,6 +39,9 @@ const getViteRollupConfig = (ctx) => {
|
|
|
39
39
|
treeshake: { moduleSideEffects(id) {
|
|
40
40
|
return nitro$1.options.moduleSideEffects.some((p) => id.startsWith(p));
|
|
41
41
|
} },
|
|
42
|
+
onwarn(warning, warn) {
|
|
43
|
+
if (!base.ignoreWarningCodes.has(warning.code || "")) warn(warning);
|
|
44
|
+
},
|
|
42
45
|
output: {
|
|
43
46
|
format: "esm",
|
|
44
47
|
entryFileNames: "index.mjs",
|
|
@@ -3,10 +3,10 @@ import type { ServerRequest, ServerRequestContext } from "srvx";
|
|
|
3
3
|
import type { H3EventContext, Middleware, WebSocketHooks } from "h3";
|
|
4
4
|
import { HookableCore } from "hookable";
|
|
5
5
|
declare global {
|
|
6
|
-
var __nitro__: NitroApp | undefined;
|
|
6
|
+
var __nitro__: Partial<Record<"default" | "prerender" | (string & {}), NitroApp | undefined>> | undefined;
|
|
7
7
|
}
|
|
8
|
-
export declare function useNitroApp(): NitroApp;
|
|
9
|
-
export declare function useNitroHooks(): HookableCore<NitroRuntimeHooks>;
|
|
8
|
+
export declare function useNitroApp(_id?): NitroApp;
|
|
9
|
+
export declare function useNitroHooks(_id?): HookableCore<NitroRuntimeHooks>;
|
|
10
10
|
export declare function serverFetch(resource: string | URL | Request, init?: RequestInit, context?: ServerRequestContext | H3EventContext): Promise<Response>;
|
|
11
11
|
export declare function resolveWebsocketHooks(req: ServerRequest): Promise<Partial<WebSocketHooks>>;
|
|
12
12
|
export declare function fetch(resource: string | URL | Request, init?: RequestInit, context?: ServerRequestContext | H3EventContext): Promise<Response>;
|
|
@@ -6,11 +6,21 @@ import errorHandler from "#nitro/virtual/error-handler";
|
|
|
6
6
|
import { plugins } from "#nitro/virtual/plugins";
|
|
7
7
|
import { findRoute, findRouteRules, globalMiddleware, findRoutedMiddleware } from "#nitro/virtual/routing";
|
|
8
8
|
import { hasRouteRules, hasRoutedMiddleware, hasGlobalMiddleware, hasRoutes, hasHooks, hasPlugins } from "#nitro/virtual/feature-flags";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const APP_ID = import.meta.prerender ? "prerender" : "default";
|
|
10
|
+
export function useNitroApp(_id = APP_ID) {
|
|
11
|
+
let instance = globalThis.__nitro__?.[_id];
|
|
12
|
+
if (instance) {
|
|
13
|
+
return instance;
|
|
14
|
+
}
|
|
15
|
+
globalThis.__nitro__ ??= {};
|
|
16
|
+
instance = globalThis.__nitro__[_id] = createNitroApp();
|
|
17
|
+
if (hasPlugins) {
|
|
18
|
+
initNitroPlugins(instance);
|
|
19
|
+
}
|
|
20
|
+
return instance;
|
|
11
21
|
}
|
|
12
|
-
export function useNitroHooks() {
|
|
13
|
-
const nitroApp = useNitroApp();
|
|
22
|
+
export function useNitroHooks(_id = APP_ID) {
|
|
23
|
+
const nitroApp = useNitroApp(_id);
|
|
14
24
|
const hooks = nitroApp.hooks;
|
|
15
25
|
if (hooks) {
|
|
16
26
|
return hooks;
|
|
@@ -42,21 +52,6 @@ export function fetch(resource, init, context) {
|
|
|
42
52
|
resource = resource._request || resource;
|
|
43
53
|
return fetch(resource, init);
|
|
44
54
|
}
|
|
45
|
-
function initNitroApp() {
|
|
46
|
-
const nitroApp = createNitroApp();
|
|
47
|
-
if (hasPlugins) {
|
|
48
|
-
for (const plugin of plugins) {
|
|
49
|
-
try {
|
|
50
|
-
plugin(nitroApp);
|
|
51
|
-
} catch (error) {
|
|
52
|
-
nitroApp.captureError?.(error, { tags: ["plugin"] });
|
|
53
|
-
throw error;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
globalThis.__nitro__ = nitroApp;
|
|
58
|
-
return nitroApp;
|
|
59
|
-
}
|
|
60
55
|
function createNitroApp() {
|
|
61
56
|
const hooks = hasHooks ? new HookableCore() : undefined;
|
|
62
57
|
const captureError = (error, errorCtx) => {
|
|
@@ -119,6 +114,17 @@ function createNitroApp() {
|
|
|
119
114
|
};
|
|
120
115
|
return app;
|
|
121
116
|
}
|
|
117
|
+
function initNitroPlugins(app) {
|
|
118
|
+
for (const plugin of plugins) {
|
|
119
|
+
try {
|
|
120
|
+
plugin(app);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
app.captureError?.(error, { tags: ["plugin"] });
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return app;
|
|
127
|
+
}
|
|
122
128
|
function createH3App(config) {
|
|
123
129
|
// Create H3 app
|
|
124
130
|
const h3App = new H3Core(config);
|
package/dist/runtime/nitro.mjs
CHANGED
|
@@ -8,7 +8,7 @@ export { defineRouteMeta } from "./internal/meta.mjs";
|
|
|
8
8
|
export { defineNitroErrorHandler as defineErrorHandler } from "./internal/error/utils.mjs";
|
|
9
9
|
// Runtime
|
|
10
10
|
export function serverFetch(resource, init, context) {
|
|
11
|
-
const nitro = globalThis.__nitro__ || globalThis.__nitro_builder__;
|
|
11
|
+
const nitro = globalThis.__nitro__?.default || globalThis.__nitro__?.prerender || globalThis.__nitro_builder__;
|
|
12
12
|
if (!nitro) {
|
|
13
13
|
return Promise.reject(new Error("Nitro instance is not available."));
|
|
14
14
|
}
|
package/package.json
CHANGED