Skip to content

Commit bc8b811

Browse files
committed
feat: upgrade to vite 8 and rolldown
1 parent c9e95d7 commit bc8b811

File tree

19 files changed

+1427
-1120
lines changed

19 files changed

+1427
-1120
lines changed

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"preact": "^10.24.3",
3535
"preact-render-to-string": "^6.5.11",
3636
"rehype-external-links": "^3.0.0",
37-
"unocss": "^0.61.8",
37+
"unocss": "^66.6.6",
3838
"vite-plugin-inspect": "^0.8.7",
3939
"vue-tsc": "^2.1.10"
4040
},

iles.config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import { join } from 'pathe'
33

44
const testConfig = {
55
test: {
6-
deps: {
7-
inline: [
8-
'@vue/devtools-api',
9-
],
6+
server: {
7+
deps: {
8+
inline: [
9+
'@vue/devtools-api',
10+
],
11+
},
1012
},
1113
},
1214
}

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@
3838
"semver": "^7.6.3",
3939
"tsx": "^4.19.2",
4040
"typescript": "^5.6.3",
41-
"vitest": "^2.1.4"
41+
"vitest": "^4.1.0"
4242
},
4343
"pnpm": {
4444
"overrides": {
4545
"@typescript-eslint/typescript-estree": "8.5.0",
46-
"esbuild": "0.24.0",
47-
"vite": "5.4.10"
46+
"vite": "8.0.0"
4847
},
4948
"peerDependencyRules": {
5049
"allowedVersions": {

packages/hydration/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"svelte": "^5.1.13",
4545
"tsup": "8.2.4",
4646
"typescript": "^5.6.3",
47-
"vite": "^5.4.10",
47+
"vite": "^8.0.0",
4848
"vue": "^3.5.12"
4949
}
5050
}

packages/iles/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"lint:fix": "eslint . --fix"
4949
},
5050
"engines": {
51-
"node": "^18.0.0 || >=20.0.0"
51+
"node": ">=20.19.0 || >=22.12.0"
5252
},
5353
"keywords": [
5454
"vite",
@@ -71,7 +71,7 @@
7171
"@nuxt/devalue": "^2.0.2",
7272
"@unhead/ssr": "^1.9.16",
7373
"@unhead/vue": "^1.9.16",
74-
"@vitejs/plugin-vue": "^5.1.4",
74+
"@vitejs/plugin-vue": "^6.0.5",
7575
"@vue/devtools-api": "^7.6.3",
7676
"debug": "^4.3.5",
7777
"deep-equal": "^2.2.3",
@@ -85,13 +85,13 @@
8585
"picocolors": "^1.0.1",
8686
"unist-util-visit": "^5.0.0",
8787
"unplugin-vue-components": "^0.27.3",
88-
"vite": "^5.4.10",
88+
"vite": "^8.0.0",
8989
"vue": "^3.5.12",
9090
"vue-router": "^4.4.0"
9191
},
9292
"devDependencies": {
9393
"@preact/preset-vite": "^2.9.1",
94-
"@sveltejs/vite-plugin-svelte": "^4.0.0",
94+
"@sveltejs/vite-plugin-svelte": "^7.0.0",
9595
"@types/debug": "^4.1.12",
9696
"@types/fs-extra": "^11.0.4",
9797
"@types/micromatch": "^4.0.9",
@@ -108,7 +108,7 @@
108108
"mdast-util-mdxjs-esm": "^2.0.1",
109109
"micromatch": "^4.0.7",
110110
"npm-run-all": "^4.1.5",
111-
"rollup": "^4.19.0",
111+
"rolldown": "1.0.0-rc.9",
112112
"semver": "^7.6.3",
113113
"tinyglobby": "0.2.6",
114114
"tsup": "8.2.4",

packages/iles/src/node/build/bundle.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { promises as fs } from 'fs'
2-
import type { RollupOutput } from 'rollup'
2+
import type { RolldownOutput } from 'rolldown'
33
import type { Plugin } from 'vite'
44
import glob from 'fast-glob'
55
import { relative, dirname, resolve, join } from 'pathe'
@@ -55,17 +55,16 @@ async function bundleWithVite (config: AppConfig, entrypoints: string[] | Entryp
5555
build: {
5656
ssr,
5757
cssCodeSplit: htmlBuild || !ssr,
58-
minify: ssr ? false : 'esbuild',
58+
minify: ssr ? false : true,
5959
emptyOutDir: ssr,
6060
outDir: ssr ? config.tempDir : config.outDir,
6161
sourcemap: false,
62-
rollupOptions: {
62+
rolldownOptions: {
6363
input: entrypoints,
64-
preserveEntrySignatures: htmlBuild ? undefined : 'allow-extension',
6564
treeshake: htmlBuild,
6665
},
6766
},
68-
} as ViteUserConfig)) as RollupOutput
67+
} as ViteUserConfig)) as RolldownOutput
6968
}
7069

