@adonisjs/core 7.0.0 → 7.1.0

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 (162) hide show
  1. package/build/ace-DBm6EcQ-.js +37 -0
  2. package/build/app-BCcG_oDd.js +7 -0
  3. package/build/app-CAuSGb2P.js +15 -0
  4. package/build/bodyparser_middleware-H5FArWkI.js +9 -0
  5. package/build/{chunk-iKc69rpz.js → chunk-Do49iUES.js} +3 -0
  6. package/build/commands/add.d.ts +1 -0
  7. package/build/commands/add.js +64 -10
  8. package/build/commands/build.js +41 -3
  9. package/build/commands/commands.json +1 -1
  10. package/build/commands/configure.js +70 -4
  11. package/build/commands/eject.js +30 -4
  12. package/build/commands/env/add.js +62 -4
  13. package/build/commands/generate_key.js +23 -3
  14. package/build/commands/inspect_rcfile.js +26 -2
  15. package/build/commands/list/routes.d.ts +5 -0
  16. package/build/commands/list/routes.js +242 -3
  17. package/build/commands/make/command.js +33 -4
  18. package/build/commands/make/controller.js +46 -4
  19. package/build/commands/make/event.js +36 -4
  20. package/build/commands/make/exception.js +36 -4
  21. package/build/commands/make/listener.js +44 -4
  22. package/build/commands/make/middleware.js +53 -5
  23. package/build/commands/make/preload.js +55 -5
  24. package/build/commands/make/provider.js +54 -5
  25. package/build/commands/make/service.js +29 -4
  26. package/build/commands/make/test.js +63 -4
  27. package/build/commands/make/transformer.js +37 -4
  28. package/build/commands/make/validator.js +44 -4
  29. package/build/commands/make/view.js +33 -4
  30. package/build/commands/repl.js +31 -2
  31. package/build/commands/serve.js +54 -4
  32. package/build/commands/test.js +69 -4
  33. package/build/config-Coti2q6R.js +7 -0
  34. package/build/config_provider-Do9af1ze.js +35 -0
  35. package/build/container-CGfEwWof.js +7 -0
  36. package/build/{core-IpCOCkUL.js → core-XjMm_ipu.js} +51 -2
  37. package/build/create_kernel-BV3swyCg.js +4 -0
  38. package/build/{create_kernel-B7ILNhuP.js → create_kernel-D38-0Zbt.js} +41 -1
  39. package/build/debug-DWofTfIX.js +20 -0
  40. package/build/{decorate-DmrZA614.js → decorate-B9Uz0anB.js} +2 -0
  41. package/build/{define_config-0oHaj43l.js → define_config--5euEdi8.js} +54 -3
  42. package/build/dumper-3R77st8F.js +353 -0
  43. package/build/edge-BG5ZYp6Z.js +57 -0
  44. package/build/{errors-CrCO-k44.js → errors-BScZTzBu.js} +9 -1
  45. package/build/events-DlKX1ZdL.js +7 -0
  46. package/build/exceptions-B2MzIlHY.js +2 -0
  47. package/build/factories/app.js +1 -0
  48. package/build/factories/bodyparser.js +1 -0
  49. package/build/factories/core/ace.js +16 -22
  50. package/build/factories/core/ignitor.js +13 -73
  51. package/build/factories/core/main.js +25 -17
  52. package/build/factories/core/test_utils.js +22 -19
  53. package/build/factories/encryption.js +1 -0
  54. package/build/factories/events.js +1 -0
  55. package/build/factories/hash.js +1 -0
  56. package/build/factories/http.js +1 -0
  57. package/build/factories/logger.js +1 -0
  58. package/build/factories/stubs.js +75 -7
  59. package/build/ignitor-Kym3gR-I.js +169 -0
  60. package/build/index.js +11 -8
  61. package/build/logger-DIdZPHCe.js +43 -0
  62. package/build/main-B50zECAi.js +121 -0
  63. package/build/main-CRnMnrH7.js +184 -0
  64. package/build/{main-kn40V-hF.js → main-CfTiGsiS.js} +2 -0
  65. package/build/main-Ck0GqLx4.js +117 -0
  66. package/build/main-CoZI4Ezs.js +2 -0
  67. package/build/main-D1MSq4Uu.js +435 -0
  68. package/build/{main--nXd7T-C.js → main-bRYXIHgD.js} +75 -3
  69. package/build/main-zxNP7iRl.js +7 -0
  70. package/build/modules/ace/codemods.d.ts +1 -1
  71. package/build/modules/ace/codemods.js +303 -8
  72. package/build/modules/ace/commands.d.ts +5 -0
  73. package/build/modules/ace/main.js +2 -1
  74. package/build/modules/app.js +3 -5
  75. package/build/modules/bodyparser/bodyparser_middleware.js +2 -2
  76. package/build/modules/bodyparser/main.js +3 -5
  77. package/build/modules/config.js +3 -5
  78. package/build/modules/container.js +3 -5
  79. package/build/modules/dumper/main.js +29 -2
  80. package/build/modules/dumper/plugins/edge.js +2 -46
  81. package/build/modules/encryption/drivers/aes_256_cbc.js +1 -0
  82. package/build/modules/encryption/drivers/aes_256_gcm.js +1 -0
  83. package/build/modules/encryption/drivers/aes_siv.js +1 -0
  84. package/build/modules/encryption/drivers/chacha20_poly1305.js +1 -0
  85. package/build/modules/encryption/drivers/legacy.js +46 -1
  86. package/build/modules/encryption/main.js +7 -5
  87. package/build/modules/env/editor.js +1 -0
  88. package/build/modules/env/main.js +1 -0
  89. package/build/modules/events.js +3 -5
  90. package/build/modules/hash/drivers/argon.js +1 -0
  91. package/build/modules/hash/drivers/bcrypt.js +1 -0
  92. package/build/modules/hash/drivers/scrypt.js +1 -0
  93. package/build/modules/hash/main.js +4 -4
  94. package/build/modules/hash/phc_formatter.js +1 -0
  95. package/build/modules/health.js +1 -0
  96. package/build/modules/http/helpers.js +1 -0
  97. package/build/modules/http/main.js +2 -2
  98. package/build/modules/http/url_builder_client.js +1 -0
  99. package/build/modules/logger.js +3 -13
  100. package/build/modules/repl.js +3 -5
  101. package/build/modules/transformers/main.js +1 -0
  102. package/build/providers/app_provider.js +214 -15
  103. package/build/providers/edge_provider.js +90 -3
  104. package/build/providers/hash_provider.js +59 -4
  105. package/build/providers/repl_provider.js +64 -2
  106. package/build/providers/vinejs_provider.js +44 -3
  107. package/build/repl-C02Re0Yd.js +7 -0
  108. package/build/services/ace.js +11 -1
  109. package/build/services/app.js +2 -4
  110. package/build/services/config.js +7 -1
  111. package/build/services/dumper.js +13 -1
  112. package/build/services/emitter.js +8 -1
  113. package/build/services/encryption.js +8 -1
  114. package/build/services/hash.js +8 -1
  115. package/build/services/logger.js +8 -1
  116. package/build/services/repl.js +8 -1
  117. package/build/services/router.js +8 -1
  118. package/build/services/server.js +8 -1
  119. package/build/services/test_utils.js +11 -1
  120. package/build/services/url_builder.js +8 -1
  121. package/build/src/cli_formatters/routes_list.d.ts +7 -0
  122. package/build/src/exceptions.js +2 -1
  123. package/build/src/helpers/assert.js +1 -0
  124. package/build/src/helpers/http.js +1 -0
  125. package/build/src/helpers/is.js +24 -0
  126. package/build/src/helpers/main.js +2 -1
  127. package/build/src/helpers/string.js +2 -27
  128. package/build/src/helpers/types.js +18 -0
  129. package/build/src/helpers/verification_token.js +2 -45
  130. package/build/src/test_utils/main.js +9 -7
  131. package/build/src/types.js +1 -0
  132. package/build/src/vine.js +2 -32
  133. package/build/string-8_8He-HH.js +46 -0
  134. package/build/test_utils-DbJS_uEu.js +32 -0
  135. package/build/toolkit/main.js +13 -1
  136. package/build/types/ace.js +1 -0
  137. package/build/types/app.js +1 -0
  138. package/build/types/bodyparser.js +1 -0
  139. package/build/types/common.js +1 -0
  140. package/build/types/container.js +1 -0
  141. package/build/types/encryption.js +1 -0
  142. package/build/types/events.js +1 -0
  143. package/build/types/hash.js +1 -0
  144. package/build/types/health.js +1 -0
  145. package/build/types/helpers.js +1 -0
  146. package/build/types/http.js +1 -0
  147. package/build/types/logger.js +1 -0
  148. package/build/types/repl.js +1 -0
  149. package/build/types/transformers.js +1 -0
  150. package/build/utils-CKwka7OL.js +105 -0
  151. package/build/verification_token-WCrZtUgZ.js +108 -0
  152. package/build/vine-DkIupA3Z.js +97 -0
  153. package/package.json +12 -12
  154. package/build/config_provider-FIAUgvae.js +0 -13
  155. package/build/create_kernel-BD0Iqi8e.js +0 -3
  156. package/build/debug-CGQmxzGt.js +0 -3
  157. package/build/dumper-BBgqFX5a.js +0 -147
  158. package/build/main-Cxz0TyIw.js +0 -173
  159. package/build/main-DN2qEEg5.js +0 -41
  160. package/build/main-DkNgvceD.js +0 -52
  161. package/build/main-MBAMnmJb.js +0 -81
  162. package/build/utils-rRkbAPnP.js +0 -42
