@ts-ioc-container/bundler 1.5.0 → 2.1.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/AGENTS.md +47 -31
- package/README.md +157 -280
- package/cjm/app.js +39 -0
- package/cjm/bin.js +2 -2
- package/cjm/cli/Application.js +58 -0
- package/cjm/cli/IErrorHandler.js +5 -0
- package/cjm/cli/decorators.js +9 -0
- package/cjm/cli/index.js +17 -0
- package/cjm/cli/options.js +25 -0
- package/cjm/cli/usage.js +19 -0
- package/cjm/domain/CliIo.js +7 -0
- package/cjm/domain/GlobalConfig.js +7 -0
- package/cjm/exceptions/DomainException.js +54 -0
- package/cjm/exceptions/ExceptionHandler.js +38 -0
- package/cjm/features/build/BuildConfig.js +183 -0
- package/cjm/features/build/BuildController.js +91 -0
- package/cjm/features/build/BuildModule.js +16 -0
- package/cjm/{ImportPaths.js → features/build/domain/ImportPaths.js} +7 -29
- package/cjm/features/build/domain/configFiles.js +35 -0
- package/cjm/{emit.js → features/build/domain/emit.js} +10 -9
- package/cjm/{scan.js → features/build/domain/scan.js} +6 -3
- package/cjm/features/build/domain/tokenCollisions.js +29 -0
- package/cjm/features/build/domain/tsconfig.js +78 -0
- package/cjm/features/build/services/BundleBuilder.js +116 -0
- package/cjm/features/build/services/TicConfigService.js +68 -0
- package/cjm/features/help/HelpController.js +39 -0
- package/cjm/features/help/HelpModule.js +12 -0
- package/cjm/features/help/VersionController.js +45 -0
- package/cjm/index.js +87 -28
- package/cjm/modules/CommonModule.js +28 -0
- package/cjm/schema/ticConfigSchema.js +24 -0
- package/cjm/services/ConsoleLogger.js +36 -0
- package/cjm/services/HandlebarsRenderService.js +33 -0
- package/cjm/services/NodeFileSystemService.js +32 -0
- package/cjm/services/OutputService.js +33 -0
- package/package.json +10 -7
- package/tic.schema.json +118 -147
- package/tpl/index.cjs +36 -16
- package/typings/app.d.ts +24 -0
- package/typings/cli/Application.d.ts +16 -0
- package/typings/cli/Application.d.ts.map +1 -0
- package/typings/cli/IErrorHandler.d.ts +7 -0
- package/typings/cli/IErrorHandler.d.ts.map +1 -0
- package/typings/cli/decorators.d.ts +10 -0
- package/typings/cli/decorators.d.ts.map +1 -0
- package/typings/cli/index.d.ts +6 -0
- package/typings/cli/index.d.ts.map +1 -0
- package/typings/cli/options.d.ts +23 -0
- package/typings/cli/options.d.ts.map +1 -0
- package/typings/cli/usage.d.ts +2 -0
- package/typings/cli/usage.d.ts.map +1 -0
- package/typings/domain/CliIo.d.ts +10 -0
- package/typings/domain/CliIo.d.ts.map +1 -0
- package/typings/domain/GlobalConfig.d.ts +10 -0
- package/typings/domain/GlobalConfig.d.ts.map +1 -0
- package/typings/exceptions/DomainException.d.ts +37 -0
- package/typings/exceptions/DomainException.d.ts.map +1 -0
- package/typings/exceptions/ExceptionHandler.d.ts +12 -0
- package/typings/exceptions/ExceptionHandler.d.ts.map +1 -0
- package/typings/features/build/BuildConfig.d.ts +179 -0
- package/typings/features/build/BuildConfig.d.ts.map +1 -0
- package/typings/features/build/BuildController.d.ts +32 -0
- package/typings/features/build/BuildController.d.ts.map +1 -0
- package/typings/features/build/BuildModule.d.ts +5 -0
- package/typings/features/build/BuildModule.d.ts.map +1 -0
- package/typings/{ImportPaths.d.ts → features/build/domain/ImportPaths.d.ts} +4 -16
- package/typings/features/build/domain/ImportPaths.d.ts.map +1 -0
- package/typings/features/build/domain/configFiles.d.ts +13 -0
- package/typings/features/build/domain/configFiles.d.ts.map +1 -0
- package/typings/features/build/domain/emit.d.ts +42 -0
- package/typings/features/build/domain/emit.d.ts.map +1 -0
- package/typings/features/build/domain/glob.d.ts.map +1 -0
- package/typings/{scan.d.ts → features/build/domain/scan.d.ts} +4 -2
- package/typings/features/build/domain/scan.d.ts.map +1 -0
- package/typings/features/build/domain/tokenCollisions.d.ts +14 -0
- package/typings/features/build/domain/tokenCollisions.d.ts.map +1 -0
- package/typings/features/build/domain/tsconfig.d.ts +25 -0
- package/typings/features/build/domain/tsconfig.d.ts.map +1 -0
- package/typings/features/build/services/BundleBuilder.d.ts +68 -0
- package/typings/features/build/services/BundleBuilder.d.ts.map +1 -0
- package/typings/features/build/services/TicConfigService.d.ts +37 -0
- package/typings/features/build/services/TicConfigService.d.ts.map +1 -0
- package/typings/features/help/HelpController.d.ts +8 -0
- package/typings/features/help/HelpController.d.ts.map +1 -0
- package/typings/features/help/HelpModule.d.ts +5 -0
- package/typings/features/help/HelpModule.d.ts.map +1 -0
- package/typings/features/help/VersionController.d.ts +8 -0
- package/typings/features/help/VersionController.d.ts.map +1 -0
- package/typings/index.d.ts +25 -11
- package/typings/modules/CommonModule.d.ts +9 -0
- package/typings/modules/CommonModule.d.ts.map +1 -0
- package/typings/schema/ticConfigSchema.d.ts +7 -0
- package/typings/schema/ticConfigSchema.d.ts.map +1 -0
- package/typings/services/ConsoleLogger.d.ts +20 -0
- package/typings/services/ConsoleLogger.d.ts.map +1 -0
- package/typings/services/HandlebarsRenderService.d.ts +23 -0
- package/typings/services/HandlebarsRenderService.d.ts.map +1 -0
- package/typings/services/NodeFileSystemService.d.ts +21 -0
- package/typings/services/NodeFileSystemService.d.ts.map +1 -0
- package/typings/services/OutputService.d.ts +13 -0
- package/typings/services/OutputService.d.ts.map +1 -0
- package/cjm/build.js +0 -132
- package/cjm/cli.js +0 -84
- package/cjm/config.js +0 -162
- package/cjm/errors.js +0 -15
- package/cjm/exportPredicate.js +0 -13
- package/cjm/inclusion.js +0 -24
- package/cjm/predicateFile.js +0 -30
- package/cjm/render.js +0 -15
- package/cjm/utils.js +0 -2
- package/typings/build.d.ts +0 -45
- package/typings/cli.d.ts +0 -8
- package/typings/config.d.ts +0 -123
- package/typings/emit.d.ts +0 -18
- package/typings/errors.d.ts +0 -13
- package/typings/exportPredicate.d.ts +0 -36
- package/typings/inclusion.d.ts +0 -42
- package/typings/predicateFile.d.ts +0 -16
- package/typings/render.d.ts +0 -8
- package/typings/utils.d.ts +0 -3
- /package/cjm/{glob.js → features/build/domain/glob.js} +0 -0
- /package/typings/{glob.d.ts → features/build/domain/glob.d.ts} +0 -0
package/tpl/index.cjs
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
var Handlebars = require("handlebars"); var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
|
2
2
|
templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,partials,data) {
|
|
3
|
-
|
|
3
|
+
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
5
|
+
return parent[propertyName];
|
|
6
|
+
}
|
|
7
|
+
return undefined
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
return "// Paths: "
|
|
11
|
+
+ ((stack1 = (lookupProperty(helpers,"join")||(depth0 && lookupProperty(depth0,"join"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"paths") : depth0),", ",{"name":"join","hash":{},"data":data,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":44}}})) != null ? stack1 : "");
|
|
4
12
|
},"1":function(container,depth0,helpers,partials,data) {
|
|
13
|
+
var stack1, helper, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
14
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
15
|
+
return parent[propertyName];
|
|
16
|
+
}
|
|
17
|
+
return undefined
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return "// Files: as compiled by "
|
|
21
|
+
+ ((stack1 = ((helper = (helper = lookupProperty(helpers,"tsconfigPath") || (depth0 != null ? lookupProperty(depth0,"tsconfigPath") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"tsconfigPath","hash":{},"data":data,"loc":{"start":{"line":2,"column":77},"end":{"line":2,"column":95}}}) : helper))) != null ? stack1 : "");
|
|
22
|
+
},"2":function(container,depth0,helpers,partials,data) {
|
|
23
|
+
return ", Registration";
|
|
24
|
+
},"3":function(container,depth0,helpers,partials,data) {
|
|
5
25
|
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
6
26
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
7
27
|
return parent[propertyName];
|
|
@@ -10,12 +30,12 @@ templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,par
|
|
|
10
30
|
};
|
|
11
31
|
|
|
12
32
|
return "import "
|
|
13
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"defaultName") : depth0),{"name":"if","hash":{},"fn":container.program(
|
|
14
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"named") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(
|
|
33
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"defaultName") : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":79}}})) != null ? stack1 : "")
|
|
34
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"named") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":5,"column":79},"end":{"line":5,"column":131}}})) != null ? stack1 : "")
|
|
15
35
|
+ " from '"
|
|
16
36
|
+ ((stack1 = ((helper = (helper = lookupProperty(helpers,"specifier") || (depth0 != null ? lookupProperty(depth0,"specifier") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"specifier","hash":{},"data":data,"loc":{"start":{"line":5,"column":138},"end":{"line":5,"column":153}}}) : helper))) != null ? stack1 : "")
|
|
17
37
|
+ "';\n";
|
|
18
|
-
},"
|
|
38
|
+
},"4":function(container,depth0,helpers,partials,data) {
|
|
19
39
|
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
20
40
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
21
41
|
return parent[propertyName];
|
|
@@ -24,10 +44,10 @@ templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,par
|
|
|
24
44
|
};
|
|
25
45
|
|
|
26
46
|
return ((stack1 = ((helper = (helper = lookupProperty(helpers,"defaultName") || (depth0 != null ? lookupProperty(depth0,"defaultName") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"defaultName","hash":{},"data":data,"loc":{"start":{"line":5,"column":26},"end":{"line":5,"column":43}}}) : helper))) != null ? stack1 : "")
|
|
27
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"named") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(
|
|
28
|
-
},"
|
|
47
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"named") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":5,"column":43},"end":{"line":5,"column":72}}})) != null ? stack1 : "");
|
|
48
|
+
},"5":function(container,depth0,helpers,partials,data) {
|
|
29
49
|
return ", ";
|
|
30
|
-
},"
|
|
50
|
+
},"6":function(container,depth0,helpers,partials,data) {
|
|
31
51
|
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
32
52
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
33
53
|
return parent[propertyName];
|
|
@@ -38,7 +58,7 @@ templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,par
|
|
|
38
58
|
return "{ "
|
|
39
59
|
+ ((stack1 = (lookupProperty(helpers,"join")||(depth0 && lookupProperty(depth0,"join"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"named") : depth0),", ",{"name":"join","hash":{},"data":data,"loc":{"start":{"line":5,"column":101},"end":{"line":5,"column":122}}})) != null ? stack1 : "")
|
|
40
60
|
+ " }";
|
|
41
|
-
},"
|
|
61
|
+
},"7":function(container,depth0,helpers,partials,data) {
|
|
42
62
|
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
43
63
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
44
64
|
return parent[propertyName];
|
|
@@ -47,15 +67,15 @@ templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,par
|
|
|
47
67
|
};
|
|
48
68
|
|
|
49
69
|
return "export const registrations: IRegistration[] = [\n"
|
|
50
|
-
+ ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"registrations") : depth0),{"name":"each","hash":{},"fn":container.program(
|
|
70
|
+
+ ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"registrations") : depth0),{"name":"each","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":10,"column":0},"end":{"line":12,"column":9}}})) != null ? stack1 : "")
|
|
51
71
|
+ "];\n";
|
|
52
|
-
},"
|
|
72
|
+
},"8":function(container,depth0,helpers,partials,data) {
|
|
53
73
|
var stack1;
|
|
54
74
|
|
|
55
75
|
return " Registration.fromClass("
|
|
56
76
|
+ ((stack1 = container.lambda(depth0, depth0)) != null ? stack1 : "")
|
|
57
77
|
+ "),\n";
|
|
58
|
-
},"
|
|
78
|
+
},"9":function(container,depth0,helpers,partials,data) {
|
|
59
79
|
return "export const registrations: IRegistration[] = [];\n";
|
|
60
80
|
},"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
|
61
81
|
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
@@ -67,14 +87,14 @@ templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,par
|
|
|
67
87
|
|
|
68
88
|
return "// Generated by `tic build` from "
|
|
69
89
|
+ ((stack1 = ((helper = (helper = lookupProperty(helpers,"configPath") || (depth0 != null ? lookupProperty(depth0,"configPath") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"configPath","hash":{},"data":data,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":49}}}) : helper))) != null ? stack1 : "")
|
|
70
|
-
+ ". Do not edit by hand.\n
|
|
71
|
-
+ ((stack1 =
|
|
90
|
+
+ ". Do not edit by hand.\n"
|
|
91
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"paths") : depth0),{"name":"if","hash":{},"fn":container.program(0, data, 0),"inverse":container.program(1, data, 0),"data":data,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":102}}})) != null ? stack1 : "")
|
|
72
92
|
+ "\nimport { type IContainer, type IContainerModule, type IRegistration"
|
|
73
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"registrations") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(
|
|
93
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"registrations") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":67},"end":{"line":3,"column":116}}})) != null ? stack1 : "")
|
|
74
94
|
+ " } from 'ts-ioc-container';\n"
|
|
75
|
-
+ ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"imports") : depth0),{"name":"each","hash":{},"fn":container.program(
|
|
95
|
+
+ ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"imports") : depth0),{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":4,"column":0},"end":{"line":6,"column":9}}})) != null ? stack1 : "")
|
|
76
96
|
+ "\n"
|
|
77
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"registrations") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(
|
|
97
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"registrations") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.program(9, data, 0),"data":data,"loc":{"start":{"line":8,"column":0},"end":{"line":16,"column":7}}})) != null ? stack1 : "")
|
|
78
98
|
+ "\nexport class "
|
|
79
99
|
+ ((stack1 = ((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":18,"column":13},"end":{"line":18,"column":23}}}) : helper))) != null ? stack1 : "")
|
|
80
100
|
+ " implements IContainerModule {\n applyTo(container: IContainer): void {\n for (const registration of registrations) container.addRegistration(registration);\n }\n}\n";
|
package/typings/app.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { type IContainer } from 'ts-ioc-container';
|
|
3
|
+
import { type CliIo } from './domain/CliIo.js';
|
|
4
|
+
import { type ResolvedConfig } from './features/build/BuildConfig.js';
|
|
5
|
+
import { type BuildOptions, type BuildResult } from './features/build/services/BundleBuilder.js';
|
|
6
|
+
/** The composition root: one container per run, holding every module of the CLI. */
|
|
7
|
+
export declare function createContainer(io?: CliIo): IContainer;
|
|
8
|
+
/** Runs the `tic` CLI and returns its exit code; output goes through `io`. */
|
|
9
|
+
export declare function run(argv: string[], io?: CliIo): number;
|
|
10
|
+
/**
|
|
11
|
+
* Generates the bundle a config describes — one `tic build` step as a function. Nothing is
|
|
12
|
+
* written unless generation succeeds.
|
|
13
|
+
*
|
|
14
|
+
* @throws {TicConfigError} when the config or its tsconfig is missing or invalid, or the config has neither `files.paths` nor a tsconfig.
|
|
15
|
+
* @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
|
|
16
|
+
*/
|
|
17
|
+
export declare function build({ cwd, ...request }?: BuildOptions): BuildResult;
|
|
18
|
+
/**
|
|
19
|
+
* Reads and validates a `*.bundle.json`, `*.bundle.yaml` or `*.bundle.yml`.
|
|
20
|
+
*
|
|
21
|
+
* @throws {TicConfigError} when the file is missing, cannot be parsed, or does not match the config shape.
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadConfig(file: string): ResolvedConfig;
|
|
24
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type IContainer } from 'ts-ioc-container';
|
|
2
|
+
/**
|
|
3
|
+
* Runs one command line against a container: resolves the controller registered
|
|
4
|
+
* under the command's name, runs the hooks it declares under the action, and routes
|
|
5
|
+
* failures to the bound {@link IErrorHandler}. Each action method reads its own
|
|
6
|
+
* options from the raw command line, which reaches it as the hook's runtime args.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Application {
|
|
9
|
+
private readonly scope;
|
|
10
|
+
private readonly errorHandler;
|
|
11
|
+
static bootstrap(container: IContainer): Application;
|
|
12
|
+
private constructor();
|
|
13
|
+
/** Runs `argv` and returns the exit code; the container is disposed afterwards. */
|
|
14
|
+
run(...argv: string[]): number;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=Application.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../lib/cli/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,UAAU,EAAU,MAAM,kBAAkB,CAAC;AA6BpG;;;;;GAKG;AACH,qBAAa,WAAW;IAMpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAN/B,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,UAAU,GAAG,WAAW;IAIpD,OAAO;IAKP,mFAAmF;IACnF,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM;CAmB/B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SingleToken } from 'ts-ioc-container';
|
|
2
|
+
export interface IErrorHandler {
|
|
3
|
+
/** Reports `error` and returns the exit code the CLI ends with. */
|
|
4
|
+
handleError(error: unknown): number;
|
|
5
|
+
}
|
|
6
|
+
export declare const IErrorHandlerKey: SingleToken<IErrorHandler>;
|
|
7
|
+
//# sourceMappingURL=IErrorHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IErrorHandler.d.ts","sourceRoot":"","sources":["../../lib/cli/IErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;CACrC;AAED,eAAO,MAAM,gBAAgB,4BAAkD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type HookType } from 'ts-ioc-container';
|
|
2
|
+
export declare const DEFAULT_ACTION = "default";
|
|
3
|
+
/**
|
|
4
|
+
* Registers a method as a named CLI action: `@action('check', invoke)` makes
|
|
5
|
+
* `tic <command> check` run it. Several hooks run in declaration order.
|
|
6
|
+
*/
|
|
7
|
+
export declare const action: (name: string, ...hooks: HookType[]) => (target: object, propertyKey: string | symbol) => void;
|
|
8
|
+
/** Runs when the command is invoked without an action name. */
|
|
9
|
+
export declare const onDefault: (...hooks: HookType[]) => (target: object, propertyKey: string | symbol) => void;
|
|
10
|
+
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../lib/cli/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,QAAQ,EAAc,MAAM,kBAAkB,CAAC;AAEnE,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,EAAE,GAAG,OAAO,QAAQ,EAAE,2DAAqC,CAAC;AAE/F,+DAA+D;AAC/D,eAAO,MAAM,SAAS,GAAI,GAAG,OAAO,QAAQ,EAAE,2DAAqC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { action, DEFAULT_ACTION, onDefault } from './decorators.js';
|
|
2
|
+
export { commandArgs, parseOptions, validate } from './options.js';
|
|
3
|
+
export { Application } from './Application.js';
|
|
4
|
+
export { type IErrorHandler, IErrorHandlerKey } from './IErrorHandler.js';
|
|
5
|
+
export { USAGE } from './usage.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ParseArgsConfig } from 'node:util';
|
|
2
|
+
import { type InjectOptions } from 'ts-ioc-container';
|
|
3
|
+
import { z, type ZodType } from 'zod';
|
|
4
|
+
type OptionsConfig = NonNullable<ParseArgsConfig['options']>;
|
|
5
|
+
/** The raw command line a CLI action was invoked with, handed to it as its runtime args. */
|
|
6
|
+
export declare const commandArgs: ({ args }: InjectOptions) => string[];
|
|
7
|
+
/**
|
|
8
|
+
* Mapper that parses the raw command line against an action's options. Everything
|
|
9
|
+
* from the first flag onwards belongs to the action — what precedes it is the
|
|
10
|
+
* command and the action name.
|
|
11
|
+
*
|
|
12
|
+
* @throws {UsageError} when a flag is unknown or a flag that takes a value has none.
|
|
13
|
+
*/
|
|
14
|
+
export declare const parseOptions: (options: OptionsConfig) => (argv: string[]) => Record<string, unknown>;
|
|
15
|
+
/**
|
|
16
|
+
* Mapper that validates a loosely-typed value — parsed options in practice —
|
|
17
|
+
* against a schema and narrows it to the schema's output type.
|
|
18
|
+
*
|
|
19
|
+
* @throws {UsageError} when the value does not match the schema.
|
|
20
|
+
*/
|
|
21
|
+
export declare const validate: <T extends ZodType>(schema: T) => (value: unknown) => z.output<T>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../lib/cli/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,KAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AAGtC,KAAK,aAAa,GAAG,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;AAE7D,4FAA4F;AAC5F,eAAO,MAAM,WAAW,GAAI,UAAe,aAAa,KAAG,MAAM,EAAsB,CAAC;AAExF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GACtB,SAAS,aAAa,MACtB,MAAM,MAAM,EAAE,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAOvC,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAClB,CAAC,SAAS,OAAO,EAAE,QAAQ,CAAC,MAC5B,OAAO,OAAO,KAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAI3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../lib/cli/usage.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,QAeN,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SingleToken } from 'ts-ioc-container';
|
|
2
|
+
/** Where the CLI runs and writes: `run(argv, io)` takes one, so tests can capture output. */
|
|
3
|
+
export interface CliIo {
|
|
4
|
+
cwd: string;
|
|
5
|
+
stdout: (line: string) => void;
|
|
6
|
+
stderr: (line: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const CliIoKey: SingleToken<CliIo>;
|
|
9
|
+
export declare const processIo: () => CliIo;
|
|
10
|
+
//# sourceMappingURL=CliIo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CliIo.d.ts","sourceRoot":"","sources":["../../lib/domain/CliIo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,6FAA6F;AAC7F,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,QAAQ,oBAAkC,CAAC;AAExD,eAAO,MAAM,SAAS,QAAO,KAA6E,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type InjectFn, SingleToken } from 'ts-ioc-container';
|
|
2
|
+
/** Settings every service shares for one run: the process-level context the CLI was started in. */
|
|
3
|
+
export type GlobalConfig = {
|
|
4
|
+
/** Directory relative paths (`--config`, `build({ config })`) resolve against. */
|
|
5
|
+
cwd: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const GlobalConfigKey: SingleToken<GlobalConfig>;
|
|
8
|
+
/** Injects one field of the {@link GlobalConfig}: `@inject(globalConfig('cwd'))`. */
|
|
9
|
+
export declare const globalConfig: <K extends keyof GlobalConfig>(key: K) => InjectFn<GlobalConfig[K]>;
|
|
10
|
+
//# sourceMappingURL=GlobalConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlobalConfig.d.ts","sourceRoot":"","sources":["../../lib/domain/GlobalConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE9D,mGAAmG;AACnG,MAAM,MAAM,YAAY,GAAG;IACzB,kFAAkF;IAClF,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,eAAe,2BAAgD,CAAC;AAE7E,qFAAqF;AACrF,eAAO,MAAM,YAAY,GACtB,CAAC,SAAS,MAAM,YAAY,EAAE,KAAK,CAAC,KAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAE3B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class of every error the bundler raises on purpose. `code` is a stable,
|
|
3
|
+
* machine-readable identifier; the CLI prints the message without a stack.
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class TicError extends Error {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
protected constructor(code: string, message: string);
|
|
8
|
+
}
|
|
9
|
+
/** The config file is missing, is not JSON, or does not match the `tic.config.json` shape. */
|
|
10
|
+
export declare class TicConfigError extends TicError {
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
/** A namespace is neither an existing folder nor a `tsconfig.json` `paths` alias of one. */
|
|
14
|
+
export declare class NamespaceNotFoundError extends TicError {
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
17
|
+
/** The command line names no command. */
|
|
18
|
+
export declare class MissingCommandError extends TicError {
|
|
19
|
+
constructor(usage: string);
|
|
20
|
+
}
|
|
21
|
+
/** The command line names a command no controller is registered for. */
|
|
22
|
+
export declare class UnknownCommandError extends TicError {
|
|
23
|
+
constructor(command: string);
|
|
24
|
+
}
|
|
25
|
+
/** The command line names an action the command's controller does not declare. */
|
|
26
|
+
export declare class UnknownActionError extends TicError {
|
|
27
|
+
constructor(command: string, action: string);
|
|
28
|
+
}
|
|
29
|
+
/** A command's options are malformed: an unknown flag, or a flag missing its value. */
|
|
30
|
+
export declare class UsageError extends TicError {
|
|
31
|
+
constructor(message: string);
|
|
32
|
+
}
|
|
33
|
+
/** `tic build --check` found generated bundles that differ from what a build would write. */
|
|
34
|
+
export declare class StaleBundlesError extends TicError {
|
|
35
|
+
constructor(count: number);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=DomainException.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomainException.d.ts","sourceRoot":"","sources":["../../lib/exceptions/DomainException.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,8BAAsB,QAAS,SAAQ,KAAK;IAExC,QAAQ,CAAC,IAAI,EAAE,MAAM;IADvB,SAAS,aACE,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM;CAKlB;AAED,8FAA8F;AAC9F,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,OAAO,EAAE,MAAM;CAG5B;AAED,4FAA4F;AAC5F,qBAAa,sBAAuB,SAAQ,QAAQ;gBACtC,OAAO,EAAE,MAAM;CAG5B;AAED,yCAAyC;AACzC,qBAAa,mBAAoB,SAAQ,QAAQ;gBACnC,KAAK,EAAE,MAAM;CAG1B;AAED,wEAAwE;AACxE,qBAAa,mBAAoB,SAAQ,QAAQ;gBACnC,OAAO,EAAE,MAAM;CAG5B;AAED,kFAAkF;AAClF,qBAAa,kBAAmB,SAAQ,QAAQ;gBAClC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAG5C;AAED,uFAAuF;AACvF,qBAAa,UAAW,SAAQ,QAAQ;gBAC1B,OAAO,EAAE,MAAM;CAG5B;AAED,6FAA6F;AAC7F,qBAAa,iBAAkB,SAAQ,QAAQ;gBACjC,KAAK,EAAE,MAAM;CAG1B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type IErrorHandler } from '../cli/IErrorHandler.js';
|
|
2
|
+
import { type ILogger } from '../services/ConsoleLogger.js';
|
|
3
|
+
/**
|
|
4
|
+
* Turns a failed command into exit code 1. A {@link TicError} is an expected failure
|
|
5
|
+
* and is reported by its message alone; anything else is a bug, reported with its stack.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExceptionHandler implements IErrorHandler {
|
|
8
|
+
private readonly logger;
|
|
9
|
+
constructor(logger: ILogger);
|
|
10
|
+
handleError(error: unknown): number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ExceptionHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExceptionHandler.d.ts","sourceRoot":"","sources":["../../lib/exceptions/ExceptionHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,2BAA2B,CAAC;AAGrE;;;GAGG;AACH,qBACa,gBAAiB,YAAW,aAAa;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,OAAO;IAEpE,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;CAKpC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Which files a bundle reads and parses: the first, cheap stage of selection,
|
|
4
|
+
* decided by path alone. The candidates are what the extended tsconfig compiles,
|
|
5
|
+
* or the folders in `paths` when given — they override the tsconfig's file set,
|
|
6
|
+
* as a child tsconfig's `include` overrides its parent's. A candidate is parsed
|
|
7
|
+
* when it matches one of `include` and none of `exclude`. Globs are relative to
|
|
8
|
+
* the config file and `/`-separated. With a file naming convention
|
|
9
|
+
* (`*.service.ts`), `include` keeps the bundler from reading anything else.
|
|
10
|
+
*/
|
|
11
|
+
export interface FileSelector {
|
|
12
|
+
/**
|
|
13
|
+
* Folders to scan instead of the tsconfig's file set: relative to the config file,
|
|
14
|
+
* or tsconfig `paths` aliases. Required when there is no tsconfig to extend.
|
|
15
|
+
*/
|
|
16
|
+
paths?: (string | PathConfig)[];
|
|
17
|
+
/** Globs a file must match one of, e.g. `**\/*.service.ts`. Default: every source file. */
|
|
18
|
+
include?: string[];
|
|
19
|
+
/** Globs of files never read. Replaces {@link DEFAULT_EXCLUDE} when given. */
|
|
20
|
+
exclude?: string[];
|
|
21
|
+
}
|
|
22
|
+
/** A {@link FileSelector} with its defaults filled in and its globs compiled. */
|
|
23
|
+
export interface ResolvedFileSelector {
|
|
24
|
+
/** `undefined`: the extended tsconfig's file set. */
|
|
25
|
+
paths?: Required<PathConfig>[];
|
|
26
|
+
include?: RegExp[];
|
|
27
|
+
exclude: RegExp[];
|
|
28
|
+
}
|
|
29
|
+
/** Which exports of a file count: both kinds, only named exports, or only the default export. */
|
|
30
|
+
export type ExportKind = 'any' | 'named' | 'default';
|
|
31
|
+
/**
|
|
32
|
+
* Which classes of a parsed file are registered: the second stage of selection,
|
|
33
|
+
* run on the files {@link FileSelector} let through. A class is selected when
|
|
34
|
+
* it is exported, not abstract, and meets every criterion set here; an empty
|
|
35
|
+
* rule selects every exported class.
|
|
36
|
+
*/
|
|
37
|
+
export interface ClassSelector {
|
|
38
|
+
/** Default `any`. */
|
|
39
|
+
export?: ExportKind;
|
|
40
|
+
/**
|
|
41
|
+
* The class must carry one of these decorators, recognised by name (`register`, or a
|
|
42
|
+
* composed one). Default {@link DEFAULT_DECORATORS}; `[]` requires none.
|
|
43
|
+
*/
|
|
44
|
+
decorators?: string[];
|
|
45
|
+
/** A glob the class name must match, e.g. `*Service`. An anonymous default export is named after its file. */
|
|
46
|
+
name?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Class names to drop after selection, e.g. one test double sitting next to the
|
|
49
|
+
* real registration in the same file.
|
|
50
|
+
*/
|
|
51
|
+
excludeClasses?: string[];
|
|
52
|
+
/** A glob the class name must NOT match, e.g. `*Mock`. An anonymous default export is named after its file. */
|
|
53
|
+
excludeName?: string;
|
|
54
|
+
}
|
|
55
|
+
/** A {@link ClassSelector} with its defaults filled in and its globs compiled. */
|
|
56
|
+
export interface ResolvedClassSelector {
|
|
57
|
+
export: ExportKind;
|
|
58
|
+
decorators?: string[];
|
|
59
|
+
name?: RegExp;
|
|
60
|
+
excludeClasses?: string[];
|
|
61
|
+
excludeName?: RegExp;
|
|
62
|
+
}
|
|
63
|
+
export interface PathConfig {
|
|
64
|
+
/** A folder relative to the config file (`./src/services`) or a tsconfig `paths` alias (`@app/services`). */
|
|
65
|
+
path: string;
|
|
66
|
+
/** Scan sub-folders too. Default `true`. */
|
|
67
|
+
recursive?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The shape of `*.bundle.json`: one bundle, built on one tsconfig. A project that
|
|
71
|
+
* needs several bundles keeps one config file per bundle.
|
|
72
|
+
*/
|
|
73
|
+
export interface BundleConfig {
|
|
74
|
+
$schema?: string;
|
|
75
|
+
/**
|
|
76
|
+
* The generated file, relative to the config file. Default `<root>/<name>.bundle.ts`:
|
|
77
|
+
* `<root>` is the tsconfig's `rootDir`, else the common folder of the files it compiles.
|
|
78
|
+
* Required when there is no tsconfig to extend.
|
|
79
|
+
*/
|
|
80
|
+
output?: string;
|
|
81
|
+
/**
|
|
82
|
+
* The bundle's name: letters, digits, `-` and `_`, starting with a letter. Default: the
|
|
83
|
+
* config file's stem (`production.bundle.json` -> `production`), else {@link DEFAULT_BUNDLE_NAME}.
|
|
84
|
+
* It names the default output (`production.bundle.ts`) and the generated class,
|
|
85
|
+
* an `IContainerModule` (`ProductionBundle`, see {@link toClassName}).
|
|
86
|
+
*/
|
|
87
|
+
name?: string;
|
|
88
|
+
/** Tags associated with the bundle. */
|
|
89
|
+
tags?: string[];
|
|
90
|
+
/**
|
|
91
|
+
* The tsconfig the bundle builds on, like a tsconfig's own `extends`: the source of
|
|
92
|
+
* its file set, `paths` aliases and import extension. Relative to the config file.
|
|
93
|
+
* Default `./tsconfig.json`, which may be absent; a tsconfig named here must exist.
|
|
94
|
+
*/
|
|
95
|
+
extends?: string;
|
|
96
|
+
/** Extension of generated imports. Inferred from the tsconfig's `moduleResolution` when omitted. */
|
|
97
|
+
importExtension?: string;
|
|
98
|
+
/** Which files are parsed. Default: what the tsconfig compiles, minus {@link DEFAULT_EXCLUDE}. */
|
|
99
|
+
files?: FileSelector;
|
|
100
|
+
/** Which classes of a parsed file are registered. Default: every exported class. */
|
|
101
|
+
classes?: ClassSelector;
|
|
102
|
+
}
|
|
103
|
+
export declare const DEFAULT_EXTENDS = "./tsconfig.json";
|
|
104
|
+
/** The bundle name when the config file gives none, e.g. building from `tsconfig.json` alone. */
|
|
105
|
+
export declare const DEFAULT_BUNDLE_NAME = "base";
|
|
106
|
+
/** What `classes.decorators` requires when omitted: the library's own `@register`. */
|
|
107
|
+
export declare const DEFAULT_DECORATORS: string[];
|
|
108
|
+
export declare const DEFAULT_EXCLUDE: string[];
|
|
109
|
+
/** A {@link BundleConfig} whose defaults are filled in and whose paths are absolute. */
|
|
110
|
+
export interface ResolvedConfig {
|
|
111
|
+
/** The config file itself. */
|
|
112
|
+
file: string;
|
|
113
|
+
dir: string;
|
|
114
|
+
/** `undefined`: derived from the tsconfig at build time (see {@link BundleConfig.output}). */
|
|
115
|
+
output?: string;
|
|
116
|
+
/** The bundle name: `production` for `production.bundle.json`. */
|
|
117
|
+
name: string;
|
|
118
|
+
/** The generated class: `ProductionBundle`. */
|
|
119
|
+
className: string;
|
|
120
|
+
tags: string[];
|
|
121
|
+
/** The extended tsconfig; `required` when the config names it, so it must exist. */
|
|
122
|
+
tsconfig: {
|
|
123
|
+
file: string;
|
|
124
|
+
required: boolean;
|
|
125
|
+
};
|
|
126
|
+
importExtension?: string;
|
|
127
|
+
files: ResolvedFileSelector;
|
|
128
|
+
classes: ResolvedClassSelector;
|
|
129
|
+
/** Non-fatal problems found while resolving, e.g. a `files.exclude` that drops a default test glob. */
|
|
130
|
+
warnings: string[];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* One `*.bundle.json` / `*.bundle.yaml`. The published `tic.schema.json` is generated
|
|
134
|
+
* from it (`ticConfigJsonSchema`), so the schema editors validate against cannot drift
|
|
135
|
+
* from what `tic build` accepts.
|
|
136
|
+
*/
|
|
137
|
+
export declare const BUNDLE_CONFIG_SCHEMA: z.ZodObject<{
|
|
138
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
139
|
+
output: z.ZodOptional<z.ZodString>;
|
|
140
|
+
name: z.ZodOptional<z.ZodString>;
|
|
141
|
+
tags: z.ZodDefault<z.ZodCustom<string[], string[]>>;
|
|
142
|
+
extends: z.ZodOptional<z.ZodString>;
|
|
143
|
+
importExtension: z.ZodOptional<z.ZodString>;
|
|
144
|
+
files: z.ZodOptional<z.ZodObject<{
|
|
145
|
+
paths: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
146
|
+
path: z.ZodString;
|
|
147
|
+
recursive: z.ZodDefault<z.ZodBoolean>;
|
|
148
|
+
}, z.core.$strip>]>>>;
|
|
149
|
+
include: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
150
|
+
exclude: z.ZodDefault<z.ZodCustom<string[], string[]>>;
|
|
151
|
+
}, z.core.$strict>>;
|
|
152
|
+
classes: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
export: z.ZodDefault<z.ZodEnum<{
|
|
154
|
+
default: "default";
|
|
155
|
+
any: "any";
|
|
156
|
+
named: "named";
|
|
157
|
+
}>>;
|
|
158
|
+
decorators: z.ZodDefault<z.ZodCustom<string[], string[]>>;
|
|
159
|
+
name: z.ZodOptional<z.ZodString>;
|
|
160
|
+
excludeClasses: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
161
|
+
excludeName: z.ZodOptional<z.ZodString>;
|
|
162
|
+
}, z.core.$strict>>;
|
|
163
|
+
}, z.core.$strict>;
|
|
164
|
+
/**
|
|
165
|
+
* A config file is named `<name>.bundle.json`, `<name>.bundle.yaml` or `<name>.bundle.yml`,
|
|
166
|
+
* e.g. `app.bundle.json`, `production.bundle.yaml`. Every format has the same shape.
|
|
167
|
+
*/
|
|
168
|
+
export declare const CONFIG_FILE_SUFFIXES: string[];
|
|
169
|
+
/** The config suffix `file` ends with, if any. */
|
|
170
|
+
export declare const configSuffix: (file: string) => string | undefined;
|
|
171
|
+
/** The generated class for a bundle name: `production` -> `ProductionBundle`, `my-app_v2` -> `MyAppV2Bundle`. */
|
|
172
|
+
export declare function toClassName(name: string): string;
|
|
173
|
+
/**
|
|
174
|
+
* Validates parsed `*.bundle.json` content and resolves its paths against `file`'s directory.
|
|
175
|
+
*
|
|
176
|
+
* @throws {TicConfigError} when the content does not match the config shape; the message names the field.
|
|
177
|
+
*/
|
|
178
|
+
export declare function resolveConfig(content: unknown, file: string): ResolvedConfig;
|
|
179
|
+
//# sourceMappingURL=BuildConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuildConfig.d.ts","sourceRoot":"","sources":["../../../lib/features/build/BuildConfig.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ILogger } from '../../services/ConsoleLogger.js';
|
|
3
|
+
import { type IOutputService } from '../../services/OutputService.js';
|
|
4
|
+
import { type IBundleBuilder } from './services/BundleBuilder.js';
|
|
5
|
+
import { type ITicConfigService } from './services/TicConfigService.js';
|
|
6
|
+
export declare const BUILD_OPTIONS: z.ZodObject<{
|
|
7
|
+
config: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
8
|
+
check: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type BuildCliOptions = z.output<typeof BUILD_OPTIONS>;
|
|
11
|
+
/** `tic build [--config <path>]... [--check]`. */
|
|
12
|
+
export declare class BuildController {
|
|
13
|
+
private readonly cwd;
|
|
14
|
+
private readonly configs;
|
|
15
|
+
private readonly builder;
|
|
16
|
+
private readonly output;
|
|
17
|
+
private readonly logger;
|
|
18
|
+
constructor(cwd: string, configs: ITicConfigService, builder: IBundleBuilder, output: IOutputService, logger: ILogger);
|
|
19
|
+
/**
|
|
20
|
+
* Builds every config named with `--config`, else every `*.bundle.{json,yaml,yml}` of the
|
|
21
|
+
* package, else one bundle from its `tsconfig.json`. With `--check` nothing is written and
|
|
22
|
+
* an out-of-date bundle fails the run. One line per bundle goes to stdout, warnings to
|
|
23
|
+
* stderr; an error names the config it came from.
|
|
24
|
+
*
|
|
25
|
+
* @throws {UsageError} when an option is unknown or `--config` has no value.
|
|
26
|
+
* @throws {TicConfigError} when a config or its tsconfig is missing or invalid, or none can be found.
|
|
27
|
+
* @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
|
|
28
|
+
* @throws {StaleBundlesError} when `--check` finds a bundle that differs from what a build would write.
|
|
29
|
+
*/
|
|
30
|
+
build(options: BuildCliOptions): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=BuildController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuildController.d.ts","sourceRoot":"","sources":["../../../lib/features/build/BuildController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,KAAK,cAAc,EAAwC,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE,KAAK,iBAAiB,EAAuC,MAAM,6BAA6B,CAAC;AAE1G,eAAO,MAAM,aAAa;;;iBAGxB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAW7D,kDAAkD;AAClD,qBACa,eAAe;IAEK,OAAO,CAAC,QAAQ,CAAC,GAAG;IACf,OAAO,CAAC,QAAQ,CAAC,OAAO;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAJD,GAAG,EAAE,MAAM,EACN,OAAO,EAAE,iBAAiB,EAC7B,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,cAAc,EAC7B,MAAM,EAAE,OAAO;IAG1D;;;;;;;;;;OAUG;IAEH,KAAK,CAAgE,OAAO,EAAE,eAAe,GAAG,IAAI;CAiBrG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuildModule.d.ts","sourceRoot":"","sources":["../../../lib/features/build/BuildModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAqB,MAAM,kBAAkB,CAAC;AAK7F,qBAAa,WAAY,YAAW,gBAAgB;IAClD,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;CAMrC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
1
2
|
interface Alias {
|
|
2
3
|
pattern: string;
|
|
3
4
|
/** Absolute, `/`-separated. */
|
|
@@ -11,15 +12,10 @@ export declare class ImportPaths {
|
|
|
11
12
|
private readonly aliases;
|
|
12
13
|
readonly extension: string;
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @throws {TicConfigError} when a required tsconfig is missing or cannot be parsed.
|
|
15
|
+
* From a parsed tsconfig's options: its `paths` aliases, and the extension imports need
|
|
16
|
+
* under its `moduleResolution`; `importExtension` overrides the latter.
|
|
18
17
|
*/
|
|
19
|
-
static
|
|
20
|
-
file: string;
|
|
21
|
-
required: boolean;
|
|
22
|
-
}, importExtension?: string): ImportPaths;
|
|
18
|
+
static fromOptions(options: ts.CompilerOptions, tsconfigFile: string, importExtension?: string): ImportPaths;
|
|
23
19
|
constructor(aliases: Alias[], extension: string);
|
|
24
20
|
/**
|
|
25
21
|
* The folder a namespace names: a path relative to `baseDir`, or a `paths` alias.
|
|
@@ -29,18 +25,10 @@ export declare class ImportPaths {
|
|
|
29
25
|
resolveNamespace(namespace: string, baseDir: string): string;
|
|
30
26
|
/** The specifier `fromFile` imports `toFile` by: its most specific alias, else a relative path. */
|
|
31
27
|
specifier(fromFile: string, toFile: string): string;
|
|
32
|
-
/**
|
|
33
|
-
* The tsconfig `paths` alias `file` is covered by, normalized to its name
|
|
34
|
-
* (`@app/services/*` -> `app/services`), or `undefined` when no alias covers it.
|
|
35
|
-
* Used to drop classes by alias (`select.excludeAliases`).
|
|
36
|
-
*/
|
|
37
|
-
aliasName(file: string): string | undefined;
|
|
38
28
|
private bestAlias;
|
|
39
29
|
private aliasTargets;
|
|
40
30
|
/** A longer matched target prefix is a more specific alias; an exact file alias beats every wildcard. */
|
|
41
31
|
private matchAlias;
|
|
42
32
|
}
|
|
43
|
-
/** The name of a `paths` alias: `@app/services/*` and `@app/services` both become `app/services`. */
|
|
44
|
-
export declare function normalizeAliasName(pattern: string): string;
|
|
45
33
|
export {};
|
|
46
34
|
//# sourceMappingURL=ImportPaths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportPaths.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/ImportPaths.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAaD;;;GAGG;AACH,qBAAa,WAAW;IAmBpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM;IAnB5B;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW;gBAczF,OAAO,EAAE,KAAK,EAAE,EACxB,SAAS,EAAE,MAAM;IAG5B;;;;OAIG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAa5D,mGAAmG;IACnG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAUnD,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,YAAY;IAWpB,yGAAyG;IACzG,OAAO,CAAC,UAAU;CAanB"}
|