@contentful/experience-design-system-cli 2.40.1-dev-build-1691fb91.0 → 2.40.1-dev-build-0aff4b7e.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 +588 -600
- package/dist/index.js +588 -637
- 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 name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
// packages/experience-design-system-cli/src/tui/package-root.ts
|
|
@@ -165,7 +165,7 @@ async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
|
165
165
|
const contentfulDir = join4(base, ".contentful");
|
|
166
166
|
const result = { logs: 0, folders: 0 };
|
|
167
167
|
try {
|
|
168
|
-
const sessions = (await readdir(contentfulDir)).filter((
|
|
168
|
+
const sessions = (await readdir(contentfulDir)).filter((name) => SESSION_FOLDER.test(name));
|
|
169
169
|
for (const session of sessions) {
|
|
170
170
|
const files = await logFilesIn(join4(contentfulDir, session, "debug")).catch(() => []);
|
|
171
171
|
for (const file of files) {
|
|
@@ -721,8 +721,8 @@ var init_extract_sentinel_output = __esm({
|
|
|
721
721
|
});
|
|
722
722
|
|
|
723
723
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/format-generate-progress-line.js
|
|
724
|
-
function formatGenerateProgressLine(done, total,
|
|
725
|
-
return `progress=generate:${done}/${total}:${
|
|
724
|
+
function formatGenerateProgressLine(done, total, name) {
|
|
725
|
+
return `progress=generate:${done}/${total}:${name}`;
|
|
726
726
|
}
|
|
727
727
|
var init_format_generate_progress_line = __esm({
|
|
728
728
|
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/format-generate-progress-line.js"() {
|
|
@@ -1408,14 +1408,14 @@ function formatToolCall(obj) {
|
|
|
1408
1408
|
return ` ${ansi.cyan("\u25C8")} ${slot}${req} ${ansi.dim(desc)}`;
|
|
1409
1409
|
}
|
|
1410
1410
|
case "select_component": {
|
|
1411
|
-
const
|
|
1411
|
+
const name = String(obj["name"] ?? "");
|
|
1412
1412
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1413
|
-
return ` ${ansi.green("+")} ${
|
|
1413
|
+
return ` ${ansi.green("+")} ${name} ${ansi.dim(reason)}`;
|
|
1414
1414
|
}
|
|
1415
1415
|
case "reject_component": {
|
|
1416
|
-
const
|
|
1416
|
+
const name = String(obj["name"] ?? "");
|
|
1417
1417
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1418
|
-
return ` ${ansi.dim("\u2013")} ${
|
|
1418
|
+
return ` ${ansi.dim("\u2013")} ${name} ${ansi.dim(reason)}`;
|
|
1419
1419
|
}
|
|
1420
1420
|
default:
|
|
1421
1421
|
return null;
|
|
@@ -3573,17 +3573,17 @@ var TRUNCATED_MARKER = "/* truncated */";
|
|
|
3573
3573
|
function escapeForRegExp(value) {
|
|
3574
3574
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3575
3575
|
}
|
|
3576
|
-
function identifierPattern(
|
|
3577
|
-
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(
|
|
3576
|
+
function identifierPattern(name) {
|
|
3577
|
+
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(name)}(?![A-Za-z0-9_$])`);
|
|
3578
3578
|
}
|
|
3579
3579
|
function excerptAroundNames(text, names, maxChars, contextLines = 6) {
|
|
3580
3580
|
if (text.length <= maxChars)
|
|
3581
3581
|
return { content: text, usesNotShown: [] };
|
|
3582
|
-
const patterns = names.filter((
|
|
3582
|
+
const patterns = names.filter((name) => name.length > 0).map((name) => ({ name, pattern: identifierPattern(name) }));
|
|
3583
3583
|
const lines = text.split("\n");
|
|
3584
3584
|
const windows = [];
|
|
3585
3585
|
lines.forEach((line, index) => {
|
|
3586
|
-
const mentioned = patterns.filter(({ pattern }) => pattern.test(line)).map(({ name
|
|
3586
|
+
const mentioned = patterns.filter(({ pattern }) => pattern.test(line)).map(({ name }) => name);
|
|
3587
3587
|
if (mentioned.length === 0)
|
|
3588
3588
|
return;
|
|
3589
3589
|
const start = Math.max(0, index - contextLines);
|
|
@@ -3591,8 +3591,8 @@ function excerptAroundNames(text, names, maxChars, contextLines = 6) {
|
|
|
3591
3591
|
const last = windows[windows.length - 1];
|
|
3592
3592
|
if (last && start <= last.end + 1) {
|
|
3593
3593
|
last.end = Math.max(last.end, end);
|
|
3594
|
-
for (const
|
|
3595
|
-
last.names.add(
|
|
3594
|
+
for (const name of mentioned)
|
|
3595
|
+
last.names.add(name);
|
|
3596
3596
|
} else {
|
|
3597
3597
|
windows.push({ start, end, names: new Set(mentioned) });
|
|
3598
3598
|
}
|
|
@@ -3603,8 +3603,8 @@ ${TRUNCATED_MARKER}`, usesNotShown: [] };
|
|
|
3603
3603
|
}
|
|
3604
3604
|
const lastWindowFor = /* @__PURE__ */ new Map();
|
|
3605
3605
|
for (const window of windows)
|
|
3606
|
-
for (const
|
|
3607
|
-
lastWindowFor.set(
|
|
3606
|
+
for (const name of window.names)
|
|
3607
|
+
lastWindowFor.set(name, window);
|
|
3608
3608
|
const kept = [];
|
|
3609
3609
|
const cut = /* @__PURE__ */ new Set();
|
|
3610
3610
|
let used = 0;
|
|
@@ -3618,15 +3618,15 @@ ${ELLIPSIS_MARKER}
|
|
|
3618
3618
|
const head = chunk.slice(0, maxChars);
|
|
3619
3619
|
kept.push({ window, text: head });
|
|
3620
3620
|
used += head.length;
|
|
3621
|
-
for (const
|
|
3622
|
-
if (lastWindowFor.get(
|
|
3623
|
-
cut.add(
|
|
3621
|
+
for (const name of window.names) {
|
|
3622
|
+
if (lastWindowFor.get(name) === window && !identifierPattern(name).test(head))
|
|
3623
|
+
cut.add(name);
|
|
3624
3624
|
}
|
|
3625
3625
|
continue;
|
|
3626
3626
|
}
|
|
3627
|
-
for (const
|
|
3628
|
-
if (lastWindowFor.get(
|
|
3629
|
-
cut.add(
|
|
3627
|
+
for (const name of window.names) {
|
|
3628
|
+
if (lastWindowFor.get(name) === window)
|
|
3629
|
+
cut.add(name);
|
|
3630
3630
|
}
|
|
3631
3631
|
continue;
|
|
3632
3632
|
}
|
|
@@ -3637,15 +3637,15 @@ ${ELLIPSIS_MARKER}
|
|
|
3637
3637
|
const parts = kept.map((entry, index) => (index > 0 ? `
|
|
3638
3638
|
${ELLIPSIS_MARKER}
|
|
3639
3639
|
` : "") + entry.text);
|
|
3640
|
-
const usesNotShown = names.filter((
|
|
3640
|
+
const usesNotShown = names.filter((name, index) => cut.has(name) && names.indexOf(name) === index);
|
|
3641
3641
|
return { content: `${parts.join("")}
|
|
3642
3642
|
${TRUNCATED_MARKER}`, usesNotShown };
|
|
3643
3643
|
}
|
|
3644
3644
|
|
|
3645
3645
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/components/derive-component-id.js
|
|
3646
3646
|
import { createHash } from "node:crypto";
|
|
3647
|
-
function deriveComponentId(
|
|
3648
|
-
return createHash("sha256").update(`${
|
|
3647
|
+
function deriveComponentId(name, source) {
|
|
3648
|
+
return createHash("sha256").update(`${name}:${source}`).digest("hex").slice(0, 12);
|
|
3649
3649
|
}
|
|
3650
3650
|
|
|
3651
3651
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cdf/cdf-mappers.js
|
|
@@ -3713,8 +3713,8 @@ function getLatestCompletedSessionForCommand(db, command) {
|
|
|
3713
3713
|
}
|
|
3714
3714
|
|
|
3715
3715
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/write.js
|
|
3716
|
-
function createSession(db, id,
|
|
3717
|
-
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id,
|
|
3716
|
+
function createSession(db, id, name, timestamp) {
|
|
3717
|
+
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id, name, timestamp, timestamp);
|
|
3718
3718
|
}
|
|
3719
3719
|
function updateSessionTimestamp(db, sessionId, timestamp) {
|
|
3720
3720
|
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(timestamp, sessionId);
|
|
@@ -4996,7 +4996,7 @@ function identifiersIn(propTypes) {
|
|
|
4996
4996
|
return [...names];
|
|
4997
4997
|
}
|
|
4998
4998
|
function declaresAnyType(text, typeNames) {
|
|
4999
|
-
return typeNames.some((
|
|
4999
|
+
return typeNames.some((name) => new RegExp(`\\b(?:type|interface|enum|const|class)\\s+${escapeForRegExp(name)}\\b`).test(text));
|
|
5000
5000
|
}
|
|
5001
5001
|
function extractRelativeImportPaths(sourceText) {
|
|
5002
5002
|
const specifiers = /* @__PURE__ */ new Set();
|
|
@@ -5061,7 +5061,7 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
5061
5061
|
frontier = nextFrontier;
|
|
5062
5062
|
}
|
|
5063
5063
|
const inHand = [sourceText, ...discovered.map((d) => d.content)];
|
|
5064
|
-
const declaredTypeNames = candidateTypeNames.filter((
|
|
5064
|
+
const declaredTypeNames = candidateTypeNames.filter((name) => inHand.some((text) => declaresAnyType(text, [name])));
|
|
5065
5065
|
const usesNotShown = /* @__PURE__ */ new Set();
|
|
5066
5066
|
const searchNames = [.../* @__PURE__ */ new Set([...propNames, ...declaredTypeNames])];
|
|
5067
5067
|
let enlarged = 0;
|
|
@@ -5071,19 +5071,19 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
5071
5071
|
enlarged++;
|
|
5072
5072
|
const budget = enlarge ? MAX_TYPE_DECLARING_SIBLING_CHARS : MAX_SIBLING_SNIPPET_CHARS;
|
|
5073
5073
|
const excerpt = excerptAroundNames(d.content, searchNames, budget);
|
|
5074
|
-
for (const
|
|
5075
|
-
usesNotShown.add(
|
|
5074
|
+
for (const name of excerpt.usesNotShown)
|
|
5075
|
+
usesNotShown.add(name);
|
|
5076
5076
|
return { path: d.path, content: excerpt.content };
|
|
5077
5077
|
});
|
|
5078
5078
|
const truncatedCount = Math.max(0, discovered.length - MAX_SIBLING_FILES);
|
|
5079
5079
|
return {
|
|
5080
5080
|
siblings,
|
|
5081
5081
|
truncatedCount,
|
|
5082
|
-
usesNotShown: propNames.filter((
|
|
5082
|
+
usesNotShown: propNames.filter((name) => usesNotShown.has(name)),
|
|
5083
5083
|
declaredTypeNames
|
|
5084
5084
|
};
|
|
5085
5085
|
}
|
|
5086
|
-
async function loadComponentSourceRef(
|
|
5086
|
+
async function loadComponentSourceRef(name, sourcePath, propNames = [], propTypes = []) {
|
|
5087
5087
|
let content = null;
|
|
5088
5088
|
let siblingFiles = [];
|
|
5089
5089
|
let truncatedSiblingCount = 0;
|
|
@@ -5100,18 +5100,18 @@ async function loadComponentSourceRef(name2, sourcePath, propNames = [], propTyp
|
|
|
5100
5100
|
} = await loadSiblingFiles(rawText, sourcePath, propNames, identifiersIn(propTypes)));
|
|
5101
5101
|
const mainExcerpt = excerptAroundNames(rawText, [.../* @__PURE__ */ new Set([...propNames, ...declaredTypeNames])], MAX_COMPONENT_SOURCE_CHARS);
|
|
5102
5102
|
content = mainExcerpt.content;
|
|
5103
|
-
for (const
|
|
5104
|
-
usesNotShown.add(
|
|
5105
|
-
for (const
|
|
5106
|
-
usesNotShown.add(
|
|
5103
|
+
for (const name2 of mainExcerpt.usesNotShown)
|
|
5104
|
+
usesNotShown.add(name2);
|
|
5105
|
+
for (const name2 of siblingUsesNotShown)
|
|
5106
|
+
usesNotShown.add(name2);
|
|
5107
5107
|
} catch {
|
|
5108
5108
|
}
|
|
5109
|
-
const ref = { component:
|
|
5109
|
+
const ref = { component: name, sourcePath, content };
|
|
5110
5110
|
if (siblingFiles.length > 0)
|
|
5111
5111
|
ref.siblingFiles = siblingFiles;
|
|
5112
5112
|
if (truncatedSiblingCount > 0)
|
|
5113
5113
|
ref.truncatedSiblingCount = truncatedSiblingCount;
|
|
5114
|
-
const notShown = propNames.filter((
|
|
5114
|
+
const notShown = propNames.filter((name2) => usesNotShown.has(name2));
|
|
5115
5115
|
if (notShown.length > 0)
|
|
5116
5116
|
ref.usesNotShown = notShown;
|
|
5117
5117
|
return ref;
|
|
@@ -5264,7 +5264,7 @@ function loadCDFComponents(db, sessionId) {
|
|
|
5264
5264
|
const allowedComponentsBySlot = indexRowsByKey(allowedComponents, (ac) => `${ac.component_id}::${ac.slot_name}`);
|
|
5265
5265
|
const tokenPathsByProp = indexRowsByKey(tokenPaths, (t) => `${t.component_id}::${t.prop_name}`);
|
|
5266
5266
|
const toTokenPaths = (rows) => rows === void 0 ? void 0 : rows.map((r) => r.path);
|
|
5267
|
-
return components.map(({ component_id, name
|
|
5267
|
+
return components.map(({ component_id, name, description }) => {
|
|
5268
5268
|
const compProps = propsByComponent.get(component_id) ?? [];
|
|
5269
5269
|
const $properties = {};
|
|
5270
5270
|
for (const p of compProps) {
|
|
@@ -5321,7 +5321,7 @@ function loadCDFComponents(db, sessionId) {
|
|
|
5321
5321
|
entry.$description = description;
|
|
5322
5322
|
if (Object.keys($slots).length > 0)
|
|
5323
5323
|
entry.$slots = $slots;
|
|
5324
|
-
return { key:
|
|
5324
|
+
return { key: name, entry };
|
|
5325
5325
|
});
|
|
5326
5326
|
}
|
|
5327
5327
|
function loadScopeComponents(db, sessionId) {
|
|
@@ -5910,29 +5910,29 @@ function extractTsxComponents(filePaths, componentFilePattern, extract) {
|
|
|
5910
5910
|
}
|
|
5911
5911
|
function resolveDefaultExportName(declarations, exported, allowVariableDeclaration = false) {
|
|
5912
5912
|
const declaration = declarations[0];
|
|
5913
|
-
const
|
|
5914
|
-
if (!
|
|
5913
|
+
const name = Node.isFunctionDeclaration(declaration) ? declaration.getName() : allowVariableDeclaration && Node.isVariableDeclaration(declaration) ? declaration.getName() : void 0;
|
|
5914
|
+
if (!name || !/^[A-Z]/.test(name) || exported.has(name))
|
|
5915
5915
|
return void 0;
|
|
5916
|
-
return
|
|
5916
|
+
return name;
|
|
5917
5917
|
}
|
|
5918
5918
|
function getRenderableExports(sourceFile, exclusions, options) {
|
|
5919
5919
|
const renderable = [];
|
|
5920
5920
|
const exported = sourceFile.getExportedDeclarations();
|
|
5921
5921
|
for (const [exportKey, declarations] of exported) {
|
|
5922
|
-
const
|
|
5923
|
-
if (!
|
|
5922
|
+
const name = exportKey === "default" ? resolveDefaultExportName(declarations, exported, options.allowVariableDeclaration) : exportKey;
|
|
5923
|
+
if (!name || !/^[A-Z]/.test(name))
|
|
5924
5924
|
continue;
|
|
5925
|
-
if (
|
|
5925
|
+
if (name.startsWith("use")) {
|
|
5926
5926
|
exclusions.push({
|
|
5927
5927
|
itemType: "component",
|
|
5928
|
-
name
|
|
5928
|
+
name,
|
|
5929
5929
|
source: sourceFile.getFilePath(),
|
|
5930
5930
|
reason: options.hookReason,
|
|
5931
5931
|
stage: "component-filter"
|
|
5932
5932
|
});
|
|
5933
5933
|
continue;
|
|
5934
5934
|
}
|
|
5935
|
-
renderable.push({ name
|
|
5935
|
+
renderable.push({ name, declarations });
|
|
5936
5936
|
}
|
|
5937
5937
|
return renderable;
|
|
5938
5938
|
}
|
|
@@ -6315,7 +6315,7 @@ function extractProps(classDecl) {
|
|
|
6315
6315
|
for (const property of classDecl.getProperties()) {
|
|
6316
6316
|
if (!hasDecorator(property, "Prop"))
|
|
6317
6317
|
continue;
|
|
6318
|
-
const
|
|
6318
|
+
const name = property.getName();
|
|
6319
6319
|
const typeNode = property.getTypeNode();
|
|
6320
6320
|
const typeText = typeNode ? typeNode.getText() : "unknown";
|
|
6321
6321
|
const hasQuestionToken = property.hasQuestionToken();
|
|
@@ -6353,21 +6353,21 @@ function extractProps(classDecl) {
|
|
|
6353
6353
|
}
|
|
6354
6354
|
const allowedValues = extractAllowedValues2(typeText);
|
|
6355
6355
|
props.push({
|
|
6356
|
-
name
|
|
6356
|
+
name,
|
|
6357
6357
|
type: typeText,
|
|
6358
6358
|
required: isRequired,
|
|
6359
6359
|
...defaultValue !== void 0 && { defaultValue },
|
|
6360
6360
|
...description && { description },
|
|
6361
6361
|
...allowedValues && { allowedValues },
|
|
6362
|
-
...intrinsicDomAttributeProps.has(
|
|
6362
|
+
...intrinsicDomAttributeProps.has(name) && { domAttribute: true },
|
|
6363
6363
|
sourceStartLine: property.getStartLineNumber(),
|
|
6364
6364
|
sourceEndLine: property.getEndLineNumber()
|
|
6365
6365
|
});
|
|
6366
6366
|
}
|
|
6367
6367
|
return props.sort((a, b) => a.name.localeCompare(b.name));
|
|
6368
6368
|
}
|
|
6369
|
-
function normalizeSlotName(
|
|
6370
|
-
const normalizedName =
|
|
6369
|
+
function normalizeSlotName(name) {
|
|
6370
|
+
const normalizedName = name && name.length > 0 ? name : "default";
|
|
6371
6371
|
return {
|
|
6372
6372
|
name: normalizedName,
|
|
6373
6373
|
isDefault: normalizedName === "default"
|
|
@@ -6437,9 +6437,9 @@ function extractSlots(classDecl, warnings, componentName) {
|
|
|
6437
6437
|
if (tagName === "slot") {
|
|
6438
6438
|
const nameAttribute = openingElement.getAttributes().find((attribute) => Node2.isJsxAttribute(attribute) && attribute.getNameNode().getText() === "name");
|
|
6439
6439
|
const initializer2 = Node2.isJsxAttribute(nameAttribute) ? nameAttribute.getInitializer() : void 0;
|
|
6440
|
-
const
|
|
6440
|
+
const name2 = initializer2 && Node2.isStringLiteral(initializer2) ? initializer2.getLiteralValue() : initializer2 && Node2.isJsxExpression(initializer2) ? initializer2.getExpression()?.getText() ?? "" : "";
|
|
6441
6441
|
upsertSlot({
|
|
6442
|
-
...normalizeSlotName(
|
|
6442
|
+
...normalizeSlotName(name2)
|
|
6443
6443
|
});
|
|
6444
6444
|
return;
|
|
6445
6445
|
}
|
|
@@ -6448,11 +6448,11 @@ function extractSlots(classDecl, warnings, componentName) {
|
|
|
6448
6448
|
const initializer = slotAttribute.getInitializer();
|
|
6449
6449
|
if (!initializer || !Node2.isStringLiteral(initializer))
|
|
6450
6450
|
return;
|
|
6451
|
-
const
|
|
6452
|
-
if (!
|
|
6451
|
+
const name = initializer.getLiteralValue();
|
|
6452
|
+
if (!name)
|
|
6453
6453
|
return;
|
|
6454
6454
|
upsertSlot({
|
|
6455
|
-
name
|
|
6455
|
+
name,
|
|
6456
6456
|
isDefault: false
|
|
6457
6457
|
});
|
|
6458
6458
|
});
|
|
@@ -6474,15 +6474,15 @@ function extractFromSourceFile(sourceFile, warnings) {
|
|
|
6474
6474
|
const tag = getComponentTag(classDecl);
|
|
6475
6475
|
if (!tag)
|
|
6476
6476
|
continue;
|
|
6477
|
-
const
|
|
6477
|
+
const name = kebabToPascal(tag);
|
|
6478
6478
|
const props = extractProps(classDecl);
|
|
6479
|
-
const slots = extractSlots(classDecl, warnings,
|
|
6479
|
+
const slots = extractSlots(classDecl, warnings, name);
|
|
6480
6480
|
const eventNames = detectEvents(classDecl);
|
|
6481
6481
|
if (eventNames.length > 0) {
|
|
6482
|
-
warnings.push(`Component ${
|
|
6482
|
+
warnings.push(`Component ${name} has ${eventNames.length} events not captured: ${eventNames.join(", ")}`);
|
|
6483
6483
|
}
|
|
6484
6484
|
components.push({
|
|
6485
|
-
name
|
|
6485
|
+
name,
|
|
6486
6486
|
source: sourceFile.getFilePath(),
|
|
6487
6487
|
sourcePath: sourceFile.getFilePath(),
|
|
6488
6488
|
framework: "stencil",
|
|
@@ -6634,9 +6634,9 @@ function extractAllowedComponentsFromJsdoc(jsdocText, componentNames) {
|
|
|
6634
6634
|
return [];
|
|
6635
6635
|
const found = /* @__PURE__ */ new Set();
|
|
6636
6636
|
for (const raw of m[1].split(",")) {
|
|
6637
|
-
const
|
|
6638
|
-
if (
|
|
6639
|
-
found.add(
|
|
6637
|
+
const name = raw.trim();
|
|
6638
|
+
if (name && componentNames.has(name))
|
|
6639
|
+
found.add(name);
|
|
6640
6640
|
}
|
|
6641
6641
|
return [...found].sort();
|
|
6642
6642
|
}
|
|
@@ -6671,8 +6671,8 @@ function collectTypePredicateComponentReferences(sourceFile, ctx) {
|
|
|
6671
6671
|
const assertedTypeNode = returnTypeNode.getTypeNode();
|
|
6672
6672
|
if (!assertedTypeNode)
|
|
6673
6673
|
continue;
|
|
6674
|
-
for (const
|
|
6675
|
-
found.add(
|
|
6674
|
+
for (const name of extractAllowedComponentsFromTypeText(assertedTypeNode.getText(), ctx)) {
|
|
6675
|
+
found.add(name);
|
|
6676
6676
|
}
|
|
6677
6677
|
}
|
|
6678
6678
|
return [...found].sort();
|
|
@@ -6691,13 +6691,13 @@ function collectRuntimeTypeCheckComponentReferences(sourceFile, componentNames)
|
|
|
6691
6691
|
return void 0;
|
|
6692
6692
|
if (!Node3.isIdentifier(otherSide) && !Node3.isPropertyAccessExpression(otherSide))
|
|
6693
6693
|
return void 0;
|
|
6694
|
-
const
|
|
6695
|
-
if (!
|
|
6694
|
+
const name = otherSide.getText().split(".").pop();
|
|
6695
|
+
if (!name || !componentNames.has(name))
|
|
6696
6696
|
return void 0;
|
|
6697
6697
|
const baseIdentifier = Node3.isPropertyAccessExpression(otherSide) ? otherSide.getExpression() : otherSide;
|
|
6698
6698
|
if (!Node3.isIdentifier(baseIdentifier) || !localBindings.has(baseIdentifier.getText()))
|
|
6699
6699
|
return void 0;
|
|
6700
|
-
return
|
|
6700
|
+
return name;
|
|
6701
6701
|
};
|
|
6702
6702
|
const match2 = candidateFromTypeAccess(left, right) ?? candidateFromTypeAccess(right, left);
|
|
6703
6703
|
if (match2)
|
|
@@ -6749,8 +6749,8 @@ function collectArrayMapRenderComponentReferences(funcNode, componentNames, ownC
|
|
|
6749
6749
|
const found = /* @__PURE__ */ new Set();
|
|
6750
6750
|
const propNames = new Set(propTypesByName.keys());
|
|
6751
6751
|
const renderCountByComponent = /* @__PURE__ */ new Map();
|
|
6752
|
-
const bumpRenderCount = (
|
|
6753
|
-
renderCountByComponent.set(
|
|
6752
|
+
const bumpRenderCount = (name) => {
|
|
6753
|
+
renderCountByComponent.set(name, (renderCountByComponent.get(name) ?? 0) + 1);
|
|
6754
6754
|
};
|
|
6755
6755
|
for (const jsxElement of [
|
|
6756
6756
|
...funcNode.getDescendantsOfKind(SyntaxKind3.JsxSelfClosingElement),
|
|
@@ -7078,7 +7078,7 @@ function sourceFileUsesCreateContext(sourceFile) {
|
|
|
7078
7078
|
function isNextJsComponent(filePath, exportedNames) {
|
|
7079
7079
|
const normalized = filePath.replace(/\\/g, "/");
|
|
7080
7080
|
const isAppRouterFile = /\/app\/.*\/(page|layout)\.[jt]sx?$/.test(normalized);
|
|
7081
|
-
const hasNextExports = exportedNames.some((
|
|
7081
|
+
const hasNextExports = exportedNames.some((name) => name === "generateMetadata" || name === "generateStaticParams");
|
|
7082
7082
|
return isAppRouterFile || hasNextExports;
|
|
7083
7083
|
}
|
|
7084
7084
|
function isRepoLocalTransparentPolymorphicWrapperDeclaration(declaration, typeName) {
|
|
@@ -7260,8 +7260,8 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
7260
7260
|
const props = [];
|
|
7261
7261
|
let hasChildren = false;
|
|
7262
7262
|
for (const property of type.getProperties()) {
|
|
7263
|
-
const
|
|
7264
|
-
if (
|
|
7263
|
+
const name = property.getName();
|
|
7264
|
+
if (name === "children") {
|
|
7265
7265
|
if (suppressNeverChildrenSlot) {
|
|
7266
7266
|
const declaration2 = property.getValueDeclaration() ?? property.getDeclarations()[0];
|
|
7267
7267
|
if (declaration2 && property.getTypeAtLocation(declaration2).isNever()) {
|
|
@@ -7271,7 +7271,7 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
7271
7271
|
hasChildren = true;
|
|
7272
7272
|
continue;
|
|
7273
7273
|
}
|
|
7274
|
-
if (slotNames.has(
|
|
7274
|
+
if (slotNames.has(name))
|
|
7275
7275
|
continue;
|
|
7276
7276
|
const declaration = property.getValueDeclaration() ?? property.getDeclarations()[0];
|
|
7277
7277
|
if (!declaration)
|
|
@@ -7282,7 +7282,7 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
7282
7282
|
const required = !property.isOptional();
|
|
7283
7283
|
const allowedValues = extractAllowedValues(propType);
|
|
7284
7284
|
props.push({
|
|
7285
|
-
name
|
|
7285
|
+
name,
|
|
7286
7286
|
type: typeText,
|
|
7287
7287
|
required,
|
|
7288
7288
|
...allowedValues && { allowedValues },
|
|
@@ -7313,19 +7313,19 @@ function extractPropsFromInterfaceDeclaration(declaration, slotNames, seen, excl
|
|
|
7313
7313
|
return acc;
|
|
7314
7314
|
const propType = symbol.getTypeAtLocation(decl);
|
|
7315
7315
|
const typeText = propType.isAny() ? ("getTypeNode" in decl && typeof decl.getTypeNode === "function" ? decl.getTypeNode()?.getText() : void 0) ?? propType.getText(decl) : propType.getText(decl);
|
|
7316
|
-
const
|
|
7317
|
-
if (
|
|
7316
|
+
const name = symbol.getName();
|
|
7317
|
+
if (name === "children") {
|
|
7318
7318
|
if (suppressNeverChildrenSlot && propType.isNever())
|
|
7319
7319
|
return acc;
|
|
7320
7320
|
acc.hasChildren = true;
|
|
7321
7321
|
return acc;
|
|
7322
7322
|
}
|
|
7323
|
-
if (slotNames.has(
|
|
7323
|
+
if (slotNames.has(name))
|
|
7324
7324
|
return acc;
|
|
7325
7325
|
const required = !symbol.isOptional();
|
|
7326
7326
|
const allowedValues = extractAllowedValues(propType);
|
|
7327
7327
|
acc.props.push({
|
|
7328
|
-
name
|
|
7328
|
+
name,
|
|
7329
7329
|
type: typeText,
|
|
7330
7330
|
required,
|
|
7331
7331
|
...allowedValues && { allowedValues },
|
|
@@ -7658,7 +7658,7 @@ function collectReboundDeclarations(body) {
|
|
|
7658
7658
|
function collectPropDataflow(func, param, availablePropNames) {
|
|
7659
7659
|
const valueAliases = /* @__PURE__ */ new Map();
|
|
7660
7660
|
const objectAliases = /* @__PURE__ */ new Map();
|
|
7661
|
-
const fullPropsShape = new Map([...availablePropNames].map((
|
|
7661
|
+
const fullPropsShape = new Map([...availablePropNames].map((name) => [name, name]));
|
|
7662
7662
|
const belongsToComponentFunction = (node) => node.getFirstAncestor((ancestor) => Node4.isFunctionDeclaration(ancestor) || Node4.isArrowFunction(ancestor) || Node4.isFunctionExpression(ancestor)) === func;
|
|
7663
7663
|
const resolveValue = (expression) => {
|
|
7664
7664
|
if (!expression)
|
|
@@ -7852,12 +7852,12 @@ function extractSlots2(type, hasChildren) {
|
|
|
7852
7852
|
slots.push({ name: "children", isDefault: true });
|
|
7853
7853
|
}
|
|
7854
7854
|
for (const property of type.getProperties()) {
|
|
7855
|
-
const
|
|
7856
|
-
if (
|
|
7855
|
+
const name = property.getName();
|
|
7856
|
+
if (name === "children")
|
|
7857
7857
|
continue;
|
|
7858
7858
|
if (!getRenderPropType(property))
|
|
7859
7859
|
continue;
|
|
7860
|
-
const slotName =
|
|
7860
|
+
const slotName = name.replace(/^render/, "");
|
|
7861
7861
|
slots.push({
|
|
7862
7862
|
name: slotName.charAt(0).toLowerCase() + slotName.slice(1),
|
|
7863
7863
|
isDefault: false
|
|
@@ -7870,9 +7870,9 @@ function isExpandableDomAttributeWrapperName(typeName) {
|
|
|
7870
7870
|
}
|
|
7871
7871
|
function getStringLiteralTypeValues(typeNode) {
|
|
7872
7872
|
if (Node4.isLiteralTypeNode(typeNode)) {
|
|
7873
|
-
const
|
|
7874
|
-
if (Node4.isStringLiteral(
|
|
7875
|
-
return [
|
|
7873
|
+
const literal3 = typeNode.getLiteral();
|
|
7874
|
+
if (Node4.isStringLiteral(literal3)) {
|
|
7875
|
+
return [literal3.getLiteralText()];
|
|
7876
7876
|
}
|
|
7877
7877
|
}
|
|
7878
7878
|
if (!Node4.isUnionTypeNode(typeNode))
|
|
@@ -8113,17 +8113,17 @@ function getSyntheticDomAttributeProps(typeNode) {
|
|
|
8113
8113
|
}
|
|
8114
8114
|
return [...propsByName.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
8115
8115
|
}
|
|
8116
|
-
function getDomAttributeSurface(
|
|
8117
|
-
if (seen.has(
|
|
8116
|
+
function getDomAttributeSurface(name, seen = /* @__PURE__ */ new Set()) {
|
|
8117
|
+
if (seen.has(name))
|
|
8118
8118
|
return [];
|
|
8119
|
-
seen.add(
|
|
8119
|
+
seen.add(name);
|
|
8120
8120
|
const propsByName = /* @__PURE__ */ new Map();
|
|
8121
|
-
for (const parentName of DOM_ATTRIBUTE_WRAPPER_PARENTS[
|
|
8121
|
+
for (const parentName of DOM_ATTRIBUTE_WRAPPER_PARENTS[name] ?? []) {
|
|
8122
8122
|
for (const prop of getDomAttributeSurface(parentName, seen)) {
|
|
8123
8123
|
propsByName.set(prop.name, prop);
|
|
8124
8124
|
}
|
|
8125
8125
|
}
|
|
8126
|
-
for (const prop of DOM_ATTRIBUTE_PROP_SURFACES[
|
|
8126
|
+
for (const prop of DOM_ATTRIBUTE_PROP_SURFACES[name]) {
|
|
8127
8127
|
propsByName.set(prop.name, prop);
|
|
8128
8128
|
}
|
|
8129
8129
|
return [...propsByName.values()].map((prop) => ({
|
|
@@ -8220,12 +8220,12 @@ function extractPickedPropsFromTypeNode(typeNode, slotNames, excludedProps = /*
|
|
|
8220
8220
|
}
|
|
8221
8221
|
const pickedKeys = getStringLiteralTypeValues(pickedKeysNode);
|
|
8222
8222
|
const props = [];
|
|
8223
|
-
for (const
|
|
8224
|
-
if (slotNames.has(
|
|
8223
|
+
for (const name of pickedKeys) {
|
|
8224
|
+
if (slotNames.has(name))
|
|
8225
8225
|
continue;
|
|
8226
|
-
if (excludedProps.has(
|
|
8226
|
+
if (excludedProps.has(name))
|
|
8227
8227
|
continue;
|
|
8228
|
-
const pickedProp = sourcePropsByName.get(
|
|
8228
|
+
const pickedProp = sourcePropsByName.get(name);
|
|
8229
8229
|
if (pickedProp) {
|
|
8230
8230
|
props.push(pickedProp);
|
|
8231
8231
|
}
|
|
@@ -8455,7 +8455,7 @@ async function extractReactComponents(filePaths) {
|
|
|
8455
8455
|
function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
8456
8456
|
const components = [];
|
|
8457
8457
|
const usesCreateContext = sourceFileUsesCreateContext(sourceFile);
|
|
8458
|
-
for (const { name
|
|
8458
|
+
for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
8459
8459
|
allowVariableDeclaration: true,
|
|
8460
8460
|
hookReason: "React hook names are not renderable components"
|
|
8461
8461
|
})) {
|
|
@@ -8467,7 +8467,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
8467
8467
|
const params = funcNode.getParameters();
|
|
8468
8468
|
if (params.length === 0) {
|
|
8469
8469
|
components.push({
|
|
8470
|
-
name
|
|
8470
|
+
name,
|
|
8471
8471
|
source: sourceFile.getFilePath(),
|
|
8472
8472
|
sourcePath: sourceFile.getFilePath(),
|
|
8473
8473
|
framework: isNext ? "next" : "react",
|
|
@@ -8511,7 +8511,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
8511
8511
|
}
|
|
8512
8512
|
const resolvedProps = [...mergedPropsByName.values()];
|
|
8513
8513
|
const noUsefulTypes = resolvedProps.length === 0 || resolvedProps.every((p) => p.type === "any");
|
|
8514
|
-
const finalProps = noUsefulTypes ? extractPropTypes(sourceFile,
|
|
8514
|
+
const finalProps = noUsefulTypes ? extractPropTypes(sourceFile, name) ?? resolvedProps : resolvedProps;
|
|
8515
8515
|
const propsWithDefaults = finalProps.map((p) => {
|
|
8516
8516
|
if (!defaults.has(p.name))
|
|
8517
8517
|
return p;
|
|
@@ -8544,7 +8544,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
8544
8544
|
const propsTypeName = firstParamTypeNode?.getText?.().trim();
|
|
8545
8545
|
const propsTypeNameCapture = propsTypeName && /^[A-Za-z_$][\w$]*$/.test(propsTypeName) ? propsTypeName : void 0;
|
|
8546
8546
|
components.push({
|
|
8547
|
-
name
|
|
8547
|
+
name,
|
|
8548
8548
|
source: sourceFile.getFilePath(),
|
|
8549
8549
|
sourcePath: sourceFile.getFilePath(),
|
|
8550
8550
|
framework: isNext ? "next" : "react",
|
|
@@ -8759,10 +8759,10 @@ async function extractVueTsxComponents(filePaths) {
|
|
|
8759
8759
|
}
|
|
8760
8760
|
function extractFromSourceFile3(sourceFile, exclusions) {
|
|
8761
8761
|
const components = [];
|
|
8762
|
-
for (const { name
|
|
8762
|
+
for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
8763
8763
|
hookReason: "Vue composition hook names are not renderable components"
|
|
8764
8764
|
})) {
|
|
8765
|
-
const component = extractVueTsxComponent(declarations,
|
|
8765
|
+
const component = extractVueTsxComponent(declarations, name, sourceFile);
|
|
8766
8766
|
if (component) {
|
|
8767
8767
|
components.push(component);
|
|
8768
8768
|
}
|
|
@@ -8778,11 +8778,11 @@ function extractVueTsxComponent(declarations, exportName, sourceFile) {
|
|
|
8778
8778
|
const resolved = resolveVueComponentOptions(declaration.getInitializer());
|
|
8779
8779
|
if (!resolved)
|
|
8780
8780
|
continue;
|
|
8781
|
-
const
|
|
8781
|
+
const name = extractVueGenericComponentName(resolved.options) ?? exportName;
|
|
8782
8782
|
const props = extractVueGenericComponentProps(resolved.options);
|
|
8783
8783
|
const slots = extractVueGenericComponentSlots(resolved.options, resolved.slotsTypeNode);
|
|
8784
8784
|
return {
|
|
8785
|
-
name
|
|
8785
|
+
name,
|
|
8786
8786
|
source: sourceFile.getFilePath(),
|
|
8787
8787
|
framework: "vue",
|
|
8788
8788
|
props,
|
|
@@ -8956,16 +8956,16 @@ function extractVueObjectPropDefinition(propName, initializer) {
|
|
|
8956
8956
|
for (const property of initializer.getProperties()) {
|
|
8957
8957
|
if (!Node5.isPropertyAssignment(property))
|
|
8958
8958
|
continue;
|
|
8959
|
-
const
|
|
8959
|
+
const name = property.getName();
|
|
8960
8960
|
const value = property.getInitializer();
|
|
8961
8961
|
if (!value)
|
|
8962
8962
|
continue;
|
|
8963
|
-
if (
|
|
8963
|
+
if (name === "type") {
|
|
8964
8964
|
type = getVuePropTypeText(value);
|
|
8965
8965
|
allowedValues = extractAllowedValues(value.getType());
|
|
8966
|
-
} else if (
|
|
8966
|
+
} else if (name === "required") {
|
|
8967
8967
|
required = value.getText() === "true";
|
|
8968
|
-
} else if (
|
|
8968
|
+
} else if (name === "default") {
|
|
8969
8969
|
defaultValue = value.getText();
|
|
8970
8970
|
}
|
|
8971
8971
|
}
|
|
@@ -9258,20 +9258,20 @@ async function extractVueComponents(filePaths, onProgress) {
|
|
|
9258
9258
|
async function extractFromVueSFC(filePath, source) {
|
|
9259
9259
|
const { descriptor, errors } = parseSFC(source);
|
|
9260
9260
|
const fileWarnings = errors.map((e) => `Parse error in ${filePath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
9261
|
-
const
|
|
9261
|
+
const name = getVueComponentName(filePath);
|
|
9262
9262
|
let props = [];
|
|
9263
9263
|
const setupProps = descriptor.scriptSetup ? await extractSetupProps(filePath, descriptor.scriptSetup.content) : null;
|
|
9264
9264
|
if (setupProps !== null) {
|
|
9265
9265
|
props = setupProps;
|
|
9266
9266
|
} else if (descriptor.script) {
|
|
9267
|
-
return extractOptionsComponent(filePath, descriptor.script.content, fileWarnings,
|
|
9267
|
+
return extractOptionsComponent(filePath, descriptor.script.content, fileWarnings, name, descriptor.template?.ast, source);
|
|
9268
9268
|
}
|
|
9269
9269
|
let slots = descriptor.template?.ast ? extractSlotsFromTemplate(descriptor.template.ast) : [];
|
|
9270
9270
|
const runtimeSlots = extractSlotsFromRuntimeAccess(source);
|
|
9271
9271
|
slots = mergeSlotsDedup(slots, runtimeSlots);
|
|
9272
9272
|
return {
|
|
9273
9273
|
component: {
|
|
9274
|
-
name
|
|
9274
|
+
name,
|
|
9275
9275
|
source: filePath,
|
|
9276
9276
|
sourcePath: filePath,
|
|
9277
9277
|
framework: "vue",
|
|
@@ -9289,7 +9289,7 @@ function getVueComponentName(filePath) {
|
|
|
9289
9289
|
const parentDirName = basename(dirname9(filePath));
|
|
9290
9290
|
return parentDirName || fileName;
|
|
9291
9291
|
}
|
|
9292
|
-
async function extractOptionsComponent(filePath, scriptContent, fileWarnings,
|
|
9292
|
+
async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
|
|
9293
9293
|
const props = await extractOptionsProps(filePath, scriptContent);
|
|
9294
9294
|
let slots = templateAst ? extractSlotsFromTemplate(templateAst) : [];
|
|
9295
9295
|
if (sfcSource) {
|
|
@@ -9298,7 +9298,7 @@ async function extractOptionsComponent(filePath, scriptContent, fileWarnings, na
|
|
|
9298
9298
|
}
|
|
9299
9299
|
return {
|
|
9300
9300
|
component: {
|
|
9301
|
-
name
|
|
9301
|
+
name,
|
|
9302
9302
|
source: filePath,
|
|
9303
9303
|
sourcePath: filePath,
|
|
9304
9304
|
framework: "vue",
|
|
@@ -9371,13 +9371,13 @@ function extractGenericProps(typeText) {
|
|
|
9371
9371
|
const resolved = resolveTypeProperty(property);
|
|
9372
9372
|
if (!resolved)
|
|
9373
9373
|
continue;
|
|
9374
|
-
const { name
|
|
9374
|
+
const { name, typeText: resolvedTypeText, required } = resolved;
|
|
9375
9375
|
let typeText2 = resolvedTypeText;
|
|
9376
9376
|
if (!required) {
|
|
9377
9377
|
typeText2 = typeText2.replace(/\s*\|\s*undefined$/, "").replace(/^undefined\s*\|\s*/, "");
|
|
9378
9378
|
}
|
|
9379
9379
|
props.push({
|
|
9380
|
-
name
|
|
9380
|
+
name,
|
|
9381
9381
|
type: typeText2,
|
|
9382
9382
|
required
|
|
9383
9383
|
});
|
|
@@ -9675,14 +9675,14 @@ function parseObjectProps(obj) {
|
|
|
9675
9675
|
for (const prop of obj.getProperties()) {
|
|
9676
9676
|
if (!Node6.isPropertyAssignment(prop))
|
|
9677
9677
|
continue;
|
|
9678
|
-
const
|
|
9679
|
-
if (!isPublicVuePropName(
|
|
9678
|
+
const name = prop.getName();
|
|
9679
|
+
if (!isPublicVuePropName(name))
|
|
9680
9680
|
continue;
|
|
9681
9681
|
const init = prop.getInitializer();
|
|
9682
9682
|
if (!init || !Node6.isObjectLiteralExpression(init)) {
|
|
9683
9683
|
const initText = init?.getText() ?? "any";
|
|
9684
9684
|
result.push({
|
|
9685
|
-
name
|
|
9685
|
+
name,
|
|
9686
9686
|
type: VUE_TYPE_MAP[initText] ?? "any",
|
|
9687
9687
|
required: false,
|
|
9688
9688
|
sourceStartLine: prop.getStartLineNumber(),
|
|
@@ -9715,7 +9715,7 @@ function parseObjectProps(obj) {
|
|
|
9715
9715
|
}
|
|
9716
9716
|
}
|
|
9717
9717
|
result.push({
|
|
9718
|
-
name
|
|
9718
|
+
name,
|
|
9719
9719
|
type,
|
|
9720
9720
|
required,
|
|
9721
9721
|
...defaultValue !== void 0 && { defaultValue },
|
|
@@ -9725,8 +9725,8 @@ function parseObjectProps(obj) {
|
|
|
9725
9725
|
}
|
|
9726
9726
|
return result;
|
|
9727
9727
|
}
|
|
9728
|
-
function isPublicVuePropName(
|
|
9729
|
-
return !/^[_$]/.test(
|
|
9728
|
+
function isPublicVuePropName(name) {
|
|
9729
|
+
return !/^[_$]/.test(name);
|
|
9730
9730
|
}
|
|
9731
9731
|
function extractSlotsFromTemplate(ast) {
|
|
9732
9732
|
const slots = [];
|
|
@@ -9758,10 +9758,10 @@ function extractSlotsFromRuntimeAccess(source) {
|
|
|
9758
9758
|
for (const pattern of [dotPattern, bracketPattern]) {
|
|
9759
9759
|
let match2;
|
|
9760
9760
|
while ((match2 = pattern.exec(source)) !== null) {
|
|
9761
|
-
const
|
|
9762
|
-
if (!seen.has(
|
|
9763
|
-
seen.add(
|
|
9764
|
-
slots.push({ name
|
|
9761
|
+
const name = match2[1];
|
|
9762
|
+
if (!seen.has(name)) {
|
|
9763
|
+
seen.add(name);
|
|
9764
|
+
slots.push({ name, isDefault: name === "default" });
|
|
9765
9765
|
}
|
|
9766
9766
|
}
|
|
9767
9767
|
}
|
|
@@ -9870,12 +9870,12 @@ function extractPropsFromFrontmatter(frontmatter) {
|
|
|
9870
9870
|
const propsTypeAlias = sf.getTypeAlias("Props");
|
|
9871
9871
|
if (propsInterface) {
|
|
9872
9872
|
for (const member of propsInterface.getProperties()) {
|
|
9873
|
-
const
|
|
9873
|
+
const name = member.getName();
|
|
9874
9874
|
const typeText = member.getTypeNode()?.getText() ?? "any";
|
|
9875
9875
|
const required = !member.hasQuestionToken();
|
|
9876
9876
|
const allowedValues = extractAllowedValues3(typeText);
|
|
9877
9877
|
props.push({
|
|
9878
|
-
name
|
|
9878
|
+
name,
|
|
9879
9879
|
type: typeText,
|
|
9880
9880
|
required,
|
|
9881
9881
|
...allowedValues && { allowedValues },
|
|
@@ -9889,10 +9889,10 @@ function extractPropsFromFrontmatter(frontmatter) {
|
|
|
9889
9889
|
const resolved = resolveTypeProperty(property);
|
|
9890
9890
|
if (!resolved)
|
|
9891
9891
|
continue;
|
|
9892
|
-
const { name
|
|
9892
|
+
const { name, declaration: decl, typeText, required } = resolved;
|
|
9893
9893
|
const allowedValues = extractAllowedValues3(typeText);
|
|
9894
9894
|
props.push({
|
|
9895
|
-
name
|
|
9895
|
+
name,
|
|
9896
9896
|
type: typeText,
|
|
9897
9897
|
required,
|
|
9898
9898
|
...allowedValues && { allowedValues },
|
|
@@ -9958,7 +9958,7 @@ function mergeSlots(...slotGroups) {
|
|
|
9958
9958
|
return merged;
|
|
9959
9959
|
}
|
|
9960
9960
|
function extractFromAstroFile(filePath, source) {
|
|
9961
|
-
const
|
|
9961
|
+
const name = basename2(filePath, ".astro");
|
|
9962
9962
|
const fenceIndex = source.startsWith("---") ? 0 : -1;
|
|
9963
9963
|
let frontmatter = "";
|
|
9964
9964
|
let template = source;
|
|
@@ -9977,7 +9977,7 @@ function extractFromAstroFile(filePath, source) {
|
|
|
9977
9977
|
});
|
|
9978
9978
|
const slots = mergeSlots(extractSlotsFromTemplate2(template), extractSlotsFromFrontmatter(frontmatter));
|
|
9979
9979
|
return {
|
|
9980
|
-
name
|
|
9980
|
+
name,
|
|
9981
9981
|
source: filePath,
|
|
9982
9982
|
sourcePath: filePath,
|
|
9983
9983
|
framework: "astro",
|
|
@@ -10189,10 +10189,10 @@ function extractSlotsFromTemplate3(templateContent) {
|
|
|
10189
10189
|
for (const match2 of templateContent.matchAll(slotRegex)) {
|
|
10190
10190
|
const attrs = match2[1] ?? "";
|
|
10191
10191
|
const nameMatch = attrs.match(/\bname=["']([^"']+)["']/);
|
|
10192
|
-
const
|
|
10193
|
-
slots.set(
|
|
10192
|
+
const name = nameMatch?.[1] ?? "default";
|
|
10193
|
+
slots.set(name, name === "default");
|
|
10194
10194
|
}
|
|
10195
|
-
return [...slots.entries()].map(([
|
|
10195
|
+
return [...slots.entries()].map(([name, isDefault]) => ({ name, isDefault })).sort((a, b) => a.name.localeCompare(b.name));
|
|
10196
10196
|
}
|
|
10197
10197
|
function mergeSlotLists(...slotLists) {
|
|
10198
10198
|
const merged = /* @__PURE__ */ new Map();
|
|
@@ -10221,20 +10221,20 @@ function extractJsDocSlots(classDecl) {
|
|
|
10221
10221
|
const comment = tag.getCommentText()?.trim();
|
|
10222
10222
|
if (!comment)
|
|
10223
10223
|
continue;
|
|
10224
|
-
let
|
|
10224
|
+
let name = "default";
|
|
10225
10225
|
let description = comment;
|
|
10226
10226
|
if (comment.startsWith("-")) {
|
|
10227
10227
|
description = comment.slice(1).trim();
|
|
10228
10228
|
} else {
|
|
10229
10229
|
const match2 = comment.match(/^(\S+)\s*-\s*(.*)$/s);
|
|
10230
10230
|
if (match2) {
|
|
10231
|
-
|
|
10231
|
+
name = match2[1];
|
|
10232
10232
|
description = match2[2].trim();
|
|
10233
10233
|
}
|
|
10234
10234
|
}
|
|
10235
10235
|
slots.push({
|
|
10236
|
-
name
|
|
10237
|
-
isDefault:
|
|
10236
|
+
name,
|
|
10237
|
+
isDefault: name === "default",
|
|
10238
10238
|
...description && { description }
|
|
10239
10239
|
});
|
|
10240
10240
|
}
|
|
@@ -10279,8 +10279,8 @@ function isNonPublicLitMember(member) {
|
|
|
10279
10279
|
function hasShoelaceRuntimeBookkeepingField(classDecl) {
|
|
10280
10280
|
return classDecl.getProperties().some((property) => property.getName() === "initialReflectedProperties");
|
|
10281
10281
|
}
|
|
10282
|
-
function isInternalRuntimeField(
|
|
10283
|
-
return applyRuntimeFieldDenylist && INTERNAL_RUNTIME_FIELD_NAMES.has(
|
|
10282
|
+
function isInternalRuntimeField(name, applyRuntimeFieldDenylist) {
|
|
10283
|
+
return applyRuntimeFieldDenylist && INTERNAL_RUNTIME_FIELD_NAMES.has(name);
|
|
10284
10284
|
}
|
|
10285
10285
|
function getExplicitLitPropertyAttributeName(property) {
|
|
10286
10286
|
const decorator = property.getDecorators().find((candidate) => candidate.getName() === "property");
|
|
@@ -10307,8 +10307,8 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
10307
10307
|
continue;
|
|
10308
10308
|
if (isNonPublicLitMember(property))
|
|
10309
10309
|
continue;
|
|
10310
|
-
const
|
|
10311
|
-
if (
|
|
10310
|
+
const name = property.getName();
|
|
10311
|
+
if (name.startsWith("#") || isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
10312
10312
|
continue;
|
|
10313
10313
|
const scope = property.getScope();
|
|
10314
10314
|
if (scope === "private" || scope === "protected")
|
|
@@ -10323,7 +10323,7 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
10323
10323
|
}
|
|
10324
10324
|
const typeNode = property.getTypeNode();
|
|
10325
10325
|
const type = typeNode ? typeNode.getText() : "any";
|
|
10326
|
-
const publicName =
|
|
10326
|
+
const publicName = name.startsWith("_") && hasDecorators ? getExplicitLitPropertyAttributeName(property) : null;
|
|
10327
10327
|
let defaultValue;
|
|
10328
10328
|
if (initializer) {
|
|
10329
10329
|
if (Node8.isStringLiteral(initializer)) {
|
|
@@ -10333,7 +10333,7 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
10333
10333
|
}
|
|
10334
10334
|
}
|
|
10335
10335
|
props.push({
|
|
10336
|
-
name: publicName ? kebabToCamel(publicName) :
|
|
10336
|
+
name: publicName ? kebabToCamel(publicName) : name,
|
|
10337
10337
|
type,
|
|
10338
10338
|
required: false,
|
|
10339
10339
|
...defaultValue !== void 0 && { defaultValue },
|
|
@@ -10353,15 +10353,15 @@ function extractAccessorProperties(classDecl, applyRuntimeFieldDenylist = false)
|
|
|
10353
10353
|
continue;
|
|
10354
10354
|
if (isNonPublicLitMember(getter))
|
|
10355
10355
|
continue;
|
|
10356
|
-
const
|
|
10357
|
-
if (
|
|
10356
|
+
const name = getter.getName();
|
|
10357
|
+
if (name === "observedAttributes" || name === "template" || name.startsWith("#") || isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
10358
10358
|
continue;
|
|
10359
10359
|
const scope = getter.getScope();
|
|
10360
10360
|
if (scope === "private" || scope === "protected")
|
|
10361
10361
|
continue;
|
|
10362
|
-
const entry = accessors.get(
|
|
10362
|
+
const entry = accessors.get(name) ?? {};
|
|
10363
10363
|
entry.getter = getter;
|
|
10364
|
-
accessors.set(
|
|
10364
|
+
accessors.set(name, entry);
|
|
10365
10365
|
}
|
|
10366
10366
|
for (const setter of classDecl.getSetAccessors()) {
|
|
10367
10367
|
if (setter.isStatic())
|
|
@@ -10370,24 +10370,24 @@ function extractAccessorProperties(classDecl, applyRuntimeFieldDenylist = false)
|
|
|
10370
10370
|
continue;
|
|
10371
10371
|
if (isNonPublicLitMember(setter))
|
|
10372
10372
|
continue;
|
|
10373
|
-
const
|
|
10374
|
-
if (
|
|
10373
|
+
const name = setter.getName();
|
|
10374
|
+
if (name === "observedAttributes" || name === "template" || name.startsWith("#") || isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
10375
10375
|
continue;
|
|
10376
10376
|
const scope = setter.getScope();
|
|
10377
10377
|
if (scope === "private" || scope === "protected")
|
|
10378
10378
|
continue;
|
|
10379
|
-
const entry = accessors.get(
|
|
10379
|
+
const entry = accessors.get(name) ?? {};
|
|
10380
10380
|
entry.setter = setter;
|
|
10381
|
-
accessors.set(
|
|
10381
|
+
accessors.set(name, entry);
|
|
10382
10382
|
}
|
|
10383
|
-
for (const [
|
|
10383
|
+
for (const [name, { getter, setter }] of accessors) {
|
|
10384
10384
|
const hasPropertyDecorator = getter?.getDecorators().some((decorator) => decorator.getName() === "property") || setter?.getDecorators().some((decorator) => decorator.getName() === "property");
|
|
10385
10385
|
if (!hasPropertyDecorator && !(getter && setter))
|
|
10386
10386
|
continue;
|
|
10387
10387
|
const type = getter?.getReturnTypeNode()?.getText() ?? setter?.getParameters()[0]?.getTypeNode()?.getText() ?? "any";
|
|
10388
10388
|
const accessorNode = getter ?? setter;
|
|
10389
10389
|
props.push({
|
|
10390
|
-
name
|
|
10390
|
+
name,
|
|
10391
10391
|
type,
|
|
10392
10392
|
required: false,
|
|
10393
10393
|
...accessorNode ? {
|
|
@@ -10409,11 +10409,11 @@ function extractJsDocAttributeProps(classDecl) {
|
|
|
10409
10409
|
const match2 = normalizedComment?.match(/(?:\{([^}]+)\}\s+)?([^\s]+)(?:\s*-\s*([\s\S]*))?/);
|
|
10410
10410
|
if (!match2)
|
|
10411
10411
|
continue;
|
|
10412
|
-
const [, type,
|
|
10413
|
-
if (!
|
|
10412
|
+
const [, type, name, description] = match2;
|
|
10413
|
+
if (!name || name.startsWith("#"))
|
|
10414
10414
|
continue;
|
|
10415
10415
|
props.push({
|
|
10416
|
-
name
|
|
10416
|
+
name,
|
|
10417
10417
|
type: type?.trim() || "any",
|
|
10418
10418
|
required: false,
|
|
10419
10419
|
...description ? { description: description.replace(/\s+/g, " ").trim() } : {}
|
|
@@ -10765,7 +10765,7 @@ function extractFromSourceFile4(sourceFile, project) {
|
|
|
10765
10765
|
const tagName = tagNameMap.get(className) ?? siblingDefinedTagName ?? decoratorTagName ?? jsDocTagName ?? fastDefinitionTagName ?? void 0;
|
|
10766
10766
|
if (!tagName)
|
|
10767
10767
|
continue;
|
|
10768
|
-
const
|
|
10768
|
+
const name = chooseComponentName(classDecl, className, tagName);
|
|
10769
10769
|
const observedAttrs = extractObservedAttributes(classDecl);
|
|
10770
10770
|
const inheritedProps = extractInheritedClassProperties(classDecl, project);
|
|
10771
10771
|
const classProps = mergePropLists(extractJsDocAttributeProps(classDecl), extractAccessorProperties(classDecl), extractClassProperties(classDecl));
|
|
@@ -10773,7 +10773,7 @@ function extractFromSourceFile4(sourceFile, project) {
|
|
|
10773
10773
|
const templateContent = extractTemplateContent(classDecl, project);
|
|
10774
10774
|
const slots = mergeSlotLists(extractInheritedSlots(classDecl, project), extractJsDocSlots(classDecl), extractSlotsFromTemplate3(templateContent), extractFastTemplateSlots(classDecl, project));
|
|
10775
10775
|
components.push({
|
|
10776
|
-
name
|
|
10776
|
+
name,
|
|
10777
10777
|
source: sourceFile.getFilePath(),
|
|
10778
10778
|
sourcePath: sourceFile.getFilePath(),
|
|
10779
10779
|
framework: "web-component",
|
|
@@ -11085,8 +11085,8 @@ async function retryComponentWithProject(component, ctx, project, warnings) {
|
|
|
11085
11085
|
}
|
|
11086
11086
|
function addImportedDeclarationsToProject(project, ctx) {
|
|
11087
11087
|
const importedNames = collectReferencedTypeNames(ctx.annotation);
|
|
11088
|
-
for (const
|
|
11089
|
-
const localDecl = findLocalTypeDeclaration(ctx.instance,
|
|
11088
|
+
for (const name of [...importedNames]) {
|
|
11089
|
+
const localDecl = findLocalTypeDeclaration(ctx.instance, name, ctx.moduleScript) ?? (ctx.moduleScript ? findLocalTypeDeclaration(ctx.moduleScript, name, ctx.instance) : null);
|
|
11090
11090
|
if (localDecl) {
|
|
11091
11091
|
for (const referenced of collectReferencedTypeNames(localDecl))
|
|
11092
11092
|
importedNames.add(referenced);
|
|
@@ -11267,21 +11267,21 @@ function collapseUnresolvedTypeWarnings(warnings) {
|
|
|
11267
11267
|
}
|
|
11268
11268
|
async function extractFromSvelteFile(filePath, source) {
|
|
11269
11269
|
const warnings = [];
|
|
11270
|
-
const
|
|
11270
|
+
const name = getSvelteComponentName(filePath);
|
|
11271
11271
|
let ast;
|
|
11272
11272
|
try {
|
|
11273
11273
|
ast = parseSvelte(source, { modern: true });
|
|
11274
11274
|
} catch (e) {
|
|
11275
11275
|
return {
|
|
11276
11276
|
component: null,
|
|
11277
|
-
warnings: [`${
|
|
11277
|
+
warnings: [`${name}: parse error in ${filePath}: ${e instanceof Error ? e.message : String(e)}`]
|
|
11278
11278
|
};
|
|
11279
11279
|
}
|
|
11280
11280
|
const instance = ast["instance"];
|
|
11281
11281
|
const moduleScript = ast["module"];
|
|
11282
11282
|
const fragment = ast["fragment"];
|
|
11283
11283
|
if (instance && hasV4ExportLetProps(instance)) {
|
|
11284
|
-
warnings.push(`${
|
|
11284
|
+
warnings.push(`${name}: Svelte 4 export let syntax not yet supported (${filePath}); see INTEG-4267 for v5-only scope and follow-up`);
|
|
11285
11285
|
return { component: null, warnings };
|
|
11286
11286
|
}
|
|
11287
11287
|
const propsCall = instance ? findPropsCall(instance) : null;
|
|
@@ -11296,7 +11296,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11296
11296
|
instance,
|
|
11297
11297
|
moduleScript,
|
|
11298
11298
|
filePath,
|
|
11299
|
-
componentName:
|
|
11299
|
+
componentName: name,
|
|
11300
11300
|
source,
|
|
11301
11301
|
snippetLocals
|
|
11302
11302
|
});
|
|
@@ -11308,12 +11308,12 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11308
11308
|
extractionReasons.push(...result.additionalReasons);
|
|
11309
11309
|
} else if (instance) {
|
|
11310
11310
|
} else {
|
|
11311
|
-
warnings.push(`${
|
|
11311
|
+
warnings.push(`${name}: no instance script block (${filePath}); no props extracted`);
|
|
11312
11312
|
}
|
|
11313
11313
|
const templateSlots = fragment ? extractTemplateSlots(fragment) : [];
|
|
11314
11314
|
const { slots, mixedWarning } = mergeSlots2(snippetSlotsFromProps, templateSlots);
|
|
11315
11315
|
if (mixedWarning) {
|
|
11316
|
-
warnings.push(`${
|
|
11316
|
+
warnings.push(`${name}: mixed Snippet and <slot> usage detected (${filePath}); preferring Snippet entries`);
|
|
11317
11317
|
}
|
|
11318
11318
|
let propsTypeNameCapture;
|
|
11319
11319
|
if (propsCall) {
|
|
@@ -11326,7 +11326,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11326
11326
|
}
|
|
11327
11327
|
}
|
|
11328
11328
|
const component = {
|
|
11329
|
-
name
|
|
11329
|
+
name,
|
|
11330
11330
|
source: filePath,
|
|
11331
11331
|
framework: "svelte",
|
|
11332
11332
|
props,
|
|
@@ -11352,7 +11352,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11352
11352
|
instance,
|
|
11353
11353
|
moduleScript,
|
|
11354
11354
|
annotation,
|
|
11355
|
-
componentName:
|
|
11355
|
+
componentName: name
|
|
11356
11356
|
};
|
|
11357
11357
|
}
|
|
11358
11358
|
}
|
|
@@ -11495,8 +11495,8 @@ function describeAnnotationForUser(annotation) {
|
|
|
11495
11495
|
if (!annotation)
|
|
11496
11496
|
return "<unknown>";
|
|
11497
11497
|
if (annotation.type === "TSTypeReference") {
|
|
11498
|
-
const
|
|
11499
|
-
return
|
|
11498
|
+
const name = annotation["typeName"]?.["name"] ?? null;
|
|
11499
|
+
return name ? `'${name}'` : "<unnamed reference>";
|
|
11500
11500
|
}
|
|
11501
11501
|
if (annotation.type === "TSIntersectionType")
|
|
11502
11502
|
return "<intersection>";
|
|
@@ -11571,7 +11571,7 @@ async function resolveViaTypeChecker(annotation, instance, moduleScript, filePat
|
|
|
11571
11571
|
return null;
|
|
11572
11572
|
const members = [];
|
|
11573
11573
|
for (const symbol of properties) {
|
|
11574
|
-
const
|
|
11574
|
+
const name = symbol.getName();
|
|
11575
11575
|
const declaration = symbol.getValueDeclaration() ?? symbol.getDeclarations()[0];
|
|
11576
11576
|
if (!declaration)
|
|
11577
11577
|
continue;
|
|
@@ -11586,7 +11586,7 @@ async function resolveViaTypeChecker(annotation, instance, moduleScript, filePat
|
|
|
11586
11586
|
const declaredTypeText = readDeclaredTypeNodeText(declaration);
|
|
11587
11587
|
const isSnippet = declaredTypeText !== null && isSnippetTypeText(declaredTypeText, snippetLocals) || typeRefersToSnippet(propType) || isSnippetTypeText(typeText, snippetLocals);
|
|
11588
11588
|
members.push({
|
|
11589
|
-
name
|
|
11589
|
+
name,
|
|
11590
11590
|
optional: optional5,
|
|
11591
11591
|
typeText,
|
|
11592
11592
|
...declaredTypeText ? { declaredTypeText } : {},
|
|
@@ -11674,7 +11674,7 @@ function mergeSets(a, b) {
|
|
|
11674
11674
|
out.add(v);
|
|
11675
11675
|
return out;
|
|
11676
11676
|
}
|
|
11677
|
-
function findLocalTypeDeclaration(instance,
|
|
11677
|
+
function findLocalTypeDeclaration(instance, name, module) {
|
|
11678
11678
|
for (const script of [instance, module]) {
|
|
11679
11679
|
const body = script?.["content"]?.["body"];
|
|
11680
11680
|
if (!body)
|
|
@@ -11683,7 +11683,7 @@ function findLocalTypeDeclaration(instance, name2, module) {
|
|
|
11683
11683
|
const decl = stmt.type === "ExportNamedDeclaration" ? stmt["declaration"] ?? stmt : stmt;
|
|
11684
11684
|
if (decl.type === "TSInterfaceDeclaration" || decl.type === "TSTypeAliasDeclaration") {
|
|
11685
11685
|
const id = decl["id"];
|
|
11686
|
-
if (id?.["name"] ===
|
|
11686
|
+
if (id?.["name"] === name)
|
|
11687
11687
|
return decl;
|
|
11688
11688
|
}
|
|
11689
11689
|
}
|
|
@@ -11704,8 +11704,8 @@ function readMembersFromInterfaceOrAlias(decl, snippetLocals) {
|
|
|
11704
11704
|
}
|
|
11705
11705
|
return [];
|
|
11706
11706
|
}
|
|
11707
|
-
function readMembersFromTypeLiteral(
|
|
11708
|
-
const members =
|
|
11707
|
+
function readMembersFromTypeLiteral(literal3, snippetLocals) {
|
|
11708
|
+
const members = literal3["members"];
|
|
11709
11709
|
if (!members)
|
|
11710
11710
|
return [];
|
|
11711
11711
|
return members.map((m) => readPropertySignature(m, snippetLocals)).filter((m) => !!m);
|
|
@@ -11714,8 +11714,8 @@ function readPropertySignature(member, snippetLocals) {
|
|
|
11714
11714
|
if (member.type !== "TSPropertySignature")
|
|
11715
11715
|
return null;
|
|
11716
11716
|
const key = member["key"];
|
|
11717
|
-
const
|
|
11718
|
-
if (!
|
|
11717
|
+
const name = key?.["name"] ?? null;
|
|
11718
|
+
if (!name)
|
|
11719
11719
|
return null;
|
|
11720
11720
|
const optional5 = !!member["optional"];
|
|
11721
11721
|
const typeNode = member["typeAnnotation"]?.["typeAnnotation"];
|
|
@@ -11725,7 +11725,7 @@ function readPropertySignature(member, snippetLocals) {
|
|
|
11725
11725
|
const leading = member["leadingComments"] ?? [];
|
|
11726
11726
|
const description = extractJsdocText(leading);
|
|
11727
11727
|
return {
|
|
11728
|
-
name
|
|
11728
|
+
name,
|
|
11729
11729
|
optional: optional5,
|
|
11730
11730
|
typeText,
|
|
11731
11731
|
isSnippet,
|
|
@@ -11864,19 +11864,19 @@ function extractFromDestructure(propsCall, _ctx, typeMembers, warnings, addition
|
|
|
11864
11864
|
if (p.type !== "Property")
|
|
11865
11865
|
continue;
|
|
11866
11866
|
const key = p["key"];
|
|
11867
|
-
const
|
|
11868
|
-
if (!
|
|
11867
|
+
const name = key?.["name"] ?? null;
|
|
11868
|
+
if (!name)
|
|
11869
11869
|
continue;
|
|
11870
|
-
seenInDestructure.add(
|
|
11870
|
+
seenInDestructure.add(name);
|
|
11871
11871
|
const value = p["value"];
|
|
11872
11872
|
const hasDefault = value?.type === "AssignmentPattern";
|
|
11873
11873
|
const defaultValueRaw = hasDefault ? renderLiteral(value["right"]) : void 0;
|
|
11874
|
-
const typeMember = typeByName.get(
|
|
11874
|
+
const typeMember = typeByName.get(name);
|
|
11875
11875
|
if (typeMember?.isSnippet) {
|
|
11876
|
-
snippetNames.add(
|
|
11876
|
+
snippetNames.add(name);
|
|
11877
11877
|
const slot = {
|
|
11878
|
-
name
|
|
11879
|
-
isDefault:
|
|
11878
|
+
name,
|
|
11879
|
+
isDefault: name === "children",
|
|
11880
11880
|
...typeMember.description ? { description: typeMember.description } : {}
|
|
11881
11881
|
};
|
|
11882
11882
|
const authorText = typeMember.declaredTypeText ?? typeMember.typeText;
|
|
@@ -11887,7 +11887,7 @@ function extractFromDestructure(propsCall, _ctx, typeMembers, warnings, addition
|
|
|
11887
11887
|
}
|
|
11888
11888
|
const required = typeMember ? !typeMember.optional && !hasDefault : !hasDefault;
|
|
11889
11889
|
const propDef = {
|
|
11890
|
-
name
|
|
11890
|
+
name,
|
|
11891
11891
|
type: typeMember?.typeText ?? "unknown",
|
|
11892
11892
|
required
|
|
11893
11893
|
};
|
|
@@ -11945,9 +11945,9 @@ function propertyOrder(properties) {
|
|
|
11945
11945
|
for (const p of properties) {
|
|
11946
11946
|
if (p.type !== "Property")
|
|
11947
11947
|
continue;
|
|
11948
|
-
const
|
|
11949
|
-
if (
|
|
11950
|
-
m.set(
|
|
11948
|
+
const name = p["key"]?.["name"] ?? null;
|
|
11949
|
+
if (name)
|
|
11950
|
+
m.set(name, i++);
|
|
11951
11951
|
}
|
|
11952
11952
|
return m;
|
|
11953
11953
|
}
|
|
@@ -12126,10 +12126,10 @@ function extractTemplateSlots(fragment) {
|
|
|
12126
12126
|
if (!node)
|
|
12127
12127
|
return;
|
|
12128
12128
|
if (node.type === "SlotElement") {
|
|
12129
|
-
const
|
|
12130
|
-
if (!seen.has(
|
|
12131
|
-
seen.add(
|
|
12132
|
-
slots.push({ name
|
|
12129
|
+
const name = readSlotName(node);
|
|
12130
|
+
if (!seen.has(name)) {
|
|
12131
|
+
seen.add(name);
|
|
12132
|
+
slots.push({ name, isDefault: name === "default" });
|
|
12133
12133
|
}
|
|
12134
12134
|
}
|
|
12135
12135
|
const children = node["nodes"] ?? node["children"] ?? [];
|
|
@@ -12328,9 +12328,9 @@ function extractDecoratorInput(field) {
|
|
|
12328
12328
|
}
|
|
12329
12329
|
const resolved = resolvePropType(typeNode);
|
|
12330
12330
|
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
12331
|
-
const
|
|
12331
|
+
const name = alias ?? fieldName;
|
|
12332
12332
|
const prop = {
|
|
12333
|
-
name
|
|
12333
|
+
name,
|
|
12334
12334
|
type: typeText,
|
|
12335
12335
|
required,
|
|
12336
12336
|
sourceStartLine: field.getStartLineNumber(),
|
|
@@ -12400,9 +12400,9 @@ function extractSignalInput(field) {
|
|
|
12400
12400
|
const typeArg = init.getTypeArguments()[0];
|
|
12401
12401
|
const resolved = resolvePropType(typeArg);
|
|
12402
12402
|
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
12403
|
-
const
|
|
12403
|
+
const name = alias ?? fieldName;
|
|
12404
12404
|
const prop = {
|
|
12405
|
-
name
|
|
12405
|
+
name,
|
|
12406
12406
|
type: typeText,
|
|
12407
12407
|
required,
|
|
12408
12408
|
sourceStartLine: field.getStartLineNumber(),
|
|
@@ -12485,10 +12485,10 @@ function extractProps2(cls, meta) {
|
|
|
12485
12485
|
const parsed = parseInputsArrayEntry(entry);
|
|
12486
12486
|
if (!parsed)
|
|
12487
12487
|
continue;
|
|
12488
|
-
const
|
|
12489
|
-
if (byName.has(
|
|
12488
|
+
const name = parsed.alias ?? parsed.fieldName;
|
|
12489
|
+
if (byName.has(name))
|
|
12490
12490
|
continue;
|
|
12491
|
-
byName.set(
|
|
12491
|
+
byName.set(name, { name, type: "any", required: false });
|
|
12492
12492
|
}
|
|
12493
12493
|
return [...byName.values()];
|
|
12494
12494
|
}
|
|
@@ -12601,16 +12601,16 @@ async function resolveTemplateSource(meta) {
|
|
|
12601
12601
|
|
|
12602
12602
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/strip-library-prefix.js
|
|
12603
12603
|
var KNOWN_PREFIXES = ["Mat", "Cdk", "Nz", "Cds", "Ibm", "Clr", "Hlm", "Brn", "Tui", "Nb", "Fd", "P", "Ng"];
|
|
12604
|
-
function stripLibraryPrefix(
|
|
12604
|
+
function stripLibraryPrefix(name) {
|
|
12605
12605
|
for (const prefix of KNOWN_PREFIXES) {
|
|
12606
|
-
if (
|
|
12607
|
-
const rest =
|
|
12606
|
+
if (name.startsWith(prefix) && name.length > prefix.length) {
|
|
12607
|
+
const rest = name.slice(prefix.length);
|
|
12608
12608
|
if (rest[0] && rest[0] === rest[0].toUpperCase()) {
|
|
12609
12609
|
return rest;
|
|
12610
12610
|
}
|
|
12611
12611
|
}
|
|
12612
12612
|
}
|
|
12613
|
-
return
|
|
12613
|
+
return name;
|
|
12614
12614
|
}
|
|
12615
12615
|
|
|
12616
12616
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/derive-slot-name.js
|
|
@@ -12678,8 +12678,8 @@ function extractContentChildQueries(cls) {
|
|
|
12678
12678
|
if (init && Node15.isCallExpression(init)) {
|
|
12679
12679
|
const callee = init.getExpression();
|
|
12680
12680
|
if (Node15.isIdentifier(callee)) {
|
|
12681
|
-
const
|
|
12682
|
-
if (
|
|
12681
|
+
const name = callee.getText();
|
|
12682
|
+
if (name === "contentChild" || name === "contentChildren") {
|
|
12683
12683
|
const first = init.getArguments()[0];
|
|
12684
12684
|
const allowed = resolveClassIdentifierArg(first);
|
|
12685
12685
|
out.push(buildSlot(fieldName, allowed));
|
|
@@ -12708,9 +12708,9 @@ function resolveClassIdentifierArg(arg) {
|
|
|
12708
12708
|
return [arg.getText()];
|
|
12709
12709
|
return [];
|
|
12710
12710
|
}
|
|
12711
|
-
function buildSlot(
|
|
12711
|
+
function buildSlot(name, allowed) {
|
|
12712
12712
|
const slot = {
|
|
12713
|
-
name
|
|
12713
|
+
name,
|
|
12714
12714
|
isDefault: false
|
|
12715
12715
|
};
|
|
12716
12716
|
if (allowed.length > 0)
|
|
@@ -12744,11 +12744,11 @@ async function extractSlots3(cls, meta, props) {
|
|
|
12744
12744
|
const template = await resolveTemplateSource(meta);
|
|
12745
12745
|
if (template) {
|
|
12746
12746
|
for (const el of parseNgContentElements(template)) {
|
|
12747
|
-
const
|
|
12748
|
-
if (byName.has(
|
|
12747
|
+
const name = deriveSlotName(el.rawSelect, meta.normalizedName);
|
|
12748
|
+
if (byName.has(name))
|
|
12749
12749
|
continue;
|
|
12750
|
-
byName.set(
|
|
12751
|
-
name
|
|
12750
|
+
byName.set(name, {
|
|
12751
|
+
name,
|
|
12752
12752
|
isDefault: el.rawSelect === null
|
|
12753
12753
|
});
|
|
12754
12754
|
}
|
|
@@ -12830,9 +12830,9 @@ function normalizeSlots(slots) {
|
|
|
12830
12830
|
return slots.map((slot) => {
|
|
12831
12831
|
if (slot.name.trim())
|
|
12832
12832
|
return slot;
|
|
12833
|
-
const
|
|
12833
|
+
const name = fallbackIndex === 0 ? "children" : `slot_${fallbackIndex}`;
|
|
12834
12834
|
fallbackIndex++;
|
|
12835
|
-
return { ...slot, name
|
|
12835
|
+
return { ...slot, name };
|
|
12836
12836
|
});
|
|
12837
12837
|
}
|
|
12838
12838
|
|
|
@@ -13547,8 +13547,8 @@ ${fileDigest}`);
|
|
|
13547
13547
|
|
|
13548
13548
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
|
|
13549
13549
|
import { dirname as dirname14 } from "node:path";
|
|
13550
|
-
function kebabToPascal3(
|
|
13551
|
-
return
|
|
13550
|
+
function kebabToPascal3(name) {
|
|
13551
|
+
return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
|
|
13552
13552
|
}
|
|
13553
13553
|
function collectManifestEdges(files, componentNames) {
|
|
13554
13554
|
const edges = [];
|
|
@@ -13940,9 +13940,9 @@ import { resolve as resolve16 } from "node:path";
|
|
|
13940
13940
|
|
|
13941
13941
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/create-component-id.js
|
|
13942
13942
|
import { createHash as createHash7 } from "node:crypto";
|
|
13943
|
-
function createComponentId(
|
|
13944
|
-
const sourceHash = createHash7("sha256").update(`${
|
|
13945
|
-
return `${
|
|
13943
|
+
function createComponentId(name, resolvedSourcePath) {
|
|
13944
|
+
const sourceHash = createHash7("sha256").update(`${name}:${resolvedSourcePath}`).digest("hex").slice(0, 12);
|
|
13945
|
+
return `${name}-${sourceHash}`;
|
|
13946
13946
|
}
|
|
13947
13947
|
|
|
13948
13948
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/resolve-component-source-path.js
|
|
@@ -14239,10 +14239,10 @@ var CATEGORY_BY_EXTENSION = {
|
|
|
14239
14239
|
};
|
|
14240
14240
|
|
|
14241
14241
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/categorize-file.js
|
|
14242
|
-
function categorizeFile(
|
|
14243
|
-
if (
|
|
14242
|
+
function categorizeFile(name) {
|
|
14243
|
+
if (name.endsWith(".d.ts"))
|
|
14244
14244
|
return "other";
|
|
14245
|
-
const ext = path.extname(
|
|
14245
|
+
const ext = path.extname(name);
|
|
14246
14246
|
return CATEGORY_BY_EXTENSION[ext] ?? "other";
|
|
14247
14247
|
}
|
|
14248
14248
|
|
|
@@ -14250,20 +14250,20 @@ function categorizeFile(name2) {
|
|
|
14250
14250
|
import path2 from "node:path";
|
|
14251
14251
|
|
|
14252
14252
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/is-noise-config-file.js
|
|
14253
|
-
function isNoiseConfigFile(
|
|
14254
|
-
return DENYLISTED_EXACT_FILE_NAMES.has(
|
|
14253
|
+
function isNoiseConfigFile(name) {
|
|
14254
|
+
return DENYLISTED_EXACT_FILE_NAMES.has(name) || DENYLISTED_FILE_NAME_PATTERNS.some((pattern) => pattern.test(name));
|
|
14255
14255
|
}
|
|
14256
14256
|
|
|
14257
14257
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/is-source-file.js
|
|
14258
|
-
function isSourceFile(
|
|
14259
|
-
if (
|
|
14258
|
+
function isSourceFile(name) {
|
|
14259
|
+
if (name.endsWith(".d.ts"))
|
|
14260
14260
|
return false;
|
|
14261
|
-
if (EXCLUDED_SUFFIXES.some((suffix) =>
|
|
14261
|
+
if (EXCLUDED_SUFFIXES.some((suffix) => name.endsWith(suffix)))
|
|
14262
14262
|
return false;
|
|
14263
|
-
const ext = path2.extname(
|
|
14263
|
+
const ext = path2.extname(name);
|
|
14264
14264
|
if (INCLUDED_EXTENSIONS.has(ext))
|
|
14265
14265
|
return true;
|
|
14266
|
-
if (DENYLIST_GATED_EXTENSIONS.has(ext) && !isNoiseConfigFile(
|
|
14266
|
+
if (DENYLIST_GATED_EXTENSIONS.has(ext) && !isNoiseConfigFile(name))
|
|
14267
14267
|
return true;
|
|
14268
14268
|
return false;
|
|
14269
14269
|
}
|
|
@@ -14469,7 +14469,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14469
14469
|
const seen = /* @__PURE__ */ new Set();
|
|
14470
14470
|
for (const row of rows) {
|
|
14471
14471
|
const sourcePath = rowField(row, "source_path");
|
|
14472
|
-
const
|
|
14472
|
+
const name = rowField(row, "name");
|
|
14473
14473
|
if (!sourcePath)
|
|
14474
14474
|
continue;
|
|
14475
14475
|
const abs = resolve19(sourcePath);
|
|
@@ -14479,8 +14479,8 @@ async function buildSourceFingerprint(opts) {
|
|
|
14479
14479
|
try {
|
|
14480
14480
|
const st = await stat2(abs);
|
|
14481
14481
|
const entry = { mtime: st.mtime.toISOString() };
|
|
14482
|
-
if (
|
|
14483
|
-
entry.componentName =
|
|
14482
|
+
if (name)
|
|
14483
|
+
entry.componentName = name;
|
|
14484
14484
|
files[abs] = entry;
|
|
14485
14485
|
} catch {
|
|
14486
14486
|
}
|
|
@@ -14511,10 +14511,10 @@ var SAVE_FILES = ["components.json", "tokens.json"];
|
|
|
14511
14511
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/list-conflicting-files.js
|
|
14512
14512
|
async function listConflictingFiles(path5) {
|
|
14513
14513
|
const conflicts = [];
|
|
14514
|
-
for (const
|
|
14514
|
+
for (const name of SAVE_FILES) {
|
|
14515
14515
|
try {
|
|
14516
|
-
await access4(join14(path5,
|
|
14517
|
-
conflicts.push(
|
|
14516
|
+
await access4(join14(path5, name));
|
|
14517
|
+
conflicts.push(name);
|
|
14518
14518
|
} catch {
|
|
14519
14519
|
}
|
|
14520
14520
|
}
|
|
@@ -14731,18 +14731,18 @@ var separatorObjectExplode = (style) => {
|
|
|
14731
14731
|
return "&";
|
|
14732
14732
|
}
|
|
14733
14733
|
};
|
|
14734
|
-
var serializeArrayParam = ({ allowReserved, explode, name
|
|
14734
|
+
var serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
14735
14735
|
if (!explode) {
|
|
14736
14736
|
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
14737
14737
|
switch (style) {
|
|
14738
14738
|
case "label":
|
|
14739
14739
|
return `.${joinedValues2}`;
|
|
14740
14740
|
case "matrix":
|
|
14741
|
-
return `;${
|
|
14741
|
+
return `;${name}=${joinedValues2}`;
|
|
14742
14742
|
case "simple":
|
|
14743
14743
|
return joinedValues2;
|
|
14744
14744
|
default:
|
|
14745
|
-
return `${
|
|
14745
|
+
return `${name}=${joinedValues2}`;
|
|
14746
14746
|
}
|
|
14747
14747
|
}
|
|
14748
14748
|
const separator = separatorArrayExplode(style);
|
|
@@ -14752,24 +14752,24 @@ var serializeArrayParam = ({ allowReserved, explode, name: name2, style, value }
|
|
|
14752
14752
|
}
|
|
14753
14753
|
return serializePrimitiveParam({
|
|
14754
14754
|
allowReserved,
|
|
14755
|
-
name
|
|
14755
|
+
name,
|
|
14756
14756
|
value: v
|
|
14757
14757
|
});
|
|
14758
14758
|
}).join(separator);
|
|
14759
14759
|
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
14760
14760
|
};
|
|
14761
|
-
var serializePrimitiveParam = ({ allowReserved, name
|
|
14761
|
+
var serializePrimitiveParam = ({ allowReserved, name, value }) => {
|
|
14762
14762
|
if (value === void 0 || value === null) {
|
|
14763
14763
|
return "";
|
|
14764
14764
|
}
|
|
14765
14765
|
if (typeof value === "object") {
|
|
14766
14766
|
throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
|
|
14767
14767
|
}
|
|
14768
|
-
return `${
|
|
14768
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
14769
14769
|
};
|
|
14770
|
-
var serializeObjectParam = ({ allowReserved, explode, name
|
|
14770
|
+
var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
14771
14771
|
if (value instanceof Date) {
|
|
14772
|
-
return valueOnly ? value.toISOString() : `${
|
|
14772
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
14773
14773
|
}
|
|
14774
14774
|
if (style !== "deepObject" && !explode) {
|
|
14775
14775
|
let values = [];
|
|
@@ -14783,11 +14783,11 @@ var serializeObjectParam = ({ allowReserved, explode, name: name2, style, value,
|
|
|
14783
14783
|
const joinedValues2 = values.join(",");
|
|
14784
14784
|
switch (style) {
|
|
14785
14785
|
case "form":
|
|
14786
|
-
return `${
|
|
14786
|
+
return `${name}=${joinedValues2}`;
|
|
14787
14787
|
case "label":
|
|
14788
14788
|
return `.${joinedValues2}`;
|
|
14789
14789
|
case "matrix":
|
|
14790
|
-
return `;${
|
|
14790
|
+
return `;${name}=${joinedValues2}`;
|
|
14791
14791
|
default:
|
|
14792
14792
|
return joinedValues2;
|
|
14793
14793
|
}
|
|
@@ -14795,7 +14795,7 @@ var serializeObjectParam = ({ allowReserved, explode, name: name2, style, value,
|
|
|
14795
14795
|
const separator = separatorObjectExplode(style);
|
|
14796
14796
|
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
|
|
14797
14797
|
allowReserved,
|
|
14798
|
-
name: style === "deepObject" ? `${
|
|
14798
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
14799
14799
|
value: v
|
|
14800
14800
|
})).join(separator);
|
|
14801
14801
|
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
@@ -14809,31 +14809,31 @@ var defaultPathSerializer = ({ path: path5, url: _url }) => {
|
|
|
14809
14809
|
if (matches) {
|
|
14810
14810
|
for (const match2 of matches) {
|
|
14811
14811
|
let explode = false;
|
|
14812
|
-
let
|
|
14812
|
+
let name = match2.substring(1, match2.length - 1);
|
|
14813
14813
|
let style = "simple";
|
|
14814
|
-
if (
|
|
14814
|
+
if (name.endsWith("*")) {
|
|
14815
14815
|
explode = true;
|
|
14816
|
-
|
|
14816
|
+
name = name.substring(0, name.length - 1);
|
|
14817
14817
|
}
|
|
14818
|
-
if (
|
|
14819
|
-
|
|
14818
|
+
if (name.startsWith(".")) {
|
|
14819
|
+
name = name.substring(1);
|
|
14820
14820
|
style = "label";
|
|
14821
|
-
} else if (
|
|
14822
|
-
|
|
14821
|
+
} else if (name.startsWith(";")) {
|
|
14822
|
+
name = name.substring(1);
|
|
14823
14823
|
style = "matrix";
|
|
14824
14824
|
}
|
|
14825
|
-
const value = path5[
|
|
14825
|
+
const value = path5[name];
|
|
14826
14826
|
if (value === void 0 || value === null) {
|
|
14827
14827
|
continue;
|
|
14828
14828
|
}
|
|
14829
14829
|
if (Array.isArray(value)) {
|
|
14830
|
-
url = url.replace(match2, serializeArrayParam({ explode, name
|
|
14830
|
+
url = url.replace(match2, serializeArrayParam({ explode, name, style, value }));
|
|
14831
14831
|
continue;
|
|
14832
14832
|
}
|
|
14833
14833
|
if (typeof value === "object") {
|
|
14834
14834
|
url = url.replace(match2, serializeObjectParam({
|
|
14835
14835
|
explode,
|
|
14836
|
-
name
|
|
14836
|
+
name,
|
|
14837
14837
|
style,
|
|
14838
14838
|
value,
|
|
14839
14839
|
valueOnly: true
|
|
@@ -14842,7 +14842,7 @@ var defaultPathSerializer = ({ path: path5, url: _url }) => {
|
|
|
14842
14842
|
}
|
|
14843
14843
|
if (style === "matrix") {
|
|
14844
14844
|
url = url.replace(match2, `;${serializePrimitiveParam({
|
|
14845
|
-
name
|
|
14845
|
+
name,
|
|
14846
14846
|
value
|
|
14847
14847
|
})}`);
|
|
14848
14848
|
continue;
|
|
@@ -14853,12 +14853,12 @@ var defaultPathSerializer = ({ path: path5, url: _url }) => {
|
|
|
14853
14853
|
}
|
|
14854
14854
|
return url;
|
|
14855
14855
|
};
|
|
14856
|
-
var createQuerySerializer = ({ allowReserved, array:
|
|
14856
|
+
var createQuerySerializer = ({ allowReserved, array: array3, object } = {}) => {
|
|
14857
14857
|
const querySerializer = (queryParams) => {
|
|
14858
14858
|
const search = [];
|
|
14859
14859
|
if (queryParams && typeof queryParams === "object") {
|
|
14860
|
-
for (const
|
|
14861
|
-
const value = queryParams[
|
|
14860
|
+
for (const name in queryParams) {
|
|
14861
|
+
const value = queryParams[name];
|
|
14862
14862
|
if (value === void 0 || value === null) {
|
|
14863
14863
|
continue;
|
|
14864
14864
|
}
|
|
@@ -14866,10 +14866,10 @@ var createQuerySerializer = ({ allowReserved, array: array4, object } = {}) => {
|
|
|
14866
14866
|
const serializedArray = serializeArrayParam({
|
|
14867
14867
|
allowReserved,
|
|
14868
14868
|
explode: true,
|
|
14869
|
-
name
|
|
14869
|
+
name,
|
|
14870
14870
|
style: "form",
|
|
14871
14871
|
value,
|
|
14872
|
-
...
|
|
14872
|
+
...array3
|
|
14873
14873
|
});
|
|
14874
14874
|
if (serializedArray)
|
|
14875
14875
|
search.push(serializedArray);
|
|
@@ -14877,7 +14877,7 @@ var createQuerySerializer = ({ allowReserved, array: array4, object } = {}) => {
|
|
|
14877
14877
|
const serializedObject = serializeObjectParam({
|
|
14878
14878
|
allowReserved,
|
|
14879
14879
|
explode: true,
|
|
14880
|
-
name
|
|
14880
|
+
name,
|
|
14881
14881
|
style: "deepObject",
|
|
14882
14882
|
value,
|
|
14883
14883
|
...object
|
|
@@ -14887,7 +14887,7 @@ var createQuerySerializer = ({ allowReserved, array: array4, object } = {}) => {
|
|
|
14887
14887
|
} else {
|
|
14888
14888
|
const serializedPrimitive = serializePrimitiveParam({
|
|
14889
14889
|
allowReserved,
|
|
14890
|
-
name
|
|
14890
|
+
name,
|
|
14891
14891
|
value
|
|
14892
14892
|
});
|
|
14893
14893
|
if (serializedPrimitive)
|
|
@@ -14921,11 +14921,11 @@ var getParseAs = (contentType) => {
|
|
|
14921
14921
|
}
|
|
14922
14922
|
return;
|
|
14923
14923
|
};
|
|
14924
|
-
var checkForExistence = (options,
|
|
14925
|
-
if (!
|
|
14924
|
+
var checkForExistence = (options, name) => {
|
|
14925
|
+
if (!name) {
|
|
14926
14926
|
return false;
|
|
14927
14927
|
}
|
|
14928
|
-
if (options.headers.has(
|
|
14928
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
14929
14929
|
return true;
|
|
14930
14930
|
}
|
|
14931
14931
|
return false;
|
|
@@ -14939,20 +14939,20 @@ var setAuthParams = async ({ security, ...options }) => {
|
|
|
14939
14939
|
if (!token) {
|
|
14940
14940
|
continue;
|
|
14941
14941
|
}
|
|
14942
|
-
const
|
|
14942
|
+
const name = auth.name ?? "Authorization";
|
|
14943
14943
|
switch (auth.in) {
|
|
14944
14944
|
case "query":
|
|
14945
14945
|
if (!options.query) {
|
|
14946
14946
|
options.query = {};
|
|
14947
14947
|
}
|
|
14948
|
-
options.query[
|
|
14948
|
+
options.query[name] = token;
|
|
14949
14949
|
break;
|
|
14950
14950
|
case "cookie":
|
|
14951
|
-
options.headers.append("Cookie", `${
|
|
14951
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
14952
14952
|
break;
|
|
14953
14953
|
case "header":
|
|
14954
14954
|
default:
|
|
14955
|
-
options.headers.set(
|
|
14955
|
+
options.headers.set(name, token);
|
|
14956
14956
|
break;
|
|
14957
14957
|
}
|
|
14958
14958
|
}
|
|
@@ -15811,11 +15811,11 @@ function parseEdsiError(rawInput) {
|
|
|
15811
15811
|
...binding.diagnostics ? { diagnostics: binding.diagnostics } : {}
|
|
15812
15812
|
};
|
|
15813
15813
|
}
|
|
15814
|
-
const
|
|
15815
|
-
if (
|
|
15814
|
+
const literal3 = parseObjectLiteralTail(cleaned);
|
|
15815
|
+
if (literal3 && (literal3.code || literal3.cycle)) {
|
|
15816
15816
|
const braceStart = cleaned.lastIndexOf("{");
|
|
15817
15817
|
const head = braceStart === -1 ? cleaned : cleaned.slice(0, braceStart).trim();
|
|
15818
|
-
return { code:
|
|
15818
|
+
return { code: literal3.code ?? null, message: head || cleaned, cycle: literal3.cycle ?? null, raw: false };
|
|
15819
15819
|
}
|
|
15820
15820
|
return { code: null, message: cleaned || prefix || rawInput, cycle: null, raw: true };
|
|
15821
15821
|
}
|
|
@@ -16118,8 +16118,8 @@ function countCharacterEdits(a, b) {
|
|
|
16118
16118
|
}
|
|
16119
16119
|
|
|
16120
16120
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/simplify-name-for-comparison.js
|
|
16121
|
-
function simplifyNameForComparison(
|
|
16122
|
-
const stripped =
|
|
16121
|
+
function simplifyNameForComparison(name) {
|
|
16122
|
+
const stripped = name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
16123
16123
|
return stripped.endsWith("s") && stripped.length > 1 ? stripped.slice(0, -1) : stripped;
|
|
16124
16124
|
}
|
|
16125
16125
|
|
|
@@ -16421,9 +16421,9 @@ init_cache_keys();
|
|
|
16421
16421
|
import { execFile } from "node:child_process";
|
|
16422
16422
|
import { promisify } from "node:util";
|
|
16423
16423
|
var execFileAsync = promisify(execFile);
|
|
16424
|
-
async function binaryExists(
|
|
16424
|
+
async function binaryExists(name) {
|
|
16425
16425
|
try {
|
|
16426
|
-
await execFileAsync(process.platform === "win32" ? "where" : "which", [
|
|
16426
|
+
await execFileAsync(process.platform === "win32" ? "where" : "which", [name]);
|
|
16427
16427
|
return true;
|
|
16428
16428
|
} catch {
|
|
16429
16429
|
return false;
|
|
@@ -16893,20 +16893,20 @@ function collectSiblingRendererImports(sourceText) {
|
|
|
16893
16893
|
continue;
|
|
16894
16894
|
if (/-g(?:ql|gl)(?:$|\.)/i.test(importPath))
|
|
16895
16895
|
continue;
|
|
16896
|
-
for (const
|
|
16897
|
-
if (
|
|
16898
|
-
names.add(
|
|
16896
|
+
for (const name of parseImportedNames(importClause)) {
|
|
16897
|
+
if (name)
|
|
16898
|
+
names.add(name);
|
|
16899
16899
|
}
|
|
16900
16900
|
}
|
|
16901
16901
|
return [...names];
|
|
16902
16902
|
}
|
|
16903
16903
|
function hasSiblingForwardRender(sourceText, siblingImports) {
|
|
16904
|
-
return siblingImports.some((
|
|
16905
|
-
const renderPattern = new RegExp(`<${escapeRegExp(
|
|
16904
|
+
return siblingImports.some((name) => {
|
|
16905
|
+
const renderPattern = new RegExp(`<${escapeRegExp(name)}\\b[\\s\\S]*?(?:/>|</${escapeRegExp(name)}>)`);
|
|
16906
16906
|
if (!renderPattern.test(sourceText))
|
|
16907
16907
|
return false;
|
|
16908
|
-
const siblingSpreadPattern = new RegExp(`<${escapeRegExp(
|
|
16909
|
-
const propsPlusSiblingSpreadPattern = new RegExp(`<${escapeRegExp(
|
|
16908
|
+
const siblingSpreadPattern = new RegExp(`<${escapeRegExp(name)}\\b[^>]*\\{\\.\\.\\.(?!props\\b)[^}]+\\}`);
|
|
16909
|
+
const propsPlusSiblingSpreadPattern = new RegExp(`<${escapeRegExp(name)}\\b[^>]*\\{\\.\\.\\.props\\}[^>]*\\{\\.\\.\\.(?!props\\b)[^}]+\\}`);
|
|
16910
16910
|
return siblingSpreadPattern.test(sourceText) || propsPlusSiblingSpreadPattern.test(sourceText);
|
|
16911
16911
|
});
|
|
16912
16912
|
}
|
|
@@ -17153,34 +17153,34 @@ var DOM_PASS_THROUGH_PROPS = /* @__PURE__ */ new Set([
|
|
|
17153
17153
|
"modelValue",
|
|
17154
17154
|
"modelModifiers"
|
|
17155
17155
|
]);
|
|
17156
|
-
function isDomPassThroughProp(
|
|
17157
|
-
if (DOM_PASS_THROUGH_PROPS.has(
|
|
17156
|
+
function isDomPassThroughProp(name) {
|
|
17157
|
+
if (DOM_PASS_THROUGH_PROPS.has(name))
|
|
17158
17158
|
return true;
|
|
17159
|
-
if (/^aria[-A-Z]/.test(
|
|
17159
|
+
if (/^aria[-A-Z]/.test(name))
|
|
17160
17160
|
return true;
|
|
17161
|
-
return
|
|
17161
|
+
return name.startsWith("data-");
|
|
17162
17162
|
}
|
|
17163
17163
|
function preClassifyProp(prop) {
|
|
17164
|
-
const { name
|
|
17165
|
-
if (/^on[A-Z]/.test(
|
|
17164
|
+
const { name, type } = prop;
|
|
17165
|
+
if (/^on[A-Z]/.test(name) || type.includes("=> void") || type.includes("EventHandler")) {
|
|
17166
17166
|
return { category: "exclude" };
|
|
17167
17167
|
}
|
|
17168
|
-
if (
|
|
17168
|
+
if (name === "ref" || name === "innerRef" || type.includes("Ref<") || type.includes("RefObject<")) {
|
|
17169
17169
|
return { category: "exclude" };
|
|
17170
17170
|
}
|
|
17171
|
-
if (
|
|
17171
|
+
if (name === "testId" || name === "data-testid" || name === "dataTestId") {
|
|
17172
17172
|
return { category: "exclude" };
|
|
17173
17173
|
}
|
|
17174
|
-
if (
|
|
17174
|
+
if (name === "key") {
|
|
17175
17175
|
return { category: "exclude" };
|
|
17176
17176
|
}
|
|
17177
17177
|
if (type.includes("Dispatch<") || type.includes("SetStateAction")) {
|
|
17178
17178
|
return { category: "exclude" };
|
|
17179
17179
|
}
|
|
17180
|
-
if (isDomPassThroughProp(
|
|
17180
|
+
if (isDomPassThroughProp(name)) {
|
|
17181
17181
|
return { category: "exclude" };
|
|
17182
17182
|
}
|
|
17183
|
-
if (
|
|
17183
|
+
if (name === "name" && prop.domAttribute) {
|
|
17184
17184
|
return { category: "exclude" };
|
|
17185
17185
|
}
|
|
17186
17186
|
if (isStringLiteralUnion(type)) {
|
|
@@ -17189,36 +17189,36 @@ function preClassifyProp(prop) {
|
|
|
17189
17189
|
if (!isComplexType(type)) {
|
|
17190
17190
|
const designNameStart = /^(variant|size|spacing|gap|color|bg|theme|align|layout|orientation|position)/i;
|
|
17191
17191
|
const designNameEnd = /(Color|Size|Variant|Style)$/;
|
|
17192
|
-
if (designNameStart.test(
|
|
17192
|
+
if (designNameStart.test(name) || designNameEnd.test(name)) {
|
|
17193
17193
|
return { category: "design", cdfTypeHint: "string" };
|
|
17194
17194
|
}
|
|
17195
17195
|
}
|
|
17196
17196
|
if (isBooleanType(type)) {
|
|
17197
17197
|
const stateNames = ["disabled", "loading", "expanded", "isOpen", "selected", "checked", "active", "preview"];
|
|
17198
|
-
if (stateNames.includes(
|
|
17198
|
+
if (stateNames.includes(name)) {
|
|
17199
17199
|
return { category: "state", cdfTypeHint: "boolean" };
|
|
17200
17200
|
}
|
|
17201
17201
|
}
|
|
17202
17202
|
if (isBooleanType(type)) {
|
|
17203
17203
|
const visualToggle = /^(hide|show|enable|disable|vertical|horizontal|reverse|bold|italic|imageOn|with)/i;
|
|
17204
|
-
if (visualToggle.test(
|
|
17204
|
+
if (visualToggle.test(name)) {
|
|
17205
17205
|
return { category: "design", cdfTypeHint: "boolean" };
|
|
17206
17206
|
}
|
|
17207
17207
|
}
|
|
17208
|
-
if (
|
|
17208
|
+
if (name === "componentId" || name === "sectionKey" || name === "locale" || name === "variantIndex") {
|
|
17209
17209
|
return { category: "state", cdfTypeHint: "string" };
|
|
17210
17210
|
}
|
|
17211
17211
|
if (isStringType(type)) {
|
|
17212
17212
|
const urlNameStart = /^(href|url|link|src)/i;
|
|
17213
17213
|
const urlNameEnd = /(Url|Href|Link|Src)$/;
|
|
17214
|
-
if (urlNameStart.test(
|
|
17214
|
+
if (urlNameStart.test(name) || urlNameEnd.test(name)) {
|
|
17215
17215
|
return { category: "content", cdfTypeHint: "string" };
|
|
17216
17216
|
}
|
|
17217
17217
|
}
|
|
17218
17218
|
if (isStringType(type)) {
|
|
17219
17219
|
const textNameStart = /^(label|title|text|description|caption|heading|subheading|body|alt|name|placeholder|summary)/i;
|
|
17220
17220
|
const textNameEnd = /(Text|Label|Title|Name)$/;
|
|
17221
|
-
if (textNameStart.test(
|
|
17221
|
+
if (textNameStart.test(name) || textNameEnd.test(name)) {
|
|
17222
17222
|
return { category: "content", cdfTypeHint: "string" };
|
|
17223
17223
|
}
|
|
17224
17224
|
}
|
|
@@ -17427,7 +17427,7 @@ async function resolveComposition(request) {
|
|
|
17427
17427
|
timeoutMs: 12e4,
|
|
17428
17428
|
promptViaStdin: true,
|
|
17429
17429
|
bedrock,
|
|
17430
|
-
onDebugEvent: (
|
|
17430
|
+
onDebugEvent: (name, payload) => onDebugEvent?.("agent", { event: name, ...payload })
|
|
17431
17431
|
});
|
|
17432
17432
|
lastAgentExitCode = res.exitCode;
|
|
17433
17433
|
if (res.exitCode !== 0 && res.stderr.trim()) {
|
|
@@ -17688,7 +17688,7 @@ function collectDuplicateNames(components) {
|
|
|
17688
17688
|
sources.push(c2.source);
|
|
17689
17689
|
nameCounts.set(c2.name, sources);
|
|
17690
17690
|
}
|
|
17691
|
-
return [...nameCounts.entries()].filter(([, srcs]) => srcs.length > 1).map(([
|
|
17691
|
+
return [...nameCounts.entries()].filter(([, srcs]) => srcs.length > 1).map(([name, sources]) => ({ name, sources }));
|
|
17692
17692
|
}
|
|
17693
17693
|
|
|
17694
17694
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/filter-dropped-allowed-components.js
|
|
@@ -17779,7 +17779,7 @@ async function runOneGenerateComponent(options, component, index, total) {
|
|
|
17779
17779
|
});
|
|
17780
17780
|
}
|
|
17781
17781
|
}
|
|
17782
|
-
effectiveSlots = effectiveSlots.map((slot) => slot.allowedComponents ? { ...slot, allowedComponents: slot.allowedComponents.filter((
|
|
17782
|
+
effectiveSlots = effectiveSlots.map((slot) => slot.allowedComponents ? { ...slot, allowedComponents: slot.allowedComponents.filter((name) => allowedComponentNames2.has(name)) } : slot);
|
|
17783
17783
|
const cacheComponent = normalizeComponentForCache(component);
|
|
17784
17784
|
if (!noCache && precomputedCachedNames.has(component.name)) {
|
|
17785
17785
|
onProgress?.({ kind: "component:cached", index, total, name: component.name, pinned: false });
|
|
@@ -19618,7 +19618,7 @@ function collectDependents(components) {
|
|
|
19618
19618
|
function findRoots(components, selected) {
|
|
19619
19619
|
const scope = selected ? components.filter((c2) => selected.has(c2.name)) : components;
|
|
19620
19620
|
const dependents = collectDependents(scope);
|
|
19621
|
-
return scope.map((c2) => c2.name).filter((
|
|
19621
|
+
return scope.map((c2) => c2.name).filter((name) => !dependents.has(name)).sort();
|
|
19622
19622
|
}
|
|
19623
19623
|
function findCycleInClosure(root, reachable, components) {
|
|
19624
19624
|
const scopedComponents = components.filter((c2) => reachable.has(c2.name)).map((c2) => ({ name: c2.name, slots: c2.slots }));
|
|
@@ -19654,9 +19654,9 @@ function computeClosure(root, components) {
|
|
|
19654
19654
|
const reachable = walkReachable2(root, byName, known);
|
|
19655
19655
|
const cyclePath = findCycleInClosure(root, reachable, components);
|
|
19656
19656
|
if (cyclePath) {
|
|
19657
|
-
const nodes2 = [...reachable].sort().map((
|
|
19658
|
-
name
|
|
19659
|
-
depth:
|
|
19657
|
+
const nodes2 = [...reachable].sort().map((name) => ({
|
|
19658
|
+
name,
|
|
19659
|
+
depth: name === root ? 0 : 1,
|
|
19660
19660
|
path: [root],
|
|
19661
19661
|
parents: []
|
|
19662
19662
|
}));
|
|
@@ -19692,12 +19692,12 @@ function computeClosure(root, components) {
|
|
|
19692
19692
|
}
|
|
19693
19693
|
}
|
|
19694
19694
|
const nodes = [];
|
|
19695
|
-
for (const [
|
|
19695
|
+
for (const [name, d] of depth.entries()) {
|
|
19696
19696
|
nodes.push({
|
|
19697
|
-
name
|
|
19697
|
+
name,
|
|
19698
19698
|
depth: d,
|
|
19699
|
-
path: parentPath.get(
|
|
19700
|
-
parents: [...parents.get(
|
|
19699
|
+
path: parentPath.get(name),
|
|
19700
|
+
parents: [...parents.get(name) ?? /* @__PURE__ */ new Set()].sort()
|
|
19701
19701
|
});
|
|
19702
19702
|
}
|
|
19703
19703
|
nodes.sort((a, b) => a.depth - b.depth || a.name.localeCompare(b.name));
|
|
@@ -19720,8 +19720,8 @@ function findSharedDeps(closures) {
|
|
|
19720
19720
|
}
|
|
19721
19721
|
}
|
|
19722
19722
|
const out = /* @__PURE__ */ new Map();
|
|
19723
|
-
for (const [
|
|
19724
|
-
if (roots.length >= 2) out.set(
|
|
19723
|
+
for (const [name, roots] of counts.entries()) {
|
|
19724
|
+
if (roots.length >= 2) out.set(name, [...roots].sort());
|
|
19725
19725
|
}
|
|
19726
19726
|
return out;
|
|
19727
19727
|
}
|
|
@@ -19924,13 +19924,13 @@ function buildVisibleRows(props) {
|
|
|
19924
19924
|
...findRoots(subgraph),
|
|
19925
19925
|
...subgraph.filter((n) => hasDirectChild(n)).map((n) => n.name)
|
|
19926
19926
|
]);
|
|
19927
|
-
for (const
|
|
19928
|
-
const full = computeClosure(
|
|
19929
|
-
closures.set(
|
|
19927
|
+
for (const name of [...parentNames].sort()) {
|
|
19928
|
+
const full = computeClosure(name, subgraph);
|
|
19929
|
+
closures.set(name, { ...full, nodes: full.nodes.filter((n) => n.depth <= 1) });
|
|
19930
19930
|
}
|
|
19931
19931
|
const sharedDeps = findSharedDeps(closures);
|
|
19932
|
-
const hasCycleDepDirect = (
|
|
19933
|
-
const it = itemByKey.get(
|
|
19932
|
+
const hasCycleDepDirect = (name) => {
|
|
19933
|
+
const it = itemByKey.get(name)?.it;
|
|
19934
19934
|
if (!it) return false;
|
|
19935
19935
|
for (const target of allowedComponentNames(it.entry)) {
|
|
19936
19936
|
if (cycleParticipants.has(target)) return true;
|
|
@@ -20035,28 +20035,28 @@ function buildVisibleRows(props) {
|
|
|
20035
20035
|
});
|
|
20036
20036
|
});
|
|
20037
20037
|
}
|
|
20038
|
-
for (const
|
|
20039
|
-
const rec = itemByKey.get(
|
|
20038
|
+
for (const name of standaloneRoots) {
|
|
20039
|
+
const rec = itemByKey.get(name);
|
|
20040
20040
|
if (!rec) continue;
|
|
20041
20041
|
rows.push({
|
|
20042
20042
|
kind: "standalone",
|
|
20043
|
-
key: `stand:${
|
|
20044
|
-
label:
|
|
20043
|
+
key: `stand:${name}`,
|
|
20044
|
+
label: name,
|
|
20045
20045
|
indent: 0,
|
|
20046
20046
|
itemIdx: rec.idx
|
|
20047
20047
|
});
|
|
20048
20048
|
}
|
|
20049
20049
|
const nodeByName = new Map(subgraph.map((n) => [n.name, n]));
|
|
20050
|
-
const sharedLeafNames = [...sharedDeps.keys()].filter((
|
|
20050
|
+
const sharedLeafNames = [...sharedDeps.keys()].filter((name) => (nodeByName.get(name)?.slots.length ?? 0) === 0).sort();
|
|
20051
20051
|
const seenStandaloneNames = new Set(standaloneRoots);
|
|
20052
|
-
for (const
|
|
20053
|
-
if (seenStandaloneNames.has(
|
|
20054
|
-
const rec = itemByKey.get(
|
|
20052
|
+
for (const name of sharedLeafNames) {
|
|
20053
|
+
if (seenStandaloneNames.has(name)) continue;
|
|
20054
|
+
const rec = itemByKey.get(name);
|
|
20055
20055
|
if (!rec) continue;
|
|
20056
20056
|
rows.push({
|
|
20057
20057
|
kind: "standalone",
|
|
20058
|
-
key: `shared-standalone:${
|
|
20059
|
-
label: `${
|
|
20058
|
+
key: `shared-standalone:${name}`,
|
|
20059
|
+
label: `${name} (shared)`,
|
|
20060
20060
|
indent: 0,
|
|
20061
20061
|
sharedSuffix: true,
|
|
20062
20062
|
itemIdx: rec.idx
|
|
@@ -20072,13 +20072,13 @@ function buildVisibleRows(props) {
|
|
|
20072
20072
|
indent: 0,
|
|
20073
20073
|
itemIdx: -1
|
|
20074
20074
|
});
|
|
20075
|
-
for (const
|
|
20076
|
-
const rec = itemByKey.get(
|
|
20075
|
+
for (const name of flatNames) {
|
|
20076
|
+
const rec = itemByKey.get(name);
|
|
20077
20077
|
if (!rec) continue;
|
|
20078
20078
|
rows.push({
|
|
20079
20079
|
kind: "flat",
|
|
20080
|
-
key: `flat:${
|
|
20081
|
-
label:
|
|
20080
|
+
key: `flat:${name}`,
|
|
20081
|
+
label: name,
|
|
20082
20082
|
indent: 0,
|
|
20083
20083
|
itemIdx: rec.idx
|
|
20084
20084
|
});
|
|
@@ -20088,9 +20088,9 @@ function buildVisibleRows(props) {
|
|
|
20088
20088
|
if (filterVisibleKeys !== void 0) {
|
|
20089
20089
|
return rows.filter((row) => {
|
|
20090
20090
|
if (row.itemIdx < 0) return true;
|
|
20091
|
-
const
|
|
20092
|
-
if (
|
|
20093
|
-
return filterVisibleKeys.has(
|
|
20091
|
+
const name = items[row.itemIdx]?.key;
|
|
20092
|
+
if (name === void 0) return true;
|
|
20093
|
+
return filterVisibleKeys.has(name);
|
|
20094
20094
|
});
|
|
20095
20095
|
}
|
|
20096
20096
|
return rows;
|
|
@@ -20735,11 +20735,11 @@ function computeCycleAwareAcceptCascade(target, components, cycleUnits) {
|
|
|
20735
20735
|
const byName = new Map(components.map((c2) => [c2.name, c2]));
|
|
20736
20736
|
const visited = /* @__PURE__ */ new Set();
|
|
20737
20737
|
const queue = [];
|
|
20738
|
-
const enqueue = (
|
|
20739
|
-
if (visited.has(
|
|
20740
|
-
visited.add(
|
|
20741
|
-
queue.push(
|
|
20742
|
-
const unit = cycleUnits.get(
|
|
20738
|
+
const enqueue = (name) => {
|
|
20739
|
+
if (visited.has(name)) return;
|
|
20740
|
+
visited.add(name);
|
|
20741
|
+
queue.push(name);
|
|
20742
|
+
const unit = cycleUnits.get(name);
|
|
20743
20743
|
if (unit) {
|
|
20744
20744
|
for (const member of unit) {
|
|
20745
20745
|
if (!visited.has(member)) {
|
|
@@ -20864,7 +20864,7 @@ function buildScopeGraph(components) {
|
|
|
20864
20864
|
cycles = [];
|
|
20865
20865
|
}
|
|
20866
20866
|
const cycleParticipants = /* @__PURE__ */ new Set();
|
|
20867
|
-
for (const cycle of cycles) for (const
|
|
20867
|
+
for (const cycle of cycles) for (const name of cycle.path) cycleParticipants.add(name);
|
|
20868
20868
|
return {
|
|
20869
20869
|
nodes,
|
|
20870
20870
|
cycles,
|
|
@@ -21052,10 +21052,10 @@ function computeSidebarBudget({ rows, panelOpen, entryCount }) {
|
|
|
21052
21052
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/sidebar-navigation.ts
|
|
21053
21053
|
function collectExpandedGroupRoots(closures, cycleParticipants) {
|
|
21054
21054
|
const roots = /* @__PURE__ */ new Set();
|
|
21055
|
-
for (const [
|
|
21056
|
-
if (closure.nodes.length > 1) roots.add(
|
|
21055
|
+
for (const [name, closure] of closures.entries()) {
|
|
21056
|
+
if (closure.nodes.length > 1) roots.add(name);
|
|
21057
21057
|
}
|
|
21058
|
-
for (const
|
|
21058
|
+
for (const name of cycleParticipants) roots.add(name);
|
|
21059
21059
|
return roots;
|
|
21060
21060
|
}
|
|
21061
21061
|
function computeSidebarViewToggle({
|
|
@@ -21126,9 +21126,9 @@ function buildFlatDimPredicate(input) {
|
|
|
21126
21126
|
const isFlat = input.viewMode === "flat";
|
|
21127
21127
|
const keys = isFlat ? input.filterVisibleKeys : void 0;
|
|
21128
21128
|
if (!hasSearch && keys === void 0) return void 0;
|
|
21129
|
-
return (
|
|
21130
|
-
if (hasSearch && !fuzzyMatches(input.searchQuery,
|
|
21131
|
-
if (keys !== void 0 && !keys.has(
|
|
21129
|
+
return (name) => {
|
|
21130
|
+
if (hasSearch && !fuzzyMatches(input.searchQuery, name)) return true;
|
|
21131
|
+
if (keys !== void 0 && !keys.has(name)) return true;
|
|
21132
21132
|
return false;
|
|
21133
21133
|
};
|
|
21134
21134
|
}
|
|
@@ -21136,7 +21136,7 @@ function buildFlatDimPredicate(input) {
|
|
|
21136
21136
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/state.ts
|
|
21137
21137
|
function apply(state2, entries) {
|
|
21138
21138
|
const next = new Map(state2);
|
|
21139
|
-
for (const [
|
|
21139
|
+
for (const [name, decision] of entries) next.set(name, decision);
|
|
21140
21140
|
return next;
|
|
21141
21141
|
}
|
|
21142
21142
|
function reduceDecisions(state2, action, components, graph) {
|
|
@@ -21145,44 +21145,44 @@ function reduceDecisions(state2, action, components, graph) {
|
|
|
21145
21145
|
if (state2.get(action.name) === "accepted") return state2;
|
|
21146
21146
|
return apply(
|
|
21147
21147
|
state2,
|
|
21148
|
-
acceptCascade(graph, action.name).map((
|
|
21148
|
+
acceptCascade(graph, action.name).map((name) => [name, "accepted"])
|
|
21149
21149
|
);
|
|
21150
21150
|
}
|
|
21151
21151
|
case "reject": {
|
|
21152
21152
|
if (state2.get(action.name) === "rejected") return state2;
|
|
21153
21153
|
const { toReject, toDeselect } = rejectCascade(graph, action.name);
|
|
21154
21154
|
return apply(state2, [
|
|
21155
|
-
...toReject.map((
|
|
21156
|
-
...toDeselect.map((
|
|
21155
|
+
...toReject.map((name) => [name, "rejected"]),
|
|
21156
|
+
...toDeselect.map((name) => [name, "undecided"])
|
|
21157
21157
|
]);
|
|
21158
21158
|
}
|
|
21159
21159
|
case "toggle-all": {
|
|
21160
21160
|
const nonCycle = components.filter((c2) => !graph.cycleParticipants.has(c2.name)).map((c2) => c2.name);
|
|
21161
|
-
const anyNotAccepted = nonCycle.some((
|
|
21161
|
+
const anyNotAccepted = nonCycle.some((name) => state2.get(name) !== "accepted");
|
|
21162
21162
|
if (anyNotAccepted) {
|
|
21163
21163
|
return apply(state2, [
|
|
21164
|
-
...nonCycle.map((
|
|
21165
|
-
...reachableCycleMembers(graph, nonCycle).map((
|
|
21164
|
+
...nonCycle.map((name) => [name, "accepted"]),
|
|
21165
|
+
...reachableCycleMembers(graph, nonCycle).map((name) => [name, "accepted"])
|
|
21166
21166
|
]);
|
|
21167
21167
|
}
|
|
21168
21168
|
return apply(state2, [
|
|
21169
|
-
...nonCycle.map((
|
|
21169
|
+
...nonCycle.map((name) => [name, "rejected"]),
|
|
21170
21170
|
...components.filter((c2) => graph.cycleParticipants.has(c2.name) && state2.get(c2.name) === "accepted").map((c2) => [c2.name, "undecided"])
|
|
21171
21171
|
]);
|
|
21172
21172
|
}
|
|
21173
21173
|
case "accept-unflagged": {
|
|
21174
21174
|
const seeds = components.filter((c2) => !graph.cycleParticipants.has(c2.name) && !isAiFlagged(c2)).map((c2) => c2.name);
|
|
21175
21175
|
return apply(state2, [
|
|
21176
|
-
...seeds.map((
|
|
21177
|
-
...reachableCycleMembers(graph, seeds).map((
|
|
21176
|
+
...seeds.map((name) => [name, "accepted"]),
|
|
21177
|
+
...reachableCycleMembers(graph, seeds).map((name) => [name, "accepted"])
|
|
21178
21178
|
]);
|
|
21179
21179
|
}
|
|
21180
21180
|
}
|
|
21181
21181
|
}
|
|
21182
|
-
function rejectNeedsConfirmation(graph,
|
|
21183
|
-
if (state2.get(
|
|
21184
|
-
const { toReject, toDeselect } = rejectCascade(graph,
|
|
21185
|
-
const ancestors = toReject.filter((n) => n !==
|
|
21182
|
+
function rejectNeedsConfirmation(graph, name, state2) {
|
|
21183
|
+
if (state2.get(name) === "rejected") return false;
|
|
21184
|
+
const { toReject, toDeselect } = rejectCascade(graph, name);
|
|
21185
|
+
const ancestors = toReject.filter((n) => n !== name);
|
|
21186
21186
|
return ancestors.length + toDeselect.length >= 2;
|
|
21187
21187
|
}
|
|
21188
21188
|
function partitionDecisions(components, state2) {
|
|
@@ -21272,8 +21272,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21272
21272
|
for (const node of closure.nodes) keys.add(node.name);
|
|
21273
21273
|
}
|
|
21274
21274
|
for (const unit of cycleUnits.values()) {
|
|
21275
|
-
if (![...unit].some((
|
|
21276
|
-
for (const
|
|
21275
|
+
if (![...unit].some((name) => decisions.get(name) === "accepted")) continue;
|
|
21276
|
+
for (const name of unit) keys.add(name);
|
|
21277
21277
|
}
|
|
21278
21278
|
return keys;
|
|
21279
21279
|
}, [closures, cycleUnits, showDependencies, decisions]);
|
|
@@ -21371,12 +21371,12 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21371
21371
|
return void 0;
|
|
21372
21372
|
}
|
|
21373
21373
|
};
|
|
21374
|
-
const jumpCursorTo = (
|
|
21374
|
+
const jumpCursorTo = (name) => {
|
|
21375
21375
|
let idx = -1;
|
|
21376
21376
|
for (let i = 0; i < visibleRows.length; i++) {
|
|
21377
21377
|
const row = visibleRows[i];
|
|
21378
21378
|
if (row.itemIdx < 0) continue;
|
|
21379
|
-
if (groupedItems[row.itemIdx]?.key ===
|
|
21379
|
+
if (groupedItems[row.itemIdx]?.key === name) {
|
|
21380
21380
|
idx = i;
|
|
21381
21381
|
break;
|
|
21382
21382
|
}
|
|
@@ -21390,18 +21390,18 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21390
21390
|
});
|
|
21391
21391
|
};
|
|
21392
21392
|
const decide = (action) => setDecisions((prev) => reduceDecisions(prev, action, components, graph));
|
|
21393
|
-
const requestReject = (
|
|
21394
|
-
if (decisions.get(
|
|
21395
|
-
if (rejectNeedsConfirmation(graph,
|
|
21396
|
-
const { toReject, toDeselect } = rejectCascade(graph,
|
|
21393
|
+
const requestReject = (name) => {
|
|
21394
|
+
if (decisions.get(name) === "rejected") return;
|
|
21395
|
+
if (rejectNeedsConfirmation(graph, name, decisions)) {
|
|
21396
|
+
const { toReject, toDeselect } = rejectCascade(graph, name);
|
|
21397
21397
|
setPendingRejectCascade({
|
|
21398
|
-
target:
|
|
21399
|
-
ancestors: toReject.filter((n) => n !==
|
|
21398
|
+
target: name,
|
|
21399
|
+
ancestors: toReject.filter((n) => n !== name).sort(),
|
|
21400
21400
|
descendants: [...toDeselect].sort()
|
|
21401
21401
|
});
|
|
21402
21402
|
return;
|
|
21403
21403
|
}
|
|
21404
|
-
decide({ type: "reject", name
|
|
21404
|
+
decide({ type: "reject", name });
|
|
21405
21405
|
};
|
|
21406
21406
|
const mode = showHelp ? "help" : pendingRejectCascade ? "reject-prompt" : searchOpen ? "search" : cyclesPanelOpen ? "cycles" : aiRationalePanel.isOpen ? "flags" : "main";
|
|
21407
21407
|
const context = {
|
|
@@ -21880,25 +21880,25 @@ function formatAcceptanceSummary(counts) {
|
|
|
21880
21880
|
if (counts.autoRejected === 0) return `${accepted}.`;
|
|
21881
21881
|
return `${accepted}, ${counts.autoRejected} excluded due to validation errors.`;
|
|
21882
21882
|
}
|
|
21883
|
-
var capitalize = (
|
|
21883
|
+
var capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1);
|
|
21884
21884
|
function describeGeneration(input) {
|
|
21885
21885
|
const agent = capitalize(input.agent);
|
|
21886
21886
|
return `${formatAcceptanceSummary({ accepted: input.acceptedCount, autoRejected: 0 })}
|
|
21887
21887
|
${agent} is reading each selected component and writing a Contentful component definition for it.${input.hasTokens ? "\nUsing your design tokens for prop resolution." : ""}`;
|
|
21888
21888
|
}
|
|
21889
21889
|
function progressRows2(progress, agent) {
|
|
21890
|
-
const
|
|
21890
|
+
const name = capitalize(agent);
|
|
21891
21891
|
const { components, mapTokens } = progress;
|
|
21892
21892
|
const rows = [
|
|
21893
21893
|
{
|
|
21894
|
-
text: components ? components.current : `Starting up ${
|
|
21894
|
+
text: components ? components.current : `Starting up ${name}...`,
|
|
21895
21895
|
complete: false,
|
|
21896
21896
|
...components ? { progress: { done: components.done, total: components.total } } : {}
|
|
21897
21897
|
}
|
|
21898
21898
|
];
|
|
21899
21899
|
if (mapTokens !== "idle") {
|
|
21900
21900
|
rows.push({
|
|
21901
|
-
text: mapTokens === "running" ? `Mapping token restrictions via ${
|
|
21901
|
+
text: mapTokens === "running" ? `Mapping token restrictions via ${name}...` : "Token restrictions ready",
|
|
21902
21902
|
complete: mapTokens === "complete"
|
|
21903
21903
|
});
|
|
21904
21904
|
}
|
|
@@ -22139,18 +22139,6 @@ function buildFlowStart(input) {
|
|
|
22139
22139
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/screen.tsx
|
|
22140
22140
|
import { Box as Box45 } from "ink";
|
|
22141
22141
|
|
|
22142
|
-
// packages/experience-design-system-types/dist/src/source-input-association.js
|
|
22143
|
-
import * as z3 from "zod/mini";
|
|
22144
|
-
var name = z3.string().check(z3.refine((value) => value.trim().length > 0));
|
|
22145
|
-
var SourceInputAssociationSchema = z3.strictObject({
|
|
22146
|
-
schemaVersion: z3.literal(1),
|
|
22147
|
-
componentId: name,
|
|
22148
|
-
componentDeclarationId: name,
|
|
22149
|
-
rootSymbolId: name,
|
|
22150
|
-
inputName: name,
|
|
22151
|
-
inputPath: z3.array(name).check(z3.minLength(1))
|
|
22152
|
-
}).check(z3.refine((value) => value.inputPath[0] === value.inputName));
|
|
22153
|
-
|
|
22154
22142
|
// packages/experience-design-system-types/dist/src/cdf/validate.js
|
|
22155
22143
|
import { Ajv as Ajv2 } from "ajv";
|
|
22156
22144
|
|
|
@@ -22319,32 +22307,32 @@ function validateCDF2(input) {
|
|
|
22319
22307
|
}
|
|
22320
22308
|
|
|
22321
22309
|
// packages/experience-design-system-types/dist/src/cdf/types.js
|
|
22322
|
-
import * as
|
|
22323
|
-
var CDFPropertySchema2 =
|
|
22324
|
-
$type:
|
|
22325
|
-
$category:
|
|
22326
|
-
$description:
|
|
22327
|
-
$required:
|
|
22328
|
-
$default:
|
|
22329
|
-
$values:
|
|
22330
|
-
"$token.kind":
|
|
22331
|
-
"$token.allowed":
|
|
22310
|
+
import * as z3 from "zod/mini";
|
|
22311
|
+
var CDFPropertySchema2 = z3.strictObject({
|
|
22312
|
+
$type: z3.enum(CDF_PROPERTY_TYPES2),
|
|
22313
|
+
$category: z3.enum(CDF_PROPERTY_CATEGORIES2),
|
|
22314
|
+
$description: z3.optional(z3.string()),
|
|
22315
|
+
$required: z3.optional(z3.boolean()),
|
|
22316
|
+
$default: z3.optional(z3.any()),
|
|
22317
|
+
$values: z3.optional(z3.array(z3.string())),
|
|
22318
|
+
"$token.kind": z3.optional(z3.string()),
|
|
22319
|
+
"$token.allowed": z3.optional(z3.array(z3.string()))
|
|
22332
22320
|
});
|
|
22333
|
-
var CDFSlotSchema2 =
|
|
22334
|
-
$description:
|
|
22335
|
-
$allowedComponents:
|
|
22336
|
-
$required:
|
|
22321
|
+
var CDFSlotSchema2 = z3.strictObject({
|
|
22322
|
+
$description: z3.optional(z3.string()),
|
|
22323
|
+
$allowedComponents: z3.optional(z3.array(z3.string())),
|
|
22324
|
+
$required: z3.optional(z3.boolean())
|
|
22337
22325
|
});
|
|
22338
|
-
var CDFComponentSchema2 =
|
|
22339
|
-
$type:
|
|
22340
|
-
$description:
|
|
22341
|
-
$properties:
|
|
22342
|
-
$slots:
|
|
22326
|
+
var CDFComponentSchema2 = z3.strictObject({
|
|
22327
|
+
$type: z3.literal("component"),
|
|
22328
|
+
$description: z3.optional(z3.string()),
|
|
22329
|
+
$properties: z3.record(z3.string(), CDFPropertySchema2),
|
|
22330
|
+
$slots: z3.optional(z3.record(z3.string(), CDFSlotSchema2))
|
|
22343
22331
|
});
|
|
22344
|
-
var CDFTokenSchema2 =
|
|
22345
|
-
$type:
|
|
22346
|
-
$value:
|
|
22347
|
-
$description:
|
|
22332
|
+
var CDFTokenSchema2 = z3.strictObject({
|
|
22333
|
+
$type: z3.enum(DESIGN_TOKEN_TYPES2),
|
|
22334
|
+
$value: z3.unknown(),
|
|
22335
|
+
$description: z3.optional(z3.string())
|
|
22348
22336
|
});
|
|
22349
22337
|
|
|
22350
22338
|
// packages/experience-design-system-types/dist/src/cdf/build.js
|
|
@@ -22352,9 +22340,9 @@ function stripUnsupportedSlotFields(entry) {
|
|
|
22352
22340
|
if (!entry.$slots)
|
|
22353
22341
|
return entry;
|
|
22354
22342
|
const cleaned = {};
|
|
22355
|
-
for (const [
|
|
22343
|
+
for (const [name, slot] of Object.entries(entry.$slots)) {
|
|
22356
22344
|
const { $required: _required, ...rest } = slot;
|
|
22357
|
-
cleaned[
|
|
22345
|
+
cleaned[name] = rest;
|
|
22358
22346
|
}
|
|
22359
22347
|
return { ...entry, $slots: cleaned };
|
|
22360
22348
|
}
|
|
@@ -22397,7 +22385,7 @@ function validateSlotReferences2(components) {
|
|
|
22397
22385
|
const slots = entry.$slots ?? {};
|
|
22398
22386
|
for (const [slotKey, slot] of Object.entries(slots)) {
|
|
22399
22387
|
const allowed = slot?.$allowedComponents ?? [];
|
|
22400
|
-
const unresolved = allowed.filter((
|
|
22388
|
+
const unresolved = allowed.filter((name) => !componentKeys.has(name));
|
|
22401
22389
|
if (unresolved.length === 0)
|
|
22402
22390
|
continue;
|
|
22403
22391
|
errors.push({
|
|
@@ -22423,12 +22411,12 @@ function setAtPath(root, dottedPath, value) {
|
|
|
22423
22411
|
}
|
|
22424
22412
|
|
|
22425
22413
|
// packages/experience-design-system-types/dist/src/dtcg/types.js
|
|
22426
|
-
import * as
|
|
22427
|
-
var DTCGTokenSchema2 =
|
|
22428
|
-
path:
|
|
22429
|
-
$type:
|
|
22430
|
-
$value:
|
|
22431
|
-
$description:
|
|
22414
|
+
import * as z4 from "zod/mini";
|
|
22415
|
+
var DTCGTokenSchema2 = z4.strictObject({
|
|
22416
|
+
path: z4.string(),
|
|
22417
|
+
$type: z4.enum(DESIGN_TOKEN_TYPES2),
|
|
22418
|
+
$value: z4.unknown(),
|
|
22419
|
+
$description: z4.optional(z4.string())
|
|
22432
22420
|
});
|
|
22433
22421
|
|
|
22434
22422
|
// packages/experience-design-system-types/dist/src/dtcg/validate.js
|
|
@@ -22438,8 +22426,8 @@ var TOKEN_TYPE_SET4 = new Set(DESIGN_TOKEN_TYPES2);
|
|
|
22438
22426
|
var nodeTypes = globalThis.process?.getBuiltinModule?.("node:util")?.types;
|
|
22439
22427
|
|
|
22440
22428
|
// packages/experience-design-system-types/dist/src/property-contract/date-time-value.js
|
|
22441
|
-
import * as
|
|
22442
|
-
var dateTimeValueSchema =
|
|
22429
|
+
import * as z5 from "zod/mini";
|
|
22430
|
+
var dateTimeValueSchema = z5.iso.datetime({ offset: true });
|
|
22443
22431
|
|
|
22444
22432
|
// packages/experience-design-system-types/dist/src/property-contract/target-definition.js
|
|
22445
22433
|
var TARGET_PROPERTY_TYPES = [
|
|
@@ -22527,7 +22515,7 @@ function failedComponentNames(errors) {
|
|
|
22527
22515
|
return [...new Set(errors.map((error) => error.componentName))];
|
|
22528
22516
|
}
|
|
22529
22517
|
function matchedComponentNames(errors, missingNames) {
|
|
22530
|
-
return failedComponentNames(errors).filter((
|
|
22518
|
+
return failedComponentNames(errors).filter((name) => !missingNames.includes(name));
|
|
22531
22519
|
}
|
|
22532
22520
|
function formatErrorLine(error) {
|
|
22533
22521
|
const context = [`Component: ${error.componentName}`, error.path ? `Path: ${error.path}` : null].filter(Boolean);
|
|
@@ -22657,11 +22645,11 @@ function computeRenderStatuses(closure, directIssues) {
|
|
|
22657
22645
|
inheritedSources.get(ancestor).set(node.name, ownStatus);
|
|
22658
22646
|
}
|
|
22659
22647
|
}
|
|
22660
|
-
for (const [
|
|
22661
|
-
out.set(
|
|
22648
|
+
for (const [name, status] of own2.entries()) {
|
|
22649
|
+
out.set(name, {
|
|
22662
22650
|
status,
|
|
22663
22651
|
isOwn: true,
|
|
22664
|
-
sourceComponents: [
|
|
22652
|
+
sourceComponents: [name]
|
|
22665
22653
|
});
|
|
22666
22654
|
}
|
|
22667
22655
|
for (const [ancestor, sources] of inheritedSources.entries()) {
|
|
@@ -22926,7 +22914,7 @@ function parseToState(json) {
|
|
|
22926
22914
|
}
|
|
22927
22915
|
const componentDescription = typeof component.$description === "string" ? component.$description : "";
|
|
22928
22916
|
const rawProps = component.$properties ?? {};
|
|
22929
|
-
const props = Object.entries(rawProps).map(([
|
|
22917
|
+
const props = Object.entries(rawProps).map(([name, raw]) => {
|
|
22930
22918
|
const p = raw ?? {};
|
|
22931
22919
|
const type = CDF_PROPERTY_TYPES2.includes(p.$type) ? p.$type : "string";
|
|
22932
22920
|
let defaultValue = null;
|
|
@@ -22938,7 +22926,7 @@ function parseToState(json) {
|
|
|
22938
22926
|
}
|
|
22939
22927
|
}
|
|
22940
22928
|
return {
|
|
22941
|
-
name
|
|
22929
|
+
name,
|
|
22942
22930
|
type,
|
|
22943
22931
|
category: CDF_PROPERTY_CATEGORIES2.includes(p.$category) ? p.$category : "content",
|
|
22944
22932
|
required: p.$required === true,
|
|
@@ -22950,10 +22938,10 @@ function parseToState(json) {
|
|
|
22950
22938
|
};
|
|
22951
22939
|
});
|
|
22952
22940
|
const rawSlots = component.$slots ?? {};
|
|
22953
|
-
const slots = Object.entries(rawSlots).map(([
|
|
22941
|
+
const slots = Object.entries(rawSlots).map(([name, raw]) => {
|
|
22954
22942
|
const s = raw ?? {};
|
|
22955
22943
|
return {
|
|
22956
|
-
name
|
|
22944
|
+
name,
|
|
22957
22945
|
description: typeof s.$description === "string" ? s.$description : "",
|
|
22958
22946
|
required: s.$required === true,
|
|
22959
22947
|
allowedComponents: Array.isArray(s.$allowedComponents) ? s.$allowedComponents.filter((v) => typeof v === "string") : []
|
|
@@ -23061,7 +23049,7 @@ function DefaultValueRow({
|
|
|
23061
23049
|
] });
|
|
23062
23050
|
}
|
|
23063
23051
|
function RowLabel({
|
|
23064
|
-
name
|
|
23052
|
+
name,
|
|
23065
23053
|
selected,
|
|
23066
23054
|
trailing = true
|
|
23067
23055
|
}) {
|
|
@@ -23074,7 +23062,7 @@ function RowLabel({
|
|
|
23074
23062
|
wrap: "truncate-end",
|
|
23075
23063
|
children: [
|
|
23076
23064
|
" ",
|
|
23077
|
-
|
|
23065
|
+
name,
|
|
23078
23066
|
trailing ? " " : ""
|
|
23079
23067
|
]
|
|
23080
23068
|
}
|
|
@@ -23426,10 +23414,10 @@ function SlotRow({
|
|
|
23426
23414
|
const slice = filtered.slice(start, start + MAX_VISIBLE);
|
|
23427
23415
|
return /* @__PURE__ */ jsxs26(Box26, { flexDirection: "column", children: [
|
|
23428
23416
|
/* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: " candidates (\u2191\u2193 cycle, Enter to add):" }),
|
|
23429
|
-
slice.map((
|
|
23417
|
+
slice.map((name, i) => {
|
|
23430
23418
|
const absIdx = start + i;
|
|
23431
23419
|
const isCursor = absIdx === cursor;
|
|
23432
|
-
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${
|
|
23420
|
+
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${name}` : ` ${name}` }, name);
|
|
23433
23421
|
})
|
|
23434
23422
|
] });
|
|
23435
23423
|
})() })
|
|
@@ -24326,8 +24314,8 @@ function FieldEditor({
|
|
|
24326
24314
|
const hasEmptyProperties = props.length === 0 && slots.length === 0;
|
|
24327
24315
|
const modeLabel = (() => {
|
|
24328
24316
|
if (pendingDelete) {
|
|
24329
|
-
const
|
|
24330
|
-
return `Delete ${pendingDelete.kind} "${
|
|
24317
|
+
const name = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
|
|
24318
|
+
return `Delete ${pendingDelete.kind} "${name}"? [y] delete \xB7 any other key cancels`;
|
|
24331
24319
|
}
|
|
24332
24320
|
if (editingValue) {
|
|
24333
24321
|
return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
|
|
@@ -25456,7 +25444,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
25456
25444
|
);
|
|
25457
25445
|
db.exec("BEGIN");
|
|
25458
25446
|
try {
|
|
25459
|
-
for (const
|
|
25447
|
+
for (const name of toReject) statement.run(extractSessionId, name);
|
|
25460
25448
|
db.exec("COMMIT");
|
|
25461
25449
|
} catch (error) {
|
|
25462
25450
|
db.exec("ROLLBACK");
|
|
@@ -26362,13 +26350,13 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26362
26350
|
const unchanged = new Set(preview.components.unchanged);
|
|
26363
26351
|
const changedNames = /* @__PURE__ */ new Set();
|
|
26364
26352
|
for (const item of preview.components.changed) {
|
|
26365
|
-
const
|
|
26366
|
-
if (typeof
|
|
26367
|
-
changedNames.add(
|
|
26353
|
+
const name = item.current?.name;
|
|
26354
|
+
if (typeof name !== "string") continue;
|
|
26355
|
+
changedNames.add(name);
|
|
26368
26356
|
if (item.changeClassification?.classification === "breaking") {
|
|
26369
|
-
out.set(
|
|
26357
|
+
out.set(name, "breaking");
|
|
26370
26358
|
} else {
|
|
26371
|
-
out.set(
|
|
26359
|
+
out.set(name, "changed");
|
|
26372
26360
|
}
|
|
26373
26361
|
}
|
|
26374
26362
|
const removedNames = /* @__PURE__ */ new Set();
|
|
@@ -26378,12 +26366,12 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26378
26366
|
out.set(entity.name, "removed");
|
|
26379
26367
|
}
|
|
26380
26368
|
}
|
|
26381
|
-
for (const
|
|
26382
|
-
if (unchanged.has(
|
|
26383
|
-
if (changedNames.has(
|
|
26384
|
-
if (removedNames.has(
|
|
26385
|
-
if (out.has(
|
|
26386
|
-
out.set(
|
|
26369
|
+
for (const name of localNames) {
|
|
26370
|
+
if (unchanged.has(name)) continue;
|
|
26371
|
+
if (changedNames.has(name)) continue;
|
|
26372
|
+
if (removedNames.has(name)) continue;
|
|
26373
|
+
if (out.has(name)) continue;
|
|
26374
|
+
out.set(name, "new");
|
|
26387
26375
|
}
|
|
26388
26376
|
return out;
|
|
26389
26377
|
}
|
|
@@ -27137,10 +27125,10 @@ function GenerateReviewStepView({
|
|
|
27137
27125
|
const merged = /* @__PURE__ */ new Map();
|
|
27138
27126
|
for (const closure of closures.values()) {
|
|
27139
27127
|
const per = computeRenderStatuses(closure, directIssues);
|
|
27140
|
-
for (const [
|
|
27141
|
-
const existing = merged.get(
|
|
27128
|
+
for (const [name, rs] of per.entries()) {
|
|
27129
|
+
const existing = merged.get(name);
|
|
27142
27130
|
if (!existing || !existing.isOwn && rs.isOwn) {
|
|
27143
|
-
merged.set(
|
|
27131
|
+
merged.set(name, rs);
|
|
27144
27132
|
}
|
|
27145
27133
|
}
|
|
27146
27134
|
}
|
|
@@ -27195,11 +27183,11 @@ function GenerateReviewStepView({
|
|
|
27195
27183
|
reviewEditor.setSaveError(null);
|
|
27196
27184
|
setPendingEditorFocus(null);
|
|
27197
27185
|
};
|
|
27198
|
-
const jumpCursorToName = (
|
|
27186
|
+
const jumpCursorToName = (name) => {
|
|
27199
27187
|
for (let i = 0; i < visibleRowsMemo.length; i++) {
|
|
27200
27188
|
const row = visibleRowsMemo[i];
|
|
27201
27189
|
if (row.itemIdx < 0) continue;
|
|
27202
|
-
if (components[row.itemIdx]?.key ===
|
|
27190
|
+
if (components[row.itemIdx]?.key === name) {
|
|
27203
27191
|
jumpCursorToRow(i);
|
|
27204
27192
|
return;
|
|
27205
27193
|
}
|
|
@@ -27727,8 +27715,8 @@ function GenerateReviewStepView({
|
|
|
27727
27715
|
}
|
|
27728
27716
|
),
|
|
27729
27717
|
!dialogOpen && autoRejected.length > 0 && (() => {
|
|
27730
|
-
const stillRejected = autoRejected.filter((
|
|
27731
|
-
const c2 = components.find((x) => x.key ===
|
|
27718
|
+
const stillRejected = autoRejected.filter((name) => {
|
|
27719
|
+
const c2 = components.find((x) => x.key === name);
|
|
27732
27720
|
return c2?.status === "rejected";
|
|
27733
27721
|
});
|
|
27734
27722
|
if (stillRejected.length === 0) return null;
|
|
@@ -28239,31 +28227,31 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
28239
28227
|
const proposedProperties = proposed["$properties"] ?? {};
|
|
28240
28228
|
const proposedProps = new Set(Object.keys(proposedProperties));
|
|
28241
28229
|
const oldProps = current.fullProperties;
|
|
28242
|
-
for (const
|
|
28243
|
-
if (!currentProps.has(
|
|
28244
|
-
const def = proposedProperties[
|
|
28245
|
-
lines.push({ key: `${
|
|
28230
|
+
for (const name of [...proposedProps].sort()) {
|
|
28231
|
+
if (!currentProps.has(name)) {
|
|
28232
|
+
const def = proposedProperties[name];
|
|
28233
|
+
lines.push({ key: `${name}-add`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(def)}` });
|
|
28246
28234
|
}
|
|
28247
28235
|
}
|
|
28248
|
-
for (const
|
|
28249
|
-
if (!proposedProps.has(
|
|
28250
|
-
if (oldProps?.[
|
|
28251
|
-
lines.push({ key: `${
|
|
28236
|
+
for (const name of [...currentProps].sort()) {
|
|
28237
|
+
if (!proposedProps.has(name)) {
|
|
28238
|
+
if (oldProps?.[name]) {
|
|
28239
|
+
lines.push({ key: `${name}-rm`, color: PALETTE.error, text: `- ${name}: ${formatOldProp(oldProps[name])}` });
|
|
28252
28240
|
} else {
|
|
28253
|
-
const cat = current.contentProperties.includes(
|
|
28254
|
-
lines.push({ key: `${
|
|
28241
|
+
const cat = current.contentProperties.includes(name) ? "content" : "design";
|
|
28242
|
+
lines.push({ key: `${name}-rm`, color: PALETTE.error, text: `- ${name} (${cat})` });
|
|
28255
28243
|
}
|
|
28256
28244
|
}
|
|
28257
28245
|
}
|
|
28258
28246
|
const handledProps = /* @__PURE__ */ new Set();
|
|
28259
|
-
for (const
|
|
28260
|
-
if (!proposedProps.has(
|
|
28261
|
-
const newDef = proposedProperties[
|
|
28262
|
-
const oldDef = oldProps?.[
|
|
28247
|
+
for (const name of [...currentProps].sort()) {
|
|
28248
|
+
if (!proposedProps.has(name)) continue;
|
|
28249
|
+
const newDef = proposedProperties[name];
|
|
28250
|
+
const oldDef = oldProps?.[name];
|
|
28263
28251
|
if (!oldDef) continue;
|
|
28264
|
-
const diffs = diffProperty(
|
|
28252
|
+
const diffs = diffProperty(name, oldDef, newDef);
|
|
28265
28253
|
if (diffs.length > 0) {
|
|
28266
|
-
handledProps.add(
|
|
28254
|
+
handledProps.add(name);
|
|
28267
28255
|
for (const d of diffs) lines.push(d);
|
|
28268
28256
|
}
|
|
28269
28257
|
}
|
|
@@ -28286,40 +28274,40 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
28286
28274
|
const proposedSlots = proposed["$slots"] ?? {};
|
|
28287
28275
|
const proposedSlotNames = new Set(Object.keys(proposedSlots));
|
|
28288
28276
|
const currentSlotAllowed = current.currentSlotAllowed ?? {};
|
|
28289
|
-
for (const
|
|
28290
|
-
if (!currentSlots.has(
|
|
28291
|
-
lines.push({ key: `slot-${
|
|
28277
|
+
for (const name of [...proposedSlotNames].sort()) {
|
|
28278
|
+
if (!currentSlots.has(name)) {
|
|
28279
|
+
lines.push({ key: `slot-${name}-add`, color: PALETTE.success, text: `+ slot: ${name}` });
|
|
28292
28280
|
}
|
|
28293
28281
|
}
|
|
28294
|
-
for (const
|
|
28295
|
-
if (!proposedSlotNames.has(
|
|
28296
|
-
lines.push({ key: `slot-${
|
|
28282
|
+
for (const name of [...currentSlots].sort()) {
|
|
28283
|
+
if (!proposedSlotNames.has(name)) {
|
|
28284
|
+
lines.push({ key: `slot-${name}-rm`, color: PALETTE.error, text: `- slot: ${name}` });
|
|
28297
28285
|
}
|
|
28298
28286
|
}
|
|
28299
|
-
for (const
|
|
28300
|
-
const nextAllowed = normalizeAllowedComponents(proposedSlots[
|
|
28301
|
-
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[
|
|
28302
|
-
const prevExists = currentSlots.has(
|
|
28287
|
+
for (const name of [...proposedSlotNames].sort()) {
|
|
28288
|
+
const nextAllowed = normalizeAllowedComponents(proposedSlots[name]?.["$allowedComponents"]);
|
|
28289
|
+
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[name]);
|
|
28290
|
+
const prevExists = currentSlots.has(name);
|
|
28303
28291
|
if (!prevExists) {
|
|
28304
28292
|
if (nextAllowed.length > 0) {
|
|
28305
28293
|
lines.push({
|
|
28306
|
-
key: `slot-${
|
|
28294
|
+
key: `slot-${name}-allow-new`,
|
|
28307
28295
|
color: PALETTE.success,
|
|
28308
|
-
text: `+ slot ${
|
|
28296
|
+
text: `+ slot ${name} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
28309
28297
|
});
|
|
28310
28298
|
}
|
|
28311
28299
|
continue;
|
|
28312
28300
|
}
|
|
28313
28301
|
if (arraysEqual(prevAllowed, nextAllowed)) continue;
|
|
28314
28302
|
lines.push({
|
|
28315
|
-
key: `slot-${
|
|
28303
|
+
key: `slot-${name}-allow-old`,
|
|
28316
28304
|
color: PALETTE.error,
|
|
28317
|
-
text: `- slot ${
|
|
28305
|
+
text: `- slot ${name} allowedComponents: [${prevAllowed.join(", ")}]`
|
|
28318
28306
|
});
|
|
28319
28307
|
lines.push({
|
|
28320
|
-
key: `slot-${
|
|
28308
|
+
key: `slot-${name}-allow-new`,
|
|
28321
28309
|
color: PALETTE.success,
|
|
28322
|
-
text: `+ slot ${
|
|
28310
|
+
text: `+ slot ${name} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
28323
28311
|
});
|
|
28324
28312
|
}
|
|
28325
28313
|
return lines;
|
|
@@ -28355,7 +28343,7 @@ function normalizeType(type) {
|
|
|
28355
28343
|
return type.toLowerCase();
|
|
28356
28344
|
}
|
|
28357
28345
|
}
|
|
28358
|
-
function diffProperty(
|
|
28346
|
+
function diffProperty(name, old, newDef) {
|
|
28359
28347
|
const diffs = [];
|
|
28360
28348
|
const newType = newDef["$type"] ?? "";
|
|
28361
28349
|
const newCategory = newDef["$category"] ?? "";
|
|
@@ -28366,15 +28354,15 @@ function diffProperty(name2, old, newDef) {
|
|
|
28366
28354
|
const requiredChanged = old.required !== newRequired;
|
|
28367
28355
|
const defaultChanged = JSON.stringify(old.default) !== JSON.stringify(newDefault);
|
|
28368
28356
|
if (!typeChanged && !categoryChanged && !requiredChanged && !defaultChanged) return [];
|
|
28369
|
-
diffs.push({ key: `${
|
|
28370
|
-
diffs.push({ key: `${
|
|
28357
|
+
diffs.push({ key: `${name}-old`, color: PALETTE.error, text: `- ${name}: ${formatOldProp(old)}` });
|
|
28358
|
+
diffs.push({ key: `${name}-new`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(newDef)}` });
|
|
28371
28359
|
return diffs;
|
|
28372
28360
|
}
|
|
28373
28361
|
function formatDefault(value) {
|
|
28374
28362
|
const sys = value?.sys;
|
|
28375
28363
|
if (sys?.linkType === "Contentful:DesignToken" && typeof sys.urn === "string") {
|
|
28376
|
-
const
|
|
28377
|
-
if (
|
|
28364
|
+
const name = sys.urn.split("/designTokens/")[1];
|
|
28365
|
+
if (name) return name;
|
|
28378
28366
|
}
|
|
28379
28367
|
return JSON.stringify(value);
|
|
28380
28368
|
}
|
|
@@ -28427,8 +28415,8 @@ function buildPreviewSummaryLines(preview) {
|
|
|
28427
28415
|
text: ` \uFF0B ${components.new.length} components will be created`
|
|
28428
28416
|
});
|
|
28429
28417
|
for (const [index, item] of components.new.entries()) {
|
|
28430
|
-
const
|
|
28431
|
-
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${
|
|
28418
|
+
const name = item.key ?? item.$name ?? "unknown";
|
|
28419
|
+
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${name}` });
|
|
28432
28420
|
}
|
|
28433
28421
|
}
|
|
28434
28422
|
if (components.changed.length > 0) {
|
|
@@ -28521,27 +28509,27 @@ function getPreviewScrollOffset(input, downArrow, upArrow, diffExpanded, current
|
|
|
28521
28509
|
}
|
|
28522
28510
|
return void 0;
|
|
28523
28511
|
}
|
|
28524
|
-
function appendChangedPreviewLine(lines, keyPrefix,
|
|
28512
|
+
function appendChangedPreviewLine(lines, keyPrefix, name, hasPendingDraftChanges, changeClassification) {
|
|
28525
28513
|
lines.push({
|
|
28526
|
-
key: `${keyPrefix}-h-${
|
|
28514
|
+
key: `${keyPrefix}-h-${name}`,
|
|
28527
28515
|
color: PALETTE.warning,
|
|
28528
|
-
text: ` ~ ${
|
|
28516
|
+
text: ` ~ ${name}${hasPendingDraftChanges ? " \u26A1 has pending draft changes" : ""}`
|
|
28529
28517
|
});
|
|
28530
28518
|
if (changeClassification?.classification !== "breaking") return;
|
|
28531
28519
|
const reasons = changeClassification.breakingChanges.map((bc) => `${"slotId" in bc ? bc.slotId : bc.propertyId}: ${bc.reason}`).join(", ");
|
|
28532
|
-
lines.push({ key: `${keyPrefix}-b-${
|
|
28520
|
+
lines.push({ key: `${keyPrefix}-b-${name}`, color: PALETTE.error, text: ` \u26A0 BREAKING: ${reasons}` });
|
|
28533
28521
|
}
|
|
28534
28522
|
function buildPreviewDiffLines(preview) {
|
|
28535
28523
|
const lines = [];
|
|
28536
28524
|
const { components, tokens } = preview;
|
|
28537
28525
|
for (const item of components.new) {
|
|
28538
28526
|
const raw = item;
|
|
28539
|
-
const
|
|
28540
|
-
lines.push({ key: `comp-new-${
|
|
28527
|
+
const name = raw.key ?? raw.$name ?? "unknown";
|
|
28528
|
+
lines.push({ key: `comp-new-${name}`, color: PALETTE.success, text: ` + ${name}` });
|
|
28541
28529
|
const slots = raw.$slots ?? {};
|
|
28542
28530
|
for (const slotName of Object.keys(slots).sort()) {
|
|
28543
28531
|
lines.push({
|
|
28544
|
-
key: `comp-new-${
|
|
28532
|
+
key: `comp-new-${name}-slot-${slotName}`,
|
|
28545
28533
|
color: PALETTE.success,
|
|
28546
28534
|
text: ` slot: ${slotName}`
|
|
28547
28535
|
});
|
|
@@ -28549,7 +28537,7 @@ function buildPreviewDiffLines(preview) {
|
|
|
28549
28537
|
if (Array.isArray(allowed) && allowed.length > 0) {
|
|
28550
28538
|
const names = allowed.filter((n) => typeof n === "string");
|
|
28551
28539
|
lines.push({
|
|
28552
|
-
key: `comp-new-${
|
|
28540
|
+
key: `comp-new-${name}-slot-${slotName}-allow`,
|
|
28553
28541
|
color: PALETTE.success,
|
|
28554
28542
|
text: ` allowedComponents: [${names.join(", ")}]`
|
|
28555
28543
|
});
|
|
@@ -28587,8 +28575,8 @@ function buildPreviewDiffLines(preview) {
|
|
|
28587
28575
|
}
|
|
28588
28576
|
for (const item of tokens.new) {
|
|
28589
28577
|
const raw = item;
|
|
28590
|
-
const
|
|
28591
|
-
lines.push({ key: `tok-new-${
|
|
28578
|
+
const name = raw.name ?? raw.path ?? "unknown";
|
|
28579
|
+
lines.push({ key: `tok-new-${name}`, color: PALETTE.success, text: ` + ${name}` });
|
|
28592
28580
|
}
|
|
28593
28581
|
for (const item of tokens.removed) {
|
|
28594
28582
|
lines.push({ key: `tok-rm-${item.name}`, color: PALETTE.error, text: ` - ${item.name}` });
|
|
@@ -29788,7 +29776,7 @@ init_config();
|
|
|
29788
29776
|
import { existsSync as existsSync10 } from "node:fs";
|
|
29789
29777
|
function diffSnapshots(before, after) {
|
|
29790
29778
|
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
|
|
29791
|
-
const changed_fields = names.filter((
|
|
29779
|
+
const changed_fields = names.filter((name) => before[name] !== after[name]);
|
|
29792
29780
|
return { changed: changed_fields.length > 0, changed_fields };
|
|
29793
29781
|
}
|
|
29794
29782
|
var DEFAULT_TRAIL_LIMIT = 30;
|
|
@@ -29836,11 +29824,11 @@ var LOGIN_HINTS = {
|
|
|
29836
29824
|
cursor: "sign in from Cursor",
|
|
29837
29825
|
copilot: "run `copilot` and sign in"
|
|
29838
29826
|
};
|
|
29839
|
-
function effectiveBinary(
|
|
29840
|
-
return savedBinary.trim() || AGENT_BINARIES[
|
|
29827
|
+
function effectiveBinary(name, savedBinary) {
|
|
29828
|
+
return savedBinary.trim() || AGENT_BINARIES[name];
|
|
29841
29829
|
}
|
|
29842
|
-
function defaultModelLabel(
|
|
29843
|
-
const model = DEFAULT_MODELS[
|
|
29830
|
+
function defaultModelLabel(name) {
|
|
29831
|
+
const model = DEFAULT_MODELS[name];
|
|
29844
29832
|
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
29845
29833
|
}
|
|
29846
29834
|
var fail3 = (step, detail) => ({ step, ok: false, detail });
|
|
@@ -29869,32 +29857,32 @@ function readVersion(binary) {
|
|
|
29869
29857
|
});
|
|
29870
29858
|
});
|
|
29871
29859
|
}
|
|
29872
|
-
async function inspect(
|
|
29873
|
-
const target = effectiveBinary(
|
|
29860
|
+
async function inspect(name, binary) {
|
|
29861
|
+
const target = effectiveBinary(name, binary);
|
|
29874
29862
|
const found = await resolveOnPath(target);
|
|
29875
29863
|
if (!found) return { checks: [fail3("path", `\`${target}\` was not found or is not executable`)], found: null };
|
|
29876
29864
|
const checks = [pass("path", found)];
|
|
29877
29865
|
checks.push(await readVersion(found));
|
|
29878
|
-
if (
|
|
29879
|
-
const auth = await withBinaryEnv(
|
|
29866
|
+
if (name === "claude") {
|
|
29867
|
+
const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
|
|
29880
29868
|
checks.push(
|
|
29881
29869
|
auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
29882
29870
|
);
|
|
29883
29871
|
}
|
|
29884
29872
|
return { checks, found };
|
|
29885
29873
|
}
|
|
29886
|
-
async function inspectAgent(
|
|
29887
|
-
return (await inspect(
|
|
29874
|
+
async function inspectAgent(name, binary) {
|
|
29875
|
+
return (await inspect(name, binary)).checks;
|
|
29888
29876
|
}
|
|
29889
|
-
async function testAgent(
|
|
29890
|
-
const { checks, found } = await inspect(
|
|
29877
|
+
async function testAgent(name, binary, model) {
|
|
29878
|
+
const { checks, found } = await inspect(name, binary);
|
|
29891
29879
|
if (!found || !checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
29892
29880
|
const started = Date.now();
|
|
29893
29881
|
const result = await withBinaryEnv(
|
|
29894
|
-
|
|
29882
|
+
name,
|
|
29895
29883
|
found,
|
|
29896
29884
|
() => createLocalCliAgentInvoker().invoke({
|
|
29897
|
-
agent:
|
|
29885
|
+
agent: name,
|
|
29898
29886
|
...model.trim() ? { model: model.trim() } : {},
|
|
29899
29887
|
prompt: TEST_PROMPT,
|
|
29900
29888
|
timeoutMs: PROMPT_TIMEOUT_MS
|
|
@@ -29910,7 +29898,7 @@ async function testAgent(name2, binary, model) {
|
|
|
29910
29898
|
}
|
|
29911
29899
|
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
29912
29900
|
}
|
|
29913
|
-
function statusFromChecks(
|
|
29901
|
+
function statusFromChecks(name, checks, savedBinary) {
|
|
29914
29902
|
if (checks.length === 0) return "checking";
|
|
29915
29903
|
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
29916
29904
|
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
@@ -29922,13 +29910,13 @@ function statusFromChecks(name2, checks, savedBinary) {
|
|
|
29922
29910
|
}
|
|
29923
29911
|
const login = checks.find((check) => check.step === "login");
|
|
29924
29912
|
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
29925
|
-
return
|
|
29913
|
+
return name === "claude" ? "ready" : "unknown";
|
|
29926
29914
|
}
|
|
29927
|
-
function setupHint(
|
|
29928
|
-
if (status === "not-configured") return `${INSTALL_HINTS[
|
|
29929
|
-
if (status === "not-found") return `${INSTALL_HINTS[
|
|
29930
|
-
if (status === "not-logged-in") return LOGIN_HINTS[
|
|
29931
|
-
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[
|
|
29915
|
+
function setupHint(name, status) {
|
|
29916
|
+
if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set its command path in settings`;
|
|
29917
|
+
if (status === "not-found") return `${INSTALL_HINTS[name]}, or correct the command path in settings`;
|
|
29918
|
+
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
29919
|
+
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name]}`;
|
|
29932
29920
|
if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
|
|
29933
29921
|
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
29934
29922
|
return "";
|
|
@@ -29950,14 +29938,14 @@ var LIST_STATUS = {
|
|
|
29950
29938
|
"timed-out": { symbol: "\u2717", text: "test timed out", tone: "bad" },
|
|
29951
29939
|
unknown: { symbol: "\u25D0", text: "installed, login unknown", tone: "muted" }
|
|
29952
29940
|
};
|
|
29953
|
-
function modelLine(
|
|
29941
|
+
function modelLine(name, savedModel) {
|
|
29954
29942
|
const model = savedModel.trim();
|
|
29955
|
-
return model ? model : `${defaultModelLabel(
|
|
29943
|
+
return model ? model : `${defaultModelLabel(name)} (built-in default)`;
|
|
29956
29944
|
}
|
|
29957
|
-
function baseRows(
|
|
29945
|
+
function baseRows(name, checks, savedBinary) {
|
|
29958
29946
|
const path5 = checks.find((check) => check.step === "path");
|
|
29959
29947
|
const version2 = checks.find((check) => check.step === "version");
|
|
29960
|
-
const hint = setupHint(
|
|
29948
|
+
const hint = setupHint(name, statusFromChecks(name, checks, savedBinary));
|
|
29961
29949
|
const setup = hint ? { label: "Setup", value: hint, tone: "muted" } : void 0;
|
|
29962
29950
|
if (!path5?.ok) {
|
|
29963
29951
|
const saved = savedBinary.trim() !== "";
|
|
@@ -29980,15 +29968,15 @@ function baseRows(name2, checks, savedBinary) {
|
|
|
29980
29968
|
};
|
|
29981
29969
|
}
|
|
29982
29970
|
var checking = [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
29983
|
-
function panelRows(
|
|
29971
|
+
function panelRows(name, checks, settings) {
|
|
29984
29972
|
if (!checks) return checking;
|
|
29985
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
29986
|
-
const model = { label: "Model", value: modelLine(
|
|
29973
|
+
const { command, version: version2, setup, found } = baseRows(name, checks, settings.binary);
|
|
29974
|
+
const model = { label: "Model", value: modelLine(name, settings.model), tone: "muted" };
|
|
29987
29975
|
return [command, ...found ? [...version2?.tone === "ok" ? [version2] : [], model] : [], ...setup ? [setup] : []];
|
|
29988
29976
|
}
|
|
29989
|
-
function statusRows(
|
|
29977
|
+
function statusRows(name, checks, savedBinary) {
|
|
29990
29978
|
if (!checks) return checking;
|
|
29991
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
29979
|
+
const { command, version: version2, setup, found } = baseRows(name, checks, savedBinary);
|
|
29992
29980
|
if (!found) return [command];
|
|
29993
29981
|
const login = checks.find((check) => check.step === "login");
|
|
29994
29982
|
const prompt = checks.find((check) => check.step === "prompt");
|
|
@@ -30007,8 +29995,8 @@ function statusRows(name2, checks, savedBinary) {
|
|
|
30007
29995
|
const testRow = prompt ? [{ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" }] : [];
|
|
30008
29996
|
return [command, ...version2 ? [version2] : [], loginRow, ...testRow, ...setup ? [setup] : []];
|
|
30009
29997
|
}
|
|
30010
|
-
async function withBinaryEnv(
|
|
30011
|
-
const key = `EDS_AGENT_BINARY_${
|
|
29998
|
+
async function withBinaryEnv(name, binary, run) {
|
|
29999
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
30012
30000
|
const previous = process.env[key];
|
|
30013
30001
|
process.env[key] = binary;
|
|
30014
30002
|
try {
|
|
@@ -30022,9 +30010,9 @@ async function withBinaryEnv(name2, binary, run) {
|
|
|
30022
30010
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-debug.ts
|
|
30023
30011
|
function agentSnapshot(config) {
|
|
30024
30012
|
const snapshot = { default_agent: config.defaultAgent };
|
|
30025
|
-
for (const
|
|
30026
|
-
snapshot[`${
|
|
30027
|
-
snapshot[`${
|
|
30013
|
+
for (const name of AGENT_NAMES) {
|
|
30014
|
+
snapshot[`${name}.model`] = config.agents[name].model;
|
|
30015
|
+
snapshot[`${name}.binary`] = config.agents[name].binary;
|
|
30028
30016
|
}
|
|
30029
30017
|
return snapshot;
|
|
30030
30018
|
}
|
|
@@ -30041,10 +30029,10 @@ function environmentFrom(checks, savedBinary, envValue) {
|
|
|
30041
30029
|
}
|
|
30042
30030
|
async function describeAgents(config) {
|
|
30043
30031
|
const entries = await Promise.all(
|
|
30044
|
-
AGENT_NAMES.map(async (
|
|
30045
|
-
const saved = config.agents[
|
|
30046
|
-
const checks = await inspectAgent(
|
|
30047
|
-
return [
|
|
30032
|
+
AGENT_NAMES.map(async (name) => {
|
|
30033
|
+
const saved = config.agents[name].binary;
|
|
30034
|
+
const checks = await inspectAgent(name, saved);
|
|
30035
|
+
return [name, environmentFrom(checks, saved, process.env[`EDS_AGENT_BINARY_${name.toUpperCase()}`])];
|
|
30048
30036
|
})
|
|
30049
30037
|
);
|
|
30050
30038
|
return Object.fromEntries(entries);
|
|
@@ -30065,7 +30053,7 @@ var AGENT_LABELS = {
|
|
|
30065
30053
|
};
|
|
30066
30054
|
var asString = (value) => typeof value === "string" ? value : "";
|
|
30067
30055
|
function emptyAgents() {
|
|
30068
|
-
return Object.fromEntries(AGENT_NAMES.map((
|
|
30056
|
+
return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "", binary: "" }]));
|
|
30069
30057
|
}
|
|
30070
30058
|
async function readAgentConfig() {
|
|
30071
30059
|
const store = await readV1Store();
|
|
@@ -30075,11 +30063,11 @@ async function readAgentConfig() {
|
|
|
30075
30063
|
const agents = emptyAgents();
|
|
30076
30064
|
const saved = store["agents"];
|
|
30077
30065
|
if (saved && typeof saved === "object") {
|
|
30078
|
-
for (const
|
|
30079
|
-
const entry = saved[
|
|
30066
|
+
for (const name of AGENT_NAMES) {
|
|
30067
|
+
const entry = saved[name];
|
|
30080
30068
|
if (entry && typeof entry === "object") {
|
|
30081
30069
|
const fields2 = entry;
|
|
30082
|
-
agents[
|
|
30070
|
+
agents[name] = { model: asString(fields2["model"]), binary: asString(fields2["binary"]) };
|
|
30083
30071
|
}
|
|
30084
30072
|
}
|
|
30085
30073
|
}
|
|
@@ -30092,10 +30080,10 @@ async function writeAgentConfig(config) {
|
|
|
30092
30080
|
const existing = await readV1Store();
|
|
30093
30081
|
const merged = { ...existing };
|
|
30094
30082
|
const agents = {};
|
|
30095
|
-
for (const
|
|
30096
|
-
const model = config.agents[
|
|
30097
|
-
const binary = config.agents[
|
|
30098
|
-
if (model || binary) agents[
|
|
30083
|
+
for (const name of AGENT_NAMES) {
|
|
30084
|
+
const model = config.agents[name].model.trim();
|
|
30085
|
+
const binary = config.agents[name].binary.trim();
|
|
30086
|
+
if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
|
|
30099
30087
|
}
|
|
30100
30088
|
const defaultModel = config.defaultChosen ? agents[config.defaultAgent]?.model : void 0;
|
|
30101
30089
|
if (config.defaultChosen) merged["agent"] = config.defaultAgent;
|
|
@@ -30120,20 +30108,20 @@ var TONE_COLOR = {
|
|
|
30120
30108
|
muted: PALETTE.muted
|
|
30121
30109
|
};
|
|
30122
30110
|
function AgentStatusBadge({
|
|
30123
|
-
name
|
|
30111
|
+
name,
|
|
30124
30112
|
checks,
|
|
30125
30113
|
binary
|
|
30126
30114
|
}) {
|
|
30127
|
-
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(
|
|
30115
|
+
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(name, checks, binary) : "checking"];
|
|
30128
30116
|
return /* @__PURE__ */ jsx59(Text49, { color: TONE_COLOR[tone], children: `${symbol} ${text}` });
|
|
30129
30117
|
}
|
|
30130
30118
|
|
|
30131
30119
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/apply-binary-overrides.ts
|
|
30132
30120
|
var shellValues = /* @__PURE__ */ new Map();
|
|
30133
30121
|
function applyBinaryOverrides(config) {
|
|
30134
|
-
for (const
|
|
30135
|
-
const key = `EDS_AGENT_BINARY_${
|
|
30136
|
-
const binary = config.agents[
|
|
30122
|
+
for (const name of AGENT_NAMES) {
|
|
30123
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
30124
|
+
const binary = config.agents[name].binary.trim();
|
|
30137
30125
|
if (binary) {
|
|
30138
30126
|
if (!shellValues.has(key)) shellValues.set(key, process.env[key]);
|
|
30139
30127
|
process.env[key] = binary;
|
|
@@ -30148,9 +30136,9 @@ function applyBinaryOverrides(config) {
|
|
|
30148
30136
|
|
|
30149
30137
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
30150
30138
|
import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
30151
|
-
var fields = (
|
|
30152
|
-
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[
|
|
30153
|
-
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(
|
|
30139
|
+
var fields = (name) => [
|
|
30140
|
+
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[name]}\` from the PATH)` },
|
|
30141
|
+
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name)})` }
|
|
30154
30142
|
];
|
|
30155
30143
|
var INSPECT_DELAY_MS = 400;
|
|
30156
30144
|
function StatusHeading() {
|
|
@@ -30160,13 +30148,13 @@ function StatusHeading() {
|
|
|
30160
30148
|
] });
|
|
30161
30149
|
}
|
|
30162
30150
|
function AgentDetail({
|
|
30163
|
-
name
|
|
30151
|
+
name,
|
|
30164
30152
|
config,
|
|
30165
30153
|
setConfig,
|
|
30166
30154
|
onBack,
|
|
30167
30155
|
record: record3
|
|
30168
30156
|
}) {
|
|
30169
|
-
const settings = config.agents[
|
|
30157
|
+
const settings = config.agents[name];
|
|
30170
30158
|
const [saving, setSaving] = useState33(false);
|
|
30171
30159
|
const [testing, setTesting] = useState33(false);
|
|
30172
30160
|
const [notice, setNotice] = useState33(null);
|
|
@@ -30175,38 +30163,38 @@ function AgentDetail({
|
|
|
30175
30163
|
let active = true;
|
|
30176
30164
|
setChecks(void 0);
|
|
30177
30165
|
const timer = setTimeout(() => {
|
|
30178
|
-
void inspectAgent(
|
|
30166
|
+
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
30179
30167
|
}, INSPECT_DELAY_MS);
|
|
30180
30168
|
return () => {
|
|
30181
30169
|
active = false;
|
|
30182
30170
|
clearTimeout(timer);
|
|
30183
30171
|
};
|
|
30184
|
-
}, [
|
|
30172
|
+
}, [name, settings.binary]);
|
|
30185
30173
|
const save = () => {
|
|
30186
30174
|
setSaving(true);
|
|
30187
30175
|
setNotice(null);
|
|
30188
30176
|
writeAgentConfig(config).then(() => {
|
|
30189
30177
|
applyBinaryOverrides(config);
|
|
30190
|
-
record3(`saved ${
|
|
30191
|
-
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[
|
|
30178
|
+
record3(`saved ${name}`);
|
|
30179
|
+
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name]} settings are written to config.json` });
|
|
30192
30180
|
}).catch((err) => {
|
|
30193
|
-
record3(`saving ${
|
|
30181
|
+
record3(`saving ${name} failed`, err);
|
|
30194
30182
|
setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` });
|
|
30195
30183
|
}).finally(() => setSaving(false));
|
|
30196
30184
|
};
|
|
30197
30185
|
const runTest = () => {
|
|
30198
30186
|
setTesting(true);
|
|
30199
30187
|
setNotice(null);
|
|
30200
|
-
testAgent(
|
|
30188
|
+
testAgent(name, settings.binary, settings.model).then((result) => {
|
|
30201
30189
|
setChecks(result);
|
|
30202
30190
|
const outcome = testOutcome(result);
|
|
30203
30191
|
if (!outcome || !outcome.ok)
|
|
30204
|
-
record3(`test of ${
|
|
30192
|
+
record3(`test of ${name} failed: ${outcome?.text ?? "the agent could not be started"}`);
|
|
30205
30193
|
setNotice(
|
|
30206
30194
|
outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
|
|
30207
30195
|
);
|
|
30208
30196
|
}).catch((err) => {
|
|
30209
|
-
record3(`test of ${
|
|
30197
|
+
record3(`test of ${name} could not run`, err);
|
|
30210
30198
|
setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` });
|
|
30211
30199
|
}).finally(() => setTesting(false));
|
|
30212
30200
|
};
|
|
@@ -30217,19 +30205,19 @@ function AgentDetail({
|
|
|
30217
30205
|
hint: "run test",
|
|
30218
30206
|
onRun: runTest
|
|
30219
30207
|
};
|
|
30220
|
-
const formFields = fields(
|
|
30208
|
+
const formFields = fields(name);
|
|
30221
30209
|
const labelWidth = formLabelWidth([...formFields, action]);
|
|
30222
30210
|
return /* @__PURE__ */ jsx60(
|
|
30223
30211
|
FieldForm,
|
|
30224
30212
|
{
|
|
30225
|
-
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[
|
|
30226
|
-
subtitle: config.defaultAgent ===
|
|
30213
|
+
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[name]}`,
|
|
30214
|
+
subtitle: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_BINARIES[name]}\` command.`,
|
|
30227
30215
|
fields: formFields,
|
|
30228
30216
|
values: { binary: settings.binary, model: settings.model },
|
|
30229
30217
|
onChange: (key, value) => {
|
|
30230
|
-
setConfig({ ...config, agents: { ...config.agents, [
|
|
30218
|
+
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [key]: value } } });
|
|
30231
30219
|
setNotice(null);
|
|
30232
|
-
record3(`edited ${
|
|
30220
|
+
record3(`edited ${name}.${key}`);
|
|
30233
30221
|
},
|
|
30234
30222
|
onSave: save,
|
|
30235
30223
|
onQuit: onBack,
|
|
@@ -30238,7 +30226,7 @@ function AgentDetail({
|
|
|
30238
30226
|
busy: saving || testing,
|
|
30239
30227
|
children: /* @__PURE__ */ jsxs48(Box48, { flexDirection: "column", marginTop: 1, children: [
|
|
30240
30228
|
/* @__PURE__ */ jsx60(StatusHeading, {}),
|
|
30241
|
-
statusRows(
|
|
30229
|
+
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx60(FormReadOnlyRow, { label: row.label, labelWidth, children: /* @__PURE__ */ jsx60(Text50, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label))
|
|
30242
30230
|
] })
|
|
30243
30231
|
}
|
|
30244
30232
|
);
|
|
@@ -30263,9 +30251,9 @@ function AgentsScreen({ onDone }) {
|
|
|
30263
30251
|
error: ""
|
|
30264
30252
|
}).current;
|
|
30265
30253
|
const inspectAll = (loaded) => {
|
|
30266
|
-
for (const
|
|
30267
|
-
void inspectAgent(
|
|
30268
|
-
(result) => setChecks((previous) => ({ ...previous, [
|
|
30254
|
+
for (const name of AGENT_NAMES) {
|
|
30255
|
+
void inspectAgent(name, loaded.agents[name].binary).then(
|
|
30256
|
+
(result) => setChecks((previous) => ({ ...previous, [name]: result }))
|
|
30269
30257
|
);
|
|
30270
30258
|
}
|
|
30271
30259
|
};
|
|
@@ -30305,21 +30293,21 @@ function AgentsScreen({ onDone }) {
|
|
|
30305
30293
|
exitMethod: change.changed ? "saved" : "discarded"
|
|
30306
30294
|
});
|
|
30307
30295
|
};
|
|
30308
|
-
const makeDefault = (
|
|
30296
|
+
const makeDefault = (name) => {
|
|
30309
30297
|
if (!config || saving) return;
|
|
30310
|
-
if (
|
|
30311
|
-
setNotice({ kind: "success", text: `${AGENT_LABELS[
|
|
30298
|
+
if (name === config.defaultAgent) {
|
|
30299
|
+
setNotice({ kind: "success", text: `${AGENT_LABELS[name]} is already the default agent` });
|
|
30312
30300
|
return;
|
|
30313
30301
|
}
|
|
30314
30302
|
setSaving(true);
|
|
30315
30303
|
setNotice(null);
|
|
30316
|
-
writeAgentConfig({ ...config, defaultAgent:
|
|
30317
|
-
setConfig((current) => current ? { ...current, defaultAgent:
|
|
30318
|
-
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[
|
|
30319
|
-
visit.trail.record(`made ${
|
|
30304
|
+
writeAgentConfig({ ...config, defaultAgent: name, defaultChosen: true }).then(() => {
|
|
30305
|
+
setConfig((current) => current ? { ...current, defaultAgent: name, defaultChosen: true } : current);
|
|
30306
|
+
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
|
|
30307
|
+
visit.trail.record(`made ${name} the default`);
|
|
30320
30308
|
}).catch((err) => {
|
|
30321
30309
|
visit.error = scrubError(err, []);
|
|
30322
|
-
visit.trail.record(`making ${
|
|
30310
|
+
visit.trail.record(`making ${name} the default failed`);
|
|
30323
30311
|
setNotice({ kind: "error", text: `Default agent not changed: ${visit.error}` });
|
|
30324
30312
|
}).finally(() => setSaving(false));
|
|
30325
30313
|
};
|
|
@@ -30406,14 +30394,14 @@ function AgentsScreen({ onDone }) {
|
|
|
30406
30394
|
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "AGENT" }) }),
|
|
30407
30395
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "STATUS" })
|
|
30408
30396
|
] }),
|
|
30409
|
-
AGENT_NAMES.map((
|
|
30410
|
-
const isFocused = focusedAgent ===
|
|
30397
|
+
AGENT_NAMES.map((name) => {
|
|
30398
|
+
const isFocused = focusedAgent === name;
|
|
30411
30399
|
return /* @__PURE__ */ jsxs49(Box49, { gap: 1, children: [
|
|
30412
30400
|
/* @__PURE__ */ jsx61(Text51, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " }),
|
|
30413
|
-
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children:
|
|
30414
|
-
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[
|
|
30415
|
-
/* @__PURE__ */ jsx61(AgentStatusBadge, { name
|
|
30416
|
-
] },
|
|
30401
|
+
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children: name === config.defaultAgent ? "\u2605" : " " }),
|
|
30402
|
+
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[name] }) }),
|
|
30403
|
+
/* @__PURE__ */ jsx61(AgentStatusBadge, { name, checks: checks[name], binary: config.agents[name].binary })
|
|
30404
|
+
] }, name);
|
|
30417
30405
|
}),
|
|
30418
30406
|
/* @__PURE__ */ jsxs49(Box49, { flexDirection: "column", marginTop: 1, children: [
|
|
30419
30407
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: `\u2500 ${AGENT_LABELS[focusedAgent]} ${"\u2500".repeat(30)}` }),
|