1 |
- {"version":3,"names":["semver","require","convert","babelParser","paths","resolve","isRunningMinSupportedCoreVersion","module","exports","parse","code","options","client","minSupportedCoreVersion","satisfies","getVersion","Error","ast","parserOptions","maybeParse","getTokLabels","getVisitorKeys","err","error"],"sources":["../src/parse.cjs"],"sourcesContent":["\"use strict\";\n\nconst semver = require(\"semver\");\nconst convert = require(\"./convert/index.cjs\");\n\nconst babelParser = require(require.resolve(\"@babel/parser\", {\n paths: [require.resolve(\"@babel/core/package.json\")],\n}));\n\nlet isRunningMinSupportedCoreVersion = null;\n\nmodule.exports = function parse(code, options, client) {\n // Ensure we're using a version of `@babel/core` that includes `parse()` and `tokTypes`.\n const minSupportedCoreVersion = \">=7.2.0\";\n\n if (typeof isRunningMinSupportedCoreVersion !== \"boolean\") {\n isRunningMinSupportedCoreVersion = semver.satisfies(\n client.getVersion(),\n minSupportedCoreVersion,\n );\n }\n\n if (!isRunningMinSupportedCoreVersion) {\n throw new Error(\n `@babel/eslint-parser@${\n PACKAGE_JSON.version\n } does not support @babel/core@${client.getVersion()}. Please upgrade to @babel/core@${minSupportedCoreVersion}.`,\n );\n }\n\n const { ast, parserOptions } = client.maybeParse(code, options);\n\n if (ast) return ast;\n\n try {\n return convert.ast(\n babelParser.parse(code, parserOptions),\n code,\n client.getTokLabels(),\n client.getVisitorKeys(),\n );\n } catch (err) {\n throw convert.error(err);\n }\n};\n"],"mappings":"AAAA;;AAEA,MAAMA,MAAM,GAAGC,OAAO,CAAC,QAAD,CAAtB;;AACA,MAAMC,OAAO,GAAGD,OAAO,CAAC,qBAAD,CAAvB;;AAEA,MAAME,WAAW,GAAGF,OAAO,CAAC;EAAA;AAAA;EAAA;;EAAA;EAAA;EAAA;EAAA;AAAA,GAAgB,eAAhB,EAAiC;EAC3DG,KAAK,EAAE,CAACH,OAAO,CAACI,OAAR,CAAgB,0BAAhB,CAAD;AADoD,CAAjC,CAAD,CAA3B;;AAIA,IAAIC,gCAAgC,GAAG,IAAvC;;AAEAC,MAAM,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