Duffer Derek
{"version":3,"sources":["../../src/lib/find-root.ts"],"sourcesContent":["import { dirname } from 'path'\nimport findUp from 'next/dist/compiled/find-up'\nimport * as Log from '../build/output/log'\n\nfunction findWorkRoot(cwd: string) {\n // Find-up evaluates the list of files at each level.\n // For pnpm-workspace.yaml we first want to look up before searching for lockfiles as those can be included in the application directory by accident.\n const pnpmWorkspaceFile = findUp.sync(\n 'pnpm-workspace.yaml',\n\n {\n cwd,\n }\n )\n\n if (pnpmWorkspaceFile) {\n return pnpmWorkspaceFile\n }\n\n return findUp.sync(\n [\n 'pnpm-lock.yaml',\n 'package-lock.json',\n 'yarn.lock',\n 'bun.lock',\n 'bun.lockb',\n ],\n {\n cwd,\n }\n )\n}\n\nexport function findRootDirAndLockFiles(cwd: string): {\n lockFiles: string[]\n rootDir: string\n} {\n const lockFile = findWorkRoot(cwd)\n if (!lockFile)\n return {\n lockFiles: [],\n rootDir: cwd,\n }\n\n const lockFiles = [lockFile]\n while (true) {\n const lastLockFile = lockFiles[lockFiles.length - 1]\n const currentDir = dirname(lastLockFile)\n const parentDir = dirname(currentDir)\n\n // dirname('/')==='/' so if we happen to reach the FS root (as might happen in a container we need to quit to avoid looping forever\n if (parentDir === currentDir) break\n\n const newLockFile = findWorkRoot(parentDir)\n\n if (!newLockFile) break\n\n lockFiles.push(newLockFile)\n }\n\n return {\n lockFiles,\n rootDir: dirname(lockFiles[lockFiles.length - 1]),\n }\n}\n\nexport function warnDuplicatedLockFiles(lockFiles: string[]) {\n if (lockFiles.length > 1) {\n const additionalLockFiles = lockFiles\n .slice(0, -1)\n .map((str) => `\\n * ${str}`)\n .join('')\n\n if (process.env.TURBOPACK) {\n Log.warnOnce(\n `Warning: Next.js inferred your workspace root, but it may not be correct.\\n` +\n ` We detected multiple lockfiles and selected the directory of ${lockFiles[lockFiles.length - 1]} as the root directory.\\n` +\n ` To silence this warning, set \\`turbopack.root\\` in your Next.js config, or consider ` +\n `removing one of the lockfiles if it's not needed.\\n` +\n ` See https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#root-directory for more information.\\n` +\n ` Detected additional lockfiles: ${additionalLockFiles}\\n`\n )\n } else {\n Log.warnOnce(\n `Warning: Next.js inferred your workspace root, but it may not be correct.\\n` +\n ` We detected multiple lockfiles and selected the directory of ${lockFiles[lockFiles.length - 1]} as the root directory.\\n` +\n ` To silence this warning, set \\`outputFileTracingRoot\\` in your Next.js config, or consider ` +\n `removing one of the lockfiles if it's not needed.\\n` +\n ` See https://nextjs.org/docs/app/api-reference/config/next-config-js/output#caveats for more information.\\n` +\n ` Detected additional lockfiles: ${additionalLockFiles}\\n`\n )\n }\n }\n}\n"],"names":["findRootDirAndLockFiles","warnDuplicatedLockFiles","findWorkRoot","cwd","pnpmWorkspaceFile","findUp","sync","lockFile","lockFiles","rootDir","lastLockFile","length","currentDir","dirname","parentDir","newLockFile","push","additionalLockFiles","slice","map","str","join","process","env","TURBOPACK","Log","warnOnce"],"mappings":";;;;;;;;;;;;;;;IAiCgBA,uBAAuB;eAAvBA;;IAiCAC,uBAAuB;eAAvBA;;;sBAlEQ;+DACL;6DACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,SAASC,aAAaC,GAAW;IAC/B,qDAAqD;IACrD,qJAAqJ;IACrJ,MAAMC,oBAAoBC,eAAM,CAACC,IAAI,CACnC,uBAEA;QACEH;IACF;IAGF,IAAIC,mBAAmB;QACrB,OAAOA;IACT;IAEA,OAAOC,eAAM,CAACC,IAAI,CAChB;QACE;QACA;QACA;QACA;QACA;KACD,EACD;QACEH;IACF;AAEJ;AAEO,SAASH,wBAAwBG,GAAW;IAIjD,MAAMI,WAAWL,aAAaC;IAC9B,IAAI,CAACI,UACH,OAAO;QACLC,WAAW,EAAE;QACbC,SAASN;IACX;IAEF,MAAMK,YAAY;QAACD;KAAS;IAC5B,MAAO,KAAM;QACX,MAAMG,eAAeF,SAAS,CAACA,UAAUG,MAAM,GAAG,EAAE;QACpD,MAA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