@dimina-kit/devtools 0.4.0-dev.20260616102751 → 0.4.0-dev.20260618090552

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 (40) hide show
  1. package/README.md +25 -24
  2. package/dist/main/index.bundle.js +212 -12
  3. package/dist/main/ipc/bridge-router.js +44 -1
  4. package/dist/main/runtime/devtools-backend.d.ts +1 -1
  5. package/dist/main/runtime/devtools-backend.js +1 -1
  6. package/dist/main/runtime/miniapp-runtime.d.ts +2 -2
  7. package/dist/main/services/console-forward/index.js +8 -1
  8. package/dist/main/services/elements-forward/index.js +31 -7
  9. package/dist/main/services/layout/index.d.ts +12 -0
  10. package/dist/main/services/layout/index.js +14 -2
  11. package/dist/main/services/projects/types.d.ts +1 -1
  12. package/dist/main/services/projects/types.js +1 -1
  13. package/dist/main/services/service-console/console-api.d.ts +78 -0
  14. package/dist/main/services/service-console/console-api.js +104 -0
  15. package/dist/main/services/service-console/index.d.ts +47 -0
  16. package/dist/main/services/service-console/index.js +139 -0
  17. package/dist/main/services/update/update-manager.d.ts +1 -1
  18. package/dist/main/services/update/update-manager.js +1 -1
  19. package/dist/main/services/views/view-manager.d.ts +7 -0
  20. package/dist/main/services/views/view-manager.js +53 -0
  21. package/dist/main/services/workbench-context.d.ts +7 -6
  22. package/dist/renderer/assets/index-DmgWoK8N.js +50 -0
  23. package/dist/renderer/assets/{input-B8NDCYv3.js → input-DiCxYlqY.js} +2 -2
  24. package/dist/renderer/assets/{ipc-transport-DhrajiC5.js → ipc-transport-DSBmaWpJ.js} +1 -1
  25. package/dist/renderer/assets/ipc-transport-DZxf2YoM.css +1 -0
  26. package/dist/renderer/assets/{popover-DbZOg03s.js → popover-CyL_uffj.js} +2 -2
  27. package/dist/renderer/assets/{select-pW3Ysc9T.js → select-BSwvDMtA.js} +2 -2
  28. package/dist/renderer/assets/settings-Ch8XbFxf.js +2 -0
  29. package/dist/renderer/assets/{settings-api-BSKzKiWd.js → settings-api-e9ILe2JO.js} +2 -2
  30. package/dist/renderer/assets/{workbenchSettings-BGxjl25x.js → workbenchSettings-DZsHf1g_.js} +2 -2
  31. package/dist/renderer/entries/main/index.html +6 -6
  32. package/dist/renderer/entries/popover/index.html +5 -5
  33. package/dist/renderer/entries/settings/index.html +11 -5
  34. package/dist/renderer/entries/workbench-settings/index.html +4 -4
  35. package/dist/service-host/preload.cjs +13 -15
  36. package/dist/service-host/sourcemap-rewrite.cjs +21 -12
  37. package/package.json +4 -4
  38. package/dist/renderer/assets/index-Z4Rh52G8.js +0 -50
  39. package/dist/renderer/assets/ipc-transport-9agi76dX.css +0 -1
  40. package/dist/renderer/assets/settings-CZJOHt8b.js +0 -2
@@ -5,12 +5,18 @@
5
5
  <!-- See main/index.html for CSP rationale. -->
6
6
  <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:;" />
7
7
  <title>Settings</title>
8
- <script type="module" crossorigin src="../../assets/settings-CZJOHt8b.js"></script>
8
+ <style>
9
+ /* The view spans the full content area as a transparent backdrop (only the
10
+ panel is opaque) so a click outside the panel reaches the backdrop and
11
+ closes the overlay — mirrors the popover entry. */
12
+ html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: transparent !important; }
13
+ </style>
14
+ <script type="module" crossorigin src="../../assets/settings-Ch8XbFxf.js"></script>
9
15
  <link rel="modulepreload" crossorigin href="../../assets/chunk-DPI0Y_ll.js">
