@arcgis/api-extractor 5.0.0-next.17 → 5.0.0-next.170
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/README.md +2 -3
- package/dist/ApiExtractor-nkPAVjKb.js +2664 -0
- package/dist/apiHelpers-BYzO767m.js +161 -0
- package/dist/apiJson.d.ts +783 -1011
- package/dist/cli-7PX_wNxb.js +34 -0
- package/dist/cli.js +57 -0
- package/dist/compilerHints.d.ts +62 -0
- package/dist/diff/apiDiffToMarkdown.d.ts +9 -0
- package/dist/diff/apiDiffToMarkdown.js +140 -0
- package/dist/diff/diffApiJson.d.ts +26 -3
- package/dist/diff/diffApiJson.js +260 -0
- package/dist/diff/fetchApiJsonFromNpm.d.ts +5 -2
- package/dist/diff/fetchApiJsonFromNpm.js +9 -0
- package/dist/diff/types.d.ts +81 -49
- package/dist/diffTypes/index.d.ts +21 -0
- package/dist/diffTypes/index.js +71 -0
- package/dist/extractor/ApiExtractor.d.ts +66 -0
- package/dist/extractor/ApiExtractor.js +9 -0
- package/dist/extractor/config.d.ts +486 -0
- package/dist/extractor/config.js +18 -0
- package/dist/extractor/extractors/copyDoc.d.ts +25 -0
- package/dist/extractor/processing/links.d.ts +15 -0
- package/dist/extractor/processing/links.js +172 -0
- package/dist/extractor/types.d.ts +19 -0
- package/dist/extractor/webComponent/findComponents.d.ts +19 -0
- package/dist/extractor/webComponent/findComponents.js +36 -0
- package/dist/extractor/webComponent/pathMapping.d.ts +11 -0
- package/dist/extractor/webComponent/pathMapping.js +44 -0
- package/dist/index.d.ts +164 -8
- package/dist/index.js +3 -283
- package/dist/typeScript-DMWUxd36.js +64 -0
- package/dist/uiUtils/index.d.ts +12 -0
- package/dist/uiUtils/index.js +5 -0
- package/dist/utils/apiHelpers.d.ts +43 -17
- package/dist/utils/apiHelpers.js +17 -0
- package/dist/utils/astHelpers.d.ts +24 -11
- package/dist/utils/astHelpers.js +67 -0
- package/dist/utils/createIndex.d.ts +30 -0
- package/dist/utils/createIndex.js +83 -0
- package/dist/utils/hydrateApiType.d.ts +26 -0
- package/dist/utils/hydrateApiType.js +62 -0
- package/dist/utils/inferEntrypoints.d.ts +17 -0
- package/dist/utils/inferEntrypoints.js +26 -0
- package/dist/utils/internalTypeScriptApis.d.ts +92 -0
- package/dist/utils/internalTypeScriptApis.js +58 -0
- package/dist/utils/partPrinter.d.ts +29 -0
- package/dist/utils/partPrinter.js +82 -0
- package/dist/vite/plugin.d.ts +53 -0
- package/dist/vite/plugin.js +107 -0
- package/dist/vite/typeScript.d.ts +16 -0
- package/dist/vite/typeScript.js +6 -0
- package/dist/worker-BkDzhZMK.js +3680 -0
- package/package.json +49 -5
- package/dist/diff/index.d.ts +0 -3
- package/dist/diff/index.js +0 -147
- package/dist/ensureValidType.d.ts +0 -1
- package/dist/extractor/index.d.ts +0 -46
- package/dist/types.d.ts +0 -25
- package/dist/utils/docHelpers.d.ts +0 -9
- package/dist/utils/error.d.ts +0 -12
- package/dist/utils/print.d.ts +0 -7
package/dist/index.js
CHANGED
|
@@ -1,285 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import T, { supportsColorStderr as S } from "chalk";
|
|
4
|
-
import { mappedFind as D } from "@arcgis/toolkit/array";
|
|
5
|
-
const m = "@arcgis/api-extractor", E = "5.0.0-next.17", H = (t) => t.kind === "method", q = (t) => t.kind === "field";
|
|
6
|
-
function k(t, e) {
|
|
7
|
-
const s = t.path.split("/"), n = s.pop(), o = s.join("/"), i = e.path.split("/"), r = i.pop(), a = i.join("/");
|
|
8
|
-
return o === a ? n < r ? -1 : 1 : o.startsWith(a) ? 1 : a.startsWith(o) || o < a ? -1 : 1;
|
|
9
|
-
}
|
|
10
|
-
const G = "global:", C = /* @__PURE__ */ new Set([
|
|
11
|
-
"example",
|
|
12
|
-
"see",
|
|
13
|
-
"param",
|
|
14
|
-
"property",
|
|
15
|
-
"throws",
|
|
16
|
-
"slot",
|
|
17
|
-
"csspart",
|
|
18
|
-
"cssstate"
|
|
19
|
-
]), $ = c.createPrinter();
|
|
20
|
-
function w(t) {
|
|
21
|
-
return $.printNode(c.EmitHint.Unspecified, t, void 0);
|
|
22
|
-
}
|
|
23
|
-
function L(t, e) {
|
|
24
|
-
return t.pos !== -1 && t.end !== -1 && e !== void 0 ? t.getText(e) : w(t);
|
|
25
|
-
}
|
|
26
|
-
let A = 0;
|
|
27
|
-
const I = /* @__PURE__ */ new Set();
|
|
28
|
-
let g = console.error;
|
|
29
|
-
function Q(t) {
|
|
30
|
-
g = t;
|
|
31
|
-
}
|
|
32
|
-
const M = {
|
|
33
|
-
getCurrentDirectory: process.cwd,
|
|
34
|
-
getCanonicalFileName: (t) => t,
|
|
35
|
-
getNewLine: () => c.sys.newLine
|
|
36
|
-
};
|
|
37
|
-
function N(t, { file: e, node: s, scope: n, start: o, length: i }) {
|
|
38
|
-
A += 1, process.exitCode = 1;
|
|
39
|
-
const r = e?.fileName;
|
|
40
|
-
r !== void 0 && I.add(r), o ??= s?.getStart(e, !1) ?? -1;
|
|
41
|
-
const a = s?.end ?? -1;
|
|
42
|
-
i ??= a === -1 ? -1 : Math.max(1, a - o);
|
|
43
|
-
const d = o >= 0 && i >= 0, l = !d && n !== void 0, f = {
|
|
44
|
-
category: c.DiagnosticCategory.Error,
|
|
45
|
-
code: d ? m : K,
|
|
46
|
-
file: l ? void 0 : e,
|
|
47
|
-
start: d ? o : 0,
|
|
48
|
-
length: d ? i : 0,
|
|
49
|
-
messageText: (l ? `${T.cyan(n)}: ` : "") + t + (d || s === void 0 ? "" : `
|
|
50
|
-
|
|
51
|
-
${L(s, e)}`)
|
|
52
|
-
}, x = c.formatDiagnosticsWithColorAndContext([f], M), v = S ? x : x.replaceAll(j, "");
|
|
53
|
-
g(v);
|
|
54
|
-
}
|
|
55
|
-
const K = 1490, j = /\x1B\[[0-9;]*m/gu;
|
|
56
|
-
class X {
|
|
57
|
-
constructor(e) {
|
|
58
|
-
this.options = e;
|
|
59
|
-
}
|
|
60
|
-
/** Given an array of TypeScript source files, generate an api.json file */
|
|
61
|
-
extract(e) {
|
|
62
|
-
return {
|
|
63
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString().split(".")[0],
|
|
64
|
-
compiler: {
|
|
65
|
-
name: m,
|
|
66
|
-
version: E,
|
|
67
|
-
typescriptVersion: c.version
|
|
68
|
-
},
|
|
69
|
-
schemaVersion: "1.0.0",
|
|
70
|
-
modules: this.extractModules(e)
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
extractModules(e) {
|
|
74
|
-
const s = [];
|
|
75
|
-
for (const n of e)
|
|
76
|
-
this.file = n, s.push(this.extractModule(n));
|
|
77
|
-
return this.options.isFullApiExtraction && s.sort(k), s;
|
|
78
|
-
}
|
|
79
|
-
extractModule(e) {
|
|
80
|
-
const s = {
|
|
81
|
-
kind: "javascript-module",
|
|
82
|
-
path: y.relative(this.options.cwd, e.fileName),
|
|
83
|
-
declarations: void 0,
|
|
84
|
-
exports: void 0
|
|
85
|
-
};
|
|
86
|
-
this.apiModule = s;
|
|
87
|
-
const n = this.extractDeclarations(e);
|
|
88
|
-
if (s.declarations = n, this.options.isFullApiExtraction) {
|
|
89
|
-
const o = this.inferExports(n);
|
|
90
|
-
o.length > 0 && (s.exports = o);
|
|
91
|
-
}
|
|
92
|
-
return s;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* For a given module, extract all public declarations.
|
|
96
|
-
*/
|
|
97
|
-
extractDeclarations(e) {
|
|
98
|
-
const s = [];
|
|
99
|
-
for (const n of e.statements) {
|
|
100
|
-
const o = this.extractDeclaration(n);
|
|
101
|
-
o !== void 0 && s.push(o);
|
|
102
|
-
}
|
|
103
|
-
return s;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Infer ApiModule.exports based on ApiModule.declarations.
|
|
107
|
-
*/
|
|
108
|
-
inferExports(e) {
|
|
109
|
-
const s = [];
|
|
110
|
-
for (const n of e) {
|
|
111
|
-
const o = this.inferExport(n);
|
|
112
|
-
o !== void 0 && s.push(o);
|
|
113
|
-
}
|
|
114
|
-
return s;
|
|
115
|
-
}
|
|
116
|
-
copyDoc(e, s, n, o) {
|
|
117
|
-
const i = n.docsTags?.findIndex((d) => d.name === "copyDoc");
|
|
118
|
-
if (i === void 0 || i === -1)
|
|
119
|
-
return;
|
|
120
|
-
s === void 0 && N("@copyDoc tag was used, but failed to find copyDoc definition for it.", {
|
|
121
|
-
file: this.file,
|
|
122
|
-
node: e
|
|
123
|
-
});
|
|
124
|
-
const r = s?.(n, o);
|
|
125
|
-
if (r === void 0)
|
|
126
|
-
return;
|
|
127
|
-
for (const [d, l] of Object.entries(r))
|
|
128
|
-
d !== "docsTags" && (n[d] = n[d] ?? l);
|
|
129
|
-
n.docsTags.splice(i, 1);
|
|
130
|
-
const a = new Set(n.docsTags.map(({ name: d }) => d));
|
|
131
|
-
for (const d of r.docsTags ?? [])
|
|
132
|
-
a.has(d.name) && !C.has(d.name) || n.docsTags.push(d);
|
|
133
|
-
n.docsTags.length === 0 && (n.docsTags = void 0);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const Y = (t) => t.modifiers?.some?.(
|
|
137
|
-
(e) => e.kind === c.SyntaxKind.StaticKeyword || e.kind === c.SyntaxKind.PrivateKeyword || e.kind === c.SyntaxKind.ProtectedKeyword
|
|
138
|
-
) ?? !1;
|
|
139
|
-
function Z(t, e, s) {
|
|
140
|
-
if (!e.default && "initializer" in t && t.initializer) {
|
|
141
|
-
const n = h(t.initializer);
|
|
142
|
-
F(n) && (e.default = n.getText(s));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const F = (t) => c.isLiteralExpression(t) || t.kind === c.SyntaxKind.TrueKeyword || t.kind === c.SyntaxKind.FalseKeyword || c.isPrefixUnaryExpression(t) && c.isLiteralExpression(t.operand);
|
|
146
|
-
function h(t) {
|
|
147
|
-
return c.isSatisfiesExpression(t) || c.isParenthesizedExpression(t) ? h(t.expression) : t;
|
|
148
|
-
}
|
|
149
|
-
function _(t) {
|
|
150
|
-
if (t !== void 0 && (c.isIdentifier(t) || c.isStringLiteralLike(t)))
|
|
151
|
-
return t.text;
|
|
152
|
-
}
|
|
153
|
-
const tt = ({ modifiers: t = [] }, e) => D(
|
|
154
|
-
t,
|
|
155
|
-
(s) => c.isDecorator(s) && c.isCallExpression(s.expression) && c.isIdentifier(s.expression.expression) && s.expression.expression.text === e ? s.expression : void 0
|
|
156
|
-
);
|
|
157
|
-
function P(t, e) {
|
|
158
|
-
const s = W(e.getJsDocTags());
|
|
159
|
-
let n = c.displayPartsToString(e.getDocumentationComment(t));
|
|
160
|
-
const o = s.at(-1), i = o?.text?.indexOf(O);
|
|
161
|
-
if (i !== void 0 && i !== -1) {
|
|
162
|
-
const r = o.text.indexOf(b);
|
|
163
|
-
r !== -1 && (n += o.text.slice(r), o.text = o.text?.slice(0, r));
|
|
164
|
-
}
|
|
165
|
-
return {
|
|
166
|
-
docsTags: s,
|
|
167
|
-
description: n || void 0
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
const b = `
|
|
171
|
-
|
|
172
|
-
{@link `, O = "Read more...}", W = (t) => t.filter((e) => e.name !== "privateRemarks").map((e) => ({
|
|
173
|
-
name: e.name,
|
|
174
|
-
text: e.text?.map((s) => s.text).join("")
|
|
175
|
-
}));
|
|
176
|
-
function et(t) {
|
|
177
|
-
const e = Array.from(t.docsTags ?? []), s = t, n = t;
|
|
178
|
-
if (t.deprecated && e.push({
|
|
179
|
-
name: "deprecated",
|
|
180
|
-
text: t.deprecated === !0 ? void 0 : t.deprecated
|
|
181
|
-
}), s.default && e.push({
|
|
182
|
-
name: "default",
|
|
183
|
-
text: s.default
|
|
184
|
-
}), n.cssParts)
|
|
185
|
-
for (const i of n.cssParts)
|
|
186
|
-
e.push({
|
|
187
|
-
name: "csspart",
|
|
188
|
-
text: u(i)
|
|
189
|
-
});
|
|
190
|
-
if (n.cssStates)
|
|
191
|
-
for (const i of n.cssStates)
|
|
192
|
-
e.push({
|
|
193
|
-
name: "cssstate",
|
|
194
|
-
text: u(i)
|
|
195
|
-
});
|
|
196
|
-
if (n.slots)
|
|
197
|
-
for (const i of n.slots)
|
|
198
|
-
e.push({
|
|
199
|
-
name: "slot",
|
|
200
|
-
text: u(i)
|
|
201
|
-
});
|
|
202
|
-
n.privacy === "private" && e.push({
|
|
203
|
-
name: "private",
|
|
204
|
-
text: void 0
|
|
205
|
-
});
|
|
206
|
-
const o = t.description ?? "";
|
|
207
|
-
return e.length === 0 && o.length === 0 ? [] : [J(o, e)];
|
|
208
|
-
}
|
|
209
|
-
function J(t = "", e = []) {
|
|
210
|
-
return {
|
|
211
|
-
kind: c.SyntaxKind.MultiLineCommentTrivia,
|
|
212
|
-
pos: -1,
|
|
213
|
-
end: -1,
|
|
214
|
-
text: R(t, e),
|
|
215
|
-
hasTrailingNewLine: !0
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
function R(t = "", e = []) {
|
|
219
|
-
const s = t === "" ? [] : t.split(`
|
|
220
|
-
`), o = s.length + e.length > 1 || (e.at(0)?.text?.includes(`
|
|
221
|
-
`) ?? !1);
|
|
222
|
-
return `*${o ? s.map((i) => `
|
|
223
|
-
* ${i}`).join("") : ` ${t}`}${s.length > 0 && e.length > 0 ? `
|
|
224
|
-
*` : ""}${e.map((i) => {
|
|
225
|
-
const r = `@${i.name}`, a = i.text ?? "", d = i.text?.includes(`
|
|
226
|
-
`) ?? !1;
|
|
227
|
-
return `${o ? `
|
|
228
|
-
* ` : ""}${r}${d ? a.split(`
|
|
229
|
-
`).map((f) => `
|
|
230
|
-
* ${f}`).join("") : a.length > 0 ? ` ${a}` : ""}`;
|
|
231
|
-
}).join("")}${o ? `
|
|
232
|
-
` : ""} `;
|
|
233
|
-
}
|
|
234
|
-
function st(t, e, s, n) {
|
|
235
|
-
const o = e.getSymbolAtLocation(t);
|
|
236
|
-
if (n ??= o === void 0 ? void 0 : P(e, o), n !== void 0) {
|
|
237
|
-
for (const i of n.docsTags) {
|
|
238
|
-
const { name: r, text: a } = i;
|
|
239
|
-
r === "deprecated" ? s.deprecated = a || !0 : r === "default" ? s.default = a : r === "readonly" ? s.readonly = !0 : r === "private" ? s.privacy = "private" : r === "csspart" ? s.cssParts.push(p(a)) : r === "cssstate" ? s.cssStates.push(p(a)) : r === "slot" ? s.slots.push(p(a)) : (s.docsTags ??= [], s.docsTags.push(i));
|
|
240
|
-
}
|
|
241
|
-
s.description = n.description;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
function p(t) {
|
|
245
|
-
if (t === void 0)
|
|
246
|
-
return { name: "" };
|
|
247
|
-
const e = t.indexOf(" - ");
|
|
248
|
-
if (e === -1)
|
|
249
|
-
return t.startsWith("- ") ? { name: "", description: t.slice(2) } : { name: t };
|
|
250
|
-
let s, n = t.slice(0, e);
|
|
251
|
-
if (n.startsWith("[") && n.endsWith("]")) {
|
|
252
|
-
const i = n.slice(1, -1), r = i.indexOf("=");
|
|
253
|
-
n = i.slice(0, r), s = i.slice(r + 1);
|
|
254
|
-
}
|
|
255
|
-
const o = t.slice(e + 3);
|
|
256
|
-
return {
|
|
257
|
-
name: n,
|
|
258
|
-
default: s,
|
|
259
|
-
description: o
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
function u(t) {
|
|
263
|
-
const e = t.name + (t.default !== void 0 ? `=${t.default}` : ""), s = e.length > 0 ? `[${e}]` : "", n = t.description ?? "", o = n.length > 0 ? ` - ${n}` : "";
|
|
264
|
-
return `${s}${o}`;
|
|
265
|
-
}
|
|
1
|
+
import { printSignature as r } from "./utils/partPrinter.js";
|
|
2
|
+
const i = r;
|
|
266
3
|
export {
|
|
267
|
-
|
|
268
|
-
N as apiExtractorError,
|
|
269
|
-
A as apiExtractorErrorCount,
|
|
270
|
-
I as apiExtractorErrorFiles,
|
|
271
|
-
et as apiMemberToSynthesizedComments,
|
|
272
|
-
L as debugPrintNode,
|
|
273
|
-
tt as findDecorator,
|
|
274
|
-
_ as getMemberName,
|
|
275
|
-
G as globalPackageIdentifier,
|
|
276
|
-
Y as hasIgnoredModifier,
|
|
277
|
-
H as isApiMethod,
|
|
278
|
-
q as isApiProperty,
|
|
279
|
-
C as multipleJsDocTags,
|
|
280
|
-
w as printNode,
|
|
281
|
-
st as setApiDocFromJsDoc,
|
|
282
|
-
Q as setApiExtractorErrorLogger,
|
|
283
|
-
Z as setDefaultFromInitializer,
|
|
284
|
-
P as symbolToDocs
|
|
4
|
+
i as printSignature
|
|
285
5
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { findPath as v, path as C, toSystemPathSeparators as y } from "@arcgis/components-build-utils";
|
|
2
|
+
import t from "typescript";
|
|
3
|
+
import E, { supportsColorStderr as S } from "chalk";
|
|
4
|
+
import { styleText as w } from "util";
|
|
5
|
+
const P = "@arcgis/api-extractor", D = "5.0.0-next.170", N = {
|
|
6
|
+
name: P,
|
|
7
|
+
version: D
|
|
8
|
+
};
|
|
9
|
+
let u;
|
|
10
|
+
function A(o) {
|
|
11
|
+
return u ??= t.createPrinter(), u.printNode(t.EmitHint.Unspecified, o, void 0);
|
|
12
|
+
}
|
|
13
|
+
function F(o, r) {
|
|
14
|
+
return o.pos !== -1 && o.end !== -1 && r !== void 0 ? o.getText(r) : A(o);
|
|
15
|
+
}
|
|
16
|
+
const p = N.name, g = {
|
|
17
|
+
getCurrentDirectory: process.cwd,
|
|
18
|
+
getCanonicalFileName: (o) => o,
|
|
19
|
+
getNewLine: () => t.sys.newLine
|
|
20
|
+
}, W = function(o, { file: r, node: n, scope: s, start: i, length: c }) {
|
|
21
|
+
this.errorCount += 1, process.exitCode = 1, i ??= n === void 0 || n.pos === -1 ? -1 : n.getStart(r, !1);
|
|
22
|
+
const a = n?.end ?? -1;
|
|
23
|
+
c ??= a === -1 ? -1 : Math.max(1, a - i);
|
|
24
|
+
const e = i >= 0 && c >= 0, d = !e && s !== void 0, f = {
|
|
25
|
+
category: t.DiagnosticCategory.Error,
|
|
26
|
+
code: e ? p : x,
|
|
27
|
+
file: d ? void 0 : r,
|
|
28
|
+
start: e ? i : 0,
|
|
29
|
+
length: e ? c : 0,
|
|
30
|
+
messageText: (d ? `${E.cyan(s)}: ` : "") + o + (e || n === void 0 ? "" : `
|
|
31
|
+
|
|
32
|
+
${F(n, r)}`)
|
|
33
|
+
}, l = t.formatDiagnosticsWithColorAndContext([f], g), m = S ? l : l.replaceAll($, ""), h = e ? m : m.replace(x.toString(), p);
|
|
34
|
+
this.config.context.logger.error(h);
|
|
35
|
+
}, x = 1490, $ = /\x1B\[[0-9;]*m/gu, J = w("cyan", `[${p}] `);
|
|
36
|
+
function U(o = process.cwd(), r, n) {
|
|
37
|
+
const s = r === void 0 ? v("tsconfig.json", o) : C.resolve(o, r);
|
|
38
|
+
if (s === void 0)
|
|
39
|
+
throw Error(
|
|
40
|
+
`Unable to find ${y(String(r))}. Please make sure the file exists, or provide types.tsconfigPath option to useLumina()`
|
|
41
|
+
);
|
|
42
|
+
const i = t.readConfigFile(s, t.sys.readFile);
|
|
43
|
+
if (i.error !== void 0)
|
|
44
|
+
throw Error(t.formatDiagnosticsWithColorAndContext([i.error], g));
|
|
45
|
+
const c = i.config, a = n ? c : {
|
|
46
|
+
...c,
|
|
47
|
+
include: [],
|
|
48
|
+
files: [],
|
|
49
|
+
exclude: []
|
|
50
|
+
}, e = t.parseJsonConfigFileContent(a, t.sys, C.dirname(s)), d = 18002, f = n ? e.errors : e.errors.filter((l) => l.code !== d);
|
|
51
|
+
if (f.length > 0)
|
|
52
|
+
throw Error(t.formatDiagnosticsWithColorAndContext(f, g));
|
|
53
|
+
return {
|
|
54
|
+
configPath: s,
|
|
55
|
+
config: e
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
g as a,
|
|
60
|
+
U as b,
|
|
61
|
+
W as e,
|
|
62
|
+
J as l,
|
|
63
|
+
N as p
|
|
64
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ApiType } from "../apiJson.js";
|
|
2
|
+
import type { HydrateApiTypeCallback as HydrateApiTypeCallbackAlias } from "../utils/hydrateApiType.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated import { hydrateApiType } from "@arcgis/api-extractor/utils/hydrateApiType" instead.
|
|
6
|
+
* @param apiType
|
|
7
|
+
* @param hydratePart
|
|
8
|
+
*/
|
|
9
|
+
export function hydrateApiType<T>(apiType: Pick<ApiType, "references" | "text">, hydratePart: HydrateApiTypeCallbackAlias<T>): (T | string)[];
|
|
10
|
+
|
|
11
|
+
/** @deprecated import { HydrateApiTypeCallback } from "@arcgis/api-extractor/utils/hydrateApiType" instead. */
|
|
12
|
+
export type HydrateApiTypeCallback<T> = HydrateApiTypeCallbackAlias<T>;
|
|
@@ -1,23 +1,49 @@
|
|
|
1
|
-
import { ApiClassMember, ApiClassMethod, ApiCustomElementField,
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { ApiClassMember, ApiClassMethod, ApiCssCustomProperty, ApiCustomElementField, ApiCustomElementMember, ApiDeclaration, ApiEvent, ApiSlot } from "../apiJson.js";
|
|
2
|
+
|
|
3
|
+
/** @param member */
|
|
4
|
+
export function isApiMethod(member: ApiClassMember): member is ApiClassMethod;
|
|
5
|
+
|
|
6
|
+
/** @param member */
|
|
7
|
+
export function isApiProperty(member: ApiClassMember): member is ApiCustomElementField;
|
|
8
|
+
|
|
9
|
+
/** This is not made up by us - defined in the custom-elements-manifest spec */
|
|
10
|
+
export const globalPackageIdentifier: "global:";
|
|
11
|
+
|
|
4
12
|
/**
|
|
5
|
-
*
|
|
6
|
-
* is that nested components appear after their parent component. Otherwise,
|
|
7
|
-
* simple alphabetical.
|
|
13
|
+
* Get a name from a class member.
|
|
8
14
|
*
|
|
15
|
+
* @param member
|
|
9
16
|
* @example
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* "src/components/z/components/sub-z.js",
|
|
15
|
-
* ]
|
|
16
|
-
* ```
|
|
17
|
+
* - method named "test" => "test"
|
|
18
|
+
* - property named "test" => "test"
|
|
19
|
+
* - constructor => "constructor"
|
|
20
|
+
* - call-signature => "call-signature"
|
|
17
21
|
*/
|
|
18
|
-
export
|
|
22
|
+
export function getApiMemberName(member: ApiClassMember | ApiCustomElementMember): string;
|
|
23
|
+
|
|
19
24
|
/**
|
|
20
|
-
*
|
|
25
|
+
* Like `getApiMemberName`, but prefixes with `static ` if the member is static.
|
|
26
|
+
*
|
|
27
|
+
* @param member
|
|
28
|
+
*/
|
|
29
|
+
export function getMaybeStaticApiMemberName(member: ApiClassMember | ApiCustomElementMember): string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get a UI label from a class member.
|
|
33
|
+
*
|
|
34
|
+
* @param member
|
|
35
|
+
* @example
|
|
36
|
+
* - method named "test" => "test()"
|
|
37
|
+
* - property named "test" => "test"
|
|
38
|
+
* - constructor => "constructor()"
|
|
39
|
+
* - call-signature => "()"
|
|
40
|
+
* - web component with tag name "my-component" => "my-component"
|
|
41
|
+
*/
|
|
42
|
+
export function getApiNodeLabel(member: ApiClassMember | ApiCssCustomProperty | ApiCustomElementMember | ApiDeclaration | ApiEvent | ApiSlot): string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Checks whether method's return type is a Promise.
|
|
46
|
+
*
|
|
47
|
+
* @param apiMethod
|
|
21
48
|
*/
|
|
22
|
-
export
|
|
23
|
-
export declare const multipleJsDocTags: Set<string>;
|
|
49
|
+
export function isApiMethodAsync(apiMethod: ApiClassMethod): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { d as s, k as r, j as o, y as i, u as p, h as t, v as m, i as d, e as A, w as c, q as g, x as M, m as b, n as l } from "../apiHelpers-BYzO767m.js";
|
|
2
|
+
export {
|
|
3
|
+
s as apiTypeToImportType,
|
|
4
|
+
r as compareClassMembers,
|
|
5
|
+
o as compareNamedNodes,
|
|
6
|
+
i as compareStrings,
|
|
7
|
+
p as emitJsDocError,
|
|
8
|
+
t as getApiMemberName,
|
|
9
|
+
m as getApiNodeLabel,
|
|
10
|
+
d as getMaybeStaticApiMemberName,
|
|
11
|
+
A as globalPackageIdentifier,
|
|
12
|
+
c as isApiMethod,
|
|
13
|
+
g as isApiMethodAsync,
|
|
14
|
+
M as isApiProperty,
|
|
15
|
+
b as mergeApiNodes,
|
|
16
|
+
l as naturalSortModules
|
|
17
|
+
};
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import type ts from "typescript";
|
|
2
|
+
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Convert property name node into a string. Converts Identifier and
|
|
5
|
+
* StringLiteralLike nodes. Handles symbols like [Symbol.iterator]. For the
|
|
6
|
+
* rest, returns undefined.
|
|
7
|
+
*
|
|
8
|
+
* @param name
|
|
5
9
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
10
|
+
export function getMemberName(name?: ts.PropertyName): string | undefined;
|
|
11
|
+
|
|
8
12
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
13
|
+
* @param specifier
|
|
14
|
+
* @example
|
|
15
|
+
* ```js
|
|
16
|
+
* getPackageNameFromExternalSpecifier("@esri/calcite-components/components/calcite-button")
|
|
17
|
+
* // "@esri/calcite-components"
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function getPackageNameFromExternalSpecifier(specifier: string): string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Remove the extension from a file path. In most cases, removes only the last
|
|
24
|
+
* dot segment, but also removes `.d` in case of `.d.ts`
|
|
25
|
+
*
|
|
26
|
+
* @param path
|
|
11
27
|
*/
|
|
12
|
-
export
|
|
13
|
-
export declare const findDecorator: ({ modifiers }: {
|
|
14
|
-
modifiers?: readonly ts.ModifierLike[];
|
|
15
|
-
}, name: string) => ts.CallExpression | undefined;
|
|
28
|
+
export function getBasename(path: string): string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import s from "typescript";
|
|
2
|
+
import { mappedFind as o } from "@arcgis/toolkit/array";
|
|
3
|
+
function a(e, n, t) {
|
|
4
|
+
if (!n && e !== void 0) {
|
|
5
|
+
const r = i(e);
|
|
6
|
+
if (x(r))
|
|
7
|
+
return r.getText(t);
|
|
8
|
+
}
|
|
9
|
+
return n;
|
|
10
|
+
}
|
|
11
|
+
const x = (e) => s.isLiteralExpression(e) || e.kind === s.SyntaxKind.TrueKeyword || e.kind === s.SyntaxKind.FalseKeyword || s.isPrefixUnaryExpression(e) && s.isLiteralExpression(e.operand);
|
|
12
|
+
function i(e) {
|
|
13
|
+
return s.isSatisfiesExpression(e) || s.isParenthesizedExpression(e) || s.isAsExpression(e) || s.isTypeAssertionExpression(e) ? i(e.expression) : e;
|
|
14
|
+
}
|
|
15
|
+
function f(e) {
|
|
16
|
+
if (e !== void 0) {
|
|
17
|
+
if (s.isIdentifier(e))
|
|
18
|
+
return e.escapedText;
|
|
19
|
+
if (s.isStringLiteralLike(e))
|
|
20
|
+
return e.text;
|
|
21
|
+
if (s.isComputedPropertyName(e)) {
|
|
22
|
+
if (s.isStringLiteralLike(e.expression))
|
|
23
|
+
return e.expression.text;
|
|
24
|
+
if (s.isPropertyAccessExpression(e.expression) && s.isIdentifier(e.expression.expression) && e.expression.expression.text === "Symbol")
|
|
25
|
+
return `[Symbol.${e.expression.name.text}]`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const p = (e, n) => e === void 0 ? void 0 : o(
|
|
30
|
+
e,
|
|
31
|
+
(t) => s.isDecorator(t) && s.isCallExpression(t.expression) && s.isIdentifier(t.expression.expression) && t.expression.expression.escapedText === n ? t.expression : void 0
|
|
32
|
+
);
|
|
33
|
+
function c(e) {
|
|
34
|
+
const n = e.indexOf("/");
|
|
35
|
+
if (n === -1)
|
|
36
|
+
return e;
|
|
37
|
+
if (e.startsWith("@")) {
|
|
38
|
+
const t = e.indexOf("/", n + 1);
|
|
39
|
+
return t === -1 ? e : e.slice(0, t);
|
|
40
|
+
} else
|
|
41
|
+
return e.slice(0, n);
|
|
42
|
+
}
|
|
43
|
+
function y(e, n) {
|
|
44
|
+
return e.kind === s.SyntaxKind.TrueKeyword ? !0 : (e.kind === s.SyntaxKind.FalseKeyword || n.emitError(
|
|
45
|
+
"Expected boolean literal (true or false) rather than variable/expression - the value must be statically analyzable",
|
|
46
|
+
{
|
|
47
|
+
file: n.file,
|
|
48
|
+
node: e
|
|
49
|
+
}
|
|
50
|
+
), !1);
|
|
51
|
+
}
|
|
52
|
+
function E(e) {
|
|
53
|
+
const n = e.lastIndexOf(".");
|
|
54
|
+
if (n === -1 || e.length - n > l || e.includes("/", n))
|
|
55
|
+
return e;
|
|
56
|
+
const t = e.slice(n - 2, n) === ".d" ? n - 2 : n;
|
|
57
|
+
return e.slice(0, t);
|
|
58
|
+
}
|
|
59
|
+
const l = 4;
|
|
60
|
+
export {
|
|
61
|
+
y as extractBooleanInitializer,
|
|
62
|
+
a as extractInitializer,
|
|
63
|
+
p as findDecorator,
|
|
64
|
+
E as getBasename,
|
|
65
|
+
f as getMemberName,
|
|
66
|
+
c as getPackageNameFromExternalSpecifier
|
|
67
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ApiClassDeclaration, ApiCustomElementDeclaration, ApiJson, ApiMixinDeclaration, ApiModule, ApiReferenceWithTypeArguments } from "../apiJson.js";
|
|
2
|
+
|
|
3
|
+
/** Everything is indexed by the module path. */
|
|
4
|
+
export type IndexedModules = Map<string, IndexedModule>;
|
|
5
|
+
|
|
6
|
+
export interface IndexedModule {
|
|
7
|
+
readonly apiModule: ApiModule;
|
|
8
|
+
readonly classLike?: ApiClassDeclaration | ApiCustomElementDeclaration | ApiMixinDeclaration;
|
|
9
|
+
/**
|
|
10
|
+
* Mixins and superclasses ancestors. Sorted from most immediate to furthest
|
|
11
|
+
* ancestor.
|
|
12
|
+
*
|
|
13
|
+
* The type reference may refer to a local module or an external package.
|
|
14
|
+
*
|
|
15
|
+
* If type argument were passed, they will be included.
|
|
16
|
+
* In the docs UI, it makes the most sense to show type arguments only for the
|
|
17
|
+
* immediate superclass.
|
|
18
|
+
*/
|
|
19
|
+
ancestors?: ApiReferenceWithTypeArguments[];
|
|
20
|
+
/** Includes only direct children. */
|
|
21
|
+
children?: IndexedModule[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Compute a list of subclasses and parent hierarchy for each class in the api.json.
|
|
26
|
+
* Everything is indexed by the module path.
|
|
27
|
+
*
|
|
28
|
+
* @param apiJson
|
|
29
|
+
*/
|
|
30
|
+
export function createIndex(apiJson: Pick<ApiJson, "modules">): IndexedModules;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
function y(s) {
|
|
2
|
+
const t = g(s.modules);
|
|
3
|
+
return k(t), t;
|
|
4
|
+
}
|
|
5
|
+
function g(s) {
|
|
6
|
+
const t = /* @__PURE__ */ new Map();
|
|
7
|
+
for (let o = 0; o < s.length; ++o) {
|
|
8
|
+
const n = s[o];
|
|
9
|
+
let i;
|
|
10
|
+
for (let a = 0; a < n.declarations.length; ++a) {
|
|
11
|
+
const r = n.declarations[a];
|
|
12
|
+
if (r.kind === "class" || r.kind === "mixin") {
|
|
13
|
+
i = r;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
t.set(n.path, {
|
|
18
|
+
apiModule: n,
|
|
19
|
+
classLike: i,
|
|
20
|
+
ancestors: void 0,
|
|
21
|
+
children: void 0
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
}
|
|
26
|
+
function k(s) {
|
|
27
|
+
for (const t of s.values())
|
|
28
|
+
p(t, s);
|
|
29
|
+
}
|
|
30
|
+
function p(s, t) {
|
|
31
|
+
const o = s.classLike;
|
|
32
|
+
if (o === void 0)
|
|
33
|
+
return;
|
|
34
|
+
const n = o;
|
|
35
|
+
if (!(s.ancestors !== void 0 || o.mixins === void 0 && n.superclass === void 0)) {
|
|
36
|
+
if (s.ancestors ??= [], o.mixins !== void 0)
|
|
37
|
+
for (let a = o.mixins.length - 1; a >= 0; --a)
|
|
38
|
+
v(o.mixins[a], s, t);
|
|
39
|
+
n.superclass !== void 0 && h(n.superclass, s, t);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function v(s, t, o) {
|
|
43
|
+
if (s.module !== void 0 && s.package === void 0) {
|
|
44
|
+
const n = o.get(s.module);
|
|
45
|
+
p(n, o), n.children ??= [], n.children.push(t);
|
|
46
|
+
}
|
|
47
|
+
t.ancestors.push(s);
|
|
48
|
+
}
|
|
49
|
+
function h(s, t, o) {
|
|
50
|
+
if (!(s.module !== void 0 && s.package === void 0)) {
|
|
51
|
+
t.ancestors.push(s);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const i = o.get(s.module);
|
|
55
|
+
p(i, o), i.children ??= [], i.children.push(t);
|
|
56
|
+
const a = i.classLike;
|
|
57
|
+
if (a.kind === "mixin" && a.name !== s.name && s.name !== "default") {
|
|
58
|
+
const u = i.apiModule.declarations;
|
|
59
|
+
for (let e = 0; e < u.length; ++e) {
|
|
60
|
+
const f = u[e];
|
|
61
|
+
if (f.name === s.name) {
|
|
62
|
+
const l = f;
|
|
63
|
+
for (let m = l.supertypes.length - 1; m >= 1; --m) {
|
|
64
|
+
const c = l.supertypes[m], d = c.module === void 0 && c.package === void 0 ? {
|
|
65
|
+
name: c.name,
|
|
66
|
+
module: s.module,
|
|
67
|
+
package: void 0,
|
|
68
|
+
viewUrl: c.viewUrl,
|
|
69
|
+
typeArguments: c.typeArguments
|
|
70
|
+
} : c;
|
|
71
|
+
v(d, t, o);
|
|
72
|
+
}
|
|
73
|
+
h(l.supertypes[0], t, o);
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} else
|
|
78
|
+
t.ancestors.push(s);
|
|
79
|
+
i.ancestors !== void 0 && t.ancestors.push(...i.ancestors);
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
y as createIndex
|
|
83
|
+
};
|