debug.js.map 2.6 KB
{"version":3,"names":["logPlugin","item","targetVersions","list","filteredList","getInclusionReasons","support","startsWith","proposalName","slice","Object","prototype","hasOwnProperty","call","compatData","console","log","formattedTargets","first","target","keys"],"sources":["../src/debug.ts"],"sourcesContent":["import {\n  getInclusionReasons,\n  type Targets,\n  type Target,\n} from \"@babel/helper-compilation-targets\";\nimport compatData from \"@babel/compat-data/plugins\";\n\n// Outputs a message that shows which target(s) caused an item to be included:\n// transform-foo { \"edge\":\"13\", \"firefox\":\"49\", \"ie\":\"10\" }\nexport const logPlugin = (\n  item: string,\n  targetVersions: Targets,\n  list: { [key: string]: Targets },\n) => {\n  const filteredList = getInclusionReasons(item, targetVersions, list);\n\n  const support = list[item];\n\n  // TODO(Babel 8): Remove this. It's needed to keep outputting proposal-\n  // in the debug log.\n  if (item.startsWith(\"transform-\")) {\n    const proposalName = `proposal-${item.slice(10)}`;\n    if (\n      proposalName === \"proposal-dynamic-import\" ||\n      Object.prototype.hasOwnProperty.call(compatData, proposalName)\n    ) {\n      item = proposalName;\n    }\n  }\n\n  if (!support) {\n    console.log(`  ${item}`);\n    return;\n  }\n\n  let formattedTargets = `{`;\n  let first = true;\n  for (const target of Object.keys(filteredList) as Target[]) {\n    if (!first) formattedTargets += `,`;\n    first = false;\n    formattedTargets += ` ${target}`;\n    if (support[target]) formattedTargets += ` < ${support[target]}`;\n  }\n  formattedTargets += ` }`;\n\n  console.log(`  ${item} ${formattedTargets}`);\n};\n"],"mappings":";;;;;;AAAA;AAKA;AAIO,MAAMA,SAAS,GAAG,CACvBC,IAAY,EACZC,cAAuB,EACvBC,IAAgC,KAC7B;EACH,MAAMC,YAAY,GAAG,IAAAC,6CAAmB,EAACJ,IAAI,EAAEC,cAAc,EAAEC,IAAI,CAAC;EAEpE,MAAMG,OAAO,GAAGH,IAAI,CAACF,IAAI,CAAC;;EAI1B,IAAIA,IAAI,CAACM,UAAU,CAAC,YAAY,CAAC,EAAE;IACjC,MAAMC,YAAY,GAAI,YAAWP,IAAI,CAACQ,KAAK,CAAC,EAAE,CAAE,EAAC;IACjD,IACED,YAAY,KAAK,yBAAyB,IAC1CE,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACC,QAAU,EAAEN,YAAY,CAAC,EAC9D;MACAP,IAAI,GAAGO,YAAY;IACrB;EACF;EAEA,IAAI,CAACF,OAAO,EAAE;IACZS,OAAO,CAACC,GAAG,CAAE,KAAIf,IAAK,EAAC,CAAC;IACxB;EACF;EAEA,IAAIgB,gBAAgB,GAAI,GAAE;EAC1B,IAAIC,KAAK,GAAG,IAAI;EAChB,KAAK,MAAMC,MAAM,IAAIT,MAAM,CAACU,IAAI,CAAChB,YAAY,CAAC,EAAc;IAC1D,IAAI,CAACc,KAAK,EAAED,gBAAgB,IAAK,GAAE;IACnCC,KAAK,GAAG,KAAK;IACbD,gBAAgB,IAAK,IAAGE,MAAO,EAAC;IAChC,IAAIb,OAAO,CAACa,MAAM,CAAC,EAAEF,gBAAgB,IAAK,MAAKX,OAAO,CAACa,MAAM,CAAE,EAAC;EAClE;EACAF,gBAAgB,IAAK,IAAG;EAExBF,OAAO,CAACC,GAAG,CAAE,KAAIf,IAAK,IAAGgB,gBAAiB,EAAC,CAAC;AAC9C,CAAC;AAAC"}