storybookjs / builder-vite

A builder plugin to run and build Storybooks with Vite
MIT License
891 stars 107 forks source link

Allow the use of @vitejs/plugin-react-swc #552

Closed IanVS closed 1 year ago

IanVS commented 1 year ago

Fixes https://github.com/storybookjs/builder-vite/issues/551

This will first look for @vitejs/plugin-react, then @vitejs/plugin-react-swc. It seems like the SWC version might not work with MDX stories, though. I updated the react-18 example to use it, and the intro story doesn't load. I don't think that should necessarily block this PR though.

socket-security[bot] commented 1 year ago

Socket Security Pull Request Report

Dependency issues detected. If you merge this pull request, you will not be alerted to the instances of these issues again.

📜 Install scripts

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

Package Script field Source
@swc/core@1.3.32 (added) postinstall examples/react-18/package.json via @vitejs/plugin-react-swc@3.1.0, packages/builder-vite/package.json via @vitejs/plugin-react-swc@3.1.0
⚠️ Uses eval

Package uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.

Avoid packages that use eval, since this could potentially execute any code.

Package Eval Type Location Source
rollup@3.14.0 (upgraded) Function dist/shared/loadConfigFile.js examples/lit-ts/package.json via @storybook/builder-vite@0.4.0, vite@4.0.4, examples/preact/package.json via @preact/preset-vite@2.5.0, @storybook/builder-vite@0.4.0, vite@4.0.4, examples/react/package.json via @storybook/builder-vite@0.4.0, vite@4.0.4, examples/react-18/package.json via @storybook/builder-vite@0.4.0, @vitejs/plugin-react-swc@3.1.0, vite@4.0.4, examples/react-ts/package.json via @storybook/builder-vite@0.4.0, @vitejs/plugin-react@3.1.0, vite@4.0.4, examples/svelte/package.json via @storybook/builder-vite@0.4.0, vite@4.0.4, examples/vue2.6/package.json via @storybook/builder-vite@0.4.0, examples/vue2.7/package.json via @storybook/builder-vite@0.4.0, examples/vue3/package.json via @storybook/builder-vite@0.4.0, vite@4.0.4, examples/workspaces/packages/catalog/package.json via @storybook/builder-vite@0.4.0, @vitejs/plugin-react@3.1.0, vite@4.0.4, packages/builder-vite/package.json via @joshwooding/vite-plugin-react-docgen-typescript@0.2.1, @sveltejs/vite-plugin-svelte@2.0.2, @vitejs/plugin-react@3.1.0, @vitejs/plugin-react-swc@3.1.0, @vitejs/plugin-vue@4.0.0, vite@4.1.1
rollup@3.14.0 (upgraded) Function dist/shared/loadConfigFile.js examples/lit-ts/package.json via @storybook/builder-vite@0.4.0, vite@4.0.4, examples/preact/package.json via @preact/preset-vite@2.5.0, @storybook/builder-vite@0.4.0, vite@4.0.4, examples/react/package.json via @storybook/builder-vite@0.4.0, vite@4.0.4, examples/react-18/package.json via @storybook/builder-vite@0.4.0, @vitejs/plugin-react-swc@3.1.0, vite@4.0.4, examples/react-ts/package.json via @storybook/builder-vite@0.4.0, @vitejs/plugin-react@3.1.0, vite@4.0.4, examples/svelte/package.json via @storybook/builder-vite@0.4.0, vite@4.0.4, examples/vue2.6/package.json via @storybook/builder-vite@0.4.0, examples/vue2.7/package.json via @storybook/builder-vite@0.4.0, examples/vue3/package.json via @storybook/builder-vite@0.4.0, vite@4.0.4, examples/workspaces/packages/catalog/package.json via @storybook/builder-vite@0.4.0, @vitejs/plugin-react@3.1.0, vite@4.0.4, packages/builder-vite/package.json via @joshwooding/vite-plugin-react-docgen-typescript@0.2.1, @sveltejs/vite-plugin-svelte@2.0.2, @vitejs/plugin-react@3.1.0, @vitejs/plugin-react-swc@3.1.0, @vitejs/plugin-vue@4.0.0, vite@4.1.1
telejson@6.0.8 (added) Function dist/cjs/index.js
telejson@6.0.8 (added) Function dist/esm/index.js
terser@4.8.1 (upgraded) Function dist/bundle.min.js
terser@4.8.1 (upgraded) Function dist/bundle.min.js
terser@4.8.1 (upgraded) Function dist/bundle.min.js
terser@4.8.1 (upgraded) Function dist/bundle.min.js
tastafur commented 1 year ago

Thank you very much for your work @IanVS : D