Skip to content

Commit 57267de

Browse files
committed
Remove redundant code
1 parent c385faf commit 57267de

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

packages/cli-utils/src/ts/factory.ts

-26
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ export const programFactory = (params: ProgramFactoryParams): ProgramFactory =>
5252
const system = createFSBackedSystem(vfsMap, projectRoot, ts, resolveDefaultLibsPath(params));
5353
const config = resolveConfig(params, system);
5454

55-
for (const { filename, contents } of resolveLibs(params)) {
56-
if (contents) system.writeFile('/' + filename, contents);
57-
}
58-
5955
const rootNames = new Set(config.fileNames);
6056
const options = {
6157
getDefaultLibFilePath: ts.getDefaultLibFilePath(config.options),
@@ -177,11 +173,6 @@ export const programFactory = (params: ProgramFactoryParams): ProgramFactory =>
177173
return factory;
178174
};
179175

180-
interface LibFile {
181-
filename: string;
182-
contents: string;
183-
}
184-
185176
const defaultCompilerOptions = {
186177
target: ts.ScriptTarget.Latest,
187178
} satisfies ts.CompilerOptions;
@@ -209,23 +200,6 @@ const resolveDefaultLibsPath = (params: ProgramFactoryParams): string => {
209200
}
210201
};
211202

212-
const resolveLibs = (params: ProgramFactoryParams): readonly LibFile[] => {
213-
const tsPath = resolveDefaultLibsPath(params);
214-
const libs = ts.sys.readDirectory(
215-
path.resolve(tsPath, 'lib'),
216-
/*extensions*/ ['.d.ts'],
217-
/*exclude*/ ['typescript.d.ts'],
218-
/*include*/ ['lib.*'],
219-
/*depth*/ 1
220-
);
221-
const output: LibFile[] = [];
222-
for (const fileName of libs) {
223-
const contents = ts.sys.readFile(fileName, 'utf8');
224-
if (contents) output.push({ filename: path.basename(fileName), contents });
225-
}
226-
return output;
227-
};
228-
229203
const resolveConfig = (params: ProgramFactoryParams, system: ts.System): ts.ParsedCommandLine => {
230204
const text = system.readFile(params.configPath, 'utf8') || '{}';
231205
const parseResult = ts.parseConfigFileTextToJson(params.configPath, text);

0 commit comments

Comments
 (0)