@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
@@ -12,16 +12,34 @@ 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 { BaseCommand, flags } from '../modules/ace/main.js';
16
- import { detectAssetsBundler, importAssembler, importTypeScript } from '../src/internal_helpers.js';
15
+ import { BaseCommand, flags } from "../modules/ace/main.js";
16
+ import { importAssembler, importTypeScript } from "../src/utils.js";
17
17
  /**
18
18
  * Serve command is used to run the AdonisJS HTTP server during development. The
19
19
  * command under the hood runs the "bin/server.ts" file and watches for file
20
20
  * system changes
21
+ *
22
+ * @example
23
+ * ```
24
+ * ace serve
25
+ * ace serve --watch
26
+ * ace serve --hmr
27
+ * ace serve --poll
28
+ * ace serve --no-clear
29
+ * ```
21
30
  */
22
31
  export default class Serve extends BaseCommand {
32
+ /**
33
+ * The command name
34
+ */
23
35
  static commandName = 'serve';
36
+ /**
37
+ * The command description
38
+ */
24
39
  static description = 'Start the development HTTP server along with the file watcher to perform restarts on file change';
40
+ /**
41
+ * Help text for the command
42
+ */
25
43
  static help = [
26
44
  'Start the development server with file watcher using the following command.',
27
45
  '```',
@@ -39,11 +57,16 @@ export default class Serve extends BaseCommand {
39
57
  '{{ binaryName }} serve --assets-args="--debug --base=/public"',
40
58
  '```',
41
59
  ];
60
+ /**
61
+ * Command options configuration
62
+ */
42
63
  static options = {
43
64
  staysAlive: true,
44
65
  };
45
66
  /**
46
67
  * Log a development dependency is missing
68
+ *
69
+ * @param dependency - The name of the missing dependency
47
70
  */
48
71
  #logMissingDevelopmentDependency(dependency) {
49
72
  this.logger.error([
@@ -54,22 +77,6 @@ export default class Serve extends BaseCommand {
54
77
  'If you are running your application in production, then use "node bin/server.js" command to start the HTTP server',
55
78
  ].join('\n'));
56
79
  }
57
- /**
58
- * Returns the assets bundler config
59
- */
60
- async #getAssetsBundlerConfig() {
61
- const assetsBundler = await detectAssetsBundler(this.app);
62
- return assetsBundler
63
- ? {
64
- enabled: this.assets === false ? false : true,
65
- driver: assetsBundler.name,
66
- cmd: assetsBundler.devServer.command,
67
- args: (assetsBundler.devServer.args || []).concat(this.assetsArgs || []),
68
- }
69
- : {
70
- enabled: false,
71
- };
72
- }
73
80
  /**
74
81
  * Runs the HTTP server
75
82
  */
@@ -90,18 +97,14 @@ export default class Serve extends BaseCommand {
90
97
  clearScreen: this.clear === false ? false : true,
91
98
  nodeArgs: this.parsed.nodeArgs,
92
99
  scriptArgs: [],
93
- assets: await this.#getAssetsBundlerConfig(),
94
100
  metaFiles: this.app.rcFile.metaFiles,
95
- hooks: {
96
- onDevServerStarted: this.app.rcFile.hooks?.onDevServerStarted,
97
- onSourceFileChanged: this.app.rcFile.hooks?.onSourceFileChanged,
98
- },
101
+ hooks: this.app.rcFile.hooks,
99
102
  });
100
103
  /**
101
104
  * Share command logger with assembler, so that CLI flags like --no-ansi has
102
105
  * similar impact for assembler logs as well.
103
106
  */
104
- this.devServer.setLogger(this.logger);
107
+ this.devServer.ui.logger = this.logger;
105
108
  /**
106
109
  * Exit command when the dev server is closed
107
110
  */
@@ -116,20 +119,20 @@ export default class Serve extends BaseCommand {
116
119
  this.exitCode = 1;
117
120
  this.terminate();
118
121
  });
122
+ const ts = await importTypeScript(this.app);
123
+ if (!ts) {
124
+ this.#logMissingDevelopmentDependency('typescript');
125
+ this.exitCode = 1;
126
+ return;
127
+ }
119
128
  /**
120
129
  * Start the development server
121
130
  */
