@adonisjs/core 7.0.0-next.8 → 7.0.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 (210) hide show
  1. package/README.md +62 -1
  2. package/build/chunk-iKc69rpz.js +26 -0
  3. package/build/commands/add.d.ts +4 -3
  4. package/build/commands/add.js +73 -110
  5. package/build/commands/build.js +51 -107
  6. package/build/commands/commands.json +1 -1
  7. package/build/commands/configure.js +81 -177
  8. package/build/commands/eject.js +17 -60
  9. package/build/commands/env/add.js +55 -134
  10. package/build/commands/generate_key.js +22 -66
  11. package/build/commands/inspect_rcfile.js +27 -55
  12. package/build/commands/list/routes.js +246 -116
  13. package/build/commands/make/command.d.ts +5 -0
  14. package/build/commands/make/command.js +16 -57
  15. package/build/commands/make/controller.d.ts +5 -0
  16. package/build/commands/make/controller.js +44 -120
  17. package/build/commands/make/event.d.ts +5 -0
  18. package/build/commands/make/event.js +17 -62
  19. package/build/commands/make/exception.d.ts +5 -0
  20. package/build/commands/make/exception.js +17 -62
  21. package/build/commands/make/listener.d.ts +5 -0
  22. package/build/commands/make/listener.js +37 -93
  23. package/build/commands/make/middleware.d.ts +5 -0
  24. package/build/commands/make/middleware.js +42 -101
  25. package/build/commands/make/preload.d.ts +5 -0
  26. package/build/commands/make/preload.js +48 -113
  27. package/build/commands/make/provider.d.ts +5 -0
  28. package/build/commands/make/provider.js +48 -112
  29. package/build/commands/make/service.d.ts +5 -0
  30. package/build/commands/make/service.js +17 -55
  31. package/build/commands/make/test.d.ts +5 -0
  32. package/build/commands/make/test.js +48 -132
  33. package/build/commands/make/transformer.d.ts +5 -0
  34. package/build/commands/make/transformer.js +18 -64
  35. package/build/commands/make/validator.d.ts +5 -0
  36. package/build/commands/make/validator.js +21 -80
  37. package/build/commands/make/view.d.ts +5 -0
  38. package/build/commands/make/view.js +16 -56
  39. package/build/commands/repl.js +17 -50
  40. package/build/commands/serve.js +80 -156
  41. package/build/commands/test.js +92 -208
  42. package/build/config_provider-FIAUgvae.js +13 -0
  43. package/build/core-IpCOCkUL.js +146 -0
  44. package/build/create_kernel-B7ILNhuP.js +38 -0
  45. package/build/create_kernel-BD0Iqi8e.js +3 -0
  46. package/build/debug-CGQmxzGt.js +3 -0
  47. package/build/decorate-DmrZA614.js +7 -0
  48. package/build/define_config-0oHaj43l.js +86 -0
  49. package/build/dumper-BBgqFX5a.js +147 -0
  50. package/build/errors-CrCO-k44.js +8 -0
  51. package/build/factories/app.js +2 -9
  52. package/build/factories/bodyparser.js +2 -9
  53. package/build/factories/core/ace.js +22 -45
  54. package/build/factories/core/ignitor.js +74 -180
  55. package/build/factories/core/main.js +18 -11
  56. package/build/factories/core/test_utils.js +19 -42
  57. package/build/factories/encryption.d.ts +1 -1
  58. package/build/factories/encryption.js +2 -9
  59. package/build/factories/events.js +2 -9
  60. package/build/factories/hash.js +2 -9
  61. package/build/factories/http.js +2 -9
  62. package/build/factories/logger.js +2 -9
  63. package/build/factories/stubs.d.ts +1 -6
  64. package/build/factories/stubs.js +24 -91
  65. package/build/index.d.ts +1 -1
  66. package/build/index.js +10 -46
  67. package/build/main--nXd7T-C.js +73 -0
  68. package/build/main-Cxz0TyIw.js +173 -0
  69. package/build/main-DN2qEEg5.js +41 -0
  70. package/build/main-DkNgvceD.js +52 -0
  71. package/build/main-MBAMnmJb.js +81 -0
  72. package/build/main-kn40V-hF.js +2 -0
  73. package/build/{stubs/make → make}/health/controller.stub +5 -2
  74. package/build/modules/ace/codemods.d.ts +74 -22
  75. package/build/modules/ace/codemods.js +295 -476
  76. package/build/modules/ace/main.js +2 -41
  77. package/build/modules/app.js +6 -26
  78. package/build/modules/bodyparser/bodyparser_middleware.js +3 -14
  79. package/build/modules/bodyparser/main.js +6 -9
  80. package/build/modules/config.js +6 -26
  81. package/build/modules/container.js +6 -9
  82. package/build/modules/dumper/main.js +6 -32
  83. package/build/modules/dumper/plugins/edge.js +46 -61
  84. package/build/modules/encryption/define_config.d.ts +161 -0
  85. package/build/modules/encryption/drivers/aes_256_cbc.d.ts +20 -0
  86. package/build/modules/encryption/drivers/aes_256_cbc.js +2 -0
  87. package/build/modules/encryption/drivers/aes_256_gcm.d.ts +21 -0
  88. package/build/modules/encryption/drivers/aes_256_gcm.js +2 -0
  89. package/build/modules/encryption/drivers/aes_siv.d.ts +19 -0
  90. package/build/modules/encryption/drivers/aes_siv.js +2 -0
  91. package/build/modules/encryption/drivers/chacha20_poly1305.d.ts +21 -0
  92. package/build/modules/encryption/drivers/chacha20_poly1305.js +2 -0
  93. package/build/modules/encryption/drivers/legacy.d.ts +84 -0
  94. package/build/modules/encryption/drivers/legacy.js +57 -0
  95. package/build/modules/encryption/errors.d.ts +16 -0
  96. package/build/modules/encryption/main.d.ts +89 -0
  97. package/build/modules/encryption/main.js +6 -0
  98. package/build/modules/env/editor.js +2 -9
  99. package/build/modules/env/main.js +2 -28
  100. package/build/modules/events.js +6 -9
  101. package/build/modules/hash/drivers/argon.js +2 -9
  102. package/build/modules/hash/drivers/bcrypt.js +2 -20
  103. package/build/modules/hash/drivers/scrypt.js +2 -9
  104. package/build/modules/hash/main.js +6 -28
  105. package/build/modules/hash/phc_formatter.js +2 -9
  106. package/build/modules/health.js +2 -9
  107. package/build/modules/http/helpers.d.ts +1 -0
  108. package/build/modules/http/helpers.js +2 -0
  109. package/build/modules/http/main.js +4 -15
  110. package/build/modules/http/request_validator.d.ts +3 -4
  111. package/build/modules/http/url_builder_client.js +2 -9
  112. package/build/modules/logger.d.ts +30 -0
  113. package/build/modules/logger.js +14 -9
  114. package/build/modules/repl.js +6 -9
  115. package/build/modules/transformers/main.js +2 -9
  116. package/build/providers/app_provider.d.ts +14 -21
  117. package/build/providers/app_provider.js +153 -354
  118. package/build/providers/edge_provider.js +98 -164
  119. package/build/providers/hash_provider.js +29 -91
  120. package/build/providers/repl_provider.js +66 -152
  121. package/build/providers/vinejs_provider.d.ts +1 -1
  122. package/build/providers/vinejs_provider.js +21 -65
  123. package/build/services/ace.js +1 -16
  124. package/build/services/app.js +3 -19
  125. package/build/services/config.js +1 -12
  126. package/build/services/dumper.js +4 -20
  127. package/build/services/emitter.js +1 -13
  128. package/build/services/encryption.js +1 -13
  129. package/build/services/hash.js +1 -13
  130. package/build/services/logger.js +1 -13
  131. package/build/services/repl.js +1 -13
  132. package/build/services/router.js +1 -13
  133. package/build/services/server.js +1 -13
  134. package/build/services/test_utils.js +1 -16
  135. package/build/services/url_builder.d.ts +3 -3
  136. package/build/services/url_builder.js +4 -16
  137. package/build/src/assembler_hooks/index_entities.d.ts +34 -1
  138. package/build/src/debug.d.ts +1 -1
  139. package/build/src/exceptions.js +2 -49
  140. package/build/src/helpers/assert.js +2 -55
  141. package/build/src/helpers/http.js +2 -28
  142. package/build/src/helpers/is.js +3 -31
  143. package/build/src/helpers/main.js +5 -52
  144. package/build/src/helpers/string.js +26 -76
  145. package/build/src/helpers/types.js +25 -134
  146. package/build/src/helpers/verification_token.js +46 -120
  147. package/build/src/test_utils/main.js +8 -77
  148. package/build/src/types.d.ts +53 -99
  149. package/build/src/types.js +0 -8
  150. package/build/src/utils.d.ts +1 -1
  151. package/build/src/vine.js +29 -101
  152. package/build/toolkit/main.js +19 -21
  153. package/build/types/ace.js +2 -9
  154. package/build/types/app.js +2 -9
  155. package/build/types/bodyparser.js +2 -9
  156. package/build/types/common.js +2 -9
  157. package/build/types/container.js +2 -9
  158. package/build/types/encryption.d.ts +53 -1
  159. package/build/types/encryption.js +1 -9
  160. package/build/types/events.js +2 -9
  161. package/build/types/hash.js +2 -9
  162. package/build/types/health.js +2 -9
  163. package/build/types/helpers.js +0 -8
  164. package/build/types/http.js +2 -9
  165. package/build/types/logger.js +2 -9
  166. package/build/types/repl.js +2 -9
  167. package/build/types/transformers.js +2 -9
  168. package/build/utils-rRkbAPnP.js +42 -0
  169. package/package.json +117 -62
  170. package/build/modules/ace/commands.js +0 -157
  171. package/build/modules/ace/create_kernel.js +0 -91
  172. package/build/modules/ace/kernel.js +0 -40
  173. package/build/modules/dumper/define_config.js +0 -36
  174. package/build/modules/dumper/dumper.js +0 -266
  175. package/build/modules/dumper/errors.js +0 -119
  176. package/build/modules/encryption.d.ts +0 -18
  177. package/build/modules/encryption.js +0 -26
  178. package/build/modules/hash/define_config.js +0 -125
  179. package/build/modules/http/request_validator.js +0 -100
  180. package/build/src/assembler_hooks/index_entities.js +0 -112
  181. package/build/src/cli_formatters/routes_list.js +0 -397
  182. package/build/src/config_provider.js +0 -71
  183. package/build/src/debug.js +0 -25
  184. package/build/src/ignitor/ace.js +0 -102
  185. package/build/src/ignitor/http.js +0 -159
  186. package/build/src/ignitor/main.js +0 -124
  187. package/build/src/ignitor/test.js +0 -66
  188. package/build/src/test_utils/http.js +0 -82
  189. package/build/src/utils.js +0 -114
  190. package/build/stubs/main.js +0 -9
  191. package/build/toolkit/commands/index_commands.js +0 -30
  192. /package/build/{stubs/make → make}/command/main.stub +0 -0
  193. /package/build/{stubs/make → make}/controller/actions.stub +0 -0
  194. /package/build/{stubs/make → make}/controller/api.stub +0 -0
  195. /package/build/{stubs/make → make}/controller/main.stub +0 -0
  196. /package/build/{stubs/make → make}/controller/resource.stub +0 -0
  197. /package/build/{stubs/make → make}/event/main.stub +0 -0
  198. /package/build/{stubs/make → make}/exception/main.stub +0 -0
  199. /package/build/{stubs/make → make}/health/main.stub +0 -0
  200. /package/build/{stubs/make → make}/listener/for_event.stub +0 -0
  201. /package/build/{stubs/make → make}/listener/main.stub +0 -0
  202. /package/build/{stubs/make → make}/middleware/main.stub +0 -0
  203. /package/build/{stubs/make → make}/preload/main.stub +0 -0
  204. /package/build/{stubs/make → make}/provider/main.stub +0 -0
  205. /package/build/{stubs/make → make}/service/main.stub +0 -0
  206. /package/build/{stubs/make → make}/test/main.stub +0 -0
  207. /package/build/{stubs/make → make}/transformer/main.stub +0 -0
  208. /package/build/{stubs/make → make}/validator/main.stub +0 -0
  209. /package/build/{stubs/make → make}/validator/resource.stub +0 -0
  210. /package/build/{stubs/make → make}/view/main.stub +0 -0
