Skip to content

Commit 0046e50

Browse files
committed
fix(inspector): satisfy workspace and runtime gates
Declare the source-only package build boundary and use realm-safe element checks so the inspector passes workspace, type, and runtime contracts.
1 parent 8f91ef0 commit 0046e50

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

‎packages/core/src/runtime/inspection.ts‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
RuntimeResponse,
66
RuntimeResult,
77
} from "./inspectionTypes";
8+
import { isElementNode } from "./domRealm";
89

910
type Method = (this: unknown, ...args: unknown[]) => unknown;
1011
interface Animation {
@@ -91,7 +92,7 @@ export function installInspection(win: InspectorWindow, generation: string, limi
9192
function wrap(owner: Record<string, unknown>, name: string, timeline: boolean) {
9293
const original = owner[name];
9394
if (typeof original !== "function") return;
94-
const method: Method = original;
95+
const method = original as Method;
9596
const wrapped: Method = function (...args) {
9697
const outer = depth === 0;
9798
const stack = outer ? (new Error().stack ?? "") : "";
@@ -181,7 +182,7 @@ export function installInspection(win: InspectorWindow, generation: string, limi
181182
elements = [
182183
...new Set(
183184
roots.flatMap((root) => [
184-
...(root instanceof Element && root.matches(selector) ? [root] : []),
185+
...(isElementNode(root) && root.matches(selector) ? [root] : []),
185186
...root.querySelectorAll(selector),
186187
]),
187188
),
@@ -197,7 +198,7 @@ export function installInspection(win: InspectorWindow, generation: string, limi
197198
candidates: elements.slice(0, 20).map(describe),
198199
truncated: elements.length > 20,
199200
};
200-
const targetElement = elements[0];
201+
const targetElement = elements[0]!;
201202
const descendants = q.descendants ? [...targetElement.querySelectorAll("*")] : [];
202203
const scope = [targetElement, ...descendants.slice(0, 1000)];
203204
const animations = (gsap?.getTweensOf?.(scope) ?? []).map((tw): RuntimeAnimation => {
@@ -217,10 +218,7 @@ export function installInspection(win: InspectorWindow, generation: string, limi
217218
properties: Object.keys(tw.vars ?? {}).filter(
218219
(key) => !reserved.has(key) && !key.startsWith("on"),
219220
),
220-
targets: (tw.targets?.() ?? [])
221-
.filter((el): el is Element => el instanceof Element)
222-
.slice(0, 50)
223-
.map(describe),
221+
targets: (tw.targets?.() ?? []).filter(isElementNode).slice(0, 50).map(describe),
224222
localStart: tw.startTime(),
225223
duration: tw.duration(),
226224
attachmentStacks,

‎packages/inspector/package.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,11 @@
2222
"@types/node": "^25.0.10",
2323
"typescript": "^5.0.0",
2424
"vitest": "^4.1.11"
25+
},
26+
"hyperframesWorkspaceContract": {
27+
"build": {
28+
"optOut": true,
29+
"reason": "Private Bun service runs its TypeScript source directly and has no published artifact."
30+
}
2531
}
2632
}

0 commit comments

Comments
 (0)