nuxt-nightly 4.3.0-29356103.2f7957ac → 4.3.0-29430616.754c35a4
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 +8 -8
- package/dist/app/compat/capi.d.ts +1 -1
- package/dist/app/compat/interval.d.ts +1 -1
- package/dist/app/compat/interval.js +2 -2
- package/dist/app/components/error-404.d.vue.ts +44 -10
- package/dist/app/components/error-404.vue.d.ts +44 -10
- package/dist/app/components/error-500.d.vue.ts +44 -10
- package/dist/app/components/error-500.vue.d.ts +44 -10
- package/dist/app/components/nuxt-error-page.d.vue.ts +5 -7
- package/dist/app/components/nuxt-error-page.vue +3 -2
- package/dist/app/components/nuxt-error-page.vue.d.ts +5 -7
- package/dist/app/components/nuxt-link.js +1 -1
- package/dist/app/components/nuxt-stubs.d.ts +2 -2
- package/dist/app/components/welcome.d.vue.ts +20 -7
- package/dist/app/components/welcome.vue +1 -1
- package/dist/app/components/welcome.vue.d.ts +20 -7
- package/dist/app/composables/asyncData.js +10 -8
- package/dist/app/composables/fetch.js +1 -1
- package/dist/app/composables/once.js +16 -1
- package/dist/app/composables/router.js +1 -1
- package/dist/app/entry.async.d.ts +2 -2
- package/dist/app/entry.d.ts +3 -2
- package/dist/app/entry.js +1 -1
- package/dist/app/nuxt.d.ts +7 -4
- package/dist/app/utils.d.ts +6 -9
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +142 -125
- package/dist/pages/runtime/page.js +9 -4
- package/dist/pages/runtime/plugins/router.js +2 -3
- package/package.json +27 -26
|
@@ -150,7 +150,7 @@ You can use a different key or move the call to a composable to ensure the optio
|
|
|
150
150
|
if (keyChanging) {
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
nuxtApp._asyncData[key.value]?._execute({ cause: "watch", dedupe: options.dedupe });
|
|
154
154
|
}) : () => {
|
|
155
155
|
};
|
|
156
156
|
if (hasScope) {
|
|
@@ -352,11 +352,12 @@ function createAsyncData(nuxtApp, key, _handler, options, initialCachedData) {
|
|
|
352
352
|
}
|
|
353
353
|
asyncData._abortController = new AbortController();
|
|
354
354
|
asyncData.status.value = "pending";
|
|
355
|
+
const cleanupController = new AbortController();
|
|
355
356
|
const promise = new Promise(
|
|
356
357
|
(resolve, reject) => {
|
|
357
358
|
try {
|
|
358
359
|
const timeout = opts.timeout ?? options.timeout;
|
|
359
|
-
const mergedSignal = mergeAbortSignals([asyncData._abortController?.signal, opts?.signal], timeout);
|
|
360
|
+
const mergedSignal = mergeAbortSignals([asyncData._abortController?.signal, opts?.signal], cleanupController.signal, timeout);
|
|
360
361
|
if (mergedSignal.aborted) {
|
|
361
362
|
const reason = mergedSignal.reason;
|
|
362
363
|
reject(reason instanceof Error ? reason : new DOMException(String(reason ?? "Aborted"), "AbortError"));
|
|
@@ -365,7 +366,7 @@ function createAsyncData(nuxtApp, key, _handler, options, initialCachedData) {
|
|
|
365
366
|
mergedSignal.addEventListener("abort", () => {
|
|
366
367
|
const reason = mergedSignal.reason;
|
|
367
368
|
reject(reason instanceof Error ? reason : new DOMException(String(reason ?? "Aborted"), "AbortError"));
|
|
368
|
-
}, { once: true });
|
|
369
|
+
}, { once: true, signal: cleanupController.signal });
|
|
369
370
|
return Promise.resolve(handler(nuxtApp, { signal: mergedSignal })).then(resolve, reject);
|
|
370
371
|
} catch (err) {
|
|
371
372
|
reject(err);
|
|
@@ -390,14 +391,14 @@ function createAsyncData(nuxtApp, key, _handler, options, initialCachedData) {
|
|
|
390
391
|
asyncData.status.value = "success";
|
|
391
392
|
}).catch((error) => {
|
|
392
393
|
if (nuxtApp._asyncDataPromises[key] && nuxtApp._asyncDataPromises[key] !== promise) {
|
|
393
|
-
return;
|
|
394
|
+
return nuxtApp._asyncDataPromises[key];
|
|
394
395
|
}
|
|
395
396
|
if (asyncData._abortController?.signal.aborted) {
|
|
396
|
-
return;
|
|
397
|
+
return nuxtApp._asyncDataPromises[key];
|
|
397
398
|
}
|
|
398
399
|
if (typeof DOMException !== "undefined" && error instanceof DOMException && error.name === "AbortError") {
|
|
399
400
|
asyncData.status.value = "idle";
|
|
400
|
-
return;
|
|
401
|
+
return nuxtApp._asyncDataPromises[key];
|
|
401
402
|
}
|
|
402
403
|
asyncData.error.value = createError(error);
|
|
403
404
|
asyncData.data.value = unref(options.default());
|
|
@@ -406,6 +407,7 @@ function createAsyncData(nuxtApp, key, _handler, options, initialCachedData) {
|
|
|
406
407
|
if (pendingWhenIdle) {
|
|
407
408
|
asyncData.pending.value = false;
|
|
408
409
|
}
|
|
410
|
+
cleanupController.abort();
|
|
409
411
|
delete nuxtApp._asyncDataPromises[key];
|
|
410
412
|
});
|
|
411
413
|
nuxtApp._asyncDataPromises[key] = promise;
|
|
@@ -450,7 +452,7 @@ function createHash(_handler, options) {
|
|
|
450
452
|
getCachedData: options.getCachedData ? hash(options.getCachedData) : void 0
|
|
451
453
|
};
|
|
452
454
|
}
|
|
453
|
-
function mergeAbortSignals(signals, timeout) {
|
|
455
|
+
function mergeAbortSignals(signals, cleanupSignal, timeout) {
|
|
454
456
|
const list = signals.filter((s) => !!s);
|
|
455
457
|
if (typeof timeout === "number" && timeout >= 0) {
|
|
456
458
|
const timeoutSignal = AbortSignal.timeout?.(timeout);
|
|
@@ -483,7 +485,7 @@ function mergeAbortSignals(signals, timeout) {
|
|
|
483
485
|
}
|
|
484
486
|
};
|
|
485
487
|
for (const sig of list) {
|
|
486
|
-
sig.addEventListener?.("abort", onAbort, { once: true });
|
|
488
|
+
sig.addEventListener?.("abort", onAbort, { once: true, signal: cleanupSignal });
|
|
487
489
|
}
|
|
488
490
|
return controller.signal;
|
|
489
491
|
}
|
|
@@ -85,7 +85,7 @@ function generateOptionSegments(opts) {
|
|
|
85
85
|
toValue(opts.method)?.toUpperCase() || "GET",
|
|
86
86
|
toValue(opts.baseURL)
|
|
87
87
|
];
|
|
88
|
-
for (const _obj of [opts.
|
|
88
|
+
for (const _obj of [opts.query || opts.params]) {
|
|
89
89
|
const obj = toValue(_obj);
|
|
90
90
|
if (!obj) {
|
|
91
91
|
continue;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useRouter } from "./router.js";
|
|
2
2
|
import { useNuxtApp } from "../nuxt.js";
|
|
3
|
+
let _isHmrUpdating = false;
|
|
3
4
|
export async function callOnce(...args) {
|
|
4
5
|
const autoKey = typeof args[args.length - 1] === "string" ? args.pop() : void 0;
|
|
5
6
|
if (typeof args[0] !== "string") {
|
|
@@ -24,7 +25,9 @@ export async function callOnce(...args) {
|
|
|
24
25
|
cleanups.push(nuxtApp.hooks.hook("page:start", callback), useRouter().beforeResolve(callback));
|
|
25
26
|
}
|
|
26
27
|
if (nuxtApp.payload.once.has(_key)) {
|
|
27
|
-
|
|
28
|
+
if (!import.meta.dev || !_isHmrUpdating) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
nuxtApp._once ||= {};
|
|
30
33
|
nuxtApp._once[_key] ||= fn() || true;
|
|
@@ -32,3 +35,15 @@ export async function callOnce(...args) {
|
|
|
32
35
|
nuxtApp.payload.once.add(_key);
|
|
33
36
|
delete nuxtApp._once[_key];
|
|
34
37
|
}
|
|
38
|
+
if (import.meta.hot) {
|
|
39
|
+
import.meta.hot.on("vite:beforeUpdate", (payload) => {
|
|
40
|
+
if (payload.updates.some((u) => u.type === "js-update")) {
|
|
41
|
+
_isHmrUpdating = true;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
import.meta.hot.on("vite:afterUpdate", (payload) => {
|
|
45
|
+
if (payload.updates.some((u) => u.type === "js-update")) {
|
|
46
|
+
_isHmrUpdating = false;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -12,7 +12,7 @@ export const useRoute = () => {
|
|
|
12
12
|
if (import.meta.dev && !getCurrentInstance() && isProcessingMiddleware()) {
|
|
13
13
|
const middleware = useNuxtApp()._processingMiddleware;
|
|
14
14
|
const trace = getUserTrace().map(({ source, line, column }) => `at ${source}:${line}:${column}`).join("\n");
|
|
15
|
-
console.warn(`[nuxt] \`useRoute\` was called within middleware${typeof middleware === "string" ? ` (\`${middleware}\`)` : ""}. This may lead to misleading results. Instead, use the (to, from) arguments passed to the middleware to access the new and old routes. Learn more: https://nuxt.com/docs/4.x/
|
|
15
|
+
console.warn(`[nuxt] \`useRoute\` was called within middleware${typeof middleware === "string" ? ` (\`${middleware}\`)` : ""}. This may lead to misleading results. Instead, use the (to, from) arguments passed to the middleware to access the new and old routes. Learn more: https://nuxt.com/docs/4.x/directory-structure/app/middleware#accessing-route-in-middleware` + ("\n" + trace));
|
|
16
16
|
}
|
|
17
17
|
if (hasInjectionContext()) {
|
|
18
18
|
return inject(PageRouteSymbol, useNuxtApp()._route);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const entry: (
|
|
1
|
+
import type { Entry } from './entry.js';
|
|
2
|
+
declare const entry: Entry | (() => Promise<Entry>);
|
|
3
3
|
export default entry;
|
package/dist/app/entry.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { App } from 'vue';
|
|
2
2
|
import '#build/fetch.mjs';
|
|
3
3
|
import '#build/global-polyfills.mjs';
|
|
4
|
-
import type {
|
|
4
|
+
import type { NuxtSSRContext } from './nuxt.js';
|
|
5
5
|
import '#build/css';
|
|
6
|
-
|
|
6
|
+
export type Entry = (ssrContext?: NuxtSSRContext) => Promise<App<Element>>;
|
|
7
|
+
declare const _default: Entry;
|
|
7
8
|
export default _default;
|
package/dist/app/entry.js
CHANGED
package/dist/app/nuxt.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { App, EffectScope, Ref, VNode, onErrorCaptured } from 'vue';
|
|
2
2
|
import type { RouteLocationNormalizedLoaded } from 'vue-router';
|
|
3
3
|
import type { Hookable } from 'hookable';
|
|
4
|
+
import type { UseContext } from 'unctx';
|
|
4
5
|
import type { SSRContext, createRenderer } from 'vue-bundle-renderer/runtime';
|
|
5
6
|
import type { EventHandlerRequest, H3Event } from 'h3';
|
|
6
7
|
import type { RenderResponse } from 'nitropack/types';
|
|
@@ -15,7 +16,7 @@ import type { NuxtAppManifestMeta } from './composables/manifest.js';
|
|
|
15
16
|
import type { LoadingIndicator } from './composables/loading-indicator.js';
|
|
16
17
|
import type { RouteAnnouncer } from './composables/route-announcer.js';
|
|
17
18
|
import type { AppConfig, AppConfigInput, RuntimeConfig } from 'nuxt/schema';
|
|
18
|
-
export declare function getNuxtAppCtx(id?:
|
|
19
|
+
export declare function getNuxtAppCtx(id?: string): UseContext<NuxtApp>;
|
|
19
20
|
type HookResult = Promise<void> | void;
|
|
20
21
|
type AppRenderedContext = {
|
|
21
22
|
ssrContext: NuxtApp['ssrContext'];
|
|
@@ -148,7 +149,9 @@ interface _NuxtApp {
|
|
|
148
149
|
/** @internal */
|
|
149
150
|
_appConfig: AppConfig;
|
|
150
151
|
/** @internal */
|
|
151
|
-
_route: RouteLocationNormalizedLoaded
|
|
152
|
+
_route: RouteLocationNormalizedLoaded & {
|
|
153
|
+
sync?: () => void;
|
|
154
|
+
};
|
|
152
155
|
/** @internal */
|
|
153
156
|
_islandPromises?: Record<string, Promise<any>>;
|
|
154
157
|
/** @internal */
|
|
@@ -240,14 +243,14 @@ export declare function applyPlugins(nuxtApp: NuxtApp, plugins: Array<Plugin & O
|
|
|
240
243
|
export declare function defineNuxtPlugin<T extends Record<string, unknown>>(plugin: Plugin<T> | ObjectPlugin<T>): Plugin<T> & ObjectPlugin<T>;
|
|
241
244
|
export declare const definePayloadPlugin: typeof defineNuxtPlugin;
|
|
242
245
|
/** @since 3.0.0 */
|
|
243
|
-
export declare function isNuxtPlugin(plugin: unknown): plugin is
|
|
246
|
+
export declare function isNuxtPlugin(plugin: unknown): plugin is Plugin;
|
|
244
247
|
/**
|
|
245
248
|
* Ensures that the setup function passed in has access to the Nuxt instance via `useNuxtApp`.
|
|
246
249
|
* @param nuxt A Nuxt instance
|
|
247
250
|
* @param setup The function to call
|
|
248
251
|
* @since 3.0.0
|
|
249
252
|
*/
|
|
250
|
-
export declare function callWithNuxt<T extends (...args: any[]) => any>(nuxt: NuxtApp | _NuxtApp, setup: T, args?: Parameters<T>):
|
|
253
|
+
export declare function callWithNuxt<T extends (...args: any[]) => any>(nuxt: NuxtApp | _NuxtApp, setup: T, args?: Parameters<T>): Promise<ReturnType<T>>;
|
|
251
254
|
/**
|
|
252
255
|
* Returns the current Nuxt instance.
|
|
253
256
|
*
|
package/dist/app/utils.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/** @since 3.9.0 */
|
|
2
2
|
export declare function toArray<T>(value: T | T[]): T[];
|
|
3
|
-
|
|
3
|
+
type Trace = {
|
|
4
4
|
source: string;
|
|
5
|
-
column?: number;
|
|
6
|
-
function?: string;
|
|
7
5
|
line?: number;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} | null;
|
|
6
|
+
column?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function getUserTrace(): Trace[];
|
|
9
|
+
export declare function getUserCaller(): Trace | null;
|
|
10
|
+
export {};
|
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,6 @@ import { NuxtOptions, Nuxt } from 'nuxt/schema';
|
|
|
4
4
|
declare function createNuxt(options: NuxtOptions): Nuxt;
|
|
5
5
|
declare function loadNuxt(opts: LoadNuxtOptions): Promise<Nuxt>;
|
|
6
6
|
|
|
7
|
-
declare function build(nuxt: Nuxt): Promise<
|
|
7
|
+
declare function build(nuxt: Nuxt): Promise<void>;
|
|
8
8
|
|
|
9
9
|
export { build, createNuxt, loadNuxt };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ import { NuxtOptions, Nuxt } from 'nuxt/schema';
|
|
|
4
4
|
declare function createNuxt(options: NuxtOptions): Nuxt;
|
|
5
5
|
declare function loadNuxt(opts: LoadNuxtOptions): Promise<Nuxt>;
|
|
6
6
|
|
|
7
|
-
declare function build(nuxt: Nuxt): Promise<
|
|
7
|
+
declare function build(nuxt: Nuxt): Promise<void>;
|
|
8
8
|
|
|
9
9
|
export { build, createNuxt, loadNuxt };
|