@openrewrite/rewrite 0.27.0 → 0.28.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 (37) hide show
  1. package/dist/src/java/remote/receiver.d.ts.map +1 -1
  2. package/dist/src/java/remote/receiver.js +0 -10
  3. package/dist/src/java/remote/receiver.js.map +1 -1
  4. package/dist/src/java/remote/sender.d.ts.map +1 -1
  5. package/dist/src/java/remote/sender.js +0 -7
  6. package/dist/src/java/remote/sender.js.map +1 -1
  7. package/dist/src/java/tree/tree.d.ts +0 -39
  8. package/dist/src/java/tree/tree.d.ts.map +1 -1
  9. package/dist/src/java/tree/tree.js +2 -48
  10. package/dist/src/java/tree/tree.js.map +1 -1
  11. package/dist/src/java/visitor.d.ts +1 -2
  12. package/dist/src/java/visitor.d.ts.map +1 -1
  13. package/dist/src/java/visitor.js +0 -15
  14. package/dist/src/java/visitor.js.map +1 -1
  15. package/dist/src/javascript/parser.d.ts +10 -9
  16. package/dist/src/javascript/parser.d.ts.map +1 -1
  17. package/dist/src/javascript/parser.js +52 -23
  18. package/dist/src/javascript/parser.js.map +1 -1
  19. package/dist/src/javascript/remote/receiver.d.ts.map +1 -1
  20. package/dist/src/javascript/remote/receiver.js +84 -17
  21. package/dist/src/javascript/remote/receiver.js.map +1 -1
  22. package/dist/src/javascript/remote/sender.d.ts.map +1 -1
  23. package/dist/src/javascript/remote/sender.js +62 -13
  24. package/dist/src/javascript/remote/sender.js.map +1 -1
  25. package/dist/src/javascript/tree/support_types.d.ts +19 -4
  26. package/dist/src/javascript/tree/support_types.d.ts.map +1 -1
  27. package/dist/src/javascript/tree/support_types.js +15 -0
  28. package/dist/src/javascript/tree/support_types.js.map +1 -1
  29. package/dist/src/javascript/tree/tree.d.ts +349 -26
  30. package/dist/src/javascript/tree/tree.d.ts.map +1 -1
  31. package/dist/src/javascript/tree/tree.js +447 -59
  32. package/dist/src/javascript/tree/tree.js.map +1 -1
  33. package/dist/src/javascript/visitor.d.ts +8 -1
  34. package/dist/src/javascript/visitor.d.ts.map +1 -1
  35. package/dist/src/javascript/visitor.js +67 -6
  36. package/dist/src/javascript/visitor.js.map +1 -1
  37. package/package.json +1 -1
@@ -271,7 +271,7 @@ class JavaScriptParserVisitor {
271
271
  || ts.isInterfaceDeclaration(node) || ts.isPropertyDeclaration(node) || ts.isPropertySignature(node) || ts.isParameter(node)
272
272
  || ts.isMethodDeclaration(node) || ts.isConstructorDeclaration(node) || ts.isArrowFunction(node)
273
273
  || ts.isIndexSignatureDeclaration(node) || ts.isTypeAliasDeclaration(node) || ts.isExportDeclaration(node)
274
- || ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isConstructorTypeNode(node) || ts.isTypeParameterDeclaration(node)) {
274
+ || ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isConstructorTypeNode(node) || ts.isTypeParameterDeclaration(node) || ts.isImportDeclaration(node) || ts.isImportEqualsDeclaration(node)) {
275
275
  return node.modifiers ? (_a = node.modifiers) === null || _a === void 0 ? void 0 : _a.filter(ts.isModifier).map(this.mapModifier) : [];
276
276
  }
