@lzehrung/codegraph-native 1.9.1 → 1.11.0
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 +46 -13
- package/package.json +9 -9
package/index.d.ts
CHANGED
|
@@ -32,6 +32,10 @@ export interface NativeDuplicateTokens {
|
|
|
32
32
|
normalizedTokens: Array<string>
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Not built in unit tests: it carries a projected tree, whose typed arrays hold JS
|
|
37
|
+
* references. See `NativeSyntaxTree`.
|
|
38
|
+
*/
|
|
35
39
|
export interface NativeLanguageExtraction {
|
|
36
40
|
results: NativeQueryResults
|
|
37
41
|
syntaxTree: NativeSyntaxTree
|
|
@@ -59,21 +63,50 @@ export interface NativeQueryRunResult {
|
|
|
59
63
|
matches: Array<NativeMatch>
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Column-oriented projection of a Tree-sitter tree.
|
|
68
|
+
*
|
|
69
|
+
* Every attribute is one typed array indexed by node id, and node kinds and child
|
|
70
|
+
* field names are interned into string tables. A grammar has a few hundred distinct
|
|
71
|
+
* kinds, so a file with 2,000 nodes crosses the napi boundary as ~15 typed arrays
|
|
72
|
+
* plus ~200 strings instead of 2,000 objects holding ~4,000 strings. That keeps both
|
|
73
|
+
* the boundary crossing and the worker-to-main-thread transfer proportional to bytes
|
|
74
|
+
* rather than to node count, and lets the transfer move buffers instead of cloning.
|
|
75
|
+
*
|
|
76
|
+
* Child lists use compressed sparse row layout: the children of node `i` are
|
|
77
|
+
* `child_ids[child_offsets[i]..child_offsets[i + 1]]`, and `child_field_name_ids`
|
|
78
|
+
* is parallel to `child_ids`.
|
|
79
|
+
*
|
|
80
|
+
* Excluded from `cfg(test)` builds: typed arrays hold JS references whose `Drop`
|
|
81
|
+
* calls into the Node runtime, which the `noop` feature used by `cargo test` does
|
|
82
|
+
* not provide. Unit tests cover `projection::project_columns`, which is pure Rust;
|
|
83
|
+
* this type is only the marshalling shell around it, and the JS-side parity suites
|
|
84
|
+
* exercise it end to end.
|
|
85
|
+
*/
|
|
74
86
|
export interface NativeSyntaxTree {
|
|
75
87
|
rootId: number
|
|
76
|
-
|
|
88
|
+
nodeCount: number
|
|
89
|
+
/** Distinct node kinds; `kind_ids[i]` indexes this table. */
|
|
90
|
+
kinds: Array<string>
|
|
91
|
+
/** Distinct child field names; index 0 is always the empty name. */
|
|
92
|
+
fieldNames: Array<string>
|
|
93
|
+
kindIds: Uint32Array
|
|
94
|
+
/** -1 for the root node. */
|
|
95
|
+
parentIds: Int32Array
|
|
96
|
+
named: Uint8Array
|
|
97
|
+
startRow: Uint32Array
|
|
98
|
+
startColumn: Uint32Array
|
|
99
|
+
/** UTF-8 byte offset, matching Tree-sitter's `start_byte()`. */
|
|
100
|
+
startIndex: Uint32Array
|
|
101
|
+
endRow: Uint32Array
|
|
102
|
+
endColumn: Uint32Array
|
|
103
|
+
/** UTF-8 byte offset, matching Tree-sitter's `end_byte()`. */
|
|
104
|
+
endIndex: Uint32Array
|
|
105
|
+
childOffsets: Uint32Array
|
|
106
|
+
childIds: Uint32Array
|
|
107
|
+
childFieldNameIds: Uint32Array
|
|
108
|
+
namedChildOffsets: Uint32Array
|
|
109
|
+
namedChildIds: Uint32Array
|
|
77
110
|
}
|
|
78
111
|
|
|
79
112
|
export declare function parseSyntaxTree(source: string, languageId: string): NativeSyntaxTree
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lzehrung/codegraph-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
"optionalDependencies": {
|
|
52
|
-
"@lzehrung/codegraph-native-darwin-arm64": "1.
|
|
53
|
-
"@lzehrung/codegraph-native-darwin-x64": "1.
|
|
54
|
-
"@lzehrung/codegraph-native-linux-arm64-gnu": "1.
|
|
55
|
-
"@lzehrung/codegraph-native-linux-arm64-musl": "1.
|
|
56
|
-
"@lzehrung/codegraph-native-linux-x64-gnu": "1.
|
|
57
|
-
"@lzehrung/codegraph-native-linux-x64-musl": "1.
|
|
58
|
-
"@lzehrung/codegraph-native-win32-arm64-msvc": "1.
|
|
59
|
-
"@lzehrung/codegraph-native-win32-x64-msvc": "1.
|
|
52
|
+
"@lzehrung/codegraph-native-darwin-arm64": "1.11.0",
|
|
53
|
+
"@lzehrung/codegraph-native-darwin-x64": "1.11.0",
|
|
54
|
+
"@lzehrung/codegraph-native-linux-arm64-gnu": "1.11.0",
|
|
55
|
+
"@lzehrung/codegraph-native-linux-arm64-musl": "1.11.0",
|
|
56
|
+
"@lzehrung/codegraph-native-linux-x64-gnu": "1.11.0",
|
|
57
|
+
"@lzehrung/codegraph-native-linux-x64-musl": "1.11.0",
|
|
58
|
+
"@lzehrung/codegraph-native-win32-arm64-msvc": "1.11.0",
|
|
59
|
+
"@lzehrung/codegraph-native-win32-x64-msvc": "1.11.0"
|
|
60
60
|
}
|
|
61
61
|
}
|