bot/.yarn/sdks/prettier/bin/prettier.cjs

28 lines
877 B
JavaScript
Raw Normal View History

2023-06-18 03:57:02 +00:00
#!/usr/bin/env node
const {existsSync} = require(`fs`);
2024-06-21 15:02:56 +00:00
const {createRequire, register} = require(`module`);
2023-06-18 03:57:02 +00:00
const {resolve} = require(`path`);
2024-06-21 15:02:56 +00:00
const {pathToFileURL} = require(`url`);
2023-06-18 03:57:02 +00:00
2023-11-23 11:30:10 +00:00
const relPnpApiPath = "../../../../.pnp.cjs";
2023-06-18 03:57:02 +00:00
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
2024-06-21 15:02:56 +00:00
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
2023-06-18 03:57:02 +00:00
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
2023-11-23 11:30:10 +00:00
// Setup the environment to be able to require prettier/bin/prettier.cjs
2023-06-18 03:57:02 +00:00
require(absPnpApiPath).setup();
2024-06-21 15:02:56 +00:00
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
2023-06-18 03:57:02 +00:00
}
}
2023-11-23 11:30:10 +00:00
// Defer to the real prettier/bin/prettier.cjs your application uses
module.exports = absRequire(`prettier/bin/prettier.cjs`);