openclaw/scripts/tsx.mjs
Peter Steinberger ce0fafefce
fix(tooling): avoid build and test startup stalls on shared tsx caches (#130924)
* fix(tooling): avoid shared tsx cache startup stalls

Use the shared preloader before tsx initializes so maintained build, check, and test commands retain memory transforms without scanning other checkouts' disk caches. Preserve changed-cwd forks and copied tooling closures.

* test: align command contracts with tooling bootstrap
2026-08-27 10:36:12 -07:00

14 lines
566 B
JavaScript

import { registerToolingTsx } from "./lib/tsx-cli-shim.mjs";
// fork() inherits execArgv but can change cwd. Keep our root-script preload
// resolvable there without rewriting unrelated flags or other preloads.
const preload = "./scripts/tsx.mjs";
for (const [index, arg] of process.execArgv.entries()) {
if (arg === preload && process.execArgv[index - 1] === "--import") {
process.execArgv[index] = import.meta.url;
} else if (arg === `--import=${preload}`) {
process.execArgv[index] = `--import=${import.meta.url}`;
}
}
await registerToolingTsx();