@adonisjs/assembler 8.0.0-next.5 → 8.0.0-next.7

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.
Files changed (36) hide show
  1. package/README.md +87 -59
  2. package/build/chunk-25Q3N5JR.js +392 -0
  3. package/build/chunk-PORDZS62.js +391 -0
  4. package/build/chunk-TIKQQRMX.js +116 -0
  5. package/build/index.d.ts +2 -0
  6. package/build/index.js +825 -430
  7. package/build/src/bundler.d.ts +44 -3
  8. package/build/src/code_scanners/routes_scanner/main.d.ts +49 -9
  9. package/build/src/code_scanners/routes_scanner/main.js +445 -0
  10. package/build/src/code_scanners/routes_scanner/validator_extractor.d.ts +12 -4
  11. package/build/src/code_transformer/main.d.ts +44 -43
  12. package/build/src/code_transformer/main.js +123 -101
  13. package/build/src/code_transformer/rc_file_transformer.d.ts +56 -4
  14. package/build/src/debug.d.ts +12 -0
  15. package/build/src/dev_server.d.ts +38 -9
  16. package/build/src/file_buffer.d.ts +67 -0
  17. package/build/src/file_system.d.ts +45 -7
  18. package/build/src/helpers.d.ts +79 -4
  19. package/build/src/helpers.js +16 -0
  20. package/build/src/hooks.d.ts +224 -0
  21. package/build/src/index_generator/main.d.ts +64 -0
  22. package/build/src/index_generator/main.js +7 -0
  23. package/build/src/index_generator/source.d.ts +60 -0
  24. package/build/src/paths_resolver.d.ts +27 -2
  25. package/build/src/shortcuts_manager.d.ts +42 -4
  26. package/build/src/test_runner.d.ts +56 -10
  27. package/build/src/types/code_scanners.d.ts +138 -24
  28. package/build/src/types/code_transformer.d.ts +61 -19
  29. package/build/src/types/common.d.ts +199 -55
  30. package/build/src/types/hooks.d.ts +235 -22
  31. package/build/src/types/main.d.ts +13 -0
  32. package/build/src/utils.d.ts +88 -13
  33. package/build/src/virtual_file_system.d.ts +112 -0
  34. package/package.json +9 -3
  35. package/build/chunk-RR4HCA4M.js +0 -7
  36. package/build/src/ast_file_system.d.ts +0 -17
@@ -0,0 +1,60 @@
1
+ import { type Logger } from '@poppinss/cliui';
2
+ import { type IndexGeneratorSourceConfig } from '../types/common.ts';
3
+ /**
4
+ * IndexGeneratorSource handles the generation of a single index file.
5
+ *
6
+ * This class is responsible for scanning a source directory, processing files
7
+ * according to configuration, and generating an index file that exports the
8
+ * discovered modules. It supports both barrel file generation and custom
9
+ * generation strategies.
10
+ *
11
+ * @example
12
+ * const source = new IndexGeneratorSource(appRoot, {
13
+ * source: 'app/controllers',
14
+ * output: 'app/controllers/index.ts',
15
+ * as: 'barrelFile',
16
+ * exportName: 'controllers'
17
+ * })
18
+ * await source.generate()
19
+ */
20
+ export declare class IndexGeneratorSource {
21
+ #private;
22
+ /**
23
+ * Unique name for this index generator source
24
+ */
25
+ name: string;
26
+ /**
27
+ * Create a new IndexGeneratorSource instance
28
+ *
29
+ * @param name - Unique name for this index generator source
30
+ * @param appRoot - The application root directory path
31
+ * @param cliLogger - Logger instance for CLI output
32
+ * @param config - Configuration for this index generator source
33
+ */
34
+ constructor(name: string, appRoot: string, cliLogger: Logger, config: IndexGeneratorSourceConfig);
35
+ /**
36
+ * Add a file to the virtual file system and regenerate index if needed
37
+ *
38
+ * If the file matches the configured glob patterns, it will be added
39
+ * to the virtual file system and the index file will be regenerated.
40
+ *
41
+ * @param filePath - Absolute path of the file to add
42
+ */
43
+ addFile(filePath: string): Promise<void>;
44
+ /**
45
+ * Remove a file from the virtual file system and regenerate index if needed
46
+ *
47
+ * If the file was previously tracked, it will be removed from the
48
+ * virtual file system and the index file will be regenerated.
49
+ *
50
+ * @param filePath - Absolute path of the file to remove
51
+ */
52
+ removeFile(filePath: string): Promise<void>;
53
+ /**
54
+ * Generate the index file
55
+ *
56
+ * This method scans the source directory, processes files according to
57
+ * the configuration, and writes the generated index file to disk.
58
+ */
59
+ generate(): Promise<void>;
60
+ }
@@ -1,15 +1,40 @@
1
1
  /**
2
2
  * Encapsulates the API to resolve import specifiers with the ability
3
- * to define customer resolver.
3
+ * to define custom resolver functions.
4
+ *
5
+ * The PathsResolver provides a caching mechanism to avoid resolving the same
6
+ * specifier multiple times and supports custom resolvers for handling
7
+ * special import patterns like path aliases.
8
+ *
9
+ * @example
10
+ * const resolver = new PathsResolver()
11
+ * resolver.use((specifier) => '/custom/path/' + specifier)
12
+ * const resolved = resolver.resolve('#app/models/user')
4
13
  */
