{
  "version": 3,
  "sources": ["../../../../../../src/packages/core/install/checkCompatibility/index.ts"],
  "sourcesContent": ["import path from 'node:path';\nimport { LAYOUT_VERSION } from '../../../constants/index.ts';\nimport type { Modules } from '../../../modules-yaml/index.ts';\nimport { ModulesBreakingChangeError } from './ModulesBreakingChangeError.ts';\nimport { UnexpectedStoreError } from './UnexpectedStoreError.ts';\nimport { UnexpectedVirtualStoreDirError } from './UnexpectedVirtualStoreDirError.ts';\nimport type { ModulesDir } from 'src/packages/types/project.ts';\n\nexport function checkCompatibility(\n  modules: Modules,\n  opts: {\n    storeDir: string;\n    modulesDir: ModulesDir;\n    virtualStoreDir: string;\n  }\n): void {\n  if (!modules.layoutVersion || modules.layoutVersion !== LAYOUT_VERSION) {\n    throw new ModulesBreakingChangeError({\n      modulesPath: opts.modulesDir,\n    });\n  }\n\n  // Important: comparing paths with path.relative()\n  // is the only way to compare paths correctly on Windows\n  // as of Node.js 4-9\n  // See related issue: https://github.com/pnpm/pnpm/issues/996\n  if (\n    !modules.storeDir ||\n    (path.relative(modules.storeDir, opts.storeDir) !== '' &&\n      path.relative(modules.storeDir, path.join(opts.storeDir, '../v3')) !== '')\n  ) {\n    throw new UnexpectedStoreError({\n      actualStorePath: opts.storeDir,\n      expectedStorePath: modules.storeDir,\n      modulesDir: opts.modulesDir,\n    });\n  }\n\n  if (\n    modules.virtualStoreDir &&\n    path.relative(modules.virtualStoreDir, opts.virtualStoreDir) !== ''\n  ) {\n    throw new UnexpectedVirtualStoreDirError({\n      actual: opts.virtualStoreDir,\n      expected: modules.virtualStoreDir,\n      modulesDir: opts.modulesDir,\n    });\n  }\n}\n"],
  "mappings": "AAAA,OAAO,UAAU;AACjB,SAAS,sBAAsB;AAE/B,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AACrC,SAAS,sCAAsC;AAGxC,SAAS,mBACd,SACA,MAKM;AACN,MAAI,CAAC,QAAQ,iBAAiB,QAAQ,kBAAkB,gBAAgB;AACtE,UAAM,IAAI,2BAA2B;AAAA,MACnC,aAAa,KAAK;AAAA,IACpB,CAAC;AAAA,EACH;AAMA,MACE,CAAC,QAAQ,YACR,KAAK,SAAS,QAAQ,UAAU,KAAK,QAAQ,MAAM,MAClD,KAAK,SAAS,QAAQ,UAAU,KAAK,KAAK,KAAK,UAAU,OAAO,CAAC,MAAM,IACzE;AACA,UAAM,IAAI,qBAAqB;AAAA,MAC7B,iBAAiB,KAAK;AAAA,MACtB,mBAAmB,QAAQ;AAAA,MAC3B,YAAY,KAAK;AAAA,IACnB,CAAC;AAAA,EACH;AAEA,MACE,QAAQ,mBACR,KAAK,SAAS,QAAQ,iBAAiB,KAAK,eAAe,MAAM,IACjE;AACA,UAAM,IAAI,+BAA+B;AAAA,MACvC,QAAQ,KAAK;AAAA,MACb,UAAU,QAAQ;AAAA,MAClB,YAAY,KAAK;AAAA,IACnB,CAAC;AAAA,EACH;AACF;",
  "names": []
}
