{
  "version": 3,
  "sources": ["../../../../src/packages/plugin-commands-outdated/utils.ts"],
  "sourcesContent": ["import type { OutdatedPackage } from '../outdated/index.ts';\nimport type { SEMVER_CHANGE } from '@pnpm/semver-diff';\n\nexport interface OutdatedWithVersionDiff extends OutdatedPackage {\n  change: SEMVER_CHANGE | null;\n  diff?: [string[], string[]];\n}\n\nexport type Comparator = (\n  o1: OutdatedWithVersionDiff,\n  o2: OutdatedWithVersionDiff\n) => number;\n\nexport const NAME_COMPARATOR: Comparator = (\n  o1: OutdatedWithVersionDiff,\n  o2: OutdatedWithVersionDiff\n): number => {\n  return o1.packageName.localeCompare(o2.packageName);\n};\n/**\n * Default comparators used as the argument to `ramda.sortWith()`.\n */\nexport const DEFAULT_COMPARATORS: Comparator[] = [\n  sortBySemverChange,\n  NAME_COMPARATOR,\n  (o1: OutdatedWithVersionDiff, o2: OutdatedWithVersionDiff): number => {\n    return typeof o1.current !== 'undefined' &&\n      typeof o2.current !== 'undefined'\n      ? o1.current.localeCompare(o2.current)\n      : 0;\n  },\n];\n\nexport function sortBySemverChange(\n  outdated1: OutdatedWithVersionDiff,\n  outdated2: OutdatedWithVersionDiff\n): number {\n  return pkgPriority(outdated1) - pkgPriority(outdated2);\n}\n\nfunction pkgPriority(pkg: OutdatedWithVersionDiff): number {\n  switch (pkg.change) {\n    case null: {\n      return 0;\n    }\n\n    case 'fix': {\n      return 1;\n    }\n\n    case 'feature': {\n      return 2;\n    }\n\n    case 'breaking': {\n      return 3;\n    }\n\n    default: {\n      return 4;\n    }\n  }\n}\n"],
  "mappings": "AAaO,MAAM,kBAA8B,CACzC,IACA,OACW;AACX,SAAO,GAAG,YAAY,cAAc,GAAG,WAAW;AACpD;AAIO,MAAM,sBAAoC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA,CAAC,IAA6B,OAAwC;AACpE,WAAO,OAAO,GAAG,YAAY,eAC3B,OAAO,GAAG,YAAY,cACpB,GAAG,QAAQ,cAAc,GAAG,OAAO,IACnC;AAAA,EACN;AACF;AAEO,SAAS,mBACd,WACA,WACQ;AACR,SAAO,YAAY,SAAS,IAAI,YAAY,SAAS;AACvD;AAEA,SAAS,YAAY,KAAsC;AACzD,UAAQ,IAAI,QAAQ;AAAA,IAClB,KAAK,MAAM;AACT,aAAO;AAAA,IACT;AAAA,IAEA,KAAK,OAAO;AACV,aAAO;AAAA,IACT;AAAA,IAEA,KAAK,WAAW;AACd,aAAO;AAAA,IACT;AAAA,IAEA,KAAK,YAAY;AACf,aAAO;AAAA,IACT;AAAA,IAEA,SAAS;AACP,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
  "names": []
}
