@dimina-kit/devtools 0.4.0-dev.20260718143821 → 0.4.0-dev.20260728065133

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 (68) hide show
  1. package/dist/main/app/app.js +67 -1
  2. package/dist/main/app/lifecycle.js +9 -0
  3. package/dist/main/index.bundle.js +928 -162
  4. package/dist/main/ipc/bridge-router.d.ts +36 -0
  5. package/dist/main/ipc/bridge-router.js +56 -0
  6. package/dist/main/ipc/index.d.ts +1 -0
  7. package/dist/main/ipc/index.js +1 -0
  8. package/dist/main/ipc/internal-devtools.d.ts +15 -0
  9. package/dist/main/ipc/internal-devtools.js +9 -0
  10. package/dist/main/services/compile-standby.js +4 -0
  11. package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
  12. package/dist/main/services/console-forward/cdp-inject.js +30 -0
  13. package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
  14. package/dist/main/services/console-forward/global-console-mirror.js +71 -0
  15. package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
  16. package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
  17. package/dist/main/services/console-forward/index.d.ts +15 -1
  18. package/dist/main/services/console-forward/index.js +42 -2
  19. package/dist/main/services/console-forward/internal-log.d.ts +11 -0
  20. package/dist/main/services/console-forward/internal-log.js +23 -0
  21. package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
  22. package/dist/main/services/console-forward/open-gated-relay.js +55 -0
  23. package/dist/main/services/diagnostics/index.d.ts +10 -0
  24. package/dist/main/services/elements-forward/index.js +14 -96
  25. package/dist/main/services/network-forward/frontend-dispatch.d.ts +64 -0
  26. package/dist/main/services/network-forward/frontend-dispatch.js +113 -8
  27. package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
  28. package/dist/main/services/network-forward/global-body-gate.js +93 -0
  29. package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
  30. package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
  31. package/dist/main/services/network-forward/index.d.ts +31 -0
  32. package/dist/main/services/network-forward/index.js +256 -8
  33. package/dist/main/services/network-forward/user-facing.d.ts +21 -0
  34. package/dist/main/services/network-forward/user-facing.js +50 -0
  35. package/dist/main/services/views/console-filter.d.ts +145 -0
  36. package/dist/main/services/views/console-filter.js +233 -0
  37. package/dist/main/services/views/frontend-bootstrap-gate.d.ts +59 -0
  38. package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
  39. package/dist/main/services/views/native-simulator-devtools-host.js +138 -30
  40. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
  41. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +182 -0
  42. package/dist/main/services/workbench-context.d.ts +10 -0
  43. package/dist/main/utils/theme.d.ts +10 -6
  44. package/dist/main/utils/theme.js +10 -6
  45. package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
  46. package/dist/main/windows/internal-devtools-window/index.js +160 -0
  47. package/dist/native-host/render/render.js +89 -73
  48. package/dist/native-host/service/service.js +2 -2
  49. package/dist/preload/windows/host-toolbar-runtime.cjs.map +1 -1
  50. package/dist/preload/windows/simulator.cjs.map +1 -1
  51. package/dist/renderer/assets/index-M5NDq_vi.js +49 -0
  52. package/dist/renderer/assets/{input-c2OcrrZy.js → input-dsgeTmVX.js} +2 -2
  53. package/dist/renderer/assets/ipc-transport-BgFdT9bT.js +9 -0
  54. package/dist/renderer/assets/{popover-kv2qspWz.js → popover-Disfu1cx.js} +2 -2
  55. package/dist/renderer/assets/{select-DKqzMtTh.js → select-DAw1hzkl.js} +2 -2
  56. package/dist/renderer/assets/{settings-dJNKTGr8.js → settings-M_8GFW2M.js} +2 -2
  57. package/dist/renderer/assets/settings-api-DFR5eDl_.js +2 -0
  58. package/dist/renderer/assets/{workbenchSettings-DQ_VP5-W.js → workbenchSettings-CxdXeoOu.js} +2 -2
  59. package/dist/renderer/entries/main/index.html +5 -5
  60. package/dist/renderer/entries/popover/index.html +4 -4
  61. package/dist/renderer/entries/settings/index.html +4 -4
  62. package/dist/renderer/entries/workbench-settings/index.html +3 -3
  63. package/dist/shared/ipc-channels.d.ts +3 -0
  64. package/dist/shared/ipc-channels.js +6 -0
  65. package/package.json +7 -7
  66. package/dist/renderer/assets/index-DfDIvgvK.js +0 -49
  67. package/dist/renderer/assets/ipc-transport-CuDJ07aE.js +0 -9
  68. package/dist/renderer/assets/settings-api-qpXKDRXt.js +0 -2
