@depup/nuxt 4.3.0-depup.0 → 4.4.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/README.md +23 -107
- package/dist/app/components/nuxt-announcer.d.ts +26 -0
- package/dist/app/components/nuxt-announcer.js +59 -0
- package/dist/app/components/nuxt-island.js +7 -1
- package/dist/app/components/nuxt-layout.js +44 -21
- package/dist/app/components/nuxt-link.js +29 -15
- package/dist/app/components/nuxt-root.vue +1 -1
- package/dist/app/components/nuxt-route-announcer.js +11 -2
- package/dist/app/components/nuxt-time.vue +13 -2
- package/dist/app/components/test-component-wrapper.js +10 -2
- package/dist/app/components/utils.d.ts +7 -1
- package/dist/app/components/utils.js +18 -0
- package/dist/app/components/welcome.vue +1 -1
- package/dist/app/composables/announcer.d.ts +23 -0
- package/dist/app/composables/announcer.js +47 -0
- package/dist/app/composables/asyncData.d.ts +18 -36
- package/dist/app/composables/asyncData.js +214 -186
- package/dist/app/composables/chunk.js +1 -2
- package/dist/app/composables/cookie.d.ts +14 -0
- package/dist/app/composables/cookie.js +66 -17
- package/dist/app/composables/error.d.ts +2 -2
- package/dist/app/composables/error.js +11 -1
- package/dist/app/composables/fetch.d.ts +11 -16
- package/dist/app/composables/fetch.js +79 -76
- package/dist/app/composables/index.d.ts +2 -0
- package/dist/app/composables/index.js +1 -0
- package/dist/app/composables/manifest.d.ts +1 -1
- package/dist/app/composables/manifest.js +1 -4
- package/dist/app/composables/pages.d.ts +2 -0
- package/dist/app/composables/pages.js +1 -0
- package/dist/app/composables/payload.js +14 -5
- package/dist/app/composables/preload.js +1 -1
- package/dist/app/composables/route-announcer.d.ts +2 -2
- package/dist/app/composables/route-announcer.js +6 -6
- package/dist/app/composables/router.d.ts +7 -0
- package/dist/app/composables/router.js +8 -3
- package/dist/app/composables/ssr.d.ts +1 -1
- package/dist/app/composables/ssr.js +1 -1
- package/dist/app/composables/state.d.ts +11 -1
- package/dist/app/composables/state.js +11 -2
- package/dist/app/composables/url.d.ts +1 -1
- package/dist/app/composables/url.js +1 -1
- package/dist/app/config.d.ts +1 -2
- package/dist/app/index.d.ts +2 -2
- package/dist/app/index.js +1 -1
- package/dist/app/nuxt.d.ts +46 -31
- package/dist/app/nuxt.js +6 -2
- package/dist/app/plugins/restore-state.client.js +1 -2
- package/dist/app/plugins/revive-payload.client.js +9 -3
- package/dist/app/plugins/router.js +2 -2
- package/dist/app/plugins/view-transitions.client.js +39 -4
- package/dist/compiler/runtime/index.d.ts +14 -0
- package/dist/compiler/runtime/index.js +14 -0
- package/dist/index.mjs +2592 -1365
- package/dist/pages/runtime/page.js +11 -21
- package/dist/pages/runtime/plugins/router.js +20 -8
- package/dist/pages/runtime/router.options.js +12 -6
- package/meta.js +2 -1
- package/package.json +73 -37
package/README.md
CHANGED
|
@@ -1,119 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
# @depup/nuxt
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Dependency-bumped version of [nuxt](https://www.npmjs.com/package/nuxt)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/dm/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Downloads"></a>
|
|
8
|
-
<a href="https://github.com/nuxt/nuxt/blob/main/LICENSE"><img src="https://img.shields.io/github/license/nuxt/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"></a>
|
|
9
|
-
<a href="https://nuxt.com/modules"><img src="https://img.shields.io/badge/dynamic/json?url=https://nuxt.com/api/v1/modules&query=$.stats.modules&label=Modules&style=flat&colorA=18181B&colorB=28CF8D" alt="Modules"></a>
|
|
10
|
-
<a href="https://nuxt.com"><img src="https://img.shields.io/badge/Nuxt%20Docs-18181B?logo=nuxt" alt="Website"></a>
|
|
11
|
-
<a href="https://chat.nuxt.dev"><img src="https://img.shields.io/badge/Nuxt%20Discord-18181B?logo=discord" alt="Discord"></a>
|
|
12
|
-
<a href="https://securityscorecards.dev/"><img src="https://api.securityscorecards.dev/projects/github.com/nuxt/nuxt/badge" alt="Nuxt openssf scorecard score"></a>
|
|
13
|
-
<a href="https://deepwiki.com/nuxt/nuxt"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
|
|
14
|
-
</p>
|
|
5
|
+
Generated by [DepUp](https://github.com/depup/npm) -- all production
|
|
6
|
+
dependencies bumped to latest versions.
|
|
15
7
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
It provides a number of features that make it easy to build fast, SEO-friendly, and scalable web applications, including:
|
|
19
|
-
- Server-side rendering, static site generation, hybrid rendering and edge-side rendering
|
|
20
|
-
- Automatic routing with code-splitting and pre-fetching
|
|
21
|
-
- Data fetching and state management
|
|
22
|
-
- Search engine optimization and defining meta tags
|
|
23
|
-
- Auto imports of components, composables and utils
|
|
24
|
-
- TypeScript with zero configuration
|
|
25
|
-
- Go full-stack with our server/ directory
|
|
26
|
-
- Extensible with [300+ modules](https://nuxt.com/modules)
|
|
27
|
-
- Deployment to a variety of [hosting platforms](https://nuxt.com/deploy)
|
|
28
|
-
- ...[and much more](https://nuxt.com) 🚀
|
|
29
|
-
|
|
30
|
-
### Table of Contents
|
|
31
|
-
|
|
32
|
-
- 🚀 [Getting Started](#getting-started)
|
|
33
|
-
- 💻 [Vue Development](#vue-development)
|
|
34
|
-
- 📖 [Documentation](#documentation)
|
|
35
|
-
- 🧩 [Modules](#modules)
|
|
36
|
-
- ❤️ [Contribute](#contribute)
|
|
37
|
-
- 🏠 [Local Development](#local-development)
|
|
38
|
-
- 🛟 [Professional Support](#professional-support)
|
|
39
|
-
- 🔗 [Follow Us](#follow-us)
|
|
40
|
-
- ⚖️ [License](#license)
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## <a name="getting-started">🚀 Getting Started</a>
|
|
45
|
-
|
|
46
|
-
Use the following command to create a new starter project. This will create a starter project with all the necessary files and dependencies:
|
|
8
|
+
## Installation
|
|
47
9
|
|
|
48
10
|
```bash
|
|
49
|
-
npm
|
|
11
|
+
npm install @depup/nuxt
|
|
50
12
|
```
|
|
51
13
|
|
|
52
|
-
|
|
53
|
-
|
|
14
|
+
| Field | Value |
|
|
15
|
+
|-------|-------|
|
|
16
|
+
| Original | [nuxt](https://www.npmjs.com/package/nuxt) @ 4.4.2 |
|
|
17
|
+
| Processed | 2026-03-12 |
|
|
18
|
+
| Smoke test | passed |
|
|
19
|
+
| Deps updated | 5 |
|
|
54
20
|
|
|
55
|
-
##
|
|
56
|
-
|
|
57
|
-
Simple, intuitive and powerful, Nuxt lets you write Vue components in a way that makes sense. Every repetitive task is automated, so you can focus on writing your full-stack Vue application with confidence.
|
|
58
|
-
|
|
59
|
-
Example of an `app.vue`:
|
|
60
|
-
|
|
61
|
-
```vue
|
|
62
|
-
<script setup lang="ts">
|
|
63
|
-
useSeoMeta({
|
|
64
|
-
title: 'Meet Nuxt',
|
|
65
|
-
description: 'The Intuitive Vue Framework.',
|
|
66
|
-
})
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<template>
|
|
70
|
-
<div id="app">
|
|
71
|
-
<AppHeader />
|
|
72
|
-
<NuxtPage />
|
|
73
|
-
<AppFooter />
|
|
74
|
-
</div>
|
|
75
|
-
</template>
|
|
76
|
-
|
|
77
|
-
<style scoped>
|
|
78
|
-
#app {
|
|
79
|
-
background-color: #020420;
|
|
80
|
-
color: #00DC82;
|
|
81
|
-
}
|
|
82
|
-
</style>
|
|
83
|
-
```
|
|
21
|
+
## Dependency Changes
|
|
84
22
|
|
|
85
|
-
|
|
23
|
+
| Dependency | From | To |
|
|
24
|
+
|------------|------|-----|
|
|
25
|
+
| c12 | ^3.3.3 | ^4.0.0-beta.3 |
|
|
26
|
+
| devalue | ^5.6.3 | ^5.6.4 |
|
|
27
|
+
| oxc-minify | ^0.117.0 | ^0.118.0 |
|
|
28
|
+
| oxc-parser | ^0.117.0 | ^0.118.0 |
|
|
29
|
+
| oxc-transform | ^0.117.0 | ^0.118.0 |
|
|
86
30
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
## <a name="modules">🧩 Modules</a>
|
|
90
|
-
|
|
91
|
-
Discover our [list of modules](https://nuxt.com/modules) to supercharge your Nuxt project, created by the Nuxt team and community.
|
|
92
|
-
|
|
93
|
-
## <a name="contribute">❤️ Contribute</a>
|
|
94
|
-
|
|
95
|
-
We invite you to contribute and help improve Nuxt 💚
|
|
96
|
-
|
|
97
|
-
Here are a few ways you can get involved:
|
|
98
|
-
- **Reporting Bugs:** If you come across any bugs or issues, please check out the [reporting bugs guide](https://nuxt.com/docs/4.x/community/reporting-bugs) to learn how to submit a bug report.
|
|
99
|
-
- **Suggestions:** Have ideas to enhance Nuxt? We'd love to hear them! Check out the [contribution guide](https://nuxt.com/docs/4.x/community/contribution) to share your suggestions.
|
|
100
|
-
- **Questions:** If you have questions or need assistance, the [getting help guide](https://nuxt.com/docs/4.x/community/getting-help) provides resources to help you out.
|
|
101
|
-
|
|
102
|
-
## <a name="local-development">🏠 Local Development</a>
|
|
103
|
-
|
|
104
|
-
Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/4.x/community/framework-contribution#setup) to contribute to the framework and documentation.
|
|
105
|
-
|
|
106
|
-
## <a name="professional-support">🛟 Professional Support</a>
|
|
107
|
-
|
|
108
|
-
- Technical audit & consulting: [Nuxt Experts](https://nuxt.com/enterprise/support)
|
|
109
|
-
- Custom development & more: [Nuxt Agencies Partners](https://nuxt.com/enterprise/agencies)
|
|
110
|
-
|
|
111
|
-
## <a name="follow-us">🔗 Follow Us</a>
|
|
112
|
-
|
|
113
|
-
<p valign="center">
|
|
114
|
-
<a href="https://go.nuxt.com/discord"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/discord.svg" alt="Discord"></a> <a href="https://go.nuxt.com/x"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/twitter.svg" alt="Twitter"></a> <a href="https://go.nuxt.com/github"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/github.svg" alt="GitHub"></a> <a href="https://go.nuxt.com/bluesky"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/bluesky.svg" alt="Bluesky"></a>
|
|
115
|
-
</p>
|
|
31
|
+
---
|
|
116
32
|
|
|
117
|
-
|
|
33
|
+
Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/nuxt
|
|
118
34
|
|
|
119
|
-
|
|
35
|
+
License inherited from the original package.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AnnouncerPoliteness } from '../composables/announcer.js';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
atomic: {
|
|
4
|
+
type: BooleanConstructor;
|
|
5
|
+
default: boolean;
|
|
6
|
+
};
|
|
7
|
+
politeness: {
|
|
8
|
+
type: () => AnnouncerPoliteness;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
14
|
+
atomic: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
politeness: {
|
|
19
|
+
type: () => AnnouncerPoliteness;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
}>> & Readonly<{}>, {
|
|
23
|
+
politeness: AnnouncerPoliteness;
|
|
24
|
+
atomic: boolean;
|
|
25
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { computed, defineComponent, h } from "vue";
|
|
2
|
+
import { useAnnouncer } from "../composables/announcer.js";
|
|
3
|
+
export default defineComponent({
|
|
4
|
+
name: "NuxtAnnouncer",
|
|
5
|
+
props: {
|
|
6
|
+
atomic: {
|
|
7
|
+
type: Boolean,
|
|
8
|
+
default: true
|
|
9
|
+
},
|
|
10
|
+
politeness: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "polite"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
setup(props, { slots, expose }) {
|
|
16
|
+
const { set, polite, assertive, message, politeness } = useAnnouncer({
|
|
17
|
+
politeness: props.politeness
|
|
18
|
+
});
|
|
19
|
+
const role = computed(() => {
|
|
20
|
+
if (politeness.value === "assertive") {
|
|
21
|
+
return "alert";
|
|
22
|
+
}
|
|
23
|
+
if (politeness.value === "off") {
|
|
24
|
+
return void 0;
|
|
25
|
+
}
|
|
26
|
+
return "status";
|
|
27
|
+
});
|
|
28
|
+
expose({
|
|
29
|
+
set,
|
|
30
|
+
polite,
|
|
31
|
+
assertive,
|
|
32
|
+
message,
|
|
33
|
+
politeness
|
|
34
|
+
});
|
|
35
|
+
return () => h("span", {
|
|
36
|
+
class: "nuxt-announcer",
|
|
37
|
+
style: {
|
|
38
|
+
position: "absolute"
|
|
39
|
+
}
|
|
40
|
+
}, h("span", {
|
|
41
|
+
"role": role.value,
|
|
42
|
+
"aria-live": politeness.value,
|
|
43
|
+
"aria-atomic": props.atomic,
|
|
44
|
+
"style": {
|
|
45
|
+
"border": "0",
|
|
46
|
+
"clip": "rect(0 0 0 0)",
|
|
47
|
+
"clip-path": "inset(50%)",
|
|
48
|
+
"height": "1px",
|
|
49
|
+
"width": "1px",
|
|
50
|
+
"overflow": "hidden",
|
|
51
|
+
"position": "absolute",
|
|
52
|
+
"white-space": "nowrap",
|
|
53
|
+
"word-wrap": "normal",
|
|
54
|
+
"margin": "-1px",
|
|
55
|
+
"padding": "0"
|
|
56
|
+
}
|
|
57
|
+
}, slots.default ? slots.default({ message: message.value }) : message.value));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, Teleport, computed, createStaticVNode, createVNode, defineComponent, getCurrentInstance, h, nextTick, onBeforeUnmount, onMounted, ref, shallowRef, toRaw, watch, withMemo } from "vue";
|
|
2
2
|
import { debounce } from "perfect-debounce";
|
|
3
3
|
import { hash } from "ohash";
|
|
4
|
-
import { appendResponseHeader } from "h3";
|
|
4
|
+
import { appendResponseHeader } from "@nuxt/nitro-server/h3";
|
|
5
5
|
import { randomUUID } from "uncrypto";
|
|
6
6
|
import { joinURL, withQuery } from "ufo";
|
|
7
7
|
import { useNuxtApp, useRuntimeConfig } from "../nuxt.js";
|
|
@@ -260,6 +260,12 @@ export default defineComponent({
|
|
|
260
260
|
if (import.meta.client) {
|
|
261
261
|
watch(props, debounce(() => fetchComponent(), 100), { deep: true });
|
|
262
262
|
}
|
|
263
|
+
if (import.meta.client && instance.vnode.el) {
|
|
264
|
+
const headData = toRaw(nuxtApp.payload.data[`${props.name}_${hashId.value}`])?.head;
|
|
265
|
+
if (headData) {
|
|
266
|
+
activeHead = head.push(headData);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
263
269
|
if (import.meta.client && !instance.vnode.el && props.lazy) {
|
|
264
270
|
fetchComponent();
|
|
265
271
|
} else if (import.meta.server || !instance.vnode.el || !nuxtApp.payload.serverRendered) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Suspense, computed, defineComponent, h, inject, mergeProps, nextTick, onMounted, provide, shallowReactive, shallowRef, unref } from "vue";
|
|
2
2
|
import { useRoute, useRouter } from "../composables/router.js";
|
|
3
3
|
import { useNuxtApp } from "../nuxt.js";
|
|
4
|
-
import { _wrapInTransition } from "./utils.js";
|
|
4
|
+
import { _mergeTransitionProps, _wrapInTransition } from "./utils.js";
|
|
5
5
|
import { LayoutMetaSymbol, PageRouteSymbol } from "./injections.js";
|
|
6
6
|
import { useRoute as useVueRouterRoute } from "#build/pages";
|
|
7
7
|
import layouts from "#build/layouts";
|
|
@@ -62,29 +62,52 @@ export default defineComponent({
|
|
|
62
62
|
}
|
|
63
63
|
let lastLayout;
|
|
64
64
|
return () => {
|
|
65
|
-
const hasLayout = layout.value && layout.value in layouts;
|
|
66
|
-
const
|
|
65
|
+
const hasLayout = !!layout.value && layout.value in layouts;
|
|
66
|
+
const hasTransition = hasLayout && !!(route?.meta.layoutTransition ?? defaultLayoutTransition);
|
|
67
|
+
const transitionProps = hasTransition && _mergeTransitionProps([
|
|
68
|
+
route?.meta.layoutTransition,
|
|
69
|
+
defaultLayoutTransition,
|
|
70
|
+
{
|
|
71
|
+
onBeforeLeave() {
|
|
72
|
+
nuxtApp["~transitionPromise"] = new Promise((resolve) => {
|
|
73
|
+
nuxtApp["~transitionFinish"] = resolve;
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
onAfterLeave() {
|
|
77
|
+
nuxtApp["~transitionFinish"]?.();
|
|
78
|
+
delete nuxtApp["~transitionFinish"];
|
|
79
|
+
delete nuxtApp["~transitionPromise"];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]);
|
|
67
83
|
const previouslyRenderedLayout = lastLayout;
|
|
68
84
|
lastLayout = layout.value;
|
|
69
|
-
return _wrapInTransition(
|
|
70
|
-
default: () => h(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
return _wrapInTransition(transitionProps, {
|
|
86
|
+
default: () => h(
|
|
87
|
+
Suspense,
|
|
88
|
+
{
|
|
89
|
+
suspensible: true,
|
|
90
|
+
onResolve: async () => {
|
|
91
|
+
await nextTick(done);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
default: () => h(
|
|
96
|
+
LayoutProvider,
|
|
97
|
+
{
|
|
98
|
+
layoutProps: mergeProps(context.attrs, route.meta.layoutProps ?? {}, { ref: layoutRef }),
|
|
99
|
+
key: layout.value || void 0,
|
|
100
|
+
name: layout.value,
|
|
101
|
+
shouldProvide: !props.name,
|
|
102
|
+
isRenderingNewLayout: (name) => {
|
|
103
|
+
return name !== previouslyRenderedLayout && name === layout.value;
|
|
104
|
+
},
|
|
105
|
+
hasTransition
|
|
82
106
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
})
|
|
107
|
+
context.slots
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
)
|
|
88
111
|
}).default();
|
|
89
112
|
};
|
|
90
113
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, ref, resolveComponent, shallowRef } from "vue";
|
|
1
|
+
import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, ref, resolveComponent, shallowRef, unref } from "vue";
|
|
2
2
|
import { hasProtocol, joinURL, parseQuery, withTrailingSlash, withoutTrailingSlash } from "ufo";
|
|
3
3
|
import { preloadRouteComponents } from "../composables/preload.js";
|
|
4
4
|
import { onNuxtReady } from "../composables/ready.js";
|
|
5
|
-
import { navigateTo, resolveRouteObject, useRouter } from "../composables/router.js";
|
|
5
|
+
import { encodeRoutePath, navigateTo, resolveRouteObject, useRouter } from "../composables/router.js";
|
|
6
6
|
import { useNuxtApp, useRuntimeConfig } from "../nuxt.js";
|
|
7
7
|
import { cancelIdleCallback, requestIdleCallback } from "../compat/idle-callback.js";
|
|
8
8
|
import { nuxtLinkDefaults } from "#build/nuxt.config.mjs";
|
|
@@ -40,18 +40,18 @@ export function defineNuxtLink(options) {
|
|
|
40
40
|
function useNuxtLink(props) {
|
|
41
41
|
const router = useRouter();
|
|
42
42
|
const config = useRuntimeConfig();
|
|
43
|
-
const hasTarget = computed(() => !!props.target && props.target !== "_self");
|
|
43
|
+
const hasTarget = computed(() => !!unref(props.target) && unref(props.target) !== "_self");
|
|
44
44
|
const isAbsoluteUrl = computed(() => {
|
|
45
|
-
const path = props.to || props.href || "";
|
|
45
|
+
const path = unref(props.to) || unref(props.href) || "";
|
|
46
46
|
return typeof path === "string" && hasProtocol(path, { acceptRelative: true });
|
|
47
47
|
});
|
|
48
48
|
const builtinRouterLink = resolveComponent("RouterLink");
|
|
49
49
|
const useBuiltinLink = builtinRouterLink && typeof builtinRouterLink !== "string" ? builtinRouterLink.useLink : void 0;
|
|
50
50
|
const isExternal = computed(() => {
|
|
51
|
-
if (props.external) {
|
|
51
|
+
if (unref(props.external)) {
|
|
52
52
|
return true;
|
|
53
53
|
}
|
|
54
|
-
const path = props.to || props.href || "";
|
|
54
|
+
const path = unref(props.to) || unref(props.href) || "";
|
|
55
55
|
if (typeof path === "object") {
|
|
56
56
|
return false;
|
|
57
57
|
}
|
|
@@ -59,15 +59,15 @@ export function defineNuxtLink(options) {
|
|
|
59
59
|
});
|
|
60
60
|
const to = computed(() => {
|
|
61
61
|
checkPropConflicts(props, "to", "href");
|
|
62
|
-
const path = props.to || props.href || "";
|
|
62
|
+
const path = unref(props.to) || unref(props.href) || "";
|
|
63
63
|
if (isExternal.value) {
|
|
64
64
|
return path;
|
|
65
65
|
}
|
|
66
|
-
return resolveTrailingSlashBehavior(path, router.resolve, props.trailingSlash);
|
|
66
|
+
return resolveTrailingSlashBehavior(path, router.resolve, unref(props.trailingSlash));
|
|
67
67
|
});
|
|
68
|
-
const link = isExternal.value ? void 0 : useBuiltinLink?.({ ...props, to });
|
|
68
|
+
const link = isExternal.value ? void 0 : useBuiltinLink?.({ ...props, to, viewTransition: unref(props.viewTransition) });
|
|
69
69
|
const href = computed(() => {
|
|
70
|
-
const effectiveTrailingSlash = props.trailingSlash ?? options.trailingSlash;
|
|
70
|
+
const effectiveTrailingSlash = unref(props.trailingSlash) ?? options.trailingSlash;
|
|
71
71
|
if (!to.value || isAbsoluteUrl.value || isHashLinkWithoutHashMode(to.value)) {
|
|
72
72
|
return to.value;
|
|
73
73
|
}
|
|
@@ -92,7 +92,7 @@ export function defineNuxtLink(options) {
|
|
|
92
92
|
isExactActive: link?.isExactActive ?? computed(() => to.value === router.currentRoute.value.path),
|
|
93
93
|
route: link?.route ?? computed(() => router.resolve(to.value)),
|
|
94
94
|
async navigate(_e) {
|
|
95
|
-
await navigateTo(href.value, { replace: props.replace, external: isExternal.value || hasTarget.value });
|
|
95
|
+
await navigateTo(href.value, { replace: unref(props.replace), external: isExternal.value || hasTarget.value });
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
98
|
}
|
|
@@ -214,9 +214,9 @@ export function defineNuxtLink(options) {
|
|
|
214
214
|
const path = typeof to.value === "string" ? to.value : isExternal.value ? resolveRouteObject(to.value) : router.resolve(to.value).fullPath;
|
|
215
215
|
const normalizedPath = isExternal.value ? new URL(path, window.location.href).href : path;
|
|
216
216
|
await Promise.all([
|
|
217
|
-
nuxtApp.hooks.callHook("link:prefetch", normalizedPath)
|
|
217
|
+
nuxtApp.hooks.callHook("link:prefetch", normalizedPath)?.catch(() => {
|
|
218
218
|
}),
|
|
219
|
-
!isExternal.value && !hasTarget.value && preloadRouteComponents(to.value, router).catch(() => {
|
|
219
|
+
!import.meta.dev && !isExternal.value && !hasTarget.value && preloadRouteComponents(to.value, router).catch(() => {
|
|
220
220
|
})
|
|
221
221
|
]);
|
|
222
222
|
}
|
|
@@ -339,12 +339,26 @@ export function defineNuxtLink(options) {
|
|
|
339
339
|
// converts `""` to `null` to prevent the attribute from being added as empty (`href=""`)
|
|
340
340
|
rel,
|
|
341
341
|
target,
|
|
342
|
-
onClick: (event) => {
|
|
342
|
+
onClick: async (event) => {
|
|
343
343
|
if (isExternal.value || hasTarget.value) {
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
346
|
event.preventDefault();
|
|
347
|
-
|
|
347
|
+
try {
|
|
348
|
+
const encodedHref = encodeRoutePath(href.value);
|
|
349
|
+
return await (props.replace ? router.replace(encodedHref) : router.push(encodedHref));
|
|
350
|
+
} finally {
|
|
351
|
+
if (import.meta.client && isHashLinkWithoutHashMode(to.value)) {
|
|
352
|
+
const rawHash = to.value.slice(1);
|
|
353
|
+
let hash = rawHash;
|
|
354
|
+
try {
|
|
355
|
+
hash = decodeURIComponent(rawHash);
|
|
356
|
+
} catch {
|
|
357
|
+
}
|
|
358
|
+
const el2 = document.getElementById(hash);
|
|
359
|
+
el2?.focus();
|
|
360
|
+
}
|
|
361
|
+
}
|
|
348
362
|
}
|
|
349
363
|
}, slots.default?.());
|
|
350
364
|
};
|
|
@@ -44,7 +44,7 @@ const error = useError();
|
|
|
44
44
|
const abortRender = import.meta.server && error.value && !nuxtApp.ssrContext.error;
|
|
45
45
|
const BOT_RE = /bot\b|chrome-lighthouse|facebookexternalhit|google\b/i;
|
|
46
46
|
onErrorCaptured((err, target, info) => {
|
|
47
|
-
nuxtApp.hooks.callHook("vue:error", err, target, info)
|
|
47
|
+
nuxtApp.hooks.callHook("vue:error", err, target, info)?.catch((hookError) => console.error("[nuxt] Error in `vue:error` hook", hookError));
|
|
48
48
|
if (import.meta.client && BOT_RE.test(navigator.userAgent)) {
|
|
49
49
|
nuxtApp.hooks.callHook("app:error", err);
|
|
50
50
|
console.error(`[nuxt] Not rendering error page for bot with user agent \`${navigator.userAgent}\`:`, err);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h } from "vue";
|
|
1
|
+
import { computed, defineComponent, h } from "vue";
|
|
2
2
|
import { useRouteAnnouncer } from "../composables/route-announcer.js";
|
|
3
3
|
export default defineComponent({
|
|
4
4
|
name: "NuxtRouteAnnouncer",
|
|
@@ -14,6 +14,15 @@ export default defineComponent({
|
|
|
14
14
|
},
|
|
15
15
|
setup(props, { slots, expose }) {
|
|
16
16
|
const { set, polite, assertive, message, politeness } = useRouteAnnouncer({ politeness: props.politeness });
|
|
17
|
+
const role = computed(() => {
|
|
18
|
+
if (politeness.value === "assertive") {
|
|
19
|
+
return "alert";
|
|
20
|
+
}
|
|
21
|
+
if (politeness.value === "off") {
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
return "status";
|
|
25
|
+
});
|
|
17
26
|
expose({
|
|
18
27
|
set,
|
|
19
28
|
polite,
|
|
@@ -27,7 +36,7 @@ export default defineComponent({
|
|
|
27
36
|
position: "absolute"
|
|
28
37
|
}
|
|
29
38
|
}, h("span", {
|
|
30
|
-
"role":
|
|
39
|
+
"role": role.value,
|
|
31
40
|
"aria-live": politeness.value,
|
|
32
41
|
"aria-atomic": props.atomic,
|
|
33
42
|
"style": {
|
|
@@ -59,6 +59,9 @@ const formatter = computed(() => {
|
|
|
59
59
|
return new Intl.DateTimeFormat(_locale ?? propsLocale, rest);
|
|
60
60
|
});
|
|
61
61
|
const formattedDate = computed(() => {
|
|
62
|
+
if (isInvalidDate.value) {
|
|
63
|
+
return date.value.toString();
|
|
64
|
+
}
|
|
62
65
|
if (!props.relative) {
|
|
63
66
|
return formatter.value.format(date.value);
|
|
64
67
|
}
|
|
@@ -80,7 +83,8 @@ const formattedDate = computed(() => {
|
|
|
80
83
|
const value = diffInSeconds / seconds;
|
|
81
84
|
return formatter.value.format(Math.round(value), unit);
|
|
82
85
|
});
|
|
83
|
-
const
|
|
86
|
+
const isInvalidDate = computed(() => Number.isNaN(date.value.getTime()));
|
|
87
|
+
const isoDate = computed(() => isInvalidDate.value ? void 0 : date.value.toISOString());
|
|
84
88
|
const title = computed(() => props.title === true ? isoDate.value : typeof props.title === "string" ? props.title : void 0);
|
|
85
89
|
const dataset = {};
|
|
86
90
|
if (import.meta.server) {
|
|
@@ -101,7 +105,14 @@ if (import.meta.server) {
|
|
|
101
105
|
}
|
|
102
106
|
return name;
|
|
103
107
|
};
|
|
104
|
-
const
|
|
108
|
+
const datetime = el2.getAttribute("datetime");
|
|
109
|
+
if (!datetime) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const date2 = new Date(datetime);
|
|
113
|
+
if (Number.isNaN(date2.getTime())) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
105
116
|
const options = {};
|
|
106
117
|
for (const name of el2.getAttributeNames()) {
|
|
107
118
|
if (name.startsWith("data-")) {
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { defineComponent, h } from "vue";
|
|
2
2
|
import { parseQuery } from "vue-router";
|
|
3
3
|
import { resolve } from "pathe";
|
|
4
|
-
import destr from "destr";
|
|
5
4
|
import { devRootDir } from "#build/nuxt.config.mjs";
|
|
6
5
|
export default (url) => defineComponent({
|
|
7
6
|
name: "NuxtTestComponentWrapper",
|
|
8
7
|
inheritAttrs: false,
|
|
9
8
|
async setup(props, { attrs }) {
|
|
10
9
|
const query = parseQuery(new URL(url, "http://localhost").search);
|
|
11
|
-
|
|
10
|
+
let urlProps = {};
|
|
11
|
+
if (query.props) {
|
|
12
|
+
try {
|
|
13
|
+
const parsedProps = JSON.parse(query.props);
|
|
14
|
+
if (parsedProps && typeof parsedProps === "object") {
|
|
15
|
+
urlProps = parsedProps;
|
|
16
|
+
}
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
12
20
|
const path = resolve(query.path);
|
|
13
21
|
if (!path.startsWith(devRootDir)) {
|
|
14
22
|
throw new Error(`[nuxt] Cannot access path outside of project root directory: \`${path}\`.`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RendererNode, VNode } from 'vue';
|
|
1
|
+
import type { RendererNode, TransitionProps, VNode } from 'vue';
|
|
2
2
|
import type { RouteLocationNormalized } from 'vue-router';
|
|
3
3
|
/**
|
|
4
4
|
* Internal utility
|
|
@@ -46,3 +46,9 @@ export declare function getFragmentHTML(element: RendererNode | null, withoutSlo
|
|
|
46
46
|
export declare function elToStaticVNode(el: RendererNode | null, staticNodeFallback?: string): VNode;
|
|
47
47
|
export declare function isStartFragment(element: RendererNode): boolean;
|
|
48
48
|
export declare function isEndFragment(element: RendererNode): boolean;
|
|
49
|
+
export declare function toArray<T>(value: T | T[]): T[];
|
|
50
|
+
/**
|
|
51
|
+
* Internal utility
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
export declare function _mergeTransitionProps(routeProps: TransitionProps[]): TransitionProps;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Transition, createStaticVNode, h } from "vue";
|
|
2
|
+
import { defu } from "defu";
|
|
2
3
|
import { isString, isPromise, isArray, isObject } from "@vue/shared";
|
|
3
4
|
import { START_LOCATION } from "#build/pages";
|
|
4
5
|
export const _wrapInTransition = (props, children) => {
|
|
@@ -124,3 +125,20 @@ export function isStartFragment(element) {
|
|
|
124
125
|
export function isEndFragment(element) {
|
|
125
126
|
return element.nodeName === "#comment" && element.nodeValue === "]";
|
|
126
127
|
}
|
|
128
|
+
export function toArray(value) {
|
|
129
|
+
return Array.isArray(value) ? value : [value];
|
|
130
|
+
}
|
|
131
|
+
export function _mergeTransitionProps(routeProps) {
|
|
132
|
+
const _props = [];
|
|
133
|
+
for (const prop of routeProps) {
|
|
134
|
+
if (!prop) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
_props.push({
|
|
138
|
+
...prop,
|
|
139
|
+
onAfterLeave: prop.onAfterLeave ? toArray(prop.onAfterLeave) : void 0,
|
|
140
|
+
onBeforeLeave: prop.onBeforeLeave ? toArray(prop.onBeforeLeave) : void 0
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return defu(..._props);
|
|
144
|
+
}
|