@arcgis/codemod 5.2.0-next.2 → 5.2.0-next.21
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/actions-TqvlTKWR.js +354 -0
- package/dist/{cli-mQ3ZNyiH.js → cli-CqB-08tZ.js} +86 -80
- package/dist/cli.js +2 -1
- package/dist/codemod-CcxqQd8R.js +436 -0
- package/dist/{codemod-wiEaN6_r.js → codemod-DdyO0alZ.js} +9 -8
- package/dist/{codemod-ul_pPsIY.js → codemod-kSkY37LR.js} +5 -4
- package/dist/useProjectInstance-C9i4ViQD.js +50 -0
- package/package.json +4 -3
- package/dist/useProjectInstance-BeTuT4eH.js +0 -398
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
var S = (n, e) => (e = Symbol[n]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + n), L = (n) => {
|
|
2
|
+
throw TypeError(n);
|
|
3
|
+
};
|
|
4
|
+
var D = (n, e, i) => {
|
|
5
|
+
if (e != null) {
|
|
6
|
+
typeof e != "object" && typeof e != "function" && L("Object expected");
|
|
7
|
+
var d, r;
|
|
8
|
+
i && (d = e[S("asyncDispose")]), d === void 0 && (d = e[S("dispose")], i && (r = d)), typeof d != "function" && L("Object not disposable"), r && (d = function() {
|
|
9
|
+
try {
|
|
10
|
+
r.call(this);
|
|
11
|
+
} catch (s) {
|
|
12
|
+
return Promise.reject(s);
|
|
13
|
+
}
|
|
14
|
+
}), n.push([i, d, e]);
|
|
15
|
+
} else i && n.push([i]);
|
|
16
|
+
return e;
|
|
17
|
+
}, E = (n, e, i) => {
|
|
18
|
+
var d = typeof SuppressedError == "function" ? SuppressedError : function(t, c, o, a) {
|
|
19
|
+
return a = Error(o), a.name = "SuppressedError", a.error = t, a.suppressed = c, a;
|
|
20
|
+
}, r = (t) => e = i ? new d(t, e, "An error was suppressed during disposal") : (i = !0, t), s = (t) => {
|
|
21
|
+
for (; t = n.pop(); )
|
|
22
|
+
try {
|
|
23
|
+
var c = t[1] && t[1].call(t[2]);
|
|
24
|
+
if (t[0]) return Promise.resolve(c).then(s, (o) => (r(o), s()));
|
|
25
|
+
} catch (o) {
|
|
26
|
+
r(o);
|
|
27
|
+
}
|
|
28
|
+
if (i) throw e;
|
|
29
|
+
};
|
|
30
|
+
return s();
|
|
31
|
+
};
|
|
32
|
+
import { log as y } from "@arcgis/toolkit/log";
|
|
33
|
+
import { c as V } from "./useProjectInstance-C9i4ViQD.js";
|
|
34
|
+
import { mergeApiExtractorConfigs as O, loadApiExtractorConfig as _ } from "@arcgis/api-extractor/extractor/config";
|
|
35
|
+
import { g as F } from "./cli-CqB-08tZ.js";
|
|
36
|
+
import { writeFile as I, readFile as j } from "node:fs/promises";
|
|
37
|
+
import { join as W, relative as Q } from "node:path";
|
|
38
|
+
import { existsAsync as U } from "@arcgis/components-build-utils";
|
|
39
|
+
import { ApiExtractor as Y } from "@arcgis/api-extractor/extractor/ApiExtractor";
|
|
40
|
+
import { SyntaxKind as f } from "ts-morph";
|
|
41
|
+
import { getApiMemberName as q } from "@arcgis/api-extractor/utils/apiHelpers";
|
|
42
|
+
import { identity as B } from "@arcgis/toolkit/function";
|
|
43
|
+
import { styleText as $ } from "node:util";
|
|
44
|
+
function G(n) {
|
|
45
|
+
const e = {};
|
|
46
|
+
for (const i of n.modules) {
|
|
47
|
+
const d = {};
|
|
48
|
+
for (const r of i.declarations) {
|
|
49
|
+
const s = {}, t = A(r);
|
|
50
|
+
if (d[r.name + t] = s, "members" in r)
|
|
51
|
+
for (const c of r.members ?? []) {
|
|
52
|
+
const o = q(c);
|
|
53
|
+
s[o + (t || A(c))] = {};
|
|
54
|
+
}
|
|
55
|
+
if ("events" in r)
|
|
56
|
+
for (const c of r.events ?? [])
|
|
57
|
+
s[`@${c.name}${t || A(c)}`] = {};
|
|
58
|
+
}
|
|
59
|
+
e[i.path] = d;
|
|
60
|
+
}
|
|
61
|
+
return e;
|
|
62
|
+
}
|
|
63
|
+
function A(n) {
|
|
64
|
+
if (n.docsTags === void 0)
|
|
65
|
+
return "";
|
|
66
|
+
for (let e = 0; e < n.docsTags.length; ++e)
|
|
67
|
+
if (n.docsTags[e].name === "internal")
|
|
68
|
+
return " (internal)";
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
function X(n, e) {
|
|
72
|
+
return H(n, e, "").join(`
|
|
73
|
+
`);
|
|
74
|
+
}
|
|
75
|
+
const J = {};
|
|
76
|
+
function H(n, e, i) {
|
|
77
|
+
const r = [.../* @__PURE__ */ new Set([...Object.keys(n), ...Object.keys(e)])].sort(), s = [];
|
|
78
|
+
for (let t = 0; t < r.length; ++t) {
|
|
79
|
+
const c = r[t], o = n[c], a = e[c];
|
|
80
|
+
if (o === void 0 && s.push(`${i}+ ${c}`), a === void 0) {
|
|
81
|
+
if (c.endsWith(" (internal)") && (c.toLowerCase().includes("message") || c.toLowerCase().includes("string") || c.toLowerCase().includes("t9n")))
|
|
82
|
+
continue;
|
|
83
|
+
s.push(`${i}- ${c}`);
|
|
84
|
+
}
|
|
85
|
+
const l = H(o ?? J, a ?? J, `${i} `);
|
|
86
|
+
l.length > 0 && (o !== void 0 && a !== void 0 && s.push(`${i}${c}`), s.push(...l));
|
|
87
|
+
}
|
|
88
|
+
return s;
|
|
89
|
+
}
|
|
90
|
+
function x(n, e, i, d) {
|
|
91
|
+
const r = n.getJsDocs().at(-1);
|
|
92
|
+
let s = !1;
|
|
93
|
+
const t = r?.getStructure() ?? { description: void 0, tags: [] }, c = t.tags.findIndex((a) => a.tagName === "private");
|
|
94
|
+
if (c !== -1) {
|
|
95
|
+
if (s = !0, t.tags.splice(c, 1), t.tags.length === 0 && (t.description ?? "").trim() === "") {
|
|
96
|
+
r.remove();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
} else if (e !== void 0) {
|
|
100
|
+
const a = t.tags.some((u) => u.tagName === "internal");
|
|
101
|
+
!t.tags.some((u) => u.tagName === "public") && !a && (s = !0, t.tags.unshift({ tagName: d ? "internal" : "public" }));
|
|
102
|
+
}
|
|
103
|
+
for (const a of t.tags) {
|
|
104
|
+
const l = M(a.text ?? "", i);
|
|
105
|
+
l !== a.text && (s = !0, a.text = l);
|
|
106
|
+
}
|
|
107
|
+
const o = Z(e);
|
|
108
|
+
if (o !== void 0)
|
|
109
|
+
for (const a of o)
|
|
110
|
+
t.tags.some(
|
|
111
|
+
(u) => u.tagName === "param" && (u.text?.includes(`${a.name} `) || u.text === a.name)
|
|
112
|
+
) || (s = !0, t.tags.push({
|
|
113
|
+
tagName: "param",
|
|
114
|
+
text: a.name.startsWith("_") ? a.name.slice(1) : a.name
|
|
115
|
+
}));
|
|
116
|
+
if (t.description !== void 0) {
|
|
117
|
+
const a = M(t.description, i);
|
|
118
|
+
a !== t.description && (s = !0, t.description = a);
|
|
119
|
+
}
|
|
120
|
+
s && (r === void 0 ? n.addJsDoc(t) : r.set(t));
|
|
121
|
+
}
|
|
122
|
+
function Z(n) {
|
|
123
|
+
if (n !== void 0)
|
|
124
|
+
return "parameters" in n ? n.parameters : "kind" in n && n.kind === "interface" && n.supertypes === void 0 && n.type === void 0 && n.members?.length === 1 && (n.members[0].kind === "call-signature" || n.members[0].kind === "constructor") ? n.members[0].parameters : void 0;
|
|
125
|
+
}
|
|
126
|
+
function M(n, e) {
|
|
127
|
+
return n.replace(/\{@link +([^}]+)\}/gu, (i, d) => {
|
|
128
|
+
const r = d.trim(), s = r.indexOf(" "), t = s === -1 ? r : r.slice(0, s), c = s === -1 ? "" : r.slice(s + 1).trim();
|
|
129
|
+
if (t.startsWith("https://"))
|
|
130
|
+
return c ? `[${c}](${t})]` : t;
|
|
131
|
+
if (t.includes("!"))
|
|
132
|
+
return i;
|
|
133
|
+
const o = t.indexOf("#"), a = o === -1 ? t : t.slice(0, o), l = o === -1 ? void 0 : t.slice(o + 1), u = e[a] ?? Object.values(e).find(({ modulePath: N }) => N === a);
|
|
134
|
+
if (u === void 0)
|
|
135
|
+
return i;
|
|
136
|
+
const { component: h, modulePath: T } = u;
|
|
137
|
+
let v = l;
|
|
138
|
+
if (l !== void 0) {
|
|
139
|
+
if (h.members?.find((w) => w.name === l) !== void 0)
|
|
140
|
+
v = l;
|
|
141
|
+
else if (l !== void 0) {
|
|
142
|
+
const w = h.slots?.find((b) => b.name === l);
|
|
143
|
+
if (w !== void 0)
|
|
144
|
+
v = `slot-${w.name}`;
|
|
145
|
+
else {
|
|
146
|
+
const b = h.events?.find((m) => m.name === l);
|
|
147
|
+
b !== void 0 && (v = `event-${b.name}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return `{@link ${T}${v === void 0 ? "" : `#${v}`}${c === "" ? "" : ` ${c}`}}`;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async function ee(n, e, i, d) {
|
|
155
|
+
const r = [], s = O(e, {
|
|
156
|
+
strict: !0,
|
|
157
|
+
context: {
|
|
158
|
+
logger: {
|
|
159
|
+
info: B,
|
|
160
|
+
error(l) {
|
|
161
|
+
r.push(l);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}), t = new Y(s), { apiJson: c } = await t.run();
|
|
166
|
+
r.length > 0 && y(
|
|
167
|
+
"error",
|
|
168
|
+
n.logName,
|
|
169
|
+
// Since we remove @private tags, re-running the codemod is not entirely safe
|
|
170
|
+
`The migration is complete, but API Extractor reported errors:
|
|
171
|
+
${r.join(`
|
|
172
|
+
`)}
|
|
173
|
+
You don't need to run the codemod again - run \`${d}\` from inside ${n.logName} to verify the fixes.`
|
|
174
|
+
);
|
|
175
|
+
const o = G(c), a = X(i, o);
|
|
176
|
+
a.length > 0 && y(
|
|
177
|
+
"error",
|
|
178
|
+
n.logName,
|
|
179
|
+
`The migration is complete, but it looks like the public API surface has changed a bit:
|
|
180
|
+
${a}
|
|
181
|
+
|
|
182
|
+
For each added declaration, remove @public from it if it is not supposed to be public. For each removed declaration, add @public JSDoc tag if it needs to remain public.`
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
const te = "5.2.0-next.21", ne = {
|
|
186
|
+
version: te
|
|
187
|
+
};
|
|
188
|
+
async function oe(n) {
|
|
189
|
+
const e = n.contents.dependencies ?? {}, i = n.contents.devDependencies ?? {};
|
|
190
|
+
if (i["@arcgis/api-extractor"] !== void 0)
|
|
191
|
+
return;
|
|
192
|
+
const d = i["@arcgis/lumina-compiler"] ?? e["@arcgis/typescript-config"] ?? e["@arcgis/toolkit"] ?? `^${ne.version}`;
|
|
193
|
+
n.contents.devDependencies = {
|
|
194
|
+
...i,
|
|
195
|
+
"@arcgis/api-extractor": d
|
|
196
|
+
}, await I(n.filePath, `${JSON.stringify(n.contents, null, 2)}
|
|
197
|
+
`), y(
|
|
198
|
+
"warn",
|
|
199
|
+
$("blue", n.contents.name),
|
|
200
|
+
`Added @arcgis/api-extractor dev dependency. Please run ${$("blue", "npm install or equivalent")}.
|
|
201
|
+
`
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
const we = {
|
|
205
|
+
meta: {
|
|
206
|
+
needsTypeInformation: !1
|
|
207
|
+
},
|
|
208
|
+
async run() {
|
|
209
|
+
y(
|
|
210
|
+
"warn",
|
|
211
|
+
F.codemodName,
|
|
212
|
+
`This codemod automates most of the changes. It may print warnings or errors for manual follow-up work - ${$(["bold", "magenta"], "Carefully review the following log messages.")}
|
|
213
|
+
`
|
|
214
|
+
);
|
|
215
|
+
const n = /* @__PURE__ */ new Set();
|
|
216
|
+
for (const e of F.projectsData) {
|
|
217
|
+
if (e.packageJson === void 0 || n.has(e.packageJson.filePath))
|
|
218
|
+
continue;
|
|
219
|
+
n.add(e.packageJson.filePath);
|
|
220
|
+
const i = e.packageJson?.contents.devDependencies ?? {}, d = i["@arcgis/lumina-compiler"] !== void 0;
|
|
221
|
+
if (!(d || i["@arcgis/api-extractor"] !== void 0)) {
|
|
222
|
+
y(
|
|
223
|
+
"warn",
|
|
224
|
+
e.logName,
|
|
225
|
+
"This project doesn't look like a Lumina package, nor is it directly using API Extractor. This codemod only works for projects that already use API Extractor."
|
|
226
|
+
);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
await re(e);
|
|
230
|
+
const s = W(e.cwd, "api-extractor.config.ts");
|
|
231
|
+
let t;
|
|
232
|
+
const c = d ? "npm run build" : "npx api-extractor run";
|
|
233
|
+
if (await U(s) && (t = await _(e.cwd, "api-extractor.config.ts"), t.strict === !0)) {
|
|
234
|
+
y(
|
|
235
|
+
"info",
|
|
236
|
+
e.logName,
|
|
237
|
+
$(
|
|
238
|
+
"green",
|
|
239
|
+
`This package is already in strict mode. You likely do not need to run the codemod again. Instead, run \`${c}\` to verify API Extractor emits no errors in strict mode.`
|
|
240
|
+
)
|
|
241
|
+
);
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
const o = O(t ?? {}, {
|
|
245
|
+
context: {
|
|
246
|
+
cwd: e.cwd,
|
|
247
|
+
// Explicitly don't write to disk, just in case config says otherwise
|
|
248
|
+
apiJsonEmitPath: "",
|
|
249
|
+
dtsEmitPath: "",
|
|
250
|
+
logger: {
|
|
251
|
+
info: B,
|
|
252
|
+
// eslint-disable-next-line webgis/consistent-logging
|
|
253
|
+
error: console.error
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}), a = await ie(o, d, e);
|
|
257
|
+
if (a !== void 0) {
|
|
258
|
+
if (t === void 0)
|
|
259
|
+
await I(
|
|
260
|
+
s,
|
|
261
|
+
`import type { ApiExtractorConfig } from "@arcgis/api-extractor/extractor/config";
|
|
262
|
+
|
|
263
|
+
export const config: ApiExtractorConfig = {
|
|
264
|
+
strict: true,
|
|
265
|
+
};
|
|
266
|
+
`
|
|
267
|
+
);
|
|
268
|
+
else {
|
|
269
|
+
const l = await j(s, "utf-8"), u = l.replace(
|
|
270
|
+
/ApiExtractorConfig\s*=\s*\{\r?\n/u,
|
|
271
|
+
`ApiExtractorConfig = {
|
|
272
|
+
strict: true,
|
|
273
|
+
`
|
|
274
|
+
);
|
|
275
|
+
u === l ? y(
|
|
276
|
+
"warn",
|
|
277
|
+
e.logName,
|
|
278
|
+
`Could not automatically add "strict: true" option to ${s}.`
|
|
279
|
+
) : await I(s, u);
|
|
280
|
+
}
|
|
281
|
+
await oe(e.packageJson), await ee(e, o, a, c);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
async function ie(n, e, i) {
|
|
287
|
+
var o = [];
|
|
288
|
+
try {
|
|
289
|
+
const d = new Y(n);
|
|
290
|
+
const { apiJson: r } = await d.run();
|
|
291
|
+
if (d.errorCount > 0) {
|
|
292
|
+
y("error", i.logName, "API Extractor reported errors. Please resolve them and re-run the codemod.");
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const s = new Map(r.modules.map((h) => [h.sourcePath, h]));
|
|
296
|
+
const t = {};
|
|
297
|
+
if (e)
|
|
298
|
+
for (const h of r.modules) {
|
|
299
|
+
const T = h.declarations.find(
|
|
300
|
+
(v) => v.kind === "class" && v.customElement === !0
|
|
301
|
+
);
|
|
302
|
+
T !== void 0 && (t[T.name] = { component: T, modulePath: h.path });
|
|
303
|
+
}
|
|
304
|
+
const c = D(o, V(i));
|
|
305
|
+
for (const h of c.getCodemodFiles()) {
|
|
306
|
+
const T = Q(i.cwd, h.getFilePath());
|
|
307
|
+
se(h);
|
|
308
|
+
const v = s.get(T), N = v?.declarations.find(
|
|
309
|
+
(m) => m.kind === "class" && m.customElement === !0
|
|
310
|
+
)?.docsTags?.some((m) => m.name === "internal") ?? !1, w = v?.declarations.find((m) => m.kind === "class"), b = v === void 0 ? void 0 : new Map(v.declarations.map((m) => [m.name, m]));
|
|
311
|
+
for (const m of h.getStatements())
|
|
312
|
+
if (m.isKind(f.VariableStatement)) {
|
|
313
|
+
const g = m.getDeclarations().at(0)?.getName(), P = g === void 0 ? void 0 : b?.get(g);
|
|
314
|
+
x(m, P, t, N);
|
|
315
|
+
} else if (m.isKind(f.TypeAliasDeclaration)) {
|
|
316
|
+
const p = m.getName(), g = b?.get(p) ?? (p.endsWith("Properties") && w?.name === p.slice(0, -10) ? w : void 0);
|
|
317
|
+
if (x(m, g, t, N), g !== void 0) {
|
|
318
|
+
const P = m.getTypeNode();
|
|
319
|
+
(P === void 0 ? [] : P.isKind(f.IntersectionType) ? P.getTypeNodes() : [P]).forEach((K) => {
|
|
320
|
+
if (K.isKind(f.TypeLiteral)) {
|
|
321
|
+
let k = K;
|
|
322
|
+
if (!k.getText().includes(`
|
|
323
|
+
`) && k.getMembers().length > 0) {
|
|
324
|
+
const R = k.getMembers().map((z) => ` ${z.getFullText()}`).join(`
|
|
325
|
+
`);
|
|
326
|
+
k = k.replaceWithText(`{
|
|
327
|
+
${R}
|
|
328
|
+
}`);
|
|
329
|
+
}
|
|
330
|
+
C(
|
|
331
|
+
k,
|
|
332
|
+
g,
|
|
333
|
+
t,
|
|
334
|
+
i
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
} else if (m.isKind(f.FunctionDeclaration)) {
|
|
340
|
+
const p = m.getName(), g = p === void 0 ? void 0 : b?.get(p);
|
|
341
|
+
x(m, g, t, N);
|
|
342
|
+
} else if (m.isKind(f.InterfaceDeclaration)) {
|
|
343
|
+
const p = m.getName(), g = b?.get(p) ?? (p.endsWith("Properties") && w?.name === p.slice(0, -10) ? w : void 0);
|
|
344
|
+
x(m, g, t, N), g !== void 0 && C(m, g, t, i);
|
|
345
|
+
} else if (m.isKind(f.ClassDeclaration)) {
|
|
346
|
+
const p = m.getName(), g = p === void 0 ? void 0 : b?.get(p);
|
|
347
|
+
x(m, g, t, N), g !== void 0 && C(m, g, t, i);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return G(r);
|
|
351
|
+
} catch (a) {
|
|
352
|
+
var l = a, u = !0;
|
|
353
|
+
} finally {
|
|
354
|
+
E(o, l, u);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
async function re(n) {
|
|
358
|
+
const e = W(n.cwd, "vite.config.ts");
|
|
359
|
+
if (!await U(e))
|
|
360
|
+
return;
|
|
361
|
+
const i = await j(e, "utf-8");
|
|
362
|
+
if (!i.includes("useLumina"))
|
|
363
|
+
return;
|
|
364
|
+
const r = [
|
|
365
|
+
"copyDefinitions",
|
|
366
|
+
"apiJsonFileName",
|
|
367
|
+
"publicStoryUrlPrefix",
|
|
368
|
+
"getComponentDocsUrl",
|
|
369
|
+
"getComponentDemoUrl",
|
|
370
|
+
"compilerOptions",
|
|
371
|
+
"tsconfigPath",
|
|
372
|
+
"afterDiagnostic",
|
|
373
|
+
"typeScriptInstanceCreated",
|
|
374
|
+
"declarationTextTransformers",
|
|
375
|
+
"DeclarationTextTransformer",
|
|
376
|
+
"DeclarationFile",
|
|
377
|
+
"ApiJsonOptions",
|
|
378
|
+
"afterCreate"
|
|
379
|
+
].filter(
|
|
380
|
+
(s) => i.match(new RegExp(`\\b${s}\\b`, "u"))
|
|
381
|
+
);
|
|
382
|
+
r.length > 0 && y(
|
|
383
|
+
"warn",
|
|
384
|
+
n.logName,
|
|
385
|
+
`Found deprecated options in ${e}: ${r.join(", ")}. Please refactor these out to equivalents specific in their deprecation messages (see vscode tooltips). See https://webgis.esri.com/references/api-extractor/running-standalone for an example api-extractor.config.ts. You do not need to re-run the codemod.
|
|
386
|
+
`
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
function se(n) {
|
|
390
|
+
const e = n.getFullText(), i = e.indexOf("identity<typeof");
|
|
391
|
+
if (i === -1)
|
|
392
|
+
return;
|
|
393
|
+
const d = e.indexOf(`
|
|
394
|
+
`, i), r = e.slice(i, d === -1 ? 20 : d).trim();
|
|
395
|
+
y(
|
|
396
|
+
"error",
|
|
397
|
+
n.getFilePath(),
|
|
398
|
+
`Found a t9n type workaround: ${r}. This is no longer necessary - you can directly use the t9n json type like \`typeof T9nStrings>\``
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
function C(n, e, i, d) {
|
|
402
|
+
const r = e.docsTags?.some((o) => o.name === "internal") ?? !1, s = new Map(e.members?.map((o) => [q(o), o]) ?? []);
|
|
403
|
+
let t, c = !1;
|
|
404
|
+
for (const o of n.getMembers())
|
|
405
|
+
if (o.isKind(f.Constructor) || o.isKind(f.ConstructSignature))
|
|
406
|
+
x(o, s.get("constructor"), i, r), c = !0;
|
|
407
|
+
else if (o.isKind(f.CallSignature))
|
|
408
|
+
x(o, s.get("call-signature"), i, r);
|
|
409
|
+
else if (o.isKind(f.MethodDeclaration) || o.isKind(f.MethodSignature) || o.isKind(f.PropertySignature)) {
|
|
410
|
+
const a = o.getNameNode().asKind(f.StringLiteral)?.getLiteralText() ?? o.getName();
|
|
411
|
+
x(o, s.get(a), i, r);
|
|
412
|
+
} else if (o.isKind(f.GetAccessor) || o.isKind(f.SetAccessor)) {
|
|
413
|
+
const a = o.getNameNode().asKind(f.StringLiteral)?.getLiteralText() ?? o.getName(), l = o.getNextSibling();
|
|
414
|
+
!(o.getJsDocs().length === 0 && l !== void 0 && (l.isKind(f.GetAccessor) || l.isKind(f.SetAccessor)) && l.getName() === o.getName()) && // Don't attach the JSDoc if we already attached to the previous node
|
|
415
|
+
t !== a && (x(o, s.get(a), i, r), t = a);
|
|
416
|
+
} else if (o.isKind(f.PropertyDeclaration)) {
|
|
417
|
+
if (o.getInitializer()?.asKind(f.CallExpression)?.getExpression().asKind(f.Identifier)?.getText() === "useT9n")
|
|
418
|
+
continue;
|
|
419
|
+
const l = o.getNameNode().asKind(f.StringLiteral)?.getLiteralText() ?? o.getName();
|
|
420
|
+
x(
|
|
421
|
+
o,
|
|
422
|
+
s.get(l) ?? ("events" in e ? e.events?.find((u) => u.name === l) : void 0),
|
|
423
|
+
i,
|
|
424
|
+
r
|
|
425
|
+
);
|
|
426
|
+
} else o.isKind(f.IndexSignature) && x(o, e, i, r);
|
|
427
|
+
!c && e.kind === "class" && e.customElement !== !0 && y(
|
|
428
|
+
"warn",
|
|
429
|
+
d.logName,
|
|
430
|
+
`${e.name} doesn't have a @public constructor, so it will appear as abstract class in the docs and public types. If you wish to expose the ability for users to construct instances of this class, add a @public constructor to it. Documentation: https://webgis.esri.com/references/api-extractor/api-node-kinds#constructor
|
|
431
|
+
`
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
export {
|
|
435
|
+
we as codemod
|
|
436
|
+
};
|
|
@@ -29,10 +29,11 @@ var p = (o, i, r) => {
|
|
|
29
29
|
};
|
|
30
30
|
return s();
|
|
31
31
|
};
|
|
32
|
-
import { f as k,
|
|
32
|
+
import { f as k, p as u } from "./actions-TqvlTKWR.js";
|
|
33
33
|
import { log as g } from "@arcgis/toolkit/log";
|
|
34
|
-
import { writeFile as
|
|
35
|
-
import {
|
|
34
|
+
import { writeFile as E } from "node:fs/promises";
|
|
35
|
+
import { c as b } from "./useProjectInstance-C9i4ViQD.js";
|
|
36
|
+
import { p as h, g as y } from "./cli-CqB-08tZ.js";
|
|
36
37
|
async function L(o, i) {
|
|
37
38
|
const r = /* @__PURE__ */ new Set();
|
|
38
39
|
for (const a of o) {
|
|
@@ -43,7 +44,7 @@ async function L(o, i) {
|
|
|
43
44
|
const s = t.contents;
|
|
44
45
|
try {
|
|
45
46
|
const e = await i(s, t.filePath);
|
|
46
|
-
s !== e && await
|
|
47
|
+
s !== e && await E(t.filePath, `${JSON.stringify(e, null, 2)}
|
|
47
48
|
`, "utf8");
|
|
48
49
|
} catch (e) {
|
|
49
50
|
process.exitCode = 1, g(
|
|
@@ -65,7 +66,7 @@ function P(o, i) {
|
|
|
65
66
|
}
|
|
66
67
|
return o;
|
|
67
68
|
}
|
|
68
|
-
const
|
|
69
|
+
const F = {
|
|
69
70
|
meta: {
|
|
70
71
|
needsTypeInformation: !1
|
|
71
72
|
},
|
|
@@ -84,9 +85,9 @@ const C = {
|
|
|
84
85
|
for (const s of o) {
|
|
85
86
|
var i = [];
|
|
86
87
|
try {
|
|
87
|
-
const e = p(i,
|
|
88
|
+
const e = p(i, b(s));
|
|
88
89
|
for (const n of e.getCodemodFiles())
|
|
89
|
-
|
|
90
|
+
u(n, {
|
|
90
91
|
"@arcgis/components-utils": {
|
|
91
92
|
// Deprecated
|
|
92
93
|
setFocusOnElement: [{ do: "deprecate" }, { do: "rename", specifier: "@arcgis/toolkit/dom" }],
|
|
@@ -152,5 +153,5 @@ const C = {
|
|
|
152
153
|
}
|
|
153
154
|
};
|
|
154
155
|
export {
|
|
155
|
-
|
|
156
|
+
F as codemod
|
|
156
157
|
};
|