yuku-analyzer 0.5.47 → 0.5.48

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.
Files changed (2) hide show
  1. package/decode.js +52 -52
  2. package/package.json +12 -12
package/decode.js CHANGED
@@ -27,11 +27,11 @@ function _ck(type, keys) {
27
27
  }
28
28
  _ck("SequenceExpression", ["expressions"]);
29
29
  _ck("ParenthesizedExpression", ["expression"]);
30
- _ck("ArrowFunctionExpression", ["params", "body", "typeParameters", "returnType"]);
31
- _ck("FunctionDeclaration", ["id", "params", "body", "typeParameters", "returnType"]);
32
- _ck("FunctionExpression", ["id", "params", "body", "typeParameters", "returnType"]);
33
- _ck("TSDeclareFunction", ["id", "params", "body", "typeParameters", "returnType"]);
34
- _ck("TSEmptyBodyFunctionExpression", ["id", "params", "body", "typeParameters", "returnType"]);
30
+ _ck("ArrowFunctionExpression", ["typeParameters", "params", "returnType", "body"]);
31
+ _ck("FunctionDeclaration", ["id", "typeParameters", "params", "returnType", "body"]);
32
+ _ck("FunctionExpression", ["id", "typeParameters", "params", "returnType", "body"]);
33
+ _ck("TSDeclareFunction", ["id", "typeParameters", "params", "returnType", "body"]);
34
+ _ck("TSEmptyBodyFunctionExpression", ["id", "typeParameters", "params", "returnType", "body"]);
35
35
  _ck("BlockStatement", ["body"]);
36
36
  _ck("BlockStatement", ["body"]);
37
37
  _ck("BinaryExpression", ["left", "right"]);
@@ -45,23 +45,23 @@ _ck("ObjectExpression", ["properties"]);
45
45
  _ck("SpreadElement", ["argument"]);
46
46
  _ck("Property", ["key", "value"]);
47
47
  _ck("MemberExpression", ["object", "property"]);
48
- _ck("CallExpression", ["callee", "arguments", "typeArguments"]);
48
+ _ck("CallExpression", ["callee", "typeArguments", "arguments"]);
49
49
  _ck("ChainExpression", ["expression"]);
50
- _ck("TaggedTemplateExpression", ["tag", "quasi", "typeArguments"]);
51
- _ck("NewExpression", ["callee", "arguments", "typeArguments"]);
50
+ _ck("TaggedTemplateExpression", ["tag", "typeArguments", "quasi"]);
51
+ _ck("NewExpression", ["callee", "typeArguments", "arguments"]);
52
52
  _ck("AwaitExpression", ["argument"]);
53
53
  _ck("YieldExpression", ["argument"]);
54
54
  _ck("MetaProperty", ["meta", "property"]);
55
55
  _ck("Decorator", ["expression"]);
56
- _ck("ClassDeclaration", ["decorators", "id", "superClass", "body", "typeParameters", "superTypeArguments", "implements"]);
57
- _ck("ClassExpression", ["decorators", "id", "superClass", "body", "typeParameters", "superTypeArguments", "implements"]);
56
+ _ck("ClassDeclaration", ["decorators", "id", "typeParameters", "superClass", "superTypeArguments", "implements", "body"]);
57
+ _ck("ClassExpression", ["decorators", "id", "typeParameters", "superClass", "superTypeArguments", "implements", "body"]);
58
58
  _ck("ClassBody", ["body"]);
59
59
  _ck("MethodDefinition", ["decorators", "key", "value"]);
60
60
  _ck("TSAbstractMethodDefinition", ["decorators", "key", "value"]);
61
- _ck("PropertyDefinition", ["decorators", "key", "value", "typeAnnotation"]);
62
- _ck("AccessorProperty", ["decorators", "key", "value", "typeAnnotation"]);
63
- _ck("TSAbstractPropertyDefinition", ["decorators", "key", "value", "typeAnnotation"]);
64
- _ck("TSAbstractAccessorProperty", ["decorators", "key", "value", "typeAnnotation"]);
61
+ _ck("PropertyDefinition", ["decorators", "key", "typeAnnotation", "value"]);
62
+ _ck("AccessorProperty", ["decorators", "key", "typeAnnotation", "value"]);
63
+ _ck("TSAbstractPropertyDefinition", ["decorators", "key", "typeAnnotation", "value"]);
64
+ _ck("TSAbstractAccessorProperty", ["decorators", "key", "typeAnnotation", "value"]);
65
65
  _ck("StaticBlock", ["body"]);
