@contentful/experience-design-system-cli 2.11.4-dev-build-f1df48f.0 → 2.11.4-dev-build-11add11.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
|
@@ -872,7 +872,10 @@ async function resolveViaTypeChecker(annotation, instance, moduleScript, filePat
|
|
|
872
872
|
}
|
|
873
873
|
const allowed = extractAllowedValuesFromType(propType);
|
|
874
874
|
const description = readJsDocFromDeclaration(declaration);
|
|
875
|
-
|
|
875
|
+
// Snippet detection is alias-based first (works through generic instantiation
|
|
876
|
+
// and full type expansion) and falls back to text-matching for the simple
|
|
877
|
+
// case where alias info isn't available.
|
|
878
|
+
const isSnippet = typeRefersToSnippet(propType) || isSnippetTypeText(typeText, snippetLocals);
|
|
876
879
|
members.push({
|
|
877
880
|
name,
|
|
878
881
|
optional,
|
|
@@ -930,6 +933,35 @@ function isSnippetTypeText(typeText, snippetLocals) {
|
|
|
930
933
|
// Defensive fallback: TS may surface the canonical `Snippet` from the import.
|
|
931
934
|
return typeText === 'Snippet' || typeText.startsWith('Snippet<');
|
|
932
935
|
}
|
|
936
|
+
function typeRefersToSnippet(propType) {
|
|
937
|
+
const seen = new Set();
|
|
938
|
+
let cursor = propType;
|
|
939
|
+
while (cursor && !seen.has(cursor)) {
|
|
940
|
+
seen.add(cursor);
|
|
941
|
+
const aliasName = cursor.getAliasSymbol()?.getName();
|
|
942
|
+
const symName = cursor.getSymbol()?.getName();
|
|
943
|
+
if (aliasName === 'Snippet' || symName === 'Snippet') {
|
|
944
|
+
const decl = cursor.getAliasSymbol()?.getDeclarations()[0] ?? cursor.getSymbol()?.getDeclarations()[0];
|
|
945
|
+
const file = decl?.getSourceFile().getFilePath() ?? '';
|
|
946
|
+
// Accept Snippet from anywhere named "svelte" in the path; users almost
|
|
947
|
+
// never name an unrelated type "Snippet" in their own code, but the
|
|
948
|
+
// path check guards against the rare false positive.
|
|
949
|
+
if (file.includes('/svelte/') || file.includes('\\svelte\\') || file === '')
|
|
950
|
+
return true;
|
|
951
|
+
}
|
|
952
|
+
// Strip optional `| undefined` and recurse into single-element unions
|
|
953
|
+
// (covers `Snippet | undefined` etc.).
|
|
954
|
+
if (cursor.isUnion()) {
|
|
955
|
+
const nonUndef = cursor.getUnionTypes().filter((t) => !t.isUndefined() && !t.isNull());
|
|
956
|
+
if (nonUndef.length === 1) {
|
|
957
|
+
cursor = nonUndef[0];
|
|
958
|
+
continue;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
break;
|
|
962
|
+
}
|
|
963
|
+
return false;
|
|
964
|
+
}
|
|
933
965
|
function mergeSets(a, b) {
|
|
934
966
|
const out = new Set(a);
|
|
935
967
|
for (const v of b)
|
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-
|
|
3
|
+
"version": "2.11.4-dev-build-11add11.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-
|
|
40
|
+
"@contentful/experience-design-system-types": "2.11.4-dev-build-11add11.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@tsconfig/node24": "^24.0.3",
|