Skip to content

Commit 584c601

Browse files
committed
feat: using rolldown vite
1 parent 87929ca commit 584c601

34 files changed

+2444
-1338
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@
5656
"picocolors": "^1.1.1",
5757
"playwright-chromium": "^1.49.0",
5858
"prettier": "3.3.3",
59+
"rolldown-vite": "catalog:",
5960
"rollup": "^4.27.4",
6061
"simple-git-hooks": "^2.11.1",
6162
"tsx": "^4.19.2",
6263
"typescript": "^5.7.2",
6364
"typescript-eslint": "^8.16.0",
6465
"unbuild": "2.0.0",
65-
"vite": "catalog:",
66-
"vitest": "^2.1.6",
66+
"vitest": "^2.1.8",
6767
"vue": "catalog:"
6868
},
6969
"simple-git-hooks": {

packages/plugin-vue-jsx/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
"@vue/babel-plugin-jsx": "^1.2.5"
4141
},
4242
"devDependencies": {
43-
"vite": "catalog:"
43+
"rolldown-vite": "catalog:"
4444
},
4545
"peerDependencies": {
46-
"vite": "^5.0.0 || ^6.0.0",
46+
"rolldown-vite": "catalog:",
4747
"vue": "^3.0.0"
4848
}
4949
}

packages/plugin-vue-jsx/src/index.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import path from 'node:path'
33
import type { types } from '@babel/core'
44
import * as babel from '@babel/core'
55
import jsx from '@vue/babel-plugin-jsx'
6-
import { createFilter, normalizePath } from 'vite'
6+
import { createFilter, normalizePath } from 'rolldown-vite'
77
import type { ComponentOptions } from 'vue'
8-
import type { Plugin } from 'vite'
8+
import type { Plugin } from 'rolldown-vite'
99
import type { Options } from './types'
1010

