Skip to content

Commit 67e6a03

Browse files
committed
Revert "use externalTranspiler before doing diffs for status". Hot fixes #765 which takes priority over babel compile experience 🌹
This reverts commit 900a1da.
1 parent fadb41e commit 67e6a03

File tree

5 files changed

+29
-63
lines changed

5 files changed

+29
-63
lines changed

dist/main/lang/modules/building.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,6 @@ function getRawOutput(proj, filePath) {
7979
return output;
8080
}
8181
exports.getRawOutput = getRawOutput;
82-
function getRawOutputPostExternal(proj, filePath) {
83-
var output1 = getRawOutput(proj, filePath);
84-
var sourceFile = proj.languageService.getSourceFile(filePath);
85-
var sourceMapContents = {};
86-
return runExternalTranspiler(filePath, sourceFile.text, output1.outputFiles[0], proj, sourceMapContents).then(function () {
87-
return {
88-
outputFiles: output1.outputFiles,
89-
emitSkipped: false
90-
};
91-
});
92-
}
93-
exports.getRawOutputPostExternal = getRawOutputPostExternal;
9482
function getBabelInstance(projectDirectory) {
9583
return new Promise(function (resolve) {
9684
if (!babels[projectDirectory]) {

dist/main/lang/projectService.js

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -600,27 +600,23 @@ exports.getOutputJs = getOutputJs;
600600
function getOutputJsStatus(query) {
601601
projectCache_1.consistentPath(query);
602602
var project = projectCache_1.getOrCreateProject(query.filePath);
603-
return building_1.getRawOutputPostExternal(project, query.filePath)
604-
.then(function (output) {
605-
if (output.emitSkipped) {
606-
if (output.outputFiles && output.outputFiles.length === 1) {
607-
if (output.outputFiles[0].text === building.Not_In_Context) {
608-
return resolve({ emitDiffers: false });
609-
}
610-
}
611-
return resolve({ emitDiffers: true });
612-
}
613-
else {
614-
var jsFile = output.outputFiles.filter(function (x) { return path.extname(x.name) == ".js"; })[0];
615-
if (!jsFile) {
603+
var output = building_1.getRawOutput(project, query.filePath);
604+
if (output.emitSkipped) {
605+
if (output.outputFiles && output.outputFiles.length === 1) {
606+
if (output.outputFiles[0].text === building.Not_In_Context) {
616607
return resolve({ emitDiffers: false });
617608
}
618-
else {
619-
var emitDiffers = !fs.existsSync(jsFile.name) || fs.readFileSync(jsFile.name).toString() !== jsFile.text;
620-
return resolve({ emitDiffers: emitDiffers });
621-
}
622609
}
623-
});
610+
return resolve({ emitDiffers: true });
611+
}
612+
var jsFile = output.outputFiles.filter(function (x) { return path.extname(x.name) == ".js"; })[0];
613+
if (!jsFile) {
614+
return resolve({ emitDiffers: false });
615+
}
616+
else {
617+
var emitDiffers = !fs.existsSync(jsFile.name) || fs.readFileSync(jsFile.name).toString() !== jsFile.text;
618+
return resolve({ emitDiffers: emitDiffers });
619+
}
624620
}
625621
exports.getOutputJsStatus = getOutputJsStatus;
626622
function softReset(query) {

lib/main/lang/modules/building.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,6 @@ export function getRawOutput(proj: project.Project, filePath: string): ts.EmitOu
106106
return output;
107107
}
108108

109-
export function getRawOutputPostExternal(proj: project.Project, filePath: string): Promise<ts.EmitOutput> {
110-
var output1 = getRawOutput(proj, filePath);
111-
let sourceFile = proj.languageService.getSourceFile(filePath);
112-
let sourceMapContents: { [index: string]: any } = {};
113-
return runExternalTranspiler(
114-
filePath, sourceFile.text, output1.outputFiles[0], proj, sourceMapContents
115-
).then(() => {
116-
return {
117-
outputFiles: output1.outputFiles,
118-
emitSkipped: false
119-
};
120-
});
121-
}
122-
123109
function getBabelInstance(projectDirectory: string) {
124110
return new Promise<any>(resolve => {
125111
if (!babels[projectDirectory]) {

lib/main/lang/projectService.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ export function applyQuickFix(query: ApplyQuickFixQuery): Promise<ApplyQuickFixR
909909
interface GetOutputResponse {
910910
output: ts.EmitOutput;
911911
}
912-
import {getRawOutputPostExternal, getRawOutput} from "./modules/building";
912+
import {getRawOutput} from "./modules/building";
913913
export function getOutput(query: FilePathQuery): Promise<GetOutputResponse> {
914914
consistentPath(query);
915915
var project = getOrCreateProject(query.filePath);
@@ -938,26 +938,22 @@ interface GetOutputJsStatusResponse {
938938
export function getOutputJsStatus(query: FilePathQuery): Promise<GetOutputJsStatusResponse> {
939939
consistentPath(query);
940940
var project = getOrCreateProject(query.filePath);
941-
return getRawOutputPostExternal(project, query.filePath)
942-
.then((output) => {
943-
if (output.emitSkipped) {
944-
if (output.outputFiles && output.outputFiles.length === 1) {
945-
if (output.outputFiles[0].text === building.Not_In_Context) {
946-
return resolve({ emitDiffers: false });
947-
}
948-
}
949-
return resolve({ emitDiffers: true });
950-
}
951-
else {
952-
var jsFile = output.outputFiles.filter(x=> path.extname(x.name) == ".js")[0];
953-
if (!jsFile) {
941+
var output = getRawOutput(project, query.filePath);
942+
if (output.emitSkipped) {
943+
if (output.outputFiles && output.outputFiles.length === 1) {
944+
if (output.outputFiles[0].text === building.Not_In_Context) {
954945
return resolve({ emitDiffers: false });
955-
} else {
956-
var emitDiffers = !fs.existsSync(jsFile.name) || fs.readFileSync(jsFile.name).toString() !== jsFile.text;
957-
return resolve({ emitDiffers });
958946
}
959947
}
960-
});
948+
return resolve({ emitDiffers: true });
949+
}
950+
var jsFile = output.outputFiles.filter(x=> path.extname(x.name) == ".js")[0];
951+
if (!jsFile) {
952+
return resolve({ emitDiffers: false });
953+
} else {
954+
var emitDiffers = !fs.existsSync(jsFile.name) || fs.readFileSync(jsFile.name).toString() !== jsFile.text;
955+
return resolve({ emitDiffers });
956+
}
961957
}
962958

963959
/**

lib/typings/atompromise.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface PromiseConstructor {
3333
* and a reject callback used to reject the promise with a provided reason or error.
3434
*/
3535
new <T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
36-
36+
3737
<T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
3838

3939
/**

0 commit comments

Comments
 (0)