diff --git a/code/.storybook/bench.stories.tsx b/code/.storybook/bench.stories.tsx deleted file mode 100644 index 83f999fad215..000000000000 --- a/code/.storybook/bench.stories.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import React from 'react'; - -import type { Meta } from '@storybook/react-vite'; - -import { safeMetafileArg } from '../../scripts/bench/safe-args'; - -// @ts-expect-error - TS doesn't know about import.meta.glob from Vite -const allMetafiles = import.meta.glob(['../bench/esbuild-metafiles/**/*.json']); - -export default { - title: 'Bench', - parameters: { - layout: 'fullscreen', - chromatic: { disableSnapshot: true }, - }, - args: { - metafile: safeMetafileArg(Object.keys(allMetafiles)[0]), - }, - argTypes: { - metafile: { - options: Object.keys(allMetafiles).map(safeMetafileArg).sort(), - mapping: Object.fromEntries( - Object.keys(allMetafiles).map((path) => [safeMetafileArg(path), path]) - ), - control: { - type: 'select', - labels: Object.fromEntries( - Object.keys(allMetafiles).map((path) => { - const [, dirName, subEntry] = /esbuild-metafiles\/(.+)\/(.+).json/.exec(path)!; - return [safeMetafileArg(path), `${dirName} - ${subEntry}`]; - }) - ), - }, - }, - }, - loaders: [ - async ({ args }) => { - if (!args.metafile) { - return; - } - let metafile; - try { - metafile = await allMetafiles[args.metafile](); - } catch (e) { - return; - } - const encodedMetafile = btoa(JSON.stringify(metafile)); - return { encodedMetafile }; - }, - ], - render: (args, { loaded }) => { - const { encodedMetafile = '' } = loaded ?? {}; - - if (encodedMetafile.length > 2020836) { - return ( -
-

Metafile is too large

-

- The metafile {args.metafile} is too large to be displayed - in the iframe. This is because we base64-encode the contents of the metafile into the - URL of the {'