122
131
  if (this.watch) {
123
- const ts = await importTypeScript(this.app);
124
- if (!ts) {
125
- this.#logMissingDevelopmentDependency('typescript');
126
- this.exitCode = 1;
127
- return;
128
- }
129
132
  await this.devServer.startAndWatch(ts, { poll: this.poll || false });
130
133
  }
131
134
  else {
132
- await this.devServer.start();
135
+ await this.devServer.start(ts);
133
136
  }
134
137
  }
135
138
  }
@@ -152,15 +155,3 @@ __decorate([
152
155
  default: true,
153
156
  })
154
157
  ], Serve.prototype, "clear", void 0);
155
- __decorate([
156
- flags.boolean({
157
- description: 'Start assets bundler dev server',
158
- showNegatedVariantInHelp: true,
159
- default: true,
160
- })
161
- ], Serve.prototype, "assets", void 0);
162
- __decorate([
163
- flags.array({
164
- description: 'Define CLI arguments to pass to the assets bundler',
165
- })
166
- ], Serve.prototype, "assetsArgs", void 0);
@@ -1,32 +1,93 @@
1
1
  import type { TestRunner } from '@adonisjs/assembler';
2
- import type { CommandOptions } from '../types/ace.js';
3
- import { BaseCommand } from '../modules/ace/main.js';
2
+ import type { CommandOptions } from '../types/ace.ts';
3
+ import { BaseCommand } from '../modules/ace/main.ts';
4
4
  /**
5
- * Test command is used to run tests with optional file watcher. Under the
6
- * hood, we run "bin/test.js" file.
5
+ * Command to run application tests using the Japa test runner.
6
+ * Supports filtering tests by suites, files, tags, groups, and individual tests.
7
+ * Can run in watch mode to automatically re-run tests when files change.
8
+ *
9
+ * @example
10
+ * ```
11
+ * ace test
12
+ * ace test unit integration
13
+ * ace test --watch
14
+ * ace test --files=user.spec.ts
15
+ * ace test --tags=slow --groups="User tests"
16
+ * ace test --reporters=spec,dot
17
+ * ace test --timeout=5000 --retries=2
18
+ * ```
7
19
  */
8
20
  export default class Test extends BaseCommand {
9
21
  #private;
22
+ /**
23
+ * The command name
24
+ */
10
25
  static commandName: string;
26
+ /**
27
+ * The command description
28
+ */
11
29
  static description: string;
30
+ /**
31
+ * Command options configuration.
32
+ * Allows unknown flags to be passed to Japa and keeps the process alive.
33
+ */
12
34
  static options: CommandOptions;
35
+ /**
36
+ * The test runner instance from the assembler package
37
+ */
13
38
  testsRunner: TestRunner;
39
+ /**
40
+ * Test suite names to run. When provided, only tests from the specified suites will be executed
41
+ */
14
42
  suites?: string[];
43
+ /**
44
+ * Filter tests by filename patterns
45
+ */
15
46
  files?: string[];
47
+ /**
48
+ * Filter tests by tags
49
+ */
16
50
  tags?: string[];
51
+ /**
52
+ * Filter tests by parent group title
53
+ */
17
54
  groups?: string[];
55
+ /**
56
+ * Filter tests by test title
57
+ */
18
58
  tests?: string[];
59
+ /**
60
+ * Specify one or more test reporters to use for output formatting
61
+ */
19
62
  reporters?: string[];
63
+ /**
64
+ * Enable watch mode to automatically re-run tests when files change
65
+ */
20
66
  watch?: boolean;
67
+ /**
68
+ * Use polling instead of native filesystem events to detect file changes
69
+ */
21
70
  poll?: boolean;
71
+ /**
72
+ * Default timeout in milliseconds for all tests
73
+ */
22
74
  timeout?: number;
75
+ /**
76
+ * Default number of retries for failed tests
77
+ */
23
78
  retries?: number;
79
+ /**
80
+ * Execute only tests that failed during the last run
81
+ */
24
82
  failed?: boolean;
83
+ /**
84
+ * Clear the terminal for new logs after file change in watch mode
85
+ */
25
86
  clear?: boolean;
26
- assets?: boolean;
27
- assetsArgs?: string[];
28
87
  /**
29
- * Runs tests
88
+ * Execute the test command. Sets up the test runner with all configured options
89
+ * and filters, then runs tests either once or in watch mode. Handles missing
90
+ * dependencies and properly configures the test environment.
30
91
  */
31
92
  run(): Promise<void>;
32
93
  }
