@stryke/hash 0.12.14 → 0.12.22

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 (86) hide show
  1. package/CHANGELOG.md +384 -0
  2. package/README.md +18 -9
  3. package/dist/digest-311IQaur.mjs +2 -0
  4. package/dist/digest-311IQaur.mjs.map +1 -0
  5. package/dist/digest-CG1Sk96A.d.mts +32 -0
  6. package/dist/digest-CG1Sk96A.d.mts.map +1 -0
  7. package/dist/digest-REorjd4v.cjs +1 -0
  8. package/dist/digest-Yy26O9oW.d.cts +32 -0
  9. package/dist/digest-Yy26O9oW.d.cts.map +1 -0
  10. package/dist/digest.cjs +1 -36
  11. package/dist/digest.d.cts +2 -0
  12. package/dist/digest.d.mts +2 -0
  13. package/dist/digest.mjs +1 -1
  14. package/dist/{etag.d.ts → etag-BdoEX_I_.d.cts} +6 -2
  15. package/dist/etag-BdoEX_I_.d.cts.map +1 -0
  16. package/dist/etag-DXmoR6hr.mjs +2 -0
  17. package/dist/etag-DXmoR6hr.mjs.map +1 -0
  18. package/dist/etag-Kuj0WZon.d.mts +22 -0
  19. package/dist/etag-Kuj0WZon.d.mts.map +1 -0
  20. package/dist/etag-SIhKWCBx.cjs +1 -0
  21. package/dist/etag.cjs +1 -23
  22. package/dist/etag.d.cts +2 -0
  23. package/dist/etag.d.mts +2 -0
  24. package/dist/etag.mjs +1 -1
  25. package/dist/hash-files-BMmt9LzB.mjs +2 -0
  26. package/dist/hash-files-BMmt9LzB.mjs.map +1 -0
  27. package/dist/hash-files-C8KCroZK.d.mts +26 -0
  28. package/dist/hash-files-C8KCroZK.d.mts.map +1 -0
  29. package/dist/hash-files-DMXzIbQw.d.cts +26 -0
  30. package/dist/hash-files-DMXzIbQw.d.cts.map +1 -0
  31. package/dist/hash-files-DNDrDY17.cjs +1 -0
  32. package/dist/hash-files.cjs +1 -19
  33. package/dist/hash-files.d.cts +2 -0
  34. package/dist/hash-files.d.mts +2 -0
  35. package/dist/hash-files.mjs +1 -1
  36. package/dist/index.cjs +1 -71
  37. package/dist/index.d.cts +7 -0
  38. package/dist/index.d.mts +7 -0
  39. package/dist/index.mjs +1 -1
  40. package/dist/{md5.d.ts → md5-CCxA7tZv.d.cts} +5 -1
  41. package/dist/md5-CCxA7tZv.d.cts.map +1 -0
  42. package/dist/md5-C_8IsDev.d.mts +12 -0
  43. package/dist/md5-C_8IsDev.d.mts.map +1 -0
  44. package/dist/md5-CnYTBU9u.mjs +2 -0
  45. package/dist/md5-CnYTBU9u.mjs.map +1 -0
  46. package/dist/md5-Cwdph7YU.cjs +1 -0
  47. package/dist/md5.cjs +1 -10
  48. package/dist/md5.d.cts +2 -0
  49. package/dist/md5.d.mts +2 -0
  50. package/dist/md5.mjs +1 -1
  51. package/dist/murmurhash-CVcuhG5F.cjs +1 -0
  52. package/dist/murmurhash-CoNWpOwZ.mjs +2 -0
  53. package/dist/murmurhash-CoNWpOwZ.mjs.map +1 -0
  54. package/dist/murmurhash-D6qhmMhz.d.mts +23 -0
  55. package/dist/murmurhash-D6qhmMhz.d.mts.map +1 -0
  56. package/dist/murmurhash-dzYfmtjT.d.cts +23 -0
  57. package/dist/murmurhash-dzYfmtjT.d.cts.map +1 -0
  58. package/dist/murmurhash.cjs +1 -12
  59. package/dist/murmurhash.d.cts +2 -0
  60. package/dist/murmurhash.d.mts +2 -0
  61. package/dist/murmurhash.mjs +1 -1
  62. package/dist/neutral.cjs +1 -49
  63. package/dist/neutral.d.cts +5 -0
  64. package/dist/neutral.d.mts +5 -0
  65. package/dist/neutral.mjs +1 -1
  66. package/dist/src-GI5wB-mz.mjs +2 -0
  67. package/dist/src-GI5wB-mz.mjs.map +1 -0
  68. package/dist/src-QUlAu3to.cjs +1 -0
  69. package/dist/xx-hash--6giOvM7.cjs +1 -0
  70. package/dist/xx-hash-BnLXga7m.d.cts +7 -0
  71. package/dist/xx-hash-BnLXga7m.d.cts.map +1 -0
  72. package/dist/xx-hash-DyeY-GKZ.d.mts +7 -0
  73. package/dist/xx-hash-DyeY-GKZ.d.mts.map +1 -0
  74. package/dist/xx-hash-SyVhkkcA.mjs +2 -0
  75. package/dist/xx-hash-SyVhkkcA.mjs.map +1 -0
  76. package/dist/xx-hash.cjs +1 -18
  77. package/dist/xx-hash.d.cts +2 -0
  78. package/dist/xx-hash.d.mts +2 -0
  79. package/dist/xx-hash.mjs +1 -1
  80. package/package.json +26 -146
  81. package/dist/digest.d.ts +0 -28
  82. package/dist/hash-files.d.ts +0 -18
  83. package/dist/index.d.ts +0 -14
  84. package/dist/murmurhash.d.ts +0 -19
  85. package/dist/neutral.d.ts +0 -4
  86. package/dist/xx-hash.d.ts +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-GI5wB-mz.mjs","names":["isBuffer: typeof Buffer.isBuffer","isBuffer"],"sources":["../../type-checks/src/is-buffer.ts","../../type-checks/src/type-detect.ts","../../type-checks/src/is-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\nexport const isBufferExists = typeof Buffer !== \"undefined\";\n\n/**\n * Check if the provided value's type is `Buffer`\n */\nexport const isBuffer: typeof Buffer.isBuffer = isBufferExists\n ? Buffer.isBuffer.bind(Buffer)\n : /**\n * Check if the provided value's type is `Buffer`\n\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Buffer`\n */\n function isBuffer(\n value: Parameters<typeof Buffer.isBuffer>[0]\n ): value is Buffer {\n return false;\n };\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isBuffer } from \"./is-buffer\";\n\nconst globalObject = (Obj => {\n if (typeof globalThis === \"object\") {\n return globalThis;\n }\n Object.defineProperty(Obj, \"typeDetectGlobalObject\", {\n get() {\n return this;\n },\n configurable: true\n });\n\n // // biome-ignore lint/correctness/noUndeclaredVariables: <explanation>\n // const global = typeDetectGlobalObject;\n\n // // biome-ignore lint/performance/noDelete: <explanation>\n // delete Obj.typeDetectGlobalObject;\n return globalThis;\n})(Object.prototype);\n\nexport function typeDetect(obj: unknown): string {\n // NOTE: isBuffer must execute before type-detect,\n // because type-detect returns 'Uint8Array'.\n if (isBuffer(obj)) {\n return \"Buffer\";\n }\n\n const typeofObj = typeof obj;\n if (typeofObj !== \"object\") {\n return typeofObj;\n }\n\n if (obj === null) {\n return \"null\";\n }\n\n if (obj === globalObject) {\n return \"global\";\n }\n\n if (\n Array.isArray(obj) &&\n (Symbol.toStringTag === undefined || !(Symbol.toStringTag in obj))\n ) {\n return \"Array\";\n }\n\n // https://html.spec.whatwg.org/multipage/browsers.html#location\n if (typeof globalThis === \"object\" && globalThis !== null) {\n if (\n typeof (globalThis as any).location === \"object\" &&\n obj === (globalThis as any).location\n ) {\n return \"Location\";\n }\n\n // https://html.spec.whatwg.org/#document\n if (\n typeof (globalThis as any).document === \"object\" &&\n obj === (globalThis as any).document\n ) {\n return \"Document\";\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray\n if (typeof (globalThis as any).navigator === \"object\") {\n if (\n typeof (globalThis as any).navigator.mimeTypes === \"object\" &&\n obj === (globalThis as any).navigator.mimeTypes\n ) {\n return \"MimeTypeArray\";\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray\n if (\n typeof (globalThis as any).navigator.plugins === \"object\" &&\n obj === (globalThis as any).navigator.plugins\n ) {\n return \"PluginArray\";\n }\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray\n if (\n (typeof (globalThis as any).HTMLElement === \"function\" ||\n typeof (globalThis as any).HTMLElement === \"object\") &&\n obj instanceof (globalThis as any).HTMLElement\n ) {\n if ((obj as any).tagName === \"BLOCKQUOTE\") {\n return \"HTMLQuoteElement\";\n }\n\n // https://html.spec.whatwg.org/#htmltabledatacellelement\n if ((obj as any).tagName === \"TD\") {\n return \"HTMLTableDataCellElement\";\n }\n\n // https://html.spec.whatwg.org/#htmltableheadercellelement\n if ((obj as any).tagName === \"TH\") {\n return \"HTMLTableHeaderCellElement\";\n }\n }\n }\n\n const stringTag =\n Symbol.toStringTag !== undefined && (obj as any)[Symbol.toStringTag];\n if (typeof stringTag === \"string\") {\n return stringTag;\n }\n\n const objPrototype = Object.getPrototypeOf(obj);\n if (objPrototype === RegExp.prototype) {\n return \"RegExp\";\n }\n\n if (objPrototype === Date.prototype) {\n return \"Date\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag\n if (typeof Promise !== \"undefined\" && objPrototype === Promise.prototype) {\n return \"Promise\";\n }\n\n if (typeof Set !== \"undefined\" && objPrototype === Set.prototype) {\n return \"Set\";\n }\n\n if (typeof Map !== \"undefined\" && objPrototype === Map.prototype) {\n return \"Map\";\n }\n\n if (typeof WeakSet !== \"undefined\" && objPrototype === WeakSet.prototype) {\n return \"WeakSet\";\n }\n\n if (typeof WeakMap !== \"undefined\" && objPrototype === WeakMap.prototype) {\n return \"WeakMap\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag\n if (typeof DataView !== \"undefined\" && objPrototype === DataView.prototype) {\n return \"DataView\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag\n if (\n typeof Map !== \"undefined\" &&\n objPrototype === Object.getPrototypeOf(new Map().entries())\n ) {\n return \"Map Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag\n if (\n typeof Set !== \"undefined\" &&\n objPrototype === Object.getPrototypeOf(new Set().entries())\n ) {\n return \"Set Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag\n if (\n typeof Array.prototype[Symbol.iterator] === \"function\" &&\n objPrototype === Object.getPrototypeOf([][Symbol.iterator]())\n ) {\n return \"Array Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag\n if (\n Symbol.iterator !== undefined &&\n typeof String.prototype[Symbol.iterator] === \"function\" &&\n Object.getPrototypeOf(\"\"[Symbol.iterator]()) &&\n objPrototype === Object.getPrototypeOf(\"\"[Symbol.iterator]())\n ) {\n return \"String Iterator\";\n }\n\n if (objPrototype === null) {\n return \"Object\";\n }\n\n return Object.prototype.toString.call(obj).slice(8, -1);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isString = (value: unknown): value is string => {\n try {\n return typeof value === \"string\";\n } catch {\n return false;\n }\n};\n"],"mappings":"AAkB8B,OAAO,OAAW,KAM5C,OAAO,SAAS,KAAK,OAAO,ECJV,IAChB,OAAO,YAAe,UAG1B,OAAO,eAAe,EAAK,yBAA0B,CACnD,KAAM,CACJ,OAAO,MAET,aAAc,GACf,CAAC,CAPO,aAeR,OAAO,UAAU,CCnBpB,MAAa,EAAY,GAAoC,CAC3D,GAAI,CACF,OAAO,OAAO,GAAU,cAClB,CACN,MAAO"}
