From 95eb48c83e9a7c38da5070312ccdfeaffea7e70d Mon Sep 17 00:00:00 2001 From: Gunther Brunner Date: Thu, 11 Jul 2024 23:46:31 +0900 Subject: [PATCH] feat: Add Effect Schema validator (#589) * First commit * Add basic Effect Schema validator * chore(effect-validator): Change name of middleware to `effect-validator` and fix devDependencies * chores(effect-validator): Update yarn.lock * Remove bun lock file * chores(effect-validator): Add github workflow * chores: Update yarn.lock * refactor the code and correct settings * remove unnecessary files --------- Co-authored-by: Yusuke Wada --- .changeset/poor-clouds-fix.md | 5 + .github/workflows/ci-effect-validator.yml | 25 ++ packages/effect-validator/README.md | 51 +++ packages/effect-validator/package.json | 52 +++ packages/effect-validator/src/index.ts | 54 +++ packages/effect-validator/test/index.test.ts | 152 +++++++++ packages/effect-validator/tsconfig.json | 10 + packages/effect-validator/vitest.config.ts | 8 + yarn.lock | 337 +++++++++++++++++++ 9 files changed, 694 insertions(+) create mode 100644 .changeset/poor-clouds-fix.md create mode 100644 .github/workflows/ci-effect-validator.yml create mode 100644 packages/effect-validator/README.md create mode 100644 packages/effect-validator/package.json create mode 100644 packages/effect-validator/src/index.ts create mode 100644 packages/effect-validator/test/index.test.ts create mode 100644 packages/effect-validator/tsconfig.json create mode 100644 packages/effect-validator/vitest.config.ts diff --git a/.changeset/poor-clouds-fix.md b/.changeset/poor-clouds-fix.md new file mode 100644 index 00000000..19eb3f8d --- /dev/null +++ b/.changeset/poor-clouds-fix.md @@ -0,0 +1,5 @@ +--- +'@hono/schema-validator': major +--- + +Add new basic Effect Schema validator middleware diff --git a/.github/workflows/ci-effect-validator.yml b/.github/workflows/ci-effect-validator.yml new file mode 100644 index 00000000..810b6015 --- /dev/null +++ b/.github/workflows/ci-effect-validator.yml @@ -0,0 +1,25 @@ +name: ci-effect-validator +on: + push: + branches: [main] + paths: + - 'packages/effect-validator/**' + pull_request: + branches: ['*'] + paths: + - 'packages/effect-validator/**' + +jobs: + ci: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./packages/effect-validator + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20.x + - run: yarn install --frozen-lockfile + - run: yarn build + - run: yarn test diff --git a/packages/effect-validator/README.md b/packages/effect-validator/README.md new file mode 100644 index 00000000..2d386e21 --- /dev/null +++ b/packages/effect-validator/README.md @@ -0,0 +1,51 @@ +# Effect Schema Validator Middleware for Hono + +This package provides a validator middleware using [Effect Schema](https://github.com/Effect-TS/effect/blob/main/packages/schema/README.md) for [Hono](https://honojs.dev) applications. With this middleware, you can define schemas using Effect Schema and validate incoming data in your Hono routes. + +## Why Effect Schema? + +Effect Schema offers several advantages over other validation libraries: + +1. Bidirectional transformations: Effect Schema can both decode and encode data. +2. Integration with Effect: It inherits benefits from the Effect ecosystem, such as dependency tracking in transformations. +3. Highly customizable: Users can attach meta-information through annotations. +4. Functional programming style: Uses combinators and transformations for schema definition. + +## Usage + +```ts +import { Hono } from 'hono' +import { Schema as S } from '@effect/schema' +import { effectValidator } from '@hono/effect-validator' + +const app = new Hono() + +const User = S.Struct({ + name: S.String, + age: S.Number, +}) + +app.post('/user', effectValidator('json', User), (c) => { + const user = c.req.valid('json') + + return c.json({ + success: true, + message: `${user.name} is ${user.age}`, + }) +}) +``` + +## API + +### `effectValidator(target, schema)` + +- `target`: The target of validation ('json', 'form', 'query', etc.) +- `schema`: An Effect Schema schema + +## Author + +Günther Brunner + +## License + +MIT diff --git a/packages/effect-validator/package.json b/packages/effect-validator/package.json new file mode 100644 index 00000000..6466afad --- /dev/null +++ b/packages/effect-validator/package.json @@ -0,0 +1,52 @@ +{ + "name": "@hono/effect-validator", + "version": "0.0.0", + "description": "Validator middleware using Effect Schema", + "type": "module", + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "types": "dist/esm/index.d.ts", + "exports": { + ".": { + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } + } + }, + "files": [ + "dist" + ], + "scripts": { + "test": "vitest --run", + "build": "tsup ./src/index.ts --format esm,cjs --dts", + "publint": "publint", + "release": "yarn build && yarn test && yarn publint && yarn publish" + }, + "license": "MIT", + "publishConfig": { + "registry": "https://registry.npmjs.org", + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/honojs/middleware.git" + }, + "homepage": "https://github.com/honojs/middleware", + "peerDependencies": { + "@effect/schema": ">=0.68.18", + "hono": ">=4.4.13" + }, + "devDependencies": { + "@effect/schema": "^0.68.21", + "effect": "^3.4.8", + "hono": "^4.4.13", + "tsup": "^8.1.0", + "typescript": "^5.5.3", + "vitest": "^2.0.1" + } +} diff --git a/packages/effect-validator/src/index.ts b/packages/effect-validator/src/index.ts new file mode 100644 index 00000000..0b670061 --- /dev/null +++ b/packages/effect-validator/src/index.ts @@ -0,0 +1,54 @@ +import * as S from '@effect/schema/Schema' +import { Either } from 'effect' +import type { Env, Input, MiddlewareHandler, ValidationTargets } from 'hono' +import type { Simplify } from 'hono/utils/types' +import { validator } from 'hono/validator' + +type RemoveReadonly = { -readonly [P in keyof T]: RemoveReadonly } + +type HasUndefined = undefined extends T ? true : false + +export const effectValidator = < + // eslint-disable-next-line @typescript-eslint/no-explicit-any + T extends S.Schema.Variance, + Target extends keyof ValidationTargets, + E extends Env, + P extends string, + In = Simplify>>, + Out = Simplify>>, + I extends Input = { + in: HasUndefined extends true + ? { + [K in Target]?: K extends 'json' + ? In + : HasUndefined extends true + ? { [K2 in keyof In]?: ValidationTargets[K][K2] } + : { [K2 in keyof In]: ValidationTargets[K][K2] } + } + : { + [K in Target]: K extends 'json' + ? In + : HasUndefined extends true + ? { [K2 in keyof In]?: ValidationTargets[K][K2] } + : { [K2 in keyof In]: ValidationTargets[K][K2] } + } + out: { [K in Target]: Out } + }, + V extends I = I +>( + target: Target, + schema: T +): MiddlewareHandler => + // @ts-expect-error not typed well + validator(target, async (value, c) => { + // @ts-expect-error not typed well + const result = S.decodeUnknownEither(schema)(value) + + return Either.match(result, { + onLeft: (error) => c.json({ success: false, error: JSON.parse(JSON.stringify(error)) }, 400), + onRight: (data) => { + c.req.addValidatedData(target, data as object) + return data + }, + }) + }) diff --git a/packages/effect-validator/test/index.test.ts b/packages/effect-validator/test/index.test.ts new file mode 100644 index 00000000..fa7212c1 --- /dev/null +++ b/packages/effect-validator/test/index.test.ts @@ -0,0 +1,152 @@ +import { Schema as S } from '@effect/schema' +import { Hono } from 'hono' +import type { StatusCode } from 'hono/utils/http-status' +import type { Equal, Expect } from 'hono/utils/types' +import { effectValidator } from '../src' + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +type ExtractSchema = T extends Hono ? S : never + +describe('Basic', () => { + const app = new Hono() + + const jsonSchema = S.Struct({ + name: S.String, + age: S.Number, + }) + + const querySchema = S.Union( + S.Struct({ + name: S.optional(S.String), + }), + S.Undefined + ) + + const route = app.post( + '/author', + effectValidator('json', jsonSchema), + effectValidator('query', querySchema), + (c) => { + const data = c.req.valid('json') + const query = c.req.valid('query') + + return c.json({ + success: true, + message: `${data.name} is ${data.age}`, + queryName: query?.name, + }) + } + ) + + type Actual = ExtractSchema + + type Expected = { + '/author': { + $post: { + input: { + json: { + name: string + age: number + } + } & { + query?: { + name?: string | string[] | undefined + } + } + output: { + success: boolean + message: string + queryName: string | undefined + } + outputFormat: 'json' + status: StatusCode + } + } + } + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + type verify = Expect> + + it('Should return 200 response', async () => { + const req = new Request('http://localhost/author?name=Metallo', { + body: JSON.stringify({ + name: 'Superman', + age: 20, + }), + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + }) + const res = await app.request(req) + expect(res).not.toBeNull() + expect(res.status).toBe(200) + expect(await res.json()).toEqual({ + success: true, + message: 'Superman is 20', + queryName: 'Metallo', + }) + }) + + it('Should return 400 response', async () => { + const req = new Request('http://localhost/author', { + body: JSON.stringify({ + name: 'Superman', + age: '20', + }), + method: 'POST', + headers: { + 'content-type': 'application/json', + }, + }) + const res = await app.request(req) + expect(res).not.toBeNull() + expect(res.status).toBe(400) + + const data = (await res.json()) as { success: boolean } + expect(data.success).toBe(false) + }) +}) + +describe('coerce', () => { + const app = new Hono() + + const querySchema = S.Struct({ + page: S.NumberFromString, + }) + + const route = app.get('/page', effectValidator('query', querySchema), (c) => { + const { page } = c.req.valid('query') + return c.json({ page }) + }) + + type Actual = ExtractSchema + type Expected = { + '/page': { + $get: { + input: { + query: { + page: string | string[] + } + } + output: { + page: number + } + outputFormat: 'json' + status: StatusCode + } + } + } + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + type verify = Expect> + + it('Should return 200 response', async () => { + const res = await app.request('/page?page=123') + expect(res).not.toBeNull() + expect(res.status).toBe(200) + expect(await res.json()).toEqual({ + page: 123, + }) + }) +}) diff --git a/packages/effect-validator/tsconfig.json b/packages/effect-validator/tsconfig.json new file mode 100644 index 00000000..7a3469bf --- /dev/null +++ b/packages/effect-validator/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "./src", + "exactOptionalPropertyTypes": true + }, + "include": [ + "src/**/*.ts" + ], +} \ No newline at end of file diff --git a/packages/effect-validator/vitest.config.ts b/packages/effect-validator/vitest.config.ts new file mode 100644 index 00000000..17b54e48 --- /dev/null +++ b/packages/effect-validator/vitest.config.ts @@ -0,0 +1,8 @@ +/// +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + globals: true, + }, +}) diff --git a/yarn.lock b/yarn.lock index c4fa943f..ab9d3701 100644 --- a/yarn.lock +++ b/yarn.lock @@ -22,6 +22,16 @@ __metadata: languageName: node linkType: hard +"@ampproject/remapping@npm:^2.3.0": + version: 2.3.0 + resolution: "@ampproject/remapping@npm:2.3.0" + dependencies: + "@jridgewell/gen-mapping": "npm:^0.3.5" + "@jridgewell/trace-mapping": "npm:^0.3.24" + checksum: 81d63cca5443e0f0c72ae18b544cc28c7c0ec2cea46e7cb888bb0e0f411a1191d0d6b7af798d54e30777d8d1488b2ec0732aac2be342d3d7d3ffd271c6f489ed + languageName: node + linkType: hard + "@apidevtools/json-schema-ref-parser@npm:^9.0.3": version: 9.1.2 resolution: "@apidevtools/json-schema-ref-parser@npm:9.1.2" @@ -1002,6 +1012,17 @@ __metadata: languageName: node linkType: hard +"@effect/schema@npm:^0.68.21": + version: 0.68.21 + resolution: "@effect/schema@npm:0.68.21" + dependencies: + fast-check: "npm:^3.19.0" + peerDependencies: + effect: ^3.5.1 + checksum: 127b4b89ce637c9be1dc84d933cefd63fdbf30f1fad9acf656c32a19df41875b646f2775129b331db9090f198a08f67f3ffe277af914a157a0c6711f3669b9a7 + languageName: node + linkType: hard + "@emnapi/runtime@npm:^0.44.0": version: 0.44.0 resolution: "@emnapi/runtime@npm:0.44.0" @@ -2007,6 +2028,22 @@ __metadata: languageName: unknown linkType: soft +"@hono/effect-validator@workspace:packages/effect-validator": + version: 0.0.0-use.local + resolution: "@hono/effect-validator@workspace:packages/effect-validator" + dependencies: + "@effect/schema": "npm:^0.68.21" + effect: "npm:^3.4.8" + hono: "npm:^4.4.13" + tsup: "npm:^8.1.0" + typescript: "npm:^5.5.3" + vitest: "npm:^2.0.1" + peerDependencies: + "@effect/schema": ">=0.68.18" + hono: ">=4.4.13" + languageName: unknown + linkType: soft + "@hono/esbuild-transpiler@workspace:packages/esbuild-transpiler": version: 0.0.0-use.local resolution: "@hono/esbuild-transpiler@workspace:packages/esbuild-transpiler" @@ -3095,6 +3132,17 @@ __metadata: languageName: node linkType: hard +"@jridgewell/gen-mapping@npm:^0.3.5": + version: 0.3.5 + resolution: "@jridgewell/gen-mapping@npm:0.3.5" + dependencies: + "@jridgewell/set-array": "npm:^1.2.1" + "@jridgewell/sourcemap-codec": "npm:^1.4.10" + "@jridgewell/trace-mapping": "npm:^0.3.24" + checksum: 1be4fd4a6b0f41337c4f5fdf4afc3bd19e39c3691924817108b82ffcb9c9e609c273f936932b9fba4b3a298ce2eb06d9bff4eb1cc3bd81c4f4ee1b4917e25feb + languageName: node + linkType: hard + "@jridgewell/resolve-uri@npm:^3.0.3": version: 3.1.2 resolution: "@jridgewell/resolve-uri@npm:3.1.2" @@ -3116,6 +3164,13 @@ __metadata: languageName: node linkType: hard +"@jridgewell/set-array@npm:^1.2.1": + version: 1.2.1 + resolution: "@jridgewell/set-array@npm:1.2.1" + checksum: 2a5aa7b4b5c3464c895c802d8ae3f3d2b92fcbe84ad12f8d0bfbb1f5ad006717e7577ee1fd2eac00c088abe486c7adb27976f45d2941ff6b0b92b2c3302c60f4 + languageName: node + linkType: hard + "@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14, @jridgewell/sourcemap-codec@npm:^1.4.15": version: 1.4.15 resolution: "@jridgewell/sourcemap-codec@npm:1.4.15" @@ -3143,6 +3198,16 @@ __metadata: languageName: node linkType: hard +"@jridgewell/trace-mapping@npm:^0.3.24": + version: 0.3.25 + resolution: "@jridgewell/trace-mapping@npm:0.3.25" + dependencies: + "@jridgewell/resolve-uri": "npm:^3.1.0" + "@jridgewell/sourcemap-codec": "npm:^1.4.14" + checksum: 3d1ce6ebc69df9682a5a8896b414c6537e428a1d68b02fcc8363b04284a8ca0df04d0ee3013132252ab14f2527bc13bea6526a912ecb5658f0e39fd2860b4df4 + languageName: node + linkType: hard + "@jsdevtools/ono@npm:^7.1.3": version: 7.1.3 resolution: "@jsdevtools/ono@npm:7.1.3" @@ -4721,6 +4786,17 @@ __metadata: languageName: node linkType: hard +"@vitest/expect@npm:2.0.1": + version: 2.0.1 + resolution: "@vitest/expect@npm:2.0.1" + dependencies: + "@vitest/spy": "npm:2.0.1" + "@vitest/utils": "npm:2.0.1" + chai: "npm:^5.1.1" + checksum: 75c82f9f2fc11d96cca342ef15c448254e37174f7cbf526cc533a0545074efc91528cd5247e07f07a787f4b2f4e2d76089ebbdd217214e1811844b9b35256297 + languageName: node + linkType: hard + "@vitest/runner@npm:0.34.6": version: 0.34.6 resolution: "@vitest/runner@npm:0.34.6" @@ -4787,6 +4863,16 @@ __metadata: languageName: node linkType: hard +"@vitest/runner@npm:2.0.1": + version: 2.0.1 + resolution: "@vitest/runner@npm:2.0.1" + dependencies: + "@vitest/utils": "npm:2.0.1" + pathe: "npm:^1.1.2" + checksum: 2e1da08c4739fd48aaae3f163d785a0a9cc3789072c8722575e7d2abe51efb6c1ce9666b71f9ac16e628964173b0c52777178241ca0889066227b739206e5060 + languageName: node + linkType: hard + "@vitest/snapshot@npm:0.34.6": version: 0.34.6 resolution: "@vitest/snapshot@npm:0.34.6" @@ -4853,6 +4939,17 @@ __metadata: languageName: node linkType: hard +"@vitest/snapshot@npm:2.0.1": + version: 2.0.1 + resolution: "@vitest/snapshot@npm:2.0.1" + dependencies: + magic-string: "npm:^0.30.10" + pathe: "npm:^1.1.2" + pretty-format: "npm:^29.7.0" + checksum: 0bcddbd0f52d82ec3852eba010d382896bfca3171a7f7aaa61bc2380f3d4360e78eee09bbd02cbb3117dd2476aaecee2942f12d2fa74e80e2623b271eb3e1211 + languageName: node + linkType: hard + "@vitest/spy@npm:0.34.6": version: 0.34.6 resolution: "@vitest/spy@npm:0.34.6" @@ -4907,6 +5004,15 @@ __metadata: languageName: node linkType: hard +"@vitest/spy@npm:2.0.1": + version: 2.0.1 + resolution: "@vitest/spy@npm:2.0.1" + dependencies: + tinyspy: "npm:^3.0.0" + checksum: b9ed4a306dba9517a51db666516a22e96d37c637b1f3782e89e714f9db4f1db1d8e878e0f49e6e4bec22b8a911b09d36337d7887ef68a004d15bc97e2afee1e6 + languageName: node + linkType: hard + "@vitest/utils@npm:0.34.6": version: 0.34.6 resolution: "@vitest/utils@npm:0.34.6" @@ -4977,6 +5083,18 @@ __metadata: languageName: node linkType: hard +"@vitest/utils@npm:2.0.1": + version: 2.0.1 + resolution: "@vitest/utils@npm:2.0.1" + dependencies: + diff-sequences: "npm:^29.6.3" + estree-walker: "npm:^3.0.3" + loupe: "npm:^3.1.1" + pretty-format: "npm:^29.7.0" + checksum: 1a49f72f4ba3b33d3b44a73dbddb50cc7472fc96024f375e697e5a669c38b865e40a045de29553cabcb17f604120e875cd2645ace9bc676e3594f82e3a4cff36 + languageName: node + linkType: hard + "@yarnpkg/lockfile@npm:^1.1.0": version: 1.1.0 resolution: "@yarnpkg/lockfile@npm:1.1.0" @@ -5483,6 +5601,13 @@ __metadata: languageName: node linkType: hard +"assertion-error@npm:^2.0.1": + version: 2.0.1 + resolution: "assertion-error@npm:2.0.1" + checksum: bbbcb117ac6480138f8c93cf7f535614282dea9dc828f540cdece85e3c665e8f78958b96afac52f29ff883c72638e6a87d469ecc9fe5bc902df03ed24a55dba8 + languageName: node + linkType: hard + "ast-types@npm:^0.13.4": version: 0.13.4 resolution: "ast-types@npm:0.13.4" @@ -6172,6 +6297,19 @@ __metadata: languageName: node linkType: hard +"chai@npm:^5.1.1": + version: 5.1.1 + resolution: "chai@npm:5.1.1" + dependencies: + assertion-error: "npm:^2.0.1" + check-error: "npm:^2.1.1" + deep-eql: "npm:^5.0.1" + loupe: "npm:^3.1.0" + pathval: "npm:^2.0.0" + checksum: e7f00e5881e3d5224f08fe63966ed6566bd9fdde175863c7c16dd5240416de9b34c4a0dd925f4fd64ad56256ca6507d32cf6131c49e1db65c62578eb31d4566c + languageName: node + linkType: hard + "chalk@npm:^1.0.0, chalk@npm:^1.1.3": version: 1.1.3 resolution: "chalk@npm:1.1.3" @@ -6264,6 +6402,13 @@ __metadata: languageName: node linkType: hard +"check-error@npm:^2.1.1": + version: 2.1.1 + resolution: "check-error@npm:2.1.1" + checksum: 979f13eccab306cf1785fa10941a590b4e7ea9916ea2a4f8c87f0316fc3eab07eabefb6e587424ef0f88cbcd3805791f172ea739863ca3d7ce2afc54641c7f0e + languageName: node + linkType: hard + "chokidar@npm:^3.0.2, chokidar@npm:^3.4.2, chokidar@npm:^3.5.1": version: 3.5.3 resolution: "chokidar@npm:3.5.3" @@ -7035,6 +7180,18 @@ __metadata: languageName: node linkType: hard +"debug@npm:^4.3.5": + version: 4.3.5 + resolution: "debug@npm:4.3.5" + dependencies: + ms: "npm:2.1.2" + peerDependenciesMeta: + supports-color: + optional: true + checksum: 082c375a2bdc4f4469c99f325ff458adad62a3fc2c482d59923c260cb08152f34e2659f72b3767db8bb2f21ca81a60a42d1019605a412132d7b9f59363a005cc + languageName: node + linkType: hard + "decamelize-keys@npm:^1.1.0": version: 1.1.1 resolution: "decamelize-keys@npm:1.1.1" @@ -7107,6 +7264,13 @@ __metadata: languageName: node linkType: hard +"deep-eql@npm:^5.0.1": + version: 5.0.2 + resolution: "deep-eql@npm:5.0.2" + checksum: 7102cf3b7bb719c6b9c0db2e19bf0aa9318d141581befe8c7ce8ccd39af9eaa4346e5e05adef7f9bd7015da0f13a3a25dcfe306ef79dc8668aedbecb658dd247 + languageName: node + linkType: hard + "deep-extend@npm:^0.6.0": version: 0.6.0 resolution: "deep-extend@npm:0.6.0" @@ -7440,6 +7604,13 @@ __metadata: languageName: node linkType: hard +"effect@npm:^3.4.8": + version: 3.4.8 + resolution: "effect@npm:3.4.8" + checksum: 951962386775fa8506a6bfae75dc2802b00557dc58d9aecc7dff552c2e01ba651b87d662bdbf1f7c5ba1e450bc1a58f6daf44628222b0260471c5b52e0e76a8f + languageName: node + linkType: hard + "electron-to-chromium@npm:^1.4.601": version: 1.4.614 resolution: "electron-to-chromium@npm:1.4.614" @@ -8748,6 +8919,15 @@ __metadata: languageName: node linkType: hard +"fast-check@npm:^3.19.0": + version: 3.19.0 + resolution: "fast-check@npm:3.19.0" + dependencies: + pure-rand: "npm:^6.1.0" + checksum: 5a15484d380fb5a3e94ec951c97e59b940ac4f2e1f3f7a05578d67851e5cb5283121bcf08c57e3238bc85899ce691b47ab477a6dd481a6f520e2e7ab4952d1ee + languageName: node + linkType: hard + "fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3": version: 3.1.3 resolution: "fast-deep-equal@npm:3.1.3" @@ -9979,6 +10159,13 @@ __metadata: languageName: node linkType: hard +"hono@npm:^4.4.13": + version: 4.4.13 + resolution: "hono@npm:4.4.13" + checksum: 213c09eafa4d82dfa6b6326fd37e8f0d17753ece62581ea849ec0eb87b0984a721389a0d8480f64dbef564d3fa49cc6031603374f326cb48ad4bc9eb9496e876 + languageName: node + linkType: hard + "hosted-git-info@npm:^2.1.4": version: 2.8.9 resolution: "hosted-git-info@npm:2.8.9" @@ -12746,6 +12933,15 @@ __metadata: languageName: node linkType: hard +"loupe@npm:^3.1.0, loupe@npm:^3.1.1": + version: 3.1.1 + resolution: "loupe@npm:3.1.1" + dependencies: + get-func-name: "npm:^2.0.1" + checksum: 99f88badc47e894016df0c403de846fedfea61154aadabbf776c8428dd59e8d8378007135d385d737de32ae47980af07d22ba7bec5ef7beebd721de9baa0a0af + languageName: node + linkType: hard + "lower-case@npm:^2.0.2": version: 2.0.2 resolution: "lower-case@npm:2.0.2" @@ -12829,6 +13025,15 @@ __metadata: languageName: node linkType: hard +"magic-string@npm:^0.30.10": + version: 0.30.10 + resolution: "magic-string@npm:0.30.10" + dependencies: + "@jridgewell/sourcemap-codec": "npm:^1.4.15" + checksum: aa9ca17eae571a19bce92c8221193b6f93ee8511abb10f085e55ffd398db8e4c089a208d9eac559deee96a08b7b24d636ea4ab92f09c6cf42a7d1af51f7fd62b + languageName: node + linkType: hard + "make-dir@npm:^3.0.0": version: 3.1.0 resolution: "make-dir@npm:3.1.0" @@ -15038,6 +15243,13 @@ __metadata: languageName: node linkType: hard +"pathe@npm:^1.1.2": + version: 1.1.2 + resolution: "pathe@npm:1.1.2" + checksum: 64ee0a4e587fb0f208d9777a6c56e4f9050039268faaaaecd50e959ef01bf847b7872785c36483fa5cdcdbdfdb31fef2ff222684d4fc21c330ab60395c681897 + languageName: node + linkType: hard + "pathval@npm:^1.1.1": version: 1.1.1 resolution: "pathval@npm:1.1.1" @@ -15045,6 +15257,13 @@ __metadata: languageName: node linkType: hard +"pathval@npm:^2.0.0": + version: 2.0.0 + resolution: "pathval@npm:2.0.0" + checksum: 602e4ee347fba8a599115af2ccd8179836a63c925c23e04bd056d0674a64b39e3a081b643cc7bc0b84390517df2d800a46fcc5598d42c155fe4977095c2f77c5 + languageName: node + linkType: hard + "periscopic@npm:^3.0.0": version: 3.1.0 resolution: "periscopic@npm:3.1.0" @@ -15063,6 +15282,13 @@ __metadata: languageName: node linkType: hard +"picocolors@npm:^1.0.1": + version: 1.0.1 + resolution: "picocolors@npm:1.0.1" + checksum: c63cdad2bf812ef0d66c8db29583802355d4ca67b9285d846f390cc15c2f6ccb94e8cb7eb6a6e97fc5990a6d3ad4ae42d86c84d3146e667c739a4234ed50d400 + languageName: node + linkType: hard + "picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.3, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" @@ -15525,6 +15751,13 @@ __metadata: languageName: node linkType: hard +"pure-rand@npm:^6.1.0": + version: 6.1.0 + resolution: "pure-rand@npm:6.1.0" + checksum: 1abe217897bf74dcb3a0c9aba3555fe975023147b48db540aa2faf507aee91c03bf54f6aef0eb2bf59cc259a16d06b28eca37f0dc426d94f4692aeff02fb0e65 + languageName: node + linkType: hard + "qs@npm:6.11.0": version: 6.11.0 resolution: "qs@npm:6.11.0" @@ -17422,6 +17655,13 @@ __metadata: languageName: node linkType: hard +"tinybench@npm:^2.8.0": + version: 2.8.0 + resolution: "tinybench@npm:2.8.0" + checksum: 5a9a642351fa3e4955e0cbf38f5674be5f3ba6730fd872fd23a5c953ad6c914234d5aba6ea41ef88820180a81829ceece5bd8d3967c490c5171bca1141c2f24d + languageName: node + linkType: hard + "tinypool@npm:^0.7.0": version: 0.7.0 resolution: "tinypool@npm:0.7.0" @@ -17450,6 +17690,13 @@ __metadata: languageName: node linkType: hard +"tinypool@npm:^1.0.0": + version: 1.0.0 + resolution: "tinypool@npm:1.0.0" + checksum: 71b20b9c54366393831c286a0772380c20f8cad9546d724c484edb47aea3228f274c58e98cf51d28c40869b39f5273209ef3ea94a9d2a23f8b292f4731cd3e4e + languageName: node + linkType: hard + "tinyspy@npm:^2.1.1, tinyspy@npm:^2.2.0": version: 2.2.0 resolution: "tinyspy@npm:2.2.0" @@ -17457,6 +17704,13 @@ __metadata: languageName: node linkType: hard +"tinyspy@npm:^3.0.0": + version: 3.0.0 + resolution: "tinyspy@npm:3.0.0" + checksum: eb0dec264aa5370efd3d29743825eb115ed7f1ef8a72a431e9a75d5c9e7d67e99d04b0d61d86b8cd70c79ec27863f241ad0317bc453f78762e0cbd76d2c332d0 + languageName: node + linkType: hard + "tmp@npm:^0.0.33": version: 0.0.33 resolution: "tmp@npm:0.0.33" @@ -18079,6 +18333,16 @@ __metadata: languageName: node linkType: hard +"typescript@npm:^5.5.3": + version: 5.5.3 + resolution: "typescript@npm:5.5.3" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: f52c71ccbc7080b034b9d3b72051d563601a4815bf3e39ded188e6ce60813f75dbedf11ad15dd4d32a12996a9ed8c7155b46c93a9b9c9bad1049766fe614bbdd + languageName: node + linkType: hard + "typescript@patch:typescript@npm%3A^4.7.4#optional!builtin": version: 4.9.5 resolution: "typescript@patch:typescript@npm%3A4.9.5#optional!builtin::version=4.9.5&hash=289587" @@ -18109,6 +18373,16 @@ __metadata: languageName: node linkType: hard +"typescript@patch:typescript@npm%3A^5.5.3#optional!builtin": + version: 5.5.3 + resolution: "typescript@patch:typescript@npm%3A5.5.3#optional!builtin::version=5.5.3&hash=e012d7" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 5a437c416251334deeaf29897157032311f3f126547cfdc4b133768b606cb0e62bcee733bb97cf74c42fe7268801aea1392d8e40988cdef112e9546eba4c03c5 + languageName: node + linkType: hard + "typia@npm:^5.0.4": version: 5.3.5 resolution: "typia@npm:5.3.5" @@ -18706,6 +18980,21 @@ __metadata: languageName: node linkType: hard +"vite-node@npm:2.0.1": + version: 2.0.1 + resolution: "vite-node@npm:2.0.1" + dependencies: + cac: "npm:^6.7.14" + debug: "npm:^4.3.5" + pathe: "npm:^1.1.2" + picocolors: "npm:^1.0.1" + vite: "npm:^5.0.0" + bin: + vite-node: vite-node.mjs + checksum: c3a3196c17c1069f31aeb81dedbbf5d571fb362a24c3c170ada23271874a214184fcfc55a9a593483431dd862d0e1a8a115590e594666e50532c03f5680fd8e2 + languageName: node + linkType: hard + "vite@npm:^3.0.0 || ^4.0.0 || ^5.0.0-0, vite@npm:^3.1.0 || ^4.0.0 || ^5.0.0-0, vite@npm:^5.0.0": version: 5.0.10 resolution: "vite@npm:5.0.10" @@ -19097,6 +19386,54 @@ __metadata: languageName: node linkType: hard +"vitest@npm:^2.0.1": + version: 2.0.1 + resolution: "vitest@npm:2.0.1" + dependencies: + "@ampproject/remapping": "npm:^2.3.0" + "@vitest/expect": "npm:2.0.1" + "@vitest/runner": "npm:2.0.1" + "@vitest/snapshot": "npm:2.0.1" + "@vitest/spy": "npm:2.0.1" + "@vitest/utils": "npm:2.0.1" + chai: "npm:^5.1.1" + debug: "npm:^4.3.5" + execa: "npm:^8.0.1" + magic-string: "npm:^0.30.10" + pathe: "npm:^1.1.2" + picocolors: "npm:^1.0.1" + std-env: "npm:^3.7.0" + tinybench: "npm:^2.8.0" + tinypool: "npm:^1.0.0" + vite: "npm:^5.0.0" + vite-node: "npm:2.0.1" + why-is-node-running: "npm:^2.2.2" + peerDependencies: + "@edge-runtime/vm": "*" + "@types/node": ^18.0.0 || >=20.0.0 + "@vitest/browser": 2.0.1 + "@vitest/ui": 2.0.1 + happy-dom: "*" + jsdom: "*" + peerDependenciesMeta: + "@edge-runtime/vm": + optional: true + "@types/node": + optional: true + "@vitest/browser": + optional: true + "@vitest/ui": + optional: true + happy-dom: + optional: true + jsdom: + optional: true + bin: + vitest: vitest.mjs + checksum: c6bc72bb347880a2938e395ee127543aff366e030a21248f0389e1b894cae7856c9aae25c1764d4425ba9199a5376b3127cb61c47c67443f999ca0bd01895fc5 + languageName: node + linkType: hard + "walker@npm:^1.0.8": version: 1.0.8 resolution: "walker@npm:1.0.8"