@openrewrite/rewrite 0.30.1 → 0.32.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.
Files changed (36) hide show
  1. package/dist/src/java/tree/support_types.d.ts +201 -190
  2. package/dist/src/java/tree/support_types.d.ts.map +1 -1
  3. package/dist/src/java/tree/support_types.js +75 -65
  4. package/dist/src/java/tree/support_types.js.map +1 -1
  5. package/dist/src/java/visitor.js +67 -67
  6. package/dist/src/javascript/extensions.js +1 -1
  7. package/dist/src/javascript/index.d.ts +1 -0
  8. package/dist/src/javascript/index.d.ts.map +1 -1
  9. package/dist/src/javascript/index.js +1 -0
  10. package/dist/src/javascript/index.js.map +1 -1
  11. package/dist/src/javascript/parser.d.ts.map +1 -1
  12. package/dist/src/javascript/parser.js +7 -4
  13. package/dist/src/javascript/parser.js.map +1 -1
  14. package/dist/src/javascript/printer.d.ts +136 -0
  15. package/dist/src/javascript/printer.d.ts.map +1 -0
  16. package/dist/src/javascript/printer.js +1671 -0
  17. package/dist/src/javascript/printer.js.map +1 -0
  18. package/dist/src/javascript/remote/receiver.js +2 -3
  19. package/dist/src/javascript/remote/receiver.js.map +1 -1
  20. package/dist/src/javascript/remote/sender.js +1 -2
  21. package/dist/src/javascript/remote/sender.js.map +1 -1
  22. package/dist/src/javascript/tree/support_types.d.ts +300 -177
  23. package/dist/src/javascript/tree/support_types.d.ts.map +1 -1
  24. package/dist/src/javascript/tree/support_types.js +314 -177
  25. package/dist/src/javascript/tree/support_types.js.map +1 -1
  26. package/dist/src/javascript/tree/tree.d.ts +9 -10
  27. package/dist/src/javascript/tree/tree.d.ts.map +1 -1
  28. package/dist/src/javascript/tree/tree.js +17 -18
  29. package/dist/src/javascript/tree/tree.js.map +1 -1
  30. package/dist/src/javascript/typeMapping.d.ts.map +1 -1
  31. package/dist/src/javascript/typeMapping.js +23 -9
  32. package/dist/src/javascript/typeMapping.js.map +1 -1
  33. package/dist/src/javascript/visitor.d.ts.map +1 -1
  34. package/dist/src/javascript/visitor.js +8 -4
  35. package/dist/src/javascript/visitor.js.map +1 -1
  36. package/package.json +1 -1
@@ -629,13 +629,13 @@ class JavaScriptParserVisitor {
629
629
  return new JS.FunctionType((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, [], this.leftPadded(java_1.Space.EMPTY, false), this.mapTypeParametersAsObject(node), new java_1.JContainer(this.prefix(node.getChildAt(node.getChildren().findIndex(n => n.pos === node.parameters.pos) - 1)), node.parameters.length == 0 ?
630
630
  [this.rightPadded(this.newJEmpty(), this.prefix(this.findChildNode(node, ts.SyntaxKind.CloseParenToken)))]
631
631
  : node.parameters.map(p => this.rightPadded(this.visit(p), this.suffix(p)))
632
- .concat(node.parameters.hasTrailingComma ? this.rightPadded(this.newJEmpty(), this.prefix(this.findChildNode(node, ts.SyntaxKind.CloseParenToken))) : []), core_1.Markers.EMPTY), this.prefix(this.findChildNode(node, ts.SyntaxKind.EqualsGreaterThanToken)), this.convert(node.type), null);
632
+ .concat(node.parameters.hasTrailingComma ? this.rightPadded(this.newJEmpty(), this.prefix(this.findChildNode(node, ts.SyntaxKind.CloseParenToken))) : []), core_1.Markers.EMPTY), this.leftPadded(this.prefix(this.findChildNode(node, ts.SyntaxKind.EqualsGreaterThanToken)), this.convert(node.type)), null);
633
633
  }
