Skip to content

Commit

Permalink
tsc -b removes silent noEmitOnError and emits files even if there…
Browse files Browse the repository at this point in the history
… are errors (microsoft#58838)
  • Loading branch information
sheetalkamat authored Jun 13, 2024
1 parent e30b5fb commit b258429
Show file tree
Hide file tree
Showing 186 changed files with 5,540 additions and 3,000 deletions.
174 changes: 84 additions & 90 deletions src/compiler/builder.ts

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/compiler/builderPublic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
Program,
ProjectReference,
ReusableBuilderProgramState,
SavedBuildProgramEmitState,
SourceFile,
WriteFileCallback,
} from "./_namespaces/ts.js";
Expand Down Expand Up @@ -48,10 +47,6 @@ export interface BuilderProgram {
/** @internal */
state: ReusableBuilderProgramState;
/** @internal */
saveEmitState(): SavedBuildProgramEmitState;
/** @internal */
restoreEmitState(saved: SavedBuildProgramEmitState): void;
/** @internal */
hasChangedEmitSignature?(): boolean;
/**
* Returns current program
Expand Down
12 changes: 8 additions & 4 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4365,10 +4365,6 @@
"category": "Error",
"code": 5012
},
"Failed to parse file '{0}': {1}.": {
"category": "Error",
"code": 5014
},
"Unknown compiler option '{0}'.": {
"category": "Error",
"code": 5023
Expand Down Expand Up @@ -5898,6 +5894,14 @@
"category": "Message",
"code": 6418
},
"Project '{0}' is out of date because buildinfo file '{1}' indicates that program needs to report errors.": {
"category": "Message",
"code": 6419
},
"Project '{0}' is out of date because {1}.": {
"category": "Message",
"code": 6420
},

"The expected type comes from property '{0}' which is declared here on type '{1}'": {
"category": "Message",
Expand Down
9 changes: 6 additions & 3 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ import {
WithStatement,
writeCommentRange,
writeFile,
WriteFileCallbackData,
YieldExpression,
} from "./_namespaces/ts.js";
import * as performance from "./_namespaces/ts.performance.js";
Expand Down Expand Up @@ -923,7 +924,7 @@ export function emitFiles(
isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
substituteNode: declarationTransform.substituteNode,
});
printSourceFileOrBundle(
const dtsWritten = printSourceFileOrBundle(
declarationFilePath,
declarationMapPath,
declarationTransform,
Expand All @@ -937,7 +938,7 @@ export function emitFiles(
},
);
if (emittedFilesList) {
emittedFilesList.push(declarationFilePath);
if (dtsWritten) emittedFilesList.push(declarationFilePath);
if (declarationMapPath) {
emittedFilesList.push(declarationMapPath);
}
Expand Down Expand Up @@ -1027,10 +1028,12 @@ export function emitFiles(

// Write the output file
const text = writer.getText();
writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos, diagnostics: transform.diagnostics });
const data: WriteFileCallbackData = { sourceMapUrlPos, diagnostics: transform.diagnostics };
writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);

// Reset state
writer.clear();
return !data.skippedDtsWrite;
}

interface SourceMapOptions {
Expand Down
13 changes: 10 additions & 3 deletions src/compiler/tsbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export enum UpToDateStatusType {
ErrorReadingFile,
OutOfDateWithSelf,
OutOfDateWithUpstream,
OutOfDateBuildInfo,
OutOfDateBuildInfoWithPendingEmit,
OutOfDateBuildInfoWithErrors,
OutOfDateOptions,
OutOfDateRoots,
UpstreamOutOfDate,
Expand Down Expand Up @@ -76,7 +77,10 @@ export namespace Status {
* We track what the newest input file is.
*/
export interface UpToDate {
type: UpToDateStatusType.UpToDate | UpToDateStatusType.UpToDateWithUpstreamTypes | UpToDateStatusType.UpToDateWithInputFileText;
type:
| UpToDateStatusType.UpToDate
| UpToDateStatusType.UpToDateWithUpstreamTypes
| UpToDateStatusType.UpToDateWithInputFileText;
newestInputFileTime?: Date;
newestInputFileName?: string;
oldestOutputFileName: string;
Expand Down Expand Up @@ -112,7 +116,10 @@ export namespace Status {
* Buildinfo indicates that build is out of date
*/
export interface OutOfDateBuildInfo {
type: UpToDateStatusType.OutOfDateBuildInfo | UpToDateStatusType.OutOfDateOptions;
type:
| UpToDateStatusType.OutOfDateBuildInfoWithPendingEmit
| UpToDateStatusType.OutOfDateBuildInfoWithErrors
| UpToDateStatusType.OutOfDateOptions;
buildInfoFile: string;
}

Expand Down
Loading

0 comments on commit b258429

Please sign in to comment.