@arcgis/api-extractor 5.0.0-next.4 → 5.0.0-next.42

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/apiJson.d.ts CHANGED
@@ -115,6 +115,12 @@ export type ApiJavaScriptModule = {
115
115
  * Whether the module is deprecated.
116
116
  * If the value is a string, it's the reason for the deprecation.
117
117
  *
118
+ * @remarks
119
+ * If module is marked as deprecated, all its declarations should also be
120
+ * marked as deprecated. This is because in TypeScript, a usage of a
121
+ * declaration will only be marked as deprecated if the declaration itself
122
+ * is marked as deprecated, rather than its module.
123
+ *
118
124
  * @default false
119
125
  */
120
126
  deprecated?: boolean | string;
@@ -283,10 +289,6 @@ export type ApiCustomElementDeclaration = Omit<ApiClassDeclaration, "members"> &
283
289
  * "attributes" is not necessary.
284
290
  */
285
291
  attributes?: ApiAttribute[];
286
- /**
287
- * The events that this element fires.
288
- */
289
- events?: ApiEvent[];
290
292
  /**
291
293
  * The shadow dom content slots that this element accepts.
292
294
  */
@@ -736,6 +738,10 @@ export type ApiClassDeclaration = {
736
738
  */
737
739
  mixins?: ApiReference[];
738
740
  members?: ApiClassMember[];
741
+ /**
742
+ * The events that this element fires.
743
+ */
744
+ events?: ApiEvent[];
739
745
  /**
740
746
  * @remarks
741
747
  * Not used by `@arcgis/api-extractor`. Preserved in typings for compatibility
@@ -0,0 +1,3 @@
1
+ import { ApiJson } from '../apiJson';
2
+ import { ApiDiff } from './types';
3
+ export declare function diffApiJson(oldApiJson: Pick<ApiJson, "modules">, newApiJson: Pick<ApiJson, "modules">): ApiDiff;
@@ -0,0 +1,7 @@
1
+ import { ApiJson } from '../apiJson';
2
+ /**
3
+ * Read dist/docs/api.json for a given NPM package.
4
+ *
5
+ * @example fetchApiJsonFromNpm("@arcgis/map-components", "latest");
6
+ */
7
+ export declare function fetchApiJsonFromNpm(packageName: string, semverVersion: string): Promise<ApiJson>;
@@ -0,0 +1,3 @@
1
+ export { fetchApiJsonFromNpm } from './fetchApiJsonFromNpm';
2
+ export { diffApiJson } from './diffApiJson';
3
+ export type * from './types';
@@ -0,0 +1,147 @@
1
+ async function b(d, i) {
2
+ const o = await fetch(`https://unpkg.com/${d}@${i}/dist/docs/api.json`);
3
+ if (!o.ok)
4
+ throw new Error(`Failed to fetch api.json: ${o.statusText}`);
5
+ return await o.json();
6
+ }
7
+ function M(d, i) {
8
+ const o = new Map(d.modules.map((e) => [e.path, e])), t = [];
9
+ for (const e of i.modules) {
10
+ const a = o.get(e.path), s = D(a, e, !0);
11
+ s !== void 0 && t.push(s), o.delete(e.path);
12
+ }
13
+ for (const e of o.values()) {
14
+ const a = D(void 0, e, !1);
15
+ a !== void 0 && t.push(a);
16
+ }
17
+ return { modules: t };
18
+ }
19
+ function D(d, i, o) {
20
+ const t = [], e = p(d?.declarations ?? []), a = p(i.declarations ?? []);
21
+ for (const s of a.values()) {
22
+ const n = s.at(-1), l = "tagName" in n ? n.tagName : void 0, v = l ?? n.name, u = e.get(v);
23
+ e.delete(v);
24
+ const h = u === void 0 && !o ? !0 : void 0, m = o && // Only mark as deprecated if all overloads are deprecated
25
+ (s.length === 1 || s.every((r) => r.deprecated !== void 0)) ? n.deprecated : void 0, g = !m && u === void 0 && o ? !0 : void 0;
26
+ if (h || g) {
27
+ t.push({
28
+ kind: n.kind,
29
+ name: n.name,
30
+ tagName: l,
31
+ members: void 0,
32
+ removed: h,
33
+ added: g,
34
+ deprecated: m
35
+ });
36
+ continue;
37
+ } else if (!o)
38
+ continue;
39
+ if ("tagName" in n) {
40
+ const r = u?.[0], c = {
41
+ kind: n.kind,
42
+ name: n.name,
43
+ tagName: n.tagName,
44
+ deprecated: m,
45
+ added: void 0,
46
+ removed: void 0,
47
+ members: k(r?.members, n.members),
48
+ events: f(r?.events, n.events),
49
+ slots: f(r?.slots, n.slots),
50
+ cssParts: f(r?.cssParts, n.cssParts),
51
+ cssProperties: f(r?.cssProperties, n.cssProperties),
52
+ cssStates: f(r?.cssStates, n.cssStates)
53
+ };
54
+ (m !== void 0 || c.members !== void 0 || c.events !== void 0 || c.slots !== void 0 || c.cssParts !== void 0 || c.cssProperties !== void 0 || c.cssStates !== void 0) && t.push(c);
55
+ } else if (n.kind === "class") {
56
+ const r = u?.[0], c = {
57
+ kind: n.kind,
58
+ name: n.name,
59
+ deprecated: m,
60
+ added: void 0,
61
+ removed: void 0,
62
+ members: k(r?.members, n.members),
63
+ events: f(r?.events, n.events)
64
+ };
65
+ (m !== void 0 || c.members !== void 0 || c.events !== void 0) && t.push(c);
66
+ } else m !== void 0 && t.push({
67
+ kind: n.kind,
68
+ name: n.name,
69
+ deprecated: m,
70
+ added: void 0,
71
+ removed: void 0
72
+ });
73
+ }
74
+ if (o)
75
+ for (const [s] of e.values())
76
+ t.push({
77
+ kind: s.kind,
78
+ name: s.name,
79
+ tagName: "tagName" in s ? s.tagName : void 0,
80
+ members: void 0,
81
+ removed: !0,
82
+ added: void 0,
83
+ deprecated: void 0
84
+ });
85
+ if (t.length !== 0)
86
+ return {
87
+ path: i.path,
88
+ declarations: t
89
+ };
90
+ }
91
+ function p(d) {
92
+ const i = /* @__PURE__ */ new Map();
93
+ for (let o = 0; o < d.length; o++) {
94
+ const t = d[o], e = "tagName" in t ? t.tagName : t.name, a = i.get(e);
95
+ a === void 0 ? i.set(e, [t]) : a.push(t);
96
+ }
97
+ return i;
98
+ }
99
+ function f(d, i) {
100
+ const o = p(d ?? []), t = [];
101
+ if (i !== void 0)
102
+ for (const e of i)
103
+ o.get(e.name) === void 0 ? t.push({
104
+ name: e.name,
105
+ added: !0
106
+ }) : e.deprecated && t.push({
107
+ name: e.name,
108
+ deprecated: e.deprecated
109
+ }), o.delete(e.name);
110
+ for (const [e] of o.values())
111
+ t.push({
112
+ name: e.name,
113
+ removed: !0
114
+ });
115
+ return t.length ? t : void 0;
116
+ }
117
+ function k(d, i) {
118
+ const o = p(d ?? []), t = p(i ?? []), e = [];
119
+ for (const a of t.values()) {
120
+ const s = a.at(-1), n = o.get(s.name);
121
+ o.delete(s.name);
122
+ const l = (
123
+ // Only mark as deprecated if all overloads are deprecated
124
+ a.length === 1 || a.every((v) => v.deprecated !== void 0) ? s.deprecated : void 0
125
+ );
126
+ l ? e.push({
127
+ kind: s.kind,
128
+ name: s.name,
129
+ deprecated: l
130
+ }) : n === void 0 && e.push({
131
+ kind: s.kind,
132
+ name: s.name,
133
+ added: !0
134
+ });
135
+ }
136
+ for (const [a] of o.values())
137
+ e.push({
138
+ kind: a.kind,
139
+ name: a.name,
140
+ removed: !0
141
+ });
142
+ return e.length ? e : void 0;
143
+ }
144
+ export {
145
+ M as diffApiJson,
146
+ b as fetchApiJsonFromNpm
147
+ };
@@ -0,0 +1,66 @@
1
+ import { ApiClassDeclaration, ApiClassField, ApiClassMethod, ApiCustomElementDeclaration, ApiFunctionDeclaration, ApiModule, ApiVariableDeclaration } from '../apiJson';
2
+ export interface ApiDiff {
3
+ modules: ApiModuleDiff[];
4
+ }
5
+ export interface ApiModuleDiff {
6
+ path: ApiModule["path"];
7
+ declarations: ApiDeclarationDiff[];
8
+ }
9
+ export interface ApiDiffBase {
10
+ name: string;
11
+ /**
12
+ * True if this declaration was removed in the new api.json.
13
+ * If class is removed, members are not listed.
14
+ * @default false
15
+ */
16
+ removed?: true;
17
+ /**
18
+ * True if this declaration was added in the new api.json.
19
+ * If class is added, members are not listed.
20
+ *
21
+ * @default false
22
+ */
23
+ added?: true;
24
+ /**
25
+ * Whether this declaration is deprecated in the new api.json, regardless of
26
+ * whether it was deprecated in the old api.json.
27
+ * If the value is a string, it's the reason for the deprecation.
28
+ * Deprecated takes precedence over added.
29
+ *
30
+ * @default false
31
+ */
32
+ deprecated?: boolean | string;
33
+ }
34
+ export type ApiDeclarationDiff = ApiClassDeclarationDiff | ApiCustomElementDeclarationDiff | ApiFunctionDeclarationDiff | ApiVariableDeclarationDiff;
35
+ export interface ApiClassDeclarationDiff extends ApiDiffBase {
36
+ kind: ApiClassDeclaration["kind"];
37
+ /**
38
+ * Inherited members are not included in the diff.
39
+ * Also, if entire class is added/removed, members are not included in the diff.
40
+ */
41
+ members?: ApiClassMemberDiff[];
42
+ events?: ApiDiffBase[];
43
+ }
44
+ export interface ApiCustomElementDeclarationDiff extends ApiClassDeclarationDiff {
45
+ /**
46
+ * Attributes diff is not included as attributes are based on members.
47
+ */
48
+ tagName: ApiCustomElementDeclaration["tagName"];
49
+ slots?: ApiDiffBase[];
50
+ cssParts?: ApiDiffBase[];
51
+ cssProperties?: ApiDiffBase[];
52
+ cssStates?: ApiDiffBase[];
53
+ }
54
+ export type ApiClassMemberDiff = ApiClassFieldDiff | ApiClassMethodDiff;
55
+ export interface ApiClassFieldDiff extends ApiDiffBase {
56
+ kind: ApiClassField["kind"];
57
+ }
58
+ export interface ApiClassMethodDiff extends ApiDiffBase {
59
+ kind: ApiClassMethod["kind"];
60
+ }
61
+ export interface ApiFunctionDeclarationDiff extends ApiDiffBase {
62
+ kind: ApiFunctionDeclaration["kind"];
63
+ }
64
+ export interface ApiVariableDeclarationDiff extends ApiDiffBase {
65
+ kind: ApiVariableDeclaration["kind"];
66
+ }
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import c from "typescript";
2
- import { path as P } from "@arcgis/components-build-utils";
3
- import { mappedFind as R } from "@arcgis/toolkit/array";
4
- const N = "@arcgis/api-extractor", K = "5.0.0-next.4", ye = (t) => t.kind === "method", Te = (t) => t.kind === "field";
5
- function W(t, e) {
6
- const n = t.path.split("/"), o = n.pop(), s = n.join("/"), r = e.path.split("/"), i = r.pop(), a = r.join("/");
7
- return s === a ? o < i ? -1 : 1 : s.startsWith(a) ? 1 : a.startsWith(s) || s < a ? -1 : 1;
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.42", 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;
8
9
  }
9
- const Se = "global:", G = /* @__PURE__ */ new Set([
10
+ const G = "global:", C = /* @__PURE__ */ new Set([
10
11
  "example",
11
12
  "see",
12
13
  "param",
@@ -15,315 +16,44 @@ const Se = "global:", G = /* @__PURE__ */ new Set([
15
16
  "slot",
16
17
  "csspart",
17
18
  "cssstate"
18
- ]), v = 10, M = (t = 0) => (e) => `\x1B[${e + t}m`, k = (t = 0) => (e) => `\x1B[${38 + t};5;${e}m`, w = (t = 0) => (e, n, o) => `\x1B[${38 + t};2;${e};${n};${o}m`, l = {
19
- modifier: {
20
- reset: [0, 0],
21
- // 21 isn't widely supported and 22 does the same thing
22
- bold: [1, 22],
23
- dim: [2, 22],
24
- italic: [3, 23],
25
- underline: [4, 24],
26
- overline: [53, 55],
27
- inverse: [7, 27],
28
- hidden: [8, 28],
29
- strikethrough: [9, 29]
30
- },
31
- color: {
32
- black: [30, 39],
33
- red: [31, 39],
34
- green: [32, 39],
35
- yellow: [33, 39],
36
- blue: [34, 39],
37
- magenta: [35, 39],
38
- cyan: [36, 39],
39
- white: [37, 39],
40
- // Bright color
41
- blackBright: [90, 39],
42
- gray: [90, 39],
43
- // Alias of `blackBright`
44
- grey: [90, 39],
45
- // Alias of `blackBright`
46
- redBright: [91, 39],
47
- greenBright: [92, 39],
48
- yellowBright: [93, 39],
49
- blueBright: [94, 39],
50
- magentaBright: [95, 39],
51
- cyanBright: [96, 39],
52
- whiteBright: [97, 39]
53
- },
54
- bgColor: {
55
- bgBlack: [40, 49],
56
- bgRed: [41, 49],
57
- bgGreen: [42, 49],
58
- bgYellow: [43, 49],
59
- bgBlue: [44, 49],
60
- bgMagenta: [45, 49],
61
- bgCyan: [46, 49],
62
- bgWhite: [47, 49],
63
- // Bright color
64
- bgBlackBright: [100, 49],
65
- bgGray: [100, 49],
66
- // Alias of `bgBlackBright`
67
- bgGrey: [100, 49],
68
- // Alias of `bgBlackBright`
69
- bgRedBright: [101, 49],
70
- bgGreenBright: [102, 49],
71
- bgYellowBright: [103, 49],
72
- bgBlueBright: [104, 49],
73
- bgMagentaBright: [105, 49],
74
- bgCyanBright: [106, 49],
75
- bgWhiteBright: [107, 49]
76
- }
77
- };
78
- Object.keys(l.modifier);
79
- const V = Object.keys(l.color), Y = Object.keys(l.bgColor);
80
- [...V, ...Y];
81
- function J() {
82
- const t = /* @__PURE__ */ new Map();
83
- for (const [e, n] of Object.entries(l)) {
84
- for (const [o, s] of Object.entries(n))
85
- l[o] = {
86
- open: `\x1B[${s[0]}m`,
87
- close: `\x1B[${s[1]}m`
88
- }, n[o] = l[o], t.set(s[0], s[1]);
89
- Object.defineProperty(l, e, {
90
- value: n,
91
- enumerable: !1
92
- });
93
- }
94
- return Object.defineProperty(l, "codes", {
95
- value: t,
96
- enumerable: !1
97
- }), l.color.close = "\x1B[39m", l.bgColor.close = "\x1B[49m", l.color.ansi = M(), l.color.ansi256 = k(), l.color.ansi16m = w(), l.bgColor.ansi = M(v), l.bgColor.ansi256 = k(v), l.bgColor.ansi16m = w(v), Object.defineProperties(l, {
98
- rgbToAnsi256: {
99
- value(e, n, o) {
100
- return e === n && n === o ? e < 8 ? 16 : e > 248 ? 231 : Math.round((e - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(e / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(o / 255 * 5);
101
- },
102
- enumerable: !1
103
- },
104
- hexToRgb: {
105
- value(e) {
106
- const n = /[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));
107
- if (!n)
108
- return [0, 0, 0];
109
- let [o] = n;
110
- o.length === 3 && (o = [...o].map((r) => r + r).join(""));
111
- const s = Number.parseInt(o, 16);
112
- return [
113
- /* eslint-disable no-bitwise */
114
- s >> 16 & 255,
115
- s >> 8 & 255,
116
- s & 255
117
- /* eslint-enable no-bitwise */
118
- ];
119
- },
120
- enumerable: !1
121
- },
122
- hexToAnsi256: {
123
- value: (e) => l.rgbToAnsi256(...l.hexToRgb(e)),
124
- enumerable: !1
125
- },
126
- ansi256ToAnsi: {
127
- value(e) {
128
- if (e < 8)
129
- return 30 + e;
130
- if (e < 16)
131
- return 90 + (e - 8);
132
- let n, o, s;
133
- if (e >= 232)
134
- n = ((e - 232) * 10 + 8) / 255, o = n, s = n;
135
- else {
136
- e -= 16;
137
- const a = e % 36;
138
- n = Math.floor(e / 36) / 5, o = Math.floor(a / 6) / 5, s = a % 6 / 5;
139
- }
140
- const r = Math.max(n, o, s) * 2;
141
- if (r === 0)
142
- return 30;
143
- let i = 30 + (Math.round(s) << 2 | Math.round(o) << 1 | Math.round(n));
144
- return r === 2 && (i += 60), i;
145
- },
146
- enumerable: !1
147
- },
148
- rgbToAnsi: {
149
- value: (e, n, o) => l.ansi256ToAnsi(l.rgbToAnsi256(e, n, o)),
150
- enumerable: !1
151
- },
152
- hexToAnsi: {
153
- value: (e) => l.ansi256ToAnsi(l.hexToAnsi256(e)),
154
- enumerable: !1
155
- }
156
- }), l;
157
- }
158
- const d = J(), B = (() => {
159
- if (!("navigator" in globalThis))
160
- return 0;
161
- if (globalThis.navigator.userAgentData) {
162
- const t = navigator.userAgentData.brands.find(({ brand: e }) => e === "Chromium");
163
- if (t && t.version > 93)
164
- return 3;
165
- }
166
- return /\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent) ? 1 : 0;
167
- })(), j = B !== 0 && {
168
- level: B
169
- }, U = {
170
- stdout: j,
171
- stderr: j
172
- };
173
- function z(t, e, n) {
174
- let o = t.indexOf(e);
175
- if (o === -1)
176
- return t;
177
- const s = e.length;
178
- let r = 0, i = "";
179
- do
180
- i += t.slice(r, o) + e + n, r = o + s, o = t.indexOf(e, r);
181
- while (o !== -1);
182
- return i += t.slice(r), i;
183
- }
184
- function H(t, e, n, o) {
185
- let s = 0, r = "";
186
- do {
187
- const i = t[o - 1] === "\r";
188
- r += t.slice(s, i ? o - 1 : o) + e + (i ? `\r
189
- ` : `
190
- `) + n, s = o + 1, o = t.indexOf(`
191
- `, s);
192
- } while (o !== -1);
193
- return r += t.slice(s), r;
194
- }
195
- const { stdout: $, stderr: S } = U, A = Symbol("GENERATOR"), f = Symbol("STYLER"), h = Symbol("IS_EMPTY"), D = [
196
- "ansi",
197
- "ansi",
198
- "ansi256",
199
- "ansi16m"
200
- ], p = /* @__PURE__ */ Object.create(null), q = (t, e = {}) => {
201
- if (e.level && !(Number.isInteger(e.level) && e.level >= 0 && e.level <= 3))
202
- throw new Error("The `level` option should be an integer from 0 to 3");
203
- const n = $ ? $.level : 0;
204
- t.level = e.level === void 0 ? n : e.level;
205
- }, Q = (t) => {
206
- const e = (...n) => n.join(" ");
207
- return q(e, t), Object.setPrototypeOf(e, m.prototype), e;
208
- };
209
- function m(t) {
210
- return Q(t);
211
- }
212
- Object.setPrototypeOf(m.prototype, Function.prototype);
213
- for (const [t, e] of Object.entries(d))
214
- p[t] = {
215
- get() {
216
- const n = x(this, E(e.open, e.close, this[f]), this[h]);
217
- return Object.defineProperty(this, t, { value: n }), n;
218
- }
219
- };
220
- p.visible = {
221
- get() {
222
- const t = x(this, this[f], !0);
223
- return Object.defineProperty(this, "visible", { value: t }), t;
224
- }
225
- };
226
- const C = (t, e, n, ...o) => t === "rgb" ? e === "ansi16m" ? d[n].ansi16m(...o) : e === "ansi256" ? d[n].ansi256(d.rgbToAnsi256(...o)) : d[n].ansi(d.rgbToAnsi(...o)) : t === "hex" ? C("rgb", e, n, ...d.hexToRgb(...o)) : d[n][t](...o), X = ["rgb", "hex", "ansi256"];
227
- for (const t of X) {
228
- p[t] = {
229
- get() {
230
- const { level: n } = this;
231
- return function(...o) {
232
- const s = E(C(t, D[n], "color", ...o), d.color.close, this[f]);
233
- return x(this, s, this[h]);
234
- };
235
- }
236
- };
237
- const e = "bg" + t[0].toUpperCase() + t.slice(1);
238
- p[e] = {
239
- get() {
240
- const { level: n } = this;
241
- return function(...o) {
242
- const s = E(C(t, D[n], "bgColor", ...o), d.bgColor.close, this[f]);
243
- return x(this, s, this[h]);
244
- };
245
- }
246
- };
247
- }
248
- const Z = Object.defineProperties(() => {
249
- }, {
250
- ...p,
251
- level: {
252
- enumerable: !0,
253
- get() {
254
- return this[A].level;
255
- },
256
- set(t) {
257
- this[A].level = t;
258
- }
259
- }
260
- }), E = (t, e, n) => {
261
- let o, s;
262
- return n === void 0 ? (o = t, s = e) : (o = n.openAll + t, s = e + n.closeAll), {
263
- open: t,
264
- close: e,
265
- openAll: o,
266
- closeAll: s,
267
- parent: n
268
- };
269
- }, x = (t, e, n) => {
270
- const o = (...s) => _(o, s.length === 1 ? "" + s[0] : s.join(" "));
271
- return Object.setPrototypeOf(o, Z), o[A] = t, o[f] = e, o[h] = n, o;
272
- }, _ = (t, e) => {
273
- if (t.level <= 0 || !e)
274
- return t[h] ? "" : e;
275
- let n = t[f];
276
- if (n === void 0)
277
- return e;
278
- const { openAll: o, closeAll: s } = n;
279
- if (e.includes("\x1B"))
280
- for (; n !== void 0; )
281
- e = z(e, n.close, n.open), n = n.parent;
282
- const r = e.indexOf(`
283
- `);
284
- return r !== -1 && (e = H(e, s, o, r)), o + e + s;
285
- };
286
- Object.defineProperties(m.prototype, p);
287
- const ee = m();
288
- m({ level: S ? S.level : 0 });
289
- const te = c.createPrinter();
290
- function ne(t) {
291
- return te.printNode(c.EmitHint.Unspecified, t, void 0);
19
+ ]), $ = c.createPrinter();
20
+ function w(t) {
21
+ return $.printNode(c.EmitHint.Unspecified, t, void 0);
292
22
  }
293
- function oe(t, e) {
294
- return t.pos !== -1 && t.end !== -1 && e !== void 0 ? t.getText(e) : ne(t);
23
+ function L(t, e) {
24
+ return t.pos !== -1 && t.end !== -1 && e !== void 0 ? t.getText(e) : w(t);
295
25
  }
296
- let se = 0;
297
- const re = /* @__PURE__ */ new Set();
298
- let I = console.error;
299
- function Ae(t) {
300
- I = t;
26
+ let A = 0;
27
+ const I = /* @__PURE__ */ new Set();
28
+ let g = console.error;
29
+ function Q(t) {
30
+ g = t;
301
31
  }
302
- const ie = {
32
+ const M = {
303
33
  getCurrentDirectory: process.cwd,
304
34
  getCanonicalFileName: (t) => t,
305
35
  getNewLine: () => c.sys.newLine
306
36
  };
307
- function le(t, { file: e, node: n, scope: o, start: s, length: r }) {
308
- se += 1, process.exitCode = 1;
309
- const i = e?.fileName;
310
- i !== void 0 && re.add(i), s ??= n?.getStart(e, !1) ?? -1;
311
- const a = n?.end ?? -1;
312
- r ??= a === -1 ? -1 : Math.max(1, a - s);
313
- const u = s >= 0 && r >= 0, g = !u && o !== void 0, b = {
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 = {
314
44
  category: c.DiagnosticCategory.Error,
315
- code: u ? N : ce,
316
- file: g ? void 0 : e,
317
- start: u ? s : 0,
318
- length: u ? r : 0,
319
- messageText: (g ? `${ee.cyan(o)}: ` : "") + t + (u || n === void 0 ? "" : `
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 ? "" : `
320
50
 
321
- ${oe(n, e)}`)
322
- }, O = c.formatDiagnosticsWithColorAndContext([b], ie), F = S ? O : O.replaceAll(ae, "");
323
- I(F);
51
+ ${L(s, e)}`)
52
+ }, x = c.formatDiagnosticsWithColorAndContext([f], M), v = S ? x : x.replaceAll(j, "");
53
+ g(v);
324
54
  }
325
- const ce = 1490, ae = /\x1B\[[0-9;]*m/gu;
326
- class Ce {
55
+ const K = 1490, j = /\x1B\[[0-9;]*m/gu;
56
+ class X {
327
57
  constructor(e) {
328
58
  this.options = e;
329
59
  }
@@ -332,8 +62,8 @@ class Ce {
332
62
  return {
333
63
  timestamp: (/* @__PURE__ */ new Date()).toISOString().split(".")[0],
334
64
  compiler: {
335
- name: N,
336
- version: K,
65
+ name: m,
66
+ version: E,
337
67
  typescriptVersion: c.version
338
68
  },
339
69
  schemaVersion: "1.0.0",
@@ -341,215 +71,215 @@ class Ce {
341
71
  };
342
72
  }
343
73
  extractModules(e) {
344
- const n = [];
345
- for (const o of e)
346
- this.file = o, n.push(this.extractModule(o));
347
- return this.options.isFullApiExtraction && n.sort(W), n;
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;
348
78
  }
349
79
  extractModule(e) {
350
- const n = {
80
+ const s = {
351
81
  kind: "javascript-module",
352
- path: P.relative(this.options.cwd, e.fileName),
82
+ path: y.relative(this.options.cwd, e.fileName),
353
83
  declarations: void 0,
354
84
  exports: void 0
355
85
  };
356
- this.apiModule = n;
357
- const o = this.extractDeclarations(e);
358
- if (n.declarations = o, this.options.isFullApiExtraction) {
359
- const s = this.inferExports(o);
360
- s.length > 0 && (n.exports = s);
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);
361
91
  }
362
- return n;
92
+ return s;
363
93
  }
364
94
  /**
365
95
  * For a given module, extract all public declarations.
366
96
  */
367
97
  extractDeclarations(e) {
368
- const n = [];
369
- for (const o of e.statements) {
370
- const s = this.extractDeclaration(o);
371
- s !== void 0 && n.push(s);
98
+ const s = [];
99
+ for (const n of e.statements) {
100
+ const o = this.extractDeclaration(n);
101
+ o !== void 0 && s.push(o);
372
102
  }
373
- return n;
103
+ return s;
374
104
  }
375
105
  /**
376
106
  * Infer ApiModule.exports based on ApiModule.declarations.
377
107
  */
378
108
  inferExports(e) {
379
- const n = [];
380
- for (const o of e) {
381
- const s = this.inferExport(o);
382
- s !== void 0 && n.push(s);
109
+ const s = [];
110
+ for (const n of e) {
111
+ const o = this.inferExport(n);
112
+ o !== void 0 && s.push(o);
383
113
  }
384
- return n;
114
+ return s;
385
115
  }
386
- copyDoc(e, n, o, s) {
387
- const r = o.docsTags?.findIndex((u) => u.name === "copyDoc");
388
- if (r === void 0 || r === -1)
116
+ copyDoc(e, s, n, o) {
117
+ const i = n.docsTags?.findIndex((d) => d.name === "copyDoc");
118
+ if (i === void 0 || i === -1)
389
119
  return;
390
- n === void 0 && le("@copyDoc tag was used, but failed to find copyDoc definition for it.", {
120
+ s === void 0 && N("@copyDoc tag was used, but failed to find copyDoc definition for it.", {
391
121
  file: this.file,
392
122
  node: e
393
123
  });
394
- const i = n?.(o, s);
395
- if (i === void 0)
124
+ const r = s?.(n, o);
125
+ if (r === void 0)
396
126
  return;
397
- for (const [u, g] of Object.entries(i))
398
- u !== "docsTags" && (o[u] = o[u] ?? g);
399
- o.docsTags.splice(r, 1);
400
- const a = new Set(o.docsTags.map(({ name: u }) => u));
401
- for (const u of i.docsTags ?? [])
402
- a.has(u.name) && !G.has(u.name) || o.docsTags.push(u);
403
- o.docsTags.length === 0 && (o.docsTags = void 0);
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);
404
134
  }
405
135
  }
406
- const Ee = (t) => t.modifiers?.some?.(
136
+ const Y = (t) => t.modifiers?.some?.(
407
137
  (e) => e.kind === c.SyntaxKind.StaticKeyword || e.kind === c.SyntaxKind.PrivateKeyword || e.kind === c.SyntaxKind.ProtectedKeyword
408
138
  ) ?? !1;
409
- function Oe(t, e, n) {
139
+ function Z(t, e, s) {
410
140
  if (!e.default && "initializer" in t && t.initializer) {
411
- const o = L(t.initializer);
412
- ue(o) && (e.default = o.getText(n));
141
+ const n = h(t.initializer);
142
+ F(n) && (e.default = n.getText(s));
413
143
  }
414
144
  }
415
- const ue = (t) => c.isLiteralExpression(t) || t.kind === c.SyntaxKind.TrueKeyword || t.kind === c.SyntaxKind.FalseKeyword || c.isPrefixUnaryExpression(t) && c.isLiteralExpression(t.operand);
416
- function L(t) {
417
- return c.isSatisfiesExpression(t) || c.isParenthesizedExpression(t) ? L(t.expression) : t;
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;
418
148
  }
419
- function Me(t) {
149
+ function _(t) {
420
150
  if (t !== void 0 && (c.isIdentifier(t) || c.isStringLiteralLike(t)))
421
151
  return t.text;
422
152
  }
423
- const ke = ({ modifiers: t = [] }, e) => R(
153
+ const tt = ({ modifiers: t = [] }, e) => D(
424
154
  t,
425
- (n) => c.isDecorator(n) && c.isCallExpression(n.expression) && c.isIdentifier(n.expression.expression) && n.expression.expression.text === e ? n.expression : void 0
155
+ (s) => c.isDecorator(s) && c.isCallExpression(s.expression) && c.isIdentifier(s.expression.expression) && s.expression.expression.text === e ? s.expression : void 0
426
156
  );
427
- function de(t, e) {
428
- const n = ge(e.getJsDocTags());
429
- let o = c.displayPartsToString(e.getDocumentationComment(t));
430
- const s = n.at(-1), r = s?.text?.indexOf(pe);
431
- if (r !== void 0 && r !== -1) {
432
- const i = s.text.indexOf(fe);
433
- i !== -1 && (o += s.text.slice(i), s.text = s.text?.slice(0, i));
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));
434
164
  }
435
165
  return {
436
- docsTags: n,
437
- description: o || void 0
166
+ docsTags: s,
167
+ description: n || void 0
438
168
  };
439
169
  }
440
- const fe = `
170
+ const b = `
441
171
 
442
- {@link `, pe = "Read more...}", ge = (t) => t.filter((e) => e.name !== "privateRemarks").map((e) => ({
172
+ {@link `, O = "Read more...}", W = (t) => t.filter((e) => e.name !== "privateRemarks").map((e) => ({
443
173
  name: e.name,
444
- text: e.text?.map((n) => n.text).join("")
174
+ text: e.text?.map((s) => s.text).join("")
445
175
  }));
446
- function we(t) {
447
- const e = Array.from(t.docsTags ?? []), n = t, o = t;
176
+ function et(t) {
177
+ const e = Array.from(t.docsTags ?? []), s = t, n = t;
448
178
  if (t.deprecated && e.push({
449
179
  name: "deprecated",
450
180
  text: t.deprecated === !0 ? void 0 : t.deprecated
451
- }), n.default && e.push({
181
+ }), s.default && e.push({
452
182
  name: "default",
453
- text: n.default
454
- }), o.cssParts)
455
- for (const r of o.cssParts)
183
+ text: s.default
184
+ }), n.cssParts)
185
+ for (const i of n.cssParts)
456
186
  e.push({
457
187
  name: "csspart",
458
- text: T(r)
188
+ text: u(i)
459
189
  });
460
- if (o.cssStates)
461
- for (const r of o.cssStates)
190
+ if (n.cssStates)
191
+ for (const i of n.cssStates)
462
192
  e.push({
463
193
  name: "cssstate",
464
- text: T(r)
194
+ text: u(i)
465
195
  });
466
- if (o.slots)
467
- for (const r of o.slots)
196
+ if (n.slots)
197
+ for (const i of n.slots)
468
198
  e.push({
469
199
  name: "slot",
470
- text: T(r)
200
+ text: u(i)
471
201
  });
472
- o.privacy === "private" && e.push({
202
+ n.privacy === "private" && e.push({
473
203
  name: "private",
474
204
  text: void 0
475
205
  });
476
- const s = t.description ?? "";
477
- return e.length === 0 && s.length === 0 ? [] : [he(s, e)];
206
+ const o = t.description ?? "";
207
+ return e.length === 0 && o.length === 0 ? [] : [J(o, e)];
478
208
  }
479
- function he(t = "", e = []) {
209
+ function J(t = "", e = []) {
480
210
  return {
481
211
  kind: c.SyntaxKind.MultiLineCommentTrivia,
482
212
  pos: -1,
483
213
  end: -1,
484
- text: me(t, e),
214
+ text: R(t, e),
485
215
  hasTrailingNewLine: !0
486
216
  };
487
217
  }
488
- function me(t = "", e = []) {
489
- const n = t === "" ? [] : t.split(`
490
- `), s = n.length + e.length > 1 || (e.at(0)?.text?.includes(`
218
+ function R(t = "", e = []) {
219
+ const s = t === "" ? [] : t.split(`
220
+ `), o = s.length + e.length > 1 || (e.at(0)?.text?.includes(`
491
221
  `) ?? !1);
492
- return `*${s ? n.map((r) => `
493
- * ${r}`).join("") : ` ${t}`}${n.length > 0 && e.length > 0 ? `
494
- *` : ""}${e.map((r) => {
495
- const i = `@${r.name}`, a = r.text ?? "", u = r.text?.includes(`
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(`
496
226
  `) ?? !1;
497
- return `${s ? `
498
- * ` : ""}${i}${u ? a.split(`
499
- `).map((b) => `
500
- * ${b}`).join("") : a.length > 0 ? ` ${a}` : ""}`;
501
- }).join("")}${s ? `
227
+ return `${o ? `
228
+ * ` : ""}${r}${d ? a.split(`
229
+ `).map((f) => `
230
+ * ${f}`).join("") : a.length > 0 ? ` ${a}` : ""}`;
231
+ }).join("")}${o ? `
502
232
  ` : ""} `;
503
233
  }
504
- function Be(t, e, n, o) {
505
- const s = e.getSymbolAtLocation(t);
506
- if (o ??= s === void 0 ? void 0 : de(e, s), o !== void 0) {
507
- for (const r of o.docsTags) {
508
- const { name: i, text: a } = r;
509
- i === "deprecated" ? n.deprecated = a || !0 : i === "default" ? n.default = a : i === "readonly" ? n.readonly = !0 : i === "private" ? n.privacy = "private" : i === "csspart" ? n.cssParts.push(y(a)) : i === "cssstate" ? n.cssStates.push(y(a)) : i === "slot" ? n.slots.push(y(a)) : (n.docsTags ??= [], n.docsTags.push(r));
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));
510
240
  }
511
- n.description = o.description;
241
+ s.description = n.description;
512
242
  }
513
243
  }
514
- function y(t) {
244
+ function p(t) {
515
245
  if (t === void 0)
516
246
  return { name: "" };
517
247
  const e = t.indexOf(" - ");
518
248
  if (e === -1)
519
249
  return t.startsWith("- ") ? { name: "", description: t.slice(2) } : { name: t };
520
- let n, o = t.slice(0, e);
521
- if (o.startsWith("[") && o.endsWith("]")) {
522
- const r = o.slice(1, -1), i = r.indexOf("=");
523
- o = r.slice(0, i), n = r.slice(i + 1);
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);
524
254
  }
525
- const s = t.slice(e + 3);
255
+ const o = t.slice(e + 3);
526
256
  return {
527
- name: o,
528
- default: n,
529
- description: s
257
+ name: n,
258
+ default: s,
259
+ description: o
530
260
  };
531
261
  }
532
- function T(t) {
533
- const e = t.name + (t.default !== void 0 ? `=${t.default}` : ""), n = e.length > 0 ? `[${e}]` : "", o = t.description ?? "", s = o.length > 0 ? ` - ${o}` : "";
534
- return `${n}${s}`;
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}`;
535
265
  }
536
266
  export {
537
- Ce as ApiExtractor,
538
- le as apiExtractorError,
539
- se as apiExtractorErrorCount,
540
- re as apiExtractorErrorFiles,
541
- we as apiMemberToSynthesizedComments,
542
- oe as debugPrintNode,
543
- ke as findDecorator,
544
- Me as getMemberName,
545
- Se as globalPackageIdentifier,
546
- Ee as hasIgnoredModifier,
547
- ye as isApiMethod,
548
- Te as isApiProperty,
549
- G as multipleJsDocTags,
550
- ne as printNode,
551
- Be as setApiDocFromJsDoc,
552
- Ae as setApiExtractorErrorLogger,
553
- Oe as setDefaultFromInitializer,
554
- de as symbolToDocs
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
555
285
  };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@arcgis/api-extractor",
3
- "version": "5.0.0-next.4",
3
+ "version": "5.0.0-next.42",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": "./dist/index.js",
10
+ "./diff": "./dist/diff/index.js",
10
11
  "./package.json": "./package.json"
11
12
  },
12
13
  "files": [
@@ -14,8 +15,9 @@
14
15
  ],
15
16
  "license": "SEE LICENSE IN LICENSE.md",
16
17
  "dependencies": {
17
- "@arcgis/components-build-utils": "5.0.0-next.4",
18
- "@arcgis/toolkit": "5.0.0-next.4",
18
+ "@arcgis/components-build-utils": "5.0.0-next.42",
19
+ "@arcgis/toolkit": "5.0.0-next.42",
20
+ "chalk": "^5.4.1",
19
21
  "tslib": "^2.8.1",
20
22
  "typescript": "~5.8.3"
21
23
  }