@openrewrite/rewrite 8.55.1 → 8.55.3

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 (42) hide show
  1. package/dist/src/java/tree.d.ts +1 -1
  2. package/dist/src/java/tree.d.ts.map +1 -1
  3. package/dist/src/java/type.d.ts +0 -4
  4. package/dist/src/java/type.d.ts.map +1 -1
  5. package/dist/src/java/type.js +0 -1
  6. package/dist/src/java/type.js.map +1 -1
  7. package/dist/src/javascript/comparator.d.ts.map +1 -1
  8. package/dist/src/javascript/comparator.js +10 -13
  9. package/dist/src/javascript/comparator.js.map +1 -1
  10. package/dist/src/javascript/format.d.ts +0 -2
  11. package/dist/src/javascript/format.d.ts.map +1 -1
  12. package/dist/src/javascript/format.js +4 -33
  13. package/dist/src/javascript/format.js.map +1 -1
  14. package/dist/src/javascript/parser.d.ts +3 -3
  15. package/dist/src/javascript/parser.d.ts.map +1 -1
  16. package/dist/src/javascript/parser.js +93 -62
  17. package/dist/src/javascript/parser.js.map +1 -1
  18. package/dist/src/javascript/print.d.ts.map +1 -1
  19. package/dist/src/javascript/print.js +5 -22
  20. package/dist/src/javascript/print.js.map +1 -1
  21. package/dist/src/javascript/rpc.js +2 -2
  22. package/dist/src/javascript/rpc.js.map +1 -1
  23. package/dist/src/javascript/tree.d.ts +2 -11
  24. package/dist/src/javascript/tree.d.ts.map +1 -1
  25. package/dist/src/javascript/tree.js.map +1 -1
  26. package/dist/src/javascript/type-mapping.d.ts.map +1 -1
  27. package/dist/src/javascript/type-mapping.js +0 -7
  28. package/dist/src/javascript/type-mapping.js.map +1 -1
  29. package/dist/src/javascript/visitor.d.ts.map +1 -1
  30. package/dist/src/javascript/visitor.js +2 -2
  31. package/dist/src/javascript/visitor.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/java/tree.ts +1 -1
  34. package/src/java/type.ts +0 -5
  35. package/src/javascript/comparator.ts +10 -15
  36. package/src/javascript/format.ts +4 -25
  37. package/src/javascript/parser.ts +96 -78
  38. package/src/javascript/print.ts +6 -24
  39. package/src/javascript/rpc.ts +2 -2
  40. package/src/javascript/tree.ts +2 -12
  41. package/src/javascript/type-mapping.ts +0 -6
  42. package/src/javascript/visitor.ts +2 -2
@@ -164,6 +164,11 @@ export class JavaScriptPrinter extends JavaScriptVisitor<PrintOutputCapture> {
164
164
 
165
165
  jsImport.attributes && await this.visit(jsImport.attributes, p);
166
166
 
167
+ if (jsImport.initializer) {
168
+ p.append("=");
169
+ await this.visitLeftPadded(jsImport.initializer, p);
170
+ }
171
+
167
172
  await this.afterSyntax(jsImport, p);
168
173
  return jsImport;
169
174
  }
@@ -432,29 +437,6 @@ export class JavaScriptPrinter extends JavaScriptVisitor<PrintOutputCapture> {
432
437
  await this.visitModifier(m, p);
433
438
  }
434
439
 
435
- const scope = variableDeclarations.scope;
436
- if (scope) {
437
- await this.visitSpace(scope.before, p);
438
-
439
- switch (scope.element) {
440
- case JS.ScopedVariableDeclarations.Scope.Let:
441
- p.append("let");
442
- break;
443
- case JS.ScopedVariableDeclarations.Scope.Const:
444
- p.append("const");
445
- break;
446
- case JS.ScopedVariableDeclarations.Scope.Var:
447
- p.append("var");
448
- break;
449
- case JS.ScopedVariableDeclarations.Scope.Using:
450
- p.append("using");
451
- break;
452
- case JS.ScopedVariableDeclarations.Scope.Import:
453
- p.append("import");
454
- break;
455
- }
456
- }
457
-
458
440
  await this.visitRightPaddedLocal(variableDeclarations.variables, ",", p);
459
441
 
460
442
  await this.afterSyntax(variableDeclarations, p);
