0.10.8 (2024-09-08)
- loaders: allow errors as a function (df80b28)
- loaders: allow plain value in colada loader key (646e5bf)
- loaders: avoid warning during ssr (99d7b0b)
- loaders: warn incorrect query usage (e43c5f5)
0.10.7 (2024-08-17)
- loaders: reset context in ssr scenarios (4ea4b8c)
0.10.6 (2024-08-15)
- loaders: remove default value for experimental (8773c96)
0.10.5 (2024-08-15)
- loaders: change experimental option to match only specific folders (f01cddd)
0.10.4 (2024-08-14)
- experimental auto export of data loaders (16af831)
0.10.3 (2024-08-12)
- upgrade to @pinia/colada 0.8.0 (c372b14)
0.10.2 (2024-07-30)
0.10.1 (2024-07-22)
0.10.0 (2024-06-21)
- types: use native vue-router types (5c1b6c3)
- allow imported values in definePage (a113a2d), closes #317
- handle hmr for pages (4925e7e), closes #292 #404
- hmr: reload if cannot update (6044b94)
- make
definePage()
globally available (7a57597) - support TS in definePage (4fbff23), closes #57 #238
This version requires vue-router@4.4.0 or higher. The unplugin-vue-router/types
no longer export all of the generic types from vue-router
. Instead, import them directly from vue-router
.
0.9.1 (2024-06-07)
0.9.0 (2024-05-28)
- move extension handling outside of tree (85d8472), closes #400
- remove wrong error log during HMR (c511082)
- require explicit
routes
import to avoid cyclic imports (63788f6), closes #132
- pkg: migrate package to type=module (f1e4ca5)
createRouter()
now requires the explicitrouter
property to be set and imported:
import { createRouter, createWebHistory } from 'vue-router/auto'
+import { routes } from 'vue-router/auto-routes'
createRouter({
history: createWebHistory(),
+ routes
})
This also means that runtime extendRoutes()
option is not needed. It
has been deprecated and will be removed in the next major release.
Tree
andPrefixTree
insert method expects a path without the file extension. They also expect the fullpath of the file as a second argument (it used to be optional). This aligns better with their responsibility as they shouldn't be trimming the extension like they used to.
// replace
tree.insert('file.vue')
// with
tree.insert('file', resolve('file.vue'))
This shouldn't affect most users as the Tree implementation is used internally to represent the folder structure.
- pkg: The package is now of
"type": "module"
. It shouldn't break anything for users but this is just in case, we all know how fragile this js ecosystem is sometimes...
0.8.8 (2024-05-22)
- watch all extensions not just root (74ac22b)
0.8.7 (2024-05-20)
- apply definePage in named pages (bd7d5b1), closes #383
- correctly trim extensions from routesFolder (b8a9473), closes #274
- add an option to disable file watching (#387) (13f93fc)
- add component alias to EditableTreeNode (fc8ae27)
0.8.6 (2024-04-12)
- data-loaders: tracked properties with an object in key (58aa516)
0.8.5 (2024-03-14)
0.8.4 (2024-02-24)
This patch contains the necessary fixes to allow importing the data loaders. However, they cannot be imported from vue-router/auto
nor from unplugin-vue-router/runtime
. Instead, they should be imported from unplugin-vue-router/data-loaders/...
. This is needed as some of the loaders depends on extra packages that not all users have installed. At the moment, there are two data loaders
unplugin-vue-router/data-loaders/basic
: https://uvr.esm.is/data-loaders/basic/unplugin-vue-router/data-loaders/pinia-colada
: https://uvr.esm.is/data-loaders/colada/
- allow untyped router with data loaders (51f7d55)
- build: externalize libs (e55d735)
- remove the need to install @pinia/colada (8d45669)
- types: externalize uvr/types (ee9a2a3), closes #322
0.8.3 (2024-02-22)
0.8.2 (2024-02-22)
0.8.1 (2024-02-22)
- upgrade peer dep on vue-router to 4.3.0 (746ad8f)
0.8.0 (2024-02-22)
Based on the feedback of the RFC, the Data Loaders have been redesigned from the ground up and are now way more flexible and powerful. As a result, if you were using the experimental data loaders, make sure to check the list of breaking changes and the new RFC at https://uvr.esm.is/rfcs/data-loaders. We are looking for early testers and feedback!
For people using the file-based routing, you now need to add unplugin-vue-router/client
to the types
property of your tsconfig. See setup for an example.
- allow errors outside of navigation (ae37a8e)
- avoid uncatchable rejection (fa0c794)
- delay setting the error (3d341ae)
- discard loads from canceled navigations (aac66c1), closes posva/unplugin-vue-router#200
- router.push types (98cb17b)
- run nested loaders once when used across places (73a6cc5)
- types: correct types in navigation guards (3f01155)
- types: correctly extend client (d226cf9)
- types: remove null from non raw star param (0b71ad5)
- types: restrict what can be imported from the package (8748644), closes #289
- types: use
vue-router/auto-routes
(2dc0446) - use single alias for reused components on different paths (1544363)
- rename
pending
toisLoading
(9502751) - refactor!: remove deprecated APIs (0415b9e)
- refactor(data-loaders)!: rewrite of data loaders (f0b7b58)
- refactor!: remove
setupLoaderGuard
(8094f62)
- add pinia colada properties (63a768f)
- commit option (56b2a4d), closes posva/unplugin-vue-router#201
- data-fetching: add server option (d4d2f46)
- data-loaders: abort the signal for old pending locations (afabb47)
- data-loaders: add abort signal to navigation (a175fa7)
- data-loaders: allow changing the navigation result (7a7da74)
- data-loaders: pass the signal to the loader (85d0494)
- handle thrown errors (2e38544)
- inject in nested loaders (b0aa0b3)
- loaders: thrown navigation results take precedence (2aaaf56)
- return a promise of data only (d2dda40)
- run loaders with access to global inject and provide (9d95e27)
- track used params (b2ae763)
- compute params once (322f220)
- use a shallowRef for data (aae0c70)
- use for of instead of forEach (1635745)
-
Remove the deprecated APIs:
-
createPrefixTree()
->new PrefixTree()
-
VueRouterExports
->VueRouterAutoImports
-
Data Loaders have been redesigned to be more flexible and account for other libraries. Notably, the caching behavior has been moved out of the basic loader to an extended one pinia-colada and the basic loader has no cache. All of the pending bugs have also been fixed. I recommend you to give the RFC examples a new read to get setup: https://uvr.esm.is/data-loaders/rfc. Most of the changes are simplifying things by removing them. Here is a list of the breaking changes to simplify migration:
- The
dataFetching
option is no longer needed. - Manual work needed to add loaders with
HasDataLoaderMeta
has been removed. It is just no longer needed. Loaders are picked up from lazy loaded components and must otherwise be directly added to ameta.loaders
array. See the example at https://uvr.esm.is/data-loaders/rfc.html#basic-example - The function
setupDataFetchingGuard
has been replaced with a Vue Plugin. See https://uvr.esm.is/data-loaders/rfc.html#data-loader-setup for details. - If you were relying on
cacheTime
, use thestaleTime
option in the newdefineColadaLoader()
based off @pinia/colada - To reduce the dependency on file-based router, things have been
refactored and none of the defineLoader functions are automatically
imported anymore. You can add them yourself to the list of auto
imports, or import them from
unplugin-vue-router/data-loaders/...
. The good news is you no longer need to use the plugin in order to benefit from the data loaders; they can be imported even if you don't want file-based routing.
If you find missing information or improvements, please open a Pull Request to improve the
CHANGELOG.md
.- The navigation guard is replaced in favor of a Vue plugin:
Replace
import { setupLoaderGuard } from 'vue-router/auto' setupLoaderGuard({ router, app })
with
import { DataLoaderPlugin } from 'vue-router/auto' app.use(DataLoaderPlugin, { router })
vue-router/auto/routes
becomesvue-router/auto-routes
. This change was necessary to improve compatibility with TypeScript and other tools in the ecosystem. Most of the time you don't need to use this path but if you were using it, replace it:
- import { } from 'vue-router/auto/routes' + import { } from 'vue-router/auto-routes'
-
Data Loaders now return an
isLoading
property instead ofpending
. This aligns better with the wording of Data Loaders being in a loading state rather than pending, which can have more meanings. -
You know need to add
unplugin-vue-router/client
to thetypes
property of your tsconfig. See setup for an example. This file contains the augmentation of thevue-router/auto
module that was previously intyped-router.d.ts
. You also need to set themodeResolution
toBundler
in yourtsconfig.json
. -
the existing
defineLoader
is being replaced by a basic loader without cache. The version with cache will be implemented by adding a library that properly handles the caching. This new strategy will also enable other integrations like VueFire, Apollo, and custom ones. Keep an eye (subscribe) to the RFC for news and to discus about the future of Data Loaders: vuejs/rfcs#460 -
since data loaders aren't meant to be awaited in script setup (they are awaited at the navigation level), they now return a promise of the raw data only, not of the UseDataLoaderReturn, to make it clearer that this syntax is a bit special and should only be used within nested loaders. This change also brings other benefits like allowing lazy loaders to be awaited within loaders without changing their usage outside, in components. Also, allowing different types of commit while still allowing data to be awaited within loaders.
- The
0.7.0 (2023-09-22)
- allow overriding and extending folder options (1f6e312)
- correctly ignore folders (cbd14b9)
- keep parent override in children (f651961), closes #189
- allow path as function (b913f56)
exclude
is no longer relative toroutesFolder.src
but to the cwd. like other paths. Note this is technically a fix that should simplify your configuration.
0.6.4 (2023-05-09)
0.6.3 (2023-05-02)
- handle empty regexp in raw routes (9bea452)
0.6.2 (2023-05-01)
- options: dotNesting (b7abc9b)
0.6.1 (2023-05-01)
- types: correct exports in new files (e9056f7)
0.6.0 (2023-05-01)
- allow inserting raw routes in the editable tree node (c04d068)
- dotNesting option to disable dot special handling in filenames (d803831)
- types: expose RouterLinkProps typed (04031b4)
0.5.5 (2023-04-18)
- no missing imports (65f8c83)
- remove old option (7368185)
- split types from index to avoid types pollution (4026948), closes #136
- types: skip postbuild fix on types (d54a9b7)
0.5.4 (2023-03-02)
- allow exclude per folder (468b251)
0.5.3 (2023-03-02)
- feat!: rename filePattern to filePatterns and allow arrays (8902778)
filePattern
is now namedfilePatterns
because it allows arrays. This is only a naming change.
0.5.2 (2023-03-02)
- allow overriding the file pattern (96febf1)
0.5.1 (2023-03-01)
0.5.0 (2023-02-16)
- feat!: allow set operations on meta (a84d659)
- types: improve routeBlockLang (19bd892)
- if you were setting directly
route.meta
withinextendRoute()
, you know need to useroute.addToMeta()
instead to have the same merging behavior. Directly settingroute.meta
now replaces themeta
property completely.
0.4.1 (2023-02-16)
- webpack: handle loadInclude (9a43b63)
0.4.0 (2023-02-16)
-
handle insertions with leading slash in extendRoute (d1287b8)
-
feat!: rename EditableTreeNode
files
tocomponents
(5c359c9)
- add internal name in virtual files as comments (326156d)
- allow changing the path in extendRoute (a9d0c77)
- the property
files
inEditableTreeNode
(e.g. withinextendRoute
) is now namedcomponents
to match the route record name.
0.3.3 (2023-02-15)
🙌 This version introduces the ability to extend the routes with the extendRoutes
option. Please refer to the relevant issue for use cases and share any problems you might have.
- runtime: merge aliases (73bacd9)
- beforeWriteFiles (cc12c24)
- extendRoute (ff0195f)
- warn: improve invalid lang warn for route block (5c8c7df)
- warn: missing dots in extensions (18f30a1), closes #117
- wip extendroutes (627f417)
0.3.2 (2023-01-09)
0.3.1 (2023-01-08)
- parse non modules with definePage (ce70048), closes #114
- stricter extension check (f5f508a)
- work with files named definePage (178107b)
0.3.0 (2023-01-03)
0.2.3 (2022-10-05)
- merge route record (f1e7c8b)
0.2.2 (2022-09-30)
- types: for auto import (49ffe81)
- types: remove trailing slash in path for nested routes (f0cfb36), closes #70
0.2.1 (2022-08-27)
0.2.0 (2022-08-26)
Refer to https://github.com/posva/unplugin-vue-router/tree/main/src/data-fetching for up to date information on how to use the data fetching.
- add setupNavigationGuard options (0656e35)
- explicitly allow for the data fetching guard (5f672b2)
- importMode option (9aa2e33), closes #47
- one single auto import (c82e964)
- parse definePage (b2470a6)
- support props to route blocks (073c29c), closes #49
0.1.2 (2022-08-10)
- ssr: support SSR (5578f7d)
0.1.1 (2022-08-09)
- types: declaration of auto module (e5ac67c)
0.1.0 (2022-08-09)
- deep merge meta properties (47bce4f)
- expose options subpath (#42) (b44c32e)
- handle nested loaders that were already called (6887fb2)
- reload the page during dev when no cache entry is available (918bfd0)
- support older browsers with object.assign (66c7ae0)
- trigger loaders only once when nested (4a13819)
- rename
[@vue-router](https://github.com/vue-router)
tovue-router/auto
(461530a)
- add basic data loaders (9c19fd2)
- add lazy loaders (815f875)
- add pendingLoad (055bc3c)
- allow enabling experimental data fetching (1b7e6b3)
- change default route component folder to
src/pages
(6d6cb13) - implement nested sequential loaders (6d5201f)
- track hash reads (e5583a4)
-
the module name is now
vue-router/auto
instead of@vue-router
. To upgrade to this version you only need to replace it:-import { ... } from '@vue-router' +import { ... } from 'vue-router/auto' -import { ... } from '@vue-router/routes' +import { ... } from 'vue-router/auto/routes'
This allows stubbing the package in
vue-router
to hint the user towards this plugin. -
the default value of
routesFolder
is changed fromsrc/routes
tosrc/pages
. If you didn't change this setting, you will have to either:- rename your
src/routes
folder tosrc/pages
- add
routesFolder: 'src/routes'
to the options of the plugin in your vite, webpack, etc config
- rename your
0.0.21 (2022-07-12)
0.0.20 (2022-07-07)
- correct arg for useLink (afdf147)
0.0.19 (2022-07-07)
0.0.18 (2022-07-07)
0.0.17 (2022-07-06)
0.0.16 (2022-07-06)
0.0.15 (2022-07-05)
0.0.14 (2022-07-05)
- handle updates of routes (1a9a028)
0.0.13 (2022-07-05)
0.0.12 (2022-07-04)
0.0.11 (2022-07-04)
Adapt peer vue router per dep to 4.1.0
.
0.0.10 (2022-07-04)
- add route json schema (c5480e1)
- parse route custom block (963d1ca)
- vite: reload when routes change (0231679)
0.0.9 (2022-07-01)
0.0.8 (2022-06-29)
- correctly extendRoutes (e8d22a2)
- handle static unnested paths (56b73d7)
- stable order of paths (59d743a)
0.0.7 (2022-06-28)
- stable order of paths (59d743a)
- allow extending routes with extendRoutes (da4db97)
- keep one component if possible (efe20e2)
- named view support (#6) (a46dcd2)
0.0.6 (2022-06-27)
- small fixes
0.0.5 (2022-06-27)
- handle unnested routes (f52304d)
0.0.4 (2022-06-24)
- use virtual modules for @vue-router (74cb353)
0.0.3 (2022-06-24)
- correct module id (eb4ee83)
0.0.1 (2022-06-24)
- setup chokidar watcher (15f217f)