diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee65ce3f1..65215dea7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: strategy: matrix: - node: [18.x, lts/*] + node: [20.x, lts/*] os: [ubuntu-latest, windows-latest, macos-latest] fail-fast: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bbdc809a..b7d81a246 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ +# [0.15.0](https://github.com/posva/unplugin-vue-router/compare/v0.14.0...v0.15.0) (2025-08-04) + +### Features + +- remove empty string names from the route map ([45de2b7](https://github.com/posva/unplugin-vue-router/commit/45de2b74692c85f35a2c3fcf25abcb8f437ed7c5)) +- allow removing a route by setting its name to `false` ([d754601](https://github.com/posva/unplugin-vue-router/commit/d754601b694eed4e42c5fbc175b1d74972942407)) +- automatically type `useRoute()` with a volar plugin ([#609](https://github.com/posva/unplugin-vue-router/issues/609)) ([a8a0dcc](https://github.com/posva/unplugin-vue-router/commit/a8a0dcc3f86f4ed8fabf2cc340e3f7bda1729523)) + +# [0.14.0](https://github.com/posva/unplugin-vue-router/compare/v0.13.0...v0.14.0) (2025-06-29) + +### Bug Fixes + +- **data-loaders:** avoid exporting data loaders in runtime ([264f338](https://github.com/posva/unplugin-vue-router/commit/264f3389a66f1a33c6fdb0dc0c4f3ac93bef3017)), closes [#663](https://github.com/posva/unplugin-vue-router/issues/663) +- stable order in children ([d0fc9f3](https://github.com/posva/unplugin-vue-router/commit/d0fc9f313f1b177a2e1d12e0dc7522f7c3afe6ba)), closes [#664](https://github.com/posva/unplugin-vue-router/issues/664) + +### BREAKING CHANGES + +- **data-loaders:** Data loader features must be imported from `unplugin-vue-router/data-loaders`. They were accidentally exposed through runtime but this was never documented. Your IDE might have added auto imports automatically and removing this will avoid future issues. You simply need to replace missing imports. + # [0.13.0](https://github.com/posva/unplugin-vue-router/compare/v0.12.0...v0.13.0) (2025-06-29) ### Features diff --git a/docs/introduction.md b/docs/introduction.md index 9377b8a08..77818bff9 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -172,7 +172,11 @@ If you don't have an `env.d.ts` file, you can create one and add the unplugin-vu ::: warning -unplugin-vue-router will add a virtual `vue-router/auto` module that exports everything from `vue-router` with some extra features from `unplugin-vue-router/runtime` and `unplugin-vue-router/data-loaders`. It's recommended to avoid using `vue-router/auto` in new projects. It's kept for compatibility with existing projects that use it and will likely be removed in the future. +unplugin-vue-router adds a virtual `vue-router/auto` module that exports everything from `vue-router` with some extra features from `unplugin-vue-router/runtime` and `unplugin-vue-router/data-loaders`. + +**DO NOT use `vue-router/auto` in new projects**. + +It's kept for compatibility with existing projects that use it and **will be removed in the near future**. ::: tip You can exclude `vue-router/auto` from VSCode import suggestions by adding this setting to your `.vscode/settings.json`: diff --git a/package.json b/package.json index 089c19223..927bcc336 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "unplugin-vue-router", - "version": "0.13.0", + "version": "0.15.0", "type": "module", - "packageManager": "pnpm@10.12.2", + "packageManager": "pnpm@10.14.0", "description": "File based typed routing for Vue Router", "keywords": [ "unplugin", @@ -77,6 +77,12 @@ "import": "./dist/data-loaders/pinia-colada.js", "require": "./dist/data-loaders/pinia-colada.cjs" }, + "./volar/sfc-route-blocks": { + "require": "./dist/volar/sfc-route-blocks.cjs" + }, + "./volar/sfc-typed-router": { + "require": "./dist/volar/sfc-typed-router.cjs" + }, "./client": { "types": "./client.d.ts" } @@ -133,20 +139,22 @@ ] }, "dependencies": { - "@vue-macros/common": "3.0.0-beta.15", + "@vue-macros/common": "3.0.0-beta.21", + "@vue/language-core": "^3.0.5", "ast-walker-scope": "^0.8.1", "chokidar": "^4.0.3", - "fast-glob": "^3.3.3", "json5": "^2.2.3", "local-pkg": "^1.1.1", "magic-string": "^0.30.17", "mlly": "^1.7.4", + "muggle-string": "^0.4.1", "pathe": "^2.0.3", - "picomatch": "^4.0.2", + "picomatch": "^4.0.3", "scule": "^1.3.0", + "tinyglobby": "^0.2.14", "unplugin": "^2.3.5", - "unplugin-utils": "^0.2.4", - "yaml": "^2.8.0" + "unplugin-utils": "^0.2.5", + "yaml": "^2.8.1" }, "peerDependencies": { "@vue/compiler-sfc": "^3.5.17", @@ -158,48 +166,48 @@ } }, "devDependencies": { - "@babel/types": "^7.27.7", + "@babel/types": "^7.28.2", "@pinia/colada": "^0.17.1", "@posva/prompts": "^2.4.4", - "@shikijs/vitepress-twoslash": "3.7.0", - "@tanstack/vue-query": "^5.81.5", - "@types/node": "^22.15.34", - "@types/picomatch": "^4.0.0", + "@shikijs/vitepress-twoslash": "3.9.2", + "@tanstack/vue-query": "^5.83.1", + "@types/node": "^22.17.1", + "@types/picomatch": "^4.0.2", "@vitest/coverage-v8": "^3.2.4", "@vitest/ui": "^3.2.4", - "@vue/language-core": "^2.2.10", + "@vue/language-core": "^3.0.5", "@vue/test-utils": "^2.4.6", - "chalk": "^5.4.1", + "chalk": "^5.5.0", "conventional-changelog-cli": "^5.0.0", "execa": "^9.6.0", - "firebase": "^11.9.1", + "firebase": "^12.1.0", "happy-dom": "^18.0.1", - "lint-staged": "^16.1.2", + "lint-staged": "^16.1.5", "minimist": "^1.2.8", "nodemon": "^3.1.10", "p-series": "^3.0.0", "pinia": "^3.0.3", "prettier": "^3.6.2", "rimraf": "^6.0.1", - "rollup": "^4.44.1", + "rollup": "^4.46.2", "semver": "^7.7.2", "ts-expect": "^1.3.0", - "tsdown": "^0.12.9", - "typescript": "^5.8.3", - "unplugin-auto-import": "^19.3.0", - "unplugin-vue-markdown": "^28.3.1", + "tsdown": "^0.14.0", + "typescript": "^5.9.2", + "unplugin-auto-import": "^20.0.0", + "unplugin-vue-markdown": "^29.1.0", "unplugin-vue-router": "workspace:*", - "vite": "^6.3.5", + "vite": "^7.1.1", "vite-plugin-vue-devtools": "^7.7.7", - "vitepress": "^1.6.3", - "vitepress-plugin-llms": "^1.6.0", + "vitepress": "^1.6.4", + "vitepress-plugin-llms": "^1.7.2", "vitest": "^3.2.4", - "vue": "^3.5.17", + "vue": "^3.5.18", "vue-router": "^4.5.1", - "vue-router-mock": "^1.1.0", - "vue-tsc": "^2.2.10", - "vuefire": "^3.2.1", - "webpack": "^5.99.9", + "vue-router-mock": "^2.0.0", + "vue-tsc": "^3.0.5", + "vuefire": "^3.2.2", + "webpack": "^5.101.0", "yorkie": "^2.0.0" }, "pnpm": { diff --git a/playground/.gitignore b/playground/.gitignore new file mode 100644 index 000000000..cc1b7f164 --- /dev/null +++ b/playground/.gitignore @@ -0,0 +1 @@ +tsconfig.tsbuildinfo diff --git a/playground/package.json b/playground/package.json index 8eed6a023..d17d8030b 100644 --- a/playground/package.json +++ b/playground/package.json @@ -7,20 +7,19 @@ "build": "vite build" }, "devDependencies": { - "@tanstack/vue-query-devtools": "^5.81.5", - "@vitejs/plugin-vue": "^5.2.4", - "@vue/compiler-sfc": "^3.5.17", + "@tanstack/vue-query-devtools": "^5.84.0", + "@vitejs/plugin-vue": "^6.0.1", + "@vue/compiler-sfc": "^3.5.18", "@vue/tsconfig": "^0.7.0", "json-server": "^0.17.4", "unplugin-vue-router": "workspace:*", - "vite": "^6.3.5", - "vite-plugin-inspect": "^11.3.0" + "vite": "^7.1.1" }, "dependencies": { - "@tanstack/vue-query": "^5.81.5", + "@tanstack/vue-query": "^5.83.1", "mande": "^2.0.9", "pinia": "^3.0.3", - "vue": "^3.5.17", + "vue": "^3.5.18", "vue-router": "^4.5.1" } } diff --git a/playground/src/components/TestSetup.vue b/playground/src/components/TestSetup.vue index ad3528d67..b229476c1 100644 --- a/playground/src/components/TestSetup.vue +++ b/playground/src/components/TestSetup.vue @@ -1,5 +1,9 @@ + + diff --git a/playground/src/pages/(some-layout)/app.vue b/playground/src/pages/(some-layout)/app.vue new file mode 100644 index 000000000..de7a313ea --- /dev/null +++ b/playground/src/pages/(some-layout)/app.vue @@ -0,0 +1,3 @@ + diff --git a/playground/src/pages/(some-layout)/home.vue b/playground/src/pages/(some-layout)/home.vue new file mode 100644 index 000000000..f9db97c7c --- /dev/null +++ b/playground/src/pages/(some-layout)/home.vue @@ -0,0 +1,3 @@ + diff --git a/playground/src/pages/@[profileId].vue b/playground/src/pages/@[profileId].vue index 9237c490d..7127acb56 100644 --- a/playground/src/pages/@[profileId].vue +++ b/playground/src/pages/@[profileId].vue @@ -1,8 +1,9 @@ - + { "props": true } diff --git a/playground/src/pages/[...path].vue b/playground/src/pages/[...path].vue index e8bf8e24e..7efacb197 100644 --- a/playground/src/pages/[...path].vue +++ b/playground/src/pages/[...path].vue @@ -1,13 +1,11 @@ - + { "props": true } diff --git a/playground/src/pages/[name].vue b/playground/src/pages/[name].vue index 1631b08b9..b97b87a80 100644 --- a/playground/src/pages/[name].vue +++ b/playground/src/pages/[name].vue @@ -49,6 +49,7 @@ import { onBeforeRouteUpdate, type RouteLocationNormalized, } from 'vue-router' +import type { RouteNamedMap } from 'vue-router/auto-routes' const thing = 'THING' @@ -90,8 +91,8 @@ if (routeLocation.name === '/[name]') { routeLocation.params.id } -const route = useRoute('/[name]') -const anyRoute = useRoute() +const route = useRoute() +const anyRoute = useRoute() if (anyRoute.name == '/articles/[id]') { console.log('anyRoute.params', anyRoute.params.id) } @@ -133,7 +134,7 @@ definePage({