avyvar's picture
Add Vite Selfbench 27-task evaluation
8579f8a verified
Raw
History Blame Contribute Delete
5.01 kB
diff --git a/packages/vite/package.json b/packages/vite/package.json
index 54893c6001f0547f1776897aa2d7f555d0f8d72f..e30a040254087b6215b185cbb3afdde6e0e33707 100644
--- a/packages/vite/package.json
+++ b/packages/vite/package.json
@@ -73,7 +73,6 @@
},
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
"dependencies": {
- "@oxc-project/runtime": "0.120.0",
"lightningcss": "^1.32.0",
"picomatch": "^4.0.3",
"postcss": "^8.5.8",
diff --git a/packages/vite/src/node/plugins/index.ts b/packages/vite/src/node/plugins/index.ts
index 2f7cb28f2723eea17c4b98fbc12f0779d65599f6..662a2659162dff94f2c5dce6ded531dd57ab271e 100644
--- a/packages/vite/src/node/plugins/index.ts
+++ b/packages/vite/src/node/plugins/index.ts
@@ -4,6 +4,7 @@ import {
viteAliasPlugin as nativeAliasPlugin,
viteJsonPlugin as nativeJsonPlugin,
viteWasmFallbackPlugin as nativeWasmFallbackPlugin,
+ oxcRuntimePlugin,
} from 'rolldown/experimental'
import type { PluginHookUtils, ResolvedConfig } from '../config'
import {
@@ -94,6 +95,8 @@ export async function resolvePlugins(
htmlInlineProxyPlugin(config),
cssPlugin(config),
esbuildBannerFooterCompatPlugin(config),
+ // @oxc-project/runtime resolution is handled by rolldown in build
+ config.oxc !== false && !isBundled ? oxcRuntimePlugin() : null,
config.oxc !== false ? oxcPlugin(config) : null,
nativeJsonPlugin({ ...config.json, minify: isBuild }),
wasmHelperPlugin(),
diff --git a/packages/vite/src/node/plugins/oxc.ts b/packages/vite/src/node/plugins/oxc.ts
index e0e30e8224d7b9deb4a0a1c8f16f839d98f600a0..ede897068e17a920e4e944fe58be894191bffd8a 100644
--- a/packages/vite/src/node/plugins/oxc.ts
+++ b/packages/vite/src/node/plugins/oxc.ts
@@ -7,7 +7,6 @@ import { transformSync } from 'rolldown/utils'
import { viteTransformPlugin as nativeTransformPlugin } from 'rolldown/experimental'
import type { RolldownError, RolldownLog, SourceMap } from 'rolldown'
import colors from 'picocolors'
-import { prefixRegex } from 'rolldown/filter'
import type { FSWatcher } from '#dep-types/chokidar'
import { createFilter, ensureWatchedFile, normalizePath } from '../utils'
import type { ResolvedConfig } from '../config'
@@ -15,7 +14,7 @@ import type { Plugin } from '../plugin'
import { cleanUrl } from '../../shared/utils'
import { type Environment, perEnvironmentPlugin } from '..'
import type { ViteDevServer } from '../server'
-import { JS_TYPES_RE, VITE_PACKAGE_DIR } from '../constants'
+import { JS_TYPES_RE } from '../constants'
import type { Logger } from '../logger'
import { type ESBuildOptions, getTSConfigResolutionCache } from './esbuild'
@@ -299,9 +298,6 @@ export function oxcPlugin(config: ResolvedConfig): Plugin {
return result
}
- const runtimeResolveBase = normalizePath(
- path.join(VITE_PACKAGE_DIR, 'package.json'),
- )
let server: ViteDevServer
@@ -310,23 +306,6 @@ export function oxcPlugin(config: ResolvedConfig): Plugin {
configureServer(_server) {
server = _server
},
- // @oxc-project/runtime resolution is handled by rolldown in build
- ...(config.command === 'serve'
- ? {
- resolveId: {
- filter: {
- id: prefixRegex('@oxc-project/runtime/'),
- },
- async handler(id, _importer, opts) {
- // @oxc-project/runtime imports will be injected by Oxc transform
- // since it's injected by the transform, @oxc-project/runtime should be resolved to the one Vite depends on
- const resolved = await this.resolve(id, runtimeResolveBase, opts)
- return resolved
- },
- order: 'pre',
- },
- }
- : {}),
async transform(code, id) {
if (filter(id) || filter(cleanUrl(id)) || jsxRefreshFilter?.(id)) {
const modifiedOxcTransformOptions = getModifiedOxcTransformOptions(
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7ce254492e9b24cfe07584d7dfc369349ab9ff8d..4ef381c1201db4782907b3d41ab9900b0f6fb2b9 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -237,9 +237,6 @@ importers:
packages/vite:
dependencies:
- '@oxc-project/runtime':
- specifier: 0.120.0
- version: 0.120.0
lightningcss:
specifier: ^1.32.0
version: 1.32.0
@@ -3092,10 +3089,6 @@ packages:
cpu: [x64]
os: [win32]
- '@oxc-project/runtime@0.120.0':
- resolution: {integrity: sha512-7fvACzS46TkHuzA+Tag8ac40qfwURXRTdc4AtyItF59AoNPOO/QjPMqPyvJH8CaUdGu0ntWDX1CCUNyLMxxX5g==}
- engines: {node: ^20.19.0 || >=22.12.0}
-
'@oxc-project/types@0.120.0':
resolution: {integrity: sha512-k1YNu55DuvAip/MGE1FTsIuU3FUCn6v/ujG9V7Nq5Df/kX2CWb13hhwD0lmJGMGqE+bE1MXvv9SZVnMzEXlWcg==}
@@ -9222,8 +9215,6 @@ snapshots:
'@oxc-minify/binding-win32-x64-msvc@0.120.0':
optional: true
- '@oxc-project/runtime@0.120.0': {}
-
'@oxc-project/types@0.120.0': {}
'@package-json/types@0.0.12': {}