@blocklet/pages-kit 0.4.73 → 0.4.74
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.
|
@@ -27,6 +27,7 @@ exports.RenderNestedComponent = void 0;
|
|
|
27
27
|
exports.componentUMDName = componentUMDName;
|
|
28
28
|
exports.mergeComponent = mergeComponent;
|
|
29
29
|
exports.safeJSONParse = safeJSONParse;
|
|
30
|
+
exports.safeYamlParse = safeYamlParse;
|
|
30
31
|
exports.parsePropertyValue = parsePropertyValue;
|
|
31
32
|
exports.assignNullableFields = assignNullableFields;
|
|
32
33
|
const yaml = __importStar(require("yaml"));
|
|
@@ -90,6 +91,12 @@ function safeJSONParse(value) {
|
|
|
90
91
|
}
|
|
91
92
|
return JSON.parse(value);
|
|
92
93
|
}
|
|
94
|
+
function safeYamlParse(value) {
|
|
95
|
+
if (typeof value === 'object' && value !== null) {
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
return yaml.parse(value);
|
|
99
|
+
}
|
|
93
100
|
function parsePropertyValue(property, value, { locale, defaultLocale }) {
|
|
94
101
|
if (property.type === 'json') {
|
|
95
102
|
if (!value)
|
|
@@ -111,7 +118,7 @@ function parsePropertyValue(property, value, { locale, defaultLocale }) {
|
|
|
111
118
|
if (!value)
|
|
112
119
|
return undefined;
|
|
113
120
|
try {
|
|
114
|
-
return
|
|
121
|
+
return safeYamlParse(value);
|
|
115
122
|
}
|
|
116
123
|
catch (error) {
|
|
117
124
|
console.error('parse yaml value error', error);
|