@stryke/fs 0.33.19 → 0.33.21

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 (494) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/{chunk-Bmb41Sf3.cjs → _virtual/rolldown_runtime.cjs} +1 -1
  3. package/dist/buffer.cjs +1 -1
  4. package/dist/buffer.d.cts +32 -2
  5. package/dist/buffer.d.cts.map +1 -0
  6. package/dist/buffer.d.mts +32 -2
  7. package/dist/buffer.d.mts.map +1 -0
  8. package/dist/buffer.mjs +2 -1
  9. package/dist/buffer.mjs.map +1 -0
  10. package/dist/chmod-x.cjs +1 -1
  11. package/dist/chmod-x.d.cts +44 -2
  12. package/dist/chmod-x.d.cts.map +1 -0
  13. package/dist/chmod-x.d.mts +44 -2
  14. package/dist/chmod-x.d.mts.map +1 -0
  15. package/dist/chmod-x.mjs +2 -1
  16. package/dist/chmod-x.mjs.map +1 -0
  17. package/dist/command-exists.cjs +1 -1
  18. package/dist/command-exists.d.cts +22 -2
  19. package/dist/command-exists.d.cts.map +1 -0
  20. package/dist/command-exists.d.mts +22 -2
  21. package/dist/command-exists.d.mts.map +1 -0
  22. package/dist/command-exists.mjs +2 -1
  23. package/dist/command-exists.mjs.map +1 -0
  24. package/dist/compress.cjs +1 -1
  25. package/dist/compress.d.cts +16 -2
  26. package/dist/compress.d.cts.map +1 -0
  27. package/dist/compress.d.mts +16 -2
  28. package/dist/compress.d.mts.map +1 -0
  29. package/dist/compress.mjs +2 -1
  30. package/dist/compress.mjs.map +1 -0
  31. package/dist/constants.d.cts +5 -2
  32. package/dist/constants.d.cts.map +1 -0
  33. package/dist/constants.d.mts +5 -2
  34. package/dist/constants.d.mts.map +1 -0
  35. package/dist/convert/src/array-buffer-to-string.cjs +1 -0
  36. package/dist/convert/src/array-buffer-to-string.mjs +2 -0
  37. package/dist/convert/src/array-buffer-to-string.mjs.map +1 -0
  38. package/dist/convert/src/to-array.cjs +1 -0
  39. package/dist/convert/src/to-array.mjs +2 -0
  40. package/dist/convert/src/to-array.mjs.map +1 -0
  41. package/dist/convert/src/uint8-array-to-string.cjs +1 -0
  42. package/dist/convert/src/uint8-array-to-string.mjs +2 -0
  43. package/dist/convert/src/uint8-array-to-string.mjs.map +1 -0
  44. package/dist/copy-file.cjs +1 -1
  45. package/dist/copy-file.d.cts +39 -2
  46. package/dist/copy-file.d.cts.map +1 -0
  47. package/dist/copy-file.d.mts +39 -2
  48. package/dist/copy-file.d.mts.map +1 -0
  49. package/dist/copy-file.mjs +2 -1
  50. package/dist/copy-file.mjs.map +1 -0
  51. package/dist/exists.cjs +1 -1
  52. package/dist/exists.d.cts +18 -2
  53. package/dist/exists.d.cts.map +1 -0
  54. package/dist/exists.d.mts +18 -2
  55. package/dist/exists.d.mts.map +1 -0
  56. package/dist/exists.mjs +2 -1
  57. package/dist/exists.mjs.map +1 -0
  58. package/dist/get-parent-path.cjs +1 -1
  59. package/dist/get-parent-path.d.cts +32 -2
  60. package/dist/get-parent-path.d.cts.map +1 -0
  61. package/dist/get-parent-path.d.mts +32 -2
  62. package/dist/get-parent-path.d.mts.map +1 -0
  63. package/dist/get-parent-path.mjs +2 -1
  64. package/dist/get-parent-path.mjs.map +1 -0
  65. package/dist/get-workspace-root.cjs +1 -1
  66. package/dist/get-workspace-root.d.cts +48 -2
  67. package/dist/get-workspace-root.d.cts.map +1 -0
  68. package/dist/get-workspace-root.d.mts +48 -2
  69. package/dist/get-workspace-root.d.mts.map +1 -0
  70. package/dist/get-workspace-root.mjs +2 -1
  71. package/dist/get-workspace-root.mjs.map +1 -0
  72. package/dist/helpers/src/get-unique.cjs +1 -0
  73. package/dist/helpers/src/get-unique.mjs +2 -0
  74. package/dist/helpers/src/get-unique.mjs.map +1 -0
  75. package/dist/helpers.cjs +1 -1
  76. package/dist/helpers.d.cts +50 -2
  77. package/dist/helpers.d.cts.map +1 -0
  78. package/dist/helpers.d.mts +50 -2
  79. package/dist/helpers.d.mts.map +1 -0
  80. package/dist/helpers.mjs +2 -1
  81. package/dist/helpers.mjs.map +1 -0
  82. package/dist/index.cjs +1 -1
  83. package/dist/index.d.cts +24 -24
  84. package/dist/index.d.mts +24 -24
  85. package/dist/index.mjs +1 -1
  86. package/dist/install.cjs +1 -1
  87. package/dist/install.d.cts +28 -2
  88. package/dist/install.d.cts.map +1 -0
  89. package/dist/install.d.mts +29 -2
  90. package/dist/install.d.mts.map +1 -0
  91. package/dist/install.mjs +2 -1
  92. package/dist/install.mjs.map +1 -0
  93. package/dist/is-file.cjs +1 -1
  94. package/dist/is-file.d.cts +36 -2
  95. package/dist/is-file.d.cts.map +1 -0
  96. package/dist/is-file.d.mts +36 -2
  97. package/dist/is-file.d.mts.map +1 -0
  98. package/dist/is-file.mjs +2 -1
  99. package/dist/is-file.mjs.map +1 -0
  100. package/dist/json/src/storm-json.cjs +1 -0
  101. package/dist/json/src/storm-json.mjs +2 -0
  102. package/dist/json/src/storm-json.mjs.map +1 -0
  103. package/dist/json/src/types.d.cts +33 -0
  104. package/dist/json/src/types.d.cts.map +1 -0
  105. package/dist/json/src/types.d.mts +33 -0
  106. package/dist/json/src/types.d.mts.map +1 -0
  107. package/dist/json/src/utils/code-frames.cjs +3 -0
  108. package/dist/json/src/utils/code-frames.mjs +4 -0
  109. package/dist/json/src/utils/code-frames.mjs.map +1 -0
  110. package/dist/json/src/utils/parse-error.cjs +1 -0
  111. package/dist/json/src/utils/parse-error.mjs +2 -0
  112. package/dist/json/src/utils/parse-error.mjs.map +1 -0
  113. package/dist/json/src/utils/parse.cjs +1 -0
  114. package/dist/json/src/utils/parse.mjs +2 -0
  115. package/dist/json/src/utils/parse.mjs.map +1 -0
  116. package/dist/json/src/utils/stringify.cjs +1 -0
  117. package/dist/json/src/utils/stringify.mjs +2 -0
  118. package/dist/json/src/utils/stringify.mjs.map +1 -0
  119. package/dist/json/src/utils/strip-comments.cjs +4 -0
  120. package/dist/json/src/utils/strip-comments.mjs +5 -0
  121. package/dist/json/src/utils/strip-comments.mjs.map +1 -0
  122. package/dist/json.cjs +1 -1
  123. package/dist/json.d.cts +54 -2
  124. package/dist/json.d.cts.map +1 -0
  125. package/dist/json.d.mts +54 -2
  126. package/dist/json.d.mts.map +1 -0
  127. package/dist/json.mjs +2 -1
  128. package/dist/json.mjs.map +1 -0
  129. package/dist/list-files.cjs +1 -1
  130. package/dist/list-files.d.cts +51 -2
  131. package/dist/list-files.d.cts.map +1 -0
  132. package/dist/list-files.d.mts +51 -2
  133. package/dist/list-files.d.mts.map +1 -0
  134. package/dist/list-files.mjs +2 -1
  135. package/dist/list-files.mjs.map +1 -0
  136. package/dist/package-fns.cjs +1 -1
  137. package/dist/package-fns.d.cts +95 -2
  138. package/dist/package-fns.d.cts.map +1 -0
  139. package/dist/package-fns.d.mts +95 -2
  140. package/dist/package-fns.d.mts.map +1 -0
  141. package/dist/package-fns.mjs +2 -1
  142. package/dist/package-fns.mjs.map +1 -0
  143. package/dist/path/src/append.cjs +1 -0
  144. package/dist/path/src/append.mjs +2 -0
  145. package/dist/path/src/append.mjs.map +1 -0
  146. package/dist/path/src/correct-path.cjs +1 -0
  147. package/dist/path/src/correct-path.mjs +2 -0
  148. package/dist/path/src/correct-path.mjs.map +1 -0
  149. package/dist/path/src/cwd.cjs +1 -0
  150. package/dist/path/src/cwd.mjs +2 -0
  151. package/dist/path/src/cwd.mjs.map +1 -0
  152. package/dist/path/src/file-path-fns.cjs +1 -0
  153. package/dist/path/src/file-path-fns.mjs +2 -0
  154. package/dist/path/src/file-path-fns.mjs.map +1 -0
  155. package/dist/path/src/is-parent-path.cjs +1 -0
  156. package/dist/path/src/is-parent-path.mjs +2 -0
  157. package/dist/path/src/is-parent-path.mjs.map +1 -0
  158. package/dist/path/src/is-root-dir.cjs +1 -0
  159. package/dist/path/src/is-root-dir.mjs +2 -0
  160. package/dist/path/src/is-root-dir.mjs.map +1 -0
  161. package/dist/path/src/is-type.cjs +1 -0
  162. package/dist/path/src/is-type.mjs +2 -0
  163. package/dist/path/src/is-type.mjs.map +1 -0
  164. package/dist/path/src/join-paths.cjs +1 -0
  165. package/dist/path/src/join-paths.mjs +2 -0
  166. package/dist/path/src/join-paths.mjs.map +1 -0
  167. package/dist/path/src/regex.cjs +1 -0
  168. package/dist/path/src/regex.mjs +2 -0
  169. package/dist/path/src/regex.mjs.map +1 -0
  170. package/dist/path/src/replace.cjs +1 -0
  171. package/dist/path/src/replace.mjs +2 -0
  172. package/dist/path/src/replace.mjs.map +1 -0
  173. package/dist/path/src/resolve-parent-path.cjs +1 -0
  174. package/dist/path/src/resolve-parent-path.mjs +2 -0
  175. package/dist/path/src/resolve-parent-path.mjs.map +1 -0
  176. package/dist/path/src/slash.cjs +1 -0
  177. package/dist/path/src/slash.mjs +2 -0
  178. package/dist/path/src/slash.mjs.map +1 -0
  179. package/dist/read-file.cjs +1 -1
  180. package/dist/read-file.d.cts +30 -2
  181. package/dist/read-file.d.cts.map +1 -0
  182. package/dist/read-file.d.mts +30 -2
  183. package/dist/read-file.d.mts.map +1 -0
  184. package/dist/read-file.mjs +2 -1
  185. package/dist/read-file.mjs.map +1 -0
  186. package/dist/registry.cjs +1 -1
  187. package/dist/registry.d.cts +53 -2
  188. package/dist/registry.d.cts.map +1 -0
  189. package/dist/registry.d.mts +53 -2
  190. package/dist/registry.d.mts.map +1 -0
  191. package/dist/registry.mjs +2 -1
  192. package/dist/registry.mjs.map +1 -0
  193. package/dist/remove-file.cjs +1 -1
  194. package/dist/remove-file.d.cts +16 -2
  195. package/dist/remove-file.d.cts.map +1 -0
  196. package/dist/remove-file.d.mts +16 -2
  197. package/dist/remove-file.d.mts.map +1 -0
  198. package/dist/remove-file.mjs +2 -1
  199. package/dist/remove-file.mjs.map +1 -0
  200. package/dist/resolve.cjs +3 -1
  201. package/dist/resolve.d.cts +106 -2
  202. package/dist/resolve.d.cts.map +1 -0
  203. package/dist/resolve.d.mts +106 -2
  204. package/dist/resolve.d.mts.map +1 -0
  205. package/dist/resolve.mjs +4 -1
  206. package/dist/resolve.mjs.map +1 -0
  207. package/dist/semver-fns.cjs +1 -1
  208. package/dist/semver-fns.d.cts +92 -2
  209. package/dist/semver-fns.d.cts.map +1 -0
  210. package/dist/semver-fns.d.mts +92 -2
  211. package/dist/semver-fns.d.mts.map +1 -0
  212. package/dist/semver-fns.mjs +2 -1
  213. package/dist/semver-fns.mjs.map +1 -0
  214. package/dist/string-format/src/package.cjs +1 -0
  215. package/dist/string-format/src/package.mjs +2 -0
  216. package/dist/string-format/src/package.mjs.map +1 -0
  217. package/dist/toml.cjs +3 -1
  218. package/dist/toml.d.cts +81 -2
  219. package/dist/toml.d.cts.map +1 -0
  220. package/dist/toml.d.mts +81 -2
  221. package/dist/toml.d.mts.map +1 -0
  222. package/dist/toml.mjs +4 -1
  223. package/dist/toml.mjs.map +1 -0
  224. package/dist/tsconfig.cjs +1 -1
  225. package/dist/tsconfig.d.cts +14 -2
  226. package/dist/tsconfig.d.cts.map +1 -0
  227. package/dist/tsconfig.d.mts +14 -2
  228. package/dist/tsconfig.d.mts.map +1 -0
  229. package/dist/tsconfig.mjs +2 -1
  230. package/dist/tsconfig.mjs.map +1 -0
  231. package/dist/type-checks/src/get-object-tag.cjs +1 -0
  232. package/dist/type-checks/src/get-object-tag.mjs +2 -0
  233. package/dist/type-checks/src/get-object-tag.mjs.map +1 -0
  234. package/dist/type-checks/src/index.cjs +1 -0
  235. package/dist/type-checks/src/index.mjs +1 -0
  236. package/dist/type-checks/src/is-buffer.cjs +1 -0
  237. package/dist/type-checks/src/is-buffer.mjs +2 -0
  238. package/dist/type-checks/src/is-buffer.mjs.map +1 -0
  239. package/dist/type-checks/src/is-collection.cjs +1 -0
  240. package/dist/type-checks/src/is-collection.mjs +1 -0
  241. package/dist/type-checks/src/is-empty.cjs +1 -0
  242. package/dist/type-checks/src/is-empty.mjs +2 -0
  243. package/dist/type-checks/src/is-empty.mjs.map +1 -0
  244. package/dist/type-checks/src/is-error.cjs +1 -0
  245. package/dist/type-checks/src/is-error.mjs +2 -0
  246. package/dist/type-checks/src/is-error.mjs.map +1 -0
  247. package/dist/type-checks/src/is-null.cjs +1 -0
  248. package/dist/type-checks/src/is-null.mjs +2 -0
  249. package/dist/type-checks/src/is-null.mjs.map +1 -0
  250. package/dist/type-checks/src/is-number.cjs +1 -0
  251. package/dist/type-checks/src/is-number.mjs +2 -0
  252. package/dist/type-checks/src/is-number.mjs.map +1 -0
  253. package/dist/type-checks/src/is-object.cjs +1 -0
  254. package/dist/type-checks/src/is-object.mjs +2 -0
  255. package/dist/type-checks/src/is-object.mjs.map +1 -0
  256. package/dist/type-checks/src/is-plain-object.cjs +1 -0
  257. package/dist/type-checks/src/is-plain-object.mjs +2 -0
  258. package/dist/type-checks/src/is-plain-object.mjs.map +1 -0
  259. package/dist/type-checks/src/is-set-string.cjs +1 -0
  260. package/dist/type-checks/src/is-set-string.mjs +2 -0
  261. package/dist/type-checks/src/is-set-string.mjs.map +1 -0
  262. package/dist/type-checks/src/is-set.cjs +1 -0
  263. package/dist/type-checks/src/is-set.mjs +2 -0
  264. package/dist/type-checks/src/is-set.mjs.map +1 -0
  265. package/dist/type-checks/src/is-string.cjs +1 -0
  266. package/dist/type-checks/src/is-string.mjs +2 -0
  267. package/dist/type-checks/src/is-string.mjs.map +1 -0
  268. package/dist/type-checks/src/is-undefined.cjs +1 -0
  269. package/dist/type-checks/src/is-undefined.mjs +2 -0
  270. package/dist/type-checks/src/is-undefined.mjs.map +1 -0
  271. package/dist/type-checks/src/type-detect.cjs +1 -0
  272. package/dist/type-checks/src/type-detect.mjs +2 -0
  273. package/dist/type-checks/src/type-detect.mjs.map +1 -0
  274. package/dist/types/src/base.cjs +1 -0
  275. package/dist/types/src/base.mjs +2 -0
  276. package/dist/types/src/base.mjs.map +1 -0
  277. package/dist/{file-D1uBqkpP.d.cts → types/src/file.d.cts} +2 -2
  278. package/dist/types/src/file.d.cts.map +1 -0
  279. package/dist/{file-DauFFmfh.d.mts → types/src/file.d.mts} +2 -2
  280. package/dist/types/src/file.d.mts.map +1 -0
  281. package/dist/{package-fns-CxokaGDY.d.mts → types/src/package-json.d.cts} +2 -95
  282. package/dist/types/src/package-json.d.cts.map +1 -0
  283. package/dist/{package-fns-BNRi_Rpc.d.cts → types/src/package-json.d.mts} +2 -95
  284. package/dist/types/src/package-json.d.mts.map +1 -0
  285. package/dist/types/src/package-manager.d.cts +5 -0
  286. package/dist/types/src/package-manager.d.cts.map +1 -0
  287. package/dist/types/src/package-manager.d.mts +5 -0
  288. package/dist/types/src/package-manager.d.mts.map +1 -0
  289. package/dist/{tsconfig-B13IMV_0.d.mts → types/src/tsconfig.d.cts} +3 -12
  290. package/dist/types/src/tsconfig.d.cts.map +1 -0
  291. package/dist/{tsconfig-C8ecu1-0.d.cts → types/src/tsconfig.d.mts} +3 -12
  292. package/dist/types/src/tsconfig.d.mts.map +1 -0
  293. package/dist/write-file.cjs +1 -1
  294. package/dist/write-file.d.cts +35 -2
  295. package/dist/write-file.d.cts.map +1 -0
  296. package/dist/write-file.d.mts +35 -2
  297. package/dist/write-file.d.mts.map +1 -0
  298. package/dist/write-file.mjs +2 -1
  299. package/dist/write-file.mjs.map +1 -0
  300. package/dist/yaml.cjs +1 -1
  301. package/dist/yaml.d.cts +23 -2
  302. package/dist/yaml.d.cts.map +1 -0
  303. package/dist/yaml.d.mts +23 -2
  304. package/dist/yaml.d.mts.map +1 -0
  305. package/dist/yaml.mjs +2 -1
  306. package/dist/yaml.mjs.map +1 -0
  307. package/package.json +11 -11
  308. package/dist/buffer-Ch164vki.cjs +0 -1
  309. package/dist/buffer-DDq-CW4J.mjs +0 -2
  310. package/dist/buffer-DDq-CW4J.mjs.map +0 -1
  311. package/dist/buffer-DgfUmhrc.d.mts +0 -32
  312. package/dist/buffer-DgfUmhrc.d.mts.map +0 -1
  313. package/dist/buffer-DvCjrjQH.d.cts +0 -32
  314. package/dist/buffer-DvCjrjQH.d.cts.map +0 -1
  315. package/dist/chmod-x-BPr4tt2-.d.cts +0 -44
  316. package/dist/chmod-x-BPr4tt2-.d.cts.map +0 -1
  317. package/dist/chmod-x-FOy3sak8.cjs +0 -1
  318. package/dist/chmod-x-QCk1GmQJ.d.mts +0 -44
  319. package/dist/chmod-x-QCk1GmQJ.d.mts.map +0 -1
  320. package/dist/chmod-x-q-TWdus7.mjs +0 -2
  321. package/dist/chmod-x-q-TWdus7.mjs.map +0 -1
  322. package/dist/command-exists-CuieR7rx.d.cts +0 -22
  323. package/dist/command-exists-CuieR7rx.d.cts.map +0 -1
  324. package/dist/command-exists-D1bV-wSk.cjs +0 -1
  325. package/dist/command-exists-Dzb2kKT4.mjs +0 -2
  326. package/dist/command-exists-Dzb2kKT4.mjs.map +0 -1
  327. package/dist/command-exists-dBdtR0xj.d.mts +0 -22
  328. package/dist/command-exists-dBdtR0xj.d.mts.map +0 -1
  329. package/dist/compress-BiTxso15.mjs +0 -2
  330. package/dist/compress-BiTxso15.mjs.map +0 -1
  331. package/dist/compress-BjGbQqs_.cjs +0 -1
  332. package/dist/compress-CLAaOwH3.d.mts +0 -16
  333. package/dist/compress-CLAaOwH3.d.mts.map +0 -1
  334. package/dist/compress-CQve2a6h.d.cts +0 -16
  335. package/dist/compress-CQve2a6h.d.cts.map +0 -1
  336. package/dist/constants-D58o2CiO.d.cts +0 -5
  337. package/dist/constants-D58o2CiO.d.cts.map +0 -1
  338. package/dist/constants-DZz9LJgo.d.mts +0 -5
  339. package/dist/constants-DZz9LJgo.d.mts.map +0 -1
  340. package/dist/copy-file-B5FJHiIK.d.mts +0 -39
  341. package/dist/copy-file-B5FJHiIK.d.mts.map +0 -1
  342. package/dist/copy-file-Bot2YNtT.mjs +0 -2
  343. package/dist/copy-file-Bot2YNtT.mjs.map +0 -1
  344. package/dist/copy-file-DjH2Ho5e.d.cts +0 -39
  345. package/dist/copy-file-DjH2Ho5e.d.cts.map +0 -1
  346. package/dist/copy-file-Y1ilzocZ.cjs +0 -1
  347. package/dist/cwd-YTg9Cx6C.mjs +0 -2
  348. package/dist/cwd-YTg9Cx6C.mjs.map +0 -1
  349. package/dist/cwd-o2vq8Tk9.cjs +0 -1
  350. package/dist/exists-175EN367.d.mts +0 -18
  351. package/dist/exists-175EN367.d.mts.map +0 -1
  352. package/dist/exists-B31lSRFp.cjs +0 -1
  353. package/dist/exists-CVlDImzc.d.cts +0 -18
  354. package/dist/exists-CVlDImzc.d.cts.map +0 -1
  355. package/dist/exists-Ci-9lYmi.mjs +0 -2
  356. package/dist/exists-Ci-9lYmi.mjs.map +0 -1
  357. package/dist/file-D1uBqkpP.d.cts.map +0 -1
  358. package/dist/file-DauFFmfh.d.mts.map +0 -1
  359. package/dist/file-path-fns-7aKacdLg.cjs +0 -1
  360. package/dist/file-path-fns-BDzC2SIV.mjs +0 -2
  361. package/dist/file-path-fns-BDzC2SIV.mjs.map +0 -1
  362. package/dist/get-parent-path-COkh6Pvl.d.mts +0 -32
  363. package/dist/get-parent-path-COkh6Pvl.d.mts.map +0 -1
  364. package/dist/get-parent-path-Cbqs2km7.d.cts +0 -32
  365. package/dist/get-parent-path-Cbqs2km7.d.cts.map +0 -1
  366. package/dist/get-parent-path-CfRkaB4R.cjs +0 -1
  367. package/dist/get-parent-path-DLFSyxSW.mjs +0 -2
  368. package/dist/get-parent-path-DLFSyxSW.mjs.map +0 -1
  369. package/dist/get-workspace-root-CCNjjZGY.cjs +0 -1
  370. package/dist/get-workspace-root-DQBvBd8X.d.mts +0 -48
  371. package/dist/get-workspace-root-DQBvBd8X.d.mts.map +0 -1
  372. package/dist/get-workspace-root-eTfm1jII.d.cts +0 -48
  373. package/dist/get-workspace-root-eTfm1jII.d.cts.map +0 -1
  374. package/dist/get-workspace-root-k66w-wLW.mjs +0 -2
  375. package/dist/get-workspace-root-k66w-wLW.mjs.map +0 -1
  376. package/dist/helpers-BSEQb1fp.mjs +0 -2
  377. package/dist/helpers-BSEQb1fp.mjs.map +0 -1
  378. package/dist/helpers-CYWFZ-Uv.d.mts +0 -50
  379. package/dist/helpers-CYWFZ-Uv.d.mts.map +0 -1
  380. package/dist/helpers-CgMOExPa.d.cts +0 -50
  381. package/dist/helpers-CgMOExPa.d.cts.map +0 -1
  382. package/dist/helpers-_MJ6PR-g.cjs +0 -1
  383. package/dist/install-B3bIjHoU.mjs +0 -2
  384. package/dist/install-B3bIjHoU.mjs.map +0 -1
  385. package/dist/install-CZ_S7NHm.cjs +0 -1
  386. package/dist/install-CxPsLO2t.d.cts +0 -28
  387. package/dist/install-CxPsLO2t.d.cts.map +0 -1
  388. package/dist/install-dYt7hlQn.d.mts +0 -29
  389. package/dist/install-dYt7hlQn.d.mts.map +0 -1
  390. package/dist/is-error-CjEyTRps.cjs +0 -1
  391. package/dist/is-error-CjVXmD_8.mjs +0 -2
  392. package/dist/is-error-CjVXmD_8.mjs.map +0 -1
  393. package/dist/is-file-BkFQev3M.cjs +0 -1
  394. package/dist/is-file-CNooe8Wz.mjs +0 -2
  395. package/dist/is-file-CNooe8Wz.mjs.map +0 -1
  396. package/dist/is-file-DjqOQrqY.d.mts +0 -36
  397. package/dist/is-file-DjqOQrqY.d.mts.map +0 -1
  398. package/dist/is-file-DoBi2FN9.d.cts +0 -36
  399. package/dist/is-file-DoBi2FN9.d.cts.map +0 -1
  400. package/dist/is-object-FBXmvehR.cjs +0 -1
  401. package/dist/is-object-UsKYhyC5.mjs +0 -2
  402. package/dist/is-object-UsKYhyC5.mjs.map +0 -1
  403. package/dist/is-set-string-CLeu8BKX.cjs +0 -1
  404. package/dist/is-set-string-Cj0g4gsG.mjs +0 -2
  405. package/dist/is-set-string-Cj0g4gsG.mjs.map +0 -1
  406. package/dist/is-string-91Z3dOKQ.mjs +0 -2
  407. package/dist/is-string-91Z3dOKQ.mjs.map +0 -1
  408. package/dist/is-string-DKgNS0jA.cjs +0 -1
  409. package/dist/join-paths-BHepkhAj.mjs +0 -2
  410. package/dist/join-paths-BHepkhAj.mjs.map +0 -1
  411. package/dist/join-paths-DUdaieID.cjs +0 -1
  412. package/dist/json-CYenVxvr.d.cts +0 -83
  413. package/dist/json-CYenVxvr.d.cts.map +0 -1
  414. package/dist/json-DH7Q6Ftp.d.mts +0 -83
  415. package/dist/json-DH7Q6Ftp.d.mts.map +0 -1
  416. package/dist/json-DKhqPjHB.cjs +0 -6
  417. package/dist/json-Dp4PSH2i.mjs +0 -7
  418. package/dist/json-Dp4PSH2i.mjs.map +0 -1
  419. package/dist/list-files-Cn_UVruo.cjs +0 -1
  420. package/dist/list-files-D3dQOljX.d.cts +0 -51
  421. package/dist/list-files-D3dQOljX.d.cts.map +0 -1
  422. package/dist/list-files-D3iJzEQw.d.mts +0 -51
  423. package/dist/list-files-D3iJzEQw.d.mts.map +0 -1
  424. package/dist/list-files-D__uh3tQ.mjs +0 -2
  425. package/dist/list-files-D__uh3tQ.mjs.map +0 -1
  426. package/dist/package-fns-BNRi_Rpc.d.cts.map +0 -1
  427. package/dist/package-fns-C7-MKgBR.mjs +0 -2
  428. package/dist/package-fns-C7-MKgBR.mjs.map +0 -1
  429. package/dist/package-fns-CxokaGDY.d.mts.map +0 -1
  430. package/dist/package-fns-YTCdMAXr.cjs +0 -1
  431. package/dist/read-file-B091zB64.mjs +0 -2
  432. package/dist/read-file-B091zB64.mjs.map +0 -1
  433. package/dist/read-file-BB2WzW-N.cjs +0 -1
  434. package/dist/read-file-Bxn1VHKv.d.cts +0 -30
  435. package/dist/read-file-Bxn1VHKv.d.cts.map +0 -1
  436. package/dist/read-file-CRVW-wcE.d.mts +0 -30
  437. package/dist/read-file-CRVW-wcE.d.mts.map +0 -1
  438. package/dist/registry-B1taIPKm.mjs +0 -2
  439. package/dist/registry-B1taIPKm.mjs.map +0 -1
  440. package/dist/registry-BQ3JXRFA.d.mts +0 -53
  441. package/dist/registry-BQ3JXRFA.d.mts.map +0 -1
  442. package/dist/registry-BYwvM92u.cjs +0 -1
  443. package/dist/registry-C2A0Kau7.d.cts +0 -53
  444. package/dist/registry-C2A0Kau7.d.cts.map +0 -1
  445. package/dist/remove-file-BM64Brdf.mjs +0 -2
  446. package/dist/remove-file-BM64Brdf.mjs.map +0 -1
  447. package/dist/remove-file-BqlkL_Df.d.mts +0 -16
  448. package/dist/remove-file-BqlkL_Df.d.mts.map +0 -1
  449. package/dist/remove-file-XHFKELQN.cjs +0 -1
  450. package/dist/remove-file-lQOlxDwr.d.cts +0 -16
  451. package/dist/remove-file-lQOlxDwr.d.cts.map +0 -1
  452. package/dist/resolve-C_YsCFne.mjs +0 -4
  453. package/dist/resolve-C_YsCFne.mjs.map +0 -1
  454. package/dist/resolve-D66oIwjf.d.mts +0 -106
  455. package/dist/resolve-D66oIwjf.d.mts.map +0 -1
  456. package/dist/resolve-DTkLQekH.cjs +0 -3
  457. package/dist/resolve-DubH-8qd.d.cts +0 -106
  458. package/dist/resolve-DubH-8qd.d.cts.map +0 -1
  459. package/dist/resolve-parent-path-CR8av8WP.mjs +0 -2
  460. package/dist/resolve-parent-path-CR8av8WP.mjs.map +0 -1
  461. package/dist/resolve-parent-path-D0AaW2PB.cjs +0 -1
  462. package/dist/semver-fns-B0e5zB6C.d.mts +0 -92
  463. package/dist/semver-fns-B0e5zB6C.d.mts.map +0 -1
  464. package/dist/semver-fns-Btrm1dIF.cjs +0 -1
  465. package/dist/semver-fns-DjhZXnUw.d.cts +0 -92
  466. package/dist/semver-fns-DjhZXnUw.d.cts.map +0 -1
  467. package/dist/semver-fns-F_rYnwDq.mjs +0 -2
  468. package/dist/semver-fns-F_rYnwDq.mjs.map +0 -1
  469. package/dist/toml-CIgLQmP3.mjs +0 -4
  470. package/dist/toml-CIgLQmP3.mjs.map +0 -1
  471. package/dist/toml-D3X2QoaL.d.cts +0 -81
  472. package/dist/toml-D3X2QoaL.d.cts.map +0 -1
  473. package/dist/toml-DgVyNp_y.cjs +0 -3
  474. package/dist/toml-Djau1M6n.d.mts +0 -81
  475. package/dist/toml-Djau1M6n.d.mts.map +0 -1
  476. package/dist/tsconfig-B13IMV_0.d.mts.map +0 -1
  477. package/dist/tsconfig-B6WtgD1c.cjs +0 -1
  478. package/dist/tsconfig-C8ecu1-0.d.cts.map +0 -1
  479. package/dist/tsconfig-CqvvSVuX.mjs +0 -2
  480. package/dist/tsconfig-CqvvSVuX.mjs.map +0 -1
  481. package/dist/write-file-BmvbsmMj.d.cts +0 -35
  482. package/dist/write-file-BmvbsmMj.d.cts.map +0 -1
  483. package/dist/write-file-CFByoJkN.mjs +0 -2
  484. package/dist/write-file-CFByoJkN.mjs.map +0 -1
  485. package/dist/write-file-CWTzQpb2.d.mts +0 -35
  486. package/dist/write-file-CWTzQpb2.d.mts.map +0 -1
  487. package/dist/write-file-CqokudVp.cjs +0 -1
  488. package/dist/yaml-6uuLoSfT.d.cts +0 -23
  489. package/dist/yaml-6uuLoSfT.d.cts.map +0 -1
  490. package/dist/yaml-CLMo56UG.mjs +0 -2
  491. package/dist/yaml-CLMo56UG.mjs.map +0 -1
  492. package/dist/yaml-Ddslc5NK.d.mts +0 -23
  493. package/dist/yaml-Ddslc5NK.d.mts.map +0 -1
  494. package/dist/yaml-q2k-BjIM.cjs +0 -1