@@ -1,121 +1,45 @@
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 stubsRoot } from "../../main-kn40V-hF.js";
2
+ import { f as BaseCommand, l as flags, o as args } from "../../main-MBAMnmJb.js";
3
+ import { t as __decorate } from "../../decorate-DmrZA614.js";
4
+ import string from "@poppinss/utils/string";
5
+ var MakeController = class extends BaseCommand {
6
+ static commandName = "make:controller";
7
+ static description = "Create a new HTTP controller class";
8
+ static options = { allowUnknownFlags: true };
9
+ stubPath = "make/controller/main.stub";
10
+ async prepare() {
11
+ if (this.actions) this.stubPath = "make/controller/actions.stub";
12
+ if (this.resource) if (this.actions) this.logger.warning("Cannot use --resource flag with actions. Ignoring --resource");
13
+ else this.stubPath = "make/controller/resource.stub";
14
+ if (this.api) if (this.actions) this.logger.warning("Cannot use --api flag with actions. Ignoring --api");
15
+ else this.stubPath = "make/controller/api.stub";
16
+ if (this.resource && this.api && !this.actions) this.logger.warning("--api and --resource flags cannot be used together. Ignoring --resource");
17
+ }
18
+ async run() {
19
+ await (await this.createCodemods()).makeUsingStub(stubsRoot, this.stubPath, {
20
+ flags: this.parsed.flags,
21
+ actions: this.actions?.map((action) => string.camelCase(action)),
22
+ entity: this.app.generators.createEntity(this.name),
23
+ singular: this.singular
24
+ }, { contentsFromFile: this.contentsFrom });
25
+ }
14
26
  };
