@xberg-io/tree-sitter-language-pack 1.13.1 → 1.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +150 -150
- package/index.js +19 -52
- package/package.json +9 -9
- package/ts-pack-core-node.darwin-arm64.node +0 -0
- package/ts-pack-core-node.darwin-x64.node +0 -0
- package/ts-pack-core-node.linux-arm64-gnu.node +0 -0
- package/ts-pack-core-node.linux-arm64-musl.node +0 -0
- package/ts-pack-core-node.linux-x64-gnu.node +0 -0
- package/ts-pack-core-node.linux-x64-musl.node +0 -0
- package/ts-pack-core-node.win32-arm64-msvc.node +0 -0
- package/ts-pack-core-node.win32-x64-msvc.node +0 -0
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:e0daa4aa08c0f8ff366b6c0739dbb2c201a286cd58fb7cf0091fcc130801eb96
|
|
3
3
|
// To regenerate: alef generate
|
|
4
4
|
// To verify freshness: alef verify --exit-code
|
|
5
5
|
/* eslint-disable */
|
|
@@ -242,59 +242,59 @@ export declare function init(config?: PackConfig | undefined | null): void;
|
|
|
242
242
|
/** A byte range — start (inclusive) to end (exclusive). */
|
|
243
243
|
export interface ByteRange {
|
|
244
244
|
/** Inclusive start byte offset. */
|
|
245
|
-
readonly start: number
|
|
245
|
+
readonly start: number
|
|
246
246
|
/** Exclusive end byte offset. */
|
|
247
|
-
readonly end: number
|
|
247
|
+
readonly end: number
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
/** Metadata for a single chunk of source code. */
|
|
251
251
|
export interface ChunkContext {
|
|
252
252
|
/** Language name used to parse this chunk. */
|
|
253
|
-
readonly language?: string
|
|
253
|
+
readonly language?: string
|
|
254
254
|
/** Zero-indexed position of this chunk within the file's chunk list. */
|
|
255
|
-
readonly chunkIndex?: number
|
|
255
|
+
readonly chunkIndex?: number
|
|
256
256
|
/** Total number of chunks the file was split into. */
|
|
257
|
-
readonly totalChunks?: number
|
|
257
|
+
readonly totalChunks?: number
|
|
258
258
|
/** Tree-sitter node kinds that appear at the top level of this chunk. */
|
|
259
|
-
readonly nodeTypes?: Array<string
|
|
259
|
+
readonly nodeTypes?: Array<string>
|
|
260
260
|
/** Hierarchical path of enclosing structural items (e.g., `["MyClass", "my_method"]`). */
|
|
261
|
-
readonly contextPath?: Array<string
|
|
261
|
+
readonly contextPath?: Array<string>
|
|
262
262
|
/** Names of symbols defined within this chunk. */
|
|
263
|
-
readonly symbolsDefined?: Array<string
|
|
263
|
+
readonly symbolsDefined?: Array<string>
|
|
264
264
|
/** Comments contained within this chunk. */
|
|
265
|
-
readonly comments?: Array<CommentInfo
|
|
265
|
+
readonly comments?: Array<CommentInfo>
|
|
266
266
|
/** Docstrings contained within this chunk. */
|
|
267
|
-
readonly docstrings?: Array<DocstringInfo
|
|
267
|
+
readonly docstrings?: Array<DocstringInfo>
|
|
268
268
|
/** Whether this chunk contains any tree-sitter error nodes. */
|
|
269
|
-
readonly hasErrorNodes?: boolean
|
|
269
|
+
readonly hasErrorNodes?: boolean
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
/** A chunk of source code with rich metadata. */
|
|
273
273
|
export interface CodeChunk {
|
|
274
274
|
/** The raw source text of this chunk. */
|
|
275
|
-
readonly content?: string
|
|
275
|
+
readonly content?: string
|
|
276
276
|
/** Inclusive start byte offset of this chunk in the original source. */
|
|
277
|
-
readonly startByte?: number
|
|
277
|
+
readonly startByte?: number
|
|
278
278
|
/** Exclusive end byte offset of this chunk in the original source. */
|
|
279
|
-
readonly endByte?: number
|
|
279
|
+
readonly endByte?: number
|
|
280
280
|
/** Zero-indexed start line of this chunk. */
|
|
281
|
-
readonly startLine?: number
|
|
281
|
+
readonly startLine?: number
|
|
282
282
|
/** Zero-indexed end line of this chunk. */
|
|
283
|
-
readonly endLine?: number
|
|
283
|
+
readonly endLine?: number
|
|
284
284
|
/** Contextual metadata about this chunk. */
|
|
285
|
-
readonly metadata?: ChunkContext
|
|
285
|
+
readonly metadata?: ChunkContext
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
/** A comment extracted from source code. */
|
|
289
289
|
export interface CommentInfo {
|
|
290
290
|
/** The raw text content of the comment. */
|
|
291
|
-
readonly text?: string
|
|
291
|
+
readonly text?: string
|
|
292
292
|
/** The kind of comment (line, block, or doc). */
|
|
293
|
-
readonly kind?: CommentKind
|
|
293
|
+
readonly kind?: CommentKind
|
|
294
294
|
/** Source span covering the comment. */
|
|
295
|
-
readonly span?: Span
|
|
295
|
+
readonly span?: Span
|
|
296
296
|
/** Name of the syntax node this comment is directly associated with. */
|
|
297
|
-
readonly associatedNode?: string
|
|
297
|
+
readonly associatedNode?: string
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
/**
|
|
@@ -320,11 +320,11 @@ export declare enum CommentKind {
|
|
|
320
320
|
*/
|
|
321
321
|
export interface DataAttribute {
|
|
322
322
|
/** Attribute name (e.g. `"class"`, `"href"`). */
|
|
323
|
-
readonly name?: string
|
|
323
|
+
readonly name?: string
|
|
324
324
|
/** Attribute value as a raw string (quotes stripped). */
|
|
325
|
-
readonly value?: string
|
|
325
|
+
readonly value?: string
|
|
326
326
|
/** Source span covering the entire `name="value"` attribute token. */
|
|
327
|
-
readonly span?: Span
|
|
327
|
+
readonly span?: Span
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
/**
|
|
@@ -344,23 +344,23 @@ export interface DataAttribute {
|
|
|
344
344
|
*/
|
|
345
345
|
export interface DataNode {
|
|
346
346
|
/** Whether this node is a key/value pair, XML element, or sequence item. */
|
|
347
|
-
readonly kind?: DataNodeKind
|
|
347
|
+
readonly kind?: DataNodeKind
|
|
348
348
|
/**
|
|
349
349
|
* Key, attribute name, tag name, or positional index (`"0"`, `"1"`, …).
|
|
350
350
|
* `None` at the document root.
|
|
351
351
|
*/
|
|
352
|
-
readonly key?: string
|
|
352
|
+
readonly key?: string
|
|
353
353
|
/**
|
|
354
354
|
* Leaf scalar value, if any. `None` for containers (objects, arrays, XML elements
|
|
355
355
|
* with child elements).
|
|
356
356
|
*/
|
|
357
|
-
readonly value?: string
|
|
357
|
+
readonly value?: string
|
|
358
358
|
/** Attributes on element-shape nodes (XML `STag` attributes). Empty for all other kinds. */
|
|
359
|
-
readonly attributes?: Array<DataAttribute
|
|
359
|
+
readonly attributes?: Array<DataAttribute>
|
|
360
360
|
/** Children for nested containers and XML element bodies. */
|
|
361
|
-
readonly children?: Array<DataNode
|
|
361
|
+
readonly children?: Array<DataNode>
|
|
362
362
|
/** Source span covering this node in the original source file. */
|
|
363
|
-
readonly span?: Span
|
|
363
|
+
readonly span?: Span
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
/**
|
|
@@ -395,11 +395,11 @@ export declare enum DataNodeKind {
|
|
|
395
395
|
/** A diagnostic (syntax error, missing node, etc.) from parsing. */
|
|
396
396
|
export interface Diagnostic {
|
|
397
397
|
/** Human-readable description of the diagnostic. */
|
|
398
|
-
readonly message?: string
|
|
398
|
+
readonly message?: string
|
|
399
399
|
/** Severity of the diagnostic. */
|
|
400
|
-
readonly severity?: DiagnosticSeverity
|
|
400
|
+
readonly severity?: DiagnosticSeverity
|
|
401
401
|
/** Source span where the diagnostic was detected. */
|
|
402
|
-
readonly span?: Span
|
|
402
|
+
readonly span?: Span
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
/**
|
|
@@ -420,11 +420,11 @@ export declare enum DiagnosticSeverity {
|
|
|
420
420
|
/** A section within a docstring (e.g., Args, Returns, Raises). */
|
|
421
421
|
export interface DocSection {
|
|
422
422
|
/** Section kind (e.g., `"args"`, `"returns"`, `"raises"`). */
|
|
423
|
-
readonly kind?: string
|
|
423
|
+
readonly kind?: string
|
|
424
424
|
/** Parameter or return value name, if applicable. */
|
|
425
|
-
readonly name?: string
|
|
425
|
+
readonly name?: string
|
|
426
426
|
/** Description text for this section. */
|
|
427
|
-
readonly description?: string
|
|
427
|
+
readonly description?: string
|
|
428
428
|
}
|
|
429
429
|
|
|
430
430
|
/**
|
|
@@ -463,23 +463,23 @@ export declare enum DocstringFormat {
|
|
|
463
463
|
/** A docstring extracted from source code. */
|
|
464
464
|
export interface DocstringInfo {
|
|
465
465
|
/** The raw text of the docstring. */
|
|
466
|
-
readonly text?: string
|
|
466
|
+
readonly text?: string
|
|
467
467
|
/** The docstring format (Python, JSDoc, Rustdoc, etc.). */
|
|
468
|
-
readonly format?: DocstringFormat
|
|
468
|
+
readonly format?: DocstringFormat
|
|
469
469
|
/** Source span covering the docstring. */
|
|
470
|
-
readonly span?: Span
|
|
470
|
+
readonly span?: Span
|
|
471
471
|
/** Name of the item this docstring documents. */
|
|
472
|
-
readonly associatedItem?: string
|
|
472
|
+
readonly associatedItem?: string
|
|
473
473
|
/** Parsed sections of the docstring (Args, Returns, Raises, etc.). */
|
|
474
|
-
readonly parsedSections?: Array<DocSection
|
|
474
|
+
readonly parsedSections?: Array<DocSection>
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
/** Manages downloading and caching of pre-built parser shared libraries. */
|
|
478
478
|
export declare class DownloadManager {
|
|
479
479
|
/** Create a new download manager for the given version. */
|
|
480
|
-
static new(version: string): DownloadManager
|
|
480
|
+
static new(version: string): DownloadManager
|
|
481
481
|
/** List languages that are already downloaded and cached. */
|
|
482
|
-
installedLanguages(): Array<string
|
|
482
|
+
installedLanguages(): Array<string>
|
|
483
483
|
/**
|
|
484
484
|
* Download the platform bundle and extract every library file it contains.
|
|
485
485
|
*
|
|
@@ -490,7 +490,7 @@ export declare class DownloadManager {
|
|
|
490
490
|
*
|
|
491
491
|
* Returns the number of library files extracted (including those already cached).
|
|
492
492
|
*/
|
|
493
|
-
downloadAllBestEffort(): number
|
|
493
|
+
downloadAllBestEffort(): number
|
|
494
494
|
/**
|
|
495
495
|
* Remove all cached parser libraries.
|
|
496
496
|
*
|
|
@@ -501,17 +501,17 @@ export declare class DownloadManager {
|
|
|
501
501
|
* already opened the file to continue holding a stale lock handle while a new
|
|
502
502
|
* process opens a fresh inode, breaking the mutual-exclusion guarantee.
|
|
503
503
|
*/
|
|
504
|
-
cleanCache(): void
|
|
504
|
+
cleanCache(): void
|
|
505
505
|
}
|
|
506
506
|
|
|
507
507
|
/** An export statement extracted from source code. */
|
|
508
508
|
export interface ExportInfo {
|
|
509
509
|
/** The exported name. */
|
|
510
|
-
readonly name?: string
|
|
510
|
+
readonly name?: string
|
|
511
511
|
/** The kind of export (named, default, or re-export). */
|
|
512
|
-
readonly kind?: ExportKind
|
|
512
|
+
readonly kind?: ExportKind
|
|
513
513
|
/** Source span covering the export statement. */
|
|
514
|
-
readonly span?: Span
|
|
514
|
+
readonly span?: Span
|
|
515
515
|
}
|
|
516
516
|
|
|
517
517
|
/**
|
|
@@ -531,35 +531,35 @@ export declare enum ExportKind {
|
|
|
531
531
|
/** Aggregate metrics for a source file. */
|
|
532
532
|
export interface FileMetrics {
|
|
533
533
|
/** Total number of lines (including blank and comment lines). */
|
|
534
|
-
readonly totalLines?: number
|
|
534
|
+
readonly totalLines?: number
|
|
535
535
|
/** Number of lines containing non-blank, non-comment source code. */
|
|
536
|
-
readonly codeLines?: number
|
|
536
|
+
readonly codeLines?: number
|
|
537
537
|
/** Number of lines that are entirely comments. */
|
|
538
|
-
readonly commentLines?: number
|
|
538
|
+
readonly commentLines?: number
|
|
539
539
|
/** Number of blank (whitespace-only) lines. */
|
|
540
|
-
readonly blankLines?: number
|
|
540
|
+
readonly blankLines?: number
|
|
541
541
|
/** Total byte length of the source file. */
|
|
542
|
-
readonly totalBytes?: number
|
|
542
|
+
readonly totalBytes?: number
|
|
543
543
|
/** Total number of nodes in the syntax tree. */
|
|
544
|
-
readonly nodeCount?: number
|
|
544
|
+
readonly nodeCount?: number
|
|
545
545
|
/** Number of error nodes in the syntax tree (parse errors). */
|
|
546
|
-
readonly errorCount?: number
|
|
546
|
+
readonly errorCount?: number
|
|
547
547
|
/** Maximum nesting depth reached in the syntax tree. */
|
|
548
|
-
readonly maxDepth?: number
|
|
548
|
+
readonly maxDepth?: number
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
/** An import statement extracted from source code. */
|
|
552
552
|
export interface ImportInfo {
|
|
553
553
|
/** The module or path being imported from. */
|
|
554
|
-
readonly source?: string
|
|
554
|
+
readonly source?: string
|
|
555
555
|
/** Specific names imported from the source module. */
|
|
556
|
-
readonly items?: Array<string
|
|
556
|
+
readonly items?: Array<string>
|
|
557
557
|
/** Alias assigned to the import (e.g., `import numpy as np`). */
|
|
558
|
-
readonly alias?: string
|
|
558
|
+
readonly alias?: string
|
|
559
559
|
/** Whether this is a wildcard import (e.g., `import *` or `use foo::*`). */
|
|
560
|
-
readonly isWildcard?: boolean
|
|
560
|
+
readonly isWildcard?: boolean
|
|
561
561
|
/** Source span covering the import statement. */
|
|
562
|
-
readonly span?: Span
|
|
562
|
+
readonly span?: Span
|
|
563
563
|
}
|
|
564
564
|
|
|
565
565
|
/**
|
|
@@ -577,7 +577,7 @@ export declare class LanguageRegistry {
|
|
|
577
577
|
* When the `dynamic-loading` feature is enabled, the registry also knows
|
|
578
578
|
* about dynamically loadable grammars and will load them on demand.
|
|
579
579
|
*/
|
|
580
|
-
static new(): LanguageRegistry
|
|
580
|
+
static new(): LanguageRegistry
|
|
581
581
|
/**
|
|
582
582
|
* Get a tree-sitter [`Language`] by name.
|
|
583
583
|
*
|
|
@@ -587,14 +587,14 @@ export declare class LanguageRegistry {
|
|
|
587
587
|
* @throws Returns [`Error::LanguageNotFound`] if the name (after alias resolution)
|
|
588
588
|
* does not match any known grammar.
|
|
589
589
|
*/
|
|
590
|
-
getLanguage(name: string): Language
|
|
590
|
+
getLanguage(name: string): Language
|
|
591
591
|
/**
|
|
592
592
|
* List all available language names, sorted and deduplicated.
|
|
593
593
|
*
|
|
594
594
|
* Includes statically compiled languages, dynamically loadable languages
|
|
595
595
|
* (if the `dynamic-loading` feature is enabled), and all configured aliases.
|
|
596
596
|
*/
|
|
597
|
-
availableLanguages(): Array<string
|
|
597
|
+
availableLanguages(): Array<string>
|
|
598
598
|
/**
|
|
599
599
|
* Check whether a parser is statically compiled into this build.
|
|
600
600
|
*
|
|
@@ -617,19 +617,19 @@ export declare class LanguageRegistry {
|
|
|
617
617
|
* let can_parse = lang.map(|name| registry.has_parser(name)).unwrap_or(false);
|
|
618
618
|
* ```
|
|
619
619
|
*/
|
|
620
|
-
hasParser(name: string): boolean
|
|
620
|
+
hasParser(name: string): boolean
|
|
621
621
|
/**
|
|
622
622
|
* Check whether a language is available by name or alias.
|
|
623
623
|
*
|
|
624
624
|
* Returns `true` if the language can be loaded, either from the static
|
|
625
625
|
* table or from a dynamic library on disk.
|
|
626
626
|
*/
|
|
627
|
-
hasLanguage(name: string): boolean
|
|
627
|
+
hasLanguage(name: string): boolean
|
|
628
628
|
/** Return the total number of available languages (including aliases). */
|
|
629
|
-
languageCount(): number
|
|
629
|
+
languageCount(): number
|
|
630
630
|
/** Parse source code and extract file intelligence based on config in a single pass. */
|
|
631
|
-
process(source: string, config?: ProcessConfig | undefined | null): ProcessResult
|
|
632
|
-
static default(): LanguageRegistry
|
|
631
|
+
process(source: string, config?: ProcessConfig | undefined | null): ProcessResult
|
|
632
|
+
static default(): LanguageRegistry
|
|
633
633
|
}
|
|
634
634
|
|
|
635
635
|
/**
|
|
@@ -639,9 +639,9 @@ export declare class LanguageRegistry {
|
|
|
639
639
|
* regardless of how the tree is moved or stored at the FFI boundary.
|
|
640
640
|
*/
|
|
641
641
|
export declare class Node {
|
|
642
|
-
clone(): Node
|
|
642
|
+
clone(): Node
|
|
643
643
|
/** Return the node's kind name (e.g. `"function_definition"`). */
|
|
644
|
-
kind(): string
|
|
644
|
+
kind(): string
|
|
645
645
|
/**
|
|
646
646
|
* Return the node's numeric kind ID.
|
|
647
647
|
*
|
|
@@ -649,48 +649,48 @@ export declare class Node {
|
|
|
649
649
|
* (e.g. `"function_definition" → 42`). Comparing `kind_id()` is cheaper
|
|
650
650
|
* than comparing the string [`kind()`](Self::kind) in tight AST loops.
|
|
651
651
|
*/
|
|
652
|
-
kindId(): number
|
|
652
|
+
kindId(): number
|
|
653
653
|
/** Return the inclusive start byte offset of this node. */
|
|
654
|
-
startByte(): number
|
|
654
|
+
startByte(): number
|
|
655
655
|
/** Return the exclusive end byte offset of this node. */
|
|
656
|
-
endByte(): number
|
|
656
|
+
endByte(): number
|
|
657
657
|
/**
|
|
658
658
|
* Return the node's byte range as a [`ByteRange`].
|
|
659
659
|
*
|
|
660
660
|
* Callers should slice their own source bytes — this is a zero-copy
|
|
661
661
|
* text accessor.
|
|
662
662
|
*/
|
|
663
|
-
byteRange(): ByteRange
|
|
663
|
+
byteRange(): ByteRange
|
|
664
664
|
/** Return the start [`Point`] (row, column). */
|
|
665
|
-
startPosition(): Point
|
|
665
|
+
startPosition(): Point
|
|
666
666
|
/** Return the end [`Point`] (row, column). */
|
|
667
|
-
endPosition(): Point
|
|
667
|
+
endPosition(): Point
|
|
668
668
|
/** True when this node is named (not punctuation/whitespace). */
|
|
669
|
-
isNamed(): boolean
|
|
669
|
+
isNamed(): boolean
|
|
670
670
|
/** True when this is an error node. */
|
|
671
|
-
isError(): boolean
|
|
671
|
+
isError(): boolean
|
|
672
672
|
/** True when this is a missing-token node. */
|
|
673
|
-
isMissing(): boolean
|
|
673
|
+
isMissing(): boolean
|
|
674
674
|
/** True when this is an "extra" node (e.g. a comment). */
|
|
675
|
-
isExtra(): boolean
|
|
675
|
+
isExtra(): boolean
|
|
676
676
|
/** True when this node or any descendant is an error. */
|
|
677
|
-
hasError(): boolean
|
|
677
|
+
hasError(): boolean
|
|
678
678
|
/** Return this node's parent, if any. */
|
|
679
|
-
parent(): Node | null
|
|
679
|
+
parent(): Node | null
|
|
680
680
|
/** Return the i-th child of this node, if any. */
|
|
681
|
-
child(index: number): Node | null
|
|
681
|
+
child(index: number): Node | null
|
|
682
682
|
/** Total number of children (including unnamed). */
|
|
683
|
-
childCount(): number
|
|
683
|
+
childCount(): number
|
|
684
684
|
/** Return the i-th named child of this node, if any. */
|
|
685
|
-
namedChild(index: number): Node | null
|
|
685
|
+
namedChild(index: number): Node | null
|
|
686
686
|
/** Number of named children of this node. */
|
|
687
|
-
namedChildCount(): number
|
|
687
|
+
namedChildCount(): number
|
|
688
688
|
/** Look up a child by its grammar-defined field name. */
|
|
689
|
-
childByFieldName(name: string): Node | null
|
|
689
|
+
childByFieldName(name: string): Node | null
|
|
690
690
|
/** Return the S-expression form of this node's subtree. */
|
|
691
|
-
toSexp(): string
|
|
691
|
+
toSexp(): string
|
|
692
692
|
/** Return a [`TreeCursor`] positioned at this node. */
|
|
693
|
-
walk(): TreeCursor
|
|
693
|
+
walk(): TreeCursor
|
|
694
694
|
}
|
|
695
695
|
|
|
696
696
|
/**
|
|
@@ -706,15 +706,15 @@ export interface PackConfig {
|
|
|
706
706
|
*
|
|
707
707
|
* Default: `~/.cache/tree-sitter-language-pack/v{version}/libs/`
|
|
708
708
|
*/
|
|
709
|
-
readonly cacheDir?: string
|
|
709
|
+
readonly cacheDir?: string
|
|
710
710
|
/**
|
|
711
711
|
* Languages to pre-download on init.
|
|
712
712
|
*
|
|
713
713
|
* Each entry is a language name (e.g. `"python"`, `"rust"`).
|
|
714
714
|
*/
|
|
715
|
-
readonly languages?: Array<string
|
|
715
|
+
readonly languages?: Array<string>
|
|
716
716
|
/** Language groups to pre-download (e.g. `"web"`, `"systems"`, `"scripting"`). */
|
|
717
|
-
readonly groups?: Array<string
|
|
717
|
+
readonly groups?: Array<string>
|
|
718
718
|
}
|
|
719
719
|
|
|
720
720
|
/** A tree-sitter parser configured for one language at a time. */
|
|
@@ -724,7 +724,7 @@ export declare class Parser {
|
|
|
724
724
|
*
|
|
725
725
|
* Call [`Parser::set_language`] before parsing.
|
|
726
726
|
*/
|
|
727
|
-
static new(): Parser
|
|
727
|
+
static new(): Parser
|
|
728
728
|
/**
|
|
729
729
|
* Configure the parser to use the language identified by name (e.g. `"python"`).
|
|
730
730
|
*
|
|
@@ -733,31 +733,31 @@ export declare class Parser {
|
|
|
733
733
|
* @throws Returns [`Error::LanguageNotFound`] if the language is not recognized,
|
|
734
734
|
* or [`Error::ParserSetup`] if the language ABI is incompatible.
|
|
735
735
|
*/
|
|
736
|
-
setLanguage(name: string): void
|
|
736
|
+
setLanguage(name: string): void
|
|
737
737
|
/**
|
|
738
738
|
* Parse a UTF-8 source string. Returns `None` if parsing was cancelled
|
|
739
739
|
* or no language is set.
|
|
740
740
|
*/
|
|
741
|
-
parse(source: string): Tree | null
|
|
741
|
+
parse(source: string): Tree | null
|
|
742
742
|
/**
|
|
743
743
|
* Parse a raw byte slice. Returns `None` if parsing was cancelled or
|
|
744
744
|
* no language is set.
|
|
745
745
|
*/
|
|
746
|
-
parseBytes(source: Uint8Array): Tree | null
|
|
746
|
+
parseBytes(source: Uint8Array): Tree | null
|
|
747
747
|
/**
|
|
748
748
|
* Reset internal state. The next call to [`parse`](Self::parse) will
|
|
749
749
|
* not be incremental.
|
|
750
750
|
*/
|
|
751
|
-
reset(): void
|
|
752
|
-
static default(): Parser
|
|
751
|
+
reset(): void
|
|
752
|
+
static default(): Parser
|
|
753
753
|
}
|
|
754
754
|
|
|
755
755
|
/** A source position — row + column, zero-indexed. */
|
|
756
756
|
export interface Point {
|
|
757
757
|
/** Zero-indexed row number. */
|
|
758
|
-
readonly row: number
|
|
758
|
+
readonly row: number
|
|
759
759
|
/** Zero-indexed column number, in UTF-16 code units. */
|
|
760
|
-
readonly column: number
|
|
760
|
+
readonly column: number
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
/**
|
|
@@ -767,23 +767,23 @@ export interface Point {
|
|
|
767
767
|
*/
|
|
768
768
|
export interface ProcessConfig {
|
|
769
769
|
/** Language name (required). */
|
|
770
|
-
readonly language?: string
|
|
770
|
+
readonly language?: string
|
|
771
771
|
/** Extract structural items (functions, classes, etc.). Default: true. */
|
|
772
|
-
readonly structure?: boolean
|
|
772
|
+
readonly structure?: boolean
|
|
773
773
|
/** Extract import statements. Default: true. */
|
|
774
|
-
readonly imports?: boolean
|
|
774
|
+
readonly imports?: boolean
|
|
775
775
|
/** Extract export statements. Default: true. */
|
|
776
|
-
readonly exports?: boolean
|
|
776
|
+
readonly exports?: boolean
|
|
777
777
|
/** Extract comments. Default: false. */
|
|
778
|
-
readonly comments?: boolean
|
|
778
|
+
readonly comments?: boolean
|
|
779
779
|
/** Extract docstrings. Default: false. */
|
|
780
|
-
readonly docstrings?: boolean
|
|
780
|
+
readonly docstrings?: boolean
|
|
781
781
|
/** Extract symbol definitions. Default: false. */
|
|
782
|
-
readonly symbols?: boolean
|
|
782
|
+
readonly symbols?: boolean
|
|
783
783
|
/** Include parse diagnostics. Default: false. */
|
|
784
|
-
readonly diagnostics?: boolean
|
|
784
|
+
readonly diagnostics?: boolean
|
|
785
785
|
/** Maximum chunk size in bytes. `None` disables chunking. */
|
|
786
|
-
readonly chunkMaxSize?: number
|
|
786
|
+
readonly chunkMaxSize?: number
|
|
787
787
|
/**
|
|
788
788
|
* Extract hierarchical key/value data tree from data-format files. Default: false.
|
|
789
789
|
*
|
|
@@ -794,7 +794,7 @@ export interface ProcessConfig {
|
|
|
794
794
|
*
|
|
795
795
|
* For languages outside this set the field is left as `None`.
|
|
796
796
|
*/
|
|
797
|
-
readonly dataExtraction?: boolean
|
|
797
|
+
readonly dataExtraction?: boolean
|
|
798
798
|
}
|
|
799
799
|
|
|
800
800
|
/**
|
|
@@ -819,25 +819,25 @@ export interface ProcessConfig {
|
|
|
819
819
|
*/
|
|
820
820
|
export interface ProcessResult {
|
|
821
821
|
/** The language name used to parse the source file. */
|
|
822
|
-
readonly language?: string
|
|
822
|
+
readonly language?: string
|
|
823
823
|
/** File-level metrics (line counts, byte size, error count). */
|
|
824
|
-
readonly metrics?: FileMetrics
|
|
824
|
+
readonly metrics?: FileMetrics
|
|
825
825
|
/** Top-level structural items (functions, classes, etc.). */
|
|
826
|
-
readonly structure?: Array<StructureItem
|
|
826
|
+
readonly structure?: Array<StructureItem>
|
|
827
827
|
/** Import statements extracted from the source. */
|
|
828
|
-
readonly imports?: Array<ImportInfo
|
|
828
|
+
readonly imports?: Array<ImportInfo>
|
|
829
829
|
/** Export statements extracted from the source. */
|
|
830
|
-
readonly exports?: Array<ExportInfo
|
|
830
|
+
readonly exports?: Array<ExportInfo>
|
|
831
831
|
/** Comments extracted from the source. */
|
|
832
|
-
readonly comments?: Array<CommentInfo
|
|
832
|
+
readonly comments?: Array<CommentInfo>
|
|
833
833
|
/** Docstrings extracted from the source. */
|
|
834
|
-
readonly docstrings?: Array<DocstringInfo
|
|
834
|
+
readonly docstrings?: Array<DocstringInfo>
|
|
835
835
|
/** Symbol definitions (variables, types, functions) extracted from the source. */
|
|
836
|
-
readonly symbols?: Array<SymbolInfo
|
|
836
|
+
readonly symbols?: Array<SymbolInfo>
|
|
837
837
|
/** Parse diagnostics (syntax errors, missing nodes) from tree-sitter. */
|
|
838
|
-
readonly diagnostics?: Array<Diagnostic
|
|
838
|
+
readonly diagnostics?: Array<Diagnostic>
|
|
839
839
|
/** Syntax-aware code chunks produced when chunking is enabled. */
|
|
840
|
-
readonly chunks?: Array<CodeChunk
|
|
840
|
+
readonly chunks?: Array<CodeChunk>
|
|
841
841
|
/**
|
|
842
842
|
* Hierarchical data tree extracted when `config.data_extraction` is `true`.
|
|
843
843
|
*
|
|
@@ -847,7 +847,7 @@ export interface ProcessResult {
|
|
|
847
847
|
*
|
|
848
848
|
* See [`DataNode`] for the shape of the returned tree.
|
|
849
849
|
*/
|
|
850
|
-
readonly data?: DataNode
|
|
850
|
+
readonly data?: DataNode
|
|
851
851
|
}
|
|
852
852
|
|
|
853
853
|
/**
|
|
@@ -858,39 +858,39 @@ export interface ProcessResult {
|
|
|
858
858
|
*/
|
|
859
859
|
export interface Span {
|
|
860
860
|
/** Inclusive start byte offset in the source. */
|
|
861
|
-
readonly startByte?: number
|
|
861
|
+
readonly startByte?: number
|
|
862
862
|
/** Exclusive end byte offset in the source. */
|
|
863
|
-
readonly endByte?: number
|
|
863
|
+
readonly endByte?: number
|
|
864
864
|
/** Zero-indexed line number of the span's start. */
|
|
865
|
-
readonly startLine?: number
|
|
865
|
+
readonly startLine?: number
|
|
866
866
|
/** Zero-indexed column number of the span's start. */
|
|
867
|
-
readonly startColumn?: number
|
|
867
|
+
readonly startColumn?: number
|
|
868
868
|
/** Zero-indexed line number of the span's end. */
|
|
869
|
-
readonly endLine?: number
|
|
869
|
+
readonly endLine?: number
|
|
870
870
|
/** Zero-indexed column number of the span's end. */
|
|
871
|
-
readonly endColumn?: number
|
|
871
|
+
readonly endColumn?: number
|
|
872
872
|
}
|
|
873
873
|
|
|
874
874
|
/** A structural item (function, class, struct, etc.) in source code. */
|
|
875
875
|
export interface StructureItem {
|
|
876
876
|
/** The kind of structural item. */
|
|
877
|
-
readonly kind?: StructureKind
|
|
877
|
+
readonly kind?: StructureKind
|
|
878
878
|
/** The declared name of the item, if present. */
|
|
879
|
-
readonly name?: string
|
|
879
|
+
readonly name?: string
|
|
880
880
|
/** Visibility modifier (e.g., `"pub"`, `"public"`, `"private"`). */
|
|
881
|
-
readonly visibility?: string
|
|
881
|
+
readonly visibility?: string
|
|
882
882
|
/** Source span covering the entire item declaration. */
|
|
883
|
-
readonly span?: Span
|
|
883
|
+
readonly span?: Span
|
|
884
884
|
/** Nested structural items (e.g., methods within a class). */
|
|
885
|
-
readonly children?: Array<StructureItem
|
|
885
|
+
readonly children?: Array<StructureItem>
|
|
886
886
|
/** Decorator or attribute names applied to the item. */
|
|
887
|
-
readonly decorators?: Array<string
|
|
887
|
+
readonly decorators?: Array<string>
|
|
888
888
|
/** Documentation comment attached to the item, if any. */
|
|
889
|
-
readonly docComment?: string
|
|
889
|
+
readonly docComment?: string
|
|
890
890
|
/** Full signature text of the item (e.g., function parameters and return type). */
|
|
891
|
-
readonly signature?: string
|
|
891
|
+
readonly signature?: string
|
|
892
892
|
/** Source span covering only the body of the item, if distinct from the declaration. */
|
|
893
|
-
readonly bodySpan?: Span
|
|
893
|
+
readonly bodySpan?: Span
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
/**
|
|
@@ -937,15 +937,15 @@ export declare enum StructureKind {
|
|
|
937
937
|
/** A symbol (variable, function, type, etc.) extracted from source code. */
|
|
938
938
|
export interface SymbolInfo {
|
|
939
939
|
/** The name of the symbol. */
|
|
940
|
-
readonly name?: string
|
|
940
|
+
readonly name?: string
|
|
941
941
|
/** The kind of symbol (variable, function, class, etc.). */
|
|
942
|
-
readonly kind?: SymbolKind
|
|
942
|
+
readonly kind?: SymbolKind
|
|
943
943
|
/** Source span covering the symbol definition. */
|
|
944
|
-
readonly span?: Span
|
|
944
|
+
readonly span?: Span
|
|
945
945
|
/** Explicit type annotation, if present in the source. */
|
|
946
|
-
readonly typeAnnotation?: string
|
|
946
|
+
readonly typeAnnotation?: string
|
|
947
947
|
/** Documentation comment associated with this symbol. */
|
|
948
|
-
readonly doc?: string
|
|
948
|
+
readonly doc?: string
|
|
949
949
|
}
|
|
950
950
|
|
|
951
951
|
/**
|
|
@@ -984,32 +984,32 @@ export declare enum SymbolKind {
|
|
|
984
984
|
/** A parsed syntax tree. Cheap to clone (refcount bump). */
|
|
985
985
|
export declare class Tree {
|
|
986
986
|
/** Return the root [`Node`] of this tree. */
|
|
987
|
-
rootNode(): Node
|
|
987
|
+
rootNode(): Node
|
|
988
988
|
/** Return a [`TreeCursor`] positioned at the root. */
|
|
989
|
-
walk(): TreeCursor
|
|
989
|
+
walk(): TreeCursor
|
|
990
990
|
}
|
|
991
991
|
|
|
992
992
|
/** A cursor for traversing a [`Tree`]. */
|
|
993
993
|
export declare class TreeCursor {
|
|
994
994
|
/** Return the [`Node`] at the cursor's current position. */
|
|
995
|
-
node(): Node
|
|
995
|
+
node(): Node
|
|
996
996
|
/**
|
|
997
997
|
* Move the cursor to the first child of the current node.
|
|
998
998
|
* Returns `true` if a child existed.
|
|
999
999
|
*/
|
|
1000
|
-
gotoFirstChild(): boolean
|
|
1000
|
+
gotoFirstChild(): boolean
|
|
1001
1001
|
/**
|
|
1002
1002
|
* Move the cursor to the parent of the current node.
|
|
1003
1003
|
* Returns `true` if a parent existed.
|
|
1004
1004
|
*/
|
|
1005
|
-
gotoParent(): boolean
|
|
1005
|
+
gotoParent(): boolean
|
|
1006
1006
|
/**
|
|
1007
1007
|
* Move the cursor to the next sibling of the current node.
|
|
1008
1008
|
* Returns `true` if a sibling existed.
|
|
1009
1009
|
*/
|
|
1010
|
-
gotoNextSibling(): boolean
|
|
1010
|
+
gotoNextSibling(): boolean
|
|
1011
1011
|
/** Return the field name for the current node, if any. */
|
|
1012
|
-
fieldName(): string | null
|
|
1012
|
+
fieldName(): string | null
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
1015
1015
|
/**
|
package/index.js
CHANGED
|
@@ -9,9 +9,16 @@ const isMusl = () => {
|
|
|
9
9
|
// "is musl" positive. Fall through to the filesystem heuristic instead: on
|
|
10
10
|
// glibc systems `/lib64/ld-musl-x86_64.so.1` does not exist; on musl systems
|
|
11
11
|
// it always does. statSync errors → not musl.
|
|
12
|
-
if (
|
|
12
|
+
if (
|
|
13
|
+
typeof process.report === "object" &&
|
|
14
|
+
typeof process.report.getReport === "function"
|
|
15
|
+
) {
|
|
13
16
|
const report = process.report.getReport();
|
|
14
|
-
if (
|
|
17
|
+
if (
|
|
18
|
+
report &&
|
|
19
|
+
report.header &&
|
|
20
|
+
typeof report.header.glibcVersion === "string"
|
|
21
|
+
) {
|
|
15
22
|
return false;
|
|
16
23
|
}
|
|
17
24
|
}
|
|
@@ -40,56 +47,14 @@ const tryLoadBinding = () => {
|
|
|
40
47
|
// Optional-dep packages are named after `napi.packageName` (npm subpackage names),
|
|
41
48
|
// which inherits any scope prefix from the parent package.
|
|
42
49
|
const targets = [
|
|
43
|
-
[
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"./ts-pack-core-node.linux-x64-gnu.node",
|
|
48
|
-
"@xberg-io/tree-sitter-language-pack-linux-x64-gnu",
|
|
49
|
-
],
|
|
50
|
-
[
|
|
51
|
-
"linux",
|
|
52
|
-
"arm64",
|
|
53
|
-
"gnu",
|
|
54
|
-
"./ts-pack-core-node.linux-arm64-gnu.node",
|
|
55
|
-
"@xberg-io/tree-sitter-language-pack-linux-arm64-gnu",
|
|
56
|
-
],
|
|
57
|
-
[
|
|
58
|
-
"linux",
|
|
59
|
-
"x64",
|
|
60
|
-
"musl",
|
|
61
|
-
"./ts-pack-core-node.linux-x64-musl.node",
|
|
62
|
-
"@xberg-io/tree-sitter-language-pack-linux-x64-musl",
|
|
63
|
-
],
|
|
64
|
-
[
|
|
65
|
-
"linux",
|
|
66
|
-
"arm64",
|
|
67
|
-
"musl",
|
|
68
|
-
"./ts-pack-core-node.linux-arm64-musl.node",
|
|
69
|
-
"@xberg-io/tree-sitter-language-pack-linux-arm64-musl",
|
|
70
|
-
],
|
|
50
|
+
["linux", "x64", "gnu", "./ts-pack-core-node.linux-x64-gnu.node", "@xberg-io/tree-sitter-language-pack-linux-x64-gnu"],
|
|
51
|
+
["linux", "arm64", "gnu", "./ts-pack-core-node.linux-arm64-gnu.node", "@xberg-io/tree-sitter-language-pack-linux-arm64-gnu"],
|
|
52
|
+
["linux", "x64", "musl", "./ts-pack-core-node.linux-x64-musl.node", "@xberg-io/tree-sitter-language-pack-linux-x64-musl"],
|
|
53
|
+
["linux", "arm64", "musl", "./ts-pack-core-node.linux-arm64-musl.node", "@xberg-io/tree-sitter-language-pack-linux-arm64-musl"],
|
|
71
54
|
["darwin", "x64", null, "./ts-pack-core-node.darwin-x64.node", "@xberg-io/tree-sitter-language-pack-darwin-x64"],
|
|
72
|
-
[
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
null,
|
|
76
|
-
"./ts-pack-core-node.darwin-arm64.node",
|
|
77
|
-
"@xberg-io/tree-sitter-language-pack-darwin-arm64",
|
|
78
|
-
],
|
|
79
|
-
[
|
|
80
|
-
"win32",
|
|
81
|
-
"x64",
|
|
82
|
-
null,
|
|
83
|
-
"./ts-pack-core-node.win32-x64-msvc.node",
|
|
84
|
-
"@xberg-io/tree-sitter-language-pack-win32-x64-msvc",
|
|
85
|
-
],
|
|
86
|
-
[
|
|
87
|
-
"win32",
|
|
88
|
-
"arm64",
|
|
89
|
-
null,
|
|
90
|
-
"./ts-pack-core-node.win32-arm64-msvc.node",
|
|
91
|
-
"@xberg-io/tree-sitter-language-pack-win32-arm64-msvc",
|
|
92
|
-
],
|
|
55
|
+
["darwin", "arm64", null, "./ts-pack-core-node.darwin-arm64.node", "@xberg-io/tree-sitter-language-pack-darwin-arm64"],
|
|
56
|
+
["win32", "x64", null, "./ts-pack-core-node.win32-x64-msvc.node", "@xberg-io/tree-sitter-language-pack-win32-x64-msvc"],
|
|
57
|
+
["win32", "arm64", null, "./ts-pack-core-node.win32-arm64-msvc.node", "@xberg-io/tree-sitter-language-pack-win32-arm64-msvc"],
|
|
93
58
|
];
|
|
94
59
|
|
|
95
60
|
for (const [plat, a, abi, localPath, optionalDep] of targets) {
|
|
@@ -128,7 +93,9 @@ const tryLoadBinding = () => {
|
|
|
128
93
|
tryLoadBinding();
|
|
129
94
|
|
|
130
95
|
if (!nativeBinding) {
|
|
131
|
-
throw new Error(
|
|
96
|
+
throw new Error(
|
|
97
|
+
`Failed to load native binding for ${platform}-${arch}. Errors: ${loadErrors.join(", ")}`
|
|
98
|
+
);
|
|
132
99
|
}
|
|
133
100
|
|
|
134
101
|
module.exports = nativeBinding;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xberg-io/tree-sitter-language-pack",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.3",
|
|
4
4
|
"description": "Pre-compiled tree-sitter grammars for 306 programming languages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
},
|
|
19
19
|
"files": ["index.js", "index.d.ts", "*.node"],
|
|
20
20
|
"optionalDependencies": {
|
|
21
|
-
"@xberg-io/tree-sitter-language-pack-linux-x64-gnu": "1.13.
|
|
22
|
-
"@xberg-io/tree-sitter-language-pack-linux-arm64-gnu": "1.13.
|
|
23
|
-
"@xberg-io/tree-sitter-language-pack-linux-x64-musl": "1.13.
|
|
24
|
-
"@xberg-io/tree-sitter-language-pack-linux-arm64-musl": "1.13.
|
|
25
|
-
"@xberg-io/tree-sitter-language-pack-darwin-x64": "1.13.
|
|
26
|
-
"@xberg-io/tree-sitter-language-pack-darwin-arm64": "1.13.
|
|
27
|
-
"@xberg-io/tree-sitter-language-pack-win32-x64-msvc": "1.13.
|
|
28
|
-
"@xberg-io/tree-sitter-language-pack-win32-arm64-msvc": "1.13.
|
|
21
|
+
"@xberg-io/tree-sitter-language-pack-linux-x64-gnu": "1.13.3",
|
|
22
|
+
"@xberg-io/tree-sitter-language-pack-linux-arm64-gnu": "1.13.3",
|
|
23
|
+
"@xberg-io/tree-sitter-language-pack-linux-x64-musl": "1.13.3",
|
|
24
|
+
"@xberg-io/tree-sitter-language-pack-linux-arm64-musl": "1.13.3",
|
|
25
|
+
"@xberg-io/tree-sitter-language-pack-darwin-x64": "1.13.3",
|
|
26
|
+
"@xberg-io/tree-sitter-language-pack-darwin-arm64": "1.13.3",
|
|
27
|
+
"@xberg-io/tree-sitter-language-pack-win32-x64-msvc": "1.13.3",
|
|
28
|
+
"@xberg-io/tree-sitter-language-pack-win32-arm64-msvc": "1.13.3"
|
|
29
29
|
},
|
|
30
30
|
"napi": {
|
|
31
31
|
"packageName": "@xberg-io/tree-sitter-language-pack",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|