66
66
  _ck("Super", []);
67
67
  _ck("Literal", []);
@@ -100,8 +100,8 @@ _ck("EmptyStatement", []);
100
100
  _ck("VariableDeclaration", ["declarations"]);
101
101
  _ck("VariableDeclarator", ["id", "init"]);
102
102
  _ck("ExpressionStatement", ["expression"]);
103
- _ck("AssignmentPattern", ["left", "right", "decorators", "typeAnnotation"]);
104
- _ck("RestElement", ["argument", "decorators", "typeAnnotation"]);
103
+ _ck("AssignmentPattern", ["decorators", "left", "typeAnnotation", "right"]);
104
+ _ck("RestElement", ["decorators", "argument", "typeAnnotation"]);
105
105
  _ck("ArrayPattern", ["decorators", "elements", "typeAnnotation"]);
106
106
  _ck("ObjectPattern", ["decorators", "properties", "typeAnnotation"]);
107
107
  _ck("Property", ["key", "value"]);
@@ -188,7 +188,7 @@ _ck("TSNamespaceExportDeclaration", ["id"]);
188
188
  _ck("TSImportEqualsDeclaration", ["id", "moduleReference"]);
189
189
  _ck("TSExternalModuleReference", ["expression"]);
190
190
  _ck("JSXElement", ["openingElement", "children", "closingElement"]);
191
- _ck("JSXOpeningElement", ["name", "attributes", "typeArguments"]);
191
+ _ck("JSXOpeningElement", ["name", "typeArguments", "attributes"]);
192
192
  _ck("JSXClosingElement", ["name"]);
193
193
  _ck("JSXFragment", ["openingFragment", "children", "closingFragment"]);
194
194
  _ck("JSXOpeningFragment", []);
