@dimina-kit/devtools 0.3.2-dev.20260610082053 → 0.3.2-dev.20260610114009
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.js +8 -1
- package/dist/main/index.bundle.js +286 -161
- package/dist/main/ipc/bridge-router.js +36 -3
- package/dist/main/ipc/simulator.js +1 -21
- package/dist/main/services/simulator-temp-files/index.js +38 -16
- package/dist/main/services/views/miniapp-partition.d.ts +80 -0
- package/dist/main/services/views/miniapp-partition.js +138 -0
- package/dist/main/services/views/simulator-session-policy.d.ts +28 -0
- package/dist/main/services/views/simulator-session-policy.js +82 -0
- package/dist/main/services/views/view-manager.js +22 -9
- package/dist/main/windows/main-window/create.js +1 -27
- package/dist/main/windows/service-host-window/create.d.ts +19 -4
- package/dist/main/windows/service-host-window/create.js +34 -8
- package/dist/preload/windows/main.cjs.map +1 -1
- package/dist/preload/windows/simulator.cjs.map +1 -1
- package/dist/service-host/sync-impls/menu-button-geometry.js +8 -0
- package/dist/service-host/sync-impls/menu-button.js +1 -1
- package/dist/shared/bridge-channels.d.ts +14 -0
- package/dist/shared/bridge-channels.js +27 -0
- package/dist/simulator/assets/{device-shell-vwYSOVrh.js → device-shell-fH2cI-3q.js} +2 -2
- package/dist/simulator/assets/{simulator-DddliUL5.js → simulator-DHylZf9Z.js} +3 -3
- package/dist/simulator/simulator.html +1 -1
- package/package.json +8 -7
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { BrowserWindow } from 'electron';
|
|
2
2
|
import type { ServiceHostSpec } from '../../services/service-host-pool/pool.js';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Default service-host partition when no project `appId` is supplied (the
|
|
5
|
+
* pre-warm pool's shared, isolation-UNAWARE session — see `serviceHostSpec`).
|
|
6
|
+
* Per-project service hosts get a `persist:miniapp-<key>` partition instead so
|
|
7
|
+
* their localStorage/cookies are shared with that project's render side only.
|
|
8
|
+
*/
|
|
4
9
|
export declare const SERVICE_HOST_PARTITION = "persist:simulator";
|
|
5
10
|
/** Absolute path to the service-host preload (loaded at runtime by path). */
|
|
6
11
|
export declare const serviceHostPreloadPath: string;
|
|
@@ -40,10 +45,20 @@ export declare function navigateServiceHost(win: BrowserWindow, url: string): Pr
|
|
|
40
45
|
/**
|
|
41
46
|
* The spec a `ServiceHostPool` uses to pre-warm service-host windows. Keeps the
|
|
42
47
|
* pooled window byte-equivalent to `constructServiceHostWindow`'s output, and
|
|
43
|
-
* opts out of the reset storage-clear because the service host shares
|
|
44
|
-
*
|
|
48
|
+
* opts out of the reset storage-clear because the service host shares its
|
|
49
|
+
* session with live projects (see ServiceHostSpec docs).
|
|
50
|
+
*
|
|
51
|
+
* KNOWN BLOCKER (intentional): the pre-warm pool is NOT per-project isolation
|
|
52
|
+
* aware. It warms windows on ONE `defaultSpec` partition before any project is
|
|
53
|
+
* known, so a pooled window cannot carry a project-derived partition — handing
|
|
54
|
+
* one project's warmed window to another project would cross-contaminate
|
|
55
|
+
* storage. Therefore the pool's `defaultSpec` (and pooled `acquire`) call this
|
|
56
|
+
* with NO appId → the shared `persist:simulator` partition; per-project
|
|
57
|
+
* isolation only applies on the default (non-pooled) `createServiceHostWindow`
|
|
58
|
+
* path, which passes the project's appId. Reconciling pooling with per-project
|
|
59
|
+
* partitions (e.g. per-partition sub-pools) is out of scope for this change.
|
|
45
60
|
*/
|
|
46
|
-
export declare function serviceHostSpec(): ServiceHostSpec;
|
|
61
|
+
export declare function serviceHostSpec(appId?: string): ServiceHostSpec;
|
|
47
62
|
/**
|
|
48
63
|
* Construct + navigate a fresh service-host window (the non-pool path).
|
|
49
64
|
* Behavior-identical to the pre-refactor implementation.
|
|
@@ -2,8 +2,14 @@ import { app, BrowserWindow } from 'electron';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { pathToFileURL } from 'node:url';
|
|
4
4
|
import { devtoolsPackageRoot } from '../../utils/paths.js';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { configureMiniappSession, miniappPartition, SHARED_MINIAPP_PARTITION } from '../../services/views/miniapp-partition.js';
|
|
6
|
+
/**
|
|
7
|
+
* Default service-host partition when no project `appId` is supplied (the
|
|
8
|
+
* pre-warm pool's shared, isolation-UNAWARE session — see `serviceHostSpec`).
|
|
9
|
+
* Per-project service hosts get a `persist:miniapp-<key>` partition instead so
|
|
10
|
+
* their localStorage/cookies are shared with that project's render side only.
|
|
11
|
+
*/
|
|
12
|
+
export const SERVICE_HOST_PARTITION = SHARED_MINIAPP_PARTITION;
|
|
7
13
|
/** Absolute path to the service-host preload (loaded at runtime by path). */
|
|
8
14
|
export const serviceHostPreloadPath = path.join(devtoolsPackageRoot, 'dist/service-host/preload.cjs');
|
|
9
15
|
const serviceHostHtmlPath = path.join(devtoolsPackageRoot, 'dist/service-host/service.html');
|
|
@@ -16,13 +22,17 @@ const serviceHostHtmlPath = path.join(devtoolsPackageRoot, 'dist/service-host/se
|
|
|
16
22
|
* globals onto the page realm).
|
|
17
23
|
*/
|
|
18
24
|
export function constructServiceHostWindow(opts = {}) {
|
|
25
|
+
const partition = opts.partition ?? SERVICE_HOST_PARTITION;
|
|
26
|
+
// Apply the simulator runtime's protocol handlers + webRequest policies to
|
|
27
|
+
// THIS project's session before the window loads. Idempotent per partition.
|
|
28
|
+
configureMiniappSession(partition);
|
|
19
29
|
return new BrowserWindow({
|
|
20
30
|
width: 980,
|
|
21
31
|
height: 720,
|
|
22
32
|
show: false,
|
|
23
33
|
title: opts.appId ? `Dimina Service Host: ${opts.appId}` : 'Dimina Service Host',
|
|
24
34
|
webPreferences: {
|
|
25
|
-
partition
|
|
35
|
+
partition,
|
|
26
36
|
nodeIntegration: false,
|
|
27
37
|
contextIsolation: false,
|
|
28
38
|
sandbox: false,
|
|
@@ -86,12 +96,25 @@ export function navigateServiceHost(win, url) {
|
|
|
86
96
|
/**
|
|
87
97
|
* The spec a `ServiceHostPool` uses to pre-warm service-host windows. Keeps the
|
|
88
98
|
* pooled window byte-equivalent to `constructServiceHostWindow`'s output, and
|
|
89
|
-
* opts out of the reset storage-clear because the service host shares
|
|
90
|
-
*
|
|
99
|
+
* opts out of the reset storage-clear because the service host shares its
|
|
100
|
+
* session with live projects (see ServiceHostSpec docs).
|
|
101
|
+
*
|
|
102
|
+
* KNOWN BLOCKER (intentional): the pre-warm pool is NOT per-project isolation
|
|
103
|
+
* aware. It warms windows on ONE `defaultSpec` partition before any project is
|
|
104
|
+
* known, so a pooled window cannot carry a project-derived partition — handing
|
|
105
|
+
* one project's warmed window to another project would cross-contaminate
|
|
106
|
+
* storage. Therefore the pool's `defaultSpec` (and pooled `acquire`) call this
|
|
107
|
+
* with NO appId → the shared `persist:simulator` partition; per-project
|
|
108
|
+
* isolation only applies on the default (non-pooled) `createServiceHostWindow`
|
|
109
|
+
* path, which passes the project's appId. Reconciling pooling with per-project
|
|
110
|
+
* partitions (e.g. per-partition sub-pools) is out of scope for this change.
|
|
91
111
|
*/
|
|
92
|
-
export function serviceHostSpec() {
|
|
112
|
+
export function serviceHostSpec(appId) {
|
|
93
113
|
return {
|
|
94
|
-
partition
|
|
114
|
+
// Per-project partition when an appId is known (so this project's service
|
|
115
|
+
// host shares storage ONLY with its own render side); the shared partition
|
|
116
|
+
// for the pre-warm pool's default spec (no appId — see KNOWN BLOCKER below).
|
|
117
|
+
partition: appId ? miniappPartition(appId) : SERVICE_HOST_PARTITION,
|
|
95
118
|
preloadPath: serviceHostPreloadPath,
|
|
96
119
|
size: { width: 980, height: 720 },
|
|
97
120
|
contextIsolation: false,
|
|
@@ -105,7 +128,10 @@ export function serviceHostSpec() {
|
|
|
105
128
|
* Behavior-identical to the pre-refactor implementation.
|
|
106
129
|
*/
|
|
107
130
|
export function createServiceHostWindow(opts) {
|
|
108
|
-
|
|
131
|
+
// Default (non-pooled) path: pin the service host to THIS project's partition
|
|
132
|
+
// so its logic-layer localStorage/cookies are shared with the project's render
|
|
133
|
+
// side only, never with other projects.
|
|
134
|
+
const win = constructServiceHostWindow({ appId: opts.appId, partition: miniappPartition(opts.appId) });
|
|
109
135
|
void navigateServiceHost(win, buildServiceHostSpawnUrl(opts));
|
|
110
136
|
return win;
|
|
111
137
|
}
|