yuku-parser 0.5.47 → 0.6.1

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 +44 -44
  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", []);
@@ -367,12 +367,12 @@ function decode(buffer, source) {
367
367
  const r = {
368
368
  type: "ArrowFunctionExpression", start, end,
369
369
  id: null, generator: false, async: !!(flags & 2),
370
- params: f1 !== NULL ? fnParams(f1) : [],
371
- body: node(f2), expression: !!(flags & 1),
370
+ params: f2 !== NULL ? fnParams(f2) : [],
371
+ body: node(f4), expression: !!(flags & 1),
372
372
  };
373
373
  if (_isTs) {
374
- r.typeParameters = f3 !== NULL ? node(f3) : null;
375
- r.returnType = f4 !== NULL ? node(f4) : null;
374
+ r.typeParameters = f1 !== NULL ? node(f1) : null;
375
+ r.returnType = f3 !== NULL ? node(f3) : null;
376
376
  }
377
377
  return r;
378
378
  }
@@ -382,13 +382,13 @@ function decode(buffer, source) {
382
382
  type: FUNCTION_TYPES[ft], start, end,
383
383
  id: f1 !== NULL ? node(f1) : null,
384
384
  generator: !!(flags & 4), async: !!(flags & 8),
385
- params: f2 !== NULL ? fnParams(f2) : [],
386
- body: f3 !== NULL ? node(f3) : null,
385
+ params: f3 !== NULL ? fnParams(f3) : [],
386
+ body: f5 !== NULL ? node(f5) : null,
387
387
  expression: false,
388
388
  };
389
389
  if (_isTs) {
390
- r.typeParameters = f4 !== NULL ? node(f4) : null;
391
- r.returnType = f5 !== NULL ? node(f5) : null;
390
+ r.typeParameters = f2 !== NULL ? node(f2) : null;
391
+ r.returnType = f4 !== NULL ? node(f4) : null;
392
392
  r.declare = !!(flags & 16);
393
393
  }
394
394
  return r;
@@ -412,10 +412,10 @@ function decode(buffer, source) {
412
412
  case 16: return { type: "SpreadElement", start, end, argument: f1 !== NULL ? node(f1) : null };
413
413
  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; }
414
414
  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) };
415
- 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; }
415
+ 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; }
416
416
  case 20: return { type: "ChainExpression", start, end, expression: f1 !== NULL ? node(f1) : null };
417
- 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; }
418
- 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; }
417
+ 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; }
418
+ 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; }
419
419
  case 23: return { type: "AwaitExpression", start, end, argument: f1 !== NULL ? node(f1) : null };
420
420
  case 24: return { type: "YieldExpression", start, end, argument: f1 !== NULL ? node(f1) : null, delegate: !!(flags & 1) };
421
421
  case 25: return { type: "MetaProperty", start, end, meta: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null };
@@ -425,13 +425,13 @@ function decode(buffer, source) {
425
425
  type: CLASS_TYPES[flags & 1], start, end,
426
426
  decorators: nodeArr(f1, f0),
427
427
  id: f2 !== NULL ? node(f2) : null,
428
- superClass: f3 !== NULL ? node(f3) : null,
429
- body: node(f4),
428
+ superClass: f4 !== NULL ? node(f4) : null,
429
+ body: node(f8),
430
430
  };
431
431
  if (_isTs) {
432
- r.typeParameters = f5 !== NULL ? node(f5) : null;
433
- r.superTypeArguments = f6 !== NULL ? node(f6) : null;
434
- r.implements = nodeArr(f7, f8);
432
+ r.typeParameters = f3 !== NULL ? node(f3) : null;
433
+ r.superTypeArguments = f5 !== NULL ? node(f5) : null;
434
+ r.implements = nodeArr(f6, f7);
435
435
  r.abstract = !!(flags & 2);
436
436
  r.declare = !!(flags & 4);
437
437
  }
@@ -462,11 +462,11 @@ function decode(buffer, source) {
462
462
  start, end,
463
463
  decorators: nodeArr(f1, f0),
464
464
  key: node(f2),
465
- value: f3 !== NULL ? node(f3) : null,
465
+ value: f4 !== NULL ? node(f4) : null,
466
466
  computed: !!(flags & 1), static: !!(flags & 2),
467
467
  };
