rollup-plugin-typescript2
Advanced tools
Comparing version 0.8.4 to 0.9.0
@@ -12,4 +12,4 @@ import { IRollupContext } from "./context"; | ||
transform(this: IRollupContext, code: string, id: string): ICode | undefined; | ||
ongenerate(bundleOptions: any): void; | ||
ongenerate(): void; | ||
onwrite({dest, file}: IRollupOptions): void; | ||
}; |
import { IContext } from "./context"; | ||
import { IDiagnostics } from "./tscache"; | ||
export declare function printDiagnostics(context: IContext, diagnostics: IDiagnostics[]): void; | ||
export declare function printDiagnostics(context: IContext, diagnostics: IDiagnostics[], pretty: boolean): void; |
@@ -10,2 +10,3 @@ import { IContext } from "./context"; | ||
flatMessage: string; | ||
formatted: string; | ||
fileLine?: string; | ||
@@ -12,0 +13,0 @@ category: tsTypes.DiagnosticCategory; |
{ | ||
"name": "rollup-plugin-typescript2", | ||
"version": "0.8.4", | ||
"version": "0.9.0", | ||
"description": "Seamless integration between Rollup and TypeScript. Now with errors.", | ||
@@ -56,3 +56,3 @@ "main": "dist/rollup-plugin-typescript2.cjs.js", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.52.0", | ||
"rollup": "^0.52.2", | ||
"rollup-plugin-typescript2": "github:ezolenko/rollup-plugin-typescript2#master", | ||
@@ -59,0 +59,0 @@ "rollup-plugin-node-resolve": "^3.0.0", |
@@ -25,4 +25,3 @@ import { RollupContext } from "./rollupcontext"; | ||
let watchMode = false; | ||
let round = 0; | ||
let targetCount = 0; | ||
let generateRound = 0; | ||
let rollupOptions: IRollupOptions; | ||
@@ -79,2 +78,7 @@ let context: ConsoleContext; | ||
watchMode = process.env.ROLLUP_WATCH === "true"; | ||
if (watchMode) | ||
context.info(`running in watch mode`); | ||
parsedConfig = parseTsConfig(pluginOptions.tsconfig, context, pluginOptions); | ||
@@ -125,3 +129,3 @@ | ||
if (pluginOptions.check) | ||
printDiagnostics(context, convertDiagnostic("options", service.getCompilerOptionsDiagnostics())); | ||
printDiagnostics(context, convertDiagnostic("options", service.getCompilerOptionsDiagnostics()), parsedConfig.options.pretty === true); | ||
@@ -176,2 +180,4 @@ if (pluginOptions.clean) | ||
{ | ||
generateRound = 0; // in watch mode transform call resets generate count (used to avoid printing too many copies of the same error messages) | ||
if (!filter(id)) | ||
@@ -204,3 +210,3 @@ return undefined; | ||
); | ||
printDiagnostics(contextWrapper, diagnostics); | ||
printDiagnostics(contextWrapper, diagnostics, parsedConfig.options.pretty === true); | ||
@@ -240,3 +246,3 @@ // since no output was generated, aborting compilation | ||
printDiagnostics(contextWrapper, diagnostics); | ||
printDiagnostics(contextWrapper, diagnostics, parsedConfig.options.pretty === true); | ||
} | ||
@@ -255,17 +261,8 @@ | ||
ongenerate(bundleOptions: any): void | ||
ongenerate(): void | ||
{ | ||
targetCount = _.get(bundleOptions, "targets.length", 1); | ||
context.debug(() => `generating target ${generateRound + 1}`); | ||
if (round >= targetCount) // ongenerate() is called for each target | ||
if (watchMode && generateRound === 0) | ||
{ | ||
watchMode = true; | ||
round = 0; | ||
} | ||
context.debug(() => `generating target ${round + 1} of ${targetCount}`); | ||
if (watchMode && round === 0) | ||
{ | ||
context.debug("running in watch mode"); | ||
cache().walkTree((id) => | ||
@@ -281,3 +278,3 @@ { | ||
printDiagnostics(context, diagnostics); | ||
printDiagnostics(context, diagnostics, parsedConfig.options.pretty === true); | ||
}); | ||
@@ -287,7 +284,7 @@ } | ||
if (!watchMode && !noErrors) | ||
context.info(yellow("there were errors or warnings above.")); | ||
context.info(yellow("there were errors or warnings.")); | ||
cache().done(); | ||
round++; | ||
generateRound++; | ||
}, | ||
@@ -294,0 +291,0 @@ |
@@ -23,3 +23,3 @@ import { tsModule } from "./tsproxy"; | ||
{ | ||
printDiagnostics(context, convertDiagnostic("config", [result.error])); | ||
printDiagnostics(context, convertDiagnostic("config", [result.error]), _.get(result.config, "pretty", false)); | ||
throw new Error(`failed to parse ${fileName}`); | ||
@@ -26,0 +26,0 @@ } |
@@ -7,3 +7,3 @@ import { tsModule } from "./tsproxy"; | ||
export function printDiagnostics(context: IContext, diagnostics: IDiagnostics[]): void | ||
export function printDiagnostics(context: IContext, diagnostics: IDiagnostics[], pretty: boolean): void | ||
{ | ||
@@ -37,7 +37,12 @@ _.each(diagnostics, (diagnostic) => | ||
if (diagnostic.fileLine) | ||
print.call(context, [`${diagnostic.fileLine}: ${type}${category} TS${diagnostic.code} ${color(diagnostic.flatMessage)}`]); | ||
if (pretty) | ||
print.call(context, [`${diagnostic.formatted}`]); | ||
else | ||
print.call(context, [`${type}${category} TS${diagnostic.code} ${color(diagnostic.flatMessage)}`]); | ||
{ | ||
if (diagnostic.fileLine !== undefined) | ||
print.call(context, [`${diagnostic.fileLine}: ${type}${category} TS${diagnostic.code} ${color(diagnostic.flatMessage)}`]); | ||
else | ||
print.call(context, [`${type}${category} TS${diagnostic.code} ${color(diagnostic.flatMessage)}`]); | ||
} | ||
}); | ||
} |
@@ -11,2 +11,3 @@ import { IContext } from "./context"; | ||
import { emptyDirSync } from "fs-extra"; | ||
import { formatHost } from "./diagnostics-format-host"; | ||
@@ -28,2 +29,3 @@ export interface ICode | ||
flatMessage: string; | ||
formatted: string; | ||
fileLine?: string; | ||
@@ -48,2 +50,3 @@ category: tsTypes.DiagnosticCategory; | ||
flatMessage: tsModule.flattenDiagnosticMessageText(diagnostic.messageText, "\n"), | ||
formatted: tsModule.formatDiagnosticsWithColorAndContext(data, formatHost), | ||
category: diagnostic.category, | ||
@@ -57,3 +60,3 @@ code: diagnostic.code, | ||
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); | ||
entry.fileLine = `${diagnostic.file.fileName} (${line + 1},${character + 1})`; | ||
entry.fileLine = `${diagnostic.file.fileName}(${line + 1},${character + 1})`; | ||
} | ||
@@ -67,3 +70,3 @@ | ||
{ | ||
private cacheVersion = "6"; | ||
private cacheVersion = "7"; | ||
private dependencyTree: Graph; | ||
@@ -70,0 +73,0 @@ private ambientTypes: ITypeSnapshot[]; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
3255654
41
38329
14