-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
chore(sfc-playground): import vaporInteropPlugin only if Vapor mode is supported #13645
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
Conversation
WalkthroughThe changes update the "@vue/repl" dependency version in the SFC Playground's package.json and modify App.vue to conditionally enable the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App.vue
participant REPL
User->>App.vue: Change Vue version
App.vue->>App.vue: Parse version, set isVaporSupported
App.vue->>REPL: Reload REPL if version changed
App.vue->>REPL: Pass previewOptions (with or without vaporInteropPlugin)
REPL-->>User: Render preview with correct options
Assessment against linked issues
Possibly related PRs
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages-private/sfc-playground/src/App.vue (1)
119-130
: Improve version parsing robustness.The version parsing logic works correctly for the expected format, but consider adding error handling for malformed version strings.
- const [major, minor] = (version || store.compiler.version) - .split('.') - .map((v: string) => parseInt(v, 10)) + const versionString = version || store.compiler.version + const parts = versionString.split('.') + const major = parseInt(parts[0], 10) || 0 + const minor = parseInt(parts[1], 10) || 0 + + if (isNaN(major) || isNaN(minor)) { + console.warn(`Invalid version format: ${versionString}`) + isVaporSupported.value = false + return + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
packages-private/sfc-playground/package.json
(1 hunks)packages-private/sfc-playground/src/App.vue
(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Redirect rules
- GitHub Check: Header rules
- GitHub Check: Pages changed
🔇 Additional comments (4)
packages-private/sfc-playground/package.json (1)
16-16
: Dependency update approved:@vue/repl@^4.6.2
is available with no known security issues.Version 4.6.2 is published on npm, and our audit did not surface any advisories for this package. You can safely proceed with the update.
packages-private/sfc-playground/src/App.vue (3)
5-5
: LGTM: Import addition is correct.The
watch
import is properly added to support the new version watching functionality.
132-145
: LGTM: Preview options logic is well-implemented.The conditional plugin import and usage is correctly implemented:
- Conditionally imports
vaporInteropPlugin
based on Vue version support- Properly applies the plugin to the app when supported
- Maintains backward compatibility with existing custom formatter logic
176-176
: LGTM: Template change is correct.The change from inline options to the computed
previewOptions
property enables dynamic plugin configuration based on Vue version.
"vite": "catalog:" | ||
}, | ||
"dependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Looks good |
close #13622
Summary by CodeRabbit
New Features
Chores