@arcgis/codemod 6.0.0-next.11 → 6.0.0-next.13
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/artifact.js +36 -32
- package/dist/chunks/classification.js +83 -69
- package/dist/chunks/cli.js +237 -207
- package/dist/chunks/componentAudit.js +156 -104
- package/dist/chunks/format.js +92 -92
- package/dist/chunks/index.js +703 -465
- package/dist/chunks/index2.js +13 -13
- package/dist/chunks/index3.js +240 -205
- package/dist/chunks/useProjectInstance.js +18 -15
- package/package.json +5 -4
|
@@ -1,39 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { findPath as v, asyncFindPath as
|
|
3
|
-
import { path as
|
|
4
|
-
import { retrievePackageJson as
|
|
5
|
-
import { log as
|
|
6
|
-
import { realpath as
|
|
7
|
-
import { f as
|
|
8
|
-
import { b as
|
|
9
|
-
function
|
|
10
|
-
return typeof e == "string" ? e : e.map((
|
|
11
|
-
}
|
|
12
|
-
function
|
|
13
|
-
return e === void 0 ? void 0 :
|
|
14
|
-
}
|
|
15
|
-
function
|
|
1
|
+
import f from "typescript";
|
|
2
|
+
import { findPath as v, asyncFindPath as x } from "@arcgis/node-toolkit/file";
|
|
3
|
+
import { path as r } from "@arcgis/node-toolkit/path";
|
|
4
|
+
import { retrievePackageJson as h, asyncRetrievePackageJson as D } from "@arcgis/node-toolkit/packageJson";
|
|
5
|
+
import { log as b } from "@arcgis/toolkit/log";
|
|
6
|
+
import { realpath as k, readFile as S } from "node:fs/promises";
|
|
7
|
+
import { f as P } from "./log.js";
|
|
8
|
+
import { b as j } from "./cli.js";
|
|
9
|
+
function R(e) {
|
|
10
|
+
return typeof e == "string" ? e : e.map((n) => n.kind === f.SyntaxKind.JSDocText ? n.text : M(n.getText())).join("");
|
|
11
|
+
}
|
|
12
|
+
function _(e) {
|
|
13
|
+
return e === void 0 ? void 0 : E(f.displayPartsToString([...e]));
|
|
14
|
+
}
|
|
15
|
+
function E(e) {
|
|
16
16
|
return e.replace(
|
|
17
17
|
/\{@link(?:code|plain)?\s+([\s\S]*?)\}/gu,
|
|
18
|
-
(
|
|
18
|
+
(n, t) => w(t)
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
return
|
|
21
|
+
function M(e) {
|
|
22
|
+
const n = /^\{@link(?:code|plain)?\s+([\s\S]*?)\}$/u.exec(e)?.[1];
|
|
23
|
+
return n === void 0 ? e : w(n);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
return
|
|
29
|
-
const [
|
|
30
|
-
return
|
|
25
|
+
function w(e) {
|
|
26
|
+
const n = e.trim().replace(/^(\S+)\s+([/:#!.])/u, "$1$2"), t = n.indexOf("|");
|
|
27
|
+
if (t !== -1)
|
|
28
|
+
return n.slice(t + 1).trim() || n.slice(0, t).trim();
|
|
29
|
+
const [c, ...a] = n.split(/\s+/u);
|
|
30
|
+
return a.join(" ") || c;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
return
|
|
32
|
+
function A(e, n) {
|
|
33
|
+
const t = v("package.json", e);
|
|
34
|
+
return t === void 0 ? n : h(r.dirname(t)).name ?? n;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const g = {
|
|
37
|
+
docsLegacyDependencyLocations: /* @__PURE__ */ new Map([
|
|
38
|
+
["@arcgis/coding-components", "packages/coding-packages/coding-components"],
|
|
39
|
+
["@arcgis/core", "packages/core-packages/core/output/npm/esm"],
|
|
40
|
+
["@arcgis/lumina", "packages/support-packages/lit"],
|
|
41
|
+
["@arcgis/map-components", "packages/map-packages/map-components"],
|
|
42
|
+
["@arcgis/toolkit", "packages/support-packages/toolkit"],
|
|
43
|
+
["@esri/calcite-components", "packages/map-packages/map-components/node_modules/@esri/calcite-components"],
|
|
44
|
+
["@esri/calcite-components-react", "packages/docs/app/node_modules/@esri/calcite-components-react"],
|
|
45
|
+
["monaco-editor", "packages/docs/app/node_modules/monaco-editor"]
|
|
46
|
+
]),
|
|
37
47
|
excludedPackageNames: /* @__PURE__ */ new Set([
|
|
38
48
|
"@arcgis/charts-components-react",
|
|
39
49
|
"@arcgis/coding-components-react",
|
|
@@ -42,117 +52,159 @@ const m = {
|
|
|
42
52
|
"@arcgis/portal-components-react",
|
|
43
53
|
"@arcgis-test/lit-components-react"
|
|
44
54
|
]),
|
|
55
|
+
excludedPathFragments: ["/.astro/"],
|
|
45
56
|
excludedDefinitionPathFragments: ["test-package", "packages/docs/lumina-code-samples/", "packages/starter-packages/"],
|
|
46
57
|
ignoreDeprecatedApis: ["getReactWrapperOptions"],
|
|
47
58
|
ignoredDeprecationsByIncludes: ["React wrappers are not needed in React 19 or above"]
|
|
48
59
|
};
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
function z(e) {
|
|
61
|
+
const n = /* @__PURE__ */ new Map(), t = {};
|
|
62
|
+
if (e?.contents.name !== "@webgis/docs")
|
|
63
|
+
return { packages: n, paths: t };
|
|
64
|
+
const c = r.dirname(e.filePath), a = r.resolve(c, "../../..");
|
|
65
|
+
if (r.relative(a, c) !== "packages/docs/app" || !f.sys.fileExists(r.join(a, "pnpm-workspace.yaml")))
|
|
66
|
+
return { packages: n, paths: t };
|
|
67
|
+
const s = new Set(
|
|
68
|
+
Object.entries({
|
|
69
|
+
...e.contents.dependencies,
|
|
70
|
+
...e.contents.devDependencies,
|
|
71
|
+
...e.contents.peerDependencies,
|
|
72
|
+
...e.contents.optionalDependencies
|
|
73
|
+
}).filter(([, o]) => o === "catalog:legacyStarshipDeps").map(([o]) => o)
|
|
55
74
|
);
|
|
75
|
+
if (s.size === 0)
|
|
76
|
+
throw Error(
|
|
77
|
+
"Didn't find any catalog:legacyStarshipDeps in @webgis/docs. Update special handling in @arcgis/codemod"
|
|
78
|
+
);
|
|
79
|
+
for (const o of s) {
|
|
80
|
+
const i = g.docsLegacyDependencyLocations.get(o);
|
|
81
|
+
if (i === void 0)
|
|
82
|
+
throw new Error(
|
|
83
|
+
`Unmapped legacy dependency ${o} in @webgis/docs. Update special handling in @arcgis/codemod.`
|
|
84
|
+
);
|
|
85
|
+
const l = r.join(a, i), d = r.join(l, "package.json");
|
|
86
|
+
if (!f.sys.fileExists(d))
|
|
87
|
+
throw new Error(
|
|
88
|
+
`Missing audit dependency ${o} at ${d}. Install dependencies and build workspace packages before auditing usages.`
|
|
89
|
+
);
|
|
90
|
+
const m = h(l);
|
|
91
|
+
n.set(o, d);
|
|
92
|
+
for (const [p, u] of Object.entries(
|
|
93
|
+
m.exports ?? { ".": m.types ?? "./index.d.ts", "./*": "./*" }
|
|
94
|
+
)) {
|
|
95
|
+
const y = typeof u == "string" ? u : u.types;
|
|
96
|
+
y !== void 0 && (t[p === "." ? o : `${o}/${p.slice(2)}`] = [r.resolve(l, y)]);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return { packages: n, paths: t };
|
|
56
100
|
}
|
|
57
|
-
function
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
function N(e
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
101
|
+
function K(e) {
|
|
102
|
+
return e !== void 0 && g.excludedPackageNames.has(e);
|
|
103
|
+
}
|
|
104
|
+
function N(e) {
|
|
105
|
+
return g.excludedPathFragments.some((n) => `/${e}`.includes(n));
|
|
106
|
+
}
|
|
107
|
+
function V(e) {
|
|
108
|
+
return N(e) || g.excludedDefinitionPathFragments.some((n) => e.includes(n));
|
|
109
|
+
}
|
|
110
|
+
function W(e, n) {
|
|
111
|
+
return g.ignoreDeprecatedApis.some((t) => t === e) || n != null && g.ignoredDeprecationsByIncludes.some((t) => n.includes(t));
|
|
112
|
+
}
|
|
113
|
+
function O(e, n, t) {
|
|
114
|
+
const c = JSON.parse(e), a = { definitions: [], components: /* @__PURE__ */ new Set() };
|
|
115
|
+
for (const s of c.modules)
|
|
116
|
+
for (const o of s.declarations ?? []) {
|
|
117
|
+
let i = function(d, m, p) {
|
|
118
|
+
p !== !0 && typeof p != "string" || a.definitions.push({
|
|
119
|
+
package: t,
|
|
120
|
+
module: s.path,
|
|
121
|
+
name: d,
|
|
122
|
+
kind: m,
|
|
123
|
+
memberOf: m === "element" ? void 0 : l,
|
|
71
124
|
provenance: "manifest",
|
|
72
|
-
reason: typeof
|
|
73
|
-
sourceFileName:
|
|
125
|
+
reason: typeof p == "string" ? p : void 0,
|
|
126
|
+
sourceFileName: n,
|
|
74
127
|
line: 1,
|
|
75
128
|
column: 1
|
|
76
129
|
});
|
|
77
130
|
};
|
|
78
|
-
if (!("tagName" in
|
|
131
|
+
if (!("tagName" in o) || o.tagName === void 0)
|
|
79
132
|
continue;
|
|
80
|
-
const l =
|
|
81
|
-
|
|
82
|
-
for (const [
|
|
133
|
+
const l = o.tagName;
|
|
134
|
+
a.components.add(l), i(l, "element", o.deprecated);
|
|
135
|
+
for (const [d, m] of [
|
|
83
136
|
["cssProperties", "css-property"],
|
|
84
137
|
["cssParts", "css-part"],
|
|
85
138
|
["cssStates", "css-state"],
|
|
86
139
|
["slots", "slot"],
|
|
87
140
|
["attributes", "attribute"]
|
|
88
141
|
])
|
|
89
|
-
for (const
|
|
90
|
-
|
|
142
|
+
for (const p of o[d] ?? [])
|
|
143
|
+
d === "slots" && p.name === "" || i(p.name, m, p.deprecated);
|
|
91
144
|
}
|
|
92
|
-
return
|
|
145
|
+
return a;
|
|
93
146
|
}
|
|
94
|
-
function
|
|
95
|
-
const
|
|
96
|
-
for (const
|
|
97
|
-
for (const
|
|
98
|
-
const
|
|
99
|
-
|
|
147
|
+
function q(e) {
|
|
148
|
+
const n = e.flatMap((s) => s.definitions), t = /* @__PURE__ */ new Map();
|
|
149
|
+
for (const s of e)
|
|
150
|
+
for (const o of s.components) {
|
|
151
|
+
const i = t.get(o) ?? [];
|
|
152
|
+
i.push(s), t.set(o, i);
|
|
100
153
|
}
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
({ name:
|
|
154
|
+
const c = /* @__PURE__ */ new Map(), a = Map.groupBy(
|
|
155
|
+
n.filter(({ kind: s }) => s === "css-property"),
|
|
156
|
+
({ name: s }) => s
|
|
104
157
|
);
|
|
105
|
-
for (const [
|
|
106
|
-
new Set(
|
|
107
|
-
return { hasDeprecatedApis:
|
|
108
|
-
}
|
|
109
|
-
function
|
|
110
|
-
const
|
|
111
|
-
return async (
|
|
112
|
-
const
|
|
113
|
-
let
|
|
114
|
-
return
|
|
115
|
-
if (
|
|
158
|
+
for (const [s, o] of a)
|
|
159
|
+
new Set(o.map((i) => i.package)).size === 1 && c.set(s, o[0]);
|
|
160
|
+
return { hasDeprecatedApis: n.length > 0, components: t, cssVariables: c };
|
|
161
|
+
}
|
|
162
|
+
function G(e = "warn", n) {
|
|
163
|
+
const t = /* @__PURE__ */ new Map();
|
|
164
|
+
return async (c) => {
|
|
165
|
+
const a = await k(c);
|
|
166
|
+
let s = t.get(a);
|
|
167
|
+
return s === void 0 && (s = $(a).catch((o) => {
|
|
168
|
+
if (n?.(), e === "throw")
|
|
116
169
|
throw new Error(
|
|
117
|
-
`Unable to read component manifest for ${
|
|
118
|
-
{ cause:
|
|
170
|
+
`Unable to read component manifest for ${a}. Build the package before auditing definitions.`,
|
|
171
|
+
{ cause: o }
|
|
119
172
|
);
|
|
120
|
-
|
|
121
|
-
}),
|
|
173
|
+
b("warn", P(a), `Unable to read component manifest: ${String(o)}`);
|
|
174
|
+
}), t.set(a, s)), await s;
|
|
122
175
|
};
|
|
123
176
|
}
|
|
124
|
-
async function
|
|
125
|
-
const
|
|
177
|
+
async function H(e, n, t, c) {
|
|
178
|
+
const a = /* @__PURE__ */ new Set([
|
|
126
179
|
...Object.keys(e.contents.dependencies ?? {}),
|
|
127
180
|
...Object.keys(e.contents.devDependencies ?? {}),
|
|
128
181
|
...Object.keys(e.contents.peerDependencies ?? {}),
|
|
129
182
|
...Object.keys(e.contents.optionalDependencies ?? {})
|
|
130
183
|
]), s = await Promise.all(
|
|
131
|
-
[...
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
d.dirname(e.filePath)
|
|
135
|
-
);
|
|
136
|
-
return a === void 0 ? void 0 : await t(a);
|
|
184
|
+
[...a].filter((o) => o !== e.contents.name && (!t || j(o))).map(async (o) => {
|
|
185
|
+
const i = c?.get(o) ?? await x(r.join("node_modules", o, "package.json"), r.dirname(e.filePath));
|
|
186
|
+
return i === void 0 ? void 0 : await n(i);
|
|
137
187
|
})
|
|
138
188
|
);
|
|
139
189
|
return [...new Set(s.filter((o) => o !== void 0))];
|
|
140
190
|
}
|
|
141
|
-
async function
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
191
|
+
async function $(e) {
|
|
192
|
+
const n = r.dirname(e), t = await D(n), c = typeof t.customElements == "string" ? t.customElements : t.customElements?.[0];
|
|
193
|
+
if (c === void 0)
|
|
144
194
|
return;
|
|
145
|
-
const
|
|
146
|
-
return
|
|
195
|
+
const a = await k(r.resolve(n, c));
|
|
196
|
+
return O(await S(a, "utf8"), a, t.name);
|
|
147
197
|
}
|
|
148
198
|
export {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
199
|
+
N as a,
|
|
200
|
+
W as b,
|
|
201
|
+
q as c,
|
|
202
|
+
A as d,
|
|
203
|
+
G as e,
|
|
204
|
+
R as f,
|
|
205
|
+
z as g,
|
|
206
|
+
_ as h,
|
|
207
|
+
V as i,
|
|
208
|
+
H as l,
|
|
209
|
+
K as s
|
|
158
210
|
};
|
package/dist/chunks/format.js
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import { h as
|
|
2
|
-
import { g as
|
|
3
|
-
import { markdownTextLimit as
|
|
4
|
-
const
|
|
5
|
-
function Y(
|
|
6
|
-
const
|
|
7
|
-
return `${
|
|
1
|
+
import { h as D, k as d, l as b, m as v, d as w } from "./cli.js";
|
|
2
|
+
import { g as B, i as K, b as $, d as k } from "./classification.js";
|
|
3
|
+
import { markdownTextLimit as y, splitMarkdown as O } from "@arcgis/node-toolkit/markdown";
|
|
4
|
+
const M = `<!-- ${d} -->`, X = `<!-- ${d}`;
|
|
5
|
+
function Y(n) {
|
|
6
|
+
const e = j(n, n.findings);
|
|
7
|
+
return `${e.summary.trim().replace(/^### /u, "## ")}
|
|
8
8
|
|
|
9
|
-
${
|
|
9
|
+
${e.details}`;
|
|
10
10
|
}
|
|
11
|
-
function Z(
|
|
12
|
-
const
|
|
13
|
-
for (const
|
|
14
|
-
const s = f(
|
|
15
|
-
|
|
11
|
+
function Z(n) {
|
|
12
|
+
const e = /* @__PURE__ */ new Map();
|
|
13
|
+
for (const o of n.findings) {
|
|
14
|
+
const s = f(o.codeowners), r = s.join(","), t = e.get(r) ?? [];
|
|
15
|
+
t.push({ ...o, codeowners: s }), e.set(r, t);
|
|
16
16
|
}
|
|
17
|
-
return [...
|
|
18
|
-
const r =
|
|
17
|
+
return [...e.entries()].map(([o, s]) => {
|
|
18
|
+
const r = o === "" ? [] : o.split(","), t = L(n, s);
|
|
19
19
|
return {
|
|
20
20
|
changes: [],
|
|
21
|
-
title:
|
|
21
|
+
title: D[n.auditKind],
|
|
22
22
|
owners: r,
|
|
23
23
|
assignees: r.filter((a) => /^@[^/@\s]+$/u.test(a)).map((a) => a.slice(1)),
|
|
24
|
-
chunks: _(
|
|
24
|
+
chunks: _(t, y, G(r))
|
|
25
25
|
};
|
|
26
|
-
}).sort((
|
|
26
|
+
}).sort((o, s) => o.owners.join(",").localeCompare(s.owners.join(",")));
|
|
27
27
|
}
|
|
28
|
-
function L(
|
|
29
|
-
const
|
|
28
|
+
function L(n, e) {
|
|
29
|
+
const o = f(e.flatMap((r) => r.codeowners)).filter(
|
|
30
30
|
(r) => /^@[^/@\s]+\/[^@\s]+$/u.test(r)
|
|
31
|
-
), s =
|
|
31
|
+
), s = o.length === 0 ? "" : `
|
|
32
32
|
|
|
33
|
-
CODEOWNERS: ${
|
|
34
|
-
return U(
|
|
33
|
+
CODEOWNERS: ${o.join(", ")}`;
|
|
34
|
+
return U(n, e, s);
|
|
35
35
|
}
|
|
36
|
-
function U(
|
|
37
|
-
const s =
|
|
38
|
-
return `${s}${
|
|
36
|
+
function U(n, e, o) {
|
|
37
|
+
const s = b[n.auditKind], r = j(n, e);
|
|
38
|
+
return `${s}${o}${r.summary}
|
|
39
39
|
|
|
40
|
-
${
|
|
40
|
+
${v}
|
|
41
41
|
|
|
42
42
|
${r.details}`;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
44
|
+
function j(n, e) {
|
|
45
|
+
return n.auditKind === "usages" ? z(n, e) : E(n, e);
|
|
46
46
|
}
|
|
47
|
-
function z(
|
|
48
|
-
const
|
|
47
|
+
function z(n, e) {
|
|
48
|
+
const o = x(e, "usages"), s = B(e, (a) => a), r = s.map(({ categoryName: a, count: c, packages: m }) => {
|
|
49
49
|
const u = m.map(({ displayName: p, count: i }) => ` - \`${p}\`: ${i}`).join(`
|
|
50
50
|
`);
|
|
51
|
-
return `- **${
|
|
51
|
+
return `- **${w[a].label}**: ${c}
|
|
52
52
|
${u}`;
|
|
53
53
|
}).join(`
|
|
54
|
-
`),
|
|
55
|
-
const u = m.map(({ displayName: l, count:
|
|
56
|
-
const
|
|
57
|
-
({ items:
|
|
54
|
+
`), t = s.map(({ categoryName: a, count: c, packages: m }) => {
|
|
55
|
+
const u = m.map(({ displayName: l, count: A, apis: C }) => {
|
|
56
|
+
const P = C.flatMap(
|
|
57
|
+
({ items: R }) => I(n, R, "usages", o)
|
|
58
58
|
);
|
|
59
|
-
return `#### ${l} (${
|
|
59
|
+
return `#### ${l} (${A})
|
|
60
60
|
|
|
61
|
-
${
|
|
61
|
+
${P.join(`
|
|
62
62
|
`)}`;
|
|
63
63
|
}).join(`
|
|
64
64
|
|
|
65
|
-
`), p =
|
|
65
|
+
`), p = w[a], i = "description" in p ? `
|
|
66
66
|
|
|
67
67
|
${p.description}` : "";
|
|
68
68
|
return `### ${p.label} (${c})${i}
|
|
@@ -79,25 +79,25 @@ ${u}`;
|
|
|
79
79
|
${r}`,
|
|
80
80
|
details: `## Deprecation details
|
|
81
81
|
|
|
82
|
-
${
|
|
82
|
+
${t}`
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
function x(
|
|
86
|
-
const
|
|
87
|
-
for (const s of
|
|
88
|
-
const r = $(s),
|
|
89
|
-
|
|
85
|
+
function x(n, e) {
|
|
86
|
+
const o = /* @__PURE__ */ new Map();
|
|
87
|
+
for (const s of n) {
|
|
88
|
+
const r = $(s), t = o.get(r) ?? /* @__PURE__ */ new Set();
|
|
89
|
+
t.add(`${s.package}\0${S(e, s)}`), o.set(r, t);
|
|
90
90
|
}
|
|
91
|
-
return new Set([...
|
|
91
|
+
return new Set([...o].filter(([, s]) => s.size > 1).map(([s]) => s));
|
|
92
92
|
}
|
|
93
|
-
function E(
|
|
94
|
-
const
|
|
93
|
+
function E(n, e) {
|
|
94
|
+
const o = x(e, "definitions");
|
|
95
95
|
return { summary: "", details: [...Map.groupBy(
|
|
96
|
-
|
|
97
|
-
(
|
|
98
|
-
).entries()].sort(([
|
|
99
|
-
const c = I(
|
|
100
|
-
return `#### ${
|
|
96
|
+
e,
|
|
97
|
+
(t) => K(t.package, t.module ?? g("definitions", t))
|
|
98
|
+
).entries()].sort(([t], [a]) => t.localeCompare(a)).map(([t, a]) => {
|
|
99
|
+
const c = I(n, a, "definitions", o);
|
|
100
|
+
return `#### ${t}'s deprecations
|
|
101
101
|
|
|
102
102
|
${c.join(`
|
|
103
103
|
`)}`;
|
|
@@ -105,17 +105,17 @@ ${c.join(`
|
|
|
105
105
|
|
|
106
106
|
`) };
|
|
107
107
|
}
|
|
108
|
-
function I(
|
|
109
|
-
const r = [...Map.groupBy(
|
|
110
|
-
return
|
|
111
|
-
const a = $(
|
|
112
|
-
return
|
|
108
|
+
function I(n, e, o, s) {
|
|
109
|
+
const r = [...Map.groupBy(e, (t) => S(o, t))];
|
|
110
|
+
return r.sort(([t], [a]) => t.localeCompare(a)), r.map(([, t]) => {
|
|
111
|
+
const a = $(t[0]), c = g(o, t[0]), m = c !== void 0 && s.has(a) ? `${c} ${a}` : a, u = T(t);
|
|
112
|
+
return u.sort((p, i) => p.localeCompare(i)), N(n, m, u, t, o);
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
function N(
|
|
116
|
-
const
|
|
115
|
+
function N(n, e, o, s, r) {
|
|
116
|
+
const t = o.length === 0 ? "" : ` - ${o.map(q).join(" ")}`, a = [
|
|
117
117
|
...new Set(
|
|
118
|
-
s.filter((i) => r === "usages" || i.provenance !== "manifest").toSorted((i, l) => i.file.localeCompare(l.file) || i.line - l.line).map((i) => H(
|
|
118
|
+
s.filter((i) => r === "usages" || i.provenance !== "manifest").toSorted((i, l) => i.file.localeCompare(l.file) || i.line - l.line).map((i) => H(n.repository, n.ref, i.file, i.line))
|
|
119
119
|
)
|
|
120
120
|
], c = a.length === 1 ? ` ${a[0]}` : a.map((i) => ` - ${i}`).join(`
|
|
121
121
|
`), m = s[0].kind, u = [
|
|
@@ -125,63 +125,63 @@ function N(e, t, n, s, r) {
|
|
|
125
125
|
).flatMap(({ memberOf: i }) => i === void 0 ? [] : [i])
|
|
126
126
|
)
|
|
127
127
|
].sort(), p = u.length === 0 ? "" : ` (components: ${u.map((i) => `\`<${i}>\``).join(", ")})`;
|
|
128
|
-
return `- [ ] \`${
|
|
128
|
+
return `- [ ] \`${e}\`${k(m)}${p}${t}${c === "" ? "" : `
|
|
129
129
|
${c}`}`;
|
|
130
130
|
}
|
|
131
|
-
function T(
|
|
131
|
+
function T(n) {
|
|
132
132
|
return [
|
|
133
133
|
...new Set(
|
|
134
|
-
|
|
134
|
+
n.map(({ deprecated: e }) => e).filter((e) => typeof e == "string" && e !== "")
|
|
135
135
|
)
|
|
136
136
|
];
|
|
137
137
|
}
|
|
138
|
-
function _(
|
|
139
|
-
const s = `${
|
|
140
|
-
`, r =
|
|
138
|
+
function _(n, e = y, o = M) {
|
|
139
|
+
const s = `${o}
|
|
140
|
+
`, r = e - s.length;
|
|
141
141
|
if (r < 1)
|
|
142
142
|
throw new Error("Issue content limit is too small for the managed marker.");
|
|
143
|
-
return O(
|
|
143
|
+
return O(n, r).map((t) => s + t);
|
|
144
144
|
}
|
|
145
|
-
function G(
|
|
146
|
-
return
|
|
145
|
+
function G(n) {
|
|
146
|
+
return n.length === 0 ? M : `<!-- ${d} ${f(n).join(",")} -->`;
|
|
147
147
|
}
|
|
148
|
-
function f(
|
|
149
|
-
return [...new Set(
|
|
148
|
+
function f(n) {
|
|
149
|
+
return [...new Set(n)].sort((e, o) => e.localeCompare(o));
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
return `${$(
|
|
151
|
+
function S(n, e) {
|
|
152
|
+
return `${$(e)}${k(e.kind)}\0${g(n, e) ?? ""}`;
|
|
153
153
|
}
|
|
154
|
-
function g(
|
|
155
|
-
return
|
|
154
|
+
function g(n, e) {
|
|
155
|
+
return n === "definitions" && e.provenance !== "manifest" ? W(e.file) : e.module;
|
|
156
156
|
}
|
|
157
|
-
function W(
|
|
158
|
-
const
|
|
159
|
-
return (
|
|
157
|
+
function W(n) {
|
|
158
|
+
const e = "/src/", o = "/dist/", s = n.lastIndexOf(e), r = n.lastIndexOf(o), t = Math.max(s, r), a = r > s ? o : e;
|
|
159
|
+
return (t === -1 ? n : n.slice(t + a.length)).replace(/\.(?:d\.)?(?:[cm]?ts|tsx)$/u, "");
|
|
160
160
|
}
|
|
161
|
-
function q(
|
|
162
|
-
const
|
|
161
|
+
function q(n) {
|
|
162
|
+
const e = [], o = (t) => `\0${e.push(t) - 1}\0`, r = n.replaceAll(`\r
|
|
163
163
|
`, `
|
|
164
164
|
`).replaceAll("\r", `
|
|
165
165
|
`).replace(
|
|
166
166
|
/\[([^\]\n]+)\]\((https?:\/\/(?:[^()\s]|\([^()\s]*\))+?)\)/gu,
|
|
167
|
-
(
|
|
168
|
-
).replace(/https?:\/\/[^\s<>()]+/gu, (
|
|
169
|
-
const a = /[.,;:!?]+$/u.exec(
|
|
170
|
-
return `${
|
|
167
|
+
(t, a, c) => o(`[${h(a)}](${c})`)
|
|
168
|
+
).replace(/https?:\/\/[^\s<>()]+/gu, (t) => {
|
|
169
|
+
const a = /[.,;:!?]+$/u.exec(t)?.[0] ?? "";
|
|
170
|
+
return `${o(t.slice(0, -a.length || void 0))}${a}`;
|
|
171
171
|
});
|
|
172
|
-
return
|
|
172
|
+
return h(r).replace(/\0(\d+)\0/gu, (t, a) => e[Number(a)]).replaceAll(`
|
|
173
173
|
`, `
|
|
174
174
|
`);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
return
|
|
176
|
+
function h(n) {
|
|
177
|
+
return n.replace(/^(\s*)(#{1,6})(?=\s)/gmu, "$1\\$2").replace(/#(?=\d)/gu, "# ");
|
|
178
178
|
}
|
|
179
|
-
function H(
|
|
180
|
-
const r =
|
|
181
|
-
return `https://${
|
|
179
|
+
function H(n, e, o, s) {
|
|
180
|
+
const r = e.split("/").map(encodeURIComponent).join("/"), t = o.split("/").map(encodeURIComponent).join("/");
|
|
181
|
+
return `https://${n}/blob/${r}/${t}#L${s}`;
|
|
182
182
|
}
|
|
183
183
|
export {
|
|
184
|
-
|
|
184
|
+
M as a,
|
|
185
185
|
Z as c,
|
|
186
186
|
Y as f,
|
|
187
187
|
X as i
|