build/lib/treeshaking.ts/processLibFiles
function processLibFiles(ts: typeof import('typescript'), options: ITreeShakingOptions): ILibMap {

	const stack: string[] = [...options.compilerOptions.lib];
	const result: ILibMap = {};

	while (stack.length > 0) {
		const filename = `lib.${stack.shift()!.toLowerCase()}.d.ts`;
		const key = `defaultLib:${filename}`;
		if (!result[key]) {
			// add this file
			const filepath = path.join(TYPESCRIPT_LIB_FOLDER, filename);
			const sourceText = fs.readFileSync(filepath).toString();
			result[key] = sourceText;

			// precess dependencies and "recurse"
			const info = ts.preProcessFile(sourceText);
			for (const ref of info.libReferenceDirectives) {
				stack.push(ref.fileName);
			}
		}
	}

	return result;
}