@adonisjs/core 7.0.0-next.5 → 7.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.
@@ -75,29 +75,101 @@ export declare class Codemods extends EventEmitter {
75
75
  */
76
76
  getTsMorphProject(): Promise<CodeTransformer['project'] | undefined>;
77
77
  /**
78
- * Define validations for the environment variables
78
+ * Define validations for the environment variables in the start/env.ts file.
79
+ * This method updates the environment validation schema using the assembler.
80
+ *
81
+ * @param validations - Validation schema node for environment variables
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * await codemods.defineEnvValidations({
86
+ * NODE_ENV: 'Env.schema.enum(["development", "production", "test"] as const)',
87
+ * PORT: 'Env.schema.number()',
88
+ * HOST: 'Env.schema.string({ format: "host" })'
89
+ * })
90
+ * ```
79
91
  */
80
92
  defineEnvValidations(validations: EnvValidationNode): Promise<void>;
81
93
  /**
82
- * Define validations for the environment variables
94
+ * Register middleware in the start/kernel.ts file.
95
+ * This method adds middleware to the specified stack (server, router, or named).
96
+ *
97
+ * @param stack - The middleware stack to register to ('server' | 'router' | 'named')
98
+ * @param middleware - Array of middleware nodes to register
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * await codemods.registerMiddleware('server', [
103
+ * {
104
+ * name: 'cors',
105
+ * path: '@adonisjs/cors/cors_middleware'
106
+ * }
107
+ * ])
108
+ * ```
83
109
  */
84
110
  registerMiddleware(stack: 'server' | 'router' | 'named', middleware: MiddlewareNode[]): Promise<void>;
85
111
  /**
86
- * Register bouncer policies to the list of policies
87
- * collection exported from the "app/policies/main.ts"
88
- * file.
112
+ * Register bouncer policies to the list of policies collection exported from
113
+ * the "app/policies/main.ts" file. This method adds new policy definitions
114
+ * to the policies export.
115
+ *
116
+ * @param policies - Array of policy nodes to register
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * await codemods.registerPolicies([
121
+ * {
122
+ * name: 'UserPolicy',
123
+ * path: '#policies/user_policy'
124
+ * }
125
+ * ])
126
+ * ```
89
127
  */
90
128
  registerPolicies(policies: BouncerPolicyNode[]): Promise<void>;
91
129
  /**
92
- * Update RCFile
130
+ * Update the adonisrc.ts file with new configuration settings.
131
+ * This method allows modification of the AdonisJS runtime configuration.
132
+ *
133
+ * @param params - Parameters for updating the RC file (varies based on update type)
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * await codemods.updateRcFile((rcFile) => {
138
+ * rcFile.addCommand('make:custom')
139
+ * rcFile.addPreloadFile('#app/events/main')
140
+ * })
141
+ * ```
93
142
  */
94
143
  updateRcFile(...params: Parameters<CodeTransformer['updateRcFile']>): Promise<void>;
95
144
  /**
96
- * Register a new Vite plugin in the `vite.config.ts` file
145
+ * Register a new Vite plugin in the vite.config.ts file.
146
+ * This method adds plugin configuration to the Vite build configuration.
147
+ *
148
+ * @param params - Parameters for adding the Vite plugin (varies based on plugin type)
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * await codemods.registerVitePlugin({
153
+ * name: 'vue',
154
+ * import: 'import vue from "@vitejs/plugin-vue"',
155
+ * options: '()'
156
+ * })
157
+ * ```
97
158
  */
98
159
  registerVitePlugin(...params: Parameters<CodeTransformer['addVitePlugin']>): Promise<void>;
99
160
  /**
100
- * Register a new Japa plugin in the `tests/bootstrap.ts` file
161
+ * Register a new Japa plugin in the tests/bootstrap.ts file.
162
+ * This method adds plugin configuration to the test runner setup.
163
+ *
164
+ * @param params - Parameters for adding the Japa plugin (varies based on plugin type)
165
+ *
166
+ * @example
167
+ * ```ts
168
+ * await codemods.registerJapaPlugin({
169
+ * name: 'expect',
170
+ * import: 'import { expect } from "@japa/expect"'
171
+ * })
172
+ * ```
101
173
  */
102
174
  registerJapaPlugin(...params: Parameters<CodeTransformer['addJapaPlugin']>): Promise<void>;
103
175
  /**
@@ -143,12 +215,19 @@ export declare class Codemods extends EventEmitter {
143
215
  skipReason: string;
144
216
  }>;
145
217
  /**
146
- * Install packages using the correct package manager
147
- * You can specify version of each package by setting it in the
148
- * name like :
218
+ * Install packages using the detected or specified package manager.
219
+ * Automatically detects npm, yarn, or pnpm and installs dependencies accordingly.
220
+ * You can specify version of each package by setting it in the name like '@adonisjs/lucid@next'.
149
221
  *
150
- * ```
151
- * this.installPackages([{ name: '@adonisjs/lucid@next', isDevDependency: false }])
222
+ * @param packages - Array of packages with their dependency type
223
+ * @param packageManager - Optional package manager to use (auto-detected if not provided)
224
+ *
225
+ * @example
226
+ * ```ts
227
+ * const success = await codemods.installPackages([
228
+ * { name: '@adonisjs/lucid', isDevDependency: false },
229
+ * { name: '@types/node', isDevDependency: true }
230
+ * ])
152
231
  * ```
153
232
  */
154
233
  installPackages(packages: {
@@ -156,7 +235,23 @@ export declare class Codemods extends EventEmitter {
156
235
  isDevDependency: boolean;
157
236
  }[], packageManager?: SupportedPackageManager | 'pnpm@6' | 'deno'): Promise<boolean>;
158
237
  /**
159
- * List the packages one should install before using the packages
238
+ * List the packages that should be installed manually.
239
+ * This method displays installation commands for different package managers
240
+ * when automatic installation is not available or desired.
241
+ *
242
+ * @param packages - Array of packages with their dependency type
243
+ *
244
+ * @example
245
+ * ```ts
246
+ * await codemods.listPackagesToInstall([
247
+ * { name: '@adonisjs/lucid', isDevDependency: false },
248
+ * { name: '@types/node', isDevDependency: true }
249
+ * ])
250
+ * // Output:
251
+ * // Please install following packages
252
+ * // npm i -D @types/node
253
+ * // npm i @adonisjs/lucid
254
+ * ```
160
255
  */
161
256
  listPackagesToInstall(packages: {
162
257
  name: string;
@@ -147,7 +147,19 @@ export class Codemods extends EventEmitter {
147
147
  return transformer.project;
148
148
  }
149
149
  /**
150
- * Define validations for the environment variables
150
+ * Define validations for the environment variables in the start/env.ts file.
151
+ * This method updates the environment validation schema using the assembler.
152
+ *
153
+ * @param validations - Validation schema node for environment variables
154
+ *
155
+ * @example
156
+ * ```ts
157
+ * await codemods.defineEnvValidations({
158
+ * NODE_ENV: 'Env.schema.enum(["development", "production", "test"] as const)',
159
+ * PORT: 'Env.schema.number()',
160
+ * HOST: 'Env.schema.string({ format: "host" })'
161
+ * })
162
+ * ```
151
163
  */
152
164
  async defineEnvValidations(validations) {
153
165
  const transformer = await this.#getCodeTransformer();
@@ -166,7 +178,21 @@ export class Codemods extends EventEmitter {
166
178
  }
167
179
  }
168
180
  /**
169
- * Define validations for the environment variables
181
+ * Register middleware in the start/kernel.ts file.
182
+ * This method adds middleware to the specified stack (server, router, or named).
183
+ *
184
+ * @param stack - The middleware stack to register to ('server' | 'router' | 'named')
185
+ * @param middleware - Array of middleware nodes to register
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * await codemods.registerMiddleware('server', [
190
+ * {
191
+ * name: 'cors',
192
+ * path: '@adonisjs/cors/cors_middleware'
193
+ * }
194
+ * ])
195
+ * ```
170
196
  */
171
197
  async registerMiddleware(stack, middleware) {
172
198
  const transformer = await this.#getCodeTransformer();
@@ -185,9 +211,21 @@ export class Codemods extends EventEmitter {
185
211
  }
186
212
  }
187
213
  /**
188
- * Register bouncer policies to the list of policies
189
- * collection exported from the "app/policies/main.ts"
190
- * file.
214
+ * Register bouncer policies to the list of policies collection exported from
215
+ * the "app/policies/main.ts" file. This method adds new policy definitions
216
+ * to the policies export.
217
+ *
218
+ * @param policies - Array of policy nodes to register
219
+ *
220
+ * @example
221
+ * ```ts
222
+ * await codemods.registerPolicies([
223
+ * {
224
+ * name: 'UserPolicy',
225
+ * path: '#policies/user_policy'
226
+ * }
227
+ * ])
228
+ * ```
191
229
  */
192
230
  async registerPolicies(policies) {
193
231
  const transformer = await this.#getCodeTransformer();
@@ -206,7 +244,18 @@ export class Codemods extends EventEmitter {
206
244
  }
207
245
  }
208
246
  /**
209
- * Update RCFile
247
+ * Update the adonisrc.ts file with new configuration settings.
248
+ * This method allows modification of the AdonisJS runtime configuration.
249
+ *
250
+ * @param params - Parameters for updating the RC file (varies based on update type)
251
+ *
252
+ * @example
253
+ * ```ts
254
+ * await codemods.updateRcFile((rcFile) => {
255
+ * rcFile.addCommand('make:custom')
256
+ * rcFile.addPreloadFile('#app/events/main')
257
+ * })
258
+ * ```
210
259
  */
211
260
  async updateRcFile(...params) {
212
261
  const transformer = await this.#getCodeTransformer();
@@ -225,7 +274,19 @@ export class Codemods extends EventEmitter {
225
274
  }
226
275
  }
227
276
  /**
228
- * Register a new Vite plugin in the `vite.config.ts` file
277
+ * Register a new Vite plugin in the vite.config.ts file.
278
+ * This method adds plugin configuration to the Vite build configuration.
279
+ *
280
+ * @param params - Parameters for adding the Vite plugin (varies based on plugin type)
281
+ *
282
+ * @example
283
+ * ```ts
284
+ * await codemods.registerVitePlugin({
285
+ * name: 'vue',
286
+ * import: 'import vue from "@vitejs/plugin-vue"',
287
+ * options: '()'
288
+ * })
289
+ * ```
229
290
  */
230
291
  async registerVitePlugin(...params) {
231
292
  const transformer = await this.#getCodeTransformer();
@@ -244,7 +305,18 @@ export class Codemods extends EventEmitter {
244
305
  }
245
306
  }
246
307
  /**
247
- * Register a new Japa plugin in the `tests/bootstrap.ts` file
308
+ * Register a new Japa plugin in the tests/bootstrap.ts file.
309
+ * This method adds plugin configuration to the test runner setup.
310
+ *
311
+ * @param params - Parameters for adding the Japa plugin (varies based on plugin type)
312
+ *
313
+ * @example
314
+ * ```ts
315
+ * await codemods.registerJapaPlugin({
316
+ * name: 'expect',
317
+ * import: 'import { expect } from "@japa/expect"'
318
+ * })
319
+ * ```
248
320
  */
249
321
  async registerJapaPlugin(...params) {
250
322
  const transformer = await this.#getCodeTransformer();
@@ -296,12 +368,19 @@ export class Codemods extends EventEmitter {
296
368
  return result;
297
369
  }
298
370
  /**
299
- * Install packages using the correct package manager
300
- * You can specify version of each package by setting it in the
301
- * name like :
371
+ * Install packages using the detected or specified package manager.
372
+ * Automatically detects npm, yarn, or pnpm and installs dependencies accordingly.
373
+ * You can specify version of each package by setting it in the name like '@adonisjs/lucid@next'.
302
374
  *
303
- * ```
304
- * this.installPackages([{ name: '@adonisjs/lucid@next', isDevDependency: false }])
375
+ * @param packages - Array of packages with their dependency type
376
+ * @param packageManager - Optional package manager to use (auto-detected if not provided)
377
+ *
378
+ * @example
379
+ * ```ts
380
+ * const success = await codemods.installPackages([
381
+ * { name: '@adonisjs/lucid', isDevDependency: false },
382
+ * { name: '@types/node', isDevDependency: true }
383
+ * ])
305
384
  * ```
306
385
  */
307
386
  async installPackages(packages, packageManager) {
@@ -365,7 +444,23 @@ export class Codemods extends EventEmitter {
365
444
  }
366
445
  }
367
446
  /**
368
- * List the packages one should install before using the packages
447
+ * List the packages that should be installed manually.
448
+ * This method displays installation commands for different package managers
449
+ * when automatic installation is not available or desired.
450
+ *
451
+ * @param packages - Array of packages with their dependency type
452
+ *
453
+ * @example
454
+ * ```ts
455
+ * await codemods.listPackagesToInstall([
456
+ * { name: '@adonisjs/lucid', isDevDependency: false },
457
+ * { name: '@types/node', isDevDependency: true }
458
+ * ])
459
+ * // Output:
460
+ * // Please install following packages
461
+ * // npm i -D @types/node
462
+ * // npm i @adonisjs/lucid
463
+ * ```
369
464
  */
370
465
  async listPackagesToInstall(packages) {
371
466
  const appPath = this.#app.makePath();
@@ -1,3 +1,33 @@
1
+ /**
2
+ * Ace command line interface module for AdonisJS applications.
3
+ * Provides the kernel, base commands, and utilities for building CLI applications.
4
+ *
5
+ * @example
6
+ * // Create and use the Ace kernel
7
+ * import { Kernel, BaseCommand } from '@adonisjs/core/ace'
8
+ *
9
+ * const kernel = new Kernel(app)
10
+ * await kernel.handle(['make:controller', 'UserController'])
11
+ *
12
+ * @example
13
+ * // Create a custom command
14
+ * import { BaseCommand, args, flags } from '@adonisjs/core/ace'
15
+ *
16
+ * export default class MakeUser extends BaseCommand {
17
+ * static commandName = 'make:user'
18
+ * static description = 'Create a new user'
19
+ *
20
+ * @args.string({ description: 'Name of the user' })
21
+ * declare name: string
22
+ *
23
+ * @flags.boolean({ description: 'Create admin user' })
24
+ * declare admin: boolean
25
+ *
26
+ * async run() {
27
+ * this.logger.info(`Creating user: ${this.name}`)
28
+ * }
29
+ * }
30
+ */
1
31
  export { Kernel } from './kernel.ts';
2
32
  export { BaseCommand, ListCommand } from './commands.ts';
3
33
  export { args, flags, errors, Parser, FsLoader, ListLoader, cliHelpers, HelpCommand, IndexGenerator, tracingChannels, } from '@adonisjs/ace';
@@ -6,6 +6,36 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ /**
10
+ * Ace command line interface module for AdonisJS applications.
11
+ * Provides the kernel, base commands, and utilities for building CLI applications.
12
+ *
13
+ * @example
14
+ * // Create and use the Ace kernel
15
+ * import { Kernel, BaseCommand } from '@adonisjs/core/ace'
16
+ *
17
+ * const kernel = new Kernel(app)
18
+ * await kernel.handle(['make:controller', 'UserController'])
19
+ *
20
+ * @example
21
+ * // Create a custom command
22
+ * import { BaseCommand, args, flags } from '@adonisjs/core/ace'
23
+ *
24
+ * export default class MakeUser extends BaseCommand {
25
+ * static commandName = 'make:user'
26
+ * static description = 'Create a new user'
27
+ *
28
+ * @args.string({ description: 'Name of the user' })
29
+ * declare name: string
30
+ *
31
+ * @flags.boolean({ description: 'Create admin user' })
32
+ * declare admin: boolean
33
+ *
34
+ * async run() {
35
+ * this.logger.info(`Creating user: ${this.name}`)
36
+ * }
37
+ * }
38
+ */
9
39
  export { Kernel } from "./kernel.js";
10
40
  export { BaseCommand, ListCommand } from "./commands.js";
11
41
  export { args, flags, errors, Parser, FsLoader, ListLoader, cliHelpers, HelpCommand, IndexGenerator, tracingChannels, } from '@adonisjs/ace';
@@ -1 +1,18 @@
1
+ /**
2
+ * Application module re-exports all functionality from @adonisjs/application.
3
+ * This includes the main Application class and related types for managing
4
+ * the AdonisJS application lifecycle, container bindings, and service providers.
5
+ *
6
+ * @example
7
+ * // Import the Application class
8
+ * import { Application } from '@adonisjs/core/app'
9
+ *
10
+ * const app = new Application(new URL('../', import.meta.url))
11
+ * await app.init()
12
+ * await app.boot()
13
+ *
14
+ * @example
15
+ * // Import application types
16
+ * import type { ApplicationService, ContainerBindings } from '@adonisjs/core/app'
17
+ */
1
18
  export * from '@adonisjs/application';
@@ -6,4 +6,21 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ /**
10
+ * Application module re-exports all functionality from @adonisjs/application.
11
+ * This includes the main Application class and related types for managing
12
+ * the AdonisJS application lifecycle, container bindings, and service providers.
13
+ *
14
+ * @example
15
+ * // Import the Application class
16
+ * import { Application } from '@adonisjs/core/app'
17
+ *
18
+ * const app = new Application(new URL('../', import.meta.url))
19
+ * await app.init()
20
+ * await app.boot()
21
+ *
22
+ * @example
23
+ * // Import application types
24
+ * import type { ApplicationService, ContainerBindings } from '@adonisjs/core/app'
25
+ */
9
26
  export * from '@adonisjs/application';
@@ -1 +1,18 @@
1
+ /**
2
+ * Configuration module re-exports all functionality from @adonisjs/config.
3
+ * This includes the Config class and related types for managing application
4
+ * configuration files and environment-specific settings.
5
+ *
6
+ * @example
7
+ * // Import the Config class
8
+ * import { Config } from '@adonisjs/core/config'
9
+ *
10
+ * const config = new Config()
11
+ * config.set('database.connection', 'mysql')
12
+ * const dbConnection = config.get('database.connection')
13
+ *
14
+ * @example
15
+ * // Import configuration types
16
+ * import type { ConfigProvider } from '@adonisjs/core/config'
17
+ */
1
18
  export * from '@adonisjs/config';
@@ -6,4 +6,21 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ /**
10
+ * Configuration module re-exports all functionality from @adonisjs/config.
11
+ * This includes the Config class and related types for managing application
12
+ * configuration files and environment-specific settings.
13
+ *
14
+ * @example
15
+ * // Import the Config class
16
+ * import { Config } from '@adonisjs/core/config'
17
+ *
18
+ * const config = new Config()
19
+ * config.set('database.connection', 'mysql')
20
+ * const dbConnection = config.get('database.connection')
21
+ *
22
+ * @example
23
+ * // Import configuration types
24
+ * import type { ConfigProvider } from '@adonisjs/core/config'
25
+ */
9
26
  export * from '@adonisjs/config';
@@ -28,6 +28,11 @@ import type { Application } from '../app.ts';
28
28
  */
29
29
  export declare class Dumper {
30
30
  #private;
31
+ /**
32
+ * Creates a new Dumper instance
33
+ *
34
+ * @param app - The AdonisJS application instance
35
+ */
31
36
  constructor(app: Application<any>);
32
37
  /**
33
38
  * Configure the HTML formatter output options
@@ -89,12 +89,22 @@ export class Dumper {
89
89
  atom: 'atom://core/open/file?filename=%f&line=%l',
90
90
  vscode: 'vscode://file/%f:%l',
91
91
  };
92
+ /**
93
+ * Creates a new Dumper instance
94
+ *
95
+ * @param app - The AdonisJS application instance
96
+ */
92
97
  constructor(app) {
93
98
  this.#app = app;
94
99
  }
95
100
  /**
96
101
  * Returns the link to open the file using dd inside one
97
- * of the known code editors
102
+ * of the known code editors. Constructs a URL that can be used
103
+ * to open the file at a specific line in supported editors.
104
+ *
105
+ * @param source - Optional source file information
106
+ * @param source.location - The file path to open
107
+ * @param source.line - The line number to jump to
98
108
  */
99
109
  #getEditorLink(source) {
100
110
  const editorURL = this.#editors[IDE] || IDE;
@@ -1,3 +1,24 @@
1
+ /**
2
+ * Dumper module provides debugging and inspection utilities for AdonisJS applications.
3
+ * Includes the Dumper class for formatting output, error classes, and configuration helpers.
4
+ *
5
+ * @example
6
+ * // Use the dumper service
7
+ * import { Dumper } from '@adonisjs/core/dumper'
8
+ *
9
+ * const dumper = new Dumper(app)
10
+ * const htmlOutput = dumper.dumpToHtml(user, { title: 'User Data' })
11
+ * const ansiOutput = dumper.dumpToAnsi(user, { title: 'Debug User' })
12
+ *
13
+ * @example
14
+ * // Configure dumper output
15
+ * import { defineConfig } from '@adonisjs/core/dumper'
16
+ *
17
+ * export default defineConfig({
18
+ * html: { showHidden: true, depth: 5 },
19
+ * console: { collapse: ['Date', 'DateTime'] }
20
+ * })
21
+ */
1
22
  export * as errors from './errors.ts';
2
23
  export { Dumper } from './dumper.ts';
3
24
  export { defineConfig } from './define_config.ts';
@@ -6,6 +6,27 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ /**
10
+ * Dumper module provides debugging and inspection utilities for AdonisJS applications.
11
+ * Includes the Dumper class for formatting output, error classes, and configuration helpers.
12
+ *
13
+ * @example
14
+ * // Use the dumper service
15
+ * import { Dumper } from '@adonisjs/core/dumper'
16
+ *
17
+ * const dumper = new Dumper(app)
18
+ * const htmlOutput = dumper.dumpToHtml(user, { title: 'User Data' })
19
+ * const ansiOutput = dumper.dumpToAnsi(user, { title: 'Debug User' })
20
+ *
21
+ * @example
22
+ * // Configure dumper output
23
+ * import { defineConfig } from '@adonisjs/core/dumper'
24
+ *
25
+ * export default defineConfig({
26
+ * html: { showHidden: true, depth: 5 },
27
+ * console: { collapse: ['Date', 'DateTime'] }
28
+ * })
29
+ */
9
30
  export * as errors from "./errors.js";
10
31
  export { Dumper } from "./dumper.js";
11
32
  export { defineConfig } from "./define_config.js";
@@ -1 +1,18 @@
1
+ /**
2
+ * Encryption module re-exports all functionality from @adonisjs/encryption.
3
+ * This includes the Encryption class and related utilities for encrypting and
4
+ * decrypting data using various algorithms and key management strategies.
5
+ *
6
+ * @example
7
+ * // Import the Encryption class
8
+ * import { Encryption } from '@adonisjs/core/encryption'
9
+ *
10
+ * const encryption = new Encryption({ secret: 'your-secret-key' })
11
+ * const encrypted = encryption.encrypt('sensitive data')
12
+ * const decrypted = encryption.decrypt(encrypted)
13
+ *
14
+ * @example
15
+ * // Import encryption types and utilities
16
+ * import type { EncryptionConfig, DriverContract } from '@adonisjs/core/encryption'
17
+ */
1
18
  export * from '@adonisjs/encryption';
@@ -6,4 +6,21 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ /**
10
+ * Encryption module re-exports all functionality from @adonisjs/encryption.
11
+ * This includes the Encryption class and related utilities for encrypting and
12
+ * decrypting data using various algorithms and key management strategies.
13
+ *
14
+ * @example
15
+ * // Import the Encryption class
16
+ * import { Encryption } from '@adonisjs/core/encryption'
17
+ *
18
+ * const encryption = new Encryption({ secret: 'your-secret-key' })
19
+ * const encrypted = encryption.encrypt('sensitive data')
20
+ * const decrypted = encryption.decrypt(encrypted)
21
+ *
22
+ * @example
23
+ * // Import encryption types and utilities
24
+ * import type { EncryptionConfig, DriverContract } from '@adonisjs/core/encryption'
25
+ */
9
26
  export * from '@adonisjs/encryption';
@@ -1 +1,20 @@
1
+ /**
2
+ * Environment module re-exports all functionality from @adonisjs/env.
3
+ * This includes the Env class, validation schemas, and utilities for managing
4
+ * environment variables with type safety and validation.
5
+ *
6
+ * @example
7
+ * // Import the Env class and validation
8
+ * import { Env } from '@adonisjs/core/env'
9
+ *
10
+ * const env = await Env.create(new URL('../', import.meta.url), {
11
+ * NODE_ENV: Env.schema.enum(['development', 'production', 'test'] as const),
12
+ * PORT: Env.schema.number(),
13
+ * HOST: Env.schema.string({ format: 'host' })
14
+ * })
15
+ *
16
+ * @example
17
+ * // Import environment types and utilities
18
+ * import type { EnvParser, EnvEditor } from '@adonisjs/core/env'
19
+ */
1
20
  export * from '@adonisjs/env';
@@ -6,4 +6,23 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ /**
10
+ * Environment module re-exports all functionality from @adonisjs/env.
11
+ * This includes the Env class, validation schemas, and utilities for managing
12
+ * environment variables with type safety and validation.
13
+ *
14
+ * @example
15
+ * // Import the Env class and validation
16
+ * import { Env } from '@adonisjs/core/env'
17
+ *
18
+ * const env = await Env.create(new URL('../', import.meta.url), {
19
+ * NODE_ENV: Env.schema.enum(['development', 'production', 'test'] as const),
20
+ * PORT: Env.schema.number(),
21
+ * HOST: Env.schema.string({ format: 'host' })
22
+ * })
23
+ *
24
+ * @example
25
+ * // Import environment types and utilities
26
+ * import type { EnvParser, EnvEditor } from '@adonisjs/core/env'
27
+ */
9
28
  export * from '@adonisjs/env';
@@ -1 +1,12 @@
1
+ /**
2
+ * Bcrypt hash driver re-exports from @adonisjs/hash.
3
+ * Provides bcrypt password hashing functionality with configurable rounds.
4
+ *
5
+ * @example
6
+ * import { Bcrypt } from '@adonisjs/core/hash/drivers/bcrypt'
7
+ *
8
+ * const bcrypt = new Bcrypt({ rounds: 12 })
9
+ * const hashed = await bcrypt.make('password')
10
+ * const isValid = await bcrypt.verify(hashed, 'password')
11
+ */
1
12
  export * from '@adonisjs/hash/drivers/bcrypt';
@@ -6,4 +6,15 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ /**
10
+ * Bcrypt hash driver re-exports from @adonisjs/hash.
11
+ * Provides bcrypt password hashing functionality with configurable rounds.
12
+ *
13
+ * @example
14
+ * import { Bcrypt } from '@adonisjs/core/hash/drivers/bcrypt'
15
+ *
16
+ * const bcrypt = new Bcrypt({ rounds: 12 })
17
+ * const hashed = await bcrypt.make('password')
18
+ * const isValid = await bcrypt.verify(hashed, 'password')
19
+ */
9
20
  export * from '@adonisjs/hash/drivers/bcrypt';
@@ -1,2 +1,20 @@
1
+ /**
2
+ * Hash module provides password hashing functionality with multiple driver support.
3
+ * Re-exports all functionality from @adonisjs/hash along with configuration utilities.
4
+ *
5
+ * @example
6
+ * // Import the Hash manager and drivers
7
+ * import { HashManager, Hash } from '@adonisjs/core/hash'
8
+ *
9
+ * const manager = new HashManager(config)
10
+ * const hasher = manager.use('scrypt')
11
+ * const hashed = await hasher.make('password')
12
+ * const verified = await hasher.verify(hashed, 'password')
13
+ *
14
+ * @example
15
+ * // Import configuration and driver types
16
+ * import { defineConfig, drivers } from '@adonisjs/core/hash'
17
+ * import type { HashConfig, ScryptConfig } from '@adonisjs/core/types/hash'
18
+ */
1
19
  export * from '@adonisjs/hash';
2
20
  export { defineConfig, drivers } from './define_config.ts';
@@ -6,5 +6,23 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ /**
10
+ * Hash module provides password hashing functionality with multiple driver support.
11
+ * Re-exports all functionality from @adonisjs/hash along with configuration utilities.
12
+ *
13
+ * @example
14
+ * // Import the Hash manager and drivers
15
+ * import { HashManager, Hash } from '@adonisjs/core/hash'
16
+ *
17
+ * const manager = new HashManager(config)
18
+ * const hasher = manager.use('scrypt')
19
+ * const hashed = await hasher.make('password')
20
+ * const verified = await hasher.verify(hashed, 'password')
21
+ *
22
+ * @example
23
+ * // Import configuration and driver types
24
+ * import { defineConfig, drivers } from '@adonisjs/core/hash'
25
+ * import type { HashConfig, ScryptConfig } from '@adonisjs/core/types/hash'
26
+ */
9
27
  export * from '@adonisjs/hash';
10
28
  export { defineConfig, drivers } from "./define_config.js";
@@ -344,14 +344,7 @@ export default class AppServiceProvider {
344
344
  const router = await this.app.container.make('router');
345
345
  if (router.commited) {
346
346
  await this.generateRoutesTypes(router);
347
- process.once('message', (message) => {
348
- if (message &&
349
- typeof message === 'object' &&
350
- 'purpose' in message &&
351
- message.purpose === 'shareRoutes') {
352
- this.app.notify({ isAdonisJS: true, routes: router.toJSON() });
353
- }
354
- });
347
+ this.app.notify({ isAdonisJS: true, routes: JSON.stringify(router.toJSON()) });
355
348
  }
356
349
  }
357
350
  }
@@ -64,7 +64,9 @@ export class RoutesListFormatter {
64
64
  this.#router.commit();
65
65
  }
66
66
  /**
67
- * Test if a route clears the applied filters
67
+ * Test if a route clears the applied filters based on middleware, name, pattern, and handler.
68
+ *
69
+ * @param route - The serialized route to test against filters
68
70
  */
69
71
  #isAllowedByFilters(route) {
70
72
  let allowRoute = true;
@@ -124,7 +126,10 @@ export class RoutesListFormatter {
124
126
  return false;
125
127
  }
126
128
  /**
127
- * Serializes routes JSON to an object that can be used for pretty printing
129
+ * Serializes routes JSON to an object that can be used for pretty printing.
130
+ * Converts RouteJSON into a format suitable for display and filtering.
131
+ *
132
+ * @param route - The route JSON object to serialize
128
133
  */
129
134
  async #serializeRoute(route) {
130
135
  let methods = route.methods;
@@ -143,13 +148,17 @@ export class RoutesListFormatter {
143
148
  };
144
149
  }
145
150
  /**
146
- * Formats the route method for the ansi list and table
151
+ * Formats the route method for the ansi list and table with dim styling.
152
+ *
153
+ * @param method - The HTTP method to format (GET, POST, etc.)
147
154
  */
148
155
  #formatRouteMethod(method) {
149
156
  return this.#colors.dim(method);
150
157
  }
151
158
  /**
152
- * Formats route pattern for the ansi list and table
159
+ * Formats route pattern for the ansi list and table with colored parameters and route name.
160
+ *
161
+ * @param route - The serialized route containing pattern and name information
153
162
  */
154
163
  #formatRoutePattern(route) {
155
164
  const pattern = this.#router
@@ -170,7 +179,9 @@ export class RoutesListFormatter {
170
179
  return `${pattern === '/' ? pattern : `/${pattern}`}${route.name ? ` ${this.#colors.dim(`(${route.name})`)}` : ''} `;
171
180
  }
172
181
  /**
173
- * Formats controller name for the ansi list and table
182
+ * Formats controller name for the ansi list and table with cyan coloring.
183
+ *
184
+ * @param route - The serialized route containing handler information
174
185
  */
175
186
  #formatControllerName(route) {
176
187
  return route.handler.type === 'controller'
@@ -178,7 +189,9 @@ export class RoutesListFormatter {
178
189
  : '';
179
190
  }
180
191
  /**
181
- * Formats action name for the ansi list and table
192
+ * Formats action name for the ansi list and table with cyan coloring and arguments.
193
+ *
194
+ * @param route - The serialized route containing handler information
182
195
  */
183
196
  #formatAction(route) {
184
197
  if (route.handler.type === 'controller') {
@@ -191,7 +204,10 @@ export class RoutesListFormatter {
191
204
  return functionName;
192
205
  }
193
206
  /**
194
- * Formats route middleware for the ansi list and table
207
+ * Formats route middleware for the ansi list and table with optional compacting.
208
+ *
209
+ * @param route - The serialized route containing middleware information
210
+ * @param mode - Display mode: 'normal' shows all middleware, 'compact' truncates long lists
195
211
  */
196
212
  #formatMiddleware(route, mode = 'normal') {
197
213
  if (mode === 'compact' && route.middleware.length > 3) {
@@ -1 +1,20 @@
1
+ /**
2
+ * HTTP helper utilities re-exported from @adonisjs/http-server. This module
3
+ * provides a convenient entry point for accessing all HTTP-related utilities
4
+ * including route helpers, middleware utilities, and request/response helpers.
5
+ *
6
+ * @example
7
+ * // Import specific HTTP helpers
8
+ * import { middlewareInfo, routeInfo } from '@adonisjs/core/helpers'
9
+ *
10
+ * const middleware = middlewareInfo('cors', CorsMiddleware)
11
+ * const route = routeInfo('users.show', '/users/:id')
12
+ *
13
+ * @example
14
+ * // Access all HTTP helpers
15
+ * import * as httpHelpers from '@adonisjs/core/helpers/http'
16
+ *
17
+ * // Use any helper from the http-server package
18
+ * const routeData = httpHelpers.routeInfo('api.posts', '/api/posts')
19
+ */
1
20
  export * from '@adonisjs/http-server/helpers';
@@ -6,4 +6,23 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ /**
10
+ * HTTP helper utilities re-exported from @adonisjs/http-server. This module
11
+ * provides a convenient entry point for accessing all HTTP-related utilities
12
+ * including route helpers, middleware utilities, and request/response helpers.
13
+ *
14
+ * @example
15
+ * // Import specific HTTP helpers
16
+ * import { middlewareInfo, routeInfo } from '@adonisjs/core/helpers'
17
+ *
18
+ * const middleware = middlewareInfo('cors', CorsMiddleware)
19
+ * const route = routeInfo('users.show', '/users/:id')
20
+ *
21
+ * @example
22
+ * // Access all HTTP helpers
23
+ * import * as httpHelpers from '@adonisjs/core/helpers/http'
24
+ *
25
+ * // Use any helper from the http-server package
26
+ * const routeData = httpHelpers.routeInfo('api.posts', '/api/posts')
27
+ */
9
28
  export * from '@adonisjs/http-server/helpers';
@@ -43,9 +43,21 @@ const stringHelpers = {
43
43
  prettyHrTime(time, options) {
44
44
  return prettyHrTime(time, options);
45
45
  },
46
+ /**
47
+ * Check if a string is empty or contains only whitespace characters.
48
+ *
49
+ * @param value - The string to check for emptiness
50
+ */
46
51
  isEmpty(value) {
47
52
  return value.trim().length === 0;
48
53
  },
54
+ /**
55
+ * Escape HTML entities to prevent XSS attacks and display HTML safely.
56
+ *
57
+ * @param value - The string containing HTML to escape
58
+ * @param options - Optional configuration for escaping behavior
59
+ * @param options.encodeSymbols - Whether to also encode Unicode symbols as HTML entities
60
+ */
49
61
  escapeHTML(value, options) {
50
62
  value = he.escape(value);
51
63
  if (options && options.encodeSymbols) {
@@ -53,6 +65,12 @@ const stringHelpers = {
53
65
  }
54
66
  return value;
55
67
  },
68
+ /**
69
+ * Encode Unicode symbols and special characters as HTML entities.
70
+ *
71
+ * @param value - The string containing symbols to encode
72
+ * @param options - Encoding options from the 'he' library
73
+ */
56
74
  encodeSymbols(value, options) {
57
75
  return he.encode(value, options);
58
76
  },
@@ -32,7 +32,9 @@ export class HttpServerProcess {
32
32
  this.#ignitor = ignitor;
33
33
  }
34
34
  /**
35
- * Calling this method closes the underlying HTTP server
35
+ * Calling this method closes the underlying HTTP server gracefully.
36
+ *
37
+ * @param nodeHttpServer - The Node.js HTTP or HTTPS server instance to close
36
38
  */
37
39
  #close(nodeHttpServer) {
38
40
  return new Promise((resolve) => {
@@ -42,7 +44,11 @@ export class HttpServerProcess {
42
44
  }
43
45
  /**
44
46
  * Monitors the app and the server to close the HTTP server when
45
- * either one of them goes down
47
+ * either one of them goes down. Sets up event listeners for graceful shutdown.
48
+ *
49
+ * @param nodeHttpServer - The Node.js HTTP or HTTPS server instance to monitor
50
+ * @param app - The application service instance
51
+ * @param logger - The logger service for error reporting
46
52
  */
47
53
  #monitorAppAndServer(nodeHttpServer, app, logger) {
48
54
  /**
@@ -64,7 +70,9 @@ export class HttpServerProcess {
64
70
  });
65
71
  }
66
72
  /**
67
- * Starts the http server a given host and port
73
+ * Starts the HTTP server on a given host and port using environment variables.
74
+ *
75
+ * @param nodeHttpServer - The Node.js HTTP or HTTPS server instance to start listening
68
76
  */
69
77
  #listen(nodeHttpServer) {
70
78
  return new Promise((resolve, reject) => {
@@ -81,8 +89,13 @@ export class HttpServerProcess {
81
89
  });
82
90
  }
83
91
  /**
84
- * Notifies the app and the parent process that the
85
- * HTTP server is ready
92
+ * Notifies the app and the parent process that the HTTP server is ready.
93
+ * Sends notifications through multiple channels: parent process, logger, and event emitter.
94
+ *
95
+ * @param app - The application service instance for parent process notification
96
+ * @param logger - The logger service for console output
97
+ * @param emitter - The event emitter for app-level notifications
98
+ * @param payload - Server startup information including host, port, and duration
86
99
  */
87
100
  #notifyServerHasStarted(app, logger, emitter, payload) {
88
101
  /**
package/build/src/vine.js CHANGED
@@ -9,15 +9,21 @@
9
9
  import vine, { symbols, BaseLiteralType } from '@vinejs/vine';
10
10
  const MULTIPART_FILE = symbols.SUBTYPE ?? Symbol.for('subtype');
11
11
  /**
12
- * Checks if the value is an instance of multipart file
13
- * from bodyparser.
12
+ * Checks if the value is an instance of multipart file from bodyparser.
13
+ * Used internally for type guarding in file validation.
14
+ *
15
+ * @param file - The value to check for MultipartFile instance
14
16
  */
15
17
  function isBodyParserFile(file) {
16
18
  return !!(file && typeof file === 'object' && 'isMultipartFile' in file);
17
19
  }
18
20
  /**
19
- * VineJS validation rule that validates the file to be an
20
- * instance of BodyParser MultipartFile class.
21
+ * VineJS validation rule that validates the file to be an instance of BodyParser
22
+ * MultipartFile class and applies size/extension validation if configured.
23
+ *
24
+ * @param file - The file value to validate
25
+ * @param options - Validation options for file size and extensions
26
+ * @param field - The field context from VineJS validation
21
27
  */
22
28
  const isMultipartFile = vine.createRule((file, options, field) => {
23
29
  /**
@@ -26,7 +32,7 @@ const isMultipartFile = vine.createRule((file, options, field) => {
26
32
  */
27
33
  if (!isBodyParserFile(file)) {
28
34
  field.report('The {{ field }} must be a file', 'file', field);
29
- return;
35
+ return false;
30
36
  }
31
37
  const validationOptions = typeof options === 'function' ? options(field) : options;
32
38
  /**
@@ -53,6 +59,7 @@ const isMultipartFile = vine.createRule((file, options, field) => {
53
59
  file.errors.forEach((error) => {
54
60
  field.report(error.message, `file.${error.type}`, field, validationOptions);
55
61
  });
62
+ return file.isValid;
56
63
  });
57
64
  /**
58
65
  * Represents a multipart file uploaded via multipart/form-data HTTP
@@ -84,8 +91,9 @@ export class VineMultipartFile extends BaseLiteralType {
84
91
  * @param validations - Array of validation functions to apply
85
92
  */
86
93
  constructor(validationOptions, options, validations) {
87
- super(options, validations || [isMultipartFile(validationOptions || {})]);
94
+ super(options, validations || []);
88
95
  this.#validationOptions = validationOptions;
96
+ this.dataTypeValidator = isMultipartFile(validationOptions || {});
89
97
  }
90
98
  /**
91
99
  * Creates a clone of the current VineMultipartFile instance
@@ -1,2 +1,22 @@
1
+ /**
2
+ * Helper types and utilities for AdonisJS applications.
3
+ * Re-exports commonly used type utilities and file system operation types.
4
+ *
5
+ * @example
6
+ * // Use Opaque type for branded primitives
7
+ * import type { Opaque } from '@adonisjs/core/types/helpers'
8
+ *
9
+ * type UserId = Opaque<'UserId', number>
10
+ * const userId: UserId = 123 as UserId
11
+ *
12
+ * @example
13
+ * // Use file system option types
14
+ * import type { ImportAllFilesOptions } from '@adonisjs/core/types/helpers'
15
+ *
16
+ * const options: ImportAllFilesOptions = {
17
+ * ignoreMissingExports: true,
18
+ * transformKeys: (key) => key.toLowerCase()
19
+ * }
20
+ */
1
21
  export type { Opaque, NormalizeConstructor } from '@poppinss/utils/types';
2
22
  export type { ImportAllFilesOptions, ReadAllFilesOptions } from '@poppinss/utils/fs';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adonisjs/core",
3
3
  "description": "Core of AdonisJS",
4
- "version": "7.0.0-next.5",
4
+ "version": "7.0.0-next.6",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },
@@ -84,10 +84,10 @@
84
84
  "index:commands": "node --import=@poppinss/ts-exec toolkit/main.js index build/commands"
85
85
  },
86
86
  "devDependencies": {
87
- "@adonisjs/assembler": "^8.0.0-next.12",
88
- "@adonisjs/eslint-config": "^3.0.0-next.1",
87
+ "@adonisjs/assembler": "^8.0.0-next.14",
88
+ "@adonisjs/eslint-config": "^3.0.0-next.4",
89
89
  "@adonisjs/prettier-config": "^1.4.5",
90
- "@adonisjs/tsconfig": "^2.0.0-next.0",
90
+ "@adonisjs/tsconfig": "^2.0.0-next.2",
91
91
  "@japa/assert": "^4.1.1",
92
92
  "@japa/expect-type": "^2.0.3",
93
93
  "@japa/file-system": "^2.3.2",
@@ -95,12 +95,12 @@
95
95
  "@japa/snapshot": "^2.0.9",
96
96
  "@poppinss/ts-exec": "^1.4.1",
97
97
  "@release-it/conventional-changelog": "^10.0.1",
98
- "@types/node": "^24.7.0",
98
+ "@types/node": "^24.7.2",
99
99
  "@types/pretty-hrtime": "^1.0.3",
100
100
  "@types/sinon": "^17.0.4",
101
101
  "@types/supertest": "^6.0.3",
102
102
  "@types/test-console": "^2.0.3",
103
- "@vinejs/vine": "^3.0.1",
103
+ "@vinejs/vine": "^4.0.0-next.1",
104
104
  "argon2": "^0.44.0",
105
105
  "bcrypt": "^6.0.0",
106
106
  "c8": "^10.1.3",
@@ -117,12 +117,12 @@
117
117
  "supertest": "^7.1.4",
118
118
  "test-console": "^2.0.0",
119
119
  "timekeeper": "^2.3.1",
120
- "typedoc": "^0.28.13",
120
+ "typedoc": "^0.28.14",
121
121
  "typescript": "^5.9.3",
122
122
  "youch": "^4.1.0-beta.11"
123
123
  },
124
124
  "dependencies": {
125
- "@adonisjs/ace": "^14.0.1-next.1",
125
+ "@adonisjs/ace": "^14.0.1-next.2",
126
126
  "@adonisjs/application": "^9.0.0-next.9",
127
127
  "@adonisjs/bodyparser": "^11.0.0-next.1",
128
128
  "@adonisjs/config": "^6.0.0-next.1",
@@ -132,7 +132,7 @@
132
132
  "@adonisjs/fold": "^11.0.0-next.2",
133
133
  "@adonisjs/hash": "^10.0.0-next.1",
134
134
  "@adonisjs/health": "^3.0.0-next.0",
135
- "@adonisjs/http-server": "^8.0.0-next.10",
135
+ "@adonisjs/http-server": "^8.0.0-next.11",
136
136
  "@adonisjs/http-transformers": "^1.5.0",
137
137
  "@adonisjs/logger": "^7.1.0-next.0",
138
138
  "@adonisjs/repl": "^5.0.0-next.0",
@@ -149,7 +149,7 @@
149
149
  },
150
150
  "peerDependencies": {
151
151
  "@adonisjs/assembler": "^8.0.0-next.10",
152
- "@vinejs/vine": "^3.0.0",
152
+ "@vinejs/vine": "^4.0.0-next.0",
153
153
  "argon2": "^0.43.0",
154
154
  "bcrypt": "^6.0.0",
155
155
  "edge.js": "^6.2.0",