@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.
@@ -0,0 +1,142 @@
1
+ export interface NodeTargetPaths {
2
+ base: string;
3
+ dataMigrations: string;
4
+ directives: string;
5
+ db: string;
6
+ dbSchema: string;
7
+ src: string;
8
+ functions: string;
9
+ graphql: string;
10
+ lib: string;
11
+ generators: string;
12
+ services: string;
13
+ config: string;
14
+ dist: string;
15
+ types: string;
16
+ models: string;
17
+ mail: string;
18
+ jobs: string;
19
+ distJobs: string;
20
+ jobsConfig: string | null;
21
+ distJobsConfig: string | null;
22
+ logger: string | null;
23
+ }
24
+ export interface WebPaths {
25
+ base: string;
26
+ src: string;
27
+ storybook: string;
28
+ app: string;
29
+ document: string;
30
+ generators: string;
31
+ html: string;
32
+ routes: string;
33
+ pages: string;
34
+ components: string;
35
+ layouts: string;
36
+ config: string;
37
+ viteConfig: string;
38
+ entryClient: string | null;
39
+ entryServer: string | null;
40
+ postcss: string;
41
+ storybookConfig: string;
42
+ storybookPreviewConfig: string | null;
43
+ storybookManagerConfig: string;
44
+ dist: string;
45
+ distBrowser: string;
46
+ distRsc: string;
47
+ distSsr: string;
48
+ distSsrDocument: string;
49
+ distSsrEntryServer: string;
50
+ distRouteHooks: string;
51
+ distRscEntries: string;
52
+ routeManifest: string;
53
+ types: string;
54
+ graphql: string;
55
+ }
56
+ export interface Paths {
57
+ base: string;
58
+ generated: {
59
+ base: string;
60
+ schema: string;
61
+ types: {
62
+ includes: string;
63
+ mirror: string;
64
+ };
65
+ prebuild: string;
66
+ };
67
+ web: WebPaths;
68
+ api: NodeTargetPaths;
69
+ scripts: string;
70
+ }
71
+ export interface PagesDependency {
72
+ /** the variable to which the import is assigned */
73
+ importName: string;
74
+ /** @alias importName */
75
+ constName: string;
76
+ /** absolute path without extension */
77
+ importPath: string;
78
+ /** absolute path with extension */
79
+ path: string;
80
+ /** const ${importName} = { ...data structure for async imports... } */
81
+ importStatement: string;
82
+ }
83
+ /**
84
+ * The Redwood config file is used as an anchor for the base directory of a project.
85
+ */
86
+ export declare const getBaseDir: (configPath?: string) => string;
87
+ export declare const getBaseDirFromFile: (file: string) => string;
88
+ /**
89
+ * Use this to resolve files when the path to the file is known,
90
+ * but the extension is not.
91
+ */
92
+ export declare const resolveFile: (filePath: string, extensions?: string[]) => string | null;
93
+ export declare const getPaths: (BASE_DIR?: string) => Paths;
94
+ /**
95
+ * Returns the route hook for the supplied page path.
96
+ * Note that the page name doesn't have to match
97
+ *
98
+ * @param pagePath
99
+ * @returns string
100
+ */
101
+ export declare const getRouteHookForPage: (pagePath: string | undefined | null) => string | null;
102
+ /**
103
+ * Use this function to find the app route hook.
104
+ * If it is present, you get the path to the file - in prod, you get the built version in dist.
105
+ * In dev, you get the source version.
106
+ *
107
+ * @param forProd
108
+ * @returns string | null
109
+ */
110
+ export declare const getAppRouteHook: (forProd?: boolean) => string | null;
111
+ /**
112
+ * Process the pages directory and return information useful for automated imports.
113
+ *
114
+ * Note: glob.sync returns posix style paths on Windows machines
115
+ * @deprecated I will write a seperate method that use `getFiles` instead. This
116
+ * is used by structure, babel auto-importer and the eslint plugin.
117
+ */
118
+ export declare const processPagesDir: (webPagesDir?: string) => PagesDependency[];
119
+ /**
120
+ * Converts Windows-style paths to Posix-style
121
+ * C:\Users\Bob\dev\Redwood -> /c/Users/Bob/dev/Redwood
122
+ *
123
+ * The conversion only happens on Windows systems, and only for paths that are
124
+ * not already Posix-style
125
+ *
126
+ * @param path Filesystem path
127
+ */
128
+ export declare const ensurePosixPath: (path: string) => string;
129
+ /**
130
+ * Switches backslash to regular slash on Windows so the path works in
131
+ * import statements
132
+ * C:\Users\Bob\dev\Redwood\UserPage\UserPage ->
133
+ * C:/Users/Bob/dev/Redwood/UserPage/UserPage
134
+ *
135
+ * @param path Filesystem path
136
+ */
137
+ export declare const importStatementPath: (path: string) => string;
138
+ export declare function projectRootIsEsm(): boolean;
139
+ export declare function projectSideIsEsm(side: 'api' | 'web'): boolean;
140
+ export declare function projectIsEsm(): boolean;
141
+ export declare const isTypeScriptProject: () => boolean;
142
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/paths.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,E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AAA;CACxB;AAiDD;;GAEG;AACH,eAAO,MAAM,UAAU,gBAAgB,MAAM,KAAqB,MAEjE,CAAA;AAED,eAAO,MAAM,kBAAkB,SAAU,MAAM,WAE9C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,aACZ,MAAM,eACJ,MAAM,EAAE,KACnB,MAAM,GAAG,IAQX,CAAA;AAMD,eAAO,MAAM,QAAQ,cAAc,MAAM,KAAkB,KA0G1D,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,aAAc,MAAM,GAAG,SAAS,GAAG,IAAI,kBAetE,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,sCAmB3B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,iBACb,MAAM,KAClB,eAAe,EAsBjB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,SAAU,MAAM,WAa3C,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,SAAU,MAAM,WAQ/C,CAAA;AAWD,wBAAgB,gBAAgB,YAE/B;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,GAAG,KAAK,WAKnD;AAED,wBAAgB,YAAY,YAY3B;AAED,eAAO,MAAM,mBAAmB,eAM/B,CAAA"}
@@ -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":"AAGA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAKjC,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,UAAU,CAAC,IAAI,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CA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AA;KACzB,CAAA;IACD,MAAM,EAAE,YAAY,CAAA;IACpB,YAAY,EAAE;QACZ,aAAa,EAAE;YACb,OAAO,EAAE,OAAO,CAAA;YAChB,OAAO,EAAE,OAAO,CAAA;YAChB,MAAM,CAAC,EAAE,MAAM,CAAA;SAChB,CAAA;QACD,GAAG,EAAE;YACH,WAAW,EAAE,OAAO,CAAA;YACpB,OAAO,EAAE,SAAS,EAAE,CAAA;SACrB,CAAA;QACD,4BAA4B,EAAE,OAAO,CAAA;QACrC,YAAY,EAAE;YACZ,OAAO,EAAE,OAAO,CAAA;SACjB,CAAA;QACD,GAAG,EAAE;YACH,OAAO,EAAE,OAAO,CAAA;SACjB,CAAA;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,OAAO,CAAA;SACjB,CAAA;QACD,aAAa,EAAE;YACb,OAAO,EAAE,OAAO,CAAA;YAChB,QAAQ,EAAE,OAAO,CAAA;SAClB,CAAA;KACF,CAAA;CACF;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAmFD;;;GAGG;AACH,eAAO,MAAM,SAAS,2BAAmC,MAMxD,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,UAAU,SAAkB,sCAMxD"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Search the parent directories for the Redwood configuration file.
3
+ */
4
+ export declare const getConfigPath: (cwd?: string) => string;
5
+ //# sourceMappingURL=configPath.d.ts.map
@@ -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,5 @@
1
+ /**
2
+ * Find a file by walking up parent directories.
3
+ */
4
+ export declare function findUp(file: string, startingDirectory?: string): string | null;
5
+ //# sourceMappingURL=findUp.d.ts.map
@@ -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,5 @@
1
+ export * from './config.js';
2
+ export * from './configPath.js';
3
+ export * from './paths.js';
4
+ export * from './findUp.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -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"}