@stryke/hash 0.12.26 → 0.12.28

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 (149) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +1 -0
  3. package/dist/convert/src/array-buffer-to-string.cjs +1 -0
  4. package/dist/convert/src/array-buffer-to-string.mjs +2 -0
  5. package/dist/convert/src/array-buffer-to-string.mjs.map +1 -0
  6. package/dist/convert/src/neutral.cjs +1 -0
  7. package/dist/convert/src/neutral.mjs +1 -0
  8. package/dist/convert/src/parse-type-definition.cjs +1 -0
  9. package/dist/convert/src/parse-type-definition.mjs +1 -0
  10. package/dist/convert/src/string-to-uint8-array.cjs +1 -0
  11. package/dist/convert/src/string-to-uint8-array.mjs +2 -0
  12. package/dist/convert/src/string-to-uint8-array.mjs.map +1 -0
  13. package/dist/convert/src/string-to-utf8-array.cjs +1 -0
  14. package/dist/convert/src/string-to-utf8-array.mjs +2 -0
  15. package/dist/convert/src/string-to-utf8-array.mjs.map +1 -0
  16. package/dist/convert/src/utf8-array-to-string.cjs +1 -0
  17. package/dist/convert/src/utf8-array-to-string.mjs +2 -0
  18. package/dist/convert/src/utf8-array-to-string.mjs.map +1 -0
  19. package/dist/digest.cjs +1 -1
  20. package/dist/digest.d.cts +32 -2
  21. package/dist/digest.d.cts.map +1 -0
  22. package/dist/digest.d.mts +32 -2
  23. package/dist/digest.d.mts.map +1 -0
  24. package/dist/digest.mjs +2 -1
  25. package/dist/digest.mjs.map +1 -0
  26. package/dist/etag.cjs +1 -1
  27. package/dist/etag.d.cts +22 -2
  28. package/dist/etag.d.cts.map +1 -0
  29. package/dist/etag.d.mts +22 -2
  30. package/dist/etag.d.mts.map +1 -0
  31. package/dist/etag.mjs +2 -1
  32. package/dist/etag.mjs.map +1 -0
  33. package/dist/fs/src/list-files.cjs +1 -0
  34. package/dist/fs/src/list-files.d.cts +7 -0
  35. package/dist/fs/src/list-files.d.cts.map +1 -0
  36. package/dist/fs/src/list-files.d.mts +7 -0
  37. package/dist/fs/src/list-files.d.mts.map +1 -0
  38. package/dist/fs/src/list-files.mjs +2 -0
  39. package/dist/fs/src/list-files.mjs.map +1 -0
  40. package/dist/fs/src/read-file.cjs +1 -0
  41. package/dist/fs/src/read-file.mjs +2 -0
  42. package/dist/fs/src/read-file.mjs.map +1 -0
  43. package/dist/hash-files.cjs +1 -1
  44. package/dist/hash-files.d.cts +24 -2
  45. package/dist/hash-files.d.cts.map +1 -0
  46. package/dist/hash-files.d.mts +24 -2
  47. package/dist/hash-files.d.mts.map +1 -0
  48. package/dist/hash-files.mjs +2 -1
  49. package/dist/hash-files.mjs.map +1 -0
  50. package/dist/index.cjs +1 -1
  51. package/dist/index.d.cts +6 -6
  52. package/dist/index.d.mts +6 -6
  53. package/dist/index.mjs +1 -1
  54. package/dist/md5.cjs +1 -1
  55. package/dist/md5.d.cts +12 -2
  56. package/dist/md5.d.cts.map +1 -0
  57. package/dist/md5.d.mts +12 -2
  58. package/dist/md5.d.mts.map +1 -0
  59. package/dist/md5.mjs +2 -1
  60. package/dist/md5.mjs.map +1 -0
  61. package/dist/murmurhash.cjs +1 -1
  62. package/dist/murmurhash.d.cts +23 -2
  63. package/dist/murmurhash.d.cts.map +1 -0
  64. package/dist/murmurhash.d.mts +23 -2
  65. package/dist/murmurhash.d.mts.map +1 -0
  66. package/dist/murmurhash.mjs +2 -1
  67. package/dist/murmurhash.mjs.map +1 -0
  68. package/dist/neutral.cjs +1 -1
  69. package/dist/neutral.d.cts +4 -4
  70. package/dist/neutral.d.mts +4 -4
  71. package/dist/neutral.mjs +1 -1
  72. package/dist/path/src/is-type.cjs +1 -0
  73. package/dist/path/src/is-type.mjs +2 -0
  74. package/dist/path/src/is-type.mjs.map +1 -0
  75. package/dist/path/src/join-paths.cjs +1 -0
  76. package/dist/path/src/join-paths.mjs +2 -0
  77. package/dist/path/src/join-paths.mjs.map +1 -0
  78. package/dist/path/src/regex.cjs +1 -0
  79. package/dist/path/src/regex.mjs +2 -0
  80. package/dist/path/src/regex.mjs.map +1 -0
  81. package/dist/path/src/slash.cjs +1 -0
  82. package/dist/path/src/slash.mjs +2 -0
  83. package/dist/path/src/slash.mjs.map +1 -0
  84. package/dist/type-checks/src/index.cjs +1 -0
  85. package/dist/type-checks/src/index.mjs +1 -0
  86. package/dist/type-checks/src/is-buffer.cjs +1 -0
  87. package/dist/type-checks/src/is-buffer.mjs +2 -0
  88. package/dist/type-checks/src/is-buffer.mjs.map +1 -0
  89. package/dist/type-checks/src/is-collection.cjs +1 -0
  90. package/dist/type-checks/src/is-collection.mjs +1 -0
  91. package/dist/type-checks/src/is-string.cjs +1 -0
  92. package/dist/type-checks/src/is-string.mjs +2 -0
  93. package/dist/type-checks/src/is-string.mjs.map +1 -0
  94. package/dist/type-checks/src/type-detect.cjs +1 -0
  95. package/dist/type-checks/src/type-detect.mjs +2 -0
  96. package/dist/type-checks/src/type-detect.mjs.map +1 -0
  97. package/dist/xx-hash.cjs +1 -1
  98. package/dist/xx-hash.d.cts +7 -2
  99. package/dist/xx-hash.d.cts.map +1 -0
  100. package/dist/xx-hash.d.mts +7 -2
  101. package/dist/xx-hash.d.mts.map +1 -0
  102. package/dist/xx-hash.mjs +2 -1
  103. package/dist/xx-hash.mjs.map +1 -0
  104. package/package.json +3 -3
  105. package/dist/digest-311IQaur.mjs +0 -2
  106. package/dist/digest-311IQaur.mjs.map +0 -1
  107. package/dist/digest-CG1Sk96A.d.mts +0 -32
  108. package/dist/digest-CG1Sk96A.d.mts.map +0 -1
  109. package/dist/digest-REorjd4v.cjs +0 -1
  110. package/dist/digest-Yy26O9oW.d.cts +0 -32
  111. package/dist/digest-Yy26O9oW.d.cts.map +0 -1
  112. package/dist/etag-BdoEX_I_.d.cts +0 -22
  113. package/dist/etag-BdoEX_I_.d.cts.map +0 -1
  114. package/dist/etag-DXmoR6hr.mjs +0 -2
  115. package/dist/etag-DXmoR6hr.mjs.map +0 -1
  116. package/dist/etag-Kuj0WZon.d.mts +0 -22
  117. package/dist/etag-Kuj0WZon.d.mts.map +0 -1
  118. package/dist/etag-SIhKWCBx.cjs +0 -1
  119. package/dist/hash-files-BMmt9LzB.mjs +0 -2
  120. package/dist/hash-files-BMmt9LzB.mjs.map +0 -1
  121. package/dist/hash-files-C8KCroZK.d.mts +0 -26
  122. package/dist/hash-files-C8KCroZK.d.mts.map +0 -1
  123. package/dist/hash-files-DMXzIbQw.d.cts +0 -26
  124. package/dist/hash-files-DMXzIbQw.d.cts.map +0 -1
  125. package/dist/hash-files-DNDrDY17.cjs +0 -1
  126. package/dist/md5-CCxA7tZv.d.cts +0 -12
  127. package/dist/md5-CCxA7tZv.d.cts.map +0 -1
  128. package/dist/md5-C_8IsDev.d.mts +0 -12
  129. package/dist/md5-C_8IsDev.d.mts.map +0 -1
  130. package/dist/md5-CnYTBU9u.mjs +0 -2
  131. package/dist/md5-CnYTBU9u.mjs.map +0 -1
  132. package/dist/md5-Cwdph7YU.cjs +0 -1
  133. package/dist/murmurhash-CVcuhG5F.cjs +0 -1
  134. package/dist/murmurhash-CoNWpOwZ.mjs +0 -2
  135. package/dist/murmurhash-CoNWpOwZ.mjs.map +0 -1
  136. package/dist/murmurhash-D6qhmMhz.d.mts +0 -23
  137. package/dist/murmurhash-D6qhmMhz.d.mts.map +0 -1
  138. package/dist/murmurhash-dzYfmtjT.d.cts +0 -23
  139. package/dist/murmurhash-dzYfmtjT.d.cts.map +0 -1
  140. package/dist/src-GI5wB-mz.mjs +0 -2
  141. package/dist/src-GI5wB-mz.mjs.map +0 -1
  142. package/dist/src-QUlAu3to.cjs +0 -1
  143. package/dist/xx-hash--6giOvM7.cjs +0 -1
  144. package/dist/xx-hash-BnLXga7m.d.cts +0 -7
  145. package/dist/xx-hash-BnLXga7m.d.cts.map +0 -1
  146. package/dist/xx-hash-DyeY-GKZ.d.mts +0 -7
  147. package/dist/xx-hash-DyeY-GKZ.d.mts.map +0 -1
  148. package/dist/xx-hash-SyVhkkcA.mjs +0 -2
  149. package/dist/xx-hash-SyVhkkcA.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  # Changelog for Stryke - Hash
