{
  "version": 3,
  "sources": ["../../../../src/packages/patching.config/verifyPatches.ts"],
  "sourcesContent": ["import { PnpmError } from '../error/index.ts';\nimport { globalWarn } from '../logger/index.ts';\nimport type { PatchGroupRecord } from '../patching.types/index.ts';\nimport { allPatchKeys } from './allPatchKeys.ts';\n\nexport type VerifyPatchesOptions = {\n  patchedDependencies: PatchGroupRecord;\n  appliedPatches: Set<string>;\n  allowUnusedPatches: boolean;\n};\n\nexport function verifyPatches({\n  patchedDependencies,\n  appliedPatches,\n  allowUnusedPatches,\n}: VerifyPatchesOptions): void {\n  const unusedPatches: string[] = [];\n\n  for (const patchKey of allPatchKeys(patchedDependencies)) {\n    if (!appliedPatches.has(patchKey)) unusedPatches.push(patchKey);\n  }\n\n  if (!unusedPatches.length) {\n    return;\n  }\n\n  const message = `The following patches were not used: ${unusedPatches.join(', ')}`;\n\n  if (allowUnusedPatches) {\n    globalWarn(message);\n\n    return;\n  }\n\n  throw new PnpmError('UNUSED_PATCH', message, {\n    hint: 'Either remove them from \"patchedDependencies\" or update them to match packages in your dependencies.',\n  });\n}\n"],
  "mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAQtB,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AACF,GAA+B;AAC7B,QAAM,gBAA0B,CAAC;AAEjC,aAAW,YAAY,aAAa,mBAAmB,GAAG;AACxD,QAAI,CAAC,eAAe,IAAI,QAAQ,EAAG,eAAc,KAAK,QAAQ;AAAA,EAChE;AAEA,MAAI,CAAC,cAAc,QAAQ;AACzB;AAAA,EACF;AAEA,QAAM,UAAU,wCAAwC,cAAc,KAAK,IAAI,CAAC;AAEhF,MAAI,oBAAoB;AACtB,eAAW,OAAO;AAElB;AAAA,EACF;AAEA,QAAM,IAAI,UAAU,gBAAgB,SAAS;AAAA,IAC3C,MAAM;AAAA,EACR,CAAC;AACH;",
  "names": []
}