@@ -1,18 +1,26 @@
1
- import "../../chunk-iKc69rpz.js";
2
- import "../../main-kn40V-hF.js";
3
- import "../../debug-CGQmxzGt.js";
4
- import "../../main-Cxz0TyIw.js";
5
- import "../../config_provider-FIAUgvae.js";
6
- import "../../utils-rRkbAPnP.js";
7
- import "../../core-IpCOCkUL.js";
8
- import "../../main-MBAMnmJb.js";
9
- import "../../main-DN2qEEg5.js";
10
- import "../../errors-CrCO-k44.js";
11
- import "../../define_config-0oHaj43l.js";
12
- import "../../main-DkNgvceD.js";
13
- import { IgnitorFactory } from "./ignitor.js";
14
- import "../../create_kernel-B7ILNhuP.js";
15
- import { AceFactory } from "./ace.js";
16
- import "../../main--nXd7T-C.js";
17
- import { TestUtilsFactory } from "./test_utils.js";
1
+ import "../../chunk-Do49iUES.js";
2
+ import "../../main-CfTiGsiS.js";
3
+ import "../../container-CGfEwWof.js";
4
+ import "../../debug-DWofTfIX.js";
5
+ import "../../main-D1MSq4Uu.js";
6
+ import "../../app-CAuSGb2P.js";
7
+ import "../../app-BCcG_oDd.js";
8
+ import "../../config_provider-Do9af1ze.js";
9
+ import "../../string-8_8He-HH.js";
10
+ import "../../utils-CKwka7OL.js";
11
+ import "../../core-XjMm_ipu.js";
12
+ import "../../main-CRnMnrH7.js";
13
+ import "../../logger-DIdZPHCe.js";
14
+ import "../../exceptions-B2MzIlHY.js";
15
+ import "../../main-Ck0GqLx4.js";
16
+ import "../../errors-BScZTzBu.js";
17
+ import "../../define_config--5euEdi8.js";
18
+ import "../../main-CoZI4Ezs.js";
19
+ import "../../main-B50zECAi.js";
20
+ import "../../main-zxNP7iRl.js";
21
+ import { t as IgnitorFactory } from "../../ignitor-Kym3gR-I.js";
22
+ import "../../create_kernel-D38-0Zbt.js";
23
+ import { t as AceFactory } from "../../ace-DBm6EcQ-.js";
24
+ import "../../main-bRYXIHgD.js";
25
+ import { t as TestUtilsFactory } from "../../test_utils-DbJS_uEu.js";
18
26
  export { AceFactory, IgnitorFactory, TestUtilsFactory };
