@arcgis/codemod 6.0.0-next.30 → 6.0.0-next.32

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.
@@ -1,40 +1,40 @@
1
- import k from "typescript";
2
- import { findPath as S, asyncFindPath as y } from "@arcgis/node-toolkit/file";
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 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";
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 === k.SyntaxKind.JSDocText ? n.text : O(n.getText())).join("");
11
+ return typeof e == "string" ? e : e.map((n) => n.kind === l.SyntaxKind.JSDocText ? n.text : T(n.getText())).join("");
12
12
  }
13
- function W(e) {
14
- return e === void 0 ? void 0 : N(k.displayPartsToString([...e]));
13
+ function q(e) {
14
+ return e === void 0 ? void 0 : O(l.displayPartsToString([...e]));
15
15
  }
16
- function N(e) {
16
+ function O(e) {
17
17
  return e.replace(
18
18
  /\{@link(?:code|plain)?\s+([\s\S]*?)\}/gu,
19
- (n, s) => P(s)
19
+ (n, s) => D(s)
20
20
  );
21
21
  }
22
- function O(e) {
22
+ function T(e) {
23
23
  const n = /^\{@link(?:code|plain)?\s+([\s\S]*?)\}$/u.exec(e)?.[1];
24
- return n === void 0 ? e : P(n);
24
+ return n === void 0 ? e : D(n);
25
25
  }
26
- function P(e) {
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 q(e, n) {
34
- const s = S("package.json", e);
35
- return s === void 0 ? n : v(p.dirname(s)).name ?? 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 m = {
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
- excludedPackageNames: /* @__PURE__ */ new Set(),
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 G(e) {
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" || !k.sys.fileExists(p.join(i, "pnpm-workspace.yaml")))
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 r = m.docsLegacyDependencyLocations.get(t);
75
- if (r === void 0)
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, r), d = p.join(c, "package.json");
80
- if (!k.sys.fileExists(d))
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 ${d}. Install dependencies and build workspace packages before auditing usages.`
78
+ `Missing audit dependency ${t} at ${r}. Install dependencies and build workspace packages before auditing usages.`
83
79
  );
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", "./*": "./*" }
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 w = typeof l == "string" ? l : l.types;
90
- w !== void 0 && (s[f === "." ? t : `${t}/${f.slice(2)}`] = [p.resolve(c, w)]);
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 T(e) || m.excludedDefinitionPathFragments.some((n) => e.includes(n));
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
- return m.ignoreDeprecatedApis.some((s) => s === e) || n != null && m.ignoredDeprecationsByIncludes.some((s) => n.includes(s));
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 C(e, n, s) {
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(M(o.sourcePath), o.path);
127
+ o.sourcePath !== void 0 && i.modulePaths.set(N(o.sourcePath), o.path);
111
128
  for (const t of o.declarations ?? []) {
112
- let r = function(d, u, f, l) {
113
- f !== !0 && typeof f != "string" || i.definitions.push({
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: 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 } },
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 f == "string" ? f : void 0,
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), r(c, "element", t.deprecated);
131
- for (const [d, u] of [
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 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);
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 r = s.get(t) ?? [];
150
- r.push(o), s.set(t, r);
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((r) => r.package)).size === 1 && a.set(o, t[0]);
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 h(a);
181
+ const i = await k(a);
164
182
  let o = s.get(i);
165
- return o === void 0 && (o = F(i, n).catch((t) => {
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
- b("warn", D(i), `Unable to read component manifest: ${String(t)}`);
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 || $(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)
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(r), d = t === "@esri/calcite-components" ? await y(
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 h(r))
206
+ p.dirname(await k(d))
189
207
  ) : void 0;
190
- return [c, d === void 0 ? void 0 : await n(d)];
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 F(e, n) {
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 L(s, a.name);
217
+ return await A(s, a.name);
200
218
  } catch (t) {
201
- n?.(), b("error", D(s), `Calcite design tokens integration is out of date: ${String(t)}`);
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 h(p.resolve(s, i));
208
- return C(await x(o, "utf8"), o, a.name);
225
+ const o = await k(p.resolve(s, i));
226
+ return L(await b(o, "utf8"), o, a.name);
209
227
  }
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();
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 h(p.join(s, o)), r = JSON.parse(await x(t, "utf8"));
216
- if (!g(r) || !Array.isArray(r.tokens))
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 r.tokens) {
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 d = c.$description ?? c.description;
224
- if (typeof d != "string")
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 u = c.attributes.names.css.slice(4, -1);
227
- a.has(u) || a.set(u, {
244
+ const f = c.attributes.names.css.slice(4, -1);
245
+ a.has(f) || a.set(f, {
228
246
  package: n,
229
- name: u,
247
+ name: f,
230
248
  kind: "css-property",
231
249
  provenance: "manifest",
232
- reason: d,
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
- T as a,
248
- X as b,
263
+ G as a,
264
+ Z as b,
249
265
  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,
266
+ V as d,
267
+ q as e,
268
+ Q as f,
269
+ H as g,
256
270
  ee as l,
257
- H as s
271
+ X as s
258
272
  };
@@ -1,32 +1,42 @@
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) {
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 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);
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 [...e.entries()].map(([o, s]) => {
18
- const r = o === "" ? [] : o.split(","), t = L(n, s);
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: 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))
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((o, s) => o.owners.join(",").localeCompare(s.owners.join(",")));
30
+ }).sort((s, r) => s.owners.join(",").localeCompare(r.owners.join(",")));
27
31
  }
28
- function L(n, e) {
29
- const o = f(e.flatMap((r) => r.codeowners)).filter(
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 = b[n.auditKind], r = j(n, e);
47
+ const s = P[n.auditKind], r = j(n, e);
38
48
  return `${s}${o}${r.summary}
39
49
 
40
- ${v}
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 = 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(`
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[a].label}**: ${c}
61
+ return `- **${w[i].label}**: ${c}
52
62
  ${u}`;
53
63
  }).join(`
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)
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} (${A})
69
+ return `#### ${l} (${C})
60
70
 
61
- ${P.join(`
71
+ ${R.join(`
62
72
  `)}`;
63
73
  }).join(`
64
74
 
65
- `), p = w[a], i = "description" in p ? `
75
+ `), p = w[i], a = "description" in p ? `
66
76
 
67
77
  ${p.description}` : "";
68
- return `### ${p.label} (${c})${i}
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 x(n, e) {
95
+ function I(n, e) {
86
96
  const o = /* @__PURE__ */ new Map();
87
97
  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);
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 = x(e, "definitions");
104
+ const o = I(e, "definitions");
95
105
  return { summary: "", details: [...Map.groupBy(
96
106
  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);
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 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);
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(" ")}`, a = [
126
+ const t = o.length === 0 ? "" : ` - ${o.map(q).join(" ")}`, i = [
117
127
  ...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(n.repository, n.ref, i.file, i.line))
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 = a.length === 1 ? ` ${a[0]}` : a.map((i) => ` - ${i}`).join(`
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
- (i) => r === "definitions" && i.provenance === "manifest" && i.kind === "css-property"
125
- ).flatMap(({ memberOf: i }) => i === void 0 ? [] : [i])
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((i) => `\`<${i}>\``).join(", ")})`;
128
- return `- [ ] \`${e}\`${k(m)}${p}${t}${c === "" ? "" : `
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 T(n) {
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 _(n, e = y, o = M) {
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 O(n, r).map((t) => s + t);
153
+ return L(n, r).map((t) => s + t);
144
154
  }
145
- function G(n) {
146
- return n.length === 0 ? M : `<!-- ${d} ${f(n).join(",")} -->`;
155
+ function x(n, e = "usages") {
156
+ const o = d(n).join(",");
157
+ return `<!-- ${$[e]}${o === "" ? "" : ` owners=${o}`} -->`;
147
158
  }
148
- function f(n) {
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 S(n, e) {
152
- return `${$(e)}${k(e.kind)}\0${g(n, e) ?? ""}`;
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), a = r > s ? o : e;
159
- return (t === -1 ? n : n.slice(t + a.length)).replace(/\.(?:d\.)?(?:[cm]?ts|tsx)$/u, "");
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, a, c) => o(`[${h(a)}](${c})`)
190
+ (t, i, c) => o(`[${k(i)}](${c})`)
168
191
  ).replace(/https?:\/\/[^\s<>()]+/gu, (t) => {
169
- const a = /[.,;:!?]+$/u.exec(t)?.[0] ?? "";
170
- return `${o(t.slice(0, -a.length || void 0))}${a}`;
192
+ const i = /[.,;:!?]+$/u.exec(t)?.[0] ?? "";
193
+ return `${o(t.slice(0, -i.length || void 0))}${i}`;
171
194
  });
172
- return h(r).replace(/\0(\d+)\0/gu, (t, a) => e[Number(a)]).replaceAll(`
195
+ return k(r).replace(/\0(\d+)\0/gu, (t, i) => e[Number(i)]).replaceAll(`
173
196
  `, `
174
197
  `);
175
198
  }
176
- function h(n) {
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
- M as a,
185
- Z as c,
186
- Y as f,
187
- X as i
207
+ $ as a,
208
+ x as b,
209
+ Y as c,
210
+ X as f,
211
+ Z as p
188
212
  };