From a8f0f43af7f1b00cd6feb294f50a183552469a4e Mon Sep 17 00:00:00 2001 From: atanasster Date: Wed, 24 Jun 2020 14:24:05 -0400 Subject: [PATCH] fix: componentsLookup --- core/instrument/src/babel/csf-stories.ts | 2 +- core/instrument/src/babel/extract-component.ts | 6 +++--- core/instrument/src/babel/mdx-stories.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/instrument/src/babel/csf-stories.ts b/core/instrument/src/babel/csf-stories.ts index 02e94db63..0d275f660 100644 --- a/core/instrument/src/babel/csf-stories.ts +++ b/core/instrument/src/babel/csf-stories.ts @@ -169,7 +169,7 @@ export const extractCSFStories = ( }); if (store.doc) { //@ts-ignore - store.doc.components = components; + store.doc.componentsLookup = components; } else { throw new Error(`stories should have one default export`); } diff --git a/core/instrument/src/babel/extract-component.ts b/core/instrument/src/babel/extract-component.ts index 6260304a7..6390d4229 100644 --- a/core/instrument/src/babel/extract-component.ts +++ b/core/instrument/src/babel/extract-component.ts @@ -84,8 +84,8 @@ export const extractStoreComponent = async ( ) => { if (store.doc) { const doc: Document = store.doc; - if (doc.components) { - const componentNames = Object.keys(doc.components); + if (doc.componentsLookup) { + const componentNames = Object.keys(doc.componentsLookup); if (componentNames) { for (const componentName of componentNames) { const { component, componentPackage } = await extractComponent( @@ -104,7 +104,7 @@ export const extractStoreComponent = async ( `${component.request ?? filePath}-${componentName}`, ); store.components[componentKey] = component; - doc.components[componentName] = componentKey; + doc.componentsLookup[componentName] = componentKey; } } } diff --git a/core/instrument/src/babel/mdx-stories.ts b/core/instrument/src/babel/mdx-stories.ts index b51c9697d..1e9d92b4c 100644 --- a/core/instrument/src/babel/mdx-stories.ts +++ b/core/instrument/src/babel/mdx-stories.ts @@ -171,7 +171,7 @@ export const extractMDXStories = (props: any) => ( const { title } = attributes; if (title) { const doc: Document = { - components: {}, + componentsLookup: {}, ...attributes, title, }; @@ -196,7 +196,7 @@ export const extractMDXStories = (props: any) => ( if (store.doc && store.doc.title) { //@ts-ignore - store.doc.components = components; + store.doc.componentsLookup = components; return store; } else { return undefined;