@ts-ioc-container/bundler 3.0.0 → 4.0.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 +45 -40
- package/README.md +181 -129
- package/cjm/app.js +2 -2
- package/cjm/cli/Application.js +4 -5
- package/cjm/cli/options.js +4 -2
- package/cjm/cli/usage.js +11 -8
- package/cjm/domain/CliIo.js +7 -1
- package/cjm/exceptions/DomainException.js +7 -7
- package/cjm/features/build/BuildConfig.js +108 -59
- package/cjm/features/build/BuildController.js +36 -46
- package/cjm/features/build/domain/ImportPaths.js +30 -8
- package/cjm/features/build/domain/emit.js +2 -2
- package/cjm/features/build/domain/scan.js +20 -4
- package/cjm/features/build/domain/tokenCollisions.js +1 -1
- package/cjm/features/build/domain/tsconfig.js +10 -35
- package/cjm/features/build/services/BundleBuilder.js +36 -29
- package/cjm/features/build/services/TicConfigService.js +10 -31
- package/cjm/index.js +9 -10
- package/cjm/schema/ticConfigSchema.js +5 -1
- package/package.json +2 -2
- package/tic.schema.json +117 -73
- package/tpl/index.cjs +15 -15
- package/typings/app.d.ts +7 -6
- package/typings/cli/Application.d.ts.map +1 -1
- package/typings/cli/options.d.ts +7 -1
- package/typings/cli/options.d.ts.map +1 -1
- package/typings/cli/usage.d.ts.map +1 -1
- package/typings/domain/CliIo.d.ts +2 -0
- package/typings/domain/CliIo.d.ts.map +1 -1
- package/typings/domain/GlobalConfig.d.ts +1 -1
- package/typings/domain/GlobalConfig.d.ts.map +1 -1
- package/typings/exceptions/DomainException.d.ts +4 -4
- package/typings/exceptions/DomainException.d.ts.map +1 -1
- package/typings/features/build/BuildConfig.d.ts +107 -94
- package/typings/features/build/BuildConfig.d.ts.map +1 -1
- package/typings/features/build/BuildController.d.ts +23 -17
- package/typings/features/build/BuildController.d.ts.map +1 -1
- package/typings/features/build/domain/ImportPaths.d.ts +15 -4
- package/typings/features/build/domain/ImportPaths.d.ts.map +1 -1
- package/typings/features/build/domain/emit.d.ts +4 -4
- package/typings/features/build/domain/emit.d.ts.map +1 -1
- package/typings/features/build/domain/scan.d.ts +2 -0
- package/typings/features/build/domain/scan.d.ts.map +1 -1
- package/typings/features/build/domain/tsconfig.d.ts +9 -16
- package/typings/features/build/domain/tsconfig.d.ts.map +1 -1
- package/typings/features/build/services/BundleBuilder.d.ts +25 -29
- package/typings/features/build/services/BundleBuilder.d.ts.map +1 -1
- package/typings/features/build/services/TicConfigService.d.ts +11 -15
- package/typings/features/build/services/TicConfigService.d.ts.map +1 -1
- package/typings/index.d.ts +6 -7
- package/typings/schema/ticConfigSchema.d.ts.map +1 -1
- package/cjm/features/build/domain/configFiles.js +0 -35
- package/typings/features/build/domain/configFiles.d.ts +0 -13
- package/typings/features/build/domain/configFiles.d.ts.map +0 -1
|
@@ -21,15 +21,13 @@ const ts_ioc_container_1 = require("ts-ioc-container");
|
|
|
21
21
|
const GlobalConfig_1 = require("../../../domain/GlobalConfig");
|
|
22
22
|
const HandlebarsRenderService_1 = require("../../../services/HandlebarsRenderService");
|
|
23
23
|
const NodeFileSystemService_1 = require("../../../services/NodeFileSystemService");
|
|
24
|
-
const
|
|
25
|
-
const
|
|
24
|
+
const DomainException_1 = require("../../../exceptions/DomainException");
|
|
25
|
+
const TicConfigService_1 = require("./TicConfigService");
|
|
26
26
|
const emit_1 = require("../domain/emit");
|
|
27
27
|
const glob_1 = require("../domain/glob");
|
|
28
28
|
const scan_1 = require("../domain/scan");
|
|
29
29
|
const tokenCollisions_1 = require("../domain/tokenCollisions");
|
|
30
30
|
const tsconfig_1 = require("../domain/tsconfig");
|
|
31
|
-
const TicConfigService_1 = require("./TicConfigService");
|
|
32
|
-
const DEFAULT_EXCLUDE_GLOBS = BuildConfig_1.DEFAULT_EXCLUDE.map(glob_1.globToRegExp);
|
|
33
31
|
exports.IBundleBuilderKey = new ts_ioc_container_1.SingleToken('IBundleBuilder');
|
|
34
32
|
let BundleBuilder = class BundleBuilder {
|
|
35
33
|
cwd;
|
|
@@ -42,44 +40,53 @@ let BundleBuilder = class BundleBuilder {
|
|
|
42
40
|
this.fs = fs;
|
|
43
41
|
this.renderer = renderer;
|
|
44
42
|
}
|
|
45
|
-
build(
|
|
46
|
-
const resolved =
|
|
47
|
-
?
|
|
48
|
-
: this.configs.load(node_path_1.default.resolve(this.cwd, config));
|
|
49
|
-
const {
|
|
50
|
-
const current = this.fs.fileExists(output) ? this.fs.readFile(output) : undefined;
|
|
51
|
-
const status = current === content ? 'unchanged' : check ? 'stale' : 'written';
|
|
52
|
-
if (status === 'written')
|
|
53
|
-
this.fs.writeFile(output, content);
|
|
43
|
+
build(request) {
|
|
44
|
+
const resolved = 'text' in request
|
|
45
|
+
? this.configs.parse(request.text, this.cwd)
|
|
46
|
+
: this.configs.load(node_path_1.default.resolve(this.cwd, request.config));
|
|
47
|
+
const { content, registrations, warnings } = this.generate(resolved);
|
|
54
48
|
return {
|
|
55
|
-
config: resolved.file,
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
config: 'text' in request ? undefined : resolved.file,
|
|
50
|
+
bundle: resolved.bundleClassName,
|
|
51
|
+
registrations,
|
|
52
|
+
content,
|
|
53
|
+
warnings: [...resolved.warnings, ...warnings],
|
|
58
54
|
};
|
|
59
55
|
}
|
|
60
56
|
generate(config) {
|
|
61
|
-
const
|
|
62
|
-
const
|
|
57
|
+
const paths = (0, tsconfig_1.loadImportPaths)(config.tsconfig, config.importExtension);
|
|
58
|
+
const relative = (file) => (0, glob_1.toPosix)(node_path_1.default.relative(config.dir, file));
|
|
59
|
+
const { include, exclude } = config.glob;
|
|
63
60
|
const isExcluded = (file) => {
|
|
64
|
-
|
|
61
|
+
const filename = relative(file);
|
|
62
|
+
if (include && !include.some((glob) => glob.test(filename)))
|
|
65
63
|
return true;
|
|
66
|
-
|
|
67
|
-
return DEFAULT_EXCLUDE_GLOBS.some((glob) => glob.test(filename));
|
|
64
|
+
return exclude.some((glob) => glob.test(filename));
|
|
68
65
|
};
|
|
69
|
-
const files =
|
|
70
|
-
const
|
|
66
|
+
const files = new Set();
|
|
67
|
+
for (const entry of config.glob.paths) {
|
|
68
|
+
const dir = paths.resolveNamespace(entry.path, config.dir);
|
|
69
|
+
for (const file of (0, scan_1.listSourceFiles)(dir, entry.recursive, isExcluded))
|
|
70
|
+
files.add(file);
|
|
71
|
+
}
|
|
72
|
+
const classes = [...files]
|
|
71
73
|
.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))
|
|
72
74
|
.flatMap((file) => {
|
|
73
75
|
const text = this.fs.readFile(file);
|
|
74
|
-
return text.startsWith(emit_1.GENERATED_HEADER) ? [] : (0, scan_1.findClasses)(file, config.
|
|
76
|
+
return text.startsWith(emit_1.GENERATED_HEADER) ? [] : (0, scan_1.findClasses)(file, config.className, text);
|
|
75
77
|
})
|
|
76
|
-
.map((cls) => ({ ...cls, specifier: paths.specifier(
|
|
78
|
+
.map((cls) => ({ ...cls, specifier: paths.specifier(cls.file) }));
|
|
79
|
+
const uncovered = [...new Set(classes.filter((cls) => cls.specifier === undefined).map((cls) => cls.file))];
|
|
80
|
+
if (uncovered.length > 0) {
|
|
81
|
+
throw new DomainException_1.TicConfigError(`no tsconfig paths alias covers ${uncovered.map((file) => (0, glob_1.toPosix)(node_path_1.default.relative(config.dir, file))).join(', ')}; ` +
|
|
82
|
+
`the bundle goes to stdout, so every import is written through an alias — add a "paths" entry to ${(0, glob_1.toPosix)(node_path_1.default.relative(config.dir, config.tsconfig.file))}`);
|
|
83
|
+
}
|
|
77
84
|
const content = this.renderer.render(emit_1.BUNDLE_PROTOCOL, (0, emit_1.bundleView)({
|
|
78
|
-
name: config.
|
|
79
|
-
|
|
80
|
-
classes,
|
|
85
|
+
name: config.bundleClassName,
|
|
86
|
+
paths: config.glob.paths.map((entry) => entry.path),
|
|
87
|
+
classes: classes.map((cls) => ({ ...cls, specifier: cls.specifier })),
|
|
81
88
|
}));
|
|
82
|
-
return {
|
|
89
|
+
return { content, registrations: classes.length, warnings: (0, tokenCollisions_1.tokenCollisions)(classes) };
|
|
83
90
|
}
|
|
84
91
|
};
|
|
85
92
|
exports.BundleBuilder = BundleBuilder;
|
|
@@ -15,54 +15,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.TicConfigService = exports.ITicConfigServiceKey =
|
|
18
|
+
exports.TicConfigService = exports.ITicConfigServiceKey = void 0;
|
|
19
19
|
const node_path_1 = __importDefault(require("node:path"));
|
|
20
20
|
const ts_ioc_container_1 = require("ts-ioc-container");
|
|
21
|
-
const yaml_1 = require("yaml");
|
|
22
|
-
const GlobalConfig_1 = require("../../../domain/GlobalConfig");
|
|
23
21
|
const DomainException_1 = require("../../../exceptions/DomainException");
|
|
24
22
|
const NodeFileSystemService_1 = require("../../../services/NodeFileSystemService");
|
|
25
23
|
const BuildConfig_1 = require("../BuildConfig");
|
|
26
|
-
const configFiles_1 = require("../domain/configFiles");
|
|
27
|
-
exports.TSCONFIG_FILE = 'tsconfig.json';
|
|
28
24
|
exports.ITicConfigServiceKey = new ts_ioc_container_1.SingleToken('ITicConfigService');
|
|
29
25
|
let TicConfigService = class TicConfigService {
|
|
30
|
-
cwd;
|
|
31
26
|
fs;
|
|
32
|
-
constructor(
|
|
33
|
-
this.cwd = cwd;
|
|
27
|
+
constructor(fs) {
|
|
34
28
|
this.fs = fs;
|
|
35
29
|
}
|
|
36
30
|
load(file) {
|
|
31
|
+
const format = (0, BuildConfig_1.configFormat)(file);
|
|
32
|
+
if (format === undefined)
|
|
33
|
+
throw new DomainException_1.TicConfigError(`expected a .json, .yaml or .yml config file: ${file}`);
|
|
37
34
|
if (!this.fs.fileExists(file))
|
|
38
35
|
throw new DomainException_1.TicConfigError(`config file not found: ${file}`);
|
|
39
|
-
return (0, BuildConfig_1.resolveConfig)(
|
|
36
|
+
return (0, BuildConfig_1.resolveConfig)((0, BuildConfig_1.parseConfig)(this.fs.readFile(file), format), file);
|
|
40
37
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return named.map((config) => node_path_1.default.resolve(this.cwd, config));
|
|
44
|
-
const root = (0, configFiles_1.findPackageRoot)(this.cwd);
|
|
45
|
-
const found = (0, configFiles_1.findConfigFiles)(root);
|
|
46
|
-
if (found.length > 0)
|
|
47
|
-
return found;
|
|
48
|
-
if (this.fs.fileExists(node_path_1.default.join(root, exports.TSCONFIG_FILE)))
|
|
49
|
-
return [undefined];
|
|
50
|
-
throw new DomainException_1.TicConfigError(`no *.bundle.{json,yaml,yml} or ${exports.TSCONFIG_FILE} in ${root}; name a config with --config`);
|
|
38
|
+
parse(text, dir) {
|
|
39
|
+
return (0, BuildConfig_1.resolveConfig)((0, BuildConfig_1.parseConfig)(text, 'yaml'), node_path_1.default.join(dir, BuildConfig_1.STDIN));
|
|
51
40
|
}
|
|
52
41
|
};
|
|
53
42
|
exports.TicConfigService = TicConfigService;
|
|
54
43
|
exports.TicConfigService = TicConfigService = __decorate([
|
|
55
44
|
(0, ts_ioc_container_1.register)(exports.ITicConfigServiceKey),
|
|
56
|
-
__param(0, (0, ts_ioc_container_1.inject)((0,
|
|
57
|
-
|
|
58
|
-
__metadata("design:paramtypes", [String, Object])
|
|
45
|
+
__param(0, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(NodeFileSystemService_1.IFileSystemServiceKey))),
|
|
46
|
+
__metadata("design:paramtypes", [Object])
|
|
59
47
|
], TicConfigService);
|
|
60
|
-
function parseConfig(file, text) {
|
|
61
|
-
const yaml = file.endsWith('.yaml') || file.endsWith('.yml');
|
|
62
|
-
try {
|
|
63
|
-
return yaml ? ((0, yaml_1.parse)(text) ?? {}) : JSON.parse(text);
|
|
64
|
-
}
|
|
65
|
-
catch (e) {
|
|
66
|
-
throw new DomainException_1.TicConfigError(`${file} is not valid ${yaml ? 'YAML' : 'JSON'}: ${e.message}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
package/cjm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ILoggerKey = exports.StdOutputService = exports.IOutputServiceKey = exports.CommonModule = exports.HelpModule = exports.globToRegExp = exports.tokenCollisions = exports.GENERATED_HEADER = exports.BUNDLE_PROTOCOL = exports.bundleView = exports.emitBundle = exports.isSourceFile = exports.findClasses = exports.
|
|
4
|
-
exports.ExceptionHandler = exports.
|
|
3
|
+
exports.ILoggerKey = exports.StdOutputService = exports.IOutputServiceKey = exports.CommonModule = exports.HelpModule = exports.globToRegExp = exports.tokenCollisions = exports.GENERATED_HEADER = exports.BUNDLE_PROTOCOL = exports.bundleView = exports.emitBundle = exports.listSourceFiles = exports.isSourceFile = exports.findClasses = exports.loadImportPaths = exports.ImportPaths = exports.ticConfigJsonSchema = exports.toClassName = exports.DEFAULT_DECORATORS = exports.DEFAULT_EXCLUDE = exports.DEFAULT_TSCONFIG = exports.configFormat = exports.STDIN = exports.CONFIG_FILE_SUFFIXES = exports.parseConfig = exports.BUNDLE_CONFIG_SCHEMA = exports.resolveConfig = exports.ITicConfigServiceKey = exports.TicConfigService = exports.IBundleBuilderKey = exports.BundleBuilder = exports.BUILD_OPTIONS = exports.BuildController = exports.BuildModule = exports.USAGE = exports.IErrorHandlerKey = exports.validate = exports.parseOptions = exports.commandArgs = exports.DEFAULT_ACTION = exports.onDefault = exports.action = exports.Application = exports.globalConfig = exports.GlobalConfigKey = exports.CliIoKey = exports.createContainer = exports.loadConfig = exports.run = exports.build = void 0;
|
|
4
|
+
exports.ExceptionHandler = exports.UsageError = exports.UnknownActionError = exports.UnknownCommandError = exports.MissingCommandError = exports.NamespaceNotFoundError = exports.TicConfigError = exports.TicError = exports.renderProtocol = exports.HandlebarsRenderService = exports.IRenderServiceKey = exports.NodeFileSystemService = exports.IFileSystemServiceKey = exports.ConsoleLogger = void 0;
|
|
5
5
|
var app_1 = require("./app");
|
|
6
6
|
Object.defineProperty(exports, "build", { enumerable: true, get: function () { return app_1.build; } });
|
|
7
7
|
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return app_1.run; } });
|
|
@@ -33,28 +33,27 @@ Object.defineProperty(exports, "IBundleBuilderKey", { enumerable: true, get: fun
|
|
|
33
33
|
var TicConfigService_1 = require("./features/build/services/TicConfigService");
|
|
34
34
|
Object.defineProperty(exports, "TicConfigService", { enumerable: true, get: function () { return TicConfigService_1.TicConfigService; } });
|
|
35
35
|
Object.defineProperty(exports, "ITicConfigServiceKey", { enumerable: true, get: function () { return TicConfigService_1.ITicConfigServiceKey; } });
|
|
36
|
-
Object.defineProperty(exports, "TSCONFIG_FILE", { enumerable: true, get: function () { return TicConfigService_1.TSCONFIG_FILE; } });
|
|
37
36
|
var BuildConfig_1 = require("./features/build/BuildConfig");
|
|
38
37
|
Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return BuildConfig_1.resolveConfig; } });
|
|
39
38
|
Object.defineProperty(exports, "BUNDLE_CONFIG_SCHEMA", { enumerable: true, get: function () { return BuildConfig_1.BUNDLE_CONFIG_SCHEMA; } });
|
|
39
|
+
Object.defineProperty(exports, "parseConfig", { enumerable: true, get: function () { return BuildConfig_1.parseConfig; } });
|
|
40
40
|
Object.defineProperty(exports, "CONFIG_FILE_SUFFIXES", { enumerable: true, get: function () { return BuildConfig_1.CONFIG_FILE_SUFFIXES; } });
|
|
41
|
-
Object.defineProperty(exports, "
|
|
41
|
+
Object.defineProperty(exports, "STDIN", { enumerable: true, get: function () { return BuildConfig_1.STDIN; } });
|
|
42
|
+
Object.defineProperty(exports, "configFormat", { enumerable: true, get: function () { return BuildConfig_1.configFormat; } });
|
|
43
|
+
Object.defineProperty(exports, "DEFAULT_TSCONFIG", { enumerable: true, get: function () { return BuildConfig_1.DEFAULT_TSCONFIG; } });
|
|
42
44
|
Object.defineProperty(exports, "DEFAULT_EXCLUDE", { enumerable: true, get: function () { return BuildConfig_1.DEFAULT_EXCLUDE; } });
|
|
43
|
-
Object.defineProperty(exports, "DEFAULT_BUNDLE_NAME", { enumerable: true, get: function () { return BuildConfig_1.DEFAULT_BUNDLE_NAME; } });
|
|
44
45
|
Object.defineProperty(exports, "DEFAULT_DECORATORS", { enumerable: true, get: function () { return BuildConfig_1.DEFAULT_DECORATORS; } });
|
|
45
46
|
Object.defineProperty(exports, "toClassName", { enumerable: true, get: function () { return BuildConfig_1.toClassName; } });
|
|
46
|
-
var configFiles_1 = require("./features/build/domain/configFiles");
|
|
47
|
-
Object.defineProperty(exports, "findConfigFiles", { enumerable: true, get: function () { return configFiles_1.findConfigFiles; } });
|
|
48
|
-
Object.defineProperty(exports, "findPackageRoot", { enumerable: true, get: function () { return configFiles_1.findPackageRoot; } });
|
|
49
47
|
var ticConfigSchema_1 = require("./schema/ticConfigSchema");
|
|
50
48
|
Object.defineProperty(exports, "ticConfigJsonSchema", { enumerable: true, get: function () { return ticConfigSchema_1.ticConfigJsonSchema; } });
|
|
51
49
|
var ImportPaths_1 = require("./features/build/domain/ImportPaths");
|
|
52
50
|
Object.defineProperty(exports, "ImportPaths", { enumerable: true, get: function () { return ImportPaths_1.ImportPaths; } });
|
|
53
51
|
var tsconfig_1 = require("./features/build/domain/tsconfig");
|
|
54
|
-
Object.defineProperty(exports, "
|
|
52
|
+
Object.defineProperty(exports, "loadImportPaths", { enumerable: true, get: function () { return tsconfig_1.loadImportPaths; } });
|
|
55
53
|
var scan_1 = require("./features/build/domain/scan");
|
|
56
54
|
Object.defineProperty(exports, "findClasses", { enumerable: true, get: function () { return scan_1.findClasses; } });
|
|
57
55
|
Object.defineProperty(exports, "isSourceFile", { enumerable: true, get: function () { return scan_1.isSourceFile; } });
|
|
56
|
+
Object.defineProperty(exports, "listSourceFiles", { enumerable: true, get: function () { return scan_1.listSourceFiles; } });
|
|
58
57
|
var emit_1 = require("./features/build/domain/emit");
|
|
59
58
|
Object.defineProperty(exports, "emitBundle", { enumerable: true, get: function () { return emit_1.emitBundle; } });
|
|
60
59
|
Object.defineProperty(exports, "bundleView", { enumerable: true, get: function () { return emit_1.bundleView; } });
|
|
@@ -84,10 +83,10 @@ Object.defineProperty(exports, "renderProtocol", { enumerable: true, get: functi
|
|
|
84
83
|
var DomainException_1 = require("./exceptions/DomainException");
|
|
85
84
|
Object.defineProperty(exports, "TicError", { enumerable: true, get: function () { return DomainException_1.TicError; } });
|
|
86
85
|
Object.defineProperty(exports, "TicConfigError", { enumerable: true, get: function () { return DomainException_1.TicConfigError; } });
|
|
86
|
+
Object.defineProperty(exports, "NamespaceNotFoundError", { enumerable: true, get: function () { return DomainException_1.NamespaceNotFoundError; } });
|
|
87
87
|
Object.defineProperty(exports, "MissingCommandError", { enumerable: true, get: function () { return DomainException_1.MissingCommandError; } });
|
|
88
88
|
Object.defineProperty(exports, "UnknownCommandError", { enumerable: true, get: function () { return DomainException_1.UnknownCommandError; } });
|
|
89
89
|
Object.defineProperty(exports, "UnknownActionError", { enumerable: true, get: function () { return DomainException_1.UnknownActionError; } });
|
|
90
90
|
Object.defineProperty(exports, "UsageError", { enumerable: true, get: function () { return DomainException_1.UsageError; } });
|
|
91
|
-
Object.defineProperty(exports, "StaleBundlesError", { enumerable: true, get: function () { return DomainException_1.StaleBundlesError; } });
|
|
92
91
|
var ExceptionHandler_1 = require("./exceptions/ExceptionHandler");
|
|
93
92
|
Object.defineProperty(exports, "ExceptionHandler", { enumerable: true, get: function () { return ExceptionHandler_1.ExceptionHandler; } });
|
|
@@ -8,13 +8,17 @@ function ticConfigJsonSchema() {
|
|
|
8
8
|
io: 'input',
|
|
9
9
|
target: 'draft-7',
|
|
10
10
|
unrepresentable: 'any',
|
|
11
|
+
override: ({ jsonSchema }) => {
|
|
12
|
+
if (jsonSchema.type === 'object')
|
|
13
|
+
jsonSchema.additionalProperties = false;
|
|
14
|
+
},
|
|
11
15
|
});
|
|
12
16
|
const { $schema, ...rest } = schema;
|
|
13
17
|
return {
|
|
14
18
|
$schema,
|
|
15
19
|
$id: 'https://github.com/IgorBabkin/ts-ioc-container/tree/main/packages/bundler/tic.schema.json',
|
|
16
20
|
title: '*.bundle.json / *.bundle.yaml',
|
|
17
|
-
description: "One bundle generated by `tic build` (@ts-ioc-container/bundler). `tic build
|
|
21
|
+
description: "One bundle generated by `tic build` (@ts-ioc-container/bundler). `tic build app.bundle.json` prints the bundle to stdout, and `cat app.bundle.json | tic build` reads the config from stdin. Relative paths resolve against this file's directory (for piped text, the working directory).",
|
|
18
22
|
...rest,
|
|
19
23
|
};
|
|
20
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-ioc-container/bundler",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.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",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"reflect-metadata": "^0.2.2",
|
|
53
53
|
"yaml": "^2.8.3",
|
|
54
54
|
"zod": "^4.6.5",
|
|
55
|
-
"ts-ioc-container": "
|
|
55
|
+
"ts-ioc-container": "76.0.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"typescript": ">=5"
|
package/tic.schema.json
CHANGED
|
@@ -2,113 +2,157 @@
|
|
|
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
4
|
"title": "*.bundle.json / *.bundle.yaml",
|
|
5
|
-
"description": "One bundle generated by `tic build` (@ts-ioc-container/bundler). `tic build
|
|
5
|
+
"description": "One bundle generated by `tic build` (@ts-ioc-container/bundler). `tic build app.bundle.json` prints the bundle to stdout, and `cat app.bundle.json | tic build` reads the config from stdin. Relative paths resolve against this file's directory (for piped text, the working directory).",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"$schema": {
|
|
9
9
|
"type": "string"
|
|
10
10
|
},
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"description": "The tsconfig this bundle extends, as a tsconfig's own `extends`: its file set, `paths` aliases and module resolution apply unless this file overrides them. Relative to this file. The default may be absent; a tsconfig named here must exist.",
|
|
11
|
+
"name": {
|
|
12
|
+
"description": "The bundle's name: letters, digits, \"-\" and \"_\", starting with a letter. Default: the config file's stem (production.bundle.json → production); required for a config file named otherwise. It names the generated IContainerModule class (ProductionBundle).",
|
|
14
13
|
"type": "string",
|
|
15
|
-
"
|
|
14
|
+
"pattern": "^[A-Za-z][\\w-]*$"
|
|
16
15
|
},
|
|
17
|
-
"
|
|
18
|
-
"
|
|
16
|
+
"tsconfig": {
|
|
17
|
+
"default": "./tsconfig.json",
|
|
18
|
+
"description": "The tsconfig whose `paths` aliases glob.paths may name and generated imports are written in, and whose module resolution sets the import extension. It adds no files: the bundle scans glob.paths alone. Relative to the config file. The default may be absent; a tsconfig named here must exist.",
|
|
19
19
|
"type": "string",
|
|
20
20
|
"minLength": 1
|
|
21
21
|
},
|
|
22
|
-
"
|
|
23
|
-
"description": "
|
|
24
|
-
"type": "string"
|
|
25
|
-
"pattern": "^[A-Za-z][\\w-]*$"
|
|
26
|
-
},
|
|
27
|
-
"include": {
|
|
28
|
-
"description": "tsconfig `include`: replaces the extended tsconfig's. Relative to this file.",
|
|
29
|
-
"type": "array",
|
|
30
|
-
"items": {
|
|
31
|
-
"type": "string",
|
|
32
|
-
"minLength": 1
|
|
33
|
-
}
|
|
22
|
+
"importExtension": {
|
|
23
|
+
"description": "Extension of generated imports, e.g. \".js\". Inferred from the tsconfig: \".js\" under node16/nodenext resolution, none otherwise.",
|
|
24
|
+
"type": "string"
|
|
34
25
|
},
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
"glob": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"properties": {
|
|
29
|
+
"paths": {
|
|
30
|
+
"minItems": 1,
|
|
31
|
+
"type": "array",
|
|
32
|
+
"items": {
|
|
33
|
+
"anyOf": [
|
|
34
|
+
{
|
|
35
|
+
"type": "string",
|
|
36
|
+
"minLength": 1
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "object",
|
|
40
|
+
"properties": {
|
|
41
|
+
"path": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"minLength": 1
|
|
44
|
+
},
|
|
45
|
+
"recursive": {
|
|
46
|
+
"default": true,
|
|
47
|
+
"type": "boolean"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"required": [
|
|
51
|
+
"path"
|
|
52
|
+
],
|
|
53
|
+
"additionalProperties": false
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"description": "Folders to scan: paths relative to the config file (./src/services) or tsconfig paths aliases (@app/services). Sub-folders are scanned too unless an entry says { \"path\": \"...\", \"recursive\": false }."
|
|
58
|
+
},
|
|
59
|
+
"include": {
|
|
60
|
+
"description": "Globs a file must match one of, e.g. [\"**/*.service.ts\", \"**/*.repository.ts\"]. Default: every source file.",
|
|
61
|
+
"type": "array",
|
|
62
|
+
"items": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"minLength": 1
|
|
65
|
+
},
|
|
66
|
+
"minItems": 1
|
|
67
|
+
},
|
|
68
|
+
"exclude": {
|
|
69
|
+
"default": [
|
|
70
|
+
"**/*.spec.ts",
|
|
71
|
+
"**/*.test.ts",
|
|
72
|
+
"**/*.spec.tsx",
|
|
73
|
+
"**/*.test.tsx",
|
|
74
|
+
"**/__tests__/**",
|
|
75
|
+
"**/node_modules/**"
|
|
76
|
+
],
|
|
77
|
+
"description": "Globs of files never read. Replaces the default when given. A non-empty list that omits a default glob makes `tic build` warn.",
|
|
78
|
+
"type": "array",
|
|
79
|
+
"items": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"minLength": 1
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"required": [
|
|
86
|
+
"paths"
|
|
87
|
+
],
|
|
88
|
+
"additionalProperties": false,
|
|
89
|
+
"description": "Which files this bundle reads and parses — decided by path alone, before parsing. `paths` are the folders the files come from; within them a file is parsed when it matches one of `include` and none of `exclude`. Globs are relative to the config file. With a file naming convention, `include` keeps every other file unread."
|
|
42
90
|
},
|
|
43
|
-
"
|
|
91
|
+
"className": {
|
|
44
92
|
"type": "object",
|
|
45
93
|
"properties": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
94
|
+
"export": {
|
|
95
|
+
"default": "any",
|
|
96
|
+
"description": "Which exports count.",
|
|
97
|
+
"type": "string",
|
|
98
|
+
"enum": [
|
|
99
|
+
"any",
|
|
100
|
+
"named",
|
|
101
|
+
"default"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
"decorators": {
|
|
105
|
+
"default": [
|
|
106
|
+
"register"
|
|
107
|
+
],
|
|
108
|
+
"description": "The class must carry one of these decorators, recognised by name (e.g. \"register\", or a composed decorator). Default [\"register\"]; [] requires none.",
|
|
109
|
+
"type": "array",
|
|
110
|
+
"items": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"minLength": 1
|
|
113
|
+
}
|
|
49
114
|
},
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
"default": "any",
|
|
55
|
-
"description": "Which exports count.",
|
|
115
|
+
"glob": {
|
|
116
|
+
"description": "Glob, or globs, the class name must match one of, e.g. \"*Service\" or [\"*Service\", \"*Repository\"]. An anonymous default export is named after its file.",
|
|
117
|
+
"anyOf": [
|
|
118
|
+
{
|
|
56
119
|
"type": "string",
|
|
57
|
-
"
|
|
120
|
+
"minLength": 1
|
|
58
121
|
},
|
|
59
|
-
|
|
60
|
-
"default": ["register"],
|
|
61
|
-
"description": "The class must carry one of these decorators, recognised by name (e.g. \"register\", or a composed decorator). Default [\"register\"]; [] requires none.",
|
|
122
|
+
{
|
|
62
123
|
"type": "array",
|
|
63
124
|
"items": {
|
|
64
125
|
"type": "string",
|
|
65
126
|
"minLength": 1
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
127
|
+
},
|
|
128
|
+
"minItems": 1
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
"exclude": {
|
|
133
|
+
"description": "Glob, or globs, the class name must match none of, applied after every other criterion. A plain name is a glob too: [\"MockUserRepository\", \"*Fake\"].",
|
|
134
|
+
"anyOf": [
|
|
135
|
+
{
|
|
70
136
|
"type": "string",
|
|
71
137
|
"minLength": 1
|
|
72
138
|
},
|
|
73
|
-
|
|
74
|
-
"description": "Class names to drop after selection, e.g. one test double sitting next to the real registration in the same file.",
|
|
139
|
+
{
|
|
75
140
|
"type": "array",
|
|
76
141
|
"items": {
|
|
77
142
|
"type": "string",
|
|
78
143
|
"minLength": 1
|
|
79
144
|
},
|
|
80
145
|
"minItems": 1
|
|
81
|
-
},
|
|
82
|
-
"excludeName": {
|
|
83
|
-
"description": "Glob the class name must NOT match, e.g. \"*Mock\". An anonymous default export is named after its file.",
|
|
84
|
-
"type": "string",
|
|
85
|
-
"minLength": 1
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"additionalProperties": false,
|
|
89
|
-
"description": "Which classes of a scanned 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."
|
|
90
|
-
},
|
|
91
|
-
"paths": {
|
|
92
|
-
"description": "tsconfig `paths`: aliases the generated imports are written in.",
|
|
93
|
-
"type": "object",
|
|
94
|
-
"propertyNames": {
|
|
95
|
-
"type": "string"
|
|
96
|
-
},
|
|
97
|
-
"additionalProperties": {
|
|
98
|
-
"type": "array",
|
|
99
|
-
"items": {
|
|
100
|
-
"type": "string"
|
|
101
146
|
}
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
"rootDir": {
|
|
105
|
-
"description": "tsconfig `rootDir`: where the default output (<rootDir>/<name>.bundle.ts) goes.",
|
|
106
|
-
"type": "string"
|
|
147
|
+
]
|
|
107
148
|
}
|
|
108
149
|
},
|
|
109
|
-
"additionalProperties":
|
|
110
|
-
"description": "
|
|
150
|
+
"additionalProperties": false,
|
|
151
|
+
"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."
|
|
111
152
|
}
|
|
112
153
|
},
|
|
154
|
+
"required": [
|
|
155
|
+
"glob"
|
|
156
|
+
],
|
|
113
157
|
"additionalProperties": false
|
|
114
158
|
}
|
package/tpl/index.cjs
CHANGED
|
@@ -10,10 +10,10 @@ templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,par
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
return "import "
|
|
13
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"defaultName") : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":
|
|
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(4, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":
|
|
13
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"defaultName") : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":5,"column":7},"end":{"line":5,"column":79}}})) != null ? stack1 : "")
|
|
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(4, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":5,"column":79},"end":{"line":5,"column":131}}})) != null ? stack1 : "")
|
|
15
15
|
+ " from '"
|
|
16
|
-
+ ((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":
|
|
16
|
+
+ ((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
17
|
+ "';\n";
|
|
18
18
|
},"2":function(container,depth0,helpers,partials,data) {
|
|
19
19
|
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
@@ -23,8 +23,8 @@ templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,par
|
|
|
23
23
|
return undefined
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
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":
|
|
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(3, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":
|
|
26
|
+
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(3, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":5,"column":43},"end":{"line":5,"column":72}}})) != null ? stack1 : "");
|
|
28
28
|
},"3":function(container,depth0,helpers,partials,data) {
|
|
29
29
|
return ", ";
|
|
30
30
|
},"4":function(container,depth0,helpers,partials,data) {
|
|
@@ -36,7 +36,7 @@ templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,par
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
return "{ "
|
|
39
|
-
+ ((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":
|
|
39
|
+
+ ((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
40
|
+ " }";
|
|
41
41
|
},"5":function(container,depth0,helpers,partials,data) {
|
|
42
42
|
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
@@ -47,7 +47,7 @@ templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,par
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
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(6, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":
|
|
50
|
+
+ ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"registrations") : depth0),{"name":"each","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":10,"column":0},"end":{"line":12,"column":9}}})) != null ? stack1 : "")
|
|
51
51
|
+ "];\n";
|
|
52
52
|
},"6":function(container,depth0,helpers,partials,data) {
|
|
53
53
|
var stack1;
|
|
@@ -58,22 +58,22 @@ templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,par
|
|
|
58
58
|
},"7":function(container,depth0,helpers,partials,data) {
|
|
59
59
|
return "export const registrations: IRegistration[] = [];\n";
|
|
60
60
|
},"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
|
61
|
-
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing,
|
|
61
|
+
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
62
62
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
63
63
|
return parent[propertyName];
|
|
64
64
|
}
|
|
65
65
|
return undefined
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
return "// Generated by `tic build
|
|
69
|
-
+ ((stack1 = ((
|
|
70
|
-
+ "
|
|
71
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"registrations") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(0, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":
|
|
68
|
+
return "// Generated by `tic build`. Do not edit by hand.\n// Paths: "
|
|
69
|
+
+ ((stack1 = (lookupProperty(helpers,"join")||(depth0 && lookupProperty(depth0,"join"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"paths") : depth0),", ",{"name":"join","hash":{},"data":data,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":31}}})) != null ? stack1 : "")
|
|
70
|
+
+ "\nimport { type IContainer, type IContainerModule, type IRegistration"
|
|
71
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"registrations") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(0, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":67},"end":{"line":3,"column":116}}})) != null ? stack1 : "")
|
|
72
72
|
+ " } from 'ts-ioc-container';\n"
|
|
73
|
-
+ ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"imports") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":
|
|
73
|
+
+ ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"imports") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":4,"column":0},"end":{"line":6,"column":9}}})) != null ? stack1 : "")
|
|
74
74
|
+ "\n"
|
|
75
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"registrations") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.program(7, data, 0),"data":data,"loc":{"start":{"line":
|
|
75
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"registrations") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.program(7, data, 0),"data":data,"loc":{"start":{"line":8,"column":0},"end":{"line":16,"column":7}}})) != null ? stack1 : "")
|
|
76
76
|
+ "\nexport class "
|
|
77
|
-
+ ((stack1 = ((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper ===
|
|
77
|
+
+ ((stack1 = ((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === "function" ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":18,"column":13},"end":{"line":18,"column":23}}}) : helper))) != null ? stack1 : "")
|
|
78
78
|
+ " implements IContainerModule {\n applyTo(container: IContainer): void {\n for (const registration of registrations) container.addRegistration(registration);\n }\n}\n";
|
|
79
79
|
},"useData":true});
|
package/typings/app.d.ts
CHANGED
|
@@ -8,16 +8,17 @@ export declare function createContainer(io?: CliIo): IContainer;
|
|
|
8
8
|
/** Runs the `tic` CLI and returns its exit code; output goes through `io`. */
|
|
9
9
|
export declare function run(argv: string[], io?: CliIo): number;
|
|
10
10
|
/**
|
|
11
|
-
* Generates the bundle a config describes —
|
|
12
|
-
*
|
|
11
|
+
* Generates the bundle a config file describes — `tic build` as a function — and returns
|
|
12
|
+
* it; nothing is written.
|
|
13
13
|
*
|
|
14
|
-
* @throws {TicConfigError} when the config or the
|
|
14
|
+
* @throws {TicConfigError} when the config file is missing or unreadable, the config or its tsconfig is invalid, the bundle has no name, or no tsconfig paths alias covers a selected class's file.
|
|
15
|
+
* @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
|
|
15
16
|
*/
|
|
16
|
-
export declare function build({ cwd, ...request }
|
|
17
|
+
export declare function build({ cwd, ...request }: BuildOptions): BuildResult;
|
|
17
18
|
/**
|
|
18
|
-
* Reads and validates a
|
|
19
|
+
* Reads and validates a config file: JSON for `.json`, YAML for `.yaml` / `.yml`.
|
|
19
20
|
*
|
|
20
|
-
* @throws {TicConfigError} when the file is missing, cannot be parsed, or does not match the config shape.
|
|
21
|
+
* @throws {TicConfigError} when the file is missing, has another extension, cannot be parsed, or does not match the config shape.
|
|
21
22
|
*/
|
|
22
23
|
export declare function loadConfig(file: string): ResolvedConfig;
|
|
23
24
|
//# sourceMappingURL=app.d.ts.map
|