@@ -0,0 +1 @@
1
+ const e=typeof Buffer<`u`,t=e?Buffer.isBuffer.bind(Buffer):function(e){return!1},n=(e=>(typeof globalThis==`object`||Object.defineProperty(e,`typeDetectGlobalObject`,{get(){return this},configurable:!0}),globalThis))(Object.prototype),r=e=>{try{return typeof e==`string`}catch{return!1}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
@@ -0,0 +1 @@
1
+ const e=require(`./hash-files-DNDrDY17.cjs`);let t=require(`js-xxhash`);function n(e,n){let r=0n;for(let i=0;i<n;i++)r=(r<<32n)+BigInt((0,t.xxHash32)(e,i));return r}const r=e=>(0,t.xxHash32)(e,0),i=e=>n(e,2),a=e=>n(e,4);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
@@ -0,0 +1,7 @@
1
+ //#region src/xx-hash.d.ts
2
+ declare const xxHash32: (s: string) => number;
3
+ declare const xxHash64: (s: string) => bigint;
4
+ declare const xxHash128: (s: string) => bigint;
5
+ //#endregion
6
+ export { xxHash32 as n, xxHash64 as r, xxHash128 as t };
7
+ //# sourceMappingURL=xx-hash-BnLXga7m.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xx-hash-BnLXga7m.d.cts","names":[],"sources":["../src/xx-hash.ts"],"sourcesContent":[],"mappings":";cAoCa;AAAA,cACA,QAD4C,EAAA,CAAA,CAAA,EAAA,MAAA,EAAA,GAAA,MAAA;AAC5C,cACA,SADyC,EAAA,CAAA,CAAA,EAAA,MAAA,EAAA,GAAA,MAAA"}
@@ -0,0 +1,7 @@
1
+ //#region src/xx-hash.d.ts
2
+ declare const xxHash32: (s: string) => number;
3
+ declare const xxHash64: (s: string) => bigint;
4
+ declare const xxHash128: (s: string) => bigint;
5
+ //#endregion
6
+ export { xxHash32 as n, xxHash64 as r, xxHash128 as t };
7
+ //# sourceMappingURL=xx-hash-DyeY-GKZ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xx-hash-DyeY-GKZ.d.mts","names":[],"sources":["../src/xx-hash.ts"],"sourcesContent":[],"mappings":";cAoCa;AAAA,cACA,QAD4C,EAAA,CAAA,CAAA,EAAA,MAAA,EAAA,GAAA,MAAA;AAC5C,cACA,SADyC,EAAA,CAAA,CAAA,EAAA,MAAA,EAAA,GAAA,MAAA"}
@@ -0,0 +1,2 @@
1
+ import{xxHash32 as e}from"js-xxhash";function t(t,n){let r=0n;for(let i=0;i<n;i++)r=(r<<32n)+BigInt(e(t,i));return r}const n=t=>e(t,0),r=e=>t(e,2),i=e=>t(e,4);export{n,r,i as t};
2
+ //# sourceMappingURL=xx-hash-SyVhkkcA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xx-hash-SyVhkkcA.mjs","names":["xxHash32Base","xxHash32"],"sources":["../src/xx-hash.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 { xxHash32 as xxHash32Base } from \"js-xxhash\";\n\n/**\n * xxHash32 only computes 32-bit values. Run it n times with different seeds to\n * get a larger hash with better collision resistance.\n *\n * @param content - The string to hash\n * @param words - The number of 32-bit words to hash\n * @returns A 128-bit hash\n */\nfunction _xxHash32(content: string, words: number): bigint {\n let hash = 0n;\n for (let i = 0; i < words; i++) {\n hash = (hash << 32n) + BigInt(xxHash32Base(content, i));\n }\n return hash;\n}\n\nexport const xxHash32 = (s: string) => xxHash32Base(s, 0);\nexport const xxHash64 = (s: string) => _xxHash32(s, 2);\nexport const xxHash128 = (s: string) => _xxHash32(s, 4);\n"],"mappings":"qCA4BA,SAAS,EAAU,EAAiB,EAAuB,CACzD,IAAI,EAAO,GACX,IAAK,IAAI,EAAI,EAAG,EAAI,EAAO,IACzB,GAAQ,GAAQ,KAAO,OAAOA,EAAa,EAAS,EAAE,CAAC,CAEzD,OAAO,EAGT,MAAaC,EAAY,GAAcD,EAAa,EAAG,EAAE,CAC5C,EAAY,GAAc,EAAU,EAAG,EAAE,CACzC,EAAa,GAAc,EAAU,EAAG,EAAE"}
package/dist/xx-hash.cjs CHANGED
@@ -1,18 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.xxHash64 = exports.xxHash32 = exports.xxHash128 = void 0;
7
- var _jsXxhash = require("js-xxhash");
8
- function r(t, i) {
9
- let s = 0n;
10
- for (let n = 0; n < i; n++) s = (s << 32n) + BigInt((0, _jsXxhash.xxHash32)(t, n));
11
- return s;
12
- }
13
- const xxHash32 = t => (0, _jsXxhash.xxHash32)(t, 0),
14
- xxHash64 = t => r(t, 2),
15
- xxHash128 = t => r(t, 4);
16
- exports.xxHash128 = xxHash128;
17
- exports.xxHash64 = xxHash64;
18
- exports.xxHash32 = xxHash32;
1
+ const e=require(`./xx-hash--6giOvM7.cjs`);exports.xxHash128=e.t,exports.xxHash32=e.n,exports.xxHash64=e.r;
@@ -0,0 +1,2 @@
1
+ import { n as xxHash32, r as xxHash64, t as xxHash128 } from "./xx-hash-BnLXga7m.cjs";
2
+ export { xxHash128, xxHash32, xxHash64 };
@@ -0,0 +1,2 @@
1
+ import { n as xxHash32, r as xxHash64, t as xxHash128 } from "./xx-hash-DyeY-GKZ.mjs";
2
+ export { xxHash128, xxHash32, xxHash64 };
package/dist/xx-hash.mjs CHANGED
@@ -1 +1 @@
1
- import{xxHash32 as x}from"js-xxhash";function r(t,i){let s=0n;for(let n=0;n<i;n++)s=(s<<32n)+BigInt(x(t,n));return s}export const xxHash32=t=>x(t,0),xxHash64=t=>r(t,2),xxHash128=t=>r(t,4);
1
+ import{n as e,r as t,t as n}from"./xx-hash-SyVhkkcA.mjs";export{n as xxHash128,e as xxHash32,t as xxHash64};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/hash",
3
- "version": "0.12.14",
3
+ "version": "0.12.22",
4
4
  "type": "module",
5
5
  "description": "A package containing utility functions that hash data using various algorithms.",
6
6
  "repository": {
@@ -9,157 +9,37 @@
9
9
  "directory": "packages/hash"
10
10
  },
11
11
  "private": false,
12
- "dependencies": {
13
- "js-xxhash": "^4.0.0",
14
- "ohash": "^2.0.11",
15
- "@stryke/convert": "^0.6.12",
16
- "@stryke/fs": "^0.33.8"
17
- },
18
- "publishConfig": { "access": "public" },
19
- "devDependencies": {},
20
- "sideEffects": false,
21
- "files": ["dist/**/*"],
22
- "homepage": "https://stormsoftware.com",
23
- "bugs": {
24
- "url": "https://stormsoftware.com/support",
25
- "email": "support@stormsoftware.com"
26
- },
27
- "license": "Apache-2.0",
28
- "keywords": [
29
- "stryke",
30
- "typescript",
31
- "utilities",
32
- "storm-software",
33
- "storm",
34
- "storm-ops",
35
- "cyclone-ui",
36
- "sullivanpj",
37
- "monorepo"
38
- ],
39
- "funding": {
40
- "type": "github",
41
- "url": "https://github.com/sponsors/storm-software"
42
- },
43
- "author": {
44
- "name": "Storm Software",
45
- "email": "contact@stormsoftware.com",
46
- "url": "https://stormsoftware.com"
47
- },
48
- "maintainers": [
49
- {
50
- "name": "Storm Software",
51
- "email": "contact@stormsoftware.com",
52
- "url": "https://stormsoftware.com"
53
- }
54
- ],
55
- "contributors": [
56
- {
57
- "name": "Storm Software",
58
- "email": "contact@stormsoftware.com",
59
- "url": "https://stormsoftware.com"
60
- }
61
- ],
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.mjs",
62
14
  "exports": {
63
- "./xx-hash": {
64
- "import": {
65
- "types": "./dist/xx-hash.d.ts",
66
- "default": "./dist/xx-hash.mjs"
67
- },
68
- "require": {
69
- "types": "./dist/xx-hash.d.ts",
70
- "default": "./dist/xx-hash.cjs"
71
- },
72
- "default": {
73
- "types": "./dist/xx-hash.d.ts",
74
- "default": "./dist/xx-hash.mjs"
75
- }
76
- },
77
- "./neutral": {
78
- "import": {
79
- "types": "./dist/neutral.d.ts",
80
- "default": "./dist/neutral.mjs"
81
- },
82
- "require": {
83
- "types": "./dist/neutral.d.ts",
84
- "default": "./dist/neutral.cjs"
85
- },
86
- "default": {
87
- "types": "./dist/neutral.d.ts",
88
- "default": "./dist/neutral.mjs"
89
- }
90
- },
91
- "./murmurhash": {
92
- "import": {
93
- "types": "./dist/murmurhash.d.ts",
94
- "default": "./dist/murmurhash.mjs"
95
- },
96
- "require": {
97
- "types": "./dist/murmurhash.d.ts",
98
- "default": "./dist/murmurhash.cjs"
99
- },
100
- "default": {
101
- "types": "./dist/murmurhash.d.ts",
102
- "default": "./dist/murmurhash.mjs"
103
- }
104
- },
105
- "./md5": {
106
- "import": { "types": "./dist/md5.d.ts", "default": "./dist/md5.mjs" },
107
- "require": { "types": "./dist/md5.d.ts", "default": "./dist/md5.cjs" },
108
- "default": { "types": "./dist/md5.d.ts", "default": "./dist/md5.mjs" }
109
- },
110
- "./index": {
111
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
112
- "require": {
113
- "types": "./dist/index.d.ts",
114
- "default": "./dist/index.cjs"
115
- },
116
- "default": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }
15
+ ".": { "require": "./dist/index.cjs", "import": "./dist/index.mjs" },
16
+ "./digest": {
17
+ "require": "./dist/digest.cjs",
18
+ "import": "./dist/digest.mjs"
117
19
  },
20
+ "./etag": { "require": "./dist/etag.cjs", "import": "./dist/etag.mjs" },
118
21
  "./hash-files": {
119
- "import": {
120
- "types": "./dist/hash-files.d.ts",
121
- "default": "./dist/hash-files.mjs"
122
- },
123
- "require": {
124
- "types": "./dist/hash-files.d.ts",
125
- "default": "./dist/hash-files.cjs"
126
- },
127
- "default": {
128
- "types": "./dist/hash-files.d.ts",
129
- "default": "./dist/hash-files.mjs"
130
- }
22
+ "require": "./dist/hash-files.cjs",
23
+ "import": "./dist/hash-files.mjs"
131
24
  },
132
- "./etag": {
133
- "import": { "types": "./dist/etag.d.ts", "default": "./dist/etag.mjs" },
134
- "require": { "types": "./dist/etag.d.ts", "default": "./dist/etag.cjs" },
135
- "default": { "types": "./dist/etag.d.ts", "default": "./dist/etag.mjs" }
25
+ "./md5": { "require": "./dist/md5.cjs", "import": "./dist/md5.mjs" },
26
+ "./murmurhash": {
27
+ "require": "./dist/murmurhash.cjs",
28
+ "import": "./dist/murmurhash.mjs"
136
29
  },
137
- "./digest": {
138
- "import": {
139
- "types": "./dist/digest.d.ts",
140
- "default": "./dist/digest.mjs"
141
- },
142
- "require": {
143
- "types": "./dist/digest.d.ts",
144
- "default": "./dist/digest.cjs"
145
- },
146
- "default": {
147
- "types": "./dist/digest.d.ts",
148
- "default": "./dist/digest.mjs"
149
- }
30
+ "./neutral": {
31
+ "require": "./dist/neutral.cjs",
32
+ "import": "./dist/neutral.mjs"
150
33
  },
151
- ".": {
152
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
153
- "require": {
154
- "types": "./dist/index.d.ts",
155
- "default": "./dist/index.cjs"
156
- },
157
- "default": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }
34
+ "./xx-hash": {
35
+ "require": "./dist/xx-hash.cjs",
36
+ "import": "./dist/xx-hash.mjs"
158
37
  },
159
- "./package.json": "./package.json"
38
+ "./*": "./*"
160
39
  },
161
- "main": "./dist/index.cjs",
162
- "module": "./dist/index.mjs",
163
- "types": "./dist/index.d.ts",
164
- "gitHead": "dc6b0d55613d96152664c76d6f2f6ab6fb9736b1"
40
+ "types": "./dist/index.d.cts",
41
+ "dependencies": { "js-xxhash": "^4.0.0", "ohash": "^2.0.11" },
42
+ "devDependencies": { "tsdown": "^0.17.1" },
43
+ "publishConfig": { "access": "public" },
44
+ "gitHead": "5c645896466d1f6a26fb9cf9748ba226dd4d1f07"
165
45
  }
package/dist/digest.d.ts DELETED
@@ -1,28 +0,0 @@
1
- export type AlgorithmIdentifier = "SHA-256" | "SHA-384" | "SHA-512";
2
- /**
3
- * Creates a new hash object for the specified algorithm.
4
- *
5
- * @param algorithm - The algorithm to use for the hash.
6
- * @returns A new hash object.
7
- */
8
- export declare function createHasher(algorithm: AlgorithmIdentifier): Hasher;
9
- /**
10
- * Creates a new hash object for the specified algorithm.
11
- *
12
- * @remarks
13
- * This function uses the Web Crypto API to create a hash of the input data.
14
- *
15
- * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
16
- *
17
- * @param data - The data to hash.
18
- * @param algorithm - The algorithm to use for the hash.
19
- * @returns A hash string representation of the `data` parameter.
20
- */
21
- export declare function digest(data: string, algorithm?: AlgorithmIdentifier): Promise<string>;
22
- export declare const hash: typeof digest;
23
- export declare class Hasher {
24
- #private;
25
- constructor(algorithm: AlgorithmIdentifier);
26
- update(data: Uint8Array): void;
27
- digest(): Promise<Uint8Array>;
28
- }
@@ -1,18 +0,0 @@
1
- import type { ListOptions } from "@stryke/fs/list-files";
2
- import type { HashOptions } from "./murmurhash";
3
- /**
4
- * Hash a list of file paths into a string based on the file content
5
- *
6
- * @param files - The list of file paths to hash
7
- * @param options - Hashing options
8
- * @returns A hashed string value
9
- */
10
- export declare function hashFiles(files: string[], options?: HashOptions): Promise<string>;
11
- /**
12
- * Hash a folder path into a string based on the file content
13
- *
14
- * @param directoryPath - The folder path to hash
15
- * @param options - Hashing options. By default, the `node_modules`, `.git`, `.nx`, `.cache`, and `tmp` folders is ignored.
16
- * @returns A hashed string value
17
- */
18
- export declare function hashDirectory(directoryPath: string, options?: HashOptions & ListOptions): Promise<string>;
package/dist/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- /**
2
- * The hashing library used by Storm Software for building TypeScript applications.
3
- *
4
- * @remarks
5
- * A package containing utility functions that hash data using various algorithms.
6
- *
7
- * @packageDocumentation
8
- */
9
- export * from "./digest";
10
- export * from "./etag";
11
- export * from "./hash-files";
12
- export * from "./md5";
13
- export * from "./murmurhash";
14
- export * from "./xx-hash";
@@ -1,19 +0,0 @@
1
- export interface HashOptions {
2
- /**
3
- * The maximum length of the hash
4
- *
5
- * @defaultValue 32
6
- */
7
- maxLength?: number;
8
- }
9
- /**
10
- * Use a [MurmurHash3](https://en.wikipedia.org/wiki/MurmurHash) based algorithm to hash any JS value into a string.
11
- *
12
- * @see https://github.com/ohash/ohash
13
- * @see https://en.wikipedia.org/wiki/MurmurHash
14
- *
15
- * @param content - The value to hash
16
- * @param options - Hashing options
17
- * @returns A hashed string value
18
- */
19
- export declare function murmurhash(content: any, options?: HashOptions): string;
package/dist/neutral.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./digest";
2
- export * from "./hash-files";
3
- export * from "./murmurhash";
4
- export * from "./xx-hash";
package/dist/xx-hash.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare const xxHash32: (s: string) => number;
2
- export declare const xxHash64: (s: string) => bigint;
3
- export declare const xxHash128: (s: string) => bigint;