fix(deps): update dependency vue-router to v4.1.0 #2101

Merged
konrad merged 1 commits from renovate/vue-router-4.x into main 2022-07-04 13:36:47 +00:00
Member

This PR contains the following updates:

Package Type Update Change
vue-router dependencies minor 4.0.16 -> 4.1.0

Release Notes

vuejs/router

v4.1.0

Compare Source

Vue Router 4.1

We are excited to announce the release of Vue Router 4.1 with a few new interesting features, better support for Node ESM and no breaking changes.

Omitting the component/components option in routes

It's now possible to completely omit the component option when defining routes with children. While nested routes are about defining layouts, they are also directly connected to a path and users often found themselves defining a pass through component that would just render a <RouterView> component to reuse the path structure. You can now simplify this to:

- import { RouterView } from 'vue-router'
- import { h } from 'vue'
-
 const routes = [
   {
     path: '/admin',
-     component: () => h(RouterView),
     children: [
       { path: 'users', component: AdminUserList },
       { path: 'users/:id', component: AdminUserDetails },
     ],
   },
 ]

In other words, you can now nest paths without having to define a component.

Passing History State in navigations

Passing History State through router.push() has been implemented and used by the router since its version 4.0 but hasn't been exposed as a public API until now. This enables passing a state property when calling router.push() or router.replace(). This is useful to pass global state to be associated with the history entry that cannot be shared by copying the URL. One common example of this are Modals:

// go to /users/24 but show a modal instead
router.push({ name: 'UserDetail', params: { id: 24 } state: { backgroundView: ... } })

To see a full example, check the modal e2e test, it has been updated to use the state property.

It's worth noting this shouldn't be used to pass fetched data or complex objects such as classes because of type and size limitations. Check the History State documentation for more information about the state property.

Given the nature of the <RouterView>'s route prop, there is also a new function loadRouteLocation() that can be used on a resolved route location to load a route with lazy loading:

import { loadRouteLocation } from 'vue-router'

const loadedRoute = await loadRouteLocation(router.resolve('/users/24'))

Typed Routes

RouterLink to autocomplete

In v4.1 we were initially planning to introduce types to automatically detect the params from a path property, creating autocomplete and type safety in router.push() and <RouterLink>'s to prop. It was implemented but also turned out to be extremely slow after ~50 routes due to the nature of the types relying on nesting and complex unions. Instead, we are introducing a build plugin to generate the types of the routes for you based your file structure. This is similar to Nuxt and Vite Plugin Pages but with full type support (similar to nuxt-typed-router) while allowing you to keep using the exact same API, just with Autocompletion and typing hints 😄. The plugin currently supports Vite, Webpack (with some caveats), and rollup and it's currently experimental to gather feedback from the community and build a flexible solution. We hope to release a stable version in the following months.

Check out the plugin GitHub repository for installation instructions and documentation.

Here are some other examples of how much this plugin can improves your developer experience:

params validation in RouterLink Route infer from if condition Typed routes in navigation guards

CJS/MJS support for Node

We now expose a few extra entry points for Node but kept the old ones as well to prevent any disruption to the existing users. You can find more information about this in the corresponding pull request.


