@spoosh/plugin-gc 0.2.0 → 0.3.1

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.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { SpooshPlugin } from '@spoosh/core';
1
+ import * as _spoosh_core from '@spoosh/core';
2
2
 
3
3
  type GcPluginOptions = {
4
4
  /**
@@ -51,7 +51,7 @@ type GcPluginExports = {
51
51
  * const removedCount = runGc();
52
52
  * ```
53
53
  */
54
- declare function gcPlugin(options?: GcPluginOptions): SpooshPlugin<{
54
+ declare function gcPlugin(options?: GcPluginOptions): _spoosh_core.SpooshPlugin<{
55
55
  instanceApi: GcPluginExports;
56
56
  }>;
57
57
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SpooshPlugin } from '@spoosh/core';
1
+ import * as _spoosh_core from '@spoosh/core';
2
2
 
3
3
  type GcPluginOptions = {
4
4
  /**
@@ -51,7 +51,7 @@ type GcPluginExports = {
51
51
  * const removedCount = runGc();
52
52
  * ```
53
53
  */
54
- declare function gcPlugin(options?: GcPluginOptions): SpooshPlugin<{
54
+ declare function gcPlugin(options?: GcPluginOptions): _spoosh_core.SpooshPlugin<{
55
55
  instanceApi: GcPluginExports;
56
56
  }>;
57
57
 
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ __export(src_exports, {
25
25
  module.exports = __toCommonJS(src_exports);
26
26
 
27
27
  // src/plugin.ts
28
+ var import_core = require("@spoosh/core");
28
29
  var PLUGIN_NAME = "spoosh:gc";
29
30
  function runGarbageCollection(stateManager, eventTracer, options) {
30
31
  const { maxAge, maxEntries } = options;
@@ -73,7 +74,7 @@ function runGarbageCollection(stateManager, eventTracer, options) {
73
74
  function gcPlugin(options = {}) {
74
75
  const { interval = 6e4 } = options;
75
76
  let runGcFn;
76
- return {
77
+ return (0, import_core.createSpooshPlugin)({
77
78
  name: PLUGIN_NAME,
78
79
  operations: [],
79
80
  setup(context) {
@@ -102,7 +103,7 @@ function gcPlugin(options = {}) {
102
103
  runGc: () => runGcFn?.() ?? 0
103
104
  };
104
105
  }
105
- };
106
+ });
106
107
  }
107
108
  // Annotate the CommonJS export names for ESM import in node:
108
109
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -1,4 +1,7 @@
1
1
  // src/plugin.ts
2
+ import {
3
+ createSpooshPlugin
4
+ } from "@spoosh/core";
2
5
  var PLUGIN_NAME = "spoosh:gc";
3
6
  function runGarbageCollection(stateManager, eventTracer, options) {
4
7
  const { maxAge, maxEntries } = options;
@@ -47,7 +50,7 @@ function runGarbageCollection(stateManager, eventTracer, options) {
47
50
  function gcPlugin(options = {}) {
48
51
  const { interval = 6e4 } = options;
49
52
  let runGcFn;
50
- return {
53
+ return createSpooshPlugin({
51
54
  name: PLUGIN_NAME,
52
55
  operations: [],
53
56
  setup(context) {
@@ -76,7 +79,7 @@ function gcPlugin(options = {}) {
76
79
  runGc: () => runGcFn?.() ?? 0
77
80
  };
78
81
  }
79
- };
82
+ });
80
83
  }
81
84
  export {
82
85
  gcPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spoosh/plugin-gc",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Garbage collection plugin for Spoosh cache with time and size-based cleanup",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -34,11 +34,11 @@
34
34
  }
35
35
  },
36
36
  "peerDependencies": {
37
- "@spoosh/core": ">=0.13.0"
37
+ "@spoosh/core": ">=0.15.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@spoosh/test-utils": "0.2.0",
41
- "@spoosh/core": "0.13.0"
40
+ "@spoosh/core": "0.15.1",
41
+ "@spoosh/test-utils": "0.3.0"
42
42
  },
43
43
  "scripts": {
44
44
  "dev": "tsup --watch",