@dimina-kit/devtools 0.3.1 → 0.3.2-dev.20260522085907

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/README.md +297 -133
  2. package/dist/main/api.d.ts +6 -2
  3. package/dist/main/api.js +5 -2
  4. package/dist/main/app/app.d.ts +1 -1
  5. package/dist/main/app/app.js +84 -36
  6. package/dist/main/app/bootstrap.js +2 -1
  7. package/dist/main/app/launch.d.ts +2 -2
  8. package/dist/main/app/launch.js +10 -8
  9. package/dist/main/index.bundle.js +1567 -477
  10. package/dist/main/ipc/app.d.ts +2 -1
  11. package/dist/main/ipc/app.js +5 -4
  12. package/dist/main/ipc/index.d.ts +5 -4
  13. package/dist/main/ipc/index.js +5 -4
  14. package/dist/main/ipc/panels.d.ts +2 -1
  15. package/dist/main/ipc/panels.js +16 -13
  16. package/dist/main/ipc/popover.d.ts +4 -1
  17. package/dist/main/ipc/popover.js +15 -5
  18. package/dist/main/ipc/projects.d.ts +6 -1
  19. package/dist/main/ipc/projects.js +127 -6
  20. package/dist/main/ipc/session.d.ts +4 -1
  21. package/dist/main/ipc/session.js +34 -6
  22. package/dist/main/ipc/settings.d.ts +4 -1
  23. package/dist/main/ipc/settings.js +51 -23
  24. package/dist/main/ipc/simulator-module.d.ts +8 -0
  25. package/dist/main/ipc/simulator-module.js +19 -0
  26. package/dist/main/ipc/simulator.d.ts +2 -1
  27. package/dist/main/ipc/simulator.js +23 -18
  28. package/dist/main/ipc/toolbar.d.ts +2 -1
  29. package/dist/main/ipc/toolbar.js +3 -2
  30. package/dist/main/menu/index.js +11 -0
  31. package/dist/main/services/automation/exec.d.ts +2 -0
  32. package/dist/main/services/automation/exec.js +7 -9
  33. package/dist/main/services/automation/handlers/app.js +37 -51
  34. package/dist/main/services/automation/handlers/element.js +27 -41
  35. package/dist/main/services/automation/index.js +88 -13
  36. package/dist/main/services/default-adapter.js +3 -3
  37. package/dist/main/services/mcp/index.d.ts +1 -0
  38. package/dist/main/services/mcp/index.js +1 -0
  39. package/dist/main/services/mcp/server.d.ts +2 -1
  40. package/dist/main/services/mcp/server.js +10 -0
  41. package/dist/main/services/mcp/status.d.ts +10 -0
  42. package/dist/main/services/mcp/status.js +14 -0
  43. package/dist/main/services/mcp/target-manager.js +2 -1
  44. package/dist/main/services/module.d.ts +18 -0
  45. package/dist/main/services/module.js +2 -0
  46. package/dist/main/services/notifications/renderer-notifier.d.ts +5 -3
  47. package/dist/main/services/notifications/renderer-notifier.js +3 -6
  48. package/dist/main/services/projects/builtin-templates.d.ts +3 -0
  49. package/dist/main/services/projects/builtin-templates.js +24 -0
  50. package/dist/main/services/projects/create-project-service.d.ts +7 -0
  51. package/dist/main/services/projects/create-project-service.js +84 -0
  52. package/dist/main/services/projects/index.d.ts +7 -0
  53. package/dist/main/services/projects/index.js +9 -0
  54. package/dist/main/services/projects/local-provider.d.ts +3 -0
  55. package/dist/main/services/projects/local-provider.js +25 -0
  56. package/dist/main/services/projects/project-repository.d.ts +1 -1
  57. package/dist/main/services/projects/project-repository.js +3 -0
  58. package/dist/main/services/projects/templates.d.ts +21 -0
  59. package/dist/main/services/projects/templates.js +39 -0
  60. package/dist/main/services/projects/thumbnail.d.ts +8 -0
  61. package/dist/main/services/projects/thumbnail.js +37 -0
  62. package/dist/main/services/projects/types.d.ts +118 -0
  63. package/dist/main/services/projects/types.js +19 -0
  64. package/dist/main/services/settings/index.d.ts +11 -0
  65. package/dist/main/services/settings/index.js +18 -2
  66. package/dist/main/services/simulator/custom-apis.d.ts +10 -0
  67. package/dist/main/services/simulator/custom-apis.js +26 -0
  68. package/dist/main/services/simulator-storage/index.d.ts +22 -1
  69. package/dist/main/services/simulator-storage/index.js +334 -97
  70. package/dist/main/services/update/update-manager.d.ts +16 -1
  71. package/dist/main/services/update/update-manager.js +18 -15
  72. package/dist/main/services/views/view-manager.d.ts +7 -7
  73. package/dist/main/services/views/view-manager.js +53 -29
  74. package/dist/main/services/window-service.d.ts +24 -0
  75. package/dist/main/services/window-service.js +26 -0
  76. package/dist/main/services/workbench-context.d.ts +49 -2
  77. package/dist/main/services/workbench-context.js +15 -2
  78. package/dist/main/services/workspace/workspace-service.d.ts +9 -6
  79. package/dist/main/services/workspace/workspace-service.js +71 -11
  80. package/dist/main/simulator-apis.d.ts +23 -0
  81. package/dist/main/simulator-apis.js +24 -0
  82. package/dist/main/utils/disposable.d.ts +13 -0
  83. package/dist/main/utils/disposable.js +60 -0
  84. package/dist/main/utils/ipc-registry.d.ts +39 -0
  85. package/dist/main/utils/ipc-registry.js +109 -0
  86. package/dist/main/utils/ipc-schema.d.ts +28 -0
  87. package/dist/main/utils/ipc-schema.js +38 -0
  88. package/dist/main/utils/paths.d.ts +6 -0
  89. package/dist/main/utils/paths.js +6 -0
  90. package/dist/main/utils/sender-policy.d.ts +25 -0
  91. package/dist/main/utils/sender-policy.js +44 -0
  92. package/dist/main/utils/theme.d.ts +24 -0
  93. package/dist/main/utils/theme.js +38 -1
  94. package/dist/main/windows/main-window/create.d.ts +6 -0
  95. package/dist/main/windows/main-window/create.js +66 -10
  96. package/dist/main/windows/main-window/events.d.ts +2 -1
  97. package/dist/main/windows/main-window/events.js +25 -2
  98. package/dist/main/windows/navigation-hardening.d.ts +24 -0
  99. package/dist/main/windows/navigation-hardening.js +55 -0
  100. package/dist/main/windows/settings-window/create.js +11 -1
  101. package/dist/preload/index.d.ts +22 -0
  102. package/dist/preload/index.js +19 -0
  103. package/dist/preload/instrumentation/app-data.d.ts +32 -2
  104. package/dist/preload/instrumentation/app-data.js +253 -79
  105. package/dist/preload/instrumentation/index.d.ts +2 -2
  106. package/dist/preload/instrumentation/index.js +2 -2
  107. package/dist/preload/instrumentation/wxml.d.ts +16 -4
  108. package/dist/preload/instrumentation/wxml.js +188 -178
  109. package/dist/preload/miniapp-snapshot/host.d.ts +12 -0
  110. package/dist/preload/miniapp-snapshot/host.js +117 -0
  111. package/dist/preload/miniapp-snapshot/types.d.ts +62 -0
  112. package/dist/preload/miniapp-snapshot/types.js +15 -0
  113. package/dist/preload/runtime/bridge.js +5 -24
  114. package/dist/preload/runtime/custom-apis.d.ts +6 -0
  115. package/dist/preload/runtime/custom-apis.js +43 -0
  116. package/dist/preload/runtime/host.d.ts +1 -0
  117. package/dist/preload/runtime/host.js +13 -0
  118. package/dist/preload/shared/expose.d.ts +15 -0
  119. package/dist/preload/shared/expose.js +33 -0
  120. package/dist/preload/shared/page-iframe.d.ts +3 -0
  121. package/dist/preload/shared/page-iframe.js +6 -0
  122. package/dist/preload/shared/types.d.ts +2 -0
  123. package/dist/preload/windows/main.cjs +47 -0
  124. package/dist/preload/windows/main.cjs.map +7 -0
  125. package/dist/preload/windows/simulator.js +501 -272
  126. package/dist/renderer/assets/constants-DI382mTP.js +2 -0
  127. package/dist/renderer/assets/index-D8VFYBh-.js +46 -0
  128. package/dist/renderer/assets/{input-DxfYnzX_.js → input-CoWcfa8u.js} +2 -2
  129. package/dist/renderer/assets/ipc-transport-Cd2xPrsa.js +9 -0
  130. package/dist/renderer/assets/ipc-transport-DqbRdZNO.css +1 -0
  131. package/dist/renderer/assets/popover-Nq5gT9DO.js +2 -0
  132. package/dist/renderer/assets/select-By5KH-UG.js +2 -0
  133. package/dist/renderer/assets/{settings-DteGraEU.js → settings-Dj_N70qR.js} +2 -2
  134. package/dist/renderer/assets/settings-api-Do0_Smq1.js +2 -0
  135. package/dist/renderer/assets/workbenchSettings-CazSLGYt.js +8 -0
  136. package/dist/renderer/entries/main/index.html +13 -5
  137. package/dist/renderer/entries/popover/index.html +8 -5
  138. package/dist/renderer/entries/settings/index.html +7 -5
  139. package/dist/renderer/entries/workbench-settings/index.html +7 -4
  140. package/dist/shared/ipc-channels.d.ts +46 -13
  141. package/dist/shared/ipc-channels.js +60 -14
  142. package/dist/shared/ipc-schemas.d.ts +118 -0
  143. package/dist/shared/ipc-schemas.js +133 -0
  144. package/dist/shared/simulator-route.d.ts +72 -0
  145. package/dist/shared/simulator-route.js +169 -0
  146. package/dist/shared/types.d.ts +82 -8
  147. package/dist/simulator/assets/simulator-DJCozrU5.js +9 -0
  148. package/dist/simulator/simulator.html +6 -43
  149. package/package.json +18 -29
  150. package/templates/blank/app.js +6 -0
  151. package/templates/blank/app.json +11 -0
  152. package/templates/blank/app.wxss +5 -0
  153. package/templates/blank/pages/index/index.js +6 -0
  154. package/templates/blank/pages/index/index.json +3 -0
  155. package/templates/blank/pages/index/index.wxml +3 -0
  156. package/templates/blank/pages/index/index.wxss +11 -0
  157. package/templates/blank/project.config.json +13 -0
  158. package/templates/blank/sitemap.json +9 -0
  159. package/templates/taro-todo/app.js +1 -0
  160. package/templates/taro-todo/app.json +1 -0
  161. package/templates/taro-todo/app.wxss +1 -0
  162. package/templates/taro-todo/base.wxml +851 -0
  163. package/templates/taro-todo/common.js +1 -0
  164. package/templates/taro-todo/comp.js +1 -0
  165. package/templates/taro-todo/comp.json +1 -0
  166. package/templates/taro-todo/comp.wxml +2 -0
  167. package/templates/taro-todo/custom-wrapper.js +1 -0
  168. package/templates/taro-todo/custom-wrapper.json +1 -0
  169. package/templates/taro-todo/custom-wrapper.wxml +4 -0
  170. package/templates/taro-todo/pages/index/index.js +2 -0
  171. package/templates/taro-todo/pages/index/index.json +1 -0
  172. package/templates/taro-todo/pages/index/index.wxml +2 -0
  173. package/templates/taro-todo/pages/index/index.wxss +1 -0
  174. package/templates/taro-todo/project.config.json +44 -0
  175. package/templates/taro-todo/runtime.js +1 -0
  176. package/templates/taro-todo/taro.js +2 -0
  177. package/templates/taro-todo/utils.wxs +39 -0
  178. package/templates/taro-todo/vendors.js +2 -0
  179. package/dist/preload/instrumentation/disposable.d.ts +0 -11
  180. package/dist/preload/instrumentation/disposable.js +0 -15
  181. package/dist/preload/windows/main.d.ts +0 -6
  182. package/dist/preload/windows/main.js +0 -6
  183. package/dist/renderer/assets/index-D1p6crtf.js +0 -46
  184. package/dist/renderer/assets/ipc-transport-ClIvDcYY.js +0 -9
  185. package/dist/renderer/assets/ipc-transport-EiWxu_hG.css +0 -1
  186. package/dist/renderer/assets/popover-CtXcBJtM.js +0 -2
  187. package/dist/renderer/assets/select-DMfp49f1.js +0 -2
  188. package/dist/renderer/assets/settings-api-CY84UMpN.js +0 -2
  189. package/dist/renderer/assets/workbenchSettings-DjELLnSJ.js +0 -8
  190. package/dist/simulator/assets/simulator-C1eHXnuq.js +0 -9