@@ -7,6 +7,9 @@ import path from 'path';
7
7
  import { rendererDir as defaultRendererDir, defaultPreloadPath, devtoolsPackageRoot } from '../utils/paths.js';
8
8
  import { installThemeBackgroundSync } from '../utils/theme.js';
9
9
  import { createMainWindow, wireMainWindowEvents } from '../windows/main-window/index.js';
10
+ import { createInternalDevtoolsWindow } from '../windows/internal-devtools-window/index.js';
11
+ import { createGlobalConsoleMirror } from '../services/console-forward/global-console-mirror.js';
12
+ import { createGlobalDiagnosticsMirror } from '../services/console-forward/global-diagnostics-mirror.js';
10
13
  import { isAppQuitting } from './lifecycle.js';
11
14
  import { resolveNativeAppDataKeys, resolveNativeStorageOverview } from './native-overview.js';
12
15
  // eslint-disable-next-line no-restricted-syntax -- grandfathered(workbench-context): shrink-only
@@ -14,7 +17,7 @@ import { createWorkbenchContext } from '../services/workbench-context.js';
14
17
  import { setupCompileWorkerStandby } from '../services/compile-standby.js';
15
18
  import { loadWorkbenchSettings, applyTheme } from '../services/settings/index.js';
16
19
  import { installAppMenu } from '../menu/index.js';
17
- import { registerAppIpc, popoverModule, projectsModule, sessionModule, settingsModule, simulatorModule, } from '../ipc/index.js';
20
+ import { registerAppIpc, registerInternalDevtoolsIpc, popoverModule, projectsModule, sessionModule, settingsModule, simulatorModule, } from '../ipc/index.js';
18
21
  import { startAutomationServer } from '../services/automation/index.js';
19
22
  import { startMcpServer, setNativeHost, setActiveBridgeId, setNativeOverviewProvider, } from '../services/mcp/index.js';
20
23
  import { setupSimulatorStorage } from '../services/simulator-storage/index.js';
