@keyv/compress-lz4 6.0.0-alpha.3 → 6.0.0-beta.4

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/LICENSE CHANGED
@@ -1,17 +1,7 @@
1
1
  MIT License
2
2
 
3
3
  Copyright (c) 2017-2021 Luke Childs
4
- Copyright (c) 2021-2022 Jared Wray
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
4
+ Copyright (c) 2021-2026 Jared Wray
15
5
 
16
6
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
7
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @keyv/compress-lz4 [<img width="100" align="right" src="https://jaredwray.com/images/keyv-symbol.svg" alt="keyv">](https://github.com/jaredwra/keyv)
1
+ # @keyv/compress-lz4 [<img width="100" align="right" src="https://jaredwray.com/images/keyv-symbol.svg" alt="keyv">](https://github.com/jaredwray/keyv)
2
2
 
3
3
  > lz4 compression for Keyv
4
4
 
package/dist/index.cjs CHANGED
@@ -1,53 +1,25 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- KeyvLz4: () => KeyvLz4,
24
- default: () => index_default
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
25
4
  });
26
- module.exports = __toCommonJS(index_exports);
27
- var import_node_buffer = require("buffer");
28
- var import_lz4_napi = require("lz4-napi");
5
+ let node_buffer = require("node:buffer");
6
+ let lz4_napi = require("lz4-napi");
7
+ //#region src/index.ts
29
8
  var KeyvLz4 = class {
30
- constructor(dictionary) {
31
- this.dictionary = dictionary;
32
- }
33
- async compress(data) {
34
- const compressed = await (0, import_lz4_napi.compress)(import_node_buffer.Buffer.from(data), this.getDictionary());
35
- return compressed.toString("base64");
36
- }
37
- async decompress(data) {
38
- const buffer = import_node_buffer.Buffer.from(data, "base64");
39
- const value = await (0, import_lz4_napi.uncompress)(buffer, this.getDictionary());
40
- return value.toString("utf8");
41
- }
42
- getDictionary() {
43
- if (this.dictionary) {
44
- return import_node_buffer.Buffer.from(this.dictionary);
45
- }
46
- return void 0;
47
- }
9
+ dictionary;
10
+ constructor(dictionary) {
11
+ this.dictionary = dictionary;
12
+ }
13
+ async compress(data) {
14
+ return (await (0, lz4_napi.compress)(node_buffer.Buffer.from(data), this.getDictionary())).toString("base64");
15
+ }
16
+ async decompress(data) {
17
+ return (await (0, lz4_napi.uncompress)(node_buffer.Buffer.from(data, "base64"), this.getDictionary())).toString("utf8");
18
+ }
19
+ getDictionary() {
20
+ if (this.dictionary) return node_buffer.Buffer.from(this.dictionary);
21
+ }
48
22
  };
49
- var index_default = KeyvLz4;
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- KeyvLz4
53
- });
23
+ //#endregion
24
+ exports.KeyvLz4 = KeyvLz4;
25
+ exports.default = KeyvLz4;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,12 @@
1
- declare class KeyvLz4 {
2
- private readonly dictionary?;
3
- constructor(dictionary?: string | undefined);
4
- compress(data: string): Promise<string>;
5
- decompress(data: string): Promise<string>;
6
- private getDictionary;
7
- }
1
+ import { KeyvCompressionAdapter } from "keyv";
8
2
 
