@openrewrite/rewrite 8.65.0-20251023-181533 → 8.65.0-20251024-060457

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/dist/version.txt CHANGED
@@ -1 +1 @@
1
- 8.65.0-20251023-181131
1
+ 8.65.0-20251024-060042
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrewrite/rewrite",
3
- "version": "8.65.0-20251023-181533",
3
+ "version": "8.65.0-20251024-060457",
4
4
  "license": "Moderne Source Available License",
5
5
  "description": "OpenRewrite JavaScript.",
6
6
  "homepage": "https://github.com/openrewrite/rewrite",
package/src/java/rpc.ts CHANGED
@@ -1088,8 +1088,8 @@ export class JavaReceiver extends JavaVisitor<RpcReceiveQueue> {
1088
1088
  expression: await q.receive(instanceOf.expression, expr => this.visitRightPadded(expr, q)),
1089
1089
  class: await q.receive(instanceOf.class, clazz => this.visit(clazz, q)),
1090
1090
  pattern: await q.receive(instanceOf.pattern, pattern => this.visit(pattern, q)),
1091
- modifier: await q.receive(instanceOf.modifier, mod => this.visit(mod, q)),
1092
- type: await q.receive(instanceOf.type, type => this.visitType(type, q))
1091
+ type: await q.receive(instanceOf.type, type => this.visitType(type, q)),
1092
+ modifier: await q.receive(instanceOf.modifier, mod => this.visit(mod, q))
1093
1093
  };
1094
1094
  return updateIfChanged(instanceOf, updates);
1095
1095
  }
@@ -968,11 +968,10 @@ export class JavaScriptParserVisitor {
968
968
  };
969
969
  }
970
970
 
971
- let name: J.Identifier = !node.name
972
- ? this.mapIdentifier(node, "")
973
- : ts.isStringLiteral(node.name)
974
- ? this.mapIdentifier(node.name, node.name.getText())
975
- : this.visit(node.name);
971
+ let name = this.mapMethodName(node) as J.Identifier;
972
+ name = produce(name, draft => {
973
+ draft.markers = this.maybeAddOptionalMarker(draft, node);
974
+ });
976
975
 
977
976
  return {
978
977
  kind: J.Kind.MethodDeclaration,
@@ -984,9 +983,7 @@ export class JavaScriptParserVisitor {
984
983
  typeParameters: this.mapTypeParametersAsObject(node),
985
984
  returnTypeExpression: this.mapTypeInfo(node),
986
985
  nameAnnotations: [],
987
- name: produce(name, draft => {
988
- draft.markers = this.maybeAddOptionalMarker(draft, node);
989
- }),
986
+ name: name,
990
987
  parameters: this.mapCommaSeparatedList(this.getParameterListNodes(node)),
991
988
  methodType: this.mapMethodType(node)
992
989
  };
@@ -1004,7 +1001,7 @@ export class JavaScriptParserVisitor {
1004
1001
  }
1005
1002
  });
1006
1003
 
1007
- let name: Expression = node.name ? this.visit(node.name) : this.mapIdentifier(node, "");
1004
+ let name = this.mapMethodName(node);
1008
1005
  name = produce(name, draft => {
1009
1006
  draft.markers = this.maybeAddOptionalMarker(draft, node);
1010
1007
  });
@@ -1043,6 +1040,14 @@ export class JavaScriptParserVisitor {
1043
1040
  };
1044
1041
  }
1045
1042
 
1043
+ private mapMethodName(node: ts.NamedDeclaration): J.Identifier | JS.ComputedPropertyName {
1044
+ return !node.name
1045
+ ? this.mapIdentifier(node, "")
1046
+ : ts.isStringLiteral(node.name) || ts.isNumericLiteral(node.name)
1047
+ ? this.mapIdentifier(node.name, node.name.getText())
1048
+ : this.visit(node.name);
1049
+ }
1050
+
1046
1051
  private mapTypeInfo(node: ts.MethodDeclaration | ts.PropertyDeclaration | ts.VariableDeclaration | ts.ParameterDeclaration
1047
1052
  | ts.PropertySignature | ts.MethodSignature | ts.ArrowFunction | ts.CallSignatureDeclaration | ts.GetAccessorDeclaration
1048
1053
  | ts.FunctionDeclaration | ts.ConstructSignatureDeclaration | ts.FunctionExpression | ts.NamedTupleMember): JS.TypeInfo | undefined {
@@ -1094,7 +1099,7 @@ export class JavaScriptParserVisitor {
1094
1099
  }
1095
1100
 
1096
1101
  visitGetAccessor(node: ts.GetAccessorDeclaration): J.MethodDeclaration | JS.ComputedPropertyMethodDeclaration {
1097
- const name = this.visit(node.name);
1102
+ const name = this.mapMethodName(node);
1098
1103
  if (ts.isComputedPropertyName(node.name)) {
1099
1104
  return {
1100
1105
  kind: JS.Kind.ComputedPropertyMethodDeclaration,
@@ -1120,7 +1125,7 @@ export class JavaScriptParserVisitor {
1120
1125
  modifiers: this.mapModifiers(node),
1121
1126
  returnTypeExpression: this.mapTypeInfo(node),
1122
1127
  nameAnnotations: [],
1123
- name: name,
1128
+ name: name as J.Identifier,
1124
1129
  parameters: this.mapCommaSeparatedList(this.getParameterListNodes(node)),
1125
1130
  body: node.body && this.convert<J.Block>(node.body),
1126
1131
  methodType: this.mapMethodType(node)
@@ -1128,7 +1133,7 @@ export class JavaScriptParserVisitor {
1128
1133
  }
1129
1134
 
1130
1135
  visitSetAccessor(node: ts.SetAccessorDeclaration): J.MethodDeclaration | JS.ComputedPropertyMethodDeclaration {
1131
- const name = this.visit(node.name);
1136
+ const name = this.mapMethodName(node);
1132
1137
  if (ts.isComputedPropertyName(node.name)) {
1133
1138
  return {
1134
1139
  kind: JS.Kind.ComputedPropertyMethodDeclaration,
@@ -1152,7 +1157,7 @@ export class JavaScriptParserVisitor {
1152
1157
  leadingAnnotations: this.mapDecorators(node),
1153
1158
  modifiers: this.mapModifiers(node),
1154
1159
  nameAnnotations: [],
1155
- name: name,
1160
+ name: name as J.Identifier,
1156
1161
  parameters: this.mapCommaSeparatedList(this.getParameterListNodes(node)),
1157
1162
  body: node.body && this.convert<J.Block>(node.body),
1158
1163
  methodType: this.mapMethodType(node)
@@ -3104,16 +3109,7 @@ export class JavaScriptParserVisitor {
3104
3109
  leadingAnnotations: [],
3105
3110
  nameAnnotations: [],
3106
3111
  modifiers: this.mapModifiers(node),
3107
- name: node.name ? this.visit(node.name) : {
3108
- kind: J.Kind.Identifier,
3109
- id: randomId(),
3110
- prefix: emptySpace,
3111
- markers: emptyMarkers,
3112
- annotations: [],
3113
- simpleName: "",
3114
- type: undefined,
3115
- fieldType: undefined
3116
- },
3112
+ name: this.mapMethodName(node) as J.Identifier,
3117
3113
  typeParameters: this.mapTypeParametersAsObject(node),
3118
3114
  parameters: this.mapCommaSeparatedList(this.getParameterListNodes(node)),
3119
3115
  returnTypeExpression: this.mapTypeInfo(node),