Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: Prerelease 7.5.0-alpha.4 #24269

Merged
merged 103 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
2a9b09e
docs: add information about @storybook/preview-api useArgs hook
jonthenerd May 17, 2023
9e5f981
docs: fix issue with code sample
jonthenerd May 17, 2023
b701f0f
docs: fix code block - remove unnecessary export
jonthenerd May 17, 2023
aade9cc
docs: now passes eslint
jonthenerd May 17, 2023
1d54130
docs: change code block to be minimum example that does not cause esl…
jonthenerd May 17, 2023
d12518c
docs: fix typo in header
jonthenerd May 17, 2023
665c1a8
docs: align code pattern to ensure no eslint or storybook issues
jonthenerd May 18, 2023
449b052
make changes per recommendations
jonthenerd Jun 16, 2023
cec4576
fix typos; align style to other js code snippets
jonthenerd Jun 16, 2023
8add32d
fix mispelling in comments
jonthenerd Jun 16, 2023
c3ea9cd
Merge branch 'next' into patch-1
jonniebigodes Jul 6, 2023
ebbff0d
Added more portable path handling code to better support win32-style …
T99 Aug 3, 2023
ed5bd70
Merge branch 'next' into patch-1
jonthenerd Aug 11, 2023
f9e2e0d
add typescript 4.9 snippet
jonthenerd Aug 11, 2023
44fa3c3
removed added file. Why wasn't this excluded via .gitignore???
jonthenerd Aug 11, 2023
504fefa
modify text to align to pull request comment
jonthenerd Aug 11, 2023
522bb81
Merge branch 'next' into patch-1
jonthenerd Aug 11, 2023
41d8edf
remove link to incorrect api
jonthenerd Aug 11, 2023
de8ab09
add migration notes for storyIndexers
JReinhold Aug 23, 2023
8b81a5f
deprecate storyIndexers
JReinhold Aug 23, 2023
01dea7c
add deprecation warnings and migration notes for storyStoreV6
JReinhold Aug 24, 2023
1a5e4ee
move deprecation warning to build and dev
JReinhold Aug 24, 2023
eb4d699
update docs snippets for indexers
JReinhold Aug 24, 2023
b53e602
rename `index` to `indexFn`
JReinhold Sep 5, 2023
60ffb65
Merge branch 'next' of github.com:storybookjs/storybook into deprecat…
JReinhold Sep 5, 2023
214b6ec
indexFn -> createIndex
JReinhold Sep 5, 2023
91cce63
Merge branch 'next' into patch-1
jonniebigodes Sep 6, 2023
78ae771
Merge branch 'next' into patch-1
jonthenerd Sep 10, 2023
eea29bc
add react IFRenderer to args docs addition
jonthenerd Sep 10, 2023
b253aeb
Adds conditional render to the Styling and CSS docs
jonniebigodes Sep 11, 2023
cd3e9bd
Merge branch 'next' into add_conditional_render_styling_docs
jonniebigodes Sep 12, 2023
65bca16
fix(builder-vite): Fix missing @storybook/addon-docs dependency
bryanjtc Sep 13, 2023
fe6f5d7
Move mdx plugin from builder-vite to addon-docs
bryanjtc Sep 14, 2023
d8a0049
Await mdxPlugin
bryanjtc Sep 14, 2023
3acfceb
Replace createFilter import from vite with @rollup/pluginutils
bryanjtc Sep 14, 2023
39fa071
Use StorybookConfig type from @storybook/builder-vite
bryanjtc Sep 14, 2023
ab089d4
Replace parameter for mdxPlugin
bryanjtc Sep 14, 2023
aabf48e
Move mdxPlugin import
bryanjtc Sep 14, 2023
fc7fc7f
Replace types in viteFinal to fix error
bryanjtc Sep 14, 2023
f97552c
(fix):Adjust the contrast ratio for focus and hover
chocoscoding Sep 18, 2023
3dbf199
Merge branch 'next' into next
chocoscoding Sep 18, 2023
7758e8f
Keep the previous providerImportSource value
bryanjtc Sep 18, 2023
0f5e6c1
Move @rollup/pluginutils to devDependencies
bryanjtc Sep 19, 2023
927bdd9
light mode error fix
chocoscoding Sep 19, 2023
e15e51d
Merge branch 'next' into next
chocoscoding Sep 19, 2023
8beddfa
hoverable color change
chocoscoding Sep 19, 2023
9439d4c
Merge branch 'next' into next
ndelangen Sep 19, 2023
04a5b3e
Merge branch 'next' into next
chocoscoding Sep 19, 2023
34db5b2
Merge branch 'next' into next
chocoscoding Sep 20, 2023
5ef917a
feat: Convert from proposal plugins to transform plugins
roottool Sep 21, 2023
25e38c0
add an await when setting state
ndelangen Sep 22, 2023
45f6153
Merge pull request #24268 from storybookjs/norbert/await-setState-in-…
ndelangen Sep 22, 2023
961790e
Merge branch 'next' into next
cdedreuille Sep 22, 2023
379d1b0
Merge pull request #24205 from chocoscoding/next
cdedreuille Sep 22, 2023
df96c9d
Update CHANGELOG.md for v7.4.4 [skip ci]
storybook-bot Sep 22, 2023
b308e54
Merge pull request #24166 from storybookjs/fix-yarn-pnp
ndelangen Sep 22, 2023
2fa0afa
cancel an action when the PR count is 0
ndelangen Sep 22, 2023
cf3fdaf
Merge pull request #24274 from storybookjs/norbert/gh-pr-creation-bug…
ndelangen Sep 22, 2023
26a8309
Merge branch 'next' into feature/24070/convert-babel-plugins
roottool Sep 24, 2023
09c793b
add missing dependency in useEffect hook
yannbf Sep 24, 2023
bf3c377
Merge pull request #24291 from storybookjs/yann/fix-infinite-effect-call
shilman Sep 24, 2023
12be604
Revert "Build: Cancel when the PR count is 0"
shilman Sep 24, 2023
43b7366
Merge pull request #24293 from storybookjs/revert-24274-norbert/gh-pr…
shilman Sep 24, 2023
b61d71b
Update storybook-addons-api-usechannel.js.mdx
RohanPoojary1107 Sep 24, 2023
a3cdabb
Update CHANGELOG.md for v7.4.5 [skip ci]
storybook-bot Sep 24, 2023
91f0c28
Merge branch 'next' into patch-1
jonniebigodes Sep 24, 2023
dd44720
Merge branch 'next' of github.com:storybookjs/storybook into deprecat…
JReinhold Sep 25, 2023
bbe075a
deprecate storyIndexers on usage
JReinhold Sep 25, 2023
0b7f436
add docs link to migration
JReinhold Sep 25, 2023
130154b
fix migration title
JReinhold Sep 25, 2023
7e6b56a
add migration note about support both versions
JReinhold Sep 25, 2023
01db751
Merge branch 'next' into feature/24070/convert-babel-plugins
roottool Sep 25, 2023
5d07fb4
Updates snippet to reference an existing import
wesgro Sep 28, 2023
128c71a
Docs: Adds theming video
jonniebigodes Sep 30, 2023
79f49b2
Merge pull request #24322 from wesgro/patch-1
jonniebigodes Sep 30, 2023
069e152
Merge branch 'next' into patch-1
jonniebigodes Sep 30, 2023
8c7d53c
Merge pull request #24295 from RohanPoojary1107/patch-1
jonniebigodes Sep 30, 2023
d9a0caa
Merge branch 'next' into patch-1
jonthenerd Oct 1, 2023
855d053
docs: fix import path
YossiSaadi Oct 1, 2023
f3ca8f4
Merge branch 'next' into feature/24070/convert-babel-plugins
roottool Oct 2, 2023
4c56698
Merge branch 'next' into next
valentinpalkovic Oct 2, 2023
039f65c
Merge branch 'next' into docs_adds_theming_video
jonniebigodes Oct 2, 2023
5cb3679
Merge pull request #24335 from storybookjs/docs_adds_theming_video
jonniebigodes Oct 2, 2023
e2aa53e
Merge pull request #23695 from T99/next
valentinpalkovic Oct 2, 2023
60ce17f
Merge branch 'next' into add_conditional_render_styling_docs
jonniebigodes Oct 2, 2023
d2b8721
Merge branch 'next' into feature/24070/convert-babel-plugins
ndelangen Oct 2, 2023
8570d0d
Merge branch 'next' into patch-1
jonniebigodes Oct 2, 2023
0cacd64
Merge branch 'next' into patch-1
jonniebigodes Oct 2, 2023
470aa54
Merge pull request #24338 from YossiSaadi/patch-1
jonniebigodes Oct 2, 2023
106bf9a
Merge branch 'next' into patch-1
jonniebigodes Oct 2, 2023
b861017
Merge branch 'next' into add_conditional_render_styling_docs
jonniebigodes Oct 2, 2023
c56bf31
Merge pull request #24145 from storybookjs/add_conditional_render_sty…
jonniebigodes Oct 2, 2023
c1b33d8
Merge pull request #22590 from jonthenerd/patch-1
jonniebigodes Oct 2, 2023
4e2d75c
Merge branch 'next' into feature/24070/convert-babel-plugins
roottool Oct 2, 2023
6ee8dca
Fix Nextjs project detection
yannbf Oct 3, 2023
5c308f7
Merge pull request #24346 from storybookjs/yann/fix-nightly
yannbf Oct 3, 2023
fa57f76
Merge pull request #24290 from roottool/feature/24070/convert-babel-p…
ndelangen Oct 3, 2023
f83a01b
move from serve-favicon to a custom route to support svg
ndelangen Oct 3, 2023
bd3abf2
disable Angular 15 sandbox in CI
JReinhold Oct 3, 2023
e8ca10c
Merge pull request #24358 from storybookjs/disable-angular-15-sandbox
JReinhold Oct 3, 2023
3270b62
Merge pull request #23938 from storybookjs/deprecate-storyindexers
JReinhold Oct 3, 2023
f23fa9c
Merge pull request #24356 from storybookjs/norbert/fix-missing-favico…
ndelangen Oct 3, 2023
090ba7f
Write changelog for 7.5.0-alpha.4
storybook-bot Oct 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -555,27 +555,27 @@ workflows:
requires:
- unit-tests
- create-sandboxes:
parallelism: 21
parallelism: 20
requires:
- build
- build-sandboxes:
parallelism: 21
parallelism: 20
requires:
- create-sandboxes
- chromatic-sandboxes:
parallelism: 18
parallelism: 17
requires:
- build-sandboxes
- e2e-production:
parallelism: 18
parallelism: 17
requires:
- build-sandboxes
- e2e-dev:
parallelism: 4
requires:
- create-sandboxes
- test-runner-production:
parallelism: 18
parallelism: 17
requires:
- build-sandboxes
- bench:
Expand Down Expand Up @@ -609,30 +609,30 @@ workflows:
requires:
- build
- create-sandboxes:
parallelism: 34
parallelism: 33
requires:
- build
# - smoke-test-sandboxes: # disabled for now
# requires:
# - create-sandboxes
- build-sandboxes:
parallelism: 34
parallelism: 33
requires:
- create-sandboxes
- chromatic-sandboxes:
parallelism: 31
parallelism: 30
requires:
- build-sandboxes
- e2e-production:
parallelism: 31
parallelism: 30
requires:
- build-sandboxes
- e2e-dev:
parallelism: 4
requires:
- create-sandboxes
- test-runner-production:
parallelism: 31
parallelism: 30
requires:
- build-sandboxes
# TODO: reenable once we find out the source of flakyness
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-sandboxes-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: yarn wait-on http://localhost:6001
working-directory: ./code
- name: Generate
run: yarn generate-sandboxes --local-registry --exclude=angular-cli/prerelease
run: yarn generate-sandboxes --local-registry --exclude=angular-cli/prerelease --debug
working-directory: ./code
- name: Publish
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=next
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 7.4.5

