| 7787 | return path; |
| 7788 | } |
| 7789 | mapToBase(path) { |
| 7790 | if (typeof path === `string`) |
| 7791 | return path; |
| 7792 | if (path instanceof url.URL) |
| 7793 | return url.fileURLToPath(path); |
| 7794 | if (Buffer.isBuffer(path)) { |
| 7795 | const str = path.toString(); |
| 7796 | if (!isUtf8(path, str)) |
| 7797 | throw new Error(`Non-utf8 buffers are not supported at the moment. Please upvote the following issue if you encounter this error: https://github.com/yarnpkg/berry/issues/4942`); |
| 7798 | return str; |
| 7799 | } |
| 7800 | throw new Error(`Unsupported path type: ${nodeUtils.inspect(path)}`); |
| 7801 | } |
| 7802 | } |
| 7803 | function isUtf8(buf, str) { |
| 7804 | if (typeof buffer__default.default.isUtf8 !== `undefined`) |