You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
2.8 KiB
1 line
2.8 KiB
{"version":3,"names":["_path","require","_module","_default","moduleName","dirname","absoluteRuntime","resolveAbsoluteRuntime","path","resolve","v","w","split","process","versions","node","r","paths","b","M","f","_findPath","_nodeModulePaths","concat","Error","code","replace","err","Object","assign","runtime","resolveFSPath"],"sources":["../../src/get-runtime-path/index.ts"],"sourcesContent":["import path from \"path\";\n\nimport { createRequire } from \"module\";\nconst require = createRequire(import.meta.url);\n\nexport default function (\n moduleName: string,\n dirname: string,\n absoluteRuntime: string | boolean,\n) {\n if (absoluteRuntime === false) return moduleName;\n\n return resolveAbsoluteRuntime(\n moduleName,\n path.resolve(dirname, absoluteRuntime === true ? \".\" : absoluteRuntime),\n );\n}\n\nfunction resolveAbsoluteRuntime(moduleName: string, dirname: string) {\n try {\n return path\n .dirname(\n require.resolve(`${moduleName}/package.json`, { paths: [dirname] }),\n )\n .replace(/\\\\/g, \"/\");\n } catch (err) {\n if (err.code !== \"MODULE_NOT_FOUND\") throw err;\n\n throw Object.assign(\n new Error(`Failed to resolve \"${moduleName}\" relative to \"${dirname}\"`),\n {\n code: \"BABEL_RUNTIME_NOT_FOUND\",\n runtime: moduleName,\n dirname,\n },\n );\n }\n}\n\nexport function resolveFSPath(path: string) {\n return require.resolve(path).replace(/\\\\/g, \"/\");\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAGe,SAAAE,SACbC,UAAkB,EAClBC,OAAe,EACfC,eAAiC,EACjC;EACA,IAAIA,eAAe,KAAK,KAAK,EAAE,OAAOF,UAAU;EAEhD,OAAOG,sBAAsB,CAC3BH,UAAU,EACVI,KAAI,CAACC,OAAO,CAACJ,OAAO,EAAEC,eAAe,KAAK,IAAI,GAAG,GAAG,GAAGA,eAAe,CACxE,CAAC;AACH;AAEA,SAASC,sBAAsBA,CAACH,UAAkB,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