@adonisjs/core 6.19.0 → 7.0.0-next.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 (177) hide show
  1. package/build/commands/add.d.ts +36 -5
  2. package/build/commands/add.js +24 -60
  3. package/build/commands/build.d.ts +23 -3
  4. package/build/commands/build.js +22 -36
  5. package/build/commands/commands.json +1 -1
  6. package/build/commands/configure.d.ts +35 -12
  7. package/build/commands/configure.js +39 -12
  8. package/build/commands/eject.d.ts +28 -3
  9. package/build/commands/eject.js +24 -5
  10. package/build/commands/env/add.d.ts +41 -4
  11. package/build/commands/env/add.js +32 -5
  12. package/build/commands/generate_key.d.ts +20 -1
  13. package/build/commands/generate_key.js +14 -1
  14. package/build/commands/inspect_rcfile.d.ts +20 -2
  15. package/build/commands/inspect_rcfile.js +20 -2
  16. package/build/commands/list/routes.d.ts +33 -11
  17. package/build/commands/list/routes.js +28 -5
  18. package/build/commands/make/command.d.ts +26 -3
  19. package/build/commands/make/command.js +25 -5
  20. package/build/commands/make/controller.d.ts +35 -2
  21. package/build/commands/make/controller.js +20 -2
  22. package/build/commands/make/event.d.ts +30 -4
  23. package/build/commands/make/event.js +27 -4
  24. package/build/commands/make/exception.d.ts +30 -4
  25. package/build/commands/make/exception.js +27 -4
  26. package/build/commands/make/listener.d.ts +38 -5
  27. package/build/commands/make/listener.js +32 -5
  28. package/build/commands/make/middleware.d.ts +25 -2
  29. package/build/commands/make/middleware.js +21 -4
  30. package/build/commands/make/preload.d.ts +31 -4
  31. package/build/commands/make/preload.js +28 -8
  32. package/build/commands/make/provider.d.ts +32 -3
  33. package/build/commands/make/provider.js +29 -7
  34. package/build/commands/make/service.d.ts +21 -2
  35. package/build/commands/make/service.js +18 -2
  36. package/build/commands/make/test.d.ts +27 -4
  37. package/build/commands/make/test.js +36 -8
  38. package/build/commands/make/transformer.d.ts +43 -0
  39. package/build/commands/make/transformer.js +65 -0
  40. package/build/commands/make/validator.d.ts +36 -5
  41. package/build/commands/make/validator.js +30 -5
  42. package/build/commands/make/view.d.ts +26 -3
  43. package/build/commands/make/view.js +24 -4
  44. package/build/commands/repl.d.ts +24 -4
  45. package/build/commands/repl.js +23 -3
  46. package/build/commands/serve.d.ts +38 -4
  47. package/build/commands/serve.js +34 -43
  48. package/build/commands/test.d.ts +68 -7
  49. package/build/commands/test.js +39 -37
  50. package/build/factories/core/ace.d.ts +31 -4
  51. package/build/factories/core/ace.js +20 -4
  52. package/build/factories/core/ignitor.d.ts +80 -9
  53. package/build/factories/core/ignitor.js +84 -13
  54. package/build/factories/core/main.d.ts +3 -3
  55. package/build/factories/core/main.js +3 -3
  56. package/build/factories/core/test_utils.d.ts +32 -4
  57. package/build/factories/core/test_utils.js +21 -4
  58. package/build/factories/stubs.d.ts +54 -5
  59. package/build/factories/stubs.js +55 -6
  60. package/build/index.d.ts +5 -4
  61. package/build/index.js +13 -9
  62. package/build/modules/ace/codemods.d.ts +71 -11
  63. package/build/modules/ace/codemods.js +90 -22
  64. package/build/modules/ace/commands.d.ts +48 -13
  65. package/build/modules/ace/commands.js +45 -10
  66. package/build/modules/ace/create_kernel.d.ts +19 -8
  67. package/build/modules/ace/create_kernel.js +19 -8
  68. package/build/modules/ace/kernel.d.ts +18 -4
  69. package/build/modules/ace/kernel.js +17 -3
  70. package/build/modules/ace/main.d.ts +3 -3
  71. package/build/modules/ace/main.js +3 -3
  72. package/build/modules/dumper/define_config.d.ts +25 -4
  73. package/build/modules/dumper/define_config.js +23 -2
  74. package/build/modules/dumper/dumper.d.ts +82 -12
  75. package/build/modules/dumper/dumper.js +82 -12
  76. package/build/modules/dumper/errors.d.ts +31 -10
  77. package/build/modules/dumper/errors.js +28 -7
  78. package/build/modules/dumper/main.d.ts +3 -3
  79. package/build/modules/dumper/main.js +3 -3
  80. package/build/modules/dumper/plugins/edge.d.ts +1 -1
  81. package/build/modules/hash/define_config.d.ts +53 -8
  82. package/build/modules/hash/define_config.js +51 -6
  83. package/build/modules/hash/main.d.ts +1 -1
  84. package/build/modules/hash/main.js +1 -1
  85. package/build/modules/http/main.d.ts +1 -1
  86. package/build/modules/http/main.js +1 -1
  87. package/build/modules/http/request_validator.d.ts +36 -9
  88. package/build/modules/http/request_validator.js +32 -5
  89. package/build/modules/transformers/main.d.ts +1 -0
  90. package/build/modules/transformers/main.js +9 -0
  91. package/build/providers/app_provider.d.ts +173 -1
  92. package/build/providers/app_provider.js +204 -8
  93. package/build/providers/edge_provider.d.ts +31 -2
  94. package/build/providers/edge_provider.js +31 -2
  95. package/build/providers/hash_provider.d.ts +38 -1
  96. package/build/providers/hash_provider.js +40 -3
  97. package/build/providers/repl_provider.d.ts +40 -1
  98. package/build/providers/repl_provider.js +52 -2
  99. package/build/providers/vinejs_provider.d.ts +32 -5
  100. package/build/providers/vinejs_provider.js +31 -4
  101. package/build/services/ace.d.ts +1 -1
  102. package/build/services/ace.js +1 -1
  103. package/build/services/app.d.ts +1 -1
  104. package/build/services/config.d.ts +1 -1
  105. package/build/services/config.js +1 -1
  106. package/build/services/dumper.js +1 -1
  107. package/build/services/emitter.d.ts +1 -1
  108. package/build/services/emitter.js +1 -1
  109. package/build/services/encryption.d.ts +1 -1
  110. package/build/services/encryption.js +1 -1
  111. package/build/services/hash.d.ts +1 -1
  112. package/build/services/hash.js +1 -1
  113. package/build/services/logger.d.ts +1 -1
  114. package/build/services/logger.js +1 -1
  115. package/build/services/repl.d.ts +1 -1
  116. package/build/services/repl.js +1 -1
  117. package/build/services/router.d.ts +1 -1
  118. package/build/services/router.js +1 -1
  119. package/build/services/server.d.ts +1 -1
  120. package/build/services/server.js +1 -1
  121. package/build/services/test_utils.d.ts +1 -1
  122. package/build/services/test_utils.js +1 -1
  123. package/build/services/url_builder.d.ts +4 -0
  124. package/build/services/url_builder.js +21 -0
  125. package/build/src/assembler_hooks/index_entities.d.ts +37 -0
  126. package/build/src/assembler_hooks/index_entities.js +106 -0
  127. package/build/src/cli_formatters/routes_list.d.ts +24 -12
  128. package/build/src/cli_formatters/routes_list.js +43 -46
  129. package/build/src/config_provider.d.ts +48 -3
  130. package/build/src/config_provider.js +47 -2
  131. package/build/src/debug.d.ts +15 -0
  132. package/build/src/debug.js +15 -0
  133. package/build/src/exceptions.d.ts +41 -1
  134. package/build/src/exceptions.js +41 -1
  135. package/build/src/helpers/assert.d.ts +47 -1
  136. package/build/src/helpers/assert.js +47 -1
  137. package/build/src/helpers/is.d.ts +21 -0
  138. package/build/src/helpers/is.js +21 -0
  139. package/build/src/helpers/main.d.ts +48 -5
  140. package/build/src/helpers/main.js +48 -5
  141. package/build/src/helpers/string.d.ts +89 -9
  142. package/build/src/helpers/string.js +21 -2
  143. package/build/src/helpers/types.d.ts +97 -2
  144. package/build/src/helpers/types.js +96 -2
  145. package/build/src/helpers/verification_token.d.ts +22 -1
  146. package/build/src/helpers/verification_token.js +24 -2
  147. package/build/src/ignitor/ace.d.ts +23 -3
  148. package/build/src/ignitor/ace.js +21 -1
  149. package/build/src/ignitor/http.d.ts +16 -3
  150. package/build/src/ignitor/http.js +16 -3
  151. package/build/src/ignitor/main.d.ts +29 -6
  152. package/build/src/ignitor/main.js +30 -7
  153. package/build/src/ignitor/test.d.ts +26 -3
  154. package/build/src/ignitor/test.js +24 -1
  155. package/build/src/test_utils/http.d.ts +19 -3
  156. package/build/src/test_utils/http.js +24 -3
  157. package/build/src/test_utils/main.d.ts +22 -4
  158. package/build/src/test_utils/main.js +21 -3
  159. package/build/src/types.d.ts +283 -26
  160. package/build/src/utils.d.ts +60 -0
  161. package/build/src/utils.js +104 -0
  162. package/build/src/vine.d.ts +24 -1
  163. package/build/src/vine.js +27 -1
  164. package/build/stubs/main.js +1 -2
  165. package/build/stubs/make/transformer/main.stub +18 -0
  166. package/build/toolkit/main.js +1 -1
  167. package/build/types/common.d.ts +1 -0
  168. package/build/types/common.js +9 -0
  169. package/build/types/helpers.d.ts +2 -1
  170. package/build/types/http.d.ts +1 -0
  171. package/build/types/transformers.d.ts +1 -0
  172. package/build/types/transformers.js +9 -0
  173. package/package.json +55 -52
  174. package/build/src/helpers/parse_binding_reference.d.ts +0 -45
  175. package/build/src/helpers/parse_binding_reference.js +0 -83
  176. package/build/src/internal_helpers.d.ts +0 -15
  177. package/build/src/internal_helpers.js +0 -63
