@arcgis/codemod 6.0.0-next.44 → 6.0.0-next.45
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 +73 -6
- package/dist/chunks/actions.js +261 -249
- package/dist/chunks/aggregateUsages.js +11 -10
- package/dist/chunks/apiName.js +123 -0
- package/dist/chunks/auditDefinitions.js +49 -47
- package/dist/chunks/auditUsages.js +649 -647
- package/dist/chunks/classification.js +73 -192
- package/dist/chunks/cli.js +52 -52
- package/dist/chunks/codemod.js +46 -46
- package/dist/chunks/codemod10.js +6039 -63
- package/dist/chunks/codemod11.js +54 -45
- package/dist/chunks/codemod12.js +74 -0
- package/dist/chunks/codemod9.js +218 -6017
- package/dist/chunks/componentAudit.js +141 -216
- package/dist/chunks/format.js +8 -7
- package/dist/chunks/hardcodedBehavior.js +96 -0
- package/dist/chunks/sync.js +1 -1
- package/package.json +4 -4
|
@@ -1,272 +1,197 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { asyncFindPath as h } from "@arcgis/node-toolkit/file";
|
|
2
|
+
import { asyncRetrievePackageJson as b } from "@arcgis/node-toolkit/packageJson";
|
|
3
3
|
import { path as p } from "@arcgis/node-toolkit/path";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return e.replace(
|
|
18
|
-
/\{@link(?:code|plain)?\s+([\s\S]*?)\}/gu,
|
|
19
|
-
(n, s) => D(s)
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
function T(e) {
|
|
23
|
-
const n = /^\{@link(?:code|plain)?\s+([\s\S]*?)\}$/u.exec(e)?.[1];
|
|
24
|
-
return n === void 0 ? e : D(n);
|
|
25
|
-
}
|
|
26
|
-
function D(e) {
|
|
27
|
-
const n = e.trim().replace(/^(\S+)\s+([/:#!.])/u, "$1$2"), s = n.indexOf("|");
|
|
28
|
-
if (s !== -1)
|
|
29
|
-
return n.slice(s + 1).trim() || n.slice(0, s).trim();
|
|
30
|
-
const [a, ...i] = n.split(/\s+/u);
|
|
31
|
-
return i.join(" ") || a;
|
|
32
|
-
}
|
|
33
|
-
function G(e, n) {
|
|
34
|
-
const s = P("package.json", e);
|
|
35
|
-
return s === void 0 ? n : w(p.dirname(s)).name ?? n;
|
|
36
|
-
}
|
|
37
|
-
const S = {
|
|
38
|
-
docsLegacyDependencyLocations: /* @__PURE__ */ new Map([
|
|
39
|
-
["@arcgis/coding-components", "packages/coding-packages/coding-components"],
|
|
40
|
-
["@arcgis/core", "packages/core-packages/core/output/npm/esm"],
|
|
41
|
-
["@arcgis/lumina", "packages/support-packages/lit"],
|
|
42
|
-
["@arcgis/map-components", "packages/map-packages/map-components"],
|
|
43
|
-
["@arcgis/toolkit", "packages/support-packages/toolkit"],
|
|
44
|
-
["@esri/calcite-components", "packages/map-packages/map-components/node_modules/@esri/calcite-components"],
|
|
45
|
-
["@esri/calcite-components-react", "packages/docs/app/node_modules/@esri/calcite-components-react"],
|
|
46
|
-
["monaco-editor", "packages/docs/app/node_modules/monaco-editor"]
|
|
47
|
-
]),
|
|
48
|
-
excludedDefinitionPathFragments: ["test-package", "packages/docs/lumina-code-samples/", "packages/starter-packages/"]
|
|
49
|
-
};
|
|
50
|
-
function H(e) {
|
|
51
|
-
const n = /* @__PURE__ */ new Map(), s = {};
|
|
52
|
-
if (e?.contents.name !== "@webgis/docs")
|
|
53
|
-
return { packages: n, paths: s };
|
|
54
|
-
const a = p.dirname(e.filePath), i = p.resolve(a, "../../..");
|
|
55
|
-
if (p.relative(i, a) !== "packages/docs/app" || !l.sys.fileExists(p.join(i, "pnpm-workspace.yaml")))
|
|
56
|
-
return { packages: n, paths: s };
|
|
57
|
-
const o = new Set(
|
|
58
|
-
Object.entries({
|
|
59
|
-
...e.contents.dependencies,
|
|
60
|
-
...e.contents.devDependencies,
|
|
61
|
-
...e.contents.peerDependencies,
|
|
62
|
-
...e.contents.optionalDependencies
|
|
63
|
-
}).filter(([, t]) => t === "catalog:legacyStarshipDeps").map(([t]) => t)
|
|
64
|
-
);
|
|
65
|
-
if (o.size === 0)
|
|
66
|
-
throw Error(
|
|
67
|
-
"Didn't find any catalog:legacyStarshipDeps in @webgis/docs. Update special handling in @arcgis/codemod"
|
|
68
|
-
);
|
|
69
|
-
for (const t of o) {
|
|
70
|
-
const d = S.docsLegacyDependencyLocations.get(t);
|
|
71
|
-
if (d === void 0)
|
|
72
|
-
throw new Error(
|
|
73
|
-
`Unmapped legacy dependency ${t} in @webgis/docs. Update special handling in @arcgis/codemod.`
|
|
74
|
-
);
|
|
75
|
-
const c = p.join(i, d), r = p.join(c, "package.json");
|
|
76
|
-
if (!l.sys.fileExists(r))
|
|
77
|
-
throw new Error(
|
|
78
|
-
`Missing audit dependency ${t} at ${r}. Install dependencies and build workspace packages before auditing usages.`
|
|
79
|
-
);
|
|
80
|
-
const f = w(c);
|
|
81
|
-
n.set(t, r);
|
|
82
|
-
for (const [m, u] of Object.entries(
|
|
83
|
-
f.exports ?? { ".": f.types ?? "./index.d.ts", "./*": "./*" }
|
|
84
|
-
)) {
|
|
85
|
-
const h = typeof u == "string" ? u : u.types;
|
|
86
|
-
h !== void 0 && (s[m === "." ? t : `${t}/${m.slice(2)}`] = [p.resolve(c, h)]);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return { packages: n, paths: s };
|
|
90
|
-
}
|
|
91
|
-
function Q(e) {
|
|
92
|
-
return $(e) || S.excludedDefinitionPathFragments.some((n) => e.includes(n));
|
|
93
|
-
}
|
|
94
|
-
function C(e, n, s, a) {
|
|
95
|
-
const i = [];
|
|
96
|
-
for (const o of e.events ?? [])
|
|
97
|
-
o.deprecated !== !0 && typeof o.deprecated != "string" || i.push({
|
|
98
|
-
package: a,
|
|
99
|
-
module: n,
|
|
100
|
-
name: o.name,
|
|
4
|
+
import { log as w } from "@arcgis/toolkit/log";
|
|
5
|
+
import { realpath as g, readFile as y, readdir as k } from "node:fs/promises";
|
|
6
|
+
import { f as v } from "./log.js";
|
|
7
|
+
import { e as P } from "./cli.js";
|
|
8
|
+
import { s as E } from "./classification.js";
|
|
9
|
+
import N from "typescript";
|
|
10
|
+
function x(n, i, o, r) {
|
|
11
|
+
const s = [];
|
|
12
|
+
for (const t of n.events ?? [])
|
|
13
|
+
t.deprecated !== !0 && typeof t.deprecated != "string" || s.push({
|
|
14
|
+
package: r,
|
|
15
|
+
module: i,
|
|
16
|
+
name: t.name,
|
|
101
17
|
kind: "field",
|
|
102
|
-
memberOf:
|
|
103
|
-
event: { tagName:
|
|
18
|
+
memberOf: n.name,
|
|
19
|
+
event: { tagName: n.tagName, name: t.name },
|
|
104
20
|
provenance: "manifest",
|
|
105
|
-
reason: typeof
|
|
106
|
-
sourceFileName:
|
|
21
|
+
reason: typeof t.deprecated == "string" ? t.deprecated : void 0,
|
|
22
|
+
sourceFileName: o,
|
|
107
23
|
line: 1,
|
|
108
24
|
column: 1
|
|
109
25
|
});
|
|
110
|
-
return
|
|
26
|
+
return s;
|
|
111
27
|
}
|
|
112
|
-
function
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
-
for (const
|
|
116
|
-
if (!
|
|
28
|
+
function B(n, i, o, r) {
|
|
29
|
+
const s = n.tagName.getText(i), t = o.components.get(s);
|
|
30
|
+
if (t?.length === 1)
|
|
31
|
+
for (const e of n.attributes.properties) {
|
|
32
|
+
if (!N.isJsxAttribute(e))
|
|
117
33
|
continue;
|
|
118
|
-
const d =
|
|
119
|
-
({ event:
|
|
34
|
+
const d = e.name.getText(i), a = t[0].definitions.find(
|
|
35
|
+
({ event: c }) => c?.tagName === s && (d === `on${c.name}` || d === `on${c.name[0].toUpperCase()}${c.name.slice(1)}`)
|
|
120
36
|
);
|
|
121
|
-
|
|
37
|
+
a !== void 0 && r(a, e.name.getStart(i), e.name.getWidth(i));
|
|
122
38
|
}
|
|
123
39
|
}
|
|
124
|
-
function
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
40
|
+
function M(n, i, o) {
|
|
41
|
+
const r = JSON.parse(n), s = {
|
|
42
|
+
modulePaths: /* @__PURE__ */ new Map(),
|
|
43
|
+
definitions: [],
|
|
44
|
+
components: /* @__PURE__ */ new Set(),
|
|
45
|
+
componentTypes: []
|
|
46
|
+
};
|
|
47
|
+
for (const t of r.modules) {
|
|
48
|
+
t.sourcePath !== void 0 && s.modulePaths.set(E(t.sourcePath), t.path);
|
|
49
|
+
for (const e of t.declarations ?? []) {
|
|
50
|
+
let d = function(c, f, m, u) {
|
|
51
|
+
m !== !0 && typeof m != "string" || s.definitions.push({
|
|
52
|
+
package: o,
|
|
53
|
+
module: t.path,
|
|
54
|
+
name: u ?? c,
|
|
134
55
|
kind: u === void 0 ? f : "field",
|
|
135
|
-
memberOf: u === void 0 ? f === "element" ? void 0 :
|
|
136
|
-
...u === void 0 ? {} : { attribute: { tagName:
|
|
56
|
+
memberOf: u === void 0 ? f === "element" ? void 0 : a : e.name,
|
|
57
|
+
...u === void 0 ? {} : { attribute: { tagName: a, name: c } },
|
|
137
58
|
provenance: "manifest",
|
|
138
59
|
reason: typeof m == "string" ? m : void 0,
|
|
139
|
-
sourceFileName:
|
|
60
|
+
sourceFileName: i,
|
|
140
61
|
line: 1,
|
|
141
62
|
column: 1
|
|
142
63
|
});
|
|
143
64
|
};
|
|
144
|
-
if (!("tagName" in
|
|
65
|
+
if (!("tagName" in e) || e.tagName === void 0)
|
|
145
66
|
continue;
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
67
|
+
const a = e.tagName;
|
|
68
|
+
s.components.add(a), "customElement" in e && e.privacy === void 0 && !e.abstract && s.componentTypes.push({
|
|
69
|
+
name: e.name,
|
|
70
|
+
tagName: a,
|
|
71
|
+
pascalCaseName: e.pascalCaseName,
|
|
72
|
+
typeParameters: e.typeParameters,
|
|
73
|
+
events: e.events,
|
|
74
|
+
packageName: o,
|
|
75
|
+
manifestFileName: i,
|
|
76
|
+
modulePath: t.path
|
|
77
|
+
}), d(a, "element", e.deprecated);
|
|
78
|
+
for (const [c, f] of [
|
|
149
79
|
["cssProperties", "css-property"],
|
|
150
80
|
["cssParts", "css-part"],
|
|
151
81
|
["cssStates", "css-state"],
|
|
152
82
|
["slots", "slot"]
|
|
153
83
|
])
|
|
154
|
-
for (const m of
|
|
155
|
-
|
|
156
|
-
for (const
|
|
157
|
-
d(
|
|
158
|
-
|
|
84
|
+
for (const m of e[c] ?? [])
|
|
85
|
+
c === "slots" && m.name === "" || d(m.name, f, m.deprecated);
|
|
86
|
+
for (const c of e.attributes ?? [])
|
|
87
|
+
d(c.name, "attribute", c.deprecated, c.fieldName);
|
|
88
|
+
s.definitions.push(...x(e, t.path, i, o));
|
|
159
89
|
}
|
|
160
90
|
}
|
|
161
|
-
return
|
|
162
|
-
}
|
|
163
|
-
function
|
|
164
|
-
const
|
|
165
|
-
for (const
|
|
166
|
-
for (const
|
|
167
|
-
const d =
|
|
168
|
-
d.push(
|
|
91
|
+
return s;
|
|
92
|
+
}
|
|
93
|
+
function F(n) {
|
|
94
|
+
const i = n.flatMap((t) => t.definitions), o = /* @__PURE__ */ new Map();
|
|
95
|
+
for (const t of n)
|
|
96
|
+
for (const e of t.components) {
|
|
97
|
+
const d = o.get(e) ?? [];
|
|
98
|
+
d.push(t), o.set(e, d);
|
|
169
99
|
}
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
({ name:
|
|
100
|
+
const r = /* @__PURE__ */ new Map(), s = Map.groupBy(
|
|
101
|
+
i.filter(({ kind: t }) => t === "css-property"),
|
|
102
|
+
({ name: t }) => t
|
|
173
103
|
);
|
|
174
|
-
for (const [
|
|
175
|
-
new Set(
|
|
176
|
-
return { hasDeprecatedApis:
|
|
177
|
-
}
|
|
178
|
-
function
|
|
179
|
-
const
|
|
180
|
-
return async (
|
|
181
|
-
const
|
|
182
|
-
let
|
|
183
|
-
return
|
|
184
|
-
if (
|
|
104
|
+
for (const [t, e] of s)
|
|
105
|
+
new Set(e.map((d) => d.package)).size === 1 && r.set(t, e[0]);
|
|
106
|
+
return { hasDeprecatedApis: i.length > 0, components: o, cssVariables: r };
|
|
107
|
+
}
|
|
108
|
+
function W(n = "warn", i) {
|
|
109
|
+
const o = /* @__PURE__ */ new Map();
|
|
110
|
+
return async (r) => {
|
|
111
|
+
const s = await g(r);
|
|
112
|
+
let t = o.get(s);
|
|
113
|
+
return t === void 0 && (t = $(s, i).catch((e) => {
|
|
114
|
+
if (i?.(), n === "throw")
|
|
185
115
|
throw new Error(
|
|
186
|
-
`Unable to read component manifest for ${
|
|
187
|
-
{ cause:
|
|
116
|
+
`Unable to read component manifest for ${s}. Build the package before auditing definitions.`,
|
|
117
|
+
{ cause: e }
|
|
188
118
|
);
|
|
189
|
-
|
|
190
|
-
}),
|
|
119
|
+
w("warn", v(s), `Unable to read component manifest: ${String(e)}`);
|
|
120
|
+
}), o.set(s, t)), await t;
|
|
191
121
|
};
|
|
192
122
|
}
|
|
193
|
-
async function
|
|
194
|
-
const
|
|
195
|
-
...Object.keys(
|
|
196
|
-
...Object.keys(
|
|
197
|
-
...Object.keys(
|
|
198
|
-
...Object.keys(
|
|
199
|
-
]),
|
|
200
|
-
[...
|
|
201
|
-
const d =
|
|
123
|
+
async function _(n, i, o, r) {
|
|
124
|
+
const s = /* @__PURE__ */ new Set([
|
|
125
|
+
...Object.keys(n.contents.dependencies ?? {}),
|
|
126
|
+
...Object.keys(n.contents.devDependencies ?? {}),
|
|
127
|
+
...Object.keys(n.contents.peerDependencies ?? {}),
|
|
128
|
+
...Object.keys(n.contents.optionalDependencies ?? {})
|
|
129
|
+
]), t = await Promise.all(
|
|
130
|
+
[...s].filter((e) => e !== n.contents.name && (!o || P(e))).map(async (e) => {
|
|
131
|
+
const d = r?.get(e) ?? await h(p.join("node_modules", e, "package.json"), p.dirname(n.filePath));
|
|
202
132
|
if (d === void 0)
|
|
203
133
|
return [];
|
|
204
|
-
const
|
|
134
|
+
const a = await i(d), c = e === "@esri/calcite-components" ? await h(
|
|
205
135
|
"node_modules/@esri/calcite-design-tokens/package.json",
|
|
206
|
-
p.dirname(await
|
|
136
|
+
p.dirname(await g(d))
|
|
207
137
|
) : void 0;
|
|
208
|
-
return [
|
|
138
|
+
return [a, c === void 0 ? void 0 : await i(c)];
|
|
209
139
|
})
|
|
210
140
|
);
|
|
211
|
-
return [...new Set(
|
|
141
|
+
return [...new Set(t.flat().filter((e) => e !== void 0))];
|
|
212
142
|
}
|
|
213
|
-
async function
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
143
|
+
async function $(n, i) {
|
|
144
|
+
const o = p.dirname(n), r = await b(o);
|
|
145
|
+
if (r.name === "@esri/calcite-design-tokens")
|
|
216
146
|
try {
|
|
217
|
-
return await
|
|
218
|
-
} catch (
|
|
219
|
-
|
|
147
|
+
return await S(o, r.name);
|
|
148
|
+
} catch (e) {
|
|
149
|
+
i?.(), w("error", v(o), `Calcite design tokens integration is out of date: ${String(e)}`);
|
|
220
150
|
return;
|
|
221
151
|
}
|
|
222
|
-
const
|
|
223
|
-
if (
|
|
152
|
+
const s = typeof r.customElements == "string" ? r.customElements : r.customElements?.[0];
|
|
153
|
+
if (s === void 0)
|
|
224
154
|
return;
|
|
225
|
-
const
|
|
226
|
-
return
|
|
227
|
-
}
|
|
228
|
-
async function
|
|
229
|
-
const
|
|
230
|
-
if (
|
|
231
|
-
throw new Error(`Missing token documentation JSON files in ${
|
|
232
|
-
for (const
|
|
233
|
-
const
|
|
234
|
-
if (!
|
|
235
|
-
throw new Error(`Expected a tokens array in ${
|
|
236
|
-
for (const
|
|
237
|
-
if (!
|
|
238
|
-
throw new Error(`Expected token attributes.docs/status and attributes.names.css in ${
|
|
239
|
-
if (
|
|
155
|
+
const t = await g(p.resolve(o, s));
|
|
156
|
+
return M(await y(t, "utf8"), t, r.name);
|
|
157
|
+
}
|
|
158
|
+
async function S(n, i) {
|
|
159
|
+
const o = p.join(n, "dist/docs"), r = /* @__PURE__ */ new Map(), s = (await k(o)).filter((t) => t.endsWith(".json")).sort();
|
|
160
|
+
if (s.length === 0)
|
|
161
|
+
throw new Error(`Missing token documentation JSON files in ${o}`);
|
|
162
|
+
for (const t of s) {
|
|
163
|
+
const e = await g(p.join(o, t)), d = JSON.parse(await y(e, "utf8"));
|
|
164
|
+
if (!l(d) || !Array.isArray(d.tokens))
|
|
165
|
+
throw new Error(`Expected a tokens array in ${e}`);
|
|
166
|
+
for (const a of d.tokens) {
|
|
167
|
+
if (!l(a) || !l(a.attributes) || a.attributes.docs !== void 0 && typeof a.attributes.docs != "string" || a.attributes.status !== void 0 && typeof a.attributes.status != "string" || !l(a.attributes.names) || typeof a.attributes.names.css != "string" || !/^var\(--[-\w]+\)$/u.test(a.attributes.names.css))
|
|
168
|
+
throw new Error(`Expected token attributes.docs/status and attributes.names.css in ${e}`);
|
|
169
|
+
if (a.attributes.docs !== "deprecated" && a.attributes.status !== "deprecated")
|
|
240
170
|
continue;
|
|
241
|
-
const
|
|
242
|
-
if (typeof
|
|
243
|
-
throw new Error(`Expected a deprecated token's $description or description in ${
|
|
244
|
-
const f =
|
|
245
|
-
|
|
246
|
-
package:
|
|
171
|
+
const c = a.$description ?? a.description;
|
|
172
|
+
if (typeof c != "string")
|
|
173
|
+
throw new Error(`Expected a deprecated token's $description or description in ${e}`);
|
|
174
|
+
const f = a.attributes.names.css.slice(4, -1);
|
|
175
|
+
r.has(f) || r.set(f, {
|
|
176
|
+
package: i,
|
|
247
177
|
name: f,
|
|
248
178
|
kind: "css-property",
|
|
249
179
|
provenance: "manifest",
|
|
250
|
-
reason:
|
|
251
|
-
sourceFileName:
|
|
180
|
+
reason: c,
|
|
181
|
+
sourceFileName: e,
|
|
252
182
|
line: 1,
|
|
253
183
|
column: 1
|
|
254
184
|
});
|
|
255
185
|
}
|
|
256
186
|
}
|
|
257
|
-
return { modulePaths: /* @__PURE__ */ new Map(), definitions: [...
|
|
187
|
+
return { modulePaths: /* @__PURE__ */ new Map(), definitions: [...r.values()], components: /* @__PURE__ */ new Set() };
|
|
258
188
|
}
|
|
259
|
-
function
|
|
260
|
-
return typeof
|
|
189
|
+
function l(n) {
|
|
190
|
+
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
261
191
|
}
|
|
262
192
|
export {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
Z as e,
|
|
268
|
-
Q as f,
|
|
269
|
-
H as g,
|
|
270
|
-
ee as l,
|
|
271
|
-
X as s
|
|
193
|
+
F as a,
|
|
194
|
+
W as c,
|
|
195
|
+
_ as l,
|
|
196
|
+
B as s
|
|
272
197
|
};
|
package/dist/chunks/format.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { j as D, k as P, l as K, d as w } from "./cli.js";
|
|
2
|
-
import {
|
|
2
|
+
import { d as h, g as B } from "./classification.js";
|
|
3
|
+
import { b as f, d as y } from "./apiName.js";
|
|
3
4
|
import { markdownTextLimit as M, splitMarkdown as L } from "@arcgis/node-toolkit/markdown";
|
|
4
5
|
const $ = {
|
|
5
6
|
usages: "arcgisCodemodAuditUsages",
|
|
6
7
|
definitions: "arcgisCodemodAuditDefinitions"
|
|
7
8
|
};
|
|
8
|
-
function
|
|
9
|
+
function Y(n) {
|
|
9
10
|
const e = j(n, n.findings);
|
|
10
11
|
return `${e.summary.trim().replace(/^### /u, "## ")}
|
|
11
12
|
|
|
12
13
|
${e.details}`;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function Z(n, e = () => []) {
|
|
15
16
|
const o = /* @__PURE__ */ new Map();
|
|
16
17
|
for (const s of n.findings) {
|
|
17
18
|
const r = d(s.codeowners), t = r.join(","), i = o.get(t) ?? [];
|
|
@@ -156,7 +157,7 @@ function x(n, e = "usages") {
|
|
|
156
157
|
const o = d(n).join(",");
|
|
157
158
|
return `<!-- ${$[e]}${o === "" ? "" : ` owners=${o}`} -->`;
|
|
158
159
|
}
|
|
159
|
-
function
|
|
160
|
+
function F(n) {
|
|
160
161
|
const e = n?.split(`
|
|
161
162
|
`, 1)[0];
|
|
162
163
|
if (e === void 0)
|
|
@@ -206,7 +207,7 @@ function H(n, e, o, s) {
|
|
|
206
207
|
export {
|
|
207
208
|
$ as a,
|
|
208
209
|
x as b,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
Z as c,
|
|
211
|
+
Y as f,
|
|
212
|
+
F as p
|
|
212
213
|
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import a from "typescript";
|
|
2
|
+
import { findPath as x } from "@arcgis/node-toolkit/file";
|
|
3
|
+
import { path as s } from "@arcgis/node-toolkit/path";
|
|
4
|
+
import { retrievePackageJson as k } from "@arcgis/node-toolkit/packageJson";
|
|
5
|
+
import { s as D } from "./cli.js";
|
|
6
|
+
function $(e) {
|
|
7
|
+
return typeof e == "string" ? e : e.map((n) => n.kind === a.SyntaxKind.JSDocText ? n.text : w(n.getText())).join("");
|
|
8
|
+
}
|
|
9
|
+
function E(e) {
|
|
10
|
+
return e === void 0 ? void 0 : S(a.displayPartsToString([...e]));
|
|
11
|
+
}
|
|
12
|
+
function S(e) {
|
|
13
|
+
return e.replace(
|
|
14
|
+
/\{@link(?:code|plain)?\s+([\s\S]*?)\}/gu,
|
|
15
|
+
(n, t) => y(t)
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function w(e) {
|
|
19
|
+
const n = /^\{@link(?:code|plain)?\s+([\s\S]*?)\}$/u.exec(e)?.[1];
|
|
20
|
+
return n === void 0 ? e : y(n);
|
|
21
|
+
}
|
|
22
|
+
function y(e) {
|
|
23
|
+
const n = e.trim().replace(/^(\S+)\s+([/:#!.])/u, "$1$2"), t = n.indexOf("|");
|
|
24
|
+
if (t !== -1)
|
|
25
|
+
return n.slice(t + 1).trim() || n.slice(0, t).trim();
|
|
26
|
+
const [i, ...c] = n.split(/\s+/u);
|
|
27
|
+
return c.join(" ") || i;
|
|
28
|
+
}
|
|
29
|
+
function L(e, n) {
|
|
30
|
+
const t = x("package.json", e);
|
|
31
|
+
return t === void 0 ? n : k(s.dirname(t)).name ?? n;
|
|
32
|
+
}
|
|
33
|
+
const h = {
|
|
34
|
+
docsLegacyDependencyLocations: /* @__PURE__ */ new Map([
|
|
35
|
+
["@arcgis/coding-components", "packages/coding-packages/coding-components"],
|
|
36
|
+
["@arcgis/core", "packages/core-packages/core/output/npm/esm"],
|
|
37
|
+
["@arcgis/lumina", "packages/support-packages/lit"],
|
|
38
|
+
["@arcgis/map-components", "packages/map-packages/map-components"],
|
|
39
|
+
["@arcgis/toolkit", "packages/support-packages/toolkit"],
|
|
40
|
+
["@esri/calcite-components", "packages/map-packages/map-components/node_modules/@esri/calcite-components"],
|
|
41
|
+
["@esri/calcite-components-react", "packages/docs/app/node_modules/@esri/calcite-components-react"],
|
|
42
|
+
["monaco-editor", "packages/docs/app/node_modules/monaco-editor"]
|
|
43
|
+
]),
|
|
44
|
+
excludedDefinitionPathFragments: ["test-package", "packages/docs/lumina-code-samples/", "packages/starter-packages/"]
|
|
45
|
+
};
|
|
46
|
+
function O(e) {
|
|
47
|
+
const n = /* @__PURE__ */ new Map(), t = {};
|
|
48
|
+
if (e?.contents.name !== "@webgis/docs")
|
|
49
|
+
return { packages: n, paths: t };
|
|
50
|
+
const i = s.dirname(e.filePath), c = s.resolve(i, "../../..");
|
|
51
|
+
if (s.relative(c, i) !== "packages/docs/app" || !a.sys.fileExists(s.join(c, "pnpm-workspace.yaml")))
|
|
52
|
+
return { packages: n, paths: t };
|
|
53
|
+
const g = new Set(
|
|
54
|
+
Object.entries({
|
|
55
|
+
...e.contents.dependencies,
|
|
56
|
+
...e.contents.devDependencies,
|
|
57
|
+
...e.contents.peerDependencies,
|
|
58
|
+
...e.contents.optionalDependencies
|
|
59
|
+
}).filter(([, o]) => o === "catalog:legacyStarshipDeps").map(([o]) => o)
|
|
60
|
+
);
|
|
61
|
+
if (g.size === 0)
|
|
62
|
+
throw Error(
|
|
63
|
+
"Didn't find any catalog:legacyStarshipDeps in @webgis/docs. Update special handling in @arcgis/codemod"
|
|
64
|
+
);
|
|
65
|
+
for (const o of g) {
|
|
66
|
+
const l = h.docsLegacyDependencyLocations.get(o);
|
|
67
|
+
if (l === void 0)
|
|
68
|
+
throw new Error(
|
|
69
|
+
`Unmapped legacy dependency ${o} in @webgis/docs. Update special handling in @arcgis/codemod.`
|
|
70
|
+
);
|
|
71
|
+
const r = s.join(c, l), p = s.join(r, "package.json");
|
|
72
|
+
if (!a.sys.fileExists(p))
|
|
73
|
+
throw new Error(
|
|
74
|
+
`Missing audit dependency ${o} at ${p}. Install dependencies and build workspace packages before auditing usages.`
|
|
75
|
+
);
|
|
76
|
+
const m = k(r);
|
|
77
|
+
n.set(o, p);
|
|
78
|
+
for (const [u, d] of Object.entries(
|
|
79
|
+
m.exports ?? { ".": m.types ?? "./index.d.ts", "./*": "./*" }
|
|
80
|
+
)) {
|
|
81
|
+
const f = typeof d == "string" ? d : d.types;
|
|
82
|
+
f !== void 0 && (t[u === "." ? o : `${o}/${u.slice(2)}`] = [s.resolve(r, f)]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return { packages: n, paths: t };
|
|
86
|
+
}
|
|
87
|
+
function _(e) {
|
|
88
|
+
return D(e) || h.excludedDefinitionPathFragments.some((n) => e.includes(n));
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
L as a,
|
|
92
|
+
$ as b,
|
|
93
|
+
E as c,
|
|
94
|
+
O as g,
|
|
95
|
+
_ as s
|
|
96
|
+
};
|
package/dist/chunks/sync.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile as j } from "node:fs/promises";
|
|
2
2
|
import { log as l } from "@arcgis/toolkit/log";
|
|
3
3
|
import { r as M } from "./log.js";
|
|
4
|
-
import {
|
|
4
|
+
import { i as x } from "./apiName.js";
|
|
5
5
|
import { h as d } from "./cli.js";
|
|
6
6
|
import { c as O, a as N, p as C, b as v } from "./format.js";
|
|
7
7
|
import { G as R, l as T, n as I, s as z, p as B, a as D, i as G } from "./legacyCompatibility.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/codemod",
|
|
3
|
-
"version": "6.0.0-next.
|
|
3
|
+
"version": "6.0.0-next.45",
|
|
4
4
|
"description": "A codemod toolkit for updating and modernizing ArcGIS Maps SDK for JavaScript codebases.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
],
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@arcgis/api-extractor": "6.0.0-next.
|
|
15
|
-
"@arcgis/node-toolkit": "6.0.0-next.
|
|
16
|
-
"@arcgis/toolkit": "6.0.0-next.
|
|
14
|
+
"@arcgis/api-extractor": "6.0.0-next.45",
|
|
15
|
+
"@arcgis/node-toolkit": "6.0.0-next.45",
|
|
16
|
+
"@arcgis/toolkit": "6.0.0-next.45",
|
|
17
17
|
"@commander-js/extra-typings": "^15.1.0",
|
|
18
18
|
"commander": "^15.1.0",
|
|
19
19
|
"picomatch": "^4.0.4",
|