@@ -3,11 +3,14 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <!-- See entries/main/index.html for CSP rationale. -->
7
+ <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: http: https:; font-src 'self' data:; media-src 'self' blob: http: https:; connect-src 'self' http: https: ws: wss:;" />
6
8
  <title>开发工具设置</title>
7
- <script type="module" crossorigin src="../../assets/workbenchSettings-DjELLnSJ.js"></script>
8
- <link rel="modulepreload" crossorigin href="../../assets/ipc-transport-ClIvDcYY.js">
9
- <link rel="modulepreload" crossorigin href="../../assets/settings-api-CY84UMpN.js">
10
- <link rel="stylesheet" crossorigin href="../../assets/ipc-transport-EiWxu_hG.css">
9
+ <script type="module" crossorigin src="../../assets/workbenchSettings-CazSLGYt.js"></script>
10
+ <link rel="modulepreload" crossorigin href="../../assets/ipc-transport-Cd2xPrsa.js">
11
+ <link rel="modulepreload" crossorigin href="../../assets/settings-api-Do0_Smq1.js">
12
+ <link rel="modulepreload" crossorigin href="../../assets/constants-DI382mTP.js">
13
+ <link rel="stylesheet" crossorigin href="../../assets/ipc-transport-DqbRdZNO.css">
11
14
  </head>
