@depup/nuxt 4.2.2-depup.0
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/LICENSE +21 -0
- package/README.md +117 -0
- package/app.d.ts +1 -0
- package/bin/nuxt.mjs +2 -0
- package/config.cjs +7 -0
- package/config.d.ts +8 -0
- package/config.js +5 -0
- package/dist/app/compat/capi.d.ts +4 -0
- package/dist/app/compat/capi.js +19 -0
- package/dist/app/compat/idle-callback.d.ts +2 -0
- package/dist/app/compat/idle-callback.js +15 -0
- package/dist/app/compat/interval.d.ts +1 -0
- package/dist/app/compat/interval.js +11 -0
- package/dist/app/compat/vue-demi.d.ts +4 -0
- package/dist/app/compat/vue-demi.js +4 -0
- package/dist/app/components/client-fallback.client.d.ts +50 -0
- package/dist/app/components/client-fallback.client.js +50 -0
- package/dist/app/components/client-fallback.server.d.ts +57 -0
- package/dist/app/components/client-fallback.server.js +80 -0
- package/dist/app/components/client-only.d.ts +26 -0
- package/dist/app/components/client-only.js +130 -0
- package/dist/app/components/dev-only.d.ts +11 -0
- package/dist/app/components/dev-only.js +14 -0
- package/dist/app/components/error-404.d.vue.ts +51 -0
- package/dist/app/components/error-404.vue +48 -0
- package/dist/app/components/error-404.vue.d.ts +51 -0
- package/dist/app/components/error-500.d.vue.ts +51 -0
- package/dist/app/components/error-500.vue +46 -0
- package/dist/app/components/error-500.vue.d.ts +51 -0
- package/dist/app/components/index.d.ts +3 -0
- package/dist/app/components/index.js +1 -0
- package/dist/app/components/injections.d.ts +7 -0
- package/dist/app/components/injections.js +2 -0
- package/dist/app/components/island-renderer.d.ts +20 -0
- package/dist/app/components/island-renderer.js +28 -0
- package/dist/app/components/nuxt-error-boundary.d.vue.ts +24 -0
- package/dist/app/components/nuxt-error-boundary.vue +46 -0
- package/dist/app/components/nuxt-error-boundary.vue.d.ts +24 -0
- package/dist/app/components/nuxt-error-page.d.vue.ts +7 -0
- package/dist/app/components/nuxt-error-page.vue +27 -0
- package/dist/app/components/nuxt-error-page.vue.d.ts +7 -0
- package/dist/app/components/nuxt-island.d.ts +70 -0
- package/dist/app/components/nuxt-island.js +331 -0
- package/dist/app/components/nuxt-layout.d.ts +14 -0
- package/dist/app/components/nuxt-layout.js +171 -0
- package/dist/app/components/nuxt-link.d.ts +101 -0
- package/dist/app/components/nuxt-link.js +409 -0
- package/dist/app/components/nuxt-loading-indicator.d.ts +78 -0
- package/dist/app/components/nuxt-loading-indicator.js +75 -0
- package/dist/app/components/nuxt-root.d.vue.ts +3 -0
- package/dist/app/components/nuxt-root.vue +60 -0
- package/dist/app/components/nuxt-root.vue.d.ts +3 -0
- package/dist/app/components/nuxt-route-announcer.d.ts +26 -0
- package/dist/app/components/nuxt-route-announcer.js +48 -0
- package/dist/app/components/nuxt-stubs.d.ts +6 -0
- package/dist/app/components/nuxt-stubs.js +14 -0
- package/dist/app/components/nuxt-teleport-island-component.d.ts +22 -0
- package/dist/app/components/nuxt-teleport-island-component.js +38 -0
- package/dist/app/components/nuxt-teleport-island-slot.d.ts +32 -0
- package/dist/app/components/nuxt-teleport-island-slot.js +53 -0
- package/dist/app/components/nuxt-time.d.vue.ts +37 -0
- package/dist/app/components/nuxt-time.vue +148 -0
- package/dist/app/components/nuxt-time.vue.d.ts +37 -0
- package/dist/app/components/route-provider.d.ts +48 -0
- package/dist/app/components/route-provider.js +49 -0
- package/dist/app/components/server-placeholder.d.ts +2 -0
- package/dist/app/components/server-placeholder.js +7 -0
- package/dist/app/components/test-component-wrapper.d.ts +4 -0
- package/dist/app/components/test-component-wrapper.js +27 -0
- package/dist/app/components/utils.d.ts +48 -0
- package/dist/app/components/utils.js +126 -0
- package/dist/app/components/welcome.d.vue.ts +24 -0
- package/dist/app/components/welcome.vue +34 -0
- package/dist/app/components/welcome.vue.d.ts +24 -0
- package/dist/app/composables/asyncContext.d.ts +2 -0
- package/dist/app/composables/asyncContext.js +7 -0
- package/dist/app/composables/asyncData.d.ts +146 -0
- package/dist/app/composables/asyncData.js +491 -0
- package/dist/app/composables/chunk.d.ts +25 -0
- package/dist/app/composables/chunk.js +30 -0
- package/dist/app/composables/component.d.ts +4 -0
- package/dist/app/composables/component.js +82 -0
- package/dist/app/composables/cookie.d.ts +22 -0
- package/dist/app/composables/cookie.js +205 -0
- package/dist/app/composables/error.d.ts +25 -0
- package/dist/app/composables/error.js +39 -0
- package/dist/app/composables/fetch.d.ts +37 -0
- package/dist/app/composables/fetch.js +123 -0
- package/dist/app/composables/head.d.ts +1 -0
- package/dist/app/composables/head.js +1 -0
- package/dist/app/composables/hydrate.d.ts +9 -0
- package/dist/app/composables/hydrate.js +14 -0
- package/dist/app/composables/id.d.ts +3 -0
- package/dist/app/composables/id.js +2 -0
- package/dist/app/composables/index.d.ts +29 -0
- package/dist/app/composables/index.js +21 -0
- package/dist/app/composables/lazy-hydration.d.ts +40 -0
- package/dist/app/composables/lazy-hydration.js +2 -0
- package/dist/app/composables/loading-indicator.d.ts +39 -0
- package/dist/app/composables/loading-indicator.js +142 -0
- package/dist/app/composables/manifest.d.ts +20 -0
- package/dist/app/composables/manifest.js +59 -0
- package/dist/app/composables/once.d.ts +14 -0
- package/dist/app/composables/once.js +49 -0
- package/dist/app/composables/payload.d.ts +27 -0
- package/dist/app/composables/payload.js +137 -0
- package/dist/app/composables/preload.d.ts +20 -0
- package/dist/app/composables/preload.js +55 -0
- package/dist/app/composables/preview.d.ts +38 -0
- package/dist/app/composables/preview.js +61 -0
- package/dist/app/composables/ready.d.ts +2 -0
- package/dist/app/composables/ready.js +15 -0
- package/dist/app/composables/route-announcer.d.ts +19 -0
- package/dist/app/composables/route-announcer.js +55 -0
- package/dist/app/composables/router.d.ts +96 -0
- package/dist/app/composables/router.js +197 -0
- package/dist/app/composables/runtime-hook.d.ts +9 -0
- package/dist/app/composables/runtime-hook.js +7 -0
- package/dist/app/composables/script-stubs.d.ts +32 -0
- package/dist/app/composables/script-stubs.js +104 -0
- package/dist/app/composables/ssr.d.ts +33 -0
- package/dist/app/composables/ssr.js +113 -0
- package/dist/app/composables/state.d.ts +11 -0
- package/dist/app/composables/state.js +40 -0
- package/dist/app/composables/url.d.ts +3 -0
- package/dist/app/composables/url.js +8 -0
- package/dist/app/config.d.ts +14 -0
- package/dist/app/config.js +72 -0
- package/dist/app/entry-spa.d.ts +2 -0
- package/dist/app/entry-spa.js +2 -0
- package/dist/app/entry.async.d.ts +3 -0
- package/dist/app/entry.async.js +5 -0
- package/dist/app/entry.d.ts +7 -0
- package/dist/app/entry.js +78 -0
- package/dist/app/index.d.ts +12 -0
- package/dist/app/index.js +8 -0
- package/dist/app/middleware/manifest-route-rule.d.ts +2 -0
- package/dist/app/middleware/manifest-route-rule.js +17 -0
- package/dist/app/nuxt.d.ts +271 -0
- package/dist/app/nuxt.js +279 -0
- package/dist/app/plugins/browser-devtools-timing.client.d.ts +2 -0
- package/dist/app/plugins/browser-devtools-timing.client.js +23 -0
- package/dist/app/plugins/check-if-layout-used.d.ts +2 -0
- package/dist/app/plugins/check-if-layout-used.js +28 -0
- package/dist/app/plugins/check-outdated-build.client.d.ts +2 -0
- package/dist/app/plugins/check-outdated-build.client.js +39 -0
- package/dist/app/plugins/chunk-reload-immediate.client.d.ts +2 -0
- package/dist/app/plugins/chunk-reload-immediate.client.js +20 -0
- package/dist/app/plugins/chunk-reload.client.d.ts +2 -0
- package/dist/app/plugins/chunk-reload.client.js +30 -0
- package/dist/app/plugins/cross-origin-prefetch.client.d.ts +2 -0
- package/dist/app/plugins/cross-origin-prefetch.client.js +37 -0
- package/dist/app/plugins/debug-hooks.d.ts +2 -0
- package/dist/app/plugins/debug-hooks.js +9 -0
- package/dist/app/plugins/dev-server-logs.d.ts +2 -0
- package/dist/app/plugins/dev-server-logs.js +60 -0
- package/dist/app/plugins/navigation-repaint.client.d.ts +2 -0
- package/dist/app/plugins/navigation-repaint.client.js +16 -0
- package/dist/app/plugins/payload.client.d.ts +2 -0
- package/dist/app/plugins/payload.client.js +50 -0
- package/dist/app/plugins/preload.server.d.ts +2 -0
- package/dist/app/plugins/preload.server.js +13 -0
- package/dist/app/plugins/restore-state.client.d.ts +2 -0
- package/dist/app/plugins/restore-state.client.js +18 -0
- package/dist/app/plugins/revive-payload.client.d.ts +2 -0
- package/dist/app/plugins/revive-payload.client.js +44 -0
- package/dist/app/plugins/revive-payload.server.d.ts +2 -0
- package/dist/app/plugins/revive-payload.server.js +26 -0
- package/dist/app/plugins/router.d.ts +59 -0
- package/dist/app/plugins/router.js +222 -0
- package/dist/app/plugins/utils.d.ts +1 -0
- package/dist/app/plugins/utils.js +4 -0
- package/dist/app/plugins/view-transitions.client.d.ts +2 -0
- package/dist/app/plugins/view-transitions.client.js +55 -0
- package/dist/app/plugins/warn.dev.server.d.ts +2 -0
- package/dist/app/plugins/warn.dev.server.js +6 -0
- package/dist/app/types/augments.d.ts +49 -0
- package/dist/app/types/augments.js +0 -0
- package/dist/app/types.d.ts +39 -0
- package/dist/app/types.js +0 -0
- package/dist/app/utils.d.ts +13 -0
- package/dist/app/utils.js +34 -0
- package/dist/components/runtime/client-component.d.ts +2 -0
- package/dist/components/runtime/client-component.js +59 -0
- package/dist/components/runtime/lazy-hydrated-component.d.ts +124 -0
- package/dist/components/runtime/lazy-hydrated-component.js +101 -0
- package/dist/components/runtime/server-component.d.ts +20 -0
- package/dist/components/runtime/server-component.js +69 -0
- package/dist/head/runtime/components.d.ts +1058 -0
- package/dist/head/runtime/components.js +297 -0
- package/dist/head/runtime/composables.d.ts +25 -0
- package/dist/head/runtime/composables.js +47 -0
- package/dist/head/runtime/plugins/unhead.d.ts +2 -0
- package/dist/head/runtime/plugins/unhead.js +31 -0
- package/dist/head/runtime/types.d.ts +7 -0
- package/dist/head/runtime/types.js +0 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.mjs +6974 -0
- package/dist/pages/runtime/app.d.vue.ts +3 -0
- package/dist/pages/runtime/app.vue +6 -0
- package/dist/pages/runtime/app.vue.d.ts +3 -0
- package/dist/pages/runtime/component-stub.d.ts +2 -0
- package/dist/pages/runtime/component-stub.js +1 -0
- package/dist/pages/runtime/composables.d.ts +58 -0
- package/dist/pages/runtime/composables.js +24 -0
- package/dist/pages/runtime/index.d.ts +3 -0
- package/dist/pages/runtime/index.js +1 -0
- package/dist/pages/runtime/page-placeholder.d.ts +4 -0
- package/dist/pages/runtime/page-placeholder.js +11 -0
- package/dist/pages/runtime/page.d.ts +30 -0
- package/dist/pages/runtime/page.js +212 -0
- package/dist/pages/runtime/plugins/check-if-page-unused.d.ts +2 -0
- package/dist/pages/runtime/plugins/check-if-page-unused.js +29 -0
- package/dist/pages/runtime/plugins/prefetch.client.d.ts +2 -0
- package/dist/pages/runtime/plugins/prefetch.client.js +41 -0
- package/dist/pages/runtime/plugins/prerender.server.d.ts +2 -0
- package/dist/pages/runtime/plugins/prerender.server.js +47 -0
- package/dist/pages/runtime/plugins/router.d.ts +6 -0
- package/dist/pages/runtime/plugins/router.js +236 -0
- package/dist/pages/runtime/router.options.d.ts +3 -0
- package/dist/pages/runtime/router.options.js +60 -0
- package/dist/pages/runtime/utils.d.ts +11 -0
- package/dist/pages/runtime/utils.js +18 -0
- package/dist/pages/runtime/validate.d.ts +2 -0
- package/dist/pages/runtime/validate.js +23 -0
- package/kit.d.ts +1 -0
- package/kit.js +1 -0
- package/package.json +156 -0
- package/schema.d.ts +1 -0
- package/schema.js +1 -0
- package/types.d.mts +14 -0
- package/types.d.ts +14 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { AsyncComponentLoader, ExtractPropTypes } from 'vue';
|
|
2
|
+
export declare const createLazyVisibleComponent: (id: string, loader: AsyncComponentLoader) => import("vue").DefineComponent<ExtractPropTypes<{
|
|
3
|
+
hydrateOnVisible: {
|
|
4
|
+
type: () => true | IntersectionObserverInit;
|
|
5
|
+
required: false;
|
|
6
|
+
default: boolean;
|
|
7
|
+
};
|
|
8
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "hydrated"[], "hydrated", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
11
|
+
hydrateOnVisible: {
|
|
12
|
+
type: () => true | IntersectionObserverInit;
|
|
13
|
+
required: false;
|
|
14
|
+
default: boolean;
|
|
15
|
+
};
|
|
16
|
+
}>> & Readonly<{
|
|
17
|
+
onHydrated?: ((...args: any[]) => any) | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
hydrateOnVisible: true | IntersectionObserverInit;
|
|
20
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
21
|
+
export declare const createLazyIdleComponent: (id: string, loader: AsyncComponentLoader) => import("vue").DefineComponent<ExtractPropTypes<{
|
|
22
|
+
hydrateOnIdle: {
|
|
23
|
+
type: () => true | number;
|
|
24
|
+
required: false;
|
|
25
|
+
default: boolean;
|
|
26
|
+
};
|
|
27
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "hydrated"[], "hydrated", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
30
|
+
hydrateOnIdle: {
|
|
31
|
+
type: () => true | number;
|
|
32
|
+
required: false;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
}>> & Readonly<{
|
|
36
|
+
onHydrated?: ((...args: any[]) => any) | undefined;
|
|
37
|
+
}>, {
|
|
38
|
+
hydrateOnIdle: number | true;
|
|
39
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
|
+
export declare const createLazyInteractionComponent: (id: string, loader: AsyncComponentLoader) => import("vue").DefineComponent<ExtractPropTypes<{
|
|
41
|
+
hydrateOnInteraction: {
|
|
42
|
+
type: () => keyof HTMLElementEventMap | Array<keyof HTMLElementEventMap> | true;
|
|
43
|
+
required: false;
|
|
44
|
+
default: ("click" | "focus" | "pointerenter")[];
|
|
45
|
+
};
|
|
46
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "hydrated"[], "hydrated", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
49
|
+
hydrateOnInteraction: {
|
|
50
|
+
type: () => keyof HTMLElementEventMap | Array<keyof HTMLElementEventMap> | true;
|
|
51
|
+
required: false;
|
|
52
|
+
default: ("click" | "focus" | "pointerenter")[];
|
|
53
|
+
};
|
|
54
|
+
}>> & Readonly<{
|
|
55
|
+
onHydrated?: ((...args: any[]) => any) | undefined;
|
|
56
|
+
}>, {
|
|
57
|
+
hydrateOnInteraction: true | keyof HTMLElementEventMap | (keyof HTMLElementEventMap)[];
|
|
58
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
59
|
+
export declare const createLazyMediaQueryComponent: (id: string, loader: AsyncComponentLoader) => import("vue").DefineComponent<ExtractPropTypes<{
|
|
60
|
+
hydrateOnMediaQuery: {
|
|
61
|
+
type: () => string;
|
|
62
|
+
required: true;
|
|
63
|
+
};
|
|
64
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "hydrated"[], "hydrated", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
67
|
+
hydrateOnMediaQuery: {
|
|
68
|
+
type: () => string;
|
|
69
|
+
required: true;
|
|
70
|
+
};
|
|
71
|
+
}>> & Readonly<{
|
|
72
|
+
onHydrated?: ((...args: any[]) => any) | undefined;
|
|
73
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
|
+
export declare const createLazyIfComponent: (id: string, loader: AsyncComponentLoader) => import("vue").DefineComponent<ExtractPropTypes<{
|
|
75
|
+
hydrateWhen: {
|
|
76
|
+
type: BooleanConstructor;
|
|
77
|
+
default: boolean;
|
|
78
|
+
};
|
|
79
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
80
|
+
[key: string]: any;
|
|
81
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "hydrated"[], "hydrated", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
82
|
+
hydrateWhen: {
|
|
83
|
+
type: BooleanConstructor;
|
|
84
|
+
default: boolean;
|
|
85
|
+
};
|
|
86
|
+
}>> & Readonly<{
|
|
87
|
+
onHydrated?: ((...args: any[]) => any) | undefined;
|
|
88
|
+
}>, {
|
|
89
|
+
hydrateWhen: boolean;
|
|
90
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
91
|
+
export declare const createLazyTimeComponent: (id: string, loader: AsyncComponentLoader) => import("vue").DefineComponent<ExtractPropTypes<{
|
|
92
|
+
hydrateAfter: {
|
|
93
|
+
type: NumberConstructor;
|
|
94
|
+
required: true;
|
|
95
|
+
};
|
|
96
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
97
|
+
[key: string]: any;
|
|
98
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "hydrated"[], "hydrated", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
99
|
+
hydrateAfter: {
|
|
100
|
+
type: NumberConstructor;
|
|
101
|
+
required: true;
|
|
102
|
+
};
|
|
103
|
+
}>> & Readonly<{
|
|
104
|
+
onHydrated?: ((...args: any[]) => any) | undefined;
|
|
105
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
106
|
+
export declare const createLazyNeverComponent: (id: string, loader: AsyncComponentLoader) => import("vue").DefineComponent<ExtractPropTypes<{
|
|
107
|
+
hydrateNever: {
|
|
108
|
+
type: () => true;
|
|
109
|
+
required: false;
|
|
110
|
+
default: boolean;
|
|
111
|
+
};
|
|
112
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
113
|
+
[key: string]: any;
|
|
114
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "hydrated"[], "hydrated", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
115
|
+
hydrateNever: {
|
|
116
|
+
type: () => true;
|
|
117
|
+
required: false;
|
|
118
|
+
default: boolean;
|
|
119
|
+
};
|
|
120
|
+
}>> & Readonly<{
|
|
121
|
+
onHydrated?: ((...args: any[]) => any) | undefined;
|
|
122
|
+
}>, {
|
|
123
|
+
hydrateNever: true;
|
|
124
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { defineAsyncComponent, defineComponent, h, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, mergeProps } from "vue";
|
|
2
|
+
import { useNuxtApp } from "#app/nuxt";
|
|
3
|
+
function defineLazyComponent(props, defineStrategy) {
|
|
4
|
+
return (id, loader) => defineComponent({
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
props,
|
|
7
|
+
emits: ["hydrated"],
|
|
8
|
+
setup(props2, ctx) {
|
|
9
|
+
if (import.meta.server) {
|
|
10
|
+
const nuxtApp = useNuxtApp();
|
|
11
|
+
nuxtApp.hook("app:rendered", ({ ssrContext }) => {
|
|
12
|
+
ssrContext.modules.delete(id);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
const child = defineAsyncComponent({ loader });
|
|
16
|
+
const comp = defineAsyncComponent({
|
|
17
|
+
hydrate: defineStrategy(props2),
|
|
18
|
+
loader: () => Promise.resolve(child)
|
|
19
|
+
});
|
|
20
|
+
const onVnodeMounted = () => {
|
|
21
|
+
ctx.emit("hydrated");
|
|
22
|
+
};
|
|
23
|
+
return () => h(comp, mergeProps(ctx.attrs, { onVnodeMounted }), ctx.slots);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export const createLazyVisibleComponent = defineLazyComponent(
|
|
28
|
+
{
|
|
29
|
+
hydrateOnVisible: {
|
|
30
|
+
type: [Object, Boolean],
|
|
31
|
+
required: false,
|
|
32
|
+
default: true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
(props) => hydrateOnVisible(props.hydrateOnVisible === true ? void 0 : props.hydrateOnVisible)
|
|
36
|
+
);
|
|
37
|
+
export const createLazyIdleComponent = defineLazyComponent(
|
|
38
|
+
{
|
|
39
|
+
hydrateOnIdle: {
|
|
40
|
+
type: [Number, Boolean],
|
|
41
|
+
required: false,
|
|
42
|
+
default: true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
(props) => props.hydrateOnIdle === 0 ? void 0 : hydrateOnIdle(props.hydrateOnIdle === true ? void 0 : props.hydrateOnIdle)
|
|
46
|
+
);
|
|
47
|
+
const defaultInteractionEvents = ["pointerenter", "click", "focus"];
|
|
48
|
+
export const createLazyInteractionComponent = defineLazyComponent(
|
|
49
|
+
{
|
|
50
|
+
hydrateOnInteraction: {
|
|
51
|
+
type: [String, Array],
|
|
52
|
+
required: false,
|
|
53
|
+
default: defaultInteractionEvents
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
(props) => hydrateOnInteraction(props.hydrateOnInteraction === true ? defaultInteractionEvents : props.hydrateOnInteraction || defaultInteractionEvents)
|
|
57
|
+
);
|
|
58
|
+
export const createLazyMediaQueryComponent = defineLazyComponent(
|
|
59
|
+
{
|
|
60
|
+
hydrateOnMediaQuery: {
|
|
61
|
+
type: String,
|
|
62
|
+
required: true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
(props) => hydrateOnMediaQuery(props.hydrateOnMediaQuery)
|
|
66
|
+
);
|
|
67
|
+
export const createLazyIfComponent = defineLazyComponent(
|
|
68
|
+
{
|
|
69
|
+
hydrateWhen: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
(props) => props.hydrateWhen ? void 0 : () => {
|
|
75
|
+
}
|
|
76
|
+
/* Vue will trigger the hydration automatically when the prop changes */
|
|
77
|
+
);
|
|
78
|
+
export const createLazyTimeComponent = defineLazyComponent(
|
|
79
|
+
{
|
|
80
|
+
hydrateAfter: {
|
|
81
|
+
type: Number,
|
|
82
|
+
required: true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
(props) => props.hydrateAfter === 0 ? void 0 : (hydrate) => {
|
|
86
|
+
const id = setTimeout(hydrate, props.hydrateAfter);
|
|
87
|
+
return () => clearTimeout(id);
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
const hydrateNever = /* @__NO_SIDE_EFFECTS__ */ () => {
|
|
91
|
+
};
|
|
92
|
+
export const createLazyNeverComponent = defineLazyComponent(
|
|
93
|
+
{
|
|
94
|
+
hydrateNever: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
required: false,
|
|
97
|
+
default: true
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
() => hydrateNever
|
|
101
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const createServerComponent: (name: string) => import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
lazy: BooleanConstructor;
|
|
3
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "error"[], "error", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
6
|
+
lazy: BooleanConstructor;
|
|
7
|
+
}>> & Readonly<{
|
|
8
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
9
|
+
}>, {
|
|
10
|
+
lazy: boolean;
|
|
11
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
12
|
+
export declare const createIslandPage: (name: string) => import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
13
|
+
lazy: BooleanConstructor;
|
|
14
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
+
lazy: BooleanConstructor;
|
|
18
|
+
}>> & Readonly<{}>, {
|
|
19
|
+
lazy: boolean;
|
|
20
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { defineComponent, getCurrentInstance, h, ref } from "vue";
|
|
2
|
+
import NuxtIsland from "#app/components/nuxt-island";
|
|
3
|
+
import { useRoute } from "#app/composables/router";
|
|
4
|
+
import { isPrerendered } from "#app/composables/payload";
|
|
5
|
+
import { createError, showError } from "#app/composables/error";
|
|
6
|
+
import { useNuxtApp } from "#app/nuxt";
|
|
7
|
+
export const createServerComponent = /* @__NO_SIDE_EFFECTS__ */ (name) => {
|
|
8
|
+
return defineComponent({
|
|
9
|
+
name,
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: { lazy: Boolean },
|
|
12
|
+
emits: ["error"],
|
|
13
|
+
setup(props, { attrs, slots, expose, emit }) {
|
|
14
|
+
const vm = getCurrentInstance();
|
|
15
|
+
const islandRef = ref(null);
|
|
16
|
+
expose({
|
|
17
|
+
refresh: () => islandRef.value?.refresh()
|
|
18
|
+
});
|
|
19
|
+
return () => {
|
|
20
|
+
return h(NuxtIsland, {
|
|
21
|
+
name,
|
|
22
|
+
lazy: props.lazy,
|
|
23
|
+
props: attrs,
|
|
24
|
+
scopeId: vm?.vnode.scopeId,
|
|
25
|
+
ref: islandRef,
|
|
26
|
+
onError: (err) => {
|
|
27
|
+
emit("error", err);
|
|
28
|
+
}
|
|
29
|
+
}, slots);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export const createIslandPage = /* @__NO_SIDE_EFFECTS__ */ (name) => {
|
|
35
|
+
return defineComponent({
|
|
36
|
+
name,
|
|
37
|
+
inheritAttrs: false,
|
|
38
|
+
props: { lazy: Boolean },
|
|
39
|
+
async setup(props, { slots, expose }) {
|
|
40
|
+
const islandRef = ref(null);
|
|
41
|
+
expose({
|
|
42
|
+
refresh: () => islandRef.value?.refresh()
|
|
43
|
+
});
|
|
44
|
+
const nuxtApp = useNuxtApp();
|
|
45
|
+
const route = useRoute();
|
|
46
|
+
const path = import.meta.client && await isPrerendered(route.path) ? route.path : route.fullPath.replace(/#.*$/, "");
|
|
47
|
+
return () => {
|
|
48
|
+
return h("div", [
|
|
49
|
+
h(NuxtIsland, {
|
|
50
|
+
name: `page_${name}`,
|
|
51
|
+
lazy: props.lazy,
|
|
52
|
+
ref: islandRef,
|
|
53
|
+
context: { url: path },
|
|
54
|
+
onError: (e) => {
|
|
55
|
+
if (e.cause && e.cause instanceof Response) {
|
|
56
|
+
throw createError({
|
|
57
|
+
statusCode: e.cause.status,
|
|
58
|
+
statusText: e.cause.statusText,
|
|
59
|
+
status: e.cause.status
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
nuxtApp.runWithContext(() => showError(e));
|
|
63
|
+
}
|
|
64
|
+
}, slots)
|
|
65
|
+
]);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|