Skip to content

Commit e4fe4ac

Browse files
committed
Make update bundle return invalidated project if it cant update the bundle
1 parent 5270b7e commit e4fe4ac

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/compiler/tsbuild.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ namespace ts {
682682

683683
interface UpdateBundleProject extends InvalidatedProjectBase {
684684
readonly kind: InvalidatedProjectKind.UpdateBundle;
685-
updateBundle(cancellationToken?: CancellationToken): BuildResultFlags;
685+
updateBundle(): BuildResultFlags | BuildInvalidedProject;
686686
}
687687

688688
type InvalidatedProject = UpdateOutputFileStampsProject | BuildInvalidedProject | UpdateBundleProject;
@@ -749,13 +749,21 @@ namespace ts {
749749
projectPath,
750750
updateBundle: update,
751751
done: cancellationToken => {
752-
if (updatePending) update(cancellationToken);
752+
if (updatePending) {
753+
const result = update();
754+
if ((result as BuildInvalidedProject).project) {
755+
return (result as BuildInvalidedProject).done(cancellationToken);
756+
}
757+
}
753758
state.projectPendingBuild.delete(projectPath);
754759
}
755760
};
756761

757-
function update(cancellationToken?: CancellationToken) {
758-
const buildResult = updateBundle(state, project, projectPath, config, cancellationToken);
762+
function update() {
763+
const buildResult = updateBundle(state, project, projectPath, config);
764+
if (isString(buildResult)) {
765+
return createBuildInvalidedProject(state, project, projectPath, projectIndex, config, buildOrder);
766+
}
759767
queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult);
760768
updatePending = false;
761769
return buildResult;
@@ -1068,9 +1076,8 @@ namespace ts {
10681076
state: SolutionBuilderState,
10691077
proj: ResolvedConfigFileName,
10701078
resolvedPath: ResolvedConfigFilePath,
1071-
config: ParsedCommandLine,
1072-
cancellationToken: CancellationToken | undefined
1073-
): BuildResultFlags {
1079+
config: ParsedCommandLine
1080+
): BuildResultFlags | string {
10741081
if (state.options.dry) {
10751082
reportStatus(state, Diagnostics.A_non_dry_build_would_update_output_of_project_0, proj);
10761083
return BuildResultFlags.Success;
@@ -1090,7 +1097,7 @@ namespace ts {
10901097
});
10911098
if (isString(outputFiles)) {
10921099
reportStatus(state, Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, proj, relName(state, outputFiles));
1093-
return buildSingleProject(state, proj, resolvedPath, config, cancellationToken);
1100+
return outputFiles;
10941101
}
10951102

10961103
// Actual Emit

0 commit comments

Comments
 (0)