posva / unplugin-vue-router

Next Generation file based typed routing for Vue Router
https://uvr.esm.is
MIT License
1.69k stars 82 forks source link

feat(extendRoutes): allow relative path overrides #519

Open robertmoura opened 1 month ago

robertmoura commented 1 month ago

BREAKING CHANGE: allow relative path overrides

Closes https://github.com/posva/unplugin-vue-router/issues/341

Includes changes from https://github.com/posva/unplugin-vue-router/pull/431

Description

Relative paths in definePage and route block

Relative paths are converted to absolute paths. Here is an example:

src/pages/
├─ custom-root.vue
├─ layout.vue
└─ layout/
    └─ empty-folder/
        └─ custom-child.vue

custom-root.vue

// Absolute path is '/i-am-custom'
definePage({
    path: 'i-am-custom',
});

custom-child.vue

// Absolute path is '/layout/i-am-custom'
definePage({
    path: 'i-am-custom',
});
codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 64.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 68.15%. Comparing base (5741b2a) to head (a930a2d).

Files with missing lines Patch % Lines
src/core/context.ts 35.71% 9 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #519 +/- ## ========================================== + Coverage 67.56% 68.15% +0.59% ========================================== Files 31 31 Lines 3074 3084 +10 Branches 601 611 +10 ========================================== + Hits 2077 2102 +25 + Misses 991 976 -15 Partials 6 6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.