@arcgis/api-extractor 5.0.0-next.135 → 5.0.0-next.137
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/ApiExtractor-BwOcUvPV.js +2644 -0
- package/dist/apiJson.d.ts +706 -760
- package/dist/cli.js +26 -2
- package/dist/compilerHints.d.ts +62 -0
- package/dist/diff/diffApiJson.d.ts +6 -3
- package/dist/diff/diffApiJson.js +142 -0
- package/dist/diff/fetchApiJsonFromNpm.d.ts +5 -2
- package/dist/diff/fetchApiJsonFromNpm.js +9 -0
- package/dist/diff/types.d.ts +70 -56
- package/dist/diffTypes/index.d.ts +20 -23
- package/dist/diffTypes/index.js +4 -2
- package/dist/extractor/ApiExtractor.d.ts +72 -137
- package/dist/extractor/ApiExtractor.js +9 -0
- package/dist/extractor/config.d.ts +425 -39
- package/dist/extractor/config.js +17 -0
- package/dist/extractor/extractors/copyDoc.d.ts +25 -0
- package/dist/extractor/privateContext.d.ts +19 -0
- package/dist/extractor/privateContext.js +84 -0
- package/dist/extractor/processing/links.d.ts +12 -0
- package/dist/extractor/processing/links.js +177 -0
- package/dist/extractor/types.d.ts +40 -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 -12
- package/dist/index.js +3 -841
- package/dist/typeScript-CzUTFiYO.js +64 -0
- package/dist/uiUtils/index.d.ts +10 -19
- package/dist/uiUtils/index.js +3 -55
- package/dist/utils/apiHelpers.d.ts +28 -61
- package/dist/utils/apiHelpers.js +80 -0
- package/dist/utils/astHelpers.d.ts +22 -21
- package/dist/utils/astHelpers.js +67 -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 +25 -19
- 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-CULPfolw.js +3599 -0
- package/package.json +40 -9
- package/dist/cli.d.ts +0 -2
- package/dist/config/typeReferences/docLinkAdditions.d.ts +0 -51
- package/dist/config/typeReferences/globals.d.ts +0 -11
- package/dist/config/typeReferences/stringDocLinkAdditions.d.ts +0 -17
- package/dist/config/typeReferences/typeScriptGlobals.json.d.ts +0 -3
- package/dist/diff/index.d.ts +0 -3
- package/dist/diff/index.js +0 -149
- package/dist/ensureCemCompatibility.d.ts +0 -1
- package/dist/internalTypeScriptApis.d.ts +0 -31
- package/dist/types.d.ts +0 -22
- package/dist/utils/error.d.ts +0 -17
- package/dist/utils/jsDocHelpers.d.ts +0 -2
- package/dist/utils/jsDocParser.d.ts +0 -46
- package/dist/utils/jsDocPrinter.d.ts +0 -13
- package/dist/utils/print.d.ts +0 -6
|
@@ -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.137", 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
|
+
};
|
package/dist/uiUtils/index.d.ts
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import { ApiType
|
|
1
|
+
import type { ApiType } from "../apiJson.js";
|
|
2
|
+
import type { HydrateApiTypeCallback as HydrateApiTypeCallbackAlias } from "../utils/hydrateApiType.js";
|
|
3
|
+
|
|
2
4
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* if they don't appear in ApiType.references.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const markdownTypeString = hydrateApiType(
|
|
11
|
-
* apiProperty.type,
|
|
12
|
-
* (text, reference) => `[${text}](${reference.viewUrl})`
|
|
13
|
-
* ).join("");
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @see [Type References](../config/typeReferences/README.md)
|
|
5
|
+
* @deprecated import { hydrateApiType } from "@arcgis/api-extractor/utils/hydrateApiType" instead.
|
|
6
|
+
* @param apiType
|
|
7
|
+
* @param hydratePart
|
|
17
8
|
*/
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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>;
|
package/dist/uiUtils/index.js
CHANGED
|
@@ -1,57 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
string: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String",
|
|
4
|
-
boolean: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
|
|
5
|
-
null: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/null",
|
|
6
|
-
number: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number",
|
|
7
|
-
object: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object",
|
|
8
|
-
void: "https://www.typescriptlang.org/docs/handbook/2/functions.html#void",
|
|
9
|
-
unknown: "https://www.typescriptlang.org/docs/handbook/2/functions.html#unknown",
|
|
10
|
-
never: "https://www.typescriptlang.org/docs/handbook/2/functions.html#never",
|
|
11
|
-
any: "https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any",
|
|
12
|
-
this: "#"
|
|
13
|
-
}), h = Object.keys(d).join("|"), g = new RegExp(`\\b(?:${h})\\b`, "u");
|
|
14
|
-
function p(e, l) {
|
|
15
|
-
const n = [];
|
|
16
|
-
let o = e.text.length;
|
|
17
|
-
if (e.references !== void 0)
|
|
18
|
-
for (let c = e.references.length - 1; c >= 0; c--) {
|
|
19
|
-
const t = e.references[c];
|
|
20
|
-
if (t.start === void 0 || t.end === void 0)
|
|
21
|
-
continue;
|
|
22
|
-
const r = e.text.slice(t.end, o);
|
|
23
|
-
r.length > 0 && i(r, l, n);
|
|
24
|
-
const s = e.text.slice(t.start, t.end);
|
|
25
|
-
o = t.start, t.viewUrl === void 0 ? n.push(s) : n.push(
|
|
26
|
-
l(s, t)
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
if (o > 0) {
|
|
30
|
-
const c = e.text.slice(0, o);
|
|
31
|
-
i(c, l, n);
|
|
32
|
-
}
|
|
33
|
-
return n.reverse();
|
|
34
|
-
}
|
|
35
|
-
function i(e, l, n) {
|
|
36
|
-
const o = n.length;
|
|
37
|
-
for (let c = 0; c < e.length; ) {
|
|
38
|
-
const t = e.match(g);
|
|
39
|
-
if (t?.index === void 0)
|
|
40
|
-
break;
|
|
41
|
-
const r = e.slice(0, t.index);
|
|
42
|
-
r.length > 0 && n.splice(o, 0, r);
|
|
43
|
-
const s = t[0];
|
|
44
|
-
e = e.slice(t.index + s.length);
|
|
45
|
-
const a = d[s], b = l(s, {
|
|
46
|
-
name: s,
|
|
47
|
-
module: void 0,
|
|
48
|
-
package: s === "this" ? void 0 : "global:",
|
|
49
|
-
viewUrl: a
|
|
50
|
-
});
|
|
51
|
-
n.splice(o, 0, b);
|
|
52
|
-
}
|
|
53
|
-
e.length > 0 && n.splice(o, 0, e);
|
|
54
|
-
}
|
|
1
|
+
import { hydrateApiType as p } from "../utils/hydrateApiType.js";
|
|
2
|
+
const r = p;
|
|
55
3
|
export {
|
|
56
|
-
|
|
4
|
+
r as hydrateApiType
|
|
57
5
|
};
|
|
@@ -1,82 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* [
|
|
13
|
-
* "src/components/z/z.js",
|
|
14
|
-
* "src/components/z/components/sub-a.js",
|
|
15
|
-
* "src/components/z/components/sub-z.js",
|
|
16
|
-
* ]
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function naturalSortModules(left: Pick<ApiModule, "sourcePath">, right: Pick<ApiModule, "sourcePath">): number;
|
|
20
|
-
/**
|
|
21
|
-
* This is not made up by us - defined in the custom-elements-manifest spec
|
|
22
|
-
*/
|
|
23
|
-
export declare const globalPackageIdentifier = "global:";
|
|
24
|
-
export declare const multipleJsDocTags: Set<string>;
|
|
25
|
-
interface PostProcessLinkContext {
|
|
26
|
-
alternativeDocumentationHost: string;
|
|
27
|
-
normalizedDocumentationHost: string;
|
|
28
|
-
resolveJsDocLink: (text: string, match: string) => string;
|
|
29
|
-
moduleName: string;
|
|
30
|
-
file?: ts.SourceFile;
|
|
31
|
-
}
|
|
32
|
-
export declare function postProcessLinks(apiPart: Partial<Pick<ApiCustomElementField, "deprecated" | "description" | "docsTags" | "inheritedFrom">>, context: PostProcessLinkContext): void;
|
|
33
|
-
/**
|
|
34
|
-
* @privateRemarks
|
|
35
|
-
* Link validation runs during post-processing, at which point we don't have easy
|
|
36
|
-
* AST access.
|
|
37
|
-
*/
|
|
38
|
-
export declare function apiExtractorJsDocError(message: string, text: string, context: PostProcessLinkContext): void;
|
|
39
|
-
export declare const compareStrings: (x: string, y: string) => number;
|
|
40
|
-
export declare const compareNamedNodes: (left: {
|
|
41
|
-
name: string;
|
|
42
|
-
}, right: {
|
|
43
|
-
name: string;
|
|
44
|
-
}) => number;
|
|
45
|
-
/**
|
|
46
|
-
* 1. Static members
|
|
47
|
-
* 2. Constructors and call signatures
|
|
48
|
-
* 3. Properties before methods
|
|
49
|
-
* 4. Alphabetical
|
|
50
|
-
*/
|
|
51
|
-
export declare const compareClassMembers: (left: ApiClassMember, right: ApiClassMember) => number;
|
|
52
|
-
/**
|
|
53
|
-
* Associate a start and end index with each type reference. Drop unresolved
|
|
54
|
-
* references.
|
|
55
|
-
*/
|
|
56
|
-
export declare function findReferenceRanges(references: ApiTypeReference[], resolvedString: string): ApiTypeReference[] | undefined;
|
|
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
|
+
|
|
57
12
|
/**
|
|
58
13
|
* Get a name from a class member.
|
|
59
14
|
*
|
|
15
|
+
* @param member
|
|
60
16
|
* @example
|
|
61
17
|
* - method named "test" => "test"
|
|
62
18
|
* - property named "test" => "test"
|
|
63
19
|
* - constructor => "constructor"
|
|
64
20
|
* - call-signature => "call-signature"
|
|
65
21
|
*/
|
|
66
|
-
export
|
|
22
|
+
export function getApiMemberName(member: ApiClassMember | ApiCustomElementMember): string;
|
|
23
|
+
|
|
67
24
|
/**
|
|
68
25
|
* Like `getApiMemberName`, but prefixes with `static ` if the member is static.
|
|
26
|
+
*
|
|
27
|
+
* @param member
|
|
69
28
|
*/
|
|
70
|
-
export
|
|
29
|
+
export function getMaybeStaticApiMemberName(member: ApiClassMember | ApiCustomElementMember): string;
|
|
30
|
+
|
|
71
31
|
/**
|
|
72
32
|
* Get a UI label from a class member.
|
|
73
33
|
*
|
|
34
|
+
* @param member
|
|
74
35
|
* @example
|
|
75
36
|
* - method named "test" => "test()"
|
|
76
37
|
* - property named "test" => "test"
|
|
77
38
|
* - constructor => "constructor()"
|
|
78
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
|
|
79
48
|
*/
|
|
80
|
-
export
|
|
81
|
-
export declare function mergeApiNodes<T extends ApiAttribute | ApiClassDeclaration | ApiClassMember | ApiCssCustomProperty | ApiCssCustomState | ApiCssPart | ApiCustomElementDeclaration | ApiCustomElementMember | ApiEvent | ApiFunctionDeclaration | ApiInterfaceDeclaration | ApiSlot | ApiVariableDeclaration>(source: Partial<T>, destination: T, copyDocTagIndex?: number): void;
|
|
82
|
-
export {};
|
|
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,27 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import type ts from "typescript";
|
|
2
|
+
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
* - it's a literal value
|
|
10
|
-
* - we have `@default` tag in the JSDoc (handled in setApiDocFromJsDoc)
|
|
11
|
-
* - default value is a variable or property access expression whose
|
|
12
|
-
* declaration has a JSDoc (handled further down in this file)
|
|
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
|
|
13
9
|
*/
|
|
14
|
-
export
|
|
10
|
+
export function getMemberName(name?: ts.PropertyName): string | undefined;
|
|
11
|
+
|
|
15
12
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* @param specifier
|
|
14
|
+
* @example
|
|
15
|
+
* ```js
|
|
16
|
+
* getPackageNameFromExternalSpecifier("@esri/calcite-components/components/calcite-button")
|
|
17
|
+
* // "@esri/calcite-components"
|
|
18
|
+
* ```
|
|
18
19
|
*/
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
modifiers?: readonly ts.ModifierLike[];
|
|
22
|
-
}, name: string) => ts.CallExpression | undefined;
|
|
23
|
-
export declare function extractBooleanInitializer(initializer: ts.Expression, sourceFile: ts.SourceFile): boolean;
|
|
20
|
+
export function getPackageNameFromExternalSpecifier(specifier: string): string;
|
|
21
|
+
|
|
24
22
|
/**
|
|
25
|
-
* Remove the
|
|
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
|
|
26
27
|
*/
|
|
27
|
-
export
|
|
28
|
+
export function getBasename(path: string): string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import n from "typescript";
|
|
2
|
+
import { mappedFind as x } from "@arcgis/toolkit/array";
|
|
3
|
+
function f(e, s, t, o) {
|
|
4
|
+
if (!s && e !== void 0) {
|
|
5
|
+
const r = i(e, o);
|
|
6
|
+
if (l(r))
|
|
7
|
+
return r.getText(t);
|
|
8
|
+
}
|
|
9
|
+
return s;
|
|
10
|
+
}
|
|
11
|
+
const l = (e) => n.isLiteralExpression(e) || e.kind === n.SyntaxKind.TrueKeyword || e.kind === n.SyntaxKind.FalseKeyword || n.isPrefixUnaryExpression(e) && n.isLiteralExpression(e.operand);
|
|
12
|
+
function i(e, s) {
|
|
13
|
+
return n.isSatisfiesExpression(e) || n.isParenthesizedExpression(e) || !s && (n.isAsExpression(e) || n.isTypeAssertionExpression(e)) ? i(e.expression, s) : e;
|
|
14
|
+
}
|
|
15
|
+
function c(e) {
|
|
16
|
+
if (e !== void 0) {
|
|
17
|
+
if (n.isIdentifier(e))
|
|
18
|
+
return e.escapedText;
|
|
19
|
+
if (n.isStringLiteralLike(e))
|
|
20
|
+
return e.text;
|
|
21
|
+
if (n.isComputedPropertyName(e)) {
|
|
22
|
+
if (n.isStringLiteralLike(e.expression))
|
|
23
|
+
return e.expression.text;
|
|
24
|
+
if (n.isPropertyAccessExpression(e.expression) && n.isIdentifier(e.expression.expression) && e.expression.expression.text === "Symbol")
|
|
25
|
+
return `[Symbol.${e.expression.name.text}]`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const p = (e, s) => e === void 0 ? void 0 : x(
|
|
30
|
+
e,
|
|
31
|
+
(t) => n.isDecorator(t) && n.isCallExpression(t.expression) && n.isIdentifier(t.expression.expression) && t.expression.expression.escapedText === s ? t.expression : void 0
|
|
32
|
+
);
|
|
33
|
+
function y(e) {
|
|
34
|
+
const s = e.indexOf("/");
|
|
35
|
+
if (s === -1)
|
|
36
|
+
return e;
|
|
37
|
+
if (e.startsWith("@")) {
|
|
38
|
+
const t = e.indexOf("/", s + 1);
|
|
39
|
+
return t === -1 ? e : e.slice(0, t);
|
|
40
|
+
} else
|
|
41
|
+
return e.slice(0, s);
|
|
42
|
+
}
|
|
43
|
+
function E(e, s) {
|
|
44
|
+
return e.kind === n.SyntaxKind.TrueKeyword ? !0 : (e.kind === n.SyntaxKind.FalseKeyword || s.emitError(
|
|
45
|
+
"Expected boolean literal (true or false) rather than variable/expression - the value must be statically analyzable",
|
|
46
|
+
{
|
|
47
|
+
file: s.file,
|
|
48
|
+
node: e
|
|
49
|
+
}
|
|
50
|
+
), !1);
|
|
51
|
+
}
|
|
52
|
+
function g(e) {
|
|
53
|
+
const s = e.lastIndexOf(".");
|
|
54
|
+
if (s === -1 || e.length - s > d || e.includes("/", s))
|
|
55
|
+
return e;
|
|
56
|
+
const t = e.slice(s - 2, s) === ".d" ? s - 2 : s;
|
|
57
|
+
return e.slice(0, t);
|
|
58
|
+
}
|
|
59
|
+
const d = 4;
|
|
60
|
+
export {
|
|
61
|
+
E as extractBooleanInitializer,
|
|
62
|
+
f as extractInitializer,
|
|
63
|
+
p as findDecorator,
|
|
64
|
+
g as getBasename,
|
|
65
|
+
c as getMemberName,
|
|
66
|
+
y 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;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const d = {
|
|
2
|
+
// Create a null prototype object to avoid collisions with Object.prototype when doing lookups
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4
|
+
__proto__: null,
|
|
5
|
+
undefined: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined",
|
|
6
|
+
string: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String",
|
|
7
|
+
boolean: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
|
|
8
|
+
null: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/null",
|
|
9
|
+
number: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number",
|
|
10
|
+
object: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object",
|
|
11
|
+
void: "https://www.typescriptlang.org/docs/handbook/2/functions.html#void",
|
|
12
|
+
unknown: "https://www.typescriptlang.org/docs/handbook/2/functions.html#unknown",
|
|
13
|
+
never: "https://www.typescriptlang.org/docs/handbook/2/functions.html#never",
|
|
14
|
+
any: "https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any",
|
|
15
|
+
this: "#"
|
|
16
|
+
}, h = Object.keys(d).join("|"), g = new RegExp(`\\b(?:${h})\\b`, "u");
|
|
17
|
+
function p(e, c) {
|
|
18
|
+
const n = [];
|
|
19
|
+
let o = e.text.length;
|
|
20
|
+
if (e.references !== void 0)
|
|
21
|
+
for (let l = e.references.length - 1; l >= 0; l--) {
|
|
22
|
+
const t = e.references[l];
|
|
23
|
+
if (t.start === void 0 || t.end === void 0)
|
|
24
|
+
continue;
|
|
25
|
+
const r = e.text.slice(t.end, o);
|
|
26
|
+
r.length > 0 && i(r, c, n);
|
|
27
|
+
const s = e.text.slice(t.start, t.end);
|
|
28
|
+
o = t.start, t.viewUrl === void 0 ? n.push(s) : n.push(
|
|
29
|
+
c(s, t)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
if (o > 0) {
|
|
33
|
+
const l = e.text.slice(0, o);
|
|
34
|
+
i(l, c, n);
|
|
35
|
+
}
|
|
36
|
+
return n.reverse();
|
|
37
|
+
}
|
|
38
|
+
function i(e, c, n) {
|
|
39
|
+
const o = n.length;
|
|
40
|
+
for (let l = 0; l < e.length; ) {
|
|
41
|
+
const t = e.match(g);
|
|
42
|
+
if (t?.index === void 0)
|
|
43
|
+
break;
|
|
44
|
+
const r = e.slice(0, t.index);
|
|
45
|
+
r.length > 0 && n.splice(o, 0, r);
|
|
46
|
+
const s = t[0];
|
|
47
|
+
e = e.slice(t.index + s.length);
|
|
48
|
+
const a = d[s], b = c(s, {
|
|
49
|
+
name: s,
|
|
50
|
+
module: void 0,
|
|
51
|
+
package: s === "this" ? void 0 : "global:",
|
|
52
|
+
viewUrl: a,
|
|
53
|
+
start: void 0,
|
|
54
|
+
end: void 0
|
|
55
|
+
});
|
|
56
|
+
n.splice(o, 0, b);
|
|
57
|
+
}
|
|
58
|
+
e.length > 0 && n.splice(o, 0, e);
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
p as hydrateApiType
|
|
62
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ApiJson } from "../apiJson.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Given api.json, list paths of files that export public runtime APIs. These
|
|
5
|
+
* can be used as entrypoints for bundling.
|
|
6
|
+
*
|
|
7
|
+
* @param apiJson
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // See JSDoc on top of "@arcgis/api-extractor/extractor/ApiExtractor" for
|
|
11
|
+
* // a full example of producing api.json
|
|
12
|
+
* const { apiJson } = await extractor.run();
|
|
13
|
+
* import { inferEntrypoints } from "@arcgis/api-extractor/utils/inferEntrypoints";
|
|
14
|
+
* const entrypoints = inferEntrypoints(apiJson);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export function inferEntrypoints(apiJson: ApiJson): string[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function o(n) {
|
|
2
|
+
const e = [];
|
|
3
|
+
for (let t = 0; t < n.modules.length; ++t) {
|
|
4
|
+
const r = n.modules[t];
|
|
5
|
+
i(r) && e.push(r.sourcePath);
|
|
6
|
+
}
|
|
7
|
+
return e;
|
|
8
|
+
}
|
|
9
|
+
function i(n) {
|
|
10
|
+
if (
|
|
11
|
+
// To keep api.json size in check, api.json for now only includes default
|
|
12
|
+
// exports and custom elements exports - those are runtime declarations.
|
|
13
|
+
n.exports !== void 0 && // Ignore type-only default export (interfaces - @arcgis/core/views/layers/GeoJSONLayerView)
|
|
14
|
+
n.exports[0]?.kind !== "ts"
|
|
15
|
+
)
|
|
16
|
+
return !0;
|
|
17
|
+
for (let e = 0; e < n.declarations.length; ++e) {
|
|
18
|
+
const t = n.declarations[e];
|
|
19
|
+
if (t.kind === "class" || t.kind === "function" || t.kind === "variable")
|
|
20
|
+
return !0;
|
|
21
|
+
}
|
|
22
|
+
return !1;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
o as inferEntrypoints
|
|
26
|
+
};
|