omkit 0.4.2 → 0.4.3
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.
|
@@ -68,11 +68,15 @@ export const chromePage = action("chromePage")
|
|
|
68
68
|
// Oms run under tsx, which forces esbuild `keepNames`: every function serialized into
|
|
69
69
|
// page.evaluate() carries a bare `__name(...)` wrapper that is undefined in the page and
|
|
70
70
|
// throws `ReferenceError: __name is not defined`. Define a no-op __name so those bodies
|
|
71
|
-
// run
|
|
72
|
-
//
|
|
71
|
+
// run. Scope it to the whole context, not just this page: downstream code often drives
|
|
72
|
+
// sibling windows via context.pages() (e.g. Electron windows), which never see a
|
|
73
|
+
// page-level shim. addInitScript covers documents created later; evaluate seeds the ones
|
|
74
|
+
// already open now (Electron windows exist before we attach). Passed as a string so tsx
|
|
75
|
+
// doesn't rewrite — and re-break — the shim itself.
|
|
73
76
|
const nameShim = "globalThis.__name = globalThis.__name || function (f) { return f; };";
|
|
74
|
-
|
|
75
|
-
await
|
|
77
|
+
const context = page.context();
|
|
78
|
+
await context.addInitScript(nameShim);
|
|
79
|
+
await Promise.all(context.pages().map((p) => p.evaluate(nameShim).catch(() => { })));
|
|
76
80
|
attach(page); // resolves instance.ref for every downstream action
|
|
77
81
|
console.log(`attached ${from}`);
|
|
78
82
|
// Daemon: hold the page open until teardown, then drop the CDP session if ours.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omkit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "A tiny runtime for developer workflows: typed actions that pass runtime capabilities and emit typed events, under one run and one shared log. The operational/runtime layer to tskb's knowledge layer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|