277
277
  else if (ts.isExportAssignment(node)) {
@@ -396,6 +396,9 @@ class JavaScriptParserVisitor {
396
396
  visitAnyKeyword(node) {
397
397
  return this.mapIdentifier(node, 'any');
398
398
  }
399
+ visitIntrinsicKeyword(node) {
400
+ return this.mapIdentifier(node, 'intrinsic');
401
+ }
399
402
  visitObjectKeyword(node) {
400
403
  return this.mapIdentifier(node, 'object');
401
404
  }
@@ -499,6 +502,9 @@ class JavaScriptParserVisitor {
499
502
  else if (ts.isPropertyAccessExpression(node.expression)) {
500
503
  annotationType = this.convert(node.expression);
501
504
  }
505
+ else if (ts.isParenthesizedExpression(node.expression)) {
506
+ annotationType = new JS.TypeTreeExpression((0, core_1.randomId)(), this.prefix(node.expression), core_1.Markers.EMPTY, this.convert(node.expression));
507
+ }
502
508
  else {
503
509
  return this.visitUnknown(node);
504
510
  }
@@ -536,7 +542,12 @@ class JavaScriptParserVisitor {
536
542
  if (ts.isComputedPropertyName(node.name)) {
537
543
  return new JS.JSMethodDeclaration((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, [], [], this.mapTypeParametersAsObject(node), this.mapTypeInfo(node), this.convert(node.name), this.mapCommaSeparatedList(this.getParameterListNodes(node)), null, null, null, this.mapMethodType(node));
538
544
  }
539
- return new J.MethodDeclaration((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, [], [], this.mapTypeParametersAsObject(node), this.mapTypeInfo(node), new J.MethodDeclaration.IdentifierWithAnnotations(node.name ? this.visit(node.name) : this.mapIdentifier(node, ""), []), this.mapCommaSeparatedList(this.getParameterListNodes(node)), null, null, null, this.mapMethodType(node));
545
+ const name = !node.name
546
+ ? this.mapIdentifier(node, "")
547
+ : ts.isStringLiteral(node.name)
548
+ ? this.mapIdentifier(node.name, node.name.getText())
549
+ : this.visit(node.name);
550
+ return new J.MethodDeclaration((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, [], [], this.mapTypeParametersAsObject(node), this.mapTypeInfo(node), new J.MethodDeclaration.IdentifierWithAnnotations(name, []), this.mapCommaSeparatedList(this.getParameterListNodes(node)), null, null, null, this.mapMethodType(node));
540
551
  }
541
552
  visitMethodDeclaration(node) {
542
553
  if (node.questionToken || node.asteriskToken) {
@@ -603,7 +614,10 @@ class JavaScriptParserVisitor {
603
614
  .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);
604
615
  }
605
616
  visitConstructorType(node) {
606
- 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.map(p => this.rightPadded(this.visit(p), this.suffix(p))), core_1.Markers.EMPTY), this.prefix(this.findChildNode(node, ts.SyntaxKind.EqualsGreaterThanToken)), this.convert(node.type), null);
617
+ 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 ?
618
+ [this.rightPadded(this.newJEmpty(), this.prefix(this.findChildNode(node, ts.SyntaxKind.CloseParenToken)))]
619
+ : node.parameters.map(p => this.rightPadded(this.visit(p), this.suffix(p)))
620
+ .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);
607
621
  }
608
622
  visitTypeQuery(node) {
609
623
  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));
@@ -875,6 +889,9 @@ class JavaScriptParserVisitor {
875
889
  case ts.SyntaxKind.AsteriskAsteriskToken:
876
890
  assignmentOperation = JS.JsAssignmentOperation.Type.Power;
877
891
  break;
892
+ case ts.SyntaxKind.AsteriskAsteriskEqualsToken:
893
+ assignmentOperation = JS.JsAssignmentOperation.Type.Exp;
894
+ break;
878
895
  }
879
896
  if (assignmentOperation !== undefined) {
880
897
  return new JS.JsAssignmentOperation((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.convert(node.left), this.leftPadded(this.prefix(node.operatorToken), assignmentOperation), this.convert(node.right), this.mapType(node));
@@ -970,7 +987,7 @@ class JavaScriptParserVisitor {
970
987
  return new JS.Unary((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.leftPadded(java_1.Space.EMPTY, JS.Unary.Type.Spread), this.convert(node.expression), this.mapType(node));
971
988
  }
972
989
  visitClassExpression(node) {
973
- return new JS.StatementExpression((0, core_1.randomId)(), new J.ClassDeclaration((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, [], [], new J.ClassDeclaration.Kind((0, core_1.randomId)(), node.modifiers ? this.suffix(node.modifiers[node.modifiers.length - 1]) : this.prefix(node), core_1.Markers.EMPTY, [], J.ClassDeclaration.Kind.Type.Class), node.name ? this.convert(node.name) : this.mapIdentifier(node, ""), this.mapTypeParametersAsJContainer(node), null, this.mapExtends(node), this.mapImplements(node), null, new J.Block((0, core_1.randomId)(), this.prefix(this.findChildNode(node, ts.SyntaxKind.OpenBraceToken)), core_1.Markers.EMPTY, this.rightPadded(false, java_1.Space.EMPTY), node.members.map(ce => {
990
+ return new JS.StatementExpression((0, core_1.randomId)(), new J.ClassDeclaration((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.mapDecorators(node), [], new J.ClassDeclaration.Kind((0, core_1.randomId)(), node.modifiers ? this.suffix(node.modifiers[node.modifiers.length - 1]) : this.prefix(node), core_1.Markers.EMPTY, [], J.ClassDeclaration.Kind.Type.Class), node.name ? this.convert(node.name) : this.mapIdentifier(node, ""), this.mapTypeParametersAsJContainer(node), null, this.mapExtends(node), this.mapImplements(node), null, new J.Block((0, core_1.randomId)(), this.prefix(this.findChildNode(node, ts.SyntaxKind.OpenBraceToken)), core_1.Markers.EMPTY, this.rightPadded(false, java_1.Space.EMPTY), node.members.map(ce => {
974
991
  var _a, _b;
975
992
  return new java_1.JRightPadded(this.convert(ce), ((_a = ce.getLastToken()) === null || _a === void 0 ? void 0 : _a.kind) === ts.SyntaxKind.SemicolonToken ? this.prefix(ce.getLastToken()) : java_1.Space.EMPTY, ((_b = ce.getLastToken()) === null || _b === void 0 ? void 0 : _b.kind) === ts.SyntaxKind.SemicolonToken ? core_1.Markers.build([new java_1.Semicolon((0, core_1.randomId)())]) : core_1.Markers.EMPTY);
976
993
  }), this.prefix(node.getLastToken())), this.mapType(node)));
@@ -1012,7 +1029,8 @@ class JavaScriptParserVisitor {
1012
1029
  return this.newJEmpty(this.prefix(node));
1013
1030
  }
1014
1031
  visitVariableStatement(node) {
1015
- return this.visitVariableDeclarationList(node.declarationList).withModifiers(this.mapModifiers(node)).withPrefix(this.prefix(node));
1032
+ const declaration = this.visitVariableDeclarationList(node.declarationList);
1033
+ return declaration.withModifiers(this.mapModifiers(node).concat(declaration.modifiers)).withPrefix(this.prefix(node));
1016
1034
  }
1017
1035
  visitExpressionStatement(node) {
1018
1036
  const expression = this.visit(node.expression);
@@ -1063,7 +1081,8 @@ class JavaScriptParserVisitor {
1063
1081
  return new J.Return((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, node.expression ? this.convert(node.expression) : null);
1064
1082
  }
1065
1083
  visitWithStatement(node) {
1066
- return this.visitUnknown(node);
1084
+ var _a;
1085
+ return new JS.WithStatement((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, new J.ControlParentheses((0, core_1.randomId)(), this.prefix(this.findChildNode(node, ts.SyntaxKind.OpenParenToken)), core_1.Markers.EMPTY, this.rightPadded(this.visit(node.expression), this.suffix(node.expression))), 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));
1067
1086
  }
1068
1087
  visitSwitchStatement(node) {
1069
1088
  return new J.Switch((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, new J.ControlParentheses((0, core_1.randomId)(), this.prefix(this.findChildNode(node, ts.SyntaxKind.OpenParenToken)), core_1.Markers.EMPTY, this.rightPadded(this.visit(node.expression), this.suffix(node.expression))), this.visit(node.caseBlock));
@@ -1076,6 +1095,10 @@ class JavaScriptParserVisitor {
1076
1095
  return new J.Throw((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.visit(node.expression));
1077
1096
  }
1078
1097
  visitTryStatement(node) {
1098
+ var _a, _b, _c, _d;
1099
+ if (((_b = (_a = node.catchClause) === null || _a === void 0 ? void 0 : _a.variableDeclaration) === null || _b === void 0 ? void 0 : _b.name) && !ts.isIdentifier((_d = (_c = node.catchClause) === null || _c === void 0 ? void 0 : _c.variableDeclaration) === null || _d === void 0 ? void 0 : _d.name)) {
1100
+ return new JS.JSTry((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.visit(node.tryBlock), this.visit(node.catchClause), node.finallyBlock ? this.leftPadded(this.prefix(this.findChildNode(node, ts.SyntaxKind.FinallyKeyword)), this.visit(node.finallyBlock)) : null);
1101
+ }
1079
1102
  return new J.Try((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, null, this.visit(node.tryBlock), node.catchClause ? [this.visit(node.catchClause)] : [], node.finallyBlock ? this.leftPadded(this.prefix(this.findChildNode(node, ts.SyntaxKind.FinallyKeyword)), this.visit(node.finallyBlock)) : null);
1080
1103
  }
1081
1104
  visitDebuggerStatement(node) {
@@ -1089,8 +1112,13 @@ class JavaScriptParserVisitor {
1089
1112
  return new JS.JSVariableDeclarations.JSNamedVariable((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, node.exclamationToken ? new JS.Unary((0, core_1.randomId)(), java_1.Space.EMPTY, core_1.Markers.EMPTY, this.leftPadded(this.suffix(node.name), JS.Unary.Type.Exclamation), nameExpression, this.mapType(node)) : nameExpression, [], node.initializer ? this.leftPadded(this.prefix(node.getChildAt(node.getChildCount(this.sourceFile) - 2)), this.visit(node.initializer)) : null, this.mapVariableType(node));
1090
1113
  }
1091
1114
  visitVariableDeclarationList(node) {
1092
- const kind = node.getFirstToken(this.sourceFile);
1093
- return new JS.ScopedVariableDeclarations((0, core_1.randomId)(), java_1.Space.EMPTY, core_1.Markers.EMPTY, [], this.leftPadded(this.prefix(node), (kind === null || kind === void 0 ? void 0 : kind.kind) === ts.SyntaxKind.LetKeyword
1115
+ let kind = node.getFirstToken();
1116
+ let modifier;
1117
+ if ((kind === null || kind === void 0 ? void 0 : kind.kind) === ts.SyntaxKind.AwaitKeyword) {
1118
+ modifier = new J.Modifier((0, core_1.randomId)(), this.prefix(kind), core_1.Markers.EMPTY, 'await', J.Modifier.Type.LanguageExtension, []);
1119
+ kind = node.getChildAt(1);
1120
+ }
1121
+ return new JS.ScopedVariableDeclarations((0, core_1.randomId)(), java_1.Space.EMPTY, core_1.Markers.EMPTY, modifier ? [modifier] : [], this.leftPadded(kind ? this.prefix(kind) : this.prefix(node), (kind === null || kind === void 0 ? void 0 : kind.kind) === ts.SyntaxKind.LetKeyword
1094
1122
  ? JS.ScopedVariableDeclarations.Scope.Let
1095
1123
  : (kind === null || kind === void 0 ? void 0 : kind.kind) === ts.SyntaxKind.ConstKeyword
1096
1124
  ? JS.ScopedVariableDeclarations.Scope.Const
@@ -1169,30 +1197,25 @@ class JavaScriptParserVisitor {
1169
1197
  ], this.leftPadded(this.prefix(this.findChildNode(node, ts.SyntaxKind.NamespaceKeyword)), JS.NamespaceDeclaration.KeywordType.Namespace), this.rightPadded(this.convert(node.name), this.suffix(node.name)), null);
1170
1198
  }
1171
1199
  visitImportEqualsDeclaration(node) {
1172
- return this.visitUnknown(node);
1200
+ const kind = this.findChildNode(node, ts.SyntaxKind.ImportKeyword);
1201
+ return new JS.ScopedVariableDeclarations((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.mapModifiers(node), this.leftPadded(this.prefix(kind), JS.ScopedVariableDeclarations.Scope.Import), [
1202
+ this.rightPadded(new J.VariableDeclarations((0, core_1.randomId)(), java_1.Space.EMPTY, core_1.Markers.EMPTY, [], node.isTypeOnly ? [new J.Modifier((0, core_1.randomId)(), this.prefix(this.findChildNode(node, ts.SyntaxKind.TypeKeyword)), core_1.Markers.EMPTY, "type", J.Modifier.Type.LanguageExtension, [])] : [], null, null, [], [this.rightPadded(new J.VariableDeclarations.NamedVariable((0, core_1.randomId)(), java_1.Space.EMPTY, core_1.Markers.EMPTY, this.visit(node.name), [], this.leftPadded(this.suffix(node.name), this.visit(node.moduleReference)), this.mapVariableType(node)), java_1.Space.EMPTY)]), java_1.Space.EMPTY)
1203
+ ]);
1173
1204
  }
1174
1205
  visitImportKeyword(node) {
1175
1206
  return this.mapIdentifier(node, 'import');
1176
1207
  }
1177
1208
  visitImportDeclaration(node) {
1178
- var _a, _b, _c, _d;
1179
- const children = node.getChildren(this.sourceFile);
1180
- const _default = !!((_a = node.importClause) === null || _a === void 0 ? void 0 : _a.name);
1181
- const onlyDefault = _default && node.importClause.namedBindings == undefined;
1182
- return new JS.JsImport((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, _default ? this.rightPadded(this.visit((_b = node.importClause) === null || _b === void 0 ? void 0 : _b.name), this.suffix((_c = node.importClause) === null || _c === void 0 ? void 0 : _c.name)) : null, ((_d = node.importClause) === null || _d === void 0 ? void 0 : _d.isTypeOnly) ? this.leftPadded(this.prefix(this.findChildNode(node.importClause, ts.SyntaxKind.TypeKeyword)), node.importClause.isTypeOnly) : this.leftPadded(java_1.Space.EMPTY, false), node.importClause && !onlyDefault ? this.visit(node.importClause) : null, children[children.indexOf(node.moduleSpecifier) - 1].kind == ts.SyntaxKind.FromKeyword ? this.prefix(children[children.indexOf(node.moduleSpecifier) - 1]) : null, this.convert(node.moduleSpecifier), null);
1209
+ return new JS.JsImport((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.mapModifiers(node), node.importClause ? this.visit(node.importClause) : null, this.leftPadded(node.importClause ? this.prefix(this.findChildNode(node, ts.SyntaxKind.FromKeyword)) : java_1.Space.EMPTY, this.visit(node.moduleSpecifier)), node.attributes ? this.visit(node.attributes) : null);
1183
1210
  }
1184
1211
  visitImportClause(node) {
1185
- var _a;
1186
- if (node.namedBindings && ts.isNamespaceImport(node.namedBindings)) {
1187
- return new java_1.JContainer(this.prefix(node), [this.rightPadded(new JS.Alias((0, core_1.randomId)(), java_1.Space.EMPTY, core_1.Markers.EMPTY, this.rightPadded(this.mapIdentifier(node.namedBindings, "*"), this.prefix(node.namedBindings.getChildAt(1, this.sourceFile))), this.convert(node.namedBindings.name)), java_1.Space.EMPTY)], core_1.Markers.EMPTY);
1188
- }
1189
- return this.mapCommaSeparatedList((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.getChildren(this.sourceFile));
1212
+ return new JS.JsImportClause((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, node.isTypeOnly, node.name ? this.rightPadded(this.visit(node.name), this.suffix(node.name)) : null, node.namedBindings ? this.visit(node.namedBindings) : null);
1190
1213
  }
1191
1214
  visitNamespaceImport(node) {
1192
- return this.visitUnknown(node);
1215
+ return new JS.Alias((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.rightPadded(this.mapIdentifier(node, "*"), this.prefix(this.findChildNode(node, ts.SyntaxKind.AsKeyword))), this.visit(node.name));
1193
1216
  }
1194
1217
  visitNamedImports(node) {
1195
- return this.visitUnknown(node);
1218
+ return new JS.NamedImports((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.mapCommaSeparatedList(node.getChildren(this.sourceFile)), null);
1196
1219
  }
1197
1220
  visitImportSpecifier(node) {
1198
1221
  return new JS.JsImportSpecifier((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.leftPadded(node.isTypeOnly ? this.prefix(this.findChildNode(node, ts.SyntaxKind.TypeKeyword)) : java_1.Space.EMPTY, node.isTypeOnly), node.propertyName
@@ -1268,15 +1291,21 @@ class JavaScriptParserVisitor {
1268
1291
  return this.convert(node.types[0]);
1269
1292
  }
1270
1293
  visitCatchClause(node) {
1294
+ var _a, _b;
1295
+ if (((_a = node.variableDeclaration) === null || _a === void 0 ? void 0 : _a.name) && !ts.isIdentifier((_b = node.variableDeclaration) === null || _b === void 0 ? void 0 : _b.name)) {
1296
+ return new JS.JSTry.JSCatch((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, new J.ControlParentheses((0, core_1.randomId)(), this.prefix(this.findChildNode(node, ts.SyntaxKind.OpenParenToken)), core_1.Markers.EMPTY, this.rightPadded(new JS.JSVariableDeclarations((0, core_1.randomId)(), this.prefix(node.variableDeclaration), core_1.Markers.EMPTY, [], [], this.mapTypeInfo(node.variableDeclaration), null, [this.rightPadded(this.visit(node.variableDeclaration), java_1.Space.EMPTY)]), this.suffix(node.variableDeclaration))), this.visit(node.block));
1297
+ }
1271
1298
  return new J.Try.Catch((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, node.variableDeclaration ?
1272
1299
  new J.ControlParentheses((0, core_1.randomId)(), this.prefix(this.findChildNode(node, ts.SyntaxKind.OpenParenToken)), core_1.Markers.EMPTY, this.rightPadded(new J.VariableDeclarations((0, core_1.randomId)(), this.prefix(node.variableDeclaration), core_1.Markers.EMPTY, [], [], this.mapTypeInfo(node.variableDeclaration), null, [], [this.rightPadded(this.visit(node.variableDeclaration), java_1.Space.EMPTY)]), this.suffix(node.variableDeclaration))) :
1273
1300
  new J.ControlParentheses((0, core_1.randomId)(), java_1.Space.EMPTY, core_1.Markers.EMPTY, this.rightPadded(new J.VariableDeclarations((0, core_1.randomId)(), java_1.Space.EMPTY, core_1.Markers.EMPTY, [], [], null, null, [], []), java_1.Space.EMPTY)), this.visit(node.block));
1274
1301
  }
1275
1302
  visitImportAttributes(node) {
1276
- return this.visitUnknown(node);
1303
+ const openBraceIndex = node.getChildren().findIndex(n => n.kind === ts.SyntaxKind.OpenBraceToken);
1304
+ const elements = this.mapCommaSeparatedList(node.getChildren(this.sourceFile).slice(openBraceIndex, openBraceIndex + 3));
1305
+ return new JS.ImportAttributes((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, ts.SyntaxKind.WithKeyword === node.token ? JS.ImportAttributes.Token.With : JS.ImportAttributes.Token.Assert, elements);
1277
1306
  }
1278
1307
  visitImportAttribute(node) {
1279
- return this.visitUnknown(node);
1308
+ return new JS.ImportAttribute((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.visit(node.name), this.leftPadded(this.suffix(node.name), this.visit(node.value)));
1280
1309
  }
1281
1310
  visitPropertyAssignment(node) {
1282
1311
  return new JS.PropertyAssignment((0, core_1.randomId)(), this.prefix(node), core_1.Markers.EMPTY, this.rightPadded(this.visit(node.name), this.suffix(node.name)), JS.PropertyAssignment.AssigmentToken.Colon, this.visit(node.initializer));