MCPcopy Create free account
hub / github.com/HKUDS/AgentSpace / resolvePgModulePath

Function resolvePgModulePath

packages/db/src/database.ts:867–881  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

865}
866
867function resolvePgModulePath(): string {
868 const candidates = [
869 join(resolveRepositoryRoot(), "packages", "db", "package.json"),
870 resolveLocalDbPackageJsonPath(),
871 ];
872 let lastError: unknown;
873 for (const candidate of candidates) {
874 try {
875 return createRequire(candidate).resolve("pg");
876 } catch (error) {
877 lastError = error;
878 }
879 }
880 throw lastError instanceof Error ? lastError : new Error("Could not resolve pg module.");
881}
882
883function normalizeFsPath(pathname: string): string {
884 return pathname.startsWith("/@fs/") ? pathname.slice("/@fs".length) : pathname;

Callers 1

ensureWorkerFunction · 0.85

Calls 2

resolveRepositoryRootFunction · 0.70

Tested by

no test coverage detected