@adonisjs/core 7.0.0-next.1 → 7.0.0-next.10
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.
- package/build/commands/serve.js +3 -9
- package/build/commands/test.js +2 -8
- package/build/modules/ace/codemods.d.ts +109 -14
- package/build/modules/ace/codemods.js +119 -16
- package/build/modules/ace/main.d.ts +30 -0
- package/build/modules/ace/main.js +30 -0
- package/build/modules/app.d.ts +17 -0
- package/build/modules/app.js +17 -0
- package/build/modules/config.d.ts +17 -0
- package/build/modules/config.js +17 -0
- package/build/modules/dumper/dumper.d.ts +5 -0
- package/build/modules/dumper/dumper.js +11 -1
- package/build/modules/dumper/main.d.ts +21 -0
- package/build/modules/dumper/main.js +21 -0
- package/build/modules/encryption.d.ts +17 -0
- package/build/modules/encryption.js +17 -0
- package/build/modules/env/main.d.ts +19 -0
- package/build/modules/env/main.js +19 -0
- package/build/modules/hash/drivers/bcrypt.d.ts +11 -0
- package/build/modules/hash/drivers/bcrypt.js +11 -0
- package/build/modules/hash/main.d.ts +18 -0
- package/build/modules/hash/main.js +18 -0
- package/build/modules/http/url_builder_client.d.ts +1 -0
- package/build/modules/http/url_builder_client.js +9 -0
- package/build/providers/app_provider.d.ts +9 -21
- package/build/providers/app_provider.js +40 -44
- package/build/providers/edge_provider.js +62 -1
- package/build/src/assembler_hooks/index_entities.js +8 -2
- package/build/src/cli_formatters/routes_list.js +23 -7
- package/build/src/helpers/http.d.ts +20 -0
- package/build/src/helpers/http.js +28 -0
- package/build/src/helpers/main.d.ts +1 -5
- package/build/src/helpers/main.js +1 -5
- package/build/src/helpers/string.js +18 -0
- package/build/src/ignitor/http.js +18 -5
- package/build/src/types.d.ts +1 -0
- package/build/src/utils.d.ts +1 -1
- package/build/src/utils.js +13 -3
- package/build/src/vine.js +14 -6
- package/build/types/helpers.d.ts +20 -0
- package/package.json +22 -21
package/build/commands/serve.js
CHANGED
|
@@ -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(
|
|
126
|
+
await this.devServer.startAndWatch({ poll: this.poll || false });
|
|
133
127
|
}
|
|
134
128
|
else {
|
|
135
|
-
await this.devServer.start(
|
|
129
|
+
await this.devServer.start();
|
|
136
130
|
}
|
|
137
131
|
}
|
|
138
132
|
}
|
package/build/commands/test.js
CHANGED
|
@@ -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
|
-
|
|
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();
|
|
@@ -75,29 +75,101 @@ export declare class Codemods extends EventEmitter {
|
|
|
75
75
|
*/
|
|
76
76
|
getTsMorphProject(): Promise<CodeTransformer['project'] | undefined>;
|
|
77
77
|
/**
|
|
78
|
-
* Define validations for the environment variables
|
|
78
|
+
* Define validations for the environment variables in the start/env.ts file.
|
|
79
|
+
* This method updates the environment validation schema using the assembler.
|
|
80
|
+
*
|
|
81
|
+
* @param validations - Validation schema node for environment variables
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* await codemods.defineEnvValidations({
|
|
86
|
+
* NODE_ENV: 'Env.schema.enum(["development", "production", "test"] as const)',
|
|
87
|
+
* PORT: 'Env.schema.number()',
|
|
88
|
+
* HOST: 'Env.schema.string({ format: "host" })'
|
|
89
|
+
* })
|
|
90
|
+
* ```
|
|
79
91
|
*/
|
|
80
92
|
defineEnvValidations(validations: EnvValidationNode): Promise<void>;
|
|
81
93
|
/**
|
|
82
|
-
*
|
|
94
|
+
* Register middleware in the start/kernel.ts file.
|
|
95
|
+
* This method adds middleware to the specified stack (server, router, or named).
|
|
96
|
+
*
|
|
97
|
+
* @param stack - The middleware stack to register to ('server' | 'router' | 'named')
|
|
98
|
+
* @param middleware - Array of middleware nodes to register
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* await codemods.registerMiddleware('server', [
|
|
103
|
+
* {
|
|
104
|
+
* name: 'cors',
|
|
105
|
+
* path: '@adonisjs/cors/cors_middleware'
|
|
106
|
+
* }
|
|
107
|
+
* ])
|
|
108
|
+
* ```
|
|
83
109
|
*/
|
|
84
110
|
registerMiddleware(stack: 'server' | 'router' | 'named', middleware: MiddlewareNode[]): Promise<void>;
|
|
85
111
|
/**
|
|
86
|
-
* Register bouncer policies to the list of policies
|
|
87
|
-
*
|
|
88
|
-
*
|
|
112
|
+
* Register bouncer policies to the list of policies collection exported from
|
|
113
|
+
* the "app/policies/main.ts" file. This method adds new policy definitions
|
|
114
|
+
* to the policies export.
|
|
115
|
+
*
|
|
116
|
+
* @param policies - Array of policy nodes to register
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* await codemods.registerPolicies([
|
|
121
|
+
* {
|
|
122
|
+
* name: 'UserPolicy',
|
|
123
|
+
* path: '#policies/user_policy'
|
|
124
|
+
* }
|
|
125
|
+
* ])
|
|
126
|
+
* ```
|
|
89
127
|
*/
|
|
90
128
|
registerPolicies(policies: BouncerPolicyNode[]): Promise<void>;
|
|
91
129
|
/**
|
|
92
|
-
* Update
|
|
130
|
+
* Update the adonisrc.ts file with new configuration settings.
|
|
131
|
+
* This method allows modification of the AdonisJS runtime configuration.
|
|
132
|
+
*
|
|
133
|
+
* @param params - Parameters for updating the RC file (varies based on update type)
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* await codemods.updateRcFile((rcFile) => {
|
|
138
|
+
* rcFile.addCommand('make:custom')
|
|
139
|
+
* rcFile.addPreloadFile('#app/events/main')
|
|
140
|
+
* })
|
|
141
|
+
* ```
|
|
93
142
|
*/
|
|
94
143
|
updateRcFile(...params: Parameters<CodeTransformer['updateRcFile']>): Promise<void>;
|
|
95
144
|
/**
|
|
96
|
-
* Register a new Vite plugin in the
|
|
145
|
+
* Register a new Vite plugin in the vite.config.ts file.
|
|
146
|
+
* This method adds plugin configuration to the Vite build configuration.
|
|
147
|
+
*
|
|
148
|
+
* @param params - Parameters for adding the Vite plugin (varies based on plugin type)
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* await codemods.registerVitePlugin({
|
|
153
|
+
* name: 'vue',
|
|
154
|
+
* import: 'import vue from "@vitejs/plugin-vue"',
|
|
155
|
+
* options: '()'
|
|
156
|
+
* })
|
|
157
|
+
* ```
|
|
97
158
|
*/
|
|
98
159
|
registerVitePlugin(...params: Parameters<CodeTransformer['addVitePlugin']>): Promise<void>;
|
|
99
160
|
/**
|
|
100
|
-
* Register a new Japa plugin in the
|
|
161
|
+
* Register a new Japa plugin in the tests/bootstrap.ts file.
|
|
162
|
+
* This method adds plugin configuration to the test runner setup.
|
|
163
|
+
*
|
|
164
|
+
* @param params - Parameters for adding the Japa plugin (varies based on plugin type)
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```ts
|
|
168
|
+
* await codemods.registerJapaPlugin({
|
|
169
|
+
* name: 'expect',
|
|
170
|
+
* import: 'import { expect } from "@japa/expect"'
|
|
171
|
+
* })
|
|
172
|
+
* ```
|
|
101
173
|
*/
|
|
102
174
|
registerJapaPlugin(...params: Parameters<CodeTransformer['addJapaPlugin']>): Promise<void>;
|
|
103
175
|
/**
|
|
@@ -143,12 +215,19 @@ export declare class Codemods extends EventEmitter {
|
|
|
143
215
|
skipReason: string;
|
|
144
216
|
}>;
|
|
145
217
|
/**
|
|
146
|
-
* Install packages using the
|
|
147
|
-
*
|
|
148
|
-
* name like
|
|
218
|
+
* Install packages using the detected or specified package manager.
|
|
219
|
+
* Automatically detects npm, yarn, or pnpm and installs dependencies accordingly.
|
|
220
|
+
* You can specify version of each package by setting it in the name like '@adonisjs/lucid@next'.
|
|
149
221
|
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
222
|
+
* @param packages - Array of packages with their dependency type
|
|
223
|
+
* @param packageManager - Optional package manager to use (auto-detected if not provided)
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```ts
|
|
227
|
+
* const success = await codemods.installPackages([
|
|
228
|
+
* { name: '@adonisjs/lucid', isDevDependency: false },
|
|
229
|
+
* { name: '@types/node', isDevDependency: true }
|
|
230
|
+
* ])
|
|
152
231
|
* ```
|
|
153
232
|
*/
|
|
154
233
|
installPackages(packages: {
|
|
@@ -156,7 +235,23 @@ export declare class Codemods extends EventEmitter {
|
|
|
156
235
|
isDevDependency: boolean;
|
|
157
236
|
}[], packageManager?: SupportedPackageManager | 'pnpm@6' | 'deno'): Promise<boolean>;
|
|
158
237
|
/**
|
|
159
|
-
* List the packages
|
|
238
|
+
* List the packages that should be installed manually.
|
|
239
|
+
* This method displays installation commands for different package managers
|
|
240
|
+
* when automatic installation is not available or desired.
|
|
241
|
+
*
|
|
242
|
+
* @param packages - Array of packages with their dependency type
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* await codemods.listPackagesToInstall([
|
|
247
|
+
* { name: '@adonisjs/lucid', isDevDependency: false },
|
|
248
|
+
* { name: '@types/node', isDevDependency: true }
|
|
249
|
+
* ])
|
|
250
|
+
* // Output:
|
|
251
|
+
* // Please install following packages
|
|
252
|
+
* // npm i -D @types/node
|
|
253
|
+
* // npm i @adonisjs/lucid
|
|
254
|
+
* ```
|
|
160
255
|
*/
|
|
161
256
|
listPackagesToInstall(packages: {
|
|
162
257
|
name: string;
|
|
@@ -147,7 +147,19 @@ export class Codemods extends EventEmitter {
|
|
|
147
147
|
return transformer.project;
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
|
-
* Define validations for the environment variables
|
|
150
|
+
* Define validations for the environment variables in the start/env.ts file.
|
|
151
|
+
* This method updates the environment validation schema using the assembler.
|
|
152
|
+
*
|
|
153
|
+
* @param validations - Validation schema node for environment variables
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* await codemods.defineEnvValidations({
|
|
158
|
+
* NODE_ENV: 'Env.schema.enum(["development", "production", "test"] as const)',
|
|
159
|
+
* PORT: 'Env.schema.number()',
|
|
160
|
+
* HOST: 'Env.schema.string({ format: "host" })'
|
|
161
|
+
* })
|
|
162
|
+
* ```
|
|
151
163
|
*/
|
|
152
164
|
async defineEnvValidations(validations) {
|
|
153
165
|
const transformer = await this.#getCodeTransformer();
|
|
@@ -166,7 +178,21 @@ export class Codemods extends EventEmitter {
|
|
|
166
178
|
}
|
|
167
179
|
}
|
|
168
180
|
/**
|
|
169
|
-
*
|
|
181
|
+
* Register middleware in the start/kernel.ts file.
|
|
182
|
+
* This method adds middleware to the specified stack (server, router, or named).
|
|
183
|
+
*
|
|
184
|
+
* @param stack - The middleware stack to register to ('server' | 'router' | 'named')
|
|
185
|
+
* @param middleware - Array of middleware nodes to register
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* await codemods.registerMiddleware('server', [
|
|
190
|
+
* {
|
|
191
|
+
* name: 'cors',
|
|
192
|
+
* path: '@adonisjs/cors/cors_middleware'
|
|
193
|
+
* }
|
|
194
|
+
* ])
|
|
195
|
+
* ```
|
|
170
196
|
*/
|
|
171
197
|
async registerMiddleware(stack, middleware) {
|
|
172
198
|
const transformer = await this.#getCodeTransformer();
|
|
@@ -185,9 +211,21 @@ export class Codemods extends EventEmitter {
|
|
|
185
211
|
}
|
|
186
212
|
}
|
|
187
213
|
/**
|
|
188
|
-
* Register bouncer policies to the list of policies
|
|
189
|
-
*
|
|
190
|
-
*
|
|
214
|
+
* Register bouncer policies to the list of policies collection exported from
|
|
215
|
+
* the "app/policies/main.ts" file. This method adds new policy definitions
|
|
216
|
+
* to the policies export.
|
|
217
|
+
*
|
|
218
|
+
* @param policies - Array of policy nodes to register
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```ts
|
|
222
|
+
* await codemods.registerPolicies([
|
|
223
|
+
* {
|
|
224
|
+
* name: 'UserPolicy',
|
|
225
|
+
* path: '#policies/user_policy'
|
|
226
|
+
* }
|
|
227
|
+
* ])
|
|
228
|
+
* ```
|
|
191
229
|
*/
|
|
192
230
|
async registerPolicies(policies) {
|
|
193
231
|
const transformer = await this.#getCodeTransformer();
|
|
@@ -206,7 +244,18 @@ export class Codemods extends EventEmitter {
|
|
|
206
244
|
}
|
|
207
245
|
}
|
|
208
246
|
/**
|
|
209
|
-
* Update
|
|
247
|
+
* Update the adonisrc.ts file with new configuration settings.
|
|
248
|
+
* This method allows modification of the AdonisJS runtime configuration.
|
|
249
|
+
*
|
|
250
|
+
* @param params - Parameters for updating the RC file (varies based on update type)
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```ts
|
|
254
|
+
* await codemods.updateRcFile((rcFile) => {
|
|
255
|
+
* rcFile.addCommand('make:custom')
|
|
256
|
+
* rcFile.addPreloadFile('#app/events/main')
|
|
257
|
+
* })
|
|
258
|
+
* ```
|
|
210
259
|
*/
|
|
211
260
|
async updateRcFile(...params) {
|
|
212
261
|
const transformer = await this.#getCodeTransformer();
|
|
@@ -225,7 +274,19 @@ export class Codemods extends EventEmitter {
|
|
|
225
274
|
}
|
|
226
275
|
}
|
|
227
276
|
/**
|
|
228
|
-
* Register a new Vite plugin in the
|
|
277
|
+
* Register a new Vite plugin in the vite.config.ts file.
|
|
278
|
+
* This method adds plugin configuration to the Vite build configuration.
|
|
279
|
+
*
|
|
280
|
+
* @param params - Parameters for adding the Vite plugin (varies based on plugin type)
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```ts
|
|
284
|
+
* await codemods.registerVitePlugin({
|
|
285
|
+
* name: 'vue',
|
|
286
|
+
* import: 'import vue from "@vitejs/plugin-vue"',
|
|
287
|
+
* options: '()'
|
|
288
|
+
* })
|
|
289
|
+
* ```
|
|
229
290
|
*/
|
|
230
291
|
async registerVitePlugin(...params) {
|
|
231
292
|
const transformer = await this.#getCodeTransformer();
|
|
@@ -244,7 +305,18 @@ export class Codemods extends EventEmitter {
|
|
|
244
305
|
}
|
|
245
306
|
}
|
|
246
307
|
/**
|
|
247
|
-
* Register a new Japa plugin in the
|
|
308
|
+
* Register a new Japa plugin in the tests/bootstrap.ts file.
|
|
309
|
+
* This method adds plugin configuration to the test runner setup.
|
|
310
|
+
*
|
|
311
|
+
* @param params - Parameters for adding the Japa plugin (varies based on plugin type)
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```ts
|
|
315
|
+
* await codemods.registerJapaPlugin({
|
|
316
|
+
* name: 'expect',
|
|
317
|
+
* import: 'import { expect } from "@japa/expect"'
|
|
318
|
+
* })
|
|
319
|
+
* ```
|
|
248
320
|
*/
|
|
249
321
|
async registerJapaPlugin(...params) {
|
|
250
322
|
const transformer = await this.#getCodeTransformer();
|
|
@@ -296,20 +368,35 @@ export class Codemods extends EventEmitter {
|
|
|
296
368
|
return result;
|
|
297
369
|
}
|
|
298
370
|
/**
|
|
299
|
-
* Install packages using the
|
|
300
|
-
*
|
|
301
|
-
* name like
|
|
371
|
+
* Install packages using the detected or specified package manager.
|
|
372
|
+
* Automatically detects npm, yarn, or pnpm and installs dependencies accordingly.
|
|
373
|
+
* You can specify version of each package by setting it in the name like '@adonisjs/lucid@next'.
|
|
302
374
|
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
375
|
+
* @param packages - Array of packages with their dependency type
|
|
376
|
+
* @param packageManager - Optional package manager to use (auto-detected if not provided)
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* const success = await codemods.installPackages([
|
|
381
|
+
* { name: '@adonisjs/lucid', isDevDependency: false },
|
|
382
|
+
* { name: '@types/node', isDevDependency: true }
|
|
383
|
+
* ])
|
|
305
384
|
* ```
|
|
306
385
|
*/
|
|
307
386
|
async installPackages(packages, packageManager) {
|
|
308
387
|
const transformer = await this.#getCodeTransformer();
|
|
309
388
|
const appPath = this.#app.makePath();
|
|
310
389
|
const colors = this.#cliLogger.getColors();
|
|
311
|
-
const devDependencies = packages
|
|
312
|
-
|
|
390
|
+
const devDependencies = packages
|
|
391
|
+
.filter((pkg) => pkg.isDevDependency)
|
|
392
|
+
.map(({ name }) => {
|
|
393
|
+
return name.startsWith('@adonisjs/') ? `${name}@next` : name;
|
|
394
|
+
});
|
|
395
|
+
const dependencies = packages
|
|
396
|
+
.filter((pkg) => !pkg.isDevDependency)
|
|
397
|
+
.map(({ name }) => {
|
|
398
|
+
return name.startsWith('@adonisjs/') ? `${name}@next` : name;
|
|
399
|
+
});
|
|
313
400
|
if (!transformer) {
|
|
314
401
|
this.#cliLogger.warning('Cannot install packages. Install "@adonisjs/assembler" or manually install following packages');
|
|
315
402
|
this.#cliLogger.log(`devDependencies: ${devDependencies.join(',')}`);
|
|
@@ -357,7 +444,23 @@ export class Codemods extends EventEmitter {
|
|
|
357
444
|
}
|
|
358
445
|
}
|
|
359
446
|
/**
|
|
360
|
-
* List the packages
|
|
447
|
+
* List the packages that should be installed manually.
|
|
448
|
+
* This method displays installation commands for different package managers
|
|
449
|
+
* when automatic installation is not available or desired.
|
|
450
|
+
*
|
|
451
|
+
* @param packages - Array of packages with their dependency type
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```ts
|
|
455
|
+
* await codemods.listPackagesToInstall([
|
|
456
|
+
* { name: '@adonisjs/lucid', isDevDependency: false },
|
|
457
|
+
* { name: '@types/node', isDevDependency: true }
|
|
458
|
+
* ])
|
|
459
|
+
* // Output:
|
|
460
|
+
* // Please install following packages
|
|
461
|
+
* // npm i -D @types/node
|
|
462
|
+
* // npm i @adonisjs/lucid
|
|
463
|
+
* ```
|
|
361
464
|
*/
|
|
362
465
|
async listPackagesToInstall(packages) {
|
|
363
466
|
const appPath = this.#app.makePath();
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ace command line interface module for AdonisJS applications.
|
|
3
|
+
* Provides the kernel, base commands, and utilities for building CLI applications.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* // Create and use the Ace kernel
|
|
7
|
+
* import { Kernel, BaseCommand } from '@adonisjs/core/ace'
|
|
8
|
+
*
|
|
9
|
+
* const kernel = new Kernel(app)
|
|
10
|
+
* await kernel.handle(['make:controller', 'UserController'])
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Create a custom command
|
|
14
|
+
* import { BaseCommand, args, flags } from '@adonisjs/core/ace'
|
|
15
|
+
*
|
|
16
|
+
* export default class MakeUser extends BaseCommand {
|
|
17
|
+
* static commandName = 'make:user'
|
|
18
|
+
* static description = 'Create a new user'
|
|
19
|
+
*
|
|
20
|
+
* @args.string({ description: 'Name of the user' })
|
|
21
|
+
* declare name: string
|
|
22
|
+
*
|
|
23
|
+
* @flags.boolean({ description: 'Create admin user' })
|
|
24
|
+
* declare admin: boolean
|
|
25
|
+
*
|
|
26
|
+
* async run() {
|
|
27
|
+
* this.logger.info(`Creating user: ${this.name}`)
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
*/
|
|
1
31
|
export { Kernel } from './kernel.ts';
|
|
2
32
|
export { BaseCommand, ListCommand } from './commands.ts';
|
|
3
33
|
export { args, flags, errors, Parser, FsLoader, ListLoader, cliHelpers, HelpCommand, IndexGenerator, tracingChannels, } from '@adonisjs/ace';
|
|
@@ -6,6 +6,36 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Ace command line interface module for AdonisJS applications.
|
|
11
|
+
* Provides the kernel, base commands, and utilities for building CLI applications.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Create and use the Ace kernel
|
|
15
|
+
* import { Kernel, BaseCommand } from '@adonisjs/core/ace'
|
|
16
|
+
*
|
|
17
|
+
* const kernel = new Kernel(app)
|
|
18
|
+
* await kernel.handle(['make:controller', 'UserController'])
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Create a custom command
|
|
22
|
+
* import { BaseCommand, args, flags } from '@adonisjs/core/ace'
|
|
23
|
+
*
|
|
24
|
+
* export default class MakeUser extends BaseCommand {
|
|
25
|
+
* static commandName = 'make:user'
|
|
26
|
+
* static description = 'Create a new user'
|
|
27
|
+
*
|
|
28
|
+
* @args.string({ description: 'Name of the user' })
|
|
29
|
+
* declare name: string
|
|
30
|
+
*
|
|
31
|
+
* @flags.boolean({ description: 'Create admin user' })
|
|
32
|
+
* declare admin: boolean
|
|
33
|
+
*
|
|
34
|
+
* async run() {
|
|
35
|
+
* this.logger.info(`Creating user: ${this.name}`)
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
9
39
|
export { Kernel } from "./kernel.js";
|
|
10
40
|
export { BaseCommand, ListCommand } from "./commands.js";
|
|
11
41
|
export { args, flags, errors, Parser, FsLoader, ListLoader, cliHelpers, HelpCommand, IndexGenerator, tracingChannels, } from '@adonisjs/ace';
|
package/build/modules/app.d.ts
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application module re-exports all functionality from @adonisjs/application.
|
|
3
|
+
* This includes the main Application class and related types for managing
|
|
4
|
+
* the AdonisJS application lifecycle, container bindings, and service providers.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* // Import the Application class
|
|
8
|
+
* import { Application } from '@adonisjs/core/app'
|
|
9
|
+
*
|
|
10
|
+
* const app = new Application(new URL('../', import.meta.url))
|
|
11
|
+
* await app.init()
|
|
12
|
+
* await app.boot()
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Import application types
|
|
16
|
+
* import type { ApplicationService, ContainerBindings } from '@adonisjs/core/app'
|
|
17
|
+
*/
|
|
1
18
|
export * from '@adonisjs/application';
|
package/build/modules/app.js
CHANGED
|
@@ -6,4 +6,21 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Application module re-exports all functionality from @adonisjs/application.
|
|
11
|
+
* This includes the main Application class and related types for managing
|
|
12
|
+
* the AdonisJS application lifecycle, container bindings, and service providers.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Import the Application class
|
|
16
|
+
* import { Application } from '@adonisjs/core/app'
|
|
17
|
+
*
|
|
18
|
+
* const app = new Application(new URL('../', import.meta.url))
|
|
19
|
+
* await app.init()
|
|
20
|
+
* await app.boot()
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Import application types
|
|
24
|
+
* import type { ApplicationService, ContainerBindings } from '@adonisjs/core/app'
|
|
25
|
+
*/
|
|
9
26
|
export * from '@adonisjs/application';
|
|
@@ -1 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration module re-exports all functionality from @adonisjs/config.
|
|
3
|
+
* This includes the Config class and related types for managing application
|
|
4
|
+
* configuration files and environment-specific settings.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* // Import the Config class
|
|
8
|
+
* import { Config } from '@adonisjs/core/config'
|
|
9
|
+
*
|
|
10
|
+
* const config = new Config()
|
|
11
|
+
* config.set('database.connection', 'mysql')
|
|
12
|
+
* const dbConnection = config.get('database.connection')
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Import configuration types
|
|
16
|
+
* import type { ConfigProvider } from '@adonisjs/core/config'
|
|
17
|
+
*/
|
|
1
18
|
export * from '@adonisjs/config';
|
package/build/modules/config.js
CHANGED
|
@@ -6,4 +6,21 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Configuration module re-exports all functionality from @adonisjs/config.
|
|
11
|
+
* This includes the Config class and related types for managing application
|
|
12
|
+
* configuration files and environment-specific settings.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Import the Config class
|
|
16
|
+
* import { Config } from '@adonisjs/core/config'
|
|
17
|
+
*
|
|
18
|
+
* const config = new Config()
|
|
19
|
+
* config.set('database.connection', 'mysql')
|
|
20
|
+
* const dbConnection = config.get('database.connection')
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Import configuration types
|
|
24
|
+
* import type { ConfigProvider } from '@adonisjs/core/config'
|
|
25
|
+
*/
|
|
9
26
|
export * from '@adonisjs/config';
|
|
@@ -28,6 +28,11 @@ import type { Application } from '../app.ts';
|
|
|
28
28
|
*/
|
|
29
29
|
export declare class Dumper {
|
|
30
30
|
#private;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new Dumper instance
|
|
33
|
+
*
|
|
34
|
+
* @param app - The AdonisJS application instance
|
|
35
|
+
*/
|
|
31
36
|
constructor(app: Application<any>);
|
|
32
37
|
/**
|
|
33
38
|
* Configure the HTML formatter output options
|
|
@@ -89,12 +89,22 @@ export class Dumper {
|
|
|
89
89
|
atom: 'atom://core/open/file?filename=%f&line=%l',
|
|
90
90
|
vscode: 'vscode://file/%f:%l',
|
|
91
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* Creates a new Dumper instance
|
|
94
|
+
*
|
|
95
|
+
* @param app - The AdonisJS application instance
|
|
96
|
+
*/
|
|
92
97
|
constructor(app) {
|
|
93
98
|
this.#app = app;
|
|
94
99
|
}
|
|
95
100
|
/**
|
|
96
101
|
* Returns the link to open the file using dd inside one
|
|
97
|
-
* of the known code editors
|
|
102
|
+
* of the known code editors. Constructs a URL that can be used
|
|
103
|
+
* to open the file at a specific line in supported editors.
|
|
104
|
+
*
|
|
105
|
+
* @param source - Optional source file information
|
|
106
|
+
* @param source.location - The file path to open
|
|
107
|
+
* @param source.line - The line number to jump to
|
|
98
108
|
*/
|
|
99
109
|
#getEditorLink(source) {
|
|
100
110
|
const editorURL = this.#editors[IDE] || IDE;
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dumper module provides debugging and inspection utilities for AdonisJS applications.
|
|
3
|
+
* Includes the Dumper class for formatting output, error classes, and configuration helpers.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* // Use the dumper service
|
|
7
|
+
* import { Dumper } from '@adonisjs/core/dumper'
|
|
8
|
+
*
|
|
9
|
+
* const dumper = new Dumper(app)
|
|
10
|
+
* const htmlOutput = dumper.dumpToHtml(user, { title: 'User Data' })
|
|
11
|
+
* const ansiOutput = dumper.dumpToAnsi(user, { title: 'Debug User' })
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Configure dumper output
|
|
15
|
+
* import { defineConfig } from '@adonisjs/core/dumper'
|
|
16
|
+
*
|
|
17
|
+
* export default defineConfig({
|
|
18
|
+
* html: { showHidden: true, depth: 5 },
|
|
19
|
+
* console: { collapse: ['Date', 'DateTime'] }
|
|
20
|
+
* })
|
|
21
|
+
*/
|
|
1
22
|
export * as errors from './errors.ts';
|
|
2
23
|
export { Dumper } from './dumper.ts';
|
|
3
24
|
export { defineConfig } from './define_config.ts';
|
|
@@ -6,6 +6,27 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Dumper module provides debugging and inspection utilities for AdonisJS applications.
|
|
11
|
+
* Includes the Dumper class for formatting output, error classes, and configuration helpers.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Use the dumper service
|
|
15
|
+
* import { Dumper } from '@adonisjs/core/dumper'
|
|
16
|
+
*
|
|
17
|
+
* const dumper = new Dumper(app)
|
|
18
|
+
* const htmlOutput = dumper.dumpToHtml(user, { title: 'User Data' })
|
|
19
|
+
* const ansiOutput = dumper.dumpToAnsi(user, { title: 'Debug User' })
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Configure dumper output
|
|
23
|
+
* import { defineConfig } from '@adonisjs/core/dumper'
|
|
24
|
+
*
|
|
25
|
+
* export default defineConfig({
|
|
26
|
+
* html: { showHidden: true, depth: 5 },
|
|
27
|
+
* console: { collapse: ['Date', 'DateTime'] }
|
|
28
|
+
* })
|
|
29
|
+
*/
|
|
9
30
|
export * as errors from "./errors.js";
|
|
10
31
|
export { Dumper } from "./dumper.js";
|
|
11
32
|
export { defineConfig } from "./define_config.js";
|