@adonisjs/core 7.0.1 → 7.1.1

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 (161) hide show
  1. package/build/ace-DBm6EcQ-.js +37 -0
  2. package/build/app-BCcG_oDd.js +7 -0
  3. package/build/app-CAuSGb2P.js +15 -0
  4. package/build/bodyparser_middleware-H5FArWkI.js +9 -0
  5. package/build/{chunk-iKc69rpz.js → chunk-Do49iUES.js} +3 -0
  6. package/build/commands/add.d.ts +1 -0
  7. package/build/commands/add.js +64 -10
  8. package/build/commands/build.js +41 -3
  9. package/build/commands/commands.json +1 -1
  10. package/build/commands/configure.js +70 -4
  11. package/build/commands/eject.js +30 -4
  12. package/build/commands/env/add.js +62 -4
  13. package/build/commands/generate_key.js +23 -3
  14. package/build/commands/inspect_rcfile.js +26 -2
  15. package/build/commands/list/routes.d.ts +5 -0
  16. package/build/commands/list/routes.js +242 -3
  17. package/build/commands/make/command.js +33 -4
  18. package/build/commands/make/controller.js +46 -4
  19. package/build/commands/make/event.js +36 -4
  20. package/build/commands/make/exception.js +36 -4
  21. package/build/commands/make/listener.js +44 -4
  22. package/build/commands/make/middleware.js +53 -5
  23. package/build/commands/make/preload.js +55 -5
  24. package/build/commands/make/provider.js +54 -5
  25. package/build/commands/make/service.js +29 -4
  26. package/build/commands/make/test.js +63 -4
  27. package/build/commands/make/transformer.js +37 -4
  28. package/build/commands/make/validator.js +44 -4
  29. package/build/commands/make/view.js +33 -4
  30. package/build/commands/repl.js +31 -2
  31. package/build/commands/serve.js +54 -4
  32. package/build/commands/test.js +69 -4
  33. package/build/config-Coti2q6R.js +7 -0
  34. package/build/config_provider-Do9af1ze.js +35 -0
  35. package/build/container-CGfEwWof.js +7 -0
  36. package/build/{core-IpCOCkUL.js → core-aRg0soJX.js} +52 -3
  37. package/build/create_kernel-BV3swyCg.js +4 -0
  38. package/build/{create_kernel-B7ILNhuP.js → create_kernel-D38-0Zbt.js} +41 -1
  39. package/build/debug-DWofTfIX.js +20 -0
  40. package/build/{decorate-DmrZA614.js → decorate-B9Uz0anB.js} +2 -0
  41. package/build/{define_config-0oHaj43l.js → define_config--5euEdi8.js} +54 -3
  42. package/build/dumper-3R77st8F.js +353 -0
  43. package/build/edge-BG5ZYp6Z.js +57 -0
  44. package/build/{errors-CrCO-k44.js → errors-BScZTzBu.js} +9 -1
  45. package/build/events-DlKX1ZdL.js +7 -0
  46. package/build/exceptions-B2MzIlHY.js +2 -0
  47. package/build/factories/app.js +1 -0
  48. package/build/factories/bodyparser.js +1 -0
  49. package/build/factories/core/ace.js +16 -22
  50. package/build/factories/core/ignitor.js +13 -73
  51. package/build/factories/core/main.js +25 -17
  52. package/build/factories/core/test_utils.js +22 -19
  53. package/build/factories/encryption.js +1 -0
  54. package/build/factories/events.js +1 -0
  55. package/build/factories/hash.js +1 -0
  56. package/build/factories/http.js +1 -0
  57. package/build/factories/logger.js +1 -0
  58. package/build/factories/stubs.js +75 -7
  59. package/build/ignitor-Kym3gR-I.js +169 -0
  60. package/build/index.js +11 -8
  61. package/build/logger-DIdZPHCe.js +43 -0
  62. package/build/main-B50zECAi.js +121 -0
  63. package/build/main-CRnMnrH7.js +184 -0
  64. package/build/{main-kn40V-hF.js → main-CfTiGsiS.js} +2 -0
  65. package/build/main-Ck0GqLx4.js +117 -0
  66. package/build/main-CoZI4Ezs.js +2 -0
  67. package/build/main-D1MSq4Uu.js +435 -0
  68. package/build/{main--nXd7T-C.js → main-bRYXIHgD.js} +75 -3
  69. package/build/main-zxNP7iRl.js +7 -0
  70. package/build/modules/ace/codemods.js +301 -2
  71. package/build/modules/ace/commands.d.ts +5 -0
  72. package/build/modules/ace/main.js +2 -1
  73. package/build/modules/app.js +3 -5
  74. package/build/modules/bodyparser/bodyparser_middleware.js +2 -2
  75. package/build/modules/bodyparser/main.js +3 -5
  76. package/build/modules/config.js +3 -5
  77. package/build/modules/container.js +3 -5
  78. package/build/modules/dumper/main.js +29 -2
  79. package/build/modules/dumper/plugins/edge.js +2 -46
  80. package/build/modules/encryption/drivers/aes_256_cbc.js +1 -0
  81. package/build/modules/encryption/drivers/aes_256_gcm.js +1 -0
  82. package/build/modules/encryption/drivers/aes_siv.js +1 -0
  83. package/build/modules/encryption/drivers/chacha20_poly1305.js +1 -0
  84. package/build/modules/encryption/drivers/legacy.js +46 -1
  85. package/build/modules/encryption/main.js +7 -5
  86. package/build/modules/env/editor.js +1 -0
  87. package/build/modules/env/main.js +1 -0
  88. package/build/modules/events.js +3 -5
  89. package/build/modules/hash/drivers/argon.js +1 -0
  90. package/build/modules/hash/drivers/bcrypt.js +1 -0
  91. package/build/modules/hash/drivers/scrypt.js +1 -0
  92. package/build/modules/hash/main.js +4 -4
  93. package/build/modules/hash/phc_formatter.js +1 -0
  94. package/build/modules/health.js +1 -0
  95. package/build/modules/http/helpers.js +1 -0
  96. package/build/modules/http/main.js +2 -2
  97. package/build/modules/http/url_builder_client.js +1 -0
  98. package/build/modules/logger.js +3 -13
  99. package/build/modules/repl.js +3 -5
  100. package/build/modules/transformers/main.js +1 -0
  101. package/build/providers/app_provider.js +214 -15
  102. package/build/providers/edge_provider.js +90 -3
  103. package/build/providers/hash_provider.js +59 -4
  104. package/build/providers/repl_provider.js +64 -2
  105. package/build/providers/vinejs_provider.js +44 -3
  106. package/build/repl-C02Re0Yd.js +7 -0
  107. package/build/services/ace.js +11 -1
  108. package/build/services/app.js +2 -4
  109. package/build/services/config.js +7 -1
  110. package/build/services/dumper.js +13 -1
  111. package/build/services/emitter.js +8 -1
  112. package/build/services/encryption.js +8 -1
  113. package/build/services/hash.js +8 -1
  114. package/build/services/logger.js +8 -1
  115. package/build/services/repl.js +8 -1
  116. package/build/services/router.js +8 -1
  117. package/build/services/server.js +8 -1
  118. package/build/services/test_utils.js +11 -1
  119. package/build/services/url_builder.js +8 -1
  120. package/build/src/cli_formatters/routes_list.d.ts +7 -0
  121. package/build/src/exceptions.js +2 -1
  122. package/build/src/helpers/assert.js +1 -0
  123. package/build/src/helpers/http.js +1 -0
  124. package/build/src/helpers/is.js +24 -0
  125. package/build/src/helpers/main.js +2 -1
  126. package/build/src/helpers/string.js +2 -27
  127. package/build/src/helpers/types.js +18 -0
  128. package/build/src/helpers/verification_token.js +2 -45
  129. package/build/src/test_utils/main.js +9 -7
  130. package/build/src/types.js +1 -0
  131. package/build/src/vine.js +2 -32
  132. package/build/string-8_8He-HH.js +46 -0
  133. package/build/test_utils-DbJS_uEu.js +32 -0
  134. package/build/toolkit/main.js +13 -1
  135. package/build/types/ace.js +1 -0
  136. package/build/types/app.js +1 -0
  137. package/build/types/bodyparser.js +1 -0
  138. package/build/types/common.js +1 -0
  139. package/build/types/container.js +1 -0
  140. package/build/types/encryption.js +1 -0
  141. package/build/types/events.js +1 -0
  142. package/build/types/hash.js +1 -0
  143. package/build/types/health.js +1 -0
  144. package/build/types/helpers.js +1 -0
  145. package/build/types/http.js +1 -0
  146. package/build/types/logger.js +1 -0
  147. package/build/types/repl.js +1 -0
  148. package/build/types/transformers.js +1 -0
  149. package/build/utils-CKwka7OL.js +105 -0
  150. package/build/verification_token-WCrZtUgZ.js +108 -0
  151. package/build/vine-DkIupA3Z.js +97 -0
  152. package/package.json +12 -12
  153. package/build/config_provider-FIAUgvae.js +0 -13
  154. package/build/create_kernel-BD0Iqi8e.js +0 -3
  155. package/build/debug-CGQmxzGt.js +0 -3
  156. package/build/dumper-BBgqFX5a.js +0 -147
  157. package/build/main-Cxz0TyIw.js +0 -173
  158. package/build/main-DN2qEEg5.js +0 -41
  159. package/build/main-DkNgvceD.js +0 -52
  160. package/build/main-MBAMnmJb.js +0 -81
  161. package/build/utils-rRkbAPnP.js +0 -42
