@storyblok/astro 9.0.3 → 9.0.5
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/components/StoryblokComponent.astro +8 -17
- package/dist/storyblok-astro.es.js +9317 -6594
- package/dist/storyblok-astro.umd.js +81 -71
- package/package.json +2 -2
|
@@ -11,34 +11,25 @@ export interface Props {
|
|
|
11
11
|
const { blok, ...props } = Astro.props;
|
|
12
12
|
|
|
13
13
|
if (!blok) {
|
|
14
|
-
throw new Error(
|
|
15
|
-
"Cannot render StoryblokComponent. 'blok' prop is undefined."
|
|
16
|
-
);
|
|
14
|
+
throw new Error("Cannot render StoryblokComponent. 'blok' prop is undefined.");
|
|
17
15
|
}
|
|
18
16
|
/**
|
|
19
17
|
* convert blok components to camel case to match vite-plugin-import-storyblok-components
|
|
20
18
|
*/
|
|
21
19
|
let key = toCamelCase(blok.component as string);
|
|
22
20
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
let Component: AstroComponentFactory;
|
|
21
|
+
const loader = storyblokComponents[key] || storyblokComponents['FallbackComponent'];
|
|
26
22
|
|
|
27
|
-
if (!
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
`No component found for blok "${blok.component}".
|
|
23
|
+
if (!loader) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`No component found for blok "${blok.component}".
|
|
31
26
|
Make sure the component is:
|
|
32
27
|
• Registered in your astro.config.mjs, or
|
|
33
28
|
• Placed in the "/${options.componentsDir}/storyblok" folder, or
|
|
34
|
-
• Enable the "fallbackComponent" option to handle missing components
|
|
35
|
-
|
|
36
|
-
else {
|
|
37
|
-
Component = storyblokComponents['FallbackComponent'];
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
Component = storyblokComponents[key];
|
|
29
|
+
• Enable the "fallbackComponent" option to handle missing components.`,
|
|
30
|
+
);
|
|
41
31
|
}
|
|
32
|
+
const Component: AstroComponentFactory = await loader();
|
|
42
33
|
---
|
|
43
34
|
|
|
44
35
|
<Component blok={blok} {...props} />
|