1111
export * from './types'
@@ -56,9 +56,16 @@ function vueJsxPlugin(options: Options = {}): Plugin {
5656
return {
5757
// only apply esbuild to ts files
5858
// since we are handling jsx and tsx now
59-
esbuild: {
59+
oxc: {
6060
include: /\.ts$/,
6161
},
62+
optimizeDeps: {
63+
rollupOptions: {
64+
jsx: {
65+
mode: 'classic', // TODO using rolldown jsx preserve
66+
},
67+
},
68+
},
6269
define: {
6370
__VUE_OPTIONS_API__: config.define?.__VUE_OPTIONS_API__ ?? true,
6471
__VUE_PROD_DEVTOOLS__: config.define?.__VUE_PROD_DEVTOOLS__ ?? false,
@@ -138,6 +145,7 @@ function vueJsxPlugin(options: Options = {}): Plugin {
138145
return {
139146
code: result.code,
140147
map: result.map,
148+
moduleType: 'js',
141149
}
142150
}
143151

@@ -263,6 +271,7 @@ function vueJsxPlugin(options: Options = {}): Plugin {
263271
return {
264272
code: result.code,
265273
map: result.map,
274+
moduleType: 'js',
266275
}
267276
}
268277
},

packages/plugin-vue-jsx/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { VueJSXPluginOptions } from '@vue/babel-plugin-jsx'
2-
import type { FilterPattern } from 'vite'
2+
import type { FilterPattern } from 'rolldown-vite'
33

44
export interface FilterOptions {
55
include?: FilterPattern

packages/plugin-vue/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@
3535
},
3636
"homepage": "https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#readme",
3737
"peerDependencies": {
38-
"vite": "^5.0.0 || ^6.0.0",
38+
"rolldown-vite": "catalog:",
3939
"vue": "^3.2.25"
4040
},
4141
"devDependencies": {
4242
"@jridgewell/gen-mapping": "^0.3.5",
4343
"@jridgewell/trace-mapping": "^0.3.25",
4444
"debug": "^4.3.7",
45-
"rollup": "^4.27.4",
45+
"rolldown": "catalog:",
4646
"slash": "^5.1.0",
4747
"source-map-js": "^1.2.1",
48-
"vite": "catalog:",
48+
"rolldown-vite": "catalog:",
4949
"vue": "catalog:"
5050
}
5151
}

packages/plugin-vue/src/handleHotUpdate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import _debug from 'debug'
22
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
3-
import type { HmrContext, ModuleNode } from 'vite'
4-
import { isCSSRequest } from 'vite'
3+
import type { HmrContext, ModuleNode } from 'rolldown-vite'
4+
import { isCSSRequest } from 'rolldown-vite'
55

66
// eslint-disable-next-line n/no-extraneous-import
77
import type * as t from '@babel/types'

packages/plugin-vue/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'node:fs'
2-
import type { Plugin, ViteDevServer } from 'vite'
3-
import { createFilter, normalizePath } from 'vite'
2+
import type { Plugin, ViteDevServer } from 'rolldown-vite'
3+
import { createFilter, normalizePath } from 'rolldown-vite'
44
import type {
55
SFCBlock,
66
SFCScriptCompileOptions,

packages/plugin-vue/src/main.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import path from 'node:path'
22
import fs from 'node:fs'
33
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
4-
import type { PluginContext, TransformPluginContext } from 'rollup'
4+
import type { PluginContext, TransformPluginContext } from 'rolldown'
55
import type { RawSourceMap } from 'source-map-js'
66
import type { EncodedSourceMap as TraceEncodedSourceMap } from '@jridgewell/trace-mapping'
77
import { TraceMap, eachMapping } from '@jridgewell/trace-mapping'
88
import type { EncodedSourceMap as GenEncodedSourceMap } from '@jridgewell/gen-mapping'
99
import { addMapping, fromMap, toEncodedMap } from '@jridgewell/gen-mapping'
10-
import { normalizePath, transformWithEsbuild } from 'vite'
10+
import { normalizePath, transformWithOxc } from 'rolldown-vite'
1111
import {
1212
createDescriptor,
1313
getDescriptor,
@@ -256,15 +256,16 @@ export async function transformMain(
256256
/tsx?$/.test(lang) &&
257257
!descriptor.script?.src // only normal script can have src
258258
) {
259-
const { code, map } = await transformWithEsbuild(
259+
const { code, map } = await transformWithOxc(
260+
pluginContext,
260261
resolvedCode,
261262
filename,
262263
{
263264
target: 'esnext',
264265
// #430 support decorators in .vue file
265266
// target can be overridden by esbuild config target
266-
...options.devServer?.config.esbuild,
267-
loader: 'ts',
267+
...options.devServer?.config.oxc,
268+
lang: 'ts',
268269
sourcemap: options.sourceMap,
269270
},
270271
resolvedMap,

packages/plugin-vue/src/style.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { SFCDescriptor } from 'vue/compiler-sfc'
2-
import type { ExistingRawSourceMap, TransformPluginContext } from 'rollup'
2+
import type { ExistingRawSourceMap, TransformPluginContext } from 'rolldown'
33
import type { RawSourceMap } from 'source-map-js'
4-
import { formatPostcssSourceMap } from 'vite'
4+
import { formatPostcssSourceMap } from 'rolldown-vite'
55
import type { ResolvedOptions } from './index'
66

77
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types

packages/plugin-vue/src/template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
SFCTemplateCompileOptions,
77
SFCTemplateCompileResults,
88
} from 'vue/compiler-sfc'
9-
import type { PluginContext, TransformPluginContext } from 'rollup'
9+
import type { PluginContext, TransformPluginContext } from 'rolldown'
1010
import { getResolvedScript, resolveScript } from './script'
1111
import { createRollupError } from './utils/error'
1212
import type { ResolvedOptions } from './index'

0 commit comments

Comments
 (0)