Skip to content

Conversation

@skiyee
Copy link
Member

@skiyee skiyee commented Sep 23, 2025

Description 描述

新增 skiyee/ui 组件的resolver

Linked Issues 关联的 Issues

Additional context 额外上下文

Summary by CodeRabbit

  • New Features
    • Added auto-resolution for Skiyee UI components in Vue projects. Components using the Sk prefix or sk- kebab-case are now automatically detected and loaded, eliminating manual imports. This streamlines integration with the Skiyee UI library, reduces boilerplate, and improves reliability when referencing components by name.

@coderabbitai
Copy link

coderabbitai bot commented Sep 23, 2025

Walkthrough

Introduces a new Vue component resolver module that maps component names with specific prefixes/patterns to kebab-case paths under @skiyee/uni-ui/components/{name}.vue, returning undefined for non-matching names. Exports a default function returning a ComponentResolver.

Changes

Cohort / File(s) Summary
New resolver: Skiyee UI
packages/core/src/_resolvers/skiyee-ui.ts
Adds SkResolver() default export returning a ComponentResolver. resolve handles names matching `/^(Sk[A-Z].*

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App as App (Auto-import)
  participant Resolver as SkResolver
  participant Registry as ComponentRegistry
  participant FS as @skiyee/uni-ui/components

  App->>Resolver: resolve(componentName)
  alt name matches /^((Sk[A-Z].*)|(sk-[a-z].*))$/
    Resolver->>Resolver: convert to kebab-case
    Resolver->>Registry: return path "@skiyee/uni-ui/components/{kebab}.vue"
    Registry->>FS: load {kebab}.vue
    FS-->>Registry: component module
    Registry-->>App: component resolved
  else no match
    Resolver-->>App: undefined
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

New paths hop in, neat and spry,
Sk names drift to kebab sky,
Resolver noses out the trail,
To uni-ui without fail.
I thump my paws—components load!
Another carrot on the code road. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "feat: add skiyee/ui resolver" is concise, uses conventional commit style, and accurately summarizes the primary change (adding a resolver for the skiyee/ui component library), so a reviewer scanning history can understand the main intent.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

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.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
packages/core/src/_resolvers/skiyee-ui.ts (3)

8-16: Tighten the match and simplify control flow.

Use an anchored regex with test() and early return; cover digits/hyphens and avoid partial-prefix matches.

-      if (name.match(/^(?:Sk[A-Z]|sk-[a-z])/)) {
-        let kebabCaseName: string = kebabCase(name)
+      if (!/^(?:Sk[A-Z][A-Za-z0-9]*|sk-[a-z][a-z0-9-]*)$/.test(name)) return
+      const kebabCaseName = kebabCase(name)
 
-        return {
-          name,
-          from: `@skiyee/uni-ui/components/${kebabCaseName}.vue`
-        }
-      }
+      return {
+        name,
+        from: `@skiyee/uni-ui/components/${kebabCaseName}.vue`
+      }

9-9: Prefer const over let for immutables.

kebabCaseName never changes.

-        let kebabCaseName: string = kebabCase(name)
+        const kebabCaseName = kebabCase(name)

4-4: Name the resolver explicitly for clarity.

Consider SkiyeeUiResolver to match other resolver naming conventions.

-export default function SkResolver(): ComponentResolver {
+export default function SkiyeeUiResolver(): ComponentResolver {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01e552e and e7f1bdd.

📒 Files selected for processing (1)
  • packages/core/src/_resolvers/skiyee-ui.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/core/src/_resolvers/skiyee-ui.ts (1)
packages/core/src/types.ts (1)
  • ComponentResolver (41-41)
🔇 Additional comments (1)
packages/core/src/_resolvers/skiyee-ui.ts (1)

11-14: Confirm @skiyee/uni-ui import paths or delegate to official resolver
Hard-coding @skiyee/uni-ui/components/${kebabCaseName}.vue may not match the actual published file layout. Verify the real component paths in @skiyee/uni-ui (or its GitHub repo) or re-export/delegate to @skiyee/ui-resolver to keep up-to-date.

Comment on lines +11 to +14
return {
name,
from: `@skiyee/uni-ui/components/${kebabCaseName}.vue`
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

Consider style side-effects if the library expects per-component CSS.

If components ship styles separately, expose sideEffects to auto-import them (pattern depends on the lib).


🌐 Web query:

Check the skiyee/ui docs for per-component style import paths and whether styles are auto-included or require manual import.

💡 Result:

Short answer: The skiyee UI packages do not appear to auto-inject all component CSS by default — you must import styles yourself (either a global CSS entry or use a helper/resolver). The project has packages for styling and automation: @skiyee/ui-preset (UnoCSS preset) and an @skiyee/ui-resolver (component auto-import resolver) which indicate on-demand/automatic wiring is available via those tools, but core docs/npm README show manual import of the library CSS (e.g. import the package CSS from dist or include a global stylesheet). [1][2][3]

References

  • ski-ui / ski (README showing explicit global CSS import instructions). [1]
  • npm listing for ski-ui (same global-style import examples). [2]
  • @skiyee/ui-resolver and @skiyee/ui-preset package pages (resolver/preset to enable auto-import / UnoCSS-driven styling). [3][4]

Expose per-component CSS via sideEffects in the skiyee resolver.
skiyee UI doesn't auto-inject component CSS; update packages/core/src/_resolvers/skiyee-ui.ts (the resolver return) to include a sideEffects entry that imports the library's per-component style path (or ensure the global/dist stylesheet is imported via the preset/resolver).

🤖 Prompt for AI Agents
In packages/core/src/_resolvers/skiyee-ui.ts around lines 11 to 14, the resolver
return only exposes name and from and does not mark per-component CSS as side
effects; update the returned object to include a sideEffects entry that imports
the component's stylesheet (for example add sideEffects:
[`@skiyee/uni-ui/components/${kebabCaseName}.css`] or the correct library
per-component style path), or alternatively ensure the resolver/preset imports
the library global/dist stylesheet; make the sideEffects value an array so
bundlers include the CSS when the component is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant