@ts-ioc-container/bundler 3.0.0 → 3.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 +12 -4
- package/README.md +25 -5
- package/cjm/features/build/BuildConfig.js +17 -5
- package/cjm/features/build/domain/ImportPaths.js +13 -2
- package/cjm/schema/ticConfigSchema.js +1 -1
- package/package.json +1 -1
- package/tic.schema.json +16 -5
- package/typings/features/build/BuildConfig.d.ts +12 -3
- package/typings/features/build/BuildConfig.d.ts.map +1 -1
- package/typings/features/build/domain/ImportPaths.d.ts +14 -5
- package/typings/features/build/domain/ImportPaths.d.ts.map +1 -1
package/AGENTS.md
CHANGED
|
@@ -10,8 +10,8 @@ it.
|
|
|
10
10
|
same program). One config file describes one bundle: `<name>.bundle.json`, or the same in
|
|
11
11
|
YAML as `<name>.bundle.yaml` / `.yml` (an empty YAML file = all defaults)
|
|
12
12
|
(schema: `tic.schema.json`), shaped like a tsconfig — `extends`, `include`,
|
|
13
|
-
`exclude`, `compilerOptions` — plus the bundler's `output` and `name`
|
|
14
|
-
the top level and `compilerOptions.importExtension` / `compilerOptions.classes`;
|
|
13
|
+
`exclude`, `compilerOptions` — plus the bundler's `baseUrl`, `output` and `name`
|
|
14
|
+
at the top level and `compilerOptions.importExtension` / `compilerOptions.classes`;
|
|
15
15
|
all optional. `tic build` works on
|
|
16
16
|
the package it is invoked in (nearest `package.json` up from the working
|
|
17
17
|
directory; never a workspace root): it builds every `*.bundle.{json,yaml,yml}` there
|
|
@@ -24,9 +24,17 @@ it.
|
|
|
24
24
|
be absent; one named explicitly must exist): TypeScript parses it with the
|
|
25
25
|
bundler's own fields removed, so the files it compiles (its `include` /
|
|
26
26
|
`exclude` replacing the parent's) are the bundle's file set, and the merged
|
|
27
|
-
`paths` aliases and module resolution shape the generated imports
|
|
28
|
-
specific alias, else a relative
|
|
27
|
+
`paths` aliases, `baseUrl` and module resolution shape the generated imports
|
|
28
|
+
(most specific alias, else a path relative to `baseUrl` when the file is under
|
|
29
|
+
it, else a relative path). Every compiler option but `classes`
|
|
29
30
|
and `importExtension` goes to TypeScript, which reports unknown ones.
|
|
31
|
+
The top-level `baseUrl` (default the config's directory) is the base the
|
|
32
|
+
config's own `include`, `exclude` and `output` resolve against — so they need
|
|
33
|
+
not repeat a shared prefix — and is passed to TypeScript as
|
|
34
|
+
`compilerOptions.baseUrl` unless that is set too; `extends` stays relative to
|
|
35
|
+
the config file. With `baseUrl` set, an omitted `include` defaults to the whole
|
|
36
|
+
`baseUrl` folder (`.`); without it, an omitted `include` still inherits the
|
|
37
|
+
extended tsconfig's.
|
|
30
38
|
`output` defaults to `<root>/<name>.bundle.ts`: root = compiled `rootDir`,
|
|
31
39
|
else the common folder of the files compiled. `name` defaults to the config's
|
|
32
40
|
stem (`production.bundle.json` → `production`), else `base`; the class is
|
package/README.md
CHANGED
|
@@ -96,10 +96,11 @@ Every field is optional; `{}` is the zero-config bundle. The tsconfig fields:
|
|
|
96
96
|
|
|
97
97
|
The bundler's own fields, at the top level:
|
|
98
98
|
|
|
99
|
-
| Field
|
|
100
|
-
|
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
99
|
+
| Field | Default | Meaning |
|
|
100
|
+
| --------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
|
101
|
+
| `baseUrl` | the config file's directory | The base `include`, `exclude` and `output` resolve against, so they need not repeat a shared prefix such as `src`; also passed to TypeScript as `compilerOptions.baseUrl` |
|
|
102
|
+
| `output` | `<root>/<name>.bundle.ts` | The bundle file; `<root>` as in [Zero config](#zero-config) |
|
|
103
|
+
| `name` | the config's stem, else `base` | The bundle's name (`production.bundle.json` → `production`): names the default output and the class, `ProductionBundle` |
|
|
103
104
|
|
|
104
105
|
and under `compilerOptions`:
|
|
105
106
|
|
|
@@ -112,6 +113,24 @@ An unknown top-level field is an error, so a misspelled or removed option never
|
|
|
112
113
|
goes unnoticed. Every other compiler option is handed to TypeScript, which
|
|
113
114
|
reports an unknown one (`Unknown compiler option 'pathz'. Did you mean 'paths'?`).
|
|
114
115
|
|
|
116
|
+
`baseUrl` lets a config read in source terms instead of from the package root:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"baseUrl": "src",
|
|
121
|
+
"output": ".generated/container.bundle.ts",
|
|
122
|
+
"exclude": [".generated/**", "db/testing/**"]
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
writes `src/.generated/container.bundle.ts` from everything under `src/` except
|
|
127
|
+
those two folders — with `baseUrl` set, an omitted `include` scans the whole
|
|
128
|
+
`baseUrl` folder. `extends` still resolves against the config file.
|
|
129
|
+
|
|
130
|
+
Generated imports read like the tsconfig you compile with: a file covered by a
|
|
131
|
+
`paths` alias is imported in that alias form, a file under `baseUrl` in
|
|
132
|
+
`baseUrl` form (`services/Logger`), and anything else relative to the bundle.
|
|
133
|
+
|
|
115
134
|
## Several bundles
|
|
116
135
|
|
|
117
136
|
Need more than one bundle — per environment, per app? Add a config per bundle.
|
|
@@ -144,7 +163,8 @@ sits in a folder the other scans.
|
|
|
144
163
|
The files a bundle scans are the files its config compiles, as `tsc` would see
|
|
145
164
|
them: the extended tsconfig's `files` / `include` / `exclude` (following its own
|
|
146
165
|
`extends`), with this config's `include` and `exclude` replacing the parent's —
|
|
147
|
-
exactly as in a child tsconfig. Globs are relative to
|
|
166
|
+
exactly as in a child tsconfig. Globs are relative to `baseUrl`, defaulting to
|
|
167
|
+
the config file's directory.
|
|
148
168
|
|
|
149
169
|
Test files (`*.spec.ts`, `*.test.ts`, their `.tsx` twins and `__tests__/`) and
|
|
150
170
|
`node_modules/` are never scanned, whatever the tsconfig compiles, since test
|
|
@@ -67,13 +67,18 @@ const COMPILER_OPTIONS_SCHEMA = zod_1.z
|
|
|
67
67
|
.describe('tsconfig `rootDir`: where the default output (<rootDir>/<name>.bundle.ts) goes.'),
|
|
68
68
|
}, expected('an object'))
|
|
69
69
|
.describe("tsconfig `compilerOptions`, plus the bundler's own `importExtension` and `classes`. Every other option is handed to TypeScript on top of the extended tsconfig's, which validates it.");
|
|
70
|
-
const tsconfigGlobs = (field) => stringList()
|
|
70
|
+
const tsconfigGlobs = (field, note = '') => stringList()
|
|
71
|
+
.optional()
|
|
72
|
+
.describe(`tsconfig \`${field}\`: replaces the extended tsconfig's. Relative to \`baseUrl\`.${note}`);
|
|
71
73
|
exports.BUNDLE_CONFIG_SCHEMA = zod_1.z.strictObject({
|
|
72
74
|
$schema: zod_1.z.string().optional(),
|
|
73
75
|
extends: nonEmptyString()
|
|
74
76
|
.optional()
|
|
75
77
|
.meta({ default: exports.DEFAULT_EXTENDS })
|
|
76
78
|
.describe("The tsconfig this bundle extends, as a tsconfig's own `extends`: its file set, `paths` aliases and module resolution apply unless this file overrides them. Relative to this file. The default may be absent; a tsconfig named here must exist."),
|
|
79
|
+
baseUrl: nonEmptyString()
|
|
80
|
+
.optional()
|
|
81
|
+
.describe("The base folder this config's relative `include`, `exclude` and `output` resolve against, so they need not repeat a shared prefix such as `src`. Relative to this file; default this file's directory. Also handed to TypeScript as `compilerOptions.baseUrl` (unless that is set too), so generated imports use it."),
|
|
77
82
|
output: nonEmptyString()
|
|
78
83
|
.optional()
|
|
79
84
|
.describe('The bundle file (convention: *.bundle.ts). Default `<root>/<name>.bundle.ts`: <root> is the compiled rootDir, else the common folder of the files compiled.'),
|
|
@@ -82,7 +87,7 @@ exports.BUNDLE_CONFIG_SCHEMA = zod_1.z.strictObject({
|
|
|
82
87
|
.regex(BUNDLE_NAME, expected('letters, digits, "-" or "_", starting with a letter'))
|
|
83
88
|
.optional()
|
|
84
89
|
.describe('The bundle\'s name: letters, digits, "-" and "_", starting with a letter. Default: this file\'s stem (production.bundle.json → production), else "base". It names the default output (production.bundle.ts) and the generated IContainerModule class (ProductionBundle).'),
|
|
85
|
-
include: tsconfigGlobs('include'),
|
|
90
|
+
include: tsconfigGlobs('include', ' When `baseUrl` is set and this is omitted, the whole `baseUrl` folder (`.`) is scanned.'),
|
|
86
91
|
exclude: tsconfigGlobs('exclude'),
|
|
87
92
|
compilerOptions: COMPILER_OPTIONS_SCHEMA.optional(),
|
|
88
93
|
}, expected('an object'));
|
|
@@ -128,18 +133,25 @@ function resolveConfig(content, file) {
|
|
|
128
133
|
const result = exports.BUNDLE_CONFIG_SCHEMA.safeParse(content);
|
|
129
134
|
if (!result.success)
|
|
130
135
|
throw new DomainException_1.TicConfigError(formatIssues(result.error));
|
|
131
|
-
const { output, name, extends: tsconfig, include, exclude, compilerOptions = {} } = result.data;
|
|
136
|
+
const { output, name, baseUrl, extends: tsconfig, include, exclude, compilerOptions = {} } = result.data;
|
|
132
137
|
const { importExtension, classes, ...tsCompilerOptions } = compilerOptions;
|
|
133
138
|
const dir = node_path_1.default.dirname(file);
|
|
139
|
+
const base = baseUrl === undefined ? dir : node_path_1.default.resolve(dir, baseUrl);
|
|
140
|
+
const includeGlobs = include ?? (baseUrl === undefined ? undefined : ['.']);
|
|
141
|
+
const rebase = (globs) => globs?.map((glob) => (node_path_1.default.isAbsolute(glob) ? glob : (0, glob_1.toPosix)(node_path_1.default.relative(dir, node_path_1.default.resolve(base, glob))) || '.'));
|
|
134
142
|
const bundleName = name ?? configStem(file) ?? exports.DEFAULT_BUNDLE_NAME;
|
|
135
143
|
return {
|
|
136
144
|
file,
|
|
137
145
|
dir,
|
|
138
|
-
output: output === undefined ? undefined : node_path_1.default.resolve(
|
|
146
|
+
output: output === undefined ? undefined : node_path_1.default.resolve(base, output),
|
|
139
147
|
name: bundleName,
|
|
140
148
|
className: toClassName(bundleName),
|
|
141
149
|
tsconfig: { file: node_path_1.default.resolve(dir, tsconfig ?? exports.DEFAULT_EXTENDS), required: tsconfig !== undefined },
|
|
142
|
-
overrides: {
|
|
150
|
+
overrides: {
|
|
151
|
+
include: rebase(includeGlobs),
|
|
152
|
+
exclude: rebase(exclude),
|
|
153
|
+
compilerOptions: baseUrl === undefined ? tsCompilerOptions : { baseUrl, ...tsCompilerOptions },
|
|
154
|
+
},
|
|
143
155
|
importExtension,
|
|
144
156
|
classes: toClassSelector(classes),
|
|
145
157
|
};
|
|
@@ -48,6 +48,7 @@ function splitWildcard(pattern) {
|
|
|
48
48
|
class ImportPaths {
|
|
49
49
|
aliases;
|
|
50
50
|
extension;
|
|
51
|
+
baseUrl;
|
|
51
52
|
static fromOptions(options, tsconfigFile, importExtension) {
|
|
52
53
|
const { paths = {}, baseUrl, pathsBasePath, moduleResolution } = options;
|
|
53
54
|
const base = baseUrl ?? (typeof pathsBasePath === 'string' ? pathsBasePath : node_path_1.default.dirname(tsconfigFile));
|
|
@@ -56,11 +57,12 @@ class ImportPaths {
|
|
|
56
57
|
targets: targets.map((target) => (0, glob_1.toPosix)(node_path_1.default.resolve(base, target))),
|
|
57
58
|
}));
|
|
58
59
|
const nodeEsm = moduleResolution === ts.ModuleResolutionKind.Node16 || moduleResolution === ts.ModuleResolutionKind.NodeNext;
|
|
59
|
-
return new ImportPaths(aliases, importExtension ?? (nodeEsm ? '.js' : ''));
|
|
60
|
+
return new ImportPaths(aliases, importExtension ?? (nodeEsm ? '.js' : ''), baseUrl === undefined ? undefined : (0, glob_1.toPosix)(baseUrl));
|
|
60
61
|
}
|
|
61
|
-
constructor(aliases, extension) {
|
|
62
|
+
constructor(aliases, extension, baseUrl) {
|
|
62
63
|
this.aliases = aliases;
|
|
63
64
|
this.extension = extension;
|
|
65
|
+
this.baseUrl = baseUrl;
|
|
64
66
|
}
|
|
65
67
|
specifier(fromFile, toFile) {
|
|
66
68
|
const target = (0, glob_1.toPosix)(toFile);
|
|
@@ -68,9 +70,18 @@ class ImportPaths {
|
|
|
68
70
|
const best = this.bestAlias(target, bare);
|
|
69
71
|
if (best)
|
|
70
72
|
return best.spec;
|
|
73
|
+
const fromBaseUrl = this.baseUrlSpecifier(bare);
|
|
74
|
+
if (fromBaseUrl)
|
|
75
|
+
return `${fromBaseUrl}${this.extension}`;
|
|
71
76
|
const relative = (0, glob_1.toPosix)(node_path_1.default.relative(node_path_1.default.dirname(fromFile), bare));
|
|
72
77
|
return `${relative.startsWith('.') ? relative : `./${relative}`}${this.extension}`;
|
|
73
78
|
}
|
|
79
|
+
baseUrlSpecifier(bare) {
|
|
80
|
+
if (!this.baseUrl)
|
|
81
|
+
return undefined;
|
|
82
|
+
const prefix = this.baseUrl.endsWith('/') ? this.baseUrl : `${this.baseUrl}/`;
|
|
83
|
+
return bare.startsWith(prefix) ? bare.slice(prefix.length) : undefined;
|
|
84
|
+
}
|
|
74
85
|
bestAlias(target, bare) {
|
|
75
86
|
let best;
|
|
76
87
|
for (const { pattern, targets } of this.aliases) {
|
|
@@ -14,7 +14,7 @@ function ticConfigJsonSchema() {
|
|
|
14
14
|
$schema,
|
|
15
15
|
$id: 'https://github.com/IgorBabkin/ts-ioc-container/tree/main/packages/bundler/tic.schema.json',
|
|
16
16
|
title: '*.bundle.json / *.bundle.yaml',
|
|
17
|
-
description: "One bundle generated by `tic build` (@ts-ioc-container/bundler). `tic build` builds every `*.bundle.json` / `*.bundle.yaml` / `*.bundle.yml` at the root of the package it is invoked in, or — with none — one bundle from that package's tsconfig.json with every setting at its default.
|
|
17
|
+
description: "One bundle generated by `tic build` (@ts-ioc-container/bundler). `tic build` builds every `*.bundle.json` / `*.bundle.yaml` / `*.bundle.yml` at the root of the package it is invoked in, or — with none — one bundle from that package's tsconfig.json with every setting at its default. `extends` and `baseUrl` resolve against this file's directory; `include`, `exclude` and `output` resolve against `baseUrl`, defaulting to this file's directory.",
|
|
18
18
|
...rest,
|
|
19
19
|
};
|
|
20
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-ioc-container/bundler",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Bundles your dependencies into a single container module for ts-ioc-container: the `tic` CLI scans folders (by path or tsconfig alias) and generates one typed bundle that registers every class — `container.useModule(new AppBundle())`.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
package/tic.schema.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "https://github.com/IgorBabkin/ts-ioc-container/tree/main/packages/bundler/tic.schema.json",
|
|
4
4
|
"title": "*.bundle.json / *.bundle.yaml",
|
|
5
|
-
"description": "One bundle generated by `tic build` (@ts-ioc-container/bundler). `tic build` builds every `*.bundle.json` / `*.bundle.yaml` / `*.bundle.yml` at the root of the package it is invoked in, or — with none — one bundle from that package's tsconfig.json with every setting at its default.
|
|
5
|
+
"description": "One bundle generated by `tic build` (@ts-ioc-container/bundler). `tic build` builds every `*.bundle.json` / `*.bundle.yaml` / `*.bundle.yml` at the root of the package it is invoked in, or — with none — one bundle from that package's tsconfig.json with every setting at its default. `extends` and `baseUrl` resolve against this file's directory; `include`, `exclude` and `output` resolve against `baseUrl`, defaulting to this file's directory.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"$schema": {
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
"type": "string",
|
|
15
15
|
"minLength": 1
|
|
16
16
|
},
|
|
17
|
+
"baseUrl": {
|
|
18
|
+
"description": "The base folder this config's relative `include`, `exclude` and `output` resolve against, so they need not repeat a shared prefix such as `src`. Relative to this file; default this file's directory. Also handed to TypeScript as `compilerOptions.baseUrl` (unless that is set too), so generated imports use it.",
|
|
19
|
+
"type": "string",
|
|
20
|
+
"minLength": 1
|
|
21
|
+
},
|
|
17
22
|
"output": {
|
|
18
23
|
"description": "The bundle file (convention: *.bundle.ts). Default `<root>/<name>.bundle.ts`: <root> is the compiled rootDir, else the common folder of the files compiled.",
|
|
19
24
|
"type": "string",
|
|
@@ -25,7 +30,7 @@
|
|
|
25
30
|
"pattern": "^[A-Za-z][\\w-]*$"
|
|
26
31
|
},
|
|
27
32
|
"include": {
|
|
28
|
-
"description": "tsconfig `include`: replaces the extended tsconfig's. Relative to this
|
|
33
|
+
"description": "tsconfig `include`: replaces the extended tsconfig's. Relative to `baseUrl`. When `baseUrl` is set and this is omitted, the whole `baseUrl` folder (`.`) is scanned.",
|
|
29
34
|
"type": "array",
|
|
30
35
|
"items": {
|
|
31
36
|
"type": "string",
|
|
@@ -33,7 +38,7 @@
|
|
|
33
38
|
}
|
|
34
39
|
},
|
|
35
40
|
"exclude": {
|
|
36
|
-
"description": "tsconfig `exclude`: replaces the extended tsconfig's. Relative to
|
|
41
|
+
"description": "tsconfig `exclude`: replaces the extended tsconfig's. Relative to `baseUrl`.",
|
|
37
42
|
"type": "array",
|
|
38
43
|
"items": {
|
|
39
44
|
"type": "string",
|
|
@@ -54,10 +59,16 @@
|
|
|
54
59
|
"default": "any",
|
|
55
60
|
"description": "Which exports count.",
|
|
56
61
|
"type": "string",
|
|
57
|
-
"enum": [
|
|
62
|
+
"enum": [
|
|
63
|
+
"any",
|
|
64
|
+
"named",
|
|
65
|
+
"default"
|
|
66
|
+
]
|
|
58
67
|
},
|
|
59
68
|
"decorators": {
|
|
60
|
-
"default": [
|
|
69
|
+
"default": [
|
|
70
|
+
"register"
|
|
71
|
+
],
|
|
61
72
|
"description": "The class must carry one of these decorators, recognised by name (e.g. \"register\", or a composed decorator). Default [\"register\"]; [] requires none.",
|
|
62
73
|
"type": "array",
|
|
63
74
|
"items": {
|
|
@@ -71,9 +71,16 @@ export interface BundleConfig {
|
|
|
71
71
|
* file. Default `./tsconfig.json`, which may be absent; a tsconfig named here must exist.
|
|
72
72
|
*/
|
|
73
73
|
extends?: string;
|
|
74
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* The base folder this config's relative `include`, `exclude` and `output` resolve against,
|
|
76
|
+
* so they need not repeat a shared prefix such as `src`. Relative to the config file; default
|
|
77
|
+
* the config file's directory. It is also handed to TypeScript as `compilerOptions.baseUrl`
|
|
78
|
+
* (unless that is set too), so the generated imports use it as well.
|
|
79
|
+
*/
|
|
80
|
+
baseUrl?: string;
|
|
81
|
+
/** tsconfig `include`: replaces the extended tsconfig's. Relative to `baseUrl`. */
|
|
75
82
|
include?: string[];
|
|
76
|
-
/** tsconfig `exclude`: replaces the extended tsconfig's. {@link DEFAULT_EXCLUDE} applies regardless. */
|
|
83
|
+
/** tsconfig `exclude`: replaces the extended tsconfig's. Relative to `baseUrl`. {@link DEFAULT_EXCLUDE} applies regardless. */
|
|
77
84
|
exclude?: string[];
|
|
78
85
|
compilerOptions?: BundleCompilerOptions;
|
|
79
86
|
}
|
|
@@ -120,6 +127,7 @@ export interface ResolvedConfig {
|
|
|
120
127
|
export declare const BUNDLE_CONFIG_SCHEMA: z.ZodObject<{
|
|
121
128
|
$schema: z.ZodOptional<z.ZodString>;
|
|
122
129
|
extends: z.ZodOptional<z.ZodString>;
|
|
130
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
123
131
|
output: z.ZodOptional<z.ZodString>;
|
|
124
132
|
name: z.ZodOptional<z.ZodString>;
|
|
125
133
|
include: z.ZodOptional<z.ZodCustom<string[], string[]>>;
|
|
@@ -151,7 +159,8 @@ export declare const configSuffix: (file: string) => string | undefined;
|
|
|
151
159
|
/** The generated class for a bundle name: `production` -> `ProductionBundle`, `my-app_v2` -> `MyAppV2Bundle`. */
|
|
152
160
|
export declare function toClassName(name: string): string;
|
|
153
161
|
/**
|
|
154
|
-
* Validates parsed `*.bundle.json` content and resolves its paths against `file`'s
|
|
162
|
+
* Validates parsed `*.bundle.json` content and resolves its paths against `file`'s
|
|
163
|
+
* directory, or its `baseUrl` for `include` / `exclude` / `output`.
|
|
155
164
|
*
|
|
156
165
|
* @throws {TicConfigError} when the content does not match the config shape; the message names the field.
|
|
157
166
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildConfig.d.ts","sourceRoot":"","sources":["../../../lib/features/build/BuildConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,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;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,8GAA8G;IAC9G,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,+GAA+G;IAC/G,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,kFAAkF;AAClF,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,oGAAoG;IACpG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gHAAgH;IAChH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"BuildConfig.d.ts","sourceRoot":"","sources":["../../../lib/features/build/BuildConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,iGAAiG;AACjG,MAAM,MAAM,UAAU,GAAG,KA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EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CA6B5E"}
|
|
@@ -6,19 +6,28 @@ interface Alias {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Import paths as a project's `tsconfig.json` sees them: writes imports in the
|
|
9
|
-
* form of its `paths` aliases where one matches.
|
|
9
|
+
* form of its `paths` aliases, else its `baseUrl`, where one matches.
|
|
10
10
|
*/
|
|
11
11
|
export declare class ImportPaths {
|
|
12
12
|
private readonly aliases;
|
|
13
13
|
readonly extension: string;
|
|
14
|
+
/** Absolute, `/`-separated: non-relative imports resolve against it. */
|
|
15
|
+
private readonly baseUrl?;
|
|
14
16
|
/**
|
|
15
|
-
* From a parsed tsconfig's options: its `paths` aliases
|
|
16
|
-
* under its `moduleResolution`; `importExtension` overrides the latter.
|
|
17
|
+
* From a parsed tsconfig's options: its `paths` aliases and `baseUrl`, and the extension
|
|
18
|
+
* imports need under its `moduleResolution`; `importExtension` overrides the latter.
|
|
17
19
|
*/
|
|
18
20
|
static fromOptions(options: ts.CompilerOptions, tsconfigFile: string, importExtension?: string): ImportPaths;
|
|
19
|
-
constructor(aliases: Alias[], extension: string
|
|
20
|
-
/**
|
|
21
|
+
constructor(aliases: Alias[], extension: string,
|
|
22
|
+
/** Absolute, `/`-separated: non-relative imports resolve against it. */
|
|
23
|
+
baseUrl?: string | undefined);
|
|
24
|
+
/**
|
|
25
|
+
* The specifier `fromFile` imports `toFile` by: its most specific `paths` alias, else a
|
|
26
|
+
* path relative to `baseUrl` when the file is under it, else a path relative to `fromFile`.
|
|
27
|
+
*/
|
|
21
28
|
specifier(fromFile: string, toFile: string): string;
|
|
29
|
+
/** `bare` written relative to `baseUrl`, when it is under it; `undefined` otherwise. */
|
|
30
|
+
private baseUrlSpecifier;
|
|
22
31
|
private bestAlias;
|
|
23
32
|
/** A longer matched target prefix is a more specific alias; an exact file alias beats every wildcard. */
|
|
24
33
|
private matchAlias;
|
|
@@ -1 +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;
|
|
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;IAuBpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAzB3B;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW;gBAkBzF,OAAO,EAAE,KAAK,EAAE,EACxB,SAAS,EAAE,MAAM;IAC1B,wEAAwE;IACvD,OAAO,CAAC,EAAE,MAAM,YAAA;IAGnC;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAanD,wFAAwF;IACxF,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,SAAS;IAWjB,yGAAyG;IACzG,OAAO,CAAC,UAAU;CAanB"}
|