12
15
  <body>
13
16
  <div id="root"></div>
@@ -11,12 +11,22 @@ export declare const SimulatorChannel: {
11
11
  readonly Resize: "simulator:resize";
12
12
  readonly SetVisible: "simulator:setVisible";
13
13
  readonly Console: "simulator:console";
14
- readonly Wxml: "simulator:wxml";
15
- readonly AppData: "simulator:appdata";
16
- readonly AppDataAll: "simulator:appdata-all";
14
+ };
15
+ export declare const SimulatorCustomApiChannel: {
16
+ readonly List: "simulator:custom-apis:list";
17
+ readonly Invoke: "simulator:custom-apis:invoke";
18
+ };
19
+ export declare const SimulatorCustomApiBridgeChannel: {
20
+ readonly Request: "simulator:custom-apis:bridge-request";
21
+ readonly Response: "simulator:custom-apis:bridge-response";
17
22
  };
18
23
  export declare const SimulatorStorageChannel: {
19
24
  readonly GetSnapshot: "simulator:storage:snapshot";
25
+ readonly GetActivePrefix: "simulator:storage:activePrefix";
26
+ readonly Set: "simulator:storage:set";
27
+ readonly Remove: "simulator:storage:remove";
28
+ readonly Clear: "simulator:storage:clear";
29
+ readonly ClearAll: "simulator:storage:clearAll";
20
30
  readonly Event: "simulator:storage:event";
21
31
  };
