84793f219dc3eeda236ec8ac2b973edc07e6a8ae061f1f9a4e81cf744b1a90b43576559eb1bcb9a250e7cbd1eaddfd8ddb735b4ac146739aeafb4de3e8713b 2.8 KB

1
  1. {"version":3,"names":["_helperCompilationTargets","require","compatData","logPlugin","item","targetVersions","list","filteredList","getInclusionReasons","support","startsWith","proposalName","slice","hasOwnProperty","call","console","log","formattedTargets","first","target","Object","keys","exports"],"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\" with { type: \"json\" };\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 if (!process.env.BABEL_8_BREAKING) {\n // It's needed to keep outputting proposal- 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.hasOwn(compatData, proposalName)\n ) {\n item = proposalName;\n }\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,IAAAA,yBAAA,GAAAC,OAAA;AAI2C,MACpCC,UAAU,GAAAD,OAAA,CAAM,4BAA4B;AAI5C,MAAME,SAAS,GAAGA,CACvBC,IAAY,EACZC,cAAuB,EACvBC,IAAgC,KAC7B;EACH,MAAMC,YAAY,GAAG,IAAAC,6CAAmB,EAACJ,IAAI,EAAEC,c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