@@ -12,21 +12,46 @@ 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 { BaseCommand, flags, args } from '../modules/ace/main.js';
16
- import { detectAssetsBundler, importAssembler, importTypeScript } from '../src/internal_helpers.js';
15
+ import { BaseCommand, flags, args } from "../modules/ace/main.js";
16
+ import { importAssembler, importTypeScript } from "../src/utils.js";
17
17
  /**
18
- * Test command is used to run tests with optional file watcher. Under the
19
- * hood, we run "bin/test.js" file.
18
+ * Command to run application tests using the Japa test runner.
19
+ * Supports filtering tests by suites, files, tags, groups, and individual tests.
20
+ * Can run in watch mode to automatically re-run tests when files change.
21
+ *
22
+ * @example
23
+ * ```
24
+ * ace test
25
+ * ace test unit integration
26
+ * ace test --watch
27
+ * ace test --files=user.spec.ts
28
+ * ace test --tags=slow --groups="User tests"
29
+ * ace test --reporters=spec,dot
30
+ * ace test --timeout=5000 --retries=2
31
+ * ```
20
32
  */
21
33
  export default class Test extends BaseCommand {
34
+ /**
35
+ * The command name
36
+ */
22
37
  static commandName = 'test';
38
+ /**
39
+ * The command description
40
+ */
23
41
  static description = 'Run tests along with the file watcher to re-run tests on file change';
42
+ /**
43
+ * Command options configuration.
44
+ * Allows unknown flags to be passed to Japa and keeps the process alive.
45
+ */
24
46
  static options = {
25
47
  allowUnknownFlags: true,
26
48
  staysAlive: true,
27
49
  };
28
50
  /**
29
- * Log a development dependency is missing
51
+ * Log an error message when a required development dependency is missing.
52
+ * Provides helpful instructions for resolving the issue.
53
+ *
54
+ * @param dependency - The name of the missing dependency package
30
55
  */
31
56
  #logMissingDevelopmentDependency(dependency) {
32
57
  this.logger.error([
@@ -38,7 +63,10 @@ export default class Test extends BaseCommand {
38
63
  ].join('\n'));
39
64
  }
40
65
  /**
41
- * Collection of unknown flags to pass to Japa
66
+ * Collect unknown flags and format them to pass to the Japa test runner.
67
+ * Handles boolean flags, arrays, and single values appropriately.
68
+ *
69
+ * @returns Array of formatted command-line arguments for Japa
42
70
  */
43
71
  #getPassthroughFlags() {
44
72
  return this.parsed.unknownFlags
@@ -61,23 +89,9 @@ export default class Test extends BaseCommand {
61
89
  .flat(2);
62
90
  }
63
91
  /**
64
- * Returns the assets bundler config
65
- */
66
- async #getAssetsBundlerConfig() {
67
- const assetsBundler = await detectAssetsBundler(this.app);
68
- return assetsBundler
69
- ? {
70
- enabled: this.assets === false ? false : true,
71
- driver: assetsBundler.name,
72
- cmd: assetsBundler.devServer.command,
73
- args: (assetsBundler.devServer.args || []).concat(this.assetsArgs || []),
74
- }
75
- : {
76
- enabled: false,
77
- };
78
- }
79
- /**
80
- * Runs tests
92
+ * Execute the test command. Sets up the test runner with all configured options
93
+ * and filters, then runs tests either once or in watch mode. Handles missing
94
+ * dependencies and properly configures the test environment.
81
95
  */
