fix: missing closing quote in generated import#2688
Conversation
✅ Deploy Preview for vue-router canceled.
|
There was a problem hiding this comment.
Pull request overview
Fixes a malformed import emitted by the DTS code generator that could break builds when a generated *.d.ts file is present (per #2687).
Changes:
- Fix the missing closing quote in the generated
import type { ... } from 'vue-router/experimental'statement. - Update the committed playground-generated
routes.d.tsto reflect the corrected output.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/router/src/unplugin/codegen/generateDTS.ts | Fixes the template output so the generated experimental import path is properly quoted. |
| packages/playground-file-based/src/routes.d.ts | Updates the generated DTS artifact to match the corrected generator output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import type { | ||
| _ExtractParamParserType, | ||
| } from 'vue-router/experimental | ||
| } from 'vue-router/experimental' |
📝 WalkthroughWalkthroughTwo malformed type-only import statements referencing Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Covers the full DTS output so template-string regressions like the missing closing quote on the `from 'vue-router/experimental'` import fail the snapshot.
posva
left a comment
There was a problem hiding this comment.
Thanks! I will add a regression test and publish fast
commit: |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/router/src/unplugin/codegen/generateDTS.spec.ts (1)
5-75: Consider adding a case with non-empty param parsers.This snapshot nicely guards against the missing-quote regression on the
'vue-router/experimental'import. As a follow-up, consider an additionalit(...)exercising a non-emptyparamsTypesDeclarationandcustomParamsTypeListso theTypesConfig.ParamParsersbranch and the "Custom route params parsers" block are also snapshot-protected — right now lines 37-39 show an emptyParamParsers:followed by a blank line, which isn't a very meaningful assertion for that code path.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/router/src/unplugin/codegen/generateDTS.spec.ts` around lines 5 - 75, The current test only covers the empty params case; add a second it(...) in generateDTS.spec.ts that calls generateDTS with a non-empty paramsTypesDeclaration and a non-empty customParamsTypeList so the TypesConfig.ParamParsers branch and the "Custom route params parsers" block are exercised; specifically, call generateDTS with paramsTypesDeclaration set to a small type declaration string and customParamsTypeList containing at least one entry, then snapshot the output to ensure the generated TypesConfig.ParamParsers and the custom parsers section are present and correctly formatted (this targets the generateDTS function and its handling of paramsTypesDeclaration and customParamsTypeList).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/router/src/unplugin/codegen/generateDTS.spec.ts`:
- Around line 5-75: The current test only covers the empty params case; add a
second it(...) in generateDTS.spec.ts that calls generateDTS with a non-empty
paramsTypesDeclaration and a non-empty customParamsTypeList so the
TypesConfig.ParamParsers branch and the "Custom route params parsers" block are
exercised; specifically, call generateDTS with paramsTypesDeclaration set to a
small type declaration string and customParamsTypeList containing at least one
entry, then snapshot the output to ensure the generated TypesConfig.ParamParsers
and the custom parsers section are present and correctly formatted (this targets
the generateDTS function and its handling of paramsTypesDeclaration and
customParamsTypeList).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9b505b06-5061-4a05-8e60-219a3de32c5b
📒 Files selected for processing (1)
packages/router/src/unplugin/codegen/generateDTS.spec.ts
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2688 +/- ##
==========================================
+ Coverage 85.65% 85.91% +0.26%
==========================================
Files 88 88
Lines 10071 10071
Branches 2307 2311 +4
==========================================
+ Hits 8626 8653 +27
+ Misses 1433 1407 -26
+ Partials 12 11 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Closes #2687
Summary by CodeRabbit