Innovenergy_trunk/frontend/node_modules/@babel/helper-compilation-targets/lib/utils.js.map

1 line
4.3 KiB
Plaintext
Raw Normal View History

{"version":3,"names":["versionRegExp","v","OptionValidator","semverMin","first","second","semver","lt","semverify","version","valid","invariant","test","toString","pos","num","indexOf","repeat","isUnreleasedVersion","env","unreleasedLabel","unreleasedLabels","toLowerCase","getLowestUnreleased","a","b","getHighestUnreleased","getLowestImplementedVersion","plugin","environment","result","chrome"],"sources":["../src/utils.ts"],"sourcesContent":["import semver from \"semver\";\nimport { OptionValidator } from \"@babel/helper-validator-option\";\nimport { unreleasedLabels } from \"./targets\";\nimport type { Target, Targets } from \"./types\";\n\ndeclare const PACKAGE_JSON: { name: string; version: string };\n\nconst versionRegExp = /^(\\d+|\\d+.\\d+)$/;\n\nconst v = new OptionValidator(PACKAGE_JSON.name);\n\nexport function semverMin(\n first: string | undefined | null,\n second: string,\n): string {\n return first && semver.lt(first, second) ? first : second;\n}\n\n// Convert version to a semver value.\n// 2.5 -> 2.5.0; 1 -> 1.0.0;\nexport function semverify(version: number | string): string {\n if (typeof version === \"string\" && semver.valid(version)) {\n return version;\n }\n\n v.invariant(\n typeof version === \"number\" ||\n (typeof version === \"string\" && versionRegExp.test(version)),\n `'${version}' is not a valid version`,\n );\n\n version = version.toString();\n\n let pos = 0;\n let num = 0;\n while ((pos = version.indexOf(\".\", pos + 1)) > 0) {\n num++;\n }\n return version + \".0\".repeat(2 - num);\n}\n\nexport function isUnreleasedVersion(\n version: string | number,\n env: Target,\n): boolean {\n const unreleasedLabel =\n // @ts-expect-error unreleasedLabel will be guarded later\n unreleasedLabels[env];\n return (\n !!unreleasedLabel && unreleasedLabel === version.toString().toLowerCase()\n );\n}\n\nexport function getLowestUnreleased(a: string, b: string, env: Target): string {\n const unreleasedLabel:\n | typeof unreleasedLabels[keyof typeof unreleasedLabels]\n | undefined =\n // @ts-expect-error unreleasedLabel is undefined when env is not safari\n unreleasedLabels[env];\n if (a === unreleasedLabel) {\n return b;\n }\n if (b === unreleasedLabel) {\n return a;\n }\n return semverMin(a, b);\n}\n\nexport function getHighestUnreleased(\n a: string,\n b: string,\n env: Target,\n): string {\n return getLowestUnreleased(a, b, env) === a ? b : a;\n}\n\nexport function getLowestImplementedVersion(\n plugin: Targets,\n environment: Target,\n): string {\n const result = plugin[environment];\n // When Android support data is absent, use Chrome data as fallback\n if (!result && environment === \"android\") {\n return plugin.chrome;\n }\n return result;\n}\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AAKA,MAAMA,aAAa,GAAG,iBAAiB;AAEvC,MAAMC,CAAC,GAAG,IAAIC,sCAAe,qCAAmB;AAEzC,SAASC,SAAS,CACvBC,KAAgC,EAChCC,MAAc,EACN;EACR,OAAOD,KAAK,IAAIE,OAAM,CAACC,EAAE,CAACH,KAAK,EAAEC,MAAM,CAAC,GAAGD,KAAK,GAAGC,MAAM;AAC3D;;AAIO,SAASG,SAAS,CAACC,OAAwB,EAAU;EAC1D,IAAI,OAAOA,OAAO,KAAK,QAAQ,IAAIH,OAAM,CAACI,KAAK,CAACD,OAAO,CAAC,EAAE;IACxD,OAAOA,OAAO;EAChB;EAEAR,CAAC,CAACU,SAAS,CACT,OAAOF,OAAO,KAAK,QAAQ,IACxB,OAAOA,OAAO,KAAK,QAAQ,IAAIT,aAAa,CAACY,IAAI,CAACH,OAAO,CAAE,EAC7D,IAAGA,OAAQ,0BAAyB,CACtC;EAEDA,OAAO,GAAGA,OAAO,CAACI,QAAQ,EAAE;EAE5B,IAAIC,GAAG,GAAG,CAAC;EACX,IAAIC,GAAG,GAAG,CAAC;EACX,OAAO,CAACD,GAAG,GAAGL,OAAO,CAACO,OAAO,CAAC,GAAG,EAAEF,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE;IAChDC,GAAG,EAAE;EACP;EACA,OAAON,OAAO,GAAG,IAAI,CAACQ,MAAM,CAAC,CAAC,GAAGF,GAAG,CAAC;AACvC;AAEO,SAASG,mBAAmB,CACjCT,OAAwB,EACxB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