@cedarjs/project-config 8.0.0-canary.3364 → 8.0.0-canary.3366
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/index.js +53 -0
- package/dist/prisma.d.ts +36 -0
- package/dist/prisma.d.ts.map +1 -1
- package/dist/prismaClientOutputDirsWorker.d.ts +2 -0
- package/dist/prismaClientOutputDirsWorker.d.ts.map +1 -0
- package/dist/prismaClientOutputDirsWorker.js +344 -0
- package/dist/prismaClientOutputDirsWorkerUrl.d.ts +2 -0
- package/dist/prismaClientOutputDirsWorkerUrl.d.ts.map +1 -0
- package/dist/prismaClientOutputDirsWorkerUrl.js +8 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -415,6 +415,7 @@ var isTypeScriptProject = () => {
|
|
|
415
415
|
import fs6 from "node:fs";
|
|
416
416
|
import path5 from "node:path";
|
|
417
417
|
import { pathToFileURL } from "node:url";
|
|
418
|
+
import { Worker } from "node:worker_threads";
|
|
418
419
|
|
|
419
420
|
// src/packageManager.ts
|
|
420
421
|
import fs5 from "node:fs";
|
|
@@ -519,6 +520,55 @@ async function getDataMigrationsPath(prismaConfigPath) {
|
|
|
519
520
|
const migrationsDir = path5.dirname(migrationsPath);
|
|
520
521
|
return path5.join(migrationsDir, "dataMigrations");
|
|
521
522
|
}
|
|
523
|
+
async function getPrismaClientOutputDirs() {
|
|
524
|
+
try {
|
|
525
|
+
const mod = await import("@prisma/internals");
|
|
526
|
+
const { getConfig: getConfig3 } = mod.default || mod;
|
|
527
|
+
const { schemas, schemaRootDir } = await getPrismaSchemas();
|
|
528
|
+
const config = await getConfig3({ datamodel: schemas });
|
|
529
|
+
return config.generators.filter(
|
|
530
|
+
(generator) => ["prisma-client", "prisma-client-js"].includes(
|
|
531
|
+
generator.provider.value ?? ""
|
|
532
|
+
)
|
|
533
|
+
).map((generator) => generator.output?.value).filter((output) => Boolean(output)).map(
|
|
534
|
+
(output) => path5.isAbsolute(output) ? output : path5.resolve(schemaRootDir, output)
|
|
535
|
+
);
|
|
536
|
+
} catch {
|
|
537
|
+
return [];
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
async function getPrismaClientOutputDirsIsolated() {
|
|
541
|
+
const { prismaClientOutputDirsWorkerUrl } = await import("./prismaClientOutputDirsWorkerUrl.js");
|
|
542
|
+
return new Promise((resolve) => {
|
|
543
|
+
const worker = new Worker(prismaClientOutputDirsWorkerUrl);
|
|
544
|
+
worker.once("message", (outputDirs) => {
|
|
545
|
+
resolve(
|
|
546
|
+
Array.isArray(outputDirs) ? outputDirs.filter((dir) => typeof dir === "string") : []
|
|
547
|
+
);
|
|
548
|
+
void worker.terminate();
|
|
549
|
+
});
|
|
550
|
+
worker.once("error", () => resolve([]));
|
|
551
|
+
worker.once("exit", () => resolve([]));
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
function createPrismaClientFileMatcher(resolveOutputDirs = getPrismaClientOutputDirsIsolated) {
|
|
555
|
+
let outputDirs;
|
|
556
|
+
const getOutputDirs = () => {
|
|
557
|
+
outputDirs ??= resolveOutputDirs();
|
|
558
|
+
return outputDirs;
|
|
559
|
+
};
|
|
560
|
+
return {
|
|
561
|
+
load: async () => {
|
|
562
|
+
await getOutputDirs();
|
|
563
|
+
},
|
|
564
|
+
matches: async (filePath) => {
|
|
565
|
+
return (await getOutputDirs()).some((dir) => {
|
|
566
|
+
const relativePath = path5.relative(dir, filePath);
|
|
567
|
+
return relativePath !== "" && !relativePath.startsWith("..") && !path5.isAbsolute(relativePath);
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
}
|
|
522
572
|
async function resolveGeneratedPrismaClient() {
|
|
523
573
|
let generatorOutputPath;
|
|
524
574
|
let ext = "ts";
|
|
@@ -600,6 +650,7 @@ function getEnvVarDefinitions() {
|
|
|
600
650
|
export {
|
|
601
651
|
DEFAULT_CONFIG,
|
|
602
652
|
TargetEnum,
|
|
653
|
+
createPrismaClientFileMatcher,
|
|
603
654
|
ensurePosixPath,
|
|
604
655
|
findUp,
|
|
605
656
|
getAppRouteHook,
|
|
@@ -616,6 +667,8 @@ export {
|
|
|
616
667
|
getMigrationsPath,
|
|
617
668
|
getParsedScalars,
|
|
618
669
|
getPaths,
|
|
670
|
+
getPrismaClientOutputDirs,
|
|
671
|
+
getPrismaClientOutputDirsIsolated,
|
|
619
672
|
getPrismaDatasourceProvider,
|
|
620
673
|
getPrismaSchemas,
|
|
621
674
|
getRawConfig,
|
package/dist/prisma.d.ts
CHANGED
|
@@ -51,6 +51,42 @@ export declare function getDbDir(prismaConfigPath: string): Promise<string>;
|
|
|
51
51
|
* @returns Absolute path to the data migrations directory
|
|
52
52
|
*/
|
|
53
53
|
export declare function getDataMigrationsPath(prismaConfigPath: string): Promise<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Gets the absolute output directories of the project's Prisma client
|
|
56
|
+
* generators (`prisma-client` and `prisma-client-js`).
|
|
57
|
+
*
|
|
58
|
+
* Other generators are not included: third-party generators (e.g. Zod schema
|
|
59
|
+
* generators) can emit source that relies on Cedar's import transforms.
|
|
60
|
+
*
|
|
61
|
+
* Returns an empty array if the schema can't be read or no client generator
|
|
62
|
+
* has an output path.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getPrismaClientOutputDirs(): Promise<string[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Same as `getPrismaClientOutputDirs()`, but resolved in a worker thread.
|
|
67
|
+
*
|
|
68
|
+
* Loading `@prisma/internals` has process-wide side effects that slow down a
|
|
69
|
+
* Vite build running in the same process by several seconds on large
|
|
70
|
+
* projects. A worker has its own module registry, so those side effects stay
|
|
71
|
+
* contained.
|
|
72
|
+
*/
|
|
73
|
+
export declare function getPrismaClientOutputDirsIsolated(): Promise<string[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Creates a matcher that reports whether a file is part of the project's
|
|
76
|
+
* generated Prisma client. Build pipelines use it to skip Cedar's source
|
|
77
|
+
* transforms for that code.
|
|
78
|
+
*
|
|
79
|
+
* The output directories are resolved once and reused for the lifetime of the
|
|
80
|
+
* matcher, so create a new one per build. Call `load()` from a build start
|
|
81
|
+
* hook: resolving them lazily from the first transform makes the lookup
|
|
82
|
+
* compete with module transforms, which stalls every transform waiting on it.
|
|
83
|
+
*
|
|
84
|
+
* @param resolveOutputDirs - Resolves the Prisma client output directories
|
|
85
|
+
*/
|
|
86
|
+
export declare function createPrismaClientFileMatcher(resolveOutputDirs?: () => Promise<string[]>): {
|
|
87
|
+
load: () => Promise<void>;
|
|
88
|
+
matches: (filePath: string) => Promise<boolean>;
|
|
89
|
+
};
|
|
54
90
|
type ResolveReturnType = {
|
|
55
91
|
clientPath: string;
|
|
56
92
|
error: undefined;
|
package/dist/prisma.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../src/prisma.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../src/prisma.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAQ1C;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,yBA8B9D;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,gBAAgB,EAAE,MAAM,mBAY3D;AAED;;GAEG;AACH,wBAAsB,gBAAgB,mEAgBrC;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAAC,CAWnE;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxE;AAED;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED;;;;;;;;;GASG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAyBnE;AAED;;;;;;;GAOG;AACH,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAkB3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAC3C,iBAAiB,GAAE,MAAM,OAAO,CAC9B,MAAM,EAAE,CAC2B;;wBAcT,MAAM;EAYnC;AAED,KAAK,iBAAiB,GAClB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACxC;IAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAwD/E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prismaClientOutputDirsWorker.d.ts","sourceRoot":"","sources":["../src/prismaClientOutputDirsWorker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
// src/prismaClientOutputDirsWorker.ts
|
|
2
|
+
import { parentPort } from "node:worker_threads";
|
|
3
|
+
|
|
4
|
+
// src/prisma.ts
|
|
5
|
+
import fs5 from "node:fs";
|
|
6
|
+
import path4 from "node:path";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
|
|
9
|
+
// src/paths.ts
|
|
10
|
+
import fs4 from "node:fs";
|
|
11
|
+
import path3 from "path";
|
|
12
|
+
import fg from "fast-glob";
|
|
13
|
+
|
|
14
|
+
// src/config.ts
|
|
15
|
+
import fs2 from "node:fs";
|
|
16
|
+
import merge from "deepmerge";
|
|
17
|
+
import * as toml from "smol-toml";
|
|
18
|
+
import { env as envInterpolation } from "string-env-interpolation";
|
|
19
|
+
|
|
20
|
+
// src/findUp.ts
|
|
21
|
+
import fs from "node:fs";
|
|
22
|
+
import path from "path";
|
|
23
|
+
function findUp(file, startingDirectory = process.cwd()) {
|
|
24
|
+
const possibleFilepath = path.join(startingDirectory, file);
|
|
25
|
+
if (fs.existsSync(possibleFilepath)) {
|
|
26
|
+
return possibleFilepath;
|
|
27
|
+
}
|
|
28
|
+
const parentDirectory = path.dirname(startingDirectory);
|
|
29
|
+
if (parentDirectory === startingDirectory) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return findUp(file, parentDirectory);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/configPath.ts
|
|
36
|
+
var CONFIG_FILE_NAMES = ["cedar.toml", "redwood.toml"];
|
|
37
|
+
var getConfigPathCache = /* @__PURE__ */ new Map();
|
|
38
|
+
var getConfigPath = (cwd = process.env.CEDAR_CWD ?? process.env.RWJS_CWD ?? process.cwd()) => {
|
|
39
|
+
const cachedPath = getConfigPathCache.get(cwd);
|
|
40
|
+
if (cachedPath) {
|
|
41
|
+
return cachedPath;
|
|
42
|
+
}
|
|
43
|
+
const configPath = findUp("cedar.toml", cwd) || findUp("redwood.toml", cwd);
|
|
44
|
+
if (!configPath) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
`Could not find a "${CONFIG_FILE_NAMES.join('" or "')}" file, are you sure you're in a Cedar project?`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
getConfigPathCache.set(cwd, configPath);
|
|
50
|
+
return configPath;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/config.ts
|
|
54
|
+
var DEFAULT_CONFIG = {
|
|
55
|
+
web: {
|
|
56
|
+
title: "Cedar App",
|
|
57
|
+
port: 8910,
|
|
58
|
+
path: "./web",
|
|
59
|
+
target: "browser" /* BROWSER */,
|
|
60
|
+
includeEnvironmentVariables: [],
|
|
61
|
+
apiUrl: "/.api/functions",
|
|
62
|
+
fastRefresh: true,
|
|
63
|
+
a11y: true,
|
|
64
|
+
sourceMap: false
|
|
65
|
+
},
|
|
66
|
+
api: {
|
|
67
|
+
title: "Cedar App",
|
|
68
|
+
port: 8911,
|
|
69
|
+
path: "./api",
|
|
70
|
+
target: "node" /* NODE */,
|
|
71
|
+
prismaConfig: "./api/prisma.config.cjs",
|
|
72
|
+
prismaGenerateArgs: [],
|
|
73
|
+
serverConfig: "./api/server.config.js",
|
|
74
|
+
debugPort: void 0
|
|
75
|
+
},
|
|
76
|
+
graphql: {
|
|
77
|
+
fragments: false,
|
|
78
|
+
trustedDocuments: false,
|
|
79
|
+
includeScalars: { File: true },
|
|
80
|
+
parsedScalars: {}
|
|
81
|
+
},
|
|
82
|
+
browser: {
|
|
83
|
+
open: false
|
|
84
|
+
},
|
|
85
|
+
generate: {
|
|
86
|
+
tests: true,
|
|
87
|
+
stories: true,
|
|
88
|
+
nestScaffoldByModel: true
|
|
89
|
+
},
|
|
90
|
+
notifications: {
|
|
91
|
+
versionUpdates: []
|
|
92
|
+
},
|
|
93
|
+
studio: {
|
|
94
|
+
basePort: 4318,
|
|
95
|
+
graphiql: {
|
|
96
|
+
authImpersonation: {
|
|
97
|
+
authProvider: void 0,
|
|
98
|
+
userId: void 0,
|
|
99
|
+
email: void 0,
|
|
100
|
+
jwtSecret: "secret"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
test: {
|
|
105
|
+
autoConsentToDbReset: false
|
|
106
|
+
},
|
|
107
|
+
experimental: {
|
|
108
|
+
opentelemetry: {
|
|
109
|
+
enabled: false,
|
|
110
|
+
wrapApi: true
|
|
111
|
+
},
|
|
112
|
+
cli: {
|
|
113
|
+
autoInstall: true,
|
|
114
|
+
plugins: [
|
|
115
|
+
{
|
|
116
|
+
package: "@cedarjs/cli-storybook-vite"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
package: "@cedarjs/cli-data-migrate"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
useSDLCodeGenForGraphQLTypes: false,
|
|
124
|
+
streamingSsr: {
|
|
125
|
+
enabled: false
|
|
126
|
+
},
|
|
127
|
+
rsc: {
|
|
128
|
+
enabled: false
|
|
129
|
+
},
|
|
130
|
+
realtime: {
|
|
131
|
+
enabled: false
|
|
132
|
+
},
|
|
133
|
+
reactCompiler: {
|
|
134
|
+
enabled: false,
|
|
135
|
+
lintOnly: false
|
|
136
|
+
},
|
|
137
|
+
packagesWorkspace: {
|
|
138
|
+
enabled: false
|
|
139
|
+
},
|
|
140
|
+
gqlorm: {
|
|
141
|
+
enabled: false,
|
|
142
|
+
organizationModel: "Organization",
|
|
143
|
+
membershipModel: "Membership",
|
|
144
|
+
membershipUserField: "userId",
|
|
145
|
+
membershipOrganizationField: "organizationId"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
function getConfig(configPath) {
|
|
150
|
+
const config = merge(DEFAULT_CONFIG, getRawConfig(configPath));
|
|
151
|
+
return config;
|
|
152
|
+
}
|
|
153
|
+
function getRawConfig(configPath = getConfigPath()) {
|
|
154
|
+
try {
|
|
155
|
+
return toml.parse(envInterpolation(fs2.readFileSync(configPath, "utf8")));
|
|
156
|
+
} catch (e) {
|
|
157
|
+
throw new Error(`Could not parse "${configPath}": ${e}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// src/generatedDataDir.ts
|
|
162
|
+
import fs3 from "node:fs";
|
|
163
|
+
import path2 from "node:path";
|
|
164
|
+
function getGeneratedDataDirPath(cwd = process.env.CEDAR_CWD ?? process.env.RWJS_CWD ?? process.cwd()) {
|
|
165
|
+
const configPath = getConfigPath(cwd);
|
|
166
|
+
const projectRoot = path2.dirname(configPath);
|
|
167
|
+
const rootDotCedarDir = path2.join(projectRoot, ".cedar");
|
|
168
|
+
const rootDotRedwoodDir = path2.join(projectRoot, ".redwood");
|
|
169
|
+
const generatedDirPath = fs3.existsSync(rootDotCedarDir) ? rootDotCedarDir : fs3.existsSync(rootDotRedwoodDir) ? rootDotRedwoodDir : rootDotCedarDir;
|
|
170
|
+
return generatedDirPath;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// src/paths.ts
|
|
174
|
+
var getBaseDir = (configPath = getConfigPath()) => {
|
|
175
|
+
return path3.dirname(configPath);
|
|
176
|
+
};
|
|
177
|
+
var resolveFile = (filePath, extensions = [".js", ".tsx", ".ts", ".jsx", ".mjs", ".mts", ".cjs"]) => {
|
|
178
|
+
for (const extension of extensions) {
|
|
179
|
+
const p = `${filePath}${extension}`;
|
|
180
|
+
if (fs4.existsSync(p)) {
|
|
181
|
+
return p;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return null;
|
|
185
|
+
};
|
|
186
|
+
var getPathsCache = /* @__PURE__ */ new Map();
|
|
187
|
+
function getPaths(BASE_DIR = getBaseDir()) {
|
|
188
|
+
if (getPathsCache.has(BASE_DIR)) {
|
|
189
|
+
return getPathsCache.get(BASE_DIR);
|
|
190
|
+
}
|
|
191
|
+
const routes = resolveFile(path3.join(BASE_DIR, "web/src/Routes"));
|
|
192
|
+
const { prismaConfig: prismaConfigFromConfig } = getConfig(
|
|
193
|
+
getConfigPath(BASE_DIR)
|
|
194
|
+
).api;
|
|
195
|
+
const prismaConfigBase = path3.join(
|
|
196
|
+
BASE_DIR,
|
|
197
|
+
prismaConfigFromConfig.replace(/\.[^.]+$/, "")
|
|
198
|
+
);
|
|
199
|
+
const prismaConfig = resolveFile(prismaConfigBase) || path3.join(BASE_DIR, prismaConfigFromConfig);
|
|
200
|
+
const viteConfig = resolveFile(
|
|
201
|
+
path3.join(BASE_DIR, "web/vite.config")
|
|
202
|
+
);
|
|
203
|
+
const generatedBase = getGeneratedDataDirPath(BASE_DIR);
|
|
204
|
+
const paths = {
|
|
205
|
+
base: BASE_DIR,
|
|
206
|
+
generated: {
|
|
207
|
+
base: generatedBase,
|
|
208
|
+
schema: path3.join(generatedBase, "schema.graphql"),
|
|
209
|
+
types: {
|
|
210
|
+
includes: path3.join(generatedBase, "types/includes"),
|
|
211
|
+
mirror: path3.join(generatedBase, "types/mirror")
|
|
212
|
+
},
|
|
213
|
+
prebuild: path3.join(generatedBase, "prebuild")
|
|
214
|
+
},
|
|
215
|
+
scripts: path3.join(BASE_DIR, "scripts"),
|
|
216
|
+
packages: path3.join(BASE_DIR, "packages"),
|
|
217
|
+
generatorTemplates: path3.join(BASE_DIR, "generatorTemplates"),
|
|
218
|
+
api: {
|
|
219
|
+
base: path3.join(BASE_DIR, "api"),
|
|
220
|
+
prismaConfig,
|
|
221
|
+
functions: path3.join(BASE_DIR, "api/src/functions"),
|
|
222
|
+
graphql: path3.join(BASE_DIR, "api/src/graphql"),
|
|
223
|
+
lib: path3.join(BASE_DIR, "api/src/lib"),
|
|
224
|
+
config: path3.join(BASE_DIR, "api/src/config"),
|
|
225
|
+
services: path3.join(BASE_DIR, "api/src/services"),
|
|
226
|
+
directives: path3.join(BASE_DIR, "api/src/directives"),
|
|
227
|
+
subscriptions: path3.join(BASE_DIR, "api/src/subscriptions"),
|
|
228
|
+
src: path3.join(BASE_DIR, "api/src"),
|
|
229
|
+
dist: path3.join(BASE_DIR, "api/dist"),
|
|
230
|
+
types: path3.join(BASE_DIR, "api/types"),
|
|
231
|
+
models: path3.join(BASE_DIR, "api/src/models"),
|
|
232
|
+
mail: path3.join(BASE_DIR, "api/src", "mail"),
|
|
233
|
+
jobs: path3.join(BASE_DIR, "api/src/jobs"),
|
|
234
|
+
distJobs: path3.join(BASE_DIR, "api/dist/jobs"),
|
|
235
|
+
jobsConfig: resolveFile(path3.join(BASE_DIR, "api/src/lib", "jobs")),
|
|
236
|
+
distJobsConfig: resolveFile(
|
|
237
|
+
path3.join(BASE_DIR, "api/dist", "lib", "jobs")
|
|
238
|
+
),
|
|
239
|
+
logger: resolveFile(path3.join(BASE_DIR, "api/src/lib", "logger"))
|
|
240
|
+
},
|
|
241
|
+
web: {
|
|
242
|
+
routes,
|
|
243
|
+
base: path3.join(BASE_DIR, "web"),
|
|
244
|
+
pages: path3.join(BASE_DIR, "web/src/pages/"),
|
|
245
|
+
components: path3.join(BASE_DIR, "web/src/components"),
|
|
246
|
+
layouts: path3.join(BASE_DIR, "web/src/layouts/"),
|
|
247
|
+
src: path3.join(BASE_DIR, "web/src"),
|
|
248
|
+
storybook: path3.join(BASE_DIR, "web/.storybook"),
|
|
249
|
+
app: resolveFile(path3.join(BASE_DIR, "web/src/App")),
|
|
250
|
+
document: resolveFile(path3.join(BASE_DIR, "web/src/Document")),
|
|
251
|
+
html: path3.join(BASE_DIR, "web/index.html"),
|
|
252
|
+
config: path3.join(BASE_DIR, "web/config"),
|
|
253
|
+
viteConfig,
|
|
254
|
+
postcss: path3.join(BASE_DIR, "web/config/postcss.config.cjs"),
|
|
255
|
+
storybookConfig: path3.join(BASE_DIR, "web/.storybook/main.js"),
|
|
256
|
+
storybookPreviewConfig: resolveFile(
|
|
257
|
+
path3.join(BASE_DIR, "web/.storybook/preview")
|
|
258
|
+
),
|
|
259
|
+
storybookManagerConfig: path3.join(BASE_DIR, "web/.storybook/manager.js"),
|
|
260
|
+
dist: path3.join(BASE_DIR, "web/dist"),
|
|
261
|
+
distBrowser: path3.join(BASE_DIR, "web/dist/browser"),
|
|
262
|
+
distRsc: path3.join(BASE_DIR, "web/dist/rsc"),
|
|
263
|
+
distSsr: path3.join(BASE_DIR, "web/dist/ssr"),
|
|
264
|
+
distSsrDocument: path3.join(BASE_DIR, "web/dist/ssr/Document"),
|
|
265
|
+
distSsrEntryServer: path3.join(BASE_DIR, "web/dist/ssr/entry.server"),
|
|
266
|
+
distRouteHooks: path3.join(BASE_DIR, "web/dist/ssr/routeHooks"),
|
|
267
|
+
distRscEntries: path3.join(BASE_DIR, "web/dist/rsc/entries.mjs"),
|
|
268
|
+
routeManifest: path3.join(BASE_DIR, "web/dist/ssr/route-manifest.json"),
|
|
269
|
+
types: path3.join(BASE_DIR, "web/types"),
|
|
270
|
+
entryClient: resolveFile(path3.join(BASE_DIR, "web/src/entry.client")),
|
|
271
|
+
// new vite/stream entry point for client
|
|
272
|
+
entryServer: resolveFile(path3.join(BASE_DIR, "web/src/entry.server")),
|
|
273
|
+
graphql: path3.join(BASE_DIR, "web/src/graphql")
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
fs4.mkdirSync(paths.generated.types.includes, { recursive: true });
|
|
277
|
+
fs4.mkdirSync(paths.generated.types.mirror, { recursive: true });
|
|
278
|
+
getPathsCache.set(BASE_DIR, paths);
|
|
279
|
+
return paths;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// src/prisma.ts
|
|
283
|
+
var configCache = /* @__PURE__ */ new Map();
|
|
284
|
+
async function loadPrismaConfig(prismaConfigPath) {
|
|
285
|
+
if (!fs5.existsSync(prismaConfigPath)) {
|
|
286
|
+
throw new Error(`Prisma config file not found at: ${prismaConfigPath}`);
|
|
287
|
+
}
|
|
288
|
+
if (configCache.has(prismaConfigPath)) {
|
|
289
|
+
return configCache.get(prismaConfigPath);
|
|
290
|
+
}
|
|
291
|
+
const configUrl = pathToFileURL(prismaConfigPath).href;
|
|
292
|
+
let config;
|
|
293
|
+
try {
|
|
294
|
+
const mod = await import(configUrl);
|
|
295
|
+
config = mod.default || mod;
|
|
296
|
+
if (!config) {
|
|
297
|
+
throw new Error("Prisma config must have a default export");
|
|
298
|
+
}
|
|
299
|
+
configCache.set(prismaConfigPath, config);
|
|
300
|
+
} catch (error) {
|
|
301
|
+
throw new Error(
|
|
302
|
+
`Failed to load Prisma config from ${prismaConfigPath}: ${error}`
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
return config;
|
|
306
|
+
}
|
|
307
|
+
async function getSchemaPath(prismaConfigPath) {
|
|
308
|
+
const config = await loadPrismaConfig(prismaConfigPath);
|
|
309
|
+
const configDir = path4.dirname(prismaConfigPath);
|
|
310
|
+
if (config.schema) {
|
|
311
|
+
return path4.isAbsolute(config.schema) ? config.schema : path4.resolve(configDir, config.schema);
|
|
312
|
+
}
|
|
313
|
+
return path4.join(configDir, "schema.prisma");
|
|
314
|
+
}
|
|
315
|
+
async function getPrismaSchemas() {
|
|
316
|
+
const mod = await import("@prisma/internals");
|
|
317
|
+
const { createSchemaPathInput, getSchemaWithPath } = mod.default || mod;
|
|
318
|
+
const schemaPath = await getSchemaPath(getPaths().api.prismaConfig);
|
|
319
|
+
const schemaPathInput = createSchemaPathInput({
|
|
320
|
+
baseDir: fs5.lstatSync(schemaPath).isDirectory() ? schemaPath : path4.dirname(schemaPath),
|
|
321
|
+
schemaPathFromConfig: schemaPath
|
|
322
|
+
});
|
|
323
|
+
return getSchemaWithPath({ schemaPath: schemaPathInput });
|
|
324
|
+
}
|
|
325
|
+
async function getPrismaClientOutputDirs() {
|
|
326
|
+
try {
|
|
327
|
+
const mod = await import("@prisma/internals");
|
|
328
|
+
const { getConfig: getConfig2 } = mod.default || mod;
|
|
329
|
+
const { schemas, schemaRootDir } = await getPrismaSchemas();
|
|
330
|
+
const config = await getConfig2({ datamodel: schemas });
|
|
331
|
+
return config.generators.filter(
|
|
332
|
+
(generator) => ["prisma-client", "prisma-client-js"].includes(
|
|
333
|
+
generator.provider.value ?? ""
|
|
334
|
+
)
|
|
335
|
+
).map((generator) => generator.output?.value).filter((output) => Boolean(output)).map(
|
|
336
|
+
(output) => path4.isAbsolute(output) ? output : path4.resolve(schemaRootDir, output)
|
|
337
|
+
);
|
|
338
|
+
} catch {
|
|
339
|
+
return [];
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// src/prismaClientOutputDirsWorker.ts
|
|
344
|
+
parentPort?.postMessage(await getPrismaClientOutputDirs());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prismaClientOutputDirsWorkerUrl.d.ts","sourceRoot":"","sources":["../src/prismaClientOutputDirsWorkerUrl.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,+BAA+B,KAG3C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/project-config",
|
|
3
|
-
"version": "8.0.0-canary.
|
|
3
|
+
"version": "8.0.0-canary.3366",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@arethetypeswrong/cli": "0.18.5",
|
|
49
|
-
"@cedarjs/framework-tools": "8.0.0-canary.
|
|
49
|
+
"@cedarjs/framework-tools": "8.0.0-canary.3366",
|
|
50
50
|
"concurrently": "9.2.4",
|
|
51
51
|
"prisma": "7.10.0",
|
|
52
52
|
"publint": "0.3.25",
|