summaryrefslogtreecommitdiff
path: root/cli/tsc/99_main_compiler.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-08-31 11:02:13 +0200
committerGitHub <noreply@github.com>2020-08-31 11:02:13 +0200
commitd761246e16826a3dd3aa73a3e053de72d640b203 (patch)
treec34ee69919be64001110bc7346c2f42f2a6827cd /cli/tsc/99_main_compiler.js
parent39912f201836e945a66583f62bfcae72655382f1 (diff)
refactor: remove dead code in tsc (#7277)
Diffstat (limited to 'cli/tsc/99_main_compiler.js')
-rw-r--r--cli/tsc/99_main_compiler.js88
1 files changed, 4 insertions, 84 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js
index 4d44375c6..1bef2cf65 100644
--- a/cli/tsc/99_main_compiler.js
+++ b/cli/tsc/99_main_compiler.js
@@ -406,15 +406,6 @@ delete Object.prototype.__proto__;
target: ts.ScriptTarget.ESNext,
};
- const DEFAULT_TRANSPILE_OPTIONS = {
- esModuleInterop: true,
- inlineSourceMap: true,
- jsx: ts.JsxEmit.React,
- module: ts.ModuleKind.ESNext,
- removeComments: true,
- target: ts.ScriptTarget.ESNext,
- };
-
const DEFAULT_RUNTIME_COMPILE_OPTIONS = {
outDir: undefined,
};
@@ -943,11 +934,10 @@ delete Object.prototype.__proto__;
// Update carefully!
const CompilerRequestType = {
Compile: 0,
- Transpile: 1,
- Bundle: 2,
- RuntimeCompile: 3,
- RuntimeBundle: 4,
- RuntimeTranspile: 5,
+ Bundle: 1,
+ RuntimeCompile: 2,
+ RuntimeBundle: 3,
+ RuntimeTranspile: 4,
};
function createBundleWriteFile(state) {
@@ -1452,71 +1442,6 @@ delete Object.prototype.__proto__;
};
}
- function transpile({
- config: configText,
- configPath,
- cwd,
- performance,
- sourceFiles,
- }) {
- if (performance) {
- performanceStart();
- }
- log(">>> transpile start");
- let compilerOptions;
- if (configText && configPath && cwd) {
- const { options, ...response } = configure(
- DEFAULT_TRANSPILE_OPTIONS,
- configText,
- configPath,
- cwd,
- );
- const diagnostics = processConfigureResponse(response, configPath);
- if (diagnostics && diagnostics.length) {
- return {
- diagnostics: fromTypeScriptDiagnostic(diagnostics),
- emitMap: {},
- };
- }
- compilerOptions = options;
- } else {
- compilerOptions = Object.assign({}, DEFAULT_TRANSPILE_OPTIONS);
- }
- const emitMap = {};
- let diagnostics = [];
- for (const { sourceCode, fileName } of sourceFiles) {
- const {
- outputText,
- sourceMapText,
- diagnostics: diags,
- } = ts.transpileModule(sourceCode, {
- fileName,
- compilerOptions,
- reportDiagnostics: true,
- });
- if (diags) {
- diagnostics = diagnostics.concat(...diags);
- }
- emitMap[`${fileName}.js`] = { filename: fileName, contents: outputText };
- // currently we inline source maps, but this is good logic to have if this
- // ever changes
- if (sourceMapText) {
- emitMap[`${fileName}.map`] = {
- filename: fileName,
- contents: sourceMapText,
- };
- }
- }
- performanceProgram({ fileCount: sourceFiles.length });
- const stats = performance ? performanceEnd() : undefined;
- log("<<< transpile end");
- return {
- diagnostics: fromTypeScriptDiagnostic(diagnostics),
- emitMap,
- stats,
- };
- }
-
function bundle({
config,
configPath,
@@ -1794,11 +1719,6 @@ delete Object.prototype.__proto__;
opCompilerRespond(result);
break;
}
- case CompilerRequestType.Transpile: {
- const result = transpile(request);
- opCompilerRespond(result);
- break;
- }
case CompilerRequestType.Bundle: {
const result = bundle(request);
opCompilerRespond(result);