feat(config-editor): extension entry + minimal Vue panel proving end-to-end IPC
Task 12 of plan 2026-06-20-config-editor-foundation. Adds:
- src/main/index.ts: onLoad + message handlers (return value = request resolve,
per Cocos 3.x verified IPC mechanism; fallback note left in plan)
- src/panels/default/{index,app}.ts: Editor.Panel.define host + Vue 3 minimal
app (table switcher, key list, record JSON dump)
- static/template/default/index.html + static/style/default/index.css
Deviation from plan (necessary, flagged): esbuild.config.mjs now marks
node:fs/node:path as external for the panel entry (platform:'browser').
The plan's panel reads static template/style at runtime via Node fs, which
requires these builtins; Cocos panel runs in an Electron renderer that
provides them. Without this, esbuild errors with 'Could not resolve node:fs'.
Build verified: dist/main.js (9.5mb, typescript compiler API bundled) and
dist/panels/default.js (628kb, vue.esm-bundler bundled) both generate.
This commit is contained in:
16
extensions/pixelhero-config-editor/src/main/index.ts
Normal file
16
extensions/pixelhero-config-editor/src/main/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { store } from './store';
|
||||
|
||||
module.exports = {
|
||||
onLoad() { store.reloadAll(); },
|
||||
|
||||
'open-panel'() { Editor.Panel.open('pixelhero-config-editor'); },
|
||||
|
||||
'query-schema'(_event: unknown, id?: string) { return store.querySchema(id as any); },
|
||||
'query-enums'() { return store.queryEnums(); },
|
||||
'query-keys'(_event: unknown, id: string) { return store.queryKeys(id as any); },
|
||||
'query-record'(_event: unknown, id: string, key: string) { return store.queryRecord(id as any, key); },
|
||||
'query-preview-desc'(_event: unknown, hero: any) { return store.queryPreviewDesc(hero); },
|
||||
'validate'(_event: unknown, id: string) { return store.validate(id as any); },
|
||||
'save-record'(_event: unknown, id: string, key: string, value: any) { return store.saveRecord(id as any, key, value); },
|
||||
'revert-record'(_event: unknown, id: string, key: string) { return store.revertRecord(id as any, key); },
|
||||
};
|
||||
Reference in New Issue
Block a user