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