Skip to content

Commit

Permalink
Dont store isExternalLibraryImport in the buildInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
sheetalkamat committed Dec 9, 2022
1 parent e39ce80 commit 6260577
Show file tree
Hide file tree
Showing 41 changed files with 2,724 additions and 4,977 deletions.
9 changes: 6 additions & 3 deletions src/compiler/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import {
PackageJsonInfoContents,
PackageJsonScope,
Path,
pathContainsNodeModules,
PerDirectoryAndNonRelativeNameCache,
PerNonRelativeNameCache,
Program,
Expand Down Expand Up @@ -954,10 +955,10 @@ export type ProgramMultiFileEmitBuildInfoFileInfo = string | ProgramMultiFileEmi
/** @internal */
export interface ProgramBuildInfoResolutionBase {
readonly resolvedFileName: ProgramBuildInfoAbsoluteFileId;
readonly isExternalLibraryImport: true | undefined;
readonly originalPath: ProgramBuildInfoAbsoluteFileId | undefined;
readonly primary: true | undefined;
extension: undefined;
isExternalLibraryImport: undefined;
}
/** @internal */
export type ProgramBuildInfoResolvedModuleFull = Omit<ResolvedModuleFull, "resolvedFileName" | "isExternalLibraryImport" | "originalPath" | "extension"> & ProgramBuildInfoResolutionBase;
Expand Down Expand Up @@ -1460,7 +1461,7 @@ function getBuildInfo(state: BuilderProgramState, host: BuilderProgramHost, bund
return resolved ? {
...resolved,
resolvedFileName: toAbsoluteFileId(resolved.resolvedFileName!),
isExternalLibraryImport: resolved.isExternalLibraryImport ? true : undefined,
isExternalLibraryImport: undefined,
originalPath: resolved.originalPath ? toAbsoluteFileId(resolved.originalPath) : undefined,
primary: (resolved as ResolvedTypeReferenceDirective).primary || undefined,
extension: undefined,
Expand Down Expand Up @@ -2446,10 +2447,12 @@ export function createOldBuildInfoProgram(
extension: Extension,
): (ResolvedModuleFull & ResolvedTypeReferenceDirective) | undefined {
if (!resolved) return undefined;
const originalPath = resolved.originalPath ? resuableCacheResolutions!.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(resolved.originalPath) : undefined;
return {
...resolved,
resolvedFileName,
originalPath: resolved.originalPath ? resuableCacheResolutions!.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(resolved.originalPath) : undefined,
originalPath,
isExternalLibraryImport: pathContainsNodeModules(originalPath || resolvedFileName),
extension,
};
}
Expand Down
126 changes: 48 additions & 78 deletions tests/baselines/reference/tsbuild/cacheResolutions/bundle-emit.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ CleanBuild:
"original": {
"resolvedModule": {
"resolvedFileName": 2,
"isExternalLibraryImport": true,
"packageId": {
"name": "pkg0",
"subModuleName": "import.d.ts",
Expand All @@ -115,7 +114,6 @@ CleanBuild:
"resolutionId": 1,
"resolvedModule": {
"resolvedFileName": "./node_modules/pkg0/import.d.ts",
"isExternalLibraryImport": true,
"packageId": {
"name": "pkg0",
"subModuleName": "import.d.ts",
Expand All @@ -134,8 +132,7 @@ CleanBuild:
"name": "pkg2",
"subModuleName": "import.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
12
Expand All @@ -148,8 +145,7 @@ CleanBuild:
"name": "pkg2",
"subModuleName": "import.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg2/package.json"
Expand All @@ -163,8 +159,7 @@ CleanBuild:
"name": "pkg3",
"subModuleName": "require.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
13
Expand All @@ -177,8 +172,7 @@ CleanBuild:
"name": "pkg3",
"subModuleName": "require.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg3/package.json"
Expand All @@ -188,15 +182,13 @@ CleanBuild:
"original": {
"resolvedTypeReferenceDirective": {
"primary": true,
"resolvedFileName": 9,
"isExternalLibraryImport": true
"resolvedFileName": 9
}
},
"resolutionId": 4,
"resolvedTypeReferenceDirective": {
"primary": true,
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts",
"isExternalLibraryImport": true
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts"
}
}
],
Expand Down Expand Up @@ -233,7 +225,6 @@ CleanBuild:
"resolutionId": 1,
"resolvedModule": {
"resolvedFileName": "./node_modules/pkg0/import.d.ts",
"isExternalLibraryImport": true,
"packageId": {
"name": "pkg0",
"subModuleName": "import.d.ts",
Expand Down Expand Up @@ -262,8 +253,7 @@ CleanBuild:
"name": "pkg2",
"subModuleName": "import.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg2/package.json"
Expand All @@ -287,8 +277,7 @@ CleanBuild:
"name": "pkg3",
"subModuleName": "require.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg3/package.json"
Expand All @@ -307,8 +296,7 @@ CleanBuild:
"resolutionId": 4,
"resolvedTypeReferenceDirective": {
"primary": true,
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts",
"isExternalLibraryImport": true
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts"
}
}
}
Expand All @@ -324,7 +312,6 @@ CleanBuild:
"resolutionId": 1,
"resolvedModule": {
"resolvedFileName": "./node_modules/pkg0/import.d.ts",
"isExternalLibraryImport": true,
"packageId": {
"name": "pkg0",
"subModuleName": "import.d.ts",
Expand Down Expand Up @@ -355,8 +342,7 @@ CleanBuild:
"name": "pkg2",
"subModuleName": "import.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg2/package.json"
Expand All @@ -375,8 +361,7 @@ CleanBuild:
"name": "pkg3",
"subModuleName": "require.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg3/package.json"
Expand All @@ -391,8 +376,7 @@ CleanBuild:
"resolutionId": 4,
"resolvedTypeReferenceDirective": {
"primary": true,
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts",
"isExternalLibraryImport": true
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts"
}
}
}
Expand Down Expand Up @@ -503,7 +487,6 @@ IncrementalBuild:
"original": {
"resolvedModule": {
"resolvedFileName": 2,
"isExternalLibraryImport": true,
"packageId": {
"name": "pkg0",
"subModuleName": "import.d.ts",
Expand All @@ -517,7 +500,6 @@ IncrementalBuild:
"resolutionId": 1,
"resolvedModule": {
"resolvedFileName": "./node_modules/pkg0/import.d.ts",
"isExternalLibraryImport": true,
"packageId": {
"name": "pkg0",
"subModuleName": "import.d.ts",
Expand All @@ -536,8 +518,7 @@ IncrementalBuild:
"name": "pkg2",
"subModuleName": "import.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
12
Expand All @@ -550,8 +531,7 @@ IncrementalBuild:
"name": "pkg2",
"subModuleName": "import.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg2/package.json"
Expand All @@ -565,8 +545,7 @@ IncrementalBuild:
"name": "pkg3",
"subModuleName": "require.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
13
Expand All @@ -579,8 +558,7 @@ IncrementalBuild:
"name": "pkg3",
"subModuleName": "require.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg3/package.json"
Expand All @@ -590,15 +568,13 @@ IncrementalBuild:
"original": {
"resolvedTypeReferenceDirective": {
"primary": true,
"resolvedFileName": 9,
"isExternalLibraryImport": true
"resolvedFileName": 9
}
},
"resolutionId": 4,
"resolvedTypeReferenceDirective": {
"primary": true,
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts",
"isExternalLibraryImport": true
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts"
}
}
],
Expand Down Expand Up @@ -635,7 +611,6 @@ IncrementalBuild:
"resolutionId": 1,
"resolvedModule": {
"resolvedFileName": "./node_modules/pkg0/import.d.ts",
"isExternalLibraryImport": true,
"packageId": {
"name": "pkg0",
"subModuleName": "import.d.ts",
Expand Down Expand Up @@ -664,8 +639,7 @@ IncrementalBuild:
"name": "pkg2",
"subModuleName": "import.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg2/package.json"
Expand All @@ -689,8 +663,7 @@ IncrementalBuild:
"name": "pkg3",
"subModuleName": "require.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg3/package.json"
Expand All @@ -709,8 +682,7 @@ IncrementalBuild:
"resolutionId": 4,
"resolvedTypeReferenceDirective": {
"primary": true,
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts",
"isExternalLibraryImport": true
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts"
}
}
}
Expand All @@ -726,7 +698,6 @@ IncrementalBuild:
"resolutionId": 1,
"resolvedModule": {
"resolvedFileName": "./node_modules/pkg0/import.d.ts",
"isExternalLibraryImport": true,
"packageId": {
"name": "pkg0",
"subModuleName": "import.d.ts",
Expand Down Expand Up @@ -757,8 +728,7 @@ IncrementalBuild:
"name": "pkg2",
"subModuleName": "import.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg2/package.json"
Expand All @@ -777,8 +747,7 @@ IncrementalBuild:
"name": "pkg3",
"subModuleName": "require.d.ts",
"version": "0.0.1"
},
"isExternalLibraryImport": true
}
},
"affectingLocations": [
"./node_modules/pkg3/package.json"
Expand All @@ -793,8 +762,7 @@ IncrementalBuild:
"resolutionId": 4,
"resolvedTypeReferenceDirective": {
"primary": true,
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts",
"isExternalLibraryImport": true
"resolvedFileName": "./node_modules/@types/pkg4/index.d.ts"
}
}
}
Expand Down
Loading

0 comments on commit 6260577

Please sign in to comment.