@tayomi/deterministic-gates 0.7.0 → 0.8.1
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/catalog/angular.json +26 -7
- package/catalog/index.html +25 -11
- package/dist/src/core/watch.js +107 -66
- package/dist/src/helpers/angular-errors.js +183 -0
- package/package.json +1 -1
- package/src/core/watch.ts +107 -71
- package/src/helpers/angular-errors.ts +200 -0
- package/dist/src/helpers/template-errors.js +0 -85
- package/src/helpers/template-errors.ts +0 -101
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { statSync, watchFile } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { join, relative } from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
import type * as Ts from "typescript";
|
|
6
|
+
import { configOf, nothingChecked } from "./tsc.ts";
|
|
7
|
+
import { strictErrorLines } from "./type-errors.ts";
|
|
8
|
+
|
|
9
|
+
// The Angular compiler of the project, with strict templates and the options it is given forced on top of the
|
|
10
|
+
// project's own, printing the errors of its TypeScript and of its templates so that a gate can compare them with the
|
|
11
|
+
// ones of the turn start: one program gives both, where tsc reads no template, and a compiler of the templates alone
|
|
12
|
+
// would build the same program beside it. It goes through the compiler's API rather than ngc: ngc stops at the errors
|
|
13
|
+
// of the TypeScript, and a strict option a project turned off brings many, so it would report no error of a template.
|
|
14
|
+
// Each error prints on the line the strict TypeScript errors of tsc print on.
|
|
15
|
+
//
|
|
16
|
+
// With --watch, it stays, and checks again each time the date of its tsconfig changes, which is how the engine asks
|
|
17
|
+
// a watch for a cycle. It follows no other file: a check reads the files as they are when it starts, the ones whose
|
|
18
|
+
// date changed since the check before it, so it never misses a change, and it reuses the program of that check.
|
|
19
|
+
|
|
20
|
+
/** A diagnostic of the Angular compiler, as its API gives it. */
|
|
21
|
+
export interface Diagnostic {
|
|
22
|
+
file?: { fileName: string; text: string };
|
|
23
|
+
start?: number;
|
|
24
|
+
code: number;
|
|
25
|
+
messageText: string | { messageText: string };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A code as Angular prints it: its own codes are negative, -99 then their number, as -998001 for NG8001. */
|
|
29
|
+
function codeOf(code: number): string {
|
|
30
|
+
return code < 0 ? `NG${String(-code).slice(2)}` : `TS${code}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The errors of the project, each on one line, as the gate compares them. */
|
|
34
|
+
export function angularErrors(root: string, diagnostics: readonly Diagnostic[]): string[] {
|
|
35
|
+
return strictErrorLines(
|
|
36
|
+
diagnostics.map(({ file, start = 0, code, messageText }) => {
|
|
37
|
+
const message = typeof messageText === "string" ? messageText : messageText.messageText;
|
|
38
|
+
if (file === undefined) return message;
|
|
39
|
+
const line = file.text.slice(0, start).split("\n").length - 1;
|
|
40
|
+
return {
|
|
41
|
+
file: relative(root, file.fileName),
|
|
42
|
+
code: codeOf(code),
|
|
43
|
+
source: file.text.split("\n")[line] ?? "",
|
|
44
|
+
message: message.split("\n")[0] ?? "",
|
|
45
|
+
};
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The arguments that are options of the compiler: not the tsconfig, nor --watch, which are the helper's own. */
|
|
51
|
+
function compilerArgs(args: string[]): string[] {
|
|
52
|
+
const own = (arg: string | undefined) => arg === "-p" || arg === "--project";
|
|
53
|
+
return args.filter((arg, at) => arg !== "--watch" && !own(arg) && !own(args[at - 1]));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The options forced on top of the project's: strict templates, and each option of TypeScript the gate gives, as tsc
|
|
58
|
+
* reads them. One TypeScript does not know is refused, since a misspelt option would otherwise check nothing more and
|
|
59
|
+
* leave the gate green.
|
|
60
|
+
*/
|
|
61
|
+
function forced(ts: typeof Ts, args: string[]): { options: Ts.CompilerOptions } | { refused: string } {
|
|
62
|
+
const { options, errors, fileNames } = ts.parseCommandLine(compilerArgs(args));
|
|
63
|
+
const [error] = errors;
|
|
64
|
+
if (error !== undefined) return { refused: ts.flattenDiagnosticMessageText(error.messageText, "\n") };
|
|
65
|
+
const [stray] = fileNames;
|
|
66
|
+
if (stray !== undefined) return { refused: `${stray} is not an option of the compiler.` };
|
|
67
|
+
return { options: { strictTemplates: true, ...options } };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The Angular compiler of the repo, with the options of the gate. */
|
|
71
|
+
interface Compiler {
|
|
72
|
+
/** What it says of the project as it is now. Each call reuses what the one before it compiled. */
|
|
73
|
+
diagnostics(): Promise<readonly Diagnostic[]>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function changedAt(file: string): number {
|
|
77
|
+
return statSync(file, { throwIfNoEntry: false })?.mtimeMs ?? 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The Angular compiler of the repo, once it is known to check files with the API this helper calls: otherwise, why
|
|
82
|
+
* not. That API is not a public one of Angular, so a version that changed it refuses the gate, never passes it green.
|
|
83
|
+
*/
|
|
84
|
+
export async function compilerOf(root: string, args: string[]): Promise<{ compiler: Compiler } | { refused: string }> {
|
|
85
|
+
const nothing = nothingChecked(root, args);
|
|
86
|
+
if (nothing) return { refused: nothing };
|
|
87
|
+
const required = createRequire(join(root, "package.json"));
|
|
88
|
+
const given = forced(required("typescript") as typeof Ts, args);
|
|
89
|
+
if ("refused" in given) return given;
|
|
90
|
+
const ng = await import(pathToFileURL(required.resolve("@angular/compiler-cli")).href);
|
|
91
|
+
const { version } = required("@angular/compiler-cli/package.json") as { version: string };
|
|
92
|
+
const api = ng.NgtscProgram?.prototype;
|
|
93
|
+
const missing = (
|
|
94
|
+
[
|
|
95
|
+
["NgtscProgram", ng.NgtscProgram],
|
|
96
|
+
["NgtscProgram.loadNgStructureAsync", api?.loadNgStructureAsync],
|
|
97
|
+
["NgtscProgram.getTsSyntacticDiagnostics", api?.getTsSyntacticDiagnostics],
|
|
98
|
+
["NgtscProgram.getTsSemanticDiagnostics", api?.getTsSemanticDiagnostics],
|
|
99
|
+
["NgtscProgram.getNgSemanticDiagnostics", api?.getNgSemanticDiagnostics],
|
|
100
|
+
["readConfiguration", ng.readConfiguration],
|
|
101
|
+
["createCompilerHost", ng.createCompilerHost],
|
|
102
|
+
] as const
|
|
103
|
+
).find(([, found]) => typeof found !== "function")?.[0];
|
|
104
|
+
if (missing !== undefined)
|
|
105
|
+
return {
|
|
106
|
+
refused: `The API of @angular/compiler-cli ${version} is not the one this gate knows: it has no ${missing}. Update deterministic-gates.`,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// What the check before this one read, by the date it had: a file whose date is the same is given as it was, which
|
|
110
|
+
// is how the compiler knows it need not check it again.
|
|
111
|
+
const sources = new Map<string, { at: number; source: unknown }>();
|
|
112
|
+
const resources = new Map<string, number>();
|
|
113
|
+
let last: { program: unknown; options: string } | undefined;
|
|
114
|
+
return {
|
|
115
|
+
compiler: {
|
|
116
|
+
async diagnostics() {
|
|
117
|
+
const config = ng.readConfiguration(configOf(root, args));
|
|
118
|
+
const options = { ...config.options, ...given.options };
|
|
119
|
+
// A program checked with other options is no help to this one.
|
|
120
|
+
if (last?.options !== JSON.stringify(options)) {
|
|
121
|
+
last = undefined;
|
|
122
|
+
sources.clear();
|
|
123
|
+
resources.clear();
|
|
124
|
+
}
|
|
125
|
+
const base = ng.createCompilerHost({ options });
|
|
126
|
+
const host = {
|
|
127
|
+
...base,
|
|
128
|
+
getSourceFile(file: string, ...rest: unknown[]) {
|
|
129
|
+
const at = changedAt(file);
|
|
130
|
+
const kept = sources.get(file);
|
|
131
|
+
if (kept?.at === at) return kept.source;
|
|
132
|
+
const source: unknown = base.getSourceFile(file, ...rest);
|
|
133
|
+
if (source === undefined) sources.delete(file);
|
|
134
|
+
else sources.set(file, { at, source });
|
|
135
|
+
return source;
|
|
136
|
+
},
|
|
137
|
+
// A template or a style, which the compiler reads as text.
|
|
138
|
+
readFile(file: string) {
|
|
139
|
+
if (!/\.(ts|json)$/.test(file) && !resources.has(file)) resources.set(file, changedAt(file));
|
|
140
|
+
return base.readFile(file);
|
|
141
|
+
},
|
|
142
|
+
getModifiedResourceFiles() {
|
|
143
|
+
const modified = new Set<string>();
|
|
144
|
+
for (const [file, at] of resources) {
|
|
145
|
+
const now = changedAt(file);
|
|
146
|
+
if (now === at) continue;
|
|
147
|
+
modified.add(file);
|
|
148
|
+
resources.set(file, now);
|
|
149
|
+
}
|
|
150
|
+
return modified;
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
const program = new ng.NgtscProgram(config.rootNames, options, host, last?.program);
|
|
154
|
+
await program.loadNgStructureAsync();
|
|
155
|
+
last = { program, options: JSON.stringify(options) };
|
|
156
|
+
return [
|
|
157
|
+
...config.errors,
|
|
158
|
+
...program.getTsSyntacticDiagnostics(),
|
|
159
|
+
...program.getTsSemanticDiagnostics(),
|
|
160
|
+
...program.getNgSemanticDiagnostics(),
|
|
161
|
+
];
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** Checks now, then each time the date of the tsconfig changes, saying when a check starts and when it is done. */
|
|
168
|
+
async function watch(root: string, args: string[], compiler: Compiler): Promise<void> {
|
|
169
|
+
let asked = false;
|
|
170
|
+
let checking = false;
|
|
171
|
+
const check = async () => {
|
|
172
|
+
asked = true;
|
|
173
|
+
if (checking) return;
|
|
174
|
+
checking = true;
|
|
175
|
+
// Asked again while it checked: the files may have changed since it read them.
|
|
176
|
+
while (asked) {
|
|
177
|
+
asked = false;
|
|
178
|
+
console.log("Type check started");
|
|
179
|
+
console.log([...angularErrors(root, await compiler.diagnostics()), "Type check done"].join("\n"));
|
|
180
|
+
}
|
|
181
|
+
checking = false;
|
|
182
|
+
};
|
|
183
|
+
// Looked at rather than watched: a date read ten times a second misses no change, whatever the file system says.
|
|
184
|
+
watchFile(configOf(root, args), { interval: 100 }, (now, before) => {
|
|
185
|
+
if (now.mtimeMs !== before.mtimeMs) void check();
|
|
186
|
+
});
|
|
187
|
+
await check();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async function main(root: string, args: string[]): Promise<void> {
|
|
191
|
+
const found = await compilerOf(root, args);
|
|
192
|
+
if ("refused" in found) {
|
|
193
|
+
console.log(found.refused);
|
|
194
|
+
process.exit(1);
|
|
195
|
+
}
|
|
196
|
+
if (args.includes("--watch")) await watch(root, args, found.compiler);
|
|
197
|
+
else console.log(angularErrors(root, await found.compiler.diagnostics()).join("\n"));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (import.meta.main) await main(process.cwd(), process.argv.slice(2));
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
-
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
-
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
-
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
return path;
|
|
8
|
-
};
|
|
9
|
-
import { createRequire } from "node:module";
|
|
10
|
-
import { join, relative } from "node:path";
|
|
11
|
-
import { pathToFileURL } from "node:url";
|
|
12
|
-
import { configOf, nothingChecked } from "./tsc.js";
|
|
13
|
-
import { strictErrorLines } from "./type-errors.js";
|
|
14
|
-
/** A code as Angular prints it: its own codes are negative, -99 then their number, as -998001 for NG8001. */
|
|
15
|
-
function codeOf(code) {
|
|
16
|
-
return code < 0 ? `NG${String(-code).slice(2)}` : `TS${code}`;
|
|
17
|
-
}
|
|
18
|
-
/** The errors of the templates, each on one line, as the gate compares them. */
|
|
19
|
-
export function templateErrors(root, diagnostics) {
|
|
20
|
-
return strictErrorLines(diagnostics.map(({ file, start = 0, code, messageText }) => {
|
|
21
|
-
const message = typeof messageText === "string" ? messageText : messageText.messageText;
|
|
22
|
-
if (file === undefined)
|
|
23
|
-
return message;
|
|
24
|
-
const line = file.text.slice(0, start).split("\n").length - 1;
|
|
25
|
-
return {
|
|
26
|
-
file: relative(root, file.fileName),
|
|
27
|
-
code: codeOf(code),
|
|
28
|
-
source: file.text.split("\n")[line] ?? "",
|
|
29
|
-
message: message.split("\n")[0] ?? "",
|
|
30
|
-
};
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
/** The options forced on top of the project's: strict templates, and each --option the gate gives. */
|
|
34
|
-
function forced(args) {
|
|
35
|
-
const options = { strictTemplates: true };
|
|
36
|
-
for (const arg of args)
|
|
37
|
-
if (arg.startsWith("--") && arg !== "--project")
|
|
38
|
-
options[arg.slice(2)] = true;
|
|
39
|
-
return options;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* The Angular compiler of the repo, once it is known to check files with the API this helper calls: otherwise, why
|
|
43
|
-
* not. That API is not a public one of Angular, so a version that changed it refuses the gate, never passes it green.
|
|
44
|
-
*/
|
|
45
|
-
export async function compilerOf(root, args) {
|
|
46
|
-
const nothing = nothingChecked(root, args);
|
|
47
|
-
if (nothing)
|
|
48
|
-
return { refused: nothing };
|
|
49
|
-
const required = createRequire(join(root, "package.json"));
|
|
50
|
-
const ng = await import(__rewriteRelativeImportExtension(pathToFileURL(required.resolve("@angular/compiler-cli")).href));
|
|
51
|
-
const { version } = required("@angular/compiler-cli/package.json");
|
|
52
|
-
const program = ng.NgtscProgram?.prototype;
|
|
53
|
-
const missing = [
|
|
54
|
-
["NgtscProgram", ng.NgtscProgram],
|
|
55
|
-
["NgtscProgram.loadNgStructureAsync", program?.loadNgStructureAsync],
|
|
56
|
-
["NgtscProgram.getNgSemanticDiagnostics", program?.getNgSemanticDiagnostics],
|
|
57
|
-
["readConfiguration", ng.readConfiguration],
|
|
58
|
-
["createCompilerHost", ng.createCompilerHost],
|
|
59
|
-
].find(([, found]) => typeof found !== "function")?.[0];
|
|
60
|
-
if (missing !== undefined)
|
|
61
|
-
return {
|
|
62
|
-
refused: `The API of @angular/compiler-cli ${version} is not the one this gate knows: it has no ${missing}. Update deterministic-gates.`,
|
|
63
|
-
};
|
|
64
|
-
return {
|
|
65
|
-
compiler: {
|
|
66
|
-
async diagnostics() {
|
|
67
|
-
const config = ng.readConfiguration(configOf(root, args));
|
|
68
|
-
const options = { ...config.options, ...forced(args) };
|
|
69
|
-
const program = new ng.NgtscProgram(config.rootNames, options, ng.createCompilerHost({ options }));
|
|
70
|
-
await program.loadNgStructureAsync();
|
|
71
|
-
return program.getNgSemanticDiagnostics();
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
async function main(root, args) {
|
|
77
|
-
const found = await compilerOf(root, args);
|
|
78
|
-
if ("refused" in found) {
|
|
79
|
-
console.log(found.refused);
|
|
80
|
-
process.exit(1);
|
|
81
|
-
}
|
|
82
|
-
console.log(templateErrors(root, await found.compiler.diagnostics()).join("\n"));
|
|
83
|
-
}
|
|
84
|
-
if (import.meta.main)
|
|
85
|
-
await main(process.cwd(), process.argv.slice(2));
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
import { join, relative } from "node:path";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
4
|
-
import { configOf, nothingChecked } from "./tsc.ts";
|
|
5
|
-
import { strictErrorLines } from "./type-errors.ts";
|
|
6
|
-
|
|
7
|
-
// The Angular compiler of the project, with strict templates and the options it is given forced on top of the
|
|
8
|
-
// project's own, printing the errors of its templates so that a gate can compare them with the ones of the turn start.
|
|
9
|
-
// It goes through the compiler's API rather than ngc: ngc stops at the errors of the TypeScript, and a strict option
|
|
10
|
-
// a project turned off brings many, so it would report no error of a template. Each error prints on the line the
|
|
11
|
-
// strict TypeScript errors print on. The errors of the TypeScript are left to them.
|
|
12
|
-
|
|
13
|
-
/** A diagnostic of the Angular compiler, as its API gives it. */
|
|
14
|
-
export interface Diagnostic {
|
|
15
|
-
file?: { fileName: string; text: string };
|
|
16
|
-
start?: number;
|
|
17
|
-
code: number;
|
|
18
|
-
messageText: string | { messageText: string };
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** A code as Angular prints it: its own codes are negative, -99 then their number, as -998001 for NG8001. */
|
|
22
|
-
function codeOf(code: number): string {
|
|
23
|
-
return code < 0 ? `NG${String(-code).slice(2)}` : `TS${code}`;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** The errors of the templates, each on one line, as the gate compares them. */
|
|
27
|
-
export function templateErrors(root: string, diagnostics: readonly Diagnostic[]): string[] {
|
|
28
|
-
return strictErrorLines(
|
|
29
|
-
diagnostics.map(({ file, start = 0, code, messageText }) => {
|
|
30
|
-
const message = typeof messageText === "string" ? messageText : messageText.messageText;
|
|
31
|
-
if (file === undefined) return message;
|
|
32
|
-
const line = file.text.slice(0, start).split("\n").length - 1;
|
|
33
|
-
return {
|
|
34
|
-
file: relative(root, file.fileName),
|
|
35
|
-
code: codeOf(code),
|
|
36
|
-
source: file.text.split("\n")[line] ?? "",
|
|
37
|
-
message: message.split("\n")[0] ?? "",
|
|
38
|
-
};
|
|
39
|
-
}),
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** The options forced on top of the project's: strict templates, and each --option the gate gives. */
|
|
44
|
-
function forced(args: string[]): Record<string, boolean> {
|
|
45
|
-
const options: Record<string, boolean> = { strictTemplates: true };
|
|
46
|
-
for (const arg of args) if (arg.startsWith("--") && arg !== "--project") options[arg.slice(2)] = true;
|
|
47
|
-
return options;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** The Angular compiler of the repo, with the options of the gate: what it says of the templates. */
|
|
51
|
-
interface Compiler {
|
|
52
|
-
diagnostics(): Promise<readonly Diagnostic[]>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* The Angular compiler of the repo, once it is known to check files with the API this helper calls: otherwise, why
|
|
57
|
-
* not. That API is not a public one of Angular, so a version that changed it refuses the gate, never passes it green.
|
|
58
|
-
*/
|
|
59
|
-
export async function compilerOf(root: string, args: string[]): Promise<{ compiler: Compiler } | { refused: string }> {
|
|
60
|
-
const nothing = nothingChecked(root, args);
|
|
61
|
-
if (nothing) return { refused: nothing };
|
|
62
|
-
const required = createRequire(join(root, "package.json"));
|
|
63
|
-
const ng = await import(pathToFileURL(required.resolve("@angular/compiler-cli")).href);
|
|
64
|
-
const { version } = required("@angular/compiler-cli/package.json") as { version: string };
|
|
65
|
-
const program = ng.NgtscProgram?.prototype;
|
|
66
|
-
const missing = (
|
|
67
|
-
[
|
|
68
|
-
["NgtscProgram", ng.NgtscProgram],
|
|
69
|
-
["NgtscProgram.loadNgStructureAsync", program?.loadNgStructureAsync],
|
|
70
|
-
["NgtscProgram.getNgSemanticDiagnostics", program?.getNgSemanticDiagnostics],
|
|
71
|
-
["readConfiguration", ng.readConfiguration],
|
|
72
|
-
["createCompilerHost", ng.createCompilerHost],
|
|
73
|
-
] as const
|
|
74
|
-
).find(([, found]) => typeof found !== "function")?.[0];
|
|
75
|
-
if (missing !== undefined)
|
|
76
|
-
return {
|
|
77
|
-
refused: `The API of @angular/compiler-cli ${version} is not the one this gate knows: it has no ${missing}. Update deterministic-gates.`,
|
|
78
|
-
};
|
|
79
|
-
return {
|
|
80
|
-
compiler: {
|
|
81
|
-
async diagnostics() {
|
|
82
|
-
const config = ng.readConfiguration(configOf(root, args));
|
|
83
|
-
const options = { ...config.options, ...forced(args) };
|
|
84
|
-
const program = new ng.NgtscProgram(config.rootNames, options, ng.createCompilerHost({ options }));
|
|
85
|
-
await program.loadNgStructureAsync();
|
|
86
|
-
return program.getNgSemanticDiagnostics();
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async function main(root: string, args: string[]): Promise<void> {
|
|
93
|
-
const found = await compilerOf(root, args);
|
|
94
|
-
if ("refused" in found) {
|
|
95
|
-
console.log(found.refused);
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
98
|
-
console.log(templateErrors(root, await found.compiler.diagnostics()).join("\n"));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (import.meta.main) await main(process.cwd(), process.argv.slice(2));
|