@@ -1,20 +1,23 @@
1
- import "../../chunk-iKc69rpz.js";
2
- import "../../main-kn40V-hF.js";
3
- import "../../debug-CGQmxzGt.js";
4
- import { t as Ignitor } from "../../main-Cxz0TyIw.js";
5
- import "../../config_provider-FIAUgvae.js";
6
- import "../../utils-rRkbAPnP.js";
7
- import "../../core-IpCOCkUL.js";
8
- import "../../main-DN2qEEg5.js";
9
- import "../../errors-CrCO-k44.js";
10
- import "../../define_config-0oHaj43l.js";
11
- import "../../main-DkNgvceD.js";
12
- import { IgnitorFactory } from "./ignitor.js";
13
- import { t as TestUtils } from "../../main--nXd7T-C.js";
14
- var TestUtilsFactory = class {
15
- create(ignitorOrAppRoot, options) {
16
- if (ignitorOrAppRoot instanceof Ignitor) return new TestUtils(ignitorOrAppRoot.createApp("test"));
17
- return new TestUtils(new IgnitorFactory().withCoreConfig().withCoreProviders().create(ignitorOrAppRoot, options).createApp("console"));
18
- }
19
- };
1
+ import "../../chunk-Do49iUES.js";
2
+ import "../../main-CfTiGsiS.js";
3
+ import "../../container-CGfEwWof.js";
4
+ import "../../debug-DWofTfIX.js";
5
+ import "../../main-D1MSq4Uu.js";
6
+ import "../../app-CAuSGb2P.js";
7
+ import "../../app-BCcG_oDd.js";
8
+ import "../../config_provider-Do9af1ze.js";
9
+ import "../../string-8_8He-HH.js";
10
+ import "../../utils-CKwka7OL.js";
11
+ import "../../core-XjMm_ipu.js";
12
+ import "../../logger-DIdZPHCe.js";
13
+ import "../../exceptions-B2MzIlHY.js";
14
+ import "../../main-Ck0GqLx4.js";
15
+ import "../../errors-BScZTzBu.js";
16
+ import "../../define_config--5euEdi8.js";
17
+ import "../../main-CoZI4Ezs.js";
18
+ import "../../main-B50zECAi.js";
19
+ import "../../main-zxNP7iRl.js";
20
+ import "../../ignitor-Kym3gR-I.js";
21
+ import "../../main-bRYXIHgD.js";
22
+ import { t as TestUtilsFactory } from "../../test_utils-DbJS_uEu.js";
20
23
  export { TestUtilsFactory };
