diff --git a/tools/bifrost-crossing-documents.mjs b/tools/bifrost-crossing-documents.mjs index c6ec6e3..b7d60ac 100644 --- a/tools/bifrost-crossing-documents.mjs +++ b/tools/bifrost-crossing-documents.mjs @@ -267,13 +267,12 @@ function loadCultCacheRuntime() { if (cachedRuntime) { return cachedRuntime; } - const packagePath = resolveFirstExisting("CultCache TypeScript runtime", [ - resolve(cultLibRoot, "packages", "cultcache-ts", "package.json"), - resolve(projectsRoot, "CultCacheTS", "package.json"), - resolve(projectsRoot, "CultCacheTS", "node_modules", "cultcache-ts", "package.json"), + const entryPoint = resolveFirstExisting("CultCache TypeScript runtime", [ + resolve(cultLibRoot, "packages", "cultcache-ts", "dist", "index.js"), + resolve(projectsRoot, "CultCacheTS", "dist", "index.js"), ]); - const requireCultCache = createRequire(packagePath); - cachedRuntime = requireCultCache("cultcache-ts"); + const requireCultCache = createRequire(entryPoint); + cachedRuntime = requireCultCache(entryPoint); return cachedRuntime; } diff --git a/tools/cultmesh-bridge-commands.mjs b/tools/cultmesh-bridge-commands.mjs index 6dbb57c..9e5b372 100644 --- a/tools/cultmesh-bridge-commands.mjs +++ b/tools/cultmesh-bridge-commands.mjs @@ -293,18 +293,24 @@ function genericDocument(defineDocumentType, type, schemaId, name) { function loadCultMeshRuntime() { const candidates = [ - resolve(cultLibRoot, "packages", "cultmesh-ts", "package.json"), - resolve(projectsRoot, "CultMeshTS", "package.json"), + { + mesh: resolve(cultLibRoot, "packages", "cultmesh-ts", "dist", "index.js"), + cache: resolve(cultLibRoot, "packages", "cultcache-ts", "dist", "index.js"), + }, + { + mesh: resolve(projectsRoot, "CultMeshTS", "dist", "index.js"), + cache: resolve(projectsRoot, "CultCacheTS", "dist", "index.js"), + }, ]; - for (const packageJson of candidates) { - if (!existsSync(packageJson)) { + for (const candidate of candidates) { + if (!existsSync(candidate.mesh) || !existsSync(candidate.cache)) { continue; } try { - const requireCult = createRequire(packageJson); - const { CultMesh } = requireCult("cultmesh-ts"); - const { defineDocumentType } = requireCult("cultcache-ts"); + const requireCult = createRequire(candidate.mesh); + const { CultMesh } = requireCult(candidate.mesh); + const { defineDocumentType } = requireCult(candidate.cache); if (CultMesh && defineDocumentType) { return { CultMesh, defineDocumentType }; }