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