Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: volar plugins #609

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

feat: volar plugins #609

wants to merge 17 commits into from

Conversation

Anoesj
Copy link
Contributor

@Anoesj Anoesj commented Mar 19, 2025

  • Moved existing Volar plugin for <route> block IntelliSense into src, added it to the building process and added it to exports
    • explain in the docs how users can enable the plugin (by adding it to vueCompilerOptions.plugins)
  • Added Volar plugin for improved useRoute and $route typings
    • explain in the docs how users can enable the plugin (by adding it to vueCompilerOptions.plugins)
    • add tests
    • update playground examples
    • use relative paths

Future

  • Explore other solutions for structuring types, e.g. like how they do it in SvelteKit
  • Explore adding enhanced typing for <RouterView> slots regarding named views

Copy link

pkg-pr-new bot commented Mar 19, 2025

Open in Stackblitz

npm i https://pkg.pr.new/unplugin-vue-router@609

commit: a5e63cb

Copy link

codecov bot commented Mar 19, 2025

Codecov Report

Attention: Patch coverage is 29.55665% with 143 lines in your changes missing coverage. Please review.

Project coverage is 59.85%. Comparing base (cd4a3f8) to head (a5e63cb).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/volar/entries/sfc-typed-router.ts 0.00% 55 Missing and 1 partial ⚠️
src/volar/entries/sfc-route-blocks.ts 0.00% 49 Missing and 1 partial ⚠️
src/volar/utils/augment-vls-ctx.ts 4.76% 20 Missing ⚠️
src/codegen/generateDTS.ts 0.00% 11 Missing ⚠️
src/core/context.ts 0.00% 4 Missing ⚠️
src/codegen/generateRouteFileInfoMap.ts 96.72% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #609      +/-   ##
==========================================
- Coverage   61.72%   59.85%   -1.87%     
==========================================
  Files          32       36       +4     
  Lines        3135     3333     +198     
  Branches      580      601      +21     
==========================================
+ Hits         1935     1995      +60     
- Misses       1194     1330     +136     
- Partials        6        8       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.


// TODO: Do we want to apply this to EVERY .vue file or only to components that the user wrote themselves?

const relativeFilePath = ctx.compilerOptions.baseUrl
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will ctx.compilerOptions.baseUrl always equal the VueRouter plugin's root? If not, this might not always work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

1 participant