@contentful/experience-design-system-cli 2.33.1-dev-build-3cccae4.0 → 2.33.1-dev-build-91bf692.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 +1 -1
- package/dist/src/index.js +86 -49
- package/dist/src/session/core/components/mappers/map-raw-component-to-with-id.d.ts +6 -0
- package/dist/src/session/core/components/mappers/map-raw-prop-to-definition.d.ts +4 -0
- package/dist/src/session/core/components/mappers/map-raw-slot-to-definition.d.ts +4 -0
- package/dist/src/session/repositories/components/raw/read.d.ts +2 -4
- package/package.json +6 -6
package/dist/package.json
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -9279,6 +9279,70 @@ var init_row_mappers = __esm({
|
|
|
9279
9279
|
}
|
|
9280
9280
|
});
|
|
9281
9281
|
|
|
9282
|
+
// packages/experience-design-system-cli/src/session/core/components/mappers/map-raw-component-to-with-id.ts
|
|
9283
|
+
function mapRawComponentToWithId(row, props, slots) {
|
|
9284
|
+
return {
|
|
9285
|
+
component_id: row.component_id,
|
|
9286
|
+
name: row.name,
|
|
9287
|
+
source: row.source,
|
|
9288
|
+
framework: row.framework,
|
|
9289
|
+
extractionConfidence: row.extraction_confidence ?? null,
|
|
9290
|
+
reviewReasons: parseReviewReasons(row.review_reasons),
|
|
9291
|
+
needsReview: Boolean(row.needs_review),
|
|
9292
|
+
sourcePath: row.source_path ?? void 0,
|
|
9293
|
+
props,
|
|
9294
|
+
slots
|
|
9295
|
+
};
|
|
9296
|
+
}
|
|
9297
|
+
var init_map_raw_component_to_with_id = __esm({
|
|
9298
|
+
"packages/experience-design-system-cli/src/session/core/components/mappers/map-raw-component-to-with-id.ts"() {
|
|
9299
|
+
"use strict";
|
|
9300
|
+
init_row_mappers();
|
|
9301
|
+
}
|
|
9302
|
+
});
|
|
9303
|
+
|
|
9304
|
+
// packages/experience-design-system-cli/src/session/core/components/mappers/map-raw-prop-to-definition.ts
|
|
9305
|
+
function mapRawPropToDefinition(row, allowedValueRows) {
|
|
9306
|
+
const prop = {
|
|
9307
|
+
name: row.name,
|
|
9308
|
+
type: row.type,
|
|
9309
|
+
required: Boolean(row.required)
|
|
9310
|
+
};
|
|
9311
|
+
if (row.category !== null) prop.category = row.category;
|
|
9312
|
+
if (row.default_value !== null) prop.defaultValue = row.default_value;
|
|
9313
|
+
if (row.description !== null) prop.description = row.description;
|
|
9314
|
+
if (row.token_reference !== null) prop.tokenReference = row.token_reference;
|
|
9315
|
+
if (allowedValueRows && allowedValueRows.length > 0) {
|
|
9316
|
+
prop.allowedValues = allowedValueRows.map((v) => v.value);
|
|
9317
|
+
}
|
|
9318
|
+
if (row.source_start_line !== null) prop.sourceStartLine = row.source_start_line;
|
|
9319
|
+
if (row.source_end_line !== null) prop.sourceEndLine = row.source_end_line;
|
|
9320
|
+
return prop;
|
|
9321
|
+
}
|
|
9322
|
+
var init_map_raw_prop_to_definition = __esm({
|
|
9323
|
+
"packages/experience-design-system-cli/src/session/core/components/mappers/map-raw-prop-to-definition.ts"() {
|
|
9324
|
+
"use strict";
|
|
9325
|
+
}
|
|
9326
|
+
});
|
|
9327
|
+
|
|
9328
|
+
// packages/experience-design-system-cli/src/session/core/components/mappers/map-raw-slot-to-definition.ts
|
|
9329
|
+
function mapRawSlotToDefinition(row, allowedComponentRows) {
|
|
9330
|
+
const slot = {
|
|
9331
|
+
name: row.name,
|
|
9332
|
+
isDefault: Boolean(row.is_default)
|
|
9333
|
+
};
|
|
9334
|
+
if (row.description !== null) slot.description = row.description;
|
|
9335
|
+
if (allowedComponentRows && allowedComponentRows.length > 0) {
|
|
9336
|
+
slot.allowedComponents = allowedComponentRows.map((v) => v.allowed_component);
|
|
9337
|
+
}
|
|
9338
|
+
return slot;
|
|
9339
|
+
}
|
|
9340
|
+
var init_map_raw_slot_to_definition = __esm({
|
|
9341
|
+
"packages/experience-design-system-cli/src/session/core/components/mappers/map-raw-slot-to-definition.ts"() {
|
|
9342
|
+
"use strict";
|
|
9343
|
+
}
|
|
9344
|
+
});
|
|
9345
|
+
|
|
9282
9346
|
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-component-rows.ts
|
|
9283
9347
|
function getRawComponentRows(db, sessionId2) {
|
|
9284
9348
|
return db.prepare(
|
|
@@ -9420,61 +9484,34 @@ var init_has_raw_prop_named = __esm({
|
|
|
9420
9484
|
|
|
9421
9485
|
// packages/experience-design-system-cli/src/session/repositories/components/raw/read.ts
|
|
9422
9486
|
function getRawComponents(db, sessionId2, allowedNames) {
|
|
9423
|
-
const
|
|
9424
|
-
const components = allowedNames ?
|
|
9487
|
+
const componentRows = getRawComponentRows(db, sessionId2);
|
|
9488
|
+
const components = allowedNames ? componentRows.filter((c2) => allowedNames.has(c2.name)) : componentRows;
|
|
9425
9489
|
if (components.length === 0) return [];
|
|
9426
|
-
const
|
|
9427
|
-
const
|
|
9428
|
-
const
|
|
9429
|
-
const
|
|
9430
|
-
const propsByComponent = indexRowsByKey(
|
|
9431
|
-
const allowedValuesByProp = indexRowsByKey(
|
|
9432
|
-
const slotsByComponent = indexRowsByKey(
|
|
9433
|
-
const allowedComponentsBySlot = indexRowsByKey(
|
|
9434
|
-
return components.map(
|
|
9435
|
-
(c2)
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
sourcePath: c2.source_path ?? void 0,
|
|
9444
|
-
props: (propsByComponent.get(c2.component_id) ?? []).map((p) => {
|
|
9445
|
-
const av = allowedValuesByProp.get(`${c2.component_id}::${p.name}`);
|
|
9446
|
-
const prop = {
|
|
9447
|
-
name: p.name,
|
|
9448
|
-
type: p.type,
|
|
9449
|
-
required: Boolean(p.required)
|
|
9450
|
-
};
|
|
9451
|
-
if (p.category !== null) prop.category = p.category;
|
|
9452
|
-
if (p.default_value !== null) prop.defaultValue = p.default_value;
|
|
9453
|
-
if (p.description !== null) prop.description = p.description;
|
|
9454
|
-
if (p.token_reference !== null) prop.tokenReference = p.token_reference;
|
|
9455
|
-
if (av && av.length > 0) prop.allowedValues = av.map((v) => v.value);
|
|
9456
|
-
if (p.source_start_line !== null) prop.sourceStartLine = p.source_start_line;
|
|
9457
|
-
if (p.source_end_line !== null) prop.sourceEndLine = p.source_end_line;
|
|
9458
|
-
return prop;
|
|
9459
|
-
}),
|
|
9460
|
-
slots: (slotsByComponent.get(c2.component_id) ?? []).map((s) => {
|
|
9461
|
-
const ac = allowedComponentsBySlot.get(`${c2.component_id}::${s.name}`);
|
|
9462
|
-
const slot = {
|
|
9463
|
-
name: s.name,
|
|
9464
|
-
isDefault: Boolean(s.is_default)
|
|
9465
|
-
};
|
|
9466
|
-
if (s.description !== null) slot.description = s.description;
|
|
9467
|
-
if (ac && ac.length > 0) slot.allowedComponents = ac.map((v) => v.allowed_component);
|
|
9468
|
-
return slot;
|
|
9469
|
-
})
|
|
9470
|
-
})
|
|
9471
|
-
);
|
|
9490
|
+
const propRows = getRawPropRows(db, sessionId2);
|
|
9491
|
+
const allowedValueRows = getRawPropAllowedValueRows(db, sessionId2);
|
|
9492
|
+
const slotRows = getRawSlotRows(db, sessionId2);
|
|
9493
|
+
const allowedComponentRows = getRawSlotAllowedComponentRows(db, sessionId2);
|
|
9494
|
+
const propsByComponent = indexRowsByKey(propRows, (p) => p.component_id);
|
|
9495
|
+
const allowedValuesByProp = indexRowsByKey(allowedValueRows, (av) => `${av.component_id}::${av.prop_name}`);
|
|
9496
|
+
const slotsByComponent = indexRowsByKey(slotRows, (s) => s.component_id);
|
|
9497
|
+
const allowedComponentsBySlot = indexRowsByKey(allowedComponentRows, (ac) => `${ac.component_id}::${ac.slot_name}`);
|
|
9498
|
+
return components.map((c2) => {
|
|
9499
|
+
const props = (propsByComponent.get(c2.component_id) ?? []).map(
|
|
9500
|
+
(p) => mapRawPropToDefinition(p, allowedValuesByProp.get(`${c2.component_id}::${p.name}`))
|
|
9501
|
+
);
|
|
9502
|
+
const slots = (slotsByComponent.get(c2.component_id) ?? []).map(
|
|
9503
|
+
(s) => mapRawSlotToDefinition(s, allowedComponentsBySlot.get(`${c2.component_id}::${s.name}`))
|
|
9504
|
+
);
|
|
9505
|
+
return mapRawComponentToWithId(c2, props, slots);
|
|
9506
|
+
});
|
|
9472
9507
|
}
|
|
9473
9508
|
var init_read4 = __esm({
|
|
9474
9509
|
"packages/experience-design-system-cli/src/session/repositories/components/raw/read.ts"() {
|
|
9475
9510
|
"use strict";
|
|
9476
9511
|
init_index_rows_by_key();
|
|
9477
|
-
|
|
9512
|
+
init_map_raw_component_to_with_id();
|
|
9513
|
+
init_map_raw_prop_to_definition();
|
|
9514
|
+
init_map_raw_slot_to_definition();
|
|
9478
9515
|
init_get_raw_component_rows();
|
|
9479
9516
|
init_get_raw_prop_rows();
|
|
9480
9517
|
init_get_raw_prop_allowed_value_rows();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RawComponentDefinition, RawPropDefinition, RawSlotDefinition } from '../../../../types.js';
|
|
2
|
+
import type { RawComponentRow } from '../../../repositories/components/raw/interfaces/raw-component-row.js';
|
|
3
|
+
export type RawComponentWithId = RawComponentDefinition & {
|
|
4
|
+
component_id: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function mapRawComponentToWithId(row: RawComponentRow, props: RawPropDefinition[], slots: RawSlotDefinition[]): RawComponentWithId;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RawPropDefinition } from '../../../../types.js';
|
|
2
|
+
import type { RawPropRow } from '../../../repositories/components/raw/interfaces/raw-prop-row.js';
|
|
3
|
+
import type { AllowedValueSnapshotEntry } from '../snapshot-types.js';
|
|
4
|
+
export declare function mapRawPropToDefinition(row: RawPropRow, allowedValueRows: AllowedValueSnapshotEntry[] | undefined): RawPropDefinition;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RawSlotDefinition } from '../../../../types.js';
|
|
2
|
+
import type { RawSlotRow } from '../../../repositories/components/raw/interfaces/raw-slot-row.js';
|
|
3
|
+
import type { RawSlotAllowedComponentRow } from '../../../repositories/components/raw/interfaces/raw-slot-allowed-component-row.js';
|
|
4
|
+
export declare function mapRawSlotToDefinition(row: RawSlotRow, allowedComponentRows: RawSlotAllowedComponentRow[] | undefined): RawSlotDefinition;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import type
|
|
2
|
+
import { type RawComponentWithId } from '../../../core/components/mappers/map-raw-component-to-with-id.js';
|
|
3
3
|
export type { RawComponentRow, RawPropRow, RawSlotRow, RawSlotAllowedComponentRow } from './rows.js';
|
|
4
4
|
export { mapRawComponentRow, mapRawPropRow, mapRawSlotRow, mapRawSlotAllowedComponentRow, mapAllowedValueSnapshotRow, parseReviewReasons, } from './row-mappers.js';
|
|
5
|
+
export type { RawComponentWithId } from '../../../core/components/mappers/map-raw-component-to-with-id.js';
|
|
5
6
|
export { getRawComponentRows } from './reads/get-raw-component-rows.js';
|
|
6
7
|
export { getRawPropRows } from './reads/get-raw-prop-rows.js';
|
|
7
8
|
export { getRawPropAllowedValueRows } from './reads/get-raw-prop-allowed-value-rows.js';
|
|
@@ -12,7 +13,4 @@ export { getComponentDescriptions } from './reads/get-component-descriptions.js'
|
|
|
12
13
|
export { getRawPropAllowedValues } from './reads/get-raw-prop-allowed-values.js';
|
|
13
14
|
export { getRawPropNameAtPosition } from './reads/get-raw-prop-name-at-position.js';
|
|
14
15
|
export { hasRawPropNamed } from './reads/has-raw-prop-named.js';
|
|
15
|
-
export type RawComponentWithId = RawComponentDefinition & {
|
|
16
|
-
component_id: string;
|
|
17
|
-
};
|
|
18
16
|
export declare function getRawComponents(db: DatabaseSync, sessionId: string, allowedNames?: Set<string>): RawComponentWithId[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.33.1-dev-build-
|
|
3
|
+
"version": "2.33.1-dev-build-91bf692.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"svelte": "^5.56.4",
|
|
41
41
|
"ts-morph": "^27.0.2",
|
|
42
42
|
"typescript": "^5.9.3",
|
|
43
|
-
"@contentful/experience-design-system-cli-v2": "2.33.1-dev-build-
|
|
44
|
-
"@contentful/experience-design-system-types": "2.33.1-dev-build-
|
|
43
|
+
"@contentful/experience-design-system-cli-v2": "2.33.1-dev-build-91bf692.0",
|
|
44
|
+
"@contentful/experience-design-system-types": "2.33.1-dev-build-91bf692.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"ink-testing-library": "^4.0.0",
|
|
54
54
|
"typescript-eslint": "^8.67.0",
|
|
55
55
|
"vitest": "^4.0.16",
|
|
56
|
-
"@contentful/experience-design-system-client": "2.33.1-dev-build-
|
|
57
|
-
"@contentful/experience-design-system-
|
|
58
|
-
"@contentful/experience-design-system-
|
|
56
|
+
"@contentful/experience-design-system-client": "2.33.1-dev-build-91bf692.0",
|
|
57
|
+
"@contentful/experience-design-system-extraction": "2.33.1-dev-build-91bf692.0",
|
|
58
|
+
"@contentful/experience-design-system-generation": "2.33.1-dev-build-91bf692.0"
|
|
59
59
|
},
|
|
60
60
|
"repository": {
|
|
61
61
|
"type": "git",
|