@nuxt/bridge-edge 3.4.0-29095736.724bfa1 → 3.4.0-29107292.b82fa62
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/chunks/module.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import hash from 'hash-sum';
|
|
|
3
3
|
import { resolve } from 'pathe';
|
|
4
4
|
import { genObjectFromRawEntries, genImport } from 'knitwork';
|
|
5
5
|
|
|
6
|
-
const version = "3.4.0-
|
|
6
|
+
const version = "3.4.0-29107292.b82fa62";
|
|
7
7
|
|
|
8
8
|
const middlewareTemplate = {
|
|
9
9
|
filename: "middleware.js",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Ref, WatchSource } from 'vue';
|
|
2
2
|
import type { NuxtAppCompat } from '@nuxt/bridge-schema';
|
|
3
|
+
import type { NuxtError } from './error';
|
|
3
4
|
export type _Transform<Input = any, Output = any> = (input: Input) => Output | Promise<Output>;
|
|
4
5
|
export type PickFrom<T, K extends Array<string>> = T extends Array<any> ? T : T extends Record<string, any> ? Pick<T, K[number]> : T;
|
|
5
6
|
export type KeysOf<T> = Array<keyof T extends string ? keyof T : string>;
|
|
@@ -79,13 +80,13 @@ export interface _AsyncData<DataT, ErrorT> {
|
|
|
79
80
|
status: Ref<AsyncDataRequestStatus>;
|
|
80
81
|
}
|
|
81
82
|
export type AsyncData<Data, Error> = _AsyncData<Data, Error> & Promise<_AsyncData<Data, Error>>;
|
|
82
|
-
export declare function useAsyncData<ResT,
|
|
83
|
-
export declare function useAsyncData<ResT,
|
|
84
|
-
export declare function useAsyncData<ResT,
|
|
85
|
-
export declare function useAsyncData<ResT,
|
|
86
|
-
export declare function useLazyAsyncData<ResT,
|
|
87
|
-
export declare function useLazyAsyncData<ResT,
|
|
88
|
-
export declare function useLazyAsyncData<ResT,
|
|
89
|
-
export declare function useLazyAsyncData<ResT,
|
|
83
|
+
export declare function useAsyncData<ResT, NuxtErrorDataT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>(handler: (ctx?: NuxtAppCompat) => Promise<ResT>, options?: AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>): AsyncData<PickFrom<DataT, PickKeys> | DefaultT, (NuxtErrorDataT extends Error | NuxtError ? NuxtErrorDataT : NuxtError<NuxtErrorDataT>) | null>;
|
|
84
|
+
export declare function useAsyncData<ResT, NuxtErrorDataT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = DataT>(handler: (ctx?: NuxtAppCompat) => Promise<ResT>, options?: AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>): AsyncData<PickFrom<DataT, PickKeys> | DefaultT, (NuxtErrorDataT extends Error | NuxtError ? NuxtErrorDataT : NuxtError<NuxtErrorDataT>) | null>;
|
|
85
|
+
export declare function useAsyncData<ResT, NuxtErrorDataT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>(key: string, handler: (ctx?: NuxtAppCompat) => Promise<ResT>, options?: AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>): AsyncData<PickFrom<DataT, PickKeys> | DefaultT, (NuxtErrorDataT extends Error | NuxtError ? NuxtErrorDataT : NuxtError<NuxtErrorDataT>) | null>;
|
|
86
|
+
export declare function useAsyncData<ResT, NuxtErrorDataT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = DataT>(key: string, handler: (ctx?: NuxtAppCompat) => Promise<ResT>, options?: AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>): AsyncData<PickFrom<DataT, PickKeys> | DefaultT, (NuxtErrorDataT extends Error | NuxtError ? NuxtErrorDataT : NuxtError<NuxtErrorDataT>) | null>;
|
|
87
|
+
export declare function useLazyAsyncData<ResT, NuxtErrorDataT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>(handler: (ctx?: NuxtAppCompat) => Promise<ResT>, options?: Omit<AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>, 'lazy'>): AsyncData<PickFrom<DataT, PickKeys> | DefaultT, (NuxtErrorDataT extends Error | NuxtError ? NuxtErrorDataT : NuxtError<NuxtErrorDataT>) | null>;
|
|
88
|
+
export declare function useLazyAsyncData<ResT, NuxtErrorDataT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = DataT>(handler: (ctx?: NuxtAppCompat) => Promise<ResT>, options?: Omit<AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>, 'lazy'>): AsyncData<PickFrom<DataT, PickKeys> | DefaultT, (NuxtErrorDataT extends Error | NuxtError ? NuxtErrorDataT : NuxtError<NuxtErrorDataT>) | null>;
|
|
89
|
+
export declare function useLazyAsyncData<ResT, NuxtErrorDataT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>(key: string, handler: (ctx?: NuxtAppCompat) => Promise<ResT>, options?: Omit<AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>, 'lazy'>): AsyncData<PickFrom<DataT, PickKeys> | DefaultT, (NuxtErrorDataT extends Error | NuxtError ? NuxtErrorDataT : NuxtError<NuxtErrorDataT>) | null>;
|
|
90
|
+
export declare function useLazyAsyncData<ResT, NuxtErrorDataT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = DataT>(key: string, handler: (ctx?: NuxtAppCompat) => Promise<ResT>, options?: Omit<AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>, 'lazy'>): AsyncData<PickFrom<DataT, PickKeys> | DefaultT, (NuxtErrorDataT extends Error | NuxtError ? NuxtErrorDataT : NuxtError<NuxtErrorDataT>) | null>;
|
|
90
91
|
export declare function refreshNuxtData(keys?: string | string[]): Promise<void>;
|
|
91
92
|
export declare function clearNuxtData(keys?: string | string[] | ((key: string) => boolean)): void;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { H3Error } from 'h3';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const NUXT_ERROR_SIGNATURE = "__nuxt_error";
|
|
3
|
+
export declare const useError: () => import("vue").Ref<any>;
|
|
3
4
|
export interface NuxtError<DataT = unknown> extends H3Error<DataT> {
|
|
4
5
|
}
|
|
5
|
-
export declare const showError: <DataT = unknown>(
|
|
6
|
-
status?: number;
|
|
7
|
-
statusText?: string;
|
|
8
|
-
})) => NuxtError<unknown>;
|
|
6
|
+
export declare const showError: <DataT = unknown>(error: string | Error | Partial<NuxtError<DataT>>) => NuxtError<DataT>;
|
|
9
7
|
/** @deprecated Use `throw createError()` or `showError` */
|
|
10
|
-
export declare const throwError: <DataT = unknown>(
|
|
11
|
-
status?: number;
|
|
12
|
-
statusText?: string;
|
|
13
|
-
})) => NuxtError<unknown>;
|
|
8
|
+
export declare const throwError: <DataT = unknown>(error: string | Error | Partial<NuxtError<DataT>>) => NuxtError<DataT>;
|
|
14
9
|
export declare const clearError: (options?: {
|
|
15
10
|
redirect?: string;
|
|
16
11
|
}) => Promise<void>;
|
|
17
|
-
export declare const isNuxtError: (
|
|
18
|
-
export declare const createError: <DataT = unknown>(
|
|
19
|
-
status?: number;
|
|
20
|
-
statusText?: string;
|
|
21
|
-
})) => NuxtError;
|
|
12
|
+
export declare const isNuxtError: <DataT = unknown>(error?: string | object) => error is NuxtError<DataT>;
|
|
13
|
+
export declare const createError: <DataT = unknown>(error: string | Partial<NuxtError<DataT>>) => NuxtError<DataT>;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { createError as
|
|
1
|
+
import { createError as createH3Error } from "h3";
|
|
2
2
|
import { toRef } from "vue";
|
|
3
3
|
import { useNuxtApp } from "../nuxt.mjs";
|
|
4
|
+
export const NUXT_ERROR_SIGNATURE = "__nuxt_error";
|
|
4
5
|
export const useError = () => toRef(useNuxtApp().payload, "error");
|
|
5
|
-
export const showError = (
|
|
6
|
-
const
|
|
6
|
+
export const showError = (error) => {
|
|
7
|
+
const nuxtError = createError(error);
|
|
7
8
|
try {
|
|
8
9
|
const nuxtApp = useNuxtApp();
|
|
9
|
-
nuxtApp.callHook("app:error",
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
nuxtApp.callHook("app:error", nuxtError);
|
|
11
|
+
const error2 = useError();
|
|
12
|
+
error2.value = error2.value || nuxtError;
|
|
12
13
|
} catch {
|
|
13
|
-
throw
|
|
14
|
+
throw nuxtError;
|
|
14
15
|
}
|
|
15
|
-
return
|
|
16
|
+
return nuxtError;
|
|
16
17
|
};
|
|
17
18
|
export const throwError = showError;
|
|
18
19
|
export const clearError = async (options = {}) => {
|
|
@@ -24,9 +25,13 @@ export const clearError = async (options = {}) => {
|
|
|
24
25
|
}
|
|
25
26
|
error.value = null;
|
|
26
27
|
};
|
|
27
|
-
export const isNuxtError = (
|
|
28
|
-
export const createError = (
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
export const isNuxtError = (error) => !!error && typeof error === "object" && NUXT_ERROR_SIGNATURE in error;
|
|
29
|
+
export const createError = (error) => {
|
|
30
|
+
const nuxtError = createH3Error(error);
|
|
31
|
+
Object.defineProperty(nuxtError, NUXT_ERROR_SIGNATURE, {
|
|
32
|
+
value: true,
|
|
33
|
+
configurable: false,
|
|
34
|
+
writable: false
|
|
35
|
+
});
|
|
36
|
+
return nuxtError;
|
|
32
37
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/bridge-edge",
|
|
3
|
-
"version": "3.4.0-
|
|
3
|
+
"version": "3.4.0-29107292.b82fa62",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/bridge.git"
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
|
23
23
|
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
|
|
24
24
|
"@babel/plugin-transform-typescript": "^7.26.7",
|
|
25
|
-
"@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.4.0-
|
|
25
|
+
"@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.4.0-29107292.b82fa62",
|
|
26
26
|
"@nuxt/devalue": "^2.0.2",
|
|
27
|
-
"@nuxt/kit": "3.
|
|
28
|
-
"@nuxt/schema": "3.
|
|
27
|
+
"@nuxt/kit": "3.17.1",
|
|
28
|
+
"@nuxt/schema": "3.17.1",
|
|
29
29
|
"@nuxt/ui-templates": "^1.3.4",
|
|
30
30
|
"@rollup/plugin-replace": "^6.0.2",
|
|
31
31
|
"@unhead/ssr": "^1.11.20",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"unimport": "^5.0.0",
|
|
69
69
|
"unplugin": "^1.16.1",
|
|
70
70
|
"untyped": "^2.0.0",
|
|
71
|
-
"vite": "~6.2.
|
|
71
|
+
"vite": "~6.2.7",
|
|
72
72
|
"vite-node": "^3.0.5",
|
|
73
73
|
"vue-bundle-renderer": "^2.1.1"
|
|
74
74
|
},
|