@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/app.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-cli/src/tui/package-root.ts
|
|
@@ -165,7 +165,7 @@ async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
|
165
165
|
const contentfulDir = join4(base, ".contentful");
|
|
166
166
|
const result = { logs: 0, folders: 0 };
|
|
167
167
|
try {
|
|
168
|
-
const sessions = (await readdir(contentfulDir)).filter((
|
|
168
|
+
const sessions = (await readdir(contentfulDir)).filter((name) => SESSION_FOLDER.test(name));
|
|
169
169
|
for (const session of sessions) {
|
|
170
170
|
const files = await logFilesIn(join4(contentfulDir, session, "debug")).catch(() => []);
|
|
171
171
|
for (const file of files) {
|
|
@@ -721,8 +721,8 @@ var init_extract_sentinel_output = __esm({
|
|
|
721
721
|
});
|
|
722
722
|
|
|
723
723
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/format-generate-progress-line.js
|
|
724
|
-
function formatGenerateProgressLine(done, total,
|
|
725
|
-
return `progress=generate:${done}/${total}:${
|
|
724
|
+
function formatGenerateProgressLine(done, total, name) {
|
|
725
|
+
return `progress=generate:${done}/${total}:${name}`;
|
|
726
726
|
}
|
|
727
727
|
var init_format_generate_progress_line = __esm({
|
|
728
728
|
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/format-generate-progress-line.js"() {
|
|
@@ -1408,14 +1408,14 @@ function formatToolCall(obj) {
|
|
|
1408
1408
|
return ` ${ansi.cyan("\u25C8")} ${slot}${req} ${ansi.dim(desc)}`;
|
|
1409
1409
|
}
|
|
1410
1410
|
case "select_component": {
|
|
1411
|
-
const
|
|
1411
|
+
const name = String(obj["name"] ?? "");
|
|
1412
1412
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1413
|
-
return ` ${ansi.green("+")} ${
|
|
1413
|
+
return ` ${ansi.green("+")} ${name} ${ansi.dim(reason)}`;
|
|
1414
1414
|
}
|
|
1415
1415
|
case "reject_component": {
|
|
1416
|
-
const
|
|
1416
|
+
const name = String(obj["name"] ?? "");
|
|
1417
1417
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1418
|
-
return ` ${ansi.dim("\u2013")} ${
|
|
1418
|
+
return ` ${ansi.dim("\u2013")} ${name} ${ansi.dim(reason)}`;
|
|
1419
1419
|
}
|
|
1420
1420
|
default:
|
|
1421
1421
|
return null;
|
|
@@ -3478,17 +3478,17 @@ var TRUNCATED_MARKER = "/* truncated */";
|
|
|
3478
3478
|
function escapeForRegExp(value) {
|
|
3479
3479
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3480
3480
|
}
|
|
3481
|
-
function identifierPattern(
|
|
3482
|
-
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(
|
|
3481
|
+
function identifierPattern(name) {
|
|
3482
|
+
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(name)}(?![A-Za-z0-9_$])`);
|
|
3483
3483
|
}
|
|
3484
3484
|
function excerptAroundNames(text, names, maxChars, contextLines = 6) {
|
|
3485
3485
|
if (text.length <= maxChars)
|
|
3486
3486
|
return { content: text, usesNotShown: [] };
|
|
3487
|
-
const patterns = names.filter((
|
|
3487
|
+
const patterns = names.filter((name) => name.length > 0).map((name) => ({ name, pattern: identifierPattern(name) }));
|
|
3488
3488
|
const lines = text.split("\n");
|
|
3489
3489
|
const windows = [];
|
|
3490
3490
|
lines.forEach((line, index) => {
|
|
3491
|
-
const mentioned = patterns.filter(({ pattern }) => pattern.test(line)).map(({ name
|
|
3491
|
+
const mentioned = patterns.filter(({ pattern }) => pattern.test(line)).map(({ name }) => name);
|
|
3492
3492
|
if (mentioned.length === 0)
|
|
3493
3493
|
return;
|
|
3494
3494
|
const start = Math.max(0, index - contextLines);
|
|
@@ -3496,8 +3496,8 @@ function excerptAroundNames(text, names, maxChars, contextLines = 6) {
|
|
|
3496
3496
|
const last = windows[windows.length - 1];
|
|
3497
3497
|
if (last && start <= last.end + 1) {
|
|
3498
3498
|
last.end = Math.max(last.end, end);
|
|
3499
|
-
for (const
|
|
3500
|
-
last.names.add(
|
|
3499
|
+
for (const name of mentioned)
|
|
3500
|
+
last.names.add(name);
|
|
3501
3501
|
} else {
|
|
3502
3502
|
windows.push({ start, end, names: new Set(mentioned) });
|
|
3503
3503
|
}
|
|
@@ -3508,8 +3508,8 @@ ${TRUNCATED_MARKER}`, usesNotShown: [] };
|
|
|
3508
3508
|
}
|
|
3509
3509
|
const lastWindowFor = /* @__PURE__ */ new Map();
|
|
3510
3510
|
for (const window of windows)
|
|
3511
|
-
for (const
|
|
3512
|
-
lastWindowFor.set(
|
|
3511
|
+
for (const name of window.names)
|
|
3512
|
+
lastWindowFor.set(name, window);
|
|
3513
3513
|
const kept = [];
|
|
3514
3514
|
const cut = /* @__PURE__ */ new Set();
|
|
3515
3515
|
let used = 0;
|
|
@@ -3523,15 +3523,15 @@ ${ELLIPSIS_MARKER}
|
|
|
3523
3523
|
const head = chunk.slice(0, maxChars);
|
|
3524
3524
|
kept.push({ window, text: head });
|
|
3525
3525
|
used += head.length;
|
|
3526
|
-
for (const
|
|
3527
|
-
if (lastWindowFor.get(
|
|
3528
|
-
cut.add(
|
|
3526
|
+
for (const name of window.names) {
|
|
3527
|
+
if (lastWindowFor.get(name) === window && !identifierPattern(name).test(head))
|
|
3528
|
+
cut.add(name);
|
|
3529
3529
|
}
|
|
3530
3530
|
continue;
|
|
3531
3531
|
}
|
|
3532
|
-
for (const
|
|
3533
|
-
if (lastWindowFor.get(
|
|
3534
|
-
cut.add(
|
|
3532
|
+
for (const name of window.names) {
|
|
3533
|
+
if (lastWindowFor.get(name) === window)
|
|
3534
|
+
cut.add(name);
|
|
3535
3535
|
}
|
|
3536
3536
|
continue;
|
|
3537
3537
|
}
|
|
@@ -3542,15 +3542,15 @@ ${ELLIPSIS_MARKER}
|
|
|
3542
3542
|
const parts = kept.map((entry, index) => (index > 0 ? `
|
|
3543
3543
|
${ELLIPSIS_MARKER}
|
|
3544
3544
|
` : "") + entry.text);
|
|
3545
|
-
const usesNotShown = names.filter((
|
|
3545
|
+
const usesNotShown = names.filter((name, index) => cut.has(name) && names.indexOf(name) === index);
|
|
3546
3546
|
return { content: `${parts.join("")}
|
|
3547
3547
|
${TRUNCATED_MARKER}`, usesNotShown };
|
|
3548
3548
|
}
|
|
3549
3549
|
|
|
3550
3550
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/components/derive-component-id.js
|
|
3551
3551
|
import { createHash } from "node:crypto";
|
|
3552
|
-
function deriveComponentId(
|
|
3553
|
-
return createHash("sha256").update(`${
|
|
3552
|
+
function deriveComponentId(name, source) {
|
|
3553
|
+
return createHash("sha256").update(`${name}:${source}`).digest("hex").slice(0, 12);
|
|
3554
3554
|
}
|
|
3555
3555
|
|
|
3556
3556
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cdf/cdf-mappers.js
|
|
@@ -3618,8 +3618,8 @@ function getLatestCompletedSessionForCommand(db, command) {
|
|
|
3618
3618
|
}
|
|
3619
3619
|
|
|
3620
3620
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/write.js
|
|
3621
|
-
function createSession(db, id,
|
|
3622
|
-
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id,
|
|
3621
|
+
function createSession(db, id, name, timestamp) {
|
|
3622
|
+
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id, name, timestamp, timestamp);
|
|
3623
3623
|
}
|
|
3624
3624
|
function updateSessionTimestamp(db, sessionId, timestamp) {
|
|
3625
3625
|
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(timestamp, sessionId);
|
|
@@ -4901,7 +4901,7 @@ function identifiersIn(propTypes) {
|
|
|
4901
4901
|
return [...names];
|
|
4902
4902
|
}
|
|
4903
4903
|
function declaresAnyType(text, typeNames) {
|
|
4904
|
-
return typeNames.some((
|
|
4904
|
+
return typeNames.some((name) => new RegExp(`\\b(?:type|interface|enum|const|class)\\s+${escapeForRegExp(name)}\\b`).test(text));
|
|
4905
4905
|
}
|
|
4906
4906
|
function extractRelativeImportPaths(sourceText) {
|
|
4907
4907
|
const specifiers = /* @__PURE__ */ new Set();
|
|
@@ -4966,7 +4966,7 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
4966
4966
|
frontier = nextFrontier;
|
|
4967
4967
|
}
|
|
4968
4968
|
const inHand = [sourceText, ...discovered.map((d) => d.content)];
|
|
4969
|
-
const declaredTypeNames = candidateTypeNames.filter((
|
|
4969
|
+
const declaredTypeNames = candidateTypeNames.filter((name) => inHand.some((text) => declaresAnyType(text, [name])));
|
|
4970
4970
|
const usesNotShown = /* @__PURE__ */ new Set();
|
|
4971
4971
|
const searchNames = [.../* @__PURE__ */ new Set([...propNames, ...declaredTypeNames])];
|
|
4972
4972
|
let enlarged = 0;
|
|
@@ -4976,19 +4976,19 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
4976
4976
|
enlarged++;
|
|
4977
4977
|
const budget = enlarge ? MAX_TYPE_DECLARING_SIBLING_CHARS : MAX_SIBLING_SNIPPET_CHARS;
|
|
4978
4978
|
const excerpt = excerptAroundNames(d.content, searchNames, budget);
|
|
4979
|
-
for (const
|
|
4980
|
-
usesNotShown.add(
|
|
4979
|
+
for (const name of excerpt.usesNotShown)
|
|
4980
|
+
usesNotShown.add(name);
|
|
4981
4981
|
return { path: d.path, content: excerpt.content };
|
|
4982
4982
|
});
|
|
4983
4983
|
const truncatedCount = Math.max(0, discovered.length - MAX_SIBLING_FILES);
|
|
4984
4984
|
return {
|
|
4985
4985
|
siblings,
|
|
4986
4986
|
truncatedCount,
|
|
4987
|
-
usesNotShown: propNames.filter((
|
|
4987
|
+
usesNotShown: propNames.filter((name) => usesNotShown.has(name)),
|
|
4988
4988
|
declaredTypeNames
|
|
4989
4989
|
};
|
|
4990
4990
|
}
|
|
4991
|
-
async function loadComponentSourceRef(
|
|
4991
|
+
async function loadComponentSourceRef(name, sourcePath, propNames = [], propTypes = []) {
|
|
4992
4992
|
let content = null;
|
|
4993
4993
|
let siblingFiles = [];
|
|
4994
4994
|
let truncatedSiblingCount = 0;
|
|
@@ -5005,18 +5005,18 @@ async function loadComponentSourceRef(name2, sourcePath, propNames = [], propTyp
|
|
|
5005
5005
|
} = await loadSiblingFiles(rawText, sourcePath, propNames, identifiersIn(propTypes)));
|
|
5006
5006
|
const mainExcerpt = excerptAroundNames(rawText, [.../* @__PURE__ */ new Set([...propNames, ...declaredTypeNames])], MAX_COMPONENT_SOURCE_CHARS);
|
|
5007
5007
|
content = mainExcerpt.content;
|
|
5008
|
-
for (const
|
|
5009
|
-
usesNotShown.add(
|
|
5010
|
-
for (const
|
|
5011
|
-
usesNotShown.add(
|
|
5008
|
+
for (const name2 of mainExcerpt.usesNotShown)
|
|
5009
|
+
usesNotShown.add(name2);
|
|
5010
|
+
for (const name2 of siblingUsesNotShown)
|
|
5011
|
+
usesNotShown.add(name2);
|
|
5012
5012
|
} catch {
|
|
5013
5013
|
}
|
|
5014
|
-
const ref = { component:
|
|
5014
|
+
const ref = { component: name, sourcePath, content };
|
|
5015
5015
|
if (siblingFiles.length > 0)
|
|
5016
5016
|
ref.siblingFiles = siblingFiles;
|
|
5017
5017
|
if (truncatedSiblingCount > 0)
|
|
5018
5018
|
ref.truncatedSiblingCount = truncatedSiblingCount;
|
|
5019
|
-
const notShown = propNames.filter((
|
|
5019
|
+
const notShown = propNames.filter((name2) => usesNotShown.has(name2));
|
|
5020
5020
|
if (notShown.length > 0)
|
|
5021
5021
|
ref.usesNotShown = notShown;
|
|
5022
5022
|
return ref;
|
|
@@ -5169,7 +5169,7 @@ function loadCDFComponents(db, sessionId) {
|
|
|
5169
5169
|
const allowedComponentsBySlot = indexRowsByKey(allowedComponents, (ac) => `${ac.component_id}::${ac.slot_name}`);
|
|
5170
5170
|
const tokenPathsByProp = indexRowsByKey(tokenPaths, (t) => `${t.component_id}::${t.prop_name}`);
|
|
5171
5171
|
const toTokenPaths = (rows) => rows === void 0 ? void 0 : rows.map((r) => r.path);
|
|
5172
|
-
return components.map(({ component_id, name
|
|
5172
|
+
return components.map(({ component_id, name, description }) => {
|
|
5173
5173
|
const compProps = propsByComponent.get(component_id) ?? [];
|
|
5174
5174
|
const $properties = {};
|
|
5175
5175
|
for (const p of compProps) {
|
|
@@ -5226,7 +5226,7 @@ function loadCDFComponents(db, sessionId) {
|
|
|
5226
5226
|
entry.$description = description;
|
|
5227
5227
|
if (Object.keys($slots).length > 0)
|
|
5228
5228
|
entry.$slots = $slots;
|
|
5229
|
-
return { key:
|
|
5229
|
+
return { key: name, entry };
|
|
5230
5230
|
});
|
|
5231
5231
|
}
|
|
5232
5232
|
function loadScopeComponents(db, sessionId) {
|
|
@@ -5815,29 +5815,29 @@ function extractTsxComponents(filePaths, componentFilePattern, extract) {
|
|
|
5815
5815
|
}
|
|
5816
5816
|
function resolveDefaultExportName(declarations, exported, allowVariableDeclaration = false) {
|
|
5817
5817
|
const declaration = declarations[0];
|
|
5818
|
-
const
|
|
5819
|
-
if (!
|
|
5818
|
+
const name = Node.isFunctionDeclaration(declaration) ? declaration.getName() : allowVariableDeclaration && Node.isVariableDeclaration(declaration) ? declaration.getName() : void 0;
|
|
5819
|
+
if (!name || !/^[A-Z]/.test(name) || exported.has(name))
|
|
5820
5820
|
return void 0;
|
|
5821
|
-
return
|
|
5821
|
+
return name;
|
|
5822
5822
|
}
|
|
5823
5823
|
function getRenderableExports(sourceFile, exclusions, options) {
|
|
5824
5824
|
const renderable = [];
|
|
5825
5825
|
const exported = sourceFile.getExportedDeclarations();
|
|
5826
5826
|
for (const [exportKey, declarations] of exported) {
|
|
5827
|
-
const
|
|
5828
|
-
if (!
|
|
5827
|
+
const name = exportKey === "default" ? resolveDefaultExportName(declarations, exported, options.allowVariableDeclaration) : exportKey;
|
|
5828
|
+
if (!name || !/^[A-Z]/.test(name))
|
|
5829
5829
|
continue;
|
|
5830
|
-
if (
|
|
5830
|
+
if (name.startsWith("use")) {
|
|
5831
5831
|
exclusions.push({
|
|
5832
5832
|
itemType: "component",
|
|
5833
|
-
name
|
|
5833
|
+
name,
|
|
5834
5834
|
source: sourceFile.getFilePath(),
|
|
5835
5835
|
reason: options.hookReason,
|
|
5836
5836
|
stage: "component-filter"
|
|
5837
5837
|
});
|
|
5838
5838
|
continue;
|
|
5839
5839
|
}
|
|
5840
|
-
renderable.push({ name
|
|
5840
|
+
renderable.push({ name, declarations });
|
|
5841
5841
|
}
|
|
5842
5842
|
return renderable;
|
|
5843
5843
|
}
|
|
@@ -6220,7 +6220,7 @@ function extractProps(classDecl) {
|
|
|
6220
6220
|
for (const property of classDecl.getProperties()) {
|
|
6221
6221
|
if (!hasDecorator(property, "Prop"))
|
|
6222
6222
|
continue;
|
|
6223
|
-
const
|
|
6223
|
+
const name = property.getName();
|
|
6224
6224
|
const typeNode = property.getTypeNode();
|
|
6225
6225
|
const typeText = typeNode ? typeNode.getText() : "unknown";
|
|
6226
6226
|
const hasQuestionToken = property.hasQuestionToken();
|
|
@@ -6258,21 +6258,21 @@ function extractProps(classDecl) {
|
|
|
6258
6258
|
}
|
|
6259
6259
|
const allowedValues = extractAllowedValues2(typeText);
|
|
6260
6260
|
props.push({
|
|
6261
|
-
name
|
|
6261
|
+
name,
|
|
6262
6262
|
type: typeText,
|
|
6263
6263
|
required: isRequired,
|
|
6264
6264
|
...defaultValue !== void 0 && { defaultValue },
|
|
6265
6265
|
...description && { description },
|
|
6266
6266
|
...allowedValues && { allowedValues },
|
|
6267
|
-
...intrinsicDomAttributeProps.has(
|
|
6267
|
+
...intrinsicDomAttributeProps.has(name) && { domAttribute: true },
|
|
6268
6268
|
sourceStartLine: property.getStartLineNumber(),
|
|
6269
6269
|
sourceEndLine: property.getEndLineNumber()
|
|
6270
6270
|
});
|
|
6271
6271
|
}
|
|
6272
6272
|
return props.sort((a, b) => a.name.localeCompare(b.name));
|
|
6273
6273
|
}
|
|
6274
|
-
function normalizeSlotName(
|
|
6275
|
-
const normalizedName =
|
|
6274
|
+
function normalizeSlotName(name) {
|
|
6275
|
+
const normalizedName = name && name.length > 0 ? name : "default";
|
|
6276
6276
|
return {
|
|
6277
6277
|
name: normalizedName,
|
|
6278
6278
|
isDefault: normalizedName === "default"
|
|
@@ -6342,9 +6342,9 @@ function extractSlots(classDecl, warnings, componentName) {
|
|
|
6342
6342
|
if (tagName === "slot") {
|
|
6343
6343
|
const nameAttribute = openingElement.getAttributes().find((attribute) => Node2.isJsxAttribute(attribute) && attribute.getNameNode().getText() === "name");
|
|
6344
6344
|
const initializer2 = Node2.isJsxAttribute(nameAttribute) ? nameAttribute.getInitializer() : void 0;
|
|
6345
|
-
const
|
|
6345
|
+
const name2 = initializer2 && Node2.isStringLiteral(initializer2) ? initializer2.getLiteralValue() : initializer2 && Node2.isJsxExpression(initializer2) ? initializer2.getExpression()?.getText() ?? "" : "";
|
|
6346
6346
|
upsertSlot({
|
|
6347
|
-
...normalizeSlotName(
|
|
6347
|
+
...normalizeSlotName(name2)
|
|
6348
6348
|
});
|
|
6349
6349
|
return;
|
|
6350
6350
|
}
|
|
@@ -6353,11 +6353,11 @@ function extractSlots(classDecl, warnings, componentName) {
|
|
|
6353
6353
|
const initializer = slotAttribute.getInitializer();
|
|
6354
6354
|
if (!initializer || !Node2.isStringLiteral(initializer))
|
|
6355
6355
|
return;
|
|
6356
|
-
const
|
|
6357
|
-
if (!
|
|
6356
|
+
const name = initializer.getLiteralValue();
|
|
6357
|
+
if (!name)
|
|
6358
6358
|
return;
|
|
6359
6359
|
upsertSlot({
|
|
6360
|
-
name
|
|
6360
|
+
name,
|
|
6361
6361
|
isDefault: false
|
|
6362
6362
|
});
|
|
6363
6363
|
});
|
|
@@ -6379,15 +6379,15 @@ function extractFromSourceFile(sourceFile, warnings) {
|
|
|
6379
6379
|
const tag = getComponentTag(classDecl);
|
|
6380
6380
|
if (!tag)
|
|
6381
6381
|
continue;
|
|
6382
|
-
const
|
|
6382
|
+
const name = kebabToPascal(tag);
|
|
6383
6383
|
const props = extractProps(classDecl);
|
|
6384
|
-
const slots = extractSlots(classDecl, warnings,
|
|
6384
|
+
const slots = extractSlots(classDecl, warnings, name);
|
|
6385
6385
|
const eventNames = detectEvents(classDecl);
|
|
6386
6386
|
if (eventNames.length > 0) {
|
|
6387
|
-
warnings.push(`Component ${
|
|
6387
|
+
warnings.push(`Component ${name} has ${eventNames.length} events not captured: ${eventNames.join(", ")}`);
|
|
6388
6388
|
}
|
|
6389
6389
|
components.push({
|
|
6390
|
-
name
|
|
6390
|
+
name,
|
|
6391
6391
|
source: sourceFile.getFilePath(),
|
|
6392
6392
|
sourcePath: sourceFile.getFilePath(),
|
|
6393
6393
|
framework: "stencil",
|
|
@@ -6539,9 +6539,9 @@ function extractAllowedComponentsFromJsdoc(jsdocText, componentNames) {
|
|
|
6539
6539
|
return [];
|
|
6540
6540
|
const found = /* @__PURE__ */ new Set();
|
|
6541
6541
|
for (const raw of m[1].split(",")) {
|
|
6542
|
-
const
|
|
6543
|
-
if (
|
|
6544
|
-
found.add(
|
|
6542
|
+
const name = raw.trim();
|
|
6543
|
+
if (name && componentNames.has(name))
|
|
6544
|
+
found.add(name);
|
|
6545
6545
|
}
|
|
6546
6546
|
return [...found].sort();
|
|
6547
6547
|
}
|
|
@@ -6576,8 +6576,8 @@ function collectTypePredicateComponentReferences(sourceFile, ctx) {
|
|
|
6576
6576
|
const assertedTypeNode = returnTypeNode.getTypeNode();
|
|
6577
6577
|
if (!assertedTypeNode)
|
|
6578
6578
|
continue;
|
|
6579
|
-
for (const
|
|
6580
|
-
found.add(
|
|
6579
|
+
for (const name of extractAllowedComponentsFromTypeText(assertedTypeNode.getText(), ctx)) {
|
|
6580
|
+
found.add(name);
|
|
6581
6581
|
}
|
|
6582
6582
|
}
|
|
6583
6583
|
return [...found].sort();
|
|
@@ -6596,13 +6596,13 @@ function collectRuntimeTypeCheckComponentReferences(sourceFile, componentNames)
|
|
|
6596
6596
|
return void 0;
|
|
6597
6597
|
if (!Node3.isIdentifier(otherSide) && !Node3.isPropertyAccessExpression(otherSide))
|
|
6598
6598
|
return void 0;
|
|
6599
|
-
const
|
|
6600
|
-
if (!
|
|
6599
|
+
const name = otherSide.getText().split(".").pop();
|
|
6600
|
+
if (!name || !componentNames.has(name))
|
|
6601
6601
|
return void 0;
|
|
6602
6602
|
const baseIdentifier = Node3.isPropertyAccessExpression(otherSide) ? otherSide.getExpression() : otherSide;
|
|
6603
6603
|
if (!Node3.isIdentifier(baseIdentifier) || !localBindings.has(baseIdentifier.getText()))
|
|
6604
6604
|
return void 0;
|
|
6605
|
-
return
|
|
6605
|
+
return name;
|
|
6606
6606
|
};
|
|
6607
6607
|
const match2 = candidateFromTypeAccess(left, right) ?? candidateFromTypeAccess(right, left);
|
|
6608
6608
|
if (match2)
|
|
@@ -6654,8 +6654,8 @@ function collectArrayMapRenderComponentReferences(funcNode, componentNames, ownC
|
|
|
6654
6654
|
const found = /* @__PURE__ */ new Set();
|
|
6655
6655
|
const propNames = new Set(propTypesByName.keys());
|
|
6656
6656
|
const renderCountByComponent = /* @__PURE__ */ new Map();
|
|
6657
|
-
const bumpRenderCount = (
|
|
6658
|
-
renderCountByComponent.set(
|
|
6657
|
+
const bumpRenderCount = (name) => {
|
|
6658
|
+
renderCountByComponent.set(name, (renderCountByComponent.get(name) ?? 0) + 1);
|
|
6659
6659
|
};
|
|
6660
6660
|
for (const jsxElement of [
|
|
6661
6661
|
...funcNode.getDescendantsOfKind(SyntaxKind3.JsxSelfClosingElement),
|
|
@@ -6983,7 +6983,7 @@ function sourceFileUsesCreateContext(sourceFile) {
|
|
|
6983
6983
|
function isNextJsComponent(filePath, exportedNames) {
|
|
6984
6984
|
const normalized = filePath.replace(/\\/g, "/");
|
|
6985
6985
|
const isAppRouterFile = /\/app\/.*\/(page|layout)\.[jt]sx?$/.test(normalized);
|
|
6986
|
-
const hasNextExports = exportedNames.some((
|
|
6986
|
+
const hasNextExports = exportedNames.some((name) => name === "generateMetadata" || name === "generateStaticParams");
|
|
6987
6987
|
return isAppRouterFile || hasNextExports;
|
|
6988
6988
|
}
|
|
6989
6989
|
function isRepoLocalTransparentPolymorphicWrapperDeclaration(declaration, typeName) {
|
|
@@ -7165,8 +7165,8 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
7165
7165
|
const props = [];
|
|
7166
7166
|
let hasChildren = false;
|
|
7167
7167
|
for (const property of type.getProperties()) {
|
|
7168
|
-
const
|
|
7169
|
-
if (
|
|
7168
|
+
const name = property.getName();
|
|
7169
|
+
if (name === "children") {
|
|
7170
7170
|
if (suppressNeverChildrenSlot) {
|
|
7171
7171
|
const declaration2 = property.getValueDeclaration() ?? property.getDeclarations()[0];
|
|
7172
7172
|
if (declaration2 && property.getTypeAtLocation(declaration2).isNever()) {
|
|
@@ -7176,7 +7176,7 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
7176
7176
|
hasChildren = true;
|
|
7177
7177
|
continue;
|
|
7178
7178
|
}
|
|
7179
|
-
if (slotNames.has(
|
|
7179
|
+
if (slotNames.has(name))
|
|
7180
7180
|
continue;
|
|
7181
7181
|
const declaration = property.getValueDeclaration() ?? property.getDeclarations()[0];
|
|
7182
7182
|
if (!declaration)
|
|
@@ -7187,7 +7187,7 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
7187
7187
|
const required = !property.isOptional();
|
|
7188
7188
|
const allowedValues = extractAllowedValues(propType);
|
|
7189
7189
|
props.push({
|
|
7190
|
-
name
|
|
7190
|
+
name,
|
|
7191
7191
|
type: typeText,
|
|
7192
7192
|
required,
|
|
7193
7193
|
...allowedValues && { allowedValues },
|
|
@@ -7218,19 +7218,19 @@ function extractPropsFromInterfaceDeclaration(declaration, slotNames, seen, excl
|
|
|
7218
7218
|
return acc;
|
|
7219
7219
|
const propType = symbol.getTypeAtLocation(decl);
|
|
7220
7220
|
const typeText = propType.isAny() ? ("getTypeNode" in decl && typeof decl.getTypeNode === "function" ? decl.getTypeNode()?.getText() : void 0) ?? propType.getText(decl) : propType.getText(decl);
|
|
7221
|
-
const
|
|
7222
|
-
if (
|
|
7221
|
+
const name = symbol.getName();
|
|
7222
|
+
if (name === "children") {
|
|
7223
7223
|
if (suppressNeverChildrenSlot && propType.isNever())
|
|
7224
7224
|
return acc;
|
|
7225
7225
|
acc.hasChildren = true;
|
|
7226
7226
|
return acc;
|
|
7227
7227
|
}
|
|
7228
|
-
if (slotNames.has(
|
|
7228
|
+
if (slotNames.has(name))
|
|
7229
7229
|
return acc;
|
|
7230
7230
|
const required = !symbol.isOptional();
|
|
7231
7231
|
const allowedValues = extractAllowedValues(propType);
|
|
7232
7232
|
acc.props.push({
|
|
7233
|
-
name
|
|
7233
|
+
name,
|
|
7234
7234
|
type: typeText,
|
|
7235
7235
|
required,
|
|
7236
7236
|
...allowedValues && { allowedValues },
|
|
@@ -7563,7 +7563,7 @@ function collectReboundDeclarations(body) {
|
|
|
7563
7563
|
function collectPropDataflow(func, param, availablePropNames) {
|
|
7564
7564
|
const valueAliases = /* @__PURE__ */ new Map();
|
|
7565
7565
|
const objectAliases = /* @__PURE__ */ new Map();
|
|
7566
|
-
const fullPropsShape = new Map([...availablePropNames].map((
|
|
7566
|
+
const fullPropsShape = new Map([...availablePropNames].map((name) => [name, name]));
|
|
7567
7567
|
const belongsToComponentFunction = (node) => node.getFirstAncestor((ancestor) => Node4.isFunctionDeclaration(ancestor) || Node4.isArrowFunction(ancestor) || Node4.isFunctionExpression(ancestor)) === func;
|
|
7568
7568
|
const resolveValue = (expression) => {
|
|
7569
7569
|
if (!expression)
|
|
@@ -7757,12 +7757,12 @@ function extractSlots2(type, hasChildren) {
|
|
|
7757
7757
|
slots.push({ name: "children", isDefault: true });
|
|
7758
7758
|
}
|
|
7759
7759
|
for (const property of type.getProperties()) {
|
|
7760
|
-
const
|
|
7761
|
-
if (
|
|
7760
|
+
const name = property.getName();
|
|
7761
|
+
if (name === "children")
|
|
7762
7762
|
continue;
|
|
7763
7763
|
if (!getRenderPropType(property))
|
|
7764
7764
|
continue;
|
|
7765
|
-
const slotName =
|
|
7765
|
+
const slotName = name.replace(/^render/, "");
|
|
7766
7766
|
slots.push({
|
|
7767
7767
|
name: slotName.charAt(0).toLowerCase() + slotName.slice(1),
|
|
7768
7768
|
isDefault: false
|
|
@@ -7775,9 +7775,9 @@ function isExpandableDomAttributeWrapperName(typeName) {
|
|
|
7775
7775
|
}
|
|
7776
7776
|
function getStringLiteralTypeValues(typeNode) {
|
|
7777
7777
|
if (Node4.isLiteralTypeNode(typeNode)) {
|
|
7778
|
-
const
|
|
7779
|
-
if (Node4.isStringLiteral(
|
|
7780
|
-
return [
|
|
7778
|
+
const literal3 = typeNode.getLiteral();
|
|
7779
|
+
if (Node4.isStringLiteral(literal3)) {
|
|
7780
|
+
return [literal3.getLiteralText()];
|
|
7781
7781
|
}
|
|
7782
7782
|
}
|
|
7783
7783
|
if (!Node4.isUnionTypeNode(typeNode))
|
|
@@ -8018,17 +8018,17 @@ function getSyntheticDomAttributeProps(typeNode) {
|
|
|
8018
8018
|
}
|
|
8019
8019
|
return [...propsByName.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
8020
8020
|
}
|
|
8021
|
-
function getDomAttributeSurface(
|
|
8022
|
-
if (seen.has(
|
|
8021
|
+
function getDomAttributeSurface(name, seen = /* @__PURE__ */ new Set()) {
|
|
8022
|
+
if (seen.has(name))
|
|
8023
8023
|
return [];
|
|
8024
|
-
seen.add(
|
|
8024
|
+
seen.add(name);
|
|
8025
8025
|
const propsByName = /* @__PURE__ */ new Map();
|
|
8026
|
-
for (const parentName of DOM_ATTRIBUTE_WRAPPER_PARENTS[
|
|
8026
|
+
for (const parentName of DOM_ATTRIBUTE_WRAPPER_PARENTS[name] ?? []) {
|
|
8027
8027
|
for (const prop of getDomAttributeSurface(parentName, seen)) {
|
|
8028
8028
|
propsByName.set(prop.name, prop);
|
|
8029
8029
|
}
|
|
8030
8030
|
}
|
|
8031
|
-
for (const prop of DOM_ATTRIBUTE_PROP_SURFACES[
|
|
8031
|
+
for (const prop of DOM_ATTRIBUTE_PROP_SURFACES[name]) {
|
|
8032
8032
|
propsByName.set(prop.name, prop);
|
|
8033
8033
|
}
|
|
8034
8034
|
return [...propsByName.values()].map((prop) => ({
|
|
@@ -8125,12 +8125,12 @@ function extractPickedPropsFromTypeNode(typeNode, slotNames, excludedProps = /*
|
|
|
8125
8125
|
}
|
|
8126
8126
|
const pickedKeys = getStringLiteralTypeValues(pickedKeysNode);
|
|
8127
8127
|
const props = [];
|
|
8128
|
-
for (const
|
|
8129
|
-
if (slotNames.has(
|
|
8128
|
+
for (const name of pickedKeys) {
|
|
8129
|
+
if (slotNames.has(name))
|
|
8130
8130
|
continue;
|
|
8131
|
-
if (excludedProps.has(
|
|
8131
|
+
if (excludedProps.has(name))
|
|
8132
8132
|
continue;
|
|
8133
|
-
const pickedProp = sourcePropsByName.get(
|
|
8133
|
+
const pickedProp = sourcePropsByName.get(name);
|
|
8134
8134
|
if (pickedProp) {
|
|
8135
8135
|
props.push(pickedProp);
|
|
8136
8136
|
}
|
|
@@ -8360,7 +8360,7 @@ async function extractReactComponents(filePaths) {
|
|
|
8360
8360
|
function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
8361
8361
|
const components = [];
|
|
8362
8362
|
const usesCreateContext = sourceFileUsesCreateContext(sourceFile);
|
|
8363
|
-
for (const { name
|
|
8363
|
+
for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
8364
8364
|
allowVariableDeclaration: true,
|
|
8365
8365
|
hookReason: "React hook names are not renderable components"
|
|
8366
8366
|
})) {
|
|
@@ -8372,7 +8372,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
8372
8372
|
const params = funcNode.getParameters();
|
|
8373
8373
|
if (params.length === 0) {
|
|
8374
8374
|
components.push({
|
|
8375
|
-
name
|
|
8375
|
+
name,
|
|
8376
8376
|
source: sourceFile.getFilePath(),
|
|
8377
8377
|
sourcePath: sourceFile.getFilePath(),
|
|
8378
8378
|
framework: isNext ? "next" : "react",
|
|
@@ -8416,7 +8416,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
8416
8416
|
}
|
|
8417
8417
|
const resolvedProps = [...mergedPropsByName.values()];
|
|
8418
8418
|
const noUsefulTypes = resolvedProps.length === 0 || resolvedProps.every((p) => p.type === "any");
|
|
8419
|
-
const finalProps = noUsefulTypes ? extractPropTypes(sourceFile,
|
|
8419
|
+
const finalProps = noUsefulTypes ? extractPropTypes(sourceFile, name) ?? resolvedProps : resolvedProps;
|
|
8420
8420
|
const propsWithDefaults = finalProps.map((p) => {
|
|
8421
8421
|
if (!defaults.has(p.name))
|
|
8422
8422
|
return p;
|
|
@@ -8449,7 +8449,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
8449
8449
|
const propsTypeName = firstParamTypeNode?.getText?.().trim();
|
|
8450
8450
|
const propsTypeNameCapture = propsTypeName && /^[A-Za-z_$][\w$]*$/.test(propsTypeName) ? propsTypeName : void 0;
|
|
8451
8451
|
components.push({
|
|
8452
|
-
name
|
|
8452
|
+
name,
|
|
8453
8453
|
source: sourceFile.getFilePath(),
|
|
8454
8454
|
sourcePath: sourceFile.getFilePath(),
|
|
8455
8455
|
framework: isNext ? "next" : "react",
|
|
@@ -8664,10 +8664,10 @@ async function extractVueTsxComponents(filePaths) {
|
|
|
8664
8664
|
}
|
|
8665
8665
|
function extractFromSourceFile3(sourceFile, exclusions) {
|
|
8666
8666
|
const components = [];
|
|
8667
|
-
for (const { name
|
|
8667
|
+
for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
8668
8668
|
hookReason: "Vue composition hook names are not renderable components"
|
|
8669
8669
|
})) {
|
|
8670
|
-
const component = extractVueTsxComponent(declarations,
|
|
8670
|
+
const component = extractVueTsxComponent(declarations, name, sourceFile);
|
|
8671
8671
|
if (component) {
|
|
8672
8672
|
components.push(component);
|
|
8673
8673
|
}
|
|
@@ -8683,11 +8683,11 @@ function extractVueTsxComponent(declarations, exportName, sourceFile) {
|
|
|
8683
8683
|
const resolved = resolveVueComponentOptions(declaration.getInitializer());
|
|
8684
8684
|
if (!resolved)
|
|
8685
8685
|
continue;
|
|
8686
|
-
const
|
|
8686
|
+
const name = extractVueGenericComponentName(resolved.options) ?? exportName;
|
|
8687
8687
|
const props = extractVueGenericComponentProps(resolved.options);
|
|
8688
8688
|
const slots = extractVueGenericComponentSlots(resolved.options, resolved.slotsTypeNode);
|
|
8689
8689
|
return {
|
|
8690
|
-
name
|
|
8690
|
+
name,
|
|
8691
8691
|
source: sourceFile.getFilePath(),
|
|
8692
8692
|
framework: "vue",
|
|
8693
8693
|
props,
|
|
@@ -8861,16 +8861,16 @@ function extractVueObjectPropDefinition(propName, initializer) {
|
|
|
8861
8861
|
for (const property of initializer.getProperties()) {
|
|
8862
8862
|
if (!Node5.isPropertyAssignment(property))
|
|
8863
8863
|
continue;
|
|
8864
|
-
const
|
|
8864
|
+
const name = property.getName();
|
|
8865
8865
|
const value = property.getInitializer();
|
|
8866
8866
|
if (!value)
|
|
8867
8867
|
continue;
|
|
8868
|
-
if (
|
|
8868
|
+
if (name === "type") {
|
|
8869
8869
|
type = getVuePropTypeText(value);
|
|
8870
8870
|
allowedValues = extractAllowedValues(value.getType());
|
|
8871
|
-
} else if (
|
|
8871
|
+
} else if (name === "required") {
|
|
8872
8872
|
required = value.getText() === "true";
|
|
8873
|
-
} else if (
|
|
8873
|
+
} else if (name === "default") {
|
|
8874
8874
|
defaultValue = value.getText();
|
|
8875
8875
|
}
|
|
8876
8876
|
}
|
|
@@ -9163,20 +9163,20 @@ async function extractVueComponents(filePaths, onProgress) {
|
|
|
9163
9163
|
async function extractFromVueSFC(filePath, source) {
|
|
9164
9164
|
const { descriptor, errors } = parseSFC(source);
|
|
9165
9165
|
const fileWarnings = errors.map((e) => `Parse error in ${filePath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
9166
|
-
const
|
|
9166
|
+
const name = getVueComponentName(filePath);
|
|
9167
9167
|
let props = [];
|
|
9168
9168
|
const setupProps = descriptor.scriptSetup ? await extractSetupProps(filePath, descriptor.scriptSetup.content) : null;
|
|
9169
9169
|
if (setupProps !== null) {
|
|
9170
9170
|
props = setupProps;
|
|
9171
9171
|
} else if (descriptor.script) {
|
|
9172
|
-
return extractOptionsComponent(filePath, descriptor.script.content, fileWarnings,
|
|
9172
|
+
return extractOptionsComponent(filePath, descriptor.script.content, fileWarnings, name, descriptor.template?.ast, source);
|
|
9173
9173
|
}
|
|
9174
9174
|
let slots = descriptor.template?.ast ? extractSlotsFromTemplate(descriptor.template.ast) : [];
|
|
9175
9175
|
const runtimeSlots = extractSlotsFromRuntimeAccess(source);
|
|
9176
9176
|
slots = mergeSlotsDedup(slots, runtimeSlots);
|
|
9177
9177
|
return {
|
|
9178
9178
|
component: {
|
|
9179
|
-
name
|
|
9179
|
+
name,
|
|
9180
9180
|
source: filePath,
|
|
9181
9181
|
sourcePath: filePath,
|
|
9182
9182
|
framework: "vue",
|
|
@@ -9194,7 +9194,7 @@ function getVueComponentName(filePath) {
|
|
|
9194
9194
|
const parentDirName = basename(dirname9(filePath));
|
|
9195
9195
|
return parentDirName || fileName;
|
|
9196
9196
|
}
|
|
9197
|
-
async function extractOptionsComponent(filePath, scriptContent, fileWarnings,
|
|
9197
|
+
async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
|
|
9198
9198
|
const props = await extractOptionsProps(filePath, scriptContent);
|
|
9199
9199
|
let slots = templateAst ? extractSlotsFromTemplate(templateAst) : [];
|
|
9200
9200
|
if (sfcSource) {
|
|
@@ -9203,7 +9203,7 @@ async function extractOptionsComponent(filePath, scriptContent, fileWarnings, na
|
|
|
9203
9203
|
}
|
|
9204
9204
|
return {
|
|
9205
9205
|
component: {
|
|
9206
|
-
name
|
|
9206
|
+
name,
|
|
9207
9207
|
source: filePath,
|
|
9208
9208
|
sourcePath: filePath,
|
|
9209
9209
|
framework: "vue",
|
|
@@ -9276,13 +9276,13 @@ function extractGenericProps(typeText) {
|
|
|
9276
9276
|
const resolved = resolveTypeProperty(property);
|
|
9277
9277
|
if (!resolved)
|
|
9278
9278
|
continue;
|
|
9279
|
-
const { name
|
|
9279
|
+
const { name, typeText: resolvedTypeText, required } = resolved;
|
|
9280
9280
|
let typeText2 = resolvedTypeText;
|
|
9281
9281
|
if (!required) {
|
|
9282
9282
|
typeText2 = typeText2.replace(/\s*\|\s*undefined$/, "").replace(/^undefined\s*\|\s*/, "");
|
|
9283
9283
|
}
|
|
9284
9284
|
props.push({
|
|
9285
|
-
name
|
|
9285
|
+
name,
|
|
9286
9286
|
type: typeText2,
|
|
9287
9287
|
required
|
|
9288
9288
|
});
|
|
@@ -9580,14 +9580,14 @@ function parseObjectProps(obj) {
|
|
|
9580
9580
|
for (const prop of obj.getProperties()) {
|
|
9581
9581
|
if (!Node6.isPropertyAssignment(prop))
|
|
9582
9582
|
continue;
|
|
9583
|
-
const
|
|
9584
|
-
if (!isPublicVuePropName(
|
|
9583
|
+
const name = prop.getName();
|
|
9584
|
+
if (!isPublicVuePropName(name))
|
|
9585
9585
|
continue;
|
|
9586
9586
|
const init = prop.getInitializer();
|
|
9587
9587
|
if (!init || !Node6.isObjectLiteralExpression(init)) {
|
|
9588
9588
|
const initText = init?.getText() ?? "any";
|
|
9589
9589
|
result.push({
|
|
9590
|
-
name
|
|
9590
|
+
name,
|
|
9591
9591
|
type: VUE_TYPE_MAP[initText] ?? "any",
|
|
9592
9592
|
required: false,
|
|
9593
9593
|
sourceStartLine: prop.getStartLineNumber(),
|
|
@@ -9620,7 +9620,7 @@ function parseObjectProps(obj) {
|
|
|
9620
9620
|
}
|
|
9621
9621
|
}
|
|
9622
9622
|
result.push({
|
|
9623
|
-
name
|
|
9623
|
+
name,
|
|
9624
9624
|
type,
|
|
9625
9625
|
required,
|
|
9626
9626
|
...defaultValue !== void 0 && { defaultValue },
|
|
@@ -9630,8 +9630,8 @@ function parseObjectProps(obj) {
|
|
|
9630
9630
|
}
|
|
9631
9631
|
return result;
|
|
9632
9632
|
}
|
|
9633
|
-
function isPublicVuePropName(
|
|
9634
|
-
return !/^[_$]/.test(
|
|
9633
|
+
function isPublicVuePropName(name) {
|
|
9634
|
+
return !/^[_$]/.test(name);
|
|
9635
9635
|
}
|
|
9636
9636
|
function extractSlotsFromTemplate(ast) {
|
|
9637
9637
|
const slots = [];
|
|
@@ -9663,10 +9663,10 @@ function extractSlotsFromRuntimeAccess(source) {
|
|
|
9663
9663
|
for (const pattern of [dotPattern, bracketPattern]) {
|
|
9664
9664
|
let match2;
|
|
9665
9665
|
while ((match2 = pattern.exec(source)) !== null) {
|
|
9666
|
-
const
|
|
9667
|
-
if (!seen.has(
|
|
9668
|
-
seen.add(
|
|
9669
|
-
slots.push({ name
|
|
9666
|
+
const name = match2[1];
|
|
9667
|
+
if (!seen.has(name)) {
|
|
9668
|
+
seen.add(name);
|
|
9669
|
+
slots.push({ name, isDefault: name === "default" });
|
|
9670
9670
|
}
|
|
9671
9671
|
}
|
|
9672
9672
|
}
|
|
@@ -9775,12 +9775,12 @@ function extractPropsFromFrontmatter(frontmatter) {
|
|
|
9775
9775
|
const propsTypeAlias = sf.getTypeAlias("Props");
|
|
9776
9776
|
if (propsInterface) {
|
|
9777
9777
|
for (const member of propsInterface.getProperties()) {
|
|
9778
|
-
const
|
|
9778
|
+
const name = member.getName();
|
|
9779
9779
|
const typeText = member.getTypeNode()?.getText() ?? "any";
|
|
9780
9780
|
const required = !member.hasQuestionToken();
|
|
9781
9781
|
const allowedValues = extractAllowedValues3(typeText);
|
|
9782
9782
|
props.push({
|
|
9783
|
-
name
|
|
9783
|
+
name,
|
|
9784
9784
|
type: typeText,
|
|
9785
9785
|
required,
|
|
9786
9786
|
...allowedValues && { allowedValues },
|
|
@@ -9794,10 +9794,10 @@ function extractPropsFromFrontmatter(frontmatter) {
|
|
|
9794
9794
|
const resolved = resolveTypeProperty(property);
|
|
9795
9795
|
if (!resolved)
|
|
9796
9796
|
continue;
|
|
9797
|
-
const { name
|
|
9797
|
+
const { name, declaration: decl, typeText, required } = resolved;
|
|
9798
9798
|
const allowedValues = extractAllowedValues3(typeText);
|
|
9799
9799
|
props.push({
|
|
9800
|
-
name
|
|
9800
|
+
name,
|
|
9801
9801
|
type: typeText,
|
|
9802
9802
|
required,
|
|
9803
9803
|
...allowedValues && { allowedValues },
|
|
@@ -9863,7 +9863,7 @@ function mergeSlots(...slotGroups) {
|
|
|
9863
9863
|
return merged;
|
|
9864
9864
|
}
|
|
9865
9865
|
function extractFromAstroFile(filePath, source) {
|
|
9866
|
-
const
|
|
9866
|
+
const name = basename2(filePath, ".astro");
|
|
9867
9867
|
const fenceIndex = source.startsWith("---") ? 0 : -1;
|
|
9868
9868
|
let frontmatter = "";
|
|
9869
9869
|
let template = source;
|
|
@@ -9882,7 +9882,7 @@ function extractFromAstroFile(filePath, source) {
|
|
|
9882
9882
|
});
|
|
9883
9883
|
const slots = mergeSlots(extractSlotsFromTemplate2(template), extractSlotsFromFrontmatter(frontmatter));
|
|
9884
9884
|
return {
|
|
9885
|
-
name
|
|
9885
|
+
name,
|
|
9886
9886
|
source: filePath,
|
|
9887
9887
|
sourcePath: filePath,
|
|
9888
9888
|
framework: "astro",
|
|
@@ -10094,10 +10094,10 @@ function extractSlotsFromTemplate3(templateContent) {
|
|
|
10094
10094
|
for (const match2 of templateContent.matchAll(slotRegex)) {
|
|
10095
10095
|
const attrs = match2[1] ?? "";
|
|
10096
10096
|
const nameMatch = attrs.match(/\bname=["']([^"']+)["']/);
|
|
10097
|
-
const
|
|
10098
|
-
slots.set(
|
|
10097
|
+
const name = nameMatch?.[1] ?? "default";
|
|
10098
|
+
slots.set(name, name === "default");
|
|
10099
10099
|
}
|
|
10100
|
-
return [...slots.entries()].map(([
|
|
10100
|
+
return [...slots.entries()].map(([name, isDefault]) => ({ name, isDefault })).sort((a, b) => a.name.localeCompare(b.name));
|
|
10101
10101
|
}
|
|
10102
10102
|
function mergeSlotLists(...slotLists) {
|
|
10103
10103
|
const merged = /* @__PURE__ */ new Map();
|
|
@@ -10126,20 +10126,20 @@ function extractJsDocSlots(classDecl) {
|
|
|
10126
10126
|
const comment = tag.getCommentText()?.trim();
|
|
10127
10127
|
if (!comment)
|
|
10128
10128
|
continue;
|
|
10129
|
-
let
|
|
10129
|
+
let name = "default";
|
|
10130
10130
|
let description = comment;
|
|
10131
10131
|
if (comment.startsWith("-")) {
|
|
10132
10132
|
description = comment.slice(1).trim();
|
|
10133
10133
|
} else {
|
|
10134
10134
|
const match2 = comment.match(/^(\S+)\s*-\s*(.*)$/s);
|
|
10135
10135
|
if (match2) {
|
|
10136
|
-
|
|
10136
|
+
name = match2[1];
|
|
10137
10137
|
description = match2[2].trim();
|
|
10138
10138
|
}
|
|
10139
10139
|
}
|
|
10140
10140
|
slots.push({
|
|
10141
|
-
name
|
|
10142
|
-
isDefault:
|
|
10141
|
+
name,
|
|
10142
|
+
isDefault: name === "default",
|
|
10143
10143
|
...description && { description }
|
|
10144
10144
|
});
|
|
10145
10145
|
}
|
|
@@ -10184,8 +10184,8 @@ function isNonPublicLitMember(member) {
|
|
|
10184
10184
|
function hasShoelaceRuntimeBookkeepingField(classDecl) {
|
|
10185
10185
|
return classDecl.getProperties().some((property) => property.getName() === "initialReflectedProperties");
|
|
10186
10186
|
}
|
|
10187
|
-
function isInternalRuntimeField(
|
|
10188
|
-
return applyRuntimeFieldDenylist && INTERNAL_RUNTIME_FIELD_NAMES.has(
|
|
10187
|
+
function isInternalRuntimeField(name, applyRuntimeFieldDenylist) {
|
|
10188
|
+
return applyRuntimeFieldDenylist && INTERNAL_RUNTIME_FIELD_NAMES.has(name);
|
|
10189
10189
|
}
|
|
10190
10190
|
function getExplicitLitPropertyAttributeName(property) {
|
|
10191
10191
|
const decorator = property.getDecorators().find((candidate) => candidate.getName() === "property");
|
|
@@ -10212,8 +10212,8 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
10212
10212
|
continue;
|
|
10213
10213
|
if (isNonPublicLitMember(property))
|
|
10214
10214
|
continue;
|
|
10215
|
-
const
|
|
10216
|
-
if (
|
|
10215
|
+
const name = property.getName();
|
|
10216
|
+
if (name.startsWith("#") || isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
10217
10217
|
continue;
|
|
10218
10218
|
const scope = property.getScope();
|
|
10219
10219
|
if (scope === "private" || scope === "protected")
|
|
@@ -10228,7 +10228,7 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
10228
10228
|
}
|
|
10229
10229
|
const typeNode = property.getTypeNode();
|
|
10230
10230
|
const type = typeNode ? typeNode.getText() : "any";
|
|
10231
|
-
const publicName =
|
|
10231
|
+
const publicName = name.startsWith("_") && hasDecorators ? getExplicitLitPropertyAttributeName(property) : null;
|
|
10232
10232
|
let defaultValue;
|
|
10233
10233
|
if (initializer) {
|
|
10234
10234
|
if (Node8.isStringLiteral(initializer)) {
|
|
@@ -10238,7 +10238,7 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
10238
10238
|
}
|
|
10239
10239
|
}
|
|
10240
10240
|
props.push({
|
|
10241
|
-
name: publicName ? kebabToCamel(publicName) :
|
|
10241
|
+
name: publicName ? kebabToCamel(publicName) : name,
|
|
10242
10242
|
type,
|
|
10243
10243
|
required: false,
|
|
10244
10244
|
...defaultValue !== void 0 && { defaultValue },
|
|
@@ -10258,15 +10258,15 @@ function extractAccessorProperties(classDecl, applyRuntimeFieldDenylist = false)
|
|
|
10258
10258
|
continue;
|
|
10259
10259
|
if (isNonPublicLitMember(getter))
|
|
10260
10260
|
continue;
|
|
10261
|
-
const
|
|
10262
|
-
if (
|
|
10261
|
+
const name = getter.getName();
|
|
10262
|
+
if (name === "observedAttributes" || name === "template" || name.startsWith("#") || isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
10263
10263
|
continue;
|
|
10264
10264
|
const scope = getter.getScope();
|
|
10265
10265
|
if (scope === "private" || scope === "protected")
|
|
10266
10266
|
continue;
|
|
10267
|
-
const entry = accessors.get(
|
|
10267
|
+
const entry = accessors.get(name) ?? {};
|
|
10268
10268
|
entry.getter = getter;
|
|
10269
|
-
accessors.set(
|
|
10269
|
+
accessors.set(name, entry);
|
|
10270
10270
|
}
|
|
10271
10271
|
for (const setter of classDecl.getSetAccessors()) {
|
|
10272
10272
|
if (setter.isStatic())
|
|
@@ -10275,24 +10275,24 @@ function extractAccessorProperties(classDecl, applyRuntimeFieldDenylist = false)
|
|
|
10275
10275
|
continue;
|
|
10276
10276
|
if (isNonPublicLitMember(setter))
|
|
10277
10277
|
continue;
|
|
10278
|
-
const
|
|
10279
|
-
if (
|
|
10278
|
+
const name = setter.getName();
|
|
10279
|
+
if (name === "observedAttributes" || name === "template" || name.startsWith("#") || isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
10280
10280
|
continue;
|
|
10281
10281
|
const scope = setter.getScope();
|
|
10282
10282
|
if (scope === "private" || scope === "protected")
|
|
10283
10283
|
continue;
|
|
10284
|
-
const entry = accessors.get(
|
|
10284
|
+
const entry = accessors.get(name) ?? {};
|
|
10285
10285
|
entry.setter = setter;
|
|
10286
|
-
accessors.set(
|
|
10286
|
+
accessors.set(name, entry);
|
|
10287
10287
|
}
|
|
10288
|
-
for (const [
|
|
10288
|
+
for (const [name, { getter, setter }] of accessors) {
|
|
10289
10289
|
const hasPropertyDecorator = getter?.getDecorators().some((decorator) => decorator.getName() === "property") || setter?.getDecorators().some((decorator) => decorator.getName() === "property");
|
|
10290
10290
|
if (!hasPropertyDecorator && !(getter && setter))
|
|
10291
10291
|
continue;
|
|
10292
10292
|
const type = getter?.getReturnTypeNode()?.getText() ?? setter?.getParameters()[0]?.getTypeNode()?.getText() ?? "any";
|
|
10293
10293
|
const accessorNode = getter ?? setter;
|
|
10294
10294
|
props.push({
|
|
10295
|
-
name
|
|
10295
|
+
name,
|
|
10296
10296
|
type,
|
|
10297
10297
|
required: false,
|
|
10298
10298
|
...accessorNode ? {
|
|
@@ -10314,11 +10314,11 @@ function extractJsDocAttributeProps(classDecl) {
|
|
|
10314
10314
|
const match2 = normalizedComment?.match(/(?:\{([^}]+)\}\s+)?([^\s]+)(?:\s*-\s*([\s\S]*))?/);
|
|
10315
10315
|
if (!match2)
|
|
10316
10316
|
continue;
|
|
10317
|
-
const [, type,
|
|
10318
|
-
if (!
|
|
10317
|
+
const [, type, name, description] = match2;
|
|
10318
|
+
if (!name || name.startsWith("#"))
|
|
10319
10319
|
continue;
|
|
10320
10320
|
props.push({
|
|
10321
|
-
name
|
|
10321
|
+
name,
|
|
10322
10322
|
type: type?.trim() || "any",
|
|
10323
10323
|
required: false,
|
|
10324
10324
|
...description ? { description: description.replace(/\s+/g, " ").trim() } : {}
|
|
@@ -10670,7 +10670,7 @@ function extractFromSourceFile4(sourceFile, project) {
|
|
|
10670
10670
|
const tagName = tagNameMap.get(className) ?? siblingDefinedTagName ?? decoratorTagName ?? jsDocTagName ?? fastDefinitionTagName ?? void 0;
|
|
10671
10671
|
if (!tagName)
|
|
10672
10672
|
continue;
|
|
10673
|
-
const
|
|
10673
|
+
const name = chooseComponentName(classDecl, className, tagName);
|
|
10674
10674
|
const observedAttrs = extractObservedAttributes(classDecl);
|
|
10675
10675
|
const inheritedProps = extractInheritedClassProperties(classDecl, project);
|
|
10676
10676
|
const classProps = mergePropLists(extractJsDocAttributeProps(classDecl), extractAccessorProperties(classDecl), extractClassProperties(classDecl));
|
|
@@ -10678,7 +10678,7 @@ function extractFromSourceFile4(sourceFile, project) {
|
|
|
10678
10678
|
const templateContent = extractTemplateContent(classDecl, project);
|
|
10679
10679
|
const slots = mergeSlotLists(extractInheritedSlots(classDecl, project), extractJsDocSlots(classDecl), extractSlotsFromTemplate3(templateContent), extractFastTemplateSlots(classDecl, project));
|
|
10680
10680
|
components.push({
|
|
10681
|
-
name
|
|
10681
|
+
name,
|
|
10682
10682
|
source: sourceFile.getFilePath(),
|
|
10683
10683
|
sourcePath: sourceFile.getFilePath(),
|
|
10684
10684
|
framework: "web-component",
|
|
@@ -10990,8 +10990,8 @@ async function retryComponentWithProject(component, ctx, project, warnings) {
|
|
|
10990
10990
|
}
|
|
10991
10991
|
function addImportedDeclarationsToProject(project, ctx) {
|
|
10992
10992
|
const importedNames = collectReferencedTypeNames(ctx.annotation);
|
|
10993
|
-
for (const
|
|
10994
|
-
const localDecl = findLocalTypeDeclaration(ctx.instance,
|
|
10993
|
+
for (const name of [...importedNames]) {
|
|
10994
|
+
const localDecl = findLocalTypeDeclaration(ctx.instance, name, ctx.moduleScript) ?? (ctx.moduleScript ? findLocalTypeDeclaration(ctx.moduleScript, name, ctx.instance) : null);
|
|
10995
10995
|
if (localDecl) {
|
|
10996
10996
|
for (const referenced of collectReferencedTypeNames(localDecl))
|
|
10997
10997
|
importedNames.add(referenced);
|
|
@@ -11172,21 +11172,21 @@ function collapseUnresolvedTypeWarnings(warnings) {
|
|
|
11172
11172
|
}
|
|
11173
11173
|
async function extractFromSvelteFile(filePath, source) {
|
|
11174
11174
|
const warnings = [];
|
|
11175
|
-
const
|
|
11175
|
+
const name = getSvelteComponentName(filePath);
|
|
11176
11176
|
let ast;
|
|
11177
11177
|
try {
|
|
11178
11178
|
ast = parseSvelte(source, { modern: true });
|
|
11179
11179
|
} catch (e) {
|
|
11180
11180
|
return {
|
|
11181
11181
|
component: null,
|
|
11182
|
-
warnings: [`${
|
|
11182
|
+
warnings: [`${name}: parse error in ${filePath}: ${e instanceof Error ? e.message : String(e)}`]
|
|
11183
11183
|
};
|
|
11184
11184
|
}
|
|
11185
11185
|
const instance = ast["instance"];
|
|
11186
11186
|
const moduleScript = ast["module"];
|
|
11187
11187
|
const fragment = ast["fragment"];
|
|
11188
11188
|
if (instance && hasV4ExportLetProps(instance)) {
|
|
11189
|
-
warnings.push(`${
|
|
11189
|
+
warnings.push(`${name}: Svelte 4 export let syntax not yet supported (${filePath}); see INTEG-4267 for v5-only scope and follow-up`);
|
|
11190
11190
|
return { component: null, warnings };
|
|
11191
11191
|
}
|
|
11192
11192
|
const propsCall = instance ? findPropsCall(instance) : null;
|
|
@@ -11201,7 +11201,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11201
11201
|
instance,
|
|
11202
11202
|
moduleScript,
|
|
11203
11203
|
filePath,
|
|
11204
|
-
componentName:
|
|
11204
|
+
componentName: name,
|
|
11205
11205
|
source,
|
|
11206
11206
|
snippetLocals
|
|
11207
11207
|
});
|
|
@@ -11213,12 +11213,12 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11213
11213
|
extractionReasons.push(...result.additionalReasons);
|
|
11214
11214
|
} else if (instance) {
|
|
11215
11215
|
} else {
|
|
11216
|
-
warnings.push(`${
|
|
11216
|
+
warnings.push(`${name}: no instance script block (${filePath}); no props extracted`);
|
|
11217
11217
|
}
|
|
11218
11218
|
const templateSlots = fragment ? extractTemplateSlots(fragment) : [];
|
|
11219
11219
|
const { slots, mixedWarning } = mergeSlots2(snippetSlotsFromProps, templateSlots);
|
|
11220
11220
|
if (mixedWarning) {
|
|
11221
|
-
warnings.push(`${
|
|
11221
|
+
warnings.push(`${name}: mixed Snippet and <slot> usage detected (${filePath}); preferring Snippet entries`);
|
|
11222
11222
|
}
|
|
11223
11223
|
let propsTypeNameCapture;
|
|
11224
11224
|
if (propsCall) {
|
|
@@ -11231,7 +11231,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11231
11231
|
}
|
|
11232
11232
|
}
|
|
11233
11233
|
const component = {
|
|
11234
|
-
name
|
|
11234
|
+
name,
|
|
11235
11235
|
source: filePath,
|
|
11236
11236
|
framework: "svelte",
|
|
11237
11237
|
props,
|
|
@@ -11257,7 +11257,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11257
11257
|
instance,
|
|
11258
11258
|
moduleScript,
|
|
11259
11259
|
annotation,
|
|
11260
|
-
componentName:
|
|
11260
|
+
componentName: name
|
|
11261
11261
|
};
|
|
11262
11262
|
}
|
|
11263
11263
|
}
|
|
@@ -11400,8 +11400,8 @@ function describeAnnotationForUser(annotation) {
|
|
|
11400
11400
|
if (!annotation)
|
|
11401
11401
|
return "<unknown>";
|
|
11402
11402
|
if (annotation.type === "TSTypeReference") {
|
|
11403
|
-
const
|
|
11404
|
-
return
|
|
11403
|
+
const name = annotation["typeName"]?.["name"] ?? null;
|
|
11404
|
+
return name ? `'${name}'` : "<unnamed reference>";
|
|
11405
11405
|
}
|
|
11406
11406
|
if (annotation.type === "TSIntersectionType")
|
|
11407
11407
|
return "<intersection>";
|
|
@@ -11476,7 +11476,7 @@ async function resolveViaTypeChecker(annotation, instance, moduleScript, filePat
|
|
|
11476
11476
|
return null;
|
|
11477
11477
|
const members = [];
|
|
11478
11478
|
for (const symbol of properties) {
|
|
11479
|
-
const
|
|
11479
|
+
const name = symbol.getName();
|
|
11480
11480
|
const declaration = symbol.getValueDeclaration() ?? symbol.getDeclarations()[0];
|
|
11481
11481
|
if (!declaration)
|
|
11482
11482
|
continue;
|
|
@@ -11491,7 +11491,7 @@ async function resolveViaTypeChecker(annotation, instance, moduleScript, filePat
|
|
|
11491
11491
|
const declaredTypeText = readDeclaredTypeNodeText(declaration);
|
|
11492
11492
|
const isSnippet = declaredTypeText !== null && isSnippetTypeText(declaredTypeText, snippetLocals) || typeRefersToSnippet(propType) || isSnippetTypeText(typeText, snippetLocals);
|
|
11493
11493
|
members.push({
|
|
11494
|
-
name
|
|
11494
|
+
name,
|
|
11495
11495
|
optional: optional5,
|
|
11496
11496
|
typeText,
|
|
11497
11497
|
...declaredTypeText ? { declaredTypeText } : {},
|
|
@@ -11579,7 +11579,7 @@ function mergeSets(a, b) {
|
|
|
11579
11579
|
out.add(v);
|
|
11580
11580
|
return out;
|
|
11581
11581
|
}
|
|
11582
|
-
function findLocalTypeDeclaration(instance,
|
|
11582
|
+
function findLocalTypeDeclaration(instance, name, module) {
|
|
11583
11583
|
for (const script of [instance, module]) {
|
|
11584
11584
|
const body = script?.["content"]?.["body"];
|
|
11585
11585
|
if (!body)
|
|
@@ -11588,7 +11588,7 @@ function findLocalTypeDeclaration(instance, name2, module) {
|
|
|
11588
11588
|
const decl = stmt.type === "ExportNamedDeclaration" ? stmt["declaration"] ?? stmt : stmt;
|
|
11589
11589
|
if (decl.type === "TSInterfaceDeclaration" || decl.type === "TSTypeAliasDeclaration") {
|
|
11590
11590
|
const id = decl["id"];
|
|
11591
|
-
if (id?.["name"] ===
|
|
11591
|
+
if (id?.["name"] === name)
|
|
11592
11592
|
return decl;
|
|
11593
11593
|
}
|
|
11594
11594
|
}
|
|
@@ -11609,8 +11609,8 @@ function readMembersFromInterfaceOrAlias(decl, snippetLocals) {
|
|
|
11609
11609
|
}
|
|
11610
11610
|
return [];
|
|
11611
11611
|
}
|
|
11612
|
-
function readMembersFromTypeLiteral(
|
|
11613
|
-
const members =
|
|
11612
|
+
function readMembersFromTypeLiteral(literal3, snippetLocals) {
|
|
11613
|
+
const members = literal3["members"];
|
|
11614
11614
|
if (!members)
|
|
11615
11615
|
return [];
|
|
11616
11616
|
return members.map((m) => readPropertySignature(m, snippetLocals)).filter((m) => !!m);
|
|
@@ -11619,8 +11619,8 @@ function readPropertySignature(member, snippetLocals) {
|
|
|
11619
11619
|
if (member.type !== "TSPropertySignature")
|
|
11620
11620
|
return null;
|
|
11621
11621
|
const key = member["key"];
|
|
11622
|
-
const
|
|
11623
|
-
if (!
|
|
11622
|
+
const name = key?.["name"] ?? null;
|
|
11623
|
+
if (!name)
|
|
11624
11624
|
return null;
|
|
11625
11625
|
const optional5 = !!member["optional"];
|
|
11626
11626
|
const typeNode = member["typeAnnotation"]?.["typeAnnotation"];
|
|
@@ -11630,7 +11630,7 @@ function readPropertySignature(member, snippetLocals) {
|
|
|
11630
11630
|
const leading = member["leadingComments"] ?? [];
|
|
11631
11631
|
const description = extractJsdocText(leading);
|
|
11632
11632
|
return {
|
|
11633
|
-
name
|
|
11633
|
+
name,
|
|
11634
11634
|
optional: optional5,
|
|
11635
11635
|
typeText,
|
|
11636
11636
|
isSnippet,
|
|
@@ -11769,19 +11769,19 @@ function extractFromDestructure(propsCall, _ctx, typeMembers, warnings, addition
|
|
|
11769
11769
|
if (p.type !== "Property")
|
|
11770
11770
|
continue;
|
|
11771
11771
|
const key = p["key"];
|
|
11772
|
-
const
|
|
11773
|
-
if (!
|
|
11772
|
+
const name = key?.["name"] ?? null;
|
|
11773
|
+
if (!name)
|
|
11774
11774
|
continue;
|
|
11775
|
-
seenInDestructure.add(
|
|
11775
|
+
seenInDestructure.add(name);
|
|
11776
11776
|
const value = p["value"];
|
|
11777
11777
|
const hasDefault = value?.type === "AssignmentPattern";
|
|
11778
11778
|
const defaultValueRaw = hasDefault ? renderLiteral(value["right"]) : void 0;
|
|
11779
|
-
const typeMember = typeByName.get(
|
|
11779
|
+
const typeMember = typeByName.get(name);
|
|
11780
11780
|
if (typeMember?.isSnippet) {
|
|
11781
|
-
snippetNames.add(
|
|
11781
|
+
snippetNames.add(name);
|
|
11782
11782
|
const slot = {
|
|
11783
|
-
name
|
|
11784
|
-
isDefault:
|
|
11783
|
+
name,
|
|
11784
|
+
isDefault: name === "children",
|
|
11785
11785
|
...typeMember.description ? { description: typeMember.description } : {}
|
|
11786
11786
|
};
|
|
11787
11787
|
const authorText = typeMember.declaredTypeText ?? typeMember.typeText;
|
|
@@ -11792,7 +11792,7 @@ function extractFromDestructure(propsCall, _ctx, typeMembers, warnings, addition
|
|
|
11792
11792
|
}
|
|
11793
11793
|
const required = typeMember ? !typeMember.optional && !hasDefault : !hasDefault;
|
|
11794
11794
|
const propDef = {
|
|
11795
|
-
name
|
|
11795
|
+
name,
|
|
11796
11796
|
type: typeMember?.typeText ?? "unknown",
|
|
11797
11797
|
required
|
|
11798
11798
|
};
|
|
@@ -11850,9 +11850,9 @@ function propertyOrder(properties) {
|
|
|
11850
11850
|
for (const p of properties) {
|
|
11851
11851
|
if (p.type !== "Property")
|
|
11852
11852
|
continue;
|
|
11853
|
-
const
|
|
11854
|
-
if (
|
|
11855
|
-
m.set(
|
|
11853
|
+
const name = p["key"]?.["name"] ?? null;
|
|
11854
|
+
if (name)
|
|
11855
|
+
m.set(name, i++);
|
|
11856
11856
|
}
|
|
11857
11857
|
return m;
|
|
11858
11858
|
}
|
|
@@ -12031,10 +12031,10 @@ function extractTemplateSlots(fragment) {
|
|
|
12031
12031
|
if (!node)
|
|
12032
12032
|
return;
|
|
12033
12033
|
if (node.type === "SlotElement") {
|
|
12034
|
-
const
|
|
12035
|
-
if (!seen.has(
|
|
12036
|
-
seen.add(
|
|
12037
|
-
slots.push({ name
|
|
12034
|
+
const name = readSlotName(node);
|
|
12035
|
+
if (!seen.has(name)) {
|
|
12036
|
+
seen.add(name);
|
|
12037
|
+
slots.push({ name, isDefault: name === "default" });
|
|
12038
12038
|
}
|
|
12039
12039
|
}
|
|
12040
12040
|
const children = node["nodes"] ?? node["children"] ?? [];
|
|
@@ -12233,9 +12233,9 @@ function extractDecoratorInput(field) {
|
|
|
12233
12233
|
}
|
|
12234
12234
|
const resolved = resolvePropType(typeNode);
|
|
12235
12235
|
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
12236
|
-
const
|
|
12236
|
+
const name = alias ?? fieldName;
|
|
12237
12237
|
const prop = {
|
|
12238
|
-
name
|
|
12238
|
+
name,
|
|
12239
12239
|
type: typeText,
|
|
12240
12240
|
required,
|
|
12241
12241
|
sourceStartLine: field.getStartLineNumber(),
|
|
@@ -12305,9 +12305,9 @@ function extractSignalInput(field) {
|
|
|
12305
12305
|
const typeArg = init.getTypeArguments()[0];
|
|
12306
12306
|
const resolved = resolvePropType(typeArg);
|
|
12307
12307
|
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
12308
|
-
const
|
|
12308
|
+
const name = alias ?? fieldName;
|
|
12309
12309
|
const prop = {
|
|
12310
|
-
name
|
|
12310
|
+
name,
|
|
12311
12311
|
type: typeText,
|
|
12312
12312
|
required,
|
|
12313
12313
|
sourceStartLine: field.getStartLineNumber(),
|
|
@@ -12390,10 +12390,10 @@ function extractProps2(cls, meta) {
|
|
|
12390
12390
|
const parsed = parseInputsArrayEntry(entry);
|
|
12391
12391
|
if (!parsed)
|
|
12392
12392
|
continue;
|
|
12393
|
-
const
|
|
12394
|
-
if (byName.has(
|
|
12393
|
+
const name = parsed.alias ?? parsed.fieldName;
|
|
12394
|
+
if (byName.has(name))
|
|
12395
12395
|
continue;
|
|
12396
|
-
byName.set(
|
|
12396
|
+
byName.set(name, { name, type: "any", required: false });
|
|
12397
12397
|
}
|
|
12398
12398
|
return [...byName.values()];
|
|
12399
12399
|
}
|
|
@@ -12506,16 +12506,16 @@ async function resolveTemplateSource(meta) {
|
|
|
12506
12506
|
|
|
12507
12507
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/strip-library-prefix.js
|
|
12508
12508
|
var KNOWN_PREFIXES = ["Mat", "Cdk", "Nz", "Cds", "Ibm", "Clr", "Hlm", "Brn", "Tui", "Nb", "Fd", "P", "Ng"];
|
|
12509
|
-
function stripLibraryPrefix(
|
|
12509
|
+
function stripLibraryPrefix(name) {
|
|
12510
12510
|
for (const prefix of KNOWN_PREFIXES) {
|
|
12511
|
-
if (
|
|
12512
|
-
const rest =
|
|
12511
|
+
if (name.startsWith(prefix) && name.length > prefix.length) {
|
|
12512
|
+
const rest = name.slice(prefix.length);
|
|
12513
12513
|
if (rest[0] && rest[0] === rest[0].toUpperCase()) {
|
|
12514
12514
|
return rest;
|
|
12515
12515
|
}
|
|
12516
12516
|
}
|
|
12517
12517
|
}
|
|
12518
|
-
return
|
|
12518
|
+
return name;
|
|
12519
12519
|
}
|
|
12520
12520
|
|
|
12521
12521
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/derive-slot-name.js
|
|
@@ -12583,8 +12583,8 @@ function extractContentChildQueries(cls) {
|
|
|
12583
12583
|
if (init && Node15.isCallExpression(init)) {
|
|
12584
12584
|
const callee = init.getExpression();
|
|
12585
12585
|
if (Node15.isIdentifier(callee)) {
|
|
12586
|
-
const
|
|
12587
|
-
if (
|
|
12586
|
+
const name = callee.getText();
|
|
12587
|
+
if (name === "contentChild" || name === "contentChildren") {
|
|
12588
12588
|
const first = init.getArguments()[0];
|
|
12589
12589
|
const allowed = resolveClassIdentifierArg(first);
|
|
12590
12590
|
out.push(buildSlot(fieldName, allowed));
|
|
@@ -12613,9 +12613,9 @@ function resolveClassIdentifierArg(arg) {
|
|
|
12613
12613
|
return [arg.getText()];
|
|
12614
12614
|
return [];
|
|
12615
12615
|
}
|
|
12616
|
-
function buildSlot(
|
|
12616
|
+
function buildSlot(name, allowed) {
|
|
12617
12617
|
const slot = {
|
|
12618
|
-
name
|
|
12618
|
+
name,
|
|
12619
12619
|
isDefault: false
|
|
12620
12620
|
};
|
|
12621
12621
|
if (allowed.length > 0)
|
|
@@ -12649,11 +12649,11 @@ async function extractSlots3(cls, meta, props) {
|
|
|
12649
12649
|
const template = await resolveTemplateSource(meta);
|
|
12650
12650
|
if (template) {
|
|
12651
12651
|
for (const el of parseNgContentElements(template)) {
|
|
12652
|
-
const
|
|
12653
|
-
if (byName.has(
|
|
12652
|
+
const name = deriveSlotName(el.rawSelect, meta.normalizedName);
|
|
12653
|
+
if (byName.has(name))
|
|
12654
12654
|
continue;
|
|
12655
|
-
byName.set(
|
|
12656
|
-
name
|
|
12655
|
+
byName.set(name, {
|
|
12656
|
+
name,
|
|
12657
12657
|
isDefault: el.rawSelect === null
|
|
12658
12658
|
});
|
|
12659
12659
|
}
|
|
@@ -12735,9 +12735,9 @@ function normalizeSlots(slots) {
|
|
|
12735
12735
|
return slots.map((slot) => {
|
|
12736
12736
|
if (slot.name.trim())
|
|
12737
12737
|
return slot;
|
|
12738
|
-
const
|
|
12738
|
+
const name = fallbackIndex === 0 ? "children" : `slot_${fallbackIndex}`;
|
|
12739
12739
|
fallbackIndex++;
|
|
12740
|
-
return { ...slot, name
|
|
12740
|
+
return { ...slot, name };
|
|
12741
12741
|
});
|
|
12742
12742
|
}
|
|
12743
12743
|
|
|
@@ -13452,8 +13452,8 @@ ${fileDigest}`);
|
|
|
13452
13452
|
|
|
13453
13453
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
|
|
13454
13454
|
import { dirname as dirname14 } from "node:path";
|
|
13455
|
-
function kebabToPascal3(
|
|
13456
|
-
return
|
|
13455
|
+
function kebabToPascal3(name) {
|
|
13456
|
+
return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
|
|
13457
13457
|
}
|
|
13458
13458
|
function collectManifestEdges(files, componentNames) {
|
|
13459
13459
|
const edges = [];
|
|
@@ -13845,9 +13845,9 @@ import { resolve as resolve16 } from "node:path";
|
|
|
13845
13845
|
|
|
13846
13846
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/create-component-id.js
|
|
13847
13847
|
import { createHash as createHash7 } from "node:crypto";
|
|
13848
|
-
function createComponentId(
|
|
13849
|
-
const sourceHash = createHash7("sha256").update(`${
|
|
13850
|
-
return `${
|
|
13848
|
+
function createComponentId(name, resolvedSourcePath) {
|
|
13849
|
+
const sourceHash = createHash7("sha256").update(`${name}:${resolvedSourcePath}`).digest("hex").slice(0, 12);
|
|
13850
|
+
return `${name}-${sourceHash}`;
|
|
13851
13851
|
}
|
|
13852
13852
|
|
|
13853
13853
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/resolve-component-source-path.js
|
|
@@ -14144,10 +14144,10 @@ var CATEGORY_BY_EXTENSION = {
|
|
|
14144
14144
|
};
|
|
14145
14145
|
|
|
14146
14146
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/categorize-file.js
|
|
14147
|
-
function categorizeFile(
|
|
14148
|
-
if (
|
|
14147
|
+
function categorizeFile(name) {
|
|
14148
|
+
if (name.endsWith(".d.ts"))
|
|
14149
14149
|
return "other";
|
|
14150
|
-
const ext = path.extname(
|
|
14150
|
+
const ext = path.extname(name);
|
|
14151
14151
|
return CATEGORY_BY_EXTENSION[ext] ?? "other";
|
|
14152
14152
|
}
|
|
14153
14153
|
|
|
@@ -14155,20 +14155,20 @@ function categorizeFile(name2) {
|
|
|
14155
14155
|
import path2 from "node:path";
|
|
14156
14156
|
|
|
14157
14157
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/is-noise-config-file.js
|
|
14158
|
-
function isNoiseConfigFile(
|
|
14159
|
-
return DENYLISTED_EXACT_FILE_NAMES.has(
|
|
14158
|
+
function isNoiseConfigFile(name) {
|
|
14159
|
+
return DENYLISTED_EXACT_FILE_NAMES.has(name) || DENYLISTED_FILE_NAME_PATTERNS.some((pattern) => pattern.test(name));
|
|
14160
14160
|
}
|
|
14161
14161
|
|
|
14162
14162
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/is-source-file.js
|
|
14163
|
-
function isSourceFile(
|
|
14164
|
-
if (
|
|
14163
|
+
function isSourceFile(name) {
|
|
14164
|
+
if (name.endsWith(".d.ts"))
|
|
14165
14165
|
return false;
|
|
14166
|
-
if (EXCLUDED_SUFFIXES.some((suffix) =>
|
|
14166
|
+
if (EXCLUDED_SUFFIXES.some((suffix) => name.endsWith(suffix)))
|
|
14167
14167
|
return false;
|
|
14168
|
-
const ext = path2.extname(
|
|
14168
|
+
const ext = path2.extname(name);
|
|
14169
14169
|
if (INCLUDED_EXTENSIONS.has(ext))
|
|
14170
14170
|
return true;
|
|
14171
|
-
if (DENYLIST_GATED_EXTENSIONS.has(ext) && !isNoiseConfigFile(
|
|
14171
|
+
if (DENYLIST_GATED_EXTENSIONS.has(ext) && !isNoiseConfigFile(name))
|
|
14172
14172
|
return true;
|
|
14173
14173
|
return false;
|
|
14174
14174
|
}
|
|
@@ -14374,7 +14374,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14374
14374
|
const seen = /* @__PURE__ */ new Set();
|
|
14375
14375
|
for (const row of rows) {
|
|
14376
14376
|
const sourcePath = rowField(row, "source_path");
|
|
14377
|
-
const
|
|
14377
|
+
const name = rowField(row, "name");
|
|
14378
14378
|
if (!sourcePath)
|
|
14379
14379
|
continue;
|
|
14380
14380
|
const abs = resolve19(sourcePath);
|
|
@@ -14384,8 +14384,8 @@ async function buildSourceFingerprint(opts) {
|
|
|
14384
14384
|
try {
|
|
14385
14385
|
const st = await stat2(abs);
|
|
14386
14386
|
const entry = { mtime: st.mtime.toISOString() };
|
|
14387
|
-
if (
|
|
14388
|
-
entry.componentName =
|
|
14387
|
+
if (name)
|
|
14388
|
+
entry.componentName = name;
|
|
14389
14389
|
files[abs] = entry;
|
|
14390
14390
|
} catch {
|
|
14391
14391
|
}
|
|
@@ -14416,10 +14416,10 @@ var SAVE_FILES = ["components.json", "tokens.json"];
|
|
|
14416
14416
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/list-conflicting-files.js
|
|
14417
14417
|
async function listConflictingFiles(path5) {
|
|
14418
14418
|
const conflicts = [];
|
|
14419
|
-
for (const
|
|
14419
|
+
for (const name of SAVE_FILES) {
|
|
14420
14420
|
try {
|
|
14421
|
-
await access4(join14(path5,
|
|
14422
|
-
conflicts.push(
|
|
14421
|
+
await access4(join14(path5, name));
|
|
14422
|
+
conflicts.push(name);
|
|
14423
14423
|
} catch {
|
|
14424
14424
|
}
|
|
14425
14425
|
}
|
|
@@ -14636,18 +14636,18 @@ var separatorObjectExplode = (style) => {
|
|
|
14636
14636
|
return "&";
|
|
14637
14637
|
}
|
|
14638
14638
|
};
|
|
14639
|
-
var serializeArrayParam = ({ allowReserved, explode, name
|
|
14639
|
+
var serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
14640
14640
|
if (!explode) {
|
|
14641
14641
|
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
14642
14642
|
switch (style) {
|
|
14643
14643
|
case "label":
|
|
14644
14644
|
return `.${joinedValues2}`;
|
|
14645
14645
|
case "matrix":
|
|
14646
|
-
return `;${
|
|
14646
|
+
return `;${name}=${joinedValues2}`;
|
|
14647
14647
|
case "simple":
|
|
14648
14648
|
return joinedValues2;
|
|
14649
14649
|
default:
|
|
14650
|
-
return `${
|
|
14650
|
+
return `${name}=${joinedValues2}`;
|
|
14651
14651
|
}
|
|
14652
14652
|
}
|
|
14653
14653
|
const separator = separatorArrayExplode(style);
|
|
@@ -14657,24 +14657,24 @@ var serializeArrayParam = ({ allowReserved, explode, name: name2, style, value }
|
|
|
14657
14657
|
}
|
|
14658
14658
|
return serializePrimitiveParam({
|
|
14659
14659
|
allowReserved,
|
|
14660
|
-
name
|
|
14660
|
+
name,
|
|
14661
14661
|
value: v
|
|
14662
14662
|
});
|
|
14663
14663
|
}).join(separator);
|
|
14664
14664
|
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
14665
14665
|
};
|
|
14666
|
-
var serializePrimitiveParam = ({ allowReserved, name
|
|
14666
|
+
var serializePrimitiveParam = ({ allowReserved, name, value }) => {
|
|
14667
14667
|
if (value === void 0 || value === null) {
|
|
14668
14668
|
return "";
|
|
14669
14669
|
}
|
|
14670
14670
|
if (typeof value === "object") {
|
|
14671
14671
|
throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
|
|
14672
14672
|
}
|
|
14673
|
-
return `${
|
|
14673
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
14674
14674
|
};
|
|
14675
|
-
var serializeObjectParam = ({ allowReserved, explode, name
|
|
14675
|
+
var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
14676
14676
|
if (value instanceof Date) {
|
|
14677
|
-
return valueOnly ? value.toISOString() : `${
|
|
14677
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
14678
14678
|
}
|
|
14679
14679
|
if (style !== "deepObject" && !explode) {
|
|
14680
14680
|
let values = [];
|
|
@@ -14688,11 +14688,11 @@ var serializeObjectParam = ({ allowReserved, explode, name: name2, style, value,
|
|
|
14688
14688
|
const joinedValues2 = values.join(",");
|
|
14689
14689
|
switch (style) {
|
|
14690
14690
|
case "form":
|
|
14691
|
-
return `${
|
|
14691
|
+
return `${name}=${joinedValues2}`;
|
|
14692
14692
|
case "label":
|
|
14693
14693
|
return `.${joinedValues2}`;
|
|
14694
14694
|
case "matrix":
|
|
14695
|
-
return `;${
|
|
14695
|
+
return `;${name}=${joinedValues2}`;
|
|
14696
14696
|
default:
|
|
14697
14697
|
return joinedValues2;
|
|
14698
14698
|
}
|
|
@@ -14700,7 +14700,7 @@ var serializeObjectParam = ({ allowReserved, explode, name: name2, style, value,
|
|
|
14700
14700
|
const separator = separatorObjectExplode(style);
|
|
14701
14701
|
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
|
|
14702
14702
|
allowReserved,
|
|
14703
|
-
name: style === "deepObject" ? `${
|
|
14703
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
14704
14704
|
value: v
|
|
14705
14705
|
})).join(separator);
|
|
14706
14706
|
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
@@ -14714,31 +14714,31 @@ var defaultPathSerializer = ({ path: path5, url: _url }) => {
|
|
|
14714
14714
|
if (matches) {
|
|
14715
14715
|
for (const match2 of matches) {
|
|
14716
14716
|
let explode = false;
|
|
14717
|
-
let
|
|
14717
|
+
let name = match2.substring(1, match2.length - 1);
|
|
14718
14718
|
let style = "simple";
|
|
14719
|
-
if (
|
|
14719
|
+
if (name.endsWith("*")) {
|
|
14720
14720
|
explode = true;
|
|
14721
|
-
|
|
14721
|
+
name = name.substring(0, name.length - 1);
|
|
14722
14722
|
}
|
|
14723
|
-
if (
|
|
14724
|
-
|
|
14723
|
+
if (name.startsWith(".")) {
|
|
14724
|
+
name = name.substring(1);
|
|
14725
14725
|
style = "label";
|
|
14726
|
-
} else if (
|
|
14727
|
-
|
|
14726
|
+
} else if (name.startsWith(";")) {
|
|
14727
|
+
name = name.substring(1);
|
|
14728
14728
|
style = "matrix";
|
|
14729
14729
|
}
|
|
14730
|
-
const value = path5[
|
|
14730
|
+
const value = path5[name];
|
|
14731
14731
|
if (value === void 0 || value === null) {
|
|
14732
14732
|
continue;
|
|
14733
14733
|
}
|
|
14734
14734
|
if (Array.isArray(value)) {
|
|
14735
|
-
url = url.replace(match2, serializeArrayParam({ explode, name
|
|
14735
|
+
url = url.replace(match2, serializeArrayParam({ explode, name, style, value }));
|
|
14736
14736
|
continue;
|
|
14737
14737
|
}
|
|
14738
14738
|
if (typeof value === "object") {
|
|
14739
14739
|
url = url.replace(match2, serializeObjectParam({
|
|
14740
14740
|
explode,
|
|
14741
|
-
name
|
|
14741
|
+
name,
|
|
14742
14742
|
style,
|
|
14743
14743
|
value,
|
|
14744
14744
|
valueOnly: true
|
|
@@ -14747,7 +14747,7 @@ var defaultPathSerializer = ({ path: path5, url: _url }) => {
|
|
|
14747
14747
|
}
|
|
14748
14748
|
if (style === "matrix") {
|
|
14749
14749
|
url = url.replace(match2, `;${serializePrimitiveParam({
|
|
14750
|
-
name
|
|
14750
|
+
name,
|
|
14751
14751
|
value
|
|
14752
14752
|
})}`);
|
|
14753
14753
|
continue;
|
|
@@ -14758,12 +14758,12 @@ var defaultPathSerializer = ({ path: path5, url: _url }) => {
|
|
|
14758
14758
|
}
|
|
14759
14759
|
return url;
|
|
14760
14760
|
};
|
|
14761
|
-
var createQuerySerializer = ({ allowReserved, array:
|
|
14761
|
+
var createQuerySerializer = ({ allowReserved, array: array3, object } = {}) => {
|
|
14762
14762
|
const querySerializer = (queryParams) => {
|
|
14763
14763
|
const search = [];
|
|
14764
14764
|
if (queryParams && typeof queryParams === "object") {
|
|
14765
|
-
for (const
|
|
14766
|
-
const value = queryParams[
|
|
14765
|
+
for (const name in queryParams) {
|
|
14766
|
+
const value = queryParams[name];
|
|
14767
14767
|
if (value === void 0 || value === null) {
|
|
14768
14768
|
continue;
|
|
14769
14769
|
}
|
|
@@ -14771,10 +14771,10 @@ var createQuerySerializer = ({ allowReserved, array: array4, object } = {}) => {
|
|
|
14771
14771
|
const serializedArray = serializeArrayParam({
|
|
14772
14772
|
allowReserved,
|
|
14773
14773
|
explode: true,
|
|
14774
|
-
name
|
|
14774
|
+
name,
|
|
14775
14775
|
style: "form",
|
|
14776
14776
|
value,
|
|
14777
|
-
...
|
|
14777
|
+
...array3
|
|
14778
14778
|
});
|
|
14779
14779
|
if (serializedArray)
|
|
14780
14780
|
search.push(serializedArray);
|
|
@@ -14782,7 +14782,7 @@ var createQuerySerializer = ({ allowReserved, array: array4, object } = {}) => {
|
|
|
14782
14782
|
const serializedObject = serializeObjectParam({
|
|
14783
14783
|
allowReserved,
|
|
14784
14784
|
explode: true,
|
|
14785
|
-
name
|
|
14785
|
+
name,
|
|
14786
14786
|
style: "deepObject",
|
|
14787
14787
|
value,
|
|
14788
14788
|
...object
|
|
@@ -14792,7 +14792,7 @@ var createQuerySerializer = ({ allowReserved, array: array4, object } = {}) => {
|
|
|
14792
14792
|
} else {
|
|
14793
14793
|
const serializedPrimitive = serializePrimitiveParam({
|
|
14794
14794
|
allowReserved,
|
|
14795
|
-
name
|
|
14795
|
+
name,
|
|
14796
14796
|
value
|
|
14797
14797
|
});
|
|
14798
14798
|
if (serializedPrimitive)
|
|
@@ -14826,11 +14826,11 @@ var getParseAs = (contentType) => {
|
|
|
14826
14826
|
}
|
|
14827
14827
|
return;
|
|
14828
14828
|
};
|
|
14829
|
-
var checkForExistence = (options,
|
|
14830
|
-
if (!
|
|
14829
|
+
var checkForExistence = (options, name) => {
|
|
14830
|
+
if (!name) {
|
|
14831
14831
|
return false;
|
|
14832
14832
|
}
|
|
14833
|
-
if (options.headers.has(
|
|
14833
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
14834
14834
|
return true;
|
|
14835
14835
|
}
|
|
14836
14836
|
return false;
|
|
@@ -14844,20 +14844,20 @@ var setAuthParams = async ({ security, ...options }) => {
|
|
|
14844
14844
|
if (!token) {
|
|
14845
14845
|
continue;
|
|
14846
14846
|
}
|
|
14847
|
-
const
|
|
14847
|
+
const name = auth.name ?? "Authorization";
|
|
14848
14848
|
switch (auth.in) {
|
|
14849
14849
|
case "query":
|
|
14850
14850
|
if (!options.query) {
|
|
14851
14851
|
options.query = {};
|
|
14852
14852
|
}
|
|
14853
|
-
options.query[
|
|
14853
|
+
options.query[name] = token;
|
|
14854
14854
|
break;
|
|
14855
14855
|
case "cookie":
|
|
14856
|
-
options.headers.append("Cookie", `${
|
|
14856
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
14857
14857
|
break;
|
|
14858
14858
|
case "header":
|
|
14859
14859
|
default:
|
|
14860
|
-
options.headers.set(
|
|
14860
|
+
options.headers.set(name, token);
|
|
14861
14861
|
break;
|
|
14862
14862
|
}
|
|
14863
14863
|
}
|
|
@@ -15716,11 +15716,11 @@ function parseEdsiError(rawInput) {
|
|
|
15716
15716
|
...binding.diagnostics ? { diagnostics: binding.diagnostics } : {}
|
|
15717
15717
|
};
|
|
15718
15718
|
}
|
|
15719
|
-
const
|
|
15720
|
-
if (
|
|
15719
|
+
const literal3 = parseObjectLiteralTail(cleaned);
|
|
15720
|
+
if (literal3 && (literal3.code || literal3.cycle)) {
|
|
15721
15721
|
const braceStart = cleaned.lastIndexOf("{");
|
|
15722
15722
|
const head = braceStart === -1 ? cleaned : cleaned.slice(0, braceStart).trim();
|
|
15723
|
-
return { code:
|
|
15723
|
+
return { code: literal3.code ?? null, message: head || cleaned, cycle: literal3.cycle ?? null, raw: false };
|
|
15724
15724
|
}
|
|
15725
15725
|
return { code: null, message: cleaned || prefix || rawInput, cycle: null, raw: true };
|
|
15726
15726
|
}
|
|
@@ -16023,8 +16023,8 @@ function countCharacterEdits(a, b) {
|
|
|
16023
16023
|
}
|
|
16024
16024
|
|
|
16025
16025
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/simplify-name-for-comparison.js
|
|
16026
|
-
function simplifyNameForComparison(
|
|
16027
|
-
const stripped =
|
|
16026
|
+
function simplifyNameForComparison(name) {
|
|
16027
|
+
const stripped = name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
16028
16028
|
return stripped.endsWith("s") && stripped.length > 1 ? stripped.slice(0, -1) : stripped;
|
|
16029
16029
|
}
|
|
16030
16030
|
|
|
@@ -16326,9 +16326,9 @@ init_cache_keys();
|
|
|
16326
16326
|
import { execFile } from "node:child_process";
|
|
16327
16327
|
import { promisify } from "node:util";
|
|
16328
16328
|
var execFileAsync = promisify(execFile);
|
|
16329
|
-
async function binaryExists(
|
|
16329
|
+
async function binaryExists(name) {
|
|
16330
16330
|
try {
|
|
16331
|
-
await execFileAsync(process.platform === "win32" ? "where" : "which", [
|
|
16331
|
+
await execFileAsync(process.platform === "win32" ? "where" : "which", [name]);
|
|
16332
16332
|
return true;
|
|
16333
16333
|
} catch {
|
|
16334
16334
|
return false;
|
|
@@ -16798,20 +16798,20 @@ function collectSiblingRendererImports(sourceText) {
|
|
|
16798
16798
|
continue;
|
|
16799
16799
|
if (/-g(?:ql|gl)(?:$|\.)/i.test(importPath))
|
|
16800
16800
|
continue;
|
|
16801
|
-
for (const
|
|
16802
|
-
if (
|
|
16803
|
-
names.add(
|
|
16801
|
+
for (const name of parseImportedNames(importClause)) {
|
|
16802
|
+
if (name)
|
|
16803
|
+
names.add(name);
|
|
16804
16804
|
}
|
|
16805
16805
|
}
|
|
16806
16806
|
return [...names];
|
|
16807
16807
|
}
|
|
16808
16808
|
function hasSiblingForwardRender(sourceText, siblingImports) {
|
|
16809
|
-
return siblingImports.some((
|
|
16810
|
-
const renderPattern = new RegExp(`<${escapeRegExp(
|
|
16809
|
+
return siblingImports.some((name) => {
|
|
16810
|
+
const renderPattern = new RegExp(`<${escapeRegExp(name)}\\b[\\s\\S]*?(?:/>|</${escapeRegExp(name)}>)`);
|
|
16811
16811
|
if (!renderPattern.test(sourceText))
|
|
16812
16812
|
return false;
|
|
16813
|
-
const siblingSpreadPattern = new RegExp(`<${escapeRegExp(
|
|
16814
|
-
const propsPlusSiblingSpreadPattern = new RegExp(`<${escapeRegExp(
|
|
16813
|
+
const siblingSpreadPattern = new RegExp(`<${escapeRegExp(name)}\\b[^>]*\\{\\.\\.\\.(?!props\\b)[^}]+\\}`);
|
|
16814
|
+
const propsPlusSiblingSpreadPattern = new RegExp(`<${escapeRegExp(name)}\\b[^>]*\\{\\.\\.\\.props\\}[^>]*\\{\\.\\.\\.(?!props\\b)[^}]+\\}`);
|
|
16815
16815
|
return siblingSpreadPattern.test(sourceText) || propsPlusSiblingSpreadPattern.test(sourceText);
|
|
16816
16816
|
});
|
|
16817
16817
|
}
|
|
@@ -17058,34 +17058,34 @@ var DOM_PASS_THROUGH_PROPS = /* @__PURE__ */ new Set([
|
|
|
17058
17058
|
"modelValue",
|
|
17059
17059
|
"modelModifiers"
|
|
17060
17060
|
]);
|
|
17061
|
-
function isDomPassThroughProp(
|
|
17062
|
-
if (DOM_PASS_THROUGH_PROPS.has(
|
|
17061
|
+
function isDomPassThroughProp(name) {
|
|
17062
|
+
if (DOM_PASS_THROUGH_PROPS.has(name))
|
|
17063
17063
|
return true;
|
|
17064
|
-
if (/^aria[-A-Z]/.test(
|
|
17064
|
+
if (/^aria[-A-Z]/.test(name))
|
|
17065
17065
|
return true;
|
|
17066
|
-
return
|
|
17066
|
+
return name.startsWith("data-");
|
|
17067
17067
|
}
|
|
17068
17068
|
function preClassifyProp(prop) {
|
|
17069
|
-
const { name
|
|
17070
|
-
if (/^on[A-Z]/.test(
|
|
17069
|
+
const { name, type } = prop;
|
|
17070
|
+
if (/^on[A-Z]/.test(name) || type.includes("=> void") || type.includes("EventHandler")) {
|
|
17071
17071
|
return { category: "exclude" };
|
|
17072
17072
|
}
|
|
17073
|
-
if (
|
|
17073
|
+
if (name === "ref" || name === "innerRef" || type.includes("Ref<") || type.includes("RefObject<")) {
|
|
17074
17074
|
return { category: "exclude" };
|
|
17075
17075
|
}
|
|
17076
|
-
if (
|
|
17076
|
+
if (name === "testId" || name === "data-testid" || name === "dataTestId") {
|
|
17077
17077
|
return { category: "exclude" };
|
|
17078
17078
|
}
|
|
17079
|
-
if (
|
|
17079
|
+
if (name === "key") {
|
|
17080
17080
|
return { category: "exclude" };
|
|
17081
17081
|
}
|
|
17082
17082
|
if (type.includes("Dispatch<") || type.includes("SetStateAction")) {
|
|
17083
17083
|
return { category: "exclude" };
|
|
17084
17084
|
}
|
|
17085
|
-
if (isDomPassThroughProp(
|
|
17085
|
+
if (isDomPassThroughProp(name)) {
|
|
17086
17086
|
return { category: "exclude" };
|
|
17087
17087
|
}
|
|
17088
|
-
if (
|
|
17088
|
+
if (name === "name" && prop.domAttribute) {
|
|
17089
17089
|
return { category: "exclude" };
|
|
17090
17090
|
}
|
|
17091
17091
|
if (isStringLiteralUnion(type)) {
|
|
@@ -17094,36 +17094,36 @@ function preClassifyProp(prop) {
|
|
|
17094
17094
|
if (!isComplexType(type)) {
|
|
17095
17095
|
const designNameStart = /^(variant|size|spacing|gap|color|bg|theme|align|layout|orientation|position)/i;
|
|
17096
17096
|
const designNameEnd = /(Color|Size|Variant|Style)$/;
|
|
17097
|
-
if (designNameStart.test(
|
|
17097
|
+
if (designNameStart.test(name) || designNameEnd.test(name)) {
|
|
17098
17098
|
return { category: "design", cdfTypeHint: "string" };
|
|
17099
17099
|
}
|
|
17100
17100
|
}
|
|
17101
17101
|
if (isBooleanType(type)) {
|
|
17102
17102
|
const stateNames = ["disabled", "loading", "expanded", "isOpen", "selected", "checked", "active", "preview"];
|
|
17103
|
-
if (stateNames.includes(
|
|
17103
|
+
if (stateNames.includes(name)) {
|
|
17104
17104
|
return { category: "state", cdfTypeHint: "boolean" };
|
|
17105
17105
|
}
|
|
17106
17106
|
}
|
|
17107
17107
|
if (isBooleanType(type)) {
|
|
17108
17108
|
const visualToggle = /^(hide|show|enable|disable|vertical|horizontal|reverse|bold|italic|imageOn|with)/i;
|
|
17109
|
-
if (visualToggle.test(
|
|
17109
|
+
if (visualToggle.test(name)) {
|
|
17110
17110
|
return { category: "design", cdfTypeHint: "boolean" };
|
|
17111
17111
|
}
|
|
17112
17112
|
}
|
|
17113
|
-
if (
|
|
17113
|
+
if (name === "componentId" || name === "sectionKey" || name === "locale" || name === "variantIndex") {
|
|
17114
17114
|
return { category: "state", cdfTypeHint: "string" };
|
|
17115
17115
|
}
|
|
17116
17116
|
if (isStringType(type)) {
|
|
17117
17117
|
const urlNameStart = /^(href|url|link|src)/i;
|
|
17118
17118
|
const urlNameEnd = /(Url|Href|Link|Src)$/;
|
|
17119
|
-
if (urlNameStart.test(
|
|
17119
|
+
if (urlNameStart.test(name) || urlNameEnd.test(name)) {
|
|
17120
17120
|
return { category: "content", cdfTypeHint: "string" };
|
|
17121
17121
|
}
|
|
17122
17122
|
}
|
|
17123
17123
|
if (isStringType(type)) {
|
|
17124
17124
|
const textNameStart = /^(label|title|text|description|caption|heading|subheading|body|alt|name|placeholder|summary)/i;
|
|
17125
17125
|
const textNameEnd = /(Text|Label|Title|Name)$/;
|
|
17126
|
-
if (textNameStart.test(
|
|
17126
|
+
if (textNameStart.test(name) || textNameEnd.test(name)) {
|
|
17127
17127
|
return { category: "content", cdfTypeHint: "string" };
|
|
17128
17128
|
}
|
|
17129
17129
|
}
|
|
@@ -17332,7 +17332,7 @@ async function resolveComposition(request) {
|
|
|
17332
17332
|
timeoutMs: 12e4,
|
|
17333
17333
|
promptViaStdin: true,
|
|
17334
17334
|
bedrock,
|
|
17335
|
-
onDebugEvent: (
|
|
17335
|
+
onDebugEvent: (name, payload) => onDebugEvent?.("agent", { event: name, ...payload })
|
|
17336
17336
|
});
|
|
17337
17337
|
lastAgentExitCode = res.exitCode;
|
|
17338
17338
|
if (res.exitCode !== 0 && res.stderr.trim()) {
|
|
@@ -17593,7 +17593,7 @@ function collectDuplicateNames(components) {
|
|
|
17593
17593
|
sources.push(c2.source);
|
|
17594
17594
|
nameCounts.set(c2.name, sources);
|
|
17595
17595
|
}
|
|
17596
|
-
return [...nameCounts.entries()].filter(([, srcs]) => srcs.length > 1).map(([
|
|
17596
|
+
return [...nameCounts.entries()].filter(([, srcs]) => srcs.length > 1).map(([name, sources]) => ({ name, sources }));
|
|
17597
17597
|
}
|
|
17598
17598
|
|
|
17599
17599
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/filter-dropped-allowed-components.js
|
|
@@ -17684,7 +17684,7 @@ async function runOneGenerateComponent(options, component, index, total) {
|
|
|
17684
17684
|
});
|
|
17685
17685
|
}
|
|
17686
17686
|
}
|
|
17687
|
-
effectiveSlots = effectiveSlots.map((slot) => slot.allowedComponents ? { ...slot, allowedComponents: slot.allowedComponents.filter((
|
|
17687
|
+
effectiveSlots = effectiveSlots.map((slot) => slot.allowedComponents ? { ...slot, allowedComponents: slot.allowedComponents.filter((name) => allowedComponentNames2.has(name)) } : slot);
|
|
17688
17688
|
const cacheComponent = normalizeComponentForCache(component);
|
|
17689
17689
|
if (!noCache && precomputedCachedNames.has(component.name)) {
|
|
17690
17690
|
onProgress?.({ kind: "component:cached", index, total, name: component.name, pinned: false });
|
|
@@ -19499,7 +19499,7 @@ function collectDependents(components) {
|
|
|
19499
19499
|
function findRoots(components, selected) {
|
|
19500
19500
|
const scope = selected ? components.filter((c2) => selected.has(c2.name)) : components;
|
|
19501
19501
|
const dependents = collectDependents(scope);
|
|
19502
|
-
return scope.map((c2) => c2.name).filter((
|
|
19502
|
+
return scope.map((c2) => c2.name).filter((name) => !dependents.has(name)).sort();
|
|
19503
19503
|
}
|
|
19504
19504
|
function findCycleInClosure(root, reachable, components) {
|
|
19505
19505
|
const scopedComponents = components.filter((c2) => reachable.has(c2.name)).map((c2) => ({ name: c2.name, slots: c2.slots }));
|
|
@@ -19535,9 +19535,9 @@ function computeClosure(root, components) {
|
|
|
19535
19535
|
const reachable = walkReachable2(root, byName, known);
|
|
19536
19536
|
const cyclePath = findCycleInClosure(root, reachable, components);
|
|
19537
19537
|
if (cyclePath) {
|
|
19538
|
-
const nodes2 = [...reachable].sort().map((
|
|
19539
|
-
name
|
|
19540
|
-
depth:
|
|
19538
|
+
const nodes2 = [...reachable].sort().map((name) => ({
|
|
19539
|
+
name,
|
|
19540
|
+
depth: name === root ? 0 : 1,
|
|
19541
19541
|
path: [root],
|
|
19542
19542
|
parents: []
|
|
19543
19543
|
}));
|
|
@@ -19573,12 +19573,12 @@ function computeClosure(root, components) {
|
|
|
19573
19573
|
}
|
|
19574
19574
|
}
|
|
19575
19575
|
const nodes = [];
|
|
19576
|
-
for (const [
|
|
19576
|
+
for (const [name, d] of depth.entries()) {
|
|
19577
19577
|
nodes.push({
|
|
19578
|
-
name
|
|
19578
|
+
name,
|
|
19579
19579
|
depth: d,
|
|
19580
|
-
path: parentPath.get(
|
|
19581
|
-
parents: [...parents.get(
|
|
19580
|
+
path: parentPath.get(name),
|
|
19581
|
+
parents: [...parents.get(name) ?? /* @__PURE__ */ new Set()].sort()
|
|
19582
19582
|
});
|
|
19583
19583
|
}
|
|
19584
19584
|
nodes.sort((a, b) => a.depth - b.depth || a.name.localeCompare(b.name));
|
|
@@ -19601,8 +19601,8 @@ function findSharedDeps(closures) {
|
|
|
19601
19601
|
}
|
|
19602
19602
|
}
|
|
19603
19603
|
const out = /* @__PURE__ */ new Map();
|
|
19604
|
-
for (const [
|
|
19605
|
-
if (roots.length >= 2) out.set(
|
|
19604
|
+
for (const [name, roots] of counts.entries()) {
|
|
19605
|
+
if (roots.length >= 2) out.set(name, [...roots].sort());
|
|
19606
19606
|
}
|
|
19607
19607
|
return out;
|
|
19608
19608
|
}
|
|
@@ -19758,11 +19758,11 @@ function buildVisibleRows(props) {
|
|
|
19758
19758
|
if (!expanded) continue;
|
|
19759
19759
|
const subtree = computeCycleMemberSubtree(key);
|
|
19760
19760
|
const isLastAtDepthSubtree = (idx) => {
|
|
19761
|
-
const
|
|
19761
|
+
const own2 = subtree[idx].depth;
|
|
19762
19762
|
for (let j = idx + 1; j < subtree.length; j++) {
|
|
19763
19763
|
const d = subtree[j].depth;
|
|
19764
|
-
if (d <
|
|
19765
|
-
if (d ===
|
|
19764
|
+
if (d < own2) return true;
|
|
19765
|
+
if (d === own2) return false;
|
|
19766
19766
|
}
|
|
19767
19767
|
return true;
|
|
19768
19768
|
};
|
|
@@ -19805,13 +19805,13 @@ function buildVisibleRows(props) {
|
|
|
19805
19805
|
...findRoots(subgraph),
|
|
19806
19806
|
...subgraph.filter((n) => hasDirectChild(n)).map((n) => n.name)
|
|
19807
19807
|
]);
|
|
19808
|
-
for (const
|
|
19809
|
-
const full = computeClosure(
|
|
19810
|
-
closures.set(
|
|
19808
|
+
for (const name of [...parentNames].sort()) {
|
|
19809
|
+
const full = computeClosure(name, subgraph);
|
|
19810
|
+
closures.set(name, { ...full, nodes: full.nodes.filter((n) => n.depth <= 1) });
|
|
19811
19811
|
}
|
|
19812
19812
|
const sharedDeps = findSharedDeps(closures);
|
|
19813
|
-
const hasCycleDepDirect = (
|
|
19814
|
-
const it = itemByKey.get(
|
|
19813
|
+
const hasCycleDepDirect = (name) => {
|
|
19814
|
+
const it = itemByKey.get(name)?.it;
|
|
19815
19815
|
if (!it) return false;
|
|
19816
19816
|
for (const target of allowedComponentNames(it.entry)) {
|
|
19817
19817
|
if (cycleParticipants.has(target)) return true;
|
|
@@ -19882,11 +19882,11 @@ function buildVisibleRows(props) {
|
|
|
19882
19882
|
injectedChildren.push({ name: c2.name, depth: c2.depth, isCycleChild: false });
|
|
19883
19883
|
}
|
|
19884
19884
|
const isLastAtDepth = (idx) => {
|
|
19885
|
-
const
|
|
19885
|
+
const own2 = injectedChildren[idx].depth;
|
|
19886
19886
|
for (let j = idx + 1; j < injectedChildren.length; j++) {
|
|
19887
19887
|
const d = injectedChildren[j].depth;
|
|
19888
|
-
if (d <
|
|
19889
|
-
if (d ===
|
|
19888
|
+
if (d < own2) return true;
|
|
19889
|
+
if (d === own2) return false;
|
|
19890
19890
|
}
|
|
19891
19891
|
return true;
|
|
19892
19892
|
};
|
|
@@ -19916,28 +19916,28 @@ function buildVisibleRows(props) {
|
|
|
19916
19916
|
});
|
|
19917
19917
|
});
|
|
19918
19918
|
}
|
|
19919
|
-
for (const
|
|
19920
|
-
const rec = itemByKey.get(
|
|
19919
|
+
for (const name of standaloneRoots) {
|
|
19920
|
+
const rec = itemByKey.get(name);
|
|
19921
19921
|
if (!rec) continue;
|
|
19922
19922
|
rows.push({
|
|
19923
19923
|
kind: "standalone",
|
|
19924
|
-
key: `stand:${
|
|
19925
|
-
label:
|
|
19924
|
+
key: `stand:${name}`,
|
|
19925
|
+
label: name,
|
|
19926
19926
|
indent: 0,
|
|
19927
19927
|
itemIdx: rec.idx
|
|
19928
19928
|
});
|
|
19929
19929
|
}
|
|
19930
19930
|
const nodeByName = new Map(subgraph.map((n) => [n.name, n]));
|
|
19931
|
-
const sharedLeafNames = [...sharedDeps.keys()].filter((
|
|
19931
|
+
const sharedLeafNames = [...sharedDeps.keys()].filter((name) => (nodeByName.get(name)?.slots.length ?? 0) === 0).sort();
|
|
19932
19932
|
const seenStandaloneNames = new Set(standaloneRoots);
|
|
19933
|
-
for (const
|
|
19934
|
-
if (seenStandaloneNames.has(
|
|
19935
|
-
const rec = itemByKey.get(
|
|
19933
|
+
for (const name of sharedLeafNames) {
|
|
19934
|
+
if (seenStandaloneNames.has(name)) continue;
|
|
19935
|
+
const rec = itemByKey.get(name);
|
|
19936
19936
|
if (!rec) continue;
|
|
19937
19937
|
rows.push({
|
|
19938
19938
|
kind: "standalone",
|
|
19939
|
-
key: `shared-standalone:${
|
|
19940
|
-
label: `${
|
|
19939
|
+
key: `shared-standalone:${name}`,
|
|
19940
|
+
label: `${name} (shared)`,
|
|
19941
19941
|
indent: 0,
|
|
19942
19942
|
sharedSuffix: true,
|
|
19943
19943
|
itemIdx: rec.idx
|
|
@@ -19953,13 +19953,13 @@ function buildVisibleRows(props) {
|
|
|
19953
19953
|
indent: 0,
|
|
19954
19954
|
itemIdx: -1
|
|
19955
19955
|
});
|
|
19956
|
-
for (const
|
|
19957
|
-
const rec = itemByKey.get(
|
|
19956
|
+
for (const name of flatNames) {
|
|
19957
|
+
const rec = itemByKey.get(name);
|
|
19958
19958
|
if (!rec) continue;
|
|
19959
19959
|
rows.push({
|
|
19960
19960
|
kind: "flat",
|
|
19961
|
-
key: `flat:${
|
|
19962
|
-
label:
|
|
19961
|
+
key: `flat:${name}`,
|
|
19962
|
+
label: name,
|
|
19963
19963
|
indent: 0,
|
|
19964
19964
|
itemIdx: rec.idx
|
|
19965
19965
|
});
|
|
@@ -19969,9 +19969,9 @@ function buildVisibleRows(props) {
|
|
|
19969
19969
|
if (filterVisibleKeys !== void 0) {
|
|
19970
19970
|
return rows.filter((row) => {
|
|
19971
19971
|
if (row.itemIdx < 0) return true;
|
|
19972
|
-
const
|
|
19973
|
-
if (
|
|
19974
|
-
return filterVisibleKeys.has(
|
|
19972
|
+
const name = items[row.itemIdx]?.key;
|
|
19973
|
+
if (name === void 0) return true;
|
|
19974
|
+
return filterVisibleKeys.has(name);
|
|
19975
19975
|
});
|
|
19976
19976
|
}
|
|
19977
19977
|
return rows;
|
|
@@ -20616,11 +20616,11 @@ function computeCycleAwareAcceptCascade(target, components, cycleUnits) {
|
|
|
20616
20616
|
const byName = new Map(components.map((c2) => [c2.name, c2]));
|
|
20617
20617
|
const visited = /* @__PURE__ */ new Set();
|
|
20618
20618
|
const queue = [];
|
|
20619
|
-
const enqueue = (
|
|
20620
|
-
if (visited.has(
|
|
20621
|
-
visited.add(
|
|
20622
|
-
queue.push(
|
|
20623
|
-
const unit = cycleUnits.get(
|
|
20619
|
+
const enqueue = (name) => {
|
|
20620
|
+
if (visited.has(name)) return;
|
|
20621
|
+
visited.add(name);
|
|
20622
|
+
queue.push(name);
|
|
20623
|
+
const unit = cycleUnits.get(name);
|
|
20624
20624
|
if (unit) {
|
|
20625
20625
|
for (const member of unit) {
|
|
20626
20626
|
if (!visited.has(member)) {
|
|
@@ -20745,7 +20745,7 @@ function buildScopeGraph(components) {
|
|
|
20745
20745
|
cycles = [];
|
|
20746
20746
|
}
|
|
20747
20747
|
const cycleParticipants = /* @__PURE__ */ new Set();
|
|
20748
|
-
for (const cycle of cycles) for (const
|
|
20748
|
+
for (const cycle of cycles) for (const name of cycle.path) cycleParticipants.add(name);
|
|
20749
20749
|
return {
|
|
20750
20750
|
nodes,
|
|
20751
20751
|
cycles,
|
|
@@ -20933,10 +20933,10 @@ function computeSidebarBudget({ rows, panelOpen, entryCount }) {
|
|
|
20933
20933
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/sidebar-navigation.ts
|
|
20934
20934
|
function collectExpandedGroupRoots(closures, cycleParticipants) {
|
|
20935
20935
|
const roots = /* @__PURE__ */ new Set();
|
|
20936
|
-
for (const [
|
|
20937
|
-
if (closure.nodes.length > 1) roots.add(
|
|
20936
|
+
for (const [name, closure] of closures.entries()) {
|
|
20937
|
+
if (closure.nodes.length > 1) roots.add(name);
|
|
20938
20938
|
}
|
|
20939
|
-
for (const
|
|
20939
|
+
for (const name of cycleParticipants) roots.add(name);
|
|
20940
20940
|
return roots;
|
|
20941
20941
|
}
|
|
20942
20942
|
function computeSidebarViewToggle({
|
|
@@ -21007,9 +21007,9 @@ function buildFlatDimPredicate(input) {
|
|
|
21007
21007
|
const isFlat = input.viewMode === "flat";
|
|
21008
21008
|
const keys = isFlat ? input.filterVisibleKeys : void 0;
|
|
21009
21009
|
if (!hasSearch && keys === void 0) return void 0;
|
|
21010
|
-
return (
|
|
21011
|
-
if (hasSearch && !fuzzyMatches(input.searchQuery,
|
|
21012
|
-
if (keys !== void 0 && !keys.has(
|
|
21010
|
+
return (name) => {
|
|
21011
|
+
if (hasSearch && !fuzzyMatches(input.searchQuery, name)) return true;
|
|
21012
|
+
if (keys !== void 0 && !keys.has(name)) return true;
|
|
21013
21013
|
return false;
|
|
21014
21014
|
};
|
|
21015
21015
|
}
|
|
@@ -21017,7 +21017,7 @@ function buildFlatDimPredicate(input) {
|
|
|
21017
21017
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/state.ts
|
|
21018
21018
|
function apply(state2, entries) {
|
|
21019
21019
|
const next = new Map(state2);
|
|
21020
|
-
for (const [
|
|
21020
|
+
for (const [name, decision] of entries) next.set(name, decision);
|
|
21021
21021
|
return next;
|
|
21022
21022
|
}
|
|
21023
21023
|
function reduceDecisions(state2, action, components, graph) {
|
|
@@ -21026,44 +21026,44 @@ function reduceDecisions(state2, action, components, graph) {
|
|
|
21026
21026
|
if (state2.get(action.name) === "accepted") return state2;
|
|
21027
21027
|
return apply(
|
|
21028
21028
|
state2,
|
|
21029
|
-
acceptCascade(graph, action.name).map((
|
|
21029
|
+
acceptCascade(graph, action.name).map((name) => [name, "accepted"])
|
|
21030
21030
|
);
|
|
21031
21031
|
}
|
|
21032
21032
|
case "reject": {
|
|
21033
21033
|
if (state2.get(action.name) === "rejected") return state2;
|
|
21034
21034
|
const { toReject, toDeselect } = rejectCascade(graph, action.name);
|
|
21035
21035
|
return apply(state2, [
|
|
21036
|
-
...toReject.map((
|
|
21037
|
-
...toDeselect.map((
|
|
21036
|
+
...toReject.map((name) => [name, "rejected"]),
|
|
21037
|
+
...toDeselect.map((name) => [name, "undecided"])
|
|
21038
21038
|
]);
|
|
21039
21039
|
}
|
|
21040
21040
|
case "toggle-all": {
|
|
21041
21041
|
const nonCycle = components.filter((c2) => !graph.cycleParticipants.has(c2.name)).map((c2) => c2.name);
|
|
21042
|
-
const anyNotAccepted = nonCycle.some((
|
|
21042
|
+
const anyNotAccepted = nonCycle.some((name) => state2.get(name) !== "accepted");
|
|
21043
21043
|
if (anyNotAccepted) {
|
|
21044
21044
|
return apply(state2, [
|
|
21045
|
-
...nonCycle.map((
|
|
21046
|
-
...reachableCycleMembers(graph, nonCycle).map((
|
|
21045
|
+
...nonCycle.map((name) => [name, "accepted"]),
|
|
21046
|
+
...reachableCycleMembers(graph, nonCycle).map((name) => [name, "accepted"])
|
|
21047
21047
|
]);
|
|
21048
21048
|
}
|
|
21049
21049
|
return apply(state2, [
|
|
21050
|
-
...nonCycle.map((
|
|
21050
|
+
...nonCycle.map((name) => [name, "rejected"]),
|
|
21051
21051
|
...components.filter((c2) => graph.cycleParticipants.has(c2.name) && state2.get(c2.name) === "accepted").map((c2) => [c2.name, "undecided"])
|
|
21052
21052
|
]);
|
|
21053
21053
|
}
|
|
21054
21054
|
case "accept-unflagged": {
|
|
21055
21055
|
const seeds = components.filter((c2) => !graph.cycleParticipants.has(c2.name) && !isAiFlagged(c2)).map((c2) => c2.name);
|
|
21056
21056
|
return apply(state2, [
|
|
21057
|
-
...seeds.map((
|
|
21058
|
-
...reachableCycleMembers(graph, seeds).map((
|
|
21057
|
+
...seeds.map((name) => [name, "accepted"]),
|
|
21058
|
+
...reachableCycleMembers(graph, seeds).map((name) => [name, "accepted"])
|
|
21059
21059
|
]);
|
|
21060
21060
|
}
|
|
21061
21061
|
}
|
|
21062
21062
|
}
|
|
21063
|
-
function rejectNeedsConfirmation(graph,
|
|
21064
|
-
if (state2.get(
|
|
21065
|
-
const { toReject, toDeselect } = rejectCascade(graph,
|
|
21066
|
-
const ancestors = toReject.filter((n) => n !==
|
|
21063
|
+
function rejectNeedsConfirmation(graph, name, state2) {
|
|
21064
|
+
if (state2.get(name) === "rejected") return false;
|
|
21065
|
+
const { toReject, toDeselect } = rejectCascade(graph, name);
|
|
21066
|
+
const ancestors = toReject.filter((n) => n !== name);
|
|
21067
21067
|
return ancestors.length + toDeselect.length >= 2;
|
|
21068
21068
|
}
|
|
21069
21069
|
function partitionDecisions(components, state2) {
|
|
@@ -21153,8 +21153,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21153
21153
|
for (const node of closure.nodes) keys.add(node.name);
|
|
21154
21154
|
}
|
|
21155
21155
|
for (const unit of cycleUnits.values()) {
|
|
21156
|
-
if (![...unit].some((
|
|
21157
|
-
for (const
|
|
21156
|
+
if (![...unit].some((name) => decisions.get(name) === "accepted")) continue;
|
|
21157
|
+
for (const name of unit) keys.add(name);
|
|
21158
21158
|
}
|
|
21159
21159
|
return keys;
|
|
21160
21160
|
}, [closures, cycleUnits, showDependencies, decisions]);
|
|
@@ -21252,12 +21252,12 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21252
21252
|
return void 0;
|
|
21253
21253
|
}
|
|
21254
21254
|
};
|
|
21255
|
-
const jumpCursorTo = (
|
|
21255
|
+
const jumpCursorTo = (name) => {
|
|
21256
21256
|
let idx = -1;
|
|
21257
21257
|
for (let i = 0; i < visibleRows.length; i++) {
|
|
21258
21258
|
const row = visibleRows[i];
|
|
21259
21259
|
if (row.itemIdx < 0) continue;
|
|
21260
|
-
if (groupedItems[row.itemIdx]?.key ===
|
|
21260
|
+
if (groupedItems[row.itemIdx]?.key === name) {
|
|
21261
21261
|
idx = i;
|
|
21262
21262
|
break;
|
|
21263
21263
|
}
|
|
@@ -21271,18 +21271,18 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21271
21271
|
});
|
|
21272
21272
|
};
|
|
21273
21273
|
const decide = (action) => setDecisions((prev) => reduceDecisions(prev, action, components, graph));
|
|
21274
|
-
const requestReject = (
|
|
21275
|
-
if (decisions.get(
|
|
21276
|
-
if (rejectNeedsConfirmation(graph,
|
|
21277
|
-
const { toReject, toDeselect } = rejectCascade(graph,
|
|
21274
|
+
const requestReject = (name) => {
|
|
21275
|
+
if (decisions.get(name) === "rejected") return;
|
|
21276
|
+
if (rejectNeedsConfirmation(graph, name, decisions)) {
|
|
21277
|
+
const { toReject, toDeselect } = rejectCascade(graph, name);
|
|
21278
21278
|
setPendingRejectCascade({
|
|
21279
|
-
target:
|
|
21280
|
-
ancestors: toReject.filter((n) => n !==
|
|
21279
|
+
target: name,
|
|
21280
|
+
ancestors: toReject.filter((n) => n !== name).sort(),
|
|
21281
21281
|
descendants: [...toDeselect].sort()
|
|
21282
21282
|
});
|
|
21283
21283
|
return;
|
|
21284
21284
|
}
|
|
21285
|
-
decide({ type: "reject", name
|
|
21285
|
+
decide({ type: "reject", name });
|
|
21286
21286
|
};
|
|
21287
21287
|
const mode = showHelp ? "help" : pendingRejectCascade ? "reject-prompt" : searchOpen ? "search" : cyclesPanelOpen ? "cycles" : aiRationalePanel.isOpen ? "flags" : "main";
|
|
21288
21288
|
const context = {
|
|
@@ -21761,25 +21761,25 @@ function formatAcceptanceSummary(counts) {
|
|
|
21761
21761
|
if (counts.autoRejected === 0) return `${accepted}.`;
|
|
21762
21762
|
return `${accepted}, ${counts.autoRejected} excluded due to validation errors.`;
|
|
21763
21763
|
}
|
|
21764
|
-
var capitalize = (
|
|
21764
|
+
var capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1);
|
|
21765
21765
|
function describeGeneration(input) {
|
|
21766
21766
|
const agent = capitalize(input.agent);
|
|
21767
21767
|
return `${formatAcceptanceSummary({ accepted: input.acceptedCount, autoRejected: 0 })}
|
|
21768
21768
|
${agent} is reading each selected component and writing a Contentful component definition for it.${input.hasTokens ? "\nUsing your design tokens for prop resolution." : ""}`;
|
|
21769
21769
|
}
|
|
21770
21770
|
function progressRows2(progress, agent) {
|
|
21771
|
-
const
|
|
21771
|
+
const name = capitalize(agent);
|
|
21772
21772
|
const { components, mapTokens } = progress;
|
|
21773
21773
|
const rows = [
|
|
21774
21774
|
{
|
|
21775
|
-
text: components ? components.current : `Starting up ${
|
|
21775
|
+
text: components ? components.current : `Starting up ${name}...`,
|
|
21776
21776
|
complete: false,
|
|
21777
21777
|
...components ? { progress: { done: components.done, total: components.total } } : {}
|
|
21778
21778
|
}
|
|
21779
21779
|
];
|
|
21780
21780
|
if (mapTokens !== "idle") {
|
|
21781
21781
|
rows.push({
|
|
21782
|
-
text: mapTokens === "running" ? `Mapping token restrictions via ${
|
|
21782
|
+
text: mapTokens === "running" ? `Mapping token restrictions via ${name}...` : "Token restrictions ready",
|
|
21783
21783
|
complete: mapTokens === "complete"
|
|
21784
21784
|
});
|
|
21785
21785
|
}
|
|
@@ -22020,18 +22020,6 @@ function buildFlowStart(input) {
|
|
|
22020
22020
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/screen.tsx
|
|
22021
22021
|
import { Box as Box45 } from "ink";
|
|
22022
22022
|
|
|
22023
|
-
// packages/experience-design-system-types/dist/src/source-input-association.js
|
|
22024
|
-
import * as z3 from "zod/mini";
|
|
22025
|
-
var name = z3.string().check(z3.refine((value) => value.trim().length > 0));
|
|
22026
|
-
var SourceInputAssociationSchema = z3.strictObject({
|
|
22027
|
-
schemaVersion: z3.literal(1),
|
|
22028
|
-
componentId: name,
|
|
22029
|
-
componentDeclarationId: name,
|
|
22030
|
-
rootSymbolId: name,
|
|
22031
|
-
inputName: name,
|
|
22032
|
-
inputPath: z3.array(name).check(z3.minLength(1))
|
|
22033
|
-
}).check(z3.refine((value) => value.inputPath[0] === value.inputName));
|
|
22034
|
-
|
|
22035
22023
|
// packages/experience-design-system-types/dist/src/cdf/validate.js
|
|
22036
22024
|
import { Ajv as Ajv2 } from "ajv";
|
|
22037
22025
|
|
|
@@ -22200,32 +22188,32 @@ function validateCDF2(input) {
|
|
|
22200
22188
|
}
|
|
22201
22189
|
|
|
22202
22190
|
// packages/experience-design-system-types/dist/src/cdf/types.js
|
|
22203
|
-
import * as
|
|
22204
|
-
var CDFPropertySchema2 =
|
|
22205
|
-
$type:
|
|
22206
|
-
$category:
|
|
22207
|
-
$description:
|
|
22208
|
-
$required:
|
|
22209
|
-
$default:
|
|
22210
|
-
$values:
|
|
22211
|
-
"$token.kind":
|
|
22212
|
-
"$token.allowed":
|
|
22191
|
+
import * as z3 from "zod/mini";
|
|
22192
|
+
var CDFPropertySchema2 = z3.strictObject({
|
|
22193
|
+
$type: z3.enum(CDF_PROPERTY_TYPES2),
|
|
22194
|
+
$category: z3.enum(CDF_PROPERTY_CATEGORIES2),
|
|
22195
|
+
$description: z3.optional(z3.string()),
|
|
22196
|
+
$required: z3.optional(z3.boolean()),
|
|
22197
|
+
$default: z3.optional(z3.any()),
|
|
22198
|
+
$values: z3.optional(z3.array(z3.string())),
|
|
22199
|
+
"$token.kind": z3.optional(z3.string()),
|
|
22200
|
+
"$token.allowed": z3.optional(z3.array(z3.string()))
|
|
22213
22201
|
});
|
|
22214
|
-
var CDFSlotSchema2 =
|
|
22215
|
-
$description:
|
|
22216
|
-
$allowedComponents:
|
|
22217
|
-
$required:
|
|
22202
|
+
var CDFSlotSchema2 = z3.strictObject({
|
|
22203
|
+
$description: z3.optional(z3.string()),
|
|
22204
|
+
$allowedComponents: z3.optional(z3.array(z3.string())),
|
|
22205
|
+
$required: z3.optional(z3.boolean())
|
|
22218
22206
|
});
|
|
22219
|
-
var CDFComponentSchema2 =
|
|
22220
|
-
$type:
|
|
22221
|
-
$description:
|
|
22222
|
-
$properties:
|
|
22223
|
-
$slots:
|
|
22207
|
+
var CDFComponentSchema2 = z3.strictObject({
|
|
22208
|
+
$type: z3.literal("component"),
|
|
22209
|
+
$description: z3.optional(z3.string()),
|
|
22210
|
+
$properties: z3.record(z3.string(), CDFPropertySchema2),
|
|
22211
|
+
$slots: z3.optional(z3.record(z3.string(), CDFSlotSchema2))
|
|
22224
22212
|
});
|
|
22225
|
-
var CDFTokenSchema2 =
|
|
22226
|
-
$type:
|
|
22227
|
-
$value:
|
|
22228
|
-
$description:
|
|
22213
|
+
var CDFTokenSchema2 = z3.strictObject({
|
|
22214
|
+
$type: z3.enum(DESIGN_TOKEN_TYPES2),
|
|
22215
|
+
$value: z3.unknown(),
|
|
22216
|
+
$description: z3.optional(z3.string())
|
|
22229
22217
|
});
|
|
22230
22218
|
|
|
22231
22219
|
// packages/experience-design-system-types/dist/src/cdf/build.js
|
|
@@ -22233,9 +22221,9 @@ function stripUnsupportedSlotFields(entry) {
|
|
|
22233
22221
|
if (!entry.$slots)
|
|
22234
22222
|
return entry;
|
|
22235
22223
|
const cleaned = {};
|
|
22236
|
-
for (const [
|
|
22224
|
+
for (const [name, slot] of Object.entries(entry.$slots)) {
|
|
22237
22225
|
const { $required: _required, ...rest } = slot;
|
|
22238
|
-
cleaned[
|
|
22226
|
+
cleaned[name] = rest;
|
|
22239
22227
|
}
|
|
22240
22228
|
return { ...entry, $slots: cleaned };
|
|
22241
22229
|
}
|
|
@@ -22278,7 +22266,7 @@ function validateSlotReferences2(components) {
|
|
|
22278
22266
|
const slots = entry.$slots ?? {};
|
|
22279
22267
|
for (const [slotKey, slot] of Object.entries(slots)) {
|
|
22280
22268
|
const allowed = slot?.$allowedComponents ?? [];
|
|
22281
|
-
const unresolved = allowed.filter((
|
|
22269
|
+
const unresolved = allowed.filter((name) => !componentKeys.has(name));
|
|
22282
22270
|
if (unresolved.length === 0)
|
|
22283
22271
|
continue;
|
|
22284
22272
|
errors.push({
|
|
@@ -22304,23 +22292,111 @@ function setAtPath(root, dottedPath, value) {
|
|
|
22304
22292
|
}
|
|
22305
22293
|
|
|
22306
22294
|
// packages/experience-design-system-types/dist/src/dtcg/types.js
|
|
22307
|
-
import * as
|
|
22308
|
-
var DTCGTokenSchema2 =
|
|
22309
|
-
path:
|
|
22310
|
-
$type:
|
|
22311
|
-
$value:
|
|
22312
|
-
$description:
|
|
22295
|
+
import * as z4 from "zod/mini";
|
|
22296
|
+
var DTCGTokenSchema2 = z4.strictObject({
|
|
22297
|
+
path: z4.string(),
|
|
22298
|
+
$type: z4.enum(DESIGN_TOKEN_TYPES2),
|
|
22299
|
+
$value: z4.unknown(),
|
|
22300
|
+
$description: z4.optional(z4.string())
|
|
22313
22301
|
});
|
|
22314
22302
|
|
|
22315
22303
|
// packages/experience-design-system-types/dist/src/dtcg/validate.js
|
|
22316
22304
|
var TOKEN_TYPE_SET4 = new Set(DESIGN_TOKEN_TYPES2);
|
|
22317
22305
|
|
|
22306
|
+
// packages/experience-design-system-types/dist/src/property-contract/json-value.js
|
|
22307
|
+
var nodeTypes = globalThis.process?.getBuiltinModule?.("node:util")?.types;
|
|
22308
|
+
|
|
22309
|
+
// packages/experience-design-system-types/dist/src/property-contract/date-time-value.js
|
|
22310
|
+
import * as z5 from "zod/mini";
|
|
22311
|
+
var dateTimeValueSchema = z5.iso.datetime({ offset: true });
|
|
22312
|
+
|
|
22313
|
+
// packages/experience-design-system-types/dist/src/property-contract/target-definition.js
|
|
22314
|
+
var TARGET_PROPERTY_TYPES = [
|
|
22315
|
+
"String",
|
|
22316
|
+
"Number",
|
|
22317
|
+
"Boolean",
|
|
22318
|
+
"Array",
|
|
22319
|
+
"Record",
|
|
22320
|
+
"Integer",
|
|
22321
|
+
"DateTime",
|
|
22322
|
+
"RichText",
|
|
22323
|
+
"JSON",
|
|
22324
|
+
"ResourceLink",
|
|
22325
|
+
"Literal",
|
|
22326
|
+
"DiscriminatedUnion"
|
|
22327
|
+
];
|
|
22328
|
+
var SAME_SPACE_RESOURCE_SOURCE = "crn:contentful:::content:spaces/$self/environments/$self";
|
|
22329
|
+
var targetDefinitionJsonSchema = {
|
|
22330
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
22331
|
+
$ref: "#/definitions/target",
|
|
22332
|
+
definitions: {
|
|
22333
|
+
target: {
|
|
22334
|
+
type: "object",
|
|
22335
|
+
required: ["type"],
|
|
22336
|
+
properties: {
|
|
22337
|
+
type: { enum: [...TARGET_PROPERTY_TYPES] },
|
|
22338
|
+
id: { type: "string" },
|
|
22339
|
+
name: { type: "string" },
|
|
22340
|
+
description: { type: "string" },
|
|
22341
|
+
required: { type: "boolean" },
|
|
22342
|
+
values: { type: "array", minItems: 1 },
|
|
22343
|
+
defaultValue: {},
|
|
22344
|
+
items: { $ref: "#/definitions/target" },
|
|
22345
|
+
fields: { type: "object", minProperties: 1, additionalProperties: { $ref: "#/definitions/target" } },
|
|
22346
|
+
allowedResources: {
|
|
22347
|
+
type: "array",
|
|
22348
|
+
minItems: 1,
|
|
22349
|
+
items: {
|
|
22350
|
+
type: "object",
|
|
22351
|
+
required: ["type", "source"],
|
|
22352
|
+
properties: {
|
|
22353
|
+
type: { enum: ["Contentful:Entry", "Contentful:Asset"] },
|
|
22354
|
+
source: { const: SAME_SPACE_RESOURCE_SOURCE },
|
|
22355
|
+
allowedTypes: { type: "array", items: { type: "string" } }
|
|
22356
|
+
},
|
|
22357
|
+
allOf: [
|
|
22358
|
+
{
|
|
22359
|
+
if: { properties: { type: { const: "Contentful:Entry" } } },
|
|
22360
|
+
then: { required: ["allowedTypes"] },
|
|
22361
|
+
else: { not: { required: ["allowedTypes"] } }
|
|
22362
|
+
}
|
|
22363
|
+
],
|
|
22364
|
+
additionalProperties: false
|
|
22365
|
+
}
|
|
22366
|
+
},
|
|
22367
|
+
value: {},
|
|
22368
|
+
valueType: { $ref: "#/definitions/target" },
|
|
22369
|
+
discriminator: { type: "string", minLength: 1 },
|
|
22370
|
+
members: {
|
|
22371
|
+
type: "array",
|
|
22372
|
+
minItems: 2,
|
|
22373
|
+
uniqueItems: true,
|
|
22374
|
+
items: {
|
|
22375
|
+
allOf: [
|
|
22376
|
+
{ $ref: "#/definitions/target" },
|
|
22377
|
+
{ type: "object", properties: { type: { const: "Record" } }, required: ["type", "fields"] }
|
|
22378
|
+
]
|
|
22379
|
+
}
|
|
22380
|
+
}
|
|
22381
|
+
},
|
|
22382
|
+
allOf: [
|
|
22383
|
+
{
|
|
22384
|
+
if: { properties: { type: { const: "DiscriminatedUnion" } } },
|
|
22385
|
+
then: { required: ["discriminator", "members"] },
|
|
22386
|
+
else: { not: { anyOf: [{ required: ["discriminator"] }, { required: ["members"] }] } }
|
|
22387
|
+
}
|
|
22388
|
+
],
|
|
22389
|
+
additionalProperties: false
|
|
22390
|
+
}
|
|
22391
|
+
}
|
|
22392
|
+
};
|
|
22393
|
+
|
|
22318
22394
|
// packages/experience-design-system-cli/src/tui/import/steps/preview-validation-error/logic.ts
|
|
22319
22395
|
function failedComponentNames(errors) {
|
|
22320
22396
|
return [...new Set(errors.map((error) => error.componentName))];
|
|
22321
22397
|
}
|
|
22322
22398
|
function matchedComponentNames(errors, missingNames) {
|
|
22323
|
-
return failedComponentNames(errors).filter((
|
|
22399
|
+
return failedComponentNames(errors).filter((name) => !missingNames.includes(name));
|
|
22324
22400
|
}
|
|
22325
22401
|
function formatErrorLine(error) {
|
|
22326
22402
|
const context = [`Component: ${error.componentName}`, error.path ? `Path: ${error.path}` : null].filter(Boolean);
|
|
@@ -22435,14 +22511,14 @@ function computeRenderStatuses(closure, directIssues) {
|
|
|
22435
22511
|
for (const node of closure.nodes) {
|
|
22436
22512
|
nodesByName.set(node.name, { name: node.name, path: node.path });
|
|
22437
22513
|
}
|
|
22438
|
-
const
|
|
22514
|
+
const own2 = /* @__PURE__ */ new Map();
|
|
22439
22515
|
for (const node of closure.nodes) {
|
|
22440
22516
|
const s = directIssues.get(node.name);
|
|
22441
|
-
if (s && s !== "ok")
|
|
22517
|
+
if (s && s !== "ok") own2.set(node.name, s);
|
|
22442
22518
|
}
|
|
22443
22519
|
const inheritedSources = /* @__PURE__ */ new Map();
|
|
22444
22520
|
for (const node of closure.nodes) {
|
|
22445
|
-
const ownStatus =
|
|
22521
|
+
const ownStatus = own2.get(node.name);
|
|
22446
22522
|
if (!ownStatus) continue;
|
|
22447
22523
|
for (let i = 0; i < node.path.length - 1; i++) {
|
|
22448
22524
|
const ancestor = node.path[i];
|
|
@@ -22450,11 +22526,11 @@ function computeRenderStatuses(closure, directIssues) {
|
|
|
22450
22526
|
inheritedSources.get(ancestor).set(node.name, ownStatus);
|
|
22451
22527
|
}
|
|
22452
22528
|
}
|
|
22453
|
-
for (const [
|
|
22454
|
-
out.set(
|
|
22529
|
+
for (const [name, status] of own2.entries()) {
|
|
22530
|
+
out.set(name, {
|
|
22455
22531
|
status,
|
|
22456
22532
|
isOwn: true,
|
|
22457
|
-
sourceComponents: [
|
|
22533
|
+
sourceComponents: [name]
|
|
22458
22534
|
});
|
|
22459
22535
|
}
|
|
22460
22536
|
for (const [ancestor, sources] of inheritedSources.entries()) {
|
|
@@ -22719,7 +22795,7 @@ function parseToState(json) {
|
|
|
22719
22795
|
}
|
|
22720
22796
|
const componentDescription = typeof component.$description === "string" ? component.$description : "";
|
|
22721
22797
|
const rawProps = component.$properties ?? {};
|
|
22722
|
-
const props = Object.entries(rawProps).map(([
|
|
22798
|
+
const props = Object.entries(rawProps).map(([name, raw]) => {
|
|
22723
22799
|
const p = raw ?? {};
|
|
22724
22800
|
const type = CDF_PROPERTY_TYPES2.includes(p.$type) ? p.$type : "string";
|
|
22725
22801
|
let defaultValue = null;
|
|
@@ -22731,7 +22807,7 @@ function parseToState(json) {
|
|
|
22731
22807
|
}
|
|
22732
22808
|
}
|
|
22733
22809
|
return {
|
|
22734
|
-
name
|
|
22810
|
+
name,
|
|
22735
22811
|
type,
|
|
22736
22812
|
category: CDF_PROPERTY_CATEGORIES2.includes(p.$category) ? p.$category : "content",
|
|
22737
22813
|
required: p.$required === true,
|
|
@@ -22743,10 +22819,10 @@ function parseToState(json) {
|
|
|
22743
22819
|
};
|
|
22744
22820
|
});
|
|
22745
22821
|
const rawSlots = component.$slots ?? {};
|
|
22746
|
-
const slots = Object.entries(rawSlots).map(([
|
|
22822
|
+
const slots = Object.entries(rawSlots).map(([name, raw]) => {
|
|
22747
22823
|
const s = raw ?? {};
|
|
22748
22824
|
return {
|
|
22749
|
-
name
|
|
22825
|
+
name,
|
|
22750
22826
|
description: typeof s.$description === "string" ? s.$description : "",
|
|
22751
22827
|
required: s.$required === true,
|
|
22752
22828
|
allowedComponents: Array.isArray(s.$allowedComponents) ? s.$allowedComponents.filter((v) => typeof v === "string") : []
|
|
@@ -22854,7 +22930,7 @@ function DefaultValueRow({
|
|
|
22854
22930
|
] });
|
|
22855
22931
|
}
|
|
22856
22932
|
function RowLabel({
|
|
22857
|
-
name
|
|
22933
|
+
name,
|
|
22858
22934
|
selected,
|
|
22859
22935
|
trailing = true
|
|
22860
22936
|
}) {
|
|
@@ -22867,7 +22943,7 @@ function RowLabel({
|
|
|
22867
22943
|
wrap: "truncate-end",
|
|
22868
22944
|
children: [
|
|
22869
22945
|
" ",
|
|
22870
|
-
|
|
22946
|
+
name,
|
|
22871
22947
|
trailing ? " " : ""
|
|
22872
22948
|
]
|
|
22873
22949
|
}
|
|
@@ -23219,10 +23295,10 @@ function SlotRow({
|
|
|
23219
23295
|
const slice = filtered.slice(start, start + MAX_VISIBLE);
|
|
23220
23296
|
return /* @__PURE__ */ jsxs26(Box26, { flexDirection: "column", children: [
|
|
23221
23297
|
/* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: " candidates (\u2191\u2193 cycle, Enter to add):" }),
|
|
23222
|
-
slice.map((
|
|
23298
|
+
slice.map((name, i) => {
|
|
23223
23299
|
const absIdx = start + i;
|
|
23224
23300
|
const isCursor = absIdx === cursor;
|
|
23225
|
-
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${
|
|
23301
|
+
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${name}` : ` ${name}` }, name);
|
|
23226
23302
|
})
|
|
23227
23303
|
] });
|
|
23228
23304
|
})() })
|
|
@@ -24119,8 +24195,8 @@ function FieldEditor({
|
|
|
24119
24195
|
const hasEmptyProperties = props.length === 0 && slots.length === 0;
|
|
24120
24196
|
const modeLabel = (() => {
|
|
24121
24197
|
if (pendingDelete) {
|
|
24122
|
-
const
|
|
24123
|
-
return `Delete ${pendingDelete.kind} "${
|
|
24198
|
+
const name = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
|
|
24199
|
+
return `Delete ${pendingDelete.kind} "${name}"? [y] delete \xB7 any other key cancels`;
|
|
24124
24200
|
}
|
|
24125
24201
|
if (editingValue) {
|
|
24126
24202
|
return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
|
|
@@ -25249,7 +25325,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
25249
25325
|
);
|
|
25250
25326
|
db.exec("BEGIN");
|
|
25251
25327
|
try {
|
|
25252
|
-
for (const
|
|
25328
|
+
for (const name of toReject) statement.run(extractSessionId, name);
|
|
25253
25329
|
db.exec("COMMIT");
|
|
25254
25330
|
} catch (error) {
|
|
25255
25331
|
db.exec("ROLLBACK");
|
|
@@ -26155,13 +26231,13 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26155
26231
|
const unchanged = new Set(preview.components.unchanged);
|
|
26156
26232
|
const changedNames = /* @__PURE__ */ new Set();
|
|
26157
26233
|
for (const item of preview.components.changed) {
|
|
26158
|
-
const
|
|
26159
|
-
if (typeof
|
|
26160
|
-
changedNames.add(
|
|
26234
|
+
const name = item.current?.name;
|
|
26235
|
+
if (typeof name !== "string") continue;
|
|
26236
|
+
changedNames.add(name);
|
|
26161
26237
|
if (item.changeClassification?.classification === "breaking") {
|
|
26162
|
-
out.set(
|
|
26238
|
+
out.set(name, "breaking");
|
|
26163
26239
|
} else {
|
|
26164
|
-
out.set(
|
|
26240
|
+
out.set(name, "changed");
|
|
26165
26241
|
}
|
|
26166
26242
|
}
|
|
26167
26243
|
const removedNames = /* @__PURE__ */ new Set();
|
|
@@ -26171,12 +26247,12 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26171
26247
|
out.set(entity.name, "removed");
|
|
26172
26248
|
}
|
|
26173
26249
|
}
|
|
26174
|
-
for (const
|
|
26175
|
-
if (unchanged.has(
|
|
26176
|
-
if (changedNames.has(
|
|
26177
|
-
if (removedNames.has(
|
|
26178
|
-
if (out.has(
|
|
26179
|
-
out.set(
|
|
26250
|
+
for (const name of localNames) {
|
|
26251
|
+
if (unchanged.has(name)) continue;
|
|
26252
|
+
if (changedNames.has(name)) continue;
|
|
26253
|
+
if (removedNames.has(name)) continue;
|
|
26254
|
+
if (out.has(name)) continue;
|
|
26255
|
+
out.set(name, "new");
|
|
26180
26256
|
}
|
|
26181
26257
|
return out;
|
|
26182
26258
|
}
|
|
@@ -26930,10 +27006,10 @@ function GenerateReviewStepView({
|
|
|
26930
27006
|
const merged = /* @__PURE__ */ new Map();
|
|
26931
27007
|
for (const closure of closures.values()) {
|
|
26932
27008
|
const per = computeRenderStatuses(closure, directIssues);
|
|
26933
|
-
for (const [
|
|
26934
|
-
const existing = merged.get(
|
|
27009
|
+
for (const [name, rs] of per.entries()) {
|
|
27010
|
+
const existing = merged.get(name);
|
|
26935
27011
|
if (!existing || !existing.isOwn && rs.isOwn) {
|
|
26936
|
-
merged.set(
|
|
27012
|
+
merged.set(name, rs);
|
|
26937
27013
|
}
|
|
26938
27014
|
}
|
|
26939
27015
|
}
|
|
@@ -26988,11 +27064,11 @@ function GenerateReviewStepView({
|
|
|
26988
27064
|
reviewEditor.setSaveError(null);
|
|
26989
27065
|
setPendingEditorFocus(null);
|
|
26990
27066
|
};
|
|
26991
|
-
const jumpCursorToName = (
|
|
27067
|
+
const jumpCursorToName = (name) => {
|
|
26992
27068
|
for (let i = 0; i < visibleRowsMemo.length; i++) {
|
|
26993
27069
|
const row = visibleRowsMemo[i];
|
|
26994
27070
|
if (row.itemIdx < 0) continue;
|
|
26995
|
-
if (components[row.itemIdx]?.key ===
|
|
27071
|
+
if (components[row.itemIdx]?.key === name) {
|
|
26996
27072
|
jumpCursorToRow(i);
|
|
26997
27073
|
return;
|
|
26998
27074
|
}
|
|
@@ -27520,8 +27596,8 @@ function GenerateReviewStepView({
|
|
|
27520
27596
|
}
|
|
27521
27597
|
),
|
|
27522
27598
|
!dialogOpen && autoRejected.length > 0 && (() => {
|
|
27523
|
-
const stillRejected = autoRejected.filter((
|
|
27524
|
-
const c2 = components.find((x) => x.key ===
|
|
27599
|
+
const stillRejected = autoRejected.filter((name) => {
|
|
27600
|
+
const c2 = components.find((x) => x.key === name);
|
|
27525
27601
|
return c2?.status === "rejected";
|
|
27526
27602
|
});
|
|
27527
27603
|
if (stillRejected.length === 0) return null;
|
|
@@ -28032,31 +28108,31 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
28032
28108
|
const proposedProperties = proposed["$properties"] ?? {};
|
|
28033
28109
|
const proposedProps = new Set(Object.keys(proposedProperties));
|
|
28034
28110
|
const oldProps = current.fullProperties;
|
|
28035
|
-
for (const
|
|
28036
|
-
if (!currentProps.has(
|
|
28037
|
-
const def = proposedProperties[
|
|
28038
|
-
lines.push({ key: `${
|
|
28111
|
+
for (const name of [...proposedProps].sort()) {
|
|
28112
|
+
if (!currentProps.has(name)) {
|
|
28113
|
+
const def = proposedProperties[name];
|
|
28114
|
+
lines.push({ key: `${name}-add`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(def)}` });
|
|
28039
28115
|
}
|
|
28040
28116
|
}
|
|
28041
|
-
for (const
|
|
28042
|
-
if (!proposedProps.has(
|
|
28043
|
-
if (oldProps?.[
|
|
28044
|
-
lines.push({ key: `${
|
|
28117
|
+
for (const name of [...currentProps].sort()) {
|
|
28118
|
+
if (!proposedProps.has(name)) {
|
|
28119
|
+
if (oldProps?.[name]) {
|
|
28120
|
+
lines.push({ key: `${name}-rm`, color: PALETTE.error, text: `- ${name}: ${formatOldProp(oldProps[name])}` });
|
|
28045
28121
|
} else {
|
|
28046
|
-
const cat = current.contentProperties.includes(
|
|
28047
|
-
lines.push({ key: `${
|
|
28122
|
+
const cat = current.contentProperties.includes(name) ? "content" : "design";
|
|
28123
|
+
lines.push({ key: `${name}-rm`, color: PALETTE.error, text: `- ${name} (${cat})` });
|
|
28048
28124
|
}
|
|
28049
28125
|
}
|
|
28050
28126
|
}
|
|
28051
28127
|
const handledProps = /* @__PURE__ */ new Set();
|
|
28052
|
-
for (const
|
|
28053
|
-
if (!proposedProps.has(
|
|
28054
|
-
const newDef = proposedProperties[
|
|
28055
|
-
const oldDef = oldProps?.[
|
|
28128
|
+
for (const name of [...currentProps].sort()) {
|
|
28129
|
+
if (!proposedProps.has(name)) continue;
|
|
28130
|
+
const newDef = proposedProperties[name];
|
|
28131
|
+
const oldDef = oldProps?.[name];
|
|
28056
28132
|
if (!oldDef) continue;
|
|
28057
|
-
const diffs = diffProperty(
|
|
28133
|
+
const diffs = diffProperty(name, oldDef, newDef);
|
|
28058
28134
|
if (diffs.length > 0) {
|
|
28059
|
-
handledProps.add(
|
|
28135
|
+
handledProps.add(name);
|
|
28060
28136
|
for (const d of diffs) lines.push(d);
|
|
28061
28137
|
}
|
|
28062
28138
|
}
|
|
@@ -28079,40 +28155,40 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
28079
28155
|
const proposedSlots = proposed["$slots"] ?? {};
|
|
28080
28156
|
const proposedSlotNames = new Set(Object.keys(proposedSlots));
|
|
28081
28157
|
const currentSlotAllowed = current.currentSlotAllowed ?? {};
|
|
28082
|
-
for (const
|
|
28083
|
-
if (!currentSlots.has(
|
|
28084
|
-
lines.push({ key: `slot-${
|
|
28158
|
+
for (const name of [...proposedSlotNames].sort()) {
|
|
28159
|
+
if (!currentSlots.has(name)) {
|
|
28160
|
+
lines.push({ key: `slot-${name}-add`, color: PALETTE.success, text: `+ slot: ${name}` });
|
|
28085
28161
|
}
|
|
28086
28162
|
}
|
|
28087
|
-
for (const
|
|
28088
|
-
if (!proposedSlotNames.has(
|
|
28089
|
-
lines.push({ key: `slot-${
|
|
28163
|
+
for (const name of [...currentSlots].sort()) {
|
|
28164
|
+
if (!proposedSlotNames.has(name)) {
|
|
28165
|
+
lines.push({ key: `slot-${name}-rm`, color: PALETTE.error, text: `- slot: ${name}` });
|
|
28090
28166
|
}
|
|
28091
28167
|
}
|
|
28092
|
-
for (const
|
|
28093
|
-
const nextAllowed = normalizeAllowedComponents(proposedSlots[
|
|
28094
|
-
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[
|
|
28095
|
-
const prevExists = currentSlots.has(
|
|
28168
|
+
for (const name of [...proposedSlotNames].sort()) {
|
|
28169
|
+
const nextAllowed = normalizeAllowedComponents(proposedSlots[name]?.["$allowedComponents"]);
|
|
28170
|
+
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[name]);
|
|
28171
|
+
const prevExists = currentSlots.has(name);
|
|
28096
28172
|
if (!prevExists) {
|
|
28097
28173
|
if (nextAllowed.length > 0) {
|
|
28098
28174
|
lines.push({
|
|
28099
|
-
key: `slot-${
|
|
28175
|
+
key: `slot-${name}-allow-new`,
|
|
28100
28176
|
color: PALETTE.success,
|
|
28101
|
-
text: `+ slot ${
|
|
28177
|
+
text: `+ slot ${name} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
28102
28178
|
});
|
|
28103
28179
|
}
|
|
28104
28180
|
continue;
|
|
28105
28181
|
}
|
|
28106
28182
|
if (arraysEqual(prevAllowed, nextAllowed)) continue;
|
|
28107
28183
|
lines.push({
|
|
28108
|
-
key: `slot-${
|
|
28184
|
+
key: `slot-${name}-allow-old`,
|
|
28109
28185
|
color: PALETTE.error,
|
|
28110
|
-
text: `- slot ${
|
|
28186
|
+
text: `- slot ${name} allowedComponents: [${prevAllowed.join(", ")}]`
|
|
28111
28187
|
});
|
|
28112
28188
|
lines.push({
|
|
28113
|
-
key: `slot-${
|
|
28189
|
+
key: `slot-${name}-allow-new`,
|
|
28114
28190
|
color: PALETTE.success,
|
|
28115
|
-
text: `+ slot ${
|
|
28191
|
+
text: `+ slot ${name} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
28116
28192
|
});
|
|
28117
28193
|
}
|
|
28118
28194
|
return lines;
|
|
@@ -28148,7 +28224,7 @@ function normalizeType(type) {
|
|
|
28148
28224
|
return type.toLowerCase();
|
|
28149
28225
|
}
|
|
28150
28226
|
}
|
|
28151
|
-
function diffProperty(
|
|
28227
|
+
function diffProperty(name, old, newDef) {
|
|
28152
28228
|
const diffs = [];
|
|
28153
28229
|
const newType = newDef["$type"] ?? "";
|
|
28154
28230
|
const newCategory = newDef["$category"] ?? "";
|
|
@@ -28159,15 +28235,15 @@ function diffProperty(name2, old, newDef) {
|
|
|
28159
28235
|
const requiredChanged = old.required !== newRequired;
|
|
28160
28236
|
const defaultChanged = JSON.stringify(old.default) !== JSON.stringify(newDefault);
|
|
28161
28237
|
if (!typeChanged && !categoryChanged && !requiredChanged && !defaultChanged) return [];
|
|
28162
|
-
diffs.push({ key: `${
|
|
28163
|
-
diffs.push({ key: `${
|
|
28238
|
+
diffs.push({ key: `${name}-old`, color: PALETTE.error, text: `- ${name}: ${formatOldProp(old)}` });
|
|
28239
|
+
diffs.push({ key: `${name}-new`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(newDef)}` });
|
|
28164
28240
|
return diffs;
|
|
28165
28241
|
}
|
|
28166
28242
|
function formatDefault(value) {
|
|
28167
28243
|
const sys = value?.sys;
|
|
28168
28244
|
if (sys?.linkType === "Contentful:DesignToken" && typeof sys.urn === "string") {
|
|
28169
|
-
const
|
|
28170
|
-
if (
|
|
28245
|
+
const name = sys.urn.split("/designTokens/")[1];
|
|
28246
|
+
if (name) return name;
|
|
28171
28247
|
}
|
|
28172
28248
|
return JSON.stringify(value);
|
|
28173
28249
|
}
|
|
@@ -28220,8 +28296,8 @@ function buildPreviewSummaryLines(preview) {
|
|
|
28220
28296
|
text: ` \uFF0B ${components.new.length} components will be created`
|
|
28221
28297
|
});
|
|
28222
28298
|
for (const [index, item] of components.new.entries()) {
|
|
28223
|
-
const
|
|
28224
|
-
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${
|
|
28299
|
+
const name = item.key ?? item.$name ?? "unknown";
|
|
28300
|
+
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${name}` });
|
|
28225
28301
|
}
|
|
28226
28302
|
}
|
|
28227
28303
|
if (components.changed.length > 0) {
|
|
@@ -28314,27 +28390,27 @@ function getPreviewScrollOffset(input, downArrow, upArrow, diffExpanded, current
|
|
|
28314
28390
|
}
|
|
28315
28391
|
return void 0;
|
|
28316
28392
|
}
|
|
28317
|
-
function appendChangedPreviewLine(lines, keyPrefix,
|
|
28393
|
+
function appendChangedPreviewLine(lines, keyPrefix, name, hasPendingDraftChanges, changeClassification) {
|
|
28318
28394
|
lines.push({
|
|
28319
|
-
key: `${keyPrefix}-h-${
|
|
28395
|
+
key: `${keyPrefix}-h-${name}`,
|
|
28320
28396
|
color: PALETTE.warning,
|
|
28321
|
-
text: ` ~ ${
|
|
28397
|
+
text: ` ~ ${name}${hasPendingDraftChanges ? " \u26A1 has pending draft changes" : ""}`
|
|
28322
28398
|
});
|
|
28323
28399
|
if (changeClassification?.classification !== "breaking") return;
|
|
28324
28400
|
const reasons = changeClassification.breakingChanges.map((bc) => `${"slotId" in bc ? bc.slotId : bc.propertyId}: ${bc.reason}`).join(", ");
|
|
28325
|
-
lines.push({ key: `${keyPrefix}-b-${
|
|
28401
|
+
lines.push({ key: `${keyPrefix}-b-${name}`, color: PALETTE.error, text: ` \u26A0 BREAKING: ${reasons}` });
|
|
28326
28402
|
}
|
|
28327
28403
|
function buildPreviewDiffLines(preview) {
|
|
28328
28404
|
const lines = [];
|
|
28329
28405
|
const { components, tokens } = preview;
|
|
28330
28406
|
for (const item of components.new) {
|
|
28331
28407
|
const raw = item;
|
|
28332
|
-
const
|
|
28333
|
-
lines.push({ key: `comp-new-${
|
|
28408
|
+
const name = raw.key ?? raw.$name ?? "unknown";
|
|
28409
|
+
lines.push({ key: `comp-new-${name}`, color: PALETTE.success, text: ` + ${name}` });
|
|
28334
28410
|
const slots = raw.$slots ?? {};
|
|
28335
28411
|
for (const slotName of Object.keys(slots).sort()) {
|
|
28336
28412
|
lines.push({
|
|
28337
|
-
key: `comp-new-${
|
|
28413
|
+
key: `comp-new-${name}-slot-${slotName}`,
|
|
28338
28414
|
color: PALETTE.success,
|
|
28339
28415
|
text: ` slot: ${slotName}`
|
|
28340
28416
|
});
|
|
@@ -28342,7 +28418,7 @@ function buildPreviewDiffLines(preview) {
|
|
|
28342
28418
|
if (Array.isArray(allowed) && allowed.length > 0) {
|
|
28343
28419
|
const names = allowed.filter((n) => typeof n === "string");
|
|
28344
28420
|
lines.push({
|
|
28345
|
-
key: `comp-new-${
|
|
28421
|
+
key: `comp-new-${name}-slot-${slotName}-allow`,
|
|
28346
28422
|
color: PALETTE.success,
|
|
28347
28423
|
text: ` allowedComponents: [${names.join(", ")}]`
|
|
28348
28424
|
});
|
|
@@ -28380,8 +28456,8 @@ function buildPreviewDiffLines(preview) {
|
|
|
28380
28456
|
}
|
|
28381
28457
|
for (const item of tokens.new) {
|
|
28382
28458
|
const raw = item;
|
|
28383
|
-
const
|
|
28384
|
-
lines.push({ key: `tok-new-${
|
|
28459
|
+
const name = raw.name ?? raw.path ?? "unknown";
|
|
28460
|
+
lines.push({ key: `tok-new-${name}`, color: PALETTE.success, text: ` + ${name}` });
|
|
28385
28461
|
}
|
|
28386
28462
|
for (const item of tokens.removed) {
|
|
28387
28463
|
lines.push({ key: `tok-rm-${item.name}`, color: PALETTE.error, text: ` - ${item.name}` });
|
|
@@ -29581,7 +29657,7 @@ init_config();
|
|
|
29581
29657
|
import { existsSync as existsSync10 } from "node:fs";
|
|
29582
29658
|
function diffSnapshots(before, after) {
|
|
29583
29659
|
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
|
|
29584
|
-
const changed_fields = names.filter((
|
|
29660
|
+
const changed_fields = names.filter((name) => before[name] !== after[name]);
|
|
29585
29661
|
return { changed: changed_fields.length > 0, changed_fields };
|
|
29586
29662
|
}
|
|
29587
29663
|
var DEFAULT_TRAIL_LIMIT = 30;
|
|
@@ -29629,11 +29705,11 @@ var LOGIN_HINTS = {
|
|
|
29629
29705
|
cursor: "sign in from Cursor",
|
|
29630
29706
|
copilot: "run `copilot` and sign in"
|
|
29631
29707
|
};
|
|
29632
|
-
function effectiveBinary(
|
|
29633
|
-
return savedBinary.trim() || AGENT_BINARIES[
|
|
29708
|
+
function effectiveBinary(name, savedBinary) {
|
|
29709
|
+
return savedBinary.trim() || AGENT_BINARIES[name];
|
|
29634
29710
|
}
|
|
29635
|
-
function defaultModelLabel(
|
|
29636
|
-
const model = DEFAULT_MODELS[
|
|
29711
|
+
function defaultModelLabel(name) {
|
|
29712
|
+
const model = DEFAULT_MODELS[name];
|
|
29637
29713
|
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
29638
29714
|
}
|
|
29639
29715
|
var fail3 = (step, detail) => ({ step, ok: false, detail });
|
|
@@ -29662,32 +29738,32 @@ function readVersion(binary) {
|
|
|
29662
29738
|
});
|
|
29663
29739
|
});
|
|
29664
29740
|
}
|
|
29665
|
-
async function inspect(
|
|
29666
|
-
const target = effectiveBinary(
|
|
29741
|
+
async function inspect(name, binary) {
|
|
29742
|
+
const target = effectiveBinary(name, binary);
|
|
29667
29743
|
const found = await resolveOnPath(target);
|
|
29668
29744
|
if (!found) return { checks: [fail3("path", `\`${target}\` was not found or is not executable`)], found: null };
|
|
29669
29745
|
const checks = [pass("path", found)];
|
|
29670
29746
|
checks.push(await readVersion(found));
|
|
29671
|
-
if (
|
|
29672
|
-
const auth = await withBinaryEnv(
|
|
29747
|
+
if (name === "claude") {
|
|
29748
|
+
const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
|
|
29673
29749
|
checks.push(
|
|
29674
29750
|
auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
29675
29751
|
);
|
|
29676
29752
|
}
|
|
29677
29753
|
return { checks, found };
|
|
29678
29754
|
}
|
|
29679
|
-
async function inspectAgent(
|
|
29680
|
-
return (await inspect(
|
|
29755
|
+
async function inspectAgent(name, binary) {
|
|
29756
|
+
return (await inspect(name, binary)).checks;
|
|
29681
29757
|
}
|
|
29682
|
-
async function testAgent(
|
|
29683
|
-
const { checks, found } = await inspect(
|
|
29758
|
+
async function testAgent(name, binary, model) {
|
|
29759
|
+
const { checks, found } = await inspect(name, binary);
|
|
29684
29760
|
if (!found || !checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
29685
29761
|
const started = Date.now();
|
|
29686
29762
|
const result = await withBinaryEnv(
|
|
29687
|
-
|
|
29763
|
+
name,
|
|
29688
29764
|
found,
|
|
29689
29765
|
() => createLocalCliAgentInvoker().invoke({
|
|
29690
|
-
agent:
|
|
29766
|
+
agent: name,
|
|
29691
29767
|
...model.trim() ? { model: model.trim() } : {},
|
|
29692
29768
|
prompt: TEST_PROMPT,
|
|
29693
29769
|
timeoutMs: PROMPT_TIMEOUT_MS
|
|
@@ -29703,7 +29779,7 @@ async function testAgent(name2, binary, model) {
|
|
|
29703
29779
|
}
|
|
29704
29780
|
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
29705
29781
|
}
|
|
29706
|
-
function statusFromChecks(
|
|
29782
|
+
function statusFromChecks(name, checks, savedBinary) {
|
|
29707
29783
|
if (checks.length === 0) return "checking";
|
|
29708
29784
|
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
29709
29785
|
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
@@ -29715,13 +29791,13 @@ function statusFromChecks(name2, checks, savedBinary) {
|
|
|
29715
29791
|
}
|
|
29716
29792
|
const login = checks.find((check) => check.step === "login");
|
|
29717
29793
|
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
29718
|
-
return
|
|
29794
|
+
return name === "claude" ? "ready" : "unknown";
|
|
29719
29795
|
}
|
|
29720
|
-
function setupHint(
|
|
29721
|
-
if (status === "not-configured") return `${INSTALL_HINTS[
|
|
29722
|
-
if (status === "not-found") return `${INSTALL_HINTS[
|
|
29723
|
-
if (status === "not-logged-in") return LOGIN_HINTS[
|
|
29724
|
-
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[
|
|
29796
|
+
function setupHint(name, status) {
|
|
29797
|
+
if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set its command path in settings`;
|
|
29798
|
+
if (status === "not-found") return `${INSTALL_HINTS[name]}, or correct the command path in settings`;
|
|
29799
|
+
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
29800
|
+
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name]}`;
|
|
29725
29801
|
if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
|
|
29726
29802
|
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
29727
29803
|
return "";
|
|
@@ -29743,14 +29819,14 @@ var LIST_STATUS = {
|
|
|
29743
29819
|
"timed-out": { symbol: "\u2717", text: "test timed out", tone: "bad" },
|
|
29744
29820
|
unknown: { symbol: "\u25D0", text: "installed, login unknown", tone: "muted" }
|
|
29745
29821
|
};
|
|
29746
|
-
function modelLine(
|
|
29822
|
+
function modelLine(name, savedModel) {
|
|
29747
29823
|
const model = savedModel.trim();
|
|
29748
|
-
return model ? model : `${defaultModelLabel(
|
|
29824
|
+
return model ? model : `${defaultModelLabel(name)} (built-in default)`;
|
|
29749
29825
|
}
|
|
29750
|
-
function baseRows(
|
|
29826
|
+
function baseRows(name, checks, savedBinary) {
|
|
29751
29827
|
const path5 = checks.find((check) => check.step === "path");
|
|
29752
29828
|
const version2 = checks.find((check) => check.step === "version");
|
|
29753
|
-
const hint = setupHint(
|
|
29829
|
+
const hint = setupHint(name, statusFromChecks(name, checks, savedBinary));
|
|
29754
29830
|
const setup = hint ? { label: "Setup", value: hint, tone: "muted" } : void 0;
|
|
29755
29831
|
if (!path5?.ok) {
|
|
29756
29832
|
const saved = savedBinary.trim() !== "";
|
|
@@ -29773,15 +29849,15 @@ function baseRows(name2, checks, savedBinary) {
|
|
|
29773
29849
|
};
|
|
29774
29850
|
}
|
|
29775
29851
|
var checking = [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
29776
|
-
function panelRows(
|
|
29852
|
+
function panelRows(name, checks, settings) {
|
|
29777
29853
|
if (!checks) return checking;
|
|
29778
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
29779
|
-
const model = { label: "Model", value: modelLine(
|
|
29854
|
+
const { command, version: version2, setup, found } = baseRows(name, checks, settings.binary);
|
|
29855
|
+
const model = { label: "Model", value: modelLine(name, settings.model), tone: "muted" };
|
|
29780
29856
|
return [command, ...found ? [...version2?.tone === "ok" ? [version2] : [], model] : [], ...setup ? [setup] : []];
|
|
29781
29857
|
}
|
|
29782
|
-
function statusRows(
|
|
29858
|
+
function statusRows(name, checks, savedBinary) {
|
|
29783
29859
|
if (!checks) return checking;
|
|
29784
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
29860
|
+
const { command, version: version2, setup, found } = baseRows(name, checks, savedBinary);
|
|
29785
29861
|
if (!found) return [command];
|
|
29786
29862
|
const login = checks.find((check) => check.step === "login");
|
|
29787
29863
|
const prompt = checks.find((check) => check.step === "prompt");
|
|
@@ -29800,8 +29876,8 @@ function statusRows(name2, checks, savedBinary) {
|
|
|
29800
29876
|
const testRow = prompt ? [{ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" }] : [];
|
|
29801
29877
|
return [command, ...version2 ? [version2] : [], loginRow, ...testRow, ...setup ? [setup] : []];
|
|
29802
29878
|
}
|
|
29803
|
-
async function withBinaryEnv(
|
|
29804
|
-
const key = `EDS_AGENT_BINARY_${
|
|
29879
|
+
async function withBinaryEnv(name, binary, run) {
|
|
29880
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
29805
29881
|
const previous = process.env[key];
|
|
29806
29882
|
process.env[key] = binary;
|
|
29807
29883
|
try {
|
|
@@ -29815,9 +29891,9 @@ async function withBinaryEnv(name2, binary, run) {
|
|
|
29815
29891
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-debug.ts
|
|
29816
29892
|
function agentSnapshot(config) {
|
|
29817
29893
|
const snapshot = { default_agent: config.defaultAgent };
|
|
29818
|
-
for (const
|
|
29819
|
-
snapshot[`${
|
|
29820
|
-
snapshot[`${
|
|
29894
|
+
for (const name of AGENT_NAMES) {
|
|
29895
|
+
snapshot[`${name}.model`] = config.agents[name].model;
|
|
29896
|
+
snapshot[`${name}.binary`] = config.agents[name].binary;
|
|
29821
29897
|
}
|
|
29822
29898
|
return snapshot;
|
|
29823
29899
|
}
|
|
@@ -29834,10 +29910,10 @@ function environmentFrom(checks, savedBinary, envValue) {
|
|
|
29834
29910
|
}
|
|
29835
29911
|
async function describeAgents(config) {
|
|
29836
29912
|
const entries = await Promise.all(
|
|
29837
|
-
AGENT_NAMES.map(async (
|
|
29838
|
-
const saved = config.agents[
|
|
29839
|
-
const checks = await inspectAgent(
|
|
29840
|
-
return [
|
|
29913
|
+
AGENT_NAMES.map(async (name) => {
|
|
29914
|
+
const saved = config.agents[name].binary;
|
|
29915
|
+
const checks = await inspectAgent(name, saved);
|
|
29916
|
+
return [name, environmentFrom(checks, saved, process.env[`EDS_AGENT_BINARY_${name.toUpperCase()}`])];
|
|
29841
29917
|
})
|
|
29842
29918
|
);
|
|
29843
29919
|
return Object.fromEntries(entries);
|
|
@@ -29858,7 +29934,7 @@ var AGENT_LABELS = {
|
|
|
29858
29934
|
};
|
|
29859
29935
|
var asString = (value) => typeof value === "string" ? value : "";
|
|
29860
29936
|
function emptyAgents() {
|
|
29861
|
-
return Object.fromEntries(AGENT_NAMES.map((
|
|
29937
|
+
return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "", binary: "" }]));
|
|
29862
29938
|
}
|
|
29863
29939
|
async function readAgentConfig() {
|
|
29864
29940
|
const store = await readV1Store();
|
|
@@ -29868,11 +29944,11 @@ async function readAgentConfig() {
|
|
|
29868
29944
|
const agents = emptyAgents();
|
|
29869
29945
|
const saved = store["agents"];
|
|
29870
29946
|
if (saved && typeof saved === "object") {
|
|
29871
|
-
for (const
|
|
29872
|
-
const entry = saved[
|
|
29947
|
+
for (const name of AGENT_NAMES) {
|
|
29948
|
+
const entry = saved[name];
|
|
29873
29949
|
if (entry && typeof entry === "object") {
|
|
29874
29950
|
const fields2 = entry;
|
|
29875
|
-
agents[
|
|
29951
|
+
agents[name] = { model: asString(fields2["model"]), binary: asString(fields2["binary"]) };
|
|
29876
29952
|
}
|
|
29877
29953
|
}
|
|
29878
29954
|
}
|
|
@@ -29885,10 +29961,10 @@ async function writeAgentConfig(config) {
|
|
|
29885
29961
|
const existing = await readV1Store();
|
|
29886
29962
|
const merged = { ...existing };
|
|
29887
29963
|
const agents = {};
|
|
29888
|
-
for (const
|
|
29889
|
-
const model = config.agents[
|
|
29890
|
-
const binary = config.agents[
|
|
29891
|
-
if (model || binary) agents[
|
|
29964
|
+
for (const name of AGENT_NAMES) {
|
|
29965
|
+
const model = config.agents[name].model.trim();
|
|
29966
|
+
const binary = config.agents[name].binary.trim();
|
|
29967
|
+
if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
|
|
29892
29968
|
}
|
|
29893
29969
|
const defaultModel = config.defaultChosen ? agents[config.defaultAgent]?.model : void 0;
|
|
29894
29970
|
if (config.defaultChosen) merged["agent"] = config.defaultAgent;
|
|
@@ -29913,20 +29989,20 @@ var TONE_COLOR = {
|
|
|
29913
29989
|
muted: PALETTE.muted
|
|
29914
29990
|
};
|
|
29915
29991
|
function AgentStatusBadge({
|
|
29916
|
-
name
|
|
29992
|
+
name,
|
|
29917
29993
|
checks,
|
|
29918
29994
|
binary
|
|
29919
29995
|
}) {
|
|
29920
|
-
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(
|
|
29996
|
+
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(name, checks, binary) : "checking"];
|
|
29921
29997
|
return /* @__PURE__ */ jsx59(Text49, { color: TONE_COLOR[tone], children: `${symbol} ${text}` });
|
|
29922
29998
|
}
|
|
29923
29999
|
|
|
29924
30000
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/apply-binary-overrides.ts
|
|
29925
30001
|
var shellValues = /* @__PURE__ */ new Map();
|
|
29926
30002
|
function applyBinaryOverrides(config) {
|
|
29927
|
-
for (const
|
|
29928
|
-
const key = `EDS_AGENT_BINARY_${
|
|
29929
|
-
const binary = config.agents[
|
|
30003
|
+
for (const name of AGENT_NAMES) {
|
|
30004
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
30005
|
+
const binary = config.agents[name].binary.trim();
|
|
29930
30006
|
if (binary) {
|
|
29931
30007
|
if (!shellValues.has(key)) shellValues.set(key, process.env[key]);
|
|
29932
30008
|
process.env[key] = binary;
|
|
@@ -29941,9 +30017,9 @@ function applyBinaryOverrides(config) {
|
|
|
29941
30017
|
|
|
29942
30018
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
29943
30019
|
import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
29944
|
-
var fields = (
|
|
29945
|
-
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[
|
|
29946
|
-
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(
|
|
30020
|
+
var fields = (name) => [
|
|
30021
|
+
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[name]}\` from the PATH)` },
|
|
30022
|
+
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name)})` }
|
|
29947
30023
|
];
|
|
29948
30024
|
var INSPECT_DELAY_MS = 400;
|
|
29949
30025
|
function StatusHeading() {
|
|
@@ -29953,13 +30029,13 @@ function StatusHeading() {
|
|
|
29953
30029
|
] });
|
|
29954
30030
|
}
|
|
29955
30031
|
function AgentDetail({
|
|
29956
|
-
name
|
|
30032
|
+
name,
|
|
29957
30033
|
config,
|
|
29958
30034
|
setConfig,
|
|
29959
30035
|
onBack,
|
|
29960
30036
|
record: record3
|
|
29961
30037
|
}) {
|
|
29962
|
-
const settings = config.agents[
|
|
30038
|
+
const settings = config.agents[name];
|
|
29963
30039
|
const [saving, setSaving] = useState33(false);
|
|
29964
30040
|
const [testing, setTesting] = useState33(false);
|
|
29965
30041
|
const [notice, setNotice] = useState33(null);
|
|
@@ -29968,38 +30044,38 @@ function AgentDetail({
|
|
|
29968
30044
|
let active = true;
|
|
29969
30045
|
setChecks(void 0);
|
|
29970
30046
|
const timer = setTimeout(() => {
|
|
29971
|
-
void inspectAgent(
|
|
30047
|
+
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
29972
30048
|
}, INSPECT_DELAY_MS);
|
|
29973
30049
|
return () => {
|
|
29974
30050
|
active = false;
|
|
29975
30051
|
clearTimeout(timer);
|
|
29976
30052
|
};
|
|
29977
|
-
}, [
|
|
30053
|
+
}, [name, settings.binary]);
|
|
29978
30054
|
const save = () => {
|
|
29979
30055
|
setSaving(true);
|
|
29980
30056
|
setNotice(null);
|
|
29981
30057
|
writeAgentConfig(config).then(() => {
|
|
29982
30058
|
applyBinaryOverrides(config);
|
|
29983
|
-
record3(`saved ${
|
|
29984
|
-
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[
|
|
30059
|
+
record3(`saved ${name}`);
|
|
30060
|
+
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name]} settings are written to config.json` });
|
|
29985
30061
|
}).catch((err) => {
|
|
29986
|
-
record3(`saving ${
|
|
30062
|
+
record3(`saving ${name} failed`, err);
|
|
29987
30063
|
setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` });
|
|
29988
30064
|
}).finally(() => setSaving(false));
|
|
29989
30065
|
};
|
|
29990
30066
|
const runTest = () => {
|
|
29991
30067
|
setTesting(true);
|
|
29992
30068
|
setNotice(null);
|
|
29993
|
-
testAgent(
|
|
30069
|
+
testAgent(name, settings.binary, settings.model).then((result) => {
|
|
29994
30070
|
setChecks(result);
|
|
29995
30071
|
const outcome = testOutcome(result);
|
|
29996
30072
|
if (!outcome || !outcome.ok)
|
|
29997
|
-
record3(`test of ${
|
|
30073
|
+
record3(`test of ${name} failed: ${outcome?.text ?? "the agent could not be started"}`);
|
|
29998
30074
|
setNotice(
|
|
29999
30075
|
outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
|
|
30000
30076
|
);
|
|
30001
30077
|
}).catch((err) => {
|
|
30002
|
-
record3(`test of ${
|
|
30078
|
+
record3(`test of ${name} could not run`, err);
|
|
30003
30079
|
setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` });
|
|
30004
30080
|
}).finally(() => setTesting(false));
|
|
30005
30081
|
};
|
|
@@ -30010,19 +30086,19 @@ function AgentDetail({
|
|
|
30010
30086
|
hint: "run test",
|
|
30011
30087
|
onRun: runTest
|
|
30012
30088
|
};
|
|
30013
|
-
const formFields = fields(
|
|
30089
|
+
const formFields = fields(name);
|
|
30014
30090
|
const labelWidth = formLabelWidth([...formFields, action]);
|
|
30015
30091
|
return /* @__PURE__ */ jsx60(
|
|
30016
30092
|
FieldForm,
|
|
30017
30093
|
{
|
|
30018
|
-
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[
|
|
30019
|
-
subtitle: config.defaultAgent ===
|
|
30094
|
+
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[name]}`,
|
|
30095
|
+
subtitle: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_BINARIES[name]}\` command.`,
|
|
30020
30096
|
fields: formFields,
|
|
30021
30097
|
values: { binary: settings.binary, model: settings.model },
|
|
30022
30098
|
onChange: (key, value) => {
|
|
30023
|
-
setConfig({ ...config, agents: { ...config.agents, [
|
|
30099
|
+
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [key]: value } } });
|
|
30024
30100
|
setNotice(null);
|
|
30025
|
-
record3(`edited ${
|
|
30101
|
+
record3(`edited ${name}.${key}`);
|
|
30026
30102
|
},
|
|
30027
30103
|
onSave: save,
|
|
30028
30104
|
onQuit: onBack,
|
|
@@ -30031,7 +30107,7 @@ function AgentDetail({
|
|
|
30031
30107
|
busy: saving || testing,
|
|
30032
30108
|
children: /* @__PURE__ */ jsxs48(Box48, { flexDirection: "column", marginTop: 1, children: [
|
|
30033
30109
|
/* @__PURE__ */ jsx60(StatusHeading, {}),
|
|
30034
|
-
statusRows(
|
|
30110
|
+
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))
|
|
30035
30111
|
] })
|
|
30036
30112
|
}
|
|
30037
30113
|
);
|
|
@@ -30056,9 +30132,9 @@ function AgentsScreen({ onDone }) {
|
|
|
30056
30132
|
error: ""
|
|
30057
30133
|
}).current;
|
|
30058
30134
|
const inspectAll = (loaded) => {
|
|
30059
|
-
for (const
|
|
30060
|
-
void inspectAgent(
|
|
30061
|
-
(result) => setChecks((previous) => ({ ...previous, [
|
|
30135
|
+
for (const name of AGENT_NAMES) {
|
|
30136
|
+
void inspectAgent(name, loaded.agents[name].binary).then(
|
|
30137
|
+
(result) => setChecks((previous) => ({ ...previous, [name]: result }))
|
|
30062
30138
|
);
|
|
30063
30139
|
}
|
|
30064
30140
|
};
|
|
@@ -30098,21 +30174,21 @@ function AgentsScreen({ onDone }) {
|
|
|
30098
30174
|
exitMethod: change.changed ? "saved" : "discarded"
|
|
30099
30175
|
});
|
|
30100
30176
|
};
|
|
30101
|
-
const makeDefault = (
|
|
30177
|
+
const makeDefault = (name) => {
|
|
30102
30178
|
if (!config || saving) return;
|
|
30103
|
-
if (
|
|
30104
|
-
setNotice({ kind: "success", text: `${AGENT_LABELS[
|
|
30179
|
+
if (name === config.defaultAgent) {
|
|
30180
|
+
setNotice({ kind: "success", text: `${AGENT_LABELS[name]} is already the default agent` });
|
|
30105
30181
|
return;
|
|
30106
30182
|
}
|
|
30107
30183
|
setSaving(true);
|
|
30108
30184
|
setNotice(null);
|
|
30109
|
-
writeAgentConfig({ ...config, defaultAgent:
|
|
30110
|
-
setConfig((current) => current ? { ...current, defaultAgent:
|
|
30111
|
-
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[
|
|
30112
|
-
visit.trail.record(`made ${
|
|
30185
|
+
writeAgentConfig({ ...config, defaultAgent: name, defaultChosen: true }).then(() => {
|
|
30186
|
+
setConfig((current) => current ? { ...current, defaultAgent: name, defaultChosen: true } : current);
|
|
30187
|
+
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
|
|
30188
|
+
visit.trail.record(`made ${name} the default`);
|
|
30113
30189
|
}).catch((err) => {
|
|
30114
30190
|
visit.error = scrubError(err, []);
|
|
30115
|
-
visit.trail.record(`making ${
|
|
30191
|
+
visit.trail.record(`making ${name} the default failed`);
|
|
30116
30192
|
setNotice({ kind: "error", text: `Default agent not changed: ${visit.error}` });
|
|
30117
30193
|
}).finally(() => setSaving(false));
|
|
30118
30194
|
};
|
|
@@ -30199,14 +30275,14 @@ function AgentsScreen({ onDone }) {
|
|
|
30199
30275
|
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "AGENT" }) }),
|
|
30200
30276
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "STATUS" })
|
|
30201
30277
|
] }),
|
|
30202
|
-
AGENT_NAMES.map((
|
|
30203
|
-
const isFocused = focusedAgent ===
|
|
30278
|
+
AGENT_NAMES.map((name) => {
|
|
30279
|
+
const isFocused = focusedAgent === name;
|
|
30204
30280
|
return /* @__PURE__ */ jsxs49(Box49, { gap: 1, children: [
|
|
30205
30281
|
/* @__PURE__ */ jsx61(Text51, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " }),
|
|
30206
|
-
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children:
|
|
30207
|
-
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[
|
|
30208
|
-
/* @__PURE__ */ jsx61(AgentStatusBadge, { name
|
|
30209
|
-
] },
|
|
30282
|
+
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children: name === config.defaultAgent ? "\u2605" : " " }),
|
|
30283
|
+
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[name] }) }),
|
|
30284
|
+
/* @__PURE__ */ jsx61(AgentStatusBadge, { name, checks: checks[name], binary: config.agents[name].binary })
|
|
30285
|
+
] }, name);
|
|
30210
30286
|
}),
|
|
30211
30287
|
/* @__PURE__ */ jsxs49(Box49, { flexDirection: "column", marginTop: 1, children: [
|
|
30212
30288
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: `\u2500 ${AGENT_LABELS[focusedAgent]} ${"\u2500".repeat(30)}` }),
|