@adonisjs/core 7.0.0-next.1 → 7.0.0-next.11

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 (145) hide show
  1. package/build/commands/add.js +40 -110
  2. package/build/commands/build.js +51 -107
  3. package/build/commands/configure.js +82 -177
  4. package/build/commands/eject.js +17 -60
  5. package/build/commands/env/add.js +55 -134
  6. package/build/commands/generate_key.js +22 -66
  7. package/build/commands/inspect_rcfile.js +27 -55
  8. package/build/commands/list/routes.js +246 -116
  9. package/build/commands/make/command.js +15 -57
  10. package/build/commands/make/controller.js +43 -120
  11. package/build/commands/make/event.js +16 -62
  12. package/build/commands/make/exception.js +16 -62
  13. package/build/commands/make/listener.js +36 -93
  14. package/build/commands/make/middleware.js +41 -101
  15. package/build/commands/make/preload.js +47 -113
  16. package/build/commands/make/provider.js +47 -112
  17. package/build/commands/make/service.js +16 -55
  18. package/build/commands/make/test.js +47 -132
  19. package/build/commands/make/transformer.js +17 -64
  20. package/build/commands/make/validator.js +20 -80
  21. package/build/commands/make/view.js +15 -56
  22. package/build/commands/repl.js +17 -50
  23. package/build/commands/serve.js +80 -156
  24. package/build/commands/test.js +92 -208
  25. package/build/factories/app.js +2 -9
  26. package/build/factories/bodyparser.js +2 -9
  27. package/build/factories/core/ace.js +15 -46
  28. package/build/factories/core/ignitor.js +12 -180
  29. package/build/factories/core/main.js +22 -11
  30. package/build/factories/core/test_utils.js +19 -43
  31. package/build/factories/encryption.js +2 -9
  32. package/build/factories/events.js +2 -9
  33. package/build/factories/hash.js +2 -9
  34. package/build/factories/http.js +2 -9
  35. package/build/factories/logger.js +2 -9
  36. package/build/factories/stubs.js +28 -91
  37. package/build/index.js +13 -46
  38. package/build/modules/ace/codemods.d.ts +109 -14
  39. package/build/modules/ace/codemods.js +222 -374
  40. package/build/modules/ace/main.d.ts +30 -0
  41. package/build/modules/ace/main.js +2 -11
  42. package/build/modules/app.d.ts +17 -0
  43. package/build/modules/app.js +4 -9
  44. package/build/modules/bodyparser/bodyparser_middleware.js +2 -14
  45. package/build/modules/bodyparser/main.js +4 -9
  46. package/build/modules/config.d.ts +17 -0
  47. package/build/modules/config.js +4 -9
  48. package/build/modules/container.js +4 -9
  49. package/build/modules/dumper/dumper.d.ts +5 -0
  50. package/build/modules/dumper/main.d.ts +21 -0
  51. package/build/modules/dumper/main.js +6 -11
  52. package/build/modules/dumper/plugins/edge.js +2 -62
  53. package/build/modules/encryption.d.ts +17 -0
  54. package/build/modules/encryption.js +4 -9
  55. package/build/modules/env/editor.js +2 -9
  56. package/build/modules/env/main.d.ts +19 -0
  57. package/build/modules/env/main.js +2 -9
  58. package/build/modules/events.js +4 -9
  59. package/build/modules/hash/drivers/argon.js +2 -9
  60. package/build/modules/hash/drivers/bcrypt.d.ts +11 -0
  61. package/build/modules/hash/drivers/bcrypt.js +2 -9
  62. package/build/modules/hash/drivers/scrypt.js +2 -9
  63. package/build/modules/hash/main.d.ts +18 -0
  64. package/build/modules/hash/main.js +6 -10
  65. package/build/modules/hash/phc_formatter.js +2 -9
  66. package/build/modules/health.js +2 -9
  67. package/build/modules/http/main.js +4 -15
  68. package/build/modules/http/url_builder_client.d.ts +1 -0
  69. package/build/modules/http/url_builder_client.js +2 -0
  70. package/build/modules/logger.d.ts +30 -0
  71. package/build/modules/logger.js +4 -9
  72. package/build/modules/repl.js +4 -9
  73. package/build/modules/transformers/main.js +4 -9
  74. package/build/providers/app_provider.d.ts +9 -21
  75. package/build/providers/app_provider.js +147 -363
  76. package/build/providers/edge_provider.js +97 -104
  77. package/build/providers/hash_provider.js +29 -91
  78. package/build/providers/repl_provider.js +61 -152
  79. package/build/providers/vinejs_provider.d.ts +1 -1
  80. package/build/providers/vinejs_provider.js +20 -66
  81. package/build/services/ace.js +2 -17
  82. package/build/services/app.js +2 -21
  83. package/build/services/config.js +2 -13
  84. package/build/services/dumper.js +5 -21
  85. package/build/services/emitter.js +2 -14
  86. package/build/services/encryption.js +2 -14
  87. package/build/services/hash.js +2 -14
  88. package/build/services/logger.js +2 -14
  89. package/build/services/repl.js +2 -14
  90. package/build/services/router.js +2 -14
  91. package/build/services/server.js +2 -14
  92. package/build/services/test_utils.js +2 -17
  93. package/build/services/url_builder.js +5 -17
  94. package/build/src/exceptions.js +2 -49
  95. package/build/src/helpers/assert.js +2 -55
  96. package/build/src/helpers/http.d.ts +20 -0
  97. package/build/src/helpers/http.js +2 -0
  98. package/build/src/helpers/is.js +3 -31
  99. package/build/src/helpers/main.d.ts +1 -5
  100. package/build/src/helpers/main.js +5 -56
  101. package/build/src/helpers/string.js +2 -60
  102. package/build/src/helpers/types.js +26 -135
  103. package/build/src/helpers/verification_token.js +2 -120
  104. package/build/src/test_utils/main.js +5 -77
  105. package/build/src/types.d.ts +1 -0
  106. package/build/src/types.js +0 -8
  107. package/build/src/utils.d.ts +1 -1
  108. package/build/src/vine.js +2 -97
  109. package/build/types/ace.js +2 -9
  110. package/build/types/app.js +2 -9
  111. package/build/types/bodyparser.js +2 -9
  112. package/build/types/common.js +2 -9
  113. package/build/types/container.js +2 -9
  114. package/build/types/encryption.js +2 -9
  115. package/build/types/events.js +2 -9
  116. package/build/types/hash.js +2 -9
  117. package/build/types/health.js +2 -9
  118. package/build/types/helpers.d.ts +20 -0
  119. package/build/types/helpers.js +0 -8
  120. package/build/types/http.js +2 -9
  121. package/build/types/logger.js +2 -9
  122. package/build/types/repl.js +2 -9
  123. package/build/types/transformers.js +2 -9
  124. package/package.json +88 -30
  125. package/build/modules/ace/commands.js +0 -157
  126. package/build/modules/ace/create_kernel.js +0 -91
  127. package/build/modules/ace/kernel.js +0 -40
  128. package/build/modules/dumper/define_config.js +0 -36
  129. package/build/modules/dumper/dumper.js +0 -256
  130. package/build/modules/dumper/errors.js +0 -119
  131. package/build/modules/hash/define_config.js +0 -125
  132. package/build/modules/http/request_validator.js +0 -100
  133. package/build/src/assembler_hooks/index_entities.js +0 -106
  134. package/build/src/cli_formatters/routes_list.js +0 -381
  135. package/build/src/config_provider.js +0 -71
  136. package/build/src/debug.js +0 -25
  137. package/build/src/ignitor/ace.js +0 -102
  138. package/build/src/ignitor/http.js +0 -146
  139. package/build/src/ignitor/main.js +0 -124
  140. package/build/src/ignitor/test.js +0 -66
  141. package/build/src/test_utils/http.js +0 -82
  142. package/build/src/utils.js +0 -104
  143. package/build/stubs/main.js +0 -9
  144. package/build/toolkit/commands/index_commands.js +0 -30
  145. package/build/toolkit/main.js +0 -27
