@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/app.js
CHANGED
|
@@ -821,16 +821,6 @@ var init_parse_map_token_prop_tool_calls = __esm({
|
|
|
821
821
|
|
|
822
822
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/services/run-agent.js
|
|
823
823
|
import { spawn } from "node:child_process";
|
|
824
|
-
function killProcessTree(pid, signal) {
|
|
825
|
-
try {
|
|
826
|
-
process.kill(-pid, signal);
|
|
827
|
-
} catch {
|
|
828
|
-
try {
|
|
829
|
-
process.kill(pid, signal);
|
|
830
|
-
} catch {
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
824
|
async function runAgent(options) {
|
|
835
825
|
const { agent, prompt, timeoutMs, model, onOutput, promptViaStdin, onDebugEvent } = options;
|
|
836
826
|
const bedrock = options.bedrock ?? process.env.EDS_BEDROCK === "1";
|
|
@@ -847,11 +837,10 @@ async function runAgent(options) {
|
|
|
847
837
|
promptLen: prompt.length,
|
|
848
838
|
promptHead: prompt.slice(0, 500)
|
|
849
839
|
});
|
|
850
|
-
return new Promise((
|
|
840
|
+
return new Promise((resolve28) => {
|
|
851
841
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
852
842
|
const child = spawn(binary, args, {
|
|
853
843
|
stdio: ["pipe", "pipe", "pipe"],
|
|
854
|
-
detached: true,
|
|
855
844
|
...bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}
|
|
856
845
|
});
|
|
857
846
|
if (useStdin2 && child.stdin) {
|
|
@@ -863,87 +852,50 @@ async function runAgent(options) {
|
|
|
863
852
|
} else {
|
|
864
853
|
child.stdin?.end();
|
|
865
854
|
}
|
|
866
|
-
|
|
867
|
-
|
|
855
|
+
let stdout = "";
|
|
856
|
+
let stderr = "";
|
|
868
857
|
let timedOut = false;
|
|
869
|
-
|
|
870
|
-
const pid = child.pid;
|
|
871
|
-
const settle = (result) => {
|
|
872
|
-
if (settled)
|
|
873
|
-
return;
|
|
874
|
-
settled = true;
|
|
875
|
-
clearTimeout(softTimer);
|
|
876
|
-
clearTimeout(hardTimer);
|
|
877
|
-
onDebugEvent?.("run.end", {
|
|
878
|
-
agent,
|
|
879
|
-
model,
|
|
880
|
-
durationMs: Date.now() - startedAt,
|
|
881
|
-
exitCode: result.exitCode,
|
|
882
|
-
timedOut: result.timedOut,
|
|
883
|
-
stdoutLen: result.stdout.length,
|
|
884
|
-
stderrLen: result.stderr.length,
|
|
885
|
-
stderrTail: result.stderr.slice(-1e3)
|
|
886
|
-
});
|
|
887
|
-
resolve29(result);
|
|
888
|
-
};
|
|
889
|
-
const softTimer = setTimeout(() => {
|
|
858
|
+
const timer = setTimeout(() => {
|
|
890
859
|
timedOut = true;
|
|
891
|
-
|
|
892
|
-
killProcessTree(pid, "SIGTERM");
|
|
860
|
+
child.kill("SIGTERM");
|
|
893
861
|
}, timeoutMs);
|
|
894
|
-
const hardTimer = setTimeout(() => {
|
|
895
|
-
if (settled)
|
|
896
|
-
return;
|
|
897
|
-
if (pid)
|
|
898
|
-
killProcessTree(pid, "SIGKILL");
|
|
899
|
-
try {
|
|
900
|
-
child.stdout?.destroy();
|
|
901
|
-
child.stderr?.destroy();
|
|
902
|
-
child.stdin?.destroy();
|
|
903
|
-
} catch {
|
|
904
|
-
}
|
|
905
|
-
settle({
|
|
906
|
-
exitCode: 1,
|
|
907
|
-
stdout: Buffer.concat(stdoutChunks).toString("utf8"),
|
|
908
|
-
stderr: Buffer.concat(stderrChunks).toString("utf8"),
|
|
909
|
-
timedOut: true
|
|
910
|
-
});
|
|
911
|
-
}, timeoutMs + WATCHDOG_GRACE_MS);
|
|
912
862
|
child.stdout?.on("data", (chunk) => {
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
863
|
+
const text = chunk.toString();
|
|
864
|
+
stdout += text;
|
|
865
|
+
onOutput?.(text);
|
|
916
866
|
});
|
|
917
867
|
child.stderr?.on("data", (chunk) => {
|
|
918
|
-
|
|
919
|
-
});
|
|
920
|
-
child.on("error", (err) => {
|
|
921
|
-
settle({
|
|
922
|
-
exitCode: 1,
|
|
923
|
-
stdout: Buffer.concat(stdoutChunks).toString("utf8"),
|
|
924
|
-
stderr: `${err instanceof Error ? err.message : String(err)}
|
|
925
|
-
${Buffer.concat(stderrChunks).toString("utf8")}`,
|
|
926
|
-
timedOut
|
|
927
|
-
});
|
|
868
|
+
stderr += chunk.toString();
|
|
928
869
|
});
|
|
929
870
|
child.on("close", (code, signal) => {
|
|
930
|
-
|
|
871
|
+
clearTimeout(timer);
|
|
872
|
+
const result = {
|
|
931
873
|
exitCode: signal ? 1 : code ?? 1,
|
|
932
|
-
stdout
|
|
933
|
-
stderr
|
|
874
|
+
stdout,
|
|
875
|
+
stderr,
|
|
934
876
|
timedOut
|
|
877
|
+
};
|
|
878
|
+
onDebugEvent?.("run.end", {
|
|
879
|
+
agent,
|
|
880
|
+
model,
|
|
881
|
+
durationMs: Date.now() - startedAt,
|
|
882
|
+
exitCode: result.exitCode,
|
|
883
|
+
signal,
|
|
884
|
+
timedOut,
|
|
885
|
+
stdoutLen: stdout.length,
|
|
886
|
+
stderrLen: stderr.length,
|
|
887
|
+
stderrTail: stderr.slice(-1e3)
|
|
935
888
|
});
|
|
889
|
+
resolve28(result);
|
|
936
890
|
});
|
|
937
891
|
});
|
|
938
892
|
}
|
|
939
|
-
var WATCHDOG_GRACE_MS;
|
|
940
893
|
var init_run_agent = __esm({
|
|
941
894
|
"packages/experience-design-system-backend-pipeline/dist/src/agents/services/run-agent.js"() {
|
|
942
895
|
"use strict";
|
|
943
896
|
init_bedrock();
|
|
944
897
|
init_build_agent_args();
|
|
945
898
|
init_resolve_binary();
|
|
946
|
-
WATCHDOG_GRACE_MS = 10 * 1e3;
|
|
947
899
|
}
|
|
948
900
|
});
|
|
949
901
|
|
|
@@ -956,7 +908,7 @@ async function checkAgentAuth(agent) {
|
|
|
956
908
|
return "not-found";
|
|
957
909
|
if (agent !== "claude")
|
|
958
910
|
return "ok";
|
|
959
|
-
return new Promise((
|
|
911
|
+
return new Promise((resolve28) => {
|
|
960
912
|
const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
961
913
|
let stdout = "";
|
|
962
914
|
let done = false;
|
|
@@ -965,7 +917,7 @@ async function checkAgentAuth(agent) {
|
|
|
965
917
|
return;
|
|
966
918
|
done = true;
|
|
967
919
|
child.kill("SIGTERM");
|
|
968
|
-
|
|
920
|
+
resolve28("unauthenticated");
|
|
969
921
|
}, 5e3);
|
|
970
922
|
child.stdout?.on("data", (chunk) => {
|
|
971
923
|
stdout += chunk.toString();
|
|
@@ -976,14 +928,14 @@ async function checkAgentAuth(agent) {
|
|
|
976
928
|
done = true;
|
|
977
929
|
clearTimeout(timer);
|
|
978
930
|
if (code !== 0) {
|
|
979
|
-
|
|
931
|
+
resolve28("unauthenticated");
|
|
980
932
|
return;
|
|
981
933
|
}
|
|
982
934
|
try {
|
|
983
935
|
const status = JSON.parse(stdout);
|
|
984
|
-
|
|
936
|
+
resolve28(status.loggedIn ? "ok" : "unauthenticated");
|
|
985
937
|
} catch {
|
|
986
|
-
|
|
938
|
+
resolve28("unauthenticated");
|
|
987
939
|
}
|
|
988
940
|
});
|
|
989
941
|
});
|
|
@@ -993,9 +945,9 @@ async function binaryIsOnPath(binary) {
|
|
|
993
945
|
const fs = await import("node:fs/promises");
|
|
994
946
|
return fs.access(binary).then(() => true, () => false);
|
|
995
947
|
}
|
|
996
|
-
return new Promise((
|
|
948
|
+
return new Promise((resolve28) => {
|
|
997
949
|
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
998
|
-
child.on("close", (code) =>
|
|
950
|
+
child.on("close", (code) => resolve28(code === 0));
|
|
999
951
|
});
|
|
1000
952
|
}
|
|
1001
953
|
var init_check_agent_auth = __esm({
|
|
@@ -1632,8 +1584,7 @@ var init_infer_fence_lang = __esm({
|
|
|
1632
1584
|
sass: "scss",
|
|
1633
1585
|
css: "css",
|
|
1634
1586
|
json: "json",
|
|
1635
|
-
json5: "json"
|
|
1636
|
-
html: "html"
|
|
1587
|
+
json5: "json"
|
|
1637
1588
|
};
|
|
1638
1589
|
}
|
|
1639
1590
|
});
|
|
@@ -2132,22 +2083,22 @@ var init_cache_keys = __esm({
|
|
|
2132
2083
|
|
|
2133
2084
|
// packages/experience-design-system-types/dist/src/config/index.js
|
|
2134
2085
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
2135
|
-
import { mkdir as mkdir6, readFile as
|
|
2086
|
+
import { mkdir as mkdir6, readFile as readFile18, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
2136
2087
|
import { homedir as homedir3 } from "node:os";
|
|
2137
|
-
import { dirname as
|
|
2088
|
+
import { dirname as dirname13, join as join16 } from "node:path";
|
|
2138
2089
|
function configRoot2() {
|
|
2139
2090
|
return process.env["EDS_HOME"] || join16(homedir3(), ".contentful", "experience-design-system-cli");
|
|
2140
2091
|
}
|
|
2141
2092
|
async function readSettings2() {
|
|
2142
2093
|
try {
|
|
2143
|
-
return JSON.parse(await
|
|
2094
|
+
return JSON.parse(await readFile18(configFilePath2(), "utf8"));
|
|
2144
2095
|
} catch {
|
|
2145
2096
|
return {};
|
|
2146
2097
|
}
|
|
2147
2098
|
}
|
|
2148
2099
|
async function writeSettings2(settings) {
|
|
2149
2100
|
const path5 = configFilePath2();
|
|
2150
|
-
await mkdir6(
|
|
2101
|
+
await mkdir6(dirname13(path5), { recursive: true });
|
|
2151
2102
|
const tmp = `${path5}.${process.pid}.${randomBytes4(4).toString("hex")}.tmp`;
|
|
2152
2103
|
await writeFile6(tmp, `${JSON.stringify(settings, null, 2)}
|
|
2153
2104
|
`, { mode: 384 });
|
|
@@ -2191,7 +2142,7 @@ var init_debug_mode_store = __esm({
|
|
|
2191
2142
|
|
|
2192
2143
|
// packages/experience-design-system-cli/src/tui/debug-prune.ts
|
|
2193
2144
|
import { readdir as readdir2, rm, rmdir, stat as stat4 } from "node:fs/promises";
|
|
2194
|
-
import { dirname as
|
|
2145
|
+
import { dirname as dirname16, join as join23 } from "node:path";
|
|
2195
2146
|
async function logFilesIn(dir) {
|
|
2196
2147
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
2197
2148
|
const nested = await Promise.all(
|
|
@@ -2214,7 +2165,7 @@ async function removeEmptyFolders(from, stop) {
|
|
|
2214
2165
|
}
|
|
2215
2166
|
removed += 1;
|
|
2216
2167
|
if (dir === stop) return removed;
|
|
2217
|
-
dir =
|
|
2168
|
+
dir = dirname16(dir);
|
|
2218
2169
|
}
|
|
2219
2170
|
}
|
|
2220
2171
|
async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
@@ -2230,7 +2181,7 @@ async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
|
2230
2181
|
if ((await stat4(file)).mtimeMs >= cutoff) continue;
|
|
2231
2182
|
await rm(file);
|
|
2232
2183
|
result.logs += 1;
|
|
2233
|
-
result.folders += await removeEmptyFolders(
|
|
2184
|
+
result.folders += await removeEmptyFolders(dirname16(file), join23(contentfulDir, session));
|
|
2234
2185
|
} catch {
|
|
2235
2186
|
}
|
|
2236
2187
|
}
|
|
@@ -2260,7 +2211,7 @@ __export(debug_store_exports, {
|
|
|
2260
2211
|
});
|
|
2261
2212
|
import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
|
|
2262
2213
|
import { existsSync as existsSync9, readdirSync as readdirSync4 } from "node:fs";
|
|
2263
|
-
import { join as join24, resolve as
|
|
2214
|
+
import { join as join24, resolve as resolve26 } from "node:path";
|
|
2264
2215
|
function generateRunId() {
|
|
2265
2216
|
const now = /* @__PURE__ */ new Date();
|
|
2266
2217
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -2276,7 +2227,7 @@ function slugify(value) {
|
|
|
2276
2227
|
async function readBaseDir() {
|
|
2277
2228
|
try {
|
|
2278
2229
|
const dir = (await readSettings2())["contentfulBaseDir"];
|
|
2279
|
-
return typeof dir === "string" && dir !== "" ?
|
|
2230
|
+
return typeof dir === "string" && dir !== "" ? resolve26(dir) : void 0;
|
|
2280
2231
|
} catch {
|
|
2281
2232
|
return void 0;
|
|
2282
2233
|
}
|
|
@@ -2305,7 +2256,7 @@ function currentSessionDir() {
|
|
|
2305
2256
|
async function startDebugSessionIn(base, { replace = false } = {}) {
|
|
2306
2257
|
try {
|
|
2307
2258
|
if (!await isDebugModeEnabled()) return;
|
|
2308
|
-
await mkdir9(join24(startSession(
|
|
2259
|
+
await mkdir9(join24(startSession(resolve26(base), { replace }), "debug"), { recursive: true });
|
|
2309
2260
|
} catch {
|
|
2310
2261
|
}
|
|
2311
2262
|
}
|
|
@@ -2319,7 +2270,7 @@ function nextImportRunDir(session) {
|
|
|
2319
2270
|
}
|
|
2320
2271
|
async function startImportRun(projectPath) {
|
|
2321
2272
|
await startDebugSessionIn(projectPath);
|
|
2322
|
-
if (!sessionDir) return join24(
|
|
2273
|
+
if (!sessionDir) return join24(resolve26(projectPath), ".contentful");
|
|
2323
2274
|
const dir = nextImportRunDir(sessionDir);
|
|
2324
2275
|
await mkdir9(dir, { recursive: true });
|
|
2325
2276
|
return dir;
|
|
@@ -12031,690 +11982,6 @@ function mergeSlots2(fromSnippetProps, fromTemplate) {
|
|
|
12031
11982
|
return { slots: [...byName.values()], mixedWarning: mixed };
|
|
12032
11983
|
}
|
|
12033
11984
|
|
|
12034
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
|
|
12035
|
-
import { readFile as readFile8 } from "node:fs/promises";
|
|
12036
|
-
import { ModuleKind as ModuleKind2, Project as Project7, ScriptTarget as ScriptTarget2 } from "ts-morph";
|
|
12037
|
-
|
|
12038
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js
|
|
12039
|
-
import { Node as Node10 } from "ts-morph";
|
|
12040
|
-
function resolveToObjectLiteral(expr, depth = 0) {
|
|
12041
|
-
if (!expr || depth > 3)
|
|
12042
|
-
return null;
|
|
12043
|
-
if (Node10.isObjectLiteralExpression(expr))
|
|
12044
|
-
return expr;
|
|
12045
|
-
if (Node10.isIdentifier(expr)) {
|
|
12046
|
-
const defs = expr.getDefinitions();
|
|
12047
|
-
for (const def of defs) {
|
|
12048
|
-
const node = def.getDeclarationNode();
|
|
12049
|
-
if (node && Node10.isVariableDeclaration(node)) {
|
|
12050
|
-
const init = node.getInitializer();
|
|
12051
|
-
const resolved = resolveToObjectLiteral(init, depth + 1);
|
|
12052
|
-
if (resolved)
|
|
12053
|
-
return resolved;
|
|
12054
|
-
}
|
|
12055
|
-
}
|
|
12056
|
-
}
|
|
12057
|
-
return null;
|
|
12058
|
-
}
|
|
12059
|
-
function findComponentDecorator(cls) {
|
|
12060
|
-
const decorator = cls.getDecorator("Component");
|
|
12061
|
-
if (!decorator)
|
|
12062
|
-
return null;
|
|
12063
|
-
const [arg] = decorator.getArguments();
|
|
12064
|
-
return resolveToObjectLiteral(arg);
|
|
12065
|
-
}
|
|
12066
|
-
function hasComponentDecorator(cls) {
|
|
12067
|
-
return cls.getDecorator("Component") !== void 0;
|
|
12068
|
-
}
|
|
12069
|
-
|
|
12070
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-decorator-input.js
|
|
12071
|
-
import { Node as Node12 } from "ts-morph";
|
|
12072
|
-
|
|
12073
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/resolve-prop-type.js
|
|
12074
|
-
import { Node as Node11 } from "ts-morph";
|
|
12075
|
-
function resolvePropType(typeNode) {
|
|
12076
|
-
if (!typeNode) {
|
|
12077
|
-
return { text: "any", allowedValues: null, isTemplateRef: false };
|
|
12078
|
-
}
|
|
12079
|
-
const text = typeNode.getText();
|
|
12080
|
-
const members = extractStringLiteralUnion(typeNode);
|
|
12081
|
-
const isTemplateRef = containsTemplateRef(typeNode);
|
|
12082
|
-
return {
|
|
12083
|
-
text,
|
|
12084
|
-
allowedValues: members.length > 0 ? members : null,
|
|
12085
|
-
isTemplateRef
|
|
12086
|
-
};
|
|
12087
|
-
}
|
|
12088
|
-
function extractStringLiteralUnion(typeNode) {
|
|
12089
|
-
if (Node11.isLiteralTypeNode(typeNode)) {
|
|
12090
|
-
const lit = typeNode.getLiteral();
|
|
12091
|
-
if (Node11.isStringLiteral(lit) || Node11.isNoSubstitutionTemplateLiteral(lit)) {
|
|
12092
|
-
return [lit.getLiteralText()];
|
|
12093
|
-
}
|
|
12094
|
-
return [];
|
|
12095
|
-
}
|
|
12096
|
-
if (Node11.isUnionTypeNode(typeNode)) {
|
|
12097
|
-
const out = [];
|
|
12098
|
-
for (const member of typeNode.getTypeNodes()) {
|
|
12099
|
-
const sub = extractStringLiteralUnion(member);
|
|
12100
|
-
if (sub.length === 0 && !isNullOrUndefinedLiteral(member)) {
|
|
12101
|
-
return [];
|
|
12102
|
-
}
|
|
12103
|
-
out.push(...sub);
|
|
12104
|
-
}
|
|
12105
|
-
return out;
|
|
12106
|
-
}
|
|
12107
|
-
return [];
|
|
12108
|
-
}
|
|
12109
|
-
function isNullOrUndefinedLiteral(typeNode) {
|
|
12110
|
-
if (Node11.isLiteralTypeNode(typeNode)) {
|
|
12111
|
-
const lit = typeNode.getLiteral();
|
|
12112
|
-
if (Node11.isNullLiteral(lit))
|
|
12113
|
-
return true;
|
|
12114
|
-
}
|
|
12115
|
-
const t = typeNode.getText();
|
|
12116
|
-
return t === "null" || t === "undefined";
|
|
12117
|
-
}
|
|
12118
|
-
function containsTemplateRef(typeNode) {
|
|
12119
|
-
const text = typeNode.getText();
|
|
12120
|
-
return /\bTemplateRef\b/.test(text);
|
|
12121
|
-
}
|
|
12122
|
-
|
|
12123
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-decorator-input.js
|
|
12124
|
-
function extractDecoratorInput(field) {
|
|
12125
|
-
const decorator = field.getDecorator("Input");
|
|
12126
|
-
if (!decorator)
|
|
12127
|
-
return null;
|
|
12128
|
-
const fieldName = field.getName();
|
|
12129
|
-
const args = decorator.getArguments();
|
|
12130
|
-
let alias = null;
|
|
12131
|
-
let required = false;
|
|
12132
|
-
let transformIsBoolean = false;
|
|
12133
|
-
let transformIsNumber = false;
|
|
12134
|
-
if (args.length === 1) {
|
|
12135
|
-
const arg = args[0];
|
|
12136
|
-
if (Node12.isStringLiteral(arg) || Node12.isNoSubstitutionTemplateLiteral(arg)) {
|
|
12137
|
-
alias = arg.getLiteralText();
|
|
12138
|
-
} else if (Node12.isObjectLiteralExpression(arg)) {
|
|
12139
|
-
const aliasProp = arg.getProperty("alias");
|
|
12140
|
-
if (aliasProp && Node12.isPropertyAssignment(aliasProp)) {
|
|
12141
|
-
const init = aliasProp.getInitializer();
|
|
12142
|
-
if (init && (Node12.isStringLiteral(init) || Node12.isNoSubstitutionTemplateLiteral(init))) {
|
|
12143
|
-
alias = init.getLiteralText();
|
|
12144
|
-
}
|
|
12145
|
-
}
|
|
12146
|
-
const requiredProp = arg.getProperty("required");
|
|
12147
|
-
if (requiredProp && Node12.isPropertyAssignment(requiredProp)) {
|
|
12148
|
-
const init = requiredProp.getInitializer();
|
|
12149
|
-
if (init?.getText() === "true")
|
|
12150
|
-
required = true;
|
|
12151
|
-
}
|
|
12152
|
-
const transformProp = arg.getProperty("transform");
|
|
12153
|
-
if (transformProp && Node12.isPropertyAssignment(transformProp)) {
|
|
12154
|
-
const transformText = transformProp.getInitializer()?.getText() ?? "";
|
|
12155
|
-
if (/\bbooleanAttribute\b/.test(transformText))
|
|
12156
|
-
transformIsBoolean = true;
|
|
12157
|
-
if (/\bnumberAttribute\b/.test(transformText))
|
|
12158
|
-
transformIsNumber = true;
|
|
12159
|
-
}
|
|
12160
|
-
}
|
|
12161
|
-
}
|
|
12162
|
-
let typeNode;
|
|
12163
|
-
let defaultValue;
|
|
12164
|
-
if (Node12.isSetAccessorDeclaration(field)) {
|
|
12165
|
-
const param = field.getParameters()[0];
|
|
12166
|
-
typeNode = param?.getTypeNode();
|
|
12167
|
-
} else if (Node12.isGetAccessorDeclaration(field)) {
|
|
12168
|
-
const parent = field.getParent();
|
|
12169
|
-
const companionSetter = parent && Node12.isClassDeclaration(parent) ? parent.getSetAccessor(fieldName) : void 0;
|
|
12170
|
-
if (companionSetter) {
|
|
12171
|
-
typeNode = companionSetter.getParameters()[0]?.getTypeNode();
|
|
12172
|
-
}
|
|
12173
|
-
if (!typeNode)
|
|
12174
|
-
typeNode = field.getReturnTypeNode();
|
|
12175
|
-
} else {
|
|
12176
|
-
typeNode = field.getTypeNode();
|
|
12177
|
-
const initializer = field.getInitializer();
|
|
12178
|
-
if (initializer)
|
|
12179
|
-
defaultValue = initializer.getText();
|
|
12180
|
-
}
|
|
12181
|
-
const resolved = resolvePropType(typeNode);
|
|
12182
|
-
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
12183
|
-
const name = alias ?? fieldName;
|
|
12184
|
-
const prop = {
|
|
12185
|
-
name,
|
|
12186
|
-
type: typeText,
|
|
12187
|
-
required,
|
|
12188
|
-
sourceStartLine: field.getStartLineNumber(),
|
|
12189
|
-
sourceEndLine: field.getEndLineNumber()
|
|
12190
|
-
};
|
|
12191
|
-
if (defaultValue !== void 0)
|
|
12192
|
-
prop.defaultValue = defaultValue;
|
|
12193
|
-
if (resolved.allowedValues && !transformIsBoolean && !transformIsNumber) {
|
|
12194
|
-
prop.allowedValues = resolved.allowedValues;
|
|
12195
|
-
}
|
|
12196
|
-
return prop;
|
|
12197
|
-
}
|
|
12198
|
-
|
|
12199
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-signal-input.js
|
|
12200
|
-
import { Node as Node13 } from "ts-morph";
|
|
12201
|
-
function extractSignalInput(field) {
|
|
12202
|
-
const init = field.getInitializer();
|
|
12203
|
-
if (!init || !Node13.isCallExpression(init))
|
|
12204
|
-
return null;
|
|
12205
|
-
const callee = init.getExpression();
|
|
12206
|
-
let required = false;
|
|
12207
|
-
if (Node13.isIdentifier(callee)) {
|
|
12208
|
-
if (callee.getText() !== "input")
|
|
12209
|
-
return null;
|
|
12210
|
-
} else if (Node13.isPropertyAccessExpression(callee)) {
|
|
12211
|
-
const left = callee.getExpression();
|
|
12212
|
-
const right = callee.getName();
|
|
12213
|
-
if (!Node13.isIdentifier(left) || left.getText() !== "input" || right !== "required")
|
|
12214
|
-
return null;
|
|
12215
|
-
required = true;
|
|
12216
|
-
} else {
|
|
12217
|
-
return null;
|
|
12218
|
-
}
|
|
12219
|
-
const fieldName = field.getName();
|
|
12220
|
-
const args = init.getArguments();
|
|
12221
|
-
let defaultValue;
|
|
12222
|
-
let configArg;
|
|
12223
|
-
if (required) {
|
|
12224
|
-
configArg = args[0];
|
|
12225
|
-
} else {
|
|
12226
|
-
const first = args[0];
|
|
12227
|
-
if (first) {
|
|
12228
|
-
defaultValue = first.getText();
|
|
12229
|
-
configArg = args[1];
|
|
12230
|
-
}
|
|
12231
|
-
}
|
|
12232
|
-
let alias = null;
|
|
12233
|
-
let transformIsBoolean = false;
|
|
12234
|
-
let transformIsNumber = false;
|
|
12235
|
-
if (configArg && Node13.isObjectLiteralExpression(configArg)) {
|
|
12236
|
-
const aliasProp = configArg.getProperty("alias");
|
|
12237
|
-
if (aliasProp && Node13.isPropertyAssignment(aliasProp)) {
|
|
12238
|
-
const aliasInit = aliasProp.getInitializer();
|
|
12239
|
-
if (aliasInit && (Node13.isStringLiteral(aliasInit) || Node13.isNoSubstitutionTemplateLiteral(aliasInit))) {
|
|
12240
|
-
alias = aliasInit.getLiteralText();
|
|
12241
|
-
}
|
|
12242
|
-
}
|
|
12243
|
-
const transformProp = configArg.getProperty("transform");
|
|
12244
|
-
if (transformProp && Node13.isPropertyAssignment(transformProp)) {
|
|
12245
|
-
const transformText = transformProp.getInitializer()?.getText() ?? "";
|
|
12246
|
-
if (/\bbooleanAttribute\b/.test(transformText))
|
|
12247
|
-
transformIsBoolean = true;
|
|
12248
|
-
if (/\bnumberAttribute\b/.test(transformText))
|
|
12249
|
-
transformIsNumber = true;
|
|
12250
|
-
}
|
|
12251
|
-
}
|
|
12252
|
-
const typeArg = init.getTypeArguments()[0];
|
|
12253
|
-
const resolved = resolvePropType(typeArg);
|
|
12254
|
-
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
12255
|
-
const name = alias ?? fieldName;
|
|
12256
|
-
const prop = {
|
|
12257
|
-
name,
|
|
12258
|
-
type: typeText,
|
|
12259
|
-
required,
|
|
12260
|
-
sourceStartLine: field.getStartLineNumber(),
|
|
12261
|
-
sourceEndLine: field.getEndLineNumber()
|
|
12262
|
-
};
|
|
12263
|
-
if (defaultValue !== void 0)
|
|
12264
|
-
prop.defaultValue = defaultValue;
|
|
12265
|
-
if (resolved.allowedValues && !transformIsBoolean && !transformIsNumber) {
|
|
12266
|
-
prop.allowedValues = resolved.allowedValues;
|
|
12267
|
-
}
|
|
12268
|
-
return prop;
|
|
12269
|
-
}
|
|
12270
|
-
|
|
12271
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/parse-inputs-array-entry.js
|
|
12272
|
-
function parseInputsArrayEntry(entry) {
|
|
12273
|
-
const trimmed = entry.trim();
|
|
12274
|
-
if (!trimmed)
|
|
12275
|
-
return null;
|
|
12276
|
-
const parts = trimmed.split(":");
|
|
12277
|
-
if (parts.length === 1) {
|
|
12278
|
-
return { fieldName: parts[0].trim(), alias: null };
|
|
12279
|
-
}
|
|
12280
|
-
if (parts.length === 2) {
|
|
12281
|
-
const field = parts[0].trim();
|
|
12282
|
-
const alias = parts[1].trim();
|
|
12283
|
-
if (!field || !alias)
|
|
12284
|
-
return null;
|
|
12285
|
-
return { fieldName: field, alias };
|
|
12286
|
-
}
|
|
12287
|
-
return null;
|
|
12288
|
-
}
|
|
12289
|
-
|
|
12290
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/props/extract-props.js
|
|
12291
|
-
var MAX_BASE_CHAIN = 10;
|
|
12292
|
-
function collectClassChain(cls) {
|
|
12293
|
-
const chain = [cls];
|
|
12294
|
-
const seen = /* @__PURE__ */ new Set([cls]);
|
|
12295
|
-
let current = cls;
|
|
12296
|
-
for (let i = 0; i < MAX_BASE_CHAIN; i++) {
|
|
12297
|
-
let base;
|
|
12298
|
-
try {
|
|
12299
|
-
base = current.getBaseClass();
|
|
12300
|
-
} catch {
|
|
12301
|
-
break;
|
|
12302
|
-
}
|
|
12303
|
-
if (!base || seen.has(base))
|
|
12304
|
-
break;
|
|
12305
|
-
chain.push(base);
|
|
12306
|
-
seen.add(base);
|
|
12307
|
-
current = base;
|
|
12308
|
-
}
|
|
12309
|
-
return chain;
|
|
12310
|
-
}
|
|
12311
|
-
function extractProps2(cls, meta) {
|
|
12312
|
-
const byName = /* @__PURE__ */ new Map();
|
|
12313
|
-
const chain = collectClassChain(cls);
|
|
12314
|
-
for (const klass of chain) {
|
|
12315
|
-
for (const field of klass.getProperties()) {
|
|
12316
|
-
const prop = extractDecoratorInput(field);
|
|
12317
|
-
if (prop && !byName.has(prop.name))
|
|
12318
|
-
byName.set(prop.name, prop);
|
|
12319
|
-
}
|
|
12320
|
-
for (const setter of klass.getSetAccessors()) {
|
|
12321
|
-
const prop = extractDecoratorInput(setter);
|
|
12322
|
-
if (prop && !byName.has(prop.name))
|
|
12323
|
-
byName.set(prop.name, prop);
|
|
12324
|
-
}
|
|
12325
|
-
for (const getter of klass.getGetAccessors()) {
|
|
12326
|
-
const prop = extractDecoratorInput(getter);
|
|
12327
|
-
if (prop && !byName.has(prop.name))
|
|
12328
|
-
byName.set(prop.name, prop);
|
|
12329
|
-
}
|
|
12330
|
-
for (const field of klass.getProperties()) {
|
|
12331
|
-
const prop = extractSignalInput(field);
|
|
12332
|
-
if (prop && !byName.has(prop.name))
|
|
12333
|
-
byName.set(prop.name, prop);
|
|
12334
|
-
}
|
|
12335
|
-
}
|
|
12336
|
-
for (const entry of meta.inputsArray) {
|
|
12337
|
-
const parsed = parseInputsArrayEntry(entry);
|
|
12338
|
-
if (!parsed)
|
|
12339
|
-
continue;
|
|
12340
|
-
const name = parsed.alias ?? parsed.fieldName;
|
|
12341
|
-
if (byName.has(name))
|
|
12342
|
-
continue;
|
|
12343
|
-
byName.set(name, { name, type: "any", required: false });
|
|
12344
|
-
}
|
|
12345
|
-
return [...byName.values()];
|
|
12346
|
-
}
|
|
12347
|
-
|
|
12348
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-component-metadata.js
|
|
12349
|
-
import { dirname as dirname10, resolve as resolve12 } from "node:path";
|
|
12350
|
-
|
|
12351
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/normalize-component-name.js
|
|
12352
|
-
var SUFFIXES = ["Component", "Directive"];
|
|
12353
|
-
function normalizeComponentName2(className) {
|
|
12354
|
-
for (const suffix of SUFFIXES) {
|
|
12355
|
-
if (className.endsWith(suffix) && className.length > suffix.length) {
|
|
12356
|
-
return className.slice(0, -suffix.length);
|
|
12357
|
-
}
|
|
12358
|
-
}
|
|
12359
|
-
return className;
|
|
12360
|
-
}
|
|
12361
|
-
|
|
12362
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-decorator-string.js
|
|
12363
|
-
import { Node as Node14 } from "ts-morph";
|
|
12364
|
-
function readDecoratorString(obj, propName) {
|
|
12365
|
-
const prop = obj.getProperty(propName);
|
|
12366
|
-
if (!prop || !Node14.isPropertyAssignment(prop))
|
|
12367
|
-
return null;
|
|
12368
|
-
const init = prop.getInitializer();
|
|
12369
|
-
if (!init)
|
|
12370
|
-
return null;
|
|
12371
|
-
if (Node14.isStringLiteral(init) || Node14.isNoSubstitutionTemplateLiteral(init)) {
|
|
12372
|
-
return init.getLiteralText();
|
|
12373
|
-
}
|
|
12374
|
-
return null;
|
|
12375
|
-
}
|
|
12376
|
-
function readDecoratorStringArray(obj, propName) {
|
|
12377
|
-
const prop = obj.getProperty(propName);
|
|
12378
|
-
if (!prop || !Node14.isPropertyAssignment(prop))
|
|
12379
|
-
return [];
|
|
12380
|
-
const init = prop.getInitializer();
|
|
12381
|
-
if (!init || !Node14.isArrayLiteralExpression(init))
|
|
12382
|
-
return [];
|
|
12383
|
-
const out = [];
|
|
12384
|
-
for (const el of init.getElements()) {
|
|
12385
|
-
if (Node14.isStringLiteral(el) || Node14.isNoSubstitutionTemplateLiteral(el)) {
|
|
12386
|
-
out.push(el.getLiteralText());
|
|
12387
|
-
}
|
|
12388
|
-
}
|
|
12389
|
-
return out;
|
|
12390
|
-
}
|
|
12391
|
-
|
|
12392
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-component-metadata.js
|
|
12393
|
-
function readComponentMetadata(cls, sourceFilePath) {
|
|
12394
|
-
const obj = findComponentDecorator(cls);
|
|
12395
|
-
if (!obj)
|
|
12396
|
-
return null;
|
|
12397
|
-
const className = cls.getName();
|
|
12398
|
-
if (!className)
|
|
12399
|
-
return null;
|
|
12400
|
-
const rawSelector = readDecoratorString(obj, "selector");
|
|
12401
|
-
const inlineTemplate = readDecoratorString(obj, "template");
|
|
12402
|
-
const templateUrlRel = readDecoratorString(obj, "templateUrl");
|
|
12403
|
-
const inputsArray = readDecoratorStringArray(obj, "inputs");
|
|
12404
|
-
const templatePath = templateUrlRel ? resolve12(dirname10(sourceFilePath), templateUrlRel) : null;
|
|
12405
|
-
const decorator = cls.getDecorator("Component");
|
|
12406
|
-
const decoratorLine = decorator?.getStartLineNumber() ?? cls.getStartLineNumber();
|
|
12407
|
-
return {
|
|
12408
|
-
className,
|
|
12409
|
-
normalizedName: normalizeComponentName2(className),
|
|
12410
|
-
rawSelector,
|
|
12411
|
-
inlineTemplate,
|
|
12412
|
-
templatePath,
|
|
12413
|
-
inputsArray,
|
|
12414
|
-
decoratorLine
|
|
12415
|
-
};
|
|
12416
|
-
}
|
|
12417
|
-
|
|
12418
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/parse-ng-content-elements.js
|
|
12419
|
-
function parseNgContentElements(templateHtml) {
|
|
12420
|
-
const out = [];
|
|
12421
|
-
const tagRe = /<ng-content\b([^>]*?)\/?>/gi;
|
|
12422
|
-
for (const match2 of templateHtml.matchAll(tagRe)) {
|
|
12423
|
-
const attrs = match2[1] ?? "";
|
|
12424
|
-
const selectMatch = attrs.match(/\bselect\s*=\s*(?:"([^"]*)"|'([^']*)')/);
|
|
12425
|
-
const rawSelect = selectMatch ? selectMatch[1] ?? selectMatch[2] ?? null : null;
|
|
12426
|
-
const sourceLine = countLines(templateHtml, match2.index ?? 0);
|
|
12427
|
-
out.push({ rawSelect, sourceLine });
|
|
12428
|
-
}
|
|
12429
|
-
return out;
|
|
12430
|
-
}
|
|
12431
|
-
function countLines(text, offset) {
|
|
12432
|
-
let line = 1;
|
|
12433
|
-
for (let i = 0; i < offset && i < text.length; i++) {
|
|
12434
|
-
if (text.charCodeAt(i) === 10)
|
|
12435
|
-
line++;
|
|
12436
|
-
}
|
|
12437
|
-
return line;
|
|
12438
|
-
}
|
|
12439
|
-
|
|
12440
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/resolve-template-source.js
|
|
12441
|
-
import { readFile as readFile7 } from "node:fs/promises";
|
|
12442
|
-
async function resolveTemplateSource(meta) {
|
|
12443
|
-
if (meta.inlineTemplate !== null)
|
|
12444
|
-
return meta.inlineTemplate;
|
|
12445
|
-
if (meta.templatePath === null)
|
|
12446
|
-
return null;
|
|
12447
|
-
try {
|
|
12448
|
-
return await readFile7(meta.templatePath, "utf8");
|
|
12449
|
-
} catch {
|
|
12450
|
-
return null;
|
|
12451
|
-
}
|
|
12452
|
-
}
|
|
12453
|
-
|
|
12454
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/strip-library-prefix.js
|
|
12455
|
-
var KNOWN_PREFIXES = ["Mat", "Cdk", "Nz", "Cds", "Ibm", "Clr", "Hlm", "Brn", "Tui", "Nb", "Fd", "P", "Ng"];
|
|
12456
|
-
function stripLibraryPrefix(name) {
|
|
12457
|
-
for (const prefix of KNOWN_PREFIXES) {
|
|
12458
|
-
if (name.startsWith(prefix) && name.length > prefix.length) {
|
|
12459
|
-
const rest = name.slice(prefix.length);
|
|
12460
|
-
if (rest[0] && rest[0] === rest[0].toUpperCase()) {
|
|
12461
|
-
return rest;
|
|
12462
|
-
}
|
|
12463
|
-
}
|
|
12464
|
-
}
|
|
12465
|
-
return name;
|
|
12466
|
-
}
|
|
12467
|
-
|
|
12468
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/derive-slot-name.js
|
|
12469
|
-
function deriveSlotName(rawSelect, parentNormalizedName) {
|
|
12470
|
-
if (!rawSelect || rawSelect.trim() === "")
|
|
12471
|
-
return "children";
|
|
12472
|
-
if (rawSelect.includes(",")) {
|
|
12473
|
-
const first = rawSelect.split(",")[0].trim();
|
|
12474
|
-
return deriveSingleSelectorName(first, parentNormalizedName);
|
|
12475
|
-
}
|
|
12476
|
-
return deriveSingleSelectorName(rawSelect.trim(), parentNormalizedName);
|
|
12477
|
-
}
|
|
12478
|
-
function deriveSingleSelectorName(sel, parentNormalizedName) {
|
|
12479
|
-
const slotAttrMatch = sel.match(/^\[\s*slot\s*=\s*['"]?([^'"\]]+)['"]?\s*\]$/);
|
|
12480
|
-
if (slotAttrMatch)
|
|
12481
|
-
return slotAttrMatch[1].trim();
|
|
12482
|
-
if (sel.startsWith(".")) {
|
|
12483
|
-
const last = sel.slice(1).split("-").pop() ?? sel.slice(1);
|
|
12484
|
-
return kebabToCamel2(last);
|
|
12485
|
-
}
|
|
12486
|
-
const attrMatch = sel.match(/^\[([^=\]]+)\]$/);
|
|
12487
|
-
if (attrMatch) {
|
|
12488
|
-
const attr = attrMatch[1].trim();
|
|
12489
|
-
const stripped = tryStripSubComponentOrLibraryPrefix(attr, parentNormalizedName);
|
|
12490
|
-
return stripped || kebabToCamel2(attr);
|
|
12491
|
-
}
|
|
12492
|
-
const elMatch = sel.match(/^([a-zA-Z][a-zA-Z0-9-]*)/);
|
|
12493
|
-
if (elMatch) {
|
|
12494
|
-
const tag = elMatch[1];
|
|
12495
|
-
const stripped = tryStripSubComponentOrLibraryPrefix(tag, parentNormalizedName);
|
|
12496
|
-
return stripped || kebabToCamel2(tag);
|
|
12497
|
-
}
|
|
12498
|
-
return sel.replace(/\s+/g, "");
|
|
12499
|
-
}
|
|
12500
|
-
function tryStripSubComponentOrLibraryPrefix(ident, parentNormalizedName) {
|
|
12501
|
-
const parentKebab = pascalToKebab(parentNormalizedName);
|
|
12502
|
-
if (parentKebab && ident.startsWith(`${parentKebab}-`)) {
|
|
12503
|
-
return kebabToCamel2(ident.slice(parentKebab.length + 1));
|
|
12504
|
-
}
|
|
12505
|
-
const asPascal = kebabToPascal2(ident);
|
|
12506
|
-
const stripped = stripLibraryPrefix(asPascal);
|
|
12507
|
-
if (stripped !== asPascal) {
|
|
12508
|
-
return stripped.charAt(0).toLowerCase() + stripped.slice(1);
|
|
12509
|
-
}
|
|
12510
|
-
return null;
|
|
12511
|
-
}
|
|
12512
|
-
function kebabToCamel2(s) {
|
|
12513
|
-
return s.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase());
|
|
12514
|
-
}
|
|
12515
|
-
function kebabToPascal2(s) {
|
|
12516
|
-
const camel = kebabToCamel2(s);
|
|
12517
|
-
return camel.charAt(0).toUpperCase() + camel.slice(1);
|
|
12518
|
-
}
|
|
12519
|
-
function pascalToKebab(s) {
|
|
12520
|
-
return s.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
12521
|
-
}
|
|
12522
|
-
|
|
12523
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-content-child-queries.js
|
|
12524
|
-
import { Node as Node15 } from "ts-morph";
|
|
12525
|
-
function extractContentChildQueries(cls) {
|
|
12526
|
-
const out = [];
|
|
12527
|
-
for (const field of cls.getProperties()) {
|
|
12528
|
-
const fieldName = field.getName();
|
|
12529
|
-
const init = field.getInitializer();
|
|
12530
|
-
if (init && Node15.isCallExpression(init)) {
|
|
12531
|
-
const callee = init.getExpression();
|
|
12532
|
-
if (Node15.isIdentifier(callee)) {
|
|
12533
|
-
const name = callee.getText();
|
|
12534
|
-
if (name === "contentChild" || name === "contentChildren") {
|
|
12535
|
-
const first = init.getArguments()[0];
|
|
12536
|
-
const allowed = resolveClassIdentifierArg(first);
|
|
12537
|
-
out.push(buildSlot(fieldName, allowed));
|
|
12538
|
-
continue;
|
|
12539
|
-
}
|
|
12540
|
-
}
|
|
12541
|
-
}
|
|
12542
|
-
for (const decName of ["ContentChild", "ContentChildren"]) {
|
|
12543
|
-
const dec = field.getDecorator(decName);
|
|
12544
|
-
if (dec) {
|
|
12545
|
-
const first = dec.getArguments()[0];
|
|
12546
|
-
const allowed = resolveClassIdentifierArg(first);
|
|
12547
|
-
out.push(buildSlot(fieldName, allowed));
|
|
12548
|
-
break;
|
|
12549
|
-
}
|
|
12550
|
-
}
|
|
12551
|
-
}
|
|
12552
|
-
return out;
|
|
12553
|
-
}
|
|
12554
|
-
function resolveClassIdentifierArg(arg) {
|
|
12555
|
-
if (!arg)
|
|
12556
|
-
return [];
|
|
12557
|
-
if (Node15.isStringLiteral(arg) || Node15.isNoSubstitutionTemplateLiteral(arg))
|
|
12558
|
-
return [];
|
|
12559
|
-
if (Node15.isIdentifier(arg))
|
|
12560
|
-
return [arg.getText()];
|
|
12561
|
-
return [];
|
|
12562
|
-
}
|
|
12563
|
-
function buildSlot(name, allowed) {
|
|
12564
|
-
const slot = {
|
|
12565
|
-
name,
|
|
12566
|
-
isDefault: false
|
|
12567
|
-
};
|
|
12568
|
-
if (allowed.length > 0)
|
|
12569
|
-
slot.allowedComponents = allowed;
|
|
12570
|
-
return slot;
|
|
12571
|
-
}
|
|
12572
|
-
|
|
12573
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-template-ref-slots.js
|
|
12574
|
-
function extractTemplateRefSlots(props) {
|
|
12575
|
-
const nextProps = [];
|
|
12576
|
-
const slots = [];
|
|
12577
|
-
for (const prop of props) {
|
|
12578
|
-
const type = prop.type;
|
|
12579
|
-
const hasTemplateRef = /\bTemplateRef\b/.test(type);
|
|
12580
|
-
if (!hasTemplateRef) {
|
|
12581
|
-
nextProps.push(prop);
|
|
12582
|
-
continue;
|
|
12583
|
-
}
|
|
12584
|
-
const isPureTemplateRef = /^\s*TemplateRef<[^>]*>\s*(\|\s*(null|undefined)\s*)*$/.test(type);
|
|
12585
|
-
if (!isPureTemplateRef) {
|
|
12586
|
-
nextProps.push(prop);
|
|
12587
|
-
}
|
|
12588
|
-
slots.push({ name: prop.name, isDefault: false });
|
|
12589
|
-
}
|
|
12590
|
-
return { props: nextProps, slots };
|
|
12591
|
-
}
|
|
12592
|
-
|
|
12593
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/slots/extract-slots.js
|
|
12594
|
-
async function extractSlots3(cls, meta, props) {
|
|
12595
|
-
const byName = /* @__PURE__ */ new Map();
|
|
12596
|
-
const template = await resolveTemplateSource(meta);
|
|
12597
|
-
if (template) {
|
|
12598
|
-
for (const el of parseNgContentElements(template)) {
|
|
12599
|
-
const name = deriveSlotName(el.rawSelect, meta.normalizedName);
|
|
12600
|
-
if (byName.has(name))
|
|
12601
|
-
continue;
|
|
12602
|
-
byName.set(name, {
|
|
12603
|
-
name,
|
|
12604
|
-
isDefault: el.rawSelect === null
|
|
12605
|
-
});
|
|
12606
|
-
}
|
|
12607
|
-
}
|
|
12608
|
-
for (const slot of extractContentChildQueries(cls)) {
|
|
12609
|
-
if (!byName.has(slot.name))
|
|
12610
|
-
byName.set(slot.name, slot);
|
|
12611
|
-
}
|
|
12612
|
-
const split = extractTemplateRefSlots(props);
|
|
12613
|
-
for (const slot of split.slots) {
|
|
12614
|
-
if (!byName.has(slot.name))
|
|
12615
|
-
byName.set(slot.name, slot);
|
|
12616
|
-
}
|
|
12617
|
-
return { props: split.props, slots: [...byName.values()] };
|
|
12618
|
-
}
|
|
12619
|
-
|
|
12620
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
|
|
12621
|
-
async function extractAngularComponents(filePaths, onProgress, _opts) {
|
|
12622
|
-
const components = [];
|
|
12623
|
-
const warnings = [];
|
|
12624
|
-
let filesProcessed = 0;
|
|
12625
|
-
const project = new Project7({
|
|
12626
|
-
useInMemoryFileSystem: false,
|
|
12627
|
-
skipAddingFilesFromTsConfig: true,
|
|
12628
|
-
compilerOptions: {
|
|
12629
|
-
target: ScriptTarget2.ES2022,
|
|
12630
|
-
module: ModuleKind2.ESNext,
|
|
12631
|
-
experimentalDecorators: true,
|
|
12632
|
-
emitDecoratorMetadata: false,
|
|
12633
|
-
allowJs: false
|
|
12634
|
-
}
|
|
12635
|
-
});
|
|
12636
|
-
for (const filePath of filePaths) {
|
|
12637
|
-
try {
|
|
12638
|
-
const source = await readFile8(filePath, "utf8");
|
|
12639
|
-
const sourceFile = project.createSourceFile(filePath, source, { overwrite: true });
|
|
12640
|
-
for (const cls of sourceFile.getClasses()) {
|
|
12641
|
-
if (!hasComponentDecorator(cls))
|
|
12642
|
-
continue;
|
|
12643
|
-
if (!findComponentDecorator(cls)) {
|
|
12644
|
-
warnings.push(`${filePath}: ${cls.getName() ?? "<anonymous>"} has @Component with a non-literal argument; skipped.`);
|
|
12645
|
-
continue;
|
|
12646
|
-
}
|
|
12647
|
-
const meta = readComponentMetadata(cls, filePath);
|
|
12648
|
-
if (!meta)
|
|
12649
|
-
continue;
|
|
12650
|
-
const propsOnly = extractProps2(cls, meta);
|
|
12651
|
-
const { props, slots } = await extractSlots3(cls, meta, propsOnly);
|
|
12652
|
-
const partial = {
|
|
12653
|
-
name: meta.className,
|
|
12654
|
-
source: filePath,
|
|
12655
|
-
framework: "angular",
|
|
12656
|
-
props,
|
|
12657
|
-
slots: normalizeSlots(slots),
|
|
12658
|
-
sourcePath: filePath
|
|
12659
|
-
};
|
|
12660
|
-
const score = computeExtractionScore(partial);
|
|
12661
|
-
partial.extractionConfidence = score.confidence;
|
|
12662
|
-
partial.reviewReasons = score.reasons;
|
|
12663
|
-
partial.needsReview = deriveNeedsReview(score.confidence);
|
|
12664
|
-
components.push(partial);
|
|
12665
|
-
}
|
|
12666
|
-
sourceFile.forget();
|
|
12667
|
-
} catch (err) {
|
|
12668
|
-
warnings.push(`${filePath}: Angular extractor failed \u2014 ${err instanceof Error ? err.message : String(err)}`);
|
|
12669
|
-
} finally {
|
|
12670
|
-
filesProcessed++;
|
|
12671
|
-
if (onProgress)
|
|
12672
|
-
onProgress({ filesProcessed, componentsFound: components.length });
|
|
12673
|
-
}
|
|
12674
|
-
}
|
|
12675
|
-
return {
|
|
12676
|
-
components: components.sort((a, b) => a.name.localeCompare(b.name)),
|
|
12677
|
-
warnings
|
|
12678
|
-
};
|
|
12679
|
-
}
|
|
12680
|
-
function normalizeSlots(slots) {
|
|
12681
|
-
let fallbackIndex = 0;
|
|
12682
|
-
return slots.map((slot) => {
|
|
12683
|
-
if (slot.name.trim())
|
|
12684
|
-
return slot;
|
|
12685
|
-
const name = fallbackIndex === 0 ? "children" : `slot_${fallbackIndex}`;
|
|
12686
|
-
fallbackIndex++;
|
|
12687
|
-
return { ...slot, name };
|
|
12688
|
-
});
|
|
12689
|
-
}
|
|
12690
|
-
|
|
12691
|
-
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/is-angular-source-file.js
|
|
12692
|
-
import { openSync, readSync, closeSync, statSync as statSync4 } from "node:fs";
|
|
12693
|
-
var HEAD_BYTES = 32 * 1024;
|
|
12694
|
-
var buffer = Buffer.alloc(HEAD_BYTES);
|
|
12695
|
-
function isAngularSourceFile(filePath) {
|
|
12696
|
-
if (!/\.[cm]?ts$/.test(filePath))
|
|
12697
|
-
return false;
|
|
12698
|
-
if (filePath.endsWith(".d.ts"))
|
|
12699
|
-
return false;
|
|
12700
|
-
try {
|
|
12701
|
-
const stats = statSync4(filePath);
|
|
12702
|
-
const toRead = Math.min(HEAD_BYTES, stats.size);
|
|
12703
|
-
if (toRead === 0)
|
|
12704
|
-
return false;
|
|
12705
|
-
const fd = openSync(filePath, "r");
|
|
12706
|
-
try {
|
|
12707
|
-
const bytesRead = readSync(fd, buffer, 0, toRead, 0);
|
|
12708
|
-
const head = buffer.subarray(0, bytesRead).toString("utf8");
|
|
12709
|
-
return head.includes("@angular/core");
|
|
12710
|
-
} finally {
|
|
12711
|
-
closeSync(fd);
|
|
12712
|
-
}
|
|
12713
|
-
} catch {
|
|
12714
|
-
return false;
|
|
12715
|
-
}
|
|
12716
|
-
}
|
|
12717
|
-
|
|
12718
11985
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/services/run-extraction-service.js
|
|
12719
11986
|
var extractors = [
|
|
12720
11987
|
{
|
|
@@ -12742,13 +12009,6 @@ var extractors = [
|
|
|
12742
12009
|
fileFilter: (f) => f.endsWith(".astro"),
|
|
12743
12010
|
extract: extractAstroComponents
|
|
12744
12011
|
},
|
|
12745
|
-
{
|
|
12746
|
-
// Must run BEFORE web-components (both claim bare .ts). The sniff reads
|
|
12747
|
-
// the file head looking for `@angular/core` so we only claim real Angular files.
|
|
12748
|
-
name: "angular",
|
|
12749
|
-
fileFilter: (f) => isAngularSourceFile(f),
|
|
12750
|
-
extract: extractAngularComponents
|
|
12751
|
-
},
|
|
12752
12012
|
{
|
|
12753
12013
|
name: "web-components",
|
|
12754
12014
|
fileFilter: (f) => /\.[jt]s$/.test(f) && !/\.[jt]sx$/.test(f) && !f.endsWith(".d.ts"),
|
|
@@ -13224,16 +12484,16 @@ function applyCompositionEdges(components, edges) {
|
|
|
13224
12484
|
|
|
13225
12485
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
|
|
13226
12486
|
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
13227
|
-
import { dirname as
|
|
12487
|
+
import { dirname as dirname10, join as join10, resolve as resolve12 } from "node:path";
|
|
13228
12488
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
13229
12489
|
function resolvePromptPath(fileName) {
|
|
13230
|
-
const thisDir =
|
|
12490
|
+
const thisDir = dirname10(fileURLToPath3(import.meta.url));
|
|
13231
12491
|
let dir = thisDir;
|
|
13232
12492
|
for (; ; ) {
|
|
13233
12493
|
const candidate = join10(dir, "prompts");
|
|
13234
12494
|
if (existsSync7(candidate))
|
|
13235
12495
|
return join10(candidate, fileName);
|
|
13236
|
-
const parent =
|
|
12496
|
+
const parent = resolve12(dir, "..");
|
|
13237
12497
|
if (parent === dir) {
|
|
13238
12498
|
throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
|
|
13239
12499
|
}
|
|
@@ -13313,31 +12573,14 @@ ${f.content}`).join("\n\n");
|
|
|
13313
12573
|
}
|
|
13314
12574
|
|
|
13315
12575
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/constants/candidate-files.js
|
|
13316
|
-
var CANDIDATE_NAME_PATTERNS = [
|
|
13317
|
-
/mapping/i,
|
|
13318
|
-
/meta/i,
|
|
13319
|
-
/registry/i,
|
|
13320
|
-
/schema/i,
|
|
13321
|
-
/composition/i,
|
|
13322
|
-
/\.module\.ts$/i,
|
|
13323
|
-
/\.component\.ts$/i,
|
|
13324
|
-
/public[-_]api\.ts$/i,
|
|
13325
|
-
/^index\.ts$/i
|
|
13326
|
-
];
|
|
12576
|
+
var CANDIDATE_NAME_PATTERNS = [/mapping/i, /meta/i, /registry/i, /schema/i, /composition/i];
|
|
13327
12577
|
var CANDIDATE_CONTENT_MARKERS = [
|
|
13328
12578
|
"requiredParent",
|
|
13329
12579
|
"withParentType",
|
|
13330
12580
|
"allowedTagNames",
|
|
13331
12581
|
"createContext",
|
|
13332
12582
|
"MappingContext",
|
|
13333
|
-
"allowedComponents"
|
|
13334
|
-
"TemplateRef",
|
|
13335
|
-
"NG_VALUE_ACCESSOR",
|
|
13336
|
-
"ContentChild",
|
|
13337
|
-
"contentChild",
|
|
13338
|
-
"ng-content",
|
|
13339
|
-
"@NgModule",
|
|
13340
|
-
"standalone: true"
|
|
12583
|
+
"allowedComponents"
|
|
13341
12584
|
];
|
|
13342
12585
|
var PROMPT_CANDIDATE_TOKEN_BUDGET = 8e4;
|
|
13343
12586
|
|
|
@@ -13398,8 +12641,8 @@ ${fileDigest}`);
|
|
|
13398
12641
|
}
|
|
13399
12642
|
|
|
13400
12643
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
|
|
13401
|
-
import { dirname as
|
|
13402
|
-
function
|
|
12644
|
+
import { dirname as dirname11 } from "node:path";
|
|
12645
|
+
function kebabToPascal2(name) {
|
|
13403
12646
|
return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
|
|
13404
12647
|
}
|
|
13405
12648
|
function collectManifestEdges(files, componentNames) {
|
|
@@ -13421,7 +12664,7 @@ function collectManifestEdges(files, componentNames) {
|
|
|
13421
12664
|
const rawParentName = typeof component === "object" && component !== null && typeof component.name === "string" ? component.name : void 0;
|
|
13422
12665
|
if (!rawParentName)
|
|
13423
12666
|
continue;
|
|
13424
|
-
const parent =
|
|
12667
|
+
const parent = kebabToPascal2(rawParentName);
|
|
13425
12668
|
if (!componentNames.has(parent))
|
|
13426
12669
|
continue;
|
|
13427
12670
|
const variantsMeta = root.variantsMeta;
|
|
@@ -13441,7 +12684,7 @@ function collectManifestEdges(files, componentNames) {
|
|
|
13441
12684
|
const rawChildName = value.name;
|
|
13442
12685
|
if (typeof rawChildName !== "string")
|
|
13443
12686
|
continue;
|
|
13444
|
-
const child =
|
|
12687
|
+
const child = kebabToPascal2(rawChildName);
|
|
13445
12688
|
if (!componentNames.has(child) || child === parent)
|
|
13446
12689
|
continue;
|
|
13447
12690
|
const key = `${parent}::${child}`;
|
|
@@ -13462,8 +12705,8 @@ function collectAgentsDocEdges(files, components, componentNames) {
|
|
|
13462
12705
|
for (const file of files) {
|
|
13463
12706
|
if (!file.path.endsWith("AGENTS.md"))
|
|
13464
12707
|
continue;
|
|
13465
|
-
const docDir =
|
|
13466
|
-
const parent = components.find((c2) => c2.sourcePath &&
|
|
12708
|
+
const docDir = dirname11(file.path);
|
|
12709
|
+
const parent = components.find((c2) => c2.sourcePath && dirname11(c2.sourcePath) === docDir)?.name;
|
|
13467
12710
|
if (!parent || !componentNames.has(parent))
|
|
13468
12711
|
continue;
|
|
13469
12712
|
for (const line of file.content.split("\n")) {
|
|
@@ -13472,7 +12715,7 @@ function collectAgentsDocEdges(files, components, componentNames) {
|
|
|
13472
12715
|
continue;
|
|
13473
12716
|
for (const match2 of line.matchAll(BOLD_BACKTICK)) {
|
|
13474
12717
|
const raw = match2[1];
|
|
13475
|
-
const candidate = componentNames.has(raw) ? raw :
|
|
12718
|
+
const candidate = componentNames.has(raw) ? raw : kebabToPascal2(raw);
|
|
13476
12719
|
if (!componentNames.has(candidate) || candidate === parent)
|
|
13477
12720
|
continue;
|
|
13478
12721
|
const key = `${parent}::${candidate}`;
|
|
@@ -13788,7 +13031,7 @@ function validateExtractedComponents(components) {
|
|
|
13788
13031
|
}
|
|
13789
13032
|
|
|
13790
13033
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
|
|
13791
|
-
import { resolve as
|
|
13034
|
+
import { resolve as resolve14 } from "node:path";
|
|
13792
13035
|
|
|
13793
13036
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/create-component-id.js
|
|
13794
13037
|
import { createHash as createHash7 } from "node:crypto";
|
|
@@ -13799,7 +13042,7 @@ function createComponentId(name, resolvedSourcePath) {
|
|
|
13799
13042
|
|
|
13800
13043
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/resolve-component-source-path.js
|
|
13801
13044
|
import { access } from "node:fs/promises";
|
|
13802
|
-
import { isAbsolute, relative, resolve as
|
|
13045
|
+
import { isAbsolute, relative, resolve as resolve13 } from "node:path";
|
|
13803
13046
|
async function resolveComponentSourcePath(source, reviewRoot) {
|
|
13804
13047
|
if (isAbsolute(source)) {
|
|
13805
13048
|
try {
|
|
@@ -13809,7 +13052,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
|
|
|
13809
13052
|
throw new Error(`Unable to access component source at ${source}`);
|
|
13810
13053
|
}
|
|
13811
13054
|
}
|
|
13812
|
-
const candidate =
|
|
13055
|
+
const candidate = resolve13(reviewRoot, source);
|
|
13813
13056
|
const relativeToRoot = relative(reviewRoot, candidate);
|
|
13814
13057
|
if (relativeToRoot.startsWith("..") || relativeToRoot === ".." || isAbsolute(relativeToRoot)) {
|
|
13815
13058
|
throw new Error(`Resolved component source is outside the review root: ${source}. Pass --project-root <path> to set the correct base.`);
|
|
@@ -13824,7 +13067,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
|
|
|
13824
13067
|
|
|
13825
13068
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
|
|
13826
13069
|
async function loadReviewInput(components, options = {}) {
|
|
13827
|
-
const reviewRoot =
|
|
13070
|
+
const reviewRoot = resolve14(options.reviewRoot ?? process.cwd());
|
|
13828
13071
|
const records = await Promise.all(components.map(async (component) => {
|
|
13829
13072
|
let resolvedSourcePath;
|
|
13830
13073
|
try {
|
|
@@ -13859,19 +13102,19 @@ async function loadAndValidateForReview(sessionId, projectRoot) {
|
|
|
13859
13102
|
}
|
|
13860
13103
|
|
|
13861
13104
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
13862
|
-
import { access as access3, readFile as
|
|
13105
|
+
import { access as access3, readFile as readFile8 } from "node:fs/promises";
|
|
13863
13106
|
|
|
13864
13107
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
|
|
13865
|
-
import { access as access2, mkdir, readFile as
|
|
13108
|
+
import { access as access2, mkdir, readFile as readFile7, writeFile } from "node:fs/promises";
|
|
13866
13109
|
|
|
13867
13110
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
13868
|
-
import { resolve as
|
|
13111
|
+
import { resolve as resolve15 } from "node:path";
|
|
13869
13112
|
async function getRefineSessionPaths(sessionId, artifactsRoot) {
|
|
13870
|
-
const sessionDir2 =
|
|
13113
|
+
const sessionDir2 = resolve15(artifactsRoot, sessionId);
|
|
13871
13114
|
return {
|
|
13872
13115
|
sessionDir: sessionDir2,
|
|
13873
|
-
eventsPath:
|
|
13874
|
-
statePath:
|
|
13116
|
+
eventsPath: resolve15(sessionDir2, "events.jsonl"),
|
|
13117
|
+
statePath: resolve15(sessionDir2, "current-review-state.json")
|
|
13875
13118
|
};
|
|
13876
13119
|
}
|
|
13877
13120
|
|
|
@@ -13881,7 +13124,7 @@ async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
|
|
|
13881
13124
|
await mkdir(paths.sessionDir, { recursive: true });
|
|
13882
13125
|
try {
|
|
13883
13126
|
await access2(paths.statePath);
|
|
13884
|
-
const savedState = await
|
|
13127
|
+
const savedState = await readFile7(paths.statePath, "utf8");
|
|
13885
13128
|
return JSON.parse(savedState);
|
|
13886
13129
|
} catch {
|
|
13887
13130
|
await writeFile(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
|
|
@@ -13891,12 +13134,12 @@ async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
|
|
|
13891
13134
|
}
|
|
13892
13135
|
|
|
13893
13136
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-artifacts-root.js
|
|
13894
|
-
import { resolve as
|
|
13137
|
+
import { resolve as resolve16 } from "node:path";
|
|
13895
13138
|
function getRefineArtifactsRoot() {
|
|
13896
13139
|
if (process.env["EDS_REVIEW_ARTIFACTS_DIR"]) {
|
|
13897
|
-
return
|
|
13140
|
+
return resolve16(process.env["EDS_REVIEW_ARTIFACTS_DIR"]);
|
|
13898
13141
|
}
|
|
13899
|
-
return
|
|
13142
|
+
return resolve16(configRoot(), "reviews");
|
|
13900
13143
|
}
|
|
13901
13144
|
|
|
13902
13145
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/save-review-state.js
|
|
@@ -13912,7 +13155,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
13912
13155
|
let snapshot;
|
|
13913
13156
|
try {
|
|
13914
13157
|
await access3(paths.statePath);
|
|
13915
|
-
snapshot = JSON.parse(await
|
|
13158
|
+
snapshot = JSON.parse(await readFile8(paths.statePath, "utf8"));
|
|
13916
13159
|
} catch {
|
|
13917
13160
|
snapshot = await loadAndValidateForReview(sessionId, void 0);
|
|
13918
13161
|
snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
|
|
@@ -13950,7 +13193,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
13950
13193
|
}
|
|
13951
13194
|
|
|
13952
13195
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
|
|
13953
|
-
import { readFile as
|
|
13196
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
13954
13197
|
async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
13955
13198
|
if (names.length === 0)
|
|
13956
13199
|
return;
|
|
@@ -13966,7 +13209,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
|
13966
13209
|
const nameSet = new Set(names);
|
|
13967
13210
|
let snapshot;
|
|
13968
13211
|
try {
|
|
13969
|
-
snapshot = JSON.parse(await
|
|
13212
|
+
snapshot = JSON.parse(await readFile9(paths.statePath, "utf8"));
|
|
13970
13213
|
} catch {
|
|
13971
13214
|
return;
|
|
13972
13215
|
}
|
|
@@ -13975,7 +13218,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
|
13975
13218
|
}
|
|
13976
13219
|
|
|
13977
13220
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
|
|
13978
|
-
import { statSync as
|
|
13221
|
+
import { statSync as statSync4 } from "node:fs";
|
|
13979
13222
|
import path4 from "node:path";
|
|
13980
13223
|
|
|
13981
13224
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/build-scan-warnings.js
|
|
@@ -14030,9 +13273,7 @@ var EXCLUDED_SUFFIXES = [
|
|
|
14030
13273
|
".spec.ts",
|
|
14031
13274
|
".spec.tsx",
|
|
14032
13275
|
".test.ts",
|
|
14033
|
-
".test.tsx"
|
|
14034
|
-
".harness.ts",
|
|
14035
|
-
".harness.tsx"
|
|
13276
|
+
".test.tsx"
|
|
14036
13277
|
];
|
|
14037
13278
|
var IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
14038
13279
|
".changeset",
|
|
@@ -14050,12 +13291,9 @@ var IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
|
14050
13291
|
"dist",
|
|
14051
13292
|
"example",
|
|
14052
13293
|
"examples",
|
|
14053
|
-
"harness",
|
|
14054
|
-
"harnesses",
|
|
14055
13294
|
"node_modules",
|
|
14056
13295
|
"out",
|
|
14057
|
-
"storybook-static"
|
|
14058
|
-
"testing"
|
|
13296
|
+
"storybook-static"
|
|
14059
13297
|
]);
|
|
14060
13298
|
var DENYLISTED_EXACT_FILE_NAMES = /* @__PURE__ */ new Set([
|
|
14061
13299
|
"package.json",
|
|
@@ -14167,7 +13405,7 @@ function collectFiles(root, options = {}) {
|
|
|
14167
13405
|
const resolved = path4.resolve(root);
|
|
14168
13406
|
let stat5;
|
|
14169
13407
|
try {
|
|
14170
|
-
stat5 =
|
|
13408
|
+
stat5 = statSync4(resolved);
|
|
14171
13409
|
} catch (err) {
|
|
14172
13410
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
14173
13411
|
}
|
|
@@ -14223,7 +13461,7 @@ function generateUlid(now = Date.now()) {
|
|
|
14223
13461
|
}
|
|
14224
13462
|
|
|
14225
13463
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14226
|
-
import { readFile as
|
|
13464
|
+
import { readFile as readFile10 } from "node:fs/promises";
|
|
14227
13465
|
|
|
14228
13466
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/migrate-record.js
|
|
14229
13467
|
function migrateRecord(rec) {
|
|
@@ -14242,7 +13480,7 @@ var READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
|
|
|
14242
13480
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14243
13481
|
async function readRunsFileMaybe() {
|
|
14244
13482
|
try {
|
|
14245
|
-
const raw = await
|
|
13483
|
+
const raw = await readFile10(runsFilePath(), "utf8");
|
|
14246
13484
|
const parsed = JSON.parse(raw);
|
|
14247
13485
|
if (!READABLE_VERSIONS.has(parsed.version)) {
|
|
14248
13486
|
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.`);
|
|
@@ -14259,9 +13497,9 @@ async function readRunsFileMaybe() {
|
|
|
14259
13497
|
|
|
14260
13498
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
|
|
14261
13499
|
import { mkdir as mkdir2, rename, writeFile as writeFile3 } from "node:fs/promises";
|
|
14262
|
-
import { dirname as
|
|
13500
|
+
import { dirname as dirname12 } from "node:path";
|
|
14263
13501
|
async function writeRunsFileAtomic(file) {
|
|
14264
|
-
await mkdir2(
|
|
13502
|
+
await mkdir2(dirname12(runsFilePath()), { recursive: true });
|
|
14265
13503
|
const body = JSON.stringify(file, null, 2) + "\n";
|
|
14266
13504
|
const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
|
|
14267
13505
|
await writeFile3(tmp, body, { mode: 384 });
|
|
@@ -14301,8 +13539,8 @@ async function updateRun(id, patch) {
|
|
|
14301
13539
|
}
|
|
14302
13540
|
|
|
14303
13541
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
|
|
14304
|
-
import { readFile as
|
|
14305
|
-
import { resolve as
|
|
13542
|
+
import { readFile as readFile11, stat } from "node:fs/promises";
|
|
13543
|
+
import { resolve as resolve17 } from "node:path";
|
|
14306
13544
|
|
|
14307
13545
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/sha256-hex.js
|
|
14308
13546
|
import { createHash as createHash8 } from "node:crypto";
|
|
@@ -14324,7 +13562,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14324
13562
|
const name = rowField(row, "name");
|
|
14325
13563
|
if (!sourcePath)
|
|
14326
13564
|
continue;
|
|
14327
|
-
const abs =
|
|
13565
|
+
const abs = resolve17(sourcePath);
|
|
14328
13566
|
if (seen.has(abs))
|
|
14329
13567
|
continue;
|
|
14330
13568
|
seen.add(abs);
|
|
@@ -14341,10 +13579,10 @@ async function buildSourceFingerprint(opts) {
|
|
|
14341
13579
|
let rawTokensMtime = null;
|
|
14342
13580
|
let rawTokensContentHash = null;
|
|
14343
13581
|
if (opts.rawTokensPath) {
|
|
14344
|
-
const abs =
|
|
13582
|
+
const abs = resolve17(opts.rawTokensPath);
|
|
14345
13583
|
rawTokensPath = abs;
|
|
14346
13584
|
try {
|
|
14347
|
-
const [st, buf] = await Promise.all([stat(abs),
|
|
13585
|
+
const [st, buf] = await Promise.all([stat(abs), readFile11(abs)]);
|
|
14348
13586
|
rawTokensMtime = st.mtime.toISOString();
|
|
14349
13587
|
rawTokensContentHash = sha256Hex(buf);
|
|
14350
13588
|
} catch {
|
|
@@ -14426,12 +13664,12 @@ async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
|
|
|
14426
13664
|
}
|
|
14427
13665
|
|
|
14428
13666
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
|
|
14429
|
-
import { readFile as
|
|
13667
|
+
import { readFile as readFile12 } from "node:fs/promises";
|
|
14430
13668
|
async function loadAcceptedNames(sessionId) {
|
|
14431
13669
|
try {
|
|
14432
13670
|
const artifactsRoot = getRefineArtifactsRoot();
|
|
14433
13671
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
14434
|
-
const raw = await
|
|
13672
|
+
const raw = await readFile12(paths.statePath, "utf8");
|
|
14435
13673
|
const snapshot = JSON.parse(raw);
|
|
14436
13674
|
const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
|
|
14437
13675
|
if (accepted.length === 0)
|
|
@@ -15129,7 +14367,7 @@ function errorMessage(error) {
|
|
|
15129
14367
|
return error instanceof Error && error.message ? error.message : String(error);
|
|
15130
14368
|
}
|
|
15131
14369
|
function defaultSleep(delayMs) {
|
|
15132
|
-
return new Promise((
|
|
14370
|
+
return new Promise((resolve28) => setTimeout(resolve28, delayMs));
|
|
15133
14371
|
}
|
|
15134
14372
|
|
|
15135
14373
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/sanitize-preview.js
|
|
@@ -15370,7 +14608,7 @@ var ApiClient = class {
|
|
|
15370
14608
|
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
15371
14609
|
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
15372
14610
|
const jitter = Math.random() * baseDelay * 0.15;
|
|
15373
|
-
await new Promise((
|
|
14611
|
+
await new Promise((resolve28) => setTimeout(resolve28, baseDelay + jitter));
|
|
15374
14612
|
}
|
|
15375
14613
|
}
|
|
15376
14614
|
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
@@ -15757,7 +14995,7 @@ function formatApiError2(request) {
|
|
|
15757
14995
|
|
|
15758
14996
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
|
|
15759
14997
|
init_shared();
|
|
15760
|
-
import { readFile as
|
|
14998
|
+
import { readFile as readFile13, stat as stat3 } from "node:fs/promises";
|
|
15761
14999
|
|
|
15762
15000
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/collect-json-files.js
|
|
15763
15001
|
import { readdir, stat as stat2 } from "node:fs/promises";
|
|
@@ -15816,7 +15054,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
15816
15054
|
const merged = {};
|
|
15817
15055
|
for (const file of files.sort()) {
|
|
15818
15056
|
try {
|
|
15819
|
-
const text = await
|
|
15057
|
+
const text = await readFile13(file, "utf8");
|
|
15820
15058
|
const parsed = JSON.parse(text);
|
|
15821
15059
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
15822
15060
|
Object.assign(merged, parsed);
|
|
@@ -15830,7 +15068,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
15830
15068
|
async function readSingleFile(flag, p) {
|
|
15831
15069
|
let text;
|
|
15832
15070
|
try {
|
|
15833
|
-
text = await
|
|
15071
|
+
text = await readFile13(p, "utf8");
|
|
15834
15072
|
} catch {
|
|
15835
15073
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
15836
15074
|
}
|
|
@@ -15921,12 +15159,12 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
15921
15159
|
}
|
|
15922
15160
|
|
|
15923
15161
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/read-from-session.js
|
|
15924
|
-
import { readFile as
|
|
15162
|
+
import { readFile as readFile14 } from "node:fs/promises";
|
|
15925
15163
|
async function readExistingContentfulEntitiesFromSession(request) {
|
|
15926
15164
|
if (!request.path)
|
|
15927
15165
|
return void 0;
|
|
15928
15166
|
try {
|
|
15929
|
-
const raw = await
|
|
15167
|
+
const raw = await readFile14(request.path, "utf8");
|
|
15930
15168
|
const parsed = JSON.parse(raw);
|
|
15931
15169
|
if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
|
|
15932
15170
|
return void 0;
|
|
@@ -16266,7 +15504,7 @@ init_describe_agent_failure();
|
|
|
16266
15504
|
init_resolve_binary();
|
|
16267
15505
|
init_resolve_skill_path();
|
|
16268
15506
|
init_parse_map_token_prop_tool_calls();
|
|
16269
|
-
import { resolve as
|
|
15507
|
+
import { resolve as resolve18 } from "node:path";
|
|
16270
15508
|
init_cache_keys();
|
|
16271
15509
|
|
|
16272
15510
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/binary-exists.js
|
|
@@ -16321,7 +15559,6 @@ function analyticsEnabled() {
|
|
|
16321
15559
|
import { Analytics } from "@segment/analytics-node";
|
|
16322
15560
|
var DEFAULT_WRITE_KEY = "6DmxiEPN3SV1vbRTTMcNqDzCvkfwT06N";
|
|
16323
15561
|
var analyticsClient = null;
|
|
16324
|
-
var flushChain = Promise.resolve();
|
|
16325
15562
|
function resolveWriteKey() {
|
|
16326
15563
|
const key = (process.env["SEGMENT_WRITE_KEY"] ?? "").trim();
|
|
16327
15564
|
return key.length > 0 ? key : DEFAULT_WRITE_KEY;
|
|
@@ -16356,17 +15593,14 @@ async function trackEvent(event, properties, anonymousId, options) {
|
|
|
16356
15593
|
}
|
|
16357
15594
|
}
|
|
16358
15595
|
async function flushAnalytics() {
|
|
16359
|
-
|
|
16360
|
-
|
|
16361
|
-
|
|
16362
|
-
|
|
15596
|
+
if (!analyticsClient)
|
|
15597
|
+
return;
|
|
15598
|
+
try {
|
|
15599
|
+
await analyticsClient.closeAndFlush();
|
|
15600
|
+
} catch {
|
|
15601
|
+
} finally {
|
|
16363
15602
|
analyticsClient = null;
|
|
16364
|
-
|
|
16365
|
-
await client2.closeAndFlush();
|
|
16366
|
-
} catch {
|
|
16367
|
-
}
|
|
16368
|
-
});
|
|
16369
|
-
return flushChain;
|
|
15603
|
+
}
|
|
16370
15604
|
}
|
|
16371
15605
|
|
|
16372
15606
|
// packages/experience-design-system-backend-pipeline/dist/src/analytics/constants.js
|
|
@@ -16575,7 +15809,7 @@ async function runMapTokens(request) {
|
|
|
16575
15809
|
outDir: process.cwd(),
|
|
16576
15810
|
existingTokensInline: request.existingEntitiesInline,
|
|
16577
15811
|
...request.skillContentOverride !== void 0 ? { skillContentOverride: request.skillContentOverride } : {},
|
|
16578
|
-
...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride:
|
|
15812
|
+
...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride: resolve18(request.skillPathOverride) } : {}
|
|
16579
15813
|
});
|
|
16580
15814
|
if (request.printPrompt) {
|
|
16581
15815
|
const prompt2 = await buildMapPrompt();
|
|
@@ -16691,7 +15925,7 @@ function hasNoAuthoringSurface(component) {
|
|
|
16691
15925
|
}
|
|
16692
15926
|
|
|
16693
15927
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
|
|
16694
|
-
import { readFile as
|
|
15928
|
+
import { readFile as readFile15 } from "node:fs/promises";
|
|
16695
15929
|
|
|
16696
15930
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/constants/review-reasons.js
|
|
16697
15931
|
var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
|
|
@@ -16763,14 +15997,7 @@ function hasSiblingForwardRender(sourceText, siblingImports) {
|
|
|
16763
15997
|
});
|
|
16764
15998
|
}
|
|
16765
15999
|
function hasVisibleUiRender(sourceText) {
|
|
16766
|
-
|
|
16767
|
-
return true;
|
|
16768
|
-
if (/template\s*:\s*[`'"][\s\S]*?[`'"]/.test(sourceText)) {
|
|
16769
|
-
const inlineMatch = sourceText.match(/template\s*:\s*[`'"]([\s\S]*?)[`'"]/);
|
|
16770
|
-
if (inlineMatch && VISIBLE_UI_TAG_PATTERN.test(inlineMatch[1]))
|
|
16771
|
-
return true;
|
|
16772
|
-
}
|
|
16773
|
-
return /templateUrl\s*:\s*['"]/.test(sourceText);
|
|
16000
|
+
return /return\s*(?:\(|<)/.test(sourceText) && VISIBLE_UI_TAG_PATTERN.test(sourceText);
|
|
16774
16001
|
}
|
|
16775
16002
|
function infraPropNames(component) {
|
|
16776
16003
|
const props = component.props.map((prop) => prop.name);
|
|
@@ -16793,7 +16020,7 @@ function dedupeReasons(reasons) {
|
|
|
16793
16020
|
async function inspectComponentSource(component) {
|
|
16794
16021
|
let sourceText = "";
|
|
16795
16022
|
try {
|
|
16796
|
-
sourceText = await
|
|
16023
|
+
sourceText = await readFile15(component.source, "utf8");
|
|
16797
16024
|
} catch {
|
|
16798
16025
|
return {
|
|
16799
16026
|
wrapperConfidence: 0,
|
|
@@ -17200,7 +16427,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
17200
16427
|
const message = error instanceof Error ? error.message : String(error);
|
|
17201
16428
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
17202
16429
|
throw error;
|
|
17203
|
-
await new Promise((
|
|
16430
|
+
await new Promise((resolve28) => setTimeout(resolve28, Math.min(250 * attempt, 2e3)));
|
|
17204
16431
|
}
|
|
17205
16432
|
}
|
|
17206
16433
|
}
|
|
@@ -17232,7 +16459,7 @@ function resolveCompositionAgentName(flagValue) {
|
|
|
17232
16459
|
}
|
|
17233
16460
|
|
|
17234
16461
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/read-candidate-files.js
|
|
17235
|
-
import { readFile as
|
|
16462
|
+
import { readFile as readFile16 } from "node:fs/promises";
|
|
17236
16463
|
async function readCandidateFiles(components, extraFiles = []) {
|
|
17237
16464
|
const paths = new Set(extraFiles);
|
|
17238
16465
|
for (const c2 of components) {
|
|
@@ -17242,7 +16469,7 @@ async function readCandidateFiles(components, extraFiles = []) {
|
|
|
17242
16469
|
const out = [];
|
|
17243
16470
|
await Promise.all([...paths].map(async (p) => {
|
|
17244
16471
|
try {
|
|
17245
|
-
const content = await
|
|
16472
|
+
const content = await readFile16(p, "utf8");
|
|
17246
16473
|
out.push({ path: p, content });
|
|
17247
16474
|
} catch {
|
|
17248
16475
|
}
|
|
@@ -17413,7 +16640,7 @@ init_build_prompt();
|
|
|
17413
16640
|
init_create_local_cli_agent_invoker();
|
|
17414
16641
|
init_invoke_agent_with_output();
|
|
17415
16642
|
init_parse_token_tool_calls();
|
|
17416
|
-
import { readFile as
|
|
16643
|
+
import { readFile as readFile17 } from "node:fs/promises";
|
|
17417
16644
|
import { basename as basename5, resolve as pathResolve } from "node:path";
|
|
17418
16645
|
init_cache_keys();
|
|
17419
16646
|
init_parse_prompt_overrides();
|
|
@@ -17446,7 +16673,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17446
16673
|
throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
|
|
17447
16674
|
const tokensOverride = overridesMap.get("tokens");
|
|
17448
16675
|
const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
|
|
17449
|
-
const rawTokensInline = await
|
|
16676
|
+
const rawTokensInline = await readFile17(pathResolve(rawTokensPath), "utf8");
|
|
17450
16677
|
const tokenInputHash = hashTokenContent(rawTokensInline);
|
|
17451
16678
|
const db = openPipelineDb();
|
|
17452
16679
|
try {
|
|
@@ -17563,7 +16790,7 @@ async function readExistingEntities(request) {
|
|
|
17563
16790
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/resolve-generate-prompt.js
|
|
17564
16791
|
init_parse_prompt_overrides();
|
|
17565
16792
|
init_resolve_prompt_override();
|
|
17566
|
-
import { resolve as
|
|
16793
|
+
import { resolve as resolve19 } from "node:path";
|
|
17567
16794
|
async function resolveGeneratePrompt(overrides) {
|
|
17568
16795
|
const { overrides: parsed, errors } = parsePromptOverrides(overrides);
|
|
17569
16796
|
if (errors.length > 0)
|
|
@@ -17574,7 +16801,7 @@ async function resolveGeneratePrompt(overrides) {
|
|
|
17574
16801
|
const text = await resolvePromptOverride(entry);
|
|
17575
16802
|
if (entry.kind === "text")
|
|
17576
16803
|
return { text };
|
|
17577
|
-
return { path:
|
|
16804
|
+
return { path: resolve19(entry.value), text };
|
|
17578
16805
|
}
|
|
17579
16806
|
|
|
17580
16807
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/run-one-generate-component.js
|
|
@@ -18482,19 +17709,19 @@ import { useEffect as useEffect5, useRef as useRef3, useState as useState10 } fr
|
|
|
18482
17709
|
|
|
18483
17710
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
18484
17711
|
import { mkdir as mkdir7 } from "node:fs/promises";
|
|
18485
|
-
import { join as join18, resolve as
|
|
17712
|
+
import { join as join18, resolve as resolve22 } from "node:path";
|
|
18486
17713
|
|
|
18487
17714
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
18488
17715
|
import { existsSync as existsSync8 } from "node:fs";
|
|
18489
|
-
import { dirname as
|
|
17716
|
+
import { dirname as dirname14, join as join17, resolve as resolve20 } from "node:path";
|
|
18490
17717
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
18491
17718
|
function findSkillPath(fileName) {
|
|
18492
|
-
const thisDir =
|
|
17719
|
+
const thisDir = dirname14(fileURLToPath4(import.meta.url));
|
|
18493
17720
|
let dir = thisDir;
|
|
18494
17721
|
for (; ; ) {
|
|
18495
17722
|
const candidate = join17(dir, "skills", fileName);
|
|
18496
17723
|
if (existsSync8(candidate)) return candidate;
|
|
18497
|
-
const parent =
|
|
17724
|
+
const parent = resolve20(dir, "..");
|
|
18498
17725
|
if (parent === dir) {
|
|
18499
17726
|
throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
|
|
18500
17727
|
}
|
|
@@ -18503,11 +17730,11 @@ function findSkillPath(fileName) {
|
|
|
18503
17730
|
}
|
|
18504
17731
|
|
|
18505
17732
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/selection.ts
|
|
18506
|
-
import { resolve as
|
|
17733
|
+
import { resolve as resolve21 } from "node:path";
|
|
18507
17734
|
var SELECT_SKILL_PATH = findSkillPath("select-components.md");
|
|
18508
17735
|
var DEFAULT_TIMEOUT_MS5 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
|
|
18509
17736
|
async function hashSelectPrompt(options) {
|
|
18510
|
-
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(
|
|
17737
|
+
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve21(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
|
|
18511
17738
|
return hashContent(`${promptHash}|${options.agent}|${options.model ?? ""}`);
|
|
18512
17739
|
}
|
|
18513
17740
|
async function runSelection(options) {
|
|
@@ -18602,7 +17829,7 @@ var realDeps = {
|
|
|
18602
17829
|
var fail = (step, message) => ({ ok: false, step, message });
|
|
18603
17830
|
var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
|
|
18604
17831
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
18605
|
-
const outDir = input.outDir ?? join18(
|
|
17832
|
+
const outDir = input.outDir ?? join18(resolve22(input.projectPath), ".contentful");
|
|
18606
17833
|
let progress = initialProgress({
|
|
18607
17834
|
hasCredentials: input.credentials !== null,
|
|
18608
17835
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -18726,7 +17953,7 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
18726
17953
|
if (select?.kind === "text") return { promptText: select.value };
|
|
18727
17954
|
if (select?.kind === "path") {
|
|
18728
17955
|
await resolvePromptOverride(select);
|
|
18729
|
-
return { promptPath:
|
|
17956
|
+
return { promptPath: resolve22(select.value) };
|
|
18730
17957
|
}
|
|
18731
17958
|
return {};
|
|
18732
17959
|
}
|
|
@@ -21685,7 +20912,7 @@ function GenerationScreen({
|
|
|
21685
20912
|
import { useEffect as useEffect10, useRef as useRef8, useState as useState17 } from "react";
|
|
21686
20913
|
|
|
21687
20914
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
21688
|
-
import { resolve as
|
|
20915
|
+
import { resolve as resolve23 } from "node:path";
|
|
21689
20916
|
|
|
21690
20917
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/map-tokens.ts
|
|
21691
20918
|
async function prepareMapTokens(input, generatedSessionId) {
|
|
@@ -21820,7 +21047,7 @@ async function buildMapTokensOptions(input) {
|
|
|
21820
21047
|
if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
|
|
21821
21048
|
if (mapOverride?.kind === "path") {
|
|
21822
21049
|
await resolvePromptOverride(mapOverride);
|
|
21823
|
-
prompt.skillPathOverride =
|
|
21050
|
+
prompt.skillPathOverride = resolve23(mapOverride.value);
|
|
21824
21051
|
}
|
|
21825
21052
|
if (input.existingEntitiesPath) {
|
|
21826
21053
|
const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
|
|
@@ -27625,10 +26852,10 @@ function DoneStep({
|
|
|
27625
26852
|
import { useState as useState27 } from "react";
|
|
27626
26853
|
import { Box as Box41, Text as Text43 } from "ink";
|
|
27627
26854
|
import { readdirSync as readdirSync3 } from "node:fs";
|
|
27628
|
-
import { dirname as
|
|
26855
|
+
import { dirname as dirname15, basename as basename6, join as join20 } from "node:path";
|
|
27629
26856
|
|
|
27630
26857
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
27631
|
-
import { resolve as
|
|
26858
|
+
import { resolve as resolve24 } from "node:path";
|
|
27632
26859
|
import { homedir as homedir4 } from "node:os";
|
|
27633
26860
|
function expandTilde(input) {
|
|
27634
26861
|
if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
|
|
@@ -27642,7 +26869,7 @@ function normalizePath(input) {
|
|
|
27642
26869
|
p = p.slice(1, -1);
|
|
27643
26870
|
}
|
|
27644
26871
|
p = expandTilde(p);
|
|
27645
|
-
return
|
|
26872
|
+
return resolve24(p);
|
|
27646
26873
|
}
|
|
27647
26874
|
|
|
27648
26875
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
@@ -27661,7 +26888,7 @@ import { jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
|
27661
26888
|
function autocomplete(partial) {
|
|
27662
26889
|
if (!partial) return null;
|
|
27663
26890
|
const normalized = normalizePath(partial);
|
|
27664
|
-
const dir =
|
|
26891
|
+
const dir = dirname15(normalized);
|
|
27665
26892
|
const base = basename6(normalized);
|
|
27666
26893
|
let entries;
|
|
27667
26894
|
try {
|
|
@@ -28425,7 +27652,7 @@ import { useEffect as useEffect21, useRef as useRef14, useSyncExternalStore } fr
|
|
|
28425
27652
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
28426
27653
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
28427
27654
|
import { tmpdir } from "node:os";
|
|
28428
|
-
import { join as join22, resolve as
|
|
27655
|
+
import { join as join22, resolve as resolve25 } from "node:path";
|
|
28429
27656
|
|
|
28430
27657
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
|
|
28431
27658
|
function shouldBypassPreview(state2) {
|
|
@@ -28799,7 +28026,7 @@ var realSaveDeps = () => ({
|
|
|
28799
28026
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
28800
28027
|
appendRun,
|
|
28801
28028
|
buildSourceFingerprint,
|
|
28802
|
-
sleep: (ms) => new Promise((
|
|
28029
|
+
sleep: (ms) => new Promise((resolve28) => setTimeout(resolve28, ms)),
|
|
28803
28030
|
warn: (message) => process.stderr.write(message)
|
|
28804
28031
|
});
|
|
28805
28032
|
async function runPrintFiles(input, deps, onPatch) {
|
|
@@ -29138,7 +28365,7 @@ function createFlowController(start, deps) {
|
|
|
29138
28365
|
},
|
|
29139
28366
|
async submitPath(submitted) {
|
|
29140
28367
|
await deps.mkdir(submitted);
|
|
29141
|
-
if (
|
|
28368
|
+
if (resolve25(submitted) !== resolve25(state2.outDir) && await deps.detectSaveConflict(submitted)) {
|
|
29142
28369
|
const subdir = deps.buildTimestampedSubdir(submitted);
|
|
29143
28370
|
await deps.mkdir(subdir);
|
|
29144
28371
|
await proceedToWrite(subdir);
|
|
@@ -29196,7 +28423,7 @@ init_debug_mode_store();
|
|
|
29196
28423
|
init_version();
|
|
29197
28424
|
|
|
29198
28425
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
29199
|
-
import { join as join25, resolve as
|
|
28426
|
+
import { join as join25, resolve as resolve27 } from "node:path";
|
|
29200
28427
|
function describeFileLocations({
|
|
29201
28428
|
contentfulBaseDir,
|
|
29202
28429
|
debugModeEnabled,
|
|
@@ -29208,7 +28435,7 @@ function describeFileLocations({
|
|
|
29208
28435
|
importFiles: `${join25("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
29209
28436
|
};
|
|
29210
28437
|
}
|
|
29211
|
-
const base = contentfulBaseDir ?
|
|
28438
|
+
const base = contentfulBaseDir ? resolve27(contentfulBaseDir) : "<project>";
|
|
29212
28439
|
const session = currentSessionDir2 ?? join25(base, ".contentful", "<date>-session-<n>");
|
|
29213
28440
|
return {
|
|
29214
28441
|
debugLogs: join25(session, "debug"),
|
|
@@ -29429,20 +28656,20 @@ function resolveOnPath(binary) {
|
|
|
29429
28656
|
() => null
|
|
29430
28657
|
);
|
|
29431
28658
|
}
|
|
29432
|
-
return new Promise((
|
|
28659
|
+
return new Promise((resolve28) => {
|
|
29433
28660
|
execFile2(
|
|
29434
28661
|
process.platform === "win32" ? "where" : "which",
|
|
29435
28662
|
[binary],
|
|
29436
|
-
(error, stdout) =>
|
|
28663
|
+
(error, stdout) => resolve28(error ? null : stdout.split("\n")[0]?.trim() ?? null)
|
|
29437
28664
|
);
|
|
29438
28665
|
});
|
|
29439
28666
|
}
|
|
29440
28667
|
function readVersion(binary) {
|
|
29441
|
-
return new Promise((
|
|
28668
|
+
return new Promise((resolve28) => {
|
|
29442
28669
|
execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
|
|
29443
28670
|
const line = stdout.split("\n")[0]?.trim() ?? "";
|
|
29444
|
-
if (!error && line)
|
|
29445
|
-
else
|
|
28671
|
+
if (!error && line) resolve28(pass("version", line));
|
|
28672
|
+
else resolve28(fail3("version", "runs, but did not report a version"));
|
|
29446
28673
|
});
|
|
29447
28674
|
});
|
|
29448
28675
|
}
|
|
@@ -30533,7 +29760,8 @@ function App({ importOptions, inkClear }) {
|
|
|
30533
29760
|
agent,
|
|
30534
29761
|
...agentModel ? { agentModel } : {},
|
|
30535
29762
|
promptOverrides: launch.prompt ?? [],
|
|
30536
|
-
|
|
29763
|
+
// Every import generates new results: no stage restores an earlier run's output from the cache.
|
|
29764
|
+
noCache: true
|
|
30537
29765
|
}
|
|
30538
29766
|
};
|
|
30539
29767
|
};
|