10
- <link rel="modulepreload" crossorigin href="../../assets/ipc-transport-DhrajiC5.js">
11
- <link rel="modulepreload" crossorigin href="../../assets/input-B8NDCYv3.js">
12
- <link rel="modulepreload" crossorigin href="../../assets/settings-api-BSKzKiWd.js">
13
- <link rel="stylesheet" crossorigin href="../../assets/ipc-transport-9agi76dX.css">
16
+ <link rel="modulepreload" crossorigin href="../../assets/ipc-transport-DSBmaWpJ.js">
17
+ <link rel="modulepreload" crossorigin href="../../assets/input-DiCxYlqY.js">
18
+ <link rel="modulepreload" crossorigin href="../../assets/settings-api-e9ILe2JO.js">
19
+ <link rel="stylesheet" crossorigin href="../../assets/ipc-transport-DZxf2YoM.css">
14
20
  </head>
15
21
  <body>
16
22
  <div id="root"></div>
@@ -6,12 +6,12 @@
6
6
  <!-- See entries/main/index.html for CSP rationale. -->
7
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:;" />
8
8
  <title>开发工具设置</title>
9
- <script type="module" crossorigin src="../../assets/workbenchSettings-BGxjl25x.js"></script>
9
+ <script type="module" crossorigin src="../../assets/workbenchSettings-DZsHf1g_.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="../../assets/chunk-DPI0Y_ll.js">
11
- <link rel="modulepreload" crossorigin href="../../assets/ipc-transport-DhrajiC5.js">
12
- <link rel="modulepreload" crossorigin href="../../assets/settings-api-BSKzKiWd.js">
11
+ <link rel="modulepreload" crossorigin href="../../assets/ipc-transport-DSBmaWpJ.js">
12
+ <link rel="modulepreload" crossorigin href="../../assets/settings-api-e9ILe2JO.js">
13
13
  <link rel="modulepreload" crossorigin href="../../assets/constants-DI382mTP.js">
14
- <link rel="stylesheet" crossorigin href="../../assets/ipc-transport-9agi76dX.css">
14
+ <link rel="stylesheet" crossorigin href="../../assets/ipc-transport-DZxf2YoM.css">
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -192,14 +192,21 @@ ipcRenderer.on(CHANNELS.TO_SERVICE, (_event, payload) => {
192
192
  deliver(payload && payload.msg)
193
193
  })
194
194
 
195
- // ── Console capture (native-host) ───────────────────────────────────────────
195
+ // ── Uncaught error capture (native-host) ────────────────────────────────────
196
196
  // Placed AFTER the no-bridgeId early-return (pool warming) and AFTER
197
197
  // DiminaServiceBridge is defined, so it only runs for a real spawn and can use
198
- // the bridge. This preload runs with contextIsolation effectively off, so
199
- // patching `console` here captures the service guest's own console (wx.* +
200
- // logic.js). Each entry is forwarded to main as a `consoleLog` container message
201
- // (source:'service') bridge-router routes it to ctx.guestConsole → automation
202
- // rebroadcasts it as App.logAdded. Mirrors src/preload/instrumentation/console.ts.
198
+ // the bridge.
199
+ //
200
+ // NOTE: `console.*` is deliberately NOT patched here. A wrapper adds a stack
201
+ // frame, so the embedded Chrome DevTools (attached natively to this service
202
+ // host) would attribute every log to the wrapper line instead of the
203
+ // developer's source. Service-layer console output is captured in main via CDP
204
+ // `Runtime.consoleAPICalled` (services/service-console) — no extra frame, native
205
+ // attribution + sourcemaps preserved. Only WINDOW error / unhandledrejection
206
+ // events are posted here: they carry no console call site to preserve and CDP's
207
+ // `consoleAPICalled` does not report them. Each is forwarded to main as a
208
+ // `consoleLog` container message (source:'service') → bridge-router →
209
+ // ctx.guestConsole → automation `App.logAdded`.
203
210
 
204
211
  function safeSerializeArg(val) {
205
212
  if (val === null || val === undefined) return val
@@ -230,15 +237,6 @@ function emitConsoleLog(level, args) {
230
237
  } catch (_) { /* never let console capture break the guest */ }
231
238
  }
232
239
 
