Minor refactor to browser prettier setup (#18749)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-01-26 01:13:42 +08:00
1 parent 5cbbc008bb
commit 68d6990fce
11 files changed
+10 -15

No files matched your search

+1 -1
View File
@@ -320,7 +320,7 @@ const configs = [
"scripts/**/*",
"benchmarks/**",
"tests/config/install-prettier.js",
"tests/config/browser/**/*",
"tests/config/browser-prettier/**/*",
],
rules: {
"no-console": "off",
+1 -1
View File
@@ -20,7 +20,7 @@ const config = {
"src/experimental-cli/index.js",
// Tests
"tests/config/browser/**",
"tests/config/browser-prettier/**",
],
project: ["src/**", "scripts/**"],
ignore: [
@@ -52,12 +52,9 @@ const proxyFunction = (accessPath, optionsIndex = 1) =>
},
);
const prettier = {
formatWithCursor: proxyFunction("formatWithCursor"),
getSupportInfo: proxyFunction("getSupportInfo", /* optionsIndex */ 0),
__debug: {
parse: proxyFunction("__debug.parse"),
},
};
export { prettier };
export const formatWithCursor = proxyFunction("formatWithCursor");
export const getSupportInfo = proxyFunction(
"getSupportInfo",
/* optionsIndex */ 0,
);
export const __debug = { parse: proxyFunction("__debug.parse") };
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1 -3
View File
@@ -3,9 +3,7 @@ import { pathToFileURL } from "node:url";
function getPrettierInternal() {
if (process.env.TEST_RUNTIME === "browser") {
return import("./browser/browser-prettier.js").then(
({ prettier }) => prettier,
);
return import("./browser-prettier/browser-prettier.js");
}
if (process.env.TEST_STANDALONE) {
+1 -1
View File
@@ -5,7 +5,7 @@ function installBrowserSync() {
"make-synchronized",
);
const { installBrowser } = makeSynchronized(
new URL("./browser/browser.js", import.meta.url),
new URL("./browser-prettier/browser.js", import.meta.url),
);
const browser = process.env.TEST_RUNTIME_BROWSER || "chrome";