5
14
  export declare class PathsResolver {
6
15
  #private;
7
16
  /**
8
17
  * Define a custom resolver that resolves a path
18
+ *
19
+ * The custom resolver function will be used instead of the default
20
+ * import.meta.resolve() for resolving import specifiers.
21
+ *
22
+ * @param resolver - Function that takes a specifier and returns resolved path
9
23
  */
10
24
  use(resolver: (specifier: string) => string): void;
11
25
  /**
12
- * Resolve import specifier
26
+ * Resolve import specifier to an absolute file path
27
+ *
28
+ * This method caches resolved paths to improve performance on repeated
29
+ * resolutions. Relative paths are not supported and will throw an error.
30
+ *
31
+ * @param specifier - The import specifier to resolve (must not be relative)
32
+ * @returns The resolved absolute file path
33
+ * @throws Error when attempting to resolve relative paths
34
+ *
35
+ * @example
36
+ * const path = resolver.resolve('#app/models/user')
37
+ * const path2 = resolver.resolve('@/utils/helper')
13
38
  */
14
39
  resolve(specifier: string): string;
15
40
  }
@@ -1,24 +1,62 @@
1
1
  import { type ShortcutsManagerOptions } from './types/common.ts';
2
2
  /**
3
- * Manages keyboard shortcuts for development server
3
+ * Manages keyboard shortcuts for development server interaction.
4
+ *
5
+ * The ShortcutsManager provides a convenient way to handle keyboard inputs
6
+ * during development, allowing users to restart servers, clear console,
7
+ * open browsers, and perform other common development tasks through simple
8
+ * key presses.
9
+ *
10
+ * @example
11
+ * const shortcuts = new ShortcutsManager({
12
+ * logger: ui.logger,
13
+ * callbacks: {
14
+ * onRestart: () => server.restart(),
15
+ * onClear: () => console.clear(),
16
+ * onQuit: () => process.exit()
17
+ * }
18
+ * })
19
+ * shortcuts.setup()
4
20
  */
5
21
  export declare class ShortcutsManager {
6
22
  #private;
23
+ /**
24
+ * Create a new ShortcutsManager instance
25
+ *
26
+ * @param options - Configuration options for the shortcuts manager
27
+ */
7
28
  constructor(options: ShortcutsManagerOptions);
8
29
  /**
9
30
  * Set server url for opening in browser
31
+ *
32
+ * This URL will be used when the user presses 'o' to open the
33
+ * development server in their default browser.
34
+ *
35
+ * @param url - The server URL to open when 'o' key is pressed
10
36
  */
11
37
  setServerUrl(url: string): void;
12
38
  /**
13
- * Initialize keyboard shortcuts
39
+ * Initialize keyboard shortcuts by setting up raw mode on stdin
40
+ *
41
+ * This method enables raw mode on stdin to capture individual keypresses
42
+ * and sets up the event listener for handling keyboard input. Only works
43
+ * in TTY environments.
14
44
  */
15
45
  setup(): void;
16
46
  /**
17
- * Show available keyboard shortcuts
47
+ * Show available keyboard shortcuts in the console
48
+ *
49
+ * Displays a formatted list of all available keyboard shortcuts
50
+ * and their descriptions to help users understand what actions
51
+ * are available.
18
52
  */
19
53
  showHelp(): void;
20
54
  /**
21
- * Cleanup keyboard shortcuts
55
+ * Cleanup keyboard shortcuts and restore terminal state
56
+ *
57
+ * Disables raw mode on stdin, removes event listeners, and restores
58
+ * the terminal to its normal state. Should be called when shutting down
59
+ * the development server.
22
60
  */
23
61
  cleanup(): void;
24
62
  }
@@ -4,19 +4,29 @@ import type { TestRunnerOptions } from './types/common.ts';
4
4
  * Exposes the API to run Japa tests and optionally watch for file
5
5
  * changes to re-run the tests.
6
6
  *
7
- * The watch mode functions as follows.
7
+ * The TestRunner provides intelligent test execution with watch mode capabilities.
8
+ * When files change, it can selectively run specific tests or the entire suite
9
+ * based on what changed.
8
10
  *
