haraka-config
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -7,5 +7,6 @@ # Changelog | ||
### [1.2.3] - 2024-04-26 | ||
### [1.2.4] - 2024-04-26 | ||
- reader: use path.sep instead of [\\/] to be more obvious | ||
- fix(watch): callback was losing context. Use explicit obj | ||
- fix(reader): use path.sep instead of [\\/] to be more obvious | ||
@@ -133,5 +134,5 @@ ### [1.2.2] - 2024-04-24 | ||
[1.1.0]: https://github.com/haraka/haraka-config/releases/tag/1.1.0 | ||
[1.2.2]: https://github.com/haraka/haraka-config/releases/tag/v1.2.2 | ||
[1.2.3]: https://github.com/haraka/haraka-config/releases/tag/v1.2.3 | ||
[1.2.0]: https://github.com/haraka/haraka-config/releases/tag/v1.2.0 | ||
[1.2.1]: https://github.com/haraka/haraka-config/releases/tag/v1.2.1 | ||
[1.2.2]: https://github.com/haraka/haraka-config/releases/tag/v1.2.2 | ||
[1.2.4]: https://github.com/haraka/haraka-config/releases/tag/v1.2.4 |
@@ -8,3 +8,5 @@ const fs = require('node:fs') | ||
module.exports.ensure_enoent_timer = (reader) => { | ||
const Watch = {} | ||
Watch.ensure_enoent_timer = (reader) => { | ||
if (enoent.timer) return | ||
@@ -23,3 +25,3 @@ // Create timer | ||
{ persistent: false }, | ||
this.onEvent(reader, file, args), | ||
Watch.onEvent(reader, file, args), | ||
) | ||
@@ -32,3 +34,3 @@ }) | ||
module.exports.file = (reader, name, type, cb, options) => { | ||
Watch.file = (reader, name, type, cb, options) => { | ||
// This works on all OS's, but watch_dir() above is preferred for Linux and | ||
@@ -45,3 +47,3 @@ // Windows as it is far more efficient. | ||
{ persistent: false }, | ||
this.onEvent(reader, name, { type, options, cb }), | ||
Watch.onEvent(reader, name, { type, options, cb }), | ||
) | ||
@@ -52,3 +54,3 @@ } catch (e) { | ||
enoent.files[name] = true | ||
this.ensure_enoent_timer(reader) | ||
Watch.ensure_enoent_timer(reader) | ||
} else { | ||
@@ -61,3 +63,3 @@ console.error(`Error watching config file: ${name} : ${e}`) | ||
// used to watch main haraka config dir | ||
module.exports.dir = (reader) => { | ||
Watch.dir = (reader) => { | ||
// NOTE: Has OS platform limitations: | ||
@@ -91,3 +93,3 @@ // https://nodejs.org/api/fs.html#fs_fs_watch_filename_options_listener | ||
// used by getDir | ||
module.exports.dir2 = (reader, dirPath) => { | ||
Watch.dir2 = (reader, dirPath) => { | ||
if (watchers[dirPath]) return | ||
@@ -115,3 +117,3 @@ const watchOpts = { persistent: false, recursive: true } | ||
module.exports.onEvent = (reader, name, args) => { | ||
Watch.onEvent = (reader, name, args) => { | ||
return (fse) => { | ||
@@ -137,3 +139,3 @@ if (sedation_timers[name]) { | ||
{ persistent: false }, | ||
this.onEvent(...arguments), | ||
Watch.onEvent(reader, name, args), | ||
) | ||
@@ -143,3 +145,3 @@ } catch (e) { | ||
enoent.files[name] = true | ||
this.ensure_enoent_timer(reader) | ||
Watch.ensure_enoent_timer(reader) | ||
} else { | ||
@@ -151,1 +153,3 @@ console.error(`Error watching file: ${name} : ${e}`) | ||
} | ||
module.exports = Watch |
@@ -6,3 +6,3 @@ { | ||
"description": "Haraka's config file loader", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"homepage": "http://haraka.github.io", | ||
@@ -9,0 +9,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36654
717