Skip to content

Commit

Permalink
fix: remove debug statement + set compiler host only when not overrid…
Browse files Browse the repository at this point in the history
…den.
  • Loading branch information
marcj committed Apr 16, 2023
1 parent dc3abbc commit 713bd1c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/type-compiler/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ export class ReflectionTransformer implements CustomTransformer {
protected typeChecker?: TypeChecker;
protected resolver: Resolver;
protected host: CompilerHost;
protected overriddenHost = false;

protected compilerOptions: CompilerOptions;

Expand All @@ -550,6 +551,7 @@ export class ReflectionTransformer implements CustomTransformer {
forHost(host: CompilerHost): this {
this.host = host;
this.resolver.host = host;
this.overriddenHost = true;
return this;
}

Expand Down Expand Up @@ -606,9 +608,10 @@ export class ReflectionTransformer implements CustomTransformer {
}
}
}

this.host = createCompilerHost(this.compilerOptions);
this.resolver = new Resolver(this.compilerOptions, this.host);
if (!this.overriddenHost) {
this.host = createCompilerHost(this.compilerOptions);
this.resolver = new Resolver(this.compilerOptions, this.host);
}

this.addImports = [];
this.sourceFile = sourceFile;
Expand All @@ -618,7 +621,6 @@ export class ReflectionTransformer implements CustomTransformer {
let basePath = this.config.compilerOptions.configFilePath as string;
if (basePath) {
basePath = dirname(basePath);
debugger;
if (!this.reflectionMode && currentConfig.reflection !== undefined) this.reflectionMode = this.parseReflectionMode(currentConfig.reflection, basePath);
if (!this.compilerOptions && currentConfig.reflectionOptions !== undefined) this.reflectionOptions = this.parseReflectionOptionsDefaults(currentConfig.reflectionOptions);
while ((this.reflectionMode === undefined || this.compilerOptions === undefined) && 'string' === typeof basePath && currentConfig.extends) {
Expand Down
1 change: 1 addition & 0 deletions packages/type/tests/compiler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function transpile<T extends string | Record<string, string>>(files: T, o
...options
};

process.env['DEBUG'] = 'deepkit';
if ('string' === typeof files) {
return transpileModule(files, {
fileName: __dirname + '/module.ts',
Expand Down

0 comments on commit 713bd1c

Please sign in to comment.