@arcgis/api-extractor 5.0.0-next.98 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/dist/ApiExtractor-DIxlsiLk.js +2664 -0
- package/dist/apiHelpers-BYzO767m.js +161 -0
- package/dist/apiJson.d.ts +706 -760
- package/dist/cli-7PX_wNxb.js +34 -0
- package/dist/cli.js +50 -7
- 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 +8 -5
- 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 +71 -56
- package/dist/diffTypes/index.d.ts +20 -23
- package/dist/diffTypes/index.js +4 -2
- package/dist/extractor/ApiExtractor.d.ts +64 -137
- package/dist/extractor/ApiExtractor.js +9 -0
- package/dist/extractor/config.d.ts +459 -39
- 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 -12
- package/dist/index.js +3 -837
- package/dist/typeScript-Dsim-EQC.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 +17 -0
- package/dist/utils/astHelpers.d.ts +22 -21
- package/dist/utils/astHelpers.js +67 -0
- package/dist/utils/createIndex.d.ts +30 -0
- package/dist/utils/createIndex.js +81 -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-1ouniZM0.js +3680 -0
- package/package.json +43 -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,34 @@
|
|
|
1
|
+
import { writeFile as r, readFile as d } from "node:fs/promises";
|
|
2
|
+
import { diffApiJson as m } from "./diff/diffApiJson.js";
|
|
3
|
+
async function k({
|
|
4
|
+
oldPath: t,
|
|
5
|
+
newPath: i,
|
|
6
|
+
outputPath: o,
|
|
7
|
+
docsUrlPrefix: e
|
|
8
|
+
}) {
|
|
9
|
+
const c = f(t), w = f(i), p = await c, l = await w, n = m(p, l);
|
|
10
|
+
if (typeof o == "string")
|
|
11
|
+
if (o.endsWith(".md")) {
|
|
12
|
+
const { apiDiffToMarkdown: s } = await import("./diff/apiDiffToMarkdown.js"), a = s(n, e);
|
|
13
|
+
await r(o, a, "utf-8");
|
|
14
|
+
} else
|
|
15
|
+
await r(o, JSON.stringify(n, null, 2), "utf-8");
|
|
16
|
+
else {
|
|
17
|
+
const { apiDiffToMarkdown: s } = await import("./diff/apiDiffToMarkdown.js"), a = s(n, e);
|
|
18
|
+
console.log(a);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function f(t) {
|
|
22
|
+
if (t.startsWith("http://") || t.startsWith("https://")) {
|
|
23
|
+
const i = await fetch(t);
|
|
24
|
+
if (!i.ok)
|
|
25
|
+
throw new Error(`Failed to fetch api.json: ${i.statusText}`);
|
|
26
|
+
return await i.json();
|
|
27
|
+
} else {
|
|
28
|
+
const i = await d(t, "utf-8");
|
|
29
|
+
return JSON.parse(i);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
k as diffApiCli
|
|
34
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,57 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { Command as c } from "@commander-js/extra-typings";
|
|
3
|
+
const o = new c();
|
|
4
|
+
o.name("api-extractor").description("Extract public API from a TypeScript project to produce .d.ts types and api.json docs");
|
|
5
|
+
o.command("run").description("Generate .d.ts types and api.json API reference for a project").option("--cwd <arcgis-js-api>", "Path to the root of the project (default: process.cwd())").option("--dts <outputDirectory>", "Destination for the .d.ts files (example: dist/)").option("--api-json <outputLocation>", "Destination for the api.json file (example: dist/docs/api.json)").option("--environment <environment>", "Environment to run in (production or development) (default: production)").option("--type-check", "Run full type checking before the extraction (default: false)").option("--verify", "Run type checker on the emitted types (default: false)").option("--watch", "Watch for file changes and re-run the extraction automatically", !1).option(
|
|
6
|
+
"--config <configPath>",
|
|
7
|
+
"Path to the ./api-extractor.config.ts file. The provided path will be used as is in import(). The config file should export a `config` object of type ApiExtractorConfig (default: api-extractor.config.ts in the cwd)"
|
|
8
|
+
).option(
|
|
9
|
+
"--silence-broken-links",
|
|
10
|
+
"(deprecated) Do not emit errors for broken @links in JSDoc comments. Temporary option for migration period (default: false)"
|
|
11
|
+
).action(async (t) => {
|
|
12
|
+
const { loadApiExtractorConfig: e, mergeApiExtractorConfigs: n } = await import("./extractor/config.js"), a = await e(t.cwd, t.config), r = n(a, {
|
|
13
|
+
context: {
|
|
14
|
+
dtsEmitPath: t.dts,
|
|
15
|
+
apiJsonEmitPath: t.apiJson,
|
|
16
|
+
environment: t.environment === "development" ? "development" : void 0,
|
|
17
|
+
cwd: t.cwd
|
|
18
|
+
},
|
|
19
|
+
types: {
|
|
20
|
+
fullTypeCheck: t.typeCheck
|
|
21
|
+
},
|
|
22
|
+
verify: {
|
|
23
|
+
typeCheckTypes: t.verify,
|
|
24
|
+
detectBrokenLinks: t.silenceBrokenLinks === !0 ? !1 : void 0
|
|
25
|
+
}
|
|
26
|
+
}), { ApiExtractor: p } = await import("./extractor/ApiExtractor.js"), i = new p(r);
|
|
27
|
+
t.watch ? await i.watch() : await i.run();
|
|
28
|
+
});
|
|
29
|
+
o.command("diff").description("Produce a diff of two api.json files").requiredOption(
|
|
30
|
+
"--old <string>",
|
|
31
|
+
"URL or file path to the old api.json file. Example: https://unpkg.com/@arcgis/map-components@latest/dist/docs/api.json"
|
|
32
|
+
).requiredOption(
|
|
33
|
+
"--new <string>",
|
|
34
|
+
"URL or file path to the new api.json file. Example: ./packages/map-packages/map-components/dist/docs/api.json"
|
|
35
|
+
).option("--output <path>", "Path to the output .md or .json file. If not provided, will print markdown to console").option(
|
|
36
|
+
"--docs-url-prefix <string>",
|
|
37
|
+
"Base URL for documentation links. Used only if output format is Markdown",
|
|
38
|
+
"https://developers.arcgis.com/javascript/latest/references/core/"
|
|
39
|
+
).action(async (t) => {
|
|
40
|
+
const { diffApiCli: e } = await import("./cli-7PX_wNxb.js");
|
|
41
|
+
await e({
|
|
42
|
+
oldPath: t.old,
|
|
43
|
+
newPath: t.new,
|
|
44
|
+
outputPath: t.output,
|
|
45
|
+
docsUrlPrefix: t.docsUrlPrefix
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
o.command("diff-types").description("Generate a types diff summary .md file").requiredOption("--original-dts <originalTypings>", "Path to the original types folder").requiredOption("--new-dts <newTypings>", "Path to the new types folder").option("--output-md <outputMd>", "Path to the output markdown file", "types-diff.md").option("--no-truncate", "Do not truncate output if it is longer than 1000 lines", !0).action(async (t) => {
|
|
49
|
+
const { diffTypes: e } = await import("./diffTypes/index.js");
|
|
50
|
+
await e({
|
|
8
51
|
originalDtsPath: t.originalDts,
|
|
9
52
|
newDtsPath: t.newDts,
|
|
10
53
|
outputMdPath: t.outputMd,
|
|
11
54
|
truncate: t.truncate
|
|
12
55
|
});
|
|
13
56
|
});
|
|
14
|
-
|
|
57
|
+
o.parse();
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* We try to keep public and private types close to keep the API more
|
|
3
|
+
* maintainable. However, occasionally we must diverge to hide some private
|
|
4
|
+
* details from the public API.
|
|
5
|
+
*
|
|
6
|
+
* Use this type helper when public TypeScript type must diverge from the
|
|
7
|
+
* private type.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* type ActionType = PublicApiNarrowType<
|
|
12
|
+
* "create" | "update" | "delete",
|
|
13
|
+
* "create" | "delete"
|
|
14
|
+
* >;
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* In private types, the 1st type parameter will be used for type checking,
|
|
18
|
+
* making the effective type `"create" | "update" | "delete"`.
|
|
19
|
+
*
|
|
20
|
+
* But in public `.d.ts` and public docs, the above will appear like this:
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* type ActionType = "create" | "delete";
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Remember that properties without `public` tag are not publicly exposed.
|
|
27
|
+
* Thus, in practice, `PublicApiNarrowType` is most commonly needed to hide
|
|
28
|
+
* private union members.
|
|
29
|
+
*
|
|
30
|
+
* To ensure public type does not get out of date, `PublicApiNarrowType`
|
|
31
|
+
* requires that the public type extends the private type (or in other words, a
|
|
32
|
+
* subset of the private type). If that restriction is too tight, use
|
|
33
|
+
* `PublicApiRelaxType` instead.
|
|
34
|
+
*/
|
|
35
|
+
export type PublicApiNarrowType<PrivateType, _PublicType extends PrivateType> = PrivateType;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Most of the time, when the public type must diverge from the private type,
|
|
39
|
+
* the public type is a subset of the private type - in such cases use
|
|
40
|
+
* `PublicApiNarrowType`.
|
|
41
|
+
*
|
|
42
|
+
* Occasionally, the public type may need to be a superset of the private type
|
|
43
|
+
* or even an unrelated type. For those cases, use `PublicApiRelaxType`.
|
|
44
|
+
*
|
|
45
|
+
* Keep usages of `PublicApiRelaxType` at minimum as it disables type
|
|
46
|
+
* checking between public and private types.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* type EditableLayers = FeatureLayer | ...;
|
|
51
|
+
* class MyClass {
|
|
52
|
+
* // Layer is a superset of EditableLayers, not subset,
|
|
53
|
+
* // so we must use PublicApiRelaxType.
|
|
54
|
+
* layer: PublicApiRelaxType<EditableLayers, Layer>;
|
|
55
|
+
*
|
|
56
|
+
* // StrictNumberType is a branded type that is incompatible
|
|
57
|
+
* // with regular number type.
|
|
58
|
+
* jobId: PublicApiRelaxType<StrictNumberType<"JobId">, number>;
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export type PublicApiRelaxType<PrivateType, _PublicType> = PrivateType;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { buildViewUrl as T } from "../extractor/processing/links.js";
|
|
2
|
+
function K({ modules: e }, t) {
|
|
3
|
+
const o = {
|
|
4
|
+
children: /* @__PURE__ */ new Map(),
|
|
5
|
+
members: []
|
|
6
|
+
};
|
|
7
|
+
for (let n = 0; n < e.length; ++n) {
|
|
8
|
+
const s = e[n], w = s.path.split("/");
|
|
9
|
+
let y = w;
|
|
10
|
+
const M = w.at(-1);
|
|
11
|
+
s.declarations.length === 1 && s.declarations[0].name === M && (y = w.slice(0, -1));
|
|
12
|
+
let U = o;
|
|
13
|
+
for (const g of y)
|
|
14
|
+
U = N(U, g);
|
|
15
|
+
for (let g = 0; g < s.declarations.length; ++g) {
|
|
16
|
+
const h = s.declarations[g], S = B(h), O = h.removed === !0 ? void 0 : $(t, s.path, h, void 0), k = j(h), x = { label: S, viewUrl: O, change: k }, d = h, m = [];
|
|
17
|
+
if (d.members !== void 0)
|
|
18
|
+
for (let l = 0; l < d.members.length; ++l) {
|
|
19
|
+
const a = d.members[l], f = p(a.kind, a);
|
|
20
|
+
if (f === void 0)
|
|
21
|
+
continue;
|
|
22
|
+
const v = F(a), r = a.removed === !0 ? void 0 : $(
|
|
23
|
+
t,
|
|
24
|
+
s.path,
|
|
25
|
+
h,
|
|
26
|
+
"name" in a ? a.name : `${h.name}Properties`
|
|
27
|
+
);
|
|
28
|
+
m.push({ label: v, viewUrl: r, change: f });
|
|
29
|
+
}
|
|
30
|
+
if (d.events !== void 0)
|
|
31
|
+
for (let l = 0; l < d.events.length; ++l) {
|
|
32
|
+
const a = d.events[l], f = p("event", a);
|
|
33
|
+
if (f === void 0)
|
|
34
|
+
continue;
|
|
35
|
+
const v = a.removed === !0 ? void 0 : $(t, s.path, h, `event-${a.name}`);
|
|
36
|
+
m.push({ label: `@${a.name}`, viewUrl: v, change: f });
|
|
37
|
+
}
|
|
38
|
+
if (typeof d.tagName == "string") {
|
|
39
|
+
const l = d.slots, a = d.cssParts, f = d.cssProperties, v = d.cssStates;
|
|
40
|
+
if (l !== void 0)
|
|
41
|
+
for (let r = 0; r < l.length; ++r) {
|
|
42
|
+
const i = l[r], u = p("slot", i);
|
|
43
|
+
if (u === void 0)
|
|
44
|
+
continue;
|
|
45
|
+
const b = i.removed === !0 ? void 0 : $(t, s.path, h, `slot-${i.name}`);
|
|
46
|
+
m.push({ label: i.name, viewUrl: b, change: u });
|
|
47
|
+
}
|
|
48
|
+
if (a !== void 0)
|
|
49
|
+
for (let r = 0; r < a.length; ++r) {
|
|
50
|
+
const i = a[r], u = p("css part", i);
|
|
51
|
+
if (u === void 0)
|
|
52
|
+
continue;
|
|
53
|
+
m.push({ label: i.name, viewUrl: void 0, change: u });
|
|
54
|
+
}
|
|
55
|
+
if (f !== void 0)
|
|
56
|
+
for (let r = 0; r < f.length; ++r) {
|
|
57
|
+
const i = f[r], u = p("css property", i);
|
|
58
|
+
if (u === void 0)
|
|
59
|
+
continue;
|
|
60
|
+
const b = i.removed === !0 ? void 0 : $(t, s.path, h, i.name);
|
|
61
|
+
m.push({ label: i.name, viewUrl: b, change: u });
|
|
62
|
+
}
|
|
63
|
+
if (v !== void 0)
|
|
64
|
+
for (let r = 0; r < v.length; ++r) {
|
|
65
|
+
const i = v[r], u = p("css state", i);
|
|
66
|
+
if (u === void 0)
|
|
67
|
+
continue;
|
|
68
|
+
m.push({ label: i.name, viewUrl: void 0, change: u });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
m.length > 0 ? E(U, x).members.push(...m) : k !== void 0 && U.members.push(x);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const c = [];
|
|
75
|
+
for (const n of o.children.values())
|
|
76
|
+
L(n, "", c);
|
|
77
|
+
return c.join(`
|
|
78
|
+
`);
|
|
79
|
+
}
|
|
80
|
+
function N(e, t) {
|
|
81
|
+
const o = e.children.get(t);
|
|
82
|
+
if (o !== void 0)
|
|
83
|
+
return o;
|
|
84
|
+
const c = { name: t, children: /* @__PURE__ */ new Map(), members: [], node: void 0 };
|
|
85
|
+
return e.children.set(t, c), c;
|
|
86
|
+
}
|
|
87
|
+
function j(e) {
|
|
88
|
+
const t = e.tagName !== void 0 ? "component" : e.kind === "interface" ? "type declaration" : e.kind;
|
|
89
|
+
return p(t, e);
|
|
90
|
+
}
|
|
91
|
+
function p(e, t) {
|
|
92
|
+
const { added: o, removed: c, deprecated: n } = t;
|
|
93
|
+
if (c) {
|
|
94
|
+
const s = `**removed** ${e}`;
|
|
95
|
+
return typeof n == "string" ? `${s} - deprecated ${D(n)}` : s;
|
|
96
|
+
}
|
|
97
|
+
if (n)
|
|
98
|
+
return typeof n == "string" ? `**deprecated** ${e} ${D(n)}` : `**deprecated** ${e}`;
|
|
99
|
+
if (o)
|
|
100
|
+
return `**added** ${e}`;
|
|
101
|
+
}
|
|
102
|
+
function B(e) {
|
|
103
|
+
const t = e.tagName;
|
|
104
|
+
return typeof t == "string" && t.length > 0 ? t : C(e.name) + (e.kind === "function" ? "()" : "");
|
|
105
|
+
}
|
|
106
|
+
function $(e, t, o, c) {
|
|
107
|
+
const n = `${e}${t}/`;
|
|
108
|
+
return T(n, o.kind === "class" ? void 0 : o.name, c);
|
|
109
|
+
}
|
|
110
|
+
function E(e, t) {
|
|
111
|
+
const o = N(e, t.label);
|
|
112
|
+
return o.node = t, o;
|
|
113
|
+
}
|
|
114
|
+
function F(e) {
|
|
115
|
+
return e.kind === "constructor" ? "constructor" : e.kind === "call-signature" ? "call signature" : e.kind === "method" ? `${C(e.name)}()` : C(e.name);
|
|
116
|
+
}
|
|
117
|
+
function C(e) {
|
|
118
|
+
return e.replace(/[\\\[\]\(\)]/gu, "\\$&");
|
|
119
|
+
}
|
|
120
|
+
function D(e) {
|
|
121
|
+
return e.split(`
|
|
122
|
+
`)[0];
|
|
123
|
+
}
|
|
124
|
+
function L(e, t, o) {
|
|
125
|
+
if (e.node) {
|
|
126
|
+
const n = e.node.viewUrl === void 0 ? e.node.label : `[${e.node.label}](${e.node.viewUrl})`;
|
|
127
|
+
e.node.change ? o.push(`${t}- ${n} - ${e.node.change}`) : o.push(`${t}- ${n}`);
|
|
128
|
+
} else
|
|
129
|
+
o.push(`${t}- ${e.name}/`);
|
|
130
|
+
const c = `${t} `;
|
|
131
|
+
for (const n of e.members) {
|
|
132
|
+
const s = n.viewUrl === void 0 ? n.label : `[${n.label}](${n.viewUrl})`;
|
|
133
|
+
n.change ? o.push(`${c}- ${s} - ${n.change}`) : o.push(`${c}- ${s}`);
|
|
134
|
+
}
|
|
135
|
+
for (const n of e.children.values())
|
|
136
|
+
L(n, c, o);
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
K as apiDiffToMarkdown
|
|
140
|
+
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { ApiJson } from
|
|
2
|
-
import { ApiDiff } from
|
|
1
|
+
import type { ApiJson, ApiJsonCompiler } from "../apiJson.js";
|
|
2
|
+
import type { ApiDiff } from "./types.js";
|
|
3
|
+
|
|
3
4
|
/**
|
|
5
|
+
* @param oldApiJson
|
|
6
|
+
* @param newApiJson
|
|
4
7
|
* @example
|
|
5
8
|
* ```js
|
|
6
|
-
* import { diffApiJson
|
|
7
|
-
* import {
|
|
9
|
+
* import { diffApiJson } from "@arcgis/api-extractor/diff/diffApiJson";
|
|
10
|
+
* import { fetchApiJsonFromNpm } from "@arcgis/api-extractor/diff/fetchApiJsonFromNpm";
|
|
8
11
|
*
|
|
9
12
|
* // Read -next api.json from file system:
|
|
10
13
|
* const apiJson = JSON.parse(
|
|
@@ -20,4 +23,4 @@ import { ApiDiff } from './types.ts';
|
|
|
20
23
|
* writeFileSync("api-diff.json", JSON.stringify(diff, null, 2));
|
|
21
24
|
* ```
|
|
22
25
|
*/
|
|
23
|
-
export
|
|
26
|
+
export function diffApiJson(oldApiJson: Pick<ApiJson, "modules"> & { compiler?: ApiJsonCompiler; }, newApiJson: Pick<ApiJson, "modules"> & { compiler?: ApiJsonCompiler; }): ApiDiff;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
function w(n, s) {
|
|
2
|
+
if (n.compiler?.name !== "@arcgis/core:manual" || n.compiler?.version !== "4.34")
|
|
3
|
+
return;
|
|
4
|
+
const o = {};
|
|
5
|
+
return n.modules.forEach((e) => {
|
|
6
|
+
o[e.path] = e;
|
|
7
|
+
}), {
|
|
8
|
+
...s,
|
|
9
|
+
modules: s.modules.filter((e) => {
|
|
10
|
+
const r = o[e.path];
|
|
11
|
+
return e.declarations = e.declarations.filter((a) => {
|
|
12
|
+
if (a.kind === "mixin")
|
|
13
|
+
return !1;
|
|
14
|
+
if (a.kind === "interface") {
|
|
15
|
+
const i = r?.declarations.find(
|
|
16
|
+
(d) => d.name === a.name && d.kind === "interface"
|
|
17
|
+
);
|
|
18
|
+
return a.members = void 0, i !== void 0;
|
|
19
|
+
}
|
|
20
|
+
return !0;
|
|
21
|
+
}), e.declarations.length > 0;
|
|
22
|
+
})
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function A(n) {
|
|
26
|
+
const s = /* @__PURE__ */ new Set([
|
|
27
|
+
// Fake class turned into a variable
|
|
28
|
+
"config",
|
|
29
|
+
// Wasn't visible directly before due to doc mismatch
|
|
30
|
+
"identity/IdentityManagerBase",
|
|
31
|
+
// Fake class turned into a variable
|
|
32
|
+
"identity/IdentityManager",
|
|
33
|
+
// Fake class turned into an interface
|
|
34
|
+
"views/layers/GeoRSSLayerView",
|
|
35
|
+
"views/layers/GraphicsLayerView",
|
|
36
|
+
"views/layers/KMLLayerView",
|
|
37
|
+
"views/layers/VectorTileLayerView",
|
|
38
|
+
"views/layers/PointCloudLayerView",
|
|
39
|
+
// ENUM-like objects turned into const variable + interfaces
|
|
40
|
+
"layers/support/rasterFunctionConstants"
|
|
41
|
+
]), o = n.modules.filter((t) => s.has(t.path) ? !1 : (t.declarations = t.declarations.filter((e) => e.kind === "class" ? e.members === void 0 ? !0 : (e.members = e.members.filter((r) => !(r.kind === "constructor" || r.kind === "call-signature" || P.has(r.name))), e.members.length > 0) : !0), t.declarations.length > 0));
|
|
42
|
+
return { ...n, modules: o };
|
|
43
|
+
}
|
|
44
|
+
const P = /* @__PURE__ */ new Set([
|
|
45
|
+
// Excluded from api.json inheritance to keep file size in check
|
|
46
|
+
"addHandles",
|
|
47
|
+
"hasHandles",
|
|
48
|
+
"removeHandles",
|
|
49
|
+
// These are coming from mixins. Exclude them from the diff to reduce noise
|
|
50
|
+
// compared to more valuable new 5.0 fields.
|
|
51
|
+
// Added 77 times
|
|
52
|
+
"emit",
|
|
53
|
+
// 77
|
|
54
|
+
"hasEventListener",
|
|
55
|
+
// 73
|
|
56
|
+
"fromJSON",
|
|
57
|
+
// 72
|
|
58
|
+
"on",
|
|
59
|
+
// 71
|
|
60
|
+
"toJSON",
|
|
61
|
+
// 63
|
|
62
|
+
"declaredClass",
|
|
63
|
+
// 63
|
|
64
|
+
"getAtOrigin",
|
|
65
|
+
// 63
|
|
66
|
+
"originOf",
|
|
67
|
+
// 63
|
|
68
|
+
"revertAllToOrigin",
|
|
69
|
+
// 63
|
|
70
|
+
"revertToOrigin",
|
|
71
|
+
// 54
|
|
72
|
+
"clone",
|
|
73
|
+
// 50
|
|
74
|
+
"fromPortalItem",
|
|
75
|
+
// 49
|
|
76
|
+
"fromArcGISServerUrl",
|
|
77
|
+
// 28
|
|
78
|
+
"isFulfilled",
|
|
79
|
+
// 28
|
|
80
|
+
"isRejected",
|
|
81
|
+
// 28
|
|
82
|
+
"isResolved",
|
|
83
|
+
// 28
|
|
84
|
+
"when",
|
|
85
|
+
// 6
|
|
86
|
+
"cancelLoad",
|
|
87
|
+
// 6
|
|
88
|
+
"loadError",
|
|
89
|
+
// 6
|
|
90
|
+
"loadStatus",
|
|
91
|
+
// 6
|
|
92
|
+
"loadWarnings"
|
|
93
|
+
]);
|
|
94
|
+
function N(n, s) {
|
|
95
|
+
const o = w(n, s), t = o ?? s, e = n.compiler?.version.startsWith("4.") === !0 && t.compiler?.version.startsWith("4.") !== !0, r = new Map(
|
|
96
|
+
n.modules.map((d) => [
|
|
97
|
+
b(d, e),
|
|
98
|
+
d
|
|
99
|
+
])
|
|
100
|
+
), a = [];
|
|
101
|
+
for (const d of t.modules) {
|
|
102
|
+
const l = r.get(d.path), m = y(l, d, !0);
|
|
103
|
+
m !== void 0 && a.push(m), r.delete(d.path);
|
|
104
|
+
}
|
|
105
|
+
for (const d of r.values()) {
|
|
106
|
+
const l = y(
|
|
107
|
+
void 0,
|
|
108
|
+
e ? { ...d, path: b(d, e) } : d,
|
|
109
|
+
!1
|
|
110
|
+
);
|
|
111
|
+
l !== void 0 && a.push(l);
|
|
112
|
+
}
|
|
113
|
+
const i = { modules: a };
|
|
114
|
+
return o === void 0 ? i : A(i);
|
|
115
|
+
}
|
|
116
|
+
function b(n, s) {
|
|
117
|
+
return s ? n.declarations?.[0]?.importPath ?? n.path : n.path;
|
|
118
|
+
}
|
|
119
|
+
function y(n, s, o) {
|
|
120
|
+
const t = [], e = h(n?.declarations ?? []), r = h(s.declarations ?? []);
|
|
121
|
+
for (const a of r.values()) {
|
|
122
|
+
const i = a.at(-1), d = i.tagName, l = d ?? i.name, m = e.get(l);
|
|
123
|
+
e.delete(l);
|
|
124
|
+
const g = m === void 0 && !o ? !0 : void 0, f = (
|
|
125
|
+
// Only mark as deprecated if all overloads are deprecated
|
|
126
|
+
a.length === 1 || a.every((c) => c.deprecated !== void 0) ? i.deprecated : void 0
|
|
127
|
+
), k = !f && m === void 0 && o ? !0 : void 0;
|
|
128
|
+
if (g || k) {
|
|
129
|
+
t.push({
|
|
130
|
+
kind: i.kind,
|
|
131
|
+
name: i.name,
|
|
132
|
+
tagName: d,
|
|
133
|
+
members: void 0,
|
|
134
|
+
removed: g,
|
|
135
|
+
added: k,
|
|
136
|
+
deprecated: f
|
|
137
|
+
});
|
|
138
|
+
continue;
|
|
139
|
+
} else if (!o)
|
|
140
|
+
continue;
|
|
141
|
+
if (d !== void 0) {
|
|
142
|
+
const c = i, u = m?.[0], v = {
|
|
143
|
+
kind: c.kind,
|
|
144
|
+
name: c.name,
|
|
145
|
+
tagName: c.tagName,
|
|
146
|
+
deprecated: f,
|
|
147
|
+
added: void 0,
|
|
148
|
+
removed: void 0,
|
|
149
|
+
members: M(u?.members, c.members),
|
|
150
|
+
events: p(u?.events, c.events),
|
|
151
|
+
slots: p(u?.slots, c.slots),
|
|
152
|
+
cssParts: p(u?.cssParts, c.cssParts),
|
|
153
|
+
cssProperties: p(u?.cssProperties, c.cssProperties),
|
|
154
|
+
cssStates: p(u?.cssStates, c.cssStates)
|
|
155
|
+
};
|
|
156
|
+
(f !== void 0 || v.members !== void 0 || v.events !== void 0 || v.slots !== void 0 || v.cssParts !== void 0 || v.cssProperties !== void 0 || v.cssStates !== void 0) && t.push(v);
|
|
157
|
+
} else if (i.kind === "class" || i.kind === "interface" || i.kind === "mixin") {
|
|
158
|
+
const c = m?.[0], u = {
|
|
159
|
+
kind: i.kind,
|
|
160
|
+
name: i.name,
|
|
161
|
+
deprecated: f,
|
|
162
|
+
added: void 0,
|
|
163
|
+
removed: void 0,
|
|
164
|
+
members: M(c?.members, i.members),
|
|
165
|
+
events: "events" in i ? p(c?.events, i.events) : void 0
|
|
166
|
+
};
|
|
167
|
+
(f !== void 0 || u.members !== void 0 || u.events !== void 0) && t.push(u);
|
|
168
|
+
} else f !== void 0 && t.push({
|
|
169
|
+
kind: i.kind,
|
|
170
|
+
name: i.name,
|
|
171
|
+
deprecated: f,
|
|
172
|
+
added: void 0,
|
|
173
|
+
removed: void 0
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
if (o)
|
|
177
|
+
for (const [a] of e.values())
|
|
178
|
+
t.push({
|
|
179
|
+
kind: a.kind,
|
|
180
|
+
name: a.name,
|
|
181
|
+
tagName: a.tagName,
|
|
182
|
+
members: void 0,
|
|
183
|
+
removed: !0,
|
|
184
|
+
added: void 0,
|
|
185
|
+
deprecated: a.deprecated
|
|
186
|
+
});
|
|
187
|
+
if (t.length !== 0)
|
|
188
|
+
return {
|
|
189
|
+
path: s.path,
|
|
190
|
+
declarations: t
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function h(n) {
|
|
194
|
+
const s = /* @__PURE__ */ new Map();
|
|
195
|
+
for (let o = 0; o < n.length; ++o) {
|
|
196
|
+
const t = n[o], e = t.tagName ?? t.name ?? t.kind, r = s.get(e);
|
|
197
|
+
x(t.docsTags) || (r === void 0 ? s.set(e, [t]) : r.push(t));
|
|
198
|
+
}
|
|
199
|
+
return s;
|
|
200
|
+
}
|
|
201
|
+
function x(n) {
|
|
202
|
+
if (n !== void 0) {
|
|
203
|
+
for (let s = 0; s < n.length; ++s)
|
|
204
|
+
if (n[s].name === "internal")
|
|
205
|
+
return !0;
|
|
206
|
+
}
|
|
207
|
+
return !1;
|
|
208
|
+
}
|
|
209
|
+
function p(n, s) {
|
|
210
|
+
const o = h(n ?? []), t = [];
|
|
211
|
+
if (s !== void 0)
|
|
212
|
+
for (const e of s)
|
|
213
|
+
o.get(e.name) === void 0 ? t.push({
|
|
214
|
+
name: e.name,
|
|
215
|
+
added: !0
|
|
216
|
+
}) : e.deprecated && t.push({
|
|
217
|
+
name: e.name,
|
|
218
|
+
deprecated: e.deprecated
|
|
219
|
+
}), o.delete(e.name);
|
|
220
|
+
for (const [e] of o.values())
|
|
221
|
+
t.push({
|
|
222
|
+
name: e.name,
|
|
223
|
+
removed: !0,
|
|
224
|
+
deprecated: e.deprecated
|
|
225
|
+
});
|
|
226
|
+
return t.length ? t : void 0;
|
|
227
|
+
}
|
|
228
|
+
function M(n, s) {
|
|
229
|
+
const o = h(n ?? []), t = h(s ?? []), e = [];
|
|
230
|
+
for (const [r, a] of t.entries()) {
|
|
231
|
+
const i = a.at(-1), d = o.get(r);
|
|
232
|
+
o.delete(r);
|
|
233
|
+
const l = (
|
|
234
|
+
// Only mark as deprecated if all overloads are deprecated
|
|
235
|
+
a.length === 1 || a.every((g) => g.deprecated !== void 0) ? i.deprecated : void 0
|
|
236
|
+
), m = r === "constructor" || r === "call-signature" ? void 0 : r;
|
|
237
|
+
l ? e.push({
|
|
238
|
+
kind: i.kind,
|
|
239
|
+
name: m,
|
|
240
|
+
deprecated: l
|
|
241
|
+
}) : d === void 0 && e.push({
|
|
242
|
+
kind: i.kind,
|
|
243
|
+
name: m,
|
|
244
|
+
added: !0
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
for (const [r, [a]] of o.entries()) {
|
|
248
|
+
const i = r === "constructor" || r === "call-signature" ? void 0 : r;
|
|
249
|
+
e.push({
|
|
250
|
+
kind: a.kind,
|
|
251
|
+
name: i,
|
|
252
|
+
removed: !0,
|
|
253
|
+
deprecated: a.deprecated
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return e.length ? e : void 0;
|
|
257
|
+
}
|
|
258
|
+
export {
|
|
259
|
+
N as diffApiJson
|
|
260
|
+
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ApiJson } from
|
|
1
|
+
import type { ApiJson } from "../apiJson.js";
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* Read dist/docs/api.json for a given NPM package.
|
|
4
5
|
*
|
|
6
|
+
* @param packageName
|
|
7
|
+
* @param semverVersion
|
|
5
8
|
* @example fetchApiJsonFromNpm("@arcgis/map-components", "latest");
|
|
6
9
|
*/
|
|
7
|
-
export
|
|
10
|
+
export function fetchApiJsonFromNpm(packageName: string, semverVersion: string): Promise<ApiJson>;
|