Skip to content

Commit 9ce39d7

Browse files
feat: update to vite 8
1 parent c1e7b83 commit 9ce39d7

8 files changed

Lines changed: 1358 additions & 815 deletions

File tree

.changeset/some-seas-smile.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'create-vitrify': minor
3+
'vitrify': minor
4+
'@vitrify/tools': minor
5+
---
6+
7+
feat: update to vite 8

packages/create-vitrify/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@
2727
"dependencies": {
2828
"@vitrify/tools": "workspace:*",
2929
"handlebars": "^4.7.8",
30-
"@inquirer/prompts": "^8.3.0",
30+
"@inquirer/prompts": "^8.3.2",
3131
"latest-version": "^9.0.0",
3232
"minimist": "^1.2.8"
3333
},
3434
"devDependencies": {
3535
"@types/minimist": "^1.2.5",
36-
"@types/node": "^25.3.1",
36+
"@types/node": "^25.5.0",
3737
"typescript": "^5.9.3",
38-
"vite": "^7.3.1",
39-
"vue": "^3.5.29"
38+
"vite": "^8.0.0",
39+
"vue": "^3.5.30"
4040
},
4141
"files": [
4242
"dist",

packages/tools/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
"registry": "https://registry.npmjs.org/"
5050
},
5151
"devDependencies": {
52-
"@types/node": "^25.3.1",
52+
"@types/node": "^25.5.0",
5353
"typescript": "^5.9.3",
54-
"vite": "^7.3.1"
54+
"vite": "^8.0.0"
5555
},
5656
"dependencies": {
5757
"handlebars": "^4.7.8"

packages/vitrify/package.json

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -56,71 +56,71 @@
5656
"test": "vitest test/"
5757
},
5858
"dependencies": {
59-
"@fastify/middie": "^9.1.0",
59+
"@fastify/middie": "^9.3.1",
6060
"@fastify/one-line-logger": "^2.1.0",
6161
"@fastify/static": "^9.0.0",
62-
"@unocss/core": "^66.6.2",
63-
"@unocss/preset-uno": "^66.6.2",
64-
"@unocss/preset-web-fonts": "66.6.2",
65-
"@unocss/preset-wind": "^66.6.2",
66-
"@vitejs/plugin-vue": "^6.0.4",
62+
"@unocss/core": "^66.6.7",
63+
"@unocss/preset-uno": "^66.6.7",
64+
"@unocss/preset-web-fonts": "66.6.7",
65+
"@unocss/preset-wind": "^66.6.7",
66+
"@vitejs/plugin-vue": "^6.0.5",
6767
"ajv": "^8.18.0",
6868
"animated-unocss": "^0.0.6",
69-
"cac": "^6.7.14",
69+
"cac": "^7.0.0",
7070
"chalk": "^5.6.2",
7171
"cross-env": "^10.1.0",
72-
"devalue": "^5.6.3",
73-
"esbuild": "^0.27.3",
74-
"fastify": "^5.7.4",
72+
"devalue": "^5.6.4",
73+
"fastify": "^5.8.2",
7574
"glob": "^13.0.6",
76-
"happy-dom": "^20.7.0",
75+
"happy-dom": "^20.8.4",
7776
"is-port-reachable": "^4.0.0",
7877
"magic-string": "^0.30.21",
7978
"merge-deep": "^3.0.3",
8079
"readline": "^1.3.0",
81-
"rollup-plugin-visualizer": "^7.0.0",
82-
"sass": "1.97.3",
80+
"rolldown": "1.0.0-rc.9",
81+
"rollup-plugin-visualizer": "^7.0.1",
82+
"sass": "1.98.0",
8383
"stringify-object": "^6.0.0",
8484
"ts-node": "^10.9.2",
85-
"unocss": "^66.6.2",
85+
"unocss": "^66.6.7",
8686
"unplugin-vue-components": "^31.0.0",
87-
"vite": "^7.3.1",
87+
"vite": "^8.0.0",
8888
"vite-plugin-pwa": "^1.2.0",
8989
"vitefu": "^1.1.2",
90-
"vitest": "^4.0.18",
90+
"vitest": "^4.1.0",
9191
"workbox-window": "^7.4.0"
9292
},
9393
"devDependencies": {
9494
"@iconify-json/mdi": "^1.2.3",
95-
"@pinia/colada": "^0.21.5",
95+
"@pinia/colada": "^1.0.0",
9696
"@quasar/extras": "^1.17.0",
9797
"@quasar/quasar-ui-qmarkdown": "^2.0.5",
9898
"@quasar/quasar-ui-qmediaplayer": "^2.0.0-beta.0",
9999
"@types/connect": "^3.4.38",
100100
"@types/glob": "^9.0.0",
101101
"@types/merge-deep": "^3.0.3",
102-
"@types/node": "^25.3.1",
102+
"@types/node": "^25.5.0",
103103
"@types/stringify-object": "^4.0.5",
104104
"@types/ws": "^8.18.1",
105-
"@unocss/preset-icons": "^66.6.2",
106-
"@vue/runtime-core": "^3.5.29",
105+
"@unocss/preset-icons": "^66.6.7",
106+
"@vue/runtime-core": "^3.5.30",
107107
"beasties": "^0.4.1",
108108
"css": "^3.0.0",
109109
"css-to-tailwind-translator": "^1.2.8",
110110
"pinia": "^3.0.4",
111-
"quasar": "^2.18.6",
111+
"quasar": "^2.18.7",
112112
"rollup": "^4.59.0",
113113
"typescript": "^5.9.3",
114-
"vue": "^3.5.29",
114+
"vue": "^3.5.30",
115115
"vue-router": "^5.0.3"
116116
},
117117
"peerDependencies": {
118118
"@fastify/static": "^9.0.0",
119-
"@pinia/colada": "^0.21.5",
120-
"fastify": "^5.7.4",
119+
"@pinia/colada": "^1.0.0",
120+
"fastify": "^5.8.2",
121121
"pinia": "^3.0.4",
122-
"quasar": "^2.18.6",
123-
"vue": "^3.5.29",
122+
"quasar": "^2.18.7",
123+
"vue": "^3.5.30",
124124
"vue-router": "^5.0.3"
125125
},
126126
"publishConfig": {

packages/vitrify/src/node/bin/cli.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import cac from 'cac'
33
import { fileURLToPath } from 'url'
44
import { getAppDir, parsePath } from '../app-urls.js'
55
import { printHttpServerUrls, exitLogs } from '../helpers/logger.js'
6-
import { build as esbuild } from 'esbuild'
6+
import { minify } from 'rolldown/utils'
77
import type { ResolvedConfig, ViteDevServer } from 'vite'
88
import type { Server } from 'net'
99
import type { FastifyInstance } from 'fastify'
10-
import { readdir } from 'fs/promises'
10+
import { readdir, readFile, writeFile } from 'fs/promises'
1111
import { loadSSRAssets } from '../frameworks/vue/fastify-ssr-plugin.js'
1212

1313
const cli = cac('vitrify')
@@ -199,23 +199,27 @@ cli.command('run <file>').action(async (file, options) => {
199199
})
200200

201201
cli.command('minify <dir>').action(async (dir, options) => {
202-
const files = await readdir(
203-
fileURLToPath(new URL(dir, `file://${process.cwd()}/`))
204-
)
202+
const baseUrl = new URL(dir, `file://${process.cwd()}/`)
203+
const files = await readdir(fileURLToPath(baseUrl))
205204
let counter = 0
206205
for (const file of files) {
207206
if (file.endsWith('.mjs')) {
208-
await esbuild({
209-
absWorkingDir: fileURLToPath(new URL(dir, `file://${process.cwd()}/`)),
210-
entryPoints: [file],
211-
minify: true,
212-
minifyIdentifiers: true,
213-
minifySyntax: true,
214-
minifyWhitespace: true,
215-
outfile: file,
216-
allowOverwrite: true
207+
const path = fileURLToPath(
208+
new URL(`${dir}/${file}`, `file://${process.cwd()}/`)
209+
)
210+
const content = await readFile(path, {
211+
encoding: 'utf-8'
212+
})
213+
const output = await minify(path, content, {
214+
compress: true,
215+
module: true,
216+
mangle: true,
217+
codegen: true
217218
})
218-
counter++
219+
if (!output.errors.length) {
220+
await writeFile(path, output.code)
221+
counter++
222+
}
219223
}
220224
}
221225
console.log(`Minified ${counter} files`)

packages/vitrify/src/node/index.ts

Lines changed: 7 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import type {
77
} from 'vite'
88
import { findDepPkgJsonPath } from 'vitefu'
99
import { mergeConfig } from 'vite'
10-
import { build } from 'esbuild'
10+
import { transform } from 'rolldown/utils'
1111
import fs from 'fs'
12-
import path from 'path'
13-
import { pathToFileURL } from 'url'
1412
import { readFileSync } from 'fs'
1513
import { builtinModules } from 'node:module'
1614
import { visualizer } from 'rollup-plugin-visualizer'
@@ -119,64 +117,6 @@ export const VIRTUAL_MODULES = [
119117
'vitrify.css'
120118
]
121119

122-
async function bundleConfigFile(
123-
fileName: string,
124-
isESM = false
125-
): Promise<{ code: string; dependencies: string[] }> {
126-
const result = await build({
127-
absWorkingDir: process.cwd(),
128-
entryPoints: [fileName],
129-
outfile: 'out.js',
130-
write: false,
131-
platform: 'node',
132-
bundle: true,
133-
format: 'esm',
134-
sourcemap: 'inline',
135-
metafile: true,
136-
plugins: [
137-
{
138-
name: 'externalize-deps',
139-
setup(build) {
140-
build.onResolve({ filter: /.*/ }, (args) => {
141-
const id = args.path
142-
if (id[0] !== '.' && !path.isAbsolute(id)) {
143-
return {
144-
external: true
145-
}
146-
}
147-
})
148-
}
149-
},
150-
{
151-
name: 'replace-import-meta',
152-
setup(build) {
153-
build.onLoad({ filter: /\.[jt]s$/ }, async (args) => {
154-
const contents = await fs.promises.readFile(args.path, 'utf8')
155-
return {
156-
loader: args.path.endsWith('.ts') ? 'ts' : 'js',
157-
contents: contents
158-
.replace(
159-
/\bimport\.meta\.url\b/g,
160-
JSON.stringify(pathToFileURL(args.path).href)
161-
)
162-
.replace(
163-
/\b__dirname\b/g,
164-
JSON.stringify(path.dirname(args.path))
165-
)
166-
.replace(/\b__filename\b/g, JSON.stringify(args.path))
167-
}
168-
})
169-
}
170-
}
171-
]
172-
})
173-
const { text } = result.outputFiles[0]
174-
return {
175-
code: text,
176-
dependencies: result.metafile ? Object.keys(result.metafile.inputs) : []
177-
}
178-
}
179-
180120
export const baseConfig = async ({
181121
ssr,
182122
appDir,
@@ -218,10 +158,12 @@ export const baseConfig = async ({
218158
try {
219159
if (fs.existsSync(fileURLToPath(new URL('vitrify.config.ts', appDir)))) {
220160
const configPath = fileURLToPath(new URL('vitrify.config.ts', appDir))
221-
const bundledConfig = await bundleConfigFile(
222-
fileURLToPath(new URL('vitrify.config.ts', appDir))
223-
)
224-
fs.writeFileSync(configPath + '.js', bundledConfig.code)
161+
162+
const content = readFileSync(configPath, {
163+
encoding: 'utf-8'
164+
})
165+
const output = await transform(configPath, content)
166+
fs.writeFileSync(configPath + '.js', output.code)
225167

226168
rawVitrifyConfig = (await import('file://' + configPath + '.js')).default
227169
fs.unlinkSync(configPath + '.js')

packages/vitrify/test/integration/app/package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,34 +39,34 @@
3939
"format:write": "prettier --write ."
4040
},
4141
"dependencies": {
42-
"@fastify/middie": "9.1.0",
42+
"@fastify/middie": "9.3.1",
4343
"@fastify/one-line-logger": "2.1.0",
4444
"@fastify/static": "9.0.0"
4545
},
4646
"devDependencies": {
47-
"@typescript-eslint/eslint-plugin": "8.56.1",
48-
"@typescript-eslint/parser": "8.56.1",
49-
"@types/node": "25.3.1",
50-
"@vitejs/plugin-vue": "6.0.4",
51-
"@vue/reactivity": "3.5.29",
52-
"@vue/runtime-core": "3.5.29",
53-
"@vue/runtime-dom": "3.5.29",
54-
"@vue/server-renderer": "3.5.29",
55-
"@vue/shared": "3.5.29",
47+
"@typescript-eslint/eslint-plugin": "8.57.1",
48+
"@typescript-eslint/parser": "8.57.1",
49+
"@types/node": "25.5.0",
50+
"@vitejs/plugin-vue": "6.0.5",
51+
"@vue/reactivity": "3.5.30",
52+
"@vue/runtime-core": "3.5.30",
53+
"@vue/runtime-dom": "3.5.30",
54+
"@vue/server-renderer": "3.5.30",
55+
"@vue/shared": "3.5.30",
5656
"beasties": "0.4.1",
5757
"devcert": "1.2.3",
58-
"eslint": "10.0.2",
58+
"eslint": "10.0.3",
5959
"eslint-config-prettier": "10.1.8",
6060
"eslint-plugin-prettier": "5.5.5",
6161
"eslint-plugin-vue": "10.8.0",
62-
"fastify": "5.7.4",
62+
"fastify": "5.8.2",
6363
"npm-run-all": "4.1.5",
6464
"typescript": "5.9.3",
65-
"typescript-eslint": "8.56.1",
66-
"vite": "7.3.1",
65+
"typescript-eslint": "8.57.1",
66+
"vite": "8.0.0",
6767
"vite-plugin-pwa": "1.2.0",
68-
"vitrify": "0.25.8",
69-
"vue": "3.5.29",
68+
"vitrify": "0.25.9",
69+
"vue": "3.5.30",
7070
"vue-eslint-parser": "10.4.0",
7171
"vue-router": "5.0.3",
7272
"workbox-window": "7.4.0"

0 commit comments

Comments
 (0)