@adonisjs/core 7.0.0-next.2 → 7.0.0-next.21

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 (217) hide show
  1. package/build/ace-sWl9sgM1.js +16 -0
  2. package/build/app-B6oge7b3.js +5 -0
  3. package/build/app-DNvbxVWl.js +5 -0
  4. package/build/bodyparser_middleware-BmARtnYe.js +3 -0
  5. package/build/chunk-B88MteZI.js +26 -0
  6. package/build/commands/add.d.ts +4 -3
  7. package/build/commands/add.js +76 -110
  8. package/build/commands/build.js +51 -107
  9. package/build/commands/commands.json +1 -1
  10. package/build/commands/configure.js +82 -177
  11. package/build/commands/eject.js +17 -60
  12. package/build/commands/env/add.js +55 -134
  13. package/build/commands/generate_key.js +22 -66
  14. package/build/commands/inspect_rcfile.js +27 -55
  15. package/build/commands/list/routes.js +246 -116
  16. package/build/commands/make/command.js +15 -57
  17. package/build/commands/make/controller.js +43 -120
  18. package/build/commands/make/event.js +16 -62
  19. package/build/commands/make/exception.js +16 -62
  20. package/build/commands/make/listener.js +36 -93
  21. package/build/commands/make/middleware.js +41 -101
  22. package/build/commands/make/preload.js +47 -113
  23. package/build/commands/make/provider.js +47 -112
  24. package/build/commands/make/service.js +16 -55
  25. package/build/commands/make/test.js +47 -132
  26. package/build/commands/make/transformer.js +17 -64
  27. package/build/commands/make/validator.js +20 -80
  28. package/build/commands/make/view.js +15 -56
  29. package/build/commands/repl.js +17 -50
  30. package/build/commands/serve.js +80 -156
  31. package/build/commands/test.js +92 -208
  32. package/build/config-Dd2H6-_e.js +5 -0
  33. package/build/config_provider-DWVFHOQX.js +15 -0
  34. package/build/container-uxa8LpGI.js +5 -0
  35. package/build/core-BuPP8K6N.js +140 -0
  36. package/build/create_kernel-Cn8zVtvt.js +3 -0
  37. package/build/create_kernel-Cpqqa931.js +38 -0
  38. package/build/decorate-CJcHOoD-.js +7 -0
  39. package/build/define_config-CoWy5lbf.js +62 -0
  40. package/build/dumper-BTjb8j4y.js +147 -0
  41. package/build/edge-BVYR-Vjr.js +47 -0
  42. package/build/events-C4d0OPUI.js +5 -0
  43. package/build/exceptions-DNMesP42.js +2 -0
  44. package/build/factories/app.js +2 -9
  45. package/build/factories/bodyparser.js +2 -9
  46. package/build/factories/core/ace.js +16 -46
  47. package/build/factories/core/ignitor.js +13 -180
  48. package/build/factories/core/main.js +24 -11
  49. package/build/factories/core/test_utils.js +21 -43
  50. package/build/factories/encryption.d.ts +1 -1
  51. package/build/factories/encryption.js +2 -9
  52. package/build/factories/events.js +2 -9
  53. package/build/factories/hash.js +2 -9
  54. package/build/factories/http.js +2 -9
  55. package/build/factories/logger.js +2 -9
  56. package/build/factories/stubs.js +27 -91
  57. package/build/ignitor-BrmVPN5N.js +71 -0
  58. package/build/index.d.ts +1 -1
  59. package/build/index.js +12 -46
  60. package/build/logger-0KKSqgPG.js +13 -0
  61. package/build/main-BU8NWUEG.js +73 -0
  62. package/build/main-Bfnr5tAw.js +2 -0
  63. package/build/main-BlJhxJJ2.js +81 -0
  64. package/build/main-C4B2SPOT.js +5 -0
  65. package/build/main-CZZ21eXm.js +171 -0
  66. package/build/main-D-WhqOOn.js +51 -0
  67. package/build/main-DOY5Q8Av.js +5 -0
  68. package/build/main-kn40V-hF.js +2 -0
  69. package/build/main-nojlltNo.js +30 -0
  70. package/build/{stubs/make → make}/health/controller.stub +5 -2
  71. package/build/modules/ace/codemods.d.ts +109 -14
  72. package/build/modules/ace/codemods.js +222 -382
  73. package/build/modules/ace/main.d.ts +30 -0
  74. package/build/modules/ace/main.js +2 -11
  75. package/build/modules/app.d.ts +17 -0
  76. package/build/modules/app.js +4 -9
  77. package/build/modules/bodyparser/bodyparser_middleware.js +2 -14
  78. package/build/modules/bodyparser/main.js +4 -9
  79. package/build/modules/config.d.ts +17 -0
  80. package/build/modules/config.js +4 -9
  81. package/build/modules/container.js +4 -9
  82. package/build/modules/dumper/dumper.d.ts +5 -0
  83. package/build/modules/dumper/main.d.ts +21 -0
  84. package/build/modules/dumper/main.js +6 -11
  85. package/build/modules/dumper/plugins/edge.js +2 -62
  86. package/build/modules/encryption/define_config.d.ts +128 -0
  87. package/build/modules/encryption/drivers/aes_256_cbc.d.ts +20 -0
  88. package/build/modules/encryption/drivers/aes_256_cbc.js +2 -0
  89. package/build/modules/encryption/drivers/aes_256_gcm.d.ts +21 -0
  90. package/build/modules/encryption/drivers/aes_256_gcm.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/main.d.ts +85 -0
  94. package/build/modules/encryption/main.js +5 -0
  95. package/build/modules/env/editor.js +2 -9
  96. package/build/modules/env/main.d.ts +19 -0
  97. package/build/modules/env/main.js +2 -9
  98. package/build/modules/events.js +4 -9
  99. package/build/modules/hash/drivers/argon.js +2 -9
  100. package/build/modules/hash/drivers/bcrypt.d.ts +11 -0
  101. package/build/modules/hash/drivers/bcrypt.js +2 -9
  102. package/build/modules/hash/drivers/scrypt.js +2 -9
  103. package/build/modules/hash/main.d.ts +18 -0
  104. package/build/modules/hash/main.js +5 -10
  105. package/build/modules/hash/phc_formatter.js +2 -9
  106. package/build/modules/health.js +2 -9
  107. package/build/modules/http/main.js +4 -15
  108. package/build/modules/http/request_validator.d.ts +1 -3
  109. package/build/modules/http/url_builder_client.d.ts +1 -0
  110. package/build/modules/http/url_builder_client.js +2 -0
  111. package/build/modules/logger.d.ts +30 -0
  112. package/build/modules/logger.js +4 -9
  113. package/build/modules/repl.js +4 -9
  114. package/build/modules/transformers/main.js +4 -9
  115. package/build/providers/app_provider.d.ts +14 -25
  116. package/build/providers/app_provider.js +155 -363
  117. package/build/providers/edge_provider.js +97 -114
  118. package/build/providers/hash_provider.js +28 -91
  119. package/build/providers/repl_provider.js +66 -152
  120. package/build/providers/vinejs_provider.d.ts +1 -1
  121. package/build/providers/vinejs_provider.js +19 -66
  122. package/build/repl-GSxgovJQ.js +5 -0
  123. package/build/services/ace.js +2 -17
  124. package/build/services/app.js +2 -21
  125. package/build/services/config.js +2 -13
  126. package/build/services/dumper.js +5 -21
  127. package/build/services/emitter.js +2 -14
  128. package/build/services/encryption.js +2 -14
  129. package/build/services/hash.js +2 -14
  130. package/build/services/logger.js +2 -14
  131. package/build/services/repl.js +2 -14
  132. package/build/services/router.js +2 -14
  133. package/build/services/server.js +2 -14
  134. package/build/services/test_utils.js +2 -17
  135. package/build/services/url_builder.d.ts +3 -3
  136. package/build/services/url_builder.js +5 -17
  137. package/build/src/assembler_hooks/index_entities.d.ts +29 -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.d.ts +20 -0
  142. package/build/src/helpers/http.js +2 -0
  143. package/build/src/helpers/is.js +3 -31
  144. package/build/src/helpers/main.d.ts +1 -5
  145. package/build/src/helpers/main.js +5 -56
  146. package/build/src/helpers/string.js +2 -60
  147. package/build/src/helpers/types.js +26 -135
  148. package/build/src/helpers/verification_token.js +2 -120
  149. package/build/src/test_utils/main.js +8 -77
  150. package/build/src/types.d.ts +53 -99
  151. package/build/src/types.js +0 -8
  152. package/build/src/utils.d.ts +1 -1
  153. package/build/src/vine.js +2 -97
  154. package/build/string-Cx6q_win.js +28 -0
  155. package/build/test_utils-hkQDmNpX.js +10 -0
  156. package/build/toolkit/main.js +19 -21
  157. package/build/types/ace.js +2 -9
  158. package/build/types/app.js +2 -9
  159. package/build/types/bodyparser.js +2 -9
  160. package/build/types/common.js +2 -9
  161. package/build/types/container.js +2 -9
  162. package/build/types/encryption.d.ts +39 -1
  163. package/build/types/encryption.js +1 -9
  164. package/build/types/events.js +2 -9
  165. package/build/types/hash.js +2 -9
  166. package/build/types/health.js +2 -9
  167. package/build/types/helpers.d.ts +20 -0
  168. package/build/types/helpers.js +0 -8
  169. package/build/types/http.js +2 -9
  170. package/build/types/logger.js +2 -9
  171. package/build/types/repl.js +2 -9
  172. package/build/types/transformers.js +2 -9
  173. package/build/utils-CtGytdtt.js +42 -0
  174. package/build/verification_token-DrdoU4RH.js +46 -0
  175. package/build/vine-DGint2rk.js +32 -0
  176. package/package.json +113 -60
  177. package/build/modules/ace/commands.js +0 -157
  178. package/build/modules/ace/create_kernel.js +0 -91
  179. package/build/modules/ace/kernel.js +0 -40
  180. package/build/modules/dumper/define_config.js +0 -36
  181. package/build/modules/dumper/dumper.js +0 -256
  182. package/build/modules/dumper/errors.js +0 -119
  183. package/build/modules/encryption.d.ts +0 -1
  184. package/build/modules/encryption.js +0 -9
  185. package/build/modules/hash/define_config.js +0 -125
  186. package/build/modules/http/request_validator.js +0 -100
  187. package/build/src/assembler_hooks/index_entities.js +0 -107
  188. package/build/src/cli_formatters/routes_list.js +0 -381
  189. package/build/src/config_provider.js +0 -71
  190. package/build/src/debug.js +0 -25
  191. package/build/src/ignitor/ace.js +0 -102
  192. package/build/src/ignitor/http.js +0 -146
  193. package/build/src/ignitor/main.js +0 -124
  194. package/build/src/ignitor/test.js +0 -66
  195. package/build/src/test_utils/http.js +0 -82
  196. package/build/src/utils.js +0 -104
  197. package/build/stubs/main.js +0 -9
  198. package/build/toolkit/commands/index_commands.js +0 -30
  199. /package/build/{stubs/make → make}/command/main.stub +0 -0
  200. /package/build/{stubs/make → make}/controller/actions.stub +0 -0
  201. /package/build/{stubs/make → make}/controller/api.stub +0 -0
  202. /package/build/{stubs/make → make}/controller/main.stub +0 -0
  203. /package/build/{stubs/make → make}/controller/resource.stub +0 -0
  204. /package/build/{stubs/make → make}/event/main.stub +0 -0
  205. /package/build/{stubs/make → make}/exception/main.stub +0 -0
  206. /package/build/{stubs/make → make}/health/main.stub +0 -0
  207. /package/build/{stubs/make → make}/listener/for_event.stub +0 -0
  208. /package/build/{stubs/make → make}/listener/main.stub +0 -0
  209. /package/build/{stubs/make → make}/middleware/main.stub +0 -0
  210. /package/build/{stubs/make → make}/preload/main.stub +0 -0
  211. /package/build/{stubs/make → make}/provider/main.stub +0 -0
  212. /package/build/{stubs/make → make}/service/main.stub +0 -0
  213. /package/build/{stubs/make → make}/test/main.stub +0 -0
  214. /package/build/{stubs/make → make}/transformer/main.stub +0 -0
  215. /package/build/{stubs/make → make}/validator/main.stub +0 -0
  216. /package/build/{stubs/make → make}/validator/resource.stub +0 -0
  217. /package/build/{stubs/make → make}/view/main.stub +0 -0