package/dist/index.d.mts CHANGED
@@ -1,25 +1,25 @@
1
- import { i as writeFileBufferSync, n as readFileBufferSync, r as writeFileBuffer, t as readFileBuffer } from "./buffer-DgfUmhrc.mjs";
2
- import { a as isWritable, i as isExecutableSync, n as chmodXSync, o as isWritableSync, r as isExecutable, t as chmodX } from "./chmod-x-QCk1GmQJ.mjs";
3
- import { n as commandExistsSync, t as commandExists } from "./command-exists-dBdtR0xj.mjs";
4
- import { n as compressDirectory, t as CompressDirectoryOptions } from "./compress-CLAaOwH3.mjs";
5
- import { t as Encoding } from "./constants-DZz9LJgo.mjs";
6
- import { i as copyFilesSync, n as copyFileSync, r as copyFiles, t as copyFile } from "./copy-file-B5FJHiIK.mjs";
7
- import { n as existsSync, t as exists } from "./exists-175EN367.mjs";
8
- import { n as getParentPath, t as GetParentPathOptions } from "./get-parent-path-COkh6Pvl.mjs";
9
- import { a as isProjectRoot, c as relativeToWorkspaceRoot, i as getWorkspaceRoot, n as WORKSPACE_ROOT_CONTENT, o as isWorkspaceRoot, r as getProjectRoot, s as relativeToProjectRoot, t as PROJECT_ROOT_CONTENT } from "./get-workspace-root-DQBvBd8X.mjs";
10
- import { a as removeDirectory, i as extractFileFromTarGzip, n as createDirectorySync, o as removeDirectorySync, r as extractFileFromTar, t as createDirectory } from "./helpers-CYWFZ-Uv.mjs";
11
- import { n as packageExists, t as install } from "./install-dYt7hlQn.mjs";
12
- import { i as isFileSymlink, n as isDirectorySymlink, r as isFile, t as isDirectory } from "./is-file-DjqOQrqY.mjs";
13
- import { a as writeJsonFile, i as readJsonFileSync, n as JsonWriteOptions, o as writeJsonFileSync, r as readJsonFile, t as JsonReadOptions } from "./json-DH7Q6Ftp.mjs";
14
- import { a as listDirectoriesSync, c as listSync, i as listDirectories, n as ListOptions, o as listFiles, r as list, s as listFilesSync, t as InferListReturnType } from "./list-files-D3iJzEQw.mjs";
15
- 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";
16
- import { a as getResolutionPaths, c as resolvePackage, d as resolveSafeSync, f as resolveSync, i as getResolutionCombinations, l as resolvePackageSync, n as ResolveOptions, o as importModule, r as getNodeModulesPaths, s as resolve, t as DEFAULT_EXTENSIONS, u as resolveSafe } from "./resolve-D66oIwjf.mjs";
17
- import { i as readFileSync, n as readFileIfExisting, r as readFileIfExistingSync, t as readFile } from "./read-file-CRVW-wcE.mjs";
18
- import { a as getRegistry, i as getParsedNodeOptionsWithoutInspect, n as formatNodeOptions, o as tokenizeArgs, r as getFormattedNodeOptionsWithoutInspect, t as NodeOptionsToken } from "./registry-BQ3JXRFA.mjs";
19
- import { n as removeFileSync, t as removeFile } from "./remove-file-BqlkL_Df.mjs";
20
- import { a as isSemver, c as isValidVersion, i as isRelativeVersionKeyword, l as parseVersion, n as deriveNewSemverVersion, o as isValidRange, r as isRange, s as isValidSemver, t as coerceVersion, u as satisfiesVersion } from "./semver-fns-B0e5zB6C.mjs";
21
- import { a as readTomlFileSync, i as readTomlFile, n as TomlWriteOptions, o as writeTomlFile, r as XOptions, s as writeTomlFileSync, t as TomlReadOptions } from "./toml-Djau1M6n.mjs";
22
- import { t as loadTsConfig } from "./tsconfig-B13IMV_0.mjs";
23
- import { n as writeFile, r as writeFileSync, t as WriteFileOptions } from "./write-file-CWTzQpb2.mjs";
24
- import { n as readYamlFile, r as readYamlFileSync, t as YamlReadOptions } from "./yaml-Ddslc5NK.mjs";
1
+ import { readFileBuffer, readFileBufferSync, writeFileBuffer, writeFileBufferSync } from "./buffer.mjs";
2
+ import { chmodX, chmodXSync, isExecutable, isExecutableSync, isWritable, isWritableSync } from "./chmod-x.mjs";
3
+ import { commandExists, commandExistsSync } from "./command-exists.mjs";
4
+ import { CompressDirectoryOptions, compressDirectory } from "./compress.mjs";
5
+ import { Encoding } from "./constants.mjs";
6
+ import { copyFile, copyFileSync, copyFiles, copyFilesSync } from "./copy-file.mjs";
7
+ import { exists, existsSync } from "./exists.mjs";
8
+ import { GetParentPathOptions, getParentPath } from "./get-parent-path.mjs";
9
+ import { PROJECT_ROOT_CONTENT, WORKSPACE_ROOT_CONTENT, getProjectRoot, getWorkspaceRoot, isProjectRoot, isWorkspaceRoot, relativeToProjectRoot, relativeToWorkspaceRoot } from "./get-workspace-root.mjs";
10
+ import { createDirectory, createDirectorySync, extractFileFromTar, extractFileFromTarGzip, removeDirectory, removeDirectorySync } from "./helpers.mjs";
11
+ import { install, packageExists } from "./install.mjs";
12
+ import { isDirectory, isDirectorySymlink, isFile, isFileSymlink } from "./is-file.mjs";
13
+ import { JsonReadOptions, JsonWriteOptions, readJsonFile, readJsonFileSync, writeJsonFile, writeJsonFileSync } from "./json.mjs";
14
+ import { InferListReturnType, ListOptions, list, listDirectories, listDirectoriesSync, listFiles, listFilesSync, listSync } from "./list-files.mjs";
15
+ import { DEFAULT_EXTENSIONS, ResolveOptions, getNodeModulesPaths, getResolutionCombinations, getResolutionPaths, importModule, resolve, resolvePackage, resolvePackageSync, resolveSafe, resolveSafeSync, resolveSync } from "./resolve.mjs";
16
+ import { GetPackageListingReturn, PackageExistsOptions, PackageMatchesOptions, doesPackageMatch, getPackageInfo, getPackageListing, getPackageManager, isPackageExists, isPackageListed, loadPackageJson } from "./package-fns.mjs";
17
+ import { readFile, readFileIfExisting, readFileIfExistingSync, readFileSync } from "./read-file.mjs";
18
+ import { NodeOptionsToken, formatNodeOptions, getFormattedNodeOptionsWithoutInspect, getParsedNodeOptionsWithoutInspect, getRegistry, tokenizeArgs } from "./registry.mjs";
19
+ import { removeFile, removeFileSync } from "./remove-file.mjs";
20
+ import { coerceVersion, deriveNewSemverVersion, isRange, isRelativeVersionKeyword, isSemver, isValidRange, isValidSemver, isValidVersion, parseVersion, satisfiesVersion } from "./semver-fns.mjs";
21
+ import { TomlReadOptions, TomlWriteOptions, XOptions, readTomlFile, readTomlFileSync, writeTomlFile, writeTomlFileSync } from "./toml.mjs";
22
+ import { loadTsConfig } from "./tsconfig.mjs";
23
+ import { WriteFileOptions, writeFile, writeFileSync } from "./write-file.mjs";
24
+ import { YamlReadOptions, readYamlFile, readYamlFileSync } from "./yaml.mjs";
25
25
  export { CompressDirectoryOptions, DEFAULT_EXTENSIONS, Encoding, GetPackageListingReturn, GetParentPathOptions, InferListReturnType, JsonReadOptions, JsonWriteOptions, ListOptions, NodeOptionsToken, PROJECT_ROOT_CONTENT, PackageExistsOptions, PackageMatchesOptions, ResolveOptions, TomlReadOptions, TomlWriteOptions, WORKSPACE_ROOT_CONTENT, WriteFileOptions, XOptions, YamlReadOptions, chmodX, chmodXSync, coerceVersion, commandExists, commandExistsSync, compressDirectory, copyFile, copyFileSync, copyFiles, copyFilesSync, createDirectory, createDirectorySync, deriveNewSemverVersion, doesPackageMatch, exists, existsSync, extractFileFromTar, extractFileFromTarGzip, formatNodeOptions, getFormattedNodeOptionsWithoutInspect, getNodeModulesPaths, getPackageInfo, getPackageListing, getPackageManager, getParentPath, getParsedNodeOptionsWithoutInspect, getProjectRoot, getRegistry, getResolutionCombinations, getResolutionPaths, getWorkspaceRoot, importModule, install, isDirectory, isDirectorySymlink, isExecutable, isExecutableSync, isFile, isFileSymlink, isPackageExists, isPackageListed, isProjectRoot, isRange, isRelativeVersionKeyword, isSemver, isValidRange, isValidSemver, isValidVersion, isWorkspaceRoot, isWritable, isWritableSync, list, listDirectories, listDirectoriesSync, listFiles, listFilesSync, listSync, loadPackageJson, loadTsConfig, packageExists, parseVersion, readFile, readFileBuffer, readFileBufferSync, readFileIfExisting, readFileIfExistingSync, readFileSync, readJsonFile, readJsonFileSync, readTomlFile, readTomlFileSync, readYamlFile, readYamlFileSync, relativeToProjectRoot, relativeToWorkspaceRoot, removeDirectory, removeDirectorySync, removeFile, removeFileSync, resolve, resolvePackage, resolvePackageSync, resolveSafe, resolveSafeSync, resolveSync, satisfiesVersion, tokenizeArgs, writeFile, writeFileBuffer, writeFileBufferSync, writeFileSync, writeJsonFile, writeJsonFileSync, writeTomlFile, writeTomlFileSync };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./get-workspace-root-k66w-wLW.mjs";import{i as c,n as l,r as u,t as d}from"./copy-file-Bot2YNtT.mjs";import{n as f,t as p}from"./exists-Ci-9lYmi.mjs";import{a as m,i as h,n as g,o as _,r as v,t as y}from"./helpers-BSEQb1fp.mjs";import{i as b,n as x,r as S,t as C}from"./buffer-DDq-CW4J.mjs";import{a as w,i as T,n as E,o as D,r as O,t as k}from"./chmod-x-q-TWdus7.mjs";import{n as A,t as j}from"./command-exists-Dzb2kKT4.mjs";import{t as M}from"./compress-BiTxso15.mjs";import{i as N,n as P,r as F,t as I}from"./is-file-CNooe8Wz.mjs";import{a as L,i as R,n as z,o as B,r as V,t as H}from"./list-files-D__uh3tQ.mjs";import{i as U,n as W,r as G,t as K}from"./read-file-B091zB64.mjs";import{n as q,t as J}from"./write-file-CFByoJkN.mjs";import"./constants.mjs";import{t as Y}from"./get-parent-path-DLFSyxSW.mjs";import{a as X,c as Z,d as Q,i as $,l as ee,n as te,o as ne,r as re,s as ie,t as ae,u as oe}from"./resolve-C_YsCFne.mjs";import{n as se,t as ce}from"./install-B3bIjHoU.mjs";import{i as le,n as ue,r as de,t as fe}from"./json-Dp4PSH2i.mjs";import{a as pe,i as me,n as he,o as ge,r as _e,s as ve,t as ye}from"./package-fns-C7-MKgBR.mjs";import{a as be,i as xe,n as Se,r as Ce,t as we}from"./registry-B1taIPKm.mjs";import{n as Te,t as Ee}from"./remove-file-BM64Brdf.mjs";import{a as De,c as Oe,i as ke,l as Ae,n as je,o as Me,r as Ne,s as Pe,t as Fe,u as Ie}from"./semver-fns-F_rYnwDq.mjs";import{i as Le,n as Re,r as ze,t as Be}from"./toml-CIgLQmP3.mjs";import{t as Ve}from"./tsconfig-CqvvSVuX.mjs";import{n as He,t as Ue}from"./yaml-CLMo56UG.mjs";export{ae as DEFAULT_EXTENSIONS,s as PROJECT_ROOT_CONTENT,r as WORKSPACE_ROOT_CONTENT,k as chmodX,E as chmodXSync,Fe as coerceVersion,j as commandExists,A as commandExistsSync,M as compressDirectory,d as copyFile,l as copyFileSync,u as copyFiles,c as copyFilesSync,y as createDirectory,g as createDirectorySync,je as deriveNewSemverVersion,ye as doesPackageMatch,p as exists,f as existsSync,v as extractFileFromTar,h as extractFileFromTarGzip,we as formatNodeOptions,Se as getFormattedNodeOptionsWithoutInspect,te as getNodeModulesPaths,he as getPackageInfo,_e as getPackageListing,me as getPackageManager,Y as getParentPath,Ce as getParsedNodeOptionsWithoutInspect,a as getProjectRoot,xe as getRegistry,re as getResolutionCombinations,$ as getResolutionPaths,n as getWorkspaceRoot,X as importModule,ce as install,I as isDirectory,P as isDirectorySymlink,O as isExecutable,T as isExecutableSync,F as isFile,N as isFileSymlink,pe as isPackageExists,ge as isPackageListed,e as isProjectRoot,Ne as isRange,ke as isRelativeVersionKeyword,De as isSemver,Me as isValidRange,Pe as isValidSemver,Oe as isValidVersion,i as isWorkspaceRoot,w as isWritable,D as isWritableSync,H as list,z as listDirectories,V as listDirectoriesSync,R as listFiles,L as listFilesSync,B as listSync,ve as loadPackageJson,Ve as loadTsConfig,se as packageExists,Ae as parseVersion,K as readFile,C as readFileBuffer,x as readFileBufferSync,W as readFileIfExisting,G as readFileIfExistingSync,U as readFileSync,fe as readJsonFile,ue as readJsonFileSync,Be as readTomlFile,Re as readTomlFileSync,Ue as readYamlFile,He as readYamlFileSync,o as relativeToProjectRoot,t as relativeToWorkspaceRoot,m as removeDirectory,_ as removeDirectorySync,Ee as removeFile,Te as removeFileSync,ne as resolve,ie as resolvePackage,Z as resolvePackageSync,ee as resolveSafe,oe as resolveSafeSync,Q as resolveSync,Ie as satisfiesVersion,be as tokenizeArgs,J as writeFile,S as writeFileBuffer,b as writeFileBufferSync,q as writeFileSync,de as writeJsonFile,le as writeJsonFileSync,ze as writeTomlFile,Le as writeTomlFileSync};
