@hyperfrontend/project-scope 0.2.0 → 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 +13 -15
  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 +1699 -2040
  55. package/cli/index.d.ts +273 -7
  56. package/cli/index.d.ts.map +1 -1
  57. package/cli/index.esm.js +1603 -1944
  58. package/core/encoding/index.cjs.js +88 -424
  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 +80 -415
  62. package/core/fs/index.cjs.js +231 -595
  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 -585
  66. package/core/index.cjs.js +518 -1804
  67. package/core/index.d.ts +486 -9
  68. package/core/index.d.ts.map +1 -1
  69. package/core/index.esm.js +501 -1784
  70. package/core/path/index.cjs.js +6 -235
  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 -233
  74. package/core/platform/index.cjs.js +5 -226
  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 -222
  78. package/heuristics/dependencies/index.cjs.js +95 -509
  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 -483
  82. package/heuristics/entry-points/index.cjs.js +93 -825
  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 +74 -806
  86. package/heuristics/framework/index.cjs.js +1482 -1473
  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 +1418 -1409
  90. package/heuristics/index.cjs.js +3207 -3383
  91. package/heuristics/index.d.ts +4 -5
  92. package/heuristics/index.d.ts.map +1 -1
  93. package/heuristics/index.esm.js +3234 -3410
  94. package/heuristics/project-type/index.cjs.js +1488 -1500
  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 +1417 -1429
  98. package/index.cjs.js +3064 -3765
  99. package/index.d.ts +44 -10
  100. package/index.d.ts.map +1 -1
  101. package/index.esm.js +2923 -3612
  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 -606
  107. package/nx/index.d.ts +279 -4
  108. package/nx/index.d.ts.map +1 -1
  109. package/nx/index.esm.js +145 -583
  110. package/package.json +13 -12
  111. package/project/config/index.cjs.js +122 -1104
  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 -1085
  115. package/project/index.cjs.js +323 -1143
  116. package/project/index.d.ts +4 -5
  117. package/project/index.d.ts.map +1 -1
  118. package/project/index.esm.js +302 -1119
  119. package/project/package/index.cjs.js +191 -483
  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 -469
  123. package/project/root/index.cjs.js +107 -427
  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 -416
  127. package/project/traversal/index.cjs.js +94 -645
  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 -631
  131. package/tech/backend/index.cjs.js +221 -524
  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 -503
  135. package/tech/build/index.cjs.js +348 -647
  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 -625
  139. package/tech/frontend/index.cjs.js +505 -700
  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 -676
  143. package/tech/index.cjs.js +1580 -1482
  144. package/tech/index.d.ts +55 -32
  145. package/tech/index.d.ts.map +1 -1
  146. package/tech/index.esm.js +1513 -1415
  147. package/tech/legacy/index.cjs.js +97 -474
  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 -456
  151. package/tech/linting/index.cjs.js +136 -536
  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 -516
  155. package/tech/monorepo/index.cjs.js +244 -584
  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 -564
  159. package/tech/testing/index.cjs.js +214 -582
  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 -564
  163. package/tech/types/index.cjs.js +121 -532
  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 -510
  167. package/vfs/index.cjs.js +647 -1187
  168. package/vfs/index.d.ts +360 -6
  169. package/vfs/index.d.ts.map +1 -1
  170. package/vfs/index.esm.js +672 -1212
  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 -20
  175. package/cli/commands/analyze.d.ts.map +0 -1
  176. package/cli/commands/config.d.ts +0 -20
  177. package/cli/commands/config.d.ts.map +0 -1
  178. package/cli/commands/deps.d.ts +0 -18
  179. package/cli/commands/deps.d.ts.map +0 -1
  180. package/cli/commands/tree.d.ts +0 -24
  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 -157
  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 -86
  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 -64
  197. package/core/errors/structured-errors.d.ts.map +0 -1
  198. package/core/fs/directory.d.ts +0 -88
  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 -86
  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 -46
  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 -86
  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 -109
  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 -66
  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 -178
  439. package/vfs/types.d.ts.map +0 -1
