@@ -6,7 +6,7 @@ import { type BrowserContext, type Page, chromium } from 'playwright';
66import Turndown from 'turndown' ;
77import { strikethrough , tables , taskListItems } from 'turndown-plugin-gfm' ;
88
9- import type { Args , StorybookComponentProp , StorybookComponent , StorybookStoreItem , StorybookGlobals } from './types' ;
9+ import type { Args , StorybookComponentProp , StorybookComponent , StorybookStoreItem } from './types' ;
1010
1111/**
1212 * Get content type based on file extension
@@ -135,6 +135,32 @@ export async function extractStorybookData({ distPath }: Args): Promise<Storyboo
135135 }
136136}
137137
138+ /**
139+ * Storybook Client API store, contains methods to cache CSF files and cached items.
140+ */
141+ type StorybookStoryStore = {
142+ /**
143+ * Caches all CSF files in the Storybook store.
144+ * This method must be called before accessing `cachedCSFFiles`.
145+ */
146+ cacheAllCSFFiles : ( ) => Promise < void > ;
147+ /**
148+ * CSF files become available after `cacheAllCSFFiles()` is resolved.
149+ **/
150+ cachedCSFFiles ?: Record < string , StorybookStoreItem > ;
151+ } ;
152+
153+ /**
154+ * Storybook Client API store, contains methods to cache CSF files.
155+ */
156+ interface StorybookGlobals extends Window {
157+ /**
158+ * Storybook Client API, contains story store and other metadata.
159+ * `storyStore` is used for Storybook 7, `storyStoreValue` for >= 8.
160+ */
161+ __STORYBOOK_PREVIEW__ ?: { storyStore : StorybookStoryStore } | { storyStoreValue : StorybookStoryStore } ;
162+ }
163+
138164/**
139165 * Extracts all stories from Storybook Client API store.
140166 */
0 commit comments