@dimina-kit/devtools 0.4.0-dev.20260701083540 → 0.4.0-dev.20260701155140

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 (50) hide show
  1. package/dist/main/app/app.js +11 -0
  2. package/dist/main/app/max-listeners-diagnostic.d.ts +32 -0
  3. package/dist/main/app/max-listeners-diagnostic.js +59 -0
  4. package/dist/main/index.bundle.js +423 -220
  5. package/dist/main/ipc/bridge-router.d.ts +5 -4
  6. package/dist/main/ipc/bridge-router.js +25 -1
  7. package/dist/main/ipc/simulator.js +1 -5
  8. package/dist/main/ipc/views.js +8 -19
  9. package/dist/main/services/automation/wait-active-page.d.ts +4 -2
  10. package/dist/main/services/render-inspect/index.d.ts +9 -0
  11. package/dist/main/services/render-inspect/index.js +13 -1
  12. package/dist/main/services/simulator-storage/index.d.ts +9 -0
  13. package/dist/main/services/simulator-storage/index.js +26 -1
  14. package/dist/main/services/simulator-wxml/index.js +117 -11
  15. package/dist/main/services/views/apply-view-ops.d.ts +11 -0
  16. package/dist/main/services/views/apply-view-ops.js +22 -0
  17. package/dist/main/services/views/placement-test-driver.d.ts +25 -0
  18. package/dist/main/services/views/placement-test-driver.js +48 -0
  19. package/dist/main/services/views/view-manager.d.ts +9 -55
  20. package/dist/main/services/views/view-manager.js +264 -233
  21. package/dist/main/services/workbench-context.d.ts +10 -0
  22. package/dist/preload/windows/host-toolbar-runtime.cjs +6 -13
  23. package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
  24. package/dist/preload/windows/simulator.cjs +0 -3
  25. package/dist/preload/windows/simulator.cjs.map +2 -2
  26. package/dist/preload/windows/simulator.js +0 -3
  27. package/dist/render-host/render-inspect.js +35 -1
  28. package/dist/renderer/assets/index-jDrNHghH.js +49 -0
  29. package/dist/renderer/assets/{input-DR7bfyQE.js → input-Djg2NR4U.js} +2 -2
  30. package/dist/renderer/assets/{ipc-transport-3Arg8jPC.js → ipc-transport-Be-AzCub.js} +2 -2
  31. package/dist/renderer/assets/ipc-transport-C6-KPMqw.css +1 -0
  32. package/dist/renderer/assets/{popover-CPZX3MrT.js → popover-eDUh4NYe.js} +2 -2
  33. package/dist/renderer/assets/{select-BxyPlVyJ.js → select-DesFfkVV.js} +2 -2
  34. package/dist/renderer/assets/{settings-CG_OR03F.js → settings-CRmO7zUG.js} +2 -2
  35. package/dist/renderer/assets/{settings-api-CtPPJF-F.js → settings-api-HQ7ZFPWi.js} +2 -2
  36. package/dist/renderer/assets/{workbenchSettings-ClqCBGOa.js → workbenchSettings-CZBWsliT.js} +2 -2
  37. package/dist/renderer/entries/main/index.html +6 -6
  38. package/dist/renderer/entries/popover/index.html +5 -5
  39. package/dist/renderer/entries/settings/index.html +5 -5
  40. package/dist/renderer/entries/workbench-settings/index.html +4 -4
  41. package/dist/service-host/sync-api-patch.js +33 -3
  42. package/dist/shared/ipc-channels.d.ts +28 -14
  43. package/dist/shared/ipc-channels.js +10 -17
  44. package/dist/shared/ipc-schemas.d.ts +21 -19
  45. package/dist/shared/ipc-schemas.js +32 -26
  46. package/dist/shared/view-ids.d.ts +19 -0
  47. package/dist/shared/view-ids.js +25 -0
  48. package/package.json +5 -5
  49. package/dist/renderer/assets/index-HE9Xr9bQ.js +0 -49
  50. package/dist/renderer/assets/ipc-transport-Dt0jR7Ir.css +0 -1
@@ -1,4 +1,5 @@
1
1
  import { setupCdpPort, registerDifileScheme, suppressInsecureCspWarnings } from './bootstrap.js';
2
+ import { installMaxListenersWarningDiagnostic } from './max-listeners-diagnostic.js';
2
3
  import { registerProjectFsIpc } from '../ipc/project-fs.js';
3
4
  import { app, BrowserWindow, nativeImage, session } from 'electron';
4
5
  import fs from 'fs';