233
- ;['log', 'warn', 'error', 'info', 'debug'].forEach((level) => {
234
- const original = typeof console[level] === 'function' ? console[level].bind(console) : null
235
- if (!original) return
236
- console[level] = (...args) => {
237
- original(...args)
238
- emitConsoleLog(level, args)
239
- }
240
- })
241
-
242
240
  globalThis.addEventListener('error', (event) => {
243
241
  emitConsoleLog('error', [{
244
242
  message: event.message,
@@ -5,18 +5,27 @@
5
5
  * ABSOLUTE URL resolved against the script's own fetch URL.
6
6
  *
7
7
  * Why this exists (native-host console file links):
8
- * The service host loads each compiled `logic.js` via the `importScripts`
9
- * shim in preload.cjs a synchronous XHR + `(0, eval)(...)`. The compiled
10
- * bundle ships a RELATIVE `//# sourceMappingURL=logic.js.map`
11
- * (compiler/core/logic-compiler.js). A real Web Worker `importScripts(url)`
12
- * gives the script the dev-server URL as its base, so DevTools resolves the
13
- * relative map against `…/{appId}/{root}/logic.js` and fetches the right
14
- * `.map`. Under `(0, eval)(...)` the script has NO base URL of its own, so
15
- * DevTools resolves a relative `sourceMappingURL` against the service-host
16
- * DOCUMENT (`file://…/service-host/service.html`) and 404s console
17
- * file:line links then point at the compiled bundle, not the developer's
18
- * original source. Rewriting the directive to an absolute dev-server URL
19
- * restores sourcemapped console frames + Sources links.
8
+ * The compiled `logic.js` ships a RELATIVE `//# sourceMappingURL=logic.js.map`
9
+ * (compiler/core/logic-compiler.js). Whoever injects it must give DevTools a
10
+ * resolvable base for that relative map, or DevTools resolves it against the
11
+ * service-host DOCUMENT (`file://…/service-host/service.html`) and 404s
12
+ * console file:line links then point at the compiled bundle, not the
13
+ * developer's original source. Rewriting the directive to an absolute
14
+ * dev-server URL restores sourcemapped console frames + Sources links.
15
+ *
16
+ * Consumer: the `importScripts` shim in preload.cjs below (this file is COPIED,
17
+ * not bundled, so a plain relative `require('./sourcemap-rewrite.cjs')` works).
18
+ * The main process needs the same rewrite in `bridge-router.injectLogicBundle`
19
+ * but keeps its OWN inlined copy there — the shipped main entry is the flat
20
+ * esbuild bundle and a runtime `require` of this relative path resolved wrong
21
+ * against the bundle location (crashed the packaged app). KEEP THE TWO IN SYNC.
22
+ *
23
+ * Legacy consumer (web-worker render only): the `importScripts` shim in
24
+ * preload.cjs (synchronous XHR + `(0, eval)(...)`). Under native-host the
25
+ * service host is a BrowserWindow, not a Web Worker (`isWebWorker` false), so
26
+ * that shim never runs — kept for the worker render path. A real
27
+ * `importScripts(url)` would base the relative map on the script URL itself,
28
+ * but `(0, eval)(...)` does not, hence the same rewrite applies there too.
20
29
  *
21
30
  * Contract:
22
31
  * - Operates on the LAST `//# sourceMappingURL=` (or legacy `//@`) directive
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimina-kit/devtools",
3
- "version": "0.4.0-dev.20260616102751",
3
+ "version": "0.4.0-dev.20260618090552",
4
4
  "description": "Dimina DevTools - modular developer tools for mini app debugging",
5
5
  "keywords": [
6
6
  "dimina",
@@ -86,9 +86,9 @@
86
86
  "monaco-editor": "^0.55.1",
87
87
  "ws": "^8.20.0",
88
88
  "zod": "^4.3.6",
89
- "@dimina-kit/devkit": "0.1.2-dev.20260616102751",
90
- "@dimina-kit/view-anchor": "0.1.0-dev.20260616102751",
91
- "@dimina-kit/electron-deck": "0.1.0-dev.20260616102751"
89
+ "@dimina-kit/devkit": "0.1.2-dev.20260618090552",
90
+ "@dimina-kit/view-anchor": "0.1.0-dev.20260618090552",
91
+ "@dimina-kit/electron-deck": "0.1.0-dev.20260618090552"
92
92
  },
93
93
  "devDependencies": {
94
94
  "@playwright/test": "^1.59.1",