{"_id":"@adhd/workspace-base-vite-paths","_rev":"4-94b241f41eab2200b1d3a7cb47113f18","name":"@adhd/workspace-base-vite-paths","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.1":{"name":"@adhd/workspace-base-vite-paths","version":"0.0.1","_id":"@adhd/workspace-base-vite-paths@0.0.1","maintainers":[{"name":"pseudosky","email":"skywinston.sk@gmail.com"}],"dist":{"shasum":"99090216d0c23c0b9337138eb2d423ecaf38af6a","tarball":"https://registry.npmjs.org/@adhd/workspace-base-vite-paths/-/workspace-base-vite-paths-0.0.1.tgz","fileCount":6,"integrity":"sha512-nj+s02N2m9w4gEWHktvFOBQRZLqKNzmFFywDQLb7IY3tv/wt69/SiWG+5EfZKl2DJZH199EIKkeC0orp+xwFKQ==","signatures":[{"sig":"MEQCIERkVtmhPZMFbSOeQ96evoaJy+dXV2nGLfflJoUtOPmzAiAP1ea6O70t7nGzpWUjk0gAdu9R/bJoW35ej/pg8ewl6g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8096},"main":"./index.js","module":"./index.mjs","gitHead":"7edc5d58575a24fb9695bb3474d3e169f20eac58","typings":"./index.d.ts","_npmUser":{"name":"pseudosky","email":"skywinston.sk@gmail.com"},"_npmVersion":"11.6.2","description":"Dynamic, move-safe path helpers for `vite.config.ts` files across the monorepo. Replaces hand-authored literal `cacheDir` / `reportsDirectory` paths (which silently go stale the moment a package is `git mv`'d to a new domain folder) with derived paths tha","directories":{},"_nodeVersion":"24.11.1","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/workspace-base-vite-paths_0.0.1_1786144520382_0.2809704500673693","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@adhd/workspace-base-vite-paths","version":"0.0.2","keywords":["vite","paths","workspace","typescript"],"license":"MIT","_id":"@adhd/workspace-base-vite-paths@0.0.2","maintainers":[{"name":"pseudosky","email":"skywinston.sk@gmail.com"}],"homepage":"https://github.com/PseudoSky/adhd/tree/main/packages/workspace/workspace-base-vite-paths#readme","bugs":{"url":"https://github.com/PseudoSky/adhd/issues"},"dist":{"shasum":"412e1d28efb6578d0b12c94e0522ed1badb5082f","tarball":"https://registry.npmjs.org/@adhd/workspace-base-vite-paths/-/workspace-base-vite-paths-0.0.2.tgz","fileCount":7,"integrity":"sha512-6bxQmaOpQjAVJgQipx+0ddkstoXWH8Vha0JKbKyzs0QxmPvaChhkvSGJ5X5WuhgBYGEXTTQTjdRXoVeiSeWO5Q==","signatures":[{"sig":"MEYCIQDlP0oTHcfKJwzDYEKTDfub7LQouzAgidJi08vXEAFblgIhALXt9aoYQvuBghj4oFRgszM7hcCN7tTEYYP6AgwedrK2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8754},"main":"./index.js","module":"./index.mjs","typings":"./index.d.ts","_npmUser":{"name":"pseudosky","email":"skywinston.sk@gmail.com"},"repository":{"url":"git+https://github.com/PseudoSky/adhd.git","type":"git","directory":"packages/workspace/workspace-base-vite-paths"},"_npmVersion":"11.6.2","description":"Vite path resolution for @adhd workspace packages","directories":{},"_nodeVersion":"24.11.1","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/workspace-base-vite-paths_0.0.2_1788439543754_0.8452612934690935","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@adhd/workspace-base-vite-paths","version":"0.0.3","keywords":["vite","paths","workspace","typescript"],"license":"MIT","_id":"@adhd/workspace-base-vite-paths@0.0.3","maintainers":[{"name":"pseudosky","email":"skywinston.sk@gmail.com"}],"homepage":"https://github.com/PseudoSky/adhd/tree/main/packages/workspace/workspace-base-vite-paths#readme","bugs":{"url":"https://github.com/PseudoSky/adhd/issues"},"dist":{"shasum":"7e34f608af3e8810f526c0ee4c22bbc9a6c2abf3","tarball":"https://registry.npmjs.org/@adhd/workspace-base-vite-paths/-/workspace-base-vite-paths-0.0.3.tgz","fileCount":7,"integrity":"sha512-+ds8lC+C9YVrpJNJjV+BC8YYC2+//DlBE54xsPtd1WnF7ZCU84F9OBgQHFh96XLEw1e0GsIjKQIaQSHa1xNdDg==","signatures":[{"sig":"MEQCIGTpG9o8tgF+nrPIDdBxw7dK7xnjcPdpDowXFcrvNnJxAiBNgU/68BJlLCZ2qqUxPqUjXBbnhsYjGlrSgv/sTeZ0CA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIGxCVG15KhFwhhUZLRkbUoEC6AO1JGrdGdADODMxYJYjAiEA0AIyQMsy/eYpk16I7KN7OtQnlAP3YMo/Htg7XUgB45g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9473},"main":"./index.js","module":"./index.mjs","gitHead":"d473447c27714c6a7ab057efee178d1af8707e05","typings":"./index.d.ts","_npmUser":{"name":"pseudosky","email":"skywinston.sk@gmail.com"},"repository":{"url":"git+https://github.com/PseudoSky/adhd.git","type":"git","directory":"packages/workspace/workspace-base-vite-paths"},"_npmVersion":"11.6.2","description":"Vite path resolution for @adhd workspace packages","directories":{},"_nodeVersion":"24.11.1","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/workspace-base-vite-paths_0.0.3_1790448867060_0.00530143565680663","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"_id":"@adhd/workspace-base-vite-paths@0.0.4","bugs":{"url":"https://github.com/PseudoSky/adhd/issues"},"dist":{"shasum":"c52a3501f7f4f9210bf8400a260c34ac12ba354e","tarball":"https://registry.npmjs.org/@adhd/workspace-base-vite-paths/-/workspace-base-vite-paths-0.0.4.tgz","fileCount":7,"integrity":"sha512-9KY7g14sQ9XLCxW7KOY+u/3SuxTY//EcjMDxG8y5+82d9iMreGD3lp5EiOPDCFB/rCE/KTB6DTzSXiujxrV0Xw==","signatures":[{"sig":"MEYCIQDlNDLInh1thjimET2fdCXfrovYBLf7HZRfAtK0xL7MsAIhAK0E+Fn9oeWUBqvUtFUESHaf5pHG18Lnq9LqYLUMhygq","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIG0v5kMRSQa/6xKjKCCzw3nJvQWBT2/YDXD7/VXIVLXAAiEAhBptM+m5tqdzKL3TKsaIhbnl8LyTo6ue2SAcTiIUu3k="}],"unpackedSize":9473},"main":"./index.js","name":"@adhd/workspace-base-vite-paths","module":"./index.mjs","gitHead":"a1a6ba024c5526b930f97c5420e920639d14e110","license":"MIT","typings":"./index.d.ts","version":"0.0.4","_npmUser":{"name":"pseudosky","email":"skywinston.sk@gmail.com"},"homepage":"https://github.com/PseudoSky/adhd/tree/main/packages/workspace/workspace-base-vite-paths#readme","keywords":["vite","paths","workspace","typescript"],"repository":{"url":"git+https://github.com/PseudoSky/adhd.git","type":"git","directory":"packages/workspace/workspace-base-vite-paths"},"_npmVersion":"11.6.2","description":"Vite path resolution for @adhd workspace packages","directories":{},"maintainers":[{"name":"pseudosky","email":"skywinston.sk@gmail.com"}],"_nodeVersion":"24.11.1","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/workspace-base-vite-paths_0.0.4_1790455352715_0.228685192334386"}}},"time":{"created":"2026-08-07T23:15:20.201Z","modified":"2026-09-26T20:42:32.981Z","0.0.1":"2026-08-07T23:15:20.519Z","0.0.2":"2026-09-03T12:45:43.905Z","0.0.3":"2026-09-26T18:54:27.138Z","0.0.4":"2026-09-26T20:42:32.808Z"},"bugs":{"url":"https://github.com/PseudoSky/adhd/issues"},"license":"MIT","homepage":"https://github.com/PseudoSky/adhd/tree/main/packages/workspace/workspace-base-vite-paths#readme","keywords":["vite","paths","workspace","typescript"],"repository":{"url":"git+https://github.com/PseudoSky/adhd.git","type":"git","directory":"packages/workspace/workspace-base-vite-paths"},"description":"Vite path resolution for @adhd workspace packages","maintainers":[{"name":"pseudosky","email":"skywinston.sk@gmail.com"}],"readme":"# @adhd/workspace-base-vite-paths\n\nDynamic, move-safe path helpers for `vite.config.ts` files across the\nmonorepo. Replaces hand-authored literal `cacheDir` / `reportsDirectory`\npaths (which silently go stale the moment a package is `git mv`'d to a new\ndomain folder) with derived paths that are always correct relative to the\ncurrent location of the package on disk.\n\n`pkg-kind:base`, `platform:node` — this package only runs inside a\n`vite.config.ts` under Node during the build/test process; it is never\nbundled into browser output.\n\n## The `__dirname` contract\n\nEvery exported function takes exactly one argument: the **calling\n`vite.config.ts`'s own `__dirname`**. This is the sole supported call site\nfor this package — do not pass any other path.\n\n```ts\n// vite.config.ts\nimport { projectCacheDir, projectCoverage } from '@adhd/workspace-base-vite-paths';\n\nexport default defineConfig({\n  cacheDir: projectCacheDir(__dirname),\n  test: {\n    coverage: {\n      reportsDirectory: projectCoverage(__dirname),\n    },\n  },\n});\n```\n\nBecause the path is *derived* from `__dirname` at the moment Vite evaluates\nthe config, moving the package (`git mv packages/<domain>/<old> packages/<new-domain>/<new>`\n+ updating the one `project.json`/`tsconfig` path-alias entry) requires\n**zero edits** to `vite.config.ts` — the next `vite`/`vitest` invocation\nre-resolves the workspace root and the package's relative position inside\nit automatically.\n\n## API\n\n- **`findWorkspaceRoot(fromDir: string): string`** — walks `fromDir` upward\n  via `path.dirname` until it finds a directory containing `nx.json` (the Nx\n  workspace root marker). Throws a descriptive error if it reaches the\n  filesystem root without finding one.\n- **`projectCacheDir(fromDir: string): string`** — `<workspaceRoot>/node_modules/.vite/<fromDir relative to workspaceRoot>`.\n  Use for Vite's `cacheDir` option.\n- **`projectCoverage(fromDir: string): string`** — `<workspaceRoot>/coverage/<fromDir relative to workspaceRoot>`.\n  Use for Vitest's `test.coverage.reportsDirectory` option.\n- **`projectDist(fromDir: string): string`** — `<fromDir>/dist`. Already\n  package-relative (not workspace-root-relative), so it was already\n  move-safe; exported for API completeness/consistency only — no behavior\n  change is implied by adopting it.\n- **`workspaceNodeModules(fromDir: string): string`** — `<workspaceRoot>/node_modules`.\n\nAll five functions are pure, synchronous, and depend only on `node:fs` +\n`node:path` — deliberately **no** `@nx/devkit` import, since `vite.config.ts`\nis evaluated directly under Node at build/test time, outside of any\nnx-devkit `Tree`/generator context.\n\n## Building\n\nRun `nx build workspace-base-vite-paths` to build the library.\n\n## Running unit tests\n\nRun `nx test workspace-base-vite-paths` to execute the unit tests via [Vitest](https://vitest.dev/).\n","readmeFilename":"README.md"}