@@ -1,2 +1,3 @@
1
+ import "../chunk-Do49iUES.js";
1
2
  export * from "@boringnode/encryption/factories";
2
3
  export {};
@@ -1,2 +1,3 @@
1
+ import "../chunk-Do49iUES.js";
1
2
  export * from "@adonisjs/events/factories";
2
3
  export {};
@@ -1,2 +1,3 @@
1
+ import "../chunk-Do49iUES.js";
1
2
  export * from "@adonisjs/hash/factories";
2
3
  export {};
@@ -1,2 +1,3 @@
1
+ import "../chunk-Do49iUES.js";
1
2
  export * from "@adonisjs/http-server/factories";
2
3
  export {};
@@ -1,2 +1,3 @@
1
+ import "../chunk-Do49iUES.js";
1
2
  export * from "@adonisjs/logger/factories";
2
3
  export {};
@@ -1,24 +1,92 @@
1
- import "../chunk-iKc69rpz.js";
2
- import { t as stubsRoot } from "../main-kn40V-hF.js";
3
- import "../debug-CGQmxzGt.js";
4
- import "../main-Cxz0TyIw.js";
5
- import "../config_provider-FIAUgvae.js";
6
- import "../utils-rRkbAPnP.js";
7
- import "../core-IpCOCkUL.js";
1
+ import "../chunk-Do49iUES.js";
2
+ import { t as stubsRoot } from "../main-CfTiGsiS.js";
3
+ import "../container-CGfEwWof.js";
4
+ import "../debug-DWofTfIX.js";
5
+ import "../main-D1MSq4Uu.js";
6
+ import "../app-CAuSGb2P.js";
7
+ import "../app-BCcG_oDd.js";
8
+ import "../config_provider-Do9af1ze.js";
9
+ import "../string-8_8He-HH.js";
10
+ import "../utils-CKwka7OL.js";
11
+ import "../core-XjMm_ipu.js";
8
12
  import { AppFactory } from "@adonisjs/application/factories";
