@contentful/experience-design-system-cli 2.37.1-dev-build-845e7310.0 → 2.37.1-dev-build-e9daa6a1.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 +911 -138
- package/dist/index.js +1035 -153
- package/dist/package.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1484,6 +1484,16 @@ var init_parse_map_token_prop_tool_calls = __esm({
|
|
|
1484
1484
|
|
|
1485
1485
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/services/run-agent.js
|
|
1486
1486
|
import { spawn } from "node:child_process";
|
|
1487
|
+
function killProcessTree(pid, signal) {
|
|
1488
|
+
try {
|
|
1489
|
+
process.kill(-pid, signal);
|
|
1490
|
+
} catch {
|
|
1491
|
+
try {
|
|
1492
|
+
process.kill(pid, signal);
|
|
1493
|
+
} catch {
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1487
1497
|
async function runAgent(options) {
|
|
1488
1498
|
const { agent, prompt, timeoutMs, model, onOutput, promptViaStdin, onDebugEvent } = options;
|
|
1489
1499
|
const bedrock = options.bedrock ?? process.env.EDS_BEDROCK === "1";
|
|
@@ -1500,10 +1510,11 @@ async function runAgent(options) {
|
|
|
1500
1510
|
promptLen: prompt.length,
|
|
1501
1511
|
promptHead: prompt.slice(0, 500)
|
|
1502
1512
|
});
|
|
1503
|
-
return new Promise((
|
|
1513
|
+
return new Promise((resolve29) => {
|
|
1504
1514
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
1505
1515
|
const child = spawn(binary, args, {
|
|
1506
1516
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1517
|
+
detached: true,
|
|
1507
1518
|
...bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}
|
|
1508
1519
|
});
|
|
1509
1520
|
if (useStdin2 && child.stdin) {
|
|
@@ -1515,50 +1526,87 @@ async function runAgent(options) {
|
|
|
1515
1526
|
} else {
|
|
1516
1527
|
child.stdin?.end();
|
|
1517
1528
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1529
|
+
const stdoutChunks = [];
|
|
1530
|
+
const stderrChunks = [];
|
|
1520
1531
|
let timedOut = false;
|
|
1521
|
-
|
|
1532
|
+
let settled = false;
|
|
1533
|
+
const pid = child.pid;
|
|
1534
|
+
const settle = (result) => {
|
|
1535
|
+
if (settled)
|
|
1536
|
+
return;
|
|
1537
|
+
settled = true;
|
|
1538
|
+
clearTimeout(softTimer);
|
|
1539
|
+
clearTimeout(hardTimer);
|
|
1540
|
+
onDebugEvent?.("run.end", {
|
|
1541
|
+
agent,
|
|
1542
|
+
model,
|
|
1543
|
+
durationMs: Date.now() - startedAt,
|
|
1544
|
+
exitCode: result.exitCode,
|
|
1545
|
+
timedOut: result.timedOut,
|
|
1546
|
+
stdoutLen: result.stdout.length,
|
|
1547
|
+
stderrLen: result.stderr.length,
|
|
1548
|
+
stderrTail: result.stderr.slice(-1e3)
|
|
1549
|
+
});
|
|
1550
|
+
resolve29(result);
|
|
1551
|
+
};
|
|
1552
|
+
const softTimer = setTimeout(() => {
|
|
1522
1553
|
timedOut = true;
|
|
1523
|
-
|
|
1554
|
+
if (pid)
|
|
1555
|
+
killProcessTree(pid, "SIGTERM");
|
|
1524
1556
|
}, timeoutMs);
|
|
1557
|
+
const hardTimer = setTimeout(() => {
|
|
1558
|
+
if (settled)
|
|
1559
|
+
return;
|
|
1560
|
+
if (pid)
|
|
1561
|
+
killProcessTree(pid, "SIGKILL");
|
|
1562
|
+
try {
|
|
1563
|
+
child.stdout?.destroy();
|
|
1564
|
+
child.stderr?.destroy();
|
|
1565
|
+
child.stdin?.destroy();
|
|
1566
|
+
} catch {
|
|
1567
|
+
}
|
|
1568
|
+
settle({
|
|
1569
|
+
exitCode: 1,
|
|
1570
|
+
stdout: Buffer.concat(stdoutChunks).toString("utf8"),
|
|
1571
|
+
stderr: Buffer.concat(stderrChunks).toString("utf8"),
|
|
1572
|
+
timedOut: true
|
|
1573
|
+
});
|
|
1574
|
+
}, timeoutMs + WATCHDOG_GRACE_MS);
|
|
1525
1575
|
child.stdout?.on("data", (chunk) => {
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1576
|
+
stdoutChunks.push(chunk);
|
|
1577
|
+
if (onOutput)
|
|
1578
|
+
onOutput(chunk.toString("utf8"));
|
|
1529
1579
|
});
|
|
1530
1580
|
child.stderr?.on("data", (chunk) => {
|
|
1531
|
-
|
|
1581
|
+
stderrChunks.push(chunk);
|
|
1582
|
+
});
|
|
1583
|
+
child.on("error", (err) => {
|
|
1584
|
+
settle({
|
|
1585
|
+
exitCode: 1,
|
|
1586
|
+
stdout: Buffer.concat(stdoutChunks).toString("utf8"),
|
|
1587
|
+
stderr: `${err instanceof Error ? err.message : String(err)}
|
|
1588
|
+
${Buffer.concat(stderrChunks).toString("utf8")}`,
|
|
1589
|
+
timedOut
|
|
1590
|
+
});
|
|
1532
1591
|
});
|
|
1533
1592
|
child.on("close", (code, signal) => {
|
|
1534
|
-
|
|
1535
|
-
const result = {
|
|
1593
|
+
settle({
|
|
1536
1594
|
exitCode: signal ? 1 : code ?? 1,
|
|
1537
|
-
stdout,
|
|
1538
|
-
stderr,
|
|
1595
|
+
stdout: Buffer.concat(stdoutChunks).toString("utf8"),
|
|
1596
|
+
stderr: Buffer.concat(stderrChunks).toString("utf8"),
|
|
1539
1597
|
timedOut
|
|
1540
|
-
};
|
|
1541
|
-
onDebugEvent?.("run.end", {
|
|
1542
|
-
agent,
|
|
1543
|
-
model,
|
|
1544
|
-
durationMs: Date.now() - startedAt,
|
|
1545
|
-
exitCode: result.exitCode,
|
|
1546
|
-
signal,
|
|
1547
|
-
timedOut,
|
|
1548
|
-
stdoutLen: stdout.length,
|
|
1549
|
-
stderrLen: stderr.length,
|
|
1550
|
-
stderrTail: stderr.slice(-1e3)
|
|
1551
1598
|
});
|
|
1552
|
-
resolve28(result);
|
|
1553
1599
|
});
|
|
1554
1600
|
});
|
|
1555
1601
|
}
|
|
1602
|
+
var WATCHDOG_GRACE_MS;
|
|
1556
1603
|
var init_run_agent = __esm({
|
|
1557
1604
|
"packages/experience-design-system-backend-pipeline/dist/src/agents/services/run-agent.js"() {
|
|
1558
1605
|
"use strict";
|
|
1559
1606
|
init_bedrock();
|
|
1560
1607
|
init_build_agent_args();
|
|
1561
1608
|
init_resolve_binary();
|
|
1609
|
+
WATCHDOG_GRACE_MS = 10 * 1e3;
|
|
1562
1610
|
}
|
|
1563
1611
|
});
|
|
1564
1612
|
|
|
@@ -1571,7 +1619,7 @@ async function checkAgentAuth(agent) {
|
|
|
1571
1619
|
return "not-found";
|
|
1572
1620
|
if (agent !== "claude")
|
|
1573
1621
|
return "ok";
|
|
1574
|
-
return new Promise((
|
|
1622
|
+
return new Promise((resolve29) => {
|
|
1575
1623
|
const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
1576
1624
|
let stdout = "";
|
|
1577
1625
|
let done = false;
|
|
@@ -1580,7 +1628,7 @@ async function checkAgentAuth(agent) {
|
|
|
1580
1628
|
return;
|
|
1581
1629
|
done = true;
|
|
1582
1630
|
child.kill("SIGTERM");
|
|
1583
|
-
|
|
1631
|
+
resolve29("unauthenticated");
|
|
1584
1632
|
}, 5e3);
|
|
1585
1633
|
child.stdout?.on("data", (chunk) => {
|
|
1586
1634
|
stdout += chunk.toString();
|
|
@@ -1591,14 +1639,14 @@ async function checkAgentAuth(agent) {
|
|
|
1591
1639
|
done = true;
|
|
1592
1640
|
clearTimeout(timer);
|
|
1593
1641
|
if (code !== 0) {
|
|
1594
|
-
|
|
1642
|
+
resolve29("unauthenticated");
|
|
1595
1643
|
return;
|
|
1596
1644
|
}
|
|
1597
1645
|
try {
|
|
1598
1646
|
const status = JSON.parse(stdout);
|
|
1599
|
-
|
|
1647
|
+
resolve29(status.loggedIn ? "ok" : "unauthenticated");
|
|
1600
1648
|
} catch {
|
|
1601
|
-
|
|
1649
|
+
resolve29("unauthenticated");
|
|
1602
1650
|
}
|
|
1603
1651
|
});
|
|
1604
1652
|
});
|
|
@@ -1608,9 +1656,9 @@ async function binaryIsOnPath(binary) {
|
|
|
1608
1656
|
const fs = await import("node:fs/promises");
|
|
1609
1657
|
return fs.access(binary).then(() => true, () => false);
|
|
1610
1658
|
}
|
|
1611
|
-
return new Promise((
|
|
1659
|
+
return new Promise((resolve29) => {
|
|
1612
1660
|
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
1613
|
-
child.on("close", (code) =>
|
|
1661
|
+
child.on("close", (code) => resolve29(code === 0));
|
|
1614
1662
|
});
|
|
1615
1663
|
}
|
|
1616
1664
|
var init_check_agent_auth = __esm({
|
|
@@ -2247,7 +2295,8 @@ var init_infer_fence_lang = __esm({
|
|
|
2247
2295
|
sass: "scss",
|
|
2248
2296
|
css: "css",
|
|
2249
2297
|
json: "json",
|
|
2250
|
-
json5: "json"
|
|
2298
|
+
json5: "json",
|
|
2299
|
+
html: "html"
|
|
2251
2300
|
};
|
|
2252
2301
|
}
|
|
2253
2302
|
});
|
|
@@ -10986,6 +11035,797 @@ var init_extract_svelte_components = __esm({
|
|
|
10986
11035
|
}
|
|
10987
11036
|
});
|
|
10988
11037
|
|
|
11038
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js
|
|
11039
|
+
import { Node as Node10 } from "ts-morph";
|
|
11040
|
+
function resolveToObjectLiteral(expr, depth = 0) {
|
|
11041
|
+
if (!expr || depth > 3)
|
|
11042
|
+
return null;
|
|
11043
|
+
if (Node10.isObjectLiteralExpression(expr))
|
|
11044
|
+
return expr;
|
|
11045
|
+
if (Node10.isIdentifier(expr)) {
|
|
11046
|
+
const defs = expr.getDefinitions();
|
|
11047
|
+
for (const def of defs) {
|
|
11048
|
+
const node = def.getDeclarationNode();
|
|
11049
|
+
if (node && Node10.isVariableDeclaration(node)) {
|
|
11050
|
+
const init = node.getInitializer();
|
|
11051
|
+
const resolved = resolveToObjectLiteral(init, depth + 1);
|
|
11052
|
+
if (resolved)
|
|
11053
|
+
return resolved;
|
|
11054
|
+
}
|
|
11055
|
+
}
|
|
11056
|
+
}
|
|
11057
|
+
return null;
|
|
11058
|
+
}
|
|
11059
|
+
function findComponentDecorator(cls) {
|
|
11060
|
+
const decorator = cls.getDecorator("Component");
|
|
11061
|
+
if (!decorator)
|
|
11062
|
+
return null;
|
|
11063
|
+
const [arg] = decorator.getArguments();
|
|
11064
|
+
return resolveToObjectLiteral(arg);
|
|
11065
|
+
}
|
|
11066
|
+
function hasComponentDecorator(cls) {
|
|
11067
|
+
return cls.getDecorator("Component") !== void 0;
|
|
11068
|
+
}
|
|
11069
|
+
var init_find_component_decorator = __esm({
|
|
11070
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js"() {
|
|
11071
|
+
"use strict";
|
|
11072
|
+
}
|
|
11073
|
+
});
|
|
11074
|
+
|
|
11075
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/resolve-prop-type.js
|
|
11076
|
+
import { Node as Node11 } from "ts-morph";
|
|
11077
|
+
function resolvePropType(typeNode) {
|
|
11078
|
+
if (!typeNode) {
|
|
11079
|
+
return { text: "any", allowedValues: null, isTemplateRef: false };
|
|
11080
|
+
}
|
|
11081
|
+
const text = typeNode.getText();
|
|
11082
|
+
const members = extractStringLiteralUnion(typeNode);
|
|
11083
|
+
const isTemplateRef = containsTemplateRef(typeNode);
|
|
11084
|
+
return {
|
|
11085
|
+
text,
|
|
11086
|
+
allowedValues: members.length > 0 ? members : null,
|
|
11087
|
+
isTemplateRef
|
|
11088
|
+
};
|
|
11089
|
+
}
|
|
11090
|
+
function extractStringLiteralUnion(typeNode) {
|
|
11091
|
+
if (Node11.isLiteralTypeNode(typeNode)) {
|
|
11092
|
+
const lit = typeNode.getLiteral();
|
|
11093
|
+
if (Node11.isStringLiteral(lit) || Node11.isNoSubstitutionTemplateLiteral(lit)) {
|
|
11094
|
+
return [lit.getLiteralText()];
|
|
11095
|
+
}
|
|
11096
|
+
return [];
|
|
11097
|
+
}
|
|
11098
|
+
if (Node11.isUnionTypeNode(typeNode)) {
|
|
11099
|
+
const out = [];
|
|
11100
|
+
for (const member of typeNode.getTypeNodes()) {
|
|
11101
|
+
const sub = extractStringLiteralUnion(member);
|
|
11102
|
+
if (sub.length === 0 && !isNullOrUndefinedLiteral(member)) {
|
|
11103
|
+
return [];
|
|
11104
|
+
}
|
|
11105
|
+
out.push(...sub);
|
|
11106
|
+
}
|
|
11107
|
+
return out;
|
|
11108
|
+
}
|
|
11109
|
+
return [];
|
|
11110
|
+
}
|
|
11111
|
+
function isNullOrUndefinedLiteral(typeNode) {
|
|
11112
|
+
if (Node11.isLiteralTypeNode(typeNode)) {
|
|
11113
|
+
const lit = typeNode.getLiteral();
|
|
11114
|
+
if (Node11.isNullLiteral(lit))
|
|
11115
|
+
return true;
|
|
11116
|
+
}
|
|
11117
|
+
const t = typeNode.getText();
|
|
11118
|
+
return t === "null" || t === "undefined";
|
|
11119
|
+
}
|
|
11120
|
+
function containsTemplateRef(typeNode) {
|
|
11121
|
+
const text = typeNode.getText();
|
|
11122
|
+
return /\bTemplateRef\b/.test(text);
|
|
11123
|
+
}
|
|
11124
|
+
var init_resolve_prop_type = __esm({
|
|
11125
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/resolve-prop-type.js"() {
|
|
11126
|
+
"use strict";
|
|
11127
|
+
}
|
|
11128
|
+
});
|
|
11129
|
+
|
|
11130
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-decorator-input.js
|
|
11131
|
+
import { Node as Node12 } from "ts-morph";
|
|
11132
|
+
function extractDecoratorInput(field) {
|
|
11133
|
+
const decorator = field.getDecorator("Input");
|
|
11134
|
+
if (!decorator)
|
|
11135
|
+
return null;
|
|
11136
|
+
const fieldName = field.getName();
|
|
11137
|
+
const args = decorator.getArguments();
|
|
11138
|
+
let alias = null;
|
|
11139
|
+
let required = false;
|
|
11140
|
+
let transformIsBoolean = false;
|
|
11141
|
+
let transformIsNumber = false;
|
|
11142
|
+
if (args.length === 1) {
|
|
11143
|
+
const arg = args[0];
|
|
11144
|
+
if (Node12.isStringLiteral(arg) || Node12.isNoSubstitutionTemplateLiteral(arg)) {
|
|
11145
|
+
alias = arg.getLiteralText();
|
|
11146
|
+
} else if (Node12.isObjectLiteralExpression(arg)) {
|
|
11147
|
+
const aliasProp = arg.getProperty("alias");
|
|
11148
|
+
if (aliasProp && Node12.isPropertyAssignment(aliasProp)) {
|
|
11149
|
+
const init = aliasProp.getInitializer();
|
|
11150
|
+
if (init && (Node12.isStringLiteral(init) || Node12.isNoSubstitutionTemplateLiteral(init))) {
|
|
11151
|
+
alias = init.getLiteralText();
|
|
11152
|
+
}
|
|
11153
|
+
}
|
|
11154
|
+
const requiredProp = arg.getProperty("required");
|
|
11155
|
+
if (requiredProp && Node12.isPropertyAssignment(requiredProp)) {
|
|
11156
|
+
const init = requiredProp.getInitializer();
|
|
11157
|
+
if (init?.getText() === "true")
|
|
11158
|
+
required = true;
|
|
11159
|
+
}
|
|
11160
|
+
const transformProp = arg.getProperty("transform");
|
|
11161
|
+
if (transformProp && Node12.isPropertyAssignment(transformProp)) {
|
|
11162
|
+
const transformText = transformProp.getInitializer()?.getText() ?? "";
|
|
11163
|
+
if (/\bbooleanAttribute\b/.test(transformText))
|
|
11164
|
+
transformIsBoolean = true;
|
|
11165
|
+
if (/\bnumberAttribute\b/.test(transformText))
|
|
11166
|
+
transformIsNumber = true;
|
|
11167
|
+
}
|
|
11168
|
+
}
|
|
11169
|
+
}
|
|
11170
|
+
let typeNode;
|
|
11171
|
+
let defaultValue;
|
|
11172
|
+
if (Node12.isSetAccessorDeclaration(field)) {
|
|
11173
|
+
const param = field.getParameters()[0];
|
|
11174
|
+
typeNode = param?.getTypeNode();
|
|
11175
|
+
} else if (Node12.isGetAccessorDeclaration(field)) {
|
|
11176
|
+
const parent = field.getParent();
|
|
11177
|
+
const companionSetter = parent && Node12.isClassDeclaration(parent) ? parent.getSetAccessor(fieldName) : void 0;
|
|
11178
|
+
if (companionSetter) {
|
|
11179
|
+
typeNode = companionSetter.getParameters()[0]?.getTypeNode();
|
|
11180
|
+
}
|
|
11181
|
+
if (!typeNode)
|
|
11182
|
+
typeNode = field.getReturnTypeNode();
|
|
11183
|
+
} else {
|
|
11184
|
+
typeNode = field.getTypeNode();
|
|
11185
|
+
const initializer = field.getInitializer();
|
|
11186
|
+
if (initializer)
|
|
11187
|
+
defaultValue = initializer.getText();
|
|
11188
|
+
}
|
|
11189
|
+
const resolved = resolvePropType(typeNode);
|
|
11190
|
+
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
11191
|
+
const name = alias ?? fieldName;
|
|
11192
|
+
const prop = {
|
|
11193
|
+
name,
|
|
11194
|
+
type: typeText,
|
|
11195
|
+
required,
|
|
11196
|
+
sourceStartLine: field.getStartLineNumber(),
|
|
11197
|
+
sourceEndLine: field.getEndLineNumber()
|
|
11198
|
+
};
|
|
11199
|
+
if (defaultValue !== void 0)
|
|
11200
|
+
prop.defaultValue = defaultValue;
|
|
11201
|
+
if (resolved.allowedValues && !transformIsBoolean && !transformIsNumber) {
|
|
11202
|
+
prop.allowedValues = resolved.allowedValues;
|
|
11203
|
+
}
|
|
11204
|
+
return prop;
|
|
11205
|
+
}
|
|
11206
|
+
var init_extract_decorator_input = __esm({
|
|
11207
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-decorator-input.js"() {
|
|
11208
|
+
"use strict";
|
|
11209
|
+
init_resolve_prop_type();
|
|
11210
|
+
}
|
|
11211
|
+
});
|
|
11212
|
+
|
|
11213
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-signal-input.js
|
|
11214
|
+
import { Node as Node13 } from "ts-morph";
|
|
11215
|
+
function extractSignalInput(field) {
|
|
11216
|
+
const init = field.getInitializer();
|
|
11217
|
+
if (!init || !Node13.isCallExpression(init))
|
|
11218
|
+
return null;
|
|
11219
|
+
const callee = init.getExpression();
|
|
11220
|
+
let required = false;
|
|
11221
|
+
if (Node13.isIdentifier(callee)) {
|
|
11222
|
+
if (callee.getText() !== "input")
|
|
11223
|
+
return null;
|
|
11224
|
+
} else if (Node13.isPropertyAccessExpression(callee)) {
|
|
11225
|
+
const left = callee.getExpression();
|
|
11226
|
+
const right = callee.getName();
|
|
11227
|
+
if (!Node13.isIdentifier(left) || left.getText() !== "input" || right !== "required")
|
|
11228
|
+
return null;
|
|
11229
|
+
required = true;
|
|
11230
|
+
} else {
|
|
11231
|
+
return null;
|
|
11232
|
+
}
|
|
11233
|
+
const fieldName = field.getName();
|
|
11234
|
+
const args = init.getArguments();
|
|
11235
|
+
let defaultValue;
|
|
11236
|
+
let configArg;
|
|
11237
|
+
if (required) {
|
|
11238
|
+
configArg = args[0];
|
|
11239
|
+
} else {
|
|
11240
|
+
const first = args[0];
|
|
11241
|
+
if (first) {
|
|
11242
|
+
defaultValue = first.getText();
|
|
11243
|
+
configArg = args[1];
|
|
11244
|
+
}
|
|
11245
|
+
}
|
|
11246
|
+
let alias = null;
|
|
11247
|
+
let transformIsBoolean = false;
|
|
11248
|
+
let transformIsNumber = false;
|
|
11249
|
+
if (configArg && Node13.isObjectLiteralExpression(configArg)) {
|
|
11250
|
+
const aliasProp = configArg.getProperty("alias");
|
|
11251
|
+
if (aliasProp && Node13.isPropertyAssignment(aliasProp)) {
|
|
11252
|
+
const aliasInit = aliasProp.getInitializer();
|
|
11253
|
+
if (aliasInit && (Node13.isStringLiteral(aliasInit) || Node13.isNoSubstitutionTemplateLiteral(aliasInit))) {
|
|
11254
|
+
alias = aliasInit.getLiteralText();
|
|
11255
|
+
}
|
|
11256
|
+
}
|
|
11257
|
+
const transformProp = configArg.getProperty("transform");
|
|
11258
|
+
if (transformProp && Node13.isPropertyAssignment(transformProp)) {
|
|
11259
|
+
const transformText = transformProp.getInitializer()?.getText() ?? "";
|
|
11260
|
+
if (/\bbooleanAttribute\b/.test(transformText))
|
|
11261
|
+
transformIsBoolean = true;
|
|
11262
|
+
if (/\bnumberAttribute\b/.test(transformText))
|
|
11263
|
+
transformIsNumber = true;
|
|
11264
|
+
}
|
|
11265
|
+
}
|
|
11266
|
+
const typeArg = init.getTypeArguments()[0];
|
|
11267
|
+
const resolved = resolvePropType(typeArg);
|
|
11268
|
+
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
11269
|
+
const name = alias ?? fieldName;
|
|
11270
|
+
const prop = {
|
|
11271
|
+
name,
|
|
11272
|
+
type: typeText,
|
|
11273
|
+
required,
|
|
11274
|
+
sourceStartLine: field.getStartLineNumber(),
|
|
11275
|
+
sourceEndLine: field.getEndLineNumber()
|
|
11276
|
+
};
|
|
11277
|
+
if (defaultValue !== void 0)
|
|
11278
|
+
prop.defaultValue = defaultValue;
|
|
11279
|
+
if (resolved.allowedValues && !transformIsBoolean && !transformIsNumber) {
|
|
11280
|
+
prop.allowedValues = resolved.allowedValues;
|
|
11281
|
+
}
|
|
11282
|
+
return prop;
|
|
11283
|
+
}
|
|
11284
|
+
var init_extract_signal_input = __esm({
|
|
11285
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-signal-input.js"() {
|
|
11286
|
+
"use strict";
|
|
11287
|
+
init_resolve_prop_type();
|
|
11288
|
+
}
|
|
11289
|
+
});
|
|
11290
|
+
|
|
11291
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/parse-inputs-array-entry.js
|
|
11292
|
+
function parseInputsArrayEntry(entry) {
|
|
11293
|
+
const trimmed = entry.trim();
|
|
11294
|
+
if (!trimmed)
|
|
11295
|
+
return null;
|
|
11296
|
+
const parts = trimmed.split(":");
|
|
11297
|
+
if (parts.length === 1) {
|
|
11298
|
+
return { fieldName: parts[0].trim(), alias: null };
|
|
11299
|
+
}
|
|
11300
|
+
if (parts.length === 2) {
|
|
11301
|
+
const field = parts[0].trim();
|
|
11302
|
+
const alias = parts[1].trim();
|
|
11303
|
+
if (!field || !alias)
|
|
11304
|
+
return null;
|
|
11305
|
+
return { fieldName: field, alias };
|
|
11306
|
+
}
|
|
11307
|
+
return null;
|
|
11308
|
+
}
|
|
11309
|
+
var init_parse_inputs_array_entry = __esm({
|
|
11310
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/parse-inputs-array-entry.js"() {
|
|
11311
|
+
"use strict";
|
|
11312
|
+
}
|
|
11313
|
+
});
|
|
11314
|
+
|
|
11315
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-props.js
|
|
11316
|
+
function collectClassChain(cls) {
|
|
11317
|
+
const chain = [cls];
|
|
11318
|
+
const seen = /* @__PURE__ */ new Set([cls]);
|
|
11319
|
+
let current = cls;
|
|
11320
|
+
for (let i = 0; i < MAX_BASE_CHAIN; i++) {
|
|
11321
|
+
let base;
|
|
11322
|
+
try {
|
|
11323
|
+
base = current.getBaseClass();
|
|
11324
|
+
} catch {
|
|
11325
|
+
break;
|
|
11326
|
+
}
|
|
11327
|
+
if (!base || seen.has(base))
|
|
11328
|
+
break;
|
|
11329
|
+
chain.push(base);
|
|
11330
|
+
seen.add(base);
|
|
11331
|
+
current = base;
|
|
11332
|
+
}
|
|
11333
|
+
return chain;
|
|
11334
|
+
}
|
|
11335
|
+
function extractProps2(cls, meta) {
|
|
11336
|
+
const byName = /* @__PURE__ */ new Map();
|
|
11337
|
+
const chain = collectClassChain(cls);
|
|
11338
|
+
for (const klass of chain) {
|
|
11339
|
+
for (const field of klass.getProperties()) {
|
|
11340
|
+
const prop = extractDecoratorInput(field);
|
|
11341
|
+
if (prop && !byName.has(prop.name))
|
|
11342
|
+
byName.set(prop.name, prop);
|
|
11343
|
+
}
|
|
11344
|
+
for (const setter of klass.getSetAccessors()) {
|
|
11345
|
+
const prop = extractDecoratorInput(setter);
|
|
11346
|
+
if (prop && !byName.has(prop.name))
|
|
11347
|
+
byName.set(prop.name, prop);
|
|
11348
|
+
}
|
|
11349
|
+
for (const getter of klass.getGetAccessors()) {
|
|
11350
|
+
const prop = extractDecoratorInput(getter);
|
|
11351
|
+
if (prop && !byName.has(prop.name))
|
|
11352
|
+
byName.set(prop.name, prop);
|
|
11353
|
+
}
|
|
11354
|
+
for (const field of klass.getProperties()) {
|
|
11355
|
+
const prop = extractSignalInput(field);
|
|
11356
|
+
if (prop && !byName.has(prop.name))
|
|
11357
|
+
byName.set(prop.name, prop);
|
|
11358
|
+
}
|
|
11359
|
+
}
|
|
11360
|
+
for (const entry of meta.inputsArray) {
|
|
11361
|
+
const parsed = parseInputsArrayEntry(entry);
|
|
11362
|
+
if (!parsed)
|
|
11363
|
+
continue;
|
|
11364
|
+
const name = parsed.alias ?? parsed.fieldName;
|
|
11365
|
+
if (byName.has(name))
|
|
11366
|
+
continue;
|
|
11367
|
+
byName.set(name, { name, type: "any", required: false });
|
|
11368
|
+
}
|
|
11369
|
+
return [...byName.values()];
|
|
11370
|
+
}
|
|
11371
|
+
var MAX_BASE_CHAIN;
|
|
11372
|
+
var init_extract_props = __esm({
|
|
11373
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-props.js"() {
|
|
11374
|
+
"use strict";
|
|
11375
|
+
init_extract_decorator_input();
|
|
11376
|
+
init_extract_signal_input();
|
|
11377
|
+
init_parse_inputs_array_entry();
|
|
11378
|
+
MAX_BASE_CHAIN = 10;
|
|
11379
|
+
}
|
|
11380
|
+
});
|
|
11381
|
+
|
|
11382
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/normalize-component-name.js
|
|
11383
|
+
function normalizeComponentName2(className) {
|
|
11384
|
+
for (const suffix of SUFFIXES) {
|
|
11385
|
+
if (className.endsWith(suffix) && className.length > suffix.length) {
|
|
11386
|
+
return className.slice(0, -suffix.length);
|
|
11387
|
+
}
|
|
11388
|
+
}
|
|
11389
|
+
return className;
|
|
11390
|
+
}
|
|
11391
|
+
var SUFFIXES;
|
|
11392
|
+
var init_normalize_component_name = __esm({
|
|
11393
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/normalize-component-name.js"() {
|
|
11394
|
+
"use strict";
|
|
11395
|
+
SUFFIXES = ["Component", "Directive"];
|
|
11396
|
+
}
|
|
11397
|
+
});
|
|
11398
|
+
|
|
11399
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-decorator-string.js
|
|
11400
|
+
import { Node as Node14 } from "ts-morph";
|
|
11401
|
+
function readDecoratorString(obj, propName) {
|
|
11402
|
+
const prop = obj.getProperty(propName);
|
|
11403
|
+
if (!prop || !Node14.isPropertyAssignment(prop))
|
|
11404
|
+
return null;
|
|
11405
|
+
const init = prop.getInitializer();
|
|
11406
|
+
if (!init)
|
|
11407
|
+
return null;
|
|
11408
|
+
if (Node14.isStringLiteral(init) || Node14.isNoSubstitutionTemplateLiteral(init)) {
|
|
11409
|
+
return init.getLiteralText();
|
|
11410
|
+
}
|
|
11411
|
+
return null;
|
|
11412
|
+
}
|
|
11413
|
+
function readDecoratorStringArray(obj, propName) {
|
|
11414
|
+
const prop = obj.getProperty(propName);
|
|
11415
|
+
if (!prop || !Node14.isPropertyAssignment(prop))
|
|
11416
|
+
return [];
|
|
11417
|
+
const init = prop.getInitializer();
|
|
11418
|
+
if (!init || !Node14.isArrayLiteralExpression(init))
|
|
11419
|
+
return [];
|
|
11420
|
+
const out = [];
|
|
11421
|
+
for (const el of init.getElements()) {
|
|
11422
|
+
if (Node14.isStringLiteral(el) || Node14.isNoSubstitutionTemplateLiteral(el)) {
|
|
11423
|
+
out.push(el.getLiteralText());
|
|
11424
|
+
}
|
|
11425
|
+
}
|
|
11426
|
+
return out;
|
|
11427
|
+
}
|
|
11428
|
+
var init_read_decorator_string = __esm({
|
|
11429
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-decorator-string.js"() {
|
|
11430
|
+
"use strict";
|
|
11431
|
+
}
|
|
11432
|
+
});
|
|
11433
|
+
|
|
11434
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-component-metadata.js
|
|
11435
|
+
import { dirname as dirname9, resolve as resolve11 } from "node:path";
|
|
11436
|
+
function readComponentMetadata(cls, sourceFilePath) {
|
|
11437
|
+
const obj = findComponentDecorator(cls);
|
|
11438
|
+
if (!obj)
|
|
11439
|
+
return null;
|
|
11440
|
+
const className = cls.getName();
|
|
11441
|
+
if (!className)
|
|
11442
|
+
return null;
|
|
11443
|
+
const rawSelector = readDecoratorString(obj, "selector");
|
|
11444
|
+
const inlineTemplate = readDecoratorString(obj, "template");
|
|
11445
|
+
const templateUrlRel = readDecoratorString(obj, "templateUrl");
|
|
11446
|
+
const inputsArray = readDecoratorStringArray(obj, "inputs");
|
|
11447
|
+
const templatePath = templateUrlRel ? resolve11(dirname9(sourceFilePath), templateUrlRel) : null;
|
|
11448
|
+
const decorator = cls.getDecorator("Component");
|
|
11449
|
+
const decoratorLine = decorator?.getStartLineNumber() ?? cls.getStartLineNumber();
|
|
11450
|
+
return {
|
|
11451
|
+
className,
|
|
11452
|
+
normalizedName: normalizeComponentName2(className),
|
|
11453
|
+
rawSelector,
|
|
11454
|
+
inlineTemplate,
|
|
11455
|
+
templatePath,
|
|
11456
|
+
inputsArray,
|
|
11457
|
+
decoratorLine
|
|
11458
|
+
};
|
|
11459
|
+
}
|
|
11460
|
+
var init_read_component_metadata = __esm({
|
|
11461
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-component-metadata.js"() {
|
|
11462
|
+
"use strict";
|
|
11463
|
+
init_find_component_decorator();
|
|
11464
|
+
init_normalize_component_name();
|
|
11465
|
+
init_read_decorator_string();
|
|
11466
|
+
}
|
|
11467
|
+
});
|
|
11468
|
+
|
|
11469
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/parse-ng-content-elements.js
|
|
11470
|
+
function parseNgContentElements(templateHtml) {
|
|
11471
|
+
const out = [];
|
|
11472
|
+
const tagRe = /<ng-content\b([^>]*?)\/?>/gi;
|
|
11473
|
+
for (const match2 of templateHtml.matchAll(tagRe)) {
|
|
11474
|
+
const attrs = match2[1] ?? "";
|
|
11475
|
+
const selectMatch = attrs.match(/\bselect\s*=\s*(?:"([^"]*)"|'([^']*)')/);
|
|
11476
|
+
const rawSelect = selectMatch ? selectMatch[1] ?? selectMatch[2] ?? null : null;
|
|
11477
|
+
const sourceLine = countLines(templateHtml, match2.index ?? 0);
|
|
11478
|
+
out.push({ rawSelect, sourceLine });
|
|
11479
|
+
}
|
|
11480
|
+
return out;
|
|
11481
|
+
}
|
|
11482
|
+
function countLines(text, offset) {
|
|
11483
|
+
let line = 1;
|
|
11484
|
+
for (let i = 0; i < offset && i < text.length; i++) {
|
|
11485
|
+
if (text.charCodeAt(i) === 10)
|
|
11486
|
+
line++;
|
|
11487
|
+
}
|
|
11488
|
+
return line;
|
|
11489
|
+
}
|
|
11490
|
+
var init_parse_ng_content_elements = __esm({
|
|
11491
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/parse-ng-content-elements.js"() {
|
|
11492
|
+
"use strict";
|
|
11493
|
+
}
|
|
11494
|
+
});
|
|
11495
|
+
|
|
11496
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/resolve-template-source.js
|
|
11497
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
11498
|
+
async function resolveTemplateSource(meta) {
|
|
11499
|
+
if (meta.inlineTemplate !== null)
|
|
11500
|
+
return meta.inlineTemplate;
|
|
11501
|
+
if (meta.templatePath === null)
|
|
11502
|
+
return null;
|
|
11503
|
+
try {
|
|
11504
|
+
return await readFile7(meta.templatePath, "utf8");
|
|
11505
|
+
} catch {
|
|
11506
|
+
return null;
|
|
11507
|
+
}
|
|
11508
|
+
}
|
|
11509
|
+
var init_resolve_template_source = __esm({
|
|
11510
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/resolve-template-source.js"() {
|
|
11511
|
+
"use strict";
|
|
11512
|
+
}
|
|
11513
|
+
});
|
|
11514
|
+
|
|
11515
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/strip-library-prefix.js
|
|
11516
|
+
function stripLibraryPrefix(name) {
|
|
11517
|
+
for (const prefix of KNOWN_PREFIXES) {
|
|
11518
|
+
if (name.startsWith(prefix) && name.length > prefix.length) {
|
|
11519
|
+
const rest = name.slice(prefix.length);
|
|
11520
|
+
if (rest[0] && rest[0] === rest[0].toUpperCase()) {
|
|
11521
|
+
return rest;
|
|
11522
|
+
}
|
|
11523
|
+
}
|
|
11524
|
+
}
|
|
11525
|
+
return name;
|
|
11526
|
+
}
|
|
11527
|
+
var KNOWN_PREFIXES;
|
|
11528
|
+
var init_strip_library_prefix = __esm({
|
|
11529
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/strip-library-prefix.js"() {
|
|
11530
|
+
"use strict";
|
|
11531
|
+
KNOWN_PREFIXES = ["Mat", "Cdk", "Nz", "Cds", "Ibm", "Clr", "Hlm", "Brn", "Tui", "Nb", "Fd", "P", "Ng"];
|
|
11532
|
+
}
|
|
11533
|
+
});
|
|
11534
|
+
|
|
11535
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/derive-slot-name.js
|
|
11536
|
+
function deriveSlotName(rawSelect, parentNormalizedName) {
|
|
11537
|
+
if (!rawSelect || rawSelect.trim() === "")
|
|
11538
|
+
return "children";
|
|
11539
|
+
if (rawSelect.includes(",")) {
|
|
11540
|
+
const first = rawSelect.split(",")[0].trim();
|
|
11541
|
+
return deriveSingleSelectorName(first, parentNormalizedName);
|
|
11542
|
+
}
|
|
11543
|
+
return deriveSingleSelectorName(rawSelect.trim(), parentNormalizedName);
|
|
11544
|
+
}
|
|
11545
|
+
function deriveSingleSelectorName(sel, parentNormalizedName) {
|
|
11546
|
+
const slotAttrMatch = sel.match(/^\[\s*slot\s*=\s*['"]?([^'"\]]+)['"]?\s*\]$/);
|
|
11547
|
+
if (slotAttrMatch)
|
|
11548
|
+
return slotAttrMatch[1].trim();
|
|
11549
|
+
if (sel.startsWith(".")) {
|
|
11550
|
+
const last = sel.slice(1).split("-").pop() ?? sel.slice(1);
|
|
11551
|
+
return kebabToCamel2(last);
|
|
11552
|
+
}
|
|
11553
|
+
const attrMatch = sel.match(/^\[([^=\]]+)\]$/);
|
|
11554
|
+
if (attrMatch) {
|
|
11555
|
+
const attr = attrMatch[1].trim();
|
|
11556
|
+
const stripped = tryStripSubComponentOrLibraryPrefix(attr, parentNormalizedName);
|
|
11557
|
+
return stripped || kebabToCamel2(attr);
|
|
11558
|
+
}
|
|
11559
|
+
const elMatch = sel.match(/^([a-zA-Z][a-zA-Z0-9-]*)/);
|
|
11560
|
+
if (elMatch) {
|
|
11561
|
+
const tag = elMatch[1];
|
|
11562
|
+
const stripped = tryStripSubComponentOrLibraryPrefix(tag, parentNormalizedName);
|
|
11563
|
+
return stripped || kebabToCamel2(tag);
|
|
11564
|
+
}
|
|
11565
|
+
return sel.replace(/\s+/g, "");
|
|
11566
|
+
}
|
|
11567
|
+
function tryStripSubComponentOrLibraryPrefix(ident, parentNormalizedName) {
|
|
11568
|
+
const parentKebab = pascalToKebab(parentNormalizedName);
|
|
11569
|
+
if (parentKebab && ident.startsWith(`${parentKebab}-`)) {
|
|
11570
|
+
return kebabToCamel2(ident.slice(parentKebab.length + 1));
|
|
11571
|
+
}
|
|
11572
|
+
const asPascal = kebabToPascal2(ident);
|
|
11573
|
+
const stripped = stripLibraryPrefix(asPascal);
|
|
11574
|
+
if (stripped !== asPascal) {
|
|
11575
|
+
return stripped.charAt(0).toLowerCase() + stripped.slice(1);
|
|
11576
|
+
}
|
|
11577
|
+
return null;
|
|
11578
|
+
}
|
|
11579
|
+
function kebabToCamel2(s) {
|
|
11580
|
+
return s.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase());
|
|
11581
|
+
}
|
|
11582
|
+
function kebabToPascal2(s) {
|
|
11583
|
+
const camel = kebabToCamel2(s);
|
|
11584
|
+
return camel.charAt(0).toUpperCase() + camel.slice(1);
|
|
11585
|
+
}
|
|
11586
|
+
function pascalToKebab(s) {
|
|
11587
|
+
return s.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
11588
|
+
}
|
|
11589
|
+
var init_derive_slot_name = __esm({
|
|
11590
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/derive-slot-name.js"() {
|
|
11591
|
+
"use strict";
|
|
11592
|
+
init_strip_library_prefix();
|
|
11593
|
+
}
|
|
11594
|
+
});
|
|
11595
|
+
|
|
11596
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-content-child-queries.js
|
|
11597
|
+
import { Node as Node15 } from "ts-morph";
|
|
11598
|
+
function extractContentChildQueries(cls) {
|
|
11599
|
+
const out = [];
|
|
11600
|
+
for (const field of cls.getProperties()) {
|
|
11601
|
+
const fieldName = field.getName();
|
|
11602
|
+
const init = field.getInitializer();
|
|
11603
|
+
if (init && Node15.isCallExpression(init)) {
|
|
11604
|
+
const callee = init.getExpression();
|
|
11605
|
+
if (Node15.isIdentifier(callee)) {
|
|
11606
|
+
const name = callee.getText();
|
|
11607
|
+
if (name === "contentChild" || name === "contentChildren") {
|
|
11608
|
+
const first = init.getArguments()[0];
|
|
11609
|
+
const allowed = resolveClassIdentifierArg(first);
|
|
11610
|
+
out.push(buildSlot(fieldName, allowed));
|
|
11611
|
+
continue;
|
|
11612
|
+
}
|
|
11613
|
+
}
|
|
11614
|
+
}
|
|
11615
|
+
for (const decName of ["ContentChild", "ContentChildren"]) {
|
|
11616
|
+
const dec = field.getDecorator(decName);
|
|
11617
|
+
if (dec) {
|
|
11618
|
+
const first = dec.getArguments()[0];
|
|
11619
|
+
const allowed = resolveClassIdentifierArg(first);
|
|
11620
|
+
out.push(buildSlot(fieldName, allowed));
|
|
11621
|
+
break;
|
|
11622
|
+
}
|
|
11623
|
+
}
|
|
11624
|
+
}
|
|
11625
|
+
return out;
|
|
11626
|
+
}
|
|
11627
|
+
function resolveClassIdentifierArg(arg) {
|
|
11628
|
+
if (!arg)
|
|
11629
|
+
return [];
|
|
11630
|
+
if (Node15.isStringLiteral(arg) || Node15.isNoSubstitutionTemplateLiteral(arg))
|
|
11631
|
+
return [];
|
|
11632
|
+
if (Node15.isIdentifier(arg))
|
|
11633
|
+
return [arg.getText()];
|
|
11634
|
+
return [];
|
|
11635
|
+
}
|
|
11636
|
+
function buildSlot(name, allowed) {
|
|
11637
|
+
const slot = {
|
|
11638
|
+
name,
|
|
11639
|
+
isDefault: false
|
|
11640
|
+
};
|
|
11641
|
+
if (allowed.length > 0)
|
|
11642
|
+
slot.allowedComponents = allowed;
|
|
11643
|
+
return slot;
|
|
11644
|
+
}
|
|
11645
|
+
var init_extract_content_child_queries = __esm({
|
|
11646
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-content-child-queries.js"() {
|
|
11647
|
+
"use strict";
|
|
11648
|
+
}
|
|
11649
|
+
});
|
|
11650
|
+
|
|
11651
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-template-ref-slots.js
|
|
11652
|
+
function extractTemplateRefSlots(props) {
|
|
11653
|
+
const nextProps = [];
|
|
11654
|
+
const slots = [];
|
|
11655
|
+
for (const prop of props) {
|
|
11656
|
+
const type = prop.type;
|
|
11657
|
+
const hasTemplateRef = /\bTemplateRef\b/.test(type);
|
|
11658
|
+
if (!hasTemplateRef) {
|
|
11659
|
+
nextProps.push(prop);
|
|
11660
|
+
continue;
|
|
11661
|
+
}
|
|
11662
|
+
const isPureTemplateRef = /^\s*TemplateRef<[^>]*>\s*(\|\s*(null|undefined)\s*)*$/.test(type);
|
|
11663
|
+
if (!isPureTemplateRef) {
|
|
11664
|
+
nextProps.push(prop);
|
|
11665
|
+
}
|
|
11666
|
+
slots.push({ name: prop.name, isDefault: false });
|
|
11667
|
+
}
|
|
11668
|
+
return { props: nextProps, slots };
|
|
11669
|
+
}
|
|
11670
|
+
var init_extract_template_ref_slots = __esm({
|
|
11671
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-template-ref-slots.js"() {
|
|
11672
|
+
"use strict";
|
|
11673
|
+
}
|
|
11674
|
+
});
|
|
11675
|
+
|
|
11676
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-slots.js
|
|
11677
|
+
async function extractSlots3(cls, meta, props) {
|
|
11678
|
+
const byName = /* @__PURE__ */ new Map();
|
|
11679
|
+
const template = await resolveTemplateSource(meta);
|
|
11680
|
+
if (template) {
|
|
11681
|
+
for (const el of parseNgContentElements(template)) {
|
|
11682
|
+
const name = deriveSlotName(el.rawSelect, meta.normalizedName);
|
|
11683
|
+
if (byName.has(name))
|
|
11684
|
+
continue;
|
|
11685
|
+
byName.set(name, {
|
|
11686
|
+
name,
|
|
11687
|
+
isDefault: el.rawSelect === null
|
|
11688
|
+
});
|
|
11689
|
+
}
|
|
11690
|
+
}
|
|
11691
|
+
for (const slot of extractContentChildQueries(cls)) {
|
|
11692
|
+
if (!byName.has(slot.name))
|
|
11693
|
+
byName.set(slot.name, slot);
|
|
11694
|
+
}
|
|
11695
|
+
const split = extractTemplateRefSlots(props);
|
|
11696
|
+
for (const slot of split.slots) {
|
|
11697
|
+
if (!byName.has(slot.name))
|
|
11698
|
+
byName.set(slot.name, slot);
|
|
11699
|
+
}
|
|
11700
|
+
return { props: split.props, slots: [...byName.values()] };
|
|
11701
|
+
}
|
|
11702
|
+
var init_extract_slots = __esm({
|
|
11703
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-slots.js"() {
|
|
11704
|
+
"use strict";
|
|
11705
|
+
init_parse_ng_content_elements();
|
|
11706
|
+
init_resolve_template_source();
|
|
11707
|
+
init_derive_slot_name();
|
|
11708
|
+
init_extract_content_child_queries();
|
|
11709
|
+
init_extract_template_ref_slots();
|
|
11710
|
+
}
|
|
11711
|
+
});
|
|
11712
|
+
|
|
11713
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
|
|
11714
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
11715
|
+
import { ModuleKind as ModuleKind2, Project as Project7, ScriptTarget as ScriptTarget2 } from "ts-morph";
|
|
11716
|
+
async function extractAngularComponents(filePaths, onProgress, _opts) {
|
|
11717
|
+
const components = [];
|
|
11718
|
+
const warnings = [];
|
|
11719
|
+
let filesProcessed = 0;
|
|
11720
|
+
const project = new Project7({
|
|
11721
|
+
useInMemoryFileSystem: false,
|
|
11722
|
+
skipAddingFilesFromTsConfig: true,
|
|
11723
|
+
compilerOptions: {
|
|
11724
|
+
target: ScriptTarget2.ES2022,
|
|
11725
|
+
module: ModuleKind2.ESNext,
|
|
11726
|
+
experimentalDecorators: true,
|
|
11727
|
+
emitDecoratorMetadata: false,
|
|
11728
|
+
allowJs: false
|
|
11729
|
+
}
|
|
11730
|
+
});
|
|
11731
|
+
for (const filePath of filePaths) {
|
|
11732
|
+
try {
|
|
11733
|
+
const source = await readFile8(filePath, "utf8");
|
|
11734
|
+
const sourceFile = project.createSourceFile(filePath, source, { overwrite: true });
|
|
11735
|
+
for (const cls of sourceFile.getClasses()) {
|
|
11736
|
+
if (!hasComponentDecorator(cls))
|
|
11737
|
+
continue;
|
|
11738
|
+
if (!findComponentDecorator(cls)) {
|
|
11739
|
+
warnings.push(`${filePath}: ${cls.getName() ?? "<anonymous>"} has @Component with a non-literal argument; skipped.`);
|
|
11740
|
+
continue;
|
|
11741
|
+
}
|
|
11742
|
+
const meta = readComponentMetadata(cls, filePath);
|
|
11743
|
+
if (!meta)
|
|
11744
|
+
continue;
|
|
11745
|
+
const propsOnly = extractProps2(cls, meta);
|
|
11746
|
+
const { props, slots } = await extractSlots3(cls, meta, propsOnly);
|
|
11747
|
+
const partial = {
|
|
11748
|
+
name: meta.className,
|
|
11749
|
+
source: filePath,
|
|
11750
|
+
framework: "angular",
|
|
11751
|
+
props,
|
|
11752
|
+
slots: normalizeSlots(slots),
|
|
11753
|
+
sourcePath: filePath
|
|
11754
|
+
};
|
|
11755
|
+
const score = computeExtractionScore(partial);
|
|
11756
|
+
partial.extractionConfidence = score.confidence;
|
|
11757
|
+
partial.reviewReasons = score.reasons;
|
|
11758
|
+
partial.needsReview = deriveNeedsReview(score.confidence);
|
|
11759
|
+
components.push(partial);
|
|
11760
|
+
}
|
|
11761
|
+
sourceFile.forget();
|
|
11762
|
+
} catch (err) {
|
|
11763
|
+
warnings.push(`${filePath}: Angular extractor failed \u2014 ${err instanceof Error ? err.message : String(err)}`);
|
|
11764
|
+
} finally {
|
|
11765
|
+
filesProcessed++;
|
|
11766
|
+
if (onProgress)
|
|
11767
|
+
onProgress({ filesProcessed, componentsFound: components.length });
|
|
11768
|
+
}
|
|
11769
|
+
}
|
|
11770
|
+
return {
|
|
11771
|
+
components: components.sort((a, b) => a.name.localeCompare(b.name)),
|
|
11772
|
+
warnings
|
|
11773
|
+
};
|
|
11774
|
+
}
|
|
11775
|
+
function normalizeSlots(slots) {
|
|
11776
|
+
let fallbackIndex = 0;
|
|
11777
|
+
return slots.map((slot) => {
|
|
11778
|
+
if (slot.name.trim())
|
|
11779
|
+
return slot;
|
|
11780
|
+
const name = fallbackIndex === 0 ? "children" : `slot_${fallbackIndex}`;
|
|
11781
|
+
fallbackIndex++;
|
|
11782
|
+
return { ...slot, name };
|
|
11783
|
+
});
|
|
11784
|
+
}
|
|
11785
|
+
var init_extract_angular_components = __esm({
|
|
11786
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js"() {
|
|
11787
|
+
"use strict";
|
|
11788
|
+
init_scoring();
|
|
11789
|
+
init_find_component_decorator();
|
|
11790
|
+
init_extract_props();
|
|
11791
|
+
init_read_component_metadata();
|
|
11792
|
+
init_extract_slots();
|
|
11793
|
+
}
|
|
11794
|
+
});
|
|
11795
|
+
|
|
11796
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/is-angular-source-file.js
|
|
11797
|
+
import { openSync, readSync, closeSync, statSync as statSync3 } from "node:fs";
|
|
11798
|
+
function isAngularSourceFile(filePath) {
|
|
11799
|
+
if (!/\.[cm]?ts$/.test(filePath))
|
|
11800
|
+
return false;
|
|
11801
|
+
if (filePath.endsWith(".d.ts"))
|
|
11802
|
+
return false;
|
|
11803
|
+
try {
|
|
11804
|
+
const stats = statSync3(filePath);
|
|
11805
|
+
const toRead = Math.min(HEAD_BYTES, stats.size);
|
|
11806
|
+
if (toRead === 0)
|
|
11807
|
+
return false;
|
|
11808
|
+
const fd = openSync(filePath, "r");
|
|
11809
|
+
try {
|
|
11810
|
+
const bytesRead = readSync(fd, buffer, 0, toRead, 0);
|
|
11811
|
+
const head = buffer.subarray(0, bytesRead).toString("utf8");
|
|
11812
|
+
return head.includes("@angular/core");
|
|
11813
|
+
} finally {
|
|
11814
|
+
closeSync(fd);
|
|
11815
|
+
}
|
|
11816
|
+
} catch {
|
|
11817
|
+
return false;
|
|
11818
|
+
}
|
|
11819
|
+
}
|
|
11820
|
+
var HEAD_BYTES, buffer;
|
|
11821
|
+
var init_is_angular_source_file = __esm({
|
|
11822
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/is-angular-source-file.js"() {
|
|
11823
|
+
"use strict";
|
|
11824
|
+
HEAD_BYTES = 32 * 1024;
|
|
11825
|
+
buffer = Buffer.alloc(HEAD_BYTES);
|
|
11826
|
+
}
|
|
11827
|
+
});
|
|
11828
|
+
|
|
10989
11829
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/services/run-extraction-service.js
|
|
10990
11830
|
function getPathPreferenceScore(filePath) {
|
|
10991
11831
|
const normalized = filePath.replace(/\\/g, "/");
|
|
@@ -11278,6 +12118,8 @@ var init_run_extraction_service = __esm({
|
|
|
11278
12118
|
init_extract_astro_components();
|
|
11279
12119
|
init_extract_web_components();
|
|
11280
12120
|
init_extract_svelte_components();
|
|
12121
|
+
init_extract_angular_components();
|
|
12122
|
+
init_is_angular_source_file();
|
|
11281
12123
|
extractors = [
|
|
11282
12124
|
{
|
|
11283
12125
|
name: "stencil",
|
|
@@ -11304,6 +12146,13 @@ var init_run_extraction_service = __esm({
|
|
|
11304
12146
|
fileFilter: (f) => f.endsWith(".astro"),
|
|
11305
12147
|
extract: extractAstroComponents
|
|
11306
12148
|
},
|
|
12149
|
+
{
|
|
12150
|
+
// Must run BEFORE web-components (both claim bare .ts). The sniff reads
|
|
12151
|
+
// the file head looking for `@angular/core` so we only claim real Angular files.
|
|
12152
|
+
name: "angular",
|
|
12153
|
+
fileFilter: (f) => isAngularSourceFile(f),
|
|
12154
|
+
extract: extractAngularComponents
|
|
12155
|
+
},
|
|
11307
12156
|
{
|
|
11308
12157
|
name: "web-components",
|
|
11309
12158
|
fileFilter: (f) => /\.[jt]s$/.test(f) && !/\.[jt]sx$/.test(f) && !f.endsWith(".d.ts"),
|
|
@@ -11532,16 +12381,16 @@ var init_apply_mapping = __esm({
|
|
|
11532
12381
|
|
|
11533
12382
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
|
|
11534
12383
|
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "node:fs";
|
|
11535
|
-
import { dirname as
|
|
12384
|
+
import { dirname as dirname10, join as join8, resolve as resolve12 } from "node:path";
|
|
11536
12385
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
11537
12386
|
function resolvePromptPath(fileName) {
|
|
11538
|
-
const thisDir =
|
|
12387
|
+
const thisDir = dirname10(fileURLToPath2(import.meta.url));
|
|
11539
12388
|
let dir = thisDir;
|
|
11540
12389
|
for (; ; ) {
|
|
11541
12390
|
const candidate = join8(dir, "prompts");
|
|
11542
12391
|
if (existsSync6(candidate))
|
|
11543
12392
|
return join8(candidate, fileName);
|
|
11544
|
-
const parent =
|
|
12393
|
+
const parent = resolve12(dir, "..");
|
|
11545
12394
|
if (parent === dir) {
|
|
11546
12395
|
throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
|
|
11547
12396
|
}
|
|
@@ -11639,14 +12488,31 @@ var CANDIDATE_NAME_PATTERNS, CANDIDATE_CONTENT_MARKERS, PROMPT_CANDIDATE_TOKEN_B
|
|
|
11639
12488
|
var init_candidate_files = __esm({
|
|
11640
12489
|
"packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/constants/candidate-files.js"() {
|
|
11641
12490
|
"use strict";
|
|
11642
|
-
CANDIDATE_NAME_PATTERNS = [
|
|
12491
|
+
CANDIDATE_NAME_PATTERNS = [
|
|
12492
|
+
/mapping/i,
|
|
12493
|
+
/meta/i,
|
|
12494
|
+
/registry/i,
|
|
12495
|
+
/schema/i,
|
|
12496
|
+
/composition/i,
|
|
12497
|
+
/\.module\.ts$/i,
|
|
12498
|
+
/\.component\.ts$/i,
|
|
12499
|
+
/public[-_]api\.ts$/i,
|
|
12500
|
+
/^index\.ts$/i
|
|
12501
|
+
];
|
|
11643
12502
|
CANDIDATE_CONTENT_MARKERS = [
|
|
11644
12503
|
"requiredParent",
|
|
11645
12504
|
"withParentType",
|
|
11646
12505
|
"allowedTagNames",
|
|
11647
12506
|
"createContext",
|
|
11648
12507
|
"MappingContext",
|
|
11649
|
-
"allowedComponents"
|
|
12508
|
+
"allowedComponents",
|
|
12509
|
+
"TemplateRef",
|
|
12510
|
+
"NG_VALUE_ACCESSOR",
|
|
12511
|
+
"ContentChild",
|
|
12512
|
+
"contentChild",
|
|
12513
|
+
"ng-content",
|
|
12514
|
+
"@NgModule",
|
|
12515
|
+
"standalone: true"
|
|
11650
12516
|
];
|
|
11651
12517
|
PROMPT_CANDIDATE_TOKEN_BUDGET = 8e4;
|
|
11652
12518
|
}
|
|
@@ -11729,8 +12595,8 @@ var init_composition_cache_key = __esm({
|
|
|
11729
12595
|
});
|
|
11730
12596
|
|
|
11731
12597
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
|
|
11732
|
-
import { dirname as
|
|
11733
|
-
function
|
|
12598
|
+
import { dirname as dirname11 } from "node:path";
|
|
12599
|
+
function kebabToPascal3(name) {
|
|
11734
12600
|
return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
|
|
11735
12601
|
}
|
|
11736
12602
|
function collectManifestEdges(files, componentNames) {
|
|
@@ -11752,7 +12618,7 @@ function collectManifestEdges(files, componentNames) {
|
|
|
11752
12618
|
const rawParentName = typeof component === "object" && component !== null && typeof component.name === "string" ? component.name : void 0;
|
|
11753
12619
|
if (!rawParentName)
|
|
11754
12620
|
continue;
|
|
11755
|
-
const parent =
|
|
12621
|
+
const parent = kebabToPascal3(rawParentName);
|
|
11756
12622
|
if (!componentNames.has(parent))
|
|
11757
12623
|
continue;
|
|
11758
12624
|
const variantsMeta = root.variantsMeta;
|
|
@@ -11772,7 +12638,7 @@ function collectManifestEdges(files, componentNames) {
|
|
|
11772
12638
|
const rawChildName = value.name;
|
|
11773
12639
|
if (typeof rawChildName !== "string")
|
|
11774
12640
|
continue;
|
|
11775
|
-
const child =
|
|
12641
|
+
const child = kebabToPascal3(rawChildName);
|
|
11776
12642
|
if (!componentNames.has(child) || child === parent)
|
|
11777
12643
|
continue;
|
|
11778
12644
|
const key = `${parent}::${child}`;
|
|
@@ -11791,8 +12657,8 @@ function collectAgentsDocEdges(files, components, componentNames) {
|
|
|
11791
12657
|
for (const file of files) {
|
|
11792
12658
|
if (!file.path.endsWith("AGENTS.md"))
|
|
11793
12659
|
continue;
|
|
11794
|
-
const docDir =
|
|
11795
|
-
const parent = components.find((c2) => c2.sourcePath &&
|
|
12660
|
+
const docDir = dirname11(file.path);
|
|
12661
|
+
const parent = components.find((c2) => c2.sourcePath && dirname11(c2.sourcePath) === docDir)?.name;
|
|
11796
12662
|
if (!parent || !componentNames.has(parent))
|
|
11797
12663
|
continue;
|
|
11798
12664
|
for (const line of file.content.split("\n")) {
|
|
@@ -11801,7 +12667,7 @@ function collectAgentsDocEdges(files, components, componentNames) {
|
|
|
11801
12667
|
continue;
|
|
11802
12668
|
for (const match2 of line.matchAll(BOLD_BACKTICK)) {
|
|
11803
12669
|
const raw = match2[1];
|
|
11804
|
-
const candidate = componentNames.has(raw) ? raw :
|
|
12670
|
+
const candidate = componentNames.has(raw) ? raw : kebabToPascal3(raw);
|
|
11805
12671
|
if (!componentNames.has(candidate) || candidate === parent)
|
|
11806
12672
|
continue;
|
|
11807
12673
|
const key = `${parent}::${candidate}`;
|
|
@@ -12439,7 +13305,7 @@ var init_create_component_id = __esm({
|
|
|
12439
13305
|
|
|
12440
13306
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/resolve-component-source-path.js
|
|
12441
13307
|
import { access } from "node:fs/promises";
|
|
12442
|
-
import { isAbsolute, relative, resolve as
|
|
13308
|
+
import { isAbsolute, relative, resolve as resolve13 } from "node:path";
|
|
12443
13309
|
async function resolveComponentSourcePath(source, reviewRoot) {
|
|
12444
13310
|
if (isAbsolute(source)) {
|
|
12445
13311
|
try {
|
|
@@ -12449,7 +13315,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
|
|
|
12449
13315
|
throw new Error(`Unable to access component source at ${source}`);
|
|
12450
13316
|
}
|
|
12451
13317
|
}
|
|
12452
|
-
const candidate =
|
|
13318
|
+
const candidate = resolve13(reviewRoot, source);
|
|
12453
13319
|
const relativeToRoot = relative(reviewRoot, candidate);
|
|
12454
13320
|
if (relativeToRoot.startsWith("..") || relativeToRoot === ".." || isAbsolute(relativeToRoot)) {
|
|
12455
13321
|
throw new Error(`Resolved component source is outside the review root: ${source}. Pass --project-root <path> to set the correct base.`);
|
|
@@ -12468,9 +13334,9 @@ var init_resolve_component_source_path = __esm({
|
|
|
12468
13334
|
});
|
|
12469
13335
|
|
|
12470
13336
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
|
|
12471
|
-
import { resolve as
|
|
13337
|
+
import { resolve as resolve14 } from "node:path";
|
|
12472
13338
|
async function loadReviewInput(components, options = {}) {
|
|
12473
|
-
const reviewRoot =
|
|
13339
|
+
const reviewRoot = resolve14(options.reviewRoot ?? process.cwd());
|
|
12474
13340
|
const records = await Promise.all(components.map(async (component) => {
|
|
12475
13341
|
let resolvedSourcePath;
|
|
12476
13342
|
try {
|
|
@@ -12521,13 +13387,13 @@ var init_load_and_validate_for_review = __esm({
|
|
|
12521
13387
|
});
|
|
12522
13388
|
|
|
12523
13389
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
12524
|
-
import { resolve as
|
|
13390
|
+
import { resolve as resolve15 } from "node:path";
|
|
12525
13391
|
async function getRefineSessionPaths(sessionId, artifactsRoot) {
|
|
12526
|
-
const sessionDir2 =
|
|
13392
|
+
const sessionDir2 = resolve15(artifactsRoot, sessionId);
|
|
12527
13393
|
return {
|
|
12528
13394
|
sessionDir: sessionDir2,
|
|
12529
|
-
eventsPath:
|
|
12530
|
-
statePath:
|
|
13395
|
+
eventsPath: resolve15(sessionDir2, "events.jsonl"),
|
|
13396
|
+
statePath: resolve15(sessionDir2, "current-review-state.json")
|
|
12531
13397
|
};
|
|
12532
13398
|
}
|
|
12533
13399
|
var init_review_session_paths = __esm({
|
|
@@ -12537,13 +13403,13 @@ var init_review_session_paths = __esm({
|
|
|
12537
13403
|
});
|
|
12538
13404
|
|
|
12539
13405
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
|
|
12540
|
-
import { access as access2, mkdir, readFile as
|
|
13406
|
+
import { access as access2, mkdir, readFile as readFile9, writeFile } from "node:fs/promises";
|
|
12541
13407
|
async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
|
|
12542
13408
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
12543
13409
|
await mkdir(paths.sessionDir, { recursive: true });
|
|
12544
13410
|
try {
|
|
12545
13411
|
await access2(paths.statePath);
|
|
12546
|
-
const savedState = await
|
|
13412
|
+
const savedState = await readFile9(paths.statePath, "utf8");
|
|
12547
13413
|
return JSON.parse(savedState);
|
|
12548
13414
|
} catch {
|
|
12549
13415
|
await writeFile(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
|
|
@@ -12559,12 +13425,12 @@ var init_ensure_review_session = __esm({
|
|
|
12559
13425
|
});
|
|
12560
13426
|
|
|
12561
13427
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-artifacts-root.js
|
|
12562
|
-
import { resolve as
|
|
13428
|
+
import { resolve as resolve16 } from "node:path";
|
|
12563
13429
|
function getRefineArtifactsRoot() {
|
|
12564
13430
|
if (process.env["EDS_REVIEW_ARTIFACTS_DIR"]) {
|
|
12565
|
-
return
|
|
13431
|
+
return resolve16(process.env["EDS_REVIEW_ARTIFACTS_DIR"]);
|
|
12566
13432
|
}
|
|
12567
|
-
return
|
|
13433
|
+
return resolve16(configRoot(), "reviews");
|
|
12568
13434
|
}
|
|
12569
13435
|
var init_review_artifacts_root = __esm({
|
|
12570
13436
|
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-artifacts-root.js"() {
|
|
@@ -12585,14 +13451,14 @@ var init_save_review_state = __esm({
|
|
|
12585
13451
|
});
|
|
12586
13452
|
|
|
12587
13453
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
12588
|
-
import { access as access3, readFile as
|
|
13454
|
+
import { access as access3, readFile as readFile10 } from "node:fs/promises";
|
|
12589
13455
|
async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors, opts = {}) {
|
|
12590
13456
|
const artifactsRoot = opts.artifactsRoot ?? getRefineArtifactsRoot();
|
|
12591
13457
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
12592
13458
|
let snapshot;
|
|
12593
13459
|
try {
|
|
12594
13460
|
await access3(paths.statePath);
|
|
12595
|
-
snapshot = JSON.parse(await
|
|
13461
|
+
snapshot = JSON.parse(await readFile10(paths.statePath, "utf8"));
|
|
12596
13462
|
} catch {
|
|
12597
13463
|
snapshot = await loadAndValidateForReview(sessionId, void 0);
|
|
12598
13464
|
snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
|
|
@@ -12640,7 +13506,7 @@ var init_merge_preview_validation_errors_into_review_session = __esm({
|
|
|
12640
13506
|
});
|
|
12641
13507
|
|
|
12642
13508
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
|
|
12643
|
-
import { readFile as
|
|
13509
|
+
import { readFile as readFile11 } from "node:fs/promises";
|
|
12644
13510
|
async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
12645
13511
|
if (names.length === 0)
|
|
12646
13512
|
return;
|
|
@@ -12656,7 +13522,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
|
12656
13522
|
const nameSet = new Set(names);
|
|
12657
13523
|
let snapshot;
|
|
12658
13524
|
try {
|
|
12659
|
-
snapshot = JSON.parse(await
|
|
13525
|
+
snapshot = JSON.parse(await readFile11(paths.statePath, "utf8"));
|
|
12660
13526
|
} catch {
|
|
12661
13527
|
return;
|
|
12662
13528
|
}
|
|
@@ -12740,7 +13606,9 @@ var init_file_patterns = __esm({
|
|
|
12740
13606
|
".spec.ts",
|
|
12741
13607
|
".spec.tsx",
|
|
12742
13608
|
".test.ts",
|
|
12743
|
-
".test.tsx"
|
|
13609
|
+
".test.tsx",
|
|
13610
|
+
".harness.ts",
|
|
13611
|
+
".harness.tsx"
|
|
12744
13612
|
];
|
|
12745
13613
|
IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
12746
13614
|
".changeset",
|
|
@@ -12758,9 +13626,12 @@ var init_file_patterns = __esm({
|
|
|
12758
13626
|
"dist",
|
|
12759
13627
|
"example",
|
|
12760
13628
|
"examples",
|
|
13629
|
+
"harness",
|
|
13630
|
+
"harnesses",
|
|
12761
13631
|
"node_modules",
|
|
12762
13632
|
"out",
|
|
12763
|
-
"storybook-static"
|
|
13633
|
+
"storybook-static",
|
|
13634
|
+
"testing"
|
|
12764
13635
|
]);
|
|
12765
13636
|
DENYLISTED_EXACT_FILE_NAMES = /* @__PURE__ */ new Set([
|
|
12766
13637
|
"package.json",
|
|
@@ -12907,13 +13778,13 @@ var init_walk_project_tree = __esm({
|
|
|
12907
13778
|
});
|
|
12908
13779
|
|
|
12909
13780
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
|
|
12910
|
-
import { statSync as
|
|
13781
|
+
import { statSync as statSync4 } from "node:fs";
|
|
12911
13782
|
import path4 from "node:path";
|
|
12912
13783
|
function collectFiles(root, options = {}) {
|
|
12913
13784
|
const resolved = path4.resolve(root);
|
|
12914
13785
|
let stat5;
|
|
12915
13786
|
try {
|
|
12916
|
-
stat5 =
|
|
13787
|
+
stat5 = statSync4(resolved);
|
|
12917
13788
|
} catch (err) {
|
|
12918
13789
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
12919
13790
|
}
|
|
@@ -13017,10 +13888,10 @@ var init_run_record = __esm({
|
|
|
13017
13888
|
});
|
|
13018
13889
|
|
|
13019
13890
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
13020
|
-
import { readFile as
|
|
13891
|
+
import { readFile as readFile12 } from "node:fs/promises";
|
|
13021
13892
|
async function readRunsFileMaybe() {
|
|
13022
13893
|
try {
|
|
13023
|
-
const raw = await
|
|
13894
|
+
const raw = await readFile12(runsFilePath(), "utf8");
|
|
13024
13895
|
const parsed = JSON.parse(raw);
|
|
13025
13896
|
if (!READABLE_VERSIONS.has(parsed.version)) {
|
|
13026
13897
|
throw new Error(`runs.json version mismatch: file is v${parsed.version}, this CLI expects v${RUNS_FILE_VERSION} (also reads: ${[...READABLE_VERSIONS].join(", ")}). Back up and remove the file to start fresh.`);
|
|
@@ -13045,9 +13916,9 @@ var init_read_runs_file = __esm({
|
|
|
13045
13916
|
|
|
13046
13917
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
|
|
13047
13918
|
import { mkdir as mkdir2, rename, writeFile as writeFile3 } from "node:fs/promises";
|
|
13048
|
-
import { dirname as
|
|
13919
|
+
import { dirname as dirname12 } from "node:path";
|
|
13049
13920
|
async function writeRunsFileAtomic(file) {
|
|
13050
|
-
await mkdir2(
|
|
13921
|
+
await mkdir2(dirname12(runsFilePath()), { recursive: true });
|
|
13051
13922
|
const body = JSON.stringify(file, null, 2) + "\n";
|
|
13052
13923
|
const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
|
|
13053
13924
|
await writeFile3(tmp, body, { mode: 384 });
|
|
@@ -13140,8 +14011,8 @@ var init_sha256_hex = __esm({
|
|
|
13140
14011
|
});
|
|
13141
14012
|
|
|
13142
14013
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
|
|
13143
|
-
import { readFile as
|
|
13144
|
-
import { resolve as
|
|
14014
|
+
import { readFile as readFile13, stat } from "node:fs/promises";
|
|
14015
|
+
import { resolve as resolve17 } from "node:path";
|
|
13145
14016
|
function rowField(row, key) {
|
|
13146
14017
|
const v = row[key];
|
|
13147
14018
|
return typeof v === "string" ? v : null;
|
|
@@ -13155,7 +14026,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
13155
14026
|
const name = rowField(row, "name");
|
|
13156
14027
|
if (!sourcePath)
|
|
13157
14028
|
continue;
|
|
13158
|
-
const abs =
|
|
14029
|
+
const abs = resolve17(sourcePath);
|
|
13159
14030
|
if (seen.has(abs))
|
|
13160
14031
|
continue;
|
|
13161
14032
|
seen.add(abs);
|
|
@@ -13172,10 +14043,10 @@ async function buildSourceFingerprint(opts) {
|
|
|
13172
14043
|
let rawTokensMtime = null;
|
|
13173
14044
|
let rawTokensContentHash = null;
|
|
13174
14045
|
if (opts.rawTokensPath) {
|
|
13175
|
-
const abs =
|
|
14046
|
+
const abs = resolve17(opts.rawTokensPath);
|
|
13176
14047
|
rawTokensPath = abs;
|
|
13177
14048
|
try {
|
|
13178
|
-
const [st, buf] = await Promise.all([stat(abs),
|
|
14049
|
+
const [st, buf] = await Promise.all([stat(abs), readFile13(abs)]);
|
|
13179
14050
|
rawTokensMtime = st.mtime.toISOString();
|
|
13180
14051
|
rawTokensContentHash = sha256Hex(buf);
|
|
13181
14052
|
} catch {
|
|
@@ -13340,12 +14211,12 @@ var init_write_scope_decisions_snapshot = __esm({
|
|
|
13340
14211
|
});
|
|
13341
14212
|
|
|
13342
14213
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
|
|
13343
|
-
import { readFile as
|
|
14214
|
+
import { readFile as readFile14 } from "node:fs/promises";
|
|
13344
14215
|
async function loadAcceptedNames(sessionId) {
|
|
13345
14216
|
try {
|
|
13346
14217
|
const artifactsRoot = getRefineArtifactsRoot();
|
|
13347
14218
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
13348
|
-
const raw = await
|
|
14219
|
+
const raw = await readFile14(paths.statePath, "utf8");
|
|
13349
14220
|
const snapshot = JSON.parse(raw);
|
|
13350
14221
|
const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
|
|
13351
14222
|
if (accepted.length === 0)
|
|
@@ -14333,7 +15204,7 @@ function errorMessage(error) {
|
|
|
14333
15204
|
return error instanceof Error && error.message ? error.message : String(error);
|
|
14334
15205
|
}
|
|
14335
15206
|
function defaultSleep(delayMs) {
|
|
14336
|
-
return new Promise((
|
|
15207
|
+
return new Promise((resolve29) => setTimeout(resolve29, delayMs));
|
|
14337
15208
|
}
|
|
14338
15209
|
var MAX_RETRY_AFTER_MS;
|
|
14339
15210
|
var init_http_utils = __esm({
|
|
@@ -14609,7 +15480,7 @@ var init_api_client = __esm({
|
|
|
14609
15480
|
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
14610
15481
|
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
14611
15482
|
const jitter = Math.random() * baseDelay * 0.15;
|
|
14612
|
-
await new Promise((
|
|
15483
|
+
await new Promise((resolve29) => setTimeout(resolve29, baseDelay + jitter));
|
|
14613
15484
|
}
|
|
14614
15485
|
}
|
|
14615
15486
|
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
@@ -15296,7 +16167,7 @@ var init_collect_json_files = __esm({
|
|
|
15296
16167
|
});
|
|
15297
16168
|
|
|
15298
16169
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
|
|
15299
|
-
import { readFile as
|
|
16170
|
+
import { readFile as readFile15, stat as stat3 } from "node:fs/promises";
|
|
15300
16171
|
async function readTokensFromPath(flag, p) {
|
|
15301
16172
|
let s;
|
|
15302
16173
|
try {
|
|
@@ -15319,7 +16190,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
15319
16190
|
const merged = {};
|
|
15320
16191
|
for (const file of files.sort()) {
|
|
15321
16192
|
try {
|
|
15322
|
-
const text = await
|
|
16193
|
+
const text = await readFile15(file, "utf8");
|
|
15323
16194
|
const parsed = JSON.parse(text);
|
|
15324
16195
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
15325
16196
|
Object.assign(merged, parsed);
|
|
@@ -15333,7 +16204,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
15333
16204
|
async function readSingleFile(flag, p) {
|
|
15334
16205
|
let text;
|
|
15335
16206
|
try {
|
|
15336
|
-
text = await
|
|
16207
|
+
text = await readFile15(p, "utf8");
|
|
15337
16208
|
} catch {
|
|
15338
16209
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
15339
16210
|
}
|
|
@@ -15439,12 +16310,12 @@ var init_fetch_and_persist = __esm({
|
|
|
15439
16310
|
});
|
|
15440
16311
|
|
|
15441
16312
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/read-from-session.js
|
|
15442
|
-
import { readFile as
|
|
16313
|
+
import { readFile as readFile16 } from "node:fs/promises";
|
|
15443
16314
|
async function readExistingContentfulEntitiesFromSession(request) {
|
|
15444
16315
|
if (!request.path)
|
|
15445
16316
|
return void 0;
|
|
15446
16317
|
try {
|
|
15447
|
-
const raw = await
|
|
16318
|
+
const raw = await readFile16(request.path, "utf8");
|
|
15448
16319
|
const parsed = JSON.parse(raw);
|
|
15449
16320
|
if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
|
|
15450
16321
|
return void 0;
|
|
@@ -16023,22 +16894,26 @@ async function trackEvent(event, properties, anonymousId, options) {
|
|
|
16023
16894
|
}
|
|
16024
16895
|
}
|
|
16025
16896
|
async function flushAnalytics() {
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
} catch {
|
|
16031
|
-
} finally {
|
|
16897
|
+
flushChain = flushChain.then(async () => {
|
|
16898
|
+
const client2 = analyticsClient;
|
|
16899
|
+
if (!client2)
|
|
16900
|
+
return;
|
|
16032
16901
|
analyticsClient = null;
|
|
16033
|
-
|
|
16902
|
+
try {
|
|
16903
|
+
await client2.closeAndFlush();
|
|
16904
|
+
} catch {
|
|
16905
|
+
}
|
|
16906
|
+
});
|
|
16907
|
+
return flushChain;
|
|
16034
16908
|
}
|
|
16035
|
-
var DEFAULT_WRITE_KEY, analyticsClient;
|
|
16909
|
+
var DEFAULT_WRITE_KEY, analyticsClient, flushChain;
|
|
16036
16910
|
var init_segment_client = __esm({
|
|
16037
16911
|
"packages/experience-design-system-backend-pipeline/dist/src/analytics/client/segment-client.js"() {
|
|
16038
16912
|
"use strict";
|
|
16039
16913
|
init_opt_out();
|
|
16040
16914
|
DEFAULT_WRITE_KEY = "6DmxiEPN3SV1vbRTTMcNqDzCvkfwT06N";
|
|
16041
16915
|
analyticsClient = null;
|
|
16916
|
+
flushChain = Promise.resolve();
|
|
16042
16917
|
}
|
|
16043
16918
|
});
|
|
16044
16919
|
|
|
@@ -16317,7 +17192,7 @@ var init_analytics = __esm({
|
|
|
16317
17192
|
});
|
|
16318
17193
|
|
|
16319
17194
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/map-tokens/run-map-tokens.js
|
|
16320
|
-
import { resolve as
|
|
17195
|
+
import { resolve as resolve18 } from "node:path";
|
|
16321
17196
|
async function runMapTokens(request) {
|
|
16322
17197
|
const timeoutMs = request.agentTimeoutMs ?? DEFAULT_TIMEOUT_MS2;
|
|
16323
17198
|
const db = openPipelineDb();
|
|
@@ -16368,7 +17243,7 @@ async function runMapTokens(request) {
|
|
|
16368
17243
|
outDir: process.cwd(),
|
|
16369
17244
|
existingTokensInline: request.existingEntitiesInline,
|
|
16370
17245
|
...request.skillContentOverride !== void 0 ? { skillContentOverride: request.skillContentOverride } : {},
|
|
16371
|
-
...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride:
|
|
17246
|
+
...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride: resolve18(request.skillPathOverride) } : {}
|
|
16372
17247
|
});
|
|
16373
17248
|
if (request.printPrompt) {
|
|
16374
17249
|
const prompt2 = await buildMapPrompt();
|
|
@@ -16584,7 +17459,7 @@ var init_parse_imported_names = __esm({
|
|
|
16584
17459
|
});
|
|
16585
17460
|
|
|
16586
17461
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
|
|
16587
|
-
import { readFile as
|
|
17462
|
+
import { readFile as readFile17 } from "node:fs/promises";
|
|
16588
17463
|
function escapeRegExp(value) {
|
|
16589
17464
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
16590
17465
|
}
|
|
@@ -16617,7 +17492,14 @@ function hasSiblingForwardRender(sourceText, siblingImports) {
|
|
|
16617
17492
|
});
|
|
16618
17493
|
}
|
|
16619
17494
|
function hasVisibleUiRender(sourceText) {
|
|
16620
|
-
|
|
17495
|
+
if (/return\s*(?:\(|<)/.test(sourceText) && VISIBLE_UI_TAG_PATTERN.test(sourceText))
|
|
17496
|
+
return true;
|
|
17497
|
+
if (/template\s*:\s*[`'"][\s\S]*?[`'"]/.test(sourceText)) {
|
|
17498
|
+
const inlineMatch = sourceText.match(/template\s*:\s*[`'"]([\s\S]*?)[`'"]/);
|
|
17499
|
+
if (inlineMatch && VISIBLE_UI_TAG_PATTERN.test(inlineMatch[1]))
|
|
17500
|
+
return true;
|
|
17501
|
+
}
|
|
17502
|
+
return /templateUrl\s*:\s*['"]/.test(sourceText);
|
|
16621
17503
|
}
|
|
16622
17504
|
function infraPropNames(component) {
|
|
16623
17505
|
const props = component.props.map((prop) => prop.name);
|
|
@@ -16640,7 +17522,7 @@ function dedupeReasons(reasons) {
|
|
|
16640
17522
|
async function inspectComponentSource(component) {
|
|
16641
17523
|
let sourceText = "";
|
|
16642
17524
|
try {
|
|
16643
|
-
sourceText = await
|
|
17525
|
+
sourceText = await readFile17(component.source, "utf8");
|
|
16644
17526
|
} catch {
|
|
16645
17527
|
return {
|
|
16646
17528
|
wrapperConfidence: 0,
|
|
@@ -17096,7 +17978,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
17096
17978
|
const message = error instanceof Error ? error.message : String(error);
|
|
17097
17979
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
17098
17980
|
throw error;
|
|
17099
|
-
await new Promise((
|
|
17981
|
+
await new Promise((resolve29) => setTimeout(resolve29, Math.min(250 * attempt, 2e3)));
|
|
17100
17982
|
}
|
|
17101
17983
|
}
|
|
17102
17984
|
}
|
|
@@ -17144,7 +18026,7 @@ var init_resolve_composition_agent_name = __esm({
|
|
|
17144
18026
|
});
|
|
17145
18027
|
|
|
17146
18028
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/read-candidate-files.js
|
|
17147
|
-
import { readFile as
|
|
18029
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
17148
18030
|
async function readCandidateFiles(components, extraFiles = []) {
|
|
17149
18031
|
const paths = new Set(extraFiles);
|
|
17150
18032
|
for (const c2 of components) {
|
|
@@ -17154,7 +18036,7 @@ async function readCandidateFiles(components, extraFiles = []) {
|
|
|
17154
18036
|
const out = [];
|
|
17155
18037
|
await Promise.all([...paths].map(async (p) => {
|
|
17156
18038
|
try {
|
|
17157
|
-
const content = await
|
|
18039
|
+
const content = await readFile18(p, "utf8");
|
|
17158
18040
|
out.push({ path: p, content });
|
|
17159
18041
|
} catch {
|
|
17160
18042
|
}
|
|
@@ -17393,7 +18275,7 @@ var init_write_tokens_file = __esm({
|
|
|
17393
18275
|
});
|
|
17394
18276
|
|
|
17395
18277
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-tokens-session/run-generate-tokens-session.js
|
|
17396
|
-
import { readFile as
|
|
18278
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
17397
18279
|
import { basename as basename5, resolve as pathResolve } from "node:path";
|
|
17398
18280
|
async function runGenerateTokensSession(request) {
|
|
17399
18281
|
const { rawTokensPath, outDir, agent, agentModel, promptOverrides, skillPath, noCache, bedrock = false, onProgress, onSessionCreated } = request;
|
|
@@ -17402,7 +18284,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17402
18284
|
throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
|
|
17403
18285
|
const tokensOverride = overridesMap.get("tokens");
|
|
17404
18286
|
const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
|
|
17405
|
-
const rawTokensInline = await
|
|
18287
|
+
const rawTokensInline = await readFile19(pathResolve(rawTokensPath), "utf8");
|
|
17406
18288
|
const tokenInputHash = hashTokenContent(rawTokensInline);
|
|
17407
18289
|
const db = openPipelineDb();
|
|
17408
18290
|
try {
|
|
@@ -17553,7 +18435,7 @@ var init_read_existing_entities = __esm({
|
|
|
17553
18435
|
});
|
|
17554
18436
|
|
|
17555
18437
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/resolve-generate-prompt.js
|
|
17556
|
-
import { resolve as
|
|
18438
|
+
import { resolve as resolve19 } from "node:path";
|
|
17557
18439
|
async function resolveGeneratePrompt(overrides) {
|
|
17558
18440
|
const { overrides: parsed, errors } = parsePromptOverrides(overrides);
|
|
17559
18441
|
if (errors.length > 0)
|
|
@@ -17564,7 +18446,7 @@ async function resolveGeneratePrompt(overrides) {
|
|
|
17564
18446
|
const text = await resolvePromptOverride(entry);
|
|
17565
18447
|
if (entry.kind === "text")
|
|
17566
18448
|
return { text };
|
|
17567
|
-
return { path:
|
|
18449
|
+
return { path: resolve19(entry.value), text };
|
|
17568
18450
|
}
|
|
17569
18451
|
var init_resolve_generate_prompt = __esm({
|
|
17570
18452
|
"packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/resolve-generate-prompt.js"() {
|
|
@@ -18067,10 +18949,10 @@ var init_src3 = __esm({
|
|
|
18067
18949
|
|
|
18068
18950
|
// packages/experience-design-system-cli/src/tui/package-root.ts
|
|
18069
18951
|
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
18070
|
-
import { dirname as
|
|
18952
|
+
import { dirname as dirname13, join as join14 } from "node:path";
|
|
18071
18953
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
18072
18954
|
function findPackageRoot(startUrl, packageName) {
|
|
18073
|
-
let dir =
|
|
18955
|
+
let dir = dirname13(fileURLToPath3(startUrl));
|
|
18074
18956
|
let found;
|
|
18075
18957
|
while (true) {
|
|
18076
18958
|
const manifestPath = join14(dir, "package.json");
|
|
@@ -18078,7 +18960,7 @@ function findPackageRoot(startUrl, packageName) {
|
|
|
18078
18960
|
const pkg2 = JSON.parse(readFileSync7(manifestPath, "utf8"));
|
|
18079
18961
|
if (pkg2.name === packageName) found = dir;
|
|
18080
18962
|
}
|
|
18081
|
-
const parent =
|
|
18963
|
+
const parent = dirname13(dir);
|
|
18082
18964
|
if (parent === dir) return found ?? dir;
|
|
18083
18965
|
dir = parent;
|
|
18084
18966
|
}
|
|
@@ -18091,22 +18973,22 @@ var init_package_root = __esm({
|
|
|
18091
18973
|
|
|
18092
18974
|
// packages/experience-design-system-types/dist/src/config/index.js
|
|
18093
18975
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
18094
|
-
import { mkdir as mkdir6, readFile as
|
|
18976
|
+
import { mkdir as mkdir6, readFile as readFile20, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
18095
18977
|
import { homedir as homedir2 } from "node:os";
|
|
18096
|
-
import { dirname as
|
|
18978
|
+
import { dirname as dirname14, join as join16 } from "node:path";
|
|
18097
18979
|
function configRoot2() {
|
|
18098
18980
|
return process.env["EDS_HOME"] || join16(homedir2(), ".contentful", "experience-design-system-cli");
|
|
18099
18981
|
}
|
|
18100
18982
|
async function readSettings2() {
|
|
18101
18983
|
try {
|
|
18102
|
-
return JSON.parse(await
|
|
18984
|
+
return JSON.parse(await readFile20(configFilePath2(), "utf8"));
|
|
18103
18985
|
} catch {
|
|
18104
18986
|
return {};
|
|
18105
18987
|
}
|
|
18106
18988
|
}
|
|
18107
18989
|
async function writeSettings2(settings) {
|
|
18108
18990
|
const path5 = configFilePath2();
|
|
18109
|
-
await mkdir6(
|
|
18991
|
+
await mkdir6(dirname14(path5), { recursive: true });
|
|
18110
18992
|
const tmp = `${path5}.${process.pid}.${randomBytes4(4).toString("hex")}.tmp`;
|
|
18111
18993
|
await writeFile6(tmp, `${JSON.stringify(settings, null, 2)}
|
|
18112
18994
|
`, { mode: 384 });
|
|
@@ -19137,7 +20019,7 @@ var init_controls5 = __esm({
|
|
|
19137
20019
|
|
|
19138
20020
|
// packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
|
|
19139
20021
|
import { homedir as homedir3 } from "node:os";
|
|
19140
|
-
import { resolve as
|
|
20022
|
+
import { resolve as resolve20 } from "node:path";
|
|
19141
20023
|
function stripQuotes(value) {
|
|
19142
20024
|
const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
|
|
19143
20025
|
return value.length >= 2 && quoted ? value.slice(1, -1) : value;
|
|
@@ -19146,7 +20028,7 @@ function expandHome(value) {
|
|
|
19146
20028
|
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir3() + value.slice(1) : value;
|
|
19147
20029
|
}
|
|
19148
20030
|
function resolveUserPath(raw) {
|
|
19149
|
-
return
|
|
20031
|
+
return resolve20(expandHome(stripQuotes(raw.trim())));
|
|
19150
20032
|
}
|
|
19151
20033
|
var init_resolve_user_path = __esm({
|
|
19152
20034
|
"packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts"() {
|
|
@@ -19155,12 +20037,12 @@ var init_resolve_user_path = __esm({
|
|
|
19155
20037
|
});
|
|
19156
20038
|
|
|
19157
20039
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
19158
|
-
import { statSync as
|
|
20040
|
+
import { statSync as statSync5 } from "node:fs";
|
|
19159
20041
|
function validateTokenPath(rawPath) {
|
|
19160
20042
|
const path5 = resolveUserPath(rawPath);
|
|
19161
20043
|
let stats;
|
|
19162
20044
|
try {
|
|
19163
|
-
stats =
|
|
20045
|
+
stats = statSync5(path5);
|
|
19164
20046
|
} catch {
|
|
19165
20047
|
return { ok: false, error: `Path not found: ${path5}`, resolvedPath: path5 };
|
|
19166
20048
|
}
|
|
@@ -19838,15 +20720,15 @@ var init_steps = __esm({
|
|
|
19838
20720
|
|
|
19839
20721
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
19840
20722
|
import { existsSync as existsSync9 } from "node:fs";
|
|
19841
|
-
import { dirname as
|
|
20723
|
+
import { dirname as dirname15, join as join18, resolve as resolve21 } from "node:path";
|
|
19842
20724
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
19843
20725
|
function findSkillPath(fileName) {
|
|
19844
|
-
const thisDir =
|
|
20726
|
+
const thisDir = dirname15(fileURLToPath4(import.meta.url));
|
|
19845
20727
|
let dir = thisDir;
|
|
19846
20728
|
for (; ; ) {
|
|
19847
20729
|
const candidate = join18(dir, "skills", fileName);
|
|
19848
20730
|
if (existsSync9(candidate)) return candidate;
|
|
19849
|
-
const parent =
|
|
20731
|
+
const parent = resolve21(dir, "..");
|
|
19850
20732
|
if (parent === dir) {
|
|
19851
20733
|
throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
|
|
19852
20734
|
}
|
|
@@ -19860,9 +20742,9 @@ var init_find_skill_path = __esm({
|
|
|
19860
20742
|
});
|
|
19861
20743
|
|
|
19862
20744
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/selection.ts
|
|
19863
|
-
import { resolve as
|
|
20745
|
+
import { resolve as resolve22 } from "node:path";
|
|
19864
20746
|
async function hashSelectPrompt(options) {
|
|
19865
|
-
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(
|
|
20747
|
+
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve22(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
|
|
19866
20748
|
return hashContent(`${promptHash}|${options.agent}|${options.model ?? ""}`);
|
|
19867
20749
|
}
|
|
19868
20750
|
async function runSelection(options) {
|
|
@@ -19957,9 +20839,9 @@ var init_selection2 = __esm({
|
|
|
19957
20839
|
|
|
19958
20840
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
19959
20841
|
import { mkdir as mkdir7 } from "node:fs/promises";
|
|
19960
|
-
import { join as join19, resolve as
|
|
20842
|
+
import { join as join19, resolve as resolve23 } from "node:path";
|
|
19961
20843
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
19962
|
-
const outDir = input.outDir ?? join19(
|
|
20844
|
+
const outDir = input.outDir ?? join19(resolve23(input.projectPath), ".contentful");
|
|
19963
20845
|
let progress = initialProgress({
|
|
19964
20846
|
hasCredentials: input.credentials !== null,
|
|
19965
20847
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -20083,7 +20965,7 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
20083
20965
|
if (select?.kind === "text") return { promptText: select.value };
|
|
20084
20966
|
if (select?.kind === "path") {
|
|
20085
20967
|
await resolvePromptOverride(select);
|
|
20086
|
-
return { promptPath:
|
|
20968
|
+
return { promptPath: resolve23(select.value) };
|
|
20087
20969
|
}
|
|
20088
20970
|
return {};
|
|
20089
20971
|
}
|
|
@@ -23427,7 +24309,7 @@ var init_save_decisions = __esm({
|
|
|
23427
24309
|
});
|
|
23428
24310
|
|
|
23429
24311
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
23430
|
-
import { resolve as
|
|
24312
|
+
import { resolve as resolve24 } from "node:path";
|
|
23431
24313
|
async function runGeneration(input, onProgress, deps = realDeps4) {
|
|
23432
24314
|
let progress = { components: null, mapTokens: "idle", mapTokensEligible: null };
|
|
23433
24315
|
const update = (change) => {
|
|
@@ -23513,7 +24395,7 @@ async function buildMapTokensOptions(input) {
|
|
|
23513
24395
|
if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
|
|
23514
24396
|
if (mapOverride?.kind === "path") {
|
|
23515
24397
|
await resolvePromptOverride(mapOverride);
|
|
23516
|
-
prompt.skillPathOverride =
|
|
24398
|
+
prompt.skillPathOverride = resolve24(mapOverride.value);
|
|
23517
24399
|
}
|
|
23518
24400
|
if (input.existingEntitiesPath) {
|
|
23519
24401
|
const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
|
|
@@ -29768,7 +30650,7 @@ var init_DoneStep = __esm({
|
|
|
29768
30650
|
});
|
|
29769
30651
|
|
|
29770
30652
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
29771
|
-
import { resolve as
|
|
30653
|
+
import { resolve as resolve25 } from "node:path";
|
|
29772
30654
|
import { homedir as homedir4 } from "node:os";
|
|
29773
30655
|
function expandTilde(input) {
|
|
29774
30656
|
if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
|
|
@@ -29782,7 +30664,7 @@ function normalizePath(input) {
|
|
|
29782
30664
|
p = p.slice(1, -1);
|
|
29783
30665
|
}
|
|
29784
30666
|
p = expandTilde(p);
|
|
29785
|
-
return
|
|
30667
|
+
return resolve25(p);
|
|
29786
30668
|
}
|
|
29787
30669
|
var init_path_utils = __esm({
|
|
29788
30670
|
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts"() {
|
|
@@ -29810,12 +30692,12 @@ var init_use_blinking_cursor = __esm({
|
|
|
29810
30692
|
import { useState as useState26 } from "react";
|
|
29811
30693
|
import { Box as Box39, Text as Text42 } from "ink";
|
|
29812
30694
|
import { readdirSync as readdirSync3 } from "node:fs";
|
|
29813
|
-
import { dirname as
|
|
30695
|
+
import { dirname as dirname16, basename as basename6, join as join21 } from "node:path";
|
|
29814
30696
|
import { jsx as jsx49, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
29815
30697
|
function autocomplete(partial) {
|
|
29816
30698
|
if (!partial) return null;
|
|
29817
30699
|
const normalized = normalizePath(partial);
|
|
29818
|
-
const dir =
|
|
30700
|
+
const dir = dirname16(normalized);
|
|
29819
30701
|
const base = basename6(normalized);
|
|
29820
30702
|
let entries;
|
|
29821
30703
|
try {
|
|
@@ -31165,7 +32047,7 @@ var init_save = __esm({
|
|
|
31165
32047
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
31166
32048
|
appendRun,
|
|
31167
32049
|
buildSourceFingerprint,
|
|
31168
|
-
sleep: (ms) => new Promise((
|
|
32050
|
+
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
31169
32051
|
warn: (message) => process.stderr.write(message)
|
|
31170
32052
|
});
|
|
31171
32053
|
}
|
|
@@ -31187,7 +32069,7 @@ var init_types9 = __esm({
|
|
|
31187
32069
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
31188
32070
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
31189
32071
|
import { tmpdir } from "node:os";
|
|
31190
|
-
import { join as join23, resolve as
|
|
32072
|
+
import { join as join23, resolve as resolve26 } from "node:path";
|
|
31191
32073
|
function appendWizardLog(entry) {
|
|
31192
32074
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
31193
32075
|
}
|
|
@@ -31440,7 +32322,7 @@ function createFlowController(start, deps) {
|
|
|
31440
32322
|
},
|
|
31441
32323
|
async submitPath(submitted) {
|
|
31442
32324
|
await deps.mkdir(submitted);
|
|
31443
|
-
if (
|
|
32325
|
+
if (resolve26(submitted) !== resolve26(state2.outDir) && await deps.detectSaveConflict(submitted)) {
|
|
31444
32326
|
const subdir = deps.buildTimestampedSubdir(submitted);
|
|
31445
32327
|
await deps.mkdir(subdir);
|
|
31446
32328
|
await proceedToWrite(subdir);
|
|
@@ -31535,7 +32417,7 @@ var init_debug_mode_store = __esm({
|
|
|
31535
32417
|
|
|
31536
32418
|
// packages/experience-design-system-cli/src/tui/debug-prune.ts
|
|
31537
32419
|
import { readdir as readdir2, rm, rmdir, stat as stat4 } from "node:fs/promises";
|
|
31538
|
-
import { dirname as
|
|
32420
|
+
import { dirname as dirname17, join as join24 } from "node:path";
|
|
31539
32421
|
async function logFilesIn(dir) {
|
|
31540
32422
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
31541
32423
|
const nested = await Promise.all(
|
|
@@ -31558,7 +32440,7 @@ async function removeEmptyFolders(from, stop) {
|
|
|
31558
32440
|
}
|
|
31559
32441
|
removed += 1;
|
|
31560
32442
|
if (dir === stop) return removed;
|
|
31561
|
-
dir =
|
|
32443
|
+
dir = dirname17(dir);
|
|
31562
32444
|
}
|
|
31563
32445
|
}
|
|
31564
32446
|
async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
@@ -31574,7 +32456,7 @@ async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
|
31574
32456
|
if ((await stat4(file)).mtimeMs >= cutoff) continue;
|
|
31575
32457
|
await rm(file);
|
|
31576
32458
|
result.logs += 1;
|
|
31577
|
-
result.folders += await removeEmptyFolders(
|
|
32459
|
+
result.folders += await removeEmptyFolders(dirname17(file), join24(contentfulDir, session));
|
|
31578
32460
|
} catch {
|
|
31579
32461
|
}
|
|
31580
32462
|
}
|
|
@@ -31604,7 +32486,7 @@ __export(debug_store_exports, {
|
|
|
31604
32486
|
});
|
|
31605
32487
|
import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
|
|
31606
32488
|
import { existsSync as existsSync10, readdirSync as readdirSync4 } from "node:fs";
|
|
31607
|
-
import { join as join25, resolve as
|
|
32489
|
+
import { join as join25, resolve as resolve27 } from "node:path";
|
|
31608
32490
|
function generateRunId() {
|
|
31609
32491
|
const now = /* @__PURE__ */ new Date();
|
|
31610
32492
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -31620,7 +32502,7 @@ function slugify(value) {
|
|
|
31620
32502
|
async function readBaseDir() {
|
|
31621
32503
|
try {
|
|
31622
32504
|
const dir = (await readSettings2())["contentfulBaseDir"];
|
|
31623
|
-
return typeof dir === "string" && dir !== "" ?
|
|
32505
|
+
return typeof dir === "string" && dir !== "" ? resolve27(dir) : void 0;
|
|
31624
32506
|
} catch {
|
|
31625
32507
|
return void 0;
|
|
31626
32508
|
}
|
|
@@ -31649,7 +32531,7 @@ function currentSessionDir() {
|
|
|
31649
32531
|
async function startDebugSessionIn(base, { replace = false } = {}) {
|
|
31650
32532
|
try {
|
|
31651
32533
|
if (!await isDebugModeEnabled()) return;
|
|
31652
|
-
await mkdir9(join25(startSession(
|
|
32534
|
+
await mkdir9(join25(startSession(resolve27(base), { replace }), "debug"), { recursive: true });
|
|
31653
32535
|
} catch {
|
|
31654
32536
|
}
|
|
31655
32537
|
}
|
|
@@ -31663,7 +32545,7 @@ function nextImportRunDir(session) {
|
|
|
31663
32545
|
}
|
|
31664
32546
|
async function startImportRun(projectPath) {
|
|
31665
32547
|
await startDebugSessionIn(projectPath);
|
|
31666
|
-
if (!sessionDir) return join25(
|
|
32548
|
+
if (!sessionDir) return join25(resolve27(projectPath), ".contentful");
|
|
31667
32549
|
const dir = nextImportRunDir(sessionDir);
|
|
31668
32550
|
await mkdir9(dir, { recursive: true });
|
|
31669
32551
|
return dir;
|
|
@@ -31805,7 +32687,7 @@ var init_debug_store = __esm({
|
|
|
31805
32687
|
});
|
|
31806
32688
|
|
|
31807
32689
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
31808
|
-
import { join as join26, resolve as
|
|
32690
|
+
import { join as join26, resolve as resolve28 } from "node:path";
|
|
31809
32691
|
function describeFileLocations({
|
|
31810
32692
|
contentfulBaseDir,
|
|
31811
32693
|
debugModeEnabled,
|
|
@@ -31817,7 +32699,7 @@ function describeFileLocations({
|
|
|
31817
32699
|
importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
31818
32700
|
};
|
|
31819
32701
|
}
|
|
31820
|
-
const base = contentfulBaseDir ?
|
|
32702
|
+
const base = contentfulBaseDir ? resolve28(contentfulBaseDir) : "<project>";
|
|
31821
32703
|
const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
|
|
31822
32704
|
return {
|
|
31823
32705
|
debugLogs: join26(session, "debug"),
|
|
@@ -32049,20 +32931,20 @@ function resolveOnPath(binary) {
|
|
|
32049
32931
|
() => null
|
|
32050
32932
|
);
|
|
32051
32933
|
}
|
|
32052
|
-
return new Promise((
|
|
32934
|
+
return new Promise((resolve29) => {
|
|
32053
32935
|
execFile2(
|
|
32054
32936
|
process.platform === "win32" ? "where" : "which",
|
|
32055
32937
|
[binary],
|
|
32056
|
-
(error, stdout) =>
|
|
32938
|
+
(error, stdout) => resolve29(error ? null : stdout.split("\n")[0]?.trim() ?? null)
|
|
32057
32939
|
);
|
|
32058
32940
|
});
|
|
32059
32941
|
}
|
|
32060
32942
|
function readVersion(binary) {
|
|
32061
|
-
return new Promise((
|
|
32943
|
+
return new Promise((resolve29) => {
|
|
32062
32944
|
execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
|
|
32063
32945
|
const line = stdout.split("\n")[0]?.trim() ?? "";
|
|
32064
|
-
if (!error && line)
|
|
32065
|
-
else
|
|
32946
|
+
if (!error && line) resolve29(pass("version", line));
|
|
32947
|
+
else resolve29(fail3("version", "runs, but did not report a version"));
|
|
32066
32948
|
});
|
|
32067
32949
|
});
|
|
32068
32950
|
}
|
|
@@ -33655,14 +34537,14 @@ function runDevWatch(args) {
|
|
|
33655
34537
|
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
33656
34538
|
return Promise.resolve(1);
|
|
33657
34539
|
}
|
|
33658
|
-
return new Promise((
|
|
34540
|
+
return new Promise((resolve29) => {
|
|
33659
34541
|
const child = spawn3(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
33660
34542
|
process.on("SIGINT", () => void 0);
|
|
33661
|
-
child.on("exit", (code) =>
|
|
34543
|
+
child.on("exit", (code) => resolve29(code ?? 0));
|
|
33662
34544
|
child.on("error", (err) => {
|
|
33663
34545
|
process.stderr.write(`${err.message}
|
|
33664
34546
|
`);
|
|
33665
|
-
|
|
34547
|
+
resolve29(1);
|
|
33666
34548
|
});
|
|
33667
34549
|
});
|
|
33668
34550
|
}
|
|
@@ -33733,12 +34615,12 @@ function createProgram() {
|
|
|
33733
34615
|
init_config();
|
|
33734
34616
|
init_package_root();
|
|
33735
34617
|
import { existsSync as existsSync12 } from "node:fs";
|
|
33736
|
-
import { mkdir as mkdir10, readFile as
|
|
33737
|
-
import { dirname as
|
|
34618
|
+
import { mkdir as mkdir10, readFile as readFile21, rename as rename3, rmdir as rmdir2, unlink } from "node:fs/promises";
|
|
34619
|
+
import { dirname as dirname18, join as join28 } from "node:path";
|
|
33738
34620
|
var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
33739
34621
|
async function readJson(path5) {
|
|
33740
34622
|
try {
|
|
33741
|
-
return JSON.parse(await
|
|
34623
|
+
return JSON.parse(await readFile21(path5, "utf8"));
|
|
33742
34624
|
} catch {
|
|
33743
34625
|
return void 0;
|
|
33744
34626
|
}
|
|
@@ -33760,7 +34642,7 @@ async function migrateOldConfig() {
|
|
|
33760
34642
|
if (Object.keys(migrated).length > 0) await updateSettings2({ ...migrated, ...await readSettings2() });
|
|
33761
34643
|
if (existsSync12(oldRuns)) {
|
|
33762
34644
|
if (!existsSync12(runsFilePath2())) {
|
|
33763
|
-
await mkdir10(
|
|
34645
|
+
await mkdir10(dirname18(runsFilePath2()), { recursive: true });
|
|
33764
34646
|
await rename3(oldRuns, runsFilePath2());
|
|
33765
34647
|
} else {
|
|
33766
34648
|
await unlink(oldRuns);
|