@contentful/experience-design-system-cli 2.43.0 → 2.43.1-dev-build-1c66450b.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 CHANGED
@@ -2847,6 +2847,7 @@ var LOCAL_HEADER = 67324752;
2847
2847
  var CENTRAL_HEADER = 33639248;
2848
2848
  var END_OF_ARCHIVE = 101010256;
2849
2849
  var VERSION2 = 20;
2850
+ var MAX_ENTRIES = 65535;
2850
2851
  var UTF8_NAMES = 2048;
2851
2852
  var DEFLATE = 8;
2852
2853
  function dosDateTime(date) {
@@ -2857,6 +2858,8 @@ function dosDateTime(date) {
2857
2858
  };
2858
2859
  }
2859
2860
  function createZip(entries) {
2861
+ if (entries.length > MAX_ENTRIES)
2862
+ throw new Error(`a zip made here holds at most ${MAX_ENTRIES} files, not ${entries.length}`);
2860
2863
  const body = [];
2861
2864
  const directory = [];
2862
2865
  let offset = 0;
@@ -3197,8 +3200,16 @@ function lineState(line) {
3197
3200
  function formatDuration(ms) {
3198
3201
  return ms < 1e3 ? "<1s" : formatElapsed(Math.round(ms / 1e3));
3199
3202
  }
3203
+ function isFinished(row) {
3204
+ return row.complete === true || row.state === "failed";
3205
+ }
3200
3206
  function trackFinished(previous, rows, elapsedMs) {
3201
- return rows.map((row, index) => previous[index] ?? (lineState(row) === "running" ? void 0 : elapsedMs));
3207
+ return rows.map((row, index) => previous[index] ?? (isFinished(row) ? elapsedMs : void 0));
3208
+ }
3209
+ function rowTimer() {
3210
+ const startedAt = Date.now();
3211
+ let rowMs = [];
3212
+ return (rows) => rowMs = trackFinished(rowMs, rows, Date.now() - startedAt);
3202
3213
  }
3203
3214
  function withTimes(rows, rowMs) {
3204
3215
  return rows.map((row, index) => rowMs[index] === void 0 ? row : { ...row, ms: rowMs[index] });
@@ -3653,14 +3664,16 @@ function describeFailure(failure, path5) {
3653
3664
  return { headline: `Cannot access: ${path5}`, hints: [] };
3654
3665
  }
3655
3666
  }
3667
+ function componentFileCount(counts) {
3668
+ return COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
3669
+ }
3656
3670
  function summarize(counts, { hasTokens = true } = {}) {
3657
3671
  const rows = ROW_ORDER.filter((category) => counts[category] > 0).map((category) => {
3658
3672
  if (category === "json" && !hasTokens) return { label: ".json files (ignored)", count: counts.json, tone: "muted" };
3659
3673
  const tone = category === "json" ? "accent" : category === "other" ? "muted" : "default";
3660
3674
  return { label: ROW_LABELS[category], count: counts[category], tone };
3661
3675
  });
3662
- const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
3663
- if (componentFiles > 0) return { total: counts.total, rows };
3676
+ if (componentFileCount(counts) > 0) return { total: counts.total, rows };
3664
3677
  if (hasTokens && counts.json > 0) {
3665
3678
  return { total: counts.total, rows, warning: "No component files found \u2014 only token files detected." };
3666
3679
  }
@@ -3684,8 +3697,7 @@ function scanReport(scan, path5, { hasTokens = true } = {}) {
3684
3697
  };
3685
3698
  }
3686
3699
  function hasImportableFiles(counts, { hasTokens = true } = {}) {
3687
- const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
3688
- return componentFiles > 0 || hasTokens && counts.json > 0;
3700
+ return componentFileCount(counts) > 0 || hasTokens && counts.json > 0;
3689
3701
  }
3690
3702
  function phaseOf(scan, { hasTokens = true } = {}) {
3691
3703
  if (scan === void 0) return "scanning";
@@ -19421,8 +19433,7 @@ function useExtraction(input) {
19421
19433
  rowMs: []
19422
19434
  });
19423
19435
  let lastProgress;
19424
- const startedAt = Date.now();
19425
- let rowMs = [];
19436
+ const timeRows = rowTimer();
19426
19437
  startDebugRun({
19427
19438
  flow: "import/extraction",
19428
19439
  step: "06-extraction",
@@ -19431,7 +19442,7 @@ function useExtraction(input) {
19431
19442
  });
19432
19443
  void runExtraction(input, (progress) => {
19433
19444
  lastProgress = progress;
19434
- rowMs = trackFinished(rowMs, progressRows(progress, input.agent), Date.now() - startedAt);
19445
+ const rowMs = timeRows(progressRows(progress, input.agent));
19435
19446
  if (current.current === input) setState({ status: "running", progress, rowMs });
19436
19447
  }).then((result) => {
19437
19448
  if (current.current !== input) return;
@@ -22588,8 +22599,7 @@ function useGeneration(input) {
22588
22599
  }
22589
22600
  setState({ status: "running", progress: initialProgress2(), rowMs: [] });
22590
22601
  let lastProgress;
22591
- const startedAt = Date.now();
22592
- let rowMs = [];
22602
+ const timeRows = rowTimer();
22593
22603
  startDebugRun({
22594
22604
  flow: "import/generation",
22595
22605
  step: "08-generation",
@@ -22598,7 +22608,7 @@ function useGeneration(input) {
22598
22608
  });
22599
22609
  void runGeneration(input, (progress) => {
22600
22610
  lastProgress = progress;
22601
- rowMs = trackFinished(rowMs, progressRows2(progress, input.agent), Date.now() - startedAt);
22611
+ const rowMs = timeRows(progressRows2(progress, input.agent));
22602
22612
  if (current.current === input) setState({ status: "running", progress, rowMs });
22603
22613
  }).then((result) => {
22604
22614
  if (current.current !== input) return;
package/dist/index.js CHANGED
@@ -19884,6 +19884,8 @@ function dosDateTime(date) {
19884
19884
  };
19885
19885
  }
19886
19886
  function createZip(entries) {
19887
+ if (entries.length > MAX_ENTRIES)
19888
+ throw new Error(`a zip made here holds at most ${MAX_ENTRIES} files, not ${entries.length}`);
19887
19889
  const body = [];
19888
19890
  const directory = [];
19889
19891
  let offset = 0;
@@ -19929,7 +19931,7 @@ function createZip(entries) {
19929
19931
  end.writeUInt32LE(offset, 16);
19930
19932
  return Buffer.concat([...body, directoryBytes, end]);
19931
19933
  }
19932
- var LOCAL_HEADER, CENTRAL_HEADER, END_OF_ARCHIVE, VERSION2, UTF8_NAMES, DEFLATE;
19934
+ var LOCAL_HEADER, CENTRAL_HEADER, END_OF_ARCHIVE, VERSION2, MAX_ENTRIES, UTF8_NAMES, DEFLATE;
19933
19935
  var init_zip = __esm({
19934
19936
  "packages/experience-design-system-cli/src/tui/zip.ts"() {
19935
19937
  "use strict";
@@ -19937,6 +19939,7 @@ var init_zip = __esm({
19937
19939
  CENTRAL_HEADER = 33639248;
19938
19940
  END_OF_ARCHIVE = 101010256;
19939
19941
  VERSION2 = 20;
19942
+ MAX_ENTRIES = 65535;
19940
19943
  UTF8_NAMES = 2048;
19941
19944
  DEFLATE = 8;
19942
19945
  }
@@ -20299,8 +20302,16 @@ function lineState(line) {
20299
20302
  function formatDuration(ms) {
20300
20303
  return ms < 1e3 ? "<1s" : formatElapsed(Math.round(ms / 1e3));
20301
20304
  }
20305
+ function isFinished(row) {
20306
+ return row.complete === true || row.state === "failed";
20307
+ }
20302
20308
  function trackFinished(previous, rows, elapsedMs) {
20303
- return rows.map((row, index) => previous[index] ?? (lineState(row) === "running" ? void 0 : elapsedMs));
20309
+ return rows.map((row, index) => previous[index] ?? (isFinished(row) ? elapsedMs : void 0));
20310
+ }
20311
+ function rowTimer() {
20312
+ const startedAt = Date.now();
20313
+ let rowMs = [];
20314
+ return (rows) => rowMs = trackFinished(rowMs, rows, Date.now() - startedAt);
20304
20315
  }
20305
20316
  function withTimes(rows, rowMs) {
20306
20317
  return rows.map((row, index) => rowMs[index] === void 0 ? row : { ...row, ms: rowMs[index] });
@@ -20846,14 +20857,16 @@ function describeFailure(failure, path5) {
20846
20857
  return { headline: `Cannot access: ${path5}`, hints: [] };
20847
20858
  }
20848
20859
  }
20860
+ function componentFileCount(counts) {
20861
+ return COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
20862
+ }
20849
20863
  function summarize(counts, { hasTokens = true } = {}) {
20850
20864
  const rows = ROW_ORDER.filter((category) => counts[category] > 0).map((category) => {
20851
20865
  if (category === "json" && !hasTokens) return { label: ".json files (ignored)", count: counts.json, tone: "muted" };
20852
20866
  const tone = category === "json" ? "accent" : category === "other" ? "muted" : "default";
20853
20867
  return { label: ROW_LABELS[category], count: counts[category], tone };
20854
20868
  });
20855
- const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
20856
- if (componentFiles > 0) return { total: counts.total, rows };
20869
+ if (componentFileCount(counts) > 0) return { total: counts.total, rows };
20857
20870
  if (hasTokens && counts.json > 0) {
20858
20871
  return { total: counts.total, rows, warning: "No component files found \u2014 only token files detected." };
20859
20872
  }
@@ -20877,8 +20890,7 @@ function scanReport(scan, path5, { hasTokens = true } = {}) {
20877
20890
  };
20878
20891
  }
20879
20892
  function hasImportableFiles(counts, { hasTokens = true } = {}) {
20880
- const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
20881
- return componentFiles > 0 || hasTokens && counts.json > 0;
20893
+ return componentFileCount(counts) > 0 || hasTokens && counts.json > 0;
20882
20894
  }
20883
20895
  function phaseOf(scan, { hasTokens = true } = {}) {
20884
20896
  if (scan === void 0) return "scanning";
@@ -22288,8 +22300,7 @@ function useExtraction(input) {
22288
22300
  rowMs: []
22289
22301
  });
22290
22302
  let lastProgress;
22291
- const startedAt = Date.now();
22292
- let rowMs = [];
22303
+ const timeRows = rowTimer();
22293
22304
  startDebugRun({
22294
22305
  flow: "import/extraction",
22295
22306
  step: "06-extraction",
@@ -22298,7 +22309,7 @@ function useExtraction(input) {
22298
22309
  });
22299
22310
  void runExtraction(input, (progress) => {
22300
22311
  lastProgress = progress;
22301
- rowMs = trackFinished(rowMs, progressRows(progress, input.agent), Date.now() - startedAt);
22312
+ const rowMs = timeRows(progressRows(progress, input.agent));
22302
22313
  if (current.current === input) setState({ status: "running", progress, rowMs });
22303
22314
  }).then((result) => {
22304
22315
  if (current.current !== input) return;
@@ -25777,8 +25788,7 @@ function useGeneration(input) {
25777
25788
  }
25778
25789
  setState({ status: "running", progress: initialProgress2(), rowMs: [] });
25779
25790
  let lastProgress;
25780
- const startedAt = Date.now();
25781
- let rowMs = [];
25791
+ const timeRows = rowTimer();
25782
25792
  startDebugRun({
25783
25793
  flow: "import/generation",
25784
25794
  step: "08-generation",
@@ -25787,7 +25797,7 @@ function useGeneration(input) {
25787
25797
  });
25788
25798
  void runGeneration(input, (progress) => {
25789
25799
  lastProgress = progress;
25790
- rowMs = trackFinished(rowMs, progressRows2(progress, input.agent), Date.now() - startedAt);
25800
+ const rowMs = timeRows(progressRows2(progress, input.agent));
25791
25801
  if (current.current === input) setState({ status: "running", progress, rowMs });
25792
25802
  }).then((result) => {
25793
25803
  if (current.current !== input) return;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.43.0",
3
+ "version": "2.43.1-dev-build-1c66450b.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,6 +21,11 @@ export declare function formatDuration(ms: number): string;
21
21
  * that appears later is added at the end.
22
22
  */
23
23
  export declare function trackFinished(previous: ReadonlyArray<number | undefined>, rows: readonly RunningLine[], elapsedMs: number): Array<number | undefined>;
24
+ /**
25
+ * Starts the clock and returns what to call with the rows after every progress event: the time each finished row took,
26
+ * by position (see `trackFinished`).
27
+ */
28
+ export declare function rowTimer(): (rows: readonly RunningLine[]) => Array<number | undefined>;
24
29
  /** The rows with the time each finished row took, by position. */
25
30
  export declare function withTimes(rows: RunningLine[], rowMs: ReadonlyArray<number | undefined>): RunningLine[];
26
31
  export declare function progressPercent(progress: Progress): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.43.0",
3
+ "version": "2.43.1-dev-build-1c66450b.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,7 +45,7 @@
45
45
  "ts-morph": "^27.0.2",
46
46
  "typescript": "^5.9.3",
47
47
  "zod": "^4.6.5",
48
- "@contentful/experience-design-system-types": "2.43.0"
48
+ "@contentful/experience-design-system-types": "2.43.1-dev-build-1c66450b.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@tsconfig/node24": "^24.0.4",
@@ -59,7 +59,7 @@
59
59
  "ink-testing-library": "^4.0.0",
60
60
  "typescript-eslint": "^8.67.0",
61
61
  "vitest": "^4.0.16",
62
- "@contentful/experience-design-system-backend-pipeline": "2.43.0"
62
+ "@contentful/experience-design-system-backend-pipeline": "2.43.1-dev-build-1c66450b.0"
63
63
  },
64
64
  "repository": {
65
65
  "type": "git",