Skip to content

Conversation

@chouchouji
Copy link
Member

@chouchouji chouchouji commented Sep 15, 2025

Description 描述

Linked Issues 关联的 Issues

Additional context 额外上下文

https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/using.html#%E5%AF%BC%E5%87%BA%E5%88%B0%E6%8F%92%E4%BB%B6

Summary by CodeRabbit

  • New Features
    • Added optional export field to plugin configuration in sub-packages, allowing selection of a specific named export when a provider exposes multiple exports.
    • Updated configuration validation to accept the new export field.
    • Backward compatible: existing configurations continue to work without changes.

@coderabbitai
Copy link

coderabbitai bot commented Sep 15, 2025

Walkthrough

Adds an optional export field to plugin entries within SubPackage plugin configurations. Updates TypeScript type definitions and the JSON schema to include export?: string without changing required fields or altering control flow.

Changes

Cohort / File(s) Summary
Type Definitions (SubPackage plugins)
packages/core/src/config/types/subPackages.ts
Adds optional property export?: string to plugin config type within SubPackage.plugins value objects.
Schema Validation (SubPackage plugins)
packages/schema/schema.json
Extends schema for definitions.SubPackage.properties.plugins.items with optional string field export; required fields unchanged.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

size/M

Poem

I twitch my whiskers, tap-tap—approve!
A tiny export hops into the groove.
Types and schemas, now in tune,
Carrots aligned beneath the moon.
With one small field, I bound and cheer—
Ship it swift, the path is clear! 🥕🐇

✨ 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.

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "fix(types): add export field for plugins" succinctly and accurately captures the primary change in the changeset—introducing an optional export?: string on plugin entries and its corresponding JSON schema update (packages/core/src/config/types/subPackages.ts and packages/schema/schema.json); it is concise, specific, and follows a conventional commit-style prefix appropriate for reviewers scanning history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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: 0

🧹 Nitpick comments (2)
packages/schema/schema.json (1)

2843-2845: Document the new field (and optionally constrain values).

Add a short description so downstream docs and editor hovers are clear. Optionally restrict to valid identifiers or "default".

Apply this diff to add a description:

-              "export": {
-                "type": "string"
-              }
+              "export": {
+                "type": "string",
+                "description": "Named export to use from the plugin entry module (e.g., 'default' or a specific export name)."
+              }

Optional: add a pattern such as ^(default|[A-Za-z_$][A-Za-z0-9_$]*)$ if you want to enforce identifier-like values.

packages/core/src/config/types/subPackages.ts (1)

17-27: Tighten index signature and document the new field.

Consider unknown over any for safer extension fields, and add JSDoc for export to mirror the schema description.

Apply this diff:

     [pluginName: string]: {
       version: string

       provider: string

-      export?: string
+      /**
+       * Named export to use from the plugin entry module (e.g., 'default' or a specific export name).
+       */
+      export?: string

-      [key: string]: any
+      [key: string]: unknown
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e43a37 and 255265b.

📒 Files selected for processing (2)
  • packages/core/src/config/types/subPackages.ts (1 hunks)
  • packages/schema/schema.json (1 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). (1)
  • GitHub Check: test (macos-latest, 20)
🔇 Additional comments (2)
packages/schema/schema.json (1)

2835-2852: LGTM: schema change is additive and aligned with TS.

export is optional, provider/version remain required, and additionalProperties stays open for plugin‑specific fields. No breaking change expected.

packages/core/src/config/types/subPackages.ts (1)

23-24: LGTM; minor gotcha when destructuring export.

Property name export is fine in types and member access (obj.export), but destructuring needs an alias: const { export: pluginExport } = cfg.

Please sanity‑check any existing destructuring of plugin objects to avoid const { export } = ... which is invalid.

@FliPPeDround FliPPeDround merged commit aeef348 into uni-helper:main Sep 16, 2025
4 checks passed
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.

2 participants