@@ -1,16 +1,42 @@
1
- import { BaseCommand } from '../../modules/ace/main.js';
2
- import { CommandOptions } from '../../types/ace.js';
1
+ import { BaseCommand } from '../../modules/ace/main.ts';
2
+ import { type CommandOptions } from '../../types/ace.ts';
3
3
  /**
4
- * The make event command to create a class based event
4
+ * Command to create a new event class.
5
+ * Events are data objects that encapsulate information about something
6
+ * that happened in your application and can be dispatched to listeners.
7
+ *
8
+ * @example
9
+ * ```
10
+ * ace make:event UserRegistered
11
+ * ace make:event OrderCompleted
12
+ * ace make:event EmailSent
13
+ * ```
5
14
  */
6
15
  export default class MakeEvent extends BaseCommand {
16
+ /**
17
+ * The command name
18
+ */
7
19
  static commandName: string;
20
+ /**
21
+ * The command description
22
+ */
8
23
  static description: string;
24
+ /**
25
+ * Command options configuration.
26
+ * Allows unknown flags to be passed through.
27
+ */
9
28
  static options: CommandOptions;
29
+ /**
30
+ * Name of the event class to create
31
+ */
10
32
  name: string;
11
33
  /**
12
- * The stub to use for generating the event
34
+ * The stub template file to use for generating the event class
13
35
  */
14
36
  protected stubPath: string;
37
+ /**
38
+ * Execute the command to create a new event class.
39
+ * Generates the event file with proper event structure.
40
+ */
15
41
  run(): Promise<void>;
16
42
  }
