Comparing version 0.0.6 to 0.0.7
@@ -22,5 +22,5 @@ /// <reference types="node" /> | ||
compile(relativeTsPath?: string): Promise<any>; | ||
buildCachedScripts(relativeTsPath: string, cachedDir: string, jsFileName: string): Promise<Buffer[]>; | ||
buildCachedScripts(relativeTsPath: string, cachedFile: string): Promise<Buffer[]>; | ||
wasModified(tsFilePath: string, jsFilePath: string): Promise<boolean>; | ||
} | ||
export declare const tsImport: Compiler; |
@@ -96,3 +96,3 @@ "use strict"; | ||
// Cache is incorrect, rebuild. | ||
return [4 /*yield*/, this.buildCachedScripts(relativeTsPath, cachedDir, jsFileName)]; | ||
return [4 /*yield*/, this.buildCachedScripts(relativeTsPath, cachedFile)]; | ||
case 2: | ||
@@ -110,3 +110,3 @@ // Cache is incorrect, rebuild. | ||
// Build cache. | ||
return [4 /*yield*/, this.buildCachedScripts(relativeTsPath, cachedDir, jsFileName)]; | ||
return [4 /*yield*/, this.buildCachedScripts(relativeTsPath, cachedFile)]; | ||
case 4: | ||
@@ -120,8 +120,8 @@ // Build cache. | ||
}; | ||
Compiler.prototype.buildCachedScripts = function (relativeTsPath, cachedDir, jsFileName) { | ||
Compiler.prototype.buildCachedScripts = function (relativeTsPath, cachedFile) { | ||
var flags = this.options.flags; | ||
this.options.logger.info("Compiling " + relativeTsPath + " to " + cachedDir + "/" + jsFileName + "..."); | ||
this.options.logger.info("Compiling " + relativeTsPath + " to " + cachedFile + "..."); | ||
return Promise.all([ | ||
// Compile new scripts.ts to .js. | ||
childProcess.execSync("tsc " + relativeTsPath + " --outDir " + cachedDir + " " + flags.join(' '), { | ||
childProcess.execSync("tsc " + relativeTsPath + " --outFile " + cachedFile + " " + flags.join(' '), { | ||
stdio: 'inherit' | ||
@@ -128,0 +128,0 @@ }), |
{ | ||
"name": "ts-import", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"license": "GPL-3.0", | ||
@@ -5,0 +5,0 @@ "author": "Artur Kurowski <radarsu@gmail.com>", |
@@ -60,3 +60,3 @@ import * as childProcess from 'child_process'; | ||
// Cache is incorrect, rebuild. | ||
await this.buildCachedScripts(relativeTsPath, cachedDir, jsFileName); | ||
await this.buildCachedScripts(relativeTsPath, cachedFile); | ||
return import(cachedFile); | ||
@@ -73,14 +73,14 @@ } | ||
// Build cache. | ||
await this.buildCachedScripts(relativeTsPath, cachedDir, jsFileName); | ||
await this.buildCachedScripts(relativeTsPath, cachedFile); | ||
return import(cachedFile); | ||
} | ||
buildCachedScripts(relativeTsPath: string, cachedDir: string, jsFileName: string) { | ||
buildCachedScripts(relativeTsPath: string, cachedFile: string) { | ||
const { flags } = this.options; | ||
this.options.logger.info(`Compiling ${relativeTsPath} to ${cachedDir}/${jsFileName}...`); | ||
this.options.logger.info(`Compiling ${relativeTsPath} to ${cachedFile}...`); | ||
return Promise.all([ | ||
// Compile new scripts.ts to .js. | ||
childProcess.execSync(`tsc ${relativeTsPath} --outDir ${cachedDir} ${flags.join(' ')}`, { | ||
childProcess.execSync(`tsc ${relativeTsPath} --outFile ${cachedFile} ${flags.join(' ')}`, { | ||
stdio: 'inherit', | ||
@@ -87,0 +87,0 @@ }), |
14589