The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { join } from "node:path"; |
| 2 | import { pathToFileURL } from "node:url"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import { ModuleLoadError, resolveProjectPackageDirectory } from "../core/Loader.ts"; |
| 5 | |
| 6 | /** Vinext exposes import-only entrypoints that require.resolve cannot resolve. */ |
| 7 | export const loadVinextModule = <T>(root: string, file: string) => |
| 8 | resolveProjectPackageDirectory(root, "vinext").pipe( |
| 9 | Effect.flatMap((directory) => |
| 10 | Effect.tryPromise({ |
| 11 | try: () => |
| 12 | import( |
| 13 | /* @vite-ignore */ pathToFileURL(join(directory, "dist", file)).href |
| 14 | ) as Promise<T>, |
| 15 | catch: (cause) => new ModuleLoadError({ root, specifier: `vinext/${file}`, cause }), |
| 16 | }), |
| 17 | ), |
| 18 | ); |