@storyblok/astro 10.0.0 → 10.1.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.
@@ -1,8 +1,32 @@
1
1
  import { Plugin } from 'vite';
2
2
  /**
3
- * Vite plugin that automatically imports Storyblok components from a specified directory
4
- * and merges them with optional user-provided component mappings.
5
- *
6
- * @returns Vite plugin object
3
+ * Vite plugin that auto-imports Storyblok components from a directory
4
+ * and merges them with user-provided component mappings.
7
5
  */
8
6
  export declare function vitePluginImportStoryblokComponents(components: Record<string, string>, componentsDir: string, enableFallbackComponent: boolean, customFallbackComponent?: string): Plugin;
7
+ export interface ComponentRegistrationParts {
8
+ importStatement: string;
9
+ wrapperDefinition: string;
10
+ registrationCall: string;
11
+ }
12
+ /**
13
+ * Generates the virtual module code with:
14
+ * - Static imports at the top for proper hoisting
15
+ * - Glob-imported components from storyblok folder
16
+ * - Manual and fallback component registrations
17
+ */
18
+ export declare function generateModuleCode(componentsDir: string, fallbackRegistration: ComponentRegistrationParts | null, manualRegistrations: ComponentRegistrationParts[]): string;
19
+ interface CreateComponentRegistrationPartsOptions {
20
+ componentName: string;
21
+ importPath: string;
22
+ }
23
+ /**
24
+ * Generates structured registration parts for a component.
25
+ *
26
+ * Uses a getter wrapper to avoid TDZ (Temporal Dead Zone) errors.
27
+ * When Vite bundles modules, direct references to imported components
28
+ * can cause "Cannot access 'X' before initialization" errors.
29
+ * The getter defers access until the component is actually needed.
30
+ */
31
+ export declare function createComponentRegistrationParts({ componentName, importPath, }: CreateComponentRegistrationPartsOptions): ComponentRegistrationParts;
32
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@storyblok/astro",
3
3
  "type": "module",
4
- "version": "10.0.0",
4
+ "version": "10.1.0",
5
5
  "private": false,
6
6
  "description": "Official Astro integration for the Storyblok Headless CMS",
7
7
  "author": "Storyblok",
@@ -46,20 +46,20 @@
46
46
  "dist"
47
47
  ],
48
48
  "peerDependencies": {
49
- "astro": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"
49
+ "astro": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
50
50
  },
51
51
  "dependencies": {
52
52
  "camelcase": "^8.0.0",
53
53
  "morphdom": "^2.7.8",
54
- "@storyblok/js": "6.0.0",
55
- "@storyblok/richtext": "5.0.0"
54
+ "@storyblok/richtext": "5.1.0",
55
+ "@storyblok/js": "6.1.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@cypress/vite-dev-server": "^6.0.3",
59
59
  "@rollup/plugin-dynamic-import-vars": "^2.1.5",
60
60
  "@types/lodash.mergewith": "^4.6.9",
61
61
  "@types/node": "^24.11.0",
62
- "astro": "^6.1.1",
62
+ "astro": "^7.0.0",
63
63
  "cypress": "^14.3.3",
64
64
  "eslint": "^9.26.0",
65
65
  "eslint-config-prettier": "^10.0.1",
@@ -69,11 +69,11 @@
69
69
  "prettier-plugin-astro": "^0.13.0",
70
70
  "start-server-and-test": "^2.0.11",
71
71
  "typescript": "5.8.3",
72
- "vite": "^7.1.7",
72
+ "vite": "^8.0.0",
73
73
  "vite-plugin-dts": "^4.5.3",
74
- "vite-plugin-static-copy": "^2.2.0",
74
+ "vite-plugin-static-copy": "^4.1.1",
75
75
  "vitest": "^3.1.3",
76
- "@storyblok/eslint-config": "0.5.1"
76
+ "@storyblok/eslint-config": "0.6.0"
77
77
  },
78
78
  "eslintConfig": {
79
79
  "env": {