@contentful/experience-design-system-cli 2.37.1-dev-build-a0a57522.0 → 2.37.1-dev-build-1b4e84a3.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 +755 -103
- package/dist/index.js +877 -117
- package/dist/package.json +1 -1
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -837,7 +837,7 @@ async function runAgent(options) {
|
|
|
837
837
|
promptLen: prompt.length,
|
|
838
838
|
promptHead: prompt.slice(0, 500)
|
|
839
839
|
});
|
|
840
|
-
return new Promise((
|
|
840
|
+
return new Promise((resolve29) => {
|
|
841
841
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
842
842
|
const child = spawn(binary, args, {
|
|
843
843
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -886,7 +886,7 @@ async function runAgent(options) {
|
|
|
886
886
|
stderrLen: stderr.length,
|
|
887
887
|
stderrTail: stderr.slice(-1e3)
|
|
888
888
|
});
|
|
889
|
-
|
|
889
|
+
resolve29(result);
|
|
890
890
|
});
|
|
891
891
|
});
|
|
892
892
|
}
|
|
@@ -908,7 +908,7 @@ async function checkAgentAuth(agent) {
|
|
|
908
908
|
return "not-found";
|
|
909
909
|
if (agent !== "claude")
|
|
910
910
|
return "ok";
|
|
911
|
-
return new Promise((
|
|
911
|
+
return new Promise((resolve29) => {
|
|
912
912
|
const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
913
913
|
let stdout = "";
|
|
914
914
|
let done = false;
|
|
@@ -917,7 +917,7 @@ async function checkAgentAuth(agent) {
|
|
|
917
917
|
return;
|
|
918
918
|
done = true;
|
|
919
919
|
child.kill("SIGTERM");
|
|
920
|
-
|
|
920
|
+
resolve29("unauthenticated");
|
|
921
921
|
}, 5e3);
|
|
922
922
|
child.stdout?.on("data", (chunk) => {
|
|
923
923
|
stdout += chunk.toString();
|
|
@@ -928,14 +928,14 @@ async function checkAgentAuth(agent) {
|
|
|
928
928
|
done = true;
|
|
929
929
|
clearTimeout(timer);
|
|
930
930
|
if (code !== 0) {
|
|
931
|
-
|
|
931
|
+
resolve29("unauthenticated");
|
|
932
932
|
return;
|
|
933
933
|
}
|
|
934
934
|
try {
|
|
935
935
|
const status = JSON.parse(stdout);
|
|
936
|
-
|
|
936
|
+
resolve29(status.loggedIn ? "ok" : "unauthenticated");
|
|
937
937
|
} catch {
|
|
938
|
-
|
|
938
|
+
resolve29("unauthenticated");
|
|
939
939
|
}
|
|
940
940
|
});
|
|
941
941
|
});
|
|
@@ -945,9 +945,9 @@ async function binaryIsOnPath(binary) {
|
|
|
945
945
|
const fs = await import("node:fs/promises");
|
|
946
946
|
return fs.access(binary).then(() => true, () => false);
|
|
947
947
|
}
|
|
948
|
-
return new Promise((
|
|
948
|
+
return new Promise((resolve29) => {
|
|
949
949
|
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
950
|
-
child.on("close", (code) =>
|
|
950
|
+
child.on("close", (code) => resolve29(code === 0));
|
|
951
951
|
});
|
|
952
952
|
}
|
|
953
953
|
var init_check_agent_auth = __esm({
|
|
@@ -1584,7 +1584,8 @@ var init_infer_fence_lang = __esm({
|
|
|
1584
1584
|
sass: "scss",
|
|
1585
1585
|
css: "css",
|
|
1586
1586
|
json: "json",
|
|
1587
|
-
json5: "json"
|
|
1587
|
+
json5: "json",
|
|
1588
|
+
html: "html"
|
|
1588
1589
|
};
|
|
1589
1590
|
}
|
|
1590
1591
|
});
|
|
@@ -2083,22 +2084,22 @@ var init_cache_keys = __esm({
|
|
|
2083
2084
|
|
|
2084
2085
|
// packages/experience-design-system-types/dist/src/config/index.js
|
|
2085
2086
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
2086
|
-
import { mkdir as mkdir6, readFile as
|
|
2087
|
+
import { mkdir as mkdir6, readFile as readFile20, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
2087
2088
|
import { homedir as homedir3 } from "node:os";
|
|
2088
|
-
import { dirname as
|
|
2089
|
+
import { dirname as dirname14, join as join17 } from "node:path";
|
|
2089
2090
|
function configRoot2() {
|
|
2090
2091
|
return process.env["EDS_HOME"] || join17(homedir3(), ".contentful", "experience-design-system-cli");
|
|
2091
2092
|
}
|
|
2092
2093
|
async function readSettings2() {
|
|
2093
2094
|
try {
|
|
2094
|
-
return JSON.parse(await
|
|
2095
|
+
return JSON.parse(await readFile20(configFilePath2(), "utf8"));
|
|
2095
2096
|
} catch {
|
|
2096
2097
|
return {};
|
|
2097
2098
|
}
|
|
2098
2099
|
}
|
|
2099
2100
|
async function writeSettings2(settings) {
|
|
2100
2101
|
const path5 = configFilePath2();
|
|
2101
|
-
await mkdir6(
|
|
2102
|
+
await mkdir6(dirname14(path5), { recursive: true });
|
|
2102
2103
|
const tmp = `${path5}.${process.pid}.${randomBytes4(4).toString("hex")}.tmp`;
|
|
2103
2104
|
await writeFile6(tmp, `${JSON.stringify(settings, null, 2)}
|
|
2104
2105
|
`, { mode: 384 });
|
|
@@ -2142,7 +2143,7 @@ var init_debug_mode_store = __esm({
|
|
|
2142
2143
|
|
|
2143
2144
|
// packages/experience-design-system-cli/src/tui/debug-prune.ts
|
|
2144
2145
|
import { readdir as readdir3, rm, rmdir, stat as stat5 } from "node:fs/promises";
|
|
2145
|
-
import { dirname as
|
|
2146
|
+
import { dirname as dirname17, join as join24 } from "node:path";
|
|
2146
2147
|
async function logFilesIn(dir) {
|
|
2147
2148
|
const entries = await readdir3(dir, { withFileTypes: true });
|
|
2148
2149
|
const nested = await Promise.all(
|
|
@@ -2165,7 +2166,7 @@ async function removeEmptyFolders(from, stop) {
|
|
|
2165
2166
|
}
|
|
2166
2167
|
removed += 1;
|
|
2167
2168
|
if (dir === stop) return removed;
|
|
2168
|
-
dir =
|
|
2169
|
+
dir = dirname17(dir);
|
|
2169
2170
|
}
|
|
2170
2171
|
}
|
|
2171
2172
|
async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
@@ -2181,7 +2182,7 @@ async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
|
2181
2182
|
if ((await stat5(file)).mtimeMs >= cutoff) continue;
|
|
2182
2183
|
await rm(file);
|
|
2183
2184
|
result.logs += 1;
|
|
2184
|
-
result.folders += await removeEmptyFolders(
|
|
2185
|
+
result.folders += await removeEmptyFolders(dirname17(file), join24(contentfulDir, session));
|
|
2185
2186
|
} catch {
|
|
2186
2187
|
}
|
|
2187
2188
|
}
|
|
@@ -2211,7 +2212,7 @@ __export(debug_store_exports, {
|
|
|
2211
2212
|
});
|
|
2212
2213
|
import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
|
|
2213
2214
|
import { existsSync as existsSync9, readdirSync as readdirSync4 } from "node:fs";
|
|
2214
|
-
import { join as join25, resolve as
|
|
2215
|
+
import { join as join25, resolve as resolve27 } from "node:path";
|
|
2215
2216
|
function generateRunId() {
|
|
2216
2217
|
const now = /* @__PURE__ */ new Date();
|
|
2217
2218
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -2227,7 +2228,7 @@ function slugify(value) {
|
|
|
2227
2228
|
async function readBaseDir() {
|
|
2228
2229
|
try {
|
|
2229
2230
|
const dir = (await readSettings2())["contentfulBaseDir"];
|
|
2230
|
-
return typeof dir === "string" && dir !== "" ?
|
|
2231
|
+
return typeof dir === "string" && dir !== "" ? resolve27(dir) : void 0;
|
|
2231
2232
|
} catch {
|
|
2232
2233
|
return void 0;
|
|
2233
2234
|
}
|
|
@@ -2256,7 +2257,7 @@ function currentSessionDir() {
|
|
|
2256
2257
|
async function startDebugSessionIn(base, { replace = false } = {}) {
|
|
2257
2258
|
try {
|
|
2258
2259
|
if (!await isDebugModeEnabled()) return;
|
|
2259
|
-
await mkdir9(join25(startSession(
|
|
2260
|
+
await mkdir9(join25(startSession(resolve27(base), { replace }), "debug"), { recursive: true });
|
|
2260
2261
|
} catch {
|
|
2261
2262
|
}
|
|
2262
2263
|
}
|
|
@@ -2270,7 +2271,7 @@ function nextImportRunDir(session) {
|
|
|
2270
2271
|
}
|
|
2271
2272
|
async function startImportRun(projectPath) {
|
|
2272
2273
|
await startDebugSessionIn(projectPath);
|
|
2273
|
-
if (!sessionDir) return join25(
|
|
2274
|
+
if (!sessionDir) return join25(resolve27(projectPath), ".contentful");
|
|
2274
2275
|
const dir = nextImportRunDir(sessionDir);
|
|
2275
2276
|
await mkdir9(dir, { recursive: true });
|
|
2276
2277
|
return dir;
|
|
@@ -11588,6 +11589,650 @@ function mergeSlots2(fromSnippetProps, fromTemplate) {
|
|
|
11588
11589
|
return { slots: [...byName.values()], mixedWarning: mixed };
|
|
11589
11590
|
}
|
|
11590
11591
|
|
|
11592
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
|
|
11593
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
11594
|
+
import { ModuleKind as ModuleKind2, Project as Project7, ScriptTarget as ScriptTarget2 } from "ts-morph";
|
|
11595
|
+
|
|
11596
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js
|
|
11597
|
+
import { Node as Node10 } from "ts-morph";
|
|
11598
|
+
function findComponentDecorator(cls) {
|
|
11599
|
+
const decorator = cls.getDecorator("Component");
|
|
11600
|
+
if (!decorator)
|
|
11601
|
+
return null;
|
|
11602
|
+
const [arg] = decorator.getArguments();
|
|
11603
|
+
if (!arg || !Node10.isObjectLiteralExpression(arg))
|
|
11604
|
+
return null;
|
|
11605
|
+
return arg;
|
|
11606
|
+
}
|
|
11607
|
+
function hasComponentDecorator(cls) {
|
|
11608
|
+
return cls.getDecorator("Component") !== void 0;
|
|
11609
|
+
}
|
|
11610
|
+
|
|
11611
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-decorator-input.js
|
|
11612
|
+
import { Node as Node12 } from "ts-morph";
|
|
11613
|
+
|
|
11614
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/resolve-prop-type.js
|
|
11615
|
+
import { Node as Node11 } from "ts-morph";
|
|
11616
|
+
function resolvePropType(typeNode) {
|
|
11617
|
+
if (!typeNode) {
|
|
11618
|
+
return { text: "any", allowedValues: null, isTemplateRef: false };
|
|
11619
|
+
}
|
|
11620
|
+
const text = typeNode.getText();
|
|
11621
|
+
const members = extractStringLiteralUnion(typeNode);
|
|
11622
|
+
const isTemplateRef = containsTemplateRef(typeNode);
|
|
11623
|
+
return {
|
|
11624
|
+
text,
|
|
11625
|
+
allowedValues: members.length > 0 ? members : null,
|
|
11626
|
+
isTemplateRef
|
|
11627
|
+
};
|
|
11628
|
+
}
|
|
11629
|
+
function extractStringLiteralUnion(typeNode) {
|
|
11630
|
+
if (Node11.isLiteralTypeNode(typeNode)) {
|
|
11631
|
+
const lit = typeNode.getLiteral();
|
|
11632
|
+
if (Node11.isStringLiteral(lit) || Node11.isNoSubstitutionTemplateLiteral(lit)) {
|
|
11633
|
+
return [lit.getLiteralText()];
|
|
11634
|
+
}
|
|
11635
|
+
return [];
|
|
11636
|
+
}
|
|
11637
|
+
if (Node11.isUnionTypeNode(typeNode)) {
|
|
11638
|
+
const out = [];
|
|
11639
|
+
for (const member of typeNode.getTypeNodes()) {
|
|
11640
|
+
const sub = extractStringLiteralUnion(member);
|
|
11641
|
+
if (sub.length === 0 && !isNullOrUndefinedLiteral(member)) {
|
|
11642
|
+
return [];
|
|
11643
|
+
}
|
|
11644
|
+
out.push(...sub);
|
|
11645
|
+
}
|
|
11646
|
+
return out;
|
|
11647
|
+
}
|
|
11648
|
+
return [];
|
|
11649
|
+
}
|
|
11650
|
+
function isNullOrUndefinedLiteral(typeNode) {
|
|
11651
|
+
if (Node11.isLiteralTypeNode(typeNode)) {
|
|
11652
|
+
const lit = typeNode.getLiteral();
|
|
11653
|
+
if (Node11.isNullLiteral(lit))
|
|
11654
|
+
return true;
|
|
11655
|
+
}
|
|
11656
|
+
const t = typeNode.getText();
|
|
11657
|
+
return t === "null" || t === "undefined";
|
|
11658
|
+
}
|
|
11659
|
+
function containsTemplateRef(typeNode) {
|
|
11660
|
+
const text = typeNode.getText();
|
|
11661
|
+
return /\bTemplateRef\b/.test(text);
|
|
11662
|
+
}
|
|
11663
|
+
|
|
11664
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-decorator-input.js
|
|
11665
|
+
function extractDecoratorInput(field) {
|
|
11666
|
+
const decorator = field.getDecorator("Input");
|
|
11667
|
+
if (!decorator)
|
|
11668
|
+
return null;
|
|
11669
|
+
const fieldName = field.getName();
|
|
11670
|
+
const args = decorator.getArguments();
|
|
11671
|
+
let alias = null;
|
|
11672
|
+
let required = false;
|
|
11673
|
+
let transformIsBoolean = false;
|
|
11674
|
+
let transformIsNumber = false;
|
|
11675
|
+
if (args.length === 1) {
|
|
11676
|
+
const arg = args[0];
|
|
11677
|
+
if (Node12.isStringLiteral(arg) || Node12.isNoSubstitutionTemplateLiteral(arg)) {
|
|
11678
|
+
alias = arg.getLiteralText();
|
|
11679
|
+
} else if (Node12.isObjectLiteralExpression(arg)) {
|
|
11680
|
+
const aliasProp = arg.getProperty("alias");
|
|
11681
|
+
if (aliasProp && Node12.isPropertyAssignment(aliasProp)) {
|
|
11682
|
+
const init = aliasProp.getInitializer();
|
|
11683
|
+
if (init && (Node12.isStringLiteral(init) || Node12.isNoSubstitutionTemplateLiteral(init))) {
|
|
11684
|
+
alias = init.getLiteralText();
|
|
11685
|
+
}
|
|
11686
|
+
}
|
|
11687
|
+
const requiredProp = arg.getProperty("required");
|
|
11688
|
+
if (requiredProp && Node12.isPropertyAssignment(requiredProp)) {
|
|
11689
|
+
const init = requiredProp.getInitializer();
|
|
11690
|
+
if (init?.getText() === "true")
|
|
11691
|
+
required = true;
|
|
11692
|
+
}
|
|
11693
|
+
const transformProp = arg.getProperty("transform");
|
|
11694
|
+
if (transformProp && Node12.isPropertyAssignment(transformProp)) {
|
|
11695
|
+
const transformText = transformProp.getInitializer()?.getText() ?? "";
|
|
11696
|
+
if (/\bbooleanAttribute\b/.test(transformText))
|
|
11697
|
+
transformIsBoolean = true;
|
|
11698
|
+
if (/\bnumberAttribute\b/.test(transformText))
|
|
11699
|
+
transformIsNumber = true;
|
|
11700
|
+
}
|
|
11701
|
+
}
|
|
11702
|
+
}
|
|
11703
|
+
let typeNode;
|
|
11704
|
+
let defaultValue;
|
|
11705
|
+
if (Node12.isSetAccessorDeclaration(field)) {
|
|
11706
|
+
const param = field.getParameters()[0];
|
|
11707
|
+
typeNode = param?.getTypeNode();
|
|
11708
|
+
} else if (Node12.isGetAccessorDeclaration(field)) {
|
|
11709
|
+
const parent = field.getParent();
|
|
11710
|
+
const companionSetter = parent && Node12.isClassDeclaration(parent) ? parent.getSetAccessor(fieldName) : void 0;
|
|
11711
|
+
if (companionSetter) {
|
|
11712
|
+
typeNode = companionSetter.getParameters()[0]?.getTypeNode();
|
|
11713
|
+
}
|
|
11714
|
+
if (!typeNode)
|
|
11715
|
+
typeNode = field.getReturnTypeNode();
|
|
11716
|
+
} else {
|
|
11717
|
+
typeNode = field.getTypeNode();
|
|
11718
|
+
const initializer = field.getInitializer();
|
|
11719
|
+
if (initializer)
|
|
11720
|
+
defaultValue = initializer.getText();
|
|
11721
|
+
}
|
|
11722
|
+
const resolved = resolvePropType(typeNode);
|
|
11723
|
+
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
11724
|
+
const name = alias ?? fieldName;
|
|
11725
|
+
const prop = {
|
|
11726
|
+
name,
|
|
11727
|
+
type: typeText,
|
|
11728
|
+
required,
|
|
11729
|
+
sourceStartLine: field.getStartLineNumber(),
|
|
11730
|
+
sourceEndLine: field.getEndLineNumber()
|
|
11731
|
+
};
|
|
11732
|
+
if (defaultValue !== void 0)
|
|
11733
|
+
prop.defaultValue = defaultValue;
|
|
11734
|
+
if (resolved.allowedValues && !transformIsBoolean && !transformIsNumber) {
|
|
11735
|
+
prop.allowedValues = resolved.allowedValues;
|
|
11736
|
+
}
|
|
11737
|
+
return prop;
|
|
11738
|
+
}
|
|
11739
|
+
|
|
11740
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-signal-input.js
|
|
11741
|
+
import { Node as Node13 } from "ts-morph";
|
|
11742
|
+
function extractSignalInput(field) {
|
|
11743
|
+
const init = field.getInitializer();
|
|
11744
|
+
if (!init || !Node13.isCallExpression(init))
|
|
11745
|
+
return null;
|
|
11746
|
+
const callee = init.getExpression();
|
|
11747
|
+
let required = false;
|
|
11748
|
+
if (Node13.isIdentifier(callee)) {
|
|
11749
|
+
if (callee.getText() !== "input")
|
|
11750
|
+
return null;
|
|
11751
|
+
} else if (Node13.isPropertyAccessExpression(callee)) {
|
|
11752
|
+
const left = callee.getExpression();
|
|
11753
|
+
const right = callee.getName();
|
|
11754
|
+
if (!Node13.isIdentifier(left) || left.getText() !== "input" || right !== "required")
|
|
11755
|
+
return null;
|
|
11756
|
+
required = true;
|
|
11757
|
+
} else {
|
|
11758
|
+
return null;
|
|
11759
|
+
}
|
|
11760
|
+
const fieldName = field.getName();
|
|
11761
|
+
const args = init.getArguments();
|
|
11762
|
+
let defaultValue;
|
|
11763
|
+
let configArg;
|
|
11764
|
+
if (required) {
|
|
11765
|
+
configArg = args[0];
|
|
11766
|
+
} else {
|
|
11767
|
+
const first = args[0];
|
|
11768
|
+
if (first) {
|
|
11769
|
+
defaultValue = first.getText();
|
|
11770
|
+
configArg = args[1];
|
|
11771
|
+
}
|
|
11772
|
+
}
|
|
11773
|
+
let alias = null;
|
|
11774
|
+
let transformIsBoolean = false;
|
|
11775
|
+
let transformIsNumber = false;
|
|
11776
|
+
if (configArg && Node13.isObjectLiteralExpression(configArg)) {
|
|
11777
|
+
const aliasProp = configArg.getProperty("alias");
|
|
11778
|
+
if (aliasProp && Node13.isPropertyAssignment(aliasProp)) {
|
|
11779
|
+
const aliasInit = aliasProp.getInitializer();
|
|
11780
|
+
if (aliasInit && (Node13.isStringLiteral(aliasInit) || Node13.isNoSubstitutionTemplateLiteral(aliasInit))) {
|
|
11781
|
+
alias = aliasInit.getLiteralText();
|
|
11782
|
+
}
|
|
11783
|
+
}
|
|
11784
|
+
const transformProp = configArg.getProperty("transform");
|
|
11785
|
+
if (transformProp && Node13.isPropertyAssignment(transformProp)) {
|
|
11786
|
+
const transformText = transformProp.getInitializer()?.getText() ?? "";
|
|
11787
|
+
if (/\bbooleanAttribute\b/.test(transformText))
|
|
11788
|
+
transformIsBoolean = true;
|
|
11789
|
+
if (/\bnumberAttribute\b/.test(transformText))
|
|
11790
|
+
transformIsNumber = true;
|
|
11791
|
+
}
|
|
11792
|
+
}
|
|
11793
|
+
const typeArg = init.getTypeArguments()[0];
|
|
11794
|
+
const resolved = resolvePropType(typeArg);
|
|
11795
|
+
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
11796
|
+
const name = alias ?? fieldName;
|
|
11797
|
+
const prop = {
|
|
11798
|
+
name,
|
|
11799
|
+
type: typeText,
|
|
11800
|
+
required,
|
|
11801
|
+
sourceStartLine: field.getStartLineNumber(),
|
|
11802
|
+
sourceEndLine: field.getEndLineNumber()
|
|
11803
|
+
};
|
|
11804
|
+
if (defaultValue !== void 0)
|
|
11805
|
+
prop.defaultValue = defaultValue;
|
|
11806
|
+
if (resolved.allowedValues && !transformIsBoolean && !transformIsNumber) {
|
|
11807
|
+
prop.allowedValues = resolved.allowedValues;
|
|
11808
|
+
}
|
|
11809
|
+
return prop;
|
|
11810
|
+
}
|
|
11811
|
+
|
|
11812
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/parse-inputs-array-entry.js
|
|
11813
|
+
function parseInputsArrayEntry(entry) {
|
|
11814
|
+
const trimmed = entry.trim();
|
|
11815
|
+
if (!trimmed)
|
|
11816
|
+
return null;
|
|
11817
|
+
const parts = trimmed.split(":");
|
|
11818
|
+
if (parts.length === 1) {
|
|
11819
|
+
return { fieldName: parts[0].trim(), alias: null };
|
|
11820
|
+
}
|
|
11821
|
+
if (parts.length === 2) {
|
|
11822
|
+
const field = parts[0].trim();
|
|
11823
|
+
const alias = parts[1].trim();
|
|
11824
|
+
if (!field || !alias)
|
|
11825
|
+
return null;
|
|
11826
|
+
return { fieldName: field, alias };
|
|
11827
|
+
}
|
|
11828
|
+
return null;
|
|
11829
|
+
}
|
|
11830
|
+
|
|
11831
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-props.js
|
|
11832
|
+
function extractProps2(cls, meta) {
|
|
11833
|
+
const byName = /* @__PURE__ */ new Map();
|
|
11834
|
+
for (const field of cls.getProperties()) {
|
|
11835
|
+
const prop = extractDecoratorInput(field);
|
|
11836
|
+
if (prop && !byName.has(prop.name))
|
|
11837
|
+
byName.set(prop.name, prop);
|
|
11838
|
+
}
|
|
11839
|
+
for (const setter of cls.getSetAccessors()) {
|
|
11840
|
+
const prop = extractDecoratorInput(setter);
|
|
11841
|
+
if (prop && !byName.has(prop.name))
|
|
11842
|
+
byName.set(prop.name, prop);
|
|
11843
|
+
}
|
|
11844
|
+
for (const getter of cls.getGetAccessors()) {
|
|
11845
|
+
const prop = extractDecoratorInput(getter);
|
|
11846
|
+
if (prop && !byName.has(prop.name))
|
|
11847
|
+
byName.set(prop.name, prop);
|
|
11848
|
+
}
|
|
11849
|
+
for (const field of cls.getProperties()) {
|
|
11850
|
+
const prop = extractSignalInput(field);
|
|
11851
|
+
if (prop && !byName.has(prop.name))
|
|
11852
|
+
byName.set(prop.name, prop);
|
|
11853
|
+
}
|
|
11854
|
+
for (const entry of meta.inputsArray) {
|
|
11855
|
+
const parsed = parseInputsArrayEntry(entry);
|
|
11856
|
+
if (!parsed)
|
|
11857
|
+
continue;
|
|
11858
|
+
const name = parsed.alias ?? parsed.fieldName;
|
|
11859
|
+
if (byName.has(name))
|
|
11860
|
+
continue;
|
|
11861
|
+
byName.set(name, { name, type: "any", required: false });
|
|
11862
|
+
}
|
|
11863
|
+
return [...byName.values()];
|
|
11864
|
+
}
|
|
11865
|
+
|
|
11866
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-component-metadata.js
|
|
11867
|
+
import { dirname as dirname10, resolve as resolve12 } from "node:path";
|
|
11868
|
+
|
|
11869
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/normalize-component-name.js
|
|
11870
|
+
var SUFFIXES = ["Component", "Directive"];
|
|
11871
|
+
function normalizeComponentName2(className) {
|
|
11872
|
+
for (const suffix of SUFFIXES) {
|
|
11873
|
+
if (className.endsWith(suffix) && className.length > suffix.length) {
|
|
11874
|
+
return className.slice(0, -suffix.length);
|
|
11875
|
+
}
|
|
11876
|
+
}
|
|
11877
|
+
return className;
|
|
11878
|
+
}
|
|
11879
|
+
|
|
11880
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-decorator-string.js
|
|
11881
|
+
import { Node as Node14 } from "ts-morph";
|
|
11882
|
+
function readDecoratorString(obj, propName) {
|
|
11883
|
+
const prop = obj.getProperty(propName);
|
|
11884
|
+
if (!prop || !Node14.isPropertyAssignment(prop))
|
|
11885
|
+
return null;
|
|
11886
|
+
const init = prop.getInitializer();
|
|
11887
|
+
if (!init)
|
|
11888
|
+
return null;
|
|
11889
|
+
if (Node14.isStringLiteral(init) || Node14.isNoSubstitutionTemplateLiteral(init)) {
|
|
11890
|
+
return init.getLiteralText();
|
|
11891
|
+
}
|
|
11892
|
+
return null;
|
|
11893
|
+
}
|
|
11894
|
+
function readDecoratorStringArray(obj, propName) {
|
|
11895
|
+
const prop = obj.getProperty(propName);
|
|
11896
|
+
if (!prop || !Node14.isPropertyAssignment(prop))
|
|
11897
|
+
return [];
|
|
11898
|
+
const init = prop.getInitializer();
|
|
11899
|
+
if (!init || !Node14.isArrayLiteralExpression(init))
|
|
11900
|
+
return [];
|
|
11901
|
+
const out = [];
|
|
11902
|
+
for (const el of init.getElements()) {
|
|
11903
|
+
if (Node14.isStringLiteral(el) || Node14.isNoSubstitutionTemplateLiteral(el)) {
|
|
11904
|
+
out.push(el.getLiteralText());
|
|
11905
|
+
}
|
|
11906
|
+
}
|
|
11907
|
+
return out;
|
|
11908
|
+
}
|
|
11909
|
+
|
|
11910
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-component-metadata.js
|
|
11911
|
+
function readComponentMetadata(cls, sourceFilePath) {
|
|
11912
|
+
const obj = findComponentDecorator(cls);
|
|
11913
|
+
if (!obj)
|
|
11914
|
+
return null;
|
|
11915
|
+
const className = cls.getName();
|
|
11916
|
+
if (!className)
|
|
11917
|
+
return null;
|
|
11918
|
+
const rawSelector = readDecoratorString(obj, "selector");
|
|
11919
|
+
const inlineTemplate = readDecoratorString(obj, "template");
|
|
11920
|
+
const templateUrlRel = readDecoratorString(obj, "templateUrl");
|
|
11921
|
+
const inputsArray = readDecoratorStringArray(obj, "inputs");
|
|
11922
|
+
const templatePath = templateUrlRel ? resolve12(dirname10(sourceFilePath), templateUrlRel) : null;
|
|
11923
|
+
const decorator = cls.getDecorator("Component");
|
|
11924
|
+
const decoratorLine = decorator?.getStartLineNumber() ?? cls.getStartLineNumber();
|
|
11925
|
+
return {
|
|
11926
|
+
className,
|
|
11927
|
+
normalizedName: normalizeComponentName2(className),
|
|
11928
|
+
rawSelector,
|
|
11929
|
+
inlineTemplate,
|
|
11930
|
+
templatePath,
|
|
11931
|
+
inputsArray,
|
|
11932
|
+
decoratorLine
|
|
11933
|
+
};
|
|
11934
|
+
}
|
|
11935
|
+
|
|
11936
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/parse-ng-content-elements.js
|
|
11937
|
+
function parseNgContentElements(templateHtml) {
|
|
11938
|
+
const out = [];
|
|
11939
|
+
const tagRe = /<ng-content\b([^>]*?)\/?>/gi;
|
|
11940
|
+
for (const match2 of templateHtml.matchAll(tagRe)) {
|
|
11941
|
+
const attrs = match2[1] ?? "";
|
|
11942
|
+
const selectMatch = attrs.match(/\bselect\s*=\s*(?:"([^"]*)"|'([^']*)')/);
|
|
11943
|
+
const rawSelect = selectMatch ? selectMatch[1] ?? selectMatch[2] ?? null : null;
|
|
11944
|
+
const sourceLine = countLines(templateHtml, match2.index ?? 0);
|
|
11945
|
+
out.push({ rawSelect, sourceLine });
|
|
11946
|
+
}
|
|
11947
|
+
return out;
|
|
11948
|
+
}
|
|
11949
|
+
function countLines(text, offset) {
|
|
11950
|
+
let line = 1;
|
|
11951
|
+
for (let i = 0; i < offset && i < text.length; i++) {
|
|
11952
|
+
if (text.charCodeAt(i) === 10)
|
|
11953
|
+
line++;
|
|
11954
|
+
}
|
|
11955
|
+
return line;
|
|
11956
|
+
}
|
|
11957
|
+
|
|
11958
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/resolve-template-source.js
|
|
11959
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
11960
|
+
async function resolveTemplateSource(meta) {
|
|
11961
|
+
if (meta.inlineTemplate !== null)
|
|
11962
|
+
return meta.inlineTemplate;
|
|
11963
|
+
if (meta.templatePath === null)
|
|
11964
|
+
return null;
|
|
11965
|
+
try {
|
|
11966
|
+
return await readFile7(meta.templatePath, "utf8");
|
|
11967
|
+
} catch {
|
|
11968
|
+
return null;
|
|
11969
|
+
}
|
|
11970
|
+
}
|
|
11971
|
+
|
|
11972
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/strip-library-prefix.js
|
|
11973
|
+
var KNOWN_PREFIXES = ["Mat", "Cdk", "Nz", "Cds", "Ibm", "Clr", "Hlm", "Brn", "Tui", "Nb", "Fd", "P", "Ng"];
|
|
11974
|
+
function stripLibraryPrefix(name) {
|
|
11975
|
+
for (const prefix of KNOWN_PREFIXES) {
|
|
11976
|
+
if (name.startsWith(prefix) && name.length > prefix.length) {
|
|
11977
|
+
const rest = name.slice(prefix.length);
|
|
11978
|
+
if (rest[0] && rest[0] === rest[0].toUpperCase()) {
|
|
11979
|
+
return rest;
|
|
11980
|
+
}
|
|
11981
|
+
}
|
|
11982
|
+
}
|
|
11983
|
+
return name;
|
|
11984
|
+
}
|
|
11985
|
+
|
|
11986
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/derive-slot-name.js
|
|
11987
|
+
function deriveSlotName(rawSelect, parentNormalizedName) {
|
|
11988
|
+
if (!rawSelect || rawSelect.trim() === "")
|
|
11989
|
+
return "children";
|
|
11990
|
+
if (rawSelect.includes(",")) {
|
|
11991
|
+
const first = rawSelect.split(",")[0].trim();
|
|
11992
|
+
return deriveSingleSelectorName(first, parentNormalizedName);
|
|
11993
|
+
}
|
|
11994
|
+
return deriveSingleSelectorName(rawSelect.trim(), parentNormalizedName);
|
|
11995
|
+
}
|
|
11996
|
+
function deriveSingleSelectorName(sel, parentNormalizedName) {
|
|
11997
|
+
const slotAttrMatch = sel.match(/^\[\s*slot\s*=\s*['"]?([^'"\]]+)['"]?\s*\]$/);
|
|
11998
|
+
if (slotAttrMatch)
|
|
11999
|
+
return slotAttrMatch[1].trim();
|
|
12000
|
+
if (sel.startsWith(".")) {
|
|
12001
|
+
const last = sel.slice(1).split("-").pop() ?? sel.slice(1);
|
|
12002
|
+
return kebabToCamel2(last);
|
|
12003
|
+
}
|
|
12004
|
+
const attrMatch = sel.match(/^\[([^=\]]+)\]$/);
|
|
12005
|
+
if (attrMatch) {
|
|
12006
|
+
const attr = attrMatch[1].trim();
|
|
12007
|
+
const stripped = tryStripSubComponentOrLibraryPrefix(attr, parentNormalizedName);
|
|
12008
|
+
return stripped || kebabToCamel2(attr);
|
|
12009
|
+
}
|
|
12010
|
+
const elMatch = sel.match(/^([a-zA-Z][a-zA-Z0-9-]*)/);
|
|
12011
|
+
if (elMatch) {
|
|
12012
|
+
const tag = elMatch[1];
|
|
12013
|
+
const stripped = tryStripSubComponentOrLibraryPrefix(tag, parentNormalizedName);
|
|
12014
|
+
return stripped || kebabToCamel2(tag);
|
|
12015
|
+
}
|
|
12016
|
+
return sel.replace(/\s+/g, "");
|
|
12017
|
+
}
|
|
12018
|
+
function tryStripSubComponentOrLibraryPrefix(ident, parentNormalizedName) {
|
|
12019
|
+
const parentKebab = pascalToKebab(parentNormalizedName);
|
|
12020
|
+
if (parentKebab && ident.startsWith(`${parentKebab}-`)) {
|
|
12021
|
+
return kebabToCamel2(ident.slice(parentKebab.length + 1));
|
|
12022
|
+
}
|
|
12023
|
+
const asPascal = kebabToPascal2(ident);
|
|
12024
|
+
const stripped = stripLibraryPrefix(asPascal);
|
|
12025
|
+
if (stripped !== asPascal) {
|
|
12026
|
+
return stripped.charAt(0).toLowerCase() + stripped.slice(1);
|
|
12027
|
+
}
|
|
12028
|
+
return null;
|
|
12029
|
+
}
|
|
12030
|
+
function kebabToCamel2(s) {
|
|
12031
|
+
return s.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase());
|
|
12032
|
+
}
|
|
12033
|
+
function kebabToPascal2(s) {
|
|
12034
|
+
const camel = kebabToCamel2(s);
|
|
12035
|
+
return camel.charAt(0).toUpperCase() + camel.slice(1);
|
|
12036
|
+
}
|
|
12037
|
+
function pascalToKebab(s) {
|
|
12038
|
+
return s.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
12039
|
+
}
|
|
12040
|
+
|
|
12041
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-content-child-queries.js
|
|
12042
|
+
import { Node as Node15 } from "ts-morph";
|
|
12043
|
+
function extractContentChildQueries(cls) {
|
|
12044
|
+
const out = [];
|
|
12045
|
+
for (const field of cls.getProperties()) {
|
|
12046
|
+
const fieldName = field.getName();
|
|
12047
|
+
const init = field.getInitializer();
|
|
12048
|
+
if (init && Node15.isCallExpression(init)) {
|
|
12049
|
+
const callee = init.getExpression();
|
|
12050
|
+
if (Node15.isIdentifier(callee)) {
|
|
12051
|
+
const name = callee.getText();
|
|
12052
|
+
if (name === "contentChild" || name === "contentChildren") {
|
|
12053
|
+
const first = init.getArguments()[0];
|
|
12054
|
+
const allowed = resolveClassIdentifierArg(first);
|
|
12055
|
+
out.push(buildSlot(fieldName, allowed));
|
|
12056
|
+
continue;
|
|
12057
|
+
}
|
|
12058
|
+
}
|
|
12059
|
+
}
|
|
12060
|
+
for (const decName of ["ContentChild", "ContentChildren"]) {
|
|
12061
|
+
const dec = field.getDecorator(decName);
|
|
12062
|
+
if (dec) {
|
|
12063
|
+
const first = dec.getArguments()[0];
|
|
12064
|
+
const allowed = resolveClassIdentifierArg(first);
|
|
12065
|
+
out.push(buildSlot(fieldName, allowed));
|
|
12066
|
+
break;
|
|
12067
|
+
}
|
|
12068
|
+
}
|
|
12069
|
+
}
|
|
12070
|
+
return out;
|
|
12071
|
+
}
|
|
12072
|
+
function resolveClassIdentifierArg(arg) {
|
|
12073
|
+
if (!arg)
|
|
12074
|
+
return [];
|
|
12075
|
+
if (Node15.isStringLiteral(arg) || Node15.isNoSubstitutionTemplateLiteral(arg))
|
|
12076
|
+
return [];
|
|
12077
|
+
if (Node15.isIdentifier(arg))
|
|
12078
|
+
return [arg.getText()];
|
|
12079
|
+
return [];
|
|
12080
|
+
}
|
|
12081
|
+
function buildSlot(name, allowed) {
|
|
12082
|
+
const slot = {
|
|
12083
|
+
name,
|
|
12084
|
+
isDefault: false
|
|
12085
|
+
};
|
|
12086
|
+
if (allowed.length > 0)
|
|
12087
|
+
slot.allowedComponents = allowed;
|
|
12088
|
+
return slot;
|
|
12089
|
+
}
|
|
12090
|
+
|
|
12091
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-template-ref-slots.js
|
|
12092
|
+
function extractTemplateRefSlots(props) {
|
|
12093
|
+
const nextProps = [];
|
|
12094
|
+
const slots = [];
|
|
12095
|
+
for (const prop of props) {
|
|
12096
|
+
const type = prop.type;
|
|
12097
|
+
const hasTemplateRef = /\bTemplateRef\b/.test(type);
|
|
12098
|
+
if (!hasTemplateRef) {
|
|
12099
|
+
nextProps.push(prop);
|
|
12100
|
+
continue;
|
|
12101
|
+
}
|
|
12102
|
+
const isPureTemplateRef = /^\s*TemplateRef<[^>]*>\s*(\|\s*(null|undefined)\s*)*$/.test(type);
|
|
12103
|
+
if (!isPureTemplateRef) {
|
|
12104
|
+
nextProps.push(prop);
|
|
12105
|
+
}
|
|
12106
|
+
slots.push({ name: prop.name, isDefault: false });
|
|
12107
|
+
}
|
|
12108
|
+
return { props: nextProps, slots };
|
|
12109
|
+
}
|
|
12110
|
+
|
|
12111
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-slots.js
|
|
12112
|
+
async function extractSlots3(cls, meta, props) {
|
|
12113
|
+
const byName = /* @__PURE__ */ new Map();
|
|
12114
|
+
const template = await resolveTemplateSource(meta);
|
|
12115
|
+
if (template) {
|
|
12116
|
+
for (const el of parseNgContentElements(template)) {
|
|
12117
|
+
const name = deriveSlotName(el.rawSelect, meta.normalizedName);
|
|
12118
|
+
if (byName.has(name))
|
|
12119
|
+
continue;
|
|
12120
|
+
byName.set(name, {
|
|
12121
|
+
name,
|
|
12122
|
+
isDefault: el.rawSelect === null
|
|
12123
|
+
});
|
|
12124
|
+
}
|
|
12125
|
+
}
|
|
12126
|
+
for (const slot of extractContentChildQueries(cls)) {
|
|
12127
|
+
if (!byName.has(slot.name))
|
|
12128
|
+
byName.set(slot.name, slot);
|
|
12129
|
+
}
|
|
12130
|
+
const split = extractTemplateRefSlots(props);
|
|
12131
|
+
for (const slot of split.slots) {
|
|
12132
|
+
if (!byName.has(slot.name))
|
|
12133
|
+
byName.set(slot.name, slot);
|
|
12134
|
+
}
|
|
12135
|
+
return { props: split.props, slots: [...byName.values()] };
|
|
12136
|
+
}
|
|
12137
|
+
|
|
12138
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
|
|
12139
|
+
async function extractAngularComponents(filePaths, onProgress, _opts) {
|
|
12140
|
+
const components = [];
|
|
12141
|
+
const warnings = [];
|
|
12142
|
+
let filesProcessed = 0;
|
|
12143
|
+
const project = new Project7({
|
|
12144
|
+
useInMemoryFileSystem: false,
|
|
12145
|
+
skipAddingFilesFromTsConfig: true,
|
|
12146
|
+
compilerOptions: {
|
|
12147
|
+
target: ScriptTarget2.ES2022,
|
|
12148
|
+
module: ModuleKind2.ESNext,
|
|
12149
|
+
experimentalDecorators: true,
|
|
12150
|
+
emitDecoratorMetadata: false,
|
|
12151
|
+
allowJs: false
|
|
12152
|
+
}
|
|
12153
|
+
});
|
|
12154
|
+
for (const filePath of filePaths) {
|
|
12155
|
+
try {
|
|
12156
|
+
const source = await readFile8(filePath, "utf8");
|
|
12157
|
+
const sourceFile = project.createSourceFile(filePath, source, { overwrite: true });
|
|
12158
|
+
for (const cls of sourceFile.getClasses()) {
|
|
12159
|
+
if (!hasComponentDecorator(cls))
|
|
12160
|
+
continue;
|
|
12161
|
+
if (!findComponentDecorator(cls)) {
|
|
12162
|
+
warnings.push(`${filePath}: ${cls.getName() ?? "<anonymous>"} has @Component with a non-literal argument; skipped.`);
|
|
12163
|
+
continue;
|
|
12164
|
+
}
|
|
12165
|
+
const meta = readComponentMetadata(cls, filePath);
|
|
12166
|
+
if (!meta)
|
|
12167
|
+
continue;
|
|
12168
|
+
const propsOnly = extractProps2(cls, meta);
|
|
12169
|
+
const { props, slots } = await extractSlots3(cls, meta, propsOnly);
|
|
12170
|
+
const partial = {
|
|
12171
|
+
name: meta.className,
|
|
12172
|
+
source: filePath,
|
|
12173
|
+
framework: "angular",
|
|
12174
|
+
props,
|
|
12175
|
+
slots: normalizeSlots(slots),
|
|
12176
|
+
sourcePath: filePath
|
|
12177
|
+
};
|
|
12178
|
+
const score = computeExtractionScore(partial);
|
|
12179
|
+
partial.extractionConfidence = score.confidence;
|
|
12180
|
+
partial.reviewReasons = score.reasons;
|
|
12181
|
+
partial.needsReview = deriveNeedsReview(score.confidence);
|
|
12182
|
+
components.push(partial);
|
|
12183
|
+
}
|
|
12184
|
+
sourceFile.deleteImmediatelySync();
|
|
12185
|
+
} catch (err) {
|
|
12186
|
+
warnings.push(`${filePath}: Angular extractor failed \u2014 ${err instanceof Error ? err.message : String(err)}`);
|
|
12187
|
+
} finally {
|
|
12188
|
+
filesProcessed++;
|
|
12189
|
+
if (onProgress)
|
|
12190
|
+
onProgress({ filesProcessed, componentsFound: components.length });
|
|
12191
|
+
}
|
|
12192
|
+
}
|
|
12193
|
+
return {
|
|
12194
|
+
components: components.sort((a, b) => a.name.localeCompare(b.name)),
|
|
12195
|
+
warnings
|
|
12196
|
+
};
|
|
12197
|
+
}
|
|
12198
|
+
function normalizeSlots(slots) {
|
|
12199
|
+
let fallbackIndex = 0;
|
|
12200
|
+
return slots.map((slot) => {
|
|
12201
|
+
if (slot.name.trim())
|
|
12202
|
+
return slot;
|
|
12203
|
+
const name = fallbackIndex === 0 ? "children" : `slot_${fallbackIndex}`;
|
|
12204
|
+
fallbackIndex++;
|
|
12205
|
+
return { ...slot, name };
|
|
12206
|
+
});
|
|
12207
|
+
}
|
|
12208
|
+
|
|
12209
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/is-angular-source-file.js
|
|
12210
|
+
import { openSync, readSync, closeSync, statSync as statSync4 } from "node:fs";
|
|
12211
|
+
var HEAD_BYTES = 4 * 1024;
|
|
12212
|
+
var buffer = Buffer.alloc(HEAD_BYTES);
|
|
12213
|
+
function isAngularSourceFile(filePath) {
|
|
12214
|
+
if (!/\.[cm]?ts$/.test(filePath))
|
|
12215
|
+
return false;
|
|
12216
|
+
if (filePath.endsWith(".d.ts"))
|
|
12217
|
+
return false;
|
|
12218
|
+
try {
|
|
12219
|
+
const stats = statSync4(filePath);
|
|
12220
|
+
const toRead = Math.min(HEAD_BYTES, stats.size);
|
|
12221
|
+
if (toRead === 0)
|
|
12222
|
+
return false;
|
|
12223
|
+
const fd = openSync(filePath, "r");
|
|
12224
|
+
try {
|
|
12225
|
+
const bytesRead = readSync(fd, buffer, 0, toRead, 0);
|
|
12226
|
+
const head = buffer.subarray(0, bytesRead).toString("utf8");
|
|
12227
|
+
return head.includes("@angular/core");
|
|
12228
|
+
} finally {
|
|
12229
|
+
closeSync(fd);
|
|
12230
|
+
}
|
|
12231
|
+
} catch {
|
|
12232
|
+
return false;
|
|
12233
|
+
}
|
|
12234
|
+
}
|
|
12235
|
+
|
|
11591
12236
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/services/run-extraction-service.js
|
|
11592
12237
|
var extractors = [
|
|
11593
12238
|
{
|
|
@@ -11615,6 +12260,13 @@ var extractors = [
|
|
|
11615
12260
|
fileFilter: (f) => f.endsWith(".astro"),
|
|
11616
12261
|
extract: extractAstroComponents
|
|
11617
12262
|
},
|
|
12263
|
+
{
|
|
12264
|
+
// Must run BEFORE web-components (both claim bare .ts). The sniff reads
|
|
12265
|
+
// the file head looking for `@angular/core` so we only claim real Angular files.
|
|
12266
|
+
name: "angular",
|
|
12267
|
+
fileFilter: (f) => isAngularSourceFile(f),
|
|
12268
|
+
extract: extractAngularComponents
|
|
12269
|
+
},
|
|
11618
12270
|
{
|
|
11619
12271
|
name: "web-components",
|
|
11620
12272
|
fileFilter: (f) => /\.[jt]s$/.test(f) && !/\.[jt]sx$/.test(f) && !f.endsWith(".d.ts"),
|
|
@@ -12090,16 +12742,16 @@ function applyCompositionEdges(components, edges) {
|
|
|
12090
12742
|
|
|
12091
12743
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
|
|
12092
12744
|
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
12093
|
-
import { dirname as
|
|
12745
|
+
import { dirname as dirname11, join as join10, resolve as resolve13 } from "node:path";
|
|
12094
12746
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
12095
12747
|
function resolvePromptPath(fileName) {
|
|
12096
|
-
const thisDir =
|
|
12748
|
+
const thisDir = dirname11(fileURLToPath3(import.meta.url));
|
|
12097
12749
|
let dir = thisDir;
|
|
12098
12750
|
for (; ; ) {
|
|
12099
12751
|
const candidate = join10(dir, "prompts");
|
|
12100
12752
|
if (existsSync7(candidate))
|
|
12101
12753
|
return join10(candidate, fileName);
|
|
12102
|
-
const parent =
|
|
12754
|
+
const parent = resolve13(dir, "..");
|
|
12103
12755
|
if (parent === dir) {
|
|
12104
12756
|
throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
|
|
12105
12757
|
}
|
|
@@ -12247,8 +12899,8 @@ ${fileDigest}`);
|
|
|
12247
12899
|
}
|
|
12248
12900
|
|
|
12249
12901
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
|
|
12250
|
-
import { dirname as
|
|
12251
|
-
function
|
|
12902
|
+
import { dirname as dirname12 } from "node:path";
|
|
12903
|
+
function kebabToPascal3(name) {
|
|
12252
12904
|
return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
|
|
12253
12905
|
}
|
|
12254
12906
|
function collectManifestEdges(files, componentNames) {
|
|
@@ -12270,7 +12922,7 @@ function collectManifestEdges(files, componentNames) {
|
|
|
12270
12922
|
const rawParentName = typeof component === "object" && component !== null && typeof component.name === "string" ? component.name : void 0;
|
|
12271
12923
|
if (!rawParentName)
|
|
12272
12924
|
continue;
|
|
12273
|
-
const parent =
|
|
12925
|
+
const parent = kebabToPascal3(rawParentName);
|
|
12274
12926
|
if (!componentNames.has(parent))
|
|
12275
12927
|
continue;
|
|
12276
12928
|
const variantsMeta = root.variantsMeta;
|
|
@@ -12290,7 +12942,7 @@ function collectManifestEdges(files, componentNames) {
|
|
|
12290
12942
|
const rawChildName = value.name;
|
|
12291
12943
|
if (typeof rawChildName !== "string")
|
|
12292
12944
|
continue;
|
|
12293
|
-
const child =
|
|
12945
|
+
const child = kebabToPascal3(rawChildName);
|
|
12294
12946
|
if (!componentNames.has(child) || child === parent)
|
|
12295
12947
|
continue;
|
|
12296
12948
|
const key = `${parent}::${child}`;
|
|
@@ -12311,8 +12963,8 @@ function collectAgentsDocEdges(files, components, componentNames) {
|
|
|
12311
12963
|
for (const file of files) {
|
|
12312
12964
|
if (!file.path.endsWith("AGENTS.md"))
|
|
12313
12965
|
continue;
|
|
12314
|
-
const docDir =
|
|
12315
|
-
const parent = components.find((c2) => c2.sourcePath &&
|
|
12966
|
+
const docDir = dirname12(file.path);
|
|
12967
|
+
const parent = components.find((c2) => c2.sourcePath && dirname12(c2.sourcePath) === docDir)?.name;
|
|
12316
12968
|
if (!parent || !componentNames.has(parent))
|
|
12317
12969
|
continue;
|
|
12318
12970
|
for (const line of file.content.split("\n")) {
|
|
@@ -12321,7 +12973,7 @@ function collectAgentsDocEdges(files, components, componentNames) {
|
|
|
12321
12973
|
continue;
|
|
12322
12974
|
for (const match2 of line.matchAll(BOLD_BACKTICK)) {
|
|
12323
12975
|
const raw = match2[1];
|
|
12324
|
-
const candidate = componentNames.has(raw) ? raw :
|
|
12976
|
+
const candidate = componentNames.has(raw) ? raw : kebabToPascal3(raw);
|
|
12325
12977
|
if (!componentNames.has(candidate) || candidate === parent)
|
|
12326
12978
|
continue;
|
|
12327
12979
|
const key = `${parent}::${candidate}`;
|
|
@@ -12637,7 +13289,7 @@ function validateExtractedComponents(components) {
|
|
|
12637
13289
|
}
|
|
12638
13290
|
|
|
12639
13291
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
|
|
12640
|
-
import { resolve as
|
|
13292
|
+
import { resolve as resolve15 } from "node:path";
|
|
12641
13293
|
|
|
12642
13294
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/create-component-id.js
|
|
12643
13295
|
import { createHash as createHash7 } from "node:crypto";
|
|
@@ -12648,7 +13300,7 @@ function createComponentId(name, resolvedSourcePath) {
|
|
|
12648
13300
|
|
|
12649
13301
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/resolve-component-source-path.js
|
|
12650
13302
|
import { access } from "node:fs/promises";
|
|
12651
|
-
import { isAbsolute, relative, resolve as
|
|
13303
|
+
import { isAbsolute, relative, resolve as resolve14 } from "node:path";
|
|
12652
13304
|
async function resolveComponentSourcePath(source, reviewRoot) {
|
|
12653
13305
|
if (isAbsolute(source)) {
|
|
12654
13306
|
try {
|
|
@@ -12658,7 +13310,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
|
|
|
12658
13310
|
throw new Error(`Unable to access component source at ${source}`);
|
|
12659
13311
|
}
|
|
12660
13312
|
}
|
|
12661
|
-
const candidate =
|
|
13313
|
+
const candidate = resolve14(reviewRoot, source);
|
|
12662
13314
|
const relativeToRoot = relative(reviewRoot, candidate);
|
|
12663
13315
|
if (relativeToRoot.startsWith("..") || relativeToRoot === ".." || isAbsolute(relativeToRoot)) {
|
|
12664
13316
|
throw new Error(`Resolved component source is outside the review root: ${source}. Pass --project-root <path> to set the correct base.`);
|
|
@@ -12673,7 +13325,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
|
|
|
12673
13325
|
|
|
12674
13326
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
|
|
12675
13327
|
async function loadReviewInput(components, options = {}) {
|
|
12676
|
-
const reviewRoot =
|
|
13328
|
+
const reviewRoot = resolve15(options.reviewRoot ?? process.cwd());
|
|
12677
13329
|
const records = await Promise.all(components.map(async (component) => {
|
|
12678
13330
|
let resolvedSourcePath;
|
|
12679
13331
|
try {
|
|
@@ -12708,19 +13360,19 @@ async function loadAndValidateForReview(sessionId, projectRoot) {
|
|
|
12708
13360
|
}
|
|
12709
13361
|
|
|
12710
13362
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
12711
|
-
import { access as access3, readFile as
|
|
13363
|
+
import { access as access3, readFile as readFile10 } from "node:fs/promises";
|
|
12712
13364
|
|
|
12713
13365
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
|
|
12714
|
-
import { access as access2, mkdir, readFile as
|
|
13366
|
+
import { access as access2, mkdir, readFile as readFile9, writeFile } from "node:fs/promises";
|
|
12715
13367
|
|
|
12716
13368
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
12717
|
-
import { resolve as
|
|
13369
|
+
import { resolve as resolve16 } from "node:path";
|
|
12718
13370
|
async function getRefineSessionPaths(sessionId, artifactsRoot) {
|
|
12719
|
-
const sessionDir2 =
|
|
13371
|
+
const sessionDir2 = resolve16(artifactsRoot, sessionId);
|
|
12720
13372
|
return {
|
|
12721
13373
|
sessionDir: sessionDir2,
|
|
12722
|
-
eventsPath:
|
|
12723
|
-
statePath:
|
|
13374
|
+
eventsPath: resolve16(sessionDir2, "events.jsonl"),
|
|
13375
|
+
statePath: resolve16(sessionDir2, "current-review-state.json")
|
|
12724
13376
|
};
|
|
12725
13377
|
}
|
|
12726
13378
|
|
|
@@ -12730,7 +13382,7 @@ async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
|
|
|
12730
13382
|
await mkdir(paths.sessionDir, { recursive: true });
|
|
12731
13383
|
try {
|
|
12732
13384
|
await access2(paths.statePath);
|
|
12733
|
-
const savedState = await
|
|
13385
|
+
const savedState = await readFile9(paths.statePath, "utf8");
|
|
12734
13386
|
return JSON.parse(savedState);
|
|
12735
13387
|
} catch {
|
|
12736
13388
|
await writeFile(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
|
|
@@ -12740,12 +13392,12 @@ async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
|
|
|
12740
13392
|
}
|
|
12741
13393
|
|
|
12742
13394
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-artifacts-root.js
|
|
12743
|
-
import { resolve as
|
|
13395
|
+
import { resolve as resolve17 } from "node:path";
|
|
12744
13396
|
function getRefineArtifactsRoot() {
|
|
12745
13397
|
if (process.env["EDS_REVIEW_ARTIFACTS_DIR"]) {
|
|
12746
|
-
return
|
|
13398
|
+
return resolve17(process.env["EDS_REVIEW_ARTIFACTS_DIR"]);
|
|
12747
13399
|
}
|
|
12748
|
-
return
|
|
13400
|
+
return resolve17(configRoot(), "reviews");
|
|
12749
13401
|
}
|
|
12750
13402
|
|
|
12751
13403
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/save-review-state.js
|
|
@@ -12761,7 +13413,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
12761
13413
|
let snapshot;
|
|
12762
13414
|
try {
|
|
12763
13415
|
await access3(paths.statePath);
|
|
12764
|
-
snapshot = JSON.parse(await
|
|
13416
|
+
snapshot = JSON.parse(await readFile10(paths.statePath, "utf8"));
|
|
12765
13417
|
} catch {
|
|
12766
13418
|
snapshot = await loadAndValidateForReview(sessionId, void 0);
|
|
12767
13419
|
snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
|
|
@@ -12799,7 +13451,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
12799
13451
|
}
|
|
12800
13452
|
|
|
12801
13453
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
|
|
12802
|
-
import { readFile as
|
|
13454
|
+
import { readFile as readFile11 } from "node:fs/promises";
|
|
12803
13455
|
async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
12804
13456
|
if (names.length === 0)
|
|
12805
13457
|
return;
|
|
@@ -12815,7 +13467,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
|
12815
13467
|
const nameSet = new Set(names);
|
|
12816
13468
|
let snapshot;
|
|
12817
13469
|
try {
|
|
12818
|
-
snapshot = JSON.parse(await
|
|
13470
|
+
snapshot = JSON.parse(await readFile11(paths.statePath, "utf8"));
|
|
12819
13471
|
} catch {
|
|
12820
13472
|
return;
|
|
12821
13473
|
}
|
|
@@ -12824,7 +13476,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
|
12824
13476
|
}
|
|
12825
13477
|
|
|
12826
13478
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
|
|
12827
|
-
import { statSync as
|
|
13479
|
+
import { statSync as statSync5 } from "node:fs";
|
|
12828
13480
|
import path4 from "node:path";
|
|
12829
13481
|
|
|
12830
13482
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/build-scan-warnings.js
|
|
@@ -13011,7 +13663,7 @@ function collectFiles(root, options = {}) {
|
|
|
13011
13663
|
const resolved = path4.resolve(root);
|
|
13012
13664
|
let stat6;
|
|
13013
13665
|
try {
|
|
13014
|
-
stat6 =
|
|
13666
|
+
stat6 = statSync5(resolved);
|
|
13015
13667
|
} catch (err) {
|
|
13016
13668
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
13017
13669
|
}
|
|
@@ -13067,7 +13719,7 @@ function generateUlid(now = Date.now()) {
|
|
|
13067
13719
|
}
|
|
13068
13720
|
|
|
13069
13721
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
13070
|
-
import { readFile as
|
|
13722
|
+
import { readFile as readFile12 } from "node:fs/promises";
|
|
13071
13723
|
|
|
13072
13724
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/migrate-record.js
|
|
13073
13725
|
function migrateRecord(rec) {
|
|
@@ -13086,7 +13738,7 @@ var READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
|
|
|
13086
13738
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
13087
13739
|
async function readRunsFileMaybe() {
|
|
13088
13740
|
try {
|
|
13089
|
-
const raw = await
|
|
13741
|
+
const raw = await readFile12(runsFilePath(), "utf8");
|
|
13090
13742
|
const parsed = JSON.parse(raw);
|
|
13091
13743
|
if (!READABLE_VERSIONS.has(parsed.version)) {
|
|
13092
13744
|
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.`);
|
|
@@ -13103,9 +13755,9 @@ async function readRunsFileMaybe() {
|
|
|
13103
13755
|
|
|
13104
13756
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
|
|
13105
13757
|
import { mkdir as mkdir2, rename, writeFile as writeFile3 } from "node:fs/promises";
|
|
13106
|
-
import { dirname as
|
|
13758
|
+
import { dirname as dirname13 } from "node:path";
|
|
13107
13759
|
async function writeRunsFileAtomic(file) {
|
|
13108
|
-
await mkdir2(
|
|
13760
|
+
await mkdir2(dirname13(runsFilePath()), { recursive: true });
|
|
13109
13761
|
const body = JSON.stringify(file, null, 2) + "\n";
|
|
13110
13762
|
const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
|
|
13111
13763
|
await writeFile3(tmp, body, { mode: 384 });
|
|
@@ -13145,8 +13797,8 @@ async function updateRun(id, patch) {
|
|
|
13145
13797
|
}
|
|
13146
13798
|
|
|
13147
13799
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
|
|
13148
|
-
import { readFile as
|
|
13149
|
-
import { resolve as
|
|
13800
|
+
import { readFile as readFile13, stat } from "node:fs/promises";
|
|
13801
|
+
import { resolve as resolve18 } from "node:path";
|
|
13150
13802
|
|
|
13151
13803
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/sha256-hex.js
|
|
13152
13804
|
import { createHash as createHash8 } from "node:crypto";
|
|
@@ -13168,7 +13820,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
13168
13820
|
const name = rowField(row, "name");
|
|
13169
13821
|
if (!sourcePath)
|
|
13170
13822
|
continue;
|
|
13171
|
-
const abs =
|
|
13823
|
+
const abs = resolve18(sourcePath);
|
|
13172
13824
|
if (seen.has(abs))
|
|
13173
13825
|
continue;
|
|
13174
13826
|
seen.add(abs);
|
|
@@ -13185,10 +13837,10 @@ async function buildSourceFingerprint(opts) {
|
|
|
13185
13837
|
let rawTokensMtime = null;
|
|
13186
13838
|
let rawTokensContentHash = null;
|
|
13187
13839
|
if (opts.rawTokensPath) {
|
|
13188
|
-
const abs =
|
|
13840
|
+
const abs = resolve18(opts.rawTokensPath);
|
|
13189
13841
|
rawTokensPath = abs;
|
|
13190
13842
|
try {
|
|
13191
|
-
const [st, buf] = await Promise.all([stat(abs),
|
|
13843
|
+
const [st, buf] = await Promise.all([stat(abs), readFile13(abs)]);
|
|
13192
13844
|
rawTokensMtime = st.mtime.toISOString();
|
|
13193
13845
|
rawTokensContentHash = sha256Hex(buf);
|
|
13194
13846
|
} catch {
|
|
@@ -13270,12 +13922,12 @@ async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
|
|
|
13270
13922
|
}
|
|
13271
13923
|
|
|
13272
13924
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
|
|
13273
|
-
import { readFile as
|
|
13925
|
+
import { readFile as readFile14 } from "node:fs/promises";
|
|
13274
13926
|
async function loadAcceptedNames(sessionId) {
|
|
13275
13927
|
try {
|
|
13276
13928
|
const artifactsRoot = getRefineArtifactsRoot();
|
|
13277
13929
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
13278
|
-
const raw = await
|
|
13930
|
+
const raw = await readFile14(paths.statePath, "utf8");
|
|
13279
13931
|
const snapshot = JSON.parse(raw);
|
|
13280
13932
|
const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
|
|
13281
13933
|
if (accepted.length === 0)
|
|
@@ -13973,7 +14625,7 @@ function errorMessage(error) {
|
|
|
13973
14625
|
return error instanceof Error && error.message ? error.message : String(error);
|
|
13974
14626
|
}
|
|
13975
14627
|
function defaultSleep(delayMs) {
|
|
13976
|
-
return new Promise((
|
|
14628
|
+
return new Promise((resolve29) => setTimeout(resolve29, delayMs));
|
|
13977
14629
|
}
|
|
13978
14630
|
|
|
13979
14631
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/sanitize-preview.js
|
|
@@ -14214,7 +14866,7 @@ var ApiClient = class {
|
|
|
14214
14866
|
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
14215
14867
|
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
14216
14868
|
const jitter = Math.random() * baseDelay * 0.15;
|
|
14217
|
-
await new Promise((
|
|
14869
|
+
await new Promise((resolve29) => setTimeout(resolve29, baseDelay + jitter));
|
|
14218
14870
|
}
|
|
14219
14871
|
}
|
|
14220
14872
|
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
@@ -14601,7 +15253,7 @@ function formatApiError2(request) {
|
|
|
14601
15253
|
|
|
14602
15254
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
|
|
14603
15255
|
init_shared();
|
|
14604
|
-
import { readFile as
|
|
15256
|
+
import { readFile as readFile15, stat as stat3 } from "node:fs/promises";
|
|
14605
15257
|
|
|
14606
15258
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/collect-json-files.js
|
|
14607
15259
|
import { readdir, stat as stat2 } from "node:fs/promises";
|
|
@@ -14660,7 +15312,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
14660
15312
|
const merged = {};
|
|
14661
15313
|
for (const file of files.sort()) {
|
|
14662
15314
|
try {
|
|
14663
|
-
const text = await
|
|
15315
|
+
const text = await readFile15(file, "utf8");
|
|
14664
15316
|
const parsed = JSON.parse(text);
|
|
14665
15317
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
14666
15318
|
Object.assign(merged, parsed);
|
|
@@ -14674,7 +15326,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
14674
15326
|
async function readSingleFile(flag, p) {
|
|
14675
15327
|
let text;
|
|
14676
15328
|
try {
|
|
14677
|
-
text = await
|
|
15329
|
+
text = await readFile15(p, "utf8");
|
|
14678
15330
|
} catch {
|
|
14679
15331
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
14680
15332
|
}
|
|
@@ -14765,12 +15417,12 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
14765
15417
|
}
|
|
14766
15418
|
|
|
14767
15419
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/read-from-session.js
|
|
14768
|
-
import { readFile as
|
|
15420
|
+
import { readFile as readFile16 } from "node:fs/promises";
|
|
14769
15421
|
async function readExistingContentfulEntitiesFromSession(request) {
|
|
14770
15422
|
if (!request.path)
|
|
14771
15423
|
return void 0;
|
|
14772
15424
|
try {
|
|
14773
|
-
const raw = await
|
|
15425
|
+
const raw = await readFile16(request.path, "utf8");
|
|
14774
15426
|
const parsed = JSON.parse(raw);
|
|
14775
15427
|
if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
|
|
14776
15428
|
return void 0;
|
|
@@ -15110,7 +15762,7 @@ init_describe_agent_failure();
|
|
|
15110
15762
|
init_resolve_binary();
|
|
15111
15763
|
init_resolve_skill_path();
|
|
15112
15764
|
init_parse_map_token_prop_tool_calls();
|
|
15113
|
-
import { resolve as
|
|
15765
|
+
import { resolve as resolve19 } from "node:path";
|
|
15114
15766
|
init_cache_keys();
|
|
15115
15767
|
|
|
15116
15768
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/binary-exists.js
|
|
@@ -15415,7 +16067,7 @@ async function runMapTokens(request) {
|
|
|
15415
16067
|
outDir: process.cwd(),
|
|
15416
16068
|
existingTokensInline: request.existingEntitiesInline,
|
|
15417
16069
|
...request.skillContentOverride !== void 0 ? { skillContentOverride: request.skillContentOverride } : {},
|
|
15418
|
-
...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride:
|
|
16070
|
+
...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride: resolve19(request.skillPathOverride) } : {}
|
|
15419
16071
|
});
|
|
15420
16072
|
if (request.printPrompt) {
|
|
15421
16073
|
const prompt2 = await buildMapPrompt();
|
|
@@ -15531,7 +16183,7 @@ function hasNoAuthoringSurface(component) {
|
|
|
15531
16183
|
}
|
|
15532
16184
|
|
|
15533
16185
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
|
|
15534
|
-
import { readFile as
|
|
16186
|
+
import { readFile as readFile17 } from "node:fs/promises";
|
|
15535
16187
|
|
|
15536
16188
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/constants/review-reasons.js
|
|
15537
16189
|
var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
|
|
@@ -15626,7 +16278,7 @@ function dedupeReasons(reasons) {
|
|
|
15626
16278
|
async function inspectComponentSource(component) {
|
|
15627
16279
|
let sourceText = "";
|
|
15628
16280
|
try {
|
|
15629
|
-
sourceText = await
|
|
16281
|
+
sourceText = await readFile17(component.source, "utf8");
|
|
15630
16282
|
} catch {
|
|
15631
16283
|
return {
|
|
15632
16284
|
wrapperConfidence: 0,
|
|
@@ -16033,7 +16685,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
16033
16685
|
const message = error instanceof Error ? error.message : String(error);
|
|
16034
16686
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
16035
16687
|
throw error;
|
|
16036
|
-
await new Promise((
|
|
16688
|
+
await new Promise((resolve29) => setTimeout(resolve29, Math.min(250 * attempt, 2e3)));
|
|
16037
16689
|
}
|
|
16038
16690
|
}
|
|
16039
16691
|
}
|
|
@@ -16065,7 +16717,7 @@ function resolveCompositionAgentName(flagValue) {
|
|
|
16065
16717
|
}
|
|
16066
16718
|
|
|
16067
16719
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/read-candidate-files.js
|
|
16068
|
-
import { readFile as
|
|
16720
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
16069
16721
|
async function readCandidateFiles(components, extraFiles = []) {
|
|
16070
16722
|
const paths = new Set(extraFiles);
|
|
16071
16723
|
for (const c2 of components) {
|
|
@@ -16075,7 +16727,7 @@ async function readCandidateFiles(components, extraFiles = []) {
|
|
|
16075
16727
|
const out = [];
|
|
16076
16728
|
await Promise.all([...paths].map(async (p) => {
|
|
16077
16729
|
try {
|
|
16078
|
-
const content = await
|
|
16730
|
+
const content = await readFile18(p, "utf8");
|
|
16079
16731
|
out.push({ path: p, content });
|
|
16080
16732
|
} catch {
|
|
16081
16733
|
}
|
|
@@ -16246,7 +16898,7 @@ init_build_prompt();
|
|
|
16246
16898
|
init_create_local_cli_agent_invoker();
|
|
16247
16899
|
init_invoke_agent_with_output();
|
|
16248
16900
|
init_parse_token_tool_calls();
|
|
16249
|
-
import { readFile as
|
|
16901
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
16250
16902
|
import { basename as basename5, resolve as pathResolve } from "node:path";
|
|
16251
16903
|
init_cache_keys();
|
|
16252
16904
|
init_parse_prompt_overrides();
|
|
@@ -16279,7 +16931,7 @@ async function runGenerateTokensSession(request) {
|
|
|
16279
16931
|
throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
|
|
16280
16932
|
const tokensOverride = overridesMap.get("tokens");
|
|
16281
16933
|
const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
|
|
16282
|
-
const rawTokensInline = await
|
|
16934
|
+
const rawTokensInline = await readFile19(pathResolve(rawTokensPath), "utf8");
|
|
16283
16935
|
const tokenInputHash = hashTokenContent(rawTokensInline);
|
|
16284
16936
|
const db = openPipelineDb();
|
|
16285
16937
|
try {
|
|
@@ -16396,7 +17048,7 @@ async function readExistingEntities(request) {
|
|
|
16396
17048
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/resolve-generate-prompt.js
|
|
16397
17049
|
init_parse_prompt_overrides();
|
|
16398
17050
|
init_resolve_prompt_override();
|
|
16399
|
-
import { resolve as
|
|
17051
|
+
import { resolve as resolve20 } from "node:path";
|
|
16400
17052
|
async function resolveGeneratePrompt(overrides) {
|
|
16401
17053
|
const { overrides: parsed, errors } = parsePromptOverrides(overrides);
|
|
16402
17054
|
if (errors.length > 0)
|
|
@@ -16407,7 +17059,7 @@ async function resolveGeneratePrompt(overrides) {
|
|
|
16407
17059
|
const text = await resolvePromptOverride(entry);
|
|
16408
17060
|
if (entry.kind === "text")
|
|
16409
17061
|
return { text };
|
|
16410
|
-
return { path:
|
|
17062
|
+
return { path: resolve20(entry.value), text };
|
|
16411
17063
|
}
|
|
16412
17064
|
|
|
16413
17065
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/run-one-generate-component.js
|
|
@@ -17397,19 +18049,19 @@ import { useEffect as useEffect5, useRef as useRef3, useState as useState8 } fro
|
|
|
17397
18049
|
|
|
17398
18050
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
17399
18051
|
import { mkdir as mkdir7 } from "node:fs/promises";
|
|
17400
|
-
import { join as join19, resolve as
|
|
18052
|
+
import { join as join19, resolve as resolve23 } from "node:path";
|
|
17401
18053
|
|
|
17402
18054
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
17403
18055
|
import { existsSync as existsSync8 } from "node:fs";
|
|
17404
|
-
import { dirname as
|
|
18056
|
+
import { dirname as dirname15, join as join18, resolve as resolve21 } from "node:path";
|
|
17405
18057
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
17406
18058
|
function findSkillPath(fileName) {
|
|
17407
|
-
const thisDir =
|
|
18059
|
+
const thisDir = dirname15(fileURLToPath4(import.meta.url));
|
|
17408
18060
|
let dir = thisDir;
|
|
17409
18061
|
for (; ; ) {
|
|
17410
18062
|
const candidate = join18(dir, "skills", fileName);
|
|
17411
18063
|
if (existsSync8(candidate)) return candidate;
|
|
17412
|
-
const parent =
|
|
18064
|
+
const parent = resolve21(dir, "..");
|
|
17413
18065
|
if (parent === dir) {
|
|
17414
18066
|
throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
|
|
17415
18067
|
}
|
|
@@ -17418,11 +18070,11 @@ function findSkillPath(fileName) {
|
|
|
17418
18070
|
}
|
|
17419
18071
|
|
|
17420
18072
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/selection.ts
|
|
17421
|
-
import { resolve as
|
|
18073
|
+
import { resolve as resolve22 } from "node:path";
|
|
17422
18074
|
var SELECT_SKILL_PATH = findSkillPath("select-components.md");
|
|
17423
18075
|
var DEFAULT_TIMEOUT_MS5 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
|
|
17424
18076
|
async function hashSelectPrompt(options) {
|
|
17425
|
-
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(
|
|
18077
|
+
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve22(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
|
|
17426
18078
|
return hashContent(`${promptHash}|${options.agent}|${options.model ?? ""}`);
|
|
17427
18079
|
}
|
|
17428
18080
|
async function runSelection(options) {
|
|
@@ -17517,7 +18169,7 @@ var realDeps = {
|
|
|
17517
18169
|
var fail = (step, message) => ({ ok: false, step, message });
|
|
17518
18170
|
var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
|
|
17519
18171
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
17520
|
-
const outDir = input.outDir ?? join19(
|
|
18172
|
+
const outDir = input.outDir ?? join19(resolve23(input.projectPath), ".contentful");
|
|
17521
18173
|
let progress = initialProgress({
|
|
17522
18174
|
hasCredentials: input.credentials !== null,
|
|
17523
18175
|
hasRawTokens: input.rawTokensPath !== "",
|
|
@@ -17643,7 +18295,7 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
17643
18295
|
if (select?.kind === "text") return { promptText: select.value };
|
|
17644
18296
|
if (select?.kind === "path") {
|
|
17645
18297
|
await resolvePromptOverride(select);
|
|
17646
|
-
return { promptPath:
|
|
18298
|
+
return { promptPath: resolve23(select.value) };
|
|
17647
18299
|
}
|
|
17648
18300
|
return {};
|
|
17649
18301
|
}
|
|
@@ -20565,7 +21217,7 @@ function GenerationScreen({
|
|
|
20565
21217
|
import { useEffect as useEffect9, useRef as useRef7, useState as useState14 } from "react";
|
|
20566
21218
|
|
|
20567
21219
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
20568
|
-
import { resolve as
|
|
21220
|
+
import { resolve as resolve24 } from "node:path";
|
|
20569
21221
|
|
|
20570
21222
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/map-tokens.ts
|
|
20571
21223
|
async function prepareMapTokens(input, generatedSessionId) {
|
|
@@ -20700,7 +21352,7 @@ async function buildMapTokensOptions(input) {
|
|
|
20700
21352
|
if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
|
|
20701
21353
|
if (mapOverride?.kind === "path") {
|
|
20702
21354
|
await resolvePromptOverride(mapOverride);
|
|
20703
|
-
prompt.skillPathOverride =
|
|
21355
|
+
prompt.skillPathOverride = resolve24(mapOverride.value);
|
|
20704
21356
|
}
|
|
20705
21357
|
if (input.existingEntitiesPath) {
|
|
20706
21358
|
const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
|
|
@@ -26482,10 +27134,10 @@ function DoneStep({
|
|
|
26482
27134
|
import { useState as useState24 } from "react";
|
|
26483
27135
|
import { Box as Box37, Text as Text40 } from "ink";
|
|
26484
27136
|
import { readdirSync as readdirSync3 } from "node:fs";
|
|
26485
|
-
import { dirname as
|
|
27137
|
+
import { dirname as dirname16, basename as basename6, join as join21 } from "node:path";
|
|
26486
27138
|
|
|
26487
27139
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
26488
|
-
import { resolve as
|
|
27140
|
+
import { resolve as resolve25 } from "node:path";
|
|
26489
27141
|
import { homedir as homedir4 } from "node:os";
|
|
26490
27142
|
function expandTilde(input) {
|
|
26491
27143
|
if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
|
|
@@ -26499,7 +27151,7 @@ function normalizePath(input) {
|
|
|
26499
27151
|
p = p.slice(1, -1);
|
|
26500
27152
|
}
|
|
26501
27153
|
p = expandTilde(p);
|
|
26502
|
-
return
|
|
27154
|
+
return resolve25(p);
|
|
26503
27155
|
}
|
|
26504
27156
|
|
|
26505
27157
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
@@ -26518,7 +27170,7 @@ import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
|
26518
27170
|
function autocomplete(partial) {
|
|
26519
27171
|
if (!partial) return null;
|
|
26520
27172
|
const normalized = normalizePath(partial);
|
|
26521
|
-
const dir =
|
|
27173
|
+
const dir = dirname16(normalized);
|
|
26522
27174
|
const base = basename6(normalized);
|
|
26523
27175
|
let entries;
|
|
26524
27176
|
try {
|
|
@@ -27287,7 +27939,7 @@ import { useEffect as useEffect20, useRef as useRef13, useSyncExternalStore } fr
|
|
|
27287
27939
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
27288
27940
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
27289
27941
|
import { tmpdir } from "node:os";
|
|
27290
|
-
import { join as join23, resolve as
|
|
27942
|
+
import { join as join23, resolve as resolve26 } from "node:path";
|
|
27291
27943
|
|
|
27292
27944
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
|
|
27293
27945
|
function shouldBypassPreview(state2) {
|
|
@@ -27661,7 +28313,7 @@ var realSaveDeps = () => ({
|
|
|
27661
28313
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
27662
28314
|
appendRun,
|
|
27663
28315
|
buildSourceFingerprint,
|
|
27664
|
-
sleep: (ms) => new Promise((
|
|
28316
|
+
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
27665
28317
|
warn: (message) => process.stderr.write(message)
|
|
27666
28318
|
});
|
|
27667
28319
|
async function runPrintFiles(input, deps, onPatch) {
|
|
@@ -27995,7 +28647,7 @@ function createFlowController(start, deps) {
|
|
|
27995
28647
|
},
|
|
27996
28648
|
async submitPath(submitted) {
|
|
27997
28649
|
await deps.mkdir(submitted);
|
|
27998
|
-
if (
|
|
28650
|
+
if (resolve26(submitted) !== resolve26(state2.outDir) && await deps.detectSaveConflict(submitted)) {
|
|
27999
28651
|
const subdir = deps.buildTimestampedSubdir(submitted);
|
|
28000
28652
|
await deps.mkdir(subdir);
|
|
28001
28653
|
await proceedToWrite(subdir);
|
|
@@ -28053,7 +28705,7 @@ init_debug_mode_store();
|
|
|
28053
28705
|
init_version();
|
|
28054
28706
|
|
|
28055
28707
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
28056
|
-
import { join as join26, resolve as
|
|
28708
|
+
import { join as join26, resolve as resolve28 } from "node:path";
|
|
28057
28709
|
function describeFileLocations({
|
|
28058
28710
|
contentfulBaseDir,
|
|
28059
28711
|
debugModeEnabled,
|
|
@@ -28065,7 +28717,7 @@ function describeFileLocations({
|
|
|
28065
28717
|
importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
28066
28718
|
};
|
|
28067
28719
|
}
|
|
28068
|
-
const base = contentfulBaseDir ?
|
|
28720
|
+
const base = contentfulBaseDir ? resolve28(contentfulBaseDir) : "<project>";
|
|
28069
28721
|
const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
|
|
28070
28722
|
return {
|
|
28071
28723
|
debugLogs: join26(session, "debug"),
|
|
@@ -28286,20 +28938,20 @@ function resolveOnPath(binary) {
|
|
|
28286
28938
|
() => null
|
|
28287
28939
|
);
|
|
28288
28940
|
}
|
|
28289
|
-
return new Promise((
|
|
28941
|
+
return new Promise((resolve29) => {
|
|
28290
28942
|
execFile2(
|
|
28291
28943
|
process.platform === "win32" ? "where" : "which",
|
|
28292
28944
|
[binary],
|
|
28293
|
-
(error, stdout) =>
|
|
28945
|
+
(error, stdout) => resolve29(error ? null : stdout.split("\n")[0]?.trim() ?? null)
|
|
28294
28946
|
);
|
|
28295
28947
|
});
|
|
28296
28948
|
}
|
|
28297
28949
|
function readVersion(binary) {
|
|
28298
|
-
return new Promise((
|
|
28950
|
+
return new Promise((resolve29) => {
|
|
28299
28951
|
execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
|
|
28300
28952
|
const line = stdout.split("\n")[0]?.trim() ?? "";
|
|
28301
|
-
if (!error && line)
|
|
28302
|
-
else
|
|
28953
|
+
if (!error && line) resolve29(pass("version", line));
|
|
28954
|
+
else resolve29(fail3("version", "runs, but did not report a version"));
|
|
28303
28955
|
});
|
|
28304
28956
|
});
|
|
28305
28957
|
}
|