@nrwl/js 13.4.0-beta.1 → 13.4.1-beta.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/executors.json +20 -0
- package/generators.json +14 -0
- package/package.json +10 -6
- package/src/executors/node/compat.d.ts +2 -0
- package/src/executors/node/compat.js +6 -0
- package/src/executors/node/compat.js.map +1 -0
- package/src/executors/node/node-with-require-overrides.d.ts +5 -0
- package/src/executors/node/node-with-require-overrides.js +20 -0
- package/src/executors/node/node-with-require-overrides.js.map +1 -0
- package/src/executors/node/node.impl.d.ts +5 -0
- package/src/executors/node/node.impl.js +141 -0
- package/src/executors/node/node.impl.js.map +1 -0
- package/src/executors/node/schema.d.ts +16 -0
- package/src/executors/node/schema.json +67 -0
- package/src/executors/swc/compat.d.ts +2 -0
- package/src/executors/swc/compat.js +6 -0
- package/src/executors/swc/compat.js.map +1 -0
- package/src/executors/swc/schema.d.ts +10 -0
- package/src/executors/swc/schema.json +75 -0
- package/src/executors/swc/swc.impl.d.ts +5 -0
- package/src/executors/swc/swc.impl.js +50 -0
- package/src/executors/swc/swc.impl.js.map +1 -0
- package/src/executors/tsc/schema.json +34 -1
- package/src/executors/tsc/tsc.impl.d.ts +3 -4
- package/src/executors/tsc/tsc.impl.js +35 -50
- package/src/executors/tsc/tsc.impl.js.map +1 -1
- package/src/generators/application/application.d.ts +3 -3
- package/src/generators/application/application.js.map +1 -1
- package/src/generators/convert-to-swc/convert-to-swc.d.ts +5 -0
- package/src/generators/convert-to-swc/convert-to-swc.js +54 -0
- package/src/generators/convert-to-swc/convert-to-swc.js.map +1 -0
- package/src/generators/convert-to-swc/schema.d.ts +4 -0
- package/src/generators/convert-to-swc/schema.json +35 -0
- package/src/generators/library/library.d.ts +3 -3
- package/src/generators/library/library.js.map +1 -1
- package/src/generators/library/schema.json +6 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -1
- package/src/utils/check-dependencies.d.ts +5 -0
- package/src/utils/check-dependencies.js +32 -0
- package/src/utils/check-dependencies.js.map +1 -0
- package/src/utils/normalize-ts-compilation-options.d.ts +2 -0
- package/src/utils/normalize-ts-compilation-options.js +9 -0
- package/src/utils/normalize-ts-compilation-options.js.map +1 -0
- package/src/utils/project-generator.d.ts +3 -3
- package/src/utils/project-generator.js +30 -16
- package/src/utils/project-generator.js.map +1 -1
- package/src/utils/schema.d.ts +42 -2
- package/src/utils/swc/add-swc-config.d.ts +2 -0
- package/src/utils/swc/add-swc-config.js +36 -0
- package/src/utils/swc/add-swc-config.js.map +1 -0
- package/src/utils/swc/add-swc-dependencies.d.ts +2 -0
- package/src/utils/swc/add-swc-dependencies.js +14 -0
- package/src/utils/swc/add-swc-dependencies.js.map +1 -0
- package/src/utils/swc/compile-swc.d.ts +6 -0
- package/src/utils/swc/compile-swc.js +128 -0
- package/src/utils/swc/compile-swc.js.map +1 -0
- package/src/utils/typescript/__mocks__/plugin-a.d.ts +1 -0
- package/src/utils/typescript/__mocks__/plugin-a.js +6 -0
- package/src/utils/typescript/__mocks__/plugin-a.js.map +1 -0
- package/src/utils/typescript/__mocks__/plugin-b.d.ts +1 -0
- package/src/utils/typescript/__mocks__/plugin-b.js +6 -0
- package/src/utils/typescript/__mocks__/plugin-b.js.map +1 -0
- package/src/utils/typescript/compile-typescript-files.d.ts +4 -0
- package/src/utils/typescript/compile-typescript-files.js +59 -0
- package/src/utils/typescript/compile-typescript-files.js.map +1 -0
- package/src/utils/typescript/load-ts-plugins.d.ts +5 -0
- package/src/utils/typescript/load-ts-plugins.js +63 -0
- package/src/utils/typescript/load-ts-plugins.js.map +1 -0
- package/src/utils/typescript/print-diagnostics.d.ts +1 -2
- package/src/utils/typescript/print-diagnostics.js +7 -7
- package/src/utils/typescript/print-diagnostics.js.map +1 -1
- package/src/utils/typescript/run-type-check.d.ts +8 -3
- package/src/utils/typescript/run-type-check.js +90 -58
- package/src/utils/typescript/run-type-check.js.map +1 -1
- package/src/utils/typescript/types.d.ts +18 -0
- package/src/utils/typescript/types.js +3 -0
- package/src/utils/typescript/types.js.map +1 -0
- package/src/utils/update-package-json.d.ts +1 -0
- package/src/utils/update-package-json.js +30 -0
- package/src/utils/update-package-json.js.map +1 -0
- package/src/utils/versions.d.ts +2 -0
- package/src/utils/versions.js +4 -2
- package/src/utils/versions.js.map +1 -1
- package/src/executors/tsc/schema.d.ts +0 -6
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addSwcDependencies = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const versions_1 = require("../versions");
|
|
6
|
+
function addSwcDependencies(tree) {
|
|
7
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
8
|
+
'@swc/core': versions_1.swcCoreVersion,
|
|
9
|
+
'@swc/helpers': versions_1.swcHelpersVersion,
|
|
10
|
+
'@swc/cli': versions_1.swcCliVersion,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.addSwcDependencies = addSwcDependencies;
|
|
14
|
+
//# sourceMappingURL=add-swc-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-swc-dependencies.js","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/swc/add-swc-dependencies.ts"],"names":[],"mappings":";;;AAAA,yCAAkE;AAClE,0CAA+E;AAE/E,SAAgB,kBAAkB,CAAC,IAAU;IAC3C,IAAA,qCAA4B,EAC1B,IAAI,EACJ,EAAE,EACF;QACE,WAAW,EAAE,yBAAc;QAC3B,cAAc,EAAE,4BAAiB;QACjC,UAAU,EAAE,wBAAa;KAC1B,CACF,CAAC;AACJ,CAAC;AAVD,gDAUC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { NormalizedSwcExecutorOptions } from '../schema';
|
|
4
|
+
export declare function compileSwc(context: ExecutorContext, normalizedOptions: NormalizedSwcExecutorOptions, postCompilationCallback: () => Promise<void>): Observable<{
|
|
5
|
+
success: any;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileSwc = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const rxjs_1 = require("rxjs");
|
|
7
|
+
const operators_1 = require("rxjs/operators");
|
|
8
|
+
const normalize_ts_compilation_options_1 = require("../normalize-ts-compilation-options");
|
|
9
|
+
const print_diagnostics_1 = require("../typescript/print-diagnostics");
|
|
10
|
+
const run_type_check_1 = require("../typescript/run-type-check");
|
|
11
|
+
function compileSwc(context, normalizedOptions, postCompilationCallback) {
|
|
12
|
+
const tsOptions = {
|
|
13
|
+
outputPath: normalizedOptions.outputPath,
|
|
14
|
+
projectName: context.projectName,
|
|
15
|
+
projectRoot: normalizedOptions.projectRoot,
|
|
16
|
+
tsConfig: normalizedOptions.tsConfig,
|
|
17
|
+
watch: normalizedOptions.watch,
|
|
18
|
+
};
|
|
19
|
+
const outDir = tsOptions.outputPath.replace(`/${tsOptions.projectRoot}`, '');
|
|
20
|
+
const normalizedTsOptions = (0, normalize_ts_compilation_options_1.normalizeTsCompilationOptions)(tsOptions);
|
|
21
|
+
devkit_1.logger.log(`Compiling with SWC for ${normalizedTsOptions.projectName}...`);
|
|
22
|
+
const srcPath = normalizedTsOptions.projectRoot;
|
|
23
|
+
const destPath = normalizedTsOptions.outputPath.replace(`/${normalizedTsOptions.projectName}`, '');
|
|
24
|
+
let swcCmd = `npx swc ${srcPath} -d ${destPath} --source-maps --config-file=${normalizedOptions.swcrcPath}`;
|
|
25
|
+
const postCompilationOperator = () => (0, operators_1.concatMap)(({ success }) => {
|
|
26
|
+
if (success) {
|
|
27
|
+
return postCompilationCallback().then(() => ({ success }));
|
|
28
|
+
}
|
|
29
|
+
return rxjs_1.EMPTY;
|
|
30
|
+
});
|
|
31
|
+
const compile$ = new rxjs_1.Observable((subscriber) => {
|
|
32
|
+
if (normalizedOptions.watch) {
|
|
33
|
+
swcCmd += ' --watch';
|
|
34
|
+
const watchProcess = createSwcWatchProcess(swcCmd, (success) => {
|
|
35
|
+
subscriber.next({ success });
|
|
36
|
+
});
|
|
37
|
+
return () => {
|
|
38
|
+
watchProcess.close();
|
|
39
|
+
subscriber.complete();
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const swcCmdLog = (0, child_process_1.execSync)(swcCmd).toString();
|
|
43
|
+
devkit_1.logger.log(swcCmdLog.replace(/\n/, ''));
|
|
44
|
+
subscriber.next({ success: swcCmdLog.includes('Successfully compiled') });
|
|
45
|
+
return () => {
|
|
46
|
+
subscriber.complete();
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
if (normalizedOptions.skipTypeCheck) {
|
|
50
|
+
return compile$.pipe(postCompilationOperator());
|
|
51
|
+
}
|
|
52
|
+
const typeCheck$ = new rxjs_1.Observable((subscriber) => {
|
|
53
|
+
const typeCheckOptions = {
|
|
54
|
+
mode: 'emitDeclarationOnly',
|
|
55
|
+
tsConfigPath: tsOptions.tsConfig,
|
|
56
|
+
outDir,
|
|
57
|
+
workspaceRoot: normalizedOptions.root,
|
|
58
|
+
};
|
|
59
|
+
if (normalizedOptions.watch) {
|
|
60
|
+
let typeCheckRunner;
|
|
61
|
+
let preEmit = false;
|
|
62
|
+
(0, run_type_check_1.runTypeCheckWatch)(typeCheckOptions, (diagnostic, formattedDiagnostic, errorCount) => {
|
|
63
|
+
// 6031 and 6032 are to skip watchCompilerHost initialization (Start watching for changes... message)
|
|
64
|
+
// We also skip if preEmit has been set to true, because it means that the first type check before
|
|
65
|
+
// the WatchCompiler emits.
|
|
66
|
+
if (preEmit && diagnostic.code !== 6031 && diagnostic.code !== 6032) {
|
|
67
|
+
const hasErrors = errorCount > 0;
|
|
68
|
+
if (hasErrors) {
|
|
69
|
+
void (0, print_diagnostics_1.printDiagnostics)([formattedDiagnostic]);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
void (0, print_diagnostics_1.printDiagnostics)([], [formattedDiagnostic]);
|
|
73
|
+
}
|
|
74
|
+
subscriber.next({ success: !hasErrors });
|
|
75
|
+
}
|
|
76
|
+
}).then(({ close, preEmitErrors, preEmitWarnings }) => {
|
|
77
|
+
const hasErrors = preEmitErrors.length > 0;
|
|
78
|
+
if (hasErrors) {
|
|
79
|
+
void (0, print_diagnostics_1.printDiagnostics)(preEmitErrors, preEmitWarnings);
|
|
80
|
+
}
|
|
81
|
+
typeCheckRunner = { close };
|
|
82
|
+
subscriber.next({ success: !hasErrors });
|
|
83
|
+
preEmit = true;
|
|
84
|
+
});
|
|
85
|
+
return () => {
|
|
86
|
+
if (typeCheckRunner) {
|
|
87
|
+
typeCheckRunner.close();
|
|
88
|
+
}
|
|
89
|
+
subscriber.complete();
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
(0, run_type_check_1.runTypeCheck)(typeCheckOptions).then(({ errors, warnings }) => {
|
|
93
|
+
const hasErrors = errors.length > 0;
|
|
94
|
+
if (hasErrors) {
|
|
95
|
+
void (0, print_diagnostics_1.printDiagnostics)(errors, warnings);
|
|
96
|
+
}
|
|
97
|
+
subscriber.next({ success: !hasErrors });
|
|
98
|
+
subscriber.complete();
|
|
99
|
+
});
|
|
100
|
+
return () => {
|
|
101
|
+
subscriber.complete();
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
return (0, rxjs_1.zip)(compile$, typeCheck$).pipe((0, operators_1.map)(([compileResult, typeCheckResult]) => ({
|
|
105
|
+
success: compileResult.success && typeCheckResult.success,
|
|
106
|
+
})), postCompilationOperator());
|
|
107
|
+
}
|
|
108
|
+
exports.compileSwc = compileSwc;
|
|
109
|
+
function createSwcWatchProcess(swcCmd, callback) {
|
|
110
|
+
const watchProcess = (0, child_process_1.exec)(swcCmd);
|
|
111
|
+
watchProcess.stdout.on('data', (data) => {
|
|
112
|
+
process.stdout.write(data);
|
|
113
|
+
callback(data.includes('Successfully compiled'));
|
|
114
|
+
});
|
|
115
|
+
watchProcess.stderr.on('data', (err) => {
|
|
116
|
+
process.stderr.write(err);
|
|
117
|
+
callback(false);
|
|
118
|
+
});
|
|
119
|
+
const processExitListener = () => watchProcess.kill();
|
|
120
|
+
process.on('SIGINT', processExitListener);
|
|
121
|
+
process.on('SIGTERM', processExitListener);
|
|
122
|
+
process.on('exit', processExitListener);
|
|
123
|
+
watchProcess.on('exit', () => {
|
|
124
|
+
callback(true);
|
|
125
|
+
});
|
|
126
|
+
return { close: () => watchProcess.kill() };
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=compile-swc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-swc.js","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/swc/compile-swc.ts"],"names":[],"mappings":";;;AAAA,yCAAuD;AACvD,iDAA+C;AAC/C,+BAA8C;AAC9C,8CAAqD;AACrD,0FAAoF;AAEpF,uEAAmE;AACnE,iEAIsC;AAEtC,SAAgB,UAAU,CACxB,OAAwB,EACxB,iBAA+C,EAC/C,uBAA4C;IAE5C,MAAM,SAAS,GAAG;QAChB,UAAU,EAAE,iBAAiB,CAAC,UAAU;QACxC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,iBAAiB,CAAC,WAAW;QAC1C,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;QACpC,KAAK,EAAE,iBAAiB,CAAC,KAAK;KAC/B,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;IAE7E,MAAM,mBAAmB,GAAG,IAAA,gEAA6B,EAAC,SAAS,C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ugin-a.js","sourceRoot":"","sources":["../../../../../../../packages/js/src/utils/typescript/__mocks__/plugin-a.ts"],"names":[],"mappings":";;;AAAO,MAAM,MAAM,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAAlB,QAAA,MAAM,UAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const after: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-b.js","sourceRoot":"","sources":["../../../../../../../packages/js/src/utils/typescript/__mocks__/plugin-b.ts"],"names":[],"mappings":";;;AAAO,MAAM,KAAK,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAAjB,QAAA,KAAK,SAAY"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { NormalizedExecutorOptions } from '../schema';
|
|
4
|
+
export declare function compileTypeScriptFiles(options: NormalizedExecutorOptions, context: ExecutorContext, postCompleteAction: () => void | Promise<void>): Observable<unknown>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileTypeScriptFiles = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const compilation_1 = require("@nrwl/workspace/src/utilities/typescript/compilation");
|
|
6
|
+
const rxjs_1 = require("rxjs");
|
|
7
|
+
const load_ts_plugins_1 = require("./load-ts-plugins");
|
|
8
|
+
function compileTypeScriptFiles(options, context, postCompleteAction) {
|
|
9
|
+
const { compilerPluginHooks } = (0, load_ts_plugins_1.loadTsPlugins)(options.transformers);
|
|
10
|
+
const getCustomTransformers = (program) => ({
|
|
11
|
+
before: compilerPluginHooks.beforeHooks.map((hook) => hook(program)),
|
|
12
|
+
after: compilerPluginHooks.afterHooks.map((hook) => hook(program)),
|
|
13
|
+
afterDeclarations: compilerPluginHooks.afterDeclarationsHooks.map((hook) => hook(program)),
|
|
14
|
+
});
|
|
15
|
+
// const tcsOptions = {
|
|
16
|
+
// outputPath: options.normalizedOutputPath,
|
|
17
|
+
// projectName: context.projectName,
|
|
18
|
+
// projectRoot: libRoot,
|
|
19
|
+
// tsConfig: tsConfigPath,
|
|
20
|
+
// deleteOutputPath: options.deleteOutputPath,
|
|
21
|
+
// rootDir: options.srcRootForCompilationRoot,
|
|
22
|
+
// watch: options.watch,
|
|
23
|
+
// getCustomTransformers,
|
|
24
|
+
// };
|
|
25
|
+
const tscOptions = {
|
|
26
|
+
outputPath: options.outputPath,
|
|
27
|
+
projectName: context.projectName,
|
|
28
|
+
projectRoot: options.projectRoot,
|
|
29
|
+
tsConfig: options.tsConfig,
|
|
30
|
+
// deleteOutputPath: options.deleteOutputPath,
|
|
31
|
+
// rootDir: options.srcRootForCompilationRoot,
|
|
32
|
+
watch: options.watch,
|
|
33
|
+
getCustomTransformers,
|
|
34
|
+
};
|
|
35
|
+
return new rxjs_1.Observable((subscriber) => {
|
|
36
|
+
if (options.watch) {
|
|
37
|
+
const watcher = (0, compilation_1.compileTypeScriptWatcher)(tscOptions, (d) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
38
|
+
if (d.code === 6194) {
|
|
39
|
+
yield postCompleteAction();
|
|
40
|
+
subscriber.next({ success: true });
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
return () => {
|
|
44
|
+
watcher.close();
|
|
45
|
+
subscriber.complete();
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const result = (0, compilation_1.compileTypeScript)(tscOptions);
|
|
49
|
+
postCompleteAction().then(() => {
|
|
50
|
+
subscriber.next(result);
|
|
51
|
+
subscriber.complete();
|
|
52
|
+
});
|
|
53
|
+
return () => {
|
|
54
|
+
subscriber.complete();
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.compileTypeScriptFiles = compileTypeScriptFiles;
|
|
59
|
+
//# sourceMappingURL=compile-typescript-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-typescript-files.js","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/typescript/compile-typescript-files.ts"],"names":[],"mappings":";;;;AACA,sFAG8D;AAC9D,+BAAkC;AASlC,uDAAkD;AAElD,SAAgB,sBAAsB,CACpC,OAAkC,EAClC,OAAwB,EACxB,kBAA8C;IAE9C,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAA,+BAAa,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAEpE,MAAM,qBAAqB,GAAG,CAAC,OAAgB,EAAsB,EAAE,CAAC,CAAC;QACvE,MAAM,EAAE,mBAAmB,CAAC,WAAW,CAAC,GAAG,CACzC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAmC,CAC1D;QACD,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAAG,CACvC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAmC,CAC1D;QACD,iBAAiB,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,GAAG,CAC/D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAmC,CAC1D;KACF,CAAC,CAAC;IAEH,uBAAuB;IACvB,8CAA8C;IAC9C,sCAAsC;IACtC,0BAA0B;IAC1B,4BAA4B;IAC5B,gDAAgD;IAChD,gDAAgD;IAChD,0BAA0B;IAC1B,2BAA2B;IAC3B,KAAK;IAEL,MAAM,UAAU,GAAG;QACjB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,8CAA8C;QAC9C,8CAA8C;QAC9C,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,qBAAqB;KACtB,CAAC;IAEF,OAAO,IAAI,iBAAU,CAAC,CAAC,UAAU,EAAE,EAAE;QACnC,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,MAAM,OAAO,GAAG,IAAA,sCAAwB,EACtC,UAAU,EACV,CAAO,CAAa,EAAE,EAAE;gBACtB,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE;oBACnB,MAAM,kBAAkB,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;iBACpC;YACH,CAAC,CAAA,CACF,CAAC;YAEF,OAAO,GAAG,EAAE;gBACV,OAAO,CAAC,KAAK,EAAE,CAAC;gBAChB,UAAU,CAAC,QAAQ,EAAE,CAAC;YACxB,CAAC,CAAC;SACH;QAED,MAAM,MAAM,GAAG,IAAA,+BAAiB,EAAC,UAAU,CAAC,CAAC;QAC5C,kBAAkB,EAAoB,CAAC,IAAI,CAAC,GAAG,EAAE;YAChD,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACxB,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AArED,wDAqEC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadTsPlugins = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function loadTsPlugins(plugins, moduleResolver = require.resolve) {
|
|
7
|
+
const beforeHooks = [];
|
|
8
|
+
const afterHooks = [];
|
|
9
|
+
const afterDeclarationsHooks = [];
|
|
10
|
+
if (!plugins || !plugins.length)
|
|
11
|
+
return {
|
|
12
|
+
compilerPluginHooks: {
|
|
13
|
+
beforeHooks,
|
|
14
|
+
afterHooks,
|
|
15
|
+
afterDeclarationsHooks,
|
|
16
|
+
},
|
|
17
|
+
hasPlugin: false,
|
|
18
|
+
};
|
|
19
|
+
const normalizedPlugins = plugins.map((plugin) => typeof plugin === 'string' ? { name: plugin, options: {} } : plugin);
|
|
20
|
+
const nodeModulePaths = [
|
|
21
|
+
(0, path_1.join)(process.cwd(), 'node_modules'),
|
|
22
|
+
...module.paths,
|
|
23
|
+
];
|
|
24
|
+
const pluginRefs = normalizedPlugins.map(({ name }) => {
|
|
25
|
+
try {
|
|
26
|
+
const binaryPath = moduleResolver(name, {
|
|
27
|
+
paths: nodeModulePaths,
|
|
28
|
+
});
|
|
29
|
+
return require(binaryPath);
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
devkit_1.logger.warn(`"${name}" plugin could not be found!`);
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
for (let i = 0; i < pluginRefs.length; i++) {
|
|
37
|
+
const { name: pluginName, options: pluginOptions } = normalizedPlugins[i];
|
|
38
|
+
const { before, after, afterDeclarations } = pluginRefs[i];
|
|
39
|
+
if (!before && !after && !afterDeclarations) {
|
|
40
|
+
devkit_1.logger.warn(`${pluginName} is not a Transformer Plugin. It does not provide neither before(), after(), nor afterDeclarations()`);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (before) {
|
|
44
|
+
beforeHooks.push(before.bind(before, pluginOptions));
|
|
45
|
+
}
|
|
46
|
+
if (after) {
|
|
47
|
+
afterHooks.push(after.bind(after, pluginOptions));
|
|
48
|
+
}
|
|
49
|
+
if (afterDeclarations) {
|
|
50
|
+
afterDeclarationsHooks.push(afterDeclarations.bind(afterDeclarations, pluginOptions));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
compilerPluginHooks: {
|
|
55
|
+
beforeHooks,
|
|
56
|
+
afterHooks,
|
|
57
|
+
afterDeclarationsHooks,
|
|
58
|
+
},
|
|
59
|
+
hasPlugin: true,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
exports.loadTsPlugins = loadTsPlugins;
|
|
63
|
+
//# sourceMappingURL=load-ts-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-ts-plugins.js","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/typescript/load-ts-plugins.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,+BAA4B;AAQ5B,SAAgB,aAAa,CAC3B,OAA2B,EAC3B,iBAAyC,OAAO,CAAC,OAAO;IAKxD,MAAM,WAAW,GAAuC,EAAE,CAAC;IAC3D,MAAM,UAAU,GAAsC,EAAE,CAAC;IACzD,MAAM,sBAAsB,GAC1B,EAAE,CAAC;IAEL,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM;QAC7B,OAAO;YACL,mBAAmB,EAAE;gBACnB,WAAW;gBACX,UAAU;gBACV,sBAAsB;aACvB;YACD,SAAS,EAAE,KAAK;SACjB,CAAC;IAEJ,MAAM,iBAAiB,GAAwB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACpE,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CACpE,CAAC;IAEF,MAAM,eAAe,GAAG;QACtB,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC;QACnC,GAAG,MAAM,CAAC,KAAK;KAChB,CAAC;IAEF,MAAM,UAAU,GAAqB,iBAAiB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;QACtE,IAAI;YACF,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,EAAE;gBACtC,KAAK,EAAE,eAAe;aACvB,CAAC,CAAC;YACH,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;SAC5B;QAAC,OAAO,CAAC,EAAE;YACV,eAAM,CAAC,IAAI,CAAC,IAAI,IAAI,8BAA8B,CAAC,CAAC;YACpD,OAAO,EAAE,CAAC;SACX;IACH,CAAC,CAAC,CAAC;IAEH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC1E,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,IAAI,CAAC,iBAAiB,EAAE;YAC3C,eAAM,CAAC,IAAI,CACT,GAAG,UAAU,sGAAsG,CACpH,CAAC;YACF,SAAS;SACV;QAED,IAAI,MAAM,EAAE;YACV,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;SACtD;QAED,IAAI,KAAK,EAAE;YACT,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;SACnD;QAED,IAAI,iBAAiB,EAAE;YACrB,sBAAsB,CAAC,IAAI,CACzB,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CACzD,CAAC;SACH;KACF;IAED,OAAO;QACL,mBAAmB,EAAE;YACnB,WAAW;YACX,UAAU;YACV,sBAAsB;SACvB;QACD,SAAS,EAAE,IAAI;KAChB,CAAC;AACJ,CAAC;AA5ED,sCA4EC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function printDiagnostics(result: TypeCheckResult): Promise<void>;
|
|
1
|
+
export declare function printDiagnostics(errors?: string[], warnings?: string[]): Promise<void>;
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.printDiagnostics = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
function printDiagnostics(
|
|
5
|
+
function printDiagnostics(errors = [], warnings = []) {
|
|
6
6
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
7
|
-
if (
|
|
8
|
-
|
|
7
|
+
if (errors.length > 0) {
|
|
8
|
+
errors.forEach((err) => {
|
|
9
9
|
console.log(`${err}\n`);
|
|
10
10
|
});
|
|
11
|
-
console.log(`Found ${
|
|
11
|
+
console.log(`Found ${errors.length} error${errors.length > 1 ? 's' : ''}.`);
|
|
12
12
|
}
|
|
13
|
-
else if (
|
|
14
|
-
|
|
13
|
+
else if (warnings.length > 0) {
|
|
14
|
+
warnings.forEach((err) => {
|
|
15
15
|
console.log(`${err}\n`);
|
|
16
16
|
});
|
|
17
|
-
console.log(`Found ${
|
|
17
|
+
console.log(`Found ${warnings.length} warnings.`);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print-diagnostics.js","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/typescript/print-diagnostics.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"print-diagnostics.js","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/typescript/print-diagnostics.ts"],"names":[],"mappings":";;;;AAAA,SAAsB,gBAAgB,CACpC,SAAmB,EAAE,EACrB,WAAqB,EAAE;;QAEvB,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACrB,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACrB,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC7E;aAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9B,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACvB,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,SAAS,QAAQ,CAAC,MAAM,YAAY,CAAC,CAAC;SACnD;IACH,CAAC;CAAA;AAjBD,4CAiBC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Diagnostic } from 'typescript';
|
|
1
2
|
export interface TypeCheckResult {
|
|
2
3
|
warnings?: string[];
|
|
3
4
|
errors?: string[];
|
|
@@ -5,9 +6,8 @@ export interface TypeCheckResult {
|
|
|
5
6
|
totalFilesCount: number;
|
|
6
7
|
incremental: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare type TypeCheckOptions = BaseTypeCheckOptions & Mode;
|
|
9
|
+
export declare type TypeCheckOptions = BaseTypeCheckOptions & Mode;
|
|
9
10
|
interface BaseTypeCheckOptions {
|
|
10
|
-
ts: typeof import('typescript');
|
|
11
11
|
workspaceRoot: string;
|
|
12
12
|
tsConfigPath: string;
|
|
13
13
|
cacheDir?: string;
|
|
@@ -20,6 +20,11 @@ interface EmitDeclarationOnlyMode {
|
|
|
20
20
|
mode: 'emitDeclarationOnly';
|
|
21
21
|
outDir: string;
|
|
22
22
|
}
|
|
23
|
+
export declare function runTypeCheckWatch(options: TypeCheckOptions, callback: (diagnostic: Diagnostic, formattedDiagnostic: string, errorCount?: number) => void | Promise<void>): Promise<{
|
|
24
|
+
close: any;
|
|
25
|
+
preEmitErrors: string[];
|
|
26
|
+
preEmitWarnings: string[];
|
|
27
|
+
}>;
|
|
23
28
|
export declare function runTypeCheck(options: TypeCheckOptions): Promise<TypeCheckResult>;
|
|
24
|
-
export declare function getFormattedDiagnostic(ts: typeof import('typescript'), workspaceRoot: string, diagnostic:
|
|
29
|
+
export declare function getFormattedDiagnostic(ts: typeof import('typescript'), workspaceRoot: string, diagnostic: Diagnostic): string;
|
|
25
30
|
export {};
|
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFormattedDiagnostic = exports.runTypeCheck = void 0;
|
|
3
|
+
exports.getFormattedDiagnostic = exports.runTypeCheck = exports.runTypeCheckWatch = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const typescript_1 = require("@nrwl/workspace/src/utilities/typescript");
|
|
6
|
-
const path = require("path");
|
|
7
6
|
const chalk = require("chalk");
|
|
7
|
+
const path = require("path");
|
|
8
8
|
const code_frames_1 = require("../code-frames/code-frames");
|
|
9
|
+
function runTypeCheckWatch(options, callback) {
|
|
10
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
11
|
+
const { ts, workspaceRoot, config, compilerOptions } = yield setupTypeScript(options);
|
|
12
|
+
const host = ts.createWatchCompilerHost(config.fileNames, compilerOptions, ts.sys, ts.createEmitAndSemanticDiagnosticsBuilderProgram);
|
|
13
|
+
const originalOnWatchStatusChange = host.onWatchStatusChange;
|
|
14
|
+
host.onWatchStatusChange = (diagnostic, newLine, opts, errorCount) => {
|
|
15
|
+
originalOnWatchStatusChange === null || originalOnWatchStatusChange === void 0 ? void 0 : originalOnWatchStatusChange(diagnostic, newLine, opts, errorCount);
|
|
16
|
+
callback(diagnostic, getFormattedDiagnostic(ts, workspaceRoot, diagnostic), errorCount);
|
|
17
|
+
};
|
|
18
|
+
const watchProgram = ts.createWatchProgram(host);
|
|
19
|
+
const program = watchProgram.getProgram().getProgram();
|
|
20
|
+
const diagnostics = ts.getPreEmitDiagnostics(program);
|
|
21
|
+
return {
|
|
22
|
+
close: watchProgram.close.bind(watchProgram),
|
|
23
|
+
preEmitErrors: diagnostics
|
|
24
|
+
.filter((d) => d.category === ts.DiagnosticCategory.Error)
|
|
25
|
+
.map((d) => getFormattedDiagnostic(ts, workspaceRoot, d)),
|
|
26
|
+
preEmitWarnings: diagnostics
|
|
27
|
+
.filter((d) => d.category === ts.DiagnosticCategory.Warning)
|
|
28
|
+
.map((d) => getFormattedDiagnostic(ts, workspaceRoot, d)),
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.runTypeCheckWatch = runTypeCheckWatch;
|
|
9
33
|
function runTypeCheck(options) {
|
|
10
34
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
11
|
-
const { ts, workspaceRoot,
|
|
12
|
-
const config = (0, typescript_1.readTsConfig)(tsConfigPath);
|
|
13
|
-
if (config.errors.length) {
|
|
14
|
-
throw new Error(`Invalid config file: ${config.errors}`);
|
|
15
|
-
}
|
|
16
|
-
const emitOptions = options.mode === 'emitDeclarationOnly'
|
|
17
|
-
? { emitDeclarationOnly: true, declaration: true, outDir: options.outDir }
|
|
18
|
-
: { noEmit: true };
|
|
19
|
-
const compilerOptions = Object.assign(Object.assign(Object.assign({}, config.options), { skipLibCheck: true }), emitOptions);
|
|
35
|
+
const { ts, workspaceRoot, cacheDir, config, compilerOptions } = yield setupTypeScript(options);
|
|
20
36
|
let program;
|
|
21
37
|
let incremental = false;
|
|
22
38
|
if (compilerOptions.incremental && cacheDir) {
|
|
@@ -33,59 +49,75 @@ function runTypeCheck(options) {
|
|
|
33
49
|
const allDiagnostics = ts
|
|
34
50
|
.getPreEmitDiagnostics(program)
|
|
35
51
|
.concat(result.diagnostics);
|
|
36
|
-
|
|
37
|
-
.filter((d) => d.category === ts.DiagnosticCategory.Error)
|
|
38
|
-
.map((d) => getFormattedDiagnostic(ts, workspaceRoot, d)));
|
|
39
|
-
const warnings = yield Promise.all(allDiagnostics
|
|
40
|
-
.filter((d) => d.category === ts.DiagnosticCategory.Warning)
|
|
41
|
-
.map((d) => getFormattedDiagnostic(ts, workspaceRoot, d)));
|
|
42
|
-
return {
|
|
43
|
-
warnings,
|
|
44
|
-
errors,
|
|
45
|
-
inputFilesCount: config.fileNames.length,
|
|
46
|
-
totalFilesCount: program.getSourceFiles().length,
|
|
47
|
-
incremental,
|
|
48
|
-
};
|
|
52
|
+
return getTypeCheckResult(ts, allDiagnostics, workspaceRoot, config.fileNames.length, program.getSourceFiles().length, incremental);
|
|
49
53
|
});
|
|
50
54
|
}
|
|
51
55
|
exports.runTypeCheck = runTypeCheck;
|
|
52
|
-
function
|
|
56
|
+
function setupTypeScript(options) {
|
|
53
57
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
message += `${chalk.yellow.bold('warning')} ${chalk.gray(`TS${diagnostic.code}`)}: `;
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
case ts.DiagnosticCategory.Error: {
|
|
63
|
-
message += `${chalk.red.bold('error')} ${chalk.gray(`TS${diagnostic.code}`)}: `;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
case ts.DiagnosticCategory.Suggestion:
|
|
67
|
-
case ts.DiagnosticCategory.Message:
|
|
68
|
-
default: {
|
|
69
|
-
message += `${chalk.cyan.bold(category === 2 ? 'suggestion' : 'info')}: `;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
message += reason + '\n';
|
|
74
|
-
if (diagnostic.file) {
|
|
75
|
-
const pos = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
76
|
-
const line = pos.line + 1;
|
|
77
|
-
const column = pos.character + 1;
|
|
78
|
-
const fileName = path.relative(workspaceRoot, diagnostic.file.fileName);
|
|
79
|
-
message =
|
|
80
|
-
`${chalk.underline.blue(`${fileName}:${line}:${column}`)} - ` + message;
|
|
81
|
-
message +=
|
|
82
|
-
'\n' +
|
|
83
|
-
(0, code_frames_1.codeFrameColumns)(diagnostic.file.getFullText(diagnostic.file.getSourceFile()), {
|
|
84
|
-
start: { line: line, column },
|
|
85
|
-
});
|
|
58
|
+
const ts = yield Promise.resolve().then(() => require('typescript'));
|
|
59
|
+
const { workspaceRoot, tsConfigPath, cacheDir } = options;
|
|
60
|
+
const config = (0, typescript_1.readTsConfig)(tsConfigPath);
|
|
61
|
+
if (config.errors.length) {
|
|
62
|
+
throw new Error(`Invalid config file: ${config.errors}`);
|
|
86
63
|
}
|
|
87
|
-
|
|
64
|
+
const emitOptions = options.mode === 'emitDeclarationOnly'
|
|
65
|
+
? { emitDeclarationOnly: true, declaration: true, outDir: options.outDir }
|
|
66
|
+
: { noEmit: true };
|
|
67
|
+
const compilerOptions = Object.assign(Object.assign(Object.assign({}, config.options), { skipLibCheck: true }), emitOptions);
|
|
68
|
+
return { ts, workspaceRoot, cacheDir, config, compilerOptions };
|
|
88
69
|
});
|
|
89
70
|
}
|
|
71
|
+
function getTypeCheckResult(ts, allDiagnostics, workspaceRoot, inputFilesCount, totalFilesCount, incremental = false) {
|
|
72
|
+
const errors = allDiagnostics
|
|
73
|
+
.filter((d) => d.category === ts.DiagnosticCategory.Error)
|
|
74
|
+
.map((d) => getFormattedDiagnostic(ts, workspaceRoot, d));
|
|
75
|
+
const warnings = allDiagnostics
|
|
76
|
+
.filter((d) => d.category === ts.DiagnosticCategory.Warning)
|
|
77
|
+
.map((d) => getFormattedDiagnostic(ts, workspaceRoot, d));
|
|
78
|
+
return {
|
|
79
|
+
warnings,
|
|
80
|
+
errors,
|
|
81
|
+
inputFilesCount,
|
|
82
|
+
totalFilesCount,
|
|
83
|
+
incremental,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function getFormattedDiagnostic(ts, workspaceRoot, diagnostic) {
|
|
87
|
+
let message = '';
|
|
88
|
+
const reason = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
|
89
|
+
const category = diagnostic.category;
|
|
90
|
+
switch (category) {
|
|
91
|
+
case ts.DiagnosticCategory.Warning: {
|
|
92
|
+
message += `${chalk.yellow.bold('warning')} ${chalk.gray(`TS${diagnostic.code}`)}: `;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
case ts.DiagnosticCategory.Error: {
|
|
96
|
+
message += `${chalk.red.bold('error')} ${chalk.gray(`TS${diagnostic.code}`)}: `;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case ts.DiagnosticCategory.Suggestion:
|
|
100
|
+
case ts.DiagnosticCategory.Message:
|
|
101
|
+
default: {
|
|
102
|
+
message += `${chalk.cyan.bold(category === 2 ? 'suggestion' : 'info')}: `;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
message += reason + '\n';
|
|
107
|
+
if (diagnostic.file) {
|
|
108
|
+
const pos = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
109
|
+
const line = pos.line + 1;
|
|
110
|
+
const column = pos.character + 1;
|
|
111
|
+
const fileName = path.relative(workspaceRoot, diagnostic.file.fileName);
|
|
112
|
+
message =
|
|
113
|
+
`${chalk.underline.blue(`${fileName}:${line}:${column}`)} - ` + message;
|
|
114
|
+
message +=
|
|
115
|
+
'\n' +
|
|
116
|
+
(0, code_frames_1.codeFrameColumns)(diagnostic.file.getFullText(diagnostic.file.getSourceFile()), {
|
|
117
|
+
start: { line: line, column },
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return message;
|
|
121
|
+
}
|
|
90
122
|
exports.getFormattedDiagnostic = getFormattedDiagnostic;
|
|
91
123
|
//# sourceMappingURL=run-type-check.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-type-check.js","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/typescript/run-type-check.ts"],"names":[],"mappings":";;;;AAAA,yEAAwE;AACxE
|
|
1
|
+
{"version":3,"file":"run-type-check.js","s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O,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;YAC1E,MAAM;SACP;KACF;IAED,OAAO,IAAI,MAAM,GAAG,IAAI,CAAC;IAEzB,IAAI,UAAU,CAAC,IAAI,EAAE;QACnB,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,6BAA6B,CACvD,UAAU,CAAC,KAAM,CAClB,CAAC;QACF,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;QAC1B,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxE,OAAO;YACL,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC,KAAK,GAAG,OAAO,CAAC;QAE1E,OAAO;YACL,IAAI;gBACJ,IAAA,8BAAgB,EACd,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,EAC5D;oBACE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE;iBAC9B,CACF,CAAC;KACL;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAtDD,wDAsDC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CustomTransformerFactory, Node, Program, TransformerFactory as TypescriptTransformerFactory } from 'typescript';
|
|
2
|
+
declare type TransformerFactory = TypescriptTransformerFactory<Node> | CustomTransformerFactory;
|
|
3
|
+
export interface TransformerPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
options: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export declare type TransformerEntry = string | TransformerPlugin;
|
|
8
|
+
export interface CompilerPlugin {
|
|
9
|
+
before?: (options?: Record<string, unknown>, program?: Program) => TransformerFactory;
|
|
10
|
+
after?: (options?: Record<string, unknown>, program?: Program) => TransformerFactory;
|
|
11
|
+
afterDeclarations?: (options?: Record<string, unknown>, program?: Program) => TransformerFactory;
|
|
12
|
+
}
|
|
13
|
+
export interface CompilerPluginHooks {
|
|
14
|
+
beforeHooks: Array<(program?: Program) => TransformerFactory>;
|
|
15
|
+
afterHooks: Array<(program?: Program) => TransformerFactory>;
|
|
16
|
+
afterDeclarationsHooks: Array<(program?: Program) => TransformerFactory>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|