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

feat: upgrade to rollup 3 and vite 4 #404

Merged
merged 7 commits into from
Dec 19, 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
6 changes: 3 additions & 3 deletions examples/svelte3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
},
"type": "module",
"dependencies": {
"svelte": "^3.49.0"
"svelte": "^3.54.0"
},
"devDependencies": {
"@histoire/plugin-svelte": "workspace:*",
"@sveltejs/vite-plugin-svelte": "^1.0.1",
"@sveltejs/vite-plugin-svelte": "^2.0.0",
"cypress": "^10.8.0",
"histoire": "workspace:*",
"start-server-and-test": "^1.14.0",
"svelte-preprocess": "^4.10.7",
"vite": "^3.0.5"
"vite": "^4.0.0"
}
}
4 changes: 2 additions & 2 deletions examples/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
"@sveltejs/kit": "next",
"@types/cookie": "^0.5.1",
"histoire": "workspace:*",
"svelte": "^3.49.0",
"svelte": "^3.54.0",
"svelte-check": "^2.7.1",
"svelte-preprocess": "^4.10.7",
"tslib": "^2.3.1",
"typescript": "^4.7.4",
"vite": "^3.0.5"
"vite": "^4.0.0"
}
}
4 changes: 2 additions & 2 deletions examples/vue2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
},
"devDependencies": {
"@histoire/plugin-vue2": "workspace:*",
"@vitejs/plugin-vue2": "^1.1.2",
"@vitejs/plugin-vue2": "^2.1.0",
"histoire": "workspace:*",
"vite": "^3.0.5",
"vite": "^4.0.0",
"vue-template-compiler": "^2.7.8"
}
}
4 changes: 2 additions & 2 deletions examples/vue3-percy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"devDependencies": {
"@histoire/plugin-percy": "workspace:*",
"@histoire/plugin-vue": "workspace:*",
"@vitejs/plugin-vue": "^3.0.1",
"@vitejs/plugin-vue": "^4.0.0",
"histoire": "workspace:*",
"vite": "^3.0.5"
"vite": "^4.0.0"
}
}
4 changes: 2 additions & 2 deletions examples/vue3-screenshot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"devDependencies": {
"@histoire/plugin-screenshot": "workspace:*",
"@histoire/plugin-vue": "workspace:*",
"@vitejs/plugin-vue": "^3.0.1",
"@vitejs/plugin-vue": "^4.0.0",
"histoire": "workspace:*",
"vite": "^3.0.5"
"vite": "^4.0.0"
}
}
4 changes: 2 additions & 2 deletions examples/vue3-themed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"vue": "^3.2.31"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.0.1",
"@vitejs/plugin-vue": "^4.0.0",
"@histoire/plugin-vue": "workspace:*",
"histoire": "workspace:*",
"vite": "^3.0.5"
"vite": "^4.0.0"
}
}
4 changes: 2 additions & 2 deletions examples/vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"@histoire/app": "workspace:*",
"@histoire/plugin-vue": "workspace:*",
"@histoire/vendors": "workspace:*",
"@vitejs/plugin-vue": "^3.0.1",
"@vitejs/plugin-vue": "^4.0.0",
"cypress": "^9.5.3",
"histoire": "workspace:*",
"sass": "^1.50.0",
"start-server-and-test": "^1.14.0",
"vite": "^3.0.5"
"vite": "^4.0.0"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"eslint": "*",
"eslint-plugin-promise": "*",
"eslint-plugin-vue": "*",
"vite": "^2.9.0 || ^3.0.0",
"vite": "^2.9.0 || ^3.0.0 || ^4.0.0",
"vue": "*"
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/histoire-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@tailwindcss/typography": "^0.5.2",
"@types/fs-extra": "^9.0.13",
"@types/node": "^17.0.32",
"@vitejs/plugin-vue": "^3.1.2",
"@vitejs/plugin-vue": "^4.0.0",
"autoprefixer": "^10.4.4",
"chokidar": "^3.5.3",
"concurrently": "^7.1.0",
Expand All @@ -51,7 +51,7 @@
"postcss-import": "^14.1.0",
"tailwindcss": "^3.0.23",
"typescript": "^4.7.4",
"vite": "^3.1.4",
"vite": "^4.0.0",
"vue": "^3.2.31"
}
}
4 changes: 2 additions & 2 deletions packages/histoire-controls-stories/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
},
"devDependencies": {
"@histoire/plugin-vue": "workspace:*",
"@vitejs/plugin-vue": "^3.1.2",
"@vitejs/plugin-vue": "^4.0.0",
"histoire": "workspace:*",
"vite": "^3.1.4"
"vite": "^4.0.0"
}
}
4 changes: 2 additions & 2 deletions packages/histoire-controls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@peeky/server": "^0.14.0",
"@peeky/test": "^0.14.1",
"@types/node": "^17.0.32",
"@vitejs/plugin-vue": "^2.3.1",
"@vitejs/plugin-vue": "^4.0.0",
"@vue/test-utils": "^2.0.0-rc.19",
"@vueuse/core": "^8.2.5",
"autoprefixer": "^10.4.4",
Expand All @@ -63,7 +63,7 @@
"postcss-import": "^14.1.0",
"tailwindcss": "^3.0.23",
"typescript": "^4.7.4",
"vite": "^3.1.4",
"vite": "^4.0.0",
"vue": "^3.2.31",
"vue-tsc": "^0.35.2"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/histoire-plugin-nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@nuxt/schema": "^3.0.0-rc.11",
"histoire": "workspace:*",
"typescript": "^4.7.4",
"vite": "^3.1.4"
"vite": "^4.0.0"
},
"peerDependencies": {
"@histoire/plugin-vue": "^0.11.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/histoire-plugin-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"histoire": "workspace:*",
"svelte": "^3.49.0",
"svelte-preprocess": "^4.10.7",
"vite": "^3.0.5"
"vite": "^4.0.0"
},
"peerDependencies": {
"histoire": "^0.11.9",
Expand Down
3 changes: 2 additions & 1 deletion packages/histoire-plugin-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@
"@types/node": "^17.0.32",
"change-case": "^4.1.2",
"concurrently": "^7.1.0",
"globby": "^13.1.1",
"typescript": "^4.7.4",
"histoire": "workspace:*",
"vite": "^3.1.4",
"vite": "^4.0.0",
"vue": "^3.2.31"
},
"peerDependencies": {
Expand Down
29 changes: 29 additions & 0 deletions packages/histoire-plugin-vue/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
import { defineConfig } from 'vite'
import fs from 'node:fs'
import { globbySync } from 'globby'

export default defineConfig({
plugins: [
{
name: 'histoire:preserve:import.dynamic',
enforce: 'pre',
transform (code) {
if (code.includes('import(')) {
return {
code: code.replace(/import\(/g, 'import__dyn('),
}
}
},
closeBundle () {
try {
const files = globbySync('./dist/**/*.js')
for (const file of files) {
const content = fs.readFileSync(file, 'utf-8')
if (content.includes('import__dyn')) {
fs.writeFileSync(file, content.replace(/import__dyn\(/g, 'import(/* @vite-ignore */'), 'utf-8')
}
}
} catch (e) {
console.error(e)
}
},
},
],

build: {
emptyOutDir: false,
outDir: 'dist/bundled',
Expand Down
3 changes: 2 additions & 1 deletion packages/histoire-plugin-vue2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@
"@types/node": "^17.0.32",
"change-case": "^4.1.2",
"concurrently": "^7.1.0",
"globby": "^13.1.1",
"histoire": "workspace:*",
"typescript": "^4.7.4",
"vite": "^3.1.4",
"vite": "^4.0.0",
"vue": "^2.7.8"
},
"peerDependencies": {
Expand Down
29 changes: 29 additions & 0 deletions packages/histoire-plugin-vue2/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
import { defineConfig } from 'vite'
import fs from 'node:fs'
import { globbySync } from 'globby'

export default defineConfig({
plugins: [
{
name: 'histoire:preserve:import.dynamic',
enforce: 'pre',
transform (code) {
if (code.includes('import(')) {
return {
code: code.replace(/import\(/g, 'import__dyn('),
}
}
},
closeBundle () {
try {
const files = globbySync('./dist/**/*.js')
for (const file of files) {
const content = fs.readFileSync(file, 'utf-8')
if (content.includes('import__dyn')) {
fs.writeFileSync(file, content.replace(/import__dyn\(/g, 'import(/* @vite-ignore */'), 'utf-8')
}
}
} catch (e) {
console.error(e)
}
},
},
],

build: {
emptyOutDir: false,
outDir: 'dist/bundled',
Expand Down
4 changes: 2 additions & 2 deletions packages/histoire-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"picocolors": "^1.0.0"
},
"peerDependencies": {
"vite": "^2.9.0 || ^3.0.0"
"vite": "^2.9.0 || ^3.0.0 || ^4.0.0"
},
"devDependencies": {
"typescript": "^4.7.4",
"vite": "^3.0.5"
"vite": "^4.0.0"
}
}
8 changes: 4 additions & 4 deletions packages/histoire-vendors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
},
"devDependencies": {
"@iconify/vue": "^3.2.1",
"@rollup/plugin-commonjs": "^22.0.1",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-commonjs": "^23.0.3",
"@rollup/plugin-node-resolve": "^15.0.1",
"@types/node": "^18.0.3",
"@vueuse/core": "^8.2.5",
"execa": "^6.1.0",
"floating-vue": "^2.0.0-beta.19",
"fs-extra": "^10.0.1",
"globby": "^13.1.1",
"pinia": "^2.0.13",
"rollup": "^2.75.7",
"rollup-plugin-typescript2": "^0.32.1",
"rollup": "^3.5.1",
"rollup-plugin-typescript2": "^0.34.1",
"scroll-into-view-if-needed": "^2.2.29",
"typescript": "^4.7.4",
"vue-router": "^4.0.14",
Expand Down
8 changes: 4 additions & 4 deletions packages/histoire/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
"shiki": "0.11.1",
"sirv": "^2.0.2",
"tinypool": "^0.1.2",
"vite-node": "0.23.4"
"vite-node": "0.26.0"
},
"peerDependencies": {
"vite": "^2.9.0 || ^3.0.0"
"vite": "^2.9.0 || ^3.0.0 || ^4.0.0"
},
"devDependencies": {
"@peeky/server": "^0.14.0",
Expand All @@ -81,8 +81,8 @@
"@types/markdown-it": "^12.2.3",
"@types/micromatch": "^4.0.2",
"@types/node": "^17.0.32",
"rollup": "^2.59.0",
"rollup": "^3.5.1",
"typescript": "^4.7.4",
"vite": "^3.0.5"
"vite": "^4.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/histoire/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import type {
BuildEndCallback,
PreviewStoryCallback,
} from '@histoire/shared'
import type { RollupOutput } from 'rollup'
import { APP_PATH } from './alias.js'
import { Context } from './context.js'
import { getViteConfigWithPlugins } from './vite.js'
import { findAllStories } from './stories.js'
import type { RollupOutput } from 'rollup'
import { useCollectStories } from './collect/index.js'
import { BuildPluginApi } from './plugin.js'
import { useModuleLoader } from './load.js'
Expand Down
Loading