15
- import string from '@poppinss/utils/string';
16
- import { stubsRoot } from "../../stubs/main.js";
17
- import { args, flags, BaseCommand } from "../../modules/ace/main.js";
18
- /**
19
- * The make controller command to create an HTTP controller
20
- *
21
- * @example
22
- * ```
23
- * ace make:controller User
24
- * ace make:controller User store update
25
- * ace make:controller User --resource
26
- * ace make:controller User --api
27
- * ace make:controller User --singular
28
- * ```
29
- */
30
- export default class MakeController extends BaseCommand {
31
- /**
32
- * The command name
33
- */
34
- static commandName = 'make:controller';
35
- /**
36
- * The command description
37
- */
38
- static description = 'Create a new HTTP controller class';
39
- /**
40
- * Command options configuration
41
- */
42
- static options = {
43
- allowUnknownFlags: true,
44
- };
45
- /**
46
- * The stub to use for generating the controller
47
- */
48
- stubPath = 'make/controller/main.stub';
49
- /**
50
- * Preparing the command state
51
- */
52
- async prepare() {
53
- /**
54
- * Use actions stub
55
- */
56
- if (this.actions) {
57
- this.stubPath = 'make/controller/actions.stub';
58
- }
59
- /**
60
- * Use resource stub
61
- */
62
- if (this.resource) {
63
- if (this.actions) {
64
- this.logger.warning('Cannot use --resource flag with actions. Ignoring --resource');
65
- }
66
- else {
67
- this.stubPath = 'make/controller/resource.stub';
68
- }
69
- }
70
- /**
71
- * Use api stub
72
- */
73
- if (this.api) {
74
- if (this.actions) {
75
- this.logger.warning('Cannot use --api flag with actions. Ignoring --api');
76
- }
77
- else {
78
- this.stubPath = 'make/controller/api.stub';
79
- }
80
- }
81
- /**
82
- * Log warning when both flags are used together
83
- */
84
- if (this.resource && this.api && !this.actions) {
85
- this.logger.warning('--api and --resource flags cannot be used together. Ignoring --resource');
86
- }
87
- }
88
- async run() {
89
- const codemods = await this.createCodemods();
90
- await codemods.makeUsingStub(stubsRoot, this.stubPath, {
91
- flags: this.parsed.flags,
92
- actions: this.actions?.map((action) => string.camelCase(action)),
93
- entity: this.app.generators.createEntity(this.name),
94
- singular: this.singular,
95
- });
96
- }
97
- }
98
- __decorate([
99
- args.string({ description: 'The name of the controller' })
100
- ], MakeController.prototype, "name", void 0);
101
- __decorate([
102
- args.spread({ description: 'Create controller with custom method names', required: false })
103
- ], MakeController.prototype, "actions", void 0);
104
- __decorate([
105
- flags.boolean({
106
- description: 'Generate controller in singular form',
107
- alias: 's',
108
- })
109
- ], MakeController.prototype, "singular", void 0);
110
- __decorate([
111
- flags.boolean({
112
- description: 'Generate resourceful controller with methods to perform CRUD actions on a resource',
113
- alias: 'r',
114
- })
115
- ], MakeController.prototype, "resource", void 0);
116
- __decorate([
117
- flags.boolean({
118
- description: 'Generate resourceful controller without the "edit" and the "create" methods',
119
- alias: 'a',
120
- })
121
- ], MakeController.prototype, "api", void 0);
27
+ __decorate([args.string({ description: "The name of the controller" })], MakeController.prototype, "name", void 0);
28
+ __decorate([args.spread({
29
+ description: "Create controller with custom method names",
30
+ required: false
31
+ })], MakeController.prototype, "actions", void 0);
32
+ __decorate([flags.boolean({
33
+ description: "Generate controller in singular form",
34
+ alias: "s"
35
+ })], MakeController.prototype, "singular", void 0);
36
+ __decorate([flags.boolean({
37
+ description: "Generate resourceful controller with methods to perform CRUD actions on a resource",
38
+ alias: "r"
39
+ })], MakeController.prototype, "resource", void 0);
40
+ __decorate([flags.boolean({
41
+ description: "Generate resourceful controller without the \"edit\" and the \"create\" methods",
42
+ alias: "a"
43
+ })], MakeController.prototype, "api", void 0);
44
+ __decorate([flags.string({ description: "Use the contents of the given file as the generated output" })], MakeController.prototype, "contentsFrom", void 0);
45
+ export { MakeController as default };
@@ -30,6 +30,11 @@ export default class MakeEvent extends BaseCommand {
30
30
  * Name of the event class to create
31
31
  */
32
32
  name: string;
33
+ /**
34
+ * Read the contents from this file (if the flag exists) and use
35
+ * it as the raw contents
36
+ */
37
+ contentsFrom: string;
33
38
  /**
34
39
  * The stub template file to use for generating the event class
35
40
  */
@@ -1,63 +1,18 @@
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 stubsRoot } from "../../main-kn40V-hF.js";
2
+ import { f as BaseCommand, l as flags, o as args } from "../../main-MBAMnmJb.js";
3
+ import { t as __decorate } from "../../decorate-DmrZA614.js";
4
+ var MakeEvent = class extends BaseCommand {
5
+ static commandName = "make:event";
6
+ static description = "Create a new event class";
7
+ static options = { allowUnknownFlags: true };
8
+ stubPath = "make/event/main.stub";
9
+ async run() {
10
+ await (await this.createCodemods()).makeUsingStub(stubsRoot, this.stubPath, {
11
+ flags: this.parsed.flags,
12
+ entity: this.app.generators.createEntity(this.name)
13
+ }, { contentsFromFile: this.contentsFrom });
14
+ }
14
15
  };
