@contentful/experience-design-system-cli 2.39.1-dev-build-4580d8be.0 → 2.39.1-dev-build-eee35c0c.0
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/app.js +607 -683
- package/dist/index.js +614 -724
- package/dist/package.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@ var __esm = (fn, res) => function __init() {
|
|
|
4
4
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
5
|
};
|
|
6
6
|
var __export = (target, all) => {
|
|
7
|
-
for (var
|
|
8
|
-
__defProp(target,
|
|
7
|
+
for (var name2 in all)
|
|
8
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js
|
|
@@ -26,17 +26,17 @@ var init_config_root = __esm({
|
|
|
26
26
|
function escapeForRegExp(value) {
|
|
27
27
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
28
28
|
}
|
|
29
|
-
function identifierPattern(
|
|
30
|
-
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(
|
|
29
|
+
function identifierPattern(name2) {
|
|
30
|
+
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(name2)}(?![A-Za-z0-9_$])`);
|
|
31
31
|
}
|
|
32
32
|
function excerptAroundNames(text, names, maxChars, contextLines = 6) {
|
|
33
33
|
if (text.length <= maxChars)
|
|
34
34
|
return { content: text, usesNotShown: [] };
|
|
35
|
-
const patterns = names.filter((
|
|
35
|
+
const patterns = names.filter((name2) => name2.length > 0).map((name2) => ({ name: name2, pattern: identifierPattern(name2) }));
|
|
36
36
|
const lines = text.split("\n");
|
|
37
37
|
const windows = [];
|
|
38
38
|
lines.forEach((line, index) => {
|
|
39
|
-
const mentioned = patterns.filter(({ pattern }) => pattern.test(line)).map(({ name }) =>
|
|
39
|
+
const mentioned = patterns.filter(({ pattern }) => pattern.test(line)).map(({ name: name2 }) => name2);
|
|
40
40
|
if (mentioned.length === 0)
|
|
41
41
|
return;
|
|
42
42
|
const start = Math.max(0, index - contextLines);
|
|
@@ -44,8 +44,8 @@ function excerptAroundNames(text, names, maxChars, contextLines = 6) {
|
|
|
44
44
|
const last = windows[windows.length - 1];
|
|
45
45
|
if (last && start <= last.end + 1) {
|
|
46
46
|
last.end = Math.max(last.end, end);
|
|
47
|
-
for (const
|
|
48
|
-
last.names.add(
|
|
47
|
+
for (const name2 of mentioned)
|
|
48
|
+
last.names.add(name2);
|
|
49
49
|
} else {
|
|
50
50
|
windows.push({ start, end, names: new Set(mentioned) });
|
|
51
51
|
}
|
|
@@ -56,8 +56,8 @@ ${TRUNCATED_MARKER}`, usesNotShown: [] };
|
|
|
56
56
|
}
|
|
57
57
|
const lastWindowFor = /* @__PURE__ */ new Map();
|
|
58
58
|
for (const window of windows)
|
|
59
|
-
for (const
|
|
60
|
-
lastWindowFor.set(
|
|
59
|
+
for (const name2 of window.names)
|
|
60
|
+
lastWindowFor.set(name2, window);
|
|
61
61
|
const kept = [];
|
|
62
62
|
const cut = /* @__PURE__ */ new Set();
|
|
63
63
|
let used = 0;
|
|
@@ -71,15 +71,15 @@ ${ELLIPSIS_MARKER}
|
|
|
71
71
|
const head = chunk.slice(0, maxChars);
|
|
72
72
|
kept.push({ window, text: head });
|
|
73
73
|
used += head.length;
|
|
74
|
-
for (const
|
|
75
|
-
if (lastWindowFor.get(
|
|
76
|
-
cut.add(
|
|
74
|
+
for (const name2 of window.names) {
|
|
75
|
+
if (lastWindowFor.get(name2) === window && !identifierPattern(name2).test(head))
|
|
76
|
+
cut.add(name2);
|
|
77
77
|
}
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
|
-
for (const
|
|
81
|
-
if (lastWindowFor.get(
|
|
82
|
-
cut.add(
|
|
80
|
+
for (const name2 of window.names) {
|
|
81
|
+
if (lastWindowFor.get(name2) === window)
|
|
82
|
+
cut.add(name2);
|
|
83
83
|
}
|
|
84
84
|
continue;
|
|
85
85
|
}
|
|
@@ -90,7 +90,7 @@ ${ELLIPSIS_MARKER}
|
|
|
90
90
|
const parts = kept.map((entry, index) => (index > 0 ? `
|
|
91
91
|
${ELLIPSIS_MARKER}
|
|
92
92
|
` : "") + entry.text);
|
|
93
|
-
const usesNotShown = names.filter((
|
|
93
|
+
const usesNotShown = names.filter((name2, index) => cut.has(name2) && names.indexOf(name2) === index);
|
|
94
94
|
return { content: `${parts.join("")}
|
|
95
95
|
${TRUNCATED_MARKER}`, usesNotShown };
|
|
96
96
|
}
|
|
@@ -105,8 +105,8 @@ var init_source_excerpt = __esm({
|
|
|
105
105
|
|
|
106
106
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/components/derive-component-id.js
|
|
107
107
|
import { createHash } from "node:crypto";
|
|
108
|
-
function deriveComponentId(
|
|
109
|
-
return createHash("sha256").update(`${
|
|
108
|
+
function deriveComponentId(name2, source) {
|
|
109
|
+
return createHash("sha256").update(`${name2}:${source}`).digest("hex").slice(0, 12);
|
|
110
110
|
}
|
|
111
111
|
var init_derive_component_id = __esm({
|
|
112
112
|
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/components/derive-component-id.js"() {
|
|
@@ -195,8 +195,8 @@ var init_read = __esm({
|
|
|
195
195
|
});
|
|
196
196
|
|
|
197
197
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/write.js
|
|
198
|
-
function createSession(db, id,
|
|
199
|
-
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id,
|
|
198
|
+
function createSession(db, id, name2, timestamp) {
|
|
199
|
+
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id, name2, timestamp, timestamp);
|
|
200
200
|
}
|
|
201
201
|
function updateSessionTimestamp(db, sessionId, timestamp) {
|
|
202
202
|
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(timestamp, sessionId);
|
|
@@ -1031,8 +1031,8 @@ var init_extract_sentinel_output = __esm({
|
|
|
1031
1031
|
});
|
|
1032
1032
|
|
|
1033
1033
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/format-generate-progress-line.js
|
|
1034
|
-
function formatGenerateProgressLine(done, total,
|
|
1035
|
-
return `progress=generate:${done}/${total}:${
|
|
1034
|
+
function formatGenerateProgressLine(done, total, name2) {
|
|
1035
|
+
return `progress=generate:${done}/${total}:${name2}`;
|
|
1036
1036
|
}
|
|
1037
1037
|
var init_format_generate_progress_line = __esm({
|
|
1038
1038
|
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/format-generate-progress-line.js"() {
|
|
@@ -1718,14 +1718,14 @@ function formatToolCall(obj) {
|
|
|
1718
1718
|
return ` ${ansi.cyan("\u25C8")} ${slot}${req} ${ansi.dim(desc)}`;
|
|
1719
1719
|
}
|
|
1720
1720
|
case "select_component": {
|
|
1721
|
-
const
|
|
1721
|
+
const name2 = String(obj["name"] ?? "");
|
|
1722
1722
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1723
|
-
return ` ${ansi.green("+")} ${
|
|
1723
|
+
return ` ${ansi.green("+")} ${name2} ${ansi.dim(reason)}`;
|
|
1724
1724
|
}
|
|
1725
1725
|
case "reject_component": {
|
|
1726
|
-
const
|
|
1726
|
+
const name2 = String(obj["name"] ?? "");
|
|
1727
1727
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1728
|
-
return ` ${ansi.dim("\u2013")} ${
|
|
1728
|
+
return ` ${ansi.dim("\u2013")} ${name2} ${ansi.dim(reason)}`;
|
|
1729
1729
|
}
|
|
1730
1730
|
default:
|
|
1731
1731
|
return null;
|
|
@@ -3445,7 +3445,7 @@ function identifiersIn(propTypes) {
|
|
|
3445
3445
|
return [...names];
|
|
3446
3446
|
}
|
|
3447
3447
|
function declaresAnyType(text, typeNames) {
|
|
3448
|
-
return typeNames.some((
|
|
3448
|
+
return typeNames.some((name2) => new RegExp(`\\b(?:type|interface|enum|const|class)\\s+${escapeForRegExp(name2)}\\b`).test(text));
|
|
3449
3449
|
}
|
|
3450
3450
|
function extractRelativeImportPaths(sourceText) {
|
|
3451
3451
|
const specifiers = /* @__PURE__ */ new Set();
|
|
@@ -3510,7 +3510,7 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
3510
3510
|
frontier = nextFrontier;
|
|
3511
3511
|
}
|
|
3512
3512
|
const inHand = [sourceText, ...discovered.map((d) => d.content)];
|
|
3513
|
-
const declaredTypeNames = candidateTypeNames.filter((
|
|
3513
|
+
const declaredTypeNames = candidateTypeNames.filter((name2) => inHand.some((text) => declaresAnyType(text, [name2])));
|
|
3514
3514
|
const usesNotShown = /* @__PURE__ */ new Set();
|
|
3515
3515
|
const searchNames = [.../* @__PURE__ */ new Set([...propNames, ...declaredTypeNames])];
|
|
3516
3516
|
let enlarged = 0;
|
|
@@ -3520,19 +3520,19 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
3520
3520
|
enlarged++;
|
|
3521
3521
|
const budget = enlarge ? MAX_TYPE_DECLARING_SIBLING_CHARS : MAX_SIBLING_SNIPPET_CHARS;
|
|
3522
3522
|
const excerpt = excerptAroundNames(d.content, searchNames, budget);
|
|
3523
|
-
for (const
|
|
3524
|
-
usesNotShown.add(
|
|
3523
|
+
for (const name2 of excerpt.usesNotShown)
|
|
3524
|
+
usesNotShown.add(name2);
|
|
3525
3525
|
return { path: d.path, content: excerpt.content };
|
|
3526
3526
|
});
|
|
3527
3527
|
const truncatedCount = Math.max(0, discovered.length - MAX_SIBLING_FILES);
|
|
3528
3528
|
return {
|
|
3529
3529
|
siblings,
|
|
3530
3530
|
truncatedCount,
|
|
3531
|
-
usesNotShown: propNames.filter((
|
|
3531
|
+
usesNotShown: propNames.filter((name2) => usesNotShown.has(name2)),
|
|
3532
3532
|
declaredTypeNames
|
|
3533
3533
|
};
|
|
3534
3534
|
}
|
|
3535
|
-
async function loadComponentSourceRef(
|
|
3535
|
+
async function loadComponentSourceRef(name2, sourcePath, propNames = [], propTypes = []) {
|
|
3536
3536
|
let content = null;
|
|
3537
3537
|
let siblingFiles = [];
|
|
3538
3538
|
let truncatedSiblingCount = 0;
|
|
@@ -3549,18 +3549,18 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
|
|
|
3549
3549
|
} = await loadSiblingFiles(rawText, sourcePath, propNames, identifiersIn(propTypes)));
|
|
3550
3550
|
const mainExcerpt = excerptAroundNames(rawText, [.../* @__PURE__ */ new Set([...propNames, ...declaredTypeNames])], MAX_COMPONENT_SOURCE_CHARS);
|
|
3551
3551
|
content = mainExcerpt.content;
|
|
3552
|
-
for (const
|
|
3553
|
-
usesNotShown.add(
|
|
3554
|
-
for (const
|
|
3555
|
-
usesNotShown.add(
|
|
3552
|
+
for (const name3 of mainExcerpt.usesNotShown)
|
|
3553
|
+
usesNotShown.add(name3);
|
|
3554
|
+
for (const name3 of siblingUsesNotShown)
|
|
3555
|
+
usesNotShown.add(name3);
|
|
3556
3556
|
} catch {
|
|
3557
3557
|
}
|
|
3558
|
-
const ref = { component:
|
|
3558
|
+
const ref = { component: name2, sourcePath, content };
|
|
3559
3559
|
if (siblingFiles.length > 0)
|
|
3560
3560
|
ref.siblingFiles = siblingFiles;
|
|
3561
3561
|
if (truncatedSiblingCount > 0)
|
|
3562
3562
|
ref.truncatedSiblingCount = truncatedSiblingCount;
|
|
3563
|
-
const notShown = propNames.filter((
|
|
3563
|
+
const notShown = propNames.filter((name3) => usesNotShown.has(name3));
|
|
3564
3564
|
if (notShown.length > 0)
|
|
3565
3565
|
ref.usesNotShown = notShown;
|
|
3566
3566
|
return ref;
|
|
@@ -3713,7 +3713,7 @@ function loadCDFComponents(db, sessionId) {
|
|
|
3713
3713
|
const allowedComponentsBySlot = indexRowsByKey(allowedComponents, (ac) => `${ac.component_id}::${ac.slot_name}`);
|
|
3714
3714
|
const tokenPathsByProp = indexRowsByKey(tokenPaths, (t) => `${t.component_id}::${t.prop_name}`);
|
|
3715
3715
|
const toTokenPaths = (rows) => rows === void 0 ? void 0 : rows.map((r) => r.path);
|
|
3716
|
-
return components.map(({ component_id, name, description }) => {
|
|
3716
|
+
return components.map(({ component_id, name: name2, description }) => {
|
|
3717
3717
|
const compProps = propsByComponent.get(component_id) ?? [];
|
|
3718
3718
|
const $properties = {};
|
|
3719
3719
|
for (const p of compProps) {
|
|
@@ -3770,7 +3770,7 @@ function loadCDFComponents(db, sessionId) {
|
|
|
3770
3770
|
entry.$description = description;
|
|
3771
3771
|
if (Object.keys($slots).length > 0)
|
|
3772
3772
|
entry.$slots = $slots;
|
|
3773
|
-
return { key:
|
|
3773
|
+
return { key: name2, entry };
|
|
3774
3774
|
});
|
|
3775
3775
|
}
|
|
3776
3776
|
function loadScopeComponents(db, sessionId) {
|
|
@@ -4648,29 +4648,29 @@ function extractTsxComponents(filePaths, componentFilePattern, extract) {
|
|
|
4648
4648
|
}
|
|
4649
4649
|
function resolveDefaultExportName(declarations, exported, allowVariableDeclaration = false) {
|
|
4650
4650
|
const declaration = declarations[0];
|
|
4651
|
-
const
|
|
4652
|
-
if (!
|
|
4651
|
+
const name2 = Node.isFunctionDeclaration(declaration) ? declaration.getName() : allowVariableDeclaration && Node.isVariableDeclaration(declaration) ? declaration.getName() : void 0;
|
|
4652
|
+
if (!name2 || !/^[A-Z]/.test(name2) || exported.has(name2))
|
|
4653
4653
|
return void 0;
|
|
4654
|
-
return
|
|
4654
|
+
return name2;
|
|
4655
4655
|
}
|
|
4656
4656
|
function getRenderableExports(sourceFile, exclusions, options) {
|
|
4657
4657
|
const renderable = [];
|
|
4658
4658
|
const exported = sourceFile.getExportedDeclarations();
|
|
4659
4659
|
for (const [exportKey, declarations] of exported) {
|
|
4660
|
-
const
|
|
4661
|
-
if (!
|
|
4660
|
+
const name2 = exportKey === "default" ? resolveDefaultExportName(declarations, exported, options.allowVariableDeclaration) : exportKey;
|
|
4661
|
+
if (!name2 || !/^[A-Z]/.test(name2))
|
|
4662
4662
|
continue;
|
|
4663
|
-
if (
|
|
4663
|
+
if (name2.startsWith("use")) {
|
|
4664
4664
|
exclusions.push({
|
|
4665
4665
|
itemType: "component",
|
|
4666
|
-
name,
|
|
4666
|
+
name: name2,
|
|
4667
4667
|
source: sourceFile.getFilePath(),
|
|
4668
4668
|
reason: options.hookReason,
|
|
4669
4669
|
stage: "component-filter"
|
|
4670
4670
|
});
|
|
4671
4671
|
continue;
|
|
4672
4672
|
}
|
|
4673
|
-
renderable.push({ name, declarations });
|
|
4673
|
+
renderable.push({ name: name2, declarations });
|
|
4674
4674
|
}
|
|
4675
4675
|
return renderable;
|
|
4676
4676
|
}
|
|
@@ -5069,7 +5069,7 @@ function extractProps(classDecl) {
|
|
|
5069
5069
|
for (const property of classDecl.getProperties()) {
|
|
5070
5070
|
if (!hasDecorator(property, "Prop"))
|
|
5071
5071
|
continue;
|
|
5072
|
-
const
|
|
5072
|
+
const name2 = property.getName();
|
|
5073
5073
|
const typeNode = property.getTypeNode();
|
|
5074
5074
|
const typeText = typeNode ? typeNode.getText() : "unknown";
|
|
5075
5075
|
const hasQuestionToken = property.hasQuestionToken();
|
|
@@ -5107,21 +5107,21 @@ function extractProps(classDecl) {
|
|
|
5107
5107
|
}
|
|
5108
5108
|
const allowedValues = extractAllowedValues2(typeText);
|
|
5109
5109
|
props.push({
|
|
5110
|
-
name,
|
|
5110
|
+
name: name2,
|
|
5111
5111
|
type: typeText,
|
|
5112
5112
|
required: isRequired,
|
|
5113
5113
|
...defaultValue !== void 0 && { defaultValue },
|
|
5114
5114
|
...description && { description },
|
|
5115
5115
|
...allowedValues && { allowedValues },
|
|
5116
|
-
...intrinsicDomAttributeProps.has(
|
|
5116
|
+
...intrinsicDomAttributeProps.has(name2) && { domAttribute: true },
|
|
5117
5117
|
sourceStartLine: property.getStartLineNumber(),
|
|
5118
5118
|
sourceEndLine: property.getEndLineNumber()
|
|
5119
5119
|
});
|
|
5120
5120
|
}
|
|
5121
5121
|
return props.sort((a, b) => a.name.localeCompare(b.name));
|
|
5122
5122
|
}
|
|
5123
|
-
function normalizeSlotName(
|
|
5124
|
-
const normalizedName =
|
|
5123
|
+
function normalizeSlotName(name2) {
|
|
5124
|
+
const normalizedName = name2 && name2.length > 0 ? name2 : "default";
|
|
5125
5125
|
return {
|
|
5126
5126
|
name: normalizedName,
|
|
5127
5127
|
isDefault: normalizedName === "default"
|
|
@@ -5191,9 +5191,9 @@ function extractSlots(classDecl, warnings, componentName) {
|
|
|
5191
5191
|
if (tagName === "slot") {
|
|
5192
5192
|
const nameAttribute = openingElement.getAttributes().find((attribute) => Node2.isJsxAttribute(attribute) && attribute.getNameNode().getText() === "name");
|
|
5193
5193
|
const initializer2 = Node2.isJsxAttribute(nameAttribute) ? nameAttribute.getInitializer() : void 0;
|
|
5194
|
-
const
|
|
5194
|
+
const name3 = initializer2 && Node2.isStringLiteral(initializer2) ? initializer2.getLiteralValue() : initializer2 && Node2.isJsxExpression(initializer2) ? initializer2.getExpression()?.getText() ?? "" : "";
|
|
5195
5195
|
upsertSlot({
|
|
5196
|
-
...normalizeSlotName(
|
|
5196
|
+
...normalizeSlotName(name3)
|
|
5197
5197
|
});
|
|
5198
5198
|
return;
|
|
5199
5199
|
}
|
|
@@ -5202,11 +5202,11 @@ function extractSlots(classDecl, warnings, componentName) {
|
|
|
5202
5202
|
const initializer = slotAttribute.getInitializer();
|
|
5203
5203
|
if (!initializer || !Node2.isStringLiteral(initializer))
|
|
5204
5204
|
return;
|
|
5205
|
-
const
|
|
5206
|
-
if (!
|
|
5205
|
+
const name2 = initializer.getLiteralValue();
|
|
5206
|
+
if (!name2)
|
|
5207
5207
|
return;
|
|
5208
5208
|
upsertSlot({
|
|
5209
|
-
name,
|
|
5209
|
+
name: name2,
|
|
5210
5210
|
isDefault: false
|
|
5211
5211
|
});
|
|
5212
5212
|
});
|
|
@@ -5228,15 +5228,15 @@ function extractFromSourceFile(sourceFile, warnings) {
|
|
|
5228
5228
|
const tag = getComponentTag(classDecl);
|
|
5229
5229
|
if (!tag)
|
|
5230
5230
|
continue;
|
|
5231
|
-
const
|
|
5231
|
+
const name2 = kebabToPascal(tag);
|
|
5232
5232
|
const props = extractProps(classDecl);
|
|
5233
|
-
const slots = extractSlots(classDecl, warnings,
|
|
5233
|
+
const slots = extractSlots(classDecl, warnings, name2);
|
|
5234
5234
|
const eventNames = detectEvents(classDecl);
|
|
5235
5235
|
if (eventNames.length > 0) {
|
|
5236
|
-
warnings.push(`Component ${
|
|
5236
|
+
warnings.push(`Component ${name2} has ${eventNames.length} events not captured: ${eventNames.join(", ")}`);
|
|
5237
5237
|
}
|
|
5238
5238
|
components.push({
|
|
5239
|
-
name,
|
|
5239
|
+
name: name2,
|
|
5240
5240
|
source: sourceFile.getFilePath(),
|
|
5241
5241
|
sourcePath: sourceFile.getFilePath(),
|
|
5242
5242
|
framework: "stencil",
|
|
@@ -5403,9 +5403,9 @@ function extractAllowedComponentsFromJsdoc(jsdocText, componentNames) {
|
|
|
5403
5403
|
return [];
|
|
5404
5404
|
const found = /* @__PURE__ */ new Set();
|
|
5405
5405
|
for (const raw of m[1].split(",")) {
|
|
5406
|
-
const
|
|
5407
|
-
if (
|
|
5408
|
-
found.add(
|
|
5406
|
+
const name2 = raw.trim();
|
|
5407
|
+
if (name2 && componentNames.has(name2))
|
|
5408
|
+
found.add(name2);
|
|
5409
5409
|
}
|
|
5410
5410
|
return [...found].sort();
|
|
5411
5411
|
}
|
|
@@ -5453,8 +5453,8 @@ function collectTypePredicateComponentReferences(sourceFile, ctx) {
|
|
|
5453
5453
|
const assertedTypeNode = returnTypeNode.getTypeNode();
|
|
5454
5454
|
if (!assertedTypeNode)
|
|
5455
5455
|
continue;
|
|
5456
|
-
for (const
|
|
5457
|
-
found.add(
|
|
5456
|
+
for (const name2 of extractAllowedComponentsFromTypeText(assertedTypeNode.getText(), ctx)) {
|
|
5457
|
+
found.add(name2);
|
|
5458
5458
|
}
|
|
5459
5459
|
}
|
|
5460
5460
|
return [...found].sort();
|
|
@@ -5473,13 +5473,13 @@ function collectRuntimeTypeCheckComponentReferences(sourceFile, componentNames)
|
|
|
5473
5473
|
return void 0;
|
|
5474
5474
|
if (!Node3.isIdentifier(otherSide) && !Node3.isPropertyAccessExpression(otherSide))
|
|
5475
5475
|
return void 0;
|
|
5476
|
-
const
|
|
5477
|
-
if (!
|
|
5476
|
+
const name2 = otherSide.getText().split(".").pop();
|
|
5477
|
+
if (!name2 || !componentNames.has(name2))
|
|
5478
5478
|
return void 0;
|
|
5479
5479
|
const baseIdentifier = Node3.isPropertyAccessExpression(otherSide) ? otherSide.getExpression() : otherSide;
|
|
5480
5480
|
if (!Node3.isIdentifier(baseIdentifier) || !localBindings.has(baseIdentifier.getText()))
|
|
5481
5481
|
return void 0;
|
|
5482
|
-
return
|
|
5482
|
+
return name2;
|
|
5483
5483
|
};
|
|
5484
5484
|
const match2 = candidateFromTypeAccess(left, right) ?? candidateFromTypeAccess(right, left);
|
|
5485
5485
|
if (match2)
|
|
@@ -5531,8 +5531,8 @@ function collectArrayMapRenderComponentReferences(funcNode, componentNames, ownC
|
|
|
5531
5531
|
const found = /* @__PURE__ */ new Set();
|
|
5532
5532
|
const propNames = new Set(propTypesByName.keys());
|
|
5533
5533
|
const renderCountByComponent = /* @__PURE__ */ new Map();
|
|
5534
|
-
const bumpRenderCount = (
|
|
5535
|
-
renderCountByComponent.set(
|
|
5534
|
+
const bumpRenderCount = (name2) => {
|
|
5535
|
+
renderCountByComponent.set(name2, (renderCountByComponent.get(name2) ?? 0) + 1);
|
|
5536
5536
|
};
|
|
5537
5537
|
for (const jsxElement of [
|
|
5538
5538
|
...funcNode.getDescendantsOfKind(SyntaxKind3.JsxSelfClosingElement),
|
|
@@ -5695,7 +5695,7 @@ function sourceFileUsesCreateContext(sourceFile) {
|
|
|
5695
5695
|
function isNextJsComponent(filePath, exportedNames) {
|
|
5696
5696
|
const normalized = filePath.replace(/\\/g, "/");
|
|
5697
5697
|
const isAppRouterFile = /\/app\/.*\/(page|layout)\.[jt]sx?$/.test(normalized);
|
|
5698
|
-
const hasNextExports = exportedNames.some((
|
|
5698
|
+
const hasNextExports = exportedNames.some((name2) => name2 === "generateMetadata" || name2 === "generateStaticParams");
|
|
5699
5699
|
return isAppRouterFile || hasNextExports;
|
|
5700
5700
|
}
|
|
5701
5701
|
function isRepoLocalTransparentPolymorphicWrapperDeclaration(declaration, typeName) {
|
|
@@ -5877,8 +5877,8 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
5877
5877
|
const props = [];
|
|
5878
5878
|
let hasChildren = false;
|
|
5879
5879
|
for (const property of type.getProperties()) {
|
|
5880
|
-
const
|
|
5881
|
-
if (
|
|
5880
|
+
const name2 = property.getName();
|
|
5881
|
+
if (name2 === "children") {
|
|
5882
5882
|
if (suppressNeverChildrenSlot) {
|
|
5883
5883
|
const declaration2 = property.getValueDeclaration() ?? property.getDeclarations()[0];
|
|
5884
5884
|
if (declaration2 && property.getTypeAtLocation(declaration2).isNever()) {
|
|
@@ -5888,7 +5888,7 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
5888
5888
|
hasChildren = true;
|
|
5889
5889
|
continue;
|
|
5890
5890
|
}
|
|
5891
|
-
if (slotNames.has(
|
|
5891
|
+
if (slotNames.has(name2))
|
|
5892
5892
|
continue;
|
|
5893
5893
|
const declaration = property.getValueDeclaration() ?? property.getDeclarations()[0];
|
|
5894
5894
|
if (!declaration)
|
|
@@ -5899,7 +5899,7 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
5899
5899
|
const required = !property.isOptional();
|
|
5900
5900
|
const allowedValues = extractAllowedValues(propType);
|
|
5901
5901
|
props.push({
|
|
5902
|
-
name,
|
|
5902
|
+
name: name2,
|
|
5903
5903
|
type: typeText,
|
|
5904
5904
|
required,
|
|
5905
5905
|
...allowedValues && { allowedValues },
|
|
@@ -5930,19 +5930,19 @@ function extractPropsFromInterfaceDeclaration(declaration, slotNames, seen, excl
|
|
|
5930
5930
|
return acc;
|
|
5931
5931
|
const propType = symbol.getTypeAtLocation(decl);
|
|
5932
5932
|
const typeText = propType.isAny() ? ("getTypeNode" in decl && typeof decl.getTypeNode === "function" ? decl.getTypeNode()?.getText() : void 0) ?? propType.getText(decl) : propType.getText(decl);
|
|
5933
|
-
const
|
|
5934
|
-
if (
|
|
5933
|
+
const name2 = symbol.getName();
|
|
5934
|
+
if (name2 === "children") {
|
|
5935
5935
|
if (suppressNeverChildrenSlot && propType.isNever())
|
|
5936
5936
|
return acc;
|
|
5937
5937
|
acc.hasChildren = true;
|
|
5938
5938
|
return acc;
|
|
5939
5939
|
}
|
|
5940
|
-
if (slotNames.has(
|
|
5940
|
+
if (slotNames.has(name2))
|
|
5941
5941
|
return acc;
|
|
5942
5942
|
const required = !symbol.isOptional();
|
|
5943
5943
|
const allowedValues = extractAllowedValues(propType);
|
|
5944
5944
|
acc.props.push({
|
|
5945
|
-
name,
|
|
5945
|
+
name: name2,
|
|
5946
5946
|
type: typeText,
|
|
5947
5947
|
required,
|
|
5948
5948
|
...allowedValues && { allowedValues },
|
|
@@ -6275,7 +6275,7 @@ function collectReboundDeclarations(body) {
|
|
|
6275
6275
|
function collectPropDataflow(func, param, availablePropNames) {
|
|
6276
6276
|
const valueAliases = /* @__PURE__ */ new Map();
|
|
6277
6277
|
const objectAliases = /* @__PURE__ */ new Map();
|
|
6278
|
-
const fullPropsShape = new Map([...availablePropNames].map((
|
|
6278
|
+
const fullPropsShape = new Map([...availablePropNames].map((name2) => [name2, name2]));
|
|
6279
6279
|
const belongsToComponentFunction = (node) => node.getFirstAncestor((ancestor) => Node4.isFunctionDeclaration(ancestor) || Node4.isArrowFunction(ancestor) || Node4.isFunctionExpression(ancestor)) === func;
|
|
6280
6280
|
const resolveValue = (expression) => {
|
|
6281
6281
|
if (!expression)
|
|
@@ -6469,12 +6469,12 @@ function extractSlots2(type, hasChildren) {
|
|
|
6469
6469
|
slots.push({ name: "children", isDefault: true });
|
|
6470
6470
|
}
|
|
6471
6471
|
for (const property of type.getProperties()) {
|
|
6472
|
-
const
|
|
6473
|
-
if (
|
|
6472
|
+
const name2 = property.getName();
|
|
6473
|
+
if (name2 === "children")
|
|
6474
6474
|
continue;
|
|
6475
6475
|
if (!getRenderPropType(property))
|
|
6476
6476
|
continue;
|
|
6477
|
-
const slotName =
|
|
6477
|
+
const slotName = name2.replace(/^render/, "");
|
|
6478
6478
|
slots.push({
|
|
6479
6479
|
name: slotName.charAt(0).toLowerCase() + slotName.slice(1),
|
|
6480
6480
|
isDefault: false
|
|
@@ -6487,9 +6487,9 @@ function isExpandableDomAttributeWrapperName(typeName) {
|
|
|
6487
6487
|
}
|
|
6488
6488
|
function getStringLiteralTypeValues(typeNode) {
|
|
6489
6489
|
if (Node4.isLiteralTypeNode(typeNode)) {
|
|
6490
|
-
const
|
|
6491
|
-
if (Node4.isStringLiteral(
|
|
6492
|
-
return [
|
|
6490
|
+
const literal4 = typeNode.getLiteral();
|
|
6491
|
+
if (Node4.isStringLiteral(literal4)) {
|
|
6492
|
+
return [literal4.getLiteralText()];
|
|
6493
6493
|
}
|
|
6494
6494
|
}
|
|
6495
6495
|
if (!Node4.isUnionTypeNode(typeNode))
|
|
@@ -6730,17 +6730,17 @@ function getSyntheticDomAttributeProps(typeNode) {
|
|
|
6730
6730
|
}
|
|
6731
6731
|
return [...propsByName.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
6732
6732
|
}
|
|
6733
|
-
function getDomAttributeSurface(
|
|
6734
|
-
if (seen.has(
|
|
6733
|
+
function getDomAttributeSurface(name2, seen = /* @__PURE__ */ new Set()) {
|
|
6734
|
+
if (seen.has(name2))
|
|
6735
6735
|
return [];
|
|
6736
|
-
seen.add(
|
|
6736
|
+
seen.add(name2);
|
|
6737
6737
|
const propsByName = /* @__PURE__ */ new Map();
|
|
6738
|
-
for (const parentName of DOM_ATTRIBUTE_WRAPPER_PARENTS[
|
|
6738
|
+
for (const parentName of DOM_ATTRIBUTE_WRAPPER_PARENTS[name2] ?? []) {
|
|
6739
6739
|
for (const prop of getDomAttributeSurface(parentName, seen)) {
|
|
6740
6740
|
propsByName.set(prop.name, prop);
|
|
6741
6741
|
}
|
|
6742
6742
|
}
|
|
6743
|
-
for (const prop of DOM_ATTRIBUTE_PROP_SURFACES[
|
|
6743
|
+
for (const prop of DOM_ATTRIBUTE_PROP_SURFACES[name2]) {
|
|
6744
6744
|
propsByName.set(prop.name, prop);
|
|
6745
6745
|
}
|
|
6746
6746
|
return [...propsByName.values()].map((prop) => ({
|
|
@@ -6837,12 +6837,12 @@ function extractPickedPropsFromTypeNode(typeNode, slotNames, excludedProps = /*
|
|
|
6837
6837
|
}
|
|
6838
6838
|
const pickedKeys = getStringLiteralTypeValues(pickedKeysNode);
|
|
6839
6839
|
const props = [];
|
|
6840
|
-
for (const
|
|
6841
|
-
if (slotNames.has(
|
|
6840
|
+
for (const name2 of pickedKeys) {
|
|
6841
|
+
if (slotNames.has(name2))
|
|
6842
6842
|
continue;
|
|
6843
|
-
if (excludedProps.has(
|
|
6843
|
+
if (excludedProps.has(name2))
|
|
6844
6844
|
continue;
|
|
6845
|
-
const pickedProp = sourcePropsByName.get(
|
|
6845
|
+
const pickedProp = sourcePropsByName.get(name2);
|
|
6846
6846
|
if (pickedProp) {
|
|
6847
6847
|
props.push(pickedProp);
|
|
6848
6848
|
}
|
|
@@ -7071,7 +7071,7 @@ async function extractReactComponents(filePaths) {
|
|
|
7071
7071
|
function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
7072
7072
|
const components = [];
|
|
7073
7073
|
const usesCreateContext = sourceFileUsesCreateContext(sourceFile);
|
|
7074
|
-
for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
7074
|
+
for (const { name: name2, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
7075
7075
|
allowVariableDeclaration: true,
|
|
7076
7076
|
hookReason: "React hook names are not renderable components"
|
|
7077
7077
|
})) {
|
|
@@ -7083,7 +7083,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
7083
7083
|
const params = funcNode.getParameters();
|
|
7084
7084
|
if (params.length === 0) {
|
|
7085
7085
|
components.push({
|
|
7086
|
-
name,
|
|
7086
|
+
name: name2,
|
|
7087
7087
|
source: sourceFile.getFilePath(),
|
|
7088
7088
|
sourcePath: sourceFile.getFilePath(),
|
|
7089
7089
|
framework: isNext ? "next" : "react",
|
|
@@ -7127,7 +7127,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
7127
7127
|
}
|
|
7128
7128
|
const resolvedProps = [...mergedPropsByName.values()];
|
|
7129
7129
|
const noUsefulTypes = resolvedProps.length === 0 || resolvedProps.every((p) => p.type === "any");
|
|
7130
|
-
const finalProps = noUsefulTypes ? extractPropTypes(sourceFile,
|
|
7130
|
+
const finalProps = noUsefulTypes ? extractPropTypes(sourceFile, name2) ?? resolvedProps : resolvedProps;
|
|
7131
7131
|
const propsWithDefaults = finalProps.map((p) => {
|
|
7132
7132
|
if (!defaults.has(p.name))
|
|
7133
7133
|
return p;
|
|
@@ -7160,7 +7160,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
7160
7160
|
const propsTypeName = firstParamTypeNode?.getText?.().trim();
|
|
7161
7161
|
const propsTypeNameCapture = propsTypeName && /^[A-Za-z_$][\w$]*$/.test(propsTypeName) ? propsTypeName : void 0;
|
|
7162
7162
|
components.push({
|
|
7163
|
-
name,
|
|
7163
|
+
name: name2,
|
|
7164
7164
|
source: sourceFile.getFilePath(),
|
|
7165
7165
|
sourcePath: sourceFile.getFilePath(),
|
|
7166
7166
|
framework: isNext ? "next" : "react",
|
|
@@ -7561,10 +7561,10 @@ async function extractVueTsxComponents(filePaths) {
|
|
|
7561
7561
|
}
|
|
7562
7562
|
function extractFromSourceFile3(sourceFile, exclusions) {
|
|
7563
7563
|
const components = [];
|
|
7564
|
-
for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
7564
|
+
for (const { name: name2, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
7565
7565
|
hookReason: "Vue composition hook names are not renderable components"
|
|
7566
7566
|
})) {
|
|
7567
|
-
const component = extractVueTsxComponent(declarations,
|
|
7567
|
+
const component = extractVueTsxComponent(declarations, name2, sourceFile);
|
|
7568
7568
|
if (component) {
|
|
7569
7569
|
components.push(component);
|
|
7570
7570
|
}
|
|
@@ -7580,11 +7580,11 @@ function extractVueTsxComponent(declarations, exportName, sourceFile) {
|
|
|
7580
7580
|
const resolved = resolveVueComponentOptions(declaration.getInitializer());
|
|
7581
7581
|
if (!resolved)
|
|
7582
7582
|
continue;
|
|
7583
|
-
const
|
|
7583
|
+
const name2 = extractVueGenericComponentName(resolved.options) ?? exportName;
|
|
7584
7584
|
const props = extractVueGenericComponentProps(resolved.options);
|
|
7585
7585
|
const slots = extractVueGenericComponentSlots(resolved.options, resolved.slotsTypeNode);
|
|
7586
7586
|
return {
|
|
7587
|
-
name,
|
|
7587
|
+
name: name2,
|
|
7588
7588
|
source: sourceFile.getFilePath(),
|
|
7589
7589
|
framework: "vue",
|
|
7590
7590
|
props,
|
|
@@ -7758,16 +7758,16 @@ function extractVueObjectPropDefinition(propName, initializer) {
|
|
|
7758
7758
|
for (const property of initializer.getProperties()) {
|
|
7759
7759
|
if (!Node5.isPropertyAssignment(property))
|
|
7760
7760
|
continue;
|
|
7761
|
-
const
|
|
7761
|
+
const name2 = property.getName();
|
|
7762
7762
|
const value = property.getInitializer();
|
|
7763
7763
|
if (!value)
|
|
7764
7764
|
continue;
|
|
7765
|
-
if (
|
|
7765
|
+
if (name2 === "type") {
|
|
7766
7766
|
type = getVuePropTypeText(value);
|
|
7767
7767
|
allowedValues = extractAllowedValues(value.getType());
|
|
7768
|
-
} else if (
|
|
7768
|
+
} else if (name2 === "required") {
|
|
7769
7769
|
required = value.getText() === "true";
|
|
7770
|
-
} else if (
|
|
7770
|
+
} else if (name2 === "default") {
|
|
7771
7771
|
defaultValue = value.getText();
|
|
7772
7772
|
}
|
|
7773
7773
|
}
|
|
@@ -8063,20 +8063,20 @@ async function extractVueComponents(filePaths, onProgress) {
|
|
|
8063
8063
|
async function extractFromVueSFC(filePath, source) {
|
|
8064
8064
|
const { descriptor, errors } = parseSFC(source);
|
|
8065
8065
|
const fileWarnings = errors.map((e) => `Parse error in ${filePath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
8066
|
-
const
|
|
8066
|
+
const name2 = getVueComponentName(filePath);
|
|
8067
8067
|
let props = [];
|
|
8068
8068
|
const setupProps = descriptor.scriptSetup ? await extractSetupProps(filePath, descriptor.scriptSetup.content) : null;
|
|
8069
8069
|
if (setupProps !== null) {
|
|
8070
8070
|
props = setupProps;
|
|
8071
8071
|
} else if (descriptor.script) {
|
|
8072
|
-
return extractOptionsComponent(filePath, descriptor.script.content, fileWarnings,
|
|
8072
|
+
return extractOptionsComponent(filePath, descriptor.script.content, fileWarnings, name2, descriptor.template?.ast, source);
|
|
8073
8073
|
}
|
|
8074
8074
|
let slots = descriptor.template?.ast ? extractSlotsFromTemplate(descriptor.template.ast) : [];
|
|
8075
8075
|
const runtimeSlots = extractSlotsFromRuntimeAccess(source);
|
|
8076
8076
|
slots = mergeSlotsDedup(slots, runtimeSlots);
|
|
8077
8077
|
return {
|
|
8078
8078
|
component: {
|
|
8079
|
-
name,
|
|
8079
|
+
name: name2,
|
|
8080
8080
|
source: filePath,
|
|
8081
8081
|
sourcePath: filePath,
|
|
8082
8082
|
framework: "vue",
|
|
@@ -8094,7 +8094,7 @@ function getVueComponentName(filePath) {
|
|
|
8094
8094
|
const parentDirName = basename(dirname6(filePath));
|
|
8095
8095
|
return parentDirName || fileName;
|
|
8096
8096
|
}
|
|
8097
|
-
async function extractOptionsComponent(filePath, scriptContent, fileWarnings,
|
|
8097
|
+
async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name2, templateAst, sfcSource) {
|
|
8098
8098
|
const props = await extractOptionsProps(filePath, scriptContent);
|
|
8099
8099
|
let slots = templateAst ? extractSlotsFromTemplate(templateAst) : [];
|
|
8100
8100
|
if (sfcSource) {
|
|
@@ -8103,7 +8103,7 @@ async function extractOptionsComponent(filePath, scriptContent, fileWarnings, na
|
|
|
8103
8103
|
}
|
|
8104
8104
|
return {
|
|
8105
8105
|
component: {
|
|
8106
|
-
name,
|
|
8106
|
+
name: name2,
|
|
8107
8107
|
source: filePath,
|
|
8108
8108
|
sourcePath: filePath,
|
|
8109
8109
|
framework: "vue",
|
|
@@ -8176,13 +8176,13 @@ function extractGenericProps(typeText) {
|
|
|
8176
8176
|
const resolved = resolveTypeProperty(property);
|
|
8177
8177
|
if (!resolved)
|
|
8178
8178
|
continue;
|
|
8179
|
-
const { name, typeText: resolvedTypeText, required } = resolved;
|
|
8179
|
+
const { name: name2, typeText: resolvedTypeText, required } = resolved;
|
|
8180
8180
|
let typeText2 = resolvedTypeText;
|
|
8181
8181
|
if (!required) {
|
|
8182
8182
|
typeText2 = typeText2.replace(/\s*\|\s*undefined$/, "").replace(/^undefined\s*\|\s*/, "");
|
|
8183
8183
|
}
|
|
8184
8184
|
props.push({
|
|
8185
|
-
name,
|
|
8185
|
+
name: name2,
|
|
8186
8186
|
type: typeText2,
|
|
8187
8187
|
required
|
|
8188
8188
|
});
|
|
@@ -8478,14 +8478,14 @@ function parseObjectProps(obj) {
|
|
|
8478
8478
|
for (const prop of obj.getProperties()) {
|
|
8479
8479
|
if (!Node6.isPropertyAssignment(prop))
|
|
8480
8480
|
continue;
|
|
8481
|
-
const
|
|
8482
|
-
if (!isPublicVuePropName(
|
|
8481
|
+
const name2 = prop.getName();
|
|
8482
|
+
if (!isPublicVuePropName(name2))
|
|
8483
8483
|
continue;
|
|
8484
8484
|
const init = prop.getInitializer();
|
|
8485
8485
|
if (!init || !Node6.isObjectLiteralExpression(init)) {
|
|
8486
8486
|
const initText = init?.getText() ?? "any";
|
|
8487
8487
|
result.push({
|
|
8488
|
-
name,
|
|
8488
|
+
name: name2,
|
|
8489
8489
|
type: VUE_TYPE_MAP[initText] ?? "any",
|
|
8490
8490
|
required: false,
|
|
8491
8491
|
sourceStartLine: prop.getStartLineNumber(),
|
|
@@ -8518,7 +8518,7 @@ function parseObjectProps(obj) {
|
|
|
8518
8518
|
}
|
|
8519
8519
|
}
|
|
8520
8520
|
result.push({
|
|
8521
|
-
name,
|
|
8521
|
+
name: name2,
|
|
8522
8522
|
type,
|
|
8523
8523
|
required,
|
|
8524
8524
|
...defaultValue !== void 0 && { defaultValue },
|
|
@@ -8528,8 +8528,8 @@ function parseObjectProps(obj) {
|
|
|
8528
8528
|
}
|
|
8529
8529
|
return result;
|
|
8530
8530
|
}
|
|
8531
|
-
function isPublicVuePropName(
|
|
8532
|
-
return !/^[_$]/.test(
|
|
8531
|
+
function isPublicVuePropName(name2) {
|
|
8532
|
+
return !/^[_$]/.test(name2);
|
|
8533
8533
|
}
|
|
8534
8534
|
function extractSlotsFromTemplate(ast) {
|
|
8535
8535
|
const slots = [];
|
|
@@ -8561,10 +8561,10 @@ function extractSlotsFromRuntimeAccess(source) {
|
|
|
8561
8561
|
for (const pattern of [dotPattern, bracketPattern]) {
|
|
8562
8562
|
let match2;
|
|
8563
8563
|
while ((match2 = pattern.exec(source)) !== null) {
|
|
8564
|
-
const
|
|
8565
|
-
if (!seen.has(
|
|
8566
|
-
seen.add(
|
|
8567
|
-
slots.push({ name, isDefault:
|
|
8564
|
+
const name2 = match2[1];
|
|
8565
|
+
if (!seen.has(name2)) {
|
|
8566
|
+
seen.add(name2);
|
|
8567
|
+
slots.push({ name: name2, isDefault: name2 === "default" });
|
|
8568
8568
|
}
|
|
8569
8569
|
}
|
|
8570
8570
|
}
|
|
@@ -8696,12 +8696,12 @@ function extractPropsFromFrontmatter(frontmatter) {
|
|
|
8696
8696
|
const propsTypeAlias = sf.getTypeAlias("Props");
|
|
8697
8697
|
if (propsInterface) {
|
|
8698
8698
|
for (const member of propsInterface.getProperties()) {
|
|
8699
|
-
const
|
|
8699
|
+
const name2 = member.getName();
|
|
8700
8700
|
const typeText = member.getTypeNode()?.getText() ?? "any";
|
|
8701
8701
|
const required = !member.hasQuestionToken();
|
|
8702
8702
|
const allowedValues = extractAllowedValues3(typeText);
|
|
8703
8703
|
props.push({
|
|
8704
|
-
name,
|
|
8704
|
+
name: name2,
|
|
8705
8705
|
type: typeText,
|
|
8706
8706
|
required,
|
|
8707
8707
|
...allowedValues && { allowedValues },
|
|
@@ -8715,10 +8715,10 @@ function extractPropsFromFrontmatter(frontmatter) {
|
|
|
8715
8715
|
const resolved = resolveTypeProperty(property);
|
|
8716
8716
|
if (!resolved)
|
|
8717
8717
|
continue;
|
|
8718
|
-
const { name, declaration: decl, typeText, required } = resolved;
|
|
8718
|
+
const { name: name2, declaration: decl, typeText, required } = resolved;
|
|
8719
8719
|
const allowedValues = extractAllowedValues3(typeText);
|
|
8720
8720
|
props.push({
|
|
8721
|
-
name,
|
|
8721
|
+
name: name2,
|
|
8722
8722
|
type: typeText,
|
|
8723
8723
|
required,
|
|
8724
8724
|
...allowedValues && { allowedValues },
|
|
@@ -8784,7 +8784,7 @@ function mergeSlots(...slotGroups) {
|
|
|
8784
8784
|
return merged;
|
|
8785
8785
|
}
|
|
8786
8786
|
function extractFromAstroFile(filePath, source) {
|
|
8787
|
-
const
|
|
8787
|
+
const name2 = basename2(filePath, ".astro");
|
|
8788
8788
|
const fenceIndex = source.startsWith("---") ? 0 : -1;
|
|
8789
8789
|
let frontmatter = "";
|
|
8790
8790
|
let template = source;
|
|
@@ -8803,7 +8803,7 @@ function extractFromAstroFile(filePath, source) {
|
|
|
8803
8803
|
});
|
|
8804
8804
|
const slots = mergeSlots(extractSlotsFromTemplate2(template), extractSlotsFromFrontmatter(frontmatter));
|
|
8805
8805
|
return {
|
|
8806
|
-
name,
|
|
8806
|
+
name: name2,
|
|
8807
8807
|
source: filePath,
|
|
8808
8808
|
sourcePath: filePath,
|
|
8809
8809
|
framework: "astro",
|
|
@@ -9023,10 +9023,10 @@ function extractSlotsFromTemplate3(templateContent) {
|
|
|
9023
9023
|
for (const match2 of templateContent.matchAll(slotRegex)) {
|
|
9024
9024
|
const attrs = match2[1] ?? "";
|
|
9025
9025
|
const nameMatch = attrs.match(/\bname=["']([^"']+)["']/);
|
|
9026
|
-
const
|
|
9027
|
-
slots.set(
|
|
9026
|
+
const name2 = nameMatch?.[1] ?? "default";
|
|
9027
|
+
slots.set(name2, name2 === "default");
|
|
9028
9028
|
}
|
|
9029
|
-
return [...slots.entries()].map(([
|
|
9029
|
+
return [...slots.entries()].map(([name2, isDefault]) => ({ name: name2, isDefault })).sort((a, b) => a.name.localeCompare(b.name));
|
|
9030
9030
|
}
|
|
9031
9031
|
function mergeSlotLists(...slotLists) {
|
|
9032
9032
|
const merged = /* @__PURE__ */ new Map();
|
|
@@ -9055,20 +9055,20 @@ function extractJsDocSlots(classDecl) {
|
|
|
9055
9055
|
const comment = tag.getCommentText()?.trim();
|
|
9056
9056
|
if (!comment)
|
|
9057
9057
|
continue;
|
|
9058
|
-
let
|
|
9058
|
+
let name2 = "default";
|
|
9059
9059
|
let description = comment;
|
|
9060
9060
|
if (comment.startsWith("-")) {
|
|
9061
9061
|
description = comment.slice(1).trim();
|
|
9062
9062
|
} else {
|
|
9063
9063
|
const match2 = comment.match(/^(\S+)\s*-\s*(.*)$/s);
|
|
9064
9064
|
if (match2) {
|
|
9065
|
-
|
|
9065
|
+
name2 = match2[1];
|
|
9066
9066
|
description = match2[2].trim();
|
|
9067
9067
|
}
|
|
9068
9068
|
}
|
|
9069
9069
|
slots.push({
|
|
9070
|
-
name,
|
|
9071
|
-
isDefault:
|
|
9070
|
+
name: name2,
|
|
9071
|
+
isDefault: name2 === "default",
|
|
9072
9072
|
...description && { description }
|
|
9073
9073
|
});
|
|
9074
9074
|
}
|
|
@@ -9111,8 +9111,8 @@ function isNonPublicLitMember(member) {
|
|
|
9111
9111
|
function hasShoelaceRuntimeBookkeepingField(classDecl) {
|
|
9112
9112
|
return classDecl.getProperties().some((property) => property.getName() === "initialReflectedProperties");
|
|
9113
9113
|
}
|
|
9114
|
-
function isInternalRuntimeField(
|
|
9115
|
-
return applyRuntimeFieldDenylist && INTERNAL_RUNTIME_FIELD_NAMES.has(
|
|
9114
|
+
function isInternalRuntimeField(name2, applyRuntimeFieldDenylist) {
|
|
9115
|
+
return applyRuntimeFieldDenylist && INTERNAL_RUNTIME_FIELD_NAMES.has(name2);
|
|
9116
9116
|
}
|
|
9117
9117
|
function getExplicitLitPropertyAttributeName(property) {
|
|
9118
9118
|
const decorator = property.getDecorators().find((candidate) => candidate.getName() === "property");
|
|
@@ -9139,8 +9139,8 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
9139
9139
|
continue;
|
|
9140
9140
|
if (isNonPublicLitMember(property))
|
|
9141
9141
|
continue;
|
|
9142
|
-
const
|
|
9143
|
-
if (
|
|
9142
|
+
const name2 = property.getName();
|
|
9143
|
+
if (name2.startsWith("#") || isInternalRuntimeField(name2, applyRuntimeFieldDenylist))
|
|
9144
9144
|
continue;
|
|
9145
9145
|
const scope = property.getScope();
|
|
9146
9146
|
if (scope === "private" || scope === "protected")
|
|
@@ -9155,7 +9155,7 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
9155
9155
|
}
|
|
9156
9156
|
const typeNode = property.getTypeNode();
|
|
9157
9157
|
const type = typeNode ? typeNode.getText() : "any";
|
|
9158
|
-
const publicName =
|
|
9158
|
+
const publicName = name2.startsWith("_") && hasDecorators ? getExplicitLitPropertyAttributeName(property) : null;
|
|
9159
9159
|
let defaultValue;
|
|
9160
9160
|
if (initializer) {
|
|
9161
9161
|
if (Node8.isStringLiteral(initializer)) {
|
|
@@ -9165,7 +9165,7 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
9165
9165
|
}
|
|
9166
9166
|
}
|
|
9167
9167
|
props.push({
|
|
9168
|
-
name: publicName ? kebabToCamel(publicName) :
|
|
9168
|
+
name: publicName ? kebabToCamel(publicName) : name2,
|
|
9169
9169
|
type,
|
|
9170
9170
|
required: false,
|
|
9171
9171
|
...defaultValue !== void 0 && { defaultValue },
|
|
@@ -9185,15 +9185,15 @@ function extractAccessorProperties(classDecl, applyRuntimeFieldDenylist = false)
|
|
|
9185
9185
|
continue;
|
|
9186
9186
|
if (isNonPublicLitMember(getter))
|
|
9187
9187
|
continue;
|
|
9188
|
-
const
|
|
9189
|
-
if (
|
|
9188
|
+
const name2 = getter.getName();
|
|
9189
|
+
if (name2 === "observedAttributes" || name2 === "template" || name2.startsWith("#") || isInternalRuntimeField(name2, applyRuntimeFieldDenylist))
|
|
9190
9190
|
continue;
|
|
9191
9191
|
const scope = getter.getScope();
|
|
9192
9192
|
if (scope === "private" || scope === "protected")
|
|
9193
9193
|
continue;
|
|
9194
|
-
const entry = accessors.get(
|
|
9194
|
+
const entry = accessors.get(name2) ?? {};
|
|
9195
9195
|
entry.getter = getter;
|
|
9196
|
-
accessors.set(
|
|
9196
|
+
accessors.set(name2, entry);
|
|
9197
9197
|
}
|
|
9198
9198
|
for (const setter of classDecl.getSetAccessors()) {
|
|
9199
9199
|
if (setter.isStatic())
|
|
@@ -9202,24 +9202,24 @@ function extractAccessorProperties(classDecl, applyRuntimeFieldDenylist = false)
|
|
|
9202
9202
|
continue;
|
|
9203
9203
|
if (isNonPublicLitMember(setter))
|
|
9204
9204
|
continue;
|
|
9205
|
-
const
|
|
9206
|
-
if (
|
|
9205
|
+
const name2 = setter.getName();
|
|
9206
|
+
if (name2 === "observedAttributes" || name2 === "template" || name2.startsWith("#") || isInternalRuntimeField(name2, applyRuntimeFieldDenylist))
|
|
9207
9207
|
continue;
|
|
9208
9208
|
const scope = setter.getScope();
|
|
9209
9209
|
if (scope === "private" || scope === "protected")
|
|
9210
9210
|
continue;
|
|
9211
|
-
const entry = accessors.get(
|
|
9211
|
+
const entry = accessors.get(name2) ?? {};
|
|
9212
9212
|
entry.setter = setter;
|
|
9213
|
-
accessors.set(
|
|
9213
|
+
accessors.set(name2, entry);
|
|
9214
9214
|
}
|
|
9215
|
-
for (const [
|
|
9215
|
+
for (const [name2, { getter, setter }] of accessors) {
|
|
9216
9216
|
const hasPropertyDecorator = getter?.getDecorators().some((decorator) => decorator.getName() === "property") || setter?.getDecorators().some((decorator) => decorator.getName() === "property");
|
|
9217
9217
|
if (!hasPropertyDecorator && !(getter && setter))
|
|
9218
9218
|
continue;
|
|
9219
9219
|
const type = getter?.getReturnTypeNode()?.getText() ?? setter?.getParameters()[0]?.getTypeNode()?.getText() ?? "any";
|
|
9220
9220
|
const accessorNode = getter ?? setter;
|
|
9221
9221
|
props.push({
|
|
9222
|
-
name,
|
|
9222
|
+
name: name2,
|
|
9223
9223
|
type,
|
|
9224
9224
|
required: false,
|
|
9225
9225
|
...accessorNode ? {
|
|
@@ -9241,11 +9241,11 @@ function extractJsDocAttributeProps(classDecl) {
|
|
|
9241
9241
|
const match2 = normalizedComment?.match(/(?:\{([^}]+)\}\s+)?([^\s]+)(?:\s*-\s*([\s\S]*))?/);
|
|
9242
9242
|
if (!match2)
|
|
9243
9243
|
continue;
|
|
9244
|
-
const [, type,
|
|
9245
|
-
if (!
|
|
9244
|
+
const [, type, name2, description] = match2;
|
|
9245
|
+
if (!name2 || name2.startsWith("#"))
|
|
9246
9246
|
continue;
|
|
9247
9247
|
props.push({
|
|
9248
|
-
name,
|
|
9248
|
+
name: name2,
|
|
9249
9249
|
type: type?.trim() || "any",
|
|
9250
9250
|
required: false,
|
|
9251
9251
|
...description ? { description: description.replace(/\s+/g, " ").trim() } : {}
|
|
@@ -9597,7 +9597,7 @@ function extractFromSourceFile4(sourceFile, project) {
|
|
|
9597
9597
|
const tagName = tagNameMap.get(className) ?? siblingDefinedTagName ?? decoratorTagName ?? jsDocTagName ?? fastDefinitionTagName ?? void 0;
|
|
9598
9598
|
if (!tagName)
|
|
9599
9599
|
continue;
|
|
9600
|
-
const
|
|
9600
|
+
const name2 = chooseComponentName(classDecl, className, tagName);
|
|
9601
9601
|
const observedAttrs = extractObservedAttributes(classDecl);
|
|
9602
9602
|
const inheritedProps = extractInheritedClassProperties(classDecl, project);
|
|
9603
9603
|
const classProps = mergePropLists(extractJsDocAttributeProps(classDecl), extractAccessorProperties(classDecl), extractClassProperties(classDecl));
|
|
@@ -9605,7 +9605,7 @@ function extractFromSourceFile4(sourceFile, project) {
|
|
|
9605
9605
|
const templateContent = extractTemplateContent(classDecl, project);
|
|
9606
9606
|
const slots = mergeSlotLists(extractInheritedSlots(classDecl, project), extractJsDocSlots(classDecl), extractSlotsFromTemplate3(templateContent), extractFastTemplateSlots(classDecl, project));
|
|
9607
9607
|
components.push({
|
|
9608
|
-
name,
|
|
9608
|
+
name: name2,
|
|
9609
9609
|
source: sourceFile.getFilePath(),
|
|
9610
9610
|
sourcePath: sourceFile.getFilePath(),
|
|
9611
9611
|
framework: "web-component",
|
|
@@ -9931,8 +9931,8 @@ async function retryComponentWithProject(component, ctx, project, warnings) {
|
|
|
9931
9931
|
}
|
|
9932
9932
|
function addImportedDeclarationsToProject(project, ctx) {
|
|
9933
9933
|
const importedNames = collectReferencedTypeNames(ctx.annotation);
|
|
9934
|
-
for (const
|
|
9935
|
-
const localDecl = findLocalTypeDeclaration(ctx.instance,
|
|
9934
|
+
for (const name2 of [...importedNames]) {
|
|
9935
|
+
const localDecl = findLocalTypeDeclaration(ctx.instance, name2, ctx.moduleScript) ?? (ctx.moduleScript ? findLocalTypeDeclaration(ctx.moduleScript, name2, ctx.instance) : null);
|
|
9936
9936
|
if (localDecl) {
|
|
9937
9937
|
for (const referenced of collectReferencedTypeNames(localDecl))
|
|
9938
9938
|
importedNames.add(referenced);
|
|
@@ -10113,21 +10113,21 @@ function collapseUnresolvedTypeWarnings(warnings) {
|
|
|
10113
10113
|
}
|
|
10114
10114
|
async function extractFromSvelteFile(filePath, source) {
|
|
10115
10115
|
const warnings = [];
|
|
10116
|
-
const
|
|
10116
|
+
const name2 = getSvelteComponentName(filePath);
|
|
10117
10117
|
let ast;
|
|
10118
10118
|
try {
|
|
10119
10119
|
ast = parseSvelte(source, { modern: true });
|
|
10120
10120
|
} catch (e) {
|
|
10121
10121
|
return {
|
|
10122
10122
|
component: null,
|
|
10123
|
-
warnings: [`${
|
|
10123
|
+
warnings: [`${name2}: parse error in ${filePath}: ${e instanceof Error ? e.message : String(e)}`]
|
|
10124
10124
|
};
|
|
10125
10125
|
}
|
|
10126
10126
|
const instance = ast["instance"];
|
|
10127
10127
|
const moduleScript = ast["module"];
|
|
10128
10128
|
const fragment = ast["fragment"];
|
|
10129
10129
|
if (instance && hasV4ExportLetProps(instance)) {
|
|
10130
|
-
warnings.push(`${
|
|
10130
|
+
warnings.push(`${name2}: Svelte 4 export let syntax not yet supported (${filePath}); see INTEG-4267 for v5-only scope and follow-up`);
|
|
10131
10131
|
return { component: null, warnings };
|
|
10132
10132
|
}
|
|
10133
10133
|
const propsCall = instance ? findPropsCall(instance) : null;
|
|
@@ -10142,7 +10142,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
10142
10142
|
instance,
|
|
10143
10143
|
moduleScript,
|
|
10144
10144
|
filePath,
|
|
10145
|
-
componentName:
|
|
10145
|
+
componentName: name2,
|
|
10146
10146
|
source,
|
|
10147
10147
|
snippetLocals
|
|
10148
10148
|
});
|
|
@@ -10154,12 +10154,12 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
10154
10154
|
extractionReasons.push(...result.additionalReasons);
|
|
10155
10155
|
} else if (instance) {
|
|
10156
10156
|
} else {
|
|
10157
|
-
warnings.push(`${
|
|
10157
|
+
warnings.push(`${name2}: no instance script block (${filePath}); no props extracted`);
|
|
10158
10158
|
}
|
|
10159
10159
|
const templateSlots = fragment ? extractTemplateSlots(fragment) : [];
|
|
10160
10160
|
const { slots, mixedWarning } = mergeSlots2(snippetSlotsFromProps, templateSlots);
|
|
10161
10161
|
if (mixedWarning) {
|
|
10162
|
-
warnings.push(`${
|
|
10162
|
+
warnings.push(`${name2}: mixed Snippet and <slot> usage detected (${filePath}); preferring Snippet entries`);
|
|
10163
10163
|
}
|
|
10164
10164
|
let propsTypeNameCapture;
|
|
10165
10165
|
if (propsCall) {
|
|
@@ -10172,7 +10172,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
10172
10172
|
}
|
|
10173
10173
|
}
|
|
10174
10174
|
const component = {
|
|
10175
|
-
name,
|
|
10175
|
+
name: name2,
|
|
10176
10176
|
source: filePath,
|
|
10177
10177
|
framework: "svelte",
|
|
10178
10178
|
props,
|
|
@@ -10198,7 +10198,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
10198
10198
|
instance,
|
|
10199
10199
|
moduleScript,
|
|
10200
10200
|
annotation,
|
|
10201
|
-
componentName:
|
|
10201
|
+
componentName: name2
|
|
10202
10202
|
};
|
|
10203
10203
|
}
|
|
10204
10204
|
}
|
|
@@ -10340,8 +10340,8 @@ function describeAnnotationForUser(annotation) {
|
|
|
10340
10340
|
if (!annotation)
|
|
10341
10341
|
return "<unknown>";
|
|
10342
10342
|
if (annotation.type === "TSTypeReference") {
|
|
10343
|
-
const
|
|
10344
|
-
return
|
|
10343
|
+
const name2 = annotation["typeName"]?.["name"] ?? null;
|
|
10344
|
+
return name2 ? `'${name2}'` : "<unnamed reference>";
|
|
10345
10345
|
}
|
|
10346
10346
|
if (annotation.type === "TSIntersectionType")
|
|
10347
10347
|
return "<intersection>";
|
|
@@ -10416,7 +10416,7 @@ async function resolveViaTypeChecker(annotation, instance, moduleScript, filePat
|
|
|
10416
10416
|
return null;
|
|
10417
10417
|
const members = [];
|
|
10418
10418
|
for (const symbol of properties) {
|
|
10419
|
-
const
|
|
10419
|
+
const name2 = symbol.getName();
|
|
10420
10420
|
const declaration = symbol.getValueDeclaration() ?? symbol.getDeclarations()[0];
|
|
10421
10421
|
if (!declaration)
|
|
10422
10422
|
continue;
|
|
@@ -10431,7 +10431,7 @@ async function resolveViaTypeChecker(annotation, instance, moduleScript, filePat
|
|
|
10431
10431
|
const declaredTypeText = readDeclaredTypeNodeText(declaration);
|
|
10432
10432
|
const isSnippet = declaredTypeText !== null && isSnippetTypeText(declaredTypeText, snippetLocals) || typeRefersToSnippet(propType) || isSnippetTypeText(typeText, snippetLocals);
|
|
10433
10433
|
members.push({
|
|
10434
|
-
name,
|
|
10434
|
+
name: name2,
|
|
10435
10435
|
optional: optional5,
|
|
10436
10436
|
typeText,
|
|
10437
10437
|
...declaredTypeText ? { declaredTypeText } : {},
|
|
@@ -10519,7 +10519,7 @@ function mergeSets(a, b) {
|
|
|
10519
10519
|
out.add(v);
|
|
10520
10520
|
return out;
|
|
10521
10521
|
}
|
|
10522
|
-
function findLocalTypeDeclaration(instance,
|
|
10522
|
+
function findLocalTypeDeclaration(instance, name2, module) {
|
|
10523
10523
|
for (const script of [instance, module]) {
|
|
10524
10524
|
const body = script?.["content"]?.["body"];
|
|
10525
10525
|
if (!body)
|
|
@@ -10528,7 +10528,7 @@ function findLocalTypeDeclaration(instance, name, module) {
|
|
|
10528
10528
|
const decl = stmt.type === "ExportNamedDeclaration" ? stmt["declaration"] ?? stmt : stmt;
|
|
10529
10529
|
if (decl.type === "TSInterfaceDeclaration" || decl.type === "TSTypeAliasDeclaration") {
|
|
10530
10530
|
const id = decl["id"];
|
|
10531
|
-
if (id?.["name"] ===
|
|
10531
|
+
if (id?.["name"] === name2)
|
|
10532
10532
|
return decl;
|
|
10533
10533
|
}
|
|
10534
10534
|
}
|
|
@@ -10549,8 +10549,8 @@ function readMembersFromInterfaceOrAlias(decl, snippetLocals) {
|
|
|
10549
10549
|
}
|
|
10550
10550
|
return [];
|
|
10551
10551
|
}
|
|
10552
|
-
function readMembersFromTypeLiteral(
|
|
10553
|
-
const members =
|
|
10552
|
+
function readMembersFromTypeLiteral(literal4, snippetLocals) {
|
|
10553
|
+
const members = literal4["members"];
|
|
10554
10554
|
if (!members)
|
|
10555
10555
|
return [];
|
|
10556
10556
|
return members.map((m) => readPropertySignature(m, snippetLocals)).filter((m) => !!m);
|
|
@@ -10559,8 +10559,8 @@ function readPropertySignature(member, snippetLocals) {
|
|
|
10559
10559
|
if (member.type !== "TSPropertySignature")
|
|
10560
10560
|
return null;
|
|
10561
10561
|
const key = member["key"];
|
|
10562
|
-
const
|
|
10563
|
-
if (!
|
|
10562
|
+
const name2 = key?.["name"] ?? null;
|
|
10563
|
+
if (!name2)
|
|
10564
10564
|
return null;
|
|
10565
10565
|
const optional5 = !!member["optional"];
|
|
10566
10566
|
const typeNode = member["typeAnnotation"]?.["typeAnnotation"];
|
|
@@ -10570,7 +10570,7 @@ function readPropertySignature(member, snippetLocals) {
|
|
|
10570
10570
|
const leading = member["leadingComments"] ?? [];
|
|
10571
10571
|
const description = extractJsdocText(leading);
|
|
10572
10572
|
return {
|
|
10573
|
-
name,
|
|
10573
|
+
name: name2,
|
|
10574
10574
|
optional: optional5,
|
|
10575
10575
|
typeText,
|
|
10576
10576
|
isSnippet,
|
|
@@ -10709,19 +10709,19 @@ function extractFromDestructure(propsCall, _ctx, typeMembers, warnings, addition
|
|
|
10709
10709
|
if (p.type !== "Property")
|
|
10710
10710
|
continue;
|
|
10711
10711
|
const key = p["key"];
|
|
10712
|
-
const
|
|
10713
|
-
if (!
|
|
10712
|
+
const name2 = key?.["name"] ?? null;
|
|
10713
|
+
if (!name2)
|
|
10714
10714
|
continue;
|
|
10715
|
-
seenInDestructure.add(
|
|
10715
|
+
seenInDestructure.add(name2);
|
|
10716
10716
|
const value = p["value"];
|
|
10717
10717
|
const hasDefault = value?.type === "AssignmentPattern";
|
|
10718
10718
|
const defaultValueRaw = hasDefault ? renderLiteral(value["right"]) : void 0;
|
|
10719
|
-
const typeMember = typeByName.get(
|
|
10719
|
+
const typeMember = typeByName.get(name2);
|
|
10720
10720
|
if (typeMember?.isSnippet) {
|
|
10721
|
-
snippetNames.add(
|
|
10721
|
+
snippetNames.add(name2);
|
|
10722
10722
|
const slot = {
|
|
10723
|
-
name,
|
|
10724
|
-
isDefault:
|
|
10723
|
+
name: name2,
|
|
10724
|
+
isDefault: name2 === "children",
|
|
10725
10725
|
...typeMember.description ? { description: typeMember.description } : {}
|
|
10726
10726
|
};
|
|
10727
10727
|
const authorText = typeMember.declaredTypeText ?? typeMember.typeText;
|
|
@@ -10732,7 +10732,7 @@ function extractFromDestructure(propsCall, _ctx, typeMembers, warnings, addition
|
|
|
10732
10732
|
}
|
|
10733
10733
|
const required = typeMember ? !typeMember.optional && !hasDefault : !hasDefault;
|
|
10734
10734
|
const propDef = {
|
|
10735
|
-
name,
|
|
10735
|
+
name: name2,
|
|
10736
10736
|
type: typeMember?.typeText ?? "unknown",
|
|
10737
10737
|
required
|
|
10738
10738
|
};
|
|
@@ -10790,9 +10790,9 @@ function propertyOrder(properties) {
|
|
|
10790
10790
|
for (const p of properties) {
|
|
10791
10791
|
if (p.type !== "Property")
|
|
10792
10792
|
continue;
|
|
10793
|
-
const
|
|
10794
|
-
if (
|
|
10795
|
-
m.set(
|
|
10793
|
+
const name2 = p["key"]?.["name"] ?? null;
|
|
10794
|
+
if (name2)
|
|
10795
|
+
m.set(name2, i++);
|
|
10796
10796
|
}
|
|
10797
10797
|
return m;
|
|
10798
10798
|
}
|
|
@@ -10971,10 +10971,10 @@ function extractTemplateSlots(fragment) {
|
|
|
10971
10971
|
if (!node)
|
|
10972
10972
|
return;
|
|
10973
10973
|
if (node.type === "SlotElement") {
|
|
10974
|
-
const
|
|
10975
|
-
if (!seen.has(
|
|
10976
|
-
seen.add(
|
|
10977
|
-
slots.push({ name, isDefault:
|
|
10974
|
+
const name2 = readSlotName(node);
|
|
10975
|
+
if (!seen.has(name2)) {
|
|
10976
|
+
seen.add(name2);
|
|
10977
|
+
slots.push({ name: name2, isDefault: name2 === "default" });
|
|
10978
10978
|
}
|
|
10979
10979
|
}
|
|
10980
10980
|
const children = node["nodes"] ?? node["children"] ?? [];
|
|
@@ -11188,9 +11188,9 @@ function extractDecoratorInput(field) {
|
|
|
11188
11188
|
}
|
|
11189
11189
|
const resolved = resolvePropType(typeNode);
|
|
11190
11190
|
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
11191
|
-
const
|
|
11191
|
+
const name2 = alias ?? fieldName;
|
|
11192
11192
|
const prop = {
|
|
11193
|
-
name,
|
|
11193
|
+
name: name2,
|
|
11194
11194
|
type: typeText,
|
|
11195
11195
|
required,
|
|
11196
11196
|
sourceStartLine: field.getStartLineNumber(),
|
|
@@ -11266,9 +11266,9 @@ function extractSignalInput(field) {
|
|
|
11266
11266
|
const typeArg = init.getTypeArguments()[0];
|
|
11267
11267
|
const resolved = resolvePropType(typeArg);
|
|
11268
11268
|
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
11269
|
-
const
|
|
11269
|
+
const name2 = alias ?? fieldName;
|
|
11270
11270
|
const prop = {
|
|
11271
|
-
name,
|
|
11271
|
+
name: name2,
|
|
11272
11272
|
type: typeText,
|
|
11273
11273
|
required,
|
|
11274
11274
|
sourceStartLine: field.getStartLineNumber(),
|
|
@@ -11361,10 +11361,10 @@ function extractProps2(cls, meta) {
|
|
|
11361
11361
|
const parsed = parseInputsArrayEntry(entry);
|
|
11362
11362
|
if (!parsed)
|
|
11363
11363
|
continue;
|
|
11364
|
-
const
|
|
11365
|
-
if (byName.has(
|
|
11364
|
+
const name2 = parsed.alias ?? parsed.fieldName;
|
|
11365
|
+
if (byName.has(name2))
|
|
11366
11366
|
continue;
|
|
11367
|
-
byName.set(
|
|
11367
|
+
byName.set(name2, { name: name2, type: "any", required: false });
|
|
11368
11368
|
}
|
|
11369
11369
|
return [...byName.values()];
|
|
11370
11370
|
}
|
|
@@ -11513,16 +11513,16 @@ var init_resolve_template_source = __esm({
|
|
|
11513
11513
|
});
|
|
11514
11514
|
|
|
11515
11515
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/strip-library-prefix.js
|
|
11516
|
-
function stripLibraryPrefix(
|
|
11516
|
+
function stripLibraryPrefix(name2) {
|
|
11517
11517
|
for (const prefix of KNOWN_PREFIXES) {
|
|
11518
|
-
if (
|
|
11519
|
-
const rest =
|
|
11518
|
+
if (name2.startsWith(prefix) && name2.length > prefix.length) {
|
|
11519
|
+
const rest = name2.slice(prefix.length);
|
|
11520
11520
|
if (rest[0] && rest[0] === rest[0].toUpperCase()) {
|
|
11521
11521
|
return rest;
|
|
11522
11522
|
}
|
|
11523
11523
|
}
|
|
11524
11524
|
}
|
|
11525
|
-
return
|
|
11525
|
+
return name2;
|
|
11526
11526
|
}
|
|
11527
11527
|
var KNOWN_PREFIXES;
|
|
11528
11528
|
var init_strip_library_prefix = __esm({
|
|
@@ -11603,8 +11603,8 @@ function extractContentChildQueries(cls) {
|
|
|
11603
11603
|
if (init && Node15.isCallExpression(init)) {
|
|
11604
11604
|
const callee = init.getExpression();
|
|
11605
11605
|
if (Node15.isIdentifier(callee)) {
|
|
11606
|
-
const
|
|
11607
|
-
if (
|
|
11606
|
+
const name2 = callee.getText();
|
|
11607
|
+
if (name2 === "contentChild" || name2 === "contentChildren") {
|
|
11608
11608
|
const first = init.getArguments()[0];
|
|
11609
11609
|
const allowed = resolveClassIdentifierArg(first);
|
|
11610
11610
|
out.push(buildSlot(fieldName, allowed));
|
|
@@ -11633,9 +11633,9 @@ function resolveClassIdentifierArg(arg) {
|
|
|
11633
11633
|
return [arg.getText()];
|
|
11634
11634
|
return [];
|
|
11635
11635
|
}
|
|
11636
|
-
function buildSlot(
|
|
11636
|
+
function buildSlot(name2, allowed) {
|
|
11637
11637
|
const slot = {
|
|
11638
|
-
name,
|
|
11638
|
+
name: name2,
|
|
11639
11639
|
isDefault: false
|
|
11640
11640
|
};
|
|
11641
11641
|
if (allowed.length > 0)
|
|
@@ -11679,11 +11679,11 @@ async function extractSlots3(cls, meta, props) {
|
|
|
11679
11679
|
const template = await resolveTemplateSource(meta);
|
|
11680
11680
|
if (template) {
|
|
11681
11681
|
for (const el of parseNgContentElements(template)) {
|
|
11682
|
-
const
|
|
11683
|
-
if (byName.has(
|
|
11682
|
+
const name2 = deriveSlotName(el.rawSelect, meta.normalizedName);
|
|
11683
|
+
if (byName.has(name2))
|
|
11684
11684
|
continue;
|
|
11685
|
-
byName.set(
|
|
11686
|
-
name,
|
|
11685
|
+
byName.set(name2, {
|
|
11686
|
+
name: name2,
|
|
11687
11687
|
isDefault: el.rawSelect === null
|
|
11688
11688
|
});
|
|
11689
11689
|
}
|
|
@@ -11777,9 +11777,9 @@ function normalizeSlots(slots) {
|
|
|
11777
11777
|
return slots.map((slot) => {
|
|
11778
11778
|
if (slot.name.trim())
|
|
11779
11779
|
return slot;
|
|
11780
|
-
const
|
|
11780
|
+
const name2 = fallbackIndex === 0 ? "children" : `slot_${fallbackIndex}`;
|
|
11781
11781
|
fallbackIndex++;
|
|
11782
|
-
return { ...slot, name };
|
|
11782
|
+
return { ...slot, name: name2 };
|
|
11783
11783
|
});
|
|
11784
11784
|
}
|
|
11785
11785
|
var init_extract_angular_components = __esm({
|
|
@@ -12596,8 +12596,8 @@ var init_composition_cache_key = __esm({
|
|
|
12596
12596
|
|
|
12597
12597
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
|
|
12598
12598
|
import { dirname as dirname11 } from "node:path";
|
|
12599
|
-
function kebabToPascal3(
|
|
12600
|
-
return
|
|
12599
|
+
function kebabToPascal3(name2) {
|
|
12600
|
+
return name2.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
|
|
12601
12601
|
}
|
|
12602
12602
|
function collectManifestEdges(files, componentNames) {
|
|
12603
12603
|
const edges = [];
|
|
@@ -13293,9 +13293,9 @@ var init_validate3 = __esm({
|
|
|
13293
13293
|
|
|
13294
13294
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/create-component-id.js
|
|
13295
13295
|
import { createHash as createHash7 } from "node:crypto";
|
|
13296
|
-
function createComponentId(
|
|
13297
|
-
const sourceHash = createHash7("sha256").update(`${
|
|
13298
|
-
return `${
|
|
13296
|
+
function createComponentId(name2, resolvedSourcePath) {
|
|
13297
|
+
const sourceHash = createHash7("sha256").update(`${name2}:${resolvedSourcePath}`).digest("hex").slice(0, 12);
|
|
13298
|
+
return `${name2}-${sourceHash}`;
|
|
13299
13299
|
}
|
|
13300
13300
|
var init_create_component_id = __esm({
|
|
13301
13301
|
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/create-component-id.js"() {
|
|
@@ -13673,10 +13673,10 @@ var init_file_categories = __esm({
|
|
|
13673
13673
|
|
|
13674
13674
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/categorize-file.js
|
|
13675
13675
|
import path from "node:path";
|
|
13676
|
-
function categorizeFile(
|
|
13677
|
-
if (
|
|
13676
|
+
function categorizeFile(name2) {
|
|
13677
|
+
if (name2.endsWith(".d.ts"))
|
|
13678
13678
|
return "other";
|
|
13679
|
-
const ext = path.extname(
|
|
13679
|
+
const ext = path.extname(name2);
|
|
13680
13680
|
return CATEGORY_BY_EXTENSION[ext] ?? "other";
|
|
13681
13681
|
}
|
|
13682
13682
|
var init_categorize_file = __esm({
|
|
@@ -13687,8 +13687,8 @@ var init_categorize_file = __esm({
|
|
|
13687
13687
|
});
|
|
13688
13688
|
|
|
13689
13689
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/is-noise-config-file.js
|
|
13690
|
-
function isNoiseConfigFile(
|
|
13691
|
-
return DENYLISTED_EXACT_FILE_NAMES.has(
|
|
13690
|
+
function isNoiseConfigFile(name2) {
|
|
13691
|
+
return DENYLISTED_EXACT_FILE_NAMES.has(name2) || DENYLISTED_FILE_NAME_PATTERNS.some((pattern) => pattern.test(name2));
|
|
13692
13692
|
}
|
|
13693
13693
|
var init_is_noise_config_file = __esm({
|
|
13694
13694
|
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/is-noise-config-file.js"() {
|
|
@@ -13699,15 +13699,15 @@ var init_is_noise_config_file = __esm({
|
|
|
13699
13699
|
|
|
13700
13700
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/is-source-file.js
|
|
13701
13701
|
import path2 from "node:path";
|
|
13702
|
-
function isSourceFile(
|
|
13703
|
-
if (
|
|
13702
|
+
function isSourceFile(name2) {
|
|
13703
|
+
if (name2.endsWith(".d.ts"))
|
|
13704
13704
|
return false;
|
|
13705
|
-
if (EXCLUDED_SUFFIXES.some((suffix) =>
|
|
13705
|
+
if (EXCLUDED_SUFFIXES.some((suffix) => name2.endsWith(suffix)))
|
|
13706
13706
|
return false;
|
|
13707
|
-
const ext = path2.extname(
|
|
13707
|
+
const ext = path2.extname(name2);
|
|
13708
13708
|
if (INCLUDED_EXTENSIONS.has(ext))
|
|
13709
13709
|
return true;
|
|
13710
|
-
if (DENYLIST_GATED_EXTENSIONS.has(ext) && !isNoiseConfigFile(
|
|
13710
|
+
if (DENYLIST_GATED_EXTENSIONS.has(ext) && !isNoiseConfigFile(name2))
|
|
13711
13711
|
return true;
|
|
13712
13712
|
return false;
|
|
13713
13713
|
}
|
|
@@ -14023,7 +14023,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14023
14023
|
const seen = /* @__PURE__ */ new Set();
|
|
14024
14024
|
for (const row of rows) {
|
|
14025
14025
|
const sourcePath = rowField(row, "source_path");
|
|
14026
|
-
const
|
|
14026
|
+
const name2 = rowField(row, "name");
|
|
14027
14027
|
if (!sourcePath)
|
|
14028
14028
|
continue;
|
|
14029
14029
|
const abs = resolve17(sourcePath);
|
|
@@ -14033,8 +14033,8 @@ async function buildSourceFingerprint(opts) {
|
|
|
14033
14033
|
try {
|
|
14034
14034
|
const st = await stat(abs);
|
|
14035
14035
|
const entry = { mtime: st.mtime.toISOString() };
|
|
14036
|
-
if (
|
|
14037
|
-
entry.componentName =
|
|
14036
|
+
if (name2)
|
|
14037
|
+
entry.componentName = name2;
|
|
14038
14038
|
files[abs] = entry;
|
|
14039
14039
|
} catch {
|
|
14040
14040
|
}
|
|
@@ -14075,10 +14075,10 @@ import { access as access4 } from "node:fs/promises";
|
|
|
14075
14075
|
import { join as join9 } from "node:path";
|
|
14076
14076
|
async function listConflictingFiles(path5) {
|
|
14077
14077
|
const conflicts = [];
|
|
14078
|
-
for (const
|
|
14078
|
+
for (const name2 of SAVE_FILES) {
|
|
14079
14079
|
try {
|
|
14080
|
-
await access4(join9(path5,
|
|
14081
|
-
conflicts.push(
|
|
14080
|
+
await access4(join9(path5, name2));
|
|
14081
|
+
conflicts.push(name2);
|
|
14082
14082
|
} catch {
|
|
14083
14083
|
}
|
|
14084
14084
|
}
|
|
@@ -14584,18 +14584,18 @@ var init_pathSerializer_gen = __esm({
|
|
|
14584
14584
|
return "&";
|
|
14585
14585
|
}
|
|
14586
14586
|
};
|
|
14587
|
-
serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
14587
|
+
serializeArrayParam = ({ allowReserved, explode, name: name2, style, value }) => {
|
|
14588
14588
|
if (!explode) {
|
|
14589
14589
|
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
14590
14590
|
switch (style) {
|
|
14591
14591
|
case "label":
|
|
14592
14592
|
return `.${joinedValues2}`;
|
|
14593
14593
|
case "matrix":
|
|
14594
|
-
return `;${
|
|
14594
|
+
return `;${name2}=${joinedValues2}`;
|
|
14595
14595
|
case "simple":
|
|
14596
14596
|
return joinedValues2;
|
|
14597
14597
|
default:
|
|
14598
|
-
return `${
|
|
14598
|
+
return `${name2}=${joinedValues2}`;
|
|
14599
14599
|
}
|
|
14600
14600
|
}
|
|
14601
14601
|
const separator = separatorArrayExplode(style);
|
|
@@ -14605,24 +14605,24 @@ var init_pathSerializer_gen = __esm({
|
|
|
14605
14605
|
}
|
|
14606
14606
|
return serializePrimitiveParam({
|
|
14607
14607
|
allowReserved,
|
|
14608
|
-
name,
|
|
14608
|
+
name: name2,
|
|
14609
14609
|
value: v
|
|
14610
14610
|
});
|
|
14611
14611
|
}).join(separator);
|
|
14612
14612
|
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
14613
14613
|
};
|
|
14614
|
-
serializePrimitiveParam = ({ allowReserved, name, value }) => {
|
|
14614
|
+
serializePrimitiveParam = ({ allowReserved, name: name2, value }) => {
|
|
14615
14615
|
if (value === void 0 || value === null) {
|
|
14616
14616
|
return "";
|
|
14617
14617
|
}
|
|
14618
14618
|
if (typeof value === "object") {
|
|
14619
14619
|
throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
|
|
14620
14620
|
}
|
|
14621
|
-
return `${
|
|
14621
|
+
return `${name2}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
14622
14622
|
};
|
|
14623
|
-
serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
14623
|
+
serializeObjectParam = ({ allowReserved, explode, name: name2, style, value, valueOnly }) => {
|
|
14624
14624
|
if (value instanceof Date) {
|
|
14625
|
-
return valueOnly ? value.toISOString() : `${
|
|
14625
|
+
return valueOnly ? value.toISOString() : `${name2}=${value.toISOString()}`;
|
|
14626
14626
|
}
|
|
14627
14627
|
if (style !== "deepObject" && !explode) {
|
|
14628
14628
|
let values = [];
|
|
@@ -14636,11 +14636,11 @@ var init_pathSerializer_gen = __esm({
|
|
|
14636
14636
|
const joinedValues2 = values.join(",");
|
|
14637
14637
|
switch (style) {
|
|
14638
14638
|
case "form":
|
|
14639
|
-
return `${
|
|
14639
|
+
return `${name2}=${joinedValues2}`;
|
|
14640
14640
|
case "label":
|
|
14641
14641
|
return `.${joinedValues2}`;
|
|
14642
14642
|
case "matrix":
|
|
14643
|
-
return `;${
|
|
14643
|
+
return `;${name2}=${joinedValues2}`;
|
|
14644
14644
|
default:
|
|
14645
14645
|
return joinedValues2;
|
|
14646
14646
|
}
|
|
@@ -14648,7 +14648,7 @@ var init_pathSerializer_gen = __esm({
|
|
|
14648
14648
|
const separator = separatorObjectExplode(style);
|
|
14649
14649
|
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
|
|
14650
14650
|
allowReserved,
|
|
14651
|
-
name: style === "deepObject" ? `${
|
|
14651
|
+
name: style === "deepObject" ? `${name2}[${key}]` : key,
|
|
14652
14652
|
value: v
|
|
14653
14653
|
})).join(separator);
|
|
14654
14654
|
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
@@ -14671,31 +14671,31 @@ var init_utils_gen = __esm({
|
|
|
14671
14671
|
if (matches) {
|
|
14672
14672
|
for (const match2 of matches) {
|
|
14673
14673
|
let explode = false;
|
|
14674
|
-
let
|
|
14674
|
+
let name2 = match2.substring(1, match2.length - 1);
|
|
14675
14675
|
let style = "simple";
|
|
14676
|
-
if (
|
|
14676
|
+
if (name2.endsWith("*")) {
|
|
14677
14677
|
explode = true;
|
|
14678
|
-
|
|
14678
|
+
name2 = name2.substring(0, name2.length - 1);
|
|
14679
14679
|
}
|
|
14680
|
-
if (
|
|
14681
|
-
|
|
14680
|
+
if (name2.startsWith(".")) {
|
|
14681
|
+
name2 = name2.substring(1);
|
|
14682
14682
|
style = "label";
|
|
14683
|
-
} else if (
|
|
14684
|
-
|
|
14683
|
+
} else if (name2.startsWith(";")) {
|
|
14684
|
+
name2 = name2.substring(1);
|
|
14685
14685
|
style = "matrix";
|
|
14686
14686
|
}
|
|
14687
|
-
const value = path5[
|
|
14687
|
+
const value = path5[name2];
|
|
14688
14688
|
if (value === void 0 || value === null) {
|
|
14689
14689
|
continue;
|
|
14690
14690
|
}
|
|
14691
14691
|
if (Array.isArray(value)) {
|
|
14692
|
-
url = url.replace(match2, serializeArrayParam({ explode, name, style, value }));
|
|
14692
|
+
url = url.replace(match2, serializeArrayParam({ explode, name: name2, style, value }));
|
|
14693
14693
|
continue;
|
|
14694
14694
|
}
|
|
14695
14695
|
if (typeof value === "object") {
|
|
14696
14696
|
url = url.replace(match2, serializeObjectParam({
|
|
14697
14697
|
explode,
|
|
14698
|
-
name,
|
|
14698
|
+
name: name2,
|
|
14699
14699
|
style,
|
|
14700
14700
|
value,
|
|
14701
14701
|
valueOnly: true
|
|
@@ -14704,7 +14704,7 @@ var init_utils_gen = __esm({
|
|
|
14704
14704
|
}
|
|
14705
14705
|
if (style === "matrix") {
|
|
14706
14706
|
url = url.replace(match2, `;${serializePrimitiveParam({
|
|
14707
|
-
name,
|
|
14707
|
+
name: name2,
|
|
14708
14708
|
value
|
|
14709
14709
|
})}`);
|
|
14710
14710
|
continue;
|
|
@@ -14715,12 +14715,12 @@ var init_utils_gen = __esm({
|
|
|
14715
14715
|
}
|
|
14716
14716
|
return url;
|
|
14717
14717
|
};
|
|
14718
|
-
createQuerySerializer = ({ allowReserved, array:
|
|
14718
|
+
createQuerySerializer = ({ allowReserved, array: array4, object } = {}) => {
|
|
14719
14719
|
const querySerializer = (queryParams) => {
|
|
14720
14720
|
const search = [];
|
|
14721
14721
|
if (queryParams && typeof queryParams === "object") {
|
|
14722
|
-
for (const
|
|
14723
|
-
const value = queryParams[
|
|
14722
|
+
for (const name2 in queryParams) {
|
|
14723
|
+
const value = queryParams[name2];
|
|
14724
14724
|
if (value === void 0 || value === null) {
|
|
14725
14725
|
continue;
|
|
14726
14726
|
}
|
|
@@ -14728,10 +14728,10 @@ var init_utils_gen = __esm({
|
|
|
14728
14728
|
const serializedArray = serializeArrayParam({
|
|
14729
14729
|
allowReserved,
|
|
14730
14730
|
explode: true,
|
|
14731
|
-
name,
|
|
14731
|
+
name: name2,
|
|
14732
14732
|
style: "form",
|
|
14733
14733
|
value,
|
|
14734
|
-
...
|
|
14734
|
+
...array4
|
|
14735
14735
|
});
|
|
14736
14736
|
if (serializedArray)
|
|
14737
14737
|
search.push(serializedArray);
|
|
@@ -14739,7 +14739,7 @@ var init_utils_gen = __esm({
|
|
|
14739
14739
|
const serializedObject = serializeObjectParam({
|
|
14740
14740
|
allowReserved,
|
|
14741
14741
|
explode: true,
|
|
14742
|
-
name,
|
|
14742
|
+
name: name2,
|
|
14743
14743
|
style: "deepObject",
|
|
14744
14744
|
value,
|
|
14745
14745
|
...object
|
|
@@ -14749,7 +14749,7 @@ var init_utils_gen = __esm({
|
|
|
14749
14749
|
} else {
|
|
14750
14750
|
const serializedPrimitive = serializePrimitiveParam({
|
|
14751
14751
|
allowReserved,
|
|
14752
|
-
name,
|
|
14752
|
+
name: name2,
|
|
14753
14753
|
value
|
|
14754
14754
|
});
|
|
14755
14755
|
if (serializedPrimitive)
|
|
@@ -14783,11 +14783,11 @@ var init_utils_gen = __esm({
|
|
|
14783
14783
|
}
|
|
14784
14784
|
return;
|
|
14785
14785
|
};
|
|
14786
|
-
checkForExistence = (options,
|
|
14787
|
-
if (!
|
|
14786
|
+
checkForExistence = (options, name2) => {
|
|
14787
|
+
if (!name2) {
|
|
14788
14788
|
return false;
|
|
14789
14789
|
}
|
|
14790
|
-
if (options.headers.has(
|
|
14790
|
+
if (options.headers.has(name2) || options.query?.[name2] || options.headers.get("Cookie")?.includes(`${name2}=`)) {
|
|
14791
14791
|
return true;
|
|
14792
14792
|
}
|
|
14793
14793
|
return false;
|
|
@@ -14801,20 +14801,20 @@ var init_utils_gen = __esm({
|
|
|
14801
14801
|
if (!token) {
|
|
14802
14802
|
continue;
|
|
14803
14803
|
}
|
|
14804
|
-
const
|
|
14804
|
+
const name2 = auth.name ?? "Authorization";
|
|
14805
14805
|
switch (auth.in) {
|
|
14806
14806
|
case "query":
|
|
14807
14807
|
if (!options.query) {
|
|
14808
14808
|
options.query = {};
|
|
14809
14809
|
}
|
|
14810
|
-
options.query[
|
|
14810
|
+
options.query[name2] = token;
|
|
14811
14811
|
break;
|
|
14812
14812
|
case "cookie":
|
|
14813
|
-
options.headers.append("Cookie", `${
|
|
14813
|
+
options.headers.append("Cookie", `${name2}=${token}`);
|
|
14814
14814
|
break;
|
|
14815
14815
|
case "header":
|
|
14816
14816
|
default:
|
|
14817
|
-
options.headers.set(
|
|
14817
|
+
options.headers.set(name2, token);
|
|
14818
14818
|
break;
|
|
14819
14819
|
}
|
|
14820
14820
|
}
|
|
@@ -15972,11 +15972,11 @@ function parseEdsiError(rawInput) {
|
|
|
15972
15972
|
...binding.diagnostics ? { diagnostics: binding.diagnostics } : {}
|
|
15973
15973
|
};
|
|
15974
15974
|
}
|
|
15975
|
-
const
|
|
15976
|
-
if (
|
|
15975
|
+
const literal4 = parseObjectLiteralTail(cleaned);
|
|
15976
|
+
if (literal4 && (literal4.code || literal4.cycle)) {
|
|
15977
15977
|
const braceStart = cleaned.lastIndexOf("{");
|
|
15978
15978
|
const head = braceStart === -1 ? cleaned : cleaned.slice(0, braceStart).trim();
|
|
15979
|
-
return { code:
|
|
15979
|
+
return { code: literal4.code ?? null, message: head || cleaned, cycle: literal4.cycle ?? null, raw: false };
|
|
15980
15980
|
}
|
|
15981
15981
|
return { code: null, message: cleaned || prefix || rawInput, cycle: null, raw: true };
|
|
15982
15982
|
}
|
|
@@ -16382,8 +16382,8 @@ var init_count_character_edits = __esm({
|
|
|
16382
16382
|
});
|
|
16383
16383
|
|
|
16384
16384
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/simplify-name-for-comparison.js
|
|
16385
|
-
function simplifyNameForComparison(
|
|
16386
|
-
const stripped =
|
|
16385
|
+
function simplifyNameForComparison(name2) {
|
|
16386
|
+
const stripped = name2.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
16387
16387
|
return stripped.endsWith("s") && stripped.length > 1 ? stripped.slice(0, -1) : stripped;
|
|
16388
16388
|
}
|
|
16389
16389
|
var init_simplify_name_for_comparison = __esm({
|
|
@@ -16774,9 +16774,9 @@ var init_apply_map_token_prop_calls = __esm({
|
|
|
16774
16774
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/binary-exists.js
|
|
16775
16775
|
import { execFile } from "node:child_process";
|
|
16776
16776
|
import { promisify } from "node:util";
|
|
16777
|
-
async function binaryExists(
|
|
16777
|
+
async function binaryExists(name2) {
|
|
16778
16778
|
try {
|
|
16779
|
-
await execFileAsync(process.platform === "win32" ? "where" : "which", [
|
|
16779
|
+
await execFileAsync(process.platform === "win32" ? "where" : "which", [name2]);
|
|
16780
16780
|
return true;
|
|
16781
16781
|
} catch {
|
|
16782
16782
|
return false;
|
|
@@ -17474,20 +17474,20 @@ function collectSiblingRendererImports(sourceText) {
|
|
|
17474
17474
|
continue;
|
|
17475
17475
|
if (/-g(?:ql|gl)(?:$|\.)/i.test(importPath))
|
|
17476
17476
|
continue;
|
|
17477
|
-
for (const
|
|
17478
|
-
if (
|
|
17479
|
-
names.add(
|
|
17477
|
+
for (const name2 of parseImportedNames(importClause)) {
|
|
17478
|
+
if (name2)
|
|
17479
|
+
names.add(name2);
|
|
17480
17480
|
}
|
|
17481
17481
|
}
|
|
17482
17482
|
return [...names];
|
|
17483
17483
|
}
|
|
17484
17484
|
function hasSiblingForwardRender(sourceText, siblingImports) {
|
|
17485
|
-
return siblingImports.some((
|
|
17486
|
-
const renderPattern = new RegExp(`<${escapeRegExp(
|
|
17485
|
+
return siblingImports.some((name2) => {
|
|
17486
|
+
const renderPattern = new RegExp(`<${escapeRegExp(name2)}\\b[\\s\\S]*?(?:/>|</${escapeRegExp(name2)}>)`);
|
|
17487
17487
|
if (!renderPattern.test(sourceText))
|
|
17488
17488
|
return false;
|
|
17489
|
-
const siblingSpreadPattern = new RegExp(`<${escapeRegExp(
|
|
17490
|
-
const propsPlusSiblingSpreadPattern = new RegExp(`<${escapeRegExp(
|
|
17489
|
+
const siblingSpreadPattern = new RegExp(`<${escapeRegExp(name2)}\\b[^>]*\\{\\.\\.\\.(?!props\\b)[^}]+\\}`);
|
|
17490
|
+
const propsPlusSiblingSpreadPattern = new RegExp(`<${escapeRegExp(name2)}\\b[^>]*\\{\\.\\.\\.props\\}[^>]*\\{\\.\\.\\.(?!props\\b)[^}]+\\}`);
|
|
17491
17491
|
return siblingSpreadPattern.test(sourceText) || propsPlusSiblingSpreadPattern.test(sourceText);
|
|
17492
17492
|
});
|
|
17493
17493
|
}
|
|
@@ -17704,34 +17704,34 @@ function isNumberType(type) {
|
|
|
17704
17704
|
function isComplexType(type) {
|
|
17705
17705
|
return !isSimpleType(type);
|
|
17706
17706
|
}
|
|
17707
|
-
function isDomPassThroughProp(
|
|
17708
|
-
if (DOM_PASS_THROUGH_PROPS.has(
|
|
17707
|
+
function isDomPassThroughProp(name2) {
|
|
17708
|
+
if (DOM_PASS_THROUGH_PROPS.has(name2))
|
|
17709
17709
|
return true;
|
|
17710
|
-
if (/^aria[-A-Z]/.test(
|
|
17710
|
+
if (/^aria[-A-Z]/.test(name2))
|
|
17711
17711
|
return true;
|
|
17712
|
-
return
|
|
17712
|
+
return name2.startsWith("data-");
|
|
17713
17713
|
}
|
|
17714
17714
|
function preClassifyProp(prop) {
|
|
17715
|
-
const { name, type } = prop;
|
|
17716
|
-
if (/^on[A-Z]/.test(
|
|
17715
|
+
const { name: name2, type } = prop;
|
|
17716
|
+
if (/^on[A-Z]/.test(name2) || type.includes("=> void") || type.includes("EventHandler")) {
|
|
17717
17717
|
return { category: "exclude" };
|
|
17718
17718
|
}
|
|
17719
|
-
if (
|
|
17719
|
+
if (name2 === "ref" || name2 === "innerRef" || type.includes("Ref<") || type.includes("RefObject<")) {
|
|
17720
17720
|
return { category: "exclude" };
|
|
17721
17721
|
}
|
|
17722
|
-
if (
|
|
17722
|
+
if (name2 === "testId" || name2 === "data-testid" || name2 === "dataTestId") {
|
|
17723
17723
|
return { category: "exclude" };
|
|
17724
17724
|
}
|
|
17725
|
-
if (
|
|
17725
|
+
if (name2 === "key") {
|
|
17726
17726
|
return { category: "exclude" };
|
|
17727
17727
|
}
|
|
17728
17728
|
if (type.includes("Dispatch<") || type.includes("SetStateAction")) {
|
|
17729
17729
|
return { category: "exclude" };
|
|
17730
17730
|
}
|
|
17731
|
-
if (isDomPassThroughProp(
|
|
17731
|
+
if (isDomPassThroughProp(name2)) {
|
|
17732
17732
|
return { category: "exclude" };
|
|
17733
17733
|
}
|
|
17734
|
-
if (
|
|
17734
|
+
if (name2 === "name" && prop.domAttribute) {
|
|
17735
17735
|
return { category: "exclude" };
|
|
17736
17736
|
}
|
|
17737
17737
|
if (isStringLiteralUnion(type)) {
|
|
@@ -17740,36 +17740,36 @@ function preClassifyProp(prop) {
|
|
|
17740
17740
|
if (!isComplexType(type)) {
|
|
17741
17741
|
const designNameStart = /^(variant|size|spacing|gap|color|bg|theme|align|layout|orientation|position)/i;
|
|
17742
17742
|
const designNameEnd = /(Color|Size|Variant|Style)$/;
|
|
17743
|
-
if (designNameStart.test(
|
|
17743
|
+
if (designNameStart.test(name2) || designNameEnd.test(name2)) {
|
|
17744
17744
|
return { category: "design", cdfTypeHint: "string" };
|
|
17745
17745
|
}
|
|
17746
17746
|
}
|
|
17747
17747
|
if (isBooleanType(type)) {
|
|
17748
17748
|
const stateNames = ["disabled", "loading", "expanded", "isOpen", "selected", "checked", "active", "preview"];
|
|
17749
|
-
if (stateNames.includes(
|
|
17749
|
+
if (stateNames.includes(name2)) {
|
|
17750
17750
|
return { category: "state", cdfTypeHint: "boolean" };
|
|
17751
17751
|
}
|
|
17752
17752
|
}
|
|
17753
17753
|
if (isBooleanType(type)) {
|
|
17754
17754
|
const visualToggle = /^(hide|show|enable|disable|vertical|horizontal|reverse|bold|italic|imageOn|with)/i;
|
|
17755
|
-
if (visualToggle.test(
|
|
17755
|
+
if (visualToggle.test(name2)) {
|
|
17756
17756
|
return { category: "design", cdfTypeHint: "boolean" };
|
|
17757
17757
|
}
|
|
17758
17758
|
}
|
|
17759
|
-
if (
|
|
17759
|
+
if (name2 === "componentId" || name2 === "sectionKey" || name2 === "locale" || name2 === "variantIndex") {
|
|
17760
17760
|
return { category: "state", cdfTypeHint: "string" };
|
|
17761
17761
|
}
|
|
17762
17762
|
if (isStringType(type)) {
|
|
17763
17763
|
const urlNameStart = /^(href|url|link|src)/i;
|
|
17764
17764
|
const urlNameEnd = /(Url|Href|Link|Src)$/;
|
|
17765
|
-
if (urlNameStart.test(
|
|
17765
|
+
if (urlNameStart.test(name2) || urlNameEnd.test(name2)) {
|
|
17766
17766
|
return { category: "content", cdfTypeHint: "string" };
|
|
17767
17767
|
}
|
|
17768
17768
|
}
|
|
17769
17769
|
if (isStringType(type)) {
|
|
17770
17770
|
const textNameStart = /^(label|title|text|description|caption|heading|subheading|body|alt|name|placeholder|summary)/i;
|
|
17771
17771
|
const textNameEnd = /(Text|Label|Title|Name)$/;
|
|
17772
|
-
if (textNameStart.test(
|
|
17772
|
+
if (textNameStart.test(name2) || textNameEnd.test(name2)) {
|
|
17773
17773
|
return { category: "content", cdfTypeHint: "string" };
|
|
17774
17774
|
}
|
|
17775
17775
|
}
|
|
@@ -18085,7 +18085,7 @@ async function resolveComposition(request) {
|
|
|
18085
18085
|
timeoutMs: 12e4,
|
|
18086
18086
|
promptViaStdin: true,
|
|
18087
18087
|
bedrock,
|
|
18088
|
-
onDebugEvent: (
|
|
18088
|
+
onDebugEvent: (name2, payload) => onDebugEvent?.("agent", { event: name2, ...payload })
|
|
18089
18089
|
});
|
|
18090
18090
|
lastAgentExitCode = res.exitCode;
|
|
18091
18091
|
if (res.exitCode !== 0 && res.stderr.trim()) {
|
|
@@ -18397,7 +18397,7 @@ function collectDuplicateNames(components) {
|
|
|
18397
18397
|
sources.push(c2.source);
|
|
18398
18398
|
nameCounts.set(c2.name, sources);
|
|
18399
18399
|
}
|
|
18400
|
-
return [...nameCounts.entries()].filter(([, srcs]) => srcs.length > 1).map(([
|
|
18400
|
+
return [...nameCounts.entries()].filter(([, srcs]) => srcs.length > 1).map(([name2, sources]) => ({ name: name2, sources }));
|
|
18401
18401
|
}
|
|
18402
18402
|
var init_collect_duplicate_names = __esm({
|
|
18403
18403
|
"packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/collect-duplicate-names.js"() {
|
|
@@ -18512,7 +18512,7 @@ async function runOneGenerateComponent(options, component, index, total) {
|
|
|
18512
18512
|
});
|
|
18513
18513
|
}
|
|
18514
18514
|
}
|
|
18515
|
-
effectiveSlots = effectiveSlots.map((slot) => slot.allowedComponents ? { ...slot, allowedComponents: slot.allowedComponents.filter((
|
|
18515
|
+
effectiveSlots = effectiveSlots.map((slot) => slot.allowedComponents ? { ...slot, allowedComponents: slot.allowedComponents.filter((name2) => allowedComponentNames2.has(name2)) } : slot);
|
|
18516
18516
|
const cacheComponent = normalizeComponentForCache(component);
|
|
18517
18517
|
if (!noCache && precomputedCachedNames.has(component.name)) {
|
|
18518
18518
|
onProgress?.({ kind: "component:cached", index, total, name: component.name, pinned: false });
|
|
@@ -19020,7 +19020,7 @@ var init_v1_store = __esm({
|
|
|
19020
19020
|
|
|
19021
19021
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-store.ts
|
|
19022
19022
|
function emptyAgents() {
|
|
19023
|
-
return Object.fromEntries(AGENT_NAMES.map((
|
|
19023
|
+
return Object.fromEntries(AGENT_NAMES.map((name2) => [name2, { model: "", binary: "" }]));
|
|
19024
19024
|
}
|
|
19025
19025
|
async function readAgentConfig() {
|
|
19026
19026
|
const store = await readV1Store();
|
|
@@ -19030,11 +19030,11 @@ async function readAgentConfig() {
|
|
|
19030
19030
|
const agents = emptyAgents();
|
|
19031
19031
|
const saved = store["agents"];
|
|
19032
19032
|
if (saved && typeof saved === "object") {
|
|
19033
|
-
for (const
|
|
19034
|
-
const entry = saved[
|
|
19033
|
+
for (const name2 of AGENT_NAMES) {
|
|
19034
|
+
const entry = saved[name2];
|
|
19035
19035
|
if (entry && typeof entry === "object") {
|
|
19036
19036
|
const fields2 = entry;
|
|
19037
|
-
agents[
|
|
19037
|
+
agents[name2] = { model: asString(fields2["model"]), binary: asString(fields2["binary"]) };
|
|
19038
19038
|
}
|
|
19039
19039
|
}
|
|
19040
19040
|
}
|
|
@@ -19047,10 +19047,10 @@ async function writeAgentConfig(config) {
|
|
|
19047
19047
|
const existing = await readV1Store();
|
|
19048
19048
|
const merged = { ...existing };
|
|
19049
19049
|
const agents = {};
|
|
19050
|
-
for (const
|
|
19051
|
-
const model = config.agents[
|
|
19052
|
-
const binary = config.agents[
|
|
19053
|
-
if (model || binary) agents[
|
|
19050
|
+
for (const name2 of AGENT_NAMES) {
|
|
19051
|
+
const model = config.agents[name2].model.trim();
|
|
19052
|
+
const binary = config.agents[name2].binary.trim();
|
|
19053
|
+
if (model || binary) agents[name2] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
|
|
19054
19054
|
}
|
|
19055
19055
|
const defaultModel = config.defaultChosen ? agents[config.defaultAgent]?.model : void 0;
|
|
19056
19056
|
if (config.defaultChosen) merged["agent"] = config.defaultAgent;
|
|
@@ -19080,9 +19080,9 @@ var init_agent_store = __esm({
|
|
|
19080
19080
|
|
|
19081
19081
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/apply-binary-overrides.ts
|
|
19082
19082
|
function applyBinaryOverrides(config) {
|
|
19083
|
-
for (const
|
|
19084
|
-
const key = `EDS_AGENT_BINARY_${
|
|
19085
|
-
const binary = config.agents[
|
|
19083
|
+
for (const name2 of AGENT_NAMES) {
|
|
19084
|
+
const key = `EDS_AGENT_BINARY_${name2.toUpperCase()}`;
|
|
19085
|
+
const binary = config.agents[name2].binary.trim();
|
|
19086
19086
|
if (binary) {
|
|
19087
19087
|
if (!shellValues.has(key)) shellValues.set(key, process.env[key]);
|
|
19088
19088
|
process.env[key] = binary;
|
|
@@ -19465,7 +19465,7 @@ async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
|
19465
19465
|
const contentfulDir = join18(base, ".contentful");
|
|
19466
19466
|
const result = { logs: 0, folders: 0 };
|
|
19467
19467
|
try {
|
|
19468
|
-
const sessions = (await readdir2(contentfulDir)).filter((
|
|
19468
|
+
const sessions = (await readdir2(contentfulDir)).filter((name2) => SESSION_FOLDER.test(name2));
|
|
19469
19469
|
for (const session of sessions) {
|
|
19470
19470
|
const files = await logFilesIn(join18(contentfulDir, session, "debug")).catch(() => []);
|
|
19471
19471
|
for (const file of files) {
|
|
@@ -22399,7 +22399,7 @@ function collectDependents(components) {
|
|
|
22399
22399
|
function findRoots(components, selected) {
|
|
22400
22400
|
const scope = selected ? components.filter((c2) => selected.has(c2.name)) : components;
|
|
22401
22401
|
const dependents = collectDependents(scope);
|
|
22402
|
-
return scope.map((c2) => c2.name).filter((
|
|
22402
|
+
return scope.map((c2) => c2.name).filter((name2) => !dependents.has(name2)).sort();
|
|
22403
22403
|
}
|
|
22404
22404
|
function findCycleInClosure(root, reachable, components) {
|
|
22405
22405
|
const scopedComponents = components.filter((c2) => reachable.has(c2.name)).map((c2) => ({ name: c2.name, slots: c2.slots }));
|
|
@@ -22435,9 +22435,9 @@ function computeClosure(root, components) {
|
|
|
22435
22435
|
const reachable = walkReachable2(root, byName, known);
|
|
22436
22436
|
const cyclePath = findCycleInClosure(root, reachable, components);
|
|
22437
22437
|
if (cyclePath) {
|
|
22438
|
-
const nodes2 = [...reachable].sort().map((
|
|
22439
|
-
name,
|
|
22440
|
-
depth:
|
|
22438
|
+
const nodes2 = [...reachable].sort().map((name2) => ({
|
|
22439
|
+
name: name2,
|
|
22440
|
+
depth: name2 === root ? 0 : 1,
|
|
22441
22441
|
path: [root],
|
|
22442
22442
|
parents: []
|
|
22443
22443
|
}));
|
|
@@ -22473,12 +22473,12 @@ function computeClosure(root, components) {
|
|
|
22473
22473
|
}
|
|
22474
22474
|
}
|
|
22475
22475
|
const nodes = [];
|
|
22476
|
-
for (const [
|
|
22476
|
+
for (const [name2, d] of depth.entries()) {
|
|
22477
22477
|
nodes.push({
|
|
22478
|
-
name,
|
|
22478
|
+
name: name2,
|
|
22479
22479
|
depth: d,
|
|
22480
|
-
path: parentPath.get(
|
|
22481
|
-
parents: [...parents.get(
|
|
22480
|
+
path: parentPath.get(name2),
|
|
22481
|
+
parents: [...parents.get(name2) ?? /* @__PURE__ */ new Set()].sort()
|
|
22482
22482
|
});
|
|
22483
22483
|
}
|
|
22484
22484
|
nodes.sort((a, b) => a.depth - b.depth || a.name.localeCompare(b.name));
|
|
@@ -22501,8 +22501,8 @@ function findSharedDeps(closures) {
|
|
|
22501
22501
|
}
|
|
22502
22502
|
}
|
|
22503
22503
|
const out = /* @__PURE__ */ new Map();
|
|
22504
|
-
for (const [
|
|
22505
|
-
if (roots.length >= 2) out.set(
|
|
22504
|
+
for (const [name2, roots] of counts.entries()) {
|
|
22505
|
+
if (roots.length >= 2) out.set(name2, [...roots].sort());
|
|
22506
22506
|
}
|
|
22507
22507
|
return out;
|
|
22508
22508
|
}
|
|
@@ -22666,11 +22666,11 @@ function buildVisibleRows(props) {
|
|
|
22666
22666
|
if (!expanded) continue;
|
|
22667
22667
|
const subtree = computeCycleMemberSubtree(key);
|
|
22668
22668
|
const isLastAtDepthSubtree = (idx) => {
|
|
22669
|
-
const
|
|
22669
|
+
const own = subtree[idx].depth;
|
|
22670
22670
|
for (let j = idx + 1; j < subtree.length; j++) {
|
|
22671
22671
|
const d = subtree[j].depth;
|
|
22672
|
-
if (d <
|
|
22673
|
-
if (d ===
|
|
22672
|
+
if (d < own) return true;
|
|
22673
|
+
if (d === own) return false;
|
|
22674
22674
|
}
|
|
22675
22675
|
return true;
|
|
22676
22676
|
};
|
|
@@ -22713,13 +22713,13 @@ function buildVisibleRows(props) {
|
|
|
22713
22713
|
...findRoots(subgraph),
|
|
22714
22714
|
...subgraph.filter((n) => hasDirectChild(n)).map((n) => n.name)
|
|
22715
22715
|
]);
|
|
22716
|
-
for (const
|
|
22717
|
-
const full = computeClosure(
|
|
22718
|
-
closures.set(
|
|
22716
|
+
for (const name2 of [...parentNames].sort()) {
|
|
22717
|
+
const full = computeClosure(name2, subgraph);
|
|
22718
|
+
closures.set(name2, { ...full, nodes: full.nodes.filter((n) => n.depth <= 1) });
|
|
22719
22719
|
}
|
|
22720
22720
|
const sharedDeps = findSharedDeps(closures);
|
|
22721
|
-
const hasCycleDepDirect = (
|
|
22722
|
-
const it = itemByKey.get(
|
|
22721
|
+
const hasCycleDepDirect = (name2) => {
|
|
22722
|
+
const it = itemByKey.get(name2)?.it;
|
|
22723
22723
|
if (!it) return false;
|
|
22724
22724
|
for (const target of allowedComponentNames(it.entry)) {
|
|
22725
22725
|
if (cycleParticipants.has(target)) return true;
|
|
@@ -22790,11 +22790,11 @@ function buildVisibleRows(props) {
|
|
|
22790
22790
|
injectedChildren.push({ name: c2.name, depth: c2.depth, isCycleChild: false });
|
|
22791
22791
|
}
|
|
22792
22792
|
const isLastAtDepth = (idx) => {
|
|
22793
|
-
const
|
|
22793
|
+
const own = injectedChildren[idx].depth;
|
|
22794
22794
|
for (let j = idx + 1; j < injectedChildren.length; j++) {
|
|
22795
22795
|
const d = injectedChildren[j].depth;
|
|
22796
|
-
if (d <
|
|
22797
|
-
if (d ===
|
|
22796
|
+
if (d < own) return true;
|
|
22797
|
+
if (d === own) return false;
|
|
22798
22798
|
}
|
|
22799
22799
|
return true;
|
|
22800
22800
|
};
|
|
@@ -22824,28 +22824,28 @@ function buildVisibleRows(props) {
|
|
|
22824
22824
|
});
|
|
22825
22825
|
});
|
|
22826
22826
|
}
|
|
22827
|
-
for (const
|
|
22828
|
-
const rec = itemByKey.get(
|
|
22827
|
+
for (const name2 of standaloneRoots) {
|
|
22828
|
+
const rec = itemByKey.get(name2);
|
|
22829
22829
|
if (!rec) continue;
|
|
22830
22830
|
rows.push({
|
|
22831
22831
|
kind: "standalone",
|
|
22832
|
-
key: `stand:${
|
|
22833
|
-
label:
|
|
22832
|
+
key: `stand:${name2}`,
|
|
22833
|
+
label: name2,
|
|
22834
22834
|
indent: 0,
|
|
22835
22835
|
itemIdx: rec.idx
|
|
22836
22836
|
});
|
|
22837
22837
|
}
|
|
22838
22838
|
const nodeByName = new Map(subgraph.map((n) => [n.name, n]));
|
|
22839
|
-
const sharedLeafNames = [...sharedDeps.keys()].filter((
|
|
22839
|
+
const sharedLeafNames = [...sharedDeps.keys()].filter((name2) => (nodeByName.get(name2)?.slots.length ?? 0) === 0).sort();
|
|
22840
22840
|
const seenStandaloneNames = new Set(standaloneRoots);
|
|
22841
|
-
for (const
|
|
22842
|
-
if (seenStandaloneNames.has(
|
|
22843
|
-
const rec = itemByKey.get(
|
|
22841
|
+
for (const name2 of sharedLeafNames) {
|
|
22842
|
+
if (seenStandaloneNames.has(name2)) continue;
|
|
22843
|
+
const rec = itemByKey.get(name2);
|
|
22844
22844
|
if (!rec) continue;
|
|
22845
22845
|
rows.push({
|
|
22846
22846
|
kind: "standalone",
|
|
22847
|
-
key: `shared-standalone:${
|
|
22848
|
-
label: `${
|
|
22847
|
+
key: `shared-standalone:${name2}`,
|
|
22848
|
+
label: `${name2} (shared)`,
|
|
22849
22849
|
indent: 0,
|
|
22850
22850
|
sharedSuffix: true,
|
|
22851
22851
|
itemIdx: rec.idx
|
|
@@ -22861,13 +22861,13 @@ function buildVisibleRows(props) {
|
|
|
22861
22861
|
indent: 0,
|
|
22862
22862
|
itemIdx: -1
|
|
22863
22863
|
});
|
|
22864
|
-
for (const
|
|
22865
|
-
const rec = itemByKey.get(
|
|
22864
|
+
for (const name2 of flatNames) {
|
|
22865
|
+
const rec = itemByKey.get(name2);
|
|
22866
22866
|
if (!rec) continue;
|
|
22867
22867
|
rows.push({
|
|
22868
22868
|
kind: "flat",
|
|
22869
|
-
key: `flat:${
|
|
22870
|
-
label:
|
|
22869
|
+
key: `flat:${name2}`,
|
|
22870
|
+
label: name2,
|
|
22871
22871
|
indent: 0,
|
|
22872
22872
|
itemIdx: rec.idx
|
|
22873
22873
|
});
|
|
@@ -22877,9 +22877,9 @@ function buildVisibleRows(props) {
|
|
|
22877
22877
|
if (filterVisibleKeys !== void 0) {
|
|
22878
22878
|
return rows.filter((row) => {
|
|
22879
22879
|
if (row.itemIdx < 0) return true;
|
|
22880
|
-
const
|
|
22881
|
-
if (
|
|
22882
|
-
return filterVisibleKeys.has(
|
|
22880
|
+
const name2 = items[row.itemIdx]?.key;
|
|
22881
|
+
if (name2 === void 0) return true;
|
|
22882
|
+
return filterVisibleKeys.has(name2);
|
|
22883
22883
|
});
|
|
22884
22884
|
}
|
|
22885
22885
|
return rows;
|
|
@@ -23601,11 +23601,11 @@ function computeCycleAwareAcceptCascade(target, components, cycleUnits) {
|
|
|
23601
23601
|
const byName = new Map(components.map((c2) => [c2.name, c2]));
|
|
23602
23602
|
const visited = /* @__PURE__ */ new Set();
|
|
23603
23603
|
const queue = [];
|
|
23604
|
-
const enqueue = (
|
|
23605
|
-
if (visited.has(
|
|
23606
|
-
visited.add(
|
|
23607
|
-
queue.push(
|
|
23608
|
-
const unit = cycleUnits.get(
|
|
23604
|
+
const enqueue = (name2) => {
|
|
23605
|
+
if (visited.has(name2)) return;
|
|
23606
|
+
visited.add(name2);
|
|
23607
|
+
queue.push(name2);
|
|
23608
|
+
const unit = cycleUnits.get(name2);
|
|
23609
23609
|
if (unit) {
|
|
23610
23610
|
for (const member of unit) {
|
|
23611
23611
|
if (!visited.has(member)) {
|
|
@@ -23742,7 +23742,7 @@ function buildScopeGraph(components) {
|
|
|
23742
23742
|
cycles = [];
|
|
23743
23743
|
}
|
|
23744
23744
|
const cycleParticipants = /* @__PURE__ */ new Set();
|
|
23745
|
-
for (const cycle of cycles) for (const
|
|
23745
|
+
for (const cycle of cycles) for (const name2 of cycle.path) cycleParticipants.add(name2);
|
|
23746
23746
|
return {
|
|
23747
23747
|
nodes,
|
|
23748
23748
|
cycles,
|
|
@@ -23967,10 +23967,10 @@ var init_lineage_layout = __esm({
|
|
|
23967
23967
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/sidebar-navigation.ts
|
|
23968
23968
|
function collectExpandedGroupRoots(closures, cycleParticipants) {
|
|
23969
23969
|
const roots = /* @__PURE__ */ new Set();
|
|
23970
|
-
for (const [
|
|
23971
|
-
if (closure.nodes.length > 1) roots.add(
|
|
23970
|
+
for (const [name2, closure] of closures.entries()) {
|
|
23971
|
+
if (closure.nodes.length > 1) roots.add(name2);
|
|
23972
23972
|
}
|
|
23973
|
-
for (const
|
|
23973
|
+
for (const name2 of cycleParticipants) roots.add(name2);
|
|
23974
23974
|
return roots;
|
|
23975
23975
|
}
|
|
23976
23976
|
function computeSidebarViewToggle({
|
|
@@ -24042,9 +24042,9 @@ function buildFlatDimPredicate(input) {
|
|
|
24042
24042
|
const isFlat = input.viewMode === "flat";
|
|
24043
24043
|
const keys = isFlat ? input.filterVisibleKeys : void 0;
|
|
24044
24044
|
if (!hasSearch && keys === void 0) return void 0;
|
|
24045
|
-
return (
|
|
24046
|
-
if (hasSearch && !fuzzyMatches(input.searchQuery,
|
|
24047
|
-
if (keys !== void 0 && !keys.has(
|
|
24045
|
+
return (name2) => {
|
|
24046
|
+
if (hasSearch && !fuzzyMatches(input.searchQuery, name2)) return true;
|
|
24047
|
+
if (keys !== void 0 && !keys.has(name2)) return true;
|
|
24048
24048
|
return false;
|
|
24049
24049
|
};
|
|
24050
24050
|
}
|
|
@@ -24064,7 +24064,7 @@ var init_step_filters = __esm({
|
|
|
24064
24064
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/state.ts
|
|
24065
24065
|
function apply(state2, entries) {
|
|
24066
24066
|
const next = new Map(state2);
|
|
24067
|
-
for (const [
|
|
24067
|
+
for (const [name2, decision] of entries) next.set(name2, decision);
|
|
24068
24068
|
return next;
|
|
24069
24069
|
}
|
|
24070
24070
|
function reduceDecisions(state2, action, components, graph) {
|
|
@@ -24073,44 +24073,44 @@ function reduceDecisions(state2, action, components, graph) {
|
|
|
24073
24073
|
if (state2.get(action.name) === "accepted") return state2;
|
|
24074
24074
|
return apply(
|
|
24075
24075
|
state2,
|
|
24076
|
-
acceptCascade(graph, action.name).map((
|
|
24076
|
+
acceptCascade(graph, action.name).map((name2) => [name2, "accepted"])
|
|
24077
24077
|
);
|
|
24078
24078
|
}
|
|
24079
24079
|
case "reject": {
|
|
24080
24080
|
if (state2.get(action.name) === "rejected") return state2;
|
|
24081
24081
|
const { toReject, toDeselect } = rejectCascade(graph, action.name);
|
|
24082
24082
|
return apply(state2, [
|
|
24083
|
-
...toReject.map((
|
|
24084
|
-
...toDeselect.map((
|
|
24083
|
+
...toReject.map((name2) => [name2, "rejected"]),
|
|
24084
|
+
...toDeselect.map((name2) => [name2, "undecided"])
|
|
24085
24085
|
]);
|
|
24086
24086
|
}
|
|
24087
24087
|
case "toggle-all": {
|
|
24088
24088
|
const nonCycle = components.filter((c2) => !graph.cycleParticipants.has(c2.name)).map((c2) => c2.name);
|
|
24089
|
-
const anyNotAccepted = nonCycle.some((
|
|
24089
|
+
const anyNotAccepted = nonCycle.some((name2) => state2.get(name2) !== "accepted");
|
|
24090
24090
|
if (anyNotAccepted) {
|
|
24091
24091
|
return apply(state2, [
|
|
24092
|
-
...nonCycle.map((
|
|
24093
|
-
...reachableCycleMembers(graph, nonCycle).map((
|
|
24092
|
+
...nonCycle.map((name2) => [name2, "accepted"]),
|
|
24093
|
+
...reachableCycleMembers(graph, nonCycle).map((name2) => [name2, "accepted"])
|
|
24094
24094
|
]);
|
|
24095
24095
|
}
|
|
24096
24096
|
return apply(state2, [
|
|
24097
|
-
...nonCycle.map((
|
|
24097
|
+
...nonCycle.map((name2) => [name2, "rejected"]),
|
|
24098
24098
|
...components.filter((c2) => graph.cycleParticipants.has(c2.name) && state2.get(c2.name) === "accepted").map((c2) => [c2.name, "undecided"])
|
|
24099
24099
|
]);
|
|
24100
24100
|
}
|
|
24101
24101
|
case "accept-unflagged": {
|
|
24102
24102
|
const seeds = components.filter((c2) => !graph.cycleParticipants.has(c2.name) && !isAiFlagged(c2)).map((c2) => c2.name);
|
|
24103
24103
|
return apply(state2, [
|
|
24104
|
-
...seeds.map((
|
|
24105
|
-
...reachableCycleMembers(graph, seeds).map((
|
|
24104
|
+
...seeds.map((name2) => [name2, "accepted"]),
|
|
24105
|
+
...reachableCycleMembers(graph, seeds).map((name2) => [name2, "accepted"])
|
|
24106
24106
|
]);
|
|
24107
24107
|
}
|
|
24108
24108
|
}
|
|
24109
24109
|
}
|
|
24110
|
-
function rejectNeedsConfirmation(graph,
|
|
24111
|
-
if (state2.get(
|
|
24112
|
-
const { toReject, toDeselect } = rejectCascade(graph,
|
|
24113
|
-
const ancestors = toReject.filter((n) => n !==
|
|
24110
|
+
function rejectNeedsConfirmation(graph, name2, state2) {
|
|
24111
|
+
if (state2.get(name2) === "rejected") return false;
|
|
24112
|
+
const { toReject, toDeselect } = rejectCascade(graph, name2);
|
|
24113
|
+
const ancestors = toReject.filter((n) => n !== name2);
|
|
24114
24114
|
return ancestors.length + toDeselect.length >= 2;
|
|
24115
24115
|
}
|
|
24116
24116
|
function partitionDecisions(components, state2) {
|
|
@@ -24208,8 +24208,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24208
24208
|
for (const node of closure.nodes) keys.add(node.name);
|
|
24209
24209
|
}
|
|
24210
24210
|
for (const unit of cycleUnits.values()) {
|
|
24211
|
-
if (![...unit].some((
|
|
24212
|
-
for (const
|
|
24211
|
+
if (![...unit].some((name2) => decisions.get(name2) === "accepted")) continue;
|
|
24212
|
+
for (const name2 of unit) keys.add(name2);
|
|
24213
24213
|
}
|
|
24214
24214
|
return keys;
|
|
24215
24215
|
}, [closures, cycleUnits, showDependencies, decisions]);
|
|
@@ -24307,12 +24307,12 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24307
24307
|
return void 0;
|
|
24308
24308
|
}
|
|
24309
24309
|
};
|
|
24310
|
-
const jumpCursorTo = (
|
|
24310
|
+
const jumpCursorTo = (name2) => {
|
|
24311
24311
|
let idx = -1;
|
|
24312
24312
|
for (let i = 0; i < visibleRows.length; i++) {
|
|
24313
24313
|
const row = visibleRows[i];
|
|
24314
24314
|
if (row.itemIdx < 0) continue;
|
|
24315
|
-
if (groupedItems[row.itemIdx]?.key ===
|
|
24315
|
+
if (groupedItems[row.itemIdx]?.key === name2) {
|
|
24316
24316
|
idx = i;
|
|
24317
24317
|
break;
|
|
24318
24318
|
}
|
|
@@ -24326,18 +24326,18 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24326
24326
|
});
|
|
24327
24327
|
};
|
|
24328
24328
|
const decide = (action) => setDecisions((prev) => reduceDecisions(prev, action, components, graph));
|
|
24329
|
-
const requestReject = (
|
|
24330
|
-
if (decisions.get(
|
|
24331
|
-
if (rejectNeedsConfirmation(graph,
|
|
24332
|
-
const { toReject, toDeselect } = rejectCascade(graph,
|
|
24329
|
+
const requestReject = (name2) => {
|
|
24330
|
+
if (decisions.get(name2) === "rejected") return;
|
|
24331
|
+
if (rejectNeedsConfirmation(graph, name2, decisions)) {
|
|
24332
|
+
const { toReject, toDeselect } = rejectCascade(graph, name2);
|
|
24333
24333
|
setPendingRejectCascade({
|
|
24334
|
-
target:
|
|
24335
|
-
ancestors: toReject.filter((n) => n !==
|
|
24334
|
+
target: name2,
|
|
24335
|
+
ancestors: toReject.filter((n) => n !== name2).sort(),
|
|
24336
24336
|
descendants: [...toDeselect].sort()
|
|
24337
24337
|
});
|
|
24338
24338
|
return;
|
|
24339
24339
|
}
|
|
24340
|
-
decide({ type: "reject", name });
|
|
24340
|
+
decide({ type: "reject", name: name2 });
|
|
24341
24341
|
};
|
|
24342
24342
|
const mode = showHelp ? "help" : pendingRejectCascade ? "reject-prompt" : searchOpen ? "search" : cyclesPanelOpen ? "cycles" : aiRationalePanel.isOpen ? "flags" : "main";
|
|
24343
24343
|
const context = {
|
|
@@ -24886,18 +24886,18 @@ function describeGeneration(input) {
|
|
|
24886
24886
|
${agent} is reading each selected component and writing a Contentful component definition for it.${input.hasTokens ? "\nUsing your design tokens for prop resolution." : ""}`;
|
|
24887
24887
|
}
|
|
24888
24888
|
function progressRows2(progress, agent) {
|
|
24889
|
-
const
|
|
24889
|
+
const name2 = capitalize(agent);
|
|
24890
24890
|
const { components, mapTokens } = progress;
|
|
24891
24891
|
const rows = [
|
|
24892
24892
|
{
|
|
24893
|
-
text: components ? components.current : `Starting up ${
|
|
24893
|
+
text: components ? components.current : `Starting up ${name2}...`,
|
|
24894
24894
|
complete: false,
|
|
24895
24895
|
...components ? { progress: { done: components.done, total: components.total } } : {}
|
|
24896
24896
|
}
|
|
24897
24897
|
];
|
|
24898
24898
|
if (mapTokens !== "idle") {
|
|
24899
24899
|
rows.push({
|
|
24900
|
-
text: mapTokens === "running" ? `Mapping token restrictions via ${
|
|
24900
|
+
text: mapTokens === "running" ? `Mapping token restrictions via ${name2}...` : "Token restrictions ready",
|
|
24901
24901
|
complete: mapTokens === "complete"
|
|
24902
24902
|
});
|
|
24903
24903
|
}
|
|
@@ -24907,7 +24907,7 @@ var capitalize;
|
|
|
24907
24907
|
var init_logic11 = __esm({
|
|
24908
24908
|
"packages/experience-design-system-cli/src/tui/import/steps/08-generation/logic.ts"() {
|
|
24909
24909
|
"use strict";
|
|
24910
|
-
capitalize = (
|
|
24910
|
+
capitalize = (name2) => name2.charAt(0).toUpperCase() + name2.slice(1);
|
|
24911
24911
|
}
|
|
24912
24912
|
});
|
|
24913
24913
|
|
|
@@ -25182,6 +25182,24 @@ var init_build_flow_start = __esm({
|
|
|
25182
25182
|
}
|
|
25183
25183
|
});
|
|
25184
25184
|
|
|
25185
|
+
// packages/experience-design-system-types/dist/src/source-input-association.js
|
|
25186
|
+
import * as z3 from "zod/mini";
|
|
25187
|
+
var name, SourceInputAssociationSchema;
|
|
25188
|
+
var init_source_input_association = __esm({
|
|
25189
|
+
"packages/experience-design-system-types/dist/src/source-input-association.js"() {
|
|
25190
|
+
"use strict";
|
|
25191
|
+
name = z3.string().check(z3.refine((value) => value.trim().length > 0));
|
|
25192
|
+
SourceInputAssociationSchema = z3.strictObject({
|
|
25193
|
+
schemaVersion: z3.literal(1),
|
|
25194
|
+
componentId: name,
|
|
25195
|
+
componentDeclarationId: name,
|
|
25196
|
+
rootSymbolId: name,
|
|
25197
|
+
inputName: name,
|
|
25198
|
+
inputPath: z3.array(name).check(z3.minLength(1))
|
|
25199
|
+
}).check(z3.refine((value) => value.inputPath[0] === value.inputName));
|
|
25200
|
+
}
|
|
25201
|
+
});
|
|
25202
|
+
|
|
25185
25203
|
// packages/experience-design-system-types/dist/src/cdf/vocabularies.js
|
|
25186
25204
|
var CDF_PROPERTY_TYPES2, CDF_PROPERTY_CATEGORIES2;
|
|
25187
25205
|
var init_vocabularies2 = __esm({
|
|
@@ -25376,38 +25394,38 @@ var init_validate5 = __esm({
|
|
|
25376
25394
|
});
|
|
25377
25395
|
|
|
25378
25396
|
// packages/experience-design-system-types/dist/src/cdf/types.js
|
|
25379
|
-
import * as
|
|
25397
|
+
import * as z4 from "zod/mini";
|
|
25380
25398
|
var CDFPropertySchema2, CDFSlotSchema2, CDFComponentSchema2, CDFTokenSchema2;
|
|
25381
25399
|
var init_types7 = __esm({
|
|
25382
25400
|
"packages/experience-design-system-types/dist/src/cdf/types.js"() {
|
|
25383
25401
|
"use strict";
|
|
25384
25402
|
init_vocabularies2();
|
|
25385
25403
|
init_token_types2();
|
|
25386
|
-
CDFPropertySchema2 =
|
|
25387
|
-
$type:
|
|
25388
|
-
$category:
|
|
25389
|
-
$description:
|
|
25390
|
-
$required:
|
|
25391
|
-
$default:
|
|
25392
|
-
$values:
|
|
25393
|
-
"$token.kind":
|
|
25394
|
-
"$token.allowed":
|
|
25404
|
+
CDFPropertySchema2 = z4.strictObject({
|
|
25405
|
+
$type: z4.enum(CDF_PROPERTY_TYPES2),
|
|
25406
|
+
$category: z4.enum(CDF_PROPERTY_CATEGORIES2),
|
|
25407
|
+
$description: z4.optional(z4.string()),
|
|
25408
|
+
$required: z4.optional(z4.boolean()),
|
|
25409
|
+
$default: z4.optional(z4.any()),
|
|
25410
|
+
$values: z4.optional(z4.array(z4.string())),
|
|
25411
|
+
"$token.kind": z4.optional(z4.string()),
|
|
25412
|
+
"$token.allowed": z4.optional(z4.array(z4.string()))
|
|
25395
25413
|
});
|
|
25396
|
-
CDFSlotSchema2 =
|
|
25397
|
-
$description:
|
|
25398
|
-
$allowedComponents:
|
|
25399
|
-
$required:
|
|
25414
|
+
CDFSlotSchema2 = z4.strictObject({
|
|
25415
|
+
$description: z4.optional(z4.string()),
|
|
25416
|
+
$allowedComponents: z4.optional(z4.array(z4.string())),
|
|
25417
|
+
$required: z4.optional(z4.boolean())
|
|
25400
25418
|
});
|
|
25401
|
-
CDFComponentSchema2 =
|
|
25402
|
-
$type:
|
|
25403
|
-
$description:
|
|
25404
|
-
$properties:
|
|
25405
|
-
$slots:
|
|
25419
|
+
CDFComponentSchema2 = z4.strictObject({
|
|
25420
|
+
$type: z4.literal("component"),
|
|
25421
|
+
$description: z4.optional(z4.string()),
|
|
25422
|
+
$properties: z4.record(z4.string(), CDFPropertySchema2),
|
|
25423
|
+
$slots: z4.optional(z4.record(z4.string(), CDFSlotSchema2))
|
|
25406
25424
|
});
|
|
25407
|
-
CDFTokenSchema2 =
|
|
25408
|
-
$type:
|
|
25409
|
-
$value:
|
|
25410
|
-
$description:
|
|
25425
|
+
CDFTokenSchema2 = z4.strictObject({
|
|
25426
|
+
$type: z4.enum(DESIGN_TOKEN_TYPES2),
|
|
25427
|
+
$value: z4.unknown(),
|
|
25428
|
+
$description: z4.optional(z4.string())
|
|
25411
25429
|
});
|
|
25412
25430
|
}
|
|
25413
25431
|
});
|
|
@@ -25417,9 +25435,9 @@ function stripUnsupportedSlotFields(entry) {
|
|
|
25417
25435
|
if (!entry.$slots)
|
|
25418
25436
|
return entry;
|
|
25419
25437
|
const cleaned = {};
|
|
25420
|
-
for (const [
|
|
25438
|
+
for (const [name2, slot] of Object.entries(entry.$slots)) {
|
|
25421
25439
|
const { $required: _required, ...rest } = slot;
|
|
25422
|
-
cleaned[
|
|
25440
|
+
cleaned[name2] = rest;
|
|
25423
25441
|
}
|
|
25424
25442
|
return { ...entry, $slots: cleaned };
|
|
25425
25443
|
}
|
|
@@ -25461,7 +25479,7 @@ function validateSlotReferences2(components) {
|
|
|
25461
25479
|
const slots = entry.$slots ?? {};
|
|
25462
25480
|
for (const [slotKey, slot] of Object.entries(slots)) {
|
|
25463
25481
|
const allowed = slot?.$allowedComponents ?? [];
|
|
25464
|
-
const unresolved = allowed.filter((
|
|
25482
|
+
const unresolved = allowed.filter((name2) => !componentKeys.has(name2));
|
|
25465
25483
|
if (unresolved.length === 0)
|
|
25466
25484
|
continue;
|
|
25467
25485
|
errors.push({
|
|
@@ -25507,17 +25525,17 @@ var init_cdf2 = __esm({
|
|
|
25507
25525
|
});
|
|
25508
25526
|
|
|
25509
25527
|
// packages/experience-design-system-types/dist/src/dtcg/types.js
|
|
25510
|
-
import * as
|
|
25528
|
+
import * as z5 from "zod/mini";
|
|
25511
25529
|
var DTCGTokenSchema2;
|
|
25512
25530
|
var init_types8 = __esm({
|
|
25513
25531
|
"packages/experience-design-system-types/dist/src/dtcg/types.js"() {
|
|
25514
25532
|
"use strict";
|
|
25515
25533
|
init_token_types2();
|
|
25516
|
-
DTCGTokenSchema2 =
|
|
25517
|
-
path:
|
|
25518
|
-
$type:
|
|
25519
|
-
$value:
|
|
25520
|
-
$description:
|
|
25534
|
+
DTCGTokenSchema2 = z5.strictObject({
|
|
25535
|
+
path: z5.string(),
|
|
25536
|
+
$type: z5.enum(DESIGN_TOKEN_TYPES2),
|
|
25537
|
+
$value: z5.unknown(),
|
|
25538
|
+
$description: z5.optional(z5.string())
|
|
25521
25539
|
});
|
|
25522
25540
|
}
|
|
25523
25541
|
});
|
|
@@ -25551,141 +25569,13 @@ var init_dtcg2 = __esm({
|
|
|
25551
25569
|
}
|
|
25552
25570
|
});
|
|
25553
25571
|
|
|
25554
|
-
// packages/experience-design-system-types/dist/src/property-contract/json-value.js
|
|
25555
|
-
var nodeTypes;
|
|
25556
|
-
var init_json_value = __esm({
|
|
25557
|
-
"packages/experience-design-system-types/dist/src/property-contract/json-value.js"() {
|
|
25558
|
-
"use strict";
|
|
25559
|
-
nodeTypes = globalThis.process?.getBuiltinModule?.("node:util")?.types;
|
|
25560
|
-
}
|
|
25561
|
-
});
|
|
25562
|
-
|
|
25563
|
-
// packages/experience-design-system-types/dist/src/property-contract/date-time-value.js
|
|
25564
|
-
import * as z5 from "zod/mini";
|
|
25565
|
-
var dateTimeValueSchema;
|
|
25566
|
-
var init_date_time_value = __esm({
|
|
25567
|
-
"packages/experience-design-system-types/dist/src/property-contract/date-time-value.js"() {
|
|
25568
|
-
"use strict";
|
|
25569
|
-
dateTimeValueSchema = z5.iso.datetime({ offset: true });
|
|
25570
|
-
}
|
|
25571
|
-
});
|
|
25572
|
-
|
|
25573
|
-
// packages/experience-design-system-types/dist/src/property-contract/discriminated-union.js
|
|
25574
|
-
var init_discriminated_union = __esm({
|
|
25575
|
-
"packages/experience-design-system-types/dist/src/property-contract/discriminated-union.js"() {
|
|
25576
|
-
"use strict";
|
|
25577
|
-
init_json_value();
|
|
25578
|
-
}
|
|
25579
|
-
});
|
|
25580
|
-
|
|
25581
|
-
// packages/experience-design-system-types/dist/src/property-contract/target-definition.js
|
|
25582
|
-
var TARGET_PROPERTY_TYPES, SAME_SPACE_RESOURCE_SOURCE, targetDefinitionJsonSchema;
|
|
25583
|
-
var init_target_definition = __esm({
|
|
25584
|
-
"packages/experience-design-system-types/dist/src/property-contract/target-definition.js"() {
|
|
25585
|
-
"use strict";
|
|
25586
|
-
init_json_value();
|
|
25587
|
-
init_date_time_value();
|
|
25588
|
-
init_discriminated_union();
|
|
25589
|
-
TARGET_PROPERTY_TYPES = [
|
|
25590
|
-
"String",
|
|
25591
|
-
"Number",
|
|
25592
|
-
"Boolean",
|
|
25593
|
-
"Array",
|
|
25594
|
-
"Record",
|
|
25595
|
-
"Integer",
|
|
25596
|
-
"DateTime",
|
|
25597
|
-
"RichText",
|
|
25598
|
-
"JSON",
|
|
25599
|
-
"ResourceLink",
|
|
25600
|
-
"Literal",
|
|
25601
|
-
"DiscriminatedUnion"
|
|
25602
|
-
];
|
|
25603
|
-
SAME_SPACE_RESOURCE_SOURCE = "crn:contentful:::content:spaces/$self/environments/$self";
|
|
25604
|
-
targetDefinitionJsonSchema = {
|
|
25605
|
-
$schema: "http://json-schema.org/draft-07/schema#",
|
|
25606
|
-
$ref: "#/definitions/target",
|
|
25607
|
-
definitions: {
|
|
25608
|
-
target: {
|
|
25609
|
-
type: "object",
|
|
25610
|
-
required: ["type"],
|
|
25611
|
-
properties: {
|
|
25612
|
-
type: { enum: [...TARGET_PROPERTY_TYPES] },
|
|
25613
|
-
id: { type: "string" },
|
|
25614
|
-
name: { type: "string" },
|
|
25615
|
-
description: { type: "string" },
|
|
25616
|
-
required: { type: "boolean" },
|
|
25617
|
-
values: { type: "array", minItems: 1 },
|
|
25618
|
-
defaultValue: {},
|
|
25619
|
-
items: { $ref: "#/definitions/target" },
|
|
25620
|
-
fields: { type: "object", minProperties: 1, additionalProperties: { $ref: "#/definitions/target" } },
|
|
25621
|
-
allowedResources: {
|
|
25622
|
-
type: "array",
|
|
25623
|
-
minItems: 1,
|
|
25624
|
-
items: {
|
|
25625
|
-
type: "object",
|
|
25626
|
-
required: ["type", "source"],
|
|
25627
|
-
properties: {
|
|
25628
|
-
type: { enum: ["Contentful:Entry", "Contentful:Asset"] },
|
|
25629
|
-
source: { const: SAME_SPACE_RESOURCE_SOURCE },
|
|
25630
|
-
allowedTypes: { type: "array", items: { type: "string" } }
|
|
25631
|
-
},
|
|
25632
|
-
allOf: [
|
|
25633
|
-
{
|
|
25634
|
-
if: { properties: { type: { const: "Contentful:Entry" } } },
|
|
25635
|
-
then: { required: ["allowedTypes"] },
|
|
25636
|
-
else: { not: { required: ["allowedTypes"] } }
|
|
25637
|
-
}
|
|
25638
|
-
],
|
|
25639
|
-
additionalProperties: false
|
|
25640
|
-
}
|
|
25641
|
-
},
|
|
25642
|
-
value: {},
|
|
25643
|
-
valueType: { $ref: "#/definitions/target" },
|
|
25644
|
-
discriminator: { type: "string", minLength: 1 },
|
|
25645
|
-
members: {
|
|
25646
|
-
type: "array",
|
|
25647
|
-
minItems: 2,
|
|
25648
|
-
uniqueItems: true,
|
|
25649
|
-
items: {
|
|
25650
|
-
allOf: [
|
|
25651
|
-
{ $ref: "#/definitions/target" },
|
|
25652
|
-
{ type: "object", properties: { type: { const: "Record" } }, required: ["type", "fields"] }
|
|
25653
|
-
]
|
|
25654
|
-
}
|
|
25655
|
-
}
|
|
25656
|
-
},
|
|
25657
|
-
allOf: [
|
|
25658
|
-
{
|
|
25659
|
-
if: { properties: { type: { const: "DiscriminatedUnion" } } },
|
|
25660
|
-
then: { required: ["discriminator", "members"] },
|
|
25661
|
-
else: { not: { anyOf: [{ required: ["discriminator"] }, { required: ["members"] }] } }
|
|
25662
|
-
}
|
|
25663
|
-
],
|
|
25664
|
-
additionalProperties: false
|
|
25665
|
-
}
|
|
25666
|
-
}
|
|
25667
|
-
};
|
|
25668
|
-
}
|
|
25669
|
-
});
|
|
25670
|
-
|
|
25671
|
-
// packages/experience-design-system-types/dist/src/property-contract/index.js
|
|
25672
|
-
var init_property_contract = __esm({
|
|
25673
|
-
"packages/experience-design-system-types/dist/src/property-contract/index.js"() {
|
|
25674
|
-
"use strict";
|
|
25675
|
-
init_json_value();
|
|
25676
|
-
init_date_time_value();
|
|
25677
|
-
init_discriminated_union();
|
|
25678
|
-
init_target_definition();
|
|
25679
|
-
}
|
|
25680
|
-
});
|
|
25681
|
-
|
|
25682
25572
|
// packages/experience-design-system-types/dist/src/index.js
|
|
25683
25573
|
var init_src4 = __esm({
|
|
25684
25574
|
"packages/experience-design-system-types/dist/src/index.js"() {
|
|
25685
25575
|
"use strict";
|
|
25576
|
+
init_source_input_association();
|
|
25686
25577
|
init_cdf2();
|
|
25687
25578
|
init_dtcg2();
|
|
25688
|
-
init_property_contract();
|
|
25689
25579
|
}
|
|
25690
25580
|
});
|
|
25691
25581
|
|
|
@@ -25694,7 +25584,7 @@ function failedComponentNames(errors) {
|
|
|
25694
25584
|
return [...new Set(errors.map((error) => error.componentName))];
|
|
25695
25585
|
}
|
|
25696
25586
|
function matchedComponentNames(errors, missingNames) {
|
|
25697
|
-
return failedComponentNames(errors).filter((
|
|
25587
|
+
return failedComponentNames(errors).filter((name2) => !missingNames.includes(name2));
|
|
25698
25588
|
}
|
|
25699
25589
|
function formatErrorLine(error) {
|
|
25700
25590
|
const context = [`Component: ${error.componentName}`, error.path ? `Path: ${error.path}` : null].filter(Boolean);
|
|
@@ -25825,14 +25715,14 @@ function computeRenderStatuses(closure, directIssues) {
|
|
|
25825
25715
|
for (const node of closure.nodes) {
|
|
25826
25716
|
nodesByName.set(node.name, { name: node.name, path: node.path });
|
|
25827
25717
|
}
|
|
25828
|
-
const
|
|
25718
|
+
const own = /* @__PURE__ */ new Map();
|
|
25829
25719
|
for (const node of closure.nodes) {
|
|
25830
25720
|
const s = directIssues.get(node.name);
|
|
25831
|
-
if (s && s !== "ok")
|
|
25721
|
+
if (s && s !== "ok") own.set(node.name, s);
|
|
25832
25722
|
}
|
|
25833
25723
|
const inheritedSources = /* @__PURE__ */ new Map();
|
|
25834
25724
|
for (const node of closure.nodes) {
|
|
25835
|
-
const ownStatus =
|
|
25725
|
+
const ownStatus = own.get(node.name);
|
|
25836
25726
|
if (!ownStatus) continue;
|
|
25837
25727
|
for (let i = 0; i < node.path.length - 1; i++) {
|
|
25838
25728
|
const ancestor = node.path[i];
|
|
@@ -25840,11 +25730,11 @@ function computeRenderStatuses(closure, directIssues) {
|
|
|
25840
25730
|
inheritedSources.get(ancestor).set(node.name, ownStatus);
|
|
25841
25731
|
}
|
|
25842
25732
|
}
|
|
25843
|
-
for (const [
|
|
25844
|
-
out.set(
|
|
25733
|
+
for (const [name2, status] of own.entries()) {
|
|
25734
|
+
out.set(name2, {
|
|
25845
25735
|
status,
|
|
25846
25736
|
isOwn: true,
|
|
25847
|
-
sourceComponents: [
|
|
25737
|
+
sourceComponents: [name2]
|
|
25848
25738
|
});
|
|
25849
25739
|
}
|
|
25850
25740
|
for (const [ancestor, sources] of inheritedSources.entries()) {
|
|
@@ -26162,7 +26052,7 @@ function parseToState(json) {
|
|
|
26162
26052
|
}
|
|
26163
26053
|
const componentDescription = typeof component.$description === "string" ? component.$description : "";
|
|
26164
26054
|
const rawProps = component.$properties ?? {};
|
|
26165
|
-
const props = Object.entries(rawProps).map(([
|
|
26055
|
+
const props = Object.entries(rawProps).map(([name2, raw]) => {
|
|
26166
26056
|
const p = raw ?? {};
|
|
26167
26057
|
const type = CDF_PROPERTY_TYPES2.includes(p.$type) ? p.$type : "string";
|
|
26168
26058
|
let defaultValue = null;
|
|
@@ -26174,7 +26064,7 @@ function parseToState(json) {
|
|
|
26174
26064
|
}
|
|
26175
26065
|
}
|
|
26176
26066
|
return {
|
|
26177
|
-
name,
|
|
26067
|
+
name: name2,
|
|
26178
26068
|
type,
|
|
26179
26069
|
category: CDF_PROPERTY_CATEGORIES2.includes(p.$category) ? p.$category : "content",
|
|
26180
26070
|
required: p.$required === true,
|
|
@@ -26186,10 +26076,10 @@ function parseToState(json) {
|
|
|
26186
26076
|
};
|
|
26187
26077
|
});
|
|
26188
26078
|
const rawSlots = component.$slots ?? {};
|
|
26189
|
-
const slots = Object.entries(rawSlots).map(([
|
|
26079
|
+
const slots = Object.entries(rawSlots).map(([name2, raw]) => {
|
|
26190
26080
|
const s = raw ?? {};
|
|
26191
26081
|
return {
|
|
26192
|
-
name,
|
|
26082
|
+
name: name2,
|
|
26193
26083
|
description: typeof s.$description === "string" ? s.$description : "",
|
|
26194
26084
|
required: s.$required === true,
|
|
26195
26085
|
allowedComponents: Array.isArray(s.$allowedComponents) ? s.$allowedComponents.filter((v) => typeof v === "string") : []
|
|
@@ -26297,7 +26187,7 @@ function DefaultValueRow({
|
|
|
26297
26187
|
] });
|
|
26298
26188
|
}
|
|
26299
26189
|
function RowLabel({
|
|
26300
|
-
name,
|
|
26190
|
+
name: name2,
|
|
26301
26191
|
selected,
|
|
26302
26192
|
trailing = true
|
|
26303
26193
|
}) {
|
|
@@ -26310,7 +26200,7 @@ function RowLabel({
|
|
|
26310
26200
|
wrap: "truncate-end",
|
|
26311
26201
|
children: [
|
|
26312
26202
|
" ",
|
|
26313
|
-
|
|
26203
|
+
name2,
|
|
26314
26204
|
trailing ? " " : ""
|
|
26315
26205
|
]
|
|
26316
26206
|
}
|
|
@@ -26662,10 +26552,10 @@ function SlotRow({
|
|
|
26662
26552
|
const slice = filtered.slice(start, start + MAX_VISIBLE);
|
|
26663
26553
|
return /* @__PURE__ */ jsxs26(Box26, { flexDirection: "column", children: [
|
|
26664
26554
|
/* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: " candidates (\u2191\u2193 cycle, Enter to add):" }),
|
|
26665
|
-
slice.map((
|
|
26555
|
+
slice.map((name2, i) => {
|
|
26666
26556
|
const absIdx = start + i;
|
|
26667
26557
|
const isCursor = absIdx === cursor;
|
|
26668
|
-
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${
|
|
26558
|
+
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${name2}` : ` ${name2}` }, name2);
|
|
26669
26559
|
})
|
|
26670
26560
|
] });
|
|
26671
26561
|
})() })
|
|
@@ -27561,8 +27451,8 @@ function FieldEditor({
|
|
|
27561
27451
|
const hasEmptyProperties = props.length === 0 && slots.length === 0;
|
|
27562
27452
|
const modeLabel = (() => {
|
|
27563
27453
|
if (pendingDelete) {
|
|
27564
|
-
const
|
|
27565
|
-
return `Delete ${pendingDelete.kind} "${
|
|
27454
|
+
const name2 = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
|
|
27455
|
+
return `Delete ${pendingDelete.kind} "${name2}"? [y] delete \xB7 any other key cancels`;
|
|
27566
27456
|
}
|
|
27567
27457
|
if (editingValue) {
|
|
27568
27458
|
return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
|
|
@@ -28787,7 +28677,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
28787
28677
|
);
|
|
28788
28678
|
db.exec("BEGIN");
|
|
28789
28679
|
try {
|
|
28790
|
-
for (const
|
|
28680
|
+
for (const name2 of toReject) statement.run(extractSessionId, name2);
|
|
28791
28681
|
db.exec("COMMIT");
|
|
28792
28682
|
} catch (error) {
|
|
28793
28683
|
db.exec("ROLLBACK");
|
|
@@ -29771,13 +29661,13 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
29771
29661
|
const unchanged = new Set(preview.components.unchanged);
|
|
29772
29662
|
const changedNames = /* @__PURE__ */ new Set();
|
|
29773
29663
|
for (const item of preview.components.changed) {
|
|
29774
|
-
const
|
|
29775
|
-
if (typeof
|
|
29776
|
-
changedNames.add(
|
|
29664
|
+
const name2 = item.current?.name;
|
|
29665
|
+
if (typeof name2 !== "string") continue;
|
|
29666
|
+
changedNames.add(name2);
|
|
29777
29667
|
if (item.changeClassification?.classification === "breaking") {
|
|
29778
|
-
out.set(
|
|
29668
|
+
out.set(name2, "breaking");
|
|
29779
29669
|
} else {
|
|
29780
|
-
out.set(
|
|
29670
|
+
out.set(name2, "changed");
|
|
29781
29671
|
}
|
|
29782
29672
|
}
|
|
29783
29673
|
const removedNames = /* @__PURE__ */ new Set();
|
|
@@ -29787,12 +29677,12 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
29787
29677
|
out.set(entity.name, "removed");
|
|
29788
29678
|
}
|
|
29789
29679
|
}
|
|
29790
|
-
for (const
|
|
29791
|
-
if (unchanged.has(
|
|
29792
|
-
if (changedNames.has(
|
|
29793
|
-
if (removedNames.has(
|
|
29794
|
-
if (out.has(
|
|
29795
|
-
out.set(
|
|
29680
|
+
for (const name2 of localNames) {
|
|
29681
|
+
if (unchanged.has(name2)) continue;
|
|
29682
|
+
if (changedNames.has(name2)) continue;
|
|
29683
|
+
if (removedNames.has(name2)) continue;
|
|
29684
|
+
if (out.has(name2)) continue;
|
|
29685
|
+
out.set(name2, "new");
|
|
29796
29686
|
}
|
|
29797
29687
|
return out;
|
|
29798
29688
|
}
|
|
@@ -30517,10 +30407,10 @@ function GenerateReviewStepView({
|
|
|
30517
30407
|
const merged = /* @__PURE__ */ new Map();
|
|
30518
30408
|
for (const closure of closures.values()) {
|
|
30519
30409
|
const per = computeRenderStatuses(closure, directIssues);
|
|
30520
|
-
for (const [
|
|
30521
|
-
const existing = merged.get(
|
|
30410
|
+
for (const [name2, rs] of per.entries()) {
|
|
30411
|
+
const existing = merged.get(name2);
|
|
30522
30412
|
if (!existing || !existing.isOwn && rs.isOwn) {
|
|
30523
|
-
merged.set(
|
|
30413
|
+
merged.set(name2, rs);
|
|
30524
30414
|
}
|
|
30525
30415
|
}
|
|
30526
30416
|
}
|
|
@@ -30575,11 +30465,11 @@ function GenerateReviewStepView({
|
|
|
30575
30465
|
reviewEditor.setSaveError(null);
|
|
30576
30466
|
setPendingEditorFocus(null);
|
|
30577
30467
|
};
|
|
30578
|
-
const jumpCursorToName = (
|
|
30468
|
+
const jumpCursorToName = (name2) => {
|
|
30579
30469
|
for (let i = 0; i < visibleRowsMemo.length; i++) {
|
|
30580
30470
|
const row = visibleRowsMemo[i];
|
|
30581
30471
|
if (row.itemIdx < 0) continue;
|
|
30582
|
-
if (components[row.itemIdx]?.key ===
|
|
30472
|
+
if (components[row.itemIdx]?.key === name2) {
|
|
30583
30473
|
jumpCursorToRow(i);
|
|
30584
30474
|
return;
|
|
30585
30475
|
}
|
|
@@ -31107,8 +30997,8 @@ function GenerateReviewStepView({
|
|
|
31107
30997
|
}
|
|
31108
30998
|
),
|
|
31109
30999
|
!dialogOpen && autoRejected.length > 0 && (() => {
|
|
31110
|
-
const stillRejected = autoRejected.filter((
|
|
31111
|
-
const c2 = components.find((x) => x.key ===
|
|
31000
|
+
const stillRejected = autoRejected.filter((name2) => {
|
|
31001
|
+
const c2 = components.find((x) => x.key === name2);
|
|
31112
31002
|
return c2?.status === "rejected";
|
|
31113
31003
|
});
|
|
31114
31004
|
if (stillRejected.length === 0) return null;
|
|
@@ -31790,31 +31680,31 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
31790
31680
|
const proposedProperties = proposed["$properties"] ?? {};
|
|
31791
31681
|
const proposedProps = new Set(Object.keys(proposedProperties));
|
|
31792
31682
|
const oldProps = current.fullProperties;
|
|
31793
|
-
for (const
|
|
31794
|
-
if (!currentProps.has(
|
|
31795
|
-
const def = proposedProperties[
|
|
31796
|
-
lines.push({ key: `${
|
|
31683
|
+
for (const name2 of [...proposedProps].sort()) {
|
|
31684
|
+
if (!currentProps.has(name2)) {
|
|
31685
|
+
const def = proposedProperties[name2];
|
|
31686
|
+
lines.push({ key: `${name2}-add`, color: PALETTE.success, text: `+ ${name2}: ${formatPropDef(def)}` });
|
|
31797
31687
|
}
|
|
31798
31688
|
}
|
|
31799
|
-
for (const
|
|
31800
|
-
if (!proposedProps.has(
|
|
31801
|
-
if (oldProps?.[
|
|
31802
|
-
lines.push({ key: `${
|
|
31689
|
+
for (const name2 of [...currentProps].sort()) {
|
|
31690
|
+
if (!proposedProps.has(name2)) {
|
|
31691
|
+
if (oldProps?.[name2]) {
|
|
31692
|
+
lines.push({ key: `${name2}-rm`, color: PALETTE.error, text: `- ${name2}: ${formatOldProp(oldProps[name2])}` });
|
|
31803
31693
|
} else {
|
|
31804
|
-
const cat = current.contentProperties.includes(
|
|
31805
|
-
lines.push({ key: `${
|
|
31694
|
+
const cat = current.contentProperties.includes(name2) ? "content" : "design";
|
|
31695
|
+
lines.push({ key: `${name2}-rm`, color: PALETTE.error, text: `- ${name2} (${cat})` });
|
|
31806
31696
|
}
|
|
31807
31697
|
}
|
|
31808
31698
|
}
|
|
31809
31699
|
const handledProps = /* @__PURE__ */ new Set();
|
|
31810
|
-
for (const
|
|
31811
|
-
if (!proposedProps.has(
|
|
31812
|
-
const newDef = proposedProperties[
|
|
31813
|
-
const oldDef = oldProps?.[
|
|
31700
|
+
for (const name2 of [...currentProps].sort()) {
|
|
31701
|
+
if (!proposedProps.has(name2)) continue;
|
|
31702
|
+
const newDef = proposedProperties[name2];
|
|
31703
|
+
const oldDef = oldProps?.[name2];
|
|
31814
31704
|
if (!oldDef) continue;
|
|
31815
|
-
const diffs = diffProperty(
|
|
31705
|
+
const diffs = diffProperty(name2, oldDef, newDef);
|
|
31816
31706
|
if (diffs.length > 0) {
|
|
31817
|
-
handledProps.add(
|
|
31707
|
+
handledProps.add(name2);
|
|
31818
31708
|
for (const d of diffs) lines.push(d);
|
|
31819
31709
|
}
|
|
31820
31710
|
}
|
|
@@ -31837,40 +31727,40 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
31837
31727
|
const proposedSlots = proposed["$slots"] ?? {};
|
|
31838
31728
|
const proposedSlotNames = new Set(Object.keys(proposedSlots));
|
|
31839
31729
|
const currentSlotAllowed = current.currentSlotAllowed ?? {};
|
|
31840
|
-
for (const
|
|
31841
|
-
if (!currentSlots.has(
|
|
31842
|
-
lines.push({ key: `slot-${
|
|
31730
|
+
for (const name2 of [...proposedSlotNames].sort()) {
|
|
31731
|
+
if (!currentSlots.has(name2)) {
|
|
31732
|
+
lines.push({ key: `slot-${name2}-add`, color: PALETTE.success, text: `+ slot: ${name2}` });
|
|
31843
31733
|
}
|
|
31844
31734
|
}
|
|
31845
|
-
for (const
|
|
31846
|
-
if (!proposedSlotNames.has(
|
|
31847
|
-
lines.push({ key: `slot-${
|
|
31735
|
+
for (const name2 of [...currentSlots].sort()) {
|
|
31736
|
+
if (!proposedSlotNames.has(name2)) {
|
|
31737
|
+
lines.push({ key: `slot-${name2}-rm`, color: PALETTE.error, text: `- slot: ${name2}` });
|
|
31848
31738
|
}
|
|
31849
31739
|
}
|
|
31850
|
-
for (const
|
|
31851
|
-
const nextAllowed = normalizeAllowedComponents(proposedSlots[
|
|
31852
|
-
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[
|
|
31853
|
-
const prevExists = currentSlots.has(
|
|
31740
|
+
for (const name2 of [...proposedSlotNames].sort()) {
|
|
31741
|
+
const nextAllowed = normalizeAllowedComponents(proposedSlots[name2]?.["$allowedComponents"]);
|
|
31742
|
+
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[name2]);
|
|
31743
|
+
const prevExists = currentSlots.has(name2);
|
|
31854
31744
|
if (!prevExists) {
|
|
31855
31745
|
if (nextAllowed.length > 0) {
|
|
31856
31746
|
lines.push({
|
|
31857
|
-
key: `slot-${
|
|
31747
|
+
key: `slot-${name2}-allow-new`,
|
|
31858
31748
|
color: PALETTE.success,
|
|
31859
|
-
text: `+ slot ${
|
|
31749
|
+
text: `+ slot ${name2} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
31860
31750
|
});
|
|
31861
31751
|
}
|
|
31862
31752
|
continue;
|
|
31863
31753
|
}
|
|
31864
31754
|
if (arraysEqual(prevAllowed, nextAllowed)) continue;
|
|
31865
31755
|
lines.push({
|
|
31866
|
-
key: `slot-${
|
|
31756
|
+
key: `slot-${name2}-allow-old`,
|
|
31867
31757
|
color: PALETTE.error,
|
|
31868
|
-
text: `- slot ${
|
|
31758
|
+
text: `- slot ${name2} allowedComponents: [${prevAllowed.join(", ")}]`
|
|
31869
31759
|
});
|
|
31870
31760
|
lines.push({
|
|
31871
|
-
key: `slot-${
|
|
31761
|
+
key: `slot-${name2}-allow-new`,
|
|
31872
31762
|
color: PALETTE.success,
|
|
31873
|
-
text: `+ slot ${
|
|
31763
|
+
text: `+ slot ${name2} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
31874
31764
|
});
|
|
31875
31765
|
}
|
|
31876
31766
|
return lines;
|
|
@@ -31906,7 +31796,7 @@ function normalizeType(type) {
|
|
|
31906
31796
|
return type.toLowerCase();
|
|
31907
31797
|
}
|
|
31908
31798
|
}
|
|
31909
|
-
function diffProperty(
|
|
31799
|
+
function diffProperty(name2, old, newDef) {
|
|
31910
31800
|
const diffs = [];
|
|
31911
31801
|
const newType = newDef["$type"] ?? "";
|
|
31912
31802
|
const newCategory = newDef["$category"] ?? "";
|
|
@@ -31917,15 +31807,15 @@ function diffProperty(name, old, newDef) {
|
|
|
31917
31807
|
const requiredChanged = old.required !== newRequired;
|
|
31918
31808
|
const defaultChanged = JSON.stringify(old.default) !== JSON.stringify(newDefault);
|
|
31919
31809
|
if (!typeChanged && !categoryChanged && !requiredChanged && !defaultChanged) return [];
|
|
31920
|
-
diffs.push({ key: `${
|
|
31921
|
-
diffs.push({ key: `${
|
|
31810
|
+
diffs.push({ key: `${name2}-old`, color: PALETTE.error, text: `- ${name2}: ${formatOldProp(old)}` });
|
|
31811
|
+
diffs.push({ key: `${name2}-new`, color: PALETTE.success, text: `+ ${name2}: ${formatPropDef(newDef)}` });
|
|
31922
31812
|
return diffs;
|
|
31923
31813
|
}
|
|
31924
31814
|
function formatDefault(value) {
|
|
31925
31815
|
const sys = value?.sys;
|
|
31926
31816
|
if (sys?.linkType === "Contentful:DesignToken" && typeof sys.urn === "string") {
|
|
31927
|
-
const
|
|
31928
|
-
if (
|
|
31817
|
+
const name2 = sys.urn.split("/designTokens/")[1];
|
|
31818
|
+
if (name2) return name2;
|
|
31929
31819
|
}
|
|
31930
31820
|
return JSON.stringify(value);
|
|
31931
31821
|
}
|
|
@@ -31991,8 +31881,8 @@ function buildPreviewSummaryLines(preview) {
|
|
|
31991
31881
|
text: ` \uFF0B ${components.new.length} components will be created`
|
|
31992
31882
|
});
|
|
31993
31883
|
for (const [index, item] of components.new.entries()) {
|
|
31994
|
-
const
|
|
31995
|
-
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${
|
|
31884
|
+
const name2 = item.key ?? item.$name ?? "unknown";
|
|
31885
|
+
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${name2}` });
|
|
31996
31886
|
}
|
|
31997
31887
|
}
|
|
31998
31888
|
if (components.changed.length > 0) {
|
|
@@ -32085,27 +31975,27 @@ function getPreviewScrollOffset(input, downArrow, upArrow, diffExpanded, current
|
|
|
32085
31975
|
}
|
|
32086
31976
|
return void 0;
|
|
32087
31977
|
}
|
|
32088
|
-
function appendChangedPreviewLine(lines, keyPrefix,
|
|
31978
|
+
function appendChangedPreviewLine(lines, keyPrefix, name2, hasPendingDraftChanges, changeClassification) {
|
|
32089
31979
|
lines.push({
|
|
32090
|
-
key: `${keyPrefix}-h-${
|
|
31980
|
+
key: `${keyPrefix}-h-${name2}`,
|
|
32091
31981
|
color: PALETTE.warning,
|
|
32092
|
-
text: ` ~ ${
|
|
31982
|
+
text: ` ~ ${name2}${hasPendingDraftChanges ? " \u26A1 has pending draft changes" : ""}`
|
|
32093
31983
|
});
|
|
32094
31984
|
if (changeClassification?.classification !== "breaking") return;
|
|
32095
31985
|
const reasons = changeClassification.breakingChanges.map((bc) => `${"slotId" in bc ? bc.slotId : bc.propertyId}: ${bc.reason}`).join(", ");
|
|
32096
|
-
lines.push({ key: `${keyPrefix}-b-${
|
|
31986
|
+
lines.push({ key: `${keyPrefix}-b-${name2}`, color: PALETTE.error, text: ` \u26A0 BREAKING: ${reasons}` });
|
|
32097
31987
|
}
|
|
32098
31988
|
function buildPreviewDiffLines(preview) {
|
|
32099
31989
|
const lines = [];
|
|
32100
31990
|
const { components, tokens } = preview;
|
|
32101
31991
|
for (const item of components.new) {
|
|
32102
31992
|
const raw = item;
|
|
32103
|
-
const
|
|
32104
|
-
lines.push({ key: `comp-new-${
|
|
31993
|
+
const name2 = raw.key ?? raw.$name ?? "unknown";
|
|
31994
|
+
lines.push({ key: `comp-new-${name2}`, color: PALETTE.success, text: ` + ${name2}` });
|
|
32105
31995
|
const slots = raw.$slots ?? {};
|
|
32106
31996
|
for (const slotName of Object.keys(slots).sort()) {
|
|
32107
31997
|
lines.push({
|
|
32108
|
-
key: `comp-new-${
|
|
31998
|
+
key: `comp-new-${name2}-slot-${slotName}`,
|
|
32109
31999
|
color: PALETTE.success,
|
|
32110
32000
|
text: ` slot: ${slotName}`
|
|
32111
32001
|
});
|
|
@@ -32113,7 +32003,7 @@ function buildPreviewDiffLines(preview) {
|
|
|
32113
32003
|
if (Array.isArray(allowed) && allowed.length > 0) {
|
|
32114
32004
|
const names = allowed.filter((n) => typeof n === "string");
|
|
32115
32005
|
lines.push({
|
|
32116
|
-
key: `comp-new-${
|
|
32006
|
+
key: `comp-new-${name2}-slot-${slotName}-allow`,
|
|
32117
32007
|
color: PALETTE.success,
|
|
32118
32008
|
text: ` allowedComponents: [${names.join(", ")}]`
|
|
32119
32009
|
});
|
|
@@ -32151,8 +32041,8 @@ function buildPreviewDiffLines(preview) {
|
|
|
32151
32041
|
}
|
|
32152
32042
|
for (const item of tokens.new) {
|
|
32153
32043
|
const raw = item;
|
|
32154
|
-
const
|
|
32155
|
-
lines.push({ key: `tok-new-${
|
|
32044
|
+
const name2 = raw.name ?? raw.path ?? "unknown";
|
|
32045
|
+
lines.push({ key: `tok-new-${name2}`, color: PALETTE.success, text: ` + ${name2}` });
|
|
32156
32046
|
}
|
|
32157
32047
|
for (const item of tokens.removed) {
|
|
32158
32048
|
lines.push({ key: `tok-rm-${item.name}`, color: PALETTE.error, text: ` - ${item.name}` });
|
|
@@ -33460,7 +33350,7 @@ var init_PageContainer3 = __esm({
|
|
|
33460
33350
|
import { existsSync as existsSync11 } from "node:fs";
|
|
33461
33351
|
function diffSnapshots(before, after) {
|
|
33462
33352
|
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
|
|
33463
|
-
const changed_fields = names.filter((
|
|
33353
|
+
const changed_fields = names.filter((name2) => before[name2] !== after[name2]);
|
|
33464
33354
|
return { changed: changed_fields.length > 0, changed_fields };
|
|
33465
33355
|
}
|
|
33466
33356
|
function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
|
|
@@ -33498,11 +33388,11 @@ var init_debug_trail = __esm({
|
|
|
33498
33388
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
|
|
33499
33389
|
import { execFile as execFile2 } from "node:child_process";
|
|
33500
33390
|
import { access as access5, constants } from "node:fs/promises";
|
|
33501
|
-
function effectiveBinary(
|
|
33502
|
-
return savedBinary.trim() || AGENT_BINARIES[
|
|
33391
|
+
function effectiveBinary(name2, savedBinary) {
|
|
33392
|
+
return savedBinary.trim() || AGENT_BINARIES[name2];
|
|
33503
33393
|
}
|
|
33504
|
-
function defaultModelLabel(
|
|
33505
|
-
const model = DEFAULT_MODELS[
|
|
33394
|
+
function defaultModelLabel(name2) {
|
|
33395
|
+
const model = DEFAULT_MODELS[name2];
|
|
33506
33396
|
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
33507
33397
|
}
|
|
33508
33398
|
function resolveOnPath(binary) {
|
|
@@ -33529,32 +33419,32 @@ function readVersion(binary) {
|
|
|
33529
33419
|
});
|
|
33530
33420
|
});
|
|
33531
33421
|
}
|
|
33532
|
-
async function inspect(
|
|
33533
|
-
const target = effectiveBinary(
|
|
33422
|
+
async function inspect(name2, binary) {
|
|
33423
|
+
const target = effectiveBinary(name2, binary);
|
|
33534
33424
|
const found = await resolveOnPath(target);
|
|
33535
33425
|
if (!found) return { checks: [fail3("path", `\`${target}\` was not found or is not executable`)], found: null };
|
|
33536
33426
|
const checks = [pass("path", found)];
|
|
33537
33427
|
checks.push(await readVersion(found));
|
|
33538
|
-
if (
|
|
33539
|
-
const auth = await withBinaryEnv(
|
|
33428
|
+
if (name2 === "claude") {
|
|
33429
|
+
const auth = await withBinaryEnv(name2, found, () => checkAgentAuth(name2));
|
|
33540
33430
|
checks.push(
|
|
33541
33431
|
auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
33542
33432
|
);
|
|
33543
33433
|
}
|
|
33544
33434
|
return { checks, found };
|
|
33545
33435
|
}
|
|
33546
|
-
async function inspectAgent(
|
|
33547
|
-
return (await inspect(
|
|
33436
|
+
async function inspectAgent(name2, binary) {
|
|
33437
|
+
return (await inspect(name2, binary)).checks;
|
|
33548
33438
|
}
|
|
33549
|
-
async function testAgent(
|
|
33550
|
-
const { checks, found } = await inspect(
|
|
33439
|
+
async function testAgent(name2, binary, model) {
|
|
33440
|
+
const { checks, found } = await inspect(name2, binary);
|
|
33551
33441
|
if (!found || !checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
33552
33442
|
const started = Date.now();
|
|
33553
33443
|
const result = await withBinaryEnv(
|
|
33554
|
-
|
|
33444
|
+
name2,
|
|
33555
33445
|
found,
|
|
33556
33446
|
() => createLocalCliAgentInvoker().invoke({
|
|
33557
|
-
agent:
|
|
33447
|
+
agent: name2,
|
|
33558
33448
|
...model.trim() ? { model: model.trim() } : {},
|
|
33559
33449
|
prompt: TEST_PROMPT,
|
|
33560
33450
|
timeoutMs: PROMPT_TIMEOUT_MS
|
|
@@ -33570,7 +33460,7 @@ async function testAgent(name, binary, model) {
|
|
|
33570
33460
|
}
|
|
33571
33461
|
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
33572
33462
|
}
|
|
33573
|
-
function statusFromChecks(
|
|
33463
|
+
function statusFromChecks(name2, checks, savedBinary) {
|
|
33574
33464
|
if (checks.length === 0) return "checking";
|
|
33575
33465
|
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
33576
33466
|
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
@@ -33582,13 +33472,13 @@ function statusFromChecks(name, checks, savedBinary) {
|
|
|
33582
33472
|
}
|
|
33583
33473
|
const login = checks.find((check) => check.step === "login");
|
|
33584
33474
|
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
33585
|
-
return
|
|
33475
|
+
return name2 === "claude" ? "ready" : "unknown";
|
|
33586
33476
|
}
|
|
33587
|
-
function setupHint(
|
|
33588
|
-
if (status === "not-configured") return `${INSTALL_HINTS[
|
|
33589
|
-
if (status === "not-found") return `${INSTALL_HINTS[
|
|
33590
|
-
if (status === "not-logged-in") return LOGIN_HINTS[
|
|
33591
|
-
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[
|
|
33477
|
+
function setupHint(name2, status) {
|
|
33478
|
+
if (status === "not-configured") return `${INSTALL_HINTS[name2]}, or set its command path in settings`;
|
|
33479
|
+
if (status === "not-found") return `${INSTALL_HINTS[name2]}, or correct the command path in settings`;
|
|
33480
|
+
if (status === "not-logged-in") return LOGIN_HINTS[name2];
|
|
33481
|
+
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name2]}`;
|
|
33592
33482
|
if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
|
|
33593
33483
|
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
33594
33484
|
return "";
|
|
@@ -33600,14 +33490,14 @@ function testOutcome(checks) {
|
|
|
33600
33490
|
if (prompt.timedOut) return { ok: false, text: `Test timed out: ${prompt.detail}` };
|
|
33601
33491
|
return { ok: false, text: `Test failed: ${prompt.detail}` };
|
|
33602
33492
|
}
|
|
33603
|
-
function modelLine(
|
|
33493
|
+
function modelLine(name2, savedModel) {
|
|
33604
33494
|
const model = savedModel.trim();
|
|
33605
|
-
return model ? model : `${defaultModelLabel(
|
|
33495
|
+
return model ? model : `${defaultModelLabel(name2)} (built-in default)`;
|
|
33606
33496
|
}
|
|
33607
|
-
function baseRows(
|
|
33497
|
+
function baseRows(name2, checks, savedBinary) {
|
|
33608
33498
|
const path5 = checks.find((check) => check.step === "path");
|
|
33609
33499
|
const version2 = checks.find((check) => check.step === "version");
|
|
33610
|
-
const hint = setupHint(
|
|
33500
|
+
const hint = setupHint(name2, statusFromChecks(name2, checks, savedBinary));
|
|
33611
33501
|
const setup = hint ? { label: "Setup", value: hint, tone: "muted" } : void 0;
|
|
33612
33502
|
if (!path5?.ok) {
|
|
33613
33503
|
const saved = savedBinary.trim() !== "";
|
|
@@ -33629,15 +33519,15 @@ function baseRows(name, checks, savedBinary) {
|
|
|
33629
33519
|
found: true
|
|
33630
33520
|
};
|
|
33631
33521
|
}
|
|
33632
|
-
function panelRows(
|
|
33522
|
+
function panelRows(name2, checks, settings) {
|
|
33633
33523
|
if (!checks) return checking;
|
|
33634
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
33635
|
-
const model = { label: "Model", value: modelLine(
|
|
33524
|
+
const { command, version: version2, setup, found } = baseRows(name2, checks, settings.binary);
|
|
33525
|
+
const model = { label: "Model", value: modelLine(name2, settings.model), tone: "muted" };
|
|
33636
33526
|
return [command, ...found ? [...version2?.tone === "ok" ? [version2] : [], model] : [], ...setup ? [setup] : []];
|
|
33637
33527
|
}
|
|
33638
|
-
function statusRows(
|
|
33528
|
+
function statusRows(name2, checks, savedBinary) {
|
|
33639
33529
|
if (!checks) return checking;
|
|
33640
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
33530
|
+
const { command, version: version2, setup, found } = baseRows(name2, checks, savedBinary);
|
|
33641
33531
|
if (!found) return [command];
|
|
33642
33532
|
const login = checks.find((check) => check.step === "login");
|
|
33643
33533
|
const prompt = checks.find((check) => check.step === "prompt");
|
|
@@ -33656,8 +33546,8 @@ function statusRows(name, checks, savedBinary) {
|
|
|
33656
33546
|
const testRow = prompt ? [{ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" }] : [];
|
|
33657
33547
|
return [command, ...version2 ? [version2] : [], loginRow, ...testRow, ...setup ? [setup] : []];
|
|
33658
33548
|
}
|
|
33659
|
-
async function withBinaryEnv(
|
|
33660
|
-
const key = `EDS_AGENT_BINARY_${
|
|
33549
|
+
async function withBinaryEnv(name2, binary, run) {
|
|
33550
|
+
const key = `EDS_AGENT_BINARY_${name2.toUpperCase()}`;
|
|
33661
33551
|
const previous = process.env[key];
|
|
33662
33552
|
process.env[key] = binary;
|
|
33663
33553
|
try {
|
|
@@ -33708,9 +33598,9 @@ var init_agent_status = __esm({
|
|
|
33708
33598
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-debug.ts
|
|
33709
33599
|
function agentSnapshot(config) {
|
|
33710
33600
|
const snapshot = { default_agent: config.defaultAgent };
|
|
33711
|
-
for (const
|
|
33712
|
-
snapshot[`${
|
|
33713
|
-
snapshot[`${
|
|
33601
|
+
for (const name2 of AGENT_NAMES) {
|
|
33602
|
+
snapshot[`${name2}.model`] = config.agents[name2].model;
|
|
33603
|
+
snapshot[`${name2}.binary`] = config.agents[name2].binary;
|
|
33714
33604
|
}
|
|
33715
33605
|
return snapshot;
|
|
33716
33606
|
}
|
|
@@ -33727,10 +33617,10 @@ function environmentFrom(checks, savedBinary, envValue) {
|
|
|
33727
33617
|
}
|
|
33728
33618
|
async function describeAgents(config) {
|
|
33729
33619
|
const entries = await Promise.all(
|
|
33730
|
-
AGENT_NAMES.map(async (
|
|
33731
|
-
const saved = config.agents[
|
|
33732
|
-
const checks = await inspectAgent(
|
|
33733
|
-
return [
|
|
33620
|
+
AGENT_NAMES.map(async (name2) => {
|
|
33621
|
+
const saved = config.agents[name2].binary;
|
|
33622
|
+
const checks = await inspectAgent(name2, saved);
|
|
33623
|
+
return [name2, environmentFrom(checks, saved, process.env[`EDS_AGENT_BINARY_${name2.toUpperCase()}`])];
|
|
33734
33624
|
})
|
|
33735
33625
|
);
|
|
33736
33626
|
return Object.fromEntries(entries);
|
|
@@ -33747,11 +33637,11 @@ var init_agent_debug = __esm({
|
|
|
33747
33637
|
import { Text as Text49 } from "ink";
|
|
33748
33638
|
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
33749
33639
|
function AgentStatusBadge({
|
|
33750
|
-
name,
|
|
33640
|
+
name: name2,
|
|
33751
33641
|
checks,
|
|
33752
33642
|
binary
|
|
33753
33643
|
}) {
|
|
33754
|
-
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(
|
|
33644
|
+
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(name2, checks, binary) : "checking"];
|
|
33755
33645
|
return /* @__PURE__ */ jsx59(Text49, { color: TONE_COLOR[tone], children: `${symbol} ${text}` });
|
|
33756
33646
|
}
|
|
33757
33647
|
var TONE_COLOR;
|
|
@@ -33779,13 +33669,13 @@ function StatusHeading() {
|
|
|
33779
33669
|
] });
|
|
33780
33670
|
}
|
|
33781
33671
|
function AgentDetail({
|
|
33782
|
-
name,
|
|
33672
|
+
name: name2,
|
|
33783
33673
|
config,
|
|
33784
33674
|
setConfig,
|
|
33785
33675
|
onBack,
|
|
33786
33676
|
record: record3
|
|
33787
33677
|
}) {
|
|
33788
|
-
const settings = config.agents[
|
|
33678
|
+
const settings = config.agents[name2];
|
|
33789
33679
|
const [saving, setSaving] = useState33(false);
|
|
33790
33680
|
const [testing, setTesting] = useState33(false);
|
|
33791
33681
|
const [notice, setNotice] = useState33(null);
|
|
@@ -33794,38 +33684,38 @@ function AgentDetail({
|
|
|
33794
33684
|
let active = true;
|
|
33795
33685
|
setChecks(void 0);
|
|
33796
33686
|
const timer = setTimeout(() => {
|
|
33797
|
-
void inspectAgent(
|
|
33687
|
+
void inspectAgent(name2, settings.binary).then((result) => active && setChecks(result));
|
|
33798
33688
|
}, INSPECT_DELAY_MS);
|
|
33799
33689
|
return () => {
|
|
33800
33690
|
active = false;
|
|
33801
33691
|
clearTimeout(timer);
|
|
33802
33692
|
};
|
|
33803
|
-
}, [
|
|
33693
|
+
}, [name2, settings.binary]);
|
|
33804
33694
|
const save = () => {
|
|
33805
33695
|
setSaving(true);
|
|
33806
33696
|
setNotice(null);
|
|
33807
33697
|
writeAgentConfig(config).then(() => {
|
|
33808
33698
|
applyBinaryOverrides(config);
|
|
33809
|
-
record3(`saved ${
|
|
33810
|
-
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[
|
|
33699
|
+
record3(`saved ${name2}`);
|
|
33700
|
+
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name2]} settings are written to config.json` });
|
|
33811
33701
|
}).catch((err) => {
|
|
33812
|
-
record3(`saving ${
|
|
33702
|
+
record3(`saving ${name2} failed`, err);
|
|
33813
33703
|
setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` });
|
|
33814
33704
|
}).finally(() => setSaving(false));
|
|
33815
33705
|
};
|
|
33816
33706
|
const runTest = () => {
|
|
33817
33707
|
setTesting(true);
|
|
33818
33708
|
setNotice(null);
|
|
33819
|
-
testAgent(
|
|
33709
|
+
testAgent(name2, settings.binary, settings.model).then((result) => {
|
|
33820
33710
|
setChecks(result);
|
|
33821
33711
|
const outcome = testOutcome(result);
|
|
33822
33712
|
if (!outcome || !outcome.ok)
|
|
33823
|
-
record3(`test of ${
|
|
33713
|
+
record3(`test of ${name2} failed: ${outcome?.text ?? "the agent could not be started"}`);
|
|
33824
33714
|
setNotice(
|
|
33825
33715
|
outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
|
|
33826
33716
|
);
|
|
33827
33717
|
}).catch((err) => {
|
|
33828
|
-
record3(`test of ${
|
|
33718
|
+
record3(`test of ${name2} could not run`, err);
|
|
33829
33719
|
setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` });
|
|
33830
33720
|
}).finally(() => setTesting(false));
|
|
33831
33721
|
};
|
|
@@ -33836,19 +33726,19 @@ function AgentDetail({
|
|
|
33836
33726
|
hint: "run test",
|
|
33837
33727
|
onRun: runTest
|
|
33838
33728
|
};
|
|
33839
|
-
const formFields = fields(
|
|
33729
|
+
const formFields = fields(name2);
|
|
33840
33730
|
const labelWidth = formLabelWidth([...formFields, action]);
|
|
33841
33731
|
return /* @__PURE__ */ jsx60(
|
|
33842
33732
|
FieldForm,
|
|
33843
33733
|
{
|
|
33844
|
-
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[
|
|
33845
|
-
subtitle: config.defaultAgent ===
|
|
33734
|
+
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[name2]}`,
|
|
33735
|
+
subtitle: config.defaultAgent === name2 ? "This is the default agent." : `Runs the \`${AGENT_BINARIES[name2]}\` command.`,
|
|
33846
33736
|
fields: formFields,
|
|
33847
33737
|
values: { binary: settings.binary, model: settings.model },
|
|
33848
33738
|
onChange: (key, value) => {
|
|
33849
|
-
setConfig({ ...config, agents: { ...config.agents, [
|
|
33739
|
+
setConfig({ ...config, agents: { ...config.agents, [name2]: { ...settings, [key]: value } } });
|
|
33850
33740
|
setNotice(null);
|
|
33851
|
-
record3(`edited ${
|
|
33741
|
+
record3(`edited ${name2}.${key}`);
|
|
33852
33742
|
},
|
|
33853
33743
|
onSave: save,
|
|
33854
33744
|
onQuit: onBack,
|
|
@@ -33857,7 +33747,7 @@ function AgentDetail({
|
|
|
33857
33747
|
busy: saving || testing,
|
|
33858
33748
|
children: /* @__PURE__ */ jsxs48(Box48, { flexDirection: "column", marginTop: 1, children: [
|
|
33859
33749
|
/* @__PURE__ */ jsx60(StatusHeading, {}),
|
|
33860
|
-
statusRows(
|
|
33750
|
+
statusRows(name2, checks, settings.binary).map((row) => /* @__PURE__ */ jsx60(FormReadOnlyRow, { label: row.label, labelWidth, children: /* @__PURE__ */ jsx60(Text50, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label))
|
|
33861
33751
|
] })
|
|
33862
33752
|
}
|
|
33863
33753
|
);
|
|
@@ -33873,9 +33763,9 @@ var init_AgentDetail = __esm({
|
|
|
33873
33763
|
init_agent_status();
|
|
33874
33764
|
init_AgentStatusBadge();
|
|
33875
33765
|
init_apply_binary_overrides();
|
|
33876
|
-
fields = (
|
|
33877
|
-
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[
|
|
33878
|
-
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(
|
|
33766
|
+
fields = (name2) => [
|
|
33767
|
+
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[name2]}\` from the PATH)` },
|
|
33768
|
+
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name2)})` }
|
|
33879
33769
|
];
|
|
33880
33770
|
INSPECT_DELAY_MS = 400;
|
|
33881
33771
|
}
|
|
@@ -33900,9 +33790,9 @@ function AgentsScreen({ onDone }) {
|
|
|
33900
33790
|
error: ""
|
|
33901
33791
|
}).current;
|
|
33902
33792
|
const inspectAll = (loaded) => {
|
|
33903
|
-
for (const
|
|
33904
|
-
void inspectAgent(
|
|
33905
|
-
(result) => setChecks((previous) => ({ ...previous, [
|
|
33793
|
+
for (const name2 of AGENT_NAMES) {
|
|
33794
|
+
void inspectAgent(name2, loaded.agents[name2].binary).then(
|
|
33795
|
+
(result) => setChecks((previous) => ({ ...previous, [name2]: result }))
|
|
33906
33796
|
);
|
|
33907
33797
|
}
|
|
33908
33798
|
};
|
|
@@ -33942,21 +33832,21 @@ function AgentsScreen({ onDone }) {
|
|
|
33942
33832
|
exitMethod: change.changed ? "saved" : "discarded"
|
|
33943
33833
|
});
|
|
33944
33834
|
};
|
|
33945
|
-
const makeDefault = (
|
|
33835
|
+
const makeDefault = (name2) => {
|
|
33946
33836
|
if (!config || saving) return;
|
|
33947
|
-
if (
|
|
33948
|
-
setNotice({ kind: "success", text: `${AGENT_LABELS[
|
|
33837
|
+
if (name2 === config.defaultAgent) {
|
|
33838
|
+
setNotice({ kind: "success", text: `${AGENT_LABELS[name2]} is already the default agent` });
|
|
33949
33839
|
return;
|
|
33950
33840
|
}
|
|
33951
33841
|
setSaving(true);
|
|
33952
33842
|
setNotice(null);
|
|
33953
|
-
writeAgentConfig({ ...config, defaultAgent:
|
|
33954
|
-
setConfig((current) => current ? { ...current, defaultAgent:
|
|
33955
|
-
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[
|
|
33956
|
-
visit.trail.record(`made ${
|
|
33843
|
+
writeAgentConfig({ ...config, defaultAgent: name2, defaultChosen: true }).then(() => {
|
|
33844
|
+
setConfig((current) => current ? { ...current, defaultAgent: name2, defaultChosen: true } : current);
|
|
33845
|
+
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name2]}` });
|
|
33846
|
+
visit.trail.record(`made ${name2} the default`);
|
|
33957
33847
|
}).catch((err) => {
|
|
33958
33848
|
visit.error = scrubError(err, []);
|
|
33959
|
-
visit.trail.record(`making ${
|
|
33849
|
+
visit.trail.record(`making ${name2} the default failed`);
|
|
33960
33850
|
setNotice({ kind: "error", text: `Default agent not changed: ${visit.error}` });
|
|
33961
33851
|
}).finally(() => setSaving(false));
|
|
33962
33852
|
};
|
|
@@ -34043,14 +33933,14 @@ function AgentsScreen({ onDone }) {
|
|
|
34043
33933
|
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "AGENT" }) }),
|
|
34044
33934
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "STATUS" })
|
|
34045
33935
|
] }),
|
|
34046
|
-
AGENT_NAMES.map((
|
|
34047
|
-
const isFocused = focusedAgent ===
|
|
33936
|
+
AGENT_NAMES.map((name2) => {
|
|
33937
|
+
const isFocused = focusedAgent === name2;
|
|
34048
33938
|
return /* @__PURE__ */ jsxs49(Box49, { gap: 1, children: [
|
|
34049
33939
|
/* @__PURE__ */ jsx61(Text51, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " }),
|
|
34050
|
-
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children:
|
|
34051
|
-
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[
|
|
34052
|
-
/* @__PURE__ */ jsx61(AgentStatusBadge, { name, checks: checks[
|
|
34053
|
-
] },
|
|
33940
|
+
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children: name2 === config.defaultAgent ? "\u2605" : " " }),
|
|
33941
|
+
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[name2] }) }),
|
|
33942
|
+
/* @__PURE__ */ jsx61(AgentStatusBadge, { name: name2, checks: checks[name2], binary: config.agents[name2].binary })
|
|
33943
|
+
] }, name2);
|
|
34054
33944
|
}),
|
|
34055
33945
|
/* @__PURE__ */ jsxs49(Box49, { flexDirection: "column", marginTop: 1, children: [
|
|
34056
33946
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: `\u2500 ${AGENT_LABELS[focusedAgent]} ${"\u2500".repeat(30)}` }),
|