13
+ //#region factories/stubs.ts
14
+ /**
15
+ * Factory for preparing and processing stub templates from the "@adonisjs/core" package.
16
+ * This factory is designed for internal testing and development purposes, utilizing
17
+ * the core package's stub root directory.
18
+ *
19
+ * Note: This class is not published as it's intended for internal testing only.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const stubsFactory = new StubsFactory()
24
+ *
25
+ * // Prepare a controller stub
26
+ * const preparedStub = await stubsFactory.prepare('controller.stub', {
27
+ * filename: 'UserController',
28
+ * entity: { name: 'User' },
29
+ * resourceful: true
30
+ * })
31
+ *
32
+ * console.log(preparedStub.contents)
33
+ * ```
34
+ */
9
35
  var StubsFactory = class {
10
36
  #parameters = {};
37
+ /**
38
+ * Returns an instance of application, either from parameters or creates a default one
39
+ */
11
40
  #getApp() {
12
41
  return this.#parameters.app || new AppFactory().create(new URL("./", import.meta.url));
13
42
  }
43
+ /**
44
+ * Merge custom factory parameters to override defaults.
45
+ * This allows you to provide a custom application instance.
46
+ *
47
+ * @param params - Parameters to merge
48
+ * @param params.app - Custom application service instance
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const customApp = new AppFactory().create(appRoot)
53
+ * const stubsFactory = new StubsFactory().merge({ app: customApp })
54
+ * ```
55
+ */
14
56
  merge(params) {
15
57
  this.#parameters = Object.assign(this.#parameters, params);
16
58
  return this;
17
59
  }
60
+ /**
61
+ * Prepare a stub template with the provided data and return the processed content.
62
+ * This method initializes the application, loads the stub, and processes it with
63
+ * the given template variables.
64
+ *
65
+ * @param stubPath - Path to the stub file relative to the stubs root
66
+ * @param data - Template data to populate the stub placeholders
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const stubsFactory = new StubsFactory()
71
+ * const preparedStub = await stubsFactory.prepare('controller.stub', {
72
+ * filename: 'UserController',
73
+ * entity: {
74
+ * name: 'User',
75
+ * modelName: 'User',
76
+ * pluralName: 'users'
77
+ * },
78
+ * resourceful: true
79
+ * })
80
+ *
81
+ * // Access the processed stub content
82
+ * console.log(preparedStub.contents)
83
+ * ```
84
+ */
18
85
  async prepare(stubPath, data) {
19
86
  const app = this.#getApp();
20
87
  await app.init();
21
88
  return (await (await app.stubs.create()).build(stubPath, { source: stubsRoot })).prepare(data);
22
89
  }
23
90
  };
91
+ //#endregion
24
92
  export { StubsFactory };