634
634
  visitConstructorType(node) {
635
635
  return new JS.FunctionType((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.mapModifiers(node), this.leftPadded(this.prefix(this.findChildNode(node, ts.SyntaxKind.NewKeyword)), true), this.mapTypeParametersAsObject(node), new java_1.JContainer(this.prefix(node.getChildAt(node.getChildren().findIndex(n => n.pos === node.parameters.pos) - 1)), node.parameters.length == 0 ?
636
636
  [this.rightPadded(this.newJEmpty(), this.prefix(this.findChildNode(node, ts.SyntaxKind.CloseParenToken)))]
637
637
  : node.parameters.map(p => this.rightPadded(this.visit(p), this.suffix(p)))
638
- .concat(node.parameters.hasTrailingComma ? this.rightPadded(this.newJEmpty(), this.prefix(this.findChildNode(node, ts.SyntaxKind.CloseParenToken))) : []), core_1.Markers.EMPTY), this.prefix(this.findChildNode(node, ts.SyntaxKind.EqualsGreaterThanToken)), this.convert(node.type), null);
638
+ .concat(node.parameters.hasTrailingComma ? this.rightPadded(this.newJEmpty(), this.prefix(this.findChildNode(node, ts.SyntaxKind.CloseParenToken))) : []), core_1.Markers.EMPTY), this.leftPadded(this.prefix(this.findChildNode(node, ts.SyntaxKind.EqualsGreaterThanToken)), this.convert(node.type)), null);
639
639
  }
