rollup-plugin-typescript2
Advanced tools
Comparing version 0.11.0 to 0.11.1
@@ -5,3 +5,3 @@ export interface ICache<DataType> { | ||
match(names: string[]): boolean; | ||
read(name: string): DataType; | ||
read(name: string): DataType | null | undefined; | ||
write(name: string, data: DataType): void; | ||
@@ -8,0 +8,0 @@ touch(name: string): void; |
@@ -29,3 +29,3 @@ import { ICache } from "./icache"; | ||
*/ | ||
read(name: string): DataType; | ||
read(name: string): DataType | null | undefined; | ||
write(name: string, data: DataType): void; | ||
@@ -32,0 +32,0 @@ touch(name: string): void; |
{ | ||
"name": "rollup-plugin-typescript2", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"description": "Seamless integration between Rollup and TypeScript. Now with errors.", | ||
@@ -5,0 +5,0 @@ "main": "dist/rollup-plugin-typescript2.cjs.js", |
@@ -9,3 +9,3 @@ export interface ICache <DataType> | ||
read(name: string): DataType; | ||
read(name: string): DataType | null | undefined; | ||
@@ -12,0 +12,0 @@ write(name: string, data: DataType): void; |
@@ -65,8 +65,8 @@ import { ICache } from "./icache"; | ||
*/ | ||
public read(name: string): DataType | ||
public read(name: string): DataType | null | undefined | ||
{ | ||
if (this.checkNewCache && existsSync(`${this.newCacheRoot}/${name}`)) | ||
return readJsonSync(`${this.newCacheRoot}/${name}`, { encoding: "utf8" }); | ||
return readJsonSync(`${this.newCacheRoot}/${name}`, { encoding: "utf8", throws: false }); | ||
return readJsonSync(`${this.oldCacheRoot}/${name}`, { encoding: "utf8" }); | ||
return readJsonSync(`${this.oldCacheRoot}/${name}`, { encoding: "utf8", throws: false }); | ||
} | ||
@@ -73,0 +73,0 @@ |
@@ -149,17 +149,21 @@ import { IContext } from "./context"; | ||
if (!this.codeCache.exists(name) || this.isDirty(id, false)) | ||
if (this.codeCache.exists(name) && !this.isDirty(id, false)) | ||
{ | ||
this.context.debug(yellow(" cache miss")); | ||
const transformedData = transform(); | ||
this.codeCache.write(name, transformedData); | ||
this.markAsDirty(id); | ||
return transformedData; | ||
this.context.debug(green(" cache hit")); | ||
const data = this.codeCache.read(name); | ||
if (data) | ||
{ | ||
this.codeCache.write(name, data); | ||
return data; | ||
} | ||
else | ||
this.context.warn(yellow(" cache broken, discarding")); | ||
} | ||
this.context.debug(green(" cache hit")); | ||
this.context.debug(yellow(" cache miss")); | ||
const data = this.codeCache.read(name); | ||
this.codeCache.write(name, data); | ||
return data; | ||
const transformedData = transform(); | ||
this.codeCache.write(name, transformedData); | ||
this.markAsDirty(id); | ||
return transformedData; | ||
} | ||
@@ -201,17 +205,22 @@ | ||
if (!cache.exists(name) || this.isDirty(id, true)) | ||
if (cache.exists(name) && !this.isDirty(id, true)) | ||
{ | ||
this.context.debug(yellow(" cache miss")); | ||
this.context.debug(green(" cache hit")); | ||
const convertedData = convertDiagnostic(type, check()); | ||
cache.write(name, convertedData); | ||
this.markAsDirty(id); | ||
return convertedData; | ||
const data = cache.read(name); | ||
if (data) | ||
{ | ||
cache.write(name, data); | ||
return data; | ||
} | ||
else | ||
this.context.warn(yellow(" cache broken, discarding")); | ||
} | ||
this.context.debug(green(" cache hit")); | ||
this.context.debug(yellow(" cache miss")); | ||
const data = cache.read(name); | ||
cache.write(name, data); | ||
return data; | ||
const convertedData = convertDiagnostic(type, check()); | ||
cache.write(name, convertedData); | ||
this.markAsDirty(id); | ||
return convertedData; | ||
} | ||
@@ -218,0 +227,0 @@ |
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
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
3263756
38446