From 54cc1bc5be0d048f1005a543eabd58c84f0509f9 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Sat, 22 Feb 2025 13:00:54 +0000 Subject: [PATCH 1/6] feat: add bytes package --- README.md | 7 +- packages/bytes/.lintstagedrc.mjs | 12 + packages/bytes/.prettierignore | 2 + packages/bytes/LICENSE | 116 +++++++ packages/bytes/README.md | 75 +++++ packages/bytes/eslint.config.mjs | 33 ++ packages/bytes/package.json | 52 +++ packages/bytes/prettier.config.mjs | 3 + packages/bytes/release.config.mjs | 36 ++ packages/bytes/scripts/generate-index.ts | 43 +++ packages/bytes/src/index.ts | 2 + packages/bytes/src/utilities/concat.ts | 10 + packages/bytes/src/utilities/index.ts | 2 + packages/bytes/src/utilities/isEqual.test.ts | 32 ++ packages/bytes/src/utilities/isEqual.ts | 14 + packages/bytes/tsconfig.build.json | 11 + packages/bytes/tsconfig.json | 30 ++ packages/bytes/vite.common.config.ts | 6 + packages/bytes/vite.config.ts | 24 ++ packages/bytes/vitest.config.ts | 15 + pnpm-lock.yaml | 334 +++++++++++++++++++ pnpm-workspace.yaml | 1 + 22 files changed, 857 insertions(+), 3 deletions(-) create mode 100644 packages/bytes/.lintstagedrc.mjs create mode 100644 packages/bytes/.prettierignore create mode 100644 packages/bytes/LICENSE create mode 100644 packages/bytes/README.md create mode 100644 packages/bytes/eslint.config.mjs create mode 100644 packages/bytes/package.json create mode 100644 packages/bytes/prettier.config.mjs create mode 100644 packages/bytes/release.config.mjs create mode 100644 packages/bytes/scripts/generate-index.ts create mode 100644 packages/bytes/src/index.ts create mode 100644 packages/bytes/src/utilities/concat.ts create mode 100644 packages/bytes/src/utilities/index.ts create mode 100644 packages/bytes/src/utilities/isEqual.test.ts create mode 100644 packages/bytes/src/utilities/isEqual.ts create mode 100644 packages/bytes/tsconfig.build.json create mode 100644 packages/bytes/tsconfig.json create mode 100644 packages/bytes/vite.common.config.ts create mode 100644 packages/bytes/vite.config.ts create mode 100644 packages/bytes/vitest.config.ts diff --git a/README.md b/README.md index bd97a14..37ad3cd 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,10 @@ pnpm install ### 3.1. Packages -| Name | Visibility | Description | Package | -|--------------------------------------|------------|-------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------| -| [`uuid`](./packages/types/README.md) | `public` | A UUID v4 utility package that allows generation and encoding/decoding. | [![NPM Version](https://img.shields.io/npm/v/%40agoralabs-sh%2Fuuid)](https://www.npmjs.com/package/%40agoralabs-sh/uuid) | +| Name | Visibility | Description | Package | +|--------------------------------------------------|------------|-------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------| +| [`@agoralabs/bytes`](./packages/bytes/README.md) | `public` | A UUID v4 utility package that allows generation and encoding/decoding. | [![NPM Version](https://img.shields.io/npm/v/%40agoralabs-sh%2Fbytes)](https://www.npmjs.com/package/%40agoralabs-sh/bytes) | +| [`uuid`](./packages/types/README.md) | `public` | A UUID v4 utility package that allows generation and encoding/decoding. | [![NPM Version](https://img.shields.io/npm/v/%40agoralabs-sh%2Fuuid)](https://www.npmjs.com/package/%40agoralabs-sh/uuid) | [Back to top ^][table-of-contents] diff --git a/packages/bytes/.lintstagedrc.mjs b/packages/bytes/.lintstagedrc.mjs new file mode 100644 index 0000000..a4af7ec --- /dev/null +++ b/packages/bytes/.lintstagedrc.mjs @@ -0,0 +1,12 @@ +import { resolve } from 'node:path'; + +export default (() => { + const packageName = 'bytes'; + + return { + '**/*.{cjs,js,json,mjs,ts}': (filenames) => [ + `sh -c 'pnpm -F @agoralabs-sh/${packageName} run generate:index && git add ${resolve(process.cwd(), 'packages', packageName, 'src', 'index.ts')}'`, + `prettier --write ${filenames.join(' ')}`, // exclude this file + ], + }; +})(); diff --git a/packages/bytes/.prettierignore b/packages/bytes/.prettierignore new file mode 100644 index 0000000..1eae0cf --- /dev/null +++ b/packages/bytes/.prettierignore @@ -0,0 +1,2 @@ +dist/ +node_modules/ diff --git a/packages/bytes/LICENSE b/packages/bytes/LICENSE new file mode 100644 index 0000000..670154e --- /dev/null +++ b/packages/bytes/LICENSE @@ -0,0 +1,116 @@ +CC0 1.0 Universal + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator and +subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for the +purpose of contributing to a commons of creative, cultural and scientific +works ("Commons") that the public can reliably and without fear of later +claims of infringement build upon, modify, incorporate in other works, reuse +and redistribute as freely as possible in any form whatsoever and for any +purposes, including without limitation commercial purposes. These owners may +contribute to the Commons to promote the ideal of a free culture and the +further production of creative, cultural and scientific works, or to gain +reputation or greater distribution for their Work in part through the use and +efforts of others. + +For these and/or other purposes and motivations, and without any expectation +of additional consideration or compensation, the person associating CC0 with a +Work (the "Affirmer"), to the extent that he or she is an owner of Copyright +and Related Rights in the Work, voluntarily elects to apply CC0 to the Work +and publicly distribute the Work under its terms, with knowledge of his or her +Copyright and Related Rights in the Work and the meaning and intended legal +effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not limited +to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, communicate, + and translate a Work; + + ii. moral rights retained by the original author(s) and/or performer(s); + + iii. publicity and privacy rights pertaining to a person's image or likeness + depicted in a Work; + + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + + v. rights protecting the extraction, dissemination, use and reuse of data in + a Work; + + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation thereof, + including any amended or successor version of such directive); and + + vii. other similar, equivalent or corresponding rights throughout the world + based on applicable law or treaty, and any national implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention of, +applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and +unconditionally waives, abandons, and surrenders all of Affirmer's Copyright +and Related Rights and associated claims and causes of action, whether now +known or unknown (including existing as well as future claims and causes of +action), in the Work (i) in all territories worldwide, (ii) for the maximum +duration provided by applicable law or treaty (including future time +extensions), (iii) in any current or future medium and for any number of +copies, and (iv) for any purpose whatsoever, including without limitation +commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes +the Waiver for the benefit of each member of the public at large and to the +detriment of Affirmer's heirs and successors, fully intending that such Waiver +shall not be subject to revocation, rescission, cancellation, termination, or +any other legal or equitable action to disrupt the quiet enjoyment of the Work +by the public as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason be +judged legally invalid or ineffective under applicable law, then the Waiver +shall be preserved to the maximum extent permitted taking into account +Affirmer's express Statement of Purpose. In addition, to the extent the Waiver +is so judged Affirmer hereby grants to each affected person a royalty-free, +non transferable, non sublicensable, non exclusive, irrevocable and +unconditional license to exercise Affirmer's Copyright and Related Rights in +the Work (i) in all territories worldwide, (ii) for the maximum duration +provided by applicable law or treaty (including future time extensions), (iii) +in any current or future medium and for any number of copies, and (iv) for any +purpose whatsoever, including without limitation commercial, advertising or +promotional purposes (the "License"). The License shall be deemed effective as +of the date CC0 was applied by Affirmer to the Work. Should any part of the +License for any reason be judged legally invalid or ineffective under +applicable law, such partial invalidity or ineffectiveness shall not +invalidate the remainder of the License, and in such case Affirmer hereby +affirms that he or she will not (i) exercise any of his or her remaining +Copyright and Related Rights in the Work or (ii) assert any associated claims +and causes of action with respect to the Work, in either case contrary to +Affirmer's express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + + b. Affirmer offers the Work as-is and makes no representations or warranties + of any kind concerning the Work, express, implied, statutory or otherwise, + including without limitation warranties of title, merchantability, fitness + for a particular purpose, non infringement, or the absence of latent or + other defects, accuracy, or the present or absence of errors, whether or not + discoverable, all to the greatest extent permissible under applicable law. + + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without limitation + any person's Copyright and Related Rights in the Work. Further, Affirmer + disclaims responsibility for obtaining any necessary consents, permissions + or other rights required for any use of the Work. + + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to this + CC0 or use of the Work. + +For more information, please see + diff --git a/packages/bytes/README.md b/packages/bytes/README.md new file mode 100644 index 0000000..eac8af6 --- /dev/null +++ b/packages/bytes/README.md @@ -0,0 +1,75 @@ +
+ +[![License: CC0-1.0](https://img.shields.io/badge/License-CC0_1.0-brightgreen.svg)](./LICENSE) +[![NPM Version](https://img.shields.io/npm/v/%40agoralabs-sh%2Fbytes)](https://www.npmjs.com/package/%40agoralabs-sh/bytes) + +
+ +
+ +![GitHub Release](https://img.shields.io/github/v/release/agoralabs-sh/instrumentum?filter=%40agoralabs-sh%2Fbytes*) +![GitHub Release](https://img.shields.io/github/v/release/agoralabs-sh/instrumentum?include_prereleases&filter=%40agoralabs-sh%2Fbytes*&label=pre-release) + +
+ +

+ Bytes +

+ +

+ Utilities for handling byte arrays. +

+ +--- + +### Table Of Contents + +* [1. Getting Started](#-2-getting-started) + - [1.1. Installation](#12-installation) +* [2. Appendix](#-2-appendix) + - [2.1. Useful Commands](#21-useful-commands) +* [3. How To Contribute](#-3-how-to-contribute) +* [4. License](#-4-license) + +## 🪄 1. Getting Started + +### 1.1. Installation + +You can install the types using: +```shell +pnpm add @agoralabs-sh/bytes +``` + +[Back to top ^][table-of-contents] + +## 📑 2. Appendix + +### 2.1. Useful Commands + +| Command | Description | +|---------------------------|-----------------------------------------------------------------------------| +| `pnpm run build` | Generates build and TypeScript declaration files to the `dist/` directory. | +| `pnpm run clean` | Deletes the `dist/` directory and the `tsconfig.*.tsbuildinfo` files. | +| `pnpm run generate:index` | Generates/overwrites the main `index.ts` file used for exporting all files. | +| `pnpm run lint` | Runs the linter based on the rules in `eslint.config.mjs`. | +| `pnpm run prettier` | Runs the prettier based on the rules in `prettier.config.mjs`. | + +[Back to top ^][table-of-contents] + +## 👏 3. How To Contribute + +Please read the [**Contributing Guide**][contribute] to learn about the development process. + +[Back to top ^][table-of-contents] + +## 📄 4. License + +Please refer to the [LICENSE][license] file. + +[Back to top ^][table-of-contents] + + +[contribute]: ../../CONTRIBUTING.md +[license]: LICENSE +[table-of-contents]: #table-of-contents + diff --git a/packages/bytes/eslint.config.mjs b/packages/bytes/eslint.config.mjs new file mode 100644 index 0000000..2ee75db --- /dev/null +++ b/packages/bytes/eslint.config.mjs @@ -0,0 +1,33 @@ +import eslint from '@eslint/js'; +import globals from 'globals'; +import prettierConfig from 'eslint-config-prettier'; +import typescriptConfig from 'typescript-eslint'; + +/** + * @type {import('eslint').Linter.Config[]} + **/ +export default [ + eslint.configs.recommended, + ...typescriptConfig.configs.recommended, + prettierConfig, + // custom config + { + files: ['**/*.{js,mjs,cjs,ts}'], + }, + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + }, + }, + }, + { + ignores: ['dist/', 'node_modules/'], + }, + { + rules: { + 'prefer-const': 'off', + }, + }, +]; diff --git a/packages/bytes/package.json b/packages/bytes/package.json new file mode 100644 index 0000000..94fe88f --- /dev/null +++ b/packages/bytes/package.json @@ -0,0 +1,52 @@ +{ + "name": "@agoralabs-sh/bytes", + "version": "1.0.0", + "description": "Utilities for handling byte arrays.", + "repository": { + "type": "git", + "url": "https://github.com/agoralabs-sh/avm-tools" + }, + "author": { + "name": "Kieran O'Neill", + "email": "hello@kieranoneill.com", + "url": "https://github.com/kieranroneill" + }, + "license": "CC0-1.0", + "private": false, + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "dist", + "LICENSE" + ], + "scripts": { + "build": "pnpm run clean && vite build", + "build:dependencies": "exit 0", + "clean": "shx rm -rf dist && shx rm -rf tsconfig.*.tsbuildinfo", + "generate:index": "tsx ./scripts/generate-index.ts", + "lint": "eslint .", + "prettier": "prettier --write \"**/*.{cjs,js,json,mjs,ts}\"", + "test": "vitest run --config vitest.config.ts" + }, + "dependencies": { + "@stablelib/bytes": "^2.0.1" + }, + "devDependencies": { + "@eslint/js": "catalog:", + "@types/node": "catalog:", + "chalk": "catalog:", + "eslint": "catalog:", + "eslint-config-prettier": "catalog:", + "globals": "catalog:", + "prettier": "catalog:", + "shx": "catalog:", + "tsx": "catalog:", + "typescript": "catalog:", + "typescript-eslint": "catalog:", + "vite": "catalog:", + "vite-plugin-dts": "catalog:", + "vite-tsconfig-paths": "catalog:", + "vitest": "catalog:" + } +} diff --git a/packages/bytes/prettier.config.mjs b/packages/bytes/prettier.config.mjs new file mode 100644 index 0000000..69e9f90 --- /dev/null +++ b/packages/bytes/prettier.config.mjs @@ -0,0 +1,3 @@ +import defaultConfig from '../../prettier.config.mjs'; + +export default defaultConfig; diff --git a/packages/bytes/release.config.mjs b/packages/bytes/release.config.mjs new file mode 100644 index 0000000..259b0ac --- /dev/null +++ b/packages/bytes/release.config.mjs @@ -0,0 +1,36 @@ +import packageJSON from './package.json' assert { type: 'json' }; + +/** + * @type {import('semantic-release').GlobalConfig} + */ +export default { + branches: [ + 'main', + { + name: 'beta', + prerelease: true, + }, + ], + extends: 'semantic-release-monorepo', + plugins: [ + '@semantic-release/commit-analyzer', + '@semantic-release/release-notes-generator', + '@semantic-release/changelog', + '@anolilab/semantic-release-pnpm', + [ + '@semantic-release/git', + { + assets: ['package.json', 'CHANGELOG.md'], + message: `chore(release): ${packageJSON.name}-v$\{nextRelease.version} + +$\{nextRelease.notes}`, + }, + ], + [ + '@semantic-release/github', + { + releasedLabels: ['🚀 released'], + }, + ], + ], +}; diff --git a/packages/bytes/scripts/generate-index.ts b/packages/bytes/scripts/generate-index.ts new file mode 100644 index 0000000..958fade --- /dev/null +++ b/packages/bytes/scripts/generate-index.ts @@ -0,0 +1,43 @@ +import chalk from 'chalk'; +import { readdirSync, rmSync, type Stats, statSync, writeFileSync } from 'node:fs'; +import { join, parse, type ParsedPath } from 'node:path'; +import * as process from 'node:process'; + +/** + * Script that creates the index.ts file in the `src/` directory. + */ +function main(): void { + const exports = ['// exports will be generated automatically generated using: pnpm generate:index']; + const srcDir = 'src'; + const indexFilePath = join(srcDir, 'index.ts'); + let dir: ParsedPath; + let stat: Stats; + + // remove the index file + rmSync(indexFilePath, { + force: true, + }); + + // get utils + for (const item of readdirSync(srcDir)) { + stat = statSync(join(srcDir, item)); + + // if it is not a directory, move on + if (!stat.isDirectory()) { + continue; + } + + dir = parse(item); + + exports.push(`export * from './${dir.name}';`); + } + + // write to index file + writeFileSync(indexFilePath, `${exports.join('\n')}\n`, 'utf-8'); + + console.log(`${chalk.yellow('[INFO]')}: generated indexes to "./src/index.ts"`); + + process.exit(0); +} + +main(); diff --git a/packages/bytes/src/index.ts b/packages/bytes/src/index.ts new file mode 100644 index 0000000..58d8aad --- /dev/null +++ b/packages/bytes/src/index.ts @@ -0,0 +1,2 @@ +// exports will be generated automatically generated using: pnpm generate:index +export * from './utilities'; diff --git a/packages/bytes/src/utilities/concat.ts b/packages/bytes/src/utilities/concat.ts new file mode 100644 index 0000000..18c10bf --- /dev/null +++ b/packages/bytes/src/utilities/concat.ts @@ -0,0 +1,10 @@ +import { concat } from '@stablelib/bytes'; + +/** + * Convenience function that concatenates a number of Uint8Arrays. + * @param {...Uint8Array[]} arrays - A list of arrays to concatenate. + * @returns {Uint8Array} The arrays concatenated. + */ +export default function isEqual(...arrays: Uint8Array[]): Uint8Array { + return concat(...arrays); +} diff --git a/packages/bytes/src/utilities/index.ts b/packages/bytes/src/utilities/index.ts new file mode 100644 index 0000000..441836e --- /dev/null +++ b/packages/bytes/src/utilities/index.ts @@ -0,0 +1,2 @@ +export { default as concat } from './concat'; +export { default as isEqual } from './isEqual'; diff --git a/packages/bytes/src/utilities/isEqual.test.ts b/packages/bytes/src/utilities/isEqual.test.ts new file mode 100644 index 0000000..a145fd6 --- /dev/null +++ b/packages/bytes/src/utilities/isEqual.test.ts @@ -0,0 +1,32 @@ +import { randomBytes } from 'node:crypto'; +import { describe, expect, test } from 'vitest'; + +// utils +import isEqual from './isEqual'; + +describe('isEqual', () => { + test('should return false if the arrays are not equal length', () => { + const arr1 = new Uint8Array(10); + const arr2 = new Uint8Array(arr1.length * 2); + + expect(isEqual(arr1, arr2)).toBe(false); + }); + + test('should return false if the arrays are the same length but not equal', () => { + const size = 10; + const arr1 = randomBytes(size); + const arr2 = randomBytes(size); + + expect(isEqual(arr1, arr2)).toBe(false); + }); + + test('should return true for the same array', () => { + const arr = randomBytes(10); + + expect(isEqual(arr, arr)).toBe(true); + }); + + test('should return true for empty arrays', () => { + expect(isEqual(new Uint8Array(), new Uint8Array())).toBe(true); + }); +}); diff --git a/packages/bytes/src/utilities/isEqual.ts b/packages/bytes/src/utilities/isEqual.ts new file mode 100644 index 0000000..e09e57b --- /dev/null +++ b/packages/bytes/src/utilities/isEqual.ts @@ -0,0 +1,14 @@ +/** + * Convenience function that checks if two Uint8Arrays are equal. + * @param {Uint8Array} arr1 - The first array. + * @param {Uint8Array} arr2 - The second array. + * @returns {boolean} True if the two arrays are equal, false otherwise. + */ +export default function isEqual(arr1: Uint8Array, arr2: Uint8Array): boolean { + // check if the arrays have the same length + if (arr1.length !== arr2.length) { + return false; + } + + return arr1.every((value, index) => value === arr2[index]); +} diff --git a/packages/bytes/tsconfig.build.json b/packages/bytes/tsconfig.build.json new file mode 100644 index 0000000..aa62075 --- /dev/null +++ b/packages/bytes/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declarationMap": true, + "moduleResolution": "Bundler", + "outDir": "dist", + "rootDir": "src", + "sourceMap": true + }, + "include": ["src/**/*"] +} diff --git a/packages/bytes/tsconfig.json b/packages/bytes/tsconfig.json new file mode 100644 index 0000000..befdd71 --- /dev/null +++ b/packages/bytes/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "allowUnreachableCode": false, + "alwaysStrict": true, + "baseUrl": ".", + "emitDecoratorMetadata": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true, + "incremental": true, + "isolatedModules": true, + "lib": ["DOM", "DOM.Iterable", "ESNext"], + "moduleResolution": "Node", + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "paths": { + "@/*": ["src/*"] + }, + "removeComments": false, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": false, + "strictBindCallApply": false, + "strictNullChecks": true, + "strictPropertyInitialization": false, + "target": "ES2020" + } +} diff --git a/packages/bytes/vite.common.config.ts b/packages/bytes/vite.common.config.ts new file mode 100644 index 0000000..34e9aa2 --- /dev/null +++ b/packages/bytes/vite.common.config.ts @@ -0,0 +1,6 @@ +import { defineConfig } from 'vite'; +import tsconfigPaths from 'vite-tsconfig-paths'; + +export default defineConfig({ + plugins: [tsconfigPaths()], +}); diff --git a/packages/bytes/vite.config.ts b/packages/bytes/vite.config.ts new file mode 100644 index 0000000..ef1dfd1 --- /dev/null +++ b/packages/bytes/vite.config.ts @@ -0,0 +1,24 @@ +import { defineConfig, mergeConfig } from 'vite'; +import dts from 'vite-plugin-dts'; + +// configs +import commonConfig from './vite.common.config'; + +export default mergeConfig( + commonConfig, + defineConfig({ + build: { + lib: { + entry: 'src/index.ts', + formats: ['es'], + fileName: 'index', + }, + outDir: 'dist', + }, + plugins: [ + dts({ + tsconfigPath: 'tsconfig.build.json', + }), + ], + }) +); diff --git a/packages/bytes/vitest.config.ts b/packages/bytes/vitest.config.ts new file mode 100644 index 0000000..a300204 --- /dev/null +++ b/packages/bytes/vitest.config.ts @@ -0,0 +1,15 @@ +import { defineConfig, mergeConfig } from 'vitest/config'; + +// configs +import commonConfig from './vite.common.config'; + +export default mergeConfig( + commonConfig, + defineConfig({ + test: { + dir: 'src', + passWithNoTests: true, + testTimeout: 60000, + }, + }) +); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 439d451..81d4b78 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -48,6 +48,9 @@ catalogs: vite-tsconfig-paths: specifier: ^5.1.4 version: 5.1.4 + vitest: + specifier: ^3.0.5 + version: 3.0.6 importers: @@ -96,6 +99,58 @@ importers: specifier: ^8.0.2 version: 8.0.2(semantic-release@23.1.1(typescript@5.7.3)) + packages/bytes: + dependencies: + '@stablelib/bytes': + specifier: ^2.0.1 + version: 2.0.1 + devDependencies: + '@eslint/js': + specifier: 'catalog:' + version: 9.21.0 + '@types/node': + specifier: 'catalog:' + version: 22.13.5 + chalk: + specifier: 'catalog:' + version: 5.4.1 + eslint: + specifier: 'catalog:' + version: 9.21.0(jiti@2.4.2) + eslint-config-prettier: + specifier: 'catalog:' + version: 9.1.0(eslint@9.21.0(jiti@2.4.2)) + globals: + specifier: 'catalog:' + version: 15.15.0 + prettier: + specifier: 'catalog:' + version: 3.5.2 + shx: + specifier: 'catalog:' + version: 0.3.4 + tsx: + specifier: 'catalog:' + version: 4.19.3 + typescript: + specifier: 'catalog:' + version: 5.7.3 + typescript-eslint: + specifier: 'catalog:' + version: 8.24.1(eslint@9.21.0(jiti@2.4.2))(typescript@5.7.3) + vite: + specifier: 'catalog:' + version: 6.1.1(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0) + vite-plugin-dts: + specifier: 'catalog:' + version: 4.5.0(@types/node@22.13.5)(rollup@4.34.8)(typescript@5.7.3)(vite@6.1.1(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0)) + vite-tsconfig-paths: + specifier: 'catalog:' + version: 5.1.4(typescript@5.7.3)(vite@6.1.1(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0)) + vitest: + specifier: 'catalog:' + version: 3.0.6(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0) + packages/uuid: dependencies: '@stablelib/hex': @@ -934,6 +989,9 @@ packages: '@stablelib/binary@2.0.1': resolution: {integrity: sha512-U9iAO8lXgEDONsA0zPPSgcf3HUBNAqHiJmSHgZz62OvC3Hi2Bhc5kTnQ3S1/L+sthDTHtCMhcEiklmIly6uQ3w==} + '@stablelib/bytes@2.0.1': + resolution: {integrity: sha512-QIzI6V7nkJA5CjOZ7GoceBd4CIKrJoC471VaI6jh1xPQ2cMhkhQK4HddyzCXOR2y+fBF3/5B2HO3FXXI9C+Xzg==} + '@stablelib/hex@2.0.1': resolution: {integrity: sha512-nsAgs3109myeijRQg3HASq3vlxe/8uDKHEUuIwn9ZLxfWtXavgojAGLBjI7Sda6seOhy7rKrpmeehYo0Z5VGQA==} @@ -1044,6 +1102,35 @@ packages: engines: {node: '>=18.0.0 <=23.x'} os: [darwin, linux, win32] + '@vitest/expect@3.0.6': + resolution: {integrity: sha512-zBduHf/ja7/QRX4HdP1DSq5XrPgdN+jzLOwaTq/0qZjYfgETNFCKf9nOAp2j3hmom3oTbczuUzrzg9Hafh7hNg==} + + '@vitest/mocker@3.0.6': + resolution: {integrity: sha512-KPztr4/tn7qDGZfqlSPQoF2VgJcKxnDNhmfR3VgZ6Fy1bO8T9Fc1stUiTXtqz0yG24VpD00pZP5f8EOFknjNuQ==} + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 || ^6.0.0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@3.0.6': + resolution: {integrity: sha512-Zyctv3dbNL+67qtHfRnUE/k8qxduOamRfAL1BurEIQSyOEFffoMvx2pnDSSbKAAVxY0Ej2J/GH2dQKI0W2JyVg==} + + '@vitest/runner@3.0.6': + resolution: {integrity: sha512-JopP4m/jGoaG1+CBqubV/5VMbi7L+NQCJTu1J1Pf6YaUbk7bZtaq5CX7p+8sY64Sjn1UQ1XJparHfcvTTdu9cA==} + + '@vitest/snapshot@3.0.6': + resolution: {integrity: sha512-qKSmxNQwT60kNwwJHMVwavvZsMGXWmngD023OHSgn873pV0lylK7dwBTfYP7e4URy5NiBCHHiQGA9DHkYkqRqg==} + + '@vitest/spy@3.0.6': + resolution: {integrity: sha512-HfOGx/bXtjy24fDlTOpgiAEJbRfFxoX3zIGagCqACkFKKZ/TTOE6gYMKXlqecvxEndKFuNHcHqP081ggZ2yM0Q==} + + '@vitest/utils@3.0.6': + resolution: {integrity: sha512-18ktZpf4GQFTbf9jK543uspU03Q2qya7ZGya5yiZ0Gx0nnnalBvd5ZBislbl2EhLjM8A8rt4OilqKG7QwcGkvQ==} + '@volar/language-core@2.4.11': resolution: {integrity: sha512-lN2C1+ByfW9/JRPpqScuZt/4OrUUse57GLI6TbLgTIqBVemdl1wNcZ1qYGEo2+Gw8coYLgCy7SuKqn6IrQcQgg==} @@ -1177,6 +1264,10 @@ packages: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -1196,10 +1287,18 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} + chai@5.2.0: + resolution: {integrity: sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw==} + engines: {node: '>=12'} + chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} @@ -1216,6 +1315,10 @@ packages: resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} engines: {node: '>=10'} + check-error@2.1.1: + resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} + engines: {node: '>= 16'} + clean-stack@2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} engines: {node: '>=6'} @@ -1379,6 +1482,10 @@ packages: supports-color: optional: true + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + deep-extend@0.6.0: resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} engines: {node: '>=4.0.0'} @@ -1429,6 +1536,9 @@ packages: error-ex@1.3.2: resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} + es-module-lexer@1.6.0: + resolution: {integrity: sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==} + esbuild@0.24.2: resolution: {integrity: sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==} engines: {node: '>=18'} @@ -1502,6 +1612,9 @@ packages: estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} @@ -1521,6 +1634,10 @@ packages: resolution: {integrity: sha512-EHlpxMCpHWSAh1dgS6bVeoLAXGnJNdR93aabr4QCGbzOM73o5XmRfM/e5FUqsw3aagP8S8XEWUWFAxnRBnAF0Q==} engines: {node: ^18.19.0 || >=20.5.0} + expect-type@1.1.0: + resolution: {integrity: sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==} + engines: {node: '>=12.0.0'} + fast-content-type-parse@2.0.1: resolution: {integrity: sha512-nGqtvLrj5w0naR6tDPfB4cUmYCqouzyQiz6C5y/LtcDllJdrcc6WaWW6iXyIIOErTa/XRybj28aasdn4LkVk6Q==} @@ -2054,6 +2171,9 @@ packages: resolution: {integrity: sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==} engines: {node: '>=18'} + loupe@3.1.3: + resolution: {integrity: sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==} + lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} @@ -2427,6 +2547,10 @@ packages: pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + pathval@2.0.0: + resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} + engines: {node: '>= 14.16'} + picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -2629,6 +2753,9 @@ packages: engines: {node: '>=6'} hasBin: true + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} @@ -2693,6 +2820,12 @@ packages: sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + std-env@3.8.0: + resolution: {integrity: sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==} + stream-combiner2@1.1.1: resolution: {integrity: sha512-3PnJbYgS56AeWgtKF5jtJRT6uFJe56Z0Hc5Ngg/6sI6rIt8iiMBTa9cvdyFfpMQjaVHr8dusbNeFGIIonxOvKw==} @@ -2804,9 +2937,24 @@ packages: resolution: {integrity: sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA==} engines: {node: '>=12'} + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + tinyexec@0.3.2: resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + tinypool@1.0.2: + resolution: {integrity: sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@2.0.0: + resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==} + engines: {node: '>=14.0.0'} + + tinyspy@3.0.2: + resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==} + engines: {node: '>=14.0.0'} + to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -2931,6 +3079,11 @@ packages: validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} + vite-node@3.0.6: + resolution: {integrity: sha512-s51RzrTkXKJrhNbUzQRsarjmAae7VmMPAsRT7lppVpIg6mK3zGthP9Hgz0YQQKuNcF+Ii7DfYk3Fxz40jRmePw==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + vite-plugin-dts@4.5.0: resolution: {integrity: sha512-M1lrPTdi7gilLYRZoLmGYnl4fbPryVYsehPN9JgaxjJKTs8/f7tuAlvCCvOLB5gRDQTTKnptBcB0ACsaw2wNLw==} peerDependencies: @@ -2988,6 +3141,34 @@ packages: yaml: optional: true + vitest@3.0.6: + resolution: {integrity: sha512-/iL1Sc5VeDZKPDe58oGK4HUFLhw6b5XdY1MYawjuSaDA4sEfYlY9HnS6aCEG26fX+MgUi7MwlduTBHHAI/OvMA==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/debug': ^4.1.12 + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + '@vitest/browser': 3.0.6 + '@vitest/ui': 3.0.6 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/debug': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + vscode-uri@3.1.0: resolution: {integrity: sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==} @@ -2996,6 +3177,11 @@ packages: engines: {node: '>= 8'} hasBin: true + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + word-wrap@1.2.5: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} @@ -3836,6 +4022,8 @@ snapshots: dependencies: '@stablelib/int': 2.0.1 + '@stablelib/bytes@2.0.1': {} + '@stablelib/hex@2.0.1': {} '@stablelib/int@2.0.1': {} @@ -3972,6 +4160,46 @@ snapshots: '@visulima/path@1.3.4': {} + '@vitest/expect@3.0.6': + dependencies: + '@vitest/spy': 3.0.6 + '@vitest/utils': 3.0.6 + chai: 5.2.0 + tinyrainbow: 2.0.0 + + '@vitest/mocker@3.0.6(vite@6.1.1(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0))': + dependencies: + '@vitest/spy': 3.0.6 + estree-walker: 3.0.3 + magic-string: 0.30.17 + optionalDependencies: + vite: 6.1.1(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0) + + '@vitest/pretty-format@3.0.6': + dependencies: + tinyrainbow: 2.0.0 + + '@vitest/runner@3.0.6': + dependencies: + '@vitest/utils': 3.0.6 + pathe: 2.0.3 + + '@vitest/snapshot@3.0.6': + dependencies: + '@vitest/pretty-format': 3.0.6 + magic-string: 0.30.17 + pathe: 2.0.3 + + '@vitest/spy@3.0.6': + dependencies: + tinyspy: 3.0.2 + + '@vitest/utils@3.0.6': + dependencies: + '@vitest/pretty-format': 3.0.6 + loupe: 3.1.3 + tinyrainbow: 2.0.0 + '@volar/language-core@2.4.11': dependencies: '@volar/source-map': 2.4.11 @@ -4114,6 +4342,8 @@ snapshots: array-union@2.1.0: {} + assertion-error@2.0.1: {} + balanced-match@1.0.2: {} before-after-hook@3.0.2: {} @@ -4133,8 +4363,18 @@ snapshots: dependencies: fill-range: 7.1.1 + cac@6.7.14: {} + callsites@3.1.0: {} + chai@5.2.0: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.1 + deep-eql: 5.0.2 + loupe: 3.1.3 + pathval: 2.0.0 + chalk@2.4.2: dependencies: ansi-styles: 3.2.1 @@ -4150,6 +4390,8 @@ snapshots: char-regex@1.0.2: {} + check-error@2.1.1: {} + clean-stack@2.2.0: {} clean-stack@5.2.0: @@ -4309,6 +4551,8 @@ snapshots: dependencies: ms: 2.1.3 + deep-eql@5.0.2: {} + deep-extend@0.6.0: {} deep-is@0.1.4: {} @@ -4357,6 +4601,8 @@ snapshots: dependencies: is-arrayish: 0.2.1 + es-module-lexer@1.6.0: {} + esbuild@0.24.2: optionalDependencies: '@esbuild/aix-ppc64': 0.24.2 @@ -4493,6 +4739,10 @@ snapshots: estree-walker@2.0.2: {} + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.6 + esutils@2.0.3: {} eventemitter3@5.0.1: {} @@ -4536,6 +4786,8 @@ snapshots: strip-final-newline: 4.0.0 yoctocolors: 2.1.1 + expect-type@1.1.0: {} + fast-content-type-parse@2.0.1: {} fast-deep-equal@3.1.3: {} @@ -5025,6 +5277,8 @@ snapshots: strip-ansi: 7.1.0 wrap-ansi: 9.0.0 + loupe@3.1.3: {} + lru-cache@10.4.3: {} lru-cache@6.0.0: @@ -5292,6 +5546,8 @@ snapshots: pathe@2.0.3: {} + pathval@2.0.0: {} + picocolors@1.1.1: {} picomatch@2.3.1: {} @@ -5542,6 +5798,8 @@ snapshots: minimist: 1.2.8 shelljs: 0.8.5 + siginfo@2.0.0: {} + signal-exit@3.0.7: {} signal-exit@4.1.0: {} @@ -5598,6 +5856,10 @@ snapshots: sprintf-js@1.0.3: {} + stackback@0.0.2: {} + + std-env@3.8.0: {} + stream-combiner2@1.1.1: dependencies: duplexer2: 0.1.4 @@ -5705,8 +5967,16 @@ snapshots: dependencies: convert-hrtime: 5.0.0 + tinybench@2.9.0: {} + tinyexec@0.3.2: {} + tinypool@1.0.2: {} + + tinyrainbow@2.0.0: {} + + tinyspy@3.0.2: {} + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 @@ -5796,6 +6066,27 @@ snapshots: spdx-correct: 3.2.0 spdx-expression-parse: 3.0.1 + vite-node@3.0.6(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0): + dependencies: + cac: 6.7.14 + debug: 4.4.0 + es-module-lexer: 1.6.0 + pathe: 2.0.3 + vite: 6.1.1(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0) + transitivePeerDependencies: + - '@types/node' + - jiti + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + vite-plugin-dts@4.5.0(@types/node@22.13.5)(rollup@4.34.8)(typescript@5.7.3)(vite@6.1.1(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0)): dependencies: '@microsoft/api-extractor': 7.50.1(@types/node@22.13.5) @@ -5838,12 +6129,55 @@ snapshots: tsx: 4.19.3 yaml: 2.7.0 + vitest@3.0.6(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0): + dependencies: + '@vitest/expect': 3.0.6 + '@vitest/mocker': 3.0.6(vite@6.1.1(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0)) + '@vitest/pretty-format': 3.0.6 + '@vitest/runner': 3.0.6 + '@vitest/snapshot': 3.0.6 + '@vitest/spy': 3.0.6 + '@vitest/utils': 3.0.6 + chai: 5.2.0 + debug: 4.4.0 + expect-type: 1.1.0 + magic-string: 0.30.17 + pathe: 2.0.3 + std-env: 3.8.0 + tinybench: 2.9.0 + tinyexec: 0.3.2 + tinypool: 1.0.2 + tinyrainbow: 2.0.0 + vite: 6.1.1(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0) + vite-node: 3.0.6(@types/node@22.13.5)(jiti@2.4.2)(tsx@4.19.3)(yaml@2.7.0) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 22.13.5 + transitivePeerDependencies: + - jiti + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + vscode-uri@3.1.0: {} which@2.0.2: dependencies: isexe: 2.0.0 + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + word-wrap@1.2.5: {} wordwrap@1.0.0: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 7310272..d081cc8 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -16,3 +16,4 @@ catalog: vite: ^6.0.3 vite-plugin-dts: ^4.3.0 vite-tsconfig-paths: ^5.1.4 + vitest: ^3.0.5 From 2cafb24101bc2a4f98dd6875c6895b0b586de716 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Sat, 22 Feb 2025 13:01:21 +0000 Subject: [PATCH 2/6] ci(bytes): add workflow for bytes package --- .github/workflows/pull_request_checks.yml | 11 +++++++++++ .github/workflows/release.yml | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/.github/workflows/pull_request_checks.yml b/.github/workflows/pull_request_checks.yml index 956a5bd..f18869d 100644 --- a/.github/workflows/pull_request_checks.yml +++ b/.github/workflows/pull_request_checks.yml @@ -10,6 +10,7 @@ jobs: permissions: pull-requests: read outputs: + bytes: ${{ steps.filter.outputs.bytes }} uuid: ${{ steps.filter.outputs.uuid }} steps: - name: "📥 Filter" @@ -17,6 +18,8 @@ jobs: id: filter with: filters: | + bytes: + - 'packages/bytes/**' uuid: - 'packages/uuid/**' @@ -47,6 +50,14 @@ jobs: # package specific ## + bytes: + name: "@agoralabs-sh/bytes" + needs: [changed_files, validate_pr_title] + if: ${{ needs.changed_files.outputs.uuid == 'true' }} + uses: ./.github/workflows/lint_build_test.yml + with: + package_name: "@agoralabs-sh/bytes" + uuid: name: "@agoralabs-sh/uuid" needs: [changed_files, validate_pr_title] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c8fd8ad..80b9e81 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,8 +16,19 @@ permissions: packages: write # to be able to publish packages pull-requests: write # to be able to comment on released pull requests +# each job **MUST** run sequentially as a potential release will alter commit and push a CHANGELOG and bump its package version jobs: + bytes: + name: "@agoralabs-sh/bytes" + uses: ./.github/workflows/publish_release.yml + with: + package_dir: "bytes" + package_name: "@agoralabs-sh/bytes" + secrets: + NPM_TOKEN: ${{ secrets.PUBLISH_PUBLIC_PACKAGES_TOKEN }} + uuid: + needs: [bytes] name: "@agoralabs-sh/uuid" uses: ./.github/workflows/publish_release.yml with: From a5426e1df3efa45fea505d4655366ad0a634863f Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Sat, 22 Feb 2025 13:02:24 +0000 Subject: [PATCH 3/6] chore: squash --- packages/bytes/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bytes/README.md b/packages/bytes/README.md index eac8af6..05bcb55 100644 --- a/packages/bytes/README.md +++ b/packages/bytes/README.md @@ -13,7 +13,7 @@

- Bytes + @agoralabs/bytes

From 13ed82d54db23d8921d8153d57ea75ca5fe4bef6 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Sat, 22 Feb 2025 13:03:26 +0000 Subject: [PATCH 4/6] chore: squash --- packages/bytes/README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/bytes/README.md b/packages/bytes/README.md index 05bcb55..9b554aa 100644 --- a/packages/bytes/README.md +++ b/packages/bytes/README.md @@ -46,13 +46,14 @@ pnpm add @agoralabs-sh/bytes ### 2.1. Useful Commands -| Command | Description | -|---------------------------|-----------------------------------------------------------------------------| -| `pnpm run build` | Generates build and TypeScript declaration files to the `dist/` directory. | -| `pnpm run clean` | Deletes the `dist/` directory and the `tsconfig.*.tsbuildinfo` files. | -| `pnpm run generate:index` | Generates/overwrites the main `index.ts` file used for exporting all files. | -| `pnpm run lint` | Runs the linter based on the rules in `eslint.config.mjs`. | -| `pnpm run prettier` | Runs the prettier based on the rules in `prettier.config.mjs`. | +| Command | Description | +|-----------------------|-----------------------------------------------------------------------------| +| `pnpm build` | Generates build and TypeScript declaration files to the `dist/` directory. | +| `pnpm clean` | Deletes the `dist/` directory and the `tsconfig.*.tsbuildinfo` files. | +| `pnpm generate:index` | Generates/overwrites the main `index.ts` file used for exporting all files. | +| `pnpm lint` | Runs the linter based on the rules in `eslint.config.mjs`. | +| `pnpm prettier` | Runs the prettier based on the rules in `prettier.config.mjs`. | +| `pnpm test` | Runs Vitest. | [Back to top ^][table-of-contents] From 6e3645de1629374b8a2a17b098f141f1de0f18a0 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Sat, 22 Feb 2025 13:05:24 +0000 Subject: [PATCH 5/6] chore: squash --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37ad3cd..dbe625a 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,8 @@ pnpm install | Name | Visibility | Description | Package | |--------------------------------------------------|------------|-------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------| -| [`@agoralabs/bytes`](./packages/bytes/README.md) | `public` | A UUID v4 utility package that allows generation and encoding/decoding. | [![NPM Version](https://img.shields.io/npm/v/%40agoralabs-sh%2Fbytes)](https://www.npmjs.com/package/%40agoralabs-sh/bytes) | -| [`uuid`](./packages/types/README.md) | `public` | A UUID v4 utility package that allows generation and encoding/decoding. | [![NPM Version](https://img.shields.io/npm/v/%40agoralabs-sh%2Fuuid)](https://www.npmjs.com/package/%40agoralabs-sh/uuid) | +| [`@agoralabs/bytes`](./packages/bytes/README.md) | `public` | Utilities for handling byte arrays. | [![NPM Version](https://img.shields.io/npm/v/%40agoralabs-sh%2Fbytes)](https://www.npmjs.com/package/%40agoralabs-sh/bytes) | +| [`@agoralabs/uuid`](./packages/uuid/README.md) | `public` | A UUID v4 utility package that allows generation and encoding/decoding. | [![NPM Version](https://img.shields.io/npm/v/%40agoralabs-sh%2Fuuid)](https://www.npmjs.com/package/%40agoralabs-sh/uuid) | [Back to top ^][table-of-contents] From 36c6789e7b70b63948b3cb3dd6776e7681f7e06c Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Sat, 22 Feb 2025 13:08:11 +0000 Subject: [PATCH 6/6] ci: fix issue with pr checks being skipped --- .github/workflows/pull_request_checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request_checks.yml b/.github/workflows/pull_request_checks.yml index f18869d..53df341 100644 --- a/.github/workflows/pull_request_checks.yml +++ b/.github/workflows/pull_request_checks.yml @@ -53,7 +53,7 @@ jobs: bytes: name: "@agoralabs-sh/bytes" needs: [changed_files, validate_pr_title] - if: ${{ needs.changed_files.outputs.uuid == 'true' }} + if: ${{ needs.changed_files.outputs.bytes == 'true' }} uses: ./.github/workflows/lint_build_test.yml with: package_name: "@agoralabs-sh/bytes"