@blocklet/pages-kit 0.3.21 → 0.3.23
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/lib/cjs/builtin/utils.js +16 -4
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/inject-global-components.js +1 -2
- package/lib/cjs/utils/preload.js +2 -0
- package/lib/cjs/utils/property.js +15 -0
- package/lib/esm/builtin/utils.js +11 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/inject-global-components.js +1 -2
- package/lib/esm/utils/preload.js +2 -0
- package/lib/esm/utils/property.js +12 -0
- package/lib/types/builtin/utils.d.ts +1 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/lib/types/types/core.d.ts +1 -1
- package/lib/types/utils/preload.d.ts +1 -1
- package/package.json +3 -1
|
@@ -27,8 +27,7 @@ import CustomComponentRenderer from '../components/CustomComponentRenderer';
|
|
|
27
27
|
import { BuiltinModulesGlobalVariableName } from '../types/builtin';
|
|
28
28
|
function injectGlobalComponents() {
|
|
29
29
|
const win = window;
|
|
30
|
-
if (win[BuiltinModulesGlobalVariableName])
|
|
31
|
-
return;
|
|
30
|
+
// if (win[BuiltinModulesGlobalVariableName]) return;
|
|
32
31
|
win[BuiltinModulesGlobalVariableName] = {
|
|
33
32
|
modules: {
|
|
34
33
|
'@blocklet/pages-kit/builtin/pages-kit': { CustomComponentRenderer },
|
package/lib/esm/utils/preload.js
CHANGED
|
@@ -11,6 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { PreloadComponentScriptModule, PreloadComponentsStateGlobalVariableName, } from '../types';
|
|
13
13
|
export function injectPreloadComponents(data) {
|
|
14
|
+
if (!data)
|
|
15
|
+
return null;
|
|
14
16
|
const injectState = {
|
|
15
17
|
config: data.config,
|
|
16
18
|
components: Object.fromEntries(Object.entries(data.components).map(([componentId, { script, component }]) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import yaml from 'js-yaml';
|
|
1
2
|
export function componentUMDName({ componentId }) {
|
|
2
3
|
return `PagesCustomComponent${componentId}`;
|
|
3
4
|
}
|
|
@@ -66,6 +67,17 @@ export function parsePropertyValue(property, value, { locale, defaultLocale }) {
|
|
|
66
67
|
return undefined;
|
|
67
68
|
}
|
|
68
69
|
}
|
|
70
|
+
if (property.type === 'yaml') {
|
|
71
|
+
if (!value)
|
|
72
|
+
return undefined;
|
|
73
|
+
try {
|
|
74
|
+
return yaml.load(value);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.error('parse yaml value error', error);
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
69
81
|
if (property.type === 'component') {
|
|
70
82
|
const componentId = value === null || value === void 0 ? void 0 : value.componentId;
|
|
71
83
|
if (typeof componentId !== 'string')
|