7170
// Internal: Currently SSG supports a single stylesheet for all pages.

packages/iles/src/node/build/chunks.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import type { GetManualChunk, ManualChunkMeta } from 'rollup'
1+
import type { GetModuleInfo } from 'rolldown'
22
import type { AppConfig } from '../shared'
33

4+
type ManualChunkMeta = { getModuleInfo: GetModuleInfo }
5+
type GetManualChunk = (id: string, meta: ManualChunkMeta) => string | void
6+
47
export function extendManualChunks (config: AppConfig): GetManualChunk {
58
const userChunks = config.ssg.manualChunks
69
const cache = new Map<string, string | undefined>()

packages/iles/src/node/build/islands.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { promises as fs } from 'fs'
22
import { relative, resolve } from 'pathe'
33
import { build as viteBuild, mergeConfig as mergeViteConfig } from 'vite'
44
import type { UserConfig as ViteUserConfig, Plugin } from 'vite'
5-
import type { PreRenderedChunk } from 'rollup'
5+
import type { PreRenderedChunk } from 'rolldown'
66
import IslandsPlugins from '../plugin/plugin'
77
import type { AppConfig, IslandsByPath } from '../shared'
88
import { TURBO_SCRIPT_PATH } from '../alias'
@@ -38,8 +38,8 @@ export async function bundleIslands (config: AppConfig, islandsByPath: IslandsBy
3838
emptyOutDir: false,
3939
outDir: config.outDir,
4040
manifest: true,
41-
minify: 'esbuild',
42-
rollupOptions: {
41+
minify: true,
42+
rolldownOptions: {
4343
input: entryFiles,
4444
output: {
4545
entryFileNames: chunkFileNames,

packages/iles/src/node/build/render.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { existsSync } from 'fs'
22
import { join } from 'pathe'
33
import { renderSSRHead } from '@unhead/ssr'
4-
import type { RollupOutput } from 'rollup'
4+
import type { RolldownOutput } from 'rolldown'
55
import { renderers } from '@islands/prerender'
66
import { IslandDefinition } from 'iles'
77
import { renderToString } from 'vue/server-renderer'
@@ -39,7 +39,7 @@ export async function renderPages (
3939
export async function renderPage (
4040
config: AppConfig,
4141
islandsByPath: IslandsByPath,
42-
clientChunks: RollupOutput['output'],
42+
clientChunks: RolldownOutput['output'],
4343
route: RouteToRender,
4444
createApp: CreateAppFactory,
4545
) {
@@ -68,7 +68,7 @@ export async function renderPage (
6868
</html>`
6969
}
7070

71-
function stylesheetTagsFrom (config: AppConfig, clientChunks: RollupOutput['output']) {
71+
function stylesheetTagsFrom (config: AppConfig, clientChunks: RolldownOutput['output']) {
7272
return clientChunks
7373
.filter(chunk => chunk.type === 'asset' && chunk.fileName.endsWith('.css'))
7474
.map(chunk => `<link rel="stylesheet" href="${config.base}${chunk.fileName}">`)

packages/iles/src/node/plugin/plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { promises as fs } from 'fs'
22
import { basename, resolve, relative } from 'pathe'
33
import type { PluginOption, ResolvedConfig, ViteDevServer } from 'vite'
4-
import { transformWithEsbuild } from 'vite'
4+
import { transformWithOxc } from 'vite'
55

66
import MagicString from 'magic-string'
77

@@ -31,7 +31,7 @@ function isVueScript (path: string, query: Record<string, any>) {
3131

3232
async function transformUserFile (path: string) {
3333
return await exists(path)
34-
? await transformWithEsbuild(await fs.readFile(path, 'utf-8'), path, { sourcemap: false })
34+
? await transformWithOxc(await fs.readFile(path, 'utf-8'), path, { sourcemap: false })
3535
: { code: 'export default {}' }
3636
}
3737

@@ -244,7 +244,7 @@ import.meta.hot?.accept('/${relative(root, path)}', (...args) => __ILES_PAGE_UPD
244244
appConfig.jsx === 'preact' && {
245245
name: 'iles:preact-jsx-config',
246246
config () {
247-
return { esbuild: { include: /\.(tsx?|jsx)$/ } }
247+
return { oxc: { include: /\.(tsx?|jsx)$/ } }
248248
},
249249
},
250250
]

0 commit comments

Comments
 (0)