@contentful/experience-design-system-cli 2.34.5-dev-build-ab8465d2.0 → 2.34.5-dev-build-f8f0b1fa.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 +43 -59
- package/package.json +6 -6
package/dist/package.json
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -11334,30 +11334,26 @@ function getTsxExtractionContext(filePaths, componentFilePattern) {
|
|
|
11334
11334
|
project: createTsxProject(getTsxProjectFiles(filePaths))
|
|
11335
11335
|
};
|
|
11336
11336
|
}
|
|
11337
|
-
function extractTsxComponents(filePaths, componentFilePattern,
|
|
11337
|
+
function extractTsxComponents(filePaths, componentFilePattern, extract) {
|
|
11338
11338
|
const extractionContext = getTsxExtractionContext(filePaths, componentFilePattern);
|
|
11339
|
-
if (!extractionContext)
|
|
11340
|
-
return
|
|
11341
|
-
|
|
11339
|
+
if (!extractionContext) {
|
|
11340
|
+
return { components: [], warnings: [], exclusions: [] };
|
|
11341
|
+
}
|
|
11342
|
+
const { componentFiles, project } = extractionContext;
|
|
11342
11343
|
const components = [];
|
|
11343
|
-
|
|
11344
|
+
const warnings = [];
|
|
11345
|
+
const exclusions = [];
|
|
11346
|
+
for (const filePath of componentFiles) {
|
|
11344
11347
|
try {
|
|
11345
|
-
const sourceFile =
|
|
11348
|
+
const sourceFile = project.getSourceFile(filePath);
|
|
11346
11349
|
if (!sourceFile)
|
|
11347
11350
|
continue;
|
|
11348
|
-
components.push(...
|
|
11351
|
+
components.push(...extract(sourceFile, exclusions));
|
|
11349
11352
|
} catch (e) {
|
|
11350
11353
|
warnings.push(`Failed to extract from ${filePath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
11351
11354
|
}
|
|
11352
11355
|
}
|
|
11353
|
-
return {
|
|
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");
|
|
11356
|
+
return { components, warnings, exclusions, project };
|
|
11361
11357
|
}
|
|
11362
11358
|
function resolveDefaultExportName(declarations, exported, allowVariableDeclaration = false) {
|
|
11363
11359
|
const declaration = declarations[0];
|
|
@@ -11366,6 +11362,27 @@ function resolveDefaultExportName(declarations, exported, allowVariableDeclarati
|
|
|
11366
11362
|
return void 0;
|
|
11367
11363
|
return name;
|
|
11368
11364
|
}
|
|
11365
|
+
function getRenderableExports(sourceFile, exclusions, options) {
|
|
11366
|
+
const renderable = [];
|
|
11367
|
+
const exported = sourceFile.getExportedDeclarations();
|
|
11368
|
+
for (const [exportKey, declarations] of exported) {
|
|
11369
|
+
const name = exportKey === "default" ? resolveDefaultExportName(declarations, exported, options.allowVariableDeclaration) : exportKey;
|
|
11370
|
+
if (!name || !/^[A-Z]/.test(name))
|
|
11371
|
+
continue;
|
|
11372
|
+
if (name.startsWith("use")) {
|
|
11373
|
+
exclusions.push({
|
|
11374
|
+
itemType: "component",
|
|
11375
|
+
name,
|
|
11376
|
+
source: sourceFile.getFilePath(),
|
|
11377
|
+
reason: options.hookReason,
|
|
11378
|
+
stage: "component-filter"
|
|
11379
|
+
});
|
|
11380
|
+
continue;
|
|
11381
|
+
}
|
|
11382
|
+
renderable.push({ name, declarations });
|
|
11383
|
+
}
|
|
11384
|
+
return renderable;
|
|
11385
|
+
}
|
|
11369
11386
|
function kebabToPascal(input) {
|
|
11370
11387
|
return input.split("-").filter(Boolean).map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("");
|
|
11371
11388
|
}
|
|
@@ -13649,18 +13666,13 @@ function hasImplementationChildrenHint(funcNode, param) {
|
|
|
13649
13666
|
return body.getDescendantsOfKind(SyntaxKind4.JsxSpreadAttribute).some((attr) => isComponentSpreadAttribute(attr, /* @__PURE__ */ new Set([paramName])));
|
|
13650
13667
|
}
|
|
13651
13668
|
async function extractReactComponents(filePaths) {
|
|
13652
|
-
const exclusions = []
|
|
13653
|
-
const extractionContext = extractTsxComponents(filePaths, /\.[jt]sx$/, (sourceFile) => {
|
|
13669
|
+
const { components, warnings, exclusions, project } = extractTsxComponents(filePaths, /\.[jt]sx$/, (sourceFile, exclusions2) => {
|
|
13654
13670
|
if (isStencilFile2(sourceFile))
|
|
13655
13671
|
return [];
|
|
13656
13672
|
const fileExports = [...sourceFile.getExportedDeclarations().keys()];
|
|
13657
13673
|
const isNext = isNextJsComponent(sourceFile.getFilePath(), fileExports);
|
|
13658
|
-
return extractFromSourceFile2(sourceFile, isNext,
|
|
13674
|
+
return extractFromSourceFile2(sourceFile, isNext, exclusions2);
|
|
13659
13675
|
});
|
|
13660
|
-
if (!extractionContext) {
|
|
13661
|
-
return { components: [], warnings: [] };
|
|
13662
|
-
}
|
|
13663
|
-
const { project, components, warnings } = extractionContext;
|
|
13664
13676
|
const propsToComponent = /* @__PURE__ */ new Map();
|
|
13665
13677
|
const componentNames = /* @__PURE__ */ new Set();
|
|
13666
13678
|
for (const c2 of components) {
|
|
@@ -13696,7 +13708,7 @@ async function extractReactComponents(filePaths) {
|
|
|
13696
13708
|
const cached = structuralByFile.get(filePath);
|
|
13697
13709
|
if (cached)
|
|
13698
13710
|
return cached;
|
|
13699
|
-
const sourceFile = project
|
|
13711
|
+
const sourceFile = project?.getSourceFile(filePath);
|
|
13700
13712
|
if (!sourceFile)
|
|
13701
13713
|
return [];
|
|
13702
13714
|
const ctx = { propsToComponent, componentNames };
|
|
@@ -13758,22 +13770,11 @@ async function extractReactComponents(filePaths) {
|
|
|
13758
13770
|
}
|
|
13759
13771
|
function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
13760
13772
|
const components = [];
|
|
13761
|
-
const exported = sourceFile.getExportedDeclarations();
|
|
13762
13773
|
const usesCreateContext = sourceFileUsesCreateContext(sourceFile);
|
|
13763
|
-
for (const
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
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
|
-
}
|
|
13774
|
+
for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
13775
|
+
allowVariableDeclaration: true,
|
|
13776
|
+
hookReason: "React hook names are not renderable components"
|
|
13777
|
+
})) {
|
|
13777
13778
|
const funcNode = resolveBestFunctionNode(declarations);
|
|
13778
13779
|
if (!funcNode)
|
|
13779
13780
|
continue;
|
|
@@ -14251,12 +14252,7 @@ var init_react = __esm({
|
|
|
14251
14252
|
// packages/experience-design-system-extraction/dist/src/extract/vue-tsx.js
|
|
14252
14253
|
import { Node as Node5, SyntaxKind as SyntaxKind5 } from "ts-morph";
|
|
14253
14254
|
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;
|
|
14255
|
+
const { components, warnings, exclusions } = extractTsxComponents(filePaths, /\.tsx$/, extractFromSourceFile3);
|
|
14260
14256
|
return {
|
|
14261
14257
|
components: components.sort((a, b) => a.name.localeCompare(b.name)),
|
|
14262
14258
|
warnings,
|
|
@@ -14265,21 +14261,9 @@ async function extractVueTsxComponents(filePaths) {
|
|
|
14265
14261
|
}
|
|
14266
14262
|
function extractFromSourceFile3(sourceFile, exclusions) {
|
|
14267
14263
|
const components = [];
|
|
14268
|
-
const
|
|
14269
|
-
|
|
14270
|
-
|
|
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
|
-
}
|
|
14264
|
+
for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
14265
|
+
hookReason: "Vue composition hook names are not renderable components"
|
|
14266
|
+
})) {
|
|
14283
14267
|
const component = extractVueTsxComponent(declarations, name, sourceFile);
|
|
14284
14268
|
if (component) {
|
|
14285
14269
|
components.push(component);
|
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-
|
|
3
|
+
"version": "2.34.5-dev-build-f8f0b1fa.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-
|
|
45
|
-
"@contentful/experience-design-system-
|
|
44
|
+
"@contentful/experience-design-system-cli-v2": "2.34.5-dev-build-f8f0b1fa.0",
|
|
45
|
+
"@contentful/experience-design-system-types": "2.34.5-dev-build-f8f0b1fa.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-
|
|
58
|
-
"@contentful/experience-design-system-
|
|
59
|
-
"@contentful/experience-design-system-generation": "2.34.5-dev-build-
|
|
57
|
+
"@contentful/experience-design-system-extraction": "2.34.5-dev-build-f8f0b1fa.0",
|
|
58
|
+
"@contentful/experience-design-system-client": "2.34.5-dev-build-f8f0b1fa.0",
|
|
59
|
+
"@contentful/experience-design-system-generation": "2.34.5-dev-build-f8f0b1fa.0"
|
|
60
60
|
},
|
|
61
61
|
"repository": {
|
|
62
62
|
"type": "git",
|