Skip to content

Commit

Permalink
Write original fileInfo when its not just string = version = signatur…
Browse files Browse the repository at this point in the history
…e in readable baseline (#51391)
  • Loading branch information
sheetalkamat authored Nov 2, 2022
1 parent 3568eba commit 8ed84e1
Show file tree
Hide file tree
Showing 370 changed files with 10,800 additions and 18 deletions.
20 changes: 10 additions & 10 deletions src/compiler/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -794,23 +794,23 @@ namespace ts {
fileNames: readonly string[];
fileInfos: readonly ProgramBuildInfoFileInfo[];
options: CompilerOptions | undefined;
fileIdsList?: readonly (readonly ProgramBuildInfoFileId[])[];
referencedMap?: ProgramBuildInfoReferencedMap;
exportedModulesMap?: ProgramBuildInfoReferencedMap;
semanticDiagnosticsPerFile?: ProgramBuildInfoDiagnostic[];
affectedFilesPendingEmit?: ProgramBuilderInfoFilePendingEmit[];
changeFileSet?: readonly ProgramBuildInfoFileId[];
emitSignatures?: readonly ProgramBuildInfoEmitSignature[];
fileIdsList: readonly (readonly ProgramBuildInfoFileId[])[] | undefined;
referencedMap: ProgramBuildInfoReferencedMap | undefined;
exportedModulesMap: ProgramBuildInfoReferencedMap | undefined;
semanticDiagnosticsPerFile: ProgramBuildInfoDiagnostic[] | undefined;
affectedFilesPendingEmit: ProgramBuilderInfoFilePendingEmit[] | undefined;
changeFileSet: readonly ProgramBuildInfoFileId[] | undefined;
emitSignatures: readonly ProgramBuildInfoEmitSignature[] | undefined;
// Because this is only output file in the program, we dont need fileId to deduplicate name
latestChangedDtsFile?: string;
latestChangedDtsFile?: string | undefined;
}

export interface ProgramBundleEmitBuildInfo {
fileNames: readonly string[];
fileInfos: readonly string[];
options: CompilerOptions | undefined;
outSignature?: string;
latestChangedDtsFile?: string;
outSignature: string | undefined;
latestChangedDtsFile: string | undefined;
}

export type ProgramBuildInfo = ProgramMultiFileEmitBuildInfo | ProgramBundleEmitBuildInfo;
Expand Down
20 changes: 12 additions & 8 deletions src/testRunner/unittests/tsbuild/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,23 @@ interface Symbol {
type ReadableProgramBuildInfoDiagnostic = string | [string, readonly ReusableDiagnostic[]];
type ReadableProgramBuilderInfoFilePendingEmit = [original: string | [string], emitKind: "DtsOnly" | "Full"];
type ReadableProgramBuildInfoEmitSignature = string | [string, string];
type ReadableProgramBuildInfoFileInfo = Omit<BuilderState.FileInfo, "impliedFormat"> & { impliedFormat: string | undefined; };
type ReadableProgramBuildInfoFileInfo = Omit<BuilderState.FileInfo, "impliedFormat"> & {
impliedFormat: string | undefined;
original: ProgramBuildInfoBuilderStateFileInfo | undefined;
};
type ReadableProgramMultiFileEmitBuildInfo = Omit<ProgramMultiFileEmitBuildInfo,
"fileIdsList" | "fileInfos" |
"referencedMap" | "exportedModulesMap" | "semanticDiagnosticsPerFile" |
"affectedFilesPendingEmit" | "changeFileSet" | "emitSignatures"
> & {
fileNamesList: readonly (readonly string[])[] | undefined;
fileInfos: MapLike<ReadableProgramBuildInfoFileInfo>;
referencedMap?: MapLike<string[]>;
exportedModulesMap?: MapLike<string[]>;
semanticDiagnosticsPerFile?: readonly ReadableProgramBuildInfoDiagnostic[];
affectedFilesPendingEmit?: readonly ReadableProgramBuilderInfoFilePendingEmit[];
changeFileSet?: readonly string[];
emitSignatures?: readonly ReadableProgramBuildInfoEmitSignature[];
referencedMap: MapLike<string[]> | undefined;
exportedModulesMap: MapLike<string[]> | undefined;
semanticDiagnosticsPerFile: readonly ReadableProgramBuildInfoDiagnostic[] | undefined;
affectedFilesPendingEmit: readonly ReadableProgramBuilderInfoFilePendingEmit[] | undefined;
changeFileSet: readonly string[] | undefined;
emitSignatures: readonly ReadableProgramBuildInfoEmitSignature[] | undefined;
};
type ReadableProgramBundleEmitBuildInfo = Omit<ProgramBundleEmitBuildInfo, "fileInfos"> & {
fileInfos: MapLike<string>;
Expand Down Expand Up @@ -298,6 +301,7 @@ interface Symbol {
function toReadableFileInfo(fileInfo: ProgramBuildInfoFileInfo): ReadableProgramBuildInfoFileInfo {
const info = toBuilderStateFileInfo(fileInfo);
return {
original: isString(fileInfo) ? undefined : fileInfo,
...info,
impliedFormat: info.impliedFormat && getNameOfCompilerOptionValue(info.impliedFormat, moduleOptionDeclaration.type),
};
Expand Down Expand Up @@ -540,7 +544,7 @@ interface Symbol {
for (const id in readableBuildInfo.program.fileInfos) {
if (hasProperty(readableBuildInfo.program.fileInfos, id)) {
const info = readableBuildInfo.program.fileInfos[id];
sanitizedFileInfos[id] = isString(info) ? info : { ...info, signature: undefined };
sanitizedFileInfos[id] = isString(info) ? info : { ...info, signature: undefined, original: undefined };
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,26 @@ exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped
],
"fileInfos": {
"../lib/lib.d.ts": {
"original": {
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"signature": false,
"affectsGlobalScope": true
},
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"affectsGlobalScope": true
},
"./a.ts": {
"original": {
"version": "4646078106-export function foo() { }",
"signature": false
},
"version": "4646078106-export function foo() { }"
},
"./b.ts": {
"original": {
"version": "1045484683-export function bar() { }",
"signature": false
},
"version": "1045484683-export function bar() { }"
}
},
Expand Down Expand Up @@ -210,15 +223,27 @@ exports.bar = bar;
],
"fileInfos": {
"../lib/lib.d.ts": {
"original": {
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"affectsGlobalScope": true
},
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"affectsGlobalScope": true
},
"./a.ts": {
"original": {
"version": "9819159940-export function foo() { }export function fooBar() { }",
"signature": "-827728784-export declare function foo(): void;\r\nexport declare function fooBar(): void;\r\n"
},
"version": "9819159940-export function foo() { }export function fooBar() { }",
"signature": "-827728784-export declare function foo(): void;\r\nexport declare function fooBar(): void;\r\n"
},
"./b.ts": {
"original": {
"version": "1045484683-export function bar() { }",
"signature": "-1357953631-export declare function bar(): void;\r\n"
},
"version": "1045484683-export function bar() { }",
"signature": "-1357953631-export declare function bar(): void;\r\n"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,27 @@ exports.a = 1;
],
"fileInfos": {
"../../../lib/lib.d.ts": {
"original": {
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"affectsGlobalScope": true
},
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"affectsGlobalScope": true
},
"../../shared/index.ts": {
"original": {
"version": "-22125360210-export const a: Unrestricted = 1;",
"signature": "-478734393-export declare const a: Unrestricted;\r\n"
},
"version": "-22125360210-export const a: Unrestricted = 1;",
"signature": "-478734393-export declare const a: Unrestricted;\r\n"
},
"../../shared/typings-base/globals.d.ts": {
"original": {
"version": "4725476611-type Unrestricted = any;",
"affectsGlobalScope": true
},
"version": "4725476611-type Unrestricted = any;",
"signature": "4725476611-type Unrestricted = any;",
"affectsGlobalScope": true
Expand Down Expand Up @@ -140,15 +152,27 @@ exports.b = 1;
],
"fileInfos": {
"../../../lib/lib.d.ts": {
"original": {
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"affectsGlobalScope": true
},
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"affectsGlobalScope": true
},
"../../webpack/index.ts": {
"original": {
"version": "-14405273073-export const b: Unrestricted = 1;",
"signature": "-5074241048-export declare const b: Unrestricted;\r\n"
},
"version": "-14405273073-export const b: Unrestricted = 1;",
"signature": "-5074241048-export declare const b: Unrestricted;\r\n"
},
"../../shared/typings-base/globals.d.ts": {
"original": {
"version": "4725476611-type Unrestricted = any;",
"affectsGlobalScope": true
},
"version": "4725476611-type Unrestricted = any;",
"signature": "4725476611-type Unrestricted = any;",
"affectsGlobalScope": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,27 @@ exports.a = 1;
],
"fileInfos": {
"../../../lib/lib.d.ts": {
"original": {
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"affectsGlobalScope": true
},
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"affectsGlobalScope": true
},
"../../shared/index.ts": {
"original": {
"version": "-22125360210-export const a: Unrestricted = 1;",
"signature": "-478734393-export declare const a: Unrestricted;\r\n"
},
"version": "-22125360210-export const a: Unrestricted = 1;",
"signature": "-478734393-export declare const a: Unrestricted;\r\n"
},
"../../shared/typings-base/globals.d.ts": {
"original": {
"version": "4725476611-type Unrestricted = any;",
"affectsGlobalScope": true
},
"version": "4725476611-type Unrestricted = any;",
"signature": "4725476611-type Unrestricted = any;",
"affectsGlobalScope": true
Expand Down Expand Up @@ -141,15 +153,27 @@ exports.b = 1;
],
"fileInfos": {
"../../../lib/lib.d.ts": {
"original": {
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"affectsGlobalScope": true
},
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"affectsGlobalScope": true
},
"../../webpack/index.ts": {
"original": {
"version": "-14405273073-export const b: Unrestricted = 1;",
"signature": "-5074241048-export declare const b: Unrestricted;\r\n"
},
"version": "-14405273073-export const b: Unrestricted = 1;",
"signature": "-5074241048-export declare const b: Unrestricted;\r\n"
},
"../../shared/typings-base/globals.d.ts": {
"original": {
"version": "4725476611-type Unrestricted = any;",
"affectsGlobalScope": true
},
"version": "4725476611-type Unrestricted = any;",
"signature": "4725476611-type Unrestricted = any;",
"affectsGlobalScope": true
Expand Down
Loading

0 comments on commit 8ed84e1

Please sign in to comment.