UEA-PRODEM
This commit is contained in:
+18
-2
@@ -19,9 +19,9 @@ export default defineConfig({
|
||||
|
||||
## Options
|
||||
|
||||
### include/exclude
|
||||
### include
|
||||
|
||||
Includes `.js`, `.jsx`, `.ts` & `.tsx` and excludes `/node_modules/` by default. This option can be used to add fast refresh to `.mdx` files:
|
||||
Includes `.js`, `.jsx`, `.ts` & `.tsx` by default. This option can be used to add fast refresh to `.mdx` files:
|
||||
|
||||
```js
|
||||
import { defineConfig } from 'vite'
|
||||
@@ -36,6 +36,22 @@ export default defineConfig({
|
||||
})
|
||||
```
|
||||
|
||||
### exclude
|
||||
|
||||
The default value is `/node_modules/`. You may use it to exclude JSX/TSX files that runs in a worker or are not React files.
|
||||
Except if explicitly desired, you should keep `node_modules` in the exclude list:
|
||||
|
||||
```js
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
react({ exclude: [/\/pdf\//, /\.solid\.tsx$/, /\/node_modules\//] }),
|
||||
],
|
||||
})
|
||||
```
|
||||
|
||||
### jsxImportSource
|
||||
|
||||
Control where the JSX factory is imported from. By default, this is inferred from `jsxImportSource` from corresponding a tsconfig file for a transformed file.
|
||||
|
||||
+11
@@ -3,7 +3,18 @@ import { ParserOptions, TransformOptions } from "@babel/core";
|
||||
|
||||
//#region src/index.d.ts
|
||||
interface Options {
|
||||
/**
|
||||
* Can be used to process extra files like `.mdx`
|
||||
* @example include: /\.(mdx|js|jsx|ts|tsx)$/
|
||||
* @default /\.[tj]sx?$/
|
||||
*/
|
||||
include?: string | RegExp | Array<string | RegExp>;
|
||||
/**
|
||||
* Can be used to exclude JSX/TSX files that runs in a worker or are not React files.
|
||||
* Except if explicitly desired, you should keep node_modules in the exclude list
|
||||
* @example exclude: [/\/pdf\//, /\.solid\.tsx$/, /\/node_modules\//]
|
||||
* @default /\/node_modules\//
|
||||
*/
|
||||
exclude?: string | RegExp | Array<string | RegExp>;
|
||||
/**
|
||||
* Control where the JSX factory is imported from.
|
||||
|
||||
+11
-11
@@ -1,9 +1,9 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { exactRegex, makeIdFiltersToMatchWithQuery } from "@rolldown/pluginutils";
|
||||
import * as vite from "vite";
|
||||
import { createFilter } from "vite";
|
||||
import { exactRegex, makeIdFiltersToMatchWithQuery } from "@rolldown/pluginutils";
|
||||
|
||||
//#region ../common/refresh-utils.ts
|
||||
const runtimePublicPath = "/@react-refresh";
|
||||
@@ -184,14 +184,14 @@ function viteReact(opts = {}) {
|
||||
return newBabelOptions;
|
||||
})();
|
||||
const plugins = [...babelOptions.plugins];
|
||||
let reactCompilerPlugin$1 = getReactCompilerPlugin(plugins);
|
||||
if (reactCompilerPlugin$1 && ssr) {
|
||||
plugins.splice(plugins.indexOf(reactCompilerPlugin$1), 1);
|
||||
reactCompilerPlugin$1 = void 0;
|
||||
let reactCompilerPlugin = getReactCompilerPlugin(plugins);
|
||||
if (reactCompilerPlugin && ssr) {
|
||||
plugins.splice(plugins.indexOf(reactCompilerPlugin), 1);
|
||||
reactCompilerPlugin = void 0;
|
||||
}
|
||||
if (Array.isArray(reactCompilerPlugin$1) && reactCompilerPlugin$1[1]?.compilationMode === "annotation" && !compilerAnnotationRE.test(code)) {
|
||||
plugins.splice(plugins.indexOf(reactCompilerPlugin$1), 1);
|
||||
reactCompilerPlugin$1 = void 0;
|
||||
if (Array.isArray(reactCompilerPlugin) && reactCompilerPlugin[1]?.compilationMode === "annotation" && !compilerAnnotationRE.test(code)) {
|
||||
plugins.splice(plugins.indexOf(reactCompilerPlugin), 1);
|
||||
reactCompilerPlugin = void 0;
|
||||
}
|
||||
const isJSX = filepath.endsWith("x");
|
||||
const useFastRefresh = !(isRolldownVite || skipFastRefresh) && !ssr && (isJSX || (opts.jsxRuntime === "classic" ? importReactRE.test(code) : code.includes(jsxImportDevRuntime) || code.includes(jsxImportRuntime)));
|
||||
@@ -208,7 +208,7 @@ function viteReact(opts = {}) {
|
||||
root: projectRoot,
|
||||
filename: id,
|
||||
sourceFileName: filepath,
|
||||
retainLines: reactCompilerPlugin$1 ? false : !isProduction && isJSX && opts.jsxRuntime !== "classic",
|
||||
retainLines: reactCompilerPlugin ? false : !isProduction && isJSX && opts.jsxRuntime !== "classic",
|
||||
parserOpts: {
|
||||
...babelOptions.parserOpts,
|
||||
sourceType: "module",
|
||||
@@ -356,7 +356,7 @@ function viteReactForCjs(options) {
|
||||
}
|
||||
Object.assign(viteReactForCjs, { default: viteReactForCjs });
|
||||
function canSkipBabel(plugins, babelOptions) {
|
||||
return !(plugins.length || babelOptions.presets.length || babelOptions.configFile || babelOptions.babelrc);
|
||||
return !(plugins.length || babelOptions.presets.length || babelOptions.overrides.length || babelOptions.configFile || babelOptions.babelrc);
|
||||
}
|
||||
const loadedPlugin = /* @__PURE__ */ new Map();
|
||||
function loadPlugin(path) {
|
||||
|
||||
+42
-30
@@ -1,24 +1,33 @@
|
||||
{
|
||||
"name": "@vitejs/plugin-react",
|
||||
"version": "5.1.2",
|
||||
"license": "MIT",
|
||||
"author": "Evan You",
|
||||
"version": "5.2.0",
|
||||
"description": "The default Vite plugin for React projects",
|
||||
"keywords": [
|
||||
"vite",
|
||||
"vite-plugin",
|
||||
"react",
|
||||
"babel",
|
||||
"fast refresh",
|
||||
"react",
|
||||
"react-refresh",
|
||||
"fast refresh"
|
||||
"vite",
|
||||
"vite-plugin"
|
||||
],
|
||||
"homepage": "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vitejs/vite-plugin-react/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "Evan You",
|
||||
"contributors": [
|
||||
"Alec Larson",
|
||||
"Arnaud Barré"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vitejs/vite-plugin-react.git",
|
||||
"directory": "packages/plugin-react"
|
||||
},
|
||||
"files": [
|
||||
"types",
|
||||
"dist"
|
||||
"dist",
|
||||
"types"
|
||||
],
|
||||
"type": "module",
|
||||
"exports": {
|
||||
@@ -31,35 +40,38 @@
|
||||
"prepublishOnly": "npm run build",
|
||||
"test-unit": "vitest run"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vitejs/vite-plugin-react.git",
|
||||
"directory": "packages/plugin-react"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vitejs/vite-plugin-react/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#readme",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.28.5",
|
||||
"@babel/core": "^7.29.0",
|
||||
"@babel/plugin-transform-react-jsx-self": "^7.27.1",
|
||||
"@babel/plugin-transform-react-jsx-source": "^7.27.1",
|
||||
"@rolldown/pluginutils": "1.0.0-beta.53",
|
||||
"@rolldown/pluginutils": "1.0.0-rc.3",
|
||||
"@types/babel__core": "^7.20.5",
|
||||
"react-refresh": "^0.18.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/react-common": "workspace:*",
|
||||
"babel-plugin-react-compiler": "19.1.0-rc.3",
|
||||
"react": "^19.2.1",
|
||||
"react-dom": "^19.2.1",
|
||||
"rolldown": "1.0.0-beta.53",
|
||||
"tsdown": "^0.17.1"
|
||||
"react": "^19.2.4",
|
||||
"react-dom": "^19.2.4",
|
||||
"rolldown": "1.0.0-rc.3",
|
||||
"tsdown": "^0.20.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"compatiblePackages": {
|
||||
"schemaVersion": 1,
|
||||
"rolldown": {
|
||||
"type": "compatible",
|
||||
"versions": "^1.0.0-beta.44",
|
||||
"note": "You can use Rolldown's built-in feature directly."
|
||||
},
|
||||
"rollup": {
|
||||
"type": "incompatible",
|
||||
"reason": "Uses Rolldown-specific APIs or Vite-specific APIs"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user