@ts-ioc-container/bundler 0.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 +40 -0
- package/README.md +335 -0
- package/cjm/ImportPaths.js +134 -0
- package/cjm/bin.js +5 -0
- package/cjm/build.js +90 -0
- package/cjm/cli.js +82 -0
- package/cjm/config.js +118 -0
- package/cjm/emit.js +33 -0
- package/cjm/errors.js +15 -0
- package/cjm/exportPredicate.js +13 -0
- package/cjm/glob.js +27 -0
- package/cjm/inclusion.js +24 -0
- package/cjm/index.js +36 -0
- package/cjm/predicateFile.js +30 -0
- package/cjm/render.js +15 -0
- package/cjm/scan.js +144 -0
- package/cjm/utils.js +2 -0
- package/lib/ImportPaths.ts +127 -0
- package/lib/bin.ts +4 -0
- package/lib/build.ts +157 -0
- package/lib/cli.ts +88 -0
- package/lib/config.ts +206 -0
- package/lib/emit.ts +47 -0
- package/lib/errors.ts +14 -0
- package/lib/exportPredicate.ts +45 -0
- package/lib/glob.ts +24 -0
- package/lib/inclusion.ts +61 -0
- package/lib/index.ts +40 -0
- package/lib/predicateFile.ts +36 -0
- package/lib/render.ts +19 -0
- package/lib/scan.ts +133 -0
- package/lib/utils.ts +2 -0
- package/package.json +84 -0
- package/tic.schema.json +134 -0
- package/tpl/index.cjs +81 -0
- package/typings/ImportPaths.d.ts +37 -0
- package/typings/ImportPaths.d.ts.map +1 -0
- package/typings/bin.d.ts +3 -0
- package/typings/bin.d.ts.map +1 -0
- package/typings/build.d.ts +39 -0
- package/typings/build.d.ts.map +1 -0
- package/typings/cli.d.ts +8 -0
- package/typings/cli.d.ts.map +1 -0
- package/typings/config.d.ts +95 -0
- package/typings/config.d.ts.map +1 -0
- package/typings/emit.d.ts +18 -0
- package/typings/emit.d.ts.map +1 -0
- package/typings/errors.d.ts +13 -0
- package/typings/errors.d.ts.map +1 -0
- package/typings/exportPredicate.d.ts +36 -0
- package/typings/exportPredicate.d.ts.map +1 -0
- package/typings/glob.d.ts +7 -0
- package/typings/glob.d.ts.map +1 -0
- package/typings/inclusion.d.ts +42 -0
- package/typings/inclusion.d.ts.map +1 -0
- package/typings/index.d.ts +12 -0
- package/typings/index.d.ts.map +1 -0
- package/typings/predicateFile.d.ts +16 -0
- package/typings/predicateFile.d.ts.map +1 -0
- package/typings/render.d.ts +8 -0
- package/typings/render.d.ts.map +1 -0
- package/typings/scan.d.ts +22 -0
- package/typings/scan.d.ts.map +1 -0
- package/typings/utils.d.ts +3 -0
- package/typings/utils.d.ts.map +1 -0
package/tpl/index.cjs
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var Handlebars = require("handlebars"); var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
|
2
|
+
templates["Bundle.ts.hbs"] = template({"0":function(container,depth0,helpers,partials,data) {
|
|
3
|
+
return ", Registration";
|
|
4
|
+
},"1":function(container,depth0,helpers,partials,data) {
|
|
5
|
+
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
7
|
+
return parent[propertyName];
|
|
8
|
+
}
|
|
9
|
+
return undefined
|
|
10
|
+
};
|
|
11
|
+
|
|
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":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
|
+
+ " 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":5,"column":138},"end":{"line":5,"column":153}}}) : helper))) != null ? stack1 : "")
|
|
17
|
+
+ "';\n";
|
|
18
|
+
},"2":function(container,depth0,helpers,partials,data) {
|
|
19
|
+
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
20
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
21
|
+
return parent[propertyName];
|
|
22
|
+
}
|
|
23
|
+
return undefined
|
|
24
|
+
};
|
|
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":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
|
+
},"3":function(container,depth0,helpers,partials,data) {
|
|
29
|
+
return ", ";
|
|
30
|
+
},"4":function(container,depth0,helpers,partials,data) {
|
|
31
|
+
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
32
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
33
|
+
return parent[propertyName];
|
|
34
|
+
}
|
|
35
|
+
return undefined
|
|
36
|
+
};
|
|
37
|
+
|
|
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":5,"column":101},"end":{"line":5,"column":122}}})) != null ? stack1 : "")
|
|
40
|
+
+ " }";
|
|
41
|
+
},"5":function(container,depth0,helpers,partials,data) {
|
|
42
|
+
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
43
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
44
|
+
return parent[propertyName];
|
|
45
|
+
}
|
|
46
|
+
return undefined
|
|
47
|
+
};
|
|
48
|
+
|
|
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":10,"column":0},"end":{"line":12,"column":9}}})) != null ? stack1 : "")
|
|
51
|
+
+ "];\n";
|
|
52
|
+
},"6":function(container,depth0,helpers,partials,data) {
|
|
53
|
+
var stack1;
|
|
54
|
+
|
|
55
|
+
return " Registration.fromClass("
|
|
56
|
+
+ ((stack1 = container.lambda(depth0, depth0)) != null ? stack1 : "")
|
|
57
|
+
+ "),\n";
|
|
58
|
+
},"7":function(container,depth0,helpers,partials,data) {
|
|
59
|
+
return "export const registrations: IRegistration[] = [];\n";
|
|
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, alias3="function", lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
63
|
+
return parent[propertyName];
|
|
64
|
+
}
|
|
65
|
+
return undefined
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return "// Generated by `tic build` from "
|
|
69
|
+
+ ((stack1 = ((helper = (helper = lookupProperty(helpers,"configPath") || (depth0 != null ? lookupProperty(depth0,"configPath") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"configPath","hash":{},"data":data,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":49}}}) : helper))) != null ? stack1 : "")
|
|
70
|
+
+ ". Do not edit by hand.\n// Namespaces: "
|
|
71
|
+
+ ((stack1 = (lookupProperty(helpers,"join")||(depth0 && lookupProperty(depth0,"join"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"namespaces") : depth0),", ",{"name":"join","hash":{},"data":data,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":41}}})) != null ? stack1 : "")
|
|
72
|
+
+ "\nimport { type IContainer, type IContainerModule, type IRegistration"
|
|
73
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"registrations") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(0, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":67},"end":{"line":3,"column":116}}})) != null ? stack1 : "")
|
|
74
|
+
+ " } from 'ts-ioc-container';\n"
|
|
75
|
+
+ ((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 : "")
|
|
76
|
+
+ "\n"
|
|
77
|
+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"registrations") : depth0)) != null ? lookupProperty(stack1,"length") : stack1),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.program(7, data, 0),"data":data,"loc":{"start":{"line":8,"column":0},"end":{"line":16,"column":7}}})) != null ? stack1 : "")
|
|
78
|
+
+ "\nexport class "
|
|
79
|
+
+ ((stack1 = ((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":18,"column":13},"end":{"line":18,"column":23}}}) : helper))) != null ? stack1 : "")
|
|
80
|
+
+ " implements IContainerModule {\n applyTo(container: IContainer): void {\n for (const registration of registrations) container.addRegistration(registration);\n }\n}\n";
|
|
81
|
+
},"useData":true});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface Alias {
|
|
2
|
+
pattern: string;
|
|
3
|
+
/** Absolute, `/`-separated. */
|
|
4
|
+
targets: string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Import paths as a project's `tsconfig.json` sees them: resolves namespaces
|
|
8
|
+
* written as `paths` aliases to folders, and writes imports back in alias form.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ImportPaths {
|
|
11
|
+
private readonly aliases;
|
|
12
|
+
readonly extension: string;
|
|
13
|
+
/**
|
|
14
|
+
* Reads `paths` (following `extends`) and the extension imports need under the
|
|
15
|
+
* tsconfig's `moduleResolution`; `importExtension` overrides the latter.
|
|
16
|
+
*
|
|
17
|
+
* @throws {TicConfigError} when a required tsconfig is missing or cannot be parsed.
|
|
18
|
+
*/
|
|
19
|
+
static load(tsconfig: {
|
|
20
|
+
file: string;
|
|
21
|
+
required: boolean;
|
|
22
|
+
}, importExtension?: string): ImportPaths;
|
|
23
|
+
constructor(aliases: Alias[], extension: string);
|
|
24
|
+
/**
|
|
25
|
+
* The folder a namespace names: a path relative to `baseDir`, or a `paths` alias.
|
|
26
|
+
*
|
|
27
|
+
* @throws {NamespaceNotFoundError} when the namespace is neither an existing folder nor an alias of one.
|
|
28
|
+
*/
|
|
29
|
+
resolveNamespace(namespace: string, baseDir: string): string;
|
|
30
|
+
/** The specifier `fromFile` imports `toFile` by: its most specific alias, else a relative path. */
|
|
31
|
+
specifier(fromFile: string, toFile: string): string;
|
|
32
|
+
private aliasTargets;
|
|
33
|
+
/** A longer matched target prefix is a more specific alias; an exact file alias beats every wildcard. */
|
|
34
|
+
private matchAlias;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=ImportPaths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportPaths.d.ts","sourceRoot":"","sources":["../lib/ImportPaths.ts"],"names":[],"mappings":"AAMA,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAeD;;;GAGG;AACH,qBAAa,WAAW;IAiCpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM;IAjC5B;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW;gBA0B9E,OAAO,EAAE,KAAK,EAAE,EACxB,SAAS,EAAE,MAAM;IAG5B;;;;OAIG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAa5D,mGAAmG;IACnG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAgBnD,OAAO,CAAC,YAAY;IAWpB,yGAAyG;IACzG,OAAO,CAAC,UAAU;CAanB"}
|
package/typings/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../lib/bin.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
/**
|
|
32
|
+
* Generates one bundle per config entry. Every bundle is generated before any
|
|
33
|
+
* file is written, so a failing namespace leaves the previous outputs intact.
|
|
34
|
+
*
|
|
35
|
+
* @throws {TicConfigError} when the config, the tsconfig or a predicate file it names is missing or invalid.
|
|
36
|
+
* @throws {NamespaceNotFoundError} when a namespace is neither a folder nor a tsconfig paths alias of one.
|
|
37
|
+
*/
|
|
38
|
+
export declare function build({ config, cwd, check, include, filterExports, }?: BuildOptions): BuildResult;
|
|
39
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../lib/build.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,eAAe,EAAwD,MAAM,mBAAmB,CAAC;AAC/G,OAAO,EAAuC,KAAK,kBAAkB,EAA0B,MAAM,aAAa,CAAC;AAGnH,MAAM,WAAW,YAAY;IAC3B,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uFAAuF;IACvF,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,gGAAgG;IAChG,aAAa,CAAC,EAAE,eAAe,CAAC;CACjC;AAED,kFAAkF;AAClF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,EACpB,MAA4B,EAC5B,GAAmB,EACnB,KAAa,EACb,OAAO,EACP,aAAa,GACd,GAAE,YAAiB,GAAG,WAAW,CA6BjC"}
|
package/typings/cli.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../lib/cli.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AA2CD,8EAA8E;AAC9E,wBAAgB,GAAG,CACjB,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,GAAE,KAA0E,GAC7E,MAAM,CA+BR"}
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
/** A {@link ClassSelector} with its defaults filled in and its `nameGlob` compiled. */
|
|
17
|
+
export interface ResolvedSelector {
|
|
18
|
+
export: ExportKind;
|
|
19
|
+
decorators?: string[];
|
|
20
|
+
nameGlob?: RegExp;
|
|
21
|
+
}
|
|
22
|
+
export interface NamespaceConfig {
|
|
23
|
+
/** A folder relative to the config file (`./src/services`) or a tsconfig `paths` alias (`@app/services`). */
|
|
24
|
+
path: string;
|
|
25
|
+
/** Scan sub-folders too. Default `true`. */
|
|
26
|
+
recursive?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface BundleConfig {
|
|
29
|
+
/** The generated file, relative to the config file. */
|
|
30
|
+
output: string;
|
|
31
|
+
/** Name of the generated class, an `IContainerModule`. Default `Bundle`. */
|
|
32
|
+
name?: string;
|
|
33
|
+
namespaces: (string | NamespaceConfig)[];
|
|
34
|
+
/** Which classes of a scanned file are registered. Default: every exported class. */
|
|
35
|
+
select?: ClassSelector;
|
|
36
|
+
/** Globs, relative to the config file, of files never scanned. Replaces {@link DEFAULT_EXCLUDE} when given. */
|
|
37
|
+
exclude?: string[];
|
|
38
|
+
/**
|
|
39
|
+
* A file exporting an `InclusionPredicate`, relative to the config file. Overrides the
|
|
40
|
+
* conventional `tic.include.*` next to the config.
|
|
41
|
+
*/
|
|
42
|
+
include?: string;
|
|
43
|
+
/**
|
|
44
|
+
* A file exporting an `ExportPredicate`, relative to the config file. Overrides the
|
|
45
|
+
* conventional `tic.exports.*` next to the config.
|
|
46
|
+
*/
|
|
47
|
+
filterExports?: string;
|
|
48
|
+
}
|
|
49
|
+
/** The shape of `tic.config.json`. */
|
|
50
|
+
export interface TicConfig {
|
|
51
|
+
$schema?: string;
|
|
52
|
+
/** Relative to the config file. Default `tsconfig.json`, which may be absent. */
|
|
53
|
+
tsconfig?: string;
|
|
54
|
+
/** Extension of generated imports. Inferred from the tsconfig's `moduleResolution` when omitted. */
|
|
55
|
+
importExtension?: string;
|
|
56
|
+
bundles: BundleConfig[];
|
|
57
|
+
}
|
|
58
|
+
export declare const DEFAULT_CONFIG_FILE = "tic.config.json";
|
|
59
|
+
export declare const DEFAULT_BUNDLE_NAME = "Bundle";
|
|
60
|
+
export declare const DEFAULT_EXCLUDE: string[];
|
|
61
|
+
/** A config whose defaults are filled in and whose paths are absolute. */
|
|
62
|
+
export interface ResolvedConfig {
|
|
63
|
+
file: string;
|
|
64
|
+
dir: string;
|
|
65
|
+
tsconfig: {
|
|
66
|
+
file: string;
|
|
67
|
+
required: boolean;
|
|
68
|
+
};
|
|
69
|
+
importExtension?: string;
|
|
70
|
+
bundles: ResolvedBundle[];
|
|
71
|
+
}
|
|
72
|
+
export interface ResolvedBundle {
|
|
73
|
+
output: string;
|
|
74
|
+
name: string;
|
|
75
|
+
namespaces: Required<NamespaceConfig>[];
|
|
76
|
+
select: ResolvedSelector;
|
|
77
|
+
exclude: string[];
|
|
78
|
+
/** Absolute path of the bundle's own predicate file, when it names one. */
|
|
79
|
+
include?: string;
|
|
80
|
+
/** Absolute path of the bundle's own export predicate file, when it names one. */
|
|
81
|
+
filterExports?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Validates parsed `tic.config.json` content and resolves its paths against `file`'s directory.
|
|
85
|
+
*
|
|
86
|
+
* @throws {TicConfigError} when the content does not match the config shape; the message names the field.
|
|
87
|
+
*/
|
|
88
|
+
export declare function resolveConfig(content: unknown, file: string): ResolvedConfig;
|
|
89
|
+
/**
|
|
90
|
+
* Reads and validates a `tic.config.json`.
|
|
91
|
+
*
|
|
92
|
+
* @throws {TicConfigError} when the file is missing, is not valid JSON, or does not match the config shape.
|
|
93
|
+
*/
|
|
94
|
+
export declare function loadConfig(file: string): ResolvedConfig;
|
|
95
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../lib/config.ts"],"names":[],"mappings":"AAKA,iGAAiG;AACjG,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,wGAAwG;IACxG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,8GAA8G;IAC9G,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,uFAAuF;AACvF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,6GAA6G;IAC7G,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,CAAC,MAAM,GAAG,eAAe,CAAC,EAAE,CAAC;IACzC,qFAAqF;IACrF,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,+GAA+G;IAC/G,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,sCAAsC;AACtC,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oGAAoG;IACpG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AACrD,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAC5C,eAAO,MAAM,eAAe,UAO3B,CAAC;AAEF,0EAA0E;AAC1E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;IACxC,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAwED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAc5E;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CASvD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../lib/emit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,WAAW,SAAS;IACxB,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,CAAC,eAAe,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CACtD;AAID;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,SAAS,GAAG,MAAM,CA2BvF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../lib/errors.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,qBAAa,QAAS,SAAQ,KAAK;IACjC,IAAI,SAAc;CACnB;AAED,8FAA8F;AAC9F,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,IAAI,SAAoB;CACzB;AAED,4FAA4F;AAC5F,qBAAa,sBAAuB,SAAQ,QAAQ;IAClD,IAAI,SAA4B;CACjC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportPredicate.d.ts","sourceRoot":"","sources":["../lib/exportPredicate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,uFAAuF;AACvF,MAAM,WAAW,aAAa;IAC5B,4FAA4F;IAC5F,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,qGAAqG;IACrG,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,8FAA8F;IAC9F,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;AAE7D,oGAAoG;AACpG,eAAO,MAAM,kBAAkB,UAAmC,CAAC;AAEnE,wEAAwE;AACxE,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE/E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAEjE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a glob to an anchored RegExp over `/`-separated paths: `**` spans
|
|
3
|
+
* folders (`**\/` also matches none), `*` and `?` stay within one segment.
|
|
4
|
+
*/
|
|
5
|
+
export declare function globToRegExp(glob: string): RegExp;
|
|
6
|
+
export declare const toPosix: (file: string) => string;
|
|
7
|
+
//# sourceMappingURL=glob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../lib/glob.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBjD;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MAAoC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inclusion.d.ts","sourceRoot":"","sources":["../lib/inclusion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,qDAAqD;AACrD,MAAM,WAAW,gBAAgB;IAC/B,4FAA4F;IAC5F,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;AAEnE;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC;AAE3F,wFAAwF;AACxF,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAKnD;AAED,mGAAmG;AACnG,wBAAgB,MAAM,CAAC,SAAS,EAAE,qBAAqB,GAAG,kBAAkB,CAE3E;AAED,6FAA6F;AAC7F,eAAO,MAAM,oBAAoB,UAAmC,CAAC;AAErE,2EAA2E;AAC3E,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAEvE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { build, type BuildOptions, type BuildResult, type OutputResult, type OutputStatus } from './build.js';
|
|
2
|
+
export { run, type CliIo } from './cli.js';
|
|
3
|
+
export { loadConfig, resolveConfig, DEFAULT_CONFIG_FILE, DEFAULT_EXCLUDE, DEFAULT_BUNDLE_NAME, type TicConfig, type BundleConfig, type NamespaceConfig, type ClassSelector, type ExportKind, type ResolvedSelector, type ResolvedConfig, type ResolvedBundle, } from './config.js';
|
|
4
|
+
export { ImportPaths } from './ImportPaths.js';
|
|
5
|
+
export { type FilterPredicate } from './utils.js';
|
|
6
|
+
export { type ExportPredicate, type ExportContext, EXPORTS_CONVENTION, findConventionalExportPredicate, loadExportPredicate, } from './exportPredicate.js';
|
|
7
|
+
export { type InclusionPredicate, type InclusionContext, type TagInclusionPredicate, byTags, fileTags, INCLUSION_CONVENTION, findConventionalPredicate, loadInclusionPredicate, } from './inclusion.js';
|
|
8
|
+
export { findClasses, listSourceFiles, type DiscoveredClass } from './scan.js';
|
|
9
|
+
export { emitBundle, type EmitInput } from './emit.js';
|
|
10
|
+
export { globToRegExp } from './glob.js';
|
|
11
|
+
export { TicError, TicConfigError, NamespaceNotFoundError } from './errors.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3G,OAAO,EAAE,GAAG,EAAE,KAAK,KAAK,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EACL,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,kBAAkB,EAClB,+BAA+B,EAC/B,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,MAAM,EACN,QAAQ,EACR,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predicateFile.d.ts","sourceRoot":"","sources":["../lib/predicateFile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI/C,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MAAM,EAA+C,CAAC;AAEvG,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIlF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,eAAe,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,CAQrG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '../tpl/index.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a precompiled protocol, looked up by its file basename (`Bundle.ts.hbs`).
|
|
4
|
+
*
|
|
5
|
+
* @throws {Error} when no protocol is registered under `name`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderProtocol(name: string, data: unknown): string;
|
|
8
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../lib/render.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAS1B;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAIlE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ResolvedSelector } from './config.js';
|
|
2
|
+
/** An exported class the generated bundle registers. */
|
|
3
|
+
export interface DiscoveredClass {
|
|
4
|
+
file: string;
|
|
5
|
+
/** The name it is exported under; `default` for a default export. */
|
|
6
|
+
exportName: string;
|
|
7
|
+
/** The local name the generated bundle would like to import it under. */
|
|
8
|
+
localName: string;
|
|
9
|
+
/** The declared class name; an anonymous default export is named after its file. */
|
|
10
|
+
className: string;
|
|
11
|
+
isDefault: boolean;
|
|
12
|
+
/** Names of the class's decorators, renamed imports resolved. */
|
|
13
|
+
decorators: string[];
|
|
14
|
+
}
|
|
15
|
+
/** Source files of `dir`, sorted by path so the generated output is stable across machines. */
|
|
16
|
+
export declare function listSourceFiles(dir: string, recursive: boolean, isExcluded: (file: string) => boolean): string[];
|
|
17
|
+
/**
|
|
18
|
+
* The exported, non-abstract classes of one file that `selector` selects, in
|
|
19
|
+
* declaration order. Syntax only: decorators are recognised by name, not by type.
|
|
20
|
+
*/
|
|
21
|
+
export declare function findClasses(file: string, selector: ResolvedSelector, text?: string): DiscoveredClass[];
|
|
22
|
+
//# sourceMappingURL=scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../lib/scan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAKD,+FAA+F;AAC/F,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,EAAE,CAchH;AA2BD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,SAA6B,GAChC,eAAe,EAAE,CA4DnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../lib/utils.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,MAAM,MAAM,eAAe,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC"}
|