@visulima/package 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/chunk-5UU4RIJA.js +11 -0
- package/dist/chunk-5UU4RIJA.js.map +1 -0
- package/dist/chunk-BGVUNBLL.js +12 -0
- package/dist/chunk-BGVUNBLL.js.map +1 -0
- package/dist/chunk-BHDWBI3F.cjs +22 -0
- package/dist/chunk-BHDWBI3F.cjs.map +1 -0
- package/dist/chunk-C36BYRSZ.cjs +19 -0
- package/dist/chunk-C36BYRSZ.cjs.map +1 -0
- package/dist/chunk-EY5KVLRL.js +10 -0
- package/dist/chunk-EY5KVLRL.js.map +1 -0
- package/dist/chunk-HGV2BL7M.js +12 -0
- package/dist/chunk-HGV2BL7M.js.map +1 -0
- package/dist/chunk-I3EKI236.cjs +13 -0
- package/dist/chunk-I3EKI236.cjs.map +1 -0
- package/dist/chunk-J5ERILYG.cjs +9 -0
- package/dist/chunk-J5ERILYG.cjs.map +1 -0
- package/dist/chunk-KMWIKANF.js +7 -0
- package/dist/chunk-KMWIKANF.js.map +1 -0
- package/dist/chunk-RETLQXQB.cjs +13 -0
- package/dist/chunk-RETLQXQB.cjs.map +1 -0
- package/dist/chunk-W3Z24XII.js +14 -0
- package/dist/chunk-W3Z24XII.js.map +1 -0
- package/dist/chunk-W7A6C74U.cjs +27 -0
- package/dist/chunk-W7A6C74U.cjs.map +1 -0
- package/dist/error.cjs +5 -5
- package/dist/error.js +3 -3
- package/dist/index.cjs +54 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -59
- package/dist/index.js.map +1 -1
- package/dist/monorepo.cjs +5 -5
- package/dist/monorepo.js +3 -3
- package/dist/package-json.cjs +11 -11
- package/dist/package-json.js +1 -1
- package/dist/package-manager.cjs +14 -14
- package/dist/package-manager.js +2 -2
- package/dist/package.cjs +7 -7
- package/dist/package.js +3 -3
- package/dist/tsconfig.cjs +15 -15
- package/dist/tsconfig.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-5VO6NTKJ.js +0 -361
- package/dist/chunk-5VO6NTKJ.js.map +0 -1
- package/dist/chunk-7IOK6YPW.cjs +0 -52
- package/dist/chunk-7IOK6YPW.cjs.map +0 -1
- package/dist/chunk-CVVFWSMT.cjs +0 -65
- package/dist/chunk-CVVFWSMT.cjs.map +0 -1
- package/dist/chunk-E2PKJX3Q.js +0 -54
- package/dist/chunk-E2PKJX3Q.js.map +0 -1
- package/dist/chunk-EYMR7Z2I.js +0 -62
- package/dist/chunk-EYMR7Z2I.js.map +0 -1
- package/dist/chunk-G3SI24AJ.cjs +0 -88
- package/dist/chunk-G3SI24AJ.cjs.map +0 -1
- package/dist/chunk-IIYQBLPC.js +0 -119
- package/dist/chunk-IIYQBLPC.js.map +0 -1
- package/dist/chunk-IK5YSYLX.cjs +0 -126
- package/dist/chunk-IK5YSYLX.cjs.map +0 -1
- package/dist/chunk-UZ2FN6C5.js +0 -78
- package/dist/chunk-UZ2FN6C5.js.map +0 -1
- package/dist/chunk-WXFZK4G3.cjs +0 -374
- package/dist/chunk-WXFZK4G3.cjs.map +0 -1
- package/dist/chunk-YLCN7EVV.js +0 -50
- package/dist/chunk-YLCN7EVV.js.map +0 -1
- package/dist/chunk-YOQXHFU3.cjs +0 -56
- package/dist/chunk-YOQXHFU3.cjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/monorepo.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,YAAY,oBAAoB;AAEzC,SAAS,QAAQ,gBAAgB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,SAAS,YAAY;AAsBvB,IAAM,mBAAmB,OAAO,QAA8C;AACjF,QAAM,oBAAoB,MAAM,OAAO,CAAC,cAAc,YAAY,GAAG;AAAA,IACjE,MAAM;AAAA,IACN,GAAI,OAAO,EAAE,IAAI;AAAA,EACrB,CAAC;AAED,MAAI,mBAAmB,SAAS,YAAY,GAAG;AAC3C,UAAM,QAAQ,MAAM,SAA2D,iBAAiB;AAEhG,QAAI,MAAM,iBAAiB,MAAM,UAAU;AACvC,aAAO;AAAA,QACH,MAAM,QAAQ,iBAAiB;AAAA,QAC/B,UAAU;AAAA,MACd;AAAA,IACJ;AAAA,EACJ;AAEA,QAAM,UAAU,mBAAmB,SAAS,YAAY;AAExD,MAAI;AACA,UAAM,EAAE,gBAAgB,KAAK,IAAI,MAAM,mBAAmB,GAAG;AAE7D,QAAI,CAAC,OAAO,MAAM,EAAE,SAAS,cAAc,GAAG;AAC1C,YAAM,sBAAsB,KAAK,MAAM,cAAc;AAGrD,UAAI,WAAW,mBAAmB,GAAG;AAEjC,cAAM,cAAc,aAAa,KAAK,MAAM,cAAc,GAAG,MAAM;AAEnE,YAAI,YAAY,SAAS,YAAY,GAAG;AACpC,iBAAO;AAAA,YACH;AAAA,YACA,UAAU,UAAU,UAAW;AAAA,UACnC;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ,WAAW,mBAAmB,QAAQ;AAClC,YAAM,yBAAyB,KAAK,MAAM,qBAAqB;AAG/D,UAAI,WAAW,sBAAsB,GAAG;AACpC,eAAO;AAAA,UACH;AAAA,UACA,UAAU,UAAU,UAAU;AAAA,QAClC;AAAA,MACJ;AAAA,IACJ;AAAA,EAEJ,SAAS,OAAY;AAEjB,QAAI,EAAE,iBAAiB,gBAAgB;AACnC,YAAM;AAAA,IACV;AAAA,EACJ;AAEA,QAAM,IAAI,MAAM,8DAA8D,GAAa,iDAAiD;AAChJ","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\n\nimport { findUp, readJson } from \"@visulima/fs\";\nimport { NotFoundError } from \"@visulima/fs/error\";\nimport { dirname, join } from \"pathe\";\n\nimport { findPackageManager } from \"./package-manager\";\n\nexport type Strategy = \"lerna\" | \"npm\" | \"pnpm\" | \"turbo\" | \"yarn\";\n\nexport interface RootMonorepo<T extends Strategy = Strategy> {\n path: string;\n strategy: T;\n}\n\n/**\n * An asynchronous function to find the root directory path and strategy for a monorepo based on\n * the given current working directory (cwd).\n *\n * @param cwd - The current working directory. The type of `cwd` is part of an `Options` type, specifically `Options[\"cwd\"]`.\n * Default is undefined.\n * @returns A `Promise` that resolves to the root directory path and strategy for the monorepo.\n * The type of the returned promise is `Promise<RootMonorepo>`.\n * @throws An `Error` if no monorepo root can be found using lerna, yarn, pnpm, or npm as indicators.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const findMonorepoRoot = async (cwd?: URL | string): Promise<RootMonorepo> => {\n const workspaceFilePath = await findUp([\"lerna.json\", \"turbo.json\"], {\n type: \"file\",\n ...(cwd && { cwd }),\n });\n\n if (workspaceFilePath?.endsWith(\"lerna.json\")) {\n const lerna = await readJson<{ packages?: string[]; useWorkspaces?: boolean }>(workspaceFilePath);\n\n if (lerna.useWorkspaces || lerna.packages) {\n return {\n path: dirname(workspaceFilePath),\n strategy: \"lerna\",\n };\n }\n }\n\n const isTurbo = workspaceFilePath?.endsWith(\"turbo.json\");\n\n try {\n const { packageManager, path } = await findPackageManager(cwd);\n\n if ([\"npm\", \"yarn\"].includes(packageManager)) {\n const packageJsonFilePath = join(path, \"package.json\");\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(packageJsonFilePath)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const packageJson = readFileSync(join(path, \"package.json\"), \"utf8\");\n\n if (packageJson.includes(\"workspaces\")) {\n return {\n path,\n strategy: isTurbo ? \"turbo\" : (packageManager as \"npm\" | \"yarn\"),\n };\n }\n }\n } else if (packageManager === \"pnpm\") {\n const pnpmWorkspacesFilePath = join(path, \"pnpm-workspace.yaml\");\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(pnpmWorkspacesFilePath)) {\n return {\n path,\n strategy: isTurbo ? \"turbo\" : \"pnpm\",\n };\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // Skip this error to show the error message from the next block\n if (!(error instanceof NotFoundError)) {\n throw error;\n }\n }\n\n throw new Error(`No monorepo root could be found upwards from the directory ${cwd as string} using lerna, yarn, pnpm, or npm as indicators.`);\n};\n"]}
|