@arcgis/codemod 6.0.0-next.2 → 6.0.0-next.20

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.
@@ -46,7 +46,6 @@ const p = "@arcgis/components-build-utils", v = {
46
46
  asyncFindPath: { do: "rename", specifier: "@arcgis/node-toolkit/file" },
47
47
  createFileIfNotExists: { do: "rename", specifier: "@arcgis/node-toolkit/file" },
48
48
  gitIgnoreFileToGlobs: { do: "rename", specifier: "@arcgis/node-toolkit/glob" },
49
- gitIgnoreToGlob: { do: "rename", specifier: "@arcgis/node-toolkit/glob" },
50
49
  isPosix: { do: "rename", specifier: "@arcgis/node-toolkit/path" },
51
50
  toPosixPathSeparators: { do: "rename", specifier: "@arcgis/node-toolkit/path" },
52
51
  normalizePath: { do: "rename", specifier: "@arcgis/node-toolkit/path" },
@@ -0,0 +1,258 @@
1
+ import k from "typescript";
2
+ import { findPath as S, asyncFindPath as y } from "@arcgis/node-toolkit/file";
3
+ import { path as p } from "@arcgis/node-toolkit/path";
4
+ import { retrievePackageJson as v, asyncRetrievePackageJson as E } from "@arcgis/node-toolkit/packageJson";
5
+ import { log as b } from "@arcgis/toolkit/log";
6
+ import { realpath as h, readFile as x, readdir as j } from "node:fs/promises";
7
+ import { f as D } from "./log.js";
8
+ import { b as $ } from "./cli.js";
9
+ import { s as M } from "./classification.js";
10
+ function V(e) {
11
+ return typeof e == "string" ? e : e.map((n) => n.kind === k.SyntaxKind.JSDocText ? n.text : O(n.getText())).join("");
12
+ }
13
+ function W(e) {
14
+ return e === void 0 ? void 0 : N(k.displayPartsToString([...e]));
15
+ }
16
+ function N(e) {
17
+ return e.replace(
18
+ /\{@link(?:code|plain)?\s+([\s\S]*?)\}/gu,
19
+ (n, s) => P(s)
20
+ );
21
+ }
22
+ function O(e) {
23
+ const n = /^\{@link(?:code|plain)?\s+([\s\S]*?)\}$/u.exec(e)?.[1];
24
+ return n === void 0 ? e : P(n);
25
+ }
26
+ function P(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 q(e, n) {
34
+ const s = S("package.json", e);
35
+ return s === void 0 ? n : v(p.dirname(s)).name ?? n;
36
+ }
37
+ const m = {
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
+ excludedPackageNames: /* @__PURE__ */ new Set(),
49
+ excludedPathFragments: ["/.astro/"],
50
+ excludedDefinitionPathFragments: ["test-package", "packages/docs/lumina-code-samples/", "packages/starter-packages/"],
51
+ ignoreDeprecatedApis: [],
52
+ ignoredDeprecationsByIncludes: []
53
+ };
54
+ function G(e) {
55
+ const n = /* @__PURE__ */ new Map(), s = {};
56
+ if (e?.contents.name !== "@webgis/docs")
57
+ return { packages: n, paths: s };
58
+ const a = p.dirname(e.filePath), i = p.resolve(a, "../../..");
59
+ if (p.relative(i, a) !== "packages/docs/app" || !k.sys.fileExists(p.join(i, "pnpm-workspace.yaml")))
60
+ return { packages: n, paths: s };
61
+ const o = new Set(
62
+ Object.entries({
63
+ ...e.contents.dependencies,
64
+ ...e.contents.devDependencies,
65
+ ...e.contents.peerDependencies,
66
+ ...e.contents.optionalDependencies
67
+ }).filter(([, t]) => t === "catalog:legacyStarshipDeps").map(([t]) => t)
68
+ );
69
+ if (o.size === 0)
70
+ throw Error(
71
+ "Didn't find any catalog:legacyStarshipDeps in @webgis/docs. Update special handling in @arcgis/codemod"
72
+ );
73
+ for (const t of o) {
74
+ const r = m.docsLegacyDependencyLocations.get(t);
75
+ if (r === void 0)
76
+ throw new Error(
77
+ `Unmapped legacy dependency ${t} in @webgis/docs. Update special handling in @arcgis/codemod.`
78
+ );
79
+ const c = p.join(i, r), d = p.join(c, "package.json");
80
+ if (!k.sys.fileExists(d))
81
+ throw new Error(
82
+ `Missing audit dependency ${t} at ${d}. Install dependencies and build workspace packages before auditing usages.`
83
+ );
84
+ const u = v(c);
85
+ n.set(t, d);
86
+ for (const [f, l] of Object.entries(
87
+ u.exports ?? { ".": u.types ?? "./index.d.ts", "./*": "./*" }
88
+ )) {
89
+ const w = typeof l == "string" ? l : l.types;
90
+ w !== void 0 && (s[f === "." ? t : `${t}/${f.slice(2)}`] = [p.resolve(c, w)]);
91
+ }
92
+ }
93
+ return { packages: n, paths: s };
94
+ }
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
+ function Q(e) {
102
+ return T(e) || m.excludedDefinitionPathFragments.some((n) => e.includes(n));
103
+ }
104
+ function X(e, n) {
105
+ return m.ignoreDeprecatedApis.some((s) => s === e) || n != null && m.ignoredDeprecationsByIncludes.some((s) => n.includes(s));
106
+ }
107
+ function C(e, n, s) {
108
+ const a = JSON.parse(e), i = { modulePaths: /* @__PURE__ */ new Map(), definitions: [], components: /* @__PURE__ */ new Set() };
109
+ for (const o of a.modules) {
110
+ o.sourcePath !== void 0 && i.modulePaths.set(M(o.sourcePath), o.path);
111
+ for (const t of o.declarations ?? []) {
112
+ let r = function(d, u, f, l) {
113
+ f !== !0 && typeof f != "string" || i.definitions.push({
114
+ package: s,
115
+ module: o.path,
116
+ name: l ?? d,
117
+ kind: l === void 0 ? u : "field",
118
+ memberOf: l === void 0 ? u === "element" ? void 0 : c : t.name,
119
+ ...l === void 0 ? {} : { attribute: { tagName: c, name: d } },
120
+ provenance: "manifest",
121
+ reason: typeof f == "string" ? f : void 0,
122
+ sourceFileName: n,
123
+ line: 1,
124
+ column: 1
125
+ });
126
+ };
127
+ if (!("tagName" in t) || t.tagName === void 0)
128
+ continue;
129
+ const c = t.tagName;
130
+ i.components.add(c), r(c, "element", t.deprecated);
131
+ for (const [d, u] of [
132
+ ["cssProperties", "css-property"],
133
+ ["cssParts", "css-part"],
134
+ ["cssStates", "css-state"],
135
+ ["slots", "slot"]
136
+ ])
137
+ for (const f of t[d] ?? [])
138
+ d === "slots" && f.name === "" || r(f.name, u, f.deprecated);
139
+ for (const d of t.attributes ?? [])
140
+ r(d.name, "attribute", d.deprecated, d.fieldName);
141
+ }
142
+ }
143
+ return i;
144
+ }
145
+ function Y(e) {
146
+ const n = e.flatMap((o) => o.definitions), s = /* @__PURE__ */ new Map();
147
+ for (const o of e)
148
+ for (const t of o.components) {
149
+ const r = s.get(t) ?? [];
150
+ r.push(o), s.set(t, r);
151
+ }
152
+ const a = /* @__PURE__ */ new Map(), i = Map.groupBy(
153
+ n.filter(({ kind: o }) => o === "css-property"),
154
+ ({ name: o }) => o
155
+ );
156
+ for (const [o, t] of i)
157
+ new Set(t.map((r) => r.package)).size === 1 && a.set(o, t[0]);
158
+ return { hasDeprecatedApis: n.length > 0, components: s, cssVariables: a };
159
+ }
160
+ function Z(e = "warn", n) {
161
+ const s = /* @__PURE__ */ new Map();
162
+ return async (a) => {
163
+ const i = await h(a);
164
+ let o = s.get(i);
165
+ return o === void 0 && (o = F(i, n).catch((t) => {
166
+ if (n?.(), e === "throw")
167
+ throw new Error(
168
+ `Unable to read component manifest for ${i}. Build the package before auditing definitions.`,
169
+ { cause: t }
170
+ );
171
+ b("warn", D(i), `Unable to read component manifest: ${String(t)}`);
172
+ }), s.set(i, o)), await o;
173
+ };
174
+ }
175
+ async function ee(e, n, s, a) {
176
+ const i = /* @__PURE__ */ new Set([
177
+ ...Object.keys(e.contents.dependencies ?? {}),
178
+ ...Object.keys(e.contents.devDependencies ?? {}),
179
+ ...Object.keys(e.contents.peerDependencies ?? {}),
180
+ ...Object.keys(e.contents.optionalDependencies ?? {})
181
+ ]), o = await Promise.all(
182
+ [...i].filter((t) => t !== e.contents.name && (!s || $(t))).map(async (t) => {
183
+ const r = a?.get(t) ?? await y(p.join("node_modules", t, "package.json"), p.dirname(e.filePath));
184
+ if (r === void 0)
185
+ return [];
186
+ const c = await n(r), d = t === "@esri/calcite-components" ? await y(
187
+ "node_modules/@esri/calcite-design-tokens/package.json",
188
+ p.dirname(await h(r))
189
+ ) : void 0;
190
+ return [c, d === void 0 ? void 0 : await n(d)];
191
+ })
192
+ );
193
+ return [...new Set(o.flat().filter((t) => t !== void 0))];
194
+ }
195
+ async function F(e, n) {
196
+ const s = p.dirname(e), a = await E(s);
197
+ if (a.name === "@esri/calcite-design-tokens")
198
+ try {
199
+ return await L(s, a.name);
200
+ } catch (t) {
201
+ n?.(), b("error", D(s), `Calcite design tokens integration is out of date: ${String(t)}`);
202
+ return;
203
+ }
204
+ const i = typeof a.customElements == "string" ? a.customElements : a.customElements?.[0];
205
+ if (i === void 0)
206
+ return;
207
+ const o = await h(p.resolve(s, i));
208
+ return C(await x(o, "utf8"), o, a.name);
209
+ }
210
+ async function L(e, n) {
211
+ const s = p.join(e, "dist/docs"), a = /* @__PURE__ */ new Map(), i = (await j(s)).filter((o) => o.endsWith(".json")).sort();
212
+ if (i.length === 0)
213
+ throw new Error(`Missing token documentation JSON files in ${s}`);
214
+ for (const o of i) {
215
+ const t = await h(p.join(s, o)), r = JSON.parse(await x(t, "utf8"));
216
+ if (!g(r) || !Array.isArray(r.tokens))
217
+ throw new Error(`Expected a tokens array in ${t}`);
218
+ for (const c of r.tokens) {
219
+ 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
+ throw new Error(`Expected token attributes.docs/status and attributes.names.css in ${t}`);
221
+ if (c.attributes.docs !== "deprecated" && c.attributes.status !== "deprecated")
222
+ continue;
223
+ const d = c.$description ?? c.description;
224
+ if (typeof d != "string")
225
+ throw new Error(`Expected a deprecated token's $description or description in ${t}`);
226
+ const u = c.attributes.names.css.slice(4, -1);
227
+ a.has(u) || a.set(u, {
228
+ package: n,
229
+ name: u,
230
+ kind: "css-property",
231
+ provenance: "manifest",
232
+ reason: d,
233
+ sourceFileName: t,
234
+ line: 1,
235
+ column: 1
236
+ });
237
+ }
238
+ }
239
+ if (a.size === 0)
240
+ throw new Error(`Expected tokens marked with attributes.docs or attributes.status = "deprecated" in ${s}`);
241
+ return { modulePaths: /* @__PURE__ */ new Map(), definitions: [...a.values()], components: /* @__PURE__ */ new Set() };
242
+ }
243
+ function g(e) {
244
+ return typeof e == "object" && e !== null && !Array.isArray(e);
245
+ }
246
+ export {
247
+ T as a,
248
+ X as b,
249
+ Y as c,
250
+ q as d,
251
+ Z as e,
252
+ V as f,
253
+ G as g,
254
+ W as h,
255
+ Q as i,
256
+ ee as l,
257
+ H as s
258
+ };
@@ -1,157 +1,73 @@
1
- import { d as h } from "./cli.js";
2
- const I = /(?:esri|arcgis)/iu, y = "@arcgis/codemod", x = {
3
- usages: "Refactor-out deprecated API usages",
4
- definitions: "Remove deprecated APIs in next breaking changes release"
5
- }, P = {
6
- usages: "The following deprecated APIs are used in files owned by assigned CODEOWNERS. Refactor them before the APIs are removed.",
7
- definitions: "The following deprecated APIs are owned by assigned CODEOWNERS. Remove them in the next breaking changes release."
8
- }, R = "This issue is autogenerated and updated regularly based on remaining items. Feel free to add comments and labels, update assignees, set milestone, or create sub-issues. Close it once completed. A new issue will be created if new findings are detected.", J = "Task", K = "deprecations sync-issues";
9
- function A(e) {
10
- return I.test(e);
11
- }
12
- const L = /* @__PURE__ */ new Set([
13
- "MessageBundleLoader",
14
- "createJSONLoader",
15
- "fetchMessageBundle",
16
- "messageBundle",
17
- "normalizeMessageBundleLocale",
18
- "registerMessageBundleLoader"
19
- ]), O = /* @__PURE__ */ new Set([
20
- "AreaMeasurement2D",
21
- "AreaMeasurement3D",
22
- "BasemapGallery",
23
- "BasemapToggle",
24
- "BatchAttributeForm",
25
- "BinaryColorSizeSlider",
26
- "ClassedColorSlider",
27
- "ColorSlider",
28
- "ColorSizeSlider",
29
- "CoordinateConversion",
30
- "Daylight",
31
- "DirectLineMeasurement3D",
32
- "DistanceMeasurement2D",
33
- "Editor",
34
- "FeatureForm",
35
- "FeatureTable",
36
- "GridControls",
37
- "HeatmapSlider",
38
- "Home",
39
- "HistogramRangeSlider",
40
- "LayerList",
41
- "Legend",
42
- "LineOfSight",
43
- "Locate",
44
- "NavigationToggle",
45
- "OpacitySlider",
46
- "OrientedImageryViewer",
47
- "Print",
48
- "ScaleBar",
49
- "Search",
50
- "Sketch",
51
- "SketchLabelOptions",
52
- "SketchTooltipOptions",
53
- "Slice",
54
- "SizeSlider",
55
- "Slider",
56
- "SnappingOptions",
57
- "TableList",
58
- "useLegacyCreateTools"
59
- ]);
60
- function D({
61
- packageName: e,
62
- api: n,
63
- reason: s
64
- }) {
65
- const r = e.toLowerCase(), t = s?.toLowerCase() ?? "";
66
- return e === "@arcgis/core" && (O.has(n) || t.includes("components-transition-plan")) ? "coreWidgets" : e === "@arcgis/core" && (n === "geometryEngine" || n === "extendedSpatialReferenceInfo" || t.includes("geometry/operators")) ? "coreGeometryEngine" : /\bcodemod\b/iu.test(t) ? "codemod" : e === "@arcgis/core" && (L.has(n) || t.includes("widget translations")) ? "coreIntl" : r.includes("calcite") ? "calcite" : e === "@arcgis/core" || r.startsWith("@arcgis/") && r.includes("components") ? "arcgisCoreComponents" : A(e) ? "otherEsri" : "nonEsri";
67
- }
68
- function j(e, n) {
69
- const s = Map.groupBy(e, (r) => D(n(r)));
70
- return Object.keys(h).flatMap((r) => {
71
- const t = s.get(r);
72
- if (t === void 0)
73
- return [];
74
- const i = [...Map.groupBy(t, (a) => n(a).packageName)].map(([a, c]) => {
75
- const p = [...Map.groupBy(c, (d) => n(d).api)].map(([d, m]) => {
76
- const g = m.map((u) => n(u).reason).filter((u) => u != null && u !== ""), f = [...new Set(g)].sort((u, $) => u.localeCompare($));
77
- return { api: d, reasons: f, items: m };
78
- });
79
- return p.sort((d, m) => m.items.length - d.items.length || d.api.localeCompare(m.api)), { packageName: a, count: c.length, apis: p };
80
- });
81
- return i.sort((a, c) => c.count - a.count || a.packageName.localeCompare(c.packageName)), [{ categoryName: r, count: t.length, packages: i }];
82
- });
83
- }
84
- const S = `<!-- ${y} -->`, V = `<!-- ${y}`, M = 65536;
85
- function Q(e) {
86
- const n = C(e, e.findings);
87
- return `${n.summary.trim().replace(/^### /u, "## ")}
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, "## ")}
88
8
 
89
- ${n.details}`;
9
+ ${e.details}`;
90
10
  }
91
- function X(e) {
92
- const n = /* @__PURE__ */ new Map();
93
- for (const s of e.findings) {
94
- const r = k(s.codeowners), t = r.join(","), o = n.get(t) ?? [];
95
- o.push({ ...s, codeowners: r }), n.set(t, o);
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);
96
16
  }
97
- return [...n.entries()].map(([s, r]) => {
98
- const t = s === "" ? [] : s.split(","), o = T(e, r);
17
+ return [...e.entries()].map(([o, s]) => {
18
+ const r = o === "" ? [] : o.split(","), t = L(n, s);
99
19
  return {
100
20
  changes: [],
101
- title: x[e.kind],
102
- owners: t,
103
- assignees: t.filter((i) => /^@[^/@\s]+$/u.test(i)).map((i) => i.slice(1)),
104
- chunks: F(o, M, G(t))
21
+ title: D[n.auditKind],
22
+ owners: r,
23
+ assignees: r.filter((a) => /^@[^/@\s]+$/u.test(a)).map((a) => a.slice(1)),
24
+ chunks: _(t, y, G(r))
105
25
  };
106
- }).sort((s, r) => s.title.localeCompare(r.title));
26
+ }).sort((o, s) => o.owners.join(",").localeCompare(s.owners.join(",")));
107
27
  }
108
- function T(e, n) {
109
- const s = k(n.flatMap((t) => t.codeowners)).filter(
110
- (t) => /^@[^/@\s]+\/[^@\s]+$/u.test(t)
111
- ), r = s.length === 0 ? "" : `
28
+ function L(n, e) {
29
+ const o = f(e.flatMap((r) => r.codeowners)).filter(
30
+ (r) => /^@[^/@\s]+\/[^@\s]+$/u.test(r)
31
+ ), s = o.length === 0 ? "" : `
112
32
 
113
- CODEOWNERS: ${s.join(", ")}`;
114
- return E(e, n, r);
33
+ CODEOWNERS: ${o.join(", ")}`;
34
+ return U(n, e, s);
115
35
  }
116
- function E(e, n, s) {
117
- const r = P[e.kind], t = C(e, n);
118
- return `${r}${s}${t.summary}
36
+ function U(n, e, o) {
37
+ const s = b[n.auditKind], r = j(n, e);
38
+ return `${s}${o}${r.summary}
119
39
 
120
- ${R}
40
+ ${v}
121
41
 
122
- ${t.details}`;
123
- }
124
- function C(e, n) {
125
- return e.kind === "usages" ? v(e, n) : z(e, n);
126
- }
127
- function v(e, n) {
128
- const s = j(n, ({ package: o, api: i, reason: a }) => ({
129
- packageName: o,
130
- api: i,
131
- reason: a
132
- })), r = s.map(({ categoryName: o, count: i, packages: a }) => {
133
- const c = a.map(({ packageName: l, count: p }) => ` - \`${l}\`: ${p}`).join(`
42
+ ${r.details}`;
43
+ }
44
+ function j(n, e) {
45
+ return n.auditKind === "usages" ? z(n, e) : E(n, e);
46
+ }
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
+ const u = m.map(({ displayName: p, count: i }) => ` - \`${p}\`: ${i}`).join(`
134
50
  `);
135
- return `- **${h[o].label}**: ${i}
136
- ${c}`;
51
+ return `- **${w[a].label}**: ${c}
52
+ ${u}`;
137
53
  }).join(`
138
- `), t = s.map(({ categoryName: o, count: i, packages: a }) => {
139
- const c = a.map(({ packageName: d, count: m, apis: g }) => {
140
- const f = g.map(
141
- ({ api: u, reasons: $, items: b }) => B(e, u, $, b)
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)
142
58
  );
143
- return `#### ${d} (${m})
59
+ return `#### ${l} (${A})
144
60
 
145
- ${f.join(`
61
+ ${P.join(`
146
62
  `)}`;
147
63
  }).join(`
148
64
 
149
- `), l = h[o], p = "description" in l ? `
65
+ `), p = w[a], i = "description" in p ? `
150
66
 
151
- ${l.description}` : "";
152
- return `### ${l.label} (${i})${p}
67
+ ${p.description}` : "";
68
+ return `### ${p.label} (${c})${i}
153
69
 
154
- ${c}`;
70
+ ${u}`;
155
71
  }).join(`
156
72
 
157
73
  `);
@@ -166,90 +82,107 @@ ${r}`,
166
82
  ${t}`
167
83
  };
168
84
  }
169
- function z(e, n) {
170
- return { summary: "", details: [...Map.groupBy(n, (t) => t.package).entries()].sort(([t], [o]) => t.localeCompare(o)).map(([t, o]) => {
171
- const a = [...Map.groupBy(o, (c) => N(e.kind, c)).entries()].sort(([c], [l]) => c.localeCompare(l)).map(([, c]) => B(e, c[0].api, W(c), c));
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
+ }
91
+ return new Set([...o].filter(([, s]) => s.size > 1).map(([s]) => s));
92
+ }
93
+ function E(n, e) {
94
+ const o = x(e, "definitions");
95
+ return { summary: "", details: [...Map.groupBy(
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);
172
100
  return `#### ${t}'s deprecations
173
101
 
174
- ${a.join(`
102
+ ${c.join(`
175
103
  `)}`;
176
104
  }).join(`
177
105
 
178
106
  `) };
179
107
  }
180
- function B(e, n, s, r) {
181
- const t = s.length === 0 ? "" : ` - ${s.map(H).join(" ")}`, o = [
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
+ });
114
+ }
115
+ function N(n, e, o, s, r) {
116
+ const t = o.length === 0 ? "" : ` - ${o.map(q).join(" ")}`, a = [
182
117
  ...new Set(
183
- r.toSorted((a, c) => a.file.localeCompare(c.file) || a.line - c.line).map((a) => _(e.repository, e.ref, a.file, a.line))
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))
184
119
  )
185
- ], i = o.length === 1 ? ` ${o[0]}` : o.map((a) => ` - ${a}`).join(`
186
- `);
187
- return `- [ ] \`${n}\`${t}
188
- ${i}`;
120
+ ], c = a.length === 1 ? ` ${a[0]}` : a.map((i) => ` - ${i}`).join(`
121
+ `), m = s[0].kind, u = [
122
+ ...new Set(
123
+ s.filter(
124
+ (i) => r === "definitions" && i.provenance === "manifest" && i.kind === "css-property"
125
+ ).flatMap(({ memberOf: i }) => i === void 0 ? [] : [i])
126
+ )
127
+ ].sort(), p = u.length === 0 ? "" : ` (components: ${u.map((i) => `\`<${i}>\``).join(", ")})`;
128
+ return `- [ ] \`${e}\`${k(m)}${p}${t}${c === "" ? "" : `
129
+ ${c}`}`;
189
130
  }