4
4
 
5
+ ## [0.12.27](https://github.com/storm-software/stryke/releases/tag/hash%400.12.27) (12/17/2025)
6
+
7
+ ### Updated Dependencies
8
+
9
+ - Updated **convert** to **v0.6.25**
10
+ - Updated **fs** to **v0.33.21**
11
+
12
+ ## [0.12.26](https://github.com/storm-software/stryke/releases/tag/hash%400.12.26) (12/08/2025)
13
+
14
+ ### Updated Dependencies
15
+
16
+ - Updated **convert** to **v0.6.24**
17
+ - Updated **fs** to **v0.33.20**
18
+
5
19
  ## [0.12.25](https://github.com/storm-software/stryke/releases/tag/hash%400.12.25) (12/08/2025)
6
20
 
7
21
  ### Updated Dependencies
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
@@ -0,0 +1 @@
1
+ function e(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=t.byteLength;if(n<65535)return String.fromCharCode.apply(null,t);let r=``;for(let e=0;e<n;e++)r+=String.fromCharCode(t[e]);return r}exports.arrayBufferToString=e;
@@ -0,0 +1,2 @@
1
+ function e(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=t.byteLength;if(n<65535)return String.fromCharCode.apply(null,t);let r=``;for(let e=0;e<n;e++)r+=String.fromCharCode(t[e]);return r}export{e as arrayBufferToString};
2
+ //# sourceMappingURL=array-buffer-to-string.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-buffer-to-string.mjs","names":[],"sources":["../../../../convert/src/array-buffer-to-string.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert an ArrayBuffer or Uint8Array to a string\n *\n * @param buffer - The ArrayBuffer or Uint8Array to convert\n * @returns The converted string\n */\nexport function arrayBufferToString(\n buffer: ArrayBuffer | ArrayBufferLike | Uint8Array\n): string {\n const bytes =\n buffer instanceof Uint8Array\n ? buffer\n : new Uint8Array(buffer as ArrayBufferLike);\n const len = bytes.byteLength;\n if (len < 65535) {\n return String.fromCharCode.apply(null, bytes as unknown as number[]);\n }\n let binary = \"\";\n for (let i = 0; i < len; i++) {\n binary += String.fromCharCode(bytes[i]!);\n }\n return binary;\n}\n"],"mappings":"AAwBA,SAAgB,EACd,EACQ,CACR,IAAM,EACJ,aAAkB,WACd,EACA,IAAI,WAAW,EAA0B,CACzC,EAAM,EAAM,WAClB,GAAI,EAAM,MACR,OAAO,OAAO,aAAa,MAAM,KAAM,EAA6B,CAEtE,IAAI,EAAS,GACb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,IACvB,GAAU,OAAO,aAAa,EAAM,GAAI,CAE1C,OAAO"}
@@ -0,0 +1 @@
1
+ const e=require(`./array-buffer-to-string.cjs`);require(`./parse-type-definition.cjs`);const t=require(`./string-to-uint8-array.cjs`);require(`./string-to-utf8-array.cjs`),require(`./utf8-array-to-string.cjs`);
@@ -0,0 +1 @@
1
+ import{arrayBufferToString as e}from"./array-buffer-to-string.mjs";import"./parse-type-definition.mjs";import{stringToUint8Array as t}from"./string-to-uint8-array.mjs";import"./string-to-utf8-array.mjs";import"./utf8-array-to-string.mjs";export{};
@@ -0,0 +1 @@
1
+ require(`../../type-checks/src/index.cjs`);
@@ -0,0 +1 @@
1
+ import"../../type-checks/src/index.mjs";export{};
@@ -0,0 +1 @@
1
+ function e(e){return Uint8Array.from([...encodeURIComponent(e)].map(e=>e.codePointAt(0)))}exports.stringToUint8Array=e;
@@ -0,0 +1,2 @@
1
+ function e(e){return Uint8Array.from([...encodeURIComponent(e)].map(e=>e.codePointAt(0)))}export{e as stringToUint8Array};
2
+ //# sourceMappingURL=string-to-uint8-array.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-to-uint8-array.mjs","names":[],"sources":["../../../../convert/src/string-to-uint8-array.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert a string to Uint8Array\n *\n * @param text - The text to convert\n * @returns The converted Uint8Array\n */\nexport function stringToUint8Array(text: string): Uint8Array {\n return Uint8Array.from(\n [...encodeURIComponent(text)].map(letter => letter.codePointAt(0)!)\n );\n}\n\n/**\n * Convert a binary string to Uint8Array\n *\n * @param binary - The binary string to convert\n * @returns The converted Uint8Array\n */\nexport function binaryStringToUint8Array(binary: string): Uint8Array {\n const len = binary.length;\n const arr = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n arr[i] = binary.charCodeAt(i);\n }\n return arr;\n}\n\n/**\n * Convert a base64 string to a Uint8Array\n *\n * @param data - The base64 string to convert\n * @returns The converted Uint8Array\n */\nexport function base64StringToUint8Array(data: string): Uint8Array {\n return stringToUint8Array(atob(data));\n}\n"],"mappings":"AAwBA,SAAgB,EAAmB,EAA0B,CAC3D,OAAO,WAAW,KAChB,CAAC,GAAG,mBAAmB,EAAK,CAAC,CAAC,IAAI,GAAU,EAAO,YAAY,EAAE,CAAE,CACpE"}
@@ -0,0 +1 @@
1
+ const e=new TextEncoder;
@@ -0,0 +1,2 @@
1
+ new TextEncoder;export{};
2
+ //# sourceMappingURL=string-to-utf8-array.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-to-utf8-array.mjs","names":[],"sources":["../../../../convert/src/string-to-utf8-array.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\nconst encoder = new TextEncoder();\n\n/**\n * Convert a string to a utf-8 array\n *\n * @param input - The string to convert\n * @returns The converted utf-8 array\n */\nexport function stringToUtf8Array(input: string): Uint8Array {\n return encoder.encode(input);\n}\n"],"mappings":"AAkBgB,IAAI"}
@@ -0,0 +1 @@
1
+ const e=new TextDecoder;
@@ -0,0 +1,2 @@
1
+ new TextDecoder;export{};
2
+ //# sourceMappingURL=utf8-array-to-string.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utf8-array-to-string.mjs","names":[],"sources":["../../../../convert/src/utf8-array-to-string.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\nconst decoder = new TextDecoder();\n\n/**\n * Convert a utf-8 array to string\n *\n * @param input - Utf-8 Array\n * @returns The converted string\n */\nexport function utf8ArrayToString(\n input: NodeJS.ArrayBufferView | ArrayBuffer\n): string {\n return decoder.decode(input);\n}\n"],"mappings":"AAkBgB,IAAI"}
package/dist/digest.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./digest-REorjd4v.cjs`);require(`./src-QUlAu3to.cjs`),exports.Hasher=e.t,exports.createHasher=e.n,exports.digest=e.r,exports.hash=e.i;
1
+ const e=require(`./convert/src/array-buffer-to-string.cjs`),t=require(`./convert/src/string-to-uint8-array.cjs`);require(`./convert/src/neutral.cjs`);function n(e){return new a(e)}async function r(n,r=`SHA-512`){return e.arrayBufferToString(await globalThis.crypto.subtle.digest(r,t.stringToUint8Array(n)))}const i=r;var a=class{#e=[];#t;constructor(e){this.#t=e}update(e){this.#e.push(e)}async digest(){let e=new Uint8Array(this.#e.reduce((e,t)=>e+t.length,0)),t=0;for(let n of this.#e)e.set(n,t),t+=n.length;let n=await globalThis.crypto.subtle.digest(this.#t,e);return new Uint8Array(n)}};exports.Hasher=a,exports.createHasher=n,exports.digest=r,exports.hash=i;
package/dist/digest.d.cts CHANGED
@@ -1,2 +1,32 @@
1
- import { a as hash, i as digest, n as Hasher, r as createHasher, t as AlgorithmIdentifier } from "./digest-Yy26O9oW.cjs";
2
- export { AlgorithmIdentifier, Hasher, createHasher, digest, hash };
1
+ //#region src/digest.d.ts
2
+ type AlgorithmIdentifier = "SHA-256" | "SHA-384" | "SHA-512";
3
+ /**
4
+ * Creates a new hash object for the specified algorithm.
5
+ *
6
+ * @param algorithm - The algorithm to use for the hash.
7
+ * @returns A new hash object.
8
+ */
9
+ declare function createHasher(algorithm: AlgorithmIdentifier): Hasher;
10
+ /**
11
+ * Creates a new hash object for the specified algorithm.
12
+ *
13
+ * @remarks
14
+ * This function uses the Web Crypto API to create a hash of the input data.
15
+ *
16
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
17
+ *
18
+ * @param data - The data to hash.
19
+ * @param algorithm - The algorithm to use for the hash.
20
+ * @returns A hash string representation of the `data` parameter.
21
+ */
22
+ declare function digest(data: string, algorithm?: AlgorithmIdentifier): Promise<string>;
23
+ declare const hash: typeof digest;
24
+ declare class Hasher {
25
+ #private;
26
+ constructor(algorithm: AlgorithmIdentifier);
27
+ update(data: Uint8Array): void;
28
+ digest(): Promise<Uint8Array>;
29
+ }
30
+ //#endregion
31
+ export { AlgorithmIdentifier, Hasher, createHasher, digest, hash };
32
+ //# sourceMappingURL=digest.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digest.d.cts","names":[],"sources":["../src/digest.ts"],"sourcesContent":[],"mappings":";KAuBY,mBAAA;AAAZ;AAQA;AAgBA;AAYA;AAEA;;AASe,iBAvCC,YAAA,CAuCD,SAAA,EAvCyB,mBAuCzB,CAAA,EAvC+C,MAuC/C;;;;;;;;;;;;;iBAvBO,MAAA,2BAET,sBACV;cASU,aAAI;cAEJ,MAAA;;yBAKY;eAIV;YAIG,QAAQ"}
package/dist/digest.d.mts CHANGED
@@ -1,2 +1,32 @@
1
- import { a as hash, i as digest, n as Hasher, r as createHasher, t as AlgorithmIdentifier } from "./digest-CG1Sk96A.mjs";
2
- export { AlgorithmIdentifier, Hasher, createHasher, digest, hash };
1
+ //#region src/digest.d.ts
2
+ type AlgorithmIdentifier = "SHA-256" | "SHA-384" | "SHA-512";
3
+ /**
4
+ * Creates a new hash object for the specified algorithm.
5
+ *
6
+ * @param algorithm - The algorithm to use for the hash.
7
+ * @returns A new hash object.
8
+ */
9
+ declare function createHasher(algorithm: AlgorithmIdentifier): Hasher;
10
+ /**
11
+ * Creates a new hash object for the specified algorithm.
12
+ *
13
+ * @remarks
14
+ * This function uses the Web Crypto API to create a hash of the input data.
15
+ *
16
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
17
+ *
18
+ * @param data - The data to hash.
19
+ * @param algorithm - The algorithm to use for the hash.
20
+ * @returns A hash string representation of the `data` parameter.
21
+ */
22
+ declare function digest(data: string, algorithm?: AlgorithmIdentifier): Promise<string>;
23
+ declare const hash: typeof digest;
24
+ declare class Hasher {
25
+ #private;
26
+ constructor(algorithm: AlgorithmIdentifier);
27
+ update(data: Uint8Array): void;
28
+ digest(): Promise<Uint8Array>;
29
+ }
30
+ //#endregion
31
+ export { AlgorithmIdentifier, Hasher, createHasher, digest, hash };
32
+ //# sourceMappingURL=digest.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digest.d.mts","names":[],"sources":["../src/digest.ts"],"sourcesContent":[],"mappings":";KAuBY,mBAAA;AAAZ;AAQA;AAgBA;AAYA;AAEA;;AASe,iBAvCC,YAAA,CAuCD,SAAA,EAvCyB,mBAuCzB,CAAA,EAvC+C,MAuC/C;;;;;;;;;;;;;iBAvBO,MAAA,2BAET,sBACV;cASU,aAAI;cAEJ,MAAA;;yBAKY;eAIV;YAIG,QAAQ"}
package/dist/digest.mjs CHANGED
@@ -1 +1,2 @@
1
- import{i as e,n as t,r as n,t as r}from"./digest-311IQaur.mjs";import"./src-GI5wB-mz.mjs";export{r as Hasher,t as createHasher,n as digest,e as hash};
1
+ import{arrayBufferToString as e}from"./convert/src/array-buffer-to-string.mjs";import{stringToUint8Array as t}from"./convert/src/string-to-uint8-array.mjs";import"./convert/src/neutral.mjs";function n(e){return new a(e)}async function r(n,r=`SHA-512`){return e(await globalThis.crypto.subtle.digest(r,t(n)))}const i=r;var a=class{#e=[];#t;constructor(e){this.#t=e}update(e){this.#e.push(e)}async digest(){let e=new Uint8Array(this.#e.reduce((e,t)=>e+t.length,0)),t=0;for(let n of this.#e)e.set(n,t),t+=n.length;let n=await globalThis.crypto.subtle.digest(this.#t,e);return new Uint8Array(n)}};export{a as Hasher,n as createHasher,r as digest,i as hash};
2
+ //# sourceMappingURL=digest.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digest.mjs","names":["#algorithm","#chunks"],"sources":["../src/digest.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 {\n arrayBufferToString,\n stringToUint8Array\n} from \"@stryke/convert/neutral\";\n\nexport type AlgorithmIdentifier = \"SHA-256\" | \"SHA-384\" | \"SHA-512\";\n\n/**\n * Creates a new hash object for the specified algorithm.\n *\n * @param algorithm - The algorithm to use for the hash.\n * @returns A new hash object.\n */\nexport function createHasher(algorithm: AlgorithmIdentifier): Hasher {\n return new Hasher(algorithm);\n}\n\n/**\n * Creates a new hash object for the specified algorithm.\n *\n * @remarks\n * This function uses the Web Crypto API to create a hash of the input data.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest\n *\n * @param data - The data to hash.\n * @param algorithm - The algorithm to use for the hash.\n * @returns A hash string representation of the `data` parameter.\n */\nexport async function digest(\n data: string,\n algorithm: AlgorithmIdentifier = \"SHA-512\"\n): Promise<string> {\n const arrayBuffer = await globalThis.crypto.subtle.digest(\n algorithm,\n stringToUint8Array(data) as BufferSource\n );\n\n return arrayBufferToString(arrayBuffer);\n}\n\nexport const hash = digest;\n\nexport class Hasher {\n #chunks: Uint8Array[] = [];\n\n #algorithm: AlgorithmIdentifier;\n\n constructor(algorithm: AlgorithmIdentifier) {\n this.#algorithm = algorithm;\n }\n\n update(data: Uint8Array): void {\n this.#chunks.push(data);\n }\n\n async digest(): Promise<Uint8Array> {\n const data = new Uint8Array(\n this.#chunks.reduce((acc, chunk) => acc + chunk.length, 0)\n );\n let offset = 0;\n for (const chunk of this.#chunks) {\n data.set(chunk, offset);\n offset += chunk.length;\n }\n const arrayBuffer = await globalThis.crypto.subtle.digest(\n this.#algorithm,\n data\n );\n\n return new Uint8Array(arrayBuffer);\n }\n}\n"],"mappings":"8LA+BA,SAAgB,EAAa,EAAwC,CACnE,OAAO,IAAI,EAAO,EAAU,CAe9B,eAAsB,EACpB,EACA,EAAiC,UAChB,CAMjB,OAAO,EALa,MAAM,WAAW,OAAO,OAAO,OACjD,EACA,EAAmB,EAAK,CACzB,CAEsC,CAGzC,MAAa,EAAO,EAEpB,IAAa,EAAb,KAAoB,CAClB,GAAwB,EAAE,CAE1B,GAEA,YAAY,EAAgC,CAC1C,MAAA,EAAkB,EAGpB,OAAO,EAAwB,CAC7B,MAAA,EAAa,KAAK,EAAK,CAGzB,MAAM,QAA8B,CAClC,IAAM,EAAO,IAAI,WACf,MAAA,EAAa,QAAQ,EAAK,IAAU,EAAM,EAAM,OAAQ,EAAE,CAC3D,CACG,EAAS,EACb,IAAK,IAAM,KAAS,MAAA,EAClB,EAAK,IAAI,EAAO,EAAO,CACvB,GAAU,EAAM,OAElB,IAAM,EAAc,MAAM,WAAW,OAAO,OAAO,OACjD,MAAA,EACA,EACD,CAED,OAAO,IAAI,WAAW,EAAY"}
package/dist/etag.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./etag-SIhKWCBx.cjs`);exports.fnv1a52=e.t,exports.generateETag=e.n;
1
+ const e=e=>{let t=e.length,n=0,r=0,i=8997,a=0,o=33826,s=0,c=40164,l=0,u=52210;for(;n<t;)i^=e.charCodeAt(n++),r=i*435,a=o*435,s=c*435,l=u*435,s+=i<<8,l+=o<<8,a+=r>>>16,i=r&65535,s+=a>>>16,o=a&65535,u=l+(s>>>16)&65535,c=s&65535;return(u&15)*281474976710656+c*4294967296+o*65536+(i^u>>4)},t=(t,n=!1)=>`${(n?`W/"`:`"`)+e(t).toString(36)+t.length.toString(36)}"`;exports.fnv1a52=e,exports.generateETag=t;
package/dist/etag.d.cts CHANGED
@@ -1,2 +1,22 @@
1
- import { n as generateETag, t as fnv1a52 } from "./etag-BdoEX_I_.cjs";
2
- export { fnv1a52, generateETag };
1
+ //#region src/etag.d.ts
2
+ /**
3
+ * FNV-1a Hash implementation
4
+ *
5
+ * Ported from https://github.com/tjwebb/fnv-plus/blob/master/index.js
6
+ *
7
+ * @remarks
8
+ * Simplified, optimized and add modified for 52 bit, which provides a larger hash space
9
+ * and still making use of Javascript's 53-bit integer space.
10
+ */
11
+ declare const fnv1a52: (str: string) => number;
12
+ /**
13
+ * Generates an ETag for the given payload.
14
+ *
15
+ * @param payload - The payload to generate an ETag for.
16
+ * @param weak - Whether to generate a weak ETag.
17
+ * @returns The generated ETag.
18
+ */
19
+ declare const generateETag: (payload: string, weak?: boolean) => string;
20
+ //#endregion
21
+ export { fnv1a52, generateETag };
22
+ //# sourceMappingURL=etag.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"etag.d.cts","names":[],"sources":["../src/etag.ts"],"sourcesContent":[],"mappings":";;AA2BA;AA2CA;;;;;;;cA3Ca;;;;;;;;cA2CA"}
package/dist/etag.d.mts CHANGED
@@ -1,2 +1,22 @@
1
- import { n as generateETag, t as fnv1a52 } from "./etag-Kuj0WZon.mjs";
2
- export { fnv1a52, generateETag };
1
+ //#region src/etag.d.ts
2
+ /**
3
+ * FNV-1a Hash implementation
4
+ *
5
+ * Ported from https://github.com/tjwebb/fnv-plus/blob/master/index.js
6
+ *
7
+ * @remarks
8
+ * Simplified, optimized and add modified for 52 bit, which provides a larger hash space
9
+ * and still making use of Javascript's 53-bit integer space.
10
+ */
11
+ declare const fnv1a52: (str: string) => number;
12
+ /**
13
+ * Generates an ETag for the given payload.
14
+ *
15
+ * @param payload - The payload to generate an ETag for.
16
+ * @param weak - Whether to generate a weak ETag.
17
+ * @returns The generated ETag.
18
+ */
19
+ declare const generateETag: (payload: string, weak?: boolean) => string;
20
+ //#endregion
21
+ export { fnv1a52, generateETag };
22
+ //# sourceMappingURL=etag.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"etag.d.mts","names":[],"sources":["../src/etag.ts"],"sourcesContent":[],"mappings":";;AA2BA;AA2CA;;;;;;;cA3Ca;;;;;;;;cA2CA"}
package/dist/etag.mjs CHANGED
@@ -1 +1,2 @@
1
- import{n as e,t}from"./etag-DXmoR6hr.mjs";export{t as fnv1a52,e as generateETag};
1
+ const e=e=>{let t=e.length,n=0,r=0,i=8997,a=0,o=33826,s=0,c=40164,l=0,u=52210;for(;n<t;)i^=e.charCodeAt(n++),r=i*435,a=o*435,s=c*435,l=u*435,s+=i<<8,l+=o<<8,a+=r>>>16,i=r&65535,s+=a>>>16,o=a&65535,u=l+(s>>>16)&65535,c=s&65535;return(u&15)*281474976710656+c*4294967296+o*65536+(i^u>>4)},t=(t,n=!1)=>`${(n?`W/"`:`"`)+e(t).toString(36)+t.length.toString(36)}"`;export{e as fnv1a52,t as generateETag};
2
+ //# sourceMappingURL=etag.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"etag.mjs","names":[],"sources":["../src/etag.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * FNV-1a Hash implementation\n *\n * Ported from https://github.com/tjwebb/fnv-plus/blob/master/index.js\n *\n * @remarks\n * Simplified, optimized and add modified for 52 bit, which provides a larger hash space\n * and still making use of Javascript's 53-bit integer space.\n */\nexport const fnv1a52 = (str: string) => {\n const len = str.length;\n let i = 0;\n let t0 = 0;\n let v0 = 0x2325;\n let t1 = 0;\n let v1 = 0x8422;\n let t2 = 0;\n let v2 = 0x9ce4;\n let t3 = 0;\n let v3 = 0xcbf2;\n\n while (i < len) {\n v0 ^= str.charCodeAt(i++);\n t0 = v0 * 435;\n t1 = v1 * 435;\n t2 = v2 * 435;\n t3 = v3 * 435;\n t2 += v0 << 8;\n t3 += v1 << 8;\n t1 += t0 >>> 16;\n v0 = t0 & 65535;\n t2 += t1 >>> 16;\n v1 = t1 & 65535;\n v3 = (t3 + (t2 >>> 16)) & 65535;\n v2 = t2 & 65535;\n }\n\n return (\n (v3 & 15) * 281474976710656 +\n v2 * 4294967296 +\n v1 * 65536 +\n (v0 ^ (v3 >> 4))\n );\n};\n\n/**\n * Generates an ETag for the given payload.\n *\n * @param payload - The payload to generate an ETag for.\n * @param weak - Whether to generate a weak ETag.\n * @returns The generated ETag.\n */\nexport const generateETag = (payload: string, weak = false) => {\n const prefix = weak ? 'W/\"' : '\"';\n\n return `${prefix + fnv1a52(payload).toString(36) + payload.length.toString(36)}\"`;\n};\n"],"mappings":"AA2BA,MAAa,EAAW,GAAgB,CACtC,IAAM,EAAM,EAAI,OACZ,EAAI,EACJ,EAAK,EACL,EAAK,KACL,EAAK,EACL,EAAK,MACL,EAAK,EACL,EAAK,MACL,EAAK,EACL,EAAK,MAET,KAAO,EAAI,GACT,GAAM,EAAI,WAAW,IAAI,CACzB,EAAK,EAAK,IACV,EAAK,EAAK,IACV,EAAK,EAAK,IACV,EAAK,EAAK,IACV,GAAM,GAAM,EACZ,GAAM,GAAM,EACZ,GAAM,IAAO,GACb,EAAK,EAAK,MACV,GAAM,IAAO,GACb,EAAK,EAAK,MACV,EAAM,GAAM,IAAO,IAAO,MAC1B,EAAK,EAAK,MAGZ,OACG,EAAK,IAAM,gBACZ,EAAK,WACL,EAAK,OACJ,EAAM,GAAM,IAWJ,GAAgB,EAAiB,EAAO,KAG5C,IAFQ,EAAO,MAAQ,KAEX,EAAQ,EAAQ,CAAC,SAAS,GAAG,CAAG,EAAQ,OAAO,SAAS,GAAG,CAAC"}
@@ -0,0 +1 @@
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`../../type-checks/src/is-string.cjs`);require(`../../type-checks/src/index.cjs`);const n=require(`../../path/src/join-paths.cjs`);let r=require(`defu`);r=e.__toESM(r);let i=require(`glob`);const a={dot:!0};async function o(e,o){return(0,i.glob)(t.isString(e)?e.includes(`*`)?e:n.joinPaths(e,`**/*`):e.input?n.joinPaths(e.input,e.glob):e.glob,(0,r.default)(t.isString(e)?{}:{dot:e.dot,ignore:e.ignore},o??{},a))}async function s(e,t){let n=(await o(e,(0,r.default)({withFileTypes:!0},t??{}))).filter(e=>e.isFile());return t?.withFileTypes?n:n.map(e=>e.fullpath())}exports.listFiles=s;
@@ -0,0 +1,7 @@
1
+ import { GlobOptions } from "glob";
2
+
3
+ //#region ../fs/src/list-files.d.ts
4
+ type ListOptions = GlobOptions;
5
+ //#endregion
6
+ export { ListOptions };
7
+ //# sourceMappingURL=list-files.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-files.d.cts","names":[],"sources":["../../../../fs/src/list-files.ts"],"sourcesContent":[],"mappings":";;;KAyBY,WAAA,GAAc"}
@@ -0,0 +1,7 @@
1
+ import { GlobOptions } from "glob";
2
+
3
+ //#region ../fs/src/list-files.d.ts
4
+ type ListOptions = GlobOptions;
5
+ //#endregion
6
+ export { ListOptions };
7
+ //# sourceMappingURL=list-files.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-files.d.mts","names":[],"sources":["../../../../fs/src/list-files.ts"],"sourcesContent":[],"mappings":";;;KAyBY,WAAA,GAAc"}
@@ -0,0 +1,2 @@
1
+ import{isString as e}from"../../type-checks/src/is-string.mjs";import"../../type-checks/src/index.mjs";import{joinPaths as t}from"../../path/src/join-paths.mjs";import n from"defu";import{glob as r}from"glob";const i={dot:!0};async function a(a,o){return r(e(a)?a.includes(`*`)?a:t(a,`**/*`):a.input?t(a.input,a.glob):a.glob,n(e(a)?{}:{dot:a.dot,ignore:a.ignore},o??{},i))}async function o(e,t){let r=(await a(e,n({withFileTypes:!0},t??{}))).filter(e=>e.isFile());return t?.withFileTypes?r:r.map(e=>e.fullpath())}export{o as listFiles};
2
+ //# sourceMappingURL=list-files.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-files.mjs","names":["DEFAULT_OPTIONS: ListOptions"],"sources":["../../../../fs/src/list-files.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\";\nimport { isString } from \"@stryke/type-checks\";\nimport type { AssetGlob } from \"@stryke/types/file\";\nimport defu from \"defu\";\nimport type { GlobOptions, GlobOptionsWithFileTypesTrue, Path } from \"glob\";\nimport { glob } from \"glob\";\n\nexport type ListOptions = GlobOptions;\nexport type InferListReturnType<TOptions extends GlobOptions> =\n TOptions[\"withFileTypes\"] extends true ? Path[] : string[];\n\nconst DEFAULT_OPTIONS: ListOptions = {\n dot: true\n};\n\n/**\n * A files and directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport async function list<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n): Promise<InferListReturnType<TOptions>> {\n return glob(\n isString(filesGlob)\n ? filesGlob.includes(\"*\")\n ? filesGlob\n : joinPaths(filesGlob, \"**/*\")\n : filesGlob.input\n ? joinPaths(filesGlob.input, filesGlob.glob)\n : filesGlob.glob,\n defu(\n isString(filesGlob)\n ? {}\n : { dot: filesGlob.dot, ignore: filesGlob.ignore },\n options ?? {},\n DEFAULT_OPTIONS\n )\n ) as Promise<InferListReturnType<TOptions>>;\n}\n\n/**\n * A synchronous files and directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport function listSync<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n): InferListReturnType<TOptions> {\n return glob.sync(\n isString(filesGlob)\n ? filesGlob.includes(\"*\")\n ? filesGlob\n : joinPaths(filesGlob, \"**/*\")\n : filesGlob.input\n ? joinPaths(filesGlob.input, filesGlob.glob)\n : filesGlob.glob,\n defu(\n isString(filesGlob)\n ? {}\n : { dot: filesGlob.dot, ignore: filesGlob.ignore },\n options ?? {},\n DEFAULT_OPTIONS\n )\n ) as InferListReturnType<TOptions>;\n}\n\n/**\n * A file listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport async function listFiles<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = (\n await list(\n filesGlob,\n defu(\n { withFileTypes: true },\n options ?? {}\n ) as GlobOptionsWithFileTypesTrue\n )\n ).filter(ret => ret.isFile());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n\n/**\n * A synchronous file listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport function listFilesSync<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = listSync(\n filesGlob,\n defu({ withFileTypes: true }, options ?? {}) as GlobOptionsWithFileTypesTrue\n ).filter(ret => ret.isFile());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n\n/**\n * A directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport async function listDirectories<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = (\n await list(\n filesGlob,\n defu(\n { withFileTypes: true },\n options ?? {}\n ) as GlobOptionsWithFileTypesTrue\n )\n ).filter(ret => ret.isDirectory());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n\n/**\n * A synchronous directories listing helper function\n *\n * @param filesGlob - A glob pattern to match files\n * @returns A list of file paths\n */\nexport function listDirectoriesSync<TOptions extends ListOptions>(\n filesGlob: string | Omit<AssetGlob, \"output\">,\n options?: TOptions\n) {\n const result = listSync(\n filesGlob,\n defu({ withFileTypes: true }, options ?? {}) as GlobOptionsWithFileTypesTrue\n ).filter(ret => ret.isDirectory());\n if (!options?.withFileTypes) {\n return result.map(file => file.fullpath()) as InferListReturnType<TOptions>;\n }\n\n return result as InferListReturnType<TOptions>;\n}\n"],"mappings":"iNA6BA,MAAMA,EAA+B,CACnC,IAAK,GACN,CAQD,eAAsB,EACpB,EACA,EACwC,CACxC,OAAO,EACL,EAAS,EAAU,CACf,EAAU,SAAS,IAAI,CACrB,EACA,EAAU,EAAW,OAAO,CAC9B,EAAU,MACR,EAAU,EAAU,MAAO,EAAU,KAAK,CAC1C,EAAU,KAChB,EACE,EAAS,EAAU,CACf,EAAE,CACF,CAAE,IAAK,EAAU,IAAK,OAAQ,EAAU,OAAQ,CACpD,GAAW,EAAE,CACb,EACD,CACF,CAqCH,eAAsB,EACpB,EACA,EACA,CACA,IAAM,GACJ,MAAM,EACJ,EACA,EACE,CAAE,cAAe,GAAM,CACvB,GAAW,EAAE,CACd,CACF,EACD,OAAO,GAAO,EAAI,QAAQ,CAAC,CAK7B,OAJK,GAAS,cAIP,EAHE,EAAO,IAAI,GAAQ,EAAK,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`);let t=require(`node:fs/promises`);const n=async e=>{if(!e)throw Error(`No file path provided to read data`);return(0,t.readFile)(e,{encoding:`utf8`})};exports.readFile=n;
@@ -0,0 +1,2 @@
1
+ import{readFile as e}from"node:fs/promises";const t=async t=>{if(!t)throw Error(`No file path provided to read data`);return e(t,{encoding:`utf8`})};export{t as readFile};
2
+ //# sourceMappingURL=read-file.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-file.mjs","names":["readFile","readFileFs"],"sources":["../../../../fs/src/read-file.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { existsSync, readFileSync as readFileSyncFs } from \"node:fs\";\nimport { readFile as readFileFs } from \"node:fs/promises\";\n\n/**\n * Read the given content to the given file path\n *\n * @param filePath - The file path to write to\n */\nexport const readFileSync = (filePath: string): string => {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n\n return readFileSyncFs(filePath, { encoding: \"utf8\" });\n};\n\n/**\n * Read the given content to the given file path\n *\n * @param filePath - The file path to read to\n */\nexport const readFile = async (filePath: string): Promise<string> => {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n\n return readFileFs(filePath, { encoding: \"utf8\" });\n};\n\n/**\n * Reads a file if it exists, otherwise returns an empty string.\n *\n * @param path - The path to the file to read.\n * @returns The content of the file if it exists, otherwise an empty string.\n */\nexport function readFileIfExistingSync(path: string) {\n return existsSync(path) ? readFileSync(path) : \"\";\n}\n\n/**\n * Reads a file if it exists, otherwise returns an empty string.\n *\n * @param path - The path to the file to read.\n * @returns The content of the file if it exists, otherwise an empty string.\n */\nexport async function readFileIfExisting(path: string) {\n return existsSync(path) ? readFile(path) : \"\";\n}\n"],"mappings":"4CAuCA,MAAaA,EAAW,KAAO,IAAsC,CACnE,GAAI,CAAC,EACH,MAAU,MAAM,qCAAqC,CAGvD,OAAOC,EAAW,EAAU,CAAE,SAAU,OAAQ,CAAC"}
@@ -1 +1 @@
1
- const e=require(`./hash-files-DNDrDY17.cjs`);require(`./src-QUlAu3to.cjs`),require(`./murmurhash-CVcuhG5F.cjs`),exports.hashDirectory=e.t,exports.hashFiles=e.n;
1
+ const e=require(`./fs/src/list-files.cjs`),t=require(`./fs/src/read-file.cjs`),n=require(`./murmurhash.cjs`);async function r(e,r){let i={};return await Promise.all(e.map(async e=>{i[e]=await t.readFile(e)})),n.murmurhash(i,r)}async function i(t,n={}){return n.ignore=n.ignore??[`**/node_modules/**`,`**/.git/**`,`**/.nx/**`,`**/.cache/**`,`**/.storm/**`,`**/tmp/**`],r(await e.listFiles(t,n),n)}exports.hashDirectory=i,exports.hashFiles=r;
@@ -1,2 +1,24 @@
1
- import { n as hashFiles, t as hashDirectory } from "./hash-files-DMXzIbQw.cjs";
2
- export { hashDirectory, hashFiles };
1
+ import { ListOptions } from "./fs/src/list-files.cjs";
2
+ import { HashOptions } from "./murmurhash.cjs";
3
+
4
+ //#region src/hash-files.d.ts
5
+
6
+ /**
7
+ * Hash a list of file paths into a string based on the file content
8
+ *
9
+ * @param files - The list of file paths to hash
10
+ * @param options - Hashing options
11
+ * @returns A hashed string value
12
+ */
13
+ declare function hashFiles(files: string[], options?: HashOptions): Promise<string>;
14
+ /**
15
+ * Hash a folder path into a string based on the file content
16
+ *
17
+ * @param directoryPath - The folder path to hash
18
+ * @param options - Hashing options. By default, the `node_modules`, `.git`, `.nx`, `.cache`, and `tmp` folders is ignored.
19
+ * @returns A hashed string value
20
+ */
21
+ declare function hashDirectory(directoryPath: string, options?: HashOptions & ListOptions): Promise<string>;
22
+ //#endregion
23
+ export { hashDirectory, hashFiles };
24
+ //# sourceMappingURL=hash-files.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash-files.d.cts","names":[],"sources":["../src/hash-files.ts"],"sourcesContent":[],"mappings":";;;;;;;AA+BA;AAqBA;;;;AAGU,iBAxBY,SAAA,CAwBZ,KAAA,EAAA,MAAA,EAAA,EAAA,OAAA,CAAA,EAtBE,WAsBF,CAAA,EArBP,OAqBO,CAAA,MAAA,CAAA;;;;;;;;iBAHY,aAAA,kCAEX,cAAc,cACtB"}
@@ -1,2 +1,24 @@
1
- import { n as hashFiles, t as hashDirectory } from "./hash-files-C8KCroZK.mjs";
2
- export { hashDirectory, hashFiles };
1
+ import { ListOptions } from "./fs/src/list-files.mjs";
2
+ import { HashOptions } from "./murmurhash.mjs";
3
+
4
+ //#region src/hash-files.d.ts
5
+
6
+ /**
7
+ * Hash a list of file paths into a string based on the file content
8
+ *
9
+ * @param files - The list of file paths to hash
10
+ * @param options - Hashing options
11
+ * @returns A hashed string value
12
+ */
13
+ declare function hashFiles(files: string[], options?: HashOptions): Promise<string>;
14
+ /**
15
+ * Hash a folder path into a string based on the file content
16
+ *
17
+ * @param directoryPath - The folder path to hash
18
+ * @param options - Hashing options. By default, the `node_modules`, `.git`, `.nx`, `.cache`, and `tmp` folders is ignored.
19
+ * @returns A hashed string value
20
+ */
21
+ declare function hashDirectory(directoryPath: string, options?: HashOptions & ListOptions): Promise<string>;
22
+ //#endregion
23
+ export { hashDirectory, hashFiles };
24
+ //# sourceMappingURL=hash-files.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash-files.d.mts","names":[],"sources":["../src/hash-files.ts"],"sourcesContent":[],"mappings":";;;;;;;AA+BA;AAqBA;;;;AAGU,iBAxBY,SAAA,CAwBZ,KAAA,EAAA,MAAA,EAAA,EAAA,OAAA,CAAA,EAtBE,WAsBF,CAAA,EArBP,OAqBO,CAAA,MAAA,CAAA;;;;;;;;iBAHY,aAAA,kCAEX,cAAc,cACtB"}
@@ -1 +1,2 @@
1
- import"./src-GI5wB-mz.mjs";import{n as e,t}from"./hash-files-BMmt9LzB.mjs";import"./murmurhash-CoNWpOwZ.mjs";export{t as hashDirectory,e as hashFiles};
1
+ import{listFiles as e}from"./fs/src/list-files.mjs";import{readFile as t}from"./fs/src/read-file.mjs";import{murmurhash as n}from"./murmurhash.mjs";async function r(e,r){let i={};return await Promise.all(e.map(async e=>{i[e]=await t(e)})),n(i,r)}async function i(t,n={}){return n.ignore=n.ignore??[`**/node_modules/**`,`**/.git/**`,`**/.nx/**`,`**/.cache/**`,`**/.storm/**`,`**/tmp/**`],r(await e(t,n),n)}export{i as hashDirectory,r as hashFiles};
2
+ //# sourceMappingURL=hash-files.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash-files.mjs","names":[],"sources":["../src/hash-files.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 { ListOptions } from \"@stryke/fs/list-files\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { readFile } from \"@stryke/fs/read-file\";\nimport type { HashOptions } from \"./murmurhash\";\nimport { murmurhash } from \"./murmurhash\";\n\n/**\n * Hash a list of file paths into a string based on the file content\n *\n * @param files - The list of file paths to hash\n * @param options - Hashing options\n * @returns A hashed string value\n */\nexport async function hashFiles(\n files: string[],\n options?: HashOptions\n): Promise<string> {\n const result = {} as Record<string, string>;\n await Promise.all(\n files.map(async file => {\n result[file] = await readFile(file);\n })\n );\n\n return murmurhash(result, options);\n}\n\n/**\n * Hash a folder path into a string based on the file content\n *\n * @param directoryPath - The folder path to hash\n * @param options - Hashing options. By default, the `node_modules`, `.git`, `.nx`, `.cache`, and `tmp` folders is ignored.\n * @returns A hashed string value\n */\nexport async function hashDirectory(\n directoryPath: string,\n options: HashOptions & ListOptions = {}\n): Promise<string> {\n options.ignore = options.ignore ?? [\n \"**/node_modules/**\",\n \"**/.git/**\",\n \"**/.nx/**\",\n \"**/.cache/**\",\n \"**/.storm/**\",\n \"**/tmp/**\"\n ];\n\n return hashFiles(await listFiles(directoryPath, options), options);\n}\n"],"mappings":"oJA+BA,eAAsB,EACpB,EACA,EACiB,CACjB,IAAM,EAAS,EAAE,CAOjB,OANA,MAAM,QAAQ,IACZ,EAAM,IAAI,KAAM,IAAQ,CACtB,EAAO,GAAQ,MAAM,EAAS,EAAK,EACnC,CACH,CAEM,EAAW,EAAQ,EAAQ,CAUpC,eAAsB,EACpB,EACA,EAAqC,EAAE,CACtB,CAUjB,MATA,GAAQ,OAAS,EAAQ,QAAU,CACjC,qBACA,aACA,YACA,eACA,eACA,YACD,CAEM,EAAU,MAAM,EAAU,EAAe,EAAQ,CAAE,EAAQ"}
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./hash-files-DNDrDY17.cjs`),t=require(`./digest-REorjd4v.cjs`);require(`./src-QUlAu3to.cjs`);const n=require(`./etag-SIhKWCBx.cjs`),r=require(`./murmurhash-CVcuhG5F.cjs`),i=require(`./md5-Cwdph7YU.cjs`),a=require(`./xx-hash--6giOvM7.cjs`);exports.Hasher=t.t,exports.createHasher=t.n,exports.digest=t.r,exports.fnv1a52=n.t,exports.generateETag=n.n,exports.hash=t.i,exports.hashDirectory=e.t,exports.hashFiles=e.n,exports.md5=i.t,exports.murmurhash=r.t,exports.xxHash128=a.t,exports.xxHash32=a.n,exports.xxHash64=a.r;
1
+ const e=require(`./digest.cjs`),t=require(`./etag.cjs`),n=require(`./murmurhash.cjs`),r=require(`./hash-files.cjs`),i=require(`./md5.cjs`),a=require(`./xx-hash.cjs`);exports.Hasher=e.Hasher,exports.createHasher=e.createHasher,exports.digest=e.digest,exports.fnv1a52=t.fnv1a52,exports.generateETag=t.generateETag,exports.hash=e.hash,exports.hashDirectory=r.hashDirectory,exports.hashFiles=r.hashFiles,exports.md5=i.md5,exports.murmurhash=n.murmurhash,exports.xxHash128=a.xxHash128,exports.xxHash32=a.xxHash32,exports.xxHash64=a.xxHash64;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as hash, i as digest, n as Hasher, r as createHasher, t as AlgorithmIdentifier } from "./digest-Yy26O9oW.cjs";
2
- import { n as generateETag, t as fnv1a52 } from "./etag-BdoEX_I_.cjs";
3
- import { n as hashFiles, t as hashDirectory } from "./hash-files-DMXzIbQw.cjs";
4
- import { n as murmurhash, t as HashOptions } from "./murmurhash-dzYfmtjT.cjs";
5
- import { t as md5 } from "./md5-CCxA7tZv.cjs";
6
- import { n as xxHash32, r as xxHash64, t as xxHash128 } from "./xx-hash-BnLXga7m.cjs";
1
+ import { AlgorithmIdentifier, Hasher, createHasher, digest, hash } from "./digest.cjs";
2
+ import { fnv1a52, generateETag } from "./etag.cjs";
3
+ import { HashOptions, murmurhash } from "./murmurhash.cjs";
4
+ import { hashDirectory, hashFiles } from "./hash-files.cjs";
5
+ import { md5 } from "./md5.cjs";
6
+ import { xxHash128, xxHash32, xxHash64 } from "./xx-hash.cjs";
7
7
  export { AlgorithmIdentifier, HashOptions, Hasher, createHasher, digest, fnv1a52, generateETag, hash, hashDirectory, hashFiles, md5, murmurhash, xxHash128, xxHash32, xxHash64 };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as hash, i as digest, n as Hasher, r as createHasher, t as AlgorithmIdentifier } from "./digest-CG1Sk96A.mjs";
2
- import { n as generateETag, t as fnv1a52 } from "./etag-Kuj0WZon.mjs";
3
- import { n as hashFiles, t as hashDirectory } from "./hash-files-C8KCroZK.mjs";
4
- import { n as murmurhash, t as HashOptions } from "./murmurhash-D6qhmMhz.mjs";
5
- import { t as md5 } from "./md5-C_8IsDev.mjs";
6
- import { n as xxHash32, r as xxHash64, t as xxHash128 } from "./xx-hash-DyeY-GKZ.mjs";
1
+ import { AlgorithmIdentifier, Hasher, createHasher, digest, hash } from "./digest.mjs";
2
+ import { fnv1a52, generateETag } from "./etag.mjs";
3
+ import { HashOptions, murmurhash } from "./murmurhash.mjs";
4
+ import { hashDirectory, hashFiles } from "./hash-files.mjs";
5
+ import { md5 } from "./md5.mjs";
6
+ import { xxHash128, xxHash32, xxHash64 } from "./xx-hash.mjs";
7
7
  export { AlgorithmIdentifier, HashOptions, Hasher, createHasher, digest, fnv1a52, generateETag, hash, hashDirectory, hashFiles, md5, murmurhash, xxHash128, xxHash32, xxHash64 };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{i as e,n as t,r as n,t as r}from"./digest-311IQaur.mjs";import"./src-GI5wB-mz.mjs";import{n as i,t as a}from"./etag-DXmoR6hr.mjs";import{n as o,t as s}from"./hash-files-BMmt9LzB.mjs";import{t as c}from"./murmurhash-CoNWpOwZ.mjs";import{t as l}from"./md5-CnYTBU9u.mjs";import{n as u,r as d,t as f}from"./xx-hash-SyVhkkcA.mjs";export{r as Hasher,t as createHasher,n as digest,a as fnv1a52,i as generateETag,e as hash,s as hashDirectory,o as hashFiles,l as md5,c as murmurhash,f as xxHash128,u as xxHash32,d as xxHash64};
1
+ import{Hasher as e,createHasher as t,digest as n,hash as r}from"./digest.mjs";import{fnv1a52 as i,generateETag as a}from"./etag.mjs";import{murmurhash as o}from"./murmurhash.mjs";import{hashDirectory as s,hashFiles as c}from"./hash-files.mjs";import{md5 as l}from"./md5.mjs";import{xxHash128 as u,xxHash32 as d,xxHash64 as f}from"./xx-hash.mjs";export{e as Hasher,t as createHasher,n as digest,i as fnv1a52,a as generateETag,r as hash,s as hashDirectory,c as hashFiles,l as md5,o as murmurhash,u as xxHash128,d as xxHash32,f as xxHash64};
package/dist/md5.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./md5-Cwdph7YU.cjs`);exports.md5=e.t;
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`node:crypto`);function n(e,n=32){return(0,t.createHash)(`md5`).update(e).digest(`hex`).slice(0,n)}exports.md5=n;
package/dist/md5.d.cts CHANGED
@@ -1,2 +1,12 @@
1
- import { t as md5 } from "./md5-CCxA7tZv.cjs";
2
- export { md5 };
1
+ //#region src/md5.d.ts
2
+ /**
3
+ * Generate an MD5 hash of the provided content.
4
+ *
5
+ * @param content - The content to hash.
6
+ * @param length - The length of the hash to return.
7
+ * @returns The generated MD5 hash.
8
+ */
9
+ declare function md5(content: string, length?: number): string;
10
+ //#endregion
11
+ export { md5 };
12
+ //# sourceMappingURL=md5.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md5.d.cts","names":[],"sources":["../src/md5.ts"],"sourcesContent":[],"mappings":";;AA2BA;;;;;;iBAAgB,GAAA"}
package/dist/md5.d.mts CHANGED
@@ -1,2 +1,12 @@
1
- import { t as md5 } from "./md5-C_8IsDev.mjs";
2
- export { md5 };
1
+ //#region src/md5.d.ts
2
+ /**
3
+ * Generate an MD5 hash of the provided content.
4
+ *
5
+ * @param content - The content to hash.
6
+ * @param length - The length of the hash to return.
7
+ * @returns The generated MD5 hash.
8
+ */
9
+ declare function md5(content: string, length?: number): string;
10
+ //#endregion
11
+ export { md5 };
12
+ //# sourceMappingURL=md5.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md5.d.mts","names":[],"sources":["../src/md5.ts"],"sourcesContent":[],"mappings":";;AA2BA;;;;;;iBAAgB,GAAA"}
package/dist/md5.mjs CHANGED
@@ -1 +1,2 @@
1
- import{t as e}from"./md5-CnYTBU9u.mjs";export{e as md5};
1
+ import{createHash as e}from"node:crypto";function t(t,n=32){return e(`md5`).update(t).digest(`hex`).slice(0,n)}export{t as md5};
2
+ //# sourceMappingURL=md5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"md5.mjs","names":[],"sources":["../src/md5.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 { createHash } from \"node:crypto\";\n\n/**\n * Generate an MD5 hash of the provided content.\n *\n * @param content - The content to hash.\n * @param length - The length of the hash to return.\n * @returns The generated MD5 hash.\n */\nexport function md5(content: string, length = 32) {\n return createHash(\"md5\").update(content).digest(\"hex\").slice(0, length);\n}\n"],"mappings":"yCA2BA,SAAgB,EAAI,EAAiB,EAAS,GAAI,CAChD,OAAO,EAAW,MAAM,CAAC,OAAO,EAAQ,CAAC,OAAO,MAAM,CAAC,MAAM,EAAG,EAAO"}
@@ -1 +1 @@
1
- const e=require(`./murmurhash-CVcuhG5F.cjs`);exports.murmurhash=e.t;
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`ohash`);function n(e,n){let r=(0,t.hash)(e),i=n?.maxLength??32;return r.length>i?r.slice(0,i):r}exports.murmurhash=n;
@@ -1,2 +1,23 @@
1
- import { n as murmurhash, t as HashOptions } from "./murmurhash-dzYfmtjT.cjs";
2
- export { HashOptions, murmurhash };
1
+ //#region src/murmurhash.d.ts
2
+ interface HashOptions {
3
+ /**
4
+ * The maximum length of the hash
5
+ *
6
+ * @defaultValue 32
7
+ */
8
+ maxLength?: number;
9
+ }
10
+ /**
11
+ * Use a [MurmurHash3](https://en.wikipedia.org/wiki/MurmurHash) based algorithm to hash any JS value into a string.
12
+ *
13
+ * @see https://github.com/ohash/ohash
14
+ * @see https://en.wikipedia.org/wiki/MurmurHash
15
+ *
16
+ * @param content - The value to hash
17
+ * @param options - Hashing options
18
+ * @returns A hashed string value
19
+ */
20
+ declare function murmurhash(content: any, options?: HashOptions): string;
21
+ //#endregion
22
+ export { HashOptions, murmurhash };
23
+ //# sourceMappingURL=murmurhash.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"murmurhash.d.cts","names":[],"sources":["../src/murmurhash.ts"],"sourcesContent":[],"mappings":";UAoBiB,WAAA;EAAA;AAmBjB;;;;;;;;;;;;;;;;iBAAgB,UAAA,yBAAmC"}
@@ -1,2 +1,23 @@
1
- import { n as murmurhash, t as HashOptions } from "./murmurhash-D6qhmMhz.mjs";
2
- export { HashOptions, murmurhash };
1
+ //#region src/murmurhash.d.ts
2
+ interface HashOptions {
3
+ /**
4
+ * The maximum length of the hash
5
+ *
6
+ * @defaultValue 32
7
+ */
8
+ maxLength?: number;
9
+ }
10
+ /**
11
+ * Use a [MurmurHash3](https://en.wikipedia.org/wiki/MurmurHash) based algorithm to hash any JS value into a string.
12
+ *
13
+ * @see https://github.com/ohash/ohash
14
+ * @see https://en.wikipedia.org/wiki/MurmurHash
15
+ *
16
+ * @param content - The value to hash
17
+ * @param options - Hashing options
18
+ * @returns A hashed string value
19
+ */
20
+ declare function murmurhash(content: any, options?: HashOptions): string;
21
+ //#endregion
22
+ export { HashOptions, murmurhash };
23
+ //# sourceMappingURL=murmurhash.d.mts.map