@adonisjs/core 7.0.0-next.10 → 7.0.0-next.12
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/ace-DDzvaSs_.js +16 -0
- package/build/app-B6oge7b3.js +5 -0
- package/build/app-BK0PN3li.js +5 -0
- package/build/bodyparser_middleware-DTW0epKM.js +3 -0
- package/build/chunk-MjwdjG2f.js +32 -0
- package/build/commands/add.js +40 -110
- package/build/commands/build.js +51 -107
- package/build/commands/configure.js +82 -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.js +15 -57
- package/build/commands/make/controller.js +43 -120
- package/build/commands/make/event.js +16 -62
- package/build/commands/make/exception.js +16 -62
- package/build/commands/make/listener.js +36 -93
- package/build/commands/make/middleware.js +41 -101
- package/build/commands/make/preload.js +47 -113
- package/build/commands/make/provider.js +47 -112
- package/build/commands/make/service.js +16 -55
- package/build/commands/make/test.js +47 -132
- package/build/commands/make/transformer.js +17 -64
- package/build/commands/make/validator.js +20 -80
- package/build/commands/make/view.js +15 -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-B2S2xfmN.js +5 -0
- package/build/config_provider-CY-xuo2R.js +13 -0
- package/build/container-ClFvcykQ.js +5 -0
- package/build/core-CNNCwlhc.js +95 -0
- package/build/create_kernel-B7zWS8Zz.js +38 -0
- package/build/create_kernel-CsTq0pWc.js +3 -0
- package/build/debug-DURPi9xn.js +3 -0
- package/build/decorate-DM0Sx1ye.js +7 -0
- package/build/dumper-C_sMcyFb.js +147 -0
- package/build/edge-LQdCc1L3.js +47 -0
- package/build/encryption-D2HGu0bU.js +5 -0
- package/build/events-B8hK42QT.js +5 -0
- package/build/factories/app.js +2 -9
- package/build/factories/bodyparser.js +2 -9
- package/build/factories/core/ace.js +15 -46
- package/build/factories/core/ignitor.js +12 -180
- package/build/factories/core/main.js +22 -11
- package/build/factories/core/test_utils.js +19 -43
- 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.js +28 -91
- package/build/ignitor-Dil-rtCo.js +63 -0
- package/build/index.js +13 -46
- package/build/logger-Dha-0hp1.js +13 -0
- package/build/main-2-nm3TiB.js +72 -0
- package/build/main-BTUXw6He.js +171 -0
- package/build/main-BWftwyAK.js +81 -0
- package/build/main-BrJQ1VAM.js +52 -0
- package/build/main-CFmDHDls.js +35 -0
- package/build/main-D5xz2ZN1.js +5 -0
- package/build/main-kn40V-hF.js +2 -0
- package/build/main-q9TMzWUj.js +5 -0
- package/build/modules/ace/codemods.js +222 -477
- package/build/modules/ace/main.js +2 -41
- package/build/modules/app.js +4 -26
- package/build/modules/bodyparser/bodyparser_middleware.js +2 -14
- package/build/modules/bodyparser/main.js +4 -9
- package/build/modules/config.js +4 -26
- package/build/modules/container.js +4 -9
- package/build/modules/dumper/main.js +6 -32
- package/build/modules/dumper/plugins/edge.js +2 -62
- package/build/modules/encryption.js +4 -26
- package/build/modules/env/editor.js +2 -9
- package/build/modules/env/main.js +2 -28
- package/build/modules/events.js +4 -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/main.js +4 -15
- package/build/modules/http/url_builder_client.js +2 -9
- package/build/modules/logger.d.ts +30 -0
- package/build/modules/logger.js +4 -9
- package/build/modules/repl.js +4 -9
- package/build/modules/transformers/main.js +4 -9
- package/build/providers/app_provider.js +147 -359
- package/build/providers/edge_provider.js +97 -165
- package/build/providers/hash_provider.js +29 -91
- package/build/providers/repl_provider.js +61 -152
- package/build/providers/vinejs_provider.d.ts +1 -1
- package/build/providers/vinejs_provider.js +20 -66
- package/build/repl-CumYg2V_.js +5 -0
- package/build/services/ace.js +2 -17
- package/build/services/app.js +2 -21
- package/build/services/config.js +2 -13
- package/build/services/dumper.js +5 -21
- package/build/services/emitter.js +2 -14
- package/build/services/encryption.js +2 -14
- package/build/services/hash.js +2 -14
- package/build/services/logger.js +2 -14
- package/build/services/repl.js +2 -14
- package/build/services/router.js +2 -14
- package/build/services/server.js +2 -14
- package/build/services/test_utils.js +2 -17
- package/build/services/url_builder.js +5 -17
- 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 +2 -78
- package/build/src/helpers/types.js +26 -135
- package/build/src/helpers/verification_token.js +2 -120
- package/build/src/test_utils/main.js +5 -77
- package/build/src/types.js +0 -8
- package/build/src/vine.js +2 -105
- package/build/string-CJ7ewUFq.js +28 -0
- package/build/test_utils-c_TEaEHW.js +10 -0
- 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.js +2 -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-CNQ4tlGM.js +41 -0
- package/build/verification_token-DXsW81rl.js +46 -0
- package/build/vine-Bt4ymkM0.js +32 -0
- package/package.json +81 -31
- 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/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/controller.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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t as Ignitor } from "./main-BTUXw6He.js";
|
|
2
|
+
import { t as IgnitorFactory } from "./ignitor-Dil-rtCo.js";
|
|
3
|
+
import { t as createAceKernel } from "./create_kernel-B7zWS8Zz.js";
|
|
4
|
+
var AceFactory = class {
|
|
5
|
+
async make(ignitorOrAppRoot, options) {
|
|
6
|
+
if (ignitorOrAppRoot instanceof Ignitor) {
|
|
7
|
+
const app$1 = ignitorOrAppRoot.createApp("console");
|
|
8
|
+
await app$1.init();
|
|
9
|
+
return createAceKernel(app$1);
|
|
10
|
+
}
|
|
11
|
+
const app = new IgnitorFactory().withCoreConfig().withCoreProviders().create(ignitorOrAppRoot, options).createApp("console");
|
|
12
|
+
await app.init();
|
|
13
|
+
return createAceKernel(app);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export { AceFactory as t };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (all, symbols) => {
|
|
7
|
+
let target = {};
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
if (symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
+
return target;
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
17
|
+
key = keys[i];
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: ((k) => from[k]).bind(null, key),
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __reExport = (target, mod, secondTarget, symbols) => {
|
|
26
|
+
if (symbols) {
|
|
27
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
28
|
+
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
29
|
+
}
|
|
30
|
+
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
31
|
+
};
|
|
32
|
+
export { __reExport as n, __export as t };
|
package/build/commands/add.js
CHANGED
|
@@ -1,111 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { f as BaseCommand, l as flags, o as args } from "../main-BWftwyAK.js";
|
|
2
|
+
import { t as __decorate } from "../decorate-DM0Sx1ye.js";
|
|
3
|
+
var Add = class extends BaseCommand {
|
|
4
|
+
static commandName = "add";
|
|
5
|
+
static description = "Install and configure a package";
|
|
6
|
+
static options = { allowUnknownFlags: true };
|
|
7
|
+
async #configurePackage() {
|
|
8
|
+
const flagValueArray = this.parsed.unknownFlags.filter((flag) => !!this.parsed.flags[flag]).map((flag) => [`--${flag}`, this.parsed.flags[flag].toString()]);
|
|
9
|
+
const configureArgs = [
|
|
10
|
+
this.name,
|
|
11
|
+
this.force ? "--force" : void 0,
|
|
12
|
+
this.verbose ? "--verbose" : void 0,
|
|
13
|
+
...flagValueArray.flat()
|
|
14
|
+
].filter(Boolean);
|
|
15
|
+
return await this.kernel.exec("configure", configureArgs);
|
|
16
|
+
}
|
|
17
|
+
async run() {
|
|
18
|
+
let npmPackageName = this.name;
|
|
19
|
+
if (this.name === "vinejs") npmPackageName = "@vinejs/vine";
|
|
20
|
+
else if (this.name === "edge") npmPackageName = "edge.js";
|
|
21
|
+
const codemods = await this.createCodemods();
|
|
22
|
+
codemods.verboseInstallOutput = !!this.verbose;
|
|
23
|
+
if (!await codemods.installPackages([{
|
|
24
|
+
name: npmPackageName,
|
|
25
|
+
isDevDependency: !!this.dev
|
|
26
|
+
}], this.packageManager)) return;
|
|
27
|
+
const { exitCode } = await this.#configurePackage();
|
|
28
|
+
this.exitCode = exitCode;
|
|
29
|
+
if (exitCode === 0) this.logger.success(`Installed and configured ${this.colors.green(this.name)}`);
|
|
30
|
+
else this.logger.fatal(`Unable to configure ${this.colors.green(this.name)}`);
|
|
31
|
+
}
|
|
14
32
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* ace add vinejs --force
|
|
25
|
-
* ace add edge --package-manager=pnpm
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export default class Add extends BaseCommand {
|
|
29
|
-
/**
|
|
30
|
-
* The command name
|
|
31
|
-
*/
|
|
32
|
-
static commandName = 'add';
|
|
33
|
-
/**
|
|
34
|
-
* The command description
|
|
35
|
-
*/
|
|
36
|
-
static description = 'Install and configure a package';
|
|
37
|
-
/**
|
|
38
|
-
* Command options configuration
|
|
39
|
-
*/
|
|
40
|
-
static options = {
|
|
41
|
-
allowUnknownFlags: true,
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Configure the package by delegating the work to the `node ace configure` command
|
|
45
|
-
*/
|
|
46
|
-
async #configurePackage() {
|
|
47
|
-
/**
|
|
48
|
-
* Sending unknown flags to the configure command
|
|
49
|
-
*/
|
|
50
|
-
const flagValueArray = this.parsed.unknownFlags
|
|
51
|
-
.filter((flag) => !!this.parsed.flags[flag])
|
|
52
|
-
.map((flag) => [`--${flag}`, this.parsed.flags[flag].toString()]);
|
|
53
|
-
const configureArgs = [
|
|
54
|
-
this.name,
|
|
55
|
-
this.force ? '--force' : undefined,
|
|
56
|
-
this.verbose ? '--verbose' : undefined,
|
|
57
|
-
...flagValueArray.flat(),
|
|
58
|
-
].filter(Boolean);
|
|
59
|
-
return await this.kernel.exec('configure', configureArgs);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Run method is invoked by ace automatically
|
|
63
|
-
*/
|
|
64
|
-
async run() {
|
|
65
|
-
/**
|
|
66
|
-
* Handle special packages to configure
|
|
67
|
-
*/
|
|
68
|
-
let npmPackageName = this.name;
|
|
69
|
-
if (this.name === 'vinejs') {
|
|
70
|
-
npmPackageName = '@vinejs/vine';
|
|
71
|
-
}
|
|
72
|
-
else if (this.name === 'edge') {
|
|
73
|
-
npmPackageName = 'edge.js';
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Install package
|
|
77
|
-
*/
|
|
78
|
-
const codemods = await this.createCodemods();
|
|
79
|
-
codemods.verboseInstallOutput = !!this.verbose;
|
|
80
|
-
const pkgWasInstalled = await codemods.installPackages([{ name: npmPackageName, isDevDependency: !!this.dev }], this.packageManager);
|
|
81
|
-
if (!pkgWasInstalled) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Configure package
|
|
86
|
-
*/
|
|
87
|
-
const { exitCode } = await this.#configurePackage();
|
|
88
|
-
this.exitCode = exitCode;
|
|
89
|
-
if (exitCode === 0) {
|
|
90
|
-
this.logger.success(`Installed and configured ${this.colors.green(this.name)}`);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
this.logger.fatal(`Unable to configure ${this.colors.green(this.name)}`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
__decorate([
|
|
98
|
-
args.string({ description: 'Package name' })
|
|
99
|
-
], Add.prototype, "name", void 0);
|
|
100
|
-
__decorate([
|
|
101
|
-
flags.boolean({ description: 'Display logs in verbose mode' })
|
|
102
|
-
], Add.prototype, "verbose", void 0);
|
|
103
|
-
__decorate([
|
|
104
|
-
flags.string({ description: 'Define the package manager you want to use' })
|
|
105
|
-
], Add.prototype, "packageManager", void 0);
|
|
106
|
-
__decorate([
|
|
107
|
-
flags.boolean({ description: 'Should we install the package as a dev dependency', alias: 'D' })
|
|
108
|
-
], Add.prototype, "dev", void 0);
|
|
109
|
-
__decorate([
|
|
110
|
-
flags.boolean({ description: 'Forcefully overwrite existing files' })
|
|
111
|
-
], Add.prototype, "force", void 0);
|
|
33
|
+
__decorate([args.string({ description: "Package name" })], Add.prototype, "name", void 0);
|
|
34
|
+
__decorate([flags.boolean({ description: "Display logs in verbose mode" })], Add.prototype, "verbose", void 0);
|
|
35
|
+
__decorate([flags.string({ description: "Define the package manager you want to use" })], Add.prototype, "packageManager", void 0);
|
|
36
|
+
__decorate([flags.boolean({
|
|
37
|
+
description: "Should we install the package as a dev dependency",
|
|
38
|
+
alias: "D"
|
|
39
|
+
})], Add.prototype, "dev", void 0);
|
|
40
|
+
__decorate([flags.boolean({ description: "Forcefully overwrite existing files" })], Add.prototype, "force", void 0);
|
|
41
|
+
export { Add as default };
|
package/build/commands/build.js
CHANGED
|
@@ -1,108 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { n as importTypeScript, t as importAssembler } from "../utils-CNQ4tlGM.js";
|
|
2
|
+
import { f as BaseCommand, l as flags } from "../main-BWftwyAK.js";
|
|
3
|
+
import { t as __decorate } from "../decorate-DM0Sx1ye.js";
|
|
4
|
+
var Build = class extends BaseCommand {
|
|
5
|
+
static commandName = "build";
|
|
6
|
+
static description = "Build application for production by compiling frontend assets and TypeScript source to JavaScript";
|
|
7
|
+
static help = [
|
|
8
|
+
"Create the production build using the following command.",
|
|
9
|
+
"```",
|
|
10
|
+
"{{ binaryName }} build",
|
|
11
|
+
"```",
|
|
12
|
+
"",
|
|
13
|
+
"The assets bundler dev server runs automatically after detecting vite config or webpack config files",
|
|
14
|
+
"You may pass vite CLI args using the --assets-args command line flag.",
|
|
15
|
+
"```",
|
|
16
|
+
"{{ binaryName }} build --assets-args=\"--debug --base=/public\"",
|
|
17
|
+
"```"
|
|
18
|
+
];
|
|
19
|
+
#logMissingDevelopmentDependency(dependency) {
|
|
20
|
+
this.logger.error([
|
|
21
|
+
`Cannot find package "${dependency}"`,
|
|
22
|
+
"",
|
|
23
|
+
`The "${dependency}" package is a development dependency and therefore you should use the build command with development dependencies installed.`,
|
|
24
|
+
"",
|
|
25
|
+
"If you are using the build command inside a CI or with a deployment platform, make sure the NODE_ENV is set to \"development\""
|
|
26
|
+
].join("\n"));
|
|
27
|
+
}
|
|
28
|
+
async run() {
|
|
29
|
+
const assembler = await importAssembler(this.app);
|
|
30
|
+
if (!assembler) {
|
|
31
|
+
this.#logMissingDevelopmentDependency("@adonisjs/assembler");
|
|
32
|
+
this.exitCode = 1;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const ts = await importTypeScript(this.app);
|
|
36
|
+
if (!ts) {
|
|
37
|
+
this.#logMissingDevelopmentDependency("typescript");
|
|
38
|
+
this.exitCode = 1;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const bundler = new assembler.Bundler(this.app.appRoot, ts, {
|
|
42
|
+
metaFiles: this.app.rcFile.metaFiles,
|
|
43
|
+
hooks: this.app.rcFile.hooks
|
|
44
|
+
});
|
|
45
|
+
bundler.ui.logger = this.logger;
|
|
46
|
+
const stopOnError = this.ignoreTsErrors === true ? false : true;
|
|
47
|
+
if (!await bundler.bundle(stopOnError, this.packageManager)) this.exitCode = 1;
|
|
48
|
+
}
|
|
14
49
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* Create the production build by compiling TypeScript source and the
|
|
19
|
-
* frontend assets
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```
|
|
23
|
-
* ace build
|
|
24
|
-
* ace build --ignore-ts-errors
|
|
25
|
-
* ace build --package-manager=pnpm
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export default class Build extends BaseCommand {
|
|
29
|
-
/**
|
|
30
|
-
* The command name
|
|
31
|
-
*/
|
|
32
|
-
static commandName = 'build';
|
|
33
|
-
/**
|
|
34
|
-
* The command description
|
|
35
|
-
*/
|
|
36
|
-
static description = 'Build application for production by compiling frontend assets and TypeScript source to JavaScript';
|
|
37
|
-
/**
|
|
38
|
-
* Help text for the command
|
|
39
|
-
*/
|
|
40
|
-
static help = [
|
|
41
|
-
'Create the production build using the following command.',
|
|
42
|
-
'```',
|
|
43
|
-
'{{ binaryName }} build',
|
|
44
|
-
'```',
|
|
45
|
-
'',
|
|
46
|
-
'The assets bundler dev server runs automatically after detecting vite config or webpack config files',
|
|
47
|
-
'You may pass vite CLI args using the --assets-args command line flag.',
|
|
48
|
-
'```',
|
|
49
|
-
'{{ binaryName }} build --assets-args="--debug --base=/public"',
|
|
50
|
-
'```',
|
|
51
|
-
];
|
|
52
|
-
/**
|
|
53
|
-
* Log a development dependency is missing
|
|
54
|
-
*
|
|
55
|
-
* @param dependency - The name of the missing dependency
|
|
56
|
-
*/
|
|
57
|
-
#logMissingDevelopmentDependency(dependency) {
|
|
58
|
-
this.logger.error([
|
|
59
|
-
`Cannot find package "${dependency}"`,
|
|
60
|
-
'',
|
|
61
|
-
`The "${dependency}" package is a development dependency and therefore you should use the build command with development dependencies installed.`,
|
|
62
|
-
'',
|
|
63
|
-
'If you are using the build command inside a CI or with a deployment platform, make sure the NODE_ENV is set to "development"',
|
|
64
|
-
].join('\n'));
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Build application
|
|
68
|
-
*/
|
|
69
|
-
async run() {
|
|
70
|
-
const assembler = await importAssembler(this.app);
|
|
71
|
-
if (!assembler) {
|
|
72
|
-
this.#logMissingDevelopmentDependency('@adonisjs/assembler');
|
|
73
|
-
this.exitCode = 1;
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const ts = await importTypeScript(this.app);
|
|
77
|
-
if (!ts) {
|
|
78
|
-
this.#logMissingDevelopmentDependency('typescript');
|
|
79
|
-
this.exitCode = 1;
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const bundler = new assembler.Bundler(this.app.appRoot, ts, {
|
|
83
|
-
metaFiles: this.app.rcFile.metaFiles,
|
|
84
|
-
hooks: this.app.rcFile.hooks,
|
|
85
|
-
});
|
|
86
|
-
/**
|
|
87
|
-
* Share command logger with assembler, so that CLI flags like --no-ansi has
|
|
88
|
-
* similar impact for assembler logs as well.
|
|
89
|
-
*/
|
|
90
|
-
bundler.ui.logger = this.logger;
|
|
91
|
-
/**
|
|
92
|
-
* Bundle project for production
|
|
93
|
-
*/
|
|
94
|
-
const stopOnError = this.ignoreTsErrors === true ? false : true;
|
|
95
|
-
const builtSuccessfully = await bundler.bundle(stopOnError, this.packageManager);
|
|
96
|
-
if (!builtSuccessfully) {
|
|
97
|
-
this.exitCode = 1;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
__decorate([
|
|
102
|
-
flags.boolean({ description: 'Ignore TypeScript errors and continue with the build process' })
|
|
103
|
-
], Build.prototype, "ignoreTsErrors", void 0);
|
|
104
|
-
__decorate([
|
|
105
|
-
flags.string({
|
|
106
|
-
description: 'Define the package manager to copy the appropriate lock file',
|
|
107
|
-
})
|
|
108
|
-
], Build.prototype, "packageManager", void 0);
|
|
50
|
+
__decorate([flags.boolean({ description: "Ignore TypeScript errors and continue with the build process" })], Build.prototype, "ignoreTsErrors", void 0);
|
|
51
|
+
__decorate([flags.string({ description: "Define the package manager to copy the appropriate lock file" })], Build.prototype, "packageManager", void 0);
|
|
52
|
+
export { Build as default };
|
|
@@ -1,178 +1,83 @@
|
|
|
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-BWftwyAK.js";
|
|
3
|
+
import { t as __decorate } from "../decorate-DM0Sx1ye.js";
|
|
4
|
+
import { RuntimeException } from "@poppinss/utils/exception";
|
|
5
|
+
var Configure = class extends BaseCommand {
|
|
6
|
+
static commandName = "configure";
|
|
7
|
+
static description = "Configure a package after it has been installed";
|
|
8
|
+
static options = { allowUnknownFlags: true };
|
|
9
|
+
get parsedFlags() {
|
|
10
|
+
return this.parsed.flags;
|
|
11
|
+
}
|
|
12
|
+
get parsedArgs() {
|
|
13
|
+
return this.parsed._;
|
|
14
|
+
}
|
|
15
|
+
async #getPackageSource(packageName) {
|
|
16
|
+
try {
|
|
17
|
+
return await this.app.import(packageName);
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error.code && error.code === "ERR_MODULE_NOT_FOUND" || error.message.startsWith("Cannot find module")) return null;
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async #configureVineJS() {
|
|
24
|
+
await (await this.createCodemods()).updateRcFile((rcFile) => {
|
|
25
|
+
rcFile.addProvider("@adonisjs/core/providers/vinejs_provider");
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async #configureEdge() {
|
|
29
|
+
await (await this.createCodemods()).updateRcFile((rcFile) => {
|
|
30
|
+
rcFile.addProvider("@adonisjs/core/providers/edge_provider");
|
|
31
|
+
rcFile.addMetaFile("resources/views/**/*.edge", false);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async #configureHealthChecks() {
|
|
35
|
+
const codemods = await this.createCodemods();
|
|
36
|
+
await codemods.makeUsingStub(stubsRoot, "make/health/main.stub", {
|
|
37
|
+
flags: this.parsed.flags,
|
|
38
|
+
entity: this.app.generators.createEntity("health")
|
|
39
|
+
});
|
|
40
|
+
await codemods.makeUsingStub(stubsRoot, "make/health/controller.stub", {
|
|
41
|
+
flags: this.parsed.flags,
|
|
42
|
+
entity: this.app.generators.createEntity("health_checks")
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async createCodemods() {
|
|
46
|
+
const codemods = await super.createCodemods();
|
|
47
|
+
codemods.overwriteExisting = this.force === true;
|
|
48
|
+
codemods.verboseInstallOutput = this.verbose === true;
|
|
49
|
+
return codemods;
|
|
50
|
+
}
|
|
51
|
+
async run() {
|
|
52
|
+
if (this.name === "vinejs") return this.#configureVineJS();
|
|
53
|
+
if (this.name === "edge") return this.#configureEdge();
|
|
54
|
+
if (this.name === "health_checks") return this.#configureHealthChecks();
|
|
55
|
+
const packageExports = await this.#getPackageSource(this.name);
|
|
56
|
+
if (!packageExports) {
|
|
57
|
+
this.logger.error(`Cannot find module "${this.name}". Make sure to install it`);
|
|
58
|
+
this.exitCode = 1;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (!packageExports.configure) {
|
|
62
|
+
this.logger.error(`Cannot configure module "${this.name}". The module does not export the configure hook`);
|
|
63
|
+
this.exitCode = 1;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (packageExports.stubsRoot) this.stubsRoot = packageExports.stubsRoot;
|
|
67
|
+
try {
|
|
68
|
+
await packageExports.configure(this);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
throw new RuntimeException(`Unable to configure package "${this.name}"`, { cause: error });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
14
73
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* ace configure @adonisjs/lucid
|
|
26
|
-
* ace configure vinejs
|
|
27
|
-
* ace configure edge
|
|
28
|
-
* ace configure health_checks
|
|
29
|
-
* ace configure @adonisjs/auth --force --verbose
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export default class Configure extends BaseCommand {
|
|
33
|
-
/**
|
|
34
|
-
* The command name
|
|
35
|
-
*/
|
|
36
|
-
static commandName = 'configure';
|
|
37
|
-
/**
|
|
38
|
-
* The command description
|
|
39
|
-
*/
|
|
40
|
-
static description = 'Configure a package after it has been installed';
|
|
41
|
-
/**
|
|
42
|
-
* Command options configuration.
|
|
43
|
-
* Allows unknown flags to be passed to package configure functions.
|
|
44
|
-
*/
|
|
45
|
-
static options = {
|
|
46
|
-
allowUnknownFlags: true,
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Expose all flags from the protected property "parsed" for access by package configure functions
|
|
50
|
-
*/
|
|
51
|
-
get parsedFlags() {
|
|
52
|
-
return this.parsed.flags;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Expose all arguments from the protected property "parsed" for access by package configure functions
|
|
56
|
-
*/
|
|
57
|
-
get parsedArgs() {
|
|
58
|
-
return this.parsed._;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Import and return the main exports of a package.
|
|
62
|
-
* Returns null if the package is not found, rethrows other errors.
|
|
63
|
-
*
|
|
64
|
-
* @param packageName - The name of the package to import
|
|
65
|
-
* @returns The package exports or null if not found
|
|
66
|
-
*/
|
|
67
|
-
async #getPackageSource(packageName) {
|
|
68
|
-
try {
|
|
69
|
-
const packageExports = await this.app.import(packageName);
|
|
70
|
-
return packageExports;
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
if ((error.code && error.code === 'ERR_MODULE_NOT_FOUND') ||
|
|
74
|
-
error.message.startsWith('Cannot find module')) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
throw error;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Configure VineJS validation library by registering its provider in the RC file
|
|
82
|
-
*/
|
|
83
|
-
async #configureVineJS() {
|
|
84
|
-
const codemods = await this.createCodemods();
|
|
85
|
-
await codemods.updateRcFile((rcFile) => {
|
|
86
|
-
rcFile.addProvider('@adonisjs/core/providers/vinejs_provider');
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Configure Edge template engine by registering its provider and adding view meta files
|
|
91
|
-
*/
|
|
92
|
-
async #configureEdge() {
|
|
93
|
-
const codemods = await this.createCodemods();
|
|
94
|
-
await codemods.updateRcFile((rcFile) => {
|
|
95
|
-
rcFile.addProvider('@adonisjs/core/providers/edge_provider');
|
|
96
|
-
rcFile.addMetaFile('resources/views/**/*.edge', false);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Configure health checks feature by generating the main health file and controller
|
|
101
|
-
*/
|
|
102
|
-
async #configureHealthChecks() {
|
|
103
|
-
const codemods = await this.createCodemods();
|
|
104
|
-
await codemods.makeUsingStub(stubsRoot, 'make/health/main.stub', {
|
|
105
|
-
flags: this.parsed.flags,
|
|
106
|
-
entity: this.app.generators.createEntity('health'),
|
|
107
|
-
});
|
|
108
|
-
await codemods.makeUsingStub(stubsRoot, 'make/health/controller.stub', {
|
|
109
|
-
flags: this.parsed.flags,
|
|
110
|
-
entity: this.app.generators.createEntity('health_checks'),
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Create a codemods instance configured with command options.
|
|
115
|
-
* Sets overwrite and verbose flags based on command arguments.
|
|
116
|
-
*/
|
|
117
|
-
async createCodemods() {
|
|
118
|
-
const codemods = await super.createCodemods();
|
|
119
|
-
codemods.overwriteExisting = this.force === true;
|
|
120
|
-
codemods.verboseInstallOutput = this.verbose === true;
|
|
121
|
-
return codemods;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Execute the configure command. Handles built-in configurations for VineJS, Edge,
|
|
125
|
-
* and health checks, or imports and executes the configure function from the specified package.
|
|
126
|
-
*/
|
|
127
|
-
async run() {
|
|
128
|
-
if (this.name === 'vinejs') {
|
|
129
|
-
return this.#configureVineJS();
|
|
130
|
-
}
|
|
131
|
-
if (this.name === 'edge') {
|
|
132
|
-
return this.#configureEdge();
|
|
133
|
-
}
|
|
134
|
-
if (this.name === 'health_checks') {
|
|
135
|
-
return this.#configureHealthChecks();
|
|
136
|
-
}
|
|
137
|
-
const packageExports = await this.#getPackageSource(this.name);
|
|
138
|
-
if (!packageExports) {
|
|
139
|
-
this.logger.error(`Cannot find module "${this.name}". Make sure to install it`);
|
|
140
|
-
this.exitCode = 1;
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Warn, there are not instructions to run
|
|
145
|
-
*/
|
|
146
|
-
if (!packageExports.configure) {
|
|
147
|
-
this.logger.error(`Cannot configure module "${this.name}". The module does not export the configure hook`);
|
|
148
|
-
this.exitCode = 1;
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Set stubsRoot property when package exports it
|
|
153
|
-
*/
|
|
154
|
-
if (packageExports.stubsRoot) {
|
|
155
|
-
this.stubsRoot = packageExports.stubsRoot;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Run instructions
|
|
159
|
-
*/
|
|
160
|
-
try {
|
|
161
|
-
await packageExports.configure(this);
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
throw new RuntimeException(`Unable to configure package "${this.name}"`, {
|
|
165
|
-
cause: error,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
__decorate([
|
|
171
|
-
args.string({ description: 'Package name' })
|
|
172
|
-
], Configure.prototype, "name", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
flags.boolean({ description: 'Display logs in verbose mode', alias: 'v' })
|
|
175
|
-
], Configure.prototype, "verbose", void 0);
|
|
176
|
-
__decorate([
|
|
177
|
-
flags.boolean({ description: 'Forcefully overwrite existing files', alias: 'f' })
|
|
178
|
-
], Configure.prototype, "force", void 0);
|
|
74
|
+
__decorate([args.string({ description: "Package name" })], Configure.prototype, "name", void 0);
|
|
75
|
+
__decorate([flags.boolean({
|
|
76
|
+
description: "Display logs in verbose mode",
|
|
77
|
+
alias: "v"
|
|
78
|
+
})], Configure.prototype, "verbose", void 0);
|
|
79
|
+
__decorate([flags.boolean({
|
|
80
|
+
description: "Forcefully overwrite existing files",
|
|
81
|
+
alias: "f"
|
|
82
|
+
})], Configure.prototype, "force", void 0);
|
|
83
|
+
export { Configure as default };
|