@hyperfrontend/project-scope 0.2.1 → 0.2.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.
Files changed (439) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +3 -4
  3. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.cjs.js +7 -0
  4. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.esm.js +5 -0
  5. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.cjs.js +13 -0
  6. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.esm.js +8 -0
  7. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.cjs.js +10 -0
  8. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.esm.js +8 -0
  9. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js +6 -0
  10. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js +5 -0
  11. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.cjs.js +7 -0
  12. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.esm.js +5 -0
  13. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.cjs.js +6 -0
  14. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.esm.js +5 -0
  15. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js +9 -0
  16. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.esm.js +6 -0
  17. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.cjs.js +7 -0
  18. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.esm.js +7 -0
  19. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js +15 -0
  20. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.esm.js +9 -0
  21. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js +6 -0
  22. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js +5 -0
  23. package/_dependencies/@hyperfrontend/logging/index.cjs.js +191 -0
  24. package/_dependencies/@hyperfrontend/logging/index.d.ts +151 -0
  25. package/_dependencies/@hyperfrontend/logging/index.esm.js +186 -0
  26. package/_shared/core/cache/index.cjs.js +135 -0
  27. package/_shared/core/cache/index.esm.js +128 -0
  28. package/_shared/core/errors/structured-errors/index.cjs.js +28 -0
  29. package/_shared/core/errors/structured-errors/index.esm.js +23 -0
  30. package/_shared/core/fs/stat/index.cjs.js +46 -0
  31. package/_shared/core/fs/stat/index.esm.js +40 -0
  32. package/_shared/core/path/join/index.cjs.js +13 -0
  33. package/_shared/core/path/join/index.esm.js +10 -0
  34. package/_shared/core/path/normalize/index.cjs.js +37 -0
  35. package/_shared/core/path/normalize/index.esm.js +31 -0
  36. package/_shared/core/path/resolve/index.cjs.js +47 -0
  37. package/_shared/core/path/resolve/index.esm.js +41 -0
  38. package/_shared/core/path/segments/index.cjs.js +38 -0
  39. package/_shared/core/path/segments/index.esm.js +31 -0
  40. package/_shared/core/patterns/glob/index.cjs.js +145 -0
  41. package/_shared/core/patterns/glob/index.esm.js +136 -0
  42. package/_shared/core/platform/detect/index.cjs.js +103 -0
  43. package/_shared/core/platform/detect/index.esm.js +95 -0
  44. package/_shared/core/platform/line-endings/index.cjs.js +52 -0
  45. package/_shared/core/platform/line-endings/index.esm.js +44 -0
  46. package/_shared/project/config/patterns/index.cjs.js +172 -0
  47. package/_shared/project/config/patterns/index.esm.js +169 -0
  48. package/_shared/tech/monorepo/pnpm-workspaces/index.cjs.js +33 -0
  49. package/_shared/tech/monorepo/pnpm-workspaces/index.esm.js +31 -0
  50. package/_shared/tech/shared-utils/detector-helpers/index.cjs.js +48 -0
  51. package/_shared/tech/shared-utils/detector-helpers/index.esm.js +43 -0
  52. package/_shared/vfs/types/index.cjs.js +14 -0
  53. package/_shared/vfs/types/index.esm.js +12 -0
  54. package/cli/index.cjs.js +1702 -1910
  55. package/cli/index.d.ts +273 -7
  56. package/cli/index.d.ts.map +1 -1
  57. package/cli/index.esm.js +1586 -1794
  58. package/core/encoding/index.cjs.js +86 -401
  59. package/core/encoding/index.d.ts +186 -3
  60. package/core/encoding/index.d.ts.map +1 -1
  61. package/core/encoding/index.esm.js +78 -392
  62. package/core/fs/index.cjs.js +231 -581
  63. package/core/fs/index.d.ts +479 -6
  64. package/core/fs/index.d.ts.map +1 -1
  65. package/core/fs/index.esm.js +221 -571
  66. package/core/index.cjs.js +518 -1748
  67. package/core/index.d.ts +486 -9
  68. package/core/index.d.ts.map +1 -1
  69. package/core/index.esm.js +501 -1728
  70. package/core/path/index.cjs.js +6 -234
  71. package/core/path/index.d.ts +306 -5
  72. package/core/path/index.d.ts.map +1 -1
  73. package/core/path/index.esm.js +4 -232
  74. package/core/platform/index.cjs.js +5 -216
  75. package/core/platform/index.d.ts +185 -3
  76. package/core/platform/index.d.ts.map +1 -1
  77. package/core/platform/index.esm.js +3 -212
  78. package/heuristics/dependencies/index.cjs.js +95 -492
  79. package/heuristics/dependencies/index.d.ts +99 -2
  80. package/heuristics/dependencies/index.d.ts.map +1 -1
  81. package/heuristics/dependencies/index.esm.js +69 -466
  82. package/heuristics/entry-points/index.cjs.js +91 -795
  83. package/heuristics/entry-points/index.d.ts +123 -2
  84. package/heuristics/entry-points/index.d.ts.map +1 -1
  85. package/heuristics/entry-points/index.esm.js +72 -776
  86. package/heuristics/framework/index.cjs.js +1481 -1410
  87. package/heuristics/framework/index.d.ts +104 -2
  88. package/heuristics/framework/index.d.ts.map +1 -1
  89. package/heuristics/framework/index.esm.js +1417 -1346
  90. package/heuristics/index.cjs.js +3206 -3301
  91. package/heuristics/index.d.ts +4 -5
  92. package/heuristics/index.d.ts.map +1 -1
  93. package/heuristics/index.esm.js +3231 -3326
  94. package/heuristics/project-type/index.cjs.js +1487 -1437
  95. package/heuristics/project-type/index.d.ts +64 -2
  96. package/heuristics/project-type/index.d.ts.map +1 -1
  97. package/heuristics/project-type/index.esm.js +1416 -1366
  98. package/index.cjs.js +3044 -3533
  99. package/index.d.ts +44 -10
  100. package/index.d.ts.map +1 -1
  101. package/index.esm.js +2900 -3377
  102. package/models/index.cjs.js +0 -1
  103. package/models/index.d.ts +20 -14
  104. package/models/index.d.ts.map +1 -1
  105. package/models/index.esm.js +0 -1
  106. package/nx/index.cjs.js +163 -577
  107. package/nx/index.d.ts +279 -4
  108. package/nx/index.d.ts.map +1 -1
  109. package/nx/index.esm.js +145 -554
  110. package/package.json +13 -12
  111. package/project/config/index.cjs.js +122 -1062
  112. package/project/config/index.d.ts +202 -4
  113. package/project/config/index.d.ts.map +1 -1
  114. package/project/config/index.esm.js +105 -1043
  115. package/project/index.cjs.js +323 -1100
  116. package/project/index.d.ts +4 -5
  117. package/project/index.d.ts.map +1 -1
  118. package/project/index.esm.js +302 -1076
  119. package/project/package/index.cjs.js +191 -472
  120. package/project/package/index.d.ts +280 -3
  121. package/project/package/index.d.ts.map +1 -1
  122. package/project/package/index.esm.js +178 -458
  123. package/project/root/index.cjs.js +107 -416
  124. package/project/root/index.d.ts +83 -2
  125. package/project/root/index.d.ts.map +1 -1
  126. package/project/root/index.esm.js +96 -405
  127. package/project/traversal/index.cjs.js +94 -621
  128. package/project/traversal/index.d.ts +165 -3
  129. package/project/traversal/index.d.ts.map +1 -1
  130. package/project/traversal/index.esm.js +80 -607
  131. package/tech/backend/index.cjs.js +221 -507
  132. package/tech/backend/index.d.ts +205 -8
  133. package/tech/backend/index.d.ts.map +1 -1
  134. package/tech/backend/index.esm.js +200 -486
  135. package/tech/build/index.cjs.js +348 -635
  136. package/tech/build/index.d.ts +276 -10
  137. package/tech/build/index.d.ts.map +1 -1
  138. package/tech/build/index.esm.js +326 -613
  139. package/tech/frontend/index.cjs.js +505 -684
  140. package/tech/frontend/index.d.ts +379 -15
  141. package/tech/frontend/index.d.ts.map +1 -1
  142. package/tech/frontend/index.esm.js +481 -660
  143. package/tech/index.cjs.js +1580 -1420
  144. package/tech/index.d.ts +55 -32
  145. package/tech/index.d.ts.map +1 -1
  146. package/tech/index.esm.js +1513 -1353
  147. package/tech/legacy/index.cjs.js +97 -448
  148. package/tech/legacy/index.d.ts +125 -7
  149. package/tech/legacy/index.d.ts.map +1 -1
  150. package/tech/legacy/index.esm.js +79 -430
  151. package/tech/linting/index.cjs.js +136 -522
  152. package/tech/linting/index.d.ts +129 -7
  153. package/tech/linting/index.d.ts.map +1 -1
  154. package/tech/linting/index.esm.js +116 -502
  155. package/tech/monorepo/index.cjs.js +244 -572
  156. package/tech/monorepo/index.d.ts +241 -10
  157. package/tech/monorepo/index.d.ts.map +1 -1
  158. package/tech/monorepo/index.esm.js +224 -552
  159. package/tech/testing/index.cjs.js +214 -570
  160. package/tech/testing/index.d.ts +176 -8
  161. package/tech/testing/index.d.ts.map +1 -1
  162. package/tech/testing/index.esm.js +196 -552
  163. package/tech/types/index.cjs.js +121 -505
  164. package/tech/types/index.d.ts +120 -2
  165. package/tech/types/index.d.ts.map +1 -1
  166. package/tech/types/index.esm.js +99 -483
  167. package/vfs/index.cjs.js +647 -1142
  168. package/vfs/index.d.ts +360 -6
  169. package/vfs/index.d.ts.map +1 -1
  170. package/vfs/index.esm.js +672 -1167
  171. package/ARCHITECTURE.md +0 -370
  172. package/analyze.d.ts +0 -33
  173. package/analyze.d.ts.map +0 -1
  174. package/cli/commands/analyze.d.ts +0 -28
  175. package/cli/commands/analyze.d.ts.map +0 -1
  176. package/cli/commands/config.d.ts +0 -27
  177. package/cli/commands/config.d.ts.map +0 -1
  178. package/cli/commands/deps.d.ts +0 -24
  179. package/cli/commands/deps.d.ts.map +0 -1
  180. package/cli/commands/tree.d.ts +0 -36
  181. package/cli/commands/tree.d.ts.map +0 -1
  182. package/cli/index.cjs.js.map +0 -1
  183. package/cli/index.esm.js.map +0 -1
  184. package/cli/run.d.ts +0 -25
  185. package/cli/run.d.ts.map +0 -1
  186. package/cli/types.d.ts +0 -55
  187. package/cli/types.d.ts.map +0 -1
  188. package/core/cache.d.ts +0 -158
  189. package/core/cache.d.ts.map +0 -1
  190. package/core/encoding/convert.d.ts +0 -32
  191. package/core/encoding/convert.d.ts.map +0 -1
  192. package/core/encoding/detect.d.ts +0 -91
  193. package/core/encoding/detect.d.ts.map +0 -1
  194. package/core/encoding/index.cjs.js.map +0 -1
  195. package/core/encoding/index.esm.js.map +0 -1
  196. package/core/errors/structured-errors.d.ts +0 -66
  197. package/core/errors/structured-errors.d.ts.map +0 -1
  198. package/core/fs/directory.d.ts +0 -91
  199. package/core/fs/directory.d.ts.map +0 -1
  200. package/core/fs/index.cjs.js.map +0 -1
  201. package/core/fs/index.esm.js.map +0 -1
  202. package/core/fs/read.d.ts +0 -94
  203. package/core/fs/read.d.ts.map +0 -1
  204. package/core/fs/stat.d.ts +0 -58
  205. package/core/fs/stat.d.ts.map +0 -1
  206. package/core/fs/traversal.d.ts +0 -26
  207. package/core/fs/traversal.d.ts.map +0 -1
  208. package/core/fs/write.d.ts +0 -75
  209. package/core/fs/write.d.ts.map +0 -1
  210. package/core/index.cjs.js.map +0 -1
  211. package/core/index.esm.js.map +0 -1
  212. package/core/logger.d.ts +0 -111
  213. package/core/logger.d.ts.map +0 -1
  214. package/core/path/index.cjs.js.map +0 -1
  215. package/core/path/index.esm.js.map +0 -1
  216. package/core/path/join.d.ts +0 -17
  217. package/core/path/join.d.ts.map +0 -1
  218. package/core/path/normalize.d.ts +0 -37
  219. package/core/path/normalize.d.ts.map +0 -1
  220. package/core/path/resolve.d.ts +0 -52
  221. package/core/path/resolve.d.ts.map +0 -1
  222. package/core/path/segments.d.ts +0 -59
  223. package/core/path/segments.d.ts.map +0 -1
  224. package/core/patterns/glob.d.ts +0 -42
  225. package/core/patterns/glob.d.ts.map +0 -1
  226. package/core/platform/detect.d.ts +0 -66
  227. package/core/platform/detect.d.ts.map +0 -1
  228. package/core/platform/index.cjs.js.map +0 -1
  229. package/core/platform/index.esm.js.map +0 -1
  230. package/core/platform/line-endings.d.ts +0 -48
  231. package/core/platform/line-endings.d.ts.map +0 -1
  232. package/heuristics/dependencies/analyze.d.ts +0 -77
  233. package/heuristics/dependencies/analyze.d.ts.map +0 -1
  234. package/heuristics/dependencies/index.cjs.js.map +0 -1
  235. package/heuristics/dependencies/index.esm.js.map +0 -1
  236. package/heuristics/entry-points/discover.d.ts +0 -113
  237. package/heuristics/entry-points/discover.d.ts.map +0 -1
  238. package/heuristics/entry-points/index.cjs.js.map +0 -1
  239. package/heuristics/entry-points/index.esm.js.map +0 -1
  240. package/heuristics/framework/identify.d.ts +0 -84
  241. package/heuristics/framework/identify.d.ts.map +0 -1
  242. package/heuristics/framework/index.cjs.js.map +0 -1
  243. package/heuristics/framework/index.esm.js.map +0 -1
  244. package/heuristics/index.cjs.js.map +0 -1
  245. package/heuristics/index.esm.js.map +0 -1
  246. package/heuristics/project-type/detect.d.ts +0 -61
  247. package/heuristics/project-type/detect.d.ts.map +0 -1
  248. package/heuristics/project-type/index.cjs.js.map +0 -1
  249. package/heuristics/project-type/index.esm.js.map +0 -1
  250. package/index.cjs.js.map +0 -1
  251. package/index.esm.js.map +0 -1
  252. package/models/index.cjs.js.map +0 -1
  253. package/models/index.esm.js.map +0 -1
  254. package/nx/detect.d.ts +0 -105
  255. package/nx/detect.d.ts.map +0 -1
  256. package/nx/devkit-loader.d.ts +0 -62
  257. package/nx/devkit-loader.d.ts.map +0 -1
  258. package/nx/index.cjs.js.map +0 -1
  259. package/nx/index.esm.js.map +0 -1
  260. package/nx/project-config.d.ts +0 -111
  261. package/nx/project-config.d.ts.map +0 -1
  262. package/project/config/detect.d.ts +0 -77
  263. package/project/config/detect.d.ts.map +0 -1
  264. package/project/config/index.cjs.js.map +0 -1
  265. package/project/config/index.esm.js.map +0 -1
  266. package/project/config/parse.d.ts +0 -53
  267. package/project/config/parse.d.ts.map +0 -1
  268. package/project/config/patterns.d.ts +0 -31
  269. package/project/config/patterns.d.ts.map +0 -1
  270. package/project/index.cjs.js.map +0 -1
  271. package/project/index.esm.js.map +0 -1
  272. package/project/package/dependencies.d.ts +0 -101
  273. package/project/package/dependencies.d.ts.map +0 -1
  274. package/project/package/index.cjs.js.map +0 -1
  275. package/project/package/index.esm.js.map +0 -1
  276. package/project/package/read.d.ts +0 -67
  277. package/project/package/read.d.ts.map +0 -1
  278. package/project/root/detect.d.ts +0 -65
  279. package/project/root/detect.d.ts.map +0 -1
  280. package/project/root/index.cjs.js.map +0 -1
  281. package/project/root/index.esm.js.map +0 -1
  282. package/project/traversal/index.cjs.js.map +0 -1
  283. package/project/traversal/index.esm.js.map +0 -1
  284. package/project/traversal/search.d.ts +0 -59
  285. package/project/traversal/search.d.ts.map +0 -1
  286. package/project/traversal/walk.d.ts +0 -63
  287. package/project/traversal/walk.d.ts.map +0 -1
  288. package/tech/backend/detect-all.d.ts +0 -13
  289. package/tech/backend/detect-all.d.ts.map +0 -1
  290. package/tech/backend/express.d.ts +0 -11
  291. package/tech/backend/express.d.ts.map +0 -1
  292. package/tech/backend/fastify.d.ts +0 -11
  293. package/tech/backend/fastify.d.ts.map +0 -1
  294. package/tech/backend/hono.d.ts +0 -11
  295. package/tech/backend/hono.d.ts.map +0 -1
  296. package/tech/backend/index.cjs.js.map +0 -1
  297. package/tech/backend/index.esm.js.map +0 -1
  298. package/tech/backend/koa.d.ts +0 -11
  299. package/tech/backend/koa.d.ts.map +0 -1
  300. package/tech/backend/nestjs.d.ts +0 -11
  301. package/tech/backend/nestjs.d.ts.map +0 -1
  302. package/tech/backend/types.d.ts +0 -31
  303. package/tech/backend/types.d.ts.map +0 -1
  304. package/tech/build/babel.d.ts +0 -13
  305. package/tech/build/babel.d.ts.map +0 -1
  306. package/tech/build/detect-all.d.ts +0 -13
  307. package/tech/build/detect-all.d.ts.map +0 -1
  308. package/tech/build/esbuild.d.ts +0 -11
  309. package/tech/build/esbuild.d.ts.map +0 -1
  310. package/tech/build/index.cjs.js.map +0 -1
  311. package/tech/build/index.esm.js.map +0 -1
  312. package/tech/build/parcel.d.ts +0 -13
  313. package/tech/build/parcel.d.ts.map +0 -1
  314. package/tech/build/rollup.d.ts +0 -13
  315. package/tech/build/rollup.d.ts.map +0 -1
  316. package/tech/build/swc.d.ts +0 -13
  317. package/tech/build/swc.d.ts.map +0 -1
  318. package/tech/build/types.d.ts +0 -31
  319. package/tech/build/types.d.ts.map +0 -1
  320. package/tech/build/vite.d.ts +0 -13
  321. package/tech/build/vite.d.ts.map +0 -1
  322. package/tech/build/webpack.d.ts +0 -13
  323. package/tech/build/webpack.d.ts.map +0 -1
  324. package/tech/frontend/angular.d.ts +0 -11
  325. package/tech/frontend/angular.d.ts.map +0 -1
  326. package/tech/frontend/astro.d.ts +0 -11
  327. package/tech/frontend/astro.d.ts.map +0 -1
  328. package/tech/frontend/detect-all.d.ts +0 -13
  329. package/tech/frontend/detect-all.d.ts.map +0 -1
  330. package/tech/frontend/gatsby.d.ts +0 -11
  331. package/tech/frontend/gatsby.d.ts.map +0 -1
  332. package/tech/frontend/index.cjs.js.map +0 -1
  333. package/tech/frontend/index.esm.js.map +0 -1
  334. package/tech/frontend/nextjs.d.ts +0 -11
  335. package/tech/frontend/nextjs.d.ts.map +0 -1
  336. package/tech/frontend/nuxt.d.ts +0 -11
  337. package/tech/frontend/nuxt.d.ts.map +0 -1
  338. package/tech/frontend/qwik.d.ts +0 -11
  339. package/tech/frontend/qwik.d.ts.map +0 -1
  340. package/tech/frontend/react.d.ts +0 -11
  341. package/tech/frontend/react.d.ts.map +0 -1
  342. package/tech/frontend/remix.d.ts +0 -11
  343. package/tech/frontend/remix.d.ts.map +0 -1
  344. package/tech/frontend/solid.d.ts +0 -11
  345. package/tech/frontend/solid.d.ts.map +0 -1
  346. package/tech/frontend/svelte.d.ts +0 -11
  347. package/tech/frontend/svelte.d.ts.map +0 -1
  348. package/tech/frontend/sveltekit.d.ts +0 -11
  349. package/tech/frontend/sveltekit.d.ts.map +0 -1
  350. package/tech/frontend/types.d.ts +0 -35
  351. package/tech/frontend/types.d.ts.map +0 -1
  352. package/tech/frontend/vue.d.ts +0 -11
  353. package/tech/frontend/vue.d.ts.map +0 -1
  354. package/tech/index.cjs.js.map +0 -1
  355. package/tech/index.esm.js.map +0 -1
  356. package/tech/legacy/angularjs.d.ts +0 -12
  357. package/tech/legacy/angularjs.d.ts.map +0 -1
  358. package/tech/legacy/backbone.d.ts +0 -11
  359. package/tech/legacy/backbone.d.ts.map +0 -1
  360. package/tech/legacy/detect-all.d.ts +0 -13
  361. package/tech/legacy/detect-all.d.ts.map +0 -1
  362. package/tech/legacy/ember.d.ts +0 -11
  363. package/tech/legacy/ember.d.ts.map +0 -1
  364. package/tech/legacy/index.cjs.js.map +0 -1
  365. package/tech/legacy/index.esm.js.map +0 -1
  366. package/tech/legacy/jquery.d.ts +0 -11
  367. package/tech/legacy/jquery.d.ts.map +0 -1
  368. package/tech/legacy/types.d.ts +0 -33
  369. package/tech/legacy/types.d.ts.map +0 -1
  370. package/tech/linting/biome.d.ts +0 -11
  371. package/tech/linting/biome.d.ts.map +0 -1
  372. package/tech/linting/detect-all.d.ts +0 -13
  373. package/tech/linting/detect-all.d.ts.map +0 -1
  374. package/tech/linting/eslint.d.ts +0 -13
  375. package/tech/linting/eslint.d.ts.map +0 -1
  376. package/tech/linting/index.cjs.js.map +0 -1
  377. package/tech/linting/index.esm.js.map +0 -1
  378. package/tech/linting/prettier.d.ts +0 -13
  379. package/tech/linting/prettier.d.ts.map +0 -1
  380. package/tech/linting/stylelint.d.ts +0 -13
  381. package/tech/linting/stylelint.d.ts.map +0 -1
  382. package/tech/linting/types.d.ts +0 -31
  383. package/tech/linting/types.d.ts.map +0 -1
  384. package/tech/monorepo/detect-all.d.ts +0 -13
  385. package/tech/monorepo/detect-all.d.ts.map +0 -1
  386. package/tech/monorepo/index.cjs.js.map +0 -1
  387. package/tech/monorepo/index.esm.js.map +0 -1
  388. package/tech/monorepo/lerna.d.ts +0 -11
  389. package/tech/monorepo/lerna.d.ts.map +0 -1
  390. package/tech/monorepo/npm-workspaces.d.ts +0 -11
  391. package/tech/monorepo/npm-workspaces.d.ts.map +0 -1
  392. package/tech/monorepo/nx.d.ts +0 -11
  393. package/tech/monorepo/nx.d.ts.map +0 -1
  394. package/tech/monorepo/pnpm-workspaces.d.ts +0 -9
  395. package/tech/monorepo/pnpm-workspaces.d.ts.map +0 -1
  396. package/tech/monorepo/rush.d.ts +0 -11
  397. package/tech/monorepo/rush.d.ts.map +0 -1
  398. package/tech/monorepo/turborepo.d.ts +0 -11
  399. package/tech/monorepo/turborepo.d.ts.map +0 -1
  400. package/tech/monorepo/types.d.ts +0 -39
  401. package/tech/monorepo/types.d.ts.map +0 -1
  402. package/tech/monorepo/yarn-workspaces.d.ts +0 -11
  403. package/tech/monorepo/yarn-workspaces.d.ts.map +0 -1
  404. package/tech/shared-utils/detector-helpers.d.ts +0 -52
  405. package/tech/shared-utils/detector-helpers.d.ts.map +0 -1
  406. package/tech/shared-utils/types.d.ts +0 -41
  407. package/tech/shared-utils/types.d.ts.map +0 -1
  408. package/tech/testing/cypress.d.ts +0 -13
  409. package/tech/testing/cypress.d.ts.map +0 -1
  410. package/tech/testing/detect-all.d.ts +0 -13
  411. package/tech/testing/detect-all.d.ts.map +0 -1
  412. package/tech/testing/index.cjs.js.map +0 -1
  413. package/tech/testing/index.esm.js.map +0 -1
  414. package/tech/testing/jest.d.ts +0 -13
  415. package/tech/testing/jest.d.ts.map +0 -1
  416. package/tech/testing/mocha.d.ts +0 -13
  417. package/tech/testing/mocha.d.ts.map +0 -1
  418. package/tech/testing/playwright.d.ts +0 -13
  419. package/tech/testing/playwright.d.ts.map +0 -1
  420. package/tech/testing/types.d.ts +0 -35
  421. package/tech/testing/types.d.ts.map +0 -1
  422. package/tech/testing/vitest.d.ts +0 -13
  423. package/tech/testing/vitest.d.ts.map +0 -1
  424. package/tech/types/detectors.d.ts +0 -67
  425. package/tech/types/detectors.d.ts.map +0 -1
  426. package/tech/types/index.cjs.js.map +0 -1
  427. package/tech/types/index.esm.js.map +0 -1
  428. package/vfs/commit.d.ts +0 -32
  429. package/vfs/commit.d.ts.map +0 -1
  430. package/vfs/diff.d.ts +0 -73
  431. package/vfs/diff.d.ts.map +0 -1
  432. package/vfs/factory.d.ts +0 -37
  433. package/vfs/factory.d.ts.map +0 -1
  434. package/vfs/fs-tree.d.ts +0 -13
  435. package/vfs/fs-tree.d.ts.map +0 -1
  436. package/vfs/index.cjs.js.map +0 -1
  437. package/vfs/index.esm.js.map +0 -1
  438. package/vfs/types.d.ts +0 -179
  439. package/vfs/types.d.ts.map +0 -1
