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

Support vite 3.1 #490

Merged
merged 2 commits into from
Sep 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion examples/lit-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"npm-run-all": "^4.1.5",
"rollup-plugin-postcss-lit": "^2.0.0",
"sass": "^1.50.1",
"vite": "^3.0.0-beta.9",
"vite": "^3.1.0-beta.1",
"wait-on": "^6.0.1"
},
"bookcase-builder": {}
Expand Down
2 changes: 1 addition & 1 deletion examples/overview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"http-server": "^14.1.0",
"jest": "^27.5.1",
"npm-run-all": "^4.1.5",
"vite": "^3.0.0-beta.9",
"vite": "^3.1.0-beta.1",
"wait-on": "^6.0.1"
},
"bookcase-builder": {}
Expand Down
2 changes: 1 addition & 1 deletion examples/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"http-server": "^14.1.0",
"jest": "^27.5.1",
"npm-run-all": "^4.1.5",
"vite": "^3.0.0-beta.9",
"vite": "^3.1.0-beta.1",
"wait-on": "^6.0.1"
},
"bookcase-builder": {}
Expand Down
2 changes: 1 addition & 1 deletion examples/react-18/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"http-server": "^14.1.0",
"jest": "^27.5.1",
"npm-run-all": "^4.1.5",
"vite": "^3.0.0-beta.9",
"vite": "^3.1.0-beta.1",
"wait-on": "^6.0.1"
},
"bookcase-builder": {}
Expand Down
2 changes: 1 addition & 1 deletion examples/react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"npm-run-all": "^4.1.5",
"ts-node": "^10.7.0",
"typescript": "^4.5.4",
"vite": "^3.0.0-beta.9",
"vite": "^3.1.0-beta.1",
"wait-on": "^6.0.1"
},
"bookcase-builder": {}
Expand Down
4 changes: 2 additions & 2 deletions examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
"@storybook/mdx2-csf": "^0.0.3",
"@storybook/react": "^6.5.9",
"@storybook/test-runner": "0.1.0",
"@vitejs/plugin-react": "^2.0.0-beta.1",
"@vitejs/plugin-react": "^2.0.0",
"http-server": "^14.1.0",
"jest": "^27.5.1",
"npm-run-all": "^4.1.5",
"vite": "^3.0.0-beta.9",
"vite": "^3.1.0-beta.1",
"wait-on": "^6.0.1"
},
"bookcase-builder": {}
Expand Down
2 changes: 1 addition & 1 deletion examples/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"npm-run-all": "^4.1.5",
"svelte-preprocess": "^4.10.4",
"typescript": "^4.5.5",
"vite": "^3.0.0-beta.9",
"vite": "^3.1.0-beta.1",
"wait-on": "^6.0.1"
},
"bookcase-builder": {}
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"http-server": "^14.1.0",
"jest": "^27.5.1",
"npm-run-all": "^4.1.5",
"vite": "^3.0.0-beta.9",
"vite": "^3.1.0-beta.1",
"wait-on": "^6.0.1"
}
}
2 changes: 1 addition & 1 deletion examples/workspaces/packages/catalog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"@storybook/addon-essentials": "^6.5.9",
"@storybook/builder-vite": "workspace:*",
"@storybook/react": "^6.5.9",
"vite": "^3.0.0-beta.9"
"vite": "^3.1.0-beta.1"
}
}
1 change: 1 addition & 0 deletions packages/builder-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@sveltejs/vite-plugin-svelte": "^1.0.0",
"@types/express": "^4.17.13",
"@types/node": "^17.0.23",
"vite": "^3.1.0-beta.1",
"vue-docgen-api": "^4.40.0"
},
"peerDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion packages/builder-vite/plugins/mdx-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ export function mdxPlugin(options: Options): Plugin {

const modifiedCode = injectRenderer(mdxCode, Boolean(features?.previewMdx2));

const result = await reactRefresh?.transform!.call(this, modifiedCode, `${id}.jsx`, options);
// Hooks in recent rollup versions can be functions or objects, and though react hasn't changed, the typescript defs have
const rTransform = reactRefresh?.transform;
const transform = rTransform && 'handler' in rTransform ? rTransform.handler : rTransform;

const result = await transform!.call(this, modifiedCode, `${id}.jsx`, options);

if (!result) return modifiedCode;

