@contentful/experience-design-system-cli 2.37.1-dev-build-c5c89a0c.0 → 2.37.1-dev-build-2be54904.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 +140 -912
- package/dist/index.js +157 -1039
- package/dist/package.json +1 -1
- package/dist/src/commands/import-options.d.ts +0 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1484,16 +1484,6 @@ 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
|
-
}
|
|
1497
1487
|
async function runAgent(options) {
|
|
1498
1488
|
const { agent, prompt, timeoutMs, model, onOutput, promptViaStdin, onDebugEvent } = options;
|
|
1499
1489
|
const bedrock = options.bedrock ?? process.env.EDS_BEDROCK === "1";
|
|
@@ -1510,11 +1500,10 @@ async function runAgent(options) {
|
|
|
1510
1500
|
promptLen: prompt.length,
|
|
1511
1501
|
promptHead: prompt.slice(0, 500)
|
|
1512
1502
|
});
|
|
1513
|
-
return new Promise((
|
|
1503
|
+
return new Promise((resolve28) => {
|
|
1514
1504
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
1515
1505
|
const child = spawn(binary, args, {
|
|
1516
1506
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1517
|
-
detached: true,
|
|
1518
1507
|
...bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}
|
|
1519
1508
|
});
|
|
1520
1509
|
if (useStdin2 && child.stdin) {
|
|
@@ -1526,87 +1515,50 @@ async function runAgent(options) {
|
|
|
1526
1515
|
} else {
|
|
1527
1516
|
child.stdin?.end();
|
|
1528
1517
|
}
|
|
1529
|
-
|
|
1530
|
-
|
|
1518
|
+
let stdout = "";
|
|
1519
|
+
let stderr = "";
|
|
1531
1520
|
let timedOut = false;
|
|
1532
|
-
|
|
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(() => {
|
|
1521
|
+
const timer = setTimeout(() => {
|
|
1553
1522
|
timedOut = true;
|
|
1554
|
-
|
|
1555
|
-
killProcessTree(pid, "SIGTERM");
|
|
1523
|
+
child.kill("SIGTERM");
|
|
1556
1524
|
}, 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);
|
|
1575
1525
|
child.stdout?.on("data", (chunk) => {
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1526
|
+
const text = chunk.toString();
|
|
1527
|
+
stdout += text;
|
|
1528
|
+
onOutput?.(text);
|
|
1579
1529
|
});
|
|
1580
1530
|
child.stderr?.on("data", (chunk) => {
|
|
1581
|
-
|
|
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
|
-
});
|
|
1531
|
+
stderr += chunk.toString();
|
|
1591
1532
|
});
|
|
1592
1533
|
child.on("close", (code, signal) => {
|
|
1593
|
-
|
|
1534
|
+
clearTimeout(timer);
|
|
1535
|
+
const result = {
|
|
1594
1536
|
exitCode: signal ? 1 : code ?? 1,
|
|
1595
|
-
stdout
|
|
1596
|
-
stderr
|
|
1537
|
+
stdout,
|
|
1538
|
+
stderr,
|
|
1597
1539
|
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)
|
|
1598
1551
|
});
|
|
1552
|
+
resolve28(result);
|
|
1599
1553
|
});
|
|
1600
1554
|
});
|
|
1601
1555
|
}
|
|
1602
|
-
var WATCHDOG_GRACE_MS;
|
|
1603
1556
|
var init_run_agent = __esm({
|
|
1604
1557
|
"packages/experience-design-system-backend-pipeline/dist/src/agents/services/run-agent.js"() {
|
|
1605
1558
|
"use strict";
|
|
1606
1559
|
init_bedrock();
|
|
1607
1560
|
init_build_agent_args();
|
|
1608
1561
|
init_resolve_binary();
|
|
1609
|
-
WATCHDOG_GRACE_MS = 10 * 1e3;
|
|
1610
1562
|
}
|
|
1611
1563
|
});
|
|
1612
1564
|
|
|
@@ -1619,7 +1571,7 @@ async function checkAgentAuth(agent) {
|
|
|
1619
1571
|
return "not-found";
|
|
1620
1572
|
if (agent !== "claude")
|
|
1621
1573
|
return "ok";
|
|
1622
|
-
return new Promise((
|
|
1574
|
+
return new Promise((resolve28) => {
|
|
1623
1575
|
const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
1624
1576
|
let stdout = "";
|
|
1625
1577
|
let done = false;
|
|
@@ -1628,7 +1580,7 @@ async function checkAgentAuth(agent) {
|
|
|
1628
1580
|
return;
|
|
1629
1581
|
done = true;
|
|
1630
1582
|
child.kill("SIGTERM");
|
|
1631
|
-
|
|
1583
|
+
resolve28("unauthenticated");
|
|
1632
1584
|
}, 5e3);
|
|
1633
1585
|
child.stdout?.on("data", (chunk) => {
|
|
1634
1586
|
stdout += chunk.toString();
|
|
@@ -1639,14 +1591,14 @@ async function checkAgentAuth(agent) {
|
|
|
1639
1591
|
done = true;
|
|
1640
1592
|
clearTimeout(timer);
|
|
1641
1593
|
if (code !== 0) {
|
|
1642
|
-
|
|
1594
|
+
resolve28("unauthenticated");
|
|
1643
1595
|
return;
|
|
1644
1596
|
}
|
|
1645
1597
|
try {
|
|
1646
1598
|
const status = JSON.parse(stdout);
|
|
1647
|
-
|
|
1599
|
+
resolve28(status.loggedIn ? "ok" : "unauthenticated");
|
|
1648
1600
|
} catch {
|
|
1649
|
-
|
|
1601
|
+
resolve28("unauthenticated");
|
|
1650
1602
|
}
|
|
1651
1603
|
});
|
|
1652
1604
|
});
|
|
@@ -1656,9 +1608,9 @@ async function binaryIsOnPath(binary) {
|
|
|
1656
1608
|
const fs = await import("node:fs/promises");
|
|
1657
1609
|
return fs.access(binary).then(() => true, () => false);
|
|
1658
1610
|
}
|
|
1659
|
-
return new Promise((
|
|
1611
|
+
return new Promise((resolve28) => {
|
|
1660
1612
|
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
1661
|
-
child.on("close", (code) =>
|
|
1613
|
+
child.on("close", (code) => resolve28(code === 0));
|
|
1662
1614
|
});
|
|
1663
1615
|
}
|
|
1664
1616
|
var init_check_agent_auth = __esm({
|
|
@@ -2295,8 +2247,7 @@ var init_infer_fence_lang = __esm({
|
|
|
2295
2247
|
sass: "scss",
|
|
2296
2248
|
css: "css",
|
|
2297
2249
|
json: "json",
|
|
2298
|
-
json5: "json"
|
|
2299
|
-
html: "html"
|
|
2250
|
+
json5: "json"
|
|
2300
2251
|
};
|
|
2301
2252
|
}
|
|
2302
2253
|
});
|
|
@@ -11035,797 +10986,6 @@ var init_extract_svelte_components = __esm({
|
|
|
11035
10986
|
}
|
|
11036
10987
|
});
|
|
11037
10988
|
|
|
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
|
-
|
|
11829
10989
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/services/run-extraction-service.js
|
|
11830
10990
|
function getPathPreferenceScore(filePath) {
|
|
11831
10991
|
const normalized = filePath.replace(/\\/g, "/");
|
|
@@ -12118,8 +11278,6 @@ var init_run_extraction_service = __esm({
|
|
|
12118
11278
|
init_extract_astro_components();
|
|
12119
11279
|
init_extract_web_components();
|
|
12120
11280
|
init_extract_svelte_components();
|
|
12121
|
-
init_extract_angular_components();
|
|
12122
|
-
init_is_angular_source_file();
|
|
12123
11281
|
extractors = [
|
|
12124
11282
|
{
|
|
12125
11283
|
name: "stencil",
|
|
@@ -12146,13 +11304,6 @@ var init_run_extraction_service = __esm({
|
|
|
12146
11304
|
fileFilter: (f) => f.endsWith(".astro"),
|
|
12147
11305
|
extract: extractAstroComponents
|
|
12148
11306
|
},
|
|
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
|
-
},
|
|
12156
11307
|
{
|
|
12157
11308
|
name: "web-components",
|
|
12158
11309
|
fileFilter: (f) => /\.[jt]s$/.test(f) && !/\.[jt]sx$/.test(f) && !f.endsWith(".d.ts"),
|
|
@@ -12381,16 +11532,16 @@ var init_apply_mapping = __esm({
|
|
|
12381
11532
|
|
|
12382
11533
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
|
|
12383
11534
|
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "node:fs";
|
|
12384
|
-
import { dirname as
|
|
11535
|
+
import { dirname as dirname9, join as join8, resolve as resolve11 } from "node:path";
|
|
12385
11536
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
12386
11537
|
function resolvePromptPath(fileName) {
|
|
12387
|
-
const thisDir =
|
|
11538
|
+
const thisDir = dirname9(fileURLToPath2(import.meta.url));
|
|
12388
11539
|
let dir = thisDir;
|
|
12389
11540
|
for (; ; ) {
|
|
12390
11541
|
const candidate = join8(dir, "prompts");
|
|
12391
11542
|
if (existsSync6(candidate))
|
|
12392
11543
|
return join8(candidate, fileName);
|
|
12393
|
-
const parent =
|
|
11544
|
+
const parent = resolve11(dir, "..");
|
|
12394
11545
|
if (parent === dir) {
|
|
12395
11546
|
throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
|
|
12396
11547
|
}
|
|
@@ -12488,31 +11639,14 @@ var CANDIDATE_NAME_PATTERNS, CANDIDATE_CONTENT_MARKERS, PROMPT_CANDIDATE_TOKEN_B
|
|
|
12488
11639
|
var init_candidate_files = __esm({
|
|
12489
11640
|
"packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/constants/candidate-files.js"() {
|
|
12490
11641
|
"use strict";
|
|
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
|
-
];
|
|
11642
|
+
CANDIDATE_NAME_PATTERNS = [/mapping/i, /meta/i, /registry/i, /schema/i, /composition/i];
|
|
12502
11643
|
CANDIDATE_CONTENT_MARKERS = [
|
|
12503
11644
|
"requiredParent",
|
|
12504
11645
|
"withParentType",
|
|
12505
11646
|
"allowedTagNames",
|
|
12506
11647
|
"createContext",
|
|
12507
11648
|
"MappingContext",
|
|
12508
|
-
"allowedComponents"
|
|
12509
|
-
"TemplateRef",
|
|
12510
|
-
"NG_VALUE_ACCESSOR",
|
|
12511
|
-
"ContentChild",
|
|
12512
|
-
"contentChild",
|
|
12513
|
-
"ng-content",
|
|
12514
|
-
"@NgModule",
|
|
12515
|
-
"standalone: true"
|
|
11649
|
+
"allowedComponents"
|
|
12516
11650
|
];
|
|
12517
11651
|
PROMPT_CANDIDATE_TOKEN_BUDGET = 8e4;
|
|
12518
11652
|
}
|
|
@@ -12595,8 +11729,8 @@ var init_composition_cache_key = __esm({
|
|
|
12595
11729
|
});
|
|
12596
11730
|
|
|
12597
11731
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
|
|
12598
|
-
import { dirname as
|
|
12599
|
-
function
|
|
11732
|
+
import { dirname as dirname10 } from "node:path";
|
|
11733
|
+
function kebabToPascal2(name) {
|
|
12600
11734
|
return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
|
|
12601
11735
|
}
|
|
12602
11736
|
function collectManifestEdges(files, componentNames) {
|
|
@@ -12618,7 +11752,7 @@ function collectManifestEdges(files, componentNames) {
|
|
|
12618
11752
|
const rawParentName = typeof component === "object" && component !== null && typeof component.name === "string" ? component.name : void 0;
|
|
12619
11753
|
if (!rawParentName)
|
|
12620
11754
|
continue;
|
|
12621
|
-
const parent =
|
|
11755
|
+
const parent = kebabToPascal2(rawParentName);
|
|
12622
11756
|
if (!componentNames.has(parent))
|
|
12623
11757
|
continue;
|
|
12624
11758
|
const variantsMeta = root.variantsMeta;
|
|
@@ -12638,7 +11772,7 @@ function collectManifestEdges(files, componentNames) {
|
|
|
12638
11772
|
const rawChildName = value.name;
|
|
12639
11773
|
if (typeof rawChildName !== "string")
|
|
12640
11774
|
continue;
|
|
12641
|
-
const child =
|
|
11775
|
+
const child = kebabToPascal2(rawChildName);
|
|
12642
11776
|
if (!componentNames.has(child) || child === parent)
|
|
12643
11777
|
continue;
|
|
12644
11778
|
const key = `${parent}::${child}`;
|
|
@@ -12657,8 +11791,8 @@ function collectAgentsDocEdges(files, components, componentNames) {
|
|
|
12657
11791
|
for (const file of files) {
|
|
12658
11792
|
if (!file.path.endsWith("AGENTS.md"))
|
|
12659
11793
|
continue;
|
|
12660
|
-
const docDir =
|
|
12661
|
-
const parent = components.find((c2) => c2.sourcePath &&
|
|
11794
|
+
const docDir = dirname10(file.path);
|
|
11795
|
+
const parent = components.find((c2) => c2.sourcePath && dirname10(c2.sourcePath) === docDir)?.name;
|
|
12662
11796
|
if (!parent || !componentNames.has(parent))
|
|
12663
11797
|
continue;
|
|
12664
11798
|
for (const line of file.content.split("\n")) {
|
|
@@ -12667,7 +11801,7 @@ function collectAgentsDocEdges(files, components, componentNames) {
|
|
|
12667
11801
|
continue;
|
|
12668
11802
|
for (const match2 of line.matchAll(BOLD_BACKTICK)) {
|
|
12669
11803
|
const raw = match2[1];
|
|
12670
|
-
const candidate = componentNames.has(raw) ? raw :
|
|
11804
|
+
const candidate = componentNames.has(raw) ? raw : kebabToPascal2(raw);
|
|
12671
11805
|
if (!componentNames.has(candidate) || candidate === parent)
|
|
12672
11806
|
continue;
|
|
12673
11807
|
const key = `${parent}::${candidate}`;
|
|
@@ -13305,7 +12439,7 @@ var init_create_component_id = __esm({
|
|
|
13305
12439
|
|
|
13306
12440
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/resolve-component-source-path.js
|
|
13307
12441
|
import { access } from "node:fs/promises";
|
|
13308
|
-
import { isAbsolute, relative, resolve as
|
|
12442
|
+
import { isAbsolute, relative, resolve as resolve12 } from "node:path";
|
|
13309
12443
|
async function resolveComponentSourcePath(source, reviewRoot) {
|
|
13310
12444
|
if (isAbsolute(source)) {
|
|
13311
12445
|
try {
|
|
@@ -13315,7 +12449,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
|
|
|
13315
12449
|
throw new Error(`Unable to access component source at ${source}`);
|
|
13316
12450
|
}
|
|
13317
12451
|
}
|
|
13318
|
-
const candidate =
|
|
12452
|
+
const candidate = resolve12(reviewRoot, source);
|
|
13319
12453
|
const relativeToRoot = relative(reviewRoot, candidate);
|
|
13320
12454
|
if (relativeToRoot.startsWith("..") || relativeToRoot === ".." || isAbsolute(relativeToRoot)) {
|
|
13321
12455
|
throw new Error(`Resolved component source is outside the review root: ${source}. Pass --project-root <path> to set the correct base.`);
|
|
@@ -13334,9 +12468,9 @@ var init_resolve_component_source_path = __esm({
|
|
|
13334
12468
|
});
|
|
13335
12469
|
|
|
13336
12470
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
|
|
13337
|
-
import { resolve as
|
|
12471
|
+
import { resolve as resolve13 } from "node:path";
|
|
13338
12472
|
async function loadReviewInput(components, options = {}) {
|
|
13339
|
-
const reviewRoot =
|
|
12473
|
+
const reviewRoot = resolve13(options.reviewRoot ?? process.cwd());
|
|
13340
12474
|
const records = await Promise.all(components.map(async (component) => {
|
|
13341
12475
|
let resolvedSourcePath;
|
|
13342
12476
|
try {
|
|
@@ -13387,13 +12521,13 @@ var init_load_and_validate_for_review = __esm({
|
|
|
13387
12521
|
});
|
|
13388
12522
|
|
|
13389
12523
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
13390
|
-
import { resolve as
|
|
12524
|
+
import { resolve as resolve14 } from "node:path";
|
|
13391
12525
|
async function getRefineSessionPaths(sessionId, artifactsRoot) {
|
|
13392
|
-
const sessionDir2 =
|
|
12526
|
+
const sessionDir2 = resolve14(artifactsRoot, sessionId);
|
|
13393
12527
|
return {
|
|
13394
12528
|
sessionDir: sessionDir2,
|
|
13395
|
-
eventsPath:
|
|
13396
|
-
statePath:
|
|
12529
|
+
eventsPath: resolve14(sessionDir2, "events.jsonl"),
|
|
12530
|
+
statePath: resolve14(sessionDir2, "current-review-state.json")
|
|
13397
12531
|
};
|
|
13398
12532
|
}
|
|
13399
12533
|
var init_review_session_paths = __esm({
|
|
@@ -13403,13 +12537,13 @@ var init_review_session_paths = __esm({
|
|
|
13403
12537
|
});
|
|
13404
12538
|
|
|
13405
12539
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
|
|
13406
|
-
import { access as access2, mkdir, readFile as
|
|
12540
|
+
import { access as access2, mkdir, readFile as readFile7, writeFile } from "node:fs/promises";
|
|
13407
12541
|
async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
|
|
13408
12542
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
13409
12543
|
await mkdir(paths.sessionDir, { recursive: true });
|
|
13410
12544
|
try {
|
|
13411
12545
|
await access2(paths.statePath);
|
|
13412
|
-
const savedState = await
|
|
12546
|
+
const savedState = await readFile7(paths.statePath, "utf8");
|
|
13413
12547
|
return JSON.parse(savedState);
|
|
13414
12548
|
} catch {
|
|
13415
12549
|
await writeFile(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
|
|
@@ -13425,12 +12559,12 @@ var init_ensure_review_session = __esm({
|
|
|
13425
12559
|
});
|
|
13426
12560
|
|
|
13427
12561
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-artifacts-root.js
|
|
13428
|
-
import { resolve as
|
|
12562
|
+
import { resolve as resolve15 } from "node:path";
|
|
13429
12563
|
function getRefineArtifactsRoot() {
|
|
13430
12564
|
if (process.env["EDS_REVIEW_ARTIFACTS_DIR"]) {
|
|
13431
|
-
return
|
|
12565
|
+
return resolve15(process.env["EDS_REVIEW_ARTIFACTS_DIR"]);
|
|
13432
12566
|
}
|
|
13433
|
-
return
|
|
12567
|
+
return resolve15(configRoot(), "reviews");
|
|
13434
12568
|
}
|
|
13435
12569
|
var init_review_artifacts_root = __esm({
|
|
13436
12570
|
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-artifacts-root.js"() {
|
|
@@ -13451,14 +12585,14 @@ var init_save_review_state = __esm({
|
|
|
13451
12585
|
});
|
|
13452
12586
|
|
|
13453
12587
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
13454
|
-
import { access as access3, readFile as
|
|
12588
|
+
import { access as access3, readFile as readFile8 } from "node:fs/promises";
|
|
13455
12589
|
async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors, opts = {}) {
|
|
13456
12590
|
const artifactsRoot = opts.artifactsRoot ?? getRefineArtifactsRoot();
|
|
13457
12591
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
13458
12592
|
let snapshot;
|
|
13459
12593
|
try {
|
|
13460
12594
|
await access3(paths.statePath);
|
|
13461
|
-
snapshot = JSON.parse(await
|
|
12595
|
+
snapshot = JSON.parse(await readFile8(paths.statePath, "utf8"));
|
|
13462
12596
|
} catch {
|
|
13463
12597
|
snapshot = await loadAndValidateForReview(sessionId, void 0);
|
|
13464
12598
|
snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
|
|
@@ -13506,7 +12640,7 @@ var init_merge_preview_validation_errors_into_review_session = __esm({
|
|
|
13506
12640
|
});
|
|
13507
12641
|
|
|
13508
12642
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
|
|
13509
|
-
import { readFile as
|
|
12643
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
13510
12644
|
async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
13511
12645
|
if (names.length === 0)
|
|
13512
12646
|
return;
|
|
@@ -13522,7 +12656,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
|
13522
12656
|
const nameSet = new Set(names);
|
|
13523
12657
|
let snapshot;
|
|
13524
12658
|
try {
|
|
13525
|
-
snapshot = JSON.parse(await
|
|
12659
|
+
snapshot = JSON.parse(await readFile9(paths.statePath, "utf8"));
|
|
13526
12660
|
} catch {
|
|
13527
12661
|
return;
|
|
13528
12662
|
}
|
|
@@ -13606,9 +12740,7 @@ var init_file_patterns = __esm({
|
|
|
13606
12740
|
".spec.ts",
|
|
13607
12741
|
".spec.tsx",
|
|
13608
12742
|
".test.ts",
|
|
13609
|
-
".test.tsx"
|
|
13610
|
-
".harness.ts",
|
|
13611
|
-
".harness.tsx"
|
|
12743
|
+
".test.tsx"
|
|
13612
12744
|
];
|
|
13613
12745
|
IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
13614
12746
|
".changeset",
|
|
@@ -13626,12 +12758,9 @@ var init_file_patterns = __esm({
|
|
|
13626
12758
|
"dist",
|
|
13627
12759
|
"example",
|
|
13628
12760
|
"examples",
|
|
13629
|
-
"harness",
|
|
13630
|
-
"harnesses",
|
|
13631
12761
|
"node_modules",
|
|
13632
12762
|
"out",
|
|
13633
|
-
"storybook-static"
|
|
13634
|
-
"testing"
|
|
12763
|
+
"storybook-static"
|
|
13635
12764
|
]);
|
|
13636
12765
|
DENYLISTED_EXACT_FILE_NAMES = /* @__PURE__ */ new Set([
|
|
13637
12766
|
"package.json",
|
|
@@ -13778,13 +12907,13 @@ var init_walk_project_tree = __esm({
|
|
|
13778
12907
|
});
|
|
13779
12908
|
|
|
13780
12909
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
|
|
13781
|
-
import { statSync as
|
|
12910
|
+
import { statSync as statSync3 } from "node:fs";
|
|
13782
12911
|
import path4 from "node:path";
|
|
13783
12912
|
function collectFiles(root, options = {}) {
|
|
13784
12913
|
const resolved = path4.resolve(root);
|
|
13785
12914
|
let stat5;
|
|
13786
12915
|
try {
|
|
13787
|
-
stat5 =
|
|
12916
|
+
stat5 = statSync3(resolved);
|
|
13788
12917
|
} catch (err) {
|
|
13789
12918
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
13790
12919
|
}
|
|
@@ -13888,10 +13017,10 @@ var init_run_record = __esm({
|
|
|
13888
13017
|
});
|
|
13889
13018
|
|
|
13890
13019
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
13891
|
-
import { readFile as
|
|
13020
|
+
import { readFile as readFile10 } from "node:fs/promises";
|
|
13892
13021
|
async function readRunsFileMaybe() {
|
|
13893
13022
|
try {
|
|
13894
|
-
const raw = await
|
|
13023
|
+
const raw = await readFile10(runsFilePath(), "utf8");
|
|
13895
13024
|
const parsed = JSON.parse(raw);
|
|
13896
13025
|
if (!READABLE_VERSIONS.has(parsed.version)) {
|
|
13897
13026
|
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.`);
|
|
@@ -13916,9 +13045,9 @@ var init_read_runs_file = __esm({
|
|
|
13916
13045
|
|
|
13917
13046
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
|
|
13918
13047
|
import { mkdir as mkdir2, rename, writeFile as writeFile3 } from "node:fs/promises";
|
|
13919
|
-
import { dirname as
|
|
13048
|
+
import { dirname as dirname11 } from "node:path";
|
|
13920
13049
|
async function writeRunsFileAtomic(file) {
|
|
13921
|
-
await mkdir2(
|
|
13050
|
+
await mkdir2(dirname11(runsFilePath()), { recursive: true });
|
|
13922
13051
|
const body = JSON.stringify(file, null, 2) + "\n";
|
|
13923
13052
|
const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
|
|
13924
13053
|
await writeFile3(tmp, body, { mode: 384 });
|
|
@@ -14011,8 +13140,8 @@ var init_sha256_hex = __esm({
|
|
|
14011
13140
|
});
|
|
14012
13141
|
|
|
14013
13142
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
|
|
14014
|
-
import { readFile as
|
|
14015
|
-
import { resolve as
|
|
13143
|
+
import { readFile as readFile11, stat } from "node:fs/promises";
|
|
13144
|
+
import { resolve as resolve16 } from "node:path";
|
|
14016
13145
|
function rowField(row, key) {
|
|
14017
13146
|
const v = row[key];
|
|
14018
13147
|
return typeof v === "string" ? v : null;
|
|
@@ -14026,7 +13155,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14026
13155
|
const name = rowField(row, "name");
|
|
14027
13156
|
if (!sourcePath)
|
|
14028
13157
|
continue;
|
|
14029
|
-
const abs =
|
|
13158
|
+
const abs = resolve16(sourcePath);
|
|
14030
13159
|
if (seen.has(abs))
|
|
14031
13160
|
continue;
|
|
14032
13161
|
seen.add(abs);
|
|
@@ -14043,10 +13172,10 @@ async function buildSourceFingerprint(opts) {
|
|
|
14043
13172
|
let rawTokensMtime = null;
|
|
14044
13173
|
let rawTokensContentHash = null;
|
|
14045
13174
|
if (opts.rawTokensPath) {
|
|
14046
|
-
const abs =
|
|
13175
|
+
const abs = resolve16(opts.rawTokensPath);
|
|
14047
13176
|
rawTokensPath = abs;
|
|
14048
13177
|
try {
|
|
14049
|
-
const [st, buf] = await Promise.all([stat(abs),
|
|
13178
|
+
const [st, buf] = await Promise.all([stat(abs), readFile11(abs)]);
|
|
14050
13179
|
rawTokensMtime = st.mtime.toISOString();
|
|
14051
13180
|
rawTokensContentHash = sha256Hex(buf);
|
|
14052
13181
|
} catch {
|
|
@@ -14211,12 +13340,12 @@ var init_write_scope_decisions_snapshot = __esm({
|
|
|
14211
13340
|
});
|
|
14212
13341
|
|
|
14213
13342
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
|
|
14214
|
-
import { readFile as
|
|
13343
|
+
import { readFile as readFile12 } from "node:fs/promises";
|
|
14215
13344
|
async function loadAcceptedNames(sessionId) {
|
|
14216
13345
|
try {
|
|
14217
13346
|
const artifactsRoot = getRefineArtifactsRoot();
|
|
14218
13347
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
14219
|
-
const raw = await
|
|
13348
|
+
const raw = await readFile12(paths.statePath, "utf8");
|
|
14220
13349
|
const snapshot = JSON.parse(raw);
|
|
14221
13350
|
const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
|
|
14222
13351
|
if (accepted.length === 0)
|
|
@@ -15204,7 +14333,7 @@ function errorMessage(error) {
|
|
|
15204
14333
|
return error instanceof Error && error.message ? error.message : String(error);
|
|
15205
14334
|
}
|
|
15206
14335
|
function defaultSleep(delayMs) {
|
|
15207
|
-
return new Promise((
|
|
14336
|
+
return new Promise((resolve28) => setTimeout(resolve28, delayMs));
|
|
15208
14337
|
}
|
|
15209
14338
|
var MAX_RETRY_AFTER_MS;
|
|
15210
14339
|
var init_http_utils = __esm({
|
|
@@ -15480,7 +14609,7 @@ var init_api_client = __esm({
|
|
|
15480
14609
|
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
15481
14610
|
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
15482
14611
|
const jitter = Math.random() * baseDelay * 0.15;
|
|
15483
|
-
await new Promise((
|
|
14612
|
+
await new Promise((resolve28) => setTimeout(resolve28, baseDelay + jitter));
|
|
15484
14613
|
}
|
|
15485
14614
|
}
|
|
15486
14615
|
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
@@ -16167,7 +15296,7 @@ var init_collect_json_files = __esm({
|
|
|
16167
15296
|
});
|
|
16168
15297
|
|
|
16169
15298
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
|
|
16170
|
-
import { readFile as
|
|
15299
|
+
import { readFile as readFile13, stat as stat3 } from "node:fs/promises";
|
|
16171
15300
|
async function readTokensFromPath(flag, p) {
|
|
16172
15301
|
let s;
|
|
16173
15302
|
try {
|
|
@@ -16190,7 +15319,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16190
15319
|
const merged = {};
|
|
16191
15320
|
for (const file of files.sort()) {
|
|
16192
15321
|
try {
|
|
16193
|
-
const text = await
|
|
15322
|
+
const text = await readFile13(file, "utf8");
|
|
16194
15323
|
const parsed = JSON.parse(text);
|
|
16195
15324
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
16196
15325
|
Object.assign(merged, parsed);
|
|
@@ -16204,7 +15333,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16204
15333
|
async function readSingleFile(flag, p) {
|
|
16205
15334
|
let text;
|
|
16206
15335
|
try {
|
|
16207
|
-
text = await
|
|
15336
|
+
text = await readFile13(p, "utf8");
|
|
16208
15337
|
} catch {
|
|
16209
15338
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
16210
15339
|
}
|
|
@@ -16310,12 +15439,12 @@ var init_fetch_and_persist = __esm({
|
|
|
16310
15439
|
});
|
|
16311
15440
|
|
|
16312
15441
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/read-from-session.js
|
|
16313
|
-
import { readFile as
|
|
15442
|
+
import { readFile as readFile14 } from "node:fs/promises";
|
|
16314
15443
|
async function readExistingContentfulEntitiesFromSession(request) {
|
|
16315
15444
|
if (!request.path)
|
|
16316
15445
|
return void 0;
|
|
16317
15446
|
try {
|
|
16318
|
-
const raw = await
|
|
15447
|
+
const raw = await readFile14(request.path, "utf8");
|
|
16319
15448
|
const parsed = JSON.parse(raw);
|
|
16320
15449
|
if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
|
|
16321
15450
|
return void 0;
|
|
@@ -16894,26 +16023,22 @@ async function trackEvent(event, properties, anonymousId, options) {
|
|
|
16894
16023
|
}
|
|
16895
16024
|
}
|
|
16896
16025
|
async function flushAnalytics() {
|
|
16897
|
-
|
|
16898
|
-
|
|
16899
|
-
|
|
16900
|
-
|
|
16026
|
+
if (!analyticsClient)
|
|
16027
|
+
return;
|
|
16028
|
+
try {
|
|
16029
|
+
await analyticsClient.closeAndFlush();
|
|
16030
|
+
} catch {
|
|
16031
|
+
} finally {
|
|
16901
16032
|
analyticsClient = null;
|
|
16902
|
-
|
|
16903
|
-
await client2.closeAndFlush();
|
|
16904
|
-
} catch {
|
|
16905
|
-
}
|
|
16906
|
-
});
|
|
16907
|
-
return flushChain;
|
|
16033
|
+
}
|
|
16908
16034
|
}
|
|
16909
|
-
var DEFAULT_WRITE_KEY, analyticsClient
|
|
16035
|
+
var DEFAULT_WRITE_KEY, analyticsClient;
|
|
16910
16036
|
var init_segment_client = __esm({
|
|
16911
16037
|
"packages/experience-design-system-backend-pipeline/dist/src/analytics/client/segment-client.js"() {
|
|
16912
16038
|
"use strict";
|
|
16913
16039
|
init_opt_out();
|
|
16914
16040
|
DEFAULT_WRITE_KEY = "6DmxiEPN3SV1vbRTTMcNqDzCvkfwT06N";
|
|
16915
16041
|
analyticsClient = null;
|
|
16916
|
-
flushChain = Promise.resolve();
|
|
16917
16042
|
}
|
|
16918
16043
|
});
|
|
16919
16044
|
|
|
@@ -17192,7 +16317,7 @@ var init_analytics = __esm({
|
|
|
17192
16317
|
});
|
|
17193
16318
|
|
|
17194
16319
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/map-tokens/run-map-tokens.js
|
|
17195
|
-
import { resolve as
|
|
16320
|
+
import { resolve as resolve17 } from "node:path";
|
|
17196
16321
|
async function runMapTokens(request) {
|
|
17197
16322
|
const timeoutMs = request.agentTimeoutMs ?? DEFAULT_TIMEOUT_MS2;
|
|
17198
16323
|
const db = openPipelineDb();
|
|
@@ -17243,7 +16368,7 @@ async function runMapTokens(request) {
|
|
|
17243
16368
|
outDir: process.cwd(),
|
|
17244
16369
|
existingTokensInline: request.existingEntitiesInline,
|
|
17245
16370
|
...request.skillContentOverride !== void 0 ? { skillContentOverride: request.skillContentOverride } : {},
|
|
17246
|
-
...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride:
|
|
16371
|
+
...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride: resolve17(request.skillPathOverride) } : {}
|
|
17247
16372
|
});
|
|
17248
16373
|
if (request.printPrompt) {
|
|
17249
16374
|
const prompt2 = await buildMapPrompt();
|
|
@@ -17459,7 +16584,7 @@ var init_parse_imported_names = __esm({
|
|
|
17459
16584
|
});
|
|
17460
16585
|
|
|
17461
16586
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
|
|
17462
|
-
import { readFile as
|
|
16587
|
+
import { readFile as readFile15 } from "node:fs/promises";
|
|
17463
16588
|
function escapeRegExp(value) {
|
|
17464
16589
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
17465
16590
|
}
|
|
@@ -17492,14 +16617,7 @@ function hasSiblingForwardRender(sourceText, siblingImports) {
|
|
|
17492
16617
|
});
|
|
17493
16618
|
}
|
|
17494
16619
|
function hasVisibleUiRender(sourceText) {
|
|
17495
|
-
|
|
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);
|
|
16620
|
+
return /return\s*(?:\(|<)/.test(sourceText) && VISIBLE_UI_TAG_PATTERN.test(sourceText);
|
|
17503
16621
|
}
|
|
17504
16622
|
function infraPropNames(component) {
|
|
17505
16623
|
const props = component.props.map((prop) => prop.name);
|
|
@@ -17522,7 +16640,7 @@ function dedupeReasons(reasons) {
|
|
|
17522
16640
|
async function inspectComponentSource(component) {
|
|
17523
16641
|
let sourceText = "";
|
|
17524
16642
|
try {
|
|
17525
|
-
sourceText = await
|
|
16643
|
+
sourceText = await readFile15(component.source, "utf8");
|
|
17526
16644
|
} catch {
|
|
17527
16645
|
return {
|
|
17528
16646
|
wrapperConfidence: 0,
|
|
@@ -17978,7 +17096,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
17978
17096
|
const message = error instanceof Error ? error.message : String(error);
|
|
17979
17097
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
17980
17098
|
throw error;
|
|
17981
|
-
await new Promise((
|
|
17099
|
+
await new Promise((resolve28) => setTimeout(resolve28, Math.min(250 * attempt, 2e3)));
|
|
17982
17100
|
}
|
|
17983
17101
|
}
|
|
17984
17102
|
}
|
|
@@ -18026,7 +17144,7 @@ var init_resolve_composition_agent_name = __esm({
|
|
|
18026
17144
|
});
|
|
18027
17145
|
|
|
18028
17146
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/read-candidate-files.js
|
|
18029
|
-
import { readFile as
|
|
17147
|
+
import { readFile as readFile16 } from "node:fs/promises";
|
|
18030
17148
|
async function readCandidateFiles(components, extraFiles = []) {
|
|
18031
17149
|
const paths = new Set(extraFiles);
|
|
18032
17150
|
for (const c2 of components) {
|
|
@@ -18036,7 +17154,7 @@ async function readCandidateFiles(components, extraFiles = []) {
|
|
|
18036
17154
|
const out = [];
|
|
18037
17155
|
await Promise.all([...paths].map(async (p) => {
|
|
18038
17156
|
try {
|
|
18039
|
-
const content = await
|
|
17157
|
+
const content = await readFile16(p, "utf8");
|
|
18040
17158
|
out.push({ path: p, content });
|
|
18041
17159
|
} catch {
|
|
18042
17160
|
}
|
|
@@ -18275,7 +17393,7 @@ var init_write_tokens_file = __esm({
|
|
|
18275
17393
|
});
|
|
18276
17394
|
|
|
18277
17395
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-tokens-session/run-generate-tokens-session.js
|
|
18278
|
-
import { readFile as
|
|
17396
|
+
import { readFile as readFile17 } from "node:fs/promises";
|
|
18279
17397
|
import { basename as basename5, resolve as pathResolve } from "node:path";
|
|
18280
17398
|
async function runGenerateTokensSession(request) {
|
|
18281
17399
|
const { rawTokensPath, outDir, agent, agentModel, promptOverrides, skillPath, noCache, bedrock = false, onProgress, onSessionCreated } = request;
|
|
@@ -18284,7 +17402,7 @@ async function runGenerateTokensSession(request) {
|
|
|
18284
17402
|
throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
|
|
18285
17403
|
const tokensOverride = overridesMap.get("tokens");
|
|
18286
17404
|
const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
|
|
18287
|
-
const rawTokensInline = await
|
|
17405
|
+
const rawTokensInline = await readFile17(pathResolve(rawTokensPath), "utf8");
|
|
18288
17406
|
const tokenInputHash = hashTokenContent(rawTokensInline);
|
|
18289
17407
|
const db = openPipelineDb();
|
|
18290
17408
|
try {
|
|
@@ -18435,7 +17553,7 @@ var init_read_existing_entities = __esm({
|
|
|
18435
17553
|
});
|
|
18436
17554
|
|
|
18437
17555
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/resolve-generate-prompt.js
|
|
18438
|
-
import { resolve as
|
|
17556
|
+
import { resolve as resolve18 } from "node:path";
|
|
18439
17557
|
async function resolveGeneratePrompt(overrides) {
|
|
18440
17558
|
const { overrides: parsed, errors } = parsePromptOverrides(overrides);
|
|
18441
17559
|
if (errors.length > 0)
|
|
@@ -18446,7 +17564,7 @@ async function resolveGeneratePrompt(overrides) {
|
|
|
18446
17564
|
const text = await resolvePromptOverride(entry);
|
|
18447
17565
|
if (entry.kind === "text")
|
|
18448
17566
|
return { text };
|
|
18449
|
-
return { path:
|
|
17567
|
+
return { path: resolve18(entry.value), text };
|
|
18450
17568
|
}
|
|
18451
17569
|
var init_resolve_generate_prompt = __esm({
|
|
18452
17570
|
"packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/resolve-generate-prompt.js"() {
|
|
@@ -18949,10 +18067,10 @@ var init_src3 = __esm({
|
|
|
18949
18067
|
|
|
18950
18068
|
// packages/experience-design-system-cli/src/tui/package-root.ts
|
|
18951
18069
|
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
18952
|
-
import { dirname as
|
|
18070
|
+
import { dirname as dirname12, join as join14 } from "node:path";
|
|
18953
18071
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
18954
18072
|
function findPackageRoot(startUrl, packageName) {
|
|
18955
|
-
let dir =
|
|
18073
|
+
let dir = dirname12(fileURLToPath3(startUrl));
|
|
18956
18074
|
let found;
|
|
18957
18075
|
while (true) {
|
|
18958
18076
|
const manifestPath = join14(dir, "package.json");
|
|
@@ -18960,7 +18078,7 @@ function findPackageRoot(startUrl, packageName) {
|
|
|
18960
18078
|
const pkg2 = JSON.parse(readFileSync7(manifestPath, "utf8"));
|
|
18961
18079
|
if (pkg2.name === packageName) found = dir;
|
|
18962
18080
|
}
|
|
18963
|
-
const parent =
|
|
18081
|
+
const parent = dirname12(dir);
|
|
18964
18082
|
if (parent === dir) return found ?? dir;
|
|
18965
18083
|
dir = parent;
|
|
18966
18084
|
}
|
|
@@ -18973,22 +18091,22 @@ var init_package_root = __esm({
|
|
|
18973
18091
|
|
|
18974
18092
|
// packages/experience-design-system-types/dist/src/config/index.js
|
|
18975
18093
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
18976
|
-
import { mkdir as mkdir6, readFile as
|
|
18094
|
+
import { mkdir as mkdir6, readFile as readFile18, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
18977
18095
|
import { homedir as homedir2 } from "node:os";
|
|
18978
|
-
import { dirname as
|
|
18096
|
+
import { dirname as dirname13, join as join16 } from "node:path";
|
|
18979
18097
|
function configRoot2() {
|
|
18980
18098
|
return process.env["EDS_HOME"] || join16(homedir2(), ".contentful", "experience-design-system-cli");
|
|
18981
18099
|
}
|
|
18982
18100
|
async function readSettings2() {
|
|
18983
18101
|
try {
|
|
18984
|
-
return JSON.parse(await
|
|
18102
|
+
return JSON.parse(await readFile18(configFilePath2(), "utf8"));
|
|
18985
18103
|
} catch {
|
|
18986
18104
|
return {};
|
|
18987
18105
|
}
|
|
18988
18106
|
}
|
|
18989
18107
|
async function writeSettings2(settings) {
|
|
18990
18108
|
const path5 = configFilePath2();
|
|
18991
|
-
await mkdir6(
|
|
18109
|
+
await mkdir6(dirname13(path5), { recursive: true });
|
|
18992
18110
|
const tmp = `${path5}.${process.pid}.${randomBytes4(4).toString("hex")}.tmp`;
|
|
18993
18111
|
await writeFile6(tmp, `${JSON.stringify(settings, null, 2)}
|
|
18994
18112
|
`, { mode: 384 });
|
|
@@ -20089,7 +19207,7 @@ var init_controls5 = __esm({
|
|
|
20089
19207
|
|
|
20090
19208
|
// packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
|
|
20091
19209
|
import { homedir as homedir3 } from "node:os";
|
|
20092
|
-
import { resolve as
|
|
19210
|
+
import { resolve as resolve19 } from "node:path";
|
|
20093
19211
|
function stripQuotes(value) {
|
|
20094
19212
|
const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
|
|
20095
19213
|
return value.length >= 2 && quoted ? value.slice(1, -1) : value;
|
|
@@ -20098,7 +19216,7 @@ function expandHome(value) {
|
|
|
20098
19216
|
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir3() + value.slice(1) : value;
|
|
20099
19217
|
}
|
|
20100
19218
|
function resolveUserPath(raw) {
|
|
20101
|
-
return
|
|
19219
|
+
return resolve19(expandHome(stripQuotes(raw.trim())));
|
|
20102
19220
|
}
|
|
20103
19221
|
var init_resolve_user_path = __esm({
|
|
20104
19222
|
"packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts"() {
|
|
@@ -20107,12 +19225,12 @@ var init_resolve_user_path = __esm({
|
|
|
20107
19225
|
});
|
|
20108
19226
|
|
|
20109
19227
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
20110
|
-
import { statSync as
|
|
19228
|
+
import { statSync as statSync4 } from "node:fs";
|
|
20111
19229
|
function validateTokenPath(rawPath) {
|
|
20112
19230
|
const path5 = resolveUserPath(rawPath);
|
|
20113
19231
|
let stats;
|
|
20114
19232
|
try {
|
|
20115
|
-
stats =
|
|
19233
|
+
stats = statSync4(path5);
|
|
20116
19234
|
} catch {
|
|
20117
19235
|
return { ok: false, error: `Path not found: ${path5}`, resolvedPath: path5 };
|
|
20118
19236
|
}
|
|
@@ -20980,15 +20098,15 @@ var init_steps = __esm({
|
|
|
20980
20098
|
|
|
20981
20099
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
20982
20100
|
import { existsSync as existsSync9 } from "node:fs";
|
|
20983
|
-
import { dirname as
|
|
20101
|
+
import { dirname as dirname14, join as join18, resolve as resolve20 } from "node:path";
|
|
20984
20102
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
20985
20103
|
function findSkillPath(fileName) {
|
|
20986
|
-
const thisDir =
|
|
20104
|
+
const thisDir = dirname14(fileURLToPath4(import.meta.url));
|
|
20987
20105
|
let dir = thisDir;
|
|
20988
20106
|
for (; ; ) {
|
|
20989
20107
|
const candidate = join18(dir, "skills", fileName);
|
|
20990
20108
|
if (existsSync9(candidate)) return candidate;
|
|
20991
|
-
const parent =
|
|
20109
|
+
const parent = resolve20(dir, "..");
|
|
20992
20110
|
if (parent === dir) {
|
|
20993
20111
|
throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
|
|
20994
20112
|
}
|
|
@@ -21002,9 +20120,9 @@ var init_find_skill_path = __esm({
|
|
|
21002
20120
|
});
|
|
21003
20121
|
|
|
21004
20122
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/selection.ts
|
|
21005
|
-
import { resolve as
|
|
20123
|
+
import { resolve as resolve21 } from "node:path";
|
|
21006
20124
|
async function hashSelectPrompt(options) {
|
|
21007
|
-
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(
|
|
20125
|
+
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve21(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
|
|
21008
20126
|
return hashContent(`${promptHash}|${options.agent}|${options.model ?? ""}`);
|
|
21009
20127
|
}
|
|
21010
20128
|
async function runSelection(options) {
|
|
@@ -21099,9 +20217,9 @@ var init_selection2 = __esm({
|
|
|
21099
20217
|
|
|
21100
20218
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
21101
20219
|
import { mkdir as mkdir7 } from "node:fs/promises";
|
|
21102
|
-
import { join as join19, resolve as
|
|
20220
|
+
import { join as join19, resolve as resolve22 } from "node:path";
|
|
21103
20221
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
21104
|
-
const outDir = input.outDir ?? join19(
|
|
20222
|
+
const outDir = input.outDir ?? join19(resolve22(input.projectPath), ".contentful");
|
|
21105
20223
|
let progress = initialProgress({
|
|
21106
20224
|
hasCredentials: input.credentials !== null,
|
|
21107
20225
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -21225,7 +20343,7 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
21225
20343
|
if (select?.kind === "text") return { promptText: select.value };
|
|
21226
20344
|
if (select?.kind === "path") {
|
|
21227
20345
|
await resolvePromptOverride(select);
|
|
21228
|
-
return { promptPath:
|
|
20346
|
+
return { promptPath: resolve22(select.value) };
|
|
21229
20347
|
}
|
|
21230
20348
|
return {};
|
|
21231
20349
|
}
|
|
@@ -24543,7 +23661,7 @@ var init_save_decisions = __esm({
|
|
|
24543
23661
|
});
|
|
24544
23662
|
|
|
24545
23663
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
24546
|
-
import { resolve as
|
|
23664
|
+
import { resolve as resolve23 } from "node:path";
|
|
24547
23665
|
async function runGeneration(input, onProgress, deps = realDeps4) {
|
|
24548
23666
|
let progress = { components: null, mapTokens: "idle", mapTokensEligible: null };
|
|
24549
23667
|
const update = (change) => {
|
|
@@ -24629,7 +23747,7 @@ async function buildMapTokensOptions(input) {
|
|
|
24629
23747
|
if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
|
|
24630
23748
|
if (mapOverride?.kind === "path") {
|
|
24631
23749
|
await resolvePromptOverride(mapOverride);
|
|
24632
|
-
prompt.skillPathOverride =
|
|
23750
|
+
prompt.skillPathOverride = resolve23(mapOverride.value);
|
|
24633
23751
|
}
|
|
24634
23752
|
if (input.existingEntitiesPath) {
|
|
24635
23753
|
const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
|
|
@@ -30910,7 +30028,7 @@ var init_DoneStep = __esm({
|
|
|
30910
30028
|
});
|
|
30911
30029
|
|
|
30912
30030
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
30913
|
-
import { resolve as
|
|
30031
|
+
import { resolve as resolve24 } from "node:path";
|
|
30914
30032
|
import { homedir as homedir4 } from "node:os";
|
|
30915
30033
|
function expandTilde(input) {
|
|
30916
30034
|
if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
|
|
@@ -30924,7 +30042,7 @@ function normalizePath(input) {
|
|
|
30924
30042
|
p = p.slice(1, -1);
|
|
30925
30043
|
}
|
|
30926
30044
|
p = expandTilde(p);
|
|
30927
|
-
return
|
|
30045
|
+
return resolve24(p);
|
|
30928
30046
|
}
|
|
30929
30047
|
var init_path_utils = __esm({
|
|
30930
30048
|
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts"() {
|
|
@@ -30952,12 +30070,12 @@ var init_use_blinking_cursor = __esm({
|
|
|
30952
30070
|
import { useState as useState27 } from "react";
|
|
30953
30071
|
import { Box as Box41, Text as Text43 } from "ink";
|
|
30954
30072
|
import { readdirSync as readdirSync3 } from "node:fs";
|
|
30955
|
-
import { dirname as
|
|
30073
|
+
import { dirname as dirname15, basename as basename6, join as join21 } from "node:path";
|
|
30956
30074
|
import { jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
30957
30075
|
function autocomplete(partial) {
|
|
30958
30076
|
if (!partial) return null;
|
|
30959
30077
|
const normalized = normalizePath(partial);
|
|
30960
|
-
const dir =
|
|
30078
|
+
const dir = dirname15(normalized);
|
|
30961
30079
|
const base = basename6(normalized);
|
|
30962
30080
|
let entries;
|
|
30963
30081
|
try {
|
|
@@ -32271,7 +31389,7 @@ var init_save = __esm({
|
|
|
32271
31389
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
32272
31390
|
appendRun,
|
|
32273
31391
|
buildSourceFingerprint,
|
|
32274
|
-
sleep: (ms) => new Promise((
|
|
31392
|
+
sleep: (ms) => new Promise((resolve28) => setTimeout(resolve28, ms)),
|
|
32275
31393
|
warn: (message) => process.stderr.write(message)
|
|
32276
31394
|
});
|
|
32277
31395
|
}
|
|
@@ -32293,7 +31411,7 @@ var init_types9 = __esm({
|
|
|
32293
31411
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
32294
31412
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
32295
31413
|
import { tmpdir } from "node:os";
|
|
32296
|
-
import { join as join23, resolve as
|
|
31414
|
+
import { join as join23, resolve as resolve25 } from "node:path";
|
|
32297
31415
|
function appendWizardLog(entry) {
|
|
32298
31416
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
32299
31417
|
}
|
|
@@ -32546,7 +31664,7 @@ function createFlowController(start, deps) {
|
|
|
32546
31664
|
},
|
|
32547
31665
|
async submitPath(submitted) {
|
|
32548
31666
|
await deps.mkdir(submitted);
|
|
32549
|
-
if (
|
|
31667
|
+
if (resolve25(submitted) !== resolve25(state2.outDir) && await deps.detectSaveConflict(submitted)) {
|
|
32550
31668
|
const subdir = deps.buildTimestampedSubdir(submitted);
|
|
32551
31669
|
await deps.mkdir(subdir);
|
|
32552
31670
|
await proceedToWrite(subdir);
|
|
@@ -32641,7 +31759,7 @@ var init_debug_mode_store = __esm({
|
|
|
32641
31759
|
|
|
32642
31760
|
// packages/experience-design-system-cli/src/tui/debug-prune.ts
|
|
32643
31761
|
import { readdir as readdir2, rm, rmdir, stat as stat4 } from "node:fs/promises";
|
|
32644
|
-
import { dirname as
|
|
31762
|
+
import { dirname as dirname16, join as join24 } from "node:path";
|
|
32645
31763
|
async function logFilesIn(dir) {
|
|
32646
31764
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
32647
31765
|
const nested = await Promise.all(
|
|
@@ -32664,7 +31782,7 @@ async function removeEmptyFolders(from, stop) {
|
|
|
32664
31782
|
}
|
|
32665
31783
|
removed += 1;
|
|
32666
31784
|
if (dir === stop) return removed;
|
|
32667
|
-
dir =
|
|
31785
|
+
dir = dirname16(dir);
|
|
32668
31786
|
}
|
|
32669
31787
|
}
|
|
32670
31788
|
async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
@@ -32680,7 +31798,7 @@ async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
|
32680
31798
|
if ((await stat4(file)).mtimeMs >= cutoff) continue;
|
|
32681
31799
|
await rm(file);
|
|
32682
31800
|
result.logs += 1;
|
|
32683
|
-
result.folders += await removeEmptyFolders(
|
|
31801
|
+
result.folders += await removeEmptyFolders(dirname16(file), join24(contentfulDir, session));
|
|
32684
31802
|
} catch {
|
|
32685
31803
|
}
|
|
32686
31804
|
}
|
|
@@ -32710,7 +31828,7 @@ __export(debug_store_exports, {
|
|
|
32710
31828
|
});
|
|
32711
31829
|
import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
|
|
32712
31830
|
import { existsSync as existsSync10, readdirSync as readdirSync4 } from "node:fs";
|
|
32713
|
-
import { join as join25, resolve as
|
|
31831
|
+
import { join as join25, resolve as resolve26 } from "node:path";
|
|
32714
31832
|
function generateRunId() {
|
|
32715
31833
|
const now = /* @__PURE__ */ new Date();
|
|
32716
31834
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -32726,7 +31844,7 @@ function slugify(value) {
|
|
|
32726
31844
|
async function readBaseDir() {
|
|
32727
31845
|
try {
|
|
32728
31846
|
const dir = (await readSettings2())["contentfulBaseDir"];
|
|
32729
|
-
return typeof dir === "string" && dir !== "" ?
|
|
31847
|
+
return typeof dir === "string" && dir !== "" ? resolve26(dir) : void 0;
|
|
32730
31848
|
} catch {
|
|
32731
31849
|
return void 0;
|
|
32732
31850
|
}
|
|
@@ -32755,7 +31873,7 @@ function currentSessionDir() {
|
|
|
32755
31873
|
async function startDebugSessionIn(base, { replace = false } = {}) {
|
|
32756
31874
|
try {
|
|
32757
31875
|
if (!await isDebugModeEnabled()) return;
|
|
32758
|
-
await mkdir9(join25(startSession(
|
|
31876
|
+
await mkdir9(join25(startSession(resolve26(base), { replace }), "debug"), { recursive: true });
|
|
32759
31877
|
} catch {
|
|
32760
31878
|
}
|
|
32761
31879
|
}
|
|
@@ -32769,7 +31887,7 @@ function nextImportRunDir(session) {
|
|
|
32769
31887
|
}
|
|
32770
31888
|
async function startImportRun(projectPath) {
|
|
32771
31889
|
await startDebugSessionIn(projectPath);
|
|
32772
|
-
if (!sessionDir) return join25(
|
|
31890
|
+
if (!sessionDir) return join25(resolve26(projectPath), ".contentful");
|
|
32773
31891
|
const dir = nextImportRunDir(sessionDir);
|
|
32774
31892
|
await mkdir9(dir, { recursive: true });
|
|
32775
31893
|
return dir;
|
|
@@ -32911,7 +32029,7 @@ var init_debug_store = __esm({
|
|
|
32911
32029
|
});
|
|
32912
32030
|
|
|
32913
32031
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
32914
|
-
import { join as join26, resolve as
|
|
32032
|
+
import { join as join26, resolve as resolve27 } from "node:path";
|
|
32915
32033
|
function describeFileLocations({
|
|
32916
32034
|
contentfulBaseDir,
|
|
32917
32035
|
debugModeEnabled,
|
|
@@ -32923,7 +32041,7 @@ function describeFileLocations({
|
|
|
32923
32041
|
importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
32924
32042
|
};
|
|
32925
32043
|
}
|
|
32926
|
-
const base = contentfulBaseDir ?
|
|
32044
|
+
const base = contentfulBaseDir ? resolve27(contentfulBaseDir) : "<project>";
|
|
32927
32045
|
const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
|
|
32928
32046
|
return {
|
|
32929
32047
|
debugLogs: join26(session, "debug"),
|
|
@@ -33155,20 +32273,20 @@ function resolveOnPath(binary) {
|
|
|
33155
32273
|
() => null
|
|
33156
32274
|
);
|
|
33157
32275
|
}
|
|
33158
|
-
return new Promise((
|
|
32276
|
+
return new Promise((resolve28) => {
|
|
33159
32277
|
execFile2(
|
|
33160
32278
|
process.platform === "win32" ? "where" : "which",
|
|
33161
32279
|
[binary],
|
|
33162
|
-
(error, stdout) =>
|
|
32280
|
+
(error, stdout) => resolve28(error ? null : stdout.split("\n")[0]?.trim() ?? null)
|
|
33163
32281
|
);
|
|
33164
32282
|
});
|
|
33165
32283
|
}
|
|
33166
32284
|
function readVersion(binary) {
|
|
33167
|
-
return new Promise((
|
|
32285
|
+
return new Promise((resolve28) => {
|
|
33168
32286
|
execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
|
|
33169
32287
|
const line = stdout.split("\n")[0]?.trim() ?? "";
|
|
33170
|
-
if (!error && line)
|
|
33171
|
-
else
|
|
32288
|
+
if (!error && line) resolve28(pass("version", line));
|
|
32289
|
+
else resolve28(fail3("version", "runs, but did not report a version"));
|
|
33172
32290
|
});
|
|
33173
32291
|
});
|
|
33174
32292
|
}
|
|
@@ -34286,7 +33404,8 @@ function App({ importOptions, inkClear }) {
|
|
|
34286
33404
|
agent,
|
|
34287
33405
|
...agentModel ? { agentModel } : {},
|
|
34288
33406
|
promptOverrides: launch.prompt ?? [],
|
|
34289
|
-
|
|
33407
|
+
// Every import generates new results: no stage restores an earlier run's output from the cache.
|
|
33408
|
+
noCache: true
|
|
34290
33409
|
}
|
|
34291
33410
|
};
|
|
34292
33411
|
};
|
|
@@ -34572,8 +33691,7 @@ import { Command } from "commander";
|
|
|
34572
33691
|
function toImportOptions(raw) {
|
|
34573
33692
|
return {
|
|
34574
33693
|
...raw.agent ? { agent: raw.agent } : {},
|
|
34575
|
-
prompt: raw.prompt ?? []
|
|
34576
|
-
cache: raw.cache !== false
|
|
33694
|
+
prompt: raw.prompt ?? []
|
|
34577
33695
|
};
|
|
34578
33696
|
}
|
|
34579
33697
|
|
|
@@ -34593,14 +33711,14 @@ function runDevWatch(args) {
|
|
|
34593
33711
|
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
34594
33712
|
return Promise.resolve(1);
|
|
34595
33713
|
}
|
|
34596
|
-
return new Promise((
|
|
33714
|
+
return new Promise((resolve28) => {
|
|
34597
33715
|
const child = spawn3(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
34598
33716
|
process.on("SIGINT", () => void 0);
|
|
34599
|
-
child.on("exit", (code) =>
|
|
33717
|
+
child.on("exit", (code) => resolve28(code ?? 0));
|
|
34600
33718
|
child.on("error", (err) => {
|
|
34601
33719
|
process.stderr.write(`${err.message}
|
|
34602
33720
|
`);
|
|
34603
|
-
|
|
33721
|
+
resolve28(1);
|
|
34604
33722
|
});
|
|
34605
33723
|
});
|
|
34606
33724
|
}
|
|
@@ -34615,7 +33733,7 @@ function registerImportCommand(program, openTui) {
|
|
|
34615
33733
|
"Override a stage prompt (repeatable): a file path or literal text, e.g. --prompt select=./p.md",
|
|
34616
33734
|
(value, previous) => [...previous, value],
|
|
34617
33735
|
[]
|
|
34618
|
-
).
|
|
33736
|
+
).action(async (_args, raw) => {
|
|
34619
33737
|
const { watch, rest: forwarded } = extractWatchFlag(stripImportArg(process.argv.slice(2)));
|
|
34620
33738
|
if (watch) {
|
|
34621
33739
|
process.exit(await runDevWatch(forwarded));
|
|
@@ -34671,12 +33789,12 @@ function createProgram() {
|
|
|
34671
33789
|
init_config();
|
|
34672
33790
|
init_package_root();
|
|
34673
33791
|
import { existsSync as existsSync12 } from "node:fs";
|
|
34674
|
-
import { mkdir as mkdir10, readFile as
|
|
34675
|
-
import { dirname as
|
|
33792
|
+
import { mkdir as mkdir10, readFile as readFile19, rename as rename3, rmdir as rmdir2, unlink } from "node:fs/promises";
|
|
33793
|
+
import { dirname as dirname17, join as join28 } from "node:path";
|
|
34676
33794
|
var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
34677
33795
|
async function readJson(path5) {
|
|
34678
33796
|
try {
|
|
34679
|
-
return JSON.parse(await
|
|
33797
|
+
return JSON.parse(await readFile19(path5, "utf8"));
|
|
34680
33798
|
} catch {
|
|
34681
33799
|
return void 0;
|
|
34682
33800
|
}
|
|
@@ -34698,7 +33816,7 @@ async function migrateOldConfig() {
|
|
|
34698
33816
|
if (Object.keys(migrated).length > 0) await updateSettings2({ ...migrated, ...await readSettings2() });
|
|
34699
33817
|
if (existsSync12(oldRuns)) {
|
|
34700
33818
|
if (!existsSync12(runsFilePath2())) {
|
|
34701
|
-
await mkdir10(
|
|
33819
|
+
await mkdir10(dirname17(runsFilePath2()), { recursive: true });
|
|
34702
33820
|
await rename3(oldRuns, runsFilePath2());
|
|
34703
33821
|
} else {
|
|
34704
33822
|
await unlink(oldRuns);
|