468
468
  if (_isTs) {
469
- r.typeAnnotation = f4 !== NULL ? node(f4) : null;
469
+ r.typeAnnotation = f3 !== NULL ? node(f3) : null;
470
470
  r.declare = !!(flags & 8);
471
471
  r.override = !!(flags & 16);
472
472
  r.optional = !!(flags & 32);
@@ -572,25 +572,25 @@ function decode(buffer, source) {
572
572
  type: "ExpressionStatement", start, end,
573
573
  expression: node(f1), directive: str(f2, f3),
574
574
  };
575
- 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; }
576
- 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; }
575
+ 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; }
576
+ 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; }
577
577
  case 71: {
578
- const el = nodeArrHoles(f1, f0);
579
- if (f2 !== NULL) el.push(node(f2));
578
+ const el = nodeArrHoles(f2, f3);
579
+ if (f4 !== NULL) el.push(node(f4));
580
580
  const r = { type: "ArrayPattern", start, end, elements: el };
581
581
  if (_isTs) {
582
- r.decorators = nodeArr(f3, f4);
582
+ r.decorators = nodeArr(f1, f0);
583
583
  r.optional = !!(flags & 1);
584
584
  r.typeAnnotation = f5 !== NULL ? node(f5) : null;
585
585
  }
586
586
  return r;
587
587
  }
588
588
  case 72: {
589
- const pr = nodeArr(f1, f0);
590
- if (f2 !== NULL) pr.push(node(f2));
589
+ const pr = nodeArr(f2, f3);
590
+ if (f4 !== NULL) pr.push(node(f4));
591
591
  const r = { type: "ObjectPattern", start, end, properties: pr };
592
592
  if (_isTs) {
593
- r.decorators = nodeArr(f3, f4);
593
+ r.decorators = nodeArr(f1, f0);
594
594
  r.optional = !!(flags & 1);
595
595
  r.typeAnnotation = f5 !== NULL ? node(f5) : null;
596
596
  }
@@ -757,7 +757,7 @@ function decode(buffer, source) {
757
757
  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] };
758
758
  case 155: return { type: "TSExternalModuleReference", start, end, expression: f1 !== NULL ? node(f1) : null };
759
759
  case 156: return { type: "JSXElement", start, end, openingElement: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingElement: f3 !== NULL ? node(f3) : null };
760
- 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; }
760
+ 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; }
761
761
  case 158: return { type: "JSXClosingElement", start, end, name: f1 !== NULL ? node(f1) : null };
762
762
  case 159: return { type: "JSXFragment", start, end, openingFragment: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingFragment: f3 !== NULL ? node(f3) : null };
763
763
  case 160: return { type: "JSXOpeningFragment", start, end };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuku-parser",
3
- "version": "0.5.47",
3
+ "version": "0.6.1",
4
4
  "description": "High-performance JavaScript/TypeScript parser",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,17 +18,17 @@
18
18
  "walk.js"
19
19
  ],
20
20
  "optionalDependencies": {
21
- "@yuku-parser/binding-linux-x64-gnu": "0.5.47",
22
- "@yuku-parser/binding-linux-arm64-gnu": "0.5.47",
23
- "@yuku-parser/binding-linux-arm-gnu": "0.5.47",
24
- "@yuku-parser/binding-linux-x64-musl": "0.5.47",
25
- "@yuku-parser/binding-linux-arm64-musl": "0.5.47",
26
- "@yuku-parser/binding-linux-arm-musl": "0.5.47",
27
- "@yuku-parser/binding-darwin-x64": "0.5.47",
28
- "@yuku-parser/binding-darwin-arm64": "0.5.47",
29
- "@yuku-parser/binding-win32-x64": "0.5.47",
30
- "@yuku-parser/binding-win32-arm64": "0.5.47",
31
- "@yuku-parser/binding-freebsd-x64": "0.5.47"
21
+ "@yuku-parser/binding-linux-x64-gnu": "0.6.1",
22
+ "@yuku-parser/binding-linux-arm64-gnu": "0.6.1",
23
+ "@yuku-parser/binding-linux-arm-gnu": "0.6.1",
24
+ "@yuku-parser/binding-linux-x64-musl": "0.6.1",
25
+ "@yuku-parser/binding-linux-arm64-musl": "0.6.1",
26
+ "@yuku-parser/binding-linux-arm-musl": "0.6.1",
27
+ "@yuku-parser/binding-darwin-x64": "0.6.1",
28
+ "@yuku-parser/binding-darwin-arm64": "0.6.1",
29
+ "@yuku-parser/binding-win32-x64": "0.6.1",
30
+ "@yuku-parser/binding-win32-arm64": "0.6.1",
31
+ "@yuku-parser/binding-freebsd-x64": "0.6.1"
32
32
  },
33
33
  "dependencies": {
34
34
  "@yuku-toolchain/types": "0.5.43"