@adonisjs/core 7.0.0-next.1 → 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 (145) 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 -156
  24. package/build/commands/test.js +92 -208
  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.d.ts +109 -14
  39. package/build/modules/ace/codemods.js +222 -374
  40. package/build/modules/ace/main.d.ts +30 -0
  41. package/build/modules/ace/main.js +2 -11
  42. package/build/modules/app.d.ts +17 -0
  43. package/build/modules/app.js +4 -9
  44. package/build/modules/bodyparser/bodyparser_middleware.js +2 -14
  45. package/build/modules/bodyparser/main.js +4 -9
  46. package/build/modules/config.d.ts +17 -0
  47. package/build/modules/config.js +4 -9
  48. package/build/modules/container.js +4 -9
  49. package/build/modules/dumper/dumper.d.ts +5 -0
  50. package/build/modules/dumper/main.d.ts +21 -0
  51. package/build/modules/dumper/main.js +6 -11
  52. package/build/modules/dumper/plugins/edge.js +2 -62
  53. package/build/modules/encryption.d.ts +17 -0
  54. package/build/modules/encryption.js +4 -9
  55. package/build/modules/env/editor.js +2 -9
  56. package/build/modules/env/main.d.ts +19 -0
  57. package/build/modules/env/main.js +2 -9
  58. package/build/modules/events.js +4 -9
  59. package/build/modules/hash/drivers/argon.js +2 -9
  60. package/build/modules/hash/drivers/bcrypt.d.ts +11 -0
  61. package/build/modules/hash/drivers/bcrypt.js +2 -9
  62. package/build/modules/hash/drivers/scrypt.js +2 -9
  63. package/build/modules/hash/main.d.ts +18 -0
  64. package/build/modules/hash/main.js +6 -10
  65. package/build/modules/hash/phc_formatter.js +2 -9
  66. package/build/modules/health.js +2 -9
  67. package/build/modules/http/main.js +4 -15
  68. package/build/modules/http/url_builder_client.d.ts +1 -0
  69. package/build/modules/http/url_builder_client.js +2 -0
  70. package/build/modules/logger.d.ts +30 -0
  71. package/build/modules/logger.js +4 -9
  72. package/build/modules/repl.js +4 -9
  73. package/build/modules/transformers/main.js +4 -9
  74. package/build/providers/app_provider.d.ts +9 -21
  75. package/build/providers/app_provider.js +147 -363
  76. package/build/providers/edge_provider.js +97 -104
  77. package/build/providers/hash_provider.js +29 -91
  78. package/build/providers/repl_provider.js +61 -152
  79. package/build/providers/vinejs_provider.d.ts +1 -1
  80. package/build/providers/vinejs_provider.js +20 -66
  81. package/build/services/ace.js +2 -17
  82. package/build/services/app.js +2 -21
  83. package/build/services/config.js +2 -13
  84. package/build/services/dumper.js +5 -21
  85. package/build/services/emitter.js +2 -14
  86. package/build/services/encryption.js +2 -14
  87. package/build/services/hash.js +2 -14
  88. package/build/services/logger.js +2 -14
  89. package/build/services/repl.js +2 -14
  90. package/build/services/router.js +2 -14
  91. package/build/services/server.js +2 -14
  92. package/build/services/test_utils.js +2 -17
  93. package/build/services/url_builder.js +5 -17
  94. package/build/src/exceptions.js +2 -49
  95. package/build/src/helpers/assert.js +2 -55
  96. package/build/src/helpers/http.d.ts +20 -0
  97. package/build/src/helpers/http.js +2 -0
  98. package/build/src/helpers/is.js +3 -31
  99. package/build/src/helpers/main.d.ts +1 -5
  100. package/build/src/helpers/main.js +5 -56
  101. package/build/src/helpers/string.js +2 -60
  102. package/build/src/helpers/types.js +26 -135
  103. package/build/src/helpers/verification_token.js +2 -120
  104. package/build/src/test_utils/main.js +5 -77
  105. package/build/src/types.d.ts +1 -0
  106. package/build/src/types.js +0 -8
  107. package/build/src/utils.d.ts +1 -1
  108. package/build/src/vine.js +2 -97
  109. package/build/types/ace.js +2 -9
  110. package/build/types/app.js +2 -9
  111. package/build/types/bodyparser.js +2 -9
  112. package/build/types/common.js +2 -9
  113. package/build/types/container.js +2 -9
  114. package/build/types/encryption.js +2 -9
  115. package/build/types/events.js +2 -9
  116. package/build/types/hash.js +2 -9
  117. package/build/types/health.js +2 -9
  118. package/build/types/helpers.d.ts +20 -0
  119. package/build/types/helpers.js +0 -8
  120. package/build/types/http.js +2 -9
  121. package/build/types/logger.js +2 -9
  122. package/build/types/repl.js +2 -9
  123. package/build/types/transformers.js +2 -9
  124. package/package.json +88 -30
  125. package/build/modules/ace/commands.js +0 -157
  126. package/build/modules/ace/create_kernel.js +0 -91
  127. package/build/modules/ace/kernel.js +0 -40
  128. package/build/modules/dumper/define_config.js +0 -36
  129. package/build/modules/dumper/dumper.js +0 -256
  130. package/build/modules/dumper/errors.js +0 -119
  131. package/build/modules/hash/define_config.js +0 -125
  132. package/build/modules/http/request_validator.js +0 -100
  133. package/build/src/assembler_hooks/index_entities.js +0 -106
  134. package/build/src/cli_formatters/routes_list.js +0 -381
  135. package/build/src/config_provider.js +0 -71
  136. package/build/src/debug.js +0 -25
  137. package/build/src/ignitor/ace.js +0 -102
  138. package/build/src/ignitor/http.js +0 -146
  139. package/build/src/ignitor/main.js +0 -124
  140. package/build/src/ignitor/test.js +0 -66
  141. package/build/src/test_utils/http.js +0 -82
  142. package/build/src/utils.js +0 -104
  143. package/build/stubs/main.js +0 -9
  144. package/build/toolkit/commands/index_commands.js +0 -30
  145. package/build/toolkit/main.js +0 -27
