@adonisjs/core 7.0.0-next.10 → 7.0.0-next.12

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 (181) hide show
  1. package/build/ace-DDzvaSs_.js +16 -0
  2. package/build/app-B6oge7b3.js +5 -0
  3. package/build/app-BK0PN3li.js +5 -0
  4. package/build/bodyparser_middleware-DTW0epKM.js +3 -0
  5. package/build/chunk-MjwdjG2f.js +32 -0
  6. package/build/commands/add.js +40 -110
  7. package/build/commands/build.js +51 -107
  8. package/build/commands/configure.js +82 -177
  9. package/build/commands/eject.js +17 -60
  10. package/build/commands/env/add.js +55 -134
  11. package/build/commands/generate_key.js +22 -66
  12. package/build/commands/inspect_rcfile.js +27 -55
  13. package/build/commands/list/routes.js +246 -116
  14. package/build/commands/make/command.js +15 -57
  15. package/build/commands/make/controller.js +43 -120
  16. package/build/commands/make/event.js +16 -62
  17. package/build/commands/make/exception.js +16 -62
  18. package/build/commands/make/listener.js +36 -93
  19. package/build/commands/make/middleware.js +41 -101
  20. package/build/commands/make/preload.js +47 -113
  21. package/build/commands/make/provider.js +47 -112
  22. package/build/commands/make/service.js +16 -55
  23. package/build/commands/make/test.js +47 -132
  24. package/build/commands/make/transformer.js +17 -64
  25. package/build/commands/make/validator.js +20 -80
  26. package/build/commands/make/view.js +15 -56
  27. package/build/commands/repl.js +17 -50
  28. package/build/commands/serve.js +80 -150
  29. package/build/commands/test.js +92 -202
  30. package/build/config-B2S2xfmN.js +5 -0
  31. package/build/config_provider-CY-xuo2R.js +13 -0
  32. package/build/container-ClFvcykQ.js +5 -0
  33. package/build/core-CNNCwlhc.js +95 -0
  34. package/build/create_kernel-B7zWS8Zz.js +38 -0
  35. package/build/create_kernel-CsTq0pWc.js +3 -0
  36. package/build/debug-DURPi9xn.js +3 -0
  37. package/build/decorate-DM0Sx1ye.js +7 -0
  38. package/build/dumper-C_sMcyFb.js +147 -0
  39. package/build/edge-LQdCc1L3.js +47 -0
  40. package/build/encryption-D2HGu0bU.js +5 -0
  41. package/build/events-B8hK42QT.js +5 -0
  42. package/build/factories/app.js +2 -9
  43. package/build/factories/bodyparser.js +2 -9
  44. package/build/factories/core/ace.js +15 -46
  45. package/build/factories/core/ignitor.js +12 -180
  46. package/build/factories/core/main.js +22 -11
  47. package/build/factories/core/test_utils.js +19 -43
  48. package/build/factories/encryption.js +2 -9
  49. package/build/factories/events.js +2 -9
  50. package/build/factories/hash.js +2 -9
  51. package/build/factories/http.js +2 -9
  52. package/build/factories/logger.js +2 -9
  53. package/build/factories/stubs.js +28 -91
  54. package/build/ignitor-Dil-rtCo.js +63 -0
  55. package/build/index.js +13 -46
  56. package/build/logger-Dha-0hp1.js +13 -0
  57. package/build/main-2-nm3TiB.js +72 -0
  58. package/build/main-BTUXw6He.js +171 -0
  59. package/build/main-BWftwyAK.js +81 -0
  60. package/build/main-BrJQ1VAM.js +52 -0
  61. package/build/main-CFmDHDls.js +35 -0
  62. package/build/main-D5xz2ZN1.js +5 -0
  63. package/build/main-kn40V-hF.js +2 -0
  64. package/build/main-q9TMzWUj.js +5 -0
  65. package/build/modules/ace/codemods.js +222 -477
  66. package/build/modules/ace/main.js +2 -41
  67. package/build/modules/app.js +4 -26
  68. package/build/modules/bodyparser/bodyparser_middleware.js +2 -14
  69. package/build/modules/bodyparser/main.js +4 -9
  70. package/build/modules/config.js +4 -26
  71. package/build/modules/container.js +4 -9
  72. package/build/modules/dumper/main.js +6 -32
  73. package/build/modules/dumper/plugins/edge.js +2 -62
  74. package/build/modules/encryption.js +4 -26
  75. package/build/modules/env/editor.js +2 -9
  76. package/build/modules/env/main.js +2 -28
  77. package/build/modules/events.js +4 -9
  78. package/build/modules/hash/drivers/argon.js +2 -9
  79. package/build/modules/hash/drivers/bcrypt.js +2 -20
  80. package/build/modules/hash/drivers/scrypt.js +2 -9
  81. package/build/modules/hash/main.js +6 -28
  82. package/build/modules/hash/phc_formatter.js +2 -9
  83. package/build/modules/health.js +2 -9
  84. package/build/modules/http/main.js +4 -15
  85. package/build/modules/http/url_builder_client.js +2 -9
  86. package/build/modules/logger.d.ts +30 -0
  87. package/build/modules/logger.js +4 -9
  88. package/build/modules/repl.js +4 -9
  89. package/build/modules/transformers/main.js +4 -9
  90. package/build/providers/app_provider.js +147 -359
  91. package/build/providers/edge_provider.js +97 -165
  92. package/build/providers/hash_provider.js +29 -91
  93. package/build/providers/repl_provider.js +61 -152
  94. package/build/providers/vinejs_provider.d.ts +1 -1
  95. package/build/providers/vinejs_provider.js +20 -66
  96. package/build/repl-CumYg2V_.js +5 -0
  97. package/build/services/ace.js +2 -17
  98. package/build/services/app.js +2 -21
  99. package/build/services/config.js +2 -13
  100. package/build/services/dumper.js +5 -21
  101. package/build/services/emitter.js +2 -14
  102. package/build/services/encryption.js +2 -14
  103. package/build/services/hash.js +2 -14
  104. package/build/services/logger.js +2 -14
  105. package/build/services/repl.js +2 -14
  106. package/build/services/router.js +2 -14
  107. package/build/services/server.js +2 -14
  108. package/build/services/test_utils.js +2 -17
  109. package/build/services/url_builder.js +5 -17
  110. package/build/src/exceptions.js +2 -49
  111. package/build/src/helpers/assert.js +2 -55
  112. package/build/src/helpers/http.js +2 -28
  113. package/build/src/helpers/is.js +3 -31
  114. package/build/src/helpers/main.js +5 -52
  115. package/build/src/helpers/string.js +2 -78
  116. package/build/src/helpers/types.js +26 -135
  117. package/build/src/helpers/verification_token.js +2 -120
  118. package/build/src/test_utils/main.js +5 -77
  119. package/build/src/types.js +0 -8
  120. package/build/src/vine.js +2 -105
  121. package/build/string-CJ7ewUFq.js +28 -0
  122. package/build/test_utils-c_TEaEHW.js +10 -0
  123. package/build/toolkit/main.js +19 -21
  124. package/build/types/ace.js +2 -9
  125. package/build/types/app.js +2 -9
  126. package/build/types/bodyparser.js +2 -9
  127. package/build/types/common.js +2 -9
  128. package/build/types/container.js +2 -9
  129. package/build/types/encryption.js +2 -9
  130. package/build/types/events.js +2 -9
  131. package/build/types/hash.js +2 -9
  132. package/build/types/health.js +2 -9
  133. package/build/types/helpers.js +0 -8
  134. package/build/types/http.js +2 -9
  135. package/build/types/logger.js +2 -9
  136. package/build/types/repl.js +2 -9
  137. package/build/types/transformers.js +2 -9
  138. package/build/utils-CNQ4tlGM.js +41 -0
  139. package/build/verification_token-DXsW81rl.js +46 -0
  140. package/build/vine-Bt4ymkM0.js +32 -0
  141. package/package.json +81 -31
  142. package/build/modules/ace/commands.js +0 -157
  143. package/build/modules/ace/create_kernel.js +0 -91
  144. package/build/modules/ace/kernel.js +0 -40
  145. package/build/modules/dumper/define_config.js +0 -36
  146. package/build/modules/dumper/dumper.js +0 -266
  147. package/build/modules/dumper/errors.js +0 -119
  148. package/build/modules/hash/define_config.js +0 -125
  149. package/build/modules/http/request_validator.js +0 -100
  150. package/build/src/assembler_hooks/index_entities.js +0 -112
  151. package/build/src/cli_formatters/routes_list.js +0 -397
  152. package/build/src/config_provider.js +0 -71
  153. package/build/src/debug.js +0 -25
  154. package/build/src/ignitor/ace.js +0 -102
  155. package/build/src/ignitor/http.js +0 -159
  156. package/build/src/ignitor/main.js +0 -124
  157. package/build/src/ignitor/test.js +0 -66
  158. package/build/src/test_utils/http.js +0 -82
  159. package/build/src/utils.js +0 -114
  160. package/build/stubs/main.js +0 -9
  161. package/build/toolkit/commands/index_commands.js +0 -30
  162. /package/build/{stubs/make → make}/command/main.stub +0 -0
  163. /package/build/{stubs/make → make}/controller/actions.stub +0 -0
  164. /package/build/{stubs/make → make}/controller/api.stub +0 -0
  165. /package/build/{stubs/make → make}/controller/main.stub +0 -0
  166. /package/build/{stubs/make → make}/controller/resource.stub +0 -0
  167. /package/build/{stubs/make → make}/event/main.stub +0 -0
  168. /package/build/{stubs/make → make}/exception/main.stub +0 -0
  169. /package/build/{stubs/make → make}/health/controller.stub +0 -0
  170. /package/build/{stubs/make → make}/health/main.stub +0 -0
  171. /package/build/{stubs/make → make}/listener/for_event.stub +0 -0
  172. /package/build/{stubs/make → make}/listener/main.stub +0 -0
  173. /package/build/{stubs/make → make}/middleware/main.stub +0 -0
  174. /package/build/{stubs/make → make}/preload/main.stub +0 -0
  175. /package/build/{stubs/make → make}/provider/main.stub +0 -0
  176. /package/build/{stubs/make → make}/service/main.stub +0 -0
  177. /package/build/{stubs/make → make}/test/main.stub +0 -0
  178. /package/build/{stubs/make → make}/transformer/main.stub +0 -0
  179. /package/build/{stubs/make → make}/validator/main.stub +0 -0
  180. /package/build/{stubs/make → make}/validator/resource.stub +0 -0
  181. /package/build/{stubs/make → make}/view/main.stub +0 -0