@@ -383,6 +386,19 @@ onInstanceCreated) {
383
386
  context.registry.add(registerAppIpc(context));
384
387
  // Sandboxed project file-system IPC (the renderer-side project:fs:* surface).
385
388
  context.registry.add(registerProjectFsIpc(context));
389
+ // Standalone internal (app-wide) DevTools debug window controller — the
390
+ // independent floating CDP panel that debugs the whole Electron app (as
391
+ // opposed to the right-panel CDP, which inspects only the user's
392
+ // mini-program). Assembled before the IPC handler below so a request
393
+ // arriving right after boot always finds it.
394
+ // `isAppQuitting` lets the controller stop intercepting 'close' during a
395
+ // real quit — its habitual preventDefault()+hide() would otherwise cancel
396
+ // the quit itself and strand the process with a hidden window.
397
+ context.internalDevtoolsWindow = createInternalDevtoolsWindow(mainWindow, { isAppQuitting });
398
+ context.registry.add(toDisposable(() => context.internalDevtoolsWindow?.dispose()));
399
+ // Unconditional (not a toggleable BUILTIN_MODULES entry): it's core dev
400
+ // tooling, not a host-configurable feature.
401
+ context.registry.add(registerInternalDevtoolsIpc(context));
386
402
  // Referer/CORS webRequest policy for the simulator runtime's sessions (shared
387
403
  // fallback + every per-project partition). Registered into the context
388
404
  // registry so its configurator + per-session listeners are torn down with the
@@ -398,6 +414,37 @@ onInstanceCreated) {
398
414
  if (!config.adapter)
399
415
  context.registry.add(setupCompileWorkerStandby(context));
400
416
  registerBuiltinModules(config, context);
417
+ // Global console mirror: while the standalone
418
+ // internal DevTools window is open, mirror every guest console entry
419
+ // (service + render, UNFILTERED — see global-console-mirror.ts) into it —
420
+ // each open replays the forwarder's current history buffer first (see that
421
+ // module's doc comment for why the subscribe lifecycle is gated on
422
+ // onHostChanged rather than subscribed once at construction time).
423
+ // `context.consoleForwarder` is assembled by the simulator module's
424
+ // installBridgeRouter just above; absent only when that builtin module was
425
+ // disabled via config. The Console panel shows the INSPECTED target's own
426
+ // console (mainWindow, per internal-devtools-window.ts's
427
+ // setDevToolsWebContents relationship) — NOT the front-end host page's
428
+ // console, so `target` is always mainWindow.webContents, never the hostWc
429
+ // onHostChanged hands the mirror.
430
+ if (context.consoleForwarder && context.internalDevtoolsWindow) {
431
+ const consoleMirror = createGlobalConsoleMirror(context.consoleForwarder, mainWindow.webContents, context.internalDevtoolsWindow.onHostChanged,
432
+ // CDP transport (never executeJavaScript) — see the mirror's inject()
433
+ // doc for the setDevToolsWebContents + external-CDP double-attach hang.
434
+ { broker: context.cdpSessionBroker });
435
+ context.registry.add(toDisposable(() => consoleMirror.dispose()));
436
+ }
437
+ // Global diagnostics mirror (same wiring, same INSPECTED-side
438
+ // target rationale as the console mirror above): every diagnostic —
439
+ // including `audience:'internal'` ones console-forward's own service-host
440
+ // injection now skips (see compile-standby.ts / index.ts's handleDiagnostic
441
+ // gate) — surfaces here instead of vanishing. `context.diagnostics` is
442
+ // assembled alongside `context.consoleForwarder` by the same
443
+ // installBridgeRouter call.
444
+ if (context.diagnostics && context.internalDevtoolsWindow) {
445
+ const diagnosticsMirror = createGlobalDiagnosticsMirror(context.diagnostics, mainWindow.webContents, context.internalDevtoolsWindow.onHostChanged, { broker: context.cdpSessionBroker });
446
+ context.registry.add(toDisposable(() => diagnosticsMirror.dispose()));
447
+ }
401
448
  // Wire the simulator-side difile:// protocol handler + temp-file IPC
402
449
  // before host onSetup so any host-driven simulator boot sees the
403
450
  // protocol live. The module installs its own narrow sender-policy
@@ -534,12 +581,31 @@ onInstanceCreated) {
534
581
  // DevTools host exist; getServiceWc here is the fallback sink target.
535
582
  const networkForward = createNetworkForwarder({
536
583
  getServiceWc: (appId) => context.bridge?.getServiceWc(appId) ?? null,
584
+ getResourceServerBaseUrl: () => context.bridge?.getResourceBaseUrl?.() ?? null,
585
+ // The simulator shell's own static-asset server (serves simulator.html
586
+ // + its JS/CSS, independent from the resource server above — see
587
+ // NetworkForwarderBridge.getSimulatorServerBaseUrl's doc). Host is
588
+ // always 'localhost' — see shared/simulator-route.ts's
589
+ // buildSimulatorUrlFromSpec default. Absent (null port) when no
590
+ // project is open.
591
+ getSimulatorServerBaseUrl: () => {
592
+ const port = context.workspace?.getSession()?.port;
593
+ return typeof port === 'number' ? `http://localhost:${port}/` : null;
594
+ },
537
595
  connections: context.connections,
538
596
  broker: context.cdpSessionBroker,
539
597
  });
540
598
  context.networkForward = networkForward;
541
599
  context.registry.add(networkForward);
542
600
  context.registry.add(() => { context.networkForward = undefined; });
601
+ // Global mirror: once the standalone internal
602
+ // DevTools window builds its own front-end host, mirror the full
603
+ // unfiltered Network stream into it. Attached AFTER context.networkForward
604
+ // is assigned above — the callback re-reads the mutable field on every
605
+ // fire, so ordering only matters for readability here, not correctness.
606
+ context.registry.add(toDisposable(context.internalDevtoolsWindow?.onHostChanged((hostWc) => {
607
+ context.networkForward?.setGlobalDevtoolsHost(hostWc);
608
+ }) ?? (() => { })));
543
609
  context.registry.add(setupSimulatorWxml(mainWindow.webContents, {
544
610
  senderPolicy: context.senderPolicy,
545
611
  bridge: context.bridge,
@@ -4,6 +4,15 @@ import { app, globalShortcut } from 'electron';
4
4
  // BEFORE each window's `close` event, so the main-window onClose handler can
5
5
  // read this to tell "the whole app is exiting" apart from "the user closed a
6
6
  // single project window" and avoid swallowing the quit.
7
+ //
8
+ // Deliberately a ONE-WAY latch: Electron emits no "quit was canceled" signal
9
+ // to reset on, and any heuristic reset (timers, window-created probes) risks
10
+ // flipping back to false DURING a real quit — which would re-arm the very
11
+ // close-interception this flag exists to disable and abort the quit. The
12
+ // cost of staying latched after a hypothetically-canceled quit (no in-repo
13
+ // cancel path exists; a renderer `beforeunload` could in principle create
14
+ // one) is a degraded-but-functional state, strictly cheaper than a broken
15
+ // quit.
7
16
  let appIsQuitting = false;
8
17
  export function isAppQuitting() {
9
18
  return appIsQuitting;