UEA-PRODEM
This commit is contained in:
+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) {
|
||||
|
||||
Reference in New Issue
Block a user