@arcgis/api-extractor 5.0.0-next.14 → 5.0.0-next.141

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 (56) hide show
  1. package/dist/ApiExtractor-DIfug_xm.js +2644 -0
  2. package/dist/apiJson.d.ts +783 -1011
  3. package/dist/cli.js +38 -0
  4. package/dist/compilerHints.d.ts +62 -0
  5. package/dist/diff/diffApiJson.d.ts +26 -3
  6. package/dist/diff/diffApiJson.js +142 -0
  7. package/dist/diff/fetchApiJsonFromNpm.d.ts +5 -2
  8. package/dist/diff/fetchApiJsonFromNpm.js +9 -0
  9. package/dist/diff/types.d.ts +80 -49
  10. package/dist/diffTypes/index.d.ts +21 -0
  11. package/dist/diffTypes/index.js +71 -0
  12. package/dist/extractor/ApiExtractor.d.ts +74 -0
  13. package/dist/extractor/ApiExtractor.js +9 -0
  14. package/dist/extractor/config.d.ts +452 -0
  15. package/dist/extractor/config.js +17 -0
  16. package/dist/extractor/extractors/copyDoc.d.ts +25 -0
  17. package/dist/extractor/privateContext.d.ts +19 -0
  18. package/dist/extractor/privateContext.js +84 -0
  19. package/dist/extractor/processing/links.d.ts +12 -0
  20. package/dist/extractor/processing/links.js +174 -0
  21. package/dist/extractor/types.d.ts +40 -0
  22. package/dist/extractor/webComponent/findComponents.d.ts +19 -0
  23. package/dist/extractor/webComponent/findComponents.js +36 -0
  24. package/dist/extractor/webComponent/pathMapping.d.ts +11 -0
  25. package/dist/extractor/webComponent/pathMapping.js +44 -0
  26. package/dist/index.d.ts +164 -8
  27. package/dist/index.js +3 -283
  28. package/dist/typeScript-soMJqHns.js +64 -0
  29. package/dist/uiUtils/index.d.ts +12 -0
  30. package/dist/uiUtils/index.js +5 -0
  31. package/dist/utils/apiHelpers.d.ts +43 -17
  32. package/dist/utils/apiHelpers.js +80 -0
  33. package/dist/utils/astHelpers.d.ts +24 -11
  34. package/dist/utils/astHelpers.js +67 -0
  35. package/dist/utils/hydrateApiType.d.ts +26 -0
  36. package/dist/utils/hydrateApiType.js +62 -0
  37. package/dist/utils/inferEntrypoints.d.ts +17 -0
  38. package/dist/utils/inferEntrypoints.js +26 -0
  39. package/dist/utils/internalTypeScriptApis.d.ts +92 -0
  40. package/dist/utils/internalTypeScriptApis.js +58 -0
  41. package/dist/utils/partPrinter.d.ts +29 -0
  42. package/dist/utils/partPrinter.js +82 -0
  43. package/dist/vite/plugin.d.ts +53 -0
  44. package/dist/vite/plugin.js +107 -0
  45. package/dist/vite/typeScript.d.ts +16 -0
  46. package/dist/vite/typeScript.js +6 -0
  47. package/dist/worker-On5v54cw.js +3597 -0
  48. package/package.json +46 -5
  49. package/dist/diff/index.d.ts +0 -3
  50. package/dist/diff.js +0 -147
  51. package/dist/ensureValidType.d.ts +0 -1
  52. package/dist/extractor/index.d.ts +0 -46
  53. package/dist/types.d.ts +0 -25
  54. package/dist/utils/docHelpers.d.ts +0 -9
  55. package/dist/utils/error.d.ts +0 -12
  56. package/dist/utils/print.d.ts +0 -7
