@dimina-kit/devtools 0.4.0-dev.20260629114208 → 0.4.0-dev.20260630033804

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.
@@ -2787,13 +2787,17 @@ function createViewManager(ctx) {
2787
2787
  }
2788
2788
  const openInEditorWiredWcIds = /* @__PURE__ */ new Set();
2789
2789
  function injectOpenResourceHandler(serviceWc, devtoolsWc) {
2790
- const sourceContext = projectSourceContextFromServiceHostUrl(
2791
- serviceWc.getURL(),
2792
- ctx.workspace?.getProjectPath?.()
2793
- );
2794
- if (!sourceContext) return;
2795
- devtoolsWc.executeJavaScript(buildDevtoolsProjectSourceLinksScript(sourceContext)).catch(() => {
2796
- });
2790
+ if (serviceWc.isDestroyed() || devtoolsWc.isDestroyed()) return;
2791
+ try {
2792
+ const sourceContext = projectSourceContextFromServiceHostUrl(
2793
+ serviceWc.getURL(),
2794
+ ctx.workspace?.getProjectPath?.()
2795
+ );
2796
+ if (!sourceContext) return;
2797
+ devtoolsWc.executeJavaScript(buildDevtoolsProjectSourceLinksScript(sourceContext)).catch(() => {
2798
+ });
2799
+ } catch {
2800
+ }
2797
2801
  }
2798
2802
  function customizeDevtoolsTabs(devtoolsWc) {
2799
2803
  try {
@@ -653,12 +653,24 @@ export function createViewManager(ctx) {
653
653
  // interceptor re-emits an encoded sentinel via
654
654
  // `InspectorFrontendHost.openInNewTab` → Electron `devtools-open-url`. (The
655
655
  // legacy `setOpenResourceHandler` hook this used to rely on is gone in
656
- // current Chromium, so the script keeps it only as a fallback.) Best-effort:
657
- // the script is fully try/catch-wrapped so a missing API never throws.
658
- const sourceContext = projectSourceContextFromServiceHostUrl(serviceWc.getURL(), ctx.workspace?.getProjectPath?.());
659
- if (!sourceContext)
656
+ // current Chromium, so the script keeps it only as a fallback.)
657
+ //
658
+ // Destroy-race chokepoint: this runs from a deferred `dom-ready` callback
659
+ // (see wireOpenInEditor), by which time the inspected service-host wc may
660
+ // already be torn down (pool swap / project close / relaunch). Reading
661
+ // `serviceWc.getURL()` on a destroyed wc throws "Object has been destroyed"
662
+ // synchronously, which would escape the event listener. Guard both wc and
663
+ // wrap the body so a teardown mid-call degrades silently (mirrors
664
+ // customizeDevtoolsTabs).
665
+ if (serviceWc.isDestroyed() || devtoolsWc.isDestroyed())
660
666
  return;
661
- devtoolsWc.executeJavaScript(buildDevtoolsProjectSourceLinksScript(sourceContext)).catch(() => { });
667
+ try {
668
+ const sourceContext = projectSourceContextFromServiceHostUrl(serviceWc.getURL(), ctx.workspace?.getProjectPath?.());
669
+ if (!sourceContext)
670
+ return;
671
+ devtoolsWc.executeJavaScript(buildDevtoolsProjectSourceLinksScript(sourceContext)).catch(() => { });
672
+ }
673
+ catch { /* wc torn down mid-call — degrade silently */ }
662
674
  }
663
675
  // ── DevTools tab customization: keep only Elements/Console/Network ──────────
664
676
  // Inject into the same DevTools front-end host wc that the console/network
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimina-kit/devtools",
3
- "version": "0.4.0-dev.20260629114208",
3
+ "version": "0.4.0-dev.20260630033804",
4
4
  "description": "Dimina DevTools - modular developer tools for mini app debugging",
5
5
  "keywords": [
6
6
  "dimina",
@@ -85,9 +85,9 @@
85
85
  "chrome-remote-interface": "^0.34.0",
86
86
  "ws": "^8.20.0",
87
87
  "zod": "^4.3.6",
88
- "@dimina-kit/devkit": "0.1.2-dev.20260629114208",
89
- "@dimina-kit/electron-deck": "0.1.0-dev.20260629114208",
90
- "@dimina-kit/view-anchor": "0.1.0-dev.20260629114208"
88
+ "@dimina-kit/devkit": "0.1.2-dev.20260630033804",
89
+ "@dimina-kit/electron-deck": "0.1.0-dev.20260630033804",
90
+ "@dimina-kit/view-anchor": "0.1.0-dev.20260630033804"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@playwright/test": "^1.59.1",
@@ -132,8 +132,8 @@
132
132
  "vite": "^8.0.8",
133
133
  "vitest": "^4.1.4",
134
134
  "@dimina-kit/eslint-config": "0.1.0",
135
- "@dimina-kit/typescript-config": "0.1.0",
136
- "@dimina-kit/workbench": "0.1.0"
135
+ "@dimina-kit/workbench": "0.1.0",
136
+ "@dimina-kit/typescript-config": "0.1.0"
137
137
  },
138
138
  "peerDependencies": {
139
139
  "electron": ">=36"
@@ -147,7 +147,7 @@
147
147
  "build:container": "node build-container.js",
148
148
  "build:native-host": "node build-native-host.mjs",
149
149
  "build:simulator": "vite build --config vite.config.simulator.ts",
150
- "build:workbench": "WORKBENCH_OUT_DIR=../devtools/dist/vscode-workbench pnpm --filter @dimina-kit/workbench run build:app",
150
+ "build:workbench": "node build-workbench.mjs",
151
151
  "pack": "electron-builder --dir",
152
152
  "dist": "electron-builder",
153
153
  "build:main": "tsc -p tsconfig.main.json && esbuild src/main/index.ts --bundle --platform=node --format=esm --target=node24 --external:electron --packages=external --outfile=dist/main/index.bundle.js",