Package and environment
- Package:
@fluentui/babel-preset-storybook-full-source@0.1.3
- Storybook:
10.5.5
Configuration
The plugin is configured as:
[fullSourcePlugin, { importMappings: {}, storyGranularity: "story" }]
Reproduction
import type { Meta, StoryObj } from "@storybook/react";
const meta = { title: "Example" } satisfies Meta;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
render: () => <div>Example</div>,
parameters: {
docs: { description: { story: "Description" } },
},
};
The relevant Storybook configuration includes:
import fullSourcePlugin from "@fluentui/babel-preset-storybook-full-source";
export default {
babel: async (config: any) => ({
...config,
plugins: [
...(config.plugins ?? []),
[fullSourcePlugin, { importMappings: {}, storyGranularity: "story" }],
],
}),
};
Expected behavior
The inline parameters.docs.description.story description survives, and parameters.fullSource is added.
Actual behavior
The description disappears, while parameters.fullSource remains.
Root cause
Verified from the package implementation: parameter detection only tracks assignment expressions such as Story.parameters = ...; it does not recognize the inline parameters property inside export const Story = { ... }. At Program exit it considers parameters missing and appends Story.parameters = {}, overwriting all inline parameters, then assigns Story.parameters.fullSource.
Proposed fix
Recognize inline CSF3 object parameters, or initialize with Story.parameters ??= {} rather than unconditionally replacing the object.
A locally verified workaround is to post-transform Story.parameters = {} into:
Story.parameters = Story.parameters ?? {};
Package and environment
@fluentui/babel-preset-storybook-full-source@0.1.310.5.5Configuration
The plugin is configured as:
Reproduction
The relevant Storybook configuration includes:
Expected behavior
The inline
parameters.docs.description.storydescription survives, andparameters.fullSourceis added.Actual behavior
The description disappears, while
parameters.fullSourceremains.Root cause
Verified from the package implementation: parameter detection only tracks assignment expressions such as
Story.parameters = ...; it does not recognize the inlineparametersproperty insideexport const Story = { ... }. AtProgramexit it considers parameters missing and appendsStory.parameters = {}, overwriting all inline parameters, then assignsStory.parameters.fullSource.Proposed fix
Recognize inline CSF3 object parameters, or initialize with
Story.parameters ??= {}rather than unconditionally replacing the object.A locally verified workaround is to post-transform
Story.parameters = {}into: