@plugjs/typescript 0.4.35 → 0.5.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/compiler.cjs +1 -1
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.mjs +1 -1
- package/dist/compiler.mjs.map +1 -1
- package/dist/options.cjs +31 -38
- package/dist/options.cjs.map +1 -1
- package/dist/options.d.ts +2 -2
- package/dist/options.mjs +31 -38
- package/dist/options.mjs.map +1 -1
- package/dist/report.cjs +1 -1
- package/dist/report.cjs.map +1 -1
- package/dist/report.mjs +1 -1
- package/dist/report.mjs.map +1 -1
- package/dist/typescript.cjs +41 -24
- package/dist/typescript.cjs.map +1 -1
- package/dist/typescript.mjs +43 -26
- package/dist/typescript.mjs.map +1 -1
- package/package.json +2 -2
- package/src/compiler.ts +1 -1
- package/src/options.ts +93 -66
- package/src/report.ts +1 -1
- package/src/typescript.ts +56 -25
package/dist/compiler.cjs
CHANGED
|
@@ -33,8 +33,8 @@ __export(compiler_exports, {
|
|
|
33
33
|
TypeScriptHost: () => TypeScriptHost
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(compiler_exports);
|
|
36
|
-
var import_typescript = __toESM(require("typescript"), 1);
|
|
37
36
|
var import_paths = require("@plugjs/plug/paths");
|
|
37
|
+
var import_typescript = __toESM(require("typescript"), 1);
|
|
38
38
|
var TypeScriptHost = class {
|
|
39
39
|
constructor(_directory) {
|
|
40
40
|
this._directory = _directory;
|
package/dist/compiler.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/compiler.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;A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[]
|
|
6
6
|
}
|
package/dist/options.cjs
CHANGED
|
@@ -33,48 +33,41 @@ __export(options_exports, {
|
|
|
33
33
|
getCompilerOptions: () => getCompilerOptions
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(options_exports);
|
|
36
|
-
var import_typescript = __toESM(require("typescript"), 1);
|
|
37
36
|
var import_paths = require("@plugjs/plug/paths");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const
|
|
37
|
+
var import_typescript = __toESM(require("typescript"), 1);
|
|
38
|
+
async function getCompilerOptions(file, overrides, inputs) {
|
|
39
|
+
if (!file) {
|
|
40
|
+
const options = { ...import_typescript.default.getDefaultCompilerOptions(), ...overrides };
|
|
41
|
+
return { options, errors: [] };
|
|
42
|
+
}
|
|
43
|
+
const host = {
|
|
44
|
+
useCaseSensitiveFileNames: import_typescript.default.sys.useCaseSensitiveFileNames,
|
|
45
|
+
readDirectory(rootDir, extensions, excludes, includes, depth) {
|
|
46
|
+
return import_typescript.default.sys.readDirectory(rootDir, extensions, excludes, includes, depth);
|
|
47
|
+
},
|
|
48
|
+
fileExists(path) {
|
|
49
|
+
return import_typescript.default.sys.fileExists(path);
|
|
50
|
+
},
|
|
51
|
+
readFile(path) {
|
|
52
|
+
return import_typescript.default.sys.readFile(path);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
45
55
|
const { config, error } = import_typescript.default.readConfigFile(file, import_typescript.default.sys.readFile);
|
|
46
56
|
if (error)
|
|
47
57
|
return { options: {}, errors: [error] };
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// copied from typescript internals...
|
|
62
|
-
file: import_typescript.default.createSourceFile(file, data, import_typescript.default.ScriptTarget.JSON, false, import_typescript.default.ScriptKind.JSON),
|
|
63
|
-
start: void 0,
|
|
64
|
-
length: void 0
|
|
65
|
-
}] };
|
|
66
|
-
}
|
|
67
|
-
return mergeResults(await loadOptions(ext, [...stack, ext]), result);
|
|
68
|
-
}
|
|
69
|
-
async function getCompilerOptions(file, overrides) {
|
|
70
|
-
const options = import_typescript.default.getDefaultCompilerOptions();
|
|
71
|
-
let result = { options, errors: [] };
|
|
72
|
-
if (file)
|
|
73
|
-
result = mergeResults(result, await loadOptions(file));
|
|
74
|
-
if (overrides) {
|
|
75
|
-
result = mergeResults(result, { options: overrides, errors: [] });
|
|
76
|
-
}
|
|
77
|
-
return result;
|
|
58
|
+
config.include = inputs;
|
|
59
|
+
return import_typescript.default.parseJsonConfigFileContent(
|
|
60
|
+
config,
|
|
61
|
+
// the parsed JSON
|
|
62
|
+
host,
|
|
63
|
+
// our config parser host
|
|
64
|
+
(0, import_paths.getAbsoluteParent)(file),
|
|
65
|
+
// directory for path resolution
|
|
66
|
+
overrides,
|
|
67
|
+
// overrides (from the TSC plug config)
|
|
68
|
+
file
|
|
69
|
+
// the file name for path resolution
|
|
70
|
+
);
|
|
78
71
|
}
|
|
79
72
|
// Annotate the CommonJS export names for ESM import in node:
|
|
80
73
|
0 && (module.exports = {
|
package/dist/options.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/options.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AAClC,wBAAe;AA2Ef,eAAsB,mBAClB,MACA,WACA,QACsC;AAExC,MAAI,CAAE,MAAM;AACV,UAAM,UAAU,EAAE,GAAG,kBAAAA,QAAG,0BAA0B,GAAG,GAAG,UAAU;AAClE,WAAO,EAAE,SAAS,QAAQ,CAAC,EAAE;AAAA,EAC/B;AAGA,QAAM,OAA2B;AAAA,IAC/B,2BAA2B,kBAAAA,QAAG,IAAI;AAAA,IAClC,cAAc,SAAS,YAAY,UAAU,UAAU,OAA0B;AAC/E,aAAO,kBAAAA,QAAG,IAAI,cAAc,SAAS,YAAY,UAAU,UAAU,KAAK;AAAA,IAC5E;AAAA,IACA,WAAW,MAAuB;AAChC,aAAO,kBAAAA,QAAG,IAAI,WAAW,IAAI;AAAA,IAC/B;AAAA,IACA,SAAS,MAAkC;AACzC,aAAO,kBAAAA,QAAG,IAAI,SAAS,IAAI;AAAA,IAC7B;AAAA,EACF;AAMA,QAAM,EAAE,QAAQ,MAAM,IAAI,kBAAAA,QAAG,eAAe,MAAM,kBAAAA,QAAG,IAAI,QAAQ;AACjE,MAAI;AAAO,WAAO,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAE,KAAM,EAAE;AAInD,SAAO,UAAU;AAEjB,SAAO,kBAAAA,QAAG;AAAA,IACN;AAAA;AAAA,IACA;AAAA;AAAA,QACA,gCAAkB,IAAI;AAAA;AAAA,IACtB;AAAA;AAAA,IACA;AAAA;AAAA,EACJ;AACF;",
|
|
5
5
|
"names": ["ts"]
|
|
6
6
|
}
|
package/dist/options.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export type CompilerOptionsAndDiagnostics = {
|
|
|
4
4
|
options: ts.CompilerOptions;
|
|
5
5
|
errors: readonly ts.Diagnostic[];
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
export declare function getCompilerOptions(file: AbsolutePath | undefined, overrides: ts.CompilerOptions): Promise<CompilerOptionsAndDiagnostics>;
|
|
7
|
+
/** Load compiler options from a JSON file, and merge in the overrides */
|
|
8
|
+
export declare function getCompilerOptions(file: AbsolutePath | undefined, overrides: ts.CompilerOptions, inputs: AbsolutePath[]): Promise<CompilerOptionsAndDiagnostics>;
|
package/dist/options.mjs
CHANGED
|
@@ -1,46 +1,39 @@
|
|
|
1
1
|
// options.ts
|
|
2
|
+
import { getAbsoluteParent } from "@plugjs/plug/paths";
|
|
2
3
|
import ts from "typescript";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
async function getCompilerOptions(file, overrides, inputs) {
|
|
5
|
+
if (!file) {
|
|
6
|
+
const options = { ...ts.getDefaultCompilerOptions(), ...overrides };
|
|
7
|
+
return { options, errors: [] };
|
|
8
|
+
}
|
|
9
|
+
const host = {
|
|
10
|
+
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
|
|
11
|
+
readDirectory(rootDir, extensions, excludes, includes, depth) {
|
|
12
|
+
return ts.sys.readDirectory(rootDir, extensions, excludes, includes, depth);
|
|
13
|
+
},
|
|
14
|
+
fileExists(path) {
|
|
15
|
+
return ts.sys.fileExists(path);
|
|
16
|
+
},
|
|
17
|
+
readFile(path) {
|
|
18
|
+
return ts.sys.readFile(path);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
11
21
|
const { config, error } = ts.readConfigFile(file, ts.sys.readFile);
|
|
12
22
|
if (error)
|
|
13
23
|
return { options: {}, errors: [error] };
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// copied from typescript internals...
|
|
28
|
-
file: ts.createSourceFile(file, data, ts.ScriptTarget.JSON, false, ts.ScriptKind.JSON),
|
|
29
|
-
start: void 0,
|
|
30
|
-
length: void 0
|
|
31
|
-
}] };
|
|
32
|
-
}
|
|
33
|
-
return mergeResults(await loadOptions(ext, [...stack, ext]), result);
|
|
34
|
-
}
|
|
35
|
-
async function getCompilerOptions(file, overrides) {
|
|
36
|
-
const options = ts.getDefaultCompilerOptions();
|
|
37
|
-
let result = { options, errors: [] };
|
|
38
|
-
if (file)
|
|
39
|
-
result = mergeResults(result, await loadOptions(file));
|
|
40
|
-
if (overrides) {
|
|
41
|
-
result = mergeResults(result, { options: overrides, errors: [] });
|
|
42
|
-
}
|
|
43
|
-
return result;
|
|
24
|
+
config.include = inputs;
|
|
25
|
+
return ts.parseJsonConfigFileContent(
|
|
26
|
+
config,
|
|
27
|
+
// the parsed JSON
|
|
28
|
+
host,
|
|
29
|
+
// our config parser host
|
|
30
|
+
getAbsoluteParent(file),
|
|
31
|
+
// directory for path resolution
|
|
32
|
+
overrides,
|
|
33
|
+
// overrides (from the TSC plug config)
|
|
34
|
+
file
|
|
35
|
+
// the file name for path resolution
|
|
36
|
+
);
|
|
44
37
|
}
|
|
45
38
|
export {
|
|
46
39
|
getCompilerOptions
|
package/dist/options.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/options.ts"],
|
|
4
|
-
"mappings": ";AAAA,OAAO,QAAQ;
|
|
4
|
+
"mappings": ";AAAA,SAAS,yBAAyB;AAClC,OAAO,QAAQ;AA2Ef,eAAsB,mBAClB,MACA,WACA,QACsC;AAExC,MAAI,CAAE,MAAM;AACV,UAAM,UAAU,EAAE,GAAG,GAAG,0BAA0B,GAAG,GAAG,UAAU;AAClE,WAAO,EAAE,SAAS,QAAQ,CAAC,EAAE;AAAA,EAC/B;AAGA,QAAM,OAA2B;AAAA,IAC/B,2BAA2B,GAAG,IAAI;AAAA,IAClC,cAAc,SAAS,YAAY,UAAU,UAAU,OAA0B;AAC/E,aAAO,GAAG,IAAI,cAAc,SAAS,YAAY,UAAU,UAAU,KAAK;AAAA,IAC5E;AAAA,IACA,WAAW,MAAuB;AAChC,aAAO,GAAG,IAAI,WAAW,IAAI;AAAA,IAC/B;AAAA,IACA,SAAS,MAAkC;AACzC,aAAO,GAAG,IAAI,SAAS,IAAI;AAAA,IAC7B;AAAA,EACF;AAMA,QAAM,EAAE,QAAQ,MAAM,IAAI,GAAG,eAAe,MAAM,GAAG,IAAI,QAAQ;AACjE,MAAI;AAAO,WAAO,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAE,KAAM,EAAE;AAInD,SAAO,UAAU;AAEjB,SAAO,GAAG;AAAA,IACN;AAAA;AAAA,IACA;AAAA;AAAA,IACA,kBAAkB,IAAI;AAAA;AAAA,IACtB;AAAA;AAAA,IACA;AAAA;AAAA,EACJ;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/report.cjs
CHANGED
|
@@ -33,9 +33,9 @@ __export(report_exports, {
|
|
|
33
33
|
updateReport: () => updateReport
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(report_exports);
|
|
36
|
-
var import_typescript = __toESM(require("typescript"), 1);
|
|
37
36
|
var import_logging = require("@plugjs/plug/logging");
|
|
38
37
|
var import_paths = require("@plugjs/plug/paths");
|
|
38
|
+
var import_typescript = __toESM(require("typescript"), 1);
|
|
39
39
|
function convertMessageChain(chain, indent = 0) {
|
|
40
40
|
const message = `${"".padStart(indent * 2)}${chain.messageText}`;
|
|
41
41
|
if (chain.next) {
|
package/dist/report.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/report.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoC;AACpC,mBAAoC;AACpC,wBAAe;AAMf,SAAS,oBAAoB,OAAkC,SAAS,GAAa;AACnF,QAAM,UAAU,GAAG,GAAG,SAAS,SAAS,CAAC,CAAC,GAAG,MAAM,WAAW;AAE9D,MAAI,MAAM,MAAM;AACd,UAAM,OAAO,MAAM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|
|
5
5
|
"names": ["ts"]
|
|
6
6
|
}
|
package/dist/report.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// report.ts
|
|
2
|
-
import ts from "typescript";
|
|
3
2
|
import { ERROR, NOTICE, WARN } from "@plugjs/plug/logging";
|
|
4
3
|
import { resolveAbsolutePath } from "@plugjs/plug/paths";
|
|
4
|
+
import ts from "typescript";
|
|
5
5
|
function convertMessageChain(chain, indent = 0) {
|
|
6
6
|
const message = `${"".padStart(indent * 2)}${chain.messageText}`;
|
|
7
7
|
if (chain.next) {
|
package/dist/report.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/report.ts"],
|
|
4
|
-
"mappings": ";AAAA,
|
|
4
|
+
"mappings": ";AAAA,SAAS,OAAO,QAAQ,YAAY;AACpC,SAAS,2BAA2B;AACpC,OAAO,QAAQ;AAMf,SAAS,oBAAoB,OAAkC,SAAS,GAAa;AACnF,QAAM,UAAU,GAAG,GAAG,SAAS,SAAS,CAAC,CAAC,GAAG,MAAM,WAAW;AAE9D,MAAI,MAAM,MAAM;AACd,UAAM,OAAO,MAAM,KAAK,IAAI,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAC,CAAC;AACrE,WAAO,CAAE,SAAS,GAAG,KAAK,KAAK,CAAC,CAAE;AAAA,EACpC,OAAO;AACL,WAAO,CAAE,OAAQ;AAAA,EACnB;AACF;AAEA,SAAS,mBACL,aACA,WACc;AAChB,SAAO,YAAY,IAAI,CAAC,eAA6B;AAKnD,QAAI;AACJ,YAAQ,WAAW,UAAU;AAAA,MAC3B,KAAK,GAAG,mBAAmB;AAAO,gBAAQ;AAAO;AAAA,MAEjD,KAAK,GAAG,mBAAmB;AAAS,gBAAQ;AAAM;AAAA,MAElD;AAAS,gBAAQ;AAAA,IACnB;AAGA,QAAI;AACJ,QAAI,OAAO,WAAW,gBAAgB,UAAU;AAC9C,gBAAU,WAAW;AAAA,IACvB,OAAO;AACL,gBAAU,oBAAoB,WAAW,WAAW;AAAA,IACtD;AAGA,UAAM,OAAO,KAAK,WAAW,IAAI;AAGjC,QAAI,WAAW,MAAM;AACnB,YAAM,EAAE,MAAM,YAAY,OAAO,OAAO,IAAI;AAC5C,YAAM,OAAO,oBAAoB,WAAW,WAAW,QAAQ;AAC/D,YAAM,SAAS,WAAW,YAAY;AAGtC,UAAI,UAAU,QAAW;AACvB,cAAM,WAAW,WAAW,8BAA8B,KAAK;AAC/D,YAAI,EAAE,MAAM,WAAW,OAAO,IAAI;AAClC,kBAAU;AACV,gBAAQ;AAER,eAAO,EAAE,OAAO,SAAS,MAAM,MAAM,QAAQ,MAAM,QAAQ,OAAO;AAAA,MACpE,OAAO;AACL,eAAO,EAAE,OAAO,SAAS,MAAM,MAAM,OAAO;AAAA,MAC9C;AAAA,IACF,OAAO;AACL,aAAO,EAAE,OAAO,SAAS,KAAK;AAAA,IAChC;AAAA,EACF,CAAC;AACH;AAGO,SAAS,aACZ,QACA,aACA,WACI;AACN,QAAM,UAAU,mBAAmB,aAAa,SAAS;AACzD,SAAO,IAAI,GAAG,OAAO;AACvB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/typescript.cjs
CHANGED
|
@@ -33,15 +33,24 @@ __export(typescript_exports, {
|
|
|
33
33
|
Tsc: () => Tsc
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(typescript_exports);
|
|
36
|
-
var import_typescript = __toESM(require("typescript"), 1);
|
|
37
36
|
var import_asserts = require("@plugjs/plug/asserts");
|
|
38
37
|
var import_files = require("@plugjs/plug/files");
|
|
39
38
|
var import_logging = require("@plugjs/plug/logging");
|
|
40
39
|
var import_paths = require("@plugjs/plug/paths");
|
|
41
40
|
var import_utils = require("@plugjs/plug/utils");
|
|
41
|
+
var import_typescript = __toESM(require("typescript"), 1);
|
|
42
42
|
var import_compiler = require("./compiler.cjs");
|
|
43
43
|
var import_options = require("./options.cjs");
|
|
44
44
|
var import_report = require("./report.cjs");
|
|
45
|
+
function defaultRootDir(paths) {
|
|
46
|
+
const [firstPath, ...restPaths] = paths.filter((path) => {
|
|
47
|
+
return !path.match(/\.d\.[mc]?ts$/i);
|
|
48
|
+
});
|
|
49
|
+
(0, import_asserts.assert)(firstPath, "No non-declaration files found to compile");
|
|
50
|
+
if (restPaths.length)
|
|
51
|
+
return (0, import_paths.commonPath)(firstPath, ...restPaths);
|
|
52
|
+
return (0, import_paths.getAbsoluteParent)(firstPath);
|
|
53
|
+
}
|
|
45
54
|
var Tsc = class {
|
|
46
55
|
_tsconfig;
|
|
47
56
|
_options;
|
|
@@ -51,41 +60,43 @@ var Tsc = class {
|
|
|
51
60
|
this._options = options;
|
|
52
61
|
}
|
|
53
62
|
async pipe(files, context) {
|
|
54
|
-
const
|
|
63
|
+
const paths = [...files.absolutePaths()];
|
|
55
64
|
const report = context.log.report("TypeScript Report");
|
|
56
|
-
const { extraTypesDir, ...
|
|
65
|
+
const { extraTypesDir, ...__overrides } = { ...this._options };
|
|
66
|
+
if (extraTypesDir) {
|
|
67
|
+
const directory = context.resolve(extraTypesDir);
|
|
68
|
+
for await (const file of (0, import_utils.walk)(directory, ["**/*.d.ts"])) {
|
|
69
|
+
const path = (0, import_paths.resolveAbsolutePath)(directory, file);
|
|
70
|
+
context.log.debug(`Including extra type file "${(0, import_logging.$p)(path)}"`);
|
|
71
|
+
paths.push(path);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
57
74
|
const sourcesConfig = (0, import_paths.resolveFile)(files.directory, "tsconfig.json");
|
|
58
75
|
const tsconfig = this._tsconfig ? context.resolve(this._tsconfig) : sourcesConfig || (0, import_paths.resolveFile)(context.resolve("tsconfig.json"));
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
rootDir = overrides.rootDir = context.resolve(overrides.rootDir);
|
|
62
|
-
} else {
|
|
63
|
-
rootDir = overrides.rootDir = files.directory;
|
|
76
|
+
if (__overrides.rootDir) {
|
|
77
|
+
__overrides.rootDir = context.resolve(__overrides.rootDir);
|
|
64
78
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
outDir = overrides.outDir = context.resolve(overrides.outDir);
|
|
68
|
-
} else {
|
|
69
|
-
outDir = overrides.outDir = rootDir;
|
|
79
|
+
if (__overrides.outDir) {
|
|
80
|
+
__overrides.outDir = context.resolve(__overrides.outDir);
|
|
70
81
|
}
|
|
71
|
-
if (
|
|
72
|
-
|
|
82
|
+
if (__overrides.rootDirs) {
|
|
83
|
+
__overrides.rootDirs = __overrides.rootDirs.map((dir) => context.resolve(dir));
|
|
73
84
|
}
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
|
|
85
|
+
if (__overrides.baseUrl)
|
|
86
|
+
__overrides.baseUrl = context.resolve(__overrides.baseUrl);
|
|
87
|
+
if (__overrides.outFile)
|
|
88
|
+
__overrides.outFile = context.resolve(__overrides.outFile);
|
|
78
89
|
const { errors, options } = await (0, import_options.getCompilerOptions)(
|
|
79
90
|
tsconfig,
|
|
80
91
|
// resolved tsconfig.json from constructor, might be undefined
|
|
81
|
-
|
|
92
|
+
__overrides,
|
|
93
|
+
paths
|
|
82
94
|
);
|
|
83
|
-
(0, import_report.updateReport)(report, errors,
|
|
95
|
+
(0, import_report.updateReport)(report, errors, context.resolve("."));
|
|
84
96
|
if (report.errors)
|
|
85
97
|
report.done(true);
|
|
86
|
-
const paths = [...files.absolutePaths()];
|
|
87
98
|
for (const path of paths)
|
|
88
|
-
context.log.
|
|
99
|
+
context.log.debug(`Compiling "${(0, import_logging.$p)(path)}"`);
|
|
89
100
|
context.log.info("Compiling", paths.length, "files");
|
|
90
101
|
if (extraTypesDir) {
|
|
91
102
|
const directory = context.resolve(extraTypesDir);
|
|
@@ -95,7 +106,13 @@ var Tsc = class {
|
|
|
95
106
|
paths.push(path);
|
|
96
107
|
}
|
|
97
108
|
}
|
|
98
|
-
context.
|
|
109
|
+
const rootDir = options.rootDir ? context.resolve(options.rootDir) : defaultRootDir(paths);
|
|
110
|
+
if (!(options.rootDir || options.rootDirs))
|
|
111
|
+
options.rootDir = rootDir;
|
|
112
|
+
const outDir = options.outDir ? context.resolve(options.outDir) : rootDir;
|
|
113
|
+
if (!(options.outDir || options.outFile))
|
|
114
|
+
options.outDir = outDir;
|
|
115
|
+
context.log.info("Compliation options", options);
|
|
99
116
|
const host = new import_compiler.TypeScriptHost(rootDir);
|
|
100
117
|
const program = import_typescript.default.createProgram(paths, options, host, void 0, errors);
|
|
101
118
|
const diagnostics = import_typescript.default.getPreEmitDiagnostics(program);
|
package/dist/typescript.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/typescript.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAqD;AACrD,mBAAsB;AACtB,qBAAmB;AACnB,mBAAgF;AAChF,mBAAmC;AACnC,wBAAe;AAEf,sBAA+B;AAC/B,qBAAmC;AACnC,oBAA6B;AAW7B,SAAS,eAAe,OAAqC;AAC3D,QAAM,CAAE,WAAW,GAAG,SAAU,IAAI,MAAM,OAAO,CAAC,SAAS;AACzD,WAAO,CAAE,KAAK,MAAM,gBAAgB;AAAA,EACtC,CAAC;AAED,6BAAO,WAAW,2CAA2C;AAC7D,MAAI,UAAU;AAAQ,eAAO,yBAAW,WAAW,GAAG,SAAS;AAC/D,aAAO,gCAAkB,SAAS;AACpC;AAEO,IAAM,MAAN,MAAiC;AAAA,EACrB;AAAA,EACA;AAAA,EAEjB,eAAe,MAA6B;AAC1C,UAAM,EAAE,QAAQ,CAAE,QAAS,GAAG,QAAQ,QAAI,2BAAa,MAAM,CAAC,CAAC;AAC/D,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A,QAAiC,CAAC,UAAU;AAC7C,gBAAM,cAAU,kCAAoB,QAAQ,QAAQ;AACpD,kBAAQ,IAAI,MAAM,wBAAoB,mBAAG,OAAO,GAAG,KAAK;AACxD,gBAAM,4BAAa,KAAK;AAAA,QAC1B;AAAA,MAAC,CAAC;AAAA,IACJ,CAAC;AAGD,cAAM,+BAAe,QAAQ;AAG7B,oCAAa,QAAQ,OAAO,aAAa,OAAO;AAEhD,QAAI,OAAO;AAAQ,aAAO,KAAK,IAAI;AAGnC,UAAM,UAAU,QAAQ,MAAM;AAC9B,YAAQ,IAAI,KAAK,gBAAgB,QAAQ,QAAQ,kBAAc,mBAAG,QAAQ,SAAS,CAAC;AACpF,WAAO;AAAA,EACT;AACF;",
|
|
5
5
|
"names": ["ts"]
|
|
6
6
|
}
|
package/dist/typescript.mjs
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
// typescript.ts
|
|
2
|
-
import
|
|
3
|
-
import { assertPromises, BuildFailure } from "@plugjs/plug/asserts";
|
|
2
|
+
import { assert, assertPromises, BuildFailure } from "@plugjs/plug/asserts";
|
|
4
3
|
import { Files } from "@plugjs/plug/files";
|
|
5
4
|
import { $p } from "@plugjs/plug/logging";
|
|
6
|
-
import { resolveAbsolutePath, resolveFile } from "@plugjs/plug/paths";
|
|
5
|
+
import { commonPath, getAbsoluteParent, resolveAbsolutePath, resolveFile } from "@plugjs/plug/paths";
|
|
7
6
|
import { parseOptions, walk } from "@plugjs/plug/utils";
|
|
7
|
+
import ts from "typescript";
|
|
8
8
|
import { TypeScriptHost } from "./compiler.mjs";
|
|
9
9
|
import { getCompilerOptions } from "./options.mjs";
|
|
10
10
|
import { updateReport } from "./report.mjs";
|
|
11
|
+
function defaultRootDir(paths) {
|
|
12
|
+
const [firstPath, ...restPaths] = paths.filter((path) => {
|
|
13
|
+
return !path.match(/\.d\.[mc]?ts$/i);
|
|
14
|
+
});
|
|
15
|
+
assert(firstPath, "No non-declaration files found to compile");
|
|
16
|
+
if (restPaths.length)
|
|
17
|
+
return commonPath(firstPath, ...restPaths);
|
|
18
|
+
return getAbsoluteParent(firstPath);
|
|
19
|
+
}
|
|
11
20
|
var Tsc = class {
|
|
12
21
|
_tsconfig;
|
|
13
22
|
_options;
|
|
@@ -17,41 +26,43 @@ var Tsc = class {
|
|
|
17
26
|
this._options = options;
|
|
18
27
|
}
|
|
19
28
|
async pipe(files, context) {
|
|
20
|
-
const
|
|
29
|
+
const paths = [...files.absolutePaths()];
|
|
21
30
|
const report = context.log.report("TypeScript Report");
|
|
22
|
-
const { extraTypesDir, ...
|
|
31
|
+
const { extraTypesDir, ...__overrides } = { ...this._options };
|
|
32
|
+
if (extraTypesDir) {
|
|
33
|
+
const directory = context.resolve(extraTypesDir);
|
|
34
|
+
for await (const file of walk(directory, ["**/*.d.ts"])) {
|
|
35
|
+
const path = resolveAbsolutePath(directory, file);
|
|
36
|
+
context.log.debug(`Including extra type file "${$p(path)}"`);
|
|
37
|
+
paths.push(path);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
23
40
|
const sourcesConfig = resolveFile(files.directory, "tsconfig.json");
|
|
24
41
|
const tsconfig = this._tsconfig ? context.resolve(this._tsconfig) : sourcesConfig || resolveFile(context.resolve("tsconfig.json"));
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
rootDir = overrides.rootDir = context.resolve(overrides.rootDir);
|
|
28
|
-
} else {
|
|
29
|
-
rootDir = overrides.rootDir = files.directory;
|
|
42
|
+
if (__overrides.rootDir) {
|
|
43
|
+
__overrides.rootDir = context.resolve(__overrides.rootDir);
|
|
30
44
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
outDir = overrides.outDir = context.resolve(overrides.outDir);
|
|
34
|
-
} else {
|
|
35
|
-
outDir = overrides.outDir = rootDir;
|
|
45
|
+
if (__overrides.outDir) {
|
|
46
|
+
__overrides.outDir = context.resolve(__overrides.outDir);
|
|
36
47
|
}
|
|
37
|
-
if (
|
|
38
|
-
|
|
48
|
+
if (__overrides.rootDirs) {
|
|
49
|
+
__overrides.rootDirs = __overrides.rootDirs.map((dir) => context.resolve(dir));
|
|
39
50
|
}
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
if (
|
|
43
|
-
|
|
51
|
+
if (__overrides.baseUrl)
|
|
52
|
+
__overrides.baseUrl = context.resolve(__overrides.baseUrl);
|
|
53
|
+
if (__overrides.outFile)
|
|
54
|
+
__overrides.outFile = context.resolve(__overrides.outFile);
|
|
44
55
|
const { errors, options } = await getCompilerOptions(
|
|
45
56
|
tsconfig,
|
|
46
57
|
// resolved tsconfig.json from constructor, might be undefined
|
|
47
|
-
|
|
58
|
+
__overrides,
|
|
59
|
+
paths
|
|
48
60
|
);
|
|
49
|
-
updateReport(report, errors,
|
|
61
|
+
updateReport(report, errors, context.resolve("."));
|
|
50
62
|
if (report.errors)
|
|
51
63
|
report.done(true);
|
|
52
|
-
const paths = [...files.absolutePaths()];
|
|
53
64
|
for (const path of paths)
|
|
54
|
-
context.log.
|
|
65
|
+
context.log.debug(`Compiling "${$p(path)}"`);
|
|
55
66
|
context.log.info("Compiling", paths.length, "files");
|
|
56
67
|
if (extraTypesDir) {
|
|
57
68
|
const directory = context.resolve(extraTypesDir);
|
|
@@ -61,7 +72,13 @@ var Tsc = class {
|
|
|
61
72
|
paths.push(path);
|
|
62
73
|
}
|
|
63
74
|
}
|
|
64
|
-
context.
|
|
75
|
+
const rootDir = options.rootDir ? context.resolve(options.rootDir) : defaultRootDir(paths);
|
|
76
|
+
if (!(options.rootDir || options.rootDirs))
|
|
77
|
+
options.rootDir = rootDir;
|
|
78
|
+
const outDir = options.outDir ? context.resolve(options.outDir) : rootDir;
|
|
79
|
+
if (!(options.outDir || options.outFile))
|
|
80
|
+
options.outDir = outDir;
|
|
81
|
+
context.log.info("Compliation options", options);
|
|
65
82
|
const host = new TypeScriptHost(rootDir);
|
|
66
83
|
const program = ts.createProgram(paths, options, host, void 0, errors);
|
|
67
84
|
const diagnostics = ts.getPreEmit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O;AAAA,EACT;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plugjs/typescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"typescript": "^5.2.2"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@plugjs/plug": "0.
|
|
36
|
+
"@plugjs/plug": "0.5.0"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"*.md",
|
package/src/compiler.ts
CHANGED
package/src/options.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { getAbsoluteParent } from '@plugjs/plug/paths'
|
|
2
|
+
import ts from 'typescript'
|
|
3
3
|
|
|
4
4
|
import type { AbsolutePath } from '@plugjs/plug/paths'
|
|
5
5
|
|
|
@@ -12,82 +12,109 @@ export type CompilerOptionsAndDiagnostics = {
|
|
|
12
12
|
|
|
13
13
|
/* ========================================================================== */
|
|
14
14
|
|
|
15
|
-
function mergeResults(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
): CompilerOptionsAndDiagnostics {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
15
|
+
// function mergeResults(
|
|
16
|
+
// base: CompilerOptionsAndDiagnostics,
|
|
17
|
+
// override: CompilerOptionsAndDiagnostics,
|
|
18
|
+
// ): CompilerOptionsAndDiagnostics {
|
|
19
|
+
// const options = { ...base.options, ...override.options }
|
|
20
|
+
// const errors = [ ...base.errors, ...override.errors ]
|
|
21
|
+
// return errors.length ? { options: {}, errors } : { options, errors: [] }
|
|
22
|
+
// }
|
|
23
23
|
|
|
24
24
|
/* ========================================================================== */
|
|
25
25
|
|
|
26
|
-
async function loadOptions(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
): Promise<CompilerOptionsAndDiagnostics> {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
26
|
+
// async function loadOptions(
|
|
27
|
+
// file: AbsolutePath,
|
|
28
|
+
// stack: AbsolutePath[] = [ file ],
|
|
29
|
+
// ): Promise<CompilerOptionsAndDiagnostics> {
|
|
30
|
+
// const dir = getAbsoluteParent(file)
|
|
31
|
+
|
|
32
|
+
// // Load up our config file and convert is wicked JSON
|
|
33
|
+
// const { config, error } = ts.readConfigFile(file, ts.sys.readFile)
|
|
34
|
+
// if (error) return { options: {}, errors: [ error ] }
|
|
35
|
+
|
|
36
|
+
// // Parse up the configuration file as options
|
|
37
|
+
// const { compilerOptions = {}, extends: extendsPath } = config
|
|
38
|
+
// const result = ts.convertCompilerOptionsFromJson(compilerOptions, dir, file)
|
|
39
|
+
// if (result.errors.length) return result
|
|
40
|
+
|
|
41
|
+
// // If we don't extend, we can return our result
|
|
42
|
+
// if (!extendsPath) return result
|
|
43
|
+
|
|
44
|
+
// // Resolve the name of the file this config extends
|
|
45
|
+
// const ext = resolveAbsolutePath(dir, extendsPath)
|
|
46
|
+
|
|
47
|
+
// // Triple check that we are not recursively importing this file
|
|
48
|
+
// if (stack.includes(ext)) {
|
|
49
|
+
// const data = ts.sys.readFile(file)
|
|
50
|
+
// return { options: {}, errors: [ {
|
|
51
|
+
// messageText: `Circularity detected extending from "${ext}"`,
|
|
52
|
+
// category: ts.DiagnosticCategory.Error,
|
|
53
|
+
// code: 18000, // copied from typescript internals...
|
|
54
|
+
// file: ts.createSourceFile(file, data!, ts.ScriptTarget.JSON, false, ts.ScriptKind.JSON),
|
|
55
|
+
// start: undefined,
|
|
56
|
+
// length: undefined,
|
|
57
|
+
// } ] }
|
|
58
|
+
// }
|
|
59
|
+
|
|
60
|
+
// // Push our file in the stack and load recursively
|
|
61
|
+
// return mergeResults(await loadOptions(ext, [ ...stack, ext ]), result)
|
|
62
|
+
// }
|
|
63
63
|
|
|
64
64
|
/* ========================================================================== */
|
|
65
65
|
|
|
66
|
-
export async function getCompilerOptions(
|
|
67
|
-
|
|
68
|
-
): Promise<CompilerOptionsAndDiagnostics>
|
|
66
|
+
// export async function getCompilerOptions(
|
|
67
|
+
// file?: AbsolutePath,
|
|
68
|
+
// ): Promise<CompilerOptionsAndDiagnostics>
|
|
69
69
|
|
|
70
|
-
export async function getCompilerOptions(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
// export async function getCompilerOptions(
|
|
71
|
+
// file: AbsolutePath | undefined,
|
|
72
|
+
// overrides: ts.CompilerOptions,
|
|
73
|
+
// inputs: AbsolutePath[],
|
|
74
|
+
// ): Promise<CompilerOptionsAndDiagnostics>
|
|
74
75
|
|
|
75
76
|
/** Load compiler options from a JSON file, and merge in the overrides */
|
|
76
77
|
export async function getCompilerOptions(
|
|
77
|
-
file
|
|
78
|
-
overrides
|
|
78
|
+
file: AbsolutePath | undefined,
|
|
79
|
+
overrides: ts.CompilerOptions,
|
|
80
|
+
inputs: AbsolutePath[],
|
|
79
81
|
): Promise<CompilerOptionsAndDiagnostics> {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
// If we don't have a config file, return the merged defaults/overrides
|
|
83
|
+
if (! file) {
|
|
84
|
+
const options = { ...ts.getDefaultCompilerOptions(), ...overrides }
|
|
85
|
+
return { options, errors: [] }
|
|
86
|
+
}
|
|
85
87
|
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
// Our config parser host
|
|
89
|
+
const host: ts.ParseConfigHost = {
|
|
90
|
+
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
|
|
91
|
+
readDirectory(rootDir, extensions, excludes, includes, depth): readonly string[] {
|
|
92
|
+
return ts.sys.readDirectory(rootDir, extensions, excludes, includes, depth)
|
|
93
|
+
},
|
|
94
|
+
fileExists(path: string): boolean {
|
|
95
|
+
return ts.sys.fileExists(path)
|
|
96
|
+
},
|
|
97
|
+
readFile(path: string): string | undefined {
|
|
98
|
+
return ts.sys.readFile(path)
|
|
99
|
+
},
|
|
89
100
|
}
|
|
90
101
|
|
|
91
|
-
//
|
|
92
|
-
return
|
|
102
|
+
// The "readJsonConfigFile" / "parseJsonSourceFileConfigFileContent" migth
|
|
103
|
+
// be better here, but "readJsonConfigFile" doesn't return any errors in
|
|
104
|
+
// case a file doesn't exist, and "parseJsonSourceFileConfigFileContent"
|
|
105
|
+
// then fails miserably as it can't really find anything in the source
|
|
106
|
+
const { config, error } = ts.readConfigFile(file, ts.sys.readFile)
|
|
107
|
+
if (error) return { options: {}, errors: [ error ] }
|
|
108
|
+
|
|
109
|
+
// Inputs will be discarded, but are needed by "parseJsonConfigFileConent"
|
|
110
|
+
// otherwise it'll complain that we have no inputs in the "tsconfig.json"
|
|
111
|
+
config.include = inputs
|
|
112
|
+
|
|
113
|
+
return ts.parseJsonConfigFileContent(
|
|
114
|
+
config, // the parsed JSON
|
|
115
|
+
host, // our config parser host
|
|
116
|
+
getAbsoluteParent(file), // directory for path resolution
|
|
117
|
+
overrides, // overrides (from the TSC plug config)
|
|
118
|
+
file, // the file name for path resolution
|
|
119
|
+
)
|
|
93
120
|
}
|
package/src/report.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import ts from 'typescript' // TypeScript does NOT support ESM modules
|
|
2
1
|
import { ERROR, NOTICE, WARN } from '@plugjs/plug/logging'
|
|
3
2
|
import { resolveAbsolutePath } from '@plugjs/plug/paths'
|
|
3
|
+
import ts from 'typescript'
|
|
4
4
|
|
|
5
5
|
import type { Report, ReportLevel, ReportRecord } from '@plugjs/plug/logging'
|
|
6
6
|
import type { AbsolutePath } from '@plugjs/plug/paths'
|
package/src/typescript.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Reference ourselves, so that the constructor's parameters are correct
|
|
2
2
|
/// <reference path="./index.ts"/>
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import { assertPromises, BuildFailure } from '@plugjs/plug/asserts'
|
|
4
|
+
import { assert, assertPromises, BuildFailure } from '@plugjs/plug/asserts'
|
|
6
5
|
import { Files } from '@plugjs/plug/files'
|
|
7
6
|
import { $p } from '@plugjs/plug/logging'
|
|
8
|
-
import { resolveAbsolutePath, resolveFile } from '@plugjs/plug/paths'
|
|
7
|
+
import { commonPath, getAbsoluteParent, resolveAbsolutePath, resolveFile } from '@plugjs/plug/paths'
|
|
9
8
|
import { parseOptions, walk } from '@plugjs/plug/utils'
|
|
9
|
+
import ts from 'typescript'
|
|
10
10
|
|
|
11
11
|
import { TypeScriptHost } from './compiler'
|
|
12
12
|
import { getCompilerOptions } from './options'
|
|
@@ -21,6 +21,16 @@ import type { ExtendedCompilerOptions } from './index'
|
|
|
21
21
|
* WORKER PLUG *
|
|
22
22
|
* ========================================================================== */
|
|
23
23
|
|
|
24
|
+
function defaultRootDir(paths: AbsolutePath[]): AbsolutePath {
|
|
25
|
+
const [ firstPath, ...restPaths ] = paths.filter((path) => {
|
|
26
|
+
return ! path.match(/\.d\.[mc]?ts$/i)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
assert(firstPath, 'No non-declaration files found to compile')
|
|
30
|
+
if (restPaths.length) return commonPath(firstPath, ...restPaths)
|
|
31
|
+
return getAbsoluteParent(firstPath)
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
export class Tsc implements Plug<Files> {
|
|
25
35
|
private readonly _tsconfig?: string
|
|
26
36
|
private readonly _options: ExtendedCompilerOptions
|
|
@@ -32,9 +42,23 @@ export class Tsc implements Plug<Files> {
|
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
async pipe(files: Files, context: Context): Promise<Files> {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
const paths = [ ...files.absolutePaths() ]
|
|
46
|
+
|
|
47
|
+
/* Start preparing the report that will be used throughout */
|
|
48
|
+
const report = context.log.report('TypeScript Report')
|
|
49
|
+
|
|
50
|
+
/* Clone our options and add extra types to our sources */
|
|
51
|
+
const { extraTypesDir, ...__overrides } = { ...this._options }
|
|
52
|
+
|
|
53
|
+
if (extraTypesDir) {
|
|
54
|
+
const directory = context.resolve(extraTypesDir)
|
|
55
|
+
|
|
56
|
+
for await (const file of walk(directory, [ '**/*.d.ts' ])) {
|
|
57
|
+
const path = resolveAbsolutePath(directory, file)
|
|
58
|
+
context.log.debug(`Including extra type file "${$p(path)}"`)
|
|
59
|
+
paths.push(path)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
38
62
|
|
|
39
63
|
/*
|
|
40
64
|
* The "tsconfig" file is either specified, or (if existing) first checked
|
|
@@ -45,44 +69,41 @@ export class Tsc implements Plug<Files> {
|
|
|
45
69
|
sourcesConfig || resolveFile(context.resolve('tsconfig.json'))
|
|
46
70
|
|
|
47
71
|
/* Root directory must always exist */
|
|
48
|
-
let rootDir: AbsolutePath
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
} else {
|
|
52
|
-
rootDir = overrides.rootDir = files.directory
|
|
72
|
+
// let rootDir: AbsolutePath
|
|
73
|
+
if (__overrides.rootDir) {
|
|
74
|
+
__overrides.rootDir = context.resolve(__overrides.rootDir)
|
|
53
75
|
}
|
|
54
76
|
|
|
55
77
|
/* Output directory _also_ must always exist */
|
|
56
|
-
let outDir: AbsolutePath
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
} else {
|
|
60
|
-
outDir = overrides.outDir = rootDir // default to the root directory
|
|
78
|
+
// let outDir: AbsolutePath
|
|
79
|
+
if (__overrides.outDir) {
|
|
80
|
+
__overrides.outDir = context.resolve(__overrides.outDir)
|
|
61
81
|
}
|
|
62
82
|
|
|
63
83
|
/* All other root paths */
|
|
64
|
-
if (
|
|
65
|
-
|
|
84
|
+
if (__overrides.rootDirs) {
|
|
85
|
+
__overrides.rootDirs = __overrides.rootDirs.map((dir) => context.resolve(dir))
|
|
66
86
|
}
|
|
67
87
|
|
|
68
88
|
/* The baseURL is resolved, as well */
|
|
69
|
-
if (
|
|
89
|
+
if (__overrides.baseUrl) __overrides.baseUrl = context.resolve(__overrides.baseUrl)
|
|
70
90
|
|
|
71
91
|
/* The baseURL is resolved, as well */
|
|
72
|
-
if (
|
|
92
|
+
if (__overrides.outFile) __overrides.outFile = context.resolve(__overrides.outFile)
|
|
73
93
|
|
|
74
94
|
/* We can now get our compiler options, and check any and all overrides */
|
|
75
95
|
const { errors, options } = await getCompilerOptions(
|
|
76
96
|
tsconfig, // resolved tsconfig.json from constructor, might be undefined
|
|
77
|
-
|
|
97
|
+
__overrides,
|
|
98
|
+
paths,
|
|
99
|
+
) // overrides from constructor, might be an empty object
|
|
78
100
|
|
|
79
101
|
/* Update report and fail on errors */
|
|
80
|
-
updateReport(report, errors,
|
|
102
|
+
updateReport(report, errors, context.resolve('.'))
|
|
81
103
|
if (report.errors) report.done(true)
|
|
82
104
|
|
|
83
105
|
/* Prep for compilation */
|
|
84
|
-
const
|
|
85
|
-
for (const path of paths) context.log.trace(`Compiling "${$p(path)}"`)
|
|
106
|
+
for (const path of paths) context.log.debug(`Compiling "${$p(path)}"`)
|
|
86
107
|
context.log.info('Compiling', paths.length, 'files')
|
|
87
108
|
|
|
88
109
|
/* If we have an extra types directory, add all the .d.ts files in there */
|
|
@@ -96,8 +117,18 @@ export class Tsc implements Plug<Files> {
|
|
|
96
117
|
}
|
|
97
118
|
}
|
|
98
119
|
|
|
120
|
+
/* Figure out the root directory, either from the options, or default */
|
|
121
|
+
const rootDir = options.rootDir ?
|
|
122
|
+
context.resolve(options.rootDir) :
|
|
123
|
+
defaultRootDir(paths)
|
|
124
|
+
if (!(options.rootDir || options.rootDirs)) options.rootDir = rootDir
|
|
125
|
+
|
|
126
|
+
/* Figure out the output directory, either from the options or same as root */
|
|
127
|
+
const outDir = options.outDir ? context.resolve(options.outDir) : rootDir
|
|
128
|
+
if (!(options.outDir || options.outFile)) options.outDir = outDir
|
|
129
|
+
|
|
99
130
|
/* Log out what we'll be our final compilation options */
|
|
100
|
-
context.log.
|
|
131
|
+
context.log.info('Compliation options', options)
|
|
101
132
|
|
|
102
133
|
/* Typescript host, create program and compile */
|
|
103
134
|
const host = new TypeScriptHost(rootDir)
|