@openrewrite/rewrite 8.66.0-20251027-095903 → 8.66.0-20251027-133754
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/java/tree.d.ts +1 -0
- package/dist/java/tree.d.ts.map +1 -1
- package/dist/java/tree.js +6 -1
- package/dist/java/tree.js.map +1 -1
- package/dist/javascript/add-import.d.ts +102 -0
- package/dist/javascript/add-import.d.ts.map +1 -0
- package/dist/javascript/add-import.js +789 -0
- package/dist/javascript/add-import.js.map +1 -0
- package/dist/javascript/format.d.ts.map +1 -1
- package/dist/javascript/format.js +9 -1
- package/dist/javascript/format.js.map +1 -1
- package/dist/javascript/index.d.ts +1 -0
- package/dist/javascript/index.d.ts.map +1 -1
- package/dist/javascript/index.js +1 -0
- package/dist/javascript/index.js.map +1 -1
- package/dist/javascript/type-mapping.js +1 -1
- package/dist/javascript/type-mapping.js.map +1 -1
- package/dist/version.txt +1 -1
- package/package.json +1 -1
- package/src/java/tree.ts +6 -0
- package/src/javascript/add-import.ts +871 -0
- package/src/javascript/format.ts +10 -2
- package/src/javascript/index.ts +1 -0
- package/src/javascript/type-mapping.ts +1 -1
package/src/javascript/format.ts
CHANGED
|
@@ -1152,6 +1152,7 @@ export class TabsAndIndentsVisitor<P> extends JavaScriptVisitor<P> {
|
|
|
1152
1152
|
const ifStmt = tree as J.If;
|
|
1153
1153
|
if (ifStmt.thenPart.element.kind !== J.Kind.Block) {
|
|
1154
1154
|
indentShouldIncrease = true;
|
|
1155
|
+
this.cursor.messages.set("else-indent", this.currentIndent);
|
|
1155
1156
|
}
|
|
1156
1157
|
} else if (tree.kind === J.Kind.WhileLoop) {
|
|
1157
1158
|
const whileLoop = tree as J.WhileLoop;
|
|
@@ -1165,7 +1166,9 @@ export class TabsAndIndentsVisitor<P> extends JavaScriptVisitor<P> {
|
|
|
1165
1166
|
}
|
|
1166
1167
|
}
|
|
1167
1168
|
|
|
1168
|
-
if (
|
|
1169
|
+
if (tree.kind === J.Kind.IfElse && this.cursor.getNearestMessage("else-indent") !== undefined) {
|
|
1170
|
+
this.cursor.messages.set("indentToUse", this.cursor.getNearestMessage("else-indent"));
|
|
1171
|
+
} else if (indentShouldIncrease) {
|
|
1169
1172
|
this.cursor.messages.set("indentToUse", this.currentIndent + this.singleIndent);
|
|
1170
1173
|
}
|
|
1171
1174
|
return ret;
|
|
@@ -1179,7 +1182,12 @@ export class TabsAndIndentsVisitor<P> extends JavaScriptVisitor<P> {
|
|
|
1179
1182
|
if (ret == undefined) {
|
|
1180
1183
|
return ret;
|
|
1181
1184
|
}
|
|
1182
|
-
|
|
1185
|
+
|
|
1186
|
+
if (tree.kind === J.Kind.IfElse && this.cursor.messages.get("else-indent") !== undefined) {
|
|
1187
|
+
this.cursor.messages.set("indentToUse", this.cursor.messages.get("else-indent"));
|
|
1188
|
+
this.cursor.messages.delete("else-indent");
|
|
1189
|
+
}
|
|
1190
|
+
const relativeIndent: string = this.currentIndent;
|
|
1183
1191
|
|
|
1184
1192
|
return produce(ret, draft => {
|
|
1185
1193
|
if (draft.prefix == undefined) {
|
package/src/javascript/index.ts
CHANGED
|
@@ -214,7 +214,7 @@ export class JavaScriptTypeMapping {
|
|
|
214
214
|
let declaredFormalTypeNames: string[] = [];
|
|
215
215
|
|
|
216
216
|
// Handle different kinds of nodes that represent methods or method invocations
|
|
217
|
-
if (ts.
|
|
217
|
+
if (ts.isCallOrNewExpression(node)) {
|
|
218
218
|
// For method invocations (e.g., _.map(...))
|
|
219
219
|
signature = this.checker.getResolvedSignature(node);
|
|
220
220
|
if (!signature) {
|