@adonisjs/core 6.1.5-2 → 6.1.5-20
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/build.d.ts +10 -0
- package/build/commands/build.js +65 -22
- package/build/commands/commands.json +1 -1
- package/build/commands/configure.d.ts +30 -3
- package/build/commands/configure.js +103 -25
- package/build/commands/eject.d.ts +4 -0
- package/build/commands/eject.js +16 -8
- package/build/commands/generate_key.d.ts +4 -0
- package/build/commands/generate_key.js +15 -8
- package/build/commands/inspect_rcfile.d.ts +9 -0
- package/build/commands/inspect_rcfile.js +36 -0
- package/build/commands/list/routes.d.ts +23 -0
- package/build/commands/list/routes.js +29 -13
- package/build/commands/main.d.ts +4 -0
- package/build/commands/make/command.d.ts +7 -1
- package/build/commands/make/command.js +20 -7
- package/build/commands/make/controller.d.ts +10 -1
- package/build/commands/make/controller.js +35 -14
- package/build/commands/make/event.d.ts +7 -1
- package/build/commands/make/event.js +20 -8
- package/build/commands/make/exception.d.ts +14 -0
- package/build/commands/make/exception.js +37 -0
- package/build/commands/make/listener.d.ts +8 -1
- package/build/commands/make/listener.js +28 -12
- package/build/commands/make/middleware.d.ts +8 -1
- package/build/commands/make/middleware.js +21 -8
- package/build/commands/make/preload.d.ts +22 -0
- package/build/commands/make/preload.js +99 -0
- package/build/commands/make/provider.d.ts +7 -1
- package/build/commands/make/provider.js +28 -8
- package/build/commands/make/service.d.ts +14 -0
- package/build/commands/make/service.js +37 -0
- package/build/commands/make/test.d.ts +10 -1
- package/build/commands/make/test.js +46 -10
- package/build/commands/make/validator.d.ts +14 -0
- package/build/commands/make/validator.js +37 -0
- package/build/commands/make/view.d.ts +14 -0
- package/build/commands/make/view.js +37 -0
- package/build/commands/repl.d.ts +14 -0
- package/build/commands/repl.js +30 -0
- package/build/commands/serve.d.ts +12 -0
- package/build/commands/serve.js +78 -27
- package/build/commands/test.d.ts +32 -0
- package/build/commands/test.js +203 -0
- package/build/factories/app.js +8 -0
- package/build/factories/bodyparser.js +8 -0
- package/build/factories/core/ace.d.ts +4 -1
- package/build/factories/core/ace.js +11 -0
- package/build/factories/core/ignitor.d.ts +20 -1
- package/build/factories/core/ignitor.js +35 -1
- package/build/factories/core/main.js +8 -0
- package/build/factories/core/test_utils.d.ts +4 -1
- package/build/factories/core/test_utils.js +11 -0
- package/build/factories/encryption.js +8 -0
- package/build/factories/events.js +8 -0
- package/build/factories/hash.js +8 -0
- package/build/factories/http.js +8 -0
- package/build/factories/logger.js +8 -0
- package/build/factories/stubs.d.ts +10 -0
- package/build/factories/stubs.js +23 -1
- package/build/index.d.ts +6 -2
- package/build/index.js +14 -1
- package/build/modules/ace/codemods.d.ts +54 -0
- package/build/modules/ace/codemods.js +133 -0
- package/build/modules/ace/commands.d.ts +48 -0
- package/build/modules/ace/commands.js +54 -0
- package/build/modules/ace/create_kernel.d.ts +9 -0
- package/build/modules/ace/create_kernel.js +32 -1
- package/build/modules/ace/kernel.d.ts +4 -0
- package/build/modules/ace/kernel.js +12 -0
- package/build/modules/ace/main.js +8 -0
- package/build/modules/ace/shell.d.ts +9 -1
- package/build/modules/ace/shell.js +21 -0
- package/build/modules/app.js +8 -0
- package/build/modules/bodyparser/bodyparser_middleware.d.ts +4 -0
- package/build/modules/bodyparser/bodyparser_middleware.js +12 -0
- package/build/modules/bodyparser/main.js +8 -0
- package/build/modules/config.js +8 -0
- package/build/modules/container.js +8 -0
- package/build/modules/encryption.js +8 -0
- package/build/modules/env.js +8 -0
- package/build/modules/events.js +8 -0
- package/build/modules/hash/define_config.d.ts +4 -0
- package/build/modules/hash/define_config.js +23 -0
- package/build/modules/hash/drivers/argon.d.ts +1 -0
- package/build/modules/hash/drivers/argon.js +9 -0
- package/build/modules/hash/drivers/bcrypt.d.ts +1 -0
- package/build/modules/hash/drivers/bcrypt.js +9 -0
- package/build/modules/hash/drivers/scrypt.d.ts +1 -0
- package/build/modules/hash/drivers/scrypt.js +9 -0
- package/build/modules/hash/drivers_collection.d.ts +16 -4
- package/build/modules/hash/drivers_collection.js +31 -8
- package/build/modules/hash/main.d.ts +1 -0
- package/build/modules/hash/main.js +9 -0
- package/build/modules/http/main.js +9 -0
- package/build/modules/http/request_validator.d.ts +44 -0
- package/build/modules/http/request_validator.js +74 -0
- package/build/modules/logger.js +8 -0
- package/build/modules/repl.d.ts +1 -0
- package/build/modules/repl.js +9 -0
- package/build/providers/app_provider.d.ts +31 -2
- package/build/providers/app_provider.js +44 -15
- package/build/providers/edge_provider.d.ts +10 -0
- package/build/providers/edge_provider.js +22 -0
- package/build/providers/hash_provider.d.ts +22 -2
- package/build/providers/hash_provider.js +49 -7
- package/build/providers/http_provider.d.ts +17 -0
- package/build/providers/http_provider.js +26 -1
- package/build/providers/repl_provider.d.ts +13 -0
- package/build/providers/repl_provider.js +35 -0
- package/build/providers/vinejs_provider.d.ts +5 -0
- package/build/providers/vinejs_provider.js +13 -0
- package/build/services/ace.js +15 -0
- package/build/services/app.d.ts +8 -0
- package/build/services/app.js +16 -0
- package/build/services/config.js +11 -0
- package/build/services/emitter.js +13 -2
- package/build/services/encryption.js +13 -2
- package/build/services/hash.js +13 -2
- package/build/services/logger.js +13 -2
- package/build/services/repl.d.ts +3 -0
- package/build/services/repl.js +18 -0
- package/build/services/router.js +13 -2
- package/build/services/server.js +13 -2
- package/build/services/test_utils.js +15 -0
- package/build/src/bindings/edge/main.d.ts +7 -0
- package/build/src/bindings/edge/main.js +58 -0
- package/build/src/bindings/edge/types.d.ts +18 -0
- package/build/src/bindings/edge/types.js +9 -0
- package/build/src/bindings/repl.d.ts +6 -0
- package/build/src/bindings/repl.js +78 -0
- package/build/src/bindings/vinejs/main.d.ts +13 -0
- package/build/src/bindings/vinejs/main.js +76 -0
- package/build/src/bindings/vinejs/types.d.ts +12 -0
- package/build/src/bindings/vinejs/types.js +9 -0
- package/build/src/cli_formatters/routes_list.d.ts +24 -1
- package/build/src/cli_formatters/routes_list.js +118 -0
- package/build/src/debug.d.ts +1 -1
- package/build/src/debug.js +8 -0
- package/build/src/exceptions.d.ts +1 -0
- package/build/src/exceptions.js +9 -0
- package/build/src/helpers/is.js +8 -0
- package/build/src/helpers/main.d.ts +1 -1
- package/build/src/helpers/main.js +9 -1
- package/build/src/helpers/parse_binding_reference.d.ts +40 -0
- package/build/src/helpers/parse_binding_reference.js +60 -0
- package/build/src/helpers/string.d.ts +26 -0
- package/build/src/helpers/string.js +15 -0
- package/build/src/helpers/types.d.ts +114 -16
- package/build/src/helpers/types.js +13 -0
- package/build/src/ignitor/ace.d.ts +12 -0
- package/build/src/ignitor/ace.js +50 -1
- package/build/src/ignitor/http.d.ts +9 -2
- package/build/src/ignitor/http.js +67 -0
- package/build/src/ignitor/main.d.ts +29 -1
- package/build/src/ignitor/main.js +56 -0
- package/build/src/ignitor/test.d.ts +10 -0
- package/build/src/ignitor/test.js +25 -0
- package/build/src/internal_helpers.d.ts +12 -5
- package/build/src/internal_helpers.js +35 -7
- package/build/src/test_utils/http.d.ts +10 -2
- package/build/src/test_utils/http.js +19 -0
- package/build/src/test_utils/main.d.ts +21 -3
- package/build/src/test_utils/main.js +27 -1
- package/build/src/types.d.ts +65 -4
- package/build/src/types.js +8 -0
- package/build/stubs/main.js +10 -0
- package/build/stubs/make/exception/main.stub +10 -0
- package/build/stubs/make/preload_file/main.stub +4 -0
- package/build/stubs/make/service/main.stub +4 -0
- package/build/stubs/make/validator/main.stub +5 -0
- package/build/stubs/make/view/main.stub +4 -0
- package/build/toolkit/commands/index_commands.d.ts +4 -0
- package/build/toolkit/commands/index_commands.js +13 -5
- package/build/toolkit/main.js +11 -0
- package/build/types/ace.js +8 -0
- package/build/types/app.js +8 -0
- package/build/types/bodyparser.js +8 -0
- package/build/types/container.js +8 -0
- package/build/types/encryption.js +8 -0
- package/build/types/events.js +8 -0
- package/build/types/hash.js +8 -0
- package/build/types/http.js +8 -0
- package/build/types/logger.js +8 -0
- package/build/types/repl.d.ts +1 -0
- package/build/types/repl.js +9 -0
- package/package.json +83 -121
- package/build/commands/make/_base.d.ts +0 -6
- package/build/commands/make/_base.js +0 -19
- package/build/legacy/validator.d.ts +0 -1
- package/build/legacy/validator.js +0 -1
- package/build/modules/http.js +0 -1
- package/build/src/helpers/string_builder.d.ts +0 -23
- package/build/src/helpers/string_builder.js +0 -86
- package/build/stubs/index.js +0 -2
- /package/build/modules/{http.d.ts → http/main.d.ts} +0 -0
- /package/build/stubs/{index.d.ts → main.d.ts} +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, flags, BaseCommand } from '../../modules/ace/main.js';
|
|
17
|
+
const ALLOWED_ENVIRONMENTS = ['web', 'console', 'test', 'repl'];
|
|
18
|
+
/**
|
|
19
|
+
* Make a new preload file
|
|
20
|
+
*/
|
|
21
|
+
export default class MakePreload extends BaseCommand {
|
|
22
|
+
static commandName = 'make:preload';
|
|
23
|
+
static description = 'Create a new preload file inside the start directory';
|
|
24
|
+
/**
|
|
25
|
+
* The stub to use for generating the preload file
|
|
26
|
+
*/
|
|
27
|
+
stubPath = 'make/preload_file/main.stub';
|
|
28
|
+
/**
|
|
29
|
+
* Check if the mentioned environments are valid
|
|
30
|
+
*/
|
|
31
|
+
#isValidEnvironment(environment) {
|
|
32
|
+
return !environment.find((one) => !ALLOWED_ENVIRONMENTS.includes(one));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Validate the environments flag passed by the user
|
|
36
|
+
*/
|
|
37
|
+
#isEnvironmentsFlagValid() {
|
|
38
|
+
if (!this.environments || !this.environments.length) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return this.#isValidEnvironment(this.environments);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Prompt for the environments
|
|
45
|
+
*/
|
|
46
|
+
async #promptForEnvironments() {
|
|
47
|
+
const selectedEnvironments = await this.prompt.multiple('Select the environment(s) in which you want to load this file', [
|
|
48
|
+
{ name: 'all', message: 'Load file in all environments' },
|
|
49
|
+
{ name: 'console', message: 'Environment for ace commands' },
|
|
50
|
+
{ name: 'repl', message: 'Environment for the REPL session' },
|
|
51
|
+
{ name: 'web', message: 'Environment for HTTP requests' },
|
|
52
|
+
{ name: 'test', message: 'Environment for the test process' },
|
|
53
|
+
]);
|
|
54
|
+
if (selectedEnvironments.includes('all')) {
|
|
55
|
+
return ['web', 'console', 'test', 'repl'];
|
|
56
|
+
}
|
|
57
|
+
return selectedEnvironments;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Run command
|
|
61
|
+
*/
|
|
62
|
+
async run() {
|
|
63
|
+
let environments = this.environments;
|
|
64
|
+
/**
|
|
65
|
+
* Ensure the environments are valid when provided via flag
|
|
66
|
+
*/
|
|
67
|
+
if (!this.#isEnvironmentsFlagValid()) {
|
|
68
|
+
this.logger.error(`Invalid environment(s) "${this.environments}". Only "${ALLOWED_ENVIRONMENTS}" are allowed`);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Prompt for the environments when not defined
|
|
73
|
+
*/
|
|
74
|
+
if (!environments) {
|
|
75
|
+
environments = await this.#promptForEnvironments();
|
|
76
|
+
}
|
|
77
|
+
const codemods = await this.createCodemods();
|
|
78
|
+
const output = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
79
|
+
flags: this.parsed.flags,
|
|
80
|
+
entity: this.app.generators.createEntity(this.name),
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* Registering the preload file with the `.adonisrc.json` file. We register
|
|
84
|
+
* the relative path, since we cannot be sure about aliases to exist.
|
|
85
|
+
*/
|
|
86
|
+
const preloadImportPath = `./${output.relativeFileName.replace(/(\.js|\.ts)$/, '')}.js`;
|
|
87
|
+
await codemods.updateRcFile((rcFile) => {
|
|
88
|
+
rcFile.addPreloadFile(preloadImportPath, environments);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
__decorate([
|
|
93
|
+
args.string({ description: 'Name of the preload file' })
|
|
94
|
+
], MakePreload.prototype, "name", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
flags.array({
|
|
97
|
+
description: `Define the preload file's environment. Accepted values are "${ALLOWED_ENVIRONMENTS}"`,
|
|
98
|
+
})
|
|
99
|
+
], MakePreload.prototype, "environments", void 0);
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import BaseCommand from '
|
|
1
|
+
import { BaseCommand } from '../../modules/ace/main.js';
|
|
2
|
+
/**
|
|
3
|
+
* Make a new provider class
|
|
4
|
+
*/
|
|
2
5
|
export default class MakeProvider extends BaseCommand {
|
|
3
6
|
static commandName: string;
|
|
4
7
|
static description: string;
|
|
5
8
|
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The stub to use for generating the provider class
|
|
11
|
+
*/
|
|
6
12
|
protected stubPath: string;
|
|
7
13
|
run(): Promise<void>;
|
|
8
14
|
}
|
|
@@ -1,25 +1,45 @@
|
|
|
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
|
+
*/
|
|
1
9
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
10
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
11
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
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;
|
|
5
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
14
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, BaseCommand } from '../../modules/ace/main.js';
|
|
17
|
+
/**
|
|
18
|
+
* Make a new provider class
|
|
19
|
+
*/
|
|
12
20
|
export default class MakeProvider extends BaseCommand {
|
|
13
21
|
static commandName = 'make:provider';
|
|
14
22
|
static description = 'Create a new service provider class';
|
|
23
|
+
/**
|
|
24
|
+
* The stub to use for generating the provider class
|
|
25
|
+
*/
|
|
15
26
|
stubPath = 'make/provider/main.stub';
|
|
16
27
|
async run() {
|
|
17
|
-
await this.
|
|
28
|
+
const codemods = await this.createCodemods();
|
|
29
|
+
const output = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
30
|
+
flags: this.parsed.flags,
|
|
18
31
|
entity: this.app.generators.createEntity(this.name),
|
|
19
32
|
});
|
|
33
|
+
/**
|
|
34
|
+
* Registering the provider with the `.adonisrc.json` file. We register
|
|
35
|
+
* the relative path, since we cannot be sure about aliases to exist.
|
|
36
|
+
*/
|
|
37
|
+
const providerImportPath = `./${output.relativeFileName.replace(/(\.js|\.ts)$/, '')}.js`;
|
|
38
|
+
await codemods.updateRcFile((rcFile) => {
|
|
39
|
+
rcFile.addProvider(providerImportPath);
|
|
40
|
+
});
|
|
20
41
|
}
|
|
21
42
|
}
|
|
22
43
|
__decorate([
|
|
23
|
-
args.string({ description: 'Name of the provider' })
|
|
24
|
-
__metadata("design:type", String)
|
|
44
|
+
args.string({ description: 'Name of the provider' })
|
|
25
45
|
], MakeProvider.prototype, "name", void 0);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../modules/ace/main.js';
|
|
2
|
+
/**
|
|
3
|
+
* Make a new service class
|
|
4
|
+
*/
|
|
5
|
+
export default class MakeService extends BaseCommand {
|
|
6
|
+
static commandName: string;
|
|
7
|
+
static description: string;
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The stub to use for generating the service class
|
|
11
|
+
*/
|
|
12
|
+
protected stubPath: string;
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, BaseCommand } from '../../modules/ace/main.js';
|
|
17
|
+
/**
|
|
18
|
+
* Make a new service class
|
|
19
|
+
*/
|
|
20
|
+
export default class MakeService extends BaseCommand {
|
|
21
|
+
static commandName = 'make:service';
|
|
22
|
+
static description = 'Create a new service class';
|
|
23
|
+
/**
|
|
24
|
+
* The stub to use for generating the service class
|
|
25
|
+
*/
|
|
26
|
+
stubPath = 'make/service/main.stub';
|
|
27
|
+
async run() {
|
|
28
|
+
const codemods = await this.createCodemods();
|
|
29
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
30
|
+
flags: this.parsed.flags,
|
|
31
|
+
entity: this.app.generators.createEntity(this.name),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
__decorate([
|
|
36
|
+
args.string({ description: 'Name of the service' })
|
|
37
|
+
], MakeService.prototype, "name", void 0);
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import BaseCommand from '
|
|
1
|
+
import { BaseCommand } from '../../modules/ace/main.js';
|
|
2
|
+
/**
|
|
3
|
+
* Make a new test file
|
|
4
|
+
*/
|
|
2
5
|
export default class MakeTest extends BaseCommand {
|
|
3
6
|
#private;
|
|
4
7
|
static commandName: string;
|
|
5
8
|
static description: string;
|
|
6
9
|
name: string;
|
|
7
10
|
suite?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The stub to use for generating the test file
|
|
13
|
+
*/
|
|
8
14
|
protected stubPath: string;
|
|
15
|
+
/**
|
|
16
|
+
* Executed by ace
|
|
17
|
+
*/
|
|
9
18
|
run(): Promise<void>;
|
|
10
19
|
}
|
|
@@ -1,26 +1,47 @@
|
|
|
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
|
+
*/
|
|
1
9
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
10
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
11
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
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;
|
|
5
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
14
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, flags, BaseCommand } from '../../modules/ace/main.js';
|
|
17
|
+
/**
|
|
18
|
+
* Make a new test file
|
|
19
|
+
*/
|
|
12
20
|
export default class MakeTest extends BaseCommand {
|
|
13
21
|
static commandName = 'make:test';
|
|
14
22
|
static description = 'Create a new Japa test file';
|
|
23
|
+
/**
|
|
24
|
+
* The stub to use for generating the test file
|
|
25
|
+
*/
|
|
15
26
|
stubPath = 'make/test/main.stub';
|
|
27
|
+
/**
|
|
28
|
+
* Returns the suite name for creating the test file
|
|
29
|
+
*/
|
|
16
30
|
async #getSuite() {
|
|
17
31
|
if (this.suite) {
|
|
18
32
|
return this.suite;
|
|
19
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Use the first suite from the rcFile when there is only
|
|
36
|
+
* one suite
|
|
37
|
+
*/
|
|
20
38
|
const rcFileSuites = this.app.rcFile.tests.suites;
|
|
21
39
|
if (rcFileSuites.length === 1) {
|
|
22
40
|
return rcFileSuites[0].name;
|
|
23
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Prompt the user to select a suite manually
|
|
44
|
+
*/
|
|
24
45
|
return this.prompt.choice('Select the suite for the test file', this.app.rcFile.tests.suites.map((suite) => {
|
|
25
46
|
return suite.name;
|
|
26
47
|
}), {
|
|
@@ -29,6 +50,9 @@ export default class MakeTest extends BaseCommand {
|
|
|
29
50
|
},
|
|
30
51
|
});
|
|
31
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns the directory path for the selected suite.
|
|
55
|
+
*/
|
|
32
56
|
async #getSuiteDirectory(directories) {
|
|
33
57
|
if (directories.length === 1) {
|
|
34
58
|
return directories[0];
|
|
@@ -39,19 +63,33 @@ export default class MakeTest extends BaseCommand {
|
|
|
39
63
|
},
|
|
40
64
|
});
|
|
41
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Find suite info from the rcFile file
|
|
68
|
+
*/
|
|
42
69
|
#findSuite(suiteName) {
|
|
43
70
|
return this.app.rcFile.tests.suites.find((suite) => {
|
|
44
71
|
return suite.name === suiteName;
|
|
45
72
|
});
|
|
46
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Executed by ace
|
|
76
|
+
*/
|
|
47
77
|
async run() {
|
|
48
78
|
const suite = this.#findSuite(await this.#getSuite());
|
|
79
|
+
/**
|
|
80
|
+
* Show error when mentioned/selected suite does not exist
|
|
81
|
+
*/
|
|
49
82
|
if (!suite) {
|
|
50
83
|
this.logger.error(`The "${this.suite}" suite is not configured inside the .adonisrc.json file`);
|
|
51
84
|
this.exitCode = 1;
|
|
52
85
|
return;
|
|
53
86
|
}
|
|
54
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Generate entity
|
|
89
|
+
*/
|
|
90
|
+
const codemods = await this.createCodemods();
|
|
91
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
92
|
+
flags: this.parsed.flags,
|
|
55
93
|
entity: this.app.generators.createEntity(this.name),
|
|
56
94
|
suite: {
|
|
57
95
|
directory: await this.#getSuiteDirectory(suite.directories),
|
|
@@ -60,10 +98,8 @@ export default class MakeTest extends BaseCommand {
|
|
|
60
98
|
}
|
|
61
99
|
}
|
|
62
100
|
__decorate([
|
|
63
|
-
args.string({ description: 'Name of the test file' })
|
|
64
|
-
__metadata("design:type", String)
|
|
101
|
+
args.string({ description: 'Name of the test file' })
|
|
65
102
|
], MakeTest.prototype, "name", void 0);
|
|
66
103
|
__decorate([
|
|
67
|
-
flags.string({ description: 'The suite for which to create the test file' })
|
|
68
|
-
__metadata("design:type", String)
|
|
104
|
+
flags.string({ description: 'The suite for which to create the test file' })
|
|
69
105
|
], MakeTest.prototype, "suite", void 0);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../modules/ace/main.js';
|
|
2
|
+
/**
|
|
3
|
+
* Make a new VineJS validator
|
|
4
|
+
*/
|
|
5
|
+
export default class MakeValidator extends BaseCommand {
|
|
6
|
+
static commandName: string;
|
|
7
|
+
static description: string;
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The stub to use for generating the validator
|
|
11
|
+
*/
|
|
12
|
+
protected stubPath: string;
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, BaseCommand } from '../../modules/ace/main.js';
|
|
17
|
+
/**
|
|
18
|
+
* Make a new VineJS validator
|
|
19
|
+
*/
|
|
20
|
+
export default class MakeValidator extends BaseCommand {
|
|
21
|
+
static commandName = 'make:validator';
|
|
22
|
+
static description = 'Create a new VineJS validator';
|
|
23
|
+
/**
|
|
24
|
+
* The stub to use for generating the validator
|
|
25
|
+
*/
|
|
26
|
+
stubPath = 'make/validator/main.stub';
|
|
27
|
+
async run() {
|
|
28
|
+
const codemods = await this.createCodemods();
|
|
29
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
30
|
+
flags: this.parsed.flags,
|
|
31
|
+
entity: this.app.generators.createEntity(this.name),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
__decorate([
|
|
36
|
+
args.string({ description: 'Name of the validator' })
|
|
37
|
+
], MakeValidator.prototype, "name", void 0);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../modules/ace/main.js';
|
|
2
|
+
/**
|
|
3
|
+
* Make a new EdgeJS template file
|
|
4
|
+
*/
|
|
5
|
+
export default class MakeView extends BaseCommand {
|
|
6
|
+
static commandName: string;
|
|
7
|
+
static description: string;
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The stub to use for generating the template
|
|
11
|
+
*/
|
|
12
|
+
protected stubPath: string;
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, BaseCommand } from '../../modules/ace/main.js';
|
|
17
|
+
/**
|
|
18
|
+
* Make a new EdgeJS template file
|
|
19
|
+
*/
|
|
20
|
+
export default class MakeView extends BaseCommand {
|
|
21
|
+
static commandName = 'make:view';
|
|
22
|
+
static description = 'Create a new Edge.js template file';
|
|
23
|
+
/**
|
|
24
|
+
* The stub to use for generating the template
|
|
25
|
+
*/
|
|
26
|
+
stubPath = 'make/view/main.stub';
|
|
27
|
+
async run() {
|
|
28
|
+
const codemods = await this.createCodemods();
|
|
29
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
30
|
+
flags: this.parsed.flags,
|
|
31
|
+
entity: this.app.generators.createEntity(this.name),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
__decorate([
|
|
36
|
+
args.string({ description: 'Name of the template' })
|
|
37
|
+
], MakeView.prototype, "name", void 0);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../modules/ace/main.js';
|
|
2
|
+
import { CommandOptions } from '../types/ace.js';
|
|
3
|
+
/**
|
|
4
|
+
* The ReplCommand class is used to start the Repl server
|
|
5
|
+
*/
|
|
6
|
+
export default class ReplCommand extends BaseCommand {
|
|
7
|
+
static commandName: string;
|
|
8
|
+
static description: string;
|
|
9
|
+
static options: CommandOptions;
|
|
10
|
+
/**
|
|
11
|
+
* Starts the REPL server process
|
|
12
|
+
*/
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { BaseCommand } from '../modules/ace/main.js';
|
|
10
|
+
/**
|
|
11
|
+
* The ReplCommand class is used to start the Repl server
|
|
12
|
+
*/
|
|
13
|
+
export default class ReplCommand extends BaseCommand {
|
|
14
|
+
static commandName = 'repl';
|
|
15
|
+
static description = 'Start a new REPL session';
|
|
16
|
+
static options = {
|
|
17
|
+
startApp: true,
|
|
18
|
+
staysAlive: true,
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Starts the REPL server process
|
|
22
|
+
*/
|
|
23
|
+
async run() {
|
|
24
|
+
const repl = await this.app.container.make('repl');
|
|
25
|
+
repl.start();
|
|
26
|
+
repl.server.on('exit', async () => {
|
|
27
|
+
await this.terminate();
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
+
import type { DevServer } from '@adonisjs/assembler';
|
|
1
2
|
import type { CommandOptions } from '../types/ace.js';
|
|
2
3
|
import { BaseCommand } from '../modules/ace/main.js';
|
|
4
|
+
/**
|
|
5
|
+
* Serve command is used to run the AdonisJS HTTP server during development. The
|
|
6
|
+
* command under the hood runs the "bin/server.ts" file and watches for file
|
|
7
|
+
* system changes
|
|
8
|
+
*/
|
|
3
9
|
export default class Serve extends BaseCommand {
|
|
4
10
|
#private;
|
|
5
11
|
static commandName: string;
|
|
6
12
|
static description: string;
|
|
13
|
+
static help: string[];
|
|
7
14
|
static options: CommandOptions;
|
|
15
|
+
devServer: DevServer;
|
|
8
16
|
watch?: boolean;
|
|
9
17
|
poll?: boolean;
|
|
10
18
|
clear?: boolean;
|
|
11
19
|
assets?: boolean;
|
|
20
|
+
assetsArgs?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Runs the HTTP server
|
|
23
|
+
*/
|
|
12
24
|
run(): Promise<void>;
|
|
13
25
|
}
|