UNPKG

@pnpm/core

Version:

Fast, disk space efficient installation engine

38 lines 1.87 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkCompatibility = checkCompatibility; const path_1 = __importDefault(require("path")); const constants_1 = require("@pnpm/constants"); const ModulesBreakingChangeError_1 = require("./ModulesBreakingChangeError"); const UnexpectedStoreError_1 = require("./UnexpectedStoreError"); const UnexpectedVirtualStoreDirError_1 = require("./UnexpectedVirtualStoreDirError"); function checkCompatibility(modules, opts) { if (!modules.layoutVersion || modules.layoutVersion !== constants_1.LAYOUT_VERSION) { throw new ModulesBreakingChangeError_1.ModulesBreakingChangeError({ modulesPath: opts.modulesDir, }); } // Important: comparing paths with path.relative() // is the only way to compare paths correctly on Windows // as of Node.js 4-9 // See related issue: https://github.com/pnpm/pnpm/issues/996 if (!modules.storeDir || path_1.default.relative(modules.storeDir, opts.storeDir) !== '' && path_1.default.relative(modules.storeDir, path_1.default.join(opts.storeDir, '../v3')) !== '') { throw new UnexpectedStoreError_1.UnexpectedStoreError({ actualStorePath: opts.storeDir, expectedStorePath: modules.storeDir, modulesDir: opts.modulesDir, }); } if (modules.virtualStoreDir && path_1.default.relative(modules.virtualStoreDir, opts.virtualStoreDir) !== '') { throw new UnexpectedVirtualStoreDirError_1.UnexpectedVirtualStoreDirError({ actual: opts.virtualStoreDir, expected: modules.virtualStoreDir, modulesDir: opts.modulesDir, }); } } //# sourceMappingURL=index.js.map