@arcgis/codemod 6.0.0-next.15 → 6.0.0-next.17
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 +1 -1
- package/dist/chunks/classification.js +75 -70
- package/dist/chunks/cli.js +1 -1
- package/dist/chunks/componentAudit.js +181 -126
- package/dist/chunks/index.js +672 -529
- package/dist/chunks/index2.js +95 -96
- package/dist/chunks/index3.js +146 -146
- package/package.json +6 -5
package/dist/chunks/artifact.js
CHANGED
|
@@ -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.
|
|
4
|
+
const f = "6.0.0-next.17";
|
|
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
|
|
3
|
-
import { toPosixPathSeparators as
|
|
4
|
-
import { retrievePackageJson as
|
|
5
|
-
import { b as C, d as
|
|
6
|
-
function
|
|
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
|
|
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
|
|
27
|
+
function G(e) {
|
|
28
28
|
if (e === void 0)
|
|
29
29
|
return {};
|
|
30
|
-
const r =
|
|
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
|
-
...
|
|
33
|
+
...s === void 0 ? {} : { memberOf: s }
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
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
|
|
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
|
|
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
|
-
]),
|
|
73
|
+
]), L = /* @__PURE__ */ new Set([
|
|
74
74
|
"MessageBundleLoader",
|
|
75
75
|
"createJSONLoader",
|
|
76
76
|
"fetchMessageBundle",
|
|
77
77
|
"messageBundle",
|
|
78
78
|
"normalizeMessageBundleLocale",
|
|
79
79
|
"registerMessageBundleLoader"
|
|
80
|
-
]),
|
|
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
|
|
121
|
+
function $({
|
|
122
122
|
package: e,
|
|
123
123
|
name: r,
|
|
124
124
|
category: o,
|
|
125
125
|
memberOf: i,
|
|
126
|
-
module:
|
|
127
|
-
deprecated:
|
|
126
|
+
module: s,
|
|
127
|
+
deprecated: u
|
|
128
128
|
}) {
|
|
129
129
|
if (o !== void 0)
|
|
130
130
|
return o;
|
|
131
|
-
const
|
|
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" && (
|
|
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
|
|
149
|
-
|
|
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
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
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
|
-
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
|
181
|
-
const
|
|
182
|
-
return T(
|
|
183
|
-
})].map(([
|
|
184
|
-
const d = r(
|
|
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,
|
|
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:
|
|
198
|
+
}), { packageName: d, displayName: n, count: c.length, apis: S };
|
|
195
199
|
});
|
|
196
|
-
return
|
|
197
|
-
(
|
|
198
|
-
), [{ categoryName: i, count:
|
|
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
|
|
206
|
+
return x(e, r) ? "DOM / Web platform" : e;
|
|
203
207
|
}
|
|
204
|
-
function
|
|
208
|
+
function x(e, r) {
|
|
205
209
|
return e === "typescript" && /^lib\/lib\.dom(?:$|[./])/u.test(r ?? "");
|
|
206
210
|
}
|
|
207
211
|
export {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
|
};
|
package/dist/chunks/cli.js
CHANGED
|
@@ -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
|
|
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
|
|
2
|
-
import { findPath as
|
|
3
|
-
import { path as
|
|
4
|
-
import { retrievePackageJson as
|
|
5
|
-
import { log as
|
|
6
|
-
import { realpath as h, readFile as
|
|
7
|
-
import { f as
|
|
8
|
-
import { b as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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,
|
|
19
|
+
(n, s) => P(s)
|
|
19
20
|
);
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function O(e) {
|
|
22
23
|
const n = /^\{@link(?:code|plain)?\s+([\s\S]*?)\}$/u.exec(e)?.[1];
|
|
23
|
-
return n === void 0 ? e :
|
|
24
|
+
return n === void 0 ? e : P(n);
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
-
const n = e.trim().replace(/^(\S+)\s+([/:#!.])/u, "$1$2"),
|
|
27
|
-
if (
|
|
28
|
-
return n.slice(
|
|
29
|
-
const [
|
|
30
|
-
return
|
|
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
|
|
33
|
-
const
|
|
34
|
-
return
|
|
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
|
|
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
|
|
54
|
-
const n = /* @__PURE__ */ new Map(),
|
|
54
|
+
function G(e) {
|
|
55
|
+
const n = /* @__PURE__ */ new Map(), s = {};
|
|
55
56
|
if (e?.contents.name !== "@webgis/docs")
|
|
56
|
-
return { packages: n, paths:
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
return { packages: n, paths:
|
|
60
|
-
const
|
|
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(([,
|
|
67
|
+
}).filter(([, t]) => t === "catalog:legacyStarshipDeps").map(([t]) => t)
|
|
67
68
|
);
|
|
68
|
-
if (
|
|
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
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
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 ${
|
|
77
|
+
`Unmapped legacy dependency ${t} in @webgis/docs. Update special handling in @arcgis/codemod.`
|
|
77
78
|
);
|
|
78
|
-
const
|
|
79
|
-
if (!
|
|
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 ${
|
|
82
|
+
`Missing audit dependency ${t} at ${d}. Install dependencies and build workspace packages before auditing usages.`
|
|
82
83
|
);
|
|
83
|
-
const
|
|
84
|
-
n.set(
|
|
85
|
-
for (const [
|
|
86
|
-
|
|
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
|
|
89
|
-
|
|
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:
|
|
93
|
+
return { packages: n, paths: s };
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
-
return e !== void 0 &&
|
|
95
|
+
function H(e) {
|
|
96
|
+
return e !== void 0 && m.excludedPackageNames.has(e);
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
-
return
|
|
98
|
+
function T(e) {
|
|
99
|
+
return m.excludedPathFragments.some((n) => `/${e}`.includes(n));
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
-
return
|
|
101
|
+
function Q(e) {
|
|
102
|
+
return T(e) || m.excludedDefinitionPathFragments.some((n) => e.includes(n));
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
105
|
-
}
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
for (const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
|
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
|
|
127
|
+
if (!("tagName" in t) || t.tagName === void 0)
|
|
125
128
|
continue;
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
for (const [
|
|
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
|
|
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);
|
|
137
141
|
}
|
|
138
|
-
|
|
142
|
+
}
|
|
143
|
+
return i;
|
|
139
144
|
}
|
|
140
|
-
function
|
|
141
|
-
const n = e.flatMap((
|
|
142
|
-
for (const
|
|
143
|
-
for (const
|
|
144
|
-
const
|
|
145
|
-
|
|
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
|
|
148
|
-
n.filter(({ kind:
|
|
149
|
-
({ name:
|
|
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 [
|
|
152
|
-
new Set(
|
|
153
|
-
return { hasDeprecatedApis: n.length > 0, components:
|
|
154
|
-
}
|
|
155
|
-
function
|
|
156
|
-
const
|
|
157
|
-
return async (
|
|
158
|
-
const
|
|
159
|
-
let
|
|
160
|
-
return
|
|
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 ${
|
|
164
|
-
{ cause:
|
|
168
|
+
`Unable to read component manifest for ${i}. Build the package before auditing definitions.`,
|
|
169
|
+
{ cause: t }
|
|
165
170
|
);
|
|
166
|
-
|
|
167
|
-
}),
|
|
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
|
|
171
|
-
const
|
|
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
|
-
]),
|
|
177
|
-
[...
|
|
178
|
-
const
|
|
179
|
-
|
|
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(
|
|
193
|
+
return [...new Set(o.flat().filter((t) => t !== void 0))];
|
|
183
194
|
}
|
|
184
|
-
async function
|
|
185
|
-
const
|
|
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
|
|
189
|
-
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);
|
|
190
245
|
}
|
|
191
246
|
export {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
};
|