22
32
  export interface StorageItem {
@@ -38,6 +48,12 @@ export type StorageEvent = {
38
48
  } | {
39
49
  type: 'cleared';
40
50
  };
51
+ export type StorageWriteResult = {
52
+ ok: true;
53
+ } | {
54
+ ok: false;
55
+ error: string;
56
+ };
41
57
  export declare const SimulatorElementChannel: {
42
58
  readonly Inspect: "simulator:element:inspect";
43
59
  readonly Clear: "simulator:element:clear";
@@ -61,16 +77,12 @@ export interface ElementInspection {
61
77
  fontSize: string;
62
78
  };
63
79
  }
64
- export declare const WorkbenchChannel: {
65
- readonly GetPanelConfig: "workbench:getPanelConfig";
66
- readonly GetApiNamespaces: "workbench:getApiNamespaces";
67
- readonly Reset: "workbench:reset";
68
- };
69
80
  export declare const WorkbenchSettingsChannel: {
70
81
  readonly Get: "workbenchSettings:get";
71
82
  readonly Save: "workbenchSettings:save";
72
83
  readonly SetTheme: "workbenchSettings:setTheme";
73
84
  readonly GetCdpStatus: "workbenchSettings:getCdpStatus";
85
+ readonly GetMcpStatus: "workbenchSettings:getMcpStatus";
74
86
  readonly SetVisible: "workbenchSettings:setVisible";
75
87
  readonly Init: "workbenchSettings:init";
76
88
  };
@@ -81,12 +93,27 @@ export declare const ProjectChannel: {
81
93
  readonly GetCompileConfig: "project:getCompileConfig";
82
94
  readonly SaveCompileConfig: "project:saveCompileConfig";
83
95
  readonly Status: "project:status";
96
+ readonly CaptureThumbnail: "project:captureThumbnail";
97
+ readonly GetThumbnail: "project:getThumbnail";
84
98
  };
85
99
  export declare const ProjectsChannel: {
86
100
  readonly List: "projects:list";
87
101
  readonly Add: "projects:add";
88
102
  readonly Remove: "projects:remove";
89
- };
103
+ /** Phase 3: merged + sanitized template catalog for the create-project dialog. */
104
+ readonly ListTemplates: "projects:listTemplates";
105
+ /** Phase 3: host-supplied create-project dialog hook (returns input or null). */
106
+ readonly OpenCreateDialog: "projects:openCreateDialog";
107
+ /** Phase 3: server-side scaffold + register (delegates to create-project-service). */
108
+ readonly Create: "projects:create";
109
+ /** Default values used to pre-fill the create-project dialog (baseDir). */
110
+ readonly GetCreateDefaults: "projects:getCreateDefaults";
111
+ };
112
+ /** Renderer-facing payload for `projects:getCreateDefaults`. */
113
+ export interface ProjectCreateDefaults {
114
+ /** Absolute directory used as the parent for new projects. */
115
+ baseDir: string;
116
+ }
90
117
  export declare const DialogChannel: {
91
118
  readonly OpenDirectory: "dialog:openDirectory";
92
119
  };
@@ -116,10 +143,9 @@ export declare const AppChannel: {
116
143
  readonly GetPreloadPath: "app:getPreloadPath";
117
144
  readonly GetBranding: "app:getBranding";
118
145
  };
