flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
1 lines • 1.23 kB
Source Map (JSON)
{"version":3,"file":"get-module-package-json.cjs","sources":["../../../src/cli/utils/get-module-package-json.ts"],"sourcesContent":["import { createRequire } from \"module\";\n\n/**\n * Gets the package.json contents for a given package.\n *\n * @param packageName - The name of the package to get the package.json from\n * @returns The contents of the package.json file or null if the package is not installed\n */\nexport async function getModulePackageJson<T extends { name: string; version: string } & Record<string, unknown>>(\n packageName: string,\n): Promise<T | null> {\n try {\n const require = createRequire(import.meta.url);\n return require(`${packageName}/package.json`);\n } catch {\n try {\n return (await import(`${packageName}/package.json`)).default;\n } catch {\n return null;\n }\n }\n}\n"],"names":["require","createRequire"],"mappings":";;;;;AAEO,eAAe,oBAAoB,CAAC,WAAW,EAAE;AACxD,EAAE,IAAI;AACN,IAAI,MAAMA,SAAO,GAAGC,sBAAa,CAAC,uRAAe,CAAC;AAClD,IAAI,OAAOD,SAAO,CAAC,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;AACjD,GAAG,CAAC,MAAM;AACV,IAAI,IAAI;AACR,MAAM,OAAO,CAAC,MAAM,OAAO,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,EAAE,OAAO;AAClE,KAAK,CAAC,MAAM;AACZ,MAAM,OAAO,IAAI;AACjB;AACA;AACA;;;;"}