@contentful/experience-design-system-extraction 2.35.1-dev-build-4f1ad8cb.0 → 2.35.1-dev-build-98f1ba74.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-extraction",
3
- "version": "2.35.1-dev-build-4f1ad8cb.0",
3
+ "version": "2.35.1-dev-build-98f1ba74.0",
4
4
  "description": "Component extraction engine for the Contentful Experience Design System SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,3 +13,13 @@ export declare function preClassifyProp(prop: RawPropDefinition): PreClassificat
13
13
  * - Removes props that match an exclusion rule so they cannot reach agent classification
14
14
  */
15
15
  export declare function preClassifyComponent(component: RawComponentDefinition): RawComponentDefinition;
16
+ export type PropBucket = 'custom' | 'dom-passthrough' | 'other';
17
+ export interface PropBucketAssignment {
18
+ component: string;
19
+ source: string;
20
+ customPropNames: string[];
21
+ domPassthroughPropNames: string[];
22
+ otherPropNames: string[];
23
+ }
24
+ export declare function bucketComponentProps(component: RawComponentDefinition): PropBucketAssignment;
25
+ export declare function bucketComponentsProps(components: readonly RawComponentDefinition[]): PropBucketAssignment[];
@@ -112,3 +112,32 @@ export function preClassifyComponent(component) {
112
112
  });
113
113
  return { ...component, props };
114
114
  }
115
+ export function bucketComponentProps(component) {
116
+ const customPropNames = [];
117
+ const domPassthroughPropNames = [];
118
+ const otherPropNames = [];
119
+ for (const prop of component.props) {
120
+ if (!prop.type.trim()) {
121
+ otherPropNames.push(prop.name);
122
+ }
123
+ else if (prop.domAttribute === true) {
124
+ domPassthroughPropNames.push(prop.name);
125
+ }
126
+ else {
127
+ customPropNames.push(prop.name);
128
+ }
129
+ }
130
+ const sortNames = (names) => names.toSorted((left, right) => left.localeCompare(right));
131
+ return {
132
+ component: component.name,
133
+ source: component.source,
134
+ customPropNames: sortNames(customPropNames),
135
+ domPassthroughPropNames: sortNames(domPassthroughPropNames),
136
+ otherPropNames: sortNames(otherPropNames),
137
+ };
138
+ }
139
+ export function bucketComponentsProps(components) {
140
+ return components
141
+ .map(bucketComponentProps)
142
+ .toSorted((left, right) => `${left.component}\u0000${left.source}`.localeCompare(`${right.component}\u0000${right.source}`));
143
+ }
@@ -13,8 +13,6 @@ export { extractAstroComponents } from './extract/framework-adapters/astro/extra
13
13
  export { extractWebComponentDefinitions } from './extract/framework-adapters/web-components/extractor.js';
14
14
  export { extractSvelteComponents } from './extract/framework-adapters/svelte/extractor.js';
15
15
  export { extractAllowedComponentsFromTypeText, extractAllowedComponentsFromJsdoc, } from './extract/helpers/evidence/collect-allowed-component-names.js';
16
- export type { PropBucket, PropBucketAssignment } from './extract/services/classification/bucket-component-props.js';
17
- export { bucketComponentProps, bucketComponentsProps, } from './extract/services/classification/bucket-component-props.js';
18
16
  export { evaluateExtractionQuality } from './extract/services/quality/evaluate-extraction-quality.js';
19
17
  export { hasNoAuthoringSurface } from './extract/services/quality/helpers/authorability/evaluate-authorability.js';
20
18
  export { hasNoAuthoringSurface as isNonAuthorableComponent } from './extract/services/quality/helpers/authorability/evaluate-authorability.js';
@@ -25,5 +23,6 @@ export type { ComponentSourceInspection } from './extract/types/source-inspectio
25
23
  export { validateExtractedComponents, shouldExcludeDueToValidation, formatExclusionWarning, formatExcludedComponentLines, } from './extract/services/quality/helpers/inspection/validate-extracted-components.js';
26
24
  export { parseImportedNames } from './extract/helpers/evidence/parse-source-imports.js';