15
- import { stubsRoot } from "../../stubs/main.js";
16
- import { args, BaseCommand } from "../../modules/ace/main.js";
17
- /**
18
- * Command to create a new event class.
19
- * Events are data objects that encapsulate information about something
20
- * that happened in your application and can be dispatched to listeners.
21
- *
22
- * @example
23
- * ```
24
- * ace make:event UserRegistered
25
- * ace make:event OrderCompleted
26
- * ace make:event EmailSent
27
- * ```
28
- */
29
- export default class MakeEvent extends BaseCommand {
30
- /**
31
- * The command name
32
- */
33
- static commandName = 'make:event';
34
- /**
35
- * The command description
36
- */
37
- static description = 'Create a new event class';
38
- /**
39
- * Command options configuration.
40
- * Allows unknown flags to be passed through.
41
- */
42
- static options = {
43
- allowUnknownFlags: true,
44
- };
45
- /**
46
- * The stub template file to use for generating the event class
47
- */
48
- stubPath = 'make/event/main.stub';
49
- /**
50
- * Execute the command to create a new event class.
51
- * Generates the event file with proper event structure.
52
- */
53
- async run() {
54
- const codemods = await this.createCodemods();
55
- await codemods.makeUsingStub(stubsRoot, this.stubPath, {
56
- flags: this.parsed.flags,
57
- entity: this.app.generators.createEntity(this.name),
58
- });
59
- }
60
- }
61
- __decorate([
62
- args.string({ description: 'Name of the event' })
63
- ], MakeEvent.prototype, "name", void 0);
16
+ __decorate([args.string({ description: "Name of the event" })], MakeEvent.prototype, "name", void 0);
17
+ __decorate([flags.string({ description: "Use the contents of the given file as the generated output" })], MakeEvent.prototype, "contentsFrom", void 0);
18
+ export { MakeEvent as default };
@@ -30,6 +30,11 @@ export default class MakeException extends BaseCommand {
30
30
  * Name of the exception class to create
31
31
  */
32
32
  name: string;
33
+ /**
34
+ * Read the contents from this file (if the flag exists) and use
35
+ * it as the raw contents
36
+ */
37
+ contentsFrom: string;
33
38
  /**
34
39
  * The stub template file to use for generating the exception class
35
40
  */
@@ -1,63 +1,18 @@
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 stubsRoot } from "../../main-kn40V-hF.js";
2
+ import { f as BaseCommand, l as flags, o as args } from "../../main-MBAMnmJb.js";
3
+ import { t as __decorate } from "../../decorate-DmrZA614.js";
4
+ var MakeException = class extends BaseCommand {
5
+ static commandName = "make:exception";
6
+ static description = "Create a new custom exception class";
7
+ static options = { allowUnknownFlags: true };
8
+ stubPath = "make/exception/main.stub";
9
+ async run() {
10
+ await (await this.createCodemods()).makeUsingStub(stubsRoot, this.stubPath, {
11
+ flags: this.parsed.flags,
12
+ entity: this.app.generators.createEntity(this.name)
13
+ }, { contentsFromFile: this.contentsFrom });
14
+ }
14
15
  };
