javascript

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
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()
View Source
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.

View Source
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.

View Source
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

View Source
var Extensions = []string{".js", ".jsx", ".mjs", ".cjs"}

Extensions lists all file extensions handled by the JavaScript grammar.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL