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 8.4.0-alpha.1 #29118

Merged
merged 100 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
64fbe39
NextJS: fix sass-loader version for compatibility with nodejs > 20
Sep 3, 2024
aff3580
Replace .at() call with [] in Vite Builder codegen
Chudesnov Sep 4, 2024
6f19cac
Fix Angular sourceDecorator to apply excludeDecorators flag
JSMike Sep 7, 2024
5faae40
Merge branch 'next' into next
HoncharenkoZhenya Sep 10, 2024
19a68df
Merge branch 'next' into jsmike/angular-sourceDecorator
valentinpalkovic Sep 10, 2024
b9e35a1
Merge branch 'next' into next
HoncharenkoZhenya Sep 11, 2024
98e6608
Merge branch 'next' into next
HoncharenkoZhenya Sep 11, 2024
651674a
api.md typo
kazuyainoue0124 Sep 11, 2024
3da4372
Merge branch 'next' into next
HoncharenkoZhenya Sep 12, 2024
4af51ac
Use ansi-to-html for colored test errors
kasperpeulen Sep 12, 2024
e693dcd
Fix check
kasperpeulen Sep 13, 2024
1d27f37
Merge pull request #29110 from storybookjs/kasper/fix-ansi-chars
kasperpeulen Sep 13, 2024
dac2cc3
Merge branch 'next' into next
HoncharenkoZhenya Sep 13, 2024
3d4f7ec
Ensure `.gitignore` updated via CLI ends with a newline
3w36zj6 Sep 13, 2024
247efff
Remove `fs-extra` from `presets/server`
Sep 13, 2024
2ac99b3
Remove `fs-extra` from `presets/react-webpack`
Sep 13, 2024
ce73ddb
Remove `fs-extra` from `lib/create-storybook`
Sep 14, 2024
5ed3ab4
Remove `fs-extra` from `lib/cli-storybook`
Sep 14, 2024
2e89262
Remove `fs-extra` from `frameworks/nextjs`
Sep 14, 2024
b080e71
Remove `fs-extra` from `builders/builder-webpack5`
Sep 14, 2024
b9c600a
Remove `fs-extra` from `builders/builder-vite`
Sep 14, 2024
67dbe11
Remove `fs-extra` from `addons/docs`
Sep 14, 2024
cf80eaa
Remove rogue import in `builders/builder-vite`
Sep 14, 2024
ef33853
Merge 'upstream/next' into 'remove-fs-extra'
Sep 14, 2024
353dfb1
Remove rogue comment
Sep 14, 2024
08c6eef
Remove `fs-extra` from `presets/server-webpack`
Sep 14, 2024
a09abbc
Remove `fs-extra` from `renderers/svelte`
Sep 14, 2024
93b866b
Remove `fs-extra` from `addons/links`
Sep 14, 2024
7c14a13
core: Remove `fs-extra` from `src/telemetry`
Sep 14, 2024
7816541
core: Remove `fs-extra` from `src/common/utils`
Sep 14, 2024
fb2455b
core: Remove `fs-extra` from `src/core-server/utils`
Sep 14, 2024
2dcc7b7
Add `recursive: true` to `cp` calls
Sep 14, 2024
ca39982
core: Remove `fs-extra` from `src/core-server`
Sep 14, 2024
a42ff7e
Close the file descriptor
Sep 14, 2024
174868a
core: Remove `fs-extra` from `src/builder-manager`
Sep 14, 2024
643acbf
core: Remove `fs-extra` from `scripts`
Sep 14, 2024
89cdff3
Remove `fs-extra` from `code`
Sep 14, 2024
0d10b95
Replace 'utf-8' with 'utf8' for consistency with Node docs
Sep 15, 2024
5a97b8f
Merge branch 'next' into patch-1
Chudesnov Sep 15, 2024
8c58016
CLI: Fix skip-install for stable latest releases
valentinpalkovic Sep 16, 2024
a3d75f5
Core: Do not prebundle jsdoc-type-pratt-parser
valentinpalkovic Sep 16, 2024
6019553
Merge pull request #29040 from HoncharenkoZhenya/next
valentinpalkovic Sep 16, 2024
b0d55ed
Merge pull request #29069 from JSMike/jsmike/angular-sourceDecorator
valentinpalkovic Sep 16, 2024
b40b44f
Core: Do not prebundle better-opn
valentinpalkovic Sep 16, 2024
629e70d
Merge pull request #29134 from storybookjs/valentin/do-not-prebundle-…
shilman Sep 16, 2024
8e9d63b
Merge pull request #29137 from storybookjs/valentin/do-not-prebundle-…
shilman Sep 16, 2024
f5b1525
Merge branch 'next' into remove-fs-extra
JReinhold Sep 16, 2024
8346b85
Remove the TODOs regarding `fsPromises.cp`
Sep 16, 2024
12f8029
Preact: Fix E2E test
valentinpalkovic Sep 16, 2024
f6e33b1
Merge pull request #29139 from storybookjs/valentin/fix-e2e-test-for-…
valentinpalkovic Sep 16, 2024
f0593f9
Rewrite how `ensureFile` is replaced
Sep 16, 2024
ea609bf
Remove `fs-extra` `from lib/cli/scripts`
Sep 16, 2024
b034203
Fix the `emptyDir` + `ensureDir` replacement
Sep 16, 2024
7262c52
Update CHANGELOG.md for v8.3.1 [skip ci]
storybook-bot Sep 16, 2024
8ac3e53
Merge branch 'next' into remove-fs-extra
JReinhold Sep 16, 2024
8115974
remove @types/fs-extra
JReinhold Sep 17, 2024
4ebba9a
Build Storybook on CI (skip install case)
valentinpalkovic Sep 17, 2024
20c0b10
Merge remote-tracking branch 'origin/next' into valentin/fix-skip-ins…
valentinpalkovic Sep 17, 2024
ea27938
Merge pull request #29126 from ziebam/remove-fs-extra
JReinhold Sep 17, 2024
57cdf15
Merge pull request #29133 from storybookjs/valentin/fix-skip-install-…
valentinpalkovic Sep 17, 2024
2d2943b
feat[vitest-plugin]: support read story name for vitest test description
InfiniteXyy Sep 18, 2024
5ac38c3
chore: update vitest document
InfiniteXyy Sep 18, 2024
a70830b
chore: remove iife
InfiniteXyy Sep 18, 2024
3f856d9
Merge branch 'next' into patch-1
Chudesnov Sep 18, 2024
0d238e2
Core: Do not add packageManager field to package.json during storyboo…
valentinpalkovic Sep 19, 2024
57ee6e1
Merge pull request #29152 from storybookjs/valentin/fix-package-manag…
valentinpalkovic Sep 19, 2024
221f6a7
Update CHANGELOG.md for v8.3.2 [skip ci]
storybook-bot Sep 19, 2024
26c2865
Merge branch 'next' into next
InfiniteXyy Sep 20, 2024
3bae5cf
Chore: Add jiti as dev dependency to core
tobiasdiez Sep 20, 2024
995c912
Merge branch 'next' into patch-1
Chudesnov Sep 20, 2024
b11edcf
Update TooltipLinkList.tsx to add href to item object for onclick events
JSMike Sep 21, 2024
1882717
chore: refactor with parsedStory
InfiniteXyy Sep 21, 2024
d43564e
Vite: Add jsdoc-type-pratt-parser to `optimizeDeps`
tobiasdiez Sep 22, 2024
d02d6b4
feat: Add InitialViewportKeyUnion type
hyeongrok7874 Sep 22, 2024
d2a98f1
update tests
yannbf Sep 23, 2024
d5ba8e5
React-Vite: Downgrade react-docgen-typescript plugin
shilman Sep 23, 2024
b23e84a
Merge pull request #29184 from storybookjs/shilman/28269-downgrade-ty…
kasperpeulen Sep 23, 2024
387f10e
Merge branch 'next' into patch-1
kasperpeulen Sep 23, 2024
470ad3c
Merge branch 'storybookjs:next' into next
InfiniteXyy Sep 23, 2024
9414c0d
Merge branch 'next' into patch-1
jonniebigodes Sep 23, 2024
48980f6
Merge pull request #29102 from kazuyainoue0124/patch-1
jonniebigodes Sep 23, 2024
f665c36
update faq
yannbf Sep 23, 2024
8de3b0e
Merge branch 'next' of github.com:InfiniteXyy/storybook into Infinite…
yannbf Sep 23, 2024
0811ca8
Merge pull request #29147 from InfiniteXyy/next
yannbf Sep 23, 2024
72a6f7d
Merge branch 'next' into patch-1
Chudesnov Sep 23, 2024
af8d757
#23619 Show constraints in error when getting depndencies
andrasczeh Sep 23, 2024
dd170eb
Fix types
kasperpeulen Sep 24, 2024
91c2e9d
Merge branch 'next' into patch-1
kasperpeulen Sep 24, 2024
538de42
Update code/addons/viewport/src/defaults.ts
kasperpeulen Sep 24, 2024
b7cfbe5
Merge branch 'next' into viewport-addon
kasperpeulen Sep 24, 2024
60e266a
Merge pull request #29173 from tobiasdiez/core-jiti
kasperpeulen Sep 24, 2024
9a059d9
Merge branch 'next' into feature/ensure-gitignore-updated-via-cli-end…
kasperpeulen Sep 24, 2024
d80402d
Merge branch 'next' into patch-1
kasperpeulen Sep 24, 2024
71a3eb4
Merge pull request #29187 from andrasczeh/patch-1
kasperpeulen Sep 24, 2024
caa4ff3
Merge pull request #29179 from tobiasdiez/optimize-dep
kasperpeulen Sep 24, 2024
1a50094
Merge pull request #29175 from JSMike/patch-1
kasperpeulen Sep 24, 2024
58cca8d
Merge pull request #29182 from hyeongrok7874/viewport-addon
kasperpeulen Sep 24, 2024
8333cde
Merge pull request #29124 from 3w36zj6/feature/ensure-gitignore-updat…
kasperpeulen Sep 24, 2024
f655698
Merge pull request #29048 from Chudesnov/patch-1
kasperpeulen Sep 24, 2024
02598e5
Write changelog for 8.4.0-alpha.1 [skip ci]
storybook-bot Sep 24, 2024
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
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,8 @@ jobs:
mkdir empty-<< parameters.template >>-no-install
cd empty-<< parameters.template >>-no-install
npx storybook init --yes --skip-install
npm install
npm run build-storybook
environment:
IN_STORYBOOK_SANDBOX: true
STORYBOOK_INIT_EMPTY_TYPE: << parameters.template >>
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 8.3.2

- CLI: Fix skip-install for stable latest releases - [#29133](https://github.com/storybookjs/storybook/pull/29133), thanks @valentinpalkovic!
- Core: Do not add packageManager field to package.json during `storybook dev` - [#29152](https://github.com/storybookjs/storybook/pull/29152), thanks @valentinpalkovic!

## 8.3.1

- Angular: Fix sourceDecorator to apply excludeDecorators flag - [#29069](https://github.com/storybookjs/storybook/pull/29069), thanks @JSMike!
- Core: Do not prebundle better-opn - [#29137](https://github.com/storybookjs/storybook/pull/29137), thanks @valentinpalkovic!
- Core: Do not prebundle jsdoc-type-pratt-parser - [#29134](https://github.com/storybookjs/storybook/pull/29134), thanks @valentinpalkovic!
- Next.js: Upgrade sass-loader from ^12 to ^13 - [#29040](https://github.com/storybookjs/storybook/pull/29040), thanks @HoncharenkoZhenya!

## 8.3.0

Fresh out of the oven! Storybook 8.3 brings you:
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## 8.4.0-alpha.1

- Addon Test: Support story name as test description - [#29147](https://github.com/storybookjs/storybook/pull/29147), thanks @InfiniteXyy!
- Addon-Interactions: Use ansi-to-html for colored test errors - [#29110](https://github.com/storybookjs/storybook/pull/29110), thanks @kasperpeulen!
- Angular: Fix sourceDecorator to apply excludeDecorators flag - [#29069](https://github.com/storybookjs/storybook/pull/29069), thanks @JSMike!
- Builder-vite: Replace .at() call with [] in codegen - [#29048](https://github.com/storybookjs/storybook/pull/29048), thanks @Chudesnov!
- CLI: Ensure `.gitignore` updated via CLI ends with a newline - [#29124](https://github.com/storybookjs/storybook/pull/29124), thanks @3w36zj6!
- CLI: Fix skip-install for stable latest releases - [#29133](https://github.com/storybookjs/storybook/pull/29133), thanks @valentinpalkovic!
- CLI: Show constraints in error when getting depndencies - [#29187](https://github.com/storybookjs/storybook/pull/29187), thanks @andrasczeh!
- Core: Do not add packageManager field to package.json during `storybook dev` - [#29152](https://github.com/storybookjs/storybook/pull/29152), thanks @valentinpalkovic!
- Core: Do not prebundle better-opn - [#29137](https://github.com/storybookjs/storybook/pull/29137), thanks @valentinpalkovic!
- Core: Do not prebundle jsdoc-type-pratt-parser - [#29134](https://github.com/storybookjs/storybook/pull/29134), thanks @valentinpalkovic!
- Core: Replace `fs-extra` with the native APIs - [#29126](https://github.com/storybookjs/storybook/pull/29126), thanks @ziebam!
- Next.js: Upgrade sass-loader from ^12 to ^13 - [#29040](https://github.com/storybookjs/storybook/pull/29040), thanks @HoncharenkoZhenya!
- React-Vite: Downgrade react-docgen-typescript plugin - [#29184](https://github.com/storybookjs/storybook/pull/29184), thanks @shilman!
- UI: Fix composed storybook TooltipLinkList bug where href isn't passed forward - [#29175](https://github.com/storybookjs/storybook/pull/29175), thanks @JSMike!
- Viewport-addon: Add InitialViewportKeys type to viewport addon - [#29182](https://github.com/storybookjs/storybook/pull/29182), thanks @hyeongrok7874!
- Vite: Add jsdoc-type-pratt-parser to `optimizeDeps` - [#29179](https://github.com/storybookjs/storybook/pull/29179), thanks @tobiasdiez!

## 8.4.0-alpha.0


Expand Down
29 changes: 0 additions & 29 deletions code/__mocks__/fs.js

This file was deleted.

32 changes: 32 additions & 0 deletions code/__mocks__/fs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { vi } from 'vitest';

// This is a custom function that our tests can use during setup to specify
// what the files on the "mock" filesystem should look like when any of the
// `fs` APIs are used.
let mockFiles = Object.create(null);

// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/naming-convention
export function __setMockFiles(newMockFiles: Record<string, string | null>) {
mockFiles = newMockFiles;
}

export const readFileSync = (filePath = '') => mockFiles[filePath];
export const existsSync = (filePath: string) => !!mockFiles[filePath];
export const lstatSync = (filePath: string) => ({
isFile: () => !!mockFiles[filePath],
});
export const realpathSync = vi.fn();
export const readdir = vi.fn();
export const readdirSync = vi.fn();
export const readlinkSync = vi.fn();

export default {
__setMockFiles,
readFileSync,
existsSync,
lstatSync,
realpathSync,
readdir,
readdirSync,
readlinkSync,
};
32 changes: 32 additions & 0 deletions code/__mocks__/fs/promises.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { vi } from 'vitest';

// This is a custom function that our tests can use during setup to specify
// what the files on the "mock" filesystem should look like when any of the
// `fs` APIs are used.
let mockFiles = Object.create(null);

// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/naming-convention
export function __setMockFiles(newMockFiles: Record<string, string | null>) {
mockFiles = newMockFiles;
}

export const writeFile = vi.fn(async (filePath: string, content: string) => {
mockFiles[filePath] = content;
});
export const readFile = vi.fn(async (filePath: string) => mockFiles[filePath]);
export const lstat = vi.fn(async (filePath: string) => ({
isFile: () => !!mockFiles[filePath],
}));
export const readdir = vi.fn();
export const readlink = vi.fn();
export const realpath = vi.fn();

export default {
__setMockFiles,
writeFile,
readFile,
lstat,
readdir,
readlink,
realpath,
};
1 change: 0 additions & 1 deletion code/addons/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
"@storybook/global": "^5.0.0",
"@storybook/react-dom-shim": "workspace:*",
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"fs-extra": "^11.1.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"rehype-external-links": "^3.0.0",
Expand Down
1 change: 1 addition & 0 deletions code/addons/interactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@devtools-ds/object-inspector": "^1.1.2",
"@storybook/icons": "^1.2.5",
"@types/node": "^22.0.0",
"ansi-to-html": "^0.7.2",
"formik": "^2.2.9",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
5 changes: 3 additions & 2 deletions code/addons/interactions/src/components/Interaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { type Call, CallStates, type ControlStates } from '@storybook/instrument

import { transparentize } from 'polished';

import { isChaiError, isJestError } from '../utils';
import { isChaiError, isJestError, useAnsiToHtmlFilter } from '../utils';
import type { Controls } from './InteractionsPanel';
import { MatcherResult } from './MatcherResult';
import { MethodCall } from './MethodCall';
Expand Down Expand Up @@ -116,6 +116,7 @@ const RowMessage = styled('div')(({ theme }) => ({
}));

export const Exception = ({ exception }: { exception: Call['exception'] }) => {
const filter = useAnsiToHtmlFilter();
if (isJestError(exception)) {
return <MatcherResult {...exception} />;
}
Expand All @@ -135,7 +136,7 @@ export const Exception = ({ exception }: { exception: Call['exception'] }) => {
const more = paragraphs.length > 1;
return (
<RowMessage>
<pre>{paragraphs[0]}</pre>
<pre dangerouslySetInnerHTML={{ __html: filter.toHtml(paragraphs[0]) }}></pre>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Use of dangerouslySetInnerHTML could pose a security risk if the input is not properly sanitized

{more && <p>See the full stack trace in the browser console.</p>}
</RowMessage>
);
Expand Down
12 changes: 8 additions & 4 deletions code/addons/interactions/src/components/InteractionsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { type Call, CallStates, type ControlStates } from '@storybook/instrument

import { transparentize } from 'polished';

import { isTestAssertionError } from '../utils';
import { isTestAssertionError, useAnsiToHtmlFilter } from '../utils';
import { Empty } from './EmptyState';
import { Interaction } from './Interaction';
import { Subnav } from './Subnav';
Expand Down Expand Up @@ -97,6 +97,7 @@ export const InteractionsPanel: React.FC<InteractionsPanelProps> = React.memo(
onScrollToEnd,
endRef,
}) {
const filter = useAnsiToHtmlFilter();
return (
<Container>
{(interactions.length > 0 || hasException) && (
Expand Down Expand Up @@ -131,9 +132,12 @@ export const InteractionsPanel: React.FC<InteractionsPanelProps> = React.memo(
<CaughtExceptionTitle>
Caught exception in <CaughtExceptionCode>play</CaughtExceptionCode> function
</CaughtExceptionTitle>
<CaughtExceptionStack data-chromatic="ignore">
{printSerializedError(caughtException)}
</CaughtExceptionStack>
<CaughtExceptionStack
data-chromatic="ignore"
dangerouslySetInnerHTML={{
__html: filter.toHtml(printSerializedError(caughtException)),
}}
Comment on lines +137 to +139
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Use of dangerouslySetInnerHTML might pose security risks if the input is not properly sanitized

></CaughtExceptionStack>
</CaughtException>
)}
{unhandledErrors && (
Expand Down
10 changes: 9 additions & 1 deletion code/addons/interactions/src/components/MatcherResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';

import { styled, typography } from 'storybook/internal/theming';

import { useAnsiToHtmlFilter } from '../utils';
import { Node } from './MethodCall';

const getParams = (line: string, fromIndex = 0): string => {
Expand Down Expand Up @@ -59,6 +60,7 @@ export const MatcherResult = ({
message: string;
style?: React.CSSProperties;
}) => {
const filter = useAnsiToHtmlFilter();
const lines = message.split('\n');
return (
<pre
Expand Down Expand Up @@ -131,7 +133,13 @@ export const MatcherResult = ({
];
}

return [<span key={line + index}>{line}</span>, <br key={`br${index}`} />];
return [
<span
key={line + index}
dangerouslySetInnerHTML={{ __html: filter.toHtml(line) }}
></span>,
Comment on lines +137 to +140
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Using dangerouslySetInnerHTML can be a security risk if the input is not properly sanitized. Ensure that the filter.toHtml() method properly escapes any potentially malicious content.

<br key={`br${index}`} />,
];
})}
</pre>
);
Expand Down
16 changes: 16 additions & 0 deletions code/addons/interactions/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { type StorybookTheme, useTheme } from 'storybook/internal/theming';

import Filter from 'ansi-to-html';

export function isTestAssertionError(error: unknown) {
return isChaiError(error) || isJestError(error);
}
Expand All @@ -21,3 +25,15 @@ export function isJestError(error: unknown) {
error.message.startsWith('expect(')
);
}

export function createAnsiToHtmlFilter(theme: StorybookTheme) {
return new Filter({
fg: theme.color.defaultText,
bg: theme.background.content,
});
}

export function useAnsiToHtmlFilter() {
const theme = useTheme();
return createAnsiToHtmlFilter(theme);
}
1 change: 0 additions & 1 deletion code/addons/links/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"fs-extra": "^11.1.0",
"typescript": "^5.3.2"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion code/addons/links/scripts/fix-preview-api-reference.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFile, writeFile } from 'fs-extra';
import { readFile, writeFile } from 'node:fs/promises';

/* I wish this wasn't needed..
* There seems to be some bug in tsup / the unlaying lib that does DTS bundling
Expand Down
2 changes: 1 addition & 1 deletion code/addons/themes/docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const myCustomDecorator = ({ themes, defaultState, ...rest }) => {
Let's use Vuetify as an example. Vuetify uses it's own global state to know which theme to render. To build a custom decorator to accommodate this method we'll need to do the following

```js
// .storybook/withVeutifyTheme.decorator.js
// .storybook/withVuetifyTheme.decorator.js
import { DecoratorHelpers } from '@storybook/addon-themes';
import { useTheme } from 'vuetify';

Expand Down
9 changes: 7 additions & 2 deletions code/addons/viewport/src/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ViewportMap } from './types';

export const INITIAL_VIEWPORTS: ViewportMap = {
const INITIAL_VIEWPORTS_DATA = {
iphone5: {
name: 'iPhone 5',
styles: {
Expand Down Expand Up @@ -225,7 +225,12 @@ export const INITIAL_VIEWPORTS: ViewportMap = {
},
type: 'mobile',
},
};
} as const;

export type InitialViewportKeys = keyof typeof INITIAL_VIEWPORTS_DATA;

export const INITIAL_VIEWPORTS: ViewportMap = INITIAL_VIEWPORTS_DATA;

export const DEFAULT_VIEWPORT = 'responsive';

export const MINIMAL_VIEWPORTS: ViewportMap = {
Expand Down
1 change: 0 additions & 1 deletion code/builders/builder-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"es-module-lexer": "^1.5.0",
"express": "^4.19.2",
"find-cache-dir": "^3.0.0",
"fs-extra": "^11.1.0",
"magic-string": "^0.30.0",
"ts-dedent": "^2.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function generateModernIframeScriptCode(options: Options, projectRo
.map(
(previewAnnotation, index) =>
// Prefer the updated module from an HMR update, otherwise import the original module
`hmrPreviewAnnotationModules.at(${index}) ?? import('${previewAnnotation}')`
`hmrPreviewAnnotationModules[${index}] ?? import('${previewAnnotation}')`
)
.join(',\n')}])
return composeConfigs(configs);
Expand Down
12 changes: 6 additions & 6 deletions code/builders/builder-vite/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// noinspection JSUnusedGlobalSymbols
import { cp, readFile } from 'node:fs/promises';
import { join, parse } from 'node:path';

import { NoStatsForViteDevError } from 'storybook/internal/server-errors';
import type { Options } from 'storybook/internal/types';

import type { RequestHandler } from 'express';
import express from 'express';
import * as fs from 'fs-extra';
import { corePath } from 'storybook/core-path';
import type { ViteDevServer } from 'vite';

Expand Down Expand Up @@ -34,10 +34,9 @@ function iframeMiddleware(options: Options, server: ViteDevServer): RequestHandl
return;
}

const indexHtml = await fs.readFile(
require.resolve('@storybook/builder-vite/input/iframe.html'),
'utf-8'
);
const indexHtml = await readFile(require.resolve('@storybook/builder-vite/input/iframe.html'), {
encoding: 'utf8',
});
const generated = await transformIframeHtml(indexHtml, options);
const transformed = await server.transformIndexHtml('/iframe.html', generated);
res.setHeader('Content-Type', 'text/html');
Expand Down Expand Up @@ -85,14 +84,15 @@ export const build: ViteBuilder['build'] = async ({ options }) => {
const previewDirOrigin = previewResolvedDir;
const previewDirTarget = join(options.outputDir || '', `sb-preview`);

const previewFiles = fs.copy(previewDirOrigin, previewDirTarget, {
const previewFiles = cp(previewDirOrigin, previewDirTarget, {
filter: (src) => {
const { ext } = parse(src);
if (ext) {
return ext === '.js';
}
return true;
},
recursive: true,
});

const [out] = await Promise.all([viteCompilation, previewFiles]);
Expand Down
1 change: 1 addition & 0 deletions code/builders/builder-vite/src/optimizeDeps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const INCLUDE_CANDIDATES = [
'fast-deep-equal',
'html-tags',
'isobject',
'jsdoc-type-pratt-parser', // TODO: Remove this once it's converted to ESM: https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/173
'loader-utils',
'lodash/camelCase.js',
'lodash/camelCase',
Expand Down
Loading
Loading