<commit_before>/* */
import * as ts from 'typescript';
import Logger from './logger';
import {CompilerHost} from './compiler-host';
import {Transpiler} from './transpiler';
import {TypeChecker} from './type-checker';
import {formatErrors} from './format-errors';
import {isTypescriptDeclaration} from "./utils";

let logger = new Logger({ debug: false });

interface FactoryOutput {
	 host: CompilerHost;
	 transpiler: Transpiler;
	 typeChecker: TypeChecker;
	 options: PluginOptions;
}

/*
	This code looks a lot better with async functions...
*/
export function createFactory(sjsconfig: PluginOptions, _resolve: ResolveFunction, _fetch: FetchFunction): Promise<FactoryOutput> {
	let tsconfigFiles = [];
	let typingsFiles = [];

	return loadOptions(sjsconfig, _resolve, _fetch)
		.then(options => {
			return createServices(options, _resolve, _fetch);
		})
		.then(services => {
			if (services.options.typeCheck) {
				return resolveDeclarationFiles(services.options, _resolve)
					.then(resolvedFiles => {
						resolvedFiles.forEach(resolvedFile => {
							services.typeChecker.registerDeclarationFile(resolvedFile, false);
						});
						return services;<commit_msg>default sjsconfig to {}<commit_after>/* */
import * as ts from 'typescript';
import Logger from './logger';
import {CompilerHost} from './compiler-host';
import {Transpiler} from './transpiler';
import {TypeChecker} from './type-checker';
import {formatErrors} from './format-errors';
import {isTypescriptDeclaration} from "./utils";

let logger = new Logger({ debug: false });

interface FactoryOutput {
	 host: CompilerHost;
	 transpiler: Transpiler;
	 typeChecker: TypeChecker;
	 options: PluginOptions;
}

/*
	This code looks a lot better with async functions...
*/
export function createFactory(sjsconfig: PluginOptions = {}, _resolve: ResolveFunction, _fetch: FetchFunction): Promise<FactoryOutput> {
	let tsconfigFiles = [];
	let typingsFiles = [];

	return loadOptions(sjsconfig, _resolve, _fetch)
		.then(options => {
			return createServices(options, _resolve, _fetch);
		})
		.then(services => {
			if (services.options.typeCheck) {
				return resolveDeclarationFiles(services.options, _resolve)
					.then(resolvedFiles => {
						resolvedFiles.forEach(resolvedFile => {
							services.typeChecker.registerDeclarationFile(resolvedFile, false);
						});
						return services;
{'fraction_non_alphanumeric': 0.12653406686415575, 'fraction_numerical': 0.0, 'mean_word_length': 4.6826923076923075, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6149978', 'n_tokens_mistral': 737, 'n_tokens_neox': 659, 'n_words': 180}