{"version":3,"file":"resolvePackageRootFolder.js","sourceRoot":"","sources":["../../src/utils/resolvePackageRootFolder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAA6B;AAC7B,2CAA6B;AAC7B,gEAAuC;AAEvC,SAAgB,wBAAwB,CAAC,aAAqB,EAAE,QAAgB;IAC9E,MAAM,QAAQ,GAAG,sBAAW,CAAC,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAC7D,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,kDAAkD;IAClD,MAAM,WAAW,GAAG,iBAAM,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IACnE,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,8CAA8C;IAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AARD,4DAQC","sourcesContent":["import findUp from 'find-up';\nimport * as path from 'path';\nimport resolveFrom from 'resolve-from';\n\nexport function resolvePackageRootFolder(fromDirectory: string, moduleId: string): string | null {\n const resolved = resolveFrom.silent(fromDirectory, moduleId);\n if (!resolved) return null;\n // Get the closest package.json to the node module\n const packageJson = findUp.sync('package.json', { cwd: resolved });\n if (!packageJson) return null;\n // resolve the root folder for the node module\n return path.dirname(packageJson);\n}\n"]}