-
-
Notifications
You must be signed in to change notification settings - Fork 31
fix(types): add export field for plugins #239
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
WalkthroughAdds 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
Sequence Diagram(s)Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
✨ 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. 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 Pre-merge checks✅ Passed checks (3 passed)
|
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 (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
unknownoveranyfor safer extension fields, and add JSDoc forexportto 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
📒 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.
exportis optional,provider/versionremain required, andadditionalPropertiesstays open for plugin‑specific fields. No breaking change expected.packages/core/src/config/types/subPackages.ts (1)
23-24: LGTM; minor gotcha when destructuringexport.Property name
exportis 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.
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