@cedarjs/project-config 7.0.0-rc.128 → 7.0.1-next.305
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/config.d.ts +47 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/index.js +30 -30
- package/dist/packageManager.js +2 -1
- package/dist/paths.d.ts +0 -3
- package/dist/paths.d.ts.map +1 -1
- package/dist/workspaces.js +2 -1
- package/package.json +11 -29
- package/dist/cjs/config.d.ts +0 -154
- package/dist/cjs/config.d.ts.map +0 -1
- package/dist/cjs/configPath.d.ts +0 -5
- package/dist/cjs/configPath.d.ts.map +0 -1
- package/dist/cjs/envVarDefinitions.d.ts +0 -14
- package/dist/cjs/envVarDefinitions.d.ts.map +0 -1
- package/dist/cjs/envVars.d.ts +0 -32
- package/dist/cjs/envVars.d.ts.map +0 -1
- package/dist/cjs/findUp.d.ts +0 -5
- package/dist/cjs/findUp.d.ts.map +0 -1
- package/dist/cjs/generatedDataDir.d.ts +0 -10
- package/dist/cjs/generatedDataDir.d.ts.map +0 -1
- package/dist/cjs/index.d.ts +0 -9
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js +0 -701
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/packageManager.d.ts +0 -20
- package/dist/cjs/packageManager.d.ts.map +0 -1
- package/dist/cjs/packageManager.js +0 -349
- package/dist/cjs/paths.d.ts +0 -152
- package/dist/cjs/paths.d.ts.map +0 -1
- package/dist/cjs/prisma.d.ts +0 -63
- package/dist/cjs/prisma.d.ts.map +0 -1
- package/dist/cjs/workspaces.d.ts +0 -2
- package/dist/cjs/workspaces.d.ts.map +0 -1
- package/dist/cjs/workspaces.js +0 -376
- package/dist/package.json +0 -1
package/dist/cjs/index.js
DELETED
|
@@ -1,701 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
DEFAULT_CONFIG: () => DEFAULT_CONFIG,
|
|
34
|
-
TargetEnum: () => TargetEnum,
|
|
35
|
-
ensurePosixPath: () => ensurePosixPath,
|
|
36
|
-
findUp: () => findUp,
|
|
37
|
-
getAppRouteHook: () => getAppRouteHook,
|
|
38
|
-
getBaseDir: () => getBaseDir,
|
|
39
|
-
getBaseDirFromFile: () => getBaseDirFromFile,
|
|
40
|
-
getBuiltDocumentFile: () => getBuiltDocumentFile,
|
|
41
|
-
getBuiltServerEntryFile: () => getBuiltServerEntryFile,
|
|
42
|
-
getConfig: () => getConfig,
|
|
43
|
-
getConfigPath: () => getConfigPath,
|
|
44
|
-
getDataMigrationsPath: () => getDataMigrationsPath,
|
|
45
|
-
getDbDir: () => getDbDir,
|
|
46
|
-
getEnvVarDefinitions: () => getEnvVarDefinitions,
|
|
47
|
-
getGeneratedDataDirPath: () => getGeneratedDataDirPath,
|
|
48
|
-
getMigrationsPath: () => getMigrationsPath,
|
|
49
|
-
getPaths: () => getPaths,
|
|
50
|
-
getPrismaDatasourceProvider: () => getPrismaDatasourceProvider,
|
|
51
|
-
getPrismaSchemas: () => getPrismaSchemas,
|
|
52
|
-
getRawConfig: () => getRawConfig,
|
|
53
|
-
getRouteHookForPage: () => getRouteHookForPage,
|
|
54
|
-
getSchemaPath: () => getSchemaPath,
|
|
55
|
-
importStatementPath: () => importStatementPath,
|
|
56
|
-
isTypeScriptProject: () => isTypeScriptProject,
|
|
57
|
-
loadPrismaConfig: () => loadPrismaConfig,
|
|
58
|
-
parsePort: () => parsePort,
|
|
59
|
-
processPagesDir: () => processPagesDir,
|
|
60
|
-
projectIsEsm: () => projectIsEsm,
|
|
61
|
-
projectRootIsEsm: () => projectRootIsEsm,
|
|
62
|
-
projectSideIsEsm: () => projectSideIsEsm,
|
|
63
|
-
readEnvVar: () => readEnvVar,
|
|
64
|
-
resolveFile: () => resolveFile,
|
|
65
|
-
resolveGeneratedPrismaClient: () => resolveGeneratedPrismaClient
|
|
66
|
-
});
|
|
67
|
-
module.exports = __toCommonJS(index_exports);
|
|
68
|
-
|
|
69
|
-
// src/config.ts
|
|
70
|
-
var import_node_fs2 = __toESM(require("node:fs"), 1);
|
|
71
|
-
var import_deepmerge = __toESM(require("deepmerge"), 1);
|
|
72
|
-
var toml = __toESM(require("smol-toml"), 1);
|
|
73
|
-
var import_string_env_interpolation = require("string-env-interpolation");
|
|
74
|
-
|
|
75
|
-
// src/findUp.ts
|
|
76
|
-
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
77
|
-
var import_path = __toESM(require("path"), 1);
|
|
78
|
-
function findUp(file, startingDirectory = process.cwd()) {
|
|
79
|
-
const possibleFilepath = import_path.default.join(startingDirectory, file);
|
|
80
|
-
if (import_node_fs.default.existsSync(possibleFilepath)) {
|
|
81
|
-
return possibleFilepath;
|
|
82
|
-
}
|
|
83
|
-
const parentDirectory = import_path.default.dirname(startingDirectory);
|
|
84
|
-
if (parentDirectory === startingDirectory) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
return findUp(file, parentDirectory);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// src/configPath.ts
|
|
91
|
-
var CONFIG_FILE_NAMES = ["cedar.toml", "redwood.toml"];
|
|
92
|
-
var getConfigPathCache = /* @__PURE__ */ new Map();
|
|
93
|
-
var getConfigPath = (cwd = process.env.CEDAR_CWD ?? process.env.RWJS_CWD ?? process.cwd()) => {
|
|
94
|
-
const cachedPath = getConfigPathCache.get(cwd);
|
|
95
|
-
if (cachedPath) {
|
|
96
|
-
return cachedPath;
|
|
97
|
-
}
|
|
98
|
-
const configPath = findUp("cedar.toml", cwd) || findUp("redwood.toml", cwd);
|
|
99
|
-
if (!configPath) {
|
|
100
|
-
throw new Error(
|
|
101
|
-
`Could not find a "${CONFIG_FILE_NAMES.join('" or "')}" file, are you sure you're in a Cedar project?`
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
getConfigPathCache.set(cwd, configPath);
|
|
105
|
-
return configPath;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// src/config.ts
|
|
109
|
-
var TargetEnum = /* @__PURE__ */ ((TargetEnum2) => {
|
|
110
|
-
TargetEnum2["NODE"] = "node";
|
|
111
|
-
TargetEnum2["BROWSER"] = "browser";
|
|
112
|
-
TargetEnum2["REACT_NATIVE"] = "react-native";
|
|
113
|
-
TargetEnum2["ELECTRON"] = "electron";
|
|
114
|
-
return TargetEnum2;
|
|
115
|
-
})(TargetEnum || {});
|
|
116
|
-
var DEFAULT_CONFIG = {
|
|
117
|
-
web: {
|
|
118
|
-
title: "Cedar App",
|
|
119
|
-
port: 8910,
|
|
120
|
-
path: "./web",
|
|
121
|
-
target: "browser" /* BROWSER */,
|
|
122
|
-
includeEnvironmentVariables: [],
|
|
123
|
-
apiUrl: "/.api/functions",
|
|
124
|
-
fastRefresh: true,
|
|
125
|
-
a11y: true,
|
|
126
|
-
sourceMap: false
|
|
127
|
-
},
|
|
128
|
-
api: {
|
|
129
|
-
title: "Cedar App",
|
|
130
|
-
port: 8911,
|
|
131
|
-
path: "./api",
|
|
132
|
-
target: "node" /* NODE */,
|
|
133
|
-
prismaConfig: "./api/prisma.config.cjs",
|
|
134
|
-
prismaGenerateArgs: [],
|
|
135
|
-
serverConfig: "./api/server.config.js",
|
|
136
|
-
debugPort: void 0
|
|
137
|
-
},
|
|
138
|
-
graphql: {
|
|
139
|
-
fragments: false,
|
|
140
|
-
trustedDocuments: false,
|
|
141
|
-
includeScalars: { File: true }
|
|
142
|
-
},
|
|
143
|
-
browser: {
|
|
144
|
-
open: false
|
|
145
|
-
},
|
|
146
|
-
generate: {
|
|
147
|
-
tests: true,
|
|
148
|
-
stories: true,
|
|
149
|
-
nestScaffoldByModel: true
|
|
150
|
-
},
|
|
151
|
-
notifications: {
|
|
152
|
-
versionUpdates: []
|
|
153
|
-
},
|
|
154
|
-
studio: {
|
|
155
|
-
basePort: 4318,
|
|
156
|
-
graphiql: {
|
|
157
|
-
authImpersonation: {
|
|
158
|
-
authProvider: void 0,
|
|
159
|
-
userId: void 0,
|
|
160
|
-
email: void 0,
|
|
161
|
-
jwtSecret: "secret"
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
test: {
|
|
166
|
-
autoConsentToDbReset: false
|
|
167
|
-
},
|
|
168
|
-
experimental: {
|
|
169
|
-
opentelemetry: {
|
|
170
|
-
enabled: false,
|
|
171
|
-
wrapApi: true
|
|
172
|
-
},
|
|
173
|
-
cli: {
|
|
174
|
-
autoInstall: true,
|
|
175
|
-
plugins: [
|
|
176
|
-
{
|
|
177
|
-
package: "@cedarjs/cli-storybook-vite"
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
package: "@cedarjs/cli-data-migrate"
|
|
181
|
-
}
|
|
182
|
-
]
|
|
183
|
-
},
|
|
184
|
-
useSDLCodeGenForGraphQLTypes: false,
|
|
185
|
-
streamingSsr: {
|
|
186
|
-
enabled: false
|
|
187
|
-
},
|
|
188
|
-
rsc: {
|
|
189
|
-
enabled: false
|
|
190
|
-
},
|
|
191
|
-
realtime: {
|
|
192
|
-
enabled: false
|
|
193
|
-
},
|
|
194
|
-
reactCompiler: {
|
|
195
|
-
enabled: false,
|
|
196
|
-
lintOnly: false
|
|
197
|
-
},
|
|
198
|
-
packagesWorkspace: {
|
|
199
|
-
enabled: false
|
|
200
|
-
},
|
|
201
|
-
gqlorm: {
|
|
202
|
-
enabled: false,
|
|
203
|
-
organizationModel: "Organization",
|
|
204
|
-
membershipModel: "Membership",
|
|
205
|
-
membershipUserField: "userId",
|
|
206
|
-
membershipOrganizationField: "organizationId"
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
function getConfig(configPath) {
|
|
211
|
-
const config = (0, import_deepmerge.default)(DEFAULT_CONFIG, getRawConfig(configPath));
|
|
212
|
-
return config;
|
|
213
|
-
}
|
|
214
|
-
function getRawConfig(configPath = getConfigPath()) {
|
|
215
|
-
try {
|
|
216
|
-
return toml.parse((0, import_string_env_interpolation.env)(import_node_fs2.default.readFileSync(configPath, "utf8")));
|
|
217
|
-
} catch (e) {
|
|
218
|
-
throw new Error(`Could not parse "${configPath}": ${e}`);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// src/envVars.ts
|
|
223
|
-
function readEnvVar(name, { deprecatedAlias }) {
|
|
224
|
-
return process.env[name] || process.env[deprecatedAlias] || void 0;
|
|
225
|
-
}
|
|
226
|
-
function parsePort(value, envVarName) {
|
|
227
|
-
const trimmed = value.trim();
|
|
228
|
-
if (!/^\d+$/.test(trimmed)) {
|
|
229
|
-
throw new Error(
|
|
230
|
-
`Invalid ${envVarName} env var value: "${value}". Must be an integer.`
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
const port = Number(trimmed);
|
|
234
|
-
if (port > 65535) {
|
|
235
|
-
throw new Error(
|
|
236
|
-
`Invalid ${envVarName} env var value: "${value}". Must be between 0 and 65535.`
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
return port;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// src/generatedDataDir.ts
|
|
243
|
-
var import_node_fs3 = __toESM(require("node:fs"), 1);
|
|
244
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
245
|
-
function getGeneratedDataDirPath(cwd = process.env.CEDAR_CWD ?? process.env.RWJS_CWD ?? process.cwd()) {
|
|
246
|
-
const configPath = getConfigPath(cwd);
|
|
247
|
-
const projectRoot = import_node_path.default.dirname(configPath);
|
|
248
|
-
const rootDotCedarDir = import_node_path.default.join(projectRoot, ".cedar");
|
|
249
|
-
const rootDotRedwoodDir = import_node_path.default.join(projectRoot, ".redwood");
|
|
250
|
-
const generatedDirPath = import_node_fs3.default.existsSync(rootDotCedarDir) ? rootDotCedarDir : import_node_fs3.default.existsSync(rootDotRedwoodDir) ? rootDotRedwoodDir : rootDotCedarDir;
|
|
251
|
-
return generatedDirPath;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// src/paths.ts
|
|
255
|
-
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
256
|
-
var import_path2 = __toESM(require("path"), 1);
|
|
257
|
-
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
258
|
-
var getBaseDir = (configPath = getConfigPath()) => {
|
|
259
|
-
return import_path2.default.dirname(configPath);
|
|
260
|
-
};
|
|
261
|
-
var getBaseDirFromFile = (file) => {
|
|
262
|
-
return getBaseDir(getConfigPath(import_path2.default.dirname(file)));
|
|
263
|
-
};
|
|
264
|
-
var resolveFile = (filePath, extensions = [".js", ".tsx", ".ts", ".jsx", ".mjs", ".mts", ".cjs"]) => {
|
|
265
|
-
for (const extension of extensions) {
|
|
266
|
-
const p = `${filePath}${extension}`;
|
|
267
|
-
if (import_node_fs4.default.existsSync(p)) {
|
|
268
|
-
return p;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
return null;
|
|
272
|
-
};
|
|
273
|
-
var getPathsCache = /* @__PURE__ */ new Map();
|
|
274
|
-
function getPaths(BASE_DIR = getBaseDir()) {
|
|
275
|
-
if (getPathsCache.has(BASE_DIR)) {
|
|
276
|
-
return getPathsCache.get(BASE_DIR);
|
|
277
|
-
}
|
|
278
|
-
const routes = resolveFile(import_path2.default.join(BASE_DIR, "web/src/Routes"));
|
|
279
|
-
const { prismaConfig: prismaConfigFromConfig } = getConfig(
|
|
280
|
-
getConfigPath(BASE_DIR)
|
|
281
|
-
).api;
|
|
282
|
-
const prismaConfigBase = import_path2.default.join(
|
|
283
|
-
BASE_DIR,
|
|
284
|
-
prismaConfigFromConfig.replace(/\.[^.]+$/, "")
|
|
285
|
-
);
|
|
286
|
-
const prismaConfig = resolveFile(prismaConfigBase) || import_path2.default.join(BASE_DIR, prismaConfigFromConfig);
|
|
287
|
-
const viteConfig = resolveFile(
|
|
288
|
-
import_path2.default.join(BASE_DIR, "web/vite.config")
|
|
289
|
-
);
|
|
290
|
-
const generatedBase = getGeneratedDataDirPath(BASE_DIR);
|
|
291
|
-
const paths = {
|
|
292
|
-
base: BASE_DIR,
|
|
293
|
-
generated: {
|
|
294
|
-
base: generatedBase,
|
|
295
|
-
schema: import_path2.default.join(generatedBase, "schema.graphql"),
|
|
296
|
-
types: {
|
|
297
|
-
includes: import_path2.default.join(generatedBase, "types/includes"),
|
|
298
|
-
mirror: import_path2.default.join(generatedBase, "types/mirror")
|
|
299
|
-
},
|
|
300
|
-
prebuild: import_path2.default.join(generatedBase, "prebuild")
|
|
301
|
-
},
|
|
302
|
-
scripts: import_path2.default.join(BASE_DIR, "scripts"),
|
|
303
|
-
packages: import_path2.default.join(BASE_DIR, "packages"),
|
|
304
|
-
generatorTemplates: import_path2.default.join(BASE_DIR, "generatorTemplates"),
|
|
305
|
-
api: {
|
|
306
|
-
base: import_path2.default.join(BASE_DIR, "api"),
|
|
307
|
-
prismaConfig,
|
|
308
|
-
functions: import_path2.default.join(BASE_DIR, "api/src/functions"),
|
|
309
|
-
graphql: import_path2.default.join(BASE_DIR, "api/src/graphql"),
|
|
310
|
-
lib: import_path2.default.join(BASE_DIR, "api/src/lib"),
|
|
311
|
-
config: import_path2.default.join(BASE_DIR, "api/src/config"),
|
|
312
|
-
services: import_path2.default.join(BASE_DIR, "api/src/services"),
|
|
313
|
-
directives: import_path2.default.join(BASE_DIR, "api/src/directives"),
|
|
314
|
-
subscriptions: import_path2.default.join(BASE_DIR, "api/src/subscriptions"),
|
|
315
|
-
src: import_path2.default.join(BASE_DIR, "api/src"),
|
|
316
|
-
dist: import_path2.default.join(BASE_DIR, "api/dist"),
|
|
317
|
-
types: import_path2.default.join(BASE_DIR, "api/types"),
|
|
318
|
-
models: import_path2.default.join(BASE_DIR, "api/src/models"),
|
|
319
|
-
mail: import_path2.default.join(BASE_DIR, "api/src", "mail"),
|
|
320
|
-
jobs: import_path2.default.join(BASE_DIR, "api/src/jobs"),
|
|
321
|
-
distJobs: import_path2.default.join(BASE_DIR, "api/dist/jobs"),
|
|
322
|
-
jobsConfig: resolveFile(import_path2.default.join(BASE_DIR, "api/src/lib", "jobs")),
|
|
323
|
-
distJobsConfig: resolveFile(
|
|
324
|
-
import_path2.default.join(BASE_DIR, "api/dist", "lib", "jobs")
|
|
325
|
-
),
|
|
326
|
-
logger: resolveFile(import_path2.default.join(BASE_DIR, "api/src/lib", "logger"))
|
|
327
|
-
},
|
|
328
|
-
web: {
|
|
329
|
-
routes,
|
|
330
|
-
base: import_path2.default.join(BASE_DIR, "web"),
|
|
331
|
-
pages: import_path2.default.join(BASE_DIR, "web/src/pages/"),
|
|
332
|
-
components: import_path2.default.join(BASE_DIR, "web/src/components"),
|
|
333
|
-
layouts: import_path2.default.join(BASE_DIR, "web/src/layouts/"),
|
|
334
|
-
src: import_path2.default.join(BASE_DIR, "web/src"),
|
|
335
|
-
storybook: import_path2.default.join(BASE_DIR, "web/.storybook"),
|
|
336
|
-
app: resolveFile(import_path2.default.join(BASE_DIR, "web/src/App")),
|
|
337
|
-
document: resolveFile(import_path2.default.join(BASE_DIR, "web/src/Document")),
|
|
338
|
-
html: import_path2.default.join(BASE_DIR, "web/index.html"),
|
|
339
|
-
config: import_path2.default.join(BASE_DIR, "web/config"),
|
|
340
|
-
viteConfig,
|
|
341
|
-
postcss: import_path2.default.join(BASE_DIR, "web/config/postcss.config.cjs"),
|
|
342
|
-
storybookConfig: import_path2.default.join(BASE_DIR, "web/.storybook/main.js"),
|
|
343
|
-
storybookPreviewConfig: resolveFile(
|
|
344
|
-
import_path2.default.join(BASE_DIR, "web/.storybook/preview")
|
|
345
|
-
),
|
|
346
|
-
storybookManagerConfig: import_path2.default.join(BASE_DIR, "web/.storybook/manager.js"),
|
|
347
|
-
dist: import_path2.default.join(BASE_DIR, "web/dist"),
|
|
348
|
-
distBrowser: import_path2.default.join(BASE_DIR, "web/dist/browser"),
|
|
349
|
-
distRsc: import_path2.default.join(BASE_DIR, "web/dist/rsc"),
|
|
350
|
-
distSsr: import_path2.default.join(BASE_DIR, "web/dist/ssr"),
|
|
351
|
-
distSsrDocument: import_path2.default.join(BASE_DIR, "web/dist/ssr/Document"),
|
|
352
|
-
distSsrEntryServer: import_path2.default.join(BASE_DIR, "web/dist/ssr/entry.server"),
|
|
353
|
-
distRouteHooks: import_path2.default.join(BASE_DIR, "web/dist/ssr/routeHooks"),
|
|
354
|
-
distRscEntries: import_path2.default.join(BASE_DIR, "web/dist/rsc/entries.mjs"),
|
|
355
|
-
routeManifest: import_path2.default.join(BASE_DIR, "web/dist/ssr/route-manifest.json"),
|
|
356
|
-
types: import_path2.default.join(BASE_DIR, "web/types"),
|
|
357
|
-
entryClient: resolveFile(import_path2.default.join(BASE_DIR, "web/src/entry.client")),
|
|
358
|
-
// new vite/stream entry point for client
|
|
359
|
-
entryServer: resolveFile(import_path2.default.join(BASE_DIR, "web/src/entry.server")),
|
|
360
|
-
graphql: import_path2.default.join(BASE_DIR, "web/src/graphql")
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
import_node_fs4.default.mkdirSync(paths.generated.types.includes, { recursive: true });
|
|
364
|
-
import_node_fs4.default.mkdirSync(paths.generated.types.mirror, { recursive: true });
|
|
365
|
-
getPathsCache.set(BASE_DIR, paths);
|
|
366
|
-
return paths;
|
|
367
|
-
}
|
|
368
|
-
var getRouteHookForPage = (pagePath) => {
|
|
369
|
-
if (!pagePath) {
|
|
370
|
-
return null;
|
|
371
|
-
}
|
|
372
|
-
return import_fast_glob.default.sync("*.routeHooks.{js,ts,tsx,jsx}", {
|
|
373
|
-
absolute: true,
|
|
374
|
-
cwd: import_path2.default.dirname(pagePath)
|
|
375
|
-
// the page's folder
|
|
376
|
-
}).at(0) || null;
|
|
377
|
-
};
|
|
378
|
-
var getAppRouteHook = (forProd = false) => {
|
|
379
|
-
const rwPaths = getPaths();
|
|
380
|
-
if (forProd) {
|
|
381
|
-
const distAppRouteHook = import_path2.default.join(
|
|
382
|
-
rwPaths.web.distRouteHooks,
|
|
383
|
-
"App.routeHooks.js"
|
|
384
|
-
);
|
|
385
|
-
try {
|
|
386
|
-
import_node_fs4.default.statSync(distAppRouteHook).isFile();
|
|
387
|
-
return distAppRouteHook;
|
|
388
|
-
} catch {
|
|
389
|
-
return null;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
return resolveFile(import_path2.default.join(rwPaths.web.src, "App.routeHooks"));
|
|
393
|
-
};
|
|
394
|
-
function getBuiltServerEntryFile() {
|
|
395
|
-
const entryServer = getPaths().web.distSsrEntryServer;
|
|
396
|
-
const resolvedEntryServer = resolveFile(entryServer);
|
|
397
|
-
if (!resolvedEntryServer) {
|
|
398
|
-
throw new Error("Server entry file not found (" + entryServer + ")");
|
|
399
|
-
}
|
|
400
|
-
return resolvedEntryServer;
|
|
401
|
-
}
|
|
402
|
-
function getBuiltDocumentFile() {
|
|
403
|
-
const document = getPaths().web.distSsrDocument;
|
|
404
|
-
const resolvedDocument = resolveFile(document);
|
|
405
|
-
if (!resolvedDocument) {
|
|
406
|
-
throw new Error("Document file not found (" + document + ")");
|
|
407
|
-
}
|
|
408
|
-
return resolvedDocument;
|
|
409
|
-
}
|
|
410
|
-
var processPagesDir = (webPagesDir = getPaths().web.pages) => {
|
|
411
|
-
const pagePaths = import_fast_glob.default.sync("**/*Page.{js,jsx,ts,tsx}", {
|
|
412
|
-
cwd: webPagesDir,
|
|
413
|
-
ignore: ["node_modules"]
|
|
414
|
-
});
|
|
415
|
-
return pagePaths.map((pagePath) => {
|
|
416
|
-
const p = import_path2.default.parse(pagePath);
|
|
417
|
-
const importName = p.dir.replace(/\//g, "");
|
|
418
|
-
const importPath = importStatementPath(
|
|
419
|
-
import_path2.default.join(webPagesDir, p.dir, p.name)
|
|
420
|
-
);
|
|
421
|
-
const importStatement = `const ${importName} = { name: '${importName}', loader: import('${importPath}') }`;
|
|
422
|
-
return {
|
|
423
|
-
importName,
|
|
424
|
-
constName: importName,
|
|
425
|
-
importPath,
|
|
426
|
-
path: import_path2.default.join(webPagesDir, pagePath),
|
|
427
|
-
importStatement
|
|
428
|
-
};
|
|
429
|
-
});
|
|
430
|
-
};
|
|
431
|
-
var ensurePosixPath = (path7) => {
|
|
432
|
-
let posixPath = path7;
|
|
433
|
-
if (process.platform === "win32") {
|
|
434
|
-
if (/^[A-Z]:\\/.test(path7)) {
|
|
435
|
-
const drive = path7[0].toLowerCase();
|
|
436
|
-
posixPath = `/${drive}/${path7.substring(3)}`;
|
|
437
|
-
}
|
|
438
|
-
posixPath = posixPath.replace(/\\/g, "/");
|
|
439
|
-
}
|
|
440
|
-
return posixPath;
|
|
441
|
-
};
|
|
442
|
-
var importStatementPath = (path7) => {
|
|
443
|
-
let importPath = path7;
|
|
444
|
-
if (process.platform === "win32") {
|
|
445
|
-
importPath = importPath.replaceAll("\\", "/");
|
|
446
|
-
}
|
|
447
|
-
return importPath;
|
|
448
|
-
};
|
|
449
|
-
function packageJsonIsEsm(packageJsonPath) {
|
|
450
|
-
const packageJsonContents = JSON.parse(
|
|
451
|
-
import_node_fs4.default.readFileSync(packageJsonPath, "utf-8")
|
|
452
|
-
);
|
|
453
|
-
return packageJsonContents.type === "module";
|
|
454
|
-
}
|
|
455
|
-
function projectRootIsEsm() {
|
|
456
|
-
return packageJsonIsEsm(import_path2.default.join(getPaths().base, "package.json"));
|
|
457
|
-
}
|
|
458
|
-
function projectSideIsEsm(side) {
|
|
459
|
-
const cedarProjectPaths = getPaths();
|
|
460
|
-
return packageJsonIsEsm(
|
|
461
|
-
import_path2.default.join(cedarProjectPaths[side].base, "package.json")
|
|
462
|
-
);
|
|
463
|
-
}
|
|
464
|
-
function projectIsEsm() {
|
|
465
|
-
if (!projectRootIsEsm()) {
|
|
466
|
-
return false;
|
|
467
|
-
}
|
|
468
|
-
for (const side of ["api", "web"]) {
|
|
469
|
-
if (!projectSideIsEsm(side)) {
|
|
470
|
-
return false;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
return true;
|
|
474
|
-
}
|
|
475
|
-
var isTypeScriptProject = () => {
|
|
476
|
-
const paths = getPaths();
|
|
477
|
-
return import_node_fs4.default.existsSync(import_path2.default.join(paths.web.base, "tsconfig.json")) || import_node_fs4.default.existsSync(import_path2.default.join(paths.api.base, "tsconfig.json"));
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
// src/prisma.ts
|
|
481
|
-
var import_node_fs6 = __toESM(require("node:fs"), 1);
|
|
482
|
-
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
483
|
-
var import_node_url = require("node:url");
|
|
484
|
-
|
|
485
|
-
// src/packageManager.ts
|
|
486
|
-
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
487
|
-
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
488
|
-
var packageManagerCache;
|
|
489
|
-
function getPackageManager() {
|
|
490
|
-
if (packageManagerCache) {
|
|
491
|
-
return packageManagerCache;
|
|
492
|
-
}
|
|
493
|
-
const base = getPaths().base;
|
|
494
|
-
packageManagerCache = "yarn";
|
|
495
|
-
const envPackageManager = process.env.npm_config_user_agent?.split(" ")[0]?.split("/")[0];
|
|
496
|
-
if (isPackageManager(envPackageManager)) {
|
|
497
|
-
packageManagerCache = envPackageManager;
|
|
498
|
-
} else if (import_node_fs5.default.existsSync(import_node_path2.default.join(base, "yarn.lock"))) {
|
|
499
|
-
packageManagerCache = "yarn";
|
|
500
|
-
} else if (import_node_fs5.default.existsSync(import_node_path2.default.join(base, "pnpm-lock.yaml"))) {
|
|
501
|
-
packageManagerCache = "pnpm";
|
|
502
|
-
} else if (import_node_fs5.default.existsSync(import_node_path2.default.join(base, "package-lock.json"))) {
|
|
503
|
-
packageManagerCache = "npm";
|
|
504
|
-
}
|
|
505
|
-
return packageManagerCache;
|
|
506
|
-
}
|
|
507
|
-
function isPackageManager(pm) {
|
|
508
|
-
return pm === "yarn" || pm === "npm" || pm === "pnpm";
|
|
509
|
-
}
|
|
510
|
-
function prettyPrintCedarCommand(args) {
|
|
511
|
-
const packageManager = getPackageManager();
|
|
512
|
-
const packageManagerBin = packageManager === "npm" ? "npx" : packageManager;
|
|
513
|
-
return `${packageManagerBin} cedar ${args.join(" ")}`;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
// src/prisma.ts
|
|
517
|
-
var configCache = /* @__PURE__ */ new Map();
|
|
518
|
-
async function loadPrismaConfig(prismaConfigPath) {
|
|
519
|
-
if (!import_node_fs6.default.existsSync(prismaConfigPath)) {
|
|
520
|
-
throw new Error(`Prisma config file not found at: ${prismaConfigPath}`);
|
|
521
|
-
}
|
|
522
|
-
if (configCache.has(prismaConfigPath)) {
|
|
523
|
-
return configCache.get(prismaConfigPath);
|
|
524
|
-
}
|
|
525
|
-
const configUrl = (0, import_node_url.pathToFileURL)(prismaConfigPath).href;
|
|
526
|
-
let config;
|
|
527
|
-
try {
|
|
528
|
-
const mod = require(prismaConfigPath);
|
|
529
|
-
config = mod.default || mod;
|
|
530
|
-
if (!config) {
|
|
531
|
-
throw new Error("Prisma config must have a default export");
|
|
532
|
-
}
|
|
533
|
-
configCache.set(prismaConfigPath, config);
|
|
534
|
-
} catch (error) {
|
|
535
|
-
throw new Error(
|
|
536
|
-
`Failed to load Prisma config from ${prismaConfigPath}: ${error}`
|
|
537
|
-
);
|
|
538
|
-
}
|
|
539
|
-
return config;
|
|
540
|
-
}
|
|
541
|
-
async function getSchemaPath(prismaConfigPath) {
|
|
542
|
-
const config = await loadPrismaConfig(prismaConfigPath);
|
|
543
|
-
const configDir = import_node_path3.default.dirname(prismaConfigPath);
|
|
544
|
-
if (config.schema) {
|
|
545
|
-
return import_node_path3.default.isAbsolute(config.schema) ? config.schema : import_node_path3.default.resolve(configDir, config.schema);
|
|
546
|
-
}
|
|
547
|
-
return import_node_path3.default.join(configDir, "schema.prisma");
|
|
548
|
-
}
|
|
549
|
-
async function getPrismaSchemas() {
|
|
550
|
-
const mod = require("@prisma/internals");
|
|
551
|
-
const { createSchemaPathInput, getSchemaWithPath } = mod.default || mod;
|
|
552
|
-
const schemaPath = await getSchemaPath(getPaths().api.prismaConfig);
|
|
553
|
-
const schemaPathInput = createSchemaPathInput({
|
|
554
|
-
baseDir: import_node_fs6.default.lstatSync(schemaPath).isDirectory() ? schemaPath : import_node_path3.default.dirname(schemaPath),
|
|
555
|
-
schemaPathFromConfig: schemaPath
|
|
556
|
-
});
|
|
557
|
-
return getSchemaWithPath({ schemaPath: schemaPathInput });
|
|
558
|
-
}
|
|
559
|
-
async function getPrismaDatasourceProvider() {
|
|
560
|
-
const mod = await import("@prisma/internals");
|
|
561
|
-
const { getConfig: getConfig3 } = mod.default || mod;
|
|
562
|
-
const { schemas } = await getPrismaSchemas();
|
|
563
|
-
const config = await getConfig3({ datamodel: schemas });
|
|
564
|
-
return config.datasources[0].activeProvider;
|
|
565
|
-
}
|
|
566
|
-
async function getMigrationsPath(prismaConfigPath) {
|
|
567
|
-
const config = await loadPrismaConfig(prismaConfigPath);
|
|
568
|
-
const configDir = import_node_path3.default.dirname(prismaConfigPath);
|
|
569
|
-
if (config.migrations?.path) {
|
|
570
|
-
return import_node_path3.default.isAbsolute(config.migrations.path) ? config.migrations.path : import_node_path3.default.resolve(configDir, config.migrations.path);
|
|
571
|
-
}
|
|
572
|
-
const schemaPath = await getSchemaPath(prismaConfigPath);
|
|
573
|
-
const schemaDir = import_node_fs6.default.statSync(schemaPath).isDirectory() ? schemaPath : import_node_path3.default.dirname(schemaPath);
|
|
574
|
-
return import_node_path3.default.join(schemaDir, "migrations");
|
|
575
|
-
}
|
|
576
|
-
async function getDbDir(prismaConfigPath) {
|
|
577
|
-
const schemaPath = await getSchemaPath(prismaConfigPath);
|
|
578
|
-
if (import_node_fs6.default.existsSync(schemaPath) && import_node_fs6.default.statSync(schemaPath).isDirectory()) {
|
|
579
|
-
return schemaPath;
|
|
580
|
-
}
|
|
581
|
-
return import_node_path3.default.dirname(schemaPath);
|
|
582
|
-
}
|
|
583
|
-
async function getDataMigrationsPath(prismaConfigPath) {
|
|
584
|
-
const migrationsPath = await getMigrationsPath(prismaConfigPath);
|
|
585
|
-
const migrationsDir = import_node_path3.default.dirname(migrationsPath);
|
|
586
|
-
return import_node_path3.default.join(migrationsDir, "dataMigrations");
|
|
587
|
-
}
|
|
588
|
-
async function resolveGeneratedPrismaClient() {
|
|
589
|
-
let generatorOutputPath;
|
|
590
|
-
let ext = "ts";
|
|
591
|
-
try {
|
|
592
|
-
const prismaInternalsMod = require("@prisma/internals");
|
|
593
|
-
const { getConfig: getConfig3 } = prismaInternalsMod.default || prismaInternalsMod;
|
|
594
|
-
const { schemas, schemaRootDir } = await getPrismaSchemas();
|
|
595
|
-
const config = await getConfig3({ datamodel: schemas });
|
|
596
|
-
const generator = config.generators.find((entry) => entry.name === "client") ?? config.generators[0];
|
|
597
|
-
const output = generator?.output?.value;
|
|
598
|
-
const generatedFileExtension = generator?.config?.generatedFileExtension;
|
|
599
|
-
const resolvedExtension = Array.isArray(generatedFileExtension) ? generatedFileExtension[0] : generatedFileExtension;
|
|
600
|
-
if (typeof resolvedExtension === "string" && resolvedExtension.length > 0) {
|
|
601
|
-
ext = resolvedExtension;
|
|
602
|
-
}
|
|
603
|
-
if (output) {
|
|
604
|
-
generatorOutputPath = import_node_path3.default.isAbsolute(output) ? output : import_node_path3.default.resolve(schemaRootDir, output);
|
|
605
|
-
}
|
|
606
|
-
} catch {
|
|
607
|
-
}
|
|
608
|
-
const prismaClientEntry = typeof generatorOutputPath === "string" ? import_node_path3.default.join(generatorOutputPath, "client." + ext) : void 0;
|
|
609
|
-
if (!prismaClientEntry || !import_node_fs6.default.existsSync(prismaClientEntry)) {
|
|
610
|
-
const checked = prismaClientEntry ?? "(could not determine output path)";
|
|
611
|
-
const pmCommand = prettyPrintCedarCommand(["prisma", "generate"]);
|
|
612
|
-
return {
|
|
613
|
-
clientPath: prismaClientEntry,
|
|
614
|
-
error: `Could not find generated Prisma client entry. Checked: ${checked}. Run \`${pmCommand}\` and try again.`
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
return {
|
|
618
|
-
clientPath: prismaClientEntry,
|
|
619
|
-
error: void 0
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
// src/envVarDefinitions.ts
|
|
624
|
-
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
625
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
626
|
-
function getEnvVarDefinitions() {
|
|
627
|
-
const rwConfig = (0, import_project_config.getConfig)();
|
|
628
|
-
const rwPaths = (0, import_project_config.getPaths)();
|
|
629
|
-
return {
|
|
630
|
-
RWJS_ENV: {
|
|
631
|
-
RWJS_API_GRAPHQL_URL: rwConfig.web.apiGraphQLUrl ?? rwConfig.web.apiUrl + "/graphql",
|
|
632
|
-
RWJS_API_URL: rwConfig.web.apiUrl,
|
|
633
|
-
__REDWOOD__APP_TITLE: rwConfig.web.title || import_node_path4.default.basename(rwPaths.base),
|
|
634
|
-
RWJS_EXP_STREAMING_SSR: rwConfig.experimental.streamingSsr?.enabled,
|
|
635
|
-
RWJS_EXP_RSC: rwConfig.experimental?.rsc?.enabled
|
|
636
|
-
},
|
|
637
|
-
RWJS_DEBUG_ENV: {
|
|
638
|
-
RWJS_SRC_ROOT: rwPaths.web.src,
|
|
639
|
-
REDWOOD_ENV_EDITOR: JSON.stringify(process.env.REDWOOD_ENV_EDITOR)
|
|
640
|
-
},
|
|
641
|
-
// Vite can automatically expose environment variables, but we
|
|
642
|
-
// disable that in `buildFeServer.ts` by setting `envFile: false`
|
|
643
|
-
// because we want to use our own logic for loading .env,
|
|
644
|
-
// .env.defaults, etc
|
|
645
|
-
// The two object spreads below will expose all environment
|
|
646
|
-
// variables listed in cedar.toml and all environment variables
|
|
647
|
-
// that are prefixed with REDWOOD_ENV_
|
|
648
|
-
...Object.fromEntries(
|
|
649
|
-
rwConfig.web.includeEnvironmentVariables.flatMap((envName) => [
|
|
650
|
-
[`import.meta.env.${envName}`, JSON.stringify(process.env[envName])],
|
|
651
|
-
[`process.env.${envName}`, JSON.stringify(process.env[envName])]
|
|
652
|
-
])
|
|
653
|
-
),
|
|
654
|
-
...Object.entries(process.env).reduce(
|
|
655
|
-
(acc, [key, value]) => {
|
|
656
|
-
if (key.startsWith("REDWOOD_ENV_")) {
|
|
657
|
-
acc[`import.meta.env.${key}`] = JSON.stringify(value);
|
|
658
|
-
acc[`process.env.${key}`] = JSON.stringify(value);
|
|
659
|
-
}
|
|
660
|
-
return acc;
|
|
661
|
-
},
|
|
662
|
-
{}
|
|
663
|
-
)
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
667
|
-
0 && (module.exports = {
|
|
668
|
-
DEFAULT_CONFIG,
|
|
669
|
-
TargetEnum,
|
|
670
|
-
ensurePosixPath,
|
|
671
|
-
findUp,
|
|
672
|
-
getAppRouteHook,
|
|
673
|
-
getBaseDir,
|
|
674
|
-
getBaseDirFromFile,
|
|
675
|
-
getBuiltDocumentFile,
|
|
676
|
-
getBuiltServerEntryFile,
|
|
677
|
-
getConfig,
|
|
678
|
-
getConfigPath,
|
|
679
|
-
getDataMigrationsPath,
|
|
680
|
-
getDbDir,
|
|
681
|
-
getEnvVarDefinitions,
|
|
682
|
-
getGeneratedDataDirPath,
|
|
683
|
-
getMigrationsPath,
|
|
684
|
-
getPaths,
|
|
685
|
-
getPrismaDatasourceProvider,
|
|
686
|
-
getPrismaSchemas,
|
|
687
|
-
getRawConfig,
|
|
688
|
-
getRouteHookForPage,
|
|
689
|
-
getSchemaPath,
|
|
690
|
-
importStatementPath,
|
|
691
|
-
isTypeScriptProject,
|
|
692
|
-
loadPrismaConfig,
|
|
693
|
-
parsePort,
|
|
694
|
-
processPagesDir,
|
|
695
|
-
projectIsEsm,
|
|
696
|
-
projectRootIsEsm,
|
|
697
|
-
projectSideIsEsm,
|
|
698
|
-
readEnvVar,
|
|
699
|
-
resolveFile,
|
|
700
|
-
resolveGeneratedPrismaClient
|
|
701
|
-
});
|
package/dist/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|