11
+ * The watch mode functions as follows:
9
12
  * - If the changed file is a test file, then only tests for that file
10
13
  * will be re-run.
11
14
  * - Otherwise, all tests will re-run with respect to the initial
12
15
  * filters applied when running the `node ace test` command.
16
+ *
17
+ * @example
18
+ * const testRunner = new TestRunner(cwd, { suites: [], hooks: [] })
19
+ * await testRunner.run()
20
+ *
21
+ * @example
22
+ * // Run tests in watch mode
23
+ * const testRunner = new TestRunner(cwd, { suites: [], hooks: [] })
24
+ * await testRunner.runAndWatch(ts, { poll: false })
13
25
  */
14
26
  export declare class TestRunner {
15
27
  #private;
16
- cwd: URL;
17
- options: TestRunnerOptions;
18
28
  /**
19
- * CLI UI to log colorful messages
29
+ * CLI UI instance for displaying colorful messages and progress information
20
30
  */
21
31
  ui: {
22
32
  colors: import("@poppinss/colors/types").Colors;
@@ -43,27 +53,63 @@ export declare class TestRunner {
43
53
  * The script file to run as a child process
44
54
  */
45
55
  scriptFile: string;
56
+ /**
57
+ * The current working directory URL
58
+ */
59
+ cwd: URL;
60
+ /**
61
+ * The current working directory path as a string
62
+ */
63
+ cwdPath: string;
64
+ /**
65
+ * Test runner configuration options including filters, reporters, and hooks
66
+ */
67
+ options: TestRunnerOptions;
68
+ /**
69
+ * Create a new TestRunner instance
70
+ *
71
+ * @param cwd - The current working directory URL
72
+ * @param options - Test runner configuration options
73
+ */
46
74
  constructor(cwd: URL, options: TestRunnerOptions);
47
75
  /**
48
- * Add listener to get notified when dev server is
49
- * closed
76
+ * Add listener to get notified when test runner is closed
77
+ *
78
+ * @param callback - Function to call when test runner closes
79
+ * @returns This TestRunner instance for method chaining
50
80
  */
51
81
  onClose(callback: (exitCode: number) => any): this;
52
82
  /**
53
- * Add listener to get notified when dev server exists
54
- * with an error
83
+ * Add listener to get notified when test runner encounters an error
84
+ *
85
+ * @param callback - Function to call when test runner encounters an error
86
+ * @returns This TestRunner instance for method chaining
55
87
  */
56
88
  onError(callback: (error: any) => any): this;
57
89
  /**
58
90
  * Close watchers and running child processes
91
+ *
92
+ * Cleans up file system watchers and terminates any running test
93
+ * processes to ensure graceful shutdown.
59
94
  */
60
95
  close(): Promise<void>;
61
96
  /**
62
- * Runs tests
97
+ * Runs tests once without watching for file changes
98
+ *
99
+ * Executes the test suite a single time and exits. This is the
100
+ * equivalent of running tests in CI/CD environments.
63
101
  */
64
102
  run(): Promise<void>;
65
103
  /**
66
- * Run tests in watch mode
104
+ * Run tests in watch mode and re-run them when files change
105
+ *
106
+ * Starts the test runner in watch mode, monitoring the file system
107
+ * for changes and automatically re-running tests when relevant files
108
+ * are modified. Uses intelligent filtering to run only affected tests
109
+ * when possible.
110
+ *
111
+ * @param ts - TypeScript module reference for parsing configuration
112
+ * @param options - Watch options including polling mode for file system monitoring
67
113
  */
68
114
  runAndWatch(ts: typeof tsStatic, options?: {
69
115
  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. It
25
- * could be duplicate across domains.
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
- * HTTP method for which the route is defined
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 could be used for constructing a URI for
42
- * the route without parsing the pattern
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. By default, the request
52
- * data type is inferred when route is using a controller with a
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 for the route. By default, the response is only
61
- * inferred when the route is using a controller.
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 validators info, only when using the controller.
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 info, only when using the 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
- * Rules accepted by the route scanner.
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
- * the processing
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 type for a route by its name or the
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 type for a route by its name
112
- * or the controller+method path
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
- * via the CodeTransformer
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
- * If you are adding a named middleware, then you must
8
- * define the name.
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
- * `@adonisjs/static/static_middleware`
16
- * `#middlewares/silent_auth.js`
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. If `before`
21
- * middleware will be added at the first position and
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
- * Policy name
53
+ * The name of the policy class (should match the exported class name)
34
54
  */
35
55
  name: string;
36
56
  /**
37
- * Policy import path
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
- * definition
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
- * Write a leading comment on top of your variables
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 env variables and their validation
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
- * MY_VAR: 'Env.schema.string.optional()'
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';