diff options
Diffstat (limited to '.yarn/sdks/eslint/lib/api.js')
-rw-r--r-- | .yarn/sdks/eslint/lib/api.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/.yarn/sdks/eslint/lib/api.js b/.yarn/sdks/eslint/lib/api.js index 653b22ba..ea2b46a7 100644 --- a/.yarn/sdks/eslint/lib/api.js +++ b/.yarn/sdks/eslint/lib/api.js | |||
@@ -1,18 +1,25 @@ | |||
1 | #!/usr/bin/env node | 1 | #!/usr/bin/env node |
2 | 2 | ||
3 | const {existsSync} = require(`fs`); | 3 | const {existsSync} = require(`fs`); |
4 | const {createRequire} = require(`module`); | 4 | const {createRequire, register} = require(`module`); |
5 | const {resolve} = require(`path`); | 5 | const {resolve} = require(`path`); |
6 | const {pathToFileURL} = require(`url`); | ||
6 | 7 | ||
7 | const relPnpApiPath = "../../../../.pnp.cjs"; | 8 | const relPnpApiPath = "../../../../.pnp.cjs"; |
8 | 9 | ||
9 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); | 10 | const absPnpApiPath = resolve(__dirname, relPnpApiPath); |
10 | const absRequire = createRequire(absPnpApiPath); | 11 | const absRequire = createRequire(absPnpApiPath); |
11 | 12 | ||
13 | const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`); | ||
14 | const isPnpLoaderEnabled = existsSync(absPnpLoaderPath); | ||
15 | |||
12 | if (existsSync(absPnpApiPath)) { | 16 | if (existsSync(absPnpApiPath)) { |
13 | if (!process.versions.pnp) { | 17 | if (!process.versions.pnp) { |
14 | // Setup the environment to be able to require eslint | 18 | // Setup the environment to be able to require eslint |
15 | require(absPnpApiPath).setup(); | 19 | require(absPnpApiPath).setup(); |
20 | if (isPnpLoaderEnabled && register) { | ||
21 | register(pathToFileURL(absPnpLoaderPath)); | ||
22 | } | ||
16 | } | 23 | } |
17 | } | 24 | } |
18 | 25 | ||