@dimina-kit/devtools 0.4.0 → 0.5.0-dev.20260908120530

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 (507) hide show
  1. package/README.md +51 -660
  2. package/dist/main/api.d.ts +2 -1
  3. package/dist/main/app/app.d.ts +41 -12
  4. package/dist/main/app/app.js +299 -514
  5. package/dist/main/app/bootstrap.d.ts +8 -5
  6. package/dist/main/app/bootstrap.js +15 -15
  7. package/dist/main/app/editor-view.d.ts +21 -0
  8. package/dist/main/app/editor-view.js +71 -0
  9. package/dist/main/app/global-mirrors.d.ts +23 -0
  10. package/dist/main/app/global-mirrors.js +37 -0
  11. package/dist/main/app/host-sidebar-default.d.ts +19 -0
  12. package/dist/main/app/host-sidebar-default.js +44 -0
  13. package/dist/main/app/lifecycle.d.ts +12 -1
  14. package/dist/main/app/lifecycle.js +27 -1
  15. package/dist/main/app/menu-setup.d.ts +13 -0
  16. package/dist/main/app/menu-setup.js +49 -0
  17. package/dist/main/app/native-overview.d.ts +1 -1
  18. package/dist/main/app/open-project-ipc.d.ts +13 -0
  19. package/dist/main/app/open-project-ipc.js +21 -0
  20. package/dist/main/app/project-list-surface.d.ts +31 -0
  21. package/dist/main/app/project-list-surface.js +20 -0
  22. package/dist/main/app/project-window.d.ts +36 -0
  23. package/dist/main/app/project-window.js +93 -0
  24. package/dist/main/app/servers.d.ts +17 -0
  25. package/dist/main/app/servers.js +60 -0
  26. package/dist/main/app/ui-extension-targets.d.ts +42 -0
  27. package/dist/main/app/ui-extension-targets.js +101 -0
  28. package/dist/main/app/window-close-reveal.harness.d.ts +34 -0
  29. package/dist/main/app/window-close-reveal.harness.js +65 -0
  30. package/dist/main/app/window-events.d.ts +15 -0
  31. package/dist/main/app/window-events.js +45 -0
  32. package/dist/main/app/window-runtime-services.d.ts +41 -0
  33. package/dist/main/app/window-runtime-services.js +197 -0
  34. package/dist/main/app/workbench-modules.d.ts +24 -0
  35. package/dist/main/app/workbench-modules.js +51 -0
  36. package/dist/main/app/workbench-window.d.ts +85 -0
  37. package/dist/main/app/workbench-window.js +310 -0
  38. package/dist/main/index.bundle.js +11712 -9986
  39. package/dist/main/index.js +49 -1
  40. package/dist/main/ipc/app-lifecycle.d.ts +1 -31
  41. package/dist/main/ipc/app-lifecycle.js +1 -53
  42. package/dist/main/ipc/app.d.ts +4 -1
  43. package/dist/main/ipc/app.js +4 -3
  44. package/dist/main/ipc/bridge-router.d.ts +19 -116
  45. package/dist/main/ipc/bridge-router.js +28 -2128
  46. package/dist/main/ipc/device-picker.d.ts +16 -0
  47. package/dist/main/ipc/device-picker.js +27 -0
  48. package/dist/main/ipc/index.d.ts +5 -0
  49. package/dist/main/ipc/index.js +5 -0
  50. package/dist/main/ipc/internal-devtools.d.ts +16 -0
  51. package/dist/main/ipc/internal-devtools.js +10 -0
  52. package/dist/main/ipc/page-scroll.d.ts +1 -13
  53. package/dist/main/ipc/page-scroll.js +1 -16
  54. package/dist/main/ipc/popover.d.ts +4 -1
  55. package/dist/main/ipc/popover.js +26 -19
  56. package/dist/main/ipc/project-create.d.ts +16 -0
  57. package/dist/main/ipc/project-create.js +27 -0
  58. package/dist/main/ipc/project-fs.d.ts +38 -3
  59. package/dist/main/ipc/project-fs.js +53 -22
  60. package/dist/main/ipc/projects.d.ts +3 -3
  61. package/dist/main/ipc/projects.js +47 -11
  62. package/dist/main/ipc/session-listener-bag.d.ts +1 -40
  63. package/dist/main/ipc/session-listener-bag.js +1 -39
  64. package/dist/main/ipc/session.d.ts +4 -1
  65. package/dist/main/ipc/session.js +26 -26
  66. package/dist/main/ipc/settings.d.ts +4 -1
  67. package/dist/main/ipc/settings.js +17 -19
  68. package/dist/main/ipc/simulator-module.d.ts +9 -3
  69. package/dist/main/ipc/simulator-module.js +13 -10
  70. package/dist/main/ipc/simulator.d.ts +4 -1
  71. package/dist/main/ipc/simulator.js +12 -18
  72. package/dist/main/ipc/tooltip.d.ts +14 -0
  73. package/dist/main/ipc/tooltip.js +29 -0
  74. package/dist/main/ipc/views.d.ts +19 -2
  75. package/dist/main/ipc/views.js +76 -8
  76. package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +43 -0
  77. package/dist/main/runtime/devtools-backend-before-quit.harness.js +87 -0
  78. package/dist/main/runtime/devtools-backend.js +60 -4
  79. package/dist/main/runtime/devtools-runtime-mock.harness.d.ts +21 -0
  80. package/dist/main/runtime/devtools-runtime-mock.harness.js +313 -0
  81. package/dist/main/runtime/miniapp-runtime.d.ts +91 -22
  82. package/dist/main/services/app-services.d.ts +62 -0
  83. package/dist/main/services/app-services.js +64 -0
  84. package/dist/main/services/automation/connection-target.d.ts +36 -0
  85. package/dist/main/services/automation/connection-target.js +29 -0
  86. package/dist/main/services/automation/console-bridge.d.ts +28 -0
  87. package/dist/main/services/automation/console-bridge.js +91 -0
  88. package/dist/main/services/automation/handlers/app.js +4 -4
  89. package/dist/main/services/automation/handlers/element.js +55 -21
  90. package/dist/main/services/automation/index.d.ts +12 -1
  91. package/dist/main/services/automation/index.js +54 -133
  92. package/dist/main/services/cdp-session/index.d.ts +87 -0
  93. package/dist/main/services/cdp-session/index.js +173 -0
  94. package/dist/main/services/compile-standby.js +4 -0
  95. package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
  96. package/dist/main/services/console-forward/cdp-inject.js +30 -0
  97. package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
  98. package/dist/main/services/console-forward/global-console-mirror.js +71 -0
  99. package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
  100. package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
  101. package/dist/main/services/console-forward/index.d.ts +1 -46
  102. package/dist/main/services/console-forward/index.js +1 -185
  103. package/dist/main/services/console-forward/internal-log.d.ts +2 -0
  104. package/dist/main/services/console-forward/internal-log.js +2 -0
  105. package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
  106. package/dist/main/services/console-forward/open-gated-relay.js +55 -0
  107. package/dist/main/services/default-adapter.js +1 -1
  108. package/dist/main/services/diagnostics/index.d.ts +1 -48
  109. package/dist/main/services/diagnostics/index.js +1 -60
  110. package/dist/main/services/dimina-resource-server.d.ts +1 -6
  111. package/dist/main/services/dimina-resource-server.js +1 -98
  112. package/dist/main/services/elements-forward/index.d.ts +132 -15
  113. package/dist/main/services/elements-forward/index.js +155 -304
  114. package/dist/main/services/fs-bridge-protocol.d.ts +61 -0
  115. package/dist/main/services/fs-bridge-protocol.js +34 -0
  116. package/dist/main/services/fs-watch-sse.d.ts +40 -0
  117. package/dist/main/services/fs-watch-sse.js +113 -0
  118. package/dist/main/services/http-json.d.ts +9 -0
  119. package/dist/main/services/http-json.js +6 -0
  120. package/dist/main/services/layout/index.d.ts +11 -0
  121. package/dist/main/services/layout/index.js +23 -0
  122. package/dist/main/services/mcp/connection-owner.d.ts +38 -0
  123. package/dist/main/services/mcp/connection-owner.js +79 -0
  124. package/dist/main/services/mcp/index.d.ts +3 -1
  125. package/dist/main/services/mcp/index.js +4 -3
  126. package/dist/main/services/mcp/opened-project.d.ts +88 -0
  127. package/dist/main/services/mcp/opened-project.js +60 -0
  128. package/dist/main/services/mcp/server.d.ts +2 -1
  129. package/dist/main/services/mcp/server.js +29 -4
  130. package/dist/main/services/mcp/target-manager.d.ts +71 -23
  131. package/dist/main/services/mcp/target-manager.js +269 -138
  132. package/dist/main/services/mcp/target-selection.d.ts +47 -0
  133. package/dist/main/services/mcp/target-selection.js +71 -0
  134. package/dist/main/services/mcp/tools/context-tools.js +20 -5
  135. package/dist/main/services/mcp/tools/project-tools.d.ts +72 -0
  136. package/dist/main/services/mcp/tools/project-tools.js +133 -0
  137. package/dist/main/services/module.d.ts +13 -5
  138. package/dist/main/services/network-forward/body-cache.d.ts +72 -0
  139. package/dist/main/services/network-forward/body-cache.js +179 -0
  140. package/dist/main/services/network-forward/frontend-dispatch.d.ts +91 -0
  141. package/dist/main/services/network-forward/frontend-dispatch.js +148 -0
  142. package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
  143. package/dist/main/services/network-forward/global-body-gate.js +93 -0
  144. package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
  145. package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
  146. package/dist/main/services/network-forward/http.d.ts +47 -0
  147. package/dist/main/services/network-forward/http.js +162 -0
  148. package/dist/main/services/network-forward/index.d.ts +135 -15
  149. package/dist/main/services/network-forward/index.js +854 -224
  150. package/dist/main/services/network-forward/request-ids.d.ts +5 -0
  151. package/dist/main/services/network-forward/request-ids.js +5 -0
  152. package/dist/main/services/network-forward/user-facing.d.ts +21 -0
  153. package/dist/main/services/network-forward/user-facing.js +50 -0
  154. package/dist/main/services/network-forward/websocket.d.ts +36 -0
  155. package/dist/main/services/network-forward/websocket.js +120 -0
  156. package/dist/main/services/notifications/renderer-notifier.d.ts +71 -9
  157. package/dist/main/services/notifications/renderer-notifier.js +45 -8
  158. package/dist/main/services/projects/create-project-service.js +19 -5
  159. package/dist/main/services/projects/local-provider.js +8 -4
  160. package/dist/main/services/projects/project-repository.d.ts +59 -7
  161. package/dist/main/services/projects/project-repository.js +285 -51
  162. package/dist/main/services/projects/types.d.ts +44 -34
  163. package/dist/main/services/render-inspect/index.d.ts +12 -2
  164. package/dist/main/services/render-inspect/index.js +21 -102
  165. package/dist/main/services/safe-area/index.d.ts +21 -6
  166. package/dist/main/services/safe-area/index.js +92 -46
  167. package/dist/main/services/service-host-pool/pool.d.ts +1 -196
  168. package/dist/main/services/service-host-pool/pool.js +1 -363
  169. package/dist/main/services/settings/index.d.ts +7 -1
  170. package/dist/main/services/settings/index.js +22 -2
  171. package/dist/main/services/simulator/custom-apis.d.ts +1 -42
  172. package/dist/main/services/simulator/custom-apis.js +1 -46
  173. package/dist/main/services/simulator/referer.d.ts +1 -9
  174. package/dist/main/services/simulator/referer.js +1 -19
  175. package/dist/main/services/simulator/ui-extensions.d.ts +21 -0
  176. package/dist/main/services/simulator/ui-extensions.js +176 -0
  177. package/dist/main/services/simulator-appdata/index.d.ts +6 -0
  178. package/dist/main/services/simulator-appdata/index.js +21 -2
  179. package/dist/main/services/simulator-current-page/index.d.ts +5 -3
  180. package/dist/main/services/simulator-current-page/index.js +8 -1
  181. package/dist/main/services/simulator-storage/index.d.ts +34 -5
  182. package/dist/main/services/simulator-storage/index.js +73 -71
  183. package/dist/main/services/simulator-storage/service-storage-ops.d.ts +1 -39
  184. package/dist/main/services/simulator-storage/service-storage-ops.js +1 -66
  185. package/dist/main/services/simulator-storage/window-scope.d.ts +20 -0
  186. package/dist/main/services/simulator-storage/window-scope.js +20 -0
  187. package/dist/main/services/simulator-temp-files/disk.d.ts +1 -54
  188. package/dist/main/services/simulator-temp-files/disk.js +1 -237
  189. package/dist/main/services/simulator-temp-files/fs-channels.d.ts +1 -68
  190. package/dist/main/services/simulator-temp-files/fs-channels.js +1 -107
  191. package/dist/main/services/simulator-temp-files/index.d.ts +1 -32
  192. package/dist/main/services/simulator-temp-files/index.js +1 -181
  193. package/dist/main/services/simulator-temp-files/request-handler.d.ts +1 -29
  194. package/dist/main/services/simulator-temp-files/request-handler.js +1 -177
  195. package/dist/main/services/simulator-temp-files/resolver.d.ts +1 -21
  196. package/dist/main/services/simulator-temp-files/resolver.js +1 -21
  197. package/dist/main/services/simulator-temp-files/store.d.ts +1 -13
  198. package/dist/main/services/simulator-temp-files/store.js +1 -23
  199. package/dist/main/services/update/github-release-checker.js +22 -3
  200. package/dist/main/services/update/update-manager.d.ts +21 -4
  201. package/dist/main/services/update/update-manager.js +55 -11
  202. package/dist/main/services/views/clear-console-filter.d.ts +44 -0
  203. package/dist/main/services/views/clear-console-filter.js +86 -0
  204. package/dist/main/services/views/console-filter-test-fixtures.d.ts +94 -0
  205. package/dist/main/services/views/console-filter-test-fixtures.js +82 -0
  206. package/dist/main/services/views/console-filter.d.ts +94 -0
  207. package/dist/main/services/views/console-filter.js +190 -0
  208. package/dist/main/services/views/devtools-tabs.d.ts +24 -4
  209. package/dist/main/services/views/devtools-tabs.js +40 -21
  210. package/dist/main/services/views/frontend-bootstrap-gate.d.ts +59 -0
  211. package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
  212. package/dist/main/services/views/host-dialog-port-channel.d.ts +18 -0
  213. package/dist/main/services/views/host-dialog-port-channel.js +15 -0
  214. package/dist/main/services/views/host-dialog-session-runtime.d.ts +10 -0
  215. package/dist/main/services/views/host-dialog-session-runtime.js +17 -0
  216. package/dist/main/services/views/host-dialog-view.d.ts +95 -0
  217. package/dist/main/services/views/host-dialog-view.js +147 -0
  218. package/dist/main/services/views/host-sidebar-port-channel.d.ts +18 -0
  219. package/dist/main/services/views/host-sidebar-port-channel.js +15 -0
  220. package/dist/main/services/views/host-sidebar-session-runtime.d.ts +10 -0
  221. package/dist/main/services/views/host-sidebar-session-runtime.js +17 -0
  222. package/dist/main/services/views/host-sidebar-view.d.ts +59 -0
  223. package/dist/main/services/views/host-sidebar-view.js +44 -0
  224. package/dist/main/services/views/host-slot-port-channel.d.ts +124 -0
  225. package/dist/main/services/views/host-slot-port-channel.js +289 -0
  226. package/dist/main/services/views/host-slot-session-runtime.d.ts +40 -0
  227. package/dist/main/services/views/host-slot-session-runtime.js +50 -0
  228. package/dist/main/services/views/host-slot-view.d.ts +109 -0
  229. package/dist/main/services/views/host-slot-view.js +147 -0
  230. package/dist/main/services/views/host-toolbar-port-channel.d.ts +6 -91
  231. package/dist/main/services/views/host-toolbar-port-channel.js +10 -243
  232. package/dist/main/services/views/host-toolbar-session-runtime.d.ts +5 -30
  233. package/dist/main/services/views/host-toolbar-session-runtime.js +9 -47
  234. package/dist/main/services/views/host-toolbar-view.d.ts +34 -7
  235. package/dist/main/services/views/host-toolbar-view.js +30 -237
  236. package/dist/main/services/views/managed-web-contents-view.d.ts +48 -0
  237. package/dist/main/services/views/managed-web-contents-view.js +143 -0
  238. package/dist/main/services/views/miniapp-partition.d.ts +1 -89
  239. package/dist/main/services/views/miniapp-partition.js +1 -158
  240. package/dist/main/services/views/native-simulator-devtools-host.js +206 -68
  241. package/dist/main/services/views/native-simulator-view.d.ts +6 -0
  242. package/dist/main/services/views/native-simulator-view.js +47 -40
  243. package/dist/main/services/views/native-view-tree.d.ts +25 -0
  244. package/dist/main/services/views/native-view-tree.js +69 -0
  245. package/dist/main/services/views/overlay-panels-view.d.ts +63 -4
  246. package/dist/main/services/views/overlay-panels-view.js +257 -108
  247. package/dist/main/services/views/placement-reconciler.d.ts +18 -18
  248. package/dist/main/services/views/placement-reconciler.js +91 -29
  249. package/dist/main/services/views/placement-test-driver.d.ts +27 -0
  250. package/dist/main/services/views/placement-test-driver.js +29 -0
  251. package/dist/main/services/views/refresh-styles.d.ts +10 -0
  252. package/dist/main/services/views/refresh-styles.js +57 -0
  253. package/dist/main/services/views/simulator-session-policy.d.ts +1 -27
  254. package/dist/main/services/views/simulator-session-policy.js +1 -98
  255. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
  256. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +184 -0
  257. package/dist/main/services/views/view-manager.d.ts +69 -88
  258. package/dist/main/services/views/view-manager.js +62 -7
  259. package/dist/main/services/views/workbench-view.d.ts +2 -0
  260. package/dist/main/services/views/workbench-view.js +104 -17
  261. package/dist/main/services/window-contexts/context-router.d.ts +36 -0
  262. package/dist/main/services/window-contexts/context-router.js +55 -0
  263. package/dist/main/services/workbench-coi-host.d.ts +52 -0
  264. package/dist/main/services/workbench-coi-host.js +227 -0
  265. package/dist/main/services/workbench-coi-server.d.ts +11 -0
  266. package/dist/main/services/workbench-coi-server.js +126 -126
  267. package/dist/main/services/workbench-coi-shutdown.d.ts +40 -0
  268. package/dist/main/services/workbench-coi-shutdown.js +69 -0
  269. package/dist/main/services/workbench-coi-static.d.ts +23 -0
  270. package/dist/main/services/workbench-coi-static.js +87 -0
  271. package/dist/main/services/workbench-context.d.ts +88 -8
  272. package/dist/main/services/workbench-context.js +54 -6
  273. package/dist/main/services/workspace/compile-log-buffer.d.ts +40 -0
  274. package/dist/main/services/workspace/compile-log-buffer.js +41 -0
  275. package/dist/main/services/workspace/compile-mode-adapter.d.ts +18 -0
  276. package/dist/main/services/workspace/compile-mode-adapter.js +57 -0
  277. package/dist/main/services/workspace/compile-mode-store.d.ts +25 -0
  278. package/dist/main/services/workspace/compile-mode-store.js +71 -0
  279. package/dist/main/services/workspace/open-project-guards.d.ts +16 -0
  280. package/dist/main/services/workspace/open-project-guards.js +42 -0
  281. package/dist/main/services/workspace/rebuild-status.d.ts +37 -0
  282. package/dist/main/services/workspace/rebuild-status.js +36 -0
  283. package/dist/main/services/workspace/session-status-store.d.ts +47 -0
  284. package/dist/main/services/workspace/session-status-store.js +73 -0
  285. package/dist/main/services/workspace/status-tap.d.ts +20 -0
  286. package/dist/main/services/workspace/status-tap.js +32 -0
  287. package/dist/main/services/workspace/workspace-compile-modes.d.ts +59 -0
  288. package/dist/main/services/workspace/workspace-compile-modes.js +93 -0
  289. package/dist/main/services/workspace/workspace-lifecycle-race.testutil.d.ts +22 -0
  290. package/dist/main/services/workspace/workspace-lifecycle-race.testutil.js +62 -0
  291. package/dist/main/services/workspace/workspace-referer.d.ts +17 -0
  292. package/dist/main/services/workspace/workspace-referer.js +26 -0
  293. package/dist/main/services/workspace/workspace-service.d.ts +7 -5
  294. package/dist/main/services/workspace/workspace-service.js +96 -135
  295. package/dist/main/services/workspace/workspace-thumbnails.d.ts +22 -0
  296. package/dist/main/services/workspace/workspace-thumbnails.js +67 -0
  297. package/dist/main/utils/ipc-context-source.d.ts +40 -0
  298. package/dist/main/utils/ipc-context-source.js +23 -0
  299. package/dist/main/utils/ipc-registry.d.ts +46 -21
  300. package/dist/main/utils/ipc-registry.js +166 -76
  301. package/dist/main/utils/paths.d.ts +18 -0
  302. package/dist/main/utils/paths.js +18 -0
  303. package/dist/main/utils/sender-policy.d.ts +10 -1
  304. package/dist/main/utils/sender-policy.js +42 -4
  305. package/dist/main/utils/theme.d.ts +18 -8
  306. package/dist/main/utils/theme.js +19 -9
  307. package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
  308. package/dist/main/windows/internal-devtools-window/index.js +160 -0
  309. package/dist/main/windows/main-window/create.d.ts +16 -0
  310. package/dist/main/windows/main-window/create.js +19 -11
  311. package/dist/main/windows/main-window/events.d.ts +1 -1
  312. package/dist/main/windows/main-window/events.js +26 -13
  313. package/dist/main/windows/main-window/index.d.ts +1 -1
  314. package/dist/main/windows/main-window/index.js +1 -1
  315. package/dist/main/windows/service-host-window/create.d.ts +1 -92
  316. package/dist/main/windows/service-host-window/create.js +1 -154
  317. package/dist/native-host/common/common.js +173 -53
  318. package/dist/native-host/container/pageFrame.css +1 -1
  319. package/dist/native-host/render/render.js +8278 -3659
  320. package/dist/native-host/service/service.js +2 -2
  321. package/dist/preload/index.d.ts +2 -0
  322. package/dist/preload/index.js +1 -0
  323. package/dist/preload/instrumentation/app-data.d.ts +2 -2
  324. package/dist/preload/instrumentation/app-data.js +1 -1
  325. package/dist/preload/instrumentation/wxml.js +1 -1
  326. package/dist/preload/runtime/bridge.d.ts +3 -3
  327. package/dist/preload/runtime/bridge.js +2 -2
  328. package/dist/preload/runtime/clipboard.d.ts +6 -0
  329. package/dist/preload/runtime/clipboard.js +12 -0
  330. package/dist/preload/runtime/host-dialog-advertiser.d.ts +22 -0
  331. package/dist/preload/runtime/host-dialog-advertiser.js +37 -0
  332. package/dist/preload/runtime/host-dialog-port.d.ts +44 -0
  333. package/dist/preload/runtime/host-dialog-port.js +53 -0
  334. package/dist/preload/runtime/host-dialog-runtime.d.ts +28 -0
  335. package/dist/preload/runtime/host-dialog-runtime.js +36 -0
  336. package/dist/preload/runtime/host-sidebar-advertiser.d.ts +19 -0
  337. package/dist/preload/runtime/host-sidebar-advertiser.js +35 -0
  338. package/dist/preload/runtime/host-sidebar-port.d.ts +44 -0
  339. package/dist/preload/runtime/host-sidebar-port.js +53 -0
  340. package/dist/preload/runtime/host-sidebar-runtime.d.ts +28 -0
  341. package/dist/preload/runtime/host-sidebar-runtime.js +36 -0
  342. package/dist/preload/runtime/host-slot-port-bridge.d.ts +18 -0
  343. package/dist/preload/runtime/host-slot-port-bridge.js +112 -0
  344. package/dist/preload/runtime/host-toolbar-advertiser.d.ts +5 -13
  345. package/dist/preload/runtime/host-toolbar-advertiser.js +18 -38
  346. package/dist/preload/runtime/host-toolbar-port.d.ts +9 -0
  347. package/dist/preload/runtime/host-toolbar-port.js +11 -95
  348. package/dist/preload/runtime/native-host.d.ts +14 -0
  349. package/dist/preload/runtime/native-host.js +5 -8
  350. package/dist/preload/runtime/node-bindings.d.ts +18 -0
  351. package/dist/preload/runtime/node-bindings.js +44 -0
  352. package/dist/preload/runtime/temp-files.js +9 -2
  353. package/dist/preload/runtime/wait-for-slot-root.d.ts +23 -0
  354. package/dist/preload/runtime/wait-for-slot-root.js +80 -0
  355. package/dist/preload/shared/api-compat.js +63 -41
  356. package/dist/preload/windows/host-dialog-runtime.cjs +360 -0
  357. package/dist/preload/windows/host-dialog-runtime.cjs.map +7 -0
  358. package/dist/preload/windows/host-dialog-runtime.d.ts +2 -0
  359. package/dist/preload/windows/host-dialog-runtime.js +13 -0
  360. package/dist/preload/windows/host-sidebar-runtime.cjs +361 -0
  361. package/dist/preload/windows/host-sidebar-runtime.cjs.map +7 -0
  362. package/dist/preload/windows/host-sidebar-runtime.d.ts +2 -0
  363. package/dist/preload/windows/host-sidebar-runtime.js +13 -0
  364. package/dist/preload/windows/host-toolbar-runtime.cjs +142 -52
  365. package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
  366. package/dist/preload/windows/main.cjs +4922 -1246
  367. package/dist/preload/windows/main.cjs.map +4 -4
  368. package/dist/preload/windows/main.css +428 -0
  369. package/dist/preload/windows/main.css.map +7 -0
  370. package/dist/preload/windows/simulator.cjs +376 -322
  371. package/dist/preload/windows/simulator.cjs.map +4 -4
  372. package/dist/preload/windows/simulator.js +376 -322
  373. package/dist/render-host/pageFrame.html +4 -4
  374. package/dist/render-host/preload.cjs +30 -0
  375. package/dist/render-host/render-inspect.js +184 -115
  376. package/dist/renderer/assets/button-CB2MWjHY.js +2 -0
  377. package/dist/renderer/assets/constants-CkoGPQTS.js +2 -0
  378. package/dist/renderer/assets/constants-zQZ2-y21.js +2 -0
  379. package/dist/renderer/assets/createLucideIcon-cZ9FlZZw.js +2 -0
  380. package/dist/renderer/assets/devicePicker-H2eIO4e1.js +2 -0
  381. package/dist/renderer/assets/dialog-pHzEA8Vx.js +46 -0
  382. package/dist/renderer/assets/dist-B5HADirS.js +2 -0
  383. package/dist/renderer/assets/dist-DIFlRMKe.js +2 -0
  384. package/dist/renderer/assets/hostSidebarDefault-DRWh6OCt.js +2 -0
  385. package/dist/renderer/assets/index-CEL_XFge.js +2 -0
  386. package/dist/renderer/assets/input-CAObw95L.js +2 -0
  387. package/dist/renderer/assets/ipc-channels-overlays-gIPUFnqc.js +2 -0
  388. package/dist/renderer/assets/jsx-runtime-DICEQH_0.css +1 -0
  389. package/dist/renderer/assets/jsx-runtime-DIw5wnYl.js +9 -0
  390. package/dist/renderer/assets/plus-BQ9u5EbL.js +2 -0
  391. package/dist/renderer/assets/popover-Cw7G2Ctp.js +2 -0
  392. package/dist/renderer/assets/presets-DMZOb9ay.js +2 -0
  393. package/dist/renderer/assets/project-api-YTOr_Yvo.js +2 -0
  394. package/dist/renderer/assets/projectCreateDialog-BmLqiYxn.js +2 -0
  395. package/dist/renderer/assets/search-BMvuYF48.js +2 -0
  396. package/dist/renderer/assets/select-nFP95TxM.js +2 -0
  397. package/dist/renderer/assets/settings-CnpVfSWt.js +2 -0
  398. package/dist/renderer/assets/settings-api-Ccsf-Nsj.js +2 -0
  399. package/dist/renderer/assets/settings-tab-bar-CAzrv32m.js +2 -0
  400. package/dist/renderer/assets/smartphone-Bb2GdIKy.js +2 -0
  401. package/dist/renderer/assets/tabs-CPKN3Mmq.js +2 -0
  402. package/dist/renderer/assets/tooltip-D6AxXRk5.js +2 -0
  403. package/dist/renderer/assets/types-Bh0hA7El.js +2 -0
  404. package/dist/renderer/assets/updateDialog-CwndJ0Bl.js +2 -0
  405. package/dist/renderer/assets/utils-sEB5OZEQ.js +2 -0
  406. package/dist/renderer/assets/view-api-B-2zPBR5.js +2 -0
  407. package/dist/renderer/assets/view-ids-BfaDVV5P.js +2 -0
  408. package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
  409. package/dist/renderer/assets/workbenchSettings-YD0Ctbm_.js +8 -0
  410. package/dist/renderer/entries/device-picker/index.html +28 -0
  411. package/dist/renderer/entries/host-sidebar-default/index.html +22 -0
  412. package/dist/renderer/entries/main/index.html +16 -7
  413. package/dist/renderer/entries/popover/index.html +16 -6
  414. package/dist/renderer/entries/project-create-dialog/index.html +27 -0
  415. package/dist/renderer/entries/settings/index.html +10 -5
  416. package/dist/renderer/entries/tooltip/index.html +21 -0
  417. package/dist/renderer/entries/update-dialog/index.html +25 -0
  418. package/dist/renderer/entries/workbench/index.html +49 -0
  419. package/dist/renderer/entries/workbench-settings/index.html +12 -5
  420. package/dist/service-host/appdata-set-data.cjs +39 -0
  421. package/dist/service-host/host-env-update.cjs +23 -0
  422. package/dist/service-host/preload.cjs +54 -48
  423. package/dist/service-host/service-message-queue.cjs +71 -0
  424. package/dist/service-host/sync-impls/menu-button-geometry.js +16 -5
  425. package/dist/service-host/sync-impls/menu-button.js +5 -3
  426. package/dist/service-host/sync-impls/system-info.js +31 -9
  427. package/dist/shared/bridge-channels.d.ts +1 -416
  428. package/dist/shared/bridge-channels.js +1 -89
  429. package/dist/shared/compile-mode-state.d.ts +73 -0
  430. package/dist/shared/compile-mode-state.js +100 -0
  431. package/dist/shared/compile-modes.d.ts +152 -0
  432. package/dist/shared/compile-modes.js +237 -0
  433. package/dist/shared/constants.d.ts +22 -0
  434. package/dist/shared/constants.js +22 -0
  435. package/dist/shared/dmb-resource-url.d.ts +2 -0
  436. package/dist/shared/dmb-resource-url.js +2 -0
  437. package/dist/shared/ipc-channels-overlays.d.ts +162 -0
  438. package/dist/shared/ipc-channels-overlays.js +203 -0
  439. package/dist/shared/ipc-channels.d.ts +24 -154
  440. package/dist/shared/ipc-channels.js +48 -96
  441. package/dist/shared/ipc-schemas.d.ts +143 -54
  442. package/dist/shared/ipc-schemas.js +137 -45
  443. package/dist/shared/node-bindings.d.ts +2 -0
  444. package/dist/shared/node-bindings.js +2 -0
  445. package/dist/shared/project-window-types.d.ts +42 -0
  446. package/dist/shared/project-window-types.js +2 -0
  447. package/dist/shared/simulator-route.d.ts +8 -0
  448. package/dist/shared/simulator-route.js +15 -0
  449. package/dist/shared/simulator-ui.d.ts +61 -0
  450. package/dist/shared/simulator-ui.js +12 -0
  451. package/dist/shared/types.d.ts +126 -41
  452. package/dist/shared/view-ids.d.ts +10 -0
  453. package/dist/shared/view-ids.js +23 -0
  454. package/dist/simulator/assets/bridge-channels-B3JAmRfl.js +2 -0
  455. package/dist/simulator/assets/device-shell-ATEhHV2_.css +1 -0
  456. package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
  457. package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
  458. package/dist/simulator/assets/simulator-mini-app-DFo7fhi5.js +2 -0
  459. package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
  460. package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
  461. package/dist/simulator/simulator.html +4 -3
  462. package/dist/simulator/temp-files.d.ts +35 -0
  463. package/dist/simulator/temp-files.js +121 -0
  464. package/dist/simulator/types.d.ts +50 -0
  465. package/dist/simulator/types.js +2 -0
  466. package/dist/vscode-workbench/assets/__vite-browser-external-JIkWewFf.js +1 -0
  467. package/dist/vscode-workbench/assets/{dist-TpGpmMGi.js → dist-CXG-u1VB.js} +3 -3
  468. package/dist/vscode-workbench/assets/fs-core-worker-urls-DZ1nod84.js +1 -0
  469. package/dist/vscode-workbench/assets/fs-core.worker-Bnmpp6fo.js +1 -0
  470. package/dist/vscode-workbench/assets/fs-query.worker-cZ-7Fjch.js +2 -0
  471. package/dist/vscode-workbench/assets/{iconv-lite-umd-C9tiCAJa.js → iconv-lite-umd-Dxx9Qyb4.js} +1 -1
  472. package/dist/vscode-workbench/assets/{index-DJ1HyMZ7.js → index-6VJMsaWj.js} +475 -475
  473. package/dist/vscode-workbench/assets/{jschardet-DE1jV513.js → jschardet-Ba3D16vt.js} +1 -1
  474. package/dist/vscode-workbench/index.html +21 -1
  475. package/package.json +23 -13
  476. package/dist/main/services/views/destroy-child-view.d.ts +0 -9
  477. package/dist/main/services/views/destroy-child-view.js +0 -23
  478. package/dist/preload/instrumentation/wxml-extract.d.ts +0 -11
  479. package/dist/preload/instrumentation/wxml-extract.js +0 -382
  480. package/dist/preload/shared/sid-registry.d.ts +0 -11
  481. package/dist/preload/shared/sid-registry.js +0 -38
  482. package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
  483. package/dist/renderer/assets/index-BMqyDx71.js +0 -49
  484. package/dist/renderer/assets/input-CDAEwpBO.js +0 -2
  485. package/dist/renderer/assets/ipc-transport-B7eFOR68.css +0 -1
  486. package/dist/renderer/assets/ipc-transport-_G1k5V1p.js +0 -9
  487. package/dist/renderer/assets/popover-DEdjK14m.js +0 -2
  488. package/dist/renderer/assets/select-DpKPCh3y.js +0 -2
  489. package/dist/renderer/assets/settings-M5q2elUr.js +0 -2
  490. package/dist/renderer/assets/settings-api-CDlZoHiO.js +0 -2
  491. package/dist/renderer/assets/workbenchSettings-CT_H1WhV.js +0 -8
  492. package/dist/shared/appdata-accumulator.d.ts +0 -95
  493. package/dist/shared/appdata-accumulator.js +0 -218
  494. package/dist/shared/request-core.d.ts +0 -84
  495. package/dist/shared/request-core.js +0 -168
  496. package/dist/shared/simulator-api-metadata.d.ts +0 -26
  497. package/dist/shared/simulator-api-metadata.js +0 -59
  498. package/dist/shared/vpath.d.ts +0 -42
  499. package/dist/shared/vpath.js +0 -105
  500. package/dist/simulator/assets/bridge-channels-zhsumfky.js +0 -2
  501. package/dist/simulator/assets/device-shell-C-wcFq3Z.js +0 -2
  502. package/dist/simulator/assets/device-shell-CS1rqAQz.css +0 -1
  503. package/dist/simulator/assets/jsx-runtime-BDTY6fEq.js +0 -2
  504. package/dist/simulator/assets/simulator-DU3-fS3v.js +0 -10
  505. package/dist/simulator/assets/simulator-mini-app-DzfMfnVM.js +0 -2
  506. package/dist/simulator/device-shell/menu-button-geometry.js +0 -8
  507. package/dist/vscode-workbench/assets/__vite-browser-external-CXi6Kz9W.js +0 -1