640
640
  visitTypeQuery(node) {
641
641
  return new JS.TypeQuery((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.convert(node.exprName), node.typeArguments ? this.mapTypeArguments(this.suffix(node.exprName), node.typeArguments) : null, this.mapType(node));
@@ -710,10 +710,13 @@ class JavaScriptParserVisitor {
710
710
  function hasSuffixToken(questionToken) {
711
711
  return !!(questionToken && (questionToken.kind == ts.SyntaxKind.PlusToken || questionToken.kind == ts.SyntaxKind.MinusToken));
712
712
  }
713
- return new JS.MappedType((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, hasPrefixToken(node.readonlyToken) ? this.leftPadded(this.prefix(node.readonlyToken), new J.Literal((0, core_1.randomId)(), this.prefix(node.readonlyToken), core_1.Markers.EMPTY, null, node.readonlyToken.getText(), null, this.mapPrimitiveType(node.readonlyToken))) : null, node.readonlyToken ? this.leftPadded(this.prefix(this.findChildNode(node, ts.SyntaxKind.ReadonlyKeyword)), true) : this.leftPadded(java_1.Space.EMPTY, false), new JS.MappedType.KeysRemapping((0, core_1.randomId)(), this.prefix(this.findChildNode(node, ts.SyntaxKind.OpenBracketToken)), core_1.Markers.EMPTY, this.rightPadded(new JS.MappedType.MappedTypeParameter((0, core_1.randomId)(), this.prefix(node.typeParameter), core_1.Markers.EMPTY, this.visit(node.typeParameter.name), this.leftPadded(this.suffix(node.typeParameter.name), this.visit(node.typeParameter.constraint))), this.suffix(node.typeParameter)), node.nameType ? this.rightPadded(this.visit(node.nameType), this.suffix(node.nameType)) : null), hasSuffixToken(node.questionToken) ? this.leftPadded(this.prefix(node.questionToken), new J.Literal((0, core_1.randomId)(), this.prefix(node.questionToken), core_1.Markers.EMPTY, null, node.questionToken.getText(), null, this.mapPrimitiveType(node.questionToken))) : null, node.questionToken ? this.leftPadded(this.prefix(this.findChildNode(node, ts.SyntaxKind.QuestionToken)), true) : this.leftPadded(java_1.Space.EMPTY, false), new java_1.JContainer(this.prefix(this.findChildNode(node, ts.SyntaxKind.ColonToken)), [this.rightPadded(this.visit(node.type), this.suffix(node.type)),
713
+ return new JS.MappedType((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, hasPrefixToken(node.readonlyToken) ? this.leftPadded(this.prefix(node.readonlyToken), new J.Literal((0, core_1.randomId)(), this.prefix(node.readonlyToken), core_1.Markers.EMPTY, null, node.readonlyToken.getText(), null, this.mapPrimitiveType(node.readonlyToken))) : null, node.readonlyToken ? this.leftPadded(this.prefix(this.findChildNode(node, ts.SyntaxKind.ReadonlyKeyword)), true) : this.leftPadded(java_1.Space.EMPTY, false), new JS.MappedType.KeysRemapping((0, core_1.randomId)(), this.prefix(this.findChildNode(node, ts.SyntaxKind.OpenBracketToken)), core_1.Markers.EMPTY, this.rightPadded(new JS.MappedType.MappedTypeParameter((0, core_1.randomId)(), this.prefix(node.typeParameter), core_1.Markers.EMPTY, this.visit(node.typeParameter.name), this.leftPadded(this.suffix(node.typeParameter.name), this.visit(node.typeParameter.constraint))), this.suffix(node.typeParameter)), node.nameType ? this.rightPadded(this.visit(node.nameType), this.suffix(node.nameType)) : null), hasSuffixToken(node.questionToken) ? this.leftPadded(this.prefix(node.questionToken), new J.Literal((0, core_1.randomId)(), this.prefix(node.questionToken), core_1.Markers.EMPTY, null, node.questionToken.getText(), null, this.mapPrimitiveType(node.questionToken))) : null, node.questionToken ? this.leftPadded(this.prefix(this.findChildNode(node, ts.SyntaxKind.QuestionToken)), true) : this.leftPadded(java_1.Space.EMPTY, false), node.type ? new java_1.JContainer(this.prefix(this.findChildNode(node, ts.SyntaxKind.ColonToken)), [this.rightPadded(this.visit(node.type), this.suffix(node.type)),
714
714
  this.findChildNode(node, ts.SyntaxKind.SemicolonToken) ?
715
715
  this.rightPadded(this.newJEmpty(java_1.Space.EMPTY, core_1.Markers.build([new java_1.Semicolon((0, core_1.randomId)())])), this.prefix(node.getLastToken()))
716
716
  : this.rightPadded(this.newJEmpty(), this.prefix(node.getLastToken()))
717
+ ], core_1.Markers.EMPTY) : new java_1.JContainer(java_1.Space.EMPTY, [this.findChildNode(node, ts.SyntaxKind.SemicolonToken) ?
718
+ this.rightPadded(this.newJEmpty(this.prefix(this.findChildNode(node, ts.SyntaxKind.SemicolonToken)), core_1.Markers.build([new java_1.Semicolon((0, core_1.randomId)())])), this.prefix(node.getLastToken()))
719
+ : this.rightPadded(this.newJEmpty(), this.prefix(node.getLastToken()))
717
720
  ], core_1.Markers.EMPTY), this.mapType(node));
718
721
  }
719
722
  visitLiteralType(node) {
@@ -1085,7 +1088,7 @@ class JavaScriptParserVisitor {
1085
1088
  return new J.ForLoop((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, new J.ForLoop.Control((0, core_1.randomId)(), this.prefix(this.findChildNode(node, ts.SyntaxKind.OpenParenToken)), core_1.Markers.EMPTY, [node.initializer ?
1086
1089
  (ts.isVariableDeclarationList(node.initializer) ? this.rightPadded(this.visit(node.initializer), java_1.Space.EMPTY) :
1087
1090
  this.rightPadded(new _1.ExpressionStatement((0, core_1.randomId)(), this.visit(node.initializer)), this.suffix(node.initializer))) :
1088
- this.rightPadded(this.newJEmpty(), this.suffix(this.findChildNode(node, ts.SyntaxKind.OpenParenToken)))], node.condition ? this.rightPadded(ts.isStatement(node.condition) ? this.visit(node.condition) : new _1.ExpressionStatement((0, core_1.randomId)(), this.visit(node.condition)), this.suffix(node.condition)) :
1091
+ this.rightPadded(this.newJEmpty(), this.suffix(this.findChildNode(node, ts.SyntaxKind.OpenParenToken)))], node.condition ? this.rightPadded(this.visit(node.condition), this.suffix(node.condition)) :
1089
1092
  this.rightPadded(this.newJEmpty(), this.suffix(this.findChildNode(node, ts.SyntaxKind.SemicolonToken))), [node.incrementor ? this.rightPadded(ts.isStatement(node.incrementor) ? this.visit(node.incrementor) : new _1.ExpressionStatement((0, core_1.randomId)(), this.visit(node.incrementor)), this.suffix(node.incrementor)) :
1090
1093
  this.rightPadded(this.newJEmpty(this.prefix(this.findChildNode(node, ts.SyntaxKind.CloseParenToken))), java_1.Space.EMPTY)]), this.rightPadded(this.convert(node.statement), this.semicolonPrefix(node.statement), ((_a = node.statement.getChildAt(node.statement.getChildCount() - 1)) === null || _a === void 0 ? void 0 : _a.kind) == ts.SyntaxKind.SemicolonToken ? core_1.Markers.build([new java_1.Semicolon((0, core_1.randomId)())]) : core_1.Markers.EMPTY));
1091
1094
  }