@stryke/fs 0.33.9 → 0.33.16

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 (310) hide show
  1. package/CHANGELOG.md +1280 -0
  2. package/README.md +18 -9
  3. package/dist/buffer-Ch164vki.cjs +1 -0
  4. package/dist/buffer-DDq-CW4J.mjs +2 -0
  5. package/dist/buffer-DDq-CW4J.mjs.map +1 -0
  6. package/dist/{buffer.d.ts → buffer-DgfUmhrc.d.mts} +8 -4
  7. package/dist/buffer-DgfUmhrc.d.mts.map +1 -0
  8. package/dist/buffer-DvCjrjQH.d.cts +32 -0
  9. package/dist/buffer-DvCjrjQH.d.cts.map +1 -0
  10. package/dist/buffer.cjs +1 -34
  11. package/dist/buffer.d.cts +2 -0
  12. package/dist/buffer.d.mts +2 -0
  13. package/dist/buffer.mjs +1 -1
  14. package/dist/{chmod-x.d.ts → chmod-x-BPr4tt2-.d.cts} +10 -6
  15. package/dist/chmod-x-BPr4tt2-.d.cts.map +1 -0
  16. package/dist/chmod-x-FOy3sak8.cjs +1 -0
  17. package/dist/chmod-x-QCk1GmQJ.d.mts +44 -0
  18. package/dist/chmod-x-QCk1GmQJ.d.mts.map +1 -0
  19. package/dist/chmod-x-q-TWdus7.mjs +2 -0
  20. package/dist/chmod-x-q-TWdus7.mjs.map +1 -0
  21. package/dist/chmod-x.cjs +1 -57
  22. package/dist/chmod-x.d.cts +2 -0
  23. package/dist/chmod-x.d.mts +2 -0
  24. package/dist/chmod-x.mjs +1 -1
  25. package/dist/chunk-Bmb41Sf3.cjs +1 -0
  26. package/dist/{command-exists.d.ts → command-exists-CuieR7rx.d.cts} +6 -2
  27. package/dist/command-exists-CuieR7rx.d.cts.map +1 -0
  28. package/dist/command-exists-D1bV-wSk.cjs +1 -0
  29. package/dist/command-exists-Dzb2kKT4.mjs +2 -0
  30. package/dist/command-exists-Dzb2kKT4.mjs.map +1 -0
  31. package/dist/command-exists-dBdtR0xj.d.mts +22 -0
  32. package/dist/command-exists-dBdtR0xj.d.mts.map +1 -0
  33. package/dist/command-exists.cjs +1 -71
  34. package/dist/command-exists.d.cts +2 -0
  35. package/dist/command-exists.d.mts +2 -0
  36. package/dist/command-exists.mjs +1 -1
  37. package/dist/compress-BiTxso15.mjs +2 -0
  38. package/dist/compress-BiTxso15.mjs.map +1 -0
  39. package/dist/compress-BjGbQqs_.cjs +1 -0
  40. package/dist/compress-CLAaOwH3.d.mts +16 -0
  41. package/dist/compress-CLAaOwH3.d.mts.map +1 -0
  42. package/dist/compress-CQve2a6h.d.cts +16 -0
  43. package/dist/compress-CQve2a6h.d.cts.map +1 -0
  44. package/dist/compress.cjs +1 -26
  45. package/dist/compress.d.cts +2 -0
  46. package/dist/compress.d.mts +2 -0
  47. package/dist/compress.mjs +1 -1
  48. package/dist/constants-D58o2CiO.d.cts +5 -0
  49. package/dist/constants-D58o2CiO.d.cts.map +1 -0
  50. package/dist/constants-DZz9LJgo.d.mts +5 -0
  51. package/dist/constants-DZz9LJgo.d.mts.map +1 -0
  52. package/dist/constants.cjs +0 -1
  53. package/dist/constants.d.cts +2 -0
  54. package/dist/constants.d.mts +2 -0
  55. package/dist/constants.mjs +1 -0
  56. package/dist/{copy-file.d.ts → copy-file-B5FJHiIK.d.mts} +11 -5
  57. package/dist/copy-file-B5FJHiIK.d.mts.map +1 -0
  58. package/dist/copy-file-Bot2YNtT.mjs +2 -0
  59. package/dist/copy-file-Bot2YNtT.mjs.map +1 -0
  60. package/dist/copy-file-DjH2Ho5e.d.cts +39 -0
  61. package/dist/copy-file-DjH2Ho5e.d.cts.map +1 -0
  62. package/dist/copy-file-Y1ilzocZ.cjs +1 -0
  63. package/dist/copy-file.cjs +1 -48
  64. package/dist/copy-file.d.cts +2 -0
  65. package/dist/copy-file.d.mts +2 -0
  66. package/dist/copy-file.mjs +1 -1
  67. package/dist/cwd-YTg9Cx6C.mjs +2 -0
  68. package/dist/cwd-YTg9Cx6C.mjs.map +1 -0
  69. package/dist/cwd-o2vq8Tk9.cjs +1 -0
  70. package/dist/{exists.d.ts → exists-175EN367.d.mts} +6 -2
  71. package/dist/exists-175EN367.d.mts.map +1 -0
  72. package/dist/exists-B31lSRFp.cjs +1 -0
  73. package/dist/exists-CVlDImzc.d.cts +18 -0
  74. package/dist/exists-CVlDImzc.d.cts.map +1 -0
  75. package/dist/exists-Ci-9lYmi.mjs +2 -0
  76. package/dist/exists-Ci-9lYmi.mjs.map +1 -0
  77. package/dist/exists.cjs +1 -15
  78. package/dist/exists.d.cts +2 -0
  79. package/dist/exists.d.mts +2 -0
  80. package/dist/exists.mjs +1 -1
  81. package/dist/file-D1uBqkpP.d.cts +32 -0
  82. package/dist/file-D1uBqkpP.d.cts.map +1 -0
  83. package/dist/file-DauFFmfh.d.mts +32 -0
  84. package/dist/file-DauFFmfh.d.mts.map +1 -0
  85. package/dist/file-path-fns-7aKacdLg.cjs +1 -0
  86. package/dist/file-path-fns-BDzC2SIV.mjs +2 -0
  87. package/dist/file-path-fns-BDzC2SIV.mjs.map +1 -0
  88. package/dist/get-parent-path-COkh6Pvl.d.mts +32 -0
  89. package/dist/get-parent-path-COkh6Pvl.d.mts.map +1 -0
  90. package/dist/get-parent-path-Cbqs2km7.d.cts +32 -0
  91. package/dist/get-parent-path-Cbqs2km7.d.cts.map +1 -0
  92. package/dist/get-parent-path-CfRkaB4R.cjs +1 -0
  93. package/dist/get-parent-path-DLFSyxSW.mjs +2 -0
  94. package/dist/get-parent-path-DLFSyxSW.mjs.map +1 -0
  95. package/dist/get-parent-path.cjs +1 -28
  96. package/dist/get-parent-path.d.cts +2 -0
  97. package/dist/get-parent-path.d.mts +2 -0
  98. package/dist/get-parent-path.mjs +1 -1
  99. package/dist/get-workspace-root-CCNjjZGY.cjs +1 -0
  100. package/dist/{get-workspace-root.d.ts → get-workspace-root-DQBvBd8X.d.mts} +12 -8
  101. package/dist/get-workspace-root-DQBvBd8X.d.mts.map +1 -0
  102. package/dist/get-workspace-root-eTfm1jII.d.cts +48 -0
  103. package/dist/get-workspace-root-eTfm1jII.d.cts.map +1 -0
  104. package/dist/get-workspace-root-k66w-wLW.mjs +2 -0
  105. package/dist/get-workspace-root-k66w-wLW.mjs.map +1 -0
  106. package/dist/get-workspace-root.cjs +1 -49
  107. package/dist/get-workspace-root.d.cts +2 -0
  108. package/dist/get-workspace-root.d.mts +2 -0
  109. package/dist/get-workspace-root.mjs +1 -1
  110. package/dist/helpers-BSEQb1fp.mjs +2 -0
  111. package/dist/helpers-BSEQb1fp.mjs.map +1 -0
  112. package/dist/{helpers.d.ts → helpers-CYWFZ-Uv.d.mts} +10 -6
  113. package/dist/helpers-CYWFZ-Uv.d.mts.map +1 -0
  114. package/dist/helpers-CgMOExPa.d.cts +50 -0
  115. package/dist/helpers-CgMOExPa.d.cts.map +1 -0
  116. package/dist/helpers-_MJ6PR-g.cjs +1 -0
  117. package/dist/helpers.cjs +1 -49
  118. package/dist/helpers.d.cts +2 -0
  119. package/dist/helpers.d.mts +2 -0
  120. package/dist/helpers.mjs +1 -1
  121. package/dist/index.cjs +1 -269
  122. package/dist/index.d.cts +25 -0
  123. package/dist/index.d.mts +25 -0
  124. package/dist/index.mjs +1 -1
  125. package/dist/install-B3bIjHoU.mjs +2 -0
  126. package/dist/install-B3bIjHoU.mjs.map +1 -0
  127. package/dist/install-CZ_S7NHm.cjs +1 -0
  128. package/dist/install-CxPsLO2t.d.cts +28 -0
  129. package/dist/install-CxPsLO2t.d.cts.map +1 -0
  130. package/dist/install-dYt7hlQn.d.mts +29 -0
  131. package/dist/install-dYt7hlQn.d.mts.map +1 -0
  132. package/dist/install.cjs +1 -25
  133. package/dist/install.d.cts +2 -0
  134. package/dist/install.d.mts +2 -0
  135. package/dist/install.mjs +1 -1
  136. package/dist/is-error-CjEyTRps.cjs +1 -0
  137. package/dist/is-error-CjVXmD_8.mjs +2 -0
  138. package/dist/is-error-CjVXmD_8.mjs.map +1 -0
  139. package/dist/is-file-BkFQev3M.cjs +1 -0
  140. package/dist/is-file-CNooe8Wz.mjs +2 -0
  141. package/dist/is-file-CNooe8Wz.mjs.map +1 -0
  142. package/dist/{is-file.d.ts → is-file-DjqOQrqY.d.mts} +8 -4
  143. package/dist/is-file-DjqOQrqY.d.mts.map +1 -0
  144. package/dist/is-file-DoBi2FN9.d.cts +36 -0
  145. package/dist/is-file-DoBi2FN9.d.cts.map +1 -0
  146. package/dist/is-file.cjs +1 -29
  147. package/dist/is-file.d.cts +2 -0
  148. package/dist/is-file.d.mts +2 -0
  149. package/dist/is-file.mjs +1 -1
  150. package/dist/is-object-FBXmvehR.cjs +1 -0
  151. package/dist/is-object-UsKYhyC5.mjs +2 -0
  152. package/dist/is-object-UsKYhyC5.mjs.map +1 -0
  153. package/dist/is-set-string-CLeu8BKX.cjs +1 -0
  154. package/dist/is-set-string-Cj0g4gsG.mjs +2 -0
  155. package/dist/is-set-string-Cj0g4gsG.mjs.map +1 -0
  156. package/dist/is-string-91Z3dOKQ.mjs +2 -0
  157. package/dist/is-string-91Z3dOKQ.mjs.map +1 -0
  158. package/dist/is-string-DKgNS0jA.cjs +1 -0
  159. package/dist/join-paths-BHepkhAj.mjs +2 -0
  160. package/dist/join-paths-BHepkhAj.mjs.map +1 -0
  161. package/dist/join-paths-DUdaieID.cjs +1 -0
  162. package/dist/json-CYenVxvr.d.cts +83 -0
  163. package/dist/json-CYenVxvr.d.cts.map +1 -0
  164. package/dist/json-DH7Q6Ftp.d.mts +83 -0
  165. package/dist/json-DH7Q6Ftp.d.mts.map +1 -0
  166. package/dist/json-DKhqPjHB.cjs +6 -0
  167. package/dist/json-Dp4PSH2i.mjs +7 -0
  168. package/dist/json-Dp4PSH2i.mjs.map +1 -0
  169. package/dist/json.cjs +1 -41
  170. package/dist/json.d.cts +2 -0
  171. package/dist/json.d.mts +2 -0
  172. package/dist/json.mjs +1 -3
  173. package/dist/list-files-Cn_UVruo.cjs +1 -0
  174. package/dist/list-files-D3dQOljX.d.cts +51 -0
  175. package/dist/list-files-D3dQOljX.d.cts.map +1 -0
  176. package/dist/list-files-D3iJzEQw.d.mts +51 -0
  177. package/dist/list-files-D3iJzEQw.d.mts.map +1 -0
  178. package/dist/list-files-D__uh3tQ.mjs +2 -0
  179. package/dist/list-files-D__uh3tQ.mjs.map +1 -0
  180. package/dist/list-files.cjs +1 -55
  181. package/dist/list-files.d.cts +2 -0
  182. package/dist/list-files.d.mts +2 -0
  183. package/dist/list-files.mjs +1 -1
  184. package/dist/package-fns-BNRi_Rpc.d.cts +354 -0
  185. package/dist/package-fns-BNRi_Rpc.d.cts.map +1 -0
  186. package/dist/package-fns-C7-MKgBR.mjs +2 -0
  187. package/dist/package-fns-C7-MKgBR.mjs.map +1 -0
  188. package/dist/package-fns-CxokaGDY.d.mts +354 -0
  189. package/dist/package-fns-CxokaGDY.d.mts.map +1 -0
  190. package/dist/package-fns-YTCdMAXr.cjs +1 -0
  191. package/dist/package-fns.cjs +1 -99
  192. package/dist/package-fns.d.cts +2 -0
  193. package/dist/package-fns.d.mts +2 -0
  194. package/dist/package-fns.mjs +1 -1
  195. package/dist/read-file-B091zB64.mjs +2 -0
  196. package/dist/read-file-B091zB64.mjs.map +1 -0
  197. package/dist/read-file-BB2WzW-N.cjs +1 -0
  198. package/dist/{read-file.d.ts → read-file-Bxn1VHKv.d.cts} +8 -4
  199. package/dist/read-file-Bxn1VHKv.d.cts.map +1 -0
  200. package/dist/read-file-CRVW-wcE.d.mts +30 -0
  201. package/dist/read-file-CRVW-wcE.d.mts.map +1 -0
  202. package/dist/read-file.cjs +1 -31
  203. package/dist/read-file.d.cts +2 -0
  204. package/dist/read-file.d.mts +2 -0
  205. package/dist/read-file.mjs +1 -1
  206. package/dist/registry-B1taIPKm.mjs +2 -0
  207. package/dist/registry-B1taIPKm.mjs.map +1 -0
  208. package/dist/{registry.d.ts → registry-BQ3JXRFA.d.mts} +17 -13
  209. package/dist/registry-BQ3JXRFA.d.mts.map +1 -0
  210. package/dist/registry-BYwvM92u.cjs +1 -0
  211. package/dist/registry-C2A0Kau7.d.cts +53 -0
  212. package/dist/registry-C2A0Kau7.d.cts.map +1 -0
  213. package/dist/registry.cjs +1 -95
  214. package/dist/registry.d.cts +2 -0
  215. package/dist/registry.d.mts +2 -0
  216. package/dist/registry.mjs +1 -1
  217. package/dist/remove-file-BM64Brdf.mjs +2 -0
  218. package/dist/remove-file-BM64Brdf.mjs.map +1 -0
  219. package/dist/remove-file-BqlkL_Df.d.mts +16 -0
  220. package/dist/remove-file-BqlkL_Df.d.mts.map +1 -0
  221. package/dist/remove-file-XHFKELQN.cjs +1 -0
  222. package/dist/remove-file-lQOlxDwr.d.cts +16 -0
  223. package/dist/remove-file-lQOlxDwr.d.cts.map +1 -0
  224. package/dist/remove-file.cjs +1 -16
  225. package/dist/remove-file.d.cts +2 -0
  226. package/dist/remove-file.d.mts +2 -0
  227. package/dist/remove-file.mjs +1 -1
  228. package/dist/resolve-C_YsCFne.mjs +4 -0
  229. package/dist/resolve-C_YsCFne.mjs.map +1 -0
  230. package/dist/{resolve.d.ts → resolve-D66oIwjf.d.mts} +33 -29
  231. package/dist/resolve-D66oIwjf.d.mts.map +1 -0
  232. package/dist/resolve-DTkLQekH.cjs +3 -0
  233. package/dist/resolve-DubH-8qd.d.cts +106 -0
  234. package/dist/resolve-DubH-8qd.d.cts.map +1 -0
  235. package/dist/resolve-parent-path-CR8av8WP.mjs +2 -0
  236. package/dist/resolve-parent-path-CR8av8WP.mjs.map +1 -0
  237. package/dist/resolve-parent-path-D0AaW2PB.cjs +1 -0
  238. package/dist/resolve.cjs +1 -115
  239. package/dist/resolve.d.cts +2 -0
  240. package/dist/resolve.d.mts +2 -0
  241. package/dist/resolve.mjs +1 -5
  242. package/dist/{semver-fns.d.ts → semver-fns-B0e5zB6C.d.mts} +17 -11
  243. package/dist/semver-fns-B0e5zB6C.d.mts.map +1 -0
  244. package/dist/semver-fns-Btrm1dIF.cjs +1 -0
  245. package/dist/semver-fns-DjhZXnUw.d.cts +92 -0
  246. package/dist/semver-fns-DjhZXnUw.d.cts.map +1 -0
  247. package/dist/semver-fns-F_rYnwDq.mjs +2 -0
  248. package/dist/semver-fns-F_rYnwDq.mjs.map +1 -0
  249. package/dist/semver-fns.cjs +1 -40
  250. package/dist/semver-fns.d.cts +2 -0
  251. package/dist/semver-fns.d.mts +2 -0
  252. package/dist/semver-fns.mjs +1 -1
  253. package/dist/toml-CIgLQmP3.mjs +4 -0
  254. package/dist/toml-CIgLQmP3.mjs.map +1 -0
  255. package/dist/toml-D3X2QoaL.d.cts +81 -0
  256. package/dist/toml-D3X2QoaL.d.cts.map +1 -0
  257. package/dist/toml-DgVyNp_y.cjs +3 -0
  258. package/dist/toml-Djau1M6n.d.mts +81 -0
  259. package/dist/toml-Djau1M6n.d.mts.map +1 -0
  260. package/dist/toml.cjs +1 -40
  261. package/dist/toml.d.cts +2 -0
  262. package/dist/toml.d.mts +2 -0
  263. package/dist/toml.mjs +1 -3
  264. package/dist/tsconfig-B13IMV_0.d.mts +812 -0
  265. package/dist/tsconfig-B13IMV_0.d.mts.map +1 -0
  266. package/dist/tsconfig-B6WtgD1c.cjs +1 -0
  267. package/dist/tsconfig-C8ecu1-0.d.cts +812 -0
  268. package/dist/tsconfig-C8ecu1-0.d.cts.map +1 -0
  269. package/dist/tsconfig-CqvvSVuX.mjs +2 -0
  270. package/dist/tsconfig-CqvvSVuX.mjs.map +1 -0
  271. package/dist/tsconfig.cjs +1 -28
  272. package/dist/tsconfig.d.cts +2 -0
  273. package/dist/tsconfig.d.mts +2 -0
  274. package/dist/tsconfig.mjs +1 -1
  275. package/dist/write-file-BmvbsmMj.d.cts +35 -0
  276. package/dist/write-file-BmvbsmMj.d.cts.map +1 -0
  277. package/dist/write-file-CFByoJkN.mjs +2 -0
  278. package/dist/write-file-CFByoJkN.mjs.map +1 -0
  279. package/dist/write-file-CWTzQpb2.d.mts +35 -0
  280. package/dist/write-file-CWTzQpb2.d.mts.map +1 -0
  281. package/dist/write-file-CqokudVp.cjs +1 -0
  282. package/dist/write-file.cjs +1 -26
  283. package/dist/write-file.d.cts +2 -0
  284. package/dist/write-file.d.mts +2 -0
  285. package/dist/write-file.mjs +1 -1
  286. package/dist/yaml-6uuLoSfT.d.cts +23 -0
  287. package/dist/yaml-6uuLoSfT.d.cts.map +1 -0
  288. package/dist/yaml-CLMo56UG.mjs +2 -0
  289. package/dist/yaml-CLMo56UG.mjs.map +1 -0
  290. package/dist/yaml-Ddslc5NK.d.mts +23 -0
  291. package/dist/yaml-Ddslc5NK.d.mts.map +1 -0
  292. package/dist/yaml-q2k-BjIM.cjs +1 -0
  293. package/dist/yaml.cjs +1 -15
  294. package/dist/yaml.d.cts +2 -0
  295. package/dist/yaml.d.mts +2 -0
  296. package/dist/yaml.mjs +1 -1
  297. package/package.json +98 -379
  298. package/dist/compress.d.ts +0 -11
  299. package/dist/constants.d.ts +0 -1
  300. package/dist/get-parent-path.d.ts +0 -28
  301. package/dist/index.d.ts +0 -32
  302. package/dist/install.d.ts +0 -24
  303. package/dist/json.d.ts +0 -49
  304. package/dist/list-files.d.ts +0 -46
  305. package/dist/package-fns.d.ts +0 -89
  306. package/dist/remove-file.d.ts +0 -12
  307. package/dist/toml.d.ts +0 -77
  308. package/dist/tsconfig.d.ts +0 -8
  309. package/dist/write-file.d.ts +0 -30
  310. package/dist/yaml.d.ts +0 -18
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-fns-C7-MKgBR.mjs","names":[],"sources":["../../string-format/src/package.ts","../src/package-fns.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Check if a package name has a version\n *\n * @example\n * ```typescript\n * hasPackageVersion(\"lodash@4.17.21\");\n * // => true\n * hasPackageVersion(\"@stryke/core@4.17.21\");\n * // => true\n * hasPackageVersion(\"lodash\");\n * // => false\n * hasPackageVersion(\"@stryke/core\");\n * // => false\n * hasPackageVersion(\"lodash/module\");\n * // => false\n * hasPackageVersion(\"@stryke/core/module\");\n * // => false\n * hasPackageVersion(\"lodash/module@4.17.21\");\n * // => true\n * hasPackageVersion(\"@stryke/core/module@4.17.21\");\n * // => true\n * ```\n *\n * @param value - The package name with version\n * @returns Whether the package name has a version\n */\nexport function hasPackageVersion(value: string): boolean {\n return /^.[^\\n\\r@\\u2028\\u2029]*@.*$/.test(value);\n}\n\n/**\n * Remove the version from a package name (if it exists)\n *\n * @example\n * ```typescript\n * removePackageVersion(\"lodash@4.17.21\");\n * // => \"lodash\"\n * removePackageVersion(\"@stryke/core@4.17.21\");\n * // => \"@stryke/core\"\n * removePackageVersion(\"lodash\");\n * // => \"lodash\"\n * removePackageVersion(\"@stryke/core\");\n * // => \"@stryke/core\"\n * getPackageName(\"lodash/module\");\n * // => \"lodash/module\"\n * getPackageName(\"@stryke/core/module\");\n * // => \"@stryke/core/module\"\n * getPackageName(\"lodash/module@4.17.21\");\n * // => \"lodash/module\"\n * getPackageName(\"@stryke/core/module@4.17.21\");\n * // => \"@stryke/core/module\"\n * ```\n *\n * @param value - The package name with version\n * @returns The package name without version\n */\nexport function removePackageVersion(value: string) {\n return hasPackageVersion(value)\n ? value.substring(0, value.lastIndexOf(\"@\"))\n : value;\n}\n\n/**\n * Get the package name from a scoped package string\n *\n * @example\n * ```typescript\n * getPackageName(\"lodash@4.17.21\");\n * // => \"lodash\"\n * getPackageName(\"@stryke/core@4.17.21\");\n * // => \"@stryke/core\"\n * getPackageName(\"lodash\");\n * // => \"lodash\"\n * getPackageName(\"@stryke/core\");\n * // => \"@stryke/core\"\n * getPackageName(\"lodash/module\");\n * // => \"lodash\"\n * getPackageName(\"@stryke/core/module\");\n * // => \"@stryke/core\"\n * getPackageName(\"lodash/module@4.17.21\");\n * // => \"lodash\"\n * getPackageName(\"@stryke/core/module@4.17.21\");\n * // => \"@stryke/core\"\n * ```\n *\n * @param value - The scoped package string\n * @returns The package name without the scope\n */\nexport function getPackageName(value: string) {\n return /^[^\\n\\r/\\u2028\\u2029]*\\/.[^\\n\\r/\\u2028\\u2029]*\\/.*$/.test(value)\n ? value.substring(0, value.lastIndexOf(\"/\"))\n : removePackageVersion(value);\n}\n\n/**\n * Get the package version from a scoped package string\n *\n * @example\n * ```typescript\n * getPackageName(\"lodash@4.17.21\");\n * // => \"4.17.21\"\n * getPackageName(\"@stryke/core@4.17.21\");\n * // => \"4.17.21\"\n * getPackageName(\"lodash\");\n * // => undefined\n * getPackageName(\"@stryke/core\");\n * // => undefined\n * getPackageName(\"lodash/module\");\n * // => undefined\n * getPackageName(\"@stryke/core/module\");\n * // => undefined\n * getPackageName(\"lodash/module@4.17.21\");\n * // => \"4.17.21\"\n * getPackageName(\"@stryke/core/module@4.17.21\");\n * // => \"4.17.21\"\n * ```\n *\n * @param value - The scoped package string\n * @returns The package version without the package name if it exists. If not, returns undefined.\n */\nexport function getPackageVersion(value: string): string | undefined {\n return hasPackageVersion(value) ? value.replace(/^.+@/, \"\") : undefined;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { findFileName, findFilePath } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { getPackageName } from \"@stryke/string-format/package\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type { PackageJson } from \"@stryke/types/package-json\";\nimport type { PackageManager } from \"@stryke/types/package-manager\";\nimport { existsSync } from \"node:fs\";\nimport type { Range } from \"semver\";\nimport { subset } from \"semver\";\nimport { exists } from \"./exists\";\nimport { getParentPath } from \"./get-parent-path\";\nimport { getWorkspaceRoot } from \"./get-workspace-root\";\nimport { readJsonFile } from \"./json\";\nimport type { ResolveOptions } from \"./resolve\";\nimport { resolvePackage } from \"./resolve\";\n\n/**\n * Get the package manager used in the project\n *\n * @param dir - The path to the project\n * @returns The package manager used in the project\n */\nexport function getPackageManager(dir = getWorkspaceRoot()): PackageManager {\n const lockFile = getParentPath(\n [\"package-lock.json\", \"yarn.lock\", \"pnpm-lock.yaml\", \"bun.lock\"],\n dir,\n {\n includeNameInResults: true\n }\n );\n\n if (!lockFile) {\n // default use pnpm\n return \"pnpm\";\n }\n\n switch (findFileName(lockFile)) {\n case \"yarn.lock\": {\n return \"yarn\";\n }\n case \"pnpm-lock.yaml\": {\n return \"pnpm\";\n }\n case \"bun.lock\": {\n return \"bun\";\n }\n default: {\n return \"npm\";\n }\n }\n}\n\n// Much of the below code comes from https://github.com/antfu-collective/local-pkg with some modifications\n\nasync function searchPackageJson(dir: string) {\n let packageJsonPath;\n\n while (true) {\n if (!dir) {\n return;\n }\n const newDir = findFilePath(dir);\n\n if (newDir === dir) {\n return;\n }\n\n dir = newDir;\n packageJsonPath = joinPaths(dir, \"package.json\");\n\n if (await exists(packageJsonPath)) {\n break;\n }\n }\n\n return packageJsonPath;\n}\n\nasync function getPackageJsonPath(name: string, options: ResolveOptions = {}) {\n const entry = await resolvePackage(name, options);\n if (!entry) {\n return;\n }\n\n return searchPackageJson(entry);\n}\n\n/**\n * Get package info\n *\n * @param name - The name of the package\n * @param options - The options to use when resolving the package\n * @returns The package info\n */\nexport async function getPackageInfo(\n name: string,\n options: ResolveOptions = {}\n) {\n const packageJsonPath = await getPackageJsonPath(name, options);\n if (!packageJsonPath) {\n return;\n }\n\n const packageJson = await readJsonFile<PackageJson>(packageJsonPath);\n\n return {\n name,\n version: packageJson.version,\n rootPath: findFilePath(packageJsonPath),\n packageJsonPath,\n packageJson\n };\n}\n\n/**\n * Get the package info from the package.json file\n *\n * @param cwd - The current working directory\n * @returns The package info\n */\nexport async function loadPackageJson(\n cwd = getWorkspaceRoot()\n): Promise<PackageJson | null> {\n const path = getParentPath(\"package.json\", cwd, {\n skipCwd: false,\n includeNameInResults: true\n });\n if (!path || !existsSync(path)) {\n return null;\n }\n\n return readJsonFile<PackageJson>(path);\n}\n\nexport interface PackageExistsOptions {\n /**\n * The current working directory\n */\n cwd?: string;\n}\n\nexport interface PackageMatchesOptions extends PackageExistsOptions {\n /**\n * The version range of the package to check\n */\n version?: string | Range;\n}\n\n/**\n * Check if a package is listed in the package.json file\n *\n * @param name - The name of the package\n * @param cwd - The current working directory\n * @returns An indicator specifying if the package is listed\n */\nexport async function isPackageListed(\n name: string,\n cwd?: string\n): Promise<boolean>;\n\n/**\n * Check if a package is listed in the package.json file\n *\n * @param name - The name of the package\n * @param options - The options to use when checking if the package is listed\n * @returns An indicator specifying if the package is listed\n */\nexport async function isPackageListed(\n name: string,\n options?: PackageExistsOptions\n): Promise<boolean>;\n\n/**\n * Check if a package is listed in the package.json file\n *\n * @param name - The name of the package\n * @param cwdOrOptions - The current working directory or options to use when checking if the package is listed\n * @returns An indicator specifying if the package is listed\n */\nexport async function isPackageListed(\n name: string,\n cwdOrOptions?: string | PackageExistsOptions\n): Promise<boolean> {\n const packageName = getPackageName(name);\n const cwd = isString(cwdOrOptions) ? cwdOrOptions : cwdOrOptions?.cwd;\n\n const packageJson = await loadPackageJson(cwd);\n if (!packageJson) {\n return false;\n }\n\n return Boolean(\n (packageJson.dependencies &&\n packageName in packageJson.dependencies &&\n packageJson.dependencies[packageName]) ||\n (packageJson.devDependencies &&\n packageName in packageJson.devDependencies &&\n packageJson.devDependencies[packageName])\n );\n}\n\nexport interface GetPackageListingReturn {\n version: string;\n type: \"dependencies\" | \"devDependencies\";\n}\n\n/**\n * Return the package version and dependency type listed in the package.json file\n *\n * @param name - The name of the package\n * @param cwdOrOptions - The current working directory or options to use when checking if the package is listed\n * @returns The version and type of the package if listed, otherwise undefined\n */\nexport async function getPackageListing(\n name: string,\n cwdOrOptions?: string | PackageExistsOptions\n): Promise<GetPackageListingReturn | undefined> {\n const packageName = getPackageName(name);\n const cwd = isString(cwdOrOptions) ? cwdOrOptions : cwdOrOptions?.cwd;\n\n const packageJson = await loadPackageJson(cwd);\n if (!packageJson) {\n return undefined;\n }\n\n const version =\n packageJson.dependencies && packageName in packageJson.dependencies\n ? packageJson.dependencies[packageName]\n : packageJson.devDependencies &&\n packageName in packageJson.devDependencies\n ? packageJson.devDependencies[packageName]\n : undefined;\n const type =\n (packageJson.dependencies && packageName in packageJson.dependencies\n ? \"dependencies\"\n : packageJson.devDependencies &&\n packageName in packageJson.devDependencies\n ? \"devDependencies\"\n : undefined) || undefined;\n\n return version && type\n ? {\n version,\n type\n }\n : undefined;\n}\n\n/**\n * Check if a package version matches a specific version range\n *\n * @param name - The name of the package\n * @param version - The version to check against\n * @param cwd - The current working directory\n * @returns An indicator specifying if the package version matches the range\n */\nexport async function doesPackageMatch(\n name: string,\n version: string,\n cwd?: string\n): Promise<boolean> {\n const pkg = await getPackageListing(name, { cwd });\n if (!pkg) {\n return false;\n }\n\n return (\n pkg.version.startsWith(\"catalog:\") ||\n pkg.version.startsWith(\"workspace:\") ||\n subset(pkg.version, version)\n );\n}\n\n/**\n * Check if a package exists\n *\n * @param name - The name of the package\n * @param options - The options to use when resolving the package\n * @returns An indicator specifying if the package exists\n */\nexport function isPackageExists(name: string, options: ResolveOptions = {}) {\n return Boolean(resolvePackage(name, options));\n}\n"],"mappings":"obA4CA,SAAgB,EAAkB,EAAwB,CACxD,MAAO,8BAA8B,KAAK,EAAM,CA6BlD,SAAgB,EAAqB,EAAe,CAClD,OAAO,EAAkB,EAAM,CAC3B,EAAM,UAAU,EAAG,EAAM,YAAY,IAAI,CAAC,CAC1C,EA6BN,SAAgB,EAAe,EAAe,CAC5C,MAAO,sDAAsD,KAAK,EAAM,CACpE,EAAM,UAAU,EAAG,EAAM,YAAY,IAAI,CAAC,CAC1C,EAAqB,EAAM,CCrEjC,SAAgB,EAAkB,EAAM,GAAkB,CAAkB,CAC1E,IAAM,EAAW,EACf,CAAC,oBAAqB,YAAa,iBAAkB,WAAW,CAChE,EACA,CACE,qBAAsB,GACvB,CACF,CAED,GAAI,CAAC,EAEH,MAAO,OAGT,OAAQ,EAAa,EAAS,CAA9B,CACE,IAAK,YACH,MAAO,OAET,IAAK,iBACH,MAAO,OAET,IAAK,WACH,MAAO,MAET,QACE,MAAO,OAOb,eAAe,EAAkB,EAAa,CAC5C,IAAI,EAEJ,OAAa,CACX,GAAI,CAAC,EACH,OAEF,IAAM,EAAS,EAAa,EAAI,CAEhC,GAAI,IAAW,EACb,OAMF,GAHA,EAAM,EACN,EAAkB,EAAU,EAAK,eAAe,CAE5C,MAAM,EAAO,EAAgB,CAC/B,MAIJ,OAAO,EAGT,eAAe,EAAmB,EAAc,EAA0B,EAAE,CAAE,CAC5E,IAAM,EAAQ,MAAM,EAAe,EAAM,EAAQ,CAC5C,KAIL,OAAO,EAAkB,EAAM,CAUjC,eAAsB,EACpB,EACA,EAA0B,EAAE,CAC5B,CACA,IAAM,EAAkB,MAAM,EAAmB,EAAM,EAAQ,CAC/D,GAAI,CAAC,EACH,OAGF,IAAM,EAAc,MAAM,EAA0B,EAAgB,CAEpE,MAAO,CACL,OACA,QAAS,EAAY,QACrB,SAAU,EAAa,EAAgB,CACvC,kBACA,cACD,CASH,eAAsB,EACpB,EAAM,GAAkB,CACK,CAC7B,IAAM,EAAO,EAAc,eAAgB,EAAK,CAC9C,QAAS,GACT,qBAAsB,GACvB,CAAC,CAKF,MAJI,CAAC,GAAQ,CAAC,EAAW,EAAK,CACrB,KAGF,EAA0B,EAAK,CAgDxC,eAAsB,EACpB,EACA,EACkB,CAClB,IAAM,EAAc,EAAe,EAAK,CAGlC,EAAc,MAAM,EAFd,EAAS,EAAa,CAAG,EAAe,GAAc,IAEpB,CAK9C,OAJK,EAIE,GACJ,EAAY,cACX,KAAe,EAAY,cAC3B,EAAY,aAAa,IAC1B,EAAY,iBACX,KAAe,EAAY,iBAC3B,EAAY,gBAAgB,IATvB,GAyBX,eAAsB,EACpB,EACA,EAC8C,CAC9C,IAAM,EAAc,EAAe,EAAK,CAGlC,EAAc,MAAM,EAFd,EAAS,EAAa,CAAG,EAAe,GAAc,IAEpB,CAC9C,GAAI,CAAC,EACH,OAGF,IAAM,EACJ,EAAY,cAAgB,KAAe,EAAY,aACnD,EAAY,aAAa,GACzB,EAAY,iBACV,KAAe,EAAY,gBAC3B,EAAY,gBAAgB,GAC5B,IAAA,GACF,GACH,EAAY,cAAgB,KAAe,EAAY,aACpD,eACA,EAAY,iBACV,KAAe,EAAY,gBAC3B,kBACA,IAAA,KAAc,IAAA,GAEtB,OAAO,GAAW,EACd,CACE,UACA,OACD,CACD,IAAA,GAWN,eAAsB,EACpB,EACA,EACA,EACkB,CAClB,IAAM,EAAM,MAAM,EAAkB,EAAM,CAAE,MAAK,CAAC,CAKlD,OAJK,EAKH,EAAI,QAAQ,WAAW,WAAW,EAClC,EAAI,QAAQ,WAAW,aAAa,EACpC,EAAO,EAAI,QAAS,EAAQ,CANrB,GAiBX,SAAgB,EAAgB,EAAc,EAA0B,EAAE,CAAE,CAC1E,MAAO,EAAQ,EAAe,EAAM,EAAQ"}
@@ -0,0 +1,354 @@
1
+ import { n as ResolveOptions } from "./resolve-D66oIwjf.mjs";
2
+ import { Range } from "semver";
3
+
4
+ //#region ../types/src/package-json.d.ts
5
+ /**
6
+ * The `package.json` file is the only required file in a package. It must be located at the root of a package, and can contain the following fields.
7
+ */
8
+ interface PackageJson extends Record<string, any> {
9
+ /**
10
+ * The name is what your thing is called.
11
+ * Some rules:
12
+ * - The name must be less than or equal to 214 characters. This includes the scope for scoped packages.
13
+ * - The name can’t start with a dot or an underscore.
14
+ * - New packages must not have uppercase letters in the name.
15
+ * - The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can’t contain any non-URL-safe characters.
16
+ */
17
+ name?: string;
18
+ /**
19
+ * Version must be parseable by `node-semver`, which is bundled with npm as a dependency. (`npm install semver` to use it yourself.)
20
+ */
21
+ version?: string;
22
+ /**
23
+ * Put a description in it. It’s a string. This helps people discover your package, as it’s listed in `npm search`.
24
+ */
25
+ description?: string;
26
+ /**
27
+ * Put keywords in it. It’s an array of strings. This helps people discover your package as it’s listed in `npm search`.
28
+ */
29
+ keywords?: string[];
30
+ /**
31
+ * The url to the project homepage.
32
+ */
33
+ homepage?: string;
34
+ /**
35
+ * The url to your project’s issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package.
36
+ */
37
+ bugs?: string | {
38
+ url?: string;
39
+ email?: string;
40
+ };
41
+ /**
42
+ * You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you’re placing on it.
43
+ */
44
+ license?: string;
45
+ /**
46
+ * Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the `npm docs` command will be able to find you.
47
+ * For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install:
48
+ */
49
+ repository?: string | {
50
+ type: string;
51
+ url: string;
52
+ /**
53
+ * If the `package.json` for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives:
54
+ */
55
+ directory?: string;
56
+ };
57
+ /**
58
+ * The `scripts` field is a dictionary containing script commands that are run at various times in the lifecycle of your package.
59
+ */
60
+ scripts?: Record<string, string>;
61
+ /**
62
+ * If you set `"private": true` in your package.json, then npm will refuse to publish it.
63
+ */
64
+ private?: boolean;
65
+ /**
66
+ * The “author” is one person.
67
+ */
68
+ author?: PackageJsonPerson;
69
+ /**
70
+ * “contributors” is an array of people.
71
+ */
72
+ contributors?: PackageJsonPerson[];
73
+ /**
74
+ * The optional `files` field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to `.gitignore`, but reversed: including a file, directory, or glob pattern (`*`, `**\/*`, and such) will make it so that file is included in the tarball when it’s packed. Omitting the field will make it default to `["*"]`, which means it will include all files.
75
+ */
76
+ files?: string[];
77
+ /**
78
+ * The main field is a module ID that is the primary entry point to your program. That is, if your package is named `foo`, and a user installs it, and then does `require("foo")`, then your main module’s exports object will be returned.
79
+ * This should be a module ID relative to the root of your package folder.
80
+ * For most modules, it makes the most sense to have a main script and often not much else.
81
+ */
82
+ main?: string;
83
+ /**
84
+ * If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren’t available in Node.js modules. (e.g. window)
85
+ */
86
+ browser?: string | Record<string, string | false>;
87
+ /**
88
+ * The `unpkg` field is used to specify the URL to a UMD module for your package. This is used by default in the unpkg.com CDN service.
89
+ */
90
+ unpkg?: string;
91
+ /**
92
+ * A map of command name to local file name. On install, npm will symlink that file into `prefix/bin` for global installs, or `./node_modules/.bin/` for local installs.
93
+ */
94
+ bin?: string | Record<string, string>;
95
+ /**
96
+ * Specify either a single file or an array of filenames to put in place for the `man` program to find.
97
+ */
98
+ man?: string | string[];
99
+ /**
100
+ * Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL.
101
+ */
102
+ dependencies?: Record<string, string>;
103
+ /**
104
+ * If someone is planning on downloading and using your module in their program, then they probably don’t want or need to download and build the external test or documentation framework that you use.
105
+ * In this case, it’s best to map these additional items in a `devDependencies` object.
106
+ */
107
+ devDependencies?: Record<string, string>;
108
+ /**
109
+ * If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the `optionalDependencies` object. This is a map of package name to version or url, just like the `dependencies` object. The difference is that build failures do not cause installation to fail.
110
+ */
111
+ optionalDependencies?: Record<string, string>;
112
+ /**
113
+ * In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a `require` of this host. This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation.
114
+ */
115
+ peerDependencies?: Record<string, string>;
116
+ /**
117
+ * TypeScript typings, typically ending by `.d.ts`.
118
+ */
119
+ types?: string;
120
+ /**
121
+ * This field is synonymous with `types`.
122
+ */
123
+ typings?: string;
124
+ /**
125
+ * Non-Standard Node.js alternate entry-point to main.
126
+ * An initial implementation for supporting CJS packages (from main), and use module for ESM modules.
127
+ */
128
+ module?: string;
129
+ /**
130
+ * Make main entry-point be loaded as an ESM module, support "export" syntax instead of "require"
131
+ *
132
+ * Docs:
133
+ * - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_package_json_type_field
134
+ *
135
+ * @defaultValue 'commonjs'
136
+ */
137
+ type?: "module" | "commonjs";
138
+ /**
139
+ * Alternate and extensible alternative to "main" entry point.
140
+ *
141
+ * When using `{type: "module"}`, any ESM module file MUST end with `.mjs` extension.
142
+ *
143
+ * Docs:
144
+ * - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_exports_sugar
145
+ */
146
+ exports?: PackageJsonExports;
147
+ /**
148
+ * Docs:
149
+ * - https://nodejs.org/api/packages.html#imports
150
+ */
151
+ imports?: Record<string, string | Record<string, string>>;
152
+ /**
153
+ * The field is used to define a set of sub-packages (or workspaces) within a monorepo.
154
+ *
155
+ * This field is an array of glob patterns or an object with specific configurations for managing
156
+ * multiple packages in a single repository.
157
+ */
158
+ workspaces?: string[];
159
+ /**
160
+ * The field is is used to specify different TypeScript declaration files for
161
+ * different versions of TypeScript, allowing for version-specific type definitions.
162
+ */
163
+ typesVersions?: Record<string, Record<string, string[]>>;
164
+ /**
165
+ * You can specify which operating systems your module will run on:
166
+ * ```json
167
+ * {
168
+ * "os": ["darwin", "linux"]
169
+ * }
170
+ * ```
171
+ * You can also block instead of allowing operating systems, just prepend the blocked os with a '!':
172
+ * ```json
173
+ * {
174
+ * "os": ["!win32"]
175
+ * }
176
+ * ```
177
+ * The host operating system is determined by `process.platform`
178
+ * It is allowed to both block and allow an item, although there isn't any good reason to do this.
179
+ */
180
+ os?: string[];
181
+ /**
182
+ * If your code only runs on certain cpu architectures, you can specify which ones.
183
+ * ```json
184
+ * {
185
+ * "cpu": ["x64", "ia32"]
186
+ * }
187
+ * ```
188
+ * Like the `os` option, you can also block architectures:
189
+ * ```json
190
+ * {
191
+ * "cpu": ["!arm", "!mips"]
192
+ * }
193
+ * ```
194
+ * The host architecture is determined by `process.arch`
195
+ */
196
+ cpu?: string[];
197
+ /**
198
+ * This is a set of config values that will be used at publish-time.
199
+ */
200
+ publishConfig?: {
201
+ /**
202
+ * The registry that will be used if the package is published.
203
+ */
204
+ registry?: string;
205
+ /**
206
+ * The tag that will be used if the package is published.
207
+ */
208
+ tag?: string;
209
+ /**
210
+ * The access level that will be used if the package is published.
211
+ */
212
+ access?: "public" | "restricted";
213
+ /**
214
+ * **pnpm-only**
215
+ *
216
+ * By default, for portability reasons, no files except those listed in
217
+ * the bin field will be marked as executable in the resulting package
218
+ * archive. The executableFiles field lets you declare additional fields
219
+ * that must have the executable flag (+x) set even if
220
+ * they aren't directly accessible through the bin field.
221
+ */
222
+ executableFiles?: string[];
223
+ /**
224
+ * **pnpm-only**
225
+ *
226
+ * You also can use the field `publishConfig.directory` to customize
227
+ * the published subdirectory relative to the current `package.json`.
228
+ *
229
+ * It is expected to have a modified version of the current package in
230
+ * the specified directory (usually using third party build tools).
231
+ */
232
+ directory?: string;
233
+ /**
234
+ * **pnpm-only**
235
+ *
236
+ * When set to `true`, the project will be symlinked from the
237
+ * `publishConfig.directory` location during local development.
238
+ *
239
+ * @defaultValue true
240
+ */
241
+ linkDirectory?: boolean;
242
+ } & Pick<PackageJson, "bin" | "main" | "exports" | "types" | "typings" | "module" | "browser" | "unpkg" | "typesVersions" | "os" | "cpu">;
243
+ /**
244
+ * See: https://nodejs.org/api/packages.html#packagemanager
245
+ * This field defines which package manager is expected to be used when working on the current project.
246
+ * Should be of the format: `<name>@<version>[#hash]`
247
+ */
248
+ packageManager?: string;
249
+ [key: string]: any;
250
+ }
251
+ /**
252
+ * A “person” is an object with a “name” field and optionally “url” and “email”. Or you can shorten that all into a single string, and npm will parse it for you.
253
+ */
254
+ type PackageJsonPerson = string | {
255
+ name: string;
256
+ email?: string;
257
+ url?: string;
258
+ };
259
+ type PackageJsonExportKey = "." | "import" | "require" | "types" | "node" | "browser" | "default" | (string & {});
260
+ type PackageJsonExportsObject = { [P in PackageJsonExportKey]?: string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject> };
261
+ type PackageJsonExports = string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>;
262
+ //#endregion
263
+ //#region ../types/src/package-manager.d.ts
264
+ type PackageManager = "npm" | "yarn" | "pnpm" | "bun";
265
+ //#endregion
266
+ //#region src/package-fns.d.ts
267
+ /**
268
+ * Get the package manager used in the project
269
+ *
270
+ * @param dir - The path to the project
271
+ * @returns The package manager used in the project
272
+ */
273
+ declare function getPackageManager(dir?: string): PackageManager;
274
+ /**
275
+ * Get package info
276
+ *
277
+ * @param name - The name of the package
278
+ * @param options - The options to use when resolving the package
279
+ * @returns The package info
280
+ */
281
+ declare function getPackageInfo(name: string, options?: ResolveOptions): Promise<{
282
+ name: string;
283
+ version: string | undefined;
284
+ rootPath: string;
285
+ packageJsonPath: string;
286
+ packageJson: PackageJson;
287
+ } | undefined>;
288
+ /**
289
+ * Get the package info from the package.json file
290
+ *
291
+ * @param cwd - The current working directory
292
+ * @returns The package info
293
+ */
294
+ declare function loadPackageJson(cwd?: string): Promise<PackageJson | null>;
295
+ interface PackageExistsOptions {
296
+ /**
297
+ * The current working directory
298
+ */
299
+ cwd?: string;
300
+ }
301
+ interface PackageMatchesOptions extends PackageExistsOptions {
302
+ /**
303
+ * The version range of the package to check
304
+ */
305
+ version?: string | Range;
306
+ }
307
+ /**
308
+ * Check if a package is listed in the package.json file
309
+ *
310
+ * @param name - The name of the package
311
+ * @param cwd - The current working directory
312
+ * @returns An indicator specifying if the package is listed
313
+ */
314
+ declare function isPackageListed(name: string, cwd?: string): Promise<boolean>;
315
+ /**
316
+ * Check if a package is listed in the package.json file
317
+ *
318
+ * @param name - The name of the package
319
+ * @param options - The options to use when checking if the package is listed
320
+ * @returns An indicator specifying if the package is listed
321
+ */
322
+ declare function isPackageListed(name: string, options?: PackageExistsOptions): Promise<boolean>;
323
+ interface GetPackageListingReturn {
324
+ version: string;
325
+ type: "dependencies" | "devDependencies";
326
+ }
327
+ /**
328
+ * Return the package version and dependency type listed in the package.json file
329
+ *
330
+ * @param name - The name of the package
331
+ * @param cwdOrOptions - The current working directory or options to use when checking if the package is listed
332
+ * @returns The version and type of the package if listed, otherwise undefined
333
+ */
334
+ declare function getPackageListing(name: string, cwdOrOptions?: string | PackageExistsOptions): Promise<GetPackageListingReturn | undefined>;
335
+ /**
336
+ * Check if a package version matches a specific version range
337
+ *
338
+ * @param name - The name of the package
339
+ * @param version - The version to check against
340
+ * @param cwd - The current working directory
341
+ * @returns An indicator specifying if the package version matches the range
342
+ */
343
+ declare function doesPackageMatch(name: string, version: string, cwd?: string): Promise<boolean>;
344
+ /**
345
+ * Check if a package exists
346
+ *
347
+ * @param name - The name of the package
348
+ * @param options - The options to use when resolving the package
349
+ * @returns An indicator specifying if the package exists
350
+ */
351
+ declare function isPackageExists(name: string, options?: ResolveOptions): boolean;
352
+ //#endregion
353
+ export { getPackageInfo as a, isPackageExists as c, doesPackageMatch as i, isPackageListed as l, PackageExistsOptions as n, getPackageListing as o, PackageMatchesOptions as r, getPackageManager as s, GetPackageListingReturn as t, loadPackageJson as u };
354
+ //# sourceMappingURL=package-fns-CxokaGDY.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-fns-CxokaGDY.d.mts","names":[],"sources":["../../types/src/package-json.ts","../../types/src/package-manager.ts","../src/package-fns.ts"],"sourcesContent":[],"mappings":";;;;;;;UAqBiB,WAAA,SAAoB;EAApB;;;;;;;;EA2GQ,IAAA,CAAA,EAAA,MAAA;EAIJ;;;EAoCT,OAAA,CAAA,EAAA,MAAA;EAYqB;;;EA+E3B,WAAA,CAAA,EAAA,MAAA;EA9O+B;;AAoQpC;EAaI,QAAA,CAAA,EAAA,MAAA,EAAA;EAUA;;;EAIgB,QAAA,CAAA,EAAA,MAAA;EAAf;;AAAK;EAKP,IAAA,CAAA,EAAA,MAAA,GAAA;IACe,GAAA,CAAA,EAAA,MAAA;IAAf,KAAA,CAAA,EAAA,MAAA;EAAK,CAAA;;;;ECxSG,OAAA,CAAA,EAAA,MAAA;;;;ACsBZ;EAwEsB,UAAA,CAAA,EAAA,MAAc,GAAA;IAEzB,IAAA,EAAA,MAAA;;IAAmB;;AAwB9B;IAciB,SAAA,CAAA,EAAA,MAAA;EAOA,CAAA;EAcK;AAYtB;AAkCA;EAYsB,OAAA,CAAA,EF1JV,ME0JU,CAAA,MAAiB,EAAA,MAAA,CAAA;EAEb;;;EAChB,OAAA,CAAA,EAAA,OAAA;EAwCY;AAwBtB;;WFrNW;;;;iBAIM;;;;;;;;;;;;;;qBAcI;;;;;;;;iBAQJ;;;;;;;;iBAQA;;;;;oBAKG;;;;yBAIK;;;;qBAIJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA+BT;;;;;YAKA,wBAAwB;;;;;;;;;;;;kBAYlB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+E3B,KACF;;;;;;;;;;;;KA0BC,iBAAA;;;;;KAQA,oBAAA;KAUA,wBAAA,WACG,iCAEF,2BACA,eAAe;KAGhB,kBAAA,YAED,2BACA,eAAe;;;KCxSP,cAAA;;;ADGZ;;;;;;AAkGiB,iBE/ED,iBAAA,CF+EC,GAAA,CAAA,EAAA,MAAA,CAAA,EE/E4C,cF+E5C;;;;;;;;AA6DC,iBEpEI,cAAA,CFoEJ,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EElEP,cFkEO,CAAA,EElEY,OFkEZ,CAAA;EAgFd,IAAA,EAAA,MAAA;EADE,OAAA,EAAA,MAAA,GAAA,SAAA;EA9O+B,QAAA,EAAA,MAAA;EAAM,eAAA,EAAA,MAAA;EAyQtC,WAAA,aAAiB;AAAA,CAAA,GAQjB,SAAA,CAAA;AAAoB;;;;;;AAiBpB,iBE7KiB,eAAA,CF6KC,GAAA,CAAA,EAAA,MAAA,CAAA,EE3KpB,OF2KoB,CE3KZ,WF2KY,GAAA,IAAA,CAAA;AAEnB,UEjKa,oBAAA,CFiKb;EACe;;;;;UE3JF,qBAAA,SAA8B;ED7InC;;;qBCiJS;AA3HrB;AAwEA;;;;;AA0BA;AAcA;AAOiB,iBAcK,eAAA,CAVD,IAAA,EAAA,MAJ0B,EAAA,GAAA,CAAA,EAAA,MAAA,CAAA,EAiB5C,OAjBgE,CAAA,OAAA,CAAA;AAcnE;AAYA;AAkCA;AAYA;;;;AAGU,iBAjDY,eAAA,CAiDZ,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EA/CE,oBA+CF,CAAA,EA9CP,OA8CO,CAAA,OAAA,CAAA;AAwCY,UAvDL,uBAAA,CA2Dd;EAoBa,OAAA,EAAA,MAAA;;;;;;;;;;iBAnEM,iBAAA,uCAEI,uBACvB,QAAQ;;;;;;;;;iBAwCW,gBAAA,+CAInB;;;;;;;;iBAoBa,eAAA,yBAAuC"}
@@ -0,0 +1 @@
1
+ const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./join-paths-DUdaieID.cjs`),n=require(`./file-path-fns-7aKacdLg.cjs`),r=require(`./is-string-DKgNS0jA.cjs`),i=require(`./get-workspace-root-CCNjjZGY.cjs`),a=require(`./exists-B31lSRFp.cjs`),o=require(`./get-parent-path-CfRkaB4R.cjs`),s=require(`./resolve-DTkLQekH.cjs`),c=require(`./json-DKhqPjHB.cjs`);let l=require(`node:fs`),u=require(`semver`);function d(e){return/^.[^\n\r@\u2028\u2029]*@.*$/.test(e)}function f(e){return d(e)?e.substring(0,e.lastIndexOf(`@`)):e}function p(e){return/^[^\n\r/\u2028\u2029]*\/.[^\n\r/\u2028\u2029]*\/.*$/.test(e)?e.substring(0,e.lastIndexOf(`/`)):f(e)}function m(e=i.i()){let t=o.t([`package-lock.json`,`yarn.lock`,`pnpm-lock.yaml`,`bun.lock`],e,{includeNameInResults:!0});if(!t)return`pnpm`;switch(n.n(t)){case`yarn.lock`:return`yarn`;case`pnpm-lock.yaml`:return`pnpm`;case`bun.lock`:return`bun`;default:return`npm`}}async function h(e){let r;for(;;){if(!e)return;let i=n.r(e);if(i===e)return;if(e=i,r=t.t(e,`package.json`),await a.t(r))break}return r}async function g(e,t={}){let n=await s.s(e,t);if(n)return h(n)}async function _(e,t={}){let r=await g(e,t);if(!r)return;let i=await c.t(r);return{name:e,version:i.version,rootPath:n.r(r),packageJsonPath:r,packageJson:i}}async function v(e=i.i()){let t=o.t(`package.json`,e,{skipCwd:!1,includeNameInResults:!0});return!t||!(0,l.existsSync)(t)?null:c.t(t)}async function y(e,t){let n=p(e),i=await v(r.t(t)?t:t?.cwd);return i?!!(i.dependencies&&n in i.dependencies&&i.dependencies[n]||i.devDependencies&&n in i.devDependencies&&i.devDependencies[n]):!1}async function b(e,t){let n=p(e),i=await v(r.t(t)?t:t?.cwd);if(!i)return;let a=i.dependencies&&n in i.dependencies?i.dependencies[n]:i.devDependencies&&n in i.devDependencies?i.devDependencies[n]:void 0,o=(i.dependencies&&n in i.dependencies?`dependencies`:i.devDependencies&&n in i.devDependencies?`devDependencies`:void 0)||void 0;return a&&o?{version:a,type:o}:void 0}async function x(e,t,n){let r=await b(e,{cwd:n});return r?r.version.startsWith(`catalog:`)||r.version.startsWith(`workspace:`)||(0,u.subset)(r.version,t):!1}function S(e,t={}){return!!s.s(e,t)}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return x}});
@@ -1,99 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.doesPackageMatch = doesPackageMatch;
7
- exports.getPackageInfo = getPackageInfo;
8
- exports.getPackageListing = getPackageListing;
9
- exports.getPackageManager = getPackageManager;
10
- exports.isPackageExists = isPackageExists;
11
- exports.isPackageListed = isPackageListed;
12
- exports.loadPackageJson = loadPackageJson;
13
- var _filePathFns = require("@stryke/path/file-path-fns");
14
- var _joinPaths = require("@stryke/path/join-paths");
15
- var _package = require("@stryke/string-format/package");
16
- var _isString = require("@stryke/type-checks/is-string");
17
- var _nodeFs = require("node:fs");
18
- var _semver = require("semver");
19
- var _exists = require("./exists.cjs");
20
- var _getParentPath = require("./get-parent-path.cjs");
21
- var _getWorkspaceRoot = require("./get-workspace-root.cjs");
22
- var _json = require("./json.cjs");
23
- var _resolve = require("./resolve.cjs");
24
- function getPackageManager(t = (0, _getWorkspaceRoot.getWorkspaceRoot)()) {
25
- const e = (0, _getParentPath.getParentPath)(["package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lock"], t, {
26
- includeNameInResults: !0
27
- });
28
- if (!e) return "pnpm";
29
- switch ((0, _filePathFns.findFileName)(e)) {
30
- case "yarn.lock":
31
- return "yarn";
32
- case "pnpm-lock.yaml":
33
- return "pnpm";
34
- case "bun.lock":
35
- return "bun";
36
- default:
37
- return "npm";
38
- }
39
- }
40
- async function v(t) {
41
- let e;
42
- for (;;) {
43
- if (!t) return;
44
- const n = (0, _filePathFns.findFilePath)(t);
45
- if (n === t) return;
46
- if (t = n, e = (0, _joinPaths.joinPaths)(t, "package.json"), await (0, _exists.exists)(e)) break;
47
- }
48
- return e;
49
- }
50
- async function x(t, e = {}) {
51
- const n = await (0, _resolve.resolvePackage)(t, e);
52
- if (n) return v(n);
53
- }
54
- async function getPackageInfo(t, e = {}) {
55
- const n = await x(t, e);
56
- if (!n) return;
57
- const a = await (0, _json.readJsonFile)(n);
58
- return {
59
- name: t,
60
- version: a.version,
61
- rootPath: (0, _filePathFns.findFilePath)(n),
62
- packageJsonPath: n,
63
- packageJson: a
64
- };
65
- }
66
- async function loadPackageJson(t = (0, _getWorkspaceRoot.getWorkspaceRoot)()) {
67
- const e = (0, _getParentPath.getParentPath)("package.json", t, {
68
- skipCwd: !1,
69
- includeNameInResults: !0
70
- });
71
- return !e || !(0, _nodeFs.existsSync)(e) ? null : (0, _json.readJsonFile)(e);
72
- }
73
- async function isPackageListed(t, e) {
74
- const n = (0, _package.getPackageName)(t),
75
- a = (0, _isString.isString)(e) ? e : e?.cwd,
76
- s = await loadPackageJson(a);
77
- return s ? !!(s.dependencies && n in s.dependencies && s.dependencies[n] || s.devDependencies && n in s.devDependencies && s.devDependencies[n]) : !1;
78
- }
79
- async function getPackageListing(t, e) {
80
- const n = (0, _package.getPackageName)(t),
81
- a = (0, _isString.isString)(e) ? e : e?.cwd,
82
- s = await loadPackageJson(a);
83
- if (!s) return;
84
- const i = s.dependencies && n in s.dependencies ? s.dependencies[n] : s.devDependencies && n in s.devDependencies ? s.devDependencies[n] : void 0,
85
- o = (s.dependencies && n in s.dependencies ? "dependencies" : s.devDependencies && n in s.devDependencies ? "devDependencies" : void 0) || void 0;
86
- return i && o ? {
87
- version: i,
88
- type: o
89
- } : void 0;
90
- }
91
- async function doesPackageMatch(t, e, n) {
92
- const a = await getPackageListing(t, {
93
- cwd: n
94
- });
95
- return a ? a.version.startsWith("catalog:") || a.version.startsWith("workspace:") || (0, _semver.subset)(a.version, e) : !1;
96
- }
97
- function isPackageExists(t, e = {}) {
98
- return !!(0, _resolve.resolvePackage)(t, e);
99
- }
1
+ require(`./get-workspace-root-CCNjjZGY.cjs`),require(`./helpers-_MJ6PR-g.cjs`),require(`./write-file-CqokudVp.cjs`),require(`./resolve-DTkLQekH.cjs`),require(`./json-DKhqPjHB.cjs`);const e=require(`./package-fns-YTCdMAXr.cjs`);exports.doesPackageMatch=e.t,exports.getPackageInfo=e.n,exports.getPackageListing=e.r,exports.getPackageManager=e.i,exports.isPackageExists=e.a,exports.isPackageListed=e.o,exports.loadPackageJson=e.s;
@@ -0,0 +1,2 @@
1
+ import { a as getPackageInfo, c as isPackageExists, i as doesPackageMatch, l as isPackageListed, n as PackageExistsOptions, o as getPackageListing, r as PackageMatchesOptions, s as getPackageManager, t as GetPackageListingReturn, u as loadPackageJson } from "./package-fns-BNRi_Rpc.cjs";
2
+ export { GetPackageListingReturn, PackageExistsOptions, PackageMatchesOptions, doesPackageMatch, getPackageInfo, getPackageListing, getPackageManager, isPackageExists, isPackageListed, loadPackageJson };
@@ -0,0 +1,2 @@
1
+ import { a as getPackageInfo, c as isPackageExists, i as doesPackageMatch, l as isPackageListed, n as PackageExistsOptions, o as getPackageListing, r as PackageMatchesOptions, s as getPackageManager, t as GetPackageListingReturn, u as loadPackageJson } from "./package-fns-CxokaGDY.mjs";
2
+ export { GetPackageListingReturn, PackageExistsOptions, PackageMatchesOptions, doesPackageMatch, getPackageInfo, getPackageListing, getPackageManager, isPackageExists, isPackageListed, loadPackageJson };
@@ -1 +1 @@
1
- import{findFileName as f,findFilePath as r}from"@stryke/path/file-path-fns";import{joinPaths as m}from"@stryke/path/join-paths";import{getPackageName as c}from"@stryke/string-format/package";import{isString as p}from"@stryke/type-checks/is-string";import{existsSync as l}from"node:fs";import{subset as P}from"semver";import{exists as y}from"./exists";import{getParentPath as g}from"./get-parent-path";import{getWorkspaceRoot as d}from"./get-workspace-root";import{readJsonFile as k}from"./json";import{resolvePackage as u}from"./resolve";export function getPackageManager(t=d()){const e=g(["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lock"],t,{includeNameInResults:!0});if(!e)return"pnpm";switch(f(e)){case"yarn.lock":return"yarn";case"pnpm-lock.yaml":return"pnpm";case"bun.lock":return"bun";default:return"npm"}}async function v(t){let e;for(;;){if(!t)return;const n=r(t);if(n===t)return;if(t=n,e=m(t,"package.json"),await y(e))break}return e}async function x(t,e={}){const n=await u(t,e);if(n)return v(n)}export async function getPackageInfo(t,e={}){const n=await x(t,e);if(!n)return;const a=await k(n);return{name:t,version:a.version,rootPath:r(n),packageJsonPath:n,packageJson:a}}export async function loadPackageJson(t=d()){const e=g("package.json",t,{skipCwd:!1,includeNameInResults:!0});return!e||!l(e)?null:k(e)}export async function isPackageListed(t,e){const n=c(t),a=p(e)?e:e?.cwd,s=await loadPackageJson(a);return s?!!(s.dependencies&&n in s.dependencies&&s.dependencies[n]||s.devDependencies&&n in s.devDependencies&&s.devDependencies[n]):!1}export async function getPackageListing(t,e){const n=c(t),a=p(e)?e:e?.cwd,s=await loadPackageJson(a);if(!s)return;const i=s.dependencies&&n in s.dependencies?s.dependencies[n]:s.devDependencies&&n in s.devDependencies?s.devDependencies[n]:void 0,o=(s.dependencies&&n in s.dependencies?"dependencies":s.devDependencies&&n in s.devDependencies?"devDependencies":void 0)||void 0;return i&&o?{version:i,type:o}:void 0}export async function doesPackageMatch(t,e,n){const a=await getPackageListing(t,{cwd:n});return a?a.version.startsWith("catalog:")||a.version.startsWith("workspace:")||P(a.version,e):!1}export function isPackageExists(t,e={}){return!!u(t,e)}
1
+ import"./get-workspace-root-k66w-wLW.mjs";import"./helpers-BSEQb1fp.mjs";import"./write-file-CFByoJkN.mjs";import"./resolve-C_YsCFne.mjs";import"./json-Dp4PSH2i.mjs";import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./package-fns-C7-MKgBR.mjs";export{o as doesPackageMatch,n as getPackageInfo,i as getPackageListing,t as getPackageManager,e as isPackageExists,r as isPackageListed,a as loadPackageJson};
@@ -0,0 +1,2 @@
1
+ import{existsSync as e,readFileSync as t}from"node:fs";import{readFile as n}from"node:fs/promises";const r=e=>{if(!e)throw Error(`No file path provided to read data`);return t(e,{encoding:`utf8`})},i=async e=>{if(!e)throw Error(`No file path provided to read data`);return n(e,{encoding:`utf8`})};function a(t){return e(t)?r(t):``}async function o(t){return e(t)?i(t):``}export{r as i,o as n,a as r,i as t};
2
+ //# sourceMappingURL=read-file-B091zB64.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-file-B091zB64.mjs","names":["readFileSync","readFileSyncFs","readFile","readFileFs"],"sources":["../src/read-file.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { existsSync, readFileSync as readFileSyncFs } from \"node:fs\";\nimport { readFile as readFileFs } from \"node:fs/promises\";\n\n/**\n * Read the given content to the given file path\n *\n * @param filePath - The file path to write to\n */\nexport const readFileSync = (filePath: string): string => {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n\n return readFileSyncFs(filePath, { encoding: \"utf8\" });\n};\n\n/**\n * Read the given content to the given file path\n *\n * @param filePath - The file path to read to\n */\nexport const readFile = async (filePath: string): Promise<string> => {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n\n return readFileFs(filePath, { encoding: \"utf8\" });\n};\n\n/**\n * Reads a file if it exists, otherwise returns an empty string.\n *\n * @param path - The path to the file to read.\n * @returns The content of the file if it exists, otherwise an empty string.\n */\nexport function readFileIfExistingSync(path: string) {\n return existsSync(path) ? readFileSync(path) : \"\";\n}\n\n/**\n * Reads a file if it exists, otherwise returns an empty string.\n *\n * @param path - The path to the file to read.\n * @returns The content of the file if it exists, otherwise an empty string.\n */\nexport async function readFileIfExisting(path: string) {\n return existsSync(path) ? readFile(path) : \"\";\n}\n"],"mappings":"mGA0BA,MAAaA,EAAgB,GAA6B,CACxD,GAAI,CAAC,EACH,MAAU,MAAM,qCAAqC,CAGvD,OAAOC,EAAe,EAAU,CAAE,SAAU,OAAQ,CAAC,EAQ1CC,EAAW,KAAO,IAAsC,CACnE,GAAI,CAAC,EACH,MAAU,MAAM,qCAAqC,CAGvD,OAAOC,EAAW,EAAU,CAAE,SAAU,OAAQ,CAAC,EASnD,SAAgB,EAAuB,EAAc,CACnD,OAAO,EAAW,EAAK,CAAGH,EAAa,EAAK,CAAG,GASjD,eAAsB,EAAmB,EAAc,CACrD,OAAO,EAAW,EAAK,CAAGE,EAAS,EAAK,CAAG"}
@@ -0,0 +1 @@
1
+ const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`node:fs`),n=require(`node:fs/promises`);const r=e=>{if(!e)throw Error(`No file path provided to read data`);return(0,t.readFileSync)(e,{encoding:`utf8`})},i=async e=>{if(!e)throw Error(`No file path provided to read data`);return(0,n.readFile)(e,{encoding:`utf8`})};function a(e){return(0,t.existsSync)(e)?r(e):``}async function o(e){return(0,t.existsSync)(e)?i(e):``}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
@@ -1,26 +1,30 @@
1
+ //#region src/read-file.d.ts
1
2
  /**
2
3
  * Read the given content to the given file path
3
4
  *
4
5
  * @param filePath - The file path to write to
5
6
  */
6
- export declare const readFileSync: (filePath: string) => string;
7
+ declare const readFileSync: (filePath: string) => string;
7
8
  /**
8
9
  * Read the given content to the given file path
9
10
  *
10
11
  * @param filePath - The file path to read to
11
12
  */
12
- export declare const readFile: (filePath: string) => Promise<string>;
13
+ declare const readFile: (filePath: string) => Promise<string>;
13
14
  /**
14
15
  * Reads a file if it exists, otherwise returns an empty string.
15
16
  *
16
17
  * @param path - The path to the file to read.
17
18
  * @returns The content of the file if it exists, otherwise an empty string.
18
19
  */
19
- export declare function readFileIfExistingSync(path: string): string;
20
+ declare function readFileIfExistingSync(path: string): string;
20
21
  /**
21
22
  * Reads a file if it exists, otherwise returns an empty string.
22
23
  *
23
24
  * @param path - The path to the file to read.
24
25
  * @returns The content of the file if it exists, otherwise an empty string.
25
26
  */
26
- export declare function readFileIfExisting(path: string): Promise<string>;
27
+ declare function readFileIfExisting(path: string): Promise<string>;
28
+ //#endregion
29
+ export { readFileSync as i, readFileIfExisting as n, readFileIfExistingSync as r, readFile as t };
30
+ //# sourceMappingURL=read-file-Bxn1VHKv.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-file-Bxn1VHKv.d.cts","names":[],"sources":["../src/read-file.ts"],"sourcesContent":[],"mappings":";;AA0BA;AAaA;AAcA;AAUA;cArCa;;;;;;cAaA,gCAAqC;;;;;;;iBAclC,sBAAA;;;;;;;iBAUM,kBAAA,gBAA+B"}
@@ -0,0 +1,30 @@
1
+ //#region src/read-file.d.ts
2
+ /**
3
+ * Read the given content to the given file path
4
+ *
5
+ * @param filePath - The file path to write to
6
+ */
7
+ declare const readFileSync: (filePath: string) => string;
8
+ /**
9
+ * Read the given content to the given file path
10
+ *
11
+ * @param filePath - The file path to read to
12
+ */
13
+ declare const readFile: (filePath: string) => Promise<string>;
14
+ /**
15
+ * Reads a file if it exists, otherwise returns an empty string.
16
+ *
17
+ * @param path - The path to the file to read.
18
+ * @returns The content of the file if it exists, otherwise an empty string.
19
+ */
20
+ declare function readFileIfExistingSync(path: string): string;
21
+ /**
22
+ * Reads a file if it exists, otherwise returns an empty string.
23
+ *
24
+ * @param path - The path to the file to read.
25
+ * @returns The content of the file if it exists, otherwise an empty string.
26
+ */
27
+ declare function readFileIfExisting(path: string): Promise<string>;
28
+ //#endregion
29
+ export { readFileSync as i, readFileIfExisting as n, readFileIfExistingSync as r, readFile as t };
30
+ //# sourceMappingURL=read-file-CRVW-wcE.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-file-CRVW-wcE.d.mts","names":[],"sources":["../src/read-file.ts"],"sourcesContent":[],"mappings":";;AA0BA;AAaA;AAcA;AAUA;cArCa;;;;;;cAaA,gCAAqC;;;;;;;iBAclC,sBAAA;;;;;;;iBAUM,kBAAA,gBAA+B"}
@@ -1,31 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.readFile = void 0;
7
- exports.readFileIfExisting = readFileIfExisting;
8
- exports.readFileIfExistingSync = readFileIfExistingSync;
9
- exports.readFileSync = void 0;
10
- var _nodeFs = require("node:fs");
11
- var _promises = require("node:fs/promises");
12
- const readFileSync = r => {
13
- if (!r) throw new Error("No file path provided to read data");
14
- return (0, _nodeFs.readFileSync)(r, {
15
- encoding: "utf8"
16
- });
17
- },
18
- readFile = async r => {
19
- if (!r) throw new Error("No file path provided to read data");
20
- return (0, _promises.readFile)(r, {
21
- encoding: "utf8"
22
- });
23
- };
24
- exports.readFile = readFile;
25
- exports.readFileSync = readFileSync;
26
- function readFileIfExistingSync(r) {
27
- return (0, _nodeFs.existsSync)(r) ? readFileSync(r) : "";
28
- }
29
- async function readFileIfExisting(r) {
30
- return (0, _nodeFs.existsSync)(r) ? readFile(r) : "";
31
- }
1
+ const e=require(`./read-file-BB2WzW-N.cjs`);exports.readFile=e.t,exports.readFileIfExisting=e.n,exports.readFileIfExistingSync=e.r,exports.readFileSync=e.i;