@@ -0,0 +1,169 @@
1
+ import { t as Ignitor } from "./main-D1MSq4Uu.js";
2
+ import { t as logger_exports } from "./logger-DIdZPHCe.js";
3
+ import { t as main_exports } from "./main-Ck0GqLx4.js";
4
+ import { n as drivers, t as defineConfig } from "./define_config--5euEdi8.js";
5
+ import { n as defineConfig$1, r as drivers$1 } from "./main-B50zECAi.js";
6
+ import { t as main_exports$1 } from "./main-zxNP7iRl.js";
7
+ //#region factories/core/ignitor.ts
8
+ /**
9
+ * Factory for creating and configuring AdonisJS Ignitor instances.
10
+ * This factory provides a fluent API to set up applications with core providers,
11
+ * configurations, and preload actions for testing and development scenarios.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const ignitor = new IgnitorFactory()
16
+ * .withCoreProviders()
17
+ * .withCoreConfig()
18
+ * .preload((app) => {
19
+ * // Custom initialization logic
20
+ * })
21
+ * .create(new URL('../', import.meta.url))
22
+ *
23
+ * const app = ignitor.createApp('web')
24
+ * await app.boot()
25
+ * ```
26
+ */
27
+ var IgnitorFactory = class {
28
+ #preloadActions = [];
29
+ #parameters = {};
30
+ /**
31
+ * A flag to know if we should load the core providers
32
+ */
33
+ #loadCoreProviders = false;
34
+ /**
35
+ * Define preload actions to run during application initialization.
36
+ * These actions are executed after the application is booted.
37
+ *
38
+ * @param action - Function to execute during preload phase
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * factory.preload((app) => {
43
+ * // Register custom bindings
44
+ * app.container.bind('customService', () => new CustomService())
45
+ * })
46
+ * ```
47
+ */
48
+ preload(action) {
49
+ this.#preloadActions.push(action);
50
+ return this;
51
+ }
52
+ /**
53
+ * Merge core providers with user defined providers
54
+ */
55
+ #mergeCoreProviders(providers) {
56
+ return [
57
+ () => import("@adonisjs/core/providers/app_provider"),
58
+ () => import("@adonisjs/core/providers/hash_provider"),
59
+ () => import("@adonisjs/core/providers/repl_provider")
60
+ ].concat(providers || []);
61
+ }
62
+ /**
63
+ * Merge custom factory parameters with existing ones.
64
+ * This allows you to customize RC file contents and application configuration.
65
+ *
66
+ * @param params - Parameters to merge
67
+ * @param params.config - Application configuration to merge
68
+ * @param params.rcFileContents - RC file contents to merge
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * factory.merge({
73
+ * config: {
74
+ * database: { connection: 'mysql' }
75
+ * },
76
+ * rcFileContents: {
77
+ * commands: ['./commands/CustomCommand']
78
+ * }
79
+ * })
80
+ * ```
81
+ */
82
+ merge(params) {
83
+ if (params.config) this.#parameters.config = Object.assign(this.#parameters.config || {}, params.config);
84
+ if (params.rcFileContents) this.#parameters.rcFileContents = Object.assign(this.#parameters.rcFileContents || {}, params.rcFileContents);
85
+ return this;
86
+ }
87
+ /**
88
+ * Include core AdonisJS providers when booting the application.
89
+ * This adds essential providers like app, hash, and REPL providers.
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * const ignitor = new IgnitorFactory()
94
+ * .withCoreProviders()
95
+ * .create(appRoot)
96
+ * ```
97
+ */
98
+ withCoreProviders() {
99
+ this.#loadCoreProviders = true;
100
+ return this;
101
+ }
102
+ /**
103
+ * Merge default configuration for core AdonisJS features.
104
+ * This includes configurations for HTTP, hash, logger, and bodyparser.
105
+ * A shallow merge is performed with existing config.
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * const ignitor = new IgnitorFactory()
110
+ * .withCoreConfig()
111
+ * .create(appRoot)
112
+ * ```
113
+ */
114
+ withCoreConfig() {
115
+ this.merge({ config: {
116
+ app: {
117
+ appUrl: "http://localhost:3333",
118
+ http: (0, main_exports.defineConfig)({})
119
+ },
120
+ validator: {},
121
+ encryption: defineConfig({
122
+ default: "gcm",
123
+ list: { gcm: drivers.aes256gcm({
124
+ id: "gcm",
125
+ keys: ["averylongrandomsecretkey"]
126
+ }) }
127
+ }),
128
+ bodyparser: (0, main_exports$1.defineConfig)({}),
129
+ hash: defineConfig$1({
130
+ default: "scrypt",
131
+ list: { scrypt: drivers$1.scrypt({}) }
132
+ }),
133
+ logger: (0, logger_exports.defineConfig)({
134
+ default: "app",
135
+ loggers: { app: {} }
136
+ })
137
+ } });
138
+ return this;
139
+ }
140
+ /**
141
+ * Create a configured Ignitor instance with all specified parameters.
142
+ *
143
+ * @param appRoot - Application root directory URL
144
+ * @param options - Optional Ignitor configuration options
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * const ignitor = new IgnitorFactory()
149
+ * .withCoreConfig()
150
+ * .withCoreProviders()
151
+ * .create(new URL('../', import.meta.url))
152
+ * ```
153
+ */
154
+ create(appRoot, options) {
155
+ return new Ignitor(appRoot, options).tap((app) => {
156
+ app.booted(async () => {
157
+ for (let action of this.#preloadActions) await action(app);
158
+ });
159
+ if (this.#loadCoreProviders) {
160
+ this.#parameters.rcFileContents = this.#parameters.rcFileContents || {};
161
+ this.#parameters.rcFileContents.providers = this.#mergeCoreProviders(this.#parameters.rcFileContents.providers);
162
+ }
163
+ this.#parameters.rcFileContents && app.rcContents(this.#parameters.rcFileContents);
164
+ this.#parameters.config && app.useConfig(this.#parameters.config);
165
+ });
166
+ }
167
+ };
168
+ //#endregion
169
+ export { IgnitorFactory as t };
package/build/index.js CHANGED
@@ -1,10 +1,13 @@
1
- import "./chunk-iKc69rpz.js";
2
- import { t as stubsRoot } from "./main-kn40V-hF.js";
3
- import { t as container_exports } from "./modules/container.js";
4
- import "./debug-CGQmxzGt.js";
5
- import { t as Ignitor } from "./main-Cxz0TyIw.js";
6
- import { t as configProvider } from "./config_provider-FIAUgvae.js";
7
- import "./utils-rRkbAPnP.js";
8
- import { n as prettyPrintError, r as indexEntities, t as errors } from "./core-IpCOCkUL.js";
1
+ import "./chunk-Do49iUES.js";
2
+ import { t as stubsRoot } from "./main-CfTiGsiS.js";
3
+ import { t as container_exports } from "./container-CGfEwWof.js";
4
+ import "./debug-DWofTfIX.js";
5
+ import { t as Ignitor } from "./main-D1MSq4Uu.js";
6
+ import "./app-CAuSGb2P.js";
7
+ import "./app-BCcG_oDd.js";
8
+ import { t as configProvider } from "./config_provider-Do9af1ze.js";
9
+ import "./string-8_8He-HH.js";
10
+ import "./utils-CKwka7OL.js";
11
+ import { n as prettyPrintError, r as indexEntities, t as errors } from "./core-XjMm_ipu.js";
9
12
  var inject = container_exports.inject;