@@ -1,20 +1,66 @@
1
- import { t as debug_default } from "../../debug-CGQmxzGt.js";
2
- import stringHelpers from "../../src/helpers/string.js";
1
+ import "../../chunk-Do49iUES.js";
2
+ import { t as debug_default } from "../../debug-DWofTfIX.js";
3
+ import { t as stringHelpers } from "../../string-8_8He-HH.js";
3
4
  import { EnvEditor } from "@adonisjs/env/editor";
4
5
  import { isAbsolute } from "node:path";
5
6
  import { readFile } from "node:fs/promises";
6
7
  import { EventEmitter } from "node:events";
8
+ //#region modules/ace/codemods.ts
9
+ /**
10
+ * Codemods class for programmatically modifying AdonisJS source files.
11
+ * This class provides APIs to modify configuration files, register middleware,
12
+ * generate stubs, and install packages.
13
+ *
14
+ * The codemod APIs rely on the "@adonisjs/assembler" package, which must be
15
+ * installed as a dependency in the user application.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const codemods = new Codemods(app, logger)
20
+ *
21
+ * // Generate a controller from a stub
22
+ * await codemods.makeUsingStub(stubsRoot, 'controller.stub', {
23
+ * filename: 'UserController',
24
+ * entity: { name: 'User' }
25
+ * })
26
+ *
27
+ * // Install packages
28
+ * await codemods.installPackages([
29
+ * { name: '@adonisjs/lucid', isDevDependency: false }
30
+ * ])
31
+ * ```
32
+ */
7
33
  var Codemods = class extends EventEmitter {
34
+ /**
35
+ * Reference to lazily imported assembler code transformer
36
+ */
8
37
  #codeTransformer;
38
+ /**
39
+ * Reference to AdonisJS application
40
+ */
9
41
  #app;
42
+ /**
43
+ * Reference to CLI logger to write logs
44
+ */
10
45
  #cliLogger;
46
+ /**
47
+ * Overwrite existing files when generating files
48
+ * from stubs
49
+ */
11
50
  overwriteExisting = false;
51
+ /**
52
+ * Display verbose logs for package installation
53
+ */
12
54
  verboseInstallOutput = false;
13
55
  constructor(app, cliLogger) {
14
56
  super();
15
57
  this.#app = app;
16
58
  this.#cliLogger = cliLogger;
17
59
  }
60
+ /**
61
+ * - Lazily import the code transformer
62
+ * - Return a fresh or reused instance of the code transformer
63
+ */
18
64
  async #getCodeTransformer() {
19
65
  try {
20
66
  if (!this.#codeTransformer) {
@@ -26,6 +72,10 @@ var Codemods = class extends EventEmitter {
26
72
  return null;
27
73
  }
28
74
  }
75
+ /**
76
+ * Returns the installation command for different
77
+ * package managers
78
+ */
29
79
  #getInstallationCommands(packages, packageManager, isDev) {
30
80
  if (!packages.length) return "";
31
81
  const colors = this.#cliLogger.getColors();
@@ -37,6 +87,24 @@ var Codemods = class extends EventEmitter {
37
87
  default: return `${colors.yellow(`npm i${devFlag}`)} ${packages.join(" ")}`;
38
88
  }
39
89
  }
90
+ /**
91
+ * Define one or more environment variables in the .env file
92
+ *
93
+ * @param environmentVariables - Key-value pairs of environment variables
94
+ * @param options - Configuration options
95
+ * @param options.omitFromExample - Keys to exclude from .env.example file
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * await codemods.defineEnvVariables({
100
+ * DB_CONNECTION: 'mysql',
101
+ * DB_HOST: 'localhost',
102
+ * SECRET_KEY: 'abc123'
103
+ * }, {
104
+ * omitFromExample: ['SECRET_KEY']
105
+ * })
106
+ * ```
107
+ */
40
108
  async defineEnvVariables(environmentVariables, options) {
41
109
  const editor = new EnvEditor(this.#app.appRoot);
42
110
  await editor.load();
@@ -47,6 +115,19 @@ var Codemods = class extends EventEmitter {
47
115
  await editor.save();
48
116
  this.#cliLogger.action("update .env file").succeeded();
49
117
  }
118
+ /**
119
+ * Returns the TsMorph project instance for advanced AST manipulations.
120
+ * See https://ts-morph.com/ for documentation.
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * const project = await codemods.getTsMorphProject()
125
+ * if (project) {
126
+ * const sourceFile = project.getSourceFile('app/controllers/user_controller.ts')
127
+ * // Perform advanced AST operations
128
+ * }
129
+ * ```
130
+ */
50
131
  async getTsMorphProject() {
51
132
  const transformer = await this.#getCodeTransformer();
52
133
  if (!transformer) {
@@ -55,6 +136,21 @@ var Codemods = class extends EventEmitter {
55
136
  }
56
137
  return transformer.project;
57
138
  }
139
+ /**
140
+ * Define validations for the environment variables in the start/env.ts file.
141
+ * This method updates the environment validation schema using the assembler.
142
+ *
143
+ * @param validations - Validation schema node for environment variables
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * await codemods.defineEnvValidations({
148
+ * NODE_ENV: 'Env.schema.enum(["development", "production", "test"] as const)',
149
+ * PORT: 'Env.schema.number()',
150
+ * HOST: 'Env.schema.string({ format: "host" })'
151
+ * })
152
+ * ```
153
+ */
58
154
  async defineEnvValidations(validations) {
59
155
  const transformer = await this.#getCodeTransformer();
60
156
  if (!transformer) {
@@ -70,6 +166,23 @@ var Codemods = class extends EventEmitter {
70
166
  action.failed(error.message);
71
167
  }
72
168
  }
169
+ /**
170
+ * Register middleware in the start/kernel.ts file.
171
+ * This method adds middleware to the specified stack (server, router, or named).
172
+ *
173
+ * @param stack - The middleware stack to register to ('server' | 'router' | 'named')
174
+ * @param middleware - Array of middleware nodes to register
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * await codemods.registerMiddleware('server', [
179
+ * {
180
+ * name: 'cors',
181
+ * path: '@adonisjs/cors/cors_middleware'
182
+ * }
183
+ * ])
184
+ * ```
185
+ */
73
186
  async registerMiddleware(stack, middleware) {
74
187
  const transformer = await this.#getCodeTransformer();
75
188
  if (!transformer) {
@@ -85,6 +198,23 @@ var Codemods = class extends EventEmitter {
85
198
  action.failed(error.message);
86
199
  }
87
200
  }
201
+ /**
202
+ * Register bouncer policies to the list of policies collection exported from
203
+ * the "app/policies/main.ts" file. This method adds new policy definitions
204
+ * to the policies export.
205
+ *
206
+ * @param policies - Array of policy nodes to register
207
+ *
208
+ * @example
209
+ * ```ts
210
+ * await codemods.registerPolicies([
211
+ * {
212
+ * name: 'UserPolicy',
213
+ * path: '#policies/user_policy'
214
+ * }
215
+ * ])
216
+ * ```
217
+ */
88
218
  async registerPolicies(policies) {
89
219
  const transformer = await this.#getCodeTransformer();
90
220
  if (!transformer) {
@@ -100,6 +230,20 @@ var Codemods = class extends EventEmitter {
100
230
  action.failed(error.message);
101
231
  }
102
232
  }
233
+ /**
234
+ * Update the adonisrc.ts file with new configuration settings.
235
+ * This method allows modification of the AdonisJS runtime configuration.
236
+ *
237
+ * @param params - Parameters for updating the RC file (varies based on update type)
238
+ *
239
+ * @example
240
+ * ```ts
241
+ * await codemods.updateRcFile((rcFile) => {
242
+ * rcFile.addCommand('make:custom')
243
+ * rcFile.addPreloadFile('#app/events/main')
244
+ * })
245
+ * ```
246
+ */
103
247
  async updateRcFile(...params) {
104
248
  const transformer = await this.#getCodeTransformer();
105
249
  if (!transformer) {
@@ -115,6 +259,21 @@ var Codemods = class extends EventEmitter {
115
259
  action.failed(error.message);
116
260
  }
117
261
  }
262
+ /**
263
+ * Register a new Vite plugin in the vite.config.ts file.
264
+ * This method adds plugin configuration to the Vite build configuration.
265
+ *
266
+ * @param params - Parameters for adding the Vite plugin (varies based on plugin type)
267
+ *
268
+ * @example
269
+ * ```ts
270
+ * await codemods.registerVitePlugin({
271
+ * name: 'vue',
272
+ * import: 'import vue from "@vitejs/plugin-vue"',
273
+ * options: '()'
274
+ * })
275
+ * ```
276
+ */
118
277
  async registerVitePlugin(...params) {
119
278
  const transformer = await this.#getCodeTransformer();
120
279
  if (!transformer) {
@@ -130,6 +289,20 @@ var Codemods = class extends EventEmitter {
130
289
  action.failed(error.message);
131
290
  }
132
291
  }
292
+ /**
293
+ * Register a new Japa plugin in the tests/bootstrap.ts file.
294
+ * This method adds plugin configuration to the test runner setup.
295
+ *
296
+ * @param params - Parameters for adding the Japa plugin (varies based on plugin type)
297
+ *
298
+ * @example
299
+ * ```ts
300
+ * await codemods.registerJapaPlugin({
301
+ * name: 'expect',
302
+ * import: 'import { expect } from "@japa/expect"'
303
+ * })
304
+ * ```
305
+ */
133
306
  async registerJapaPlugin(...params) {
134
307
  const transformer = await this.#getCodeTransformer();
135
308
  if (!transformer) {
@@ -145,6 +318,21 @@ var Codemods = class extends EventEmitter {
145
318
  action.failed(error.message);
146
319
  }
147
320
  }
321
+ /**
322
+ * Add a new validator file to the validators directory.
323
+ * This method creates a new validator file with the provided definition.
324
+ *
325
+ * @param params - Parameters for adding the validator
326
+ *
327
+ * @example
328
+ * ```ts
329
+ * await codemods.addValidator({
330
+ * validatorFileName: 'create_user',
331
+ * exportName: 'createUserValidator',
332
+ * contents: 'export const createUserValidator = vine.compile(...)'
333
+ * })
334
+ * ```
335
+ */
148
336
  async addValidator(...params) {
149
337
  const transformer = await this.#getCodeTransformer();
150
338
  if (!transformer) {
@@ -160,6 +348,21 @@ var Codemods = class extends EventEmitter {
160
348
  action.failed(error.message);
161
349
  }
162
350
  }
351
+ /**
352
+ * Add a new rate limiter file to the limiters directory.
353
+ * This method creates a new limiter file with the provided definition.
354
+ *
355
+ * @param params - Parameters for adding the limiter
356
+ *
357
+ * @example
358
+ * ```ts
359
+ * await codemods.addLimiter({
360
+ * limiterFileName: 'api_throttle',
361
+ * exportName: 'apiThrottleLimiter',
362
+ * contents: 'export const apiThrottleLimiter = limiter.define(...)'
363
+ * })
364
+ * ```
365
+ */
163
366
  async addLimiter(...params) {
164
367
  const transformer = await this.#getCodeTransformer();
165
368
  if (!transformer) {
@@ -175,6 +378,23 @@ var Codemods = class extends EventEmitter {
175
378
  action.failed(error.message);
176
379
  }
177
380
  }
381
+ /**
382
+ * Add mixins to a model class.
383
+ * This method adds mixin calls to the specified model file.
384
+ *
385
+ * @param params - Parameters for adding model mixins (modelFileName, mixins array)
386
+ *
387
+ * @example
388
+ * ```ts
389
+ * await codemods.addModelMixins('user', [
390
+ * {
391
+ * name: 'SoftDeletes',
392
+ * importPath: '@adonisjs/lucid/mixins/soft_deletes',
393
+ * importType: 'named'
394
+ * }
395
+ * ])
396
+ * ```
397
+ */
178
398
  async addModelMixins(...params) {
179
399
  const transformer = await this.#getCodeTransformer();
180
400
  if (!transformer) {
@@ -190,6 +410,25 @@ var Codemods = class extends EventEmitter {
190
410
  action.failed(error.message);
191
411
  }
192
412
  }
413
+ /**
414
+ * Add a new method to an existing controller class.
415
+ * This method injects a new method into the specified controller file.
416
+ *
417
+ * @param params - Parameters for adding the controller method
418
+ *
419
+ * @example
420
+ * ```ts
421
+ * await codemods.addControllerMethod({
422
+ * controllerFileName: 'users_controller',
423
+ * className: 'UsersController',
424
+ * name: 'destroy',
425
+ * contents: 'async destroy({ params, response }: HttpContext) { ... }',
426
+ * imports: [
427
+ * { isType: false, isNamed: true, name: 'HttpContext', path: '@adonisjs/core/http' }
428
+ * ]
429
+ * })
430
+ * ```
431
+ */
193
432
  async addControllerMethod(...params) {
194
433
  const transformer = await this.#getCodeTransformer();
195
434
  if (!transformer) {
@@ -205,8 +444,32 @@ var Codemods = class extends EventEmitter {
205
444
  action.failed(error.message);
206
445
  }
207
446
  }
447
+ /**
448
+ * Generate a file using a stub template
449
+ *
450
+ * @param stubsRoot - Root directory containing stub files
451
+ * @param stubPath - Path to the specific stub file
452
+ * @param stubState - Template variables for stub generation
453
+ *
454
+ * @example
455
+ * ```ts
456
+ * const result = await codemods.makeUsingStub(
457
+ * './stubs',
458
+ * 'controller.stub',
459
+ * {
460
+ * filename: 'UserController',
461
+ * entity: { name: 'User', modelName: 'User' },
462
+ * resourceful: true
463
+ * }
464
+ * )
465
+ * ```
466
+ */
208
467
  async makeUsingStub(stubsRoot, stubPath, stubState, options) {
209
468
  const stub = await (await this.#app.stubs.create()).build(stubPath, { source: stubsRoot });
469
+ /**
470
+ * Overwrite the contents of the stub output with the contents
471
+ * of the provided file.
472
+ */
210
473
  if (options?.contentsFromFile) {
211
474
  const source = isAbsolute(options.contentsFromFile) ? options.contentsFromFile : this.#app.makePath(options.contentsFromFile);
212
475
  try {
@@ -234,6 +497,22 @@ var Codemods = class extends EventEmitter {
234
497
  this.#cliLogger.action(`create ${entityFileName}`).succeeded();
235
498
  return result;
236
499
  }
500
+ /**
501
+ * Install packages using the detected or specified package manager.
502
+ * Automatically detects npm, yarn, or pnpm and installs dependencies accordingly.
503
+ * You can specify version of each package by setting it in the name like '@adonisjs/lucid'.
504
+ *
505
+ * @param packages - Array of packages with their dependency type
506
+ * @param packageManager - Optional package manager to use (auto-detected if not provided)
507
+ *
508
+ * @example
509
+ * ```ts
510
+ * const success = await codemods.installPackages([
511
+ * { name: '@adonisjs/lucid', isDevDependency: false },
512
+ * { name: '@types/node', isDevDependency: true }
513
+ * ])
514
+ * ```
515
+ */
237
516
  async installPackages(packages, packageManager) {
238
517
  const transformer = await this.#getCodeTransformer();
239
518
  const appPath = this.#app.makePath();
@@ -277,6 +556,25 @@ var Codemods = class extends EventEmitter {
277
556
  return false;
278
557
  }
279
558
  }
559
+ /**
560
+ * List the packages that should be installed manually.
561
+ * This method displays installation commands for different package managers
562
+ * when automatic installation is not available or desired.
563
+ *
564
+ * @param packages - Array of packages with their dependency type
565
+ *
566
+ * @example
567
+ * ```ts
568
+ * await codemods.listPackagesToInstall([
569
+ * { name: '@adonisjs/lucid', isDevDependency: false },
570
+ * { name: '@types/node', isDevDependency: true }
571
+ * ])
572
+ * // Output:
573
+ * // Please install following packages
574
+ * // npm i -D @types/node
575
+ * // npm i @adonisjs/lucid
576
+ * ```
577
+ */
280
578
  async listPackagesToInstall(packages) {
281
579
  const appPath = this.#app.makePath();
282
580
  const devDependencies = packages.filter((pkg) => pkg.isDevDependency).map(({ name }) => name);
@@ -289,4 +587,5 @@ var Codemods = class extends EventEmitter {
289
587
  this.#cliLogger.log(this.#getInstallationCommands(dependencies, packageManager || "npm", false));
290
588
  }
291
589
  };
590
+ //#endregion
292
591
  export { Codemods };
@@ -94,6 +94,11 @@ export declare class ListCommand extends AceListCommand implements BaseCommand {
94
94
  get staysAlive(): boolean | undefined;
95
95
  get startApp(): boolean | undefined;
96
96
  constructor(app: ApplicationService, kernel: Kernel, parsed: ParsedOutput, ui: UIPrimitives, prompt: Kernel['prompt']);
97
+ /**
98
+ * Auto-select JSON output when running inside an AI agent
99
+ * and no explicit format flag is provided.
100
+ */
101
+ run(): Promise<void>;
97
102
  /**
98
103
  * Creates the codemods module to modify source files programmatically.
99
104
  * This method provides access to AST-based code transformations.
@@ -1,2 +1,3 @@
1
- import { a as Parser, c as errors, d as Kernel, f as BaseCommand, i as ListLoader, l as flags, n as HelpCommand, o as args, p as ListCommand, r as IndexGenerator, s as cliHelpers, t as FsLoader, u as tracingChannels } from "../../main-MBAMnmJb.js";
1
+ import "../../chunk-Do49iUES.js";
2
+ import { a as Parser, c as errors, d as Kernel, f as BaseCommand, i as ListLoader, l as flags, n as HelpCommand, o as args, p as ListCommand, r as IndexGenerator, s as cliHelpers, t as FsLoader, u as tracingChannels } from "../../main-CRnMnrH7.js";
2
3
  export { BaseCommand, FsLoader, HelpCommand, IndexGenerator, Kernel, ListCommand, ListLoader, Parser, args, cliHelpers, errors, flags, tracingChannels };
@@ -1,6 +1,4 @@
1
- import { n as __reExport, t as __exportAll } from "../chunk-iKc69rpz.js";
1
+ import "../chunk-Do49iUES.js";
2
+ import "../app-BCcG_oDd.js";
2
3
  export * from "@adonisjs/application";
3
- var app_exports = /* @__PURE__ */ __exportAll({});
4
- import * as import__adonisjs_application from "@adonisjs/application";
5
- __reExport(app_exports, import__adonisjs_application);
6
- export { app_exports as t };
4
+ export {};
@@ -1,3 +1,3 @@
1
- import { BodyParserMiddleware } from "@adonisjs/bodyparser/bodyparser_middleware";
2
- var bodyparser_middleware_default = BodyParserMiddleware;
1
+ import "../../chunk-Do49iUES.js";
2
+ import { t as bodyparser_middleware_default } from "../../bodyparser_middleware-H5FArWkI.js";
3
3
  export { bodyparser_middleware_default as default };
@@ -1,6 +1,4 @@
1
- import { n as __reExport, t as __exportAll } from "../../chunk-iKc69rpz.js";
1
+ import "../../chunk-Do49iUES.js";
2
+ import "../../main-zxNP7iRl.js";
2
3
  export * from "@adonisjs/bodyparser";
3
- var main_exports = /* @__PURE__ */ __exportAll({});
4
- import * as import__adonisjs_bodyparser from "@adonisjs/bodyparser";
5
- __reExport(main_exports, import__adonisjs_bodyparser);
6
- export { main_exports as t };
4
+ export {};
@@ -1,6 +1,4 @@
1
- import { n as __reExport, t as __exportAll } from "../chunk-iKc69rpz.js";
1
+ import "../chunk-Do49iUES.js";
2
+ import "../config-Coti2q6R.js";
2
3
  export * from "@adonisjs/config";
3
- var config_exports = /* @__PURE__ */ __exportAll({});
4
- import * as import__adonisjs_config from "@adonisjs/config";
5
- __reExport(config_exports, import__adonisjs_config);
6
- export { config_exports as t };
4
+ export {};
@@ -1,6 +1,4 @@
1
- import { n as __reExport, t as __exportAll } from "../chunk-iKc69rpz.js";
1
+ import "../chunk-Do49iUES.js";
2
+ import "../container-CGfEwWof.js";
2
3
  export * from "@adonisjs/fold";
3
- var container_exports = /* @__PURE__ */ __exportAll({});
4
- import * as import__adonisjs_fold from "@adonisjs/fold";
5
- __reExport(container_exports, import__adonisjs_fold);
6
- export { container_exports as t };
4
+ export {};
@@ -1,6 +1,33 @@
1
- import "../../chunk-iKc69rpz.js";
2
- import { n as errors_exports, t as Dumper } from "../../dumper-BBgqFX5a.js";
1
+ import "../../chunk-Do49iUES.js";
2
+ import { n as errors_exports, t as Dumper } from "../../dumper-3R77st8F.js";
3
+ //#region modules/dumper/define_config.ts
4
+ /**
5
+ * Define configuration for the dumper service exported by the
6
+ * "@adonisjs/core/services/dumper" module. This function allows
7
+ * you to customize HTML and console output formatting options.
8
+ *
9
+ * @param dumperConfig - Configuration object with HTML and console options
10
+ * @param dumperConfig.html - HTML output formatting configuration
11
+ * @param dumperConfig.console - Console output formatting configuration
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * export default defineConfig({
16
+ * html: {
17
+ * showHidden: true,
18
+ * depth: 5,
19
+ * colors: true
20
+ * },
21
+ * console: {
22
+ * showHidden: false,
23
+ * depth: 3,
24
+ * collapse: ['Date', 'DateTime']
25
+ * }
26
+ * })
27
+ * ```
28
+ */
3
29
  function defineConfig(dumperConfig) {
4
30
  return dumperConfig;
5
31
  }
32
+ //#endregion
6
33
  export { Dumper, defineConfig, errors_exports as errors };
@@ -1,47 +1,3 @@
1
- import { Template } from "edge.js";
2
- function pluginEdgeDumper(dumper) {
3
- Template.macro("dumper", dumper);
4
- return (edge) => {
5
- edge.registerTag({
6
- tagName: "dump",
7
- block: false,
8
- seekable: true,
9
- noNewLine: true,
10
- compile(parser, buffer, token) {
11
- const parsed = parser.utils.transformAst(parser.utils.generateAST(token.properties.jsArg, token.loc, token.filename), token.filename, parser);
12
- buffer.writeExpression(`template.stacks.pushOnceTo('dumper', 'dumper_globals', template.dumper.getHeadElements(state.cspNonce))`, token.filename, token.loc.start.line);
13
- buffer.outputExpression(`template.dumper.dumpToHtml(${parser.utils.stringify(parsed)}, { cspNonce: state.cspNonce, source: { location: $filename, line: $lineNumber } })`, token.filename, token.loc.start.line, true);
14
- }
15
- });
16
- edge.registerTag({
17
- tagName: "dd",
18
- block: false,
19
- seekable: true,
20
- noNewLine: true,
21
- compile(parser, buffer, token) {
22
- const parsed = parser.utils.transformAst(parser.utils.generateAST(token.properties.jsArg, token.loc, token.filename), token.filename, parser);
23
- const ddStatement = [
24
- "try {",
25
- ` template.dumper.dd(${parser.utils.stringify(parsed)})`,
26
- "} catch (error) {",
27
- ` if (error.code === 'E_DUMP_DIE_EXCEPTION') {`,
28
- " const edgeError = template.createError(error.message, $filename, $lineNumber)",
29
- " error.fileName = $filename",
30
- " error.lineNumber = $lineNumber",
31
- " edgeError.handle = function (_, ctx) {",
32
- " return error.handle(error, ctx)",
33
- " }",
34
- " edgeError.report = function () {",
35
- " return error.report(error)",
36
- " }",
37
- " throw edgeError",
38
- " }",
39
- " throw error",
40
- "}"
41
- ].join("\n");
42
- buffer.writeStatement(ddStatement, token.filename, token.loc.start.line);
43
- }
44
- });
45
- };
46
- }
1
+ import "../../../chunk-Do49iUES.js";
2
+ import { t as pluginEdgeDumper } from "../../../edge-BG5ZYp6Z.js";
47
3
  export { pluginEdgeDumper };
@@ -1,2 +1,3 @@
1
+ import "../../../chunk-Do49iUES.js";
1
2
  import { AES256CBC } from "@boringnode/encryption/drivers/aes_256_cbc";
2
3
  export { AES256CBC };
@@ -1,2 +1,3 @@
1
+ import "../../../chunk-Do49iUES.js";
1
2
  import { AES256GCM } from "@boringnode/encryption/drivers/aes_256_gcm";
2
3
  export { AES256GCM };
@@ -1,2 +1,3 @@
1
+ import "../../../chunk-Do49iUES.js";
1
2
  import { AESSIV } from "@boringnode/encryption/drivers/aes_siv";
2
3
  export { AESSIV };
@@ -1,2 +1,3 @@
1
+ import "../../../chunk-Do49iUES.js";
1
2
  import { ChaCha20Poly1305 } from "@boringnode/encryption/drivers/chacha20_poly1305";
2
3
  export { ChaCha20Poly1305 };
@@ -1,16 +1,51 @@
1
- import { t as E_BLIND_INDEX_NOT_SUPPORTED } from "../../../errors-CrCO-k44.js";
1
+ import "../../../chunk-Do49iUES.js";
2
+ import "../../../exceptions-B2MzIlHY.js";
3
+ import { t as E_BLIND_INDEX_NOT_SUPPORTED } from "../../../errors-BScZTzBu.js";
2
4
  import { BaseDriver, Hmac, base64UrlDecode, base64UrlEncode, errors } from "@boringnode/encryption";
3
5
  import { MessageBuilder } from "@poppinss/utils";
4
6
  import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
7
+ //#region modules/encryption/drivers/legacy.ts
8
+ /**
9
+ * Factory function to create a Legacy encryption configuration.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * drivers.legacy({
14
+ * keys: [env.get('APP_KEY')]
15
+ * })
16
+ * ```
17
+ */
5
18
  function legacy(config) {
6
19
  return {
7
20
  driver: (key) => new Legacy({ key }),
8
21
  keys: config.keys
9
22
  };
10
23
  }
24
+ /**
25
+ * Legacy encryption driver for AdonisJS.
26
+ *
27
+ * This driver maintains compatibility with the old AdonisJS v6 encryption
28
+ * format. It uses:
29
+ * - AES-256-CBC for encryption
30
+ * - HMAC SHA-256 for integrity verification
31
+ * - MessageBuilder from @poppinss/utils for encoding values
32
+ *
33
+ * Encrypted format: `[encrypted_base64url].[iv_base64url].[hmac]`
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const driver = new Legacy({ key: 'your-32-character-secret-key!!' })
38
+ *
39
+ * const encrypted = driver.encrypt('sensitive data')
40
+ * const decrypted = driver.decrypt(encrypted)
41
+ * ```
42
+ */
11
43
  var Legacy = class extends BaseDriver {
12
44
  constructor(config) {
13
45
  super(config);
46
+ /**
47
+ * The key length must be at least 16 characters
48
+ */
14
49
  if (this.cryptoKey.length < 16) throw new errors.E_INSECURE_ENCRYPTER_KEY();
15
50
  }
16
51
  encrypt(payload, expiresInOrOptions, purpose) {
@@ -30,6 +65,9 @@ var Legacy = class extends BaseDriver {
30
65
  const hmac = new Hmac(this.cryptoKey).generate(macPayload);
31
66
  return this.computeReturns([macPayload, hmac]);
32
67
  }
68
+ /**
69
+ * Decrypt value and verify it against a purpose
70
+ */
33
71
  decrypt(value, purpose) {
34
72
  if (typeof value !== "string") return null;
35
73
  const [cipherEncoded, ivEncoded, macEncoded] = value.split(this.separator);
@@ -47,11 +85,18 @@ var Legacy = class extends BaseDriver {
47
85
  return null;
48
86
  }
49
87
  }
88
+ /**
89
+ * Legacy driver does not support blind indexes.
90
+ */
50
91
  blindIndex(_payload, _purpose) {
51
92
  throw new E_BLIND_INDEX_NOT_SUPPORTED(["legacy"]);
52
93
  }
94
+ /**
95
+ * Legacy driver does not support blind indexes.
96
+ */
53
97
  blindIndexes(_payload, _purpose) {
54
98
  throw new E_BLIND_INDEX_NOT_SUPPORTED(["legacy"]);
55
99
  }
56
100
  };
101
+ //#endregion
57
102
  export { Legacy, legacy };