@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,726 +1,19 @@
1
1
  import { join, basename } from 'node:path';
2
+ import { freeze, entries, keys, defineProperties } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.esm.js';
3
+ import { createMap } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.esm.js';
4
+ import { createSet } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js';
2
5
  import { existsSync, readFileSync, statSync, lstatSync, readdirSync } from 'node:fs';
3
-
4
- /**
5
- * Known configuration file patterns organized by type.
6
- */
7
- const CONFIG_PATTERNS = {
8
- // Package Management
9
- 'package.json': {
10
- patterns: ['package.json'],
11
- format: 'json',
12
- description: 'NPM package manifest',
13
- },
14
- 'package-lock.json': {
15
- patterns: ['package-lock.json'],
16
- format: 'json',
17
- description: 'NPM lockfile',
18
- },
19
- 'pnpm-lock.yaml': {
20
- patterns: ['pnpm-lock.yaml'],
21
- format: 'yaml',
22
- description: 'PNPM lockfile',
23
- },
24
- 'yarn.lock': {
25
- patterns: ['yarn.lock'],
26
- format: 'text',
27
- description: 'Yarn lockfile',
28
- },
29
- '.npmrc': {
30
- patterns: ['.npmrc'],
31
- format: 'ini',
32
- description: 'NPM configuration',
33
- sensitive: true,
34
- },
35
- // TypeScript
36
- tsconfig: {
37
- patterns: ['tsconfig.json', 'tsconfig.*.json'],
38
- format: 'jsonc',
39
- description: 'TypeScript configuration',
40
- canExtend: true,
41
- },
42
- // Monorepo
43
- nx: {
44
- patterns: ['nx.json'],
45
- format: 'json',
46
- description: 'NX workspace configuration',
47
- },
48
- 'project.json': {
49
- patterns: ['project.json', '**/project.json'],
50
- format: 'json',
51
- description: 'NX project configuration',
52
- },
53
- 'workspace.json': {
54
- patterns: ['workspace.json'],
55
- format: 'json',
56
- description: 'NX workspace projects (deprecated)',
57
- },
58
- turbo: {
59
- patterns: ['turbo.json'],
60
- format: 'jsonc',
61
- description: 'TurboRepo configuration',
62
- },
63
- lerna: {
64
- patterns: ['lerna.json'],
65
- format: 'json',
66
- description: 'Lerna configuration',
67
- },
68
- // Build Tools
69
- webpack: {
70
- patterns: ['webpack.config.js', 'webpack.config.ts', 'webpack.config.cjs', 'webpack.config.mjs'],
71
- format: 'js',
72
- description: 'Webpack configuration',
73
- },
74
- rollup: {
75
- patterns: ['rollup.config.js', 'rollup.config.ts', 'rollup.config.mjs'],
76
- format: 'js',
77
- description: 'Rollup configuration',
78
- },
79
- vite: {
80
- patterns: ['vite.config.js', 'vite.config.ts', 'vite.config.mjs'],
81
- format: 'js',
82
- description: 'Vite configuration',
83
- },
84
- esbuild: {
85
- patterns: ['esbuild.config.js', 'esbuild.config.ts', 'esbuild.config.mjs'],
86
- format: 'js',
87
- description: 'esbuild configuration',
88
- },
89
- babel: {
90
- patterns: ['babel.config.js', 'babel.config.json', '.babelrc', '.babelrc.js', '.babelrc.json'],
91
- format: 'json',
92
- description: 'Babel configuration',
93
- },
94
- swc: {
95
- patterns: ['.swcrc'],
96
- format: 'json',
97
- description: 'SWC configuration',
98
- },
99
- // Testing
100
- jest: {
101
- patterns: ['jest.config.js', 'jest.config.ts', 'jest.config.mjs'],
102
- description: 'Jest configuration',
103
- },
104
- vitest: {
105
- patterns: ['vitest.config.js', 'vitest.config.ts'],
106
- description: 'Vitest configuration',
107
- },
108
- cypress: {
109
- patterns: ['cypress.config.js', 'cypress.config.ts'],
110
- description: 'Cypress configuration',
111
- },
112
- playwright: {
113
- patterns: ['playwright.config.js', 'playwright.config.ts'],
114
- description: 'Playwright configuration',
115
- },
116
- // Framework configs
117
- next: {
118
- patterns: ['next.config.js', 'next.config.mjs', 'next.config.ts'],
119
- format: 'js',
120
- description: 'Next.js configuration',
121
- },
122
- angular: {
123
- patterns: ['angular.json'],
124
- format: 'json',
125
- description: 'Angular CLI configuration',
126
- },
127
- nuxt: {
128
- patterns: ['nuxt.config.js', 'nuxt.config.ts'],
129
- format: 'js',
130
- description: 'Nuxt.js configuration',
131
- },
132
- svelte: {
133
- patterns: ['svelte.config.js', 'svelte.config.ts'],
134
- format: 'js',
135
- description: 'SvelteKit configuration',
136
- },
137
- astro: {
138
- patterns: ['astro.config.js', 'astro.config.ts', 'astro.config.mjs'],
139
- format: 'js',
140
- description: 'Astro configuration',
141
- },
142
- // Linting & Formatting
143
- eslint: {
144
- patterns: [
145
- 'eslint.config.js',
146
- 'eslint.config.cjs',
147
- 'eslint.config.mjs',
148
- '.eslintrc',
149
- '.eslintrc.js',
150
- '.eslintrc.json',
151
- '.eslintrc.yml',
152
- ],
153
- format: 'js',
154
- description: 'ESLint configuration',
155
- },
156
- prettier: {
157
- patterns: ['prettier.config.js', 'prettier.config.cjs', '.prettierrc', '.prettierrc.js', '.prettierrc.json', '.prettierrc.yml'],
158
- format: 'json',
159
- description: 'Prettier configuration',
160
- },
161
- // Environment (sensitive)
162
- env: {
163
- patterns: ['.env', '.env.*', '*.env'],
164
- format: 'dotenv',
165
- description: 'Environment variables',
166
- sensitive: true,
167
- },
168
- // Git
169
- '.gitignore': {
170
- patterns: ['.gitignore'],
171
- format: 'text',
172
- description: 'Git ignore patterns',
173
- },
174
- '.gitattributes': {
175
- patterns: ['.gitattributes'],
176
- format: 'text',
177
- description: 'Git attributes',
178
- },
179
- };
180
- /**
181
- * Get patterns for specific config types.
182
- *
183
- * @param types - Array of config types to get patterns for
184
- * @returns Array of file patterns
185
- */
186
- function getConfigPatternsByType(types) {
187
- return types.flatMap((type) => CONFIG_PATTERNS[type]?.patterns ?? []);
188
- }
189
-
190
- /**
191
- * Safe copies of Object built-in methods.
192
- *
193
- * These references are captured at module initialization time to protect against
194
- * prototype pollution attacks. Import only what you need for tree-shaking.
195
- *
196
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/object
197
- */
198
- // Capture references at module initialization time
199
- const _Object = globalThis.Object;
200
- /**
201
- * (Safe copy) Prevents modification of existing property attributes and values,
202
- * and prevents the addition of new properties.
203
- */
204
- const freeze = _Object.freeze;
205
- /**
206
- * (Safe copy) Returns the names of the enumerable string properties and methods of an object.
207
- */
208
- const keys = _Object.keys;
209
- /**
210
- * (Safe copy) Returns an array of key/values of the enumerable own properties of an object.
211
- */
212
- const entries = _Object.entries;
213
- /**
214
- * (Safe copy) Adds one or more properties to an object, and/or modifies attributes of existing properties.
215
- */
216
- const defineProperties = _Object.defineProperties;
217
-
218
- /**
219
- * Safe copies of Map built-in via factory function.
220
- *
221
- * Since constructors cannot be safely captured via Object.assign, this module
222
- * provides a factory function that uses Reflect.construct internally.
223
- *
224
- * These references are captured at module initialization time to protect against
225
- * prototype pollution attacks. Import only what you need for tree-shaking.
226
- *
227
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/map
228
- */
229
- // Capture references at module initialization time
230
- const _Map = globalThis.Map;
231
- const _Reflect$2 = globalThis.Reflect;
232
- /**
233
- * (Safe copy) Creates a new Map using the captured Map constructor.
234
- * Use this instead of `new Map()`.
235
- *
236
- * @param iterable - Optional iterable of key-value pairs.
237
- * @returns A new Map instance.
238
- */
239
- const createMap = (iterable) => _Reflect$2.construct(_Map, iterable ? [iterable] : []);
240
-
241
- /**
242
- * Safe copies of Set built-in via factory function.
243
- *
244
- * Since constructors cannot be safely captured via Object.assign, this module
245
- * provides a factory function that uses Reflect.construct internally.
246
- *
247
- * These references are captured at module initialization time to protect against
248
- * prototype pollution attacks. Import only what you need for tree-shaking.
249
- *
250
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/set
251
- */
252
- // Capture references at module initialization time
253
- const _Set = globalThis.Set;
254
- const _Reflect$1 = globalThis.Reflect;
255
- /**
256
- * (Safe copy) Creates a new Set using the captured Set constructor.
257
- * Use this instead of `new Set()`.
258
- *
259
- * @param iterable - Optional iterable of values.
260
- * @returns A new Set instance.
261
- */
262
- const createSet = (iterable) => _Reflect$1.construct(_Set, iterable ? [iterable] : []);
263
-
264
- /**
265
- * Global registry of all caches for bulk operations.
266
- */
267
- const cacheRegistry = createSet();
268
- /**
269
- * Create a cache with optional TTL and size limits.
270
- *
271
- * The cache provides a simple key-value store with:
272
- * - Optional TTL (time-to-live) for automatic expiration
273
- * - Optional maxSize for limiting cache size with FIFO eviction
274
- * - Lazy expiration (entries are checked on access)
275
- *
276
- * @param options - Cache configuration options
277
- * @returns Cache instance
278
- *
279
- * @example
280
- * ```typescript
281
- * // Basic cache
282
- * const cache = createCache<string, number>()
283
- * cache.set('answer', 42)
284
- * cache.get('answer') // 42
285
- *
286
- * // Cache with TTL (expires after 60 seconds)
287
- * const ttlCache = createCache<string, object>({ ttl: 60000 })
288
- *
289
- * // Cache with max size (evicts oldest when full)
290
- * const lruCache = createCache<string, object>({ maxSize: 100 })
291
- *
292
- * // Combined options
293
- * const configCache = createCache<string, object>({
294
- * ttl: 30000,
295
- * maxSize: 50
296
- * })
297
- * ```
298
- */
299
- function createCache(options) {
300
- const { ttl, maxSize } = options ?? {};
301
- const store = createMap();
302
- // Track insertion order for FIFO eviction
303
- const insertionOrder = [];
304
- /**
305
- * Check if an entry is expired.
306
- *
307
- * @param entry - Cache entry to check
308
- * @returns True if entry is expired
309
- */
310
- function isExpired(entry) {
311
- if (ttl === undefined)
312
- return false;
313
- // eslint-disable-next-line workspace/no-unsafe-builtin-methods -- Date.now() is needed for Jest fake timers compatibility
314
- return Date.now() - entry.timestamp > ttl;
315
- }
316
- /**
317
- * Evict oldest entries to make room for new ones.
318
- */
319
- function evictIfNeeded() {
320
- if (maxSize === undefined)
321
- return;
322
- while (store.size >= maxSize && insertionOrder.length > 0) {
323
- const oldestKey = insertionOrder.shift();
324
- if (oldestKey !== undefined) {
325
- store.delete(oldestKey);
326
- }
327
- }
328
- }
329
- /**
330
- * Remove key from insertion order tracking.
331
- *
332
- * @param key - Key to remove from order tracking
333
- */
334
- function removeFromOrder(key) {
335
- const index = insertionOrder.indexOf(key);
336
- if (index !== -1) {
337
- insertionOrder.splice(index, 1);
338
- }
339
- }
340
- const cache = {
341
- get(key) {
342
- const entry = store.get(key);
343
- if (!entry)
344
- return undefined;
345
- if (isExpired(entry)) {
346
- store.delete(key);
347
- removeFromOrder(key);
348
- return undefined;
349
- }
350
- return entry.value;
351
- },
352
- set(key, value) {
353
- // If key exists, remove from order first
354
- if (store.has(key)) {
355
- removeFromOrder(key);
356
- }
357
- else {
358
- // Evict if needed before adding new entry
359
- evictIfNeeded();
360
- }
361
- // eslint-disable-next-line workspace/no-unsafe-builtin-methods -- Date.now() is needed for Jest fake timers compatibility
362
- store.set(key, { value, timestamp: Date.now() });
363
- insertionOrder.push(key);
364
- },
365
- has(key) {
366
- const entry = store.get(key);
367
- if (!entry)
368
- return false;
369
- if (isExpired(entry)) {
370
- store.delete(key);
371
- removeFromOrder(key);
372
- return false;
373
- }
374
- return true;
375
- },
376
- delete(key) {
377
- removeFromOrder(key);
378
- return store.delete(key);
379
- },
380
- clear() {
381
- store.clear();
382
- insertionOrder.length = 0;
383
- },
384
- size() {
385
- return store.size;
386
- },
387
- keys() {
388
- return [...insertionOrder];
389
- },
390
- };
391
- // Register cache for global operations
392
- cacheRegistry.add(cache);
393
- return freeze(cache);
394
- }
395
-
396
- /**
397
- * Safe copies of Error built-ins via factory functions.
398
- *
399
- * Since constructors cannot be safely captured via Object.assign, this module
400
- * provides factory functions that use Reflect.construct internally.
401
- *
402
- * These references are captured at module initialization time to protect against
403
- * prototype pollution attacks. Import only what you need for tree-shaking.
404
- *
405
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/error
406
- */
407
- // Capture references at module initialization time
408
- const _Error = globalThis.Error;
409
- const _Reflect = globalThis.Reflect;
410
- /**
411
- * (Safe copy) Creates a new Error using the captured Error constructor.
412
- * Use this instead of `new Error()`.
413
- *
414
- * @param message - Optional error message.
415
- * @param options - Optional error options.
416
- * @returns A new Error instance.
417
- */
418
- const createError = (message, options) => _Reflect.construct(_Error, [message, options]);
419
-
420
- /**
421
- * Safe copies of JSON built-in methods.
422
- *
423
- * These references are captured at module initialization time to protect against
424
- * prototype pollution attacks. Import only what you need for tree-shaking.
425
- *
426
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/json
427
- */
428
- // Capture references at module initialization time
429
- const _JSON = globalThis.JSON;
430
- /**
431
- * (Safe copy) Converts a JavaScript Object Notation (JSON) string into an object.
432
- */
433
- const parse = _JSON.parse;
434
- /**
435
- * (Safe copy) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
436
- */
437
- const stringify = _JSON.stringify;
438
-
439
- /**
440
- * Safe copies of Array built-in static methods.
441
- *
442
- * These references are captured at module initialization time to protect against
443
- * prototype pollution attacks. Import only what you need for tree-shaking.
444
- *
445
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/array
446
- */
447
- // Capture references at module initialization time
448
- const _Array = globalThis.Array;
449
- /**
450
- * (Safe copy) Determines whether the passed value is an Array.
451
- */
452
- const isArray = _Array.isArray;
453
-
454
- /**
455
- * Safe copies of Console built-in methods.
456
- *
457
- * These references are captured at module initialization time to protect against
458
- * prototype pollution attacks. Import only what you need for tree-shaking.
459
- *
460
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/console
461
- */
462
- // Capture references at module initialization time
463
- const _console = globalThis.console;
464
- /**
465
- * (Safe copy) Outputs a message to the console.
466
- */
467
- const log = _console.log.bind(_console);
468
- /**
469
- * (Safe copy) Outputs a warning message to the console.
470
- */
471
- const warn = _console.warn.bind(_console);
472
- /**
473
- * (Safe copy) Outputs an error message to the console.
474
- */
475
- const error = _console.error.bind(_console);
476
- /**
477
- * (Safe copy) Outputs an informational message to the console.
478
- */
479
- const info = _console.info.bind(_console);
480
- /**
481
- * (Safe copy) Outputs a debug message to the console.
482
- */
483
- const debug = _console.debug.bind(_console);
484
- /**
485
- * (Safe copy) Outputs a stack trace to the console.
486
- */
487
- _console.trace.bind(_console);
488
- /**
489
- * (Safe copy) Displays an interactive listing of the properties of a specified object.
490
- */
491
- _console.dir.bind(_console);
492
- /**
493
- * (Safe copy) Displays tabular data as a table.
494
- */
495
- _console.table.bind(_console);
496
- /**
497
- * (Safe copy) Writes an error message to the console if the assertion is false.
498
- */
499
- _console.assert.bind(_console);
500
- /**
501
- * (Safe copy) Clears the console.
502
- */
503
- _console.clear.bind(_console);
504
- /**
505
- * (Safe copy) Logs the number of times that this particular call to count() has been called.
506
- */
507
- _console.count.bind(_console);
508
- /**
509
- * (Safe copy) Resets the counter used with console.count().
510
- */
511
- _console.countReset.bind(_console);
512
- /**
513
- * (Safe copy) Creates a new inline group in the console.
514
- */
515
- _console.group.bind(_console);
516
- /**
517
- * (Safe copy) Creates a new inline group in the console that is initially collapsed.
518
- */
519
- _console.groupCollapsed.bind(_console);
520
- /**
521
- * (Safe copy) Exits the current inline group.
522
- */
523
- _console.groupEnd.bind(_console);
524
- /**
525
- * (Safe copy) Starts a timer with a name specified as an input parameter.
526
- */
527
- _console.time.bind(_console);
528
- /**
529
- * (Safe copy) Stops a timer that was previously started.
530
- */
531
- _console.timeEnd.bind(_console);
532
- /**
533
- * (Safe copy) Logs the current value of a timer that was previously started.
534
- */
535
- _console.timeLog.bind(_console);
536
-
537
- const registeredClasses = [];
538
-
539
- /**
540
- * Returns the data type of the target.
541
- * Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`.
542
- * Also, when classes are registered via `registerClass`, it checks if objects are instance of any known registered class.
543
- *
544
- * @param target - The target to get the data type of.
545
- * @returns The data type of the target.
546
- */
547
- const getType = (target) => {
548
- if (target === null)
549
- return 'null';
550
- const nativeDataType = typeof target;
551
- if (nativeDataType === 'object') {
552
- if (isArray(target))
553
- return 'array';
554
- for (const registeredClass of registeredClasses) {
555
- if (target instanceof registeredClass)
556
- return registeredClass.name;
557
- }
558
- }
559
- return nativeDataType;
560
- };
561
-
562
- /* eslint-disable @typescript-eslint/no-explicit-any */
563
- /**
564
- * Creates a wrapper function that only executes the wrapped function if the condition function returns true.
565
- *
566
- * @param func - The function to be conditionally executed.
567
- * @param conditionFunc - A function that returns a boolean, determining if `func` should be executed.
568
- * @returns A wrapped version of `func` that executes conditionally.
569
- */
570
- function createConditionalExecutionFunction(func, conditionFunc) {
571
- return function (...args) {
572
- if (conditionFunc()) {
573
- return func(...args);
574
- }
575
- };
576
- }
577
-
578
- /* eslint-disable @typescript-eslint/no-explicit-any */
579
- /**
580
- * Creates a wrapper function that silently ignores any errors thrown by the wrapped void function.
581
- * This function is specifically for wrapping functions that do not return a value (void functions).
582
- * Exceptions are swallowed without any logging or handling.
583
- *
584
- * @param func - The void function to be wrapped.
585
- * @returns A wrapped version of the input function that ignores errors.
586
- */
587
- function createErrorIgnoringFunction(func) {
588
- return function (...args) {
589
- try {
590
- func(...args);
591
- }
592
- catch {
593
- // Deliberately swallowing/ignoring the exception
594
- }
595
- };
596
- }
597
-
598
- /* eslint-disable @typescript-eslint/no-unused-vars */
599
- /**
600
- * A no-operation function (noop) that does nothing regardless of the arguments passed.
601
- * It is designed to be as permissive as possible in its typing without using the `Function` keyword.
602
- *
603
- * @param args - Any arguments passed to the function (ignored)
604
- */
605
- const noop = (...args) => {
606
- // Intentionally does nothing
607
- };
608
-
609
- const logLevels = ['none', 'error', 'warn', 'log', 'info', 'debug'];
610
- const priority = {
611
- error: 4,
612
- warn: 3,
613
- log: 2,
614
- info: 1,
615
- debug: 0,
616
- };
617
- /**
618
- * Validates whether a given string is a valid log level.
619
- *
620
- * @param level - The log level to validate
621
- * @returns True if the level is valid, false otherwise
622
- */
623
- function isValidLogLevel(level) {
624
- return logLevels.includes(level);
625
- }
626
- /**
627
- * Creates a log level configuration manager for controlling logging behavior.
628
- * Provides methods to get, set, and evaluate log levels based on priority.
629
- *
630
- * @param level - The initial log level (defaults to 'error')
631
- * @returns A configuration object with log level management methods
632
- * @throws {Error} When the provided level is not a valid log level
633
- */
634
- function createLogLevelConfig(level = 'error') {
635
- if (!isValidLogLevel(level)) {
636
- throw createError('Cannot create log level configuration with a valid default log level');
637
- }
638
- const state = { level };
639
- const getLogLevel = () => state.level;
640
- const setLogLevel = (level) => {
641
- if (!isValidLogLevel(level)) {
642
- throw createError(`Cannot set value '${level}' level. Expected levels are ${logLevels}.`);
643
- }
644
- state.level = level;
645
- };
646
- const shouldLog = (level) => {
647
- if (state.level === 'none' || level === 'none' || !isValidLogLevel(level)) {
648
- return false;
649
- }
650
- return priority[level] >= priority[state.level];
651
- };
652
- return freeze({
653
- getLogLevel,
654
- setLogLevel,
655
- shouldLog,
656
- });
657
- }
658
-
659
- /**
660
- * Creates a logger instance with configurable log level filtering.
661
- * Each log function is wrapped to respect the current log level setting.
662
- *
663
- * @param error - Function to handle error-level logs (required)
664
- * @param warn - Function to handle warning-level logs (optional, defaults to noop)
665
- * @param log - Function to handle standard logs (optional, defaults to noop)
666
- * @param info - Function to handle info-level logs (optional, defaults to noop)
667
- * @param debug - Function to handle debug-level logs (optional, defaults to noop)
668
- * @returns A frozen logger object with log methods and level control
669
- * @throws {ErrorLevelFn} When any provided log function is invalid
670
- */
671
- function createLogger(error, warn = noop, log = noop, info = noop, debug = noop) {
672
- if (notValidLogFn(error)) {
673
- throw createError(notFnMsg('error'));
674
- }
675
- if (notValidLogFn(warn)) {
676
- throw createError(notFnMsg('warn'));
677
- }
678
- if (notValidLogFn(log)) {
679
- throw createError(notFnMsg('log'));
680
- }
681
- if (notValidLogFn(info)) {
682
- throw createError(notFnMsg('info'));
683
- }
684
- if (notValidLogFn(debug)) {
685
- throw createError(notFnMsg('debug'));
686
- }
687
- const { setLogLevel, getLogLevel, shouldLog } = createLogLevelConfig();
688
- const wrapLogFn = (fn, level) => {
689
- if (fn === noop)
690
- return fn;
691
- const condition = () => shouldLog(level);
692
- return createConditionalExecutionFunction(createErrorIgnoringFunction(fn), condition);
693
- };
694
- return freeze({
695
- error: wrapLogFn(error, 'error'),
696
- warn: wrapLogFn(warn, 'warn'),
697
- log: wrapLogFn(log, 'log'),
698
- info: wrapLogFn(info, 'info'),
699
- debug: wrapLogFn(debug, 'debug'),
700
- setLogLevel,
701
- getLogLevel,
702
- });
703
- }
704
- /**
705
- * Validates whether a given value is a valid log function.
706
- *
707
- * @param fn - The value to validate
708
- * @returns True if the value is not a function (invalid), false if it is valid
709
- */
710
- function notValidLogFn(fn) {
711
- return getType(fn) !== 'function' && fn !== noop;
712
- }
713
- /**
714
- * Generates an error message for invalid log function parameters.
715
- *
716
- * @param label - The name of the log function that failed validation
717
- * @returns A formatted error message string
718
- */
719
- function notFnMsg(label) {
720
- return `Cannot create a logger when ${label} is not a function`;
721
- }
722
-
723
- createLogger(error, warn, log, info, debug);
6
+ import { isArray } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.esm.js';
7
+ import { error, warn, log, info, debug } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.esm.js';
8
+ import { stringify, parse } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.esm.js';
9
+ import { createLogger } from '../../_dependencies/@hyperfrontend/logging/index.esm.js';
10
+ import { createError } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js';
11
+ import { parseInt, parseFloat } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.esm.js';
12
+ import { isDirectory, exists } from '../../_shared/core/fs/stat/index.esm.js';
13
+ import { createConfigError } from '../../_shared/core/errors/structured-errors/index.esm.js';
14
+ import { createCache } from '../../_shared/core/cache/index.esm.js';
15
+ import { matchGlobPattern } from '../../_shared/core/patterns/glob/index.esm.js';
16
+ import { CONFIG_PATTERNS, getConfigPatternsByType } from '../../_shared/project/config/patterns/index.esm.js';
724
17
 