Expand Down
62 changes: 44 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3110,6 +3110,7 @@ __metadata:
react-docgen: ^6.0.0-alpha.0
slash: ^3.0.0
sveltedoc-parser: ^4.2.1
vite: ^3.1.0-beta.1
vue-docgen-api: ^4.40.0
peerDependencies:
"@storybook/mdx2-csf": ^0.0.3
Expand Down Expand Up @@ -9679,7 +9680,7 @@ __metadata:
npm-run-all: ^4.1.5
rollup-plugin-postcss-lit: ^2.0.0
sass: ^1.50.1
vite: ^3.0.0-beta.9
vite: ^3.1.0-beta.1
wait-on: ^6.0.1
languageName: unknown
linkType: soft
Expand All @@ -9700,7 +9701,7 @@ __metadata:
npm-run-all: ^4.1.5
react: ^16.4.14
react-dom: ^16.4.14
vite: ^3.0.0-beta.9
vite: ^3.1.0-beta.1
wait-on: ^6.0.1
languageName: unknown
linkType: soft
Expand All @@ -9718,7 +9719,7 @@ __metadata:
jest: ^27.5.1
npm-run-all: ^4.1.5
preact: ^10.5.15
vite: ^3.0.0-beta.9
vite: ^3.1.0-beta.1
wait-on: ^6.0.1
languageName: unknown
linkType: soft
Expand All @@ -9739,7 +9740,7 @@ __metadata:
npm-run-all: ^4.1.5
react: ^18.0.0
react-dom: ^18.0.0
vite: ^3.0.0-beta.9
vite: ^3.1.0-beta.1
wait-on: ^6.0.1
languageName: unknown
linkType: soft
Expand All @@ -9762,7 +9763,7 @@ __metadata:
react-dom: ^16.4.14
ts-node: ^10.7.0
typescript: ^4.5.4
vite: ^3.0.0-beta.9
vite: ^3.1.0-beta.1
wait-on: ^6.0.1
languageName: unknown
linkType: soft
Expand All @@ -9778,13 +9779,13 @@ __metadata:
"@storybook/mdx2-csf": ^0.0.3
"@storybook/react": ^6.5.9
"@storybook/test-runner": 0.1.0
"@vitejs/plugin-react": ^2.0.0-beta.1
"@vitejs/plugin-react": ^2.0.0
http-server: ^14.1.0
jest: ^27.5.1
npm-run-all: ^4.1.5
react: ^16.4.14
react-dom: ^16.4.14
vite: ^3.0.0-beta.9
vite: ^3.1.0-beta.1
wait-on: ^6.0.1
languageName: unknown
linkType: soft
Expand All @@ -9808,7 +9809,7 @@ __metadata:
svelte: ^3.46.4
svelte-preprocess: ^4.10.4
typescript: ^4.5.5
vite: ^3.0.0-beta.9
vite: ^3.1.0-beta.1
wait-on: ^6.0.1
languageName: unknown
linkType: soft
Expand All @@ -9830,7 +9831,7 @@ __metadata:
http-server: ^14.1.0
jest: ^27.5.1
npm-run-all: ^4.1.5
vite: ^3.0.0-beta.9
vite: ^3.1.0-beta.1
vue: ^3.2.25
wait-on: ^6.0.1
languageName: unknown
Expand All @@ -9847,7 +9848,7 @@ __metadata:
"@storybook/react": ^6.5.9
react: ^16.4.14
react-dom: ^16.4.14
vite: ^3.0.0-beta.9
vite: ^3.1.0-beta.1
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -16262,7 +16263,7 @@ __metadata:
languageName: node
linkType: hard

"postcss@npm:^8.1.10, postcss@npm:^8.4.13, postcss@npm:^8.4.14":
"postcss@npm:^8.1.10, postcss@npm:^8.4.13":
version: 8.4.14
resolution: "postcss@npm:8.4.14"
dependencies:
Expand All @@ -16273,6 +16274,17 @@ __metadata:
languageName: node
linkType: hard

"postcss@npm:^8.4.16":
version: 8.4.16
resolution: "postcss@npm:8.4.16"
dependencies:
nanoid: ^3.3.4
picocolors: ^1.0.0
source-map-js: ^1.0.2
checksum: 10eee25efd77868036403858577da0cefaf2e0905feeaba5770d5438ccdddba3d01cba8063e96b8aac4c6daa0ed413dd5ae0554a433a3c4db38df1d134cffc1f
languageName: node
linkType: hard

"preact@npm:^10.5.15":
version: 10.9.0
resolution: "preact@npm:10.9.0"
Expand Down Expand Up @@ -17625,7 +17637,7 @@ __metadata:
languageName: node
linkType: hard

"rollup@npm:^2.59.0, rollup@npm:^2.75.6":
"rollup@npm:^2.59.0":
version: 2.76.0
resolution: "rollup@npm:2.76.0"
dependencies:
Expand All @@ -17639,6 +17651,20 @@ __metadata:
languageName: node
linkType: hard

"rollup@npm:~2.78.0":
version: 2.78.1
resolution: "rollup@npm:2.78.1"
dependencies:
fsevents: ~2.3.2
dependenciesMeta:
fsevents:
optional: true
bin:
rollup: dist/bin/rollup
checksum: 9034814383ca5bdb4bea6d499270aeb31cdb0bb884f81b0c6a1d19c63cc973f040e6ee09b7af8a7169dd231c090f4b44ef8b99c4bfdf884aceeb3dcefb8cfa14
languageName: node
linkType: hard

"rsvp@npm:^4.8.4":
version: 4.8.5
resolution: "rsvp@npm:4.8.5"
Expand Down Expand Up @@ -20213,15 +20239,15 @@ __metadata:
languageName: node
linkType: hard

"vite@npm:^3.0.0-beta.9":
version: 3.0.0-beta.9
resolution: "vite@npm:3.0.0-beta.9"
"vite@npm:^3.1.0-beta.1":
version: 3.1.0-beta.1
resolution: "vite@npm:3.1.0-beta.1"
dependencies:
esbuild: ^0.14.47
fsevents: ~2.3.2
postcss: ^8.4.14
postcss: ^8.4.16
resolve: ^1.22.1
rollup: ^2.75.6
rollup: ~2.78.0
peerDependencies:
less: "*"
sass: "*"
Expand All @@ -20241,7 +20267,7 @@ __metadata:
optional: true
bin:
vite: bin/vite.js
checksum: 287ead2b4cd3e4c015cc515d2c5eac55727098967bd21622610dc05a05984bb6b35f69e50b6b9874345efe86332915762477e38f03d15fa120d1245c9b606032
checksum: aa869e7bf2bcba96ca5509baa62c9e142cf5e31372c1529ab19807ef2b5c16a67af97cc1e64dced5f62379f357222a5b06dca6d3b2a619c4bc7bb777947e19b5
languageName: node
linkType: hard

Expand Down