Comparing version 0.0.9-0 to 0.0.9-1
@@ -21,3 +21,3 @@ /// <reference types="node" /> | ||
*/ | ||
compile(absoluteTsPath?: string): Promise<any>; | ||
compile(tsPath?: string): Promise<any>; | ||
buildCachedScripts(absoluteTsPath: string): Promise<Buffer[]>; | ||
@@ -24,0 +24,0 @@ wasModified(tsFilePath: string, jsFilePath: string): Promise<boolean>; |
@@ -74,6 +74,6 @@ "use strict"; | ||
*/ | ||
Compiler.prototype.compile = function (absoluteTsPath) { | ||
if (absoluteTsPath === void 0) { absoluteTsPath = ""; } | ||
Compiler.prototype.compile = function (tsPath) { | ||
if (tsPath === void 0) { tsPath = ""; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var cacheDir, tsPathArr, tsFileName, jsFileName, tsDir, cachedDir, cachedFile, tsWasModified; | ||
var cacheDir, absoluteTsPath, tsFileName, jsFileName, absoluteTsDir, cachedDir, cachedFile, tsWasModified; | ||
return __generator(this, function (_a) { | ||
@@ -83,7 +83,7 @@ switch (_a.label) { | ||
cacheDir = this.options.cacheDir; | ||
tsPathArr = absoluteTsPath.split('/'); | ||
tsFileName = tsPathArr.pop(); | ||
absoluteTsPath = path.resolve(process.cwd(), tsPath); | ||
tsFileName = path.basename(absoluteTsPath); | ||
jsFileName = tsFileName.replace(/\.[^/.]+$/, ".js"); | ||
tsDir = tsPathArr.join('/'); | ||
cachedDir = path.resolve(cacheDir, tsDir); | ||
absoluteTsDir = path.dirname(absoluteTsPath); | ||
cachedDir = path.resolve(cacheDir, absoluteTsDir); | ||
cachedFile = path.resolve(cachedDir, jsFileName); | ||
@@ -90,0 +90,0 @@ if (!fs.existsSync(cachedFile)) return [3 /*break*/, 3]; |
{ | ||
"name": "ts-import", | ||
"version": "0.0.9-0", | ||
"version": "0.0.9-1", | ||
"license": "GPL-3.0", | ||
@@ -5,0 +5,0 @@ "author": "Artur Kurowski <radarsu@gmail.com>", |
@@ -40,11 +40,12 @@ import * as childProcess from 'child_process'; | ||
*/ | ||
async compile(absoluteTsPath: string = ``): Promise<any> { | ||
async compile(tsPath: string = ``): Promise<any> { | ||
const { cacheDir } = this.options; | ||
const tsPathArr = absoluteTsPath.split('/'); | ||
const tsFileName = tsPathArr.pop(); | ||
const absoluteTsPath = path.resolve(process.cwd(), tsPath); | ||
const tsFileName = path.basename(absoluteTsPath); | ||
const jsFileName = tsFileName.replace(/\.[^/.]+$/, `.js`); | ||
const tsDir = tsPathArr.join('/'); | ||
const absoluteTsDir = path.dirname(absoluteTsPath); | ||
const cachedDir = path.resolve(cacheDir, tsDir); | ||
const cachedDir = path.resolve(cacheDir, absoluteTsDir); | ||
const cachedFile = path.resolve(cachedDir, jsFileName); | ||
@@ -51,0 +52,0 @@ |
15644