@ts-ioc-container/bundler 2.0.0 → 3.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 +36 -23
- package/README.md +64 -84
- 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 +48 -0
- package/cjm/exceptions/ExceptionHandler.js +38 -0
- package/cjm/features/build/BuildConfig.js +146 -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} +0 -27
- package/cjm/features/build/domain/configFiles.js +35 -0
- package/cjm/{emit.js → features/build/domain/emit.js} +9 -11
- package/cjm/{scan.js → features/build/domain/scan.js} +0 -18
- package/cjm/features/build/domain/tokenCollisions.js +29 -0
- package/cjm/{tsconfig.js → features/build/domain/tsconfig.js} +17 -11
- package/cjm/features/build/services/BundleBuilder.js +93 -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 +83 -26
- package/cjm/modules/CommonModule.js +28 -0
- package/cjm/schema/ticConfigSchema.js +20 -0
- package/cjm/services/ConsoleLogger.js +36 -0
- package/cjm/services/HandlebarsRenderService.js +33 -0
- package/cjm/services/NodeFileSystemService.js +32 -0
- package/cjm/services/OutputService.js +33 -0
- package/package.json +9 -7
- package/tic.schema.json +79 -113
- package/tpl/index.cjs +19 -41
- package/typings/app.d.ts +23 -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 +33 -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 +159 -0
- package/typings/features/build/BuildConfig.d.ts.map +1 -0
- package/typings/features/build/BuildController.d.ts +31 -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} +2 -9
- 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 +36 -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} +1 -3
- 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 +21 -0
- package/typings/features/build/domain/tsconfig.d.ts.map +1 -0
- package/typings/features/build/services/BundleBuilder.d.ts +65 -0
- package/typings/features/build/services/BundleBuilder.d.ts.map +1 -0
- package/typings/features/build/services/TicConfigService.d.ts +37 -0
- package/typings/features/build/services/TicConfigService.d.ts.map +1 -0
- package/typings/features/help/HelpController.d.ts +8 -0
- package/typings/features/help/HelpController.d.ts.map +1 -0
- package/typings/features/help/HelpModule.d.ts +5 -0
- package/typings/features/help/HelpModule.d.ts.map +1 -0
- package/typings/features/help/VersionController.d.ts +8 -0
- package/typings/features/help/VersionController.d.ts.map +1 -0
- package/typings/index.d.ts +25 -9
- package/typings/modules/CommonModule.d.ts +9 -0
- package/typings/modules/CommonModule.d.ts.map +1 -0
- package/typings/schema/ticConfigSchema.d.ts +7 -0
- package/typings/schema/ticConfigSchema.d.ts.map +1 -0
- package/typings/services/ConsoleLogger.d.ts +20 -0
- package/typings/services/ConsoleLogger.d.ts.map +1 -0
- package/typings/services/HandlebarsRenderService.d.ts +23 -0
- package/typings/services/HandlebarsRenderService.d.ts.map +1 -0
- package/typings/services/NodeFileSystemService.d.ts +21 -0
- package/typings/services/NodeFileSystemService.d.ts.map +1 -0
- package/typings/services/OutputService.d.ts +13 -0
- package/typings/services/OutputService.d.ts.map +1 -0
- package/cjm/build.js +0 -106
- package/cjm/cli.js +0 -109
- package/cjm/config.js +0 -199
- package/cjm/errors.js +0 -15
- package/cjm/render.js +0 -15
- package/typings/build.d.ts +0 -42
- package/typings/cli.d.ts +0 -8
- package/typings/config.d.ts +0 -162
- package/typings/emit.d.ts +0 -23
- package/typings/errors.d.ts +0 -13
- package/typings/render.d.ts +0 -8
- package/typings/tsconfig.d.ts +0 -25
- /package/cjm/{glob.js → features/build/domain/glob.js} +0 -0
- /package/typings/{glob.d.ts → features/build/domain/glob.d.ts} +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Which exports of a file count: both kinds, only named exports, or only the default export. */
|
|
3
|
+
export type ExportKind = 'any' | 'named' | 'default';
|
|
4
|
+
/**
|
|
5
|
+
* Which classes of a parsed file are registered. A class is selected when it is
|
|
6
|
+
* exported, not abstract, and meets every criterion set here; an empty rule
|
|
7
|
+
* selects every exported class.
|
|
8
|
+
*/
|
|
9
|
+
export interface ClassSelector {
|
|
10
|
+
/** Default `any`. */
|
|
11
|
+
export?: ExportKind;
|
|
12
|
+
/**
|
|
13
|
+
* The class must carry one of these decorators, recognised by name (`register`, or a
|
|
14
|
+
* composed one). Default {@link DEFAULT_DECORATORS}; `[]` requires none.
|
|
15
|
+
*/
|
|
16
|
+
decorators?: string[];
|
|
17
|
+
/** A glob the class name must match, e.g. `*Service`. An anonymous default export is named after its file. */
|
|
18
|
+
name?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Class names to drop after selection, e.g. one test double sitting next to the
|
|
21
|
+
* real registration in the same file.
|
|
22
|
+
*/
|
|
23
|
+
excludeClasses?: string[];
|
|
24
|
+
/** A glob the class name must NOT match, e.g. `*Mock`. An anonymous default export is named after its file. */
|
|
25
|
+
excludeName?: string;
|
|
26
|
+
}
|
|
27
|
+
/** A {@link ClassSelector} with its defaults filled in and its globs compiled. */
|
|
28
|
+
export interface ResolvedClassSelector {
|
|
29
|
+
export: ExportKind;
|
|
30
|
+
decorators?: string[];
|
|
31
|
+
name?: RegExp;
|
|
32
|
+
excludeClasses?: string[];
|
|
33
|
+
excludeName?: RegExp;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `compilerOptions` of a bundle config: the tsconfig's own options plus the bundler's.
|
|
37
|
+
* `importExtension` and `classes` are read by `tic build`; every other option (`paths`,
|
|
38
|
+
* `baseUrl`, `rootDir`, `moduleResolution`, ...) is handed to TypeScript on top of the
|
|
39
|
+
* extended tsconfig, exactly as a child tsconfig's would be.
|
|
40
|
+
*/
|
|
41
|
+
export interface BundleCompilerOptions {
|
|
42
|
+
/** Extension of generated imports. Inferred from the tsconfig's `moduleResolution` when omitted. */
|
|
43
|
+
importExtension?: string;
|
|
44
|
+
/** Which classes of a scanned file are registered. Default: every exported class decorated with `@register`. */
|
|
45
|
+
classes?: ClassSelector;
|
|
46
|
+
[option: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The shape of `*.bundle.json`: one bundle, written as a tsconfig. `extends`, `include`,
|
|
50
|
+
* `exclude` and `compilerOptions` mean what they mean in a tsconfig, so the files the bundle
|
|
51
|
+
* scans are the files this config would compile; `output`, `name` and the bundler's
|
|
52
|
+
* own compiler options describe the generated module. A project that needs several bundles
|
|
53
|
+
* keeps one config file per bundle.
|
|
54
|
+
*/
|
|
55
|
+
export interface BundleConfig {
|
|
56
|
+
$schema?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The generated file, relative to the config file. Default `<root>/<name>.bundle.ts`:
|
|
59
|
+
* `<root>` is the compiled `rootDir`, else the common folder of the files compiled.
|
|
60
|
+
*/
|
|
61
|
+
output?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The bundle's name: letters, digits, `-` and `_`, starting with a letter. Default: the
|
|
64
|
+
* config file's stem (`production.bundle.json` -> `production`), else {@link DEFAULT_BUNDLE_NAME}.
|
|
65
|
+
* It names the default output (`production.bundle.ts`) and the generated class,
|
|
66
|
+
* an `IContainerModule` (`ProductionBundle`, see {@link toClassName}).
|
|
67
|
+
*/
|
|
68
|
+
name?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The tsconfig this config extends, as a tsconfig's own `extends`. Relative to the config
|
|
71
|
+
* file. Default `./tsconfig.json`, which may be absent; a tsconfig named here must exist.
|
|
72
|
+
*/
|
|
73
|
+
extends?: string;
|
|
74
|
+
/** tsconfig `include`: replaces the extended tsconfig's. */
|
|
75
|
+
include?: string[];
|
|
76
|
+
/** tsconfig `exclude`: replaces the extended tsconfig's. {@link DEFAULT_EXCLUDE} applies regardless. */
|
|
77
|
+
exclude?: string[];
|
|
78
|
+
compilerOptions?: BundleCompilerOptions;
|
|
79
|
+
}
|
|
80
|
+
export declare const DEFAULT_EXTENDS = "./tsconfig.json";
|
|
81
|
+
/** The bundle name when the config file gives none, e.g. building from `tsconfig.json` alone. */
|
|
82
|
+
export declare const DEFAULT_BUNDLE_NAME = "base";
|
|
83
|
+
/** What `classes.decorators` requires when omitted: the library's own `@register`. */
|
|
84
|
+
export declare const DEFAULT_DECORATORS: string[];
|
|
85
|
+
/** Files never scanned, whatever the tsconfig compiles: tests, and anything under `node_modules`. */
|
|
86
|
+
export declare const DEFAULT_EXCLUDE: string[];
|
|
87
|
+
/** The tsconfig part of a bundle config, handed to TypeScript as a tsconfig of its own. */
|
|
88
|
+
export interface TsconfigOverrides {
|
|
89
|
+
include?: string[];
|
|
90
|
+
exclude?: string[];
|
|
91
|
+
/** `compilerOptions` without the bundler's own options. */
|
|
92
|
+
compilerOptions: Record<string, unknown>;
|
|
93
|
+
}
|
|
94
|
+
/** A {@link BundleConfig} whose defaults are filled in and whose paths are absolute. */
|
|
95
|
+
export interface ResolvedConfig {
|
|
96
|
+
/** The config file itself. */
|
|
97
|
+
file: string;
|
|
98
|
+
dir: string;
|
|
99
|
+
/** `undefined`: derived from what is compiled at build time (see {@link BundleConfig.output}). */
|
|
100
|
+
output?: string;
|
|
101
|
+
/** The bundle name: `production` for `production.bundle.json`. */
|
|
102
|
+
name: string;
|
|
103
|
+
/** The generated class: `ProductionBundle`. */
|
|
104
|
+
className: string;
|
|
105
|
+
/** The extended tsconfig; `required` when the config names it, so it must exist. */
|
|
106
|
+
tsconfig: {
|
|
107
|
+
file: string;
|
|
108
|
+
required: boolean;
|
|
109
|
+
};
|
|
110
|
+
/** What the config sets on top of {@link tsconfig}. */
|
|
111
|
+
overrides: TsconfigOverrides;
|
|
112
|
+
importExtension?: string;
|
|
113
|
+
classes: ResolvedClassSelector;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* One `*.bundle.json` / `*.bundle.yaml`: a tsconfig with the bundler's fields. The published
|
|
117
|
+
* `tic.schema.json` is generated from it (`ticConfigJsonSchema`), so the schema editors
|
|
118
|
+
* validate against cannot drift from what `tic build` accepts.
|
|
119
|
+
*/
|
|
120
|
+
export declare const BUNDLE_CONFIG_SCHEMA: z.ZodObject<{
|
|
121
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
122
|
+
extends: z.ZodOptional<z.ZodString>;
|
|
123
|
+
output: z.ZodOptional<z.ZodString>;
|
|
124
|
+
name: z.ZodOptional<z.ZodString>;
|
|
125
|
+
include: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
126
|
+
exclude: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
127
|
+
compilerOptions: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
importExtension: z.ZodOptional<z.ZodString>;
|
|
129
|
+
classes: z.ZodOptional<z.ZodObject<{
|
|
130
|
+
export: z.ZodDefault<z.ZodEnum<{
|
|
131
|
+
default: "default";
|
|
132
|
+
any: "any";
|
|
133
|
+
named: "named";
|
|
134
|
+
}>>;
|
|
135
|
+
decorators: z.ZodDefault<z.ZodCustom<string[], string[]>>;
|
|
136
|
+
name: z.ZodOptional<z.ZodString>;
|
|
137
|
+
excludeClasses: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
138
|
+
excludeName: z.ZodOptional<z.ZodString>;
|
|
139
|
+
}, z.core.$strict>>;
|
|
140
|
+
paths: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
141
|
+
rootDir: z.ZodOptional<z.ZodString>;
|
|
142
|
+
}, z.core.$loose>>;
|
|
143
|
+
}, z.core.$strict>;
|
|
144
|
+
/**
|
|
145
|
+
* A config file is named `<name>.bundle.json`, `<name>.bundle.yaml` or `<name>.bundle.yml`,
|
|
146
|
+
* e.g. `app.bundle.json`, `production.bundle.yaml`. Every format has the same shape.
|
|
147
|
+
*/
|
|
148
|
+
export declare const CONFIG_FILE_SUFFIXES: string[];
|
|
149
|
+
/** The config suffix `file` ends with, if any. */
|
|
150
|
+
export declare const configSuffix: (file: string) => string | undefined;
|
|
151
|
+
/** The generated class for a bundle name: `production` -> `ProductionBundle`, `my-app_v2` -> `MyAppV2Bundle`. */
|
|
152
|
+
export declare function toClassName(name: string): string;
|
|
153
|
+
/**
|
|
154
|
+
* Validates parsed `*.bundle.json` content and resolves its paths against `file`'s directory.
|
|
155
|
+
*
|
|
156
|
+
* @throws {TicConfigError} when the content does not match the config shape; the message names the field.
|
|
157
|
+
*/
|
|
158
|
+
export declare function resolveConfig(content: unknown, file: string): ResolvedConfig;
|
|
159
|
+
//# sourceMappingURL=BuildConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuildConfig.d.ts","sourceRoot":"","sources":["../../../lib/features/build/BuildConfig.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ILogger } from '../../services/ConsoleLogger.js';
|
|
3
|
+
import { type IOutputService } from '../../services/OutputService.js';
|
|
4
|
+
import { type IBundleBuilder } from './services/BundleBuilder.js';
|
|
5
|
+
import { type ITicConfigService } from './services/TicConfigService.js';
|
|
6
|
+
export declare const BUILD_OPTIONS: z.ZodObject<{
|
|
7
|
+
config: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
8
|
+
check: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type BuildCliOptions = z.output<typeof BUILD_OPTIONS>;
|
|
11
|
+
/** `tic build [--config <path>]... [--check]`. */
|
|
12
|
+
export declare class BuildController {
|
|
13
|
+
private readonly cwd;
|
|
14
|
+
private readonly configs;
|
|
15
|
+
private readonly builder;
|
|
16
|
+
private readonly output;
|
|
17
|
+
private readonly logger;
|
|
18
|
+
constructor(cwd: string, configs: ITicConfigService, builder: IBundleBuilder, output: IOutputService, logger: ILogger);
|
|
19
|
+
/**
|
|
20
|
+
* Builds every config named with `--config`, else every `*.bundle.{json,yaml,yml}` of the
|
|
21
|
+
* package, else one bundle from its `tsconfig.json`. With `--check` nothing is written and
|
|
22
|
+
* an out-of-date bundle fails the run. One line per bundle goes to stdout, warnings to
|
|
23
|
+
* stderr; an error names the config it came from.
|
|
24
|
+
*
|
|
25
|
+
* @throws {UsageError} when an option is unknown or `--config` has no value.
|
|
26
|
+
* @throws {TicConfigError} when a config or its tsconfig is missing or invalid, or none can be found.
|
|
27
|
+
* @throws {StaleBundlesError} when `--check` finds a bundle that differs from what a build would write.
|
|
28
|
+
*/
|
|
29
|
+
build(options: BuildCliOptions): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=BuildController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuildController.d.ts","sourceRoot":"","sources":["../../../lib/features/build/BuildController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,KAAK,cAAc,EAAwC,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE,KAAK,iBAAiB,EAAuC,MAAM,6BAA6B,CAAC;AAE1G,eAAO,MAAM,aAAa;;;iBAGxB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAW7D,kDAAkD;AAClD,qBACa,eAAe;IAEK,OAAO,CAAC,QAAQ,CAAC,GAAG;IACf,OAAO,CAAC,QAAQ,CAAC,OAAO;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAJD,GAAG,EAAE,MAAM,EACN,OAAO,EAAE,iBAAiB,EAC7B,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,cAAc,EAC7B,MAAM,EAAE,OAAO;IAG1D;;;;;;;;;OASG;IAEH,KAAK,CAAgE,OAAO,EAAE,eAAe,GAAG,IAAI;CAiBrG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuildModule.d.ts","sourceRoot":"","sources":["../../../lib/features/build/BuildModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAqB,MAAM,kBAAkB,CAAC;AAK7F,qBAAa,WAAY,YAAW,gBAAgB;IAClD,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;CAMrC"}
|
|
@@ -5,8 +5,8 @@ interface Alias {
|
|
|
5
5
|
targets: string[];
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Import paths as a project's `tsconfig.json` sees them:
|
|
9
|
-
*
|
|
8
|
+
* Import paths as a project's `tsconfig.json` sees them: writes imports in the
|
|
9
|
+
* form of its `paths` aliases where one matches.
|
|
10
10
|
*/
|
|
11
11
|
export declare class ImportPaths {
|
|
12
12
|
private readonly aliases;
|
|
@@ -17,16 +17,9 @@ export declare class ImportPaths {
|
|
|
17
17
|
*/
|
|
18
18
|
static fromOptions(options: ts.CompilerOptions, tsconfigFile: string, importExtension?: string): ImportPaths;
|
|
19
19
|
constructor(aliases: Alias[], extension: string);
|
|
20
|
-
/**
|
|
21
|
-
* The folder a namespace names: a path relative to `baseDir`, or a `paths` alias.
|
|
22
|
-
*
|
|
23
|
-
* @throws {NamespaceNotFoundError} when the namespace is neither an existing folder nor an alias of one.
|
|
24
|
-
*/
|
|
25
|
-
resolveNamespace(namespace: string, baseDir: string): string;
|
|
26
20
|
/** The specifier `fromFile` imports `toFile` by: its most specific alias, else a relative path. */
|
|
27
21
|
specifier(fromFile: string, toFile: string): string;
|
|
28
22
|
private bestAlias;
|
|
29
|
-
private aliasTargets;
|
|
30
23
|
/** A longer matched target prefix is a more specific alias; an exact file alias beats every wildcard. */
|
|
31
24
|
private matchAlias;
|
|
32
25
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportPaths.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/ImportPaths.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAUD;;;GAGG;AACH,qBAAa,WAAW;IAmBpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM;IAnB5B;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW;gBAczF,OAAO,EAAE,KAAK,EAAE,EACxB,SAAS,EAAE,MAAM;IAG5B,mGAAmG;IACnG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAUnD,OAAO,CAAC,SAAS;IAWjB,yGAAyG;IACzG,OAAO,CAAC,UAAU;CAanB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The root of the package `dir` belongs to: the nearest folder, `dir` or above, with a
|
|
3
|
+
* `package.json` — the project root in a single-package project, the package in a
|
|
4
|
+
* monorepo. `dir` itself when no folder above has one.
|
|
5
|
+
*/
|
|
6
|
+
export declare function findPackageRoot(dir: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* The `*.bundle.{json,yaml,yml}` configs in `dir` (not its sub-folders), sorted by name.
|
|
9
|
+
*
|
|
10
|
+
* @throws {TicConfigError} when one bundle is described in two formats, e.g. `app.bundle.json` and `app.bundle.yaml`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function findConfigFiles(dir: string): string[];
|
|
13
|
+
//# sourceMappingURL=configFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configFiles.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/configFiles.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMnD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAarD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
classes: (DiscoveredClass & {
|
|
8
|
+
specifier: string;
|
|
9
|
+
})[];
|
|
10
|
+
}
|
|
11
|
+
/** The first line of every generated bundle; marks it as output, never input. */
|
|
12
|
+
export declare const GENERATED_HEADER = "// Generated by `tic build`";
|
|
13
|
+
/** What `protocols/Bundle.ts.hbs` renders. */
|
|
14
|
+
export interface BundleView {
|
|
15
|
+
configPath: string;
|
|
16
|
+
name: string;
|
|
17
|
+
imports: {
|
|
18
|
+
specifier: string;
|
|
19
|
+
defaultName?: string;
|
|
20
|
+
named: string[];
|
|
21
|
+
}[];
|
|
22
|
+
registrations: string[];
|
|
23
|
+
}
|
|
24
|
+
/** The protocol a bundle is rendered from. */
|
|
25
|
+
export declare const BUNDLE_PROTOCOL = "Bundle.ts.hbs";
|
|
26
|
+
/**
|
|
27
|
+
* Prepares the data the bundle protocol renders: unique local names, and one import
|
|
28
|
+
* per file in file order.
|
|
29
|
+
*/
|
|
30
|
+
export declare function bundleView({ name, configPath, classes }: EmitInput): BundleView;
|
|
31
|
+
/**
|
|
32
|
+
* Renders the generated bundle — static imports, `registrations`, and the bundle applying them —
|
|
33
|
+
* from its protocol, `protocols/Bundle.ts.hbs`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function emitBundle(input: EmitInput): string;
|
|
36
|
+
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/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,OAAO,EAAE,CAAC,eAAe,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CACtD;AAED,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,gCAAgC,CAAC;AAE9D,8CAA8C;AAC9C,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IACxE,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,8CAA8C;AAC9C,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAI/C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,SAAS,GAAG,UAAU,CAqB/E;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ResolvedClassSelector } from '
|
|
1
|
+
import type { ResolvedClassSelector } from '../BuildConfig.js';
|
|
2
2
|
/** An exported class the generated bundle registers. */
|
|
3
3
|
export interface DiscoveredClass {
|
|
4
4
|
file: string;
|
|
@@ -29,8 +29,6 @@ export interface DiscoveredClass {
|
|
|
29
29
|
}
|
|
30
30
|
/** A TypeScript source file the bundler may parse: not a declaration file. */
|
|
31
31
|
export declare const isSourceFile: (file: string) => boolean;
|
|
32
|
-
/** Source files of `dir`, sorted by path so the generated output is stable across machines. */
|
|
33
|
-
export declare function listSourceFiles(dir: string, recursive: boolean, isExcluded: (file: string) => boolean): string[];
|
|
34
32
|
/**
|
|
35
33
|
* The exported, non-abstract classes of one file that `selector` selects, in
|
|
36
34
|
* declaration order. Syntax only: decorators are recognised by name, not by type.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/scan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,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;IACrB;;;;OAIG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;;;OAIG;IACH,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CACpD;AAKD,8EAA8E;AAC9E,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,OAAiE,CAAC;AA2B9G;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,qBAAqB,EAC/B,IAAI,SAA6B,GAChC,eAAe,EAAE,CAmFnB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DiscoveredClass } from './scan.js';
|
|
2
|
+
/**
|
|
3
|
+
* A heuristic for "two selected classes bind the same token": when the decorator's
|
|
4
|
+
* first argument is a plain identifier, equal identifiers are almost always the same
|
|
5
|
+
* token, and registration is last-wins, so one silently replaces the other. Purely
|
|
6
|
+
* syntactic — aliased imports and computed keys are not resolved.
|
|
7
|
+
*
|
|
8
|
+
* Scope-gated classes (`@perPage('stations')`, `@perPage('sessions')`) share the
|
|
9
|
+
* token but are not last-wins: the classes are distinguished by a decorator they
|
|
10
|
+
* share called with different arguments, so each scope registers its own. Those
|
|
11
|
+
* groups are not warned about.
|
|
12
|
+
*/
|
|
13
|
+
export declare function tokenCollisions(classes: DiscoveredClass[]): string[];
|
|
14
|
+
//# sourceMappingURL=tokenCollisions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenCollisions.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/tokenCollisions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAmBpE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ResolvedConfig } from '../BuildConfig.js';
|
|
2
|
+
import { ImportPaths } from './ImportPaths.js';
|
|
3
|
+
/** What a bundle compiles: the bundle config read as a tsconfig, on top of the tsconfig it extends. */
|
|
4
|
+
export interface CompiledTsconfig {
|
|
5
|
+
importPaths: ImportPaths;
|
|
6
|
+
/** Absolute paths of the files compiled. */
|
|
7
|
+
fileNames: string[];
|
|
8
|
+
/**
|
|
9
|
+
* Where the sources live, as tsc sees it: `rootDir`, else the longest common folder of
|
|
10
|
+
* the non-declaration files compiled, else the config's folder.
|
|
11
|
+
*/
|
|
12
|
+
rootDir: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Compiles a bundle config as a tsconfig, following `extends`: the files it compiles
|
|
16
|
+
* (`include` / `exclude`, as overridden), its `paths` aliases and import extension.
|
|
17
|
+
*
|
|
18
|
+
* @throws {TicConfigError} when a required tsconfig is missing, or the config or a tsconfig it extends is invalid.
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadTsconfig(config: ResolvedConfig): CompiledTsconfig;
|
|
21
|
+
//# sourceMappingURL=tsconfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/tsconfig.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,uGAAuG;AACvG,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,WAAW,CAAC;IACzB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AA+BD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAerE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { SingleToken } from 'ts-ioc-container';
|
|
2
|
+
import { type IRenderService } from '../../../services/HandlebarsRenderService.js';
|
|
3
|
+
import { type IFileSystemService } from '../../../services/NodeFileSystemService.js';
|
|
4
|
+
import { type ITicConfigService } from './TicConfigService.js';
|
|
5
|
+
/** What one build does. Paths resolve against the run's working directory. */
|
|
6
|
+
export interface BuildRequest {
|
|
7
|
+
/**
|
|
8
|
+
* Path of the `*.bundle.json` to build, relative to the working directory. Omitted: build
|
|
9
|
+
* from the `tsconfig.json` of the package the working directory is in (see `findPackageRoot`),
|
|
10
|
+
* every setting at its default.
|
|
11
|
+
*/
|
|
12
|
+
config?: string;
|
|
13
|
+
/** Compare instead of writing: outputs that would change are reported `stale`. */
|
|
14
|
+
check?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface BuildOptions extends BuildRequest {
|
|
17
|
+
/** Default `process.cwd()`. */
|
|
18
|
+
cwd?: string;
|
|
19
|
+
}
|
|
20
|
+
/** `written` / `unchanged` after a build; `stale` / `unchanged` after a check. */
|
|
21
|
+
export type OutputStatus = 'written' | 'unchanged' | 'stale';
|
|
22
|
+
export interface OutputResult {
|
|
23
|
+
/** Absolute path of the generated file. */
|
|
24
|
+
file: string;
|
|
25
|
+
/** Name of the generated class. */
|
|
26
|
+
bundle: string;
|
|
27
|
+
status: OutputStatus;
|
|
28
|
+
registrations: number;
|
|
29
|
+
content: string;
|
|
30
|
+
}
|
|
31
|
+
export interface BuildResult {
|
|
32
|
+
/** Absolute path of the config that was built. */
|
|
33
|
+
config: string;
|
|
34
|
+
output: OutputResult;
|
|
35
|
+
/**
|
|
36
|
+
* Non-fatal problems found while building, e.g. two selected classes passing the same
|
|
37
|
+
* decorator token.
|
|
38
|
+
*/
|
|
39
|
+
warnings: string[];
|
|
40
|
+
}
|
|
41
|
+
export interface IBundleBuilder {
|
|
42
|
+
/**
|
|
43
|
+
* Generates the bundle a config describes. Nothing is written unless generation succeeds.
|
|
44
|
+
*
|
|
45
|
+
* @throws {TicConfigError} when the config or the tsconfig it extends is missing or invalid.
|
|
46
|
+
*/
|
|
47
|
+
build(request?: BuildRequest): BuildResult;
|
|
48
|
+
}
|
|
49
|
+
export declare const IBundleBuilderKey: SingleToken<IBundleBuilder>;
|
|
50
|
+
export declare class BundleBuilder implements IBundleBuilder {
|
|
51
|
+
private readonly cwd;
|
|
52
|
+
private readonly configs;
|
|
53
|
+
private readonly fs;
|
|
54
|
+
private readonly renderer;
|
|
55
|
+
constructor(cwd: string, configs: ITicConfigService, fs: IFileSystemService, renderer: IRenderService);
|
|
56
|
+
/**
|
|
57
|
+
* @throws {TicConfigError} when the config or the tsconfig it extends is missing or invalid.
|
|
58
|
+
*/
|
|
59
|
+
build({ config, check }?: BuildRequest): BuildResult;
|
|
60
|
+
/**
|
|
61
|
+
* @throws {TicConfigError} when the config or the tsconfig it extends is missing or invalid.
|
|
62
|
+
*/
|
|
63
|
+
private generate;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=BundleBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BundleBuilder.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/services/BundleBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,2CAA2C,CAAC;AACnG,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,yCAAyC,CAAC;AAQzG,OAAO,EAAE,KAAK,iBAAiB,EAAuC,MAAM,oBAAoB,CAAC;AAIjG,8EAA8E;AAC9E,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,+BAA+B;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;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,MAAM,EAAE,YAAY,CAAC;IACrB;;;OAGG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CAC5C;AAED,eAAO,MAAM,iBAAiB,6BAAoD,CAAC;AAEnF,qBACa,aAAc,YAAW,cAAc;IAEnB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACf,OAAO,CAAC,QAAQ,CAAC,OAAO;IACvB,OAAO,CAAC,QAAQ,CAAC,EAAE;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAHV,GAAG,EAAE,MAAM,EACN,OAAO,EAAE,iBAAiB,EACzB,EAAE,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,cAAc;IAG1E;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,KAAa,EAAE,GAAE,YAAiB,GAAG,WAAW;IAiBhE;;OAEG;IACH,OAAO,CAAC,QAAQ;CA8BjB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SingleToken } from 'ts-ioc-container';
|
|
2
|
+
import { type IFileSystemService } from '../../../services/NodeFileSystemService.js';
|
|
3
|
+
import { type ResolvedConfig } from '../BuildConfig.js';
|
|
4
|
+
/** The tsconfig a build without a config file extends. */
|
|
5
|
+
export declare const TSCONFIG_FILE = "tsconfig.json";
|
|
6
|
+
export interface ITicConfigService {
|
|
7
|
+
/**
|
|
8
|
+
* Reads and validates a `*.bundle.json`, `*.bundle.yaml` or `*.bundle.yml`.
|
|
9
|
+
*
|
|
10
|
+
* @throws {TicConfigError} when the file is missing, cannot be parsed, or does not match the config shape.
|
|
11
|
+
*/
|
|
12
|
+
load(file: string): ResolvedConfig;
|
|
13
|
+
/**
|
|
14
|
+
* The configs to build, as absolute paths: the ones named (relative to the working
|
|
15
|
+
* directory), else every `*.bundle.{json,yaml,yml}` at the root of the package the working
|
|
16
|
+
* directory is in, else `[undefined]` — one build from that package's `tsconfig.json`
|
|
17
|
+
* with default settings. Never looks past the package into a workspace root.
|
|
18
|
+
*
|
|
19
|
+
* @throws {TicConfigError} when none is named and the package has neither a config nor a `tsconfig.json`, or one bundle is described in two formats.
|
|
20
|
+
*/
|
|
21
|
+
discover(named: string[]): (string | undefined)[];
|
|
22
|
+
}
|
|
23
|
+
export declare const ITicConfigServiceKey: SingleToken<ITicConfigService>;
|
|
24
|
+
export declare class TicConfigService implements ITicConfigService {
|
|
25
|
+
private readonly cwd;
|
|
26
|
+
private readonly fs;
|
|
27
|
+
constructor(cwd: string, fs: IFileSystemService);
|
|
28
|
+
/**
|
|
29
|
+
* @throws {TicConfigError} when the file is missing, cannot be parsed, or does not match the config shape.
|
|
30
|
+
*/
|
|
31
|
+
load(file: string): ResolvedConfig;
|
|
32
|
+
/**
|
|
33
|
+
* @throws {TicConfigError} when none is named and the package has neither a config nor a `tsconfig.json`, or one bundle is described in two formats.
|
|
34
|
+
*/
|
|
35
|
+
discover(named: string[]): (string | undefined)[];
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=TicConfigService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TicConfigService.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/services/TicConfigService.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIrE,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,yCAAyC,CAAC;AACzG,OAAO,EAAE,KAAK,cAAc,EAAiB,MAAM,gBAAgB,CAAC;AAGpE,0DAA0D;AAC1D,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC;IAEnC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;CACnD;AAED,eAAO,MAAM,oBAAoB,gCAA0D,CAAC;AAE5F,qBACa,gBAAiB,YAAW,iBAAiB;IAEzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACd,OAAO,CAAC,QAAQ,CAAC,EAAE;gBADR,GAAG,EAAE,MAAM,EACL,EAAE,EAAE,kBAAkB;IAG5E;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc;IAKlC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE;CAQlD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IOutputService } from '../../services/OutputService.js';
|
|
2
|
+
/** `tic help`, also `tic --help` / `tic -h`. */
|
|
3
|
+
export declare class HelpController {
|
|
4
|
+
private readonly output;
|
|
5
|
+
constructor(output: IOutputService);
|
|
6
|
+
printUsage(): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=HelpController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelpController.d.ts","sourceRoot":"","sources":["../../../lib/features/help/HelpController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,8BAA8B,CAAC;AAEtF,gDAAgD;AAChD,qBACa,cAAc;IACkB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAGlF,UAAU,IAAI,IAAI;CAGnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelpModule.d.ts","sourceRoot":"","sources":["../../../lib/features/help/HelpModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAqB,MAAM,kBAAkB,CAAC;AAI7F,qBAAa,UAAW,YAAW,gBAAgB;IACjD,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;CAGrC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IOutputService } from '../../services/OutputService.js';
|
|
2
|
+
/** `tic version`, also `tic --version` / `tic -v`. */
|
|
3
|
+
export declare class VersionController {
|
|
4
|
+
private readonly output;
|
|
5
|
+
constructor(output: IOutputService);
|
|
6
|
+
printVersion(): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=VersionController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VersionController.d.ts","sourceRoot":"","sources":["../../../lib/features/help/VersionController.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,8BAA8B,CAAC;AAItF,sDAAsD;AACtD,qBACa,iBAAiB;IACe,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAGlF,YAAY,IAAI,IAAI;CAGrB"}
|
package/typings/index.d.ts
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
export { build,
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
1
|
+
export { build, run, loadConfig, createContainer } from './app.js';
|
|
2
|
+
export { type CliIo, CliIoKey } from './domain/CliIo.js';
|
|
3
|
+
export { type GlobalConfig, GlobalConfigKey, globalConfig } from './domain/GlobalConfig.js';
|
|
4
|
+
export { Application, action, onDefault, DEFAULT_ACTION, commandArgs, parseOptions, validate, type IErrorHandler, IErrorHandlerKey, USAGE, } from './cli.js';
|
|
5
|
+
export { BuildModule } from './features/build/BuildModule.js';
|
|
6
|
+
export { BuildController, BUILD_OPTIONS, type BuildCliOptions } from './features/build/BuildController.js';
|
|
7
|
+
export { BundleBuilder, IBundleBuilderKey, type IBundleBuilder, type BuildRequest, type BuildOptions, type BuildResult, type OutputResult, type OutputStatus, } from './features/build/services/BundleBuilder.js';
|
|
8
|
+
export { TicConfigService, ITicConfigServiceKey, TSCONFIG_FILE, type ITicConfigService, } from './features/build/services/TicConfigService.js';
|
|
9
|
+
export { resolveConfig, BUNDLE_CONFIG_SCHEMA, CONFIG_FILE_SUFFIXES, DEFAULT_EXTENDS, DEFAULT_EXCLUDE, DEFAULT_BUNDLE_NAME, DEFAULT_DECORATORS, toClassName, type BundleConfig, type BundleCompilerOptions, type ClassSelector, type ExportKind, type ResolvedClassSelector, type ResolvedConfig, type TsconfigOverrides, } from './features/build/BuildConfig.js';
|
|
10
|
+
export { findConfigFiles, findPackageRoot } from './features/build/domain/configFiles.js';
|
|
11
|
+
export { ticConfigJsonSchema } from './schema/ticConfigSchema.js';
|
|
12
|
+
export { ImportPaths } from './features/build/domain/ImportPaths.js';
|
|
13
|
+
export { loadTsconfig, type CompiledTsconfig } from './features/build/domain/tsconfig.js';
|
|
14
|
+
export { findClasses, isSourceFile, type DiscoveredClass } from './features/build/domain/scan.js';
|
|
15
|
+
export { emitBundle, bundleView, BUNDLE_PROTOCOL, GENERATED_HEADER, type EmitInput, type BundleView, } from './features/build/domain/emit.js';
|
|
16
|
+
export { tokenCollisions } from './features/build/domain/tokenCollisions.js';
|
|
17
|
+
export { globToRegExp } from './features/build/domain/glob.js';
|
|
18
|
+
export { HelpModule } from './features/help/HelpModule.js';
|
|
19
|
+
export { CommonModule } from './modules/CommonModule.js';
|
|
20
|
+
export { type IOutputService, IOutputServiceKey, StdOutputService } from './services/OutputService.js';
|
|
21
|
+
export { type ILogger, ILoggerKey, ConsoleLogger } from './services/ConsoleLogger.js';
|
|
22
|
+
export { type IFileSystemService, IFileSystemServiceKey, NodeFileSystemService, } from './services/NodeFileSystemService.js';
|
|
23
|
+
export { type IRenderService, IRenderServiceKey, HandlebarsRenderService, renderProtocol, } from './services/HandlebarsRenderService.js';
|
|
24
|
+
export { TicError, TicConfigError, MissingCommandError, UnknownCommandError, UnknownActionError, UsageError, StaleBundlesError, } from './exceptions/DomainException.js';
|
|
25
|
+
export { ExceptionHandler } from './exceptions/ExceptionHandler.js';
|
|
10
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type IContainer, type IContainerModule } from 'ts-ioc-container';
|
|
2
|
+
import { type CliIo } from '../domain/CliIo.js';
|
|
3
|
+
/** Services every feature shares: the run's context, its output streams, and error reporting. */
|
|
4
|
+
export declare class CommonModule implements IContainerModule {
|
|
5
|
+
private readonly io;
|
|
6
|
+
constructor(io: CliIo);
|
|
7
|
+
applyTo(container: IContainer): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=CommonModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommonModule.d.ts","sourceRoot":"","sources":["../../lib/modules/CommonModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAqB,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,iBAAiB,CAAC;AAQvD,iGAAiG;AACjG,qBAAa,YAAa,YAAW,gBAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,KAAK;IAEtC,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;CAUrC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JSON Schema published as `tic.schema.json`, generated from the zod schema
|
|
3
|
+
* `tic build` validates with. `pnpm run generate:schema` writes it; a test fails
|
|
4
|
+
* when the committed file is stale.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ticConfigJsonSchema(): Record<string, unknown>;
|
|
7
|
+
//# sourceMappingURL=ticConfigSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticConfigSchema.d.ts","sourceRoot":"","sources":["../../lib/schema/ticConfigSchema.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgB7D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SingleToken } from 'ts-ioc-container';
|
|
2
|
+
import { type CliIo } from '../domain/CliIo.js';
|
|
3
|
+
/**
|
|
4
|
+
* Diagnostics, kept off stdout so a command's output stays machine-readable.
|
|
5
|
+
* Every line is prefixed with `tic:`.
|
|
6
|
+
*/
|
|
7
|
+
export interface ILogger {
|
|
8
|
+
/** A non-fatal problem: `tic: warning: <message>`. */
|
|
9
|
+
warn(message: string): void;
|
|
10
|
+
/** A fatal problem: `tic: <message>`. */
|
|
11
|
+
error(message: string): void;
|
|
12
|
+
}
|
|
13
|
+
export declare const ILoggerKey: SingleToken<ILogger>;
|
|
14
|
+
export declare class ConsoleLogger implements ILogger {
|
|
15
|
+
private readonly io;
|
|
16
|
+
constructor(io: CliIo);
|
|
17
|
+
warn(message: string): void;
|
|
18
|
+
error(message: string): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ConsoleLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../lib/services/ConsoleLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,iBAAiB,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,sDAAsD;IACtD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,yCAAyC;IACzC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,UAAU,sBAAsC,CAAC;AAE9D,qBACa,aAAc,YAAW,OAAO;IACT,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,KAAK;IAE5D,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG7B"}
|