@wrongstack/plugins 0.31.1 → 0.41.0

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/cron.js CHANGED
@@ -1,5 +1,10 @@
1
1
  // src/cron/index.ts
2
2
  var API_VERSION = "^0.1.10";
3
+ var state = {
4
+ jobs: /* @__PURE__ */ new Map(),
5
+ timers: /* @__PURE__ */ new Map(),
6
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
7
+ };
3
8
  function formatNextRun(intervalMs) {
4
9
  const ms = Number.isNaN(intervalMs) || intervalMs <= 0 ? 6e4 : intervalMs;
5
10
  return new Date(Date.now() + ms).toISOString();
@@ -24,11 +29,9 @@ var plugin = {
24
29
  }
25
30
  },
26
31
  setup(api) {
27
- const state = {
28
- jobs: /* @__PURE__ */ new Map(),
29
- timers: /* @__PURE__ */ new Map(),
30
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
31
- };
32
+ state.jobs.clear();
33
+ state.timers.clear();
34
+ state.createdAt = (/* @__PURE__ */ new Date()).toISOString();
32
35
  const maxConcurrent = api.config.extensions?.["cron"]?.["maxConcurrentJobs"] ?? 5;
33
36
  function scheduleNextRun(name) {
34
37
  const job = state.jobs.get(name);
@@ -208,13 +211,11 @@ var plugin = {
208
211
  api.log.info("cron plugin loaded", { version: "0.1.0", maxConcurrent });
209
212
  },
210
213
  teardown(api) {
211
- const { jobs, timers } = api._state ?? { jobs: /* @__PURE__ */ new Map(), timers: /* @__PURE__ */ new Map() };
212
- for (const name of jobs.keys()) {
213
- const timer = timers.get(name);
214
- if (timer) clearTimeout(timer);
214
+ for (const timer of state.timers.values()) {
215
+ clearTimeout(timer);
215
216
  }
216
- jobs.clear();
217
- timers.clear();
217
+ state.timers.clear();
218
+ state.jobs.clear();
218
219
  api.log.info("cron plugin unloaded");
219
220
  }
220
221
  };
@@ -7,6 +7,8 @@ var watchIdCounter = 0;
7
7
  function nextId() {
8
8
  return `watch_${++watchIdCounter}_${Date.now().toString(36)}`;
9
9
  }
10
+ var watches = /* @__PURE__ */ new Map();
11
+ var debounceTimers = /* @__PURE__ */ new Map();
10
12
  var plugin = {
11
13
  name: "file-watcher",
12
14
  version: "0.1.0",
@@ -39,9 +41,16 @@ var plugin = {
39
41
  }
40
42
  },
41
43
  setup(api) {
42
- const watches = /* @__PURE__ */ new Map();
44
+ for (const handle of watches.values()) {
45
+ try {
46
+ handle.watcher.close();
47
+ } catch {
48
+ }
49
+ }
50
+ watches.clear();
51
+ for (const t of debounceTimers.values()) clearTimeout(t);
52
+ debounceTimers.clear();
43
53
  const debounceMs = api.config.extensions?.["file-watcher"]?.["debounceMs"] ?? 500;
44
- const debounceTimers = /* @__PURE__ */ new Map();
45
54
  function debounceEvent(key, fn, ms) {
46
55
  const existing = debounceTimers.get(key);
47
56
  if (existing) clearTimeout(existing);
@@ -229,9 +238,19 @@ var plugin = {
229
238
  api.log.info("file-watcher plugin loaded", { version: "0.1.0" });
230
239
  },
231
240
  teardown(api) {
232
- {
233
- api.log.info("file-watcher: teardown complete");
241
+ for (const handle of watches.values()) {
242
+ try {
243
+ handle.watcher.close();
244
+ } catch {
245
+ }
234
246
  }
247
+ watches.clear();
248
+ for (const t of debounceTimers.values()) clearTimeout(t);
249
+ debounceTimers.clear();
250
+ api.log.info("file-watcher: teardown complete", {
251
+ closed: 0
252
+ // recorded for log symmetry; actual count cleared above
253
+ });
235
254
  }
236
255
  };
237
256
  var file_watcher_default = plugin;
package/dist/index.js CHANGED
@@ -980,6 +980,8 @@ var watchIdCounter = 0;
980
980
  function nextId() {
981
981
  return `watch_${++watchIdCounter}_${Date.now().toString(36)}`;
982
982
  }
983
+ var watches = /* @__PURE__ */ new Map();
984
+ var debounceTimers = /* @__PURE__ */ new Map();
983
985
  var plugin5 = {
984
986
  name: "file-watcher",
985
987
  version: "0.1.0",
@@ -1012,9 +1014,16 @@ var plugin5 = {
1012
1014
  }
1013
1015
  },
1014
1016
  setup(api) {
1015
- const watches = /* @__PURE__ */ new Map();
1017
+ for (const handle of watches.values()) {
1018
+ try {
1019
+ handle.watcher.close();
1020
+ } catch {
1021
+ }
1022
+ }
1023
+ watches.clear();
1024
+ for (const t of debounceTimers.values()) clearTimeout(t);
1025
+ debounceTimers.clear();
1016
1026
  const debounceMs = api.config.extensions?.["file-watcher"]?.["debounceMs"] ?? 500;
1017
- const debounceTimers = /* @__PURE__ */ new Map();
1018
1027
  function debounceEvent(key, fn, ms) {
1019
1028
  const existing = debounceTimers.get(key);
1020
1029
  if (existing) clearTimeout(existing);
@@ -1202,9 +1211,19 @@ var plugin5 = {
1202
1211
  api.log.info("file-watcher plugin loaded", { version: "0.1.0" });
1203
1212
  },
1204
1213
  teardown(api) {
1205
- {
1206
- api.log.info("file-watcher: teardown complete");
1214
+ for (const handle of watches.values()) {
1215
+ try {
1216
+ handle.watcher.close();
1217
+ } catch {
1218
+ }
1207
1219
  }
1220
+ watches.clear();
1221
+ for (const t of debounceTimers.values()) clearTimeout(t);
1222
+ debounceTimers.clear();
1223
+ api.log.info("file-watcher: teardown complete", {
1224
+ closed: 0
1225
+ // recorded for log symmetry; actual count cleared above
1226
+ });
1208
1227
  }
1209
1228
  };
1210
1229
  var file_watcher_default = plugin5;
@@ -1796,6 +1815,11 @@ var json_path_default = plugin7;
1796
1815
 
1797
1816
  // src/cron/index.ts
1798
1817
  var API_VERSION7 = "^0.1.10";
1818
+ var state = {
1819
+ jobs: /* @__PURE__ */ new Map(),
1820
+ timers: /* @__PURE__ */ new Map(),
1821
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
1822
+ };
1799
1823
  function formatNextRun(intervalMs) {
1800
1824
  const ms = Number.isNaN(intervalMs) || intervalMs <= 0 ? 6e4 : intervalMs;
1801
1825
  return new Date(Date.now() + ms).toISOString();
@@ -1820,11 +1844,9 @@ var plugin8 = {
1820
1844
  }
1821
1845
  },
1822
1846
  setup(api) {
1823
- const state = {
1824
- jobs: /* @__PURE__ */ new Map(),
1825
- timers: /* @__PURE__ */ new Map(),
1826
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
1827
- };
1847
+ state.jobs.clear();
1848
+ state.timers.clear();
1849
+ state.createdAt = (/* @__PURE__ */ new Date()).toISOString();
1828
1850
  const maxConcurrent = api.config.extensions?.["cron"]?.["maxConcurrentJobs"] ?? 5;
1829
1851
  function scheduleNextRun(name) {
1830
1852
  const job = state.jobs.get(name);
@@ -2004,13 +2026,11 @@ var plugin8 = {
2004
2026
  api.log.info("cron plugin loaded", { version: "0.1.0", maxConcurrent });
2005
2027
  },
2006
2028
  teardown(api) {
2007
- const { jobs, timers } = api._state ?? { jobs: /* @__PURE__ */ new Map(), timers: /* @__PURE__ */ new Map() };
2008
- for (const name of jobs.keys()) {
2009
- const timer = timers.get(name);
2010
- if (timer) clearTimeout(timer);
2029
+ for (const timer of state.timers.values()) {
2030
+ clearTimeout(timer);
2011
2031
  }
2012
- jobs.clear();
2013
- timers.clear();
2032
+ state.timers.clear();
2033
+ state.jobs.clear();
2014
2034
  api.log.info("cron plugin unloaded");
2015
2035
  }
2016
2036
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/plugins",
3
- "version": "0.31.1",
3
+ "version": "0.41.0",
4
4
  "description": "Official WrongStack plugin collection — auto-doc, git-autocommit, shell-check, cost-tracker, file-watcher, web-search, json-path, cron, template-engine, semver-bump",
5
5
  "license": "MIT",
6
6
  "author": "ECOSTACK TECHNOLOGY OÜ",
@@ -63,7 +63,7 @@
63
63
  "vitest": "^4.1.7"
64
64
  },
65
65
  "dependencies": {
66
- "@wrongstack/core": "0.31.1"
66
+ "@wrongstack/core": "0.41.0"
67
67
  },
68
68
  "scripts": {
69
69
  "build": "tsup",