10
13
  export { Ignitor, configProvider, errors, indexEntities, inject, prettyPrintError, stubsRoot };
@@ -0,0 +1,43 @@
1
+ import { n as __reExport, t as __exportAll } from "./chunk-Do49iUES.js";
2
+ import { destination } from "@adonisjs/logger";
3
+ //#region modules/logger.ts
4
+ var logger_exports = /* @__PURE__ */ __exportAll({ syncDestination: () => syncDestination });
5
+ import * as import__adonisjs_logger from "@adonisjs/logger";
6
+ __reExport(logger_exports, import__adonisjs_logger);
7
+ /**
8
+ * Creates a synchronous Pino Pretty stream for formatted log output.
9
+ *
10
+ * This function is specifically designed for testing and development environments
11
+ * where synchronous log output is preferred. By default, Pino uses asynchronous
12
+ * logging which can make it difficult to correlate logs with specific actions
13
+ * during debugging or testing.
14
+ *
15
+ * @param options - Configuration options for the pretty printer
16
+ *
17
+ * @example
18
+ * const loggerConfig = defineConfig({
19
+ * default: 'app',
20
+ * loggers: {
21
+ * app: {
22
+ * enabled: true,
23
+ * name: env.get('APP_NAME'),
24
+ * level: env.get('LOG_LEVEL'),
25
+ * desination: !app.inProduction && (await syncDestination()),
26
+ * transport: {
27
+ * targets: [targets.file({ destination: 1 })],
28
+ * },
29
+ * },
30
+ * }
31
+ * })
32
+ *
33
+ * @returns A promise that resolves to a PrettyStream instance
34
+ */
35
+ async function syncDestination(options) {
36
+ const { default: pinoPretty, isColorSupported } = await import("pino-pretty");
37
+ return isColorSupported ? pinoPretty({
38
+ ...options,
39
+ sync: true
40
+ }) : destination(1);
41
+ }
42
+ //#endregion
43
+ export { syncDestination as n, logger_exports as t };
@@ -0,0 +1,121 @@
1
+ import { n as __reExport, t as __exportAll } from "./chunk-Do49iUES.js";
2
+ import { t as debug_default } from "./debug-DWofTfIX.js";
3
+ import { t as configProvider } from "./config_provider-Do9af1ze.js";
4
+ import { InvalidArgumentsException } from "@poppinss/utils/exception";
5
+ //#region modules/hash/define_config.ts
6
+ /**
7
+ * Define config for the hash service. This function creates a configuration
8
+ * provider that lazily imports and resolves hash drivers when needed.
9
+ *
10
+ * @param config - Configuration object containing default hasher and list of hashers
11
+ * @param config.default - Optional default hasher name (must exist in the list)
12
+ * @param config.list - Record of hasher configurations or config providers
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const hashConfig = defineConfig({
17
+ * default: 'scrypt',
18
+ * list: {
19
+ * scrypt: drivers.scrypt({
20
+ * cost: 16384,
21
+ * blockSize: 8,
22
+ * parallelization: 1,
23
+ * saltSize: 16,
24
+ * keyLength: 64,
25
+ * }),
26
+ * bcrypt: drivers.bcrypt({
27
+ * rounds: 10,
28
+ * })
29
+ * }
30
+ * })
31
+ * ```
32
+ */
33
+ function defineConfig(config) {
34
+ /**
35
+ * Hashers list should always be provided
36
+ */
37
+ if (!config.list) throw new InvalidArgumentsException("Missing \"list\" property in hash config");
38
+ /**
39
+ * The default hasher should be mentioned in the list
40
+ */
41
+ if (config.default && !config.list[config.default]) throw new InvalidArgumentsException(`Missing "list.${String(config.default)}" in hash config. It is referenced by the "default" property`);
42
+ /**
43
+ * Config provider to lazily import drivers as they are used inside
44
+ * the user application
45
+ */
46
+ return configProvider.create(async (app) => {
47
+ debug_default("resolving hash config");
48
+ const hashersList = Object.keys(config.list);
49
+ const hashers = {};
50
+ for (let hasherName of hashersList) {
51
+ const hasher = config.list[hasherName];
52
+ if (typeof hasher === "function") hashers[hasherName] = hasher;
53
+ else hashers[hasherName] = await hasher.resolver(app);
54
+ }
55
+ return {
56
+ default: config.default,
57
+ list: hashers
58
+ };
59
+ });
60
+ }
61
+ /**
62
+ * Helpers to configure drivers inside the config file. These functions create
63
+ * configuration providers that lazily import and instantiate hash drivers.
64
+ *
65
+ * - Import happens when you first use the hash module
66
+ * - Construction of drivers happens when you first use a driver
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const hashConfig = defineConfig({
71
+ * default: 'bcrypt',
72
+ * list: {
73
+ * bcrypt: drivers.bcrypt({ rounds: 12 }),
74
+ * argon2: drivers.argon2({
75
+ * variant: 'id',
76
+ * memory: 65536,
77
+ * time: 3,
78
+ * parallelism: 4
79
+ * }),
80
+ * scrypt: drivers.scrypt({
81
+ * cost: 16384,
82
+ * blockSize: 8,
83
+ * parallelization: 1
84
+ * })
85
+ * }
86
+ * })
87
+ * ```
88
+ */
89
+ const drivers = {
90
+ argon2: (config) => {
91
+ return configProvider.create(async () => {
92
+ const { Argon } = await import("./modules/hash/drivers/argon.js");
93
+ debug_default("configuring argon driver");
94
+ return () => new Argon(config);
95
+ });
96
+ },
97
+ bcrypt: (config) => {
98
+ return configProvider.create(async () => {
99
+ const { Bcrypt } = await import("./modules/hash/drivers/bcrypt.js");
100
+ debug_default("configuring bcrypt driver");
101
+ return () => new Bcrypt(config);
102
+ });
103
+ },
104
+ scrypt: (config) => {
105
+ return configProvider.create(async () => {
106
+ const { Scrypt } = await import("./modules/hash/drivers/scrypt.js");
107
+ debug_default("configuring scrypt driver");
108
+ return () => new Scrypt(config);
109
+ });
110
+ }
111
+ };
112
+ //#endregion
113
+ //#region modules/hash/main.ts
114
+ var main_exports = /* @__PURE__ */ __exportAll({
115
+ defineConfig: () => defineConfig,
116
+ drivers: () => drivers
117
+ });
118
+ import * as import__adonisjs_hash from "@adonisjs/hash";
119
+ __reExport(main_exports, import__adonisjs_hash);
120
+ //#endregion
121
+ export { defineConfig as n, drivers as r, main_exports as t };