@metamask/utils 8.4.0 → 8.5.0

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 (346) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/assert.cjs +127 -0
  3. package/dist/assert.cjs.map +1 -0
  4. package/dist/{types/assert.d.ts → assert.d.cts} +3 -3
  5. package/dist/assert.d.cts.map +1 -0
  6. package/dist/assert.d.mts +61 -0
  7. package/dist/assert.d.mts.map +1 -0
  8. package/dist/assert.mjs +119 -15
  9. package/dist/assert.mjs.map +1 -1
  10. package/dist/base64.cjs +34 -0
  11. package/dist/base64.cjs.map +1 -0
  12. package/dist/{types/base64.d.ts → base64.d.cts} +3 -3
  13. package/dist/base64.d.cts.map +1 -0
  14. package/dist/base64.d.mts +25 -0
  15. package/dist/base64.d.mts.map +1 -0
  16. package/dist/base64.mjs +28 -9
  17. package/dist/base64.mjs.map +1 -1
  18. package/dist/bytes.cjs +400 -0
  19. package/dist/{chunk-QEPVHEP7.js.map → bytes.cjs.map} +1 -1
  20. package/dist/{types/bytes.d.ts → bytes.d.cts} +3 -3
  21. package/dist/bytes.d.cts.map +1 -0
  22. package/dist/bytes.d.mts +183 -0
  23. package/dist/bytes.d.mts.map +1 -0
  24. package/dist/bytes.mjs +379 -42
  25. package/dist/bytes.mjs.map +1 -1
  26. package/dist/caip-types.cjs +151 -0
  27. package/dist/caip-types.cjs.map +1 -0
  28. package/dist/{types/caip-types.d.ts → caip-types.d.cts} +12 -12
  29. package/dist/caip-types.d.cts.map +1 -0
  30. package/dist/caip-types.d.mts +114 -0
  31. package/dist/caip-types.d.mts.map +1 -0
  32. package/dist/caip-types.mjs +139 -43
  33. package/dist/caip-types.mjs.map +1 -1
  34. package/dist/checksum.cjs +7 -0
  35. package/dist/checksum.cjs.map +1 -0
  36. package/dist/checksum.d.cts +2 -0
  37. package/dist/checksum.d.cts.map +1 -0
  38. package/dist/checksum.d.mts +2 -0
  39. package/dist/checksum.d.mts.map +1 -0
  40. package/dist/checksum.mjs +3 -11
  41. package/dist/checksum.mjs.map +1 -1
  42. package/dist/coercers.cjs +162 -0
  43. package/dist/coercers.cjs.map +1 -0
  44. package/dist/{types/coercers.d.ts → coercers.d.cts} +7 -7
  45. package/dist/coercers.d.cts.map +1 -0
  46. package/dist/coercers.d.mts +97 -0
  47. package/dist/coercers.d.mts.map +1 -0
  48. package/dist/coercers.mjs +154 -17
  49. package/dist/coercers.mjs.map +1 -1
  50. package/dist/collections.cjs +109 -0
  51. package/dist/collections.cjs.map +1 -0
  52. package/dist/{types/collections.d.ts → collections.d.cts} +1 -1
  53. package/dist/collections.d.cts.map +1 -0
  54. package/dist/collections.d.mts +39 -0
  55. package/dist/collections.d.mts.map +1 -0
  56. package/dist/collections.mjs +103 -8
  57. package/dist/collections.mjs.map +1 -1
  58. package/dist/encryption-types.cjs +3 -0
  59. package/dist/encryption-types.cjs.map +1 -0
  60. package/dist/{types/encryption-types.d.ts → encryption-types.d.cts} +2 -2
  61. package/dist/encryption-types.d.cts.map +1 -0
  62. package/dist/encryption-types.d.mts +7 -0
  63. package/dist/encryption-types.d.mts.map +1 -0
  64. package/dist/encryption-types.mjs +1 -1
  65. package/dist/encryption-types.mjs.map +1 -1
  66. package/dist/errors.cjs +111 -0
  67. package/dist/errors.cjs.map +1 -0
  68. package/dist/{types/errors.d.ts → errors.d.cts} +1 -1
  69. package/dist/errors.d.cts.map +1 -0
  70. package/dist/errors.d.mts +58 -0
  71. package/dist/errors.d.mts.map +1 -0
  72. package/dist/errors.mjs +102 -16
  73. package/dist/errors.mjs.map +1 -1
  74. package/dist/fs.cjs +248 -0
  75. package/dist/fs.cjs.map +1 -0
  76. package/dist/{types/fs.d.ts → fs.d.cts} +3 -3
  77. package/dist/fs.d.cts.map +1 -0
  78. package/dist/fs.d.mts +133 -0
  79. package/dist/fs.d.mts.map +1 -0
  80. package/dist/fs.mjs +209 -25
  81. package/dist/fs.mjs.map +1 -1
  82. package/dist/hex.cjs +134 -0
  83. package/dist/hex.cjs.map +1 -0
  84. package/dist/{types/hex.d.ts → hex.d.cts} +3 -3
  85. package/dist/hex.d.cts.map +1 -0
  86. package/dist/hex.d.mts +77 -0
  87. package/dist/hex.d.mts.map +1 -0
  88. package/dist/hex.mjs +121 -34
  89. package/dist/hex.mjs.map +1 -1
  90. package/dist/index.cjs +37 -0
  91. package/dist/index.cjs.map +1 -0
  92. package/dist/index.d.cts +21 -0
  93. package/dist/index.d.cts.map +1 -0
  94. package/dist/index.d.mts +21 -0
  95. package/dist/index.d.mts.map +1 -0
  96. package/dist/index.mjs +20 -296
  97. package/dist/index.mjs.map +1 -1
  98. package/dist/json.cjs +413 -0
  99. package/dist/json.cjs.map +1 -0
  100. package/dist/{types/json.d.ts → json.d.cts} +21 -22
  101. package/dist/json.d.cts.map +1 -0
  102. package/dist/json.d.mts +383 -0
  103. package/dist/json.d.mts.map +1 -0
  104. package/dist/json.mjs +389 -74
  105. package/dist/json.mjs.map +1 -1
  106. package/dist/keyring.cjs +3 -0
  107. package/dist/keyring.cjs.map +1 -0
  108. package/dist/{types/keyring.d.ts → keyring.d.cts} +7 -7
  109. package/dist/keyring.d.cts.map +1 -0
  110. package/dist/keyring.d.mts +224 -0
  111. package/dist/keyring.d.mts.map +1 -0
  112. package/dist/keyring.mjs +1 -1
  113. package/dist/keyring.mjs.map +1 -1
  114. package/dist/logging.cjs +43 -0
  115. package/dist/logging.cjs.map +1 -0
  116. package/dist/{types/logging.d.ts → logging.d.cts} +2 -2
  117. package/dist/logging.d.cts.map +1 -0
  118. package/dist/logging.d.mts +30 -0
  119. package/dist/logging.d.mts.map +1 -0
  120. package/dist/logging.mjs +34 -9
  121. package/dist/logging.mjs.map +1 -1
  122. package/dist/misc.cjs +149 -0
  123. package/dist/misc.cjs.map +1 -0
  124. package/dist/{types/misc.d.ts → misc.d.cts} +6 -6
  125. package/dist/misc.d.cts.map +1 -0
  126. package/dist/misc.d.mts +119 -0
  127. package/dist/misc.d.mts.map +1 -0
  128. package/dist/misc.mjs +136 -27
  129. package/dist/misc.mjs.map +1 -1
  130. package/dist/node.cjs +19 -0
  131. package/dist/node.cjs.map +1 -0
  132. package/dist/node.d.cts +3 -0
  133. package/dist/node.d.cts.map +1 -0
  134. package/dist/node.d.mts +3 -0
  135. package/dist/node.d.mts.map +1 -0
  136. package/dist/node.mjs +2 -316
  137. package/dist/node.mjs.map +1 -1
  138. package/dist/number.cjs +102 -0
  139. package/dist/number.cjs.map +1 -0
  140. package/dist/{types/number.d.ts → number.d.cts} +1 -1
  141. package/dist/number.d.cts.map +1 -0
  142. package/dist/number.d.mts +73 -0
  143. package/dist/number.d.mts.map +1 -0
  144. package/dist/number.mjs +93 -16
  145. package/dist/number.mjs.map +1 -1
  146. package/dist/opaque.cjs +3 -0
  147. package/dist/opaque.cjs.map +1 -0
  148. package/dist/opaque.d.cts +6 -0
  149. package/dist/opaque.d.cts.map +1 -0
  150. package/dist/opaque.d.mts +6 -0
  151. package/dist/opaque.d.mts.map +1 -0
  152. package/dist/opaque.mjs +1 -1
  153. package/dist/opaque.mjs.map +1 -1
  154. package/dist/promise.cjs +40 -0
  155. package/dist/promise.cjs.map +1 -0
  156. package/dist/{types/promise.d.ts → promise.d.cts} +2 -2
  157. package/dist/promise.d.cts.map +1 -0
  158. package/dist/promise.d.mts +45 -0
  159. package/dist/promise.d.mts.map +1 -0
  160. package/dist/promise.mjs +35 -7
  161. package/dist/promise.mjs.map +1 -1
  162. package/dist/time.cjs +67 -0
  163. package/dist/time.cjs.map +1 -0
  164. package/dist/{types/time.d.ts → time.d.cts} +1 -1
  165. package/dist/time.d.cts.map +1 -0
  166. package/dist/time.d.mts +49 -0
  167. package/dist/time.d.mts.map +1 -0
  168. package/dist/time.mjs +60 -10
  169. package/dist/time.mjs.map +1 -1
  170. package/dist/transaction-types.cjs +3 -0
  171. package/dist/transaction-types.cjs.map +1 -0
  172. package/dist/{types/transaction-types.d.ts → transaction-types.d.cts} +11 -11
  173. package/dist/transaction-types.d.cts.map +1 -0
  174. package/dist/transaction-types.d.mts +117 -0
  175. package/dist/transaction-types.d.mts.map +1 -0
  176. package/dist/transaction-types.mjs +1 -1
  177. package/dist/transaction-types.mjs.map +1 -1
  178. package/dist/versions.cjs +95 -0
  179. package/dist/versions.cjs.map +1 -0
  180. package/dist/{types/versions.d.ts → versions.d.cts} +5 -5
  181. package/dist/versions.d.cts.map +1 -0
  182. package/dist/versions.d.mts +101 -0
  183. package/dist/versions.d.mts.map +1 -0
  184. package/dist/versions.mjs +85 -26
  185. package/dist/versions.mjs.map +1 -1
  186. package/package.json +26 -17
  187. package/dist/assert.js +0 -16
  188. package/dist/assert.js.map +0 -1
  189. package/dist/base64.js +0 -11
  190. package/dist/base64.js.map +0 -1
  191. package/dist/bytes.js +0 -43
  192. package/dist/bytes.js.map +0 -1
  193. package/dist/caip-types.js +0 -44
  194. package/dist/caip-types.js.map +0 -1
  195. package/dist/checksum.js +0 -12
  196. package/dist/checksum.js.map +0 -1
  197. package/dist/chunk-2LBGT4GH.js +0 -15
  198. package/dist/chunk-2LBGT4GH.js.map +0 -1
  199. package/dist/chunk-3W5G4CYI.js +0 -25
  200. package/dist/chunk-3W5G4CYI.js.map +0 -1
  201. package/dist/chunk-4D6XQBHA.js +0 -69
  202. package/dist/chunk-4D6XQBHA.js.map +0 -1
  203. package/dist/chunk-4RMX5YWE.js +0 -34
  204. package/dist/chunk-4RMX5YWE.js.map +0 -1
  205. package/dist/chunk-5AVWINSB.js +0 -1
  206. package/dist/chunk-5AVWINSB.js.map +0 -1
  207. package/dist/chunk-622IOGVI.mjs +0 -1
  208. package/dist/chunk-622IOGVI.mjs.map +0 -1
  209. package/dist/chunk-6C35XQOF.mjs +0 -257
  210. package/dist/chunk-6C35XQOF.mjs.map +0 -1
  211. package/dist/chunk-6NZW4WK4.js +0 -35
  212. package/dist/chunk-6NZW4WK4.js.map +0 -1
  213. package/dist/chunk-6ZDHSOUV.js +0 -59
  214. package/dist/chunk-6ZDHSOUV.js.map +0 -1
  215. package/dist/chunk-74DGVJVE.mjs +0 -59
  216. package/dist/chunk-74DGVJVE.mjs.map +0 -1
  217. package/dist/chunk-AY6FDCBT.mjs +0 -1
  218. package/dist/chunk-AY6FDCBT.mjs.map +0 -1
  219. package/dist/chunk-C6HGFEYL.js +0 -23
  220. package/dist/chunk-C6HGFEYL.js.map +0 -1
  221. package/dist/chunk-DHVKFDHQ.js +0 -95
  222. package/dist/chunk-DHVKFDHQ.js.map +0 -1
  223. package/dist/chunk-DYRKZQMK.mjs +0 -122
  224. package/dist/chunk-DYRKZQMK.mjs.map +0 -1
  225. package/dist/chunk-E4C7EW4R.js +0 -16
  226. package/dist/chunk-E4C7EW4R.js.map +0 -1
  227. package/dist/chunk-EQMZL4XU.js +0 -1
  228. package/dist/chunk-EQMZL4XU.js.map +0 -1
  229. package/dist/chunk-GZS3IQBZ.mjs +0 -16
  230. package/dist/chunk-GZS3IQBZ.mjs.map +0 -1
  231. package/dist/chunk-H4YFDLB7.mjs +0 -70
  232. package/dist/chunk-H4YFDLB7.mjs.map +0 -1
  233. package/dist/chunk-I575FZFH.mjs +0 -1
  234. package/dist/chunk-I575FZFH.mjs.map +0 -1
  235. package/dist/chunk-IZC266HS.js +0 -55
  236. package/dist/chunk-IZC266HS.js.map +0 -1
  237. package/dist/chunk-JPAL7Q5S.mjs +0 -90
  238. package/dist/chunk-JPAL7Q5S.mjs.map +0 -1
  239. package/dist/chunk-LC2CRSWD.js +0 -1
  240. package/dist/chunk-LC2CRSWD.js.map +0 -1
  241. package/dist/chunk-NQMRFZHB.mjs +0 -35
  242. package/dist/chunk-NQMRFZHB.mjs.map +0 -1
  243. package/dist/chunk-O3EIM33O.mjs +0 -95
  244. package/dist/chunk-O3EIM33O.mjs.map +0 -1
  245. package/dist/chunk-OLLG4H35.js +0 -257
  246. package/dist/chunk-OLLG4H35.js.map +0 -1
  247. package/dist/chunk-OUZ3LSLX.mjs +0 -94
  248. package/dist/chunk-OUZ3LSLX.mjs.map +0 -1
  249. package/dist/chunk-QEPVHEP7.js +0 -273
  250. package/dist/chunk-QVEKZRZ2.js +0 -70
  251. package/dist/chunk-QVEKZRZ2.js.map +0 -1
  252. package/dist/chunk-RIRDOQPX.mjs +0 -15
  253. package/dist/chunk-RIRDOQPX.mjs.map +0 -1
  254. package/dist/chunk-RKRGAFXY.js +0 -1
  255. package/dist/chunk-RKRGAFXY.js.map +0 -1
  256. package/dist/chunk-RNEXSCNP.js +0 -122
  257. package/dist/chunk-RNEXSCNP.js.map +0 -1
  258. package/dist/chunk-ROQSKDP5.mjs +0 -69
  259. package/dist/chunk-ROQSKDP5.mjs.map +0 -1
  260. package/dist/chunk-RRYOWRCV.mjs +0 -1
  261. package/dist/chunk-RRYOWRCV.mjs.map +0 -1
  262. package/dist/chunk-S3UHBN2Z.mjs +0 -44
  263. package/dist/chunk-S3UHBN2Z.mjs.map +0 -1
  264. package/dist/chunk-THNLGEXV.mjs +0 -34
  265. package/dist/chunk-THNLGEXV.mjs.map +0 -1
  266. package/dist/chunk-UOTVU7OQ.js +0 -1
  267. package/dist/chunk-UOTVU7OQ.js.map +0 -1
  268. package/dist/chunk-VA2DRBDE.mjs +0 -273
  269. package/dist/chunk-VA2DRBDE.mjs.map +0 -1
  270. package/dist/chunk-VFXTVNXN.js +0 -44
  271. package/dist/chunk-VFXTVNXN.js.map +0 -1
  272. package/dist/chunk-W5XI7ERF.mjs +0 -23
  273. package/dist/chunk-W5XI7ERF.mjs.map +0 -1
  274. package/dist/chunk-WA4DHIND.mjs +0 -1
  275. package/dist/chunk-WA4DHIND.mjs.map +0 -1
  276. package/dist/chunk-X66SUIEF.mjs +0 -25
  277. package/dist/chunk-X66SUIEF.mjs.map +0 -1
  278. package/dist/chunk-XYGUOY6N.mjs +0 -55
  279. package/dist/chunk-XYGUOY6N.mjs.map +0 -1
  280. package/dist/chunk-YWAID473.js +0 -94
  281. package/dist/chunk-YWAID473.js.map +0 -1
  282. package/dist/chunk-Z2RGWDD7.js +0 -90
  283. package/dist/chunk-Z2RGWDD7.js.map +0 -1
  284. package/dist/coercers.js +0 -18
  285. package/dist/coercers.js.map +0 -1
  286. package/dist/collections.js +0 -10
  287. package/dist/collections.js.map +0 -1
  288. package/dist/encryption-types.js +0 -2
  289. package/dist/encryption-types.js.map +0 -1
  290. package/dist/errors.js +0 -17
  291. package/dist/errors.js.map +0 -1
  292. package/dist/fs.js +0 -26
  293. package/dist/fs.js.map +0 -1
  294. package/dist/hex.js +0 -35
  295. package/dist/hex.js.map +0 -1
  296. package/dist/index.js +0 -297
  297. package/dist/index.js.map +0 -1
  298. package/dist/json.js +0 -75
  299. package/dist/json.js.map +0 -1
  300. package/dist/keyring.js +0 -2
  301. package/dist/keyring.js.map +0 -1
  302. package/dist/logging.js +0 -10
  303. package/dist/logging.js.map +0 -1
  304. package/dist/misc.js +0 -28
  305. package/dist/misc.js.map +0 -1
  306. package/dist/node.js +0 -317
  307. package/dist/node.js.map +0 -1
  308. package/dist/number.js +0 -18
  309. package/dist/number.js.map +0 -1
  310. package/dist/opaque.js +0 -2
  311. package/dist/opaque.js.map +0 -1
  312. package/dist/promise.js +0 -8
  313. package/dist/promise.js.map +0 -1
  314. package/dist/time.js +0 -12
  315. package/dist/time.js.map +0 -1
  316. package/dist/transaction-types.js +0 -2
  317. package/dist/transaction-types.js.map +0 -1
  318. package/dist/types/assert.d.ts.map +0 -1
  319. package/dist/types/base64.d.ts.map +0 -1
  320. package/dist/types/bytes.d.ts.map +0 -1
  321. package/dist/types/caip-types.d.ts.map +0 -1
  322. package/dist/types/checksum.d.ts +0 -2
  323. package/dist/types/checksum.d.ts.map +0 -1
  324. package/dist/types/coercers.d.ts.map +0 -1
  325. package/dist/types/collections.d.ts.map +0 -1
  326. package/dist/types/encryption-types.d.ts.map +0 -1
  327. package/dist/types/errors.d.ts.map +0 -1
  328. package/dist/types/fs.d.ts.map +0 -1
  329. package/dist/types/hex.d.ts.map +0 -1
  330. package/dist/types/index.d.ts +0 -21
  331. package/dist/types/index.d.ts.map +0 -1
  332. package/dist/types/json.d.ts.map +0 -1
  333. package/dist/types/keyring.d.ts.map +0 -1
  334. package/dist/types/logging.d.ts.map +0 -1
  335. package/dist/types/misc.d.ts.map +0 -1
  336. package/dist/types/node.d.ts +0 -3
  337. package/dist/types/node.d.ts.map +0 -1
  338. package/dist/types/number.d.ts.map +0 -1
  339. package/dist/types/opaque.d.ts +0 -6
  340. package/dist/types/opaque.d.ts.map +0 -1
  341. package/dist/types/promise.d.ts.map +0 -1
  342. package/dist/types/time.d.ts.map +0 -1
  343. package/dist/types/transaction-types.d.ts.map +0 -1
  344. package/dist/types/versions.d.ts.map +0 -1
  345. package/dist/versions.js +0 -27
  346. package/dist/versions.js.map +0 -1
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Makes every specified property of the specified object type mutable.
3
+ *
4
+ * @template ObjectValue - The object whose readonly properties to make mutable.
5
+ * @template TargetKey - The property key(s) to make mutable.
6
+ */
7
+ export type Mutable<ObjectValue extends Record<string, unknown>, TargetKey extends keyof ObjectValue> = {
8
+ -readonly [Key in keyof Pick<ObjectValue, TargetKey>]: ObjectValue[Key];
9
+ } & {
10
+ [Key in keyof Omit<ObjectValue, TargetKey>]: ObjectValue[Key];
11
+ };
12
+ /**
13
+ * Useful for representing some value that _might_ be present and / or complete.
14
+ *
15
+ * @template Value - The value that might be present or complete.
16
+ */
17
+ export type PartialOrAbsent<Value> = Partial<Value> | null | undefined;
18
+ /**
19
+ * Like {@link Array}, but always non-empty.
20
+ *
21
+ * @template Element - The non-empty array member type.
22
+ */
23
+ export type NonEmptyArray<Element> = [Element, ...Element[]];
24
+ /**
25
+ * A JavaScript object that is not `null`, a function, or an array.
26
+ */
27
+ export type RuntimeObject = Record<PropertyKey, unknown>;
28
+ /**
29
+ * A {@link NonEmptyArray} type guard.
30
+ *
31
+ * @template Element - The non-empty array member type.
32
+ * @param value - The value to check.
33
+ * @returns Whether the value is a non-empty array.
34
+ */
35
+ export declare function isNonEmptyArray<Element>(value: Element[]): value is NonEmptyArray<Element>;
36
+ /**
37
+ * Type guard for "nullishness".
38
+ *
39
+ * @param value - Any value.
40
+ * @returns `true` if the value is null or undefined, `false` otherwise.
41
+ */
42
+ export declare function isNullOrUndefined(value: unknown): value is null | undefined;
43
+ /**
44
+ * A type guard for {@link RuntimeObject}.
45
+ *
46
+ * @param value - The value to check.
47
+ * @returns Whether the specified value has a runtime type of `object` and is
48
+ * neither `null` nor an `Array`.
49
+ */
50
+ export declare function isObject(value: unknown): value is RuntimeObject;
51
+ /**
52
+ * A type guard for ensuring an object has a property.
53
+ *
54
+ * @param objectToCheck - The object to check.
55
+ * @param name - The property name to check for.
56
+ * @returns Whether the specified object has an own property with the specified
57
+ * name, regardless of whether it is enumerable or not.
58
+ */
59
+ export declare const hasProperty: <ObjectToCheck extends Object, Property extends PropertyKey>(objectToCheck: ObjectToCheck, name: Property) => objectToCheck is ObjectToCheck & Record<Property, Property extends keyof ObjectToCheck ? ObjectToCheck[Property] : unknown>;
60
+ /**
61
+ * `Object.getOwnPropertyNames()` is intentionally generic: it returns the
62
+ * immediate property names of an object, but it cannot make guarantees about
63
+ * the contents of that object, so the type of the property names is merely
64
+ * `string[]`. While this is technically accurate, it is also unnecessary if we
65
+ * have an object with a type that we own (such as an enum).
66
+ *
67
+ * @param object - The plain object.
68
+ * @returns The own property names of the object which are assigned a type
69
+ * derived from the object itself.
70
+ */
71
+ export declare function getKnownPropertyNames<Key extends PropertyKey>(object: Partial<Record<Key, any>>): Key[];
72
+ export type PlainObject = Record<number | string | symbol, unknown>;
73
+ /**
74
+ * Predefined sizes (in Bytes) of specific parts of JSON structure.
75
+ */
76
+ export declare enum JsonSize {
77
+ Null = 4,
78
+ Comma = 1,
79
+ Wrapper = 1,
80
+ True = 4,
81
+ False = 5,
82
+ Quote = 1,
83
+ Colon = 1,
84
+ Date = 24
85
+ }
86
+ /**
87
+ * Regular expression with pattern matching for (special) escaped characters.
88
+ */
89
+ export declare const ESCAPE_CHARACTERS_REGEXP: RegExp;
90
+ /**
91
+ * Check if the value is plain object.
92
+ *
93
+ * @param value - Value to be checked.
94
+ * @returns True if an object is the plain JavaScript object,
95
+ * false if the object is not plain (e.g. function).
96
+ */
97
+ export declare function isPlainObject(value: unknown): value is PlainObject;
98
+ /**
99
+ * Check if character is ASCII.
100
+ *
101
+ * @param character - Character.
102
+ * @returns True if a character code is ASCII, false if not.
103
+ */
104
+ export declare function isASCII(character: string): boolean;
105
+ /**
106
+ * Calculate string size.
107
+ *
108
+ * @param value - String value to calculate size.
109
+ * @returns Number of bytes used to store whole string value.
110
+ */
111
+ export declare function calculateStringSize(value: string): number;
112
+ /**
113
+ * Calculate size of a number ofter JSON serialization.
114
+ *
115
+ * @param value - Number value to calculate size.
116
+ * @returns Number of bytes used to store whole number in JSON.
117
+ */
118
+ export declare function calculateNumberSize(value: number): number;
119
+ //# sourceMappingURL=misc.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc.d.mts","sourceRoot":"","sources":["../src/misc.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,MAAM,OAAO,CACjB,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3C,SAAS,SAAS,MAAM,WAAW,IACjC;IACF,CAAC,UAAU,GAAG,IAAI,MAAM,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC;CACxE,GAAG;KACD,GAAG,IAAI,MAAM,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC;CAC9D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAEvE;;;;GAIG;AACH,MAAM,MAAM,aAAa,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAMzD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EACrC,KAAK,EAAE,OAAO,EAAE,GACf,KAAK,IAAI,aAAa,CAAC,OAAO,CAAC,CAEjC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,SAAS,CAE3E;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAE/D;AAMD;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,2OAW8B,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,SAAS,WAAW,EAC3D,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAChC,GAAG,EAAE,CAEP;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpE;;GAEG;AACH,oBAAY,QAAQ;IAClB,IAAI,IAAI;IACR,KAAK,IAAI;IACT,OAAO,IAAI;IACX,IAAI,IAAI;IACR,KAAK,IAAI;IACT,KAAK,IAAI;IACT,KAAK,IAAI;IAET,IAAI,KAAK;CACV;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,QAAoB,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAelE;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,WAExC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUzD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD"}
package/dist/misc.mjs CHANGED
@@ -1,28 +1,137 @@
1
- import {
2
- ESCAPE_CHARACTERS_REGEXP,
3
- JsonSize,
4
- calculateNumberSize,
5
- calculateStringSize,
6
- getKnownPropertyNames,
7
- hasProperty,
8
- isASCII,
9
- isNonEmptyArray,
10
- isNullOrUndefined,
11
- isObject,
12
- isPlainObject
13
- } from "./chunk-H4YFDLB7.mjs";
14
- import "./chunk-X66SUIEF.mjs";
15
- export {
16
- ESCAPE_CHARACTERS_REGEXP,
17
- JsonSize,
18
- calculateNumberSize,
19
- calculateStringSize,
20
- getKnownPropertyNames,
21
- hasProperty,
22
- isASCII,
23
- isNonEmptyArray,
24
- isNullOrUndefined,
25
- isObject,
26
- isPlainObject
27
- };
1
+ //
2
+ // Types
3
+ //
4
+ //
5
+ // Type Guards
6
+ //
7
+ /**
8
+ * A {@link NonEmptyArray} type guard.
9
+ *
10
+ * @template Element - The non-empty array member type.
11
+ * @param value - The value to check.
12
+ * @returns Whether the value is a non-empty array.
13
+ */
14
+ export function isNonEmptyArray(value) {
15
+ return Array.isArray(value) && value.length > 0;
16
+ }
17
+ /**
18
+ * Type guard for "nullishness".
19
+ *
20
+ * @param value - Any value.
21
+ * @returns `true` if the value is null or undefined, `false` otherwise.
22
+ */
23
+ export function isNullOrUndefined(value) {
24
+ return value === null || value === undefined;
25
+ }
26
+ /**
27
+ * A type guard for {@link RuntimeObject}.
28
+ *
29
+ * @param value - The value to check.
30
+ * @returns Whether the specified value has a runtime type of `object` and is
31
+ * neither `null` nor an `Array`.
32
+ */
33
+ export function isObject(value) {
34
+ return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
35
+ }
36
+ //
37
+ // Other utility functions
38
+ //
39
+ /**
40
+ * A type guard for ensuring an object has a property.
41
+ *
42
+ * @param objectToCheck - The object to check.
43
+ * @param name - The property name to check for.
44
+ * @returns Whether the specified object has an own property with the specified
45
+ * name, regardless of whether it is enumerable or not.
46
+ */
47
+ export const hasProperty = (objectToCheck, name) => Object.hasOwnProperty.call(objectToCheck, name);
48
+ /**
49
+ * `Object.getOwnPropertyNames()` is intentionally generic: it returns the
50
+ * immediate property names of an object, but it cannot make guarantees about
51
+ * the contents of that object, so the type of the property names is merely
52
+ * `string[]`. While this is technically accurate, it is also unnecessary if we
53
+ * have an object with a type that we own (such as an enum).
54
+ *
55
+ * @param object - The plain object.
56
+ * @returns The own property names of the object which are assigned a type
57
+ * derived from the object itself.
58
+ */
59
+ export function getKnownPropertyNames(object) {
60
+ return Object.getOwnPropertyNames(object);
61
+ }
62
+ /**
63
+ * Predefined sizes (in Bytes) of specific parts of JSON structure.
64
+ */
65
+ export var JsonSize;
66
+ (function (JsonSize) {
67
+ JsonSize[JsonSize["Null"] = 4] = "Null";
68
+ JsonSize[JsonSize["Comma"] = 1] = "Comma";
69
+ JsonSize[JsonSize["Wrapper"] = 1] = "Wrapper";
70
+ JsonSize[JsonSize["True"] = 4] = "True";
71
+ JsonSize[JsonSize["False"] = 5] = "False";
72
+ JsonSize[JsonSize["Quote"] = 1] = "Quote";
73
+ JsonSize[JsonSize["Colon"] = 1] = "Colon";
74
+ // eslint-disable-next-line @typescript-eslint/no-shadow
75
+ JsonSize[JsonSize["Date"] = 24] = "Date";
76
+ })(JsonSize = JsonSize || (JsonSize = {}));
77
+ /**
78
+ * Regular expression with pattern matching for (special) escaped characters.
79
+ */
80
+ export const ESCAPE_CHARACTERS_REGEXP = /"|\\|\n|\r|\t/gu;
81
+ /**
82
+ * Check if the value is plain object.
83
+ *
84
+ * @param value - Value to be checked.
85
+ * @returns True if an object is the plain JavaScript object,
86
+ * false if the object is not plain (e.g. function).
87
+ */
88
+ export function isPlainObject(value) {
89
+ if (typeof value !== 'object' || value === null) {
90
+ return false;
91
+ }
92
+ try {
93
+ let proto = value;
94
+ while (Object.getPrototypeOf(proto) !== null) {
95
+ proto = Object.getPrototypeOf(proto);
96
+ }
97
+ return Object.getPrototypeOf(value) === proto;
98
+ }
99
+ catch (_) {
100
+ return false;
101
+ }
102
+ }
103
+ /**
104
+ * Check if character is ASCII.
105
+ *
106
+ * @param character - Character.
107
+ * @returns True if a character code is ASCII, false if not.
108
+ */
109
+ export function isASCII(character) {
110
+ return character.charCodeAt(0) <= 127;
111
+ }
112
+ /**
113
+ * Calculate string size.
114
+ *
115
+ * @param value - String value to calculate size.
116
+ * @returns Number of bytes used to store whole string value.
117
+ */
118
+ export function calculateStringSize(value) {
119
+ const size = value.split('').reduce((total, character) => {
120
+ if (isASCII(character)) {
121
+ return total + 1;
122
+ }
123
+ return total + 2;
124
+ }, 0);
125
+ // Also detect characters that need backslash escape
126
+ return size + (value.match(ESCAPE_CHARACTERS_REGEXP) ?? []).length;
127
+ }
128
+ /**
129
+ * Calculate size of a number ofter JSON serialization.
130
+ *
131
+ * @param value - Number value to calculate size.
132
+ * @returns Number of bytes used to store whole number in JSON.
133
+ */
134
+ export function calculateNumberSize(value) {
135
+ return value.toString().length;
136
+ }
28
137
  //# sourceMappingURL=misc.mjs.map
