diff --git a/MIGRATION.md b/MIGRATION.md index 3e42324c8431..79150ff185a3 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -20,9 +20,9 @@ - [7.0 feature flags removed](#70-feature-flags-removed) - [Vite builder uses vite config automatically](#vite-builder-uses-vite-config-automatically) - [Removed docs.getContainer and getPage parameters](#removed-docsgetcontainer-and-getpage-parameters) + - [Removed STORYBOOK_REACT_CLASSES global](#removed-storybook_react_classes-global) - [Icons API changed](#icons-api-changed) - ['config' preset entry replaced with 'previewAnnotations'](#config-preset-entry-replaced-with-previewannotations) - - [Vue2 DOM structure changed](#vue2-dom-structure-changed) - [Docs Changes](#docs-changes) - [Standalone docs files](#standalone-docs-files) - [Referencing stories in docs files](#referencing-stories-in-docs-files) @@ -530,6 +530,10 @@ If you were using `viteFinal` in 6.5 to simply merge in your project's standard It is no longer possible to set `parameters.docs.getContainer()` and `getPage()`. Instead use `parameters.docs.container` or `parameters.docs.page` directly. +#### Removed STORYBOOK_REACT_CLASSES global + +This was a legacy global variable from the early days of react docgen. If you were using this variable, you can instead use docgen information which is added directly to components using `.__docgenInfo`. + #### Icons API changed For addon authors who use the `Icons` component, its API has been updated in Storybook 7. diff --git a/code/addons/storyshots/storyshots-core/src/api/index.ts b/code/addons/storyshots/storyshots-core/src/api/index.ts index 7668c69fa993..232f929bf21f 100644 --- a/code/addons/storyshots/storyshots-core/src/api/index.ts +++ b/code/addons/storyshots/storyshots-core/src/api/index.ts @@ -7,7 +7,6 @@ import loadFramework from '../frameworks/frameworkLoader'; import { StoryshotsOptions } from './StoryshotsOptions'; const { describe, window: globalWindow } = global; -global.STORYBOOK_REACT_CLASSES = global.STORYBOOK_REACT_CLASSES || {}; type TestMethod = 'beforeAll' | 'beforeEach' | 'afterEach' | 'afterAll'; const methods: TestMethod[] = ['beforeAll', 'beforeEach', 'afterEach', 'afterAll']; diff --git a/code/frameworks/angular/src/server/framework-preset-angular-cli.test.ts b/code/frameworks/angular/src/server/framework-preset-angular-cli.test.ts index fac3ff0dfd89..45a98660effb 100644 --- a/code/frameworks/angular/src/server/framework-preset-angular-cli.test.ts +++ b/code/frameworks/angular/src/server/framework-preset-angular-cli.test.ts @@ -786,7 +786,6 @@ const newWebpackConfiguration = ( devtool: 'cheap-module-source-map', entry: [ '/Users/joe/storybook/lib/core-server/dist/esm/globals/polyfills.js', - '/Users/joe/storybook/lib/core-server/dist/esm/globals/globals.js', '/Users/joe/storybook/examples/angular-cli/.storybook/storybook-init-framework-entry.js', '/Users/joe/storybook/addons/docs/dist/esm/frameworks/common/config.js-generated-other-entry.js', '/Users/joe/storybook/addons/docs/dist/esm/frameworks/angular/config.js-generated-other-entry.js', diff --git a/code/lib/core-client/src/globals/globals.ts b/code/lib/core-client/src/globals/globals.ts deleted file mode 100644 index 0375e3f37a9a..000000000000 --- a/code/lib/core-client/src/globals/globals.ts +++ /dev/null @@ -1,5 +0,0 @@ -import global from 'global'; - -const { window: globalWindow } = global; - -globalWindow.STORYBOOK_REACT_CLASSES = {}; diff --git a/code/lib/core-server/src/presets/common-preset.ts b/code/lib/core-server/src/presets/common-preset.ts index daefd2030a70..9e51296c4fc2 100644 --- a/code/lib/core-server/src/presets/common-preset.ts +++ b/code/lib/core-server/src/presets/common-preset.ts @@ -93,7 +93,7 @@ export const previewAnnotations = async (base: any, options: Options) => { if (config.length > 0) warnConfigField(); - return [...config, require.resolve('@storybook/core-client/dist/esm/globals/globals'), ...base]; + return [...config, ...base]; }; export const features = async ( diff --git a/code/presets/react-webpack/src/framework-preset-react-docs.test.ts b/code/presets/react-webpack/src/framework-preset-react-docs.test.ts index 0a4afb50fbe3..553dd6098728 100644 --- a/code/presets/react-webpack/src/framework-preset-react-docs.test.ts +++ b/code/presets/react-webpack/src/framework-preset-react-docs.test.ts @@ -33,14 +33,7 @@ describe('framework-preset-react-docgen', () => { overrides: [ { test: /\.(cjs|mjs|tsx?|jsx?)$/, - plugins: [ - [ - babelPluginReactDocgenPath, - { - DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', - }, - ], - ], + plugins: [[babelPluginReactDocgenPath]], }, ], }); diff --git a/code/presets/react-webpack/src/framework-preset-react-docs.ts b/code/presets/react-webpack/src/framework-preset-react-docs.ts index f02de5cf515b..b08a3e427d4f 100644 --- a/code/presets/react-webpack/src/framework-preset-react-docs.ts +++ b/code/presets/react-webpack/src/framework-preset-react-docs.ts @@ -23,14 +23,7 @@ export const babel: StorybookConfig['babel'] = async (config, options) => { ...(config?.overrides || []), { test: reactDocgen === 'react-docgen' ? /\.(cjs|mjs|tsx?|jsx?)$/ : /\.(cjs|mjs|jsx?)$/, - plugins: [ - [ - require.resolve('babel-plugin-react-docgen'), - { - DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', - }, - ], - ], + plugins: [[require.resolve('babel-plugin-react-docgen')]], }, ], }; diff --git a/code/renderers/vue/src/globals.ts b/code/renderers/vue/src/globals.ts index e80d65427f47..2fec84f69602 100644 --- a/code/renderers/vue/src/globals.ts +++ b/code/renderers/vue/src/globals.ts @@ -3,5 +3,4 @@ import global from 'global'; const { window: globalWindow } = global; -globalWindow.STORYBOOK_REACT_CLASSES = {}; globalWindow.STORYBOOK_ENV = 'vue'; diff --git a/code/renderers/vue3/src/globals.ts b/code/renderers/vue3/src/globals.ts index ab2c948bafd1..5a17ebf65326 100644 --- a/code/renderers/vue3/src/globals.ts +++ b/code/renderers/vue3/src/globals.ts @@ -3,5 +3,4 @@ import global from 'global'; const { window: globalWindow } = global; -globalWindow.STORYBOOK_REACT_CLASSES = {}; globalWindow.STORYBOOK_ENV = 'vue3';