@contentful/experience-design-system-cli 2.35.1-dev-build-d5a8fc4d.0 → 2.35.1-dev-build-57c625cc.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 +49 -46
- package/dist/index.js +60 -54
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +1 -0
- package/legacy/dist/src/index.js +476 -142
- package/legacy/dist/src/lib/push-debug-log.d.ts +29 -0
- package/legacy/package.json +1 -1
- package/package.json +2 -2
package/legacy/dist/src/index.js
CHANGED
|
@@ -1213,8 +1213,8 @@ function makeSessionTimestamp() {
|
|
|
1213
1213
|
const override = process.env["EDSI_DEBUG_TS"];
|
|
1214
1214
|
if (override) return override;
|
|
1215
1215
|
const now = /* @__PURE__ */ new Date();
|
|
1216
|
-
const
|
|
1217
|
-
return `${now.getUTCFullYear()}${
|
|
1216
|
+
const pad3 = (n, w = 2) => n.toString().padStart(w, "0");
|
|
1217
|
+
return `${now.getUTCFullYear()}${pad3(now.getUTCMonth() + 1)}${pad3(now.getUTCDate())}T${pad3(now.getUTCHours())}${pad3(now.getUTCMinutes())}${pad3(now.getUTCSeconds())}Z`;
|
|
1218
1218
|
}
|
|
1219
1219
|
function initDebugLogger(opts) {
|
|
1220
1220
|
if (singleton) return singleton;
|
|
@@ -2011,8 +2011,8 @@ function deleteRawTokensForSession(db, sessionId2) {
|
|
|
2011
2011
|
}
|
|
2012
2012
|
function createRawTokenGroups(db, sessionId2, groups) {
|
|
2013
2013
|
const insertGroup = db.prepare(`INSERT INTO raw_token_groups (session_id, path, description) VALUES (?, ?, ?)`);
|
|
2014
|
-
for (const
|
|
2015
|
-
insertGroup.run(sessionId2,
|
|
2014
|
+
for (const group2 of groups) {
|
|
2015
|
+
insertGroup.run(sessionId2, group2.path, group2.$description ?? null);
|
|
2016
2016
|
}
|
|
2017
2017
|
}
|
|
2018
2018
|
function createRawTokens(db, sessionId2, tokens) {
|
|
@@ -6891,24 +6891,24 @@ function parseEdsiError(rawInput) {
|
|
|
6891
6891
|
}
|
|
6892
6892
|
}
|
|
6893
6893
|
const cleaned = stripLambdaLogPrefix(body);
|
|
6894
|
-
const
|
|
6895
|
-
const bindingFromJson = typeof
|
|
6894
|
+
const json2 = parseJsonBody(cleaned) ?? parseJsonBody(body);
|
|
6895
|
+
const bindingFromJson = typeof json2?.message === "string" ? parseBindingDiagnostics(json2.message) : null;
|
|
6896
6896
|
if (bindingFromJson) {
|
|
6897
6897
|
return {
|
|
6898
|
-
code: bindingFromJson.code ??
|
|
6898
|
+
code: bindingFromJson.code ?? json2?.code ?? null,
|
|
6899
6899
|
message: bindingFromJson.message ?? cleaned,
|
|
6900
6900
|
cycle: null,
|
|
6901
6901
|
raw: false,
|
|
6902
6902
|
...bindingFromJson.diagnostics ? { diagnostics: bindingFromJson.diagnostics } : {}
|
|
6903
6903
|
};
|
|
6904
6904
|
}
|
|
6905
|
-
if (
|
|
6905
|
+
if (json2 && (json2.code || json2.message || json2.cycle)) {
|
|
6906
6906
|
return {
|
|
6907
|
-
code:
|
|
6908
|
-
message:
|
|
6909
|
-
cycle:
|
|
6907
|
+
code: json2.code ?? null,
|
|
6908
|
+
message: json2.message ?? (cleaned || prefix),
|
|
6909
|
+
cycle: json2.cycle ?? null,
|
|
6910
6910
|
raw: false,
|
|
6911
|
-
...
|
|
6911
|
+
...json2.diagnostics ? { diagnostics: json2.diagnostics } : {}
|
|
6912
6912
|
};
|
|
6913
6913
|
}
|
|
6914
6914
|
const binding = parseBindingDiagnostics(cleaned);
|
|
@@ -8448,8 +8448,8 @@ async function resolveSession(sessionFlag, command) {
|
|
|
8448
8448
|
}
|
|
8449
8449
|
function rebuildDTCGTree(groups, tokens) {
|
|
8450
8450
|
const root = {};
|
|
8451
|
-
for (const
|
|
8452
|
-
const segments =
|
|
8451
|
+
for (const group2 of groups) {
|
|
8452
|
+
const segments = group2.path.split(".");
|
|
8453
8453
|
let node = root;
|
|
8454
8454
|
for (const seg of segments) {
|
|
8455
8455
|
if (typeof node[seg] !== "object" || node[seg] === null) {
|
|
@@ -8457,8 +8457,8 @@ function rebuildDTCGTree(groups, tokens) {
|
|
|
8457
8457
|
}
|
|
8458
8458
|
node = node[seg];
|
|
8459
8459
|
}
|
|
8460
|
-
if (
|
|
8461
|
-
node["$description"] =
|
|
8460
|
+
if (group2.$description) {
|
|
8461
|
+
node["$description"] = group2.$description;
|
|
8462
8462
|
}
|
|
8463
8463
|
}
|
|
8464
8464
|
for (const token of tokens) {
|
|
@@ -9201,6 +9201,214 @@ var init_run_teaser = __esm({
|
|
|
9201
9201
|
}
|
|
9202
9202
|
});
|
|
9203
9203
|
|
|
9204
|
+
// packages/experience-design-system-cli-legacy/src/lib/push-debug-log.ts
|
|
9205
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readdirSync, writeFileSync } from "node:fs";
|
|
9206
|
+
import { join as join10 } from "node:path";
|
|
9207
|
+
function scrub(key, value) {
|
|
9208
|
+
if (/^cma_?token$/i.test(key)) {
|
|
9209
|
+
return typeof value === "string" && value ? `[present, ${value.length} chars]` : "[not set]";
|
|
9210
|
+
}
|
|
9211
|
+
if (typeof value === "string" && SECRET_VALUE.test(value)) return "[redacted]";
|
|
9212
|
+
return value;
|
|
9213
|
+
}
|
|
9214
|
+
function json(value) {
|
|
9215
|
+
const text = JSON.stringify(value, scrub, 2) ?? "null";
|
|
9216
|
+
return text.length > MAX_BLOCK_CHARS ? `${text.slice(0, MAX_BLOCK_CHARS)}
|
|
9217
|
+
\u2026 truncated, ${text.length - MAX_BLOCK_CHARS} more characters` : text;
|
|
9218
|
+
}
|
|
9219
|
+
function pad(n, width = 2) {
|
|
9220
|
+
return String(n).padStart(width, "0");
|
|
9221
|
+
}
|
|
9222
|
+
function datePrefix(now) {
|
|
9223
|
+
return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
|
|
9224
|
+
}
|
|
9225
|
+
function clock(now) {
|
|
9226
|
+
return `${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}.${pad(now.getMilliseconds(), 3)}`;
|
|
9227
|
+
}
|
|
9228
|
+
function nextFilename(dir, now) {
|
|
9229
|
+
const today = datePrefix(now);
|
|
9230
|
+
const pattern = new RegExp(`^${today}-push-attempt-(\\d+)\\.md$`);
|
|
9231
|
+
const existing = existsSync3(dir) ? readdirSync(dir) : [];
|
|
9232
|
+
const max = existing.reduce((acc, entry) => {
|
|
9233
|
+
const match2 = pattern.exec(entry);
|
|
9234
|
+
return match2 ? Math.max(acc, Number(match2[1])) : acc;
|
|
9235
|
+
}, 0);
|
|
9236
|
+
return `${today}-push-attempt-${max + 1}.md`;
|
|
9237
|
+
}
|
|
9238
|
+
function entityName(entry) {
|
|
9239
|
+
if (typeof entry === "string") return entry;
|
|
9240
|
+
if (entry && typeof entry === "object") {
|
|
9241
|
+
const record = entry;
|
|
9242
|
+
for (const field of ["key", "name", "$name", "id"]) {
|
|
9243
|
+
if (typeof record[field] === "string") return record[field];
|
|
9244
|
+
}
|
|
9245
|
+
const current = record["current"];
|
|
9246
|
+
if (current && typeof current === "object" && typeof current["name"] === "string") {
|
|
9247
|
+
return current["name"];
|
|
9248
|
+
}
|
|
9249
|
+
}
|
|
9250
|
+
return "unknown";
|
|
9251
|
+
}
|
|
9252
|
+
function group(diff) {
|
|
9253
|
+
return {
|
|
9254
|
+
new: diff.new.map(entityName),
|
|
9255
|
+
changed: diff.changed.map((entry) => {
|
|
9256
|
+
const breaking = entry && typeof entry === "object" && entry.changeClassification?.classification === "breaking";
|
|
9257
|
+
return breaking ? `${entityName(entry)} (breaking)` : entityName(entry);
|
|
9258
|
+
}),
|
|
9259
|
+
unchanged: diff.unchanged,
|
|
9260
|
+
removed: diff.removed.map(entityName)
|
|
9261
|
+
};
|
|
9262
|
+
}
|
|
9263
|
+
function summarizePreview(preview) {
|
|
9264
|
+
return { components: group(preview.components), tokens: group(preview.tokens) };
|
|
9265
|
+
}
|
|
9266
|
+
function summarizeCdf(cdf) {
|
|
9267
|
+
return Object.entries(cdf).filter(([key]) => !key.startsWith("$") && key !== "allowDeletions").map(([key, value]) => {
|
|
9268
|
+
const entry = value ?? {};
|
|
9269
|
+
const properties = entry["$properties"];
|
|
9270
|
+
const slots = entry["$slots"];
|
|
9271
|
+
return {
|
|
9272
|
+
name: key,
|
|
9273
|
+
type: entry["$type"],
|
|
9274
|
+
properties: properties && typeof properties === "object" ? Object.keys(properties) : [],
|
|
9275
|
+
slots: slots && typeof slots === "object" ? Object.keys(slots) : []
|
|
9276
|
+
};
|
|
9277
|
+
});
|
|
9278
|
+
}
|
|
9279
|
+
function renderEvents(events) {
|
|
9280
|
+
if (events.length === 0) return "_Nothing recorded yet._";
|
|
9281
|
+
return events.map((event, index) => {
|
|
9282
|
+
const note = event.note ? ` \u2014 ${event.note}` : "";
|
|
9283
|
+
const request2 = event.requestId ? ` _(request ${event.requestId})_` : "";
|
|
9284
|
+
return `${index + 1}. \`${clock(event.at)}\` (+${event.sinceStartMs}ms) **${event.title}**${note}${request2}`;
|
|
9285
|
+
}).join("\n");
|
|
9286
|
+
}
|
|
9287
|
+
function renderDetails(events) {
|
|
9288
|
+
const withData = events.map((event, index) => ({ event, index })).filter(({ event }) => event.data && Object.keys(event.data).length > 0);
|
|
9289
|
+
if (withData.length === 0) return "";
|
|
9290
|
+
return withData.map(
|
|
9291
|
+
({ event, index }) => `<details>
|
|
9292
|
+
<summary>${index + 1}. ${event.title}</summary>
|
|
9293
|
+
|
|
9294
|
+
\`\`\`json
|
|
9295
|
+
${json(event.data)}
|
|
9296
|
+
\`\`\`
|
|
9297
|
+
|
|
9298
|
+
</details>`
|
|
9299
|
+
).join("\n\n");
|
|
9300
|
+
}
|
|
9301
|
+
function render2(runId, inputs, events, startedAt, result, durationMs) {
|
|
9302
|
+
const requestIds = [...new Set(events.map((event) => event.requestId).filter(Boolean))];
|
|
9303
|
+
const text = (field) => String(inputs[field] ?? "\u2014");
|
|
9304
|
+
const details = renderDetails(events);
|
|
9305
|
+
return `# Push to Contentful \u2014 debug log
|
|
9306
|
+
|
|
9307
|
+
## Summary
|
|
9308
|
+
|
|
9309
|
+
| | |
|
|
9310
|
+
|---|---|
|
|
9311
|
+
| **Result** | ${OUTCOME_LABEL[result.outcome]} |
|
|
9312
|
+
| **What happened** | ${result.summary} |
|
|
9313
|
+
| **Space / environment** | \`${text("space_id")}\` / \`${text("environment_id")}\` |
|
|
9314
|
+
| **Host** | ${text("host")} |
|
|
9315
|
+
| **Started** | ${startedAt.toISOString()} |
|
|
9316
|
+
| **Duration** | ${durationMs}ms |
|
|
9317
|
+
| **Request IDs** | ${requestIds.length > 0 ? requestIds.map((id) => `\`${id}\``).join(", ") : "\u2014"} |
|
|
9318
|
+
| **CLI / runtime** | ${cliVersion()} \xB7 ${process.platform} \xB7 Node ${process.version} |
|
|
9319
|
+
| **Run ID** | ${runId} |
|
|
9320
|
+
|
|
9321
|
+
## Timeline
|
|
9322
|
+
|
|
9323
|
+
${renderEvents(events)}
|
|
9324
|
+
|
|
9325
|
+
## Inputs
|
|
9326
|
+
|
|
9327
|
+
\`\`\`json
|
|
9328
|
+
${json(inputs)}
|
|
9329
|
+
\`\`\`
|
|
9330
|
+
|
|
9331
|
+
## Result
|
|
9332
|
+
|
|
9333
|
+
\`\`\`json
|
|
9334
|
+
${json({ outcome: result.outcome, summary: result.summary, ...result.details ?? {} })}
|
|
9335
|
+
\`\`\`
|
|
9336
|
+
${details ? `
|
|
9337
|
+
## Details
|
|
9338
|
+
|
|
9339
|
+
${details}
|
|
9340
|
+
` : ""}`;
|
|
9341
|
+
}
|
|
9342
|
+
function startPushDebugRun(inputs) {
|
|
9343
|
+
const sessionDir = process.env[DEBUG_SESSION_DIR_ENV];
|
|
9344
|
+
if (!sessionDir) return NOOP_RUN;
|
|
9345
|
+
const startedAt = /* @__PURE__ */ new Date();
|
|
9346
|
+
const runId = `${startedAt.getFullYear()}${pad(startedAt.getMonth() + 1)}${pad(startedAt.getDate())}-${pad(startedAt.getHours())}${pad(startedAt.getMinutes())}${pad(startedAt.getSeconds())}`;
|
|
9347
|
+
const events = [];
|
|
9348
|
+
let result = {
|
|
9349
|
+
outcome: "in-progress",
|
|
9350
|
+
summary: "The push started but no final result was recorded."
|
|
9351
|
+
};
|
|
9352
|
+
let finished = false;
|
|
9353
|
+
let path;
|
|
9354
|
+
const flush = () => {
|
|
9355
|
+
try {
|
|
9356
|
+
if (!path) {
|
|
9357
|
+
const dir = join10(sessionDir, "import");
|
|
9358
|
+
mkdirSync3(dir, { recursive: true });
|
|
9359
|
+
path = join10(dir, nextFilename(dir, startedAt));
|
|
9360
|
+
}
|
|
9361
|
+
writeFileSync(path, render2(runId, inputs, events, startedAt, result, Date.now() - startedAt.getTime()), {
|
|
9362
|
+
mode: 384
|
|
9363
|
+
});
|
|
9364
|
+
} catch {
|
|
9365
|
+
}
|
|
9366
|
+
};
|
|
9367
|
+
flush();
|
|
9368
|
+
return {
|
|
9369
|
+
event(title, options = {}) {
|
|
9370
|
+
if (finished) return;
|
|
9371
|
+
const at = /* @__PURE__ */ new Date();
|
|
9372
|
+
events.push({ at, sinceStartMs: at.getTime() - startedAt.getTime(), title, ...options });
|
|
9373
|
+
flush();
|
|
9374
|
+
},
|
|
9375
|
+
finish(final) {
|
|
9376
|
+
if (finished) return;
|
|
9377
|
+
finished = true;
|
|
9378
|
+
result = final;
|
|
9379
|
+
const at = /* @__PURE__ */ new Date();
|
|
9380
|
+
events.push({
|
|
9381
|
+
at,
|
|
9382
|
+
sinceStartMs: at.getTime() - startedAt.getTime(),
|
|
9383
|
+
title: OUTCOME_LABEL[final.outcome].replace(/^\S+\s/, ""),
|
|
9384
|
+
note: final.summary
|
|
9385
|
+
});
|
|
9386
|
+
flush();
|
|
9387
|
+
}
|
|
9388
|
+
};
|
|
9389
|
+
}
|
|
9390
|
+
var DEBUG_SESSION_DIR_ENV, NOOP_RUN, OUTCOME_LABEL, MAX_BLOCK_CHARS, SECRET_VALUE;
|
|
9391
|
+
var init_push_debug_log = __esm({
|
|
9392
|
+
"packages/experience-design-system-cli-legacy/src/lib/push-debug-log.ts"() {
|
|
9393
|
+
"use strict";
|
|
9394
|
+
init_client();
|
|
9395
|
+
DEBUG_SESSION_DIR_ENV = "EDS_DEBUG_SESSION_DIR";
|
|
9396
|
+
NOOP_RUN = { event: () => void 0, finish: () => void 0 };
|
|
9397
|
+
OUTCOME_LABEL = {
|
|
9398
|
+
"in-progress": "\u23F3 In progress (the process ended before the push finished)",
|
|
9399
|
+
pushed: "\u2705 Pushed",
|
|
9400
|
+
partial: "\u26A0\uFE0F Partly pushed (some items failed)",
|
|
9401
|
+
failed: "\u274C Push failed",
|
|
9402
|
+
"preview-failed": "\u274C Preview failed (nothing was sent to apply)",
|
|
9403
|
+
"nothing-to-push": "\u2139\uFE0F Nothing to push (the server says the space already matches)",
|
|
9404
|
+
skipped: "\u23ED\uFE0F Skipped",
|
|
9405
|
+
superseded: "\u21A9\uFE0F Superseded by a newer attempt"
|
|
9406
|
+
};
|
|
9407
|
+
MAX_BLOCK_CHARS = 1e5;
|
|
9408
|
+
SECRET_VALUE = /CFPAT-[A-Za-z0-9_-]{20,}|^Bearer\s+\S+/;
|
|
9409
|
+
}
|
|
9410
|
+
});
|
|
9411
|
+
|
|
9204
9412
|
// packages/experience-design-system-cli-legacy/src/tui/use-blinking-cursor.ts
|
|
9205
9413
|
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
9206
9414
|
function useBlinkingCursor() {
|
|
@@ -9220,8 +9428,8 @@ var init_use_blinking_cursor = __esm({
|
|
|
9220
9428
|
// packages/experience-design-system-cli-legacy/src/runs/path-prompt.tsx
|
|
9221
9429
|
import { useState as useState4 } from "react";
|
|
9222
9430
|
import { Box as Box6, Text as Text7 } from "ink";
|
|
9223
|
-
import { readdirSync } from "node:fs";
|
|
9224
|
-
import { dirname as dirname5, basename as basename2, join as
|
|
9431
|
+
import { readdirSync as readdirSync2 } from "node:fs";
|
|
9432
|
+
import { dirname as dirname5, basename as basename2, join as join11 } from "node:path";
|
|
9225
9433
|
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
9226
9434
|
function autocomplete(partial) {
|
|
9227
9435
|
if (!partial) return null;
|
|
@@ -9230,19 +9438,19 @@ function autocomplete(partial) {
|
|
|
9230
9438
|
const base = basename2(normalized);
|
|
9231
9439
|
let entries;
|
|
9232
9440
|
try {
|
|
9233
|
-
entries =
|
|
9441
|
+
entries = readdirSync2(dir);
|
|
9234
9442
|
} catch {
|
|
9235
9443
|
return null;
|
|
9236
9444
|
}
|
|
9237
9445
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
9238
9446
|
if (matches.length === 0) return null;
|
|
9239
|
-
if (matches.length === 1) return
|
|
9447
|
+
if (matches.length === 1) return join11(dir, matches[0]);
|
|
9240
9448
|
let prefix = matches[0];
|
|
9241
9449
|
for (const m of matches) {
|
|
9242
9450
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
9243
9451
|
if (!prefix) break;
|
|
9244
9452
|
}
|
|
9245
|
-
return prefix.length > base.length ?
|
|
9453
|
+
return prefix.length > base.length ? join11(dir, prefix) : null;
|
|
9246
9454
|
}
|
|
9247
9455
|
function PathPrompt({
|
|
9248
9456
|
defaultPath,
|
|
@@ -9307,12 +9515,12 @@ var init_path_prompt = __esm({
|
|
|
9307
9515
|
|
|
9308
9516
|
// packages/experience-design-system-cli-legacy/src/runs/save-path-resolver.ts
|
|
9309
9517
|
import { access as access4 } from "node:fs/promises";
|
|
9310
|
-
import { join as
|
|
9518
|
+
import { join as join12 } from "node:path";
|
|
9311
9519
|
async function listConflictingFiles(path) {
|
|
9312
9520
|
const conflicts = [];
|
|
9313
9521
|
for (const name of SAVE_FILES) {
|
|
9314
9522
|
try {
|
|
9315
|
-
await access4(
|
|
9523
|
+
await access4(join12(path, name));
|
|
9316
9524
|
conflicts.push(name);
|
|
9317
9525
|
} catch {
|
|
9318
9526
|
}
|
|
@@ -9332,7 +9540,7 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
|
|
|
9332
9540
|
const hh = pad2(now.getHours());
|
|
9333
9541
|
const mm = pad2(now.getMinutes());
|
|
9334
9542
|
const ss = pad2(now.getSeconds());
|
|
9335
|
-
return
|
|
9543
|
+
return join12(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
|
|
9336
9544
|
}
|
|
9337
9545
|
var SAVE_FILES;
|
|
9338
9546
|
var init_save_path_resolver = __esm({
|
|
@@ -9344,7 +9552,7 @@ var init_save_path_resolver = __esm({
|
|
|
9344
9552
|
|
|
9345
9553
|
// packages/experience-design-system-cli-legacy/src/runs/store.ts
|
|
9346
9554
|
import { readFile as readFile12, writeFile as writeFile4, mkdir as mkdir4, rename } from "node:fs/promises";
|
|
9347
|
-
import { join as
|
|
9555
|
+
import { join as join13 } from "node:path";
|
|
9348
9556
|
import { homedir as homedir6 } from "node:os";
|
|
9349
9557
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
9350
9558
|
function encodeBase32(bytes, length) {
|
|
@@ -9440,8 +9648,8 @@ var init_store = __esm({
|
|
|
9440
9648
|
RUNS_FILE_VERSION = 3;
|
|
9441
9649
|
RUNS_FILE_CAP = 200;
|
|
9442
9650
|
READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
|
|
9443
|
-
RUNS_DIR =
|
|
9444
|
-
RUNS_PATH =
|
|
9651
|
+
RUNS_DIR = join13(homedir6(), ".config", "experiences");
|
|
9652
|
+
RUNS_PATH = join13(RUNS_DIR, "runs.json");
|
|
9445
9653
|
CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
9446
9654
|
}
|
|
9447
9655
|
});
|
|
@@ -9598,7 +9806,7 @@ var init_WelcomeStep = __esm({
|
|
|
9598
9806
|
import { useState as useState6, useEffect as useEffect3 } from "react";
|
|
9599
9807
|
import { Box as Box9, Text as Text10 } from "ink";
|
|
9600
9808
|
import { promises as fs } from "node:fs";
|
|
9601
|
-
import { join as
|
|
9809
|
+
import { join as join14 } from "node:path";
|
|
9602
9810
|
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
9603
9811
|
async function countFiles(dir) {
|
|
9604
9812
|
const counts = {
|
|
@@ -9622,7 +9830,7 @@ async function countFiles(dir) {
|
|
|
9622
9830
|
await Promise.all(
|
|
9623
9831
|
entries.map(async (entry) => {
|
|
9624
9832
|
if (IGNORE_DIRS.has(entry)) return;
|
|
9625
|
-
const full =
|
|
9833
|
+
const full = join14(current, entry);
|
|
9626
9834
|
let stat7;
|
|
9627
9835
|
try {
|
|
9628
9836
|
stat7 = await fs.stat(full);
|
|
@@ -11307,8 +11515,8 @@ var init_types = __esm({
|
|
|
11307
11515
|
});
|
|
11308
11516
|
|
|
11309
11517
|
// packages/experience-design-system-extraction/dist/src/extract/tsx-shared.js
|
|
11310
|
-
import { existsSync as
|
|
11311
|
-
import { dirname as dirname6, join as
|
|
11518
|
+
import { existsSync as existsSync4, readFileSync as readFileSync5 } from "node:fs";
|
|
11519
|
+
import { dirname as dirname6, join as join15, resolve as resolve12 } from "node:path";
|
|
11312
11520
|
import { Node, Project, SyntaxKind } from "ts-morph";
|
|
11313
11521
|
import ts from "typescript";
|
|
11314
11522
|
function createTsxProject(filePaths) {
|
|
@@ -11507,8 +11715,8 @@ function findNearestTsConfigPath(filePath) {
|
|
|
11507
11715
|
let currentDir = dirname6(filePath);
|
|
11508
11716
|
while (true) {
|
|
11509
11717
|
for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
|
|
11510
|
-
const candidatePath =
|
|
11511
|
-
if (
|
|
11718
|
+
const candidatePath = join15(currentDir, candidateName);
|
|
11719
|
+
if (existsSync4(candidatePath)) {
|
|
11512
11720
|
nearestTsConfigPathCache.set(filePath, candidatePath);
|
|
11513
11721
|
return candidatePath;
|
|
11514
11722
|
}
|
|
@@ -11564,12 +11772,12 @@ function resolveImportSourcePath(basePath) {
|
|
|
11564
11772
|
`${basePath}.tsx`,
|
|
11565
11773
|
`${basePath}.js`,
|
|
11566
11774
|
`${basePath}.jsx`,
|
|
11567
|
-
|
|
11568
|
-
|
|
11569
|
-
|
|
11570
|
-
|
|
11775
|
+
join15(basePath, "index.ts"),
|
|
11776
|
+
join15(basePath, "index.tsx"),
|
|
11777
|
+
join15(basePath, "index.js"),
|
|
11778
|
+
join15(basePath, "index.jsx")
|
|
11571
11779
|
];
|
|
11572
|
-
return candidates.find((candidatePath) =>
|
|
11780
|
+
return candidates.find((candidatePath) => existsSync4(candidatePath));
|
|
11573
11781
|
}
|
|
11574
11782
|
function findProjectSourceFileByImportPath(project, resolvedPath) {
|
|
11575
11783
|
const candidatePaths = [
|
|
@@ -11578,10 +11786,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
|
|
|
11578
11786
|
`${resolvedPath}.tsx`,
|
|
11579
11787
|
`${resolvedPath}.js`,
|
|
11580
11788
|
`${resolvedPath}.jsx`,
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11789
|
+
join15(resolvedPath, "index.ts"),
|
|
11790
|
+
join15(resolvedPath, "index.tsx"),
|
|
11791
|
+
join15(resolvedPath, "index.js"),
|
|
11792
|
+
join15(resolvedPath, "index.jsx")
|
|
11585
11793
|
];
|
|
11586
11794
|
for (const candidatePath of candidatePaths) {
|
|
11587
11795
|
const sourceFile = project.getSourceFile(candidatePath);
|
|
@@ -11602,10 +11810,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
11602
11810
|
if (!packageRootDir)
|
|
11603
11811
|
return void 0;
|
|
11604
11812
|
const preferredEntryPaths = [
|
|
11605
|
-
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11813
|
+
join15(packageRootDir, "src/index.ts"),
|
|
11814
|
+
join15(packageRootDir, "src/index.tsx"),
|
|
11815
|
+
join15(packageRootDir, "index.ts"),
|
|
11816
|
+
join15(packageRootDir, "index.tsx")
|
|
11609
11817
|
];
|
|
11610
11818
|
for (const entryPath of preferredEntryPaths) {
|
|
11611
11819
|
const entrySourceFile = project.getSourceFile(entryPath);
|
|
@@ -11613,7 +11821,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
11613
11821
|
return entrySourceFile;
|
|
11614
11822
|
}
|
|
11615
11823
|
}
|
|
11616
|
-
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() ===
|
|
11824
|
+
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join15(packageRootDir, "src"));
|
|
11617
11825
|
}
|
|
11618
11826
|
function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
11619
11827
|
const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
|
|
@@ -11622,7 +11830,7 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
|
11622
11830
|
if (workspacePackageManifestCache.has(packageRootDir)) {
|
|
11623
11831
|
return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
|
|
11624
11832
|
}
|
|
11625
|
-
const packageJsonPath =
|
|
11833
|
+
const packageJsonPath = join15(packageRootDir, "package.json");
|
|
11626
11834
|
try {
|
|
11627
11835
|
const packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf8"));
|
|
11628
11836
|
const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
|
|
@@ -11639,7 +11847,7 @@ function findNearestPackageRootDir(filePath) {
|
|
|
11639
11847
|
}
|
|
11640
11848
|
let currentDir = dirname6(filePath);
|
|
11641
11849
|
while (true) {
|
|
11642
|
-
if (
|
|
11850
|
+
if (existsSync4(join15(currentDir, "package.json"))) {
|
|
11643
11851
|
packageRootByFilePathCache.set(filePath, currentDir);
|
|
11644
11852
|
return currentDir;
|
|
11645
11853
|
}
|
|
@@ -14701,8 +14909,8 @@ var init_vue_tsx = __esm({
|
|
|
14701
14909
|
});
|
|
14702
14910
|
|
|
14703
14911
|
// packages/experience-design-system-extraction/dist/src/extract/resolve-local-module.js
|
|
14704
|
-
import { existsSync as
|
|
14705
|
-
import { dirname as dirname7, join as
|
|
14912
|
+
import { existsSync as existsSync5, statSync as statSync2 } from "node:fs";
|
|
14913
|
+
import { dirname as dirname7, join as join16, resolve as resolve13 } from "node:path";
|
|
14706
14914
|
function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
14707
14915
|
const basePath = resolve13(dirname7(importingFilePath), specifier);
|
|
14708
14916
|
const candidates = [
|
|
@@ -14711,18 +14919,18 @@ function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
|
14711
14919
|
`${basePath}.ts`,
|
|
14712
14920
|
`${basePath}.mjs`,
|
|
14713
14921
|
`${basePath}.cjs`,
|
|
14714
|
-
|
|
14715
|
-
|
|
14716
|
-
|
|
14717
|
-
|
|
14922
|
+
join16(basePath, "index.js"),
|
|
14923
|
+
join16(basePath, "index.ts"),
|
|
14924
|
+
join16(basePath, "index.mjs"),
|
|
14925
|
+
join16(basePath, "index.cjs")
|
|
14718
14926
|
];
|
|
14719
14927
|
for (const candidate of candidates) {
|
|
14720
|
-
if (
|
|
14928
|
+
if (existsSync5(candidate) && statSync2(candidate).isFile())
|
|
14721
14929
|
return candidate;
|
|
14722
14930
|
}
|
|
14723
14931
|
if (options.allowJavaScriptExtensionFallback && basePath.endsWith(".js")) {
|
|
14724
14932
|
const tsPath = `${basePath.slice(0, -".js".length)}.ts`;
|
|
14725
|
-
if (
|
|
14933
|
+
if (existsSync5(tsPath) && statSync2(tsPath).isFile())
|
|
14726
14934
|
return tsPath;
|
|
14727
14935
|
}
|
|
14728
14936
|
return null;
|
|
@@ -14753,9 +14961,9 @@ var init_resolve_type_property = __esm({
|
|
|
14753
14961
|
|
|
14754
14962
|
// packages/experience-design-system-extraction/dist/src/extract/vue.js
|
|
14755
14963
|
import os from "node:os";
|
|
14756
|
-
import { basename as basename3, dirname as dirname8, resolve as resolve14, join as
|
|
14964
|
+
import { basename as basename3, dirname as dirname8, resolve as resolve14, join as join17 } from "node:path";
|
|
14757
14965
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
14758
|
-
import { existsSync as
|
|
14966
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6, readdirSync as readdirSync3, statSync as statSync3 } from "node:fs";
|
|
14759
14967
|
import { parse as parseSFC } from "@vue/compiler-sfc";
|
|
14760
14968
|
import { Project as Project3, Node as Node6 } from "ts-morph";
|
|
14761
14969
|
async function extractVueComponents(filePaths, onProgress) {
|
|
@@ -14968,11 +15176,11 @@ function findWorkspaceRoot(startDir) {
|
|
|
14968
15176
|
return workspaceRootCache.get(startDir);
|
|
14969
15177
|
let dir = startDir;
|
|
14970
15178
|
while (true) {
|
|
14971
|
-
const pkgJsonPath =
|
|
14972
|
-
if (
|
|
15179
|
+
const pkgJsonPath = join17(dir, "package.json");
|
|
15180
|
+
if (existsSync6(pkgJsonPath)) {
|
|
14973
15181
|
try {
|
|
14974
15182
|
const pkg4 = JSON.parse(readFileSync6(pkgJsonPath, "utf8"));
|
|
14975
|
-
if (pkg4.workspaces ||
|
|
15183
|
+
if (pkg4.workspaces || existsSync6(join17(dir, "pnpm-workspace.yaml"))) {
|
|
14976
15184
|
workspaceRootCache.set(startDir, dir);
|
|
14977
15185
|
return dir;
|
|
14978
15186
|
}
|
|
@@ -14992,8 +15200,8 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
14992
15200
|
return workspacePackageDirsCache.get(workspaceRoot);
|
|
14993
15201
|
}
|
|
14994
15202
|
const packageMap = /* @__PURE__ */ new Map();
|
|
14995
|
-
const packagesDir =
|
|
14996
|
-
if (!
|
|
15203
|
+
const packagesDir = join17(workspaceRoot, "packages");
|
|
15204
|
+
if (!existsSync6(packagesDir)) {
|
|
14997
15205
|
workspacePackageDirsCache.set(workspaceRoot, packageMap);
|
|
14998
15206
|
return packageMap;
|
|
14999
15207
|
}
|
|
@@ -15002,12 +15210,12 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
15002
15210
|
return;
|
|
15003
15211
|
let entries;
|
|
15004
15212
|
try {
|
|
15005
|
-
entries =
|
|
15213
|
+
entries = readdirSync3(dir);
|
|
15006
15214
|
} catch {
|
|
15007
15215
|
return;
|
|
15008
15216
|
}
|
|
15009
|
-
const pkgJsonPath =
|
|
15010
|
-
if (
|
|
15217
|
+
const pkgJsonPath = join17(dir, "package.json");
|
|
15218
|
+
if (existsSync6(pkgJsonPath)) {
|
|
15011
15219
|
try {
|
|
15012
15220
|
const pkg4 = JSON.parse(readFileSync6(pkgJsonPath, "utf8"));
|
|
15013
15221
|
if (typeof pkg4.name === "string") {
|
|
@@ -15019,7 +15227,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
15019
15227
|
for (const entry of entries) {
|
|
15020
15228
|
if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
|
|
15021
15229
|
continue;
|
|
15022
|
-
const entryPath =
|
|
15230
|
+
const entryPath = join17(dir, entry);
|
|
15023
15231
|
try {
|
|
15024
15232
|
const stat7 = statSync3(entryPath);
|
|
15025
15233
|
if (stat7.isDirectory()) {
|
|
@@ -15059,28 +15267,28 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
15059
15267
|
const packageDir = packageDirs.get(packageName);
|
|
15060
15268
|
if (!packageDir)
|
|
15061
15269
|
return null;
|
|
15062
|
-
const pkgJsonPath =
|
|
15270
|
+
const pkgJsonPath = join17(packageDir, "package.json");
|
|
15063
15271
|
try {
|
|
15064
15272
|
const pkg4 = JSON.parse(readFileSync6(pkgJsonPath, "utf8"));
|
|
15065
15273
|
if (pkg4.exports && subpath !== ".") {
|
|
15066
15274
|
const exportValue = pkg4.exports[subpath];
|
|
15067
15275
|
if (typeof exportValue === "string" && exportValue.endsWith(".vue")) {
|
|
15068
15276
|
const resolved = resolve14(packageDir, exportValue);
|
|
15069
|
-
if (
|
|
15277
|
+
if (existsSync6(resolved))
|
|
15070
15278
|
return resolved;
|
|
15071
15279
|
}
|
|
15072
15280
|
}
|
|
15073
15281
|
if (subpath !== ".") {
|
|
15074
15282
|
const subDir = resolve14(packageDir, subpath.replace(/^\.\//, ""));
|
|
15075
|
-
for (const base of [
|
|
15076
|
-
const subPkgPath =
|
|
15077
|
-
if (
|
|
15283
|
+
for (const base of [join17(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
|
|
15284
|
+
const subPkgPath = join17(base, "package.json");
|
|
15285
|
+
if (existsSync6(subPkgPath)) {
|
|
15078
15286
|
try {
|
|
15079
15287
|
const subPkg = JSON.parse(readFileSync6(subPkgPath, "utf8"));
|
|
15080
15288
|
const main = subPkg.main || subPkg.module;
|
|
15081
15289
|
if (typeof main === "string" && main.endsWith(".vue")) {
|
|
15082
15290
|
const resolved = resolve14(base, main);
|
|
15083
|
-
if (
|
|
15291
|
+
if (existsSync6(resolved))
|
|
15084
15292
|
return resolved;
|
|
15085
15293
|
}
|
|
15086
15294
|
} catch {
|
|
@@ -15092,7 +15300,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
15092
15300
|
const main = pkg4.main || pkg4.module;
|
|
15093
15301
|
if (typeof main === "string" && main.endsWith(".vue")) {
|
|
15094
15302
|
const resolved = resolve14(packageDir, main);
|
|
15095
|
-
if (
|
|
15303
|
+
if (existsSync6(resolved))
|
|
15096
15304
|
return resolved;
|
|
15097
15305
|
}
|
|
15098
15306
|
}
|
|
@@ -15534,7 +15742,7 @@ var init_astro = __esm({
|
|
|
15534
15742
|
});
|
|
15535
15743
|
|
|
15536
15744
|
// packages/experience-design-system-extraction/dist/src/extract/web-components.js
|
|
15537
|
-
import { basename as basename5, dirname as dirname9, join as
|
|
15745
|
+
import { basename as basename5, dirname as dirname9, join as join18, resolve as resolve15 } from "node:path";
|
|
15538
15746
|
import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
|
|
15539
15747
|
function normalizeComponentName(input) {
|
|
15540
15748
|
return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
@@ -16187,14 +16395,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
|
16187
16395
|
if (!specifier.startsWith(spectrumPrefix)) {
|
|
16188
16396
|
return null;
|
|
16189
16397
|
}
|
|
16190
|
-
const packagesMarker = `${
|
|
16398
|
+
const packagesMarker = `${join18("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
|
|
16191
16399
|
const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
|
|
16192
16400
|
if (markerIndex === -1) {
|
|
16193
16401
|
return null;
|
|
16194
16402
|
}
|
|
16195
16403
|
const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
|
|
16196
16404
|
const componentPath = specifier.slice(spectrumPrefix.length);
|
|
16197
|
-
return
|
|
16405
|
+
return join18(packagesRoot, "core", "components", componentPath, "index.ts");
|
|
16198
16406
|
}
|
|
16199
16407
|
function getImportedBaseClass(classDecl, project, visitedFiles) {
|
|
16200
16408
|
const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
|
|
@@ -16461,8 +16669,8 @@ var init_scoring = __esm({
|
|
|
16461
16669
|
|
|
16462
16670
|
// packages/experience-design-system-extraction/dist/src/extract/svelte.js
|
|
16463
16671
|
import os3 from "node:os";
|
|
16464
|
-
import { basename as basename6, dirname as dirname10, resolve as resolve16, join as
|
|
16465
|
-
import { existsSync as
|
|
16672
|
+
import { basename as basename6, dirname as dirname10, resolve as resolve16, join as join19 } from "node:path";
|
|
16673
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
16466
16674
|
import { createRequire } from "node:module";
|
|
16467
16675
|
import { parse as parseSvelte } from "svelte/compiler";
|
|
16468
16676
|
import { Project as Project6, Node as Node9, ScriptTarget, ModuleKind, ts as ts2 } from "ts-morph";
|
|
@@ -16595,8 +16803,8 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
|
|
|
16595
16803
|
function findNearestTsconfig(startDir) {
|
|
16596
16804
|
let dir = startDir;
|
|
16597
16805
|
for (let i = 0; i < 16; i++) {
|
|
16598
|
-
const candidate =
|
|
16599
|
-
if (
|
|
16806
|
+
const candidate = join19(dir, "tsconfig.json");
|
|
16807
|
+
if (existsSync7(candidate))
|
|
16600
16808
|
return candidate;
|
|
16601
16809
|
const parent = dirname10(dir);
|
|
16602
16810
|
if (!parent || parent === dir)
|
|
@@ -16731,29 +16939,29 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
16731
16939
|
const seedDir = resolvedJs ? dirname10(resolvedJs) : dirname10(parentFile);
|
|
16732
16940
|
const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
|
|
16733
16941
|
if (pkgRoot) {
|
|
16734
|
-
const pkgJsonPath =
|
|
16735
|
-
if (
|
|
16942
|
+
const pkgJsonPath = join19(pkgRoot, "package.json");
|
|
16943
|
+
if (existsSync7(pkgJsonPath)) {
|
|
16736
16944
|
try {
|
|
16737
16945
|
const pkgRaw = readFileSync7(pkgJsonPath, "utf-8");
|
|
16738
16946
|
const pkg4 = JSON.parse(pkgRaw);
|
|
16739
16947
|
const typesField = pkg4.types ?? pkg4.typings;
|
|
16740
16948
|
if (typeof typesField === "string") {
|
|
16741
16949
|
const candidate = resolve16(pkgRoot, typesField);
|
|
16742
|
-
if (
|
|
16950
|
+
if (existsSync7(candidate))
|
|
16743
16951
|
return candidate;
|
|
16744
16952
|
}
|
|
16745
16953
|
const exportsTypes = extractTypesFromExports(pkg4.exports);
|
|
16746
16954
|
if (exportsTypes) {
|
|
16747
16955
|
const candidate = resolve16(pkgRoot, exportsTypes);
|
|
16748
|
-
if (
|
|
16956
|
+
if (existsSync7(candidate))
|
|
16749
16957
|
return candidate;
|
|
16750
16958
|
}
|
|
16751
16959
|
} catch {
|
|
16752
16960
|
}
|
|
16753
16961
|
}
|
|
16754
16962
|
for (const entry of ["index.d.ts", "index.d.mts"]) {
|
|
16755
|
-
const candidate =
|
|
16756
|
-
if (
|
|
16963
|
+
const candidate = join19(pkgRoot, entry);
|
|
16964
|
+
if (existsSync7(candidate))
|
|
16757
16965
|
return candidate;
|
|
16758
16966
|
}
|
|
16759
16967
|
}
|
|
@@ -16761,7 +16969,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
16761
16969
|
const noExt = resolvedJs.replace(/\.(m?js|cjs)$/, "");
|
|
16762
16970
|
for (const ext of [".d.ts", ".d.mts"]) {
|
|
16763
16971
|
const candidate = `${noExt}${ext}`;
|
|
16764
|
-
if (
|
|
16972
|
+
if (existsSync7(candidate))
|
|
16765
16973
|
return candidate;
|
|
16766
16974
|
}
|
|
16767
16975
|
}
|
|
@@ -16770,9 +16978,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
16770
16978
|
function findPackageRootForSpecifier(seedDir, specifier) {
|
|
16771
16979
|
let dir = seedDir;
|
|
16772
16980
|
for (let i = 0; i < 32; i++) {
|
|
16773
|
-
if (
|
|
16981
|
+
if (existsSync7(join19(dir, "package.json"))) {
|
|
16774
16982
|
try {
|
|
16775
|
-
const pkgRaw = readFileSync7(
|
|
16983
|
+
const pkgRaw = readFileSync7(join19(dir, "package.json"), "utf-8");
|
|
16776
16984
|
const pkg4 = JSON.parse(pkgRaw);
|
|
16777
16985
|
if (pkg4.name === specifier)
|
|
16778
16986
|
return dir;
|
|
@@ -20126,17 +20334,17 @@ function buildCycleUnits(slotCycles) {
|
|
|
20126
20334
|
const groups = /* @__PURE__ */ new Map();
|
|
20127
20335
|
for (const node of parent.keys()) {
|
|
20128
20336
|
const root = find(node);
|
|
20129
|
-
let
|
|
20130
|
-
if (!
|
|
20131
|
-
|
|
20132
|
-
groups.set(root,
|
|
20337
|
+
let group2 = groups.get(root);
|
|
20338
|
+
if (!group2) {
|
|
20339
|
+
group2 = /* @__PURE__ */ new Set();
|
|
20340
|
+
groups.set(root, group2);
|
|
20133
20341
|
}
|
|
20134
|
-
|
|
20342
|
+
group2.add(node);
|
|
20135
20343
|
}
|
|
20136
20344
|
const out = /* @__PURE__ */ new Map();
|
|
20137
|
-
for (const
|
|
20138
|
-
for (const node of
|
|
20139
|
-
out.set(node,
|
|
20345
|
+
for (const group2 of groups.values()) {
|
|
20346
|
+
for (const node of group2) {
|
|
20347
|
+
out.set(node, group2);
|
|
20140
20348
|
}
|
|
20141
20349
|
}
|
|
20142
20350
|
return out;
|
|
@@ -21630,10 +21838,10 @@ function swapValues(values, firstIndex, secondIndex) {
|
|
|
21630
21838
|
[next[firstIndex], next[secondIndex]] = [next[secondIndex], next[firstIndex]];
|
|
21631
21839
|
return next;
|
|
21632
21840
|
}
|
|
21633
|
-
function parseToState(
|
|
21841
|
+
function parseToState(json2) {
|
|
21634
21842
|
let parsed;
|
|
21635
21843
|
try {
|
|
21636
|
-
parsed = JSON.parse(
|
|
21844
|
+
parsed = JSON.parse(json2);
|
|
21637
21845
|
} catch (e) {
|
|
21638
21846
|
return {
|
|
21639
21847
|
state: { componentDescription: "", props: [], slots: [] },
|
|
@@ -22486,11 +22694,11 @@ function FieldEditor({
|
|
|
22486
22694
|
setEditorState(next);
|
|
22487
22695
|
onChange(serializeState(next, value));
|
|
22488
22696
|
};
|
|
22489
|
-
const canonicalize = React14.useCallback((
|
|
22697
|
+
const canonicalize = React14.useCallback((json2) => {
|
|
22490
22698
|
try {
|
|
22491
|
-
return JSON.stringify(JSON.parse(
|
|
22699
|
+
return JSON.stringify(JSON.parse(json2));
|
|
22492
22700
|
} catch {
|
|
22493
|
-
return `__unparseable__:${
|
|
22701
|
+
return `__unparseable__:${json2}`;
|
|
22494
22702
|
}
|
|
22495
22703
|
}, []);
|
|
22496
22704
|
const initialStateRef = React14.useRef(initialState);
|
|
@@ -23064,14 +23272,14 @@ function FieldEditor({
|
|
|
23064
23272
|
})();
|
|
23065
23273
|
const rows = [];
|
|
23066
23274
|
rows.push({ kind: "component-description" });
|
|
23067
|
-
for (const
|
|
23068
|
-
if (
|
|
23275
|
+
for (const group2 of propGroups.filter((candidate) => candidate.kind !== "hidden")) {
|
|
23276
|
+
if (group2.indexes.length === 0) continue;
|
|
23069
23277
|
rows.push({
|
|
23070
23278
|
kind: "header",
|
|
23071
|
-
label: `${
|
|
23072
|
-
section:
|
|
23279
|
+
label: `${group2.label} (${group2.indexes.length}) `,
|
|
23280
|
+
section: group2.kind
|
|
23073
23281
|
});
|
|
23074
|
-
|
|
23282
|
+
group2.indexes.forEach((idx) => rows.push({ kind: "prop", idx }));
|
|
23075
23283
|
}
|
|
23076
23284
|
if (slots.length > 0) {
|
|
23077
23285
|
rows.push({
|
|
@@ -23081,7 +23289,7 @@ function FieldEditor({
|
|
|
23081
23289
|
});
|
|
23082
23290
|
slots.forEach((_, i) => rows.push({ kind: "slot", idx: i }));
|
|
23083
23291
|
}
|
|
23084
|
-
const hiddenGroup = propGroups.find((
|
|
23292
|
+
const hiddenGroup = propGroups.find((group2) => group2.kind === "hidden");
|
|
23085
23293
|
if (hiddenGroup && hiddenGroup.indexes.length > 0) {
|
|
23086
23294
|
rows.push({
|
|
23087
23295
|
kind: "header",
|
|
@@ -26866,7 +27074,7 @@ var init_fetch_existing_contentful_entities = __esm({
|
|
|
26866
27074
|
|
|
26867
27075
|
// packages/experience-design-system-cli-legacy/src/helpers/fetch-and-persist-existing-contentful-entities.ts
|
|
26868
27076
|
import { writeFile as writeFile5 } from "node:fs/promises";
|
|
26869
|
-
import { join as
|
|
27077
|
+
import { join as join20 } from "node:path";
|
|
26870
27078
|
async function fetchAndPersistExistingContentfulEntities(params) {
|
|
26871
27079
|
const t0 = Date.now();
|
|
26872
27080
|
try {
|
|
@@ -26878,7 +27086,7 @@ async function fetchAndPersistExistingContentfulEntities(params) {
|
|
|
26878
27086
|
spaceId: params.spaceId,
|
|
26879
27087
|
environmentId: params.environmentId
|
|
26880
27088
|
});
|
|
26881
|
-
const path =
|
|
27089
|
+
const path = join20(params.outDir, ".existing-entities.json");
|
|
26882
27090
|
await writeFile5(path, JSON.stringify(entities, null, 2), "utf8");
|
|
26883
27091
|
return { ok: true, path, durationMs: Date.now() - t0, entities };
|
|
26884
27092
|
} catch (error) {
|
|
@@ -27055,8 +27263,8 @@ __export(WizardApp_exports, {
|
|
|
27055
27263
|
});
|
|
27056
27264
|
import { useEffect as useEffect15, useRef as useRef10, useState as useState23 } from "react";
|
|
27057
27265
|
import { Box as Box42, Text as Text46 } from "ink";
|
|
27058
|
-
import { join as
|
|
27059
|
-
import { appendFileSync as appendFileSync2, writeFileSync } from "node:fs";
|
|
27266
|
+
import { join as join21, resolve as resolve17 } from "node:path";
|
|
27267
|
+
import { appendFileSync as appendFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
27060
27268
|
import { access as access7, stat as stat5, writeFile as writeFile6 } from "node:fs/promises";
|
|
27061
27269
|
import { tmpdir } from "node:os";
|
|
27062
27270
|
import { execFile as execFile2, spawn as spawn3 } from "node:child_process";
|
|
@@ -27196,7 +27404,7 @@ function WizardApp({
|
|
|
27196
27404
|
const logInit = useRef10(false);
|
|
27197
27405
|
const initialAgentAuthRef = useRef10(initialAgentAuth ?? null);
|
|
27198
27406
|
if (!logInit.current) {
|
|
27199
|
-
|
|
27407
|
+
writeFileSync2(WIZARD_LOG, `--- experiences import session ${(/* @__PURE__ */ new Date()).toISOString()} ---
|
|
27200
27408
|
`);
|
|
27201
27409
|
logInit.current = true;
|
|
27202
27410
|
}
|
|
@@ -27205,6 +27413,7 @@ function WizardApp({
|
|
|
27205
27413
|
tokensPath: ""
|
|
27206
27414
|
});
|
|
27207
27415
|
const allowEmptyDeleteAllRef = useRef10(false);
|
|
27416
|
+
const pushDebugRef = useRef10(null);
|
|
27208
27417
|
const generateChildRef = useRef10(null);
|
|
27209
27418
|
const generationCachePreflightRef = useRef10(null);
|
|
27210
27419
|
const selectionToReviewStartedAtRef = useRef10(null);
|
|
@@ -27223,7 +27432,7 @@ function WizardApp({
|
|
|
27223
27432
|
const rawTokensEntryReady = !!initialRawTokensPath;
|
|
27224
27433
|
const effectiveNoCache = resolveNoCacheForGenerate({ cliNoCache: noCache });
|
|
27225
27434
|
const initialStepResolved = rawTokensEntryReady ? initialProjectPath ? "path-validation" : "credentials" : initialProjectPath ? "token-input" : "welcome";
|
|
27226
|
-
const initialOutDir = initialProjectPath ?
|
|
27435
|
+
const initialOutDir = initialProjectPath ? join21(resolve17(initialProjectPath), ".contentful") : "";
|
|
27227
27436
|
const [state, setState] = useState23({
|
|
27228
27437
|
step: initialStepResolved,
|
|
27229
27438
|
agent: initialAgent ?? "claude",
|
|
@@ -27421,7 +27630,7 @@ If you are using AWS Bedrock, run:
|
|
|
27421
27630
|
}
|
|
27422
27631
|
const sessionMatch = /^session=(.+)$/m.exec(result.stdout);
|
|
27423
27632
|
const tokenSessionId = sessionMatch ? sessionMatch[1].trim() : null;
|
|
27424
|
-
const tokensPath =
|
|
27633
|
+
const tokensPath = join21(outDir, "tokens.json");
|
|
27425
27634
|
const printArgs = ["print", "tokens", "--out", tokensPath];
|
|
27426
27635
|
if (tokenSessionId) printArgs.push("--session", tokenSessionId);
|
|
27427
27636
|
const r = await runCli(printArgs);
|
|
@@ -27443,7 +27652,7 @@ If you are using AWS Bedrock, run:
|
|
|
27443
27652
|
tokenGenerationStatus: "complete",
|
|
27444
27653
|
skipComponents: true,
|
|
27445
27654
|
acceptedCount: 0,
|
|
27446
|
-
outDir: state.outDir ||
|
|
27655
|
+
outDir: state.outDir || join21(process.cwd(), ".contentful")
|
|
27447
27656
|
});
|
|
27448
27657
|
update({ step: "credentials" });
|
|
27449
27658
|
return true;
|
|
@@ -27584,7 +27793,7 @@ If you are using AWS Bedrock, run:
|
|
|
27584
27793
|
return promise;
|
|
27585
27794
|
};
|
|
27586
27795
|
const runExtract = async (projectPath, showProgress = true) => {
|
|
27587
|
-
const outDir =
|
|
27796
|
+
const outDir = join21(resolve17(projectPath), ".contentful");
|
|
27588
27797
|
const existingEntitiesExpected = !state.credentialsSkipped && Boolean(state.spaceId && state.environmentId && state.cmaToken && projectPath);
|
|
27589
27798
|
update({
|
|
27590
27799
|
...showProgress ? { step: "extracting" } : {},
|
|
@@ -28259,12 +28468,30 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
28259
28468
|
void runSaveAndPush();
|
|
28260
28469
|
};
|
|
28261
28470
|
const runPreview = async (extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host2) => {
|
|
28471
|
+
const resolvedHost = resolveWizardHost(host2);
|
|
28472
|
+
pushDebugRef.current?.finish({
|
|
28473
|
+
outcome: "superseded",
|
|
28474
|
+
summary: "A new push attempt started before this one finished."
|
|
28475
|
+
});
|
|
28476
|
+
const pushDebug = startPushDebugRun({
|
|
28477
|
+
space_id: spaceId,
|
|
28478
|
+
environment_id: environmentId,
|
|
28479
|
+
host: resolvedHost,
|
|
28480
|
+
cma_token: cmaToken,
|
|
28481
|
+
extract_session_id: extractSessionId,
|
|
28482
|
+
tokens_file: tokensPath || null,
|
|
28483
|
+
delete_everything_not_listed: allowEmptyDeleteAllRef.current
|
|
28484
|
+
});
|
|
28485
|
+
pushDebugRef.current = pushDebug;
|
|
28262
28486
|
if (shouldBypassPreview(state)) {
|
|
28487
|
+
pushDebug.finish({
|
|
28488
|
+
outcome: "skipped",
|
|
28489
|
+
summary: "Credentials were skipped, so nothing is previewed or pushed. Files were saved only."
|
|
28490
|
+
});
|
|
28263
28491
|
update(buildSkippedPreviewTransition());
|
|
28264
28492
|
return;
|
|
28265
28493
|
}
|
|
28266
28494
|
update({ step: "previewing" });
|
|
28267
|
-
const resolvedHost = resolveWizardHost(host2);
|
|
28268
28495
|
try {
|
|
28269
28496
|
const client2 = new ImportApiClient({
|
|
28270
28497
|
cmaToken,
|
|
@@ -28272,6 +28499,7 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
28272
28499
|
environmentId,
|
|
28273
28500
|
host: resolvedHost
|
|
28274
28501
|
});
|
|
28502
|
+
pushDebug.event("Preview started", { note: `POST ${resolvedHost}/\u2026/design_systems/imports/preview` });
|
|
28275
28503
|
let components = [];
|
|
28276
28504
|
if (extractSessionId) {
|
|
28277
28505
|
const db = openPipelineDb();
|
|
@@ -28287,7 +28515,16 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
28287
28515
|
tokens = await readTokensFromPath("tokens", tokensPath);
|
|
28288
28516
|
}
|
|
28289
28517
|
let cdf = buildCDF3(components, toCDFTokens(tokens), { deleteAll: allowEmptyDeleteAllRef.current });
|
|
28518
|
+
pushDebug.event("Built the CDF to send", {
|
|
28519
|
+
note: `${summarizeCdf(cdf).length} entries`,
|
|
28520
|
+
data: { entries: summarizeCdf(cdf), tokens_loaded: tokens.length }
|
|
28521
|
+
});
|
|
28290
28522
|
let preview = await client2.previewImport(cdf);
|
|
28523
|
+
pushDebug.event("Server previewed the CDF", {
|
|
28524
|
+
note: "what the server would create, change, leave alone or remove",
|
|
28525
|
+
data: summarizePreview(preview),
|
|
28526
|
+
requestId: client2.getLastRequestId()
|
|
28527
|
+
});
|
|
28291
28528
|
if (extractSessionId) {
|
|
28292
28529
|
let needsRepreview = false;
|
|
28293
28530
|
const db = openPipelineDb();
|
|
@@ -28307,15 +28544,27 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
28307
28544
|
if (seededDefaults > 0) needsRepreview = true;
|
|
28308
28545
|
}
|
|
28309
28546
|
if (needsRepreview) {
|
|
28547
|
+
pushDebug.event("Re-previewing", {
|
|
28548
|
+
note: "the server listed components as removed or changed that exist locally, so defaults were filled in"
|
|
28549
|
+
});
|
|
28310
28550
|
components = loadCDFComponents(db, extractSessionId);
|
|
28311
28551
|
cdf = buildCDF3(components, toCDFTokens(tokens), { deleteAll: allowEmptyDeleteAllRef.current });
|
|
28312
28552
|
preview = await client2.previewImport(cdf);
|
|
28553
|
+
pushDebug.event("Server previewed the updated CDF", {
|
|
28554
|
+
data: summarizePreview(preview),
|
|
28555
|
+
requestId: client2.getLastRequestId()
|
|
28556
|
+
});
|
|
28313
28557
|
}
|
|
28314
28558
|
} finally {
|
|
28315
28559
|
db.close();
|
|
28316
28560
|
}
|
|
28317
28561
|
}
|
|
28318
28562
|
if (isEmptyPreview(preview)) {
|
|
28563
|
+
pushDebug.finish({
|
|
28564
|
+
outcome: "nothing-to-push",
|
|
28565
|
+
summary: "The server says every component and token in the CDF already matches what is in this space, so no apply request was sent. If the space looks empty, check that this is the space and environment you are viewing.",
|
|
28566
|
+
details: { preview: summarizePreview(preview), request_id: client2.getLastRequestId() }
|
|
28567
|
+
});
|
|
28319
28568
|
update({
|
|
28320
28569
|
step: "done",
|
|
28321
28570
|
serverPreview: preview,
|
|
@@ -28327,6 +28576,9 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
28327
28576
|
});
|
|
28328
28577
|
return;
|
|
28329
28578
|
}
|
|
28579
|
+
pushDebug.event("Waiting for confirmation", {
|
|
28580
|
+
note: "the preview shows changes, so the wizard asks before pushing"
|
|
28581
|
+
});
|
|
28330
28582
|
update({
|
|
28331
28583
|
step: "preview-gate",
|
|
28332
28584
|
serverPreview: preview,
|
|
@@ -28335,6 +28587,11 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
28335
28587
|
...clearedValidationErrorState()
|
|
28336
28588
|
});
|
|
28337
28589
|
} catch (e) {
|
|
28590
|
+
pushDebug.finish({
|
|
28591
|
+
outcome: "preview-failed",
|
|
28592
|
+
summary: e instanceof ApiError ? `The preview request was rejected with HTTP ${e.status}.` : `The preview failed before the server answered: ${e instanceof Error ? e.message : String(e)}`,
|
|
28593
|
+
details: e instanceof ApiError ? { status: e.status, body: (e.body ?? "").slice(0, 4e3) } : { error: e instanceof Error ? e.message : String(e) }
|
|
28594
|
+
});
|
|
28338
28595
|
if (e instanceof ApiError) {
|
|
28339
28596
|
if (e.status === 401 || e.status === 403) {
|
|
28340
28597
|
let bodyMsg = "";
|
|
@@ -28397,7 +28654,18 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28397
28654
|
}
|
|
28398
28655
|
};
|
|
28399
28656
|
const runPush = async (cdf, spaceId, environmentId, cmaToken, host2, acknowledgeBreakingChanges, preview) => {
|
|
28657
|
+
const pushDebug = pushDebugRef.current ?? startPushDebugRun({
|
|
28658
|
+
space_id: spaceId,
|
|
28659
|
+
environment_id: environmentId,
|
|
28660
|
+
host: resolveWizardHost(host2),
|
|
28661
|
+
cma_token: cmaToken
|
|
28662
|
+
});
|
|
28663
|
+
pushDebugRef.current = pushDebug;
|
|
28400
28664
|
if (shouldRefusePush(state)) {
|
|
28665
|
+
pushDebug.finish({
|
|
28666
|
+
outcome: "skipped",
|
|
28667
|
+
summary: "Credentials were skipped, so the push was refused. Files were saved only."
|
|
28668
|
+
});
|
|
28401
28669
|
update(buildSkippedPushTransition());
|
|
28402
28670
|
return;
|
|
28403
28671
|
}
|
|
@@ -28405,6 +28673,11 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28405
28673
|
const hasComponentChanges = preview.components.new.length > 0 || preview.components.changed.length > 0 || preview.components.removed.length > 0;
|
|
28406
28674
|
const hasTokenChanges = preview.tokens.new.length > 0 || preview.tokens.changed.length > 0 || preview.tokens.removed.length > 0;
|
|
28407
28675
|
if (!hasComponentChanges && !hasTokenChanges) {
|
|
28676
|
+
pushDebug.finish({
|
|
28677
|
+
outcome: "nothing-to-push",
|
|
28678
|
+
summary: "The preview had no new, changed or removed items, so no apply request was sent.",
|
|
28679
|
+
details: { preview: summarizePreview(preview) }
|
|
28680
|
+
});
|
|
28408
28681
|
update({
|
|
28409
28682
|
step: "done",
|
|
28410
28683
|
pushResult: {
|
|
@@ -28417,6 +28690,11 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28417
28690
|
}
|
|
28418
28691
|
const cycles = detectSlotCycles(extractComponents(cdf));
|
|
28419
28692
|
if (cycles.length > 0) {
|
|
28693
|
+
pushDebug.finish({
|
|
28694
|
+
outcome: "failed",
|
|
28695
|
+
summary: "The push was blocked locally because components slot each other in a cycle.",
|
|
28696
|
+
details: { cycles: formatSlotCycleReport(cycles) }
|
|
28697
|
+
});
|
|
28420
28698
|
update({
|
|
28421
28699
|
step: "error",
|
|
28422
28700
|
errorStep: "apply",
|
|
@@ -28427,6 +28705,11 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28427
28705
|
}
|
|
28428
28706
|
const unresolvedSlotReferences = validateSlotReferences2(extractComponents(cdf));
|
|
28429
28707
|
if (unresolvedSlotReferences.length > 0) {
|
|
28708
|
+
pushDebug.finish({
|
|
28709
|
+
outcome: "failed",
|
|
28710
|
+
summary: "The push was blocked locally because a slot refers to a component that is not in the CDF.",
|
|
28711
|
+
details: { unresolved: formatUnresolvedSlotReferences(unresolvedSlotReferences) }
|
|
28712
|
+
});
|
|
28430
28713
|
update({
|
|
28431
28714
|
step: "error",
|
|
28432
28715
|
errorStep: "apply",
|
|
@@ -28436,6 +28719,14 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28436
28719
|
return;
|
|
28437
28720
|
}
|
|
28438
28721
|
update({ step: "pushing", pushProgress: null, errorAllowBreakingChangeAcknowledgment: false });
|
|
28722
|
+
pushDebug.event("Apply started", {
|
|
28723
|
+
note: `POST ${resolveWizardHost(host2)}/\u2026/design_systems/imports/apply`,
|
|
28724
|
+
data: {
|
|
28725
|
+
acknowledge_breaking_changes: acknowledgeBreakingChanges,
|
|
28726
|
+
sending: summarizeCdf(cdf),
|
|
28727
|
+
expected: preview ? summarizePreview(preview) : null
|
|
28728
|
+
}
|
|
28729
|
+
});
|
|
28439
28730
|
try {
|
|
28440
28731
|
const resolvedHost = resolveWizardHost(host2);
|
|
28441
28732
|
const client2 = new ImportApiClient({
|
|
@@ -28445,6 +28736,11 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28445
28736
|
host: resolvedHost
|
|
28446
28737
|
});
|
|
28447
28738
|
let operation = await client2.applyImport(cdf, { acknowledgeBreakingChanges });
|
|
28739
|
+
pushDebug.event("Server accepted the apply request", {
|
|
28740
|
+
note: `operation ${operation.sys.id} is ${operation.sys.status}`,
|
|
28741
|
+
data: { operation_id: operation.sys.id, status: operation.sys.status, summary: operation.summary },
|
|
28742
|
+
requestId: client2.getLastRequestId()
|
|
28743
|
+
});
|
|
28448
28744
|
try {
|
|
28449
28745
|
logStep({
|
|
28450
28746
|
applyResponse: {
|
|
@@ -28461,9 +28757,15 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28461
28757
|
pushProgress: { kind: "queued", operationId: operation.sys.id }
|
|
28462
28758
|
});
|
|
28463
28759
|
let pollCount = 0;
|
|
28760
|
+
let lastPolledStatus = "";
|
|
28464
28761
|
operation = await client2.pollOperation(operation.sys.id, {
|
|
28465
28762
|
onProgress: (op) => {
|
|
28466
28763
|
pollCount++;
|
|
28764
|
+
const polled = `${op.sys.status} ${op.summary ? `${op.summary.total - op.summary.pending}/${op.summary.total}` : ""}`;
|
|
28765
|
+
if (polled !== lastPolledStatus) {
|
|
28766
|
+
lastPolledStatus = polled;
|
|
28767
|
+
pushDebug.event("Operation status changed", { note: polled.trim(), requestId: client2.getLastRequestId() });
|
|
28768
|
+
}
|
|
28467
28769
|
const s = op.summary;
|
|
28468
28770
|
if (s) {
|
|
28469
28771
|
const done = s.total - s.pending;
|
|
@@ -28568,6 +28870,29 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28568
28870
|
);
|
|
28569
28871
|
}
|
|
28570
28872
|
}
|
|
28873
|
+
const failedItems = items.filter((item) => item.status === "failed");
|
|
28874
|
+
const pushedCount = items.filter((item) => item.status === "succeeded").length;
|
|
28875
|
+
pushDebug.finish({
|
|
28876
|
+
outcome: pushSucceeded ? "pushed" : pushedCount > 0 ? "partial" : "failed",
|
|
28877
|
+
summary: pushSucceeded ? items.length > 0 ? `The server reports ${pushedCount} of ${items.length} items applied.` : `The operation finished as ${operation.sys.status}, but the server returned no per-item results, so the counts come from the preview.` : `The operation finished as ${operation.sys.status}; ${failedItems.length} item(s) failed.`,
|
|
28878
|
+
details: {
|
|
28879
|
+
operation_id: operation.sys.id,
|
|
28880
|
+
operation_status: operation.sys.status,
|
|
28881
|
+
server_summary: operation.summary,
|
|
28882
|
+
items: items.map((item) => ({
|
|
28883
|
+
type: item.entityType,
|
|
28884
|
+
id: item.id,
|
|
28885
|
+
action: item.action,
|
|
28886
|
+
status: item.status,
|
|
28887
|
+
...item.error ? { error: formatEdsiError(item.error) } : {}
|
|
28888
|
+
})),
|
|
28889
|
+
shown_to_user: {
|
|
28890
|
+
component_types: pushResult.componentTypes,
|
|
28891
|
+
design_tokens: pushResult.designTokens
|
|
28892
|
+
},
|
|
28893
|
+
request_id: client2.getLastRequestId()
|
|
28894
|
+
}
|
|
28895
|
+
});
|
|
28571
28896
|
update({ step: "done", pushResult });
|
|
28572
28897
|
} catch (e) {
|
|
28573
28898
|
let msg;
|
|
@@ -28578,6 +28903,14 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28578
28903
|
} else {
|
|
28579
28904
|
msg = "Push failed";
|
|
28580
28905
|
}
|
|
28906
|
+
pushDebug.finish({
|
|
28907
|
+
outcome: "failed",
|
|
28908
|
+
summary: e instanceof ApiError ? `The apply request failed with HTTP ${e.status}.` : `The apply request failed before the server answered: ${msg}`,
|
|
28909
|
+
details: {
|
|
28910
|
+
message: msg,
|
|
28911
|
+
...e instanceof ApiError ? { status: e.status, body: (e.body ?? "").slice(0, 4e3) } : {}
|
|
28912
|
+
}
|
|
28913
|
+
});
|
|
28581
28914
|
update({
|
|
28582
28915
|
step: "error",
|
|
28583
28916
|
errorStep: "apply",
|
|
@@ -28589,7 +28922,7 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28589
28922
|
};
|
|
28590
28923
|
const runPrintFiles = async (extractSessionId, outDir, opts = {}) => {
|
|
28591
28924
|
update({ step: "printing" });
|
|
28592
|
-
const componentsPath =
|
|
28925
|
+
const componentsPath = join21(outDir, "components.json");
|
|
28593
28926
|
try {
|
|
28594
28927
|
const db = openPipelineDb();
|
|
28595
28928
|
let components = [];
|
|
@@ -28692,7 +29025,7 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28692
29025
|
if (tokenReuseChecked.current) return;
|
|
28693
29026
|
tokenReuseChecked.current = true;
|
|
28694
29027
|
const tokenNextStep = state.projectPath ? "path-validation" : "credentials";
|
|
28695
|
-
const existingTokensPath =
|
|
29028
|
+
const existingTokensPath = join21(state.outDir, "tokens.json");
|
|
28696
29029
|
if (effectiveNoCache) {
|
|
28697
29030
|
tokenGenerationPromiseRef.current = runAgentAuthCheck(tokenNextStep).then(
|
|
28698
29031
|
(ok2) => ok2 ? runGenerateTokens(state.rawTokensPath, state.outDir) : false
|
|
@@ -28743,7 +29076,7 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28743
29076
|
{
|
|
28744
29077
|
onContinue: (path) => {
|
|
28745
29078
|
const projectPath = normalizePath(path);
|
|
28746
|
-
const outDir =
|
|
29079
|
+
const outDir = join21(projectPath, ".contentful");
|
|
28747
29080
|
update({ step: "token-input", projectPath, outDir });
|
|
28748
29081
|
},
|
|
28749
29082
|
onQuit: () => process.exit(0)
|
|
@@ -29241,6 +29574,7 @@ var init_WizardApp = __esm({
|
|
|
29241
29574
|
init_theme();
|
|
29242
29575
|
init_run_teaser();
|
|
29243
29576
|
init_debug_logger();
|
|
29577
|
+
init_push_debug_log();
|
|
29244
29578
|
init_credentials_store();
|
|
29245
29579
|
init_path_prompt();
|
|
29246
29580
|
init_save_path_resolver();
|
|
@@ -29285,7 +29619,7 @@ var init_WizardApp = __esm({
|
|
|
29285
29619
|
init_use_terminal_size();
|
|
29286
29620
|
init_render_with_goodbye();
|
|
29287
29621
|
SAVE_CONFIRMATION_DELAY_MS = 1e3;
|
|
29288
|
-
WIZARD_LOG =
|
|
29622
|
+
WIZARD_LOG = join21(tmpdir(), "experiences-import-wizard.log");
|
|
29289
29623
|
}
|
|
29290
29624
|
});
|
|
29291
29625
|
|
|
@@ -29465,7 +29799,7 @@ var init_shell = __esm({
|
|
|
29465
29799
|
});
|
|
29466
29800
|
|
|
29467
29801
|
// packages/experience-design-system-cli-legacy/src/setup/lib/checks.ts
|
|
29468
|
-
import { join as
|
|
29802
|
+
import { join as join22 } from "node:path";
|
|
29469
29803
|
function checkNodeVersion(nodeVersion = process.versions.node) {
|
|
29470
29804
|
const major = Number.parseInt(nodeVersion.split(".")[0], 10);
|
|
29471
29805
|
return {
|
|
@@ -29479,7 +29813,7 @@ async function detectNodeVersionManagers(homeDir, deps = {
|
|
|
29479
29813
|
binaryExists,
|
|
29480
29814
|
pathExists: pathExists3
|
|
29481
29815
|
}) {
|
|
29482
|
-
const nvmScript =
|
|
29816
|
+
const nvmScript = join22(homeDir, ".nvm", "nvm.sh");
|
|
29483
29817
|
return {
|
|
29484
29818
|
nvm: await deps.binaryExists("nvm") || await deps.pathExists(nvmScript),
|
|
29485
29819
|
fnm: await deps.binaryExists("fnm"),
|
|
@@ -29558,7 +29892,7 @@ var init_report = __esm({
|
|
|
29558
29892
|
|
|
29559
29893
|
// packages/experience-design-system-cli-legacy/src/doctor/checks.ts
|
|
29560
29894
|
import { homedir as homedir7 } from "node:os";
|
|
29561
|
-
import { join as
|
|
29895
|
+
import { join as join23 } from "node:path";
|
|
29562
29896
|
async function reportNode() {
|
|
29563
29897
|
section("Checking Node.js version");
|
|
29564
29898
|
const check = checkNodeVersion();
|
|
@@ -29609,12 +29943,12 @@ async function reportPnpm(pkgRoot) {
|
|
|
29609
29943
|
}
|
|
29610
29944
|
async function reportDependencies(pkgRoot) {
|
|
29611
29945
|
section("Checking dependencies (pnpm install)");
|
|
29612
|
-
if (!await pathExists3(
|
|
29946
|
+
if (!await pathExists3(join23(pkgRoot, "node_modules"))) {
|
|
29613
29947
|
info("node_modules not found \u2014 running pnpm install...");
|
|
29614
29948
|
} else {
|
|
29615
29949
|
info("Running pnpm install to ensure dependencies are up to date...");
|
|
29616
29950
|
}
|
|
29617
|
-
const check = await installDependencies(
|
|
29951
|
+
const check = await installDependencies(join23(pkgRoot, "..", ".."));
|
|
29618
29952
|
if (!check.passed) {
|
|
29619
29953
|
fail("pnpm install failed");
|
|
29620
29954
|
info("");
|
|
@@ -29631,7 +29965,7 @@ async function reportDependencies(pkgRoot) {
|
|
|
29631
29965
|
async function reportBuild(pkgRoot) {
|
|
29632
29966
|
section("Building CLI");
|
|
29633
29967
|
info("Running pnpm build...");
|
|
29634
|
-
const check = await buildCli(
|
|
29968
|
+
const check = await buildCli(join23(pkgRoot, "..", ".."));
|
|
29635
29969
|
if (!check.passed) {
|
|
29636
29970
|
fail("Build failed");
|
|
29637
29971
|
info("");
|
|
@@ -30846,9 +31180,9 @@ var init_SetupScreen = __esm({
|
|
|
30846
31180
|
|
|
30847
31181
|
// packages/experience-design-system-cli-legacy/src/setup/command.ts
|
|
30848
31182
|
import { readFileSync as readFileSync8 } from "node:fs";
|
|
30849
|
-
import { join as
|
|
31183
|
+
import { join as join24 } from "node:path";
|
|
30850
31184
|
function getCliVersion() {
|
|
30851
|
-
const pkg4 = JSON.parse(readFileSync8(
|
|
31185
|
+
const pkg4 = JSON.parse(readFileSync8(join24(findPkgRoot(), "package.json"), "utf8"));
|
|
30852
31186
|
return pkg4.version;
|
|
30853
31187
|
}
|
|
30854
31188
|
async function runSetup(opts) {
|
|
@@ -30860,7 +31194,7 @@ async function runSetup(opts) {
|
|
|
30860
31194
|
const { renderWithGoodbye: renderWithGoodbye2 } = await Promise.resolve().then(() => (init_render_with_goodbye(), render_with_goodbye_exports));
|
|
30861
31195
|
const { createElement: createElement6 } = await import("react");
|
|
30862
31196
|
const { SetupScreen: SetupScreen2 } = await Promise.resolve().then(() => (init_SetupScreen(), SetupScreen_exports));
|
|
30863
|
-
const repoRoot =
|
|
31197
|
+
const repoRoot = join24(findPkgRoot(), "..", "..");
|
|
30864
31198
|
const completion = { outcome: null };
|
|
30865
31199
|
let unmountInk = null;
|
|
30866
31200
|
const { waitUntilExit, unmount } = renderWithGoodbye2(
|
|
@@ -31061,15 +31395,15 @@ var init_apply_mapping = __esm({
|
|
|
31061
31395
|
});
|
|
31062
31396
|
|
|
31063
31397
|
// packages/experience-design-system-cli-legacy/src/analyze/composition/prompt-loader.ts
|
|
31064
|
-
import { existsSync as
|
|
31065
|
-
import { dirname as dirname11, join as
|
|
31398
|
+
import { existsSync as existsSync8, readFileSync as readFileSync9 } from "node:fs";
|
|
31399
|
+
import { dirname as dirname11, join as join25, resolve as resolve18 } from "node:path";
|
|
31066
31400
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
31067
31401
|
function resolvePromptPath(fileName) {
|
|
31068
31402
|
const thisDir = dirname11(fileURLToPath3(import.meta.url));
|
|
31069
31403
|
let dir = thisDir;
|
|
31070
31404
|
for (; ; ) {
|
|
31071
|
-
const candidate =
|
|
31072
|
-
if (
|
|
31405
|
+
const candidate = join25(dir, "prompts");
|
|
31406
|
+
if (existsSync8(candidate)) return join25(candidate, fileName);
|
|
31073
31407
|
const parent = resolve18(dir, "..");
|
|
31074
31408
|
if (parent === dir) {
|
|
31075
31409
|
throw new Error(
|
|
@@ -31337,7 +31671,7 @@ var init_manifest_doc_evidence = __esm({
|
|
|
31337
31671
|
|
|
31338
31672
|
// packages/experience-design-system-cli-legacy/src/analyze/extract-command.ts
|
|
31339
31673
|
import { mkdir as mkdir6, readdir as readdir3, readFile as readFile18, stat as stat6 } from "node:fs/promises";
|
|
31340
|
-
import { isAbsolute as isAbsolute2, join as
|
|
31674
|
+
import { isAbsolute as isAbsolute2, join as join26, relative as relative2, resolve as resolve19 } from "node:path";
|
|
31341
31675
|
function resolveExtractNoCache(opts) {
|
|
31342
31676
|
return opts.noCache === true || opts.cache === false;
|
|
31343
31677
|
}
|
|
@@ -31375,7 +31709,7 @@ async function collectSourceFiles(directory, onProgress) {
|
|
|
31375
31709
|
const entries = await readdir3(currentDirectory, { withFileTypes: true });
|
|
31376
31710
|
const subdirs = [];
|
|
31377
31711
|
for (const entry of entries) {
|
|
31378
|
-
const fullPath =
|
|
31712
|
+
const fullPath = join26(currentDirectory, entry.name);
|
|
31379
31713
|
if (entry.isDirectory()) {
|
|
31380
31714
|
if (!IGNORED_DIRECTORY_NAMES.has(entry.name)) {
|
|
31381
31715
|
subdirs.push(fullPath);
|
|
@@ -31459,7 +31793,7 @@ function registerInternalExtractCommand(program) {
|
|
|
31459
31793
|
}
|
|
31460
31794
|
}
|
|
31461
31795
|
const projectRoot = resolve19(opts.project);
|
|
31462
|
-
const outDir =
|
|
31796
|
+
const outDir = join26(projectRoot, ".contentful");
|
|
31463
31797
|
let sourceDirectory;
|
|
31464
31798
|
if (opts.dir !== void 0) {
|
|
31465
31799
|
sourceDirectory = resolveFromProjectRoot(projectRoot, opts.dir);
|
|
@@ -31864,7 +32198,7 @@ __export(program_exports, {
|
|
|
31864
32198
|
});
|
|
31865
32199
|
import { spawn as spawn5 } from "node:child_process";
|
|
31866
32200
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
31867
|
-
import { dirname as dirname13, join as
|
|
32201
|
+
import { dirname as dirname13, join as join27, resolve as resolve20 } from "node:path";
|
|
31868
32202
|
import { readFileSync as readFileSync10 } from "node:fs";
|
|
31869
32203
|
import { Command } from "commander";
|
|
31870
32204
|
async function runBuild(opts) {
|
|
@@ -31964,7 +32298,7 @@ var init_program = __esm({
|
|
|
31964
32298
|
init_analytics();
|
|
31965
32299
|
init_credentials_store();
|
|
31966
32300
|
init_cli_path();
|
|
31967
|
-
pkg3 = JSON.parse(readFileSync10(
|
|
32301
|
+
pkg3 = JSON.parse(readFileSync10(join27(findPkgRoot(), "package.json"), "utf8"));
|
|
31968
32302
|
}
|
|
31969
32303
|
});
|
|
31970
32304
|
|