intial
This commit is contained in:
21
node_modules/@keyv/bigmap/LICENSE
generated
vendored
Normal file
21
node_modules/@keyv/bigmap/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Jared Wray
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
624
node_modules/@keyv/bigmap/README.md
generated
vendored
Normal file
624
node_modules/@keyv/bigmap/README.md
generated
vendored
Normal file
@@ -0,0 +1,624 @@
|
||||
# @keyv/bigmap [<img width="100" align="right" src="https://jaredwray.com/images/keyv-symbol.svg" alt="keyv">](https://github.com/jaredwra/keyv)
|
||||
|
||||
> Bigmap for Keyv
|
||||
|
||||
[](https://github.com/jaredwray/keyv/actions/workflows/tests.yaml)
|
||||
[](https://codecov.io/gh/jaredwray/keyv)
|
||||
[](https://www.npmjs.com/package/@keyv/bigmap)
|
||||
[](https://npmjs.com/package/@keyv/bigmap)
|
||||
|
||||
# Features
|
||||
* Based on the Map interface and uses the same API.
|
||||
* Lightweight with no dependencies.
|
||||
* Scales to past the 17 million key limit of a regular Map.
|
||||
* Uses a hash `djb2Hash` for fast key lookups.
|
||||
* Ability to use your own hash function.
|
||||
* Built in Typescript and Generics for type safety.
|
||||
* Used in `@cacheable/memory` for scalable in-memory caching.
|
||||
* Maintained regularly with a focus on performance and reliability.
|
||||
|
||||
# Table of Contents
|
||||
- [Features](#features)
|
||||
- [Installation](#installation)
|
||||
- [Overview](#overview)
|
||||
- [Basic Usage](#basic-usage)
|
||||
- [Custom Store Size](#custom-store-size)
|
||||
- [Custom Hash Function](#custom-hash-function)
|
||||
- [Iteration](#iteration)
|
||||
- [For...of Loop](#forof-loop)
|
||||
- [forEach](#foreach)
|
||||
- [Keys, Values, and Entries](#keys-values-and-entries)
|
||||
- [Advanced Features](#advanced-features)
|
||||
- [Type Safety with Generics](#type-safety-with-generics)
|
||||
- [Large-Scale Data](#large-scale-data)
|
||||
- [Using with Keyv](#using-with-keyv)
|
||||
- [createKeyv](#createkeyv)
|
||||
- [With Custom Options](#with-custom-options)
|
||||
- [Type Safety](#type-safety)
|
||||
- [Integration with Keyv Ecosystem](#integration-with-keyv-ecosystem)
|
||||
- [API](#api)
|
||||
- [Constructor](#constructor)
|
||||
- [Properties](#properties)
|
||||
- [Methods](#methods)
|
||||
- [set](#set)
|
||||
- [get](#get)
|
||||
- [has](#has)
|
||||
- [delete](#delete)
|
||||
- [clear](#clear)
|
||||
- [forEach](#foreach)
|
||||
- [keys](#keys)
|
||||
- [values](#values)
|
||||
- [entries](#entries)
|
||||
- [Symbol.iterator](#symboliterator)
|
||||
- [getStore](#getstorekey)
|
||||
- [getStoreMap](#getstoremapindex)
|
||||
- [initStore](#initstore)
|
||||
- [Types](#types)
|
||||
- [StoreHashFunction](#storehashfunction)
|
||||
- [defaultHashFunction(key, storeSize)](#defaulthashfunctionkey-storesize)
|
||||
- [Contributing](#contributing)
|
||||
- [License](#license)
|
||||
|
||||
# Installation
|
||||
|
||||
```bash
|
||||
npm install --save keyv @keyv/bigmap
|
||||
```
|
||||
|
||||
# Overview
|
||||
|
||||
BigMap is a scalable Map implementation that overcomes JavaScript's built-in Map limit of approximately 17 million entries. It uses a distributed hash approach with multiple internal Map instances.
|
||||
|
||||
# Basic Usage
|
||||
|
||||
```typescript
|
||||
import { BigMap } from '@keyv/bigmap';
|
||||
|
||||
// Create a new BigMap
|
||||
const bigMap = new BigMap<string, number>();
|
||||
|
||||
// Set values
|
||||
bigMap.set('key1', 100);
|
||||
bigMap.set('key2', 200);
|
||||
|
||||
// Get values
|
||||
const value = bigMap.get('key1'); // 100
|
||||
|
||||
// Check if key exists
|
||||
bigMap.has('key1'); // true
|
||||
|
||||
// Delete a key
|
||||
bigMap.delete('key1'); // true
|
||||
|
||||
// Get size
|
||||
console.log(bigMap.size); // 1
|
||||
|
||||
// Clear all entries
|
||||
bigMap.clear();
|
||||
```
|
||||
|
||||
# Custom Store Size
|
||||
|
||||
By default, BigMap uses 4 internal Map instances. You can configure this:
|
||||
|
||||
```typescript
|
||||
const bigMap = new BigMap<string, number>({ storeSize: 10 });
|
||||
```
|
||||
|
||||
**Note:** Changing the `storeSize` after initialization will clear all entries.
|
||||
|
||||
# Custom Hash Function
|
||||
|
||||
Provide your own hash function for key distribution:
|
||||
|
||||
```typescript
|
||||
const customHashFunction = (key: string, storeSize: number) => {
|
||||
return key.length % storeSize;
|
||||
};
|
||||
|
||||
const bigMap = new BigMap<string, string>({
|
||||
storeHashFunction: customHashFunction
|
||||
});
|
||||
```
|
||||
|
||||
## Using Hashery for Hash Functions
|
||||
|
||||
[Hashery](https://github.com/jaredwray/hashery) is a powerful hashing library that provides multiple hash algorithms. You can use it for better key distribution and it is available as an export:
|
||||
|
||||
```typescript
|
||||
import { BigMap, Hashery } from '@keyv/bigmap';
|
||||
|
||||
const hashery = new Hashery();
|
||||
|
||||
// Using Hashery's toNumberSync for deterministic key distribution
|
||||
const bigMap = new BigMap<string, string>({
|
||||
storeHashFunction: (key: string, storeSize: number) => {
|
||||
return hashery.toNumberSync(key, { min: 0, max: storeSize - 1 });
|
||||
}
|
||||
});
|
||||
|
||||
// You can also use different algorithms
|
||||
const hasheryFnv1 = new Hashery({ defaultAlgorithmSync: 'fnv1' });
|
||||
|
||||
const bigMapWithFnv1 = new BigMap<string, string>({
|
||||
storeHashFunction: (key: string, storeSize: number) => {
|
||||
return hasheryFnv1.toNumberSync(key, { min: 0, max: storeSize - 1 });
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Hashery supports multiple synchronous hash algorithms:
|
||||
- **djb2** - Fast hash function (default)
|
||||
- **fnv1** - Excellent distribution for hash tables
|
||||
- **murmer** - MurmurHash algorithm
|
||||
- **crc32** - Cyclic Redundancy Check
|
||||
|
||||
# Iteration
|
||||
|
||||
BigMap supports all standard Map iteration methods:
|
||||
|
||||
## For...of Loop
|
||||
|
||||
```typescript
|
||||
const bigMap = new BigMap<string, number>();
|
||||
bigMap.set('a', 1);
|
||||
bigMap.set('b', 2);
|
||||
|
||||
for (const [key, value] of bigMap) {
|
||||
console.log(key, value);
|
||||
}
|
||||
```
|
||||
|
||||
## forEach
|
||||
|
||||
```typescript
|
||||
bigMap.forEach((value, key) => {
|
||||
console.log(key, value);
|
||||
});
|
||||
|
||||
// With custom context
|
||||
const context = { sum: 0 };
|
||||
bigMap.forEach(function(value) {
|
||||
this.sum += value;
|
||||
}, context);
|
||||
```
|
||||
|
||||
## Keys, Values, and Entries
|
||||
|
||||
```typescript
|
||||
// Iterate over keys
|
||||
for (const key of bigMap.keys()) {
|
||||
console.log(key);
|
||||
}
|
||||
|
||||
// Iterate over values
|
||||
for (const value of bigMap.values()) {
|
||||
console.log(value);
|
||||
}
|
||||
|
||||
// Iterate over entries
|
||||
for (const [key, value] of bigMap.entries()) {
|
||||
console.log(key, value);
|
||||
}
|
||||
```
|
||||
|
||||
# Advanced Features
|
||||
|
||||
## Type Safety with Generics
|
||||
|
||||
```typescript
|
||||
interface User {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
const userMap = new BigMap<string, User>();
|
||||
userMap.set('user1', { id: 1, name: 'Alice' });
|
||||
```
|
||||
|
||||
## Large-Scale Data
|
||||
|
||||
BigMap is designed to handle millions of entries:
|
||||
|
||||
```typescript
|
||||
const bigMap = new BigMap<string, number>({ storeSize: 16 });
|
||||
|
||||
// Add 20+ million entries without hitting Map limits
|
||||
for (let i = 0; i < 20000000; i++) {
|
||||
bigMap.set(`key${i}`, i);
|
||||
}
|
||||
|
||||
console.log(bigMap.size); // 20000000
|
||||
```
|
||||
|
||||
# Using with Keyv
|
||||
|
||||
BigMap can be used as a storage adapter for [Keyv](https://github.com/jaredwray/keyv), providing a scalable in-memory store with TTL support.
|
||||
|
||||
## createKeyv
|
||||
|
||||
The `createKeyv` function creates a Keyv instance with BigMap as the storage adapter.
|
||||
|
||||
**Parameters:**
|
||||
- `options` (optional): BigMap configuration options
|
||||
- `storeSize` (number): Number of internal Map instances. Default: `4`
|
||||
- `storeHashFunction` (StoreHashFunction): Custom hash function for key distribution
|
||||
|
||||
**Returns:** `Keyv` instance with BigMap adapter
|
||||
|
||||
**Example:**
|
||||
|
||||
```typescript
|
||||
import { createKeyv } from '@keyv/bigmap';
|
||||
|
||||
// Basic usage
|
||||
const keyv = createKeyv();
|
||||
|
||||
// Set with TTL (in milliseconds)
|
||||
await keyv.set('user:123', { name: 'Alice', age: 30 }, 60000); // Expires in 60 seconds
|
||||
|
||||
// Get value
|
||||
const user = await keyv.get('user:123');
|
||||
console.log(user); // { name: 'Alice', age: 30 }
|
||||
|
||||
// Check if key exists
|
||||
const exists = await keyv.has('user:123');
|
||||
|
||||
// Delete key
|
||||
await keyv.delete('user:123');
|
||||
|
||||
// Clear all keys
|
||||
await keyv.clear();
|
||||
```
|
||||
|
||||
## With Custom Options
|
||||
|
||||
```typescript
|
||||
import { createKeyv } from '@keyv/bigmap';
|
||||
|
||||
// Create with custom store size for better performance with millions of keys
|
||||
const keyv = createKeyv({ storeSize: 16 });
|
||||
|
||||
// With custom hash function
|
||||
const keyv = createKeyv({
|
||||
storeSize: 8,
|
||||
storeHashFunction: (key, storeSize) => {
|
||||
// Custom distribution logic
|
||||
return key.length % storeSize;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Type Safety
|
||||
|
||||
```typescript
|
||||
import { createKeyv } from '@keyv/bigmap';
|
||||
|
||||
interface Product {
|
||||
id: string;
|
||||
name: string;
|
||||
price: number;
|
||||
}
|
||||
|
||||
const keyv = createKeyv<string, Product>();
|
||||
|
||||
await keyv.set('product:1', {
|
||||
id: '1',
|
||||
name: 'Laptop',
|
||||
price: 999
|
||||
});
|
||||
|
||||
const product = await keyv.get<Product>('product:1');
|
||||
```
|
||||
|
||||
# Integration with Keyv Ecosystem
|
||||
|
||||
BigMap works seamlessly with the Keyv ecosystem:
|
||||
|
||||
```typescript
|
||||
import { createKeyv } from '@keyv/bigmap';
|
||||
|
||||
const cache = createKeyv({ storeSize: 16 });
|
||||
|
||||
// Use with namespaces
|
||||
const users = cache.namespace('users');
|
||||
const products = cache.namespace('products');
|
||||
|
||||
await users.set('123', { name: 'Alice' });
|
||||
await products.set('456', { name: 'Laptop' });
|
||||
|
||||
// Iterate over keys
|
||||
for await (const [key, value] of cache.iterator()) {
|
||||
console.log(key, value);
|
||||
}
|
||||
```
|
||||
|
||||
# API
|
||||
|
||||
## Constructor
|
||||
|
||||
`new BigMap<K, V>(options?)`
|
||||
|
||||
Creates a new BigMap instance.
|
||||
|
||||
**Parameters:**
|
||||
- `options` (optional): Configuration options
|
||||
- `storeSize` (number): Number of internal Map instances to use. Default: `4`. Must be at least 1.
|
||||
- `storeHashFunction` (StoreHashFunction): Custom hash function for key distribution. Default: `defaultHashFunction`
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
const bigMap = new BigMap<string, number>();
|
||||
const customBigMap = new BigMap<string, number>({
|
||||
storeSize: 10,
|
||||
storeHashFunction: (key, storeSize) => key.length % storeSize
|
||||
});
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Access | Description |
|
||||
|----------|------|--------|-------------|
|
||||
| `size` | `number` | Read-only | Gets the total number of entries in the BigMap. |
|
||||
| `storeSize` | `number` | Read/Write | Gets or sets the number of internal Map instances. **Note:** Setting this will clear all entries. Default: `4` |
|
||||
| `storeHashFunction` | `StoreHashFunction \| undefined` | Read/Write | Gets or sets the hash function used for key distribution. |
|
||||
| `store` | `Array<Map<K, V>>` | Read-only | Gets the internal array of Map instances. |
|
||||
|
||||
**Examples:**
|
||||
```typescript
|
||||
const bigMap = new BigMap<string, number>();
|
||||
|
||||
// size property
|
||||
bigMap.set('key1', 100);
|
||||
console.log(bigMap.size); // 1
|
||||
|
||||
// storeSize property
|
||||
console.log(bigMap.storeSize); // 4 (default)
|
||||
bigMap.storeSize = 8; // Changes size and clears all entries
|
||||
|
||||
// storeHashFunction property
|
||||
bigMap.storeHashFunction = (key, storeSize) => key.length % storeSize;
|
||||
|
||||
// store property
|
||||
console.log(bigMap.store.length); // 8
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
### set
|
||||
|
||||
Sets the value for a key in the map.
|
||||
|
||||
**Parameters:**
|
||||
- `key` (K): The key to set
|
||||
- `value` (V): The value to associate with the key
|
||||
|
||||
**Returns:** `Map<K, V>` - The internal Map instance where the key was stored
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
bigMap.set('user123', { name: 'Alice' });
|
||||
```
|
||||
|
||||
### get
|
||||
|
||||
Gets the value associated with a key.
|
||||
|
||||
**Parameters:**
|
||||
- `key` (K): The key to retrieve
|
||||
|
||||
**Returns:** `V | undefined` - The value, or undefined if not found
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
const value = bigMap.get('user123');
|
||||
```
|
||||
|
||||
### has
|
||||
|
||||
Checks if a key exists in the map.
|
||||
|
||||
**Parameters:**
|
||||
- `key` (K): The key to check
|
||||
|
||||
**Returns:** `boolean` - True if the key exists, false otherwise
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
if (bigMap.has('user123')) {
|
||||
console.log('User exists');
|
||||
}
|
||||
```
|
||||
|
||||
### delete
|
||||
|
||||
Deletes a key-value pair from the map.
|
||||
|
||||
**Parameters:**
|
||||
- `key` (K): The key to delete
|
||||
|
||||
**Returns:** `boolean` - True if the entry was deleted, false if the key was not found
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
const deleted = bigMap.delete('user123');
|
||||
```
|
||||
|
||||
### clear
|
||||
|
||||
Removes all entries from the map.
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
bigMap.clear();
|
||||
console.log(bigMap.size); // 0
|
||||
```
|
||||
|
||||
### forEach
|
||||
|
||||
Executes a provided function once for each key-value pair.
|
||||
|
||||
**Parameters:**
|
||||
- `callbackfn` (function): Function to execute for each entry
|
||||
- `value` (V): The value of the current entry
|
||||
- `key` (K): The key of the current entry
|
||||
- `map` (`Map<K, V>`): The BigMap instance
|
||||
- `thisArg` (optional): Value to use as `this` when executing the callback
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
bigMap.forEach((value, key) => {
|
||||
console.log(`${key}: ${value}`);
|
||||
});
|
||||
|
||||
// With custom context
|
||||
const context = { total: 0 };
|
||||
bigMap.forEach(function(value) {
|
||||
this.total += value;
|
||||
}, context);
|
||||
```
|
||||
|
||||
### keys
|
||||
|
||||
Returns an iterator of all keys in the map.
|
||||
|
||||
**Returns:** `IterableIterator<K>`
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
for (const key of bigMap.keys()) {
|
||||
console.log(key);
|
||||
}
|
||||
```
|
||||
|
||||
### values
|
||||
|
||||
Returns an iterator of all values in the map.
|
||||
|
||||
**Returns:** `IterableIterator<V>`
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
for (const value of bigMap.values()) {
|
||||
console.log(value);
|
||||
}
|
||||
```
|
||||
|
||||
### entries
|
||||
|
||||
Returns an iterator of all key-value pairs in the map.
|
||||
|
||||
**Returns:** `IterableIterator<[K, V]>`
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
for (const [key, value] of bigMap.entries()) {
|
||||
console.log(key, value);
|
||||
}
|
||||
```
|
||||
|
||||
### Symbol.iterator
|
||||
|
||||
Returns an iterator for the map (same as `entries()`). Enables `for...of` loops.
|
||||
|
||||
**Returns:** `IterableIterator<[K, V]>`
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
for (const [key, value] of bigMap) {
|
||||
console.log(key, value);
|
||||
}
|
||||
```
|
||||
|
||||
### getStore
|
||||
|
||||
Gets the internal Map instance for a specific key.
|
||||
|
||||
**Parameters:**
|
||||
- `key` (K): The key to find the store for
|
||||
|
||||
**Returns:** `Map<K, V>` - The internal Map instance
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
const store = bigMap.getStore('user123');
|
||||
```
|
||||
|
||||
### getStoreMap
|
||||
|
||||
Gets the internal Map instance at a specific index.
|
||||
|
||||
**Parameters:**
|
||||
- `index` (number): The index of the Map to retrieve (0 to storeSize - 1)
|
||||
|
||||
**Returns:** `Map<K, V>` - The Map at the specified index
|
||||
|
||||
**Throws:** Error if index is out of bounds
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
const firstMap = bigMap.getStoreMap(0);
|
||||
```
|
||||
|
||||
### initStore
|
||||
|
||||
Initializes the internal store with empty Map instances. Called automatically during construction.
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
## Types
|
||||
|
||||
### StoreHashFunction
|
||||
|
||||
Type definition for custom hash functions.
|
||||
|
||||
```typescript
|
||||
type StoreHashFunction = (key: string, storeSize: number) => number;
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
- `key` (string): The key to hash (converted to string)
|
||||
- `storeSize` (number): The number of stores (adjusted for zero-based index)
|
||||
|
||||
**Returns:** `number` - The index of the store to use (0 to storeSize - 1)
|
||||
|
||||
### defaultHashFunction
|
||||
|
||||
The default hash function using DJB2 algorithm from [Hashery](https://npmjs.com/package/hashery):
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
import { defaultHashFunction } from '@keyv/bigmap';
|
||||
|
||||
const index = defaultHashFunction('myKey', 4);
|
||||
```
|
||||
|
||||
### djb2Hash
|
||||
|
||||
DJB2 hash algorithm implementation.
|
||||
|
||||
**Parameters:**
|
||||
- `string` (string): The string to hash
|
||||
- `min` (number): Minimum value. Default: `0`
|
||||
- `max` (number): Maximum value. Default: `10`
|
||||
|
||||
**Returns:** `number` - Hash value within the specified range
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
import { djb2Hash } from '@keyv/bigmap';
|
||||
|
||||
const hash = djb2Hash('myKey', 0, 10);
|
||||
```
|
||||
|
||||
# Contributing
|
||||
|
||||
Please see our [contributing](https://github.com/jaredwray/keyv/blob/main/CONTRIBUTING.md) guide.
|
||||
|
||||
# License
|
||||
|
||||
[MIT © Jared Wray](LICENSE)
|
||||
268
node_modules/@keyv/bigmap/dist/index.cjs
generated
vendored
Normal file
268
node_modules/@keyv/bigmap/dist/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,268 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
BigMap: () => BigMap,
|
||||
Hashery: () => import_hashery2.Hashery,
|
||||
Keyv: () => import_keyv2.Keyv,
|
||||
createKeyv: () => createKeyv,
|
||||
defaultHashFunction: () => defaultHashFunction
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
var import_hashery = require("hashery");
|
||||
var import_hookified = require("hookified");
|
||||
var import_keyv = require("keyv");
|
||||
var import_hashery2 = require("hashery");
|
||||
var import_keyv2 = require("keyv");
|
||||
function defaultHashFunction(key, storeSize) {
|
||||
return new import_hashery.Hashery().toNumberSync(key, { min: 0, max: storeSize - 1 });
|
||||
}
|
||||
var BigMap = class extends import_hookified.Hookified {
|
||||
_storeSize = 4;
|
||||
_store = Array.from(
|
||||
{ length: this._storeSize },
|
||||
() => /* @__PURE__ */ new Map()
|
||||
);
|
||||
_storeHashFunction;
|
||||
/**
|
||||
* Creates an instance of BigMap.
|
||||
* @param {BigMapOptions<K, V>} [options] - Optional configuration options for the BigMap.
|
||||
*/
|
||||
constructor(options) {
|
||||
super(options);
|
||||
if (options?.storeSize !== void 0) {
|
||||
if (options.storeSize < 1) {
|
||||
throw new Error("Store size must be at least 1.");
|
||||
}
|
||||
this.storeSize = options.storeSize;
|
||||
}
|
||||
this.initStore();
|
||||
this._storeHashFunction = options?.storeHashFunction ?? defaultHashFunction;
|
||||
}
|
||||
/**
|
||||
* Gets the number of maps in the store.
|
||||
* @returns {number} The number of maps in the store.
|
||||
*/
|
||||
get storeSize() {
|
||||
return this._storeSize;
|
||||
}
|
||||
/**
|
||||
* Sets the number of maps in the store. If the size is less than 1, an error is thrown.
|
||||
* If you change the store size it will clear all entries.
|
||||
* @param {number} size - The new size of the store.
|
||||
* @throws {Error} If the size is less than 1.
|
||||
*/
|
||||
set storeSize(size) {
|
||||
if (size < 1) {
|
||||
throw new Error("Store size must be at least 1.");
|
||||
}
|
||||
this._storeSize = size;
|
||||
this.clear();
|
||||
this.initStore();
|
||||
}
|
||||
/**
|
||||
* Gets the hash function used for storing keys.
|
||||
* @returns {StoreHashFunction | undefined} The hash function used for storing keys, or undefined if not set.
|
||||
*/
|
||||
get storeHashFunction() {
|
||||
return this._storeHashFunction;
|
||||
}
|
||||
/**
|
||||
* Sets the hash function used for storing keys.
|
||||
* @param {StoreHashFunction} hashFunction - The hash function to use for storing keys.
|
||||
*/
|
||||
set storeHashFunction(hashFunction) {
|
||||
this._storeHashFunction = hashFunction ?? defaultHashFunction;
|
||||
}
|
||||
/**
|
||||
* Gets the store, which is an array of maps.
|
||||
* @returns {Array<Map<K, V>>} The array of maps in the store.
|
||||
*/
|
||||
get store() {
|
||||
return this._store;
|
||||
}
|
||||
/**
|
||||
* Gets the map at the specified index in the store.
|
||||
* @param {number} index - The index of the map to retrieve.
|
||||
* @returns {Map<K, V>} The map at the specified index.
|
||||
*/
|
||||
getStoreMap(index) {
|
||||
if (index < 0 || index >= this._storeSize) {
|
||||
throw new Error(
|
||||
`Index out of bounds: ${index}. Valid range is 0 to ${this._storeSize - 1}.`
|
||||
);
|
||||
}
|
||||
return this._store[index];
|
||||
}
|
||||
/**
|
||||
* Initializes the store with empty maps.
|
||||
* This method is called when the BigMap instance is created.
|
||||
*/
|
||||
initStore() {
|
||||
this._store = Array.from(
|
||||
{ length: this._storeSize },
|
||||
() => /* @__PURE__ */ new Map()
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Gets the store for a specific key.
|
||||
* The store is determined by applying the hash function to the key and the store size.
|
||||
* If the hash function is not set, it defaults to using the default hash function.
|
||||
* @param key - The key for which to get the store.
|
||||
* @returns The store for the specified key.
|
||||
*/
|
||||
getStore(key) {
|
||||
if (this._storeSize === 1) {
|
||||
return this.getStoreMap(0);
|
||||
}
|
||||
const storeSize = this._storeSize - 1;
|
||||
const index = this._storeHashFunction ? this._storeHashFunction(String(key), storeSize) : defaultHashFunction(String(key), storeSize);
|
||||
return this.getStoreMap(index);
|
||||
}
|
||||
/**
|
||||
* Returns an iterable of key-value pairs in the map.
|
||||
* @returns {IterableIterator<[K, V]>} An iterable of key-value pairs in the map.
|
||||
*/
|
||||
entries() {
|
||||
const entries = [];
|
||||
for (const store of this._store) {
|
||||
store.forEach((value, key) => entries.push([key, value]));
|
||||
}
|
||||
return entries[Symbol.iterator]();
|
||||
}
|
||||
/**
|
||||
* Returns an iterable of keys in the map.
|
||||
* @returns {IterableIterator<K>} An iterable of keys in the map.
|
||||
*/
|
||||
keys() {
|
||||
const keys = [];
|
||||
for (const store of this._store) {
|
||||
store.forEach((_, key) => keys.push(key));
|
||||
}
|
||||
return keys[Symbol.iterator]();
|
||||
}
|
||||
/**
|
||||
* Returns an iterable of values in the map.
|
||||
* @returns {IterableIterator<V>} An iterable of values in the map.
|
||||
*/
|
||||
values() {
|
||||
const values = [];
|
||||
for (const store of this._store) {
|
||||
store.forEach((value) => values.push(value));
|
||||
}
|
||||
return values[Symbol.iterator]();
|
||||
}
|
||||
/**
|
||||
* Returns an iterator that iterates over the key-value pairs in the map.
|
||||
* @returns {IterableIterator<[K, V]>} An iterator that iterates over the key-value pairs in the map.
|
||||
*/
|
||||
[Symbol.iterator]() {
|
||||
const entries = [];
|
||||
for (const store of this._store) {
|
||||
store.forEach((value, key) => entries.push([key, value]));
|
||||
}
|
||||
return entries[Symbol.iterator]();
|
||||
}
|
||||
/**
|
||||
* Clears all entries in the map.
|
||||
* @returns {void} This method does not return a value.
|
||||
*/
|
||||
clear() {
|
||||
for (const store of this._store) {
|
||||
store.clear();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Deletes a key-value pair from the map.
|
||||
* @param {K} key - The key of the entry to delete.
|
||||
* @returns {boolean} Returns true if the entry was deleted, false if the key was not found.
|
||||
*/
|
||||
delete(key) {
|
||||
const store = this.getStore(key);
|
||||
const deleted = store.delete(key);
|
||||
return deleted;
|
||||
}
|
||||
/**
|
||||
* Calls a provided callback function once for each key-value pair in the map.
|
||||
* @param {function} callbackfn - The function to execute for each key-value pair.
|
||||
* @param {any} [thisArg] - An optional value to use as `this` when executing the callback.
|
||||
*/
|
||||
forEach(callbackfn, thisArg) {
|
||||
this._store.forEach((store) => {
|
||||
store.forEach((value, key) => {
|
||||
callbackfn.call(thisArg, value, key, this);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Gets the value associated with the specified key.
|
||||
* @param {K} key - The key of the entry to get.
|
||||
* @returns {V | undefined} The value associated with the key, or undefined if the key does not exist.
|
||||
*/
|
||||
get(key) {
|
||||
const store = this.getStore(key);
|
||||
return store.get(key);
|
||||
}
|
||||
/**
|
||||
* Checks if the map contains a key.
|
||||
* @param {K} key - The key to check for existence.
|
||||
* @returns {boolean} Returns true if the key exists, false otherwise.
|
||||
*/
|
||||
has(key) {
|
||||
const store = this.getStore(key);
|
||||
return store.has(key);
|
||||
}
|
||||
/**
|
||||
* Sets the value for a key in the map.
|
||||
* @param {K} key - The key of the entry to set.
|
||||
* @param {V} value - The value to set for the entry.
|
||||
* @returns {Map<K, V>} The map instance.
|
||||
*/
|
||||
set(key, value) {
|
||||
const store = this.getStore(key);
|
||||
store.set(key, value);
|
||||
return store;
|
||||
}
|
||||
/**
|
||||
* Gets the number of entries in the map.
|
||||
* @returns {number} The number of entries in the map.
|
||||
*/
|
||||
get size() {
|
||||
let size = 0;
|
||||
for (const store of this._store) {
|
||||
size += store.size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
};
|
||||
function createKeyv(options) {
|
||||
const adapter = new BigMap(options);
|
||||
const keyv = new import_keyv.Keyv({ store: adapter });
|
||||
return keyv;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BigMap,
|
||||
Hashery,
|
||||
Keyv,
|
||||
createKeyv,
|
||||
defaultHashFunction
|
||||
});
|
||||
157
node_modules/@keyv/bigmap/dist/index.d.cts
generated
vendored
Normal file
157
node_modules/@keyv/bigmap/dist/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
import { HookifiedOptions, Hookified } from 'hookified';
|
||||
import { Keyv } from 'keyv';
|
||||
export { Keyv } from 'keyv';
|
||||
export { Hashery } from 'hashery';
|
||||
|
||||
type MapInterfacee<K, V> = {
|
||||
readonly size: number;
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
forEach(callbackfn: (value: V, key: K, map: MapInterfacee<K, V>) => void, thisArg?: any): void;
|
||||
entries(): IterableIterator<[K, V]>;
|
||||
keys(): IterableIterator<K>;
|
||||
values(): IterableIterator<V>;
|
||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value: V): Map<K, V>;
|
||||
};
|
||||
type StoreHashFunction = (key: string, storeSize: number) => number;
|
||||
declare function defaultHashFunction(key: string, storeSize: number): number;
|
||||
type BigMapOptions = {
|
||||
/**
|
||||
* Optional size of the store. The default is 4 maps objects.
|
||||
* @default 4
|
||||
*/
|
||||
storeSize?: number;
|
||||
/**
|
||||
* Optional hash function to use for storing keys.
|
||||
* @default undefined
|
||||
*/
|
||||
storeHashFunction?: StoreHashFunction;
|
||||
} & HookifiedOptions;
|
||||
declare class BigMap<K, V> extends Hookified implements MapInterfacee<K, V> {
|
||||
private _storeSize;
|
||||
private _store;
|
||||
private _storeHashFunction?;
|
||||
/**
|
||||
* Creates an instance of BigMap.
|
||||
* @param {BigMapOptions<K, V>} [options] - Optional configuration options for the BigMap.
|
||||
*/
|
||||
constructor(options?: BigMapOptions);
|
||||
/**
|
||||
* Gets the number of maps in the store.
|
||||
* @returns {number} The number of maps in the store.
|
||||
*/
|
||||
get storeSize(): number;
|
||||
/**
|
||||
* Sets the number of maps in the store. If the size is less than 1, an error is thrown.
|
||||
* If you change the store size it will clear all entries.
|
||||
* @param {number} size - The new size of the store.
|
||||
* @throws {Error} If the size is less than 1.
|
||||
*/
|
||||
set storeSize(size: number);
|
||||
/**
|
||||
* Gets the hash function used for storing keys.
|
||||
* @returns {StoreHashFunction | undefined} The hash function used for storing keys, or undefined if not set.
|
||||
*/
|
||||
get storeHashFunction(): StoreHashFunction | undefined;
|
||||
/**
|
||||
* Sets the hash function used for storing keys.
|
||||
* @param {StoreHashFunction} hashFunction - The hash function to use for storing keys.
|
||||
*/
|
||||
set storeHashFunction(hashFunction: StoreHashFunction | undefined);
|
||||
/**
|
||||
* Gets the store, which is an array of maps.
|
||||
* @returns {Array<Map<K, V>>} The array of maps in the store.
|
||||
*/
|
||||
get store(): Array<Map<K, V>>;
|
||||
/**
|
||||
* Gets the map at the specified index in the store.
|
||||
* @param {number} index - The index of the map to retrieve.
|
||||
* @returns {Map<K, V>} The map at the specified index.
|
||||
*/
|
||||
getStoreMap(index: number): Map<K, V>;
|
||||
/**
|
||||
* Initializes the store with empty maps.
|
||||
* This method is called when the BigMap instance is created.
|
||||
*/
|
||||
initStore(): void;
|
||||
/**
|
||||
* Gets the store for a specific key.
|
||||
* The store is determined by applying the hash function to the key and the store size.
|
||||
* If the hash function is not set, it defaults to using the default hash function.
|
||||
* @param key - The key for which to get the store.
|
||||
* @returns The store for the specified key.
|
||||
*/
|
||||
getStore(key: K): Map<K, V>;
|
||||
/**
|
||||
* Returns an iterable of key-value pairs in the map.
|
||||
* @returns {IterableIterator<[K, V]>} An iterable of key-value pairs in the map.
|
||||
*/
|
||||
entries(): IterableIterator<[K, V]>;
|
||||
/**
|
||||
* Returns an iterable of keys in the map.
|
||||
* @returns {IterableIterator<K>} An iterable of keys in the map.
|
||||
*/
|
||||
keys(): IterableIterator<K>;
|
||||
/**
|
||||
* Returns an iterable of values in the map.
|
||||
* @returns {IterableIterator<V>} An iterable of values in the map.
|
||||
*/
|
||||
values(): IterableIterator<V>;
|
||||
/**
|
||||
* Returns an iterator that iterates over the key-value pairs in the map.
|
||||
* @returns {IterableIterator<[K, V]>} An iterator that iterates over the key-value pairs in the map.
|
||||
*/
|
||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||
/**
|
||||
* Clears all entries in the map.
|
||||
* @returns {void} This method does not return a value.
|
||||
*/
|
||||
clear(): void;
|
||||
/**
|
||||
* Deletes a key-value pair from the map.
|
||||
* @param {K} key - The key of the entry to delete.
|
||||
* @returns {boolean} Returns true if the entry was deleted, false if the key was not found.
|
||||
*/
|
||||
delete(key: K): boolean;
|
||||
/**
|
||||
* Calls a provided callback function once for each key-value pair in the map.
|
||||
* @param {function} callbackfn - The function to execute for each key-value pair.
|
||||
* @param {any} [thisArg] - An optional value to use as `this` when executing the callback.
|
||||
*/
|
||||
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
|
||||
/**
|
||||
* Gets the value associated with the specified key.
|
||||
* @param {K} key - The key of the entry to get.
|
||||
* @returns {V | undefined} The value associated with the key, or undefined if the key does not exist.
|
||||
*/
|
||||
get(key: K): V | undefined;
|
||||
/**
|
||||
* Checks if the map contains a key.
|
||||
* @param {K} key - The key to check for existence.
|
||||
* @returns {boolean} Returns true if the key exists, false otherwise.
|
||||
*/
|
||||
has(key: K): boolean;
|
||||
/**
|
||||
* Sets the value for a key in the map.
|
||||
* @param {K} key - The key of the entry to set.
|
||||
* @param {V} value - The value to set for the entry.
|
||||
* @returns {Map<K, V>} The map instance.
|
||||
*/
|
||||
set(key: K, value: V): Map<K, V>;
|
||||
/**
|
||||
* Gets the number of entries in the map.
|
||||
* @returns {number} The number of entries in the map.
|
||||
*/
|
||||
get size(): number;
|
||||
}
|
||||
/**
|
||||
* Will create a Keyv instance with the BigMap adapter. This will also set the namespace and useKeyPrefix to false.
|
||||
* @param {BigMapOptions} options - Options for the BigMap adapter such as storeSize and storeHashFunction.
|
||||
* @returns {Keyv} - Keyv instance with the BigMap adapter
|
||||
*/
|
||||
declare function createKeyv<K = string, V = unknown>(options?: BigMapOptions): Keyv;
|
||||
|
||||
export { BigMap, type BigMapOptions, type MapInterfacee, type StoreHashFunction, createKeyv, defaultHashFunction };
|
||||
157
node_modules/@keyv/bigmap/dist/index.d.ts
generated
vendored
Normal file
157
node_modules/@keyv/bigmap/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
import { HookifiedOptions, Hookified } from 'hookified';
|
||||
import { Keyv } from 'keyv';
|
||||
export { Keyv } from 'keyv';
|
||||
export { Hashery } from 'hashery';
|
||||
|
||||
type MapInterfacee<K, V> = {
|
||||
readonly size: number;
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
forEach(callbackfn: (value: V, key: K, map: MapInterfacee<K, V>) => void, thisArg?: any): void;
|
||||
entries(): IterableIterator<[K, V]>;
|
||||
keys(): IterableIterator<K>;
|
||||
values(): IterableIterator<V>;
|
||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value: V): Map<K, V>;
|
||||
};
|
||||
type StoreHashFunction = (key: string, storeSize: number) => number;
|
||||
declare function defaultHashFunction(key: string, storeSize: number): number;
|
||||
type BigMapOptions = {
|
||||
/**
|
||||
* Optional size of the store. The default is 4 maps objects.
|
||||
* @default 4
|
||||
*/
|
||||
storeSize?: number;
|
||||
/**
|
||||
* Optional hash function to use for storing keys.
|
||||
* @default undefined
|
||||
*/
|
||||
storeHashFunction?: StoreHashFunction;
|
||||
} & HookifiedOptions;
|
||||
declare class BigMap<K, V> extends Hookified implements MapInterfacee<K, V> {
|
||||
private _storeSize;
|
||||
private _store;
|
||||
private _storeHashFunction?;
|
||||
/**
|
||||
* Creates an instance of BigMap.
|
||||
* @param {BigMapOptions<K, V>} [options] - Optional configuration options for the BigMap.
|
||||
*/
|
||||
constructor(options?: BigMapOptions);
|
||||
/**
|
||||
* Gets the number of maps in the store.
|
||||
* @returns {number} The number of maps in the store.
|
||||
*/
|
||||
get storeSize(): number;
|
||||
/**
|
||||
* Sets the number of maps in the store. If the size is less than 1, an error is thrown.
|
||||
* If you change the store size it will clear all entries.
|
||||
* @param {number} size - The new size of the store.
|
||||
* @throws {Error} If the size is less than 1.
|
||||
*/
|
||||
set storeSize(size: number);
|
||||
/**
|
||||
* Gets the hash function used for storing keys.
|
||||
* @returns {StoreHashFunction | undefined} The hash function used for storing keys, or undefined if not set.
|
||||
*/
|
||||
get storeHashFunction(): StoreHashFunction | undefined;
|
||||
/**
|
||||
* Sets the hash function used for storing keys.
|
||||
* @param {StoreHashFunction} hashFunction - The hash function to use for storing keys.
|
||||
*/
|
||||
set storeHashFunction(hashFunction: StoreHashFunction | undefined);
|
||||
/**
|
||||
* Gets the store, which is an array of maps.
|
||||
* @returns {Array<Map<K, V>>} The array of maps in the store.
|
||||
*/
|
||||
get store(): Array<Map<K, V>>;
|
||||
/**
|
||||
* Gets the map at the specified index in the store.
|
||||
* @param {number} index - The index of the map to retrieve.
|
||||
* @returns {Map<K, V>} The map at the specified index.
|
||||
*/
|
||||
getStoreMap(index: number): Map<K, V>;
|
||||
/**
|
||||
* Initializes the store with empty maps.
|
||||
* This method is called when the BigMap instance is created.
|
||||
*/
|
||||
initStore(): void;
|
||||
/**
|
||||
* Gets the store for a specific key.
|
||||
* The store is determined by applying the hash function to the key and the store size.
|
||||
* If the hash function is not set, it defaults to using the default hash function.
|
||||
* @param key - The key for which to get the store.
|
||||
* @returns The store for the specified key.
|
||||
*/
|
||||
getStore(key: K): Map<K, V>;
|
||||
/**
|
||||
* Returns an iterable of key-value pairs in the map.
|
||||
* @returns {IterableIterator<[K, V]>} An iterable of key-value pairs in the map.
|
||||
*/
|
||||
entries(): IterableIterator<[K, V]>;
|
||||
/**
|
||||
* Returns an iterable of keys in the map.
|
||||
* @returns {IterableIterator<K>} An iterable of keys in the map.
|
||||
*/
|
||||
keys(): IterableIterator<K>;
|
||||
/**
|
||||
* Returns an iterable of values in the map.
|
||||
* @returns {IterableIterator<V>} An iterable of values in the map.
|
||||
*/
|
||||
values(): IterableIterator<V>;
|
||||
/**
|
||||
* Returns an iterator that iterates over the key-value pairs in the map.
|
||||
* @returns {IterableIterator<[K, V]>} An iterator that iterates over the key-value pairs in the map.
|
||||
*/
|
||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||
/**
|
||||
* Clears all entries in the map.
|
||||
* @returns {void} This method does not return a value.
|
||||
*/
|
||||
clear(): void;
|
||||
/**
|
||||
* Deletes a key-value pair from the map.
|
||||
* @param {K} key - The key of the entry to delete.
|
||||
* @returns {boolean} Returns true if the entry was deleted, false if the key was not found.
|
||||
*/
|
||||
delete(key: K): boolean;
|
||||
/**
|
||||
* Calls a provided callback function once for each key-value pair in the map.
|
||||
* @param {function} callbackfn - The function to execute for each key-value pair.
|
||||
* @param {any} [thisArg] - An optional value to use as `this` when executing the callback.
|
||||
*/
|
||||
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
|
||||
/**
|
||||
* Gets the value associated with the specified key.
|
||||
* @param {K} key - The key of the entry to get.
|
||||
* @returns {V | undefined} The value associated with the key, or undefined if the key does not exist.
|
||||
*/
|
||||
get(key: K): V | undefined;
|
||||
/**
|
||||
* Checks if the map contains a key.
|
||||
* @param {K} key - The key to check for existence.
|
||||
* @returns {boolean} Returns true if the key exists, false otherwise.
|
||||
*/
|
||||
has(key: K): boolean;
|
||||
/**
|
||||
* Sets the value for a key in the map.
|
||||
* @param {K} key - The key of the entry to set.
|
||||
* @param {V} value - The value to set for the entry.
|
||||
* @returns {Map<K, V>} The map instance.
|
||||
*/
|
||||
set(key: K, value: V): Map<K, V>;
|
||||
/**
|
||||
* Gets the number of entries in the map.
|
||||
* @returns {number} The number of entries in the map.
|
||||
*/
|
||||
get size(): number;
|
||||
}
|
||||
/**
|
||||
* Will create a Keyv instance with the BigMap adapter. This will also set the namespace and useKeyPrefix to false.
|
||||
* @param {BigMapOptions} options - Options for the BigMap adapter such as storeSize and storeHashFunction.
|
||||
* @returns {Keyv} - Keyv instance with the BigMap adapter
|
||||
*/
|
||||
declare function createKeyv<K = string, V = unknown>(options?: BigMapOptions): Keyv;
|
||||
|
||||
export { BigMap, type BigMapOptions, type MapInterfacee, type StoreHashFunction, createKeyv, defaultHashFunction };
|
||||
239
node_modules/@keyv/bigmap/dist/index.js
generated
vendored
Normal file
239
node_modules/@keyv/bigmap/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
// src/index.ts
|
||||
import { Hashery } from "hashery";
|
||||
import { Hookified } from "hookified";
|
||||
import { Keyv } from "keyv";
|
||||
import { Hashery as Hashery2 } from "hashery";
|
||||
import { Keyv as Keyv2 } from "keyv";
|
||||
function defaultHashFunction(key, storeSize) {
|
||||
return new Hashery().toNumberSync(key, { min: 0, max: storeSize - 1 });
|
||||
}
|
||||
var BigMap = class extends Hookified {
|
||||
_storeSize = 4;
|
||||
_store = Array.from(
|
||||
{ length: this._storeSize },
|
||||
() => /* @__PURE__ */ new Map()
|
||||
);
|
||||
_storeHashFunction;
|
||||
/**
|
||||
* Creates an instance of BigMap.
|
||||
* @param {BigMapOptions<K, V>} [options] - Optional configuration options for the BigMap.
|
||||
*/
|
||||
constructor(options) {
|
||||
super(options);
|
||||
if (options?.storeSize !== void 0) {
|
||||
if (options.storeSize < 1) {
|
||||
throw new Error("Store size must be at least 1.");
|
||||
}
|
||||
this.storeSize = options.storeSize;
|
||||
}
|
||||
this.initStore();
|
||||
this._storeHashFunction = options?.storeHashFunction ?? defaultHashFunction;
|
||||
}
|
||||
/**
|
||||
* Gets the number of maps in the store.
|
||||
* @returns {number} The number of maps in the store.
|
||||
*/
|
||||
get storeSize() {
|
||||
return this._storeSize;
|
||||
}
|
||||
/**
|
||||
* Sets the number of maps in the store. If the size is less than 1, an error is thrown.
|
||||
* If you change the store size it will clear all entries.
|
||||
* @param {number} size - The new size of the store.
|
||||
* @throws {Error} If the size is less than 1.
|
||||
*/
|
||||
set storeSize(size) {
|
||||
if (size < 1) {
|
||||
throw new Error("Store size must be at least 1.");
|
||||
}
|
||||
this._storeSize = size;
|
||||
this.clear();
|
||||
this.initStore();
|
||||
}
|
||||
/**
|
||||
* Gets the hash function used for storing keys.
|
||||
* @returns {StoreHashFunction | undefined} The hash function used for storing keys, or undefined if not set.
|
||||
*/
|
||||
get storeHashFunction() {
|
||||
return this._storeHashFunction;
|
||||
}
|
||||
/**
|
||||
* Sets the hash function used for storing keys.
|
||||
* @param {StoreHashFunction} hashFunction - The hash function to use for storing keys.
|
||||
*/
|
||||
set storeHashFunction(hashFunction) {
|
||||
this._storeHashFunction = hashFunction ?? defaultHashFunction;
|
||||
}
|
||||
/**
|
||||
* Gets the store, which is an array of maps.
|
||||
* @returns {Array<Map<K, V>>} The array of maps in the store.
|
||||
*/
|
||||
get store() {
|
||||
return this._store;
|
||||
}
|
||||
/**
|
||||
* Gets the map at the specified index in the store.
|
||||
* @param {number} index - The index of the map to retrieve.
|
||||
* @returns {Map<K, V>} The map at the specified index.
|
||||
*/
|
||||
getStoreMap(index) {
|
||||
if (index < 0 || index >= this._storeSize) {
|
||||
throw new Error(
|
||||
`Index out of bounds: ${index}. Valid range is 0 to ${this._storeSize - 1}.`
|
||||
);
|
||||
}
|
||||
return this._store[index];
|
||||
}
|
||||
/**
|
||||
* Initializes the store with empty maps.
|
||||
* This method is called when the BigMap instance is created.
|
||||
*/
|
||||
initStore() {
|
||||
this._store = Array.from(
|
||||
{ length: this._storeSize },
|
||||
() => /* @__PURE__ */ new Map()
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Gets the store for a specific key.
|
||||
* The store is determined by applying the hash function to the key and the store size.
|
||||
* If the hash function is not set, it defaults to using the default hash function.
|
||||
* @param key - The key for which to get the store.
|
||||
* @returns The store for the specified key.
|
||||
*/
|
||||
getStore(key) {
|
||||
if (this._storeSize === 1) {
|
||||
return this.getStoreMap(0);
|
||||
}
|
||||
const storeSize = this._storeSize - 1;
|
||||
const index = this._storeHashFunction ? this._storeHashFunction(String(key), storeSize) : defaultHashFunction(String(key), storeSize);
|
||||
return this.getStoreMap(index);
|
||||
}
|
||||
/**
|
||||
* Returns an iterable of key-value pairs in the map.
|
||||
* @returns {IterableIterator<[K, V]>} An iterable of key-value pairs in the map.
|
||||
*/
|
||||
entries() {
|
||||
const entries = [];
|
||||
for (const store of this._store) {
|
||||
store.forEach((value, key) => entries.push([key, value]));
|
||||
}
|
||||
return entries[Symbol.iterator]();
|
||||
}
|
||||
/**
|
||||
* Returns an iterable of keys in the map.
|
||||
* @returns {IterableIterator<K>} An iterable of keys in the map.
|
||||
*/
|
||||
keys() {
|
||||
const keys = [];
|
||||
for (const store of this._store) {
|
||||
store.forEach((_, key) => keys.push(key));
|
||||
}
|
||||
return keys[Symbol.iterator]();
|
||||
}
|
||||
/**
|
||||
* Returns an iterable of values in the map.
|
||||
* @returns {IterableIterator<V>} An iterable of values in the map.
|
||||
*/
|
||||
values() {
|
||||
const values = [];
|
||||
for (const store of this._store) {
|
||||
store.forEach((value) => values.push(value));
|
||||
}
|
||||
return values[Symbol.iterator]();
|
||||
}
|
||||
/**
|
||||
* Returns an iterator that iterates over the key-value pairs in the map.
|
||||
* @returns {IterableIterator<[K, V]>} An iterator that iterates over the key-value pairs in the map.
|
||||
*/
|
||||
[Symbol.iterator]() {
|
||||
const entries = [];
|
||||
for (const store of this._store) {
|
||||
store.forEach((value, key) => entries.push([key, value]));
|
||||
}
|
||||
return entries[Symbol.iterator]();
|
||||
}
|
||||
/**
|
||||
* Clears all entries in the map.
|
||||
* @returns {void} This method does not return a value.
|
||||
*/
|
||||
clear() {
|
||||
for (const store of this._store) {
|
||||
store.clear();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Deletes a key-value pair from the map.
|
||||
* @param {K} key - The key of the entry to delete.
|
||||
* @returns {boolean} Returns true if the entry was deleted, false if the key was not found.
|
||||
*/
|
||||
delete(key) {
|
||||
const store = this.getStore(key);
|
||||
const deleted = store.delete(key);
|
||||
return deleted;
|
||||
}
|
||||
/**
|
||||
* Calls a provided callback function once for each key-value pair in the map.
|
||||
* @param {function} callbackfn - The function to execute for each key-value pair.
|
||||
* @param {any} [thisArg] - An optional value to use as `this` when executing the callback.
|
||||
*/
|
||||
forEach(callbackfn, thisArg) {
|
||||
this._store.forEach((store) => {
|
||||
store.forEach((value, key) => {
|
||||
callbackfn.call(thisArg, value, key, this);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Gets the value associated with the specified key.
|
||||
* @param {K} key - The key of the entry to get.
|
||||
* @returns {V | undefined} The value associated with the key, or undefined if the key does not exist.
|
||||
*/
|
||||
get(key) {
|
||||
const store = this.getStore(key);
|
||||
return store.get(key);
|
||||
}
|
||||
/**
|
||||
* Checks if the map contains a key.
|
||||
* @param {K} key - The key to check for existence.
|
||||
* @returns {boolean} Returns true if the key exists, false otherwise.
|
||||
*/
|
||||
has(key) {
|
||||
const store = this.getStore(key);
|
||||
return store.has(key);
|
||||
}
|
||||
/**
|
||||
* Sets the value for a key in the map.
|
||||
* @param {K} key - The key of the entry to set.
|
||||
* @param {V} value - The value to set for the entry.
|
||||
* @returns {Map<K, V>} The map instance.
|
||||
*/
|
||||
set(key, value) {
|
||||
const store = this.getStore(key);
|
||||
store.set(key, value);
|
||||
return store;
|
||||
}
|
||||
/**
|
||||
* Gets the number of entries in the map.
|
||||
* @returns {number} The number of entries in the map.
|
||||
*/
|
||||
get size() {
|
||||
let size = 0;
|
||||
for (const store of this._store) {
|
||||
size += store.size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
};
|
||||
function createKeyv(options) {
|
||||
const adapter = new BigMap(options);
|
||||
const keyv = new Keyv({ store: adapter });
|
||||
return keyv;
|
||||
}
|
||||
export {
|
||||
BigMap,
|
||||
Hashery2 as Hashery,
|
||||
Keyv2 as Keyv,
|
||||
createKeyv,
|
||||
defaultHashFunction
|
||||
};
|
||||
73
node_modules/@keyv/bigmap/package.json
generated
vendored
Normal file
73
node_modules/@keyv/bigmap/package.json
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"name": "@keyv/bigmap",
|
||||
"version": "1.3.1",
|
||||
"description": "Bigmap for Keyv",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": {
|
||||
"types": "./dist/index.d.cts",
|
||||
"default": "./dist/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jaredwray/keyv.git"
|
||||
},
|
||||
"keywords": [
|
||||
"bigmap",
|
||||
"keyv",
|
||||
"key",
|
||||
"value",
|
||||
"store",
|
||||
"cache",
|
||||
"ttl"
|
||||
],
|
||||
"author": "Jared Wray <me@jaredwray.com> (http://jaredwray.com)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jaredwray/keyv/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jaredwray/keyv",
|
||||
"dependencies": {
|
||||
"hashery": "^1.4.0",
|
||||
"hookified": "^1.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^2.3.11",
|
||||
"@faker-js/faker": "^10.2.0",
|
||||
"@vitest/coverage-v8": "^4.0.17",
|
||||
"rimraf": "^6.1.2",
|
||||
"tsd": "^0.33.0",
|
||||
"vitest": "^4.0.17"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"keyv": "^5.6.0"
|
||||
},
|
||||
"tsd": {
|
||||
"directory": "test"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"LICENSE"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "rimraf ./dist && tsup src/index.ts --format cjs,esm --dts --clean",
|
||||
"lint": "biome check --write --error-on-warnings",
|
||||
"lint:ci": "biome check --error-on-warnings",
|
||||
"test": "pnpm lint && vitest run --coverage",
|
||||
"test:ci": "pnpm lint:ci && vitest --run --sequence.setupFiles=list --coverage",
|
||||
"clean": "rimraf ./node_modules ./coverage ./dist"
|
||||
}
|
||||
}
|
||||
22
node_modules/@keyv/serialize/LICENSE
generated
vendored
Normal file
22
node_modules/@keyv/serialize/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017-2021 Luke Childs
|
||||
Copyright (c) 2021-2022 Jared Wray
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
15
node_modules/@keyv/serialize/README.md
generated
vendored
Normal file
15
node_modules/@keyv/serialize/README.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# @keyv/serialize [<img width="100" align="right" src="https://jaredwray.com/images/keyv-symbol.svg" alt="keyv">](https://github.com/jaredwra/keyv)
|
||||
|
||||
> Serialization functionality for [Keyv](https://github.com/jaredwray/keyv)
|
||||
|
||||
|
||||
[](https://github.com/jaredwray/keyv/actions/workflows/tests.yaml)
|
||||
[](https://codecov.io/gh/jaredwray/keyv)
|
||||
[](https://github.com/jaredwray/keyv/blob/main/LICENSE)
|
||||
[](https://npmjs.com/package/@keyv/serialize)
|
||||
|
||||
This is the serialization functionality for [Keyv](https://github.com/jaredwray/keyv/tree/main/packages/keyv). It is used to serialize and deserialize data for storage and retrieval. You can also create your own [custom serialization functions](https://github.com/jaredwray/keyv/tree/main/packages/keyv#custom-serializers).
|
||||
|
||||
## License
|
||||
|
||||
[MIT © Jared Wray](LISCENCE)
|
||||
84
node_modules/@keyv/serialize/dist/index.cjs
generated
vendored
Normal file
84
node_modules/@keyv/serialize/dist/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
defaultDeserialize: () => defaultDeserialize,
|
||||
defaultSerialize: () => defaultSerialize
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
var import_node_buffer = require("buffer");
|
||||
var _serialize = (data, escapeColonStrings = true) => {
|
||||
if (data === void 0 || data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (typeof data === "string") {
|
||||
return JSON.stringify(
|
||||
escapeColonStrings && data.startsWith(":") ? `:${data}` : data
|
||||
);
|
||||
}
|
||||
if (import_node_buffer.Buffer.isBuffer(data)) {
|
||||
return JSON.stringify(`:base64:${data.toString("base64")}`);
|
||||
}
|
||||
if (data?.toJSON) {
|
||||
data = data.toJSON();
|
||||
}
|
||||
if (typeof data === "object") {
|
||||
let s = "";
|
||||
const array = Array.isArray(data);
|
||||
s = array ? "[" : "{";
|
||||
let first = true;
|
||||
for (const k in data) {
|
||||
const ignore = typeof data[k] === "function" || !array && data[k] === void 0;
|
||||
if (!Object.hasOwn(data, k) || ignore) {
|
||||
continue;
|
||||
}
|
||||
if (!first) {
|
||||
s += ",";
|
||||
}
|
||||
first = false;
|
||||
if (array) {
|
||||
s += _serialize(data[k], escapeColonStrings);
|
||||
} else if (data[k] !== void 0) {
|
||||
s += `${_serialize(k, false)}:${_serialize(data[k], escapeColonStrings)}`;
|
||||
}
|
||||
}
|
||||
s += array ? "]" : "}";
|
||||
return s;
|
||||
}
|
||||
return JSON.stringify(data);
|
||||
};
|
||||
var defaultSerialize = (data) => {
|
||||
return _serialize(data, true);
|
||||
};
|
||||
var defaultDeserialize = (data) => JSON.parse(data, (_, value) => {
|
||||
if (typeof value === "string") {
|
||||
if (value.startsWith(":base64:")) {
|
||||
return import_node_buffer.Buffer.from(value.slice(8), "base64");
|
||||
}
|
||||
return value.startsWith(":") ? value.slice(1) : value;
|
||||
}
|
||||
return value;
|
||||
});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
defaultDeserialize,
|
||||
defaultSerialize
|
||||
});
|
||||
4
node_modules/@keyv/serialize/dist/index.d.cts
generated
vendored
Normal file
4
node_modules/@keyv/serialize/dist/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare const defaultSerialize: (data: any) => string;
|
||||
declare const defaultDeserialize: <Value>(data: any) => Value;
|
||||
|
||||
export { defaultDeserialize, defaultSerialize };
|
||||
4
node_modules/@keyv/serialize/dist/index.d.ts
generated
vendored
Normal file
4
node_modules/@keyv/serialize/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare const defaultSerialize: (data: any) => string;
|
||||
declare const defaultDeserialize: <Value>(data: any) => Value;
|
||||
|
||||
export { defaultDeserialize, defaultSerialize };
|
||||
58
node_modules/@keyv/serialize/dist/index.js
generated
vendored
Normal file
58
node_modules/@keyv/serialize/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
// src/index.ts
|
||||
import { Buffer } from "buffer";
|
||||
var _serialize = (data, escapeColonStrings = true) => {
|
||||
if (data === void 0 || data === null) {
|
||||
return "null";
|
||||
}
|
||||
if (typeof data === "string") {
|
||||
return JSON.stringify(
|
||||
escapeColonStrings && data.startsWith(":") ? `:${data}` : data
|
||||
);
|
||||
}
|
||||
if (Buffer.isBuffer(data)) {
|
||||
return JSON.stringify(`:base64:${data.toString("base64")}`);
|
||||
}
|
||||
if (data?.toJSON) {
|
||||
data = data.toJSON();
|
||||
}
|
||||
if (typeof data === "object") {
|
||||
let s = "";
|
||||
const array = Array.isArray(data);
|
||||
s = array ? "[" : "{";
|
||||
let first = true;
|
||||
for (const k in data) {
|
||||
const ignore = typeof data[k] === "function" || !array && data[k] === void 0;
|
||||
if (!Object.hasOwn(data, k) || ignore) {
|
||||
continue;
|
||||
}
|
||||
if (!first) {
|
||||
s += ",";
|
||||
}
|
||||
first = false;
|
||||
if (array) {
|
||||
s += _serialize(data[k], escapeColonStrings);
|
||||
} else if (data[k] !== void 0) {
|
||||
s += `${_serialize(k, false)}:${_serialize(data[k], escapeColonStrings)}`;
|
||||
}
|
||||
}
|
||||
s += array ? "]" : "}";
|
||||
return s;
|
||||
}
|
||||
return JSON.stringify(data);
|
||||
};
|
||||
var defaultSerialize = (data) => {
|
||||
return _serialize(data, true);
|
||||
};
|
||||
var defaultDeserialize = (data) => JSON.parse(data, (_, value) => {
|
||||
if (typeof value === "string") {
|
||||
if (value.startsWith(":base64:")) {
|
||||
return Buffer.from(value.slice(8), "base64");
|
||||
}
|
||||
return value.startsWith(":") ? value.slice(1) : value;
|
||||
}
|
||||
return value;
|
||||
});
|
||||
export {
|
||||
defaultDeserialize,
|
||||
defaultSerialize
|
||||
};
|
||||
55
node_modules/@keyv/serialize/package.json
generated
vendored
Normal file
55
node_modules/@keyv/serialize/package.json
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "@keyv/serialize",
|
||||
"version": "1.1.1",
|
||||
"description": "Serialization for Keyv",
|
||||
"type": "module",
|
||||
"main": "dist/index.cjs",
|
||||
"module": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": "./dist/index.cjs",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jaredwray/keyv.git"
|
||||
},
|
||||
"keywords": [
|
||||
"keyv",
|
||||
"serialize",
|
||||
"key",
|
||||
"value",
|
||||
"store"
|
||||
],
|
||||
"author": "Jared Wray <me@jaredwray.com> (https://jaredwray.com)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jaredwray/keyv/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jaredwray/keyv",
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^2.2.3",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"rimraf": "^6.0.1",
|
||||
"tsd": "^0.33.0",
|
||||
"typescript": "^5.9.2",
|
||||
"vitest": "^3.2.4",
|
||||
"@keyv/test-suite": "^2.1.1",
|
||||
"keyv": "^5.5.0"
|
||||
},
|
||||
"tsd": {
|
||||
"directory": "test"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"LICENSE"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "rimraf ./dist && tsup src/index.ts --format cjs,esm --dts --clean",
|
||||
"test": "biome check --write && vitest run --coverage",
|
||||
"test:ci": "biome check && vitest --run --sequence.setupFiles=list --coverage",
|
||||
"clean": "rimraf ./node_modules ./coverage ./dist"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user