@nuxt/bridge-edge 3.2.1-28595085.dd1c3e4 → 3.2.1-28604977.7fe72fb
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/dev-bundler.mjs +1 -1
- package/dist/chunks/module.mjs +1 -1
- package/dist/chunks/vite.mjs +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/composables/asyncData.d.ts +2 -0
- package/dist/runtime/composables/asyncData.mjs +28 -0
- package/dist/runtime/composables/index.d.ts +1 -1
- package/dist/runtime/composables/index.mjs +1 -1
- package/dist/shared/{bridge-edge.4e3b17a7.mjs → bridge-edge.9209fb81.mjs} +1 -1
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ import { genObjectFromRawEntries, genDynamicImport } from 'knitwork';
|
|
|
7
7
|
import fse from 'fs-extra';
|
|
8
8
|
import { debounce } from 'perfect-debounce';
|
|
9
9
|
import { isIgnored, logger } from '@nuxt/kit';
|
|
10
|
-
import { h as hashId, u as uniq, g as generateDevSSRManifest, i as isCSS } from '../shared/bridge-edge.
|
|
10
|
+
import { h as hashId, u as uniq, g as generateDevSSRManifest, i as isCSS } from '../shared/bridge-edge.9209fb81.mjs';
|
|
11
11
|
import { c as createIsExternal } from './vite.mjs';
|
|
12
12
|
import 'h3';
|
|
13
13
|
import 'node-fetch';
|
package/dist/chunks/module.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import hash from 'hash-sum';
|
|
|
3
3
|
import { resolve } from 'pathe';
|
|
4
4
|
import { genImport, genObjectFromRawEntries } from 'knitwork';
|
|
5
5
|
|
|
6
|
-
const version = "3.2.1-
|
|
6
|
+
const version = "3.2.1-28604977.7fe72fb";
|
|
7
7
|
|
|
8
8
|
const middlewareTemplate = {
|
|
9
9
|
filename: "middleware.js",
|
package/dist/chunks/vite.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { normalize, isAbsolute, resolve as resolve$1, join } from 'pathe';
|
|
|
2
2
|
import { logger, isIgnored } from '@nuxt/kit';
|
|
3
3
|
import { resolve, findExports, sanitizeFilePath } from 'mlly';
|
|
4
4
|
import { joinURL, withoutLeadingSlash, withTrailingSlash } from 'ufo';
|
|
5
|
-
import { t as transpile, d as distDir, i as isCSS, p as prepareManifests, a as pkgDir } from '../shared/bridge-edge.
|
|
5
|
+
import { t as transpile, d as distDir, i as isCSS, p as prepareManifests, a as pkgDir } from '../shared/bridge-edge.9209fb81.mjs';
|
|
6
6
|
import createVuePlugin from '@vitejs/plugin-vue2';
|
|
7
7
|
import { getPort } from 'get-port-please';
|
|
8
8
|
import { toNodeListener, createApp, defineEventHandler, defineLazyEventHandler, eventHandler, createError } from 'h3';
|
package/dist/module.mjs
CHANGED
|
@@ -74,6 +74,7 @@ export interface _AsyncData<DataT, ErrorT> {
|
|
|
74
74
|
pending: Ref<boolean>;
|
|
75
75
|
refresh: (opts?: AsyncDataExecuteOptions) => Promise<DataT>;
|
|
76
76
|
execute: (opts?: AsyncDataExecuteOptions) => Promise<DataT>;
|
|
77
|
+
clear: () => void;
|
|
77
78
|
error: Ref<ErrorT | null>;
|
|
78
79
|
status: Ref<AsyncDataRequestStatus>;
|
|
79
80
|
}
|
|
@@ -87,3 +88,4 @@ export declare function useLazyAsyncData<ResT, DataE = Error, DataT = ResT, Pick
|
|
|
87
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>;
|
|
88
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>;
|
|
89
90
|
export declare function refreshNuxtData(keys?: string | string[]): Promise<void>;
|
|
91
|
+
export declare function clearNuxtData(keys?: string | string[] | ((key: string) => boolean)): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { onBeforeMount, onServerPrefetch, onUnmounted, ref, shallowRef, getCurrentInstance, watch, toRef, unref, getCurrentScope, onScopeDispose } from "vue";
|
|
2
2
|
import { useNuxtApp } from "../nuxt.mjs";
|
|
3
|
+
import { toArray } from "../../utils/toArray";
|
|
3
4
|
import { createError } from "./error.mjs";
|
|
4
5
|
const isDefer = (dedupe) => dedupe === "defer" || dedupe === false;
|
|
5
6
|
export function useAsyncData(...args) {
|
|
@@ -91,6 +92,7 @@ export function useAsyncData(...args) {
|
|
|
91
92
|
nuxt._asyncDataPromises[key] = promise;
|
|
92
93
|
return nuxt._asyncDataPromises[key];
|
|
93
94
|
};
|
|
95
|
+
asyncData.clear = () => clearNuxtDataByKey(nuxt, key);
|
|
94
96
|
const initialFetch = () => asyncData.refresh({ _initial: true });
|
|
95
97
|
const fetchOnServer = options.server !== false && nuxt.payload.serverRendered;
|
|
96
98
|
if (process.server && fetchOnServer && options.immediate) {
|
|
@@ -157,6 +159,32 @@ export function refreshNuxtData(keys) {
|
|
|
157
159
|
const _keys = keys ? Array.isArray(keys) ? keys : [keys] : void 0;
|
|
158
160
|
return useNuxtApp().callHook("app:data:refresh", _keys);
|
|
159
161
|
}
|
|
162
|
+
export function clearNuxtData(keys) {
|
|
163
|
+
const nuxtApp = useNuxtApp();
|
|
164
|
+
const _allKeys = Object.keys(nuxtApp.payload.data);
|
|
165
|
+
const _keys = !keys ? _allKeys : typeof keys === "function" ? _allKeys.filter(keys) : toArray(keys);
|
|
166
|
+
for (const key of _keys) {
|
|
167
|
+
clearNuxtDataByKey(nuxtApp, key);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function clearNuxtDataByKey(nuxtApp, key) {
|
|
171
|
+
if (key in nuxtApp.payload.data) {
|
|
172
|
+
nuxtApp.payload.data[key] = void 0;
|
|
173
|
+
}
|
|
174
|
+
if (key in nuxtApp.payload._errors) {
|
|
175
|
+
nuxtApp.payload._errors[key] = null;
|
|
176
|
+
}
|
|
177
|
+
if (nuxtApp._asyncData[key]) {
|
|
178
|
+
nuxtApp._asyncData[key].data.value = void 0;
|
|
179
|
+
nuxtApp._asyncData[key].error.value = null;
|
|
180
|
+
nuxtApp._asyncData[key].pending.value = false;
|
|
181
|
+
nuxtApp._asyncData[key].status.value = "idle";
|
|
182
|
+
}
|
|
183
|
+
if (key in nuxtApp._asyncDataPromises) {
|
|
184
|
+
nuxtApp._asyncDataPromises[key].cancelled = true;
|
|
185
|
+
nuxtApp._asyncDataPromises[key] = void 0;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
160
188
|
function pick(obj, keys) {
|
|
161
189
|
const newObj = {};
|
|
162
190
|
for (const key of keys) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useLazyAsyncData, refreshNuxtData } from './asyncData';
|
|
1
|
+
export { useLazyAsyncData, refreshNuxtData, clearNuxtData } from './asyncData';
|
|
2
2
|
export * from './component';
|
|
3
3
|
export { useCookie } from './cookie';
|
|
4
4
|
export { clearError, createError, isNuxtError, throwError, showError, useError } from './error';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useLazyAsyncData, refreshNuxtData } from "./asyncData.mjs";
|
|
1
|
+
export { useLazyAsyncData, refreshNuxtData, clearNuxtData } from "./asyncData.mjs";
|
|
2
2
|
export * from "./component.mjs";
|
|
3
3
|
export { useCookie } from "./cookie.mjs";
|
|
4
4
|
export { clearError, createError, isNuxtError, throwError, showError, useError } from "./error.mjs";
|
|
@@ -1105,7 +1105,7 @@ const granularAppPresets = [
|
|
|
1105
1105
|
from: "#app/composables/state"
|
|
1106
1106
|
},
|
|
1107
1107
|
{
|
|
1108
|
-
imports: ["useLazyAsyncData", "refreshNuxtData"],
|
|
1108
|
+
imports: ["useLazyAsyncData", "refreshNuxtData", "clearNuxtData"],
|
|
1109
1109
|
from: "#app/composables/asyncData"
|
|
1110
1110
|
},
|
|
1111
1111
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/bridge-edge",
|
|
3
|
-
"version": "3.2.1-
|
|
3
|
+
"version": "3.2.1-28604977.7fe72fb",
|
|
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.24.5",
|
|
25
|
-
"@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.2.1-
|
|
25
|
+
"@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.2.1-28604977.7fe72fb",
|
|
26
26
|
"@nuxt/devalue": "^2.0.2",
|
|
27
27
|
"@nuxt/kit": "3.11.2",
|
|
28
28
|
"@nuxt/postcss8": "^1.1.3",
|