diff --git a/index.d.ts b/index.d.ts index 42226a4..61e796f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,5 @@ export default precinct; -export type PrecinctOptions = Partial>> & { +export type PrecinctOptions = Record & { type?: string; walker?: Record; }; @@ -10,7 +10,7 @@ export type PaperworkOptions = PrecinctOptions & { }; }; /** - * @typedef {Partial>> & { + * @typedef {Record & { * type?: string, * walker?: Record * }} PrecinctOptions @@ -30,6 +30,7 @@ export type PaperworkOptions = PrecinctOptions & { */ declare function precinct(content: string | Record, options?: PrecinctOptions): string[]; declare namespace precinct { + let ast: Record | null; /** * Returns the dependencies for the given file path * diff --git a/index.js b/index.js index c19285f..16f2b06 100644 --- a/index.js +++ b/index.js @@ -18,7 +18,7 @@ import detectiveVue from 'detective-vue2'; const debug = debuglog('precinct'); /** - * @typedef {Partial>> & { + * @typedef {Record & { * type?: string, * walker?: Record * }} PrecinctOptions @@ -88,6 +88,13 @@ function precinct(content, options = {}) { return dependencies; } +/** + * The last AST produced by precinct, or null when parsing failed + * + * @type {Record | null} + */ +precinct.ast = null; + /** * Returns the dependencies for the given file path *