@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.
Files changed (122) hide show
  1. package/AGENTS.md +47 -31
  2. package/README.md +157 -280
  3. package/cjm/app.js +39 -0
  4. package/cjm/bin.js +2 -2
  5. package/cjm/cli/Application.js +58 -0
  6. package/cjm/cli/IErrorHandler.js +5 -0
  7. package/cjm/cli/decorators.js +9 -0
  8. package/cjm/cli/index.js +17 -0
  9. package/cjm/cli/options.js +25 -0
  10. package/cjm/cli/usage.js +19 -0
  11. package/cjm/domain/CliIo.js +7 -0
  12. package/cjm/domain/GlobalConfig.js +7 -0
  13. package/cjm/exceptions/DomainException.js +54 -0
  14. package/cjm/exceptions/ExceptionHandler.js +38 -0
  15. package/cjm/features/build/BuildConfig.js +183 -0
  16. package/cjm/features/build/BuildController.js +91 -0
  17. package/cjm/features/build/BuildModule.js +16 -0
  18. package/cjm/{ImportPaths.js → features/build/domain/ImportPaths.js} +7 -29
  19. package/cjm/features/build/domain/configFiles.js +35 -0
  20. package/cjm/{emit.js → features/build/domain/emit.js} +10 -9
  21. package/cjm/{scan.js → features/build/domain/scan.js} +6 -3
  22. package/cjm/features/build/domain/tokenCollisions.js +29 -0
  23. package/cjm/features/build/domain/tsconfig.js +78 -0
  24. package/cjm/features/build/services/BundleBuilder.js +116 -0
  25. package/cjm/features/build/services/TicConfigService.js +68 -0
  26. package/cjm/features/help/HelpController.js +39 -0
  27. package/cjm/features/help/HelpModule.js +12 -0
  28. package/cjm/features/help/VersionController.js +45 -0
  29. package/cjm/index.js +87 -28
  30. package/cjm/modules/CommonModule.js +28 -0
  31. package/cjm/schema/ticConfigSchema.js +24 -0
  32. package/cjm/services/ConsoleLogger.js +36 -0
  33. package/cjm/services/HandlebarsRenderService.js +33 -0
  34. package/cjm/services/NodeFileSystemService.js +32 -0
  35. package/cjm/services/OutputService.js +33 -0
  36. package/package.json +10 -7
  37. package/tic.schema.json +118 -147
  38. package/tpl/index.cjs +36 -16
  39. package/typings/app.d.ts +24 -0
  40. package/typings/cli/Application.d.ts +16 -0
  41. package/typings/cli/Application.d.ts.map +1 -0
  42. package/typings/cli/IErrorHandler.d.ts +7 -0
  43. package/typings/cli/IErrorHandler.d.ts.map +1 -0
  44. package/typings/cli/decorators.d.ts +10 -0
  45. package/typings/cli/decorators.d.ts.map +1 -0
  46. package/typings/cli/index.d.ts +6 -0
  47. package/typings/cli/index.d.ts.map +1 -0
  48. package/typings/cli/options.d.ts +23 -0
  49. package/typings/cli/options.d.ts.map +1 -0
  50. package/typings/cli/usage.d.ts +2 -0
  51. package/typings/cli/usage.d.ts.map +1 -0
  52. package/typings/domain/CliIo.d.ts +10 -0
  53. package/typings/domain/CliIo.d.ts.map +1 -0
  54. package/typings/domain/GlobalConfig.d.ts +10 -0
  55. package/typings/domain/GlobalConfig.d.ts.map +1 -0
  56. package/typings/exceptions/DomainException.d.ts +37 -0
  57. package/typings/exceptions/DomainException.d.ts.map +1 -0
  58. package/typings/exceptions/ExceptionHandler.d.ts +12 -0
  59. package/typings/exceptions/ExceptionHandler.d.ts.map +1 -0
  60. package/typings/features/build/BuildConfig.d.ts +179 -0
  61. package/typings/features/build/BuildConfig.d.ts.map +1 -0
  62. package/typings/features/build/BuildController.d.ts +32 -0
  63. package/typings/features/build/BuildController.d.ts.map +1 -0
  64. package/typings/features/build/BuildModule.d.ts +5 -0
  65. package/typings/features/build/BuildModule.d.ts.map +1 -0
  66. package/typings/{ImportPaths.d.ts → features/build/domain/ImportPaths.d.ts} +4 -16
  67. package/typings/features/build/domain/ImportPaths.d.ts.map +1 -0
  68. package/typings/features/build/domain/configFiles.d.ts +13 -0
  69. package/typings/features/build/domain/configFiles.d.ts.map +1 -0
  70. package/typings/features/build/domain/emit.d.ts +42 -0
  71. package/typings/features/build/domain/emit.d.ts.map +1 -0
  72. package/typings/features/build/domain/glob.d.ts.map +1 -0
  73. package/typings/{scan.d.ts → features/build/domain/scan.d.ts} +4 -2
  74. package/typings/features/build/domain/scan.d.ts.map +1 -0
  75. package/typings/features/build/domain/tokenCollisions.d.ts +14 -0
  76. package/typings/features/build/domain/tokenCollisions.d.ts.map +1 -0
  77. package/typings/features/build/domain/tsconfig.d.ts +25 -0
  78. package/typings/features/build/domain/tsconfig.d.ts.map +1 -0
  79. package/typings/features/build/services/BundleBuilder.d.ts +68 -0
  80. package/typings/features/build/services/BundleBuilder.d.ts.map +1 -0
  81. package/typings/features/build/services/TicConfigService.d.ts +37 -0
  82. package/typings/features/build/services/TicConfigService.d.ts.map +1 -0
  83. package/typings/features/help/HelpController.d.ts +8 -0
  84. package/typings/features/help/HelpController.d.ts.map +1 -0
  85. package/typings/features/help/HelpModule.d.ts +5 -0
  86. package/typings/features/help/HelpModule.d.ts.map +1 -0
  87. package/typings/features/help/VersionController.d.ts +8 -0
  88. package/typings/features/help/VersionController.d.ts.map +1 -0
  89. package/typings/index.d.ts +25 -11
  90. package/typings/modules/CommonModule.d.ts +9 -0
  91. package/typings/modules/CommonModule.d.ts.map +1 -0
  92. package/typings/schema/ticConfigSchema.d.ts +7 -0
  93. package/typings/schema/ticConfigSchema.d.ts.map +1 -0
  94. package/typings/services/ConsoleLogger.d.ts +20 -0
  95. package/typings/services/ConsoleLogger.d.ts.map +1 -0
  96. package/typings/services/HandlebarsRenderService.d.ts +23 -0
  97. package/typings/services/HandlebarsRenderService.d.ts.map +1 -0
  98. package/typings/services/NodeFileSystemService.d.ts +21 -0
  99. package/typings/services/NodeFileSystemService.d.ts.map +1 -0
  100. package/typings/services/OutputService.d.ts +13 -0
  101. package/typings/services/OutputService.d.ts.map +1 -0
  102. package/cjm/build.js +0 -132
  103. package/cjm/cli.js +0 -84
  104. package/cjm/config.js +0 -162
  105. package/cjm/errors.js +0 -15
  106. package/cjm/exportPredicate.js +0 -13
  107. package/cjm/inclusion.js +0 -24
  108. package/cjm/predicateFile.js +0 -30
  109. package/cjm/render.js +0 -15
  110. package/cjm/utils.js +0 -2
  111. package/typings/build.d.ts +0 -45
  112. package/typings/cli.d.ts +0 -8
  113. package/typings/config.d.ts +0 -123
  114. package/typings/emit.d.ts +0 -18
  115. package/typings/errors.d.ts +0 -13
  116. package/typings/exportPredicate.d.ts +0 -36
  117. package/typings/inclusion.d.ts +0 -42
  118. package/typings/predicateFile.d.ts +0 -16
  119. package/typings/render.d.ts +0 -8
  120. package/typings/utils.d.ts +0 -3
  121. /package/cjm/{glob.js → features/build/domain/glob.js} +0 -0
  122. /package/typings/{glob.d.ts → features/build/domain/glob.d.ts} +0 -0
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommonModule = void 0;
4
+ const ts_ioc_container_1 = require("ts-ioc-container");
5
+ const CliIo_1 = require("../domain/CliIo");
6
+ const GlobalConfig_1 = require("../domain/GlobalConfig");
7
+ const ExceptionHandler_1 = require("../exceptions/ExceptionHandler");
8
+ const ConsoleLogger_1 = require("../services/ConsoleLogger");
9
+ const HandlebarsRenderService_1 = require("../services/HandlebarsRenderService");
10
+ const NodeFileSystemService_1 = require("../services/NodeFileSystemService");
11
+ const OutputService_1 = require("../services/OutputService");
12
+ class CommonModule {
13
+ io;
14
+ constructor(io) {
15
+ this.io = io;
16
+ }
17
+ applyTo(container) {
18
+ container
19
+ .addRegistration(ts_ioc_container_1.Registration.fromValue(this.io).bindTo(CliIo_1.CliIoKey))
20
+ .addRegistration(ts_ioc_container_1.Registration.fromValue({ cwd: this.io.cwd }).bindTo(GlobalConfig_1.GlobalConfigKey))
21
+ .addRegistration(ts_ioc_container_1.Registration.fromClass(OutputService_1.StdOutputService))
22
+ .addRegistration(ts_ioc_container_1.Registration.fromClass(ConsoleLogger_1.ConsoleLogger))
23
+ .addRegistration(ts_ioc_container_1.Registration.fromClass(ExceptionHandler_1.ExceptionHandler))
24
+ .addRegistration(ts_ioc_container_1.Registration.fromClass(NodeFileSystemService_1.NodeFileSystemService))
25
+ .addRegistration(ts_ioc_container_1.Registration.fromClass(HandlebarsRenderService_1.HandlebarsRenderService));
26
+ }
27
+ }
28
+ exports.CommonModule = CommonModule;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ticConfigJsonSchema = ticConfigJsonSchema;
4
+ const zod_1 = require("zod");
5
+ const BuildConfig_1 = require("../features/build/BuildConfig");
6
+ function ticConfigJsonSchema() {
7
+ const schema = zod_1.z.toJSONSchema(BuildConfig_1.BUNDLE_CONFIG_SCHEMA, {
8
+ io: 'input',
9
+ target: 'draft-7',
10
+ unrepresentable: 'any',
11
+ override: ({ jsonSchema }) => {
12
+ if (jsonSchema.type === 'object')
13
+ jsonSchema.additionalProperties = false;
14
+ },
15
+ });
16
+ const { $schema, ...rest } = schema;
17
+ return {
18
+ $schema,
19
+ $id: 'https://github.com/IgorBabkin/ts-ioc-container/tree/main/packages/bundler/tic.schema.json',
20
+ title: '*.bundle.json / *.bundle.yaml',
21
+ 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.",
22
+ ...rest,
23
+ };
24
+ }
@@ -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": "1.5.0",
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": {
@@ -49,7 +48,11 @@
49
48
  "directory": "packages/bundler"
