@cedarjs/project-config 0.0.4
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/LICENSE +21 -0
- package/README.md +8 -0
- package/dist/cjs/config.d.ts +126 -0
- package/dist/cjs/config.d.ts.map +1 -0
- package/dist/cjs/configPath.d.ts +5 -0
- package/dist/cjs/configPath.d.ts.map +1 -0
- package/dist/cjs/findUp.d.ts +5 -0
- package/dist/cjs/findUp.d.ts.map +1 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +472 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/paths.d.ts +142 -0
- package/dist/cjs/paths.d.ts.map +1 -0
- package/dist/config.d.ts +126 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/configPath.d.ts +5 -0
- package/dist/configPath.d.ts.map +1 -0
- package/dist/findUp.d.ts +5 -0
- package/dist/findUp.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +418 -0
- package/dist/package.json +1 -0
- package/dist/paths.d.ts +142 -0
- package/dist/paths.d.ts.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Cedar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Project Config
|
|
2
|
+
|
|
3
|
+
> **Warning**
|
|
4
|
+
>
|
|
5
|
+
> This is a new internal package. There are still changes we want to make, so we're marking it as experimental for now.
|
|
6
|
+
> **Don't depend on this directly in a Redwood project**.
|
|
7
|
+
|
|
8
|
+
This package offers functionality to parse Redwood's configuration file, redwood.toml, and a convenient way of getting a Redwood project's paths.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as toml from 'smol-toml';
|
|
2
|
+
export declare enum TargetEnum {
|
|
3
|
+
NODE = "node",
|
|
4
|
+
BROWSER = "browser",
|
|
5
|
+
REACT_NATIVE = "react-native",
|
|
6
|
+
ELECTRON = "electron"
|
|
7
|
+
}
|
|
8
|
+
export interface NodeTargetConfig {
|
|
9
|
+
title: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
host?: string;
|
|
12
|
+
port: number;
|
|
13
|
+
path: string;
|
|
14
|
+
target: TargetEnum.NODE;
|
|
15
|
+
schemaPath: string;
|
|
16
|
+
serverConfig: string;
|
|
17
|
+
debugPort?: number;
|
|
18
|
+
}
|
|
19
|
+
interface BrowserTargetConfig {
|
|
20
|
+
title: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
host?: string;
|
|
23
|
+
port: number;
|
|
24
|
+
path: string;
|
|
25
|
+
target: TargetEnum.BROWSER;
|
|
26
|
+
includeEnvironmentVariables: string[];
|
|
27
|
+
/**
|
|
28
|
+
* Specify the URL to your api-server.
|
|
29
|
+
* This can be an absolute path proxied on the current domain (`/.netlify/functions`),
|
|
30
|
+
* or a fully qualified URL (`https://api.example.org:8911/functions`).
|
|
31
|
+
*
|
|
32
|
+
* Note: This should not include the path to the GraphQL Server.
|
|
33
|
+
**/
|
|
34
|
+
apiUrl: string;
|
|
35
|
+
/**
|
|
36
|
+
* Optional: FQDN or absolute path to the GraphQL serverless function, without the trailing slash.
|
|
37
|
+
* This will override the apiUrl configuration just for the graphql function
|
|
38
|
+
* Example: `./redwood/functions/graphql` or `https://api.redwoodjs.com/graphql`
|
|
39
|
+
*/
|
|
40
|
+
apiGraphQLUrl?: string;
|
|
41
|
+
fastRefresh: boolean;
|
|
42
|
+
a11y: boolean;
|
|
43
|
+
sourceMap: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface GraphiQLStudioConfig {
|
|
46
|
+
endpoint?: string;
|
|
47
|
+
authImpersonation?: AuthImpersonationConfig;
|
|
48
|
+
}
|
|
49
|
+
type SupportedAuthImpersonationProviders = 'dbAuth' | 'netlify' | 'supabase';
|
|
50
|
+
interface AuthImpersonationConfig {
|
|
51
|
+
authProvider?: SupportedAuthImpersonationProviders;
|
|
52
|
+
jwtSecret?: string;
|
|
53
|
+
userId?: string;
|
|
54
|
+
email?: string;
|
|
55
|
+
roles?: string[];
|
|
56
|
+
}
|
|
57
|
+
interface StudioConfig {
|
|
58
|
+
basePort: number;
|
|
59
|
+
graphiql?: GraphiQLStudioConfig;
|
|
60
|
+
}
|
|
61
|
+
export interface Config {
|
|
62
|
+
web: BrowserTargetConfig;
|
|
63
|
+
api: NodeTargetConfig;
|
|
64
|
+
browser: {
|
|
65
|
+
open: boolean | string;
|
|
66
|
+
};
|
|
67
|
+
generate: {
|
|
68
|
+
tests: boolean;
|
|
69
|
+
stories: boolean;
|
|
70
|
+
nestScaffoldByModel: boolean;
|
|
71
|
+
};
|
|
72
|
+
graphql: {
|
|
73
|
+
fragments: boolean;
|
|
74
|
+
trustedDocuments: boolean;
|
|
75
|
+
includeScalars: {
|
|
76
|
+
File: boolean;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
notifications: {
|
|
80
|
+
versionUpdates: string[];
|
|
81
|
+
};
|
|
82
|
+
studio: StudioConfig;
|
|
83
|
+
experimental: {
|
|
84
|
+
opentelemetry: {
|
|
85
|
+
enabled: boolean;
|
|
86
|
+
wrapApi: boolean;
|
|
87
|
+
apiSdk?: string;
|
|
88
|
+
};
|
|
89
|
+
cli: {
|
|
90
|
+
autoInstall: boolean;
|
|
91
|
+
plugins: CLIPlugin[];
|
|
92
|
+
};
|
|
93
|
+
useSDLCodeGenForGraphQLTypes: boolean;
|
|
94
|
+
streamingSsr: {
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
};
|
|
97
|
+
rsc: {
|
|
98
|
+
enabled: boolean;
|
|
99
|
+
};
|
|
100
|
+
realtime: {
|
|
101
|
+
enabled: boolean;
|
|
102
|
+
};
|
|
103
|
+
reactCompiler: {
|
|
104
|
+
enabled: boolean;
|
|
105
|
+
lintOnly: boolean;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export interface CLIPlugin {
|
|
110
|
+
package: string;
|
|
111
|
+
enabled?: boolean;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* These configuration options are modified by the user via the Redwood
|
|
115
|
+
* config file.
|
|
116
|
+
*/
|
|
117
|
+
export declare const getConfig: (configPath?: string) => Config;
|
|
118
|
+
/**
|
|
119
|
+
* Returns the JSON parse of the config file without any default values.
|
|
120
|
+
*
|
|
121
|
+
* @param configPath Path to the config file, defaults to automatically find the project `redwood.toml` file
|
|
122
|
+
* @returns A JSON object from the parsed toml values
|
|
123
|
+
*/
|
|
124
|
+
export declare function getRawConfig(configPath?: string): Record<string, toml.TomlPrimitive>;
|
|
125
|
+
export {};
|
|
126
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configPath.d.ts","sourceRoot":"","sources":["../../src/configPath.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,aAAa,SACnB,MAAM,KACV,MAkBF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findUp.d.ts","sourceRoot":"","sources":["../../src/findUp.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,MAAM,EACZ,iBAAiB,GAAE,MAAsB,GACxC,MAAM,GAAG,IAAI,CAef"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,472 @@
|
|
|
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
|
+
TargetEnum: () => TargetEnum,
|
|
34
|
+
ensurePosixPath: () => ensurePosixPath,
|
|
35
|
+
findUp: () => findUp,
|
|
36
|
+
getAppRouteHook: () => getAppRouteHook,
|
|
37
|
+
getBaseDir: () => getBaseDir,
|
|
38
|
+
getBaseDirFromFile: () => getBaseDirFromFile,
|
|
39
|
+
getConfig: () => getConfig,
|
|
40
|
+
getConfigPath: () => getConfigPath,
|
|
41
|
+
getPaths: () => getPaths,
|
|
42
|
+
getRawConfig: () => getRawConfig,
|
|
43
|
+
getRouteHookForPage: () => getRouteHookForPage,
|
|
44
|
+
importStatementPath: () => importStatementPath,
|
|
45
|
+
isTypeScriptProject: () => isTypeScriptProject,
|
|
46
|
+
processPagesDir: () => processPagesDir,
|
|
47
|
+
projectIsEsm: () => projectIsEsm,
|
|
48
|
+
projectRootIsEsm: () => projectRootIsEsm,
|
|
49
|
+
projectSideIsEsm: () => projectSideIsEsm,
|
|
50
|
+
resolveFile: () => resolveFile
|
|
51
|
+
});
|
|
52
|
+
module.exports = __toCommonJS(index_exports);
|
|
53
|
+
|
|
54
|
+
// src/config.ts
|
|
55
|
+
var import_fs2 = __toESM(require("fs"), 1);
|
|
56
|
+
var import_deepmerge = __toESM(require("deepmerge"), 1);
|
|
57
|
+
var toml = __toESM(require("smol-toml"), 1);
|
|
58
|
+
var import_string_env_interpolation = require("string-env-interpolation");
|
|
59
|
+
|
|
60
|
+
// src/findUp.ts
|
|
61
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
62
|
+
var import_path = __toESM(require("path"), 1);
|
|
63
|
+
function findUp(file, startingDirectory = process.cwd()) {
|
|
64
|
+
const possibleFilepath = import_path.default.join(startingDirectory, file);
|
|
65
|
+
if (import_fs.default.existsSync(possibleFilepath)) {
|
|
66
|
+
return possibleFilepath;
|
|
67
|
+
}
|
|
68
|
+
const parentDirectory = import_path.default.dirname(startingDirectory);
|
|
69
|
+
if (parentDirectory === startingDirectory) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return findUp(file, parentDirectory);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/configPath.ts
|
|
76
|
+
var CONFIG_FILE_NAME = "redwood.toml";
|
|
77
|
+
var getConfigPathCache = /* @__PURE__ */ new Map();
|
|
78
|
+
var getConfigPath = (cwd = process.env.RWJS_CWD ?? process.cwd()) => {
|
|
79
|
+
const cachedPath = getConfigPathCache.get(cwd);
|
|
80
|
+
if (cachedPath) {
|
|
81
|
+
return cachedPath;
|
|
82
|
+
}
|
|
83
|
+
const configPath = findUp(CONFIG_FILE_NAME, cwd);
|
|
84
|
+
if (!configPath) {
|
|
85
|
+
throw new Error(
|
|
86
|
+
`Could not find a "${CONFIG_FILE_NAME}" file, are you sure you're in a Redwood project?`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
getConfigPathCache.set(cwd, configPath);
|
|
90
|
+
return configPath;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// src/config.ts
|
|
94
|
+
var TargetEnum = /* @__PURE__ */ ((TargetEnum2) => {
|
|
95
|
+
TargetEnum2["NODE"] = "node";
|
|
96
|
+
TargetEnum2["BROWSER"] = "browser";
|
|
97
|
+
TargetEnum2["REACT_NATIVE"] = "react-native";
|
|
98
|
+
TargetEnum2["ELECTRON"] = "electron";
|
|
99
|
+
return TargetEnum2;
|
|
100
|
+
})(TargetEnum || {});
|
|
101
|
+
var DEFAULT_CONFIG = {
|
|
102
|
+
web: {
|
|
103
|
+
title: "Redwood App",
|
|
104
|
+
port: 8910,
|
|
105
|
+
path: "./web",
|
|
106
|
+
target: "browser" /* BROWSER */,
|
|
107
|
+
includeEnvironmentVariables: [],
|
|
108
|
+
apiUrl: "/.redwood/functions",
|
|
109
|
+
fastRefresh: true,
|
|
110
|
+
a11y: true,
|
|
111
|
+
sourceMap: false
|
|
112
|
+
},
|
|
113
|
+
api: {
|
|
114
|
+
title: "Redwood App",
|
|
115
|
+
port: 8911,
|
|
116
|
+
path: "./api",
|
|
117
|
+
target: "node" /* NODE */,
|
|
118
|
+
schemaPath: "./api/db/schema.prisma",
|
|
119
|
+
serverConfig: "./api/server.config.js",
|
|
120
|
+
debugPort: 18911
|
|
121
|
+
},
|
|
122
|
+
graphql: {
|
|
123
|
+
fragments: false,
|
|
124
|
+
trustedDocuments: false,
|
|
125
|
+
includeScalars: { File: true }
|
|
126
|
+
},
|
|
127
|
+
browser: {
|
|
128
|
+
open: false
|
|
129
|
+
},
|
|
130
|
+
generate: {
|
|
131
|
+
tests: true,
|
|
132
|
+
stories: true,
|
|
133
|
+
nestScaffoldByModel: true
|
|
134
|
+
},
|
|
135
|
+
notifications: {
|
|
136
|
+
versionUpdates: []
|
|
137
|
+
},
|
|
138
|
+
studio: {
|
|
139
|
+
basePort: 4318,
|
|
140
|
+
graphiql: {
|
|
141
|
+
authImpersonation: {
|
|
142
|
+
authProvider: void 0,
|
|
143
|
+
userId: void 0,
|
|
144
|
+
email: void 0,
|
|
145
|
+
jwtSecret: "secret"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
experimental: {
|
|
150
|
+
opentelemetry: {
|
|
151
|
+
enabled: false,
|
|
152
|
+
wrapApi: true
|
|
153
|
+
},
|
|
154
|
+
cli: {
|
|
155
|
+
autoInstall: true,
|
|
156
|
+
plugins: [
|
|
157
|
+
{
|
|
158
|
+
package: "@cedarjs/cli-storybook-vite"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
package: "@cedarjs/cli-data-migrate"
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
useSDLCodeGenForGraphQLTypes: false,
|
|
166
|
+
streamingSsr: {
|
|
167
|
+
enabled: false
|
|
168
|
+
},
|
|
169
|
+
rsc: {
|
|
170
|
+
enabled: false
|
|
171
|
+
},
|
|
172
|
+
realtime: {
|
|
173
|
+
enabled: false
|
|
174
|
+
},
|
|
175
|
+
reactCompiler: {
|
|
176
|
+
enabled: false,
|
|
177
|
+
lintOnly: false
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
var getConfig = (configPath = getConfigPath()) => {
|
|
182
|
+
try {
|
|
183
|
+
return (0, import_deepmerge.default)(DEFAULT_CONFIG, getRawConfig(configPath));
|
|
184
|
+
} catch (e) {
|
|
185
|
+
throw new Error(`Could not parse "${configPath}": ${e}`);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
function getRawConfig(configPath = getConfigPath()) {
|
|
189
|
+
try {
|
|
190
|
+
return toml.parse((0, import_string_env_interpolation.env)(import_fs2.default.readFileSync(configPath, "utf8")));
|
|
191
|
+
} catch (e) {
|
|
192
|
+
throw new Error(`Could not parse "${configPath}": ${e}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// src/paths.ts
|
|
197
|
+
var import_fs3 = __toESM(require("fs"), 1);
|
|
198
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
199
|
+
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
200
|
+
var PATH_API_DIR_FUNCTIONS = "api/src/functions";
|
|
201
|
+
var PATH_RW_SCRIPTS = "scripts";
|
|
202
|
+
var PATH_API_DIR_GRAPHQL = "api/src/graphql";
|
|
203
|
+
var PATH_API_DIR_CONFIG = "api/src/config";
|
|
204
|
+
var PATH_API_DIR_MODELS = "api/src/models";
|
|
205
|
+
var PATH_API_DIR_JOBS = "api/src/jobs";
|
|
206
|
+
var PATH_API_DIR_LIB = "api/src/lib";
|
|
207
|
+
var PATH_API_DIR_GENERATORS = "api/generators";
|
|
208
|
+
var PATH_API_DIR_SERVICES = "api/src/services";
|
|
209
|
+
var PATH_API_DIR_DIRECTIVES = "api/src/directives";
|
|
210
|
+
var PATH_API_DIR_SUBSCRIPTIONS = "api/src/subscriptions";
|
|
211
|
+
var PATH_API_DIR_SRC = "api/src";
|
|
212
|
+
var PATH_API_DIR_DIST = "api/dist";
|
|
213
|
+
var PATH_WEB_ROUTES = "web/src/Routes";
|
|
214
|
+
var PATH_WEB_DIR_LAYOUTS = "web/src/layouts/";
|
|
215
|
+
var PATH_WEB_DIR_PAGES = "web/src/pages/";
|
|
216
|
+
var PATH_WEB_DIR_COMPONENTS = "web/src/components";
|
|
217
|
+
var PATH_WEB_DIR_STORYBOOK_CONFIG = "web/.storybook";
|
|
218
|
+
var PATH_WEB_DIR_SRC = "web/src";
|
|
219
|
+
var PATH_WEB_DIR_SRC_APP = "web/src/App";
|
|
220
|
+
var PATH_WEB_DIR_SRC_DOCUMENT = "web/src/Document";
|
|
221
|
+
var PATH_WEB_INDEX_HTML = "web/src/index.html";
|
|
222
|
+
var PATH_WEB_DIR_GENERATORS = "web/generators";
|
|
223
|
+
var PATH_WEB_DIR_CONFIG = "web/config";
|
|
224
|
+
var PATH_WEB_DIR_CONFIG_VITE = "web/vite.config";
|
|
225
|
+
var PATH_WEB_DIR_ENTRY_CLIENT = "web/src/entry.client";
|
|
226
|
+
var PATH_WEB_DIR_ENTRY_SERVER = "web/src/entry.server";
|
|
227
|
+
var PATH_WEB_DIR_GRAPHQL = "web/src/graphql";
|
|
228
|
+
var PATH_WEB_DIR_CONFIG_POSTCSS = "web/config/postcss.config.js";
|
|
229
|
+
var PATH_WEB_DIR_CONFIG_STORYBOOK_CONFIG = "web/.storybook/main.js";
|
|
230
|
+
var PATH_WEB_DIR_CONFIG_STORYBOOK_PREVIEW = "web/.storybook/preview";
|
|
231
|
+
var PATH_WEB_DIR_CONFIG_STORYBOOK_MANAGER = "web/.storybook/manager.js";
|
|
232
|
+
var PATH_WEB_DIR_DIST = "web/dist";
|
|
233
|
+
var PATH_WEB_DIR_DIST_BROWSER = "web/dist/browser";
|
|
234
|
+
var PATH_WEB_DIR_DIST_RSC = "web/dist/rsc";
|
|
235
|
+
var PATH_WEB_DIR_DIST_SSR = "web/dist/ssr";
|
|
236
|
+
var PATH_WEB_DIR_DIST_SSR_ENTRY_SERVER = "web/dist/ssr/entry.server.mjs";
|
|
237
|
+
var PATH_WEB_DIR_DIST_SSR_DOCUMENT = "web/dist/ssr/Document.mjs";
|
|
238
|
+
var PATH_WEB_DIR_DIST_SSR_ROUTEHOOKS = "web/dist/ssr/routeHooks";
|
|
239
|
+
var PATH_WEB_DIR_DIST_RSC_ENTRIES = "web/dist/rsc/entries.mjs";
|
|
240
|
+
var PATH_WEB_DIR_ROUTE_MANIFEST = "web/dist/ssr/route-manifest.json";
|
|
241
|
+
var getBaseDir = (configPath = getConfigPath()) => {
|
|
242
|
+
return import_path2.default.dirname(configPath);
|
|
243
|
+
};
|
|
244
|
+
var getBaseDirFromFile = (file) => {
|
|
245
|
+
return getBaseDir(getConfigPath(import_path2.default.dirname(file)));
|
|
246
|
+
};
|
|
247
|
+
var resolveFile = (filePath, extensions = [".js", ".tsx", ".ts", ".jsx", ".mjs", ".mts"]) => {
|
|
248
|
+
for (const extension of extensions) {
|
|
249
|
+
const p = `${filePath}${extension}`;
|
|
250
|
+
if (import_fs3.default.existsSync(p)) {
|
|
251
|
+
return p;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return null;
|
|
255
|
+
};
|
|
256
|
+
var getPathsCache = /* @__PURE__ */ new Map();
|
|
257
|
+
var getPaths = (BASE_DIR = getBaseDir()) => {
|
|
258
|
+
if (getPathsCache.has(BASE_DIR)) {
|
|
259
|
+
return getPathsCache.get(BASE_DIR);
|
|
260
|
+
}
|
|
261
|
+
const routes = resolveFile(import_path2.default.join(BASE_DIR, PATH_WEB_ROUTES));
|
|
262
|
+
const { schemaPath } = getConfig(getConfigPath(BASE_DIR)).api;
|
|
263
|
+
const schemaDir = import_path2.default.dirname(schemaPath);
|
|
264
|
+
const viteConfig = resolveFile(
|
|
265
|
+
import_path2.default.join(BASE_DIR, PATH_WEB_DIR_CONFIG_VITE)
|
|
266
|
+
);
|
|
267
|
+
const paths = {
|
|
268
|
+
base: BASE_DIR,
|
|
269
|
+
generated: {
|
|
270
|
+
base: import_path2.default.join(BASE_DIR, ".redwood"),
|
|
271
|
+
schema: import_path2.default.join(BASE_DIR, ".redwood/schema.graphql"),
|
|
272
|
+
types: {
|
|
273
|
+
includes: import_path2.default.join(BASE_DIR, ".redwood/types/includes"),
|
|
274
|
+
mirror: import_path2.default.join(BASE_DIR, ".redwood/types/mirror")
|
|
275
|
+
},
|
|
276
|
+
prebuild: import_path2.default.join(BASE_DIR, ".redwood/prebuild")
|
|
277
|
+
},
|
|
278
|
+
scripts: import_path2.default.join(BASE_DIR, PATH_RW_SCRIPTS),
|
|
279
|
+
api: {
|
|
280
|
+
base: import_path2.default.join(BASE_DIR, "api"),
|
|
281
|
+
dataMigrations: import_path2.default.join(BASE_DIR, schemaDir, "dataMigrations"),
|
|
282
|
+
db: import_path2.default.join(BASE_DIR, schemaDir),
|
|
283
|
+
dbSchema: import_path2.default.join(BASE_DIR, schemaPath),
|
|
284
|
+
functions: import_path2.default.join(BASE_DIR, PATH_API_DIR_FUNCTIONS),
|
|
285
|
+
graphql: import_path2.default.join(BASE_DIR, PATH_API_DIR_GRAPHQL),
|
|
286
|
+
lib: import_path2.default.join(BASE_DIR, PATH_API_DIR_LIB),
|
|
287
|
+
generators: import_path2.default.join(BASE_DIR, PATH_API_DIR_GENERATORS),
|
|
288
|
+
config: import_path2.default.join(BASE_DIR, PATH_API_DIR_CONFIG),
|
|
289
|
+
services: import_path2.default.join(BASE_DIR, PATH_API_DIR_SERVICES),
|
|
290
|
+
directives: import_path2.default.join(BASE_DIR, PATH_API_DIR_DIRECTIVES),
|
|
291
|
+
subscriptions: import_path2.default.join(BASE_DIR, PATH_API_DIR_SUBSCRIPTIONS),
|
|
292
|
+
src: import_path2.default.join(BASE_DIR, PATH_API_DIR_SRC),
|
|
293
|
+
dist: import_path2.default.join(BASE_DIR, PATH_API_DIR_DIST),
|
|
294
|
+
types: import_path2.default.join(BASE_DIR, "api/types"),
|
|
295
|
+
models: import_path2.default.join(BASE_DIR, PATH_API_DIR_MODELS),
|
|
296
|
+
mail: import_path2.default.join(BASE_DIR, PATH_API_DIR_SRC, "mail"),
|
|
297
|
+
jobs: import_path2.default.join(import_path2.default.join(BASE_DIR, PATH_API_DIR_JOBS)),
|
|
298
|
+
distJobs: import_path2.default.join(import_path2.default.join(BASE_DIR, PATH_API_DIR_DIST, "jobs")),
|
|
299
|
+
jobsConfig: resolveFile(import_path2.default.join(BASE_DIR, PATH_API_DIR_LIB, "jobs")),
|
|
300
|
+
distJobsConfig: resolveFile(
|
|
301
|
+
import_path2.default.join(BASE_DIR, PATH_API_DIR_DIST, "lib", "jobs")
|
|
302
|
+
),
|
|
303
|
+
logger: resolveFile(import_path2.default.join(BASE_DIR, PATH_API_DIR_LIB, "logger"))
|
|
304
|
+
},
|
|
305
|
+
web: {
|
|
306
|
+
routes,
|
|
307
|
+
base: import_path2.default.join(BASE_DIR, "web"),
|
|
308
|
+
pages: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_PAGES),
|
|
309
|
+
components: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_COMPONENTS),
|
|
310
|
+
layouts: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_LAYOUTS),
|
|
311
|
+
src: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_SRC),
|
|
312
|
+
storybook: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_STORYBOOK_CONFIG),
|
|
313
|
+
generators: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_GENERATORS),
|
|
314
|
+
app: resolveFile(import_path2.default.join(BASE_DIR, PATH_WEB_DIR_SRC_APP)),
|
|
315
|
+
document: resolveFile(
|
|
316
|
+
import_path2.default.join(BASE_DIR, PATH_WEB_DIR_SRC_DOCUMENT)
|
|
317
|
+
),
|
|
318
|
+
html: import_path2.default.join(BASE_DIR, PATH_WEB_INDEX_HTML),
|
|
319
|
+
config: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_CONFIG),
|
|
320
|
+
viteConfig,
|
|
321
|
+
postcss: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_CONFIG_POSTCSS),
|
|
322
|
+
storybookConfig: import_path2.default.join(
|
|
323
|
+
BASE_DIR,
|
|
324
|
+
PATH_WEB_DIR_CONFIG_STORYBOOK_CONFIG
|
|
325
|
+
),
|
|
326
|
+
storybookPreviewConfig: resolveFile(
|
|
327
|
+
import_path2.default.join(BASE_DIR, PATH_WEB_DIR_CONFIG_STORYBOOK_PREVIEW)
|
|
328
|
+
),
|
|
329
|
+
storybookManagerConfig: import_path2.default.join(
|
|
330
|
+
BASE_DIR,
|
|
331
|
+
PATH_WEB_DIR_CONFIG_STORYBOOK_MANAGER
|
|
332
|
+
),
|
|
333
|
+
dist: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_DIST),
|
|
334
|
+
distBrowser: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_DIST_BROWSER),
|
|
335
|
+
distRsc: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_DIST_RSC),
|
|
336
|
+
distSsr: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_DIST_SSR),
|
|
337
|
+
distSsrDocument: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_DIST_SSR_DOCUMENT),
|
|
338
|
+
distSsrEntryServer: import_path2.default.join(
|
|
339
|
+
BASE_DIR,
|
|
340
|
+
PATH_WEB_DIR_DIST_SSR_ENTRY_SERVER
|
|
341
|
+
),
|
|
342
|
+
distRouteHooks: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_DIST_SSR_ROUTEHOOKS),
|
|
343
|
+
distRscEntries: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_DIST_RSC_ENTRIES),
|
|
344
|
+
routeManifest: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_ROUTE_MANIFEST),
|
|
345
|
+
types: import_path2.default.join(BASE_DIR, "web/types"),
|
|
346
|
+
entryClient: resolveFile(import_path2.default.join(BASE_DIR, PATH_WEB_DIR_ENTRY_CLIENT)),
|
|
347
|
+
// new vite/stream entry point for client
|
|
348
|
+
entryServer: resolveFile(import_path2.default.join(BASE_DIR, PATH_WEB_DIR_ENTRY_SERVER)),
|
|
349
|
+
graphql: import_path2.default.join(BASE_DIR, PATH_WEB_DIR_GRAPHQL)
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
import_fs3.default.mkdirSync(paths.generated.types.includes, { recursive: true });
|
|
353
|
+
import_fs3.default.mkdirSync(paths.generated.types.mirror, { recursive: true });
|
|
354
|
+
getPathsCache.set(BASE_DIR, paths);
|
|
355
|
+
return paths;
|
|
356
|
+
};
|
|
357
|
+
var getRouteHookForPage = (pagePath) => {
|
|
358
|
+
if (!pagePath) {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
return import_fast_glob.default.sync("*.routeHooks.{js,ts,tsx,jsx}", {
|
|
362
|
+
absolute: true,
|
|
363
|
+
cwd: import_path2.default.dirname(pagePath)
|
|
364
|
+
// the page's folder
|
|
365
|
+
}).at(0) || null;
|
|
366
|
+
};
|
|
367
|
+
var getAppRouteHook = (forProd = false) => {
|
|
368
|
+
const rwPaths = getPaths();
|
|
369
|
+
if (forProd) {
|
|
370
|
+
const distAppRouteHook = import_path2.default.join(
|
|
371
|
+
rwPaths.web.distRouteHooks,
|
|
372
|
+
"App.routeHooks.js"
|
|
373
|
+
);
|
|
374
|
+
try {
|
|
375
|
+
import_fs3.default.statSync(distAppRouteHook).isFile();
|
|
376
|
+
return distAppRouteHook;
|
|
377
|
+
} catch {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return resolveFile(import_path2.default.join(rwPaths.web.src, "App.routeHooks"));
|
|
382
|
+
};
|
|
383
|
+
var processPagesDir = (webPagesDir = getPaths().web.pages) => {
|
|
384
|
+
const pagePaths = import_fast_glob.default.sync("**/*Page.{js,jsx,ts,tsx}", {
|
|
385
|
+
cwd: webPagesDir,
|
|
386
|
+
ignore: ["node_modules"]
|
|
387
|
+
});
|
|
388
|
+
return pagePaths.map((pagePath) => {
|
|
389
|
+
const p = import_path2.default.parse(pagePath);
|
|
390
|
+
const importName = p.dir.replace(/\//g, "");
|
|
391
|
+
const importPath = importStatementPath(
|
|
392
|
+
import_path2.default.join(webPagesDir, p.dir, p.name)
|
|
393
|
+
);
|
|
394
|
+
const importStatement = `const ${importName} = { name: '${importName}', loader: import('${importPath}') }`;
|
|
395
|
+
return {
|
|
396
|
+
importName,
|
|
397
|
+
constName: importName,
|
|
398
|
+
importPath,
|
|
399
|
+
path: import_path2.default.join(webPagesDir, pagePath),
|
|
400
|
+
importStatement
|
|
401
|
+
};
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
var ensurePosixPath = (path3) => {
|
|
405
|
+
let posixPath = path3;
|
|
406
|
+
if (process.platform === "win32") {
|
|
407
|
+
if (/^[A-Z]:\\/.test(path3)) {
|
|
408
|
+
const drive = path3[0].toLowerCase();
|
|
409
|
+
posixPath = `/${drive}/${path3.substring(3)}`;
|
|
410
|
+
}
|
|
411
|
+
posixPath = posixPath.replace(/\\/g, "/");
|
|
412
|
+
}
|
|
413
|
+
return posixPath;
|
|
414
|
+
};
|
|
415
|
+
var importStatementPath = (path3) => {
|
|
416
|
+
let importPath = path3;
|
|
417
|
+
if (process.platform === "win32") {
|
|
418
|
+
importPath = importPath.replaceAll("\\", "/");
|
|
419
|
+
}
|
|
420
|
+
return importPath;
|
|
421
|
+
};
|
|
422
|
+
function packageJsonIsEsm(packageJsonPath) {
|
|
423
|
+
const packageJsonContents = JSON.parse(
|
|
424
|
+
import_fs3.default.readFileSync(packageJsonPath, "utf-8")
|
|
425
|
+
);
|
|
426
|
+
return packageJsonContents.type === "module";
|
|
427
|
+
}
|
|
428
|
+
function projectRootIsEsm() {
|
|
429
|
+
return packageJsonIsEsm(import_path2.default.join(getPaths().base, "package.json"));
|
|
430
|
+
}
|
|
431
|
+
function projectSideIsEsm(side) {
|
|
432
|
+
const redwoodProjectPaths = getPaths();
|
|
433
|
+
return packageJsonIsEsm(
|
|
434
|
+
import_path2.default.join(redwoodProjectPaths[side].base, "package.json")
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
function projectIsEsm() {
|
|
438
|
+
if (!projectRootIsEsm()) {
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
for (const side of ["api", "web"]) {
|
|
442
|
+
if (!projectSideIsEsm(side)) {
|
|
443
|
+
return false;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
var isTypeScriptProject = () => {
|
|
449
|
+
const paths = getPaths();
|
|
450
|
+
return import_fs3.default.existsSync(import_path2.default.join(paths.web.base, "tsconfig.json")) || import_fs3.default.existsSync(import_path2.default.join(paths.api.base, "tsconfig.json"));
|
|
451
|
+
};
|
|
452
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
453
|
+
0 && (module.exports = {
|
|
454
|
+
TargetEnum,
|
|
455
|
+
ensurePosixPath,
|
|
456
|
+
findUp,
|
|
457
|
+
getAppRouteHook,
|
|
458
|
+
getBaseDir,
|
|
459
|
+
getBaseDirFromFile,
|
|
460
|
+
getConfig,
|
|
461
|
+
getConfigPath,
|
|
462
|
+
getPaths,
|
|
463
|
+
getRawConfig,
|
|
464
|
+
getRouteHookForPage,
|
|
465
|
+
importStatementPath,
|
|
466
|
+
isTypeScriptProject,
|
|
467
|
+
processPagesDir,
|
|
468
|
+
projectIsEsm,
|
|
469
|
+
projectRootIsEsm,
|
|
470
|
+
projectSideIsEsm,
|
|
471
|
+
resolveFile
|
|
472
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|