mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
docs(cache): add/change some comments for clarity (#357)
- use typedoc for `isDirty` comment so that it actually appears in IDEs etc
- and use `@returns` typedoc annotation for better specification
- modify the comment a little for better grammar: 3 "or"s and no commas -> 1 "or" and commas
- use more accurate terminology: "global types" -> "ambient types"
- that's also more consistent in this codebase itself, where there's a legit function named `checkAmbientTypes`
- in `init`, specify that the `RollingCache` error should never actually happen
- I was a bit confused by when this would happen, then checked the constructor, and the answer is basically never: it's an invariant / redundant error-check
- also add a new line for style consistency
This commit is contained in:
parent
045560cd37
commit
a3c26998a4
@ -313,8 +313,10 @@ export class TsCache
|
||||
}
|
||||
else
|
||||
{
|
||||
// this is an invariant, it should never happen: cacheDir should only not exist when noCache
|
||||
if (this.cacheDir === undefined)
|
||||
throw new Error(`this.cacheDir undefined`);
|
||||
|
||||
this.codeCache = new RollingCache<ICode>(`${this.cacheDir}/code`, true);
|
||||
this.typesCache = new RollingCache<string>(`${this.cacheDir}/types`, true);
|
||||
this.syntacticDiagnosticsCache = new RollingCache<IDiagnostics[]>(`${this.cacheDir}/syntacticDiagnostics`, true);
|
||||
@ -327,7 +329,7 @@ export class TsCache
|
||||
this.dependencyTree.setNode(id, { dirty: true });
|
||||
}
|
||||
|
||||
// returns true if node or any of its imports or any of global types changed
|
||||
/** @returns true if node, any of its imports, or any ambient types changed */
|
||||
private isDirty(id: string, checkImports: boolean): boolean
|
||||
{
|
||||
const label = this.dependencyTree.node(id) as INodeLabel;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user