@codeque/core
Version:
Multiline code search for every language. Structural code search for JavaScript, TypeScript, HTML and CSS
27 lines (26 loc) • 1.32 kB
TypeScript
import type { Tree } from 'web-tree-sitter';
import { PoorNodeType, TreeSitterNodeFieldsMeta } from './types';
export declare type PostProcessNodes = Record<string, (node: PoorNodeType, codeText: string) => PoorNodeType>;
export declare function collectAstFromTree({ tree, codeText, defineRawValueForNodeTypes, nodeFieldsMeta, postProcessNodes, }: {
tree: Tree;
codeText: string;
defineRawValueForNodeTypes: string[];
nodeFieldsMeta: TreeSitterNodeFieldsMeta;
postProcessNodes?: PostProcessNodes;
}): PoorNodeType | null;
export declare const getFilePaths: (parserName: string) => {
treeSitterWasm: string;
parserWasm: string;
fieldsMeta: string;
};
export declare const getFieldsMeta: (basePath: string, path: string) => Promise<TreeSitterNodeFieldsMeta>;
export declare const getTreeSitterWasmPath: (basePath: string, parserPath: string) => string;
export declare const sanitizeFsPath: (fsPath: string) => string;
export declare const treeSitterParserModuleFactory: ({ treeSitterParserName, defineRawValueForNodeTypes, postProcessNodes, }: {
treeSitterParserName: string;
defineRawValueForNodeTypes: string[];
postProcessNodes?: PostProcessNodes | undefined;
}) => {
init: (basePathOption?: string | undefined) => Promise<void>;
parse: (code: string) => PoorNodeType;
};