Load CultLib entrypoints without workspace links
This commit is contained in:
parent
6104f6c514
commit
03c6f353a8
2 changed files with 18 additions and 13 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue