perf: 使用非捕获分组优化 KuRootView 正则的匹配#25
Conversation
WalkthroughUpdated a regex in src/root.ts to use a non-capturing group for matching self-closing or closing root tags. The replacement behavior to "" remains unchanged. No exported/public API changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/root.ts (1)
21-21: Allow optional whitespace before closing tag and make the regex globalrg output shows matches in examples/src/KuRoot.vue:1 and README.md:8 — the current regex misses cases like
<KuRootView>\n</KuRootView>.Use:
const rootTagNameRE = /<(KuRootView|ku-root-view)(?:\s*/>|>\s*</\1>)/g
|
THANK YOU ❤ |
正则改为非捕获组,可能会提升一点点性能
Summary by CodeRabbit