@plugjs/tsgo 0.0.5 → 0.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/dist/diagnostics.d.ts +2 -4
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +8 -35
- package/dist/diagnostics.js.map +1 -1
- package/dist/index.d.ts +55 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/typescript.d.ts +9 -6
- package/dist/typescript.d.ts.map +1 -1
- package/dist/typescript.js +113 -106
- package/dist/typescript.js.map +1 -1
- package/dist/utils.d.ts +17 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +58 -0
- package/dist/utils.js.map +1 -0
- package/package.json +6 -6
- package/src/diagnostics.ts +21 -60
- package/src/index.ts +65 -7
- package/src/typescript.ts +121 -112
- package/src/utils.ts +64 -0
- package/dist/projects.d.ts +0 -72
- package/dist/projects.d.ts.map +0 -1
- package/dist/projects.js +0 -209
- package/dist/projects.js.map +0 -1
- package/src/projects.ts +0 -271
package/dist/diagnostics.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { ReportRecord } from '@plugjs/plug/logging';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare function convertDiagnostics(diagnostics: readonly Diagnostic[], program: Program, deprecations?: 'warn' | 'notice' | 'off'): Promise<ReportRecord[]>;
|
|
5
|
-
export declare function convertProjectDiagnostics(diagnostics: readonly Diagnostic[], program: Program, fileName: AbsolutePath): Promise<ReportRecord[]>;
|
|
2
|
+
import type { Diagnostic } from 'typescript/unstable/async';
|
|
3
|
+
export declare function convertDiagnostics(diagnostics: readonly Diagnostic[], deprecations?: 'warn' | 'notice' | 'off'): ReportRecord[];
|
|
6
4
|
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAqC3D,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,YAAY,GAAE,MAAM,GAAG,QAAQ,GAAG,KAAgB,GACjD,YAAY,EAAE,CAsChB"}
|
package/dist/diagnostics.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ERROR, NOTICE, WARN } from '@plugjs/plug/logging';
|
|
2
2
|
import { assertAbsolutePath } from '@plugjs/plug/paths';
|
|
3
3
|
import { DiagnosticCategory } from 'typescript/unstable/async';
|
|
4
|
-
function convertDiagnostic(diagnostic
|
|
4
|
+
function convertDiagnostic(diagnostic) {
|
|
5
5
|
const record = {
|
|
6
6
|
level: NOTICE,
|
|
7
7
|
message: diagnostic.text,
|
|
@@ -23,16 +23,16 @@ function convertDiagnostic(diagnostic, sourceFile) {
|
|
|
23
23
|
assertAbsolutePath(diagnostic.fileName);
|
|
24
24
|
record.file = diagnostic.fileName;
|
|
25
25
|
}
|
|
26
|
-
if (
|
|
27
|
-
const pos =
|
|
26
|
+
if (diagnostic.startPosition) {
|
|
27
|
+
const pos = diagnostic.startPosition;
|
|
28
28
|
record.line = pos.line + 1;
|
|
29
29
|
record.column = pos.character + 1;
|
|
30
30
|
record.length = diagnostic.end - diagnostic.pos;
|
|
31
|
-
record.source =
|
|
31
|
+
record.source = diagnostic.source;
|
|
32
32
|
}
|
|
33
33
|
return record;
|
|
34
34
|
}
|
|
35
|
-
export
|
|
35
|
+
export function convertDiagnostics(diagnostics, deprecations = 'notice') {
|
|
36
36
|
// Filter out any duplicate diagnostic *before* we convert them to report
|
|
37
37
|
// records (that might be expensive because of source file lookups)
|
|
38
38
|
const seen = new Set();
|
|
@@ -51,7 +51,7 @@ export async function convertDiagnostics(diagnostics, program, deprecations = 'n
|
|
|
51
51
|
return true;
|
|
52
52
|
});
|
|
53
53
|
// Convert all diagnostics to report records
|
|
54
|
-
const converted =
|
|
54
|
+
const converted = unique.map((diagnostic) => {
|
|
55
55
|
// Anything not an error is not critical
|
|
56
56
|
const isNonCritical = diagnostic.category !== DiagnosticCategory.Error;
|
|
57
57
|
// First of all see how we need to handle non-error deprecations: when
|
|
@@ -63,37 +63,10 @@ export async function convertDiagnostics(diagnostics, program, deprecations = 'n
|
|
|
63
63
|
diagnostic = { ...diagnostic, category: DiagnosticCategory.Warning };
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
// First figure out where this diagnostic came from...
|
|
67
|
-
const sourceFileMetadata = diagnostic.fileName
|
|
68
|
-
? await program.getSourceFileMetadata(diagnostic.fileName)
|
|
69
|
-
: /* coverage ignore next */ undefined;
|
|
70
|
-
// If the source file is in the default library (e.g. "lib.dom.ts") or
|
|
71
|
-
// from an external library (in "node_modules") then we ONLY keep errors
|
|
72
|
-
// and (we ignore things like warnings, suggestions, ...)
|
|
73
|
-
const isExternal = sourceFileMetadata?.isDefaultLibrary || sourceFileMetadata?.isFromExternalLibrary;
|
|
74
|
-
if (isExternal && isNonCritical)
|
|
75
|
-
return;
|
|
76
|
-
// Get the source file and its metadata (if any) for the diagnostic...
|
|
77
|
-
// We do this *after* the external check above as getting the source file
|
|
78
|
-
// is quite expensive (especially for things like "lib.es5.dts")...
|
|
79
|
-
const sourceFile = diagnostic.fileName
|
|
80
|
-
? ((await program.getSourceFile(diagnostic.fileName)) ??
|
|
81
|
-
(await program.getConfigSourceFile(diagnostic.fileName)))
|
|
82
|
-
: /* coverage ignore next */ undefined;
|
|
83
66
|
// Convert our diagnostic to a report record and return it
|
|
84
|
-
return convertDiagnostic(diagnostic
|
|
85
|
-
})
|
|
67
|
+
return convertDiagnostic(diagnostic);
|
|
68
|
+
});
|
|
86
69
|
// Filter out any null/undefined records
|
|
87
70
|
return converted.filter((record) => !!record);
|
|
88
71
|
}
|
|
89
|
-
export async function convertProjectDiagnostics(diagnostics, program, fileName) {
|
|
90
|
-
// Make sure that we have a file name for the diagnostics
|
|
91
|
-
const fileDiagnostics = diagnostics.map((diagnostic) => {
|
|
92
|
-
if (diagnostic.fileName)
|
|
93
|
-
return diagnostic;
|
|
94
|
-
return { ...diagnostic, fileName };
|
|
95
|
-
});
|
|
96
|
-
// Convert the diagnostics to report records and return them
|
|
97
|
-
return convertDiagnostics(fileDiagnostics, program);
|
|
98
|
-
}
|
|
99
72
|
//# sourceMappingURL=diagnostics.js.map
|
package/dist/diagnostics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.js","
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAK9D,SAAS,iBAAiB,CAAC,UAAsB;IAC/C,MAAM,MAAM,GAAsC;QAChD,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,UAAU,CAAC,IAAI;QACxB,IAAI,EAAE,CAAC,KAAK,UAAU,CAAC,IAAI,EAAE,CAAC;KAC/B,CAAA;IAED,QAAQ,UAAU,CAAC,QAAQ,EAAE,CAAC;QAC5B,KAAK,kBAAkB,CAAC,KAAK;YAC3B,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;YACpB,MAAK;QACP,KAAK,kBAAkB,CAAC,OAAO;YAC7B,MAAM,CAAC,KAAK,GAAG,IAAI,CAAA;YACnB,MAAK;IACT,CAAC;IAED,IAAI,UAAU,CAAC,iBAAiB;QAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IAChE,IAAI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CAAA;IAEF,4CAA4C;IAC5C,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;QAC1C,wCAAwC;QACxC,MAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,KAAK,kBAAkB,CAAC,KAAK,CAAA;QAEtE,sEAAsE;QACtE,qEAAqE;QACrE,IAAI,UAAU,CAAC,iBAAiB,IAAI,aAAa,EAAE,CAAC;YAClD,IAAI,YAAY,KAAK,KAAK;gBAAE,OAAM,CAAC,4BAA4B;YAC/D,IAAI,YAAY,KAAK,MAAM,EAAE,CAAC;gBAC5B,UAAU,GAAG,EAAE,GAAG,UAAU,EAAE,QAAQ,EAAE,kBAAkB,CAAC,OAAO,EAAE,CAAA;YACtE,CAAC;QACH,CAAC;QAED,0DAA0D;QAC1D,OAAO,iBAAiB,CAAC,UAAU,CAAC,CAAA;IACtC,CAAC,CAAC,CAAA;IAEF,wCAAwC;IACxC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,EAA0B,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AACvE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
import type { OverrideCompilerOptions } from 'typescript/unstable/async';
|
|
2
|
+
/** Options for the `typescriptBuild` plug. */
|
|
3
|
+
export interface TypeScriptBuildOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Force building all projects in the build. Defaults to `true`.
|
|
6
|
+
*
|
|
7
|
+
* This is equivalent to running `tsc --build --force`.
|
|
8
|
+
*/
|
|
9
|
+
force?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Skip building downstream projects on error in upstream project. Defaults
|
|
12
|
+
* to `false`.
|
|
13
|
+
*
|
|
14
|
+
* This is equivalent to running `tsc --build --stopBuildOnErrors`.
|
|
15
|
+
*/
|
|
16
|
+
stopBuildOnErrors?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Enable verbose logging during the build. Defaults to `true`.
|
|
19
|
+
*
|
|
20
|
+
* This is equivalent to running `tsc --build --verbose`.
|
|
21
|
+
*/
|
|
22
|
+
verbose?: boolean;
|
|
23
|
+
/** Override the default TypeScript compiler options for the build. */
|
|
24
|
+
overrideCompilerOptions?: OverrideCompilerOptions;
|
|
25
|
+
}
|
|
26
|
+
/** Options for the `typescript` plug. */
|
|
2
27
|
export interface TypeScriptOptions {
|
|
3
|
-
/** Whether referenced projects are built too. Defaults to `false`. */
|
|
4
|
-
projectReferences?: boolean;
|
|
5
28
|
/**
|
|
6
29
|
* Controls how deprecation diagnostics are reported. Use `'notice'` or
|
|
7
30
|
* `true` for notices, `'warn'` for warnings, and `'off'` or `false` to
|
|
@@ -16,8 +39,13 @@ export interface TypeScriptOptions {
|
|
|
16
39
|
*/
|
|
17
40
|
emitOnly?: 'js' | 'dts' | 'all' | 'none' | boolean;
|
|
18
41
|
}
|
|
19
|
-
/** Options for the {@link tsc}
|
|
20
|
-
export interface TscOptions extends
|
|
42
|
+
/** Options for the {@link tsc} helper. */
|
|
43
|
+
export interface TscOptions extends TypeScriptOptions {
|
|
44
|
+
/** Base directory used to resolve the configuration path. */
|
|
45
|
+
directory?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Options for the {@link tscBuild} helper. */
|
|
48
|
+
export interface TscBuildOptions extends TypeScriptBuildOptions {
|
|
21
49
|
/** Base directory used to resolve the configuration path. */
|
|
22
50
|
directory?: string;
|
|
23
51
|
}
|
|
@@ -27,6 +55,8 @@ declare module '@plugjs/plug' {
|
|
|
27
55
|
* Run the {@link https://www.typescriptlang.org/ TypeScript Compiler}
|
|
28
56
|
* version 7 (native) over the `tsconfig.json` configuration files
|
|
29
57
|
* given as input to this {@link Pipe} instance.
|
|
58
|
+
*
|
|
59
|
+
* This is equivalent to running `tsc --project`.
|
|
30
60
|
*/
|
|
31
61
|
typescript(): Pipe;
|
|
32
62
|
/**
|
|
@@ -34,9 +64,29 @@ declare module '@plugjs/plug' {
|
|
|
34
64
|
* version 7 (native) over the `tsconfig.json` configuration files
|
|
35
65
|
* given as input to this {@link Pipe} instance.
|
|
36
66
|
*
|
|
67
|
+
* This is equivalent to running `tsc --project`.
|
|
68
|
+
*
|
|
37
69
|
* @param options {@link TypeScriptOptions} to use for the build.
|
|
38
70
|
*/
|
|
39
71
|
typescript(options: TypeScriptOptions): Pipe;
|
|
72
|
+
/**
|
|
73
|
+
* Run the {@link https://www.typescriptlang.org/ TypeScript Builder}
|
|
74
|
+
* version 7 (native) over the `tsconfig.json` configuration files
|
|
75
|
+
* given as input to this {@link Pipe} instance.
|
|
76
|
+
*
|
|
77
|
+
* This is equivalent to running `tsc --build`.
|
|
78
|
+
*/
|
|
79
|
+
typescriptBuild(): Promise<undefined>;
|
|
80
|
+
/**
|
|
81
|
+
* Run the {@link https://www.typescriptlang.org/ TypeScript Builder}
|
|
82
|
+
* version 7 (native) over the `tsconfig.json` configuration files
|
|
83
|
+
* given as input to this {@link Pipe} instance.
|
|
84
|
+
*
|
|
85
|
+
* This is equivalent to running `tsc --build`.
|
|
86
|
+
*
|
|
87
|
+
* @param options {@link TypeScriptBuildOptions} to use for the build.
|
|
88
|
+
*/
|
|
89
|
+
typescriptBuild(options: TypeScriptBuildOptions): Promise<undefined>;
|
|
40
90
|
}
|
|
41
91
|
}
|
|
42
92
|
export { tsbuild, tsc } from './typescript.ts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAExE,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAE3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,sEAAsE;IACtE,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;CAClD;AAED,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAA;IAExD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAA;CACnD;AAED,0CAA0C;AAC1C,MAAM,WAAW,UAAW,SAAQ,iBAAiB;IACnD,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAgB,SAAQ,sBAAsB;IAC7D,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAiB,IAAI;QACnB;;;;;;WAMG;QACH,UAAU,IAAI,IAAI,CAAA;QAElB;;;;;;;;WAQG;QACH,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAA;QAE5C;;;;;;WAMG;QACH,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAAA;QAErC;;;;;;;;WAQG;QACH,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;KACrE;CACF;AAKD,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { install } from '@plugjs/plug/pipe';
|
|
2
|
-
import { TypeScript } from './typescript.js';
|
|
2
|
+
import { TypeScript, TypeScriptBuild } from './typescript.js';
|
|
3
3
|
install('typescript', TypeScript);
|
|
4
|
+
install('typescriptBuild', TypeScriptBuild);
|
|
4
5
|
export { tsbuild, tsc } from './typescript.js';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AA0G7D,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;AACjC,OAAO,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAA;AAE3C,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/typescript.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { Files } from '@plugjs/plug/files';
|
|
2
|
-
import type { TscOptions, TypeScriptOptions } from './index.ts';
|
|
2
|
+
import type { TscBuildOptions, TscOptions, TypeScriptBuildOptions, TypeScriptOptions } from './index.ts';
|
|
3
3
|
import type { Pipe } from '@plugjs/plug';
|
|
4
4
|
import type { Context, Plug } from '@plugjs/plug/pipe';
|
|
5
5
|
export declare class TypeScript implements Plug<Files> {
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
private _projectReferences;
|
|
9
|
-
constructor(options?: TypeScriptOptions);
|
|
6
|
+
private readonly _options;
|
|
7
|
+
constructor(_options?: TypeScriptOptions);
|
|
10
8
|
pipe(files: Files, context: Context): Promise<Files>;
|
|
11
9
|
}
|
|
10
|
+
export declare class TypeScriptBuild implements Plug<void> {
|
|
11
|
+
private readonly _options;
|
|
12
|
+
constructor(_options?: TypeScriptBuildOptions);
|
|
13
|
+
pipe(files: Files, context: Context): Promise<void>;
|
|
14
|
+
}
|
|
12
15
|
/**
|
|
13
16
|
* Compile the project identified by the specified configuration file
|
|
14
17
|
* (either a `tsconfig.json` or a directory containing one).
|
|
@@ -23,5 +26,5 @@ export declare function tsc(config: string, options?: TscOptions): Pipe;
|
|
|
23
26
|
*
|
|
24
27
|
* This is roughly equivalent to the command line `tsc --build <config>`.
|
|
25
28
|
*/
|
|
26
|
-
export declare function tsbuild(config: string, options
|
|
29
|
+
export declare function tsbuild(config: string, options: TscBuildOptions): Promise<undefined>;
|
|
27
30
|
//# sourceMappingURL=typescript.d.ts.map
|
package/dist/typescript.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sources":["../src/typescript.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAQ1C,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACxG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAQtD,qBAAa,UAAW,YAAW,IAAI,CAAC,KAAK,CAAC;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAArC,YAA6B,QAAQ,GAAE,iBAAsB,EAAI;IAE3D,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAmHzD;CACF;AAED,qBAAa,eAAgB,YAAW,IAAI,CAAC,IAAI,CAAC;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAArC,YAA6B,QAAQ,GAAE,sBAA2B,EAAI;IAEhE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCxD;CACF;AAMD;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,IAAI,CAGlE;AAID;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CAGpF"}
|
package/dist/typescript.js
CHANGED
|
@@ -1,145 +1,111 @@
|
|
|
1
1
|
import { using } from '@plugjs/plug';
|
|
2
|
-
import { assert } from '@plugjs/plug/asserts';
|
|
3
2
|
import { Files } from '@plugjs/plug/files';
|
|
4
3
|
import { ERROR } from '@plugjs/plug/logging';
|
|
5
|
-
import {
|
|
6
|
-
import { API,
|
|
4
|
+
import { assertAbsolutePath, commonPath, isAbsolutePath } from '@plugjs/plug/paths';
|
|
5
|
+
import { API, DiagnosticCategory } from 'typescript/unstable/async';
|
|
7
6
|
import { convertDiagnostics } from './diagnostics.js';
|
|
8
|
-
import {
|
|
7
|
+
import { diagnosticDeprecationLevel, emitOnlyOption, findProjectConfig } from './utils.js';
|
|
9
8
|
/* ========================================================================== *
|
|
10
9
|
* TYPESCRIPT 7 PLUG IMPLEMENTATION *
|
|
11
10
|
* ========================================================================== */
|
|
12
11
|
export class TypeScript {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
constructor(options = {}) {
|
|
17
|
-
const { projectReferences, reportDeprecations, emitOnly } = options;
|
|
18
|
-
this._projectReferences = !!projectReferences;
|
|
19
|
-
switch (emitOnly) {
|
|
20
|
-
// If *none* or *false* we don't emit any files at all
|
|
21
|
-
case 'none':
|
|
22
|
-
case false:
|
|
23
|
-
this._emitOnly = null;
|
|
24
|
-
break;
|
|
25
|
-
// If *js* we only emit JavaScript files
|
|
26
|
-
case 'js':
|
|
27
|
-
this._emitOnly = EmitOnly.OnlyJs;
|
|
28
|
-
break;
|
|
29
|
-
// If *dts* we only emit declaration files
|
|
30
|
-
case 'dts':
|
|
31
|
-
this._emitOnly = EmitOnly.OnlyDts;
|
|
32
|
-
break;
|
|
33
|
-
// If *all* or *true* (default) we emit all files
|
|
34
|
-
case 'all':
|
|
35
|
-
case true:
|
|
36
|
-
default:
|
|
37
|
-
this._emitOnly = EmitOnly.All;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
switch (reportDeprecations) {
|
|
41
|
-
// If *warn* we report deprecations as warnings
|
|
42
|
-
case 'warn':
|
|
43
|
-
this._reportDeprecations = 'warn';
|
|
44
|
-
break;
|
|
45
|
-
// If *off* or *false* we don't report deprecations at all
|
|
46
|
-
case 'off':
|
|
47
|
-
case false:
|
|
48
|
-
this._reportDeprecations = 'off';
|
|
49
|
-
break;
|
|
50
|
-
// If *notice* or *true* (default) we report deprecations as notices
|
|
51
|
-
case 'notice':
|
|
52
|
-
case true:
|
|
53
|
-
default:
|
|
54
|
-
this._reportDeprecations = 'notice';
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
12
|
+
_options;
|
|
13
|
+
constructor(_options = {}) {
|
|
14
|
+
this._options = _options;
|
|
57
15
|
}
|
|
58
16
|
async pipe(files, context) {
|
|
17
|
+
// Convert our options
|
|
18
|
+
const deprecationsLevel = diagnosticDeprecationLevel(this._options.reportDeprecations);
|
|
19
|
+
const emitOnly = emitOnlyOption(this._options.emitOnly);
|
|
59
20
|
// Create our TypeScript API and report for this plug
|
|
60
|
-
const api = new API({ cwd: files.directory });
|
|
61
21
|
const report = context.log.report('TypeScript Report');
|
|
62
22
|
// This is the list of emitted files to return to the pipe...
|
|
63
23
|
const emittedFiles = [];
|
|
24
|
+
let api = undefined;
|
|
64
25
|
try {
|
|
65
|
-
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// too or not... This will determine whether we have to resolve them....
|
|
71
|
-
if (this._projectReferences) {
|
|
72
|
-
// Find all project references for the given configuration files
|
|
73
|
-
const projectReferences = await findProjectReferences(api, ...files.absolutePaths());
|
|
74
|
-
report.add(...projectReferences.errors);
|
|
75
|
-
if (report.errors)
|
|
76
|
-
report.done();
|
|
77
|
-
// Then determine the build order for all projects and their references
|
|
78
|
-
const projectOrder = resolveProjectOrder(projectReferences.projects);
|
|
79
|
-
report.add(...projectOrder.errors);
|
|
80
|
-
if (report.errors)
|
|
81
|
-
report.done();
|
|
82
|
-
// At this point, our list of projects to build is the "order"
|
|
83
|
-
snapshot = await api.updateSnapshot({ openProjects: projectOrder.order });
|
|
84
|
-
projects = [...projectOrder.order];
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
// If we're not building references, then we just build our files
|
|
88
|
-
const configs = [...files.absolutePaths()].map(findProjectConfig);
|
|
89
|
-
snapshot = await api.updateSnapshot({ openProjects: configs });
|
|
90
|
-
projects = [...configs];
|
|
91
|
-
// When resolving the project references above, we already processed
|
|
92
|
-
// any configuration files and added any errors to the report...
|
|
93
|
-
// In this case, we have to do it ourselves by reading each config!
|
|
94
|
-
for (const config of configs) {
|
|
95
|
-
const { errors } = await readProjectConfig(api, config);
|
|
96
|
-
report.add(...errors);
|
|
97
|
-
}
|
|
98
|
-
// If we have any errors at this point, we can't continue...
|
|
99
|
-
if (report.errors)
|
|
100
|
-
report.done();
|
|
101
|
-
}
|
|
26
|
+
api = new API({ cwd: files.directory });
|
|
27
|
+
// If we're not building references, then we just build our files
|
|
28
|
+
const configs = [...files.absolutePaths()].map(findProjectConfig);
|
|
29
|
+
const snapshot = await api.createSnapshot({ openProjects: configs });
|
|
30
|
+
const projects = snapshot.getProjects();
|
|
102
31
|
// Now build all projects in the order we determined earlier
|
|
103
32
|
for (const project of projects) {
|
|
104
33
|
// Get the actual TypeScript program for this project...
|
|
105
|
-
const program =
|
|
106
|
-
assert(program, `Project "${project}" not found in snapshot`);
|
|
34
|
+
const program = project.program;
|
|
107
35
|
// Collect compilation diagnostics for this project (has files)
|
|
108
|
-
const
|
|
36
|
+
const fullDiagnostics = await Promise.all([
|
|
109
37
|
program.getBindDiagnostics(),
|
|
38
|
+
program.getConfigFileParsingDiagnostics(),
|
|
39
|
+
program.getDeclarationDiagnostics(),
|
|
40
|
+
program.getGlobalDiagnostics(),
|
|
41
|
+
program.getProgramDiagnostics(),
|
|
110
42
|
program.getSemanticDiagnostics(),
|
|
111
|
-
program.getSyntacticDiagnostics(),
|
|
112
43
|
program.getSuggestionDiagnostics(),
|
|
113
|
-
program.
|
|
44
|
+
program.getSyntacticDiagnostics(),
|
|
114
45
|
]).then((results) => results.flat());
|
|
46
|
+
// Keep a set of external files we can ignore non-critical diags for
|
|
47
|
+
const externalFiles = new Set();
|
|
48
|
+
// Filter out diagnostics that are not relevant for this project
|
|
49
|
+
const now = Date.now();
|
|
50
|
+
const diagnostics = (await Promise.all(fullDiagnostics.map(async (diagnostic) => {
|
|
51
|
+
// Always keep all the errors...
|
|
52
|
+
if (diagnostic.category === DiagnosticCategory.Error)
|
|
53
|
+
return diagnostic;
|
|
54
|
+
// coverage ignore if // Keep diagnostics that do not have an associated file
|
|
55
|
+
if (!diagnostic.fileName)
|
|
56
|
+
return diagnostic;
|
|
57
|
+
// coverage ignore if // Before we do all the async resolution below, check our cache
|
|
58
|
+
if (externalFiles.has(diagnostic.fileName))
|
|
59
|
+
return undefined;
|
|
60
|
+
// Get the source file metadata for this diagnostic (expensive)
|
|
61
|
+
// and filter out anything from external libraries....
|
|
62
|
+
const metadata = await program.getSourceFileMetadata(diagnostic.fileName);
|
|
63
|
+
if (metadata?.isDefaultLibrary || metadata?.isFromExternalLibrary) {
|
|
64
|
+
externalFiles.add(diagnostic.fileName);
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
// Anything else, we keep!
|
|
68
|
+
return diagnostic;
|
|
69
|
+
}))).filter((diagnostic) => !!diagnostic);
|
|
70
|
+
context.log.warn(`Filtered diagnostics in ${Date.now() - now}ms`);
|
|
115
71
|
// When emitting, let's emit the files
|
|
116
|
-
if (
|
|
72
|
+
if (emitOnly !== null) {
|
|
117
73
|
// Emit the files for this program and collect diagnostics
|
|
118
|
-
const emitted = await program.emit(
|
|
74
|
+
const emitted = await program.emit(emitOnly);
|
|
119
75
|
diagnostics.push(...emitted.diagnostics);
|
|
120
76
|
// Make sure that we add any emitted file to the list to be returned
|
|
121
77
|
if (emitted.emittedFiles?.length) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
78
|
+
emitted.emittedFiles.forEach((file) => {
|
|
79
|
+
assertAbsolutePath(file);
|
|
80
|
+
emittedFiles.push(file);
|
|
81
|
+
});
|
|
125
82
|
}
|
|
126
83
|
// Report an error if emitting was skipped for some reason (we should
|
|
127
84
|
// have some diagnostics associated with this, but still...)
|
|
128
85
|
// coverage ignore if // don't know how to test this...
|
|
129
86
|
if (emitted.emitSkipped) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
87
|
+
if (project.configFileName && isAbsolutePath(project.configFileName)) {
|
|
88
|
+
report.add({
|
|
89
|
+
level: ERROR,
|
|
90
|
+
message: `Unable to emit files for this project`,
|
|
91
|
+
file: project.configFileName,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
report.add({
|
|
96
|
+
level: ERROR,
|
|
97
|
+
message: `Unable to emit files for unknown project`,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
135
100
|
}
|
|
136
101
|
}
|
|
137
102
|
// Add all diagnostics to the report
|
|
138
|
-
report.add(...
|
|
103
|
+
report.add(...convertDiagnostics(diagnostics, deprecationsLevel));
|
|
139
104
|
}
|
|
140
105
|
}
|
|
141
106
|
finally {
|
|
142
|
-
|
|
107
|
+
if (api)
|
|
108
|
+
await api.close();
|
|
143
109
|
}
|
|
144
110
|
report.done();
|
|
145
111
|
const outputPath = commonPath(files.directory, ...emittedFiles);
|
|
@@ -148,6 +114,47 @@ export class TypeScript {
|
|
|
148
114
|
.build();
|
|
149
115
|
}
|
|
150
116
|
}
|
|
117
|
+
export class TypeScriptBuild {
|
|
118
|
+
_options;
|
|
119
|
+
constructor(_options = {}) {
|
|
120
|
+
this._options = _options;
|
|
121
|
+
}
|
|
122
|
+
async pipe(files, context) {
|
|
123
|
+
// Destructure the build options for easier access
|
|
124
|
+
const { overrideCompilerOptions = {}, stopBuildOnErrors = false, verbose = true, force = true } = this._options;
|
|
125
|
+
// Create our TypeScript API and report for this plug
|
|
126
|
+
const report = context.log.report('TypeScript Build Report');
|
|
127
|
+
let api = undefined;
|
|
128
|
+
let orchestrator = undefined;
|
|
129
|
+
try {
|
|
130
|
+
api = new API({ cwd: files.directory });
|
|
131
|
+
orchestrator = await api.createBuildOrchestrator([...files.absolutePaths()], {
|
|
132
|
+
cwd: files.directory,
|
|
133
|
+
// From our options
|
|
134
|
+
overrideCompilerOptions,
|
|
135
|
+
stopBuildOnErrors,
|
|
136
|
+
verbose,
|
|
137
|
+
force,
|
|
138
|
+
});
|
|
139
|
+
const results = await orchestrator.build();
|
|
140
|
+
if (results.diagnostics)
|
|
141
|
+
report.add(...convertDiagnostics(results.diagnostics));
|
|
142
|
+
if (results.status !== 0) {
|
|
143
|
+
report.add({
|
|
144
|
+
level: ERROR,
|
|
145
|
+
message: `Build failed with status code ${results.status}`,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
if (orchestrator)
|
|
151
|
+
await orchestrator.dispose();
|
|
152
|
+
if (api)
|
|
153
|
+
await api.close();
|
|
154
|
+
}
|
|
155
|
+
report.done();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
151
158
|
/* ========================================================================== *
|
|
152
159
|
* TYPESCRIPT 7 HELPERS *
|
|
153
160
|
* ========================================================================== */
|
|
@@ -159,7 +166,7 @@ export class TypeScript {
|
|
|
159
166
|
*/
|
|
160
167
|
export function tsc(config, options = {}) {
|
|
161
168
|
const { directory, ...opts } = options;
|
|
162
|
-
return using(config, { directory }).plug(new TypeScript(
|
|
169
|
+
return using(config, { directory }).plug(new TypeScript(opts));
|
|
163
170
|
}
|
|
164
171
|
/* ========================================================================== */
|
|
165
172
|
/**
|
|
@@ -169,8 +176,8 @@ export function tsc(config, options = {}) {
|
|
|
169
176
|
*
|
|
170
177
|
* This is roughly equivalent to the command line `tsc --build <config>`.
|
|
171
178
|
*/
|
|
172
|
-
export function tsbuild(config, options
|
|
179
|
+
export function tsbuild(config, options) {
|
|
173
180
|
const { directory, ...opts } = options;
|
|
174
|
-
return using(config, { directory }).plug(new
|
|
181
|
+
return using(config, { directory }).plug(new TypeScriptBuild(opts));
|
|
175
182
|
}
|
|
176
183
|
//# sourceMappingURL=typescript.js.map
|
package/dist/typescript.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","
|
|
1
|
+
{"version":3,"file":"typescript.js","sources":["../src/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnF,OAAO,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAS1F;;gFAEgF;AAEhF,MAAM,OAAO,UAAU;IACQ,QAAQ;IAArC,YAA6B,QAAQ,GAAsB,EAAE;wBAAhC,QAAQ;IAA2B,CAAC;IAEjE,KAAK,CAAC,IAAI,CAAC,KAAY,EAAE,OAAgB;QACvC,sBAAsB;QACtB,MAAM,iBAAiB,GAAG,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAA;QACtF,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAEvD,qDAAqD;QACrD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CA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B,CAAC;QAED,MAAM,CAAC,IAAI,EAAE,CAAA;IACf,CAAC;CACF;AAED;;gFAEgF;AAEhF;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,OAAO,GAAe,EAAE;IAC1D,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IACtC,OAAO,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC;AAED,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,MAAc,EAAE,OAAwB;IAC9D,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IACtC,OAAO,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAA;AACrE,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EmitOnly } from 'typescript/unstable/async';
|
|
2
|
+
import type { TypeScriptOptions } from './index.ts';
|
|
3
|
+
import type { AbsolutePath } from '@plugjs/plug/paths';
|
|
4
|
+
/**
|
|
5
|
+
* Find the TypeScript project configuration file for a given path.
|
|
6
|
+
*
|
|
7
|
+
* The path specified can be a `tsconfig.json` file name or a directory
|
|
8
|
+
* containing a `tsconfig.json` file.
|
|
9
|
+
*
|
|
10
|
+
* The returned path is the absolute path of the actual `tsconfig.json` file.
|
|
11
|
+
*/
|
|
12
|
+
export declare function findProjectConfig(path: AbsolutePath): AbsolutePath;
|
|
13
|
+
/** Convert a diagnostic level option for deprecations into a consistent value. */
|
|
14
|
+
export declare function diagnosticDeprecationLevel(deprecations?: TypeScriptOptions['reportDeprecations']): 'warn' | 'notice' | 'off';
|
|
15
|
+
/** Convert a emit only option into its corresponding enum value. */
|
|
16
|
+
export declare function emitOnlyOption(emitOnly?: TypeScriptOptions['emitOnly']): EmitOnly | null;
|
|
17
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAEpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CAOlE;AAED,kFAAkF;AAClF,wBAAgB,0BAA0B,CACxC,YAAY,CAAC,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,GACrD,MAAM,GAAG,QAAQ,GAAG,KAAK,CAe3B;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,GAAG,QAAQ,GAAG,IAAI,CAkBxF"}
|