package/dist/index.js CHANGED
@@ -1,285 +1,5 @@
1
- import c from "typescript";
2
- import { path as y } from "@arcgis/components-build-utils";
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.14", 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
- X as ApiExtractor,
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.141", 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>;
@@ -0,0 +1,5 @@
1
+ import { hydrateApiType as p } from "../utils/hydrateApiType.js";
2
+ const r = p;
3
+ export {
4
+ r as hydrateApiType
5
+ };
@@ -1,23 +1,49 @@
1
- import { ApiClassMember, ApiClassMethod, ApiCustomElementField, ApiModule } from '../apiJson';
2
- export declare const isApiMethod: (member: ApiClassMember) => member is ApiClassMethod;
3
- export declare const isApiProperty: (member: ApiClassMember) => member is ApiCustomElementField;
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
- * Being a bit smarter than simply sorting paths alphabetically. The goal
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
- * ```ts
11
- * [
12
- * "src/components/z/z.js",
13
- * "src/components/z/components/sub-a.js",
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 declare function naturalSortModules(left: ApiModule, right: ApiModule): number;
22
+ export function getApiMemberName(member: ApiClassMember | ApiCustomElementMember): string;
23
+
19
24
  /**
20
- * This is not made up by us - defined in the custom-elements-manifest spec
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 declare const globalPackageIdentifier = "global:";
23
- export declare const multipleJsDocTags: Set<string>;
49
+ export function isApiMethodAsync(apiMethod: ApiClassMethod): boolean;
@@ -0,0 +1,80 @@
1
+ import { getModuleContext as f } from "../extractor/privateContext.js";
2
+ const g = (e) => e.kind === "method", v = (e) => e.kind === "field";
3
+ function h(e, n) {
4
+ const o = e.sourcePath, i = n.sourcePath;
5
+ let t = 0;
6
+ for (; ; ) {
7
+ const c = o.indexOf("/", t), s = i.indexOf("/", t);
8
+ if (c === -1)
9
+ return s === -1 ? o.slice(t) < i.slice(t) ? -1 : 1 : -1;
10
+ if (s === -1)
11
+ return 1;
12
+ {
13
+ const r = o.slice(t, c), a = i.slice(t, s);
14
+ if (r !== a)
15
+ return r < a ? -1 : 1;
16
+ t = c + 1;
17
+ }
18
+ }
19
+ }
20
+ const p = "global:";
21
+ function x(e, n, o) {
22
+ const i = f(o.apiModule).file, t = i.text.indexOf(n) ?? -1;
23
+ o.emitError(`${e}${t === -1 ? `. Found in: ${n}` : ""}`, {
24
+ file: i,
25
+ node: void 0,
26
+ scope: i === void 0 ? o.apiModule.sourcePath : void 0,
27
+ start: t,
28
+ length: n.length
29
+ });
30
+ }
31
+ const l = new Intl.Collator("en", { numeric: !0 }).compare, S = (e, n) => l(e.name, n.name), M = (e, n) => e.static !== void 0 && n.static === void 0 ? -1 : n.static !== void 0 && e.static === void 0 ? 1 : e.name === void 0 ? n.name === void 0 ? 0 : -1 : n.name === void 0 || "return" in e && !("return" in n) ? 1 : "return" in n && !("return" in e) ? -1 : l(e.name, n.name), d = (e) => e.name ?? (e.kind === "constructor" ? "constructor" : "call-signature"), P = (e) => e.static === !0 ? `static ${d(e)}` : d(e), T = (e) => ("bubbles" in e ? "@" : "") + (e.tagName ?? e.name ?? (e.kind === "constructor" ? "constructor" : "")) + ("return" in e ? "()" : "");
32
+ function k(e, n, o = -1) {
33
+ "description" in n && (n.description ??= e.description), "deprecated" in n && (n.deprecated ??= e.deprecated), "return" in n && e.return !== void 0 && (n.return.description ??= e.return?.description), "readonly" in n && (n.readonly ??= e.readonly);
34
+ const { docsTags: i } = e, t = n;
35
+ if (o !== -1 && (i === void 0 && t.docsTags.length === 1 ? t.docsTags = void 0 : t.docsTags.splice(o, 1)), i !== void 0) {
36
+ t.docsTags ??= [];
37
+ const c = /* @__PURE__ */ new Set();
38
+ for (let s = 0; s < t.docsTags.length; ++s)
39
+ c.add(t.docsTags[s].name);
40
+ for (let s = 0; s < i.length; ++s) {
41
+ const r = i[s];
42
+ c.has(r.name) && r.name !== "example" && r.name !== "see" || t.docsTags.push(r);
43
+ }
44
+ }
45
+ }
46
+ function y(e, n) {
47
+ let o = e.text;
48
+ if (e.references !== void 0)
49
+ for (let i = e.references.length - 1; i >= 0; i--) {
50
+ const t = e.references[i];
51
+ if (t.package === p || t.module === void 0 && t.package === void 0 && t.viewUrl === void 0)
52
+ continue;
53
+ const r = t.name === "default" ? "default" : t.name, u = `import("${t.package === void 0 ? `./${t.module ?? n}.js` : t.package + (t.module === void 0 ? "" : `/${t.module}`)}").${r}`;
54
+ o = o.slice(0, t.start) + u + o.slice(t.end);
55
+ }
56
+ return {
57
+ ...e,
58
+ text: o,
59
+ references: void 0
60
+ };
61
+ }
62
+ function A(e) {
63
+ return e.return.type.text.startsWith("Promise<");
64
+ }
65
+ export {
66
+ y as apiTypeToImportType,
67
+ M as compareClassMembers,
68
+ S as compareNamedNodes,
69
+ l as compareStrings,
70
+ x as emitJsDocError,
71
+ d as getApiMemberName,
72
+ T as getApiNodeLabel,
73
+ P as getMaybeStaticApiMemberName,
74
+ p as globalPackageIdentifier,
75
+ g as isApiMethod,
76
+ A as isApiMethodAsync,
77
+ v as isApiProperty,
78
+ k as mergeApiNodes,
79
+ h as naturalSortModules
80
+ };
@@ -1,15 +1,28 @@
1
- import { default as ts } from 'typescript';
2
- import { ApiPropertyLike } from '../apiJson';
1
+ import type ts from "typescript";
2
+
3
3
  /**
4
- * Check if a member has a static, private, or protected modifier.
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 declare const hasIgnoredModifier: (member: ts.ClassElement) => boolean;
7
- export declare function setDefaultFromInitializer(node: ts.AccessorDeclaration | ts.PropertyDeclaration, property: ApiPropertyLike, sourceFile: ts.SourceFile): void;
10
+ export function getMemberName(name?: ts.PropertyName): string | undefined;
11
+
8
12
  /**
9
- * Convert property name node into a string. Converts Identifier and
10
- * StringLiteralLike nodes. The rest return undefined.
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 declare function getMemberName(name?: ts.PropertyName): string | undefined;
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,26 @@
1
+ import type { ApiType, ApiTypeReference } from "../apiJson.js";
2
+
3
+ /**
4
+ * Traverse through ApiType text string, turning type references into links.
5
+ *
6
+ * Also hydrates well-known JS "global" keywords (e.g. `string`, `number`), even
7
+ * if they don't appear in ApiType.references.
8
+ *
9
+ * @param apiType - The ApiType to hydrate
10
+ * @param hydratePart - A callback that converts a type reference into desired output
11
+ * @see [Type References](https://devtopia.esri.com/WebGIS/arcgis-web-components/blob/main/packages/support-packages/api-extractor/src/const/typeReferences/README.md)
12
+ * @example
13
+ * ```ts
14
+ * const markdownTypeString = hydrateApiType(
15
+ * apiProperty.type,
16
+ * (text, reference) => `[${text}](${reference.viewUrl})`
17
+ * ).join("");
18
+ * ```
19
+ */
20
+ export function hydrateApiType<T>(apiType: Pick<ApiType, "references" | "text">, hydratePart: HydrateApiTypeCallback<T>): (T | string)[];
21
+
22
+ /**
23
+ * @param referenceText - The text of the type reference
24
+ * @param reference - The metadata about the type reference
25
+ */
26
+ export type HydrateApiTypeCallback<T> = (referenceText: string, reference: ApiTypeReference & { viewUrl: NonNullable<ApiTypeReference["viewUrl"]>; }) => T;