15
- import { stubsRoot } from "../../stubs/main.js";
16
- import { args, BaseCommand } from "../../modules/ace/main.js";
17
- /**
18
- * Command to create a new custom exception class.
19
- * Custom exceptions allow you to define specific error types for your application
20
- * with custom error messages, status codes, and error handling logic.
21
- *
22
- * @example
23
- * ```
24
- * ace make:exception ValidationException
25
- * ace make:exception UnauthorizedException
26
- * ace make:exception ResourceNotFoundException
27
- * ```
28
- */
29
- export default class MakeException extends BaseCommand {
30
- /**
31
- * The command name
32
- */
33
- static commandName = 'make:exception';
34
- /**
35
- * The command description
36
- */
37
- static description = 'Create a new custom exception class';
38
- /**
39
- * Command options configuration.
40
- * Allows unknown flags to be passed through.
41
- */
42
- static options = {
43
- allowUnknownFlags: true,
44
- };
45
- /**
46
- * The stub template file to use for generating the exception class
47
- */
48
- stubPath = 'make/exception/main.stub';
49
- /**
50
- * Execute the command to create a new custom exception class.
51
- * Generates the exception file with proper error handling structure.
52
- */
53
- async run() {
54
- const codemods = await this.createCodemods();
55
- await codemods.makeUsingStub(stubsRoot, this.stubPath, {
56
- flags: this.parsed.flags,
57
- entity: this.app.generators.createEntity(this.name),
58
- });
59
- }
60
- }
61
- __decorate([
62
- args.string({ description: 'Name of the exception' })
63
- ], MakeException.prototype, "name", void 0);
16
+ __decorate([args.string({ description: "Name of the exception" })], MakeException.prototype, "name", void 0);
17
+ __decorate([flags.string({ description: "Use the contents of the given file as the generated output" })], MakeException.prototype, "contentsFrom", void 0);
18
+ export { MakeException as default };
@@ -34,6 +34,11 @@ export default class MakeListener extends BaseCommand {
34
34
  * Generate an event class alongside the listener and bind them together
35
35
  */
36
36
  event: string;
37
+ /**
38
+ * Read the contents from this file (if the flag exists) and use
39
+ * it as the raw contents
40
+ */
41
+ contentsFrom: string;
37
42
  /**
38
43
  * The stub template file to use for generating the event listener
39
44
  */
@@ -1,94 +1,38 @@
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 stubsRoot } from "../../main-kn40V-hF.js";
2
+ import { f as BaseCommand, l as flags, o as args } from "../../main-MBAMnmJb.js";
3
+ import { t as __decorate } from "../../decorate-DmrZA614.js";
4
+ var MakeListener = class extends BaseCommand {
5
+ static commandName = "make:listener";
6
+ static description = "Create a new event listener class";
7
+ static options = { allowUnknownFlags: true };
8
+ stubPath = "make/listener/main.stub";
9
+ prepare() {
10
+ if (this.event) this.stubPath = "make/listener/for_event.stub";
11
+ }
12
+ async run() {
13
+ const codemods = await this.createCodemods();
14
+ if (this.event) {
15
+ const { exitCode } = await this.kernel.exec("make:event", [this.event]);
16
+ if (exitCode === 0) {
17
+ const eventEntity = this.app.generators.createEntity(this.event);
18
+ await codemods.makeUsingStub(stubsRoot, this.stubPath, {
19
+ event: eventEntity,
20
+ flags: this.parsed.flags,
21
+ entity: this.app.generators.createEntity(this.name)
22
+ }, { contentsFromFile: this.contentsFrom });
23
+ }
24
+ return;
25
+ }
26
+ await codemods.makeUsingStub(stubsRoot, this.stubPath, {
27
+ flags: this.parsed.flags,
28
+ entity: this.app.generators.createEntity(this.name)
29
+ }, { contentsFromFile: this.contentsFrom });
30
+ }
14
31
  };
