Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default precinct;
export type PrecinctOptions = Partial<Record<string, Record<string, any>>> & {
export type PrecinctOptions = Record<string, unknown> & {
type?: string;
walker?: Record<string, any>;
};
Expand All @@ -10,7 +10,7 @@ export type PaperworkOptions = PrecinctOptions & {
};
};
/**
* @typedef {Partial<Record<string, Record<string, any>>> & {
* @typedef {Record<string, unknown> & {
* type?: string,
* walker?: Record<string, any>
* }} PrecinctOptions
Expand All @@ -30,6 +30,7 @@ export type PaperworkOptions = PrecinctOptions & {
*/
declare function precinct(content: string | Record<string, any>, options?: PrecinctOptions): string[];
declare namespace precinct {
let ast: Record<string, any> | null;
/**
* Returns the dependencies for the given file path
*
Expand Down
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import detectiveVue from 'detective-vue2';
const debug = debuglog('precinct');

/**
* @typedef {Partial<Record<string, Record<string, any>>> & {
* @typedef {Record<string, unknown> & {
* type?: string,
* walker?: Record<string, any>
* }} PrecinctOptions
Expand Down Expand Up @@ -88,6 +88,13 @@ function precinct(content, options = {}) {
return dependencies;
}

/**
* The last AST produced by precinct, or null when parsing failed
*
* @type {Record<string, any> | null}
*/
precinct.ast = null;

/**
* Returns the dependencies for the given file path
*
Expand Down