@contentful/experience-design-system-cli 2.39.1-dev-build-eee35c0c.0 → 2.39.1-dev-build-c1faff77.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 +683 -607
- package/dist/index.js +724 -614
- package/dist/package.json +2 -2
- package/package.json +4 -4
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 name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], 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(name) {
|
|
30
|
+
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(name)}(?![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((name) => name.length > 0).map((name) => ({ name, pattern: identifierPattern(name) }));
|
|
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 }) => name);
|
|
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 name of mentioned)
|
|
48
|
+
last.names.add(name);
|
|
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 name of window.names)
|
|
60
|
+
lastWindowFor.set(name, 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 name of window.names) {
|
|
75
|
+
if (lastWindowFor.get(name) === window && !identifierPattern(name).test(head))
|
|
76
|
+
cut.add(name);
|
|
77
77
|
}
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
|
-
for (const
|
|
81
|
-
if (lastWindowFor.get(
|
|
82
|
-
cut.add(
|
|
80
|
+
for (const name of window.names) {
|
|
81
|
+
if (lastWindowFor.get(name) === window)
|
|
82
|
+
cut.add(name);
|
|
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((name, index) => cut.has(name) && names.indexOf(name) === 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(name, source) {
|
|
109
|
+
return createHash("sha256").update(`${name}:${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, name, timestamp) {
|
|
199
|
+
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id, name, 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, name) {
|
|
1035
|
+
return `progress=generate:${done}/${total}:${name}`;
|
|
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 name = String(obj["name"] ?? "");
|
|
1722
1722
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1723
|
-
return ` ${ansi.green("+")} ${
|
|
1723
|
+
return ` ${ansi.green("+")} ${name} ${ansi.dim(reason)}`;
|
|
1724
1724
|
}
|
|
1725
1725
|
case "reject_component": {
|
|
1726
|
-
const
|
|
1726
|
+
const name = String(obj["name"] ?? "");
|
|
1727
1727
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1728
|
-
return ` ${ansi.dim("\u2013")} ${
|
|
1728
|
+
return ` ${ansi.dim("\u2013")} ${name} ${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((name) => new RegExp(`\\b(?:type|interface|enum|const|class)\\s+${escapeForRegExp(name)}\\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((name) => inHand.some((text) => declaresAnyType(text, [name])));
|
|
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 name of excerpt.usesNotShown)
|
|
3524
|
+
usesNotShown.add(name);
|
|
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((name) => usesNotShown.has(name)),
|
|
3532
3532
|
declaredTypeNames
|
|
3533
3533
|
};
|
|
3534
3534
|
}
|
|
3535
|
-
async function loadComponentSourceRef(
|
|
3535
|
+
async function loadComponentSourceRef(name, sourcePath, propNames = [], propTypes = []) {
|
|
3536
3536
|
let content = null;
|
|
3537
3537
|
let siblingFiles = [];
|
|
3538
3538
|
let truncatedSiblingCount = 0;
|
|
@@ -3549,18 +3549,18 @@ async function loadComponentSourceRef(name2, sourcePath, propNames = [], propTyp
|
|
|
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 name2 of mainExcerpt.usesNotShown)
|
|
3553
|
+
usesNotShown.add(name2);
|
|
3554
|
+
for (const name2 of siblingUsesNotShown)
|
|
3555
|
+
usesNotShown.add(name2);
|
|
3556
3556
|
} catch {
|
|
3557
3557
|
}
|
|
3558
|
-
const ref = { component:
|
|
3558
|
+
const ref = { component: name, 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((name2) => usesNotShown.has(name2));
|
|
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
|
|
3716
|
+
return components.map(({ component_id, name, 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: name, 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 name = Node.isFunctionDeclaration(declaration) ? declaration.getName() : allowVariableDeclaration && Node.isVariableDeclaration(declaration) ? declaration.getName() : void 0;
|
|
4652
|
+
if (!name || !/^[A-Z]/.test(name) || exported.has(name))
|
|
4653
4653
|
return void 0;
|
|
4654
|
-
return
|
|
4654
|
+
return name;
|
|
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 name = exportKey === "default" ? resolveDefaultExportName(declarations, exported, options.allowVariableDeclaration) : exportKey;
|
|
4661
|
+
if (!name || !/^[A-Z]/.test(name))
|
|
4662
4662
|
continue;
|
|
4663
|
-
if (
|
|
4663
|
+
if (name.startsWith("use")) {
|
|
4664
4664
|
exclusions.push({
|
|
4665
4665
|
itemType: "component",
|
|
4666
|
-
name
|
|
4666
|
+
name,
|
|
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
|
|
4673
|
+
renderable.push({ name, 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 name = 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,
|
|
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(name) && { 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(name) {
|
|
5124
|
+
const normalizedName = name && name.length > 0 ? name : "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 name2 = initializer2 && Node2.isStringLiteral(initializer2) ? initializer2.getLiteralValue() : initializer2 && Node2.isJsxExpression(initializer2) ? initializer2.getExpression()?.getText() ?? "" : "";
|
|
5195
5195
|
upsertSlot({
|
|
5196
|
-
...normalizeSlotName(
|
|
5196
|
+
...normalizeSlotName(name2)
|
|
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 name = initializer.getLiteralValue();
|
|
5206
|
+
if (!name)
|
|
5207
5207
|
return;
|
|
5208
5208
|
upsertSlot({
|
|
5209
|
-
name
|
|
5209
|
+
name,
|
|
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 name = kebabToPascal(tag);
|
|
5232
5232
|
const props = extractProps(classDecl);
|
|
5233
|
-
const slots = extractSlots(classDecl, warnings,
|
|
5233
|
+
const slots = extractSlots(classDecl, warnings, name);
|
|
5234
5234
|
const eventNames = detectEvents(classDecl);
|
|
5235
5235
|
if (eventNames.length > 0) {
|
|
5236
|
-
warnings.push(`Component ${
|
|
5236
|
+
warnings.push(`Component ${name} has ${eventNames.length} events not captured: ${eventNames.join(", ")}`);
|
|
5237
5237
|
}
|
|
5238
5238
|
components.push({
|
|
5239
|
-
name
|
|
5239
|
+
name,
|
|
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 name = raw.trim();
|
|
5407
|
+
if (name && componentNames.has(name))
|
|
5408
|
+
found.add(name);
|
|
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 name of extractAllowedComponentsFromTypeText(assertedTypeNode.getText(), ctx)) {
|
|
5457
|
+
found.add(name);
|
|
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 name = otherSide.getText().split(".").pop();
|
|
5477
|
+
if (!name || !componentNames.has(name))
|
|
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 name;
|
|
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 = (name) => {
|
|
5535
|
+
renderCountByComponent.set(name, (renderCountByComponent.get(name) ?? 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((name) => name === "generateMetadata" || name === "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 name = property.getName();
|
|
5881
|
+
if (name === "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(name))
|
|
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,
|
|
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 name = symbol.getName();
|
|
5934
|
+
if (name === "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(name))
|
|
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,
|
|
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((name) => [name, name]));
|
|
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 name = property.getName();
|
|
6473
|
+
if (name === "children")
|
|
6474
6474
|
continue;
|
|
6475
6475
|
if (!getRenderPropType(property))
|
|
6476
6476
|
continue;
|
|
6477
|
-
const slotName =
|
|
6477
|
+
const slotName = name.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 literal3 = typeNode.getLiteral();
|
|
6491
|
+
if (Node4.isStringLiteral(literal3)) {
|
|
6492
|
+
return [literal3.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(name, seen = /* @__PURE__ */ new Set()) {
|
|
6734
|
+
if (seen.has(name))
|
|
6735
6735
|
return [];
|
|
6736
|
-
seen.add(
|
|
6736
|
+
seen.add(name);
|
|
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[name] ?? []) {
|
|
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[name]) {
|
|
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 name of pickedKeys) {
|
|
6841
|
+
if (slotNames.has(name))
|
|
6842
6842
|
continue;
|
|
6843
|
-
if (excludedProps.has(
|
|
6843
|
+
if (excludedProps.has(name))
|
|
6844
6844
|
continue;
|
|
6845
|
-
const pickedProp = sourcePropsByName.get(
|
|
6845
|
+
const pickedProp = sourcePropsByName.get(name);
|
|
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
|
|
7074
|
+
for (const { name, 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,
|
|
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, name) ?? 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,
|
|
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
|
|
7564
|
+
for (const { name, 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, name, 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 name = 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,
|
|
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 name = property.getName();
|
|
7762
7762
|
const value = property.getInitializer();
|
|
7763
7763
|
if (!value)
|
|
7764
7764
|
continue;
|
|
7765
|
-
if (
|
|
7765
|
+
if (name === "type") {
|
|
7766
7766
|
type = getVuePropTypeText(value);
|
|
7767
7767
|
allowedValues = extractAllowedValues(value.getType());
|
|
7768
|
-
} else if (
|
|
7768
|
+
} else if (name === "required") {
|
|
7769
7769
|
required = value.getText() === "true";
|
|
7770
|
-
} else if (
|
|
7770
|
+
} else if (name === "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 name = 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, name, 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,
|
|
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, name, 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,
|
|
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
|
|
8179
|
+
const { name, 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,
|
|
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 name = prop.getName();
|
|
8482
|
+
if (!isPublicVuePropName(name))
|
|
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,
|
|
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,
|
|
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(name) {
|
|
8532
|
+
return !/^[_$]/.test(name);
|
|
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
|
|
8564
|
+
const name = match2[1];
|
|
8565
|
+
if (!seen.has(name)) {
|
|
8566
|
+
seen.add(name);
|
|
8567
|
+
slots.push({ name, isDefault: name === "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 name = 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,
|
|
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
|
|
8718
|
+
const { name, declaration: decl, typeText, required } = resolved;
|
|
8719
8719
|
const allowedValues = extractAllowedValues3(typeText);
|
|
8720
8720
|
props.push({
|
|
8721
|
-
name
|
|
8721
|
+
name,
|
|
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 name = 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,
|
|
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 name = nameMatch?.[1] ?? "default";
|
|
9027
|
+
slots.set(name, name === "default");
|
|
9028
9028
|
}
|
|
9029
|
-
return [...slots.entries()].map(([
|
|
9029
|
+
return [...slots.entries()].map(([name, isDefault]) => ({ name, 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 name = "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
|
+
name = match2[1];
|
|
9066
9066
|
description = match2[2].trim();
|
|
9067
9067
|
}
|
|
9068
9068
|
}
|
|
9069
9069
|
slots.push({
|
|
9070
|
-
name
|
|
9071
|
-
isDefault:
|
|
9070
|
+
name,
|
|
9071
|
+
isDefault: name === "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(name, applyRuntimeFieldDenylist) {
|
|
9115
|
+
return applyRuntimeFieldDenylist && INTERNAL_RUNTIME_FIELD_NAMES.has(name);
|
|
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 name = property.getName();
|
|
9143
|
+
if (name.startsWith("#") || isInternalRuntimeField(name, 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 = name.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) : name,
|
|
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 name = getter.getName();
|
|
9189
|
+
if (name === "observedAttributes" || name === "template" || name.startsWith("#") || isInternalRuntimeField(name, 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(name) ?? {};
|
|
9195
9195
|
entry.getter = getter;
|
|
9196
|
-
accessors.set(
|
|
9196
|
+
accessors.set(name, 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 name = setter.getName();
|
|
9206
|
+
if (name === "observedAttributes" || name === "template" || name.startsWith("#") || isInternalRuntimeField(name, 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(name) ?? {};
|
|
9212
9212
|
entry.setter = setter;
|
|
9213
|
-
accessors.set(
|
|
9213
|
+
accessors.set(name, entry);
|
|
9214
9214
|
}
|
|
9215
|
-
for (const [
|
|
9215
|
+
for (const [name, { 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,
|
|
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, name, description] = match2;
|
|
9245
|
+
if (!name || name.startsWith("#"))
|
|
9246
9246
|
continue;
|
|
9247
9247
|
props.push({
|
|
9248
|
-
name
|
|
9248
|
+
name,
|
|
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 name = 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,
|
|
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 name of [...importedNames]) {
|
|
9935
|
+
const localDecl = findLocalTypeDeclaration(ctx.instance, name, ctx.moduleScript) ?? (ctx.moduleScript ? findLocalTypeDeclaration(ctx.moduleScript, name, 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 name = 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: [`${name}: 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(`${name}: 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: name,
|
|
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(`${name}: 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(`${name}: 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,
|
|
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: name
|
|
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 name = annotation["typeName"]?.["name"] ?? null;
|
|
10344
|
+
return name ? `'${name}'` : "<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 name = 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,
|
|
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, name, 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, name2, 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"] === name)
|
|
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(literal3, snippetLocals) {
|
|
10553
|
+
const members = literal3["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 name = key?.["name"] ?? null;
|
|
10563
|
+
if (!name)
|
|
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,
|
|
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 name = key?.["name"] ?? null;
|
|
10713
|
+
if (!name)
|
|
10714
10714
|
continue;
|
|
10715
|
-
seenInDestructure.add(
|
|
10715
|
+
seenInDestructure.add(name);
|
|
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(name);
|
|
10720
10720
|
if (typeMember?.isSnippet) {
|
|
10721
|
-
snippetNames.add(
|
|
10721
|
+
snippetNames.add(name);
|
|
10722
10722
|
const slot = {
|
|
10723
|
-
name
|
|
10724
|
-
isDefault:
|
|
10723
|
+
name,
|
|
10724
|
+
isDefault: name === "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,
|
|
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 name = p["key"]?.["name"] ?? null;
|
|
10794
|
+
if (name)
|
|
10795
|
+
m.set(name, 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
|
|
10974
|
+
const name = readSlotName(node);
|
|
10975
|
+
if (!seen.has(name)) {
|
|
10976
|
+
seen.add(name);
|
|
10977
|
+
slots.push({ name, isDefault: name === "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 name = alias ?? fieldName;
|
|
11192
11192
|
const prop = {
|
|
11193
|
-
name
|
|
11193
|
+
name,
|
|
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 name = alias ?? fieldName;
|
|
11270
11270
|
const prop = {
|
|
11271
|
-
name
|
|
11271
|
+
name,
|
|
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 name = parsed.alias ?? parsed.fieldName;
|
|
11365
|
+
if (byName.has(name))
|
|
11366
11366
|
continue;
|
|
11367
|
-
byName.set(
|
|
11367
|
+
byName.set(name, { name, 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(name) {
|
|
11517
11517
|
for (const prefix of KNOWN_PREFIXES) {
|
|
11518
|
-
if (
|
|
11519
|
-
const rest =
|
|
11518
|
+
if (name.startsWith(prefix) && name.length > prefix.length) {
|
|
11519
|
+
const rest = name.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 name;
|
|
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 name = callee.getText();
|
|
11607
|
+
if (name === "contentChild" || name === "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(name, allowed) {
|
|
11637
11637
|
const slot = {
|
|
11638
|
-
name
|
|
11638
|
+
name,
|
|
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 name = deriveSlotName(el.rawSelect, meta.normalizedName);
|
|
11683
|
+
if (byName.has(name))
|
|
11684
11684
|
continue;
|
|
11685
|
-
byName.set(
|
|
11686
|
-
name
|
|
11685
|
+
byName.set(name, {
|
|
11686
|
+
name,
|
|
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 name = fallbackIndex === 0 ? "children" : `slot_${fallbackIndex}`;
|
|
11781
11781
|
fallbackIndex++;
|
|
11782
|
-
return { ...slot, name
|
|
11782
|
+
return { ...slot, name };
|
|
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(name) {
|
|
12600
|
+
return name.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(name, resolvedSourcePath) {
|
|
13297
|
+
const sourceHash = createHash7("sha256").update(`${name}:${resolvedSourcePath}`).digest("hex").slice(0, 12);
|
|
13298
|
+
return `${name}-${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(name) {
|
|
13677
|
+
if (name.endsWith(".d.ts"))
|
|
13678
13678
|
return "other";
|
|
13679
|
-
const ext = path.extname(
|
|
13679
|
+
const ext = path.extname(name);
|
|
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(name) {
|
|
13691
|
+
return DENYLISTED_EXACT_FILE_NAMES.has(name) || DENYLISTED_FILE_NAME_PATTERNS.some((pattern) => pattern.test(name));
|
|
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(name) {
|
|
13703
|
+
if (name.endsWith(".d.ts"))
|
|
13704
13704
|
return false;
|
|
13705
|
-
if (EXCLUDED_SUFFIXES.some((suffix) =>
|
|
13705
|
+
if (EXCLUDED_SUFFIXES.some((suffix) => name.endsWith(suffix)))
|
|
13706
13706
|
return false;
|
|
13707
|
-
const ext = path2.extname(
|
|
13707
|
+
const ext = path2.extname(name);
|
|
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(name))
|
|
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 name = 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 (name)
|
|
14037
|
+
entry.componentName = name;
|
|
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 name of SAVE_FILES) {
|
|
14079
14079
|
try {
|
|
14080
|
-
await access4(join9(path5,
|
|
14081
|
-
conflicts.push(
|
|
14080
|
+
await access4(join9(path5, name));
|
|
14081
|
+
conflicts.push(name);
|
|
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
|
|
14587
|
+
serializeArrayParam = ({ allowReserved, explode, name, 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 `;${name}=${joinedValues2}`;
|
|
14595
14595
|
case "simple":
|
|
14596
14596
|
return joinedValues2;
|
|
14597
14597
|
default:
|
|
14598
|
-
return `${
|
|
14598
|
+
return `${name}=${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,
|
|
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
|
|
14614
|
+
serializePrimitiveParam = ({ allowReserved, name, 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 `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
14622
14622
|
};
|
|
14623
|
-
serializeObjectParam = ({ allowReserved, explode, name
|
|
14623
|
+
serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
14624
14624
|
if (value instanceof Date) {
|
|
14625
|
-
return valueOnly ? value.toISOString() : `${
|
|
14625
|
+
return valueOnly ? value.toISOString() : `${name}=${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 `${name}=${joinedValues2}`;
|
|
14640
14640
|
case "label":
|
|
14641
14641
|
return `.${joinedValues2}`;
|
|
14642
14642
|
case "matrix":
|
|
14643
|
-
return `;${
|
|
14643
|
+
return `;${name}=${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" ? `${name}[${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 name = match2.substring(1, match2.length - 1);
|
|
14675
14675
|
let style = "simple";
|
|
14676
|
-
if (
|
|
14676
|
+
if (name.endsWith("*")) {
|
|
14677
14677
|
explode = true;
|
|
14678
|
-
|
|
14678
|
+
name = name.substring(0, name.length - 1);
|
|
14679
14679
|
}
|
|
14680
|
-
if (
|
|
14681
|
-
|
|
14680
|
+
if (name.startsWith(".")) {
|
|
14681
|
+
name = name.substring(1);
|
|
14682
14682
|
style = "label";
|
|
14683
|
-
} else if (
|
|
14684
|
-
|
|
14683
|
+
} else if (name.startsWith(";")) {
|
|
14684
|
+
name = name.substring(1);
|
|
14685
14685
|
style = "matrix";
|
|
14686
14686
|
}
|
|
14687
|
-
const value = path5[
|
|
14687
|
+
const value = path5[name];
|
|
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
|
|
14692
|
+
url = url.replace(match2, serializeArrayParam({ explode, name, 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,
|
|
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,
|
|
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: array3, 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 name in queryParams) {
|
|
14723
|
+
const value = queryParams[name];
|
|
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,
|
|
14732
14732
|
style: "form",
|
|
14733
14733
|
value,
|
|
14734
|
-
...
|
|
14734
|
+
...array3
|
|
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,
|
|
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,
|
|
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, name) => {
|
|
14787
|
+
if (!name) {
|
|
14788
14788
|
return false;
|
|
14789
14789
|
}
|
|
14790
|
-
if (options.headers.has(
|
|
14790
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
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 name = 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[name] = token;
|
|
14811
14811
|
break;
|
|
14812
14812
|
case "cookie":
|
|
14813
|
-
options.headers.append("Cookie", `${
|
|
14813
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
14814
14814
|
break;
|
|
14815
14815
|
case "header":
|
|
14816
14816
|
default:
|
|
14817
|
-
options.headers.set(
|
|
14817
|
+
options.headers.set(name, 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 literal3 = parseObjectLiteralTail(cleaned);
|
|
15976
|
+
if (literal3 && (literal3.code || literal3.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: literal3.code ?? null, message: head || cleaned, cycle: literal3.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(name) {
|
|
16386
|
+
const stripped = name.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(name) {
|
|
16778
16778
|
try {
|
|
16779
|
-
await execFileAsync(process.platform === "win32" ? "where" : "which", [
|
|
16779
|
+
await execFileAsync(process.platform === "win32" ? "where" : "which", [name]);
|
|
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 name of parseImportedNames(importClause)) {
|
|
17478
|
+
if (name)
|
|
17479
|
+
names.add(name);
|
|
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((name) => {
|
|
17486
|
+
const renderPattern = new RegExp(`<${escapeRegExp(name)}\\b[\\s\\S]*?(?:/>|</${escapeRegExp(name)}>)`);
|
|
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(name)}\\b[^>]*\\{\\.\\.\\.(?!props\\b)[^}]+\\}`);
|
|
17490
|
+
const propsPlusSiblingSpreadPattern = new RegExp(`<${escapeRegExp(name)}\\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(name) {
|
|
17708
|
+
if (DOM_PASS_THROUGH_PROPS.has(name))
|
|
17709
17709
|
return true;
|
|
17710
|
-
if (/^aria[-A-Z]/.test(
|
|
17710
|
+
if (/^aria[-A-Z]/.test(name))
|
|
17711
17711
|
return true;
|
|
17712
|
-
return
|
|
17712
|
+
return name.startsWith("data-");
|
|
17713
17713
|
}
|
|
17714
17714
|
function preClassifyProp(prop) {
|
|
17715
|
-
const { name
|
|
17716
|
-
if (/^on[A-Z]/.test(
|
|
17715
|
+
const { name, type } = prop;
|
|
17716
|
+
if (/^on[A-Z]/.test(name) || type.includes("=> void") || type.includes("EventHandler")) {
|
|
17717
17717
|
return { category: "exclude" };
|
|
17718
17718
|
}
|
|
17719
|
-
if (
|
|
17719
|
+
if (name === "ref" || name === "innerRef" || type.includes("Ref<") || type.includes("RefObject<")) {
|
|
17720
17720
|
return { category: "exclude" };
|
|
17721
17721
|
}
|
|
17722
|
-
if (
|
|
17722
|
+
if (name === "testId" || name === "data-testid" || name === "dataTestId") {
|
|
17723
17723
|
return { category: "exclude" };
|
|
17724
17724
|
}
|
|
17725
|
-
if (
|
|
17725
|
+
if (name === "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(name)) {
|
|
17732
17732
|
return { category: "exclude" };
|
|
17733
17733
|
}
|
|
17734
|
-
if (
|
|
17734
|
+
if (name === "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(name) || designNameEnd.test(name)) {
|
|
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(name)) {
|
|
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(name)) {
|
|
17756
17756
|
return { category: "design", cdfTypeHint: "boolean" };
|
|
17757
17757
|
}
|
|
17758
17758
|
}
|
|
17759
|
-
if (
|
|
17759
|
+
if (name === "componentId" || name === "sectionKey" || name === "locale" || name === "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(name) || urlNameEnd.test(name)) {
|
|
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(name) || textNameEnd.test(name)) {
|
|
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: (name, payload) => onDebugEvent?.("agent", { event: name, ...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(([name, sources]) => ({ name, 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((name) => allowedComponentNames2.has(name)) } : 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((name) => [name, { 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 name of AGENT_NAMES) {
|
|
19034
|
+
const entry = saved[name];
|
|
19035
19035
|
if (entry && typeof entry === "object") {
|
|
19036
19036
|
const fields2 = entry;
|
|
19037
|
-
agents[
|
|
19037
|
+
agents[name] = { 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 name of AGENT_NAMES) {
|
|
19051
|
+
const model = config.agents[name].model.trim();
|
|
19052
|
+
const binary = config.agents[name].binary.trim();
|
|
19053
|
+
if (model || binary) agents[name] = { ...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 name of AGENT_NAMES) {
|
|
19084
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
19085
|
+
const binary = config.agents[name].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((name) => SESSION_FOLDER.test(name));
|
|
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((name) => !dependents.has(name)).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((name) => ({
|
|
22439
|
+
name,
|
|
22440
|
+
depth: name === 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 [name, d] of depth.entries()) {
|
|
22477
22477
|
nodes.push({
|
|
22478
|
-
name
|
|
22478
|
+
name,
|
|
22479
22479
|
depth: d,
|
|
22480
|
-
path: parentPath.get(
|
|
22481
|
-
parents: [...parents.get(
|
|
22480
|
+
path: parentPath.get(name),
|
|
22481
|
+
parents: [...parents.get(name) ?? /* @__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 [name, roots] of counts.entries()) {
|
|
22505
|
+
if (roots.length >= 2) out.set(name, [...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 own2 = 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 < own2) return true;
|
|
22673
|
+
if (d === own2) 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 name of [...parentNames].sort()) {
|
|
22717
|
+
const full = computeClosure(name, subgraph);
|
|
22718
|
+
closures.set(name, { ...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 = (name) => {
|
|
22722
|
+
const it = itemByKey.get(name)?.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 own2 = 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 < own2) return true;
|
|
22797
|
+
if (d === own2) 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 name of standaloneRoots) {
|
|
22828
|
+
const rec = itemByKey.get(name);
|
|
22829
22829
|
if (!rec) continue;
|
|
22830
22830
|
rows.push({
|
|
22831
22831
|
kind: "standalone",
|
|
22832
|
-
key: `stand:${
|
|
22833
|
-
label:
|
|
22832
|
+
key: `stand:${name}`,
|
|
22833
|
+
label: name,
|
|
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((name) => (nodeByName.get(name)?.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 name of sharedLeafNames) {
|
|
22842
|
+
if (seenStandaloneNames.has(name)) continue;
|
|
22843
|
+
const rec = itemByKey.get(name);
|
|
22844
22844
|
if (!rec) continue;
|
|
22845
22845
|
rows.push({
|
|
22846
22846
|
kind: "standalone",
|
|
22847
|
-
key: `shared-standalone:${
|
|
22848
|
-
label: `${
|
|
22847
|
+
key: `shared-standalone:${name}`,
|
|
22848
|
+
label: `${name} (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 name of flatNames) {
|
|
22865
|
+
const rec = itemByKey.get(name);
|
|
22866
22866
|
if (!rec) continue;
|
|
22867
22867
|
rows.push({
|
|
22868
22868
|
kind: "flat",
|
|
22869
|
-
key: `flat:${
|
|
22870
|
-
label:
|
|
22869
|
+
key: `flat:${name}`,
|
|
22870
|
+
label: name,
|
|
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 name = items[row.itemIdx]?.key;
|
|
22881
|
+
if (name === void 0) return true;
|
|
22882
|
+
return filterVisibleKeys.has(name);
|
|
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 = (name) => {
|
|
23605
|
+
if (visited.has(name)) return;
|
|
23606
|
+
visited.add(name);
|
|
23607
|
+
queue.push(name);
|
|
23608
|
+
const unit = cycleUnits.get(name);
|
|
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 name of cycle.path) cycleParticipants.add(name);
|
|
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 [name, closure] of closures.entries()) {
|
|
23971
|
+
if (closure.nodes.length > 1) roots.add(name);
|
|
23972
23972
|
}
|
|
23973
|
-
for (const
|
|
23973
|
+
for (const name of cycleParticipants) roots.add(name);
|
|
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 (name) => {
|
|
24046
|
+
if (hasSearch && !fuzzyMatches(input.searchQuery, name)) return true;
|
|
24047
|
+
if (keys !== void 0 && !keys.has(name)) 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 [name, decision] of entries) next.set(name, 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((name) => [name, "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((name) => [name, "rejected"]),
|
|
24084
|
+
...toDeselect.map((name) => [name, "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((name) => state2.get(name) !== "accepted");
|
|
24090
24090
|
if (anyNotAccepted) {
|
|
24091
24091
|
return apply(state2, [
|
|
24092
|
-
...nonCycle.map((
|
|
24093
|
-
...reachableCycleMembers(graph, nonCycle).map((
|
|
24092
|
+
...nonCycle.map((name) => [name, "accepted"]),
|
|
24093
|
+
...reachableCycleMembers(graph, nonCycle).map((name) => [name, "accepted"])
|
|
24094
24094
|
]);
|
|
24095
24095
|
}
|
|
24096
24096
|
return apply(state2, [
|
|
24097
|
-
...nonCycle.map((
|
|
24097
|
+
...nonCycle.map((name) => [name, "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((name) => [name, "accepted"]),
|
|
24105
|
+
...reachableCycleMembers(graph, seeds).map((name) => [name, "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, name, state2) {
|
|
24111
|
+
if (state2.get(name) === "rejected") return false;
|
|
24112
|
+
const { toReject, toDeselect } = rejectCascade(graph, name);
|
|
24113
|
+
const ancestors = toReject.filter((n) => n !== name);
|
|
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((name) => decisions.get(name) === "accepted")) continue;
|
|
24212
|
+
for (const name of unit) keys.add(name);
|
|
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 = (name) => {
|
|
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 === name) {
|
|
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 = (name) => {
|
|
24330
|
+
if (decisions.get(name) === "rejected") return;
|
|
24331
|
+
if (rejectNeedsConfirmation(graph, name, decisions)) {
|
|
24332
|
+
const { toReject, toDeselect } = rejectCascade(graph, name);
|
|
24333
24333
|
setPendingRejectCascade({
|
|
24334
|
-
target:
|
|
24335
|
-
ancestors: toReject.filter((n) => n !==
|
|
24334
|
+
target: name,
|
|
24335
|
+
ancestors: toReject.filter((n) => n !== name).sort(),
|
|
24336
24336
|
descendants: [...toDeselect].sort()
|
|
24337
24337
|
});
|
|
24338
24338
|
return;
|
|
24339
24339
|
}
|
|
24340
|
-
decide({ type: "reject", name
|
|
24340
|
+
decide({ type: "reject", name });
|
|
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 name = 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 ${name}...`,
|
|
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 ${name}...` : "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 = (name) => name.charAt(0).toUpperCase() + name.slice(1);
|
|
24911
24911
|
}
|
|
24912
24912
|
});
|
|
24913
24913
|
|
|
@@ -25182,24 +25182,6 @@ 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
|
-
|
|
25203
25185
|
// packages/experience-design-system-types/dist/src/cdf/vocabularies.js
|
|
25204
25186
|
var CDF_PROPERTY_TYPES2, CDF_PROPERTY_CATEGORIES2;
|
|
25205
25187
|
var init_vocabularies2 = __esm({
|
|
@@ -25394,38 +25376,38 @@ var init_validate5 = __esm({
|
|
|
25394
25376
|
});
|
|
25395
25377
|
|
|
25396
25378
|
// packages/experience-design-system-types/dist/src/cdf/types.js
|
|
25397
|
-
import * as
|
|
25379
|
+
import * as z3 from "zod/mini";
|
|
25398
25380
|
var CDFPropertySchema2, CDFSlotSchema2, CDFComponentSchema2, CDFTokenSchema2;
|
|
25399
25381
|
var init_types7 = __esm({
|
|
25400
25382
|
"packages/experience-design-system-types/dist/src/cdf/types.js"() {
|
|
25401
25383
|
"use strict";
|
|
25402
25384
|
init_vocabularies2();
|
|
25403
25385
|
init_token_types2();
|
|
25404
|
-
CDFPropertySchema2 =
|
|
25405
|
-
$type:
|
|
25406
|
-
$category:
|
|
25407
|
-
$description:
|
|
25408
|
-
$required:
|
|
25409
|
-
$default:
|
|
25410
|
-
$values:
|
|
25411
|
-
"$token.kind":
|
|
25412
|
-
"$token.allowed":
|
|
25386
|
+
CDFPropertySchema2 = z3.strictObject({
|
|
25387
|
+
$type: z3.enum(CDF_PROPERTY_TYPES2),
|
|
25388
|
+
$category: z3.enum(CDF_PROPERTY_CATEGORIES2),
|
|
25389
|
+
$description: z3.optional(z3.string()),
|
|
25390
|
+
$required: z3.optional(z3.boolean()),
|
|
25391
|
+
$default: z3.optional(z3.any()),
|
|
25392
|
+
$values: z3.optional(z3.array(z3.string())),
|
|
25393
|
+
"$token.kind": z3.optional(z3.string()),
|
|
25394
|
+
"$token.allowed": z3.optional(z3.array(z3.string()))
|
|
25413
25395
|
});
|
|
25414
|
-
CDFSlotSchema2 =
|
|
25415
|
-
$description:
|
|
25416
|
-
$allowedComponents:
|
|
25417
|
-
$required:
|
|
25396
|
+
CDFSlotSchema2 = z3.strictObject({
|
|
25397
|
+
$description: z3.optional(z3.string()),
|
|
25398
|
+
$allowedComponents: z3.optional(z3.array(z3.string())),
|
|
25399
|
+
$required: z3.optional(z3.boolean())
|
|
25418
25400
|
});
|
|
25419
|
-
CDFComponentSchema2 =
|
|
25420
|
-
$type:
|
|
25421
|
-
$description:
|
|
25422
|
-
$properties:
|
|
25423
|
-
$slots:
|
|
25401
|
+
CDFComponentSchema2 = z3.strictObject({
|
|
25402
|
+
$type: z3.literal("component"),
|
|
25403
|
+
$description: z3.optional(z3.string()),
|
|
25404
|
+
$properties: z3.record(z3.string(), CDFPropertySchema2),
|
|
25405
|
+
$slots: z3.optional(z3.record(z3.string(), CDFSlotSchema2))
|
|
25424
25406
|
});
|
|
25425
|
-
CDFTokenSchema2 =
|
|
25426
|
-
$type:
|
|
25427
|
-
$value:
|
|
25428
|
-
$description:
|
|
25407
|
+
CDFTokenSchema2 = z3.strictObject({
|
|
25408
|
+
$type: z3.enum(DESIGN_TOKEN_TYPES2),
|
|
25409
|
+
$value: z3.unknown(),
|
|
25410
|
+
$description: z3.optional(z3.string())
|
|
25429
25411
|
});
|
|
25430
25412
|
}
|
|
25431
25413
|
});
|
|
@@ -25435,9 +25417,9 @@ function stripUnsupportedSlotFields(entry) {
|
|
|
25435
25417
|
if (!entry.$slots)
|
|
25436
25418
|
return entry;
|
|
25437
25419
|
const cleaned = {};
|
|
25438
|
-
for (const [
|
|
25420
|
+
for (const [name, slot] of Object.entries(entry.$slots)) {
|
|
25439
25421
|
const { $required: _required, ...rest } = slot;
|
|
25440
|
-
cleaned[
|
|
25422
|
+
cleaned[name] = rest;
|
|
25441
25423
|
}
|
|
25442
25424
|
return { ...entry, $slots: cleaned };
|
|
25443
25425
|
}
|
|
@@ -25479,7 +25461,7 @@ function validateSlotReferences2(components) {
|
|
|
25479
25461
|
const slots = entry.$slots ?? {};
|
|
25480
25462
|
for (const [slotKey, slot] of Object.entries(slots)) {
|
|
25481
25463
|
const allowed = slot?.$allowedComponents ?? [];
|
|
25482
|
-
const unresolved = allowed.filter((
|
|
25464
|
+
const unresolved = allowed.filter((name) => !componentKeys.has(name));
|
|
25483
25465
|
if (unresolved.length === 0)
|
|
25484
25466
|
continue;
|
|
25485
25467
|
errors.push({
|
|
@@ -25525,17 +25507,17 @@ var init_cdf2 = __esm({
|
|
|
25525
25507
|
});
|
|
25526
25508
|
|
|
25527
25509
|
// packages/experience-design-system-types/dist/src/dtcg/types.js
|
|
25528
|
-
import * as
|
|
25510
|
+
import * as z4 from "zod/mini";
|
|
25529
25511
|
var DTCGTokenSchema2;
|
|
25530
25512
|
var init_types8 = __esm({
|
|
25531
25513
|
"packages/experience-design-system-types/dist/src/dtcg/types.js"() {
|
|
25532
25514
|
"use strict";
|
|
25533
25515
|
init_token_types2();
|
|
25534
|
-
DTCGTokenSchema2 =
|
|
25535
|
-
path:
|
|
25536
|
-
$type:
|
|
25537
|
-
$value:
|
|
25538
|
-
$description:
|
|
25516
|
+
DTCGTokenSchema2 = z4.strictObject({
|
|
25517
|
+
path: z4.string(),
|
|
25518
|
+
$type: z4.enum(DESIGN_TOKEN_TYPES2),
|
|
25519
|
+
$value: z4.unknown(),
|
|
25520
|
+
$description: z4.optional(z4.string())
|
|
25539
25521
|
});
|
|
25540
25522
|
}
|
|
25541
25523
|
});
|
|
@@ -25569,13 +25551,141 @@ var init_dtcg2 = __esm({
|
|
|
25569
25551
|
}
|
|
25570
25552
|
});
|
|
25571
25553
|
|
|
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
|
+
|
|
25572
25682
|
// packages/experience-design-system-types/dist/src/index.js
|
|
25573
25683
|
var init_src4 = __esm({
|
|
25574
25684
|
"packages/experience-design-system-types/dist/src/index.js"() {
|
|
25575
25685
|
"use strict";
|
|
25576
|
-
init_source_input_association();
|
|
25577
25686
|
init_cdf2();
|
|
25578
25687
|
init_dtcg2();
|
|
25688
|
+
init_property_contract();
|
|
25579
25689
|
}
|
|
25580
25690
|
});
|
|
25581
25691
|
|
|
@@ -25584,7 +25694,7 @@ function failedComponentNames(errors) {
|
|
|
25584
25694
|
return [...new Set(errors.map((error) => error.componentName))];
|
|
25585
25695
|
}
|
|
25586
25696
|
function matchedComponentNames(errors, missingNames) {
|
|
25587
|
-
return failedComponentNames(errors).filter((
|
|
25697
|
+
return failedComponentNames(errors).filter((name) => !missingNames.includes(name));
|
|
25588
25698
|
}
|
|
25589
25699
|
function formatErrorLine(error) {
|
|
25590
25700
|
const context = [`Component: ${error.componentName}`, error.path ? `Path: ${error.path}` : null].filter(Boolean);
|
|
@@ -25715,14 +25825,14 @@ function computeRenderStatuses(closure, directIssues) {
|
|
|
25715
25825
|
for (const node of closure.nodes) {
|
|
25716
25826
|
nodesByName.set(node.name, { name: node.name, path: node.path });
|
|
25717
25827
|
}
|
|
25718
|
-
const
|
|
25828
|
+
const own2 = /* @__PURE__ */ new Map();
|
|
25719
25829
|
for (const node of closure.nodes) {
|
|
25720
25830
|
const s = directIssues.get(node.name);
|
|
25721
|
-
if (s && s !== "ok")
|
|
25831
|
+
if (s && s !== "ok") own2.set(node.name, s);
|
|
25722
25832
|
}
|
|
25723
25833
|
const inheritedSources = /* @__PURE__ */ new Map();
|
|
25724
25834
|
for (const node of closure.nodes) {
|
|
25725
|
-
const ownStatus =
|
|
25835
|
+
const ownStatus = own2.get(node.name);
|
|
25726
25836
|
if (!ownStatus) continue;
|
|
25727
25837
|
for (let i = 0; i < node.path.length - 1; i++) {
|
|
25728
25838
|
const ancestor = node.path[i];
|
|
@@ -25730,11 +25840,11 @@ function computeRenderStatuses(closure, directIssues) {
|
|
|
25730
25840
|
inheritedSources.get(ancestor).set(node.name, ownStatus);
|
|
25731
25841
|
}
|
|
25732
25842
|
}
|
|
25733
|
-
for (const [
|
|
25734
|
-
out.set(
|
|
25843
|
+
for (const [name, status] of own2.entries()) {
|
|
25844
|
+
out.set(name, {
|
|
25735
25845
|
status,
|
|
25736
25846
|
isOwn: true,
|
|
25737
|
-
sourceComponents: [
|
|
25847
|
+
sourceComponents: [name]
|
|
25738
25848
|
});
|
|
25739
25849
|
}
|
|
25740
25850
|
for (const [ancestor, sources] of inheritedSources.entries()) {
|
|
@@ -26052,7 +26162,7 @@ function parseToState(json) {
|
|
|
26052
26162
|
}
|
|
26053
26163
|
const componentDescription = typeof component.$description === "string" ? component.$description : "";
|
|
26054
26164
|
const rawProps = component.$properties ?? {};
|
|
26055
|
-
const props = Object.entries(rawProps).map(([
|
|
26165
|
+
const props = Object.entries(rawProps).map(([name, raw]) => {
|
|
26056
26166
|
const p = raw ?? {};
|
|
26057
26167
|
const type = CDF_PROPERTY_TYPES2.includes(p.$type) ? p.$type : "string";
|
|
26058
26168
|
let defaultValue = null;
|
|
@@ -26064,7 +26174,7 @@ function parseToState(json) {
|
|
|
26064
26174
|
}
|
|
26065
26175
|
}
|
|
26066
26176
|
return {
|
|
26067
|
-
name
|
|
26177
|
+
name,
|
|
26068
26178
|
type,
|
|
26069
26179
|
category: CDF_PROPERTY_CATEGORIES2.includes(p.$category) ? p.$category : "content",
|
|
26070
26180
|
required: p.$required === true,
|
|
@@ -26076,10 +26186,10 @@ function parseToState(json) {
|
|
|
26076
26186
|
};
|
|
26077
26187
|
});
|
|
26078
26188
|
const rawSlots = component.$slots ?? {};
|
|
26079
|
-
const slots = Object.entries(rawSlots).map(([
|
|
26189
|
+
const slots = Object.entries(rawSlots).map(([name, raw]) => {
|
|
26080
26190
|
const s = raw ?? {};
|
|
26081
26191
|
return {
|
|
26082
|
-
name
|
|
26192
|
+
name,
|
|
26083
26193
|
description: typeof s.$description === "string" ? s.$description : "",
|
|
26084
26194
|
required: s.$required === true,
|
|
26085
26195
|
allowedComponents: Array.isArray(s.$allowedComponents) ? s.$allowedComponents.filter((v) => typeof v === "string") : []
|
|
@@ -26187,7 +26297,7 @@ function DefaultValueRow({
|
|
|
26187
26297
|
] });
|
|
26188
26298
|
}
|
|
26189
26299
|
function RowLabel({
|
|
26190
|
-
name
|
|
26300
|
+
name,
|
|
26191
26301
|
selected,
|
|
26192
26302
|
trailing = true
|
|
26193
26303
|
}) {
|
|
@@ -26200,7 +26310,7 @@ function RowLabel({
|
|
|
26200
26310
|
wrap: "truncate-end",
|
|
26201
26311
|
children: [
|
|
26202
26312
|
" ",
|
|
26203
|
-
|
|
26313
|
+
name,
|
|
26204
26314
|
trailing ? " " : ""
|
|
26205
26315
|
]
|
|
26206
26316
|
}
|
|
@@ -26552,10 +26662,10 @@ function SlotRow({
|
|
|
26552
26662
|
const slice = filtered.slice(start, start + MAX_VISIBLE);
|
|
26553
26663
|
return /* @__PURE__ */ jsxs26(Box26, { flexDirection: "column", children: [
|
|
26554
26664
|
/* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: " candidates (\u2191\u2193 cycle, Enter to add):" }),
|
|
26555
|
-
slice.map((
|
|
26665
|
+
slice.map((name, i) => {
|
|
26556
26666
|
const absIdx = start + i;
|
|
26557
26667
|
const isCursor = absIdx === cursor;
|
|
26558
|
-
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${
|
|
26668
|
+
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${name}` : ` ${name}` }, name);
|
|
26559
26669
|
})
|
|
26560
26670
|
] });
|
|
26561
26671
|
})() })
|
|
@@ -27451,8 +27561,8 @@ function FieldEditor({
|
|
|
27451
27561
|
const hasEmptyProperties = props.length === 0 && slots.length === 0;
|
|
27452
27562
|
const modeLabel = (() => {
|
|
27453
27563
|
if (pendingDelete) {
|
|
27454
|
-
const
|
|
27455
|
-
return `Delete ${pendingDelete.kind} "${
|
|
27564
|
+
const name = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
|
|
27565
|
+
return `Delete ${pendingDelete.kind} "${name}"? [y] delete \xB7 any other key cancels`;
|
|
27456
27566
|
}
|
|
27457
27567
|
if (editingValue) {
|
|
27458
27568
|
return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
|
|
@@ -28677,7 +28787,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
28677
28787
|
);
|
|
28678
28788
|
db.exec("BEGIN");
|
|
28679
28789
|
try {
|
|
28680
|
-
for (const
|
|
28790
|
+
for (const name of toReject) statement.run(extractSessionId, name);
|
|
28681
28791
|
db.exec("COMMIT");
|
|
28682
28792
|
} catch (error) {
|
|
28683
28793
|
db.exec("ROLLBACK");
|
|
@@ -29661,13 +29771,13 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
29661
29771
|
const unchanged = new Set(preview.components.unchanged);
|
|
29662
29772
|
const changedNames = /* @__PURE__ */ new Set();
|
|
29663
29773
|
for (const item of preview.components.changed) {
|
|
29664
|
-
const
|
|
29665
|
-
if (typeof
|
|
29666
|
-
changedNames.add(
|
|
29774
|
+
const name = item.current?.name;
|
|
29775
|
+
if (typeof name !== "string") continue;
|
|
29776
|
+
changedNames.add(name);
|
|
29667
29777
|
if (item.changeClassification?.classification === "breaking") {
|
|
29668
|
-
out.set(
|
|
29778
|
+
out.set(name, "breaking");
|
|
29669
29779
|
} else {
|
|
29670
|
-
out.set(
|
|
29780
|
+
out.set(name, "changed");
|
|
29671
29781
|
}
|
|
29672
29782
|
}
|
|
29673
29783
|
const removedNames = /* @__PURE__ */ new Set();
|
|
@@ -29677,12 +29787,12 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
29677
29787
|
out.set(entity.name, "removed");
|
|
29678
29788
|
}
|
|
29679
29789
|
}
|
|
29680
|
-
for (const
|
|
29681
|
-
if (unchanged.has(
|
|
29682
|
-
if (changedNames.has(
|
|
29683
|
-
if (removedNames.has(
|
|
29684
|
-
if (out.has(
|
|
29685
|
-
out.set(
|
|
29790
|
+
for (const name of localNames) {
|
|
29791
|
+
if (unchanged.has(name)) continue;
|
|
29792
|
+
if (changedNames.has(name)) continue;
|
|
29793
|
+
if (removedNames.has(name)) continue;
|
|
29794
|
+
if (out.has(name)) continue;
|
|
29795
|
+
out.set(name, "new");
|
|
29686
29796
|
}
|
|
29687
29797
|
return out;
|
|
29688
29798
|
}
|
|
@@ -30407,10 +30517,10 @@ function GenerateReviewStepView({
|
|
|
30407
30517
|
const merged = /* @__PURE__ */ new Map();
|
|
30408
30518
|
for (const closure of closures.values()) {
|
|
30409
30519
|
const per = computeRenderStatuses(closure, directIssues);
|
|
30410
|
-
for (const [
|
|
30411
|
-
const existing = merged.get(
|
|
30520
|
+
for (const [name, rs] of per.entries()) {
|
|
30521
|
+
const existing = merged.get(name);
|
|
30412
30522
|
if (!existing || !existing.isOwn && rs.isOwn) {
|
|
30413
|
-
merged.set(
|
|
30523
|
+
merged.set(name, rs);
|
|
30414
30524
|
}
|
|
30415
30525
|
}
|
|
30416
30526
|
}
|
|
@@ -30465,11 +30575,11 @@ function GenerateReviewStepView({
|
|
|
30465
30575
|
reviewEditor.setSaveError(null);
|
|
30466
30576
|
setPendingEditorFocus(null);
|
|
30467
30577
|
};
|
|
30468
|
-
const jumpCursorToName = (
|
|
30578
|
+
const jumpCursorToName = (name) => {
|
|
30469
30579
|
for (let i = 0; i < visibleRowsMemo.length; i++) {
|
|
30470
30580
|
const row = visibleRowsMemo[i];
|
|
30471
30581
|
if (row.itemIdx < 0) continue;
|
|
30472
|
-
if (components[row.itemIdx]?.key ===
|
|
30582
|
+
if (components[row.itemIdx]?.key === name) {
|
|
30473
30583
|
jumpCursorToRow(i);
|
|
30474
30584
|
return;
|
|
30475
30585
|
}
|
|
@@ -30997,8 +31107,8 @@ function GenerateReviewStepView({
|
|
|
30997
31107
|
}
|
|
30998
31108
|
),
|
|
30999
31109
|
!dialogOpen && autoRejected.length > 0 && (() => {
|
|
31000
|
-
const stillRejected = autoRejected.filter((
|
|
31001
|
-
const c2 = components.find((x) => x.key ===
|
|
31110
|
+
const stillRejected = autoRejected.filter((name) => {
|
|
31111
|
+
const c2 = components.find((x) => x.key === name);
|
|
31002
31112
|
return c2?.status === "rejected";
|
|
31003
31113
|
});
|
|
31004
31114
|
if (stillRejected.length === 0) return null;
|
|
@@ -31680,31 +31790,31 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
31680
31790
|
const proposedProperties = proposed["$properties"] ?? {};
|
|
31681
31791
|
const proposedProps = new Set(Object.keys(proposedProperties));
|
|
31682
31792
|
const oldProps = current.fullProperties;
|
|
31683
|
-
for (const
|
|
31684
|
-
if (!currentProps.has(
|
|
31685
|
-
const def = proposedProperties[
|
|
31686
|
-
lines.push({ key: `${
|
|
31793
|
+
for (const name of [...proposedProps].sort()) {
|
|
31794
|
+
if (!currentProps.has(name)) {
|
|
31795
|
+
const def = proposedProperties[name];
|
|
31796
|
+
lines.push({ key: `${name}-add`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(def)}` });
|
|
31687
31797
|
}
|
|
31688
31798
|
}
|
|
31689
|
-
for (const
|
|
31690
|
-
if (!proposedProps.has(
|
|
31691
|
-
if (oldProps?.[
|
|
31692
|
-
lines.push({ key: `${
|
|
31799
|
+
for (const name of [...currentProps].sort()) {
|
|
31800
|
+
if (!proposedProps.has(name)) {
|
|
31801
|
+
if (oldProps?.[name]) {
|
|
31802
|
+
lines.push({ key: `${name}-rm`, color: PALETTE.error, text: `- ${name}: ${formatOldProp(oldProps[name])}` });
|
|
31693
31803
|
} else {
|
|
31694
|
-
const cat = current.contentProperties.includes(
|
|
31695
|
-
lines.push({ key: `${
|
|
31804
|
+
const cat = current.contentProperties.includes(name) ? "content" : "design";
|
|
31805
|
+
lines.push({ key: `${name}-rm`, color: PALETTE.error, text: `- ${name} (${cat})` });
|
|
31696
31806
|
}
|
|
31697
31807
|
}
|
|
31698
31808
|
}
|
|
31699
31809
|
const handledProps = /* @__PURE__ */ new Set();
|
|
31700
|
-
for (const
|
|
31701
|
-
if (!proposedProps.has(
|
|
31702
|
-
const newDef = proposedProperties[
|
|
31703
|
-
const oldDef = oldProps?.[
|
|
31810
|
+
for (const name of [...currentProps].sort()) {
|
|
31811
|
+
if (!proposedProps.has(name)) continue;
|
|
31812
|
+
const newDef = proposedProperties[name];
|
|
31813
|
+
const oldDef = oldProps?.[name];
|
|
31704
31814
|
if (!oldDef) continue;
|
|
31705
|
-
const diffs = diffProperty(
|
|
31815
|
+
const diffs = diffProperty(name, oldDef, newDef);
|
|
31706
31816
|
if (diffs.length > 0) {
|
|
31707
|
-
handledProps.add(
|
|
31817
|
+
handledProps.add(name);
|
|
31708
31818
|
for (const d of diffs) lines.push(d);
|
|
31709
31819
|
}
|
|
31710
31820
|
}
|
|
@@ -31727,40 +31837,40 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
31727
31837
|
const proposedSlots = proposed["$slots"] ?? {};
|
|
31728
31838
|
const proposedSlotNames = new Set(Object.keys(proposedSlots));
|
|
31729
31839
|
const currentSlotAllowed = current.currentSlotAllowed ?? {};
|
|
31730
|
-
for (const
|
|
31731
|
-
if (!currentSlots.has(
|
|
31732
|
-
lines.push({ key: `slot-${
|
|
31840
|
+
for (const name of [...proposedSlotNames].sort()) {
|
|
31841
|
+
if (!currentSlots.has(name)) {
|
|
31842
|
+
lines.push({ key: `slot-${name}-add`, color: PALETTE.success, text: `+ slot: ${name}` });
|
|
31733
31843
|
}
|
|
31734
31844
|
}
|
|
31735
|
-
for (const
|
|
31736
|
-
if (!proposedSlotNames.has(
|
|
31737
|
-
lines.push({ key: `slot-${
|
|
31845
|
+
for (const name of [...currentSlots].sort()) {
|
|
31846
|
+
if (!proposedSlotNames.has(name)) {
|
|
31847
|
+
lines.push({ key: `slot-${name}-rm`, color: PALETTE.error, text: `- slot: ${name}` });
|
|
31738
31848
|
}
|
|
31739
31849
|
}
|
|
31740
|
-
for (const
|
|
31741
|
-
const nextAllowed = normalizeAllowedComponents(proposedSlots[
|
|
31742
|
-
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[
|
|
31743
|
-
const prevExists = currentSlots.has(
|
|
31850
|
+
for (const name of [...proposedSlotNames].sort()) {
|
|
31851
|
+
const nextAllowed = normalizeAllowedComponents(proposedSlots[name]?.["$allowedComponents"]);
|
|
31852
|
+
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[name]);
|
|
31853
|
+
const prevExists = currentSlots.has(name);
|
|
31744
31854
|
if (!prevExists) {
|
|
31745
31855
|
if (nextAllowed.length > 0) {
|
|
31746
31856
|
lines.push({
|
|
31747
|
-
key: `slot-${
|
|
31857
|
+
key: `slot-${name}-allow-new`,
|
|
31748
31858
|
color: PALETTE.success,
|
|
31749
|
-
text: `+ slot ${
|
|
31859
|
+
text: `+ slot ${name} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
31750
31860
|
});
|
|
31751
31861
|
}
|
|
31752
31862
|
continue;
|
|
31753
31863
|
}
|
|
31754
31864
|
if (arraysEqual(prevAllowed, nextAllowed)) continue;
|
|
31755
31865
|
lines.push({
|
|
31756
|
-
key: `slot-${
|
|
31866
|
+
key: `slot-${name}-allow-old`,
|
|
31757
31867
|
color: PALETTE.error,
|
|
31758
|
-
text: `- slot ${
|
|
31868
|
+
text: `- slot ${name} allowedComponents: [${prevAllowed.join(", ")}]`
|
|
31759
31869
|
});
|
|
31760
31870
|
lines.push({
|
|
31761
|
-
key: `slot-${
|
|
31871
|
+
key: `slot-${name}-allow-new`,
|
|
31762
31872
|
color: PALETTE.success,
|
|
31763
|
-
text: `+ slot ${
|
|
31873
|
+
text: `+ slot ${name} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
31764
31874
|
});
|
|
31765
31875
|
}
|
|
31766
31876
|
return lines;
|
|
@@ -31796,7 +31906,7 @@ function normalizeType(type) {
|
|
|
31796
31906
|
return type.toLowerCase();
|
|
31797
31907
|
}
|
|
31798
31908
|
}
|
|
31799
|
-
function diffProperty(
|
|
31909
|
+
function diffProperty(name, old, newDef) {
|
|
31800
31910
|
const diffs = [];
|
|
31801
31911
|
const newType = newDef["$type"] ?? "";
|
|
31802
31912
|
const newCategory = newDef["$category"] ?? "";
|
|
@@ -31807,15 +31917,15 @@ function diffProperty(name2, old, newDef) {
|
|
|
31807
31917
|
const requiredChanged = old.required !== newRequired;
|
|
31808
31918
|
const defaultChanged = JSON.stringify(old.default) !== JSON.stringify(newDefault);
|
|
31809
31919
|
if (!typeChanged && !categoryChanged && !requiredChanged && !defaultChanged) return [];
|
|
31810
|
-
diffs.push({ key: `${
|
|
31811
|
-
diffs.push({ key: `${
|
|
31920
|
+
diffs.push({ key: `${name}-old`, color: PALETTE.error, text: `- ${name}: ${formatOldProp(old)}` });
|
|
31921
|
+
diffs.push({ key: `${name}-new`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(newDef)}` });
|
|
31812
31922
|
return diffs;
|
|
31813
31923
|
}
|
|
31814
31924
|
function formatDefault(value) {
|
|
31815
31925
|
const sys = value?.sys;
|
|
31816
31926
|
if (sys?.linkType === "Contentful:DesignToken" && typeof sys.urn === "string") {
|
|
31817
|
-
const
|
|
31818
|
-
if (
|
|
31927
|
+
const name = sys.urn.split("/designTokens/")[1];
|
|
31928
|
+
if (name) return name;
|
|
31819
31929
|
}
|
|
31820
31930
|
return JSON.stringify(value);
|
|
31821
31931
|
}
|
|
@@ -31881,8 +31991,8 @@ function buildPreviewSummaryLines(preview) {
|
|
|
31881
31991
|
text: ` \uFF0B ${components.new.length} components will be created`
|
|
31882
31992
|
});
|
|
31883
31993
|
for (const [index, item] of components.new.entries()) {
|
|
31884
|
-
const
|
|
31885
|
-
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${
|
|
31994
|
+
const name = item.key ?? item.$name ?? "unknown";
|
|
31995
|
+
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${name}` });
|
|
31886
31996
|
}
|
|
31887
31997
|
}
|
|
31888
31998
|
if (components.changed.length > 0) {
|
|
@@ -31975,27 +32085,27 @@ function getPreviewScrollOffset(input, downArrow, upArrow, diffExpanded, current
|
|
|
31975
32085
|
}
|
|
31976
32086
|
return void 0;
|
|
31977
32087
|
}
|
|
31978
|
-
function appendChangedPreviewLine(lines, keyPrefix,
|
|
32088
|
+
function appendChangedPreviewLine(lines, keyPrefix, name, hasPendingDraftChanges, changeClassification) {
|
|
31979
32089
|
lines.push({
|
|
31980
|
-
key: `${keyPrefix}-h-${
|
|
32090
|
+
key: `${keyPrefix}-h-${name}`,
|
|
31981
32091
|
color: PALETTE.warning,
|
|
31982
|
-
text: ` ~ ${
|
|
32092
|
+
text: ` ~ ${name}${hasPendingDraftChanges ? " \u26A1 has pending draft changes" : ""}`
|
|
31983
32093
|
});
|
|
31984
32094
|
if (changeClassification?.classification !== "breaking") return;
|
|
31985
32095
|
const reasons = changeClassification.breakingChanges.map((bc) => `${"slotId" in bc ? bc.slotId : bc.propertyId}: ${bc.reason}`).join(", ");
|
|
31986
|
-
lines.push({ key: `${keyPrefix}-b-${
|
|
32096
|
+
lines.push({ key: `${keyPrefix}-b-${name}`, color: PALETTE.error, text: ` \u26A0 BREAKING: ${reasons}` });
|
|
31987
32097
|
}
|
|
31988
32098
|
function buildPreviewDiffLines(preview) {
|
|
31989
32099
|
const lines = [];
|
|
31990
32100
|
const { components, tokens } = preview;
|
|
31991
32101
|
for (const item of components.new) {
|
|
31992
32102
|
const raw = item;
|
|
31993
|
-
const
|
|
31994
|
-
lines.push({ key: `comp-new-${
|
|
32103
|
+
const name = raw.key ?? raw.$name ?? "unknown";
|
|
32104
|
+
lines.push({ key: `comp-new-${name}`, color: PALETTE.success, text: ` + ${name}` });
|
|
31995
32105
|
const slots = raw.$slots ?? {};
|
|
31996
32106
|
for (const slotName of Object.keys(slots).sort()) {
|
|
31997
32107
|
lines.push({
|
|
31998
|
-
key: `comp-new-${
|
|
32108
|
+
key: `comp-new-${name}-slot-${slotName}`,
|
|
31999
32109
|
color: PALETTE.success,
|
|
32000
32110
|
text: ` slot: ${slotName}`
|
|
32001
32111
|
});
|
|
@@ -32003,7 +32113,7 @@ function buildPreviewDiffLines(preview) {
|
|
|
32003
32113
|
if (Array.isArray(allowed) && allowed.length > 0) {
|
|
32004
32114
|
const names = allowed.filter((n) => typeof n === "string");
|
|
32005
32115
|
lines.push({
|
|
32006
|
-
key: `comp-new-${
|
|
32116
|
+
key: `comp-new-${name}-slot-${slotName}-allow`,
|
|
32007
32117
|
color: PALETTE.success,
|
|
32008
32118
|
text: ` allowedComponents: [${names.join(", ")}]`
|
|
32009
32119
|
});
|
|
@@ -32041,8 +32151,8 @@ function buildPreviewDiffLines(preview) {
|
|
|
32041
32151
|
}
|
|
32042
32152
|
for (const item of tokens.new) {
|
|
32043
32153
|
const raw = item;
|
|
32044
|
-
const
|
|
32045
|
-
lines.push({ key: `tok-new-${
|
|
32154
|
+
const name = raw.name ?? raw.path ?? "unknown";
|
|
32155
|
+
lines.push({ key: `tok-new-${name}`, color: PALETTE.success, text: ` + ${name}` });
|
|
32046
32156
|
}
|
|
32047
32157
|
for (const item of tokens.removed) {
|
|
32048
32158
|
lines.push({ key: `tok-rm-${item.name}`, color: PALETTE.error, text: ` - ${item.name}` });
|
|
@@ -33350,7 +33460,7 @@ var init_PageContainer3 = __esm({
|
|
|
33350
33460
|
import { existsSync as existsSync11 } from "node:fs";
|
|
33351
33461
|
function diffSnapshots(before, after) {
|
|
33352
33462
|
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
|
|
33353
|
-
const changed_fields = names.filter((
|
|
33463
|
+
const changed_fields = names.filter((name) => before[name] !== after[name]);
|
|
33354
33464
|
return { changed: changed_fields.length > 0, changed_fields };
|
|
33355
33465
|
}
|
|
33356
33466
|
function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
|
|
@@ -33388,11 +33498,11 @@ var init_debug_trail = __esm({
|
|
|
33388
33498
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
|
|
33389
33499
|
import { execFile as execFile2 } from "node:child_process";
|
|
33390
33500
|
import { access as access5, constants } from "node:fs/promises";
|
|
33391
|
-
function effectiveBinary(
|
|
33392
|
-
return savedBinary.trim() || AGENT_BINARIES[
|
|
33501
|
+
function effectiveBinary(name, savedBinary) {
|
|
33502
|
+
return savedBinary.trim() || AGENT_BINARIES[name];
|
|
33393
33503
|
}
|
|
33394
|
-
function defaultModelLabel(
|
|
33395
|
-
const model = DEFAULT_MODELS[
|
|
33504
|
+
function defaultModelLabel(name) {
|
|
33505
|
+
const model = DEFAULT_MODELS[name];
|
|
33396
33506
|
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
33397
33507
|
}
|
|
33398
33508
|
function resolveOnPath(binary) {
|
|
@@ -33419,32 +33529,32 @@ function readVersion(binary) {
|
|
|
33419
33529
|
});
|
|
33420
33530
|
});
|
|
33421
33531
|
}
|
|
33422
|
-
async function inspect(
|
|
33423
|
-
const target = effectiveBinary(
|
|
33532
|
+
async function inspect(name, binary) {
|
|
33533
|
+
const target = effectiveBinary(name, binary);
|
|
33424
33534
|
const found = await resolveOnPath(target);
|
|
33425
33535
|
if (!found) return { checks: [fail3("path", `\`${target}\` was not found or is not executable`)], found: null };
|
|
33426
33536
|
const checks = [pass("path", found)];
|
|
33427
33537
|
checks.push(await readVersion(found));
|
|
33428
|
-
if (
|
|
33429
|
-
const auth = await withBinaryEnv(
|
|
33538
|
+
if (name === "claude") {
|
|
33539
|
+
const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
|
|
33430
33540
|
checks.push(
|
|
33431
33541
|
auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
33432
33542
|
);
|
|
33433
33543
|
}
|
|
33434
33544
|
return { checks, found };
|
|
33435
33545
|
}
|
|
33436
|
-
async function inspectAgent(
|
|
33437
|
-
return (await inspect(
|
|
33546
|
+
async function inspectAgent(name, binary) {
|
|
33547
|
+
return (await inspect(name, binary)).checks;
|
|
33438
33548
|
}
|
|
33439
|
-
async function testAgent(
|
|
33440
|
-
const { checks, found } = await inspect(
|
|
33549
|
+
async function testAgent(name, binary, model) {
|
|
33550
|
+
const { checks, found } = await inspect(name, binary);
|
|
33441
33551
|
if (!found || !checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
33442
33552
|
const started = Date.now();
|
|
33443
33553
|
const result = await withBinaryEnv(
|
|
33444
|
-
|
|
33554
|
+
name,
|
|
33445
33555
|
found,
|
|
33446
33556
|
() => createLocalCliAgentInvoker().invoke({
|
|
33447
|
-
agent:
|
|
33557
|
+
agent: name,
|
|
33448
33558
|
...model.trim() ? { model: model.trim() } : {},
|
|
33449
33559
|
prompt: TEST_PROMPT,
|
|
33450
33560
|
timeoutMs: PROMPT_TIMEOUT_MS
|
|
@@ -33460,7 +33570,7 @@ async function testAgent(name2, binary, model) {
|
|
|
33460
33570
|
}
|
|
33461
33571
|
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
33462
33572
|
}
|
|
33463
|
-
function statusFromChecks(
|
|
33573
|
+
function statusFromChecks(name, checks, savedBinary) {
|
|
33464
33574
|
if (checks.length === 0) return "checking";
|
|
33465
33575
|
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
33466
33576
|
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
@@ -33472,13 +33582,13 @@ function statusFromChecks(name2, checks, savedBinary) {
|
|
|
33472
33582
|
}
|
|
33473
33583
|
const login = checks.find((check) => check.step === "login");
|
|
33474
33584
|
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
33475
|
-
return
|
|
33585
|
+
return name === "claude" ? "ready" : "unknown";
|
|
33476
33586
|
}
|
|
33477
|
-
function setupHint(
|
|
33478
|
-
if (status === "not-configured") return `${INSTALL_HINTS[
|
|
33479
|
-
if (status === "not-found") return `${INSTALL_HINTS[
|
|
33480
|
-
if (status === "not-logged-in") return LOGIN_HINTS[
|
|
33481
|
-
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[
|
|
33587
|
+
function setupHint(name, status) {
|
|
33588
|
+
if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set its command path in settings`;
|
|
33589
|
+
if (status === "not-found") return `${INSTALL_HINTS[name]}, or correct the command path in settings`;
|
|
33590
|
+
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
33591
|
+
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name]}`;
|
|
33482
33592
|
if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
|
|
33483
33593
|
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
33484
33594
|
return "";
|
|
@@ -33490,14 +33600,14 @@ function testOutcome(checks) {
|
|
|
33490
33600
|
if (prompt.timedOut) return { ok: false, text: `Test timed out: ${prompt.detail}` };
|
|
33491
33601
|
return { ok: false, text: `Test failed: ${prompt.detail}` };
|
|
33492
33602
|
}
|
|
33493
|
-
function modelLine(
|
|
33603
|
+
function modelLine(name, savedModel) {
|
|
33494
33604
|
const model = savedModel.trim();
|
|
33495
|
-
return model ? model : `${defaultModelLabel(
|
|
33605
|
+
return model ? model : `${defaultModelLabel(name)} (built-in default)`;
|
|
33496
33606
|
}
|
|
33497
|
-
function baseRows(
|
|
33607
|
+
function baseRows(name, checks, savedBinary) {
|
|
33498
33608
|
const path5 = checks.find((check) => check.step === "path");
|
|
33499
33609
|
const version2 = checks.find((check) => check.step === "version");
|
|
33500
|
-
const hint = setupHint(
|
|
33610
|
+
const hint = setupHint(name, statusFromChecks(name, checks, savedBinary));
|
|
33501
33611
|
const setup = hint ? { label: "Setup", value: hint, tone: "muted" } : void 0;
|
|
33502
33612
|
if (!path5?.ok) {
|
|
33503
33613
|
const saved = savedBinary.trim() !== "";
|
|
@@ -33519,15 +33629,15 @@ function baseRows(name2, checks, savedBinary) {
|
|
|
33519
33629
|
found: true
|
|
33520
33630
|
};
|
|
33521
33631
|
}
|
|
33522
|
-
function panelRows(
|
|
33632
|
+
function panelRows(name, checks, settings) {
|
|
33523
33633
|
if (!checks) return checking;
|
|
33524
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
33525
|
-
const model = { label: "Model", value: modelLine(
|
|
33634
|
+
const { command, version: version2, setup, found } = baseRows(name, checks, settings.binary);
|
|
33635
|
+
const model = { label: "Model", value: modelLine(name, settings.model), tone: "muted" };
|
|
33526
33636
|
return [command, ...found ? [...version2?.tone === "ok" ? [version2] : [], model] : [], ...setup ? [setup] : []];
|
|
33527
33637
|
}
|
|
33528
|
-
function statusRows(
|
|
33638
|
+
function statusRows(name, checks, savedBinary) {
|
|
33529
33639
|
if (!checks) return checking;
|
|
33530
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
33640
|
+
const { command, version: version2, setup, found } = baseRows(name, checks, savedBinary);
|
|
33531
33641
|
if (!found) return [command];
|
|
33532
33642
|
const login = checks.find((check) => check.step === "login");
|
|
33533
33643
|
const prompt = checks.find((check) => check.step === "prompt");
|
|
@@ -33546,8 +33656,8 @@ function statusRows(name2, checks, savedBinary) {
|
|
|
33546
33656
|
const testRow = prompt ? [{ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" }] : [];
|
|
33547
33657
|
return [command, ...version2 ? [version2] : [], loginRow, ...testRow, ...setup ? [setup] : []];
|
|
33548
33658
|
}
|
|
33549
|
-
async function withBinaryEnv(
|
|
33550
|
-
const key = `EDS_AGENT_BINARY_${
|
|
33659
|
+
async function withBinaryEnv(name, binary, run) {
|
|
33660
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
33551
33661
|
const previous = process.env[key];
|
|
33552
33662
|
process.env[key] = binary;
|
|
33553
33663
|
try {
|
|
@@ -33598,9 +33708,9 @@ var init_agent_status = __esm({
|
|
|
33598
33708
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-debug.ts
|
|
33599
33709
|
function agentSnapshot(config) {
|
|
33600
33710
|
const snapshot = { default_agent: config.defaultAgent };
|
|
33601
|
-
for (const
|
|
33602
|
-
snapshot[`${
|
|
33603
|
-
snapshot[`${
|
|
33711
|
+
for (const name of AGENT_NAMES) {
|
|
33712
|
+
snapshot[`${name}.model`] = config.agents[name].model;
|
|
33713
|
+
snapshot[`${name}.binary`] = config.agents[name].binary;
|
|
33604
33714
|
}
|
|
33605
33715
|
return snapshot;
|
|
33606
33716
|
}
|
|
@@ -33617,10 +33727,10 @@ function environmentFrom(checks, savedBinary, envValue) {
|
|
|
33617
33727
|
}
|
|
33618
33728
|
async function describeAgents(config) {
|
|
33619
33729
|
const entries = await Promise.all(
|
|
33620
|
-
AGENT_NAMES.map(async (
|
|
33621
|
-
const saved = config.agents[
|
|
33622
|
-
const checks = await inspectAgent(
|
|
33623
|
-
return [
|
|
33730
|
+
AGENT_NAMES.map(async (name) => {
|
|
33731
|
+
const saved = config.agents[name].binary;
|
|
33732
|
+
const checks = await inspectAgent(name, saved);
|
|
33733
|
+
return [name, environmentFrom(checks, saved, process.env[`EDS_AGENT_BINARY_${name.toUpperCase()}`])];
|
|
33624
33734
|
})
|
|
33625
33735
|
);
|
|
33626
33736
|
return Object.fromEntries(entries);
|
|
@@ -33637,11 +33747,11 @@ var init_agent_debug = __esm({
|
|
|
33637
33747
|
import { Text as Text49 } from "ink";
|
|
33638
33748
|
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
33639
33749
|
function AgentStatusBadge({
|
|
33640
|
-
name
|
|
33750
|
+
name,
|
|
33641
33751
|
checks,
|
|
33642
33752
|
binary
|
|
33643
33753
|
}) {
|
|
33644
|
-
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(
|
|
33754
|
+
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(name, checks, binary) : "checking"];
|
|
33645
33755
|
return /* @__PURE__ */ jsx59(Text49, { color: TONE_COLOR[tone], children: `${symbol} ${text}` });
|
|
33646
33756
|
}
|
|
33647
33757
|
var TONE_COLOR;
|
|
@@ -33669,13 +33779,13 @@ function StatusHeading() {
|
|
|
33669
33779
|
] });
|
|
33670
33780
|
}
|
|
33671
33781
|
function AgentDetail({
|
|
33672
|
-
name
|
|
33782
|
+
name,
|
|
33673
33783
|
config,
|
|
33674
33784
|
setConfig,
|
|
33675
33785
|
onBack,
|
|
33676
33786
|
record: record3
|
|
33677
33787
|
}) {
|
|
33678
|
-
const settings = config.agents[
|
|
33788
|
+
const settings = config.agents[name];
|
|
33679
33789
|
const [saving, setSaving] = useState33(false);
|
|
33680
33790
|
const [testing, setTesting] = useState33(false);
|
|
33681
33791
|
const [notice, setNotice] = useState33(null);
|
|
@@ -33684,38 +33794,38 @@ function AgentDetail({
|
|
|
33684
33794
|
let active = true;
|
|
33685
33795
|
setChecks(void 0);
|
|
33686
33796
|
const timer = setTimeout(() => {
|
|
33687
|
-
void inspectAgent(
|
|
33797
|
+
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
33688
33798
|
}, INSPECT_DELAY_MS);
|
|
33689
33799
|
return () => {
|
|
33690
33800
|
active = false;
|
|
33691
33801
|
clearTimeout(timer);
|
|
33692
33802
|
};
|
|
33693
|
-
}, [
|
|
33803
|
+
}, [name, settings.binary]);
|
|
33694
33804
|
const save = () => {
|
|
33695
33805
|
setSaving(true);
|
|
33696
33806
|
setNotice(null);
|
|
33697
33807
|
writeAgentConfig(config).then(() => {
|
|
33698
33808
|
applyBinaryOverrides(config);
|
|
33699
|
-
record3(`saved ${
|
|
33700
|
-
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[
|
|
33809
|
+
record3(`saved ${name}`);
|
|
33810
|
+
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name]} settings are written to config.json` });
|
|
33701
33811
|
}).catch((err) => {
|
|
33702
|
-
record3(`saving ${
|
|
33812
|
+
record3(`saving ${name} failed`, err);
|
|
33703
33813
|
setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` });
|
|
33704
33814
|
}).finally(() => setSaving(false));
|
|
33705
33815
|
};
|
|
33706
33816
|
const runTest = () => {
|
|
33707
33817
|
setTesting(true);
|
|
33708
33818
|
setNotice(null);
|
|
33709
|
-
testAgent(
|
|
33819
|
+
testAgent(name, settings.binary, settings.model).then((result) => {
|
|
33710
33820
|
setChecks(result);
|
|
33711
33821
|
const outcome = testOutcome(result);
|
|
33712
33822
|
if (!outcome || !outcome.ok)
|
|
33713
|
-
record3(`test of ${
|
|
33823
|
+
record3(`test of ${name} failed: ${outcome?.text ?? "the agent could not be started"}`);
|
|
33714
33824
|
setNotice(
|
|
33715
33825
|
outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
|
|
33716
33826
|
);
|
|
33717
33827
|
}).catch((err) => {
|
|
33718
|
-
record3(`test of ${
|
|
33828
|
+
record3(`test of ${name} could not run`, err);
|
|
33719
33829
|
setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` });
|
|
33720
33830
|
}).finally(() => setTesting(false));
|
|
33721
33831
|
};
|
|
@@ -33726,19 +33836,19 @@ function AgentDetail({
|
|
|
33726
33836
|
hint: "run test",
|
|
33727
33837
|
onRun: runTest
|
|
33728
33838
|
};
|
|
33729
|
-
const formFields = fields(
|
|
33839
|
+
const formFields = fields(name);
|
|
33730
33840
|
const labelWidth = formLabelWidth([...formFields, action]);
|
|
33731
33841
|
return /* @__PURE__ */ jsx60(
|
|
33732
33842
|
FieldForm,
|
|
33733
33843
|
{
|
|
33734
|
-
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[
|
|
33735
|
-
subtitle: config.defaultAgent ===
|
|
33844
|
+
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[name]}`,
|
|
33845
|
+
subtitle: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_BINARIES[name]}\` command.`,
|
|
33736
33846
|
fields: formFields,
|
|
33737
33847
|
values: { binary: settings.binary, model: settings.model },
|
|
33738
33848
|
onChange: (key, value) => {
|
|
33739
|
-
setConfig({ ...config, agents: { ...config.agents, [
|
|
33849
|
+
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [key]: value } } });
|
|
33740
33850
|
setNotice(null);
|
|
33741
|
-
record3(`edited ${
|
|
33851
|
+
record3(`edited ${name}.${key}`);
|
|
33742
33852
|
},
|
|
33743
33853
|
onSave: save,
|
|
33744
33854
|
onQuit: onBack,
|
|
@@ -33747,7 +33857,7 @@ function AgentDetail({
|
|
|
33747
33857
|
busy: saving || testing,
|
|
33748
33858
|
children: /* @__PURE__ */ jsxs48(Box48, { flexDirection: "column", marginTop: 1, children: [
|
|
33749
33859
|
/* @__PURE__ */ jsx60(StatusHeading, {}),
|
|
33750
|
-
statusRows(
|
|
33860
|
+
statusRows(name, 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))
|
|
33751
33861
|
] })
|
|
33752
33862
|
}
|
|
33753
33863
|
);
|
|
@@ -33763,9 +33873,9 @@ var init_AgentDetail = __esm({
|
|
|
33763
33873
|
init_agent_status();
|
|
33764
33874
|
init_AgentStatusBadge();
|
|
33765
33875
|
init_apply_binary_overrides();
|
|
33766
|
-
fields = (
|
|
33767
|
-
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[
|
|
33768
|
-
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(
|
|
33876
|
+
fields = (name) => [
|
|
33877
|
+
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[name]}\` from the PATH)` },
|
|
33878
|
+
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name)})` }
|
|
33769
33879
|
];
|
|
33770
33880
|
INSPECT_DELAY_MS = 400;
|
|
33771
33881
|
}
|
|
@@ -33790,9 +33900,9 @@ function AgentsScreen({ onDone }) {
|
|
|
33790
33900
|
error: ""
|
|
33791
33901
|
}).current;
|
|
33792
33902
|
const inspectAll = (loaded) => {
|
|
33793
|
-
for (const
|
|
33794
|
-
void inspectAgent(
|
|
33795
|
-
(result) => setChecks((previous) => ({ ...previous, [
|
|
33903
|
+
for (const name of AGENT_NAMES) {
|
|
33904
|
+
void inspectAgent(name, loaded.agents[name].binary).then(
|
|
33905
|
+
(result) => setChecks((previous) => ({ ...previous, [name]: result }))
|
|
33796
33906
|
);
|
|
33797
33907
|
}
|
|
33798
33908
|
};
|
|
@@ -33832,21 +33942,21 @@ function AgentsScreen({ onDone }) {
|
|
|
33832
33942
|
exitMethod: change.changed ? "saved" : "discarded"
|
|
33833
33943
|
});
|
|
33834
33944
|
};
|
|
33835
|
-
const makeDefault = (
|
|
33945
|
+
const makeDefault = (name) => {
|
|
33836
33946
|
if (!config || saving) return;
|
|
33837
|
-
if (
|
|
33838
|
-
setNotice({ kind: "success", text: `${AGENT_LABELS[
|
|
33947
|
+
if (name === config.defaultAgent) {
|
|
33948
|
+
setNotice({ kind: "success", text: `${AGENT_LABELS[name]} is already the default agent` });
|
|
33839
33949
|
return;
|
|
33840
33950
|
}
|
|
33841
33951
|
setSaving(true);
|
|
33842
33952
|
setNotice(null);
|
|
33843
|
-
writeAgentConfig({ ...config, defaultAgent:
|
|
33844
|
-
setConfig((current) => current ? { ...current, defaultAgent:
|
|
33845
|
-
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[
|
|
33846
|
-
visit.trail.record(`made ${
|
|
33953
|
+
writeAgentConfig({ ...config, defaultAgent: name, defaultChosen: true }).then(() => {
|
|
33954
|
+
setConfig((current) => current ? { ...current, defaultAgent: name, defaultChosen: true } : current);
|
|
33955
|
+
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
|
|
33956
|
+
visit.trail.record(`made ${name} the default`);
|
|
33847
33957
|
}).catch((err) => {
|
|
33848
33958
|
visit.error = scrubError(err, []);
|
|
33849
|
-
visit.trail.record(`making ${
|
|
33959
|
+
visit.trail.record(`making ${name} the default failed`);
|
|
33850
33960
|
setNotice({ kind: "error", text: `Default agent not changed: ${visit.error}` });
|
|
33851
33961
|
}).finally(() => setSaving(false));
|
|
33852
33962
|
};
|
|
@@ -33933,14 +34043,14 @@ function AgentsScreen({ onDone }) {
|
|
|
33933
34043
|
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "AGENT" }) }),
|
|
33934
34044
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "STATUS" })
|
|
33935
34045
|
] }),
|
|
33936
|
-
AGENT_NAMES.map((
|
|
33937
|
-
const isFocused = focusedAgent ===
|
|
34046
|
+
AGENT_NAMES.map((name) => {
|
|
34047
|
+
const isFocused = focusedAgent === name;
|
|
33938
34048
|
return /* @__PURE__ */ jsxs49(Box49, { gap: 1, children: [
|
|
33939
34049
|
/* @__PURE__ */ jsx61(Text51, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " }),
|
|
33940
|
-
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children:
|
|
33941
|
-
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[
|
|
33942
|
-
/* @__PURE__ */ jsx61(AgentStatusBadge, { name
|
|
33943
|
-
] },
|
|
34050
|
+
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children: name === config.defaultAgent ? "\u2605" : " " }),
|
|
34051
|
+
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[name] }) }),
|
|
34052
|
+
/* @__PURE__ */ jsx61(AgentStatusBadge, { name, checks: checks[name], binary: config.agents[name].binary })
|
|
34053
|
+
] }, name);
|
|
33944
34054
|
}),
|
|
33945
34055
|
/* @__PURE__ */ jsxs49(Box49, { flexDirection: "column", marginTop: 1, children: [
|
|
33946
34056
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: `\u2500 ${AGENT_LABELS[focusedAgent]} ${"\u2500".repeat(30)}` }),
|