@@ -1,420 +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
- // Capture references at module initialization time
18
- const _Error = globalThis.Error;
19
- const _Reflect$2 = globalThis.Reflect;
20
- /**
21
- * (Safe copy) Creates a new Error using the captured Error constructor.
22
- * Use this instead of `new Error()`.
23
- *
24
- * @param message - Optional error message.
25
- * @param options - Optional error options.
26
- * @returns A new Error instance.
27
- */
28
- const createError = (message, options) => _Reflect$2.construct(_Error, [message, options]);
29
-
30
- /**
31
- * Safe copies of JSON built-in methods.
32
- *
33
- * These references are captured at module initialization time to protect against
34
- * prototype pollution attacks. Import only what you need for tree-shaking.
35
- *
36
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/json
37
- */
38
- // Capture references at module initialization time
39
- const _JSON = globalThis.JSON;
40
- /**
41
- * (Safe copy) Converts a JavaScript Object Notation (JSON) string into an object.
42
- */
43
- const parse = _JSON.parse;
44
- /**
45
- * (Safe copy) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
46
- */
47
- const stringify = _JSON.stringify;
48
-
49
- /**
50
- * Safe copies of Object built-in methods.
51
- *
52
- * These references are captured at module initialization time to protect against
53
- * prototype pollution attacks. Import only what you need for tree-shaking.
54
- *
55
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/object
56
- */
57
- // Capture references at module initialization time
58
- const _Object = globalThis.Object;
59
- /**
60
- * (Safe copy) Prevents modification of existing property attributes and values,
61
- * and prevents the addition of new properties.
62
- */
63
- const freeze = _Object.freeze;
64
- /**
65
- * (Safe copy) Returns the names of the enumerable string properties and methods of an object.
66
- */
67
- const keys = _Object.keys;
68
- /**
69
- * (Safe copy) Returns an array of key/values of the enumerable own properties of an object.
70
- */
71
- const entries = _Object.entries;
72
- /**
73
- * (Safe copy) Returns an array of values of the enumerable own properties of an object.
74
- */
75
- const values = _Object.values;
76
- /**
77
- * (Safe copy) Adds one or more properties to an object, and/or modifies attributes of existing properties.
78
- */
79
- const defineProperties = _Object.defineProperties;
80
-
81
- /**
82
- * Safe copies of Array built-in static methods.
83
- *
84
- * These references are captured at module initialization time to protect against
85
- * prototype pollution attacks. Import only what you need for tree-shaking.
86
- *
87
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/array
88
- */
89
- // Capture references at module initialization time
90
- const _Array = globalThis.Array;
91
- /**
92
- * (Safe copy) Determines whether the passed value is an Array.
93
- */
94
- const isArray = _Array.isArray;
95
-
96
- /**
97
- * Safe copies of Console built-in methods.
98
- *
99
- * These references are captured at module initialization time to protect against
100
- * prototype pollution attacks. Import only what you need for tree-shaking.
101
- *
102
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/console
103
- */
104
- // Capture references at module initialization time
105
- const _console = globalThis.console;
106
- /**
107
- * (Safe copy) Outputs a message to the console.
108
- */
109
- const log = _console.log.bind(_console);
110
- /**
111
- * (Safe copy) Outputs a warning message to the console.
112
- */
113
- const warn = _console.warn.bind(_console);
114
- /**
115
- * (Safe copy) Outputs an error message to the console.
116
- */
117
- const error = _console.error.bind(_console);
118
- /**
119
- * (Safe copy) Outputs an informational message to the console.
120
- */
121
- const info = _console.info.bind(_console);
122
- /**
123
- * (Safe copy) Outputs a debug message to the console.
124
- */
125
- const debug = _console.debug.bind(_console);
126
- /**
127
- * (Safe copy) Outputs a stack trace to the console.
128
- */
129
- _console.trace.bind(_console);
130
- /**
131
- * (Safe copy) Displays an interactive listing of the properties of a specified object.
132
- */
133
- _console.dir.bind(_console);
134
- /**
135
- * (Safe copy) Displays tabular data as a table.
136
- */
137
- _console.table.bind(_console);
138
- /**
139
- * (Safe copy) Writes an error message to the console if the assertion is false.
140
- */
141
- _console.assert.bind(_console);
142
- /**
143
- * (Safe copy) Clears the console.
144
- */
145
- _console.clear.bind(_console);
146
- /**
147
- * (Safe copy) Logs the number of times that this particular call to count() has been called.
148
- */
149
- _console.count.bind(_console);
150
- /**
151
- * (Safe copy) Resets the counter used with console.count().
152
- */
153
- _console.countReset.bind(_console);
154
- /**
155
- * (Safe copy) Creates a new inline group in the console.
156
- */
157
- _console.group.bind(_console);
158
- /**
159
- * (Safe copy) Creates a new inline group in the console that is initially collapsed.
160
- */
161
- _console.groupCollapsed.bind(_console);
162
- /**
163
- * (Safe copy) Exits the current inline group.
164
- */
165
- _console.groupEnd.bind(_console);
166
- /**
167
- * (Safe copy) Starts a timer with a name specified as an input parameter.
168
- */
169
- _console.time.bind(_console);
170
- /**
171
- * (Safe copy) Stops a timer that was previously started.
172
- */
173
- _console.timeEnd.bind(_console);
174
- /**
175
- * (Safe copy) Logs the current value of a timer that was previously started.
176
- */
177
- _console.timeLog.bind(_console);
178
-
179
- /**
180
- * Safe copies of Set built-in via factory function.
181
- *
182
- * Since constructors cannot be safely captured via Object.assign, this module
183
- * provides a factory function that uses Reflect.construct internally.
184
- *
185
- * These references are captured at module initialization time to protect against
186
- * prototype pollution attacks. Import only what you need for tree-shaking.
187
- *
188
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/set
189
- */
190
- // Capture references at module initialization time
191
- const _Set = globalThis.Set;
192
- const _Reflect$1 = globalThis.Reflect;
193
- /**
194
- * (Safe copy) Creates a new Set using the captured Set constructor.
195
- * Use this instead of `new Set()`.
196
- *
197
- * @param iterable - Optional iterable of values.
198
- * @returns A new Set instance.
199
- */
200
- const createSet = (iterable) => _Reflect$1.construct(_Set, iterable ? [iterable] : []);
201
-
202
- const registeredClasses = [];
203
-
204
- /**
205
- * Returns the data type of the target.
206
- * Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`.
207
- * Also, when classes are registered via `registerClass`, it checks if objects are instance of any known registered class.
208
- *
209
- * @param target - The target to get the data type of.
210
- * @returns The data type of the target.
211
- */
212
- const getType = (target) => {
213
- if (target === null)
214
- return 'null';
215
- const nativeDataType = typeof target;
216
- if (nativeDataType === 'object') {
217
- if (isArray(target))
218
- return 'array';
219
- for (const registeredClass of registeredClasses) {
220
- if (target instanceof registeredClass)
221
- return registeredClass.name;
222
- }
223
- }
224
- return nativeDataType;
225
- };
226
-
227
- /**
228
- * Safe copies of Map built-in via factory function.
229
- *
230
- * Since constructors cannot be safely captured via Object.assign, this module
231
- * provides a factory function that uses Reflect.construct internally.
232
- *
233
- * These references are captured at module initialization time to protect against
234
- * prototype pollution attacks. Import only what you need for tree-shaking.
235
- *
236
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/map
237
- */
238
- // Capture references at module initialization time
239
- const _Map = globalThis.Map;
240
- const _Reflect = globalThis.Reflect;
241
- /**
242
- * (Safe copy) Creates a new Map using the captured Map constructor.
243
- * Use this instead of `new Map()`.
244
- *
245
- * @param iterable - Optional iterable of key-value pairs.
246
- * @returns A new Map instance.
247
- */
248
- const createMap = (iterable) => _Reflect.construct(_Map, iterable ? [iterable] : []);
249
-
250
- /* eslint-disable @typescript-eslint/no-explicit-any */
251
- /**
252
- * Creates a wrapper function that only executes the wrapped function if the condition function returns true.
253
- *
254
- * @param func - The function to be conditionally executed.
255
- * @param conditionFunc - A function that returns a boolean, determining if `func` should be executed.
256
- * @returns A wrapped version of `func` that executes conditionally.
257
- */
258
- function createConditionalExecutionFunction(func, conditionFunc) {
259
- return function (...args) {
260
- if (conditionFunc()) {
261
- return func(...args);
262
- }
263
- };
264
- }
265
-
266
- /* eslint-disable @typescript-eslint/no-explicit-any */
267
- /**
268
- * Creates a wrapper function that silently ignores any errors thrown by the wrapped void function.
269
- * This function is specifically for wrapping functions that do not return a value (void functions).
270
- * Exceptions are swallowed without any logging or handling.
271
- *
272
- * @param func - The void function to be wrapped.
273
- * @returns A wrapped version of the input function that ignores errors.
274
- */
275
- function createErrorIgnoringFunction(func) {
276
- return function (...args) {
277
- try {
278
- func(...args);
279
- }
280
- catch {
281
- // Deliberately swallowing/ignoring the exception
282
- }
283
- };
284
- }
285
-
286
- /* eslint-disable @typescript-eslint/no-unused-vars */
287
- /**
288
- * A no-operation function (noop) that does nothing regardless of the arguments passed.
289
- * It is designed to be as permissive as possible in its typing without using the `Function` keyword.
290
- *
291
- * @param args - Any arguments passed to the function (ignored)
292
- */
293
- const noop = (...args) => {
294
- // Intentionally does nothing
295
- };
296
-
297
- const logLevels = ['none', 'error', 'warn', 'log', 'info', 'debug'];
298
- const priority = {
299
- error: 4,
300
- warn: 3,
301
- log: 2,
302
- info: 1,
303
- debug: 0,
304
- };
305
- /**
306
- * Validates whether a given string is a valid log level.
307
- *
308
- * @param level - The log level to validate
309
- * @returns True if the level is valid, false otherwise
310
- */
311
- function isValidLogLevel(level) {
312
- return logLevels.includes(level);
313
- }
314
- /**
315
- * Creates a log level configuration manager for controlling logging behavior.
316
- * Provides methods to get, set, and evaluate log levels based on priority.
317
- *
318
- * @param level - The initial log level (defaults to 'error')
319
- * @returns A configuration object with log level management methods
320
- * @throws {Error} When the provided level is not a valid log level
321
- */
322
- function createLogLevelConfig(level = 'error') {
323
- if (!isValidLogLevel(level)) {
324
- throw createError('Cannot create log level configuration with a valid default log level');
325
- }
326
- const state = { level };
327
- const getLogLevel = () => state.level;
328
- const setLogLevel = (level) => {
329
- if (!isValidLogLevel(level)) {
330
- throw createError(`Cannot set value '${level}' level. Expected levels are ${logLevels}.`);
331
- }
332
- state.level = level;
333
- };
334
- const shouldLog = (level) => {
335
- if (state.level === 'none' || level === 'none' || !isValidLogLevel(level)) {
336
- return false;
337
- }
338
- return priority[level] >= priority[state.level];
339
- };
340
- return freeze({
341
- getLogLevel,
342
- setLogLevel,
343
- shouldLog,
344
- });
345
- }
346
-
347
- /**
348
- * Creates a logger instance with configurable log level filtering.
349
- * Each log function is wrapped to respect the current log level setting.
350
- *
351
- * @param error - Function to handle error-level logs (required)
352
- * @param warn - Function to handle warning-level logs (optional, defaults to noop)
353
- * @param log - Function to handle standard logs (optional, defaults to noop)
354
- * @param info - Function to handle info-level logs (optional, defaults to noop)
355
- * @param debug - Function to handle debug-level logs (optional, defaults to noop)
356
- * @returns A frozen logger object with log methods and level control
357
- * @throws {ErrorLevelFn} When any provided log function is invalid
358
- */
359
- function createLogger(error, warn = noop, log = noop, info = noop, debug = noop) {
360
- if (notValidLogFn(error)) {
361
- throw createError(notFnMsg('error'));
362
- }
363
- if (notValidLogFn(warn)) {
364
- throw createError(notFnMsg('warn'));
365
- }
366
- if (notValidLogFn(log)) {
367
- throw createError(notFnMsg('log'));
368
- }
369
- if (notValidLogFn(info)) {
370
- throw createError(notFnMsg('info'));
371
- }
372
- if (notValidLogFn(debug)) {
373
- throw createError(notFnMsg('debug'));
374
- }
375
- const { setLogLevel, getLogLevel, shouldLog } = createLogLevelConfig();
376
- const wrapLogFn = (fn, level) => {
377
- if (fn === noop)
378
- return fn;
379
- const condition = () => shouldLog(level);
380
- return createConditionalExecutionFunction(createErrorIgnoringFunction(fn), condition);
381
- };
382
- return freeze({
383
- error: wrapLogFn(error, 'error'),
384
- warn: wrapLogFn(warn, 'warn'),
385
- log: wrapLogFn(log, 'log'),
386
- info: wrapLogFn(info, 'info'),
387
- debug: wrapLogFn(debug, 'debug'),
388
- setLogLevel,
389
- getLogLevel,
390
- });
391
- }
392
- /**
393
- * Validates whether a given value is a valid log function.
394
- *
395
- * @param fn - The value to validate
396
- * @returns True if the value is not a function (invalid), false if it is valid
397
- */
398
- function notValidLogFn(fn) {
399
- return getType(fn) !== 'function' && fn !== noop;
400
- }
401
- /**
402
- * Generates an error message for invalid log function parameters.
403
- *
404
- * @param label - The name of the log function that failed validation
405
- * @returns A formatted error message string
406
- */
407
- function notFnMsg(label) {
408
- return `Cannot create a logger when ${label} is not a function`;
409
- }
410
-
411
- 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');
412
20
 