@@ -1,363 +1,147 @@
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 { dirname } from 'node:path';
10
- import { mkdir, writeFile } from 'node:fs/promises';
11
- import { Config } from "../modules/config.js";
12
- import { Logger } from "../modules/logger.js";
13
- import { Application } from "../modules/app.js";
14
- import { Dumper } from "../modules/dumper/dumper.js";
15
- import { HttpContext } from "../modules/http/main.js";
16
- import { Encryption } from "../modules/encryption.js";
17
- import { Router, Server } from "../modules/http/main.js";
18
- import { BaseEvent, Emitter } from "../modules/events.js";
19
- import { serialize } from "../modules/transformers/main.js";
20
- import BodyParserMiddleware from "../modules/bodyparser/bodyparser_middleware.js";
21
- /**
22
- * The Application Service provider registers all the baseline
23
- * features required to run the framework.
24
- *
25
- * This provider handles the registration of core services including:
26
- * - Application instance
27
- * - Logger and logger manager
28
- * - Configuration
29
- * - Event emitter
30
- * - Encryption service
31
- * - HTTP server and router
32
- * - Body parser middleware
33
- * - Dumper for debugging
34
- * - Test utilities and ACE kernel
35
- *
36
- * @example
37
- * const provider = new AppServiceProvider(app)
38
- * provider.register()
39
- * await provider.boot()
40
- * await provider.ready()
41
- */
42
- export default class AppServiceProvider {
43
- app;
44
- /**
45
- * Application service provider constructor
46
- *
47
- * @param app - The application service instance
48
- */
49
- constructor(app) {
50
- this.app = app;
51
- }
52
- /**
53
- * Registers test utils with the container
54
- *
55
- * Creates a singleton binding for 'testUtils' that lazily imports
56
- * and instantiates the TestUtils class when first accessed.
57
- *
58
- * @example
59
- * const testUtils = await app.container.make('testUtils')
60
- * testUtils.createHttpContext()
61
- */
62
- registerTestUtils() {
63
- this.app.container.singleton('testUtils', async () => {
64
- const { TestUtils } = await import('../src/test_utils/main.js');
65
- return new TestUtils(this.app);
66
- });
67
- }
68
- /**
69
- * Registers ace with the container
70
- *
71
- * Creates a singleton binding for 'ace' that lazily creates
72
- * the ACE kernel for command-line interface functionality.
73
- *
74
- * @example
75
- * const ace = await app.container.make('ace')
76
- * await ace.exec('make:controller', ['UserController'])
77
- */
78
- registerAce() {
79
- this.app.container.singleton('ace', async () => {
80
- const { createAceKernel } = await import('../modules/ace/create_kernel.js');
81
- return createAceKernel(this.app);
82
- });
83
- }
84
- /**
85
- * Registers the application to the container
86
- *
87
- * Binds the application instance as both a class binding and an alias.
88
- * This allows access to the app instance throughout the container.
89
- *
90
- * @example
91
- * const app = await container.make('app')
92
- * const appPath = app.makePath('tmp')
93
- */
94
- registerApp() {
95
- this.app.container.singleton(Application, () => this.app);
96
- this.app.container.alias('app', Application);
97
- }
98
- /**
99
- * Registers the logger class to resolve the default logger
100
- *
101
- * Creates a singleton binding for the Logger class that resolves
102
- * the default logger instance from the logger manager.
103
- *
104
- * @example
105
- * const logger = await container.make(Logger)
106
- * logger.info('Application started')
107
- */
108
- registerLogger() {
109
- this.app.container.singleton(Logger, async (resolver) => {
110
- const loggerManager = await resolver.make('logger');
111
- return loggerManager.use();
112
- });
113
- }
114
- /**
115
- * Registers the logger manager to the container
116
- *
117
- * Creates a singleton binding for 'logger' that instantiates
118
- * the LoggerManager with configuration from config/logger.ts
119
- *
120
- * @example
121
- * const loggerManager = await container.make('logger')
122
- * const fileLogger = loggerManager.use('file')
123
- */
124
- registerLoggerManager() {
125
- this.app.container.singleton('logger', async () => {
126
- const { LoggerManager } = await import('../modules/logger.js');
127
- const config = this.app.config.get('logger');
128
- return new LoggerManager(config);
129
- });
130
- }
131
- /**
132
- * Registers the config to the container
133
- *
134
- * Binds the application's config instance as both a class binding
135
- * and an alias, allowing access to configuration values.
136
- *
137
- * @example
138
- * const config = await container.make('config')
139
- * const appKey = config.get('app.appKey')
140
- */
141
- registerConfig() {
142
- this.app.container.singleton(Config, () => this.app.config);
143
- this.app.container.alias('config', Config);
144
- }
145
- /**
146
- * Registers emitter service to the container
147
- *
148
- * Creates a singleton binding for the event emitter that handles
149
- * application-wide event dispatching and listening.
150
- *
151
- * @example
152
- * const emitter = await container.make('emitter')
153
- * emitter.emit('user:created', { userId: 123 })
154
- */
155
- registerEmitter() {
156
- this.app.container.singleton(Emitter, async () => {
157
- return new Emitter(this.app);
158
- });
159
- this.app.container.alias('emitter', Emitter);
160
- }
161
- /**
162
- * Register the encryption service to the container
163
- *
164
- * Creates a singleton binding for the encryption service using
165
- * the app key from configuration for encryption/decryption operations.
166
- *
167
- * @example
168
- * const encryption = await container.make('encryption')
169
- * const encrypted = encryption.encrypt('sensitive data')
170
- */
171
- registerEncryption() {
172
- this.app.container.singleton(Encryption, () => {
173
- const appKey = this.app.config.get('app.appKey');
174
- return new Encryption({ secret: appKey });
175
- });
176
- this.app.container.alias('encryption', Encryption);
177
- }
178
- /**
179
- * Registers the HTTP server with the container as a singleton
180
- *
181
- * Creates a singleton binding for the HTTP server that handles
182
- * incoming requests, with dependencies on encryption, emitter,
183
- * logger, and HTTP configuration.
184
- *
185
- * @example
186
- * const server = await container.make('server')
187
- * server.start()
188
- */
189
- registerServer() {
190
- this.app.container.singleton(Server, async (resolver) => {
191
- const encryption = await resolver.make('encryption');
192
- const emitter = await resolver.make('emitter');
193
- const logger = await resolver.make('logger');
194
- const config = this.app.config.get('app.http');
195
- return new Server(this.app, encryption, emitter, logger, config);
196
- });
197
- this.app.container.alias('server', Server);
198
- }
199
- /**
200
- * Registers router with the container as a singleton
201
- *
202
- * Creates a singleton binding for the router by getting it from
203
- * the HTTP server instance. The router handles URL routing.
204
- *
205
- * @example
206
- * const router = await container.make('router')
207
- * router.get('/', ({ response }) => response.send('Hello'))
208
- */
209
- registerRouter() {
210
- this.app.container.singleton(Router, async (resolver) => {
211
- const server = await resolver.make('server');
212
- return server.getRouter();
213
- });
214
- this.app.container.alias('router', Router);
215
- }
216
- /**
217
- * Self construct bodyparser middleware class, since it needs
218
- * config that cannot be resolved by the container
219
- *
220
- * Binds the BodyParserMiddleware with bodyparser configuration
221
- * and experimental flags for parsing request bodies.
222
- *
223
- * @example
224
- * const middleware = await container.make(BodyParserMiddleware)
225
- * await middleware.handle(ctx, next)
226
- */
227
- registerBodyParserMiddleware() {
228
- this.app.container.bind(BodyParserMiddleware, () => {
229
- const config = this.app.config.get('bodyparser');
230
- return new BodyParserMiddleware(config, this.app.experimentalFlags);
231
- });
232
- }
233
- /**
234
- * Registeres singleton instance of the "Dumper" module configured
235
- * via the "config/app.ts" file.
236
- *
237
- * The dumper is used for debugging and variable inspection with
238
- * configurable HTML and console output formats.
239
- *
240
- * @example
241
- * const dumper = await container.make('dumper')
242
- * dumper.dump({ user: { name: 'John' } })
243
- */
244
- registerDumper() {
245
- this.app.container.singleton(Dumper, async () => {
246
- const config = this.app.config.get('app.dumper', {});
247
- const dumper = new Dumper(this.app);
248
- if (config.html) {
249
- dumper.configureHtmlOutput(config.html);
250
- }
251
- if (config.console) {
252
- dumper.configureAnsiOutput(config.console);
253
- }
254
- return dumper;
255
- });
256
- this.app.container.alias('dumper', Dumper);
257
- }
258
- /**
259
- * Generates the types needed by the URL builder and writes
260
- * them to the ".adonisjs/server/routes.d.ts" file
261
- *
262
- * This method scans registered routes and generates TypeScript
263
- * types for type-safe URL generation in development.
264
- *
265
- * @param router - The router instance to generate types from
266
- *
267
- * @example
268
- * await generateRoutesTypes(router)
269
- * // Creates .adonisjs/server/routes.d.ts with route types
270
- */
271
- async generateRoutesTypes(router) {
272
- const types = router.generateTypes(4);
273
- const outputPath = this.app.generatedServerPath('routes.d.ts');
274
- await mkdir(dirname(outputPath), { recursive: true });
275
- await writeFile(outputPath, [
276
- `import '@adonisjs/core/types/http'`,
277
- '',
278
- `declare module '@adonisjs/core/types/http' {`,
279
- ' type ScannedRoutes = {',
280
- types,
281
- ' }',
282
- 'export interface RoutesList extends ScannedRoutes {}',
283
- '}',
284
- ].join('\n'));
285
- }
286
- /**
287
- * Generates the routes JSON needed by the client integration
288
- *
289
- * Exports all registered routes as JSON for client-side
290
- * applications that need route information.
291
- *
292
- * @param router - The router instance to export routes from
293
- *
294
- * @example
295
- * await generateRoutesJSONFile(router)
296
- * // Creates .adonisjs/client/routes.json
297
- */
298
- async generateRoutesJSONFile(router) {
299
- const routes = router.toJSON();
300
- const outputPath = this.app.makePath('.adonisjs/client/routes.json');
301
- await mkdir(dirname(outputPath), { recursive: true });
302
- await writeFile(outputPath, JSON.stringify(routes, null, 2));
303
- }
304
- /**
305
- * Registers bindings
306
- *
307
- * Called during the application bootstrap phase to register
308
- * all core service bindings with the IoC container.
309
- *
310
- * @example
311
- * const provider = new AppServiceProvider(app)
312
- * provider.register() // Registers all core services
313
- */
314
- register() {
315
- this.registerApp();
316
- this.registerAce();
317
- this.registerDumper();
318
- this.registerLoggerManager();
319
- this.registerLogger();
320
- this.registerConfig();
321
- this.registerEmitter();
322
- this.registerEncryption();
323
- this.registerTestUtils();
324
- this.registerServer();
325
- this.registerRouter();
326
- this.registerBodyParserMiddleware();
327
- }
328
- /**
329
- * Boot the service provider
330
- *
331
- * Called after all providers have been registered. Sets up
332
- * event emitter for BaseEvent and adds transform macro to HttpContext.
333
- *
334
- * @example
335
- * await provider.boot()
336
- * // Now HttpContext has transform method available
337
- */
338
- async boot() {
339
- BaseEvent.useEmitter(await this.app.container.make('emitter'));
340
- HttpContext.instanceProperty('serialize', function (...args) {
341
- return serialize(...args);
342
- });
343
- }
344
- /**
345
- * Called when the application is ready
346
- *
347
- * In non-production environments, generates route types and
348
- * JSON files for development tooling when router is committed.
349
- *
350
- * @example
351
- * await provider.ready()
352
- * // Route types and JSON generated in development
353
- */
354
- async ready() {
355
- if (!this.app.inProduction) {
356
- const router = await this.app.container.make('router');
357
- if (router.commited) {
358
- await this.generateRoutesJSONFile(router);
359
- await this.generateRoutesTypes(router);
360
- }
361
- }
362
- }
363
- }
1
+ import "../chunk-MjwdjG2f.js";
2
+ import { t as app_exports } from "../app-BK0PN3li.js";
3
+ import { t as config_exports } from "../config-B2S2xfmN.js";
4
+ import { t as encryption_exports } from "../encryption-D2HGu0bU.js";
5
+ import { t as events_exports } from "../events-B8hK42QT.js";
6
+ import { t as logger_exports } from "../logger-Dha-0hp1.js";
7
+ import { t as Dumper } from "../dumper-C_sMcyFb.js";
8
+ import { t as main_exports } from "../main-CFmDHDls.js";
9
+ import { t as main_exports$1 } from "../main-D5xz2ZN1.js";
10
+ import { t as bodyparser_middleware_default } from "../bodyparser_middleware-DTW0epKM.js";
11
+ import { dirname } from "node:path";
12
+ import { mkdir, writeFile } from "node:fs/promises";
13
+ var AppServiceProvider = class {
14
+ constructor(app) {
15
+ this.app = app;
16
+ }
17
+ registerTestUtils() {
18
+ this.app.container.singleton("testUtils", async () => {
19
+ const { TestUtils } = await import("../src/test_utils/main.js");
20
+ return new TestUtils(this.app);
21
+ });
22
+ }
23
+ registerAce() {
24
+ this.app.container.singleton("ace", async () => {
25
+ const { createAceKernel } = await import("../create_kernel-B4MzSE2_.js");
26
+ return createAceKernel(this.app);
27
+ });
28
+ }
29
+ registerApp() {
30
+ this.app.container.singleton(app_exports.Application, () => this.app);
31
+ this.app.container.alias("app", app_exports.Application);
32
+ }
33
+ registerLogger() {
34
+ this.app.container.singleton(logger_exports.Logger, async (resolver) => {
35
+ return (await resolver.make("logger")).use();
36
+ });
37
+ }
38
+ registerLoggerManager() {
39
+ this.app.container.singleton("logger", async () => {
40
+ const { LoggerManager } = await import("../modules/logger.js");
41
+ return new LoggerManager(this.app.config.get("logger"));
42
+ });
43
+ }
44
+ registerConfig() {
45
+ this.app.container.singleton(config_exports.Config, () => this.app.config);
46
+ this.app.container.alias("config", config_exports.Config);
47
+ }
48
+ registerEmitter() {
49
+ this.app.container.singleton(events_exports.Emitter, async () => {
50
+ return new events_exports.Emitter(this.app);
51
+ });
52
+ this.app.container.alias("emitter", events_exports.Emitter);
53
+ }
54
+ registerEncryption() {
55
+ this.app.container.singleton(encryption_exports.Encryption, () => {
56
+ const appKey = this.app.config.get("app.appKey");
57
+ return new encryption_exports.Encryption({ secret: appKey });
58
+ });
59
+ this.app.container.alias("encryption", encryption_exports.Encryption);
60
+ }
61
+ registerServer() {
62
+ this.app.container.singleton(main_exports.Server, async (resolver) => {
63
+ const encryption = await resolver.make("encryption");
64
+ const emitter = await resolver.make("emitter");
65
+ const logger = await resolver.make("logger");
66
+ const config = this.app.config.get("app.http");
67
+ return new main_exports.Server(this.app, encryption, emitter, logger, config);
68
+ });
69
+ this.app.container.alias("server", main_exports.Server);
70
+ }
71
+ registerRouter() {
72
+ this.app.container.singleton(main_exports.Router, async (resolver) => {
73
+ return (await resolver.make("server")).getRouter();
74
+ });
75
+ this.app.container.alias("router", main_exports.Router);
76
+ }
77
+ registerBodyParserMiddleware() {
78
+ this.app.container.singleton(bodyparser_middleware_default, () => {
79
+ return new bodyparser_middleware_default(this.app.config.get("bodyparser"), this.app.experimentalFlags);
80
+ });
81
+ }
82
+ registerDumper() {
83
+ this.app.container.singleton(Dumper, async () => {
84
+ const config = this.app.config.get("app.dumper", {});
85
+ const dumper = new Dumper(this.app);
86
+ if (config.html) dumper.configureHtmlOutput(config.html);
87
+ if (config.console) dumper.configureAnsiOutput(config.console);
88
+ return dumper;
89
+ });
90
+ this.app.container.alias("dumper", Dumper);
91
+ }
92
+ async emitRoutes(router) {
93
+ try {
94
+ const { routes, imports, types } = router.generateTypes(2);
95
+ const routesTypesPath = this.app.generatedServerPath("routes.d.ts");
96
+ const routesJsonPath = this.app.generatedServerPath("routes.json");
97
+ await mkdir(dirname(routesTypesPath), { recursive: true });
98
+ await Promise.all([writeFile(routesTypesPath, [
99
+ `import '@adonisjs/core/types/http'`,
100
+ ...imports,
101
+ "",
102
+ ...types,
103
+ "",
104
+ "export type ScannedRoutes = {",
105
+ routes,
106
+ "}",
107
+ `declare module '@adonisjs/core/types/http' {`,
108
+ " export interface RoutesList extends ScannedRoutes {}",
109
+ "}"
110
+ ].join("\n")), writeFile(routesJsonPath, JSON.stringify(router.toJSON()))]);
111
+ this.app.notify({
112
+ isAdonisJS: true,
113
+ routesFileLocation: routesJsonPath
114
+ });
115
+ } catch (error) {
116
+ console.error("Unable to generate routes types file due to the following error. This won't impact the dev-server");
117
+ console.error(error);
118
+ }
119
+ }
120
+ register() {
121
+ this.registerApp();
122
+ this.registerAce();
123
+ this.registerDumper();
124
+ this.registerLoggerManager();
125
+ this.registerLogger();
126
+ this.registerConfig();
127
+ this.registerEmitter();
128
+ this.registerEncryption();
129
+ this.registerTestUtils();
130
+ this.registerServer();
131
+ this.registerRouter();
132
+ this.registerBodyParserMiddleware();
133
+ }
134
+ async boot() {
135
+ events_exports.BaseEvent.useEmitter(await this.app.container.make("emitter"));
136
+ main_exports.HttpContext.instanceProperty("serialize", function(value, container) {
137
+ return (0, main_exports$1.serialize)(value, container ?? this.containerResolver);
138
+ });
139
+ }
140
+ async ready() {
141
+ if (!this.app.inProduction) {
142
+ const router = await this.app.container.make("router");
143
+ if (router.commited) await this.emitRoutes(router);
144
+ }
145
+ }
146
+ };
147
+ export { AppServiceProvider as default };