UNPKG

@storybook/core-events

Version:
33 lines (26 loc) 5.83 kB
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var server_errors_exports={};__export(server_errors_exports,{Category:()=>Category,ConflictingStaticDirConfigError:()=>ConflictingStaticDirConfigError,CouldNotEvaluateFrameworkError:()=>CouldNotEvaluateFrameworkError,InvalidFrameworkNameError:()=>InvalidFrameworkNameError,InvalidStoriesEntryError:()=>InvalidStoriesEntryError,MissingFrameworkFieldError:()=>MissingFrameworkFieldError,NxProjectDetectedError:()=>NxProjectDetectedError});module.exports=__toCommonJS(server_errors_exports);var import_ts_dedent=__toESM(require("ts-dedent"));var StorybookError=class extends Error{constructor(){super(...arguments);this.data={};this.documentation=!1;this.fromStorybook=!0}get name(){let paddedCode=String(this.code).padStart(4,"0");return`SB_${this.category}_${paddedCode}`}get message(){let page;return this.documentation===!0?page=`https://storybook.js.org/error/${this.name}`:typeof this.documentation=="string"?page=this.documentation:Array.isArray(this.documentation)&&(page=` ${this.documentation.map(doc=>` - ${doc}`).join(` `)}`),this.template()+(page!=null?` More info: ${page} `:"")}};var Category=(Category2=>(Category2.CLI="CLI",Category2.CLI_INIT="CLI_INIT",Category2.CLI_AUTOMIGRATE="CLI_AUTOMIGRATE",Category2.CLI_UPGRADE="CLI_UPGRADE",Category2.CLI_ADD="CLI_ADD",Category2.CODEMOD="CODEMOD",Category2.CORE_SERVER="CORE-SERVER",Category2.CSF_PLUGIN="CSF-PLUGIN",Category2.CSF_TOOLS="CSF-TOOLS",Category2.CORE_COMMON="CORE-COMMON",Category2.NODE_LOGGER="NODE-LOGGER",Category2.TELEMETRY="TELEMETRY",Category2.BUILDER_MANAGER="BUILDER-MANAGER",Category2.BUILDER_VITE="BUILDER-VITE",Category2.BUILDER_WEBPACK5="BUILDER-WEBPACK5",Category2.SOURCE_LOADER="SOURCE-LOADER",Category2.POSTINSTALL="POSTINSTALL",Category2.DOCS_TOOLS="DOCS-TOOLS",Category2.CORE_WEBPACK="CORE-WEBPACK",Category2))(Category||{}),NxProjectDetectedError=class extends StorybookError{constructor(){super(...arguments);this.category="CLI_INIT";this.code=1;this.documentation="https://nx.dev/packages/storybook"}template(){return import_ts_dedent.default` We have detected Nx in your project. Nx has its own Storybook initializer, so please use it instead. Run "nx g @nx/storybook:configuration" to add Storybook to your project. `}},MissingFrameworkFieldError=class extends StorybookError{constructor(){super(...arguments);this.category="CORE-COMMON";this.code=1;this.documentation="https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#new-framework-api"}template(){return import_ts_dedent.default` Could not find a 'framework' field in Storybook config. Please run 'npx storybook@next automigrate' to automatically fix your config. `}},InvalidFrameworkNameError=class extends StorybookError{constructor(data){super();this.data=data;this.category="CORE-COMMON";this.code=2;this.documentation="https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#new-framework-api"}template(){return import_ts_dedent.default` Invalid value of '${this.data.frameworkName}' in the 'framework' field of Storybook config. Please run 'npx storybook@next automigrate' to automatically fix your config. `}},CouldNotEvaluateFrameworkError=class extends StorybookError{constructor(data){super();this.data=data;this.category="CORE-COMMON";this.code=3}template(){return import_ts_dedent.default` Could not evaluate the '${this.data.frameworkName}' package from the 'framework' field of Storybook config. Are you sure it's a valid package and is installed? `}},ConflictingStaticDirConfigError=class extends StorybookError{constructor(){super(...arguments);this.category="CORE-SERVER";this.code=1;this.documentation="https://storybook.js.org/docs/react/configure/images-and-assets#serving-static-files-via-storybook-configuration"}template(){return import_ts_dedent.default` Storybook encountered a conflict when trying to serve statics. You have configured both: * Storybook's option in the config file: 'staticDirs' * Storybook's (deprecated) CLI flag: '--staticDir' or '-s' Please remove the CLI flag from your storybook script and use only the 'staticDirs' option instead. `}},InvalidStoriesEntryError=class extends StorybookError{constructor(){super(...arguments);this.category="CORE-COMMON";this.code=4;this.documentation="https://storybook.js.org/docs/react/faq#can-i-have-a-storybook-with-no-local-stories"}template(){return import_ts_dedent.default` Storybook could not index your stories. Your main configuration somehow does not contain a 'stories' field, or it resolved to an empty array. Please check your main configuration file and make sure it exports a 'stories' field that is not an empty array. `}};0&&(module.exports={Category,ConflictingStaticDirConfigError,CouldNotEvaluateFrameworkError,InvalidFrameworkNameError,InvalidStoriesEntryError,MissingFrameworkFieldError,NxProjectDetectedError});