@@ -1,114 +1,97 @@
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 edge from 'edge.js';
10
- import { pluginEdgeDumper } from "../modules/dumper/plugins/edge.js";
11
- import { BriskRoute, HttpContext } from "../modules/http/main.js";
12
- /**
13
- * The Edge service provider configures Edge to work within
14
- * an AdonisJS application environment
15
- *
16
- * This provider integrates EdgeJS template engine with AdonisJS by:
17
- * - Mounting the views directory
18
- * - Configuring template caching for production
19
- * - Adding global helpers for route generation
20
- * - Creating isolated renderer instances for HTTP contexts
21
- * - Adding render macro to BriskRoute for template rendering
22
- *
23
- * @example
24
- * const provider = new EdgeServiceProvider(app)
25
- * await provider.boot()
26
- */
27
- export default class EdgeServiceProvider {
28
- app;
29
- /**
30
- * Edge service provider constructor
31
- *
32
- * Sets the usingEdgeJS flag to true to indicate EdgeJS is being used.
33
- *
34
- * @param app - The application service instance
35
- */
36
- constructor(app) {
37
- this.app = app;
38
- this.app.usingEdgeJS = true;
39
- }
40
- /**
41
- * Bridge AdonisJS and Edge
42
- *
43
- * Configures EdgeJS integration by:
44
- * - Setting up template mounting and caching
45
- * - Defining global helpers (route, signedRoute, app, config)
46
- * - Adding view getter to HttpContext for isolated rendering
47
- * - Adding render macro to BriskRoute
48
- * - Registering dumper plugin
49
- *
50
- * @example
51
- * await provider.boot()
52
- * // Now edge templates can use {{ route('home') }} helper
53
- */
54
- async boot() {
55
- const app = this.app;
56
- const router = await this.app.container.make('router');
57
- const dumper = await this.app.container.make('dumper');
58
- function edgeConfigResolver(key, defaultValue) {
59
- return app.config.get(key, defaultValue);
60
- }
61
- edgeConfigResolver.has = function (key) {
62
- return app.config.has(key);
63
- };
64
- /**
65
- * Mount the default disk
66
- */
67
- edge.mount(app.viewsPath());
68
- /**
69
- * Cache templates in production
70
- */
71
- edge.configure({ cache: app.inProduction });
72
- /**
73
- * Define Edge global helpers
74
- * @deprecated
75
- */
76
- edge.global('route', function (...args) {
77
- return router.makeUrl(...args);
78
- });
79
- edge.global('signedRoute', function (...args) {
80
- return router.makeSignedUrl(...args);
81
- });
82
- edge.global('app', app);
83
- edge.global('config', edgeConfigResolver);
84
- /**
85
- * Route helpers
86
- */
87
- edge.global('urlFor', function (...args) {
88
- return router.urlBuilder.urlFor(...args);
89
- });
90
- edge.global('signedUrlFor', function (...args) {
91
- return router.urlBuilder.signedUrlFor(...args);
92
- });
93
- /**
94
- * Creating a isolated instance of edge renderer
95
- */
96
- HttpContext.getter('view', function () {
97
- return edge.createRenderer().share({
98
- request: this.request,
99
- });
100
- }, true);
101
- /**
102
- * Adding brisk route to render templates without an
103
- * explicit handler
104
- */
105
- BriskRoute.macro('render', function (template, data) {
106
- function rendersTemplate({ view }) {
107
- return view.render(template, data);
108
- }
109
- Object.defineProperty(rendersTemplate, 'listArgs', { value: template, writable: false });
110
- return this.setHandler(rendersTemplate);
111
- });
112
- edge.use(pluginEdgeDumper(dumper));
113
- }
114
- }
1
+ import "../chunk-B88MteZI.js";
2
+ import { t as main_exports } from "../main-nojlltNo.js";
3
+ import { t as pluginEdgeDumper } from "../edge-BVYR-Vjr.js";
4
+ import edge from "edge.js";
5
+ var EdgeServiceProvider = class {
6
+ constructor(app) {
7
+ this.app = app;
8
+ this.app.usingEdgeJS = true;
9
+ }
10
+ async boot() {
11
+ const app = this.app;
12
+ const qs = new main_exports.Qs(app.config.get("app.http.qs", {}));
13
+ const router = await this.app.container.make("router");
14
+ const dumper = await this.app.container.make("dumper");
15
+ function edgeConfigResolver(key, defaultValue) {
16
+ return app.config.get(key, defaultValue);
17
+ }
18
+ edgeConfigResolver.has = function(key) {
19
+ return app.config.has(key);
20
+ };
21
+ function clientRoutes() {
22
+ const routes = router.toJSON();
23
+ return Object.keys(routes).reduce((result, domain) => {
24
+ result[domain] = routes[domain].reduce((routesResult, route) => {
25
+ if (!route.name) return routesResult;
26
+ routesResult.push({
27
+ domain: route.domain,
28
+ methods: route.methods,
29
+ pattern: route.pattern,
30
+ tokens: route.tokens,
31
+ name: route.name
32
+ });
33
+ return routesResult;
34
+ }, []);
35
+ return result;
36
+ }, {});
37
+ }
38
+ edge.mount(app.viewsPath());
39
+ edge.configure({ cache: app.inProduction });
40
+ edge.global("route", function(...args) {
41
+ return router.makeUrl(...args);
42
+ });
43
+ edge.global("signedRoute", function(...args) {
44
+ return router.makeSignedUrl(...args);
45
+ });
46
+ edge.global("app", app);
47
+ edge.global("config", edgeConfigResolver);
48
+ edge.global("routes", function() {
49
+ return clientRoutes();
50
+ });
51
+ edge.global("routesJSON", function() {
52
+ return JSON.stringify(clientRoutes());
53
+ });
54
+ edge.global("urlFor", function(...args) {
55
+ return router.urlBuilder.urlFor(...args);
56
+ });
57
+ edge.global("signedUrlFor", function(...args) {
58
+ return router.urlBuilder.signedUrlFor(...args);
59
+ });
60
+ edge.global("qs", qs);
61
+ edge.global("formAttributes", function(route, method, params, options) {
62
+ options = options ?? {};
63
+ method = method.toUpperCase();
64
+ const original = method;
65
+ if (method !== "GET" && method !== "POST") {
66
+ method = "POST";
67
+ options = {
68
+ ...options,
69
+ qs: {
70
+ _method: original,
71
+ ...options.qs
72
+ }
73
+ };
74
+ }
75
+ const { action } = router.urlBuilder.urlFor.method(original, route, params, options).form;
76
+ return {
77
+ action,
78
+ method
79
+ };
80
+ });
81
+ main_exports.HttpContext.getter("view", function() {
82
+ return edge.createRenderer().share({ request: this.request });
83
+ }, true);
84
+ main_exports.BriskRoute.macro("render", function(template, data) {
85
+ function rendersTemplate({ view }) {
86
+ return view.render(template, data);
87
+ }
88
+ Object.defineProperty(rendersTemplate, "listArgs", {
89
+ value: template,
90
+ writable: false
91
+ });
92
+ return this.setHandler(rendersTemplate);
93
+ });
94
+ edge.use(pluginEdgeDumper(dumper));
95
+ }
96
+ };
97
+ export { EdgeServiceProvider as default };
@@ -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 { RuntimeException } from '@poppinss/utils/exception';
10
- import { Hash } from "../modules/hash/main.js";
11
- import { configProvider } from "../src/config_provider.js";
12
- /**
13
- * Registers the passwords hasher with the container
14
- *
15
- * This provider sets up password hashing functionality by:
16
- * - Registering the HashManager with configuration from config/hash.ts
17
- * - Providing a Hash class that uses the default hasher
18
- * - Supporting multiple hashing drivers (bcrypt, argon2, etc.)
19
- *
20
- * @example
21
- * const provider = new HashServiceProvider(app)
22
- * provider.register()
23
- * const hash = await app.container.make('hash')
24
- */
25
- export default class HashServiceProvider {
26
- app;
27
- /**
28
- * Hash service provider constructor
29
- *
30
- * @param app - The application service instance
31
- */
32
- constructor(app) {
33
- this.app = app;
34
- }
35
- /**
36
- * Registering the hash class to resolve an instance with the
37
- * default hasher.
38
- *
39
- * Creates a singleton binding for the Hash class that resolves
40
- * the default hasher from the hash manager.
41
- *
42
- * @example
43
- * const hash = await container.make(Hash)
44
- * const hashed = await hash.make('password')
45
- */
46
- registerHash() {
47
- this.app.container.singleton(Hash, async (resolver) => {
48
- const hashManager = await resolver.make('hash');
49
- return hashManager.use();
50
- });
51
- }
52
- /**
53
- * Registers the hash manager with the container
54
- *
55
- * Creates a singleton binding for 'hash' that instantiates
56
- * the HashManager with configuration from config/hash.ts file.
57
- * Throws an error if the configuration is invalid.
58
- *
59
- * @example
60
- * const hashManager = await container.make('hash')
61
- * const bcryptHasher = hashManager.use('bcrypt')
62
- */
63
- registerHashManager() {
64
- this.app.container.singleton('hash', async () => {
65
- const hashConfigProvider = this.app.config.get('hash');
66
- /**
67
- * Resolve config from the provider
68
- */
69
- const config = await configProvider.resolve(this.app, hashConfigProvider);
70
- if (!config) {
71
- throw new RuntimeException('Invalid "config/hash.ts" file. Make sure you are using the "defineConfig" method');
72
- }
73
- const { HashManager } = await import('../modules/hash/main.js');
74
- return new HashManager(config);
75
- });
76
- }
77
- /**
78
- * Registers bindings
79
- *
80
- * Called during the application bootstrap phase to register
81
- * the hash manager and hash class with the IoC container.
82
- *
83
- * @example
84
- * const provider = new HashServiceProvider(app)
85
- * provider.register() // Registers hash services
86
- */
87
- register() {
88
- this.registerHashManager();
89
- this.registerHash();
90
- }
91
- }
1
+ import "../chunk-B88MteZI.js";
2
+ import { t as configProvider } from "../config_provider-DWVFHOQX.js";
3
+ import { t as main_exports } from "../main-D-WhqOOn.js";
4
+ import { RuntimeException } from "@poppinss/utils/exception";
5
+ var HashServiceProvider = class {
6
+ constructor(app) {
7
+ this.app = app;
8
+ }
9
+ registerHash() {
10
+ this.app.container.singleton(main_exports.Hash, async (resolver) => {
11
+ return (await resolver.make("hash")).use();
12
+ });
13
+ }
14
+ registerHashManager() {
15
+ this.app.container.singleton("hash", async () => {
16
+ const hashConfigProvider = this.app.config.get("hash");
17
+ const config = await configProvider.resolve(this.app, hashConfigProvider);
18
+ if (!config) throw new RuntimeException("Invalid \"config/hash.ts\" file. Make sure you are using the \"defineConfig\" method");
19
+ const { HashManager } = await import("../modules/hash/main.js");
20
+ return new HashManager(config);
21
+ });
22
+ }
23
+ register() {
24
+ this.registerHashManager();
25
+ this.registerHash();
26
+ }
27
+ };
28
+ export { HashServiceProvider as default };
@@ -1,154 +1,68 @@
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 { join } from 'node:path';
10
- import { homedir } from 'node:os';
11
- import { fsImportAll } from '@poppinss/utils/fs';
12
- import { Repl } from "../modules/repl.js";
13
- /**
14
- * Resolves a container binding and sets it on the REPL
15
- * context
16
- *
17
- * This helper function makes a service from the container and
18
- * adds it to the REPL context with a notification message.
19
- *
20
- * @param app - The application service instance
21
- * @param repl - The REPL instance to add the binding to
22
- * @param binding - The container binding key to resolve
23
- *
24
- * @example
25
- * await resolveBindingForRepl(app, repl, 'router')
26
- * // Now 'router' variable is available in REPL
27
- */
1
+ import "../chunk-B88MteZI.js";
2
+ import { t as repl_exports } from "../repl-GSxgovJQ.js";
3
+ import { join } from "node:path";
4
+ import { homedir } from "node:os";
5
+ import { fsImportAll } from "@poppinss/utils/fs";
28
6
  async function resolveBindingForRepl(app, repl, binding) {
29
- repl.server.context[binding] = await app.container.make(binding);
30
- repl.notify(`Loaded "${binding}" service. You can access it using the "${repl.colors.underline(binding)}" variable`);
31
- }
32
- /**
33
- * REPL Service Provider configures the interactive Node.js REPL
34
- * for AdonisJS applications
35
- *
36
- * This provider sets up:
37
- * - REPL instance with history file support
38
- * - Helper methods for importing modules and making container bindings
39
- * - Quick access methods for loading common services (app, router, etc.)
40
- * - Utility methods for development and debugging
41
- *
42
- * @example
43
- * const provider = new ReplServiceProvider(app)
44
- * provider.register()
45
- * await provider.boot()
46
- */
47
- export default class ReplServiceProvider {
48
- app;
49
- /**
50
- * REPL service provider constructor
51
- *
52
- * @param app - The application service instance
53
- */
54
- constructor(app) {
55
- this.app = app;
56
- }
57
- /**
58
- * Registers the REPL binding
59
- *
60
- * Creates a singleton binding for the REPL with history file
61
- * support in the user's home directory.
62
- *
63
- * @example
64
- * const provider = new ReplServiceProvider(app)
65
- * provider.register()
66
- * const repl = await app.container.make('repl')
67
- */
68
- register() {
69
- this.app.container.singleton(Repl, async () => {
70
- return new Repl({
71
- historyFilePath: join(homedir(), '.adonisjs_v6_repl_history'),
72
- });
73
- });
74
- this.app.container.alias('repl', Repl);
75
- }
76
- /**
77
- * Registering REPL bindings during provider boot
78
- *
79
- * Adds helper methods to the REPL instance including:
80
- * - importDefault: Import default export from modules
81
- * - importAll: Import all files from a directory
82
- * - make: Create instances using container.make
83
- * - load* methods: Quick access to common services
84
- * - loadHelpers: Load utility helper functions
85
- *
86
- * @example
87
- * await provider.boot()
88
- * // REPL now has helper methods available
89
- */
90
- async boot() {
91
- this.app.container.resolving('repl', (repl) => {
92
- repl.addMethod('importDefault', (_, modulePath) => {
93
- return this.app.importDefault(modulePath);
94
- }, {
95
- description: 'Returns the default export for a module',
96
- });
97
- repl.addMethod('importAll', (_, dirPath) => {
98
- return fsImportAll(this.app.makeURL(dirPath), {
99
- ignoreMissingRoot: false,
100
- });
101
- }, {
102
- description: 'Import all files from a directory and assign them to a variable',
103
- });
104
- repl.addMethod('make', (_, service, runtimeValues) => {
105
- return this.app.container.make(service, runtimeValues);
106
- }, {
107
- description: 'Make class instance using "container.make" method',
108
- });
109
- repl.addMethod('loadApp', () => {
110
- return resolveBindingForRepl(this.app, repl, 'app');
111
- }, {
112
- description: 'Load "app" service in the REPL context',
113
- });
114
- repl.addMethod('loadEncryption', () => {
115
- return resolveBindingForRepl(this.app, repl, 'encryption');
116
- }, {
117
- description: 'Load "encryption" service in the REPL context',
118
- });
119
- repl.addMethod('loadHash', () => {
120
- return resolveBindingForRepl(this.app, repl, 'hash');
121
- }, {
122
- description: 'Load "hash" service in the REPL context',
123
- });
124
- repl.addMethod('loadRouter', () => {
125
- return resolveBindingForRepl(this.app, repl, 'router');
126
- }, {
127
- description: 'Load "router" service in the REPL context',
128
- });
129
- repl.addMethod('loadConfig', () => {
130
- return resolveBindingForRepl(this.app, repl, 'config');
131
- }, {
132
- description: 'Load "config" service in the REPL context',
133
- });
134
- repl.addMethod('loadTestUtils', () => {
135
- return resolveBindingForRepl(this.app, repl, 'testUtils');
136
- }, {
137
- description: 'Load "testUtils" service in the REPL context',
138
- });
139
- repl.addMethod('loadHelpers', async () => {
140
- const { default: isModule } = await import('../src/helpers/is.js');
141
- const { default: stringModule } = await import('../src/helpers/string.js');
142
- const helpers = await import('../src/helpers/main.js');
143
- repl.server.context.helpers = {
144
- string: stringModule,
145
- is: isModule,
146
- ...helpers,
147
- };
148
- repl.notify(`Loaded "helpers" module. You can access it using the "${repl.colors.underline('helpers')}" variable`);
149
- }, {
150
- description: 'Load "helpers" module in the REPL context',
151
- });
152
- });
153
- }
7
+ repl.server.context[binding] = await app.container.make(binding);
8
+ repl.notify(`Loaded "${binding}" service. You can access it using the "${repl.colors.underline(binding)}" variable`);
154
9
  }
