{"version":3,"file":"which-tsc.d.ts","sourceRoot":"","sources":["../../src/which-tsc.ts"],"names":[],"mappings":";AAgCA,wBAAkE","sourcesContent":["// find the location of the tsc binary\n// This is necessary because pnpm install trees don't expose binaries\n// of meta-deps, and it's nicer to not require that the tshy user has\n// a dep on typescript directly if they don't need it otherwise.\n// However, if they DO have a direct dep on typescript, then load the\n// tsc from their local node_modules/.bin/tsc location.\nimport { resolveImport } from 'resolve-import/resolve-import-async'\nimport { fileURLToPath } from 'url'\nimport config from './config.js'\n\nconst provider = {\n  tsgo: '@typescript/native-preview',\n  tsc: 'typescript',\n} as const\n\nconst pjToCompilerPath = {\n  tsgo: 'bin/tsgo.js',\n  tsc: 'bin/tsc',\n} as const\n\n// use theirs if possible, otherwise use tshy's\nconst resolve = async (pkg: (typeof provider)[keyof typeof provider]) =>\n  await resolveImport(pkg + '/package.json', process.cwd() + '/x').catch(\n    () => resolveImport(pkg + '/package.json', import.meta.url),\n  )\n\nconst { compiler = 'tsc' } = config\nconst provPkg = provider[compiler]\n\nconst pjToCompiler = (pj: string) =>\n  pj.slice(0, -1 * 'package.json'.length) + pjToCompilerPath[compiler]\n\nexport default pjToCompiler(fileURLToPath(await resolve(provPkg)))\n"]}