@adonisjs/core 7.0.0-next.7 → 7.0.0-next.9

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.
@@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
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
13
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
14
  };
15
+ import { importAssembler } from "../src/utils.js";
15
16
  import { BaseCommand, flags } from "../modules/ace/main.js";
16
- import { importAssembler, importTypeScript } from "../src/utils.js";
17
17
  /**
18
18
  * Serve command is used to run the AdonisJS HTTP server during development. The
19
19
  * command under the hood runs the "bin/server.ts" file and watches for file
@@ -119,20 +119,14 @@ export default class Serve extends BaseCommand {
119
119
  this.exitCode = 1;
120
120
  this.terminate();
121
121
  });
122
- const ts = await importTypeScript(this.app);
123
- if (!ts) {
124
- this.#logMissingDevelopmentDependency('typescript');
125
- this.exitCode = 1;
126
- return;
127
- }
128
122
  /**
129
123
  * Start the development server
130
124
  */
131
125
  if (this.watch) {
132
- await this.devServer.startAndWatch(ts, { poll: this.poll || false });
126
+ await this.devServer.startAndWatch({ poll: this.poll || false });
133
127
  }
134
128
  else {
135
- await this.devServer.start(ts);
129
+ await this.devServer.start();
136
130
  }
137
131
  }
138
132
  }
@@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
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
13
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
14
  };
15
+ import { importAssembler } from "../src/utils.js";
15
16
  import { BaseCommand, flags, args } from "../modules/ace/main.js";
16
- import { importAssembler, importTypeScript } from "../src/utils.js";
17
17
  /**
18
18
  * Command to run application tests using the Japa test runner.
19
19
  * Supports filtering tests by suites, files, tags, groups, and individual tests.
@@ -151,13 +151,7 @@ export default class Test extends BaseCommand {
151
151
  * Start the test runner in watch mode
152
152
  */
153
153
  if (this.watch) {
154
- const ts = await importTypeScript(this.app);
155
- if (!ts) {
156
- this.#logMissingDevelopmentDependency('typescript');
157
- this.exitCode = 1;
158
- return;
159
- }
160
- await this.testsRunner.runAndWatch(ts, { poll: this.poll || false });
154
+ await this.testsRunner.runAndWatch({ poll: this.poll || false });
161
155
  }