Please refer to CHANGELOG.md for details.


Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by Renovate Bot.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [vue-router](https://github.com/vuejs/router) | dependencies | minor | [`4.0.16` -> `4.1.0`](https://renovatebot.com/diffs/npm/vue-router/4.0.16/4.1.0) | --- ### Release Notes <details> <summary>vuejs/router</summary> ### [`v4.1.0`](https://github.com/vuejs/router/releases/v4.1.0) [Compare Source](https://github.com/vuejs/router/compare/v4.0.16...v4.1.0) ### Vue Router 4.1 We are excited to announce the release of Vue Router 4.1 with a few new interesting features, better support for Node ESM and no breaking changes. #### Omitting the `component`/`components` option in routes It's now possible to completely omit the `component` option when defining routes **with children**. While nested routes are about defining layouts, they are also directly connected to a `path` and users often found themselves defining a *pass through* component that would just render a `<RouterView>` component to reuse the `path` structure. You can now simplify this to: ```diff - import { RouterView } from 'vue-router' - import { h } from 'vue' - const routes = [ { path: '/admin', - component: () => h(RouterView), children: [ { path: 'users', component: AdminUserList }, { path: 'users/:id', component: AdminUserDetails }, ], }, ] ``` In other words, **you can now nest paths without having to define a component**. #### Passing History State in navigations Passing [History State](https://developer.mozilla.org/en-US/docs/Web/API/History/state) through `router.push()` has been implemented and used by the router since its version 4.0 but hasn't been exposed as a public API until now. This enables passing a `state` property when calling `router.push()` or `router.replace()`. This is useful to pass global state to be associated with the history entry that cannot be shared by copying the URL. One common example of this are Modals: ```js // go to /users/24 but show a modal instead router.push({ name: 'UserDetail', params: { id: 24 } state: { backgroundView: ... } }) ``` To see a full example, [check the modal e2e test](https://github.com/vuejs/router/blob/main/packages/router/e2e/modal/index.ts), it has been updated to use the `state` property. It's worth noting this **shouldn't be used to pass fetched data or complex objects such as classes** because of type and size limitations. [Check the History State documentation](https://developer.mozilla.org/en-US/docs/Web/API/History/state) for more information about the `state` property. Given the nature of the `<RouterView>`'s `route` prop, there is also a new function `loadRouteLocation()` that can be used on a *resolved route location* to load a route with lazy loading: ```js import { loadRouteLocation } from 'vue-router' const loadedRoute = await loadRouteLocation(router.resolve('/users/24')) ``` #### Typed Routes ![RouterLink to autocomplete](https://user-images.githubusercontent.com/664177/176442066-c4e7fa31-4f06-4690-a49f-ed0fd880dfca.png) In v4.1 we were initially planning to introduce types to automatically detect the params from a `path` property, creating autocomplete and type safety in `router.push()` and `<RouterLink>`'s `to` prop. It was implemented but also turned out to be **extremely slow** after ~50 routes due to the nature of the types relying on nesting and complex unions. **Instead, we are introducing a build plugin** to generate the types of the routes for you based your **file structure**. This is similar to [Nuxt](https://nuxtjs.org/) and [Vite Plugin Pages](https://github.com/hannoeru/vite-plugin-pages) but with full type support (similar to [nuxt-typed-router](https://github.com/victorgarciaesgi/nuxt-typed-router)) **while allowing you to keep using the exact same API**, just with Autocompletion and typing hints 😄. The plugin currently supports Vite, Webpack (with some caveats), and rollup and **it's currently experimental** to gather feedback from the community and build a flexible solution. We hope to release a stable version in the following months. [Check out the plugin](https://github.com/posva/unplugin-vue-router) GitHub repository for installation instructions and documentation. Here are some other examples of how much this plugin can improves your developer experience: |![params validation in RouterLink](https://user-images.githubusercontent.com/664177/176442076-553811df-6190-472c-a958-914bbd6783db.png)|![Route infer from if condition](https://user-images.githubusercontent.com/664177/176442085-61fc8751-a7b9-489f-ad4f-deb416c60bca.png)|![Typed routes in navigation guards](https://user-images.githubusercontent.com/664177/176442089-b8523642-9cee-4d9f-b1ff-c9f8986fec02.png)| |-|-|-| #### CJS/MJS support for Node We now expose a few extra entry points for Node but kept the old ones as well to prevent any disruption to the existing users. You can find more information about this [in the corresponding pull request](https://github.com/vuejs/router/pull/1157). *** Please refer to [CHANGELOG.md](https://github.com/vuejs/router/blob/main/CHANGELOG.md) for details. </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
renovate added the
dependencies
label 2022-07-04 13:03:05 +00:00
renovate added 1 commit 2022-07-04 13:03:06 +00:00
continuous-integration/drone/pr Build is passing Details
a4ee3f8dbd
fix(deps): update dependency vue-router to v4.1.0
Member

Hi renovate!

Thank you for creating a PR!

I've deployed the changes of this PR on a preview environment under this URL: https://2101-renovate-vue-router-4-x--vikunja-frontend-preview.netlify.app

You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.

Have a nice day!

Beep boop, I'm a bot.

Hi renovate! Thank you for creating a PR! I've deployed the changes of this PR on a preview environment under this URL: https://2101-renovate-vue-router-4-x--vikunja-frontend-preview.netlify.app You can use this url to view the changes live and test them out. You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/. Have a nice day! > Beep boop, I'm a bot.
konrad merged commit 6b4964c5a8 into main 2022-07-04 13:36:47 +00:00
konrad deleted branch renovate/vue-router-4.x 2022-07-04 13:36:47 +00:00
This repo is archived. You cannot comment on pull requests.
No description provided.