119
- export declare const BridgeChannel: {
120
- readonly WxmlRefreshRequest: "wxml:refresh:request";
121
- readonly AppDataGetAllRequest: "appdata:getAll:request";
122
- readonly AppDataGetAllResponse: "appdata:getAll:response";
146
+ export declare const MiniappSnapshotChannel: {
147
+ readonly Push: "miniapp-snapshot:push";
148
+ readonly Pull: "miniapp-snapshot:pull";
123
149
  };
124
150
  export declare const AutomationChannel: {
125
151
  readonly GetPort: "automation:port";
@@ -132,4 +158,11 @@ export declare const SettingsChannel: {
132
158
  readonly Closed: "settings:closed";
133
159
  readonly Changed: "settings:changed";
134
160
  };
161
+ export declare const UpdateChannel: {
162
+ readonly Check: "updates:check";
163
+ readonly Download: "updates:download";
164
+ readonly Install: "updates:install";
165
+ readonly DownloadProgress: "updates:downloadProgress";
166
+ readonly Available: "updates:available";
167
+ };
135
168
  //# sourceMappingURL=ipc-channels.d.ts.map
@@ -12,14 +12,40 @@ export const SimulatorChannel = {
12
12
  Resize: 'simulator:resize',
13
13
  SetVisible: 'simulator:setVisible',
14
14
  Console: 'simulator:console',
15
- Wxml: 'simulator:wxml',
16
- AppData: 'simulator:appdata',
17
- AppDataAll: 'simulator:appdata-all',
15
+ };
16
+ // ── Custom simulator APIs (downstream-registered, main-process handlers) ──
17
+ // list: simulator queries the names registered via @dimina-kit/devtools/simulator-apis.
18
+ // invoke: simulator forwards an API call to the registry; result/reject propagates.
19
+ //
20
+ // These are ipcMain.handle channels invoked by the **main-window renderer**
21
+ // only (trusted host). The simulator <webview> never reaches them directly —
22
+ // it proxies through the host via the bridge channels below, so the
23
+ // sender-policy can keep the webview off the IPC white-list.
24
+ export const SimulatorCustomApiChannel = {
25
+ List: 'simulator:custom-apis:list',
26
+ Invoke: 'simulator:custom-apis:invoke',
27
+ };
28
+ // ── Custom APIs bridge proxy (simulator <webview> ↔ main-window renderer) ──
29
+ // Request: webview → host via `ipcRenderer.sendToHost`,
30
+ // payload = { id, op: 'list' } | { id, op: 'invoke', name, params }
31
+ // Response: host → webview via `<webview>.send`,
32
+ // payload = { id, result } | { id, error }
33
+ //
34
+ // Request/response are correlated by `id` so multiple concurrent invokes can
35
+ // be in flight at once.
36
+ export const SimulatorCustomApiBridgeChannel = {
37
+ Request: 'simulator:custom-apis:bridge-request',
38
+ Response: 'simulator:custom-apis:bridge-response',
18
39
  };
19
40
  // ── Storage (CDP-backed; main process attaches the debugger to the
20
41
  // simulator <webview> and forwards DOMStorage events to the renderer) ──
21
42
  export const SimulatorStorageChannel = {
22
43
  GetSnapshot: 'simulator:storage:snapshot',
44
+ GetActivePrefix: 'simulator:storage:activePrefix',
45
+ Set: 'simulator:storage:set',
46
+ Remove: 'simulator:storage:remove',
47
+ Clear: 'simulator:storage:clear',
48
+ ClearAll: 'simulator:storage:clearAll',
23
49
  Event: 'simulator:storage:event',
24
50
  };
25
51
  // ── Element inspection (CDP-backed; WXML tree nodes map to real DOM by sid) ──
@@ -27,18 +53,13 @@ export const SimulatorElementChannel = {
27
53
  Inspect: 'simulator:element:inspect',
28
54
  Clear: 'simulator:element:clear',
29
55
  };
30
- // ── Workbench ────────────────────────────────────────────────────────────
31
- export const WorkbenchChannel = {
32
- GetPanelConfig: 'workbench:getPanelConfig',
33
- GetApiNamespaces: 'workbench:getApiNamespaces',
34
- Reset: 'workbench:reset',
35
- };
36
56
  // ── Workbench settings ───────────────────────────────────────────────────
37
57
  export const WorkbenchSettingsChannel = {
38
58
  Get: 'workbenchSettings:get',
39
59
  Save: 'workbenchSettings:save',
40
60
  SetTheme: 'workbenchSettings:setTheme',
41
61
  GetCdpStatus: 'workbenchSettings:getCdpStatus',
62
+ GetMcpStatus: 'workbenchSettings:getMcpStatus',
42
63
  SetVisible: 'workbenchSettings:setVisible',
43
64
  Init: 'workbenchSettings:init',
44
65
  };
@@ -50,12 +71,22 @@ export const ProjectChannel = {
50
71
  GetCompileConfig: 'project:getCompileConfig',
51
72
  SaveCompileConfig: 'project:saveCompileConfig',
52
73
  Status: 'project:status',
74
+ CaptureThumbnail: 'project:captureThumbnail',
75
+ GetThumbnail: 'project:getThumbnail',
53
76
  };
54
77
  // ── Project list / workspace ─────────────────────────────────────────────
55
78
  export const ProjectsChannel = {
56
79
  List: 'projects:list',
57
80
  Add: 'projects:add',
58
81
  Remove: 'projects:remove',
82
+ /** Phase 3: merged + sanitized template catalog for the create-project dialog. */
83
+ ListTemplates: 'projects:listTemplates',
84
+ /** Phase 3: host-supplied create-project dialog hook (returns input or null). */
85
+ OpenCreateDialog: 'projects:openCreateDialog',
86
+ /** Phase 3: server-side scaffold + register (delegates to create-project-service). */
87
+ Create: 'projects:create',
88
+ /** Default values used to pre-fill the create-project dialog (baseDir). */
89
+ GetCreateDefaults: 'projects:getCreateDefaults',
59
90
  };
60
91
  // ── Dialog ───────────────────────────────────────────────────────────────
61
92
  export const DialogChannel = {
@@ -92,11 +123,15 @@ export const AppChannel = {
92
123
  GetPreloadPath: 'app:getPreloadPath',
93
124
  GetBranding: 'app:getBranding',
94
125
  };
95
- // ── Bridge (renderer preload, webview.send / sendToHost) ───────────────
96
- export const BridgeChannel = {
97
- WxmlRefreshRequest: 'wxml:refresh:request',
98
- AppDataGetAllRequest: 'appdata:getAll:request',
99
- AppDataGetAllResponse: 'appdata:getAll:response',
126
+ // ── miniappSnapshot (unified panel snapshot framework) ───────────────────
127
+ //
128
+ // Two generic channels shared by every snapshot source (AppData, WXML, …).
129
+ // Adding a new panel needs no new channel.
130
+ // Push: preload → renderer (`sendToHost`), payload: SnapshotEnvelope
131
+ // Pull: renderer → preload (`webview.send`), payload: { id }
132
+ export const MiniappSnapshotChannel = {
133
+ Push: 'miniapp-snapshot:push',
134
+ Pull: 'miniapp-snapshot:pull',
100
135
  };
101
136
  // ── Automation (WebSocket server) ────────────────────────────────────────
102
137
  export const AutomationChannel = {
@@ -111,4 +146,15 @@ export const SettingsChannel = {
111
146
  Closed: 'settings:closed',
112
147
  Changed: 'settings:changed',
113
148
  };
149
+ // ── Updates (UpdateManager) ──────────────────────────────────────────────
150
+ //
151
+ // String values are FROZEN: shipped builds key off them. Add new entries
152
+ // here, never rename existing ones.
153
+ export const UpdateChannel = {
154
+ Check: 'updates:check',
155
+ Download: 'updates:download',
156
+ Install: 'updates:install',
157
+ DownloadProgress: 'updates:downloadProgress',
158
+ Available: 'updates:available',
159
+ };
114
160
  //# sourceMappingURL=ipc-channels.js.map
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Centralised zod schemas for IPC handler argument validation.
3
+ *
4
+ * Only the highest-risk handlers are validated here. Each schema is shaped as a
5
+ * `z.tuple([...])` matching the `(event, ...args)` argument list that an
6
+ * `ipcMain.handle` callback receives (event is stripped before validation).
7
+ */
8
+ import { z } from 'zod';
9
+ /** panel:eval — single JS expression string. Cap at 50_000 chars to avoid DoS. */
10
+ export declare const PanelEvalSchema: z.ZodTuple<[z.ZodString], null>;
11
+ /** projects:add — absolute directory path. */
12
+ export declare const ProjectsAddSchema: z.ZodTuple<[z.ZodString], null>;
13
+ /** project:open — absolute project path. */
14
+ export declare const ProjectOpenSchema: z.ZodTuple<[z.ZodString], null>;
15
+ /**
16
+ * project:saveCompileConfig — absolute project path + CompileConfig.
17
+ */
18
+ export declare const ProjectSaveCompileConfigSchema: z.ZodTuple<[z.ZodString, z.ZodObject<{
19
+ startPage: z.ZodOptional<z.ZodString>;
20
+ scene: z.ZodOptional<z.ZodNumber>;
21
+ queryParams: z.ZodOptional<z.ZodArray<z.ZodObject<{
22
+ key: z.ZodString;
23
+ value: z.ZodString;
24
+ }, z.core.$loose>>>;
25
+ }, z.core.$loose>], null>;
26
+ /** popover:show — must be an object (not undefined/null/string). */
27
+ export declare const PopoverShowSchema: z.ZodTuple<[z.ZodObject<{}, z.core.$loose>], null>;
28
+ /** simulator:attach — webContents id (positive int) + simulator width. */
29
+ export declare const SimulatorAttachSchema: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
30
+ /** simulator:resize — simulator width. */
31
+ export declare const SimulatorResizeSchema: z.ZodTuple<[z.ZodNumber], null>;
32
+ /** simulator:setVisible — visible flag + simulator width. */
33
+ export declare const SimulatorSetVisibleSchema: z.ZodTuple<[z.ZodBoolean, z.ZodNumber], null>;
34
+ /**
35
+ * simulator:custom-apis:invoke — API name + arbitrary JSON-serialisable params.
36
+ *
37
+ * Params shape is owned by the downstream handler, so we only enforce that the
38
+ * name is a non-empty bounded string (cheap DoS guard) and accept any payload.
39
+ */
40
+ export declare const SimulatorCustomApiInvokeSchema: z.ZodTuple<[z.ZodString, z.ZodUnknown], null>;
41
+ /** project:getPages — absolute project path. */
42
+ export declare const ProjectGetPagesSchema: z.ZodTuple<[z.ZodString], null>;
43
+ /** project:getCompileConfig — absolute project path. */
44
+ export declare const ProjectGetCompileConfigSchema: z.ZodTuple<[z.ZodString], null>;
45
+ /** projects:remove — absolute project directory path. */
46
+ export declare const ProjectsRemoveSchema: z.ZodTuple<[z.ZodString], null>;
47
+ /**
48
+ * workbenchSettings:save — full WorkbenchSettings object.
49
+ *
50
+ * `saveWorkbenchSettings()` overwrites the whole settings file (no merge),
51
+ * so a partial payload would silently reset whatever fields it omits to
52
+ * defaults. Require every top-level slice so the renderer can't accidentally
53
+ * (or maliciously) wipe configuration by sending `{}`.
54
+ */
55
+ export declare const WorkbenchSettingsSaveSchema: z.ZodTuple<[z.ZodObject<{
56
+ cdp: z.ZodObject<{
57
+ enabled: z.ZodBoolean;
58
+ port: z.ZodNumber;
59
+ }, z.core.$loose>;
60
+ mcp: z.ZodObject<{
61
+ enabled: z.ZodBoolean;
62
+ port: z.ZodNumber;
63
+ }, z.core.$loose>;
64
+ compile: z.ZodObject<{
65
+ watch: z.ZodBoolean;
66
+ }, z.core.$loose>;
67
+ theme: z.ZodEnum<{
68
+ system: "system";
69
+ dark: "dark";
70
+ light: "light";
71
+ }>;
72
+ lastCreateBaseDir: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
73
+ }, z.core.$loose>], null>;
74
+ /** workbenchSettings:setTheme — fixed enum of supported theme sources. */
75
+ export declare const WorkbenchSettingsSetThemeSchema: z.ZodTuple<[z.ZodEnum<{
76
+ system: "system";
77
+ dark: "dark";
78
+ light: "light";
79
+ }>], null>;
80
+ /** workbenchSettings:setVisible — boolean. */
81
+ export declare const WorkbenchSettingsSetVisibleSchema: z.ZodTuple<[z.ZodBoolean], null>;
82
+ /** settings:setVisible — boolean. */
83
+ export declare const SettingsSetVisibleSchema: z.ZodTuple<[z.ZodBoolean], null>;
84
+ /** settings:configChanged — full CompileConfig object (see shared/types.ts). */
85
+ export declare const SettingsConfigChangedSchema: z.ZodTuple<[z.ZodObject<{
86
+ startPage: z.ZodOptional<z.ZodString>;
87
+ scene: z.ZodOptional<z.ZodNumber>;
88
+ queryParams: z.ZodOptional<z.ZodArray<z.ZodObject<{
89
+ key: z.ZodString;
90
+ value: z.ZodString;
91
+ }, z.core.$loose>>>;
92
+ }, z.core.$loose>], null>;
93
+ /** popover:relaunch — full CompileConfig object pushed back to main on relaunch. */
94
+ export declare const PopoverRelaunchSchema: z.ZodTuple<[z.ZodObject<{
95
+ startPage: z.ZodOptional<z.ZodString>;
96
+ scene: z.ZodOptional<z.ZodNumber>;
97
+ queryParams: z.ZodOptional<z.ZodArray<z.ZodObject<{
98
+ key: z.ZodString;
99
+ value: z.ZodString;
100
+ }, z.core.$loose>>>;
101
+ }, z.core.$loose>], null>;
102
+ /**
103
+ * settings:projectSettingsChanged — Partial<ProjectSettings>.
104
+ *
105
+ * ProjectSettings currently has a single boolean field
106
+ * (`uploadWithSourceMap`); validated permissively to remain forward-
107
+ * compatible while still rejecting non-object payloads.
108
+ */
109
+ export declare const SettingsProjectSettingsChangedSchema: z.ZodTuple<[z.ZodObject<{
110
+ uploadWithSourceMap: z.ZodOptional<z.ZodBoolean>;
111
+ }, z.core.$loose>], null>;
112
+ /** panel:select — single panel id string. */
113
+ export declare const PanelSelectSchema: z.ZodTuple<[z.ZodString], null>;
114
+ /** project:captureThumbnail — absolute project path. */
115
+ export declare const ProjectCaptureThumbnailSchema: z.ZodTuple<[z.ZodString], null>;
116
+ /** project:getThumbnail — absolute project path. */
117
+ export declare const ProjectGetThumbnailSchema: z.ZodTuple<[z.ZodString], null>;
118
+ //# sourceMappingURL=ipc-schemas.d.ts.map
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Centralised zod schemas for IPC handler argument validation.
3
+ *
4
+ * Only the highest-risk handlers are validated here. Each schema is shaped as a
5
+ * `z.tuple([...])` matching the `(event, ...args)` argument list that an
6
+ * `ipcMain.handle` callback receives (event is stripped before validation).
7
+ */
8
+ import { z } from 'zod';
9
+ /**
10
+ * Conservative absolute-path matcher.
11
+ * Accepts:
12
+ * - POSIX absolute paths (start with `/`)
13
+ * - Windows absolute paths (e.g. `C:\foo`, `C:/foo`)
14
+ * Rejects empty strings, relative paths and other shapes.
15
+ */
16
+ const AbsolutePath = z
17
+ .string()
18
+ .min(1)
19
+ .refine((p) => p.startsWith('/') || /^[a-zA-Z]:\\/.test(p) || /^[a-zA-Z]:\//.test(p), 'must be an absolute path');
20
+ /** panel:eval — single JS expression string. Cap at 50_000 chars to avoid DoS. */
21
+ export const PanelEvalSchema = z.tuple([z.string().min(1).max(50_000)]);
22
+ /** projects:add — absolute directory path. */
23
+ export const ProjectsAddSchema = z.tuple([AbsolutePath]);
24
+ /** project:open — absolute project path. */
25
+ export const ProjectOpenSchema = z.tuple([AbsolutePath]);
26
+ /**
27
+ * Shared shape for CompileConfig payloads (used by saveCompileConfig,
28
+ * settings:configChanged, and popover:relaunch). Permissive on the outer
29
+ * object so we stay forward-compatible with new fields; the known top-level
30
+ * keys are validated to catch wrong types early.
31
+ */
32
+ const CompileConfigShape = z.looseObject({
33
+ startPage: z.string().optional(),
34
+ scene: z.number().optional(),
35
+ queryParams: z
36
+ .array(z.looseObject({ key: z.string(), value: z.string() }))
37
+ .optional(),
38
+ });
39
+ /**
40
+ * project:saveCompileConfig — absolute project path + CompileConfig.
41
+ */
42
+ export const ProjectSaveCompileConfigSchema = z.tuple([
43
+ AbsolutePath,
44
+ CompileConfigShape,
45
+ ]);
46
+ /** popover:show — must be an object (not undefined/null/string). */
47
+ export const PopoverShowSchema = z.tuple([z.looseObject({})]);
48
+ /**
49
+ * Reasonable simulator width range. Window width is clamped UI-side, but
50
+ * we still reject obvious garbage (negative, zero, absurdly large).
51
+ */
52
+ const SimWidth = z.number().int().min(100).max(2000);
53
+ /** simulator:attach — webContents id (positive int) + simulator width. */
54
+ export const SimulatorAttachSchema = z.tuple([
55
+ z.number().int().positive(),
56
+ SimWidth,
57
+ ]);
58
+ /** simulator:resize — simulator width. */
59
+ export const SimulatorResizeSchema = z.tuple([SimWidth]);
60
+ /** simulator:setVisible — visible flag + simulator width. */
61
+ export const SimulatorSetVisibleSchema = z.tuple([z.boolean(), SimWidth]);
62
+ /**
63
+ * simulator:custom-apis:invoke — API name + arbitrary JSON-serialisable params.
64
+ *
65
+ * Params shape is owned by the downstream handler, so we only enforce that the
66
+ * name is a non-empty bounded string (cheap DoS guard) and accept any payload.
67
+ */
68
+ export const SimulatorCustomApiInvokeSchema = z.tuple([
69
+ z.string().min(1).max(256),
70
+ z.unknown(),
71
+ ]);
72
+ /** project:getPages — absolute project path. */
73
+ export const ProjectGetPagesSchema = z.tuple([AbsolutePath]);
74
+ /** project:getCompileConfig — absolute project path. */
75
+ export const ProjectGetCompileConfigSchema = z.tuple([AbsolutePath]);
76
+ /** projects:remove — absolute project directory path. */
77
+ export const ProjectsRemoveSchema = z.tuple([AbsolutePath]);
78
+ /**
79
+ * workbenchSettings:save — full WorkbenchSettings object.
80
+ *
81
+ * `saveWorkbenchSettings()` overwrites the whole settings file (no merge),
82
+ * so a partial payload would silently reset whatever fields it omits to
83
+ * defaults. Require every top-level slice so the renderer can't accidentally
84
+ * (or maliciously) wipe configuration by sending `{}`.
85
+ */
86
+ export const WorkbenchSettingsSaveSchema = z.tuple([
87
+ z.looseObject({
88
+ cdp: z.looseObject({
89
+ enabled: z.boolean(),
90
+ port: z.number().int().min(0).max(65535),
91
+ }),
92
+ mcp: z.looseObject({
93
+ enabled: z.boolean(),
94
+ port: z.number().int().min(0).max(65535),
95
+ }),
96
+ compile: z.looseObject({
97
+ watch: z.boolean(),
98
+ }),
99
+ theme: z.enum(['system', 'light', 'dark']),
100
+ lastCreateBaseDir: z.union([z.string(), z.null()]),
101
+ }),
102
+ ]);
103
+ /** workbenchSettings:setTheme — fixed enum of supported theme sources. */
104
+ export const WorkbenchSettingsSetThemeSchema = z.tuple([
105
+ z.enum(['system', 'light', 'dark']),
106
+ ]);
107
+ /** workbenchSettings:setVisible — boolean. */
108
+ export const WorkbenchSettingsSetVisibleSchema = z.tuple([z.boolean()]);
109
+ /** settings:setVisible — boolean. */
110
+ export const SettingsSetVisibleSchema = z.tuple([z.boolean()]);
111
+ /** settings:configChanged — full CompileConfig object (see shared/types.ts). */
112
+ export const SettingsConfigChangedSchema = z.tuple([CompileConfigShape]);
113
+ /** popover:relaunch — full CompileConfig object pushed back to main on relaunch. */
114
+ export const PopoverRelaunchSchema = z.tuple([CompileConfigShape]);
115
+ /**
116
+ * settings:projectSettingsChanged — Partial<ProjectSettings>.
117
+ *
118
+ * ProjectSettings currently has a single boolean field
119
+ * (`uploadWithSourceMap`); validated permissively to remain forward-
120
+ * compatible while still rejecting non-object payloads.
121
+ */
122
+ export const SettingsProjectSettingsChangedSchema = z.tuple([
123
+ z.looseObject({
124
+ uploadWithSourceMap: z.boolean().optional(),
125
+ }),
126
+ ]);
127
+ /** panel:select — single panel id string. */
128
+ export const PanelSelectSchema = z.tuple([z.string().min(1).max(200)]);
129
+ /** project:captureThumbnail — absolute project path. */
130
+ export const ProjectCaptureThumbnailSchema = z.tuple([AbsolutePath]);
131
+ /** project:getThumbnail — absolute project path. */
132
+ export const ProjectGetThumbnailSchema = z.tuple([AbsolutePath]);
133
+ //# sourceMappingURL=ipc-schemas.js.map
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Single source of truth for the simulator URL format.
3
+ *
4
+ * Upstream dimina (didi/dimina, since commit 68310fe) encodes the page route
5
+ * as query params: `?appId={id}&entry={spec}&page={spec}` where each spec is
6
+ * `pagePath?key=val&…`. HashRouter.syncStack rewrites the URL after every
7
+ * navigation; before mount, parent code consumes whatever URL it received.
8
+ *
9
+ * Every URL-building or URL-parsing site in devtools should go through this
10
+ * module — if upstream changes the contract again it's a single-file diff.
11
+ */
12
+ import type { CompileConfig } from './types.js';
13
+ export interface PageSpec {
14
+ pagePath: string;
15
+ /** Per-page query parsed out of `pagePath?k=v&…`. */
16
+ query: Record<string, string>;
17
+ }
18
+ export interface SimulatorRoute {
19
+ appId: string;
20
+ entry: PageSpec;
21
+ /** Defaults to `entry` when the URL has only one segment. */
22
+ current: PageSpec;
23
+ }
24
+ /**
25
+ * Encode a search-param value but leave `/` and `,` un-escaped for
26
+ * readability. Upstream `HashRouter._encodeSearchValue` only spares `/`;
27
+ * we also spare `,` so CSV-style extras (e.g. `apiNamespaces=qd,mt`) stay
28
+ * legible in the URL. Both characters are safe in a query string.
29
+ */
30
+ export declare function encodeRouteValue(value: string): string;
31
+ /** Encode `{ pagePath, query }` as `pagePath?k1=v1&k2=v2` (no trailing `?` when empty). */
32
+ export declare function encodePageSpec(spec: PageSpec): string;
33
+ /** Decode `pagePath?k=v` into `{ pagePath, query }`. Tolerates missing query. */
34
+ export declare function decodePageSpec(value: string): PageSpec;
35
+ /**
36
+ * Build the search-params string (without a leading `?`) for a route where
37
+ * `entry === current`. `extras` is appended verbatim (e.g. `apiNamespaces`).
38
+ */
39
+ export declare function buildRouteSearch(appId: string, page: PageSpec, extras?: Record<string, string>): string;
40
+ /**
41
+ * Build a full simulator URL. The default `host`/`pathname` match what the
42
+ * devkit dev server serves; both are overridable for tests.
43
+ */
44
+ export declare function buildSimulatorUrlFromSpec(opts: {
45
+ appId: string;
46
+ page: PageSpec;
47
+ port: number;
48
+ host?: string;
49
+ pathname?: string;
50
+ extras?: Record<string, string>;
51
+ }): string;
52
+ /**
53
+ * Renderer-facing convenience: build a simulator URL from devtools'
54
+ * `CompileConfig` shape (startPage / scene / queryParams).
55
+ */
56
+ export declare function buildSimulatorUrl(appId: string, compileConfig: CompileConfig, port: number, apiNamespaces?: string[]): string;
57
+ /**
58
+ * Parse `location.search` (the query route `?appId=&entry=&page=`) into a
59
+ * `SimulatorRoute`. Returns `null` when no recognisable route is present.
60
+ */
61
+ export declare function parseLocationRoute(search: string): SimulatorRoute | null;
62
+ /** Parse a full URL string into a `SimulatorRoute`, or `null`. */
63
+ export declare function parseRoute(url: string): SimulatorRoute | null;
64
+ /** Return the current page path (no query) from a URL, or `''` if unparseable. */
65
+ export declare function getCurrentPagePath(url: string): string;
66
+ /**
67
+ * Rewrite the URL so `entry === current`. Used before a hot-reload so the
68
+ * container boots at just the top page — avoids merged-bundle requests for a
69
+ * multi-page stack that the incremental compiler never emits.
70
+ */
71
+ export declare function collapseRouteToTopPage(url: string): string;
72
+ //# sourceMappingURL=simulator-route.d.ts.map