@@ -1,413 +1,28 @@
1
1
  'use strict';
2
2
 
3
- var node_path = require('node:path');
4
- var node_fs = require('node:fs');
5
-
6
- /**
7
- * Safe copies of Error built-ins via factory functions.
8
- *
9
- * Since constructors cannot be safely captured via Object.assign, this module
10
- * provides factory functions that use Reflect.construct internally.
11
- *
12
- * These references are captured at module initialization time to protect against
13
- * prototype pollution attacks. Import only what you need for tree-shaking.
14
- *
15
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/error
16
- */
17
- const _Error = globalThis.Error;
18
- const _Reflect$2 = globalThis.Reflect;
19
- /**
20
- * (Safe copy) Creates a new Error using the captured Error constructor.
21
- * Use this instead of `new Error()`.
22
- *
23
- * @param message - Optional error message.
24
- * @param options - Optional error options.
25
- * @returns A new Error instance.
26
- */
27
- const createError = (message, options) => _Reflect$2.construct(_Error, [message, options]);
28
-
29
- /**
30
- * Safe copies of JSON built-in methods.
31
- *
32
- * These references are captured at module initialization time to protect against
33
- * prototype pollution attacks. Import only what you need for tree-shaking.
34
- *
35
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/json
36
- */
37
- const _JSON = globalThis.JSON;
38
- /**
39
- * (Safe copy) Converts a JavaScript Object Notation (JSON) string into an object.
40
- */
41
- const parse = _JSON.parse;
42
- /**
43
- * (Safe copy) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
44
- */
45
- const stringify = _JSON.stringify;
46
-
47
- /**
48
- * Safe copies of Object built-in methods.
49
- *
50
- * These references are captured at module initialization time to protect against
51
- * prototype pollution attacks. Import only what you need for tree-shaking.
52
- *
53
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/object
54
- */
55
- const _Object = globalThis.Object;
56
- /**
57
- * (Safe copy) Prevents modification of existing property attributes and values,
58
- * and prevents the addition of new properties.
59
- */
60
- const freeze = _Object.freeze;
61
- /**
62
- * (Safe copy) Returns the names of the enumerable string properties and methods of an object.
63
- */
64
- const keys = _Object.keys;
65
- /**
66
- * (Safe copy) Returns an array of key/values of the enumerable own properties of an object.
67
- */
68
- const entries = _Object.entries;
69
- /**
70
- * (Safe copy) Returns an array of values of the enumerable own properties of an object.
71
- */
72
- const values = _Object.values;
73
- /**
74
- * (Safe copy) Adds one or more properties to an object, and/or modifies attributes of existing properties.
75
- */
76
- const defineProperties = _Object.defineProperties;
77
-
78
- /**
79
- * Safe copies of Array built-in static methods.
80
- *
81
- * These references are captured at module initialization time to protect against
82
- * prototype pollution attacks. Import only what you need for tree-shaking.
83
- *
84
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/array
85
- */
86
- const _Array = globalThis.Array;
87
- /**
88
- * (Safe copy) Determines whether the passed value is an Array.
89
- */
90
- const isArray = _Array.isArray;
91
-
92
- /**
93
- * Safe copies of Console built-in methods.
94
- *
95
- * These references are captured at module initialization time to protect against
96
- * prototype pollution attacks. Import only what you need for tree-shaking.
97
- *
98
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/console
99
- */
100
- const _console = globalThis.console;
101
- /**
102
- * (Safe copy) Outputs a message to the console.
103
- */
104
- const log = _console.log.bind(_console);
105
- /**
106
- * (Safe copy) Outputs a warning message to the console.
107
- */
108
- const warn = _console.warn.bind(_console);
109
- /**
110
- * (Safe copy) Outputs an error message to the console.
111
- */
112
- const error = _console.error.bind(_console);
113
- /**
114
- * (Safe copy) Outputs an informational message to the console.
115
- */
116
- const info = _console.info.bind(_console);
117
- /**
118
- * (Safe copy) Outputs a debug message to the console.
119
- */
120
- const debug = _console.debug.bind(_console);
121
- /**
122
- * (Safe copy) Outputs a stack trace to the console.
123
- */
124
- _console.trace.bind(_console);
125
- /**
126
- * (Safe copy) Displays an interactive listing of the properties of a specified object.
127
- */
128
- _console.dir.bind(_console);
129
- /**
130
- * (Safe copy) Displays tabular data as a table.
131
- */
132
- _console.table.bind(_console);
133
- /**
134
- * (Safe copy) Writes an error message to the console if the assertion is false.
135
- */
136
- _console.assert.bind(_console);
137
- /**
138
- * (Safe copy) Clears the console.
139
- */
140
- _console.clear.bind(_console);
141
- /**
142
- * (Safe copy) Logs the number of times that this particular call to count() has been called.
143
- */
144
- _console.count.bind(_console);
145
- /**
146
- * (Safe copy) Resets the counter used with console.count().
147
- */
148
- _console.countReset.bind(_console);
149
- /**
150
- * (Safe copy) Creates a new inline group in the console.
151
- */
152
- _console.group.bind(_console);
153
- /**
154
- * (Safe copy) Creates a new inline group in the console that is initially collapsed.
155
- */
156
- _console.groupCollapsed.bind(_console);
157
- /**
158
- * (Safe copy) Exits the current inline group.
159
- */
160
- _console.groupEnd.bind(_console);
161
- /**
162
- * (Safe copy) Starts a timer with a name specified as an input parameter.
163
- */
164
- _console.time.bind(_console);
165
- /**
166
- * (Safe copy) Stops a timer that was previously started.
167
- */
168
- _console.timeEnd.bind(_console);
169
- /**
170
- * (Safe copy) Logs the current value of a timer that was previously started.
171
- */
172
- _console.timeLog.bind(_console);
173
-
174
- /**
175
- * Safe copies of Set built-in via factory function.
176
- *
177
- * Since constructors cannot be safely captured via Object.assign, this module
178
- * provides a factory function that uses Reflect.construct internally.
179
- *
180
- * These references are captured at module initialization time to protect against
181
- * prototype pollution attacks. Import only what you need for tree-shaking.
182
- *
183
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/set
184
- */
185
- const _Set = globalThis.Set;
186
- const _Reflect$1 = globalThis.Reflect;
187
- /**
188
- * (Safe copy) Creates a new Set using the captured Set constructor.
189
- * Use this instead of `new Set()`.
190
- *
191
- * @param iterable - Optional iterable of values.
192
- * @returns A new Set instance.
193
- */
194
- const createSet = (iterable) => _Reflect$1.construct(_Set, iterable ? [iterable] : []);
195
-
196
- const registeredClasses = [];
197
-
198
- /**
199
- * Returns the data type of the target.
200
- * Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`.
201
- * Also, when classes are registered via `registerClass`, it checks if objects are instance of any known registered class.
202
- *
203
- * @param target - The target to get the data type of.
204
- * @returns The data type of the target.
205
- */
206
- const getType = (target) => {
207
- if (target === null)
208
- return 'null';
209
- const nativeDataType = typeof target;
210
- if (nativeDataType === 'object') {
211
- if (isArray(target))
212
- return 'array';
213
- for (const registeredClass of registeredClasses) {
214
- if (target instanceof registeredClass)
215
- return registeredClass.name;
216
- }
217
- }
218
- return nativeDataType;
219
- };
220
-
221
- /**
222
- * Safe copies of Map built-in via factory function.
223
- *
224
- * Since constructors cannot be safely captured via Object.assign, this module
225
- * provides a factory function that uses Reflect.construct internally.
226
- *
227
- * These references are captured at module initialization time to protect against
228
- * prototype pollution attacks. Import only what you need for tree-shaking.
229
- *
230
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/map
231
- */
232
- const _Map = globalThis.Map;
233
- const _Reflect = globalThis.Reflect;
234
- /**
235
- * (Safe copy) Creates a new Map using the captured Map constructor.
236
- * Use this instead of `new Map()`.
237
- *
238
- * @param iterable - Optional iterable of key-value pairs.
239
- * @returns A new Map instance.
240
- */
241
- const createMap = (iterable) => _Reflect.construct(_Map, iterable ? [iterable] : []);
242
-
243
- /* eslint-disable @typescript-eslint/no-explicit-any */
244
- /**
245
- * Creates a wrapper function that only executes the wrapped function if the condition function returns true.
246
- *
247
- * @param func - The function to be conditionally executed.
248
- * @param conditionFunc - A function that returns a boolean, determining if `func` should be executed.
249
- * @returns A wrapped version of `func` that executes conditionally.
250
- */
251
- function createConditionalExecutionFunction(func, conditionFunc) {
252
- return function (...args) {
253
- if (conditionFunc()) {
254
- return func(...args);
255
- }
256
- };
257
- }
258
-
259
- /* eslint-disable @typescript-eslint/no-explicit-any */
260
- /**
261
- * Creates a wrapper function that silently ignores any errors thrown by the wrapped void function.
262
- * This function is specifically for wrapping functions that do not return a value (void functions).
263
- * Exceptions are swallowed without any logging or handling.
264
- *
265
- * @param func - The void function to be wrapped.
266
- * @returns A wrapped version of the input function that ignores errors.
267
- */
268
- function createErrorIgnoringFunction(func) {
269
- return function (...args) {
270
- try {
271
- func(...args);
272
- }
273
- catch {
274
- // Deliberately swallowing/ignoring the exception
275
- }
276
- };
277
- }
278
-
279
- /* eslint-disable @typescript-eslint/no-unused-vars */
280
- /**
281
- * A no-operation function (noop) that does nothing regardless of the arguments passed.
282
- * It is designed to be as permissive as possible in its typing without using the `Function` keyword.
283
- *
284
- * @param args - Any arguments passed to the function (ignored)
285
- */
286
- const noop = (...args) => {
287
- // Intentionally does nothing
288
- };
289
-
290
- const logLevels = ['none', 'error', 'warn', 'log', 'info', 'debug'];
291
- const priority = {
292
- error: 4,
293
- warn: 3,
294
- log: 2,
295
- info: 1,
296
- debug: 0,
297
- };
298
- /**
299
- * Validates whether a given string is a valid log level.
300
- *
301
- * @param level - The log level to validate
302
- * @returns True if the level is valid, false otherwise
303
- */
304
- function isValidLogLevel(level) {
305
- return logLevels.includes(level);
306
- }
307
- /**
308
- * Creates a log level configuration manager for controlling logging behavior.
309
- * Provides methods to get, set, and evaluate log levels based on priority.
310
- *
311
- * @param level - The initial log level (defaults to 'error')
312
- * @returns A configuration object with log level management methods
313
- * @throws {Error} When the provided level is not a valid log level
314
- */
315
- function createLogLevelConfig(level = 'error') {
316
- if (!isValidLogLevel(level)) {
317
- throw createError('Cannot create log level configuration with a valid default log level');
318
- }
319
- const state = { level };
320
- const getLogLevel = () => state.level;
321
- const setLogLevel = (level) => {
322
- if (!isValidLogLevel(level)) {
323
- throw createError(`Cannot set value '${level}' level. Expected levels are ${logLevels}.`);
324
- }
325
- state.level = level;
326
- };
327
- const shouldLog = (level) => {
328
- if (state.level === 'none' || level === 'none' || !isValidLogLevel(level)) {
329
- return false;
330
- }
331
- return priority[level] >= priority[state.level];
332
- };
333
- return freeze({
334
- getLogLevel,
335
- setLogLevel,
336
- shouldLog,
337
- });
338
- }
339
-
340
- /**
341
- * Creates a logger instance with configurable log level filtering.
342
- * Each log function is wrapped to respect the current log level setting.
343
- *
344
- * @param error - Function to handle error-level logs (required)
345
- * @param warn - Function to handle warning-level logs (optional, defaults to noop)
346
- * @param log - Function to handle standard logs (optional, defaults to noop)
347
- * @param info - Function to handle info-level logs (optional, defaults to noop)
348
- * @param debug - Function to handle debug-level logs (optional, defaults to noop)
349
- * @returns A frozen logger object with log methods and level control
350
- * @throws {ErrorLevelFn} When any provided log function is invalid
351
- */
352
- function createLogger(error, warn = noop, log = noop, info = noop, debug = noop) {
353
- if (notValidLogFn(error)) {
354
- throw createError(notFnMsg('error'));
355
- }
356
- if (notValidLogFn(warn)) {
357
- throw createError(notFnMsg('warn'));
358
- }
359
- if (notValidLogFn(log)) {
360
- throw createError(notFnMsg('log'));
361
- }
362
- if (notValidLogFn(info)) {
363
- throw createError(notFnMsg('info'));
364
- }
365
- if (notValidLogFn(debug)) {
366
- throw createError(notFnMsg('debug'));
367
- }
368
- const { setLogLevel, getLogLevel, shouldLog } = createLogLevelConfig();
369
- const wrapLogFn = (fn, level) => {
370
- if (fn === noop)
371
- return fn;
372
- const condition = () => shouldLog(level);
373
- return createConditionalExecutionFunction(createErrorIgnoringFunction(fn), condition);
374
- };
375
- return freeze({
376
- error: wrapLogFn(error, 'error'),
377
- warn: wrapLogFn(warn, 'warn'),
378
- log: wrapLogFn(log, 'log'),
379
- info: wrapLogFn(info, 'info'),
380
- debug: wrapLogFn(debug, 'debug'),
381
- setLogLevel,
382
- getLogLevel,
383
- });
384
- }
385
- /**
386
- * Validates whether a given value is a valid log function.
387
- *
388
- * @param fn - The value to validate
389
- * @returns True if the value is not a function (invalid), false if it is valid
390
- */
391
- function notValidLogFn(fn) {
392
- return getType(fn) !== 'function' && fn !== noop;
393
- }
394
- /**
395
- * Generates an error message for invalid log function parameters.
396
- *
397
- * @param label - The name of the log function that failed validation
398
- * @returns A formatted error message string
399
- */
400
- function notFnMsg(label) {
401
- return `Cannot create a logger when ${label} is not a function`;
402
- }
403
-
404
- createLogger(error, warn, log, info, debug);
3
+ const node_path = require('node:path');
4
+ const index_cjs_js$2 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js');
5
+ const index_cjs_js$1 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.cjs.js');
6
+ const index_cjs_js = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js');
7
+ const node_fs = require('node:fs');
8
+ const index_cjs_js$5 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.cjs.js');
9
+ const index_cjs_js$4 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.cjs.js');
10
+ const index_cjs_js$6 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.cjs.js');
11
+ const index_cjs_js$3 = require('../_dependencies/@hyperfrontend/logging/index.cjs.js');
12
+ const index_cjs_js$7 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js');
13
+ const index_cjs_js$8 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.cjs.js');
14
+ const { isDirectory, exists } = require('../_shared/core/fs/stat/index.cjs.js');
15
+ const { join } = require('../_shared/core/path/join/index.cjs.js');
16
+ const { createConfigError } = require('../_shared/core/errors/structured-errors/index.cjs.js');
17
+ const { createCache } = require('../_shared/core/cache/index.cjs.js');
18
+ const { matchGlobPattern } = require('../_shared/core/patterns/glob/index.cjs.js');
19
+ const { CONFIG_PATTERNS, getConfigPatternsByType } = require('../_shared/project/config/patterns/index.cjs.js');
405
20
 
