@adonisjs/core 7.0.0-next.9 → 7.0.1
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/README.md +62 -1
- package/build/chunk-iKc69rpz.js +26 -0
- package/build/commands/add.d.ts +4 -3
- package/build/commands/add.js +73 -110
- package/build/commands/build.js +51 -107
- package/build/commands/commands.json +1 -1
- package/build/commands/configure.js +81 -177
- package/build/commands/eject.js +17 -60
- package/build/commands/env/add.js +55 -134
- package/build/commands/generate_key.js +22 -66
- package/build/commands/inspect_rcfile.js +27 -55
- package/build/commands/list/routes.js +246 -116
- package/build/commands/make/command.d.ts +5 -0
- package/build/commands/make/command.js +16 -57
- package/build/commands/make/controller.d.ts +5 -0
- package/build/commands/make/controller.js +44 -120
- package/build/commands/make/event.d.ts +5 -0
- package/build/commands/make/event.js +17 -62
- package/build/commands/make/exception.d.ts +5 -0
- package/build/commands/make/exception.js +17 -62
- package/build/commands/make/listener.d.ts +5 -0
- package/build/commands/make/listener.js +37 -93
- package/build/commands/make/middleware.d.ts +5 -0
- package/build/commands/make/middleware.js +42 -101
- package/build/commands/make/preload.d.ts +5 -0
- package/build/commands/make/preload.js +48 -113
- package/build/commands/make/provider.d.ts +5 -0
- package/build/commands/make/provider.js +48 -112
- package/build/commands/make/service.d.ts +5 -0
- package/build/commands/make/service.js +17 -55
- package/build/commands/make/test.d.ts +5 -0
- package/build/commands/make/test.js +48 -132
- package/build/commands/make/transformer.d.ts +5 -0
- package/build/commands/make/transformer.js +18 -64
- package/build/commands/make/validator.d.ts +5 -0
- package/build/commands/make/validator.js +21 -80
- package/build/commands/make/view.d.ts +5 -0
- package/build/commands/make/view.js +16 -56
- package/build/commands/repl.js +17 -50
- package/build/commands/serve.js +80 -150
- package/build/commands/test.js +92 -202
- package/build/config_provider-FIAUgvae.js +13 -0
- package/build/core-IpCOCkUL.js +146 -0
- package/build/create_kernel-B7ILNhuP.js +38 -0
- package/build/create_kernel-BD0Iqi8e.js +3 -0
- package/build/debug-CGQmxzGt.js +3 -0
- package/build/decorate-DmrZA614.js +7 -0
- package/build/define_config-0oHaj43l.js +86 -0
- package/build/dumper-BBgqFX5a.js +147 -0
- package/build/errors-CrCO-k44.js +8 -0
- package/build/factories/app.js +2 -9
- package/build/factories/bodyparser.js +2 -9
- package/build/factories/core/ace.js +22 -45
- package/build/factories/core/ignitor.js +74 -180
- package/build/factories/core/main.js +18 -11
- package/build/factories/core/test_utils.js +19 -42
- package/build/factories/encryption.d.ts +1 -1
- package/build/factories/encryption.js +2 -9
- package/build/factories/events.js +2 -9
- package/build/factories/hash.js +2 -9
- package/build/factories/http.js +2 -9
- package/build/factories/logger.js +2 -9
- package/build/factories/stubs.d.ts +1 -6
- package/build/factories/stubs.js +24 -91
- package/build/index.d.ts +1 -1
- package/build/index.js +10 -46
- package/build/main--nXd7T-C.js +73 -0
- package/build/main-Cxz0TyIw.js +173 -0
- package/build/main-DN2qEEg5.js +41 -0
- package/build/main-DkNgvceD.js +52 -0
- package/build/main-MBAMnmJb.js +81 -0
- package/build/main-kn40V-hF.js +2 -0
- package/build/{stubs/make → make}/health/controller.stub +5 -2
- package/build/modules/ace/codemods.d.ts +75 -23
- package/build/modules/ace/codemods.js +291 -476
- package/build/modules/ace/main.js +2 -41
- package/build/modules/app.js +6 -26
- package/build/modules/bodyparser/bodyparser_middleware.js +3 -14
- package/build/modules/bodyparser/main.js +6 -9
- package/build/modules/config.js +6 -26
- package/build/modules/container.js +6 -9
- package/build/modules/dumper/main.js +6 -32
- package/build/modules/dumper/plugins/edge.js +46 -61
- package/build/modules/encryption/define_config.d.ts +161 -0
- package/build/modules/encryption/drivers/aes_256_cbc.d.ts +20 -0
- package/build/modules/encryption/drivers/aes_256_cbc.js +2 -0
- package/build/modules/encryption/drivers/aes_256_gcm.d.ts +21 -0
- package/build/modules/encryption/drivers/aes_256_gcm.js +2 -0
- package/build/modules/encryption/drivers/aes_siv.d.ts +19 -0
- package/build/modules/encryption/drivers/aes_siv.js +2 -0
- package/build/modules/encryption/drivers/chacha20_poly1305.d.ts +21 -0
- package/build/modules/encryption/drivers/chacha20_poly1305.js +2 -0
- package/build/modules/encryption/drivers/legacy.d.ts +84 -0
- package/build/modules/encryption/drivers/legacy.js +57 -0
- package/build/modules/encryption/errors.d.ts +16 -0
- package/build/modules/encryption/main.d.ts +89 -0
- package/build/modules/encryption/main.js +6 -0
- package/build/modules/env/editor.js +2 -9
- package/build/modules/env/main.js +2 -28
- package/build/modules/events.js +6 -9
- package/build/modules/hash/drivers/argon.js +2 -9
- package/build/modules/hash/drivers/bcrypt.js +2 -20
- package/build/modules/hash/drivers/scrypt.js +2 -9
- package/build/modules/hash/main.js +6 -28
- package/build/modules/hash/phc_formatter.js +2 -9
- package/build/modules/health.js +2 -9
- package/build/modules/http/helpers.d.ts +1 -0
- package/build/modules/http/helpers.js +2 -0
- package/build/modules/http/main.js +4 -15
- package/build/modules/http/request_validator.d.ts +3 -4
- package/build/modules/http/url_builder_client.js +2 -9
- package/build/modules/logger.d.ts +30 -0
- package/build/modules/logger.js +14 -9
- package/build/modules/repl.js +6 -9
- package/build/modules/transformers/main.js +2 -9
- package/build/providers/app_provider.d.ts +5 -13
- package/build/providers/app_provider.js +153 -359
- package/build/providers/edge_provider.js +98 -164
- package/build/providers/hash_provider.js +29 -91
- package/build/providers/repl_provider.js +66 -152
- package/build/providers/vinejs_provider.d.ts +1 -1
- package/build/providers/vinejs_provider.js +21 -65
- package/build/services/ace.js +1 -16
- package/build/services/app.js +3 -19
- package/build/services/config.js +1 -12
- package/build/services/dumper.js +4 -20
- package/build/services/emitter.js +1 -13
- package/build/services/encryption.js +1 -13
- package/build/services/hash.js +1 -13
- package/build/services/logger.js +1 -13
- package/build/services/repl.js +1 -13
- package/build/services/router.js +1 -13
- package/build/services/server.js +1 -13
- package/build/services/test_utils.js +1 -16
- package/build/services/url_builder.d.ts +3 -3
- package/build/services/url_builder.js +4 -16
- package/build/src/assembler_hooks/index_entities.d.ts +34 -1
- package/build/src/debug.d.ts +1 -1
- package/build/src/exceptions.js +2 -49
- package/build/src/helpers/assert.js +2 -55
- package/build/src/helpers/http.js +2 -28
- package/build/src/helpers/is.js +3 -31
- package/build/src/helpers/main.js +5 -52
- package/build/src/helpers/string.js +26 -76
- package/build/src/helpers/types.js +25 -134
- package/build/src/helpers/verification_token.js +46 -120
- package/build/src/test_utils/main.js +8 -77
- package/build/src/types.d.ts +53 -99
- package/build/src/types.js +0 -8
- package/build/src/utils.d.ts +1 -1
- package/build/src/vine.js +29 -101
- package/build/toolkit/main.js +19 -21
- package/build/types/ace.js +2 -9
- package/build/types/app.js +2 -9
- package/build/types/bodyparser.js +2 -9
- package/build/types/common.js +2 -9
- package/build/types/container.js +2 -9
- package/build/types/encryption.d.ts +53 -1
- package/build/types/encryption.js +1 -9
- package/build/types/events.js +2 -9
- package/build/types/hash.js +2 -9
- package/build/types/health.js +2 -9
- package/build/types/helpers.js +0 -8
- package/build/types/http.js +2 -9
- package/build/types/logger.js +2 -9
- package/build/types/repl.js +2 -9
- package/build/types/transformers.js +2 -9
- package/build/utils-rRkbAPnP.js +42 -0
- package/package.json +117 -62
- package/build/modules/ace/commands.js +0 -157
- package/build/modules/ace/create_kernel.js +0 -91
- package/build/modules/ace/kernel.js +0 -40
- package/build/modules/dumper/define_config.js +0 -36
- package/build/modules/dumper/dumper.js +0 -266
- package/build/modules/dumper/errors.js +0 -119
- package/build/modules/encryption.d.ts +0 -18
- package/build/modules/encryption.js +0 -26
- package/build/modules/hash/define_config.js +0 -125
- package/build/modules/http/request_validator.js +0 -100
- package/build/src/assembler_hooks/index_entities.js +0 -112
- package/build/src/cli_formatters/routes_list.js +0 -397
- package/build/src/config_provider.js +0 -71
- package/build/src/debug.js +0 -25
- package/build/src/ignitor/ace.js +0 -102
- package/build/src/ignitor/http.js +0 -159
- package/build/src/ignitor/main.js +0 -124
- package/build/src/ignitor/test.js +0 -66
- package/build/src/test_utils/http.js +0 -82
- package/build/src/utils.js +0 -114
- package/build/stubs/main.js +0 -9
- package/build/toolkit/commands/index_commands.js +0 -30
- /package/build/{stubs/make → make}/command/main.stub +0 -0
- /package/build/{stubs/make → make}/controller/actions.stub +0 -0
- /package/build/{stubs/make → make}/controller/api.stub +0 -0
- /package/build/{stubs/make → make}/controller/main.stub +0 -0
- /package/build/{stubs/make → make}/controller/resource.stub +0 -0
- /package/build/{stubs/make → make}/event/main.stub +0 -0
- /package/build/{stubs/make → make}/exception/main.stub +0 -0
- /package/build/{stubs/make → make}/health/main.stub +0 -0
- /package/build/{stubs/make → make}/listener/for_event.stub +0 -0
- /package/build/{stubs/make → make}/listener/main.stub +0 -0
- /package/build/{stubs/make → make}/middleware/main.stub +0 -0
- /package/build/{stubs/make → make}/preload/main.stub +0 -0
- /package/build/{stubs/make → make}/provider/main.stub +0 -0
- /package/build/{stubs/make → make}/service/main.stub +0 -0
- /package/build/{stubs/make → make}/test/main.stub +0 -0
- /package/build/{stubs/make → make}/transformer/main.stub +0 -0
- /package/build/{stubs/make → make}/validator/main.stub +0 -0
- /package/build/{stubs/make → make}/validator/resource.stub +0 -0
- /package/build/{stubs/make → make}/view/main.stub +0 -0
|
@@ -1,102 +1,43 @@
|
|
|
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 string from '@poppinss/utils/string';
|
|
16
|
-
import { basename, extname, relative } from 'node:path';
|
|
17
|
-
import { stubsRoot } from "../../stubs/main.js";
|
|
1
|
+
import { t as stubsRoot } from "../../main-kn40V-hF.js";
|
|
18
2
|
import stringHelpers from "../../src/helpers/string.js";
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Error out when mentioned stack is invalid
|
|
62
|
-
*/
|
|
63
|
-
if (!stackChoices.includes(this.stack)) {
|
|
64
|
-
this.exitCode = 1;
|
|
65
|
-
this.logger.error(`Invalid middleware stack "${this.stack}". Select from "${stackChoices.join(', ')}"`);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Create middleware
|
|
70
|
-
*/
|
|
71
|
-
const codemods = await this.createCodemods();
|
|
72
|
-
const { destination } = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
73
|
-
flags: this.parsed.flags,
|
|
74
|
-
entity: this.app.generators.createEntity(this.name),
|
|
75
|
-
});
|
|
76
|
-
/**
|
|
77
|
-
* Creative relative path for the middleware file from
|
|
78
|
-
* the "./app/middleware" directory
|
|
79
|
-
*/
|
|
80
|
-
const middlewareRelativePath = stringHelpers.toUnixSlash(relative(this.app.middlewarePath(), destination).replace(extname(destination), ''));
|
|
81
|
-
/**
|
|
82
|
-
* Take the middleware relative path, remove `_middleware` prefix from it
|
|
83
|
-
* and convert everything to camelcase
|
|
84
|
-
*/
|
|
85
|
-
const name = string.camelCase(basename(middlewareRelativePath).replace(/_middleware$/, ''));
|
|
86
|
-
/**
|
|
87
|
-
* Register middleware
|
|
88
|
-
*/
|
|
89
|
-
await codemods.registerMiddleware(this.stack, [
|
|
90
|
-
{
|
|
91
|
-
name: name,
|
|
92
|
-
path: `#middleware/${middlewareRelativePath}`,
|
|
93
|
-
},
|
|
94
|
-
]);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
__decorate([
|
|
98
|
-
args.string({ description: 'Name of the middleware' })
|
|
99
|
-
], MakeMiddleware.prototype, "name", void 0);
|
|
100
|
-
__decorate([
|
|
101
|
-
flags.string({ description: 'The stack in which to register the middleware', alias: 's' })
|
|
102
|
-
], MakeMiddleware.prototype, "stack", void 0);
|
|
3
|
+
import { f as BaseCommand, l as flags, o as args } from "../../main-MBAMnmJb.js";
|
|
4
|
+
import { t as __decorate } from "../../decorate-DmrZA614.js";
|
|
5
|
+
import string from "@poppinss/utils/string";
|
|
6
|
+
import { basename, extname, relative } from "node:path";
|
|
7
|
+
var MakeMiddleware = class extends BaseCommand {
|
|
8
|
+
static commandName = "make:middleware";
|
|
9
|
+
static description = "Create a new middleware class for HTTP requests";
|
|
10
|
+
static options = { allowUnknownFlags: true };
|
|
11
|
+
stubPath = "make/middleware/main.stub";
|
|
12
|
+
async run() {
|
|
13
|
+
const stackChoices = [
|
|
14
|
+
"server",
|
|
15
|
+
"router",
|
|
16
|
+
"named"
|
|
17
|
+
];
|
|
18
|
+
if (!this.stack) this.stack = await this.prompt.choice("Under which stack you want to register the middleware?", stackChoices);
|
|
19
|
+
if (!stackChoices.includes(this.stack)) {
|
|
20
|
+
this.exitCode = 1;
|
|
21
|
+
this.logger.error(`Invalid middleware stack "${this.stack}". Select from "${stackChoices.join(", ")}"`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const codemods = await this.createCodemods();
|
|
25
|
+
const { destination } = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
26
|
+
flags: this.parsed.flags,
|
|
27
|
+
entity: this.app.generators.createEntity(this.name)
|
|
28
|
+
}, { contentsFromFile: this.contentsFrom });
|
|
29
|
+
const middlewareRelativePath = stringHelpers.toUnixSlash(relative(this.app.middlewarePath(), destination).replace(extname(destination), ""));
|
|
30
|
+
const name = string.camelCase(basename(middlewareRelativePath).replace(/_middleware$/, ""));
|
|
31
|
+
await codemods.registerMiddleware(this.stack, [{
|
|
32
|
+
name,
|
|
33
|
+
path: `#middleware/${middlewareRelativePath}`
|
|
34
|
+
}]);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
__decorate([args.string({ description: "Name of the middleware" })], MakeMiddleware.prototype, "name", void 0);
|
|
38
|
+
__decorate([flags.string({
|
|
39
|
+
description: "The stack in which to register the middleware",
|
|
40
|
+
alias: "s"
|
|
41
|
+
})], MakeMiddleware.prototype, "stack", void 0);
|
|
42
|
+
__decorate([flags.string({ description: "Use the contents of the given file as the generated output" })], MakeMiddleware.prototype, "contentsFrom", void 0);
|
|
43
|
+
export { MakeMiddleware as default };
|
|
@@ -37,6 +37,11 @@ export default class MakePreload extends BaseCommand {
|
|
|
37
37
|
* Application environments where the preload file should be loaded
|
|
38
38
|
*/
|
|
39
39
|
environments?: AllowedAppEnvironments;
|
|
40
|
+
/**
|
|
41
|
+
* Read the contents from this file (if the flag exists) and use
|
|
42
|
+
* it as the raw contents
|
|
43
|
+
*/
|
|
44
|
+
contentsFrom: string;
|
|
40
45
|
/**
|
|
41
46
|
* The stub template file to use for generating the preload file
|
|
42
47
|
*/
|
|
@@ -1,114 +1,49 @@
|
|
|
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 { extname, relative } from 'node:path';
|
|
16
|
-
import { stubsRoot } from "../../stubs/main.js";
|
|
1
|
+
import { t as stubsRoot } from "../../main-kn40V-hF.js";
|
|
17
2
|
import stringHelpers from "../../src/helpers/string.js";
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*/
|
|
66
|
-
if (!this.#isEnvironmentsFlagValid()) {
|
|
67
|
-
this.logger.error(`Invalid environment(s) "${this.environments}". Only "${ALLOWED_ENVIRONMENTS}" are allowed`);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Display prompt to know if we should register the preload
|
|
72
|
-
* file inside the ".adonisrc.ts" file.
|
|
73
|
-
*/
|
|
74
|
-
if (this.register === undefined) {
|
|
75
|
-
this.register = await this.prompt.confirm('Do you want to register the preload file in .adonisrc.ts file?');
|
|
76
|
-
}
|
|
77
|
-
const codemods = await this.createCodemods();
|
|
78
|
-
const { destination } = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
79
|
-
flags: this.parsed.flags,
|
|
80
|
-
entity: this.app.generators.createEntity(this.name),
|
|
81
|
-
});
|
|
82
|
-
/**
|
|
83
|
-
* Do not register when prompt has been denied or "--no-register"
|
|
84
|
-
* flag was used
|
|
85
|
-
*/
|
|
86
|
-
if (!this.register) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Creative relative path for the preload file from
|
|
91
|
-
* the "./start" directory
|
|
92
|
-
*/
|
|
93
|
-
const preloadFileRelativePath = stringHelpers.toUnixSlash(relative(this.app.startPath(), destination).replace(extname(destination), ''));
|
|
94
|
-
await codemods.updateRcFile((rcFile) => {
|
|
95
|
-
rcFile.addPreloadFile(`#start/${preloadFileRelativePath}`, this.environments);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
__decorate([
|
|
100
|
-
args.string({ description: 'Name of the preload file' })
|
|
101
|
-
], MakePreload.prototype, "name", void 0);
|
|
102
|
-
__decorate([
|
|
103
|
-
flags.boolean({
|
|
104
|
-
description: 'Auto register the preload file inside the .adonisrc.ts file',
|
|
105
|
-
showNegatedVariantInHelp: true,
|
|
106
|
-
alias: 'r',
|
|
107
|
-
})
|
|
108
|
-
], MakePreload.prototype, "register", void 0);
|
|
109
|
-
__decorate([
|
|
110
|
-
flags.array({
|
|
111
|
-
description: `Define the preload file's environment. Accepted values are "${ALLOWED_ENVIRONMENTS}"`,
|
|
112
|
-
alias: 'e',
|
|
113
|
-
})
|
|
114
|
-
], MakePreload.prototype, "environments", void 0);
|
|
3
|
+
import { f as BaseCommand, l as flags, o as args } from "../../main-MBAMnmJb.js";
|
|
4
|
+
import { t as __decorate } from "../../decorate-DmrZA614.js";
|
|
5
|
+
import { extname, relative } from "node:path";
|
|
6
|
+
const ALLOWED_ENVIRONMENTS = [
|
|
7
|
+
"web",
|
|
8
|
+
"console",
|
|
9
|
+
"test",
|
|
10
|
+
"repl"
|
|
11
|
+
];
|
|
12
|
+
var MakePreload = class extends BaseCommand {
|
|
13
|
+
static commandName = "make:preload";
|
|
14
|
+
static description = "Create a new preload file inside the start directory";
|
|
15
|
+
stubPath = "make/preload/main.stub";
|
|
16
|
+
#isEnvironmentsFlagValid() {
|
|
17
|
+
if (!this.environments || !this.environments.length) return true;
|
|
18
|
+
return this.environments.every((one) => ALLOWED_ENVIRONMENTS.includes(one));
|
|
19
|
+
}
|
|
20
|
+
async run() {
|
|
21
|
+
if (!this.#isEnvironmentsFlagValid()) {
|
|
22
|
+
this.logger.error(`Invalid environment(s) "${this.environments}". Only "${ALLOWED_ENVIRONMENTS}" are allowed`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (this.register === void 0) this.register = await this.prompt.confirm("Do you want to register the preload file in .adonisrc.ts file?");
|
|
26
|
+
const codemods = await this.createCodemods();
|
|
27
|
+
const { destination } = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
28
|
+
flags: this.parsed.flags,
|
|
29
|
+
entity: this.app.generators.createEntity(this.name)
|
|
30
|
+
}, { contentsFromFile: this.contentsFrom });
|
|
31
|
+
if (!this.register) return;
|
|
32
|
+
const preloadFileRelativePath = stringHelpers.toUnixSlash(relative(this.app.startPath(), destination).replace(extname(destination), ""));
|
|
33
|
+
await codemods.updateRcFile((rcFile) => {
|
|
34
|
+
rcFile.addPreloadFile(`#start/${preloadFileRelativePath}`, this.environments);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
__decorate([args.string({ description: "Name of the preload file" })], MakePreload.prototype, "name", void 0);
|
|
39
|
+
__decorate([flags.boolean({
|
|
40
|
+
description: "Auto register the preload file inside the .adonisrc.ts file",
|
|
41
|
+
showNegatedVariantInHelp: true,
|
|
42
|
+
alias: "r"
|
|
43
|
+
})], MakePreload.prototype, "register", void 0);
|
|
44
|
+
__decorate([flags.array({
|
|
45
|
+
description: `Define the preload file's environment. Accepted values are "${ALLOWED_ENVIRONMENTS}"`,
|
|
46
|
+
alias: "e"
|
|
47
|
+
})], MakePreload.prototype, "environments", void 0);
|
|
48
|
+
__decorate([flags.string({ description: "Use the contents of the given file as the generated output" })], MakePreload.prototype, "contentsFrom", void 0);
|
|
49
|
+
export { MakePreload as default };
|
|
@@ -36,6 +36,11 @@ export default class MakeProvider extends BaseCommand {
|
|
|
36
36
|
* Application environments where the provider should be loaded
|
|
37
37
|
*/
|
|
38
38
|
environments?: AllowedAppEnvironments;
|
|
39
|
+
/**
|
|
40
|
+
* Read the contents from this file (if the flag exists) and use
|
|
41
|
+
* it as the raw contents
|
|
42
|
+
*/
|
|
43
|
+
contentsFrom: string;
|
|
39
44
|
/**
|
|
40
45
|
* The stub template file to use for generating the provider class
|
|
41
46
|
*/
|
|
@@ -1,113 +1,49 @@
|
|
|
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 { extname, relative } from 'node:path';
|
|
16
|
-
import { stubsRoot } from "../../stubs/main.js";
|
|
1
|
+
import { t as stubsRoot } from "../../main-kn40V-hF.js";
|
|
17
2
|
import stringHelpers from "../../src/helpers/string.js";
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (!this.#isEnvironmentsFlagValid()) {
|
|
66
|
-
this.logger.error(`Invalid environment(s) "${this.environments}". Only "${ALLOWED_ENVIRONMENTS}" are allowed`);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Display prompt to know if we should register the provider
|
|
71
|
-
* file inside the ".adonisrc.ts" file.
|
|
72
|
-
*/
|
|
73
|
-
if (this.register === undefined) {
|
|
74
|
-
this.register = await this.prompt.confirm('Do you want to register the provider in .adonisrc.ts file?');
|
|
75
|
-
}
|
|
76
|
-
const codemods = await this.createCodemods();
|
|
77
|
-
const { destination } = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
78
|
-
flags: this.parsed.flags,
|
|
79
|
-
entity: this.app.generators.createEntity(this.name),
|
|
80
|
-
});
|
|
81
|
-
/**
|
|
82
|
-
* Do not register when prompt has been denied or "--no-register"
|
|
83
|
-
* flag was used
|
|
84
|
-
*/
|
|
85
|
-
if (!this.register) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Creative relative path for the provider file from
|
|
90
|
-
* the "./start" directory
|
|
91
|
-
*/
|
|
92
|
-
const providerRelativePath = stringHelpers.toUnixSlash(relative(this.app.providersPath(), destination).replace(extname(destination), ''));
|
|
93
|
-
await codemods.updateRcFile((rcFile) => {
|
|
94
|
-
rcFile.addProvider(`#providers/${providerRelativePath}`, this.environments);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
__decorate([
|
|
99
|
-
args.string({ description: 'Name of the provider' })
|
|
100
|
-
], MakeProvider.prototype, "name", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
flags.boolean({
|
|
103
|
-
description: 'Auto register the provider inside the .adonisrc.ts file',
|
|
104
|
-
showNegatedVariantInHelp: true,
|
|
105
|
-
alias: 'r',
|
|
106
|
-
})
|
|
107
|
-
], MakeProvider.prototype, "register", void 0);
|
|
108
|
-
__decorate([
|
|
109
|
-
flags.array({
|
|
110
|
-
description: `Define the provider environment. Accepted values are "${ALLOWED_ENVIRONMENTS}"`,
|
|
111
|
-
alias: 'e',
|
|
112
|
-
})
|
|
113
|
-
], MakeProvider.prototype, "environments", void 0);
|
|
3
|
+
import { f as BaseCommand, l as flags, o as args } from "../../main-MBAMnmJb.js";
|
|
4
|
+
import { t as __decorate } from "../../decorate-DmrZA614.js";
|
|
5
|
+
import { extname, relative } from "node:path";
|
|
6
|
+
const ALLOWED_ENVIRONMENTS = [
|
|
7
|
+
"web",
|
|
8
|
+
"console",
|
|
9
|
+
"test",
|
|
10
|
+
"repl"
|
|
11
|
+
];
|
|
12
|
+
var MakeProvider = class extends BaseCommand {
|
|
13
|
+
static commandName = "make:provider";
|
|
14
|
+
static description = "Create a new service provider class";
|
|
15
|
+
stubPath = "make/provider/main.stub";
|
|
16
|
+
#isEnvironmentsFlagValid() {
|
|
17
|
+
if (!this.environments || !this.environments.length) return true;
|
|
18
|
+
return this.environments.every((one) => ALLOWED_ENVIRONMENTS.includes(one));
|
|
19
|
+
}
|
|
20
|
+
async run() {
|
|
21
|
+
if (!this.#isEnvironmentsFlagValid()) {
|
|
22
|
+
this.logger.error(`Invalid environment(s) "${this.environments}". Only "${ALLOWED_ENVIRONMENTS}" are allowed`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (this.register === void 0) this.register = await this.prompt.confirm("Do you want to register the provider in .adonisrc.ts file?");
|
|
26
|
+
const codemods = await this.createCodemods();
|
|
27
|
+
const { destination } = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
28
|
+
flags: this.parsed.flags,
|
|
29
|
+
entity: this.app.generators.createEntity(this.name)
|
|
30
|
+
}, { contentsFromFile: this.contentsFrom });
|
|
31
|
+
if (!this.register) return;
|
|
32
|
+
const providerRelativePath = stringHelpers.toUnixSlash(relative(this.app.providersPath(), destination).replace(extname(destination), ""));
|
|
33
|
+
await codemods.updateRcFile((rcFile) => {
|
|
34
|
+
rcFile.addProvider(`#providers/${providerRelativePath}`, this.environments);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
__decorate([args.string({ description: "Name of the provider" })], MakeProvider.prototype, "name", void 0);
|
|
39
|
+
__decorate([flags.boolean({
|
|
40
|
+
description: "Auto register the provider inside the .adonisrc.ts file",
|
|
41
|
+
showNegatedVariantInHelp: true,
|
|
42
|
+
alias: "r"
|
|
43
|
+
})], MakeProvider.prototype, "register", void 0);
|
|
44
|
+
__decorate([flags.array({
|
|
45
|
+
description: `Define the provider environment. Accepted values are "${ALLOWED_ENVIRONMENTS}"`,
|
|
46
|
+
alias: "e"
|
|
47
|
+
})], MakeProvider.prototype, "environments", void 0);
|
|
48
|
+
__decorate([flags.string({ description: "Use the contents of the given file as the generated output" })], MakeProvider.prototype, "contentsFrom", void 0);
|
|
49
|
+
export { MakeProvider as default };
|
|
@@ -27,6 +27,11 @@ export default class MakeService extends BaseCommand {
|
|
|
27
27
|
* Name of the service
|
|
28
28
|
*/
|
|
29
29
|
name: string;
|
|
30
|
+
/**
|
|
31
|
+
* Read the contents from this file (if the flag exists) and use
|
|
32
|
+
* it as the raw contents
|
|
33
|
+
*/
|
|
34
|
+
contentsFrom: string;
|
|
30
35
|
/**
|
|
31
36
|
* The stub to use for generating the service class
|
|
32
37
|
*/
|
|
@@ -1,56 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { t as stubsRoot } from "../../main-kn40V-hF.js";
|
|
2
|
+
import { f as BaseCommand, l as flags, o as args } from "../../main-MBAMnmJb.js";
|
|
3
|
+
import { t as __decorate } from "../../decorate-DmrZA614.js";
|
|
4
|
+
var MakeService = class extends BaseCommand {
|
|
5
|
+
static commandName = "make:service";
|
|
6
|
+
static description = "Create a new service class";
|
|
7
|
+
static options = { allowUnknownFlags: true };
|
|
8
|
+
stubPath = "make/service/main.stub";
|
|
9
|
+
async run() {
|
|
10
|
+
await (await this.createCodemods()).makeUsingStub(stubsRoot, this.stubPath, {
|
|
11
|
+
flags: this.parsed.flags,
|
|
12
|
+
entity: this.app.generators.createEntity(this.name)
|
|
13
|
+
}, { contentsFromFile: this.contentsFrom });
|
|
14
|
+
}
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* Make a new service class
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```
|
|
22
|
-
* ace make:service UserService
|
|
23
|
-
* ace make:service AuthService
|
|
24
|
-
* ace make:service User/ProfileService
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export default class MakeService extends BaseCommand {
|
|
28
|
-
/**
|
|
29
|
-
* The command name
|
|
30
|
-
*/
|
|
31
|
-
static commandName = 'make:service';
|
|
32
|
-
/**
|
|
33
|
-
* The command description
|
|
34
|
-
*/
|
|
35
|
-
static description = 'Create a new service class';
|
|
36
|
-
/**
|
|
37
|
-
* Command options configuration
|
|
38
|
-
*/
|
|
39
|
-
static options = {
|
|
40
|
-
allowUnknownFlags: true,
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* The stub to use for generating the service class
|
|
44
|
-
*/
|
|
45
|
-
stubPath = 'make/service/main.stub';
|
|
46
|
-
async run() {
|
|
47
|
-
const codemods = await this.createCodemods();
|
|
48
|
-
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
49
|
-
flags: this.parsed.flags,
|
|
50
|
-
entity: this.app.generators.createEntity(this.name),
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
__decorate([
|
|
55
|
-
args.string({ description: 'Name of the service' })
|
|
56
|
-
], MakeService.prototype, "name", void 0);
|
|
16
|
+
__decorate([args.string({ description: "Name of the service" })], MakeService.prototype, "name", void 0);
|
|
17
|
+
__decorate([flags.string({ description: "Use the contents of the given file as the generated output" })], MakeService.prototype, "contentsFrom", void 0);
|
|
18
|
+
export { MakeService as default };
|
|
@@ -29,6 +29,11 @@ export default class MakeTest extends BaseCommand {
|
|
|
29
29
|
* Test suite name where the test file should be created
|
|
30
30
|
*/
|
|
31
31
|
suite?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Read the contents from this file (if the flag exists) and use
|
|
34
|
+
* it as the raw contents
|
|
35
|
+
*/
|
|
36
|
+
contentsFrom: string;
|
|
32
37
|
/**
|
|
33
38
|
* The stub template file to use for generating the test file
|
|
34
39
|
*/
|