@nuxt/bridge-edge 3.0.0-27296172.f5307f9 → 3.0.0-27296409.955fa36
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/module2.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { defineNuxtModule, addPluginTemplate } from '@nuxt/kit';
|
|
|
3
3
|
import hash from 'hash-sum';
|
|
4
4
|
import { resolve } from 'pathe';
|
|
5
5
|
|
|
6
|
-
const version = "3.0.0-
|
|
6
|
+
const version = "3.0.0-27296409.955fa36";
|
|
7
7
|
|
|
8
8
|
const middlewareTemplate = {
|
|
9
9
|
filename: "middleware.js",
|
|
@@ -5,6 +5,7 @@ import { setNuxtAppInstance } from '#app'
|
|
|
5
5
|
// Reshape payload to match key `useLazyAsyncData` expects
|
|
6
6
|
function proxiedState (state) {
|
|
7
7
|
state._asyncData = state._asyncData || {}
|
|
8
|
+
state._errors = state._errors || {}
|
|
8
9
|
return new Proxy(state, {
|
|
9
10
|
get (target, prop) {
|
|
10
11
|
if (prop === 'data') {
|
|
@@ -39,7 +40,7 @@ export default (ctx, inject) => {
|
|
|
39
40
|
globalName: 'nuxt',
|
|
40
41
|
payload: proxiedState(process.client ? ctx.nuxtState : ctx.ssrContext.nuxt),
|
|
41
42
|
_asyncDataPromises: [],
|
|
42
|
-
isHydrating:
|
|
43
|
+
isHydrating: true,
|
|
43
44
|
nuxt2Context: ctx
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -51,6 +52,10 @@ export default (ctx, inject) => {
|
|
|
51
52
|
ctx.app.created = [ctx.app.created]
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
if (!Array.isArray(ctx.app.mounted)) {
|
|
56
|
+
ctx.app.mounted = [ctx.app.mounted]
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
if (process.server) {
|
|
55
60
|
nuxtApp.ssrContext = ctx.ssrContext
|
|
56
61
|
}
|
|
@@ -59,6 +64,8 @@ export default (ctx, inject) => {
|
|
|
59
64
|
nuxtApp.vue2App = this
|
|
60
65
|
})
|
|
61
66
|
|
|
67
|
+
ctx.app.mounted.push(() => { nuxtApp.isHydrating = false })
|
|
68
|
+
|
|
62
69
|
const proxiedApp = new Proxy(nuxtApp, {
|
|
63
70
|
get (target, prop) {
|
|
64
71
|
if (prop[0] === '$') {
|
|
@@ -5,6 +5,7 @@ import { setNuxtAppInstance } from '#app'
|
|
|
5
5
|
// Reshape payload to match key `useLazyAsyncData` expects
|
|
6
6
|
function proxiedState (state) {
|
|
7
7
|
state._asyncData = state._asyncData || {}
|
|
8
|
+
state._errors = state._errors || {}
|
|
8
9
|
return new Proxy(state, {
|
|
9
10
|
get (target, prop) {
|
|
10
11
|
if (prop === 'data') {
|
|
@@ -39,7 +40,7 @@ export default (ctx, inject) => {
|
|
|
39
40
|
globalName: 'nuxt',
|
|
40
41
|
payload: proxiedState(process.client ? ctx.nuxtState : ctx.ssrContext.nuxt),
|
|
41
42
|
_asyncDataPromises: [],
|
|
42
|
-
isHydrating:
|
|
43
|
+
isHydrating: true,
|
|
43
44
|
nuxt2Context: ctx
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -51,6 +52,10 @@ export default (ctx, inject) => {
|
|
|
51
52
|
ctx.app.created = [ctx.app.created]
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
if (!Array.isArray(ctx.app.mounted)) {
|
|
56
|
+
ctx.app.mounted = [ctx.app.mounted]
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
if (process.server) {
|
|
55
60
|
nuxtApp.ssrContext = ctx.ssrContext
|
|
56
61
|
}
|
|
@@ -59,6 +64,8 @@ export default (ctx, inject) => {
|
|
|
59
64
|
nuxtApp.vue2App = this
|
|
60
65
|
})
|
|
61
66
|
|
|
67
|
+
ctx.app.mounted.push(() => { nuxtApp.isHydrating = false })
|
|
68
|
+
|
|
62
69
|
const proxiedApp = new Proxy(nuxtApp, {
|
|
63
70
|
get (target, prop) {
|
|
64
71
|
if (prop[0] === '$') {
|
|
@@ -30,7 +30,7 @@ export function useAsyncData(key, handler, options = {}) {
|
|
|
30
30
|
const asyncData = {
|
|
31
31
|
data: ref(nuxt.payload.data[key] ?? options.default()),
|
|
32
32
|
pending: ref(true),
|
|
33
|
-
error: ref(null)
|
|
33
|
+
error: ref(nuxt.payload._errors[key] ?? null)
|
|
34
34
|
};
|
|
35
35
|
asyncData.refresh = (force) => {
|
|
36
36
|
if (nuxt._asyncDataPromises[key] && !force) {
|
|
@@ -52,28 +52,23 @@ export function useAsyncData(key, handler, options = {}) {
|
|
|
52
52
|
}).finally(() => {
|
|
53
53
|
asyncData.pending.value = false;
|
|
54
54
|
nuxt.payload.data[key] = asyncData.data.value;
|
|
55
|
+
nuxt.payload._errors[key] = !!asyncData.error.value;
|
|
55
56
|
delete nuxt._asyncDataPromises[key];
|
|
56
57
|
});
|
|
57
58
|
return nuxt._asyncDataPromises[key];
|
|
58
59
|
};
|
|
59
60
|
const fetchOnServer = options.server !== false && nuxt.payload.serverRendered;
|
|
60
|
-
const clientOnly = options.server === false || !nuxt.payload.serverRendered;
|
|
61
61
|
if (process.server && fetchOnServer) {
|
|
62
62
|
const promise = asyncData.refresh();
|
|
63
63
|
onServerPrefetch(() => promise);
|
|
64
64
|
}
|
|
65
65
|
if (process.client) {
|
|
66
|
-
if (nuxt.isHydrating
|
|
66
|
+
if (fetchOnServer && nuxt.isHydrating) {
|
|
67
67
|
asyncData.pending.value = false;
|
|
68
|
-
}
|
|
69
|
-
if (instance && nuxt.isHydrating && clientOnly) {
|
|
68
|
+
} else if (instance && (nuxt.isHydrating || options.lazy)) {
|
|
70
69
|
instance._nuxtOnBeforeMountCbs.push(asyncData.refresh);
|
|
71
|
-
} else
|
|
72
|
-
|
|
73
|
-
instance._nuxtOnBeforeMountCbs.push(asyncData.refresh);
|
|
74
|
-
} else {
|
|
75
|
-
asyncData.refresh();
|
|
76
|
-
}
|
|
70
|
+
} else {
|
|
71
|
+
asyncData.refresh();
|
|
77
72
|
}
|
|
78
73
|
}
|
|
79
74
|
const asyncDataPromise = Promise.resolve(nuxt._asyncDataPromises[key]).then(() => asyncData);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/bridge-edge",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-27296409.955fa36",
|
|
4
4
|
"repository": "nuxt/framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@babel/plugin-transform-typescript": "^7.16.1",
|
|
22
|
-
"@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-
|
|
23
|
-
"@nuxt/nitro": "npm:@nuxt/nitro-edge@3.0.0-
|
|
22
|
+
"@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-27296409.955fa36",
|
|
23
|
+
"@nuxt/nitro": "npm:@nuxt/nitro-edge@3.0.0-27296409.955fa36",
|
|
24
24
|
"@nuxt/postcss8": "^1.1.3",
|
|
25
|
-
"@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-
|
|
25
|
+
"@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-27296409.955fa36",
|
|
26
26
|
"@vitejs/plugin-legacy": "^1.6.3",
|
|
27
27
|
"@vue/composition-api": "^1.4.0",
|
|
28
28
|
"@vueuse/head": "^0.7.2",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"mlly": "^0.3.13",
|
|
43
43
|
"murmurhash-es": "^0.1.1",
|
|
44
44
|
"node-fetch": "^3.1.0",
|
|
45
|
-
"nuxi": "npm:nuxi-edge@3.0.0-
|
|
45
|
+
"nuxi": "npm:nuxi-edge@3.0.0-27296409.955fa36",
|
|
46
46
|
"p-debounce": "^4.0.0",
|
|
47
47
|
"pathe": "^0.2.0",
|
|
48
48
|
"postcss": "^8",
|