9
- export { KeyvLz4, KeyvLz4 as default };
3
+ //#region src/index.d.ts
4
+ declare class KeyvLz4 implements KeyvCompressionAdapter {
5
+ private readonly dictionary?;
6
+ constructor(dictionary?: string | undefined);
7
+ compress(data: string): Promise<string>;
8
+ decompress(data: string): Promise<string>;
9
+ private getDictionary;
10
+ }
11
+ //#endregion
12
+ export { KeyvLz4, KeyvLz4 as default };
@@ -0,0 +1,12 @@
1
+ import { KeyvCompressionAdapter } from "keyv";
2
+
3
+ //#region src/index.d.ts
4
+ declare class KeyvLz4 implements KeyvCompressionAdapter {
5
+ private readonly dictionary?;
6
+ constructor(dictionary?: string | undefined);
7
+ compress(data: string): Promise<string>;
8
+ decompress(data: string): Promise<string>;
9
+ private getDictionary;
10
+ }
11
+ //#endregion
12
+ export { KeyvLz4, KeyvLz4 as default };
package/dist/index.mjs ADDED
@@ -0,0 +1,20 @@
1
+ import { Buffer } from "node:buffer";
2
+ import { compress, uncompress } from "lz4-napi";
3
+ //#region src/index.ts
4
+ var KeyvLz4 = class {
5
+ dictionary;
6
+ constructor(dictionary) {
7
+ this.dictionary = dictionary;
8
+ }
9
+ async compress(data) {
10
+ return (await compress(Buffer.from(data), this.getDictionary())).toString("base64");
11
+ }
12
+ async decompress(data) {
13
+ return (await uncompress(Buffer.from(data, "base64"), this.getDictionary())).toString("utf8");
14
+ }
15
+ getDictionary() {
16
+ if (this.dictionary) return Buffer.from(this.dictionary);
17
+ }
18
+ };
19
+ //#endregion
20
+ export { KeyvLz4, KeyvLz4 as default };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@keyv/compress-lz4",
3
- "version": "6.0.0-alpha.3",
3
+ "version": "6.0.0-beta.4",
4
4
  "description": "lz4 compression for Keyv",
5
5
  "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
6
+ "main": "./dist/index.mjs",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.mts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "require": {
@@ -13,8 +13,8 @@
13
13
  "default": "./dist/index.cjs"
14
14
  },
15
15
  "import": {
16
- "types": "./dist/index.d.ts",
17
- "default": "./dist/index.js"
16
+ "types": "./dist/index.d.mts",
17
+ "default": "./dist/index.mjs"
18
18
  }
19
19
  }
20
20
  },
@@ -46,27 +46,27 @@
46
46
  "lz4-napi": "^2.9.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "keyv": "^6.0.0-alpha.3"
49
+ "keyv": "^6.0.0-beta.4"
50
50
  },
51
51
  "devDependencies": {
52
- "@biomejs/biome": "^2.3.8",
53
- "@vitest/coverage-v8": "^4.0.14",
54
- "rimraf": "^6.1.2",
55
- "vitest": "^4.0.14",
56
- "@keyv/test-suite": "^6.0.0-alpha.3"
52
+ "@biomejs/biome": "^2.4.16",
53
+ "@vitest/coverage-v8": "^4.1.8",
54
+ "rimraf": "^6.1.3",
55
+ "vitest": "^4.1.8",
56
+ "@keyv/test-suite": "^6.0.0-beta.4"
57
57
  },
58
58
  "tsd": {
59
59
  "directory": "test"
60
60
  },
61
61
  "engines": {
62
- "node": ">= 18"
62
+ "node": ">= 22.18.0"
63
63
  },
64
64
  "files": [
65
65
  "dist",
66
66
  "LICENSE"
67
67
  ],
68
68
  "scripts": {
69
- "build": "rimraf ./dist && tsup src/index.ts --format cjs,esm --dts --clean",
69
+ "build": "tsdown",
70
70
  "lint": "biome check --write --error-on-warnings",
71
71
  "lint:ci": "biome check --error-on-warnings",
72
72
  "test": "pnpm lint && vitest run --coverage",
package/dist/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- declare class KeyvLz4 {
2
- private readonly dictionary?;
3
- constructor(dictionary?: string | undefined);
4
- compress(data: string): Promise<string>;
5
- decompress(data: string): Promise<string>;
6
- private getDictionary;
7
- }
8
-
9
- export { KeyvLz4, KeyvLz4 as default };
package/dist/index.js DELETED
@@ -1,28 +0,0 @@
1
- // src/index.ts
2
- import { Buffer } from "buffer";
3
- import { compress, uncompress } from "lz4-napi";
4
- var KeyvLz4 = class {
5
- constructor(dictionary) {
6
- this.dictionary = dictionary;
7
- }
8
- async compress(data) {
9
- const compressed = await compress(Buffer.from(data), this.getDictionary());
10
- return compressed.toString("base64");
11
- }
12
- async decompress(data) {
13
- const buffer = Buffer.from(data, "base64");
14
- const value = await uncompress(buffer, this.getDictionary());
15
- return value.toString("utf8");
16
- }
17
- getDictionary() {
18
- if (this.dictionary) {
19
- return Buffer.from(this.dictionary);
20
- }
21
- return void 0;
22
- }
23
- };
24
- var index_default = KeyvLz4;
25
- export {
26
- KeyvLz4,
27
- index_default as default
28
- };