@openrewrite/rewrite 8.117.0 → 8.118.0
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/type.d.ts.map +1 -1
- package/dist/java/type.js +12 -3
- package/dist/java/type.js.map +1 -1
- package/dist/javascript/parser.d.ts.map +1 -1
- package/dist/javascript/parser.js +5 -2
- package/dist/javascript/parser.js.map +1 -1
- package/dist/javascript/rpc.js +6 -2
- package/dist/javascript/rpc.js.map +1 -1
- package/dist/javascript/tree.d.ts +2 -0
- package/dist/javascript/tree.d.ts.map +1 -1
- package/dist/javascript/tree.js.map +1 -1
- package/dist/javascript/type-mapping.d.ts +98 -4
- package/dist/javascript/type-mapping.d.ts.map +1 -1
- package/dist/javascript/type-mapping.js +562 -67
- package/dist/javascript/type-mapping.js.map +1 -1
- package/dist/javascript/visitor.d.ts.map +1 -1
- package/dist/javascript/visitor.js +4 -2
- package/dist/javascript/visitor.js.map +1 -1
- package/dist/rewrite-javascript-version.txt +1 -1
- package/dist/yaml/parser.js +4 -2
- package/dist/yaml/parser.js.map +1 -1
- package/package.json +1 -1
- package/src/java/type.ts +12 -2
- package/src/javascript/parser.ts +5 -2
- package/src/javascript/rpc.ts +6 -2
- package/src/javascript/tree.ts +2 -0
- package/src/javascript/type-mapping.ts +590 -63
- package/src/javascript/visitor.ts +4 -2
- package/src/yaml/parser.ts +4 -2
|
@@ -16,6 +16,8 @@ export declare class JavaScriptTypeMapping {
|
|
|
16
16
|
private readonly booleanWrapperType;
|
|
17
17
|
private readonly symbolWrapperType;
|
|
18
18
|
private readonly functionTypesInProgress;
|
|
19
|
+
private readonly heritageInProgress;
|
|
20
|
+
private readonly referencedImplementations;
|
|
19
21
|
/**
|
|
20
22
|
* @param sourceRoot What a parsed file's module is named relative to.
|
|
21
23
|
* @param sourceIsPackage Whether the source root is itself a package, whose files are named as
|
|
@@ -67,6 +69,11 @@ export declare class JavaScriptTypeMapping {
|
|
|
67
69
|
* the specifier in the call is the only thing identifying the module.
|
|
68
70
|
*/
|
|
69
71
|
private loadedModule;
|
|
72
|
+
/**
|
|
73
|
+
* TypeScript tells an intrinsic element (`<div>`, `<my-el>`, `<svg:rect>`) from a component by the tag's spelling,
|
|
74
|
+
* and a tag holding a string, as `const Tag = 'h1'; <Tag/>`, renders an intrinsic element too.
|
|
75
|
+
*/
|
|
76
|
+
private isJsxComponent;
|
|
70
77
|
private isImportDefer;
|
|
71
78
|
private unparenthesized;
|
|
72
79
|
private moduleSpecifierArgument;
|
|
@@ -102,11 +109,81 @@ export declare class JavaScriptTypeMapping {
|
|
|
102
109
|
*/
|
|
103
110
|
private sourceModuleType;
|
|
104
111
|
private sourceModuleName;
|
|
112
|
+
/** Whether a declaration is in a parsed source file, which a `.d.ts` file or an installed package is not. */
|
|
113
|
+
private isParsedSource;
|
|
114
|
+
/**
|
|
115
|
+
* What a call into a parsed source file calls, as that file's declaration names it: the function
|
|
116
|
+
* the callee is declared as, or the top-level variable holding it, as `const f = () => …` or
|
|
117
|
+
* `const ky = createInstance()` does, where the signature it calls is declared in parsed source too.
|
|
118
|
+
* A local variable holding a function names it on its file, as a nested function declaration is.
|
|
119
|
+
* One destructured from an object, as in `const {setState} = createStore()`, calls the member it is
|
|
120
|
+
* destructured from, as `store.setState()` does, where a named type in parsed source declares it.
|
|
121
|
+
* A callee bound to a module, by an import or a `require`, calls the declaration its signature
|
|
122
|
+
* resolves to, which may be one a re-export such as `module.exports = require('./lib/express')` leads to.
|
|
123
|
+
*/
|
|
124
|
+
private parsedCallee;
|
|
125
|
+
private castTarget;
|
|
126
|
+
private isCast;
|
|
127
|
+
private isTopLevelVariable;
|
|
128
|
+
/**
|
|
129
|
+
* What declares a function expression or arrow function: the member of a named type it implements,
|
|
130
|
+
* where no module binding names it, or else its file, under its own name, or else the one a top-level
|
|
131
|
+
* `const f = …`, an `exports.f = …` assignment, the property it is assigned to or the local
|
|
132
|
+
* variable it initializes gives it.
|
|
133
|
+
*/
|
|
134
|
+
private functionIdentity;
|
|
135
|
+
private localBindingName;
|
|
136
|
+
/**
|
|
137
|
+
* The member of a named type declared in parsed source that a function implements, which is
|
|
138
|
+
* where a call through that type is declared, as in Java a call is declared on the interface it is
|
|
139
|
+
* made through. That is the member of an object literal's contextual type, as in
|
|
140
|
+
* `const api: Store = {setState() {}}`, or of the receiver a function is assigned to a property of,
|
|
141
|
+
* as in `inst.create = () => …`. A local variable holding a function implements the member its
|
|
142
|
+
* annotation indexes, as in `const setState: Store['setState'] = …`, or the one an object literal
|
|
143
|
+
* holding it as a property implements, as `{setState}` does.
|
|
144
|
+
*/
|
|
145
|
+
private implementedMember;
|
|
146
|
+
private assignedMember;
|
|
147
|
+
private destructuredMember;
|
|
148
|
+
private memberOfContextualType;
|
|
105
149
|
/**
|
|
106
|
-
* The
|
|
107
|
-
*
|
|
150
|
+
* The types a receiver may be written through: its own, or where that is `any`, as with
|
|
151
|
+
* `const ky: Partial<KyInstance> & any`, each part of the intersection its declaration is annotated with.
|
|
108
152
|
*/
|
|
109
|
-
private
|
|
153
|
+
private receiverTypes;
|
|
154
|
+
/** The member an indexed access type with a literal index names, as `Store['setState']` names `setState` of `Store`. */
|
|
155
|
+
private indexedMember;
|
|
156
|
+
private memberOf;
|
|
157
|
+
/**
|
|
158
|
+
* The member a local variable holding a function implements, where an object literal in its file
|
|
159
|
+
* holds it as a property, as `{setState}` or `{setState: set}` does, and that literal's contextual
|
|
160
|
+
* type has that member, or where it is assigned to such a member, as in `inst.setState = set`.
|
|
161
|
+
* A variable held as members of different types implements none.
|
|
162
|
+
*/
|
|
163
|
+
private referencedImplementation;
|
|
164
|
+
/** The function an initializer is, also through a cast, as in `(() => …) as F`. */
|
|
165
|
+
private heldFunction;
|
|
166
|
+
private sameMember;
|
|
167
|
+
/** Only a default export, as in `export default function () {}`, declares a function without a name. */
|
|
168
|
+
private functionDeclarationName;
|
|
169
|
+
/**
|
|
170
|
+
* The name a top-level `const f = …` or an `exports.f = …` assignment gives the function it holds,
|
|
171
|
+
* also through a cast, as in `const f = (() => …) as F`. One a module exports as its default, by
|
|
172
|
+
* `export default`, `export =` or `module.exports =`, is named `<default>`, as a call of the module is.
|
|
173
|
+
*/
|
|
174
|
+
private moduleBindingName;
|
|
175
|
+
private isExportsObject;
|
|
176
|
+
private isModuleExports;
|
|
177
|
+
/**
|
|
178
|
+
* A function that an object of no class holds as a member, in a parsed source file: a function
|
|
179
|
+
* expression or arrow assigned to a property, as in `app.use = function () {}` or
|
|
180
|
+
* `{use: function () {}}`, or a method of an object literal. It is declared on its file, as a
|
|
181
|
+
* function declaration is, under the member's name, unless it implements a member of a named type.
|
|
182
|
+
*/
|
|
183
|
+
private parsedMemberFunction;
|
|
184
|
+
private memberFunctionName;
|
|
185
|
+
private isPrototype;
|
|
186
|
+
private isAnonymousReceiver;
|
|
110
187
|
/** The namespace whose body holds a declaration, as `namespace moment` holds `function utc`. */
|
|
111
188
|
private enclosingNamespace;
|
|
112
189
|
/**
|
|
@@ -139,6 +216,19 @@ export declare class JavaScriptTypeMapping {
|
|
|
139
216
|
* A union's member has one only when every member type inherits it from the same class.
|
|
140
217
|
*/
|
|
141
218
|
private declaringClassOf;
|
|
219
|
+
private sameType;
|
|
220
|
+
private memberOwner;
|
|
221
|
+
/**
|
|
222
|
+
* The type that declares the members of a type literal, as an interface declares its own: the type
|
|
223
|
+
* alias whose body it is. In parsed source that is also the alias whose conditional body has it as
|
|
224
|
+
* a branch, as `type StorePersist<S> = S extends … ? {…} : never` does, and a literal that types a
|
|
225
|
+
* property of a type that declares its members is named after that type and the property, as
|
|
226
|
+
* `persist` in `interface Store { persist: { rehydrate(): void } }` names `Store.persist`.
|
|
227
|
+
*/
|
|
228
|
+
private typeLiteralOwner;
|
|
229
|
+
private conditionalAlias;
|
|
230
|
+
/** The type of a type literal that is the body of a type alias, which declares its members as an interface does. */
|
|
231
|
+
private aliasedTypeLiteral;
|
|
142
232
|
private wrapperType;
|
|
143
233
|
methodType(node: ts.Node): Type.Method | undefined;
|
|
144
234
|
/**
|
|
@@ -179,14 +269,18 @@ export declare class JavaScriptTypeMapping {
|
|
|
179
269
|
* The shell will be populated later to handle circular references.
|
|
180
270
|
*/
|
|
181
271
|
private createEmptyClassType;
|
|
182
|
-
private
|
|
272
|
+
private bases;
|
|
273
|
+
private heritageFrom;
|
|
183
274
|
private inheritsFrom;
|
|
184
275
|
private addInterface;
|
|
276
|
+
private addInterfaces;
|
|
185
277
|
/**
|
|
186
278
|
* Populates the class type with members, methods, heritage, and type parameters
|
|
187
279
|
* Since the shell is already in the cache, any recursive references will find it
|
|
188
280
|
*/
|
|
189
281
|
private populateClassType;
|
|
282
|
+
private populateHeritage;
|
|
283
|
+
private populateMembers;
|
|
190
284
|
/**
|
|
191
285
|
* Note: Object/Class/Interface types are handled in getType() to properly manage circular references
|
|
192
286
|
* This method should only be called for primitive and unknown types
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-mapping.d.ts","sourceRoot":"","sources":["../../src/javascript/type-mapping.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"type-mapping.d.ts","sourceRoot":"","sources":["../../src/javascript/type-mapping.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAgD7B;;GAEG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC,KAAK,CAalE;AAOD,qBAAa,qBAAqB;IA6B1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAC5B,OAAO,CAAC,QAAQ,CAAC,eAAe;IA5BpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyC;IACnE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuC;I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