@adonisjs/assembler 8.0.0-next.4 → 8.0.0-next.6
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/README.md +87 -59
- package/build/chunk-F4RAGKQN.js +387 -0
- package/build/chunk-MC3FJR62.js +411 -0
- package/build/chunk-TIKQQRMX.js +116 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +606 -410
- package/build/src/bundler.d.ts +40 -3
- package/build/src/code_scanners/routes_scanner/main.d.ts +49 -9
- package/build/src/code_scanners/routes_scanner/main.js +445 -0
- package/build/src/code_scanners/routes_scanner/validator_extractor.d.ts +12 -4
- package/build/src/code_transformer/main.d.ts +44 -43
- package/build/src/code_transformer/main.js +123 -101
- package/build/src/code_transformer/rc_file_transformer.d.ts +56 -4
- package/build/src/debug.d.ts +12 -0
- package/build/src/dev_server.d.ts +40 -30
- package/build/src/file_buffer.d.ts +67 -0
- package/build/src/file_system.d.ts +45 -7
- package/build/src/helpers.d.ts +79 -4
- package/build/src/helpers.js +16 -0
- package/build/src/index_generator/main.d.ts +73 -0
- package/build/src/index_generator/main.js +7 -0
- package/build/src/index_generator/source.d.ts +66 -0
- package/build/src/paths_resolver.d.ts +27 -2
- package/build/src/shortcuts_manager.d.ts +42 -4
- package/build/src/test_runner.d.ts +58 -31
- package/build/src/types/code_scanners.d.ts +138 -24
- package/build/src/types/code_transformer.d.ts +61 -19
- package/build/src/types/common.d.ts +199 -55
- package/build/src/types/hooks.d.ts +173 -17
- package/build/src/types/main.d.ts +13 -0
- package/build/src/utils.d.ts +88 -10
- package/build/src/virtual_file_system.d.ts +112 -0
- package/package.json +9 -3
- package/build/chunk-RR4HCA4M.js +0 -7
- package/build/src/ast_file_system.d.ts +0 -17
|
@@ -1,69 +1,96 @@
|
|
|
1
1
|
import type tsStatic from 'typescript';
|
|
2
|
+
import { cliui } from '@poppinss/cliui';
|
|
2
3
|
import type { TestRunnerOptions } from './types/common.ts';
|
|
3
4
|
/**
|
|
4
5
|
* Exposes the API to run Japa tests and optionally watch for file
|
|
5
6
|
* changes to re-run the tests.
|
|
6
7
|
*
|
|
7
|
-
* The watch mode
|
|
8
|
+
* The TestRunner provides intelligent test execution with watch mode capabilities.
|
|
9
|
+
* When files change, it can selectively run specific tests or the entire suite
|
|
10
|
+
* based on what changed.
|
|
8
11
|
*
|
|
12
|
+
* The watch mode functions as follows:
|
|
9
13
|
* - If the changed file is a test file, then only tests for that file
|
|
10
14
|
* will be re-run.
|
|
11
15
|
* - Otherwise, all tests will re-run with respect to the initial
|
|
12
16
|
* filters applied when running the `node ace test` command.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const testRunner = new TestRunner(cwd, { suites: [], hooks: [] })
|
|
20
|
+
* await testRunner.run()
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Run tests in watch mode
|
|
24
|
+
* const testRunner = new TestRunner(cwd, { suites: [], hooks: [] })
|
|
25
|
+
* await testRunner.runAndWatch(ts, { poll: false })
|
|
13
26
|
*/
|
|
14
27
|
export declare class TestRunner {
|
|
15
28
|
#private;
|
|
16
|
-
cwd: URL;
|
|
17
|
-
options: TestRunnerOptions;
|
|
18
29
|
/**
|
|
19
|
-
* CLI UI to log colorful messages
|
|
30
|
+
* CLI UI instance to log colorful messages and progress information
|
|
20
31
|
*/
|
|
21
|
-
ui:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
icons: {
|
|
27
|
-
tick: string;
|
|
28
|
-
cross: string;
|
|
29
|
-
bullet: string;
|
|
30
|
-
nodejs: string;
|
|
31
|
-
pointer: string;
|
|
32
|
-
info: string;
|
|
33
|
-
warning: string;
|
|
34
|
-
squareSmallFilled: string;
|
|
35
|
-
};
|
|
36
|
-
sticker: () => import("@poppinss/cliui").Instructions;
|
|
37
|
-
instructions: () => import("@poppinss/cliui").Instructions;
|
|
38
|
-
switchMode(modeToUse: "raw" | "silent" | "normal"): void;
|
|
39
|
-
useRenderer(rendererToUse: import("@poppinss/cliui/types").RendererContract): void;
|
|
40
|
-
useColors(colorsToUse: import("@poppinss/colors/types").Colors): void;
|
|
41
|
-
};
|
|
32
|
+
get ui(): ReturnType<typeof cliui>;
|
|
33
|
+
/**
|
|
34
|
+
* CLI UI instance to log colorful messages and progress information
|
|
35
|
+
*/
|
|
36
|
+
set ui(ui: ReturnType<typeof cliui>);
|
|
42
37
|
/**
|
|
43
38
|
* The script file to run as a child process
|
|
44
39
|
*/
|
|
45
40
|
scriptFile: string;
|
|
41
|
+
/**
|
|
42
|
+
* The current working directory URL
|
|
43
|
+
*/
|
|
44
|
+
cwd: URL;
|
|
45
|
+
/**
|
|
46
|
+
* Test runner configuration options including filters, reporters, and hooks
|
|
47
|
+
*/
|
|
48
|
+
options: TestRunnerOptions;
|
|
49
|
+
/**
|
|
50
|
+
* Create a new TestRunner instance
|
|
51
|
+
*
|
|
52
|
+
* @param cwd - The current working directory URL
|
|
53
|
+
* @param options - Test runner configuration options
|
|
54
|
+
*/
|
|
46
55
|
constructor(cwd: URL, options: TestRunnerOptions);
|
|
47
56
|
/**
|
|
48
|
-
* Add listener to get notified when
|
|
49
|
-
*
|
|
57
|
+
* Add listener to get notified when test runner is closed
|
|
58
|
+
*
|
|
59
|
+
* @param callback - Function to call when test runner closes
|
|
60
|
+
* @returns This TestRunner instance for method chaining
|
|
50
61
|
*/
|
|
51
62
|
onClose(callback: (exitCode: number) => any): this;
|
|
52
63
|
/**
|
|
53
|
-
* Add listener to get notified when
|
|
54
|
-
*
|
|
64
|
+
* Add listener to get notified when test runner encounters an error
|
|
65
|
+
*
|
|
66
|
+
* @param callback - Function to call when test runner encounters an error
|
|
67
|
+
* @returns This TestRunner instance for method chaining
|
|
55
68
|
*/
|
|
56
69
|
onError(callback: (error: any) => any): this;
|
|
57
70
|
/**
|
|
58
71
|
* Close watchers and running child processes
|
|
72
|
+
*
|
|
73
|
+
* Cleans up file system watchers and terminates any running test
|
|
74
|
+
* processes to ensure graceful shutdown.
|
|
59
75
|
*/
|
|
60
76
|
close(): Promise<void>;
|
|
61
77
|
/**
|
|
62
|
-
* Runs tests
|
|
78
|
+
* Runs tests once without watching for file changes
|
|
79
|
+
*
|
|
80
|
+
* Executes the test suite a single time and exits. This is the
|
|
81
|
+
* equivalent of running tests in CI/CD environments.
|
|
63
82
|
*/
|
|
64
83
|
run(): Promise<void>;
|
|
65
84
|
/**
|
|
66
|
-
* Run tests in watch mode
|
|
85
|
+
* Run tests in watch mode and re-run them when files change
|
|
86
|
+
*
|
|
87
|
+
* Starts the test runner in watch mode, monitoring the file system
|
|
88
|
+
* for changes and automatically re-running tests when relevant files
|
|
89
|
+
* are modified. Uses intelligent filtering to run only affected tests
|
|
90
|
+
* when possible.
|
|
91
|
+
*
|
|
92
|
+
* @param ts - TypeScript module reference for parsing configuration
|
|
93
|
+
* @param options - Watch options including polling mode for file system monitoring
|
|
67
94
|
*/
|
|
68
95
|
runAndWatch(ts: typeof tsStatic, options?: {
|
|
69
96
|
poll: boolean;
|
|
@@ -1,45 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a controller that has been scanned and analyzed by the routes scanner.
|
|
3
|
+
* Contains metadata about the controller class and the specific method being called.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const controller: ScannedController = {
|
|
7
|
+
* name: 'UsersController',
|
|
8
|
+
* path: '/project/app/controllers/users_controller.ts',
|
|
9
|
+
* method: 'index',
|
|
10
|
+
* import: {
|
|
11
|
+
* type: 'default',
|
|
12
|
+
* specifier: '#controllers/users_controller',
|
|
13
|
+
* value: 'UsersController'
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
1
17
|
export type ScannedController = {
|
|
18
|
+
/** The name of the controller class */
|
|
2
19
|
name: string;
|
|
20
|
+
/** Absolute file path to the controller */
|
|
3
21
|
path: string;
|
|
22
|
+
/** The method name being called on the controller */
|
|
4
23
|
method: string;
|
|
24
|
+
/** Import information for the controller */
|
|
5
25
|
import: {
|
|
26
|
+
/** Import type (always 'default' for controllers) */
|
|
6
27
|
type: 'default';
|
|
28
|
+
/** Import specifier used to import the controller */
|
|
7
29
|
specifier: string;
|
|
30
|
+
/** The imported value name */
|
|
8
31
|
value: string;
|
|
9
32
|
};
|
|
10
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Represents a validator that has been extracted from controller methods.
|
|
36
|
+
* Contains information about how the validator is imported and used.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* const validator: ScannedValidator = {
|
|
40
|
+
* name: 'createUserValidator',
|
|
41
|
+
* import: {
|
|
42
|
+
* type: 'named',
|
|
43
|
+
* specifier: '#validators/user_validators',
|
|
44
|
+
* value: 'createUserValidator'
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
*/
|
|
11
48
|
export type ScannedValidator = {
|
|
49
|
+
/** The name/identifier of the validator */
|
|
12
50
|
name: string;
|
|
51
|
+
/** Import information for the validator */
|
|
13
52
|
import: {
|
|
53
|
+
/** The type of import (namespace, default, or named) */
|
|
14
54
|
type: 'namespace' | 'default' | 'named';
|
|
55
|
+
/** The module specifier being imported from */
|
|
15
56
|
specifier: string;
|
|
57
|
+
/** The imported value name */
|
|
16
58
|
value: string;
|
|
17
59
|
};
|
|
18
60
|
};
|
|
19
61
|
/**
|
|
20
|
-
* Output of scanned route
|
|
62
|
+
* Output of a scanned route containing all extracted metadata including
|
|
63
|
+
* controller information, validators, request/response types, and route patterns.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* const scannedRoute: ScannedRoute = {
|
|
67
|
+
* name: 'users.store',
|
|
68
|
+
* methods: ['POST'],
|
|
69
|
+
* domain: 'root',
|
|
70
|
+
* pattern: '/users',
|
|
71
|
+
* tokens: [{ val: '/users', old: '/users', type: 0, end: '' }],
|
|
72
|
+
* request: {
|
|
73
|
+
* type: 'Infer<typeof createUserValidator>',
|
|
74
|
+
* imports: ['import { Infer } from "@vinejs/vine/types"']
|
|
75
|
+
* },
|
|
76
|
+
* response: {
|
|
77
|
+
* type: 'ReturnType<UsersController["store"]>',
|
|
78
|
+
* imports: []
|
|
79
|
+
* },
|
|
80
|
+
* validators: [{
|
|
81
|
+
* name: 'createUserValidator',
|
|
82
|
+
* import: { type: 'named', specifier: '#validators/user', value: 'createUserValidator' }
|
|
83
|
+
* }],
|
|
84
|
+
* controller: {
|
|
85
|
+
* name: 'UsersController',
|
|
86
|
+
* method: 'store',
|
|
87
|
+
* path: '/app/controllers/users_controller.ts',
|
|
88
|
+
* import: { type: 'default', specifier: '#controllers/users_controller', value: 'UsersController' }
|
|
89
|
+
* }
|
|
90
|
+
* }
|
|
21
91
|
*/
|
|
22
92
|
export type ScannedRoute = {
|
|
23
93
|
/**
|
|
24
|
-
* A unique name for the route provided by AdonisJS http-server.
|
|
25
|
-
*
|
|
94
|
+
* A unique name for the route provided by AdonisJS http-server.
|
|
95
|
+
* May be duplicate across different domains.
|
|
26
96
|
*/
|
|
27
97
|
name: string;
|
|
28
98
|
/**
|
|
29
|
-
* HTTP methods for which the route is defined
|
|
99
|
+
* HTTP methods for which the route is defined (GET, POST, PUT, etc.)
|
|
30
100
|
*/
|
|
31
101
|
methods: string[];
|
|
32
102
|
/**
|
|
33
|
-
*
|
|
103
|
+
* The domain on which the route is registered (typically 'root')
|
|
34
104
|
*/
|
|
35
105
|
domain: string;
|
|
36
106
|
/**
|
|
37
|
-
* The route pattern
|
|
107
|
+
* The route pattern with parameter placeholders (e.g., '/users/:id')
|
|
38
108
|
*/
|
|
39
109
|
pattern: string;
|
|
40
110
|
/**
|
|
41
|
-
* Route tokens
|
|
42
|
-
*
|
|
111
|
+
* Route tokens that can be used for constructing URIs without parsing the pattern.
|
|
112
|
+
* Contains information about static and dynamic segments.
|
|
43
113
|
*/
|
|
44
114
|
tokens: {
|
|
45
115
|
val: string;
|
|
@@ -48,44 +118,70 @@ export type ScannedRoute = {
|
|
|
48
118
|
end: string;
|
|
49
119
|
}[];
|
|
50
120
|
/**
|
|
51
|
-
* Inferred request data accepted by the route.
|
|
52
|
-
*
|
|
53
|
-
* validator
|
|
121
|
+
* Inferred request data type accepted by the route.
|
|
122
|
+
* Generated when the route uses a controller with validators.
|
|
54
123
|
*/
|
|
55
124
|
request?: {
|
|
125
|
+
/** TypeScript type definition for the request data */
|
|
56
126
|
type: string;
|
|
127
|
+
/** Import statements needed for the type definition */
|
|
57
128
|
imports: string[];
|
|
58
129
|
};
|
|
59
130
|
/**
|
|
60
|
-
* Inferred response
|
|
61
|
-
*
|
|
131
|
+
* Inferred response type returned by the route.
|
|
132
|
+
* Generated when the route uses a controller method.
|
|
62
133
|
*/
|
|
63
134
|
response?: {
|
|
135
|
+
/** TypeScript type definition for the response data */
|
|
64
136
|
type: string;
|
|
137
|
+
/** Import statements needed for the type definition */
|
|
65
138
|
imports: string[];
|
|
66
139
|
};
|
|
67
140
|
/**
|
|
68
|
-
* Extracted
|
|
141
|
+
* Extracted validator information from the controller method.
|
|
142
|
+
* Only present when using controller-based routes with validation.
|
|
69
143
|
*/
|
|
70
144
|
validators?: ScannedValidator[];
|
|
71
145
|
/**
|
|
72
|
-
* Extracted controller
|
|
146
|
+
* Extracted controller information including class and method details.
|
|
147
|
+
* Only present when using controller-based routes.
|
|
73
148
|
*/
|
|
74
149
|
controller?: ScannedController;
|
|
75
150
|
};
|
|
76
151
|
/**
|
|
77
|
-
* The route accepted by the routes scanner when initiating
|
|
78
|
-
* the scanning process.
|
|
152
|
+
* The route data structure accepted by the routes scanner when initiating
|
|
153
|
+
* the scanning process. This represents the raw route definition before analysis.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* const routeItem: RoutesListItem = {
|
|
157
|
+
* name: 'users.store',
|
|
158
|
+
* pattern: '/users',
|
|
159
|
+
* domain: 'root',
|
|
160
|
+
* methods: ['POST'],
|
|
161
|
+
* controllerReference: {
|
|
162
|
+
* importExpression: "() => import('#controllers/users_controller')",
|
|
163
|
+
* method: 'store'
|
|
164
|
+
* },
|
|
165
|
+
* tokens: [{ val: '/users', old: '/users', type: 0, end: '' }]
|
|
166
|
+
* }
|
|
79
167
|
*/
|
|
80
168
|
export type RoutesListItem = {
|
|
169
|
+
/** Optional unique name for the route */
|
|
81
170
|
name?: string;
|
|
171
|
+
/** Route pattern with parameter placeholders */
|
|
82
172
|
pattern: string;
|
|
173
|
+
/** Domain on which the route is registered */
|
|
83
174
|
domain: string;
|
|
175
|
+
/** HTTP methods accepted by this route */
|
|
84
176
|
methods: string[];
|
|
177
|
+
/** Controller reference information (if controller-based route) */
|
|
85
178
|
controllerReference?: {
|
|
179
|
+
/** Dynamic import expression for the controller */
|
|
86
180
|
importExpression: string;
|
|
181
|
+
/** Specific controller method to call */
|
|
87
182
|
method?: string;
|
|
88
183
|
};
|
|
184
|
+
/** Parsed route tokens for URI construction */
|
|
89
185
|
tokens: {
|
|
90
186
|
val: string;
|
|
91
187
|
old: string;
|
|
@@ -94,22 +190,40 @@ export type RoutesListItem = {
|
|
|
94
190
|
}[];
|
|
95
191
|
};
|
|
96
192
|
/**
|
|
97
|
-
*
|
|
193
|
+
* Configuration rules accepted by the routes scanner to customize
|
|
194
|
+
* the scanning behavior and override type inference.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* const rules: RoutesScannerRules = {
|
|
198
|
+
* skip: ['admin.dashboard', 'health.check'],
|
|
199
|
+
* response: {
|
|
200
|
+
* 'users.index': {
|
|
201
|
+
* type: 'PaginatedResponse<User[]>',
|
|
202
|
+
* imports: ['import { User } from "#models/user"']
|
|
203
|
+
* }
|
|
204
|
+
* },
|
|
205
|
+
* request: {
|
|
206
|
+
* 'users.store': {
|
|
207
|
+
* type: 'CreateUserRequest',
|
|
208
|
+
* imports: ['import { CreateUserRequest } from "#types/requests"']
|
|
209
|
+
* }
|
|
210
|
+
* }
|
|
211
|
+
* }
|
|
98
212
|
*/
|
|
99
213
|
export type RoutesScannerRules = {
|
|
100
214
|
/**
|
|
101
|
-
* An array of route names or controller+method paths to skip from
|
|
102
|
-
*
|
|
215
|
+
* An array of route names or controller+method paths to skip from processing.
|
|
216
|
+
* Useful for excluding routes that don't need type generation.
|
|
103
217
|
*/
|
|
104
218
|
skip: string[];
|
|
105
219
|
/**
|
|
106
|
-
* Define custom response
|
|
107
|
-
* controller+method path
|
|
220
|
+
* Define custom response types for specific routes by their name
|
|
221
|
+
* or controller+method path. Overrides automatic type inference.
|
|
108
222
|
*/
|
|
109
223
|
response: Record<string, ScannedRoute['response']>;
|
|
110
224
|
/**
|
|
111
|
-
* Define custom request data
|
|
112
|
-
* or
|
|
225
|
+
* Define custom request data types for specific routes by their name
|
|
226
|
+
* or controller+method path. Overrides automatic type inference.
|
|
113
227
|
*/
|
|
114
228
|
request: Record<string, ScannedRoute['response']>;
|
|
115
229
|
};
|
|
@@ -1,61 +1,103 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Entry to add a middleware to a given middleware stack
|
|
3
|
-
*
|
|
2
|
+
* Entry to add a middleware to a given middleware stack via the CodeTransformer.
|
|
3
|
+
* Represents middleware configuration for server, router, or named middleware stacks.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const corsMiddleware: MiddlewareNode = {
|
|
7
|
+
* path: '@adonisjs/cors/cors_middleware',
|
|
8
|
+
* position: 'before'
|
|
9
|
+
* }
|
|
10
|
+
*
|
|
11
|
+
* const namedMiddleware: MiddlewareNode = {
|
|
12
|
+
* name: 'auth',
|
|
13
|
+
* path: '#middleware/auth_middleware',
|
|
14
|
+
* position: 'after'
|
|
15
|
+
* }
|
|
4
16
|
*/
|
|
5
17
|
export type MiddlewareNode = {
|
|
6
18
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
19
|
+
* Required for named middleware. The key name under which the middleware
|
|
20
|
+
* will be registered in the named middleware collection.
|
|
9
21
|
*/
|
|
10
22
|
name?: string;
|
|
11
23
|
/**
|
|
12
|
-
* The path to the middleware file
|
|
24
|
+
* The import path to the middleware file. Can be a package import,
|
|
25
|
+
* subpath import, or relative path.
|
|
13
26
|
*
|
|
14
27
|
* @example
|
|
15
|
-
*
|
|
16
|
-
*
|
|
28
|
+
* '@adonisjs/static/static_middleware'
|
|
29
|
+
* '#middlewares/silent_auth'
|
|
30
|
+
* './middleware/custom_middleware.js'
|
|
17
31
|
*/
|
|
18
32
|
path: string;
|
|
19
33
|
/**
|
|
20
|
-
* The position to add the middleware
|
|
21
|
-
*
|
|
22
|
-
* therefore will be run before all others
|
|
34
|
+
* The position to add the middleware in the stack.
|
|
35
|
+
* 'before' adds at the beginning (runs first), 'after' adds at the end (runs last).
|
|
23
36
|
*
|
|
24
37
|
* @default 'after'
|
|
25
38
|
*/
|
|
26
39
|
position?: 'before' | 'after';
|
|
27
40
|
};
|
|
28
41
|
/**
|
|
29
|
-
* Policy node to be added to the list of policies.
|
|
42
|
+
* Policy node to be added to the list of Bouncer authorization policies.
|
|
43
|
+
* Used for registering policies in the application's policy registry.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const userPolicy: BouncerPolicyNode = {
|
|
47
|
+
* name: 'UserPolicy',
|
|
48
|
+
* path: '#policies/user_policy'
|
|
49
|
+
* }
|
|
30
50
|
*/
|
|
31
51
|
export type BouncerPolicyNode = {
|
|
32
52
|
/**
|
|
33
|
-
*
|
|
53
|
+
* The name of the policy class (should match the exported class name)
|
|
34
54
|
*/
|
|
35
55
|
name: string;
|
|
36
56
|
/**
|
|
37
|
-
*
|
|
57
|
+
* The import path to the policy file
|
|
38
58
|
*/
|
|
39
59
|
path: string;
|
|
40
60
|
};
|
|
41
61
|
/**
|
|
42
|
-
* Defines the structure of an environment variable validation
|
|
43
|
-
*
|
|
62
|
+
* Defines the structure of an environment variable validation definition.
|
|
63
|
+
* Used to add new environment variable validations to the start/env.ts file.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* const envValidation: EnvValidationNode = {
|
|
67
|
+
* leadingComment: 'Database configuration',
|
|
68
|
+
* variables: {
|
|
69
|
+
* DB_HOST: 'Env.schema.string()',
|
|
70
|
+
* DB_PORT: 'Env.schema.number.optional({ port: 5432 })',
|
|
71
|
+
* DB_PASSWORD: 'Env.schema.string.optional()'
|
|
72
|
+
* }
|
|
73
|
+
* }
|
|
44
74
|
*/
|
|
45
75
|
export type EnvValidationNode = {
|
|
46
76
|
/**
|
|
47
|
-
*
|
|
77
|
+
* Optional leading comment to write above the variable definitions.
|
|
78
|
+
* Helps group related environment variables together.
|
|
48
79
|
*/
|
|
49
80
|
leadingComment?: string;
|
|
50
81
|
/**
|
|
51
|
-
* A key-value pair of
|
|
82
|
+
* A key-value pair of environment variables and their validation schemas.
|
|
83
|
+
* The key is the environment variable name, the value is the validation code.
|
|
52
84
|
*
|
|
53
85
|
* @example
|
|
54
|
-
*
|
|
86
|
+
* {
|
|
87
|
+
* MY_VAR: 'Env.schema.string.optional()',
|
|
88
|
+
* API_KEY: 'Env.schema.string()'
|
|
89
|
+
* }
|
|
55
90
|
*/
|
|
56
91
|
variables: Record<string, string>;
|
|
57
92
|
};
|
|
58
93
|
/**
|
|
59
|
-
* The supported package managers for installing packages
|
|
94
|
+
* The supported package managers for installing packages and managing lockfiles.
|
|
95
|
+
* Each package manager has specific lockfiles and install commands.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* const packageManager: SupportedPackageManager = 'pnpm'
|
|
99
|
+
*
|
|
100
|
+
* // Used in bundler configuration
|
|
101
|
+
* const bundler = new Bundler(cwd, ts, { packageManager: 'yarn@berry' })
|
|
60
102
|
*/
|
|
61
103
|
export type SupportedPackageManager = 'npm' | 'yarn' | 'yarn@berry' | 'pnpm' | 'bun';
|