@@ -317,6 +318,11 @@ export function runDevtoolsBootstrap(config = {}) {
317
318
  setupCdpPort();
318
319
  // Dev-only: silence Electron Insecure-CSP warning; no-op when packaged.
319
320
  suppressInsecureCspWarnings();
321
+ // Dev-only: decode any MaxListenersExceededWarning to the concrete wc that
322
+ // tripped it (id/type/url), so a stray listener accrual is pinned rather than
323
+ // guessed. Registered once, pre-ready; harmless if it never fires.
324
+ if (!app.isPackaged)
325
+ installMaxListenersWarningDiagnostic();
320
326
  // Privileged scheme registration must run before app.whenReady (else throws).
321
327
  registerDifileScheme();
322
328
  // The embedded workbench editor (the sole devtools editor) needs
@@ -497,6 +503,11 @@ export async function createDevtoolsRuntime(config = {}) {
497
503
  if (storage.storageApi) {
498
504
  context.storageApi = storage.storageApi;
499
505
  context.registry.add(() => { context.storageApi = undefined; });
506
+ // SYNC wx storage writes bypass main (they hit the service-host localStorage
507
+ // directly); the service-host posts `storageChanged` and bridge-router routes
508
+ // it here so the Storage panel stays live without a manual reload.
509
+ context.onServiceStorageChanged = storage.onSyncStorageChange;
510
+ context.registry.add(() => { context.onServiceStorageChanged = undefined; });
500
511
  }
501
512
  // Native-host WXML + AppData panels: main sources the data (WXML pulled
502
513
  // from the active render guest; AppData tapped from the service→render
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Runtime diagnostic for `MaxListenersExceededWarning`.
3
+ *
4
+ * Node prints `MaxListenersExceededWarning: N <event> listeners added to
5
+ * [emitter]` when an EventEmitter crosses its (default 10) ceiling, but the
6
+ * message alone does not identify WHICH Electron WebContents tripped it. This
7
+ * hook decodes the warning's `emitter` (present on the warning object in current
8
+ * Node) into the wc's id / type / url so a stray listener accrual can be pinned
9
+ * to a concrete surface (DevTools host, service host, main window, …) instead of
10
+ * guessed at. Dev-only; a no-op counterpart is returned when disabled.
11
+ */
12
+ export interface MaxListenersWarningReport {
13
+ event: string | undefined;
14
+ count: number | undefined;
15
+ wcId: number | undefined;
16
+ wcType: string | undefined;
17
+ url: string | undefined;
18
+ destroyed: boolean | undefined;
19
+ stack: string | undefined;
20
+ }
21
+ /**
22
+ * Decode a warning into a flat report, or `null` if it is not a
23
+ * `MaxListenersExceededWarning`. Pure — no logging, no process state.
24
+ */
25
+ export declare function describeMaxListenersWarning(warning: Error): MaxListenersWarningReport | null;
26
+ /**
27
+ * Register a `process.on('warning')` listener that logs a decoded report for any
28
+ * `MaxListenersExceededWarning`. Returns a disposer that removes the listener.
29
+ * Other warning kinds pass through untouched.
30
+ */
31
+ export declare function installMaxListenersWarningDiagnostic(log?: (report: MaxListenersWarningReport) => void): () => void;
32
+ //# sourceMappingURL=max-listeners-diagnostic.d.ts.map
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Runtime diagnostic for `MaxListenersExceededWarning`.
3
+ *
4
+ * Node prints `MaxListenersExceededWarning: N <event> listeners added to
5
+ * [emitter]` when an EventEmitter crosses its (default 10) ceiling, but the
6
+ * message alone does not identify WHICH Electron WebContents tripped it. This
7
+ * hook decodes the warning's `emitter` (present on the warning object in current
8
+ * Node) into the wc's id / type / url so a stray listener accrual can be pinned
9
+ * to a concrete surface (DevTools host, service host, main window, …) instead of
10
+ * guessed at. Dev-only; a no-op counterpart is returned when disabled.
11
+ */
12
+ // Run a probe thunk, swallowing anything it throws. The method call lives INSIDE
13
+ // the thunk (not eagerly bound at the call site) so a malformed emitter whose
14
+ // `getType`/`getURL`/`isDestroyed` is a non-function value throws here and is
15
+ // caught, rather than blowing up while evaluating the argument.
16
+ function callSafe(fn) {
17
+ try {
18
+ return fn();
19
+ }
20
+ catch {
21
+ return undefined;
22
+ }
23
+ }
24
+ /**
25
+ * Decode a warning into a flat report, or `null` if it is not a
26
+ * `MaxListenersExceededWarning`. Pure — no logging, no process state.
27
+ */
28
+ export function describeMaxListenersWarning(warning) {
29
+ if (warning.name !== 'MaxListenersExceededWarning')
30
+ return null;
31
+ const w = warning;
32
+ const emitter = (w.emitter ?? undefined);
33
+ return {
34
+ event: w.type,
35
+ count: w.count,
36
+ wcId: typeof emitter?.id === 'number' ? emitter.id : undefined,
37
+ wcType: callSafe(() => emitter?.getType?.()),
38
+ url: callSafe(() => emitter?.getURL?.()),
39
+ destroyed: callSafe(() => emitter?.isDestroyed?.()),
40
+ stack: warning.stack,
41
+ };
42
+ }
43
+ /**
44
+ * Register a `process.on('warning')` listener that logs a decoded report for any
45
+ * `MaxListenersExceededWarning`. Returns a disposer that removes the listener.
46
+ * Other warning kinds pass through untouched.
47
+ */
48
+ export function installMaxListenersWarningDiagnostic(log = (r) => console.warn('[max-listeners]', r)) {
49
+ const onWarning = (warning) => {
50
+ const report = describeMaxListenersWarning(warning);
51
+ if (report)
52
+ log(report);
53
+ };
54
+ process.on('warning', onWarning);
55
+ return () => {
56
+ process.removeListener('warning', onWarning);
57
+ };
58
+ }
59
+ //# sourceMappingURL=max-listeners-diagnostic.js.map