15
- import { stubsRoot } from "../../stubs/main.js";
16
- import { args, flags, BaseCommand } from "../../modules/ace/main.js";
17
- /**
18
- * Command to create a new event listener class.
19
- * Event listeners handle events dispatched by the application and can optionally
20
- * generate the corresponding event class automatically.
21
- *
22
- * @example
23
- * ```
24
- * ace make:listener UserRegistered
25
- * ace make:listener EmailSent --event=EmailSent
26
- * ace make:listener OrderCompleted --event=OrderEvent
27
- * ```
28
- */
29
- export default class MakeListener extends BaseCommand {
30
- /**
31
- * The command name
32
- */
33
- static commandName = 'make:listener';
34
- /**
35
- * The command description
36
- */
37
- static description = 'Create a new event listener class';
38
- /**
39
- * Command options configuration.
40
- * Allows unknown flags to be passed through.
41
- */
42
- static options = {
43
- allowUnknownFlags: true,
44
- };
45
- /**
46
- * The stub template file to use for generating the event listener
47
- */
48
- stubPath = 'make/listener/main.stub';
49
- /**
50
- * Prepare the command by selecting the appropriate stub based on options.
51
- * Uses a different stub when generating a listener for a specific event.
52
- */
53
- prepare() {
54
- if (this.event) {
55
- this.stubPath = 'make/listener/for_event.stub';
56
- }
57
- }
58
- /**
59
- * Execute the command to create a new event listener.
60
- * If an event is specified, creates the event class first,
61
- * then generates the listener with proper event binding.
62
- */
63
- async run() {
64
- const codemods = await this.createCodemods();
65
- if (this.event) {
66
- const { exitCode } = await this.kernel.exec('make:event', [this.event]);
67
- /**
68
- * Create listener only when make:event is completed successfully
69
- */
70
- if (exitCode === 0) {
71
- const eventEntity = this.app.generators.createEntity(this.event);
72
- await codemods.makeUsingStub(stubsRoot, this.stubPath, {
73
- event: eventEntity,
74
- flags: this.parsed.flags,
75
- entity: this.app.generators.createEntity(this.name),
76
- });
77
- }
78
- return;
79
- }
80
- await codemods.makeUsingStub(stubsRoot, this.stubPath, {
81
- flags: this.parsed.flags,
82
- entity: this.app.generators.createEntity(this.name),
83
- });
84
- }
85
- }
86
- __decorate([
87
- args.string({ description: 'Name of the event listener' })
88
- ], MakeListener.prototype, "name", void 0);
89
- __decorate([
90
- flags.string({
91
- description: 'Generate an event class alongside the listener',
92
- alias: 'e',
93
- })
94
- ], MakeListener.prototype, "event", void 0);
32
+ __decorate([args.string({ description: "Name of the event listener" })], MakeListener.prototype, "name", void 0);
33
+ __decorate([flags.string({
34
+ description: "Generate an event class alongside the listener",
35
+ alias: "e"
36
+ })], MakeListener.prototype, "event", void 0);
37
+ __decorate([flags.string({ description: "Use the contents of the given file as the generated output" })], MakeListener.prototype, "contentsFrom", void 0);
38
+ export { MakeListener as default };
@@ -33,6 +33,11 @@ export default class MakeMiddleware extends BaseCommand {
33
33
  * The stack in which to register the middleware
34
34
  */
35
35
  stack?: 'server' | 'named' | 'router';
36
+ /**
37
+ * Read the contents from this file (if the flag exists) and use
38
+ * it as the raw contents
39
+ */
40
+ contentsFrom: string;
36
41
  /**
37
42
  * The stub to use for generating the middleware
38
43
  */