@ts-ioc-container/bundler 1.5.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +47 -31
- package/README.md +157 -280
- package/cjm/app.js +39 -0
- package/cjm/bin.js +2 -2
- package/cjm/cli/Application.js +58 -0
- package/cjm/cli/IErrorHandler.js +5 -0
- package/cjm/cli/decorators.js +9 -0
- package/cjm/cli/index.js +17 -0
- package/cjm/cli/options.js +25 -0
- package/cjm/cli/usage.js +19 -0
- package/cjm/domain/CliIo.js +7 -0
- package/cjm/domain/GlobalConfig.js +7 -0
- package/cjm/exceptions/DomainException.js +54 -0
- package/cjm/exceptions/ExceptionHandler.js +38 -0
- package/cjm/features/build/BuildConfig.js +183 -0
- package/cjm/features/build/BuildController.js +91 -0
- package/cjm/features/build/BuildModule.js +16 -0
- package/cjm/{ImportPaths.js → features/build/domain/ImportPaths.js} +7 -29
- package/cjm/features/build/domain/configFiles.js +35 -0
- package/cjm/{emit.js → features/build/domain/emit.js} +10 -9
- package/cjm/{scan.js → features/build/domain/scan.js} +6 -3
- package/cjm/features/build/domain/tokenCollisions.js +29 -0
- package/cjm/features/build/domain/tsconfig.js +78 -0
- package/cjm/features/build/services/BundleBuilder.js +116 -0
- package/cjm/features/build/services/TicConfigService.js +68 -0
- package/cjm/features/help/HelpController.js +39 -0
- package/cjm/features/help/HelpModule.js +12 -0
- package/cjm/features/help/VersionController.js +45 -0
- package/cjm/index.js +87 -28
- package/cjm/modules/CommonModule.js +28 -0
- package/cjm/schema/ticConfigSchema.js +24 -0
- package/cjm/services/ConsoleLogger.js +36 -0
- package/cjm/services/HandlebarsRenderService.js +33 -0
- package/cjm/services/NodeFileSystemService.js +32 -0
- package/cjm/services/OutputService.js +33 -0
- package/package.json +10 -7
- package/tic.schema.json +118 -147
- package/tpl/index.cjs +36 -16
- package/typings/app.d.ts +24 -0
- package/typings/cli/Application.d.ts +16 -0
- package/typings/cli/Application.d.ts.map +1 -0
- package/typings/cli/IErrorHandler.d.ts +7 -0
- package/typings/cli/IErrorHandler.d.ts.map +1 -0
- package/typings/cli/decorators.d.ts +10 -0
- package/typings/cli/decorators.d.ts.map +1 -0
- package/typings/cli/index.d.ts +6 -0
- package/typings/cli/index.d.ts.map +1 -0
- package/typings/cli/options.d.ts +23 -0
- package/typings/cli/options.d.ts.map +1 -0
- package/typings/cli/usage.d.ts +2 -0
- package/typings/cli/usage.d.ts.map +1 -0
- package/typings/domain/CliIo.d.ts +10 -0
- package/typings/domain/CliIo.d.ts.map +1 -0
- package/typings/domain/GlobalConfig.d.ts +10 -0
- package/typings/domain/GlobalConfig.d.ts.map +1 -0
- package/typings/exceptions/DomainException.d.ts +37 -0
- package/typings/exceptions/DomainException.d.ts.map +1 -0
- package/typings/exceptions/ExceptionHandler.d.ts +12 -0
- package/typings/exceptions/ExceptionHandler.d.ts.map +1 -0
- package/typings/features/build/BuildConfig.d.ts +179 -0
- package/typings/features/build/BuildConfig.d.ts.map +1 -0
- package/typings/features/build/BuildController.d.ts +32 -0
- package/typings/features/build/BuildController.d.ts.map +1 -0
- package/typings/features/build/BuildModule.d.ts +5 -0
- package/typings/features/build/BuildModule.d.ts.map +1 -0
- package/typings/{ImportPaths.d.ts → features/build/domain/ImportPaths.d.ts} +4 -16
- package/typings/features/build/domain/ImportPaths.d.ts.map +1 -0
- package/typings/features/build/domain/configFiles.d.ts +13 -0
- package/typings/features/build/domain/configFiles.d.ts.map +1 -0
- package/typings/features/build/domain/emit.d.ts +42 -0
- package/typings/features/build/domain/emit.d.ts.map +1 -0
- package/typings/features/build/domain/glob.d.ts.map +1 -0
- package/typings/{scan.d.ts → features/build/domain/scan.d.ts} +4 -2
- package/typings/features/build/domain/scan.d.ts.map +1 -0
- package/typings/features/build/domain/tokenCollisions.d.ts +14 -0
- package/typings/features/build/domain/tokenCollisions.d.ts.map +1 -0
- package/typings/features/build/domain/tsconfig.d.ts +25 -0
- package/typings/features/build/domain/tsconfig.d.ts.map +1 -0
- package/typings/features/build/services/BundleBuilder.d.ts +68 -0
- package/typings/features/build/services/BundleBuilder.d.ts.map +1 -0
- package/typings/features/build/services/TicConfigService.d.ts +37 -0
- package/typings/features/build/services/TicConfigService.d.ts.map +1 -0
- package/typings/features/help/HelpController.d.ts +8 -0
- package/typings/features/help/HelpController.d.ts.map +1 -0
- package/typings/features/help/HelpModule.d.ts +5 -0
- package/typings/features/help/HelpModule.d.ts.map +1 -0
- package/typings/features/help/VersionController.d.ts +8 -0
- package/typings/features/help/VersionController.d.ts.map +1 -0
- package/typings/index.d.ts +25 -11
- package/typings/modules/CommonModule.d.ts +9 -0
- package/typings/modules/CommonModule.d.ts.map +1 -0
- package/typings/schema/ticConfigSchema.d.ts +7 -0
- package/typings/schema/ticConfigSchema.d.ts.map +1 -0
- package/typings/services/ConsoleLogger.d.ts +20 -0
- package/typings/services/ConsoleLogger.d.ts.map +1 -0
- package/typings/services/HandlebarsRenderService.d.ts +23 -0
- package/typings/services/HandlebarsRenderService.d.ts.map +1 -0
- package/typings/services/NodeFileSystemService.d.ts +21 -0
- package/typings/services/NodeFileSystemService.d.ts.map +1 -0
- package/typings/services/OutputService.d.ts +13 -0
- package/typings/services/OutputService.d.ts.map +1 -0
- package/cjm/build.js +0 -132
- package/cjm/cli.js +0 -84
- package/cjm/config.js +0 -162
- package/cjm/errors.js +0 -15
- package/cjm/exportPredicate.js +0 -13
- package/cjm/inclusion.js +0 -24
- package/cjm/predicateFile.js +0 -30
- package/cjm/render.js +0 -15
- package/cjm/utils.js +0 -2
- package/typings/build.d.ts +0 -45
- package/typings/cli.d.ts +0 -8
- package/typings/config.d.ts +0 -123
- package/typings/emit.d.ts +0 -18
- package/typings/errors.d.ts +0 -13
- package/typings/exportPredicate.d.ts +0 -36
- package/typings/inclusion.d.ts +0 -42
- package/typings/predicateFile.d.ts +0 -16
- package/typings/render.d.ts +0 -8
- package/typings/utils.d.ts +0 -3
- /package/cjm/{glob.js → features/build/domain/glob.js} +0 -0
- /package/typings/{glob.d.ts → features/build/domain/glob.d.ts} +0 -0
package/cjm/cli.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.run = run;
|
|
7
|
-
const node_fs_1 = require("node:fs");
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const build_1 = require("./build");
|
|
10
|
-
const errors_1 = require("./errors");
|
|
11
|
-
const USAGE = [
|
|
12
|
-
'Usage: ts-ioc-container <command> [options]',
|
|
13
|
-
' tic is a shortcut for ts-ioc-container',
|
|
14
|
-
'',
|
|
15
|
-
'Commands:',
|
|
16
|
-
' ts-ioc-container build [--config <path>] [--check] generate the bundles described by tic.config.json',
|
|
17
|
-
'',
|
|
18
|
-
'Options:',
|
|
19
|
-
' -c, --config <path> config file (default: tic.config.json)',
|
|
20
|
-
' --check write nothing; exit 1 when a generated bundle is out of date',
|
|
21
|
-
' -h, --help show this help',
|
|
22
|
-
' -v, --version show the version',
|
|
23
|
-
].join('\n');
|
|
24
|
-
const VERB = { written: 'wrote', unchanged: 'unchanged', stale: 'stale' };
|
|
25
|
-
const plural = (n) => `${n} registration${n === 1 ? '' : 's'}`;
|
|
26
|
-
function version() {
|
|
27
|
-
return JSON.parse((0, node_fs_1.readFileSync)(node_path_1.default.join(__dirname, '..', 'package.json'), 'utf8')).version;
|
|
28
|
-
}
|
|
29
|
-
class UsageError extends errors_1.TicError {
|
|
30
|
-
}
|
|
31
|
-
function parseBuildArgs(args) {
|
|
32
|
-
const options = { check: false };
|
|
33
|
-
for (let i = 0; i < args.length; i++) {
|
|
34
|
-
const arg = args[i];
|
|
35
|
-
if (arg === '--check')
|
|
36
|
-
options.check = true;
|
|
37
|
-
else if (arg === '--config' || arg === '-c') {
|
|
38
|
-
options.config = args[++i];
|
|
39
|
-
if (!options.config)
|
|
40
|
-
throw new UsageError(`${arg} needs a path`);
|
|
41
|
-
}
|
|
42
|
-
else if (arg.startsWith('--config='))
|
|
43
|
-
options.config = arg.slice('--config='.length);
|
|
44
|
-
else
|
|
45
|
-
throw new UsageError(`unknown option "${arg}"`);
|
|
46
|
-
}
|
|
47
|
-
return options;
|
|
48
|
-
}
|
|
49
|
-
function run(argv, io = { cwd: process.cwd(), stdout: console.log, stderr: console.error }) {
|
|
50
|
-
const [command, ...rest] = argv;
|
|
51
|
-
if (command === '--help' || command === '-h' || command === 'help') {
|
|
52
|
-
io.stdout(USAGE);
|
|
53
|
-
return 0;
|
|
54
|
-
}
|
|
55
|
-
if (command === '--version' || command === '-v') {
|
|
56
|
-
io.stdout(version());
|
|
57
|
-
return 0;
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
if (command !== 'build') {
|
|
61
|
-
io.stderr(command ? `tic: unknown command "${command}"` : USAGE);
|
|
62
|
-
return 1;
|
|
63
|
-
}
|
|
64
|
-
const { config, check } = parseBuildArgs(rest);
|
|
65
|
-
const { outputs, warnings } = (0, build_1.build)({ config, check, cwd: io.cwd });
|
|
66
|
-
for (const warning of warnings)
|
|
67
|
-
io.stderr(`tic: warning: ${warning}`);
|
|
68
|
-
for (const { status, file, registrations } of outputs) {
|
|
69
|
-
io.stdout(`${VERB[status].padEnd(10)}${node_path_1.default.relative(io.cwd, file)} (${plural(registrations)})`);
|
|
70
|
-
}
|
|
71
|
-
const stale = outputs.filter((o) => o.status === 'stale').length;
|
|
72
|
-
if (stale > 0) {
|
|
73
|
-
io.stderr(`tic: ${stale} generated bundle${stale === 1 ? ' is' : 's are'} out of date — run \`tic build\``);
|
|
74
|
-
return 1;
|
|
75
|
-
}
|
|
76
|
-
return 0;
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
if (!(e instanceof errors_1.TicError))
|
|
80
|
-
throw e;
|
|
81
|
-
io.stderr(`tic: ${e.message}`);
|
|
82
|
-
return 1;
|
|
83
|
-
}
|
|
84
|
-
}
|
package/cjm/config.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DEFAULT_EXCLUDE = exports.DEFAULT_BUNDLE_NAME = exports.DEFAULT_CONFIG_FILE = void 0;
|
|
7
|
-
exports.resolveConfig = resolveConfig;
|
|
8
|
-
exports.loadConfig = loadConfig;
|
|
9
|
-
const node_fs_1 = require("node:fs");
|
|
10
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
-
const errors_1 = require("./errors");
|
|
12
|
-
const glob_1 = require("./glob");
|
|
13
|
-
exports.DEFAULT_CONFIG_FILE = 'tic.config.json';
|
|
14
|
-
exports.DEFAULT_BUNDLE_NAME = 'Bundle';
|
|
15
|
-
exports.DEFAULT_EXCLUDE = [
|
|
16
|
-
'**/*.spec.ts',
|
|
17
|
-
'**/*.test.ts',
|
|
18
|
-
'**/*.spec.tsx',
|
|
19
|
-
'**/*.test.tsx',
|
|
20
|
-
'**/__tests__/**',
|
|
21
|
-
'**/node_modules/**',
|
|
22
|
-
];
|
|
23
|
-
const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
24
|
-
const isNonEmptyString = (value) => typeof value === 'string' && value.length > 0;
|
|
25
|
-
const isStringArray = (value) => Array.isArray(value) && value.every(isNonEmptyString);
|
|
26
|
-
const isIdentifier = (value) => typeof value === 'string' && /^[A-Za-z_$][\w$]*$/.test(value);
|
|
27
|
-
const fail = (field, expected) => {
|
|
28
|
-
throw new errors_1.TicConfigError(`${field}: expected ${expected}`);
|
|
29
|
-
};
|
|
30
|
-
function toNamespace(value, field) {
|
|
31
|
-
if (isNonEmptyString(value))
|
|
32
|
-
return { path: value, recursive: true };
|
|
33
|
-
if (!isObject(value))
|
|
34
|
-
return fail(field, 'a string or an object with "path"');
|
|
35
|
-
if (!isNonEmptyString(value.path))
|
|
36
|
-
return fail(`${field}.path`, 'a non-empty string');
|
|
37
|
-
if (value.recursive !== undefined && typeof value.recursive !== 'boolean')
|
|
38
|
-
return fail(`${field}.recursive`, 'a boolean');
|
|
39
|
-
return { path: value.path, recursive: value.recursive ?? true };
|
|
40
|
-
}
|
|
41
|
-
const SELECTOR_FIELDS = new Set([
|
|
42
|
-
'export',
|
|
43
|
-
'decorators',
|
|
44
|
-
'nameGlob',
|
|
45
|
-
'excludeClasses',
|
|
46
|
-
'excludeNameGlob',
|
|
47
|
-
'excludeAliases',
|
|
48
|
-
]);
|
|
49
|
-
function toSelector(value, field) {
|
|
50
|
-
if (value === undefined)
|
|
51
|
-
return { export: 'any' };
|
|
52
|
-
if (!isObject(value))
|
|
53
|
-
return fail(field, 'an object');
|
|
54
|
-
const unknown = Object.keys(value).find((key) => !SELECTOR_FIELDS.has(key));
|
|
55
|
-
if (unknown)
|
|
56
|
-
throw new errors_1.TicConfigError(`${field}.${unknown}: unknown field`);
|
|
57
|
-
const { export: kind, decorators, nameGlob, excludeClasses, excludeNameGlob, excludeAliases } = value;
|
|
58
|
-
if (kind !== undefined && kind !== 'any' && kind !== 'named' && kind !== 'default') {
|
|
59
|
-
return fail(`${field}.export`, '"any", "named" or "default"');
|
|
60
|
-
}
|
|
61
|
-
if (decorators !== undefined && !(isStringArray(decorators) && decorators.length > 0)) {
|
|
62
|
-
return fail(`${field}.decorators`, 'a non-empty array of strings');
|
|
63
|
-
}
|
|
64
|
-
if (nameGlob !== undefined && !isNonEmptyString(nameGlob))
|
|
65
|
-
return fail(`${field}.nameGlob`, 'a non-empty string');
|
|
66
|
-
if (excludeClasses !== undefined && !(isStringArray(excludeClasses) && excludeClasses.length > 0)) {
|
|
67
|
-
return fail(`${field}.excludeClasses`, 'a non-empty array of strings');
|
|
68
|
-
}
|
|
69
|
-
if (excludeNameGlob !== undefined && !isNonEmptyString(excludeNameGlob)) {
|
|
70
|
-
return fail(`${field}.excludeNameGlob`, 'a non-empty string');
|
|
71
|
-
}
|
|
72
|
-
if (excludeAliases !== undefined && !(isStringArray(excludeAliases) && excludeAliases.length > 0)) {
|
|
73
|
-
return fail(`${field}.excludeAliases`, 'a non-empty array of strings');
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
export: kind ?? 'any',
|
|
77
|
-
decorators,
|
|
78
|
-
nameGlob: nameGlob === undefined ? undefined : (0, glob_1.globToRegExp)(nameGlob),
|
|
79
|
-
excludeClasses,
|
|
80
|
-
excludeNameGlob: excludeNameGlob === undefined ? undefined : (0, glob_1.globToRegExp)(excludeNameGlob),
|
|
81
|
-
excludeAliases,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function toBundle(value, field, dir) {
|
|
85
|
-
if (!isObject(value))
|
|
86
|
-
return fail(field, 'an object');
|
|
87
|
-
const { output, name, tags, namespaces, select, exclude, additionalExclude, include, filterExports } = value;
|
|
88
|
-
if (!isNonEmptyString(output))
|
|
89
|
-
return fail(`${field}.output`, 'a non-empty string');
|
|
90
|
-
if (name !== undefined && !isIdentifier(name))
|
|
91
|
-
return fail(`${field}.name`, 'a valid identifier');
|
|
92
|
-
if (tags !== undefined && !isStringArray(tags))
|
|
93
|
-
return fail(`${field}.tags`, 'an array of strings');
|
|
94
|
-
if (!Array.isArray(namespaces) || namespaces.length === 0)
|
|
95
|
-
return fail(`${field}.namespaces`, 'a non-empty array');
|
|
96
|
-
if (exclude !== undefined && !isStringArray(exclude))
|
|
97
|
-
return fail(`${field}.exclude`, 'an array of strings');
|
|
98
|
-
if (additionalExclude !== undefined && !isStringArray(additionalExclude)) {
|
|
99
|
-
return fail(`${field}.additionalExclude`, 'an array of strings');
|
|
100
|
-
}
|
|
101
|
-
if (include !== undefined && !isNonEmptyString(include))
|
|
102
|
-
return fail(`${field}.include`, 'a non-empty string');
|
|
103
|
-
if (filterExports !== undefined && !isNonEmptyString(filterExports)) {
|
|
104
|
-
return fail(`${field}.filterExports`, 'a non-empty string');
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
output: node_path_1.default.resolve(dir, output),
|
|
108
|
-
name: name ?? exports.DEFAULT_BUNDLE_NAME,
|
|
109
|
-
tags: tags ?? [],
|
|
110
|
-
namespaces: namespaces.map((ns, i) => toNamespace(ns, `${field}.namespaces[${i}]`)),
|
|
111
|
-
select: toSelector(select, `${field}.select`),
|
|
112
|
-
exclude: [...(exclude ?? exports.DEFAULT_EXCLUDE), ...(additionalExclude ?? [])],
|
|
113
|
-
include: include === undefined ? undefined : node_path_1.default.resolve(dir, include),
|
|
114
|
-
filterExports: filterExports === undefined ? undefined : node_path_1.default.resolve(dir, filterExports),
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function excludeWarnings(value, field) {
|
|
118
|
-
if (!isObject(value))
|
|
119
|
-
return [];
|
|
120
|
-
const exclude = value.exclude;
|
|
121
|
-
if (!isStringArray(exclude) || exclude.length === 0)
|
|
122
|
-
return [];
|
|
123
|
-
const missing = exports.DEFAULT_EXCLUDE.filter((glob) => !exclude.includes(glob));
|
|
124
|
-
if (missing.length === 0)
|
|
125
|
-
return [];
|
|
126
|
-
return [
|
|
127
|
-
`${field}.exclude replaces the default excludes and omits ${missing.map((glob) => `"${glob}"`).join(', ')}; ` +
|
|
128
|
-
`add them back or use ${field}.additionalExclude`,
|
|
129
|
-
];
|
|
130
|
-
}
|
|
131
|
-
function resolveConfig(content, file) {
|
|
132
|
-
const dir = node_path_1.default.dirname(file);
|
|
133
|
-
if (!isObject(content))
|
|
134
|
-
return fail('config', 'a JSON object');
|
|
135
|
-
const { tsconfig, importExtension, bundles } = content;
|
|
136
|
-
if (tsconfig !== undefined && !isNonEmptyString(tsconfig))
|
|
137
|
-
return fail('tsconfig', 'a non-empty string');
|
|
138
|
-
if (importExtension !== undefined && typeof importExtension !== 'string')
|
|
139
|
-
return fail('importExtension', 'a string');
|
|
140
|
-
if (!Array.isArray(bundles) || bundles.length === 0)
|
|
141
|
-
return fail('bundles', 'a non-empty array');
|
|
142
|
-
return {
|
|
143
|
-
file,
|
|
144
|
-
dir,
|
|
145
|
-
tsconfig: { file: node_path_1.default.resolve(dir, tsconfig ?? 'tsconfig.json'), required: tsconfig !== undefined },
|
|
146
|
-
importExtension,
|
|
147
|
-
bundles: bundles.map((m, i) => toBundle(m, `bundles[${i}]`, dir)),
|
|
148
|
-
warnings: bundles.flatMap((m, i) => excludeWarnings(m, `bundles[${i}]`)),
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
function loadConfig(file) {
|
|
152
|
-
if (!(0, node_fs_1.existsSync)(file))
|
|
153
|
-
throw new errors_1.TicConfigError(`config file not found: ${file}`);
|
|
154
|
-
let content;
|
|
155
|
-
try {
|
|
156
|
-
content = JSON.parse((0, node_fs_1.readFileSync)(file, 'utf8'));
|
|
157
|
-
}
|
|
158
|
-
catch (e) {
|
|
159
|
-
throw new errors_1.TicConfigError(`${file} is not valid JSON: ${e.message}`);
|
|
160
|
-
}
|
|
161
|
-
return resolveConfig(content, file);
|
|
162
|
-
}
|
package/cjm/errors.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NamespaceNotFoundError = exports.TicConfigError = exports.TicError = void 0;
|
|
4
|
-
class TicError extends Error {
|
|
5
|
-
name = 'TicError';
|
|
6
|
-
}
|
|
7
|
-
exports.TicError = TicError;
|
|
8
|
-
class TicConfigError extends TicError {
|
|
9
|
-
name = 'TicConfigError';
|
|
10
|
-
}
|
|
11
|
-
exports.TicConfigError = TicConfigError;
|
|
12
|
-
class NamespaceNotFoundError extends TicError {
|
|
13
|
-
name = 'NamespaceNotFoundError';
|
|
14
|
-
}
|
|
15
|
-
exports.NamespaceNotFoundError = NamespaceNotFoundError;
|
package/cjm/exportPredicate.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EXPORTS_CONVENTION = void 0;
|
|
4
|
-
exports.findConventionalExportPredicate = findConventionalExportPredicate;
|
|
5
|
-
exports.loadExportPredicate = loadExportPredicate;
|
|
6
|
-
const predicateFile_1 = require("./predicateFile");
|
|
7
|
-
exports.EXPORTS_CONVENTION = (0, predicateFile_1.conventionalNames)('tic.exports');
|
|
8
|
-
function findConventionalExportPredicate(dir) {
|
|
9
|
-
return (0, predicateFile_1.findConventionalFile)(dir, 'tic.exports');
|
|
10
|
-
}
|
|
11
|
-
function loadExportPredicate(file) {
|
|
12
|
-
return (0, predicateFile_1.loadPredicateFile)(file, 'ExportPredicate');
|
|
13
|
-
}
|
package/cjm/inclusion.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INCLUSION_CONVENTION = void 0;
|
|
4
|
-
exports.fileTags = fileTags;
|
|
5
|
-
exports.byTags = byTags;
|
|
6
|
-
exports.findConventionalPredicate = findConventionalPredicate;
|
|
7
|
-
exports.loadInclusionPredicate = loadInclusionPredicate;
|
|
8
|
-
const predicateFile_1 = require("./predicateFile");
|
|
9
|
-
function fileTags(filename) {
|
|
10
|
-
return filename
|
|
11
|
-
.slice(filename.lastIndexOf('/') + 1)
|
|
12
|
-
.split('.')
|
|
13
|
-
.slice(1, -1);
|
|
14
|
-
}
|
|
15
|
-
function byTags(predicate) {
|
|
16
|
-
return (context) => predicate(fileTags(context.filename), context);
|
|
17
|
-
}
|
|
18
|
-
exports.INCLUSION_CONVENTION = (0, predicateFile_1.conventionalNames)('tic.include');
|
|
19
|
-
function findConventionalPredicate(dir) {
|
|
20
|
-
return (0, predicateFile_1.findConventionalFile)(dir, 'tic.include');
|
|
21
|
-
}
|
|
22
|
-
function loadInclusionPredicate(file) {
|
|
23
|
-
return (0, predicateFile_1.loadPredicateFile)(file, 'InclusionPredicate');
|
|
24
|
-
}
|
package/cjm/predicateFile.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.conventionalNames = void 0;
|
|
7
|
-
exports.findConventionalFile = findConventionalFile;
|
|
8
|
-
exports.loadPredicateFile = loadPredicateFile;
|
|
9
|
-
const node_fs_1 = require("node:fs");
|
|
10
|
-
const node_module_1 = require("node:module");
|
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
-
const errors_1 = require("./errors");
|
|
13
|
-
const EXTENSIONS = ['cjs', 'js', 'mjs', 'ts', 'cts', 'mts'];
|
|
14
|
-
const conventionalNames = (base) => EXTENSIONS.map((ext) => `${base}.${ext}`);
|
|
15
|
-
exports.conventionalNames = conventionalNames;
|
|
16
|
-
function findConventionalFile(dir, base) {
|
|
17
|
-
return (0, exports.conventionalNames)(base)
|
|
18
|
-
.map((name) => node_path_1.default.join(dir, name))
|
|
19
|
-
.find((file) => (0, node_fs_1.existsSync)(file));
|
|
20
|
-
}
|
|
21
|
-
function loadPredicateFile(file, typeName) {
|
|
22
|
-
if (!(0, node_fs_1.existsSync)(file))
|
|
23
|
-
throw new errors_1.TicConfigError(`predicate file not found: ${file}`);
|
|
24
|
-
const loaded = (0, node_module_1.createRequire)(file)(file);
|
|
25
|
-
const predicate = typeof loaded === 'function' ? loaded : loaded?.default;
|
|
26
|
-
if (typeof predicate !== 'function') {
|
|
27
|
-
throw new errors_1.TicConfigError(`${file} must export an ${typeName} function (default export or module.exports)`);
|
|
28
|
-
}
|
|
29
|
-
return predicate;
|
|
30
|
-
}
|
package/cjm/render.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.renderProtocol = renderProtocol;
|
|
7
|
-
require("../tpl/index.cjs");
|
|
8
|
-
const handlebars_1 = __importDefault(require("handlebars"));
|
|
9
|
-
handlebars_1.default.registerHelper('join', (items, separator) => items.join(separator));
|
|
10
|
-
function renderProtocol(name, data) {
|
|
11
|
-
const protocol = handlebars_1.default.templates?.[name];
|
|
12
|
-
if (!protocol)
|
|
13
|
-
throw new Error(`Protocol not found: ${name}`);
|
|
14
|
-
return protocol(data);
|
|
15
|
-
}
|
package/cjm/utils.js
DELETED
package/typings/build.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { type ExportPredicate } from './exportPredicate.js';
|
|
2
|
-
import { type InclusionPredicate } from './inclusion.js';
|
|
3
|
-
export interface BuildOptions {
|
|
4
|
-
/** Path of `tic.config.json`, relative to `cwd`. Default `tic.config.json`. */
|
|
5
|
-
config?: string;
|
|
6
|
-
/** Default `process.cwd()`. */
|
|
7
|
-
cwd?: string;
|
|
8
|
-
/** Compare instead of writing: outputs that would change are reported `stale`. */
|
|
9
|
-
check?: boolean;
|
|
10
|
-
/** Decides which scanned files take part; overrides every inclusion predicate file. */
|
|
11
|
-
include?: InclusionPredicate;
|
|
12
|
-
/** Decides which parsed classes become registrations; overrides every export predicate file. */
|
|
13
|
-
filterExports?: ExportPredicate;
|
|
14
|
-
}
|
|
15
|
-
/** `written` / `unchanged` after a build; `stale` / `unchanged` after a check. */
|
|
16
|
-
export type OutputStatus = 'written' | 'unchanged' | 'stale';
|
|
17
|
-
export interface OutputResult {
|
|
18
|
-
/** Absolute path of the generated file. */
|
|
19
|
-
file: string;
|
|
20
|
-
/** Name of the generated class. */
|
|
21
|
-
bundle: string;
|
|
22
|
-
status: OutputStatus;
|
|
23
|
-
registrations: number;
|
|
24
|
-
content: string;
|
|
25
|
-
}
|
|
26
|
-
export interface BuildResult {
|
|
27
|
-
/** Absolute path of the config that was built. */
|
|
28
|
-
config: string;
|
|
29
|
-
outputs: OutputResult[];
|
|
30
|
-
/**
|
|
31
|
-
* Non-fatal problems found while building, e.g. an `exclude` that drops a default
|
|
32
|
-
* test glob or two selected classes passing the same decorator token. Each warning
|
|
33
|
-
* names the bundle field it belongs to.
|
|
34
|
-
*/
|
|
35
|
-
warnings: string[];
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Generates one bundle per config entry. Every bundle is generated before any
|
|
39
|
-
* file is written, so a failing namespace leaves the previous outputs intact.
|
|
40
|
-
*
|
|
41
|
-
* @throws {TicConfigError} when the config, the tsconfig or a predicate file it names is missing or invalid.
|
|
42
|
-
* @throws {NamespaceNotFoundError} when a namespace is neither a folder nor a tsconfig paths alias of one.
|
|
43
|
-
*/
|
|
44
|
-
export declare function build({ config, cwd, check, include, filterExports, }?: BuildOptions): BuildResult;
|
|
45
|
-
//# sourceMappingURL=build.d.ts.map
|
package/typings/cli.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface CliIo {
|
|
2
|
-
cwd: string;
|
|
3
|
-
stdout: (line: string) => void;
|
|
4
|
-
stderr: (line: string) => void;
|
|
5
|
-
}
|
|
6
|
-
/** Runs the `tic` CLI and returns its exit code; output goes through `io`. */
|
|
7
|
-
export declare function run(argv: string[], io?: CliIo): number;
|
|
8
|
-
//# sourceMappingURL=cli.d.ts.map
|
package/typings/config.d.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/** Which exports of a file count: both kinds, only named exports, or only the default export. */
|
|
2
|
-
export type ExportKind = 'any' | 'named' | 'default';
|
|
3
|
-
/**
|
|
4
|
-
* How the bundler picks target classes out of a file. A class is selected when
|
|
5
|
-
* it is exported, not abstract, and meets every criterion set here; an empty
|
|
6
|
-
* rule selects every exported class.
|
|
7
|
-
*/
|
|
8
|
-
export interface ClassSelector {
|
|
9
|
-
/** Default `any`. */
|
|
10
|
-
export?: ExportKind;
|
|
11
|
-
/** The class must carry one of these decorators, recognised by name (`register`, or a composed one). */
|
|
12
|
-
decorators?: string[];
|
|
13
|
-
/** A glob the class name must match, e.g. `*Service`. An anonymous default export is named after its file. */
|
|
14
|
-
nameGlob?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Class names to drop after selection, e.g. one test double sitting next to the
|
|
17
|
-
* real registration in the same file. Unlike `filterExports` this needs no file.
|
|
18
|
-
*/
|
|
19
|
-
excludeClasses?: string[];
|
|
20
|
-
/** A glob the class name must NOT match, e.g. `*Mock`. An anonymous default export is named after its file. */
|
|
21
|
-
excludeNameGlob?: string;
|
|
22
|
-
/**
|
|
23
|
-
* tsconfig `paths` aliases to drop after selection: a class whose file resolves
|
|
24
|
-
* through one of these aliases is dropped, e.g. `["services"]` for a `services/*`
|
|
25
|
-
* (or `@services/*`) alias. Names may omit a leading `@` and a trailing `/*`.
|
|
26
|
-
*/
|
|
27
|
-
excludeAliases?: string[];
|
|
28
|
-
}
|
|
29
|
-
/** A {@link ClassSelector} with its defaults filled in and its globs compiled. */
|
|
30
|
-
export interface ResolvedSelector {
|
|
31
|
-
export: ExportKind;
|
|
32
|
-
decorators?: string[];
|
|
33
|
-
nameGlob?: RegExp;
|
|
34
|
-
excludeClasses?: string[];
|
|
35
|
-
excludeNameGlob?: RegExp;
|
|
36
|
-
excludeAliases?: string[];
|
|
37
|
-
}
|
|
38
|
-
export interface NamespaceConfig {
|
|
39
|
-
/** A folder relative to the config file (`./src/services`) or a tsconfig `paths` alias (`@app/services`). */
|
|
40
|
-
path: string;
|
|
41
|
-
/** Scan sub-folders too. Default `true`. */
|
|
42
|
-
recursive?: boolean;
|
|
43
|
-
}
|
|
44
|
-
export interface BundleConfig {
|
|
45
|
-
/** The generated file, relative to the config file. */
|
|
46
|
-
output: string;
|
|
47
|
-
/** Name of the generated class, an `IContainerModule`. Default `Bundle`. */
|
|
48
|
-
name?: string;
|
|
49
|
-
/** Tags associated with the bundle. */
|
|
50
|
-
tags?: string[];
|
|
51
|
-
namespaces: (string | NamespaceConfig)[];
|
|
52
|
-
/** Which classes of a scanned file are registered. Default: every exported class. */
|
|
53
|
-
select?: ClassSelector;
|
|
54
|
-
/** Globs, relative to the config file, of files never scanned. Replaces {@link DEFAULT_EXCLUDE} when given. */
|
|
55
|
-
exclude?: string[];
|
|
56
|
-
/**
|
|
57
|
-
* Globs, relative to the config file, of files never scanned, added on top of
|
|
58
|
-
* `exclude` (or {@link DEFAULT_EXCLUDE} when `exclude` is omitted). Use this to
|
|
59
|
-
* add one exclusion without restating the defaults.
|
|
60
|
-
*/
|
|
61
|
-
additionalExclude?: string[];
|
|
62
|
-
/**
|
|
63
|
-
* A file exporting an `InclusionPredicate`, relative to the config file. Overrides the
|
|
64
|
-
* conventional `tic.include.*` next to the config.
|
|
65
|
-
*/
|
|
66
|
-
include?: string;
|
|
67
|
-
/**
|
|
68
|
-
* A file exporting an `ExportPredicate`, relative to the config file. Overrides the
|
|
69
|
-
* conventional `tic.exports.*` next to the config.
|
|
70
|
-
*/
|
|
71
|
-
filterExports?: string;
|
|
72
|
-
}
|
|
73
|
-
/** The shape of `tic.config.json`. */
|
|
74
|
-
export interface TicConfig {
|
|
75
|
-
$schema?: string;
|
|
76
|
-
/** Relative to the config file. Default `tsconfig.json`, which may be absent. */
|
|
77
|
-
tsconfig?: string;
|
|
78
|
-
/** Extension of generated imports. Inferred from the tsconfig's `moduleResolution` when omitted. */
|
|
79
|
-
importExtension?: string;
|
|
80
|
-
bundles: BundleConfig[];
|
|
81
|
-
}
|
|
82
|
-
export declare const DEFAULT_CONFIG_FILE = "tic.config.json";
|
|
83
|
-
export declare const DEFAULT_BUNDLE_NAME = "Bundle";
|
|
84
|
-
export declare const DEFAULT_EXCLUDE: string[];
|
|
85
|
-
/** A config whose defaults are filled in and whose paths are absolute. */
|
|
86
|
-
export interface ResolvedConfig {
|
|
87
|
-
file: string;
|
|
88
|
-
dir: string;
|
|
89
|
-
tsconfig: {
|
|
90
|
-
file: string;
|
|
91
|
-
required: boolean;
|
|
92
|
-
};
|
|
93
|
-
importExtension?: string;
|
|
94
|
-
bundles: ResolvedBundle[];
|
|
95
|
-
/** Non-fatal problems found while resolving, e.g. an `exclude` that drops a default test glob. */
|
|
96
|
-
warnings: string[];
|
|
97
|
-
}
|
|
98
|
-
export interface ResolvedBundle {
|
|
99
|
-
output: string;
|
|
100
|
-
name: string;
|
|
101
|
-
tags: string[];
|
|
102
|
-
namespaces: Required<NamespaceConfig>[];
|
|
103
|
-
select: ResolvedSelector;
|
|
104
|
-
/** The effective list: the configured `exclude` (or the defaults) followed by `additionalExclude`. */
|
|
105
|
-
exclude: string[];
|
|
106
|
-
/** Absolute path of the bundle's own predicate file, when it names one. */
|
|
107
|
-
include?: string;
|
|
108
|
-
/** Absolute path of the bundle's own export predicate file, when it names one. */
|
|
109
|
-
filterExports?: string;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Validates parsed `tic.config.json` content and resolves its paths against `file`'s directory.
|
|
113
|
-
*
|
|
114
|
-
* @throws {TicConfigError} when the content does not match the config shape; the message names the field.
|
|
115
|
-
*/
|
|
116
|
-
export declare function resolveConfig(content: unknown, file: string): ResolvedConfig;
|
|
117
|
-
/**
|
|
118
|
-
* Reads and validates a `tic.config.json`.
|
|
119
|
-
*
|
|
120
|
-
* @throws {TicConfigError} when the file is missing, is not valid JSON, or does not match the config shape.
|
|
121
|
-
*/
|
|
122
|
-
export declare function loadConfig(file: string): ResolvedConfig;
|
|
123
|
-
//# sourceMappingURL=config.d.ts.map
|
package/typings/emit.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { DiscoveredClass } from './scan.js';
|
|
2
|
-
export interface EmitInput {
|
|
3
|
-
/** Name of the generated class. */
|
|
4
|
-
name: string;
|
|
5
|
-
/** Shown in the header: where the output came from. */
|
|
6
|
-
configPath: string;
|
|
7
|
-
namespaces: string[];
|
|
8
|
-
classes: (DiscoveredClass & {
|
|
9
|
-
specifier: string;
|
|
10
|
-
})[];
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Renders the generated bundle — static imports, `registrations`, and the bundle applying them —
|
|
14
|
-
* from its protocol, `protocols/Bundle.ts.hbs`. This function only prepares the data: unique local
|
|
15
|
-
* names, and one import per file in file order.
|
|
16
|
-
*/
|
|
17
|
-
export declare function emitBundle({ name, configPath, namespaces, classes }: EmitInput): string;
|
|
18
|
-
//# sourceMappingURL=emit.d.ts.map
|
package/typings/errors.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** Base class of every error the bundler raises on purpose; the CLI prints its message without a stack. */
|
|
2
|
-
export declare class TicError extends Error {
|
|
3
|
-
name: string;
|
|
4
|
-
}
|
|
5
|
-
/** The config file is missing, is not JSON, or does not match the `tic.config.json` shape. */
|
|
6
|
-
export declare class TicConfigError extends TicError {
|
|
7
|
-
name: string;
|
|
8
|
-
}
|
|
9
|
-
/** A namespace is neither an existing folder nor a `tsconfig.json` `paths` alias of one. */
|
|
10
|
-
export declare class NamespaceNotFoundError extends TicError {
|
|
11
|
-
name: string;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { FilterPredicate } from './utils.js';
|
|
2
|
-
/** What an {@link ExportPredicate} decides on: one exported class of a parsed file. */
|
|
3
|
-
export interface ExportContext {
|
|
4
|
-
/** The file's path relative to the config file, `/`-separated: `src/services/Logger.ts`. */
|
|
5
|
-
filename: string;
|
|
6
|
-
/** The name the class is exported under; `'default'` for a default export. */
|
|
7
|
-
exportName: string;
|
|
8
|
-
/** The declared class name; an anonymous default export is named after its file. */
|
|
9
|
-
className: string;
|
|
10
|
-
isDefault: boolean;
|
|
11
|
-
/** Names of the class's decorators, renamed imports resolved (`register as reg` -> `'register'`). */
|
|
12
|
-
decorators: string[];
|
|
13
|
-
/** The file-name tags `byTags` reads: `Report.production.eu.ts` -> `['production', 'eu']`. */
|
|
14
|
-
tags: string[];
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Decides, right after a file is parsed, whether one of its exported classes becomes a
|
|
18
|
-
* registration. It runs on every exported, non-abstract class that passes `select`.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* // tic.exports.ts, next to tic.config.json - picked up by convention
|
|
22
|
-
* const filterExports: ExportPredicate = ({ exportName }) => !/(Stub|Mock|Fake)$/.test(exportName);
|
|
23
|
-
* export default filterExports;
|
|
24
|
-
*/
|
|
25
|
-
export type ExportPredicate = FilterPredicate<ExportContext>;
|
|
26
|
-
/** Export predicate files looked up next to the config, in this order, when no bundle names one. */
|
|
27
|
-
export declare const EXPORTS_CONVENTION: string[];
|
|
28
|
-
/** The conventional export predicate file in `dir`, if there is one. */
|
|
29
|
-
export declare function findConventionalExportPredicate(dir: string): string | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Loads an {@link ExportPredicate} file (see `loadPredicateFile` for formats and caching).
|
|
32
|
-
*
|
|
33
|
-
* @throws {TicConfigError} when the file is missing or does not export a function.
|
|
34
|
-
*/
|
|
35
|
-
export declare function loadExportPredicate(file: string): ExportPredicate;
|
|
36
|
-
//# sourceMappingURL=exportPredicate.d.ts.map
|
package/typings/inclusion.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { FilterPredicate } from './utils.js';
|
|
2
|
-
/** What an {@link InclusionPredicate} decides on. */
|
|
3
|
-
export interface InclusionContext {
|
|
4
|
-
/** The file's path relative to the config file, `/`-separated: `src/services/Logger.ts`. */
|
|
5
|
-
filename: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Decides whether a scanned file takes part in code generation. A file takes
|
|
9
|
-
* part only when it matches no `exclude` glob and the predicate returns `true`.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* // tic.include.ts, next to tic.config.json - picked up by convention
|
|
13
|
-
* const include: InclusionPredicate = ({ filename }) => !filename.includes('/legacy/');
|
|
14
|
-
* export default include;
|
|
15
|
-
*/
|
|
16
|
-
export type InclusionPredicate = FilterPredicate<InclusionContext>;
|
|
17
|
-
/**
|
|
18
|
-
* An {@link InclusionPredicate} over a file's tags, the dot-separated parts of its name between
|
|
19
|
-
* the base name and the extension. Wrap it with {@link byTags} to use it anywhere an
|
|
20
|
-
* `InclusionPredicate` goes.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* // StripeGateway.production.ts joins production only; Shared.ts joins every environment
|
|
24
|
-
* const ENVS = ['development', 'production', 'test'];
|
|
25
|
-
* export default byTags((tags) => tags.filter((t) => ENVS.includes(t)).every((t) => t === process.env.TIC_ENV));
|
|
26
|
-
*/
|
|
27
|
-
export type TagInclusionPredicate = (tags: string[], context: InclusionContext) => boolean;
|
|
28
|
-
/** `src/Report.production.eu.ts` -> `['production', 'eu']`; `src/Shared.ts` -> `[]`. */
|
|
29
|
-
export declare function fileTags(filename: string): string[];
|
|
30
|
-
/** Wraps a {@link TagInclusionPredicate} into the {@link InclusionPredicate} the bundler calls. */
|
|
31
|
-
export declare function byTags(predicate: TagInclusionPredicate): InclusionPredicate;
|
|
32
|
-
/** Predicate files looked up next to the config, in this order, when no bundle names one. */
|
|
33
|
-
export declare const INCLUSION_CONVENTION: string[];
|
|
34
|
-
/** The conventional inclusion predicate file in `dir`, if there is one. */
|
|
35
|
-
export declare function findConventionalPredicate(dir: string): string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Loads an {@link InclusionPredicate} file (see `loadPredicateFile` for formats and caching).
|
|
38
|
-
*
|
|
39
|
-
* @throws {TicConfigError} when the file is missing or does not export a function.
|
|
40
|
-
*/
|
|
41
|
-
export declare function loadInclusionPredicate(file: string): InclusionPredicate;
|
|
42
|
-
//# sourceMappingURL=inclusion.d.ts.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { FilterPredicate } from './utils.js';
|
|
2
|
-
/** `tic.include` -> `tic.include.cjs`, `tic.include.js`, ... in lookup order. */
|
|
3
|
-
export declare const conventionalNames: (base: string) => string[];
|
|
4
|
-
/** The first conventional file for `base` that exists in `dir`, if any. */
|
|
5
|
-
export declare function findConventionalFile(dir: string, base: string): string | undefined;
|
|
6
|
-
/**
|
|
7
|
-
* Loads a predicate file synchronously with `require` - `.cjs` / `.js`, ES modules
|
|
8
|
-
* (Node 22.12+) and `.ts` (Node with type stripping). Its default export, or
|
|
9
|
-
* `module.exports` itself, is the predicate. Like any `require`d module it is loaded
|
|
10
|
-
* once per process, so a predicate that depends on the environment should read it
|
|
11
|
-
* when called, not when loaded.
|
|
12
|
-
*
|
|
13
|
-
* @throws {TicConfigError} when the file is missing or does not export a function.
|
|
14
|
-
*/
|
|
15
|
-
export declare function loadPredicateFile<T extends FilterPredicate<never>>(file: string, typeName: string): T;
|
|
16
|
-
//# sourceMappingURL=predicateFile.d.ts.map
|