Update babel to v8.0.0-rc.1 (#18822)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-02-01 08:57:18 +08:00
1 parent cc38e7430d
commit 88ee8a5b3e
21 files changed
+301 -177

No files matched your search

+5 -1
View File
@@ -4,7 +4,10 @@ import browserslistToEsbuild from "browserslist-to-esbuild";
import esbuild from "esbuild";
import createEsmUtils from "esm-utils";
import projectPackageJson from "../../../package.json" with { type: "json" };
import { PRODUCTION_MINIMAL_NODE_JS_VERSION } from "../../utilities/index.js";
import {
PRODUCTION_MINIMAL_NODE_JS_VERSION,
PROJECT_ROOT,
} from "../../utilities/index.js";
import esbuildPluginAddDefaultExport from "../esbuild-plugins/add-default-export.js";
import esbuildPluginEvaluate from "../esbuild-plugins/evaluate.js";
import esbuildPluginPrimitiveDefine from "../esbuild-plugins/primitive-define.js";
@@ -223,6 +226,7 @@ function getEsbuildOptions({ packageConfig, file, cliOptions, buildOptions }) {
"class-private-method": true,
},
packages: "bundle",
absWorkingDir: PROJECT_ROOT,
};
if (buildOptions.platform === "universal") {
+10 -39
View File
@@ -75,6 +75,16 @@ const mainModule = {
find: "export default lib;",
replacement: "export default { parse };",
},
{
module: require.resolve("@babel/code-frame"),
process(text) {
text = text.replace(
"from 'node:util'",
`from ${JSON.stringify(path.join(dirname, "../shims/node-util.js"))}`,
);
return text;
},
},
],
addDefaultExport: true,
reuseDocModule: true,
@@ -85,45 +95,6 @@ const mainModule = {
input: "src/standalone.js",
umdVariableName: "prettier",
replaceModule: [
{
module: require.resolve("@babel/code-frame"),
process(text) {
text = text.replaceAll(
/(?<=\n)let tokenize;\n\{\n.*?\n\}(?=\n)/gs,
"",
);
text = text.replaceAll(
/(?<=\n)function highlight\(text\) \{\n.*?\n\}(?=\n)/gs,
"function highlight(text) {return text}",
);
text = text.replaceAll(
/(?<=\n)function getDefs\(enabled\) \{\n.*?\n\}(?=\n)/gs,
outdent`
function getDefs() {
return new Proxy({}, {get: () => (text) => text})
}
`,
);
text = text.replaceAll(
"const defsOn = buildDefs(picocolors.createColors(true));",
"",
);
text = text.replaceAll(
"const defsOff = buildDefs(picocolors.createColors(false));",
"",
);
text = text.replaceAll(
"const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;",
"const shouldHighlight = false;",
);
return text;
},
},
// Smaller size
{
module: getPackageFile("picocolors/picocolors.browser.js"),
+4
View File
@@ -0,0 +1,4 @@
import * as util from "node:util";
export const styleText =
util.styleText ?? ((format, text /* , options*/) => text);