From f4cd9b488eee2c4255db71140113828dd42c6a17 Mon Sep 17 00:00:00 2001 From: ezolenko Date: Sat, 25 Mar 2017 00:19:45 -0600 Subject: [PATCH] - removing voodoo code --- dist/rollup-plugin-typescript2.cjs.js | 17 ++++++----------- dist/rollup-plugin-typescript2.es.js | 19 +++++++------------ src/index.ts | 4 ---- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/dist/rollup-plugin-typescript2.cjs.js b/dist/rollup-plugin-typescript2.cjs.js index f2ce939..31f050e 100644 --- a/dist/rollup-plugin-typescript2.cjs.js +++ b/dist/rollup-plugin-typescript2.cjs.js @@ -231,7 +231,7 @@ var RollingCache = (function () { return; this.rolled = true; fs.removeSync(this.oldCacheRoot); - fs.move(this.newCacheRoot, this.oldCacheRoot, function () { }); + fs.renameSync(this.newCacheRoot, this.oldCacheRoot); }; return RollingCache; }()); @@ -534,7 +534,9 @@ function typescript(options) { })); printDiagnostics(contextWrapper, diagnostics); // since no output was generated, aborting compilation - _this.error(colors.red("failed to transpile '" + id + "'")); + cache.done(); + if (_.isFunction(_this.error)) + _this.error(colors.red("failed to transpile '" + id + "'")); } var transpiled = _.find(output.outputFiles, function (entry) { return _.endsWith(entry.name, ".js"); }); var map$$1 = _.find(output.outputFiles, function (entry) { return _.endsWith(entry.name, ".map"); }); @@ -564,20 +566,13 @@ function typescript(options) { context.debug("generating target " + (round + 1) + " of " + targetCount); if (watchMode && round === 0) { context.debug("running in watch mode"); - // hack to fix ts lagging - servicesHost.reset(); - service.cleanupSemanticCache(); cache.walkTree(function (id) { var diagnostics = _.concat(convertDiagnostic("syntax", service.getSyntacticDiagnostics(id)), convertDiagnostic("semantic", service.getSemanticDiagnostics(id))); - if (diagnostics.length > 0) - noErrors = false; printDiagnostics(context, diagnostics); }); - if (!noErrors) { - noErrors = true; - context.info(colors.yellow("there were errors or warnings above.")); - } } + if (!watchMode && !noErrors) + context.info(colors.yellow("there were errors or warnings above.")); cache.done(); round++; }, diff --git a/dist/rollup-plugin-typescript2.es.js b/dist/rollup-plugin-typescript2.es.js index ca2cf62..294f1a2 100644 --- a/dist/rollup-plugin-typescript2.es.js +++ b/dist/rollup-plugin-typescript2.es.js @@ -1,7 +1,7 @@ /* eslint-disable */ import { concat, defaults, each, endsWith, filter, find, get, has, isEqual, isFunction, map, some } from 'lodash'; import * as _ from 'lodash'; -import { emptyDirSync, ensureFileSync, existsSync, move, readFileSync, readJsonSync, readdirSync, removeSync, writeJsonSync } from 'fs-extra'; +import { emptyDirSync, ensureFileSync, existsSync, readFileSync, readJsonSync, readdirSync, removeSync, renameSync, writeJsonSync } from 'fs-extra'; import * as fs from 'fs-extra'; import { DiagnosticCategory, ModuleKind, ScriptSnapshot, createDocumentRegistry, createLanguageService, findConfigFile, flattenDiagnosticMessageText, getAutomaticTypeDirectiveNames, getDefaultLibFilePath, nodeModuleNameResolver, parseConfigFileTextToJson, parseJsonConfigFileContent, resolveTypeReferenceDirective, sys, version } from 'typescript'; import * as ts from 'typescript'; @@ -237,7 +237,7 @@ var RollingCache = (function () { return; this.rolled = true; removeSync(this.oldCacheRoot); - move(this.newCacheRoot, this.oldCacheRoot, function () { }); + renameSync(this.newCacheRoot, this.oldCacheRoot); }; return RollingCache; }()); @@ -540,7 +540,9 @@ function typescript(options) { })); printDiagnostics(contextWrapper, diagnostics); // since no output was generated, aborting compilation - _this.error(red("failed to transpile '" + id + "'")); + cache.done(); + if (isFunction(_this.error)) + _this.error(red("failed to transpile '" + id + "'")); } var transpiled = find(output.outputFiles, function (entry) { return endsWith(entry.name, ".js"); }); var map$$1 = find(output.outputFiles, function (entry) { return endsWith(entry.name, ".map"); }); @@ -570,20 +572,13 @@ function typescript(options) { context.debug("generating target " + (round + 1) + " of " + targetCount); if (watchMode && round === 0) { context.debug("running in watch mode"); - // hack to fix ts lagging - servicesHost.reset(); - service.cleanupSemanticCache(); cache.walkTree(function (id) { var diagnostics = concat(convertDiagnostic("syntax", service.getSyntacticDiagnostics(id)), convertDiagnostic("semantic", service.getSemanticDiagnostics(id))); - if (diagnostics.length > 0) - noErrors = false; printDiagnostics(context, diagnostics); }); - if (!noErrors) { - noErrors = true; - context.info(yellow("there were errors or warnings above.")); - } } + if (!watchMode && !noErrors) + context.info(yellow("there were errors or warnings above.")); cache.done(); round++; }, diff --git a/src/index.ts b/src/index.ts index d6205db..578e7da 100644 --- a/src/index.ts +++ b/src/index.ts @@ -277,10 +277,6 @@ export default function typescript (options: IOptions) { context.debug("running in watch mode"); - // hack to fix ts lagging - servicesHost.reset(); - service.cleanupSemanticCache(); - cache.walkTree((id) => { const diagnostics = _.concat(