413
21
  /**
414
22
  * Global log level registry.
415
23
  * Tracks all created scoped loggers to allow global log level changes.
416
24
  */
417
- const loggerRegistry = createSet();
25
+ const loggerRegistry = index_cjs_js.createSet();
418
26
  /** Redacted placeholder for sensitive values */
419
27
  const REDACTED = '[REDACTED]';
420
28
  /**
@@ -448,17 +56,24 @@ function isSensitiveKey(key) {
448
56
  *
449
57
  * @param obj - Object to sanitize
450
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
+ * ```
451
66
  */
452
67
  function sanitize(obj) {
453
68
  if (obj === null || obj === undefined) {
454
69
  return obj;
455
70
  }
456
- if (isArray(obj)) {
71
+ if (index_cjs_js$5.isArray(obj)) {
457
72
  return obj.map((item) => sanitize(item));
458
73
  }
459
74
  if (typeof obj === 'object') {
460
75
  const result = {};
461
- for (const [key, value] of entries(obj)) {
76
+ for (const [key, value] of index_cjs_js$2.entries(obj)) {
462
77
  if (isSensitiveKey(key)) {
463
78
  result[key] = REDACTED;
464
79
  }
@@ -483,9 +98,9 @@ function sanitize(obj) {
483
98
  */
484
99
  function formatMessage(namespace, message, meta) {
485
100
  const prefix = `[${namespace}]`;
486
- if (meta && keys(meta).length > 0) {
101
+ if (meta && index_cjs_js$2.keys(meta).length > 0) {
487
102
  const sanitizedMeta = sanitize(meta);
488
- return `${prefix} ${message} ${stringify(sanitizedMeta)}`;
103
+ return `${prefix} ${message} ${index_cjs_js$6.stringify(sanitizedMeta)}`;
489
104
  }
490
105
  return `${prefix} ${message}`;
491
106
  }
@@ -498,7 +113,7 @@ function formatMessage(namespace, message, meta) {
498
113
  * @param options - Logger configuration options
499
114
  * @returns A configured scoped logger instance
500
115
  *
501
- * @example
116
+ * @example Creating a scoped logger
502
117
  * ```typescript
503
118
  * const logger = createScopedLogger('project-scope')
504
119
  * logger.setLogLevel('debug')
@@ -513,16 +128,13 @@ function formatMessage(namespace, message, meta) {
513
128
  */
514
129
  function createScopedLogger(namespace, options = {}) {
515
130
  const { level = 'error', sanitizeSecrets = true } = options;
516
- // Create wrapper functions that add namespace prefix and sanitization
517
131
  const createLogFn = (baseFn) => (message, meta) => {
518
132
  const processedMeta = sanitizeSecrets && meta ? sanitize(meta) : meta;
519
133
  baseFn(formatMessage(namespace, message, processedMeta));
520
134
  };
521
- // Create base logger with wrapped functions
522
- const baseLogger = createLogger(createLogFn(error), createLogFn(warn), createLogFn(log), createLogFn(info), createLogFn(debug));
523
- // Set initial log level (use global override if set)
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));
524
136
  baseLogger.setLogLevel(level);
525
- const scopedLogger = freeze({
137
+ const scopedLogger = index_cjs_js$2.freeze({
526
138
  error: (message, meta) => baseLogger.error(message, meta),
527
139
  warn: (message, meta) => baseLogger.warn(message, meta),
528
140
  log: (message, meta) => baseLogger.log(message, meta),
@@ -531,7 +143,6 @@ function createScopedLogger(namespace, options = {}) {
531
143
  setLogLevel: baseLogger.setLogLevel,
532
144
  getLogLevel: baseLogger.getLogLevel,
533
145
  });
534
- // Register logger for global level management
535
146
  loggerRegistry.add(scopedLogger);
536
147
  return scopedLogger;
537
148
  }
@@ -539,7 +150,7 @@ function createScopedLogger(namespace, options = {}) {
539
150
  * Default logger instance for the project-scope library.
540
151
  * Use this for general logging within the library.
541
152
  *
542
- * @example
153
+ * @example Using the default logger
543
154
  * ```typescript
544
155
  * import { logger } from '@hyperfrontend/project-scope/core'
545
156
  *
@@ -557,10 +168,19 @@ const fsLogger = createScopedLogger('project-scope:fs');
557
168
  * @param code - The category code for this type of filesystem failure
558
169
  * @param context - Additional context including path, operation, and cause
559
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
+ * ```
560
180
  */
561
181
  function createFileSystemError(message, code, context) {
562
- const error = createError(message);
563
- defineProperties(error, {
182
+ const error = index_cjs_js$7.createError(message);
183
+ index_cjs_js$2.defineProperties(error, {
564
184
  code: { value: code, enumerable: true },
565
185
  context: { value: context, enumerable: true },
566
186
  });
@@ -574,7 +194,7 @@ function createFileSystemError(message, code, context) {
574
194
  * @returns File contents as string
575
195
  * @throws {Error} If file doesn't exist or can't be read
576
196
  *
577
- * @example
197
+ * @example Reading file contents
578
198
  * ```typescript
579
199
  * import { readFileContent } from '@hyperfrontend/project-scope'
580
200
  *
@@ -601,6 +221,14 @@ function readFileContent(filePath, encoding = 'utf-8') {
601
221
  * @param filePath - Path to file
602
222
  * @param encoding - File encoding (default: utf-8)
603
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
+ * ```
604
232
  */
605
233
  function readFileIfExists(filePath, encoding = 'utf-8') {
606
234
  if (!node_fs.existsSync(filePath)) {
@@ -614,56 +242,6 @@ function readFileIfExists(filePath, encoding = 'utf-8') {
614
242
  }
615
243
  }
616
244
 
617
- createScopedLogger('project-scope:fs:write');
618
-
619
- /**
620
- * Get file stats with error handling.
621
- *
622
- * @param filePath - Path to file
623
- * @param followSymlinks - Whether to follow symlinks (default: true)
624
- * @returns File stats or null if path doesn't exist
625
- */
626
- function getFileStat(filePath, followSymlinks = true) {
627
- if (!node_fs.existsSync(filePath)) {
628
- return null;
629
- }
630
- try {
631
- const stat = followSymlinks ? node_fs.statSync(filePath) : node_fs.lstatSync(filePath);
632
- return {
633
- isFile: stat.isFile(),
634
- isDirectory: stat.isDirectory(),
635
- isSymlink: stat.isSymbolicLink(),
636
- size: stat.size,
637
- created: stat.birthtime,
638
- modified: stat.mtime,
639
- accessed: stat.atime,
640
- mode: stat.mode,
641
- };
642
- }
643
- catch {
644
- return null;
645
- }
646
- }
647
- /**
648
- * Check if path is a directory.
649
- *
650
- * @param dirPath - Path to check
651
- * @returns True if path is a directory
652
- */
653
- function isDirectory(dirPath) {
654
- const stats = getFileStat(dirPath);
655
- return stats?.isDirectory ?? false;
656
- }
657
- /**
658
- * Check if path exists.
659
- *
660
- * @param filePath - Path to check
661
- * @returns True if path exists
662
- */
663
- function exists(filePath) {
664
- return node_fs.existsSync(filePath);
665
- }
666
-
667
245
  const fsDirLogger = createScopedLogger('project-scope:fs:dir');
668
246
  /**
669
247
  * List immediate contents of a directory.
@@ -672,7 +250,7 @@ const fsDirLogger = createScopedLogger('project-scope:fs:dir');
672
250
  * @returns Array of entries with metadata for each file/directory
673
251
  * @throws {Error} If directory doesn't exist or isn't a directory
674
252
  *
675
- * @example
253
+ * @example Listing directory contents
676
254
  * ```typescript
677
255
  * import { readDirectory } from '@hyperfrontend/project-scope'
678
256
  *
@@ -713,17 +291,6 @@ function readDirectory(dirPath) {
713
291
  }
714
292
  }
715
293
 
716
- /**
717
- * Join path segments.
718
- * Uses platform-specific separators (e.g., / or \).
719
- *
720
- * @param paths - Path segments to join
721
- * @returns Joined path
722
- */
723
- function join(...paths) {
724
- return node_path.join(...paths);
725
- }
726
-
727
294
  const fsTraversalLogger = createScopedLogger('project-scope:fs:traversal');
728
295
  /**
729
296
  * Generic upward directory traversal.
@@ -732,6 +299,15 @@ const fsTraversalLogger = createScopedLogger('project-scope:fs:traversal');
732
299
  * @param startPath - Starting directory
733
300
  * @param predicate - Function to test each directory
734
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
+ * ```
735
311
  */
736
312
  function traverseUpward(startPath, predicate) {
737
313
  fsTraversalLogger.debug('Starting upward traversal', { startPath });
@@ -744,7 +320,6 @@ function traverseUpward(startPath, predicate) {
744
320
  }
745
321
  currentPath = node_path.dirname(currentPath);
746
322
  }
747
- // Check root directory
748
323
  if (predicate(rootPath)) {
749
324
  fsTraversalLogger.debug('Upward traversal found match at root', { startPath, foundPath: rootPath });
750
325
  return rootPath;
@@ -758,6 +333,17 @@ function traverseUpward(startPath, predicate) {
758
333
  * @param startPath - Starting directory
759
334
  * @param markers - Array of marker file names to search for
760
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
+ * ```
761
347
  */
762
348
  function locateByMarkers(startPath, markers) {
763
349
  fsTraversalLogger.debug('Locating by markers', { startPath, markers });
@@ -773,217 +359,21 @@ function locateByMarkers(startPath, markers) {
773
359
  * @param startPath - Starting directory
774
360
  * @param test - Function to test if directory matches criteria
775
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
+ * ```
776
370
  */
777
371
  function findUpwardWhere(startPath, test) {
778
372
  fsTraversalLogger.debug('Finding upward where condition met', { startPath });
779
373
  return traverseUpward(startPath, test);
780
374
  }
781
375
 
782
- /**
783
- * Pattern matching utilities with ReDoS protection.
784
- * Uses character-by-character matching instead of regex where possible.
785
- */
786
- /**
787
- * Match path against glob pattern using safe character iteration.
788
- * Avoids regex to prevent ReDoS attacks.
789
- *
790
- * Supported patterns:
791
- * - * matches any characters except /
792
- * - ** matches any characters including /
793
- * - ? matches exactly one character except /
794
- * - {a,b,c} matches any of the alternatives
795
- *
796
- * @param path - The filesystem path to test against the pattern
797
- * @param pattern - The glob pattern to match against
798
- * @returns True if path matches pattern
799
- *
800
- * @example
801
- * ```typescript
802
- * import { matchGlobPattern } from '@hyperfrontend/project-scope'
803
- *
804
- * matchGlobPattern('src/utils/helper.ts', '\*\*\/*.ts') // true
805
- * matchGlobPattern('test.spec.ts', '\*.spec.ts') // true
806
- * matchGlobPattern('config.json', '\*.{json,yaml}') // true
807
- * matchGlobPattern('src/index.ts', 'src/\*.ts') // true
808
- * ```
809
- */
810
- function matchGlobPattern(path, pattern) {
811
- return matchSegments(path.split('/'), pattern.split('/'), 0, 0);
812
- }
813
- /**
814
- * Internal recursive function to match path segments against pattern segments.
815
- *
816
- * @param pathParts - Array of path segments split by '/'
817
- * @param patternParts - Array of pattern segments split by '/'
818
- * @param pathIdx - Current index in pathParts being examined
819
- * @param patternIdx - Current index in patternParts being examined
820
- * @returns True if remaining segments match
821
- */
822
- function matchSegments(pathParts, patternParts, pathIdx, patternIdx) {
823
- // Base cases
824
- if (pathIdx === pathParts.length && patternIdx === patternParts.length) {
825
- return true; // Both exhausted = match
826
- }
827
- if (patternIdx >= patternParts.length) {
828
- return false; // Pattern exhausted but path remains
829
- }
830
- const patternPart = patternParts[patternIdx];
831
- // Handle ** (globstar) - matches zero or more directories
832
- if (patternPart === '**') {
833
- // Try matching rest of pattern against current position and all future positions
834
- for (let i = pathIdx; i <= pathParts.length; i++) {
835
- if (matchSegments(pathParts, patternParts, i, patternIdx + 1)) {
836
- return true;
837
- }
838
- }
839
- return false;
840
- }
841
- if (pathIdx >= pathParts.length) {
842
- return false; // Path exhausted but pattern remains (and it's not **)
843
- }
844
- const pathPart = pathParts[pathIdx];
845
- // Match current segment
846
- if (matchSegment(pathPart, patternPart)) {
847
- return matchSegments(pathParts, patternParts, pathIdx + 1, patternIdx + 1);
848
- }
849
- return false;
850
- }
851
- /**
852
- * Match a single path segment against a pattern segment.
853
- * Handles *, ?, and {a,b,c} patterns.
854
- *
855
- * @param text - The path segment text to match
856
- * @param pattern - The pattern segment to match against
857
- * @returns True if the text matches the pattern
858
- */
859
- function matchSegment(text, pattern) {
860
- let textIdx = 0;
861
- let patternIdx = 0;
862
- while (patternIdx < pattern.length) {
863
- const char = pattern[patternIdx];
864
- if (char === '*') {
865
- // * matches zero or more characters
866
- patternIdx++;
867
- if (patternIdx === pattern.length) {
868
- return true; // * at end matches rest of string
869
- }
870
- // Try matching rest of pattern at each position in text
871
- for (let i = textIdx; i <= text.length; i++) {
872
- if (matchSegmentFrom(text, i, pattern, patternIdx)) {
873
- return true;
874
- }
875
- }
876
- return false;
877
- }
878
- else if (char === '?') {
879
- // ? matches exactly one character
880
- if (textIdx >= text.length) {
881
- return false;
882
- }
883
- textIdx++;
884
- patternIdx++;
885
- }
886
- else if (char === '{') {
887
- // {a,b,c} matches any alternative
888
- const closeIdx = findClosingBrace(pattern, patternIdx);
889
- if (closeIdx === -1) {
890
- // Unmatched brace, treat as literal
891
- if (textIdx >= text.length || text[textIdx] !== char) {
892
- return false;
893
- }
894
- textIdx++;
895
- patternIdx++;
896
- }
897
- else {
898
- const alternatives = extractAlternatives(pattern.slice(patternIdx + 1, closeIdx));
899
- for (const alt of alternatives) {
900
- if (matchSegmentFrom(text, textIdx, text.slice(0, textIdx) + alt + pattern.slice(closeIdx + 1), textIdx)) {
901
- return true;
902
- }
903
- }
904
- return false;
905
- }
906
- }
907
- else {
908
- // Literal character
909
- if (textIdx >= text.length || text[textIdx] !== char) {
910
- return false;
911
- }
912
- textIdx++;
913
- patternIdx++;
914
- }
915
- }
916
- return textIdx === text.length;
917
- }
918
- /**
919
- * Helper to match from a specific position.
920
- *
921
- * @param text - The full text being matched
922
- * @param textIdx - The starting index in text to match from
923
- * @param pattern - The full pattern being matched
924
- * @param patternIdx - The starting index in pattern to match from
925
- * @returns True if the text matches the pattern from the given positions
926
- */
927
- function matchSegmentFrom(text, textIdx, pattern, patternIdx) {
928
- const remainingText = text.slice(textIdx);
929
- const remainingPattern = pattern.slice(patternIdx);
930
- return matchSegment(remainingText, remainingPattern);
931
- }
932
- /**
933
- * Find closing brace for {a,b,c} pattern.
934
- *
935
- * @param pattern - The pattern string to search within
936
- * @param startIdx - The index of the opening brace
937
- * @returns The index of the matching closing brace, or -1 if not found
938
- */
939
- function findClosingBrace(pattern, startIdx) {
940
- let depth = 0;
941
- for (let i = startIdx; i < pattern.length; i++) {
942
- if (pattern[i] === '{') {
943
- depth++;
944
- }
945
- else if (pattern[i] === '}') {
946
- depth--;
947
- if (depth === 0) {
948
- return i;
949
- }
950
- }
951
- }
952
- return -1;
953
- }
954
- /**
955
- * Extract alternatives from {a,b,c} pattern content.
956
- *
957
- * @param content - The content between braces (without the braces themselves)
958
- * @returns Array of alternative strings split by commas at depth 0
959
- */
960
- function extractAlternatives(content) {
961
- const alternatives = [];
962
- let current = '';
963
- let depth = 0;
964
- for (let i = 0; i < content.length; i++) {
965
- const char = content[i];
966
- if (char === '{') {
967
- depth++;
968
- current += char;
969
- }
970
- else if (char === '}') {
971
- depth--;
972
- current += char;
973
- }
974
- else if (char === ',' && depth === 0) {
975
- alternatives.push(current);
976
- current = '';
977
- }
978
- else {
979
- current += char;
980
- }
981
- }
982
- if (current) {
983
- alternatives.push(current);
984
- }
985
- return alternatives;
986
- }
376
+ createScopedLogger('project-scope:fs:write');
987
377
 
988
378
  const walkLogger = createScopedLogger('project-scope:project:walk');
989
379
  /**
@@ -1050,6 +440,18 @@ function matchPattern(path, pattern) {
1050
440
  * @param startPath - Root directory to begin traversal
1051
441
  * @param visitor - Callback function invoked for each file system entry
1052
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
+ * ```
1053
455
  */
1054
456
  function walkDirectory(startPath, visitor, options) {
1055
457
  walkLogger.debug('Starting directory walk', {
@@ -1132,6 +534,19 @@ function walkDirectory(startPath, visitor, options) {
1132
534
  * @param startPath - Root path within the tree to begin traversal
1133
535
  * @param visitor - Callback function invoked for each tree entry
1134
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
+ * ```
1135
550
  */
1136
551
  function walkTree(tree, startPath, visitor, options) {
1137
552
  const maxDepth = options?.maxDepth ?? -1;
@@ -1212,7 +627,7 @@ function matchesPatterns(path, patterns) {
1212
627
  * @param options - Configuration for search behavior
1213
628
  * @returns List of relative file paths that match the patterns
1214
629
  *
1215
- * @example
630
+ * @example Finding files by pattern
1216
631
  * ```typescript
1217
632
  * import { findFiles } from '@hyperfrontend/project-scope'
1218
633
  *
@@ -1230,7 +645,7 @@ function matchesPatterns(path, patterns) {
1230
645
  * ```
1231
646
  */
1232
647
  function findFiles(startPath, patterns, options) {
1233
- const normalizedPatterns = isArray(patterns) ? patterns : [patterns];
648
+ const normalizedPatterns = index_cjs_js$5.isArray(patterns) ? patterns : [patterns];
1234
649
  searchLogger.debug('Finding files', { startPath, patterns: normalizedPatterns, maxResults: options?.maxResults });
1235
650
  const results = [];
1236
651
  const maxResults = options?.maxResults ?? Infinity;
@@ -1257,9 +672,18 @@ function findFiles(startPath, patterns, options) {
1257
672
  * @param patterns - Glob patterns (e.g., '*.ts', '**\/*.json') to filter files
1258
673
  * @param options - Configuration for search behavior
1259
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
+ * ```
1260
684
  */
1261
685
  function findFilesInTree(tree, patterns, options) {
1262
- const normalizedPatterns = isArray(patterns) ? patterns : [patterns];
686
+ const normalizedPatterns = index_cjs_js$5.isArray(patterns) ? patterns : [patterns];
1263
687
  const results = [];
1264
688
  const maxResults = options?.maxResults ?? Infinity;
1265
689
  walkTree(tree, tree.root || '', (entry) => {
@@ -1284,9 +708,17 @@ function findFilesInTree(tree, patterns, options) {
1284
708
  * @param patterns - Glob patterns to filter directories (supports wildcards)
1285
709
  * @param options - Configuration for search behavior
1286
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
+ * ```
1287
719
  */
1288
720
  function findDirectories(startPath, patterns, options) {
1289
- const normalizedPatterns = isArray(patterns) ? patterns : [patterns];
721
+ const normalizedPatterns = index_cjs_js$5.isArray(patterns) ? patterns : [patterns];
1290
722
  const results = [];
1291
723
  const maxResults = options?.maxResults ?? Infinity;
1292
724
  walkDirectory(startPath, (entry) => {
@@ -1304,324 +736,6 @@ function findDirectories(startPath, patterns, options) {
1304
736
  return results;
1305
737
  }
1306
738
 
1307
- /**
1308
- * Known configuration file patterns organized by type.
1309
- */
1310
- const CONFIG_PATTERNS = {
1311
- // Package Management
1312
- 'package.json': {
1313
- patterns: ['package.json'],
1314
- format: 'json',
1315
- description: 'NPM package manifest',
1316
- },
1317
- 'package-lock.json': {
1318
- patterns: ['package-lock.json'],
1319
- format: 'json',
1320
- description: 'NPM lockfile',
1321
- },
1322
- 'pnpm-lock.yaml': {
1323
- patterns: ['pnpm-lock.yaml'],
1324
- format: 'yaml',
1325
- description: 'PNPM lockfile',
1326
- },
1327
- 'yarn.lock': {
1328
- patterns: ['yarn.lock'],
1329
- format: 'text',
1330
- description: 'Yarn lockfile',
1331
- },
1332
- '.npmrc': {
1333
- patterns: ['.npmrc'],
1334
- format: 'ini',
1335
- description: 'NPM configuration',
1336
- sensitive: true,
1337
- },
1338
- // TypeScript
1339
- tsconfig: {
1340
- patterns: ['tsconfig.json', 'tsconfig.*.json'],
1341
- format: 'jsonc',
1342
- description: 'TypeScript configuration',
1343
- canExtend: true,
1344
- },
1345
- // Monorepo
1346
- nx: {
1347
- patterns: ['nx.json'],
1348
- format: 'json',
1349
- description: 'NX workspace configuration',
1350
- },
1351
- 'project.json': {
1352
- patterns: ['project.json', '**/project.json'],
1353
- format: 'json',
1354
- description: 'NX project configuration',
1355
- },
1356
- 'workspace.json': {
1357
- patterns: ['workspace.json'],
1358
- format: 'json',
1359
- description: 'NX workspace projects (deprecated)',
1360
- },
1361
- turbo: {
1362
- patterns: ['turbo.json'],
1363
- format: 'jsonc',
1364
- description: 'TurboRepo configuration',
1365
- },
1366
- lerna: {
1367
- patterns: ['lerna.json'],
1368
- format: 'json',
1369
- description: 'Lerna configuration',
1370
- },
1371
- // Build Tools
1372
- webpack: {
1373
- patterns: ['webpack.config.js', 'webpack.config.ts', 'webpack.config.cjs', 'webpack.config.mjs'],
1374
- format: 'js',
1375
- description: 'Webpack configuration',
1376
- },
1377
- rollup: {
1378
- patterns: ['rollup.config.js', 'rollup.config.ts', 'rollup.config.mjs'],
1379
- format: 'js',
1380
- description: 'Rollup configuration',
1381
- },
1382
- vite: {
1383
- patterns: ['vite.config.js', 'vite.config.ts', 'vite.config.mjs'],
1384
- format: 'js',
1385
- description: 'Vite configuration',
1386
- },
1387
- esbuild: {
1388
- patterns: ['esbuild.config.js', 'esbuild.config.ts', 'esbuild.config.mjs'],
1389
- format: 'js',
1390
- description: 'esbuild configuration',
1391
- },
1392
- babel: {
1393
- patterns: ['babel.config.js', 'babel.config.json', '.babelrc', '.babelrc.js', '.babelrc.json'],
1394
- format: 'json',
1395
- description: 'Babel configuration',
1396
- },
1397
- swc: {
1398
- patterns: ['.swcrc'],
1399
- format: 'json',
1400
- description: 'SWC configuration',
1401
- },
1402
- // Testing
1403
- jest: {
1404
- patterns: ['jest.config.js', 'jest.config.ts', 'jest.config.mjs'],
1405
- description: 'Jest configuration',
1406
- },
1407
- vitest: {
1408
- patterns: ['vitest.config.js', 'vitest.config.ts'],
1409
- description: 'Vitest configuration',
1410
- },
1411
- cypress: {
1412
- patterns: ['cypress.config.js', 'cypress.config.ts'],
1413
- description: 'Cypress configuration',
1414
- },
1415
- playwright: {
1416
- patterns: ['playwright.config.js', 'playwright.config.ts'],
1417
- description: 'Playwright configuration',
1418
- },
1419
- // Framework configs
1420
- next: {
1421
- patterns: ['next.config.js', 'next.config.mjs', 'next.config.ts'],
1422
- format: 'js',
1423
- description: 'Next.js configuration',
1424
- },
1425
- angular: {
1426
- patterns: ['angular.json'],
1427
- format: 'json',
1428
- description: 'Angular CLI configuration',
1429
- },
1430
- nuxt: {
1431
- patterns: ['nuxt.config.js', 'nuxt.config.ts'],
1432
- format: 'js',
1433
- description: 'Nuxt.js configuration',
1434
- },
1435
- svelte: {
1436
- patterns: ['svelte.config.js', 'svelte.config.ts'],
1437
- format: 'js',
1438
- description: 'SvelteKit configuration',
1439
- },
1440
- astro: {
1441
- patterns: ['astro.config.js', 'astro.config.ts', 'astro.config.mjs'],
1442
- format: 'js',
1443
- description: 'Astro configuration',
1444
- },
1445
- // Linting & Formatting
1446
- eslint: {
1447
- patterns: [
1448
- 'eslint.config.js',
1449
- 'eslint.config.cjs',
1450
- 'eslint.config.mjs',
1451
- '.eslintrc',
1452
- '.eslintrc.js',
1453
- '.eslintrc.json',
1454
- '.eslintrc.yml',
1455
- ],
1456
- format: 'js',
1457
- description: 'ESLint configuration',
1458
- },
1459
- prettier: {
1460
- patterns: ['prettier.config.js', 'prettier.config.cjs', '.prettierrc', '.prettierrc.js', '.prettierrc.json', '.prettierrc.yml'],
1461
- format: 'json',
1462
- description: 'Prettier configuration',
1463
- },
1464
- // Environment (sensitive)
1465
- env: {
1466
- patterns: ['.env', '.env.*', '*.env'],
1467
- format: 'dotenv',
1468
- description: 'Environment variables',
1469
- sensitive: true,
1470
- },
1471
- // Git
1472
- '.gitignore': {
1473
- patterns: ['.gitignore'],
1474
- format: 'text',
1475
- description: 'Git ignore patterns',
1476
- },
1477
- '.gitattributes': {
1478
- patterns: ['.gitattributes'],
1479
- format: 'text',
1480
- description: 'Git attributes',
1481
- },
1482
- };
1483
- /**
1484
- * Get patterns for specific config types.
1485
- *
1486
- * @param types - Array of config types to get patterns for
1487
- * @returns Array of file patterns
1488
- */
1489
- function getConfigPatternsByType(types) {
1490
- return types.flatMap((type) => CONFIG_PATTERNS[type]?.patterns ?? []);
1491
- }
1492
-
1493
- /**
1494
- * Global registry of all caches for bulk operations.
1495
- */
1496
- const cacheRegistry = createSet();
1497
- /**
1498
- * Create a cache with optional TTL and size limits.
1499
- *
1500
- * The cache provides a simple key-value store with:
1501
- * - Optional TTL (time-to-live) for automatic expiration
1502
- * - Optional maxSize for limiting cache size with FIFO eviction
1503
- * - Lazy expiration (entries are checked on access)
1504
- *
1505
- * @param options - Cache configuration options
1506
- * @returns Cache instance
1507
- *
1508
- * @example
1509
- * ```typescript
1510
- * // Basic cache
1511
- * const cache = createCache<string, number>()
1512
- * cache.set('answer', 42)
1513
- * cache.get('answer') // 42
1514
- *
1515
- * // Cache with TTL (expires after 60 seconds)
1516
- * const ttlCache = createCache<string, object>({ ttl: 60000 })
1517
- *
1518
- * // Cache with max size (evicts oldest when full)
1519
- * const lruCache = createCache<string, object>({ maxSize: 100 })
1520
- *
1521
- * // Combined options
1522
- * const configCache = createCache<string, object>({
1523
- * ttl: 30000,
1524
- * maxSize: 50
1525
- * })
1526
- * ```
1527
- */
1528
- function createCache(options) {
1529
- const { ttl, maxSize } = options ?? {};
1530
- const store = createMap();
1531
- // Track insertion order for FIFO eviction
1532
- const insertionOrder = [];
1533
- /**
1534
- * Check if an entry is expired.
1535
- *
1536
- * @param entry - Cache entry to check
1537
- * @returns True if entry is expired
1538
- */
1539
- function isExpired(entry) {
1540
- if (ttl === undefined)
1541
- return false;
1542
- // eslint-disable-next-line workspace/no-unsafe-builtin-methods -- Date.now() is needed for Jest fake timers compatibility
1543
- return Date.now() - entry.timestamp > ttl;
1544
- }
1545
- /**
1546
- * Evict oldest entries to make room for new ones.
1547
- */
1548
- function evictIfNeeded() {
1549
- if (maxSize === undefined)
1550
- return;
1551
- while (store.size >= maxSize && insertionOrder.length > 0) {
1552
- const oldestKey = insertionOrder.shift();
1553
- if (oldestKey !== undefined) {
1554
- store.delete(oldestKey);
1555
- }
1556
- }
1557
- }
1558
- /**
1559
- * Remove key from insertion order tracking.
1560
- *
1561
- * @param key - Key to remove from order tracking
1562
- */
1563
- function removeFromOrder(key) {
1564
- const index = insertionOrder.indexOf(key);
1565
- if (index !== -1) {
1566
- insertionOrder.splice(index, 1);
1567
- }
1568
- }
1569
- const cache = {
1570
- get(key) {
1571
- const entry = store.get(key);
1572
- if (!entry)
1573
- return undefined;
1574
- if (isExpired(entry)) {
1575
- store.delete(key);
1576
- removeFromOrder(key);
1577
- return undefined;
1578
- }
1579
- return entry.value;
1580
- },
1581
- set(key, value) {
1582
- // If key exists, remove from order first
1583
- if (store.has(key)) {
1584
- removeFromOrder(key);
1585
- }
1586
- else {
1587
- // Evict if needed before adding new entry
1588
- evictIfNeeded();
1589
- }
1590
- // eslint-disable-next-line workspace/no-unsafe-builtin-methods -- Date.now() is needed for Jest fake timers compatibility
1591
- store.set(key, { value, timestamp: Date.now() });
1592
- insertionOrder.push(key);
1593
- },
1594
- has(key) {
1595
- const entry = store.get(key);
1596
- if (!entry)
1597
- return false;
1598
- if (isExpired(entry)) {
1599
- store.delete(key);
1600
- removeFromOrder(key);
1601
- return false;
1602
- }
1603
- return true;
1604
- },
1605
- delete(key) {
1606
- removeFromOrder(key);
1607
- return store.delete(key);
1608
- },
1609
- clear() {
1610
- store.clear();
1611
- insertionOrder.length = 0;
1612
- },
1613
- size() {
1614
- return store.size;
1615
- },
1616
- keys() {
1617
- return [...insertionOrder];
1618
- },
1619
- };
1620
- // Register cache for global operations
1621
- cacheRegistry.add(cache);
1622
- return freeze(cache);
1623
- }
1624
-
1625
739
  const configLogger = createScopedLogger('project-scope:config');
1626
740
  /**
1627
741
  * Cache for config detection results.
@@ -1639,7 +753,7 @@ const configDetectionCache = createCache({ ttl: 30000, maxSize: 50 });
1639
753
  * @param options - Detection options
1640
754
  * @returns Array of detected configuration files
1641
755
  *
1642
- * @example
756
+ * @example Detecting configuration files
1643
757
  * ```typescript
1644
758
  * import { detectConfigs } from '@hyperfrontend/project-scope'
1645
759
  *
@@ -1658,7 +772,7 @@ const configDetectionCache = createCache({ ttl: 30000, maxSize: 50 });
1658
772
  * ```
1659
773
  */
1660
774
  function detectConfigs(rootPath, types, options) {
1661
- const typesToCheck = types ?? keys(CONFIG_PATTERNS);
775
+ const typesToCheck = types ?? index_cjs_js$2.keys(CONFIG_PATTERNS);
1662
776
  const results = [];
1663
777
  const maxDepth = options?.maxDepth ?? 10;
1664
778
  const includeHidden = options?.includeHidden ?? true;
@@ -1719,6 +833,14 @@ function detectConfigs(rootPath, types, options) {
1719
833
  * Clear the config detection cache.
1720
834
  *
1721
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
+ * ```
1722
844
  */
1723
845
  function clearConfigDetectionCache() {
1724
846
  configDetectionCache.clear();
@@ -1729,6 +851,17 @@ function clearConfigDetectionCache() {
1729
851
  * @param rootPath - Project root directory
1730
852
  * @param type - Config type to find
1731
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
+ * ```
1732
865
  */
1733
866
  function findConfigFile(rootPath, type) {
1734
867
  const info = CONFIG_PATTERNS[type];
@@ -1752,76 +885,6 @@ function findConfigFile(rootPath, type) {
1752
885
  }
1753
886
  return null;
1754
887
  }
1755
- /**
1756
- * Get all known config file patterns for a given configuration type.
1757
- *
1758
- * @param type - Configuration type identifier
1759
- * @returns Array of glob patterns for matching config files
1760
- */
1761
- function getConfigPaths(type) {
1762
- const info = CONFIG_PATTERNS[type];
1763
- return info?.patterns ?? [];
1764
- }
1765
-
1766
- /**
1767
- * Safe copies of Number built-in methods and constants.
1768
- *
1769
- * These references are captured at module initialization time to protect against
1770
- * prototype pollution attacks. Import only what you need for tree-shaking.
1771
- *
1772
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/number
1773
- */
1774
- // Capture references at module initialization time
1775
- const _parseInt = globalThis.parseInt;
1776
- const _parseFloat = globalThis.parseFloat;
1777
- // ============================================================================
1778
- // Parsing
1779
- // ============================================================================
1780
- /**
1781
- * (Safe copy) Parses a string and returns an integer.
1782
- */
1783
- const parseInt = _parseInt;
1784
- /**
1785
- * (Safe copy) Parses a string and returns a floating point number.
1786
- */
1787
- const parseFloat = _parseFloat;
1788
-
1789
- /**
1790
- * Create a structured error with code and optional context.
1791
- *
1792
- * @param message - The human-readable error message
1793
- * @param code - The machine-readable error code for programmatic handling
1794
- * @param context - Additional contextual information about the error
1795
- * @returns Structured error instance with code and context properties
1796
- *
1797
- * @example
1798
- * ```typescript
1799
- * import { createStructuredError } from '@hyperfrontend/project-scope'
1800
- *
1801
- * throw createStructuredError(
1802
- * 'Configuration file not found',
1803
- * 'CONFIG_NOT_FOUND',
1804
- * { path: './config.json', searched: ['./config.json', './settings.json'] }
1805
- * )
1806
- * ```
1807
- */
1808
- function createStructuredError(message, code, context) {
1809
- const error = createError(message);
1810
- error.code = code;
1811
- error.context = context ?? {};
1812
- return error;
1813
- }
1814
- /**
1815
- * Create a configuration-related error.
1816
- *
1817
- * @param message - The human-readable error message
1818
- * @param code - The machine-readable error code for programmatic handling
1819
- * @param context - Additional contextual information (e.g., file path, config key)
1820
- * @returns Structured error instance tagged with type 'config'
1821
- */
1822
- function createConfigError(message, code, context) {
1823
- return createStructuredError(message, code, { ...context, type: 'config' });
1824
- }
1825
888
 
1826
889
  /**
1827
890
  * Detect config type from file name.
@@ -1832,7 +895,7 @@ function createConfigError(message, code, context) {
1832
895
  */
1833
896
  function detectConfigType(filePath) {
1834
897
  const fileName = node_path.basename(filePath);
1835
- for (const [type, info] of entries(CONFIG_PATTERNS)) {
898
+ for (const [type, info] of index_cjs_js$2.entries(CONFIG_PATTERNS)) {
1836
899
  for (const pattern of info.patterns) {
1837
900
  if (matchGlobPattern(fileName, pattern)) {
1838
901
  return type;
@@ -1953,10 +1016,10 @@ function parseSimpleYaml(content) {
1953
1016
  result[key] = null;
1954
1017
  }
1955
1018
  else if (/^-?\d+$/.test(value)) {
1956
- result[key] = parseInt(value, 10);
1019
+ result[key] = index_cjs_js$8.parseInt(value, 10);
1957
1020
  }
1958
1021
  else if (/^-?\d+\.\d+$/.test(value)) {
1959
- result[key] = parseFloat(value);
1022
+ result[key] = index_cjs_js$8.parseFloat(value);
1960
1023
  }
1961
1024
  else {
1962
1025
  result[key] = value.replace(/^["']|["']$/g, '');
@@ -2034,16 +1097,28 @@ function parseDotenv(content) {
2034
1097
  * @param type - Category of configuration (e.g., typescript, eslint)
2035
1098
  * @param format - Whether to strip comments (jsonc) or parse strictly (json)
2036
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
+ * ```
2037
1112
  */
2038
1113
  function parseJsonConfig(filePath, content, type, format = 'json') {
2039
1114
  const cleanContent = format === 'jsonc' ? stripJsonComments(content) : content;
2040
1115
  try {
2041
- const data = parse(cleanContent);
1116
+ const data = index_cjs_js$6.parse(cleanContent);
2042
1117
  let extendsPath;
2043
1118
  if (typeof data['extends'] === 'string') {
2044
1119
  extendsPath = [data['extends']];
2045
1120
  }
2046
- else if (isArray(data['extends'])) {
1121
+ else if (index_cjs_js$5.isArray(data['extends'])) {
2047
1122
  extendsPath = data['extends'];
2048
1123
  }
2049
1124
  return {
@@ -2069,6 +1144,14 @@ function parseJsonConfig(filePath, content, type, format = 'json') {
2069
1144
  * @param content - Raw file content to parse
2070
1145
  * @param type - Category of configuration (e.g., github-actions, docker-compose)
2071
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
+ * ```
2072
1155
  */
2073
1156
  function parseYamlConfig(filePath, content, type) {
2074
1157
  const data = parseSimpleYaml(content);
@@ -2085,6 +1168,14 @@ function parseYamlConfig(filePath, content, type) {
2085
1168
  * @param filePath - Path to config file
2086
1169
  * @param type - Optional config type (auto-detected if not provided)
2087
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
+ * ```
2088
1179
  */
2089
1180
  function parseConfig(filePath, type) {
2090
1181
  const content = readFileContent(filePath);
@@ -2129,33 +1220,6 @@ function parseConfig(filePath, type) {
2129
1220
  };
2130
1221
  }
2131
1222
  }
2132
- /**
2133
- * Read and parse config file if it exists.
2134
- *
2135
- * @param configPath - Path to config file
2136
- * @returns Parsed config or null if file doesn't exist
2137
- */
2138
- function readConfigIfExists(configPath) {
2139
- const content = readFileIfExists(configPath);
2140
- if (!content)
2141
- return null;
2142
- try {
2143
- const format = detectFormat(configPath);
2144
- switch (format) {
2145
- case 'json':
2146
- return parse(content);
2147
- case 'jsonc':
2148
- return parse(stripJsonComments(content));
2149
- case 'yaml':
2150
- return parseSimpleYaml(content);
2151
- default:
2152
- return null;
2153
- }
2154
- }
2155
- catch {
2156
- return null;
2157
- }
2158
- }
2159
1223
 
2160
1224
  const packageLogger = createScopedLogger('project-scope:project:package');
2161
1225
  /**
@@ -2168,7 +1232,7 @@ const packageLogger = createScopedLogger('project-scope:project:package');
2168
1232
  function isStringRecord(value) {
2169
1233
  if (typeof value !== 'object' || value === null)
2170
1234
  return false;
2171
- return values(value).every((v) => typeof v === 'string');
1235
+ return index_cjs_js$2.values(value).every((v) => typeof v === 'string');
2172
1236
  }
2173
1237
  /**
2174
1238
  * Extracts and normalizes the workspaces field from package.json,
@@ -2178,12 +1242,12 @@ function isStringRecord(value) {
2178
1242
  * @returns Normalized workspace patterns or undefined if invalid
2179
1243
  */
2180
1244
  function parseWorkspaces(value) {
2181
- if (isArray(value) && value.every((v) => typeof v === 'string')) {
1245
+ if (index_cjs_js$5.isArray(value) && value.every((v) => typeof v === 'string')) {
2182
1246
  return value;
2183
1247
  }
2184
1248
  if (typeof value === 'object' && value !== null) {
2185
1249
  const obj = value;
2186
- if (isArray(obj['packages'])) {
1250
+ if (index_cjs_js$5.isArray(obj['packages'])) {
2187
1251
  return { packages: obj['packages'] };
2188
1252
  }
2189
1253
  }
@@ -2197,7 +1261,7 @@ function parseWorkspaces(value) {
2197
1261
  */
2198
1262
  function validatePackageJson(data) {
2199
1263
  if (typeof data !== 'object' || data === null) {
2200
- throw createError('package.json must be an object');
1264
+ throw index_cjs_js$7.createError('package.json must be an object');
2201
1265
  }
2202
1266
  const pkg = data;
2203
1267
  return {
@@ -2227,13 +1291,21 @@ function validatePackageJson(data) {
2227
1291
  * @param projectPath - Project directory path or path to package.json
2228
1292
  * @returns Parsed package.json
2229
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
+ * ```
2230
1302
  */
2231
1303
  function readPackageJson(projectPath) {
2232
1304
  const packageJsonPath = projectPath.endsWith('package.json') ? projectPath : node_path.join(projectPath, 'package.json');
2233
1305
  packageLogger.debug('Reading package.json', { path: packageJsonPath });
2234
1306
  const content = readFileContent(packageJsonPath);
2235
1307
  try {
2236
- const data = parse(content);
1308
+ const data = index_cjs_js$6.parse(content);
2237
1309
  const validated = validatePackageJson(data);
2238
1310
  packageLogger.debug('Package.json read successfully', { path: packageJsonPath, name: validated.name });
2239
1311
  return validated;
@@ -2255,6 +1327,16 @@ function readPackageJson(projectPath) {
2255
1327
  *
2256
1328
  * @param projectPath - Project directory path or path to package.json
2257
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
+ * ```
2258
1340
  */
2259
1341
  function readPackageJsonIfExists(projectPath) {
2260
1342
  const packageJsonPath = projectPath.endsWith('package.json') ? projectPath : node_path.join(projectPath, 'package.json');
@@ -2264,7 +1346,7 @@ function readPackageJsonIfExists(projectPath) {
2264
1346
  return null;
2265
1347
  }
2266
1348
  try {
2267
- const validated = validatePackageJson(parse(content));
1349
+ const validated = validatePackageJson(index_cjs_js$6.parse(content));
2268
1350
  packageLogger.debug('Package.json loaded', { path: packageJsonPath, name: validated.name });
2269
1351
  return validated;
2270
1352
  }
@@ -2278,6 +1360,14 @@ function readPackageJsonIfExists(projectPath) {
2278
1360
  *
2279
1361
  * @param startPath - Starting path
2280
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
+ * ```
2281
1371
  */
2282
1372
  function findNearestPackageJson(startPath) {
2283
1373
  return locateByMarkers(startPath, ['package.json']);
@@ -2288,6 +1378,15 @@ function findNearestPackageJson(startPath) {
2288
1378
  *
2289
1379
  * @param packageJson - Parsed package.json
2290
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
+ * ```
2291
1390
  */
2292
1391
  function getDependencies(packageJson) {
2293
1392
  return {
@@ -2302,6 +1401,14 @@ function getDependencies(packageJson) {
2302
1401
  *
2303
1402
  * @param packageJson - Parsed package.json
2304
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
+ * ```
2305
1412
  */
2306
1413
  function getProductionDependencies(packageJson) {
2307
1414
  return packageJson.dependencies ?? {};
@@ -2311,6 +1418,14 @@ function getProductionDependencies(packageJson) {
2311
1418
  *
2312
1419
  * @param packageJson - Parsed package.json
2313
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
+ * ```
2314
1429
  */
2315
1430
  function getDevDependencies(packageJson) {
2316
1431
  return packageJson.devDependencies ?? {};
@@ -2320,6 +1435,14 @@ function getDevDependencies(packageJson) {
2320
1435
  *
2321
1436
  * @param packageJson - Parsed package.json
2322
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
+ * ```
2323
1446
  */
2324
1447
  function getPeerDependencies(packageJson) {
2325
1448
  return packageJson.peerDependencies ?? {};
@@ -2329,6 +1452,16 @@ function getPeerDependencies(packageJson) {
2329
1452
  *
2330
1453
  * @param packageJson - Parsed package.json
2331
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
+ * ```
2332
1465
  */
2333
1466
  function getAllDependencies(packageJson) {
2334
1467
  return {
@@ -2345,6 +1478,17 @@ function getAllDependencies(packageJson) {
2345
1478
  * @param name - Name of the dependency to check
2346
1479
  * @param depTypes - Optional array of dependency types to check (defaults to all)
2347
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
+ * ```
2348
1492
  */
2349
1493
  function hasDependency(packageJson, name, depTypes) {
2350
1494
  const typesToCheck = depTypes ?? ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'];
@@ -2361,6 +1505,14 @@ function hasDependency(packageJson, name, depTypes) {
2361
1505
  * @param packageJson - Parsed package.json content
2362
1506
  * @param name - Name of the dependency to look up
2363
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
+ * ```
2364
1516
  */
2365
1517
  function getDependencyVersion(packageJson, name) {
2366
1518
  const deps = getDependencies(packageJson);
@@ -2371,11 +1523,19 @@ function getDependencyVersion(packageJson, name) {
2371
1523
  *
2372
1524
  * @param packageJson - Parsed package.json
2373
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
+ * ```
2374
1534
  */
2375
1535
  function getWorkspaces(packageJson) {
2376
1536
  if (!packageJson.workspaces)
2377
1537
  return [];
2378
- if (isArray(packageJson.workspaces)) {
1538
+ if (index_cjs_js$5.isArray(packageJson.workspaces)) {
2379
1539
  return packageJson.workspaces;
2380
1540
  }
2381
1541
  if (typeof packageJson.workspaces === 'object' && 'packages' in packageJson.workspaces) {
@@ -2388,6 +1548,15 @@ function getWorkspaces(packageJson) {
2388
1548
  *
2389
1549
  * @param packageJson - Parsed package.json
2390
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
+ * ```
2391
1560
  */
2392
1561
  function hasWorkspaces(packageJson) {
2393
1562
  return getWorkspaces(packageJson).length > 0;
@@ -2398,22 +1567,20 @@ function hasWorkspaces(packageJson) {
2398
1567
  * @param projectPath - Project root directory
2399
1568
  * @param packageName - Package name to check
2400
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
+ * ```
2401
1579
  */
2402
1580
  function hasInstalledPackage(projectPath, packageName) {
2403
1581
  const pkgPath = node_path.join(projectPath, 'node_modules', packageName, 'package.json');
2404
1582
  return readPackageJsonIfExists(pkgPath) !== null;
2405
1583
  }
2406
- /**
2407
- * Get installed package version from node_modules.
2408
- *
2409
- * @param projectPath - Project root directory
2410
- * @param packageName - Name of the npm package to look up
2411
- * @returns Installed version or null if not found
2412
- */
2413
- function getInstalledVersion(projectPath, packageName) {
2414
- const pkg = readPackageJsonIfExists(node_path.join(projectPath, 'node_modules', packageName, 'package.json'));
2415
- return pkg?.version ?? null;
2416
- }
2417
1584
 
2418
1585
  const rootLogger = createScopedLogger('project-scope:root');
2419
1586
  /**
@@ -2453,7 +1620,7 @@ function looksLikeProjectDir(dirPath) {
2453
1620
  * @param startPath - Starting path
2454
1621
  * @returns Project root path or null
2455
1622
  *
2456
- * @example
1623
+ * @example Finding project root
2457
1624
  * ```typescript
2458
1625
  * import { findProjectRoot } from '@hyperfrontend/project-scope'
2459
1626
  *
@@ -2493,7 +1660,7 @@ function findProjectRoot(startPath) {
2493
1660
  * @param startPath - Starting path
2494
1661
  * @returns Workspace root path or null
2495
1662
  *
2496
- * @example
1663
+ * @example Finding workspace root
2497
1664
  * ```typescript
2498
1665
  * import { findWorkspaceRoot } from '@hyperfrontend/project-scope'
2499
1666
  *
@@ -2533,6 +1700,15 @@ function findWorkspaceRoot(startPath) {
2533
1700
  * @param startPath - Starting path
2534
1701
  * @param markers - Files to search for
2535
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
+ * ```
2536
1712
  */
2537
1713
  function findRootDirectory(startPath, markers) {
2538
1714
  return locateByMarkers(startPath, markers);
@@ -2542,6 +1718,14 @@ function findRootDirectory(startPath, markers) {
2542
1718
  *
2543
1719
  * @param startPath - Starting path
2544
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
+ * ```
2545
1729
  */
2546
1730
  function findGitRoot(startPath) {
2547
1731
  return locateByMarkers(startPath, ['.git']);
@@ -2562,12 +1746,10 @@ exports.findProjectRoot = findProjectRoot;
2562
1746
  exports.findRootDirectory = findRootDirectory;
2563
1747
  exports.findWorkspaceRoot = findWorkspaceRoot;
2564
1748
  exports.getAllDependencies = getAllDependencies;
2565
- exports.getConfigPaths = getConfigPaths;
2566
1749
  exports.getConfigPatternsByType = getConfigPatternsByType;
2567
1750
  exports.getDependencies = getDependencies;
2568
1751
  exports.getDependencyVersion = getDependencyVersion;
2569
1752
  exports.getDevDependencies = getDevDependencies;
2570
- exports.getInstalledVersion = getInstalledVersion;
2571
1753
  exports.getPeerDependencies = getPeerDependencies;
2572
1754
  exports.getProductionDependencies = getProductionDependencies;
2573
1755
  exports.getWorkspaces = getWorkspaces;
@@ -2577,9 +1759,7 @@ exports.hasWorkspaces = hasWorkspaces;
2577
1759
  exports.parseConfig = parseConfig;
2578
1760
  exports.parseJsonConfig = parseJsonConfig;
2579
1761
  exports.parseYamlConfig = parseYamlConfig;
2580
- exports.readConfigIfExists = readConfigIfExists;
2581
1762
  exports.readPackageJson = readPackageJson;
2582
1763
  exports.readPackageJsonIfExists = readPackageJsonIfExists;
2583
1764
  exports.walkDirectory = walkDirectory;
2584
1765
  exports.walkTree = walkTree;
2585
- //# sourceMappingURL=index.cjs.js.map