27
25
  export { CONTENT_NAME_EXCEPTIONS, isReactNodeType, isArrayReactNodeType, shouldBeSlot, } from './extract/helpers/evidence/detect-slot-from-prop.js';
28
- export { preClassifyProp, preClassifyComponent } from './extract/services/classification/classify-component-props.js';
26
+ export { preClassifyProp, preClassifyComponent, bucketComponentProps, bucketComponentsProps, } from './extract/services/classification/classify-component-props.js';
27
+ export type { PropBucket, PropBucketAssignment } from './extract/services/classification/classify-component-props.js';
29
28
  export type { PreClassification } from './extract/types/classification.js';
package/dist/src/index.js CHANGED
@@ -11,7 +11,6 @@ export { extractAstroComponents } from './extract/framework-adapters/astro/extra
11
11
  export { extractWebComponentDefinitions } from './extract/framework-adapters/web-components/extractor.js';
12
12
  export { extractSvelteComponents } from './extract/framework-adapters/svelte/extractor.js';
13
13
  export { extractAllowedComponentsFromTypeText, extractAllowedComponentsFromJsdoc, } from './extract/helpers/evidence/collect-allowed-component-names.js';
14
- export { bucketComponentProps, bucketComponentsProps, } from './extract/services/classification/bucket-component-props.js';
15
14
  // Post-extraction filtering and scoring
16
15
  export { evaluateExtractionQuality } from './extract/services/quality/evaluate-extraction-quality.js';
17
16
  export { hasNoAuthoringSurface } from './extract/services/quality/helpers/authorability/evaluate-authorability.js';
@@ -25,4 +24,4 @@ export { parseImportedNames } from './extract/helpers/evidence/parse-source-impo
25
24
  // Slot detection helpers
26
25
  export { CONTENT_NAME_EXCEPTIONS, isReactNodeType, isArrayReactNodeType, shouldBeSlot, } from './extract/helpers/evidence/detect-slot-from-prop.js';
27
26
  // Pre-classification
28
- export { preClassifyProp, preClassifyComponent } from './extract/services/classification/classify-component-props.js';
27
+ export { preClassifyProp, preClassifyComponent, bucketComponentProps, bucketComponentsProps, } from './extract/services/classification/classify-component-props.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-extraction",
3
- "version": "2.35.1-dev-build-4f1ad8cb.0",
3
+ "version": "2.35.1-dev-build-98f1ba74.0",
4
4
  "description": "Component extraction engine for the Contentful Experience Design System SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,11 +0,0 @@
1
- import type { RawComponentDefinition } from '../../types/component.js';
2
- export type PropBucket = 'custom' | 'dom-passthrough' | 'other';
3
- export interface PropBucketAssignment {
4
- component: string;
5
- source: string;
6
- customPropNames: string[];
7
- domPassthroughPropNames: string[];
8
- otherPropNames: string[];
9
- }
10
- export declare function bucketComponentProps(component: RawComponentDefinition): PropBucketAssignment;
11
- export declare function bucketComponentsProps(components: readonly RawComponentDefinition[]): PropBucketAssignment[];
@@ -1,29 +0,0 @@
1
- export function bucketComponentProps(component) {
2
- const customPropNames = [];
3
- const domPassthroughPropNames = [];
4
- const otherPropNames = [];
5
- for (const prop of component.props) {
6
- if (!prop.type.trim()) {
7
- otherPropNames.push(prop.name);
8
- }
9
- else if (prop.domAttribute === true) {
10
- domPassthroughPropNames.push(prop.name);
11
- }
12
- else {
13
- customPropNames.push(prop.name);
14
- }
15
- }
16
- const sortNames = (names) => names.toSorted((left, right) => left.localeCompare(right));
17
- return {
18
- component: component.name,
19
- source: component.source,
20
- customPropNames: sortNames(customPropNames),
21
- domPassthroughPropNames: sortNames(domPassthroughPropNames),
22
- otherPropNames: sortNames(otherPropNames),
23
- };
24
- }
25
- export function bucketComponentsProps(components) {
26
- return components
27
- .map(bucketComponentProps)
28
- .toSorted((left, right) => `${left.component}\u0000${left.source}`.localeCompare(`${right.component}\u0000${right.source}`));
29
- }