@ts-ioc-container/bundler 2.0.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 +13 -2
- 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} +2 -2
- package/cjm/features/build/domain/configFiles.js +35 -0
- package/cjm/{emit.js → features/build/domain/emit.js} +9 -11
- package/cjm/features/build/domain/tokenCollisions.js +29 -0
- package/cjm/{tsconfig.js → features/build/domain/tsconfig.js} +3 -3
- 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 +84 -25
- 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 +9 -7
- package/tic.schema.json +48 -53
- 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/{config.d.ts → features/build/BuildConfig.d.ts} +42 -25
- 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/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/{emit.d.ts → features/build/domain/emit.d.ts} +22 -3
- 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} +1 -1
- 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.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 -9
- 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 -106
- package/cjm/cli.js +0 -109
- package/cjm/config.js +0 -199
- package/cjm/errors.js +0 -15
- package/cjm/render.js +0 -15
- package/typings/build.d.ts +0 -42
- package/typings/cli.d.ts +0 -8
- package/typings/errors.d.ts +0 -13
- package/typings/render.d.ts +0 -8
- /package/cjm/{glob.js → features/build/domain/glob.js} +0 -0
- /package/cjm/{scan.js → features/build/domain/scan.js} +0 -0
- /package/typings/{ImportPaths.d.ts → features/build/domain/ImportPaths.d.ts} +0 -0
- /package/typings/{glob.d.ts → features/build/domain/glob.d.ts} +0 -0
- /package/typings/{tsconfig.d.ts → features/build/domain/tsconfig.d.ts} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ConsoleLogger = exports.ILoggerKey = void 0;
|
|
16
|
+
const ts_ioc_container_1 = require("ts-ioc-container");
|
|
17
|
+
const CliIo_1 = require("../domain/CliIo");
|
|
18
|
+
exports.ILoggerKey = new ts_ioc_container_1.SingleToken('ILogger');
|
|
19
|
+
let ConsoleLogger = class ConsoleLogger {
|
|
20
|
+
io;
|
|
21
|
+
constructor(io) {
|
|
22
|
+
this.io = io;
|
|
23
|
+
}
|
|
24
|
+
warn(message) {
|
|
25
|
+
this.io.stderr(`tic: warning: ${message}`);
|
|
26
|
+
}
|
|
27
|
+
error(message) {
|
|
28
|
+
this.io.stderr(`tic: ${message}`);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.ConsoleLogger = ConsoleLogger;
|
|
32
|
+
exports.ConsoleLogger = ConsoleLogger = __decorate([
|
|
33
|
+
(0, ts_ioc_container_1.register)(exports.ILoggerKey),
|
|
34
|
+
__param(0, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(CliIo_1.CliIoKey))),
|
|
35
|
+
__metadata("design:paramtypes", [Object])
|
|
36
|
+
], ConsoleLogger);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HandlebarsRenderService = exports.IRenderServiceKey = void 0;
|
|
13
|
+
exports.renderProtocol = renderProtocol;
|
|
14
|
+
require("../../tpl/index.cjs");
|
|
15
|
+
const handlebars_1 = __importDefault(require("handlebars"));
|
|
16
|
+
const ts_ioc_container_1 = require("ts-ioc-container");
|
|
17
|
+
handlebars_1.default.registerHelper('join', (items, separator) => items.join(separator));
|
|
18
|
+
function renderProtocol(name, data) {
|
|
19
|
+
const protocol = handlebars_1.default.templates?.[name];
|
|
20
|
+
if (!protocol)
|
|
21
|
+
throw new Error(`Protocol not found: ${name}`);
|
|
22
|
+
return protocol(data);
|
|
23
|
+
}
|
|
24
|
+
exports.IRenderServiceKey = new ts_ioc_container_1.SingleToken('IRenderService');
|
|
25
|
+
let HandlebarsRenderService = class HandlebarsRenderService {
|
|
26
|
+
render(protocol, data) {
|
|
27
|
+
return renderProtocol(protocol, data);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.HandlebarsRenderService = HandlebarsRenderService;
|
|
31
|
+
exports.HandlebarsRenderService = HandlebarsRenderService = __decorate([
|
|
32
|
+
(0, ts_ioc_container_1.register)(exports.IRenderServiceKey)
|
|
33
|
+
], HandlebarsRenderService);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.NodeFileSystemService = exports.IFileSystemServiceKey = void 0;
|
|
13
|
+
const node_fs_1 = require("node:fs");
|
|
14
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
15
|
+
const ts_ioc_container_1 = require("ts-ioc-container");
|
|
16
|
+
exports.IFileSystemServiceKey = new ts_ioc_container_1.SingleToken('IFileSystemService');
|
|
17
|
+
let NodeFileSystemService = class NodeFileSystemService {
|
|
18
|
+
fileExists(file) {
|
|
19
|
+
return (0, node_fs_1.existsSync)(file);
|
|
20
|
+
}
|
|
21
|
+
readFile(file) {
|
|
22
|
+
return (0, node_fs_1.readFileSync)(file, 'utf8');
|
|
23
|
+
}
|
|
24
|
+
writeFile(file, content) {
|
|
25
|
+
(0, node_fs_1.mkdirSync)(node_path_1.default.dirname(file), { recursive: true });
|
|
26
|
+
(0, node_fs_1.writeFileSync)(file, content);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.NodeFileSystemService = NodeFileSystemService;
|
|
30
|
+
exports.NodeFileSystemService = NodeFileSystemService = __decorate([
|
|
31
|
+
(0, ts_ioc_container_1.register)(exports.IFileSystemServiceKey)
|
|
32
|
+
], NodeFileSystemService);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.StdOutputService = exports.IOutputServiceKey = void 0;
|
|
16
|
+
const ts_ioc_container_1 = require("ts-ioc-container");
|
|
17
|
+
const CliIo_1 = require("../domain/CliIo");
|
|
18
|
+
exports.IOutputServiceKey = new ts_ioc_container_1.SingleToken('IOutputService');
|
|
19
|
+
let StdOutputService = class StdOutputService {
|
|
20
|
+
io;
|
|
21
|
+
constructor(io) {
|
|
22
|
+
this.io = io;
|
|
23
|
+
}
|
|
24
|
+
write(line) {
|
|
25
|
+
this.io.stdout(line);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.StdOutputService = StdOutputService;
|
|
29
|
+
exports.StdOutputService = StdOutputService = __decorate([
|
|
30
|
+
(0, ts_ioc_container_1.register)(exports.IOutputServiceKey),
|
|
31
|
+
__param(0, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(CliIo_1.CliIoKey))),
|
|
32
|
+
__metadata("design:paramtypes", [Object])
|
|
33
|
+
], StdOutputService);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-ioc-container/bundler",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Bundles your dependencies into a single container module for ts-ioc-container: the `tic` CLI scans folders (by path or tsconfig alias) and generates one typed bundle that registers every class — `container.useModule(new AppBundle())`.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"author": "ibabkin <igba14@gmail.com>",
|
|
10
10
|
"homepage": "https://github.com/IgorBabkin/ts-ioc-container/tree/main/packages/bundler#readme",
|
|
11
11
|
"license": "ISC",
|
|
12
|
-
"sideEffects": false,
|
|
13
12
|
"main": "cjm/index.js",
|
|
14
13
|
"types": "typings/index.d.ts",
|
|
15
14
|
"bin": {
|
|
@@ -50,7 +49,10 @@
|
|
|
50
49
|
},
|
|
51
50
|
"dependencies": {
|
|
52
51
|
"handlebars": "^4.7.9",
|
|
53
|
-
"
|
|
52
|
+
"reflect-metadata": "^0.2.2",
|
|
53
|
+
"yaml": "^2.8.3",
|
|
54
|
+
"zod": "^4.6.5",
|
|
55
|
+
"ts-ioc-container": "74.0.0"
|
|
54
56
|
},
|
|
55
57
|
"peerDependencies": {
|
|
56
58
|
"typescript": ">=5"
|
|
@@ -58,11 +60,10 @@
|
|
|
58
60
|
"devDependencies": {
|
|
59
61
|
"@types/node": "^25.5.2",
|
|
60
62
|
"@vitest/coverage-v8": "^4.1.2",
|
|
61
|
-
"
|
|
63
|
+
"moq.ts": "^10.0.8",
|
|
62
64
|
"typescript": "5.8.3",
|
|
63
65
|
"unplugin-swc": "^1.6.0",
|
|
64
|
-
"vitest": "^4.1.11"
|
|
65
|
-
"ts-ioc-container": "74.0.0"
|
|
66
|
+
"vitest": "^4.1.11"
|
|
66
67
|
},
|
|
67
68
|
"engines": {
|
|
68
69
|
"node": ">= 18"
|
|
@@ -78,6 +79,7 @@
|
|
|
78
79
|
"lint": "eslint lib/**/*.ts __tests__/**/*.ts",
|
|
79
80
|
"lint:fix": "pnpm run lint --fix",
|
|
80
81
|
"format": "prettier --write \"lib/**/*.ts\" \"__tests__/**/*.ts\"",
|
|
81
|
-
"format:check": "prettier --check \"lib/**/*.ts\" \"__tests__/**/*.ts\""
|
|
82
|
+
"format:check": "prettier --check \"lib/**/*.ts\" \"__tests__/**/*.ts\"",
|
|
83
|
+
"generate:schema": "pnpm run build:cjm && node scripts/generate-schema.cjs"
|
|
82
84
|
}
|
|
83
85
|
}
|
package/tic.schema.json
CHANGED
|
@@ -4,88 +4,80 @@
|
|
|
4
4
|
"title": "*.bundle.json / *.bundle.yaml",
|
|
5
5
|
"description": "One bundle generated by `tic build` (@ts-ioc-container/bundler). `tic build` builds every `*.bundle.json` / `*.bundle.yaml` / `*.bundle.yml` at the root of the package it is invoked in, or — with none — one bundle from that package's tsconfig.json with every setting at its default. Relative paths resolve against this file's directory.",
|
|
6
6
|
"type": "object",
|
|
7
|
-
"additionalProperties": false,
|
|
8
7
|
"properties": {
|
|
9
8
|
"$schema": {
|
|
10
9
|
"type": "string"
|
|
11
10
|
},
|
|
12
11
|
"output": {
|
|
12
|
+
"description": "The bundle file (convention: *.bundle.ts). Default `<root>/<name>.bundle.ts`: <root> is the tsconfig's rootDir, else the common folder of the files it compiles. Required when there is no tsconfig to extend.",
|
|
13
13
|
"type": "string",
|
|
14
|
-
"minLength": 1
|
|
15
|
-
"description": "The bundle file (convention: *.bundle.ts). Default `<root>/<name>.bundle.ts`: <root> is the tsconfig's rootDir, else the common folder of the files it compiles. Required when there is no tsconfig to extend."
|
|
14
|
+
"minLength": 1
|
|
16
15
|
},
|
|
17
16
|
"name": {
|
|
17
|
+
"description": "The bundle's name: letters, digits, \"-\" and \"_\", starting with a letter. Default: this file's stem (production.bundle.json → production), else \"base\". It names the default output (production.bundle.ts) and the generated IContainerModule class (ProductionBundle).",
|
|
18
18
|
"type": "string",
|
|
19
|
-
"pattern": "^[A-Za-z][\\w-]*$"
|
|
20
|
-
"description": "The bundle's name: letters, digits, \"-\" and \"_\", starting with a letter. Default: this file's stem (production.bundle.json → production), else \"base\". It names the default output (production.bundle.ts) and the generated IContainerModule class (ProductionBundle)."
|
|
19
|
+
"pattern": "^[A-Za-z][\\w-]*$"
|
|
21
20
|
},
|
|
22
21
|
"tags": {
|
|
22
|
+
"default": [],
|
|
23
|
+
"description": "Tags associated with the bundle.",
|
|
23
24
|
"type": "array",
|
|
24
25
|
"items": {
|
|
25
26
|
"type": "string",
|
|
26
27
|
"minLength": 1
|
|
27
|
-
}
|
|
28
|
-
"description": "Tags associated with the bundle."
|
|
28
|
+
}
|
|
29
29
|
},
|
|
30
30
|
"extends": {
|
|
31
|
-
"type": "string",
|
|
32
|
-
"minLength": 1,
|
|
33
31
|
"default": "./tsconfig.json",
|
|
34
|
-
"description": "The tsconfig this bundle builds on, like a tsconfig's own `extends`: what it compiles (`files` / `include` / `exclude`) is the bundle's file set unless `files.paths` overrides it, and its `paths` aliases and module resolution shape the generated imports. Relative to this file. The default may be absent; a tsconfig named here must exist."
|
|
32
|
+
"description": "The tsconfig this bundle builds on, like a tsconfig's own `extends`: what it compiles (`files` / `include` / `exclude`) is the bundle's file set unless `files.paths` overrides it, and its `paths` aliases and module resolution shape the generated imports. Relative to this file. The default may be absent; a tsconfig named here must exist.",
|
|
33
|
+
"type": "string",
|
|
34
|
+
"minLength": 1
|
|
35
35
|
},
|
|
36
36
|
"importExtension": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"description": "Extension of generated imports, e.g. \".js\". Inferred from the tsconfig: \".js\" under node16/nodenext resolution, none otherwise.",
|
|
38
|
+
"type": "string"
|
|
39
39
|
},
|
|
40
40
|
"files": {
|
|
41
41
|
"type": "object",
|
|
42
|
-
"additionalProperties": false,
|
|
43
|
-
"description": "Which files this bundle reads and parses — decided by path alone, before parsing. The candidates are what the extended tsconfig compiles, or the folders in `paths` when given. A candidate is parsed when it matches one of `include` and none of `exclude`. Globs are relative to this file. With a file naming convention, `include` keeps every other file unread.",
|
|
44
42
|
"properties": {
|
|
45
43
|
"paths": {
|
|
46
|
-
"type": "array",
|
|
47
|
-
"minItems": 1,
|
|
48
44
|
"description": "Folders to scan instead of the extended tsconfig's file set: paths relative to this file (./src/services) or tsconfig paths aliases (@app/services). Required when there is no tsconfig to extend.",
|
|
45
|
+
"minItems": 1,
|
|
46
|
+
"type": "array",
|
|
49
47
|
"items": {
|
|
50
|
-
"
|
|
48
|
+
"anyOf": [
|
|
51
49
|
{
|
|
52
50
|
"type": "string",
|
|
53
51
|
"minLength": 1
|
|
54
52
|
},
|
|
55
53
|
{
|
|
56
54
|
"type": "object",
|
|
57
|
-
"required": [
|
|
58
|
-
"path"
|
|
59
|
-
],
|
|
60
|
-
"additionalProperties": false,
|
|
61
55
|
"properties": {
|
|
62
56
|
"path": {
|
|
63
57
|
"type": "string",
|
|
64
58
|
"minLength": 1
|
|
65
59
|
},
|
|
66
60
|
"recursive": {
|
|
67
|
-
"
|
|
68
|
-
"
|
|
61
|
+
"default": true,
|
|
62
|
+
"type": "boolean"
|
|
69
63
|
}
|
|
70
|
-
}
|
|
64
|
+
},
|
|
65
|
+
"required": ["path"],
|
|
66
|
+
"additionalProperties": false
|
|
71
67
|
}
|
|
72
68
|
]
|
|
73
69
|
}
|
|
74
70
|
},
|
|
75
71
|
"include": {
|
|
72
|
+
"description": "Globs a file must match one of, e.g. [\"**/*.service.ts\", \"**/*.repository.ts\"]. Default: every source file.",
|
|
76
73
|
"type": "array",
|
|
77
|
-
"minItems": 1,
|
|
78
74
|
"items": {
|
|
79
75
|
"type": "string",
|
|
80
76
|
"minLength": 1
|
|
81
77
|
},
|
|
82
|
-
"
|
|
78
|
+
"minItems": 1
|
|
83
79
|
},
|
|
84
80
|
"exclude": {
|
|
85
|
-
"type": "array",
|
|
86
|
-
"items": {
|
|
87
|
-
"type": "string"
|
|
88
|
-
},
|
|
89
81
|
"default": [
|
|
90
82
|
"**/*.spec.ts",
|
|
91
83
|
"**/*.test.ts",
|
|
@@ -94,55 +86,58 @@
|
|
|
94
86
|
"**/__tests__/**",
|
|
95
87
|
"**/node_modules/**"
|
|
96
88
|
],
|
|
97
|
-
"description": "Globs of files never read. Replaces the default when given. A non-empty list that omits a default glob makes `tic build` warn."
|
|
89
|
+
"description": "Globs of files never read. Replaces the default when given. A non-empty list that omits a default glob makes `tic build` warn.",
|
|
90
|
+
"type": "array",
|
|
91
|
+
"items": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"minLength": 1
|
|
94
|
+
}
|
|
98
95
|
}
|
|
99
|
-
}
|
|
96
|
+
},
|
|
97
|
+
"additionalProperties": false,
|
|
98
|
+
"description": "Which files this bundle reads and parses — decided by path alone, before parsing. The candidates are what the extended tsconfig compiles, or the folders in `paths` when given. A candidate is parsed when it matches one of `include` and none of `exclude`. Globs are relative to this file. With a file naming convention, `include` keeps every other file unread."
|
|
100
99
|
},
|
|
101
100
|
"classes": {
|
|
102
101
|
"type": "object",
|
|
103
|
-
"additionalProperties": false,
|
|
104
|
-
"description": "Which classes of a parsed file are registered. A class is selected when it is exported, not abstract, and meets every criterion set here; by default that is every exported class decorated with @register.",
|
|
105
102
|
"properties": {
|
|
106
103
|
"export": {
|
|
107
|
-
"enum": [
|
|
108
|
-
"any",
|
|
109
|
-
"named",
|
|
110
|
-
"default"
|
|
111
|
-
],
|
|
112
104
|
"default": "any",
|
|
113
|
-
"description": "Which exports count."
|
|
105
|
+
"description": "Which exports count.",
|
|
106
|
+
"type": "string",
|
|
107
|
+
"enum": ["any", "named", "default"]
|
|
114
108
|
},
|
|
115
109
|
"decorators": {
|
|
110
|
+
"default": ["register"],
|
|
111
|
+
"description": "The class must carry one of these decorators, recognised by name (e.g. \"register\", or a composed decorator). Default [\"register\"]; [] requires none.",
|
|
116
112
|
"type": "array",
|
|
117
113
|
"items": {
|
|
118
114
|
"type": "string",
|
|
119
115
|
"minLength": 1
|
|
120
|
-
}
|
|
121
|
-
"description": "The class must carry one of these decorators, recognised by name (e.g. \"register\", or a composed decorator). Default [\"register\"]; [] requires none.",
|
|
122
|
-
"default": [
|
|
123
|
-
"register"
|
|
124
|
-
]
|
|
116
|
+
}
|
|
125
117
|
},
|
|
126
118
|
"name": {
|
|
119
|
+
"description": "Glob the class name must match, e.g. \"*Service\". An anonymous default export is named after its file.",
|
|
127
120
|
"type": "string",
|
|
128
|
-
"minLength": 1
|
|
129
|
-
"description": "Glob the class name must match, e.g. \"*Service\". An anonymous default export is named after its file."
|
|
121
|
+
"minLength": 1
|
|
130
122
|
},
|
|
131
123
|
"excludeClasses": {
|
|
124
|
+
"description": "Class names to drop after selection, e.g. one test double sitting next to the real registration in the same file.",
|
|
132
125
|
"type": "array",
|
|
133
|
-
"minItems": 1,
|
|
134
126
|
"items": {
|
|
135
127
|
"type": "string",
|
|
136
128
|
"minLength": 1
|
|
137
129
|
},
|
|
138
|
-
"
|
|
130
|
+
"minItems": 1
|
|
139
131
|
},
|
|
140
132
|
"excludeName": {
|
|
133
|
+
"description": "Glob the class name must NOT match, e.g. \"*Mock\". An anonymous default export is named after its file.",
|
|
141
134
|
"type": "string",
|
|
142
|
-
"minLength": 1
|
|
143
|
-
"description": "Glob the class name must NOT match, e.g. \"*Mock\". An anonymous default export is named after its file."
|
|
135
|
+
"minLength": 1
|
|
144
136
|
}
|
|
145
|
-
}
|
|
137
|
+
},
|
|
138
|
+
"additionalProperties": false,
|
|
139
|
+
"description": "Which classes of a parsed file are registered. A class is selected when it is exported, not abstract, and meets every criterion set here; by default that is every exported class decorated with @register."
|
|
146
140
|
}
|
|
147
|
-
}
|
|
141
|
+
},
|
|
142
|
+
"additionalProperties": false
|
|
148
143
|
}
|
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"}
|