@arcgis/codemod 6.0.0-next.3 → 6.0.0-next.31
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/chunks/classification.js +168 -126
- package/dist/chunks/cli.js +394 -228
- package/dist/chunks/codemod5.js +0 -1
- package/dist/chunks/codemod7.js +1214 -1232
- package/dist/chunks/componentAudit.js +272 -0
- package/dist/chunks/format.js +140 -112
- package/dist/chunks/index.js +1087 -312
- package/dist/chunks/index2.js +112 -99
- package/dist/chunks/index3.js +351 -0
- package/dist/chunks/legacyCompatibility.js +210 -0
- package/dist/chunks/sync.js +146 -142
- package/dist/chunks/syncMarkdown.js +42 -0
- package/dist/chunks/useProjectInstance.js +27 -24
- package/package.json +8 -5
- package/dist/chunks/hardcodedBehavior.js +0 -63
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import l from "typescript";
|
|
2
|
+
import { findPath as P, asyncFindPath as y } from "@arcgis/node-toolkit/file";
|
|
3
|
+
import { path as p } from "@arcgis/node-toolkit/path";
|
|
4
|
+
import { retrievePackageJson as w, asyncRetrievePackageJson as E } from "@arcgis/node-toolkit/packageJson";
|
|
5
|
+
import { s as $, b as j } from "./cli.js";
|
|
6
|
+
import { log as v } from "@arcgis/toolkit/log";
|
|
7
|
+
import { realpath as k, readFile as b, readdir as M } from "node:fs/promises";
|
|
8
|
+
import { f as x } from "./log.js";
|
|
9
|
+
import { m as N } from "./classification.js";
|
|
10
|
+
function V(e) {
|
|
11
|
+
return typeof e == "string" ? e : e.map((n) => n.kind === l.SyntaxKind.JSDocText ? n.text : T(n.getText())).join("");
|
|
12
|
+
}
|
|
13
|
+
function q(e) {
|
|
14
|
+
return e === void 0 ? void 0 : O(l.displayPartsToString([...e]));
|
|
15
|
+
}
|
|
16
|
+
function O(e) {
|
|
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,
|
|
101
|
+
kind: "field",
|
|
102
|
+
memberOf: e.name,
|
|
103
|
+
event: { tagName: e.tagName, name: o.name },
|
|
104
|
+
provenance: "manifest",
|
|
105
|
+
reason: typeof o.deprecated == "string" ? o.deprecated : void 0,
|
|
106
|
+
sourceFileName: s,
|
|
107
|
+
line: 1,
|
|
108
|
+
column: 1
|
|
109
|
+
});
|
|
110
|
+
return i;
|
|
111
|
+
}
|
|
112
|
+
function X(e, n, s, a) {
|
|
113
|
+
const i = e.tagName.getText(n), o = s.components.get(i);
|
|
114
|
+
if (o?.length === 1)
|
|
115
|
+
for (const t of e.attributes.properties) {
|
|
116
|
+
if (!l.isJsxAttribute(t))
|
|
117
|
+
continue;
|
|
118
|
+
const d = t.name.getText(n), c = o[0].definitions.find(
|
|
119
|
+
({ event: r }) => r?.tagName === i && (d === `on${r.name}` || d === `on${r.name[0].toUpperCase()}${r.name.slice(1)}`)
|
|
120
|
+
);
|
|
121
|
+
c !== void 0 && a(c, t.name.getStart(n), t.name.getWidth(n));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function L(e, n, s) {
|
|
125
|
+
const a = JSON.parse(e), i = { modulePaths: /* @__PURE__ */ new Map(), definitions: [], components: /* @__PURE__ */ new Set() };
|
|
126
|
+
for (const o of a.modules) {
|
|
127
|
+
o.sourcePath !== void 0 && i.modulePaths.set(N(o.sourcePath), o.path);
|
|
128
|
+
for (const t of o.declarations ?? []) {
|
|
129
|
+
let d = function(r, f, m, u) {
|
|
130
|
+
m !== !0 && typeof m != "string" || i.definitions.push({
|
|
131
|
+
package: s,
|
|
132
|
+
module: o.path,
|
|
133
|
+
name: u ?? r,
|
|
134
|
+
kind: u === void 0 ? f : "field",
|
|
135
|
+
memberOf: u === void 0 ? f === "element" ? void 0 : c : t.name,
|
|
136
|
+
...u === void 0 ? {} : { attribute: { tagName: c, name: r } },
|
|
137
|
+
provenance: "manifest",
|
|
138
|
+
reason: typeof m == "string" ? m : void 0,
|
|
139
|
+
sourceFileName: n,
|
|
140
|
+
line: 1,
|
|
141
|
+
column: 1
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
if (!("tagName" in t) || t.tagName === void 0)
|
|
145
|
+
continue;
|
|
146
|
+
const c = t.tagName;
|
|
147
|
+
i.components.add(c), d(c, "element", t.deprecated);
|
|
148
|
+
for (const [r, f] of [
|
|
149
|
+
["cssProperties", "css-property"],
|
|
150
|
+
["cssParts", "css-part"],
|
|
151
|
+
["cssStates", "css-state"],
|
|
152
|
+
["slots", "slot"]
|
|
153
|
+
])
|
|
154
|
+
for (const m of t[r] ?? [])
|
|
155
|
+
r === "slots" && m.name === "" || d(m.name, f, m.deprecated);
|
|
156
|
+
for (const r of t.attributes ?? [])
|
|
157
|
+
d(r.name, "attribute", r.deprecated, r.fieldName);
|
|
158
|
+
i.definitions.push(...C(t, o.path, n, s));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return i;
|
|
162
|
+
}
|
|
163
|
+
function Y(e) {
|
|
164
|
+
const n = e.flatMap((o) => o.definitions), s = /* @__PURE__ */ new Map();
|
|
165
|
+
for (const o of e)
|
|
166
|
+
for (const t of o.components) {
|
|
167
|
+
const d = s.get(t) ?? [];
|
|
168
|
+
d.push(o), s.set(t, d);
|
|
169
|
+
}
|
|
170
|
+
const a = /* @__PURE__ */ new Map(), i = Map.groupBy(
|
|
171
|
+
n.filter(({ kind: o }) => o === "css-property"),
|
|
172
|
+
({ name: o }) => o
|
|
173
|
+
);
|
|
174
|
+
for (const [o, t] of i)
|
|
175
|
+
new Set(t.map((d) => d.package)).size === 1 && a.set(o, t[0]);
|
|
176
|
+
return { hasDeprecatedApis: n.length > 0, components: s, cssVariables: a };
|
|
177
|
+
}
|
|
178
|
+
function Z(e = "warn", n) {
|
|
179
|
+
const s = /* @__PURE__ */ new Map();
|
|
180
|
+
return async (a) => {
|
|
181
|
+
const i = await k(a);
|
|
182
|
+
let o = s.get(i);
|
|
183
|
+
return o === void 0 && (o = J(i, n).catch((t) => {
|
|
184
|
+
if (n?.(), e === "throw")
|
|
185
|
+
throw new Error(
|
|
186
|
+
`Unable to read component manifest for ${i}. Build the package before auditing definitions.`,
|
|
187
|
+
{ cause: t }
|
|
188
|
+
);
|
|
189
|
+
v("warn", x(i), `Unable to read component manifest: ${String(t)}`);
|
|
190
|
+
}), s.set(i, o)), await o;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
async function ee(e, n, s, a) {
|
|
194
|
+
const i = /* @__PURE__ */ new Set([
|
|
195
|
+
...Object.keys(e.contents.dependencies ?? {}),
|
|
196
|
+
...Object.keys(e.contents.devDependencies ?? {}),
|
|
197
|
+
...Object.keys(e.contents.peerDependencies ?? {}),
|
|
198
|
+
...Object.keys(e.contents.optionalDependencies ?? {})
|
|
199
|
+
]), o = await Promise.all(
|
|
200
|
+
[...i].filter((t) => t !== e.contents.name && (!s || j(t))).map(async (t) => {
|
|
201
|
+
const d = a?.get(t) ?? await y(p.join("node_modules", t, "package.json"), p.dirname(e.filePath));
|
|
202
|
+
if (d === void 0)
|
|
203
|
+
return [];
|
|
204
|
+
const c = await n(d), r = t === "@esri/calcite-components" ? await y(
|
|
205
|
+
"node_modules/@esri/calcite-design-tokens/package.json",
|
|
206
|
+
p.dirname(await k(d))
|
|
207
|
+
) : void 0;
|
|
208
|
+
return [c, r === void 0 ? void 0 : await n(r)];
|
|
209
|
+
})
|
|
210
|
+
);
|
|
211
|
+
return [...new Set(o.flat().filter((t) => t !== void 0))];
|
|
212
|
+
}
|
|
213
|
+
async function J(e, n) {
|
|
214
|
+
const s = p.dirname(e), a = await E(s);
|
|
215
|
+
if (a.name === "@esri/calcite-design-tokens")
|
|
216
|
+
try {
|
|
217
|
+
return await A(s, a.name);
|
|
218
|
+
} catch (t) {
|
|
219
|
+
n?.(), v("error", x(s), `Calcite design tokens integration is out of date: ${String(t)}`);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const i = typeof a.customElements == "string" ? a.customElements : a.customElements?.[0];
|
|
223
|
+
if (i === void 0)
|
|
224
|
+
return;
|
|
225
|
+
const o = await k(p.resolve(s, i));
|
|
226
|
+
return L(await b(o, "utf8"), o, a.name);
|
|
227
|
+
}
|
|
228
|
+
async function A(e, n) {
|
|
229
|
+
const s = p.join(e, "dist/docs"), a = /* @__PURE__ */ new Map(), i = (await M(s)).filter((o) => o.endsWith(".json")).sort();
|
|
230
|
+
if (i.length === 0)
|
|
231
|
+
throw new Error(`Missing token documentation JSON files in ${s}`);
|
|
232
|
+
for (const o of i) {
|
|
233
|
+
const t = await k(p.join(s, o)), d = JSON.parse(await b(t, "utf8"));
|
|
234
|
+
if (!g(d) || !Array.isArray(d.tokens))
|
|
235
|
+
throw new Error(`Expected a tokens array in ${t}`);
|
|
236
|
+
for (const c of d.tokens) {
|
|
237
|
+
if (!g(c) || !g(c.attributes) || c.attributes.docs !== void 0 && typeof c.attributes.docs != "string" || c.attributes.status !== void 0 && typeof c.attributes.status != "string" || !g(c.attributes.names) || typeof c.attributes.names.css != "string" || !/^var\(--[-\w]+\)$/u.test(c.attributes.names.css))
|
|
238
|
+
throw new Error(`Expected token attributes.docs/status and attributes.names.css in ${t}`);
|
|
239
|
+
if (c.attributes.docs !== "deprecated" && c.attributes.status !== "deprecated")
|
|
240
|
+
continue;
|
|
241
|
+
const r = c.$description ?? c.description;
|
|
242
|
+
if (typeof r != "string")
|
|
243
|
+
throw new Error(`Expected a deprecated token's $description or description in ${t}`);
|
|
244
|
+
const f = c.attributes.names.css.slice(4, -1);
|
|
245
|
+
a.has(f) || a.set(f, {
|
|
246
|
+
package: n,
|
|
247
|
+
name: f,
|
|
248
|
+
kind: "css-property",
|
|
249
|
+
provenance: "manifest",
|
|
250
|
+
reason: r,
|
|
251
|
+
sourceFileName: t,
|
|
252
|
+
line: 1,
|
|
253
|
+
column: 1
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return { modulePaths: /* @__PURE__ */ new Map(), definitions: [...a.values()], components: /* @__PURE__ */ new Set() };
|
|
258
|
+
}
|
|
259
|
+
function g(e) {
|
|
260
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
261
|
+
}
|
|
262
|
+
export {
|
|
263
|
+
G as a,
|
|
264
|
+
Z as b,
|
|
265
|
+
Y as c,
|
|
266
|
+
V as d,
|
|
267
|
+
q as e,
|
|
268
|
+
Q as f,
|
|
269
|
+
H as g,
|
|
270
|
+
ee as l,
|
|
271
|
+
X as s
|
|
272
|
+
};
|
package/dist/chunks/format.js
CHANGED
|
@@ -1,70 +1,81 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
import { o as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { h as D, j as P, k as K, d as w } from "./cli.js";
|
|
2
|
+
import { o as h, b as B, f, h as y } from "./classification.js";
|
|
3
|
+
import { markdownTextLimit as M, splitMarkdown as L } from "@arcgis/node-toolkit/markdown";
|
|
4
|
+
const $ = {
|
|
5
|
+
usages: "arcgisCodemodAuditUsages",
|
|
6
|
+
definitions: "arcgisCodemodAuditDefinitions"
|
|
7
|
+
};
|
|
8
|
+
function X(n) {
|
|
9
|
+
const e = j(n, n.findings);
|
|
10
|
+
return `${e.summary.trim().replace(/^### /u, "## ")}
|
|
7
11
|
|
|
8
|
-
${
|
|
12
|
+
${e.details}`;
|
|
9
13
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
for (const
|
|
13
|
-
const r =
|
|
14
|
-
|
|
14
|
+
function Y(n, e = () => []) {
|
|
15
|
+
const o = /* @__PURE__ */ new Map();
|
|
16
|
+
for (const s of n.findings) {
|
|
17
|
+
const r = d(s.codeowners), t = r.join(","), i = o.get(t) ?? [];
|
|
18
|
+
i.push({ ...s, codeowners: r }), o.set(t, i);
|
|
15
19
|
}
|
|
16
|
-
return [...
|
|
17
|
-
const
|
|
20
|
+
return [...o.entries()].map(([s, r]) => {
|
|
21
|
+
const t = s === "" ? [] : s.split(","), i = T(n, r);
|
|
18
22
|
return {
|
|
19
23
|
changes: [],
|
|
20
|
-
title:
|
|
21
|
-
owners:
|
|
22
|
-
assignees:
|
|
23
|
-
|
|
24
|
+
title: O(n.auditKind, r),
|
|
25
|
+
owners: t,
|
|
26
|
+
assignees: t.filter((c) => /^@[^/@\s]+$/u.test(c)).map((c) => c.slice(1)),
|
|
27
|
+
labels: e([...new Set(r.map((c) => c.file))]),
|
|
28
|
+
chunks: G(i, M, x(t, n.auditKind))
|
|
24
29
|
};
|
|
25
|
-
}).sort((
|
|
26
|
-
}
|
|
27
|
-
function
|
|
28
|
-
const o =
|
|
29
|
-
(i) =>
|
|
30
|
-
), r = o.length
|
|
30
|
+
}).sort((s, r) => s.owners.join(",").localeCompare(r.owners.join(",")));
|
|
31
|
+
}
|
|
32
|
+
function O(n, e) {
|
|
33
|
+
const o = [...new Set(e.map((i) => h(i.package, i.module)))].sort(
|
|
34
|
+
(i, c) => i.localeCompare(c)
|
|
35
|
+
), s = o.slice(0, 3).join(", "), r = o.length > 3 ? ` +${o.length - 3} more` : "", t = `${D[n]}: ${s}${r}`;
|
|
36
|
+
return t.length > 256 ? `${t.slice(0, 253)}...` : t;
|
|
37
|
+
}
|
|
38
|
+
function T(n, e) {
|
|
39
|
+
const o = d(e.flatMap((r) => r.codeowners)).filter(
|
|
40
|
+
(r) => /^@[^/@\s]+\/[^@\s]+$/u.test(r)
|
|
41
|
+
), s = o.length === 0 ? "" : `
|
|
31
42
|
|
|
32
43
|
CODEOWNERS: ${o.join(", ")}`;
|
|
33
|
-
return
|
|
44
|
+
return U(n, e, s);
|
|
34
45
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
return `${
|
|
46
|
+
function U(n, e, o) {
|
|
47
|
+
const s = P[n.auditKind], r = j(n, e);
|
|
48
|
+
return `${s}${o}${r.summary}
|
|
38
49
|
|
|
39
|
-
${
|
|
50
|
+
${K}
|
|
40
51
|
|
|
41
|
-
${
|
|
52
|
+
${r.details}`;
|
|
42
53
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
54
|
+
function j(n, e) {
|
|
55
|
+
return n.auditKind === "usages" ? z(n, e) : E(n, e);
|
|
45
56
|
}
|
|
46
|
-
function
|
|
47
|
-
const o =
|
|
48
|
-
const u =
|
|
57
|
+
function z(n, e) {
|
|
58
|
+
const o = I(e, "usages"), s = B(e, (i) => i), r = s.map(({ categoryName: i, count: c, packages: m }) => {
|
|
59
|
+
const u = m.map(({ displayName: p, count: a }) => ` - \`${p}\`: ${a}`).join(`
|
|
49
60
|
`);
|
|
50
|
-
return `- **${
|
|
61
|
+
return `- **${w[i].label}**: ${c}
|
|
51
62
|
${u}`;
|
|
52
63
|
}).join(`
|
|
53
|
-
`), t =
|
|
54
|
-
const u =
|
|
55
|
-
const
|
|
56
|
-
({ items:
|
|
64
|
+
`), t = s.map(({ categoryName: i, count: c, packages: m }) => {
|
|
65
|
+
const u = m.map(({ displayName: l, count: C, apis: v }) => {
|
|
66
|
+
const R = v.flatMap(
|
|
67
|
+
({ items: b }) => S(n, b, "usages", o)
|
|
57
68
|
);
|
|
58
|
-
return `#### ${
|
|
69
|
+
return `#### ${l} (${C})
|
|
59
70
|
|
|
60
|
-
${
|
|
71
|
+
${R.join(`
|
|
61
72
|
`)}`;
|
|
62
73
|
}).join(`
|
|
63
74
|
|
|
64
|
-
`), p =
|
|
75
|
+
`), p = w[i], a = "description" in p ? `
|
|
65
76
|
|
|
66
77
|
${p.description}` : "";
|
|
67
|
-
return `### ${p.label} (${c})${
|
|
78
|
+
return `### ${p.label} (${c})${a}
|
|
68
79
|
|
|
69
80
|
${u}`;
|
|
70
81
|
}).join(`
|
|
@@ -75,24 +86,27 @@ ${u}`;
|
|
|
75
86
|
|
|
76
87
|
### Deprecation summary
|
|
77
88
|
|
|
78
|
-
${
|
|
89
|
+
${r}`,
|
|
79
90
|
details: `## Deprecation details
|
|
80
91
|
|
|
81
92
|
${t}`
|
|
82
93
|
};
|
|
83
94
|
}
|
|
84
|
-
function
|
|
95
|
+
function I(n, e) {
|
|
85
96
|
const o = /* @__PURE__ */ new Map();
|
|
86
|
-
for (const
|
|
87
|
-
const
|
|
88
|
-
t.add(`${
|
|
97
|
+
for (const s of n) {
|
|
98
|
+
const r = f(s), t = o.get(r) ?? /* @__PURE__ */ new Set();
|
|
99
|
+
t.add(`${s.package}\0${A(e, s)}`), o.set(r, t);
|
|
89
100
|
}
|
|
90
|
-
return new Set([...o].filter(([,
|
|
91
|
-
}
|
|
92
|
-
function
|
|
93
|
-
const o =
|
|
94
|
-
return { summary: "", details: [...Map.groupBy(
|
|
95
|
-
|
|
101
|
+
return new Set([...o].filter(([, s]) => s.size > 1).map(([s]) => s));
|
|
102
|
+
}
|
|
103
|
+
function E(n, e) {
|
|
104
|
+
const o = I(e, "definitions");
|
|
105
|
+
return { summary: "", details: [...Map.groupBy(
|
|
106
|
+
e,
|
|
107
|
+
(t) => h(t.package, t.module ?? g("definitions", t))
|
|
108
|
+
).entries()].sort(([t], [i]) => t.localeCompare(i)).map(([t, i]) => {
|
|
109
|
+
const c = S(n, i, "definitions", o);
|
|
96
110
|
return `#### ${t}'s deprecations
|
|
97
111
|
|
|
98
112
|
${c.join(`
|
|
@@ -101,84 +115,98 @@ ${c.join(`
|
|
|
101
115
|
|
|
102
116
|
`) };
|
|
103
117
|
}
|
|
104
|
-
function
|
|
105
|
-
const
|
|
106
|
-
return
|
|
107
|
-
const
|
|
108
|
-
return
|
|
118
|
+
function S(n, e, o, s) {
|
|
119
|
+
const r = [...Map.groupBy(e, (t) => A(o, t))];
|
|
120
|
+
return r.sort(([t], [i]) => t.localeCompare(i)), r.map(([, t]) => {
|
|
121
|
+
const i = f(t[0]), c = g(o, t[0]), m = c !== void 0 && s.has(i) ? `${c} ${i}` : i, u = _(t);
|
|
122
|
+
return u.sort((p, a) => p.localeCompare(a)), N(n, m, u, t, o);
|
|
109
123
|
});
|
|
110
124
|
}
|
|
111
|
-
function
|
|
112
|
-
const
|
|
125
|
+
function N(n, e, o, s, r) {
|
|
126
|
+
const t = o.length === 0 ? "" : ` - ${o.map(q).join(" ")}`, i = [
|
|
113
127
|
...new Set(
|
|
114
|
-
r.toSorted((a,
|
|
128
|
+
s.filter((a) => r === "usages" || a.provenance !== "manifest").toSorted((a, l) => a.file.localeCompare(l.file) || a.line - l.line).map((a) => H(n.repository, n.ref, a.file, a.line))
|
|
115
129
|
)
|
|
116
|
-
],
|
|
117
|
-
`),
|
|
118
|
-
|
|
119
|
-
|
|
130
|
+
], c = i.length === 1 ? ` ${i[0]}` : i.map((a) => ` - ${a}`).join(`
|
|
131
|
+
`), m = s[0].kind, u = [
|
|
132
|
+
...new Set(
|
|
133
|
+
s.filter(
|
|
134
|
+
(a) => r === "definitions" && a.provenance === "manifest" && a.kind === "css-property"
|
|
135
|
+
).flatMap(({ memberOf: a }) => a === void 0 ? [] : [a])
|
|
136
|
+
)
|
|
137
|
+
].sort(), p = u.length === 0 ? "" : ` (components: ${u.map((a) => `\`<${a}>\``).join(", ")})`;
|
|
138
|
+
return `- [ ] \`${e}\`${y(m)}${p}${t}${c === "" ? "" : `
|
|
139
|
+
${c}`}`;
|
|
120
140
|
}
|
|
121
|
-
function
|
|
141
|
+
function _(n) {
|
|
122
142
|
return [
|
|
123
143
|
...new Set(
|
|
124
|
-
|
|
144
|
+
n.map(({ deprecated: e }) => e).filter((e) => typeof e == "string" && e !== "")
|
|
125
145
|
)
|
|
126
146
|
];
|
|
127
147
|
}
|
|
128
|
-
function
|
|
129
|
-
const
|
|
130
|
-
`,
|
|
131
|
-
if (
|
|
148
|
+
function G(n, e = M, o = x([])) {
|
|
149
|
+
const s = `${o}
|
|
150
|
+
`, r = e - s.length;
|
|
151
|
+
if (r < 1)
|
|
132
152
|
throw new Error("Issue content limit is too small for the managed marker.");
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
153
|
-
}
|
|
154
|
-
function
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
return L(n, r).map((t) => s + t);
|
|
154
|
+
}
|
|
155
|
+
function x(n, e = "usages") {
|
|
156
|
+
const o = d(n).join(",");
|
|
157
|
+
return `<!-- ${$[e]}${o === "" ? "" : ` owners=${o}`} -->`;
|
|
158
|
+
}
|
|
159
|
+
function Z(n) {
|
|
160
|
+
const e = n?.split(`
|
|
161
|
+
`, 1)[0];
|
|
162
|
+
if (e === void 0)
|
|
163
|
+
return;
|
|
164
|
+
const o = /^<!-- (\S+)(?: owners=(@[^\s,]+(?:,@[^\s,]+)*))? -->$/u.exec(e);
|
|
165
|
+
if (o === null)
|
|
166
|
+
return;
|
|
167
|
+
const [, s, r] = o, t = s === $.usages ? "usages" : s === $.definitions ? "definitions" : void 0;
|
|
168
|
+
if (t !== void 0)
|
|
169
|
+
return { kind: t, owners: r === void 0 ? [] : d(r.split(",")) };
|
|
170
|
+
}
|
|
171
|
+
function d(n) {
|
|
172
|
+
return [...new Set(n)].sort((e, o) => e.localeCompare(o));
|
|
173
|
+
}
|
|
174
|
+
function A(n, e) {
|
|
175
|
+
return `${f(e)}${y(e.kind)}\0${g(n, e) ?? ""}`;
|
|
176
|
+
}
|
|
177
|
+
function g(n, e) {
|
|
178
|
+
return n === "definitions" && e.provenance !== "manifest" ? W(e.file) : e.module;
|
|
179
|
+
}
|
|
180
|
+
function W(n) {
|
|
181
|
+
const e = "/src/", o = "/dist/", s = n.lastIndexOf(e), r = n.lastIndexOf(o), t = Math.max(s, r), i = r > s ? o : e;
|
|
182
|
+
return (t === -1 ? n : n.slice(t + i.length)).replace(/\.(?:d\.)?(?:[cm]?ts|tsx)$/u, "");
|
|
183
|
+
}
|
|
184
|
+
function q(n) {
|
|
185
|
+
const e = [], o = (t) => `\0${e.push(t) - 1}\0`, r = n.replaceAll(`\r
|
|
160
186
|
`, `
|
|
161
187
|
`).replaceAll("\r", `
|
|
162
188
|
`).replace(
|
|
163
189
|
/\[([^\]\n]+)\]\((https?:\/\/(?:[^()\s]|\([^()\s]*\))+?)\)/gu,
|
|
164
|
-
(t,
|
|
190
|
+
(t, i, c) => o(`[${k(i)}](${c})`)
|
|
165
191
|
).replace(/https?:\/\/[^\s<>()]+/gu, (t) => {
|
|
166
|
-
const
|
|
167
|
-
return `${o(t.slice(0, -
|
|
192
|
+
const i = /[.,;:!?]+$/u.exec(t)?.[0] ?? "";
|
|
193
|
+
return `${o(t.slice(0, -i.length || void 0))}${i}`;
|
|
168
194
|
});
|
|
169
|
-
return
|
|
195
|
+
return k(r).replace(/\0(\d+)\0/gu, (t, i) => e[Number(i)]).replaceAll(`
|
|
170
196
|
`, `
|
|
171
197
|
`);
|
|
172
198
|
}
|
|
173
|
-
function
|
|
174
|
-
return
|
|
199
|
+
function k(n) {
|
|
200
|
+
return n.replace(/^(\s*)(#{1,6})(?=\s)/gmu, "$1\\$2").replace(/#(?=\d)/gu, "# ");
|
|
175
201
|
}
|
|
176
|
-
function
|
|
177
|
-
const
|
|
178
|
-
return `https://${
|
|
202
|
+
function H(n, e, o, s) {
|
|
203
|
+
const r = e.split("/").map(encodeURIComponent).join("/"), t = o.split("/").map(encodeURIComponent).join("/");
|
|
204
|
+
return `https://${n}/blob/${r}/${t}#L${s}`;
|
|
179
205
|
}
|
|
180
206
|
export {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
207
|
+
$ as a,
|
|
208
|
+
x as b,
|
|
209
|
+
Y as c,
|
|
210
|
+
X as f,
|
|
211
|
+
Z as p
|
|
184
212
|
};
|