package/dist/misc.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"misc.mjs","sourceRoot":"","sources":["../src/misc.ts"],"names":[],"mappings":"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","sourcesContent":["//\n// Types\n//\n\n/**\n * Makes every specified property of the specified object type mutable.\n *\n * @template ObjectValue - The object whose readonly properties to make mutable.\n * @template TargetKey - The property key(s) to make mutable.\n */\nexport type Mutable<\n ObjectValue extends Record<string, unknown>,\n TargetKey extends keyof ObjectValue,\n> = {\n -readonly [Key in keyof Pick<ObjectValue, TargetKey>]: ObjectValue[Key];\n} & {\n [Key in keyof Omit<ObjectValue, TargetKey>]: ObjectValue[Key];\n};\n\n/**\n * Useful for representing some value that _might_ be present and / or complete.\n *\n * @template Value - The value that might be present or complete.\n */\nexport type PartialOrAbsent<Value> = Partial<Value> | null | undefined;\n\n/**\n * Like {@link Array}, but always non-empty.\n *\n * @template Element - The non-empty array member type.\n */\nexport type NonEmptyArray<Element> = [Element, ...Element[]];\n\n/**\n * A JavaScript object that is not `null`, a function, or an array.\n */\nexport type RuntimeObject = Record<PropertyKey, unknown>;\n\n//\n// Type Guards\n//\n\n/**\n * A {@link NonEmptyArray} type guard.\n *\n * @template Element - The non-empty array member type.\n * @param value - The value to check.\n * @returns Whether the value is a non-empty array.\n */\nexport function isNonEmptyArray<Element>(\n value: Element[],\n): value is NonEmptyArray<Element> {\n return Array.isArray(value) && value.length > 0;\n}\n\n/**\n * Type guard for \"nullishness\".\n *\n * @param value - Any value.\n * @returns `true` if the value is null or undefined, `false` otherwise.\n */\nexport function isNullOrUndefined(value: unknown): value is null | undefined {\n return value === null || value === undefined;\n}\n\n/**\n * A type guard for {@link RuntimeObject}.\n *\n * @param value - The value to check.\n * @returns Whether the specified value has a runtime type of `object` and is\n * neither `null` nor an `Array`.\n */\nexport function isObject(value: unknown): value is RuntimeObject {\n return Boolean(value) && typeof value === 'object' && !Array.isArray(value);\n}\n\n//\n// Other utility functions\n//\n\n/**\n * A type guard for ensuring an object has a property.\n *\n * @param objectToCheck - The object to check.\n * @param name - The property name to check for.\n * @returns Whether the specified object has an own property with the specified\n * name, regardless of whether it is enumerable or not.\n */\nexport const hasProperty = <\n // eslint-disable-next-line @typescript-eslint/ban-types\n ObjectToCheck extends Object,\n Property extends PropertyKey,\n>(\n objectToCheck: ObjectToCheck,\n name: Property,\n): objectToCheck is ObjectToCheck &\n Record<\n Property,\n Property extends keyof ObjectToCheck ? ObjectToCheck[Property] : unknown\n > => Object.hasOwnProperty.call(objectToCheck, name);\n\n/**\n * `Object.getOwnPropertyNames()` is intentionally generic: it returns the\n * immediate property names of an object, but it cannot make guarantees about\n * the contents of that object, so the type of the property names is merely\n * `string[]`. While this is technically accurate, it is also unnecessary if we\n * have an object with a type that we own (such as an enum).\n *\n * @param object - The plain object.\n * @returns The own property names of the object which are assigned a type\n * derived from the object itself.\n */\nexport function getKnownPropertyNames<Key extends PropertyKey>(\n object: Partial<Record<Key, any>>,\n): Key[] {\n return Object.getOwnPropertyNames(object) as Key[];\n}\n\nexport type PlainObject = Record<number | string | symbol, unknown>;\n\n/**\n * Predefined sizes (in Bytes) of specific parts of JSON structure.\n */\nexport enum JsonSize {\n Null = 4,\n Comma = 1,\n Wrapper = 1,\n True = 4,\n False = 5,\n Quote = 1,\n Colon = 1,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Date = 24,\n}\n\n/**\n * Regular expression with pattern matching for (special) escaped characters.\n */\nexport const ESCAPE_CHARACTERS_REGEXP = /\"|\\\\|\\n|\\r|\\t/gu;\n\n/**\n * Check if the value is plain object.\n *\n * @param value - Value to be checked.\n * @returns True if an object is the plain JavaScript object,\n * false if the object is not plain (e.g. function).\n */\nexport function isPlainObject(value: unknown): value is PlainObject {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n\n try {\n let proto = value;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(value) === proto;\n } catch (_) {\n return false;\n }\n}\n\n/**\n * Check if character is ASCII.\n *\n * @param character - Character.\n * @returns True if a character code is ASCII, false if not.\n */\nexport function isASCII(character: string) {\n return character.charCodeAt(0) <= 127;\n}\n\n/**\n * Calculate string size.\n *\n * @param value - String value to calculate size.\n * @returns Number of bytes used to store whole string value.\n */\nexport function calculateStringSize(value: string): number {\n const size = value.split('').reduce((total, character) => {\n if (isASCII(character)) {\n return total + 1;\n }\n return total + 2;\n }, 0);\n\n // Also detect characters that need backslash escape\n return size + (value.match(ESCAPE_CHARACTERS_REGEXP) ?? []).length;\n}\n\n/**\n * Calculate size of a number ofter JSON serialization.\n *\n * @param value - Number value to calculate size.\n * @returns Number of bytes used to store whole number in JSON.\n */\nexport function calculateNumberSize(value: number): number {\n return value.toString().length;\n}\n"]}
package/dist/node.cjs ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./index.cjs"), exports);
18
+ __exportStar(require("./fs.cjs"), exports);
19
+ //# sourceMappingURL=node.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.cjs","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAAkB;AAClB,2CAAqB","sourcesContent":["export * from '.';\nexport * from './fs';\n"]}
@@ -0,0 +1,3 @@
1
+ export * from "./index.cjs";
2
+ export * from "./fs.cjs";
3
+ //# sourceMappingURL=node.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.cts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,4BAAkB;AAClB,yBAAqB"}
@@ -0,0 +1,3 @@
1
+ export * from "./index.mjs";
2
+ export * from "./fs.mjs";
3
+ //# sourceMappingURL=node.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.mts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,4BAAkB;AAClB,yBAAqB"}
package/dist/node.mjs CHANGED
@@ -1,317 +1,3 @@
1
- import {
2
- createSandbox,
3
- directoryExists,
4
- ensureDirectoryStructureExists,
5
- fileExists,
6
- forceRemove,
7
- readFile,
8
- readJsonFile,
9
- writeFile,
10
- writeJsonFile
11
- } from "./chunk-DYRKZQMK.mjs";
12
- import "./chunk-622IOGVI.mjs";
13
- import {
14
- bigIntToHex,
15
- hexToBigInt,
16
- hexToNumber,
17
- numberToHex
18
- } from "./chunk-S3UHBN2Z.mjs";
19
- import "./chunk-AY6FDCBT.mjs";
20
- import {
21
- createDeferredPromise
22
- } from "./chunk-W5XI7ERF.mjs";
23
- import {
24
- Duration,
25
- inMilliseconds,
26
- timeSince
27
- } from "./chunk-THNLGEXV.mjs";
28
- import "./chunk-RRYOWRCV.mjs";
29
- import {
30
- VersionRangeStruct,
31
- VersionStruct,
32
- assertIsSemVerRange,
33
- assertIsSemVerVersion,
34
- gtRange,
35
- gtVersion,
36
- isValidSemVerRange,
37
- isValidSemVerVersion,
38
- satisfiesVersionRange
39
- } from "./chunk-ROQSKDP5.mjs";
40
- import {
41
- JsonRpcErrorStruct,
42
- JsonRpcFailureStruct,
43
- JsonRpcIdStruct,
44
- JsonRpcNotificationStruct,
45
- JsonRpcParamsStruct,
46
- JsonRpcRequestStruct,
47
- JsonRpcResponseStruct,
48
- JsonRpcSuccessStruct,
49
- JsonRpcVersionStruct,
50
- JsonStruct,
51
- PendingJsonRpcResponseStruct,
52
- UnsafeJsonStruct,
53
- assertIsJsonRpcError,
54
- assertIsJsonRpcFailure,
55
- assertIsJsonRpcNotification,
56
- assertIsJsonRpcRequest,
57
- assertIsJsonRpcResponse,
58
- assertIsJsonRpcSuccess,
59
- assertIsPendingJsonRpcResponse,
60
- exactOptional,
61
- getJsonRpcIdValidator,
62
- getJsonSize,
63
- getSafeJson,
64
- isJsonRpcError,
65
- isJsonRpcFailure,
66
- isJsonRpcNotification,
67
- isJsonRpcRequest,
68
- isJsonRpcResponse,
69
- isJsonRpcSuccess,
70
- isPendingJsonRpcResponse,
71
- isValidJson,
72
- jsonrpc2,
73
- object
74
- } from "./chunk-6C35XQOF.mjs";
75
- import "./chunk-I575FZFH.mjs";
76
- import {
77
- createModuleLogger,
78
- createProjectLogger
79
- } from "./chunk-RIRDOQPX.mjs";
80
- import {
81
- CAIP_ACCOUNT_ADDRESS_REGEX,
82
- CAIP_ACCOUNT_ID_REGEX,
83
- CAIP_CHAIN_ID_REGEX,
84
- CAIP_NAMESPACE_REGEX,
85
- CAIP_REFERENCE_REGEX,
86
- CaipAccountAddressStruct,
87
- CaipAccountIdStruct,
88
- CaipChainIdStruct,
89
- CaipNamespaceStruct,
90
- CaipReferenceStruct,
91
- KnownCaipNamespace,
92
- isCaipAccountAddress,
93
- isCaipAccountId,
94
- isCaipChainId,
95
- isCaipNamespace,
96
- isCaipReference,
97
- parseCaipAccountId,
98
- parseCaipChainId,
99
- toCaipChainId
100
- } from "./chunk-OUZ3LSLX.mjs";
101
- import {
102
- ChecksumStruct
103
- } from "./chunk-GZS3IQBZ.mjs";
104
- import {
105
- base64
106
- } from "./chunk-NQMRFZHB.mjs";
107
- import {
108
- createBigInt,
109
- createBytes,
110
- createHex,
111
- createNumber
112
- } from "./chunk-O3EIM33O.mjs";
113
- import {
114
- HexAddressStruct,
115
- HexChecksumAddressStruct,
116
- HexStruct,
117
- StrictHexStruct,
118
- add0x,
119
- assertIsBytes,
120
- assertIsHexString,
121
- assertIsStrictHexString,
122
- base64ToBytes,
123
- bigIntToBytes,
124
- bytesToBase64,
125
- bytesToBigInt,
126
- bytesToHex,
127
- bytesToNumber,
128
- bytesToSignedBigInt,
129
- bytesToString,
130
- concatBytes,
131
- createDataView,
132
- getChecksumAddress,
133
- hexToBytes,
134
- isBytes,
135
- isHexString,
136
- isStrictHexString,
137
- isValidChecksumAddress,
138
- isValidHexAddress,
139
- numberToBytes,
140
- remove0x,
141
- signedBigIntToBytes,
142
- stringToBytes,
143
- valueToBytes
144
- } from "./chunk-VA2DRBDE.mjs";
145
- import {
146
- AssertionError,
147
- assert,
148
- assertExhaustive,
149
- assertStruct
150
- } from "./chunk-74DGVJVE.mjs";
151
- import {
152
- getErrorMessage,
153
- isErrorWithCode,
154
- isErrorWithMessage,
155
- isErrorWithStack,
156
- wrapError
157
- } from "./chunk-XYGUOY6N.mjs";
158
- import {
159
- ESCAPE_CHARACTERS_REGEXP,
160
- JsonSize,
161
- calculateNumberSize,
162
- calculateStringSize,
163
- getKnownPropertyNames,
164
- hasProperty,
165
- isASCII,
166
- isNonEmptyArray,
167
- isNullOrUndefined,
168
- isObject,
169
- isPlainObject
170
- } from "./chunk-H4YFDLB7.mjs";
171
- import {
172
- FrozenMap,
173
- FrozenSet
174
- } from "./chunk-JPAL7Q5S.mjs";
175
- import "./chunk-X66SUIEF.mjs";
176
- import "./chunk-WA4DHIND.mjs";
177
- export {
178
- AssertionError,
179
- CAIP_ACCOUNT_ADDRESS_REGEX,
180
- CAIP_ACCOUNT_ID_REGEX,
181
- CAIP_CHAIN_ID_REGEX,
182
- CAIP_NAMESPACE_REGEX,
183
- CAIP_REFERENCE_REGEX,
184
- CaipAccountAddressStruct,
185
- CaipAccountIdStruct,
186
- CaipChainIdStruct,
187
- CaipNamespaceStruct,
188
- CaipReferenceStruct,
189
- ChecksumStruct,
190
- Duration,
191
- ESCAPE_CHARACTERS_REGEXP,
192
- FrozenMap,
193
- FrozenSet,
194
- HexAddressStruct,
195
- HexChecksumAddressStruct,
196
- HexStruct,
197
- JsonRpcErrorStruct,
198
- JsonRpcFailureStruct,
199
- JsonRpcIdStruct,
200
- JsonRpcNotificationStruct,
201
- JsonRpcParamsStruct,
202
- JsonRpcRequestStruct,
203
- JsonRpcResponseStruct,
204
- JsonRpcSuccessStruct,
205
- JsonRpcVersionStruct,
206
- JsonSize,
207
- JsonStruct,
208
- KnownCaipNamespace,
209
- PendingJsonRpcResponseStruct,
210
- StrictHexStruct,
211
- UnsafeJsonStruct,
212
- VersionRangeStruct,
213
- VersionStruct,
214
- add0x,
215
- assert,
216
- assertExhaustive,
217
- assertIsBytes,
218
- assertIsHexString,
219
- assertIsJsonRpcError,
220
- assertIsJsonRpcFailure,
221
- assertIsJsonRpcNotification,
222
- assertIsJsonRpcRequest,
223
- assertIsJsonRpcResponse,
224
- assertIsJsonRpcSuccess,
225
- assertIsPendingJsonRpcResponse,
226
- assertIsSemVerRange,
227
- assertIsSemVerVersion,
228
- assertIsStrictHexString,
229
- assertStruct,
230
- base64,
231
- base64ToBytes,
232
- bigIntToBytes,
233
- bigIntToHex,
234
- bytesToBase64,
235
- bytesToBigInt,
236
- bytesToHex,
237
- bytesToNumber,
238
- bytesToSignedBigInt,
239
- bytesToString,
240
- calculateNumberSize,
241
- calculateStringSize,
242
- concatBytes,
243
- createBigInt,
244
- createBytes,
245
- createDataView,
246
- createDeferredPromise,
247
- createHex,
248
- createModuleLogger,
249
- createNumber,
250
- createProjectLogger,
251
- createSandbox,
252
- directoryExists,
253
- ensureDirectoryStructureExists,
254
- exactOptional,
255
- fileExists,
256
- forceRemove,
257
- getChecksumAddress,
258
- getErrorMessage,
259
- getJsonRpcIdValidator,
260
- getJsonSize,
261
- getKnownPropertyNames,
262
- getSafeJson,
263
- gtRange,
264
- gtVersion,
265
- hasProperty,
266
- hexToBigInt,
267
- hexToBytes,
268
- hexToNumber,
269
- inMilliseconds,
270
- isASCII,
271
- isBytes,
272
- isCaipAccountAddress,
273
- isCaipAccountId,
274
- isCaipChainId,
275
- isCaipNamespace,
276
- isCaipReference,
277
- isErrorWithCode,
278
- isErrorWithMessage,
279
- isErrorWithStack,
280
- isHexString,
281
- isJsonRpcError,
282
- isJsonRpcFailure,
283
- isJsonRpcNotification,
284
- isJsonRpcRequest,
285
- isJsonRpcResponse,
286
- isJsonRpcSuccess,
287
- isNonEmptyArray,
288
- isNullOrUndefined,
289
- isObject,
290
- isPendingJsonRpcResponse,
291
- isPlainObject,
292
- isStrictHexString,
293
- isValidChecksumAddress,
294
- isValidHexAddress,
295
- isValidJson,
296
- isValidSemVerRange,
297
- isValidSemVerVersion,
298
- jsonrpc2,
299
- numberToBytes,
300
- numberToHex,
301
- object,
302
- parseCaipAccountId,
303
- parseCaipChainId,
304
- readFile,
305
- readJsonFile,
306
- remove0x,
307
- satisfiesVersionRange,
308
- signedBigIntToBytes,
309
- stringToBytes,
310
- timeSince,
311
- toCaipChainId,
312
- valueToBytes,
313
- wrapError,
314
- writeFile,
315
- writeJsonFile
316
- };
1
+ export * from "./index.mjs";
2
+ export * from "./fs.mjs";
317
3
  //# sourceMappingURL=node.mjs.map
package/dist/node.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"node.mjs","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,4BAAkB;AAClB,yBAAqB","sourcesContent":["export * from '.';\nexport * from './fs';\n"]}