@storybook/core-events
Version:
Event names used in storybook core
73 lines (57 loc) • 6.66 kB
JavaScript
import { StorybookError } from '../chunk-3FIG6PJN.mjs';
import '../chunk-SCHQIR5W.mjs';
import dedent from 'ts-dedent';
var Category=(Category2=>(Category2.PREVIEW_CLIENT_LOGGER="PREVIEW_CLIENT-LOGGER",Category2.PREVIEW_CHANNELS="PREVIEW_CHANNELS",Category2.PREVIEW_CORE_EVENTS="PREVIEW_CORE-EVENTS",Category2.PREVIEW_INSTRUMENTER="PREVIEW_INSTRUMENTER",Category2.PREVIEW_API="PREVIEW_API",Category2.PREVIEW_REACT_DOM_SHIM="PREVIEW_REACT-DOM-SHIM",Category2.PREVIEW_ROUTER="PREVIEW_ROUTER",Category2.PREVIEW_THEMING="PREVIEW_THEMING",Category2.RENDERER_HTML="RENDERER_HTML",Category2.RENDERER_PREACT="RENDERER_PREACT",Category2.RENDERER_REACT="RENDERER_REACT",Category2.RENDERER_SERVER="RENDERER_SERVER",Category2.RENDERER_SVELTE="RENDERER_SVELTE",Category2.RENDERER_VUE="RENDERER_VUE",Category2.RENDERER_VUE3="RENDERER_VUE3",Category2.RENDERER_WEB_COMPONENTS="RENDERER_WEB-COMPONENTS",Category2))(Category||{}),MissingStoryAfterHmrError=class extends StorybookError{constructor(data){super();this.data=data;this.category="PREVIEW_API";this.code=1;}template(){return dedent`
Couldn't find story matching id '${this.data.storyId}' after HMR.
- Did you just rename a story?
- Did you remove it from your CSF file?
- Are you sure a story with the id '${this.data.storyId}' exists?
- Please check the values in the stories field of your main.js config and see if they would match your CSF File.
- Also check the browser console and terminal for potential error messages.`}},ImplicitActionsDuringRendering=class extends StorybookError{constructor(data){super();this.data=data;this.category="PREVIEW_API";this.code=2;this.documentation="https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#using-implicit-actions-during-rendering-is-deprecated-for-example-in-the-play-function";}template(){return dedent`
We detected that you use an implicit action arg while ${this.data.phase} of your story.
${this.data.deprecated?`
This is deprecated and won't work in Storybook 8 anymore.
`:""}
Please provide an explicit spy to your args like this:
import { fn } from '@storybook/test';
...
args: {
${this.data.name}: fn()
}
`}},CalledExtractOnStoreError=class extends StorybookError{constructor(){super(...arguments);this.category="PREVIEW_API";this.code=3;}template(){return dedent`
Cannot call \`storyStore.extract()\` without calling \`storyStore.cacheAllCsfFiles()\` first.
You probably meant to call \`await preview.extract()\` which does the above for you.`}},MissingRenderToCanvasError=class extends StorybookError{constructor(){super(...arguments);this.category="PREVIEW_API";this.code=4;this.documentation="https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#mainjs-framework-field";}template(){return dedent`
Expected your framework's preset to export a \`renderToCanvas\` field.
Perhaps it needs to be upgraded for Storybook 6.4?`}},CalledPreviewMethodBeforeInitializationError=class extends StorybookError{constructor(data){super();this.data=data;this.category="PREVIEW_API";this.code=5;}template(){return dedent`
Called \`Preview.${this.data.methodName}()\` before initialization.
The preview needs to load the story index before most methods can be called. If you want
to call \`${this.data.methodName}\`, try \`await preview.initializationPromise;\` first.
If you didn't call the above code, then likely it was called by an addon that needs to
do the above.`}},StoryIndexFetchError=class extends StorybookError{constructor(data){super();this.data=data;this.category="PREVIEW_API";this.code=6;}template(){return dedent`
Error fetching \`/index.json\`:
${this.data.text}
If you are in development, this likely indicates a problem with your Storybook process,
check the terminal for errors.
If you are in a deployed Storybook, there may have been an issue deploying the full Storybook
build.`}},MdxFileWithNoCsfReferencesError=class extends StorybookError{constructor(data){super();this.data=data;this.category="PREVIEW_API";this.code=7;}template(){return dedent`
Tried to render docs entry ${this.data.storyId} but it is a MDX file that has no CSF
references, or autodocs for a CSF file that some doesn't refer to itself.
This likely is an internal error in Storybook's indexing, or you've attached the
\`attached-mdx\` tag to an MDX file that is not attached.`}},EmptyIndexError=class extends StorybookError{constructor(){super(...arguments);this.category="PREVIEW_API";this.code=8;}template(){return dedent`
Couldn't find any stories in your Storybook.
- Please check your stories field of your main.js config: does it match correctly?
- Also check the browser console and terminal for error messages.`}},NoStoryMatchError=class extends StorybookError{constructor(data){super();this.data=data;this.category="PREVIEW_API";this.code=9;}template(){return dedent`
Couldn't find story matching '${this.data.storySpecifier}'.
- Are you sure a story with that id exists?
- Please check your stories field of your main.js config.
- Also check the browser console and terminal for error messages.`}},MissingStoryFromCsfFileError=class extends StorybookError{constructor(data){super();this.data=data;this.category="PREVIEW_API";this.code=10;}template(){return dedent`
Couldn't find story matching id '${this.data.storyId}' after importing a CSF file.
The file was indexed as if the story was there, but then after importing the file in the browser
we didn't find the story. Possible reasons:
- You are using a custom story indexer that is misbehaving.
- You have a custom file loader that is removing or renaming exports.
Please check your browser console and terminal for errors that may explain the issue.`}},StoryStoreAccessedBeforeInitializationError=class extends StorybookError{constructor(){super(...arguments);this.category="PREVIEW_API";this.code=11;}template(){return dedent`
Cannot access the Story Store until the index is ready.
It is not recommended to use methods directly on the Story Store anyway, in Storybook 9 we will
remove access to the store entirely`}};
export { CalledExtractOnStoreError, CalledPreviewMethodBeforeInitializationError, Category, EmptyIndexError, ImplicitActionsDuringRendering, MdxFileWithNoCsfReferencesError, MissingRenderToCanvasError, MissingStoryAfterHmrError, MissingStoryFromCsfFileError, NoStoryMatchError, StoryIndexFetchError, StoryStoreAccessedBeforeInitializationError };