diff options
| author | Kit Langton <[email protected]> | 2026-04-01 21:55:35 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-01 21:55:35 -0400 |
| commit | e148b318b73b748a879d8ef7661c3fea4bb46594 (patch) | |
| tree | d6c968c8b0ef606d8f285b8b718ef99e2759d3bd /packages | |
| parent | 0cad7754273bef10cfb1d5e6d6bb0cd12d4f6b0d (diff) | |
| download | opencode-e148b318b73b748a879d8ef7661c3fea4bb46594.tar.gz opencode-e148b318b73b748a879d8ef7661c3fea4bb46594.zip | |
fix(build): replace require() with dynamic import() in cross-spawn-spawner (#20580)
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/src/effect/cross-spawn-spawner.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/opencode/src/effect/cross-spawn-spawner.ts b/packages/opencode/src/effect/cross-spawn-spawner.ts index 39e50d13d..6e7f09b1d 100644 --- a/packages/opencode/src/effect/cross-spawn-spawner.ts +++ b/packages/opencode/src/effect/cross-spawn-spawner.ts @@ -491,12 +491,13 @@ export const defaultLayer = layer.pipe(Layer.provide(NodeFileSystem.layer), Laye import { lazy } from "@/util/lazy" -const rt = lazy(() => { +const rt = lazy(async () => { // Dynamic import to avoid circular dep: cross-spawn-spawner → run-service → Instance → project → cross-spawn-spawner - const { makeRuntime } = require("@/effect/run-service") as typeof import("@/effect/run-service") + const { makeRuntime } = await import("@/effect/run-service") return makeRuntime(ChildProcessSpawner, defaultLayer) }) -export const runPromiseExit: ReturnType<typeof rt>["runPromiseExit"] = (...args) => - rt().runPromiseExit(...(args as [any])) -export const runPromise: ReturnType<typeof rt>["runPromise"] = (...args) => rt().runPromise(...(args as [any])) +type RT = Awaited<ReturnType<typeof rt>> +export const runPromiseExit: RT["runPromiseExit"] = async (...args) => + (await rt()).runPromiseExit(...(args as [any])) +export const runPromise: RT["runPromise"] = async (...args) => (await rt()).runPromise(...(args as [any])) |
