Skip to content

Commit f67afa0

Browse files
committedMay 3, 2018
Unpatch vfs resolver and default lib rename
1 parent 9891b69 commit f67afa0

File tree

783 files changed

+4155
-4260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

783 files changed

+4155
-4260
lines changed
 

‎src/harness/fakes.ts

+1-21
Original file line numberDiff line numberDiff line change
@@ -289,27 +289,7 @@ namespace fakes {
289289
}
290290

291291
public getDefaultLibFileName(options: ts.CompilerOptions): string {
292-
// return vpath.resolve(this.getDefaultLibLocation(), ts.getDefaultLibFileName(options));
293-
294-
// TODO(rbuckton): This patches the baseline to replace lib.es5.d.ts with lib.d.ts.
295-
// This is only to make the PR for this change easier to read. A follow-up PR will
296-
// revert this change and accept the new baselines.
297-
// See https://github.com/Microsoft/TypeScript/pull/20763#issuecomment-352553264
298-
return vpath.resolve(this.getDefaultLibLocation(), getDefaultLibFileName(options));
299-
function getDefaultLibFileName(options: ts.CompilerOptions) {
300-
switch (options.target) {
301-
case ts.ScriptTarget.ESNext:
302-
case ts.ScriptTarget.ES2017:
303-
return "lib.es2017.d.ts";
304-
case ts.ScriptTarget.ES2016:
305-
return "lib.es2016.d.ts";
306-
case ts.ScriptTarget.ES2015:
307-
return "lib.es2015.d.ts";
308-
309-
default:
310-
return "lib.d.ts";
311-
}
312-
}
292+
return vpath.resolve(this.getDefaultLibLocation(), ts.getDefaultLibFileName(options));
313293
}
314294

315295
public getSourceFile(fileName: string, languageVersion: number): ts.SourceFile | undefined {

‎src/harness/vfs.ts

+1-20
Original file line numberDiff line numberDiff line change
@@ -1253,25 +1253,6 @@ namespace vfs {
12531253
node: Inode | undefined;
12541254
}
12551255

1256-
// TODO(rbuckton): This patches the baseline to replace lib.d.ts with lib.es5.d.ts.
1257-
// This is only to make the PR for this change easier to read. A follow-up PR will
1258-
// revert this change and accept the new baselines.
1259-
// See https://github.com/Microsoft/TypeScript/pull/20763#issuecomment-352553264
1260-
function patchResolver(host: FileSystemResolverHost, resolver: FileSystemResolver): FileSystemResolver {
1261-
const libFile = vpath.combine(host.getWorkspaceRoot(), "built/local/lib.d.ts");
1262-
const es5File = vpath.combine(host.getWorkspaceRoot(), "built/local/lib.es5.d.ts");
1263-
const stringComparer = host.useCaseSensitiveFileNames() ? vpath.compareCaseSensitive : vpath.compareCaseInsensitive;
1264-
return {
1265-
readdirSync: path => resolver.readdirSync(path),
1266-
statSync: path => resolver.statSync(fixPath(path)),
1267-
readFileSync: (path) => resolver.readFileSync(fixPath(path))
1268-
};
1269-
1270-
function fixPath(path: string) {
1271-
return stringComparer(path, libFile) === 0 ? es5File : path;
1272-
}
1273-
}
1274-
12751256
let builtLocalHost: FileSystemResolverHost | undefined;
12761257
let builtLocalCI: FileSystem | undefined;
12771258
let builtLocalCS: FileSystem | undefined;
@@ -1286,7 +1267,7 @@ namespace vfs {
12861267
const resolver = createResolver(host);
12871268
builtLocalCI = new FileSystem(/*ignoreCase*/ true, {
12881269
files: {
1289-
[builtFolder]: new Mount(vpath.resolve(host.getWorkspaceRoot(), "built/local"), patchResolver(host, resolver)),
1270+
[builtFolder]: new Mount(vpath.resolve(host.getWorkspaceRoot(), "built/local"), resolver),
12901271
[testLibFolder]: new Mount(vpath.resolve(host.getWorkspaceRoot(), "tests/lib"), resolver),
12911272
[srcFolder]: {}
12921273
},

0 commit comments

Comments
 (0)