@arcgis/api-extractor 5.1.0-next.3 → 5.1.0-next.30
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-CrpDQ5W0.js → ApiExtractor-BgMBwjdY.js} +44 -41
- package/dist/{apiHelpers-BYzO767m.js → apiHelpers-DWMIGwi4.js} +3 -3
- package/dist/apiJson.d.ts +7 -0
- package/dist/cli-7PX_wNxb.js +34 -0
- package/dist/cli.js +29 -10
- package/dist/diff/apiDiffToMarkdown.d.ts +9 -0
- package/dist/diff/apiDiffToMarkdown.js +140 -0
- package/dist/diff/diffApiJson.d.ts +4 -4
- package/dist/diff/diffApiJson.js +220 -97
- package/dist/diff/types.d.ts +3 -2
- package/dist/extractor/ApiExtractor.js +3 -3
- package/dist/extractor/config.js +3 -3
- package/dist/extractor/processing/links.js +1 -1
- package/dist/{typeScript-BssxHUy7.js → typeScript-Cp7xTsD-.js} +1 -1
- package/dist/utils/apiHelpers.js +1 -1
- package/dist/utils/createIndex.d.ts +1 -1
- package/dist/utils/createIndex.js +46 -45
- package/dist/vite/plugin.js +3 -3
- package/dist/vite/typeScript.js +1 -1
- package/dist/{worker-BzfmcnyC.js → worker-fSgFrme6.js} +465 -460
- package/package.json +7 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as H, a as se, e as Re, p as fe } from "./typeScript-
|
|
2
|
-
import { a as be, o as Me, t as Ge, b as De, c as Le, e as Oe,
|
|
1
|
+
import { l as H, a as se, e as Re, p as fe } from "./typeScript-Cp7xTsD-.js";
|
|
2
|
+
import { a as be, o as Me, t as Ge, b as De, c as Le, e as Oe, p as Ne, d as Be, f as _, i as me, g as We, h as Ue, j as ze, k as je, n as He, r as Je } from "./worker-fSgFrme6.js";
|
|
3
3
|
import { getViewUrl as Ve, postProcessDeprecated as ee, postProcessDescription as G, postProcessDocsTags as V, resolveJsDocLink as Xe } from "./extractor/processing/links.js";
|
|
4
4
|
import E from "typescript";
|
|
5
5
|
import { path as N, toPosixPathSeparators as Ye } from "@arcgis/components-build-utils";
|
|
@@ -7,7 +7,7 @@ import { mkdir as ae, writeFile as xe } from "fs/promises";
|
|
|
7
7
|
import x from "chalk";
|
|
8
8
|
import { styleText as qe } from "util";
|
|
9
9
|
import { kebabToPascal as Ze } from "@arcgis/toolkit/string";
|
|
10
|
-
import { g as h, a as Q, b as _e, c as Ke, d as le, e as Pe, f as oe, p as Qe, h as et, i as ce, m as Ie, n as tt, j as it, k as nt } from "./apiHelpers-
|
|
10
|
+
import { g as h, a as Q, b as _e, c as Ke, d as le, e as Pe, f as oe, p as Qe, h as et, i as ce, m as Ie, n as tt, j as it, k as nt } from "./apiHelpers-DWMIGwi4.js";
|
|
11
11
|
import { printTypeParameters as ie, printTypeAlias as ot } from "./utils/partPrinter.js";
|
|
12
12
|
import { identity as Se, debounce as rt } from "@arcgis/toolkit/function";
|
|
13
13
|
import { opendirSync as st, watch as at, readFileSync as lt, statSync as ct } from "node:fs";
|
|
@@ -1101,12 +1101,12 @@ function mt(e, t) {
|
|
|
1101
1101
|
const s = e.exports?.[0]?.declaration.name, a = h(e);
|
|
1102
1102
|
if (a.constructorPropertiesInterface !== void 0) {
|
|
1103
1103
|
const o = a.constructorPropertiesInterface;
|
|
1104
|
-
ue(o),
|
|
1104
|
+
ue(o), A.length !== 0 && (n += pe(o, U, o.name, t));
|
|
1105
1105
|
}
|
|
1106
1106
|
let r;
|
|
1107
1107
|
for (let o = 0; o < e.declarations.length; ++o) {
|
|
1108
1108
|
const l = e.declarations[o];
|
|
1109
|
-
if (ue(l),
|
|
1109
|
+
if (ue(l), A.length === 0)
|
|
1110
1110
|
continue;
|
|
1111
1111
|
const c = l.name === s, d = c ? "default" : l.name, m = l.kind === "function", f = l.kind === "variable";
|
|
1112
1112
|
if (m || f) {
|
|
@@ -1114,10 +1114,10 @@ function mt(e, t) {
|
|
|
1114
1114
|
if (l.name === r)
|
|
1115
1115
|
continue;
|
|
1116
1116
|
if (r = l.name, c) {
|
|
1117
|
-
|
|
1117
|
+
A.length !== 1 && t.emitError("Expected only a single @esriCompatibilityName tag on a default export function.", {
|
|
1118
1118
|
file: h(e).file,
|
|
1119
1119
|
node: void 0
|
|
1120
|
-
}), Z(
|
|
1120
|
+
}), Z(A[0], t), D === void 0 && t.emitError("Expected default export @esriCompatibilityName tag to include a #", {
|
|
1121
1121
|
file: h(e).file,
|
|
1122
1122
|
node: void 0
|
|
1123
1123
|
}), n += ` ${k}
|
|
@@ -1132,10 +1132,10 @@ function mt(e, t) {
|
|
|
1132
1132
|
continue;
|
|
1133
1133
|
}
|
|
1134
1134
|
} else if (f && c) {
|
|
1135
|
-
|
|
1135
|
+
A.length !== 1 && t.emitError("Expected only a single @esriCompatibilityName tag on a default export variable.", {
|
|
1136
1136
|
file: h(e).file,
|
|
1137
1137
|
node: void 0
|
|
1138
|
-
}), Z(
|
|
1138
|
+
}), Z(A[0], t), (D !== void 0 || B !== void 0) && t.emitError("Expected default export @esriCompatibilityName tag to not include a # or .", {
|
|
1139
1139
|
file: h(e).file,
|
|
1140
1140
|
node: void 0
|
|
1141
1141
|
}), n += ` export const ${O}: typeof ${i}.default;
|
|
@@ -1143,14 +1143,14 @@ function mt(e, t) {
|
|
|
1143
1143
|
`;
|
|
1144
1144
|
continue;
|
|
1145
1145
|
}
|
|
1146
|
-
for (let p = 0; p <
|
|
1147
|
-
Z(
|
|
1146
|
+
for (let p = 0; p < A.length; ++p)
|
|
1147
|
+
Z(A[p], t), f && z !== void 0 ? q += ` export const ${O}: ${i}.${d};
|
|
1148
1148
|
` : te += ` ${O}: typeof ${i}.${d};
|
|
1149
1149
|
`;
|
|
1150
1150
|
} else if (l.kind === "class" || l.kind === "mixin" || l.kind === "interface" && Q(l).isMixinBaseClass === !0) {
|
|
1151
1151
|
const p = ie(K(l.typeParameters, !1, U)), g = ie(K(l.typeParameters, !1, void 0)), u = ie(K(l.typeParameters, !0, void 0)), v = ` ${i}.${d}`;
|
|
1152
|
-
for (let C = 0; C <
|
|
1153
|
-
if (Z(
|
|
1152
|
+
for (let C = 0; C < A.length; ++C) {
|
|
1153
|
+
if (Z(A[C], t), O.startsWith("$")) {
|
|
1154
1154
|
const M = O.slice(1);
|
|
1155
1155
|
n += pt(M, l, d, U);
|
|
1156
1156
|
continue;
|
|
@@ -1188,8 +1188,8 @@ ${te} }
|
|
|
1188
1188
|
function pe(e, t, i, n) {
|
|
1189
1189
|
const s = ie(K(e.typeParameters, !1, void 0)), a = K(e.typeParameters, !1, t), r = `import("./${t}.js").${i}${s}`;
|
|
1190
1190
|
let o = "";
|
|
1191
|
-
for (let l = 0; l <
|
|
1192
|
-
Z(
|
|
1191
|
+
for (let l = 0; l < A.length; ++l) {
|
|
1192
|
+
Z(A[l], n);
|
|
1193
1193
|
const c = ot(O, a, void 0, r);
|
|
1194
1194
|
B === void 0 ? o += ` ${k}
|
|
1195
1195
|
${c}
|
|
@@ -1243,9 +1243,9 @@ function K(e, t, i) {
|
|
|
1243
1243
|
return n.length === 0 ? void 0 : n;
|
|
1244
1244
|
}
|
|
1245
1245
|
const ne = [];
|
|
1246
|
-
let
|
|
1246
|
+
let A = ne;
|
|
1247
1247
|
function ue(e) {
|
|
1248
|
-
e.kind === "variable" ?
|
|
1248
|
+
e.kind === "variable" ? A = _e(e).esriCompatibilityNames ?? ne : e.kind === "function" ? A = Ke(e).esriCompatibilityNames ?? ne : A = Q(e).esriCompatibilityNames ?? ne;
|
|
1249
1249
|
}
|
|
1250
1250
|
function Z(e, t) {
|
|
1251
1251
|
const i = e.indexOf(".");
|
|
@@ -1276,7 +1276,7 @@ function Z(e, t) {
|
|
|
1276
1276
|
}
|
|
1277
1277
|
function pt(e, t, i, n) {
|
|
1278
1278
|
const s = ut(e, t.events), r = `${// IdentityManager fake class got renamed to IdentityManagerBase real class
|
|
1279
|
-
t.name.startsWith(
|
|
1279
|
+
t.name.startsWith(A[0]) ? A[0] : t.name}${Ze(e)}Event`, o = yt(s, n) ?? ` = import("./${n}.js").${i}["@eventTypes"]["${e}"]`, l = o.startsWith("<") ? o.indexOf(">") + 1 : -1, c = l !== -1 ? o.slice(0, l) : "";
|
|
1280
1280
|
return ` ${k}
|
|
1281
1281
|
export type ${r}${o};
|
|
1282
1282
|
${k}
|
|
@@ -1734,7 +1734,10 @@ function xt(e, t) {
|
|
|
1734
1734
|
function he(e, t, i) {
|
|
1735
1735
|
if (e.package !== void 0)
|
|
1736
1736
|
return;
|
|
1737
|
-
const n = t.moduleMap.get(e.module)
|
|
1737
|
+
const n = t.moduleMap.get(e.module);
|
|
1738
|
+
if (n === void 0)
|
|
1739
|
+
return;
|
|
1740
|
+
const s = h(n), a = s.constructorPropertiesInterface;
|
|
1738
1741
|
if (a === void 0) {
|
|
1739
1742
|
const o = s.inheritance;
|
|
1740
1743
|
if (typeof o == "object" && o.hasSettableField) {
|
|
@@ -1899,7 +1902,7 @@ function Fe(e, t, i, n, s) {
|
|
|
1899
1902
|
Fe(c, t, l, n, s);
|
|
1900
1903
|
}
|
|
1901
1904
|
}
|
|
1902
|
-
function
|
|
1905
|
+
function Ae(e, t, i) {
|
|
1903
1906
|
const n = h(e);
|
|
1904
1907
|
if (n.inheritance !== void 0)
|
|
1905
1908
|
return;
|
|
@@ -1999,7 +2002,7 @@ function ge(e, t, i, n) {
|
|
|
1999
2002
|
a.cssStates,
|
|
2000
2003
|
s.cssStates,
|
|
2001
2004
|
e.indexedCssStates
|
|
2002
|
-
));
|
|
2005
|
+
)), s.formAssociated === !0 && (a.formAssociated = !0);
|
|
2003
2006
|
}
|
|
2004
2007
|
function X(e = [], t, i, n) {
|
|
2005
2008
|
const s = /* @__PURE__ */ new Set();
|
|
@@ -2020,7 +2023,7 @@ function ve(e, t, i) {
|
|
|
2020
2023
|
if (s === !1 || n === void 0)
|
|
2021
2024
|
return a !== void 0 ? a.inheritance = de.skip : t && i.privateMixinModuleNames.add(e), de.skip;
|
|
2022
2025
|
const [r, o] = s, l = o;
|
|
2023
|
-
|
|
2026
|
+
Ae(n, o, i);
|
|
2024
2027
|
let c, d = !1;
|
|
2025
2028
|
if (o.members !== void 0) {
|
|
2026
2029
|
c = /* @__PURE__ */ Object.create(null);
|
|
@@ -2118,7 +2121,7 @@ function Ft(e, t) {
|
|
|
2118
2121
|
file: h(n).file,
|
|
2119
2122
|
node: void 0
|
|
2120
2123
|
}
|
|
2121
|
-
), "members" in o && o.kind !== "interface" && (
|
|
2124
|
+
), "members" in o && o.kind !== "interface" && (Ae(n, o, t), o.events?.sort(it));
|
|
2122
2125
|
}
|
|
2123
2126
|
}
|
|
2124
2127
|
for (let i = 0; i < e.length; ++i) {
|
|
@@ -2200,7 +2203,7 @@ function Ft(e, t) {
|
|
|
2200
2203
|
s.constructorPropertiesInterface !== void 0 && xt(s, t), gt(n, s, t), Tt(n, s, t);
|
|
2201
2204
|
}
|
|
2202
2205
|
}
|
|
2203
|
-
const
|
|
2206
|
+
const At = async function() {
|
|
2204
2207
|
if (this.isRunInProgress)
|
|
2205
2208
|
throw Error(
|
|
2206
2209
|
"The ApiExtractor.run() is already in progress, or previous run crashed with unrecoverable error. Await the previous run first or create a new ApiExtractor"
|
|
@@ -2223,7 +2226,7 @@ const wt = async function() {
|
|
|
2223
2226
|
});
|
|
2224
2227
|
this.program = d, e.types.typeScriptInstanceCreated(d, c);
|
|
2225
2228
|
}
|
|
2226
|
-
|
|
2229
|
+
we(this, o);
|
|
2227
2230
|
}
|
|
2228
2231
|
const n = _(), s = await Oe(this);
|
|
2229
2232
|
$t(s, this);
|
|
@@ -2265,7 +2268,7 @@ const wt = async function() {
|
|
|
2265
2268
|
for (const [c, d] of this.dtsFiles)
|
|
2266
2269
|
l.get(c) !== d && this.changedDtsFiles.set(c, d);
|
|
2267
2270
|
if (t) {
|
|
2268
|
-
await i, await ae(e.context.dtsEmitPath, { recursive: !0 }), await
|
|
2271
|
+
await i, await ae(e.context.dtsEmitPath, { recursive: !0 }), await wt(e.context.dtsEmitPath, !0, this.changedDtsFiles ?? this.dtsFiles);
|
|
2269
2272
|
const c = N.join(N.relative(process.cwd(), e.context.dtsEmitPath), "/");
|
|
2270
2273
|
e.context.logger.info(
|
|
2271
2274
|
`${H}Wrote ${c}**/*${x.blue(".d.ts")} in ${x.green(`${o()}s`)}`
|
|
@@ -2285,7 +2288,7 @@ const wt = async function() {
|
|
|
2285
2288
|
`${H}${x.red(`Found ${this.errorCount} ${this.errorCount === 1 ? "error" : "errors"}`)}`
|
|
2286
2289
|
), this.silencedBrokenLinkCount > 0 && e.context.logger.info(`${H}Silenced ${this.silencedBrokenLinkCount} broken link errors.`), this.isRunInProgress = !1, this.produceDts && (r.dtsFiles = this.dtsFiles), r;
|
|
2287
2290
|
};
|
|
2288
|
-
async function
|
|
2291
|
+
async function wt(e, t, i) {
|
|
2289
2292
|
const n = /* @__PURE__ */ new Set(), s = Array.from(i.entries());
|
|
2290
2293
|
for (let l = 0; l < s.length; ++l) {
|
|
2291
2294
|
const [c, d] = s[l];
|
|
@@ -2309,7 +2312,7 @@ async function At(e, t, i) {
|
|
|
2309
2312
|
}
|
|
2310
2313
|
await Promise.all(r);
|
|
2311
2314
|
}
|
|
2312
|
-
function
|
|
2315
|
+
function we(e, t) {
|
|
2313
2316
|
if (e.config.types.fullTypeCheck)
|
|
2314
2317
|
if ("getSemanticDiagnostics" in e.program) {
|
|
2315
2318
|
const i = e.builderProgram === void 0 ? E.getPreEmitDiagnostics(e.program) : e.builderProgram.getSemanticDiagnostics();
|
|
@@ -2414,13 +2417,13 @@ const Rt = async function() {
|
|
|
2414
2417
|
if (e.types.typeCheckedExtraction || e.types.fullTypeCheck) {
|
|
2415
2418
|
const u = e.types.fullTypeCheck ? E.createSemanticDiagnosticsBuilderProgram : E.createAbstractBuilder;
|
|
2416
2419
|
let v;
|
|
2417
|
-
const C = (S, F, T, ...
|
|
2420
|
+
const C = (S, F, T, ...w) => (v = T, u(
|
|
2418
2421
|
// If not doing full type check, don't scout test files
|
|
2419
2422
|
// If non-tests import tests, they will be included implicitly anyway
|
|
2420
2423
|
e.types.fullTypeCheck ? S : S?.filter(($) => !ze($)),
|
|
2421
2424
|
F,
|
|
2422
2425
|
T,
|
|
2423
|
-
...
|
|
2426
|
+
...w
|
|
2424
2427
|
// Type cast to keep types simpler&aligned between two branches
|
|
2425
2428
|
)), y = E.createWatchCompilerHost(
|
|
2426
2429
|
// This parses the config file again (we already do it) and computes the
|
|
@@ -2458,17 +2461,17 @@ const Rt = async function() {
|
|
|
2458
2461
|
e.types.typeScriptInstanceCreated(F, v);
|
|
2459
2462
|
for (const $ of this.watchFiles.values())
|
|
2460
2463
|
$.wasRemoved = !0;
|
|
2461
|
-
let
|
|
2464
|
+
let w = !1;
|
|
2462
2465
|
for (let $ = 0; $ < T.length; ++$) {
|
|
2463
2466
|
const R = T[$];
|
|
2464
2467
|
if (!me(R.fileName, this))
|
|
2465
2468
|
continue;
|
|
2466
2469
|
const j = R.fileName.slice(e.context.cwd.length), J = this.watchFiles.get(j);
|
|
2467
|
-
J === void 0 ? (o(j, R, void 0),
|
|
2470
|
+
J === void 0 ? (o(j, R, void 0), w = !0) : J.file !== R ? (s(J, j, R), w = !0) : J.wasRemoved = !1;
|
|
2468
2471
|
}
|
|
2469
2472
|
for (const [$, R] of this.watchFiles)
|
|
2470
|
-
R.wasRemoved && (a(R, $),
|
|
2471
|
-
|
|
2473
|
+
R.wasRemoved && (a(R, $), w = !0);
|
|
2474
|
+
w ? p() : (we(this, _()), f(void 0));
|
|
2472
2475
|
}, t = E.createWatchProgram(y);
|
|
2473
2476
|
} else {
|
|
2474
2477
|
let u = function(y) {
|
|
@@ -2486,7 +2489,7 @@ const Rt = async function() {
|
|
|
2486
2489
|
if (I || P === void 0) {
|
|
2487
2490
|
const S = u(b);
|
|
2488
2491
|
if (S === !1) {
|
|
2489
|
-
let T,
|
|
2492
|
+
let T, w = !1;
|
|
2490
2493
|
try {
|
|
2491
2494
|
T = st(b, { recursive: !0 });
|
|
2492
2495
|
let $;
|
|
@@ -2494,12 +2497,12 @@ const Rt = async function() {
|
|
|
2494
2497
|
if ($.isDirectory())
|
|
2495
2498
|
continue;
|
|
2496
2499
|
const j = `${$.parentPath}/${$.name}`.slice(e.context.cwd.length);
|
|
2497
|
-
We(j) && (
|
|
2500
|
+
We(j) && (w = C(j, !1) || w);
|
|
2498
2501
|
}
|
|
2499
2502
|
} finally {
|
|
2500
2503
|
T?.closeSync();
|
|
2501
2504
|
}
|
|
2502
|
-
return
|
|
2505
|
+
return w;
|
|
2503
2506
|
}
|
|
2504
2507
|
const F = S === !0;
|
|
2505
2508
|
if (L) {
|
|
@@ -2514,9 +2517,9 @@ const Rt = async function() {
|
|
|
2514
2517
|
return o(y, void 0, void 0), !0;
|
|
2515
2518
|
{
|
|
2516
2519
|
let T = !1;
|
|
2517
|
-
const
|
|
2520
|
+
const w = `${y}/`;
|
|
2518
2521
|
for (const [$, R] of this.watchFiles)
|
|
2519
|
-
$.startsWith(
|
|
2522
|
+
$.startsWith(w) && (a(R, $), T = !0);
|
|
2520
2523
|
return T;
|
|
2521
2524
|
}
|
|
2522
2525
|
}
|
|
@@ -2625,7 +2628,7 @@ class qt {
|
|
|
2625
2628
|
* @param rawConfig Optional configuration for the extractor.
|
|
2626
2629
|
*/
|
|
2627
2630
|
constructor(t = {}) {
|
|
2628
|
-
this.componentStories = /* @__PURE__ */ Object.create(null), this.dtsFiles = /* @__PURE__ */ new Map(), this.changedDtsFiles = void 0, this.isRunInProgress = !1, this.watchFiles = void 0, this.program = void 0, this.builderProgram = void 0, this.componentPathMapping = void 0, this.componentCssFileDocs = void 0, this.vanillaComponentTypes = void 0, this.isInLuminaMinimalExtraction = !1, this.errorCount = 0, this.silencedBrokenLinkCount = 0, this.loggedBooleanWarning = !1, this.moduleMap = void 0, this.privateMixinModuleNames = /* @__PURE__ */ new Set(), this.implicitPublicModules = void 0, this.file = void 0, this.apiModule = void 0, this.componentTagName = void 0, this.pairedSetter = void 0, this.statementJsDocs = [], this.jsDoc = void 0, this.apiObject = void 0, this.moduleContext = void 0, this.localDeclarations = /* @__PURE__ */ new Set(), this.exportDefaultName = void 0, this.objectLikeTypeParameters = void 0, this.functionLikeTypeParameters = void 0, this.apiClassLikeName = void 0, this.mixinName = void 0, this.mixinMixins = void 0, this.moduleHasAccessorLikeClass = !1, this.moduleHasClass = !1, this.inheritedModuleName = void 0, this.run =
|
|
2631
|
+
this.componentStories = /* @__PURE__ */ Object.create(null), this.dtsFiles = /* @__PURE__ */ new Map(), this.changedDtsFiles = void 0, this.isRunInProgress = !1, this.watchFiles = void 0, this.program = void 0, this.builderProgram = void 0, this.componentPathMapping = void 0, this.componentCssFileDocs = void 0, this.vanillaComponentTypes = void 0, this.isInLuminaMinimalExtraction = !1, this.errorCount = 0, this.silencedBrokenLinkCount = 0, this.loggedBooleanWarning = !1, this.moduleMap = void 0, this.privateMixinModuleNames = /* @__PURE__ */ new Set(), this.implicitPublicModules = void 0, this.file = void 0, this.apiModule = void 0, this.componentTagName = void 0, this.pairedSetter = void 0, this.statementJsDocs = [], this.jsDoc = void 0, this.apiObject = void 0, this.moduleContext = void 0, this.localDeclarations = /* @__PURE__ */ new Set(), this.exportDefaultName = void 0, this.objectLikeTypeParameters = void 0, this.functionLikeTypeParameters = void 0, this.apiClassLikeName = void 0, this.mixinName = void 0, this.mixinMixins = void 0, this.moduleHasAccessorLikeClass = !1, this.moduleHasClass = !1, this.inheritedModuleName = void 0, this.run = At.bind(this), this.watch = Rt.bind(this), this.emitError = Re.bind(this);
|
|
2629
2632
|
const i = Je(t);
|
|
2630
2633
|
this.config = i, this.produceDts = i.types.forceProduceDts || i.context.dtsEmitPath !== "" || i.verify.typeCheckTypes, this.basePath = `${i.context.cwd}${i.context.basePath}`, this.normalizedApiReferencePrefix = `https://${this.config.documentation.host}${this.config.documentation.basePath}`, this.runtimeDependencyNames = /* @__PURE__ */ new Set([
|
|
2631
2634
|
...Object.keys(i.context.packageJson.dependencies ?? {}),
|
|
@@ -2657,5 +2660,5 @@ class qt {
|
|
|
2657
2660
|
}
|
|
2658
2661
|
export {
|
|
2659
2662
|
qt as A,
|
|
2660
|
-
|
|
2663
|
+
wt as w
|
|
2661
2664
|
};
|
package/dist/apiJson.d.ts
CHANGED
|
@@ -328,6 +328,13 @@ export interface ApiCustomElementDeclaration extends ApiClassDeclaration, ApiWit
|
|
|
328
328
|
* @example "ArcgisCounter" (even if class name is `Counter`)
|
|
329
329
|
*/
|
|
330
330
|
pascalCaseName: string;
|
|
331
|
+
/**
|
|
332
|
+
* True if the custom element is
|
|
333
|
+
* [form-associated](https://html.spec.whatwg.org/dev/custom-elements.html).
|
|
334
|
+
*
|
|
335
|
+
* @default false
|
|
336
|
+
*/
|
|
337
|
+
formAssociated?: boolean;
|
|
331
338
|
members: ApiCustomElementMember[];
|
|
332
339
|
/**
|
|
333
340
|
* The attributes that this element is known to understand.
|
|
@@ -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,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
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
6
|
"--config <configPath>",
|
|
7
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
8
|
).option(
|
|
9
9
|
"--silence-broken-links",
|
|
10
10
|
"(deprecated) Do not emit errors for broken @links in JSDoc comments. Temporary option for migration period (default: false)"
|
|
11
11
|
).action(async (t) => {
|
|
12
|
-
const { loadApiExtractorConfig:
|
|
12
|
+
const { loadApiExtractorConfig: e, mergeApiExtractorConfigs: n } = await import("./extractor/config.js"), a = await e(t.cwd, t.config), r = n(a, {
|
|
13
13
|
context: {
|
|
14
14
|
dtsEmitPath: t.dts,
|
|
15
15
|
apiJsonEmitPath: t.apiJson,
|
|
@@ -23,16 +23,35 @@ e.command("run").description("Generate .d.ts types and api.json API reference fo
|
|
|
23
23
|
typeCheckTypes: t.verify,
|
|
24
24
|
detectBrokenLinks: t.silenceBrokenLinks === !0 ? !1 : void 0
|
|
25
25
|
}
|
|
26
|
-
}), { ApiExtractor:
|
|
26
|
+
}), { ApiExtractor: p } = await import("./extractor/ApiExtractor.js"), i = new p(r);
|
|
27
27
|
t.watch ? await i.watch() : await i.run();
|
|
28
28
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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({
|
|
32
51
|
originalDtsPath: t.originalDts,
|
|
33
52
|
newDtsPath: t.newDts,
|
|
34
53
|
outputMdPath: t.outputMd,
|
|
35
54
|
truncate: t.truncate
|
|
36
55
|
});
|
|
37
56
|
});
|
|
38
|
-
|
|
57
|
+
o.parse();
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import type { ApiJson } from "../apiJson.js";
|
|
1
|
+
import type { ApiJson, ApiJsonCompiler } from "../apiJson.js";
|
|
2
2
|
import type { ApiDiff } from "./types.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -6,8 +6,8 @@ import type { ApiDiff } from "./types.js";
|
|
|
6
6
|
* @param newApiJson
|
|
7
7
|
* @example
|
|
8
8
|
* ```js
|
|
9
|
-
* import { diffApiJson
|
|
10
|
-
* import {
|
|
9
|
+
* import { diffApiJson } from "@arcgis/api-extractor/diff/diffApiJson";
|
|
10
|
+
* import { fetchApiJsonFromNpm } from "@arcgis/api-extractor/diff/fetchApiJsonFromNpm";
|
|
11
11
|
*
|
|
12
12
|
* // Read -next api.json from file system:
|
|
13
13
|
* const apiJson = JSON.parse(
|
|
@@ -23,4 +23,4 @@ import type { ApiDiff } from "./types.js";
|
|
|
23
23
|
* writeFileSync("api-diff.json", JSON.stringify(diff, null, 2));
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
export function diffApiJson(oldApiJson: Pick<ApiJson, "modules"
|
|
26
|
+
export function diffApiJson(oldApiJson: Pick<ApiJson, "modules"> & { compiler?: ApiJsonCompiler; }, newApiJson: Pick<ApiJson, "modules"> & { compiler?: ApiJsonCompiler; }): ApiDiff;
|