@contentful/experience-design-system-cli 2.11.4-dev-build-7e11bc8.0 → 2.12.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.11.4-dev-build-7e11bc8.0",
3
+ "version": "2.12.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,26 @@
1
1
  import type { RawComponentDefinition } from '../types.js';
2
2
  import type { AnalyzeViewResult } from './tui/AnalyzeView.js';
3
3
  type AnalyzeViewRow = AnalyzeViewResult['components'][number];
4
+ /**
5
+ * Convention used by both halves of the warnings split:
6
+ * per-component warnings start with `<ComponentName>:` and are attached to
7
+ * the matching row by `buildAnalyzeViewRows` below; everything else falls
8
+ * through to `partitionGlobalWarnings` and renders at the top of the panel.
9
+ *
10
+ * Centralized so the two halves can't drift. If the prefix shape ever changes
11
+ * (e.g. requiring a space after the colon), update `WARNING_PREFIX_SUFFIX`
12
+ * and both call sites pick it up.
13
+ */
14
+ export declare const WARNING_PREFIX_SUFFIX = ":";
15
+ export declare function isWarningForComponent(warning: string, componentName: string): boolean;
16
+ /**
17
+ * Split warnings into "global" (none of the surviving component-name prefixes
18
+ * match) and per-component (everything else, attached to rows by
19
+ * `buildAnalyzeViewRows`). The two halves MUST stay symmetric: every warning
20
+ * attached to a row must be excluded from globals (no double-render); every
21
+ * warning not attached to any row must fall through to globals (no silent drop).
22
+ */
23
+ export declare function partitionGlobalWarnings(allWarnings: string[], componentNames: readonly string[]): string[];
4
24
  /**
5
25
  * Build the per-component rows shown in the analyze TUI / non-TTY summary,
6
26
  * pairing each filtered component with its corresponding validation result.
@@ -1,3 +1,27 @@
1
+ /**
2
+ * Convention used by both halves of the warnings split:
3
+ * per-component warnings start with `<ComponentName>:` and are attached to
4
+ * the matching row by `buildAnalyzeViewRows` below; everything else falls
5
+ * through to `partitionGlobalWarnings` and renders at the top of the panel.
6
+ *
7
+ * Centralized so the two halves can't drift. If the prefix shape ever changes
8
+ * (e.g. requiring a space after the colon), update `WARNING_PREFIX_SUFFIX`
9
+ * and both call sites pick it up.
10
+ */
11
+ export const WARNING_PREFIX_SUFFIX = ':';
12
+ export function isWarningForComponent(warning, componentName) {
13
+ return warning.startsWith(componentName + WARNING_PREFIX_SUFFIX);
14
+ }
15
+ /**
16
+ * Split warnings into "global" (none of the surviving component-name prefixes
17
+ * match) and per-component (everything else, attached to rows by
18
+ * `buildAnalyzeViewRows`). The two halves MUST stay symmetric: every warning
19
+ * attached to a row must be excluded from globals (no double-render); every
20
+ * warning not attached to any row must fall through to globals (no silent drop).
21
+ */
22
+ export function partitionGlobalWarnings(allWarnings, componentNames) {
23
+ return allWarnings.filter((w) => !componentNames.some((name) => isWarningForComponent(w, name)));
24
+ }
1
25
  /**
2
26
  * Build the per-component rows shown in the analyze TUI / non-TTY summary,
3
27
  * pairing each filtered component with its corresponding validation result.
@@ -29,7 +53,7 @@ export function buildAnalyzeViewRows(filteredComponents, validatedComponents, al
29
53
  framework: c.framework,
30
54
  propCount: c.props.length,
31
55
  slotCount: c.slots.length,
32
- warnings: allWarnings.filter((w) => w.startsWith(c.name + ':')),
56
+ warnings: allWarnings.filter((w) => isWarningForComponent(w, c.name)),
33
57
  errors: errorIssues.map((issue) => issue.message),
34
58
  extractionConfidence: c.extractionConfidence ?? null,
35
59
  needsReview: c.needsReview ?? false,
@@ -12,7 +12,7 @@ import { isNonAuthorableComponent } from './extract/non-authorable-filter.js';
12
12
  import { computeExtractionScore, deriveNeedsReview } from './extract/scoring.js';
13
13
  import { describeReviewReasons, inspectComponentSource } from './extract/source-inspection.js';
14
14
  import { validateExtractedComponents } from './extract/validate.js';
15
- import { buildAnalyzeViewRows } from './build-analyze-view-rows.js';
15
+ import { buildAnalyzeViewRows, partitionGlobalWarnings } from './build-analyze-view-rows.js';
16
16
  const SCANNED_FILE_EXTENSIONS = new Set(['.astro', '.js', '.jsx', '.svelte', '.ts', '.tsx', '.vue']);
17
17
  const IGNORED_DIRECTORY_NAMES = new Set([
18
18
  '.git',
@@ -199,16 +199,9 @@ export function registerAnalyzeCommand(program) {
199
199
  // Split warnings: per-component (those whose prefix matches a surviving component name)
200
200
  // are rendered under that component in the TUI; global ones (retry summaries,
201
201
  // non-authorable skips, anything else) are rendered at the top of the warnings panel
202
- // so they don't disappear into the count.
203
- //
204
- // The matching rule MUST stay aligned with build-analyze-view-rows.ts which
205
- // attaches per-component warnings via `w.startsWith(c.name + ':')`. Using
206
- // the same `startsWith(name + ':')` here keeps the two halves symmetric —
207
- // any warning attached to a component's row is excluded from globals (no
208
- // double-render), and any warning not attached to any row falls through
209
- // to globals (no silent drop).
210
- const componentNames = componentRows.map((r) => r.name);
211
- const globalWarnings = allWarnings.filter((w) => !componentNames.some((name) => w.startsWith(name + ':')));
202
+ // so they don't disappear into the count. `partitionGlobalWarnings` shares its
203
+ // matching rule with `buildAnalyzeViewRows` to keep the two halves symmetric.
204
+ const globalWarnings = partitionGlobalWarnings(allWarnings, componentRows.map((r) => r.name));
212
205
  const analyzeResult = {
213
206
  sourceDirectory,
214
207
  sessionId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.11.4-dev-build-7e11bc8.0",
3
+ "version": "2.12.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -37,7 +37,7 @@
37
37
  "svelte": "^5.56.4",
38
38
  "ts-morph": "^27.0.2",
39
39
  "typescript": "^5.9.3",
40
- "@contentful/experience-design-system-types": "2.11.4-dev-build-7e11bc8.0"
40
+ "@contentful/experience-design-system-types": "2.12.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@tsconfig/node24": "^24.0.3",