2021-12-03 15:41:12 +08:00
|
|
|
import path from "node:path";
|
|
|
|
|
import createEsmUtils from "esm-utils";
|
|
|
|
|
|
|
|
|
|
const { __dirname, require } = createEsmUtils(import.meta);
|
2020-01-15 22:55:08 +08:00
|
|
|
|
|
|
|
|
const isProduction = process.env.NODE_ENV === "production";
|
2021-02-11 00:50:59 +08:00
|
|
|
const { PRETTIER_DIR } = process.env;
|
|
|
|
|
const { bin } = require(path.join(PRETTIER_DIR, "package.json"));
|
2025-04-23 23:42:19 +08:00
|
|
|
const prettierCliEntry = path.join(
|
2021-02-11 00:50:59 +08:00
|
|
|
PRETTIER_DIR,
|
2020-01-15 22:55:08 +08:00
|
|
|
typeof bin === "object" ? bin.prettier : bin,
|
|
|
|
|
);
|
|
|
|
|
|
2023-12-05 14:39:11 +08:00
|
|
|
const prettierMainEntry = isProduction
|
|
|
|
|
? path.join(PRETTIER_DIR, "./index.mjs")
|
|
|
|
|
: path.join(PRETTIER_DIR, "./src/index.js");
|
2020-01-15 22:55:08 +08:00
|
|
|
|
2020-08-06 23:15:19 +08:00
|
|
|
const projectRoot = path.join(__dirname, "../..");
|
|
|
|
|
|
2025-04-23 23:42:19 +08:00
|
|
|
const prettierCliMockableEntry = isProduction
|
|
|
|
|
? path.join(PRETTIER_DIR, "./internal/legacy-cli.mjs")
|
|
|
|
|
: path.join(PRETTIER_DIR, "./src/cli/index.js");
|
|
|
|
|
|
|
|
|
|
export {
|
|
|
|
|
isProduction,
|
|
|
|
|
prettierCliEntry,
|
|
|
|
|
prettierCliMockableEntry,
|
|
|
|
|
prettierMainEntry,
|
|
|
|
|
projectRoot,
|
|
|
|
|
};
|