Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node_version: [18, 20]
node_version: [20, 22, 24]
include:
# Active LTS + other OS
- os: macos-latest
node_version: 20
node_version: 22
- os: windows-latest
node_version: 20
node_version: 22
fail-fast: false

name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}"
Expand Down
6 changes: 3 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ export default tseslint.config(
'n/no-unsupported-features/es-builtins': [
'error',
{
version: '^18.0.0 || >=20.0.0',
version: '^20.19.0 || >=22.12.0',
},
],
'n/no-unsupported-features/node-builtins': [
'error',
{
version: '^18.0.0 || >=20.0.0',
version: '^20.19.0 || >=22.12.0',
},
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
Expand All @@ -150,7 +150,7 @@ export default tseslint.config(
'n/no-unsupported-features/node-builtins': [
'error',
{
version: '^18.0.0 || >=20.0.0',
version: '^20.19.0 || >=22.12.0',
allowExperimental: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"type": "module",
"engines": {
"node": "^18.0.0 || >=20.0.0"
"node": "^20.19.0 || >=22.12.0"
},
"homepage": "https://github.com/vitejs/vite-plugin-vue/",
"repository": {
Expand Down
3 changes: 0 additions & 3 deletions packages/plugin-vue-jsx/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ export default defineBuildConfig({
entries: ['src/index'],
clean: true,
declaration: true,
rollup: {
emitCJS: true,
},
})
17 changes: 4 additions & 13 deletions packages/plugin-vue-jsx/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
{
"name": "@vitejs/plugin-vue-jsx",
"version": "4.2.0",
"type": "commonjs",
"type": "module",
"license": "MIT",
"author": "Evan You",
"files": [
"dist"
],
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"exports": "./dist/index.mjs",
"scripts": {
"dev": "unbuild --stub",
"build": "unbuild && pnpm run patch-cjs",
"patch-cjs": "tsx ../../scripts/patchCJS.ts",
"build": "unbuild",
"prepublishOnly": "npm run build"
},
"engines": {
"node": "^18.0.0 || >=20.0.0"
"node": "^20.19.0 || >=22.12.0"
},
"repository": {
"type": "git",
Expand Down
22 changes: 11 additions & 11 deletions packages/plugin-vue-jsx/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@rolldown/pluginutils'
import type { Options } from './types'

export * from './types'
export type * from './types'

const ssrRegisterHelperId = '/__vue-jsx-ssr-register-helper'
const ssrRegisterHelperCode =
Expand Down Expand Up @@ -328,17 +328,17 @@ function isDefineComponentCall(
)
}

const hash =
// eslint-disable-next-line n/no-unsupported-features/node-builtins -- crypto.hash is supported in Node 21.7.0+, 20.12.0+
crypto.hash ??
((
algorithm: string,
data: crypto.BinaryLike,
outputEncoding: crypto.BinaryToTextEncoding,
) => crypto.createHash(algorithm).update(data).digest(outputEncoding))

function getHash(text: string) {
return hash('sha256', text, 'hex').substring(0, 8)
return crypto.hash('sha256', text, 'hex').substring(0, 8)
}

export default vueJsxPlugin

// Compat for require
function vueJsxPluginCjs(this: unknown, options: Options): Plugin {
return vueJsxPlugin.call(this, options)
}
Object.assign(vueJsxPluginCjs, {
default: vueJsxPluginCjs,
})
export { vueJsxPluginCjs as 'module.exports' }
6 changes: 3 additions & 3 deletions packages/plugin-vue-jsx/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist",
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "Node",
"target": "es2023",
"module": "preserve",
"moduleResolution": "bundler",
"strict": true,
"declaration": true,
"sourceMap": true,
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-vue/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export default defineBuildConfig({
clean: true,
declaration: 'compatible',
rollup: {
emitCJS: true,
inlineDependencies: true,
},
})
17 changes: 4 additions & 13 deletions packages/plugin-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
{
"name": "@vitejs/plugin-vue",
"version": "6.0.0-beta.1",
"type": "commonjs",
"type": "module",
"license": "MIT",
"author": "Evan You",
"files": [
"dist"
],
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"exports": "./dist/index.mjs",
"scripts": {
"dev": "unbuild --stub",
"build": "unbuild && pnpm run patch-cjs",
"patch-cjs": "tsx ../../scripts/patchCJS.ts",
"build": "unbuild",
"prepublishOnly": "npm run build"
},
"engines": {
"node": "^18.0.0 || >=20.0.0"
"node": "^20.19.0 || >=22.12.0"
},
"repository": {
"type": "git",
Expand Down
10 changes: 10 additions & 0 deletions packages/plugin-vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,13 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
function ensureArray<T>(value: T | T[]): T[] {
return Array.isArray(value) ? value : [value]
}

// Compat for require
function vuePluginCjs(this: unknown, options: Options): Plugin<Api> {
return vuePlugin.call(this, options)
}
Object.assign(vuePluginCjs, {
default: vuePluginCjs,
parseVueRequest,
})
export { vuePluginCjs as 'module.exports' }
6 changes: 3 additions & 3 deletions packages/plugin-vue/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist",
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "node",
"target": "es2023",
"module": "preserve",
"moduleResolution": "bundler",
"strict": true,
"declaration": true,
"sourceMap": true,
Expand Down
2 changes: 1 addition & 1 deletion playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"include": ["."],
"exclude": ["**/dist/**"],
"compilerOptions": {
"target": "ES2020",
"target": "ES2023",
"module": "ESNext",
"outDir": "dist",
"baseUrl": ".",
Expand Down
57 changes: 0 additions & 57 deletions scripts/patchCJS.ts

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"$schema": "https://json.schemastore.org/tsconfig",
"include": ["."],
"compilerOptions": {
"module": "ES2020",
"target": "ES2020",
"moduleResolution": "Node",
"target": "es2023",
"module": "preserve",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
Expand Down