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

28 lines
877 B
JavaScript
Raw Normal View History

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