@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,165 +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, Qs } 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 qs = new Qs(app.config.get('app.http.qs', {}));
57
- const router = await this.app.container.make('router');
58
- const dumper = await this.app.container.make('dumper');
59
- function edgeConfigResolver(key, defaultValue) {
60
- return app.config.get(key, defaultValue);
61
- }
62
- edgeConfigResolver.has = function (key) {
63
- return app.config.has(key);
64
- };
65
- function clientRoutes() {
66
- const routes = router.toJSON();
67
- return Object.keys(routes).reduce((result, domain) => {
68
- result[domain] = routes[domain].reduce((routesResult, route) => {
69
- if (!route.name) {
70
- return routesResult;
71
- }
72
- routesResult.push({
73
- domain: route.domain,
74
- methods: route.methods,
75
- pattern: route.pattern,
76
- tokens: route.tokens,
77
- name: route.name,
78
- });
79
- return routesResult;
80
- }, []);
81
- return result;
82
- }, {});
83
- }
84
- /**
85
- * Mount the default disk
86
- */
87
- edge.mount(app.viewsPath());
88
- /**
89
- * Cache templates in production
90
- */
91
- edge.configure({ cache: app.inProduction });
92
- /**
93
- * Define Edge global helpers
94
- * @deprecated
95
- */
96
- edge.global('route', function (...args) {
97
- return router.makeUrl(...args);
98
- });
99
- edge.global('signedRoute', function (...args) {
100
- return router.makeSignedUrl(...args);
101
- });
102
- edge.global('app', app);
103
- edge.global('config', edgeConfigResolver);
104
- edge.global('routes', function () {
105
- return clientRoutes();
106
- });
107
- edge.global('routesJSON', function () {
108
- return JSON.stringify(clientRoutes());
109
- });
110
- /**
111
- * Route helpers
112
- */
113
- edge.global('urlFor', function (...args) {
114
- return router.urlBuilder.urlFor(...args);
115
- });
116
- edge.global('signedUrlFor', function (...args) {
117
- return router.urlBuilder.signedUrlFor(...args);
118
- });
119
- /**
120
- * Sharing qs parser with templates
121
- */
122
- edge.global('qs', qs);
123
- edge.global('formAttributes', function (route, method, params, options) {
124
- /**
125
- * Normalize method and keep a reference to the original method
126
- */
127
- options = options ?? {};
128
- method = method.toUpperCase();
129
- const original = method;
130
- /**
131
- * If method if not GET and POST, then use the querystring _method
132
- * to and force update the method to "POST"
133
- */
134
- if (method !== 'GET' && method !== 'POST') {
135
- method = 'POST';
136
- options = { ...options, qs: { _method: original, ...options.qs } };
137
- }
138
- const { action } = router.urlBuilder.urlFor.method(original, route, params, options).form;
139
- return {
140
- action,
141
- method,
142
- };
143
- });
144
- /**
145
- * Creating a isolated instance of edge renderer
146
- */
147
- HttpContext.getter('view', function () {
148
- return edge.createRenderer().share({
149
- request: this.request,
150
- });
151
- }, true);
152
- /**
153
- * Adding brisk route to render templates without an
154
- * explicit handler
155
- */
156
- BriskRoute.macro('render', function (template, data) {
157
- function rendersTemplate({ view }) {
158
- return view.render(template, data);
159
- }
160
- Object.defineProperty(rendersTemplate, 'listArgs', { value: template, writable: false });
161
- return this.setHandler(rendersTemplate);
162
- });
163
- edge.use(pluginEdgeDumper(dumper));
164
- }
165
- }
1
+ import "../chunk-MjwdjG2f.js";
2
+ import { t as main_exports } from "../main-CFmDHDls.js";
3
+ import { t as pluginEdgeDumper } from "../edge-LQdCc1L3.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,29 @@
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-MjwdjG2f.js";
2
+ import "../debug-DURPi9xn.js";
3
+ import { t as configProvider } from "../config_provider-CY-xuo2R.js";
4
+ import { t as main_exports } from "../main-BrJQ1VAM.js";
5
+ import { RuntimeException } from "@poppinss/utils/exception";
6
+ var HashServiceProvider = class {
7
+ constructor(app) {
8
+ this.app = app;
9
+ }
10
+ registerHash() {
11
+ this.app.container.singleton(main_exports.Hash, async (resolver) => {
12
+ return (await resolver.make("hash")).use();
13
+ });
14
+ }
15
+ registerHashManager() {
16
+ this.app.container.singleton("hash", async () => {
17
+ const hashConfigProvider = this.app.config.get("hash");
18
+ const config = await configProvider.resolve(this.app, hashConfigProvider);
19
+ if (!config) throw new RuntimeException("Invalid \"config/hash.ts\" file. Make sure you are using the \"defineConfig\" method");
20
+ const { HashManager } = await import("../modules/hash/main.js");
21
+ return new HashManager(config);
22
+ });
23
+ }
24
+ register() {
25
+ this.registerHashManager();
26
+ this.registerHash();
27
+ }
28
+ };
29
+ export { HashServiceProvider as default };
@@ -1,154 +1,63 @@
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-MjwdjG2f.js";
2
+ import { t as repl_exports } from "../repl-CumYg2V_.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
+ });
61
+ }
62
+ };
63
+ 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
  /**