190
- function W(e) {
131
+ function T(n) {
191
132
  return [
192
133
  ...new Set(
193
- e.map(({ reason: n }) => n).filter((n) => n !== null && n !== "")
134
+ n.map(({ deprecated: e }) => e).filter((e) => typeof e == "string" && e !== "")
194
135
  )
195
136
  ];
196
137
  }
197
- function F(e, n = M, s = S) {
198
- const r = `${s}
199
- `, t = n - r.length;
200
- if (t < 1)
138
+ function _(n, e = y, o = M) {
139
+ const s = `${o}
140
+ `, r = e - s.length;
141
+ if (r < 1)
201
142
  throw new Error("Issue content limit is too small for the managed marker.");
202
- const o = [];
203
- let i = e;
204
- for (; i.length > t; ) {
205
- const a = i.lastIndexOf(`
206
- `, t), c = a > 0 ? a : t;
207
- o.push(r + i.slice(0, c)), i = i.slice(c + (a > 0 ? 1 : 0));
208
- }
209
- return o.push(r + i), o;
143
+ return O(n, r).map((t) => s + t);
144
+ }
145
+ function G(n) {
146
+ return n.length === 0 ? M : `<!-- ${d} ${f(n).join(",")} -->`;
210
147
  }
211
- function G(e) {
212
- return e.length === 0 ? S : `<!-- ${y} ${k(e).join(",")} -->`;
148
+ function f(n) {
149
+ return [...new Set(n)].sort((e, o) => e.localeCompare(o));
213
150
  }
214
- function k(e) {
215
- return [...new Set(e)].sort((n, s) => n.localeCompare(s));
151
+ function S(n, e) {
152
+ return `${$(e)}${k(e.kind)}\0${g(n, e) ?? ""}`;
216
153
  }
217
- function N(e, n) {
218
- return e === "definitions" ? `${n.api}\0${U(n.file)}` : n.api;
154
+ function g(n, e) {
155
+ return n === "definitions" && e.provenance !== "manifest" ? W(e.file) : e.module;
219
156
  }
220
- function U(e) {
221
- const n = "/src/", s = "/dist/", r = e.lastIndexOf(n), t = e.lastIndexOf(s), o = Math.max(r, t), i = t > r ? s : n;
222
- return (o === -1 ? e : e.slice(o + i.length)).replace(/\.(?:d\.)?(?:[cm]?ts|tsx)$/u, "");
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, "");
223
160
  }
224
- function H(e) {
225
- const n = [], s = (o) => `\0${n.push(o) - 1}\0`, t = e.replaceAll(`\r
161
+ function q(n) {
162
+ const e = [], o = (t) => `\0${e.push(t) - 1}\0`, r = n.replaceAll(`\r
226
163
  `, `
227
164
  `).replaceAll("\r", `
228
165
  `).replace(
229
166
  /\[([^\]\n]+)\]\((https?:\/\/(?:[^()\s]|\([^()\s]*\))+?)\)/gu,
230
- (o, i, a) => s(`[${w(i)}](${a})`)
231
- ).replace(/https?:\/\/[^\s<>()]+/gu, (o) => {
232
- const i = /[.,;:!?]+$/u.exec(o)?.[0] ?? "";
233
- return `${s(o.slice(0, -i.length || void 0))}${i}`;
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}`;
234
171
  });
235
- return w(t).replace(/\0(\d+)\0/gu, (o, i) => n[Number(i)]).replaceAll(`
172
+ return h(r).replace(/\0(\d+)\0/gu, (t, a) => e[Number(a)]).replaceAll(`
236
173
  `, `
237
174
  `);
238
175
  }
239
- function w(e) {
240
- return e.replace(/^(\s*)(#{1,6})(?=\s)/gmu, "$1\\$2").replace(/#(?=\d)/gu, "# ");
176
+ function h(n) {
177
+ return n.replace(/^(\s*)(#{1,6})(?=\s)/gmu, "$1\\$2").replace(/#(?=\d)/gu, "# ");
241
178
  }
242
- function _(e, n, s, r) {
243
- const t = n.split("/").map(encodeURIComponent).join("/"), o = s.split("/").map(encodeURIComponent).join("/");
244
- return `https://${e}/blob/${t}/${o}#L${r}`;
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}`;
245
182
  }
246
183
  export {
247
- J as a,
248
- X as b,
249
- D as c,
250
- K as d,
251
- V as e,
252
- Q as f,
253
- j as g,
254
- A as i
184
+ M as a,
185
+ Z as c,
186
+ Y as f,
187
+ X as i
255
188
  };