refactor: replace getPluginApi with getMetaApi#634
refactor: replace getPluginApi with getMetaApi#634chilingling merged 4 commits intoopentiny:refactor/developfrom
Conversation
WalkthroughThe recent changes across multiple Vue files in the project involve a significant refactor of how APIs are accessed. Specifically, the update replaces Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Actionable comments posted: 3
Outside diff range and nitpick comments (2)
packages/layout/src/DesignToolbars.vue (1)
Line range hint
1-1:
Import getMetaApi and META_APPThe import statement for
getMetaApiandMETA_APPis missing in the provided code. Ensure that these imports are correctly added.+ import { getMetaApi, META_APP } from '@opentiny/tiny-engine-meta-register'packages/settings/events/src/components/BindEvents.vue (1)
124-124: Remove unusedhighlightMethodfromgetMetaApiIf
highlightMethodis not used elsewhere in the file, consider removing it to keep the code clean.- const { highlightMethod } = getMetaApi(META_APP.Page)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (27)
- packages/canvas/DesignCanvas/src/DesignCanvas.vue (1 hunks)
- packages/common/component/BlockDeployDialog.vue (3 hunks)
- packages/common/component/ProgressBar.vue (1 hunks)
- packages/configurator/src/variable-configurator/VariableConfigurator.vue (2 hunks)
- packages/layout/src/DesignPlugins.vue (1 hunks)
- packages/layout/src/DesignToolbars.vue (2 hunks)
- packages/layout/src/composable/useLayout.js (6 hunks)
- packages/plugins/block/index.js (1 hunks)
- packages/plugins/block/src/composable/useBlock.js (2 hunks)
- packages/plugins/data/src/Main.vue (2 hunks)
- packages/plugins/materials/index.js (1 hunks)
- packages/plugins/materials/src/composable/useResource.js (3 hunks)
- packages/plugins/page/index.js (1 hunks)
- packages/plugins/script/index.js (1 hunks)
- packages/plugins/tutorial/index.js (1 hunks)
- packages/plugins/tutorial/src/Main.vue (2 hunks)
- packages/register/src/constants.js (1 hunks)
- packages/register/src/index.js (1 hunks)
- packages/settings/events/src/components/BindEvents.vue (3 hunks)
- packages/settings/events/src/components/BindEventsDialog.vue (3 hunks)
- packages/settings/events/src/components/BindEventsDialogContent.vue (2 hunks)
- packages/settings/events/src/components/BindEventsDialogSidebar.vue (2 hunks)
- packages/toolbars/generate-vue/src/Main.vue (2 hunks)
- packages/toolbars/lock/index.js (1 hunks)
- packages/toolbars/lock/src/Main.vue (1 hunks)
- packages/toolbars/save/index.js (1 hunks)
- packages/toolbars/save/src/js/index.js (3 hunks)
Files skipped from review due to trivial changes (7)
- packages/canvas/DesignCanvas/src/DesignCanvas.vue
- packages/plugins/block/index.js
- packages/plugins/materials/index.js
- packages/plugins/page/index.js
- packages/register/src/index.js
- packages/toolbars/lock/index.js
- packages/toolbars/lock/src/Main.vue
Additional comments not posted (33)
packages/common/component/ProgressBar.vue (2)
17-17: LGTM!The import statement change aligns with the new API access pattern.
24-26: LGTM!The setup function change aligns with the new API access pattern and appears correct.
packages/register/src/constants.js (2)
1-18: Constants Addition: META_SERVICEThe
META_SERVICEobject defines various service keys. The naming and values appear consistent with the existing pattern.
20-57: Constants Addition: META_APPThe
META_APPobject defines various application keys. The naming and values appear consistent with the existing pattern.packages/layout/src/composable/useLayout.js (2)
15-15: Import META_APP and getMetaApiThe import statement correctly brings in
META_APPandgetMetaApifrom@opentiny/tiny-engine-meta-register.
75-75: Update activePlugin to use getMetaApiThe
activePluginfunction now usesgetMetaApito resolve the API for the given plugin name. This aligns with the refactoring objective.packages/settings/events/src/components/BindEventsDialogSidebar.vue (2)
21-21: Import getMetaApi and META_APPThe import statement correctly brings in
getMetaApiandMETA_APPfrom@opentiny/tiny-engine-meta-register.
39-39: Update setup function to use getMetaApiThe setup function now uses
getMetaApito get thegetMethodNameListmethod fromMETA_APP.Page. This aligns with the refactoring objective.packages/toolbars/save/src/js/index.js (3)
14-22: Import changes look good.The import statements have been correctly updated to include
getMetaApiandMETA_APP.
41-41: API usage update insaveBlocklooks good.The
saveBlockfunction has been updated to usegetMetaApiwithMETA_APP.BlockManage.
127-132: API usage update inopenCommonlooks good.The
openCommonfunction has been updated to usegetMetaApiwithMETA_APP.BlockManageandMETA_APP.AppManage.packages/plugins/tutorial/src/Main.vue (2)
46-46: Import changes look good.The import statements have been correctly updated to include
getMetaApiandMETA_APP.
107-113: API usage update inopenVideoPanellooks good.The
openVideoPanelfunction has been updated to usegetMetaApiwithMETA_APP.Tutorial.packages/plugins/materials/src/composable/useResource.js (3)
25-27: Import changes look good.The import statements have been correctly updated to include
getMetaApiandMETA_APP.
72-72: API usage update ininitBlocklooks good.The
initBlockfunction has been updated to usegetMetaApiwithMETA_APP.BlockManage.
90-90: API usage update ininitPageOrBlocklooks good.The
initPageOrBlockfunction has been updated to usegetMetaApiwithMETA_APP.AppManage.packages/settings/events/src/components/BindEventsDialogContent.vue (2)
56-56: Import changes look good.The import statements have been correctly updated to include
getMetaApiandMETA_APP.
74-74: API usage update insetuplooks good.The
setupfunction has been updated to usegetMetaApiwithMETA_APP.Page.packages/settings/events/src/components/BindEventsDialog.vue (2)
25-31: Import statement changes are consistent.The import statements have been updated to include
getMetaApiandMETA_APP, aligning with the PR objectives.
63-65: API usage changes are consistent.The API usage has been updated to replace
getPluginApiwithgetMetaApi, aligning with the new import statements.packages/common/component/BlockDeployDialog.vue (2)
84-84: Import statement changes are consistent.The import statements have been updated to include
getMetaApiandMETA_APP, aligning with the PR objectives.
Line range hint
155-176:
API usage changes are consistent.The API usage has been updated to replace
getPluginApiwithgetMetaApi, aligning with the new import statements.packages/toolbars/generate-vue/src/Main.vue (2)
26-34: Import statement changes are consistent.The import statements have been updated to include
getMetaApiandMETA_APP, aligning with the PR objectives.
100-100: API usage changes are consistent.The API usage has been updated to replace
getPluginApiwithgetMetaApi, aligning with the new import statements.packages/layout/src/DesignPlugins.vue (1)
108-108: API usage changes are consistent.The removal of
registerPluginApiand the iteration overprops.pluginsaligns with the PR objectives and does not introduce any issues.packages/settings/events/src/components/BindEvents.vue (2)
91-98: ImportgetMetaApiandMETA_APPThe new imports
getMetaApiandMETA_APPare correctly added from@opentiny/tiny-engine-meta-register.
223-226: Update API usage togetMetaApiThe API usage has been correctly updated to use
getMetaApiinstead ofgetPluginApioruseLayout.packages/plugins/data/src/Main.vue (2)
78-80: ImportgetMetaApiandMETA_APPThe new imports
getMetaApiandMETA_APPare correctly added from@opentiny/tiny-engine-meta-register.
117-117: Update API usage togetMetaApiThe API usage has been correctly updated to use
getMetaApiinstead ofgetPluginApioruseLayout.packages/plugins/block/src/composable/useBlock.js (2)
23-31: ImportgetMetaApiandMETA_APPThe new imports
getMetaApiandMETA_APPare correctly added from@opentiny/tiny-engine-meta-register.
Line range hint
484-496: Update API usage togetMetaApiThe API usage has been correctly updated to use
getMetaApiinstead ofgetPluginApioruseLayout. Ensure thatgetMethodsreturns the expected methods.packages/configurator/src/variable-configurator/VariableConfigurator.vue (2)
124-131: ImportgetMetaApiandMETA_APPThe new imports
getMetaApiandMETA_APPare correctly added from@opentiny/tiny-engine-meta-register.
470-472: Update API usage togetMetaApiThe API usage has been correctly updated to use
getMetaApiinstead ofgetPluginApioruseLayout. Ensure thatgetMethodsreturns the expected methods.
32a0807 to
6f4b74a
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (23)
- packages/canvas/DesignCanvas/src/DesignCanvas.vue (1 hunks)
- packages/common/component/BlockDeployDialog.vue (3 hunks)
- packages/common/component/ProgressBar.vue (1 hunks)
- packages/configurator/src/variable-configurator/VariableConfigurator.vue (2 hunks)
- packages/layout/src/DesignPlugins.vue (1 hunks)
- packages/layout/src/DesignToolbars.vue (2 hunks)
- packages/layout/src/composable/useLayout.js (6 hunks)
- packages/plugins/block/index.js (1 hunks)
- packages/plugins/block/src/composable/useBlock.js (2 hunks)
- packages/plugins/data/src/Main.vue (2 hunks)
- packages/plugins/materials/index.js (1 hunks)
- packages/plugins/materials/src/composable/useResource.js (3 hunks)
- packages/plugins/page/index.js (1 hunks)
- packages/plugins/script/index.js (1 hunks)
- packages/plugins/tutorial/index.js (1 hunks)
- packages/plugins/tutorial/src/Main.vue (2 hunks)
- packages/settings/events/src/components/BindEvents.vue (3 hunks)
- packages/settings/events/src/components/BindEventsDialog.vue (3 hunks)
- packages/settings/events/src/components/BindEventsDialogContent.vue (2 hunks)
- packages/settings/events/src/components/BindEventsDialogSidebar.vue (2 hunks)
- packages/toolbars/generate-vue/src/Main.vue (2 hunks)
- packages/toolbars/save/index.js (1 hunks)
- packages/toolbars/save/src/js/index.js (3 hunks)
Files skipped from review due to trivial changes (1)
- packages/plugins/materials/index.js
Files skipped from review as they are similar to previous changes (19)
- packages/canvas/DesignCanvas/src/DesignCanvas.vue
- packages/common/component/BlockDeployDialog.vue
- packages/common/component/ProgressBar.vue
- packages/configurator/src/variable-configurator/VariableConfigurator.vue
- packages/layout/src/DesignPlugins.vue
- packages/layout/src/DesignToolbars.vue
- packages/layout/src/composable/useLayout.js
- packages/plugins/block/index.js
- packages/plugins/data/src/Main.vue
- packages/plugins/materials/src/composable/useResource.js
- packages/plugins/page/index.js
- packages/plugins/script/index.js
- packages/plugins/tutorial/index.js
- packages/plugins/tutorial/src/Main.vue
- packages/settings/events/src/components/BindEvents.vue
- packages/settings/events/src/components/BindEventsDialog.vue
- packages/settings/events/src/components/BindEventsDialogContent.vue
- packages/settings/events/src/components/BindEventsDialogSidebar.vue
- packages/toolbars/save/src/js/index.js
Additional comments not posted (5)
packages/toolbars/save/index.js (1)
19-19: Ensure all references to theapiproperty are updated toapis.Verify that all references to the
apiproperty in the codebase are updated toapisto maintain consistency.Verification successful
Let's investigate the context around the
apiproperty inpackages/toolbars/save/index.jsto verify if the change toapisis consistent and correctly applied.
Let's investigate the usage of
apiinpackages/toolbars/save/src/Main.vueto ensure the change toapisinindex.jsis consistent.
Ensure all references to the
apiproperty are updated toapis.The change to rename
apitoapisinpackages/toolbars/save/index.jsappears to be intentional and localized to the export object. Theapiobject inpackages/toolbars/save/src/Main.vueremains unchanged, which is consistent with the intended scope of the change.
packages/toolbars/save/index.js: Theapiproperty is renamed toapis.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to `api` are updated to `apis`. # Test: Search for the old property name. Expect: No occurrences of `api` property. rg --type js --pcre2 '\bapi\b'Length of output: 25053
Script:
#!/bin/bash # Description: Display the context around the api property in packages/toolbars/save/index.js # Fetch the relevant lines around the change in packages/toolbars/save/index.js rg --context 5 'api' packages/toolbars/save/index.jsLength of output: 358
Script:
#!/bin/bash # Description: Display the usage of api in packages/toolbars/save/src/Main.vue # Fetch the relevant lines around the usage of api in packages/toolbars/save/src/Main.vue rg --context 5 'api' packages/toolbars/save/src/Main.vueLength of output: 410
packages/toolbars/generate-vue/src/Main.vue (2)
26-35: LGTM! The import statements are correctly updated.The import statements have been correctly updated to include
getMetaApiandMETA_APP.
100-102: LGTM! The function calls are correctly updated.The function calls have been correctly updated to use
getMetaApiwithMETA_APP.packages/plugins/block/src/composable/useBlock.js (2)
23-31: LGTM! The import statements are correctly updated.The import statements have been correctly updated to include
getMetaApiandMETA_APP.
Line range hint
484-492:
LGTM! The function calls are correctly updated.The function calls have been correctly updated to use
getMetaApiwithMETA_APP.
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- packages/layout/src/DesignPlugins.vue (1 hunks)
- packages/layout/src/DesignToolbars.vue (2 hunks)
- packages/toolbars/generate-vue/src/Main.vue (2 hunks)
- packages/toolbars/lock/src/Main.vue (1 hunks)
Files skipped from review as they are similar to previous changes (4)
- packages/layout/src/DesignPlugins.vue
- packages/layout/src/DesignToolbars.vue
- packages/toolbars/generate-vue/src/Main.vue
- packages/toolbars/lock/src/Main.vue
082b687 to
20d6199
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (26)
- packages/common/component/BlockDeployDialog.vue (3 hunks)
- packages/common/component/ProgressBar.vue (1 hunks)
- packages/configurator/src/variable-configurator/VariableConfigurator.vue (2 hunks)
- packages/layout/src/DesignPlugins.vue (1 hunks)
- packages/layout/src/DesignToolbars.vue (2 hunks)
- packages/layout/src/composable/useLayout.js (6 hunks)
- packages/plugins/block/index.js (1 hunks)
- packages/plugins/block/src/composable/useBlock.js (2 hunks)
- packages/plugins/data/src/Main.vue (2 hunks)
- packages/plugins/materials/index.js (1 hunks)
- packages/plugins/materials/src/composable/useResource.js (3 hunks)
- packages/plugins/page/index.js (1 hunks)
- packages/plugins/script/index.js (1 hunks)
- packages/plugins/tutorial/index.js (1 hunks)
- packages/plugins/tutorial/src/Main.vue (2 hunks)
- packages/register/src/constants.js (1 hunks)
- packages/register/src/index.js (1 hunks)
- packages/settings/events/src/components/BindEvents.vue (3 hunks)
- packages/settings/events/src/components/BindEventsDialog.vue (3 hunks)
- packages/settings/events/src/components/BindEventsDialogContent.vue (2 hunks)
- packages/settings/events/src/components/BindEventsDialogSidebar.vue (2 hunks)
- packages/toolbars/generate-vue/src/Main.vue (2 hunks)
- packages/toolbars/lock/index.js (1 hunks)
- packages/toolbars/lock/src/Main.vue (1 hunks)
- packages/toolbars/save/index.js (1 hunks)
- packages/toolbars/save/src/js/index.js (3 hunks)
Files skipped from review as they are similar to previous changes (24)
- packages/common/component/BlockDeployDialog.vue
- packages/common/component/ProgressBar.vue
- packages/configurator/src/variable-configurator/VariableConfigurator.vue
- packages/layout/src/DesignPlugins.vue
- packages/layout/src/DesignToolbars.vue
- packages/layout/src/composable/useLayout.js
- packages/plugins/block/index.js
- packages/plugins/materials/index.js
- packages/plugins/materials/src/composable/useResource.js
- packages/plugins/page/index.js
- packages/plugins/script/index.js
- packages/plugins/tutorial/index.js
- packages/plugins/tutorial/src/Main.vue
- packages/register/src/constants.js
- packages/register/src/index.js
- packages/settings/events/src/components/BindEvents.vue
- packages/settings/events/src/components/BindEventsDialog.vue
- packages/settings/events/src/components/BindEventsDialogContent.vue
- packages/settings/events/src/components/BindEventsDialogSidebar.vue
- packages/toolbars/generate-vue/src/Main.vue
- packages/toolbars/lock/index.js
- packages/toolbars/lock/src/Main.vue
- packages/toolbars/save/index.js
- packages/toolbars/save/src/js/index.js
Additional comments not posted (4)
packages/plugins/data/src/Main.vue (2)
78-80: Add imports foruseHelp,getMetaApi, andMETA_APP.These imports are used for help documentation, API management, and meta application operations.
117-117: UsegetMetaApito get common API methods.The
getMetaApifunction is correctly used to get common API methods fromMETA_APP.Save.packages/plugins/block/src/composable/useBlock.js (2)
23-31: Add imports forgetMetaApiandMETA_APP.These imports are used for API management and meta application operations.
484-484: UsegetMetaApito get methods for thePagemeta application.The
getMetaApifunction is correctly used to get methods fromMETA_APP.Page.
* refactor: replace getPluginApi with getMetaApi
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
Refactor
getMetaApiforBlockManagerelated operations.getMetaApiandMETA_APP.Bug Fixes
Chores
apiproperty toapisin plugin-related exports for better clarity and consistency.