yuku-analyzer 0.5.41 → 0.5.43
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/decode.js +7 -37
- package/index.d.ts +0 -5
- package/module.js +0 -6
- package/package.json +13 -13
package/decode.js
CHANGED
|
@@ -619,15 +619,14 @@ function decode(buffer, source) {
|
|
|
619
619
|
extraCount = _u32[1],
|
|
620
620
|
spLen = _u32[2];
|
|
621
621
|
const commentCount = _u32[4],
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
progIdx = _u32[8];
|
|
622
|
+
diagCount = _u32[6],
|
|
623
|
+
progIdx = _u32[7];
|
|
625
624
|
const attachedCommentCount = _u32[5];
|
|
626
|
-
const _flags = _u32[
|
|
625
|
+
const _flags = _u32[8];
|
|
627
626
|
const _isTs = !!(_flags & 1);
|
|
628
627
|
const _attached = !!(_flags & 2);
|
|
629
|
-
const _firstNa = _u32[
|
|
630
|
-
const _nodesOff =
|
|
628
|
+
const _firstNa = _u32[9];
|
|
629
|
+
const _nodesOff = 40;
|
|
631
630
|
const eOff = _nodesOff + nodeCount * 48;
|
|
632
631
|
const _extraBase = eOff >> 2;
|
|
633
632
|
const _spOff = eOff + extraCount * 4;
|
|
@@ -1165,8 +1164,7 @@ function decode(buffer, source) {
|
|
|
1165
1164
|
const _nodesU32 = _nodesOff >> 2;
|
|
1166
1165
|
function startOf(i) { return _p(_u32[_nodesU32 + i * 12 + 10]); }
|
|
1167
1166
|
function endOf(i) { return _p(_u32[_nodesU32 + i * 12 + 11]); }
|
|
1168
|
-
const
|
|
1169
|
-
const dOff = lsOff + lineStartsCount * 4;
|
|
1167
|
+
const dOff = _cOff + commentCount * 20;
|
|
1170
1168
|
function _decodeComments() {
|
|
1171
1169
|
const out = Array.from({ length: commentCount });
|
|
1172
1170
|
for (let j = 0; j < commentCount; j++) {
|
|
@@ -1185,20 +1183,6 @@ function decode(buffer, source) {
|
|
|
1185
1183
|
}
|
|
1186
1184
|
return out;
|
|
1187
1185
|
}
|
|
1188
|
-
function _decodeLineStarts() {
|
|
1189
|
-
const out = Array.from({ length: lineStartsCount });
|
|
1190
|
-
if (_firstNa >= _srcLen) {
|
|
1191
|
-
for (let j = 0; j < lineStartsCount; j++) {
|
|
1192
|
-
out[j] = dv.getUint32(lsOff + j * 4, true);
|
|
1193
|
-
}
|
|
1194
|
-
return out;
|
|
1195
|
-
}
|
|
1196
|
-
for (let j = 0; j < lineStartsCount; j++) {
|
|
1197
|
-
const v = dv.getUint32(lsOff + j * 4, true);
|
|
1198
|
-
out[j] = v < _firstNa ? v : (v >= _srcLen ? pm[pm.length - 1] : pm[v - _firstNa]);
|
|
1199
|
-
}
|
|
1200
|
-
return out;
|
|
1201
|
-
}
|
|
1202
1186
|
function _decodeDiagnostics() {
|
|
1203
1187
|
const out = Array.from({ length: diagCount });
|
|
1204
1188
|
let dp = dOff;
|
|
@@ -1360,11 +1344,7 @@ function decode(buffer, source) {
|
|
|
1360
1344
|
nodeScope: (i) => nodeScopes[i],
|
|
1361
1345
|
});
|
|
1362
1346
|
}
|
|
1363
|
-
let _program,
|
|
1364
|
-
function _getLineStarts() {
|
|
1365
|
-
if (_lineStarts === undefined) _lineStarts = _decodeLineStarts();
|
|
1366
|
-
return _lineStarts;
|
|
1367
|
-
}
|
|
1347
|
+
let _program, _diagnostics, _comments;
|
|
1368
1348
|
return {
|
|
1369
1349
|
get program() {
|
|
1370
1350
|
return _program !== undefined ? _program : (_program = node(progIdx));
|
|
@@ -1379,16 +1359,6 @@ function decode(buffer, source) {
|
|
|
1379
1359
|
? _diagnostics
|
|
1380
1360
|
: (_diagnostics = _decodeDiagnostics());
|
|
1381
1361
|
},
|
|
1382
|
-
get lineStarts() { return _getLineStarts(); },
|
|
1383
|
-
locOf(offset) {
|
|
1384
|
-
const ls = _getLineStarts();
|
|
1385
|
-
let lo = 0, hi = ls.length;
|
|
1386
|
-
while (lo < hi) {
|
|
1387
|
-
const mid = (lo + hi) >>> 1;
|
|
1388
|
-
if (ls[mid] <= offset) lo = mid + 1; else hi = mid;
|
|
1389
|
-
}
|
|
1390
|
-
return { line: lo, column: offset - ls[lo - 1] };
|
|
1391
|
-
},
|
|
1392
1362
|
nodeOf: node,
|
|
1393
1363
|
indexOf: (n) => _nodeIndexes.get(n),
|
|
1394
1364
|
parentIndex: (i) => _parents()[i],
|
package/index.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ import type {
|
|
|
13
13
|
NodeType,
|
|
14
14
|
Program,
|
|
15
15
|
SourceLang,
|
|
16
|
-
SourceLocation,
|
|
17
16
|
SourceType,
|
|
18
17
|
WalkContext as BaseWalkContext,
|
|
19
18
|
} from "@yuku-toolchain/types";
|
|
@@ -364,10 +363,6 @@ interface Module {
|
|
|
364
363
|
readonly diagnostics: Diagnostic[];
|
|
365
364
|
/** Every comment in source order. */
|
|
366
365
|
readonly comments: Comment[];
|
|
367
|
-
/** Sorted offsets where each line begins. */
|
|
368
|
-
readonly lineStarts: number[];
|
|
369
|
-
/** Resolves an offset to a `(line, column)` pair. */
|
|
370
|
-
locOf(offset: number): SourceLocation;
|
|
371
366
|
|
|
372
367
|
/** Every lexical scope; index is the scope id. `scopes[0]` is global. */
|
|
373
368
|
readonly scopes: Scope[];
|
package/module.js
CHANGED
|
@@ -256,12 +256,6 @@ export class Module {
|
|
|
256
256
|
get comments() {
|
|
257
257
|
return this.#r.comments;
|
|
258
258
|
}
|
|
259
|
-
get lineStarts() {
|
|
260
|
-
return this.#r.lineStarts;
|
|
261
|
-
}
|
|
262
|
-
locOf(offset) {
|
|
263
|
-
return this.#r.locOf(offset);
|
|
264
|
-
}
|
|
265
259
|
|
|
266
260
|
get scopes() {
|
|
267
261
|
return (this.#scopes ??= this.#rows(Scope, this.#sem.scope.count));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yuku-analyzer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.43",
|
|
4
4
|
"description": "Full JavaScript and TypeScript semantic analysis: scopes, symbols, resolved references, closures, and cross-file module linking, computed natively in Zig and queried as plain JavaScript objects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
"decode.js"
|
|
22
22
|
],
|
|
23
23
|
"optionalDependencies": {
|
|
24
|
-
"@yuku-analyzer/binding-linux-x64-gnu": "0.5.
|
|
25
|
-
"@yuku-analyzer/binding-linux-arm64-gnu": "0.5.
|
|
26
|
-
"@yuku-analyzer/binding-linux-arm-gnu": "0.5.
|
|
27
|
-
"@yuku-analyzer/binding-linux-x64-musl": "0.5.
|
|
28
|
-
"@yuku-analyzer/binding-linux-arm64-musl": "0.5.
|
|
29
|
-
"@yuku-analyzer/binding-linux-arm-musl": "0.5.
|
|
30
|
-
"@yuku-analyzer/binding-darwin-x64": "0.5.
|
|
31
|
-
"@yuku-analyzer/binding-darwin-arm64": "0.5.
|
|
32
|
-
"@yuku-analyzer/binding-win32-x64": "0.5.
|
|
33
|
-
"@yuku-analyzer/binding-win32-arm64": "0.5.
|
|
34
|
-
"@yuku-analyzer/binding-freebsd-x64": "0.5.
|
|
24
|
+
"@yuku-analyzer/binding-linux-x64-gnu": "0.5.43",
|
|
25
|
+
"@yuku-analyzer/binding-linux-arm64-gnu": "0.5.43",
|
|
26
|
+
"@yuku-analyzer/binding-linux-arm-gnu": "0.5.43",
|
|
27
|
+
"@yuku-analyzer/binding-linux-x64-musl": "0.5.43",
|
|
28
|
+
"@yuku-analyzer/binding-linux-arm64-musl": "0.5.43",
|
|
29
|
+
"@yuku-analyzer/binding-linux-arm-musl": "0.5.43",
|
|
30
|
+
"@yuku-analyzer/binding-darwin-x64": "0.5.43",
|
|
31
|
+
"@yuku-analyzer/binding-darwin-arm64": "0.5.43",
|
|
32
|
+
"@yuku-analyzer/binding-win32-x64": "0.5.43",
|
|
33
|
+
"@yuku-analyzer/binding-win32-arm64": "0.5.43",
|
|
34
|
+
"@yuku-analyzer/binding-freebsd-x64": "0.5.43"
|
|
35
35
|
},
|
|
36
36
|
"keywords": [
|
|
37
37
|
"analyzer",
|
|
@@ -49,6 +49,6 @@
|
|
|
49
49
|
"typescript"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@yuku-toolchain/types": "0.5.
|
|
52
|
+
"@yuku-toolchain/types": "0.5.42"
|
|
53
53
|
}
|
|
54
54
|
}
|