Drop color support for standalone build (#12182)

This commit is contained in:
fisker Cheung authored and GitHub committed 2022-01-28 18:27:27 +08:00
1 parent 08da4e55b0
commit e3efd11401
3 files changed
+25

No files matched your search

+8
View File
@@ -1,4 +1,5 @@
import path from "node:path";
import { createRequire } from "node:module";
import createEsmUtils from "esm-utils";
const { require } = createEsmUtils(import.meta);
@@ -184,6 +185,13 @@ const coreBundles = [
input: "src/standalone.js",
name: "prettier",
target: "universal",
replaceModule: {
[require.resolve("@babel/highlight")]: require.resolve(
"./shims/babel-highlight.cjs"
),
[createRequire(require.resolve("vnopts")).resolve("chalk")]:
require.resolve("./shims/chalk.cjs"),
},
},
{
input: "bin/prettier.js",
+6
View File
@@ -0,0 +1,6 @@
"use strict";
const chalk = require("./chalk.cjs");
const highlight = { shouldHighlight: () => false, getChalk: () => chalk };
module.exports = highlight;
+11
View File
@@ -0,0 +1,11 @@
"use strict";
const chalk = (x) => x;
chalk.grey = chalk;
chalk.red = chalk;
chalk.bold = chalk;
chalk.yellow = chalk;
chalk.blue = chalk;
chalk.default = chalk;
module.exports = chalk;