@stryke/hash 0.9.1 → 0.9.2
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/dist/hash-files.cjs +7 -7
- package/dist/hash-files.d.ts +3 -4
- package/dist/hash-files.mjs +1 -1
- package/package.json +2 -2
package/dist/hash-files.cjs
CHANGED
|
@@ -8,12 +8,12 @@ exports.hashFiles = hashFiles;
|
|
|
8
8
|
var _listFiles = require("@stryke/fs/list-files");
|
|
9
9
|
var _readFile = require("@stryke/fs/read-file");
|
|
10
10
|
var _hash = require("./hash.cjs");
|
|
11
|
-
async function hashFiles(
|
|
12
|
-
const
|
|
13
|
-
return await Promise.all(
|
|
14
|
-
|
|
15
|
-
})), (0, _hash.hash)(
|
|
11
|
+
async function hashFiles(t, s) {
|
|
12
|
+
const r = {};
|
|
13
|
+
return await Promise.all(t.map(async i => {
|
|
14
|
+
r[i] = await (0, _readFile.readFile)(i);
|
|
15
|
+
})), (0, _hash.hash)(r, s);
|
|
16
16
|
}
|
|
17
|
-
async function hashDirectory(
|
|
18
|
-
return s.
|
|
17
|
+
async function hashDirectory(t, s = {}) {
|
|
18
|
+
return s.ignore = s.ignore ?? ["**/node_modules/**", "**/.git/**", "**/.nx/**", "**/.cache/**", "**/.storm/**", "**/tmp/**"], hashFiles(await (0, _listFiles.listFiles)(t, s), s);
|
|
19
19
|
}
|
package/dist/hash-files.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ListOptions } from "@stryke/fs/list-files";
|
|
2
2
|
import type { HashOptions } from "./hash";
|
|
3
|
-
export type HashFilesOptions = HashOptions & ListFilesOptions;
|
|
4
3
|
/**
|
|
5
4
|
* Hash a list of file paths into a string based on the file content
|
|
6
5
|
*
|
|
@@ -8,7 +7,7 @@ export type HashFilesOptions = HashOptions & ListFilesOptions;
|
|
|
8
7
|
* @param options - Hashing options
|
|
9
8
|
* @returns A hashed string value
|
|
10
9
|
*/
|
|
11
|
-
export declare function hashFiles(files: string[], options?:
|
|
10
|
+
export declare function hashFiles(files: string[], options?: HashOptions): Promise<string>;
|
|
12
11
|
/**
|
|
13
12
|
* Hash a folder path into a string based on the file content
|
|
14
13
|
*
|
|
@@ -16,4 +15,4 @@ export declare function hashFiles(files: string[], options?: HashFilesOptions):
|
|
|
16
15
|
* @param options - Hashing options. By default, the `node_modules`, `.git`, `.nx`, `.cache`, and `tmp` folders is ignored.
|
|
17
16
|
* @returns A hashed string value
|
|
18
17
|
*/
|
|
19
|
-
export declare function hashDirectory(directoryPath: string, options?:
|
|
18
|
+
export declare function hashDirectory(directoryPath: string, options?: HashOptions & ListOptions): Promise<string>;
|
package/dist/hash-files.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{listFiles as
|
|
1
|
+
import{listFiles as o}from"@stryke/fs/list-files";import{readFile as e}from"@stryke/fs/read-file";import{hash as n}from"./hash";export async function hashFiles(t,s){const r={};return await Promise.all(t.map(async i=>{r[i]=await e(i)})),n(r,s)}export async function hashDirectory(t,s={}){return s.ignore=s.ignore??["**/node_modules/**","**/.git/**","**/.nx/**","**/.cache/**","**/.storm/**","**/tmp/**"],hashFiles(await o(t,s),s)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/hash",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing utility functions that hash data using various algorithms.",
|
|
6
6
|
"repository": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"js-xxhash": "^4.0.0",
|
|
14
14
|
"ohash": "^2.0.11",
|
|
15
|
-
"@stryke/fs": "^0.
|
|
15
|
+
"@stryke/fs": "^0.12.0"
|
|
16
16
|
},
|
|
17
17
|
"publishConfig": { "access": "public" },
|
|
18
18
|
"devDependencies": {},
|