@@ -251,15 +251,15 @@ const CHILD_SLOTS = [
251
251
  [0, 2],
252
252
  [0, 2, 0, 3],
253
253
  [0, 2, 0, 3],
254
- [0, 2, 2, 3, 0, 4],
254
+ [0, 2, 0, 3, 2, 4],
255
255
  [0, 2],
256
256
  [0, 2, 0, 3, 0, 4],
257
- [0, 2, 2, 3, 0, 4],
257
+ [0, 2, 0, 3, 2, 4],
258
258
  [0, 2],
259
259
  [0, 2],
260
260
  [0, 2, 0, 3],
261
261
  [0, 2],
262
- [2, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 1, 8],
262
+ [2, 2, 0, 3, 0, 4, 0, 5, 0, 6, 1, 7, 0, 9],
263
263
  [2, 2],
264
264
  [2, 2, 0, 3, 0, 4],
265
265
  [2, 2, 0, 3, 0, 4, 0, 5],
@@ -301,10 +301,10 @@ const CHILD_SLOTS = [
301
301
  [2, 2],
302
302
  [0, 2, 0, 3],
303
303
  [0, 2],
304
- [0, 2, 0, 3, 2, 4, 0, 5],
305
- [0, 2, 2, 3, 0, 4],
306
- [2, 2, 0, 3, 1, 4, 0, 6],
307
- [2, 2, 0, 3, 1, 4, 0, 6],
304
+ [2, 2, 0, 3, 0, 4, 0, 5],
305
+ [2, 2, 0, 3, 0, 4],
306
+ [2, 2, 1, 3, 0, 5, 0, 6],
307
+ [2, 2, 1, 3, 0, 5, 0, 6],
308
308
  [0, 2, 0, 3],
309
309
  [2, 2],
310
310
  [0, 2, 0, 3],
@@ -389,7 +389,7 @@ const CHILD_SLOTS = [
389
389
  [0, 2, 0, 3],
390
390
  [0, 2],
391
391
  [0, 2, 2, 3, 0, 4],
392
- [0, 2, 2, 3, 0, 4],
392
+ [0, 2, 0, 3, 2, 4],
393
393
  [0, 2],
394
394
  [0, 2, 2, 3, 0, 4],
395
395
  [],
@@ -741,12 +741,12 @@ function decode(buffer, source) {
741
741
  const r = {
742
742
  type: "ArrowFunctionExpression", start, end,
743
743
  id: null, generator: false, async: !!(flags & 2),
744
- params: f1 !== NULL ? fnParams(f1) : [],
745
- body: node(f2), expression: !!(flags & 1),
744
+ params: f2 !== NULL ? fnParams(f2) : [],
745
+ body: node(f4), expression: !!(flags & 1),
746
746
  };
747
747
  if (_isTs) {
748
- r.typeParameters = f3 !== NULL ? node(f3) : null;
749
- r.returnType = f4 !== NULL ? node(f4) : null;
748
+ r.typeParameters = f1 !== NULL ? node(f1) : null;
749
+ r.returnType = f3 !== NULL ? node(f3) : null;
750
750
  }
751
751
  return r;
752
752
  }
@@ -756,13 +756,13 @@ function decode(buffer, source) {
756
756
  type: FUNCTION_TYPES[ft], start, end,
757
757
  id: f1 !== NULL ? node(f1) : null,
758
758
  generator: !!(flags & 4), async: !!(flags & 8),
759
- params: f2 !== NULL ? fnParams(f2) : [],
760
- body: f3 !== NULL ? node(f3) : null,
759
+ params: f3 !== NULL ? fnParams(f3) : [],
760
+ body: f5 !== NULL ? node(f5) : null,
761
761
  expression: false,
762
762
  };
763
763
  if (_isTs) {
764
- r.typeParameters = f4 !== NULL ? node(f4) : null;
765
- r.returnType = f5 !== NULL ? node(f5) : null;
764
+ r.typeParameters = f2 !== NULL ? node(f2) : null;
765
+ r.returnType = f4 !== NULL ? node(f4) : null;
766
766
  r.declare = !!(flags & 16);
767
767
  }
768
768
  return r;
@@ -786,10 +786,10 @@ function decode(buffer, source) {
786
786
  case 16: return { type: "SpreadElement", start, end, argument: f1 !== NULL ? node(f1) : null };
787
787
  case 17: { const r = { type: "Property", start, end, key: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null, kind: PROPERTY_KINDS[flags & 3], method: !!(flags & 4), shorthand: !!(flags & 8), computed: !!(flags & 16) }; if (_isTs) { r.optional = false; } return r; }
788
788
  case 18: return { type: "MemberExpression", start, end, object: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null, computed: !!(flags & 1), optional: !!(flags & 2) };
789
- case 19: { const r = { type: "CallExpression", start, end, callee: f1 !== NULL ? node(f1) : null, arguments: nodeArr(f2, f0), optional: !!(flags & 1) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
789
+ case 19: { const r = { type: "CallExpression", start, end, callee: f1 !== NULL ? node(f1) : null, arguments: nodeArr(f3, f0), optional: !!(flags & 1) }; if (_isTs) { r.typeArguments = f2 !== NULL ? node(f2) : null; } return r; }
790
790
  case 20: return { type: "ChainExpression", start, end, expression: f1 !== NULL ? node(f1) : null };
791
- case 21: { const r = { type: "TaggedTemplateExpression", start, end, tag: f1 !== NULL ? node(f1) : null, quasi: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
792
- case 22: { const r = { type: "NewExpression", start, end, callee: f1 !== NULL ? node(f1) : null, arguments: nodeArr(f2, f0) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
791
+ case 21: { const r = { type: "TaggedTemplateExpression", start, end, tag: f1 !== NULL ? node(f1) : null, quasi: f3 !== NULL ? node(f3) : null }; if (_isTs) { r.typeArguments = f2 !== NULL ? node(f2) : null; } return r; }
792
+ case 22: { const r = { type: "NewExpression", start, end, callee: f1 !== NULL ? node(f1) : null, arguments: nodeArr(f3, f0) }; if (_isTs) { r.typeArguments = f2 !== NULL ? node(f2) : null; } return r; }
793
793
  case 23: return { type: "AwaitExpression", start, end, argument: f1 !== NULL ? node(f1) : null };
794
794
  case 24: return { type: "YieldExpression", start, end, argument: f1 !== NULL ? node(f1) : null, delegate: !!(flags & 1) };
795
795
  case 25: return { type: "MetaProperty", start, end, meta: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null };
@@ -799,13 +799,13 @@ function decode(buffer, source) {
799
799
  type: CLASS_TYPES[flags & 1], start, end,
800
800
  decorators: nodeArr(f1, f0),
801
801
  id: f2 !== NULL ? node(f2) : null,
802
- superClass: f3 !== NULL ? node(f3) : null,
803
- body: node(f4),
802
+ superClass: f4 !== NULL ? node(f4) : null,
803
+ body: node(f8),
804
804
  };
805
805
  if (_isTs) {
806
- r.typeParameters = f5 !== NULL ? node(f5) : null;
807
- r.superTypeArguments = f6 !== NULL ? node(f6) : null;
808
- r.implements = nodeArr(f7, f8);
806
+ r.typeParameters = f3 !== NULL ? node(f3) : null;
807
+ r.superTypeArguments = f5 !== NULL ? node(f5) : null;
808
+ r.implements = nodeArr(f6, f7);
809
809
  r.abstract = !!(flags & 2);
810
810
  r.declare = !!(flags & 4);
811
811
  }
@@ -836,11 +836,11 @@ function decode(buffer, source) {
836
836
  start, end,
837
837
  decorators: nodeArr(f1, f0),
838
838
  key: node(f2),
839
- value: f3 !== NULL ? node(f3) : null,
839
+ value: f4 !== NULL ? node(f4) : null,
840
840
  computed: !!(flags & 1), static: !!(flags & 2),
841
841
  };
842
842
  if (_isTs) {
843
- r.typeAnnotation = f4 !== NULL ? node(f4) : null;
843
+ r.typeAnnotation = f3 !== NULL ? node(f3) : null;
844
844
  r.declare = !!(flags & 8);
845
845
  r.override = !!(flags & 16);
846
846
  r.optional = !!(flags & 32);
@@ -946,25 +946,25 @@ function decode(buffer, source) {
946
946
  type: "ExpressionStatement", start, end,
947
947
  expression: node(f1), directive: str(f2, f3),
948
948
  };
949
- case 69: { const r = { type: "AssignmentPattern", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.decorators = nodeArr(f3, f0); r.typeAnnotation = f4 !== NULL ? node(f4) : null; r.optional = !!(flags & 1); } return r; }
950
- case 70: { const r = { type: "RestElement", start, end, argument: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.decorators = nodeArr(f2, f0); r.typeAnnotation = f3 !== NULL ? node(f3) : null; r.optional = !!(flags & 1); r.value = null; } return r; }
949
+ case 69: { const r = { type: "AssignmentPattern", start, end, left: f2 !== NULL ? node(f2) : null, right: f4 !== NULL ? node(f4) : null }; if (_isTs) { r.decorators = nodeArr(f1, f0); r.typeAnnotation = f3 !== NULL ? node(f3) : null; r.optional = !!(flags & 1); } return r; }
950
+ case 70: { const r = { type: "RestElement", start, end, argument: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.decorators = nodeArr(f1, f0); r.typeAnnotation = f3 !== NULL ? node(f3) : null; r.optional = !!(flags & 1); r.value = null; } return r; }
951
951
  case 71: {
952
- const el = nodeArrHoles(f1, f0);
953
- if (f2 !== NULL) el.push(node(f2));
952
+ const el = nodeArrHoles(f2, f3);
953
+ if (f4 !== NULL) el.push(node(f4));
954
954
  const r = { type: "ArrayPattern", start, end, elements: el };
955
955
  if (_isTs) {
956
- r.decorators = nodeArr(f3, f4);
956
+ r.decorators = nodeArr(f1, f0);
957
957
  r.optional = !!(flags & 1);
958
958
  r.typeAnnotation = f5 !== NULL ? node(f5) : null;
959
959
  }
960
960
  return r;
961
961
  }
962
962
  case 72: {
963
- const pr = nodeArr(f1, f0);
964
- if (f2 !== NULL) pr.push(node(f2));
963
+ const pr = nodeArr(f2, f3);
964
+ if (f4 !== NULL) pr.push(node(f4));
965
965
  const r = { type: "ObjectPattern", start, end, properties: pr };
966
966
  if (_isTs) {
967
- r.decorators = nodeArr(f3, f4);
967
+ r.decorators = nodeArr(f1, f0);
968
968
  r.optional = !!(flags & 1);
969
969
  r.typeAnnotation = f5 !== NULL ? node(f5) : null;
970
970
  }
@@ -1131,7 +1131,7 @@ function decode(buffer, source) {
1131
1131
  case 154: return { type: "TSImportEqualsDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, moduleReference: f2 !== NULL ? node(f2) : null, importKind: IMPORT_EXPORT_KINDS[flags & 1] };
1132
1132
  case 155: return { type: "TSExternalModuleReference", start, end, expression: f1 !== NULL ? node(f1) : null };
1133
1133
  case 156: return { type: "JSXElement", start, end, openingElement: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingElement: f3 !== NULL ? node(f3) : null };
1134
- case 157: { const r = { type: "JSXOpeningElement", start, end, name: f1 !== NULL ? node(f1) : null, attributes: nodeArr(f2, f0), selfClosing: !!(flags & 1) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
1134
+ case 157: { const r = { type: "JSXOpeningElement", start, end, name: f1 !== NULL ? node(f1) : null, attributes: nodeArr(f3, f0), selfClosing: !!(flags & 1) }; if (_isTs) { r.typeArguments = f2 !== NULL ? node(f2) : null; } return r; }
1135
1135
  case 158: return { type: "JSXClosingElement", start, end, name: f1 !== NULL ? node(f1) : null };
1136
1136
  case 159: return { type: "JSXFragment", start, end, openingFragment: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingFragment: f3 !== NULL ? node(f3) : null };
1137
1137
  case 160: return { type: "JSXOpeningFragment", start, end };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuku-analyzer",
3
- "version": "0.5.47",
3
+ "version": "0.5.48",
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.47",
25
- "@yuku-analyzer/binding-linux-arm64-gnu": "0.5.47",
26
- "@yuku-analyzer/binding-linux-arm-gnu": "0.5.47",
27
- "@yuku-analyzer/binding-linux-x64-musl": "0.5.47",
28
- "@yuku-analyzer/binding-linux-arm64-musl": "0.5.47",
29
- "@yuku-analyzer/binding-linux-arm-musl": "0.5.47",
30
- "@yuku-analyzer/binding-darwin-x64": "0.5.47",
31
- "@yuku-analyzer/binding-darwin-arm64": "0.5.47",
32
- "@yuku-analyzer/binding-win32-x64": "0.5.47",
33
- "@yuku-analyzer/binding-win32-arm64": "0.5.47",
34
- "@yuku-analyzer/binding-freebsd-x64": "0.5.47"
24
+ "@yuku-analyzer/binding-linux-x64-gnu": "0.5.48",
25
+ "@yuku-analyzer/binding-linux-arm64-gnu": "0.5.48",
26
+ "@yuku-analyzer/binding-linux-arm-gnu": "0.5.48",
27
+ "@yuku-analyzer/binding-linux-x64-musl": "0.5.48",
28
+ "@yuku-analyzer/binding-linux-arm64-musl": "0.5.48",
29
+ "@yuku-analyzer/binding-linux-arm-musl": "0.5.48",
30
+ "@yuku-analyzer/binding-darwin-x64": "0.5.48",
31
+ "@yuku-analyzer/binding-darwin-arm64": "0.5.48",
32
+ "@yuku-analyzer/binding-win32-x64": "0.5.48",
33
+ "@yuku-analyzer/binding-win32-arm64": "0.5.48",
34
+ "@yuku-analyzer/binding-freebsd-x64": "0.5.48"
35
35
  },
36
36
  "keywords": [
37
37
  "analyzer",