82
96
  async run() {
83
97
  process.env.NODE_ENV = 'test';
@@ -91,7 +105,6 @@ export default class Test extends BaseCommand {
91
105
  clearScreen: this.clear === false ? false : true,
92
106
  nodeArgs: this.parsed.nodeArgs,
93
107
  scriptArgs: this.#getPassthroughFlags(),
94
- assets: await this.#getAssetsBundlerConfig(),
95
108
  filters: {
96
109
  suites: this.suites,
97
110
  files: this.files,
@@ -112,13 +125,14 @@ export default class Test extends BaseCommand {
112
125
  env: {
113
126
  NODE_ENV: 'test',
114
127
  },
128
+ hooks: this.app.rcFile.hooks,
115
129
  metaFiles: this.app.rcFile.metaFiles,
116
130
  });
117
131
  /**
118
132
  * Share command logger with assembler, so that CLI flags like --no-ansi has
119
133
  * similar impact for assembler logs as well.
120
134
  */
121
- this.testsRunner.setLogger(this.logger);
135
+ this.testsRunner.ui.logger = this.logger;
122
136
  /**
123
137
  * Exit command when the test runner is closed
124
138
  */
@@ -193,15 +207,3 @@ __decorate([
193
207
  default: true,
194
208
  })
195
209
  ], Test.prototype, "clear", void 0);
196
- __decorate([
197
- flags.boolean({
198
- description: 'Start assets bundler dev server.',
199
- showNegatedVariantInHelp: true,
200
- default: true,
201
- })
202
- ], Test.prototype, "assets", void 0);
203
- __decorate([
204
- flags.array({
205
- description: 'Define CLI arguments to pass to the assets bundler',
206
- })
207
- ], Test.prototype, "assetsArgs", void 0);
@@ -1,10 +1,37 @@
1
- import { Ignitor } from '../../src/ignitor/main.js';
2
- import type { IgnitorOptions } from '../../src/types.js';
3
- import type { Kernel } from '../../modules/ace/kernel.js';
1
+ import { Ignitor } from '../../src/ignitor/main.ts';
2
+ import type { IgnitorOptions } from '../../src/types.ts';
3
+ import type { Kernel } from '../../modules/ace/kernel.ts';
4
4
  /**
5
- * Creates an instance of Ace kernel
5
+ * Factory for creating and configuring Ace command kernel instances.
6
+ * This factory provides a convenient way to create Ace kernels either from
7
+ * an existing Ignitor instance or by creating a new one from scratch.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * // Create from URL
12
+ * const aceFactory = new AceFactory()
13
+ * const kernel = await aceFactory.make(new URL('../', import.meta.url))
14
+ *
15
+ * // Create from existing ignitor
16
+ * const ignitor = new Ignitor(appRoot)
17
+ * const kernel = await aceFactory.make(ignitor)
18
+ *
19
+ * // Run commands
20
+ * await kernel.handle(['make:controller', 'UserController'])
21
+ * ```
6
22
  */
7
23
  export declare class AceFactory {
24
+ /**
25
+ * Create an Ace kernel from an existing Ignitor instance
26
+ *
27
+ * @param ignitor - Existing Ignitor instance
28
+ */
8
29
  make(ignitor: Ignitor): Promise<Kernel>;
30
+ /**
31
+ * Create an Ace kernel from application root URL
32
+ *
33
+ * @param appRoot - Application root directory URL
34
+ * @param options - Optional Ignitor configuration options
35
+ */
9
36
  make(appRoot: URL, options?: IgnitorOptions): Promise<Kernel>;
10
37
  }
@@ -6,11 +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
- import { IgnitorFactory } from './ignitor.js';
10
- import { Ignitor } from '../../src/ignitor/main.js';
11
- import { createAceKernel } from '../../modules/ace/create_kernel.js';
9
+ import { IgnitorFactory } from "./ignitor.js";
10
+ import { Ignitor } from "../../src/ignitor/main.js";
11
+ import { createAceKernel } from "../../modules/ace/create_kernel.js";
12
12
  /**
13
- * Creates an instance of Ace kernel
13
+ * Factory for creating and configuring Ace command kernel instances.
14
+ * This factory provides a convenient way to create Ace kernels either from
15
+ * an existing Ignitor instance or by creating a new one from scratch.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // Create from URL
20
+ * const aceFactory = new AceFactory()
21
+ * const kernel = await aceFactory.make(new URL('../', import.meta.url))
22
+ *
23
+ * // Create from existing ignitor
24
+ * const ignitor = new Ignitor(appRoot)
25
+ * const kernel = await aceFactory.make(ignitor)
26
+ *
27
+ * // Run commands
28
+ * await kernel.handle(['make:controller', 'UserController'])
29
+ * ```
14
30
  */
