The CSF parser did not previously require that stories be functions, so story detection already worked. However, overriding the story's name via the name property was not supported, nor was parsing CSF3-style objects for properties (like name):
This commit recognizes name as a relevant property for CSF3 stories and adds basic logic to parse story objects, subject to Babel's evaluation limitations. (Notably, story objects that use object spread will not have story names detected, even if they are not part of the spread itself.)
This commit also attempts to handle differences in semantics between Storybook 6 and 7 as they relate to CSF2 and CSF3 custom display names. In particular, Storybook 7 enforces stricter rules around when to use name vs. storyName to override a story's display name.
The CSF parser did not previously require that stories be functions, so story detection already worked. However, overriding the story's name via the
name
property was not supported, nor was parsing CSF3-style objects for properties (likename
):This commit recognizes
name
as a relevant property for CSF3 stories and adds basic logic to parse story objects, subject to Babel's evaluation limitations. (Notably, story objects that use object spread will not have story names detected, even if they are not part of the spread itself.)This commit also attempts to handle differences in semantics between Storybook 6 and 7 as they relate to CSF2 and CSF3 custom display names. In particular, Storybook 7 enforces stricter rules around when to use
name
vs.storyName
to override a story's display name.