Comparing version 1.0.78 to 1.0.79
@@ -71,7 +71,9 @@ "use strict"; | ||
__extends(SemanticHost, _super); | ||
function SemanticHost(files, compilerOptions) { | ||
function SemanticHost(files, compilerOptions, libDir) { | ||
if (compilerOptions === void 0) { compilerOptions = configuration_1.defaultCompilerOptions; } | ||
if (libDir === void 0) { libDir = 'node_modules'; } | ||
_super.call(this); | ||
this.files = files; | ||
this.compilerOptions = compilerOptions; | ||
this.libDir = libDir; | ||
} | ||
@@ -104,14 +106,6 @@ SemanticHost.prototype.getProjectVersion = function () { | ||
var _this = this; | ||
var containingDir = getDirectoryPath(containingFile); | ||
return moduleNames.map(function (moduleName) { | ||
var resolvedBase = normalizePath(combinePaths(containingDir, moduleName)); | ||
return { | ||
resolvedFileName: _this.tryResolveFileName(resolvedBase + '.tsx') || _this.tryResolveFileName(resolvedBase + '.ts'), | ||
isExternalLibraryImport: false | ||
}; | ||
return ts.nodeModuleNameResolver(moduleName, containingFile, _this.compilerOptions, _this).resolvedModule; | ||
}); | ||
}; | ||
SemanticHost.prototype.tryResolveFileName = function (candidate) { | ||
return this.source.fileExists(candidate) ? candidate : null; | ||
}; | ||
SemanticHost.prototype.directoryExists = function (directoryName) { | ||
@@ -118,0 +112,0 @@ return null; |
{ | ||
"private": false, | ||
"name": "tspoon", | ||
"version": "1.0.78", | ||
"version": "1.0.79", | ||
"description": "see README.md", | ||
@@ -6,0 +6,0 @@ "main": "./dist/src/index.js", |
@@ -68,3 +68,5 @@ import * as ts from 'typescript'; | ||
constructor(private files:string[], | ||
private compilerOptions:ts.CompilerOptions = defaultCompilerOptions) { | ||
private compilerOptions:ts.CompilerOptions = defaultCompilerOptions, | ||
private libDir: string = 'node_modules' | ||
) { | ||
super(); | ||
@@ -108,16 +110,7 @@ } | ||
resolveModuleNames(moduleNames:string[], containingFile:string):ts.ResolvedModule[] { | ||
const containingDir:string = getDirectoryPath(containingFile); | ||
return moduleNames.map((moduleName:string) => { | ||
const resolvedBase:string = normalizePath(combinePaths(containingDir, moduleName)); | ||
return { | ||
resolvedFileName: this.tryResolveFileName(resolvedBase + '.tsx') || this.tryResolveFileName(resolvedBase + '.ts'), | ||
isExternalLibraryImport: false | ||
} | ||
return ts.nodeModuleNameResolver(moduleName, containingFile, this.compilerOptions, this).resolvedModule; | ||
}); | ||
} | ||
private tryResolveFileName(candidate:string):string { | ||
return this.source.fileExists(candidate) ? candidate : null; | ||
} | ||
directoryExists(directoryName:string):boolean { | ||
@@ -124,0 +117,0 @@ return null; |
@@ -170,3 +170,5 @@ import {expect} from 'chai'; | ||
`), | ||
new MockModule('node_modules/lib/index.ts', ''), | ||
new MockModule('index.ts', ` | ||
import * as lib from 'lib'; | ||
import {default as SomeClass} from './a'; | ||
@@ -173,0 +175,0 @@ const a: SomeClass = null; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1708603
23397