10
+ var ReplServiceProvider = class {
11
+ constructor(app) {
12
+ this.app = app;
13
+ }
14
+ register() {
15
+ this.app.container.singleton(repl_exports.Repl, async () => {
16
+ return new repl_exports.Repl({ historyFilePath: join(homedir(), ".adonisjs_v6_repl_history") });
17
+ });
18
+ this.app.container.alias("repl", repl_exports.Repl);
19
+ }
20
+ async boot() {
21
+ this.app.container.resolving("repl", (repl) => {
22
+ repl.addMethod("importDefault", (_, modulePath) => {
23
+ return this.app.importDefault(modulePath);
24
+ }, { description: "Returns the default export for a module" });
25
+ repl.addMethod("importAll", (_, dirPath) => {
26
+ return fsImportAll(this.app.makeURL(dirPath), { ignoreMissingRoot: false });
27
+ }, { description: "Import all files from a directory and assign them to a variable" });
28
+ repl.addMethod("make", (_, service, runtimeValues) => {
29
+ return this.app.container.make(service, runtimeValues);
30
+ }, { description: "Make class instance using \"container.make\" method" });
31
+ repl.addMethod("loadApp", () => {
32
+ return resolveBindingForRepl(this.app, repl, "app");
33
+ }, { description: "Load \"app\" service in the REPL context" });
34
+ repl.addMethod("loadEncryption", () => {
35
+ return resolveBindingForRepl(this.app, repl, "encryption");
36
+ }, { description: "Load \"encryption\" service in the REPL context" });
37
+ repl.addMethod("loadHash", () => {
38
+ return resolveBindingForRepl(this.app, repl, "hash");
39
+ }, { description: "Load \"hash\" service in the REPL context" });
40
+ repl.addMethod("loadRouter", () => {
41
+ return resolveBindingForRepl(this.app, repl, "router");
42
+ }, { description: "Load \"router\" service in the REPL context" });
43
+ repl.addMethod("loadConfig", () => {
44
+ return resolveBindingForRepl(this.app, repl, "config");
45
+ }, { description: "Load \"config\" service in the REPL context" });
46
+ repl.addMethod("loadTestUtils", () => {
47
+ return resolveBindingForRepl(this.app, repl, "testUtils");
48
+ }, { description: "Load \"testUtils\" service in the REPL context" });
49
+ repl.addMethod("loadHelpers", async () => {
50
+ const { default: isModule } = await import("../src/helpers/is.js");
51
+ const { default: stringModule } = await import("../src/helpers/string.js");
52
+ const helpers = await import("../src/helpers/main.js");
53
+ repl.server.context.helpers = {
54
+ string: stringModule,
55
+ is: isModule,
56
+ ...helpers
57
+ };
58
+ repl.notify(`Loaded "helpers" module. You can access it using the "${repl.colors.underline("helpers")}" variable`);
59
+ }, { description: "Load \"helpers\" module in the REPL context" });
60
+ repl.addMethod("loadUrlBuilder", async () => {
61
+ const router = await this.app.container.make("router");
62
+ repl.server.context.urlBuilder = router.urlBuilder;
63
+ repl.notify(`Loaded "urlBuilder" service. You can access it using the "${repl.colors.underline("urlBuilder")}" variable`);
64
+ }, { description: "Load \"urlBuilder\" service in the REPL context" });
65
+ });
66
+ }
67
+ };
68
+ export { ReplServiceProvider as default };
@@ -13,7 +13,7 @@ declare module '@vinejs/vine' {
13
13
  * Extend HTTP request class
14
14
  */
15
15
  declare module '@adonisjs/core/http' {
16
- interface Request extends RequestValidator {
16
+ interface HttpRequest extends RequestValidator {
17
17
  }
18
18
  }
19
19
  /**
@@ -1,66 +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 { Vine } from '@vinejs/vine';
10
- import { Request, RequestValidator } from "../modules/http/main.js";
11
- import { VineMultipartFile } from "../src/vine.js";
12
- /**
13
- * The VineJS service provider integrates VineJS validation
14
- * library with AdonisJS application environment
15
- *
16
- * This provider sets up:
17
- * - File validation rule for multipart file uploads
18
- * - Request validation macro for easy validation in HTTP contexts
19
- * - Extension of VineJS with AdonisJS-specific validation features
20
- *
21
- * @example
22
- * const provider = new VineJSServiceProvider(app)
23
- * provider.boot()
24
- * // Now Request has validateUsing method
25
- */
26
- export default class VineJSServiceProvider {
27
- app;
28
- /**
29
- * VineJS service provider constructor
30
- *
31
- * Sets the usingVineJS flag to true to indicate VineJS is being used.
32
- *
33
- * @param app - The application service instance
34
- */
35
- constructor(app) {
36
- this.app = app;
37
- this.app.usingVineJS = true;
38
- }
39
- /**
40
- * Boot the VineJS service provider
41
- *
42
- * Extends VineJS with file validation macro and adds validateUsing
43
- * method to the Request class for easy validation in HTTP contexts.
44
- *
45
- * @example
46
- * provider.boot()
47
- * // Now vine.file() and request.validateUsing() are available
48
- */
49
- boot() {
50
- const experimentalFlags = this.app.experimentalFlags;
51
- /**
52
- * The file method is used to validate a field to be a valid
53
- * multipart file.
54
- */
55
- Vine.macro('file', function (options) {
56
- return new VineMultipartFile(options);
57
- });
58
- /**
59
- * The validate method can be used to validate the request
60
- * data for the current request using VineJS validators
61
- */
62
- Request.macro('validateUsing', function (...args) {
63
- return new RequestValidator(this.ctx, experimentalFlags).validateUsing(...args);
64
- });
65
- }
66
- }
1
+ import "../chunk-B88MteZI.js";
2
+ import { n as RequestValidator, t as main_exports } from "../main-nojlltNo.js";
3
+ import { t as VineMultipartFile } from "../vine-DGint2rk.js";
4
+ import { Vine } from "@vinejs/vine";
5
+ var VineJSServiceProvider = class {
6
+ constructor(app) {
7
+ this.app = app;
8
+ this.app.usingVineJS = true;
9
+ }
10
+ boot() {
11
+ Vine.macro("file", function(options) {
12
+ return new VineMultipartFile(options);
13
+ });
14
+ main_exports.HttpRequest.macro("validateUsing", function(...args) {
15
+ return new RequestValidator(this.ctx).validateUsing(...args);
16
+ });
17
+ }
18
+ };
19
+ export { VineJSServiceProvider as default };
@@ -0,0 +1,5 @@
1
+ import { n as __reExport } from "./chunk-B88MteZI.js";
2
+ var repl_exports = {};
3
+ import * as import__adonisjs_repl from "@adonisjs/repl";
4
+ __reExport(repl_exports, import__adonisjs_repl);
5
+ export { repl_exports as t };