@nuxt/bridge-edge 3.4.0-29107292.b82fa62 → 3.4.0-29110408.3747562
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-29110408.3747562";
|
|
7
7
|
|
|
8
8
|
const middlewareTemplate = {
|
|
9
9
|
filename: "middleware.js",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Ref, WatchSource } from 'vue';
|
|
2
2
|
import type { NuxtAppCompat } from '@nuxt/bridge-schema';
|
|
3
|
-
import type { NuxtError } from './error';
|
|
4
3
|
export type _Transform<Input = any, Output = any> = (input: Input) => Output | Promise<Output>;
|
|
5
4
|
export type PickFrom<T, K extends Array<string>> = T extends Array<any> ? T : T extends Record<string, any> ? Pick<T, K[number]> : T;
|
|
6
5
|
export type KeysOf<T> = Array<keyof T extends string ? keyof T : string>;
|
|
@@ -80,13 +79,13 @@ export interface _AsyncData<DataT, ErrorT> {
|
|
|
80
79
|
status: Ref<AsyncDataRequestStatus>;
|
|
81
80
|
}
|
|
82
81
|
export type AsyncData<Data, Error> = _AsyncData<Data, Error> & Promise<_AsyncData<Data, Error>>;
|
|
83
|
-
export declare function useAsyncData<ResT,
|
|
84
|
-
export declare function useAsyncData<ResT,
|
|
85
|
-
export declare function useAsyncData<ResT,
|
|
86
|
-
export declare function useAsyncData<ResT,
|
|
87
|
-
export declare function useLazyAsyncData<ResT,
|
|
88
|
-
export declare function useLazyAsyncData<ResT,
|
|
89
|
-
export declare function useLazyAsyncData<ResT,
|
|
90
|
-
export declare function useLazyAsyncData<ResT,
|
|
82
|
+
export declare function useAsyncData<ResT, DataE = Error, 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, DataE | null>;
|
|
83
|
+
export declare function useAsyncData<ResT, DataE = Error, 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, DataE | null>;
|
|
84
|
+
export declare function useAsyncData<ResT, DataE = Error, 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, DataE | null>;
|
|
85
|
+
export declare function useAsyncData<ResT, DataE = Error, 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, DataE | null>;
|
|
86
|
+
export declare function useLazyAsyncData<ResT, DataE = Error, 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, DataE | null>;
|
|
87
|
+
export declare function useLazyAsyncData<ResT, DataE = Error, 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, DataE | null>;
|
|
88
|
+
export declare function useLazyAsyncData<ResT, DataE = Error, 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, DataE | null>;
|
|
89
|
+
export declare function useLazyAsyncData<ResT, DataE = Error, 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, DataE | null>;
|
|
91
90
|
export declare function refreshNuxtData(keys?: string | string[]): Promise<void>;
|
|
92
91
|
export declare function clearNuxtData(keys?: string | string[] | ((key: string) => boolean)): void;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { H3Error } from 'h3';
|
|
2
|
-
export declare const NUXT_ERROR_SIGNATURE = "__nuxt_error";
|
|
3
2
|
export declare const useError: () => import("vue").Ref<any>;
|
|
4
3
|
export interface NuxtError<DataT = unknown> extends H3Error<DataT> {
|
|
5
4
|
}
|
|
6
|
-
export declare const showError: <DataT = unknown>(
|
|
5
|
+
export declare const showError: <DataT = unknown>(_err: string | Error | (Partial<NuxtError<DataT>> & {
|
|
6
|
+
status?: number;
|
|
7
|
+
statusText?: string;
|
|
8
|
+
})) => NuxtError<unknown>;
|
|
7
9
|
/** @deprecated Use `throw createError()` or `showError` */
|
|
8
|
-
export declare const throwError: <DataT = unknown>(
|
|
10
|
+
export declare const throwError: <DataT = unknown>(_err: string | Error | (Partial<NuxtError<DataT>> & {
|
|
11
|
+
status?: number;
|
|
12
|
+
statusText?: string;
|
|
13
|
+
})) => NuxtError<unknown>;
|
|
9
14
|
export declare const clearError: (options?: {
|
|
10
15
|
redirect?: string;
|
|
11
16
|
}) => Promise<void>;
|
|
12
|
-
export declare const isNuxtError:
|
|
13
|
-
export declare const createError: <DataT = unknown>(
|
|
17
|
+
export declare const isNuxtError: (err?: string | object) => err is NuxtError;
|
|
18
|
+
export declare const createError: <DataT = unknown>(err: string | Error | (Partial<NuxtError<DataT>> & {
|
|
19
|
+
status?: number;
|
|
20
|
+
statusText?: string;
|
|
21
|
+
})) => NuxtError;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { createError as
|
|
1
|
+
import { createError as _createError } from "h3";
|
|
2
2
|
import { toRef } from "vue";
|
|
3
3
|
import { useNuxtApp } from "../nuxt.mjs";
|
|
4
|
-
export const NUXT_ERROR_SIGNATURE = "__nuxt_error";
|
|
5
4
|
export const useError = () => toRef(useNuxtApp().payload, "error");
|
|
6
|
-
export const showError = (
|
|
7
|
-
const
|
|
5
|
+
export const showError = (_err) => {
|
|
6
|
+
const err = createError(_err);
|
|
8
7
|
try {
|
|
9
8
|
const nuxtApp = useNuxtApp();
|
|
10
|
-
nuxtApp.callHook("app:error",
|
|
11
|
-
const
|
|
12
|
-
|
|
9
|
+
nuxtApp.callHook("app:error", err);
|
|
10
|
+
const error = useError();
|
|
11
|
+
error.value = error.value || err;
|
|
13
12
|
} catch {
|
|
14
|
-
throw
|
|
13
|
+
throw err;
|
|
15
14
|
}
|
|
16
|
-
return
|
|
15
|
+
return err;
|
|
17
16
|
};
|
|
18
17
|
export const throwError = showError;
|
|
19
18
|
export const clearError = async (options = {}) => {
|
|
@@ -25,13 +24,9 @@ export const clearError = async (options = {}) => {
|
|
|
25
24
|
}
|
|
26
25
|
error.value = null;
|
|
27
26
|
};
|
|
28
|
-
export const isNuxtError = (
|
|
29
|
-
export const createError = (
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
configurable: false,
|
|
34
|
-
writable: false
|
|
35
|
-
});
|
|
36
|
-
return nuxtError;
|
|
27
|
+
export const isNuxtError = (err) => !!(err && typeof err === "object" && "__nuxt_error" in err);
|
|
28
|
+
export const createError = (err) => {
|
|
29
|
+
const _err = _createError(err);
|
|
30
|
+
_err.__nuxt_error = true;
|
|
31
|
+
return _err;
|
|
37
32
|
};
|
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-29110408.3747562",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/bridge.git"
|
|
@@ -22,7 +22,7 @@
|
|
|
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-29110408.3747562",
|
|
26
26
|
"@nuxt/devalue": "^2.0.2",
|
|
27
27
|
"@nuxt/kit": "3.17.1",
|
|
28
28
|
"@nuxt/schema": "3.17.1",
|