406
21
  /**
407
22
  * Global log level registry.
408
23
  * Tracks all created scoped loggers to allow global log level changes.
409
24
  */
410
- const loggerRegistry = createSet();
25
+ const loggerRegistry = index_cjs_js.createSet();
411
26
  /** Redacted placeholder for sensitive values */
412
27
  const REDACTED = '[REDACTED]';
413
28
  /**
@@ -441,17 +56,24 @@ function isSensitiveKey(key) {
441
56
  *
442
57
  * @param obj - Object to sanitize
443
58
  * @returns New object with sensitive values redacted
59
+ *
60
+ * @example Sanitizing sensitive data
61
+ * ```typescript
62
+ * const config = { apiKey: 'secret123', endpoint: 'https://api.example.com' }
63
+ * const safe = sanitize(config)
64
+ * // => { apiKey: '[REDACTED]', endpoint: 'https://api.example.com' }
65
+ * ```
444
66
  */
445
67
  function sanitize(obj) {
446
68
  if (obj === null || obj === undefined) {
447
69
  return obj;
448
70
  }
449
- if (isArray(obj)) {
71
+ if (index_cjs_js$5.isArray(obj)) {
450
72
  return obj.map((item) => sanitize(item));
451
73
  }
452
74
  if (typeof obj === 'object') {
453
75
  const result = {};
454
- for (const [key, value] of entries(obj)) {
76
+ for (const [key, value] of index_cjs_js$2.entries(obj)) {
455
77
  if (isSensitiveKey(key)) {
456
78
  result[key] = REDACTED;
457
79
  }
@@ -476,9 +98,9 @@ function sanitize(obj) {
476
98
  */
477
99
  function formatMessage(namespace, message, meta) {
478
100
  const prefix = `[${namespace}]`;
479
- if (meta && keys(meta).length > 0) {
101
+ if (meta && index_cjs_js$2.keys(meta).length > 0) {
480
102
  const sanitizedMeta = sanitize(meta);
481
- return `${prefix} ${message} ${stringify(sanitizedMeta)}`;
103
+ return `${prefix} ${message} ${index_cjs_js$6.stringify(sanitizedMeta)}`;
482
104
  }
483
105
  return `${prefix} ${message}`;
484
106
  }
@@ -491,7 +113,7 @@ function formatMessage(namespace, message, meta) {
491
113
  * @param options - Logger configuration options
492
114
  * @returns A configured scoped logger instance
493
115
  *
494
- * @example
116
+ * @example Creating a scoped logger
495
117
  * ```typescript
496
118
  * const logger = createScopedLogger('project-scope')
497
119
  * logger.setLogLevel('debug')
@@ -510,9 +132,9 @@ function createScopedLogger(namespace, options = {}) {
510
132
  const processedMeta = sanitizeSecrets && meta ? sanitize(meta) : meta;
511
133
  baseFn(formatMessage(namespace, message, processedMeta));
512
134
  };
513
- const baseLogger = createLogger(createLogFn(error), createLogFn(warn), createLogFn(log), createLogFn(info), createLogFn(debug));
135
+ const baseLogger = index_cjs_js$3.createLogger(createLogFn(index_cjs_js$4.error), createLogFn(index_cjs_js$4.warn), createLogFn(index_cjs_js$4.log), createLogFn(index_cjs_js$4.info), createLogFn(index_cjs_js$4.debug));
514
136
  baseLogger.setLogLevel(level);
515
- const scopedLogger = freeze({
137
+ const scopedLogger = index_cjs_js$2.freeze({
516
138
  error: (message, meta) => baseLogger.error(message, meta),
517
139
  warn: (message, meta) => baseLogger.warn(message, meta),
518
140
  log: (message, meta) => baseLogger.log(message, meta),
@@ -528,7 +150,7 @@ function createScopedLogger(namespace, options = {}) {
528
150
  * Default logger instance for the project-scope library.
529
151
  * Use this for general logging within the library.
530
152
  *
531
- * @example
153
+ * @example Using the default logger
532
154
  * ```typescript
533
155
  * import { logger } from '@hyperfrontend/project-scope/core'
534
156
  *
@@ -546,10 +168,19 @@ const fsLogger = createScopedLogger('project-scope:fs');
546
168
  * @param code - The category code for this type of filesystem failure
547
169
  * @param context - Additional context including path, operation, and cause
548
170
  * @returns A configured Error object with code and context properties
171
+ *
172
+ * @example Creating a file system error
173
+ * ```typescript
174
+ * throw createFileSystemError(
175
+ * 'Cannot read file',
176
+ * 'FS_READ_ERROR',
177
+ * { path: './missing.txt', operation: 'read' }
178
+ * )
179
+ * ```
549
180
  */
550
181
  function createFileSystemError(message, code, context) {
551
- const error = createError(message);
552
- defineProperties(error, {
182
+ const error = index_cjs_js$7.createError(message);
183
+ index_cjs_js$2.defineProperties(error, {
553
184
  code: { value: code, enumerable: true },
554
185
  context: { value: context, enumerable: true },
555
186
  });
@@ -563,7 +194,7 @@ function createFileSystemError(message, code, context) {
563
194
  * @returns File contents as string
564
195
  * @throws {Error} If file doesn't exist or can't be read
565
196
  *
566
- * @example
197
+ * @example Reading file contents
567
198
  * ```typescript
568
199
  * import { readFileContent } from '@hyperfrontend/project-scope'
569
200
  *
@@ -590,6 +221,14 @@ function readFileContent(filePath, encoding = 'utf-8') {
590
221
  * @param filePath - Path to file
591
222
  * @param encoding - File encoding (default: utf-8)
592
223
  * @returns File contents or null if file doesn't exist
224
+ *
225
+ * @example Reading file if it exists
226
+ * ```typescript
227
+ * const content = readFileIfExists('./optional-config.json')
228
+ * if (content) {
229
+ * // File existed, use content
230
+ * }
231
+ * ```
593
232
  */
594
233
  function readFileIfExists(filePath, encoding = 'utf-8') {
595
234
  if (!node_fs.existsSync(filePath)) {
@@ -603,56 +242,6 @@ function readFileIfExists(filePath, encoding = 'utf-8') {
603
242
  }
604
243
  }
605
244
 
606
- createScopedLogger('project-scope:fs:write');
607
-
608
- /**
609
- * Get file stats with error handling.
610
- *
611
- * @param filePath - Path to file
612
- * @param followSymlinks - Whether to follow symlinks (default: true)
613
- * @returns File stats or null if path doesn't exist
614
- */
615
- function getFileStat(filePath, followSymlinks = true) {
616
- if (!node_fs.existsSync(filePath)) {
617
- return null;
618
- }
619
- try {
620
- const stat = followSymlinks ? node_fs.statSync(filePath) : node_fs.lstatSync(filePath);
621
- return {
622
- isFile: stat.isFile(),
623
- isDirectory: stat.isDirectory(),
624
- isSymlink: stat.isSymbolicLink(),
625
- size: stat.size,
626
- created: stat.birthtime,
627
- modified: stat.mtime,
628
- accessed: stat.atime,
629
- mode: stat.mode,
630
- };
631
- }
632
- catch {
633
- return null;
634
- }
635
- }
636
- /**
637
- * Check if path is a directory.
638
- *
639
- * @param dirPath - Path to check
640
- * @returns True if path is a directory
641
- */
642
- function isDirectory(dirPath) {
643
- const stats = getFileStat(dirPath);
644
- return stats?.isDirectory ?? false;
645
- }
646
- /**
647
- * Check if path exists.
648
- *
649
- * @param filePath - Path to check
650
- * @returns True if path exists
651
- */
652
- function exists(filePath) {
653
- return node_fs.existsSync(filePath);
654
- }
655
-
656
245
  const fsDirLogger = createScopedLogger('project-scope:fs:dir');
657
246
  /**
658
247
  * List immediate contents of a directory.
@@ -661,7 +250,7 @@ const fsDirLogger = createScopedLogger('project-scope:fs:dir');
661
250
  * @returns Array of entries with metadata for each file/directory
662
251
  * @throws {Error} If directory doesn't exist or isn't a directory
663
252
  *
664
- * @example
253
+ * @example Listing directory contents
665
254
  * ```typescript
666
255
  * import { readDirectory } from '@hyperfrontend/project-scope'
667
256
  *
@@ -702,17 +291,6 @@ function readDirectory(dirPath) {
702
291
  }
703
292
  }
704
293
 
705
- /**
706
- * Join path segments.
707
- * Uses platform-specific separators (e.g., / or \).
708
- *
709
- * @param paths - Path segments to join
710
- * @returns Joined path
711
- */
712
- function join(...paths) {
713
- return node_path.join(...paths);
714
- }
715
-
716
294
  const fsTraversalLogger = createScopedLogger('project-scope:fs:traversal');
717
295
  /**
718
296
  * Generic upward directory traversal.
@@ -721,6 +299,15 @@ const fsTraversalLogger = createScopedLogger('project-scope:fs:traversal');
721
299
  * @param startPath - Starting directory
722
300
  * @param predicate - Function to test each directory
723
301
  * @returns First matching directory or null
302
+ *
303
+ * @example Finding directory containing README
304
+ * ```typescript
305
+ * // Find first directory containing a README
306
+ * const readmeDir = traverseUpward('./src/utils', (dir) =>
307
+ * existsSync(join(dir, 'README.md'))
308
+ * )
309
+ * // => '/project' or null
310
+ * ```
724
311
  */
725
312
  function traverseUpward(startPath, predicate) {
726
313
  fsTraversalLogger.debug('Starting upward traversal', { startPath });
@@ -746,6 +333,17 @@ function traverseUpward(startPath, predicate) {
746
333
  * @param startPath - Starting directory
747
334
  * @param markers - Array of marker file names to search for
748
335
  * @returns First directory containing any marker, or null
336
+ *
337
+ * @example Finding project root by marker files
338
+ * ```typescript
339
+ * // Find project root by looking for common marker files
340
+ * const projectRoot = locateByMarkers('./src/components', [
341
+ * 'package.json',
342
+ * 'nx.json',
343
+ * 'tsconfig.base.json'
344
+ * ])
345
+ * // => '/workspace/my-project'
346
+ * ```
749
347
  */
750
348
  function locateByMarkers(startPath, markers) {
751
349
  fsTraversalLogger.debug('Locating by markers', { startPath, markers });
@@ -761,203 +359,21 @@ function locateByMarkers(startPath, markers) {
761
359
  * @param startPath - Starting directory
762
360
  * @param test - Function to test if directory matches criteria
763
361
  * @returns Matching directory path or null
362
+ *
363
+ * @example Finding directory with specific config
364
+ * ```typescript
365
+ * // Find directory with a specific config
366
+ * const configDir = findUpwardWhere('./deep/nested/path', (dir) =>
367
+ * existsSync(join(dir, '.eslintrc.js'))
368
+ * )
369
+ * ```
764
370
  */
765
371
  function findUpwardWhere(startPath, test) {
766
372
  fsTraversalLogger.debug('Finding upward where condition met', { startPath });
767
373
  return traverseUpward(startPath, test);
768
374
  }
769
375
 
770
- /**
771
- * Match path against glob pattern using safe character iteration.
772
- * Avoids regex to prevent ReDoS attacks.
773
- *
774
- * Supported patterns:
775
- * - * matches any characters except /
776
- * - ** matches any characters including /
777
- * - ? matches exactly one character except /
778
- * - {a,b,c} matches any of the alternatives
779
- *
780
- * @param path - The filesystem path to test against the pattern
781
- * @param pattern - The glob pattern to match against
782
- * @returns True if path matches pattern
783
- *
784
- * @example
785
- * ```typescript
786
- * import { matchGlobPattern } from '@hyperfrontend/project-scope'
787
- *
788
- * matchGlobPattern('src/utils/helper.ts', '\*\*\/*.ts') // true
789
- * matchGlobPattern('test.spec.ts', '\*.spec.ts') // true
790
- * matchGlobPattern('config.json', '\*.{json,yaml}') // true
791
- * matchGlobPattern('src/index.ts', 'src/\*.ts') // true
792
- * ```
793
- */
794
- function matchGlobPattern(path, pattern) {
795
- return matchSegments(path.split('/'), pattern.split('/'), 0, 0);
796
- }
797
- /**
798
- * Internal recursive function to match path segments against pattern segments.
799
- *
800
- * @param pathParts - Array of path segments split by '/'
801
- * @param patternParts - Array of pattern segments split by '/'
802
- * @param pathIdx - Current index in pathParts being examined
803
- * @param patternIdx - Current index in patternParts being examined
804
- * @returns True if remaining segments match
805
- */
806
- function matchSegments(pathParts, patternParts, pathIdx, patternIdx) {
807
- if (pathIdx === pathParts.length && patternIdx === patternParts.length) {
808
- return true;
809
- }
810
- if (patternIdx >= patternParts.length) {
811
- return false;
812
- }
813
- const patternPart = patternParts[patternIdx];
814
- if (patternPart === '**') {
815
- for (let i = pathIdx; i <= pathParts.length; i++) {
816
- if (matchSegments(pathParts, patternParts, i, patternIdx + 1)) {
817
- return true;
818
- }
819
- }
820
- return false;
821
- }
822
- if (pathIdx >= pathParts.length) {
823
- return false;
824
- }
825
- const pathPart = pathParts[pathIdx];
826
- if (matchSegment(pathPart, patternPart)) {
827
- return matchSegments(pathParts, patternParts, pathIdx + 1, patternIdx + 1);
828
- }
829
- return false;
830
- }
831
- /**
832
- * Match a single path segment against a pattern segment.
833
- * Handles *, ?, and {a,b,c} patterns.
834
- *
835
- * @param text - The path segment text to match
836
- * @param pattern - The pattern segment to match against
837
- * @returns True if the text matches the pattern
838
- */
839
- function matchSegment(text, pattern) {
840
- let textIdx = 0;
841
- let patternIdx = 0;
842
- while (patternIdx < pattern.length) {
843
- const char = pattern[patternIdx];
844
- if (char === '*') {
845
- patternIdx++;
846
- if (patternIdx === pattern.length) {
847
- return true;
848
- }
849
- for (let i = textIdx; i <= text.length; i++) {
850
- if (matchSegmentFrom(text, i, pattern, patternIdx)) {
851
- return true;
852
- }
853
- }
854
- return false;
855
- }
856
- else if (char === '?') {
857
- if (textIdx >= text.length) {
858
- return false;
859
- }
860
- textIdx++;
861
- patternIdx++;
862
- }
863
- else if (char === '{') {
864
- const closeIdx = findClosingBrace(pattern, patternIdx);
865
- if (closeIdx === -1) {
866
- if (textIdx >= text.length || text[textIdx] !== char) {
867
- return false;
868
- }
869
- textIdx++;
870
- patternIdx++;
871
- }
872
- else {
873
- const alternatives = extractAlternatives(pattern.slice(patternIdx + 1, closeIdx));
874
- for (const alt of alternatives) {
875
- if (matchSegmentFrom(text, textIdx, text.slice(0, textIdx) + alt + pattern.slice(closeIdx + 1), textIdx)) {
876
- return true;
877
- }
878
- }
879
- return false;
880
- }
881
- }
882
- else {
883
- if (textIdx >= text.length || text[textIdx] !== char) {
884
- return false;
885
- }
886
- textIdx++;
887
- patternIdx++;
888
- }
889
- }
890
- return textIdx === text.length;
891
- }
892
- /**
893
- * Helper to match from a specific position.
894
- *
895
- * @param text - The full text being matched
896
- * @param textIdx - The starting index in text to match from
897
- * @param pattern - The full pattern being matched
898
- * @param patternIdx - The starting index in pattern to match from
899
- * @returns True if the text matches the pattern from the given positions
900
- */
901
- function matchSegmentFrom(text, textIdx, pattern, patternIdx) {
902
- const remainingText = text.slice(textIdx);
903
- const remainingPattern = pattern.slice(patternIdx);
904
- return matchSegment(remainingText, remainingPattern);
905
- }
906
- /**
907
- * Find closing brace for {a,b,c} pattern.
908
- *
909
- * @param pattern - The pattern string to search within
910
- * @param startIdx - The index of the opening brace
911
- * @returns The index of the matching closing brace, or -1 if not found
912
- */
913
- function findClosingBrace(pattern, startIdx) {
914
- let depth = 0;
915
- for (let i = startIdx; i < pattern.length; i++) {
916
- if (pattern[i] === '{') {
917
- depth++;
918
- }
919
- else if (pattern[i] === '}') {
920
- depth--;
921
- if (depth === 0) {
922
- return i;
923
- }
924
- }
925
- }
926
- return -1;
927
- }
928
- /**
929
- * Extract alternatives from {a,b,c} pattern content.
930
- *
931
- * @param content - The content between braces (without the braces themselves)
932
- * @returns Array of alternative strings split by commas at depth 0
933
- */
934
- function extractAlternatives(content) {
935
- const alternatives = [];
936
- let current = '';
937
- let depth = 0;
938
- for (let i = 0; i < content.length; i++) {
939
- const char = content[i];
940
- if (char === '{') {
941
- depth++;
942
- current += char;
943
- }
944
- else if (char === '}') {
945
- depth--;
946
- current += char;
947
- }
948
- else if (char === ',' && depth === 0) {
949
- alternatives.push(current);
950
- current = '';
951
- }
952
- else {
953
- current += char;
954
- }
955
- }
956
- if (current) {
957
- alternatives.push(current);
958
- }
959
- return alternatives;
960
- }
376
+ createScopedLogger('project-scope:fs:write');
961
377
 
962
378
  const walkLogger = createScopedLogger('project-scope:project:walk');
963
379
  /**
@@ -1024,6 +440,18 @@ function matchPattern(path, pattern) {
1024
440
  * @param startPath - Root directory to begin traversal
1025
441
  * @param visitor - Callback function invoked for each file system entry
1026
442
  * @param options - Configuration for traversal behavior
443
+ *
444
+ * @example Walking a directory tree
445
+ * ```typescript
446
+ * import { walkDirectory } from '@hyperfrontend/project-scope'
447
+ *
448
+ * const tsFiles: string[] = []
449
+ * walkDirectory('./src', (entry) => {
450
+ * if (entry.isFile && entry.name.endsWith('.ts')) {
451
+ * tsFiles.push(entry.relativePath)
452
+ * }
453
+ * }, { maxDepth: 5, respectGitignore: true })
454
+ * ```
1027
455
  */
1028
456
  function walkDirectory(startPath, visitor, options) {
1029
457
  walkLogger.debug('Starting directory walk', {
@@ -1106,6 +534,19 @@ function walkDirectory(startPath, visitor, options) {
1106
534
  * @param startPath - Root path within the tree to begin traversal
1107
535
  * @param visitor - Callback function invoked for each tree entry
1108
536
  * @param options - Configuration for traversal behavior
537
+ *
538
+ * @example Walking a virtual tree
539
+ * ```typescript
540
+ * import { createTree, walkTree } from '@hyperfrontend/project-scope'
541
+ *
542
+ * const tree = createTree('/workspace')
543
+ * walkTree(tree, 'src', (entry) => {
544
+ * if (entry.isDirectory) {
545
+ * console.log('Dir:', entry.relativePath)
546
+ * return 'skip' // Don't recurse into this directory
547
+ * }
548
+ * })
549
+ * ```
1109
550
  */
1110
551
  function walkTree(tree, startPath, visitor, options) {
1111
552
  const maxDepth = options?.maxDepth ?? -1;
@@ -1186,7 +627,7 @@ function matchesPatterns(path, patterns) {
1186
627
  * @param options - Configuration for search behavior
1187
628
  * @returns List of relative file paths that match the patterns
1188
629
  *
1189
- * @example
630
+ * @example Finding files by pattern
1190
631
  * ```typescript
1191
632
  * import { findFiles } from '@hyperfrontend/project-scope'
1192
633
  *
@@ -1204,7 +645,7 @@ function matchesPatterns(path, patterns) {
1204
645
  * ```
1205
646
  */
1206
647
  function findFiles(startPath, patterns, options) {
1207
- const normalizedPatterns = isArray(patterns) ? patterns : [patterns];
648
+ const normalizedPatterns = index_cjs_js$5.isArray(patterns) ? patterns : [patterns];
1208
649
  searchLogger.debug('Finding files', { startPath, patterns: normalizedPatterns, maxResults: options?.maxResults });
1209
650
  const results = [];
1210
651
  const maxResults = options?.maxResults ?? Infinity;
@@ -1231,9 +672,18 @@ function findFiles(startPath, patterns, options) {
1231
672
  * @param patterns - Glob patterns (e.g., '*.ts', '**\/*.json') to filter files
1232
673
  * @param options - Configuration for search behavior
1233
674
  * @returns List of virtual file paths that match the patterns
675
+ *
676
+ * @example Finding files in a virtual tree
677
+ * ```typescript
678
+ * import { createTree, findFilesInTree } from '@hyperfrontend/project-scope'
679
+ *
680
+ * const tree = createTree('/workspace')
681
+ * const tsFiles = findFilesInTree(tree, '**\/*.ts', { maxDepth: 3 })
682
+ * // => ['src/index.ts', 'src/utils/helpers.ts']
683
+ * ```
1234
684
  */
1235
685
  function findFilesInTree(tree, patterns, options) {
1236
- const normalizedPatterns = isArray(patterns) ? patterns : [patterns];
686
+ const normalizedPatterns = index_cjs_js$5.isArray(patterns) ? patterns : [patterns];
1237
687
  const results = [];
1238
688
  const maxResults = options?.maxResults ?? Infinity;
1239
689
  walkTree(tree, tree.root || '', (entry) => {
@@ -1258,9 +708,17 @@ function findFilesInTree(tree, patterns, options) {
1258
708
  * @param patterns - Glob patterns to filter directories (supports wildcards)
1259
709
  * @param options - Configuration for search behavior
1260
710
  * @returns List of relative directory paths that match the patterns
711
+ *
712
+ * @example Finding directories by pattern
713
+ * ```typescript
714
+ * import { findDirectories } from '@hyperfrontend/project-scope'
715
+ *
716
+ * const componentDirs = findDirectories('./src', 'components')
717
+ * // => ['features/auth/components', 'features/dashboard/components']
718
+ * ```
1261
719
  */
1262
720
  function findDirectories(startPath, patterns, options) {
1263
- const normalizedPatterns = isArray(patterns) ? patterns : [patterns];
721
+ const normalizedPatterns = index_cjs_js$5.isArray(patterns) ? patterns : [patterns];
1264
722
  const results = [];
1265
723
  const maxResults = options?.maxResults ?? Infinity;
1266
724
  walkDirectory(startPath, (entry) => {
@@ -1278,311 +736,6 @@ function findDirectories(startPath, patterns, options) {
1278
736
  return results;
1279
737
  }
1280
738
 
1281
- /**
1282
- * Known configuration file patterns organized by type.
1283
- */
1284
- const CONFIG_PATTERNS = {
1285
- 'package.json': {
1286
- patterns: ['package.json'],
1287
- format: 'json',
1288
- description: 'NPM package manifest',
1289
- },
1290
- 'package-lock.json': {
1291
- patterns: ['package-lock.json'],
1292
- format: 'json',
1293
- description: 'NPM lockfile',
1294
- },
1295
- 'pnpm-lock.yaml': {
1296
- patterns: ['pnpm-lock.yaml'],
1297
- format: 'yaml',
1298
- description: 'PNPM lockfile',
1299
- },
1300
- 'yarn.lock': {
1301
- patterns: ['yarn.lock'],
1302
- format: 'text',
1303
- description: 'Yarn lockfile',
1304
- },
1305
- '.npmrc': {
1306
- patterns: ['.npmrc'],
1307
- format: 'ini',
1308
- description: 'NPM configuration',
1309
- sensitive: true,
1310
- },
1311
- tsconfig: {
1312
- patterns: ['tsconfig.json', 'tsconfig.*.json'],
1313
- format: 'jsonc',
1314
- description: 'TypeScript configuration',
1315
- canExtend: true,
1316
- },
1317
- nx: {
1318
- patterns: ['nx.json'],
1319
- format: 'json',
1320
- description: 'NX workspace configuration',
1321
- },
1322
- 'project.json': {
1323
- patterns: ['project.json', '**/project.json'],
1324
- format: 'json',
1325
- description: 'NX project configuration',
1326
- },
1327
- 'workspace.json': {
1328
- patterns: ['workspace.json'],
1329
- format: 'json',
1330
- description: 'NX workspace projects (deprecated)',
1331
- },
1332
- turbo: {
1333
- patterns: ['turbo.json'],
1334
- format: 'jsonc',
1335
- description: 'TurboRepo configuration',
1336
- },
1337
- lerna: {
1338
- patterns: ['lerna.json'],
1339
- format: 'json',
1340
- description: 'Lerna configuration',
1341
- },
1342
- webpack: {
1343
- patterns: ['webpack.config.js', 'webpack.config.ts', 'webpack.config.cjs', 'webpack.config.mjs'],
1344
- format: 'js',
1345
- description: 'Webpack configuration',
1346
- },
1347
- rollup: {
1348
- patterns: ['rollup.config.js', 'rollup.config.ts', 'rollup.config.mjs'],
1349
- format: 'js',
1350
- description: 'Rollup configuration',
1351
- },
1352
- vite: {
1353
- patterns: ['vite.config.js', 'vite.config.ts', 'vite.config.mjs'],
1354
- format: 'js',
1355
- description: 'Vite configuration',
1356
- },
1357
- esbuild: {
1358
- patterns: ['esbuild.config.js', 'esbuild.config.ts', 'esbuild.config.mjs'],
1359
- format: 'js',
1360
- description: 'esbuild configuration',
1361
- },
1362
- babel: {
1363
- patterns: ['babel.config.js', 'babel.config.json', '.babelrc', '.babelrc.js', '.babelrc.json'],
1364
- format: 'json',
1365
- description: 'Babel configuration',
1366
- },
1367
- swc: {
1368
- patterns: ['.swcrc'],
1369
- format: 'json',
1370
- description: 'SWC configuration',
1371
- },
1372
- jest: {
1373
- patterns: ['jest.config.js', 'jest.config.ts', 'jest.config.mjs'],
1374
- description: 'Jest configuration',
1375
- },
1376
- vitest: {
1377
- patterns: ['vitest.config.js', 'vitest.config.ts'],
1378
- description: 'Vitest configuration',
1379
- },
1380
- cypress: {
1381
- patterns: ['cypress.config.js', 'cypress.config.ts'],
1382
- description: 'Cypress configuration',
1383
- },
1384
- playwright: {
1385
- patterns: ['playwright.config.js', 'playwright.config.ts'],
1386
- description: 'Playwright configuration',
1387
- },
1388
- next: {
1389
- patterns: ['next.config.js', 'next.config.mjs', 'next.config.ts'],
1390
- format: 'js',
1391
- description: 'Next.js configuration',
1392
- },
1393
- angular: {
1394
- patterns: ['angular.json'],
1395
- format: 'json',
1396
- description: 'Angular CLI configuration',
1397
- },
1398
- nuxt: {
1399
- patterns: ['nuxt.config.js', 'nuxt.config.ts'],
1400
- format: 'js',
1401
- description: 'Nuxt.js configuration',
1402
- },
1403
- svelte: {
1404
- patterns: ['svelte.config.js', 'svelte.config.ts'],
1405
- format: 'js',
1406
- description: 'SvelteKit configuration',
1407
- },
1408
- astro: {
1409
- patterns: ['astro.config.js', 'astro.config.ts', 'astro.config.mjs'],
1410
- format: 'js',
1411
- description: 'Astro configuration',
1412
- },
1413
- eslint: {
1414
- patterns: [
1415
- 'eslint.config.js',
1416
- 'eslint.config.cjs',
1417
- 'eslint.config.mjs',
1418
- '.eslintrc',
1419
- '.eslintrc.js',
1420
- '.eslintrc.json',
1421
- '.eslintrc.yml',
1422
- ],
1423
- format: 'js',
1424
- description: 'ESLint configuration',
1425
- },
1426
- prettier: {
1427
- patterns: ['prettier.config.js', 'prettier.config.cjs', '.prettierrc', '.prettierrc.js', '.prettierrc.json', '.prettierrc.yml'],
1428
- format: 'json',
1429
- description: 'Prettier configuration',
1430
- },
1431
- env: {
1432
- patterns: ['.env', '.env.*', '*.env'],
1433
- format: 'dotenv',
1434
- description: 'Environment variables',
1435
- sensitive: true,
1436
- },
1437
- '.gitignore': {
1438
- patterns: ['.gitignore'],
1439
- format: 'text',
1440
- description: 'Git ignore patterns',
1441
- },
1442
- '.gitattributes': {
1443
- patterns: ['.gitattributes'],
1444
- format: 'text',
1445
- description: 'Git attributes',
1446
- },
1447
- };
1448
- /**
1449
- * Get patterns for specific config types.
1450
- *
1451
- * @param types - Array of config types to get patterns for
1452
- * @returns Array of file patterns
1453
- */
1454
- function getConfigPatternsByType(types) {
1455
- return types.flatMap((type) => CONFIG_PATTERNS[type]?.patterns ?? []);
1456
- }
1457
-
1458
- /**
1459
- * Global registry of all caches for bulk operations.
1460
- */
1461
- const cacheRegistry = createSet();
1462
- /**
1463
- * Create a cache with optional TTL and size limits.
1464
- *
1465
- * The cache provides a simple key-value store with:
1466
- * - Optional TTL (time-to-live) for automatic expiration
1467
- * - Optional maxSize for limiting cache size with FIFO eviction
1468
- * - Lazy expiration (entries are checked on access)
1469
- *
1470
- * @param options - Cache configuration options
1471
- * @returns Cache instance
1472
- *
1473
- * @example
1474
- * ```typescript
1475
- * // Basic cache
1476
- * const cache = createCache<string, number>()
1477
- * cache.set('answer', 42)
1478
- * cache.get('answer') // 42
1479
- *
1480
- * // Cache with TTL (expires after 60 seconds)
1481
- * const ttlCache = createCache<string, object>({ ttl: 60000 })
1482
- *
1483
- * // Cache with max size (evicts oldest when full)
1484
- * const lruCache = createCache<string, object>({ maxSize: 100 })
1485
- *
1486
- * // Combined options
1487
- * const configCache = createCache<string, object>({
1488
- * ttl: 30000,
1489
- * maxSize: 50
1490
- * })
1491
- * ```
1492
- */
1493
- function createCache(options) {
1494
- const { ttl, maxSize } = options ?? {};
1495
- const store = createMap();
1496
- const insertionOrder = [];
1497
- /**
1498
- * Check if an entry is expired.
1499
- *
1500
- * @param entry - Cache entry to check
1501
- * @returns True if entry is expired
1502
- */
1503
- function isExpired(entry) {
1504
- if (ttl === undefined)
1505
- return false;
1506
- // eslint-disable-next-line workspace/no-unsafe-builtin-methods -- Date.now() is needed for Jest fake timers compatibility
1507
- return Date.now() - entry.timestamp > ttl;
1508
- }
1509
- /**
1510
- * Evict oldest entries to make room for new ones.
1511
- */
1512
- function evictIfNeeded() {
1513
- if (maxSize === undefined)
1514
- return;
1515
- while (store.size >= maxSize && insertionOrder.length > 0) {
1516
- const oldestKey = insertionOrder.shift();
1517
- if (oldestKey !== undefined) {
1518
- store.delete(oldestKey);
1519
- }
1520
- }
1521
- }
1522
- /**
1523
- * Remove key from insertion order tracking.
1524
- *
1525
- * @param key - Key to remove from order tracking
1526
- */
1527
- function removeFromOrder(key) {
1528
- const index = insertionOrder.indexOf(key);
1529
- if (index !== -1) {
1530
- insertionOrder.splice(index, 1);
1531
- }
1532
- }
1533
- const cache = {
1534
- get(key) {
1535
- const entry = store.get(key);
1536
- if (!entry)
1537
- return undefined;
1538
- if (isExpired(entry)) {
1539
- store.delete(key);
1540
- removeFromOrder(key);
1541
- return undefined;
1542
- }
1543
- return entry.value;
1544
- },
1545
- set(key, value) {
1546
- if (store.has(key)) {
1547
- removeFromOrder(key);
1548
- }
1549
- else {
1550
- evictIfNeeded();
1551
- }
1552
- // eslint-disable-next-line workspace/no-unsafe-builtin-methods -- Date.now() is needed for Jest fake timers compatibility
1553
- store.set(key, { value, timestamp: Date.now() });
1554
- insertionOrder.push(key);
1555
- },
1556
- has(key) {
1557
- const entry = store.get(key);
1558
- if (!entry)
1559
- return false;
1560
- if (isExpired(entry)) {
1561
- store.delete(key);
1562
- removeFromOrder(key);
1563
- return false;
1564
- }
1565
- return true;
1566
- },
1567
- delete(key) {
1568
- removeFromOrder(key);
1569
- return store.delete(key);
1570
- },
1571
- clear() {
1572
- store.clear();
1573
- insertionOrder.length = 0;
1574
- },
1575
- size() {
1576
- return store.size;
1577
- },
1578
- keys() {
1579
- return [...insertionOrder];
1580
- },
1581
- };
1582
- cacheRegistry.add(cache);
1583
- return freeze(cache);
1584
- }
1585
-
1586
739
  const configLogger = createScopedLogger('project-scope:config');
1587
740
  /**
1588
741
  * Cache for config detection results.
@@ -1600,7 +753,7 @@ const configDetectionCache = createCache({ ttl: 30000, maxSize: 50 });
1600
753
  * @param options - Detection options
1601
754
  * @returns Array of detected configuration files
1602
755
  *
1603
- * @example
756
+ * @example Detecting configuration files
1604
757
  * ```typescript
1605
758
  * import { detectConfigs } from '@hyperfrontend/project-scope'
1606
759
  *
@@ -1619,7 +772,7 @@ const configDetectionCache = createCache({ ttl: 30000, maxSize: 50 });
1619
772
  * ```
1620
773
  */
1621
774
  function detectConfigs(rootPath, types, options) {
1622
- const typesToCheck = types ?? keys(CONFIG_PATTERNS);
775
+ const typesToCheck = types ?? index_cjs_js$2.keys(CONFIG_PATTERNS);
1623
776
  const results = [];
1624
777
  const maxDepth = options?.maxDepth ?? 10;
1625
778
  const includeHidden = options?.includeHidden ?? true;
@@ -1680,6 +833,14 @@ function detectConfigs(rootPath, types, options) {
1680
833
  * Clear the config detection cache.
1681
834
  *
1682
835
  * Useful for testing or when the project files have changed.
836
+ *
837
+ * @example Clearing the config detection cache
838
+ * ```typescript
839
+ * import { clearConfigDetectionCache } from '@hyperfrontend/project-scope'
840
+ *
841
+ * // Reset cache after modifying config files
842
+ * clearConfigDetectionCache()
843
+ * ```
1683
844
  */
1684
845
  function clearConfigDetectionCache() {
1685
846
  configDetectionCache.clear();
@@ -1690,6 +851,17 @@ function clearConfigDetectionCache() {
1690
851
  * @param rootPath - Project root directory
1691
852
  * @param type - Config type to find
1692
853
  * @returns Full path to config file or null if not found
854
+ *
855
+ * @example Finding a specific config file
856
+ * ```typescript
857
+ * import { findConfigFile } from '@hyperfrontend/project-scope'
858
+ *
859
+ * const tsConfig = findConfigFile('/project', 'typescript')
860
+ * // => '/project/tsconfig.json'
861
+ *
862
+ * const eslint = findConfigFile('/project', 'eslint')
863
+ * // => '/project/.eslintrc.js' or null if not found
864
+ * ```
1693
865
  */
1694
866
  function findConfigFile(rootPath, type) {
1695
867
  const info = CONFIG_PATTERNS[type];
@@ -1713,72 +885,6 @@ function findConfigFile(rootPath, type) {
1713
885
  }
1714
886
  return null;
1715
887
  }
1716
- /**
1717
- * Get all known config file patterns for a given configuration type.
1718
- *
1719
- * @param type - Configuration type identifier
1720
- * @returns Array of glob patterns for matching config files
1721
- */
1722
- function getConfigPaths(type) {
1723
- const info = CONFIG_PATTERNS[type];
1724
- return info?.patterns ?? [];
1725
- }
1726
-
1727
- /**
1728
- * Safe copies of Number built-in methods and constants.
1729
- *
1730
- * These references are captured at module initialization time to protect against
1731
- * prototype pollution attacks. Import only what you need for tree-shaking.
1732
- *
1733
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/number
1734
- */
1735
- const _parseInt = globalThis.parseInt;
1736
- const _parseFloat = globalThis.parseFloat;
1737
- /**
1738
- * (Safe copy) Parses a string and returns an integer.
1739
- */
1740
- const parseInt = _parseInt;
1741
- /**
1742
- * (Safe copy) Parses a string and returns a floating point number.
1743
- */
1744
- const parseFloat = _parseFloat;
1745
-
1746
- /**
1747
- * Create a structured error with code and optional context.
1748
- *
1749
- * @param message - The human-readable error message
1750
- * @param code - The machine-readable error code for programmatic handling
1751
- * @param context - Additional contextual information about the error
1752
- * @returns Structured error instance with code and context properties
1753
- *
1754
- * @example
1755
- * ```typescript
1756
- * import { createStructuredError } from '@hyperfrontend/project-scope'
1757
- *
1758
- * throw createStructuredError(
1759
- * 'Configuration file not found',
1760
- * 'CONFIG_NOT_FOUND',
1761
- * { path: './config.json', searched: ['./config.json', './settings.json'] }
1762
- * )
1763
- * ```
1764
- */
1765
- function createStructuredError(message, code, context) {
1766
- const error = createError(message);
1767
- error.code = code;
1768
- error.context = context ?? {};
1769
- return error;
1770
- }
1771
- /**
1772
- * Create a configuration-related error.
1773
- *
1774
- * @param message - The human-readable error message
1775
- * @param code - The machine-readable error code for programmatic handling
1776
- * @param context - Additional contextual information (e.g., file path, config key)
1777
- * @returns Structured error instance tagged with type 'config'
1778
- */
1779
- function createConfigError(message, code, context) {
1780
- return createStructuredError(message, code, { ...context, type: 'config' });
1781
- }
1782
888
 
1783
889
  /**
1784
890
  * Detect config type from file name.
@@ -1789,7 +895,7 @@ function createConfigError(message, code, context) {
1789
895
  */
1790
896
  function detectConfigType(filePath) {
1791
897
  const fileName = node_path.basename(filePath);
1792
- for (const [type, info] of entries(CONFIG_PATTERNS)) {
898
+ for (const [type, info] of index_cjs_js$2.entries(CONFIG_PATTERNS)) {
1793
899
  for (const pattern of info.patterns) {
1794
900
  if (matchGlobPattern(fileName, pattern)) {
1795
901
  return type;
@@ -1910,10 +1016,10 @@ function parseSimpleYaml(content) {
1910
1016
  result[key] = null;
1911
1017
  }
1912
1018
  else if (/^-?\d+$/.test(value)) {
1913
- result[key] = parseInt(value, 10);
1019
+ result[key] = index_cjs_js$8.parseInt(value, 10);
1914
1020
  }
1915
1021
  else if (/^-?\d+\.\d+$/.test(value)) {
1916
- result[key] = parseFloat(value);
1022
+ result[key] = index_cjs_js$8.parseFloat(value);
1917
1023
  }
1918
1024
  else {
1919
1025
  result[key] = value.replace(/^["']|["']$/g, '');
@@ -1991,16 +1097,28 @@ function parseDotenv(content) {
1991
1097
  * @param type - Category of configuration (e.g., typescript, eslint)
1992
1098
  * @param format - Whether to strip comments (jsonc) or parse strictly (json)
1993
1099
  * @returns Configuration object with parsed data and extends references
1100
+ *
1101
+ * @example Parsing JSON configuration
1102
+ * ```typescript
1103
+ * import { parseJsonConfig } from '@hyperfrontend/project-scope'
1104
+ *
1105
+ * const config = parseJsonConfig(
1106
+ * 'tsconfig.json',
1107
+ * '{ "extends": "./base.json", "compilerOptions": {} }',
1108
+ * 'typescript'
1109
+ * )
1110
+ * // => { type: 'typescript', path: 'tsconfig.json', data: {...}, extends: ['./base.json'] }
1111
+ * ```
1994
1112
  */
1995
1113
  function parseJsonConfig(filePath, content, type, format = 'json') {
1996
1114
  const cleanContent = format === 'jsonc' ? stripJsonComments(content) : content;
1997
1115
  try {
1998
- const data = parse(cleanContent);
1116
+ const data = index_cjs_js$6.parse(cleanContent);
1999
1117
  let extendsPath;
2000
1118
  if (typeof data['extends'] === 'string') {
2001
1119
  extendsPath = [data['extends']];
2002
1120
  }
2003
- else if (isArray(data['extends'])) {
1121
+ else if (index_cjs_js$5.isArray(data['extends'])) {
2004
1122
  extendsPath = data['extends'];
2005
1123
  }
2006
1124
  return {
@@ -2026,6 +1144,14 @@ function parseJsonConfig(filePath, content, type, format = 'json') {
2026
1144
  * @param content - Raw file content to parse
2027
1145
  * @param type - Category of configuration (e.g., github-actions, docker-compose)
2028
1146
  * @returns Configuration object with parsed YAML data
1147
+ *
1148
+ * @example Parsing YAML configuration
1149
+ * ```typescript
1150
+ * import { parseYamlConfig } from '@hyperfrontend/project-scope'
1151
+ *
1152
+ * const config = parseYamlConfig('.github/workflows/ci.yml', yamlContent, 'github-actions')
1153
+ * // => { type: 'github-actions', path: '...', format: 'yaml', data: {...} }
1154
+ * ```
2029
1155
  */
2030
1156
  function parseYamlConfig(filePath, content, type) {
2031
1157
  const data = parseSimpleYaml(content);
@@ -2042,6 +1168,14 @@ function parseYamlConfig(filePath, content, type) {
2042
1168
  * @param filePath - Path to config file
2043
1169
  * @param type - Optional config type (auto-detected if not provided)
2044
1170
  * @returns Parsed configuration
1171
+ *
1172
+ * @example Parsing a configuration file
1173
+ * ```typescript
1174
+ * import { parseConfig } from '@hyperfrontend/project-scope'
1175
+ *
1176
+ * const tsConfig = parseConfig('/project/tsconfig.json')
1177
+ * const eslintConfig = parseConfig('/project/.eslintrc.yml', 'eslint')
1178
+ * ```
2045
1179
  */
2046
1180
  function parseConfig(filePath, type) {
2047
1181
  const content = readFileContent(filePath);
@@ -2086,33 +1220,6 @@ function parseConfig(filePath, type) {
2086
1220
  };
2087
1221
  }
2088
1222
  }
2089
- /**
2090
- * Read and parse config file if it exists.
2091
- *
2092
- * @param configPath - Path to config file
2093
- * @returns Parsed config or null if file doesn't exist
2094
- */
2095
- function readConfigIfExists(configPath) {
2096
- const content = readFileIfExists(configPath);
2097
- if (!content)
2098
- return null;
2099
- try {
2100
- const format = detectFormat(configPath);
2101
- switch (format) {
2102
- case 'json':
2103
- return parse(content);
2104
- case 'jsonc':
2105
- return parse(stripJsonComments(content));
2106
- case 'yaml':
2107
- return parseSimpleYaml(content);
2108
- default:
2109
- return null;
2110
- }
2111
- }
2112
- catch {
2113
- return null;
2114
- }
2115
- }
2116
1223
 
2117
1224
  const packageLogger = createScopedLogger('project-scope:project:package');
2118
1225
  /**
@@ -2125,7 +1232,7 @@ const packageLogger = createScopedLogger('project-scope:project:package');
2125
1232
  function isStringRecord(value) {
2126
1233
  if (typeof value !== 'object' || value === null)
2127
1234
  return false;
2128
- return values(value).every((v) => typeof v === 'string');
1235
+ return index_cjs_js$2.values(value).every((v) => typeof v === 'string');
2129
1236
  }
2130
1237
  /**
2131
1238
  * Extracts and normalizes the workspaces field from package.json,
@@ -2135,12 +1242,12 @@ function isStringRecord(value) {
2135
1242
  * @returns Normalized workspace patterns or undefined if invalid
2136
1243
  */
2137
1244
  function parseWorkspaces(value) {
2138
- if (isArray(value) && value.every((v) => typeof v === 'string')) {
1245
+ if (index_cjs_js$5.isArray(value) && value.every((v) => typeof v === 'string')) {
2139
1246
  return value;
2140
1247
  }
2141
1248
  if (typeof value === 'object' && value !== null) {
2142
1249
  const obj = value;
2143
- if (isArray(obj['packages'])) {
1250
+ if (index_cjs_js$5.isArray(obj['packages'])) {
2144
1251
  return { packages: obj['packages'] };
2145
1252
  }
2146
1253
  }
@@ -2154,7 +1261,7 @@ function parseWorkspaces(value) {
2154
1261
  */
2155
1262
  function validatePackageJson(data) {
2156
1263
  if (typeof data !== 'object' || data === null) {
2157
- throw createError('package.json must be an object');
1264
+ throw index_cjs_js$7.createError('package.json must be an object');
2158
1265
  }
2159
1266
  const pkg = data;
2160
1267
  return {
@@ -2184,13 +1291,21 @@ function validatePackageJson(data) {
2184
1291
  * @param projectPath - Project directory path or path to package.json
2185
1292
  * @returns Parsed package.json
2186
1293
  * @throws {Error} Error if file doesn't exist or is invalid
1294
+ *
1295
+ * @example Reading package.json
1296
+ * ```typescript
1297
+ * import { readPackageJson } from '@hyperfrontend/project-scope'
1298
+ *
1299
+ * const pkg = readPackageJson('/path/to/project')
1300
+ * console.log(pkg.name, pkg.version)
1301
+ * ```
2187
1302
  */
2188
1303
  function readPackageJson(projectPath) {
2189
1304
  const packageJsonPath = projectPath.endsWith('package.json') ? projectPath : node_path.join(projectPath, 'package.json');
2190
1305
  packageLogger.debug('Reading package.json', { path: packageJsonPath });
2191
1306
  const content = readFileContent(packageJsonPath);
2192
1307
  try {
2193
- const data = parse(content);
1308
+ const data = index_cjs_js$6.parse(content);
2194
1309
  const validated = validatePackageJson(data);
2195
1310
  packageLogger.debug('Package.json read successfully', { path: packageJsonPath, name: validated.name });
2196
1311
  return validated;
@@ -2212,6 +1327,16 @@ function readPackageJson(projectPath) {
2212
1327
  *
2213
1328
  * @param projectPath - Project directory path or path to package.json
2214
1329
  * @returns Parsed package.json or null if not found
1330
+ *
1331
+ * @example Reading package.json if it exists
1332
+ * ```typescript
1333
+ * import { readPackageJsonIfExists } from '@hyperfrontend/project-scope'
1334
+ *
1335
+ * const pkg = readPackageJsonIfExists('/path/to/project')
1336
+ * if (pkg) {
1337
+ * console.log('Found:', pkg.name)
1338
+ * }
1339
+ * ```
2215
1340
  */
2216
1341
  function readPackageJsonIfExists(projectPath) {
2217
1342
  const packageJsonPath = projectPath.endsWith('package.json') ? projectPath : node_path.join(projectPath, 'package.json');
@@ -2221,7 +1346,7 @@ function readPackageJsonIfExists(projectPath) {
2221
1346
  return null;
2222
1347
  }
2223
1348
  try {
2224
- const validated = validatePackageJson(parse(content));
1349
+ const validated = validatePackageJson(index_cjs_js$6.parse(content));
2225
1350
  packageLogger.debug('Package.json loaded', { path: packageJsonPath, name: validated.name });
2226
1351
  return validated;
2227
1352
  }
@@ -2235,6 +1360,14 @@ function readPackageJsonIfExists(projectPath) {
2235
1360
  *
2236
1361
  * @param startPath - Starting path
2237
1362
  * @returns Path to directory containing package.json, or null if not found
1363
+ *
1364
+ * @example Finding nearest package.json
1365
+ * ```typescript
1366
+ * import { findNearestPackageJson } from '@hyperfrontend/project-scope'
1367
+ *
1368
+ * const pkgDir = findNearestPackageJson('./src/deep/nested/file.ts')
1369
+ * // => '/path/to/project'
1370
+ * ```
2238
1371
  */
2239
1372
  function findNearestPackageJson(startPath) {
2240
1373
  return locateByMarkers(startPath, ['package.json']);
@@ -2245,6 +1378,15 @@ function findNearestPackageJson(startPath) {
2245
1378
  *
2246
1379
  * @param packageJson - Parsed package.json
2247
1380
  * @returns All dependencies categorized
1381
+ *
1382
+ * @example Extracting all dependencies
1383
+ * ```typescript
1384
+ * import { getDependencies } from '@hyperfrontend/project-scope'
1385
+ *
1386
+ * const deps = getDependencies(packageJson)
1387
+ * console.log('Runtime:', Object.keys(deps.dependencies))
1388
+ * console.log('Dev:', Object.keys(deps.devDependencies))
1389
+ * ```
2248
1390
  */
2249
1391
  function getDependencies(packageJson) {
2250
1392
  return {
@@ -2259,6 +1401,14 @@ function getDependencies(packageJson) {
2259
1401
  *
2260
1402
  * @param packageJson - Parsed package.json
2261
1403
  * @returns Map of dependency name to version for runtime dependencies
1404
+ *
1405
+ * @example Getting production dependencies
1406
+ * ```typescript
1407
+ * import { getProductionDependencies } from '@hyperfrontend/project-scope'
1408
+ *
1409
+ * const prodDeps = getProductionDependencies(packageJson)
1410
+ * // => { 'express': '^4.18.0', 'lodash': '^4.17.21' }
1411
+ * ```
2262
1412
  */
2263
1413
  function getProductionDependencies(packageJson) {
2264
1414
  return packageJson.dependencies ?? {};
@@ -2268,6 +1418,14 @@ function getProductionDependencies(packageJson) {
2268
1418
  *
2269
1419
  * @param packageJson - Parsed package.json
2270
1420
  * @returns Map of dependency name to version for dev-time dependencies
1421
+ *
1422
+ * @example Getting development dependencies
1423
+ * ```typescript
1424
+ * import { getDevDependencies } from '@hyperfrontend/project-scope'
1425
+ *
1426
+ * const devDeps = getDevDependencies(packageJson)
1427
+ * // => { 'jest': '^29.0.0', 'typescript': '^5.0.0' }
1428
+ * ```
2271
1429
  */
2272
1430
  function getDevDependencies(packageJson) {
2273
1431
  return packageJson.devDependencies ?? {};
@@ -2277,6 +1435,14 @@ function getDevDependencies(packageJson) {
2277
1435
  *
2278
1436
  * @param packageJson - Parsed package.json
2279
1437
  * @returns Map of dependency name to version for peer requirements
1438
+ *
1439
+ * @example Getting peer dependencies
1440
+ * ```typescript
1441
+ * import { getPeerDependencies } from '@hyperfrontend/project-scope'
1442
+ *
1443
+ * const peerDeps = getPeerDependencies(packageJson)
1444
+ * // => { 'react': '^18.0.0', 'react-dom': '^18.0.0' }
1445
+ * ```
2280
1446
  */
2281
1447
  function getPeerDependencies(packageJson) {
2282
1448
  return packageJson.peerDependencies ?? {};
@@ -2286,6 +1452,16 @@ function getPeerDependencies(packageJson) {
2286
1452
  *
2287
1453
  * @param packageJson - Parsed package.json
2288
1454
  * @returns All dependencies merged
1455
+ *
1456
+ * @example Getting all merged dependencies
1457
+ * ```typescript
1458
+ * import { getAllDependencies } from '@hyperfrontend/project-scope'
1459
+ *
1460
+ * const allDeps = getAllDependencies(packageJson)
1461
+ * if ('typescript' in allDeps) {
1462
+ * console.log('TypeScript version:', allDeps['typescript'])
1463
+ * }
1464
+ * ```
2289
1465
  */
2290
1466
  function getAllDependencies(packageJson) {
2291
1467
  return {
@@ -2302,6 +1478,17 @@ function getAllDependencies(packageJson) {
2302
1478
  * @param name - Name of the dependency to check
2303
1479
  * @param depTypes - Optional array of dependency types to check (defaults to all)
2304
1480
  * @returns True if dependency exists in specified categories
1481
+ *
1482
+ * @example Checking for a dependency
1483
+ * ```typescript
1484
+ * import { hasDependency } from '@hyperfrontend/project-scope'
1485
+ *
1486
+ * // Check any dependency type
1487
+ * hasDependency(packageJson, 'lodash')
1488
+ *
1489
+ * // Check only production dependencies
1490
+ * hasDependency(packageJson, 'lodash', ['dependencies'])
1491
+ * ```
2305
1492
  */
2306
1493
  function hasDependency(packageJson, name, depTypes) {
2307
1494
  const typesToCheck = depTypes ?? ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'];
@@ -2318,6 +1505,14 @@ function hasDependency(packageJson, name, depTypes) {
2318
1505
  * @param packageJson - Parsed package.json content
2319
1506
  * @param name - Name of the dependency to look up
2320
1507
  * @returns Version string or null if not found
1508
+ *
1509
+ * @example Getting dependency version
1510
+ * ```typescript
1511
+ * import { getDependencyVersion } from '@hyperfrontend/project-scope'
1512
+ *
1513
+ * const version = getDependencyVersion(packageJson, 'react')
1514
+ * // => '^18.2.0' or null
1515
+ * ```
2321
1516
  */
2322
1517
  function getDependencyVersion(packageJson, name) {
2323
1518
  const deps = getDependencies(packageJson);
@@ -2328,11 +1523,19 @@ function getDependencyVersion(packageJson, name) {
2328
1523
  *
2329
1524
  * @param packageJson - Parsed package.json
2330
1525
  * @returns Array of workspace patterns or empty array
1526
+ *
1527
+ * @example Getting workspace patterns
1528
+ * ```typescript
1529
+ * import { getWorkspaces } from '@hyperfrontend/project-scope'
1530
+ *
1531
+ * const patterns = getWorkspaces(packageJson)
1532
+ * // => ['packages/*', 'apps/*']
1533
+ * ```
2331
1534
  */
2332
1535
  function getWorkspaces(packageJson) {
2333
1536
  if (!packageJson.workspaces)
2334
1537
  return [];
2335
- if (isArray(packageJson.workspaces)) {
1538
+ if (index_cjs_js$5.isArray(packageJson.workspaces)) {
2336
1539
  return packageJson.workspaces;
2337
1540
  }
2338
1541
  if (typeof packageJson.workspaces === 'object' && 'packages' in packageJson.workspaces) {
@@ -2345,6 +1548,15 @@ function getWorkspaces(packageJson) {
2345
1548
  *
2346
1549
  * @param packageJson - Parsed package.json
2347
1550
  * @returns True if workspaces are defined
1551
+ *
1552
+ * @example Checking for workspaces
1553
+ * ```typescript
1554
+ * import { hasWorkspaces } from '@hyperfrontend/project-scope'
1555
+ *
1556
+ * if (hasWorkspaces(packageJson)) {
1557
+ * console.log('This is a monorepo')
1558
+ * }
1559
+ * ```
2348
1560
  */
2349
1561
  function hasWorkspaces(packageJson) {
2350
1562
  return getWorkspaces(packageJson).length > 0;
@@ -2355,22 +1567,20 @@ function hasWorkspaces(packageJson) {
2355
1567
  * @param projectPath - Project root directory
2356
1568
  * @param packageName - Package name to check
2357
1569
  * @returns Boolean indicating whether the package exists in node_modules
1570
+ *
1571
+ * @example Checking installed packages
1572
+ * ```typescript
1573
+ * import { hasInstalledPackage } from '@hyperfrontend/project-scope'
1574
+ *
1575
+ * if (hasInstalledPackage('/project', 'typescript')) {
1576
+ * console.log('TypeScript is installed')
1577
+ * }
1578
+ * ```
2358
1579
  */
2359
1580
  function hasInstalledPackage(projectPath, packageName) {
2360
1581
  const pkgPath = node_path.join(projectPath, 'node_modules', packageName, 'package.json');
2361
1582
  return readPackageJsonIfExists(pkgPath) !== null;
2362
1583
  }
2363
- /**
2364
- * Get installed package version from node_modules.
2365
- *
2366
- * @param projectPath - Project root directory
2367
- * @param packageName - Name of the npm package to look up
2368
- * @returns Installed version or null if not found
2369
- */
2370
- function getInstalledVersion(projectPath, packageName) {
2371
- const pkg = readPackageJsonIfExists(node_path.join(projectPath, 'node_modules', packageName, 'package.json'));
2372
- return pkg?.version ?? null;
2373
- }
2374
1584
 
2375
1585
  const rootLogger = createScopedLogger('project-scope:root');
2376
1586
  /**
@@ -2410,7 +1620,7 @@ function looksLikeProjectDir(dirPath) {
2410
1620
  * @param startPath - Starting path
2411
1621
  * @returns Project root path or null
2412
1622
  *
2413
- * @example
1623
+ * @example Finding project root
2414
1624
  * ```typescript
2415
1625
  * import { findProjectRoot } from '@hyperfrontend/project-scope'
2416
1626
  *
@@ -2450,7 +1660,7 @@ function findProjectRoot(startPath) {
2450
1660
  * @param startPath - Starting path
2451
1661
  * @returns Workspace root path or null
2452
1662
  *
2453
- * @example
1663
+ * @example Finding workspace root
2454
1664
  * ```typescript
2455
1665
  * import { findWorkspaceRoot } from '@hyperfrontend/project-scope'
2456
1666
  *
@@ -2490,6 +1700,15 @@ function findWorkspaceRoot(startPath) {
2490
1700
  * @param startPath - Starting path
2491
1701
  * @param markers - Files to search for
2492
1702
  * @returns Root directory path or null
1703
+ *
1704
+ * @example Finding root by marker files
1705
+ * ```typescript
1706
+ * import { findRootDirectory } from '@hyperfrontend/project-scope'
1707
+ *
1708
+ * // Find monorepo root by looking for nx.json or lerna.json
1709
+ * const root = findRootDirectory('./libs/my-lib', ['nx.json', 'lerna.json'])
1710
+ * // => '/path/to/monorepo'
1711
+ * ```
2493
1712
  */
2494
1713
  function findRootDirectory(startPath, markers) {
2495
1714
  return locateByMarkers(startPath, markers);
@@ -2499,6 +1718,14 @@ function findRootDirectory(startPath, markers) {
2499
1718
  *
2500
1719
  * @param startPath - Starting path
2501
1720
  * @returns Git root path or null
1721
+ *
1722
+ * @example Finding Git repository root
1723
+ * ```typescript
1724
+ * import { findGitRoot } from '@hyperfrontend/project-scope'
1725
+ *
1726
+ * const gitRoot = findGitRoot('./src/deep/nested/file.ts')
1727
+ * // => '/path/to/repository'
1728
+ * ```
2502
1729
  */
2503
1730
  function findGitRoot(startPath) {
2504
1731
  return locateByMarkers(startPath, ['.git']);
@@ -2519,12 +1746,10 @@ exports.findProjectRoot = findProjectRoot;
2519
1746
  exports.findRootDirectory = findRootDirectory;
2520
1747
  exports.findWorkspaceRoot = findWorkspaceRoot;
2521
1748
  exports.getAllDependencies = getAllDependencies;
2522
- exports.getConfigPaths = getConfigPaths;
2523
1749
  exports.getConfigPatternsByType = getConfigPatternsByType;
2524
1750
  exports.getDependencies = getDependencies;
2525
1751
  exports.getDependencyVersion = getDependencyVersion;
2526
1752
  exports.getDevDependencies = getDevDependencies;
2527
- exports.getInstalledVersion = getInstalledVersion;
2528
1753
  exports.getPeerDependencies = getPeerDependencies;
2529
1754
  exports.getProductionDependencies = getProductionDependencies;
2530
1755
  exports.getWorkspaces = getWorkspaces;
@@ -2534,9 +1759,7 @@ exports.hasWorkspaces = hasWorkspaces;
2534
1759
  exports.parseConfig = parseConfig;
2535
1760
  exports.parseJsonConfig = parseJsonConfig;
2536
1761
  exports.parseYamlConfig = parseYamlConfig;
2537
- exports.readConfigIfExists = readConfigIfExists;
2538
1762
  exports.readPackageJson = readPackageJson;
2539
1763
  exports.readPackageJsonIfExists = readPackageJsonIfExists;
2540
1764
  exports.walkDirectory = walkDirectory;
2541
1765
  exports.walkTree = walkTree;
2542
- //# sourceMappingURL=index.cjs.js.map