hfs 3.0.6 → 3.0.7
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/package.json +2 -2
- package/src/watchLoad.js +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hfs",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "HTTP File Server",
|
|
5
5
|
"keywords": ["file server", "http server"],
|
|
6
6
|
"homepage": "https://rejetto.com/hfs",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dist": "STASHED=; if ! git diff-index --quiet HEAD --; then git stash push -m 'dist' && STASHED=1; fi; CI=1 FORCE_COLOR=1 npm run dist-uncommitted || (EXIT_CODE=$?; [ -n \"$STASHED\" ] && git stash pop; exit $EXIT_CODE); [ -n \"$STASHED\" ] && git stash pop",
|
|
29
29
|
"dist-uncommitted": "npm audit --omit=dev --audit-level=moderate && npm run build-all && npm run test-ui && npm run dist-bin",
|
|
30
30
|
"dist-bin": "npm run dist-modules && npm run dist-bin-win && npm run dist-bin-linux && npm run dist-bin-linux-arm && npm run dist-bin-mac && npm run dist-bin-mac-arm",
|
|
31
|
-
"dist-modules": "cp package*.json central.json dist && cd dist && npm ci --omit=dev && cd .. && node prune_modules",
|
|
31
|
+
"dist-modules": "cp package*.json central.json README.md dist && cd dist && npm ci --omit=dev && cd .. && node prune_modules",
|
|
32
32
|
"dist-bin-win": "cd dist && pkg . --public -C gzip -t node20-win-x64 && npx resedit-cli --in hfs.exe --icon 1,../hfs.ico --out hfs.exe && zip hfs-windows-x64-$(jq -r .version ../package.json).zip hfs.exe -r plugins && cd ..",
|
|
33
33
|
"dist-bin-mac-arm": "cd dist && pkg . --public -C gzip -t node20-macos-arm64 && zip hfs-mac-arm64-$(jq -r .version ../package.json).zip hfs -r plugins && cd ..",
|
|
34
34
|
"dist-bin-mac": "cd dist && pkg . --public -C gzip -t node20-macos-x64 && zip hfs-mac-x64-$(jq -r .version ../package.json).zip hfs -r plugins && cd ..",
|
package/src/watchLoad.js
CHANGED
|
@@ -13,7 +13,7 @@ const events_1 = require("./events");
|
|
|
13
13
|
function watchLoad(path, parser, { failedOnFirstAttempt, immediateFirst } = {}) {
|
|
14
14
|
let doing = false;
|
|
15
15
|
let watcher;
|
|
16
|
-
const debounced = (0, debounceAsync_1.debounceAsync)(load, { wait: 500, maxWait: 1000 });
|
|
16
|
+
const debounced = (0, debounceAsync_1.debounceAsync)(load, { wait: 500, maxWait: 1000, reuseRunning: true });
|
|
17
17
|
let retry;
|
|
18
18
|
let last;
|
|
19
19
|
const emitter = new events_1.BetterEventEmitter();
|
|
@@ -33,7 +33,7 @@ function watchLoad(path, parser, { failedOnFirstAttempt, immediateFirst } = {})
|
|
|
33
33
|
void debounced();
|
|
34
34
|
});
|
|
35
35
|
debounced().catch(x => x);
|
|
36
|
-
if (immediateFirst)
|
|
36
|
+
if (immediateFirst && first)
|
|
37
37
|
void debounced.flush();
|
|
38
38
|
}
|
|
39
39
|
catch (e) {
|
|
@@ -57,7 +57,9 @@ function watchLoad(path, parser, { failedOnFirstAttempt, immediateFirst } = {})
|
|
|
57
57
|
if (e.code === 'EPERM')
|
|
58
58
|
console.error("missing permissions on file", path); // warn user, who could be clueless about this problem
|
|
59
59
|
// keep the last good content on transient read failures so we don't apply accidental "empty file" state
|
|
60
|
-
|
|
60
|
+
if (e.code === 'ENOENT')
|
|
61
|
+
return '';
|
|
62
|
+
throw e;
|
|
61
63
|
});
|
|
62
64
|
if (text === last)
|
|
63
65
|
return;
|
|
@@ -68,6 +70,9 @@ function watchLoad(path, parser, { failedOnFirstAttempt, immediateFirst } = {})
|
|
|
68
70
|
install(); // reinstall, as the original file could have been renamed. We watch by the name.
|
|
69
71
|
await parser(text);
|
|
70
72
|
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
console.error("error loading", path, String(e));
|
|
75
|
+
}
|
|
71
76
|
finally {
|
|
72
77
|
doing = false;
|
|
73
78
|
}
|