Documentation
¶
Index ¶
Constants ¶
const CallQueries = `` /* 159-byte string literal not displayed */
CallQueries captures direct function and method call sites in JavaScript. Matches:
- plain calls: foo()
- method/selector calls: obj.method()
const JSXCallQueries = CallQueries + `
(jsx_opening_element
name: (identifier) @callee) @call
(jsx_self_closing_element
name: (identifier) @callee) @call
`
JSXCallQueries extends CallQueries with JSX element patterns for JSX files. Matches everything CallQueries matches, plus:
- JSX opening elements: <MyComponent prop={x}>
- JSX self-closing elements: <MyComponent />
Note: lowercase-initial JSX identifiers (native HTML tags such as <div>, <span>, <input>) are filtered out at runtime in runCallQuery so that only user-defined component names (PascalCase / uppercase-initial) are recorded as call references.
These patterns are intentionally separated from CallQueries because jsx_opening_element and jsx_self_closing_element are only valid node types in the JSX-enabled JavaScript grammar — compiling them against the plain JavaScript grammar may produce a query compilation error depending on the grammar version.
const Queries = `` /* 644-byte string literal not displayed */
Queries contains tree-sitter query patterns for JavaScript symbol extraction. Covers: function declarations, var/let/const assignments, class declarations, methods (including static/async), object shorthand methods, export default function/class, and module.exports.x = function() assignments.
const RefQueries = `` /* 137-byte string literal not displayed */
RefQueries captures identifiers used as values (not called directly) in:
- object/array literal properties: { handler: myFn }
- variable declarators: const f = myFn / let f = myFn / var f = myFn
- assignment expressions: f = myFn
Combined with CallQueries in ExtractCalls so functions passed as values are recorded as "used" and do not appear as dead code.
Variables ¶
var Extensions = []string{".js", ".jsx", ".mjs", ".cjs"}
Extensions lists all file extensions handled by the JavaScript grammar.
var Language = tree_sitter.NewLanguage(tree_sitter_javascript.Language())
Language is the single shared tree-sitter language instance for JavaScript. It is allocated once and reused across all extensions.
Functions ¶
This section is empty.
Types ¶
This section is empty.