@@ -585,7 +567,7 @@ export class JavaScriptPrinter extends JavaScriptVisitor<PrintOutputCapture> {
585
567
  keyword = "static";
586
568
  break;
587
569
  case J.ModifierType.Final:
588
- keyword = "final";
570
+ keyword = "const";
589
571
  break;
590
572
  case J.ModifierType.Native:
591
573
  keyword = "native";
@@ -132,6 +132,7 @@ class JavaScriptSender extends JavaScriptVisitor<RpcSendQueue> {
132
132
  await q.getAndSend(jsImport, el => el.importClause, el => this.visit(el, q));
133
133
  await q.getAndSend(jsImport, el => el.moduleSpecifier, el => this.visitLeftPadded(el, q));
134
134
  await q.getAndSend(jsImport, el => el.attributes, el => this.visit(el, q));
135
+ await q.getAndSend(jsImport, el => el.initializer, el => this.visitLeftPadded(el, q));
135
136
  return jsImport;
136
137
  }
137
138
 
@@ -236,7 +237,6 @@ class JavaScriptSender extends JavaScriptVisitor<RpcSendQueue> {
236
237
 
237
238
  override async visitScopedVariableDeclarations(scopedVariableDeclarations: JS.ScopedVariableDeclarations, q: RpcSendQueue): Promise<J | undefined> {
238
239
  await q.getAndSendList(scopedVariableDeclarations, el => el.modifiers, el => el.id, el => this.visit(el, q));
239
- await q.getAndSend(scopedVariableDeclarations, el => el.scope, el => this.visitLeftPadded(el, q));
240
240
  await q.getAndSendList(scopedVariableDeclarations, el => el.variables, el => el.element.id, el => this.visitRightPadded(el, q));
241
241
  return scopedVariableDeclarations;
242
242
  }
@@ -664,6 +664,7 @@ class JavaScriptReceiver extends JavaScriptVisitor<RpcReceiveQueue> {
664
664
  draft.importClause = await q.receive(draft.importClause, el => this.visitDefined<JS.ImportClause>(el, q));
665
665
  draft.moduleSpecifier = await q.receive(draft.moduleSpecifier, el => this.visitLeftPadded(el, q));
666
666
  draft.attributes = await q.receive(draft.attributes, el => this.visitDefined<JS.ImportAttributes>(el, q));
667
+ draft.initializer = await q.receive(draft.initializer, el => this.visitLeftPadded(el, q));
667
668
  return finishDraft(draft);
668
669
  }
669
670
 
@@ -783,7 +784,6 @@ class JavaScriptReceiver extends JavaScriptVisitor<RpcReceiveQueue> {
783
784
  override async visitScopedVariableDeclarations(scopedVariableDeclarations: JS.ScopedVariableDeclarations, q: RpcReceiveQueue): Promise<J | undefined> {
784
785
  const draft = createDraft(scopedVariableDeclarations);
785
786
  draft.modifiers = await q.receiveListDefined(draft.modifiers, el => this.visitDefined<J.Modifier>(el, q));
786
- draft.scope = await q.receive(draft.scope, el => this.visitLeftPadded(el, q));
787
787
  draft.variables = await q.receiveListDefined(draft.variables, el => this.visitRightPadded(el, q));
788
788
  return finishDraft(draft);
789
789
  }
@@ -223,8 +223,9 @@ export namespace JS {
223
223
  export interface Import extends JS, Statement {
224
224
  readonly kind: typeof Kind.Import;
225
225
  readonly importClause?: ImportClause;
226
- readonly moduleSpecifier: J.LeftPadded<Expression>;
226
+ readonly moduleSpecifier?: J.LeftPadded<Expression>;
227
227
  readonly attributes?: ImportAttributes;
228
+ readonly initializer?: J.LeftPadded<Expression>;
228
229
  }
229
230
 
230
231
  /**
@@ -418,20 +419,9 @@ export namespace JS {
418
419
  export interface ScopedVariableDeclarations extends JS, Statement {
419
420
  readonly kind: typeof Kind.ScopedVariableDeclarations;
420
421
  readonly modifiers: J.Modifier[];
421
- readonly scope?: J.LeftPadded<ScopedVariableDeclarations.Scope>;
422
422
  readonly variables: J.RightPadded<J>[];
423
423
  }
424
424
 
425
- export namespace ScopedVariableDeclarations {
426
- export const enum Scope {
427
- Const = "Const",
428
- Let = "Let",
429
- Var = "Var",
430
- Using = "Using",
431
- Import = "Import"
432
- }
433
- }
434
-
435
425
  /**
436
426
  * Represents a statement used as an expression. The example shows a function expressions.
437
427
  * @example const greet = function (name: string) : string { return name; };
@@ -131,12 +131,6 @@ export class JavaScriptTypeMapping {
131
131
  this.typeCache.set(signature, result);
132
132
  // FIXME unsafeSet
133
133
  return result;
134
- } else if (type.flags & ts.TypeFlags.UniqueESSymbol) {
135
- let result = {
136
- kind: JavaType.Kind.UniqueSymbol,
137
- } as JavaType.UniqueSymbol;
138
- this.typeCache.set(signature, result);
139
- return result;
140
134
  }
141
135
 
142
136
  // if (ts.isRegularExpressionLiteral(node)) {
@@ -279,8 +279,9 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
279
279
 
280
280
  return this.produceJavaScript<JS.Import>(jsImport, p, async draft => {
281
281
  draft.importClause = jsImport.importClause && await this.visitDefined<JS.ImportClause>(jsImport.importClause, p);
282
- draft.moduleSpecifier = await this.visitLeftPadded(jsImport.moduleSpecifier, p);
282
+ draft.moduleSpecifier = jsImport.moduleSpecifier && await this.visitLeftPadded(jsImport.moduleSpecifier, p);
283
283
  draft.attributes = jsImport.attributes && await this.visitDefined<JS.ImportAttributes>(jsImport.attributes, p);
284
+ draft.initializer = jsImport.initializer && await this.visitLeftPadded(jsImport.initializer, p);
284
285
  });
285
286
  }
286
287
 
@@ -451,7 +452,6 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
451
452
 
452
453
  return this.produceJavaScript<JS.ScopedVariableDeclarations>(scopedVariableDeclarations, p, async draft => {
453
454
  draft.modifiers = await mapAsync(scopedVariableDeclarations.modifiers, item => this.visitDefined<J.Modifier>(item, p));
454
- draft.scope = scopedVariableDeclarations.scope && await this.visitLeftPadded(scopedVariableDeclarations.scope, p);
455
455
  draft.variables = await mapAsync(scopedVariableDeclarations.variables, item => this.visitRightPadded(item, p));
456
456
  });
457
457
  }