From 8d31118bf8d26e8ae02f1cf19bbb8b11185bd522 Mon Sep 17 00:00:00 2001 From: levonn-dev Date: Wed, 24 Jun 2026 11:42:42 -0400 Subject: [PATCH] chore: update readme for node bug 53238 --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 028fde0..a08fd00 100644 --- a/README.md +++ b/README.md @@ -339,17 +339,21 @@ The shim contract is in [`calc-sidecar/src/types.ts`](calc-sidecar/src/types.ts) `ScoreResponse`, slot keys, derived-stats shape. The Go side mirrors it. 1. Create `calc-sidecar/src/backends//index.ts` exporting `createShim(): ShimSession` and - `CALC_VERSION: string`. + `CALC_VERSION: string`. Both must load synchronously: the registry pulls the selected backend in with + `require()`, so the backend's module graph must not use top-level `await`, and `createShim` stays + synchronous. (A worker whose module graph is async can abort the process if it's terminated mid-load; see + the note in `registry.ts`.) 2. Put engine-specific assets (synthetic HTML form, ID-mapping JSON, etc.) alongside it. 3. Drop the engine's source files under `calc-sidecar/vendor//`. 4. Register your backend in [`calc-sidecar/src/backends/registry.ts`](calc-sidecar/src/backends/registry.ts) by adding one - line in the `BACKENDS` table: + line in the `BACKENDS` table (a module specifier; the registry loads only the selected backend, synchronously + via `require()`): ```ts - const BACKENDS: Record Promise> = { - rocalc: () => import("./rocalc/index.ts"), - stub: () => import("./stub/index.ts"), - : () => import(".//index.ts"), // ← your backend + const BACKENDS: Record = { + rocalc: "./rocalc/index.ts", + stub: "./stub/index.ts", + : ".//index.ts", // ← your backend }; ```