build/lib/treeshaking.ts/shake
export function shake(options: ITreeShakingOptions): ITreeShakingResult {
	const ts = require('typescript') as typeof import('typescript');
	const languageService = createTypeScriptLanguageService(ts, options);
	const program = languageService.getProgram()!;

	const globalDiagnostics = program.getGlobalDiagnostics();
	if (globalDiagnostics.length > 0) {
		printDiagnostics(options, globalDiagnostics);
		throw new Error(`Compilation Errors encountered.`);
	}

	const syntacticDiagnostics = program.getSyntacticDiagnostics();
	if (syntacticDiagnostics.length > 0) {
		printDiagnostics(options, syntacticDiagnostics);
		throw new Error(`Compilation Errors encountered.`);
	}

	const semanticDiagnostics = program.getSemanticDiagnostics();
	if (semanticDiagnostics.length > 0) {
		printDiagnostics(options, semanticDiagnostics);
		throw new Error(`Compilation Errors encountered.`);
	}

	markNodes(ts, languageService, options);

	return generateResult(ts, languageService, options.shakeLevel);
}