1
+ import{exists as e,existsSync as t}from"./exists.mjs";import{createDirectory as n,createDirectorySync as r,extractFileFromTar as i,extractFileFromTarGzip as a,removeDirectory as o,removeDirectorySync as s}from"./helpers.mjs";import{readFileBuffer as c,readFileBufferSync as l,writeFileBuffer as u,writeFileBufferSync as d}from"./buffer.mjs";import{chmodX as f,chmodXSync as p,isExecutable as m,isExecutableSync as h,isWritable as g,isWritableSync as _}from"./chmod-x.mjs";import{commandExists as v,commandExistsSync as y}from"./command-exists.mjs";import{isDirectory as b,isDirectorySymlink as x,isFile as S,isFileSymlink as C}from"./is-file.mjs";import{list as w,listDirectories as T,listDirectoriesSync as E,listFiles as D,listFilesSync as O,listSync as k}from"./list-files.mjs";import{readFile as A,readFileIfExisting as j,readFileIfExistingSync as M,readFileSync as N}from"./read-file.mjs";import{writeFile as P,writeFileSync as F}from"./write-file.mjs";import{compressDirectory as I}from"./compress.mjs";import{copyFile as L,copyFileSync as R,copyFiles as z,copyFilesSync as B}from"./copy-file.mjs";import{getParentPath as V}from"./get-parent-path.mjs";import{PROJECT_ROOT_CONTENT as H,WORKSPACE_ROOT_CONTENT as U,getProjectRoot as W,getWorkspaceRoot as G,isProjectRoot as K,isWorkspaceRoot as q,relativeToProjectRoot as J,relativeToWorkspaceRoot as Y}from"./get-workspace-root.mjs";import{DEFAULT_EXTENSIONS as X,getNodeModulesPaths as Z,getResolutionCombinations as Q,getResolutionPaths as $,importModule as ee,resolve as te,resolvePackage as ne,resolvePackageSync as re,resolveSafe as ie,resolveSafeSync as ae,resolveSync as oe}from"./resolve.mjs";import{install as se,packageExists as ce}from"./install.mjs";import{readJsonFile as le,readJsonFileSync as ue,writeJsonFile as de,writeJsonFileSync as fe}from"./json.mjs";import{doesPackageMatch as pe,getPackageInfo as me,getPackageListing as he,getPackageManager as ge,isPackageExists as _e,isPackageListed as ve,loadPackageJson as ye}from"./package-fns.mjs";import{formatNodeOptions as be,getFormattedNodeOptionsWithoutInspect as xe,getParsedNodeOptionsWithoutInspect as Se,getRegistry as Ce,tokenizeArgs as we}from"./registry.mjs";import{removeFile as Te,removeFileSync as Ee}from"./remove-file.mjs";import{coerceVersion as De,deriveNewSemverVersion as Oe,isRange as ke,isRelativeVersionKeyword as Ae,isSemver as je,isValidRange as Me,isValidSemver as Ne,isValidVersion as Pe,parseVersion as Fe,satisfiesVersion as Ie}from"./semver-fns.mjs";import{readTomlFile as Le,readTomlFileSync as Re,writeTomlFile as ze,writeTomlFileSync as Be}from"./toml.mjs";import{loadTsConfig as Ve}from"./tsconfig.mjs";import{readYamlFile as He,readYamlFileSync as Ue}from"./yaml.mjs";export{X as DEFAULT_EXTENSIONS,H as PROJECT_ROOT_CONTENT,U as WORKSPACE_ROOT_CONTENT,f as chmodX,p as chmodXSync,De as coerceVersion,v as commandExists,y as commandExistsSync,I as compressDirectory,L as copyFile,R as copyFileSync,z as copyFiles,B as copyFilesSync,n as createDirectory,r as createDirectorySync,Oe as deriveNewSemverVersion,pe as doesPackageMatch,e as exists,t as existsSync,i as extractFileFromTar,a as extractFileFromTarGzip,be as formatNodeOptions,xe as getFormattedNodeOptionsWithoutInspect,Z as getNodeModulesPaths,me as getPackageInfo,he as getPackageListing,ge as getPackageManager,V as getParentPath,Se as getParsedNodeOptionsWithoutInspect,W as getProjectRoot,Ce as getRegistry,Q as getResolutionCombinations,$ as getResolutionPaths,G as getWorkspaceRoot,ee as importModule,se as install,b as isDirectory,x as isDirectorySymlink,m as isExecutable,h as isExecutableSync,S as isFile,C as isFileSymlink,_e as isPackageExists,ve as isPackageListed,K as isProjectRoot,ke as isRange,Ae as isRelativeVersionKeyword,je as isSemver,Me as isValidRange,Ne as isValidSemver,Pe as isValidVersion,q as isWorkspaceRoot,g as isWritable,_ as isWritableSync,w as list,T as listDirectories,E as listDirectoriesSync,D as listFiles,O as listFilesSync,k as listSync,ye as loadPackageJson,Ve as loadTsConfig,ce as packageExists,Fe as parseVersion,A as readFile,c as readFileBuffer,l as readFileBufferSync,j as readFileIfExisting,M as readFileIfExistingSync,N as readFileSync,le as readJsonFile,ue as readJsonFileSync,Le as readTomlFile,Re as readTomlFileSync,He as readYamlFile,Ue as readYamlFileSync,J as relativeToProjectRoot,Y as relativeToWorkspaceRoot,o as removeDirectory,s as removeDirectorySync,Te as removeFile,Ee as removeFileSync,te as resolve,ne as resolvePackage,re as resolvePackageSync,ie as resolveSafe,ae as resolveSafeSync,oe as resolveSync,Ie as satisfiesVersion,we as tokenizeArgs,P as writeFile,u as writeFileBuffer,d as writeFileBufferSync,F as writeFileSync,de as writeJsonFile,fe as writeJsonFileSync,ze as writeTomlFile,Be as writeTomlFileSync};
package/dist/install.cjs CHANGED
@@ -1 +1 @@
1
- require(`./get-workspace-root-CCNjjZGY.cjs`),require(`./resolve-DTkLQekH.cjs`);const e=require(`./install-CZ_S7NHm.cjs`);exports.install=e.t,exports.packageExists=e.n;
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./path/src/cwd.cjs`),n=require(`./resolve.cjs`);let r=require(`@antfu/install-pkg`);require(`tinyexec`);async function i(e,t){return(0,r.installPackage)(e,t)}const a=async(e,r)=>{let a=await n.resolve(r?.cwd||t.cwd());try{await n.resolve(e,{paths:[a]})}catch{await i(e,r)}};exports.install=i,exports.packageExists=a;
@@ -1,2 +1,28 @@
1
- import { n as packageExists, t as install } from "./install-CxPsLO2t.cjs";
2
- export { install, packageExists };
1
+ import { InstallPackageOptions, installPackage } from "@antfu/install-pkg";
2
+
3
+ //#region src/install.d.ts
4
+
5
+ /**
6
+ * Install a specific package
7
+ *
8
+ * @param name - The name of the package to install
9
+ * @param options - The options to use when installing the package
10
+ */
11
+ declare function install(name: string, options?: InstallPackageOptions): Promise<ReturnType<typeof installPackage>>;
12
+ /**
13
+ * Install a list of packages
14
+ *
15
+ * @param names - The list of package names to install
16
+ * @param options - The options to use when installing the package
17
+ */
18
+ declare function install(names: string[], options?: InstallPackageOptions): Promise<ReturnType<typeof installPackage>>;
19
+ /**
20
+ * Check if a package exists and install it if it does not
21
+ *
22
+ * @param name - The name of the package to check
23
+ * @param options - The options to use when installing the package
24
+ */
25
+ declare const packageExists: (name: string, options?: InstallPackageOptions) => Promise<void>;
26
+ //#endregion
27
+ export { install, packageExists };
28
+ //# sourceMappingURL=install.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.cts","names":[],"sources":["../src/install.ts"],"sourcesContent":[],"mappings":";;;;AA8BA;;;;;;AAWsB,iBAXA,OAAA,CAWO,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EATjB,qBASiB,CAAA,EAR1B,OAQ0B,CARlB,UAQkB,CAAA,OARA,cAQA,CAAA,CAAA;;;;;;AAyB7B;iBAzBsB,OAAA,4BAEV,wBACT,QAAQ,kBAAkB;;;;;;;cAsBhB,wCAED,0BAAqB"}
@@ -1,2 +1,29 @@
1
- import { n as packageExists, t as install } from "./install-dYt7hlQn.mjs";
2
- export { install, packageExists };
1
+ import { InstallPackageOptions, installPackage } from "@antfu/install-pkg";
2
+ import "tinyexec";
3
+
4
+ //#region src/install.d.ts
5
+
6
+ /**
7
+ * Install a specific package
8
+ *
9
+ * @param name - The name of the package to install
10
+ * @param options - The options to use when installing the package
11
+ */
12
+ declare function install(name: string, options?: InstallPackageOptions): Promise<ReturnType<typeof installPackage>>;
13
+ /**
14
+ * Install a list of packages
15
+ *
16
+ * @param names - The list of package names to install
17
+ * @param options - The options to use when installing the package
18
+ */
19
+ declare function install(names: string[], options?: InstallPackageOptions): Promise<ReturnType<typeof installPackage>>;
20
+ /**
21
+ * Check if a package exists and install it if it does not
22
+ *
23
+ * @param name - The name of the package to check
24
+ * @param options - The options to use when installing the package
25
+ */
26
+ declare const packageExists: (name: string, options?: InstallPackageOptions) => Promise<void>;
27
+ //#endregion
28
+ export { install, packageExists };
29
+ //# sourceMappingURL=install.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.mts","names":[],"sources":["../src/install.ts"],"sourcesContent":[],"mappings":";;;;;;AA8BA;;;;;AAGU,iBAHY,OAAA,CAGZ,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EADE,qBACF,CAAA,EAAP,OAAO,CAAC,UAAD,CAAA,OAAmB,cAAnB,CAAA,CAAA;AAQV;;;;;;AAyBa,iBAzBS,OAAA,CA2BV,KAAA,EAAA,MAAA,EAAA,EAAA,OAAqB,CAAA,EAzBrB,qBAyBqB,CAAA,EAxB9B,OAwB8B,CAxBtB,UAwBsB,CAAA,OAxBJ,cAwBI,CAAA,CAAA;;;;;;;cAFpB,wCAED,0BAAqB"}
package/dist/install.mjs CHANGED
@@ -1 +1,2 @@
1
- import"./get-workspace-root-k66w-wLW.mjs";import"./resolve-C_YsCFne.mjs";import{n as e,t}from"./install-B3bIjHoU.mjs";export{t as install,e as packageExists};
1
+ import{cwd as e}from"./path/src/cwd.mjs";import{resolve as t}from"./resolve.mjs";import{installPackage as n}from"@antfu/install-pkg";import"tinyexec";async function r(e,t){return n(e,t)}const i=async(n,i)=>{let a=await t(i?.cwd||e());try{await t(n,{paths:[a]})}catch{await r(n,i)}};export{r as install,i as packageExists};
2
+ //# sourceMappingURL=install.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.mjs","names":[],"sources":["../src/install.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 type { InstallPackageOptions } from \"@antfu/install-pkg\";\nimport { installPackage } from \"@antfu/install-pkg\";\nimport { cwd } from \"@stryke/path/cwd\";\nimport \"tinyexec\";\nimport { resolve } from \"./resolve\";\n\n/**\n * Install a specific package\n *\n * @param name - The name of the package to install\n * @param options - The options to use when installing the package\n */\nexport async function install(\n name: string,\n options?: InstallPackageOptions\n): Promise<ReturnType<typeof installPackage>>;\n\n/**\n * Install a list of packages\n *\n * @param names - The list of package names to install\n * @param options - The options to use when installing the package\n */\nexport async function install(\n names: string[],\n options?: InstallPackageOptions\n): Promise<ReturnType<typeof installPackage>>;\n\n/**\n * Install a specific or list of packages\n *\n * @param nameOrNames - The name or names of packages to install\n * @param options - The options to use when installing the package\n * @returns The result of the command or an exception\n */\nexport async function install(\n nameOrNames: string | string[],\n options?: InstallPackageOptions\n): Promise<ReturnType<typeof installPackage>> {\n return installPackage(nameOrNames, options);\n}\n\n/**\n * Check if a package exists and install it if it does not\n *\n * @param name - The name of the package to check\n * @param options - The options to use when installing the package\n */\nexport const packageExists = async (\n name: string,\n options?: InstallPackageOptions\n) => {\n const resolvePath = await resolve(options?.cwd || cwd());\n try {\n await resolve(name, { paths: [resolvePath] });\n } catch {\n await install(name, options);\n }\n};\n"],"mappings":"sJAqDA,eAAsB,EACpB,EACA,EAC4C,CAC5C,OAAO,EAAe,EAAa,EAAQ,CAS7C,MAAa,EAAgB,MAC3B,EACA,IACG,CACH,IAAM,EAAc,MAAM,EAAQ,GAAS,KAAO,GAAK,CAAC,CACxD,GAAI,CACF,MAAM,EAAQ,EAAM,CAAE,MAAO,CAAC,EAAY,CAAE,CAAC,MACvC,CACN,MAAM,EAAQ,EAAM,EAAQ"}
package/dist/is-file.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./is-file-BkFQev3M.cjs`);exports.isDirectory=e.t,exports.isDirectorySymlink=e.n,exports.isFile=e.r,exports.isFileSymlink=e.i;
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./path/src/join-paths.cjs`);let n=require(`node:fs`);function r(e,r){return!!(0,n.statSync)(r?t.joinPaths(r,e):e,{throwIfNoEntry:!1})?.isFile()}function i(e,r){return!!(0,n.statSync)(r?t.joinPaths(r,e):e,{throwIfNoEntry:!1})?.isDirectory()}const a=(e,r)=>!!(0,n.lstatSync)(r?t.joinPaths(r,e):e,{throwIfNoEntry:!1})?.isFile(),o=(e,r)=>!!(0,n.lstatSync)(r?t.joinPaths(r,e):e,{throwIfNoEntry:!1})?.isDirectory();exports.isDirectory=i,exports.isDirectorySymlink=o,exports.isFile=r,exports.isFileSymlink=a;
@@ -1,2 +1,36 @@
1
- import { i as isFileSymlink, n as isDirectorySymlink, r as isFile, t as isDirectory } from "./is-file-DoBi2FN9.cjs";
2
- export { isDirectory, isDirectorySymlink, isFile, isFileSymlink };
1
+ //#region src/is-file.d.ts
2
+ /**
3
+ * Check if the given path is a file.
4
+ *
5
+ * @param path - The location to check
6
+ * @param additionalPath - An optional additional path to add to the start of the path
7
+ * @returns An indicator specifying if the path is a file
8
+ */
9
+ declare function isFile(path: string, additionalPath?: string): boolean;
10
+ /**
11
+ * Check if the given path is a directory.
12
+ *
13
+ * @param path - The location to check
14
+ * @param additionalPath - An optional additional path to add to the start of the path
15
+ * @returns An indicator specifying if the path is a directory
16
+ */
17
+ declare function isDirectory(path: string, additionalPath?: string): boolean;
18
+ /**
19
+ * Check if the given path is a file . Does not dereference symbolic links.
20
+ *
21
+ * @param path - The location to check
22
+ * @param additionalPath - An optional additional path to add to the start of the path
23
+ * @returns An indicator specifying if the path is a file
24
+ */
25
+ declare const isFileSymlink: (path: string, additionalPath?: string) => boolean;
26
+ /**
27
+ * Check if the given path is a directory. Does not dereference symbolic links.
28
+ *
29
+ * @param path - The location to check
30
+ * @param additionalPath - An optional additional path to add to the start of the path
31
+ * @returns An indicator specifying if the path is a directory
32
+ */
33
+ declare const isDirectorySymlink: (path: string, additionalPath?: string) => boolean;
34
+ //#endregion
35
+ export { isDirectory, isDirectorySymlink, isFile, isFileSymlink };
36
+ //# sourceMappingURL=is-file.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-file.d.cts","names":[],"sources":["../src/is-file.ts"],"sourcesContent":[],"mappings":";;AA4BA;AAeA;AAeA;AAkBA;;;iBAhDgB,MAAA;;;;;;;;iBAeA,WAAA;;;;;;;;cAeH;;;;;;;;cAkBA"}
@@ -1,2 +1,36 @@
1
- import { i as isFileSymlink, n as isDirectorySymlink, r as isFile, t as isDirectory } from "./is-file-DjqOQrqY.mjs";
2
- export { isDirectory, isDirectorySymlink, isFile, isFileSymlink };
1
+ //#region src/is-file.d.ts
2
+ /**
3
+ * Check if the given path is a file.
4
+ *
5
+ * @param path - The location to check
6
+ * @param additionalPath - An optional additional path to add to the start of the path
7
+ * @returns An indicator specifying if the path is a file
8
+ */
9
+ declare function isFile(path: string, additionalPath?: string): boolean;
10
+ /**
11
+ * Check if the given path is a directory.
12
+ *
13
+ * @param path - The location to check
14
+ * @param additionalPath - An optional additional path to add to the start of the path
15
+ * @returns An indicator specifying if the path is a directory
16
+ */
17
+ declare function isDirectory(path: string, additionalPath?: string): boolean;
18
+ /**
19
+ * Check if the given path is a file . Does not dereference symbolic links.
20
+ *
21
+ * @param path - The location to check
22
+ * @param additionalPath - An optional additional path to add to the start of the path
23
+ * @returns An indicator specifying if the path is a file
24
+ */
25
+ declare const isFileSymlink: (path: string, additionalPath?: string) => boolean;
26
+ /**
27
+ * Check if the given path is a directory. Does not dereference symbolic links.
28
+ *
29
+ * @param path - The location to check
30
+ * @param additionalPath - An optional additional path to add to the start of the path
31
+ * @returns An indicator specifying if the path is a directory
32
+ */
33
+ declare const isDirectorySymlink: (path: string, additionalPath?: string) => boolean;
34
+ //#endregion
35
+ export { isDirectory, isDirectorySymlink, isFile, isFileSymlink };
36
+ //# sourceMappingURL=is-file.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-file.d.mts","names":[],"sources":["../src/is-file.ts"],"sourcesContent":[],"mappings":";;AA4BA;AAeA;AAeA;AAkBA;;;iBAhDgB,MAAA;;;;;;;;iBAeA,WAAA;;;;;;;;cAeH;;;;;;;;cAkBA"}
package/dist/is-file.mjs CHANGED
@@ -1 +1,2 @@
1
- import{i as e,n as t,r as n,t as r}from"./is-file-CNooe8Wz.mjs";export{r as isDirectory,t as isDirectorySymlink,n as isFile,e as isFileSymlink};
1
+ import{joinPaths as e}from"./path/src/join-paths.mjs";import{lstatSync as t,statSync as n}from"node:fs";function r(t,r){return!!n(r?e(r,t):t,{throwIfNoEntry:!1})?.isFile()}function i(t,r){return!!n(r?e(r,t):t,{throwIfNoEntry:!1})?.isDirectory()}const a=(n,r)=>!!t(r?e(r,n):n,{throwIfNoEntry:!1})?.isFile(),o=(n,r)=>!!t(r?e(r,n):n,{throwIfNoEntry:!1})?.isDirectory();export{i as isDirectory,o as isDirectorySymlink,r as isFile,a as isFileSymlink};
2
+ //# sourceMappingURL=is-file.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-file.mjs","names":[],"sources":["../src/is-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 { joinPaths } from \"@stryke/path/join-paths\";\nimport { lstatSync, statSync } from \"node:fs\";\n\n/**\n * Check if the given path is a file.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a file\n */\nexport function isFile(path: string, additionalPath?: string): boolean {\n return Boolean(\n statSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isFile()\n );\n}\n\n/**\n * Check if the given path is a directory.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a directory\n */\nexport function isDirectory(path: string, additionalPath?: string): boolean {\n return Boolean(\n statSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isDirectory()\n );\n}\n\n/**\n * Check if the given path is a file . Does not dereference symbolic links.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a file\n */\nexport const isFileSymlink = (\n path: string,\n additionalPath?: string\n): boolean => {\n return Boolean(\n lstatSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isFile()\n );\n};\n\n/**\n * Check if the given path is a directory. Does not dereference symbolic links.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a directory\n */\nexport const isDirectorySymlink = (\n path: string,\n additionalPath?: string\n): boolean => {\n return Boolean(\n lstatSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isDirectory()\n );\n};\n"],"mappings":"wGA4BA,SAAgB,EAAO,EAAc,EAAkC,CACrE,MAAO,EACL,EAAS,EAAiB,EAAU,EAAgB,EAAK,CAAG,EAAM,CAChE,eAAgB,GACjB,CAAC,EAAE,QAAQ,CAWhB,SAAgB,EAAY,EAAc,EAAkC,CAC1E,MAAO,EACL,EAAS,EAAiB,EAAU,EAAgB,EAAK,CAAG,EAAM,CAChE,eAAgB,GACjB,CAAC,EAAE,aAAa,CAWrB,MAAa,GACX,EACA,IAEO,EACL,EAAU,EAAiB,EAAU,EAAgB,EAAK,CAAG,EAAM,CACjE,eAAgB,GACjB,CAAC,EAAE,QAAQ,CAWH,GACX,EACA,IAEO,EACL,EAAU,EAAiB,EAAU,EAAgB,EAAK,CAAG,EAAM,CACjE,eAAgB,GACjB,CAAC,EAAE,aAAa"}
@@ -0,0 +1 @@
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`../../type-checks/src/is-string.cjs`),n=require(`../../type-checks/src/is-object.cjs`),r=require(`./utils/parse.cjs`),i=require(`./utils/parse-error.cjs`),a=require(`./utils/stringify.cjs`);let o=require(`node:buffer`),s=require(`jsonc-parser`),c=require(`superjson`);c=e.__toESM(c);var l=class e extends c.default{static#e;static get instance(){return e.#e||=new e,e.#e}static deserialize(t){return e.instance.deserialize(t)}static serialize(t){return e.instance.serialize(t)}static parse(e){return r.parse(e)}static stringify(t,n){let r=e.instance.customTransformerRegistry.findApplicable(t),i=t;return r&&r.isApplicable(t)&&(i=r.serialize(i)),a.stringify(i)}static parseJson(t,n){try{if(n?.expectComments===!1)return e.instance.parse(t)}catch{}let r=[],a=(0,s.parse)(t,r,{allowTrailingComma:!0,...n});if(r.length>0&&r[0])throw Error(i.formatParseError(t,r[0]));return a}static register(t,n,r,i){e.instance.registerCustom({isApplicable:i,serialize:n,deserialize:r},t)}static registerClass(r,i){e.instance.registerClass(r,{identifier:t.isString(i)?i:i?.identifier||r.name,allowProps:i&&n.isObject(i)&&i?.allowProps&&Array.isArray(i.allowProps)?i.allowProps:[`__typename`]})}constructor(){super({dedupe:!0})}};l.instance.registerCustom({isApplicable:e=>o.Buffer.isBuffer(e),serialize:e=>e.toString(`base64`),deserialize:e=>o.Buffer.from(e,`base64`)},`Bytes`),exports.StormJSON=l;
@@ -0,0 +1,2 @@
1
+ import{isString as e}from"../../type-checks/src/is-string.mjs";import{isObject as t}from"../../type-checks/src/is-object.mjs";import{parse as n}from"./utils/parse.mjs";import{formatParseError as r}from"./utils/parse-error.mjs";import{stringify as i}from"./utils/stringify.mjs";import{Buffer as a}from"node:buffer";import{parse as o}from"jsonc-parser";import s from"superjson";var c=class a extends s{static#e;static get instance(){return a.#e||=new a,a.#e}static deserialize(e){return a.instance.deserialize(e)}static serialize(e){return a.instance.serialize(e)}static parse(e){return n(e)}static stringify(e,t){let n=a.instance.customTransformerRegistry.findApplicable(e),r=e;return n&&n.isApplicable(e)&&(r=n.serialize(r)),i(r)}static parseJson(e,t){try{if(t?.expectComments===!1)return a.instance.parse(e)}catch{}let n=[],i=o(e,n,{allowTrailingComma:!0,...t});if(n.length>0&&n[0])throw Error(r(e,n[0]));return i}static register(e,t,n,r){a.instance.registerCustom({isApplicable:r,serialize:t,deserialize:n},e)}static registerClass(n,r){a.instance.registerClass(n,{identifier:e(r)?r:r?.identifier||n.name,allowProps:r&&t(r)&&r?.allowProps&&Array.isArray(r.allowProps)?r.allowProps:[`__typename`]})}constructor(){super({dedupe:!0})}};c.instance.registerCustom({isApplicable:e=>a.isBuffer(e),serialize:e=>e.toString(`base64`),deserialize:e=>a.from(e,`base64`)},`Bytes`);export{c as StormJSON};
2
+ //# sourceMappingURL=storm-json.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storm-json.mjs","names":["#instance","parseValue","stringifyValue","errors: ParseError[]"],"sources":["../../../../json/src/storm-json.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 type { ParseError } from \"jsonc-parser\";\nimport type {\n Class,\n JsonParseOptions,\n JsonParserResult,\n JsonSerializeOptions,\n JsonValue\n} from \"./types\";\n// import { Decimal } from \"decimal.js\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { parse } from \"jsonc-parser\";\nimport { Buffer } from \"node:buffer\";\nimport SuperJSON from \"superjson\";\nimport { parse as parseValue } from \"./utils/parse\";\nimport { formatParseError } from \"./utils/parse-error\";\nimport { stringify as stringifyValue } from \"./utils/stringify\";\n\n/**\n * A static JSON parser class used by Storm Software to serialize and deserialize JSON data\n *\n * @remarks\n * This class uses the [SuperJSON](https://github.com/blitz-js/superjson) library under the hood.\n */\nexport class StormJSON extends SuperJSON {\n static #instance: StormJSON;\n\n public static get instance(): StormJSON {\n if (!StormJSON.#instance) {\n StormJSON.#instance = new StormJSON();\n }\n\n return StormJSON.#instance;\n }\n\n /**\n * Deserialize the given value with superjson using the given metadata\n */\n public static override deserialize<TData = unknown>(\n payload: JsonParserResult\n ): TData {\n return StormJSON.instance.deserialize(payload);\n }\n\n /**\n * Serialize the given value with superjson\n */\n public static override serialize(object: JsonValue): JsonParserResult {\n return StormJSON.instance.serialize(object);\n }\n\n /**\n * Parse the given string value with superjson using the given metadata\n *\n * @param value - The string value to parse\n * @returns The parsed data\n */\n public static override parse<TData = unknown>(value: string): TData {\n return parseValue(value);\n }\n\n /**\n * Serializes the given data to a JSON string.\n * By default the JSON string is formatted with a 2 space indentation to be easy readable.\n *\n * @param value - Object which should be serialized to JSON\n * @param _options - JSON serialize options\n * @returns the formatted JSON representation of the object\n */\n public static override stringify<T>(\n value: T,\n _options?: JsonSerializeOptions\n ): string {\n const customTransformer =\n StormJSON.instance.customTransformerRegistry.findApplicable(value);\n\n let result = value;\n if (customTransformer && customTransformer.isApplicable(value)) {\n result = customTransformer.serialize(result) as T;\n }\n\n return stringifyValue(result);\n }\n\n /**\n * Parses the given JSON string and returns the object the JSON content represents.\n * By default javascript-style comments and trailing commas are allowed.\n *\n * @param strData - JSON content as string\n * @param options - JSON parse options\n * @returns Object the JSON content represents\n */\n public static parseJson<TData = unknown>(\n strData: string,\n options?: JsonParseOptions\n ): TData {\n try {\n if (options?.expectComments === false) {\n return StormJSON.instance.parse(strData);\n }\n } catch {\n // Do nothing\n }\n\n const errors: ParseError[] = [];\n const opts = {\n allowTrailingComma: true,\n ...options\n };\n const result = parse(strData, errors, opts) as TData;\n\n if (errors.length > 0 && errors[0]) {\n throw new Error(formatParseError(strData, errors[0]));\n }\n\n return result;\n }\n\n /**\n * Register a custom schema with superjson\n *\n * @param name - The name of the schema\n * @param serialize - The function to serialize the schema\n * @param deserialize - The function to deserialize the schema\n * @param isApplicable - The function to check if the schema is applicable\n */\n public static register<\n TData = any,\n TJsonObject extends JsonValue = JsonValue\n >(\n name: string,\n serialize: (data: TData) => TJsonObject,\n deserialize: (json: TJsonObject) => TData,\n isApplicable: (data: any) => data is TData\n ) {\n StormJSON.instance.registerCustom<TData, TJsonObject>(\n {\n isApplicable,\n serialize,\n deserialize\n },\n name\n );\n }\n\n /**\n * Register a class with superjson\n *\n * @param classConstructor - The class constructor to register\n */\n public static override registerClass(\n classConstructor: Class,\n options?: { identifier?: string; allowProps?: string[] } | string\n ) {\n StormJSON.instance.registerClass(classConstructor, {\n identifier: isString(options)\n ? options\n : options?.identifier || classConstructor.name,\n allowProps:\n options &&\n isObject(options) &&\n options?.allowProps &&\n Array.isArray(options.allowProps)\n ? options.allowProps\n : [\"__typename\"]\n });\n }\n\n private constructor() {\n super({ dedupe: true });\n }\n}\n\nStormJSON.instance.registerCustom<Buffer, string>(\n {\n isApplicable: (v): v is Buffer => Buffer.isBuffer(v),\n serialize: v => v.toString(\"base64\"),\n deserialize: v => Buffer.from(v, \"base64\")\n },\n \"Bytes\"\n);\n"],"mappings":"wXA0CA,IAAa,EAAb,MAAa,UAAkB,CAAU,CACvC,OAAA,EAEA,WAAkB,UAAsB,CAKtC,MAJA,CACE,GAAA,IAAsB,IAAI,EAGrB,GAAA,EAMT,OAAuB,YACrB,EACO,CACP,OAAO,EAAU,SAAS,YAAY,EAAQ,CAMhD,OAAuB,UAAU,EAAqC,CACpE,OAAO,EAAU,SAAS,UAAU,EAAO,CAS7C,OAAuB,MAAuB,EAAsB,CAClE,OAAOC,EAAW,EAAM,CAW1B,OAAuB,UACrB,EACA,EACQ,CACR,IAAM,EACJ,EAAU,SAAS,0BAA0B,eAAe,EAAM,CAEhE,EAAS,EAKb,OAJI,GAAqB,EAAkB,aAAa,EAAM,GAC5D,EAAS,EAAkB,UAAU,EAAO,EAGvCC,EAAe,EAAO,CAW/B,OAAc,UACZ,EACA,EACO,CACP,GAAI,CACF,GAAI,GAAS,iBAAmB,GAC9B,OAAO,EAAU,SAAS,MAAM,EAAQ,MAEpC,EAIR,IAAMC,EAAuB,EAAE,CAKzB,EAAS,EAAM,EAAS,EAJjB,CACX,mBAAoB,GACpB,GAAG,EACJ,CAC0C,CAE3C,GAAI,EAAO,OAAS,GAAK,EAAO,GAC9B,MAAU,MAAM,EAAiB,EAAS,EAAO,GAAG,CAAC,CAGvD,OAAO,EAWT,OAAc,SAIZ,EACA,EACA,EACA,EACA,CACA,EAAU,SAAS,eACjB,CACE,eACA,YACA,cACD,CACD,EACD,CAQH,OAAuB,cACrB,EACA,EACA,CACA,EAAU,SAAS,cAAc,EAAkB,CACjD,WAAY,EAAS,EAAQ,CACzB,EACA,GAAS,YAAc,EAAiB,KAC5C,WACE,GACA,EAAS,EAAQ,EACjB,GAAS,YACT,MAAM,QAAQ,EAAQ,WAAW,CAC7B,EAAQ,WACR,CAAC,aAAa,CACrB,CAAC,CAGJ,aAAsB,CACpB,MAAM,CAAE,OAAQ,GAAM,CAAC,GAI3B,EAAU,SAAS,eACjB,CACE,aAAe,GAAmB,EAAO,SAAS,EAAE,CACpD,UAAW,GAAK,EAAE,SAAS,SAAS,CACpC,YAAa,GAAK,EAAO,KAAK,EAAG,SAAS,CAC3C,CACD,QACD"}
@@ -0,0 +1,33 @@
1
+ import { ParseOptions } from "jsonc-parser";
2
+
3
+ //#region ../json/src/types.d.ts
4
+
5
+ interface JsonParseOptions extends ParseOptions {
6
+ /**
7
+ * Expect JSON with javascript-style
8
+ *
9
+ * @defaultValue false
10
+ */
11
+ expectComments?: boolean;
12
+ /**
13
+ * Disallow javascript-style
14
+ *
15
+ * @defaultValue false
16
+ */
17
+ disallowComments?: boolean;
18
+ /**
19
+ * Allow trailing commas in the JSON content
20
+ */
21
+ allowTrailingComma?: boolean;
22
+ }
23
+ interface JsonSerializeOptions {
24
+ /**
25
+ * the whitespaces to add as indentation to make the output more readable.
26
+ *
27
+ * @defaultValue 2
28
+ */
29
+ spaces?: number;
30
+ }
31
+ //#endregion
32
+ export { JsonParseOptions, JsonSerializeOptions };
33
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../../../json/src/types.ts"],"sourcesContent":[],"mappings":";;;;UAsEiB,gBAAA,SAAyB;;;;;;;;;;;;;;;;;;UAqBzB,oBAAA"}
@@ -0,0 +1,33 @@
1
+ import { ParseOptions } from "jsonc-parser";
2
+
3
+ //#region ../json/src/types.d.ts
4
+
5
+ interface JsonParseOptions extends ParseOptions {
6
+ /**
7
+ * Expect JSON with javascript-style
8
+ *
9
+ * @defaultValue false
10
+ */
11
+ expectComments?: boolean;
12
+ /**
13
+ * Disallow javascript-style
14
+ *
15
+ * @defaultValue false
16
+ */
17
+ disallowComments?: boolean;
18
+ /**
19
+ * Allow trailing commas in the JSON content
20
+ */
21
+ allowTrailingComma?: boolean;
22
+ }
23
+ interface JsonSerializeOptions {
24
+ /**
25
+ * the whitespaces to add as indentation to make the output more readable.
26
+ *
27
+ * @defaultValue 2
28
+ */
29
+ spaces?: number;
30
+ }
31
+ //#endregion
32
+ export { JsonParseOptions, JsonSerializeOptions };
33
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../../../json/src/types.ts"],"sourcesContent":[],"mappings":";;;;UAsEiB,gBAAA,SAAyB;;;;;;;;;;;;;;;;;;UAqBzB,oBAAA"}
@@ -0,0 +1,3 @@
1
+ const e=/\r\n|[\n\r\u2028\u2029]/;function t(e,t,n={}){let r={column:0,line:-1,...e.start},i={...r,...e.end},{linesAbove:a=2,linesBelow:o=3}=n||{},s=r.line,c=r.column,l=i.line,u=i.column,d=Math.max(s-(a+1),0),f=Math.min(t.length,l+o);s===-1&&(d=0),l===-1&&(f=t.length);let p=l-s,m={};if(p)for(let e=0;e<=p;e++){let n=e+s;c?e===0?m[n]=[c,(t[n-1]?.length??0)-c+1]:e===p?m[n]=[0,u]:m[n]=[0,t[n-e]?.length??0]:m[n]=!0}else c===u?m[s]=c?[c,0]:!0:m[s]=[c,u-c];return{start:d,end:f,markerLines:m}}function n(n,r,i={}){let{start:a,end:o,markerLines:s}=t(r,n.split(e),i),c=String(o).length;return(i.highlight?i.highlight(n):n).split(e).slice(a,o).map((e,t)=>{let n=a+1+t,r=` ${` ${n}`.slice(-c)} | `,i=!!(s[n]??!1);if(i){let t=``;if(Array.isArray(i)){let n=e.slice(0,Math.max(i[0]-1,0)).replace(/[^\t]/g,` `),a=i[1]||1;t=[`
2
+ `,r.replace(/\d/g,` `),n,`^`.repeat(a)].join(``)}return[`>`,r,e,t].join(``)}return` ${r}${e}`}).join(`
3
+ `)}exports.codeFrameColumns=n;
@@ -0,0 +1,4 @@
1
+ const e=/\r\n|[\n\r\u2028\u2029]/;function t(e,t,n={}){let r={column:0,line:-1,...e.start},i={...r,...e.end},{linesAbove:a=2,linesBelow:o=3}=n||{},s=r.line,c=r.column,l=i.line,u=i.column,d=Math.max(s-(a+1),0),f=Math.min(t.length,l+o);s===-1&&(d=0),l===-1&&(f=t.length);let p=l-s,m={};if(p)for(let e=0;e<=p;e++){let n=e+s;c?e===0?m[n]=[c,(t[n-1]?.length??0)-c+1]:e===p?m[n]=[0,u]:m[n]=[0,t[n-e]?.length??0]:m[n]=!0}else c===u?m[s]=c?[c,0]:!0:m[s]=[c,u-c];return{start:d,end:f,markerLines:m}}function n(n,r,i={}){let{start:a,end:o,markerLines:s}=t(r,n.split(e),i),c=String(o).length;return(i.highlight?i.highlight(n):n).split(e).slice(a,o).map((e,t)=>{let n=a+1+t,r=` ${` ${n}`.slice(-c)} | `,i=!!(s[n]??!1);if(i){let t=``;if(Array.isArray(i)){let n=e.slice(0,Math.max(i[0]-1,0)).replace(/[^\t]/g,` `),a=i[1]||1;t=[`
2
+ `,r.replace(/\d/g,` `),n,`^`.repeat(a)].join(``)}return[`>`,r,e,t].join(``)}return` ${r}${e}`}).join(`
3
+ `)}export{n as codeFrameColumns};
4
+ //# sourceMappingURL=code-frames.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-frames.mjs","names":["startLoc: Location","endLoc: Location"],"sources":["../../../../../json/src/utils/code-frames.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\ninterface Location {\n column: number;\n line: number;\n}\n\ninterface NodeLocation {\n end?: Location;\n start?: Location;\n}\n\n// Adapted from https://raw.githubusercontent.com/babel/babel/4108524/packages/babel-code-frame/src/index.js\n\n/**\n * RegExp to test for newlines in terminal.\n */\nconst NEWLINE = /\\r\\n|[\\n\\r\\u2028\\u2029]/;\n\n/**\n * Extract what lines should be marked and highlighted.\n */\nfunction getMarkerLines(\n loc: NodeLocation,\n source: string[],\n opts: { linesAbove?: number; linesBelow?: number } = {}\n): {\n start: number;\n end: number;\n markerLines: Record<number, boolean | [number, number]>;\n} {\n const startLoc: Location = {\n column: 0,\n line: -1,\n ...loc.start\n };\n const endLoc: Location = {\n ...startLoc,\n ...loc.end\n };\n const { linesAbove = 2, linesBelow = 3 } = opts || {};\n const startLine = startLoc.line;\n const startColumn = startLoc.column;\n const endLine = endLoc.line;\n const endColumn = endLoc.column;\n\n let start = Math.max(startLine - (linesAbove + 1), 0);\n let end = Math.min(source.length, endLine + linesBelow);\n\n if (startLine === -1) {\n start = 0;\n }\n\n if (endLine === -1) {\n end = source.length;\n }\n\n const lineDiff = endLine - startLine;\n const markerLines = {} as Record<number, boolean | [number, number]>;\n\n if (lineDiff) {\n for (let i = 0; i <= lineDiff; i++) {\n const lineNumber = i + startLine;\n\n if (!startColumn) {\n markerLines[lineNumber] = true;\n } else if (i === 0) {\n const sourceLength = source[lineNumber - 1]?.length ?? 0;\n\n markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];\n } else if (i === lineDiff) {\n markerLines[lineNumber] = [0, endColumn];\n } else {\n const sourceLength = source[lineNumber - i]?.length ?? 0;\n\n markerLines[lineNumber] = [0, sourceLength];\n }\n }\n } else if (startColumn === endColumn) {\n markerLines[startLine] = startColumn ? [startColumn, 0] : true;\n } else {\n markerLines[startLine] = [startColumn, endColumn - startColumn];\n }\n\n return {\n start,\n end,\n markerLines\n };\n}\n\nexport function codeFrameColumns(\n rawLines: string,\n loc: NodeLocation,\n opts: {\n linesAbove?: number;\n linesBelow?: number;\n highlight?: (rawLines: string) => string;\n } = {}\n): string {\n const lines = rawLines.split(NEWLINE);\n const { start, end, markerLines } = getMarkerLines(loc, lines, opts);\n\n const numberMaxWidth = String(end).length;\n const highlightedLines = opts.highlight ? opts.highlight(rawLines) : rawLines;\n\n const frame = highlightedLines\n .split(NEWLINE)\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index;\n const paddedNumber = ` ${number}`.slice(-numberMaxWidth);\n const gutter = ` ${paddedNumber} | `;\n const hasMarker = Boolean(markerLines[number] ?? false);\n if (hasMarker) {\n let markerLine = \"\";\n if (Array.isArray(hasMarker)) {\n const markerSpacing = line\n .slice(0, Math.max(hasMarker[0] - 1, 0))\n .replace(/[^\\t]/g, \" \");\n const numberOfMarkers = hasMarker[1] || 1;\n\n markerLine = [\n \"\\n \",\n gutter.replace(/\\d/g, \" \"),\n markerSpacing,\n \"^\".repeat(numberOfMarkers)\n ].join(\"\");\n }\n return [\">\", gutter, line, markerLine].join(\"\");\n }\n return ` ${gutter}${line}`;\n })\n .join(\"\\n\");\n\n return frame;\n}\n"],"mappings":"AAiCA,MAAM,EAAU,0BAKhB,SAAS,EACP,EACA,EACA,EAAqD,EAAE,CAKvD,CACA,IAAMA,EAAqB,CACzB,OAAQ,EACR,KAAM,GACN,GAAG,EAAI,MACR,CACKC,EAAmB,CACvB,GAAG,EACH,GAAG,EAAI,IACR,CACK,CAAE,aAAa,EAAG,aAAa,GAAM,GAAQ,EAAE,CAC/C,EAAY,EAAS,KACrB,EAAc,EAAS,OACvB,EAAU,EAAO,KACjB,EAAY,EAAO,OAErB,EAAQ,KAAK,IAAI,GAAa,EAAa,GAAI,EAAE,CACjD,EAAM,KAAK,IAAI,EAAO,OAAQ,EAAU,EAAW,CAEnD,IAAc,KAChB,EAAQ,GAGN,IAAY,KACd,EAAM,EAAO,QAGf,IAAM,EAAW,EAAU,EACrB,EAAc,EAAE,CAEtB,GAAI,EACF,IAAK,IAAI,EAAI,EAAG,GAAK,EAAU,IAAK,CAClC,IAAM,EAAa,EAAI,EAElB,EAEM,IAAM,EAGf,EAAY,GAAc,CAAC,GAFN,EAAO,EAAa,IAAI,QAAU,GAEA,EAAc,EAAE,CAC9D,IAAM,EACf,EAAY,GAAc,CAAC,EAAG,EAAU,CAIxC,EAAY,GAAc,CAAC,EAFN,EAAO,EAAa,IAAI,QAAU,EAEZ,CAV3C,EAAY,GAAc,QAarB,IAAgB,EACzB,EAAY,GAAa,EAAc,CAAC,EAAa,EAAE,CAAG,GAE1D,EAAY,GAAa,CAAC,EAAa,EAAY,EAAY,CAGjE,MAAO,CACL,QACA,MACA,cACD,CAGH,SAAgB,EACd,EACA,EACA,EAII,EAAE,CACE,CAER,GAAM,CAAE,QAAO,MAAK,eAAgB,EAAe,EADrC,EAAS,MAAM,EAAQ,CAC0B,EAAK,CAE9D,EAAiB,OAAO,EAAI,CAAC,OAgCnC,OA/ByB,EAAK,UAAY,EAAK,UAAU,EAAS,CAAG,GAGlE,MAAM,EAAQ,CACd,MAAM,EAAO,EAAI,CACjB,KAAK,EAAM,IAAU,CACpB,IAAM,EAAS,EAAQ,EAAI,EAErB,EAAS,IADM,IAAI,IAAS,MAAM,CAAC,EAAe,CACxB,KAC1B,EAAY,GAAQ,EAAY,IAAW,IACjD,GAAI,EAAW,CACb,IAAI,EAAa,GACjB,GAAI,MAAM,QAAQ,EAAU,CAAE,CAC5B,IAAM,EAAgB,EACnB,MAAM,EAAG,KAAK,IAAI,EAAU,GAAK,EAAG,EAAE,CAAC,CACvC,QAAQ,SAAU,IAAI,CACnB,EAAkB,EAAU,IAAM,EAExC,EAAa,CACX;GACA,EAAO,QAAQ,MAAO,IAAI,CAC1B,EACA,IAAI,OAAO,EAAgB,CAC5B,CAAC,KAAK,GAAG,CAEZ,MAAO,CAAC,IAAK,EAAQ,EAAM,EAAW,CAAC,KAAK,GAAG,CAEjD,MAAO,IAAI,IAAS,KACpB,CACD,KAAK;EAAK"}
@@ -0,0 +1 @@
1
+ const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`./code-frames.cjs`);let n=require(`jsonc-parser`),r=require(`lines-and-columns`);function i(e,i){let{error:a,offset:o,length:s}=i,c=new r.LinesAndColumns(e).locationForIndex(o),l=c?.line??0,u=c?.column??0;return l++,u++,`${(0,n.printParseErrorCode)(a)} in JSON at ${l}:${u}\n${t.codeFrameColumns(e,{start:{line:l,column:u},end:{line:l,column:u+s}})}\n`}exports.formatParseError=i;
@@ -0,0 +1,2 @@
1
+ import{codeFrameColumns as e}from"./code-frames.mjs";import{printParseErrorCode as t}from"jsonc-parser";import{LinesAndColumns as n}from"lines-and-columns";function r(r,i){let{error:a,offset:o,length:s}=i,c=new n(r).locationForIndex(o),l=c?.line??0,u=c?.column??0;return l++,u++,`${t(a)} in JSON at ${l}:${u}\n${e(r,{start:{line:l,column:u},end:{line:l,column:u+s}})}\n`}export{r as formatParseError};
2
+ //# sourceMappingURL=parse-error.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-error.mjs","names":[],"sources":["../../../../../json/src/utils/parse-error.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 type { ParseError } from \"jsonc-parser\";\nimport { printParseErrorCode } from \"jsonc-parser\";\nimport { LinesAndColumns } from \"lines-and-columns\";\nimport { codeFrameColumns } from \"./code-frames\";\n\n/**\n * Nicely formats a JSON error with context\n *\n * @param input - JSON content as string\n * @param parseError - jsonc ParseError\n * @returns\n */\nexport function formatParseError(input: string, parseError: ParseError) {\n const { error, offset, length } = parseError;\n const result = new LinesAndColumns(input).locationForIndex(offset);\n let line = result?.line ?? 0;\n let column = result?.column ?? 0;\n\n line++;\n column++;\n\n return `${printParseErrorCode(error)} in JSON at ${line}:${column}\\n${codeFrameColumns(\n input,\n {\n start: {\n line,\n column\n },\n end: {\n line,\n column: column + length\n }\n }\n )}\\n`;\n}\n"],"mappings":"4JA8BA,SAAgB,EAAiB,EAAe,EAAwB,CACtE,GAAM,CAAE,QAAO,SAAQ,UAAW,EAC5B,EAAS,IAAI,EAAgB,EAAM,CAAC,iBAAiB,EAAO,CAC9D,EAAO,GAAQ,MAAQ,EACvB,EAAS,GAAQ,QAAU,EAK/B,MAHA,KACA,IAEO,GAAG,EAAoB,EAAM,CAAC,cAAc,EAAK,GAAG,EAAO,IAAI,EACpE,EACA,CACE,MAAO,CACL,OACA,SACD,CACD,IAAK,CACH,OACA,OAAQ,EAAS,EAClB,CACF,CACF,CAAC"}
@@ -0,0 +1 @@
1
+ const e=require(`./strip-comments.cjs`),t=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,n=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,r=/^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;function i(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){console.warn(`Dropping "${e}" key to prevent prototype pollution.`);return}return t}function a(a,o={}){if(typeof a!=`string`)return a;let s=e.stripComments(a);if(s[0]===`"`&&s[s.length-1]===`"`&&!s.includes(`\\`))return s.slice(1,-1);if(s=s.trim(),s.length<=9)switch(s.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!r.test(s)){if(o.strict)throw Error(`Invalid JSON`);return s}try{if(t.test(s)||n.test(s)){if(o.strict)throw Error(`Possible prototype pollution`);return JSON.parse(s,i)}return JSON.parse(s)}catch(e){if(o.strict)throw e;return a}}exports.parse=a;
@@ -0,0 +1,2 @@
1
+ import{stripComments as e}from"./strip-comments.mjs";const t=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,n=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,r=/^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;function i(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){console.warn(`Dropping "${e}" key to prevent prototype pollution.`);return}return t}function a(a,o={}){if(typeof a!=`string`)return a;let s=e(a);if(s[0]===`"`&&s[s.length-1]===`"`&&!s.includes(`\\`))return s.slice(1,-1);if(s=s.trim(),s.length<=9)switch(s.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!r.test(s)){if(o.strict)throw Error(`Invalid JSON`);return s}try{if(t.test(s)||n.test(s)){if(o.strict)throw Error(`Possible prototype pollution`);return JSON.parse(s,i)}return JSON.parse(s)}catch(e){if(o.strict)throw e;return a}}export{a as parse};
2
+ //# sourceMappingURL=parse.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.mjs","names":[],"sources":["../../../../../json/src/utils/parse.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 { stripComments } from \"./strip-comments\";\n\n// https://github.com/fastify/secure-json-parse\n// https://github.com/hapijs/bourne\nconst suspectProtoRx =\n /\"(?:_|\\\\u0{2}5[Ff]){2}(?:p|\\\\u0{2}70)(?:r|\\\\u0{2}72)(?:o|\\\\u0{2}6[Ff])(?:t|\\\\u0{2}74)(?:o|\\\\u0{2}6[Ff])(?:_|\\\\u0{2}5[Ff]){2}\"\\s*:/;\nconst suspectConstructorRx =\n /\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/;\n\nconst JsonSigRx = /^\\s*[\"[{]|^\\s*-?\\d{1,16}(?:\\.\\d{1,17})?(?:E[+-]?\\d+)?\\s*$/i;\n\nfunction jsonParseTransform(key: string, value: any): any {\n if (\n key === \"__proto__\" ||\n (key === \"constructor\" &&\n value &&\n typeof value === \"object\" &&\n \"prototype\" in value)\n ) {\n // eslint-disable-next-line no-console\n console.warn(`Dropping \"${key}\" key to prevent prototype pollution.`);\n return;\n }\n return value;\n}\n\nexport interface Options {\n strict?: boolean;\n}\n\nexport function parse<T = unknown>(value: any, options: Options = {}): T {\n if (typeof value !== \"string\") {\n return value;\n }\n\n let stripped = stripComments(value);\n\n if (\n stripped[0] === '\"' &&\n stripped[stripped.length - 1] === '\"' &&\n !stripped.includes(\"\\\\\")\n ) {\n return stripped.slice(1, -1) as T;\n }\n\n stripped = stripped.trim();\n\n if (stripped.length <= 9) {\n switch (stripped.toLowerCase()) {\n case \"true\": {\n return true as T;\n }\n case \"false\": {\n return false as T;\n }\n case \"undefined\": {\n return undefined as T;\n }\n case \"null\": {\n return null as T;\n }\n case \"nan\": {\n return Number.NaN as T;\n }\n case \"infinity\": {\n return Number.POSITIVE_INFINITY as T;\n }\n case \"-infinity\": {\n return Number.NEGATIVE_INFINITY as T;\n }\n }\n }\n\n if (!JsonSigRx.test(stripped)) {\n if (options.strict) {\n throw new Error(\"Invalid JSON\");\n }\n return stripped as T;\n }\n\n try {\n if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {\n if (options.strict) {\n throw new Error(\"Possible prototype pollution\");\n }\n return JSON.parse(stripped, jsonParseTransform);\n }\n\n return JSON.parse(stripped);\n } catch (error) {\n if (options.strict) {\n throw error;\n }\n return value as T;\n }\n}\n\nexport function safeParse<T = unknown>(value: any, options: Options = {}): T {\n return parse<T>(value, { ...options, strict: true });\n}\n"],"mappings":"qDAsBA,MAAM,EACJ,oIACI,EACJ,iKAEI,EAAY,6DAElB,SAAS,EAAmB,EAAa,EAAiB,CACxD,GACE,IAAQ,aACP,IAAQ,eACP,GACA,OAAO,GAAU,UACjB,cAAe,EACjB,CAEA,QAAQ,KAAK,aAAa,EAAI,uCAAuC,CACrE,OAEF,OAAO,EAOT,SAAgB,EAAmB,EAAY,EAAmB,EAAE,CAAK,CACvE,GAAI,OAAO,GAAU,SACnB,OAAO,EAGT,IAAI,EAAW,EAAc,EAAM,CAEnC,GACE,EAAS,KAAO,KAChB,EAAS,EAAS,OAAS,KAAO,KAClC,CAAC,EAAS,SAAS,KAAK,CAExB,OAAO,EAAS,MAAM,EAAG,GAAG,CAK9B,GAFA,EAAW,EAAS,MAAM,CAEtB,EAAS,QAAU,EACrB,OAAQ,EAAS,aAAa,CAA9B,CACE,IAAK,OACH,MAAO,GAET,IAAK,QACH,MAAO,GAET,IAAK,YACH,OAEF,IAAK,OACH,OAAO,KAET,IAAK,MACH,MAAO,KAET,IAAK,WACH,MAAO,KAET,IAAK,YACH,MAAO,KAKb,GAAI,CAAC,EAAU,KAAK,EAAS,CAAE,CAC7B,GAAI,EAAQ,OACV,MAAU,MAAM,eAAe,CAEjC,OAAO,EAGT,GAAI,CACF,GAAI,EAAe,KAAK,EAAS,EAAI,EAAqB,KAAK,EAAS,CAAE,CACxE,GAAI,EAAQ,OACV,MAAU,MAAM,+BAA+B,CAEjD,OAAO,KAAK,MAAM,EAAU,EAAmB,CAGjD,OAAO,KAAK,MAAM,EAAS,OACpB,EAAO,CACd,GAAI,EAAQ,OACV,MAAM,EAER,OAAO"}
@@ -0,0 +1 @@
1
+ const e=require(`../../../type-checks/src/is-number.cjs`),t=require(`../../../type-checks/src/is-undefined.cjs`),n=`@/#$ :;,.!?&=+-*%^~|\\"'\`{}[]()<>`.split(``),r=(i,a=2)=>{let o=e.isNumber(a)?` `.repeat(a):a;switch(i){case null:return`null`;case void 0:return`"undefined"`;case!0:return`true`;case!1:return`false`;case 1/0:return`infinity`;case-1/0:return`-infinity`}if(Array.isArray(i))return`[${o}${i.map(e=>r(e,o)).join(`,${o}`)}${o}]`;if(i instanceof Uint8Array)return i.toString();switch(typeof i){case`number`:return`${i}`;case`string`:return JSON.stringify(i);case`object`:return`{${o}${Object.keys(i).filter(e=>!t.isUndefined(i[e])).map(e=>`${n.some(t=>e.includes(t))?`"${e}"`:e}: ${o}${r(i[e],o)}`).join(`,${o}`)}${o}}`;default:return`null`}};exports.stringify=r;
@@ -0,0 +1,2 @@
1
+ import{isNumber as e}from"../../../type-checks/src/is-number.mjs";import{isUndefined as t}from"../../../type-checks/src/is-undefined.mjs";const n=`@/#$ :;,.!?&=+-*%^~|\\"'\`{}[]()<>`.split(``),r=(i,a=2)=>{let o=e(a)?` `.repeat(a):a;switch(i){case null:return`null`;case void 0:return`"undefined"`;case!0:return`true`;case!1:return`false`;case 1/0:return`infinity`;case-1/0:return`-infinity`}if(Array.isArray(i))return`[${o}${i.map(e=>r(e,o)).join(`,${o}`)}${o}]`;if(i instanceof Uint8Array)return i.toString();switch(typeof i){case`number`:return`${i}`;case`string`:return JSON.stringify(i);case`object`:return`{${o}${Object.keys(i).filter(e=>!t(i[e])).map(e=>`${n.some(t=>e.includes(t))?`"${e}"`:e}: ${o}${r(i[e],o)}`).join(`,${o}`)}${o}}`;default:return`null`}};export{r as stringify};
2
+ //# sourceMappingURL=stringify.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringify.mjs","names":[],"sources":["../../../../../json/src/utils/stringify.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 { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\nexport const invalidKeyChars = [\n \"@\",\n \"/\",\n \"#\",\n \"$\",\n \" \",\n \":\",\n \";\",\n \",\",\n \".\",\n \"!\",\n \"?\",\n \"&\",\n \"=\",\n \"+\",\n \"-\",\n \"*\",\n \"%\",\n \"^\",\n \"~\",\n \"|\",\n \"\\\\\",\n '\"',\n \"'\",\n \"`\",\n \"{\",\n \"}\",\n \"[\",\n \"]\",\n \"(\",\n \")\",\n \"<\",\n \">\"\n] as const;\n\n/**\n * Stringify a value to a JSON-like string.\n *\n * @param value - The value to stringify\n * @param spacing - The spacing to use for the stringification\n * @returns The stringified value\n */\nexport const stringify = (\n value: unknown,\n spacing: string | number = 2\n): string => {\n const space = isNumber(spacing) ? \" \".repeat(spacing) : spacing;\n\n switch (value) {\n case null: {\n return \"null\";\n }\n case undefined: {\n return '\"undefined\"';\n }\n case true: {\n return \"true\";\n }\n case false: {\n return \"false\";\n }\n case Number.POSITIVE_INFINITY: {\n return \"infinity\";\n }\n case Number.NEGATIVE_INFINITY: {\n return \"-infinity\";\n }\n }\n\n if (Array.isArray(value)) {\n return `[${space}${value.map(v => stringify(v, space)).join(`,${space}`)}${space}]`;\n }\n if (value instanceof Uint8Array) {\n return value.toString();\n }\n\n // eslint-disable-next-line ts/switch-exhaustiveness-check\n switch (typeof value) {\n case \"number\": {\n return `${value}`;\n }\n case \"string\": {\n return JSON.stringify(value);\n }\n case \"object\": {\n const keys = Object.keys(value as object).filter(\n key => !isUndefined((value as any)[key])\n );\n\n return `{${space}${keys\n .map(\n key =>\n `${invalidKeyChars.some(invalidKeyChar => key.includes(invalidKeyChar)) ? `\"${key}\"` : key}: ${space}${stringify((value as any)[key], space)}`\n )\n .join(`,${space}`)}${space}}`;\n }\n default:\n return \"null\";\n }\n};\n"],"mappings":"0IAqBA,MAAa,EAAkB,8CAiC9B,CASY,GACX,EACA,EAA2B,IAChB,CACX,IAAM,EAAQ,EAAS,EAAQ,CAAG,IAAI,OAAO,EAAQ,CAAG,EAExD,OAAQ,EAAR,CACE,KAAK,KACH,MAAO,OAET,KAAK,IAAA,GACH,MAAO,cAET,IAAK,GACH,MAAO,OAET,IAAK,GACH,MAAO,QAET,IAAK,KACH,MAAO,WAET,IAAK,KACH,MAAO,YAIX,GAAI,MAAM,QAAQ,EAAM,CACtB,MAAO,IAAI,IAAQ,EAAM,IAAI,GAAK,EAAU,EAAG,EAAM,CAAC,CAAC,KAAK,IAAI,IAAQ,GAAG,EAAM,GAEnF,GAAI,aAAiB,WACnB,OAAO,EAAM,UAAU,CAIzB,OAAQ,OAAO,EAAf,CACE,IAAK,SACH,MAAO,GAAG,IAEZ,IAAK,SACH,OAAO,KAAK,UAAU,EAAM,CAE9B,IAAK,SAKH,MAAO,IAAI,IAJE,OAAO,KAAK,EAAgB,CAAC,OACxC,GAAO,CAAC,EAAa,EAAc,GAAK,CACzC,CAGE,IACC,GACE,GAAG,EAAgB,KAAK,GAAkB,EAAI,SAAS,EAAe,CAAC,CAAG,IAAI,EAAI,GAAK,EAAI,IAAI,IAAQ,EAAW,EAAc,GAAM,EAAM,GAC/I,CACA,KAAK,IAAI,IAAQ,GAAG,EAAM,GAE/B,QACE,MAAO"}
@@ -0,0 +1,4 @@
1
+ const e=require(`../../../types/src/base.cjs`),t=Symbol(`singleComment`),n=Symbol(`multiComment`);function r(){return``}function i(e,t,n){return e.slice(t,n).replace(/\S/g,` `)}function a(e,t){let n=t-1,r=0;for(;e[n]===`\\`;)--n,r+=1;return!!(r%2)}function o(o,{whitespace:s=!0,trailingCommas:c=!1}={}){if(typeof o!=`string`)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof o}\``);let l=s?i:r,u=!1,d=!1,f=0,p=``,m=``,h=-1;for(let r=0;r<o.length;r++){let i=o[r],s=o[r+1];!d&&i===`"`&&(a(o,r)||(u=!u)),!u&&(!d&&i+(s??e.EMPTY_STRING)===`//`?(p+=o.slice(f,r),f=r,d=t,r++):d===t&&i+(s??e.EMPTY_STRING)===`\r
2
+ `?(r++,d=!1,p+=l(o,f,r),f=r):d===t&&i===`
3
+ `?(d=!1,p+=l(o,f,r),f=r):!d&&i+(s??e.EMPTY_STRING)===`/*`?(p+=o.slice(f,r),f=r,d=n,r++):d===n&&i+(s??e.EMPTY_STRING)===`*/`?(r++,d=!1,p+=l(o,f,r+1),f=r+1):c&&!d&&(h===-1?i===`,`&&(m+=p+o.slice(f,r),p=``,f=r,h=r):i===`}`||i===`]`?(p+=o.slice(f,r),m+=l(p,0,1)+p.slice(1),p=``,f=r,h=-1):i!==` `&&i!==` `&&i!==`\r`&&i!==`
4
+ `&&(p+=o.slice(f,r),f=r,h=-1)))}return m+p+(d?l(o.slice(f)):o.slice(f))}exports.stripComments=o;
@@ -0,0 +1,5 @@
1
+ import{EMPTY_STRING as e}from"../../../types/src/base.mjs";const t=Symbol(`singleComment`),n=Symbol(`multiComment`);function r(){return``}function i(e,t,n){return e.slice(t,n).replace(/\S/g,` `)}function a(e,t){let n=t-1,r=0;for(;e[n]===`\\`;)--n,r+=1;return!!(r%2)}function o(o,{whitespace:s=!0,trailingCommas:c=!1}={}){if(typeof o!=`string`)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof o}\``);let l=s?i:r,u=!1,d=!1,f=0,p=``,m=``,h=-1;for(let r=0;r<o.length;r++){let i=o[r],s=o[r+1];!d&&i===`"`&&(a(o,r)||(u=!u)),!u&&(!d&&i+(s??e)===`//`?(p+=o.slice(f,r),f=r,d=t,r++):d===t&&i+(s??e)===`\r
2
+ `?(r++,d=!1,p+=l(o,f,r),f=r):d===t&&i===`
3
+ `?(d=!1,p+=l(o,f,r),f=r):!d&&i+(s??e)===`/*`?(p+=o.slice(f,r),f=r,d=n,r++):d===n&&i+(s??e)===`*/`?(r++,d=!1,p+=l(o,f,r+1),f=r+1):c&&!d&&(h===-1?i===`,`&&(m+=p+o.slice(f,r),p=``,f=r,h=r):i===`}`||i===`]`?(p+=o.slice(f,r),m+=l(p,0,1)+p.slice(1),p=``,f=r,h=-1):i!==` `&&i!==` `&&i!==`\r`&&i!==`
4
+ `&&(p+=o.slice(f,r),f=r,h=-1)))}return m+p+(d?l(o.slice(f)):o.slice(f))}export{o as stripComments};
5
+ //# sourceMappingURL=strip-comments.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip-comments.mjs","names":["isInsideString: boolean | symbol","isInsideComment: boolean | symbol"],"sources":["../../../../../json/src/utils/strip-comments.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 { EMPTY_STRING } from \"@stryke/types/base\";\n\nconst singleComment = Symbol(\"singleComment\");\nconst multiComment = Symbol(\"multiComment\");\n\nfunction stripWithoutWhitespace() {\n return \"\";\n}\nfunction stripWithWhitespace(value: string, start?: number, end?: number) {\n return value.slice(start, end).replace(/\\S/g, \" \");\n}\n\nfunction isEscaped(value: string, quotePosition: number) {\n let index = quotePosition - 1;\n let backslashCount = 0;\n while (value[index] === \"\\\\\") {\n index -= 1;\n backslashCount += 1;\n }\n\n return Boolean(backslashCount % 2);\n}\n\nexport function stripComments(\n value: string,\n { whitespace = true, trailingCommas = false } = {}\n) {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `Expected argument \\`jsonString\\` to be a \\`string\\`, got \\`${typeof value}\\``\n );\n }\n\n const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;\n let isInsideString: boolean | symbol = false;\n let isInsideComment: boolean | symbol = false;\n let offset = 0;\n let buffer = \"\";\n let result = \"\";\n let commaIndex = -1;\n for (let index = 0; index < value.length; index++) {\n const currentCharacter = value[index];\n const nextCharacter = value[index + 1];\n if (!isInsideComment && currentCharacter === '\"') {\n const escaped = isEscaped(value, index);\n if (!escaped) {\n isInsideString = !isInsideString;\n }\n }\n if (isInsideString) {\n continue;\n }\n if (\n !isInsideComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"//\"\n ) {\n buffer += value.slice(offset, index);\n offset = index;\n isInsideComment = singleComment;\n index++;\n } else if (\n isInsideComment === singleComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"\\r\\n\"\n ) {\n index++;\n isInsideComment = false;\n buffer += strip(value, offset, index);\n offset = index;\n } else if (isInsideComment === singleComment && currentCharacter === \"\\n\") {\n isInsideComment = false;\n buffer += strip(value, offset, index);\n offset = index;\n } else if (\n !isInsideComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"/*\"\n ) {\n buffer += value.slice(offset, index);\n offset = index;\n isInsideComment = multiComment;\n index++;\n } else if (\n isInsideComment === multiComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"*/\"\n ) {\n index++;\n isInsideComment = false;\n buffer += strip(value, offset, index + 1);\n offset = index + 1;\n } else if (trailingCommas && !isInsideComment) {\n if (commaIndex !== -1) {\n if (currentCharacter === \"}\" || currentCharacter === \"]\") {\n buffer += value.slice(offset, index);\n result += strip(buffer, 0, 1) + buffer.slice(1);\n buffer = \"\";\n offset = index;\n commaIndex = -1;\n } else if (\n currentCharacter !== \" \" &&\n currentCharacter !== \"\t\" &&\n currentCharacter !== \"\\r\" &&\n currentCharacter !== \"\\n\"\n ) {\n buffer += value.slice(offset, index);\n offset = index;\n commaIndex = -1;\n }\n } else if (currentCharacter === \",\") {\n result += buffer + value.slice(offset, index);\n buffer = \"\";\n offset = index;\n commaIndex = index;\n }\n }\n }\n\n return (\n result +\n buffer +\n (isInsideComment ? strip(value.slice(offset)) : value.slice(offset))\n );\n}\n"],"mappings":"2DAoBA,MAAM,EAAgB,OAAO,gBAAgB,CACvC,EAAe,OAAO,eAAe,CAE3C,SAAS,GAAyB,CAChC,MAAO,GAET,SAAS,EAAoB,EAAe,EAAgB,EAAc,CACxE,OAAO,EAAM,MAAM,EAAO,EAAI,CAAC,QAAQ,MAAO,IAAI,CAGpD,SAAS,EAAU,EAAe,EAAuB,CACvD,IAAI,EAAQ,EAAgB,EACxB,EAAiB,EACrB,KAAO,EAAM,KAAW,MACtB,IACA,GAAkB,EAGpB,MAAO,GAAQ,EAAiB,GAGlC,SAAgB,EACd,EACA,CAAE,aAAa,GAAM,iBAAiB,IAAU,EAAE,CAClD,CACA,GAAI,OAAO,GAAU,SACnB,MAAU,UACR,8DAA8D,OAAO,EAAM,IAC5E,CAGH,IAAM,EAAQ,EAAa,EAAsB,EAC7CA,EAAmC,GACnCC,EAAoC,GACpC,EAAS,EACT,EAAS,GACT,EAAS,GACT,EAAa,GACjB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAM,OAAQ,IAAS,CACjD,IAAM,EAAmB,EAAM,GACzB,EAAgB,EAAM,EAAQ,GAChC,CAAC,GAAmB,IAAqB,MAC3B,EAAU,EAAO,EAAM,GAErC,EAAiB,CAAC,IAGlB,KAIF,CAAC,GACD,GAAoB,GAAiB,KAAkB,MAEvD,GAAU,EAAM,MAAM,EAAQ,EAAM,CACpC,EAAS,EACT,EAAkB,EAClB,KAEA,IAAoB,GACpB,GAAoB,GAAiB,KAAkB;GAEvD,IACA,EAAkB,GAClB,GAAU,EAAM,EAAO,EAAQ,EAAM,CACrC,EAAS,GACA,IAAoB,GAAiB,IAAqB;GACnE,EAAkB,GAClB,GAAU,EAAM,EAAO,EAAQ,EAAM,CACrC,EAAS,GAET,CAAC,GACD,GAAoB,GAAiB,KAAkB,MAEvD,GAAU,EAAM,MAAM,EAAQ,EAAM,CACpC,EAAS,EACT,EAAkB,EAClB,KAEA,IAAoB,GACpB,GAAoB,GAAiB,KAAkB,MAEvD,IACA,EAAkB,GAClB,GAAU,EAAM,EAAO,EAAQ,EAAQ,EAAE,CACzC,EAAS,EAAQ,GACR,GAAkB,CAAC,IACxB,IAAe,GAiBR,IAAqB,MAC9B,GAAU,EAAS,EAAM,MAAM,EAAQ,EAAM,CAC7C,EAAS,GACT,EAAS,EACT,EAAa,GApBT,IAAqB,KAAO,IAAqB,KACnD,GAAU,EAAM,MAAM,EAAQ,EAAM,CACpC,GAAU,EAAM,EAAQ,EAAG,EAAE,CAAG,EAAO,MAAM,EAAE,CAC/C,EAAS,GACT,EAAS,EACT,EAAa,IAEb,IAAqB,KACrB,IAAqB,KACrB,IAAqB,MACrB,IAAqB;IAErB,GAAU,EAAM,MAAM,EAAQ,EAAM,CACpC,EAAS,EACT,EAAa,MAWrB,OACE,EACA,GACC,EAAkB,EAAM,EAAM,MAAM,EAAO,CAAC,CAAG,EAAM,MAAM,EAAO"}
package/dist/json.cjs CHANGED
@@ -1 +1 @@
1
- require(`./helpers-_MJ6PR-g.cjs`),require(`./write-file-CqokudVp.cjs`);const e=require(`./json-DKhqPjHB.cjs`);exports.readJsonFile=e.t,exports.readJsonFileSync=e.n,exports.writeJsonFile=e.r,exports.writeJsonFileSync=e.i;
1
+ const e=require(`./type-checks/src/is-error.cjs`),t=require(`./read-file.cjs`),n=require(`./write-file.cjs`),r=require(`./json/src/storm-json.cjs`);function i(n,i){let a=t.readFileSync(n);i&&(i.endsWithNewline=a.codePointAt(a.length-1)===10);try{return r.StormJSON.parseJson(a,i)}catch(t){throw e.isError(t)?(t.message=t.message.replace(`JSON`,n),t):Error(`Failed to parse JSON: ${n}`)}}async function a(n,i){let a=await t.readFile(n);i&&(i.endsWithNewline=a.codePointAt(a.length-1)===10);try{return r.StormJSON.parseJson(a,i)}catch(t){throw e.isError(t)?(t.message=t.message.replace(`JSON`,n),t):Error(`Failed to parse JSON: ${n}`)}}function o(e,t,i){let a=r.StormJSON.stringify(t,i);return n.writeFileSync(e,i?.appendNewLine?`${a}\n`:a)}async function s(e,t,i){let a=r.StormJSON.stringify(t);return n.writeFile(e,i?.appendNewLine?`${a}\n`:a)}exports.readJsonFile=a,exports.readJsonFileSync=i,exports.writeJsonFile=s,exports.writeJsonFileSync=o;