ghtml 2.1.1 → 2.1.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/bin/src/utils.js +6 -11
- package/package.json +1 -2
package/bin/src/utils.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { win32, posix } from "node:path";
|
|
4
|
-
import { cpus } from "node:os";
|
|
5
4
|
import { Glob } from "glob";
|
|
6
|
-
import { promise as fastq } from "fastq";
|
|
7
|
-
const fastqConcurrency = Math.max(1, cpus().length - 1);
|
|
8
5
|
|
|
9
6
|
const generateFileHash = async (filePath) => {
|
|
10
7
|
try {
|
|
@@ -91,10 +88,8 @@ const generateHashesAndReplace = async ({
|
|
|
91
88
|
rootPath += "/";
|
|
92
89
|
}
|
|
93
90
|
|
|
94
|
-
const queue =
|
|
95
|
-
const queuePromises = [];
|
|
91
|
+
const queue = [];
|
|
96
92
|
const files = [];
|
|
97
|
-
|
|
98
93
|
const filesIterable = new Glob("**/**", {
|
|
99
94
|
nodir: true,
|
|
100
95
|
follow: true,
|
|
@@ -104,13 +99,13 @@ const generateHashesAndReplace = async ({
|
|
|
104
99
|
ignore: skipPatterns,
|
|
105
100
|
});
|
|
106
101
|
|
|
107
|
-
for await (let
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
for await (let filePath of filesIterable) {
|
|
103
|
+
filePath = filePath.split(win32.sep).join(posix.sep);
|
|
104
|
+
queue.push(generateFileHash(filePath));
|
|
105
|
+
files.push(filePath);
|
|
111
106
|
}
|
|
112
107
|
|
|
113
|
-
const hashes = await Promise.all(
|
|
108
|
+
const hashes = await Promise.all(queue);
|
|
114
109
|
|
|
115
110
|
for (let i = 0; i < files.length; i++) {
|
|
116
111
|
const fileRelativePath = posix.relative(rootPath, files[i]);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Replace your template engine with fast JavaScript by leveraging the power of tagged templates.",
|
|
4
4
|
"author": "Gürgün Dayıoğlu",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "2.1.
|
|
6
|
+
"version": "2.1.2",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": "./bin/src/index.js",
|
|
9
9
|
"main": "./src/index.js",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"lint:fix": "eslint --fix . && prettier --write ."
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"fastq": "^1.17.1",
|
|
25
24
|
"glob": "^10.4.2"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|