@dimina-kit/devtools 0.4.0-dev.20260618090552 → 0.4.0-dev.20260624040247
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/README.md +5 -1
- package/dist/main/app/app.js +14 -2
- package/dist/main/index.bundle.js +347 -99
- package/dist/main/ipc/bridge-router.js +13 -8
- package/dist/main/ipc/projects.js +1 -1
- package/dist/main/ipc/simulator.js +1 -1
- package/dist/main/runtime/miniapp-runtime.d.ts +3 -3
- package/dist/main/services/elements-forward/index.js +5 -5
- package/dist/main/services/network-forward/index.d.ts +5 -6
- package/dist/main/services/network-forward/index.js +9 -10
- package/dist/main/services/notifications/renderer-notifier.d.ts +3 -4
- package/dist/main/services/projects/index.js +1 -1
- package/dist/main/services/service-console/console-api.d.ts +5 -6
- package/dist/main/services/service-console/console-api.js +5 -6
- package/dist/main/services/service-host-pool/pool.d.ts +2 -3
- package/dist/main/services/simulator-storage/index.d.ts +2 -4
- package/dist/main/services/simulator-storage/index.js +2 -4
- package/dist/main/services/simulator-temp-files/index.js +2 -2
- package/dist/main/services/views/host-toolbar-session-runtime.d.ts +4 -4
- package/dist/main/services/views/host-toolbar-session-runtime.js +4 -4
- package/dist/main/services/views/view-manager.d.ts +17 -1
- package/dist/main/services/views/view-manager.js +67 -41
- package/dist/main/services/workspace/workspace-service.js +11 -0
- package/dist/main/windows/service-host-window/create.d.ts +1 -0
- package/dist/main/windows/service-host-window/create.js +1 -0
- package/dist/preload/runtime/host-toolbar-port.d.ts +1 -1
- package/dist/preload/runtime/host-toolbar-port.js +1 -1
- package/dist/preload/runtime/host-toolbar-runtime.d.ts +8 -7
- package/dist/preload/runtime/host-toolbar-runtime.js +8 -7
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
- package/dist/preload/windows/main.cjs.map +2 -2
- package/dist/preload/windows/simulator.cjs +1 -1
- package/dist/preload/windows/simulator.cjs.map +1 -1
- package/dist/preload/windows/simulator.js +1 -1
- package/dist/renderer/assets/index-PtsdWlGu.js +50 -0
- package/dist/renderer/entries/main/index.html +1 -1
- package/dist/shared/appdata-accumulator.d.ts +2 -2
- package/dist/shared/appdata-accumulator.js +3 -3
- package/dist/shared/constants.d.ts +1 -1
- package/dist/shared/constants.js +1 -1
- package/dist/shared/ipc-channels.d.ts +3 -3
- package/dist/shared/ipc-channels.js +3 -3
- package/dist/shared/open-in-editor.d.ts +20 -1
- package/dist/shared/open-in-editor.js +246 -3
- package/dist/shared/vpath.d.ts +2 -2
- package/dist/shared/vpath.js +2 -2
- package/dist/simulator/assets/{device-shell-BWX7Yopg.js → device-shell-TtcSXwhb.js} +2 -2
- package/dist/simulator/assets/{simulator-sf-D0mhw.js → simulator-CtyXt_4V.js} +3 -3
- package/dist/simulator/simulator.html +1 -1
- package/package.json +8 -6
- package/dist/renderer/assets/index-DmgWoK8N.js +0 -50
|
@@ -453,7 +453,10 @@ async function handleSpawn(state, ctx, event, opts) {
|
|
|
453
453
|
const appSessionId = bridgeId;
|
|
454
454
|
const simulatorWc = resolveSimulatorWebContents(ctx, opts.simulatorWcId, event.sender);
|
|
455
455
|
const pagePath = normalizePagePath(opts.pagePath || 'pages/index/index');
|
|
456
|
-
const
|
|
456
|
+
const workspaceProjectPath = typeof ctx.workspace.getProjectPath === 'function'
|
|
457
|
+
? ctx.workspace.getProjectPath()
|
|
458
|
+
: '';
|
|
459
|
+
const pkgRoot = path.resolve(opts.pkgRoot || workspaceProjectPath || process.cwd());
|
|
457
460
|
const root = opts.root || 'main';
|
|
458
461
|
// Resource base resolution. Preferred: the simulator-supplied dev-server
|
|
459
462
|
// origin, which statically serves the compiled `<appId>/<root>/…` tree (same
|
|
@@ -505,6 +508,7 @@ async function handleSpawn(state, ctx, event, opts) {
|
|
|
505
508
|
appId,
|
|
506
509
|
pagePath,
|
|
507
510
|
pkgRoot,
|
|
511
|
+
root,
|
|
508
512
|
resourceBaseUrl,
|
|
509
513
|
hostEnvSnapshot: hostEnv,
|
|
510
514
|
});
|
|
@@ -608,6 +612,7 @@ async function handleSpawn(state, ctx, event, opts) {
|
|
|
608
612
|
appId,
|
|
609
613
|
pagePath,
|
|
610
614
|
pkgRoot,
|
|
615
|
+
root,
|
|
611
616
|
resourceBaseUrl,
|
|
612
617
|
hostEnvSnapshot: hostEnv,
|
|
613
618
|
}));
|
|
@@ -1099,13 +1104,13 @@ function makeLoadResource(ap, page, target) {
|
|
|
1099
1104
|
// dimina's service runtime reads hostEnv as `{ systemInfo, menuRect }`
|
|
1100
1105
|
// (core/host-env.js init → getSystemInfo/getMenuRect; invokeAPI resolves
|
|
1101
1106
|
// getSystemInfoSync/getWindowInfo/getDeviceInfo from hostEnv.systemInfo).
|
|
1102
|
-
//
|
|
1103
|
-
// `wx.getSystemInfoSync()`
|
|
1104
|
-
// `.screenWidth`
|
|
1105
|
-
//
|
|
1106
|
-
//
|
|
1107
|
-
// menuRect stays null
|
|
1108
|
-
//
|
|
1107
|
+
// The snapshot must be nested under `systemInfo`: a FLAT HostEnvSnapshot
|
|
1108
|
+
// leaves `systemInfo` null → `wx.getSystemInfoSync()` returns null and
|
|
1109
|
+
// pages reading `.screenWidth` throw. (render does NOT read hostEnv, so
|
|
1110
|
+
// this is service-only; the devtools sync-api-patch reads the separate
|
|
1111
|
+
// __diminaSpawnContext.hostEnvSnapshot and is unaffected.)
|
|
1112
|
+
// menuRect stays null — getMenuButtonBoundingClientRect is served by the
|
|
1113
|
+
// sync-api-patch / DeviceShell capsule, not this path.
|
|
1109
1114
|
hostEnv: { systemInfo: ap.hostEnv, menuRect: null },
|
|
1110
1115
|
},
|
|
1111
1116
|
};
|
|
@@ -49,7 +49,7 @@ export function registerProjectsIpc(ctx) {
|
|
|
49
49
|
const [dirPath] = validate(ProjectsChannel.Remove, ProjectsRemoveSchema, args);
|
|
50
50
|
return ctx.workspace.removeProject(dirPath);
|
|
51
51
|
})
|
|
52
|
-
// ──
|
|
52
|
+
// ── template catalog + create flow ──
|
|
53
53
|
.handle(ProjectsChannel.ListTemplates, () => {
|
|
54
54
|
// Sanitize at the IPC boundary: `generate` is a function and the
|
|
55
55
|
// structured-clone algorithm Electron uses for invoke would otherwise
|
|
@@ -7,7 +7,7 @@ export function registerSimulatorIpc(ctx) {
|
|
|
7
7
|
return new IpcRegistry(ctx.senderPolicy)
|
|
8
8
|
.handle(SimulatorChannel.AttachNative, (_, ...args) => {
|
|
9
9
|
const [simulatorUrl, simWidth] = validate(SimulatorChannel.AttachNative, SimulatorAttachNativeSchema, args);
|
|
10
|
-
ctx.views.attachNativeSimulator(simulatorUrl, simWidth);
|
|
10
|
+
return ctx.views.attachNativeSimulator(simulatorUrl, simWidth);
|
|
11
11
|
})
|
|
12
12
|
.handle(SimulatorChannel.Detach, () => {
|
|
13
13
|
ctx.views.detachSimulator();
|
|
@@ -83,9 +83,9 @@ declare global {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
-
* Host-facing control surface for the toolbar WebContentsView —
|
|
87
|
-
*
|
|
88
|
-
*
|
|
86
|
+
* Host-facing control surface for the toolbar WebContentsView — a
|
|
87
|
+
* message-channel surface (`send`/`onMessage`), with no `webContents` escape
|
|
88
|
+
* hatch (that would put Electron types on the contract).
|
|
89
89
|
*/
|
|
90
90
|
export interface MiniappHostToolbar {
|
|
91
91
|
/**
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* no longer active is dropped (its in-flight command id is settled with an error
|
|
37
37
|
* so the front-end never leaks a pending request, and stale nodes never bleed into
|
|
38
38
|
* the new tree); and switching away and BACK to a previously-wired guest RESUMES
|
|
39
|
-
* its forwarding (a snapshot would strand it
|
|
39
|
+
* its forwarding (a snapshot would strand it).
|
|
40
40
|
*
|
|
41
41
|
* ── Degradation ──────────────────────────────────────────────────────────────
|
|
42
42
|
* Hook unavailable / `DevToolsAPI` missing / no active guest → routing is simply
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
*
|
|
47
47
|
* This is a production feature (no env gate, default on for the native simulator).
|
|
48
48
|
* It deliberately re-implements the small pure helpers it needs (routing table,
|
|
49
|
-
* hook + dispatch scripts)
|
|
49
|
+
* hook + dispatch scripts) as self-contained code.
|
|
50
50
|
*/
|
|
51
51
|
import { webContents as electronWebContents } from 'electron';
|
|
52
52
|
/**
|
|
@@ -198,8 +198,8 @@ export function installElementsForward(deps) {
|
|
|
198
198
|
// bridge per check — NOT a generation snapshot. An event/response is honoured
|
|
199
199
|
// only while its originating guest is still the active one, so switching away
|
|
200
200
|
// and BACK to a previously-wired guest RESUMES its forwarding (a snapshot would
|
|
201
|
-
// strand it forever
|
|
202
|
-
//
|
|
201
|
+
// strand it forever). It also means destroying some OTHER (non-active) guest
|
|
202
|
+
// never stales the active guest's in-flight commands.
|
|
203
203
|
const isActiveWcId = (id) => {
|
|
204
204
|
const a = activeRenderWc();
|
|
205
205
|
return a != null && a.id === id;
|
|
@@ -395,7 +395,7 @@ export function installElementsForward(deps) {
|
|
|
395
395
|
}
|
|
396
396
|
// A destroyed guest is no longer the active one, so its in-flight commands
|
|
397
397
|
// fail `isActiveWcId` and settle as errors on their own — no global bump
|
|
398
|
-
// (which would wrongly stale OTHER, still-active guests' commands
|
|
398
|
+
// (which would wrongly stale OTHER, still-active guests' commands).
|
|
399
399
|
// If we own this wc's session there is nothing left to detach; drop it.
|
|
400
400
|
selfAttached.delete(wc.id);
|
|
401
401
|
};
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* `direct-request.ts`/`simulator-api-network.ts`, which call `fetch()` /
|
|
15
15
|
* `XMLHttpRequest`). Those requests therefore go through the simulator WCV's
|
|
16
16
|
* network stack — a DIFFERENT webContents than the one the DevTools front-end
|
|
17
|
-
* inspects — so they
|
|
18
|
-
*
|
|
17
|
+
* inspects — so they are otherwise invisible in the Network panel. This service
|
|
18
|
+
* surfaces them.
|
|
19
19
|
*
|
|
20
20
|
* ── How it surfaces them (primary sink: native Network tab) ─────────────────
|
|
21
21
|
* We attach the CDP `webContents.debugger` to the simulator WCV, `Network.enable`,
|
|
@@ -32,9 +32,8 @@
|
|
|
32
32
|
* into a namespaced virtual id (`dimina:sim:<epoch>:<rawId>`) before dispatch,
|
|
33
33
|
* keeping a raw→virtual map so redirects / extra-info / completion events on the
|
|
34
34
|
* same request stay correlated. We inject on the MAIN session (no `sessionId`),
|
|
35
|
-
* i.e. the events appear as activity on the currently-inspected target.
|
|
36
|
-
*
|
|
37
|
-
* (`Target.attachedToTarget` + hooking outbound CDP) is explicitly deferred.
|
|
35
|
+
* i.e. the events appear as activity on the currently-inspected target. Child-
|
|
36
|
+
* target routing (`Target.attachedToTarget` + hooking outbound CDP) is deferred.
|
|
38
37
|
*
|
|
39
38
|
* ── Fallback sink (console line) ────────────────────────────────────────────
|
|
40
39
|
* If the DevTools host wc is unavailable, or `window.DevToolsAPI.dispatchMessage`
|
|
@@ -127,7 +126,7 @@ export interface NetworkForwarder extends Disposable {
|
|
|
127
126
|
* Anything carrying a requestId must be namespaced consistently — even methods
|
|
128
127
|
* we don't (yet) forward — so the raw→virtual map stays coherent if forwarding
|
|
129
128
|
* is widened later. `requestServedFromCache` and `resourceChangedPriority` are
|
|
130
|
-
* included for that reason (
|
|
129
|
+
* included for that reason (rewrite-only today, not forwarded).
|
|
131
130
|
*/
|
|
132
131
|
export declare const REWRITE_REQUEST_ID_METHODS: ReadonlySet<string>;
|
|
133
132
|
/** The Network.* methods this one-shot pass forwards to the front-end. */
|
|
@@ -5,7 +5,7 @@ import { DisposableRegistry, toDisposable } from '@dimina-kit/electron-deck/main
|
|
|
5
5
|
* Anything carrying a requestId must be namespaced consistently — even methods
|
|
6
6
|
* we don't (yet) forward — so the raw→virtual map stays coherent if forwarding
|
|
7
7
|
* is widened later. `requestServedFromCache` and `resourceChangedPriority` are
|
|
8
|
-
* included for that reason (
|
|
8
|
+
* included for that reason (rewrite-only today, not forwarded).
|
|
9
9
|
*/
|
|
10
10
|
export const REWRITE_REQUEST_ID_METHODS = new Set([
|
|
11
11
|
'Network.requestWillBeSent',
|
|
@@ -243,10 +243,9 @@ export function createNetworkForwarder(bridge) {
|
|
|
243
243
|
let attachDisposables = null;
|
|
244
244
|
// The DevTools front-end host wc (primary sink), set by the ViewManager.
|
|
245
245
|
let devtoolsWc = null;
|
|
246
|
-
// Teardown for the wc 'destroyed' watcher on the current host (clears the host
|
|
247
|
-
// here, in this file — view-manager is owned by another change and untouched).
|
|
246
|
+
// Teardown for the wc 'destroyed' watcher on the current host (clears the host).
|
|
248
247
|
let devtoolsHostDisposable = null;
|
|
249
|
-
// ── Native-sink state machine
|
|
248
|
+
// ── Native-sink state machine ─────────────────────────────────────────────
|
|
250
249
|
let sink = 'idle';
|
|
251
250
|
// Buffered completed-request records while 'probing' — flushed to console if we
|
|
252
251
|
// degrade, dropped if we go ready (so a request shows in exactly one sink).
|
|
@@ -321,7 +320,7 @@ export function createNetworkForwarder(bridge) {
|
|
|
321
320
|
/** Trim the native queue to its cap, preferring to keep request-opening events.
|
|
322
321
|
* Active requests' first events (requestWillBeSent / ...ExtraInfo) are retained
|
|
323
322
|
* so later responseReceived/loadingFinished never become orphans in the panel;
|
|
324
|
-
* we drop the oldest NON-opening (low-value / completion) events first.
|
|
323
|
+
* we drop the oldest NON-opening (low-value / completion) events first. */
|
|
325
324
|
function trimQueue() {
|
|
326
325
|
if (dispatchQueue.length <= MAX_DISPATCH_QUEUE)
|
|
327
326
|
return;
|
|
@@ -355,15 +354,15 @@ export function createNetworkForwarder(bridge) {
|
|
|
355
354
|
}
|
|
356
355
|
const wc = resolveDevtoolsWc();
|
|
357
356
|
if (!wc) {
|
|
358
|
-
// Host went away mid-flight. Keep the queue bounded (
|
|
357
|
+
// Host went away mid-flight. Keep the queue bounded (the cap applies on
|
|
359
358
|
// EVERY path, not just no-host) and wait — setDevtoolsHost re-arms probing.
|
|
360
359
|
trimQueue();
|
|
361
360
|
return;
|
|
362
361
|
}
|
|
363
362
|
if (sink === 'idle')
|
|
364
363
|
beginProbing();
|
|
365
|
-
// Pack greedily up to MAX_BATCH_CHARS so one executeJavaScript stays sized
|
|
366
|
-
//
|
|
364
|
+
// Pack greedily up to MAX_BATCH_CHARS so one executeJavaScript stays sized;
|
|
365
|
+
// oversized single messages go via the chunked transport.
|
|
367
366
|
const batch = [];
|
|
368
367
|
let batchChars = 0;
|
|
369
368
|
let i = 0;
|
|
@@ -421,7 +420,7 @@ export function createNetworkForwarder(bridge) {
|
|
|
421
420
|
}).catch(() => {
|
|
422
421
|
// wc navigated / torn down mid-call, OR the script overflowed IPC. Re-queue
|
|
423
422
|
// (bounded) and let the next flush re-resolve the host. Best-effort; the
|
|
424
|
-
// ready-timeout still governs giving up.
|
|
423
|
+
// ready-timeout still governs giving up. Backoff is via the retry timer.
|
|
425
424
|
if (sink === 'degraded')
|
|
426
425
|
return;
|
|
427
426
|
dispatchQueue = batch.concat(dispatchQueue);
|
|
@@ -654,7 +653,7 @@ export function createNetworkForwarder(bridge) {
|
|
|
654
653
|
}
|
|
655
654
|
/**
|
|
656
655
|
* Route a completed request to EXACTLY ONE sink, per the native-sink state
|
|
657
|
-
* machine (
|
|
656
|
+
* machine (no double-display):
|
|
658
657
|
* - 'ready' : native path already rendered it → suppress console.
|
|
659
658
|
* - 'degraded' : native abandoned → console.
|
|
660
659
|
* - 'idle' : no host configured → console (the native queue never flushes).
|
|
@@ -39,10 +39,9 @@ export interface WorkbenchSettingsInitPayload {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Unified entry point for every main → renderer event sent by the devtools
|
|
42
|
-
* main process.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* in exactly one place.
|
|
42
|
+
* main process. Instead of calling `someWebContents.send(channel, payload)`
|
|
43
|
+
* directly, every site goes through a typed method here so that channel names,
|
|
44
|
+
* payload shapes and `isDestroyed()` guards live in exactly one place.
|
|
46
45
|
*
|
|
47
46
|
* Methods resolve their target `WebContents` lazily from references provided
|
|
48
47
|
* at call time (or read from the owning context) and silently no-op when the
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// higher-level coordination (session + renderer notifications) lives in
|
|
4
4
|
// ../workspace/workspace-service.ts.
|
|
5
5
|
//
|
|
6
|
-
//
|
|
6
|
+
// The extensibility surface lives in `types.ts` (ProjectsProvider,
|
|
7
7
|
// ProjectTemplate, CreateProjectInput) and `local-provider.ts` (the default
|
|
8
8
|
// implementation injected when the host omits `projectsProvider`).
|
|
9
9
|
export * from './project-repository.js';
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pure helpers for the native-host service-console forwarder.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* stack frame, so Chrome DevTools (attached
|
|
7
|
-
*
|
|
8
|
-
* instead of the developer's source.
|
|
9
|
-
* `Runtime.consoleAPICalled` instead, which preserves native source attribution.
|
|
4
|
+
* The service-host's console is captured via CDP `Runtime.consoleAPICalled`,
|
|
5
|
+
* which preserves native source attribution. A `console.*` monkeypatch in
|
|
6
|
+
* `service-host/preload.cjs` would add a stack frame, so Chrome DevTools (attached
|
|
7
|
+
* natively to the service host) would attribute EVERY service-layer log to the
|
|
8
|
+
* wrapper line instead of the developer's source.
|
|
10
9
|
*
|
|
11
10
|
* These functions turn the CDP event shape into the `GuestConsoleEntry` shape
|
|
12
11
|
* the existing console fan-out (automation `App.logAdded`) expects, WITHOUT any
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pure helpers for the native-host service-console forwarder.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* stack frame, so Chrome DevTools (attached
|
|
7
|
-
*
|
|
8
|
-
* instead of the developer's source.
|
|
9
|
-
* `Runtime.consoleAPICalled` instead, which preserves native source attribution.
|
|
4
|
+
* The service-host's console is captured via CDP `Runtime.consoleAPICalled`,
|
|
5
|
+
* which preserves native source attribution. A `console.*` monkeypatch in
|
|
6
|
+
* `service-host/preload.cjs` would add a stack frame, so Chrome DevTools (attached
|
|
7
|
+
* natively to the service host) would attribute EVERY service-layer log to the
|
|
8
|
+
* wrapper line instead of the developer's source.
|
|
10
9
|
*
|
|
11
10
|
* These functions turn the CDP event shape into the `GuestConsoleEntry` shape
|
|
12
11
|
* the existing console fan-out (automation `App.logAdded`) expects, WITHOUT any
|
|
@@ -7,9 +7,8 @@ import { BrowserWindow } from 'electron';
|
|
|
7
7
|
* (release / releaseDestroyed), opt-in behind `DIMINA_PREWARM_POOL_SIZE`
|
|
8
8
|
* (default OFF). Only the SERVICE-HOST window is pooled; the simulator content
|
|
9
9
|
* WebContentsView (`view-manager.attachNativeSimulator`) is created fresh per
|
|
10
|
-
* attach. (
|
|
11
|
-
*
|
|
12
|
-
* Phase 4 — and that route has since been deleted outright.)
|
|
10
|
+
* attach. (A `<webview>`-tag arch is not poolable — Electron can't reparent a
|
|
11
|
+
* pre-warmed WebContents into a `<webview>`.)
|
|
13
12
|
*
|
|
14
13
|
* Lifecycle of a pool entry:
|
|
15
14
|
* warming — BrowserWindow constructed, page loading
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* SimulatorStorageWatcher
|
|
3
3
|
*
|
|
4
4
|
* Attaches the Chrome DevTools Protocol debugger to the simulator <webview>
|
|
5
|
-
* and forwards `DOMStorage.*` events to the renderer host.
|
|
6
|
-
* preload-side localStorage.setItem hook that used to push storage changes
|
|
7
|
-
* via SimulatorChannel.Storage / StorageAll.
|
|
5
|
+
* and forwards `DOMStorage.*` events to the renderer host.
|
|
8
6
|
*
|
|
9
|
-
* Trade-offs vs
|
|
7
|
+
* Trade-offs vs a preload-side localStorage.setItem hook:
|
|
10
8
|
* + Uses standard browser protocol; no preload injection
|
|
11
9
|
* + Captures every change including ones bypassing wx (api-compat fallback,
|
|
12
10
|
* direct localStorage.setItem from devtools, etc.)
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* SimulatorStorageWatcher
|
|
3
3
|
*
|
|
4
4
|
* Attaches the Chrome DevTools Protocol debugger to the simulator <webview>
|
|
5
|
-
* and forwards `DOMStorage.*` events to the renderer host.
|
|
6
|
-
* preload-side localStorage.setItem hook that used to push storage changes
|
|
7
|
-
* via SimulatorChannel.Storage / StorageAll.
|
|
5
|
+
* and forwards `DOMStorage.*` events to the renderer host.
|
|
8
6
|
*
|
|
9
|
-
* Trade-offs vs
|
|
7
|
+
* Trade-offs vs a preload-side localStorage.setItem hook:
|
|
10
8
|
* + Uses standard browser protocol; no preload injection
|
|
11
9
|
* + Captures every change including ones bypassing wx (api-compat fallback,
|
|
12
10
|
* direct localStorage.setItem from devtools, etc.)
|
|
@@ -155,8 +155,8 @@ export function setupSimulatorTempFiles(simSession) {
|
|
|
155
155
|
installOnSession(simSession);
|
|
156
156
|
// Apply to every per-project miniapp partition session (current + future).
|
|
157
157
|
const unregisterConfigurator = registerMiniappSessionConfigurator((sess) => installOnSession(sess));
|
|
158
|
-
//
|
|
159
|
-
//
|
|
158
|
+
// Renderer FSM → main fs operations bridge. The same simulator-only sender
|
|
159
|
+
// policy applies — registry instance is shared.
|
|
160
160
|
registry.handle('simulator:fs:read', (_event, payload) => handleFsRead(payload));
|
|
161
161
|
registry.handle('simulator:fs:write', (_event, payload) => handleFsWrite(payload));
|
|
162
162
|
registry.handle('simulator:fs:stat', (_event, payload) => handleFsStat(payload));
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Ref-counted registration of the host-toolbar framework runtime on
|
|
3
3
|
* `session.defaultSession`.
|
|
4
4
|
*
|
|
5
|
-
* The toolbar's height advertiser
|
|
6
|
-
* `webPreferences.preload
|
|
7
|
-
*
|
|
5
|
+
* The toolbar's height advertiser does not ride the toolbar WCV's
|
|
6
|
+
* `webPreferences.preload`: a host's `setPreloadPath` would replace it and the
|
|
7
|
+
* strip height would collapse to 0. Instead the runtime bundle
|
|
8
8
|
* (`hostToolbarRuntimePreloadPath`) is registered once per process as a
|
|
9
9
|
* session frame preload; its own guard (`--dimina-host-toolbar` marker +
|
|
10
10
|
* `isMainFrame`) keeps it a zero-footprint no-op in every other defaultSession
|
|
11
11
|
* renderer.
|
|
12
12
|
*
|
|
13
|
-
* Ref-counting
|
|
13
|
+
* Ref-counting: multiple ViewManagers can coexist in one
|
|
14
14
|
* process and share the ONE defaultSession. Each manager acquires at most one
|
|
15
15
|
* reference (on first toolbar need) and releases it in `disposeAll`. Only the
|
|
16
16
|
* first acquire registers; only the last release unregisters (with the id
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Ref-counted registration of the host-toolbar framework runtime on
|
|
3
3
|
* `session.defaultSession`.
|
|
4
4
|
*
|
|
5
|
-
* The toolbar's height advertiser
|
|
6
|
-
* `webPreferences.preload
|
|
7
|
-
*
|
|
5
|
+
* The toolbar's height advertiser does not ride the toolbar WCV's
|
|
6
|
+
* `webPreferences.preload`: a host's `setPreloadPath` would replace it and the
|
|
7
|
+
* strip height would collapse to 0. Instead the runtime bundle
|
|
8
8
|
* (`hostToolbarRuntimePreloadPath`) is registered once per process as a
|
|
9
9
|
* session frame preload; its own guard (`--dimina-host-toolbar` marker +
|
|
10
10
|
* `isMainFrame`) keeps it a zero-footprint no-op in every other defaultSession
|
|
11
11
|
* renderer.
|
|
12
12
|
*
|
|
13
|
-
* Ref-counting
|
|
13
|
+
* Ref-counting: multiple ViewManagers can coexist in one
|
|
14
14
|
* process and share the ONE defaultSession. Each manager acquires at most one
|
|
15
15
|
* reference (on first toolbar need) and releases it in `disposeAll`. Only the
|
|
16
16
|
* first acquire registers; only the last release unregisters (with the id
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { WebContents } from 'electron';
|
|
2
2
|
import type { NativeDeviceInfo } from '../../../shared/ipc-channels.js';
|
|
3
|
+
import { type OpenInEditorRequest } from '../../../shared/open-in-editor.js';
|
|
3
4
|
import { type WorkbenchContext } from '../workbench-context.js';
|
|
4
5
|
import { type HostToolbarMessageSubscription } from './host-toolbar-port-channel.js';
|
|
5
6
|
/**
|
|
@@ -17,6 +18,8 @@ export interface ViewManagerContext {
|
|
|
17
18
|
* `createWorkbenchContext` always supplies it.
|
|
18
19
|
*/
|
|
19
20
|
connections: WorkbenchContext['connections'];
|
|
21
|
+
/** Active project root used to validate/open console source locations. */
|
|
22
|
+
workspace?: WorkbenchContext['workspace'];
|
|
20
23
|
/**
|
|
21
24
|
* Absolute path to the simulator preload bundle. Only consumed by the
|
|
22
25
|
* native-host simulator WebContentsView (`attachNativeSimulator`); the
|
|
@@ -82,7 +85,7 @@ export interface ViewManager {
|
|
|
82
85
|
* `simWidth` rides the wire for schema compatibility but is unused: all
|
|
83
86
|
* geometry is anchor-published.
|
|
84
87
|
*/
|
|
85
|
-
attachNativeSimulator(simulatorUrl: string, simWidth: number): void
|
|
88
|
+
attachNativeSimulator(simulatorUrl: string, simWidth: number): Promise<void>;
|
|
86
89
|
/**
|
|
87
90
|
* Destroy and null out the simulator view (e.g. on simulator detach).
|
|
88
91
|
* Also destroys the cached settings view and hides the popover —
|
|
@@ -106,6 +109,8 @@ export interface ViewManager {
|
|
|
106
109
|
getSimulatorWebContentsId(): number | null;
|
|
107
110
|
/** Return the live webContents of the currently attached simulator, or null. */
|
|
108
111
|
getSimulatorWebContents(): WebContents | null;
|
|
112
|
+
/** Return the active project path bound to the current native simulator. */
|
|
113
|
+
getSimulatorProjectPath(): string | null;
|
|
109
114
|
/** Return the settings overlay's WebContents (for renderer-notifier). */
|
|
110
115
|
getSettingsWebContents(): WebContents | null;
|
|
111
116
|
/** Return the webContents ID of the settings overlay if alive, else null. */
|
|
@@ -277,6 +282,17 @@ export interface HostToolbarControl {
|
|
|
277
282
|
*/
|
|
278
283
|
setHeightMode(mode: HostToolbarHeightMode): void;
|
|
279
284
|
}
|
|
285
|
+
export interface ProjectEditorTarget {
|
|
286
|
+
path: string;
|
|
287
|
+
line?: number;
|
|
288
|
+
column?: number;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Resolve a DevTools source request against the service-host URL that created
|
|
292
|
+
* the inspected app. Its pkgRoot is authoritative; the workspace is only a
|
|
293
|
+
* stale-session consistency guard.
|
|
294
|
+
*/
|
|
295
|
+
export declare function resolveProjectEditorTarget(serviceHostUrl: string, activeProjectRoot: string | undefined, req: OpenInEditorRequest, isFile?: (absolutePath: string) => boolean): ProjectEditorTarget | null;
|
|
280
296
|
/**
|
|
281
297
|
* Build a ViewManager bound to the given context. The returned object is the
|
|
282
298
|
* only component allowed to instantiate or add/remove overlay WebContentsViews.
|