@dimina-kit/devtools 0.4.0-dev.20260718095333 → 0.4.0-dev.20260728063215
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.
- package/dist/main/app/app.d.ts +10 -1
- package/dist/main/app/app.js +78 -2
- package/dist/main/app/lifecycle.d.ts +12 -1
- package/dist/main/app/lifecycle.js +27 -1
- package/dist/main/index.bundle.js +1263 -206
- package/dist/main/index.js +49 -1
- package/dist/main/ipc/bridge-router.d.ts +36 -0
- package/dist/main/ipc/bridge-router.js +56 -0
- package/dist/main/ipc/index.d.ts +1 -0
- package/dist/main/ipc/index.js +1 -0
- package/dist/main/ipc/internal-devtools.d.ts +15 -0
- package/dist/main/ipc/internal-devtools.js +9 -0
- package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +61 -0
- package/dist/main/runtime/devtools-backend-before-quit.harness.js +356 -0
- package/dist/main/runtime/devtools-backend.js +49 -4
- package/dist/main/services/compile-standby.js +4 -0
- package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
- package/dist/main/services/console-forward/cdp-inject.js +30 -0
- package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-console-mirror.js +71 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
- package/dist/main/services/console-forward/index.d.ts +15 -1
- package/dist/main/services/console-forward/index.js +42 -2
- package/dist/main/services/console-forward/internal-log.d.ts +11 -0
- package/dist/main/services/console-forward/internal-log.js +23 -0
- package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
- package/dist/main/services/console-forward/open-gated-relay.js +55 -0
- package/dist/main/services/diagnostics/index.d.ts +10 -0
- package/dist/main/services/elements-forward/index.js +14 -96
- package/dist/main/services/mcp/server.js +24 -2
- package/dist/main/services/network-forward/frontend-dispatch.d.ts +64 -0
- package/dist/main/services/network-forward/frontend-dispatch.js +113 -8
- package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
- package/dist/main/services/network-forward/global-body-gate.js +93 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
- package/dist/main/services/network-forward/index.d.ts +31 -0
- package/dist/main/services/network-forward/index.js +256 -8
- package/dist/main/services/network-forward/user-facing.d.ts +21 -0
- package/dist/main/services/network-forward/user-facing.js +50 -0
- package/dist/main/services/projects/create-project-service.js +10 -3
- package/dist/main/services/update/github-release-checker.js +22 -3
- package/dist/main/services/update/update-manager.d.ts +4 -1
- package/dist/main/services/update/update-manager.js +30 -5
- package/dist/main/services/views/console-filter.d.ts +145 -0
- package/dist/main/services/views/console-filter.js +233 -0
- package/dist/main/services/views/frontend-bootstrap-gate.d.ts +59 -0
- package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
- package/dist/main/services/views/native-simulator-devtools-host.js +138 -30
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +182 -0
- package/dist/main/services/workbench-context.d.ts +10 -0
- package/dist/main/utils/theme.d.ts +10 -6
- package/dist/main/utils/theme.js +10 -6
- package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
- package/dist/main/windows/internal-devtools-window/index.js +160 -0
- package/dist/native-host/render/render.js +89 -73
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +1 -1
- package/dist/preload/windows/simulator.cjs.map +1 -1
- package/dist/renderer/assets/index-M5NDq_vi.js +49 -0
- package/dist/renderer/assets/{input-c2OcrrZy.js → input-dsgeTmVX.js} +2 -2
- package/dist/renderer/assets/ipc-transport-BgFdT9bT.js +9 -0
- package/dist/renderer/assets/{popover-kv2qspWz.js → popover-Disfu1cx.js} +2 -2
- package/dist/renderer/assets/{select-DKqzMtTh.js → select-DAw1hzkl.js} +2 -2
- package/dist/renderer/assets/{settings-dJNKTGr8.js → settings-M_8GFW2M.js} +2 -2
- package/dist/renderer/assets/settings-api-DFR5eDl_.js +2 -0
- package/dist/renderer/assets/{workbenchSettings-DQ_VP5-W.js → workbenchSettings-CxdXeoOu.js} +2 -2
- package/dist/renderer/entries/main/index.html +5 -5
- package/dist/renderer/entries/popover/index.html +4 -4
- package/dist/renderer/entries/settings/index.html +4 -4
- package/dist/renderer/entries/workbench-settings/index.html +3 -3
- package/dist/service-host/sync-impls/menu-button-geometry.js +15 -5
- package/dist/service-host/sync-impls/menu-button.js +5 -3
- package/dist/shared/ipc-channels.d.ts +3 -0
- package/dist/shared/ipc-channels.js +6 -0
- package/dist/simulator/assets/device-shell-Cs-rmP1f.js +2 -0
- package/dist/simulator/assets/device-shell-DOy53Y0s.css +1 -0
- package/dist/simulator/assets/{simulator-Cy8c-eA2.js → simulator-BG-5CADK.js} +3 -3
- package/dist/simulator/device-shell/menu-button-geometry.js +15 -5
- package/dist/simulator/simulator.html +1 -1
- package/package.json +7 -7
- package/dist/renderer/assets/index-U9F8MrtV.js +0 -49
- package/dist/renderer/assets/ipc-transport-CuDJ07aE.js +0 -9
- package/dist/renderer/assets/settings-api-qpXKDRXt.js +0 -2
- package/dist/simulator/assets/device-shell-C-HZY3bL.css +0 -1
- package/dist/simulator/assets/device-shell-Cu1ZPLfe.js +0 -2
package/dist/main/app/app.d.ts
CHANGED
|
@@ -32,5 +32,14 @@ export declare function runDevtoolsBootstrap(config?: WorkbenchAppConfig): void;
|
|
|
32
32
|
* v2 `RuntimeBackend.assemble` reuses the exact same body (parity by shared
|
|
33
33
|
* implementation, not behavioural re-creation).
|
|
34
34
|
*/
|
|
35
|
-
export declare function createDevtoolsRuntime(config?: WorkbenchAppConfig
|
|
35
|
+
export declare function createDevtoolsRuntime(config?: WorkbenchAppConfig,
|
|
36
|
+
/**
|
|
37
|
+
* Fired the instant the `WorkbenchAppInstance` exists — BEFORE `config.onSetup`
|
|
38
|
+
* is awaited below, which may run arbitrarily long host code (including
|
|
39
|
+
* loading the host-toolbar, which opens a live MessagePort). A caller that
|
|
40
|
+
* only learns `instance` from this function's return value would not see it
|
|
41
|
+
* until `onSetup` resolves, leaving a window where an app-quit teardown hook
|
|
42
|
+
* has nothing to dispose yet a live toolbar port already exists.
|
|
43
|
+
*/
|
|
44
|
+
onInstanceCreated?: (instance: WorkbenchAppInstance) => void): Promise<WorkbenchAppInstance>;
|
|
36
45
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/main/app/app.js
CHANGED
|
@@ -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';
|
|
@@ -357,7 +360,16 @@ export function runDevtoolsBootstrap(config = {}) {
|
|
|
357
360
|
* v2 `RuntimeBackend.assemble` reuses the exact same body (parity by shared
|
|
358
361
|
* implementation, not behavioural re-creation).
|
|
359
362
|
*/
|
|
360
|
-
export async function createDevtoolsRuntime(config = {}
|
|
363
|
+
export async function createDevtoolsRuntime(config = {},
|
|
364
|
+
/**
|
|
365
|
+
* Fired the instant the `WorkbenchAppInstance` exists — BEFORE `config.onSetup`
|
|
366
|
+
* is awaited below, which may run arbitrarily long host code (including
|
|
367
|
+
* loading the host-toolbar, which opens a live MessagePort). A caller that
|
|
368
|
+
* only learns `instance` from this function's return value would not see it
|
|
369
|
+
* until `onSetup` resolves, leaving a window where an app-quit teardown hook
|
|
370
|
+
* has nothing to dispose yet a live toolbar port already exists.
|
|
371
|
+
*/
|
|
372
|
+
onInstanceCreated) {
|
|
361
373
|
// Self-gate on Electron readiness: this builds a BrowserWindow immediately, so
|
|
362
374
|
// it must run after `app.whenReady()`. The framework backend path already
|
|
363
375
|
// awaited it (idempotent no-op here); this guards any direct caller against
|
|
@@ -374,6 +386,19 @@ export async function createDevtoolsRuntime(config = {}) {
|
|
|
374
386
|
context.registry.add(registerAppIpc(context));
|
|
375
387
|
// Sandboxed project file-system IPC (the renderer-side project:fs:* surface).
|
|
376
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));
|
|
377
402
|
// Referer/CORS webRequest policy for the simulator runtime's sessions (shared
|
|
378
403
|
// fallback + every per-project partition). Registered into the context
|
|
379
404
|
// registry so its configurator + per-session listeners are torn down with the
|
|
@@ -389,6 +414,37 @@ export async function createDevtoolsRuntime(config = {}) {
|
|
|
389
414
|
if (!config.adapter)
|
|
390
415
|
context.registry.add(setupCompileWorkerStandby(context));
|
|
391
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
|
+
}
|
|
392
448
|
// Wire the simulator-side difile:// protocol handler + temp-file IPC
|
|
393
449
|
// before host onSetup so any host-driven simulator boot sees the
|
|
394
450
|
// protocol live. The module installs its own narrow sender-policy
|
|
@@ -414,6 +470,7 @@ export async function createDevtoolsRuntime(config = {}) {
|
|
|
414
470
|
registerSimulatorApi: (name, handler) => context.registry.add(toDisposable(context.simulatorApis.register(name, handler))),
|
|
415
471
|
dispose: () => disposeContext(context),
|
|
416
472
|
};
|
|
473
|
+
onInstanceCreated?.(instance);
|
|
417
474
|
// Built-in simulator APIs: devtools-supplied wx.* implementations that run
|
|
418
475
|
// in the main process. Hosts can override any of these in their onSetup by
|
|
419
476
|
// re-registering the same name (last-write-wins on the Map).
|
|
@@ -524,12 +581,31 @@ export async function createDevtoolsRuntime(config = {}) {
|
|
|
524
581
|
// DevTools host exist; getServiceWc here is the fallback sink target.
|
|
525
582
|
const networkForward = createNetworkForwarder({
|
|
526
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
|
+
},
|
|
527
595
|
connections: context.connections,
|
|
528
596
|
broker: context.cdpSessionBroker,
|
|
529
597
|
});
|
|
530
598
|
context.networkForward = networkForward;
|
|
531
599
|
context.registry.add(networkForward);
|
|
532
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
|
+
}) ?? (() => { })));
|
|
533
609
|
context.registry.add(setupSimulatorWxml(mainWindow.webContents, {
|
|
534
610
|
senderPolicy: context.senderPolicy,
|
|
535
611
|
bridge: context.bridge,
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
export declare function isAppQuitting(): boolean;
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* `onBeforeQuit`: invoked synchronously, once per `before-quit`, while
|
|
4
|
+
* Electron's main loop is still fully healthy — i.e. BEFORE `will-quit` and
|
|
5
|
+
* any window/WebContentsView destruction. Callers use this to tear down
|
|
6
|
+
* resources (child WebContentsViews, MessagePorts) that are unsafe to let
|
|
7
|
+
* survive into Chromium's native shutdown sequence, where a JS `'destroyed'`
|
|
8
|
+
* handler closing them can hit an already-torn-down native object. Isolated
|
|
9
|
+
* like `host-toolbar-port-channel.ts`'s `invokeReadyHandler`: a throwing
|
|
10
|
+
* callback must not stop `appIsQuitting` from flipping or escape as an
|
|
11
|
+
* uncaught exception out of Electron's event dispatch.
|
|
12
|
+
*/
|
|
13
|
+
export declare function registerAppLifecycle(onBeforeQuit?: () => void): void;
|
|
3
14
|
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -4,11 +4,31 @@ 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;
|
|
10
19
|
}
|
|
11
|
-
|
|
20
|
+
/**
|
|
21
|
+
* `onBeforeQuit`: invoked synchronously, once per `before-quit`, while
|
|
22
|
+
* Electron's main loop is still fully healthy — i.e. BEFORE `will-quit` and
|
|
23
|
+
* any window/WebContentsView destruction. Callers use this to tear down
|
|
24
|
+
* resources (child WebContentsViews, MessagePorts) that are unsafe to let
|
|
25
|
+
* survive into Chromium's native shutdown sequence, where a JS `'destroyed'`
|
|
26
|
+
* handler closing them can hit an already-torn-down native object. Isolated
|
|
27
|
+
* like `host-toolbar-port-channel.ts`'s `invokeReadyHandler`: a throwing
|
|
28
|
+
* callback must not stop `appIsQuitting` from flipping or escape as an
|
|
29
|
+
* uncaught exception out of Electron's event dispatch.
|
|
30
|
+
*/
|
|
31
|
+
export function registerAppLifecycle(onBeforeQuit) {
|
|
12
32
|
app.on('window-all-closed', () => {
|
|
13
33
|
globalShortcut.unregisterAll();
|
|
14
34
|
app.quit();
|
|
@@ -16,6 +36,12 @@ export function registerAppLifecycle() {
|
|
|
16
36
|
app.on('before-quit', () => {
|
|
17
37
|
appIsQuitting = true;
|
|
18
38
|
globalShortcut.unregisterAll();
|
|
39
|
+
try {
|
|
40
|
+
onBeforeQuit?.();
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
console.error('[lifecycle] onBeforeQuit handler threw:', err);
|
|
44
|
+
}
|
|
19
45
|
});
|
|
20
46
|
}
|
|
21
47
|
//# sourceMappingURL=lifecycle.js.map
|