@adonisjs/core 6.19.0 → 7.0.0-next.0
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/add.d.ts +4 -5
- package/build/commands/add.js +7 -60
- package/build/commands/build.d.ts +1 -3
- package/build/commands/build.js +4 -36
- package/build/commands/commands.json +1 -1
- package/build/commands/configure.d.ts +3 -3
- package/build/commands/configure.js +3 -3
- package/build/commands/eject.d.ts +1 -1
- package/build/commands/eject.js +3 -3
- package/build/commands/env/add.d.ts +2 -2
- package/build/commands/env/add.js +2 -2
- package/build/commands/generate_key.d.ts +1 -1
- package/build/commands/generate_key.js +1 -1
- package/build/commands/inspect_rcfile.d.ts +1 -1
- package/build/commands/inspect_rcfile.js +1 -1
- package/build/commands/list/routes.d.ts +2 -2
- package/build/commands/list/routes.js +2 -2
- package/build/commands/make/command.d.ts +1 -1
- package/build/commands/make/command.js +3 -3
- package/build/commands/make/controller.d.ts +2 -2
- package/build/commands/make/controller.js +2 -2
- package/build/commands/make/event.d.ts +2 -2
- package/build/commands/make/event.js +2 -2
- package/build/commands/make/exception.d.ts +2 -2
- package/build/commands/make/exception.js +2 -2
- package/build/commands/make/listener.d.ts +2 -2
- package/build/commands/make/listener.js +2 -2
- package/build/commands/make/middleware.d.ts +2 -2
- package/build/commands/make/middleware.js +4 -4
- package/build/commands/make/preload.d.ts +1 -1
- package/build/commands/make/preload.js +4 -4
- package/build/commands/make/provider.d.ts +1 -1
- package/build/commands/make/provider.js +4 -4
- package/build/commands/make/service.d.ts +2 -2
- package/build/commands/make/service.js +2 -2
- package/build/commands/make/test.d.ts +1 -1
- package/build/commands/make/test.js +2 -2
- package/build/commands/make/validator.d.ts +2 -2
- package/build/commands/make/validator.js +2 -2
- package/build/commands/make/view.d.ts +1 -1
- package/build/commands/make/view.js +2 -2
- package/build/commands/repl.d.ts +2 -2
- package/build/commands/repl.js +1 -1
- package/build/commands/serve.d.ts +2 -4
- package/build/commands/serve.js +11 -43
- package/build/commands/test.d.ts +2 -4
- package/build/commands/test.js +4 -32
- package/build/factories/core/ace.d.ts +31 -4
- package/build/factories/core/ace.js +20 -4
- package/build/factories/core/ignitor.d.ts +80 -9
- package/build/factories/core/ignitor.js +84 -13
- package/build/factories/core/main.d.ts +3 -3
- package/build/factories/core/main.js +3 -3
- package/build/factories/core/test_utils.d.ts +32 -4
- package/build/factories/core/test_utils.js +21 -4
- package/build/factories/stubs.d.ts +54 -5
- package/build/factories/stubs.js +55 -6
- package/build/index.d.ts +5 -4
- package/build/index.js +13 -9
- package/build/modules/ace/codemods.d.ts +71 -11
- package/build/modules/ace/codemods.js +90 -22
- package/build/modules/ace/commands.d.ts +49 -13
- package/build/modules/ace/commands.js +48 -10
- package/build/modules/ace/create_kernel.d.ts +19 -8
- package/build/modules/ace/create_kernel.js +19 -8
- package/build/modules/ace/kernel.d.ts +18 -4
- package/build/modules/ace/kernel.js +17 -3
- package/build/modules/ace/main.d.ts +3 -3
- package/build/modules/ace/main.js +3 -3
- package/build/modules/dumper/define_config.d.ts +25 -4
- package/build/modules/dumper/define_config.js +23 -2
- package/build/modules/dumper/dumper.d.ts +82 -12
- package/build/modules/dumper/dumper.js +82 -12
- package/build/modules/dumper/errors.d.ts +31 -10
- package/build/modules/dumper/errors.js +28 -7
- package/build/modules/dumper/main.d.ts +3 -3
- package/build/modules/dumper/main.js +3 -3
- package/build/modules/dumper/plugins/edge.d.ts +1 -1
- package/build/modules/hash/define_config.d.ts +53 -8
- package/build/modules/hash/define_config.js +51 -6
- package/build/modules/hash/main.d.ts +1 -1
- package/build/modules/hash/main.js +1 -1
- package/build/modules/http/main.d.ts +1 -1
- package/build/modules/http/main.js +1 -1
- package/build/modules/http/request_validator.d.ts +36 -9
- package/build/modules/http/request_validator.js +32 -5
- package/build/modules/transformers/main.d.ts +1 -0
- package/build/modules/transformers/main.js +9 -0
- package/build/providers/app_provider.d.ts +173 -1
- package/build/providers/app_provider.js +204 -8
- package/build/providers/edge_provider.d.ts +31 -2
- package/build/providers/edge_provider.js +31 -2
- package/build/providers/hash_provider.d.ts +38 -1
- package/build/providers/hash_provider.js +40 -3
- package/build/providers/repl_provider.d.ts +40 -1
- package/build/providers/repl_provider.js +52 -2
- package/build/providers/vinejs_provider.d.ts +32 -5
- package/build/providers/vinejs_provider.js +31 -4
- package/build/services/ace.d.ts +1 -1
- package/build/services/ace.js +1 -1
- package/build/services/app.d.ts +1 -1
- package/build/services/config.d.ts +1 -1
- package/build/services/config.js +1 -1
- package/build/services/dumper.js +1 -1
- package/build/services/emitter.d.ts +1 -1
- package/build/services/emitter.js +1 -1
- package/build/services/encryption.d.ts +1 -1
- package/build/services/encryption.js +1 -1
- package/build/services/hash.d.ts +1 -1
- package/build/services/hash.js +1 -1
- package/build/services/logger.d.ts +1 -1
- package/build/services/logger.js +1 -1
- package/build/services/repl.d.ts +1 -1
- package/build/services/repl.js +1 -1
- package/build/services/router.d.ts +1 -1
- package/build/services/router.js +1 -1
- package/build/services/server.d.ts +1 -1
- package/build/services/server.js +1 -1
- package/build/services/test_utils.d.ts +1 -1
- package/build/services/test_utils.js +1 -1
- package/build/services/url_builder.d.ts +4 -0
- package/build/services/url_builder.js +21 -0
- package/build/src/assembler_hooks/index_entities.d.ts +51 -0
- package/build/src/assembler_hooks/index_entities.js +96 -0
- package/build/src/cli_formatters/routes_list.d.ts +24 -12
- package/build/src/cli_formatters/routes_list.js +43 -46
- package/build/src/config_provider.d.ts +48 -3
- package/build/src/config_provider.js +47 -2
- package/build/src/debug.d.ts +15 -0
- package/build/src/debug.js +15 -0
- package/build/src/exceptions.d.ts +41 -1
- package/build/src/exceptions.js +41 -1
- package/build/src/helpers/assert.d.ts +47 -1
- package/build/src/helpers/assert.js +47 -1
- package/build/src/helpers/is.d.ts +21 -0
- package/build/src/helpers/is.js +21 -0
- package/build/src/helpers/main.d.ts +48 -5
- package/build/src/helpers/main.js +48 -5
- package/build/src/helpers/string.d.ts +89 -9
- package/build/src/helpers/string.js +15 -2
- package/build/src/helpers/types.d.ts +96 -2
- package/build/src/helpers/types.js +96 -2
- package/build/src/helpers/verification_token.d.ts +22 -1
- package/build/src/helpers/verification_token.js +24 -2
- package/build/src/ignitor/ace.d.ts +23 -3
- package/build/src/ignitor/ace.js +21 -1
- package/build/src/ignitor/http.d.ts +16 -3
- package/build/src/ignitor/http.js +16 -3
- package/build/src/ignitor/main.d.ts +29 -6
- package/build/src/ignitor/main.js +30 -7
- package/build/src/ignitor/test.d.ts +26 -3
- package/build/src/ignitor/test.js +24 -1
- package/build/src/test_utils/http.d.ts +19 -3
- package/build/src/test_utils/http.js +24 -3
- package/build/src/test_utils/main.d.ts +22 -4
- package/build/src/test_utils/main.js +21 -3
- package/build/src/types.d.ts +277 -26
- package/build/src/utils.d.ts +34 -0
- package/build/src/utils.js +49 -0
- package/build/src/vine.d.ts +24 -1
- package/build/src/vine.js +27 -1
- package/build/stubs/main.js +1 -2
- package/build/toolkit/main.js +1 -1
- package/build/types/helpers.d.ts +2 -1
- package/build/types/transformers.d.ts +1 -0
- package/build/types/transformers.js +9 -0
- package/package.json +51 -50
- package/build/src/helpers/parse_binding_reference.d.ts +0 -45
- package/build/src/helpers/parse_binding_reference.js +0 -83
- package/build/src/internal_helpers.d.ts +0 -15
- package/build/src/internal_helpers.js +0 -63
|
@@ -12,10 +12,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
14
|
};
|
|
15
|
-
import { slash } from '@poppinss/utils';
|
|
16
15
|
import { extname, relative } from 'node:path';
|
|
17
|
-
import { stubsRoot } from
|
|
18
|
-
import
|
|
16
|
+
import { stubsRoot } from "../../stubs/main.js";
|
|
17
|
+
import stringHelpers from "../../src/helpers/string.js";
|
|
18
|
+
import { args, flags, BaseCommand } from "../../modules/ace/main.js";
|
|
19
19
|
const ALLOWED_ENVIRONMENTS = ['web', 'console', 'test', 'repl'];
|
|
20
20
|
/**
|
|
21
21
|
* Make a new preload file
|
|
@@ -70,7 +70,7 @@ export default class MakePreload extends BaseCommand {
|
|
|
70
70
|
* Creative relative path for the preload file from
|
|
71
71
|
* the "./start" directory
|
|
72
72
|
*/
|
|
73
|
-
const preloadFileRelativePath =
|
|
73
|
+
const preloadFileRelativePath = stringHelpers.toUnixSlash(relative(this.app.startPath(), destination).replace(extname(destination), ''));
|
|
74
74
|
await codemods.updateRcFile((rcFile) => {
|
|
75
75
|
rcFile.addPreloadFile(`#start/${preloadFileRelativePath}`, this.environments);
|
|
76
76
|
});
|
|
@@ -12,10 +12,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
14
|
};
|
|
15
|
-
import { slash } from '@poppinss/utils';
|
|
16
15
|
import { extname, relative } from 'node:path';
|
|
17
|
-
import { stubsRoot } from
|
|
18
|
-
import
|
|
16
|
+
import { stubsRoot } from "../../stubs/main.js";
|
|
17
|
+
import stringHelpers from "../../src/helpers/string.js";
|
|
18
|
+
import { args, BaseCommand, flags } from "../../modules/ace/main.js";
|
|
19
19
|
const ALLOWED_ENVIRONMENTS = ['web', 'console', 'test', 'repl'];
|
|
20
20
|
/**
|
|
21
21
|
* Make a new provider class
|
|
@@ -67,7 +67,7 @@ export default class MakeProvider extends BaseCommand {
|
|
|
67
67
|
* Creative relative path for the provider file from
|
|
68
68
|
* the "./start" directory
|
|
69
69
|
*/
|
|
70
|
-
const providerRelativePath =
|
|
70
|
+
const providerRelativePath = stringHelpers.toUnixSlash(relative(this.app.providersPath(), destination).replace(extname(destination), ''));
|
|
71
71
|
await codemods.updateRcFile((rcFile) => {
|
|
72
72
|
rcFile.addProvider(`#providers/${providerRelativePath}`, this.environments);
|
|
73
73
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseCommand } from '../../modules/ace/main.
|
|
2
|
-
import { CommandOptions } from '../../types/ace.
|
|
1
|
+
import { BaseCommand } from '../../modules/ace/main.ts';
|
|
2
|
+
import { type CommandOptions } from '../../types/ace.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Make a new service class
|
|
5
5
|
*/
|
|
@@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
14
|
};
|
|
15
|
-
import { stubsRoot } from
|
|
16
|
-
import { args, BaseCommand } from
|
|
15
|
+
import { stubsRoot } from "../../stubs/main.js";
|
|
16
|
+
import { args, BaseCommand } from "../../modules/ace/main.js";
|
|
17
17
|
/**
|
|
18
18
|
* Make a new service class
|
|
19
19
|
*/
|
|
@@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
14
|
};
|
|
15
|
-
import { stubsRoot } from
|
|
16
|
-
import { args, flags, BaseCommand } from
|
|
15
|
+
import { stubsRoot } from "../../stubs/main.js";
|
|
16
|
+
import { args, flags, BaseCommand } from "../../modules/ace/main.js";
|
|
17
17
|
/**
|
|
18
18
|
* Make a new test file
|
|
19
19
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseCommand } from '../../modules/ace/main.
|
|
2
|
-
import { CommandOptions } from '../../types/ace.
|
|
1
|
+
import { BaseCommand } from '../../modules/ace/main.ts';
|
|
2
|
+
import { type CommandOptions } from '../../types/ace.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Make a new VineJS validator
|
|
5
5
|
*/
|
|
@@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
14
|
};
|
|
15
|
-
import { stubsRoot } from
|
|
16
|
-
import { args, flags, BaseCommand } from
|
|
15
|
+
import { stubsRoot } from "../../stubs/main.js";
|
|
16
|
+
import { args, flags, BaseCommand } from "../../modules/ace/main.js";
|
|
17
17
|
/**
|
|
18
18
|
* Make a new VineJS validator
|
|
19
19
|
*/
|
|
@@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
14
|
};
|
|
15
|
-
import { stubsRoot } from
|
|
16
|
-
import { args, BaseCommand } from
|
|
15
|
+
import { stubsRoot } from "../../stubs/main.js";
|
|
16
|
+
import { args, BaseCommand } from "../../modules/ace/main.js";
|
|
17
17
|
/**
|
|
18
18
|
* Make a new EdgeJS template file
|
|
19
19
|
*/
|
package/build/commands/repl.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseCommand } from '../modules/ace/main.
|
|
2
|
-
import { CommandOptions } from '../types/ace.
|
|
1
|
+
import { BaseCommand } from '../modules/ace/main.ts';
|
|
2
|
+
import { type CommandOptions } from '../types/ace.ts';
|
|
3
3
|
/**
|
|
4
4
|
* The ReplCommand class is used to start the Repl server
|
|
5
5
|
*/
|
package/build/commands/repl.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import { BaseCommand } from
|
|
9
|
+
import { BaseCommand } from "../modules/ace/main.js";
|
|
10
10
|
/**
|
|
11
11
|
* The ReplCommand class is used to start the Repl server
|
|
12
12
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DevServer } from '@adonisjs/assembler';
|
|
2
|
-
import type { CommandOptions } from '../types/ace.
|
|
3
|
-
import { BaseCommand } from '../modules/ace/main.
|
|
2
|
+
import type { CommandOptions } from '../types/ace.ts';
|
|
3
|
+
import { BaseCommand } from '../modules/ace/main.ts';
|
|
4
4
|
/**
|
|
5
5
|
* Serve command is used to run the AdonisJS HTTP server during development. The
|
|
6
6
|
* command under the hood runs the "bin/server.ts" file and watches for file
|
|
@@ -17,8 +17,6 @@ export default class Serve extends BaseCommand {
|
|
|
17
17
|
watch?: boolean;
|
|
18
18
|
poll?: boolean;
|
|
19
19
|
clear?: boolean;
|
|
20
|
-
assets?: boolean;
|
|
21
|
-
assetsArgs?: string[];
|
|
22
20
|
/**
|
|
23
21
|
* Runs the HTTP server
|
|
24
22
|
*/
|
package/build/commands/serve.js
CHANGED
|
@@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
14
|
};
|
|
15
|
-
import { BaseCommand, flags } from
|
|
16
|
-
import {
|
|
15
|
+
import { BaseCommand, flags } from "../modules/ace/main.js";
|
|
16
|
+
import { importAssembler, importTypeScript } from "../src/utils.js";
|
|
17
17
|
/**
|
|
18
18
|
* Serve command is used to run the AdonisJS HTTP server during development. The
|
|
19
19
|
* command under the hood runs the "bin/server.ts" file and watches for file
|
|
@@ -54,22 +54,6 @@ export default class Serve extends BaseCommand {
|
|
|
54
54
|
'If you are running your application in production, then use "node bin/server.js" command to start the HTTP server',
|
|
55
55
|
].join('\n'));
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Returns the assets bundler config
|
|
59
|
-
*/
|
|
60
|
-
async #getAssetsBundlerConfig() {
|
|
61
|
-
const assetsBundler = await detectAssetsBundler(this.app);
|
|
62
|
-
return assetsBundler
|
|
63
|
-
? {
|
|
64
|
-
enabled: this.assets === false ? false : true,
|
|
65
|
-
driver: assetsBundler.name,
|
|
66
|
-
cmd: assetsBundler.devServer.command,
|
|
67
|
-
args: (assetsBundler.devServer.args || []).concat(this.assetsArgs || []),
|
|
68
|
-
}
|
|
69
|
-
: {
|
|
70
|
-
enabled: false,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
57
|
/**
|
|
74
58
|
* Runs the HTTP server
|
|
75
59
|
*/
|
|
@@ -90,18 +74,14 @@ export default class Serve extends BaseCommand {
|
|
|
90
74
|
clearScreen: this.clear === false ? false : true,
|
|
91
75
|
nodeArgs: this.parsed.nodeArgs,
|
|
92
76
|
scriptArgs: [],
|
|
93
|
-
assets: await this.#getAssetsBundlerConfig(),
|
|
94
77
|
metaFiles: this.app.rcFile.metaFiles,
|
|
95
|
-
hooks:
|
|
96
|
-
onDevServerStarted: this.app.rcFile.hooks?.onDevServerStarted,
|
|
97
|
-
onSourceFileChanged: this.app.rcFile.hooks?.onSourceFileChanged,
|
|
98
|
-
},
|
|
78
|
+
hooks: this.app.rcFile.hooks,
|
|
99
79
|
});
|
|
100
80
|
/**
|
|
101
81
|
* Share command logger with assembler, so that CLI flags like --no-ansi has
|
|
102
82
|
* similar impact for assembler logs as well.
|
|
103
83
|
*/
|
|
104
|
-
this.devServer.
|
|
84
|
+
this.devServer.ui.logger = this.logger;
|
|
105
85
|
/**
|
|
106
86
|
* Exit command when the dev server is closed
|
|
107
87
|
*/
|
|
@@ -116,20 +96,20 @@ export default class Serve extends BaseCommand {
|
|
|
116
96
|
this.exitCode = 1;
|
|
117
97
|
this.terminate();
|
|
118
98
|
});
|
|
99
|
+
const ts = await importTypeScript(this.app);
|
|
100
|
+
if (!ts) {
|
|
101
|
+
this.#logMissingDevelopmentDependency('typescript');
|
|
102
|
+
this.exitCode = 1;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
119
105
|
/**
|
|
120
106
|
* Start the development server
|
|
121
107
|
*/
|
|
122
108
|
if (this.watch) {
|
|
123
|
-
const ts = await importTypeScript(this.app);
|
|
124
|
-
if (!ts) {
|
|
125
|
-
this.#logMissingDevelopmentDependency('typescript');
|
|
126
|
-
this.exitCode = 1;
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
109
|
await this.devServer.startAndWatch(ts, { poll: this.poll || false });
|
|
130
110
|
}
|
|
131
111
|
else {
|
|
132
|
-
await this.devServer.start();
|
|
112
|
+
await this.devServer.start(ts);
|
|
133
113
|
}
|
|
134
114
|
}
|
|
135
115
|
}
|
|
@@ -152,15 +132,3 @@ __decorate([
|
|
|
152
132
|
default: true,
|
|
153
133
|
})
|
|
154
134
|
], Serve.prototype, "clear", void 0);
|
|
155
|
-
__decorate([
|
|
156
|
-
flags.boolean({
|
|
157
|
-
description: 'Start assets bundler dev server',
|
|
158
|
-
showNegatedVariantInHelp: true,
|
|
159
|
-
default: true,
|
|
160
|
-
})
|
|
161
|
-
], Serve.prototype, "assets", void 0);
|
|
162
|
-
__decorate([
|
|
163
|
-
flags.array({
|
|
164
|
-
description: 'Define CLI arguments to pass to the assets bundler',
|
|
165
|
-
})
|
|
166
|
-
], Serve.prototype, "assetsArgs", void 0);
|
package/build/commands/test.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TestRunner } from '@adonisjs/assembler';
|
|
2
|
-
import type { CommandOptions } from '../types/ace.
|
|
3
|
-
import { BaseCommand } from '../modules/ace/main.
|
|
2
|
+
import type { CommandOptions } from '../types/ace.ts';
|
|
3
|
+
import { BaseCommand } from '../modules/ace/main.ts';
|
|
4
4
|
/**
|
|
5
5
|
* Test command is used to run tests with optional file watcher. Under the
|
|
6
6
|
* hood, we run "bin/test.js" file.
|
|
@@ -23,8 +23,6 @@ export default class Test extends BaseCommand {
|
|
|
23
23
|
retries?: number;
|
|
24
24
|
failed?: boolean;
|
|
25
25
|
clear?: boolean;
|
|
26
|
-
assets?: boolean;
|
|
27
|
-
assetsArgs?: string[];
|
|
28
26
|
/**
|
|
29
27
|
* Runs tests
|
|
30
28
|
*/
|
package/build/commands/test.js
CHANGED
|
@@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
14
|
};
|
|
15
|
-
import { BaseCommand, flags, args } from
|
|
16
|
-
import {
|
|
15
|
+
import { BaseCommand, flags, args } from "../modules/ace/main.js";
|
|
16
|
+
import { importAssembler, importTypeScript } from "../src/utils.js";
|
|
17
17
|
/**
|
|
18
18
|
* Test command is used to run tests with optional file watcher. Under the
|
|
19
19
|
* hood, we run "bin/test.js" file.
|
|
@@ -60,22 +60,6 @@ export default class Test extends BaseCommand {
|
|
|
60
60
|
})
|
|
61
61
|
.flat(2);
|
|
62
62
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Returns the assets bundler config
|
|
65
|
-
*/
|
|
66
|
-
async #getAssetsBundlerConfig() {
|
|
67
|
-
const assetsBundler = await detectAssetsBundler(this.app);
|
|
68
|
-
return assetsBundler
|
|
69
|
-
? {
|
|
70
|
-
enabled: this.assets === false ? false : true,
|
|
71
|
-
driver: assetsBundler.name,
|
|
72
|
-
cmd: assetsBundler.devServer.command,
|
|
73
|
-
args: (assetsBundler.devServer.args || []).concat(this.assetsArgs || []),
|
|
74
|
-
}
|
|
75
|
-
: {
|
|
76
|
-
enabled: false,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
63
|
/**
|
|
80
64
|
* Runs tests
|
|
81
65
|
*/
|
|
@@ -91,7 +75,6 @@ export default class Test extends BaseCommand {
|
|
|
91
75
|
clearScreen: this.clear === false ? false : true,
|
|
92
76
|
nodeArgs: this.parsed.nodeArgs,
|
|
93
77
|
scriptArgs: this.#getPassthroughFlags(),
|
|
94
|
-
assets: await this.#getAssetsBundlerConfig(),
|
|
95
78
|
filters: {
|
|
96
79
|
suites: this.suites,
|
|
97
80
|
files: this.files,
|
|
@@ -112,13 +95,14 @@ export default class Test extends BaseCommand {
|
|
|
112
95
|
env: {
|
|
113
96
|
NODE_ENV: 'test',
|
|
114
97
|
},
|
|
98
|
+
hooks: this.app.rcFile.hooks,
|
|
115
99
|
metaFiles: this.app.rcFile.metaFiles,
|
|
116
100
|
});
|
|
117
101
|
/**
|
|
118
102
|
* Share command logger with assembler, so that CLI flags like --no-ansi has
|
|
119
103
|
* similar impact for assembler logs as well.
|
|
120
104
|
*/
|
|
121
|
-
this.testsRunner.
|
|
105
|
+
this.testsRunner.ui.logger = this.logger;
|
|
122
106
|
/**
|
|
123
107
|
* Exit command when the test runner is closed
|
|
124
108
|
*/
|
|
@@ -193,15 +177,3 @@ __decorate([
|
|
|
193
177
|
default: true,
|
|
194
178
|
})
|
|
195
179
|
], Test.prototype, "clear", void 0);
|
|
196
|
-
__decorate([
|
|
197
|
-
flags.boolean({
|
|
198
|
-
description: 'Start assets bundler dev server.',
|
|
199
|
-
showNegatedVariantInHelp: true,
|
|
200
|
-
default: true,
|
|
201
|
-
})
|
|
202
|
-
], Test.prototype, "assets", void 0);
|
|
203
|
-
__decorate([
|
|
204
|
-
flags.array({
|
|
205
|
-
description: 'Define CLI arguments to pass to the assets bundler',
|
|
206
|
-
})
|
|
207
|
-
], Test.prototype, "assetsArgs", void 0);
|
|
@@ -1,10 +1,37 @@
|
|
|
1
|
-
import { Ignitor } from '../../src/ignitor/main.
|
|
2
|
-
import type { IgnitorOptions } from '../../src/types.
|
|
3
|
-
import type { Kernel } from '../../modules/ace/kernel.
|
|
1
|
+
import { Ignitor } from '../../src/ignitor/main.ts';
|
|
2
|
+
import type { IgnitorOptions } from '../../src/types.ts';
|
|
3
|
+
import type { Kernel } from '../../modules/ace/kernel.ts';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Factory for creating and configuring Ace command kernel instances.
|
|
6
|
+
* This factory provides a convenient way to create Ace kernels either from
|
|
7
|
+
* an existing Ignitor instance or by creating a new one from scratch.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* // Create from URL
|
|
12
|
+
* const aceFactory = new AceFactory()
|
|
13
|
+
* const kernel = await aceFactory.make(new URL('../', import.meta.url))
|
|
14
|
+
*
|
|
15
|
+
* // Create from existing ignitor
|
|
16
|
+
* const ignitor = new Ignitor(appRoot)
|
|
17
|
+
* const kernel = await aceFactory.make(ignitor)
|
|
18
|
+
*
|
|
19
|
+
* // Run commands
|
|
20
|
+
* await kernel.handle(['make:controller', 'UserController'])
|
|
21
|
+
* ```
|
|
6
22
|
*/
|
|
7
23
|
export declare class AceFactory {
|
|
24
|
+
/**
|
|
25
|
+
* Create an Ace kernel from an existing Ignitor instance
|
|
26
|
+
*
|
|
27
|
+
* @param ignitor - Existing Ignitor instance
|
|
28
|
+
*/
|
|
8
29
|
make(ignitor: Ignitor): Promise<Kernel>;
|
|
30
|
+
/**
|
|
31
|
+
* Create an Ace kernel from application root URL
|
|
32
|
+
*
|
|
33
|
+
* @param appRoot - Application root directory URL
|
|
34
|
+
* @param options - Optional Ignitor configuration options
|
|
35
|
+
*/
|
|
9
36
|
make(appRoot: URL, options?: IgnitorOptions): Promise<Kernel>;
|
|
10
37
|
}
|
|
@@ -6,11 +6,27 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import { IgnitorFactory } from
|
|
10
|
-
import { Ignitor } from
|
|
11
|
-
import { createAceKernel } from
|
|
9
|
+
import { IgnitorFactory } from "./ignitor.js";
|
|
10
|
+
import { Ignitor } from "../../src/ignitor/main.js";
|
|
11
|
+
import { createAceKernel } from "../../modules/ace/create_kernel.js";
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Factory for creating and configuring Ace command kernel instances.
|
|
14
|
+
* This factory provides a convenient way to create Ace kernels either from
|
|
15
|
+
* an existing Ignitor instance or by creating a new one from scratch.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* // Create from URL
|
|
20
|
+
* const aceFactory = new AceFactory()
|
|
21
|
+
* const kernel = await aceFactory.make(new URL('../', import.meta.url))
|
|
22
|
+
*
|
|
23
|
+
* // Create from existing ignitor
|
|
24
|
+
* const ignitor = new Ignitor(appRoot)
|
|
25
|
+
* const kernel = await aceFactory.make(ignitor)
|
|
26
|
+
*
|
|
27
|
+
* // Run commands
|
|
28
|
+
* await kernel.handle(['make:controller', 'UserController'])
|
|
29
|
+
* ```
|
|
14
30
|
*/
|
|
15
31
|
export class AceFactory {
|
|
16
32
|
async make(ignitorOrAppRoot, options) {
|
|
@@ -1,33 +1,104 @@
|
|
|
1
|
-
import { Ignitor } from '../../src/ignitor/main.
|
|
2
|
-
import type { ApplicationService, IgnitorOptions } from '../../src/types.
|
|
1
|
+
import { Ignitor } from '../../src/ignitor/main.ts';
|
|
2
|
+
import type { ApplicationService, IgnitorOptions } from '../../src/types.ts';
|
|
3
3
|
type FactoryParameters = {
|
|
4
4
|
rcFileContents: Record<string, any>;
|
|
5
5
|
config: Record<string, any>;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Factory for creating and configuring AdonisJS Ignitor instances.
|
|
9
|
+
* This factory provides a fluent API to set up applications with core providers,
|
|
10
|
+
* configurations, and preload actions for testing and development scenarios.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const ignitor = new IgnitorFactory()
|
|
15
|
+
* .withCoreProviders()
|
|
16
|
+
* .withCoreConfig()
|
|
17
|
+
* .preload((app) => {
|
|
18
|
+
* // Custom initialization logic
|
|
19
|
+
* })
|
|
20
|
+
* .create(new URL('../', import.meta.url))
|
|
21
|
+
*
|
|
22
|
+
* const app = ignitor.createApp('web')
|
|
23
|
+
* await app.boot()
|
|
24
|
+
* ```
|
|
9
25
|
*/
|
|
10
26
|
export declare class IgnitorFactory {
|
|
11
27
|
#private;
|
|
12
28
|
/**
|
|
13
|
-
* Define preload actions to run.
|
|
29
|
+
* Define preload actions to run during application initialization.
|
|
30
|
+
* These actions are executed after the application is booted.
|
|
31
|
+
*
|
|
32
|
+
* @param action - Function to execute during preload phase
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* factory.preload((app) => {
|
|
37
|
+
* // Register custom bindings
|
|
38
|
+
* app.container.bind('customService', () => new CustomService())
|
|
39
|
+
* })
|
|
40
|
+
* ```
|
|
14
41
|
*/
|
|
15
42
|
preload(action: (app: ApplicationService) => void | Promise<void>): this;
|
|
16
43
|
/**
|
|
17
|
-
* Merge custom factory parameters
|
|
44
|
+
* Merge custom factory parameters with existing ones.
|
|
45
|
+
* This allows you to customize RC file contents and application configuration.
|
|
46
|
+
*
|
|
47
|
+
* @param params - Parameters to merge
|
|
48
|
+
* @param params.config - Application configuration to merge
|
|
49
|
+
* @param params.rcFileContents - RC file contents to merge
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* factory.merge({
|
|
54
|
+
* config: {
|
|
55
|
+
* database: { connection: 'mysql' }
|
|
56
|
+
* },
|
|
57
|
+
* rcFileContents: {
|
|
58
|
+
* commands: ['./commands/CustomCommand']
|
|
59
|
+
* }
|
|
60
|
+
* })
|
|
61
|
+
* ```
|
|
18
62
|
*/
|
|
19
63
|
merge(params: Partial<FactoryParameters>): this;
|
|
20
64
|
/**
|
|
21
|
-
*
|
|
65
|
+
* Include core AdonisJS providers when booting the application.
|
|
66
|
+
* This adds essential providers like app, hash, and REPL providers.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const ignitor = new IgnitorFactory()
|
|
71
|
+
* .withCoreProviders()
|
|
72
|
+
* .create(appRoot)
|
|
73
|
+
* ```
|
|
22
74
|
*/
|
|
23
75
|
withCoreProviders(): this;
|
|
24
76
|
/**
|
|
25
|
-
* Merge default
|
|
26
|
-
*
|
|
77
|
+
* Merge default configuration for core AdonisJS features.
|
|
78
|
+
* This includes configurations for HTTP, hash, logger, and bodyparser.
|
|
79
|
+
* A shallow merge is performed with existing config.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* const ignitor = new IgnitorFactory()
|
|
84
|
+
* .withCoreConfig()
|
|
85
|
+
* .create(appRoot)
|
|
86
|
+
* ```
|
|
27
87
|
*/
|
|
28
88
|
withCoreConfig(): this;
|
|
29
89
|
/**
|
|
30
|
-
* Create
|
|
90
|
+
* Create a configured Ignitor instance with all specified parameters.
|
|
91
|
+
*
|
|
92
|
+
* @param appRoot - Application root directory URL
|
|
93
|
+
* @param options - Optional Ignitor configuration options
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* const ignitor = new IgnitorFactory()
|
|
98
|
+
* .withCoreConfig()
|
|
99
|
+
* .withCoreProviders()
|
|
100
|
+
* .create(new URL('../', import.meta.url))
|
|
101
|
+
* ```
|
|
31
102
|
*/
|
|
32
103
|
create(appRoot: URL, options?: IgnitorOptions): Ignitor;
|
|
33
104
|
}
|