@@ -1,209 +1,93 @@
1
- /*
2
- * @adonisjs/core
3
- *
4
- * (c) AdonisJS
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ import { t as importAssembler } from "../utils-CNQ4tlGM.js";
2
+ import { f as BaseCommand, l as flags, o as args } from "../main-Cn_x9YY5.js";
3
+ import { t as __decorate } from "../decorate-DM0Sx1ye.js";
4
+ var Test = class extends BaseCommand {
5
+ static commandName = "test";
6
+ static description = "Run tests along with the file watcher to re-run tests on file change";
7
+ static options = {
8
+ allowUnknownFlags: true,
9
+ staysAlive: true
10
+ };
11
+ #logMissingDevelopmentDependency(dependency) {
12
+ this.logger.error([
13
+ `Cannot find package "${dependency}"`,
14
+ "",
15
+ `The "${dependency}" package is a development dependency and therefore you should run tests with development dependencies installed.`,
16
+ "",
17
+ "If you are run tests inside a CI, make sure the NODE_ENV is set to \"development\""
18
+ ].join("\n"));
19
+ }
20
+ #getPassthroughFlags() {
21
+ return this.parsed.unknownFlags.map((flag) => {
22
+ const value = this.parsed.flags[flag];
23
+ if (value === true) return [`--${flag}`];
24
+ if (Array.isArray(value)) return value.map((v) => [`--${flag}`, v]);
25
+ return [`--${flag}`, value];
26
+ }).flat(2);
27
+ }
28
+ async run() {
29
+ process.env.NODE_ENV = "test";
30
+ const assembler = await importAssembler(this.app);
31
+ if (!assembler) {
32
+ this.#logMissingDevelopmentDependency("@adonisjs/assembler");
33
+ this.exitCode = 1;
34
+ return;
35
+ }
36
+ this.testsRunner = new assembler.TestRunner(this.app.appRoot, {
37
+ clearScreen: this.clear === false ? false : true,
38
+ nodeArgs: this.parsed.nodeArgs,
39
+ scriptArgs: this.#getPassthroughFlags(),
40
+ filters: {
41
+ suites: this.suites,
42
+ files: this.files,
43
+ groups: this.groups,
44
+ tags: this.tags,
45
+ tests: this.tests
46
+ },
47
+ failed: this.failed,
48
+ retries: this.retries,
49
+ timeout: this.timeout,
50
+ reporters: this.reporters,
51
+ suites: this.app.rcFile.tests.suites.map((suite) => {
52
+ return {
53
+ name: suite.name,
54
+ files: suite.files
55
+ };
56
+ }),
57
+ env: { NODE_ENV: "test" },
58
+ hooks: this.app.rcFile.hooks,
59
+ metaFiles: this.app.rcFile.metaFiles
60
+ });
61
+ this.testsRunner.ui.logger = this.logger;
62
+ this.testsRunner.onClose((exitCode) => {
63
+ this.exitCode = exitCode;
64
+ this.terminate();
65
+ });
66
+ this.testsRunner.onError(() => {
67
+ this.exitCode = 1;
68
+ this.terminate();
69
+ });
70
+ if (this.watch) await this.testsRunner.runAndWatch({ poll: this.poll || false });
71
+ else await this.testsRunner.run();
72
+ }
14
73
  };
15
- import { BaseCommand, flags, args } from "../modules/ace/main.js";
16
- import { importAssembler, importTypeScript } from "../src/utils.js";
17
- /**
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
- * ```
32
- */
33
- export default class Test extends BaseCommand {
34
- /**
35
- * The command name
36
- */
37
- static commandName = 'test';
38
- /**
39
- * The command description
40
- */
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
- */
46
- static options = {
47
- allowUnknownFlags: true,
48
- staysAlive: true,
49
- };
50
- /**
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
55
- */
56
- #logMissingDevelopmentDependency(dependency) {
57
- this.logger.error([
58
- `Cannot find package "${dependency}"`,
59
- '',
60
- `The "${dependency}" package is a development dependency and therefore you should run tests with development dependencies installed.`,
61
- '',
62
- 'If you are run tests inside a CI, make sure the NODE_ENV is set to "development"',
63
- ].join('\n'));
64
- }
65
- /**
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
70
- */
71
- #getPassthroughFlags() {
72
- return this.parsed.unknownFlags
73
- .map((flag) => {
74
- const value = this.parsed.flags[flag];
75
- /**
76
- * Not mentioning value when value is "true"
77
- */
78
- if (value === true) {
79
- return [`--${flag}`];
80
- }
81
- /**
82
- * Repeating flag multiple times when value is an array
83
- */
84
- if (Array.isArray(value)) {
85
- return value.map((v) => [`--${flag}`, v]);
86
- }
87
- return [`--${flag}`, value];
88
- })
89
- .flat(2);
90
- }
91
- /**
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.
95
- */
96
- async run() {
97
- process.env.NODE_ENV = 'test';
98
- const assembler = await importAssembler(this.app);
99
- if (!assembler) {
100
- this.#logMissingDevelopmentDependency('@adonisjs/assembler');
101
- this.exitCode = 1;
102
- return;
103
- }
104
- this.testsRunner = new assembler.TestRunner(this.app.appRoot, {
105
- clearScreen: this.clear === false ? false : true,
106
- nodeArgs: this.parsed.nodeArgs,
107
- scriptArgs: this.#getPassthroughFlags(),
108
- filters: {
109
- suites: this.suites,
110
- files: this.files,
111
- groups: this.groups,
112
- tags: this.tags,
113
- tests: this.tests,
114
- },
115
- failed: this.failed,
116
- retries: this.retries,
117
- timeout: this.timeout,
118
- reporters: this.reporters,
119
- suites: this.app.rcFile.tests.suites.map((suite) => {
120
- return {
121
- name: suite.name,
122
- files: suite.files,
123
- };
124
- }),
125
- env: {
126
- NODE_ENV: 'test',
127
- },
128
- hooks: this.app.rcFile.hooks,
129
- metaFiles: this.app.rcFile.metaFiles,
130
- });
131
- /**
132
- * Share command logger with assembler, so that CLI flags like --no-ansi has
133
- * similar impact for assembler logs as well.
134
- */
135
- this.testsRunner.ui.logger = this.logger;
136
- /**
137
- * Exit command when the test runner is closed
138
- */
139
- this.testsRunner.onClose((exitCode) => {
140
- this.exitCode = exitCode;
141
- this.terminate();
142
- });
143
- /**
144
- * Exit command when the dev server crashes
145
- */
146
- this.testsRunner.onError(() => {
147
- this.exitCode = 1;
148
- this.terminate();
149
- });
150
- /**
151
- * Start the test runner in watch mode
152
- */
153
- if (this.watch) {
154
- const ts = await importTypeScript(this.app);
155
- if (!ts) {
156
- this.#logMissingDevelopmentDependency('typescript');
157
- this.exitCode = 1;
158
- return;
159
- }
160
- await this.testsRunner.runAndWatch(ts, { poll: this.poll || false });
161
- }
162
- else {
163
- await this.testsRunner.run();
164
- }
165
- }
166
- }
167
- __decorate([
168
- args.spread({
169
- description: 'Mention suite names to run tests for selected suites',
170
- required: false,
171
- })
172
- ], Test.prototype, "suites", void 0);
173
- __decorate([
174
- flags.array({ description: 'Filter tests by the filename' })
175
- ], Test.prototype, "files", void 0);
176
- __decorate([
177
- flags.array({ description: 'Filter tests by tags' })
178
- ], Test.prototype, "tags", void 0);
179
- __decorate([
180
- flags.array({ description: 'Filter tests by parent group title' })
181
- ], Test.prototype, "groups", void 0);
182
- __decorate([
183
- flags.array({ description: 'Filter tests by test title' })
184
- ], Test.prototype, "tests", void 0);
185
- __decorate([
186
- flags.array({ description: 'Activate one or more test reporters' })
187
- ], Test.prototype, "reporters", void 0);
188
- __decorate([
189
- flags.boolean({ description: 'Watch filesystem and re-run tests on file change' })
190
- ], Test.prototype, "watch", void 0);
191
- __decorate([
192
- flags.boolean({ description: 'Use polling to detect filesystem changes' })
193
- ], Test.prototype, "poll", void 0);
194
- __decorate([
195
- flags.number({ description: 'Define default timeout for all tests' })
196
- ], Test.prototype, "timeout", void 0);
197
- __decorate([
198
- flags.number({ description: 'Define default retries for all tests' })
199
- ], Test.prototype, "retries", void 0);
200
- __decorate([
201
- flags.boolean({ description: 'Execute tests failed during the last run' })
202
- ], Test.prototype, "failed", void 0);
203
- __decorate([
204
- flags.boolean({
205
- description: 'Clear the terminal for new logs after file change',
206
- showNegatedVariantInHelp: true,
207
- default: true,
208
- })
209
- ], Test.prototype, "clear", void 0);
74
+ __decorate([args.spread({
75
+ description: "Mention suite names to run tests for selected suites",
76
+ required: false
77
+ })], Test.prototype, "suites", void 0);
78
+ __decorate([flags.array({ description: "Filter tests by the filename" })], Test.prototype, "files", void 0);
79
+ __decorate([flags.array({ description: "Filter tests by tags" })], Test.prototype, "tags", void 0);
80
+ __decorate([flags.array({ description: "Filter tests by parent group title" })], Test.prototype, "groups", void 0);
81
+ __decorate([flags.array({ description: "Filter tests by test title" })], Test.prototype, "tests", void 0);
82
+ __decorate([flags.array({ description: "Activate one or more test reporters" })], Test.prototype, "reporters", void 0);
83
+ __decorate([flags.boolean({ description: "Watch filesystem and re-run tests on file change" })], Test.prototype, "watch", void 0);
84
+ __decorate([flags.boolean({ description: "Use polling to detect filesystem changes" })], Test.prototype, "poll", void 0);
85
+ __decorate([flags.number({ description: "Define default timeout for all tests" })], Test.prototype, "timeout", void 0);
86
+ __decorate([flags.number({ description: "Define default retries for all tests" })], Test.prototype, "retries", void 0);
87
+ __decorate([flags.boolean({ description: "Execute tests failed during the last run" })], Test.prototype, "failed", void 0);
88
+ __decorate([flags.boolean({
89
+ description: "Clear the terminal for new logs after file change",
90
+ showNegatedVariantInHelp: true,
91
+ default: true
92
+ })], Test.prototype, "clear", void 0);
93
+ export { Test as default };
@@ -1,9 +1,2 @@
1
- /*
2
- * @adonisjs/core
3
- *
4
- * (c) AdonisJS
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- export * from '@adonisjs/application/factories';
1
+ export * from "@adonisjs/application/factories";
2
+ export {};
@@ -1,9 +1,2 @@
1
- /*
2
- * @adonisjs/core
3
- *
4
- * (c) AdonisJS
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- export * from '@adonisjs/bodyparser/factories';
1
+ export * from "@adonisjs/bodyparser/factories";
2
+ export {};
@@ -1,46 +1,15 @@
1
- /*
2
- * @adonisjs/core
3
- *
4
- * (c) AdonisJS
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { IgnitorFactory } from "./ignitor.js";
10
- import { Ignitor } from "../../src/ignitor/main.js";
11
- import { createAceKernel } from "../../modules/ace/create_kernel.js";
12
- /**
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
- * ```
30
- */
31
- export class AceFactory {
32
- async make(ignitorOrAppRoot, options) {
33
- if (ignitorOrAppRoot instanceof Ignitor) {
34
- const app = ignitorOrAppRoot.createApp('console');
35
- await app.init();
36
- return createAceKernel(app);
37
- }
38
- const app = new IgnitorFactory()
39
- .withCoreConfig()
40
- .withCoreProviders()
41
- .create(ignitorOrAppRoot, options)
42
- .createApp('console');
43
- await app.init();
44
- return createAceKernel(app);
45
- }
46
- }
1
+ import "../../chunk-MjwdjG2f.js";
2
+ import "../../debug-DURPi9xn.js";
3
+ import "../../main-B_vbYVm1.js";
4
+ import "../../app-B6oge7b3.js";
5
+ import "../../app-BK0PN3li.js";
6
+ import "../../config_provider-CY-xuo2R.js";
7
+ import "../../main-Cn_x9YY5.js";
8
+ import "../../logger-Dha-0hp1.js";
9
+ import "../../main-CFmDHDls.js";
10
+ import "../../main-BrJQ1VAM.js";
11
+ import "../../main-q9TMzWUj.js";
12
+ import "../../ignitor-BWGmb0oD.js";
13
+ import "../../create_kernel-C7Sc67T3.js";
14
+ import { t as AceFactory } from "../../ace-Pk4_A411.js";
15
+ export { AceFactory };
@@ -1,180 +1,12 @@
1
- /*
2
- * @adonisjs/core
3
- *
4
- * (c) AdonisJS
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- import { Ignitor } from "../../src/ignitor/main.js";
10
- import { drivers } from "../../modules/hash/define_config.js";
11
- import { defineConfig as defineHttpConfig } from "../../modules/http/main.js";
12
- import { defineConfig as defineLoggerConfig } from "../../modules/logger.js";
13
- import { defineConfig as defineHashConfig } from "../../modules/hash/main.js";
14
- import { defineConfig as defineBodyParserConfig } from "../../modules/bodyparser/main.js";
15
- /**
16
- * Factory for creating and configuring AdonisJS Ignitor instances.
17
- * This factory provides a fluent API to set up applications with core providers,
18
- * configurations, and preload actions for testing and development scenarios.
19
- *
20
- * @example
21
- * ```ts
22
- * const ignitor = new IgnitorFactory()
23
- * .withCoreProviders()
24
- * .withCoreConfig()
25
- * .preload((app) => {
26
- * // Custom initialization logic
27
- * })
28
- * .create(new URL('../', import.meta.url))
29
- *
30
- * const app = ignitor.createApp('web')
31
- * await app.boot()
32
- * ```
33
- */
34
- export class IgnitorFactory {
35
- #preloadActions = [];
36
- #parameters = {};
37
- /**
38
- * A flag to know if we should load the core providers
39
- */
40
- #loadCoreProviders = false;
41
- /**
42
- * Define preload actions to run during application initialization.
43
- * These actions are executed after the application is booted.
44
- *
45
- * @param action - Function to execute during preload phase
46
- *
47
- * @example
48
- * ```ts
49
- * factory.preload((app) => {
50
- * // Register custom bindings
51
- * app.container.bind('customService', () => new CustomService())
52
- * })
53
- * ```
54
- */
55
- preload(action) {
56
- this.#preloadActions.push(action);
57
- return this;
58
- }
59
- /**
60
- * Merge core providers with user defined providers
61
- */
62
- #mergeCoreProviders(providers) {
63
- const coreProviders = [
64
- () => import('@adonisjs/core/providers/app_provider'),
65
- () => import('@adonisjs/core/providers/hash_provider'),
66
- () => import('@adonisjs/core/providers/repl_provider'),
67
- ];
68
- return coreProviders.concat(providers || []);
69
- }
70
- /**
71
- * Merge custom factory parameters with existing ones.
72
- * This allows you to customize RC file contents and application configuration.
73
- *
74
- * @param params - Parameters to merge
75
- * @param params.config - Application configuration to merge
76
- * @param params.rcFileContents - RC file contents to merge
77
- *
78
- * @example
79
- * ```ts
80
- * factory.merge({
81
- * config: {
82
- * database: { connection: 'mysql' }
83
- * },
84
- * rcFileContents: {
85
- * commands: ['./commands/CustomCommand']
86
- * }
87
- * })
88
- * ```
89
- */
90
- merge(params) {
91
- if (params.config) {
92
- this.#parameters.config = Object.assign(this.#parameters.config || {}, params.config);
93
- }
94
- if (params.rcFileContents) {
95
- this.#parameters.rcFileContents = Object.assign(this.#parameters.rcFileContents || {}, params.rcFileContents);
96
- }
97
- return this;
98
- }
99
- /**
100
- * Include core AdonisJS providers when booting the application.
101
- * This adds essential providers like app, hash, and REPL providers.
102
- *
103
- * @example
104
- * ```ts
105
- * const ignitor = new IgnitorFactory()
106
- * .withCoreProviders()
107
- * .create(appRoot)
108
- * ```
109
- */
110
- withCoreProviders() {
111
- this.#loadCoreProviders = true;
112
- return this;
113
- }
114
- /**
115
- * Merge default configuration for core AdonisJS features.
116
- * This includes configurations for HTTP, hash, logger, and bodyparser.
117
- * A shallow merge is performed with existing config.
118
- *
119
- * @example
120
- * ```ts
121
- * const ignitor = new IgnitorFactory()
122
- * .withCoreConfig()
123
- * .create(appRoot)
124
- * ```
125
- */
126
- withCoreConfig() {
127
- this.merge({
128
- config: {
129
- app: {
130
- appKey: 'averylongrandomsecretkey',
131
- http: defineHttpConfig({}),
132
- },
133
- validator: {},
134
- bodyparser: defineBodyParserConfig({}),
135
- hash: defineHashConfig({
136
- default: 'scrypt',
137
- list: {
138
- scrypt: drivers.scrypt({}),
139
- },
140
- }),
141
- logger: defineLoggerConfig({
142
- default: 'app',
143
- loggers: {
144
- app: {},
145
- },
146
- }),
147
- },
148
- });
149
- return this;
150
- }
151
- /**
152
- * Create a configured Ignitor instance with all specified parameters.
153
- *
154
- * @param appRoot - Application root directory URL
155
- * @param options - Optional Ignitor configuration options
156
- *
157
- * @example
158
- * ```ts
159
- * const ignitor = new IgnitorFactory()
160
- * .withCoreConfig()
161
- * .withCoreProviders()
162
- * .create(new URL('../', import.meta.url))
163
- * ```
164
- */
165
- create(appRoot, options) {
166
- return new Ignitor(appRoot, options).tap((app) => {
167
- app.booted(async () => {
168
- for (let action of this.#preloadActions) {
169
- await action(app);
170
- }
171
- });
172
- if (this.#loadCoreProviders) {
173
- this.#parameters.rcFileContents = this.#parameters.rcFileContents || {};
174
- this.#parameters.rcFileContents.providers = this.#mergeCoreProviders(this.#parameters.rcFileContents.providers);
175
- }
176
- this.#parameters.rcFileContents && app.rcContents(this.#parameters.rcFileContents);
177
- this.#parameters.config && app.useConfig(this.#parameters.config);
178
- });
179
- }
180
- }
1
+ import "../../chunk-MjwdjG2f.js";
2
+ import "../../debug-DURPi9xn.js";
3
+ import "../../main-B_vbYVm1.js";
4
+ import "../../app-B6oge7b3.js";
5
+ import "../../app-BK0PN3li.js";
6
+ import "../../config_provider-CY-xuo2R.js";
7
+ import "../../logger-Dha-0hp1.js";
8
+ import "../../main-CFmDHDls.js";
9
+ import "../../main-BrJQ1VAM.js";
10
+ import "../../main-q9TMzWUj.js";
11
+ import { t as IgnitorFactory } from "../../ignitor-BWGmb0oD.js";
12
+ export { IgnitorFactory };
@@ -1,11 +1,22 @@
1
- /*
2
- * @adonisjs/core
3
- *
4
- * (c) AdonisJS
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- export { AceFactory } from "./ace.js";
10
- export { IgnitorFactory } from "./ignitor.js";
11
- export { TestUtilsFactory } from "./test_utils.js";
1
+ import "../../chunk-MjwdjG2f.js";
2
+ import "../../main-kn40V-hF.js";
3
+ import "../../container-ClFvcykQ.js";
4
+ import "../../debug-DURPi9xn.js";
5
+ import "../../main-B_vbYVm1.js";
6
+ import "../../app-B6oge7b3.js";
7
+ import "../../app-BK0PN3li.js";
8
+ import "../../config_provider-CY-xuo2R.js";
9
+ import "../../string-CJ7ewUFq.js";
10
+ import "../../utils-CNQ4tlGM.js";
11
+ import "../../core-CNNCwlhc.js";
12
+ import "../../main-Cn_x9YY5.js";
13
+ import "../../logger-Dha-0hp1.js";
14
+ import "../../main-CFmDHDls.js";
15
+ import "../../main-BrJQ1VAM.js";
16
+ import "../../main-q9TMzWUj.js";
17
+ import { t as IgnitorFactory } from "../../ignitor-BWGmb0oD.js";
18
+ import "../../create_kernel-C7Sc67T3.js";
19
+ import { t as AceFactory } from "../../ace-Pk4_A411.js";
20
+ import "../../main-2-nm3TiB.js";
21
+ import { t as TestUtilsFactory } from "../../test_utils-CWLOHq7S.js";
22
+ export { AceFactory, IgnitorFactory, TestUtilsFactory };