50
49
  },
51
50
  "dependencies": {
52
- "handlebars": "^4.7.9"
51
+ "handlebars": "^4.7.9",
52
+ "reflect-metadata": "^0.2.2",
53
+ "yaml": "^2.8.3",
54
+ "zod": "^4.6.5",
55
+ "ts-ioc-container": "74.0.0"
53
56
  },
54
57
  "peerDependencies": {
55
58
  "typescript": ">=5"
@@ -57,11 +60,10 @@
57
60
  "devDependencies": {
58
61
  "@types/node": "^25.5.2",
59
62
  "@vitest/coverage-v8": "^4.1.2",
60
- "reflect-metadata": "^0.2.2",
63
+ "moq.ts": "^10.0.8",
61
64
  "typescript": "5.8.3",
62
65
  "unplugin-swc": "^1.6.0",
63
- "vitest": "^4.1.11",
64
- "ts-ioc-container": "73.1.0"
66
+ "vitest": "^4.1.11"
65
67
  },
66
68
  "engines": {
67
69
  "node": ">= 18"
@@ -77,6 +79,7 @@
77
79
  "lint": "eslint lib/**/*.ts __tests__/**/*.ts",
78
80
  "lint:fix": "pnpm run lint --fix",
79
81
  "format": "prettier --write \"lib/**/*.ts\" \"__tests__/**/*.ts\"",
80
- "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"
81
84
  }
82
85
  }
