Share picocolors and leven with CLI (#17230)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-03-11 13:48:56 +08:00
1 parent 2baa787f6b
commit 0acd1cdff8
5 files changed
+21 -6

No files matched your search

+1 -1
View File
@@ -1,6 +1,5 @@
import fs from "node:fs/promises";
import path from "node:path";
import picocolors from "picocolors";
import * as prettier from "../index.js";
import { expandPatterns } from "./expand-patterns.js";
import findCacheFile from "./find-cache-file.js";
@@ -12,6 +11,7 @@ import {
createTwoFilesPatch,
errors,
mockable,
picocolors,
} from "./prettier-internal.js";
import { normalizeToPosix, statSafe } from "./utils.js";
+1 -1
View File
@@ -1,7 +1,7 @@
import readline from "node:readline";
import picocolors from "picocolors";
import stripAnsi from "strip-ansi";
import wcwidth from "wcwidth.js";
import { picocolors } from "./prettier-internal.js";
const countLines = (stream, text) => {
const columns = stream.columns || 80;
+6 -3
View File
@@ -1,6 +1,9 @@
import leven from "leven";
import picocolors from "picocolors";
import { normalizeOptions, vnopts } from "../prettier-internal.js";
import {
leven,
normalizeOptions,
picocolors,
vnopts,
} from "../prettier-internal.js";
const descriptor = {
key: (key) => (key.length === 1 ? `-${key}` : `--${key}`),
+2
View File
@@ -13,4 +13,6 @@ export const {
fastGlob,
createTwoFilesPatch,
mockable,
picocolors,
leven,
} = sharedWithCli;
+11 -1
View File
@@ -1,6 +1,14 @@
// "fast-glob" and `createTwoFilesPatch` are bundled here since the API uses `micromatch` and `diff` too
/*
The following are bundled here since they are used in API too
- fast-glob
- createTwoFilesPatch
- leven
- picocolors
*/
import { createTwoFilesPatch } from "diff";
import fastGlob from "fast-glob";
import leven from "leven";
import picocolors from "picocolors";
import * as vnopts from "vnopts";
import * as errors from "./common/errors.js";
import getFileInfoWithoutPlugins from "./common/get-file-info.js";
@@ -95,6 +103,8 @@ const sharedWithCli = {
},
fastGlob,
createTwoFilesPatch,
picocolors,
leven,
utils: {
omit,
},