- UI: Fix infinite hook call causing browsers to freeze - [#24291](https://github.com/storybookjs/storybook/pull/24291), thanks [@yannbf](https://github.com/yannbf)!

## 7.4.4

- Core: Fix Promise cycle bug in useSharedState - [#24268](https://github.com/storybookjs/storybook/pull/24268), thanks [@ndelangen](https://github.com/ndelangen)!
- Manager: Fix useAddonState when using a setter function - [#24237](https://github.com/storybookjs/storybook/pull/24237), thanks [@ndelangen](https://github.com/ndelangen)!

## 7.4.3

- CLI: Fix `sb add` adding duplicative entries - [#24229](https://github.com/storybookjs/storybook/pull/24229), thanks [@ndelangen](https://github.com/ndelangen)!
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 7.5.0-alpha.4

- CLI: Fix Nextjs project detection - [#24346](https://github.com/storybookjs/storybook/pull/24346), thanks [@yannbf](https://github.com/yannbf)!
- Core: Deprecate `storyStoreV6` (including `storiesOf`) and `storyIndexers` - [#23938](https://github.com/storybookjs/storybook/pull/23938), thanks [@JReinhold](https://github.com/JReinhold)!
- Core: Fix Promise cycle bug in useSharedState - [#24268](https://github.com/storybookjs/storybook/pull/24268), thanks [@ndelangen](https://github.com/ndelangen)!
- Core: Fix missing favicon during dev - [#24356](https://github.com/storybookjs/storybook/pull/24356), thanks [@ndelangen](https://github.com/ndelangen)!
- NextJS: Change babel plugins from `proposal-...` to `transform-...` - [#24290](https://github.com/storybookjs/storybook/pull/24290), thanks [@roottool](https://github.com/roottool)!
- Nextjs: Improve support for Windows-style paths - [#23695](https://github.com/storybookjs/storybook/pull/23695), thanks [@T99](https://github.com/T99)!
- UI: Fix infinite hook call causing browsers to freeze - [#24291](https://github.com/storybookjs/storybook/pull/24291), thanks [@yannbf](https://github.com/yannbf)!
- UI: Improve contrast ratio between focus / hover - [#24205](https://github.com/storybookjs/storybook/pull/24205), thanks [@chocoscoding](https://github.com/chocoscoding)!
- Vite: Move mdx-plugin from @storybook/builder-vite to @storybook/addon-docs - [#24166](https://github.com/storybookjs/storybook/pull/24166), thanks [@bryanjtc](https://github.com/bryanjtc)!

## 7.5.0-alpha.3

- Build: Filter some manager errors - [#24217](https://github.com/storybookjs/storybook/pull/24217), thanks [@yannbf](https://github.com/yannbf)!
Expand Down
90 changes: 80 additions & 10 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<h1>Migration</h1>

- [From version 7.4.0 to 7.5.0](#from-version-740-to-750)
- [`storyStoreV6` and `storiesOf` is deprecated](#storystorev6-and-storiesof-is-deprecated)
- [`storyIndexers` is replaced with `experimental_indexers`](#storyindexers-is-replaced-with-experimental_indexers)
- [From version 7.0.0 to 7.2.0](#from-version-700-to-720)
- [Addon API is more type-strict](#addon-api-is-more-type-strict)
- [Addon API is more type-strict](#addon-api-is-more-type-strict)
- [From version 6.5.x to 7.0.0](#from-version-65x-to-700)
- [7.0 breaking changes](#70-breaking-changes)
- [Dropped support for Node 15 and below](#dropped-support-for-node-15-and-below)
Expand All @@ -27,7 +30,7 @@
- [Deploying build artifacts](#deploying-build-artifacts)
- [Dropped support for file URLs](#dropped-support-for-file-urls)
- [Serving with nginx](#serving-with-nginx)
- [Ignore story files from node\_modules](#ignore-story-files-from-node_modules)
- [Ignore story files from node_modules](#ignore-story-files-from-node_modules)
- [7.0 Core changes](#70-core-changes)
- [7.0 feature flags removed](#70-feature-flags-removed)
- [Story context is prepared before for supporting fine grained updates](#story-context-is-prepared-before-for-supporting-fine-grained-updates)
Expand All @@ -39,7 +42,7 @@
- [Addon-interactions: Interactions debugger is now default](#addon-interactions-interactions-debugger-is-now-default)
- [7.0 Vite changes](#70-vite-changes)
- [Vite builder uses Vite config automatically](#vite-builder-uses-vite-config-automatically)
- [Vite cache moved to node\_modules/.cache/.vite-storybook](#vite-cache-moved-to-node_modulescachevite-storybook)
- [Vite cache moved to node_modules/.cache/.vite-storybook](#vite-cache-moved-to-node_modulescachevite-storybook)
- [7.0 Webpack changes](#70-webpack-changes)
- [Webpack4 support discontinued](#webpack4-support-discontinued)
- [Babel mode v7 exclusively](#babel-mode-v7-exclusively)
Expand Down Expand Up @@ -89,7 +92,7 @@
- [Dropped addon-docs manual babel configuration](#dropped-addon-docs-manual-babel-configuration)
- [Dropped addon-docs manual configuration](#dropped-addon-docs-manual-configuration)
- [Autoplay in docs](#autoplay-in-docs)
- [Removed STORYBOOK\_REACT\_CLASSES global](#removed-storybook_react_classes-global)
- [Removed STORYBOOK_REACT_CLASSES global](#removed-storybook_react_classes-global)
- [7.0 Deprecations and default changes](#70-deprecations-and-default-changes)
- [storyStoreV7 enabled by default](#storystorev7-enabled-by-default)
- [`Story` type deprecated](#story-type-deprecated)
Expand Down Expand Up @@ -302,6 +305,72 @@
- [Packages renaming](#packages-renaming)
- [Deprecated embedded addons](#deprecated-embedded-addons)

## From version 7.4.0 to 7.5.0

#### `storyStoreV6` and `storiesOf` is deprecated

`storyStoreV6` and `storiesOf` is deprecated and will be completely removed in Storybook 8.0.0.

If you're using `storiesOf` we recommend you migrate your stories to CSF3 for a better story writing experience.
In many cases you can get started with the migration by using two migration scripts:

```bash

# 1. convert storiesOf to CSF
npx storybook@latest migrate storiesof-to-csf --glob="**/*.stories.tsx" --parser=tsx

# 2. Convert CSF 2 to CSF 3
npx storybook@latest migrate csf-2-to-3 --glob="**/*.stories.tsx" --parser=tsx
```

They won't do a perfect migration so we recommend that you manually go through each file afterwards.

Alternatively you can build your own `storiesOf` implementation by leveraging the new (experimental) indexer API ([documentation](https://storybook.js.org/docs/react/api/main-config-indexers), [migration](#storyindexers-is-replaced-with-experimental_indexers)). A proof of concept of such an implementation can be seen in [this StackBlitz demo](https://stackblitz.com/edit/github-h2rgfk?file=README.md). See the demo's `README.md` for a deeper explanation of the implementation.

#### `storyIndexers` is replaced with `experimental_indexers`

Defining custom indexers for stories has become a more official - yet still experimental - API which is now configured at `experimental_indexers` instead of `storyIndexers` in `main.ts`. `storyIndexers` has been deprecated and will be fully removed in version 8.0.0.

The new experimental indexers are documented [here](https://storybook.js.org/docs/react/api/main-config-indexers). The most notable change from `storyIndexers` is that the indexer must now return a list of [`IndexInput`](https://github.com/storybookjs/storybook/blob/next/code/lib/types/src/modules/indexer.ts#L104-L148) instead of `CsfFile`. It's possible to construct an `IndexInput` from a `CsfFile` using the `CsfFile.indexInputs` getter.

That means you can convert an existing story indexer like this:

```diff
// .storybook/main.ts

import { readFileSync } from 'fs';
import { loadCsf } from '@storybook/csf-tools';

export default {
- storyIndexers = (indexers) => {
- const indexer = async (fileName, opts) => {
+ experimental_indexers = (indexers) => {
+ const createIndex = async (fileName, opts) => {
const code = readFileSync(fileName, { encoding: 'utf-8' });
const makeTitle = (userTitle) => {
// Do something with the auto title retrieved by Storybook
return userTitle;
};

// Parse the CSF file with makeTitle as a custom context
- return loadCsf(code, { ...compilationOptions, makeTitle, fileName }).parse();
+ return loadCsf(code, { ...compilationOptions, makeTitle, fileName }).parse().indexInputs;
};

return [
{
test: /(stories|story)\.[tj]sx?$/,
- indexer,
+ createIndex,
},
...(indexers || []),
];
},
};
```

As an addon author you can support previous versions of Storybook by setting both `storyIndexers` and `indexers_experimental`, without triggering the deprecation warning.

## From version 7.0.0 to 7.2.0

#### Addon API is more type-strict
Expand All @@ -311,14 +380,15 @@ When registering an addon using `@storybook/manager-api`, the addon API is now m
The `type` property is now a required field, and the `id` property should not be set anymore.

Here's a correct example:

```tsx
import { addons, types } from '@storybook/manager-api';

addons.register('my-addon', () => {
addons.add('my-addon/panel', {
type: types.PANEL,
title: 'My Addon',
render: ({ active }) => active ? <div>Hello World</div> : null,
render: ({ active }) => (active ? <div>Hello World</div> : null),
});
});
```
Expand Down Expand Up @@ -869,16 +939,16 @@ Given the following `main.js`:

```js
export default {
stories: ['../**/*.stories.*']
}
stories: ['../**/*.stories.*'],
};
```

If you want to restore the previous behavior to include `node_modules`, you can update it to:

```js
export default {
stories: ['../**/*.stories.*', '../**/node_modules/**/*.stories.*']
}
stories: ['../**/*.stories.*', '../**/node_modules/**/*.stories.*'],
};
```

The first glob would have node_modules automatically excluded by Storybook, and the second glob would include all stories that are under a nested `node_modules` directory.
Expand Down Expand Up @@ -1046,7 +1116,7 @@ Starting in 7.0, we drop support for Angular < 14

_Has automigration_

In Storybook 6.4 we deprecated calling Storybook directly (e.g. `npm run storybook`) for Angular. In Storybook 7.0, we've removed it entirely. Instead, you have to set up the Storybook builder in your `angular.json` and execute `ng run <your-project>:storybook` to start Storybook.
In Storybook 6.4 we deprecated calling Storybook directly (e.g. `npm run storybook`) for Angular. In Storybook 7.0, we've removed it entirely. Instead, you have to set up the Storybook builder in your `angular.json` and execute `ng run <your-project>:storybook` to start Storybook.

You can run `npx storybook@next automigrate` to automatically fix your configuration, or visit https://github.com/storybookjs/storybook/tree/next/code/frameworks/angular/README.md#how-do-i-migrate-to-an-angular-storybook-builder for instructions on how to set up Storybook for Angular manually.

Expand Down
4 changes: 3 additions & 1 deletion code/addons/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@rollup/pluginutils": "^5.0.2",
"react": "^16.14.0",
"react-dom": "^16.8.0",
"typescript": "~4.9.3"
"typescript": "~4.9.3",
"vite": "^4.0.4"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Options } from '@storybook/types';
import type { Plugin } from 'vite';
import remarkSlug from 'remark-slug';
import remarkExternalLinks from 'remark-external-links';
import { createFilter } from 'vite';
import { createFilter } from '@rollup/pluginutils';
import { dirname, join } from 'path';

const isStorybookMdx = (id: string) => id.endsWith('stories.mdx') || id.endsWith('story.mdx');
Expand Down
9 changes: 9 additions & 0 deletions code/addons/docs/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ export const addons: StorybookConfig['addons'] = [
require.resolve('@storybook/react-dom-shim/dist/preset'),
];

export const viteFinal = async (config: any, options: Options) => {
const { plugins = [] } = config;
const { mdxPlugin } = await import('./plugins/mdx-plugin');

plugins.push(mdxPlugin(options));

return config;
};

/*
* This is a workaround for https://github.com/Swatinem/rollup-plugin-dts/issues/162
* something down the dependency chain is using typescript namespaces, which are not supported by rollup-plugin-dts
Expand Down
6 changes: 0 additions & 6 deletions code/builders/builder-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"@storybook/client-logger": "workspace:*",
"@storybook/core-common": "workspace:*",
"@storybook/csf-plugin": "workspace:*",
"@storybook/mdx2-csf": "^1.0.0",
"@storybook/node-logger": "workspace:*",
"@storybook/preview": "workspace:*",
"@storybook/preview-api": "workspace:*",
Expand All @@ -59,8 +58,6 @@
"find-cache-dir": "^3.0.0",
"fs-extra": "^11.1.0",
"magic-string": "^0.30.0",
"remark-external-links": "^8.0.0",
"remark-slug": "^6.0.0",
"rollup": "^2.25.0 || ^3.3.0"
},
"devDependencies": {
Expand Down Expand Up @@ -96,9 +93,6 @@
"entries": [
"./src/index.ts"
],
"externals": [
"@storybook/mdx1-csf"
],
"platform": "node"
},
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17"
Expand Down
1 change: 0 additions & 1 deletion code/builders/builder-vite/src/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './inject-export-order-plugin';
export * from './mdx-plugin';
export * from './strip-story-hmr-boundaries';
export * from './code-generator-plugin';
export * from './csf-plugin';
Expand Down
2 changes: 0 additions & 2 deletions code/builders/builder-vite/src/vite-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
codeGeneratorPlugin,
csfPlugin,
injectExportOrderPlugin,
mdxPlugin,
stripStoryHMRBoundary,
externalGlobalsPlugin,
} from './plugins';
Expand Down Expand Up @@ -81,7 +80,6 @@ export async function pluginConfig(options: Options) {
const plugins = [
codeGeneratorPlugin(options),
await csfPlugin(options),
await mdxPlugin(options),
injectExportOrderPlugin,
stripStoryHMRBoundary(),
{
Expand Down
8 changes: 4 additions & 4 deletions code/frameworks/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@
},
"dependencies": {
"@babel/core": "^7.22.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@babel/plugin-proposal-numeric-separator": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-syntax-bigint": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-assertions": "^7.22.5",
"@babel/plugin-transform-class-properties": "^7.22.5",
"@babel/plugin-transform-export-namespace-from": "^7.22.11",
"@babel/plugin-transform-numeric-separator": "^7.22.11",
"@babel/plugin-transform-object-rest-spread": "^7.22.15",
"@babel/plugin-transform-runtime": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@babel/preset-react": "^7.22.5",
Expand Down
8 changes: 4 additions & 4 deletions code/frameworks/nextjs/src/babel/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ export default (api: any, options: NextBabelPresetOptions = {}): BabelPreset =>
require('@babel/plugin-syntax-dynamic-import'),
require('@babel/plugin-syntax-import-assertions'),
require('./plugins/react-loadable-plugin'),
[require('@babel/plugin-proposal-class-properties'), options['class-properties'] || {}],
[require('@babel/plugin-transform-class-properties'), options['class-properties'] || {}],
[
require('@babel/plugin-proposal-object-rest-spread'),
require('@babel/plugin-transform-object-rest-spread'),
{
useBuiltIns: true,
},
Expand Down Expand Up @@ -172,8 +172,8 @@ export default (api: any, options: NextBabelPresetOptions = {}): BabelPreset =>
isServer && require('@babel/plugin-syntax-bigint'),
// Always compile numeric separator because the resulting number is
// smaller.
require('@babel/plugin-proposal-numeric-separator'),
require('@babel/plugin-proposal-export-namespace-from'),
require('@babel/plugin-transform-numeric-separator'),
require('@babel/plugin-transform-export-namespace-from'),
].filter(Boolean),
};
};
Loading