162
156
  else {
163
157
  await this.testsRunner.run();
@@ -0,0 +1 @@
1
+ export * from '@adonisjs/http-server/client/url_builder';
@@ -0,0 +1,9 @@
1
+ /*
2
+ * @adonisjs/core
3
+ *
4
+ * (c) AdonisJS
5
+ *
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+ export * from '@adonisjs/http-server/client/url_builder';
@@ -174,19 +174,20 @@ export default class AppServiceProvider {
174
174
  */
175
175
  protected registerDumper(): void;
176
176
  /**
177
- * Generates the types needed by the URL builder and writes
178
- * them to the ".adonisjs/server/routes.d.ts" file
177
+ * Generates TypeScript type definitions and JSON representation of routes
179
178
  *
180
- * This method scans registered routes and generates TypeScript
181
- * types for type-safe URL generation in development.
179
+ * Creates route type definitions for better IDE support and a JSON file
180
+ * containing all registered routes. This is used in development mode for
181
+ * tooling integration and type-safety.
182
182
  *
183
- * @param router - The router instance to generate types from
183
+ * @param router - The router instance containing registered routes
184
184
  *
185
185
  * @example
186
- * await generateRoutesTypes(router)
187
- * // Creates .adonisjs/server/routes.d.ts with route types
186
+ * const router = await container.make('router')
187
+ * await this.emitRoutes(router)
188
+ * // Generates .adonisjs/server/routes.d.ts and routes.json
188
189
  */
189
- protected generateRoutesTypes(router: Router): Promise<void>;
190
+ protected emitRoutes(router: Router): Promise<void>;
190
191
  /**
191
192
  * Registers bindings
192
193
  *
@@ -225,7 +225,7 @@ export default class AppServiceProvider {
225
225
  * await middleware.handle(ctx, next)
226
226
  */
227
227
  registerBodyParserMiddleware() {
228
- this.app.container.bind(BodyParserMiddleware, () => {
228
+ this.app.container.singleton(BodyParserMiddleware, () => {
229
229
  const config = this.app.config.get('bodyparser');
230
230
  return new BodyParserMiddleware(config, this.app.experimentalFlags);
231
231
  });
@@ -256,36 +256,42 @@ export default class AppServiceProvider {
256
256
  this.app.container.alias('dumper', Dumper);
257
257
  }
258
258
  /**
259
- * Generates the types needed by the URL builder and writes
260
- * them to the ".adonisjs/server/routes.d.ts" file
259
+ * Generates TypeScript type definitions and JSON representation of routes
261
260
  *
262
- * This method scans registered routes and generates TypeScript
263
- * types for type-safe URL generation in development.
261
+ * Creates route type definitions for better IDE support and a JSON file
262
+ * containing all registered routes. This is used in development mode for
263
+ * tooling integration and type-safety.
264
264
  *
265
- * @param router - The router instance to generate types from
265
+ * @param router - The router instance containing registered routes
266
266
  *
267
267
  * @example
268
- * await generateRoutesTypes(router)
269
- * // Creates .adonisjs/server/routes.d.ts with route types
268
+ * const router = await container.make('router')
269
+ * await this.emitRoutes(router)
270
+ * // Generates .adonisjs/server/routes.d.ts and routes.json
270
271
  */
271
- async generateRoutesTypes(router) {
272
+ async emitRoutes(router) {
272
273
  try {
273
274
  const { routes, imports, types } = router.generateTypes(2);
274
- const outputPath = this.app.generatedServerPath('routes.d.ts');
275
- await mkdir(dirname(outputPath), { recursive: true });
276
- await writeFile(outputPath, [
277
- `import '@adonisjs/core/types/http'`,
278
- ...imports,
279
- '',
280
- ...types,
281
- '',
282
- 'export type ScannedRoutes = {',
283
- routes,
284
- '}',
285
- `declare module '@adonisjs/core/types/http' {`,
286
- ' export interface RoutesList extends ScannedRoutes {}',
287
- '}',
288
- ].join('\n'));
275
+ const routesTypesPath = this.app.generatedServerPath('routes.d.ts');
276
+ const routesJsonPath = this.app.generatedServerPath('routes.json');
277
+ await mkdir(dirname(routesTypesPath), { recursive: true });
278
+ await Promise.all([
279
+ writeFile(routesTypesPath, [
280
+ `import '@adonisjs/core/types/http'`,
281
+ ...imports,
282
+ '',
283
+ ...types,
284
+ '',
285
+ 'export type ScannedRoutes = {',
286
+ routes,
287
+ '}',
288
+ `declare module '@adonisjs/core/types/http' {`,
289
+ ' export interface RoutesList extends ScannedRoutes {}',
290
+ '}',
291
+ ].join('\n')),
292
+ writeFile(routesJsonPath, JSON.stringify(router.toJSON())),
293
+ ]);
294
+ this.app.notify({ isAdonisJS: true, routesFileLocation: routesJsonPath });
289
295
  }
290
296
  catch (error) {
291
297
  console.error("Unable to generate routes types file due to the following error. This won't impact the dev-server");
@@ -346,8 +352,7 @@ export default class AppServiceProvider {
346
352
  if (!this.app.inProduction) {
347
353
  const router = await this.app.container.make('router');
348
354
  if (router.commited) {
349
- await this.generateRoutesTypes(router);
350
- this.app.notify({ isAdonisJS: true, routes: JSON.stringify(router.toJSON()) });
355
+ await this.emitRoutes(router);
351
356
  }
352
357
  }
353
358
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adonisjs/core",
3
3
  "description": "Core of AdonisJS",
4
- "version": "7.0.0-next.7",
4
+ "version": "7.0.0-next.9",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },
@@ -54,6 +54,7 @@
54
54
  "./env/editor": "./build/modules/env/editor.js",
55
55
  "./events": "./build/modules/events.js",
56
56
  "./http": "./build/modules/http/main.js",
57
+ "./http/url_builder_client": "./build/modules/http/url_builder_client.js",
57
58
  "./logger": "./build/modules/logger.js",
58
59
  "./repl": "./build/modules/repl.js",
59
60
  "./transformers": "./build/modules/transformers/main.js",
@@ -84,7 +85,7 @@
84
85
  "index:commands": "node --import=@poppinss/ts-exec toolkit/main.js index build/commands"
85
86
  },
86
87
  "devDependencies": {
87
- "@adonisjs/assembler": "^8.0.0-next.14",
88
+ "@adonisjs/assembler": "^8.0.0-next.16",
88
89
  "@adonisjs/eslint-config": "^3.0.0-next.4",
89
90
  "@adonisjs/prettier-config": "^1.4.5",
90
91
  "@adonisjs/tsconfig": "^2.0.0-next.2",
@@ -95,12 +96,12 @@
95
96
  "@japa/snapshot": "^2.0.9",
96
97
  "@poppinss/ts-exec": "^1.4.1",
97
98
  "@release-it/conventional-changelog": "^10.0.1",
98
- "@types/node": "^24.7.2",
99
+ "@types/node": "^24.10.0",
99
100
  "@types/pretty-hrtime": "^1.0.3",
100
101
  "@types/sinon": "^17.0.4",
101
102
  "@types/supertest": "^6.0.3",
102
103
  "@types/test-console": "^2.0.3",
103
- "@vinejs/vine": "^4.0.0-next.1",
104
+ "@vinejs/vine": "^4.1.0",
104
105
  "argon2": "^0.44.0",
105
106
  "bcrypt": "^6.0.0",
106
107
  "c8": "^10.1.3",
@@ -108,7 +109,7 @@
108
109
  "cross-env": "^10.1.0",
109
110
  "del-cli": "^7.0.0",
110
111
  "edge.js": "^6.3.0",
111
- "eslint": "^9.37.0",
112
+ "eslint": "^9.39.1",
112
113
  "execa": "^9.6.0",
113
114
  "get-port": "^7.1.0",
114
115
  "prettier": "^3.6.2",
@@ -124,23 +125,23 @@
124
125
  "dependencies": {
125
126
  "@adonisjs/ace": "^14.0.1-next.2",
126
127
  "@adonisjs/application": "^9.0.0-next.9",
127
- "@adonisjs/bodyparser": "^11.0.0-next.1",
128
+ "@adonisjs/bodyparser": "^11.0.0-next.2",
128
129
  "@adonisjs/config": "^6.0.0-next.1",
129
130
  "@adonisjs/encryption": "^7.0.0-next.1",
130
131
  "@adonisjs/env": "^7.0.0-next.1",
131
132
  "@adonisjs/events": "^10.1.0-next.2",
132
- "@adonisjs/fold": "^11.0.0-next.2",
133
+ "@adonisjs/fold": "^11.0.0-next.3",
133
134
  "@adonisjs/hash": "^10.0.0-next.1",
134
135
  "@adonisjs/health": "^3.0.0-next.0",
135
136
  "@adonisjs/http-server": "^8.0.0-next.12",
136
137
  "@adonisjs/http-transformers": "^1.5.0",
137
- "@adonisjs/logger": "^7.1.0-next.0",
138
+ "@adonisjs/logger": "^7.1.0-next.2",
138
139
  "@adonisjs/repl": "^5.0.0-next.0",
139
140
  "@poppinss/colors": "^4.1.5",
140
- "@poppinss/dumper": "^0.6.4",
141
+ "@poppinss/dumper": "^0.6.5",
141
142
  "@poppinss/macroable": "^1.1.0",
142
143
  "@poppinss/utils": "^7.0.0-next.3",
143
- "@sindresorhus/is": "^7.1.0",
144
+ "@sindresorhus/is": "^7.1.1",
144
145
  "@types/he": "^1.2.3",
145
146
  "error-stack-parser-es": "^1.0.5",
146
147
  "he": "^1.2.0",