725
18
  /**
726
19
  * Global log level registry.
@@ -760,6 +53,13 @@ function isSensitiveKey(key) {
760
53
  *
761
54
  * @param obj - Object to sanitize
762
55
  * @returns New object with sensitive values redacted
56
+ *
57
+ * @example Sanitizing sensitive data
58
+ * ```typescript
59
+ * const config = { apiKey: 'secret123', endpoint: 'https://api.example.com' }
60
+ * const safe = sanitize(config)
61
+ * // => { apiKey: '[REDACTED]', endpoint: 'https://api.example.com' }
62
+ * ```
763
63
  */
764
64
  function sanitize(obj) {
765
65
  if (obj === null || obj === undefined) {
@@ -810,7 +110,7 @@ function formatMessage(namespace, message, meta) {
810
110
  * @param options - Logger configuration options
811
111
  * @returns A configured scoped logger instance
812
112
  *
813
- * @example
113
+ * @example Creating a scoped logger
814
114
  * ```typescript
815
115
  * const logger = createScopedLogger('project-scope')
816
116
  * logger.setLogLevel('debug')
@@ -825,14 +125,11 @@ function formatMessage(namespace, message, meta) {
825
125
  */
826
126
  function createScopedLogger(namespace, options = {}) {
827
127
  const { level = 'error', sanitizeSecrets = true } = options;
828
- // Create wrapper functions that add namespace prefix and sanitization
829
128
  const createLogFn = (baseFn) => (message, meta) => {
830
129
  const processedMeta = sanitizeSecrets && meta ? sanitize(meta) : meta;
831
130
  baseFn(formatMessage(namespace, message, processedMeta));
832
131
  };
833
- // Create base logger with wrapped functions
834
132
  const baseLogger = createLogger(createLogFn(error), createLogFn(warn), createLogFn(log), createLogFn(info), createLogFn(debug));
835
- // Set initial log level (use global override if set)
836
133
  baseLogger.setLogLevel(level);
837
134
  const scopedLogger = freeze({
838
135
  error: (message, meta) => baseLogger.error(message, meta),
@@ -843,7 +140,6 @@ function createScopedLogger(namespace, options = {}) {
843
140
  setLogLevel: baseLogger.setLogLevel,
844
141
  getLogLevel: baseLogger.getLogLevel,
845
142
  });
846
- // Register logger for global level management
847
143
  loggerRegistry.add(scopedLogger);
848
144
  return scopedLogger;
849
145
  }
@@ -851,7 +147,7 @@ function createScopedLogger(namespace, options = {}) {
851
147
  * Default logger instance for the project-scope library.
852
148
  * Use this for general logging within the library.
853
149
  *
854
- * @example
150
+ * @example Using the default logger
855
151
  * ```typescript
856
152
  * import { logger } from '@hyperfrontend/project-scope/core'
857
153
  *
@@ -869,6 +165,15 @@ const fsLogger = createScopedLogger('project-scope:fs');
869
165
  * @param code - The category code for this type of filesystem failure
870
166
  * @param context - Additional context including path, operation, and cause
871
167
  * @returns A configured Error object with code and context properties
168
+ *
169
+ * @example Creating a file system error
170
+ * ```typescript
171
+ * throw createFileSystemError(
172
+ * 'Cannot read file',
173
+ * 'FS_READ_ERROR',
174
+ * { path: './missing.txt', operation: 'read' }
175
+ * )
176
+ * ```
872
177
  */
873
178
  function createFileSystemError(message, code, context) {
874
179
  const error = createError(message);
@@ -886,7 +191,7 @@ function createFileSystemError(message, code, context) {
886
191
  * @returns File contents as string
887
192
  * @throws {Error} If file doesn't exist or can't be read
888
193
  *
889
- * @example
194
+ * @example Reading file contents
890
195
  * ```typescript
891
196
  * import { readFileContent } from '@hyperfrontend/project-scope'
892
197
  *
@@ -913,6 +218,14 @@ function readFileContent(filePath, encoding = 'utf-8') {
913
218
  * @param filePath - Path to file
914
219
  * @param encoding - File encoding (default: utf-8)
915
220
  * @returns File contents or null if file doesn't exist
221
+ *
222
+ * @example Reading file if it exists
223
+ * ```typescript
224
+ * const content = readFileIfExists('./optional-config.json')
225
+ * if (content) {
226
+ * // File existed, use content
227
+ * }
228
+ * ```
916
229
  */
917
230
  function readFileIfExists(filePath, encoding = 'utf-8') {
918
231
  if (!existsSync(filePath)) {
@@ -926,56 +239,6 @@ function readFileIfExists(filePath, encoding = 'utf-8') {
926
239
  }
927
240
  }
928
241
 
929
- createScopedLogger('project-scope:fs:write');
930
-
931
- /**
932
- * Get file stats with error handling.
933
- *
934
- * @param filePath - Path to file
935
- * @param followSymlinks - Whether to follow symlinks (default: true)
936
- * @returns File stats or null if path doesn't exist
937
- */
938
- function getFileStat(filePath, followSymlinks = true) {
939
- if (!existsSync(filePath)) {
940
- return null;
941
- }
942
- try {
943
- const stat = followSymlinks ? statSync(filePath) : lstatSync(filePath);
944
- return {
945
- isFile: stat.isFile(),
946
- isDirectory: stat.isDirectory(),
947
- isSymlink: stat.isSymbolicLink(),
948
- size: stat.size,
949
- created: stat.birthtime,
950
- modified: stat.mtime,
951
- accessed: stat.atime,
952
- mode: stat.mode,
953
- };
954
- }
955
- catch {
956
- return null;
957
- }
958
- }
959
- /**
960
- * Check if path is a directory.
961
- *
962
- * @param dirPath - Path to check
963
- * @returns True if path is a directory
964
- */
965
- function isDirectory(dirPath) {
966
- const stats = getFileStat(dirPath);
967
- return stats?.isDirectory ?? false;
968
- }
969
- /**
970
- * Check if path exists.
971
- *
972
- * @param filePath - Path to check
973
- * @returns True if path exists
974
- */
975
- function exists(filePath) {
976
- return existsSync(filePath);
977
- }
978
-
979
242
  const fsDirLogger = createScopedLogger('project-scope:fs:dir');
980
243
  /**
981
244
  * List immediate contents of a directory.
@@ -984,7 +247,7 @@ const fsDirLogger = createScopedLogger('project-scope:fs:dir');
984
247
  * @returns Array of entries with metadata for each file/directory
985
248
  * @throws {Error} If directory doesn't exist or isn't a directory
986
249
  *
987
- * @example
250
+ * @example Listing directory contents
988
251
  * ```typescript
989
252
  * import { readDirectory } from '@hyperfrontend/project-scope'
990
253
  *
@@ -1027,211 +290,7 @@ function readDirectory(dirPath) {
1027
290
 
1028
291
  createScopedLogger('project-scope:fs:traversal');
1029
292
 
1030
- /**
1031
- * Pattern matching utilities with ReDoS protection.
1032
- * Uses character-by-character matching instead of regex where possible.
1033
- */
1034
- /**
1035
- * Match path against glob pattern using safe character iteration.
1036
- * Avoids regex to prevent ReDoS attacks.
1037
- *
1038
- * Supported patterns:
1039
- * - * matches any characters except /
1040
- * - ** matches any characters including /
1041
- * - ? matches exactly one character except /
1042
- * - {a,b,c} matches any of the alternatives
1043
- *
1044
- * @param path - The filesystem path to test against the pattern
1045
- * @param pattern - The glob pattern to match against
1046
- * @returns True if path matches pattern
1047
- *
1048
- * @example
1049
- * ```typescript
1050
- * import { matchGlobPattern } from '@hyperfrontend/project-scope'
1051
- *
1052
- * matchGlobPattern('src/utils/helper.ts', '\*\*\/*.ts') // true
1053
- * matchGlobPattern('test.spec.ts', '\*.spec.ts') // true
1054
- * matchGlobPattern('config.json', '\*.{json,yaml}') // true
1055
- * matchGlobPattern('src/index.ts', 'src/\*.ts') // true
1056
- * ```
1057
- */
1058
- function matchGlobPattern(path, pattern) {
1059
- return matchSegments(path.split('/'), pattern.split('/'), 0, 0);
1060
- }
1061
- /**
1062
- * Internal recursive function to match path segments against pattern segments.
1063
- *
1064
- * @param pathParts - Array of path segments split by '/'
1065
- * @param patternParts - Array of pattern segments split by '/'
1066
- * @param pathIdx - Current index in pathParts being examined
1067
- * @param patternIdx - Current index in patternParts being examined
1068
- * @returns True if remaining segments match
1069
- */
1070
- function matchSegments(pathParts, patternParts, pathIdx, patternIdx) {
1071
- // Base cases
1072
- if (pathIdx === pathParts.length && patternIdx === patternParts.length) {
1073
- return true; // Both exhausted = match
1074
- }
1075
- if (patternIdx >= patternParts.length) {
1076
- return false; // Pattern exhausted but path remains
1077
- }
1078
- const patternPart = patternParts[patternIdx];
1079
- // Handle ** (globstar) - matches zero or more directories
1080
- if (patternPart === '**') {
1081
- // Try matching rest of pattern against current position and all future positions
1082
- for (let i = pathIdx; i <= pathParts.length; i++) {
1083
- if (matchSegments(pathParts, patternParts, i, patternIdx + 1)) {
1084
- return true;
1085
- }
1086
- }
1087
- return false;
1088
- }
1089
- if (pathIdx >= pathParts.length) {
1090
- return false; // Path exhausted but pattern remains (and it's not **)
1091
- }
1092
- const pathPart = pathParts[pathIdx];
1093
- // Match current segment
1094
- if (matchSegment(pathPart, patternPart)) {
1095
- return matchSegments(pathParts, patternParts, pathIdx + 1, patternIdx + 1);
1096
- }
1097
- return false;
1098
- }
1099
- /**
1100
- * Match a single path segment against a pattern segment.
1101
- * Handles *, ?, and {a,b,c} patterns.
1102
- *
1103
- * @param text - The path segment text to match
1104
- * @param pattern - The pattern segment to match against
1105
- * @returns True if the text matches the pattern
1106
- */
1107
- function matchSegment(text, pattern) {
1108
- let textIdx = 0;
1109
- let patternIdx = 0;
1110
- while (patternIdx < pattern.length) {
1111
- const char = pattern[patternIdx];
1112
- if (char === '*') {
1113
- // * matches zero or more characters
1114
- patternIdx++;
1115
- if (patternIdx === pattern.length) {
1116
- return true; // * at end matches rest of string
1117
- }
1118
- // Try matching rest of pattern at each position in text
1119
- for (let i = textIdx; i <= text.length; i++) {
1120
- if (matchSegmentFrom(text, i, pattern, patternIdx)) {
1121
- return true;
1122
- }
1123
- }
1124
- return false;
1125
- }
1126
- else if (char === '?') {
1127
- // ? matches exactly one character
1128
- if (textIdx >= text.length) {
1129
- return false;
1130
- }
1131
- textIdx++;
1132
- patternIdx++;
1133
- }
1134
- else if (char === '{') {
1135
- // {a,b,c} matches any alternative
1136
- const closeIdx = findClosingBrace(pattern, patternIdx);
1137
- if (closeIdx === -1) {
1138
- // Unmatched brace, treat as literal
1139
- if (textIdx >= text.length || text[textIdx] !== char) {
1140
- return false;
1141
- }
1142
- textIdx++;
1143
- patternIdx++;
1144
- }
1145
- else {
1146
- const alternatives = extractAlternatives(pattern.slice(patternIdx + 1, closeIdx));
1147
- for (const alt of alternatives) {
1148
- if (matchSegmentFrom(text, textIdx, text.slice(0, textIdx) + alt + pattern.slice(closeIdx + 1), textIdx)) {
1149
- return true;
1150
- }
1151
- }
1152
- return false;
1153
- }
1154
- }
1155
- else {
1156
- // Literal character
1157
- if (textIdx >= text.length || text[textIdx] !== char) {
1158
- return false;
1159
- }
1160
- textIdx++;
1161
- patternIdx++;
1162
- }
1163
- }
1164
- return textIdx === text.length;
1165
- }
1166
- /**
1167
- * Helper to match from a specific position.
1168
- *
1169
- * @param text - The full text being matched
1170
- * @param textIdx - The starting index in text to match from
1171
- * @param pattern - The full pattern being matched
1172
- * @param patternIdx - The starting index in pattern to match from
1173
- * @returns True if the text matches the pattern from the given positions
1174
- */
1175
- function matchSegmentFrom(text, textIdx, pattern, patternIdx) {
1176
- const remainingText = text.slice(textIdx);
1177
- const remainingPattern = pattern.slice(patternIdx);
1178
- return matchSegment(remainingText, remainingPattern);
1179
- }
1180
- /**
1181
- * Find closing brace for {a,b,c} pattern.
1182
- *
1183
- * @param pattern - The pattern string to search within
1184
- * @param startIdx - The index of the opening brace
1185
- * @returns The index of the matching closing brace, or -1 if not found
1186
- */
1187
- function findClosingBrace(pattern, startIdx) {
1188
- let depth = 0;
1189
- for (let i = startIdx; i < pattern.length; i++) {
1190
- if (pattern[i] === '{') {
1191
- depth++;
1192
- }
1193
- else if (pattern[i] === '}') {
1194
- depth--;
1195
- if (depth === 0) {
1196
- return i;
1197
- }
1198
- }
1199
- }
1200
- return -1;
1201
- }
1202
- /**
1203
- * Extract alternatives from {a,b,c} pattern content.
1204
- *
1205
- * @param content - The content between braces (without the braces themselves)
1206
- * @returns Array of alternative strings split by commas at depth 0
1207
- */
1208
- function extractAlternatives(content) {
1209
- const alternatives = [];
1210
- let current = '';
1211
- let depth = 0;
1212
- for (let i = 0; i < content.length; i++) {
1213
- const char = content[i];
1214
- if (char === '{') {
1215
- depth++;
1216
- current += char;
1217
- }
1218
- else if (char === '}') {
1219
- depth--;
1220
- current += char;
1221
- }
1222
- else if (char === ',' && depth === 0) {
1223
- alternatives.push(current);
1224
- current = '';
1225
- }
1226
- else {
1227
- current += char;
1228
- }
1229
- }
1230
- if (current) {
1231
- alternatives.push(current);
1232
- }
1233
- return alternatives;
1234
- }
293
+ createScopedLogger('project-scope:fs:write');
1235
294
 
1236
295
  const walkLogger = createScopedLogger('project-scope:project:walk');
1237
296
  /**
@@ -1298,6 +357,18 @@ function matchPattern(path, pattern) {
1298
357
  * @param startPath - Root directory to begin traversal
1299
358
  * @param visitor - Callback function invoked for each file system entry
1300
359
  * @param options - Configuration for traversal behavior
360
+ *
361
+ * @example Walking a directory tree
362
+ * ```typescript
363
+ * import { walkDirectory } from '@hyperfrontend/project-scope'
364
+ *
365
+ * const tsFiles: string[] = []
366
+ * walkDirectory('./src', (entry) => {
367
+ * if (entry.isFile && entry.name.endsWith('.ts')) {
368
+ * tsFiles.push(entry.relativePath)
369
+ * }
370
+ * }, { maxDepth: 5, respectGitignore: true })
371
+ * ```
1301
372
  */
1302
373
  function walkDirectory(startPath, visitor, options) {
1303
374
  walkLogger.debug('Starting directory walk', {
@@ -1394,7 +465,7 @@ function matchesPatterns(path, patterns) {
1394
465
  * @param options - Configuration for search behavior
1395
466
  * @returns List of relative file paths that match the patterns
1396
467
  *
1397
- * @example
468
+ * @example Finding files by pattern
1398
469
  * ```typescript
1399
470
  * import { findFiles } from '@hyperfrontend/project-scope'
1400
471
  *
@@ -1449,7 +520,7 @@ const configDetectionCache = createCache({ ttl: 30000, maxSize: 50 });
1449
520
  * @param options - Detection options
1450
521
  * @returns Array of detected configuration files
1451
522
  *
1452
- * @example
523
+ * @example Detecting configuration files
1453
524
  * ```typescript
1454
525
  * import { detectConfigs } from '@hyperfrontend/project-scope'
1455
526
  *
@@ -1529,6 +600,14 @@ function detectConfigs(rootPath, types, options) {
1529
600
  * Clear the config detection cache.
1530
601
  *
1531
602
  * Useful for testing or when the project files have changed.
603
+ *
604
+ * @example Clearing the config detection cache
605
+ * ```typescript
606
+ * import { clearConfigDetectionCache } from '@hyperfrontend/project-scope'
607
+ *
608
+ * // Reset cache after modifying config files
609
+ * clearConfigDetectionCache()
610
+ * ```
1532
611
  */
1533
612
  function clearConfigDetectionCache() {
1534
613
  configDetectionCache.clear();
@@ -1539,6 +618,17 @@ function clearConfigDetectionCache() {
1539
618
  * @param rootPath - Project root directory
1540
619
  * @param type - Config type to find
1541
620
  * @returns Full path to config file or null if not found
621
+ *
622
+ * @example Finding a specific config file
623
+ * ```typescript
624
+ * import { findConfigFile } from '@hyperfrontend/project-scope'
625
+ *
626
+ * const tsConfig = findConfigFile('/project', 'typescript')
627
+ * // => '/project/tsconfig.json'
628
+ *
629
+ * const eslint = findConfigFile('/project', 'eslint')
630
+ * // => '/project/.eslintrc.js' or null if not found
631
+ * ```
1542
632
  */
1543
633
  function findConfigFile(rootPath, type) {
1544
634
  const info = CONFIG_PATTERNS[type];
@@ -1562,76 +652,6 @@ function findConfigFile(rootPath, type) {
1562
652
  }
1563
653
  return null;
1564
654
  }
1565
- /**
1566
- * Get all known config file patterns for a given configuration type.
1567
- *
1568
- * @param type - Configuration type identifier
1569
- * @returns Array of glob patterns for matching config files
1570
- */
1571
- function getConfigPaths(type) {
1572
- const info = CONFIG_PATTERNS[type];
1573
- return info?.patterns ?? [];
1574
- }
1575
-
1576
- /**
1577
- * Safe copies of Number built-in methods and constants.
1578
- *
1579
- * These references are captured at module initialization time to protect against
1580
- * prototype pollution attacks. Import only what you need for tree-shaking.
1581
- *
1582
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/number
1583
- */
1584
- // Capture references at module initialization time
1585
- const _parseInt = globalThis.parseInt;
1586
- const _parseFloat = globalThis.parseFloat;
1587
- // ============================================================================
1588
- // Parsing
1589
- // ============================================================================
1590
- /**
1591
- * (Safe copy) Parses a string and returns an integer.
1592
- */
1593
- const parseInt = _parseInt;
1594
- /**
1595
- * (Safe copy) Parses a string and returns a floating point number.
1596
- */
1597
- const parseFloat = _parseFloat;
1598
-
1599
- /**
1600
- * Create a structured error with code and optional context.
1601
- *
1602
- * @param message - The human-readable error message
1603
- * @param code - The machine-readable error code for programmatic handling
1604
- * @param context - Additional contextual information about the error
1605
- * @returns Structured error instance with code and context properties
1606
- *
1607
- * @example
1608
- * ```typescript
1609
- * import { createStructuredError } from '@hyperfrontend/project-scope'
1610
- *
1611
- * throw createStructuredError(
1612
- * 'Configuration file not found',
1613
- * 'CONFIG_NOT_FOUND',
1614
- * { path: './config.json', searched: ['./config.json', './settings.json'] }
1615
- * )
1616
- * ```
1617
- */
1618
- function createStructuredError(message, code, context) {
1619
- const error = createError(message);
1620
- error.code = code;
1621
- error.context = context ?? {};
1622
- return error;
1623
- }
1624
- /**
1625
- * Create a configuration-related error.
1626
- *
1627
- * @param message - The human-readable error message
1628
- * @param code - The machine-readable error code for programmatic handling
1629
- * @param context - Additional contextual information (e.g., file path, config key)
1630
- * @returns Structured error instance tagged with type 'config'
1631
- */
1632
- function createConfigError(message, code, context) {
1633
- return createStructuredError(message, code, { ...context, type: 'config' });
1634
- }
1635
655
 
1636
656
  /**
1637
657
  * Detect config type from file name.
@@ -1844,6 +864,18 @@ function parseDotenv(content) {
1844
864
  * @param type - Category of configuration (e.g., typescript, eslint)
1845
865
  * @param format - Whether to strip comments (jsonc) or parse strictly (json)
1846
866
  * @returns Configuration object with parsed data and extends references
867
+ *
868
+ * @example Parsing JSON configuration
869
+ * ```typescript
870
+ * import { parseJsonConfig } from '@hyperfrontend/project-scope'
871
+ *
872
+ * const config = parseJsonConfig(
873
+ * 'tsconfig.json',
874
+ * '{ "extends": "./base.json", "compilerOptions": {} }',
875
+ * 'typescript'
876
+ * )
877
+ * // => { type: 'typescript', path: 'tsconfig.json', data: {...}, extends: ['./base.json'] }
878
+ * ```
1847
879
  */
1848
880
  function parseJsonConfig(filePath, content, type, format = 'json') {
1849
881
  const cleanContent = format === 'jsonc' ? stripJsonComments(content) : content;
@@ -1879,6 +911,14 @@ function parseJsonConfig(filePath, content, type, format = 'json') {
1879
911
  * @param content - Raw file content to parse
1880
912
  * @param type - Category of configuration (e.g., github-actions, docker-compose)
1881
913
  * @returns Configuration object with parsed YAML data
914
+ *
915
+ * @example Parsing YAML configuration
916
+ * ```typescript
917
+ * import { parseYamlConfig } from '@hyperfrontend/project-scope'
918
+ *
919
+ * const config = parseYamlConfig('.github/workflows/ci.yml', yamlContent, 'github-actions')
920
+ * // => { type: 'github-actions', path: '...', format: 'yaml', data: {...} }
921
+ * ```
1882
922
  */
1883
923
  function parseYamlConfig(filePath, content, type) {
1884
924
  const data = parseSimpleYaml(content);
@@ -1895,6 +935,14 @@ function parseYamlConfig(filePath, content, type) {
1895
935
  * @param filePath - Path to config file
1896
936
  * @param type - Optional config type (auto-detected if not provided)
1897
937
  * @returns Parsed configuration
938
+ *
939
+ * @example Parsing a configuration file
940
+ * ```typescript
941
+ * import { parseConfig } from '@hyperfrontend/project-scope'
942
+ *
943
+ * const tsConfig = parseConfig('/project/tsconfig.json')
944
+ * const eslintConfig = parseConfig('/project/.eslintrc.yml', 'eslint')
945
+ * ```
1898
946
  */
1899
947
  function parseConfig(filePath, type) {
1900
948
  const content = readFileContent(filePath);
@@ -1939,33 +987,5 @@ function parseConfig(filePath, type) {
1939
987
  };
1940
988
  }
1941
989
  }
1942
- /**
1943
- * Read and parse config file if it exists.
1944
- *
1945
- * @param configPath - Path to config file
1946
- * @returns Parsed config or null if file doesn't exist
1947
- */
1948
- function readConfigIfExists(configPath) {
1949
- const content = readFileIfExists(configPath);
1950
- if (!content)
1951
- return null;
1952
- try {
1953
- const format = detectFormat(configPath);
1954
- switch (format) {
1955
- case 'json':
1956
- return parse(content);
1957
- case 'jsonc':
1958
- return parse(stripJsonComments(content));
1959
- case 'yaml':
1960
- return parseSimpleYaml(content);
1961
- default:
1962
- return null;
1963
- }
1964
- }
1965
- catch {
1966
- return null;
1967
- }
1968
- }
1969
990
 
1970
- export { CONFIG_PATTERNS, clearConfigDetectionCache, detectConfigs, findConfigFile, getConfigPaths, getConfigPatternsByType, parseConfig, parseJsonConfig, parseYamlConfig, readConfigIfExists };
1971
- //# sourceMappingURL=index.esm.js.map
991
+ export { CONFIG_PATTERNS, clearConfigDetectionCache, detectConfigs, findConfigFile, getConfigPatternsByType, parseConfig, parseJsonConfig, parseYamlConfig };