{"version":3,"names":["semver","require","convert","babelParser","v","w","split","process","versions","node","resolve","r","paths","b","M","f","_findPath","_nodeModulePaths","concat","Error","code","isRunningMinSupportedCoreVersion","module","exports","parse","options","client","minSupportedCoreVersion","satisfies","getVersion","ast","parserOptions","maybeParse","convertFile","getTokLabels","getVisitorKeys","err","convertError"],"sources":["../src/parse.cts"],"sourcesContent":["\"use strict\";\n\nimport semver = require(\"semver\");\nimport convert = require(\"./convert/index.cts\");\nimport type { Options } from \"./types.cts\";\nimport type { Client } from \"./client.cts\";\n\nconst babelParser = require(\n require.resolve(\"@babel/parser\", {\n paths: [require.resolve(\"@babel/core/package.json\")],\n }),\n);\n\nlet isRunningMinSupportedCoreVersion: boolean = null;\n\nexport = function parse(code: string, options: Options, client: Client) {\n // Ensure we're using a version of `@babel/core` that includes `parse()` and `tokTypes`.\n const minSupportedCoreVersion = REQUIRED_VERSION(\">=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.convertFile(\n babelParser.parse(code, parserOptions),\n code,\n client.getTokLabels(),\n client.getVisitorKeys(),\n );\n } catch (err) {\n throw convert.convertError(err);\n }\n};\n"],"mappings":"AAAA,YAAY;;AAAC,MAENA,MAAM,GAAAC,OAAA,CAAW,QAAQ;AAAA,MACzBC,OAAO,GAAAD,OAAA,CAAW,qBAAqB;AAI9C,MAAME,WAAW,GAAGF,OAAO,CACzB,GAAAG,CAAA,EAAAC,CAAA,MAAAD,CAAA,GAAAA,CAAA,CAAAE,KAAA,OAAAD,CAAA,GAAAA,CAAA,C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