@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.
- package/CHANGELOG.md +14 -0
- package/dist/_virtual/rolldown_runtime.cjs +1 -0
- package/dist/convert/src/array-buffer-to-string.cjs +1 -0
- package/dist/convert/src/array-buffer-to-string.mjs +2 -0
- package/dist/convert/src/array-buffer-to-string.mjs.map +1 -0
- package/dist/convert/src/neutral.cjs +1 -0
- package/dist/convert/src/neutral.mjs +1 -0
- package/dist/convert/src/parse-type-definition.cjs +1 -0
- package/dist/convert/src/parse-type-definition.mjs +1 -0
- package/dist/convert/src/string-to-uint8-array.cjs +1 -0
- package/dist/convert/src/string-to-uint8-array.mjs +2 -0
- package/dist/convert/src/string-to-uint8-array.mjs.map +1 -0
- package/dist/convert/src/string-to-utf8-array.cjs +1 -0
- package/dist/convert/src/string-to-utf8-array.mjs +2 -0
- package/dist/convert/src/string-to-utf8-array.mjs.map +1 -0
- package/dist/convert/src/utf8-array-to-string.cjs +1 -0
- package/dist/convert/src/utf8-array-to-string.mjs +2 -0
- package/dist/convert/src/utf8-array-to-string.mjs.map +1 -0
- package/dist/digest.cjs +1 -1
- package/dist/digest.d.cts +32 -2
- package/dist/digest.d.cts.map +1 -0
- package/dist/digest.d.mts +32 -2
- package/dist/digest.d.mts.map +1 -0
- package/dist/digest.mjs +2 -1
- package/dist/digest.mjs.map +1 -0
- package/dist/etag.cjs +1 -1
- package/dist/etag.d.cts +22 -2
- package/dist/etag.d.cts.map +1 -0
- package/dist/etag.d.mts +22 -2
- package/dist/etag.d.mts.map +1 -0
- package/dist/etag.mjs +2 -1
- package/dist/etag.mjs.map +1 -0
- package/dist/fs/src/list-files.cjs +1 -0
- package/dist/fs/src/list-files.d.cts +7 -0
- package/dist/fs/src/list-files.d.cts.map +1 -0
- package/dist/fs/src/list-files.d.mts +7 -0
- package/dist/fs/src/list-files.d.mts.map +1 -0
- package/dist/fs/src/list-files.mjs +2 -0
- package/dist/fs/src/list-files.mjs.map +1 -0
- package/dist/fs/src/read-file.cjs +1 -0
- package/dist/fs/src/read-file.mjs +2 -0
- package/dist/fs/src/read-file.mjs.map +1 -0
- package/dist/hash-files.cjs +1 -1
- package/dist/hash-files.d.cts +24 -2
- package/dist/hash-files.d.cts.map +1 -0
- package/dist/hash-files.d.mts +24 -2
- package/dist/hash-files.d.mts.map +1 -0
- package/dist/hash-files.mjs +2 -1
- package/dist/hash-files.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/md5.cjs +1 -1
- package/dist/md5.d.cts +12 -2
- package/dist/md5.d.cts.map +1 -0
- package/dist/md5.d.mts +12 -2
- package/dist/md5.d.mts.map +1 -0
- package/dist/md5.mjs +2 -1
- package/dist/md5.mjs.map +1 -0
- package/dist/murmurhash.cjs +1 -1
- package/dist/murmurhash.d.cts +23 -2
- package/dist/murmurhash.d.cts.map +1 -0
- package/dist/murmurhash.d.mts +23 -2
- package/dist/murmurhash.d.mts.map +1 -0
- package/dist/murmurhash.mjs +2 -1
- package/dist/murmurhash.mjs.map +1 -0
- package/dist/neutral.cjs +1 -1
- package/dist/neutral.d.cts +4 -4
- package/dist/neutral.d.mts +4 -4
- package/dist/neutral.mjs +1 -1
- package/dist/path/src/is-type.cjs +1 -0
- package/dist/path/src/is-type.mjs +2 -0
- package/dist/path/src/is-type.mjs.map +1 -0
- package/dist/path/src/join-paths.cjs +1 -0
- package/dist/path/src/join-paths.mjs +2 -0
- package/dist/path/src/join-paths.mjs.map +1 -0
- package/dist/path/src/regex.cjs +1 -0
- package/dist/path/src/regex.mjs +2 -0
- package/dist/path/src/regex.mjs.map +1 -0
- package/dist/path/src/slash.cjs +1 -0
- package/dist/path/src/slash.mjs +2 -0
- package/dist/path/src/slash.mjs.map +1 -0
- package/dist/type-checks/src/index.cjs +1 -0
- package/dist/type-checks/src/index.mjs +1 -0
- package/dist/type-checks/src/is-buffer.cjs +1 -0
- package/dist/type-checks/src/is-buffer.mjs +2 -0
- package/dist/type-checks/src/is-buffer.mjs.map +1 -0
- package/dist/type-checks/src/is-collection.cjs +1 -0
- package/dist/type-checks/src/is-collection.mjs +1 -0
- package/dist/type-checks/src/is-string.cjs +1 -0
- package/dist/type-checks/src/is-string.mjs +2 -0
- package/dist/type-checks/src/is-string.mjs.map +1 -0
- package/dist/type-checks/src/type-detect.cjs +1 -0
- package/dist/type-checks/src/type-detect.mjs +2 -0
- package/dist/type-checks/src/type-detect.mjs.map +1 -0
- package/dist/xx-hash.cjs +1 -1
- package/dist/xx-hash.d.cts +7 -2
- package/dist/xx-hash.d.cts.map +1 -0
- package/dist/xx-hash.d.mts +7 -2
- package/dist/xx-hash.d.mts.map +1 -0
- package/dist/xx-hash.mjs +2 -1
- package/dist/xx-hash.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/digest-311IQaur.mjs +0 -2
- package/dist/digest-311IQaur.mjs.map +0 -1
- package/dist/digest-CG1Sk96A.d.mts +0 -32
- package/dist/digest-CG1Sk96A.d.mts.map +0 -1
- package/dist/digest-REorjd4v.cjs +0 -1
- package/dist/digest-Yy26O9oW.d.cts +0 -32
- package/dist/digest-Yy26O9oW.d.cts.map +0 -1
- package/dist/etag-BdoEX_I_.d.cts +0 -22
- package/dist/etag-BdoEX_I_.d.cts.map +0 -1
- package/dist/etag-DXmoR6hr.mjs +0 -2
- package/dist/etag-DXmoR6hr.mjs.map +0 -1
- package/dist/etag-Kuj0WZon.d.mts +0 -22
- package/dist/etag-Kuj0WZon.d.mts.map +0 -1
- package/dist/etag-SIhKWCBx.cjs +0 -1
- package/dist/hash-files-BMmt9LzB.mjs +0 -2
- package/dist/hash-files-BMmt9LzB.mjs.map +0 -1
- package/dist/hash-files-C8KCroZK.d.mts +0 -26
- package/dist/hash-files-C8KCroZK.d.mts.map +0 -1
- package/dist/hash-files-DMXzIbQw.d.cts +0 -26
- package/dist/hash-files-DMXzIbQw.d.cts.map +0 -1
- package/dist/hash-files-DNDrDY17.cjs +0 -1
- package/dist/md5-CCxA7tZv.d.cts +0 -12
- package/dist/md5-CCxA7tZv.d.cts.map +0 -1
- package/dist/md5-C_8IsDev.d.mts +0 -12
- package/dist/md5-C_8IsDev.d.mts.map +0 -1
- package/dist/md5-CnYTBU9u.mjs +0 -2
- package/dist/md5-CnYTBU9u.mjs.map +0 -1
- package/dist/md5-Cwdph7YU.cjs +0 -1
- package/dist/murmurhash-CVcuhG5F.cjs +0 -1
- package/dist/murmurhash-CoNWpOwZ.mjs +0 -2
- package/dist/murmurhash-CoNWpOwZ.mjs.map +0 -1
- package/dist/murmurhash-D6qhmMhz.d.mts +0 -23
- package/dist/murmurhash-D6qhmMhz.d.mts.map +0 -1
- package/dist/murmurhash-dzYfmtjT.d.cts +0 -23
- package/dist/murmurhash-dzYfmtjT.d.cts.map +0 -1
- package/dist/src-GI5wB-mz.mjs +0 -2
- package/dist/src-GI5wB-mz.mjs.map +0 -1
- package/dist/src-QUlAu3to.cjs +0 -1
- package/dist/xx-hash--6giOvM7.cjs +0 -1
- package/dist/xx-hash-BnLXga7m.d.cts +0 -7
- package/dist/xx-hash-BnLXga7m.d.cts.map +0 -1
- package/dist/xx-hash-DyeY-GKZ.d.mts +0 -7
- package/dist/xx-hash-DyeY-GKZ.d.mts.map +0 -1
- package/dist/xx-hash-SyVhkkcA.mjs +0 -2
- package/dist/xx-hash-SyVhkkcA.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"murmurhash.d.mts","names":[],"sources":["../src/murmurhash.ts"],"sourcesContent":[],"mappings":";UAoBiB,WAAA;EAAA;AAmBjB;;;;;;;;;;;;;;;;iBAAgB,UAAA,yBAAmC"}
|
package/dist/murmurhash.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{hash as e}from"ohash";function t(t,n){let r=e(t),i=n?.maxLength??32;return r.length>i?r.slice(0,i):r}export{t as murmurhash};
|
|
2
|
+
//# sourceMappingURL=murmurhash.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"murmurhash.mjs","names":["ohash"],"sources":["../src/murmurhash.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 { hash as ohash } from \"ohash\";\n\nexport interface HashOptions {\n /**\n * The maximum length of the hash\n *\n * @defaultValue 32\n */\n maxLength?: number;\n}\n\n/**\n * Use a [MurmurHash3](https://en.wikipedia.org/wiki/MurmurHash) based algorithm to hash any JS value into a string.\n *\n * @see https://github.com/ohash/ohash\n * @see https://en.wikipedia.org/wiki/MurmurHash\n *\n * @param content - The value to hash\n * @param options - Hashing options\n * @returns A hashed string value\n */\nexport function murmurhash(content: any, options?: HashOptions): string {\n const result = ohash(content);\n const maxLength = options?.maxLength ?? 32;\n\n return result.length > maxLength ? result.slice(0, maxLength) : result;\n}\n"],"mappings":"6BAuCA,SAAgB,EAAW,EAAc,EAA+B,CACtE,IAAM,EAASA,EAAM,EAAQ,CACvB,EAAY,GAAS,WAAa,GAExC,OAAO,EAAO,OAAS,EAAY,EAAO,MAAM,EAAG,EAAU,CAAG"}
|
package/dist/neutral.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./digest.cjs`),t=require(`./murmurhash.cjs`),n=require(`./hash-files.cjs`),r=require(`./xx-hash.cjs`);exports.Hasher=e.Hasher,exports.createHasher=e.createHasher,exports.digest=e.digest,exports.hash=e.hash,exports.hashDirectory=n.hashDirectory,exports.hashFiles=n.hashFiles,exports.murmurhash=t.murmurhash,exports.xxHash128=r.xxHash128,exports.xxHash32=r.xxHash32,exports.xxHash64=r.xxHash64;
|
package/dist/neutral.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { AlgorithmIdentifier, Hasher, createHasher, digest, hash } from "./digest.cjs";
|
|
2
|
+
import { HashOptions, murmurhash } from "./murmurhash.cjs";
|
|
3
|
+
import { hashDirectory, hashFiles } from "./hash-files.cjs";
|
|
4
|
+
import { xxHash128, xxHash32, xxHash64 } from "./xx-hash.cjs";
|
|
5
5
|
export { AlgorithmIdentifier, HashOptions, Hasher, createHasher, digest, hash, hashDirectory, hashFiles, murmurhash, xxHash128, xxHash32, xxHash64 };
|
package/dist/neutral.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { AlgorithmIdentifier, Hasher, createHasher, digest, hash } from "./digest.mjs";
|
|
2
|
+
import { HashOptions, murmurhash } from "./murmurhash.mjs";
|
|
3
|
+
import { hashDirectory, hashFiles } from "./hash-files.mjs";
|
|
4
|
+
import { xxHash128, xxHash32, xxHash64 } from "./xx-hash.mjs";
|
|
5
5
|
export { AlgorithmIdentifier, HashOptions, Hasher, createHasher, digest, hash, hashDirectory, hashFiles, murmurhash, xxHash128, xxHash32, xxHash64 };
|
package/dist/neutral.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Hasher as e,createHasher as t,digest as n,hash as r}from"./digest.mjs";import{murmurhash as i}from"./murmurhash.mjs";import{hashDirectory as a,hashFiles as o}from"./hash-files.mjs";import{xxHash128 as s,xxHash32 as c,xxHash64 as l}from"./xx-hash.mjs";export{e as Hasher,t as createHasher,n as digest,r as hash,a as hashDirectory,o as hashFiles,i as murmurhash,s as xxHash128,c as xxHash32,l as xxHash64};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./regex.cjs`),t=require(`./slash.cjs`);function n(n){return e.ABSOLUTE_PATH_REGEX.test(t.slash(n))}function r(e){return n(e)}exports.isAbsolute=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-type.mjs","names":[],"sources":["../../../../path/src/is-type.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 { ABSOLUTE_PATH_REGEX, NPM_SCOPED_PACKAGE_REGEX } from \"./regex\";\nimport { slash } from \"./slash\";\n\n/**\n * Check if the path is an absolute path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is an absolute path\n */\nexport function isAbsolutePath(path: string): boolean {\n return ABSOLUTE_PATH_REGEX.test(slash(path));\n}\n\n/**\n * Check if the path is an absolute path.\n *\n * @remarks\n * This is an alias for {@link isAbsolutePath}.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is an absolute path\n */\nexport function isAbsolute(path: string): boolean {\n return isAbsolutePath(path);\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function isRelativePath(path: string): boolean {\n return !isAbsolutePath(path);\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @remarks\n * This is an alias for {@link isRelativePath}.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function isRelative(path: string): boolean {\n return isRelativePath(path);\n}\n\n/**\n * Check if the path is a npm package path.\n *\n * @remarks\n * This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackage}.\n *\n * @example\n * ```ts\n * isNpmScopedPackage(\"@stryke/path\"); // returns true\n * isNpmScopedPackage(\"lodash\"); // returns false\n * isNpmNamespacePackage(\"./src/index.ts\"); // returns false\n * ```\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a npm package path\n */\nexport function isNpmScopedPackagePath(path: string): boolean {\n return NPM_SCOPED_PACKAGE_REGEX.test(slash(path));\n}\n\n/**\n * Check if the path is a npm package path.\n *\n * @remarks\n * This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackagePath}.\n *\n * @example\n * ```ts\n * isNpmScopedPackagePath(\"@stryke/path\"); // returns true\n * isNpmScopedPackagePath(\"lodash\"); // returns false\n * isNpmScopedPackagePath(\"./src/index.ts\"); // returns false\n * ```\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a npm package path\n */\nexport function isNpmScopedPackage(path: string): boolean {\n return isNpmScopedPackagePath(path);\n}\n"],"mappings":"sFA2BA,SAAgB,EAAe,EAAuB,CACpD,OAAO,EAAoB,KAAK,EAAM,EAAK,CAAC,CAY9C,SAAgB,EAAW,EAAuB,CAChD,OAAO,EAAe,EAAK"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./regex.cjs`),t=require(`./is-type.cjs`);function n(t=``){return t&&t.replace(/\\/g,`/`).replace(e.DRIVE_LETTER_START_REGEX,e=>e.toUpperCase())}function r(r){if(!r||r.length===0)return`.`;r=n(r);let i=r.match(e.UNC_REGEX),o=t.isAbsolute(r),s=r[r.length-1]===`/`;return r=a(r,!o),r.length===0?o?`/`:s?`./`:`.`:(s&&(r+=`/`),e.DRIVE_LETTER_REGEX.test(r)&&(r+=`/`),i?o?`//${r}`:`//./${r}`:o&&!t.isAbsolute(r)?`/${r}`:r)}function i(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return r(t)}function a(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}exports.joinPaths=i;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{DRIVE_LETTER_REGEX as e,DRIVE_LETTER_START_REGEX as t,UNC_REGEX as n}from"./regex.mjs";import{isAbsolute as r}from"./is-type.mjs";function i(e=``){return e&&e.replace(/\\/g,`/`).replace(t,e=>e.toUpperCase())}function a(t){if(!t||t.length===0)return`.`;t=i(t);let a=t.match(n),o=r(t),c=t[t.length-1]===`/`;return t=s(t,!o),t.length===0?o?`/`:c?`./`:`.`:(c&&(t+=`/`),e.test(t)&&(t+=`/`),a?o?`//${t}`:`//./${t}`:o&&!r(t)?`/${t}`:t)}function o(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return a(t)}function s(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}export{o as joinPaths};
|
|
2
|
+
//# sourceMappingURL=join-paths.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-paths.mjs","names":["char: string | null"],"sources":["../../../../path/src/join-paths.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 { isAbsolute } from \"./is-type\";\nimport {\n DRIVE_LETTER_REGEX,\n DRIVE_LETTER_START_REGEX,\n UNC_REGEX\n} from \"./regex\";\n\n// Util to normalize windows paths to posix\nfunction normalizeWindowsPath(input = \"\") {\n if (!input) {\n return input;\n }\n return input\n .replace(/\\\\/g, \"/\")\n .replace(DRIVE_LETTER_START_REGEX, r => r.toUpperCase());\n}\n\nfunction correctPaths(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n // Normalize windows argument\n path = normalizeWindowsPath(path);\n\n const isUNCPath = path.match(UNC_REGEX);\n const isPathAbsolute = isAbsolute(path);\n const trailingSeparator = path[path.length - 1] === \"/\";\n\n // Normalize the path\n path = normalizeString(path, !isPathAbsolute);\n\n if (path.length === 0) {\n if (isPathAbsolute) {\n return \"/\";\n }\n return trailingSeparator ? \"./\" : \".\";\n }\n if (trailingSeparator) {\n path += \"/\";\n }\n if (DRIVE_LETTER_REGEX.test(path)) {\n path += \"/\";\n }\n\n if (isUNCPath) {\n if (!isPathAbsolute) {\n return `//./${path}`;\n }\n return `//${path}`;\n }\n\n return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;\n}\n\n/**\n * Joins all given path segments together using the platform-specific separator as a delimiter.\n * The resulting path is normalized to remove any redundant or unnecessary segments.\n *\n * @param segments - The path segments to join.\n * @returns The joined and normalized path string.\n */\nexport function joinPaths(...segments: string[]): string {\n let path = \"\";\n\n for (const seg of segments) {\n if (!seg) {\n continue;\n }\n if (path.length > 0) {\n const pathTrailing = path[path.length - 1] === \"/\";\n const segLeading = seg[0] === \"/\";\n const both = pathTrailing && segLeading;\n if (both) {\n path += seg.slice(1);\n } else {\n path += pathTrailing || segLeading ? seg : `/${seg}`;\n }\n } else {\n path += seg;\n }\n }\n\n return correctPaths(path);\n}\n\nexport const join = joinPaths;\n\n/**\n * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.\n *\n * @param path - The path to normalize.\n * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.\n * @returns the normalized path string.\n */\nfunction normalizeString(path: string, allowAboveRoot: boolean) {\n let res = \"\";\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char: string | null = null;\n for (let index = 0; index <= path.length; ++index) {\n if (index < path.length) {\n // casted because we know it exists thanks to the length check\n char = path[index] as string;\n } else if (char === \"/\") {\n break;\n } else {\n char = \"/\";\n }\n if (char === \"/\") {\n if (lastSlash === index - 1 || dots === 1) {\n // NOOP\n } else if (dots === 2) {\n if (\n res.length < 2 ||\n lastSegmentLength !== 2 ||\n res[res.length - 1] !== \".\" ||\n res[res.length - 2] !== \".\"\n ) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(\"/\");\n if (lastSlashIndex === -1) {\n res = \"\";\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n }\n lastSlash = index;\n dots = 0;\n continue;\n } else if (res.length > 0) {\n res = \"\";\n lastSegmentLength = 0;\n lastSlash = index;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? \"/..\" : \"..\";\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += `/${path.slice(lastSlash + 1, index)}`;\n } else {\n res = path.slice(lastSlash + 1, index);\n }\n lastSegmentLength = index - lastSlash - 1;\n }\n lastSlash = index;\n dots = 0;\n } else if (char === \".\" && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n"],"mappings":"yIA0BA,SAAS,EAAqB,EAAQ,GAAI,CAIxC,OAHK,GAGE,EACJ,QAAQ,MAAO,IAAI,CACnB,QAAQ,EAA0B,GAAK,EAAE,aAAa,CAAC,CAG5D,SAAS,EAAa,EAAe,CACnC,GAAI,CAAC,GAAQ,EAAK,SAAW,EAC3B,MAAO,IAIT,EAAO,EAAqB,EAAK,CAEjC,IAAM,EAAY,EAAK,MAAM,EAAU,CACjC,EAAiB,EAAW,EAAK,CACjC,EAAoB,EAAK,EAAK,OAAS,KAAO,IAyBpD,MAtBA,GAAO,EAAgB,EAAM,CAAC,EAAe,CAEzC,EAAK,SAAW,EACd,EACK,IAEF,EAAoB,KAAO,KAEhC,IACF,GAAQ,KAEN,EAAmB,KAAK,EAAK,GAC/B,GAAQ,KAGN,EACG,EAGE,KAAK,IAFH,OAAO,IAKX,GAAkB,CAAC,EAAW,EAAK,CAAG,IAAI,IAAS,GAU5D,SAAgB,EAAU,GAAG,EAA4B,CACvD,IAAI,EAAO,GAEX,IAAK,IAAM,KAAO,EACX,KAGL,GAAI,EAAK,OAAS,EAAG,CACnB,IAAM,EAAe,EAAK,EAAK,OAAS,KAAO,IACzC,EAAa,EAAI,KAAO,IACjB,GAAgB,EAE3B,GAAQ,EAAI,MAAM,EAAE,CAEpB,GAAQ,GAAgB,EAAa,EAAM,IAAI,SAGjD,GAAQ,EAIZ,OAAO,EAAa,EAAK,CAY3B,SAAS,EAAgB,EAAc,EAAyB,CAC9D,IAAI,EAAM,GACN,EAAoB,EACpB,EAAY,GACZ,EAAO,EACPA,EAAsB,KAC1B,IAAK,IAAI,EAAQ,EAAG,GAAS,EAAK,OAAQ,EAAE,EAAO,CACjD,GAAI,EAAQ,EAAK,OAEf,EAAO,EAAK,WACH,IAAS,IAClB,WAEA,EAAO,IAET,GAAI,IAAS,IAAK,CAChB,GAAI,MAAc,EAAQ,GAAK,IAAS,GAAG,GAEhC,IAAS,EAAG,CACrB,GACE,EAAI,OAAS,GACb,IAAsB,GACtB,EAAI,EAAI,OAAS,KAAO,KACxB,EAAI,EAAI,OAAS,KAAO,QAEpB,EAAI,OAAS,EAAG,CAClB,IAAM,EAAiB,EAAI,YAAY,IAAI,CACvC,IAAmB,IACrB,EAAM,GACN,EAAoB,IAEpB,EAAM,EAAI,MAAM,EAAG,EAAe,CAClC,EAAoB,EAAI,OAAS,EAAI,EAAI,YAAY,IAAI,EAE3D,EAAY,EACZ,EAAO,EACP,iBACS,EAAI,OAAS,EAAG,CACzB,EAAM,GACN,EAAoB,EACpB,EAAY,EACZ,EAAO,EACP,UAGA,IACF,GAAO,EAAI,OAAS,EAAI,MAAQ,KAChC,EAAoB,QAGlB,EAAI,OAAS,EACf,GAAO,IAAI,EAAK,MAAM,EAAY,EAAG,EAAM,GAE3C,EAAM,EAAK,MAAM,EAAY,EAAG,EAAM,CAExC,EAAoB,EAAQ,EAAY,EAE1C,EAAY,EACZ,EAAO,OACE,IAAS,KAAO,IAAS,GAClC,EAAE,EAEF,EAAO,GAGX,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=/^[A-Z]:\//i,t=/^[A-Z]:$/i,n=/^[/\\]{2}/,r=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;exports.ABSOLUTE_PATH_REGEX=r,exports.DRIVE_LETTER_REGEX=t,exports.DRIVE_LETTER_START_REGEX=e,exports.UNC_REGEX=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex.mjs","names":[],"sources":["../../../../path/src/regex.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 DRIVE_LETTER_START_REGEX = /^[A-Z]:\\//i;\nexport const DRIVE_LETTER_REGEX = /^[A-Z]:$/i;\n\nexport const UNC_REGEX = /^[/\\\\]{2}/;\n\nexport const ABSOLUTE_PATH_REGEX =\n /^[/\\\\](?![/\\\\])|^[/\\\\]{2}(?!\\.)|^~[/\\\\]|^[A-Z]:[/\\\\]/i;\n\nexport const ROOT_FOLDER_REGEX = /^\\/([A-Z]:)?$/i;\n\nexport const FILE_EXTENSION_REGEX = /\\.[0-9a-z]+$/i;\n\nexport const PACKAGE_PATH_REGEX = /^@\\w+\\/.*$/;\nexport const NPM_SCOPED_PACKAGE_REGEX = /^(?:@[\\w-]+\\/)?[\\w-]+$/;\n"],"mappings":"AAkBA,MAAa,EAA2B,aAC3B,EAAqB,YAErB,EAAY,YAEZ,EACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e.startsWith(`\\\\?\\`)?e:e.replace(/\\/g,`/`)}exports.slash=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash.mjs","names":[],"sources":["../../../../path/src/slash.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 { isAbsolutePath } from \"./is-type\";\n\n/**\n * Replace backslash to slash\n *\n * @param path - The string to replace\n * @returns The string with replaced backslashes\n */\nexport function slash(path: string) {\n if (path.startsWith(\"\\\\\\\\?\\\\\")) {\n return path;\n }\n\n return path.replace(/\\\\/g, \"/\");\n}\n\n/**\n * Replace backslash to slash and remove unneeded leading and trailing slashes\n *\n * @param path - The string to replace\n * @returns The string with replaced backslashes\n */\nexport function formatSlash(path: string) {\n const formatted = slash(path);\n\n return isAbsolutePath(formatted)\n ? formatted.replace(/\\/+$/g, \"\")\n : formatted.replace(/^\\.\\//g, \"\").replace(/\\/+$/g, \"\");\n}\n"],"mappings":"AA0BA,SAAgB,EAAM,EAAc,CAKlC,OAJI,EAAK,WAAW,UAAU,CACrB,EAGF,EAAK,QAAQ,MAAO,IAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-buffer.cjs`);require(`./type-detect.cjs`),require(`./is-collection.cjs`);const t=require(`./is-string.cjs`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isBufferExists as e}from"./is-buffer.mjs";import"./type-detect.mjs";import"./is-collection.mjs";import{isString as t}from"./is-string.mjs";export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=typeof Buffer<`u`,t=e?Buffer.isBuffer.bind(Buffer):function(e){return!1};exports.isBufferExists=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-buffer.mjs","names":["isBuffer: typeof Buffer.isBuffer","isBuffer"],"sources":["../../../../type-checks/src/is-buffer.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"],"mappings":"AAkBA,MAAa,EAAiB,OAAO,OAAW,IAKA,GAC5C,OAAO,SAAS,KAAK,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./type-detect.cjs`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./type-detect.mjs";export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>{try{return typeof e==`string`}catch{return!1}};exports.isString=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-string.mjs","names":[],"sources":["../../../../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 isString = (value: unknown): value is string => {\n try {\n return typeof value === \"string\";\n } catch {\n return false;\n }\n};\n"],"mappings":"AAkBA,MAAa,EAAY,GAAoC,CAC3D,GAAI,CACF,OAAO,OAAO,GAAU,cAClB,CACN,MAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./is-buffer.cjs`);const e=(e=>(typeof globalThis==`object`||Object.defineProperty(e,`typeDetectGlobalObject`,{get(){return this},configurable:!0}),globalThis))(Object.prototype);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-detect.mjs","names":[],"sources":["../../../../type-checks/src/type-detect.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 { 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"],"mappings":"yBAoBsB,IAChB,OAAO,YAAe,UAG1B,OAAO,eAAe,EAAK,yBAA0B,CACnD,KAAM,CACJ,OAAO,MAET,aAAc,GACf,CAAC,CAPO,aAeR,OAAO,UAAU"}
|
package/dist/xx-hash.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./_virtual/rolldown_runtime.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);exports.xxHash128=a,exports.xxHash32=r,exports.xxHash64=i;
|
package/dist/xx-hash.d.cts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 { xxHash128, xxHash32, xxHash64 };
|
|
7
|
+
//# sourceMappingURL=xx-hash.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xx-hash.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"}
|
package/dist/xx-hash.d.mts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 { xxHash128, xxHash32, xxHash64 };
|
|
7
|
+
//# sourceMappingURL=xx-hash.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xx-hash.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"}
|
package/dist/xx-hash.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
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{i as xxHash128,n as xxHash32,r as xxHash64};
|
|
2
|
+
//# sourceMappingURL=xx-hash.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xx-hash.mjs","names":["xxHash32Base"],"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,MAAa,EAAY,GAAcA,EAAa,EAAG,EAAE,CAC5C,EAAY,GAAc,EAAU,EAAG,EAAE,CACzC,EAAa,GAAc,EAAU,EAAG,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/hash",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.28",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing utility functions that hash data using various algorithms.",
|
|
6
6
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"types": "./dist/index.d.cts",
|
|
41
41
|
"dependencies": { "js-xxhash": "^4.0.0", "ohash": "^2.0.11" },
|
|
42
|
-
"devDependencies": { "tsdown": "^0.17.
|
|
42
|
+
"devDependencies": { "tsdown": "^0.17.2" },
|
|
43
43
|
"publishConfig": { "access": "public" },
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "afcd140cfb0555b3dacd5ece701909f66c174068"
|
|
45
45
|
}
|
package/dist/digest-311IQaur.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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}function t(e){return Uint8Array.from([...encodeURIComponent(e)].map(e=>e.codePointAt(0)))}new TextEncoder,new TextDecoder;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{i,n,r,a as t};
|
|
2
|
-
//# sourceMappingURL=digest-311IQaur.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"digest-311IQaur.mjs","names":["#algorithm","#chunks"],"sources":["../../convert/src/array-buffer-to-string.ts","../../convert/src/string-to-uint8-array.ts","../../convert/src/string-to-utf8-array.ts","../../convert/src/utf8-array-to-string.ts","../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\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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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":"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,ECfT,SAAgB,EAAmB,EAA0B,CAC3D,OAAO,WAAW,KAChB,CAAC,GAAG,mBAAmB,EAAK,CAAC,CAAC,IAAI,GAAU,EAAO,YAAY,EAAE,CAAE,CACpE,CCTa,IAAI,YCAJ,IAAI,YCapB,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"}
|
|
@@ -1,32 +0,0 @@
|
|
|
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 { hash as a, digest as i, Hasher as n, createHasher as r, AlgorithmIdentifier as t };
|
|
32
|
-
//# sourceMappingURL=digest-CG1Sk96A.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"digest-CG1Sk96A.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-REorjd4v.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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}function t(e){return Uint8Array.from([...encodeURIComponent(e)].map(e=>e.codePointAt(0)))}const n=new TextEncoder,r=new TextDecoder;function i(e){return new s(e)}async function a(n,r=`SHA-512`){return e(await globalThis.crypto.subtle.digest(r,t(n)))}const o=a;var s=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)}};Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
|
|
@@ -1,32 +0,0 @@
|
|
|
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 { hash as a, digest as i, Hasher as n, createHasher as r, AlgorithmIdentifier as t };
|
|
32
|
-
//# sourceMappingURL=digest-Yy26O9oW.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"digest-Yy26O9oW.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/etag-BdoEX_I_.d.cts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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 { generateETag as n, fnv1a52 as t };
|
|
22
|
-
//# sourceMappingURL=etag-BdoEX_I_.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"etag-BdoEX_I_.d.cts","names":[],"sources":["../src/etag.ts"],"sourcesContent":[],"mappings":";;AA2BA;AA2CA;;;;;;;cA3Ca;;;;;;;;cA2CA"}
|
package/dist/etag-DXmoR6hr.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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{t as n,e as t};
|
|
2
|
-
//# sourceMappingURL=etag-DXmoR6hr.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"etag-DXmoR6hr.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"}
|
package/dist/etag-Kuj0WZon.d.mts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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 { generateETag as n, fnv1a52 as t };
|
|
22
|
-
//# sourceMappingURL=etag-Kuj0WZon.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"etag-Kuj0WZon.d.mts","names":[],"sources":["../src/etag.ts"],"sourcesContent":[],"mappings":";;AA2BA;AA2CA;;;;;;;cA3Ca;;;;;;;;cA2CA"}
|
package/dist/etag-SIhKWCBx.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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)}"`;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./src-GI5wB-mz.mjs";import{t}from"./murmurhash-CoNWpOwZ.mjs";import n from"defu";import{glob as r}from"glob";import{readFile as i}from"node:fs/promises";const a=/^[A-Z]:\//i,o=/^[A-Z]:$/i,s=/^[/\\]{2}/,c=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;function l(e){return c.test(d(e))}function u(e){return l(e)}function d(e){return e.startsWith(`\\\\?\\`)?e:e.replace(/\\/g,`/`)}function f(e=``){return e&&e.replace(/\\/g,`/`).replace(a,e=>e.toUpperCase())}function p(e){if(!e||e.length===0)return`.`;e=f(e);let t=e.match(s),n=u(e),r=e[e.length-1]===`/`;return e=h(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),o.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!u(e)?`/${e}`:e)}function m(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return p(t)}function h(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const g={dot:!0};async function _(t,i){return r(e(t)?t.includes(`*`)?t:m(t,`**/*`):t.input?m(t.input,t.glob):t.glob,n(e(t)?{}:{dot:t.dot,ignore:t.ignore},i??{},g))}async function v(e,t){let r=(await _(e,n({withFileTypes:!0},t??{}))).filter(e=>e.isFile());return t?.withFileTypes?r:r.map(e=>e.fullpath())}const y=async e=>{if(!e)throw Error(`No file path provided to read data`);return i(e,{encoding:`utf8`})};async function b(e,n){let r={};return await Promise.all(e.map(async e=>{r[e]=await y(e)})),t(r,n)}async function x(e,t={}){return t.ignore=t.ignore??[`**/node_modules/**`,`**/.git/**`,`**/.nx/**`,`**/.cache/**`,`**/.storm/**`,`**/tmp/**`],b(await v(e,t),t)}export{b as n,x as t};
|
|
2
|
-
//# sourceMappingURL=hash-files-BMmt9LzB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hash-files-BMmt9LzB.mjs","names":["char: string | null","DEFAULT_OPTIONS: ListOptions","readFile","readFileFs","readFile"],"sources":["../../path/src/regex.ts","../../path/src/is-type.ts","../../path/src/slash.ts","../../path/src/join-paths.ts","../../fs/src/list-files.ts","../../fs/src/read-file.ts","../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\nexport const DRIVE_LETTER_START_REGEX = /^[A-Z]:\\//i;\nexport const DRIVE_LETTER_REGEX = /^[A-Z]:$/i;\n\nexport const UNC_REGEX = /^[/\\\\]{2}/;\n\nexport const ABSOLUTE_PATH_REGEX =\n /^[/\\\\](?![/\\\\])|^[/\\\\]{2}(?!\\.)|^~[/\\\\]|^[A-Z]:[/\\\\]/i;\n\nexport const ROOT_FOLDER_REGEX = /^\\/([A-Z]:)?$/i;\n\nexport const FILE_EXTENSION_REGEX = /\\.[0-9a-z]+$/i;\n\nexport const PACKAGE_PATH_REGEX = /^@\\w+\\/.*$/;\nexport const NPM_SCOPED_PACKAGE_REGEX = /^(?:@[\\w-]+\\/)?[\\w-]+$/;\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 { ABSOLUTE_PATH_REGEX, NPM_SCOPED_PACKAGE_REGEX } from \"./regex\";\nimport { slash } from \"./slash\";\n\n/**\n * Check if the path is an absolute path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is an absolute path\n */\nexport function isAbsolutePath(path: string): boolean {\n return ABSOLUTE_PATH_REGEX.test(slash(path));\n}\n\n/**\n * Check if the path is an absolute path.\n *\n * @remarks\n * This is an alias for {@link isAbsolutePath}.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is an absolute path\n */\nexport function isAbsolute(path: string): boolean {\n return isAbsolutePath(path);\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function isRelativePath(path: string): boolean {\n return !isAbsolutePath(path);\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @remarks\n * This is an alias for {@link isRelativePath}.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function isRelative(path: string): boolean {\n return isRelativePath(path);\n}\n\n/**\n * Check if the path is a npm package path.\n *\n * @remarks\n * This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackage}.\n *\n * @example\n * ```ts\n * isNpmScopedPackage(\"@stryke/path\"); // returns true\n * isNpmScopedPackage(\"lodash\"); // returns false\n * isNpmNamespacePackage(\"./src/index.ts\"); // returns false\n * ```\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a npm package path\n */\nexport function isNpmScopedPackagePath(path: string): boolean {\n return NPM_SCOPED_PACKAGE_REGEX.test(slash(path));\n}\n\n/**\n * Check if the path is a npm package path.\n *\n * @remarks\n * This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackagePath}.\n *\n * @example\n * ```ts\n * isNpmScopedPackagePath(\"@stryke/path\"); // returns true\n * isNpmScopedPackagePath(\"lodash\"); // returns false\n * isNpmScopedPackagePath(\"./src/index.ts\"); // returns false\n * ```\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a npm package path\n */\nexport function isNpmScopedPackage(path: string): boolean {\n return isNpmScopedPackagePath(path);\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 { isAbsolutePath } from \"./is-type\";\n\n/**\n * Replace backslash to slash\n *\n * @param path - The string to replace\n * @returns The string with replaced backslashes\n */\nexport function slash(path: string) {\n if (path.startsWith(\"\\\\\\\\?\\\\\")) {\n return path;\n }\n\n return path.replace(/\\\\/g, \"/\");\n}\n\n/**\n * Replace backslash to slash and remove unneeded leading and trailing slashes\n *\n * @param path - The string to replace\n * @returns The string with replaced backslashes\n */\nexport function formatSlash(path: string) {\n const formatted = slash(path);\n\n return isAbsolutePath(formatted)\n ? formatted.replace(/\\/+$/g, \"\")\n : formatted.replace(/^\\.\\//g, \"\").replace(/\\/+$/g, \"\");\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 { isAbsolute } from \"./is-type\";\nimport {\n DRIVE_LETTER_REGEX,\n DRIVE_LETTER_START_REGEX,\n UNC_REGEX\n} from \"./regex\";\n\n// Util to normalize windows paths to posix\nfunction normalizeWindowsPath(input = \"\") {\n if (!input) {\n return input;\n }\n return input\n .replace(/\\\\/g, \"/\")\n .replace(DRIVE_LETTER_START_REGEX, r => r.toUpperCase());\n}\n\nfunction correctPaths(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n // Normalize windows argument\n path = normalizeWindowsPath(path);\n\n const isUNCPath = path.match(UNC_REGEX);\n const isPathAbsolute = isAbsolute(path);\n const trailingSeparator = path[path.length - 1] === \"/\";\n\n // Normalize the path\n path = normalizeString(path, !isPathAbsolute);\n\n if (path.length === 0) {\n if (isPathAbsolute) {\n return \"/\";\n }\n return trailingSeparator ? \"./\" : \".\";\n }\n if (trailingSeparator) {\n path += \"/\";\n }\n if (DRIVE_LETTER_REGEX.test(path)) {\n path += \"/\";\n }\n\n if (isUNCPath) {\n if (!isPathAbsolute) {\n return `//./${path}`;\n }\n return `//${path}`;\n }\n\n return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;\n}\n\n/**\n * Joins all given path segments together using the platform-specific separator as a delimiter.\n * The resulting path is normalized to remove any redundant or unnecessary segments.\n *\n * @param segments - The path segments to join.\n * @returns The joined and normalized path string.\n */\nexport function joinPaths(...segments: string[]): string {\n let path = \"\";\n\n for (const seg of segments) {\n if (!seg) {\n continue;\n }\n if (path.length > 0) {\n const pathTrailing = path[path.length - 1] === \"/\";\n const segLeading = seg[0] === \"/\";\n const both = pathTrailing && segLeading;\n if (both) {\n path += seg.slice(1);\n } else {\n path += pathTrailing || segLeading ? seg : `/${seg}`;\n }\n } else {\n path += seg;\n }\n }\n\n return correctPaths(path);\n}\n\nexport const join = joinPaths;\n\n/**\n * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.\n *\n * @param path - The path to normalize.\n * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.\n * @returns the normalized path string.\n */\nfunction normalizeString(path: string, allowAboveRoot: boolean) {\n let res = \"\";\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char: string | null = null;\n for (let index = 0; index <= path.length; ++index) {\n if (index < path.length) {\n // casted because we know it exists thanks to the length check\n char = path[index] as string;\n } else if (char === \"/\") {\n break;\n } else {\n char = \"/\";\n }\n if (char === \"/\") {\n if (lastSlash === index - 1 || dots === 1) {\n // NOOP\n } else if (dots === 2) {\n if (\n res.length < 2 ||\n lastSegmentLength !== 2 ||\n res[res.length - 1] !== \".\" ||\n res[res.length - 2] !== \".\"\n ) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(\"/\");\n if (lastSlashIndex === -1) {\n res = \"\";\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n }\n lastSlash = index;\n dots = 0;\n continue;\n } else if (res.length > 0) {\n res = \"\";\n lastSegmentLength = 0;\n lastSlash = index;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? \"/..\" : \"..\";\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += `/${path.slice(lastSlash + 1, index)}`;\n } else {\n res = path.slice(lastSlash + 1, index);\n }\n lastSegmentLength = index - lastSlash - 1;\n }\n lastSlash = index;\n dots = 0;\n } else if (char === \".\" && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\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 { 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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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":"4KAkBA,MAAa,EAA2B,aAC3B,EAAqB,YAErB,EAAY,YAEZ,EACX,wDCGF,SAAgB,EAAe,EAAuB,CACpD,OAAO,EAAoB,KAAK,EAAM,EAAK,CAAC,CAY9C,SAAgB,EAAW,EAAuB,CAChD,OAAO,EAAe,EAAK,CCf7B,SAAgB,EAAM,EAAc,CAKlC,OAJI,EAAK,WAAW,UAAU,CACrB,EAGF,EAAK,QAAQ,MAAO,IAAI,CCLjC,SAAS,EAAqB,EAAQ,GAAI,CAIxC,OAHK,GAGE,EACJ,QAAQ,MAAO,IAAI,CACnB,QAAQ,EAA0B,GAAK,EAAE,aAAa,CAAC,CAG5D,SAAS,EAAa,EAAe,CACnC,GAAI,CAAC,GAAQ,EAAK,SAAW,EAC3B,MAAO,IAIT,EAAO,EAAqB,EAAK,CAEjC,IAAM,EAAY,EAAK,MAAM,EAAU,CACjC,EAAiB,EAAW,EAAK,CACjC,EAAoB,EAAK,EAAK,OAAS,KAAO,IAyBpD,MAtBA,GAAO,EAAgB,EAAM,CAAC,EAAe,CAEzC,EAAK,SAAW,EACd,EACK,IAEF,EAAoB,KAAO,KAEhC,IACF,GAAQ,KAEN,EAAmB,KAAK,EAAK,GAC/B,GAAQ,KAGN,EACG,EAGE,KAAK,IAFH,OAAO,IAKX,GAAkB,CAAC,EAAW,EAAK,CAAG,IAAI,IAAS,GAU5D,SAAgB,EAAU,GAAG,EAA4B,CACvD,IAAI,EAAO,GAEX,IAAK,IAAM,KAAO,EACX,KAGL,GAAI,EAAK,OAAS,EAAG,CACnB,IAAM,EAAe,EAAK,EAAK,OAAS,KAAO,IACzC,EAAa,EAAI,KAAO,IACjB,GAAgB,EAE3B,GAAQ,EAAI,MAAM,EAAE,CAEpB,GAAQ,GAAgB,EAAa,EAAM,IAAI,SAGjD,GAAQ,EAIZ,OAAO,EAAa,EAAK,CAY3B,SAAS,EAAgB,EAAc,EAAyB,CAC9D,IAAI,EAAM,GACN,EAAoB,EACpB,EAAY,GACZ,EAAO,EACPA,EAAsB,KAC1B,IAAK,IAAI,EAAQ,EAAG,GAAS,EAAK,OAAQ,EAAE,EAAO,CACjD,GAAI,EAAQ,EAAK,OAEf,EAAO,EAAK,WACH,IAAS,IAClB,WAEA,EAAO,IAET,GAAI,IAAS,IAAK,CAChB,GAAI,MAAc,EAAQ,GAAK,IAAS,GAAG,GAEhC,IAAS,EAAG,CACrB,GACE,EAAI,OAAS,GACb,IAAsB,GACtB,EAAI,EAAI,OAAS,KAAO,KACxB,EAAI,EAAI,OAAS,KAAO,QAEpB,EAAI,OAAS,EAAG,CAClB,IAAM,EAAiB,EAAI,YAAY,IAAI,CACvC,IAAmB,IACrB,EAAM,GACN,EAAoB,IAEpB,EAAM,EAAI,MAAM,EAAG,EAAe,CAClC,EAAoB,EAAI,OAAS,EAAI,EAAI,YAAY,IAAI,EAE3D,EAAY,EACZ,EAAO,EACP,iBACS,EAAI,OAAS,EAAG,CACzB,EAAM,GACN,EAAoB,EACpB,EAAY,EACZ,EAAO,EACP,UAGA,IACF,GAAO,EAAI,OAAS,EAAI,MAAQ,KAChC,EAAoB,QAGlB,EAAI,OAAS,EACf,GAAO,IAAI,EAAK,MAAM,EAAY,EAAG,EAAM,GAE3C,EAAM,EAAK,MAAM,EAAY,EAAG,EAAM,CAExC,EAAoB,EAAQ,EAAY,EAE1C,EAAY,EACZ,EAAO,OACE,IAAS,KAAO,IAAS,GAClC,EAAE,EAEF,EAAO,GAGX,OAAO,ECrJT,MAAMC,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,CCtE9C,MAAaC,EAAW,KAAO,IAAsC,CACnE,GAAI,CAAC,EACH,MAAU,MAAM,qCAAqC,CAGvD,OAAOC,EAAW,EAAU,CAAE,SAAU,OAAQ,CAAC,ECbnD,eAAsB,EACpB,EACA,EACiB,CACjB,IAAM,EAAS,EAAE,CAOjB,OANA,MAAM,QAAQ,IACZ,EAAM,IAAI,KAAM,IAAQ,CACtB,EAAO,GAAQ,MAAMC,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"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { t as HashOptions } from "./murmurhash-D6qhmMhz.mjs";
|
|
2
|
-
import { GlobOptions } from "glob";
|
|
3
|
-
|
|
4
|
-
//#region ../fs/src/list-files.d.ts
|
|
5
|
-
type ListOptions = GlobOptions;
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/hash-files.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* Hash a list of file paths into a string based on the file content
|
|
10
|
-
*
|
|
11
|
-
* @param files - The list of file paths to hash
|
|
12
|
-
* @param options - Hashing options
|
|
13
|
-
* @returns A hashed string value
|
|
14
|
-
*/
|
|
15
|
-
declare function hashFiles(files: string[], options?: HashOptions): Promise<string>;
|
|
16
|
-
/**
|
|
17
|
-
* Hash a folder path into a string based on the file content
|
|
18
|
-
*
|
|
19
|
-
* @param directoryPath - The folder path to hash
|
|
20
|
-
* @param options - Hashing options. By default, the `node_modules`, `.git`, `.nx`, `.cache`, and `tmp` folders is ignored.
|
|
21
|
-
* @returns A hashed string value
|
|
22
|
-
*/
|
|
23
|
-
declare function hashDirectory(directoryPath: string, options?: HashOptions & ListOptions): Promise<string>;
|
|
24
|
-
//#endregion
|
|
25
|
-
export { hashFiles as n, hashDirectory as t };
|
|
26
|
-
//# sourceMappingURL=hash-files-C8KCroZK.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hash-files-C8KCroZK.d.mts","names":[],"sources":["../../fs/src/list-files.ts","../src/hash-files.ts"],"sourcesContent":[],"mappings":";;;;KAyBY,WAAA,GAAc;;;;;AAA1B;;;;ACMA;AAqBsB,iBArBA,SAAA,CAqBa,KAAA,EAAA,MAAA,EAAA,EAAA,OAAA,CAAA,EAnBvB,WAmBuB,CAAA,EAlBhC,OAkBgC,CAAA,MAAA,CAAA;;;;;;;;iBAAb,aAAA,kCAEX,cAAc,cACtB"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { t as HashOptions } from "./murmurhash-dzYfmtjT.cjs";
|
|
2
|
-
import { GlobOptions } from "glob";
|
|
3
|
-
|
|
4
|
-
//#region ../fs/src/list-files.d.ts
|
|
5
|
-
type ListOptions = GlobOptions;
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/hash-files.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* Hash a list of file paths into a string based on the file content
|
|
10
|
-
*
|
|
11
|
-
* @param files - The list of file paths to hash
|
|
12
|
-
* @param options - Hashing options
|
|
13
|
-
* @returns A hashed string value
|
|
14
|
-
*/
|
|
15
|
-
declare function hashFiles(files: string[], options?: HashOptions): Promise<string>;
|
|
16
|
-
/**
|
|
17
|
-
* Hash a folder path into a string based on the file content
|
|
18
|
-
*
|
|
19
|
-
* @param directoryPath - The folder path to hash
|
|
20
|
-
* @param options - Hashing options. By default, the `node_modules`, `.git`, `.nx`, `.cache`, and `tmp` folders is ignored.
|
|
21
|
-
* @returns A hashed string value
|
|
22
|
-
*/
|
|
23
|
-
declare function hashDirectory(directoryPath: string, options?: HashOptions & ListOptions): Promise<string>;
|
|
24
|
-
//#endregion
|
|
25
|
-
export { hashFiles as n, hashDirectory as t };
|
|
26
|
-
//# sourceMappingURL=hash-files-DMXzIbQw.d.cts.map
|