@arcgis/codemod 6.0.0-next.15 → 6.0.0-next.16

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,7 +1,7 @@
1
1
  import { findPath as c } from "@arcgis/node-toolkit/file";
2
2
  import { path as s, toPosixPathSeparators as p } from "@arcgis/node-toolkit/path";
3
3
  import { collectOutputSync as i } from "@arcgis/node-toolkit/shell";
4
- const f = "6.0.0-next.15";
4
+ const f = "6.0.0-next.16";
5
5
  function w(o, e) {
6
6
  return o.package.localeCompare(e.package) || o.file.localeCompare(e.file) || o.line - e.line || o.column - e.column || t(o.module, e.module) || t(o.memberOf, e.memberOf) || o.name.localeCompare(e.name) || t(o.kind, e.kind) || t(o.category, e.category) || t(o.provenance, e.provenance) || String(o.deprecated).localeCompare(String(e.deprecated));
7
7
  }
@@ -1,9 +1,9 @@
1
1
  import t from "typescript";
2
- import { findPath as v } from "@arcgis/node-toolkit/file";
3
- import { toPosixPathSeparators as D, path as y } from "@arcgis/node-toolkit/path";
4
- import { retrievePackageJson as O } from "@arcgis/node-toolkit/packageJson";
5
- import { b as C, d as w } from "./cli.js";
6
- function _(e) {
2
+ import { findPath as k } from "@arcgis/node-toolkit/file";
3
+ import { toPosixPathSeparators as y, path as h } from "@arcgis/node-toolkit/path";
4
+ import { retrievePackageJson as v } from "@arcgis/node-toolkit/packageJson";
5
+ import { b as C, d as P } from "./cli.js";
6
+ function j(e) {
7
7
  if (e.kind === "css-property")
8
8
  return e.name;
9
9
  if (e.kind === "element")
@@ -21,19 +21,19 @@ function _(e) {
21
21
  const r = e.memberOf === void 0 ? e.name : `${e.memberOf}.${e.name}`;
22
22
  return e.kind === "method" || e.kind === "function" ? `${r}()` : r;
23
23
  }
24
- function G(e, r = "dash") {
24
+ function _(e, r = "dash") {
25
25
  return e === void 0 || e === "field" || e === "method" || e === "function" ? "" : r === "parentheses" ? ` (${e})` : ` - ${e}`;
26
26
  }
27
- function J(e) {
27
+ function G(e) {
28
28
  if (e === void 0)
29
29
  return {};
30
- const r = P(e), o = e.parent, i = o !== void 0 && (t.isClassLike(o) || t.isInterfaceDeclaration(o)) ? o : o !== void 0 && t.isTypeLiteralNode(o) && t.isTypeAliasDeclaration(o.parent) ? o.parent : void 0, n = i?.name === void 0 ? void 0 : L(i, i.name.text);
30
+ const r = w(e), o = e.parent, i = o !== void 0 && (t.isClassLike(o) || t.isInterfaceDeclaration(o)) ? o : o !== void 0 && t.isTypeLiteralNode(o) && t.isTypeAliasDeclaration(o.parent) ? o.parent : void 0, s = i?.name === void 0 ? void 0 : O(i, i.name.text);
31
31
  return {
32
32
  ...r === void 0 ? {} : { kind: r },
33
- ...n === void 0 ? {} : { memberOf: n }
33
+ ...s === void 0 ? {} : { memberOf: s }
34
34
  };
35
35
  }
36
- function L(e, r) {
36
+ function O(e, r) {
37
37
  const o = [];
38
38
  for (let i = e?.parent; i !== void 0; i = i.parent) {
39
39
  if (t.isClassLike(i) || t.isInterfaceDeclaration(i) || t.isTypeLiteralNode(i))
@@ -42,7 +42,7 @@ function L(e, r) {
42
42
  }
43
43
  return [...o, r].join(".");
44
44
  }
45
- function P(e) {
45
+ function w(e) {
46
46
  if (t.isPropertyDeclaration(e) || t.isPropertySignature(e))
47
47
  return (t.getCombinedModifierFlags(e) & t.ModifierFlags.Readonly) !== 0 && M(e) ? "method" : "field";
48
48
  if (t.isGetAccessorDeclaration(e) || t.isSetAccessorDeclaration(e))
@@ -65,19 +65,19 @@ function P(e) {
65
65
  function M(e) {
66
66
  return e.type !== void 0 ? t.isFunctionTypeNode(e.type) : !t.isPropertySignature(e) && e.initializer !== void 0 && t.isArrowFunction(e.initializer);
67
67
  }
68
- const H = /* @__PURE__ */ new Map([
68
+ const J = /* @__PURE__ */ new Map([
69
69
  ["MapView", "arcgis-map"],
70
70
  ["SceneView", "arcgis-scene"],
71
71
  ["LinkChartView", "arcgis-link-chart"],
72
72
  ["VideoView", "arcgis-video"]
73
- ]), A = /* @__PURE__ */ new Set([
73
+ ]), L = /* @__PURE__ */ new Set([
74
74
  "MessageBundleLoader",
75
75
  "createJSONLoader",
76
76
  "fetchMessageBundle",
77
77
  "messageBundle",
78
78
  "normalizeMessageBundleLocale",
79
79
  "registerMessageBundleLoader"
80
- ]), $ = /* @__PURE__ */ new Set([
80
+ ]), A = /* @__PURE__ */ new Set([
81
81
  "AreaMeasurement2D",
82
82
  "AreaMeasurement3D",
83
83
  "BasemapGallery",
@@ -118,17 +118,17 @@ const H = /* @__PURE__ */ new Map([
118
118
  "TableList",
119
119
  "useLegacyCreateTools"
120
120
  ]);
121
- function V({
121
+ function $({
122
122
  package: e,
123
123
  name: r,
124
124
  category: o,
125
125
  memberOf: i,
126
- module: n,
127
- deprecated: c
126
+ module: s,
127
+ deprecated: u
128
128
  }) {
129
129
  if (o !== void 0)
130
130
  return o;
131
- const u = e.toLowerCase(), s = typeof c == "string" ? c.toLowerCase() : "";
131
+ const a = e.toLowerCase(), n = typeof u == "string" ? u.toLowerCase() : "";
132
132
  return e === "@arcgis/core" && r === "ui" && [
133
133
  "DOMContainer",
134
134
  "DOMContainerProperties",
@@ -140,78 +140,83 @@ function V({
140
140
  "LinkChartViewProperties",
141
141
  "VideoView",
142
142
  "VideoViewProperties"
143
- ].includes(i?.replace(/^__esri\./u, "") ?? "") ? "coreViews" : e === "@arcgis/core" && ($.has(r) || s.includes("components-transition-plan")) ? "coreWidgets" : e === "@arcgis/core" && (/^(?:__esri\.)?(?:geometryEngine(?:Async)?|projection)(?:\.|$)/u.test(r) || r === "extendedSpatialReferenceInfo" || n?.startsWith("geometry/geometryEngine") || n?.startsWith("geometry/projection")) ? "coreGeometryEngine" : /\bcodemod\b/iu.test(s) ? "codemod" : e === "@arcgis/core" && (A.has(r) || s.includes("widget translations")) ? "coreIntl" : u.includes("calcite") ? "calcite" : /^@arcgis\/.+components/u.test(u) ? "arcgisComponents" : e === "@arcgis/core" ? "arcgisCore" : u.startsWith("@arcgis/") ? "arcgisSupport" : C(e) ? "otherEsri" : "nonEsri";
144
- }
145
- function K(e, r) {
146
- return B(x(e, r));
143
+ ].includes(i?.replace(/^__esri\./u, "") ?? "") ? "coreViews" : e === "@arcgis/core" && (A.has(r) || n.includes("components-transition-plan")) ? "coreWidgets" : e === "@arcgis/core" && (/^(?:__esri\.)?(?:geometryEngine(?:Async)?|projection)(?:\.|$)/u.test(r) || r === "extendedSpatialReferenceInfo" || s?.startsWith("geometry/geometryEngine") || s?.startsWith("geometry/projection")) ? "coreGeometryEngine" : /\bcodemod\b/iu.test(n) ? "codemod" : e === "@arcgis/core" && (L.has(r) || n.includes("widget translations")) ? "coreIntl" : a.includes("calcite") ? "calcite" : /^@arcgis\/.+components/u.test(a) ? "arcgisComponents" : e === "@arcgis/core" ? "arcgisCore" : a.startsWith("@arcgis/") ? "arcgisSupport" : C(e) ? "otherEsri" : "nonEsri";
147
144
  }
148
- function B(e) {
149
- return e?.replace(/^(components?\/[^/]+-[^/]+)\/customElement$/u, "$1");
150
- }
151
- const b = /^(?:src|dist)\//u;
152
- function x(e, r) {
153
- const o = `/node_modules/${r}/`, i = e.map(D).sort(
154
- (n, c) => Number(c.includes(o)) - Number(n.includes(o)) || n.localeCompare(c)
145
+ function H(e, r) {
146
+ const o = `/node_modules/${r}/`, i = e.map(y).sort(
147
+ (s, u) => Number(u.includes(o)) - Number(s.includes(o)) || s.localeCompare(u)
155
148
  );
156
- for (const n of i) {
157
- const c = n.lastIndexOf(o);
158
- if (c !== -1)
159
- return n.slice(c + o.length).replace(b, "").replace(h, "");
160
- const u = [...n.matchAll(/\/(?:src|dist)(?=\/)/gu)];
161
- if (u.length === 1) {
162
- const d = u[0];
163
- return n.slice(d.index + d[0].length + 1).replace(h, "");
149
+ for (const s of i) {
150
+ const u = s.lastIndexOf(o);
151
+ let a;
152
+ if (u !== -1)
153
+ a = s.slice(u + o.length);
154
+ else {
155
+ const n = [...s.matchAll(/\/(?:src|dist)(?=\/)/gu)];
156
+ if (n.length === 1)
157
+ a = s.slice(n[0].index + 1);
158
+ else {
159
+ const c = k("package.json", h.dirname(s));
160
+ if (c === void 0)
161
+ continue;
162
+ const d = h.dirname(c);
163
+ if (v(d).name !== r)
164
+ continue;
165
+ a = y(h.relative(d, s));
166
+ }
164
167
  }
165
- const s = v("package.json", y.dirname(n));
166
- if (s === void 0)
167
- continue;
168
- const a = y.dirname(s);
169
- if (O(a).name === r)
170
- return D(y.relative(a, n)).replace(b, "").replace(h, "");
168
+ return a.startsWith("src/") ? V(a) : B(a);
171
169
  }
172
170
  }
173
- const h = /\.(?:d\.)?(?:[cm]?ts|tsx)$/u;
174
- function q(e, r) {
175
- const o = Map.groupBy(e, (i) => V(r(i)));
176
- return Object.keys(w).flatMap((i) => {
177
- const n = o.get(i);
178
- if (n === void 0)
171
+ function V(e) {
172
+ return y(e).replace(/^src\//u, "").replace(D, "");
173
+ }
174
+ function B(e) {
175
+ return y(e).replace(/^dist\//u, "").replace(D, "").replace(/^(components?\/[^/]+-[^/]+)\/customElement$/u, "$1");
176
+ }
177
+ const D = /\.(?:d\.)?(?:[cm]?ts|tsx)$/u;
178
+ function K(e, r) {
179
+ const o = Map.groupBy(e, (i) => $(r(i)));
180
+ return Object.keys(P).flatMap((i) => {
181
+ const s = o.get(i);
182
+ if (s === void 0)
179
183
  return [];
180
- const u = [...Map.groupBy(n, (s) => {
181
- const a = r(s);
182
- return T(a.package, a.module);
183
- })].map(([s, a]) => {
184
- const d = r(a[0]).package, S = [...Map.groupBy(a, (m) => {
184
+ const a = [...Map.groupBy(s, (n) => {
185
+ const c = r(n);
186
+ return T(c.package, c.module);
187
+ })].map(([n, c]) => {
188
+ const d = r(c[0]).package, S = [...Map.groupBy(c, (m) => {
185
189
  const l = r(m);
186
190
  return JSON.stringify([l.name, l.memberOf, l.kind]);
187
191
  }).values()].map((m) => {
188
- const l = r(m[0]).name, f = m.map((p) => r(p).deprecated).filter((p) => typeof p == "string" && p !== ""), g = [...new Set(f)].sort((p, k) => p.localeCompare(k));
192
+ const l = r(m[0]).name, f = m.map((p) => r(p).deprecated).filter((p) => typeof p == "string" && p !== ""), g = [...new Set(f)].sort((p, b) => p.localeCompare(b));
189
193
  return { name: l, reasons: g, items: m };
190
194
  });
191
195
  return S.sort((m, l) => {
192
196
  const f = r(m.items[0]), g = r(l.items[0]);
193
197
  return l.items.length - m.items.length || m.name.localeCompare(l.name) || (f.memberOf ?? "").localeCompare(g.memberOf ?? "") || (f.kind ?? "").localeCompare(g.kind ?? "");
194
- }), { packageName: d, displayName: s, count: a.length, apis: S };
198
+ }), { packageName: d, displayName: n, count: c.length, apis: S };
195
199
  });
196
- return u.sort(
197
- (s, a) => a.count - s.count || s.packageName.localeCompare(a.packageName) || s.displayName.localeCompare(a.displayName)
198
- ), [{ categoryName: i, count: n.length, packages: u }];
200
+ return a.sort(
201
+ (n, c) => c.count - n.count || n.packageName.localeCompare(c.packageName) || n.displayName.localeCompare(c.displayName)
202
+ ), [{ categoryName: i, count: s.length, packages: a }];
199
203
  });
200
204
  }
201
205
  function T(e, r) {
202
- return F(e, r) ? "DOM / Web platform" : e;
206
+ return x(e, r) ? "DOM / Web platform" : e;
203
207
  }
204
- function F(e, r) {
208
+ function x(e, r) {
205
209
  return e === "typescript" && /^lib\/lib\.dom(?:$|[./])/u.test(r ?? "");
206
210
  }
207
211
  export {
208
- K as a,
209
- _ as b,
210
- V as c,
211
- G as d,
212
- J as e,
213
- L as f,
214
- q as g,
215
- H as h,
216
- T as i
212
+ H as a,
213
+ j as b,
214
+ $ as c,
215
+ _ as d,
216
+ G as e,
217
+ O as f,
218
+ K as g,
219
+ J as h,
220
+ T as i,
221
+ V as s
217
222
  };
@@ -291,7 +291,7 @@ const O = {
291
291
  description: "A codemod is available to automate these migrations."
292
292
  },
293
293
  calcite: {
294
- label: "Calcite components",
294
+ label: "Calcite design system",
295
295
  description: "This does not include visual breaking changes. See complete list in https://confluencewikidev.esri.com/spaces/Calcite/pages/464553094/Calcite+6.0+-+Breaking+Change+Release+February"
296
296
  },
297
297
  arcgisCore: { label: "@arcgis/core" },
@@ -1,39 +1,40 @@
1
- import g 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 k, asyncRetrievePackageJson as D } from "@arcgis/node-toolkit/packageJson";
5
- import { log as S } from "@arcgis/toolkit/log";
6
- import { realpath as h, readFile as b } from "node:fs/promises";
7
- import { f as P } from "./log.js";
8
- import { b as j } from "./cli.js";
9
- function _(e) {
10
- return typeof e == "string" ? e : e.map((n) => n.kind === g.SyntaxKind.JSDocText ? n.text : M(n.getText())).join("");
11
- }
12
- function A(e) {
13
- return e === void 0 ? void 0 : E(g.displayPartsToString([...e]));
14
- }
15
- function E(e) {
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) {
16
17
  return e.replace(
17
18
  /\{@link(?:code|plain)?\s+([\s\S]*?)\}/gu,
18
- (n, t) => w(t)
19
+ (n, s) => P(s)
19
20
  );
20
21
  }
21
- function M(e) {
22
+ function O(e) {
22
23
  const n = /^\{@link(?:code|plain)?\s+([\s\S]*?)\}$/u.exec(e)?.[1];
23
- return n === void 0 ? e : w(n);
24
+ return n === void 0 ? e : P(n);
24
25
  }
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 [i, ...a] = n.split(/\s+/u);
30
- return a.join(" ") || i;
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;
31
32
  }
32
- function z(e, n) {
33
- const t = v("package.json", e);
34
- return t === void 0 ? n : k(r.dirname(t)).name ?? n;
33
+ function q(e, n) {
34
+ const s = S("package.json", e);
35
+ return s === void 0 ? n : v(p.dirname(s)).name ?? n;
35
36
  }
36
- const f = {
37
+ const m = {
37
38
  docsLegacyDependencyLocations: /* @__PURE__ */ new Map([
38
39
  ["@arcgis/coding-components", "packages/coding-packages/coding-components"],
39
40
  ["@arcgis/core", "packages/core-packages/core/output/npm/esm"],
@@ -50,154 +51,208 @@ const f = {
50
51
  ignoreDeprecatedApis: [],
51
52
  ignoredDeprecationsByIncludes: []
52
53
  };
53
- function R(e) {
54
- const n = /* @__PURE__ */ new Map(), t = {};
54
+ function G(e) {
55
+ const n = /* @__PURE__ */ new Map(), s = {};
55
56
  if (e?.contents.name !== "@webgis/docs")
56
- return { packages: n, paths: t };
57
- const i = r.dirname(e.filePath), a = r.resolve(i, "../../..");
58
- if (r.relative(a, i) !== "packages/docs/app" || !g.sys.fileExists(r.join(a, "pnpm-workspace.yaml")))
59
- return { packages: n, paths: t };
60
- const s = new Set(
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(
61
62
  Object.entries({
62
63
  ...e.contents.dependencies,
63
64
  ...e.contents.devDependencies,
64
65
  ...e.contents.peerDependencies,
65
66
  ...e.contents.optionalDependencies
66
- }).filter(([, o]) => o === "catalog:legacyStarshipDeps").map(([o]) => o)
67
+ }).filter(([, t]) => t === "catalog:legacyStarshipDeps").map(([t]) => t)
67
68
  );
68
- if (s.size === 0)
69
+ if (o.size === 0)
69
70
  throw Error(
70
71
  "Didn't find any catalog:legacyStarshipDeps in @webgis/docs. Update special handling in @arcgis/codemod"
71
72
  );
72
- for (const o of s) {
73
- const c = f.docsLegacyDependencyLocations.get(o);
74
- if (c === void 0)
73
+ for (const t of o) {
74
+ const r = m.docsLegacyDependencyLocations.get(t);
75
+ if (r === void 0)
75
76
  throw new Error(
76
- `Unmapped legacy dependency ${o} in @webgis/docs. Update special handling in @arcgis/codemod.`
77
+ `Unmapped legacy dependency ${t} in @webgis/docs. Update special handling in @arcgis/codemod.`
77
78
  );
78
- const l = r.join(a, c), p = r.join(l, "package.json");
79
- if (!g.sys.fileExists(p))
79
+ const c = p.join(i, r), d = p.join(c, "package.json");
80
+ if (!k.sys.fileExists(d))
80
81
  throw new Error(
81
- `Missing audit dependency ${o} at ${p}. Install dependencies and build workspace packages before auditing usages.`
82
+ `Missing audit dependency ${t} at ${d}. Install dependencies and build workspace packages before auditing usages.`
82
83
  );
83
- const m = k(l);
84
- n.set(o, p);
85
- for (const [d, u] of Object.entries(
86
- m.exports ?? { ".": m.types ?? "./index.d.ts", "./*": "./*" }
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", "./*": "./*" }
87
88
  )) {
88
- const y = typeof u == "string" ? u : u.types;
89
- y !== void 0 && (t[d === "." ? o : `${o}/${d.slice(2)}`] = [r.resolve(l, y)]);
89
+ const w = typeof l == "string" ? l : l.types;
90
+ w !== void 0 && (s[f === "." ? t : `${t}/${f.slice(2)}`] = [p.resolve(c, w)]);
90
91
  }
91
92
  }
92
- return { packages: n, paths: t };
93
+ return { packages: n, paths: s };
93
94
  }
94
- function K(e) {
95
- return e !== void 0 && f.excludedPackageNames.has(e);
95
+ function H(e) {
96
+ return e !== void 0 && m.excludedPackageNames.has(e);
96
97
  }
97
- function N(e) {
98
- return f.excludedPathFragments.some((n) => `/${e}`.includes(n));
98
+ function T(e) {
99
+ return m.excludedPathFragments.some((n) => `/${e}`.includes(n));
99
100
  }
100
- function V(e) {
101
- return N(e) || f.excludedDefinitionPathFragments.some((n) => e.includes(n));
101
+ function Q(e) {
102
+ return T(e) || m.excludedDefinitionPathFragments.some((n) => e.includes(n));
102
103
  }
103
- function q(e, n) {
104
- return f.ignoreDeprecatedApis.some((t) => t === e) || n != null && f.ignoredDeprecationsByIncludes.some((t) => n.includes(t));
105
- }
106
- function $(e, n, t) {
107
- const i = JSON.parse(e), a = { definitions: [], components: /* @__PURE__ */ new Set() };
108
- for (const s of i.modules)
109
- for (const o of s.declarations ?? []) {
110
- let c = function(p, m, d) {
111
- d !== !0 && typeof d != "string" || a.definitions.push({
112
- package: t,
113
- module: s.path,
114
- name: p,
115
- kind: m,
116
- memberOf: m === "element" ? void 0 : l,
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 } },
117
120
  provenance: "manifest",
118
- reason: typeof d == "string" ? d : void 0,
121
+ reason: typeof f == "string" ? f : void 0,
119
122
  sourceFileName: n,
120
123
  line: 1,
121
124
  column: 1
122
125
  });
123
126
  };
124
- if (!("tagName" in o) || o.tagName === void 0)
127
+ if (!("tagName" in t) || t.tagName === void 0)
125
128
  continue;
126
- const l = o.tagName;
127
- a.components.add(l), c(l, "element", o.deprecated);
128
- for (const [p, m] of [
129
+ const c = t.tagName;
130
+ i.components.add(c), r(c, "element", t.deprecated);
131
+ for (const [d, u] of [
129
132
  ["cssProperties", "css-property"],
130
133
  ["cssParts", "css-part"],
131
134
  ["cssStates", "css-state"],
132
- ["slots", "slot"],
133
- ["attributes", "attribute"]
135
+ ["slots", "slot"]
134
136
  ])
135
- for (const d of o[p] ?? [])
136
- p === "slots" && d.name === "" || c(d.name, m, d.deprecated);
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);
137
141
  }
138
- return a;
142
+ }
143
+ return i;
139
144
  }
140
- function G(e) {
141
- const n = e.flatMap((s) => s.definitions), t = /* @__PURE__ */ new Map();
142
- for (const s of e)
143
- for (const o of s.components) {
144
- const c = t.get(o) ?? [];
145
- c.push(s), t.set(o, c);
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);
146
151
  }
147
- const i = /* @__PURE__ */ new Map(), a = Map.groupBy(
148
- n.filter(({ kind: s }) => s === "css-property"),
149
- ({ name: s }) => s
152
+ const a = /* @__PURE__ */ new Map(), i = Map.groupBy(
153
+ n.filter(({ kind: o }) => o === "css-property"),
154
+ ({ name: o }) => o
150
155
  );
151
- for (const [s, o] of a)
152
- new Set(o.map((c) => c.package)).size === 1 && i.set(s, o[0]);
153
- return { hasDeprecatedApis: n.length > 0, components: t, cssVariables: i };
154
- }
155
- function H(e = "warn", n) {
156
- const t = /* @__PURE__ */ new Map();
157
- return async (i) => {
158
- const a = await h(i);
159
- let s = t.get(a);
160
- return s === void 0 && (s = O(a).catch((o) => {
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) => {
161
166
  if (n?.(), e === "throw")
162
167
  throw new Error(
163
- `Unable to read component manifest for ${a}. Build the package before auditing definitions.`,
164
- { cause: o }
168
+ `Unable to read component manifest for ${i}. Build the package before auditing definitions.`,
169
+ { cause: t }
165
170
  );
166
- S("warn", P(a), `Unable to read component manifest: ${String(o)}`);
167
- }), t.set(a, s)), await s;
171
+ b("warn", D(i), `Unable to read component manifest: ${String(t)}`);
172
+ }), s.set(i, o)), await o;
168
173
  };
169
174
  }
170
- async function Q(e, n, t, i) {
171
- const a = /* @__PURE__ */ new Set([
175
+ async function ee(e, n, s, a) {
176
+ const i = /* @__PURE__ */ new Set([
172
177
  ...Object.keys(e.contents.dependencies ?? {}),
173
178
  ...Object.keys(e.contents.devDependencies ?? {}),
174
179
  ...Object.keys(e.contents.peerDependencies ?? {}),
175
180
  ...Object.keys(e.contents.optionalDependencies ?? {})
176
- ]), s = await Promise.all(
177
- [...a].filter((o) => o !== e.contents.name && (!t || j(o))).map(async (o) => {
178
- const c = i?.get(o) ?? await x(r.join("node_modules", o, "package.json"), r.dirname(e.filePath));
179
- return c === void 0 ? void 0 : await n(c);
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)];
180
191
  })
181
192
  );
182
- return [...new Set(s.filter((o) => o !== void 0))];
193
+ return [...new Set(o.flat().filter((t) => t !== void 0))];
183
194
  }
184
- async function O(e) {
185
- const n = r.dirname(e), t = await D(n), i = typeof t.customElements == "string" ? t.customElements : t.customElements?.[0];
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];
186
205
  if (i === void 0)
187
206
  return;
188
- const a = await h(r.resolve(n, i));
189
- return $(await b(a, "utf8"), a, t.name);
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);
190
245
  }
191
246
  export {
192
- N as a,
193
- q as b,
194
- G as c,
195
- z as d,
196
- H as e,
197
- _ as f,
198
- R as g,
199
- A as h,
200
- V as i,
201
- Q as l,
202
- K as s
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
203
258
  };