@openrewrite/rewrite 8.88.0-20260729-151827 → 8.88.1
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/javascript/package-exported-types.d.ts +13 -0
- package/dist/javascript/package-exported-types.d.ts.map +1 -0
- package/dist/javascript/package-exported-types.js +374 -0
- package/dist/javascript/package-exported-types.js.map +1 -0
- package/dist/javascript/type-mapping.d.ts +6 -0
- package/dist/javascript/type-mapping.d.ts.map +1 -1
- package/dist/javascript/type-mapping.js +16 -0
- package/dist/javascript/type-mapping.js.map +1 -1
- package/dist/rewrite-javascript-version.txt +1 -1
- package/dist/rpc/queue.d.ts +12 -0
- package/dist/rpc/queue.d.ts.map +1 -1
- package/dist/rpc/queue.js +35 -4
- package/dist/rpc/queue.js.map +1 -1
- package/dist/rpc/request/dependency-types.d.ts +15 -0
- package/dist/rpc/request/dependency-types.d.ts.map +1 -0
- package/dist/rpc/request/dependency-types.js +143 -0
- package/dist/rpc/request/dependency-types.js.map +1 -0
- package/dist/rpc/request/index.d.ts +1 -0
- package/dist/rpc/request/index.d.ts.map +1 -1
- package/dist/rpc/request/index.js +1 -0
- package/dist/rpc/request/index.js.map +1 -1
- package/dist/rpc/request/last-parsed-project.d.ts +3 -0
- package/dist/rpc/request/last-parsed-project.d.ts.map +1 -0
- package/dist/rpc/request/last-parsed-project.js +29 -0
- package/dist/rpc/request/last-parsed-project.js.map +1 -0
- package/dist/rpc/request/parse-project.d.ts.map +1 -1
- package/dist/rpc/request/parse-project.js +2 -0
- package/dist/rpc/request/parse-project.js.map +1 -1
- package/dist/rpc/rewrite-rpc.d.ts.map +1 -1
- package/dist/rpc/rewrite-rpc.js +1 -0
- package/dist/rpc/rewrite-rpc.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +39 -27
- package/dist/run.js.map +1 -1
- package/package.json +1 -1
- package/src/javascript/package-exported-types.ts +351 -0
- package/src/javascript/type-mapping.ts +16 -0
- package/src/rpc/queue.ts +38 -4
- package/src/rpc/request/dependency-types.ts +128 -0
- package/src/rpc/request/index.ts +1 -0
- package/src/rpc/request/last-parsed-project.ts +27 -0
- package/src/rpc/request/parse-project.ts +2 -0
- package/src/rpc/rewrite-rpc.ts +2 -0
- package/src/run.ts +44 -23
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Type } from "../java";
|
|
2
|
+
/**
|
|
3
|
+
* Enumerate the OWN public exported types of one or more npm packages into the engine's
|
|
4
|
+
* {@link Type} model. The JS analog of the C# {@code AssemblyTypeEnumerator.Enumerate}:
|
|
5
|
+
* a {@code ts.Program} is rooted at each package's declaration entry, the {@code references}
|
|
6
|
+
* closure supplies node_modules resolution, and the types each own package exports are
|
|
7
|
+
* mapped with full members and methods. Types reached transitively come back shallow.
|
|
8
|
+
*
|
|
9
|
+
* @param ownArtifacts package directories whose public types should be defined (full bodies)
|
|
10
|
+
* @param references node_modules roots / sibling packages used only for symbol resolution
|
|
11
|
+
*/
|
|
12
|
+
export declare function exportedTypes(ownArtifacts: string[], references: string[]): Type.FullyQualified[];
|
|
13
|
+
//# sourceMappingURL=package-exported-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-exported-types.d.ts","sourceRoot":"","sources":["../../src/javascript/package-exported-types.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAY7B;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CA+GjG"}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.exportedTypes = exportedTypes;
|
|
40
|
+
/*
|
|
41
|
+
* Copyright 2026 the original author or authors.
|
|
42
|
+
* <p>
|
|
43
|
+
* Licensed under the Moderne Source Available License (the "License");
|
|
44
|
+
* you may not use this file except in compliance with the License.
|
|
45
|
+
* You may obtain a copy of the License at
|
|
46
|
+
* <p>
|
|
47
|
+
* https://docs.moderne.io/licensing/moderne-source-available-license
|
|
48
|
+
* <p>
|
|
49
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
50
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
51
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
52
|
+
* See the License for the specific language governing permissions and
|
|
53
|
+
* limitations under the License.
|
|
54
|
+
*/
|
|
55
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
56
|
+
const path = __importStar(require("path"));
|
|
57
|
+
const java_1 = require("../java");
|
|
58
|
+
const type_mapping_1 = require("./type-mapping");
|
|
59
|
+
// Free functions are not exported-type entries; only nominal types (and value modules, which are
|
|
60
|
+
// descended into for nested types) qualify.
|
|
61
|
+
const TYPE_SYMBOL_FLAGS = typescript_1.default.SymbolFlags.Class |
|
|
62
|
+
typescript_1.default.SymbolFlags.Interface |
|
|
63
|
+
typescript_1.default.SymbolFlags.Enum |
|
|
64
|
+
typescript_1.default.SymbolFlags.TypeAlias |
|
|
65
|
+
typescript_1.default.SymbolFlags.ValueModule;
|
|
66
|
+
/**
|
|
67
|
+
* Enumerate the OWN public exported types of one or more npm packages into the engine's
|
|
68
|
+
* {@link Type} model. The JS analog of the C# {@code AssemblyTypeEnumerator.Enumerate}:
|
|
69
|
+
* a {@code ts.Program} is rooted at each package's declaration entry, the {@code references}
|
|
70
|
+
* closure supplies node_modules resolution, and the types each own package exports are
|
|
71
|
+
* mapped with full members and methods. Types reached transitively come back shallow.
|
|
72
|
+
*
|
|
73
|
+
* @param ownArtifacts package directories whose public types should be defined (full bodies)
|
|
74
|
+
* @param references node_modules roots / sibling packages used only for symbol resolution
|
|
75
|
+
*/
|
|
76
|
+
function exportedTypes(ownArtifacts, references) {
|
|
77
|
+
var _a, _b, _c;
|
|
78
|
+
const entries = [];
|
|
79
|
+
for (const artifact of ownArtifacts) {
|
|
80
|
+
const entry = (_a = declarationFileEntry(artifact)) !== null && _a !== void 0 ? _a : resolvePackageEntry(artifact);
|
|
81
|
+
if (entry) {
|
|
82
|
+
entries.push(path.normalize(entry));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (entries.length === 0) {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
const compilerOptions = {
|
|
89
|
+
target: typescript_1.default.ScriptTarget.Latest,
|
|
90
|
+
module: typescript_1.default.ModuleKind.CommonJS,
|
|
91
|
+
moduleResolution: typescript_1.default.ModuleResolutionKind.Node10,
|
|
92
|
+
noEmit: true,
|
|
93
|
+
allowJs: true,
|
|
94
|
+
checkJs: false,
|
|
95
|
+
esModuleInterop: true,
|
|
96
|
+
allowSyntheticDefaultImports: true,
|
|
97
|
+
skipLibCheck: true,
|
|
98
|
+
forceConsistentCasingInFileNames: false,
|
|
99
|
+
};
|
|
100
|
+
const host = typescript_1.default.createCompilerHost(compilerOptions);
|
|
101
|
+
// Default node resolution from each file's on-disk location, falling back to the
|
|
102
|
+
// explicit reference roots when a dependency isn't co-located with the own package.
|
|
103
|
+
host.resolveModuleNameLiterals = (moduleLiterals, containingFile) => moduleLiterals.map(literal => {
|
|
104
|
+
let resolved = typescript_1.default.resolveModuleName(literal.text, containingFile, compilerOptions, host);
|
|
105
|
+
if (!resolved.resolvedModule) {
|
|
106
|
+
for (const ref of references) {
|
|
107
|
+
const probe = typescript_1.default.resolveModuleName(literal.text, path.join(ref, "__probe__.ts"), compilerOptions, host);
|
|
108
|
+
if (probe.resolvedModule) {
|
|
109
|
+
resolved = probe;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return resolved;
|
|
115
|
+
});
|
|
116
|
+
const program = typescript_1.default.createProgram(entries, compilerOptions, host);
|
|
117
|
+
const checker = program.getTypeChecker();
|
|
118
|
+
const typeMapping = new type_mapping_1.JavaScriptTypeMapping(checker);
|
|
119
|
+
// Lowest arity wins for a given FQN, mirroring the C# byFqn dedup.
|
|
120
|
+
const byFqn = new Map();
|
|
121
|
+
const collect = (cls) => {
|
|
122
|
+
const fqn = cls.fullyQualifiedName;
|
|
123
|
+
if (!fqn || fqn === "unknown" || fqn === "<unknown>" || fqn === java_1.Type.FUNCTION_TYPE_NAME) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const existing = byFqn.get(fqn);
|
|
127
|
+
if (!existing || arity(cls) < arity(existing)) {
|
|
128
|
+
byFqn.set(fqn, cls);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const mapSymbols = (symbols) => {
|
|
132
|
+
for (const symbol of symbols) {
|
|
133
|
+
// Isolate per-symbol mapping: one throwing export must not abort the coordinate.
|
|
134
|
+
try {
|
|
135
|
+
const declNodes = classLikeDeclarations(symbol);
|
|
136
|
+
if (declNodes.length > 0) {
|
|
137
|
+
const cls = typeMapping.declarationType(declNodes[0]);
|
|
138
|
+
if (java_1.Type.isClass(cls)) {
|
|
139
|
+
// Walk every declaration so merged interfaces / class+namespace merges keep
|
|
140
|
+
// all their methods; populateMethods dedups by signature across the calls.
|
|
141
|
+
for (const declNode of declNodes) {
|
|
142
|
+
populateMethods(typeMapping, declNode, cls);
|
|
143
|
+
}
|
|
144
|
+
collect(cls);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Type aliases / namespaces: keep only those that resolve to a nominal class.
|
|
149
|
+
const mapped = typeMapping.exportedType(symbol);
|
|
150
|
+
if (java_1.Type.isClass(mapped)) {
|
|
151
|
+
collect(mapped);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
console.warn(`exportedTypes: skipping export '${symbol.getName()}': ${e}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
for (const entry of entries) {
|
|
161
|
+
const sourceFile = program.getSourceFile(entry);
|
|
162
|
+
if (!sourceFile) {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (typescript_1.default.isExternalModule(sourceFile)) {
|
|
166
|
+
const moduleSymbol = (_b = checker.getSymbolAtLocation(sourceFile)) !== null && _b !== void 0 ? _b : sourceFile.symbol;
|
|
167
|
+
if (moduleSymbol) {
|
|
168
|
+
mapSymbols(enumerateTypeSymbols(checker, moduleSymbol));
|
|
169
|
+
}
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
// A global script (lib.*.d.ts / ambient .d.ts): globals live in global scope, not on a
|
|
173
|
+
// module symbol. Enumerate top-level ambient declarations + `declare module` ambients.
|
|
174
|
+
mapSymbols(globalTypeSymbols(checker, sourceFile));
|
|
175
|
+
for (const ambient of checker.getAmbientModules()) {
|
|
176
|
+
if ((_c = ambient.declarations) === null || _c === void 0 ? void 0 : _c.some(d => d.getSourceFile() === sourceFile)) {
|
|
177
|
+
mapSymbols(enumerateTypeSymbols(checker, ambient));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return [...byFqn.values()];
|
|
182
|
+
}
|
|
183
|
+
function arity(cls) {
|
|
184
|
+
var _a, _b;
|
|
185
|
+
return (_b = (_a = cls.typeParameters) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
186
|
+
}
|
|
187
|
+
/** A TypeScript declaration/source FILE (e.g. a `lib.*.d.ts` of ambient globals), used directly as a program entry. */
|
|
188
|
+
function declarationFileEntry(artifact) {
|
|
189
|
+
return typescript_1.default.sys.fileExists(artifact) && /\.[cm]?tsx?$/.test(artifact) ? artifact : undefined;
|
|
190
|
+
}
|
|
191
|
+
/** Top-level ambient type declarations of a script (non-module) file — a `lib.*.d.ts`'s globals; namespaces descended for nested types. */
|
|
192
|
+
function globalTypeSymbols(checker, sourceFile) {
|
|
193
|
+
const out = [];
|
|
194
|
+
const seen = new Set();
|
|
195
|
+
const push = (name) => {
|
|
196
|
+
const symbol = name ? checker.getSymbolAtLocation(name) : undefined;
|
|
197
|
+
if (symbol && !seen.has(symbol)) {
|
|
198
|
+
seen.add(symbol);
|
|
199
|
+
out.push(symbol);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const visit = (node) => {
|
|
203
|
+
if (typescript_1.default.isInterfaceDeclaration(node) || typescript_1.default.isClassDeclaration(node) ||
|
|
204
|
+
typescript_1.default.isEnumDeclaration(node) || typescript_1.default.isTypeAliasDeclaration(node)) {
|
|
205
|
+
push(node.name);
|
|
206
|
+
}
|
|
207
|
+
else if (typescript_1.default.isModuleDeclaration(node)) {
|
|
208
|
+
push(node.name);
|
|
209
|
+
if (node.body && typescript_1.default.isModuleBlock(node.body)) {
|
|
210
|
+
node.body.statements.forEach(visit);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
sourceFile.statements.forEach(visit);
|
|
215
|
+
return out;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Resolve a package directory to its declaration entry: the package.json `types`/`typings`
|
|
219
|
+
* field, else the `exports["."]` types condition (modern packages declare types only there),
|
|
220
|
+
* else a top-level `index.d.ts` (then `index.ts`).
|
|
221
|
+
*/
|
|
222
|
+
function resolvePackageEntry(dir) {
|
|
223
|
+
var _a;
|
|
224
|
+
const packageJson = path.join(dir, "package.json");
|
|
225
|
+
if (typescript_1.default.sys.fileExists(packageJson)) {
|
|
226
|
+
try {
|
|
227
|
+
const pkg = JSON.parse(typescript_1.default.sys.readFile(packageJson) || "{}");
|
|
228
|
+
const typesField = (_a = pkg.types) !== null && _a !== void 0 ? _a : pkg.typings;
|
|
229
|
+
const candidate = typeof typesField === "string"
|
|
230
|
+
? typesField
|
|
231
|
+
: exportsTypesEntry(pkg.exports);
|
|
232
|
+
if (typeof candidate === "string") {
|
|
233
|
+
const resolved = path.resolve(dir, candidate);
|
|
234
|
+
if (typescript_1.default.sys.fileExists(resolved)) {
|
|
235
|
+
return resolved;
|
|
236
|
+
}
|
|
237
|
+
if (typescript_1.default.sys.fileExists(resolved + ".d.ts")) {
|
|
238
|
+
return resolved + ".d.ts";
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
catch (_b) {
|
|
243
|
+
// Malformed package.json; fall through to conventional entry points.
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
for (const candidate of ["index.d.ts", "index.ts", "index.tsx"]) {
|
|
247
|
+
const resolved = path.join(dir, candidate);
|
|
248
|
+
if (typescript_1.default.sys.fileExists(resolved)) {
|
|
249
|
+
return resolved;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return undefined;
|
|
253
|
+
}
|
|
254
|
+
/** The declaration file for the package's `.` subpath from its `exports` map, if any. */
|
|
255
|
+
function exportsTypesEntry(exports) {
|
|
256
|
+
if (typeof exports === "string") {
|
|
257
|
+
return typesFromCondition(exports);
|
|
258
|
+
}
|
|
259
|
+
if (!exports || typeof exports !== "object") {
|
|
260
|
+
return undefined;
|
|
261
|
+
}
|
|
262
|
+
const map = exports;
|
|
263
|
+
// `exports["."]`, or the whole object when it is condition-only sugar (no subpath keys).
|
|
264
|
+
const dot = "." in map
|
|
265
|
+
? map["."]
|
|
266
|
+
: (Object.keys(map).some(k => k.startsWith(".")) ? undefined : map);
|
|
267
|
+
return dot === undefined ? undefined : typesFromCondition(dot);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Pull a declaration file out of an `exports` condition value: an explicit `types` condition,
|
|
271
|
+
* else the `types` nested under `import`/`require`/`default`. A bare target string is a runtime
|
|
272
|
+
* (JS) entry, not types, unless it is itself a declaration file.
|
|
273
|
+
*/
|
|
274
|
+
function typesFromCondition(entry) {
|
|
275
|
+
if (typeof entry === "string") {
|
|
276
|
+
return /\.d\.[cm]?ts$/.test(entry) ? entry : undefined;
|
|
277
|
+
}
|
|
278
|
+
if (!entry || typeof entry !== "object") {
|
|
279
|
+
return undefined;
|
|
280
|
+
}
|
|
281
|
+
const o = entry;
|
|
282
|
+
if (typeof o.types === "string") {
|
|
283
|
+
return o.types;
|
|
284
|
+
}
|
|
285
|
+
const nestedTypes = typesFromCondition(o.types);
|
|
286
|
+
if (nestedTypes) {
|
|
287
|
+
return nestedTypes;
|
|
288
|
+
}
|
|
289
|
+
for (const cond of ["import", "require", "default"]) {
|
|
290
|
+
const nested = typesFromCondition(o[cond]);
|
|
291
|
+
if (nested) {
|
|
292
|
+
return nested;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return undefined;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* The exported symbols of a module that name a type, resolving aliases and descending one
|
|
299
|
+
* level into re-exported namespaces (e.g. `export = SomeNamespace`) to reach nested types.
|
|
300
|
+
*/
|
|
301
|
+
function enumerateTypeSymbols(checker, moduleSymbol) {
|
|
302
|
+
const out = [];
|
|
303
|
+
const seen = new Set();
|
|
304
|
+
const queue = [...moduleExports(checker, moduleSymbol)];
|
|
305
|
+
while (queue.length > 0) {
|
|
306
|
+
let symbol = queue.shift();
|
|
307
|
+
if (symbol.flags & typescript_1.default.SymbolFlags.Alias) {
|
|
308
|
+
symbol = checker.getAliasedSymbol(symbol);
|
|
309
|
+
}
|
|
310
|
+
if (seen.has(symbol)) {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
seen.add(symbol);
|
|
314
|
+
if (symbol.flags & TYPE_SYMBOL_FLAGS) {
|
|
315
|
+
out.push(symbol);
|
|
316
|
+
}
|
|
317
|
+
if (symbol.flags & (typescript_1.default.SymbolFlags.ValueModule | typescript_1.default.SymbolFlags.NamespaceModule)) {
|
|
318
|
+
for (const nested of moduleExports(checker, symbol)) {
|
|
319
|
+
queue.push(nested);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return out;
|
|
324
|
+
}
|
|
325
|
+
function moduleExports(checker, symbol) {
|
|
326
|
+
var _a;
|
|
327
|
+
try {
|
|
328
|
+
return checker.getExportsOfModule(symbol);
|
|
329
|
+
}
|
|
330
|
+
catch (_b) {
|
|
331
|
+
const members = [];
|
|
332
|
+
(_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.forEach(s => members.push(s));
|
|
333
|
+
return members;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
// All class/interface/enum declarations of a symbol. Returns more than one for declaration
|
|
337
|
+
// merging (e.g. two `interface Req {...}` blocks, or a class merged with a namespace).
|
|
338
|
+
function classLikeDeclarations(symbol) {
|
|
339
|
+
var _a;
|
|
340
|
+
const out = [];
|
|
341
|
+
for (const declaration of (_a = symbol.declarations) !== null && _a !== void 0 ? _a : []) {
|
|
342
|
+
if (typescript_1.default.isClassDeclaration(declaration) || typescript_1.default.isInterfaceDeclaration(declaration) || typescript_1.default.isEnumDeclaration(declaration)) {
|
|
343
|
+
out.push(declaration);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return out;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Populate `classType.methods`, which the normal mapping path leaves empty. Scoped to the
|
|
350
|
+
* enumerator so parser output is unchanged: walk the declaration's method/constructor nodes,
|
|
351
|
+
* map each via the public {@link JavaScriptTypeMapping.methodType}, and dedup by signature.
|
|
352
|
+
*/
|
|
353
|
+
function populateMethods(typeMapping, node, classType) {
|
|
354
|
+
if (!typescript_1.default.isClassDeclaration(node) && !typescript_1.default.isInterfaceDeclaration(node)) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const seen = new Set(classType.methods.map(m => java_1.Type.signature(m)));
|
|
358
|
+
for (const member of node.members) {
|
|
359
|
+
if (typescript_1.default.isMethodDeclaration(member) || typescript_1.default.isMethodSignature(member) || typescript_1.default.isConstructorDeclaration(member)) {
|
|
360
|
+
const method = typeMapping.methodType(member);
|
|
361
|
+
if (!method) {
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
method.declaringType = classType;
|
|
365
|
+
const sig = java_1.Type.signature(method);
|
|
366
|
+
if (seen.has(sig)) {
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
seen.add(sig);
|
|
370
|
+
classType.methods.push(method);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
//# sourceMappingURL=package-exported-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-exported-types.js","sourceRoot":"","sources":["../../src/javascript/package-exported-types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,sCA+GC;AAtJD;;;;;;;;;;;;;;GAcG;AACH,4DAA4B;AAC5B,2CAA6B;AAC7B,kCAA6B;AAC7B,iDAAqD;AAErD,iGAAiG;AACjG,4CAA4C;AAC5C,MAAM,iBAAiB,GACnB,oBAAE,CAAC,WAAW,CAAC,KAAK;IACpB,oBAAE,CAAC,WAAW,CAAC,SAAS;IACxB,oBAAE,CAAC,WAAW,CAAC,IAAI;IACnB,oBAAE,CAAC,WAAW,CAAC,SAAS;IACxB,oBAAE,CAAC,WAAW,CAAC,WAAW,CAAC;AAE/B;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAAC,YAAsB,EAAE,UAAoB;;IACtE,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,MAAA,oBAAoB,CAAC,QAAQ,CAAC,mCAAI,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAC9E,IAAI,KAAK,EAAE,CAAC;YACR,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QACxC,CAAC;IACL,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,eAAe,GAAuB;QACxC,MAAM,EAAE,oBAAE,CAAC,YAAY,CAAC,MAAM;QAC9B,MAAM,EAAE,oBAAE,CA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AAC;YACd,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -38,6 +38,12 @@ export declare class JavaScriptTypeMapping {
|
|
|
38
38
|
* are derived from the declaration itself.
|
|
39
39
|
*/
|
|
40
40
|
declarationType(node: ts.ClassDeclaration | ts.ClassExpression | ts.InterfaceDeclaration | ts.EnumDeclaration): Type.FullyQualified | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Map an exported symbol (type alias, namespace, function, ...) to its {@link Type} via the
|
|
43
|
+
* symbol's declared or value type. Enumerator-only entry point ({@code exportedTypes}) for
|
|
44
|
+
* exports that are not class/interface/enum declarations; those go through {@link declarationType}.
|
|
45
|
+
*/
|
|
46
|
+
exportedType(symbol: ts.Symbol): Type | undefined;
|
|
41
47
|
private getType;
|
|
42
48
|
private getSignature;
|
|
43
49
|
primitiveType(node: ts.Node): Type.Primitive;
|
|
@@ -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;AAG7B,qBAAa,qBAAqB;IAa1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAXhC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyC;IACnE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuC;IAEnE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAwB;IACrD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAsB;IACxD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAsB;IACxD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAsB;gBAIpC,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,UAAU,CAAC,EAAE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4BpB,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS;IAQ5C,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,GAAG,SAAS;IAoKtD;;;;;;;;;;OAUG;IACH,OAAO,CAAC,yBAAyB;IAmCjC;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,oBAAoB;IAc5B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAmDxB,OAAO,CAAC,WAAW;IAanB,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,GAAG,SAAS;IA8VlD;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,+BAA+B;IA4IvC;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAkC5B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IA6HzB;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IA4CpC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAqBvB;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAqB9B;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAmCjC;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAiB/B;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;CA8D/B"}
|
|
@@ -212,6 +212,22 @@ class JavaScriptTypeMapping {
|
|
|
212
212
|
this.typeCache.set(cacheKey, classType);
|
|
213
213
|
return classType;
|
|
214
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Map an exported symbol (type alias, namespace, function, ...) to its {@link Type} via the
|
|
217
|
+
* symbol's declared or value type. Enumerator-only entry point ({@code exportedTypes}) for
|
|
218
|
+
* exports that are not class/interface/enum declarations; those go through {@link declarationType}.
|
|
219
|
+
*/
|
|
220
|
+
exportedType(symbol) {
|
|
221
|
+
const target = symbol.flags & typescript_1.default.SymbolFlags.Alias ? this.checker.getAliasedSymbol(symbol) : symbol;
|
|
222
|
+
let type;
|
|
223
|
+
if (target.flags & (typescript_1.default.SymbolFlags.Class | typescript_1.default.SymbolFlags.Interface | typescript_1.default.SymbolFlags.Enum | typescript_1.default.SymbolFlags.TypeAlias | typescript_1.default.SymbolFlags.ValueModule)) {
|
|
224
|
+
type = this.checker.getDeclaredTypeOfSymbol(target);
|
|
225
|
+
}
|
|
226
|
+
else if (target.valueDeclaration) {
|
|
227
|
+
type = this.checker.getTypeOfSymbolAtLocation(target, target.valueDeclaration);
|
|
228
|
+
}
|
|
229
|
+
return type ? this.getType(type) : undefined;
|
|
230
|
+
}
|
|
215
231
|
getType(type) {
|
|
216
232
|
var _a;
|
|
217
233
|
// Check for error types first - these indicate type-checking failures
|