@@ -1,95 +0,0 @@
1
- /**
2
- * Framework-agnostic AppData accumulator.
3
- *
4
- * The dimina runtime emits two service→render messages relevant to the AppData
5
- * panel, identical in shape on BOTH container paths:
6
- * • update batches `{type:'ub', body:{bridgeId, updates:[{moduleId,data}]}}`
7
- * — each `data` is a partial setData patch.
8
- * • instance init: `type === 'page_*'`, body `{bridgeId, path, data}` with the
9
- * COMPLETE initial state.
10
- *
11
- * Default (dimina-fe) path: the simulator preload sniffs these as Worker
12
- * `message` events (app-data.ts). Native-host path: they flow service→render
13
- * through bridge-router (SERVICE_PUBLISH). Both feed this one accumulator so the
14
- * decode/merge/page-only/init-gate policy can't drift between modes.
15
- */
16
- /**
17
- * The AppData snapshot — the full, cumulative panel state.
18
- *
19
- * - `bridges` lists every page bridge in chronological (insertion) order, each
20
- * carrying its page route (`pagePath`), so renderer tabs render in a stable
21
- * sequence.
22
- * - `entries` maps `bridgeId → (componentPath | moduleId) → setData state`.
23
- */
24
- export interface AppDataSnapshot {
25
- bridges: Array<{
26
- id: string;
27
- pagePath: string | null;
28
- }>;
29
- entries: Record<string, Record<string, unknown>>;
30
- }
31
- export type DecodedEntry = {
32
- mode: 'patch';
33
- bridgeId: string;
34
- moduleId: string;
35
- data: unknown;
36
- } | {
37
- mode: 'init';
38
- bridgeId: string;
39
- moduleId: string;
40
- componentPath: string;
41
- data: Record<string, unknown>;
42
- };
43
- /** Normalized input to the accumulator (built from a DecodedEntry or the hook). */
44
- export interface AppDataInput {
45
- bridgeId?: string;
46
- moduleId?: string;
47
- componentPath?: string;
48
- data?: unknown;
49
- mode?: 'init' | 'patch';
50
- }
51
- /**
52
- * Decode a service→render message into AppData entries, or null when it is not
53
- * AppData-relevant. Policy: surface PAGE entries only — component entries are
54
- * dropped (they sometimes flow on a bridge id distinct from their owning page's
55
- * and never receive pageUnload, which would manifest as ghost tabs).
56
- */
57
- export declare function decodeWorkerMessage(message: unknown): DecodedEntry[] | null;
58
- /** main→worker direction: container signals page teardown so cache can evict. */
59
- export declare function decodeOutgoingMessage(message: unknown): {
60
- type: string;
61
- bridgeId?: string;
62
- } | null;
63
- /** Convert a decoded entry to the normalized accumulator input. */
64
- export declare function decodedToInput(entry: DecodedEntry): AppDataInput;
65
- /**
66
- * Cumulative per-(bridgeId, moduleId) setData state. Pure data structure — no
67
- * Worker / IPC / DOM. Callers own transport (publish/emit) and the automation
68
- * mirror.
69
- */
70
- export declare class AppDataAccumulator {
71
- private readonly cache;
72
- private readonly bridgeOrder;
73
- private readonly bridgePagePath;
74
- private recordBridge;
75
- /**
76
- * Apply one entry. Returns true if it was accepted (a mutation worth
77
- * republishing), false if dropped (missing ids, or the init-gate).
78
- */
79
- apply(input: AppDataInput): boolean;
80
- /** Evict every entry for a bridge (page teardown). */
81
- clearBridge(bridgeId: string): void;
82
- /** The full cumulative snapshot for the panel. */
83
- snapshot(): AppDataSnapshot;
84
- /**
85
- * The current reactive page state for a bridge: shallow-merge of `entry.data`
86
- * across every cache entry whose key starts with `${bridgeId}/`, in insertion
87
- * order (later entries win on key conflicts). `{}` when no entries match
88
- * (unknown bridge / after clearBridge). Pure, no side effects.
89
- */
90
- pageData(bridgeId: string): Record<string, unknown>;
91
- /** Flat `key → data` map for the `__simulatorData.getAppdata()` mirror. */
92
- flat(): Record<string, unknown>;
93
- clear(): void;
94
- }
95
- //# sourceMappingURL=appdata-accumulator.d.ts.map
@@ -1,218 +0,0 @@
1
- /**
2
- * Framework-agnostic AppData accumulator.
3
- *
4
- * The dimina runtime emits two service→render messages relevant to the AppData
5
- * panel, identical in shape on BOTH container paths:
6
- * • update batches `{type:'ub', body:{bridgeId, updates:[{moduleId,data}]}}`
7
- * — each `data` is a partial setData patch.
8
- * • instance init: `type === 'page_*'`, body `{bridgeId, path, data}` with the
9
- * COMPLETE initial state.
10
- *
11
- * Default (dimina-fe) path: the simulator preload sniffs these as Worker
12
- * `message` events (app-data.ts). Native-host path: they flow service→render
13
- * through bridge-router (SERVICE_PUBLISH). Both feed this one accumulator so the
14
- * decode/merge/page-only/init-gate policy can't drift between modes.
15
- */
16
- /** Parse a service/worker message payload; a non-string is passed through as-is. */
17
- function parseMessagePayload(message) {
18
- if (typeof message !== 'string')
19
- return message;
20
- try {
21
- return JSON.parse(message);
22
- }
23
- catch {
24
- return null;
25
- }
26
- }
27
- /**
28
- * Decode a `ub` (update batch) body into patch entries, PAGE modules only —
29
- * component-module updates are dropped (see `decodeWorkerMessage`).
30
- */
31
- function decodeUpdateBatchBody(rawBody) {
32
- const body = rawBody;
33
- if (!body || typeof body !== 'object')
34
- return null;
35
- if (typeof body.bridgeId !== 'string' || !Array.isArray(body.updates))
36
- return null;
37
- const out = [];
38
- for (const u of body.updates) {
39
- if (!u || typeof u.moduleId !== 'string')
40
- continue;
41
- if (!u.moduleId.startsWith('page_'))
42
- continue;
43
- out.push({ mode: 'patch', bridgeId: body.bridgeId, moduleId: u.moduleId, data: u.data });
44
- }
45
- return out.length > 0 ? out : null;
46
- }
47
- /** Decode a `page_*` instance-init body into its single init entry. */
48
- function decodePageInitBody(moduleId, rawBody) {
49
- const body = rawBody;
50
- if (!body || typeof body !== 'object')
51
- return null;
52
- if (typeof body.bridgeId !== 'string' || typeof body.path !== 'string')
53
- return null;
54
- if (!body.data || typeof body.data !== 'object')
55
- return null;
56
- return [{
57
- mode: 'init',
58
- bridgeId: body.bridgeId,
59
- moduleId,
60
- componentPath: body.path,
61
- data: body.data,
62
- }];
63
- }
64
- /**
65
- * Decode a service→render message into AppData entries, or null when it is not
66
- * AppData-relevant. Policy: surface PAGE entries only — component entries are
67
- * dropped (they sometimes flow on a bridge id distinct from their owning page's
68
- * and never receive pageUnload, which would manifest as ghost tabs).
69
- */
70
- export function decodeWorkerMessage(message) {
71
- const payload = parseMessagePayload(message);
72
- if (!payload || typeof payload !== 'object')
73
- return null;
74
- const record = payload;
75
- if (record.type === 'ub')
76
- return decodeUpdateBatchBody(record.body);
77
- if (typeof record.type === 'string' && record.type.startsWith('page_')) {
78
- return decodePageInitBody(record.type, record.body);
79
- }
80
- return null;
81
- }
82
- /** main→worker direction: container signals page teardown so cache can evict. */
83
- export function decodeOutgoingMessage(message) {
84
- const payload = parseMessagePayload(message);
85
- if (!payload || typeof payload !== 'object')
86
- return null;
87
- const r = payload;
88
- if (typeof r.type !== 'string')
89
- return null;
90
- return {
91
- type: r.type,
92
- bridgeId: typeof r.body?.bridgeId === 'string' ? r.body.bridgeId : undefined,
93
- };
94
- }
95
- /** Convert a decoded entry to the normalized accumulator input. */
96
- export function decodedToInput(entry) {
97
- const input = {
98
- bridgeId: entry.bridgeId,
99
- moduleId: entry.moduleId,
100
- data: entry.data,
101
- mode: entry.mode,
102
- };
103
- if (entry.mode === 'init')
104
- input.componentPath = entry.componentPath;
105
- return input;
106
- }
107
- /**
108
- * Cumulative per-(bridgeId, moduleId) setData state. Pure data structure — no
109
- * Worker / IPC / DOM. Callers own transport (publish/emit) and the automation
110
- * mirror.
111
- */
112
- export class AppDataAccumulator {
113
- cache = new Map();
114
- // Bridges in insertion order — drives the `bridges` array (stable tab order).
115
- bridgeOrder = [];
116
- // Page path per bridge: set from `page_*` init's body.path (the page route).
117
- bridgePagePath = new Map();
118
- recordBridge(bridgeId) {
119
- if (!this.bridgeOrder.includes(bridgeId))
120
- this.bridgeOrder.push(bridgeId);
121
- }
122
- /**
123
- * Apply one entry. Returns true if it was accepted (a mutation worth
124
- * republishing), false if dropped (missing ids, or the init-gate).
125
- */
126
- apply(input) {
127
- if (!input.bridgeId || !input.moduleId)
128
- return false;
129
- // Drop ub patches whose bridge has never been initialised. dimina
130
- // dispatches pageUnload → onUnload, whose setData produces a late `ub`
131
- // arriving AFTER clearBridge; without this gate it would resurrect the
132
- // unloaded bridge as a ghost tab.
133
- if (input.mode !== 'init' && !this.bridgePagePath.has(input.bridgeId))
134
- return false;
135
- const key = `${input.bridgeId}/${input.moduleId}`;
136
- const prev = this.cache.get(key);
137
- const incoming = input.data && typeof input.data === 'object'
138
- ? input.data
139
- : {};
140
- // init = full-state replace; patch = merge into previous (setData semantics)
141
- const merged = input.mode === 'init'
142
- ? { ...incoming }
143
- : { ...(prev?.data ?? {}), ...incoming };
144
- const componentPath = input.componentPath ?? prev?.componentPath;
145
- const next = componentPath !== undefined
146
- ? { componentPath, data: merged }
147
- : { data: merged };
148
- this.cache.set(key, next);
149
- this.recordBridge(input.bridgeId);
150
- if (input.mode === 'init' && input.moduleId.startsWith('page_') && input.componentPath) {
151
- this.bridgePagePath.set(input.bridgeId, input.componentPath);
152
- }
153
- return true;
154
- }
155
- /** Evict every entry for a bridge (page teardown). */
156
- clearBridge(bridgeId) {
157
- const prefix = `${bridgeId}/`;
158
- for (const key of [...this.cache.keys()]) {
159
- if (key.startsWith(prefix))
160
- this.cache.delete(key);
161
- }
162
- const idx = this.bridgeOrder.indexOf(bridgeId);
163
- if (idx >= 0)
164
- this.bridgeOrder.splice(idx, 1);
165
- this.bridgePagePath.delete(bridgeId);
166
- }
167
- /** The full cumulative snapshot for the panel. */
168
- snapshot() {
169
- const bridges = [];
170
- for (const id of this.bridgeOrder) {
171
- bridges.push({ id, pagePath: this.bridgePagePath.get(id) ?? null });
172
- }
173
- const entries = {};
174
- for (const [key, entry] of this.cache) {
175
- const slash = key.indexOf('/');
176
- if (slash < 0)
177
- continue;
178
- const bridgeId = key.slice(0, slash);
179
- const moduleId = key.slice(slash + 1);
180
- if (!entries[bridgeId])
181
- entries[bridgeId] = {};
182
- const displayKey = entry.componentPath ?? moduleId;
183
- entries[bridgeId][displayKey] = entry.data;
184
- }
185
- return { bridges, entries };
186
- }
187
- /**
188
- * The current reactive page state for a bridge: shallow-merge of `entry.data`
189
- * across every cache entry whose key starts with `${bridgeId}/`, in insertion
190
- * order (later entries win on key conflicts). `{}` when no entries match
191
- * (unknown bridge / after clearBridge). Pure, no side effects.
192
- */
193
- pageData(bridgeId) {
194
- const merged = {};
195
- for (const [key, entry] of this.cache) {
196
- const slash = key.indexOf('/');
197
- if (slash < 0)
198
- continue;
199
- if (key.slice(0, slash) !== bridgeId)
200
- continue;
201
- Object.assign(merged, entry.data);
202
- }
203
- return merged;
204
- }
205
- /** Flat `key → data` map for the `__simulatorData.getAppdata()` mirror. */
206
- flat() {
207
- const data = {};
208
- for (const [key, entry] of this.cache)
209
- data[key] = entry.data;
210
- return data;
211
- }
212
- clear() {
213
- this.cache.clear();
214
- this.bridgeOrder.length = 0;
215
- this.bridgePagePath.clear();
216
- }
217
- }
218
- //# sourceMappingURL=appdata-accumulator.js.map
@@ -1,84 +0,0 @@
1
- /**
2
- * Single authoritative implementation of wx.request network semantics, shared
3
- * by every request surface (simulator `directRequest`, preload api-compat
4
- * `wx.request` shim). Keeping the semantics in one module is what prevents the
5
- * surfaces from drifting apart on the core contract.
6
- *
7
- * The contract (official wx.request semantics):
8
- * - success vs fail is decided ONLY by whether a server response was
9
- * received. Any HTTP response — 200, 401, 500 — resolves via `success`
10
- * with `{ data, statusCode, header, errMsg: 'request:ok' }`; callers
11
- * branch on `statusCode` (e.g. 401 → re-login).
12
- * - `fail` fires only for network-layer failures and always carries a
13
- * non-empty errMsg: 'request:fail timeout' (deadline hit),
14
- * 'request:fail abort' (caller aborted), 'request:fail <reason>' (DNS/
15
- * connection/protocol errors).
16
- * - `timeout` defaults to 60000ms (the wx default) when omitted or
17
- * non-positive — a request never hangs indefinitely.
18
- * - `dataType` (default 'json') controls body decoding: 'json' attempts
19
- * JSON.parse with raw-text fallback; anything else keeps raw text.
20
- * `responseType: 'arraybuffer'` (or the legacy `dataType: 'arraybuffer'`
21
- * spelling) yields an ArrayBuffer instead.
22
- * - Outgoing headers merge case-insensitively via `Headers` so a caller's
23
- * `content-type` in any casing wins exactly once; the `application/json`
24
- * default applies only when the caller supplied none. Plain-object merges
25
- * would keep both casings as distinct keys and comma-join them on the wire.
26
- * - GET/HEAD serialize object `data` into URL query params (no body);
27
- * other methods send string data verbatim, form-encode objects under
28
- * application/x-www-form-urlencoded, and JSON-encode otherwise.
29
- * - `complete` fires exactly once, after success or fail, with that same
30
- * result object.
31
- *
32
- * Not provided: `cookies` on the success result — fetch() cannot read
33
- * Set-Cookie response headers, so surfacing a fabricated list would lie.
34
- */
35
- export interface RequestSuccessResult {
36
- data: unknown;
37
- statusCode: number;
38
- header: Record<string, string>;
39
- errMsg: 'request:ok';
40
- }
41
- export interface RequestFailResult {
42
- errMsg: string;
43
- errno?: number;
44
- }
45
- export interface RequestHandle {
46
- abort(): void;
47
- }
48
- export interface RequestCoreOptions {
49
- url: string;
50
- data?: unknown;
51
- header?: Record<string, string>;
52
- timeout?: number;
53
- method?: string;
54
- dataType?: string;
55
- responseType?: string;
56
- }
57
- export interface RequestCoreCallbacks {
58
- success?: (res: RequestSuccessResult) => void;
59
- fail?: (err: RequestFailResult) => void;
60
- complete?: (res: RequestSuccessResult | RequestFailResult) => void;
61
- }
62
- /**
63
- * The wx.request default timeout budget. Exported as the single source of
64
- * truth for every layer that reasons about a request's time budget — the
65
- * bridge-router watchdog (apiCallWatchdogMs in simulator-api-metadata.ts)
66
- * derives its window from this so the two cannot drift apart.
67
- */
68
- export declare const DEFAULT_REQUEST_TIMEOUT_MS = 60000;
69
- /**
70
- * Largest delay setTimeout honours (2^31-1 ms). Anything above overflows the
71
- * signed-32-bit timer register and fires ~immediately (~1ms) instead of late —
72
- * so an oversized caller timeout must be rejected, never passed through.
73
- */
74
- export declare const MAX_TIMEOUT_MS = 2147483647;
75
- /**
76
- * Resolve a caller-supplied wx timeout into a usable budget: a finite positive
77
- * number within setTimeout's range is honoured; anything else (absent, 0,
78
- * negative, NaN, Infinity, overflowing) falls back to the wx default. Shared
79
- * by performRequest and the bridge-router watchdog (apiCallWatchdogMs) so the
80
- * two layers can never disagree on what a valid timeout is.
81
- */
82
- export declare function resolveTimeoutBudgetMs(timeout: unknown): number;
83
- export declare function performRequest(opts: RequestCoreOptions, callbacks: RequestCoreCallbacks): RequestHandle;
84
- //# sourceMappingURL=request-core.d.ts.map
@@ -1,168 +0,0 @@
1
- /**
2
- * Single authoritative implementation of wx.request network semantics, shared
3
- * by every request surface (simulator `directRequest`, preload api-compat
4
- * `wx.request` shim). Keeping the semantics in one module is what prevents the
5
- * surfaces from drifting apart on the core contract.
6
- *
7
- * The contract (official wx.request semantics):
8
- * - success vs fail is decided ONLY by whether a server response was
9
- * received. Any HTTP response — 200, 401, 500 — resolves via `success`
10
- * with `{ data, statusCode, header, errMsg: 'request:ok' }`; callers
11
- * branch on `statusCode` (e.g. 401 → re-login).
12
- * - `fail` fires only for network-layer failures and always carries a
13
- * non-empty errMsg: 'request:fail timeout' (deadline hit),
14
- * 'request:fail abort' (caller aborted), 'request:fail <reason>' (DNS/
15
- * connection/protocol errors).
16
- * - `timeout` defaults to 60000ms (the wx default) when omitted or
17
- * non-positive — a request never hangs indefinitely.
18
- * - `dataType` (default 'json') controls body decoding: 'json' attempts
19
- * JSON.parse with raw-text fallback; anything else keeps raw text.
20
- * `responseType: 'arraybuffer'` (or the legacy `dataType: 'arraybuffer'`
21
- * spelling) yields an ArrayBuffer instead.
22
- * - Outgoing headers merge case-insensitively via `Headers` so a caller's
23
- * `content-type` in any casing wins exactly once; the `application/json`
24
- * default applies only when the caller supplied none. Plain-object merges
25
- * would keep both casings as distinct keys and comma-join them on the wire.
26
- * - GET/HEAD serialize object `data` into URL query params (no body);
27
- * other methods send string data verbatim, form-encode objects under
28
- * application/x-www-form-urlencoded, and JSON-encode otherwise.
29
- * - `complete` fires exactly once, after success or fail, with that same
30
- * result object.
31
- *
32
- * Not provided: `cookies` on the success result — fetch() cannot read
33
- * Set-Cookie response headers, so surfacing a fabricated list would lie.
34
- */
35
- /**
36
- * The wx.request default timeout budget. Exported as the single source of
37
- * truth for every layer that reasons about a request's time budget — the
38
- * bridge-router watchdog (apiCallWatchdogMs in simulator-api-metadata.ts)
39
- * derives its window from this so the two cannot drift apart.
40
- */
41
- export const DEFAULT_REQUEST_TIMEOUT_MS = 60_000;
42
- /**
43
- * Largest delay setTimeout honours (2^31-1 ms). Anything above overflows the
44
- * signed-32-bit timer register and fires ~immediately (~1ms) instead of late —
45
- * so an oversized caller timeout must be rejected, never passed through.
46
- */
47
- export const MAX_TIMEOUT_MS = 2_147_483_647;
48
- /**
49
- * Resolve a caller-supplied wx timeout into a usable budget: a finite positive
50
- * number within setTimeout's range is honoured; anything else (absent, 0,
51
- * negative, NaN, Infinity, overflowing) falls back to the wx default. Shared
52
- * by performRequest and the bridge-router watchdog (apiCallWatchdogMs) so the
53
- * two layers can never disagree on what a valid timeout is.
54
- */
55
- export function resolveTimeoutBudgetMs(timeout) {
56
- const t = Number(timeout);
57
- return Number.isFinite(t) && t > 0 && t <= MAX_TIMEOUT_MS ? t : DEFAULT_REQUEST_TIMEOUT_MS;
58
- }
59
- function buildHeaders(header) {
60
- const headers = new Headers();
61
- for (const [key, value] of Object.entries(header ?? {})) {
62
- if (value != null)
63
- headers.set(key, String(value));
64
- }
65
- if (!headers.has('content-type'))
66
- headers.set('content-type', 'application/json');
67
- return headers;
68
- }
69
- function appendQueryParams(url, data) {
70
- // Resolve against the current document when available so page-relative URLs
71
- // keep working in the render-window shim.
72
- const base = typeof location !== 'undefined' ? location.href : undefined;
73
- const resolved = new URL(url, base);
74
- for (const [key, value] of Object.entries(data)) {
75
- resolved.searchParams.append(key, String(value));
76
- }
77
- return resolved.toString();
78
- }
79
- function encodeBody(data, contentType) {
80
- if (typeof data === 'string')
81
- return data;
82
- if (contentType.includes('application/x-www-form-urlencoded')) {
83
- const form = new URLSearchParams();
84
- for (const [key, value] of Object.entries(data)) {
85
- form.append(key, String(value));
86
- }
87
- return form.toString();
88
- }
89
- return JSON.stringify(data);
90
- }
91
- async function decodeResponseData(response, dataType, responseType) {
92
- if (responseType === 'arraybuffer' || dataType === 'arraybuffer') {
93
- return response.arrayBuffer();
94
- }
95
- const text = await response.text();
96
- if (dataType !== 'json')
97
- return text;
98
- try {
99
- return JSON.parse(text);
100
- }
101
- catch {
102
- return text;
103
- }
104
- }
105
- export function performRequest(opts, callbacks) {
106
- const method = (opts.method || 'GET').toUpperCase();
107
- const canHaveBody = method !== 'GET' && method !== 'HEAD';
108
- const headers = buildHeaders(opts.header);
109
- let url = opts.url;
110
- const init = { method, headers };
111
- if (!canHaveBody) {
112
- if (opts.data && typeof opts.data === 'object') {
113
- url = appendQueryParams(url, opts.data);
114
- }
115
- }
116
- else if (opts.data != null) {
117
- init.body = encodeBody(opts.data, headers.get('content-type') ?? '');
118
- }
119
- const controller = new AbortController();
120
- init.signal = controller.signal;
121
- // First verdict wins: a timeout/abort settles the call even though the fetch
122
- // promise is still pending, and the fetch's own late resolution/AbortError
123
- // rejection must not fire a second callback round.
124
- let settled = false;
125
- function settleSuccess(res) {
126
- if (settled)
127
- return;
128
- settled = true;
129
- clearTimeout(timer);
130
- callbacks.success?.(res);
131
- callbacks.complete?.(res);
132
- }
133
- function settleFail(err) {
134
- if (settled)
135
- return;
136
- settled = true;
137
- clearTimeout(timer);
138
- callbacks.fail?.(err);
139
- callbacks.complete?.(err);
140
- }
141
- const timeoutMs = resolveTimeoutBudgetMs(opts.timeout);
142
- const timer = setTimeout(() => {
143
- settleFail({ errMsg: 'request:fail timeout' });
144
- controller.abort();
145
- }, timeoutMs);
146
- const dataType = opts.dataType ?? 'json';
147
- const responseType = opts.responseType ?? 'text';
148
- fetch(url, init)
149
- .then(async (response) => {
150
- const header = {};
151
- response.headers.forEach((value, key) => {
152
- header[key] = value;
153
- });
154
- const data = await decodeResponseData(response, dataType, responseType);
155
- settleSuccess({ data, statusCode: response.status, header, errMsg: 'request:ok' });
156
- })
157
- .catch((error) => {
158
- const reason = error instanceof Error ? error.message : String(error);
159
- settleFail({ errMsg: `request:fail ${reason || 'network error'}` });
160
- });
161
- return {
162
- abort() {
163
- settleFail({ errMsg: 'request:fail abort' });
164
- controller.abort();
165
- },
166
- };
167
- }
168
- //# sourceMappingURL=request-core.js.map
@@ -1,26 +0,0 @@
1
- export declare const PERSISTENT_SIMULATOR_APIS: ReadonlySet<string>;
2
- export declare function isPersistentSimulatorApi(name: string): boolean;
3
- /**
4
- * APIs whose one-shot call legitimately runs as long as the caller's wx
5
- * network timeout budget (`params.timeout`, default 60000ms) — the simulator
6
- * handler answers when the network answers, not within a fixed router window.
7
- */
8
- export declare const NETWORK_BUDGET_SIMULATOR_APIS: ReadonlySet<string>;
9
- /**
10
- * Flat watchdog window for forwarded one-shot calls whose handler is expected
11
- * to answer promptly; it guards against a missing handler / dead seam.
12
- */
13
- export declare const API_CALL_WATCHDOG_MS = 5000;
14
- /**
15
- * How long bridge-router's one-shot "no handler" watchdog waits before
16
- * tearing a forwarded simulator-API call down.
17
- *
18
- * Network-budget APIs get their wx timeout budget plus the flat window as
19
- * forwarding grace: the handler owns the real deadline (performRequest emits
20
- * `request:fail timeout` at the budget), so the watchdog only has to catch
21
- * the case where no verdict ever comes back. A flat 5s window here would
22
- * kill any HTTP call slower than 5s and drop its late — perfectly valid —
23
- * response. Every other API keeps the flat window.
24
- */
25
- export declare function apiCallWatchdogMs(name: string, params: Record<string, unknown> | undefined): number;
26
- //# sourceMappingURL=simulator-api-metadata.d.ts.map
@@ -1,59 +0,0 @@
1
- /**
2
- * Persistent (subscription) simulator APIs — a call that, once made, keeps
3
- * delivering a response on every underlying event instead of settling once.
4
- *
5
- * The dimina service runtime strips `keep` / `evtId` / `success` before the
6
- * call leaves the service host (it stores them service-local in
7
- * `callback.store`), so by the time `audioListen` reaches the container its
8
- * `keep: true` intent is gone and it would degrade to a one-shot call —
9
- * dropping every audio DOM event after the first. The container and router
10
- * therefore recognise these APIs by NAME and treat them as persistent
11
- * regardless of the (stripped) params.
12
- *
13
- * Currently only `audioListen` — the InnerAudioContext DOM-event bridge
14
- * (canplay / play / pause / ended / error / timeupdate / waiting / seeking /
15
- * seeked). Add any new subscription API here: this is the single source of
16
- * truth, consumed by `bridge-router` (skip the one-shot timeout, keep-alive
17
- * responses) and `run-api-async` (no premature settle, re-fire on every event).
18
- */
19
- import { MAX_TIMEOUT_MS, resolveTimeoutBudgetMs } from './request-core.js';
20
- export const PERSISTENT_SIMULATOR_APIS = new Set(['audioListen']);
21
- export function isPersistentSimulatorApi(name) {
22
- return PERSISTENT_SIMULATOR_APIS.has(name);
23
- }
24
- /**
25
- * APIs whose one-shot call legitimately runs as long as the caller's wx
26
- * network timeout budget (`params.timeout`, default 60000ms) — the simulator
27
- * handler answers when the network answers, not within a fixed router window.
28
- */
29
- export const NETWORK_BUDGET_SIMULATOR_APIS = new Set([
30
- 'request',
31
- 'downloadFile',
32
- 'uploadFile',
33
- ]);
34
- /**
35
- * Flat watchdog window for forwarded one-shot calls whose handler is expected
36
- * to answer promptly; it guards against a missing handler / dead seam.
37
- */
38
- export const API_CALL_WATCHDOG_MS = 5_000;
39
- /**
40
- * How long bridge-router's one-shot "no handler" watchdog waits before
41
- * tearing a forwarded simulator-API call down.
42
- *
43
- * Network-budget APIs get their wx timeout budget plus the flat window as
44
- * forwarding grace: the handler owns the real deadline (performRequest emits
45
- * `request:fail timeout` at the budget), so the watchdog only has to catch
46
- * the case where no verdict ever comes back. A flat 5s window here would
47
- * kill any HTTP call slower than 5s and drop its late — perfectly valid —
48
- * response. Every other API keeps the flat window.
49
- */
50
- export function apiCallWatchdogMs(name, params) {
51
- if (!NETWORK_BUDGET_SIMULATOR_APIS.has(name))
52
- return API_CALL_WATCHDOG_MS;
53
- // resolveTimeoutBudgetMs rejects non-finite/oversized caller timeouts, and
54
- // the final clamp keeps budget+grace inside setTimeout's range — an
55
- // overflowing delay would wrap to ~1ms and fire the watchdog immediately.
56
- const budget = resolveTimeoutBudgetMs(params?.timeout);
57
- return Math.min(budget + API_CALL_WATCHDOG_MS, MAX_TIMEOUT_MS);
58
- }
59
- //# sourceMappingURL=simulator-api-metadata.js.map