Comparing version 3.4.3 to 3.4.4
@@ -67,3 +67,6 @@ "use strict"; | ||
this.getImportDeclarations(subject).forEach(function (i) { | ||
var assumedPath = PathHelper_1.PathHelper.assumePathOfImportedObject(subject, i); | ||
var assumedPath = PathHelper_1.PathHelper.assumePathOfImportedObject(subject.getSourceFile().fileName, i); | ||
if (!assumedPath) { | ||
return; | ||
} | ||
if (DependOnStrategy.hasSuffix(assumedPath, "ts") && | ||
@@ -70,0 +73,0 @@ _this.pathsMatch(assumedPath, object)) { |
@@ -1,6 +0,4 @@ | ||
import { File } from "../../noun/File"; | ||
import { ImportDeclaration } from "typescript"; | ||
import * as ts from "typescript"; | ||
export declare class PathHelper { | ||
static assumePathOfImportedObject(subject: File, i: ImportDeclaration): string; | ||
private static assemblePath; | ||
static assumePathOfImportedObject(subject: string, i: ts.ImportDeclaration): string | undefined; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var path = require("path"); | ||
var ts = require("typescript"); | ||
var PathHelper = /** @class */ (function () { | ||
@@ -8,14 +8,9 @@ function PathHelper() { | ||
PathHelper.assumePathOfImportedObject = function (subject, i) { | ||
var completePath = subject.getPath(); | ||
var assumedPathTokens = completePath.split("/").concat(i.moduleSpecifier["text"].split("/")); | ||
return PathHelper.assemblePath(assumedPathTokens, completePath); | ||
}; | ||
PathHelper.assemblePath = function (tokens, completePath) { | ||
var pathWithoutTrailingSlash = path.join.apply(path, tokens); | ||
if (completePath.startsWith('/')) { | ||
return '/' + pathWithoutTrailingSlash; | ||
var moduleSpecifier = i.moduleSpecifier["text"]; | ||
var completePath = subject; | ||
var resolvedModule = ts.resolveModuleName(moduleSpecifier, completePath, {}, ts.createCompilerHost({}, true)).resolvedModule; | ||
if (!resolvedModule) { | ||
return undefined; | ||
} | ||
else { | ||
return pathWithoutTrailingSlash; | ||
} | ||
return resolvedModule.resolvedFileName; | ||
}; | ||
@@ -22,0 +17,0 @@ return PathHelper; |
{ | ||
"name": "tsarch", | ||
"version": "3.4.3", | ||
"version": "3.4.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
169586
2206