package/tic.schema.json CHANGED
@@ -1,172 +1,143 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "https://github.com/IgorBabkin/ts-ioc-container/tree/main/packages/bundler/tic.schema.json",
4
- "title": "tic.config.json",
5
- "description": "Bundles generated by `tic build` (@ts-ioc-container/bundler). Relative paths resolve against this file's directory.",
4
+ "title": "*.bundle.json / *.bundle.yaml",
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
- "required": [
8
- "bundles"
9
- ],
10
- "additionalProperties": false,
11
7
  "properties": {
12
8
  "$schema": {
13
9
  "type": "string"
14
10
  },
15
- "tsconfig": {
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.",
16
13
  "type": "string",
17
- "description": "tsconfig whose `paths` aliases namespaces and imports may use. Default `tsconfig.json`, which may be absent."
14
+ "minLength": 1
18
15
  },
19
- "importExtension": {
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).",
20
18
  "type": "string",
21
- "description": "Extension of generated imports, e.g. \".js\". Inferred from the tsconfig: \".js\" under node16/nodenext resolution, none otherwise."
19
+ "pattern": "^[A-Za-z][\\w-]*$"
22
20
  },
23
- "bundles": {
21
+ "tags": {
22
+ "default": [],
23
+ "description": "Tags associated with the bundle.",
24
24
  "type": "array",
25
- "minItems": 1,
26
25
  "items": {
27
- "type": "object",
28
- "required": [
29
- "output",
30
- "namespaces"
31
- ],
32
- "additionalProperties": false,
33
- "properties": {
34
- "output": {
35
- "type": "string",
36
- "minLength": 1,
37
- "description": "The bundle file (convention: *.bundle.ts)."
38
- },
39
- "name": {
40
- "type": "string",
41
- "pattern": "^[A-Za-z_$][\\w$]*$",
42
- "default": "Bundle",
43
- "description": "Name of the generated class, an IContainerModule."
44
- },
45
- "tags": {
46
- "type": "array",
47
- "items": {
48
- "type": "string",
49
- "minLength": 1
50
- },
51
- "description": "Tags associated with the bundle."
52
- },
53
- "namespaces": {
54
- "type": "array",
55
- "minItems": 1,
56
- "description": "Folders to scan: paths relative to this file (./src/services) or tsconfig paths aliases (@app/services).",
57
- "items": {
58
- "oneOf": [
59
- {
60
- "type": "string",
61
- "minLength": 1
62
- },
63
- {
64
- "type": "object",
65
- "required": [
66
- "path"
67
- ],
68
- "additionalProperties": false,
69
- "properties": {
70
- "path": {
71
- "type": "string",
72
- "minLength": 1
73
- },
74
- "recursive": {
75
- "type": "boolean",
76
- "default": true
77
- }
78
- }
79
- }
80
- ]
81
- }
82
- },
83
- "select": {
84
- "type": "object",
85
- "additionalProperties": false,
86
- "description": "How target classes are picked out of a file. A class is selected when it is exported, not abstract, and meets every criterion set here; omit it to register every exported class.",
87
- "properties": {
88
- "export": {
89
- "enum": [
90
- "any",
91
- "named",
92
- "default"
93
- ],
94
- "default": "any",
95
- "description": "Which exports count."
96
- },
97
- "decorators": {
98
- "type": "array",
99
- "minItems": 1,
100
- "items": {
101
- "type": "string",
102
- "minLength": 1
103
- },
104
- "description": "The class must carry one of these decorators, recognised by name (e.g. \"register\", or a composed decorator)."
105
- },
106
- "nameGlob": {
107
- "type": "string",
108
- "minLength": 1,
109
- "description": "Glob the class name must match, e.g. \"*Service\". An anonymous default export is named after its file."
110
- },
111
- "excludeClasses": {
112
- "type": "array",
113
- "minItems": 1,
114
- "items": {
115
- "type": "string",
116
- "minLength": 1
117
- },
118
- "description": "Class names to drop after selection, e.g. one test double sitting next to the real registration in the same file."
119
- },
120
- "excludeNameGlob": {
26
+ "type": "string",
27
+ "minLength": 1
28
+ }
29
+ },
30
+ "extends": {
31
+ "default": "./tsconfig.json",
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
+ },
36
+ "importExtension": {
37
+ "description": "Extension of generated imports, e.g. \".js\". Inferred from the tsconfig: \".js\" under node16/nodenext resolution, none otherwise.",
38
+ "type": "string"
39
+ },
40
+ "files": {
41
+ "type": "object",
42
+ "properties": {
43
+ "paths": {
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",
47
+ "items": {
48
+ "anyOf": [
49
+ {
121
50
  "type": "string",
122
- "minLength": 1,
123
- "description": "Glob the class name must NOT match, e.g. \"*Mock\". An anonymous default export is named after its file."
51
+ "minLength": 1
124
52
  },
125
- "excludeAliases": {
126
- "type": "array",
127
- "minItems": 1,
128
- "items": {
129
- "type": "string",
130
- "minLength": 1
53
+ {
54
+ "type": "object",
55
+ "properties": {
56
+ "path": {
57
+ "type": "string",
58
+ "minLength": 1
59
+ },
60
+ "recursive": {
61
+ "default": true,
62
+ "type": "boolean"
63
+ }
131
64
  },
132
- "description": "tsconfig paths aliases to drop after selection, e.g. [\"services\"] for a `services/*` (or `@services/*`) alias. A class whose file resolves through one of these aliases is dropped. Names may omit a leading `@` and a trailing `/*`."
65
+ "required": ["path"],
66
+ "additionalProperties": false
133
67
  }
134
- }
135
- },
136
- "exclude": {
137
- "type": "array",
138
- "items": {
139
- "type": "string"
140
- },
141
- "default": [
142
- "**/*.spec.ts",
143
- "**/*.test.ts",
144
- "**/*.spec.tsx",
145
- "**/*.test.tsx",
146
- "**/__tests__/**",
147
- "**/node_modules/**"
148
- ],
149
- "description": "Globs, relative to this file, of files never scanned. Replaces the default when given; prefer additionalExclude to add one exclusion without restating the defaults. A non-empty list that omits a default glob makes `tic build` warn."
150
- },
151
- "additionalExclude": {
152
- "type": "array",
153
- "items": {
154
- "type": "string"
155
- },
156
- "description": "Globs, relative to this file, of files never scanned, added on top of `exclude` (or the default excludes when `exclude` is omitted)."
157
- },
158
- "include": {
68
+ ]
69
+ }
70
+ },
71
+ "include": {
72
+ "description": "Globs a file must match one of, e.g. [\"**/*.service.ts\", \"**/*.repository.ts\"]. Default: every source file.",
73
+ "type": "array",
74
+ "items": {
159
75
  "type": "string",
160
- "minLength": 1,
161
- "description": "A file exporting an InclusionPredicate ((context: { filename }) => boolean), relative to this file. Overrides the conventional tic.include.* next to this file. A file takes part only when it matches no `exclude` glob and the predicate returns true."
76
+ "minLength": 1
162
77
  },
163
- "filterExports": {
78
+ "minItems": 1
79
+ },
80
+ "exclude": {
81
+ "default": [
82
+ "**/*.spec.ts",
83
+ "**/*.test.ts",
84
+ "**/*.spec.tsx",
85
+ "**/*.test.tsx",
86
+ "**/__tests__/**",
87
+ "**/node_modules/**"
88
+ ],
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": {
164
92
  "type": "string",
165
- "minLength": 1,
166
- "description": "A file exporting an ExportPredicate ((context: { filename, exportName, className, isDefault, decorators, tags }) => boolean), relative to this file. Runs on every exported, non-abstract class that passes `select`, right after parsing. Overrides the conventional tic.exports.* next to this file."
93
+ "minLength": 1
167
94
  }
168
95
  }
169
- }
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."
99
+ },
100
+ "classes": {
101
+ "type": "object",
102
+ "properties": {
103
+ "export": {
104
+ "default": "any",
105
+ "description": "Which exports count.",
106
+ "type": "string",
107
+ "enum": ["any", "named", "default"]
108
+ },
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.",
112
+ "type": "array",
113
+ "items": {
114
+ "type": "string",
115
+ "minLength": 1
116
+ }
117
+ },
118
+ "name": {
119
+ "description": "Glob the class name must match, e.g. \"*Service\". An anonymous default export is named after its file.",
120
+ "type": "string",
121
+ "minLength": 1
122
+ },
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.",
125
+ "type": "array",
126
+ "items": {
127
+ "type": "string",
128
+ "minLength": 1
129
+ },
130
+ "minItems": 1
131
+ },
132
+ "excludeName": {
133
+ "description": "Glob the class name must NOT match, e.g. \"*Mock\". An anonymous default export is named after its file.",
134
+ "type": "string",
135
+ "minLength": 1
136
+ }
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."
170
140
  }
171
- }
141
+ },
142
+ "additionalProperties": false
172
143
  }