15
31
  export class AceFactory {
16
32
  async make(ignitorOrAppRoot, options) {
@@ -1,33 +1,104 @@
1
- import { Ignitor } from '../../src/ignitor/main.js';
2
- import type { ApplicationService, IgnitorOptions } from '../../src/types.js';
1
+ import { Ignitor } from '../../src/ignitor/main.ts';
2
+ import type { ApplicationService, IgnitorOptions } from '../../src/types.ts';
3
3
  type FactoryParameters = {
4
4
  rcFileContents: Record<string, any>;
5
5
  config: Record<string, any>;
6
6
  };
7
7
  /**
8
- * Ignitor factory creates an instance of the AdonisJS ignitor
8
+ * Factory for creating and configuring AdonisJS Ignitor instances.
9
+ * This factory provides a fluent API to set up applications with core providers,
10
+ * configurations, and preload actions for testing and development scenarios.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const ignitor = new IgnitorFactory()
15
+ * .withCoreProviders()
16
+ * .withCoreConfig()
17
+ * .preload((app) => {
18
+ * // Custom initialization logic
19
+ * })
20
+ * .create(new URL('../', import.meta.url))
21
+ *
22
+ * const app = ignitor.createApp('web')
23
+ * await app.boot()
24
+ * ```
9
25
  */
10
26
  export declare class IgnitorFactory {
11
27
  #private;
12
28
  /**
13
- * Define preload actions to run.
29
+ * Define preload actions to run during application initialization.
30
+ * These actions are executed after the application is booted.
31
+ *
32
+ * @param action - Function to execute during preload phase
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * factory.preload((app) => {
37
+ * // Register custom bindings
38
+ * app.container.bind('customService', () => new CustomService())
39
+ * })
40
+ * ```
14
41
  */
15
42
  preload(action: (app: ApplicationService) => void | Promise<void>): this;
16
43
  /**
17
- * Merge custom factory parameters
44
+ * Merge custom factory parameters with existing ones.
45
+ * This allows you to customize RC file contents and application configuration.
46
+ *
47
+ * @param params - Parameters to merge
48
+ * @param params.config - Application configuration to merge
49
+ * @param params.rcFileContents - RC file contents to merge
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * factory.merge({
54
+ * config: {
55
+ * database: { connection: 'mysql' }
56
+ * },
57
+ * rcFileContents: {
58
+ * commands: ['./commands/CustomCommand']
59
+ * }
60
+ * })
61
+ * ```
18
62
  */
19
63
  merge(params: Partial<FactoryParameters>): this;
20
64
  /**
21
- * Load core provider when booting the app
65
+ * Include core AdonisJS providers when booting the application.
66
+ * This adds essential providers like app, hash, and REPL providers.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const ignitor = new IgnitorFactory()
71
+ * .withCoreProviders()
72
+ * .create(appRoot)
73
+ * ```
22
74
  */
23
75
  withCoreProviders(): this;
24
76
  /**
25
- * Merge default config for the core features. A shallow merge
26
- * is performed.
77
+ * Merge default configuration for core AdonisJS features.
78
+ * This includes configurations for HTTP, hash, logger, and bodyparser.
79
+ * A shallow merge is performed with existing config.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const ignitor = new IgnitorFactory()
84
+ * .withCoreConfig()
85
+ * .create(appRoot)
86
+ * ```
27
87
  */
28
88
  withCoreConfig(): this;
29
89
  /**
30
- * Create ignitor instance
90
+ * Create a configured Ignitor instance with all specified parameters.
91
+ *
92
+ * @param appRoot - Application root directory URL
93
+ * @param options - Optional Ignitor configuration options
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const ignitor = new IgnitorFactory()
98
+ * .withCoreConfig()
99
+ * .withCoreProviders()
100
+ * .create(new URL('../', import.meta.url))
101
+ * ```
31
102
  */
32
103
  create(appRoot: URL, options?: IgnitorOptions): Ignitor;
33
104
  }