@contentful/experience-design-system-cli 2.34.5-dev-build-ab8465d2.0 → 2.34.5-dev-build-ec126bf0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.34.5-dev-build-ab8465d2.0",
3
+ "version": "2.34.5-dev-build-ec126bf0.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,4 @@
1
- export declare function CompactControlBar({ hasGroupRoots, searchActive, showJson, tokenReviewAvailable, }: {
1
+ export declare function CompactControlBar({ hasGroupRoots, searchActive }: {
2
2
  hasGroupRoots: boolean;
3
3
  searchActive: boolean;
4
- showJson?: boolean;
5
- tokenReviewAvailable?: boolean;
6
4
  }): import("react/jsx-runtime").JSX.Element;
package/dist/src/index.js CHANGED
@@ -142,18 +142,13 @@ function GoodbyeBoundary({ children }) {
142
142
  return isExiting ? /* @__PURE__ */ jsx(Text, { children: "Goodbye!" }) : /* @__PURE__ */ jsx(Fragment, { children });
143
143
  }
144
144
  function renderWithGoodbye(element, options) {
145
- const instanceRef = {};
146
- const clearScreen = () => {
147
- instanceRef.current?.clear();
148
- };
149
145
  const instance = render(
150
- /* @__PURE__ */ jsx(ScreenTransitionClearContext.Provider, { value: clearScreen, children: /* @__PURE__ */ jsx(GoodbyeBoundary, { children: element }) }),
146
+ /* @__PURE__ */ jsx(ScreenTransitionClearContext.Provider, { value: () => instance.clear(), children: /* @__PURE__ */ jsx(GoodbyeBoundary, { children: element }) }),
151
147
  {
152
148
  ...options,
153
149
  exitOnCtrlC: false
154
150
  }
155
151
  );
156
- instanceRef.current = instance;
157
152
  return instance;
158
153
  }
159
154
  var GOODBYE_RENDER_DELAY_MS, ScreenTransitionClearContext;
@@ -1250,6 +1245,17 @@ function initDebugLogger(opts) {
1250
1245
  function getDebugLogger() {
1251
1246
  return singleton ?? new NoopDebugLogger();
1252
1247
  }
1248
+ function resolveDebugMode(opts, configDebug) {
1249
+ if (opts.debug !== void 0) return opts.debug;
1250
+ const env = process.env["EDSI_DEBUG"];
1251
+ if (env !== void 0 && env !== "") {
1252
+ const value = env.toLowerCase();
1253
+ if (value === "1" || value === "true" || value === "yes" || value === "on") return true;
1254
+ if (value === "0" || value === "false" || value === "no" || value === "off") return false;
1255
+ }
1256
+ if (configDebug !== void 0) return configDebug;
1257
+ return false;
1258
+ }
1253
1259
  function printDebugBanner(logger, phase) {
1254
1260
  if (!logger.enabled || !logger.path) return;
1255
1261
  const prefix = phase === "start" ? "\x1B[92m[debug]\x1B[0m " : "\x1B[92m[debug]\x1B[0m ";
@@ -4934,6 +4940,11 @@ function createCachedComponentResult(componentName, warnings = []) {
4934
4940
  renamedSlotsCount: 0
4935
4941
  };
4936
4942
  }
4943
+ function writeCachedComponentStatus(position, componentName, pinned) {
4944
+ const status = pinned ? c.cyan("pinned (human-edited)") : c.green("cached");
4945
+ process.stderr.write(` ${position} ${c.bold(componentName)} ${status}
4946
+ `);
4947
+ }
4937
4948
  async function showGenerateView(result) {
4938
4949
  if (process.stdout.isTTY) {
4939
4950
  const { waitUntilExit } = renderWithGoodbye(
@@ -4954,11 +4965,6 @@ session=${result.sessionId}
4954
4965
  );
4955
4966
  await exitWithAnalytics(0);
4956
4967
  }
4957
- function writeCachedComponentStatus(position, componentName, pinned) {
4958
- const status = pinned ? c.cyan("pinned (human-edited)") : c.green("cached");
4959
- process.stderr.write(` ${position} ${c.bold(componentName)} ${status}
4960
- `);
4961
- }
4962
4968
  function normalizeComponentForCache(component) {
4963
4969
  const slots = component.slots.map((slot, index, allSlots) => ({
4964
4970
  ...slot,
@@ -5051,7 +5057,7 @@ async function runOneComponent(options, component, index, total) {
5051
5057
  allowedComponentNames: allowedComponentNames2
5052
5058
  });
5053
5059
  writeCachedComponentStatus(pos, component.name, true);
5054
- return createCachedComponentResult(component.name, [
5060
+ return createCachedComponentResult(`${component.name}`, [
5055
5061
  `${component.name}: source changed but human edits preserved`
5056
5062
  ]);
5057
5063
  }
@@ -11334,30 +11340,26 @@ function getTsxExtractionContext(filePaths, componentFilePattern) {
11334
11340
  project: createTsxProject(getTsxProjectFiles(filePaths))
11335
11341
  };
11336
11342
  }
11337
- function extractTsxComponents(filePaths, componentFilePattern, extractSourceFile) {
11343
+ function extractTsxComponents(filePaths, componentFilePattern, extract) {
11338
11344
  const extractionContext = getTsxExtractionContext(filePaths, componentFilePattern);
11339
- if (!extractionContext)
11340
- return void 0;
11341
- const warnings = [];
11345
+ if (!extractionContext) {
11346
+ return { components: [], warnings: [], exclusions: [] };
11347
+ }
11348
+ const { componentFiles, project } = extractionContext;
11342
11349
  const components = [];
11343
- for (const filePath of extractionContext.componentFiles) {
11350
+ const warnings = [];
11351
+ const exclusions = [];
11352
+ for (const filePath of componentFiles) {
11344
11353
  try {
11345
- const sourceFile = extractionContext.project.getSourceFile(filePath);
11354
+ const sourceFile = project.getSourceFile(filePath);
11346
11355
  if (!sourceFile)
11347
11356
  continue;
11348
- components.push(...extractSourceFile(sourceFile));
11357
+ components.push(...extract(sourceFile, exclusions));
11349
11358
  } catch (e) {
11350
11359
  warnings.push(`Failed to extract from ${filePath}: ${e instanceof Error ? e.message : String(e)}`);
11351
11360
  }
11352
11361
  }
11353
- return { ...extractionContext, components, warnings };
11354
- }
11355
- function resolveComponentExportName(exportKey, declarations, exported, allowVariableDeclaration = false) {
11356
- const name = exportKey === "default" ? resolveDefaultExportName(declarations, exported, allowVariableDeclaration) : exportKey;
11357
- return name && /^[A-Z]/.test(name) ? name : void 0;
11358
- }
11359
- function isCompositionHookName(name) {
11360
- return name.startsWith("use");
11362
+ return { components, warnings, exclusions, project };
11361
11363
  }
11362
11364
  function resolveDefaultExportName(declarations, exported, allowVariableDeclaration = false) {
11363
11365
  const declaration = declarations[0];
@@ -11366,6 +11368,27 @@ function resolveDefaultExportName(declarations, exported, allowVariableDeclarati
11366
11368
  return void 0;
11367
11369
  return name;
11368
11370
  }
11371
+ function getRenderableExports(sourceFile, exclusions, options) {
11372
+ const renderable = [];
11373
+ const exported = sourceFile.getExportedDeclarations();
11374
+ for (const [exportKey, declarations] of exported) {
11375
+ const name = exportKey === "default" ? resolveDefaultExportName(declarations, exported, options.allowVariableDeclaration) : exportKey;
11376
+ if (!name || !/^[A-Z]/.test(name))
11377
+ continue;
11378
+ if (name.startsWith("use")) {
11379
+ exclusions.push({
11380
+ itemType: "component",
11381
+ name,
11382
+ source: sourceFile.getFilePath(),
11383
+ reason: options.hookReason,
11384
+ stage: "component-filter"
11385
+ });
11386
+ continue;
11387
+ }
11388
+ renderable.push({ name, declarations });
11389
+ }
11390
+ return renderable;
11391
+ }
11369
11392
  function kebabToPascal(input) {
11370
11393
  return input.split("-").filter(Boolean).map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("");
11371
11394
  }
@@ -13649,18 +13672,13 @@ function hasImplementationChildrenHint(funcNode, param) {
13649
13672
  return body.getDescendantsOfKind(SyntaxKind4.JsxSpreadAttribute).some((attr) => isComponentSpreadAttribute(attr, /* @__PURE__ */ new Set([paramName])));
13650
13673
  }
13651
13674
  async function extractReactComponents(filePaths) {
13652
- const exclusions = [];
13653
- const extractionContext = extractTsxComponents(filePaths, /\.[jt]sx$/, (sourceFile) => {
13675
+ const { components, warnings, exclusions, project } = extractTsxComponents(filePaths, /\.[jt]sx$/, (sourceFile, exclusions2) => {
13654
13676
  if (isStencilFile2(sourceFile))
13655
13677
  return [];
13656
13678
  const fileExports = [...sourceFile.getExportedDeclarations().keys()];
13657
13679
  const isNext = isNextJsComponent(sourceFile.getFilePath(), fileExports);
13658
- return extractFromSourceFile2(sourceFile, isNext, exclusions);
13680
+ return extractFromSourceFile2(sourceFile, isNext, exclusions2);
13659
13681
  });
13660
- if (!extractionContext) {
13661
- return { components: [], warnings: [] };
13662
- }
13663
- const { project, components, warnings } = extractionContext;
13664
13682
  const propsToComponent = /* @__PURE__ */ new Map();
13665
13683
  const componentNames = /* @__PURE__ */ new Set();
13666
13684
  for (const c2 of components) {
@@ -13696,7 +13714,7 @@ async function extractReactComponents(filePaths) {
13696
13714
  const cached = structuralByFile.get(filePath);
13697
13715
  if (cached)
13698
13716
  return cached;
13699
- const sourceFile = project.getSourceFile(filePath);
13717
+ const sourceFile = project?.getSourceFile(filePath);
13700
13718
  if (!sourceFile)
13701
13719
  return [];
13702
13720
  const ctx = { propsToComponent, componentNames };
@@ -13758,22 +13776,11 @@ async function extractReactComponents(filePaths) {
13758
13776
  }
13759
13777
  function extractFromSourceFile2(sourceFile, isNext, exclusions) {
13760
13778
  const components = [];
13761
- const exported = sourceFile.getExportedDeclarations();
13762
13779
  const usesCreateContext = sourceFileUsesCreateContext(sourceFile);
13763
- for (const [exportKey, declarations] of exported) {
13764
- const name = resolveComponentExportName(exportKey, declarations, exported, true);
13765
- if (!name)
13766
- continue;
13767
- if (isCompositionHookName(name)) {
13768
- exclusions.push({
13769
- itemType: "component",
13770
- name,
13771
- source: sourceFile.getFilePath(),
13772
- reason: "React hook names are not renderable components",
13773
- stage: "component-filter"
13774
- });
13775
- continue;
13776
- }
13780
+ for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
13781
+ allowVariableDeclaration: true,
13782
+ hookReason: "React hook names are not renderable components"
13783
+ })) {
13777
13784
  const funcNode = resolveBestFunctionNode(declarations);
13778
13785
  if (!funcNode)
13779
13786
  continue;
@@ -14251,12 +14258,7 @@ var init_react = __esm({
14251
14258
  // packages/experience-design-system-extraction/dist/src/extract/vue-tsx.js
14252
14259
  import { Node as Node5, SyntaxKind as SyntaxKind5 } from "ts-morph";
14253
14260
  async function extractVueTsxComponents(filePaths) {
14254
- const exclusions = [];
14255
- const extractionContext = extractTsxComponents(filePaths, /\.tsx$/, (sourceFile) => extractFromSourceFile3(sourceFile, exclusions));
14256
- if (!extractionContext) {
14257
- return { components: [], warnings: [] };
14258
- }
14259
- const { components, warnings } = extractionContext;
14261
+ const { components, warnings, exclusions } = extractTsxComponents(filePaths, /\.tsx$/, extractFromSourceFile3);
14260
14262
  return {
14261
14263
  components: components.sort((a, b) => a.name.localeCompare(b.name)),
14262
14264
  warnings,
@@ -14265,21 +14267,9 @@ async function extractVueTsxComponents(filePaths) {
14265
14267
  }
14266
14268
  function extractFromSourceFile3(sourceFile, exclusions) {
14267
14269
  const components = [];
14268
- const exported = sourceFile.getExportedDeclarations();
14269
- for (const [exportKey, declarations] of exported) {
14270
- const name = resolveComponentExportName(exportKey, declarations, exported);
14271
- if (!name)
14272
- continue;
14273
- if (isCompositionHookName(name)) {
14274
- exclusions.push({
14275
- itemType: "component",
14276
- name,
14277
- source: sourceFile.getFilePath(),
14278
- reason: "Vue composition hook names are not renderable components",
14279
- stage: "component-filter"
14280
- });
14281
- continue;
14282
- }
14270
+ for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
14271
+ hookReason: "Vue composition hook names are not renderable components"
14272
+ })) {
14283
14273
  const component = extractVueTsxComponent(declarations, name, sourceFile);
14284
14274
  if (component) {
14285
14275
  components.push(component);
@@ -19985,29 +19975,14 @@ var init_LegendEntry = __esm({
19985
19975
  // packages/experience-design-system-cli/src/import/tui/components/CompactControlBar.tsx
19986
19976
  import { Box as Box26 } from "ink";
19987
19977
  import { jsxs as jsxs27 } from "react/jsx-runtime";
19988
- function CompactControlBar({
19989
- hasGroupRoots,
19990
- searchActive,
19991
- showJson = false,
19992
- tokenReviewAvailable = false
19993
- }) {
19978
+ function CompactControlBar({ hasGroupRoots, searchActive }) {
19994
19979
  return /* @__PURE__ */ jsxs27(Box26, { borderStyle: "single", borderColor: PALETTE.border, paddingX: 1, marginTop: 1, flexWrap: "wrap", columnGap: 2, children: [
19995
19980
  legendEntry("[\u2191/\u2193]", "move"),
19996
19981
  legendEntry("[a/r]", "accept/reject"),
19997
- legendEntry("[A]", "accept all"),
19998
19982
  hasGroupRoots && legendEntry("[space/E/C]", "expand/collapse"),
19999
- legendEntry("[L]", "flat"),
20000
- legendEntry("[i]", "focus lineage"),
20001
- legendEntry("[w]", "only breaking"),
20002
- legendEntry("[o]", "only cycles"),
20003
- legendEntry("[c]", "cycle list"),
20004
- legendEntry("[b]", "breaking changes"),
20005
19983
  legendEntry("[/]", "search", searchActive),
20006
19984
  legendEntry("[f]", "continue/finalize"),
20007
19985
  legendEntry("[h]", "help"),
20008
- legendEntry("[J]", showJson ? "hide JSON" : "show JSON"),
20009
- tokenReviewAvailable && legendEntry("[t]", "token review"),
20010
- legendEntry("[Ctrl+Z/Y/R]", "undo/redo/reload"),
20011
19986
  legendEntry("[q]", "quit")
20012
19987
  ] });
20013
19988
  }
@@ -26689,15 +26664,7 @@ function GenerateReviewStepView({
26689
26664
  hidden: dialogOpen
26690
26665
  }
26691
26666
  ),
26692
- !dialogOpen && sidebarFocused && /* @__PURE__ */ jsx49(
26693
- CompactControlBar,
26694
- {
26695
- hasGroupRoots,
26696
- searchActive: searchOpen || searchQuery.length > 0,
26697
- showJson: reviewEditor.showJson,
26698
- tokenReviewAvailable: reviewEditor.currentTokenSuggestions().length > 0
26699
- }
26700
- )
26667
+ !dialogOpen && sidebarFocused && /* @__PURE__ */ jsx49(CompactControlBar, { hasGroupRoots, searchActive: searchOpen || searchQuery.length > 0 })
26701
26668
  ] });
26702
26669
  }
26703
26670
  var HELP_SECTIONS2;
@@ -31517,7 +31484,7 @@ function registerInternalExtractCommand(program) {
31517
31484
  if (allFilesCached) {
31518
31485
  const cachedComponents = sourceFiles.flatMap((filePath) => cachedByPath.get(filePath).components);
31519
31486
  extractionCacheHits = sourceFiles.length;
31520
- extraction = { components: cachedComponents, warnings: [] };
31487
+ extraction = { components: cachedComponents, warnings: [], exclusions: [] };
31521
31488
  if (!process.stdout.isTTY) {
31522
31489
  process.stderr.write(
31523
31490
  `progress=extract:${sourceFiles.length}/${sourceFiles.length}:${cachedComponents.length}
@@ -31737,7 +31704,7 @@ function registerInternalExtractCommand(program) {
31737
31704
  validatedComponents = result.components;
31738
31705
  }
31739
31706
  }
31740
- await retryDatabaseWrite(() => storeRawComponents(db, sessionId2, validatedComponents));
31707
+ await retryDatabaseWrite(() => storeRawComponents(db, sessionId2, validatedComponents, { preserveStatus: true }));
31741
31708
  const cycleInput = validatedComponents.map((c2) => ({
31742
31709
  name: c2.name,
31743
31710
  slots: c2.slots.map((s) => ({ name: s.name, allowedComponents: s.allowedComponents }))
@@ -31844,14 +31811,14 @@ var init_extract_command = __esm({
31844
31811
  });
31845
31812
 
31846
31813
  // packages/experience-design-system-cli/src/lib/debug-preamble.ts
31847
- async function beginCommand(command) {
31814
+ async function beginCommand(command, opts) {
31848
31815
  let configDebug;
31849
31816
  try {
31850
31817
  const creds = await readExperiencesCredentials();
31851
31818
  configDebug = creds.debug;
31852
31819
  } catch {
31853
31820
  }
31854
- const enabled = configDebug ?? false;
31821
+ const enabled = resolveDebugMode(opts, configDebug);
31855
31822
  const logger = initDebugLogger({ enabled, command });
31856
31823
  if (logger.enabled) {
31857
31824
  printDebugBanner(logger, "start");
@@ -31967,7 +31934,7 @@ function createProgram() {
31967
31934
  const { analyticsDisabled } = await readExperiencesCredentials();
31968
31935
  setPersistedAnalyticsDisabled(analyticsDisabled ?? false);
31969
31936
  noteCommandStart(commandChain);
31970
- await beginCommand(commandChain);
31937
+ await beginCommand(commandChain, {});
31971
31938
  });
31972
31939
  program.hook("postAction", async () => {
31973
31940
  await completeActiveCommand();
@@ -25,6 +25,10 @@ export declare function initDebugLogger(opts: InitDebugLoggerOptions): DebugLogg
25
25
  export declare function getDebugLogger(): DebugLogger;
26
26
  /** Test-only: reset the singleton. */
27
27
  export declare function __resetDebugLoggerForTest(): void;
28
+ /** Resolve debug mode from an explicit option, environment, or saved settings. */
29
+ export declare function resolveDebugMode(opts: {
30
+ debug?: boolean;
31
+ }, configDebug?: boolean): boolean;
28
32
  /**
29
33
  * Emit the bright-green "debug logs at <path>" banner to stderr.
30
34
  * No-op when debug is disabled or stderr is not a TTY-friendly stream.
@@ -1,6 +1,7 @@
1
1
  import { type DebugLogger } from './debug-logger.js';
2
2
  /**
3
- * Initialize the debug logger from persisted credentials.
4
- * Debug mode can only be configured via setup preferences;
3
+ * Resolve and initialize the debug logger before a top-level command runs.
5
4
  */
6
- export declare function beginCommand(command: string): Promise<DebugLogger>;
5
+ export declare function beginCommand(command: string, opts: {
6
+ debug?: boolean;
7
+ }): Promise<DebugLogger>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.34.5-dev-build-ab8465d2.0",
3
+ "version": "2.34.5-dev-build-ec126bf0.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,8 +41,8 @@
41
41
  "svelte": "^5.56.4",
42
42
  "ts-morph": "^27.0.2",
43
43
  "typescript": "^5.9.3",
44
- "@contentful/experience-design-system-types": "2.34.5-dev-build-ab8465d2.0",
45
- "@contentful/experience-design-system-cli-v2": "2.34.5-dev-build-ab8465d2.0"
44
+ "@contentful/experience-design-system-types": "2.34.5-dev-build-ec126bf0.0",
45
+ "@contentful/experience-design-system-cli-v2": "2.34.5-dev-build-ec126bf0.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@tsconfig/node24": "^24.0.4",
@@ -54,9 +54,9 @@
54
54
  "ink-testing-library": "^4.0.0",
55
55
  "typescript-eslint": "^8.67.0",
56
56
  "vitest": "^4.0.16",
57
- "@contentful/experience-design-system-client": "2.34.5-dev-build-ab8465d2.0",
58
- "@contentful/experience-design-system-extraction": "2.34.5-dev-build-ab8465d2.0",
59
- "@contentful/experience-design-system-generation": "2.34.5-dev-build-ab8465d2.0"
57
+ "@contentful/experience-design-system-extraction": "2.34.5-dev-build-ec126bf0.0",
58
+ "@contentful/experience-design-system-generation": "2.34.5-dev-build-ec126bf0.0",
59
+ "@contentful/experience-design-system-client": "2.34.5-dev-build-ec126bf0.0"
60
60
  },
61
61
  "repository": {
62
62
  "type": "git",