@openrewrite/rewrite 8.101.1 → 8.101.2

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 (34) hide show
  1. package/dist/java/rpc.d.ts.map +1 -1
  2. package/dist/java/rpc.js +3 -1
  3. package/dist/java/rpc.js.map +1 -1
  4. package/dist/javascript/markers.d.ts +26 -0
  5. package/dist/javascript/markers.d.ts.map +1 -1
  6. package/dist/javascript/markers.js +21 -0
  7. package/dist/javascript/markers.js.map +1 -1
  8. package/dist/javascript/name-resolver.d.ts +68 -0
  9. package/dist/javascript/name-resolver.d.ts.map +1 -0
  10. package/dist/javascript/name-resolver.js +820 -0
  11. package/dist/javascript/name-resolver.js.map +1 -0
  12. package/dist/javascript/package-exported-types.d.ts +11 -0
  13. package/dist/javascript/package-exported-types.d.ts.map +1 -1
  14. package/dist/javascript/package-exported-types.js +63 -2
  15. package/dist/javascript/package-exported-types.js.map +1 -1
  16. package/dist/javascript/parser.d.ts +4 -0
  17. package/dist/javascript/parser.d.ts.map +1 -1
  18. package/dist/javascript/parser.js +27 -4
  19. package/dist/javascript/parser.js.map +1 -1
  20. package/dist/javascript/type-mapping.d.ts +17 -1
  21. package/dist/javascript/type-mapping.d.ts.map +1 -1
  22. package/dist/javascript/type-mapping.js +53 -5
  23. package/dist/javascript/type-mapping.js.map +1 -1
  24. package/dist/rewrite-javascript-version.txt +1 -1
  25. package/dist/rpc/request/dependency-types.js +17 -6
  26. package/dist/rpc/request/dependency-types.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/java/rpc.ts +3 -1
  29. package/src/javascript/markers.ts +50 -0
  30. package/src/javascript/name-resolver.ts +853 -0
  31. package/src/javascript/package-exported-types.ts +66 -3
  32. package/src/javascript/parser.ts +28 -4
  33. package/src/javascript/type-mapping.ts +58 -6
  34. package/src/rpc/request/dependency-types.ts +19 -7
@@ -41,6 +41,7 @@ declare module "./tree" {
41
41
  readonly DelegatedYield: "org.openrewrite.javascript.marker.DelegatedYield";
42
42
  readonly FunctionDeclaration: "org.openrewrite.javascript.marker.FunctionDeclaration";
43
43
  readonly Computed: "org.openrewrite.javascript.marker.Computed";
44
+ readonly ResolvedNames: "org.openrewrite.javascript.marker.ResolvedNames";
44
45
  };
45
46
  }
46
47
  }
@@ -53,6 +54,7 @@ declare module "./tree" {
53
54
  NonNullAssertion: "org.openrewrite.javascript.marker.NonNullAssertion",
54
55
  FunctionDeclaration: "org.openrewrite.javascript.marker.FunctionDeclaration",
55
56
  Computed: "org.openrewrite.javascript.marker.Computed",
57
+ ResolvedNames: "org.openrewrite.javascript.marker.ResolvedNames",
56
58
  } as const;
57
59
 
58
60
  /**
@@ -97,6 +99,32 @@ export interface Computed extends Marker {
97
99
  readonly suffix: J.Space;
98
100
  }
99
101
 
102
+ /**
103
+ * What the type checker resolves each name of a compilation unit to, as a canonical name that a
104
+ * reference and its declaration share.
105
+ */
106
+ export interface ResolvedNames extends Marker {
107
+ readonly kind: typeof JS.Markers.ResolvedNames;
108
+ /**
109
+ * Each canonical name once.
110
+ */
111
+ readonly names: string[];
112
+ /**
113
+ * Parallel to {@link names}: the npm package that declares each, or null for the repository's
114
+ * own and for the default library.
115
+ */
116
+ readonly packages: (string | null)[];
117
+ /**
118
+ * Each symbol kind used once.
119
+ */
120
+ readonly kinds: string[];
121
+ /**
122
+ * Four numbers per row: its start and end offset into the text as it prints, in UTF-16 code
123
+ * units, an index into {@link names} and an index into {@link kinds}.
124
+ */
125
+ readonly spans: number[];
126
+ }
127
+
100
128
  /**
101
129
  * Registers an RPC codec for any marker that has a `prefix: J.Space` field.
102
130
  */
@@ -138,6 +166,28 @@ RpcCodecs.registerCodec(JS.Markers.Computed, {
138
166
  }
139
167
  });
140
168
 
169
+ // Each list travels as one value: a file has thousands of names, and a list sent element by element
170
+ // costs a message for every number.
171
+ RpcCodecs.registerCodec(JS.Markers.ResolvedNames, {
172
+ rpcReceive(before: ResolvedNames, q: RpcReceiveQueue): ResolvedNames {
173
+ return updateIfChanged(before, {
174
+ id: q.receive(before.id),
175
+ names: q.receive(before.names),
176
+ packages: q.receive(before.packages),
177
+ kinds: q.receive(before.kinds),
178
+ spans: q.receive(before.spans),
179
+ });
180
+ },
181
+
182
+ rpcSend(after: ResolvedNames, q: RpcSendQueue): void {
183
+ q.getAndSend(after, a => a.id);
184
+ q.getAndSend(after, a => a.names);
185
+ q.getAndSend(after, a => a.packages);
186
+ q.getAndSend(after, a => a.kinds);
187
+ q.getAndSend(after, a => a.spans);
188
+ }
189
+ });
190
+
141
191
  // Register codec for PrettierStyle (a NamedStyles that contains Prettier configuration)
142
192
  // Only serialize the variable fields; constant fields are defined in the interface
143
193
  RpcCodecs.registerCodec(StyleKind.PrettierStyle, {