@vibecodeapp/cloud-studio 0.1.6 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/index.js +31 -11
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -2360,23 +2360,43 @@ import { pathToFileURL } from "url";
|
|
|
2360
2360
|
import { join as join2 } from "path";
|
|
2361
2361
|
var cachedSchema = null;
|
|
2362
2362
|
var PrismaClientConstructor = null;
|
|
2363
|
+
var PRISMA_CLIENT_PATHS = [
|
|
2364
|
+
// Custom output locations (relative to CWD)
|
|
2365
|
+
["generated", "prisma", "index.js"],
|
|
2366
|
+
["generated", "client", "index.js"],
|
|
2367
|
+
["src", "generated", "prisma", "index.js"],
|
|
2368
|
+
["src", "generated", "client", "index.js"],
|
|
2369
|
+
["prisma", "generated", "index.js"],
|
|
2370
|
+
// Default node_modules locations
|
|
2371
|
+
["node_modules", ".prisma", "client", "index.js"],
|
|
2372
|
+
["node_modules", "@prisma", "client", "index.js"]
|
|
2373
|
+
];
|
|
2363
2374
|
async function loadPrismaClient() {
|
|
2364
2375
|
if (PrismaClientConstructor) {
|
|
2365
2376
|
return PrismaClientConstructor;
|
|
2366
2377
|
}
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
const
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2378
|
+
const errors = [];
|
|
2379
|
+
for (const pathSegments of PRISMA_CLIENT_PATHS) {
|
|
2380
|
+
const prismaPath = join2(process.cwd(), ...pathSegments);
|
|
2381
|
+
try {
|
|
2382
|
+
const prismaModule = await import(pathToFileURL(prismaPath).href);
|
|
2383
|
+
if (!prismaModule.PrismaClient) {
|
|
2384
|
+
errors.push(`${prismaPath}: Module does not export PrismaClient`);
|
|
2385
|
+
continue;
|
|
2386
|
+
}
|
|
2387
|
+
PrismaClientConstructor = prismaModule.PrismaClient;
|
|
2388
|
+
if (prismaModule.Prisma?.dmmf?.datamodel) {
|
|
2389
|
+
cachedSchema = prismaModule.Prisma.dmmf.datamodel;
|
|
2390
|
+
}
|
|
2391
|
+
return PrismaClientConstructor;
|
|
2392
|
+
} catch (error) {
|
|
2393
|
+
errors.push(`${prismaPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
2373
2394
|
}
|
|
2374
|
-
return PrismaClientConstructor;
|
|
2375
|
-
} catch (error) {
|
|
2376
|
-
throw new Error(
|
|
2377
|
-
`Failed to load Prisma Client from ${join2(process.cwd(), "generated", "prisma", "index.js")}: ${error instanceof Error ? error.message : String(error)}`
|
|
2378
|
-
);
|
|
2379
2395
|
}
|
|
2396
|
+
throw new Error(
|
|
2397
|
+
`Failed to load Prisma Client. Searched locations:
|
|
2398
|
+
${errors.join("\n")}`
|
|
2399
|
+
);
|
|
2380
2400
|
}
|
|
2381
2401
|
async function withPrisma(fn) {
|
|
2382
2402
|
const ClientConstructor = await loadPrismaClient();
|