@contentful/experience-design-system-cli 2.39.1-dev-build-4580d8be.0 → 2.39.1-dev-build-eee35c0c.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +607 -683
- package/dist/index.js +614 -724
- package/dist/package.json +1 -1
- package/package.json +3 -3
package/dist/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 name2 in all)
|
|
8
|
+
__defProp(target, name2, { get: all[name2], 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((name2) => SESSION_FOLDER.test(name2));
|
|
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, name2) {
|
|
725
|
+
return `progress=generate:${done}/${total}:${name2}`;
|
|
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 name2 = String(obj["name"] ?? "");
|
|
1412
1412
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1413
|
-
return ` ${ansi.green("+")} ${
|
|
1413
|
+
return ` ${ansi.green("+")} ${name2} ${ansi.dim(reason)}`;
|
|
1414
1414
|
}
|
|
1415
1415
|
case "reject_component": {
|
|
1416
|
-
const
|
|
1416
|
+
const name2 = String(obj["name"] ?? "");
|
|
1417
1417
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1418
|
-
return ` ${ansi.dim("\u2013")} ${
|
|
1418
|
+
return ` ${ansi.dim("\u2013")} ${name2} ${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(name2) {
|
|
3482
|
+
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(name2)}(?![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((name2) => name2.length > 0).map((name2) => ({ name: name2, pattern: identifierPattern(name2) }));
|
|
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: name2 }) => name2);
|
|
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 name2 of mentioned)
|
|
3500
|
+
last.names.add(name2);
|
|
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 name2 of window.names)
|
|
3512
|
+
lastWindowFor.set(name2, 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 name2 of window.names) {
|
|
3527
|
+
if (lastWindowFor.get(name2) === window && !identifierPattern(name2).test(head))
|
|
3528
|
+
cut.add(name2);
|
|
3529
3529
|
}
|
|
3530
3530
|
continue;
|
|
3531
3531
|
}
|
|
3532
|
-
for (const
|
|
3533
|
-
if (lastWindowFor.get(
|
|
3534
|
-
cut.add(
|
|
3532
|
+
for (const name2 of window.names) {
|
|
3533
|
+
if (lastWindowFor.get(name2) === window)
|
|
3534
|
+
cut.add(name2);
|
|
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((name2, index) => cut.has(name2) && names.indexOf(name2) === 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(name2, source) {
|
|
3553
|
+
return createHash("sha256").update(`${name2}:${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, name2, timestamp) {
|
|
3622
|
+
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id, name2, 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((name2) => new RegExp(`\\b(?:type|interface|enum|const|class)\\s+${escapeForRegExp(name2)}\\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((name2) => inHand.some((text) => declaresAnyType(text, [name2])));
|
|
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 name2 of excerpt.usesNotShown)
|
|
4980
|
+
usesNotShown.add(name2);
|
|
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((name2) => usesNotShown.has(name2)),
|
|
4988
4988
|
declaredTypeNames
|
|
4989
4989
|
};
|
|
4990
4990
|
}
|
|
4991
|
-
async function loadComponentSourceRef(
|
|
4991
|
+
async function loadComponentSourceRef(name2, sourcePath, propNames = [], propTypes = []) {
|
|
4992
4992
|
let content = null;
|
|
4993
4993
|
let siblingFiles = [];
|
|
4994
4994
|
let truncatedSiblingCount = 0;
|
|
@@ -5005,18 +5005,18 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
|
|
|
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 name3 of mainExcerpt.usesNotShown)
|
|
5009
|
+
usesNotShown.add(name3);
|
|
5010
|
+
for (const name3 of siblingUsesNotShown)
|
|
5011
|
+
usesNotShown.add(name3);
|
|
5012
5012
|
} catch {
|
|
5013
5013
|
}
|
|
5014
|
-
const ref = { component:
|
|
5014
|
+
const ref = { component: name2, 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((name3) => usesNotShown.has(name3));
|
|
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, description }) => {
|
|
5172
|
+
return components.map(({ component_id, name: name2, 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: name2, 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 name2 = Node.isFunctionDeclaration(declaration) ? declaration.getName() : allowVariableDeclaration && Node.isVariableDeclaration(declaration) ? declaration.getName() : void 0;
|
|
5819
|
+
if (!name2 || !/^[A-Z]/.test(name2) || exported.has(name2))
|
|
5820
5820
|
return void 0;
|
|
5821
|
-
return
|
|
5821
|
+
return name2;
|
|
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 name2 = exportKey === "default" ? resolveDefaultExportName(declarations, exported, options.allowVariableDeclaration) : exportKey;
|
|
5828
|
+
if (!name2 || !/^[A-Z]/.test(name2))
|
|
5829
5829
|
continue;
|
|
5830
|
-
if (
|
|
5830
|
+
if (name2.startsWith("use")) {
|
|
5831
5831
|
exclusions.push({
|
|
5832
5832
|
itemType: "component",
|
|
5833
|
-
name,
|
|
5833
|
+
name: name2,
|
|
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, declarations });
|
|
5840
|
+
renderable.push({ name: name2, 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 name2 = 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: name2,
|
|
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(name2) && { 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(name2) {
|
|
6275
|
+
const normalizedName = name2 && name2.length > 0 ? name2 : "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 name3 = initializer2 && Node2.isStringLiteral(initializer2) ? initializer2.getLiteralValue() : initializer2 && Node2.isJsxExpression(initializer2) ? initializer2.getExpression()?.getText() ?? "" : "";
|
|
6346
6346
|
upsertSlot({
|
|
6347
|
-
...normalizeSlotName(
|
|
6347
|
+
...normalizeSlotName(name3)
|
|
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 name2 = initializer.getLiteralValue();
|
|
6357
|
+
if (!name2)
|
|
6358
6358
|
return;
|
|
6359
6359
|
upsertSlot({
|
|
6360
|
-
name,
|
|
6360
|
+
name: name2,
|
|
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 name2 = kebabToPascal(tag);
|
|
6383
6383
|
const props = extractProps(classDecl);
|
|
6384
|
-
const slots = extractSlots(classDecl, warnings,
|
|
6384
|
+
const slots = extractSlots(classDecl, warnings, name2);
|
|
6385
6385
|
const eventNames = detectEvents(classDecl);
|
|
6386
6386
|
if (eventNames.length > 0) {
|
|
6387
|
-
warnings.push(`Component ${
|
|
6387
|
+
warnings.push(`Component ${name2} has ${eventNames.length} events not captured: ${eventNames.join(", ")}`);
|
|
6388
6388
|
}
|
|
6389
6389
|
components.push({
|
|
6390
|
-
name,
|
|
6390
|
+
name: name2,
|
|
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 name2 = raw.trim();
|
|
6543
|
+
if (name2 && componentNames.has(name2))
|
|
6544
|
+
found.add(name2);
|
|
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 name2 of extractAllowedComponentsFromTypeText(assertedTypeNode.getText(), ctx)) {
|
|
6580
|
+
found.add(name2);
|
|
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 name2 = otherSide.getText().split(".").pop();
|
|
6600
|
+
if (!name2 || !componentNames.has(name2))
|
|
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 name2;
|
|
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 = (name2) => {
|
|
6658
|
+
renderCountByComponent.set(name2, (renderCountByComponent.get(name2) ?? 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((name2) => name2 === "generateMetadata" || name2 === "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 name2 = property.getName();
|
|
7169
|
+
if (name2 === "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(name2))
|
|
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: name2,
|
|
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 name2 = symbol.getName();
|
|
7222
|
+
if (name2 === "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(name2))
|
|
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: name2,
|
|
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((name2) => [name2, name2]));
|
|
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 name2 = property.getName();
|
|
7761
|
+
if (name2 === "children")
|
|
7762
7762
|
continue;
|
|
7763
7763
|
if (!getRenderPropType(property))
|
|
7764
7764
|
continue;
|
|
7765
|
-
const slotName =
|
|
7765
|
+
const slotName = name2.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 literal4 = typeNode.getLiteral();
|
|
7779
|
+
if (Node4.isStringLiteral(literal4)) {
|
|
7780
|
+
return [literal4.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(name2, seen = /* @__PURE__ */ new Set()) {
|
|
8022
|
+
if (seen.has(name2))
|
|
8023
8023
|
return [];
|
|
8024
|
-
seen.add(
|
|
8024
|
+
seen.add(name2);
|
|
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[name2] ?? []) {
|
|
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[name2]) {
|
|
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 name2 of pickedKeys) {
|
|
8129
|
+
if (slotNames.has(name2))
|
|
8130
8130
|
continue;
|
|
8131
|
-
if (excludedProps.has(
|
|
8131
|
+
if (excludedProps.has(name2))
|
|
8132
8132
|
continue;
|
|
8133
|
-
const pickedProp = sourcePropsByName.get(
|
|
8133
|
+
const pickedProp = sourcePropsByName.get(name2);
|
|
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, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
8363
|
+
for (const { name: name2, 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: name2,
|
|
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, name2) ?? 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: name2,
|
|
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, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
8667
|
+
for (const { name: name2, 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, name2, 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 name2 = 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: name2,
|
|
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 name2 = property.getName();
|
|
8865
8865
|
const value = property.getInitializer();
|
|
8866
8866
|
if (!value)
|
|
8867
8867
|
continue;
|
|
8868
|
-
if (
|
|
8868
|
+
if (name2 === "type") {
|
|
8869
8869
|
type = getVuePropTypeText(value);
|
|
8870
8870
|
allowedValues = extractAllowedValues(value.getType());
|
|
8871
|
-
} else if (
|
|
8871
|
+
} else if (name2 === "required") {
|
|
8872
8872
|
required = value.getText() === "true";
|
|
8873
|
-
} else if (
|
|
8873
|
+
} else if (name2 === "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 name2 = 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, name2, 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: name2,
|
|
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, name2, 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: name2,
|
|
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, typeText: resolvedTypeText, required } = resolved;
|
|
9279
|
+
const { name: name2, 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: name2,
|
|
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 name2 = prop.getName();
|
|
9584
|
+
if (!isPublicVuePropName(name2))
|
|
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: name2,
|
|
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: name2,
|
|
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(name2) {
|
|
9634
|
+
return !/^[_$]/.test(name2);
|
|
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, isDefault:
|
|
9666
|
+
const name2 = match2[1];
|
|
9667
|
+
if (!seen.has(name2)) {
|
|
9668
|
+
seen.add(name2);
|
|
9669
|
+
slots.push({ name: name2, isDefault: name2 === "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 name2 = 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: name2,
|
|
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, declaration: decl, typeText, required } = resolved;
|
|
9797
|
+
const { name: name2, declaration: decl, typeText, required } = resolved;
|
|
9798
9798
|
const allowedValues = extractAllowedValues3(typeText);
|
|
9799
9799
|
props.push({
|
|
9800
|
-
name,
|
|
9800
|
+
name: name2,
|
|
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 name2 = 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: name2,
|
|
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 name2 = nameMatch?.[1] ?? "default";
|
|
10098
|
+
slots.set(name2, name2 === "default");
|
|
10099
10099
|
}
|
|
10100
|
-
return [...slots.entries()].map(([
|
|
10100
|
+
return [...slots.entries()].map(([name2, isDefault]) => ({ name: name2, 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 name2 = "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
|
+
name2 = match2[1];
|
|
10137
10137
|
description = match2[2].trim();
|
|
10138
10138
|
}
|
|
10139
10139
|
}
|
|
10140
10140
|
slots.push({
|
|
10141
|
-
name,
|
|
10142
|
-
isDefault:
|
|
10141
|
+
name: name2,
|
|
10142
|
+
isDefault: name2 === "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(name2, applyRuntimeFieldDenylist) {
|
|
10188
|
+
return applyRuntimeFieldDenylist && INTERNAL_RUNTIME_FIELD_NAMES.has(name2);
|
|
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 name2 = property.getName();
|
|
10216
|
+
if (name2.startsWith("#") || isInternalRuntimeField(name2, 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 = name2.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) : name2,
|
|
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 name2 = getter.getName();
|
|
10262
|
+
if (name2 === "observedAttributes" || name2 === "template" || name2.startsWith("#") || isInternalRuntimeField(name2, 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(name2) ?? {};
|
|
10268
10268
|
entry.getter = getter;
|
|
10269
|
-
accessors.set(
|
|
10269
|
+
accessors.set(name2, 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 name2 = setter.getName();
|
|
10279
|
+
if (name2 === "observedAttributes" || name2 === "template" || name2.startsWith("#") || isInternalRuntimeField(name2, 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(name2) ?? {};
|
|
10285
10285
|
entry.setter = setter;
|
|
10286
|
-
accessors.set(
|
|
10286
|
+
accessors.set(name2, entry);
|
|
10287
10287
|
}
|
|
10288
|
-
for (const [
|
|
10288
|
+
for (const [name2, { 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: name2,
|
|
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, name2, description] = match2;
|
|
10318
|
+
if (!name2 || name2.startsWith("#"))
|
|
10319
10319
|
continue;
|
|
10320
10320
|
props.push({
|
|
10321
|
-
name,
|
|
10321
|
+
name: name2,
|
|
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 name2 = 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: name2,
|
|
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 name2 of [...importedNames]) {
|
|
10994
|
+
const localDecl = findLocalTypeDeclaration(ctx.instance, name2, ctx.moduleScript) ?? (ctx.moduleScript ? findLocalTypeDeclaration(ctx.moduleScript, name2, 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 name2 = 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: [`${name2}: 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(`${name2}: 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: name2,
|
|
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(`${name2}: 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(`${name2}: 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: name2,
|
|
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: name2
|
|
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 name2 = annotation["typeName"]?.["name"] ?? null;
|
|
11404
|
+
return name2 ? `'${name2}'` : "<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 name2 = 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: name2,
|
|
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, name2, 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, name, 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"] === name2)
|
|
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(literal4, snippetLocals) {
|
|
11613
|
+
const members = literal4["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 name2 = key?.["name"] ?? null;
|
|
11623
|
+
if (!name2)
|
|
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: name2,
|
|
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 name2 = key?.["name"] ?? null;
|
|
11773
|
+
if (!name2)
|
|
11774
11774
|
continue;
|
|
11775
|
-
seenInDestructure.add(
|
|
11775
|
+
seenInDestructure.add(name2);
|
|
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(name2);
|
|
11780
11780
|
if (typeMember?.isSnippet) {
|
|
11781
|
-
snippetNames.add(
|
|
11781
|
+
snippetNames.add(name2);
|
|
11782
11782
|
const slot = {
|
|
11783
|
-
name,
|
|
11784
|
-
isDefault:
|
|
11783
|
+
name: name2,
|
|
11784
|
+
isDefault: name2 === "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: name2,
|
|
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 name2 = p["key"]?.["name"] ?? null;
|
|
11854
|
+
if (name2)
|
|
11855
|
+
m.set(name2, 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, isDefault:
|
|
12034
|
+
const name2 = readSlotName(node);
|
|
12035
|
+
if (!seen.has(name2)) {
|
|
12036
|
+
seen.add(name2);
|
|
12037
|
+
slots.push({ name: name2, isDefault: name2 === "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 name2 = alias ?? fieldName;
|
|
12237
12237
|
const prop = {
|
|
12238
|
-
name,
|
|
12238
|
+
name: name2,
|
|
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 name2 = alias ?? fieldName;
|
|
12309
12309
|
const prop = {
|
|
12310
|
-
name,
|
|
12310
|
+
name: name2,
|
|
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 name2 = parsed.alias ?? parsed.fieldName;
|
|
12394
|
+
if (byName.has(name2))
|
|
12395
12395
|
continue;
|
|
12396
|
-
byName.set(
|
|
12396
|
+
byName.set(name2, { name: name2, 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(name2) {
|
|
12510
12510
|
for (const prefix of KNOWN_PREFIXES) {
|
|
12511
|
-
if (
|
|
12512
|
-
const rest =
|
|
12511
|
+
if (name2.startsWith(prefix) && name2.length > prefix.length) {
|
|
12512
|
+
const rest = name2.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 name2;
|
|
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 name2 = callee.getText();
|
|
12587
|
+
if (name2 === "contentChild" || name2 === "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(name2, allowed) {
|
|
12617
12617
|
const slot = {
|
|
12618
|
-
name,
|
|
12618
|
+
name: name2,
|
|
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 name2 = deriveSlotName(el.rawSelect, meta.normalizedName);
|
|
12653
|
+
if (byName.has(name2))
|
|
12654
12654
|
continue;
|
|
12655
|
-
byName.set(
|
|
12656
|
-
name,
|
|
12655
|
+
byName.set(name2, {
|
|
12656
|
+
name: name2,
|
|
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 name2 = fallbackIndex === 0 ? "children" : `slot_${fallbackIndex}`;
|
|
12739
12739
|
fallbackIndex++;
|
|
12740
|
-
return { ...slot, name };
|
|
12740
|
+
return { ...slot, name: name2 };
|
|
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(name2) {
|
|
13456
|
+
return name2.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(name2, resolvedSourcePath) {
|
|
13849
|
+
const sourceHash = createHash7("sha256").update(`${name2}:${resolvedSourcePath}`).digest("hex").slice(0, 12);
|
|
13850
|
+
return `${name2}-${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(name2) {
|
|
14148
|
+
if (name2.endsWith(".d.ts"))
|
|
14149
14149
|
return "other";
|
|
14150
|
-
const ext = path.extname(
|
|
14150
|
+
const ext = path.extname(name2);
|
|
14151
14151
|
return CATEGORY_BY_EXTENSION[ext] ?? "other";
|
|
14152
14152
|
}
|
|
14153
14153
|
|
|
@@ -14155,20 +14155,20 @@ function categorizeFile(name) {
|
|
|
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(name2) {
|
|
14159
|
+
return DENYLISTED_EXACT_FILE_NAMES.has(name2) || DENYLISTED_FILE_NAME_PATTERNS.some((pattern) => pattern.test(name2));
|
|
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(name2) {
|
|
14164
|
+
if (name2.endsWith(".d.ts"))
|
|
14165
14165
|
return false;
|
|
14166
|
-
if (EXCLUDED_SUFFIXES.some((suffix) =>
|
|
14166
|
+
if (EXCLUDED_SUFFIXES.some((suffix) => name2.endsWith(suffix)))
|
|
14167
14167
|
return false;
|
|
14168
|
-
const ext = path2.extname(
|
|
14168
|
+
const ext = path2.extname(name2);
|
|
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(name2))
|
|
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 name2 = 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 (name2)
|
|
14388
|
+
entry.componentName = name2;
|
|
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 name2 of SAVE_FILES) {
|
|
14420
14420
|
try {
|
|
14421
|
-
await access4(join14(path5,
|
|
14422
|
-
conflicts.push(
|
|
14421
|
+
await access4(join14(path5, name2));
|
|
14422
|
+
conflicts.push(name2);
|
|
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, style, value }) => {
|
|
14639
|
+
var serializeArrayParam = ({ allowReserved, explode, name: name2, 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 `;${name2}=${joinedValues2}`;
|
|
14647
14647
|
case "simple":
|
|
14648
14648
|
return joinedValues2;
|
|
14649
14649
|
default:
|
|
14650
|
-
return `${
|
|
14650
|
+
return `${name2}=${joinedValues2}`;
|
|
14651
14651
|
}
|
|
14652
14652
|
}
|
|
14653
14653
|
const separator = separatorArrayExplode(style);
|
|
@@ -14657,24 +14657,24 @@ var serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
|
14657
14657
|
}
|
|
14658
14658
|
return serializePrimitiveParam({
|
|
14659
14659
|
allowReserved,
|
|
14660
|
-
name,
|
|
14660
|
+
name: name2,
|
|
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, value }) => {
|
|
14666
|
+
var serializePrimitiveParam = ({ allowReserved, name: name2, 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 `${name2}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
14674
14674
|
};
|
|
14675
|
-
var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
14675
|
+
var serializeObjectParam = ({ allowReserved, explode, name: name2, style, value, valueOnly }) => {
|
|
14676
14676
|
if (value instanceof Date) {
|
|
14677
|
-
return valueOnly ? value.toISOString() : `${
|
|
14677
|
+
return valueOnly ? value.toISOString() : `${name2}=${value.toISOString()}`;
|
|
14678
14678
|
}
|
|
14679
14679
|
if (style !== "deepObject" && !explode) {
|
|
14680
14680
|
let values = [];
|
|
@@ -14688,11 +14688,11 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
|
|
|
14688
14688
|
const joinedValues2 = values.join(",");
|
|
14689
14689
|
switch (style) {
|
|
14690
14690
|
case "form":
|
|
14691
|
-
return `${
|
|
14691
|
+
return `${name2}=${joinedValues2}`;
|
|
14692
14692
|
case "label":
|
|
14693
14693
|
return `.${joinedValues2}`;
|
|
14694
14694
|
case "matrix":
|
|
14695
|
-
return `;${
|
|
14695
|
+
return `;${name2}=${joinedValues2}`;
|
|
14696
14696
|
default:
|
|
14697
14697
|
return joinedValues2;
|
|
14698
14698
|
}
|
|
@@ -14700,7 +14700,7 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
|
|
|
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" ? `${name2}[${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 name2 = match2.substring(1, match2.length - 1);
|
|
14718
14718
|
let style = "simple";
|
|
14719
|
-
if (
|
|
14719
|
+
if (name2.endsWith("*")) {
|
|
14720
14720
|
explode = true;
|
|
14721
|
-
|
|
14721
|
+
name2 = name2.substring(0, name2.length - 1);
|
|
14722
14722
|
}
|
|
14723
|
-
if (
|
|
14724
|
-
|
|
14723
|
+
if (name2.startsWith(".")) {
|
|
14724
|
+
name2 = name2.substring(1);
|
|
14725
14725
|
style = "label";
|
|
14726
|
-
} else if (
|
|
14727
|
-
|
|
14726
|
+
} else if (name2.startsWith(";")) {
|
|
14727
|
+
name2 = name2.substring(1);
|
|
14728
14728
|
style = "matrix";
|
|
14729
14729
|
}
|
|
14730
|
-
const value = path5[
|
|
14730
|
+
const value = path5[name2];
|
|
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, style, value }));
|
|
14735
|
+
url = url.replace(match2, serializeArrayParam({ explode, name: name2, 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: name2,
|
|
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: name2,
|
|
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: array4, 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 name2 in queryParams) {
|
|
14766
|
+
const value = queryParams[name2];
|
|
14767
14767
|
if (value === void 0 || value === null) {
|
|
14768
14768
|
continue;
|
|
14769
14769
|
}
|
|
@@ -14771,10 +14771,10 @@ var createQuerySerializer = ({ allowReserved, array: array3, object } = {}) => {
|
|
|
14771
14771
|
const serializedArray = serializeArrayParam({
|
|
14772
14772
|
allowReserved,
|
|
14773
14773
|
explode: true,
|
|
14774
|
-
name,
|
|
14774
|
+
name: name2,
|
|
14775
14775
|
style: "form",
|
|
14776
14776
|
value,
|
|
14777
|
-
...
|
|
14777
|
+
...array4
|
|
14778
14778
|
});
|
|
14779
14779
|
if (serializedArray)
|
|
14780
14780
|
search.push(serializedArray);
|
|
@@ -14782,7 +14782,7 @@ var createQuerySerializer = ({ allowReserved, array: array3, object } = {}) => {
|
|
|
14782
14782
|
const serializedObject = serializeObjectParam({
|
|
14783
14783
|
allowReserved,
|
|
14784
14784
|
explode: true,
|
|
14785
|
-
name,
|
|
14785
|
+
name: name2,
|
|
14786
14786
|
style: "deepObject",
|
|
14787
14787
|
value,
|
|
14788
14788
|
...object
|
|
@@ -14792,7 +14792,7 @@ var createQuerySerializer = ({ allowReserved, array: array3, object } = {}) => {
|
|
|
14792
14792
|
} else {
|
|
14793
14793
|
const serializedPrimitive = serializePrimitiveParam({
|
|
14794
14794
|
allowReserved,
|
|
14795
|
-
name,
|
|
14795
|
+
name: name2,
|
|
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, name2) => {
|
|
14830
|
+
if (!name2) {
|
|
14831
14831
|
return false;
|
|
14832
14832
|
}
|
|
14833
|
-
if (options.headers.has(
|
|
14833
|
+
if (options.headers.has(name2) || options.query?.[name2] || options.headers.get("Cookie")?.includes(`${name2}=`)) {
|
|
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 name2 = 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[name2] = token;
|
|
14854
14854
|
break;
|
|
14855
14855
|
case "cookie":
|
|
14856
|
-
options.headers.append("Cookie", `${
|
|
14856
|
+
options.headers.append("Cookie", `${name2}=${token}`);
|
|
14857
14857
|
break;
|
|
14858
14858
|
case "header":
|
|
14859
14859
|
default:
|
|
14860
|
-
options.headers.set(
|
|
14860
|
+
options.headers.set(name2, 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 literal4 = parseObjectLiteralTail(cleaned);
|
|
15720
|
+
if (literal4 && (literal4.code || literal4.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: literal4.code ?? null, message: head || cleaned, cycle: literal4.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(name2) {
|
|
16027
|
+
const stripped = name2.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(name2) {
|
|
16330
16330
|
try {
|
|
16331
|
-
await execFileAsync(process.platform === "win32" ? "where" : "which", [
|
|
16331
|
+
await execFileAsync(process.platform === "win32" ? "where" : "which", [name2]);
|
|
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 name2 of parseImportedNames(importClause)) {
|
|
16802
|
+
if (name2)
|
|
16803
|
+
names.add(name2);
|
|
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((name2) => {
|
|
16810
|
+
const renderPattern = new RegExp(`<${escapeRegExp(name2)}\\b[\\s\\S]*?(?:/>|</${escapeRegExp(name2)}>)`);
|
|
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(name2)}\\b[^>]*\\{\\.\\.\\.(?!props\\b)[^}]+\\}`);
|
|
16814
|
+
const propsPlusSiblingSpreadPattern = new RegExp(`<${escapeRegExp(name2)}\\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(name2) {
|
|
17062
|
+
if (DOM_PASS_THROUGH_PROPS.has(name2))
|
|
17063
17063
|
return true;
|
|
17064
|
-
if (/^aria[-A-Z]/.test(
|
|
17064
|
+
if (/^aria[-A-Z]/.test(name2))
|
|
17065
17065
|
return true;
|
|
17066
|
-
return
|
|
17066
|
+
return name2.startsWith("data-");
|
|
17067
17067
|
}
|
|
17068
17068
|
function preClassifyProp(prop) {
|
|
17069
|
-
const { name, type } = prop;
|
|
17070
|
-
if (/^on[A-Z]/.test(
|
|
17069
|
+
const { name: name2, type } = prop;
|
|
17070
|
+
if (/^on[A-Z]/.test(name2) || type.includes("=> void") || type.includes("EventHandler")) {
|
|
17071
17071
|
return { category: "exclude" };
|
|
17072
17072
|
}
|
|
17073
|
-
if (
|
|
17073
|
+
if (name2 === "ref" || name2 === "innerRef" || type.includes("Ref<") || type.includes("RefObject<")) {
|
|
17074
17074
|
return { category: "exclude" };
|
|
17075
17075
|
}
|
|
17076
|
-
if (
|
|
17076
|
+
if (name2 === "testId" || name2 === "data-testid" || name2 === "dataTestId") {
|
|
17077
17077
|
return { category: "exclude" };
|
|
17078
17078
|
}
|
|
17079
|
-
if (
|
|
17079
|
+
if (name2 === "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(name2)) {
|
|
17086
17086
|
return { category: "exclude" };
|
|
17087
17087
|
}
|
|
17088
|
-
if (
|
|
17088
|
+
if (name2 === "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(name2) || designNameEnd.test(name2)) {
|
|
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(name2)) {
|
|
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(name2)) {
|
|
17110
17110
|
return { category: "design", cdfTypeHint: "boolean" };
|
|
17111
17111
|
}
|
|
17112
17112
|
}
|
|
17113
|
-
if (
|
|
17113
|
+
if (name2 === "componentId" || name2 === "sectionKey" || name2 === "locale" || name2 === "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(name2) || urlNameEnd.test(name2)) {
|
|
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(name2) || textNameEnd.test(name2)) {
|
|
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: (name2, payload) => onDebugEvent?.("agent", { event: name2, ...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(([name2, sources]) => ({ name: name2, 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((name2) => allowedComponentNames2.has(name2)) } : 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((name2) => !dependents.has(name2)).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((name2) => ({
|
|
19539
|
+
name: name2,
|
|
19540
|
+
depth: name2 === 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 [name2, d] of depth.entries()) {
|
|
19577
19577
|
nodes.push({
|
|
19578
|
-
name,
|
|
19578
|
+
name: name2,
|
|
19579
19579
|
depth: d,
|
|
19580
|
-
path: parentPath.get(
|
|
19581
|
-
parents: [...parents.get(
|
|
19580
|
+
path: parentPath.get(name2),
|
|
19581
|
+
parents: [...parents.get(name2) ?? /* @__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 [name2, roots] of counts.entries()) {
|
|
19605
|
+
if (roots.length >= 2) out.set(name2, [...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 own = 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 < own) return true;
|
|
19765
|
+
if (d === own) 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 name2 of [...parentNames].sort()) {
|
|
19809
|
+
const full = computeClosure(name2, subgraph);
|
|
19810
|
+
closures.set(name2, { ...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 = (name2) => {
|
|
19814
|
+
const it = itemByKey.get(name2)?.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 own = 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 < own) return true;
|
|
19889
|
+
if (d === own) 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 name2 of standaloneRoots) {
|
|
19920
|
+
const rec = itemByKey.get(name2);
|
|
19921
19921
|
if (!rec) continue;
|
|
19922
19922
|
rows.push({
|
|
19923
19923
|
kind: "standalone",
|
|
19924
|
-
key: `stand:${
|
|
19925
|
-
label:
|
|
19924
|
+
key: `stand:${name2}`,
|
|
19925
|
+
label: name2,
|
|
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((name2) => (nodeByName.get(name2)?.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 name2 of sharedLeafNames) {
|
|
19934
|
+
if (seenStandaloneNames.has(name2)) continue;
|
|
19935
|
+
const rec = itemByKey.get(name2);
|
|
19936
19936
|
if (!rec) continue;
|
|
19937
19937
|
rows.push({
|
|
19938
19938
|
kind: "standalone",
|
|
19939
|
-
key: `shared-standalone:${
|
|
19940
|
-
label: `${
|
|
19939
|
+
key: `shared-standalone:${name2}`,
|
|
19940
|
+
label: `${name2} (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 name2 of flatNames) {
|
|
19957
|
+
const rec = itemByKey.get(name2);
|
|
19958
19958
|
if (!rec) continue;
|
|
19959
19959
|
rows.push({
|
|
19960
19960
|
kind: "flat",
|
|
19961
|
-
key: `flat:${
|
|
19962
|
-
label:
|
|
19961
|
+
key: `flat:${name2}`,
|
|
19962
|
+
label: name2,
|
|
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 name2 = items[row.itemIdx]?.key;
|
|
19973
|
+
if (name2 === void 0) return true;
|
|
19974
|
+
return filterVisibleKeys.has(name2);
|
|
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 = (name2) => {
|
|
20620
|
+
if (visited.has(name2)) return;
|
|
20621
|
+
visited.add(name2);
|
|
20622
|
+
queue.push(name2);
|
|
20623
|
+
const unit = cycleUnits.get(name2);
|
|
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 name2 of cycle.path) cycleParticipants.add(name2);
|
|
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 [name2, closure] of closures.entries()) {
|
|
20937
|
+
if (closure.nodes.length > 1) roots.add(name2);
|
|
20938
20938
|
}
|
|
20939
|
-
for (const
|
|
20939
|
+
for (const name2 of cycleParticipants) roots.add(name2);
|
|
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 (name2) => {
|
|
21011
|
+
if (hasSearch && !fuzzyMatches(input.searchQuery, name2)) return true;
|
|
21012
|
+
if (keys !== void 0 && !keys.has(name2)) 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 [name2, decision] of entries) next.set(name2, 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((name2) => [name2, "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((name2) => [name2, "rejected"]),
|
|
21037
|
+
...toDeselect.map((name2) => [name2, "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((name2) => state2.get(name2) !== "accepted");
|
|
21043
21043
|
if (anyNotAccepted) {
|
|
21044
21044
|
return apply(state2, [
|
|
21045
|
-
...nonCycle.map((
|
|
21046
|
-
...reachableCycleMembers(graph, nonCycle).map((
|
|
21045
|
+
...nonCycle.map((name2) => [name2, "accepted"]),
|
|
21046
|
+
...reachableCycleMembers(graph, nonCycle).map((name2) => [name2, "accepted"])
|
|
21047
21047
|
]);
|
|
21048
21048
|
}
|
|
21049
21049
|
return apply(state2, [
|
|
21050
|
-
...nonCycle.map((
|
|
21050
|
+
...nonCycle.map((name2) => [name2, "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((name2) => [name2, "accepted"]),
|
|
21058
|
+
...reachableCycleMembers(graph, seeds).map((name2) => [name2, "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, name2, state2) {
|
|
21064
|
+
if (state2.get(name2) === "rejected") return false;
|
|
21065
|
+
const { toReject, toDeselect } = rejectCascade(graph, name2);
|
|
21066
|
+
const ancestors = toReject.filter((n) => n !== name2);
|
|
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((name2) => decisions.get(name2) === "accepted")) continue;
|
|
21157
|
+
for (const name2 of unit) keys.add(name2);
|
|
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 = (name2) => {
|
|
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 === name2) {
|
|
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 = (name2) => {
|
|
21275
|
+
if (decisions.get(name2) === "rejected") return;
|
|
21276
|
+
if (rejectNeedsConfirmation(graph, name2, decisions)) {
|
|
21277
|
+
const { toReject, toDeselect } = rejectCascade(graph, name2);
|
|
21278
21278
|
setPendingRejectCascade({
|
|
21279
|
-
target:
|
|
21280
|
-
ancestors: toReject.filter((n) => n !==
|
|
21279
|
+
target: name2,
|
|
21280
|
+
ancestors: toReject.filter((n) => n !== name2).sort(),
|
|
21281
21281
|
descendants: [...toDeselect].sort()
|
|
21282
21282
|
});
|
|
21283
21283
|
return;
|
|
21284
21284
|
}
|
|
21285
|
-
decide({ type: "reject", name });
|
|
21285
|
+
decide({ type: "reject", name: name2 });
|
|
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 = (name2) => name2.charAt(0).toUpperCase() + name2.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 name2 = 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 ${name2}...`,
|
|
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 ${name2}...` : "Token restrictions ready",
|
|
21783
21783
|
complete: mapTokens === "complete"
|
|
21784
21784
|
});
|
|
21785
21785
|
}
|
|
@@ -22020,6 +22020,18 @@ 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
|
+
|
|
22023
22035
|
// packages/experience-design-system-types/dist/src/cdf/validate.js
|
|
22024
22036
|
import { Ajv as Ajv2 } from "ajv";
|
|
22025
22037
|
|
|
@@ -22188,32 +22200,32 @@ function validateCDF2(input) {
|
|
|
22188
22200
|
}
|
|
22189
22201
|
|
|
22190
22202
|
// packages/experience-design-system-types/dist/src/cdf/types.js
|
|
22191
|
-
import * as
|
|
22192
|
-
var CDFPropertySchema2 =
|
|
22193
|
-
$type:
|
|
22194
|
-
$category:
|
|
22195
|
-
$description:
|
|
22196
|
-
$required:
|
|
22197
|
-
$default:
|
|
22198
|
-
$values:
|
|
22199
|
-
"$token.kind":
|
|
22200
|
-
"$token.allowed":
|
|
22203
|
+
import * as z4 from "zod/mini";
|
|
22204
|
+
var CDFPropertySchema2 = z4.strictObject({
|
|
22205
|
+
$type: z4.enum(CDF_PROPERTY_TYPES2),
|
|
22206
|
+
$category: z4.enum(CDF_PROPERTY_CATEGORIES2),
|
|
22207
|
+
$description: z4.optional(z4.string()),
|
|
22208
|
+
$required: z4.optional(z4.boolean()),
|
|
22209
|
+
$default: z4.optional(z4.any()),
|
|
22210
|
+
$values: z4.optional(z4.array(z4.string())),
|
|
22211
|
+
"$token.kind": z4.optional(z4.string()),
|
|
22212
|
+
"$token.allowed": z4.optional(z4.array(z4.string()))
|
|
22201
22213
|
});
|
|
22202
|
-
var CDFSlotSchema2 =
|
|
22203
|
-
$description:
|
|
22204
|
-
$allowedComponents:
|
|
22205
|
-
$required:
|
|
22214
|
+
var CDFSlotSchema2 = z4.strictObject({
|
|
22215
|
+
$description: z4.optional(z4.string()),
|
|
22216
|
+
$allowedComponents: z4.optional(z4.array(z4.string())),
|
|
22217
|
+
$required: z4.optional(z4.boolean())
|
|
22206
22218
|
});
|
|
22207
|
-
var CDFComponentSchema2 =
|
|
22208
|
-
$type:
|
|
22209
|
-
$description:
|
|
22210
|
-
$properties:
|
|
22211
|
-
$slots:
|
|
22219
|
+
var CDFComponentSchema2 = z4.strictObject({
|
|
22220
|
+
$type: z4.literal("component"),
|
|
22221
|
+
$description: z4.optional(z4.string()),
|
|
22222
|
+
$properties: z4.record(z4.string(), CDFPropertySchema2),
|
|
22223
|
+
$slots: z4.optional(z4.record(z4.string(), CDFSlotSchema2))
|
|
22212
22224
|
});
|
|
22213
|
-
var CDFTokenSchema2 =
|
|
22214
|
-
$type:
|
|
22215
|
-
$value:
|
|
22216
|
-
$description:
|
|
22225
|
+
var CDFTokenSchema2 = z4.strictObject({
|
|
22226
|
+
$type: z4.enum(DESIGN_TOKEN_TYPES2),
|
|
22227
|
+
$value: z4.unknown(),
|
|
22228
|
+
$description: z4.optional(z4.string())
|
|
22217
22229
|
});
|
|
22218
22230
|
|
|
22219
22231
|
// packages/experience-design-system-types/dist/src/cdf/build.js
|
|
@@ -22221,9 +22233,9 @@ function stripUnsupportedSlotFields(entry) {
|
|
|
22221
22233
|
if (!entry.$slots)
|
|
22222
22234
|
return entry;
|
|
22223
22235
|
const cleaned = {};
|
|
22224
|
-
for (const [
|
|
22236
|
+
for (const [name2, slot] of Object.entries(entry.$slots)) {
|
|
22225
22237
|
const { $required: _required, ...rest } = slot;
|
|
22226
|
-
cleaned[
|
|
22238
|
+
cleaned[name2] = rest;
|
|
22227
22239
|
}
|
|
22228
22240
|
return { ...entry, $slots: cleaned };
|
|
22229
22241
|
}
|
|
@@ -22266,7 +22278,7 @@ function validateSlotReferences2(components) {
|
|
|
22266
22278
|
const slots = entry.$slots ?? {};
|
|
22267
22279
|
for (const [slotKey, slot] of Object.entries(slots)) {
|
|
22268
22280
|
const allowed = slot?.$allowedComponents ?? [];
|
|
22269
|
-
const unresolved = allowed.filter((
|
|
22281
|
+
const unresolved = allowed.filter((name2) => !componentKeys.has(name2));
|
|
22270
22282
|
if (unresolved.length === 0)
|
|
22271
22283
|
continue;
|
|
22272
22284
|
errors.push({
|
|
@@ -22292,111 +22304,23 @@ function setAtPath(root, dottedPath, value) {
|
|
|
22292
22304
|
}
|
|
22293
22305
|
|
|
22294
22306
|
// packages/experience-design-system-types/dist/src/dtcg/types.js
|
|
22295
|
-
import * as
|
|
22296
|
-
var DTCGTokenSchema2 =
|
|
22297
|
-
path:
|
|
22298
|
-
$type:
|
|
22299
|
-
$value:
|
|
22300
|
-
$description:
|
|
22307
|
+
import * as z5 from "zod/mini";
|
|
22308
|
+
var DTCGTokenSchema2 = z5.strictObject({
|
|
22309
|
+
path: z5.string(),
|
|
22310
|
+
$type: z5.enum(DESIGN_TOKEN_TYPES2),
|
|
22311
|
+
$value: z5.unknown(),
|
|
22312
|
+
$description: z5.optional(z5.string())
|
|
22301
22313
|
});
|
|
22302
22314
|
|
|
22303
22315
|
// packages/experience-design-system-types/dist/src/dtcg/validate.js
|
|
22304
22316
|
var TOKEN_TYPE_SET4 = new Set(DESIGN_TOKEN_TYPES2);
|
|
22305
22317
|
|
|
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
|
-
|
|
22394
22318
|
// packages/experience-design-system-cli/src/tui/import/steps/preview-validation-error/logic.ts
|
|
22395
22319
|
function failedComponentNames(errors) {
|
|
22396
22320
|
return [...new Set(errors.map((error) => error.componentName))];
|
|
22397
22321
|
}
|
|
22398
22322
|
function matchedComponentNames(errors, missingNames) {
|
|
22399
|
-
return failedComponentNames(errors).filter((
|
|
22323
|
+
return failedComponentNames(errors).filter((name2) => !missingNames.includes(name2));
|
|
22400
22324
|
}
|
|
22401
22325
|
function formatErrorLine(error) {
|
|
22402
22326
|
const context = [`Component: ${error.componentName}`, error.path ? `Path: ${error.path}` : null].filter(Boolean);
|
|
@@ -22511,14 +22435,14 @@ function computeRenderStatuses(closure, directIssues) {
|
|
|
22511
22435
|
for (const node of closure.nodes) {
|
|
22512
22436
|
nodesByName.set(node.name, { name: node.name, path: node.path });
|
|
22513
22437
|
}
|
|
22514
|
-
const
|
|
22438
|
+
const own = /* @__PURE__ */ new Map();
|
|
22515
22439
|
for (const node of closure.nodes) {
|
|
22516
22440
|
const s = directIssues.get(node.name);
|
|
22517
|
-
if (s && s !== "ok")
|
|
22441
|
+
if (s && s !== "ok") own.set(node.name, s);
|
|
22518
22442
|
}
|
|
22519
22443
|
const inheritedSources = /* @__PURE__ */ new Map();
|
|
22520
22444
|
for (const node of closure.nodes) {
|
|
22521
|
-
const ownStatus =
|
|
22445
|
+
const ownStatus = own.get(node.name);
|
|
22522
22446
|
if (!ownStatus) continue;
|
|
22523
22447
|
for (let i = 0; i < node.path.length - 1; i++) {
|
|
22524
22448
|
const ancestor = node.path[i];
|
|
@@ -22526,11 +22450,11 @@ function computeRenderStatuses(closure, directIssues) {
|
|
|
22526
22450
|
inheritedSources.get(ancestor).set(node.name, ownStatus);
|
|
22527
22451
|
}
|
|
22528
22452
|
}
|
|
22529
|
-
for (const [
|
|
22530
|
-
out.set(
|
|
22453
|
+
for (const [name2, status] of own.entries()) {
|
|
22454
|
+
out.set(name2, {
|
|
22531
22455
|
status,
|
|
22532
22456
|
isOwn: true,
|
|
22533
|
-
sourceComponents: [
|
|
22457
|
+
sourceComponents: [name2]
|
|
22534
22458
|
});
|
|
22535
22459
|
}
|
|
22536
22460
|
for (const [ancestor, sources] of inheritedSources.entries()) {
|
|
@@ -22795,7 +22719,7 @@ function parseToState(json) {
|
|
|
22795
22719
|
}
|
|
22796
22720
|
const componentDescription = typeof component.$description === "string" ? component.$description : "";
|
|
22797
22721
|
const rawProps = component.$properties ?? {};
|
|
22798
|
-
const props = Object.entries(rawProps).map(([
|
|
22722
|
+
const props = Object.entries(rawProps).map(([name2, raw]) => {
|
|
22799
22723
|
const p = raw ?? {};
|
|
22800
22724
|
const type = CDF_PROPERTY_TYPES2.includes(p.$type) ? p.$type : "string";
|
|
22801
22725
|
let defaultValue = null;
|
|
@@ -22807,7 +22731,7 @@ function parseToState(json) {
|
|
|
22807
22731
|
}
|
|
22808
22732
|
}
|
|
22809
22733
|
return {
|
|
22810
|
-
name,
|
|
22734
|
+
name: name2,
|
|
22811
22735
|
type,
|
|
22812
22736
|
category: CDF_PROPERTY_CATEGORIES2.includes(p.$category) ? p.$category : "content",
|
|
22813
22737
|
required: p.$required === true,
|
|
@@ -22819,10 +22743,10 @@ function parseToState(json) {
|
|
|
22819
22743
|
};
|
|
22820
22744
|
});
|
|
22821
22745
|
const rawSlots = component.$slots ?? {};
|
|
22822
|
-
const slots = Object.entries(rawSlots).map(([
|
|
22746
|
+
const slots = Object.entries(rawSlots).map(([name2, raw]) => {
|
|
22823
22747
|
const s = raw ?? {};
|
|
22824
22748
|
return {
|
|
22825
|
-
name,
|
|
22749
|
+
name: name2,
|
|
22826
22750
|
description: typeof s.$description === "string" ? s.$description : "",
|
|
22827
22751
|
required: s.$required === true,
|
|
22828
22752
|
allowedComponents: Array.isArray(s.$allowedComponents) ? s.$allowedComponents.filter((v) => typeof v === "string") : []
|
|
@@ -22930,7 +22854,7 @@ function DefaultValueRow({
|
|
|
22930
22854
|
] });
|
|
22931
22855
|
}
|
|
22932
22856
|
function RowLabel({
|
|
22933
|
-
name,
|
|
22857
|
+
name: name2,
|
|
22934
22858
|
selected,
|
|
22935
22859
|
trailing = true
|
|
22936
22860
|
}) {
|
|
@@ -22943,7 +22867,7 @@ function RowLabel({
|
|
|
22943
22867
|
wrap: "truncate-end",
|
|
22944
22868
|
children: [
|
|
22945
22869
|
" ",
|
|
22946
|
-
|
|
22870
|
+
name2,
|
|
22947
22871
|
trailing ? " " : ""
|
|
22948
22872
|
]
|
|
22949
22873
|
}
|
|
@@ -23295,10 +23219,10 @@ function SlotRow({
|
|
|
23295
23219
|
const slice = filtered.slice(start, start + MAX_VISIBLE);
|
|
23296
23220
|
return /* @__PURE__ */ jsxs26(Box26, { flexDirection: "column", children: [
|
|
23297
23221
|
/* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: " candidates (\u2191\u2193 cycle, Enter to add):" }),
|
|
23298
|
-
slice.map((
|
|
23222
|
+
slice.map((name2, i) => {
|
|
23299
23223
|
const absIdx = start + i;
|
|
23300
23224
|
const isCursor = absIdx === cursor;
|
|
23301
|
-
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${
|
|
23225
|
+
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${name2}` : ` ${name2}` }, name2);
|
|
23302
23226
|
})
|
|
23303
23227
|
] });
|
|
23304
23228
|
})() })
|
|
@@ -24195,8 +24119,8 @@ function FieldEditor({
|
|
|
24195
24119
|
const hasEmptyProperties = props.length === 0 && slots.length === 0;
|
|
24196
24120
|
const modeLabel = (() => {
|
|
24197
24121
|
if (pendingDelete) {
|
|
24198
|
-
const
|
|
24199
|
-
return `Delete ${pendingDelete.kind} "${
|
|
24122
|
+
const name2 = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
|
|
24123
|
+
return `Delete ${pendingDelete.kind} "${name2}"? [y] delete \xB7 any other key cancels`;
|
|
24200
24124
|
}
|
|
24201
24125
|
if (editingValue) {
|
|
24202
24126
|
return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
|
|
@@ -25325,7 +25249,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
25325
25249
|
);
|
|
25326
25250
|
db.exec("BEGIN");
|
|
25327
25251
|
try {
|
|
25328
|
-
for (const
|
|
25252
|
+
for (const name2 of toReject) statement.run(extractSessionId, name2);
|
|
25329
25253
|
db.exec("COMMIT");
|
|
25330
25254
|
} catch (error) {
|
|
25331
25255
|
db.exec("ROLLBACK");
|
|
@@ -26231,13 +26155,13 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26231
26155
|
const unchanged = new Set(preview.components.unchanged);
|
|
26232
26156
|
const changedNames = /* @__PURE__ */ new Set();
|
|
26233
26157
|
for (const item of preview.components.changed) {
|
|
26234
|
-
const
|
|
26235
|
-
if (typeof
|
|
26236
|
-
changedNames.add(
|
|
26158
|
+
const name2 = item.current?.name;
|
|
26159
|
+
if (typeof name2 !== "string") continue;
|
|
26160
|
+
changedNames.add(name2);
|
|
26237
26161
|
if (item.changeClassification?.classification === "breaking") {
|
|
26238
|
-
out.set(
|
|
26162
|
+
out.set(name2, "breaking");
|
|
26239
26163
|
} else {
|
|
26240
|
-
out.set(
|
|
26164
|
+
out.set(name2, "changed");
|
|
26241
26165
|
}
|
|
26242
26166
|
}
|
|
26243
26167
|
const removedNames = /* @__PURE__ */ new Set();
|
|
@@ -26247,12 +26171,12 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26247
26171
|
out.set(entity.name, "removed");
|
|
26248
26172
|
}
|
|
26249
26173
|
}
|
|
26250
|
-
for (const
|
|
26251
|
-
if (unchanged.has(
|
|
26252
|
-
if (changedNames.has(
|
|
26253
|
-
if (removedNames.has(
|
|
26254
|
-
if (out.has(
|
|
26255
|
-
out.set(
|
|
26174
|
+
for (const name2 of localNames) {
|
|
26175
|
+
if (unchanged.has(name2)) continue;
|
|
26176
|
+
if (changedNames.has(name2)) continue;
|
|
26177
|
+
if (removedNames.has(name2)) continue;
|
|
26178
|
+
if (out.has(name2)) continue;
|
|
26179
|
+
out.set(name2, "new");
|
|
26256
26180
|
}
|
|
26257
26181
|
return out;
|
|
26258
26182
|
}
|
|
@@ -27006,10 +26930,10 @@ function GenerateReviewStepView({
|
|
|
27006
26930
|
const merged = /* @__PURE__ */ new Map();
|
|
27007
26931
|
for (const closure of closures.values()) {
|
|
27008
26932
|
const per = computeRenderStatuses(closure, directIssues);
|
|
27009
|
-
for (const [
|
|
27010
|
-
const existing = merged.get(
|
|
26933
|
+
for (const [name2, rs] of per.entries()) {
|
|
26934
|
+
const existing = merged.get(name2);
|
|
27011
26935
|
if (!existing || !existing.isOwn && rs.isOwn) {
|
|
27012
|
-
merged.set(
|
|
26936
|
+
merged.set(name2, rs);
|
|
27013
26937
|
}
|
|
27014
26938
|
}
|
|
27015
26939
|
}
|
|
@@ -27064,11 +26988,11 @@ function GenerateReviewStepView({
|
|
|
27064
26988
|
reviewEditor.setSaveError(null);
|
|
27065
26989
|
setPendingEditorFocus(null);
|
|
27066
26990
|
};
|
|
27067
|
-
const jumpCursorToName = (
|
|
26991
|
+
const jumpCursorToName = (name2) => {
|
|
27068
26992
|
for (let i = 0; i < visibleRowsMemo.length; i++) {
|
|
27069
26993
|
const row = visibleRowsMemo[i];
|
|
27070
26994
|
if (row.itemIdx < 0) continue;
|
|
27071
|
-
if (components[row.itemIdx]?.key ===
|
|
26995
|
+
if (components[row.itemIdx]?.key === name2) {
|
|
27072
26996
|
jumpCursorToRow(i);
|
|
27073
26997
|
return;
|
|
27074
26998
|
}
|
|
@@ -27596,8 +27520,8 @@ function GenerateReviewStepView({
|
|
|
27596
27520
|
}
|
|
27597
27521
|
),
|
|
27598
27522
|
!dialogOpen && autoRejected.length > 0 && (() => {
|
|
27599
|
-
const stillRejected = autoRejected.filter((
|
|
27600
|
-
const c2 = components.find((x) => x.key ===
|
|
27523
|
+
const stillRejected = autoRejected.filter((name2) => {
|
|
27524
|
+
const c2 = components.find((x) => x.key === name2);
|
|
27601
27525
|
return c2?.status === "rejected";
|
|
27602
27526
|
});
|
|
27603
27527
|
if (stillRejected.length === 0) return null;
|
|
@@ -28108,31 +28032,31 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
28108
28032
|
const proposedProperties = proposed["$properties"] ?? {};
|
|
28109
28033
|
const proposedProps = new Set(Object.keys(proposedProperties));
|
|
28110
28034
|
const oldProps = current.fullProperties;
|
|
28111
|
-
for (const
|
|
28112
|
-
if (!currentProps.has(
|
|
28113
|
-
const def = proposedProperties[
|
|
28114
|
-
lines.push({ key: `${
|
|
28035
|
+
for (const name2 of [...proposedProps].sort()) {
|
|
28036
|
+
if (!currentProps.has(name2)) {
|
|
28037
|
+
const def = proposedProperties[name2];
|
|
28038
|
+
lines.push({ key: `${name2}-add`, color: PALETTE.success, text: `+ ${name2}: ${formatPropDef(def)}` });
|
|
28115
28039
|
}
|
|
28116
28040
|
}
|
|
28117
|
-
for (const
|
|
28118
|
-
if (!proposedProps.has(
|
|
28119
|
-
if (oldProps?.[
|
|
28120
|
-
lines.push({ key: `${
|
|
28041
|
+
for (const name2 of [...currentProps].sort()) {
|
|
28042
|
+
if (!proposedProps.has(name2)) {
|
|
28043
|
+
if (oldProps?.[name2]) {
|
|
28044
|
+
lines.push({ key: `${name2}-rm`, color: PALETTE.error, text: `- ${name2}: ${formatOldProp(oldProps[name2])}` });
|
|
28121
28045
|
} else {
|
|
28122
|
-
const cat = current.contentProperties.includes(
|
|
28123
|
-
lines.push({ key: `${
|
|
28046
|
+
const cat = current.contentProperties.includes(name2) ? "content" : "design";
|
|
28047
|
+
lines.push({ key: `${name2}-rm`, color: PALETTE.error, text: `- ${name2} (${cat})` });
|
|
28124
28048
|
}
|
|
28125
28049
|
}
|
|
28126
28050
|
}
|
|
28127
28051
|
const handledProps = /* @__PURE__ */ new Set();
|
|
28128
|
-
for (const
|
|
28129
|
-
if (!proposedProps.has(
|
|
28130
|
-
const newDef = proposedProperties[
|
|
28131
|
-
const oldDef = oldProps?.[
|
|
28052
|
+
for (const name2 of [...currentProps].sort()) {
|
|
28053
|
+
if (!proposedProps.has(name2)) continue;
|
|
28054
|
+
const newDef = proposedProperties[name2];
|
|
28055
|
+
const oldDef = oldProps?.[name2];
|
|
28132
28056
|
if (!oldDef) continue;
|
|
28133
|
-
const diffs = diffProperty(
|
|
28057
|
+
const diffs = diffProperty(name2, oldDef, newDef);
|
|
28134
28058
|
if (diffs.length > 0) {
|
|
28135
|
-
handledProps.add(
|
|
28059
|
+
handledProps.add(name2);
|
|
28136
28060
|
for (const d of diffs) lines.push(d);
|
|
28137
28061
|
}
|
|
28138
28062
|
}
|
|
@@ -28155,40 +28079,40 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
28155
28079
|
const proposedSlots = proposed["$slots"] ?? {};
|
|
28156
28080
|
const proposedSlotNames = new Set(Object.keys(proposedSlots));
|
|
28157
28081
|
const currentSlotAllowed = current.currentSlotAllowed ?? {};
|
|
28158
|
-
for (const
|
|
28159
|
-
if (!currentSlots.has(
|
|
28160
|
-
lines.push({ key: `slot-${
|
|
28082
|
+
for (const name2 of [...proposedSlotNames].sort()) {
|
|
28083
|
+
if (!currentSlots.has(name2)) {
|
|
28084
|
+
lines.push({ key: `slot-${name2}-add`, color: PALETTE.success, text: `+ slot: ${name2}` });
|
|
28161
28085
|
}
|
|
28162
28086
|
}
|
|
28163
|
-
for (const
|
|
28164
|
-
if (!proposedSlotNames.has(
|
|
28165
|
-
lines.push({ key: `slot-${
|
|
28087
|
+
for (const name2 of [...currentSlots].sort()) {
|
|
28088
|
+
if (!proposedSlotNames.has(name2)) {
|
|
28089
|
+
lines.push({ key: `slot-${name2}-rm`, color: PALETTE.error, text: `- slot: ${name2}` });
|
|
28166
28090
|
}
|
|
28167
28091
|
}
|
|
28168
|
-
for (const
|
|
28169
|
-
const nextAllowed = normalizeAllowedComponents(proposedSlots[
|
|
28170
|
-
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[
|
|
28171
|
-
const prevExists = currentSlots.has(
|
|
28092
|
+
for (const name2 of [...proposedSlotNames].sort()) {
|
|
28093
|
+
const nextAllowed = normalizeAllowedComponents(proposedSlots[name2]?.["$allowedComponents"]);
|
|
28094
|
+
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[name2]);
|
|
28095
|
+
const prevExists = currentSlots.has(name2);
|
|
28172
28096
|
if (!prevExists) {
|
|
28173
28097
|
if (nextAllowed.length > 0) {
|
|
28174
28098
|
lines.push({
|
|
28175
|
-
key: `slot-${
|
|
28099
|
+
key: `slot-${name2}-allow-new`,
|
|
28176
28100
|
color: PALETTE.success,
|
|
28177
|
-
text: `+ slot ${
|
|
28101
|
+
text: `+ slot ${name2} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
28178
28102
|
});
|
|
28179
28103
|
}
|
|
28180
28104
|
continue;
|
|
28181
28105
|
}
|
|
28182
28106
|
if (arraysEqual(prevAllowed, nextAllowed)) continue;
|
|
28183
28107
|
lines.push({
|
|
28184
|
-
key: `slot-${
|
|
28108
|
+
key: `slot-${name2}-allow-old`,
|
|
28185
28109
|
color: PALETTE.error,
|
|
28186
|
-
text: `- slot ${
|
|
28110
|
+
text: `- slot ${name2} allowedComponents: [${prevAllowed.join(", ")}]`
|
|
28187
28111
|
});
|
|
28188
28112
|
lines.push({
|
|
28189
|
-
key: `slot-${
|
|
28113
|
+
key: `slot-${name2}-allow-new`,
|
|
28190
28114
|
color: PALETTE.success,
|
|
28191
|
-
text: `+ slot ${
|
|
28115
|
+
text: `+ slot ${name2} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
28192
28116
|
});
|
|
28193
28117
|
}
|
|
28194
28118
|
return lines;
|
|
@@ -28224,7 +28148,7 @@ function normalizeType(type) {
|
|
|
28224
28148
|
return type.toLowerCase();
|
|
28225
28149
|
}
|
|
28226
28150
|
}
|
|
28227
|
-
function diffProperty(
|
|
28151
|
+
function diffProperty(name2, old, newDef) {
|
|
28228
28152
|
const diffs = [];
|
|
28229
28153
|
const newType = newDef["$type"] ?? "";
|
|
28230
28154
|
const newCategory = newDef["$category"] ?? "";
|
|
@@ -28235,15 +28159,15 @@ function diffProperty(name, old, newDef) {
|
|
|
28235
28159
|
const requiredChanged = old.required !== newRequired;
|
|
28236
28160
|
const defaultChanged = JSON.stringify(old.default) !== JSON.stringify(newDefault);
|
|
28237
28161
|
if (!typeChanged && !categoryChanged && !requiredChanged && !defaultChanged) return [];
|
|
28238
|
-
diffs.push({ key: `${
|
|
28239
|
-
diffs.push({ key: `${
|
|
28162
|
+
diffs.push({ key: `${name2}-old`, color: PALETTE.error, text: `- ${name2}: ${formatOldProp(old)}` });
|
|
28163
|
+
diffs.push({ key: `${name2}-new`, color: PALETTE.success, text: `+ ${name2}: ${formatPropDef(newDef)}` });
|
|
28240
28164
|
return diffs;
|
|
28241
28165
|
}
|
|
28242
28166
|
function formatDefault(value) {
|
|
28243
28167
|
const sys = value?.sys;
|
|
28244
28168
|
if (sys?.linkType === "Contentful:DesignToken" && typeof sys.urn === "string") {
|
|
28245
|
-
const
|
|
28246
|
-
if (
|
|
28169
|
+
const name2 = sys.urn.split("/designTokens/")[1];
|
|
28170
|
+
if (name2) return name2;
|
|
28247
28171
|
}
|
|
28248
28172
|
return JSON.stringify(value);
|
|
28249
28173
|
}
|
|
@@ -28296,8 +28220,8 @@ function buildPreviewSummaryLines(preview) {
|
|
|
28296
28220
|
text: ` \uFF0B ${components.new.length} components will be created`
|
|
28297
28221
|
});
|
|
28298
28222
|
for (const [index, item] of components.new.entries()) {
|
|
28299
|
-
const
|
|
28300
|
-
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${
|
|
28223
|
+
const name2 = item.key ?? item.$name ?? "unknown";
|
|
28224
|
+
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${name2}` });
|
|
28301
28225
|
}
|
|
28302
28226
|
}
|
|
28303
28227
|
if (components.changed.length > 0) {
|
|
@@ -28390,27 +28314,27 @@ function getPreviewScrollOffset(input, downArrow, upArrow, diffExpanded, current
|
|
|
28390
28314
|
}
|
|
28391
28315
|
return void 0;
|
|
28392
28316
|
}
|
|
28393
|
-
function appendChangedPreviewLine(lines, keyPrefix,
|
|
28317
|
+
function appendChangedPreviewLine(lines, keyPrefix, name2, hasPendingDraftChanges, changeClassification) {
|
|
28394
28318
|
lines.push({
|
|
28395
|
-
key: `${keyPrefix}-h-${
|
|
28319
|
+
key: `${keyPrefix}-h-${name2}`,
|
|
28396
28320
|
color: PALETTE.warning,
|
|
28397
|
-
text: ` ~ ${
|
|
28321
|
+
text: ` ~ ${name2}${hasPendingDraftChanges ? " \u26A1 has pending draft changes" : ""}`
|
|
28398
28322
|
});
|
|
28399
28323
|
if (changeClassification?.classification !== "breaking") return;
|
|
28400
28324
|
const reasons = changeClassification.breakingChanges.map((bc) => `${"slotId" in bc ? bc.slotId : bc.propertyId}: ${bc.reason}`).join(", ");
|
|
28401
|
-
lines.push({ key: `${keyPrefix}-b-${
|
|
28325
|
+
lines.push({ key: `${keyPrefix}-b-${name2}`, color: PALETTE.error, text: ` \u26A0 BREAKING: ${reasons}` });
|
|
28402
28326
|
}
|
|
28403
28327
|
function buildPreviewDiffLines(preview) {
|
|
28404
28328
|
const lines = [];
|
|
28405
28329
|
const { components, tokens } = preview;
|
|
28406
28330
|
for (const item of components.new) {
|
|
28407
28331
|
const raw = item;
|
|
28408
|
-
const
|
|
28409
|
-
lines.push({ key: `comp-new-${
|
|
28332
|
+
const name2 = raw.key ?? raw.$name ?? "unknown";
|
|
28333
|
+
lines.push({ key: `comp-new-${name2}`, color: PALETTE.success, text: ` + ${name2}` });
|
|
28410
28334
|
const slots = raw.$slots ?? {};
|
|
28411
28335
|
for (const slotName of Object.keys(slots).sort()) {
|
|
28412
28336
|
lines.push({
|
|
28413
|
-
key: `comp-new-${
|
|
28337
|
+
key: `comp-new-${name2}-slot-${slotName}`,
|
|
28414
28338
|
color: PALETTE.success,
|
|
28415
28339
|
text: ` slot: ${slotName}`
|
|
28416
28340
|
});
|
|
@@ -28418,7 +28342,7 @@ function buildPreviewDiffLines(preview) {
|
|
|
28418
28342
|
if (Array.isArray(allowed) && allowed.length > 0) {
|
|
28419
28343
|
const names = allowed.filter((n) => typeof n === "string");
|
|
28420
28344
|
lines.push({
|
|
28421
|
-
key: `comp-new-${
|
|
28345
|
+
key: `comp-new-${name2}-slot-${slotName}-allow`,
|
|
28422
28346
|
color: PALETTE.success,
|
|
28423
28347
|
text: ` allowedComponents: [${names.join(", ")}]`
|
|
28424
28348
|
});
|
|
@@ -28456,8 +28380,8 @@ function buildPreviewDiffLines(preview) {
|
|
|
28456
28380
|
}
|
|
28457
28381
|
for (const item of tokens.new) {
|
|
28458
28382
|
const raw = item;
|
|
28459
|
-
const
|
|
28460
|
-
lines.push({ key: `tok-new-${
|
|
28383
|
+
const name2 = raw.name ?? raw.path ?? "unknown";
|
|
28384
|
+
lines.push({ key: `tok-new-${name2}`, color: PALETTE.success, text: ` + ${name2}` });
|
|
28461
28385
|
}
|
|
28462
28386
|
for (const item of tokens.removed) {
|
|
28463
28387
|
lines.push({ key: `tok-rm-${item.name}`, color: PALETTE.error, text: ` - ${item.name}` });
|
|
@@ -29657,7 +29581,7 @@ init_config();
|
|
|
29657
29581
|
import { existsSync as existsSync10 } from "node:fs";
|
|
29658
29582
|
function diffSnapshots(before, after) {
|
|
29659
29583
|
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
|
|
29660
|
-
const changed_fields = names.filter((
|
|
29584
|
+
const changed_fields = names.filter((name2) => before[name2] !== after[name2]);
|
|
29661
29585
|
return { changed: changed_fields.length > 0, changed_fields };
|
|
29662
29586
|
}
|
|
29663
29587
|
var DEFAULT_TRAIL_LIMIT = 30;
|
|
@@ -29705,11 +29629,11 @@ var LOGIN_HINTS = {
|
|
|
29705
29629
|
cursor: "sign in from Cursor",
|
|
29706
29630
|
copilot: "run `copilot` and sign in"
|
|
29707
29631
|
};
|
|
29708
|
-
function effectiveBinary(
|
|
29709
|
-
return savedBinary.trim() || AGENT_BINARIES[
|
|
29632
|
+
function effectiveBinary(name2, savedBinary) {
|
|
29633
|
+
return savedBinary.trim() || AGENT_BINARIES[name2];
|
|
29710
29634
|
}
|
|
29711
|
-
function defaultModelLabel(
|
|
29712
|
-
const model = DEFAULT_MODELS[
|
|
29635
|
+
function defaultModelLabel(name2) {
|
|
29636
|
+
const model = DEFAULT_MODELS[name2];
|
|
29713
29637
|
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
29714
29638
|
}
|
|
29715
29639
|
var fail3 = (step, detail) => ({ step, ok: false, detail });
|
|
@@ -29738,32 +29662,32 @@ function readVersion(binary) {
|
|
|
29738
29662
|
});
|
|
29739
29663
|
});
|
|
29740
29664
|
}
|
|
29741
|
-
async function inspect(
|
|
29742
|
-
const target = effectiveBinary(
|
|
29665
|
+
async function inspect(name2, binary) {
|
|
29666
|
+
const target = effectiveBinary(name2, binary);
|
|
29743
29667
|
const found = await resolveOnPath(target);
|
|
29744
29668
|
if (!found) return { checks: [fail3("path", `\`${target}\` was not found or is not executable`)], found: null };
|
|
29745
29669
|
const checks = [pass("path", found)];
|
|
29746
29670
|
checks.push(await readVersion(found));
|
|
29747
|
-
if (
|
|
29748
|
-
const auth = await withBinaryEnv(
|
|
29671
|
+
if (name2 === "claude") {
|
|
29672
|
+
const auth = await withBinaryEnv(name2, found, () => checkAgentAuth(name2));
|
|
29749
29673
|
checks.push(
|
|
29750
29674
|
auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
29751
29675
|
);
|
|
29752
29676
|
}
|
|
29753
29677
|
return { checks, found };
|
|
29754
29678
|
}
|
|
29755
|
-
async function inspectAgent(
|
|
29756
|
-
return (await inspect(
|
|
29679
|
+
async function inspectAgent(name2, binary) {
|
|
29680
|
+
return (await inspect(name2, binary)).checks;
|
|
29757
29681
|
}
|
|
29758
|
-
async function testAgent(
|
|
29759
|
-
const { checks, found } = await inspect(
|
|
29682
|
+
async function testAgent(name2, binary, model) {
|
|
29683
|
+
const { checks, found } = await inspect(name2, binary);
|
|
29760
29684
|
if (!found || !checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
29761
29685
|
const started = Date.now();
|
|
29762
29686
|
const result = await withBinaryEnv(
|
|
29763
|
-
|
|
29687
|
+
name2,
|
|
29764
29688
|
found,
|
|
29765
29689
|
() => createLocalCliAgentInvoker().invoke({
|
|
29766
|
-
agent:
|
|
29690
|
+
agent: name2,
|
|
29767
29691
|
...model.trim() ? { model: model.trim() } : {},
|
|
29768
29692
|
prompt: TEST_PROMPT,
|
|
29769
29693
|
timeoutMs: PROMPT_TIMEOUT_MS
|
|
@@ -29779,7 +29703,7 @@ async function testAgent(name, binary, model) {
|
|
|
29779
29703
|
}
|
|
29780
29704
|
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
29781
29705
|
}
|
|
29782
|
-
function statusFromChecks(
|
|
29706
|
+
function statusFromChecks(name2, checks, savedBinary) {
|
|
29783
29707
|
if (checks.length === 0) return "checking";
|
|
29784
29708
|
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
29785
29709
|
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
@@ -29791,13 +29715,13 @@ function statusFromChecks(name, checks, savedBinary) {
|
|
|
29791
29715
|
}
|
|
29792
29716
|
const login = checks.find((check) => check.step === "login");
|
|
29793
29717
|
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
29794
|
-
return
|
|
29718
|
+
return name2 === "claude" ? "ready" : "unknown";
|
|
29795
29719
|
}
|
|
29796
|
-
function setupHint(
|
|
29797
|
-
if (status === "not-configured") return `${INSTALL_HINTS[
|
|
29798
|
-
if (status === "not-found") return `${INSTALL_HINTS[
|
|
29799
|
-
if (status === "not-logged-in") return LOGIN_HINTS[
|
|
29800
|
-
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[
|
|
29720
|
+
function setupHint(name2, status) {
|
|
29721
|
+
if (status === "not-configured") return `${INSTALL_HINTS[name2]}, or set its command path in settings`;
|
|
29722
|
+
if (status === "not-found") return `${INSTALL_HINTS[name2]}, or correct the command path in settings`;
|
|
29723
|
+
if (status === "not-logged-in") return LOGIN_HINTS[name2];
|
|
29724
|
+
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name2]}`;
|
|
29801
29725
|
if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
|
|
29802
29726
|
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
29803
29727
|
return "";
|
|
@@ -29819,14 +29743,14 @@ var LIST_STATUS = {
|
|
|
29819
29743
|
"timed-out": { symbol: "\u2717", text: "test timed out", tone: "bad" },
|
|
29820
29744
|
unknown: { symbol: "\u25D0", text: "installed, login unknown", tone: "muted" }
|
|
29821
29745
|
};
|
|
29822
|
-
function modelLine(
|
|
29746
|
+
function modelLine(name2, savedModel) {
|
|
29823
29747
|
const model = savedModel.trim();
|
|
29824
|
-
return model ? model : `${defaultModelLabel(
|
|
29748
|
+
return model ? model : `${defaultModelLabel(name2)} (built-in default)`;
|
|
29825
29749
|
}
|
|
29826
|
-
function baseRows(
|
|
29750
|
+
function baseRows(name2, checks, savedBinary) {
|
|
29827
29751
|
const path5 = checks.find((check) => check.step === "path");
|
|
29828
29752
|
const version2 = checks.find((check) => check.step === "version");
|
|
29829
|
-
const hint = setupHint(
|
|
29753
|
+
const hint = setupHint(name2, statusFromChecks(name2, checks, savedBinary));
|
|
29830
29754
|
const setup = hint ? { label: "Setup", value: hint, tone: "muted" } : void 0;
|
|
29831
29755
|
if (!path5?.ok) {
|
|
29832
29756
|
const saved = savedBinary.trim() !== "";
|
|
@@ -29849,15 +29773,15 @@ function baseRows(name, checks, savedBinary) {
|
|
|
29849
29773
|
};
|
|
29850
29774
|
}
|
|
29851
29775
|
var checking = [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
29852
|
-
function panelRows(
|
|
29776
|
+
function panelRows(name2, checks, settings) {
|
|
29853
29777
|
if (!checks) return checking;
|
|
29854
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
29855
|
-
const model = { label: "Model", value: modelLine(
|
|
29778
|
+
const { command, version: version2, setup, found } = baseRows(name2, checks, settings.binary);
|
|
29779
|
+
const model = { label: "Model", value: modelLine(name2, settings.model), tone: "muted" };
|
|
29856
29780
|
return [command, ...found ? [...version2?.tone === "ok" ? [version2] : [], model] : [], ...setup ? [setup] : []];
|
|
29857
29781
|
}
|
|
29858
|
-
function statusRows(
|
|
29782
|
+
function statusRows(name2, checks, savedBinary) {
|
|
29859
29783
|
if (!checks) return checking;
|
|
29860
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
29784
|
+
const { command, version: version2, setup, found } = baseRows(name2, checks, savedBinary);
|
|
29861
29785
|
if (!found) return [command];
|
|
29862
29786
|
const login = checks.find((check) => check.step === "login");
|
|
29863
29787
|
const prompt = checks.find((check) => check.step === "prompt");
|
|
@@ -29876,8 +29800,8 @@ function statusRows(name, checks, savedBinary) {
|
|
|
29876
29800
|
const testRow = prompt ? [{ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" }] : [];
|
|
29877
29801
|
return [command, ...version2 ? [version2] : [], loginRow, ...testRow, ...setup ? [setup] : []];
|
|
29878
29802
|
}
|
|
29879
|
-
async function withBinaryEnv(
|
|
29880
|
-
const key = `EDS_AGENT_BINARY_${
|
|
29803
|
+
async function withBinaryEnv(name2, binary, run) {
|
|
29804
|
+
const key = `EDS_AGENT_BINARY_${name2.toUpperCase()}`;
|
|
29881
29805
|
const previous = process.env[key];
|
|
29882
29806
|
process.env[key] = binary;
|
|
29883
29807
|
try {
|
|
@@ -29891,9 +29815,9 @@ async function withBinaryEnv(name, binary, run) {
|
|
|
29891
29815
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-debug.ts
|
|
29892
29816
|
function agentSnapshot(config) {
|
|
29893
29817
|
const snapshot = { default_agent: config.defaultAgent };
|
|
29894
|
-
for (const
|
|
29895
|
-
snapshot[`${
|
|
29896
|
-
snapshot[`${
|
|
29818
|
+
for (const name2 of AGENT_NAMES) {
|
|
29819
|
+
snapshot[`${name2}.model`] = config.agents[name2].model;
|
|
29820
|
+
snapshot[`${name2}.binary`] = config.agents[name2].binary;
|
|
29897
29821
|
}
|
|
29898
29822
|
return snapshot;
|
|
29899
29823
|
}
|
|
@@ -29910,10 +29834,10 @@ function environmentFrom(checks, savedBinary, envValue) {
|
|
|
29910
29834
|
}
|
|
29911
29835
|
async function describeAgents(config) {
|
|
29912
29836
|
const entries = await Promise.all(
|
|
29913
|
-
AGENT_NAMES.map(async (
|
|
29914
|
-
const saved = config.agents[
|
|
29915
|
-
const checks = await inspectAgent(
|
|
29916
|
-
return [
|
|
29837
|
+
AGENT_NAMES.map(async (name2) => {
|
|
29838
|
+
const saved = config.agents[name2].binary;
|
|
29839
|
+
const checks = await inspectAgent(name2, saved);
|
|
29840
|
+
return [name2, environmentFrom(checks, saved, process.env[`EDS_AGENT_BINARY_${name2.toUpperCase()}`])];
|
|
29917
29841
|
})
|
|
29918
29842
|
);
|
|
29919
29843
|
return Object.fromEntries(entries);
|
|
@@ -29934,7 +29858,7 @@ var AGENT_LABELS = {
|
|
|
29934
29858
|
};
|
|
29935
29859
|
var asString = (value) => typeof value === "string" ? value : "";
|
|
29936
29860
|
function emptyAgents() {
|
|
29937
|
-
return Object.fromEntries(AGENT_NAMES.map((
|
|
29861
|
+
return Object.fromEntries(AGENT_NAMES.map((name2) => [name2, { model: "", binary: "" }]));
|
|
29938
29862
|
}
|
|
29939
29863
|
async function readAgentConfig() {
|
|
29940
29864
|
const store = await readV1Store();
|
|
@@ -29944,11 +29868,11 @@ async function readAgentConfig() {
|
|
|
29944
29868
|
const agents = emptyAgents();
|
|
29945
29869
|
const saved = store["agents"];
|
|
29946
29870
|
if (saved && typeof saved === "object") {
|
|
29947
|
-
for (const
|
|
29948
|
-
const entry = saved[
|
|
29871
|
+
for (const name2 of AGENT_NAMES) {
|
|
29872
|
+
const entry = saved[name2];
|
|
29949
29873
|
if (entry && typeof entry === "object") {
|
|
29950
29874
|
const fields2 = entry;
|
|
29951
|
-
agents[
|
|
29875
|
+
agents[name2] = { model: asString(fields2["model"]), binary: asString(fields2["binary"]) };
|
|
29952
29876
|
}
|
|
29953
29877
|
}
|
|
29954
29878
|
}
|
|
@@ -29961,10 +29885,10 @@ async function writeAgentConfig(config) {
|
|
|
29961
29885
|
const existing = await readV1Store();
|
|
29962
29886
|
const merged = { ...existing };
|
|
29963
29887
|
const agents = {};
|
|
29964
|
-
for (const
|
|
29965
|
-
const model = config.agents[
|
|
29966
|
-
const binary = config.agents[
|
|
29967
|
-
if (model || binary) agents[
|
|
29888
|
+
for (const name2 of AGENT_NAMES) {
|
|
29889
|
+
const model = config.agents[name2].model.trim();
|
|
29890
|
+
const binary = config.agents[name2].binary.trim();
|
|
29891
|
+
if (model || binary) agents[name2] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
|
|
29968
29892
|
}
|
|
29969
29893
|
const defaultModel = config.defaultChosen ? agents[config.defaultAgent]?.model : void 0;
|
|
29970
29894
|
if (config.defaultChosen) merged["agent"] = config.defaultAgent;
|
|
@@ -29989,20 +29913,20 @@ var TONE_COLOR = {
|
|
|
29989
29913
|
muted: PALETTE.muted
|
|
29990
29914
|
};
|
|
29991
29915
|
function AgentStatusBadge({
|
|
29992
|
-
name,
|
|
29916
|
+
name: name2,
|
|
29993
29917
|
checks,
|
|
29994
29918
|
binary
|
|
29995
29919
|
}) {
|
|
29996
|
-
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(
|
|
29920
|
+
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(name2, checks, binary) : "checking"];
|
|
29997
29921
|
return /* @__PURE__ */ jsx59(Text49, { color: TONE_COLOR[tone], children: `${symbol} ${text}` });
|
|
29998
29922
|
}
|
|
29999
29923
|
|
|
30000
29924
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/apply-binary-overrides.ts
|
|
30001
29925
|
var shellValues = /* @__PURE__ */ new Map();
|
|
30002
29926
|
function applyBinaryOverrides(config) {
|
|
30003
|
-
for (const
|
|
30004
|
-
const key = `EDS_AGENT_BINARY_${
|
|
30005
|
-
const binary = config.agents[
|
|
29927
|
+
for (const name2 of AGENT_NAMES) {
|
|
29928
|
+
const key = `EDS_AGENT_BINARY_${name2.toUpperCase()}`;
|
|
29929
|
+
const binary = config.agents[name2].binary.trim();
|
|
30006
29930
|
if (binary) {
|
|
30007
29931
|
if (!shellValues.has(key)) shellValues.set(key, process.env[key]);
|
|
30008
29932
|
process.env[key] = binary;
|
|
@@ -30017,9 +29941,9 @@ function applyBinaryOverrides(config) {
|
|
|
30017
29941
|
|
|
30018
29942
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
30019
29943
|
import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
30020
|
-
var fields = (
|
|
30021
|
-
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[
|
|
30022
|
-
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(
|
|
29944
|
+
var fields = (name2) => [
|
|
29945
|
+
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[name2]}\` from the PATH)` },
|
|
29946
|
+
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name2)})` }
|
|
30023
29947
|
];
|
|
30024
29948
|
var INSPECT_DELAY_MS = 400;
|
|
30025
29949
|
function StatusHeading() {
|
|
@@ -30029,13 +29953,13 @@ function StatusHeading() {
|
|
|
30029
29953
|
] });
|
|
30030
29954
|
}
|
|
30031
29955
|
function AgentDetail({
|
|
30032
|
-
name,
|
|
29956
|
+
name: name2,
|
|
30033
29957
|
config,
|
|
30034
29958
|
setConfig,
|
|
30035
29959
|
onBack,
|
|
30036
29960
|
record: record3
|
|
30037
29961
|
}) {
|
|
30038
|
-
const settings = config.agents[
|
|
29962
|
+
const settings = config.agents[name2];
|
|
30039
29963
|
const [saving, setSaving] = useState33(false);
|
|
30040
29964
|
const [testing, setTesting] = useState33(false);
|
|
30041
29965
|
const [notice, setNotice] = useState33(null);
|
|
@@ -30044,38 +29968,38 @@ function AgentDetail({
|
|
|
30044
29968
|
let active = true;
|
|
30045
29969
|
setChecks(void 0);
|
|
30046
29970
|
const timer = setTimeout(() => {
|
|
30047
|
-
void inspectAgent(
|
|
29971
|
+
void inspectAgent(name2, settings.binary).then((result) => active && setChecks(result));
|
|
30048
29972
|
}, INSPECT_DELAY_MS);
|
|
30049
29973
|
return () => {
|
|
30050
29974
|
active = false;
|
|
30051
29975
|
clearTimeout(timer);
|
|
30052
29976
|
};
|
|
30053
|
-
}, [
|
|
29977
|
+
}, [name2, settings.binary]);
|
|
30054
29978
|
const save = () => {
|
|
30055
29979
|
setSaving(true);
|
|
30056
29980
|
setNotice(null);
|
|
30057
29981
|
writeAgentConfig(config).then(() => {
|
|
30058
29982
|
applyBinaryOverrides(config);
|
|
30059
|
-
record3(`saved ${
|
|
30060
|
-
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[
|
|
29983
|
+
record3(`saved ${name2}`);
|
|
29984
|
+
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name2]} settings are written to config.json` });
|
|
30061
29985
|
}).catch((err) => {
|
|
30062
|
-
record3(`saving ${
|
|
29986
|
+
record3(`saving ${name2} failed`, err);
|
|
30063
29987
|
setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` });
|
|
30064
29988
|
}).finally(() => setSaving(false));
|
|
30065
29989
|
};
|
|
30066
29990
|
const runTest = () => {
|
|
30067
29991
|
setTesting(true);
|
|
30068
29992
|
setNotice(null);
|
|
30069
|
-
testAgent(
|
|
29993
|
+
testAgent(name2, settings.binary, settings.model).then((result) => {
|
|
30070
29994
|
setChecks(result);
|
|
30071
29995
|
const outcome = testOutcome(result);
|
|
30072
29996
|
if (!outcome || !outcome.ok)
|
|
30073
|
-
record3(`test of ${
|
|
29997
|
+
record3(`test of ${name2} failed: ${outcome?.text ?? "the agent could not be started"}`);
|
|
30074
29998
|
setNotice(
|
|
30075
29999
|
outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
|
|
30076
30000
|
);
|
|
30077
30001
|
}).catch((err) => {
|
|
30078
|
-
record3(`test of ${
|
|
30002
|
+
record3(`test of ${name2} could not run`, err);
|
|
30079
30003
|
setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` });
|
|
30080
30004
|
}).finally(() => setTesting(false));
|
|
30081
30005
|
};
|
|
@@ -30086,19 +30010,19 @@ function AgentDetail({
|
|
|
30086
30010
|
hint: "run test",
|
|
30087
30011
|
onRun: runTest
|
|
30088
30012
|
};
|
|
30089
|
-
const formFields = fields(
|
|
30013
|
+
const formFields = fields(name2);
|
|
30090
30014
|
const labelWidth = formLabelWidth([...formFields, action]);
|
|
30091
30015
|
return /* @__PURE__ */ jsx60(
|
|
30092
30016
|
FieldForm,
|
|
30093
30017
|
{
|
|
30094
|
-
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[
|
|
30095
|
-
subtitle: config.defaultAgent ===
|
|
30018
|
+
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[name2]}`,
|
|
30019
|
+
subtitle: config.defaultAgent === name2 ? "This is the default agent." : `Runs the \`${AGENT_BINARIES[name2]}\` command.`,
|
|
30096
30020
|
fields: formFields,
|
|
30097
30021
|
values: { binary: settings.binary, model: settings.model },
|
|
30098
30022
|
onChange: (key, value) => {
|
|
30099
|
-
setConfig({ ...config, agents: { ...config.agents, [
|
|
30023
|
+
setConfig({ ...config, agents: { ...config.agents, [name2]: { ...settings, [key]: value } } });
|
|
30100
30024
|
setNotice(null);
|
|
30101
|
-
record3(`edited ${
|
|
30025
|
+
record3(`edited ${name2}.${key}`);
|
|
30102
30026
|
},
|
|
30103
30027
|
onSave: save,
|
|
30104
30028
|
onQuit: onBack,
|
|
@@ -30107,7 +30031,7 @@ function AgentDetail({
|
|
|
30107
30031
|
busy: saving || testing,
|
|
30108
30032
|
children: /* @__PURE__ */ jsxs48(Box48, { flexDirection: "column", marginTop: 1, children: [
|
|
30109
30033
|
/* @__PURE__ */ jsx60(StatusHeading, {}),
|
|
30110
|
-
statusRows(
|
|
30034
|
+
statusRows(name2, checks, settings.binary).map((row) => /* @__PURE__ */ jsx60(FormReadOnlyRow, { label: row.label, labelWidth, children: /* @__PURE__ */ jsx60(Text50, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label))
|
|
30111
30035
|
] })
|
|
30112
30036
|
}
|
|
30113
30037
|
);
|
|
@@ -30132,9 +30056,9 @@ function AgentsScreen({ onDone }) {
|
|
|
30132
30056
|
error: ""
|
|
30133
30057
|
}).current;
|
|
30134
30058
|
const inspectAll = (loaded) => {
|
|
30135
|
-
for (const
|
|
30136
|
-
void inspectAgent(
|
|
30137
|
-
(result) => setChecks((previous) => ({ ...previous, [
|
|
30059
|
+
for (const name2 of AGENT_NAMES) {
|
|
30060
|
+
void inspectAgent(name2, loaded.agents[name2].binary).then(
|
|
30061
|
+
(result) => setChecks((previous) => ({ ...previous, [name2]: result }))
|
|
30138
30062
|
);
|
|
30139
30063
|
}
|
|
30140
30064
|
};
|
|
@@ -30174,21 +30098,21 @@ function AgentsScreen({ onDone }) {
|
|
|
30174
30098
|
exitMethod: change.changed ? "saved" : "discarded"
|
|
30175
30099
|
});
|
|
30176
30100
|
};
|
|
30177
|
-
const makeDefault = (
|
|
30101
|
+
const makeDefault = (name2) => {
|
|
30178
30102
|
if (!config || saving) return;
|
|
30179
|
-
if (
|
|
30180
|
-
setNotice({ kind: "success", text: `${AGENT_LABELS[
|
|
30103
|
+
if (name2 === config.defaultAgent) {
|
|
30104
|
+
setNotice({ kind: "success", text: `${AGENT_LABELS[name2]} is already the default agent` });
|
|
30181
30105
|
return;
|
|
30182
30106
|
}
|
|
30183
30107
|
setSaving(true);
|
|
30184
30108
|
setNotice(null);
|
|
30185
|
-
writeAgentConfig({ ...config, defaultAgent:
|
|
30186
|
-
setConfig((current) => current ? { ...current, defaultAgent:
|
|
30187
|
-
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[
|
|
30188
|
-
visit.trail.record(`made ${
|
|
30109
|
+
writeAgentConfig({ ...config, defaultAgent: name2, defaultChosen: true }).then(() => {
|
|
30110
|
+
setConfig((current) => current ? { ...current, defaultAgent: name2, defaultChosen: true } : current);
|
|
30111
|
+
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name2]}` });
|
|
30112
|
+
visit.trail.record(`made ${name2} the default`);
|
|
30189
30113
|
}).catch((err) => {
|
|
30190
30114
|
visit.error = scrubError(err, []);
|
|
30191
|
-
visit.trail.record(`making ${
|
|
30115
|
+
visit.trail.record(`making ${name2} the default failed`);
|
|
30192
30116
|
setNotice({ kind: "error", text: `Default agent not changed: ${visit.error}` });
|
|
30193
30117
|
}).finally(() => setSaving(false));
|
|
30194
30118
|
};
|
|
@@ -30275,14 +30199,14 @@ function AgentsScreen({ onDone }) {
|
|
|
30275
30199
|
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "AGENT" }) }),
|
|
30276
30200
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "STATUS" })
|
|
30277
30201
|
] }),
|
|
30278
|
-
AGENT_NAMES.map((
|
|
30279
|
-
const isFocused = focusedAgent ===
|
|
30202
|
+
AGENT_NAMES.map((name2) => {
|
|
30203
|
+
const isFocused = focusedAgent === name2;
|
|
30280
30204
|
return /* @__PURE__ */ jsxs49(Box49, { gap: 1, children: [
|
|
30281
30205
|
/* @__PURE__ */ jsx61(Text51, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " }),
|
|
30282
|
-
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children:
|
|
30283
|
-
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[
|
|
30284
|
-
/* @__PURE__ */ jsx61(AgentStatusBadge, { name, checks: checks[
|
|
30285
|
-
] },
|
|
30206
|
+
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children: name2 === config.defaultAgent ? "\u2605" : " " }),
|
|
30207
|
+
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[name2] }) }),
|
|
30208
|
+
/* @__PURE__ */ jsx61(AgentStatusBadge, { name: name2, checks: checks[name2], binary: config.agents[name2].binary })
|
|
30209
|
+
] }, name2);
|
|
30286
30210
|
}),
|
|
30287
30211
|
/* @__PURE__ */ jsxs49(Box49, { flexDirection: "column", marginTop: 1, children: [
|
|
30288
30212
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: `\u2500 ${AGENT_LABELS[focusedAgent]} ${"\u2500".repeat(30)}` }),
|