Skip to content

Commit

Permalink
Remove 5.5 deprecated compiler options (#57527)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Branch <andrew@wheream.io>
  • Loading branch information
jakebailey and andrewbranch committed Feb 28, 2024
1 parent cfbb15f commit 26df0cb
Show file tree
Hide file tree
Showing 770 changed files with 1,111 additions and 5,783 deletions.
21 changes: 10 additions & 11 deletions src/compiler/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import {
maybeBind,
noop,
notImplemented,
outFile,
Path,
Program,
ProjectReference,
Expand Down Expand Up @@ -310,12 +309,12 @@ function createBuilderProgramState(newProgram: Program, oldState: Readonly<Reusa
state.program = newProgram;
const compilerOptions = newProgram.getCompilerOptions();
state.compilerOptions = compilerOptions;
const outFilePath = outFile(compilerOptions);
const outFilePath = compilerOptions.outFile;
// With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
if (!outFilePath) {
state.semanticDiagnosticsPerFile = new Map();
}
else if (compilerOptions.composite && oldState?.outSignature && outFilePath === outFile(oldState?.compilerOptions)) {
else if (compilerOptions.composite && oldState?.outSignature && outFilePath === oldState.compilerOptions.outFile) {
state.outSignature = oldState.outSignature && getEmitSignatureFromOldSignature(compilerOptions, oldState.compilerOptions, oldState.outSignature);
}
state.changedFilesSet = new Set();
Expand Down Expand Up @@ -559,7 +558,7 @@ function releaseCache(state: BuilderProgramState) {
}

function backupBuilderProgramEmitState(state: Readonly<BuilderProgramState>): SavedBuildProgramEmitState {
const outFilePath = outFile(state.compilerOptions);
const outFilePath = state.compilerOptions.outFile;
// Only in --out changeFileSet is kept around till emit
Debug.assert(!state.changedFilesSet.size || outFilePath);
return {
Expand Down Expand Up @@ -649,7 +648,7 @@ function getNextAffectedFile(
// so operations are performed directly on program, return program
const program = Debug.checkDefined(state.program);
const compilerOptions = program.getCompilerOptions();
if (outFile(compilerOptions)) {
if (compilerOptions.outFile) {
Debug.assert(!state.semanticDiagnosticsPerFile);
return program;
}
Expand Down Expand Up @@ -1051,7 +1050,7 @@ export type ProgramBuildInfo = ProgramMultiFileEmitBuildInfo | ProgramBundleEmit

/** @internal */
export function isProgramBundleEmitBuildInfo(info: ProgramBuildInfo): info is ProgramBundleEmitBuildInfo {
return !!outFile(info.options || {});
return !!info.options?.outFile;
}

/**
Expand All @@ -1065,7 +1064,7 @@ function getBuildInfo(state: BuilderProgramState): BuildInfo {
const fileNames: string[] = [];
const fileNameToFileId = new Map<string, ProgramBuildInfoFileId>();
const root: ProgramBuildInfoRoot[] = [];
if (outFile(state.compilerOptions)) {
if (state.compilerOptions.outFile) {
// Copy all fileInfo, version and impliedFormat
// Affects global scope and signature doesnt matter because with --out they arent calculated or needed to determine upto date ness
const fileInfos = arrayFrom(state.fileInfos.entries(), ([key, value]): ProgramBundleEmitBuildInfoFileInfo => {
Expand Down Expand Up @@ -1509,7 +1508,7 @@ export function createBuilderProgram(kind: BuilderProgramKind, { newProgram, hos
let emitKind: BuilderFileEmit = emitOnlyDtsFiles ?
programEmitKind & BuilderFileEmit.AllDts : programEmitKind;
if (!affected) {
if (!outFile(state.compilerOptions)) {
if (!state.compilerOptions.outFile) {
const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
if (!pendingAffectedFile) {
const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
Expand Down Expand Up @@ -1586,7 +1585,7 @@ export function createBuilderProgram(kind: BuilderProgramKind, { newProgram, hos
if (!getEmitDeclarations(state.compilerOptions)) return writeFile || maybeBind(host, host.writeFile);
return (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
if (isDeclarationFileName(fileName)) {
if (!outFile(state.compilerOptions)) {
if (!state.compilerOptions.outFile) {
Debug.assert(sourceFiles?.length === 1);
let emitSignature;
if (!customTransformers) {
Expand Down Expand Up @@ -1762,7 +1761,7 @@ export function createBuilderProgram(kind: BuilderProgramKind, { newProgram, hos
function getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): readonly Diagnostic[] {
assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
const compilerOptions = Debug.checkDefined(state.program).getCompilerOptions();
if (outFile(compilerOptions)) {
if (compilerOptions.outFile) {
Debug.assert(!state.semanticDiagnosticsPerFile);
// We dont need to cache the diagnostics just return them from program
return Debug.checkDefined(state.program).getSemanticDiagnostics(sourceFile, cancellationToken);
Expand Down Expand Up @@ -1838,7 +1837,7 @@ export function createBuilderProgramUsingProgramBuildInfo(buildInfo: BuildInfo,
else {
filePathsSetList = program.fileIdsList?.map(fileIds => new Set(fileIds.map(toFilePath)));
const fileInfos = new Map<Path, BuilderState.FileInfo>();
const emitSignatures = program.options?.composite && !outFile(program.options) ? new Map<Path, EmitSignature>() : undefined;
const emitSignatures = program.options?.composite && !program.options.outFile ? new Map<Path, EmitSignature>() : undefined;
program.fileInfos.forEach((fileInfo, index) => {
const path = toFilePath(index + 1 as ProgramBuildInfoFileId);
const stateFileInfo = toBuilderStateFileInfoForMultiEmit(fileInfo);
Expand Down
9 changes: 4 additions & 5 deletions src/compiler/builderState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
mapDefinedIterator,
ModuleDeclaration,
ModuleKind,
outFile,
OutputFile,
Path,
Program,
Expand Down Expand Up @@ -304,7 +303,7 @@ export namespace BuilderState {
export function create(newProgram: Program, oldState: Readonly<BuilderState> | undefined, disableUseFileVersionAsSignature: boolean): BuilderState {
const fileInfos = new Map<Path, FileInfo>();
const options = newProgram.getCompilerOptions();
const isOutFile = outFile(options);
const isOutFile = options.outFile;
const referencedMap = options.module !== ModuleKind.None && !isOutFile ?
createManyToManyPathMap() : undefined;
const exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
Expand Down Expand Up @@ -514,7 +513,7 @@ export namespace BuilderState {
export function getAllDependencies(state: BuilderState, programOfThisState: Program, sourceFile: SourceFile): readonly string[] {
const compilerOptions = programOfThisState.getCompilerOptions();
// With --out or --outFile all outputs go into single file, all files depend on each other
if (outFile(compilerOptions)) {
if (compilerOptions.outFile) {
return getAllFileNames(state, programOfThisState);
}

Expand Down Expand Up @@ -625,7 +624,7 @@ export namespace BuilderState {
const compilerOptions = programOfThisState.getCompilerOptions();
// If `--out` or `--outFile` is specified, any new emit will result in re-emitting the entire project,
// so returning the file itself is good enough.
if (compilerOptions && outFile(compilerOptions)) {
if (compilerOptions && compilerOptions.outFile) {
return [sourceFileWithUpdatedShape];
}
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
Expand All @@ -646,7 +645,7 @@ export namespace BuilderState {
}

const compilerOptions = programOfThisState.getCompilerOptions();
if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
if (compilerOptions && (getIsolatedModules(compilerOptions) || compilerOptions.outFile)) {
return [sourceFileWithUpdatedShape];
}

Expand Down

0 comments on commit 26df0cb

Please sign in to comment.