@@ -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-BTUXw6He.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-BWftwyAK.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-Dil-rtCo.js";
18
+ import "../../create_kernel-B7zWS8Zz.js";
19
+ import { t as AceFactory } from "../../ace-DDzvaSs_.js";
20
+ import "../../main-2-nm3TiB.js";
21
+ import { t as TestUtilsFactory } from "../../test_utils-c_TEaEHW.js";
22
+ export { AceFactory, IgnitorFactory, TestUtilsFactory };
@@ -1,43 +1,19 @@
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 "../../index.js";
10
- import { IgnitorFactory } from "./ignitor.js";
11
- import { TestUtils } from "../../src/test_utils/main.js";
12
- /**
13
- * Factory for creating TestUtils instances used in AdonisJS testing scenarios.
14
- * This factory provides convenient methods to set up test utilities either from
15
- * an existing Ignitor instance or by creating a new configured one.
16
- *
17
- * @example
18
- * ```ts
19
- * // Create from URL for testing
20
- * const factory = new TestUtilsFactory()
21
- * const testUtils = factory.create(new URL('../', import.meta.url))
22
- *
23
- * // Use in tests
24
- * const app = testUtils.app()
25
- * await app.boot()
26
- *
27
- * // Create HTTP client
28
- * const client = testUtils.httpClient()
29
- * const response = await client.get('/users')
30
- * ```
31
- */
32
- export class TestUtilsFactory {
33
- create(ignitorOrAppRoot, options) {
34
- if (ignitorOrAppRoot instanceof Ignitor) {
35
- return new TestUtils(ignitorOrAppRoot.createApp('test'));
36
- }
37
- return new TestUtils(new IgnitorFactory()
38
- .withCoreConfig()
39
- .withCoreProviders()
40
- .create(ignitorOrAppRoot, options)
41
- .createApp('console'));
42
- }
43
- }
1
+ import "../../chunk-MjwdjG2f.js";
2
+ import "../../main-kn40V-hF.js";
3
+ import "../../container-ClFvcykQ.js";
4
+ import "../../debug-DURPi9xn.js";
5
+ import "../../main-BTUXw6He.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 "../../logger-Dha-0hp1.js";
13
+ import "../../main-CFmDHDls.js";
14
+ import "../../main-BrJQ1VAM.js";
15
+ import "../../main-q9TMzWUj.js";
16
+ import "../../ignitor-Dil-rtCo.js";
17
+ import "../../main-2-nm3TiB.js";
18
+ import { t as TestUtilsFactory } from "../../test_utils-c_TEaEHW.js";
19
+ export { TestUtilsFactory };
@@ -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/encryption/factories';
1
+ export * from "@adonisjs/encryption/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/events/factories';
1
+ export * from "@adonisjs/events/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/hash/factories';
1
+ export * from "@adonisjs/hash/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/http-server/factories';
1
+ export * from "@adonisjs/http-server/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/logger/factories';
1
+ export * from "@adonisjs/logger/factories";
2
+ export {};
@@ -1,91 +1,28 @@
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 { AppFactory } from '@adonisjs/application/factories';
10
- import { stubsRoot } from "../index.js";
11
- /**
12
- * Factory for preparing and processing stub templates from the "@adonisjs/core" package.
13
- * This factory is designed for internal testing and development purposes, utilizing
14
- * the core package's stub root directory.
15
- *
16
- * Note: This class is not published as it's intended for internal testing only.
17
- *
18
- * @example
19
- * ```ts
20
- * const stubsFactory = new StubsFactory()
21
- *
22
- * // Prepare a controller stub
23
- * const preparedStub = await stubsFactory.prepare('controller.stub', {
24
- * filename: 'UserController',
25
- * entity: { name: 'User' },
26
- * resourceful: true
27
- * })
28
- *
29
- * console.log(preparedStub.contents)
30
- * ```
31
- */
32
- export class StubsFactory {
33
- #parameters = {};
34
- /**
35
- * Returns an instance of application, either from parameters or creates a default one
36
- */
37
- #getApp() {
38
- return this.#parameters.app || new AppFactory().create(new URL('./', import.meta.url));
39
- }
40
- /**
41
- * Merge custom factory parameters to override defaults.
42
- * This allows you to provide a custom application instance.
43
- *
44
- * @param params - Parameters to merge
45
- * @param params.app - Custom application service instance
46
- *
47
- * @example
48
- * ```ts
49
- * const customApp = new AppFactory().create(appRoot)
50
- * const stubsFactory = new StubsFactory().merge({ app: customApp })
51
- * ```
52
- */
53
- merge(params) {
54
- this.#parameters = Object.assign(this.#parameters, params);
55
- return this;
56
- }
57
- /**
58
- * Prepare a stub template with the provided data and return the processed content.
59
- * This method initializes the application, loads the stub, and processes it with
60
- * the given template variables.
61
- *
62
- * @param stubPath - Path to the stub file relative to the stubs root
63
- * @param data - Template data to populate the stub placeholders
64
- *
65
- * @example
66
- * ```ts
67
- * const stubsFactory = new StubsFactory()
68
- * const preparedStub = await stubsFactory.prepare('controller.stub', {
69
- * filename: 'UserController',
70
- * entity: {
71
- * name: 'User',
72
- * modelName: 'User',
73
- * pluralName: 'users'
74
- * },
75
- * resourceful: true
76
- * })
77
- *
78
- * // Access the processed stub content
79
- * console.log(preparedStub.contents)
80
- * ```
81
- */
82
- async prepare(stubPath, data) {
83
- const app = this.#getApp();
84
- await app.init();
85
- const stubs = await app.stubs.create();
86
- const stub = await stubs.build(stubPath, {
87
- source: stubsRoot,
88
- });
89
- return stub.prepare(data);
90
- }
91
- }
1
+ import "../chunk-MjwdjG2f.js";
2
+ import { t as stubsRoot } from "../main-kn40V-hF.js";
3
+ import "../container-ClFvcykQ.js";
4
+ import "../debug-DURPi9xn.js";
5
+ import "../main-BTUXw6He.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 { AppFactory } from "@adonisjs/application/factories";
13
+ var StubsFactory = class {
14
+ #parameters = {};
15
+ #getApp() {
16
+ return this.#parameters.app || new AppFactory().create(new URL("./", import.meta.url));
17
+ }
18
+ merge(params) {
19
+ this.#parameters = Object.assign(this.#parameters, params);
20
+ return this;
21
+ }
22
+ async prepare(stubPath, data) {
23
+ const app = this.#getApp();
24
+ await app.init();
25
+ return (await (await app.stubs.create()).build(stubPath, { source: stubsRoot })).prepare(data);
26
+ }
27
+ };
28
+ export { StubsFactory };
@@ -0,0 +1,63 @@
1
+ import { t as Ignitor } from "./main-BTUXw6He.js";
2
+ import { t as logger_exports } from "./logger-Dha-0hp1.js";
3
+ import { t as main_exports } from "./main-CFmDHDls.js";
4
+ import { n as defineConfig, r as drivers } from "./main-BrJQ1VAM.js";
5
+ import { t as main_exports$1 } from "./main-q9TMzWUj.js";
6
+ var IgnitorFactory = class {
7
+ #preloadActions = [];
8
+ #parameters = {};
9
+ #loadCoreProviders = false;
10
+ preload(action) {
11
+ this.#preloadActions.push(action);
12
+ return this;
13
+ }
14
+ #mergeCoreProviders(providers) {
15
+ return [
16
+ () => import("@adonisjs/core/providers/app_provider"),
17
+ () => import("@adonisjs/core/providers/hash_provider"),
18
+ () => import("@adonisjs/core/providers/repl_provider")
19
+ ].concat(providers || []);
20
+ }
21
+ merge(params) {
22
+ if (params.config) this.#parameters.config = Object.assign(this.#parameters.config || {}, params.config);
23
+ if (params.rcFileContents) this.#parameters.rcFileContents = Object.assign(this.#parameters.rcFileContents || {}, params.rcFileContents);
24
+ return this;
25
+ }
26
+ withCoreProviders() {
27
+ this.#loadCoreProviders = true;
28
+ return this;
29
+ }
30
+ withCoreConfig() {
31
+ this.merge({ config: {
32
+ app: {
33
+ appKey: "averylongrandomsecretkey",
34
+ http: (0, main_exports.defineConfig)({})
35
+ },
36
+ validator: {},
37
+ bodyparser: (0, main_exports$1.defineConfig)({}),
38
+ hash: defineConfig({
39
+ default: "scrypt",
40
+ list: { scrypt: drivers.scrypt({}) }
41
+ }),
42
+ logger: (0, logger_exports.defineConfig)({
43
+ default: "app",
44
+ loggers: { app: {} }
45
+ })
46
+ } });
47
+ return this;
48
+ }
49
+ create(appRoot, options) {
50
+ return new Ignitor(appRoot, options).tap((app) => {
51
+ app.booted(async () => {
52
+ for (let action of this.#preloadActions) await action(app);
53
+ });
54
+ if (this.#loadCoreProviders) {
55
+ this.#parameters.rcFileContents = this.#parameters.rcFileContents || {};
56
+ this.#parameters.rcFileContents.providers = this.#mergeCoreProviders(this.#parameters.rcFileContents.providers);
57
+ }
58
+ this.#parameters.rcFileContents && app.rcContents(this.#parameters.rcFileContents);
59
+ this.#parameters.config && app.useConfig(this.#parameters.config);
60
+ });
61
+ }
62
+ };
63
+ export { IgnitorFactory as t };
package/build/index.js CHANGED
@@ -1,46 +1,13 @@
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 { errors as aceErrors } from '@adonisjs/ace';
10
- import { errors as envErrors } from '@adonisjs/env';
11
- import { errors as appErrors } from '@adonisjs/application';
12
- import { errors as encryptionErrors } from '@adonisjs/encryption';
13
- import { errors as httpServerErrors } from '@adonisjs/http-server';
14
- export { stubsRoot } from "./stubs/main.js";
15
- export { inject } from "./modules/container.js";
16
- export { Ignitor } from "./src/ignitor/main.js";
17
- export { configProvider } from "./src/config_provider.js";
18
- export { indexEntities } from "./src/assembler_hooks/index_entities.js";
19
- /**
20
- * Aggregated errors from all modules.
21
- */
22
- export const errors = {
23
- ...encryptionErrors,
24
- ...httpServerErrors,
25
- ...appErrors,
26
- ...aceErrors,
27
- ...envErrors,
28
- };
29
- /**
30
- * Pretty prints an error with colorful output using
31
- * Youch terminal
32
- */
33
- export async function prettyPrintError(error) {
34
- if (error && typeof error === 'object' && error.code === 'E_DUMP_DIE_EXCEPTION') {
35
- console.error(error);
36
- return;
37
- }
38
- try {
39
- const { Youch } = await import('youch');
40
- const youch = new Youch();
41
- console.error(await youch.toANSI(error));
42
- }
43
- catch {
44
- console.error(error);
45
- }
46
- }
1
+ import "./chunk-MjwdjG2f.js";
2
+ import { t as stubsRoot } from "./main-kn40V-hF.js";
3
+ import { t as container_exports } from "./container-ClFvcykQ.js";
4
+ import "./debug-DURPi9xn.js";
5
+ import { t as Ignitor } from "./main-BTUXw6He.js";
6
+ import "./app-B6oge7b3.js";
7
+ import "./app-BK0PN3li.js";
8
+ import { t as configProvider } from "./config_provider-CY-xuo2R.js";
9
+ import "./string-CJ7ewUFq.js";
10
+ import "./utils-CNQ4tlGM.js";
11
+ import { n as prettyPrintError, r as indexEntities, t as errors } from "./core-CNNCwlhc.js";
12
+ var inject = container_exports.inject;
13
+ export { Ignitor, configProvider, errors, indexEntities, inject, prettyPrintError, stubsRoot };
@@ -0,0 +1,13 @@
1
+ import { n as __reExport, t as __export } from "./chunk-MjwdjG2f.js";
2
+ import { destination } from "@adonisjs/logger";
3
+ var logger_exports = /* @__PURE__ */ __export({ syncDestination: () => syncDestination });
4
+ import * as import___adonisjs_logger from "@adonisjs/logger";
5
+ __reExport(logger_exports, import___adonisjs_logger);
6
+ async function syncDestination(options) {
7
+ const { default: pinoPretty, isColorSupported } = await import("pino-pretty");
8
+ return isColorSupported ? pinoPretty({
9
+ ...options,
10
+ sync: true
11
+ }) : destination(1);
12
+ }
13
+ export { syncDestination as n, logger_exports as t };
@@ -0,0 +1,72 @@
1
+ import { t as debug_default } from "./debug-DURPi9xn.js";
2
+ import { t as main_exports } from "./main-CFmDHDls.js";
3
+ import { IncomingMessage, ServerResponse, createServer } from "node:http";
4
+ import { Socket } from "node:net";
5
+ import Macroable from "@poppinss/macroable";
6
+ var HttpServerUtils = class {
7
+ #utils;
8
+ constructor(utils) {
9
+ this.#utils = utils;
10
+ }
11
+ #listen(nodeHttpServer) {
12
+ return new Promise((resolve, reject) => {
13
+ const host = process.env.HOST || "0.0.0.0";
14
+ const port = Number(process.env.PORT || "3333");
15
+ nodeHttpServer.listen(port, host);
16
+ nodeHttpServer.once("listening", () => {
17
+ debug_default("listening to utils http server, host :%s, port: %s", host, port);
18
+ resolve({
19
+ port,
20
+ host
21
+ });
22
+ });
23
+ nodeHttpServer.once("error", (error) => {
24
+ reject(error);
25
+ });
26
+ });
27
+ }
28
+ async start(serverCallback) {
29
+ const createHTTPServer = serverCallback || createServer;
30
+ const server = await this.#utils.app.container.make("server");
31
+ await server.boot();
32
+ const httpServer = createHTTPServer(server.handle.bind(server));
33
+ server.setNodeServer(httpServer);
34
+ await this.#listen(httpServer);
35
+ return () => {
36
+ return new Promise((resolve, reject) => {
37
+ httpServer.close((error) => {
38
+ if (error) reject(error);
39
+ else resolve();
40
+ });
41
+ });
42
+ };
43
+ }
44
+ };
45
+ var TestUtils = class extends Macroable {
46
+ #booted = false;
47
+ get isBooted() {
48
+ return this.#booted;
49
+ }
50
+ constructor(app) {
51
+ super();
52
+ this.app = app;
53
+ }
54
+ async boot() {
55
+ if (!this.isBooted) {
56
+ this.#booted = true;
57
+ this.cookies = new main_exports.CookieClient(await this.app.container.make("encryption"));
58
+ }
59
+ }
60
+ httpServer() {
61
+ return new HttpServerUtils(this);
62
+ }
63
+ async createHttpContext(options = {}) {
64
+ const req = options.req || new IncomingMessage(new Socket());
65
+ const res = options.res || new ServerResponse(req);
66
+ const server = await this.app.container.make("server");
67
+ const request = server.createRequest(req, res);
68
+ const response = server.createResponse(req, res);
69
+ return server.createHttpContext(request, response, this.app.container.createResolver());
70
+ }
71
+ };
72
+ export { TestUtils as t };
@@ -0,0 +1,171 @@
1
+ import { t as debug_default } from "./debug-DURPi9xn.js";
2
+ import { n as setApp } from "./app-B6oge7b3.js";
3
+ import { t as app_exports } from "./app-BK0PN3li.js";
4
+ import { createServer } from "node:http";
5
+ var AceProcess = class {
6
+ #ignitor;
7
+ #configureCallback = () => {};
8
+ constructor(ignitor) {
9
+ this.#ignitor = ignitor;
10
+ }
11
+ configure(callback) {
12
+ this.#configureCallback = callback;
13
+ return this;
14
+ }
15
+ async handle(argv) {
16
+ const app = this.#ignitor.createApp("console");
17
+ await app.init();
18
+ const { createAceKernel } = await import("./create_kernel-CsTq0pWc.js");
19
+ const commandName = argv[argv.findIndex((value) => !value.startsWith("-"))];
20
+ const kernel = createAceKernel(app, commandName);
21
+ app.container.bindValue("ace", kernel);
22
+ kernel.loading(async (metaData) => {
23
+ if (metaData.options.startApp && !app.isReady) {
24
+ if (metaData.commandName === "repl") app.setEnvironment("repl");
25
+ await app.boot();
26
+ await app.start(() => {});
27
+ }
28
+ });
29
+ await this.#configureCallback(app);
30
+ await kernel.handle(argv);
31
+ const mainCommand = kernel.getMainCommand();
32
+ if (!mainCommand || !mainCommand.staysAlive) {
33
+ process.exitCode = kernel.exitCode;
34
+ await app.terminate();
35
+ } else app.terminating(() => {
36
+ process.exitCode = mainCommand.exitCode;
37
+ });
38
+ }
39
+ };
40
+ var TestRunnerProcess = class {
41
+ #ignitor;
42
+ #configureCallback = () => {};
43
+ constructor(ignitor) {
44
+ this.#ignitor = ignitor;
45
+ }
46
+ configure(callback) {
47
+ this.#configureCallback = callback;
48
+ return this;
49
+ }
50
+ async run(callback) {
51
+ const app = this.#ignitor.createApp("test");
52
+ await app.init();
53
+ await app.boot();
54
+ await app.start(this.#configureCallback);
55
+ await callback(app);
56
+ }
57
+ };
58
+ var HttpServerProcess = class {
59
+ #ignitor;
60
+ constructor(ignitor) {
61
+ this.#ignitor = ignitor;
62
+ }
63
+ #close(nodeHttpServer) {
64
+ return new Promise((resolve) => {
65
+ debug_default("closing http server process");
66
+ nodeHttpServer.close(() => resolve());
67
+ });
68
+ }
69
+ #monitorAppAndServer(nodeHttpServer, app, logger) {
70
+ app.terminating(async () => {
71
+ debug_default("terminating signal received");
72
+ await this.#close(nodeHttpServer);
73
+ });
74
+ nodeHttpServer.once("error", (error) => {
75
+ debug_default("http server crashed with error \"%O\"", error);
76
+ logger.fatal({ err: error }, error.message);
77
+ process.exitCode = 1;
78
+ app.terminate();
79
+ });
80
+ }
81
+ #listen(nodeHttpServer) {
82
+ return new Promise((resolve, reject) => {
83
+ const host = process.env.HOST || "0.0.0.0";
84
+ const port = Number(process.env.PORT || "3333");
85
+ nodeHttpServer.listen(port, host);
86
+ nodeHttpServer.once("listening", () => {
87
+ debug_default("listening to http server, host :%s, port: %s", host, port);
88
+ resolve({
89
+ port,
90
+ host
91
+ });
92
+ });
93
+ nodeHttpServer.once("error", (error) => {
94
+ reject(error);
95
+ });
96
+ });
97
+ }
98
+ #notifyServerHasStarted(app, logger, emitter, payload) {
99
+ app.notify({
100
+ isAdonisJS: true,
101
+ environment: "web",
102
+ ...payload
103
+ });
104
+ logger.info("started HTTP server on %s:%s", payload.host, payload.port);
105
+ emitter.emit("http:server_ready", payload);
106
+ }
107
+ async start(serverCallback) {
108
+ const startTime = process.hrtime();
109
+ const createHTTPServer = serverCallback || createServer;
110
+ const app = this.#ignitor.createApp("web");
111
+ await app.init();
112
+ await app.boot();
113
+ await app.start(async () => {
114
+ const server = await app.container.make("server");
115
+ await server.boot();
116
+ const httpServer = createHTTPServer(server.handle.bind(server));
117
+ server.setNodeServer(httpServer);
118
+ const logger = await app.container.make("logger");
119
+ const emitter = await app.container.make("emitter");
120
+ const payload = await this.#listen(httpServer);
121
+ this.#notifyServerHasStarted(app, logger, emitter, {
122
+ ...payload,
123
+ duration: process.hrtime(startTime)
124
+ });
125
+ this.#monitorAppAndServer(httpServer, app, logger);
126
+ });
127
+ }
128
+ };
129
+ var Ignitor = class {
130
+ #options;
131
+ #appRoot;
132
+ #app;
133
+ #tapCallbacks = /* @__PURE__ */ new Set();
134
+ constructor(appRoot, options = {}) {
135
+ this.#appRoot = appRoot;
136
+ this.#options = options;
137
+ }
138
+ #runTapCallbacks(app) {
139
+ this.#tapCallbacks.forEach((tapCallback) => tapCallback(app));
140
+ }
141
+ getApp() {
142
+ return this.#app;
143
+ }
144
+ createApp(environment) {
145
+ debug_default("creating application instance");
146
+ this.#app = new app_exports.Application(this.#appRoot, {
147
+ environment,
148
+ importer: this.#options.importer
149
+ });
150
+ setApp(this.#app);
151
+ this.#runTapCallbacks(this.#app);
152
+ return this.#app;
153
+ }
154
+ tap(callback) {
155
+ this.#tapCallbacks.add(callback);
156
+ return this;
157
+ }
158
+ httpServer() {
159
+ return new HttpServerProcess(this);
160
+ }
161
+ ace() {
162
+ return new AceProcess(this);
163
+ }
164
+ testRunner() {
165
+ return new TestRunnerProcess(this);
166
+ }
167
+ async terminate() {
168
+ await this.#app?.terminate();
169
+ }
170
+ };
171
+ export { Ignitor as t };