@@ -12,21 +12,44 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
12
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
13
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
14
  };
15
- import { stubsRoot } from '../../stubs/main.js';
16
- import { args, BaseCommand } from '../../modules/ace/main.js';
15
+ import { stubsRoot } from "../../stubs/main.js";
16
+ import { args, BaseCommand } from "../../modules/ace/main.js";
17
17
  /**
18
- * The make event command to create a class based event
18
+ * Command to create a new event class.
19
+ * Events are data objects that encapsulate information about something
20
+ * that happened in your application and can be dispatched to listeners.
21
+ *
22
+ * @example
23
+ * ```
24
+ * ace make:event UserRegistered
25
+ * ace make:event OrderCompleted
26
+ * ace make:event EmailSent
27
+ * ```
19
28
  */
20
29
  export default class MakeEvent extends BaseCommand {
30
+ /**
31
+ * The command name
32
+ */
21
33
  static commandName = 'make:event';
34
+ /**
35
+ * The command description
36
+ */
22
37
  static description = 'Create a new event class';
38
+ /**
39
+ * Command options configuration.
40
+ * Allows unknown flags to be passed through.
41
+ */
23
42
  static options = {
24
43
  allowUnknownFlags: true,
25
44
  };
26
45
  /**
27
- * The stub to use for generating the event
46
+ * The stub template file to use for generating the event class
28
47
  */
29
48
  stubPath = 'make/event/main.stub';
49
+ /**
50
+ * Execute the command to create a new event class.
51
+ * Generates the event file with proper event structure.
52
+ */
30
53
  async run() {
31
54
  const codemods = await this.createCodemods();
32
55
  await codemods.makeUsingStub(stubsRoot, this.stubPath, {
@@ -1,16 +1,42 @@
1
- import { BaseCommand } from '../../modules/ace/main.js';
2
- import { CommandOptions } from '../../types/ace.js';
1
+ import { BaseCommand } from '../../modules/ace/main.ts';
2
+ import { type CommandOptions } from '../../types/ace.ts';
3
3
  /**
4
- * Make a new exception class
4
+ * Command to create a new custom exception class.
5
+ * Custom exceptions allow you to define specific error types for your application
6
+ * with custom error messages, status codes, and error handling logic.
7
+ *
8
+ * @example
9
+ * ```
10
+ * ace make:exception ValidationException
11
+ * ace make:exception UnauthorizedException
12
+ * ace make:exception ResourceNotFoundException
13
+ * ```
5
14
  */
6
15
  export default class MakeException extends BaseCommand {
16
+ /**
17
+ * The command name
18
+ */
7
19
  static commandName: string;
20
+ /**
21
+ * The command description
22
+ */
8
23
  static description: string;
24
+ /**
25
+ * Command options configuration.
26
+ * Allows unknown flags to be passed through.
27
+ */
9
28
  static options: CommandOptions;
29
+ /**
30
+ * Name of the exception class to create
31
+ */
10
32
  name: string;
11
33
  /**
12
- * The stub to use for generating the command class
34
+ * The stub template file to use for generating the exception class
13
35
  */
14
36
  protected stubPath: string;
37
+ /**
38
+ * Execute the command to create a new custom exception class.
39
+ * Generates the exception file with proper error handling structure.
40
+ */
15
41
  run(): Promise<void>;
16
42
  }
@@ -12,21 +12,44 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
12
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
13
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
14
  };
15
- import { stubsRoot } from '../../stubs/main.js';
16
- import { args, BaseCommand } from '../../modules/ace/main.js';
15
+ import { stubsRoot } from "../../stubs/main.js";
16
+ import { args, BaseCommand } from "../../modules/ace/main.js";
17
17
  /**
18
- * Make a new exception class
18
+ * Command to create a new custom exception class.
19
+ * Custom exceptions allow you to define specific error types for your application
20
+ * with custom error messages, status codes, and error handling logic.
21
+ *
22
+ * @example
23
+ * ```
24
+ * ace make:exception ValidationException
25
+ * ace make:exception UnauthorizedException
26
+ * ace make:exception ResourceNotFoundException
27
+ * ```
19
28
  */
20
29
  export default class MakeException extends BaseCommand {
30
+ /**
31
+ * The command name
32
+ */
21
33
  static commandName = 'make:exception';
34
+ /**
35
+ * The command description
36
+ */
22
37
  static description = 'Create a new custom exception class';
38
+ /**
39
+ * Command options configuration.
40
+ * Allows unknown flags to be passed through.
41
+ */
23
42
  static options = {
24
43
  allowUnknownFlags: true,
25
44
  };
26
45
  /**
27
- * The stub to use for generating the command class
46
+ * The stub template file to use for generating the exception class
28
47
  */
29
48
  stubPath = 'make/exception/main.stub';
49
+ /**
50
+ * Execute the command to create a new custom exception class.
51
+ * Generates the exception file with proper error handling structure.
52
+ */
30
53
  async run() {
31
54
  const codemods = await this.createCodemods();
32
55
  await codemods.makeUsingStub(stubsRoot, this.stubPath, {
@@ -1,19 +1,52 @@
1
- import { BaseCommand } from '../../modules/ace/main.js';
2
- import { CommandOptions } from '../../types/ace.js';
1
+ import { BaseCommand } from '../../modules/ace/main.ts';
2
+ import { type CommandOptions } from '../../types/ace.ts';
3
3
  /**
4
- * The make listener command to create a class based event
5
- * listener
4
+ * Command to create a new event listener class.
5
+ * Event listeners handle events dispatched by the application and can optionally
6
+ * generate the corresponding event class automatically.
7
+ *
8
+ * @example
9
+ * ```
10
+ * ace make:listener UserRegistered
11
+ * ace make:listener EmailSent --event=EmailSent
12
+ * ace make:listener OrderCompleted --event=OrderEvent
13
+ * ```
6
14
  */
7
15
  export default class MakeListener extends BaseCommand {
16
+ /**
17
+ * The command name
18
+ */
8
19
  static commandName: string;
20
+ /**
21
+ * The command description
22
+ */
9
23
  static description: string;
24
+ /**
25
+ * Command options configuration.
26
+ * Allows unknown flags to be passed through.
27
+ */
10
28
  static options: CommandOptions;
29
+ /**
30
+ * Name of the event listener class to create
31
+ */
11
32
  name: string;
33
+ /**
34
+ * Generate an event class alongside the listener and bind them together
35
+ */
12
36
  event: string;
13
37
  /**
14
- * The stub to use for generating the event listener
38
+ * The stub template file to use for generating the event listener
15
39
  */
16
40
  protected stubPath: string;
41
+ /**
42
+ * Prepare the command by selecting the appropriate stub based on options.
43
+ * Uses a different stub when generating a listener for a specific event.
44
+ */
17
45
  prepare(): void;
46
+ /**
47
+ * Execute the command to create a new event listener.
48
+ * If an event is specified, creates the event class first,
49
+ * then generates the listener with proper event binding.
50
+ */
18
51
  run(): Promise<void>;
19
52
  }
@@ -12,27 +12,54 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
12
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
13
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
14
  };
15
- import { stubsRoot } from '../../stubs/main.js';
16
- import { args, flags, BaseCommand } from '../../modules/ace/main.js';
15
+ import { stubsRoot } from "../../stubs/main.js";
16
+ import { args, flags, BaseCommand } from "../../modules/ace/main.js";
17
17
  /**
18
- * The make listener command to create a class based event
19
- * listener
18
+ * Command to create a new event listener class.
19
+ * Event listeners handle events dispatched by the application and can optionally
20
+ * generate the corresponding event class automatically.
21
+ *
22
+ * @example
23
+ * ```
24
+ * ace make:listener UserRegistered
25
+ * ace make:listener EmailSent --event=EmailSent
26
+ * ace make:listener OrderCompleted --event=OrderEvent
27
+ * ```
20
28
  */
21
29
  export default class MakeListener extends BaseCommand {
30
+ /**
31
+ * The command name
32
+ */
22
33
  static commandName = 'make:listener';
34
+ /**
35
+ * The command description
36
+ */
23
37
  static description = 'Create a new event listener class';
38
+ /**
39
+ * Command options configuration.
40
+ * Allows unknown flags to be passed through.
41
+ */
24
42
  static options = {
25
43
  allowUnknownFlags: true,
26
44
  };
27
45
  /**
28
- * The stub to use for generating the event listener
46
+ * The stub template file to use for generating the event listener
29
47
  */
30
48
  stubPath = 'make/listener/main.stub';
49
+ /**
50
+ * Prepare the command by selecting the appropriate stub based on options.
51
+ * Uses a different stub when generating a listener for a specific event.
52
+ */
31
53
  prepare() {
32
54
  if (this.event) {
33
55
  this.stubPath = 'make/listener/for_event.stub';
34
56
  }
35
57
  }
58
+ /**
59
+ * Execute the command to create a new event listener.
60
+ * If an event is specified, creates the event class first,
61
+ * then generates the listener with proper event binding.
62
+ */
36
63
  async run() {
37
64
  const codemods = await this.createCodemods();
38
65
  if (this.event) {
@@ -1,14 +1,37 @@
1
- import { BaseCommand } from '../../modules/ace/main.js';
2
- import { CommandOptions } from '../../types/ace.js';
1
+ import { type CommandOptions } from '../../types/ace.ts';
2
+ import { BaseCommand } from '../../modules/ace/main.ts';
3
3
  /**
4
4
  * The make middleware command to create a new middleware
5
5
  * class.
6
+ *
7
+ * @example
8
+ * ```
9
+ * ace make:middleware Auth
10
+ * ace make:middleware Auth --stack=server
11
+ * ace make:middleware Auth --stack=named
12
+ * ace make:middleware Auth --stack=router
13
+ * ```
6
14
  */
7
15
  export default class MakeMiddleware extends BaseCommand {
16
+ /**
17
+ * The command name
18
+ */
8
19
  static commandName: string;
20
+ /**
21
+ * The command description
22
+ */
9
23
  static description: string;
24
+ /**
25
+ * Command options configuration
26
+ */
10
27
  static options: CommandOptions;
28
+ /**
29
+ * Name of the middleware
30
+ */
11
31
  name: string;
32
+ /**
33
+ * The stack in which to register the middleware
34
+ */
12
35
  stack?: 'server' | 'named' | 'router';
13
36
  /**
14
37
  * The stub to use for generating the middleware
@@ -12,18 +12,35 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
12
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
13
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
14
  };
15
- import { slash } from '@poppinss/utils';
16
15
  import string from '@poppinss/utils/string';
17
16
  import { basename, extname, relative } from 'node:path';
18
- import { stubsRoot } from '../../stubs/main.js';
19
- import { args, BaseCommand, flags } from '../../modules/ace/main.js';
17
+ import { stubsRoot } from "../../stubs/main.js";
18
+ import stringHelpers from "../../src/helpers/string.js";
19
+ import { args, BaseCommand, flags } from "../../modules/ace/main.js";
20
20
  /**
21
21
  * The make middleware command to create a new middleware
22
22
  * class.
23
+ *
24
+ * @example
25
+ * ```
26
+ * ace make:middleware Auth
27
+ * ace make:middleware Auth --stack=server
28
+ * ace make:middleware Auth --stack=named
29
+ * ace make:middleware Auth --stack=router
30
+ * ```
23
31
  */
24
32
  export default class MakeMiddleware extends BaseCommand {
33
+ /**
34
+ * The command name
35
+ */
25
36
  static commandName = 'make:middleware';
37
+ /**
38
+ * The command description
39
+ */
26
40
  static description = 'Create a new middleware class for HTTP requests';
41
+ /**
42
+ * Command options configuration
43
+ */
27
44
  static options = {
28
45
  allowUnknownFlags: true,
29
46
  };
@@ -60,7 +77,7 @@ export default class MakeMiddleware extends BaseCommand {
60
77
  * Creative relative path for the middleware file from
61
78
  * the "./app/middleware" directory
62
79
  */
63
- const middlewareRelativePath = slash(relative(this.app.middlewarePath(), destination).replace(extname(destination), ''));
80
+ const middlewareRelativePath = stringHelpers.toUnixSlash(relative(this.app.middlewarePath(), destination).replace(extname(destination), ''));
64
81
  /**
65
82
  * Take the middleware relative path, remove `_middleware` prefix from it
66
83
  * and convert everything to camelcase
@@ -1,22 +1,49 @@
1
- import { BaseCommand } from '../../modules/ace/main.js';
1
+ import { BaseCommand } from '../../modules/ace/main.ts';
2
2
  declare const ALLOWED_ENVIRONMENTS: ("web" | "console" | "test" | "repl")[];
3
3
  type AllowedAppEnvironments = typeof ALLOWED_ENVIRONMENTS;
4
4
  /**
5
- * Make a new preload file
5
+ * Command to create a new preload file in the start directory.
6
+ * Preload files are executed during application startup and can be used
7
+ * to set up global configurations, register global bindings, or perform
8
+ * application-wide initialization tasks.
9
+ *
10
+ * @example
11
+ * ```
12
+ * ace make:preload routes
13
+ * ace make:preload database --register
14
+ * ace make:preload events --no-register
15
+ * ace make:preload kernel --environments=web,console
16
+ * ```
6
17
  */
7
18
  export default class MakePreload extends BaseCommand {
8
19
  #private;
20
+ /**
21
+ * The command name
22
+ */
9
23
  static commandName: string;
24
+ /**
25
+ * The command description
26
+ */
10
27
  static description: string;
28
+ /**
29
+ * Name of the preload file to create
30
+ */
11
31
  name: string;
32
+ /**
33
+ * Automatically register the preload file in the .adonisrc.ts file
34
+ */
12
35
  register?: boolean;
36
+ /**
37
+ * Application environments where the preload file should be loaded
38
+ */
13
39
  environments?: AllowedAppEnvironments;
14
40
  /**
15
- * The stub to use for generating the preload file
41
+ * The stub template file to use for generating the preload file
16
42
  */
17
43
  protected stubPath: string;
18
44
  /**
19
- * Run command
45
+ * Execute the command to create a new preload file.
46
+ * Validates inputs, generates the preload file, and optionally registers it in .adonisrc.ts.
20
47
  */
21
48
  run(): Promise<void>;
22
49
  }
@@ -12,23 +12,42 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
12
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
13
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
14
  };
15
- import { slash } from '@poppinss/utils';
16
15
  import { extname, relative } from 'node:path';
17
- import { stubsRoot } from '../../stubs/main.js';
18
- import { args, flags, BaseCommand } from '../../modules/ace/main.js';
16
+ import { stubsRoot } from "../../stubs/main.js";
17
+ import stringHelpers from "../../src/helpers/string.js";
18
+ import { args, flags, BaseCommand } from "../../modules/ace/main.js";
19
19
  const ALLOWED_ENVIRONMENTS = ['web', 'console', 'test', 'repl'];
20
20
  /**
21
- * Make a new preload file
21
+ * Command to create a new preload file in the start directory.
22
+ * Preload files are executed during application startup and can be used
23
+ * to set up global configurations, register global bindings, or perform
24
+ * application-wide initialization tasks.
25
+ *
26
+ * @example
27
+ * ```
28
+ * ace make:preload routes
29
+ * ace make:preload database --register
30
+ * ace make:preload events --no-register
31
+ * ace make:preload kernel --environments=web,console
32
+ * ```
22
33
  */
23
34
  export default class MakePreload extends BaseCommand {
35
+ /**
36
+ * The command name
37
+ */
24
38
  static commandName = 'make:preload';
39
+ /**
40
+ * The command description
41
+ */
25
42
  static description = 'Create a new preload file inside the start directory';
26
43
  /**
27
- * The stub to use for generating the preload file
44
+ * The stub template file to use for generating the preload file
28
45
  */
29
46
  stubPath = 'make/preload/main.stub';
30
47
  /**
31
- * Validate the environments flag passed by the user
48
+ * Validate that all specified environments are valid application environments.
49
+ *
50
+ * @returns True if all environments are valid or none specified, false otherwise
32
51
  */
33
52
  #isEnvironmentsFlagValid() {
34
53
  if (!this.environments || !this.environments.length) {
@@ -37,7 +56,8 @@ export default class MakePreload extends BaseCommand {
37
56
  return this.environments.every((one) => ALLOWED_ENVIRONMENTS.includes(one));
38
57
  }
39
58
  /**
40
- * Run command
59
+ * Execute the command to create a new preload file.
60
+ * Validates inputs, generates the preload file, and optionally registers it in .adonisrc.ts.
41
61
  */
42
62
  async run() {
43
63
  /**
@@ -70,7 +90,7 @@ export default class MakePreload extends BaseCommand {
70
90
  * Creative relative path for the preload file from
71
91
  * the "./start" directory
72
92
  */
73
- const preloadFileRelativePath = slash(relative(this.app.startPath(), destination).replace(extname(destination), ''));
93
+ const preloadFileRelativePath = stringHelpers.toUnixSlash(relative(this.app.startPath(), destination).replace(extname(destination), ''));
74
94
  await codemods.updateRcFile((rcFile) => {
75
95
  rcFile.addPreloadFile(`#start/${preloadFileRelativePath}`, this.environments);
76
96
  });
@@ -1,20 +1,49 @@
1
- import { BaseCommand } from '../../modules/ace/main.js';
1
+ import { BaseCommand } from '../../modules/ace/main.ts';
2
2
  declare const ALLOWED_ENVIRONMENTS: ("web" | "console" | "test" | "repl")[];
3
3
  type AllowedAppEnvironments = typeof ALLOWED_ENVIRONMENTS;
4
4
  /**
5
- * Make a new provider class
5
+ * Command to create a new service provider class.
6
+ * Service providers are used to register bindings, configure services,
7
+ * and bootstrap application components during startup.
8
+ *
9
+ * @example
10
+ * ```
11
+ * ace make:provider AuthProvider
12
+ * ace make:provider DatabaseProvider --register
13
+ * ace make:provider AppProvider --no-register
14
+ * ace make:provider CacheProvider --environments=web,console
15
+ * ```
6
16
  */
7
17
  export default class MakeProvider extends BaseCommand {
8
18
  #private;
19
+ /**
20
+ * The command name
21
+ */
9
22
  static commandName: string;
23
+ /**
24
+ * The command description
25
+ */
10
26
  static description: string;
27
+ /**
28
+ * Name of the service provider to create
29
+ */
11
30
  name: string;
31
+ /**
32
+ * Automatically register the provider in the .adonisrc.ts file
33
+ */
12
34
  register?: boolean;
35
+ /**
36
+ * Application environments where the provider should be loaded
37
+ */
13
38
  environments?: AllowedAppEnvironments;
14
39
  /**
15
- * The stub to use for generating the provider class
40
+ * The stub template file to use for generating the provider class
16
41
  */
17
42
  protected stubPath: string;
43
+ /**
44
+ * Execute the command to create a new service provider.
45
+ * Validates inputs, generates the provider file, and optionally registers it in .adonisrc.ts.
46
+ */
18
47
  run(): Promise<void>;
19
48
  }
20
49
  export {};
@@ -12,23 +12,41 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
12
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
13
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
14
  };
15
- import { slash } from '@poppinss/utils';
16
15
  import { extname, relative } from 'node:path';
17
- import { stubsRoot } from '../../stubs/main.js';
18
- import { args, BaseCommand, flags } from '../../modules/ace/main.js';
16
+ import { stubsRoot } from "../../stubs/main.js";
17
+ import stringHelpers from "../../src/helpers/string.js";
18
+ import { args, BaseCommand, flags } from "../../modules/ace/main.js";
19
19
  const ALLOWED_ENVIRONMENTS = ['web', 'console', 'test', 'repl'];
20
20
  /**
21
- * Make a new provider class
21
+ * Command to create a new service provider class.
22
+ * Service providers are used to register bindings, configure services,
23
+ * and bootstrap application components during startup.
24
+ *
25
+ * @example
26
+ * ```
27
+ * ace make:provider AuthProvider
28
+ * ace make:provider DatabaseProvider --register
29
+ * ace make:provider AppProvider --no-register
30
+ * ace make:provider CacheProvider --environments=web,console
31
+ * ```
22
32
  */
23
33
  export default class MakeProvider extends BaseCommand {
34
+ /**
35
+ * The command name
36
+ */
24
37
  static commandName = 'make:provider';
38
+ /**
39
+ * The command description
40
+ */
25
41
  static description = 'Create a new service provider class';
26
42
  /**
27
- * The stub to use for generating the provider class
43
+ * The stub template file to use for generating the provider class
28
44
  */
29
45
  stubPath = 'make/provider/main.stub';
30
46
  /**
31
- * Validate the environments flag passed by the user
47
+ * Validate that all specified environments are valid application environments.
48
+ *
49
+ * @returns True if all environments are valid or none specified, false otherwise
32
50
  */
33
51
  #isEnvironmentsFlagValid() {
34
52
  if (!this.environments || !this.environments.length) {
@@ -36,6 +54,10 @@ export default class MakeProvider extends BaseCommand {
36
54
  }
37
55
  return this.environments.every((one) => ALLOWED_ENVIRONMENTS.includes(one));
38
56
  }
57
+ /**
58
+ * Execute the command to create a new service provider.
59
+ * Validates inputs, generates the provider file, and optionally registers it in .adonisrc.ts.
60
+ */
39
61
  async run() {
40
62
  /**
41
63
  * Ensure the environments are valid when provided via flag
@@ -67,7 +89,7 @@ export default class MakeProvider extends BaseCommand {
67
89
  * Creative relative path for the provider file from
68
90
  * the "./start" directory
69
91
  */
70
- const providerRelativePath = slash(relative(this.app.providersPath(), destination).replace(extname(destination), ''));
92
+ const providerRelativePath = stringHelpers.toUnixSlash(relative(this.app.providersPath(), destination).replace(extname(destination), ''));
71
93
  await codemods.updateRcFile((rcFile) => {
72
94
  rcFile.addProvider(`#providers/${providerRelativePath}`, this.environments);
73
95
  });