@adonisjs/core 7.0.0-next.10 → 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 (128) 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 -150
  24. package/build/commands/test.js +92 -202
  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.js +222 -477
  39. package/build/modules/ace/main.js +2 -41
  40. package/build/modules/app.js +4 -26
  41. package/build/modules/bodyparser/bodyparser_middleware.js +2 -14
  42. package/build/modules/bodyparser/main.js +4 -9
  43. package/build/modules/config.js +4 -26
  44. package/build/modules/container.js +4 -9
  45. package/build/modules/dumper/main.js +6 -32
  46. package/build/modules/dumper/plugins/edge.js +2 -62
  47. package/build/modules/encryption.js +4 -26
  48. package/build/modules/env/editor.js +2 -9
  49. package/build/modules/env/main.js +2 -28
  50. package/build/modules/events.js +4 -9
  51. package/build/modules/hash/drivers/argon.js +2 -9
  52. package/build/modules/hash/drivers/bcrypt.js +2 -20
  53. package/build/modules/hash/drivers/scrypt.js +2 -9
  54. package/build/modules/hash/main.js +6 -28
  55. package/build/modules/hash/phc_formatter.js +2 -9
  56. package/build/modules/health.js +2 -9
  57. package/build/modules/http/main.js +4 -15
  58. package/build/modules/http/url_builder_client.js +2 -9
  59. package/build/modules/logger.d.ts +30 -0
  60. package/build/modules/logger.js +4 -9
  61. package/build/modules/repl.js +4 -9
  62. package/build/modules/transformers/main.js +4 -9
  63. package/build/providers/app_provider.js +147 -359
  64. package/build/providers/edge_provider.js +97 -165
  65. package/build/providers/hash_provider.js +29 -91
  66. package/build/providers/repl_provider.js +61 -152
  67. package/build/providers/vinejs_provider.d.ts +1 -1
  68. package/build/providers/vinejs_provider.js +20 -66
  69. package/build/services/ace.js +2 -17
  70. package/build/services/app.js +2 -21
  71. package/build/services/config.js +2 -13
  72. package/build/services/dumper.js +5 -21
  73. package/build/services/emitter.js +2 -14
  74. package/build/services/encryption.js +2 -14
  75. package/build/services/hash.js +2 -14
  76. package/build/services/logger.js +2 -14
  77. package/build/services/repl.js +2 -14
  78. package/build/services/router.js +2 -14
  79. package/build/services/server.js +2 -14
  80. package/build/services/test_utils.js +2 -17
  81. package/build/services/url_builder.js +5 -17
  82. package/build/src/exceptions.js +2 -49
  83. package/build/src/helpers/assert.js +2 -55
  84. package/build/src/helpers/http.js +2 -28
  85. package/build/src/helpers/is.js +3 -31
  86. package/build/src/helpers/main.js +5 -52
  87. package/build/src/helpers/string.js +2 -78
  88. package/build/src/helpers/types.js +26 -135
  89. package/build/src/helpers/verification_token.js +2 -120
  90. package/build/src/test_utils/main.js +5 -77
  91. package/build/src/types.js +0 -8
  92. package/build/src/vine.js +2 -105
  93. package/build/types/ace.js +2 -9
  94. package/build/types/app.js +2 -9
  95. package/build/types/bodyparser.js +2 -9
  96. package/build/types/common.js +2 -9
  97. package/build/types/container.js +2 -9
  98. package/build/types/encryption.js +2 -9
  99. package/build/types/events.js +2 -9
  100. package/build/types/hash.js +2 -9
  101. package/build/types/health.js +2 -9
  102. package/build/types/helpers.js +0 -8
  103. package/build/types/http.js +2 -9
  104. package/build/types/logger.js +2 -9
  105. package/build/types/repl.js +2 -9
  106. package/build/types/transformers.js +2 -9
  107. package/package.json +76 -19
  108. package/build/modules/ace/commands.js +0 -157
  109. package/build/modules/ace/create_kernel.js +0 -91
  110. package/build/modules/ace/kernel.js +0 -40
  111. package/build/modules/dumper/define_config.js +0 -36
  112. package/build/modules/dumper/dumper.js +0 -266
  113. package/build/modules/dumper/errors.js +0 -119
  114. package/build/modules/hash/define_config.js +0 -125
  115. package/build/modules/http/request_validator.js +0 -100
  116. package/build/src/assembler_hooks/index_entities.js +0 -112
  117. package/build/src/cli_formatters/routes_list.js +0 -397
  118. package/build/src/config_provider.js +0 -71
  119. package/build/src/debug.js +0 -25
  120. package/build/src/ignitor/ace.js +0 -102
  121. package/build/src/ignitor/http.js +0 -159
  122. package/build/src/ignitor/main.js +0 -124
  123. package/build/src/ignitor/test.js +0 -66
  124. package/build/src/test_utils/http.js +0 -82
  125. package/build/src/utils.js +0 -114
  126. package/build/stubs/main.js +0 -9
  127. package/build/toolkit/commands/index_commands.js +0 -30
  128. package/build/toolkit/main.js +0 -27
@@ -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 };
@@ -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-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 "../../logger-Dha-0hp1.js";
13
+ import "../../main-CFmDHDls.js";
14
+ import "../../main-BrJQ1VAM.js";
15
+ import "../../main-q9TMzWUj.js";
16
+ import "../../ignitor-BWGmb0oD.js";
17
+ import "../../main-2-nm3TiB.js";
18
+ import { t as TestUtilsFactory } from "../../test_utils-CWLOHq7S.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-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 { 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 };
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-B_vbYVm1.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 };