@neat.is/core 0.4.5 → 0.4.6

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/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  routeSpanToProject,
3
3
  startDaemon
4
- } from "./chunk-6GXBAR3M.js";
4
+ } from "./chunk-NON5AXOR.js";
5
5
  import {
6
6
  ProjectNameCollisionError,
7
7
  addProject,
package/dist/neatd.cjs CHANGED
@@ -5886,11 +5886,45 @@ async function startDaemon(opts = {}) {
5886
5886
  });
5887
5887
  };
5888
5888
  process.on("SIGHUP", sighupHandler);
5889
+ const REGISTRY_RELOAD_DEBOUNCE_MS = 500;
5890
+ let registryWatcher = null;
5891
+ let reloadTimer = null;
5892
+ try {
5893
+ const regDir = import_node_path37.default.dirname(regPath);
5894
+ const regBase = import_node_path37.default.basename(regPath);
5895
+ registryWatcher = (0, import_node_fs22.watch)(regDir, (_eventType, filename) => {
5896
+ if (filename !== null && filename !== regBase) return;
5897
+ if (reloadTimer) clearTimeout(reloadTimer);
5898
+ reloadTimer = setTimeout(() => {
5899
+ reloadTimer = null;
5900
+ void reload().catch((err) => {
5901
+ console.warn(
5902
+ `neatd: registry-watch reload failed \u2014 ${err.message}`
5903
+ );
5904
+ });
5905
+ }, REGISTRY_RELOAD_DEBOUNCE_MS);
5906
+ });
5907
+ } catch (err) {
5908
+ console.warn(
5909
+ `neatd: failed to watch registry at ${regPath} \u2014 ${err.message}. Run \`neatd reload\` (or send SIGHUP) after registering new projects.`
5910
+ );
5911
+ }
5889
5912
  let stopped = false;
5890
5913
  const stop = async () => {
5891
5914
  if (stopped) return;
5892
5915
  stopped = true;
5893
5916
  process.off("SIGHUP", sighupHandler);
5917
+ if (reloadTimer) {
5918
+ clearTimeout(reloadTimer);
5919
+ reloadTimer = null;
5920
+ }
5921
+ if (registryWatcher) {
5922
+ try {
5923
+ registryWatcher.close();
5924
+ } catch {
5925
+ }
5926
+ registryWatcher = null;
5927
+ }
5894
5928
  if (otlpApp) await otlpApp.close().catch(() => {
5895
5929
  });
5896
5930
  if (restApp) await restApp.close().catch(() => {