diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index ae27c75..0000000 --- a/.eslintignore +++ /dev/null @@ -1,18 +0,0 @@ -.github -.vscode - -coverage -dist -docs -node_modules -storybook-static - -.eslintrc.js -.prettierrc.js -babel.config.js -fallback-react.d.ts -tailwind.config.js -postcss.config.js -tsconfig.json - -.cobaco diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index afb71ad..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,213 +0,0 @@ -/** - * @type {import('@typescript-eslint/experimental-utils').TSESLint.Linter.Config} - */ -const config = { - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'prettier' - ], - globals: { - es2020: true - }, - plugins: ['import'], - rules: { - /** - * 'max-lines' .. error - * - * 各ファイルは 150 行を上限とする. このカウントにコメントや空行は含めない. - */ - 'max-lines': [ - 'error', - { - max: 150, - skipComments: true, - skipBlankLines: true - } - ], - - /** - * 'max-lines-per-function' .. error - * - * function は 50 行を上限とする. このカウントにコメントや空行は含めない. - */ - 'max-lines-per-function': [ - 'error', - { - skipBlankLines: true, - skipComments: true - } - ], - - /** - * 'max-statements' .. warning - * - * function 内で定義する statement (e.g. `var` `let` `const`) は 10 個を超える場合は警告とする. - * 単純に冗長な手続きを書かざるを得ない場合などがあり、このルールは厳密に守ることが出来ない. - * 言い換えれば、このケースで警告が出ている場合は、 "複雑なコード" であることを意識すること. - * - * e.g. - * ```ts - * function foo() { - * var foo1 = 1; - * var foo2 = 2; - * var foo3 = 3; - * var foo4 = 4; - * var foo5 = 5; - * var foo6 = 6; - * var foo7 = 7; - * var foo8 = 8; - * var foo9 = 9; - * var foo10 = 10; - * - * var foo11 = 11; // Too many. - * } - * ``` - */ - 'max-statements': ['warn', { max: 20 }], - - /** - * 'no-else-return' .. error - * else ブロック及び、 else-if ブロックにおける return を禁止する. - * 具体的には、以下の書き方が正となる - * - * e.g. - * ```ts - * function hoge() { - * if (conditionA) { - * return 1 - * } - * if (conditionB) { - * return 2 - * } - * - * return 3 - * } - * ``` - */ - 'no-else-return': ['error', { allowElseIf: false }], - - /** - * 'max-depth' .. error (max 4 -> 3) - * - * 入れ子のレベルを最大 3 段階に制限する. - * 深ければ深いほど可読性が悪化するため. - * - * e.g. - * ```ts - * function hoge() { - * if (true) { - * // Nested 1 deep - * if (true) { - * // Nested 2 deep - * if (true) { - * // Nested 3 deep - * if (true) { - * // Nested 4 deep (ERROR!) - * } - * } - * } - * } - * } - * ``` - */ - 'max-depth': [ - 'error', - { - max: 3 - } - ], - - /** - * '@typescript-eslint/array-type' .. array-simple モード - * TSでArrayを記載する際に、 シンプルな型なら Hoge[] を強制、複雑な型なら Array<...> を強制する - */ - '@typescript-eslint/array-type': [ - 'warn', - { - default: 'array-simple' - } - ], - - /** - * '@typescript-eslint/explicit-module-boundary-types' .. warn - * すべての関数には、引数と返り値の型をつくりましょう。 - * (returnしないなら省略可能) - */ - '@typescript-eslint/explicit-module-boundary-types': 'warn', - - /** - * '@typescript-eslint/no-unused-vars' .. error - * 未使用の変数はすべて消しましょう。 - * ただし、 "_" から始まる変数名については "明示的に未使用である宣言として扱い" このルールを無効とする - */ - '@typescript-eslint/no-unused-vars': [ - 'error', - { - argsIgnorePattern: '^_', - ignoreRestSiblings: true - } - ], - - /** - * '@typescript-eslint/no-namespace' .. 無効化 - * TS の構文で namespace を使っても良い - * - * [背景] - * 使えたほうが便利なケースがある - */ - '@typescript-eslint/no-namespace': 'off', - - /** - * '@typescript-eslint/no-non-null-assertion' .. 無効化 - * 非nullアサーション構文の利用を禁止しない - * - * [背景] - * これを守り切るには高めのTS力が試されるため - */ - '@typescript-eslint/no-non-null-assertion': 'off', - - /** - * '@typescript-eslint/ban-types' .. 基本は error, ただし `{}` のみ許可 - * 非推奨の型の利用を禁止する (e.g. `string` ではなく `String`, Function, Object など) - * - * [背景] - * typescript 4.8 のリリース内容に合わせての対応 - * → https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/ - * - * `{}` とは、 null, undefined とは異なる任意の型であることを示す. - * 4.8 バージョンアップによって利便性が向上したため、利用を全面的に許可する - */ - '@typescript-eslint/ban-types': [ - 'error', - { - types: { - '{}': false - }, - extendDefaults: true - } - ], - - /** - * 'import/extensions' .. 一部の拡張子のみ、 import 文での拡張子の記載を強制する - * - * [背景] - * Nuxt Server Side Process にて、 js ファイルは拡張子がないと参照できないため. - */ - 'import/extensions': [ - 'error', - { - js: 'always', - mjs: 'always', - cjs: 'always', - json: 'always', - css: 'always', - sass: 'always', - scss: 'always', - vue: 'always' - } - ] - } -} - -module.exports = config diff --git a/.gitignore b/.gitignore index 727fd4d..8a02869 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,6 @@ dist .yarn/build-state.yml .yarn/install-state.gz .pnp.* + +# generated types +.astro diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index fbcd190..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,22 +0,0 @@ -repos: - - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.54.0 - hooks: - - id: eslint - - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.1.0 # use 2.8.0 - hooks: - - id: prettier - additional_dependencies: - - prettier@2.8.0 - - - repo: https://github.com/renovatebot/pre-commit-hooks - rev: 37.61.4 - hooks: - - id: renovate-config-validator - - - repo: https://github.com/rhysd/actionlint - rev: v1.6.26 - hooks: - - id: actionlint diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index ae27c75..0000000 --- a/.prettierignore +++ /dev/null @@ -1,18 +0,0 @@ -.github -.vscode - -coverage -dist -docs -node_modules -storybook-static - -.eslintrc.js -.prettierrc.js -babel.config.js -fallback-react.d.ts -tailwind.config.js -postcss.config.js -tsconfig.json - -.cobaco diff --git a/.prettierrc.cjs b/.prettierrc.cjs deleted file mode 100644 index 0901b5a..0000000 --- a/.prettierrc.cjs +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @type {import('prettier').Config} - */ -const config = { - semi: false, - arrowParens: 'always', - singleQuote: true, - trailingComma: 'none', - htmlWhitespaceSensitivity: 'ignore', - bracketSameLine: true, - singleAttributePerLine: true, - overrides: [ - { - files: '*.ts', - options: { - printWidth: 100 - } - } - ] -} -module.exports = config diff --git a/.vscode/project.code-workspace b/.vscode/project.code-workspace index 6251b09..5dca760 100644 --- a/.vscode/project.code-workspace +++ b/.vscode/project.code-workspace @@ -1,3 +1,46 @@ { - "folders": [{ "path": ".." }] + "folders": [{ "path": ".." }, { "path": "docs", "name": "@docs" }], + "extensions": { + "recommendations": [ + "astro-build.astro-vscode", + "DavidAnson.vscode-markdownlint", + "biomejs.biome", + "ZixuanChen.vitest-explorer" + ] + }, + "launch": { + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] + }, + "settings": { + "typescript.tsdk": "node_modules/typescript/lib", + + "[javascript]": { + "editor.defaultFormatter": "biomejs.biome" + }, + + "[typescript]": { + "editor.defaultFormatter": "biomejs.biome" + }, + + "[astro]": { + "editor.defaultFormatter": "biomejs.biome" + }, + + "editor.codeActionsOnSave": { + "quickfix.biome": "explicit", + "source.organizeImports.biome": "explicit" + }, + + "markdownlint.config": { + "no-duplicate-heading": false + } + } } diff --git a/docs/CONTROBUTING.md b/CONTROBUTING.md similarity index 100% rename from docs/CONTROBUTING.md rename to CONTROBUTING.md diff --git a/README.md b/README.md index 5877d15..dc20a27 100644 --- a/README.md +++ b/README.md @@ -3,21 +3,24 @@ [![Release](https://github.com/hacomono-lib/type-assurer/actions/workflows/release.yml/badge.svg)](https://github.com/hacomono-lib/type-assurer/actions/workflows/release.yml) [![Test](https://github.com/hacomono-lib/type-assurer/actions/workflows/test.yml/badge.svg)](https://github.com/hacomono-lib/type-assurer/actions/workflows/test.yml) -`type-assurer` is a TypeScript-first type checking library, providing compatibility with lodash's type guard functions while ensuring type safety. Designed with ESModules in mind, it allows for tree-shaking to minimize bundle sizes. +`type-assurer` is a TypeScript-first type checking library. Designed with ESModules in mind, it allows for tree-shaking to minimize bundle sizes. ## Features -- Compatible with lodash type guard functions - TypeScript-first implementation with accurate type inference - ESModule ready for tree-shaking and bundle size optimization - No external dependencies -- A collection of 7 type guard functions: - a. isString - Similar to lodash's type guard functions - b. assertString - Provides TypeScript's type assertion feature - c. ensureString - Evaluates the argument's type and returns the value if the type guard passes, otherwise throws an exception - d. fallbackString - Evaluates the first argument's type and returns the value if the type guard passes, otherwise returns the second argument's value +- 7 type guard functions: + a. `isFoo` (e.g. isString) - type guard functions + b. `assertFoo` (e.g. assertString) - Provides TypeScript's type assertion feature + c. `ensureFoo` (e.g. ensureString) - Evaluates the argument's type and returns the value if the type guard passes, otherwise throws an exception + d. `fallbackFoo` (e.g. fallbackString) - Evaluates the first argument's type and returns the value if the type guard passes, otherwise returns the second argument's value - The reversed versions - Generator provided for custom type guards for non-primitive types +- 2 type modification functions: + a. `coerceFoo` (e.g. coerceNumber) - Evaluates the argument's type and returns the value if the type guard passes, otherwise throws an exception + b. `fixFoo` (e.g. fixNumber) - Evaluates the first argument's type and returns the value if the type guard passes, otherwise returns the second argument's value + - If there is a type check for a parsable or modifiable value, there is a corresponding function. (e.g. NumberParsable, Jsonifiable, etc.) ## Installation @@ -31,15 +34,13 @@ The library provides 8 utility functions for each type guard, such as `isString` And, note that `fallbackNotNil` can be replaced with the `??` operator. Functions that can be simplified using standard JavaScript expressions, like this example, are not targeted for implementation. -### is, isNot +### is Functions such as `is` simply provide type guards that can be used in conditional branches. ```typescript import { isString } from 'type-assurer' -declare const value: unknown - if (isString(value)) { console.log(`This is a string: ${value}`) } else { @@ -52,13 +53,20 @@ Functions such as `isNot` are useful in cases that require a type guard function ```typescript import { isNotNil } from 'type-assurer' -declare const values: string | null - const result = values.filter(isNotNil) // ^? string[] ``` -### assert, assertNot +Also, type guard functions such as `isXxx` are implemented in the form of `not(isXxx)`. +If you have implemented your own type guard, you can use the `not` function directly. + +```typescript +import { not } from 'type-assurer' + +const result = values.filter(not(isFoo)) +``` + +### assert Functions with names like `assert` `assertNot` are type assertion functions. If the type check does not pass, it throws a TypeError. @@ -74,7 +82,7 @@ assertString(value, 'Value must be a string') // No error if value is a string, otherwise throws an error with the message "Value must be a string" ``` -### ensure, ensureNot +### ensure Functions with names like `ensure` `ensureNot` are type assertion functions, but return the same value if the type check passes. It is convenient to write type assertions on a single line. @@ -91,7 +99,7 @@ const value = ensureString(await fetchData(), 'Value must be a string') // No error if fetchData returns a string, otherwise throws an error with the message "Value must be a string" ``` -### fallback, fallbackNot +### fallback Functions like `fallback` `fallbackNot` are type modification functions. @@ -107,6 +115,45 @@ const value = fallbackString(await fetchData(), 'default') // Returns value if it's a string, otherwise returns the fallbackValue ``` +### coerce + +Functions like `coerce` are type modification functions. + +If there is a type check for a parsable or modifiable value, there is a corresponding function. (e.g. NumberParsable, Jsonifiable, etc.) + +This function returns the modifiable value if the type is parsable, otherwise it throws an exception. + +```typescript +import { coerceNumber } from 'type-assurer' + +const value1 = coerceNumber('123') +// ^? 123 + +const value2 = coerceNumber('abc') +// thrown TypeAssertionError +``` + +### fix + +Functions like `fix` are type modification functions. + +If there is a type check for a parsable or modifiable value, there is a corresponding function. (e.g. NumberParsable, Jsonifiable, etc.) + +This function returns the modifiable value if the type is parsable, otherwise it returns the fallback value specified in the second argument. + +```typescript +import { fixNumber } from 'type-assurer' + +const value1 = fixNumber('123') +// ^? 123 + +const value2 = fixNumber('abc') +// ^? NaN + +const value3 = fixNumber('abc', 0) +// ^? 0 +``` + ## Contributing Contributions are welcome! Please submit a pull request or open an issue to discuss any proposed changes or feature requests. diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..07838f2 --- /dev/null +++ b/biome.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.4.1/schema.json", + "files": { + "ignore": [ + "node_modules", + "coverage" + ] + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "all": true + } + }, + "formatter": { + "enabled": true, + "formatWithErrors": false, + "ignore": [], + "indentStyle": "space", + "indentWidth": 2, + "lineWidth": 120 + }, + "javascript": { + "formatter": { + "enabled": true, + "quoteStyle": "single", + "jsxQuoteStyle": "double", + "trailingComma": "all", + "semicolons": "asNeeded", + "arrowParentheses": "always", + "quoteProperties": "asNeeded" + } + } +} diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs new file mode 100644 index 0000000..7e813f8 --- /dev/null +++ b/docs/astro.config.mjs @@ -0,0 +1,44 @@ +// eslint-disable-next-line import/extensions +import { defineConfig } from 'astro/config' +import starlight from '@astrojs/starlight' + +export default defineConfig({ + integrations: [ + starlight({ + title: 'type-assurer', + social: { + github: 'https://github.com/hacomono-lib/type-assurer', + }, + sidebar: [ + { + label: 'Home', + link: '/', + }, + { + label: 'Introduction', + collapsed: false, + items: [ + { label: 'Getting Started', link: '/guides/start' }, + { label: 'Concepts', link: '/guides/concepts' }, + ], + }, + { + label: 'Reference', + collapsed: false, + items: [ + { + label: 'Common', + collapsed: false, + autogenerate: { directory: '/reference/common', collapsed: false }, + }, + { + label: 'Type Guards', + collapsed: false, + autogenerate: { directory: '/reference/typeGuards', collapsed: false }, + }, + ], + }, + ], + }), + ], +}) diff --git a/docs/public/favicon.svg b/docs/public/favicon.svg new file mode 100644 index 0000000..cba5ac1 --- /dev/null +++ b/docs/public/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/src/assets/houston.webp b/docs/src/assets/houston.webp new file mode 100644 index 0000000..930c164 Binary files /dev/null and b/docs/src/assets/houston.webp differ diff --git a/docs/src/content/config.ts b/docs/src/content/config.ts new file mode 100644 index 0000000..4624b9a --- /dev/null +++ b/docs/src/content/config.ts @@ -0,0 +1,7 @@ +import { defineCollection } from 'astro:content' +import { docsSchema, i18nSchema } from '@astrojs/starlight/schema' + +export const collections = { + docs: defineCollection({ schema: docsSchema() }), + i18n: defineCollection({ type: 'data', schema: i18nSchema() }), +} diff --git a/docs/src/content/docs/guides/concepts.md b/docs/src/content/docs/guides/concepts.md new file mode 100644 index 0000000..d3b2a7a --- /dev/null +++ b/docs/src/content/docs/guides/concepts.md @@ -0,0 +1,4 @@ +--- +title: Concept +description: type-assurer library concept +--- diff --git a/docs/src/content/docs/guides/start.md b/docs/src/content/docs/guides/start.md new file mode 100644 index 0000000..089ec5e --- /dev/null +++ b/docs/src/content/docs/guides/start.md @@ -0,0 +1,4 @@ +--- +title: Getting Started +description: Getting started with type-assurer library +--- diff --git a/docs/src/content/docs/index.mdx b/docs/src/content/docs/index.mdx new file mode 100644 index 0000000..f53a85b --- /dev/null +++ b/docs/src/content/docs/index.mdx @@ -0,0 +1,37 @@ +--- +title: type-assurer +description: A type guard / type assertion for TypeScript +template: splash +hero: + tagline: A type guard / type assertion for TypeScript + actions: + - text: Getting Started + link: /guides/start/ + icon: right-arrow + variant: primary + - text: Repository + link: https://github.com/hacomono-lib/type-assurer + icon: github +--- + +import { Card, CardGrid } from '@astrojs/starlight/components'; + +## Concepts + + + + TypeScript first implementation with accurate type inference. + + + + ES Modules and TypeScript allow for tree-shaking, so you can optimize your bundle size. + + + + No external dependencies, so you don't have to worry about security vulnerabilities. + + + + 7 types of guard, 2 types of assertion utilities are provided. + + diff --git a/docs/src/content/docs/reference/common/TypeAssertionError.md b/docs/src/content/docs/reference/common/TypeAssertionError.md new file mode 100644 index 0000000..7f01006 --- /dev/null +++ b/docs/src/content/docs/reference/common/TypeAssertionError.md @@ -0,0 +1,6 @@ +--- +title: TypeAssertionError +description: TypeAssertionError is an error that occurs when a type assertion fails. +--- + +test diff --git a/docs/src/content/docs/reference/typeGuards/date.md b/docs/src/content/docs/reference/typeGuards/date.md new file mode 100644 index 0000000..f323382 --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/date.md @@ -0,0 +1,3 @@ +=== +title: Date +--- diff --git a/docs/src/content/docs/reference/typeGuards/empty.md b/docs/src/content/docs/reference/typeGuards/empty.md new file mode 100644 index 0000000..133b9fa --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/empty.md @@ -0,0 +1,3 @@ +--- +title: empty +--- diff --git a/docs/src/content/docs/reference/typeGuards/function.md b/docs/src/content/docs/reference/typeGuards/function.md new file mode 100644 index 0000000..3951f69 --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/function.md @@ -0,0 +1,151 @@ +--- +title: function +description: A Type Guard Utility functions for checking if a value is a function. +--- +A Type Guard Utility functions for checking if a value is a function. + +## Example of return value + +| input | result | +| ----- | ------ | +| function
(e.g. `() => {}`) | true | +| function object
(e.g. `new Function()`) | true | +| async function
(e.g. `async () => {}`) | true | +| async function object
(e.g. `new Function()`) | true | +| generator function
(e.g. `function* () {}`) | true | +| generator function object
(e.g. `new Function()`) | true | +| async generator function
(e.g. `async function* () {}`) | true | +| async generator function object
(e.g. `new Function()`) | true | +| constructor
(e.g. `class Foo {}`) | true | +| other
(e.g. `'foo'`, `null`, `undefined`, `{}`, `[]`) | false | + +## isFunction + +A Type Guard function for checking if a value is a function. + +This function is determined by `typeof target === 'function'`. + +### Basic Usage + +```typescript +function isFunction(target: unknown): target is Function +``` + +#### params + +- `target` .. The value to check. + +#### returns + +- `true` .. When the value is a function. +- `false` .. When the value is not a function. + +### Examples + +```typescript +import { isFunction } from 'type-assurer' + +const value: unknown = () => {} + +if (isFunction(value)) { + // value is function +} else { + // value is unknown +} +``` + +## assertFunction + +A Type Assertion function for checking if a value is a function. + +### Basic Usage + +```typescript +function assertFunction(target: unknown, message?: ErrorMessage): asserts target is Function +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be thrown when the value is not a function. + +#### returns + +- `void` .. When the value is a function. + +#### throws + +- `TypeAssertionError` .. When the value is not a function. + +### Examples + +```typescript +import { assertFunction } from 'type-assurer' + +const value: unknown = () => {} + +assertFunction(value) +// When the value is not a function, TypeAssertionError is thrown. +// value is function +``` + +## ensureFunction + +Ensure that the value is a function. + +### Basic Usage + +```typescript +function ensureFunction(target: unknown, message?: ErrorMessage): Function +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be thrown when the value is not a function. + +#### returns + +- `Function` .. When the value is a function. + +### Examples + +```typescript +import { ensureFunction } from 'type-assurer' + +function getFunction() { return () => {} } + +const result = ensureFunction(getFunction()) +// When the value is not a function, TypeAssertionError is thrown. +// result is function +``` + +## fallbackFunction + +Fallback to the fallback function if the value is not a function. + +### Basic Usage + +```typescript +function fallbackFunction(target: unknown, fallback: Function): Function +``` + +#### params + +- `target` .. The value to check. +- `fallback` .. The fallback function. + +#### returns + +- `Function` .. When the value is a function. + +### Examples + +```typescript +import { fallbackFunction } from 'type-assurer' + +function getFunction() { return () => 'foo' } + +const result = fallbackFunction(getFunction(), () => 'bar') +// result is function +``` diff --git a/docs/src/content/docs/reference/typeGuards/json-parsable.md b/docs/src/content/docs/reference/typeGuards/json-parsable.md new file mode 100644 index 0000000..e26900c --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/json-parsable.md @@ -0,0 +1,241 @@ +--- +title: JSON-parsable +description: Type Guards and Type Assertions for JSON-parsable. +--- + +A Type Guard and Type Assertion functions for checking if a value is a JSON-parsable. + +"JSON-parsable" means that the value is a JSON or JSON parsable string using `JSON.parse()`. + +## Example of return value + +| input | example input | result | parsed result | +| ----- | -------------- | ------ | ------------- | +| number string | `'0'` | true | `0` | +| ^ | `'0123'` | true | `123` | +| ^ | `'1.1'` | true | `1.1` | +| ^ | `'Infinity'` | false | no result | +| boolean string | `'true'` | true | `true` | +| ^ | `'false'` | true | `false` | +| null string | `'null'` | true | `null` | +| json-object string | `'{}'` | true | `{}` | +| ^ | `'{"foo":"bar"}'` | true | `{ foo: 'bar' }` | +| ^ | `'{"foo":undefined}'` | false | no result | +| ^ | `'{"foo":() => 'bar'}'` | false | no result | +| ^ | `'[1, 2, 3]'` | true | `[1, 2, 3]` | + +## isJSONParsable + +A Type Guard function for checking if a value is a JSON-parsable. + +### Basic Usage + +```typescript +function isJSONParsable(target: unknown): target is JSONParsable +``` + +#### params + +- `target` .. The value to check. + +#### returns + +- `true` .. When the value is a JSON-parsable. +- `false` .. When the value is not a JSON-parsable. + +### Examples + +```typescript +import { isJSONParsable } from 'type-assurer' + +const value = '{"foo":"bar"}' +if (isJSONParsable(value)) { + // this is true, value is JSONParsable +} +``` + +## assertJSONParsable + +A Type Assertion function for checking if a value is a JSON-parsable. + +### Basic Usage + +```typescript +function assertJSONParsable(target: unknown, message?: ErrorMessage): asserts target is JSONParsable +``` + +#### params + +- `target` .. The value to check. +- `message` .. The error message to throw when the value is not a JSON-parsable. + +#### returns + +- `void` .. When the value is a JSON-parsable. + +#### throws + +- `TypeAssertionError` .. When the value is not a JSON-parsable. + +### Examples + +```typescript +import { assertJSONParsable } from 'type-assurer' + +const value = '{"foo":"bar"}' +assertJSONParsable(value) +// When the value is not a JSON-parsable, TypeAssertionError is thrown. +// value is JSONParsable +``` + +## ensureJSONParsable + +Ensure that the value is a JSON-parsable. + +### Basic Usage + +```typescript +function ensureJSONParsable(target: unknown, message?: ErrorMessage): JSONParsable +``` + +#### params + +- `target` .. The value to check. +- `message` .. The error message to throw when the value is not a JSON-parsable. + +#### returns + +- `JSONParsable` .. When the value is a JSON-parsable. + +#### throws + +- `TypeAssertionError` .. When the value is not a JSON-parsable. + +### Examples + +```typescript +import { ensureJSONParsable } from 'type-assurer' + +function getValue() { return '{"foo":"bar"}' } + +const value = ensureJSONParsable(getValue()) +// When the value is not a JSON-parsable, TypeAssertionError is thrown. +// value is JSONParsable +``` + +## fallbackJSONParsable + +Fallback to the default value if the value is not a JSON-parsable. + +### Basic Usage + +```typescript +function fallbackJSONParsable(target: unknown, fallback: JSONParsable): JSONParsable +``` + +#### params + +- `target` .. The value to check. +- `fallback` .. The default value to return if the value is not a JSON-parsable. + +#### returns + +- `JSONParsable` .. When the value is a JSON-parsable. Otherwise, the fallback value. + +### Examples + +```typescript +import { fallbackJSONParsable } from 'type-assurer' + +function getValue() { return '{"foo":"bar"}' } + +const value = fallbackJSONParsable(getValue(), { baz: 'qux' }) +// When the value is not a JSON-parsable, value is { baz: 'qux' } +``` + +## coerceJSON + +Coerce the value to a JSON if it is a JSON like object or JSON parsable string. +Otherwise, throw an error. + +If the value is a string, check with `isJSONParsable` and return the result of `JSON.parse`. +If the value is not a string, check with `isJSON` and return the same value if it is true. + +### Basic Usage + +```typescript +function coerceJSON(target: unknown, message?: ErrorMessage): JSON +``` + +#### params + +- `target` .. The value to coerce to a JSON. +- `message` .. The error message to throw when the value is not a JSON. + +#### returns + +- `JSON` .. When the value is a JSON. + +#### throws + +- `TypeAssertionError` .. When the value cannot be coerced to a JSON. + +### Examples + +```typescript +import { coerceJSON } from 'type-assurer' + +function getValue() { return '{"foo":"bar"}' } + +const value = coerceJSON(getValue()) +// value is { foo: 'bar' } + +function getValue2() { return { foo: 'bar' } } + +const value2 = coerceJSON(getValue2()) +// value2 is { foo: 'bar' } +``` + +## fixJSON + +Fix the value to a JSON if it is a JSON like object or JSON parsable string. +Otherwise, return the default value. + +If the value is a string, check with `isJSONParsable` and return the result of `JSON.parse`. +If the value is not a string, check with `isJSON` and return the same value if it is true. + +### Basic Usage + +```typescript +function fixJSON(target: unknown, fallback: JSON): JSON +``` + +#### params + +- `target` .. The value to fix to a JSON. +- `fallback` .. The default value to return if the value is not a JSON. + +#### returns + +- `JSON` .. When the value is a JSON. Otherwise, the fallback value. + +### Examples + +```typescript +import { fixJSON } from 'type-assurer' + +function getValue() { return '{"foo":"bar"}' } + +const value = fixJSON(getValue(), {}) +// value is { foo: 'bar' } + +function getValue2() { return { foo: 'bar' } } + +const value2 = fixJSON(getValue2(), {}) +// value2 is { foo: 'bar' } + +function getValue3() { return 'foo' } + +const value3 = fixJSON(getValue3(), {}) +// value3 is {} +``` diff --git a/docs/src/content/docs/reference/typeGuards/json.md b/docs/src/content/docs/reference/typeGuards/json.md new file mode 100644 index 0000000..0a0fa48 --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/json.md @@ -0,0 +1,265 @@ +--- +title: JSON +description: A Type Guard Utility functions for checking if a value is JSON like +--- +A Type Guard Utility functions for checking if a value is JSON like. + +"JSON like" means a value that can be converted to a JSON object string using `JSON.stringify` without missing object members, or a value that can be converted to a JSON primitive value. + +:::note +If the value is an object, it checks whether the result of `JSON.parse(JSON.stringify(value))` is exactly the same as the original object. + +If the object has a method, it will not be included in the result of `JSON.stringify`, so it will not match exactly. + +However, [WellKnown Symbols](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Symbol#well-known_symbol) are not included in the result of JSON.stringify and are not referenced, so they are not included in this check. + +Also, if there is a [toJSON](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#tojson_%E3%81%AE%E6%8C%99%E5%8B%95) method at the root, it checks the result of that method. + +e.g. + +```typescript +const sample1 = { + foo: 'bar', +} +// this is true + +const sample2 = { + foo: 'bar', + // methods are not included in the result of JSON.stringify, + // so returns false + baz() { return 'qux' } +} +// this is false + +const sample3 = { + foo: 'bar', + // if there is a toJSON method at the root, + // it checks the result of that method + toJSON() { return 'baz' } +} +// this is true + +const sample4 = { + foo: 'bar', + // WellKnown Symbols are not included in the result of JSON.stringify + // and are not referenced, so they are not included in this check + [Symbol.toPrimitive]() { return 'baz' }, +} +// this is true +``` + +::: + +## Example of return value + +| input | example input | result | +| ----- | -------------- | ------ | +| boolean | `true` | true | +| ^ | `false` | true | +| number | `0` | true | +| ^ | `1` | true | +| ^ | `1.1` | true | +| not-finite number | `Infinity` | false | +| ^ | `-Infinity` | false | +| ^ | `NaN` | false | +| string | `'foo'` | false | +| null | `null` | true | +| undefined | `undefined` | false | +| symbol | `Symbol('foo')` | false | +| bigint | `0n` | false | +| object | `{}` | true | +| ^ | `{ foo: 'bar' }` | true | +| ^ | `{ foo: undefined }` | false | +| ^ | `{ foo: () => 'bar' }` | false | +| object with `valueOf` | `{ valueOf: () => ({ foo: 'bar' }) }` | true | +| object with `toJSON` | `{ toJSON: () => 'bar' }` | true | +| object with `[Symbol.toPrimitive]` | `{ [Symbol.toPrimitive]: () => true }` | true | +| array | `[]` | true | +| ^ | `[1, 2, 3]` | true | +| Date | `new Date()` | true | + +## isJSON + +A Type Guard function for checking if a value is a JSON like. + +### Basic Usage + +```typescript +function isJSON(target: unknown): target is JSON +``` + +#### params + +- `target` .. The value to check. + +#### returns + +- `true` .. When the value is a JSON. +- `false` .. When the value is not a JSON. + +### Examples + +```typescript +import { isJSON } from 'type-assurer' + +const value = { foo: 'bar' } + +if (isJSON(value)) { + // value is { foo: string } +} else { + // value is never +} + +const value2 = { foo: () => 'bar' } + +if (isJSON(value2)) { + // value2 is never +} else { + // value2 is { foo: () => string } +} + +const value3 = { foo: 'bar' } as unknown + +if (isJSON(value3)) { + // value3 is JSON +} else { + // value3 is unknown +} +``` + +## assertJSON + +A Type Assertion function for checking if a value is a JSON. + +### Basic Usage + +```typescript +function assertJSON(target: unknown, message?: TypeErrorMessage): asserts target is JSON +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be displayed when the assertion fails. + +#### returns + +- `void` .. When the value is a JSON. + +#### throws + +- `TypeAssertionError` .. When the value is not a JSON. + +### Examples + +```typescript +import { assertJSON } from 'type-assurer' + +const value = { foo: 'bar' } + +assertJSON(value) +// When the value is not a JSON, TypeAssertionError is thrown. +// value is { foo: string } + +const value2 = { foo: () => 'bar' } + +assertJSON(value2) +// When the value is not a JSON, TypeAssertionError is thrown. +// value2 is never + +const value3 = { foo: 'bar' } as unknown + +assertJSON(value3) +// When the value is not a JSON, TypeAssertionError is thrown. +// value3 is JSON +``` + +### ensureJSON + +Ensures that the value is a JSON. If it is not a JSON, an error is thrown. + +### Basic Usage + +```typescript +function ensureJSON(target: unknown, message?: TypeErrorMessage): JSON +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be displayed when the assertion fails. + +#### returns + +- `JSON` .. When the value is a JSON. + +#### throws + +- `TypeAssertionError` .. When the value is not a JSON. + +### Examples + +```typescript +import { ensureJSON } from 'type-assurer' + +function getValue() { return { foo: 'bar' } } + +const value = ensureJSON(getValue()) +// When the value is not a JSON, TypeAssertionError is thrown. +// value is { foo: string } + +function getValue2() { return { foo: () => 'bar' } } + +const value2 = ensureJSON(getValue2()) +// When the value is not a JSON, TypeAssertionError is thrown. +// value2 is never + +function getValue3() { return { foo: 'bar' } as unknown } + +const value3 = ensureJSON(getValue3()) +// When the value is not a JSON, TypeAssertionError is thrown. +// value3 is JSON +``` + +## fallbackJSON + +Fallback to the default value if the value is not a JSON. + +### Basic Usage + +```typescript +function fallbackJSON(target: unknown, fallback: JSON): Jsonifiable +``` + +#### params + +- `target` .. The value to check. +- `fallback` .. The default value to return if the value is not a JSON. + +#### returns + +- `JSON` .. When the value is a JSON. Otherwise, the fallback value. + +### Examples + +```typescript +import { fallbackJSON } from 'type-assurer' + +function getValue() { return { foo: 'bar' } } + +const value = fallbackJSON(getValue(), { baz: 'qux' }) +// When the value is not a JSON, the process continues. +// value is { foo: string } | { baz: string } + +function getValue2() { return { foo: () => 'bar' } } + +const value2 = fallbackJSON(getValue2(), { baz: 'qux' }) +// When the value is not a JSON, the process continues. +// value2 is { baz: string } + +function getValue3() { return { foo: 'bar' } as unknown } + +const value3 = fallbackJSON(getValue3(), { baz: 'qux' }) +// When the value is not a JSON, the process continues. +// vlaue3 is JSON | { baz: string } +``` diff --git a/docs/src/content/docs/reference/typeGuards/nil.md b/docs/src/content/docs/reference/typeGuards/nil.md new file mode 100644 index 0000000..87f43c6 --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/nil.md @@ -0,0 +1,52 @@ +--- +title: nil +description: A Type Guard Utility functions for checking if a value is `null` or `undefined`. +--- +A Type Guard Utility functions for checking if a value is `null` or `undefined`. + +:::note +`assertNil` `ensureNil` `fallbackNil` are not implemented because it is not necessary. they are not useful. +::: + +## Example of return value + +| input | result | +| ----- | ------ | +| `null` | true | +| `undefined` | true | +| other | false | + +## isNil + +A Type Guard function for checking if a value is `null` or `undefined`. + +This function is determined by `target === null || target === undefined`. + +### Basic Usage + +```typescript +function isNil(target: T): target is Exclude +``` + +#### params + +- `target` .. The value to check. + +#### returns + +- `true` .. When the value is `null` or `undefined`. +- `false` .. When the value is not `null` and not `undefined`. + +### Examples + +```typescript +import { isNil } from 'type-assurer' + +const value: unknown = 0 + +if (isNil(value)) { + // value is null or undefined +} else { + // value is number +} +``` diff --git a/docs/src/content/docs/reference/typeGuards/not-empty.md b/docs/src/content/docs/reference/typeGuards/not-empty.md new file mode 100644 index 0000000..a44f2ba --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/not-empty.md @@ -0,0 +1,3 @@ +--- +title: not-empty +--- diff --git a/docs/src/content/docs/reference/typeGuards/not-nil.md b/docs/src/content/docs/reference/typeGuards/not-nil.md new file mode 100644 index 0000000..778ecf5 --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/not-nil.md @@ -0,0 +1,122 @@ +--- +title: not-nil +description: A Type Guard Utility functions for checking if a value is not `null` and not `undefined`. +--- +A Type Guard Utility functions for checking if a value is not `null` and not `undefined`. + +:::note +`fallbackNotNil` is not implemented because it is not necessary. use `??` operator instead. +::: + +## Example of return value + +| input | result | +| ----- | ------ | +| `null` | false | +| `undefined` | false | +| other | true | + +## isNotNil + +A Type Guard function for checking if a value is not `null` and not `undefined`. + +This function is determined by `target !== null && target !== undefined`. + +### Basic Usage + +```typescript +function isNotNil(target: T): target is Exclude +``` + +#### params + +- `target` .. The value to check. + +#### returns + +- `true` .. When the value is not `null` and not `undefined`. +- `false` .. When the value is `null` or `undefined`. + +### Examples + +```typescript +import { isNotNil } from 'type-assurer' + +const value: unknown = 0 + +if (isNotNil(value)) { + // value is number +} else { + // value is null or undefined +} +``` + +## assertNotNil + +A Type Assertion function for checking if a value is not `null` and not `undefined`. + +### Basic Usage + +```typescript +function assertNotNil(target: T): asserts target is Exclude +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be thrown when the value is `null` or `undefined`. + +#### returns + +- `void` .. When the value is not `null` and not `undefined`. + +#### throws + +- `TypeAssertionError` .. When the value is `null` or `undefined`. + +### Examples + +```typescript +import { assertNotNil } from 'type-assurer' + +const value: unknown = 0 + +assertNotNil(value) +// When value is not null and not undefined, this function does not throw an error. +// value is {} +``` + +## ensureNotNil + +Ensure that the value is not `null` and not `undefined`. + +### Basic Usage + +```typescript +function ensureNotNil(target: T, message?: ErrorMessage): Exclude +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be thrown when the value is `null` or `undefined`. + +#### returns + +- `Exclude` .. When the value is not `null` and not `undefined`. + +#### throws + +- `TypeAssertionError` .. When the value is `null` or `undefined`. + +### Examples + +```typescript +import { ensureNotNil } from 'type-assurer' + +function getValue(): number | null { return null } + +const value = ensureNotNil(getValue()) +// When value is not null and not undefined, this function does not throw an error. +// value is number +``` diff --git a/docs/src/content/docs/reference/typeGuards/number-parsable.md b/docs/src/content/docs/reference/typeGuards/number-parsable.md new file mode 100644 index 0000000..9041beb --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/number-parsable.md @@ -0,0 +1,280 @@ +--- +title: number-parsable +describe: A Type Guard Utility functions for checking if a value is a NumberParsable. +--- +A Type Guard Utility functions for checking if a value is a NumberParsable. + +"NumberParsable" is a value that can be converted to a number, using `Number(value)`. + +## Example of return value + +| input | example input | result | parsed result | +| ----- | -------------- | ------ | ------------- | +| number | `0` | true | `0` | +| ^ | `1` | true | `1` | +| ^ | `1.1` | true | `1.1` | +| ^ | `Infinity` | true | `Infinity` | +| ^ | `-Infinity` | true | `-Infinity` | +| NaN | `NaN` | false | no result | +| number object | `new Number(1)` | true | `1` | +| boolean | `true` | true | `1` | +| ^ | `false` | true | `0` | +| boolean object | `new Boolean(true)` | true | same as input of `Boolean` constructor argument | +| null | `null` | true | `0` | +| undefined | `undefined` | false | no result | +| string number | `'0'` | true | `0` | +| ^ | `'0123'` | true | `123` | +| ^ | `'1.1'` | true | `1.1` | +| ^ | `'Infinity'` | true | `Infinity` | +| string bigint | `'0n'` | false | no result | +| string | `'foo'` | false | no result | +| object with 'valueOf' | `new Number(1)` | true | `1` | +| ^ | `{ valueOf: () => 1 }` | true | `1` | +| ^ | `{ valueOf: () => true }` | true | `1` | +| ^ | `{ valueOf: () => 'foo' }` | false | no result | +| object with '[Symbol.toPrimitive]' | `{ [Symbol.toPrimitive]: () => 1 }` | true | `1` | +| ^ | `{ [Symbol.toPrimitive]: () => true }` | true | `1` | +| ^ | `{ [Symbol.toPrimitive]: () => 'foo' }` | false | no result | +| other | `''`, `false`, `true`, `null`, `undefined` | false | no result | + +:::note +Returns false for cases where `Number(value)` would cause an error, such as Symbol. +::: + +## isNumberParsable + +A Type Guard function for checking if a value is a NumberParsable. + +### Basic Usage + +```typescript +function isNumberParsable(target: unknown): target is NumberParsable +``` + +#### params + +- `target` .. The value to check. + +#### returns + +- `true` .. When the value is a NumberParsable. +- `false` .. When the value is not a NumberParsable. + +### Examples + +```typescript +import { isNumberParsable } from 'type-assurer' + +const value: unknown = '123' + +if (isNumberParsable(value)) { + // value is NumberParsable +} else { + // value is unknown +} + +const value2 = '123' as '123' | 'foo' + +if (isNumberParsable(value2)) { + // value2 is '123' +} else { + // value2 is 'foo' +} +``` + +## assertNumberParsable + +A Type Assertion function for checking if a value is a NumberParsable. + +### Basic Usage + +```typescript +function assertNumberParsable(target: unknown, message?: ErrorMessage): asserts target is NumberParsable +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be displayed when the assertion fails. + +#### returns + +- `void` .. When the value is a NumberParsable. + +#### throws + +- `TypeAssertionError` .. When the value is not a NumberParsable. + +### Examples + +```typescript +import { assertNumberParsable } from 'type-assurer' + +const value: unknown = '123' + +assertNumberParsable(value) +// When the value is NumberParsable, the process continues. +// value is NumberParsable + +const value2 = '123' as '123' | 'foo' + +assertNumberParsable(value2) +// When the value is NumberParsable, the process continues. +// value2 is '123' +``` + +## ensureNumberParsable + +Ensures that the value is a NumberParsable. If not, throw an error. + +### Basic Usage + +```typescript +function ensureNumberParsable(target: unknown, message?: ErrorMessage): NumberParsable +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be displayed when the assertion fails. + +#### returns + +- `NumberParsable` .. When the value is a NumberParsable. + +#### throws + +- `TypeAssertionError` .. When the value is not a NumberParsable. + +### Examples + +```typescript +import { ensureNumberParsable } from 'type-assurer' + +function getValue(): unknown { return '123' } + +const value = ensureNumberParsable(getValue()) +// When the value is NumberParsable, the process continues. +// value is NumberParsable + +function getValue2(): '123' | 'foo' { return '123' } + +const value2 = ensureNumberParsable(getValue2()) +// When the value is NumberParsable, the process continues. +// value2 is '123' +``` + +## fallbackNumberParsable + +Fallback to the default value if the value is not a NumberParsable. + +### Basic Usage + +```typescript +function fallbackNumberParsable(target: unknown, fallbackValue: NumberParsable): NumberParsable +``` + +#### params + +- `target` .. The value to check. +- `fallbackValue` .. The default value to be returned when the value is not a NumberParsable. + +#### returns + +- `NumberParsable` .. When the value is a NumberParsable. Otherwise, the fallback value. + +### Examples + +```typescript +import { fallbackNumberParsable } from 'type-assurer' + +function getValue(): unknown { return '123' } + +const value = fallbackNumberParsable(getValue(), 0) +// When the value is NumberParsable, the process continues. +// value is NumberParsable + +function getValue2(): '123' | 'foo' { return '123' } + +const value2 = fallbackNumberParsable(getValue2(), 0) +// When the value is NumberParsable, the process continues. +// value2 is '123' | 0 +``` + +## coerceNumber + +Parse the value as a number. If it fails, throw an error. + +### Basic Usage + +```typescript +function coerceNumber(target: unknown, message?: ErrorMessage): number +``` + +#### params + +- `target` .. The value to parse. +- `message` .. (optional) The error message to be displayed when the parsing fails. + +#### returns + +- `number` .. When the value is a NumberParsable. + +#### throws + +- `TypeAssertionError` .. When the value is not a NumberParsable. + +### Examples + +```typescript +import { coerceNumber } from 'type-assurer' + +function getValue(): unknown { return '123' } + +const value = coerceNumber(getValue()) +// When the value is NumberParsable, the process continues. +// value is number + +function getValue2(): '123' | 456 | 'foo' | 'bar' { return '123' } + +const value2 = coerceNumber(getValue2()) +// When the value is NumberParsable, the process continues. +// value2 is 123 | 456 +``` + +## fixNumber + +Parse the value as a number. If it fails, return the fallback value. + +### Basic Usage + +```typescript +function fixNumber(target: unknown, fallbackValue: number): number +``` + +#### params + +- `target` .. The value to parse. +- `fallbackValue` .. The default value to be returned when the parsing fails. + +#### returns + +- `number` .. When the value is a NumberParsable. Otherwise, the fallback value. + +### Examples + +```typescript +import { fixNumber } from 'type-assurer' + +function getValue(): unknown { return '123' } + +const value = fixNumber(getValue(), 0) +// When the value is NumberParsable, the process continues. +// value is number + +function getValue2(): '123' | 456 | 'foo' | 'bar' { return '123' } + +const value2 = fixNumber(getValue2(), 789) +// When the value is NumberParsable, the process continues. +// value2 is 123 | 456 | 789 +``` diff --git a/docs/src/content/docs/reference/typeGuards/number.md b/docs/src/content/docs/reference/typeGuards/number.md new file mode 100644 index 0000000..8c1949a --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/number.md @@ -0,0 +1,158 @@ +--- +title: number +description: A Type Guard Utility functions for checking if a value is a number. +--- +A Type Guard Utility functions for checking if a value is a number. + +:::note +`NaN` is a type of number, but it is judged as false because it is not a number. +::: + +## Example of return value + +| input | result | +| ----- | ------ | +| number
(e.g. `0`) | true | +| Non-finite number without `NaN`
(e.g. `Infinity`, `-Infinity`) | true | +| NaN | false | +| number object
(e.g. `new Number()`) | false | +| BigInt
(e.g. `0n`) | false | +| object including `Symbol.toPrimitive`
(e.g. `{ [Symbol.toPrimitive]: () => 0 }`) | false | +| object including `valueOf`
(e.g. `{ valueOf: () => 0 }`) | false | +| other
(e.g. `'foo'`, `null`, `undefined`, `{}`, `[]`) | false | + +## isNumber + +A Type Guard function for checking if a value is a number. + +This function is determined by `typeof target === 'number' && !isNaN(target)`. + +### Basic Usage + +```typescript +function isNumber(target: unknown): target is number +``` + +#### params + +- `target` .. The value to check. + +#### returns + +- `true` .. When the value is a number. +- `false` .. When the value is not a number. (including `NaN`) + +### Examples + +```typescript +import { isNumber } from 'type-assurer' + +const value: unknown = 0 + +if (isNumber(value)) { + // value is number +} else { + // value is unknown +} +``` + +## assertNumber + +A Type Assertion function for checking if a value is a number. + +### Basic Usage + +```typescript +function assertNumber(target: unknown, message?: ErrorMessage): asserts target is number +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be thrown when the value is not a number. + +#### returns + +- `void` .. When the value is a number. + +#### throws + +- `TypeAssertionError` .. When the value is not a number. + +### Examples + +```typescript +import { assertNumber } from 'type-assurer' + +const value: unknown = 0 + +assertNumber(value) +// When the value is not a number, TypeAssertionError is thrown. +// value is number +``` + +## ensureNumber + +Ensure that the value is a number. If it is not a number, it will be converted to a number. + +### Basic Usage + +```typescript +function ensureNumber(target: unknown, message?: ErrorMessage): number +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be thrown when the value is not a number. + +#### returns + +- `number` .. When the value is a number. + +#### throws + +- `TypeAssertionError` .. When the value is not a number. + +### Examples + +```typescript +import { ensureNumber } from 'type-assurer' + +function getValue(): unknown { return '0' } + +const value: number = ensureNumber(getValue()) +// When the value is not a number, TypeAssertionError is thrown. +// value is number +``` + +## fallbackNumber + +Fallback to the default value if the value is not a number. + +### Basic Usage + +```typescript +function fallbackNumber(target: unknown, fallbackValue: number): number +``` + +#### params + +- `target` .. The value to check. +- `fallbackValue` .. The default value to be returned when the value is not a number. + +#### returns + +- `number` .. When the value is a number. If the value is not a number, the default value is returned. + +### Examples + +```typescript +import { fallbackNumber } from 'type-assurer' + +function getValue(): unknown { return '0' } + +const value: number = fallbackNumber(getValue(), 1) +// When the value is not a number, 1 is returned. +// value is number +``` diff --git a/docs/src/content/docs/reference/typeGuards/object.md b/docs/src/content/docs/reference/typeGuards/object.md new file mode 100644 index 0000000..30cfd4d --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/object.md @@ -0,0 +1,228 @@ +--- +title: object +description: A Type Guard Utility functions for checking if a value is an Object. +--- +A Type Guard Utility functions for checking if a value is an Object. + +## Example of return value + +| input | result | +| ----- | ------ | +| Object
(e.g. `{ foo: 'bar' }`) | true | +| Array
(e.g. `['foo', 'bar']`) | false | +| Function
(e.g. `() => {}`) | false | +| null | false | +| undefined | false | +| other
(e.g. `0`, `''`, `false`, `true`) | false | + +## Example of return types + +| input | result | +| ----- | ------ | +| `object` | `object` | +| `unknown` | `Record` | +| some type that satisfies `Record` | same type | +| some instance | same type | +| some class instance | same type | +| other | `never` | + +## isObject + +A Type Guard function for checking if a value is an Object. + +This determination is made by `target !== null && !Array.isArray(target) && typeof target === 'object'`. + +### Basic Usage + +```typescript +function isObject(target: unknown): target is object +``` + +#### params + +- `target` .. The value to check. + +#### returns + +- `true` .. When the value is an Object. +- `false` .. When the value is not an Object. + +'Object' here means a value that is not null, not an Array, and has a type of 'object'. + +### Example + + +```typescript +import { isObject } from 'type-assurer' + +const value: unknown = { foo: 'bar' } + +if (isObject(value)) { + // value is Record +} else { + // value is unknown +} + +const value2 = { foo: 'bar' } as { foo: string } | string | null + +if (isObject(value2)) { + // value is { foo: string } +} else { + // value is string | null +} + +const value3 = { foo: 'bar' } as object | string + +if (isObject(value3)) { + // value is object +} else { + // value is string +} +``` + +## assertObject + +A Type Assertion function for checking if a value is an Object. + +### Basic Usage + +```typescript +function assertObject(target: unknown, errorMessage?: ErrorMessage): asserts target is object +``` + +#### params + +- `target` .. The value to check. +- `errorMessage` .. (optional) The error message to be displayed when the value is not an Object. + +#### returns + +- `void` .. When the value is an Object. + +Object here means a value that is not null, not an Array, and has a type of 'object'. + +#### throws + +- `TypeAssertionError` .. When the value is not an Object. + +Object here means a value that is not null, not an Array, and has a type of 'object'. + +### Example + +```typescript +import { assertObject } from 'type-assurer' + +const value: unknown = { foo: 'bar' } + +assertObject(value) +// When the value is not an Object, TypeAssertionError is thrown. +// value is Record + +const value2 = { foo: 'bar' } as { foo: string } | string | null + +assertObject(value2) +// When the value is not an Object, TypeAssertionError is thrown. +// value2 is { foo: string } + +const value3 = { foo: 'bar' } as object | string + +assertObject(value3) +// When the value is not an Object, TypeAssertionError is thrown. +// value3 is object +``` + +## ensureObject + +Ensure that the value is an Object. If it is not an Object, throw an error. + +### Basic Usage + +```typescript +function ensureObject(target: unknown, errorMessage?: ErrorMessage): object +``` + +#### params + +- `target` .. The value to check. +- `errorMessage` .. (optional) The error message to be displayed when the value is not an Object. + +#### returns + +- `object` .. When the value is an Object. + +Object here means a value that is not null, not an Array, and has a type of 'object'. + +#### throws + +- `TypeAssertionError` .. When the value is not an Object. + +Object here means a value that is not null, not an Array, and has a type of 'object'. + +### Example + +```typescript +import { ensureObject } from 'type-assurer' + +function getObject(): unknown { return { foo: 'bar' } } + +const result = ensureObject(getObject()) +// When the value is not an Object, throw TypeAssertionError +// result is Record + +function getObject2(): { foo: string } | string { return { foo: 'bar' } } + +const result2 = ensureObject(getObject2()) +// When the value is not an Object, throw TypeAssertionError +// result2 is { foo: string } + +function getObject3(): object | string { return { foo: 'bar' } } + +const result3 = ensureObject(getObject3()) +// When the value is not an Object, throw TypeAssertionError +// result3 is object +``` + +## fallbackObject + +Fallback to the default value if the value is not an Object. + +### Basic Usage + +```typescript +function fallbackObject(target: unknown, defaultValue: object): object +``` + +#### params + +- `target` .. The value to check. +- `defaultValue` .. The default value to be returned when the value is not an Object. + +Object here means a value that is not null, not an Array, and has a type of 'object'. + +#### returns + +- `object` .. When the value is an Object. Or the default value when the value is not an Object. + +### Example + +```typescript +import { fallbackObject } from 'type-assurer' + +function getObject(): unknown { return { foo: 'bar' } } + +const result = fallbackObject(getObject(), { foo: 'baz' }) +// When the value is not an Object, result is { foo: 'baz' } +// result is Record + +function getObject2(): { foo: string } | string { return { foo: 'bar' } } + +const result2 = fallbackObject(getObject2(), { baz: 'qux' }) +// When the value is not an Object, result2 is { foo: 'baz' } +// result2 is { foo: string } | { baz: string } + +function getObject3(): object | string { return { foo: 'bar' } } + +const result3 = fallbackObject(getObject3(), { baz: 'qux' }) +// When the value is not an Object, result3 is { baz: 'qux' } +// result3 is object +``` diff --git a/docs/src/content/docs/reference/typeGuards/promise.md b/docs/src/content/docs/reference/typeGuards/promise.md new file mode 100644 index 0000000..e4fa90d --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/promise.md @@ -0,0 +1,179 @@ +--- +title: promise +description: A Type Guard Utility functions for checking if a value is a Promise. +--- +A Type Guard Utility functions for checking if a value is a Promise. + +## Example of return value + +| input | result | +| ----- | ------ | +| Promise
(e.g. `Promise.resolve('foo')`) | true | +| Promise object
(e.g. `new Promise(() => {})`) | true | +| awaited async function
(e.g. `await fetchData()`) | true | +| Promise like object
(e.g. `{ then: () => {} }`) | false | +| other
(e.g. `null`, `undefined`, `0`, `''`, `false`, `true`, `[]`, `{}`) | false | + +## isPromise + +A Type Guard function for checking if a value is a Promise. + +This determination is made by `instanceof Promise`. +Therefore, PromiseLike objects with a then method will be judged as false. +If you want to make this true, see isAwaitable. + +### Basic Usage + +```typescript +function isPromise(target: unknown): target is Promise +``` + +#### params + +- `target` .. The value to check. + +#### returns + +- `true` .. When the value is a Promise. +- `false` .. When the value is not a Promise. + +### Examples + +```typescript +import { isPromise } from 'type-assurer' + +const value: unknown = Promise.resolve('foo') + +if (isPromise(value)) { + // value is Promise +} else { + // value is unknown +} + +const value2: Promise | string = Promise.resolve('foo') + +if (isPromise(value2)) { + // value2 is Promise +} else { + // value2 is string +} +``` + +## assertPromise + +A Type Assertion function for checking if a value is a Promise. + +### Basic Usage + +```typescript +function assertPromise(target: unknown, errorMessage?: ErrorMessage): asserts target is Promise +``` + +#### params + +- `target` .. The value to check. +- `errorMessage` .. (optional) The error message to be displayed when the value is not a Promise. + +#### returns + +- `void` .. When the value is a Promise. + +#### throws + +- `TypeAssertionError` .. When the value is not a Promise. + +### Examples + +```typescript +import { assertPromise } from 'type-assurer' + +const value: unknown = Promise.resolve('foo') + +assertPromise(value) +// When the value is not a Promise, TypeAssertionError is thrown. +// value is Promise + +const value2: Promise | string = Promise.resolve('foo') + +assertPromise(value2) +// When the value is not a Promise, TypeAssertionError is thrown. +// value2 is Promise +``` + +## ensurePromise + +Ensure that the value is a Promise. If it is not a Promise, throw an error. + +### Basic Usage + +```typescript +function ensurePromise(target: unknown, errorMessage?: ErrorMessage): Promise +``` + +#### params + +- `target` .. The value to check. +- `errorMessage` .. (optional) The error message to be displayed when the value is not a Promise. + +#### returns + +- `Promise` .. When the value is a Promise. + +#### throws + +- `TypeAssertionError` .. When the value is not a Promise. + +### Examples + +```typescript +import { ensurePromise } from 'type-assurer' + +declare function fetchData(): unknown + +const result = await ensurePromise(fetchData()) +// When the value is not a Promise, TypeAssertionError is thrown. +// result is Promise + +declare function fetchData2(): Promise | string + +const result2 = await ensurePromise(fetchData2()) +// When the value is not a Promise, TypeAssertionError is thrown. +// result2 is Promise +``` + +## fallbackPromise + +Fallback to the fallback value if the value is not a Promise. + +### Basic Usage + +```typescript +function fallbackPromise(target: unknown, fallbackValue: Promise): Promise +``` + +#### params + +- `target` .. The value to check. +- `fallbackValue` .. The fallback value to be returned when the value is not a Promise. + +#### returns + +- `Promise` .. When the value is a Promise. Otherwise, the fallback value is returned. + +### Examples + +```typescript +import { fallbackPromise } from 'type-assurer' + +declare function fetchData(): unknown + +const result = await fallbackPromise(fetchData(), Promise.resolve('fallback')) +// When the value is not a Promise, fallback value is returned. +// result is Promise + +declare function fetchData2(): Promise | string + +const result2 = await fallbackPromise(fetchData2(), Promise.resolve('fallback')) +// When the value is not a Promise, fallback value is returned. +// result2 is Promise +``` diff --git a/docs/src/content/docs/reference/typeGuards/string.md b/docs/src/content/docs/reference/typeGuards/string.md new file mode 100644 index 0000000..f58645c --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/string.md @@ -0,0 +1,180 @@ +--- +title: string +description: A Type Guard Utility functions for checking if a value is a string. +--- +A Type Guard Utility functions for checking if a value is a string. + +## Example of return value + +| input | result | +| ----- | ------ | +| string
(e.g. `'foo'`) | true | +| empty string
(e.g. `''`) | true | +| string object
(e.g. `new String()`) | false | +| object including `Symbol.toPrimitive`
(e.g. `{ [Symbol.toPrimitive]: () => 'foo' }`) | false | +| object including `toString`
(e.g. `{ toString: () => 'foo' }`) | false | +| object including `valueOf`
(e.g. `{ valueOf: () => 'foo' }`) | false | +| other
(e.g. `0`, `null`, `undefined`, `{}`, `[]`) | false | + +## isString + +A Type Guard function for checking if a value is a string. + +This function is determined by `typeof target === 'string'`. +Therefore, String Object and objects with `toString` `Symbol.toPrimitive` are judged as false. + +### Basic Usage + +```typescript +function isString(target: unknown): target is string +``` + +#### params + +- `target` .. The value to check. + +#### returns + +- `true` .. When the value is a string. +- `false` .. When the value is not a string. + +### Examples + +```typescript +import { isString } from 'type-assurer' + +const value: unknown = 'foo' + +if (isString(value)) { + // value is string +} else { + // value is unknown +} + +const value2: string | number = 'foo' + +if (isString(value2)) { + // value2 is string +} else { + // value2 is number +} +``` + +## assertString + +A Type Assertion function for checking if a value is a string. + +### Basic Usage + +```typescript +function assertString(target: unknown, errorMessage?: ErrorMessage): asserts target is string +``` + +#### params + +- `target` .. The value to check. +- `errorMessage` .. (optional) The error message to be displayed when the value is not a string. + +#### returns + +- `void` .. When the value is a string. + +#### throws + +- `TypeAssertionError` .. When the value is not a string. + +### Examples + +```typescript +import { assertString } from 'type-assurer' + +const value: unknown = 'foo' + +assertString(value) +// When the value is not string, throw TypeAssertionError +// value is string + +const value2: string | number = 'foo' + +assertString(value2) +// When the value is number, throw TypeAssertionError +// value2 is string +``` + +## ensureString + +Ensure that the value is a string. If it is not a string, throw an error. + +### Basic Usage + +```typescript +function ensureString(target: unknown, errorMessage?: ErrorMessage): string +``` + +#### params + +- `target` .. The value to check. +- `errorMessage` .. (optional) The error message to be displayed when the value is not a string. + +#### returns + +- `string` .. When the value is a string. + +#### throws + +- `TypeAssertionError` .. When the value is not a string. + +### Examples + +```typescript +import { ensureString } from 'type-assurer' + +function getValue(): string { return 'foo' } + +const result = ensureString(getValue()) +// When result is not string, throw TypeAssertionError +// result is string + +function getValue2(): 'foo' { return 'foo' } + +const result2 = ensureString(getValue2()) +// When result2 is not string, throw TypeAssertionError +// result2 is 'foo' +``` + +## fallbackString + +Fallback to the default value if the value is not a string. + +### Basic Usage + +```typescript +function fallbackString(target: unknown, defaultValue: string): string +``` + +#### params + +- `target` .. The value to check. +- `defaultValue` .. The default value to be returned when the value is not a string. + +#### returns + +- `string` .. When the value is a string. Or the default value when the value is not a string. + +### Examples + +```typescript +import { fallbackString } from 'type-assurer' + +function getValue(): string { return 'foo' } + +const result = fallbackString(getValue(), 'bar') +// When result is not string, result is 'bar' +// result is string + +function getValue2(): 'foo' { return 'foo' } + +const result2 = fallbackString(getValue2(), 'bar') +// When result2 is not string, result2 is 'bar' +// result2 is 'foo' | 'bar' +``` diff --git a/docs/src/content/docs/reference/typeGuards/symbol.md b/docs/src/content/docs/reference/typeGuards/symbol.md new file mode 100644 index 0000000..cfcc27b --- /dev/null +++ b/docs/src/content/docs/reference/typeGuards/symbol.md @@ -0,0 +1,183 @@ +--- +title: symbol +description: A Type Guard Utility functions for checking if a value is a symbol. +--- +A Type Guard Utility functions for checking if a value is a symbol. + +## Example of return value + +| input | result | +| ----- | ------ | +| symbol
(e.g. `Symbol('foo')`) | true | +| other
(e.g. `0`, `null`, `undefined`, `{}`, `[]`) | false | + +## isSymbol + +A Type Guard function for checking if a value is a symbol. + +This function is determined by `typeof target === 'symbol'`. + +### Basic Usage + +```typescript +function isSymbol(target: unknown): target is symbol +``` + +#### params + +- `target` .. The value to check. + +#### returns + +- `true` .. When the value is a symbol. +- `false` .. When the value is not a symbol. + +### Examples + +```typescript +import { isSymbol } from 'type-assurer' + +const value: unknown = Symbol('foo') + +if (isSymbol(value)) { + // value is symbol +} else { + // value is unknown +} + +const symbol1: unique symbol = Symbol('bar') +const symbol2: unique symbol = Symbol('baz') +const value2: typeof symbol1 | typeof symbol2 | undefined = symbol1 + +if (isSymbol(value2)) { + // value2 is typeof symbol1 | typeof symbol2 +} else { + // value2 is undefined +} +``` + +## assertSymbol + +A Type Guard function for checking if a value is a symbol. + +### Basic Usage + +```typescript +function assertSymbol(target: unknown, message?: ErrorMessage): asserts target is symbol +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be displayed when the value is not a symbol. + +#### returns + +- `void` .. When the value is a symbol. + +#### throws + +- `TypeAssertionError` .. When the value is not a symbol. + +### Examples + +```typescript +import { assertSymbol } from 'type-assurer' + +const value: unknown = Symbol('foo') + +assertSymbol(value) +// When the value is not a symbol, TypeAssertionError is thrown. +// value is symbol + +const symbol1: unique symbol = Symbol('bar') +const symbol2: unique symbol = Symbol('baz') +const value2: typeof symbol1 | typeof symbol2 | undefined = symbol1 + +assertSymbol(value2) +// When the value is not a symbol, TypeAssertionError is thrown. +// value2 is typeof symbol1 | typeof symbol2 +``` + +## ensureSymbol + +Ensure that the value is a symbol. + +### Basic Usage + +```typescript +function ensureSymbol(target: unknown, message?: ErrorMessage): symbol +``` + +#### params + +- `target` .. The value to check. +- `message` .. (optional) The error message to be displayed when the value is not a symbol. + +#### returns + +- `symbol` .. When the value is a symbol. + +#### throws + +- `TypeAssertionError` .. When the value is not a symbol. + +### Examples + +```typescript +import { ensureSymbol } from 'type-assurer' + +function getValue(): unknown { return Symbol('foo') } + +const value = ensureSymbol(getValue()) +// When the value is not a symbol, TypeAssertionError is thrown. +// value is symbol + +const symbol1: unique symbol = Symbol('bar') +const symbol2: unique symbol = Symbol('baz') +function getValue2(): typeof symbol1 | typeof symbol2 | undefined { return symbol1 } + +const value2 = ensureSymbol(getValue2()) +// When the value is not a symbol, TypeAssertionError is thrown. +// value2 is typeof symbol1 | typeof symbol2 +``` + +## fallbackSymbol + +A Type Guard function for checking if a value is a symbol. + +### Basic Usage + +```typescript +function fallbackSymbol(target: unknown, fallbackValue: symbol): symbol +``` + +#### params + +- `target` .. The value to check. +- `fallbackValue` .. The value to return when the value is not a symbol. + +#### returns + +- `symbol` .. When the value is a symbol. If the value is not a symbol, return the fallback value. + +### Examples + +```typescript +import { fallbackSymbol } from 'type-assurer' + +function getValue(): unknown { return Symbol('foo') } +const fallbackSymbol = Symbol('bar') + +const value = fallbackSymbol(getValue(), fallbackSymbol) +// When the value is not a symbol, fallbackSymbol is returned. +// value is symbol + +const symbol1: unique symbol = Symbol('baz') +function getValue2(): typeof symbol1 | undefined { return symbol1 } +const fallbackSymbol2: unique symbol = Symbol('qux') + +const value2 = fallbackSymbol(getValue2(), fallbackSymbol2) +// When the value is not a symbol, fallbackSymbol2 is returned. +// value is typeof symbol1 | typeof fallbackSymbol2 +``` diff --git a/docs/src/env.d.ts b/docs/src/env.d.ts new file mode 100644 index 0000000..acef35f --- /dev/null +++ b/docs/src/env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/package.json b/package.json index ee4a900..256b33b 100644 --- a/package.json +++ b/package.json @@ -24,30 +24,32 @@ "access": "public" }, "scripts": { - "dev": "vitest", + "dev": "vitest --ui --coverage --typecheck", + "doc": "astro dev --root ./docs --open", "build": "tsup", - "test": "run-p test:*", - "test:spec": "vitest --run", - "test:spec-d": "vitest typecheck --run", + "doc-build": "astro check --root ./docs && astro build --root ./docs", + "preview": "astro preview --root ./docs", + "test": "yarn test:spec & yarn test:type", + "test:spec": "vitest --run --typecheck", "test:type": "tsc --noEmit -p tsconfig.json", - "lint": "eslint --ext .ts .", - "format": "prettier --write . --ignore-path=.eslintignore" + "format": "biome format --write ./src ./docs", + "lint": "biome check --apply ./src ./docs" }, "devDependencies": { + "@astrojs/check": "^0.3.1", + "@astrojs/starlight": "^0.14.0", + "@biomejs/biome": "^1.4.1", "@changesets/changelog-github": "^0.4.8", "@changesets/cli": "^2.26.2", "@types/lodash": "^4.14.201", - "@typescript-eslint/eslint-plugin": "^6.11.0", - "@typescript-eslint/parser": "^6.11.0", - "eslint": "^8.54.0", - "eslint-config-prettier": "^9.0.0", - "eslint-plugin-import": "^2.29.0", + "@vitest/coverage-v8": "^1.0.4", + "@vitest/ui": "^1.0.4", + "astro": "^3.6.4", "lodash": "^4.17.21", - "prettier": "^3.1.0", + "sharp": "^0.32.5", "tsup": "^8.0.0", - "typescript": "^5.2.2", - "vitest": "^0.34.6", - "yarn-run-all": "latest" + "typescript": "^5.3.2", + "vitest": "^1.0.0" }, "peerDependencies": { "typescript": ">= 4.0.0" diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000..08d4fee Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/index.ts b/src/index.ts index e4f19c5..eaf6d45 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,10 @@ export * from './typeGuards' -export type * from './lib/type' -export { TypeAssertionError, errorMessage } from './lib/error' -export { createGuard, createAssertion, createEnsure, createFallback, not } from './lib/factory' +export { + TypeAssertionError, + errorMessage, + createGuard, + createAssertion, + createEnsure, + createFallback, + not, +} from './lib' diff --git a/src/lib-test/index.ts b/src/lib-test/index.ts new file mode 100644 index 0000000..dea8220 --- /dev/null +++ b/src/lib-test/index.ts @@ -0,0 +1,3 @@ +export * from './tester' +export * from './type' +export * from './value' diff --git a/src/lib-test/tester.ts b/src/lib-test/tester.ts new file mode 100644 index 0000000..d31e1ba --- /dev/null +++ b/src/lib-test/tester.ts @@ -0,0 +1,246 @@ +import { expect, test } from 'vitest' +import type { Not, TypeAssert, TypeEnsure, TypeFallback, TypeGuard } from '~/lib' +import { ValueType } from './type' +import { type PickTypesOption, type TestOption, allTypes, getGenerator, testTypes } from './value' + +type ExpectGuard = (v: unknown) => boolean + +function xor(a: boolean | null | undefined, b: boolean | null | undefined): boolean { + return Boolean(a) !== Boolean(b) +} + +/** + * specifies TypeGuard function retuens should be same as lodash function + * + * @param actualGuard set TypeGuard function + * @param expectGuard set Expected TypeGuard function (e.g. lodash) + * @param opt + */ +export function testEquivalentGuard( + actualGuard: TypeGuard | Not, + expectGuard: ExpectGuard, + opt: TestOption = {}, +): void { + const testcases = allTypes().map((type) => { + const expected = xor(expectGuard(getGenerator(type)()), opt.negative) + return { expected, type, case: `should return ${expected} when the value type is ${type}` } + }) + + test.each(testcases)('$case', ({ type, expected }) => { + const generate = getGenerator(type) + expect(actualGuard(generate())).toBe(expected) + }) +} + +/** + * specifies TypeGuard function returns should be true only specified ValueType. + * + * @param actualGuard set TypeGuard function + * @param expectedValueTypes set expected ValueType array + * @param opt + */ +export function testGuard( + actualGuard: TypeGuard | Not, + expectedValueTypes: ValueType[], + opt: TestOption & PickTypesOption = {}, +): void { + const testcases = testTypes(expectedValueTypes, opt).map((type) => { + const expected = xor(expectedValueTypes.includes(type), opt.negative) + return { expected, type, case: `should return ${expected} when the value type is ${type}` } + }) + + test.each(testcases)('$case', ({ type, expected }) => { + const generate = getGenerator(type) + expect(actualGuard(generate())).toBe(expected) + }) +} + +/** + * specifies TypeAssert of InvertedTypeAssert function should throw or not that same as lodash function condition + * + * @param actualAssert set TypeAssert function (if opt.negative is true, set InvertedTypeAssert function) + * @param expectGuard set Expected TypeGuard function (e.g. lodash) + * @param opt + */ +export function testEquivalentAssert(actualAssert: TypeAssert, expectGuard: ExpectGuard, opt: TestOption = {}): void { + const testcases = allTypes().map((type) => { + const expected = xor(expectGuard(getGenerator(type)()), opt.negative) + return { expected, type, case: `should ${expected ? 'NOT ' : ''}throw when the value type is ${type}` } + }) + + test.each(testcases)('$case', ({ type, expected }) => { + const generate = getGenerator(type) + + if (expected) { + expect(() => actualAssert(generate())).not.toThrow() + } else { + expect(() => actualAssert(generate())).toThrow() + } + }) +} + +/** + * + * @param actualAssert + * @param expectedValueTypes + * @param opt + */ +export function testAssert( + actualAssert: TypeAssert, + expectedValueTypes: ValueType[], + opt: TestOption & PickTypesOption = {}, +): void { + const testcases = testTypes(expectedValueTypes, opt).map((type) => { + const expected = xor(expectedValueTypes.includes(type), opt.negative) + return { expected, type, case: `should ${expected ? 'NOT ' : ''}throw when the value type is ${type}` } + }) + + test.each(testcases)('$case', ({ type, expected }) => { + const generate = getGenerator(type) + + if (expected) { + expect(() => actualAssert(generate())).not.toThrow() + } else { + expect(() => actualAssert(generate())).toThrow() + } + }) +} + +/** + * specifies TypeEnsure of InvertedTypeEnsure function should return or throw that same as lodash function condition + * + * @param ensure set TypeEnsure function (if opt.negative is true, set InvertedTypeEnsure function) + * @param expectGuard set Expected TypeGuard function (e.g. lodash) + * @param opt + */ +export function testEquivalentEnsure(ensure: TypeEnsure, expectGuard: ExpectGuard, opt: TestOption = {}): void { + const testcases = allTypes().map((type) => { + const expected = xor(expectGuard(getGenerator(type)()), opt.negative) + return { + expected, + type, + case: expected + ? `should return the value when the value type is ${type}` + : `should throw when the value type is ${type}`, + } + }) + + test.each(testcases)('$case', ({ type, expected }) => { + const generate = getGenerator(type) + + if (expected) { + const value = generate() + expect(ensure(value)).toEqual(value) + } else { + expect(() => ensure(generate())).toThrow() + } + }) +} + +/** + * specifies TypeEnsure function should return or throw only specified ValueType. + * + * @param ensure set TypeEnsure function + * @param expectedValueTypes set expected ValueType array + * @param opt + */ +export function testEnsure( + ensure: TypeEnsure, + expectedValueTypes: ValueType[], + opt: TestOption & PickTypesOption = {}, +): void { + const testcases = testTypes(expectedValueTypes, opt).map((type) => { + const expected = xor(expectedValueTypes.includes(type), opt.negative) + return { + expected, + type, + case: expected + ? `should return the value when the value type is ${type}` + : `should throw when the value type is ${type}`, + } + }) + + test.each(testcases)('$case', ({ type, expected }) => { + const generate = getGenerator(type) + + if (expected) { + const value = generate() + expect(ensure(value)).toEqual(value) + } else { + expect(() => ensure(generate())).toThrow() + } + }) +} + +// biome-ignore lint/suspicious/noExplicitAny: +type AnyFunction = (...args: any[]) => any + +/** + * specifies TypeFallback of InvertedTypeFallback function should return that same as lodash function condition + * + * @param fallback set TypeFallback function (if opt.negative is true, set InvertedTypeFallback function) + * @param expectGuard set Expected TypeGuard function (e.g. lodash) + * @param opt + */ +export function testEquivalentFallback( + fallback: TypeFallback, + expectGuard: ExpectGuard, + opt: TestOption & { fallbackValue: unknown }, +): void + +// TypeFallback | InvertedTypeFallback is difficult to type safe, so use AnyFunction +export function testEquivalentFallback( + fallback: AnyFunction, + expectGuard: ExpectGuard, + opt: TestOption & { fallbackValue: unknown }, +): void { + const testcases = allTypes().map((type) => { + const expected = xor(expectGuard(getGenerator(type)()), opt.negative) + return { + expected, + type, + case: `should return ${expected ? 'the value' : 'fallback value'} when the value type is ${type}`, + } + }) + + test.each(testcases)('$case', ({ type, expected }) => { + const generate = getGenerator(type) + const value = generate() + + expect(fallback(value, opt.fallbackValue)).toEqual(expected ? value : opt.fallbackValue) + }) +} + +/** + * specifies TypeFallback function should return only specified ValueType. + * + * @param fallback set TypeFallback function + * @param expectedValueTypes set expected ValueType array + * @param opt + */ +export function testFallback( + fallback: TypeFallback, + expectedValueTypes: ValueType[], + opt: TestOption & PickTypesOption & { fallbackValue: unknown }, +): void + +export function testFallback( + fallback: AnyFunction, + expectedValueTypes: ValueType[], + opt: TestOption & PickTypesOption & { fallbackValue: unknown }, +): void { + const testcases = testTypes(expectedValueTypes, opt).map((type) => { + const expected = xor(expectedValueTypes.includes(type), opt.negative) + return { + expected, + type, + case: `should return ${expected ? 'the value' : 'fallback value'} when the value type is ${type}`, + } + }) + + test.each(testcases)('$case', ({ type, expected }) => { + const generate = getGenerator(type) + const value = generate() + expect(fallback(value, opt.fallbackValue)).toEqual(expected ? value : opt.fallbackValue) + }) +} diff --git a/src/lib-test/type.ts b/src/lib-test/type.ts new file mode 100644 index 0000000..e8c1182 --- /dev/null +++ b/src/lib-test/type.ts @@ -0,0 +1,531 @@ +export enum ValueType { + /** + * @description `true` + */ + True = 'true', + + /** + * @description `false` + */ + False = 'false', + + /** + * @description `Boolean(true)` + */ + BooleanObject = 'booleanObject', + + /** + * @description `{ [Symbol.toPrimitive]: () => true }` + */ + ObjectToPrimitiveBoolean = 'objectToPrimitiveBoolean', + + /** + * @description `{ valueOf: () => true }` + */ + ObjectValueOfBoolean = 'objectValueOfBoolean', + + /** + * @description `'true'` + */ + BooleanParsableTrue = 'booleanParsableTrue', + + /** + * @description `'false'` + */ + BooleanParsableFalse = 'booleanParsableFalse', + + /** + * @description `null` + */ + Null = 'null', + + /** + * @description `{ [Symbol.toPrimitive]: () => null }` + */ + ObjectToPrimitiveNull = 'objectToPrimitiveNull', + + /** + * @description `{ valueOf: () => null }` + */ + ObjectValueOfNull = 'objectValueOfNull', + + /** + * @description `undefined` + */ + Undefined = 'undefined', + + /** + * @description `{ [Symbol.toPrimitive]: () => undefined }` + */ + ObjectToPrimitiveUndefined = 'objectToPrimitiveUndefined', + + /** + * @description `{ valueOf: () => undefined }` + */ + ObjectValueOfUndefined = 'objectValueOfUndefined', + + /** + * @description `1` + */ + PositiveNumber = 'positiveNumber', + + /** + * @description `Infinity` + */ + PositiveInfinity = 'positiveInfinity', + + /** + * @description `0` + */ + Zero = 'zero', + + /** + * @description `-1` + */ + NegativeNumber = 'negativeNumber', + + /** + * @description `-Infinity` + */ + NegativeInfinity = 'negativeInfinity', + + /** + * @description `Number(1)` + */ + NumberObject = 'numberObject', + + /** + * @description `{ [Symbol.toPrimitive]: () => 1 }` + */ + ObjectToPrimitiveNumber = 'objectToPrimitiveNumber', + + /** + * @description `{ valueOf: () => 1 }` + */ + ObjectValueOfNumber = 'objectValueOfNumber', + + /** + * @description `1n` + */ + PositiveBigInt = 'positiveBigint', + + /** + * @description `-1n` + */ + NegativeBigInt = 'negativeBigint', + + /** + * @description `BigInt(1)` + */ + BigIntObject = 'bigintObject', + + /** + * @description `{ [Symbol.toPrimitive]: () => 1n }` + */ + ObjectToPrimitiveBigInt = 'objectToPrimitiveBigint', + + /** + * @description `{ valueOf: () => 1n }` + */ + ObjectValueOfBigInt = 'objectValueOfBigint', + + /** + * @description `NaN` + */ + NaN = 'NaN', + + /** + * @description `'123'` + */ + NumberParsablePositiveInt = 'numberParsablePositiveInt', + + /** + * @description `'0123'` + */ + NumberStringLeadingZero = 'numberStringLeadingZero', + + /** + * @description `'-123'` + */ + NumberParsableNegativeInt = 'numberParsableNegativeInt', + + /** + * @description `'123.456'` + */ + NumberParsablePositiveFloat = 'numberParsablePositiveFloat', + + /** + * @description `'-123.456'` + */ + NumberParsableNegativeFloat = 'numberParsableNegativeFloat', + + /** + * @description `'Infinity'` + */ + NumberParsablePositiveInfinity = 'numberParsablePositiveInfinity', + + /** + * @description `'-Infinity'` + */ + NumberParsableNegativeInfinity = 'numberParsableNegativeInfinity', + + /** + * @description `'foo'` + */ + String = 'string', + + /** + * @description `''` + */ + EmptyString = 'emptyString', + + /** + * @description `String('foo')` + */ + StringObject = 'stringObject', + + /** + * @description `{ [Symbol.toPrimitive]: () => 'foo' }` + */ + ObjectToPrimitiveString = 'objectToPrimitiveString', + + /** + * @description `{ valueOf: () => 'foo' }` + */ + ObjectValueOfString = 'objectValueOfString', + + /** + * @description `{ toString: () => 'foo' }` + */ + ObjectToString = 'objectToString', + + /** + * @description `'123'` + */ + JsonParsableNumber = 'jsonParsableNumber', + + /** + * @description `'true'` + */ + JsonParsableTrue = 'jsonParsableTrue', + + /** + * @description `'false'` + */ + JsonParsableFalse = 'jsonParsableFalse', + + /** + * @description `'null'` + */ + JsonParsableNull = 'jsonParsableNull', + + /** + * @description `'foo'` + */ + JsonParsableString = 'jsonParsableString', + + /** + * @description `'{"foo": "bar"}'` + */ + JsonParsableObject = 'jsonParsableObject', + + /** + * @description `'{"foo": { "bar": "baz" }, "qux": [1, 2, 3] }'` + */ + JsonParsableComplexObject = 'jsonParsableComplexObject', + + /** + * @description `'{}'` + */ + JsonParsableEmptyObject = 'jsonParsableEmptyObject', + + /** + * @description `'[1, 2, 3]'` + */ + JsonParsableArray = 'jsonParsableArray', + + /** + * @description `'[]'` + */ + JsonParsableEmptyArray = 'jsonParsableEmptyArray', + + /** + * @description `[1, 2, 3]` + */ + Array = 'array', + + /** + * @description `[]` + */ + EmptyArray = 'emptyArray', + + /** + * @description `Array(3)` + */ + BlankArray = 'blankArray', + + /** + * @description `document.body.children` + */ + ArrayLike = 'arrayLike', + + /** + * @description `new ArrayBuffer(8)` + */ + ArrayBuffer = 'arrayBuffer', + + /** + * @description `new Uint8Array(8)` + */ + Uint8Array = 'uint8Array', + + /** + * @description `new Uint8ClampedArray(8)` + */ + Uint8ClampedArray = 'uint8ClampedArray', + + /** + * @description `new Uint16Array(8)` + */ + Uint16Array = 'uint16Array', + + /** + * @description `new Uint32Array(8)` + */ + Uint32Array = 'uint32Array', + + /** + * @description `new Int8Array(8)` + */ + Int8Array = 'int8Array', + + /** + * @description `new Int16Array(8)` + */ + Int16Array = 'int16Array', + + /** + * @description `new Int32Array(8)` + */ + Int32Array = 'int32Array', + + /** + * @description `new Float32Array(8)` + */ + Float32Array = 'float32Array', + + /** + * @description `new Float64Array(8)` + */ + Float64Array = 'float64Array', + + /** + * @description `new BigInt64Array(8)` + */ + BigInt64Array = 'bigint64Array', + + /** + * @description `new BigUint64Array(8)` + */ + BigUint64Array = 'biguint64Array', + + /** + * @description `new SharedArrayBuffer(8)` + */ + SharedArrayBuffer = 'sharedArrayBuffer', + + /** + * @description `new DataView(new ArrayBuffer(8))` + */ + DataView = 'dataView', + + /** + * @description `new DataView(new ArrayBuffer(0))` + */ + EmptyDataView = 'emptyDataView', + + /** + * @description `Buffer.from('foo')` + */ + Buffer = 'buffer', + + /** + * @description `Buffer.alloc(0)` + */ + EmptyBuffer = 'emptyBuffer', + + /** + * @description `{ foo: 'bar' }` + */ + Object = 'object', + + /** + * @description `{ }` + */ + EmptyObject = 'emptyObject', + + /** + * @description `Object.create(null)` + */ + BlankObject = 'blankObject', + + /** + * @description `{ foo: [Circular] }` + */ + RecursiveObject = 'recursiveObject', + + /** + * @description `{ [Symbol.toStringTag]: () => 'Foo' }` + */ + WellKnownSymbolObject = 'wellKnownSymbolObject', + + /** + * @description `{ *[Symbol.iterator]() { yield 1 } }` + */ + IterableObject = 'iterableObject', + + /** + * @description `{ async *[Symbol.asyncIterator]() { yield 1 } }` + */ + AsyncIterableObject = 'asyncIterableObject', + + /** + * @description `{ foo: 'bar', baz: { toJSON: (k) => `${k}` } }` + */ + JsonifiableObject = 'jsonifiableObject', + + /** + * @description `[{ toJSON: (k) => `${k}` }]` + */ + JsonifiableObjectInArray = 'jsonifiableObjectInArray', + + /** + * @description `/foo/` + */ + RegExp = 'regExp', + + /** + * @description `() => void 0` + */ + Function = 'function', + + /** + * @description `async () => void 0` + */ + AsyncFunction = 'asyncFunction', + + /** + * @description `function* () { yield 1 }` + */ + GeneratorFunction = 'generatorFunction', + + /** + * @description `async function* () { yield 1 }` + */ + AsyncGeneratorFunction = 'asyncGeneratorFunction', + + /** + * @description `Symbol('foo')` + */ + Symbol = 'symbol', + + /** + * @description `{ [Symbol.toPrimitive]: () => Symbol('foo') }` + */ + ObjectToPrimitiveSymbol = 'objectToPrimitiveSymbol', + + /** + * @description `{ valueOf: () => Symbol('foo') }` + */ + ObjectValueOfSymbol = 'objectValueOfSymbol', + + /** + * @description `new Proxy({}, {})` + */ + Proxy = 'proxy', + + /** + * @description `new Promise(() => void 0)` + */ + Promise = 'promise', + + /** + * @description `{ then: () => void 0 }` + */ + ThenableObject = 'thenableObject', + + /** + * @description `{ const f = () => void 0; f.then = () => void 0; return f; }` + */ + ThenableFunction = 'thenableFunction', + + /** + * @description `new class { then() { } }` + */ + ThenableInstance = 'thenableInstance', + + /** + * @description `await Promise.resolve()` + */ + Awaited = 'awaited', + + /** + * @description `new Date()` + */ + Date = 'date', + + /** + * @description `new Error()` + */ + Error = 'error', + + /** + * @description `class Foo {}` + */ + Class = 'class', + + /** + * @description `new Foo()` where `class Foo {}` + */ + ClassInstance = 'classInstance', + + /** + * @description `new Map([['foo', 'bar']])` + */ + Map = 'map', + + /** + * @description `new Map()` + */ + EmptyMap = 'emptyMap', + + /** + * @description `new WeakMap([[{}, 'bar']])` + */ + WeakMap = 'weakMap', + + /** + * @description `new WeakMap()` + */ + EmptyWeakMap = 'emptyWeakMap', + + /** + * @description `new Set(['foo'])` + */ + Set = 'set', + + /** + * @description `new Set()` + */ + EmptySet = 'emptySet', + + /** + * @description `new WeakSet([{}])` + */ + WeakSet = 'weakSet', + + /** + * @description `new WeakSet()` + */ + EmptyWeakSet = 'emptyWeakSet', +} diff --git a/src/lib-test/value.ts b/src/lib-test/value.ts new file mode 100644 index 0000000..4421bde --- /dev/null +++ b/src/lib-test/value.ts @@ -0,0 +1,241 @@ +/* eslint-disable max-lines */ +import { ValueType } from './type' + +type ValueFactory = () => unknown + +// WeakMap, WeakSet 用のキー +const persistentObject1 = { key: 1 } +Object.freeze(persistentObject1) + +const persistentObject2 = { key: 2 } +Object.freeze(persistentObject2) + +const generators = { + [ValueType.True]: () => true, + [ValueType.False]: () => false, + [ValueType.BooleanObject]: () => new Boolean(true), + [ValueType.ObjectToPrimitiveBoolean]: () => ({ [Symbol.toPrimitive]: () => true }), + [ValueType.ObjectValueOfBoolean]: () => ({ valueOf: () => true }), + [ValueType.BooleanParsableTrue]: () => 'true', + [ValueType.BooleanParsableFalse]: () => 'false', + [ValueType.Null]: () => null, + [ValueType.ObjectToPrimitiveNull]: () => ({ [Symbol.toPrimitive]: () => null }), + [ValueType.ObjectValueOfNull]: () => ({ valueOf: () => null }), + [ValueType.Undefined]: () => undefined, + [ValueType.ObjectToPrimitiveUndefined]: () => ({ [Symbol.toPrimitive]: () => undefined }), + [ValueType.ObjectValueOfUndefined]: () => ({ valueOf: () => undefined }), + [ValueType.PositiveNumber]: () => 1, + [ValueType.PositiveInfinity]: () => Infinity, + [ValueType.Zero]: () => 0, + [ValueType.NegativeNumber]: () => -1, + [ValueType.NegativeInfinity]: () => -Infinity, + [ValueType.NumberObject]: () => new Number(1), + [ValueType.ObjectToPrimitiveNumber]: () => ({ [Symbol.toPrimitive]: () => 1 }), + [ValueType.ObjectValueOfNumber]: () => ({ valueOf: () => 1 }), + [ValueType.PositiveBigInt]: () => 1n, + [ValueType.NegativeBigInt]: () => -1n, + [ValueType.BigIntObject]: () => BigInt(1), + [ValueType.ObjectToPrimitiveBigInt]: () => ({ [Symbol.toPrimitive]: () => 1n }), + [ValueType.ObjectValueOfBigInt]: () => ({ valueOf: () => 1n }), + [ValueType.NaN]: () => NaN, + [ValueType.NumberParsablePositiveInt]: () => '123', + [ValueType.NumberStringLeadingZero]: () => '0123', + [ValueType.NumberParsableNegativeInt]: () => '-123', + [ValueType.NumberParsablePositiveFloat]: () => '123.456', + [ValueType.NumberParsableNegativeFloat]: () => '-123.456', + [ValueType.NumberParsablePositiveInfinity]: () => 'Infinity', + [ValueType.NumberParsableNegativeInfinity]: () => '-Infinity', + [ValueType.String]: () => 'foo', + [ValueType.EmptyString]: () => '', + [ValueType.StringObject]: () => new String('foo'), + [ValueType.ObjectToPrimitiveString]: () => ({ [Symbol.toPrimitive]: () => 'foo' }), + [ValueType.ObjectValueOfString]: () => ({ valueOf: () => 'foo' }), + [ValueType.ObjectToString]: () => ({ toString: () => 'foo' }), + [ValueType.JsonParsableNumber]: () => '123', + [ValueType.JsonParsableTrue]: () => 'true', + [ValueType.JsonParsableFalse]: () => 'false', + [ValueType.JsonParsableNull]: () => 'null', + [ValueType.JsonParsableString]: () => '"foo"', + [ValueType.JsonParsableObject]: () => '{"foo":"bar"}', + [ValueType.JsonParsableComplexObject]: () => '{"foo":{"bar":"baz"}, "qux": [1,2,3]}', + [ValueType.JsonParsableEmptyObject]: () => '{}', + [ValueType.JsonParsableArray]: () => '[1,2,3]', + [ValueType.JsonParsableEmptyArray]: () => '[]', + [ValueType.Array]: () => [1, 2, 3], + [ValueType.EmptyArray]: () => [], + [ValueType.BlankArray]: () => Array(3), + [ValueType.ArrayLike]: () => ({ length: 3 }), + [ValueType.ArrayBuffer]: () => new ArrayBuffer(8), + [ValueType.Uint8Array]: () => new Uint8Array([1, 2, 3]), + [ValueType.Uint8ClampedArray]: () => new Uint8ClampedArray([1, 2, 3]), + [ValueType.Uint16Array]: () => new Uint16Array([1, 2, 3]), + [ValueType.Uint32Array]: () => new Uint32Array([1, 2, 3]), + [ValueType.Int8Array]: () => new Int8Array([1, 2, 3]), + [ValueType.Int16Array]: () => new Int16Array([1, 2, 3]), + [ValueType.Int32Array]: () => new Int32Array([1, 2, 3]), + [ValueType.Float32Array]: () => new Float32Array([1, 2, 3]), + [ValueType.Float64Array]: () => new Float64Array([1, 2, 3]), + [ValueType.BigInt64Array]: () => new BigInt64Array([1n, 2n, 3n]), + [ValueType.BigUint64Array]: () => new BigUint64Array([1n, 2n, 3n]), + [ValueType.SharedArrayBuffer]: () => new SharedArrayBuffer(8), + [ValueType.DataView]: () => new DataView(new ArrayBuffer(8)), + [ValueType.EmptyDataView]: () => new DataView(new ArrayBuffer(0)), + [ValueType.Buffer]: () => Buffer.from('foo'), + [ValueType.EmptyBuffer]: () => Buffer.alloc(0), + [ValueType.Object]: () => ({ foo: 'bar' }), + [ValueType.EmptyObject]: () => ({}), + [ValueType.BlankObject]: () => Object.create(null), + [ValueType.RecursiveObject]: () => { + // biome-ignore lint/suspicious/noExplicitAny: + const obj: any = {} + obj.foo = obj + return obj + }, + [ValueType.WellKnownSymbolObject]: () => ({ [Symbol.toStringTag]: () => 'Foo' }), + [ValueType.IterableObject]: () => ({ + *[Symbol.iterator]() { + yield 1 + }, + }), + [ValueType.AsyncIterableObject]: () => ({ + async *[Symbol.asyncIterator]() { + yield await 1 + }, + }), + [ValueType.JsonifiableObject]: () => ({ + foo: 'bar', + // biome-ignore lint/style/useNamingConvention: + baz: { toJSON: (k: string | number) => `${k}` }, + }), + // biome-ignore lint/style/useNamingConvention: + [ValueType.JsonifiableObjectInArray]: () => [{ toJSON: (k: string | number) => `${k}` }], + [ValueType.RegExp]: () => /foo/, + [ValueType.Proxy]: () => new Proxy({}, {}), + [ValueType.Promise]: () => + new Promise(() => { + return + }), + [ValueType.ThenableObject]: () => ({ + then: () => { + return + }, + }), + [ValueType.ThenableFunction]: () => { + const fn = () => { + return + } + fn.then = () => { + return + } + return fn + }, + [ValueType.ThenableInstance]: () => + new (class Foo { + then() { + return + } + })(), + [ValueType.Awaited]: async () => await Promise.resolve(), + [ValueType.Date]: () => new Date(), + [ValueType.Error]: () => new Error(), + [ValueType.Class]: () => + class Foo { + bar() { + return 'bar' + } + get baz() { + return 'baz' + } + qux = 'qux' + }, + [ValueType.ClassInstance]: () => + new (class Foo { + bar() { + return 'bar' + } + get baz() { + return 'baz' + } + qux = 'qux' + })(), + [ValueType.Map]: () => new Map([['foo', 'bar']]), + [ValueType.EmptyMap]: () => new Map(), + [ValueType.WeakMap]: () => new WeakMap([[persistentObject1, 'bar']]), + [ValueType.EmptyWeakMap]: () => new WeakMap(), + [ValueType.Set]: () => new Set([1, 2, 3]), + [ValueType.EmptySet]: () => new Set(), + [ValueType.WeakSet]: () => new WeakSet([persistentObject1, persistentObject2]), + [ValueType.EmptyWeakSet]: () => new WeakSet(), + [ValueType.Function]: () => () => { + return + }, + [ValueType.AsyncFunction]: () => async () => { + await 0 + return + }, + [ValueType.GeneratorFunction]: () => + function* () { + yield 1 + }, + [ValueType.AsyncGeneratorFunction]: () => + async function* () { + yield await 1 + }, + [ValueType.Symbol]: () => Symbol('foo'), + [ValueType.ObjectToPrimitiveSymbol]: () => ({ [Symbol.toPrimitive]: () => Symbol('foo') }), + [ValueType.ObjectValueOfSymbol]: () => ({ valueOf: () => Symbol('foo') }), +} as const satisfies Record> + +Object.freeze(generators) + +/** + * Returns a list of all ValueTypes. + */ +export function allTypes(): ValueType[] { + return Object.values(ValueType) +} + +export interface PickTypesOption { + parsableString?: boolean + typedArray?: boolean +} + +/** + * Returns a list of ValueTypes that you want to test by specifying expect targets. + * Here, Value Types that generate the same value (equivalent by '===') as the specified expect types are skipped. + */ +export function testTypes(expectTargets: ValueType[], opt: PickTypesOption = {}): ValueType[] { + const targetTypes = allTypes().filter((t) => { + let result = true + + if (!opt.parsableString) { + result &&= !(t.toLocaleLowerCase().includes('parsable') || t.toLocaleLowerCase().includes('jsonifiable')) + } + + if (!opt.typedArray) { + result &&= !(/^uint|int|float|bigInt|bigUint/.test(t) && t.endsWith('Array')) + } + + return result + }) + + const cachedValues = targetTypes.reduce( + (acc, t): Partial> => { + acc[t] = getGenerator(t)() + return acc + }, + {} as Partial>, + ) as Record + + return targetTypes.filter( + (t) => expectTargets.includes(t) || !expectTargets.some((e) => cachedValues[t] === cachedValues[e]), + ) +} + +export function getGenerator(type: ValueType): () => unknown { + return generators[type] +} + +export interface TestOption { + negative?: boolean +} diff --git a/src/lib/error/error.ts b/src/lib/error/error.ts index fef423b..ae0b6c0 100644 --- a/src/lib/error/error.ts +++ b/src/lib/error/error.ts @@ -1,6 +1,9 @@ export class TypeAssertionError extends Error { - constructor(message: string, public readonly actualData: unknown) { - super(message) + public readonly actualData: unknown + + constructor(message: string, _actualData: unknown, opt?: ErrorOptions) { + super(message, opt) + this.actualData = _actualData this.name = 'TypeAssertionError' } } diff --git a/src/lib/error/message.ts b/src/lib/error/message.ts index 0064d68..b2ec6f4 100644 --- a/src/lib/error/message.ts +++ b/src/lib/error/message.ts @@ -7,18 +7,13 @@ function actualTypeOf(target: unknown): string { if (target === null) { return `null ${suffix}` } - return `object (constructor: ${target.constructor.name}) ${suffix}` + return `object (constructor: ${target.constructor?.name ?? 'object'}) ${suffix}` } -export function errorMessage( - expectedType: string, - { not }: { not?: boolean } = {} -): (target: unknown) => string { +export function errorMessage(expectedType: string, { not }: { not?: boolean } = {}): (target: unknown) => string { if (not) { return (actualValue) => { - return `Expected a value not of type ${expectedType}, but received ${actualTypeOf( - actualValue - )}.` + return `Expected a value not of type ${expectedType}, but received ${actualTypeOf(actualValue)}.` } } return (actualValue) => { diff --git a/src/lib/factory.ts b/src/lib/factory.ts index 862c55a..6c2a381 100644 --- a/src/lib/factory.ts +++ b/src/lib/factory.ts @@ -13,8 +13,8 @@ import type { TypeErrorMessage, TypeFallback, TypeGuard, - VoidAssert -} from './type' + VoidAssert, +} from './types' import { TypeAssertionError } from './error' @@ -119,10 +119,7 @@ export function not(guard: (arg: unknown) => boolean): Not { * const assertString = createAssertion(isString, 'target must be a string') * ``` */ -export function createAssertion( - guard: T, - message: TypeErrorMessage -): TypeAssertOf +export function createAssertion(guard: T, message: TypeErrorMessage): TypeAssertOf /** * @description create a type assertion from a inverted type guard. @@ -136,10 +133,7 @@ export function createAssertion( * const assertNotString = createAssertion(not(isString), 'target must not be a string') * ``` */ -export function createAssertion( - guard: Not, - message: TypeErrorMessage -): InvertedTypeAssertOf +export function createAssertion(guard: Not, message: TypeErrorMessage): InvertedTypeAssertOf /** * @description create a type assertion from a type predicate. @@ -169,7 +163,7 @@ export function createAssertion(guard: (target: unknown) => boolean, message: Ty export function createAssertion( guard: (target: unknown) => boolean, - message: TypeErrorMessage + message: TypeErrorMessage, ): TypeAssert | InvertedTypeAssert | VoidAssert { return ((target: unknown, overrideMessage?: TypeErrorMessage) => { if (!guard(target)) { @@ -190,7 +184,7 @@ export function createAssertion( * const ensureString = createEnsure(isString, 'target must be a string') * ``` */ -export function createEnsure(guard: TypeGuard, message: TypeErrorMessage): TypeEnsureOf +export function createEnsure(guard: T, message: TypeErrorMessage): TypeEnsureOf /** * @description create a type ensure from a inverted type guard. @@ -220,7 +214,6 @@ export function createEnsure(guard: Not, message: TypeEr */ export function createEnsure(guard: (target: unknown) => target is T, message: TypeErrorMessage): TypeEnsure - /** * @description create a type ensure from a type predicate. This is a type-unsafe version of `createEnsure`. * @param guard {(arg: unknown) => boolean} type guard predicate @@ -235,7 +228,7 @@ export function createEnsure(guard: (target: unknown) => boolean, message: TypeE export function createEnsure( guard: (target: unknown) => boolean, - message: TypeErrorMessage + message: TypeErrorMessage, ): TypeEnsure | InvertedTypeEnsure { return ((target: unknown, overrideMessage?: TypeErrorMessage) => { const assert = createAssertion(guard, message) @@ -268,9 +261,7 @@ export function createFallback(guard: T): TypeFallback( - guard: Not -): InvertedTypeFallback> +export function createFallback(guard: Not): InvertedTypeFallback> /** * @description create a type fallback from a type predicate. @@ -296,8 +287,8 @@ export function createFallback(guard: (target: unknown) => target is T): Type */ export function createFallback(guard: (target: unknown) => boolean): TypeFallback -export function createFallback( - guard: (target: unknown) => boolean -): TypeFallback | InvertedTypeFallback { - return ((target: unknown, fallback: unknown) => (guard(target) ? target : fallback)) as TypeFallback | InvertedTypeFallback +export function createFallback(guard: (target: unknown) => boolean): TypeFallback | InvertedTypeFallback { + return ((target: unknown, fallback: unknown) => (guard(target) ? target : fallback)) as + | TypeFallback + | InvertedTypeFallback } diff --git a/src/lib/index.ts b/src/lib/index.ts new file mode 100644 index 0000000..ecb03fa --- /dev/null +++ b/src/lib/index.ts @@ -0,0 +1,3 @@ +export * from './error' +export * from './factory' +export * from './types' diff --git a/src/lib/test/index.ts b/src/lib/test/index.ts deleted file mode 100644 index c9968fd..0000000 --- a/src/lib/test/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './tester' diff --git a/src/lib/test/tester.ts b/src/lib/test/tester.ts deleted file mode 100644 index 9d75859..0000000 --- a/src/lib/test/tester.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { expect, test } from 'vitest' -import { - InvertedTypeAssert, - InvertedTypeEnsure, - InvertedTypeFallback, - TypeAssert, - TypeEnsure, - TypeFallback, - TypeGuard, - Not -} from '../..' -import { type TestOption, allTypes, getGenerator } from './value' - -type ExpectGuard = (v: unknown) => boolean - -function xor(a: boolean | null | undefined, b: boolean | null | undefined): boolean { - return ((a as boolean) && (!b as boolean)) || ((!a as boolean) && (b as boolean)) -} - -/** - * specifies TypeGuard function retuens should be same as lodash function - * - * @param actualGuard set TypeGuard function - * @param expectGuard set lodash function - * @param opt - */ -export function testGuard( - actualGuard: TypeGuard | Not, - expectGuard: ExpectGuard, - opt: TestOption = {} -): void { - test.each(allTypes())('test value type: %s', (type) => { - const generate = getGenerator(type) - if (opt.negative) { - expect(actualGuard(generate())).not.toBe(expectGuard(generate())) - } else { - expect(actualGuard(generate())).toBe(expectGuard(generate())) - } - }) -} - -/** - * specifies TypeAssert of InvertedTypeAssert function should throw or not that same as lodash function condition - * - * @param actualAssert set TypeAssert function (if opt.negative is true, set InvertedTypeAssert function) - * @param expectGuard set lodash function - * @param opt - */ -export function testAssert( - actualAssert: TypeAssert | InvertedTypeAssert, - expectGuard: ExpectGuard, - opt: TestOption = {} -): void { - test.each(allTypes())('test value type: %s', (type) => { - const generate = getGenerator(type) - - if (xor(expectGuard(generate()), opt.negative)) { - // (lodash.isString: true, negative: false) or (lodash.isString: false, negative: true) - // assertString should not throw - - expect(() => actualAssert(generate())).not.toThrow() - } else { - // (lodash.isString: true, negative: true) or (lodash.isString: false, negative: false) - // assertString should throw - - expect(() => actualAssert(generate())).toThrow() - } - }) -} - -/** - * specifies TypeEnsure of InvertedTypeEnsure function should return or throw that same as lodash function condition - * - * @param ensure set TypeEnsure function (if opt.negative is true, set InvertedTypeEnsure function) - * @param expectGuard set lodash function - * @param opt - */ -export function testEnsure( - ensure: TypeEnsure | InvertedTypeEnsure, - expectGuard: ExpectGuard, - opt: TestOption = {} -): void { - test.each(allTypes())('test value type: %s', (type) => { - const generate = getGenerator(type) - - if (xor(expectGuard(generate()), opt.negative)) { - // (lodash.isString: true, negative: false) or (lodash.isString: false, negative: true) - // ensureString should not throw and return value that same as argument - - const value = generate() - expect(ensure(value)).toEqual(value) - } else { - // (lodash.isString: true, negative: true) or (lodash.isString: false, negative: false) - // ensureString should throw - - expect(() => ensure(generate())).toThrow() - } - }) -} - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -type AnyFunction = (...args: any[]) => any - -/** - * specifies TypeFallback of InvertedTypeFallback function should return that same as lodash function condition - * - * @param fallback set TypeFallback function (if opt.negative is true, set InvertedTypeFallback function) - * @param expectGuard set lodash function - * @param opt - */ -export function testFallback( - fallback: TypeFallback | InvertedTypeFallback, - expectGuard: ExpectGuard, - opt: TestOption & { fallbackValue: unknown } -): void - -// TypeFallback | InvertedTypeFallback is difficult to type safe, so use AnyFunction -export function testFallback( - fallback: AnyFunction, - expectGuard: ExpectGuard, - opt: TestOption & { fallbackValue: unknown } -): void { - test.each(allTypes())('test value type: %s', (type) => { - const generate = getGenerator(type) - const value = generate() - - // (lodash.isString: true, negative: false) or (lodash.isString: false, negative: true) - // fallbackString should return value that same as first argument - - // (lodash.isString: true, negative: true) or (lodash.isString: false, negative: false) - // fallbackString should return fallback value - - const expected = xor(expectGuard(generate()), opt.negative) ? value : opt.fallbackValue - expect(fallback(value, opt.fallbackValue)).toEqual(expected) - }) -} diff --git a/src/lib/test/type.ts b/src/lib/test/type.ts deleted file mode 100644 index 7dd2921..0000000 --- a/src/lib/test/type.ts +++ /dev/null @@ -1,211 +0,0 @@ -export enum ValueType { - /** - * @description `true` - */ - True = 'true', - - /** - * @description `false` - */ - False = 'false', - - /** - * @description `null` - */ - Null = 'null', - - /** - * @description `undefined` - */ - Undefined = 'undefined', - - /** - * @description `1` - */ - PositiveNumber = 'positiveNumber', - - /** - * @description `Infinity` - */ - PositiveInfinity = 'positiveInfinity', - - /** - * @description `0` - */ - Zero = 'zero', - - /** - * @description `-1` - */ - NegativeNumber = 'negativeNumber', - - /** - * @description `-Infinity` - */ - NegativeInfinity = 'negativeInfinity', - - /** - * @description `BigInt(1)` - */ - PositiveBigInt = 'positiveBigint', - - /** - * @description `BigInt(-1)` - */ - NegativeBigInt = 'negativeBigint', - - /** - * @description `NaN` - */ - NaN = 'NaN', - - /** - * @description `'foo'` - */ - String = 'string', - - /** - * @description `''` - */ - EmptyString = 'emptyString', - - /** - * @description `[1, 2, 3]` - */ - Array = 'array', - - /** - * @description `[]` - */ - EmptyArray = 'emptyArray', - - /** - * @description `Array(3)` - */ - BlankArray = 'spacedArray', - - /** - * @description `document.body.children` - */ - ArrayLike = 'arrayLike', - - /** - * @description `new ArrayBuffer(8)` - */ - ArrayBuffer = 'arrayBuffer', - - /** - * @description `{ foo: 'bar' }` - */ - Object = 'object', - - /** - * @description `{ }` - */ - EmptyObject = 'emptyObject', - - /** - * @description `{ foo: [Circular] }` - */ - RecursiveObject = 'recursiveObject', - - /** - * @description `() => void 0` - */ - Function = 'function', - - /** - * @description `async () => void 0` - */ - AsyncFunction = 'asyncFunction', - - /** - * @description `function* () { yield 1 }` - */ - GeneratorFunction = 'generatorFunction', - - /** - * @description `async function* () { yield 1 }` - */ - AsyncGeneratorFunction = 'asyncGeneratorFunction', - - /** - * @description `Symbol('foo')` - */ - Symbol = 'symbol', - - /** - * @description `new Proxy({}, {})` - */ - Proxy = 'proxy', - - /** - * @description `new Promise(() => void 0)` - */ - Promise = 'promise', - - /** - * @description `{ then: () => void 0 }` - */ - PromiseLike = 'promiseLike', - - /** - * @description `new Date()` - */ - Date = 'date', - - /** - * @description `new Error()` - */ - Error = 'error', - - /** - * @description `class Foo {}` - */ - Class = 'class', - - /** - * @description `new Foo()` where `class Foo {}` - */ - ClassInstance = 'classInstance', - - /** - * @description `new Map([['foo', 'bar']])` - */ - Map = 'map', - - /** - * @description `new Map()` - */ - EmptyMap = 'emptyMap', - - /** - * @description `new WeakMap([[{}, 'bar']])` - */ - WeakMap = 'weakMap', - - /** - * @description `new WeakMap()` - */ - EmptyWeakMap = 'emptyWeakMap', - - /** - * @description `new Set(['foo'])` - */ - Set = 'set', - - /** - * @description `new Set()` - */ - EmptySet = 'emptySet', - - /** - * @description `new WeakSet([{}])` - */ - WeakSet = 'weakSet', - - /** - * @description `new WeakSet()` - */ - EmptyWeakSet = 'emptyWeakSet' -} diff --git a/src/lib/test/value.ts b/src/lib/test/value.ts deleted file mode 100644 index cd224d8..0000000 --- a/src/lib/test/value.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { ValueType } from './type' - -type ValueFactory = () => unknown - -const generators = { - [ValueType.True]: () => true, - [ValueType.False]: () => false, - [ValueType.Null]: () => null, - [ValueType.Undefined]: () => undefined, - [ValueType.PositiveNumber]: () => 1, - [ValueType.PositiveInfinity]: () => Infinity, - [ValueType.Zero]: () => 0, - [ValueType.NegativeNumber]: () => -1, - [ValueType.NegativeInfinity]: () => -Infinity, - [ValueType.PositiveBigInt]: () => BigInt(1), - [ValueType.NegativeBigInt]: () => BigInt(-1), - [ValueType.NaN]: () => NaN, - [ValueType.String]: () => 'foo', - [ValueType.EmptyString]: () => '', - [ValueType.Array]: () => [1, 2, 3], - [ValueType.EmptyArray]: () => [], - [ValueType.BlankArray]: () => Array(3), - [ValueType.ArrayLike]: () => ({ length: 3 }), - [ValueType.ArrayBuffer]: () => new ArrayBuffer(8), - [ValueType.Object]: () => ({ foo: 'bar' }), - [ValueType.EmptyObject]: () => ({}), - [ValueType.RecursiveObject]: () => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const obj: any = {} - obj.foo = obj - return obj as {} - }, - [ValueType.Proxy]: () => new Proxy({}, {}), - [ValueType.Promise]: () => new Promise(() => void 0), - [ValueType.PromiseLike]: () => ({ then: () => void 0 }), - [ValueType.Date]: () => new Date(), - [ValueType.Error]: () => new Error(), - [ValueType.Class]: () => class Foo {}, - [ValueType.ClassInstance]: () => new (class Foo {})(), - [ValueType.Map]: () => new Map([['foo', 'bar']]), - [ValueType.EmptyMap]: () => new Map(), - [ValueType.WeakMap]: () => new WeakMap([[{}, 'bar']]), - [ValueType.EmptyWeakMap]: () => new WeakMap(), - [ValueType.Set]: () => new Set([1, 2, 3]), - [ValueType.EmptySet]: () => new Set(), - [ValueType.WeakSet]: () => new WeakSet([{}, {}]), - [ValueType.EmptyWeakSet]: () => new WeakSet(), - [ValueType.Function]: () => () => void 0, - [ValueType.AsyncFunction]: () => async () => void 0, - [ValueType.GeneratorFunction]: () => - function* () { - yield 1 - }, - [ValueType.AsyncGeneratorFunction]: () => - async function* () { - yield 1 - }, - [ValueType.Symbol]: () => Symbol('foo') -} as const satisfies Record> - -Object.freeze(generators) - -export function allTypes(): ValueType[] { - return Object.values(ValueType) -} - -export function getGenerator(type: ValueType): () => unknown { - return generators[type] -} - -export interface TestOption { - negative?: boolean -} diff --git a/src/lib/type.ts b/src/lib/type.ts deleted file mode 100644 index 1e2b656..0000000 --- a/src/lib/type.ts +++ /dev/null @@ -1,122 +0,0 @@ -/** - * @description error message factory receives the target value as the first argument - */ -export type TypeErrorMessage = string | ((target: unknown) => string) - -type Branded = { - [_ in `__branded_${T}`]: never -} - -/** - * @description type guard - */ -export interface TypeGuard extends Branded<'type_guard'> { - (target: unknown): target is U -} - -/** - * @description inverted type guard - */ -export interface InvertedTypeGuard extends Branded<'inverted_type_guard'> { - (target: T | U): target is Exclude -} - -/** - * @description inverted type guard - */ -export type Not = InvertedTypeGuard> - -/** - * - */ -export type GuardedType = T extends TypeGuard - ? U - : T extends InvertedTypeGuard - ? U - : never - -/** - * @description type assertion. - */ -export interface TypeAssert extends Branded<'type_assert'> { - (target: unknown, message?: TypeErrorMessage): asserts target is T -} - -/** - * @description assert function. but it does not assert types. - */ -export interface VoidAssert extends Branded<'void_assert'> { - (target: unknown, message?: TypeErrorMessage): void -} - -/** - * @description inverted type assertion. - */ -export interface InvertedTypeAssert extends Branded<'inverted_type_assert'> { - (target: U | T, message?: TypeErrorMessage): asserts target is Exclude -} - -/** - * - */ -export type TypeAssertOf = TypeAssert> - -/** - * - */ -export type InvertedTypeAssertOf = InvertedTypeAssert> - -/** - * @description type ensure. - */ -export interface TypeEnsure extends Branded<'type_ensurer'> { - (target: U, message?: TypeErrorMessage): U extends T ? U : never -} - -/** - * @description inverted type ensure. - */ -export interface InvertedTypeEnsure extends Branded<'inverted_type_ensurer'> { - (target: U | T, message?: TypeErrorMessage): U extends T ? never : U -} - -/** - * - */ -export type TypeEnsureOf = TypeEnsure> - -/** - * - */ -export type InvertedTypeEnsureOf = InvertedTypeEnsure> - -/** - * - */ -export interface PartialFallback { - (target: V, fallback: W): V extends U ? U : W -} - -/** - * @description type fallback. - */ -export interface TypeFallback extends Branded<'type_fallback'> { - (target: U, fallback: V): U extends T ? U : V -} - -/** - * @description inverted type fallback. - */ -export interface InvertedTypeFallback extends Branded<'inverted_type_fallback'> { - (target: U, fallback: Exclude): U extends T ? V : U -} - -/** - * - */ -export type TypeFallbackOf = TypeFallback> - -/** - * - */ -export type InvertedTypeFallbackOf = InvertedTypeFallback> diff --git a/src/lib/types/index.ts b/src/lib/types/index.ts new file mode 100644 index 0000000..dca7843 --- /dev/null +++ b/src/lib/types/index.ts @@ -0,0 +1,2 @@ +export * from './json' +export * from './type-guards' diff --git a/src/lib/types/json.ts b/src/lib/types/json.ts new file mode 100644 index 0000000..43dae2d --- /dev/null +++ b/src/lib/types/json.ts @@ -0,0 +1,7 @@ +export type JsonValue = JsonPrimitive | JsonArray | JsonObject + +export type JsonPrimitive = string | number | boolean | null + +export type JsonArray = JsonValue[] | readonly JsonValue[] + +export type JsonObject = { [Key in string]: JsonValue } & { [Key in string]?: JsonValue | undefined } diff --git a/src/lib/types/type-guards.ts b/src/lib/types/type-guards.ts new file mode 100644 index 0000000..972502c --- /dev/null +++ b/src/lib/types/type-guards.ts @@ -0,0 +1,92 @@ +/** + * @description error message factory receives the target value as the first argument + */ +export type TypeErrorMessage = string | ((target: unknown) => string) + +/** + * @description type guard + */ +export interface TypeGuard { + (target: unknown): target is U +} + +/** + * @description inverted type guard + */ +export interface InvertedTypeGuard { + (target: T | U): target is unknown extends T | U ? unknown : Exclude +} + +/** + * @description inverted type guard + */ +export type Not = InvertedTypeGuard> + +/** + * + */ +export type GuardedType = T extends TypeGuard + ? U + : T extends InvertedTypeGuard + ? U + : never + +/** + * @description type assertion. + */ +export interface TypeAssert { + (target: unknown, message?: TypeErrorMessage): asserts target is U + (target: unknown, message?: TypeErrorMessage): asserts target is T +} + +/** + * @description assert function. but it does not assert types. + */ +export interface VoidAssert { + (target: unknown, message?: TypeErrorMessage): void +} + +/** + * + */ +export type TypeAssertOf = TypeAssert> + +/** + * @description type ensure. + */ +export interface TypeEnsure { + (target: U | V, message?: TypeErrorMessage): unknown extends U + ? T + : Extract extends never + ? T + : Extract + + (target: unknown, message?: TypeErrorMessage): unknown extends W + ? T + : Extract extends never + ? T + : Extract +} + +/** + * + */ +export type TypeEnsureOf = TypeEnsure> + +/** + * @description type fallback. + */ +export interface TypeFallback { + (target: U, fallback: V): + | (unknown extends U ? T : Extract extends never ? T : Extract) + | V + + (target: unknown, fallback: X): + | (unknown extends X ? T : Extract extends never ? T : Extract) + | X +} + +/** + * + */ +export type TypeFallbackOf = TypeFallback> diff --git a/src/typeGuards/array/assert.spec-d.ts b/src/typeGuards/array/assert.spec-d.ts index ca40b04..8ae9e9c 100644 --- a/src/typeGuards/array/assert.spec-d.ts +++ b/src/typeGuards/array/assert.spec-d.ts @@ -1,67 +1,66 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' +import { describe, expectTypeOf, test } from 'vitest' import { assertArray, assertNotArray } from '.' describe('isArray type tests', () => { test('assert definite types.', () => { - const targetArray = [] as string[] | string - assertArray(targetArray) - assertType(targetArray) + const target = [] as string[] | string + assertArray(target) + expectTypeOf(target).toEqualTypeOf() }) test('assert unknown types', () => { - const targetUnknown = 'string' as unknown - assertArray(targetUnknown) - assertType(targetUnknown) + const target = 'string' as unknown + assertArray(target) + expectTypeOf(target).toEqualTypeOf() }) test('assert union types', () => { - const targetUnion = [] as string[] | number[] | string - assertArray(targetUnion) - assertType(targetUnion) + const target = [] as string[] | number[] | string + assertArray(target) + expectTypeOf(target).toEqualTypeOf() }) test('assert union types 2', () => { - const targetUnion2 = [] as Array | string | number - assertArray(targetUnion2) - assertType>(targetUnion2) + const target = [] as Array | string | number + assertArray(target) + expectTypeOf(target).toEqualTypeOf>() }) test('assert tuple types', () => { const tuple = ['', 0] as [string, number] | string | number assertArray(tuple) - assertType<[string, number]>(tuple) + expectTypeOf(tuple).toEqualTypeOf<[string, number]>() }) }) describe('isNotArray type tests', () => { test('assert definite types.', () => { - const targetArray = [] as string[] | string - assertNotArray(targetArray) - assertType(targetArray) + const target = [] as string[] | string + assertNotArray(target) + expectTypeOf(target).toEqualTypeOf() }) test('assert unknown types', () => { - const targetUnknown = 'string' as unknown - assertNotArray(targetUnknown) - assertType(targetUnknown) + const target = 'string' as unknown + assertNotArray(target) + expectTypeOf(target).toEqualTypeOf() }) test('assert union types', () => { - const targetUnion = [] as string[] | number[] | string - assertNotArray(targetUnion) - assertType(targetUnion) + const target = [] as string[] | number[] | string + assertNotArray(target) + expectTypeOf(target).toEqualTypeOf() }) test('assert union types 2', () => { - const targetUnion2 = [] as Array | string | number - assertNotArray(targetUnion2) - assertType(targetUnion2) + const target = [] as Array | string | number + assertNotArray(target) + expectTypeOf(target).toEqualTypeOf() }) test('assert tuple types', () => { const tuple = ['', 0] as [string, number] | string | number assertNotArray(tuple) - assertType(tuple) + expectTypeOf(tuple).toEqualTypeOf() }) }) diff --git a/src/typeGuards/array/ensure.spec-d.ts b/src/typeGuards/array/ensure.spec-d.ts index 62b7ef2..53a8a52 100644 --- a/src/typeGuards/array/ensure.spec-d.ts +++ b/src/typeGuards/array/ensure.spec-d.ts @@ -1,57 +1,66 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' +import { describe, expectTypeOf, test } from 'vitest' import { ensureArray, ensureNotArray } from '.' describe('ensureArray type tests', () => { test('ensure definite types.', () => { - const targetArray = [] as string[] | string - assertType(ensureArray(targetArray)) + const target = [] as string[] | string + const result = ensureArray(target) + expectTypeOf(result).toEqualTypeOf() }) test('ensure unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(ensureArray(targetUnknown)) + const target = 'string' as unknown + const result = ensureArray(target) + expectTypeOf(result).toEqualTypeOf() }) test('ensure union types', () => { - const targetUnion = [] as string[] | number[] | string - assertType(ensureArray(targetUnion)) + const target = [] as string[] | number[] | string + const result = ensureArray(target) + expectTypeOf(result).toEqualTypeOf() }) test('ensure union types 2', () => { - const targetUnion2 = [] as Array | string | number - assertType>(ensureArray(targetUnion2)) + const target = [] as Array | string | number + const result = ensureArray(target) + expectTypeOf(result).toEqualTypeOf>() }) test('ensure tuple types', () => { const tuple = ['', 0] as [string, number] | string | number - assertType<[string, number]>(ensureArray(tuple)) + const result = ensureArray(tuple) + expectTypeOf(result).toEqualTypeOf<[string, number]>() }) }) describe('ensureNotArray type tests', () => { test('ensure definite types.', () => { - const targetArray = [] as string[] | string - assertType(ensureNotArray(targetArray)) + const target = [] as string[] | string + const result = ensureNotArray(target) + expectTypeOf(result).toEqualTypeOf() }) test('ensure unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(ensureNotArray(targetUnknown)) + const target = 'string' as unknown + const result = ensureNotArray(target) + expectTypeOf(result).toEqualTypeOf() }) test('ensure union types', () => { - const targetUnion = [] as string[] | number[] | string - assertType(ensureNotArray(targetUnion)) + const target = [] as string[] | number[] | string + const result = ensureNotArray(target) + expectTypeOf(result).toEqualTypeOf() }) test('ensure union types 2', () => { - const targetUnion2 = [] as Array | string | number - assertType(ensureNotArray(targetUnion2)) + const target = [] as Array | string | number + const result = ensureNotArray(target) + expectTypeOf(result).toEqualTypeOf() }) test('ensure tuple types', () => { const tuple = ['', 0] as [string, number] | string | number - assertType(ensureNotArray(tuple)) + const result = ensureNotArray(tuple) + expectTypeOf(result).toEqualTypeOf() }) }) diff --git a/src/typeGuards/array/fallback.spec-d.ts b/src/typeGuards/array/fallback.spec-d.ts index 2b807ff..f068341 100644 --- a/src/typeGuards/array/fallback.spec-d.ts +++ b/src/typeGuards/array/fallback.spec-d.ts @@ -1,46 +1,54 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' +import { describe, expectTypeOf, test } from 'vitest' import { fallbackArray, fallbackNotArray } from '.' describe('fallbackArray type tests', () => { test('fallback definite types.', () => { - const targetArray = [] as string[] | string - assertType(fallbackArray(targetArray, ['default'])) + const target = [] as string[] | string + const result = fallbackArray(target, ['default']) + expectTypeOf(result).toEqualTypeOf() }) test('fallback definite types with fallback never array', () => { - const targetNever = [] as string[] - assertType(fallbackArray(targetNever, [])) + const target = [] as string[] + const result = fallbackArray(target, []) + expectTypeOf(result).toEqualTypeOf() }) test('fallback definite type with unmatched fallback array', () => { - const targetArray = [] as string[] | string - assertType(fallbackArray(targetArray, [0])) + const target = [] as string[] | string + const result = fallbackArray(target, [0]) + expectTypeOf(result).toEqualTypeOf() }) test('fallback unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(fallbackArray(targetUnknown, ['default'] as unknown[])) + const target = 'string' as unknown + const result = fallbackArray(target, ['default'] as unknown[]) + expectTypeOf(result).toEqualTypeOf() }) test('fallback unknown types with fallback never array', () => { - const targetNever = 'string' as unknown - assertType(fallbackArray(targetNever, [])) + const target = 'string' as unknown + const result = fallbackArray(target, []) + expectTypeOf(result).toEqualTypeOf() }) test('fallback union types', () => { - const targetUnion = [] as string[] | number[] | string - assertType(fallbackArray(targetUnion, ['default'])) + const target = [] as string[] | number[] | string + const result = fallbackArray(target, ['default']) + expectTypeOf(result).toEqualTypeOf() }) test('fallback union types 2', () => { - const targetUnion2 = [] as Array | string | number - assertType>(fallbackArray(targetUnion2, ['default'])) + const target = [] as Array | string | number + const result = fallbackArray(target, ['default']) + expectTypeOf(result).toEqualTypeOf>() }) test('fallback tuple types', () => { const tuple = ['', 0] as [string, number] | string | number - assertType<[string] | [string, number]>(fallbackArray(tuple, ['default'])) + const result = fallbackArray(tuple, ['default']) + expectTypeOf(result).toEqualTypeOf<[string] | [string, number]>() }) test('uncorrect fallback type', () => { @@ -51,43 +59,51 @@ describe('fallbackArray type tests', () => { describe('fallbackNotArray type tests', () => { test('fallback definite types.', () => { - const targetArray = [] as string[] | string - assertType(fallbackNotArray(targetArray, 'default')) + const target = [] as string[] | string + const result = fallbackNotArray(target, 'default') + expectTypeOf(result).toEqualTypeOf() }) test('fallback definite types with fallback never array', () => { - const targetNever = [] as string[] - assertType(fallbackNotArray(targetNever, 'default')) + const target = [] as string[] + const result = fallbackNotArray(target, 'default') + expectTypeOf(result).toEqualTypeOf() }) test('fallback definite type with unmatched fallback array', () => { - const targetArray = [] as string[] | string - assertType(fallbackNotArray(targetArray, 0)) + const target = [] as string[] | string + const result = fallbackNotArray(target, 0) + expectTypeOf(result).toEqualTypeOf() }) test('fallback unknown types with unknown fallback value', () => { - const targetUnknown = 'string' as unknown - assertType(fallbackNotArray(targetUnknown, 'default' as unknown)) + const target = 'string' as unknown + const result = fallbackNotArray(target, 'default' as unknown) + expectTypeOf(result).toEqualTypeOf() }) test('fallback unknown types with definite fallback value', () => { - const targetNever = 'string' as unknown - assertType(fallbackNotArray(targetNever, 'default')) + const target = 'string' as unknown + const result = fallbackNotArray(target, 'default') + expectTypeOf(result).toEqualTypeOf() }) test('fallback union types', () => { - const targetUnion = [] as string[] | number[] | string - assertType(fallbackNotArray(targetUnion, 'default')) + const target = [] as string[] | number[] | string + const result = fallbackNotArray(target, 'default') + expectTypeOf(result).toEqualTypeOf() }) test('fallback union types 2', () => { - const targetUnion2 = [] as Array | string | number - assertType(fallbackNotArray(targetUnion2, 'default')) + const target = [] as Array | string | number + const result = fallbackNotArray(target, 'default') + expectTypeOf(result).toEqualTypeOf() }) test('fallback tuple types', () => { const tuple = ['', 0] as [string, number] | string | number - assertType(fallbackNotArray(tuple, 'default')) + const result = fallbackNotArray(tuple, 'default') + expectTypeOf(result).toEqualTypeOf() }) test('uncorrect fallback type', () => { diff --git a/src/typeGuards/array/guard.spec-d.ts b/src/typeGuards/array/guard.spec-d.ts index 389c42b..e5d038f 100644 --- a/src/typeGuards/array/guard.spec-d.ts +++ b/src/typeGuards/array/guard.spec-d.ts @@ -1,85 +1,84 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' +import { describe, expectTypeOf, test } from 'vitest' import { isArray, isNotArray } from '.' describe('isArray type tests', () => { test('guard definite types.', () => { - const targetArray = [] as string[] | string - if (isArray(targetArray)) { - assertType(targetArray) + const target = [] as string[] | string + if (isArray(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetArray) + expectTypeOf(target).toEqualTypeOf() } }) test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isArray(targetUnknown)) { - assertType(targetUnknown) + const target = 'string' as unknown + if (isArray(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetUnknown) + expectTypeOf(target).toEqualTypeOf() } }) test('guard union types', () => { - const targetUnion = [] as string[] | number[] | string - if (isArray(targetUnion)) { - assertType(targetUnion) + const target = [] as string[] | number[] | string + if (isArray(target)) { + expectTypeOf(target).toEqualTypeOf() } }) test('guard union types 2', () => { - const targetUnion2 = [] as Array | string | number - if (isArray(targetUnion2)) { - assertType>(targetUnion2) + const target = [] as Array | string | number + if (isArray(target)) { + expectTypeOf(target).toEqualTypeOf>() } }) test('guard tuple types', () => { const tuple = ['', 0] as [string, number] | string | number if (isArray(tuple)) { - assertType<[string, number]>(tuple) + expectTypeOf(tuple).toEqualTypeOf<[string, number]>() } }) }) describe('isNotArray type tests', () => { test('guard definite types.', () => { - const targetArray = [] as string[] | string - if (isNotArray(targetArray)) { - assertType(targetArray) + const target = [] as string[] | string + if (isNotArray(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetArray) + expectTypeOf(target).toEqualTypeOf() } }) test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isNotArray(targetUnknown)) { - assertType(targetUnknown) + const target = 'string' as unknown + if (isNotArray(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetUnknown) + expectTypeOf(target).toEqualTypeOf() } }) test('guard union types', () => { - const targetUnion = [] as string[] | number[] | string - if (isNotArray(targetUnion)) { - assertType(targetUnion) + const target = [] as string[] | number[] | string + if (isNotArray(target)) { + expectTypeOf(target).toEqualTypeOf() } }) test('guard union types 2', () => { - const targetUnion2 = [] as Array | string | number - if (isNotArray(targetUnion2)) { - assertType(targetUnion2) + const target = [] as Array | string | number + if (isNotArray(target)) { + expectTypeOf(target).toEqualTypeOf() } }) test('guard tuple types', () => { const tuple = ['', 0] as [string, number] | string | number if (isNotArray(tuple)) { - assertType(tuple) + expectTypeOf(tuple).toEqualTypeOf() } }) }) diff --git a/src/typeGuards/array/index.spec.ts b/src/typeGuards/array/index.spec.ts index 105edc0..2cfae73 100644 --- a/src/typeGuards/array/index.spec.ts +++ b/src/typeGuards/array/index.spec.ts @@ -1,45 +1,45 @@ -import { describe } from 'vitest' import expected from 'lodash/isArray.js' +import { describe } from 'vitest' import { - assertNotArray, assertArray, - ensureNotArray, + assertNotArray, ensureArray, - fallbackNotArray, + ensureNotArray, fallbackArray, + fallbackNotArray, isArray, - isNotArray + isNotArray, } from '.' -import { testAssert, testEnsure, testFallback, testGuard } from '../../lib/test' +import { testEquivalentAssert, testEquivalentEnsure, testEquivalentFallback, testEquivalentGuard } from '../../lib-test' describe('isArray', () => { - testGuard(isArray, expected) + testEquivalentGuard(isArray, expected) }) describe('isNotArray', () => { - testGuard(isNotArray, expected, { negative: true }) + testEquivalentGuard(isNotArray, expected, { negative: true }) }) describe('assertArray', () => { - testAssert(assertArray, expected) + testEquivalentAssert(assertArray, expected) }) describe('assertNotArray', () => { - testAssert(assertNotArray, expected, { negative: true }) + testEquivalentAssert(assertNotArray, expected, { negative: true }) }) describe('ensureArray', () => { - testEnsure(ensureArray, expected) + testEquivalentEnsure(ensureArray, expected) }) describe('ensureNotArray', () => { - testEnsure(ensureNotArray, expected, { negative: true }) + testEquivalentEnsure(ensureNotArray, expected, { negative: true }) }) describe('fallbackArray', () => { - testFallback(fallbackArray, expected, { fallbackValue: ['fallback'] }) + testEquivalentFallback(fallbackArray, expected, { fallbackValue: ['fallback'] }) }) describe('fallbackNotArray', () => { - testFallback(fallbackNotArray, expected, { negative: true, fallbackValue: 'fallback' }) + testEquivalentFallback(fallbackNotArray, expected, { negative: true, fallbackValue: 'fallback' }) }) diff --git a/src/typeGuards/array/index.ts b/src/typeGuards/array/index.ts index f8798ae..3e795cc 100644 --- a/src/typeGuards/array/index.ts +++ b/src/typeGuards/array/index.ts @@ -1,4 +1,5 @@ -import { createAssertion, createEnsure, createFallback, not } from '../../lib/factory' +import { createAssertion, createEnsure, createFallback, not } from '../../lib' +import { errorMessage } from '../../lib' import { InvertedTypeAssertOf, InvertedTypeEnsureOf, @@ -6,12 +7,12 @@ import { TypeAssertOf, TypeEnsureOf, TypeFallbackOf, - TypeGuard -} from '../../lib/type' -import { errorMessage } from '../../lib/error' + TypeGuard, +} from '../../lib/types' /** * Checks if a value is an array. + * * @param target The value to check. * @returns True if the value is an array, false otherwise. * @example @@ -28,6 +29,7 @@ type IsArray = typeof isArray /** * Asserts that a value is an array. + * * @param target The value to check. * @param message (optional) The error message to throw if the value is not an array. * @throws A TypeError with the given message if the value is not an array. @@ -43,6 +45,7 @@ export const assertArray: TypeAssertOf = createAssertion(isArray, error /** * Ensures that a value is an array. + * * @param target The value to check. * @param message (optional) The error message to throw if the value is not an array. * @throws A TypeError with the given message if the value is not an array. @@ -58,6 +61,7 @@ export const ensureArray: TypeEnsureOf = createEnsure(isArray, errorMes /** * Fallbacks to a default value if the value is not an array. + * * @param target The value to check. * @param defaultValue The default value to fallback to. * @example @@ -74,6 +78,7 @@ export const fallbackArray: TypeFallbackOf = createFallback(isArray) * * In an if statement, it is simpler to use ! operator is simpler, * but this method is useful in cases where the argument is a type guard function, such as Array.prototype.filter. + * * @param target The value to check. * @returns True if the value is not an array, false otherwise. * @example @@ -87,6 +92,7 @@ export const isNotArray = not(isArray) /** * Asserts that a value is not an array. + * * @param target The value to check. * @param message (optional) The error message to throw if the value is an array. * @throws A TypeError with the given message if the value is an array. @@ -99,11 +105,12 @@ export const isNotArray = not(isArray) */ export const assertNotArray: InvertedTypeAssertOf = createAssertion( not(isArray), - errorMessage('array', { not: true }) + errorMessage('array', { not: true }), ) /** * Enxures that a value is not an array. + * * @param target The value to check. * @param message (optional) The error message to throw if the value is an array. * @throws A TypeError with the given message if the value is an array. @@ -115,10 +122,14 @@ export const assertNotArray: InvertedTypeAssertOf = createAssertion( * // result is string * ``` */ -export const ensureNotArray: InvertedTypeEnsureOf = createEnsure(not(isArray), errorMessage('array', { not: true })) +export const ensureNotArray: InvertedTypeEnsureOf = createEnsure( + not(isArray), + errorMessage('array', { not: true }), +) /** * Fallbacks to a default value if the value is not an array. + * * @param target The value to check. * @param defaultValue The default value to fallback to. * @return The value if it is not an array, the default value otherwise. diff --git a/src/typeGuards/awaitable/assert.spec-d.ts b/src/typeGuards/awaitable/assert.spec-d.ts new file mode 100644 index 0000000..092bc05 --- /dev/null +++ b/src/typeGuards/awaitable/assert.spec-d.ts @@ -0,0 +1,42 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { assertAwaitable, assertNotAwaitable } from '.' + +describe('isAwaitable type tests', () => { + test('assert definite types.', () => { + const target = Promise.resolve() as Promise | void + assertAwaitable(target) + expectTypeOf(target).toEqualTypeOf>() + }) + + test('assert unknown types', () => { + const target = 'string' as unknown + assertAwaitable(target) + expectTypeOf(target).toEqualTypeOf>() + }) + + test('assert union types', () => { + const target = Promise.resolve() as unknown as Promise | string | number + assertAwaitable(target) + expectTypeOf(target).toEqualTypeOf>() + }) +}) + +describe('isNotAwaitable type tests', () => { + test('assert definite types.', () => { + const target = Promise.resolve() as Promise | void + assertNotAwaitable(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('assert unknown types', () => { + const target = 'string' as unknown + assertNotAwaitable(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('assert union types', () => { + const target = Promise.resolve() as unknown as Promise | string | number + assertNotAwaitable(target) + expectTypeOf(target).toEqualTypeOf() + }) +}) diff --git a/src/typeGuards/awaitable/ensure.spec-d.ts b/src/typeGuards/awaitable/ensure.spec-d.ts new file mode 100644 index 0000000..b150bc9 --- /dev/null +++ b/src/typeGuards/awaitable/ensure.spec-d.ts @@ -0,0 +1,42 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { ensureAwaitable, ensureNotAwaitable } from '.' + +describe('ensureAwaitable type tests', () => { + test('ensure definite types.', () => { + const target = Promise.resolve() as Promise | void + const result = ensureAwaitable(target) + expectTypeOf(result).toEqualTypeOf>() + }) + + test('ensure unknown types', () => { + const target = 'string' as unknown + const result = ensureAwaitable(target) + expectTypeOf(result).toEqualTypeOf>() + }) + + test('ensure union types', () => { + const target = Promise.resolve() as unknown as Promise | string | number + const result = ensureAwaitable(target) + expectTypeOf(result).toEqualTypeOf>() + }) +}) + +describe('ensureNotAwaitable type tests', () => { + test('ensure definite types.', () => { + const target = Promise.resolve() as Promise | void + const result = ensureNotAwaitable(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('ensure unknown types', () => { + const target = 'string' as unknown + const result = ensureNotAwaitable(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('ensure union types', () => { + const target = Promise.resolve() as unknown as Promise | string | number + const result = ensureNotAwaitable(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) diff --git a/src/typeGuards/awaitable/fallback.spec-d.ts b/src/typeGuards/awaitable/fallback.spec-d.ts new file mode 100644 index 0000000..5fcc81c --- /dev/null +++ b/src/typeGuards/awaitable/fallback.spec-d.ts @@ -0,0 +1,52 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { describe, expectTypeOf, test } from 'vitest' +import { fallbackAwaitable, fallbackNotAwaitable } from '.' + +describe('fallbackAwaitable type tests', () => { + test('fallback definite types.', () => { + const target = Promise.resolve('return') as Promise | string + const result = fallbackAwaitable(target, Promise.resolve('fallback')) + expectTypeOf(result).toEqualTypeOf>() + }) + + test('fallback types as union', () => { + const target = Promise.resolve('return') as Promise | string + const result = fallbackAwaitable(target, Promise.resolve(3)) + expectTypeOf(result).toEqualTypeOf>() + }) + + test('fallback union types', () => { + const target = Promise.resolve() as unknown as Promise | string | number + assertType>(fallbackAwaitable(target, Promise.resolve('fallback'))) + }) + + test('uncorrectable types', () => { + // @ts-expect-error + fallbackAwaitable(Promise.resolve('return'), 'return') + }) +}) + +describe('fallbackNotAwaitable type tests', () => { + test('fallback definite types.', () => { + const target = Promise.resolve('return') as Promise | string + const result = fallbackNotAwaitable(target, 'fallback') + expectTypeOf(result).toEqualTypeOf() + }) + + test('fallback types as union', () => { + const target = Promise.resolve('return') as Promise | string + const result = fallbackNotAwaitable(target, 3) + expectTypeOf(result).toEqualTypeOf() + }) + + test('fallback union types', () => { + const target = Promise.resolve() as unknown as Promise | string | number + const result = fallbackNotAwaitable(target, 'fallback') + expectTypeOf(result).toEqualTypeOf() + }) + + test('uncorrectable types', () => { + // @ts-expect-error + fallbackNotAwaitable('return', Promise.resolve('return')) + }) +}) diff --git a/src/typeGuards/awaitable/guard.spec-d.ts b/src/typeGuards/awaitable/guard.spec-d.ts new file mode 100644 index 0000000..56207d2 --- /dev/null +++ b/src/typeGuards/awaitable/guard.spec-d.ts @@ -0,0 +1,60 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { isAwaitable, isNotAwaitable } from '.' + +describe('isAwaitable type tests', () => { + test('guard definite types.', () => { + const target = Promise.resolve() as Promise | void + if (isAwaitable(target)) { + expectTypeOf(target).toEqualTypeOf>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('guard unknown types', () => { + const target = 'string' as unknown + if (isAwaitable(target)) { + expectTypeOf(target).toEqualTypeOf>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('guard union types', () => { + const target = Promise.resolve() as unknown as Promise | string | number + if (isAwaitable(target)) { + expectTypeOf(target).toEqualTypeOf>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('isNotAwaitable type tests', () => { + test('guard definite types.', () => { + const target = Promise.resolve() as Promise | void + if (isNotAwaitable(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf>() + } + }) + + test('guard unknown types', () => { + const target = 'string' as unknown + if (isNotAwaitable(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf>() + } + }) + + test('guard union types', () => { + const target = Promise.resolve() as unknown as Promise | string | number + if (isNotAwaitable(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf>() + } + }) +}) diff --git a/src/typeGuards/awaitable/index.spec.ts b/src/typeGuards/awaitable/index.spec.ts new file mode 100644 index 0000000..de93b26 --- /dev/null +++ b/src/typeGuards/awaitable/index.spec.ts @@ -0,0 +1,52 @@ +import { describe } from 'vitest' +import { + assertAwaitable, + assertNotAwaitable, + ensureAwaitable, + ensureNotAwaitable, + fallbackAwaitable, + fallbackNotAwaitable, + isAwaitable, + isNotAwaitable, +} from '.' +import { ValueType, testAssert, testEnsure, testFallback, testGuard } from '../../lib-test' + +const expectedValueTypes = [ + ValueType.Promise, + ValueType.ThenableFunction, + ValueType.ThenableInstance, + ValueType.ThenableObject, + ValueType.Awaited, +] + +describe('isAwaitable', () => { + testGuard(isAwaitable, expectedValueTypes) +}) + +describe('assertAwaitable', () => { + testAssert(assertAwaitable, expectedValueTypes) +}) + +describe('ensureAwaitable', () => { + testEnsure(ensureAwaitable, expectedValueTypes) +}) + +describe('fallbackAwaitable', () => { + testFallback(fallbackAwaitable, expectedValueTypes, { fallbackValue: Promise.resolve() }) +}) + +describe('isNotAwaitable', () => { + testGuard(isNotAwaitable, expectedValueTypes, { negative: true }) +}) + +describe('assertNotAwaitable', () => { + testAssert(assertNotAwaitable, expectedValueTypes, { negative: true }) +}) + +describe('ensureNotAwaitable', () => { + testEnsure(ensureNotAwaitable, expectedValueTypes, { negative: true }) +}) + +describe('fallbackNotAwaitable', () => { + testFallback(fallbackNotAwaitable, expectedValueTypes, { negative: true, fallbackValue: 123 }) +}) diff --git a/src/typeGuards/awaitable/index.ts b/src/typeGuards/awaitable/index.ts new file mode 100644 index 0000000..f66e6cc --- /dev/null +++ b/src/typeGuards/awaitable/index.ts @@ -0,0 +1,151 @@ +import { createAssertion, createEnsure, createFallback, not } from '../../lib' +import { errorMessage } from '../../lib' +import type { + InvertedTypeAssertOf, + InvertedTypeEnsureOf, + InvertedTypeFallbackOf, + TypeAssertOf, + TypeEnsureOf, + TypeFallbackOf, + TypeGuard, +} from '../../lib/types' + +/** + * Checks if a value is a PromiseLike object. + * + * @param target The value to check. + * @returns True if the value is a PromiseLike object, false otherwise. + * @example + * ```ts + * const target = getTarget() // PromiseLike | string + * if (isPromiseLike(target)) { + * // target is PromiseLike + * } + * ``` + */ +export const isAwaitable = ((target: unknown): target is PromiseLike => { + return !!target && typeof (target as PromiseLike).then === 'function' +}) as TypeGuard> + +type IsPromiseLike = typeof isAwaitable + +/** + * Asserts that a value is a PromiseLike object. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a PromiseLike object. + * @throws A TypeError with the given message if the value is not a PromiseLike object. + * @example + * ```ts + * const target = getTarget() // PromiseLike | string + * assertPromiseLike(target, 'target must be a PromiseLike') + * // target is PromiseLike + * ``` + */ + +export const assertAwaitable: TypeAssertOf = createAssertion( + isAwaitable, + errorMessage('promise-like object'), +) + +/** + * Ensures that a value is a PromiseLike object. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a PromiseLike object. + * @throws A TypeError with the given message if the value is not a PromiseLike object. + * @returns The value if it is a PromiseLike object. + * @example + * ```ts + * const target = getTarget() // PromiseLike | string + * const result = ensurePromiseLike(target, 'target must be a PromiseLike') + * // result is PromiseLike + * ``` + */ +export const ensureAwaitable: TypeEnsureOf = createEnsure( + isAwaitable, + errorMessage('promise-like object'), +) + +/** + * Fallbacks to a default value if the value is not a PromiseLike object. + * + * @param target The value to check. + * @param defaultValue The default value to fallback to. + * @example + * ```ts + * const target = getTarget() // PromiseLike | string + * const result = fallbackPromiseLike(target, ['default']) + * // result is PromiseLike | string + * ``` + */ +export const fallbackAwaitable: TypeFallbackOf = createFallback(isAwaitable) + +/** + * Checks if a value is not a PromiseLike object. + * + * In an if statement, it is simpler to use ! operator is simpler, + * but this method is useful in cases where the argument is a type guard function, such as Array.prototype.filter. + * + * @param target The value to check. + * @returns True if the value is not a PromiseLike, false otherwise. + * @example + * ```ts + * const targets = getTargets() // Array + * const result = targets.filter(isNotPromiseLike) + * // result is string[] + * ``` + */ +export const isNotAwaitable = not(isAwaitable) + +/** + * Asserts that a value is not a PromiseLike object. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is a PromiseLike object. + * @throws A TypeError with the given message if the value is a PromiseLike object. + * @example + * ```ts + * const target = getTarget() // string | PromiseLike + * assertNotPromiseLike(target, 'target must not be a PromiseLike') + * // target is string + * ``` + */ +export const assertNotAwaitable: InvertedTypeAssertOf = createAssertion( + not(isAwaitable), + errorMessage('promise-like object', { not: true }), +) + +/** + * Enxures that a value is not a PromiseLike object. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is a PromiseLike object. + * @throws A TypeError with the given message if the value is a PromiseLike object. + * @returns The value if it is not a PromiseLike object. + * @example + * ```ts + * const target = getTarget() // string | PromiseLike + * const result = ensureNotPromiseLike(target, 'target must not be a PromiseLike') + * // result is string + * ``` + */ +export const ensureNotAwaitable: InvertedTypeEnsureOf = createEnsure( + not(isAwaitable), + errorMessage('promise-like object', { not: true }), +) + +/** + * Fallbacks to a default value if the value is not a PromiseLike object. + * + * @param target The value to check. + * @param defaultValue The default value to fallback to. + * @return The value if it is not a PromiseLike object, the default value otherwise. + * @example + * ```ts + * const target = getTarget() // string | PromiseLike + * const result = fallbackNotPromiseLike(target, 'default') + * // result is string + * ``` + */ +export const fallbackNotAwaitable: InvertedTypeFallbackOf = createFallback(not(isAwaitable)) diff --git a/src/typeGuards/boolean/assert.spec-d.ts b/src/typeGuards/boolean/assert.spec-d.ts index 7b416fa..424ba34 100644 --- a/src/typeGuards/boolean/assert.spec-d.ts +++ b/src/typeGuards/boolean/assert.spec-d.ts @@ -1,31 +1,30 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' +import { describe, expectTypeOf, test } from 'vitest' import { assertBoolean, assertNotBoolean } from '.' describe('assertBoolean type tests', () => { test('guard definite types.', () => { - const targetBoolean = true as boolean | string - assertBoolean(targetBoolean) - assertType(targetBoolean) + const target = true as boolean | string + assertBoolean(target) + expectTypeOf(target).toEqualTypeOf() }) test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertBoolean(targetUnknown) - assertType(targetUnknown) + const target = 'string' as unknown + assertBoolean(target) + expectTypeOf(target).toEqualTypeOf() }) }) describe('assertNotBoolean type tests', () => { test('guard definite types.', () => { - const targetBoolean = true as boolean | string - assertNotBoolean(targetBoolean) - assertType(targetBoolean) + const target = true as boolean | string + assertNotBoolean(target) + expectTypeOf(target).toEqualTypeOf() }) test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertNotBoolean(targetUnknown) - assertType(targetUnknown) + const target = 'string' as unknown + assertNotBoolean(target) + expectTypeOf(target).toEqualTypeOf() }) }) diff --git a/src/typeGuards/boolean/ensure.spec-d.ts b/src/typeGuards/boolean/ensure.spec-d.ts index 6ebb959..6007f8f 100644 --- a/src/typeGuards/boolean/ensure.spec-d.ts +++ b/src/typeGuards/boolean/ensure.spec-d.ts @@ -1,27 +1,30 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' +import { test, describe, expectTypeOf } from 'vitest' import { ensureBoolean, ensureNotBoolean } from '.' describe('ensureBoolean type tests', () => { test('guard definite types.', () => { const target = true as boolean | string - assertType(ensureBoolean(target)) + const result = ensureBoolean(target) + expectTypeOf(result).toEqualTypeOf() }) test('guard unknown types', () => { const target = 'string' as unknown - assertType(ensureBoolean(target)) + const result = ensureBoolean(target) + expectTypeOf(result).toEqualTypeOf() }) }) describe('ensureNotBoolean type tests', () => { test('guard definite types.', () => { const target = true as boolean | string - assertType(ensureNotBoolean(target)) + const result = ensureNotBoolean(target) + expectTypeOf(result).toEqualTypeOf() }) test('guard unknown types', () => { const target = 'string' as unknown - assertType(ensureNotBoolean(target)) + const result = ensureNotBoolean(target) + expectTypeOf(result).toEqualTypeOf() }) }) diff --git a/src/typeGuards/boolean/fallback.spec-d.ts b/src/typeGuards/boolean/fallback.spec-d.ts index 4e22b91..0c32481 100644 --- a/src/typeGuards/boolean/fallback.spec-d.ts +++ b/src/typeGuards/boolean/fallback.spec-d.ts @@ -1,16 +1,18 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' +import { test, describe, expectTypeOf } from 'vitest' import { fallbackBoolean, fallbackNotBoolean } from '.' describe('fallbackBoolean type tests', () => { test('guard definite types.', () => { const target = true as boolean | string - assertType(fallbackBoolean(target, true)) + const result = fallbackBoolean(target, true) + expectTypeOf(result).toEqualTypeOf() }) test('guard unknown types', () => { const target = 'string' as unknown - assertType(fallbackBoolean(target, true)) + const result = fallbackBoolean(target, true) + expectTypeOf(result).toEqualTypeOf() }) test('uncorrectable types', () => { @@ -23,12 +25,14 @@ describe('fallbackBoolean type tests', () => { describe('fallbackNotBoolean type tests', () => { test('guard definite types.', () => { const target = true as boolean | string - assertType(fallbackNotBoolean(target, 'string')) + const result = fallbackNotBoolean(target, 'string') + expectTypeOf(result).toEqualTypeOf() }) test('guard unknown types', () => { const target = 'string' as unknown - assertType(fallbackNotBoolean(target, 'string')) + const result = fallbackNotBoolean(target, 'string') + expectTypeOf(result).toEqualTypeOf() }) test('uncorrectable types', () => { diff --git a/src/typeGuards/boolean/guard.spec-d.ts b/src/typeGuards/boolean/guard.spec-d.ts index 82c1ccd..2bdc259 100644 --- a/src/typeGuards/boolean/guard.spec-d.ts +++ b/src/typeGuards/boolean/guard.spec-d.ts @@ -1,43 +1,42 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' +import { describe, expectTypeOf, test } from 'vitest' import { isBoolean, isNotBoolean } from '.' describe('isBoolean type tests', () => { test('guard definite types.', () => { - const targetBoolean = true as boolean | string - if (isBoolean(targetBoolean)) { - assertType(targetBoolean) + const target = true as boolean | string + if (isBoolean(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetBoolean) + expectTypeOf(target).toEqualTypeOf() } }) test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isBoolean(targetUnknown)) { - assertType(targetUnknown) + const target = 'string' as unknown + if (isBoolean(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetUnknown) + expectTypeOf(target).toEqualTypeOf() } }) }) describe('isNotBoolean type tests', () => { test('guard definite types.', () => { - const targetBoolean = true as boolean | string - if (isNotBoolean(targetBoolean)) { - assertType(targetBoolean) + const target = true as boolean | string + if (isNotBoolean(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetBoolean) + expectTypeOf(target).toEqualTypeOf() } }) test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isNotBoolean(targetUnknown)) { - assertType(targetUnknown) + const target = 'string' as unknown + if (isNotBoolean(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetUnknown) + expectTypeOf(target).toEqualTypeOf() } }) }) diff --git a/src/typeGuards/boolean/index.spec.ts b/src/typeGuards/boolean/index.spec.ts index cd0f6de..c85a941 100644 --- a/src/typeGuards/boolean/index.spec.ts +++ b/src/typeGuards/boolean/index.spec.ts @@ -1,16 +1,17 @@ import { describe } from 'vitest' -import expected from 'lodash/isBoolean.js' import { - assertNotBoolean, assertBoolean, - ensureNotBoolean, + assertNotBoolean, ensureBoolean, - fallbackNotBoolean, + ensureNotBoolean, fallbackBoolean, + fallbackNotBoolean, isBoolean, - isNotBoolean + isNotBoolean, } from '.' -import { testAssert, testEnsure, testFallback, testGuard } from '../../lib/test' +import { ValueType, testAssert, testEnsure, testFallback, testGuard } from '../../lib-test' + +const expected = [ValueType.True, ValueType.False] describe('isBoolean', () => { testGuard(isBoolean, expected) diff --git a/src/typeGuards/boolean/index.ts b/src/typeGuards/boolean/index.ts index 7a36379..b682a68 100644 --- a/src/typeGuards/boolean/index.ts +++ b/src/typeGuards/boolean/index.ts @@ -1,4 +1,5 @@ -import { createAssertion, createEnsure, createFallback, not } from '../../lib/factory' +import { createAssertion, createEnsure, createFallback, not } from '../../lib' +import { errorMessage } from '../../lib' import type { InvertedTypeAssertOf, InvertedTypeEnsureOf, @@ -6,14 +7,14 @@ import type { TypeAssertOf, TypeEnsureOf, TypeFallbackOf, - TypeGuard -} from '../../lib/type' -import { errorMessage } from '../../lib/error' + TypeGuard, +} from '../../lib/types' /** - * Checks if a value is an boolean. + * Checks if a value is a boolean. + * * @param target The value to check. - * @returns True if the value is an boolean, false otherwise. + * @returns True if the value is a boolean, false otherwise. * @example * ```ts * const target = getTarget() // boolean | string @@ -22,49 +23,45 @@ import { errorMessage } from '../../lib/error' * } * ``` */ -export const isBoolean = ((target: unknown): target is boolean => - typeof target === 'boolean') as TypeGuard +export const isBoolean = ((target: unknown): target is boolean => typeof target === 'boolean') as TypeGuard type IsBoolean = typeof isBoolean /** - * Asserts that a value is an boolean. + * Asserts that a value is a boolean. + * * @param target The value to check. - * @param message (optional) The error message to throw if the value is not an boolean. - * @throws A TypeError with the given message if the value is not an boolean. + * @param message (optional) The error message to throw if the value is not a boolean. + * @throws A TypeError with the given message if the value is not a boolean. * @example * ```ts * const target = getTarget() // boolean | string - * assertBoolean(target, 'target must be an boolean') + * assertBoolean(target, 'target must be a boolean') * // target is boolean * ``` */ -export const assertBoolean: TypeAssertOf = createAssertion( - isBoolean, - errorMessage('boolean') -) +export const assertBoolean: TypeAssertOf = createAssertion(isBoolean, errorMessage('boolean')) /** - * Ensures that a value is an boolean. + * Ensures that a value is a boolean. + * * @param target The value to check. - * @param message (optional) The error message to throw if the value is not an boolean. - * @throws A TypeError with the given message if the value is not an boolean. - * @returns The value if it is an boolean. + * @param message (optional) The error message to throw if the value is not a boolean. + * @throws A TypeError with the given message if the value is not a boolean. + * @returns The value if it is a boolean. * @example * ```ts * const target = getTarget() // boolean | string - * const result = ensureBoolean(target, 'target must be an boolean') + * const result = ensureBoolean(target, 'target must be a boolean') * // result is boolean * ``` */ -export const ensureBoolean: TypeEnsureOf = createEnsure( - isBoolean, - errorMessage('boolean') -) +export const ensureBoolean: TypeEnsureOf = createEnsure(isBoolean, errorMessage('boolean')) /** - * Fallbacks to a default value if the value is not an boolean. + * Fallbacks to a default value if the value is not a boolean. + * * @param target The value to check. * @param defaultValue The default value to fallback to. * @example @@ -77,12 +74,13 @@ export const ensureBoolean: TypeEnsureOf = createEnsure( export const fallbackBoolean: TypeFallbackOf = createFallback(isBoolean) /** - * Checks if a value is not an boolean. + * Checks if a value is not a boolean. * * In an if statement, it is simpler to use ! operator is simpler, * but this method is useful in cases where the argument is a type guard function, such as Array.prototype.filter. + * * @param target The value to check. - * @returns True if the value is not an boolean, false otherwise. + * @returns True if the value is not a boolean, false otherwise. * @example * ```ts * const targets = getTargets() // Array @@ -93,45 +91,48 @@ export const fallbackBoolean: TypeFallbackOf = createFallback(isBoole export const isNotBoolean = not(isBoolean) /** - * Asserts that a value is not an boolean. + * Asserts that a value is not a boolean. + * * @param target The value to check. - * @param message (optional) The error message to throw if the value is an boolean. - * @throws A TypeError with the given message if the value is an boolean. + * @param message (optional) The error message to throw if the value is a boolean. + * @throws A TypeError with the given message if the value is a boolean. * @example * ```ts * const target = getTarget() // string | boolean - * assertNotBoolean(target, 'target must not be an boolean') + * assertNotBoolean(target, 'target must not be a boolean') * // target is string * ``` */ export const assertNotBoolean: InvertedTypeAssertOf = createAssertion( not(isBoolean), - errorMessage('boolean', { not: true }) + errorMessage('boolean', { not: true }), ) /** - * Enxures that a value is not an boolean. + * Enxures that a value is not a boolean. + * * @param target The value to check. - * @param message (optional) The error message to throw if the value is an boolean. - * @throws A TypeError with the given message if the value is an boolean. - * @returns The value if it is not an boolean. + * @param message (optional) The error message to throw if the value is a boolean. + * @throws A TypeError with the given message if the value is a boolean. + * @returns The value if it is not a boolean. * @example * ```ts * const target = getTarget() // string | boolean - * const result = ensureNotBoolean(target, 'target must not be an boolean') + * const result = ensureNotBoolean(target, 'target must not be a boolean') * // result is string * ``` */ export const ensureNotBoolean: InvertedTypeEnsureOf = createEnsure( not(isBoolean), - errorMessage('boolean', { not: true }) + errorMessage('boolean', { not: true }), ) /** - * Fallbacks to a default value if the value is not an boolean. + * Fallbacks to a default value if the value is not a boolean. + * * @param target The value to check. * @param defaultValue The default value to fallback to. - * @return The value if it is not an boolean, the default value otherwise. + * @return The value if it is not a boolean, the default value otherwise. * @example * ```ts * const target = getTarget() // string | boolean diff --git a/src/typeGuards/date/assert.spec-d.ts b/src/typeGuards/date/assert.spec-d.ts index 1bc5cdf..d06223d 100644 --- a/src/typeGuards/date/assert.spec-d.ts +++ b/src/typeGuards/date/assert.spec-d.ts @@ -1,31 +1,30 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' +import { describe, expectTypeOf, test } from 'vitest' import { assertDate, assertNotDate } from '.' describe('assertDate type tests', () => { test('guard definite types.', () => { - const targetDate = new Date() as Date | string - assertDate(targetDate) - assertType(targetDate) + const target = new Date() as Date | string + assertDate(target) + expectTypeOf(target).toEqualTypeOf() }) test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertDate(targetUnknown) - assertType(targetUnknown) + const target = 'string' as unknown + assertDate(target) + expectTypeOf(target).toEqualTypeOf() }) }) describe('assertNotDate type tests', () => { test('guard definite types.', () => { - const targetDate = new Date() as Date | string - assertNotDate(targetDate) - assertType(targetDate) + const target = new Date() as Date | string + assertNotDate(target) + expectTypeOf(target).toEqualTypeOf() }) test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertNotDate(targetUnknown) - assertType(targetUnknown) + const target = 'string' as unknown + assertNotDate(target) + expectTypeOf(target).toEqualTypeOf() }) }) diff --git a/src/typeGuards/date/ensure.spec-d.ts b/src/typeGuards/date/ensure.spec-d.ts index 6ea1e1d..04e31f5 100644 --- a/src/typeGuards/date/ensure.spec-d.ts +++ b/src/typeGuards/date/ensure.spec-d.ts @@ -1,27 +1,30 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' +import { test, describe, expectTypeOf } from 'vitest' import { ensureDate, ensureNotDate } from '.' describe('ensureDate type tests', () => { test('guard definite types.', () => { const target = new Date() as Date | string - assertType(ensureDate(target)) + const result = ensureDate(target) + expectTypeOf(result).toEqualTypeOf() }) test('guard unknown types', () => { const target = 'string' as unknown - assertType(ensureDate(target)) + const result = ensureDate(target) + expectTypeOf(result).toEqualTypeOf() }) }) describe('ensureNotDate type tests', () => { test('guard definite types.', () => { const target = new Date() as Date | string - assertType(ensureNotDate(target)) + const result = ensureNotDate(target) + expectTypeOf(result).toEqualTypeOf() }) test('guard unknown types', () => { const target = 'string' as unknown - assertType(ensureNotDate(target)) + const result = ensureNotDate(target) + expectTypeOf(result).toEqualTypeOf() }) }) diff --git a/src/typeGuards/date/fallback.spec-d.ts b/src/typeGuards/date/fallback.spec-d.ts index 26fb876..2e8bfa3 100644 --- a/src/typeGuards/date/fallback.spec-d.ts +++ b/src/typeGuards/date/fallback.spec-d.ts @@ -1,16 +1,18 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { fallbackDate, fallbackNotDate } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { fallbackDate } from './guards' describe('fallbackDate type tests', () => { test('guard definite types.', () => { const target = new Date() as Date | string - assertType(fallbackDate(target, new Date())) + const result = fallbackDate(target, new Date()) + expectTypeOf(result).toEqualTypeOf() }) test('guard unknown types', () => { const target = 'string' as unknown - assertType(fallbackDate(target, new Date())) + const result = fallbackDate(target, new Date()) + expectTypeOf(result).toEqualTypeOf() }) test('uncorrect fallback type', () => { @@ -20,20 +22,3 @@ describe('fallbackDate type tests', () => { }) }) -describe('fallbackNotDate type tests', () => { - test('guard definite types.', () => { - const target = new Date() as Date | string - assertType(fallbackNotDate(target, 'string')) - }) - - test('guard unknown types', () => { - const target = 'string' as unknown - assertType(fallbackNotDate(target, 'string')) - }) - - test('uncorrect fallback type', () => { - const target = 'string' as unknown - // @ts-expect-error - fallbackNotDate(target, new Date()) - }) -}) diff --git a/src/typeGuards/date/guard.spec-d.ts b/src/typeGuards/date/guard.spec-d.ts index 5e5ed82..bc56a5b 100644 --- a/src/typeGuards/date/guard.spec-d.ts +++ b/src/typeGuards/date/guard.spec-d.ts @@ -1,43 +1,56 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { isDate, isNotDate } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { isDate } from './guards' -describe('isDate type tests', () => { - test('guard definite types.', () => { - const targetDate = new Date() as Date | string - if (isDate(targetDate)) { - assertType(targetDate) +describe('guard definite types', () => { + test('should guard as Date for Date type values.', () => { + const target = new Date() as Date | string + if (isDate(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetDate) + expectTypeOf(target).toEqualTypeOf() } }) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isDate(targetUnknown)) { - assertType(targetUnknown) + test('should strictly guard as Date for extended Date types.', () => { + type ExtendedDate = Date & { extended: true } + const target = new Date() as ExtendedDate | string + if (isDate(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetUnknown) + expectTypeOf(target).toEqualTypeOf() } }) }) -describe('isNotDate type tests', () => { - test('guard definite types.', () => { - const targetDate = new Date() as Date | string - if (isNotDate(targetDate)) { - assertType(targetDate) +describe('guard unknown types', () => { + test('should guard as Date for unknown type value.', () => { + const target = 'string' as unknown + if (isDate(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetDate) + expectTypeOf(target).toEqualTypeOf() } }) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isNotDate(targetUnknown)) { - assertType(targetUnknown) + test('should strictly guard as Date when type argument is set.', () => { + type ExtendedDate = Date & { extended: true } + const target = 'string' as unknown + if (isDate(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetUnknown) + expectTypeOf(target).toEqualTypeOf() } }) }) + +describe('type error', () => { + test('should result is a TypeScript type error when the type argument is unknown', () => { + // @ts-expect-error + isDate(new Date()) + }) + + test('should result is a TypeScript type error when the type argument is not a Date', () => { + // @ts-expect-error + isDate(new Date()) + }) +}) diff --git a/src/typeGuards/date/guards.spec.ts b/src/typeGuards/date/guards.spec.ts new file mode 100644 index 0000000..b314b0c --- /dev/null +++ b/src/typeGuards/date/guards.spec.ts @@ -0,0 +1,25 @@ +import expected from 'lodash/isDate.js' +import { describe } from 'vitest' +import { testEquivalentAssert, testEquivalentEnsure, testEquivalentFallback, testEquivalentGuard } from '~/lib-test' +import { + assertDate, + ensureDate, + fallbackDate, + isDate, +} from './guards' + +describe('isDate', () => { + testEquivalentGuard(isDate, expected) +}) + +describe('assertDate', () => { + testEquivalentAssert(assertDate, expected) +}) + +describe('ensureDate', () => { + testEquivalentEnsure(ensureDate, expected) +}) + +describe('fallbackDate', () => { + testEquivalentFallback(fallbackDate, expected, { fallbackValue: [new Date()] }) +}) diff --git a/src/typeGuards/date/guards.ts b/src/typeGuards/date/guards.ts new file mode 100644 index 0000000..abc221a --- /dev/null +++ b/src/typeGuards/date/guards.ts @@ -0,0 +1,73 @@ +import { + type TypeAssertOf, + type TypeEnsureOf, + type TypeFallbackOf, + type TypeGuard, + createAssertion, + createEnsure, + createFallback, + errorMessage, +} from '~/lib' + +/** + * Checks if a value is a Date. + * + * @param target The value to check. + * @returns True if the value is a Date, false otherwise. + * @example + * ```ts + * const target = getTarget() // Date | string + * if (isDate(target)) { + * // target is Date + * } + * ``` + */ +export const isDate = ((target: unknown): target is Date => target instanceof Date) as TypeGuard + +type IsDate = typeof isDate + +/** + * Asserts that a value is a Date. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a Date. + * @throws A TypeAssertionError with the given message if the value is not a Date. + * @example + * ```ts + * const target = getTarget() // Date | string + * assertDate(target, 'target must be a Date') + * // target is Date + * ``` + */ + +export const assertDate: TypeAssertOf = createAssertion(isDate, errorMessage('Date')) + +/** + * Ensures that a value is a Date. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a Date. + * @throws A TypeAssertionError with the given message if the value is not a Date. + * @returns The value if it is a Date. + * @example + * ```ts + * const target = getTarget() // Date | string + * const result = ensureDate(target, 'target must be a Date') + * // result is Date + * ``` + */ +export const ensureDate: TypeEnsureOf = createEnsure(isDate, errorMessage('Date')) + +/** + * Fallbacks to a default value if the value is not a Date. + * + * @param target The value to check. + * @param defaultValue The default value to fallback to. + * @example + * ```ts + * const target = getTarget() // Date | string + * const result = fallbackDate(target, ['default']) + * // result is Date | string + * ``` + */ +export const fallbackDate: TypeFallbackOf = createFallback(isDate) diff --git a/src/typeGuards/date/index.spec.ts b/src/typeGuards/date/index.spec.ts deleted file mode 100644 index a39cc1b..0000000 --- a/src/typeGuards/date/index.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { describe } from 'vitest' -import expected from 'lodash/isDate.js' -import { - assertNotDate, - assertDate, - ensureNotDate, - ensureDate, - fallbackNotDate, - fallbackDate, - isDate, - isNotDate -} from '.' -import { testAssert, testEnsure, testFallback, testGuard } from '../../lib/test' - -describe('isDate', () => { - testGuard(isDate, expected) -}) - -describe('assertDate', () => { - testAssert(assertDate, expected) -}) - -describe('ensureDate', () => { - testEnsure(ensureDate, expected) -}) - -describe('fallbackDate', () => { - testFallback(fallbackDate, expected, { fallbackValue: [new Date()] }) -}) - -describe('isNotDate', () => { - testGuard(isNotDate, expected, { negative: true }) -}) - -describe('assertNotDate', () => { - testAssert(assertNotDate, expected, { negative: true }) -}) - -describe('ensureNotDate', () => { - testEnsure(ensureNotDate, expected, { negative: true }) -}) - -describe('fallbackNotDate', () => { - testFallback(fallbackNotDate, expected, { negative: true, fallbackValue: 'fallback' }) -}) diff --git a/src/typeGuards/date/index.ts b/src/typeGuards/date/index.ts index 146b7c2..2bfb9a1 100644 --- a/src/typeGuards/date/index.ts +++ b/src/typeGuards/date/index.ts @@ -1,133 +1 @@ -import { createAssertion, createEnsure, createFallback, not } from '../../lib/factory' -import { - InvertedTypeAssertOf, - InvertedTypeEnsureOf, - InvertedTypeFallbackOf, - TypeAssertOf, - TypeEnsureOf, - TypeFallbackOf, - TypeGuard -} from '../../lib/type' -import { errorMessage } from '../../lib/error' - -/** - * Checks if a value is an Date. - * @param target The value to check. - * @returns True if the value is an Date, false otherwise. - * @example - * ```ts - * const target = getTarget() // Date | string - * if (isDate(target)) { - * // target is Date - * } - * ``` - */ -export const isDate = ((target: unknown): target is Date => - target instanceof Date) as TypeGuard - -type IsDate = typeof isDate - -/** - * Asserts that a value is an Date. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is not an Date. - * @throws A TypeError with the given message if the value is not an Date. - * @example - * ```ts - * const target = getTarget() // Date | string - * assertDate(target, 'target must be an Date') - * // target is Date - * ``` - */ - -export const assertDate: TypeAssertOf = createAssertion(isDate, errorMessage('Date')) - -/** - * Ensures that a value is an Date. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is not an Date. - * @throws A TypeError with the given message if the value is not an Date. - * @returns The value if it is an Date. - * @example - * ```ts - * const target = getTarget() // Date | string - * const result = ensureDate(target, 'target must be an Date') - * // result is Date - * ``` - */ -export const ensureDate: TypeEnsureOf = createEnsure(isDate, errorMessage('Date')) - -/** - * Fallbacks to a default value if the value is not an Date. - * @param target The value to check. - * @param defaultValue The default value to fallback to. - * @example - * ```ts - * const target = getTarget() // Date | string - * const result = fallbackDate(target, ['default']) - * // result is Date | string - * ``` - */ -export const fallbackDate: TypeFallbackOf = createFallback(isDate) - -/** - * Checks if a value is not an Date. - * - * In an if statement, it is simpler to use ! operator is simpler, - * but this method is useful in cases where the argument is a type guard function, such as Array.prototype.filter. - * @param target The value to check. - * @returns True if the value is not an Date, false otherwise. - * @example - * ```ts - * const targets = getTargets() // Array - * const result = targets.filter(isNotDate) - * // result is string[] - * ``` - */ -export const isNotDate = not(isDate) - -/** - * Asserts that a value is not an Date. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is an Date. - * @throws A TypeError with the given message if the value is an Date. - * @example - * ```ts - * const target = getTarget() // string | Date - * assertNotDate(target, 'target must not be an Date') - * // target is string - * ``` - */ -export const assertNotDate: InvertedTypeAssertOf = createAssertion( - not(isDate), - errorMessage('Date', { not: true }) -) - -/** - * Enxures that a value is not an Date. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is an Date. - * @throws A TypeError with the given message if the value is an Date. - * @returns The value if it is not an Date. - * @example - * ```ts - * const target = getTarget() // string | Date - * const result = ensureNotDate(target, 'target must not be an Date') - * // result is string - * ``` - */ -export const ensureNotDate: InvertedTypeEnsureOf = createEnsure(not(isDate), errorMessage('Date', { not: true })) - -/** - * Fallbacks to a default value if the value is not an Date. - * @param target The value to check. - * @param defaultValue The default value to fallback to. - * @return The value if it is not an Date, the default value otherwise. - * @example - * ```ts - * const target = getTarget() // string | Date - * const result = fallbackNotDate(target, 'default') - * // result is string - * ``` - */ -export const fallbackNotDate: InvertedTypeFallbackOf = createFallback(not(isDate)) +export * from './guards' diff --git a/src/typeGuards/empty/guard.spec-d.ts b/src/typeGuards/empty/guard.spec-d.ts new file mode 100644 index 0000000..0a5bda3 --- /dev/null +++ b/src/typeGuards/empty/guard.spec-d.ts @@ -0,0 +1,52 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { isEmpty } from './guards' +import type { Empty, EmptyArray, EmptyObject, } from './type' + +describe('guard definite types', () => { + test('should strictly guard as empty for some string.', () => { + const target = '' as string + if (isEmpty(target)) { + expectTypeOf(target).toEqualTypeOf<''>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as empty for some array.', () => { + const target = [] as string[] + if (isEmpty(target)) { + expectTypeOf(target).toEqualTypeOf>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as empty for some object.', () => { + const target = {} as Record + if (isEmpty(target)) { + expectTypeOf(target).toEqualTypeOf>>() + } else { + expectTypeOf(target).toEqualTypeOf>() + } + }) + + test('should strictly guard as empty for some nilable value.', () => { + const target = null as null | undefined | string + if (isEmpty(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('guard unknown types', () => { + test('should guard as empty for unknown type value.', () => { + const target = 'string' as unknown + if (isEmpty(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) diff --git a/src/typeGuards/empty/guards.spec.ts b/src/typeGuards/empty/guards.spec.ts new file mode 100644 index 0000000..64bfc32 --- /dev/null +++ b/src/typeGuards/empty/guards.spec.ts @@ -0,0 +1,8 @@ +import expected from 'lodash/isEmpty.js' +import { describe } from 'vitest' +import { testEquivalentGuard } from '~/lib-test' +import { isEmpty } from './guards' + +describe('isEmpty', () => { + testEquivalentGuard(isEmpty, expected) +}) diff --git a/src/typeGuards/empty/guards.ts b/src/typeGuards/empty/guards.ts new file mode 100644 index 0000000..8900de0 --- /dev/null +++ b/src/typeGuards/empty/guards.ts @@ -0,0 +1,46 @@ +export type { Empty } from './type' + +import type { TypeGuard } from '~/lib' +import type { Empty, GuardIsEmpty } from './type' + +interface IsEmpty extends TypeGuard { + // (target: string): target is EmptyString + // // biome-ignore lint/suspicious/noExplicitAny: + // (target: any[]): target is EmptyArray + // >(target: T): target is EmptyObject + // (target: V | W): target is W + // (target: unknown): target is Empty + + (target: T): target is GuardIsEmpty +} + +/** + * Checks if a value is empty. + * @param target The value to check. + * @returns True if the value is empty, false otherwise. + * @example + * ```ts + * const result = '' + * + * if (isEmpty(target)) { + * // target is '' + * } else { + * // target is string + * } + * ``` + */ +export const isEmpty = ((target: unknown): boolean => { + if (target === null || target === undefined) { + return true + } + + if (typeof target === 'string' || Array.isArray(target)) { + return target.length === 0 + } + + if (typeof target === 'object') { + return Object.keys(target).length === 0 + } + + return false +}) as IsEmpty diff --git a/src/typeGuards/empty/index.ts b/src/typeGuards/empty/index.ts new file mode 100644 index 0000000..882c4db --- /dev/null +++ b/src/typeGuards/empty/index.ts @@ -0,0 +1,2 @@ +export * from './guards' +export * from './not' diff --git a/src/typeGuards/empty/not/assert.spec-d.ts b/src/typeGuards/empty/not/assert.spec-d.ts new file mode 100644 index 0000000..b717823 --- /dev/null +++ b/src/typeGuards/empty/not/assert.spec-d.ts @@ -0,0 +1,48 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { assertNotEmpty } from './guards' + +describe('assert definite types', () => { + test('should assert as not-empty for some string.', () => { + const target = '' as string + assertNotEmpty(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as not-empty for some string.', () => { + const target = '' as 'foo' | 'bar' | '' + assertNotEmpty(target) + expectTypeOf(target).toEqualTypeOf<'foo' | 'bar'>() + }) + + test('should assert as not-empty for some array.', () => { + const target = [] as string[] + assertNotEmpty(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as not-empty for some array.', () => { + const target = [] as string[] | [] + assertNotEmpty(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as not-empty for some object.', () => { + const target = {} as Record + assertNotEmpty(target) + expectTypeOf(target).toEqualTypeOf>() + }) + + test('should assert as not-empty for some nilable value.', () => { + const target = null as null | undefined | string + assertNotEmpty(target) + expectTypeOf(target).toEqualTypeOf() + }) +}) + +describe('assert unknown types', () => { + test('should assert as not-empty for unknown type value.', () => { + const target = 'string' as unknown + assertNotEmpty(target) + expectTypeOf(target).toEqualTypeOf() + }) +}) diff --git a/src/typeGuards/empty/not/ensure.spec-d.ts b/src/typeGuards/empty/not/ensure.spec-d.ts new file mode 100644 index 0000000..bf2eb4c --- /dev/null +++ b/src/typeGuards/empty/not/ensure.spec-d.ts @@ -0,0 +1,48 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { ensureNotEmpty } from './guards' + +describe('ensure definite types', () => { + test('should ensure as not-empty for some string.', () => { + const target = '' as string + const result = ensureNotEmpty(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure as not-empty for some string.', () => { + const target = '' as 'foo' | 'bar' | '' + const result = ensureNotEmpty(target) + expectTypeOf(result).toEqualTypeOf<'foo' | 'bar'>() + }) + + test('should ensure as not-empty for some array.', () => { + const target = [] as string[] + const result = ensureNotEmpty(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure as not-empty for some array.', () => { + const target = [] as string[] | [] + const result = ensureNotEmpty(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure as not-empty for some object.', () => { + const target = {} as Record + const result = ensureNotEmpty(target) + expectTypeOf(result).toEqualTypeOf>() + }) + + test('should ensure as not-empty for some nilable value.', () => { + const target = null as null | undefined | string + const result = ensureNotEmpty(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('ensure unknown types', () => { + test('should ensure as not-empty for unknown type value.', () => { + const target = 'string' as unknown + const result = ensureNotEmpty(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) diff --git a/src/typeGuards/empty/not/fallback.spec-d.ts b/src/typeGuards/empty/not/fallback.spec-d.ts new file mode 100644 index 0000000..e17c346 --- /dev/null +++ b/src/typeGuards/empty/not/fallback.spec-d.ts @@ -0,0 +1,42 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { fallbackNotEmpty } from './guards' + +describe('fallback definite types', () => { + test('should fallback as not-empty for some string.', () => { + const target = '' as string + const result = fallbackNotEmpty(target, 'fallback') + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback as not-empty for some string.', () => { + const target = '' as 'foo' | 'bar' | '' + const result = fallbackNotEmpty(target, 'fallback') + expectTypeOf(result).toEqualTypeOf<'fallback' | 'foo' | 'bar'>() + }) + + test('should fallback as not-empty for some array.', () => { + const target = [] as string[] + const result = fallbackNotEmpty(target, ['fallback']) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback as not-empty for some array.', () => { + const target = [] as string[] | [] + const result = fallbackNotEmpty(target, ['fallback']) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback as not-empty for some object.', () => { + const target = {} as Record + const result = fallbackNotEmpty(target, { fallback: 'fallback' }) + expectTypeOf(result).toEqualTypeOf | { fallback: string }>() + }) +}) + +describe('fallback unknown types', () => { + test('should fallback as not-empty for unknown type value.', () => { + const target = 'string' as unknown + const result = fallbackNotEmpty(target, 'fallback') + expectTypeOf(result).toEqualTypeOf() + }) +}) diff --git a/src/typeGuards/empty/not/guard.spec-d.ts b/src/typeGuards/empty/not/guard.spec-d.ts new file mode 100644 index 0000000..35e2217 --- /dev/null +++ b/src/typeGuards/empty/not/guard.spec-d.ts @@ -0,0 +1,87 @@ +import { describe, expectTypeOf, test } from 'vitest' +import type { Empty, EmptyObject } from '../type' +import { isNotEmpty } from './guards' + +describe('guard definite types', () => { + test('should guard as not-empty for some string.', () => { + const target = '' as string + if (isNotEmpty(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + // FIXME: should be `''` + // @ts-ignore + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as not-empty for some string.', () => { + const target = '' as 'foo' | 'bar' | '' + if (isNotEmpty(target)) { + expectTypeOf(target).toEqualTypeOf<'foo' | 'bar'>() + } else { + expectTypeOf(target).toEqualTypeOf<''>() + } + }) + + test('should guard as not-empty for some array.', () => { + const target = [] as string[] + if (isNotEmpty(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + // FIXME: should be `[]` + // @ts-ignore + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as not-empty for some array.', () => { + const target = [] as string[] | [] + if (isNotEmpty(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf<[]>() + } + }) + + test('should strictly guard as not-empty for some object.', () => { + const target = {} as Record + if (isNotEmpty(target)) { + expectTypeOf(target).toEqualTypeOf>() + } else { + // FIXME: should be `{}` + // @ts-ignore + expectTypeOf(target).toEqualTypeOf>>() + } + }) + + test('should guard as not-empty for some nilable value.', () => { + const target = null as null | undefined | string + if (isNotEmpty(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as not-empty for some nilable value.', () => { + const target = null as null | undefined | 'foo' | 'bar' | '' + if (isNotEmpty(target)) { + expectTypeOf(target).toEqualTypeOf<'foo' | 'bar'>() + } else { + expectTypeOf(target).toEqualTypeOf<'' | null | undefined>() + } + }) +}) + +describe('guard unknown types', () => { + test('should guard as not-empty for unknown type value.', () => { + const target = 'string' as unknown + if (isNotEmpty(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + // FIXME: should be `Empty` + // @ts-ignore + expectTypeOf(target).toEqualTypeOf() + } + }) +}) diff --git a/src/typeGuards/empty/not/guard.spec.ts b/src/typeGuards/empty/not/guard.spec.ts new file mode 100644 index 0000000..109fe1b --- /dev/null +++ b/src/typeGuards/empty/not/guard.spec.ts @@ -0,0 +1,21 @@ +import expected from 'lodash/isEmpty.js' +import { describe } from 'vitest' +import { testEquivalentAssert, testEquivalentEnsure, testEquivalentFallback, testEquivalentGuard } from '~/lib-test' +import { ensureNotEmpty, fallbackNotEmpty, isNotEmpty, } from './guards' + +describe('isNotEmpty', () => { + testEquivalentGuard(isNotEmpty, expected, { negative: true }) +}) + +describe('assertNotEmpty', () => { + testEquivalentAssert(fallbackNotEmpty, expected, { negative: true }) +}) + +describe('ensureNotEmpty', () => { + testEquivalentEnsure(ensureNotEmpty, expected, { negative: true }) +}) + +describe('fallbackNotEmpty', () => { + testEquivalentFallback(fallbackNotEmpty, expected, { negative: true, fallbackValue: 'fallback' }) +}) + diff --git a/src/typeGuards/empty/not/guards.ts b/src/typeGuards/empty/not/guards.ts new file mode 100644 index 0000000..b59bfcd --- /dev/null +++ b/src/typeGuards/empty/not/guards.ts @@ -0,0 +1,87 @@ +import { type TypeErrorMessage, createAssertion, createEnsure, createFallback, errorMessage, not } from '~/lib' +import { isEmpty } from '~/typeGuards/empty' +import type { GuardIsEmpty } from '../type' + +interface GuardNotEmpty { + (target: T): target is unknown extends T ? unknown : Exclude> +} + +interface AssertNotEmpty { + (target: T, message?: TypeErrorMessage): asserts target is unknown extends T ? unknown : Exclude> +} + +interface EnsureNotEmpty { + (target: T, message?: TypeErrorMessage): unknown extends T ? unknown : Exclude> +} + +interface FallbackNotEmpty { + (target: T, fallback: V): unknown extends T ? unknown | V : Exclude> | V +} + +/** + * Checks if a value is not empty. + * @param target The value to check. + * @returns True if the value is not empty, false otherwise. + * @example + * ```ts + * type Type = 'foo' | 'bar' | '' + * const value = await getType() // Type + * + * if (isNotEmpty(value)) { + * // value is 'foo' | 'bar' + * } + * ``` + */ +export const isNotEmpty = not(isEmpty) as GuardNotEmpty + +/** + * Asserts that a value is not empty. + * @param target The value to check. + * @param message (optional) The error message to throw if the value is empty. + * @throws A TypeAssertionError with the given message if the value is empty. + * @example + * ```ts + * type Type = 'foo' | 'bar' | '' + * const target = getType() // Type + * + * assertNotEmpty(target, 'target must not be empty') + * // target is 'foo' | 'bar' + * ``` + */ +export const assertNotEmpty: AssertNotEmpty = createAssertion(not(isEmpty), errorMessage('not empty', { not: true })) + +/** + * Ensures that a value is not empty. + * @param target The value to check. + * @param message (optional) The error message to throw if the value is empty. + * @returns The value if it is not empty. + * @throws A TypeAssertionError with the given message if the value is empty. + * @example + * ```ts + * type Type = 'foo' | 'bar' | '' + * function getType(): Type { + * // ... + * } + * + * const result = ensureNotEmpty(getType(), 'target must not be empty') + * // result is 'foo' | 'bar' + * ``` + */ +export const ensureNotEmpty: EnsureNotEmpty = createEnsure(not(isEmpty), errorMessage('not empty', { not: true })) + +/** + * Fallbacks to a default value if the value is empty. + * @param target The value to check. + * @param defaultValue The default value to fallback to. + * @example + * ```ts + * type Type = 'foo' | 'bar' | 'default' | '' + * function getType(): Type { + * // ... + * } + * + * const result = fallbackNotEmpty(getType(), 'default') + * // result is 'foo' | 'bar' | 'default' + * ``` + */ +export const fallbackNotEmpty: FallbackNotEmpty = createFallback(not(isEmpty)) diff --git a/src/typeGuards/empty/not/index.ts b/src/typeGuards/empty/not/index.ts new file mode 100644 index 0000000..2bfb9a1 --- /dev/null +++ b/src/typeGuards/empty/not/index.ts @@ -0,0 +1 @@ +export * from './guards' diff --git a/src/typeGuards/empty/type.spec-d.ts b/src/typeGuards/empty/type.spec-d.ts new file mode 100644 index 0000000..77578ac --- /dev/null +++ b/src/typeGuards/empty/type.spec-d.ts @@ -0,0 +1,75 @@ +import { describe, expectTypeOf, test } from 'vitest' +import type { EmptyArray, EmptyObject, EmptyString } from './type' + +describe('type satisfied: EmptyString', () => { + test('should satisfies some empty string as EmptyString', () => { + const _satisfied = '' satisfies EmptyString + + // @ts-expect-error + const _notSatisfied = 'string' satisfies EmptyString + }) + + test('should excludes EmptyString from string as string', () => { + function isEmptyString(target: string): target is EmptyString { + return target === '' + } + + const target = 'string' as string + if (isEmptyString(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('type satisfied: EmptyArray', () => { + test('should satisfies some empty array as EmptyArray', () => { + const _satisfied = [] satisfies EmptyArray + + // @ts-expect-error + const _notSatisfied = [1] satisfies EmptyArray + }) + + test('should excludes EmptyArray from array as array', () => { + // biome-ignore lint/suspicious/noExplicitAny: + function isEmptyArray(target: any[]): target is EmptyArray { + return target.length === 0 + } + + const target = [1] as unknown[] + if (isEmptyArray(target)) { + expectTypeOf(target).toEqualTypeOf<[]>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('type satisfied: EmptyObject', () => { + test('should satisfies some empty object as EmptyObject', () => { + const _satisfied = {} satisfies EmptyObject + + // @ts-expect-error + const _notSatisfied = { a: 1 } satisfies EmptyObject + + // @ts-expect-error + const _notSatisfied2 = { [Symbol()]: 1 } satisfies EmptyObject + + // @ts-expect-error + const _notSatisfied3 = { 1: 1 } satisfies EmptyObject + }) + + test('should excludes EmptyObject from object as object', () => { + function isEmptyObject(target: object): target is EmptyObject { + return Object.keys(target).length === 0 + } + + const target = { a: 1 } as object + if (isEmptyObject(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) diff --git a/src/typeGuards/empty/type.ts b/src/typeGuards/empty/type.ts new file mode 100644 index 0000000..aad2e17 --- /dev/null +++ b/src/typeGuards/empty/type.ts @@ -0,0 +1,40 @@ +export type EmptyString = '' + +// biome-ignore lint/suspicious/noExplicitAny: +export type EmptyArray = T & [] + +export type EmptyObject< + T extends Record = Record, +> = T & Record + +export type EmptyPrimitive = null | undefined + +export type Empty = EmptyString | EmptyArray | EmptyObject | EmptyPrimitive + +export type NotEmptyString = Exclude + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type NotEmptyArray = Exclude + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type NotEmptyObject = Exclude, EmptyObject> + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type NotEmptyPrimitive = Exclude + +export type NotEmpty = NotEmptyString | NotEmptyArray | NotEmptyObject | NotEmptyPrimitive + +export type GuardIsEmpty = unknown extends T +? Empty & T +: T extends null + ? null & T + : T extends undefined + ? undefined & T + : T extends string + ? EmptyString & T + : // biome-ignore lint/suspicious/noExplicitAny: + T extends any[] + ? EmptyArray + : T extends Record + ? EmptyObject + : T diff --git a/src/typeGuards/function/assert.spec-d.ts b/src/typeGuards/function/assert.spec-d.ts new file mode 100644 index 0000000..b061654 --- /dev/null +++ b/src/typeGuards/function/assert.spec-d.ts @@ -0,0 +1,53 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { assertFunction } from './guards' + +describe('assert definite types', () => { + test('should assert as Function for function type values.', () => { + // biome-ignore lint/complexity/noBannedTypes: + // biome-ignore lint/nursery/noEmptyBlockStatements: + const target = (() => {}) as Function | string + assertFunction(target) + // biome-ignore lint/complexity/noBannedTypes: + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as Function for strict function types.', () => { + const target = (() => {}) as (() => void) | '1' + assertFunction(target) + expectTypeOf(target).toEqualTypeOf<() => void>() + }) + + test('should strictly assert as Function for class constructor', () => { + class Target {} + + const target = Target as typeof Target | Target + assertFunction(target) + expectTypeOf(target).toEqualTypeOf() + }) +}) + +describe('assert unknown types', () => { + test('should assert as Function for unknown type value.', () => { + const target = 'string' as unknown + assertFunction(target) + // biome-ignore lint/complexity/noBannedTypes: + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as Function when type argument is set.', () => { + const target = 'string' as unknown + assertFunction(target) + expectTypeOf(target).toEqualTypeOf() + }) +}) + +describe('type error', () => { + test('should result in a TypeScript type error when the type argument is not a Function', () => { + // // @ts-expect-error FIXME: This is a bug + assertFunction( + // @ts-ignore FIXME: This is a bug + // biome-ignore lint/nursery/noEmptyBlockStatements: + () => {}, + ) + }) +}) diff --git a/src/typeGuards/function/ensure.spec-d.ts b/src/typeGuards/function/ensure.spec-d.ts new file mode 100644 index 0000000..91e99b3 --- /dev/null +++ b/src/typeGuards/function/ensure.spec-d.ts @@ -0,0 +1,54 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { ensureFunction } from './guards' + +describe('ensure definite types', () => { + test('should ensure as Function for function type values.', () => { + // biome-ignore lint/complexity/noBannedTypes: + // biome-ignore lint/nursery/noEmptyBlockStatements: + const target = (() => {}) as Function | string + const result = ensureFunction(target) + // biome-ignore lint/complexity/noBannedTypes: + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure as Function for strict function types.', () => { + // biome-ignore lint/nursery/noEmptyBlockStatements: + const target = (() => {}) as (() => void) | '1' + const result = ensureFunction(target) + expectTypeOf(result).toEqualTypeOf<() => void>() + }) + + test('should strictly ensure as Function for class constructor', () => { + class Target {} + + const target = Target as typeof Target | Target + const result = ensureFunction(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('ensure unknown types', () => { + test('should ensure as Function for unknown type value.', () => { + const target = 'string' as unknown + const result = ensureFunction(target) + // biome-ignore lint/complexity/noBannedTypes: + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure as Function when type argument is set.', () => { + const target = 'string' as unknown + const result = ensureFunction(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('type error', () => { + test('should result in a TypeScript type error when the type argument is not a Function', () => { + ensureFunction( + // @ts-ignore FIXME: This is a bug + // biome-ignore lint/nursery/noEmptyBlockStatements: + () => {}, + ) + }) +}) diff --git a/src/typeGuards/function/fallback.spec-d.ts b/src/typeGuards/function/fallback.spec-d.ts new file mode 100644 index 0000000..aaa59e2 --- /dev/null +++ b/src/typeGuards/function/fallback.spec-d.ts @@ -0,0 +1,63 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { fallbackFunction } from './guards' + +describe('fallback definite types', () => { + test('should fallback to Function for function type values.', () => { + // biome-ignore lint/complexity/noBannedTypes: + const target = (() => 'foo') as Function | string + const result = fallbackFunction(target, () => 'bar') + // biome-ignore lint/complexity/noBannedTypes: + expectTypeOf(result).toEqualTypeOf 'bar')>() + }) + + test('should strictly fallback to Function for strict function types.', () => { + const target = (() => 'foo') as (() => 'foo') | '1' + const result = fallbackFunction(target, () => 'bar') + expectTypeOf(result).toEqualTypeOf<(() => 'foo') | (() => 'bar')>() + }) + + test('should strictly fallback to Function for class constructor', () => { + class Target {} + class Fallback {} + + const target = Target as typeof Target | Target + const result = fallbackFunction(target, Fallback) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('fallback unknown types', () => { + test('should fallback to Function for unknown type value.', () => { + const target = 'string' as unknown + // biome-ignore lint/nursery/noEmptyBlockStatements: + const result = fallbackFunction(target, () => {}) + // biome-ignore lint/complexity/noBannedTypes: + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback to Function when type argument is set.', () => { + const target = 'string' as unknown + const result = fallbackFunction(target, String) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('type error', () => { + test('should result in a TypeScript type error when the type argument is not a Function', () => { + // @ts-expect-error + fallbackFunction( + // biome-ignore lint/nursery/noEmptyBlockStatements: + () => {}, + // biome-ignore lint/nursery/noEmptyBlockStatements: + () => {}, + ) + }) + + test.skip('should result in a TypeScript type error when the argument is not a Function', () => { + fallbackFunction( + { foo: 'bar' }, + // // @ts-expect-error FIXME: This is a bug + 3, + ) + }) +}) diff --git a/src/typeGuards/function/guard.spec-d.ts b/src/typeGuards/function/guard.spec-d.ts new file mode 100644 index 0000000..552a0f6 --- /dev/null +++ b/src/typeGuards/function/guard.spec-d.ts @@ -0,0 +1,65 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { isFunction } from './guards' + +describe('guard definite types', () => { + test('should guard as Function for function type values.', () => { + // biome-ignore lint/nursery/noEmptyBlockStatements: + // biome-ignore lint/complexity/noBannedTypes: + const target = (() => {}) as Function | string + if (isFunction(target)) { + // biome-ignore lint/complexity/noBannedTypes: + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as Function for strict function types.', () => { + // biome-ignore lint/nursery/noEmptyBlockStatements: + const target = (() => {}) as (() => void) | '1' + if (isFunction(target)) { + expectTypeOf(target).toEqualTypeOf<() => void>() + } else { + expectTypeOf(target).toEqualTypeOf<'1'>() + } + }) + + test('should strictly guard as Function for class constructor', () => { + class Target {} + + const target = Target as typeof Target | Target + if (isFunction(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('guard unknown types', () => { + test('should guard as Function for unknown type value.', () => { + const target = 'string' as unknown + if (isFunction(target)) { + // biome-ignore lint/complexity/noBannedTypes: + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as Function when type argument is set.', () => { + const target = 'string' as unknown + if (isFunction(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('type error', () => { + test.skip('should result in a TypeScript type error when the type argument is not a Function', () => { + // // @ts-expect-error FIXME: This is a bug + isFunction('foobar') + }) +}) diff --git a/src/typeGuards/function/guards.spec.ts b/src/typeGuards/function/guards.spec.ts new file mode 100644 index 0000000..ce0b483 --- /dev/null +++ b/src/typeGuards/function/guards.spec.ts @@ -0,0 +1,28 @@ +import { describe } from 'vitest' +import { ValueType, testAssert, testEnsure, testFallback, testGuard } from '~/lib-test' +import { assertFunction, ensureFunction, fallbackFunction, isFunction } from './guards' + +const expected = [ + ValueType.Function, + ValueType.AsyncFunction, + ValueType.GeneratorFunction, + ValueType.AsyncGeneratorFunction, + ValueType.Class, + ValueType.ThenableFunction, +] + +describe('isFunction', () => { + testGuard(isFunction, expected) +}) + +describe('assertFunction', () => { + testAssert(assertFunction, expected) +}) + +describe('ensureFunction', () => { + testEnsure(ensureFunction, expected) +}) + +describe('fallbackFunction', () => { + testFallback(fallbackFunction, expected, { fallbackValue: () => {} }) +}) diff --git a/src/typeGuards/function/guards.ts b/src/typeGuards/function/guards.ts new file mode 100644 index 0000000..2e87be7 --- /dev/null +++ b/src/typeGuards/function/guards.ts @@ -0,0 +1,113 @@ +import { + type TypeAssert, + type TypeEnsure, + type TypeFallback, + type TypeGuard, + createAssertion, + createEnsure, + createFallback, + errorMessage, +} from '~/lib' + +// biome-ignore lint/complexity/noBannedTypes: +export type AnyFunction = AnyPlainFunction | AnyGeneratorFunction | AnyClass | Function + +interface AnyPlainFunction { + // biome-ignore lint/suspicious/noExplicitAny: + (...args: any[]): any +} + +interface AnyGeneratorFunction { + // biome-ignore lint/suspicious/noExplicitAny: + (...args: any[]): Generator +} + +interface AnyClass { + // biome-ignore lint/suspicious/noExplicitAny: + new (...args: any[]): any +} + +interface IsFunction extends TypeGuard { + /** + * Checks if a value is a function. + * @param target The value to check. + * @returns True if the value is a function, false otherwise. + * @example + * ```ts + * const result = isFunction(() => {}) + * // true + * + * const result = isFunction('() => {}') + * // false + * ``` + */ + // biome-ignore lint/complexity/noBannedTypes: + (target: T): target is unknown extends T ? Function & T : T extends AnyFunction ? T : never +} + +export const isFunction = ((target: unknown) => typeof target === 'function') as IsFunction + +interface AssertFunction extends TypeAssert { + /** + * Asserts that a value is a function. + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a function. + * @throws A TypeError with the given message if the value is not a function. + * @example + * ```ts + * const target = getTarget() // Function | string + * assertFunction(target, 'target must be a function') + * // target is Function + * ``` + */ + (target: T, message?: string): asserts target is unknown extends T + ? // biome-ignore lint/complexity/noBannedTypes: + Function & T + : T extends AnyFunction + ? T + : never +} + +export const assertFunction: AssertFunction = createAssertion(isFunction, errorMessage('function')) + +interface EnsureFunction extends TypeEnsure { + /** + * Ensures that a value is a function. + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a function. + * @throws A TypeError with the given message if the value is not a function. + * @returns The value if it is a function. + * @example + * ```ts + * const target = getTarget() // Function | string + * const result = ensureFunction(target, 'target must be a function') + * // result is Function + * ``` + */ + + // biome-ignore lint/complexity/noBannedTypes: + (target: T, message?: string): unknown extends T ? Function & T : T extends AnyFunction ? T : never +} + +export const ensureFunction: EnsureFunction = createEnsure(isFunction, errorMessage('function')) as EnsureFunction + +interface FallbackFunction extends TypeFallback { + /** + * Returns a fallback value if a value is not a function. + * + * @param target The value to check. + * @param fallback The value to return if the target is not a function. + * @returns The fallback value if the target is not a function, otherwise the target. + * @example + * ```ts + * const target = getTarget() // Function | string + * const result = fallbackFunction(target, () => {}) + * // result is Function + * ``` + */ + + // biome-ignore lint/complexity/noBannedTypes: + (target: T, fallback: U): unknown extends T ? Function & T : T extends AnyFunction ? T : U +} + +export const fallbackFunction: FallbackFunction = createFallback(isFunction) diff --git a/src/typeGuards/function/index.ts b/src/typeGuards/function/index.ts new file mode 100644 index 0000000..2bfb9a1 --- /dev/null +++ b/src/typeGuards/function/index.ts @@ -0,0 +1 @@ +export * from './guards' diff --git a/src/typeGuards/index.ts b/src/typeGuards/index.ts index 5e06960..e01dd9b 100644 --- a/src/typeGuards/index.ts +++ b/src/typeGuards/index.ts @@ -1,7 +1,14 @@ export * from './array' +export * from './awaitable' export * from './boolean' export * from './date' +export * from './function' +export * from './json-parsable' +export * from './json' export * from './nil' +export * from './number-parsable' export * from './number' export * from './object' +export * from './promise' export * from './string' +export * from './symbol' diff --git a/src/typeGuards/json-parsable/assert.spec-d.ts b/src/typeGuards/json-parsable/assert.spec-d.ts new file mode 100644 index 0000000..ce2ceef --- /dev/null +++ b/src/typeGuards/json-parsable/assert.spec-d.ts @@ -0,0 +1,52 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { assertJsonParsable } from './guards' +import type { JsonParsable } from './type' + +describe('assert definite types', () => { + test('should assert to JsonParsable for string type values.', () => { + const target = `{ "foo": "bar" }` as string | object + assertJsonParsable(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert to JsonParsable for string literal types.', () => { + const target = `{ "foo": "bar" }` as `{ "foo": "bar" }` | { foo: string } + assertJsonParsable(target) + expectTypeOf(target).toEqualTypeOf<`{ "foo": "bar" }`>() + }) + + test('should strictly assert to JsonParsable for dynamic string literal types.', () => { + type DynamicJson = `{ "foo": "${string}" }` + const target = `{ "foo": "bar" }` as DynamicJson | { foo: string } + assertJsonParsable(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert to JsonParsable for Branded string type', () => { + type Branded = T & { __brand: 'branded' } + const target = `{ "foo": "bar" }` as Branded<`{ "foo": "${string}" }`> | Branded<{ foo: string }> + assertJsonParsable(target) + expectTypeOf(target).toEqualTypeOf>() + }) +}) + +describe('assert unknown types', () => { + test('should assert to JsonParsable for unknown type value.', () => { + const target = `{ "foo": "bar" }` as unknown + assertJsonParsable(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert to JsonParsable when type argument is set.', () => { + const target = `{ "foo": "bar" }` as unknown + assertJsonParsable<`{ "foo": "${string}" }`>(target) + expectTypeOf(target).toEqualTypeOf<`{ "foo": "${string}" }`>() + }) +}) + +describe('type error', () => { + test('should result in a TypeScript type error when the type argument is not a string', () => { + // @ts-expect-error + assertJsonParsable(`{ "foo": "bar" }`) + }) +}) diff --git a/src/typeGuards/json-parsable/coerce.spec-d.ts b/src/typeGuards/json-parsable/coerce.spec-d.ts new file mode 100644 index 0000000..e323e29 --- /dev/null +++ b/src/typeGuards/json-parsable/coerce.spec-d.ts @@ -0,0 +1,100 @@ +import { describe, expectTypeOf, test } from 'vitest' +import type { JsonValue } from '~/lib' +import { coerceJson } from './guards' + +describe('coerce definite types', () => { + test('should coerce to JsonValue for string type values.', () => { + const target = `{ "foo": "bar" }` as object | string + const result = coerceJson(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly coerce to JsonValue for string literal types.', () => { + const target = `{ "foo": "bar" }` as `{ "foo": "bar" }` | { baz: 'qux' } + const result = coerceJson(target) + // `{ "foo": "bar" }` -> JsonValue + // { baz: 'qux' } -> { baz: 'qux' } + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly coerce to JsonValue for json primitive value like string.', () => { + const target = 'null' as const + const result = coerceJson(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly coerce to JSONValue for strict number string type string.', () => { + const target = '123' as const + const result = coerceJson(target) + expectTypeOf(result).toEqualTypeOf<123>() + }) + + test('should strictly coerce to JsonValue for dynamic number string type string.', () => { + const target = '123' as `${number}` + const result = coerceJson(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should coerce to JsonValue for json-object.', () => { + const target = { foo: 'bar' } as object | string + const result = coerceJson(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly coerce to JsonValue for strict json-object.', () => { + const target = { foo: 'bar' } as { foo: string } | undefined + const result = coerceJson(target) + expectTypeOf(result).toEqualTypeOf<{ foo: string }>() + }) + + test('should strictly coerce to JsonValue for object has some methods.', () => { + // biome-ignore lint/nursery/noEmptyBlockStatements: + const target = { foo: 'bar', baz: (): void => {} } as const + const result = coerceJson(target) + + // It will actually throw an exception because it is not a Jsonifiable object, but it will be JsonValue. + // Because it is possible to create an object configuration that passes through JSON.stringify, it cannot be judged from the type. + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly coerce to JsonValue for object has toJSON method.', () => { + const date = new Date() + const result1 = coerceJson(date) + expectTypeOf(result1).toEqualTypeOf() + + // biome-ignore lint/style/useNamingConvention: + const target = { foo: 'bar', toJSON: (): string => date.toString() } as const + const result2 = coerceJson(target) + expectTypeOf(result2).toEqualTypeOf() + }) + + test.skip('should strictly coerce to JsonValue for union type', () => { + const target = { foo: 'bar' } as { foo: string } | '123' | Date | unknown[] | null | (() => void) | undefined + const result = coerceJson(target) + // FIXME: This test should pass, but it fails. + // @ts-ignore + expectTypeOf(result).toEqualTypeOf<{ foo: string } | 123 | Date | Json[] | null>() + }) + + test('should strictly coerce to JsonValue for mixed values (json-object, json-object parsable string)', () => { + const target = { foo: 'bar' } as { foo: string } | `{ "baz": "qux" }` + const result = coerceJson(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('coerce unknown types', () => { + test('should coerce to JsonValue for unknown type value.', () => { + const target = '{ "foo": "bar" }' as unknown + const result = coerceJson(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test.skip('should strictly coerce to JsonValue when type argument is set.', () => { + const target = '{ "foo": "bar" }' as unknown + // FIXME: This test should pass, but it fails. + // @ts-ignore + const result = coerceJson<{ foo: string }>(target) + expectTypeOf(result).toEqualTypeOf<{ foo: string }>() + }) +}) diff --git a/src/typeGuards/json-parsable/ensure.spec-d.ts b/src/typeGuards/json-parsable/ensure.spec-d.ts new file mode 100644 index 0000000..90b6da1 --- /dev/null +++ b/src/typeGuards/json-parsable/ensure.spec-d.ts @@ -0,0 +1,55 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { ensureJsonParsable } from './guards' +import type { JsonParsable } from './type' + +describe('ensure definite types.', () => { + test('should ensure JsonParsable for string type values.', () => { + const target = `{ "foo": "bar" }` as string | object + const result = ensureJsonParsable(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should ensure JsonParsable for string literal types.', () => { + const target = `{ "foo": "bar" }` as `{ "foo": "bar" }` | { foo: string } + const result = ensureJsonParsable(target) + + expectTypeOf(result).toEqualTypeOf<`{ "foo": "bar" }`>() + }) + + test('should ensure JsonParsable for dynamic string literal types.', () => { + type DynamicJson = `{ "foo": "${string}" }` + const target = `{ "foo": "bar" }` as DynamicJson | { foo: string } + const result = ensureJsonParsable(target) + + expectTypeOf(result).toEqualTypeOf() + }) + + test('should ensure JsonParsable for Branded string type', () => { + type BrandedString = string & { __brand: 'branded' } + const target = `{ "foo": "bar" }` as BrandedString | object + const result = ensureJsonParsable(target) + + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('ensure unknown types.', () => { + test('should ensure JsonParsable for unknown type value.', () => { + const target = `{ "foo": "bar" }` as unknown + const result = ensureJsonParsable(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should ensure JsonParsable when type argument is set.', () => { + const target = `{ "foo": "bar" }` as unknown + const result = ensureJsonParsable<`{ "foo": "${string}" }`>(target) + expectTypeOf(result).toEqualTypeOf<`{ "foo": "${string}" }`>() + }) +}) + +describe('type error', () => { + test('should result in a TypeScript type error when the type argument is not a string', () => { + // @ts-expect-error + ensureJsonParsable(`{ "foo": "bar" }`) + }) +}) diff --git a/src/typeGuards/json-parsable/fallback.spec-d.ts b/src/typeGuards/json-parsable/fallback.spec-d.ts new file mode 100644 index 0000000..a998944 --- /dev/null +++ b/src/typeGuards/json-parsable/fallback.spec-d.ts @@ -0,0 +1,56 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { fallbackJsonParsable } from './guards' +import type { JsonParsable } from './type' + +describe('fallback definite types', () => { + test('should fallback to JsonParsable for string type values.', () => { + const target = `{ "foo": "bar" }` as string | object + const result = fallbackJsonParsable(target, `{ "baz": "qux" }`) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should fallback to JsonParsable for string literal types.', () => { + const target = `{ "foo": "bar" }` as `{ "foo": "bar" }` | { foo: string } + const result = fallbackJsonParsable(target, `{ "baz": "qux" }`) + + expectTypeOf(result).toEqualTypeOf<`{ "foo": "bar" }` | `{ "baz": "qux" }`>() + }) + + test('should fallback to JsonParsable for dynamic string literal types.', () => { + type DynamicJson = `{ "foo": "${string}" }` + const target = `{ "foo": "bar" }` as DynamicJson | { foo: string } + const result = fallbackJsonParsable(target, `{ "foo": "baz" }`) + + expectTypeOf(result).toEqualTypeOf() + }) + + test('should fallback to JsonParsable for Branded string type', () => { + type Branded = T & { __brand: 'branded' } + type BrandedTarget = Branded<`{ "foo": "bar" }`> + const target = `{ "foo": "bar" }` as BrandedTarget | object + const result = fallbackJsonParsable(target, `{ "baz": "qux" }`) + + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('fallback unknown types', () => { + test('should fallback to JsonParsable for unknown type value.', () => { + const target = `{ "foo": "bar" }` as unknown + const result = fallbackJsonParsable(target, `{ "baz": "qux" }`) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should fallback to JsonParsable when type argument is set.', () => { + const target = `{ "foo": "bar" }` as unknown + const result = fallbackJsonParsable<`{ "foo": "${string}" }`>(target, `{ "foo": "baz" }`) + expectTypeOf(result).toEqualTypeOf<`{ "foo": "${string}" }`>() + }) +}) + +describe('type error', () => { + test('should result in a TypeScript type error when the type argument is not a string', () => { + // @ts-expect-error + fallbackJsonParsable(`{ "foo": "bar" }`, `{ "foo": "baz" }`) + }) +}) diff --git a/src/typeGuards/json-parsable/fix.spec-d.ts b/src/typeGuards/json-parsable/fix.spec-d.ts new file mode 100644 index 0000000..0d225a6 --- /dev/null +++ b/src/typeGuards/json-parsable/fix.spec-d.ts @@ -0,0 +1,64 @@ +import { describe, expectTypeOf, test } from 'vitest' +import type { JsonValue } from '~/lib' +import { fixJson } from './guards' + +describe('fix definite types', () => { + test('should fix as json-object for some json-object parsable string value.', () => { + const target = `{ "foo": "bar" }` as object | string + const result = fixJson(target, { baz: 'qux' }) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fix as json-object for some json-object parsable string literal value.', () => { + const target = `{ "foo": "bar" }` as `{ "foo": "bar" }` | { foo: string } + const result = fixJson(target, { baz: 'qux' }) + // TODO: type safe string literal type + expectTypeOf(result).toEqualTypeOf() + }) + + test('should fix as json-object for some json-object.', () => { + const target = { foo: 'bar' } as object | string + const result = fixJson(target, { baz: 'qux' }) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fix as json-object for some strict json-object', () => { + const target = { foo: 'bar' } as { foo: string } | '1' + const result = fixJson(target, { baz: 'qux' }) + expectTypeOf(result).toEqualTypeOf<{ foo: string } | { baz: string }>() + }) + + test('should strictly fix as json-object for some strict json-object using "as const"', () => { + const target = { foo: 'bar' } as const + const result = fixJson(target, { baz: 'qux' } as const) + expectTypeOf(result).toEqualTypeOf<{ readonly foo: 'bar' } | { readonly baz: 'qux' }>() + }) + + test('should strictly fix as json-object for union type', () => { + const target = { foo: 'bar' } as { foo: string } | Date | unknown[] | null | (() => void) | undefined + const result = fixJson(target, { baz: 'qux' }) + expectTypeOf(result).toEqualTypeOf<{ foo: string } | { baz: string } | Date | Json[] | null>() + }) + + test('should strictly fix as json-object for mixed values (json-object, json-object parsable string)', () => { + const target = { foo: 'bar' } as { foo: string } | `{ "baz": "qux" }` + const result = fixJson(target, { hoge: 'fuga' }) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('fix unknown types', () => { + test('should fix as json-object for unknown type value.', () => { + const target = '{ "foo": "bar" }' as unknown + const result = fixJson(target, { baz: 'qux' }) + expectTypeOf(result).toEqualTypeOf() + }) + + test.skip('should strictly fix as json-object when type argument is set.', () => { + const target = '{ "foo": "bar" }' as unknown + // FIXME: This test should pass, but it fails. + // @ts-ignore + const result = fixJson<{ foo: string } | { bar: string }>(target, { baz: 'qux' }) + expectTypeOf(result).toEqualTypeOf() + }) +}) diff --git a/src/typeGuards/json-parsable/guard.spec-d.ts b/src/typeGuards/json-parsable/guard.spec-d.ts new file mode 100644 index 0000000..542618a --- /dev/null +++ b/src/typeGuards/json-parsable/guard.spec-d.ts @@ -0,0 +1,78 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { isJsonParsable } from './guards' +import type { JsonParsable } from './type' + +describe('guard definite types', () => { + test('should guard as JsonParsable for JsonParsable type values.', () => { + const target = `{ "foo": "bar" }` as object | string + if (isJsonParsable(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as JsonParsable for Json-string value.', () => { + const target = `{ "foo": "bar" }` as `{ "foo": "bar" }` | { foo: string } + if (isJsonParsable(target)) { + expectTypeOf(target).toEqualTypeOf<`{ "foo": "bar" }`>() + } else { + expectTypeOf(target).toEqualTypeOf<{ foo: string }>() + } + }) + + test('should strictly guard as JsonParsable for dynamic Json-string value.', () => { + type DynamicJson = `{ "foo": "${string}" }` + const target = `{ "foo": "bar" }` as DynamicJson | { foo: string } + if (isJsonParsable(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf<{ foo: string }>() + } + }) + + test('should strictly guard as JsonParsable for Branded Json-string value', () => { + type Branded = T & { __brand: 'branded' } + type BrandedJson = Branded<`{ "foo": "bar" }`> + + const target = `{ "foo": "bar" }` as BrandedJson | { foo: string } + if (isJsonParsable(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf<{ foo: string }>() + } + }) +}) + +describe('guard unknown types', () => { + test('guard unknown types', () => { + const target = 'string' as unknown + if (isJsonParsable(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as JsonParsable when type argument is set.', () => { + type TargetJson = `{ "foo": "bar" }` + const target = 'string' as unknown + if (isJsonParsable(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('type error', () => { + test('should result in TypeScript type error when the type argument is not match "JsonParsable"', () => { + // @ts-expect-error + isJsonParsable('string') + }) + + test('should result in TypeScript type error when the type argument is not a "JsonParsable"', () => { + // @ts-expect-error + isJsonParsable('string') + }) +}) diff --git a/src/typeGuards/json-parsable/guards.spec.ts b/src/typeGuards/json-parsable/guards.spec.ts new file mode 100644 index 0000000..a0ef2bd --- /dev/null +++ b/src/typeGuards/json-parsable/guards.spec.ts @@ -0,0 +1,100 @@ +import { describe, expect, test } from 'vitest' +import { ValueType, allTypes, testAssert, testEnsure, testFallback, testGuard } from '~/lib-test' +import { + assertJSONParsable, + coerceJSON, + ensureJSONParsable, + fallbackJSONParsable, + fixJSON, + isJSONParsable, +} from './guards' + +const expected = [ + ValueType.JsonParsableArray, + ValueType.JsonParsableEmptyArray, + ValueType.JsonParsableObject, + ValueType.JsonParsableComplexObject, + ValueType.JsonParsableEmptyObject, + ValueType.JsonParsableFalse, + ValueType.JsonParsableNull, + ValueType.JsonParsableNumber, + ValueType.JsonParsableString, + ValueType.JsonParsableTrue, + ValueType.NumberParsablePositiveInt, + ValueType.NumberParsableNegativeInt, + ValueType.NumberParsablePositiveFloat, + ValueType.NumberParsableNegativeFloat, + ValueType.BooleanParsableTrue, + ValueType.BooleanParsableFalse, +] + +const expectedCoerceType = [ValueType.True, ValueType.False, ValueType.Null] + +describe('isJSONParsable', () => { + testGuard(isJSONParsable, expected, { parsableString: true }) +}) + +describe('assertJSONParsable', () => { + testAssert(assertJSONParsable, expected, { parsableString: true }) +}) + +describe('ensureJSONParsable', () => { + testEnsure(ensureJSONParsable, expected, { parsableString: true }) +}) + +describe('fallbackJSONParsable', () => { + testFallback(fallbackJSONParsable, expected, { + parsableString: true, + fallbackValue: [{ foo: 'bar' }], + }) +}) + +const caseUnparsableTypes = allTypes().filter((type) => !(expected.includes(type) || expectedCoerceType.includes(type))) + +describe('coerceJson', () => { + const caseStrings = [ + { input: '{"foo": "bar"}', expected: { foo: 'bar' } }, + { input: '123', expected: 123 }, + { input: 'true', expected: true }, + { input: 'false', expected: false }, + { input: 'null', expected: null }, + ] + + test.each(caseStrings)('should coerce to json object when the value is $input', ({ input, expected }) => { + expect(coerceJSON(input)).toStrictEqual(expected) + }) + + const caseJsons = [{ foo: 'bar' }, 123, true, false, null] + + test.each(caseJsons)('should coerce to json object when the value is %s', (input) => { + expect(coerceJSON(input)).toStrictEqual(input) + }) + + test.each(caseUnparsableTypes)('should throw error when the value type is %s', (type) => { + expect(() => coerceJSON(type)).toThrow() + }) +}) + +describe('fixJson', () => { + const caseStrings = [ + { input: '{"foo": "bar"}', expected: { foo: 'bar' } }, + { input: '123', expected: 123 }, + { input: 'true', expected: true }, + { input: 'false', expected: false }, + { input: 'null', expected: null }, + ] + + test.each(caseStrings)('should fix to json object when the the value is $input', ({ input, expected }) => { + expect(fixJSON(input, {})).toStrictEqual(expected) + }) + + const caseJsons = [{ foo: 'bar' }, 123, true, false, null] + + test.each(caseJsons)('should fix to json object when the value is %s', (input) => { + expect(fixJSON(input, {})).toStrictEqual(input) + }) + + test.each(caseUnparsableTypes)('should fix to fallback value when the value type is %s', (type) => { + expect(fixJSON(type, {})).toStrictEqual({}) + }) +}) diff --git a/src/typeGuards/json-parsable/guards.ts b/src/typeGuards/json-parsable/guards.ts new file mode 100644 index 0000000..d8a5c20 --- /dev/null +++ b/src/typeGuards/json-parsable/guards.ts @@ -0,0 +1,333 @@ +import { + type JsonValue, + type TypeAssertOf, + TypeAssertionError, + type TypeEnsureOf, + type TypeErrorMessage, + type TypeFallbackOf, + type TypeGuard, + createAssertion, + createEnsure, + createFallback, + errorMessage, +} from '~/lib' +import { type Jsonifiable, type Jsonify, isJson } from '~/typeGuards/json' +import type { WeakJsonifiable } from '~/typeGuards/json/type' +import { isString } from '~/typeGuards/string' +import type { JsonParsable, ParseJson, WeakJsonParsable } from './type' + +type Result = { parsed: JsonValue; result: boolean; cause?: unknown } + +function commonTest(target: unknown): Result { + if (!isString(target)) { + return { parsed: {}, result: false } + } + + try { + return { parsed: JSON.parse(target), result: true } + } catch (e) { + return { parsed: {}, result: false, cause: e } + } +} + +/** + * Checks if a value is string, that can be parsed as Json. + * + * @param target The value to check. + * @return True if the value is string, that can be parsed as Json, false otherwise. + * @example + * ```ts + * const result = isJsonParsable('{ "foo": "bar" }') + * // result is true + * + * const result = isJsonParsable('foo') + * // result is false + * + * const result = isJsonParsable('1') + * // result is true + * + * const result = isJsonParsable('true') + * // result is true + * + * const result = isJsonParsable('null') + * // result is true + * + * const result = isJsonParsable('undefined') + * // result is false + * ``` + */ + +// biome-ignore lint/style/useNamingConvention: +export const isJsonParsable = ((target: unknown) => commonTest(target).result) as TypeGuard + +type IsJsonParsable = typeof isJsonParsable + +/** + * Asserts that a value is a string that can be parsed as Json. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a string that can be parsed as Json. + * @throws A TypeAssertionError with the given message if the value is not a string that can be parsed as Json. + * @example + * ```ts + * assertJsonParsable('{ "foo": "bar" }') + * // target is JsonParsable + * + * assertJsonParsable('foo') + * // throws TypeAssertionError + * + * assertJsonParsable('1') + * // target is JsonParsable + * + * assertJsonParsable('true') + * // target is JsonParsable + * + * assertJsonParsable('null') + * // target is JsonParsable + * + * assertJsonParsable('undefined') + * // throws TypeAssertionError + * ``` + */ +export const assertJsonParsable: TypeAssertOf = createAssertion( + isJsonParsable, + errorMessage('JsonParsable'), +) + +/** + * Enxures that a value is a string that can be parsed as Json. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a string that can be parsed as Json. + * @throws A TypeAssertionError with the given message if the value is not a string that can be parsed as Json. + * @returns The value if it is a string that can be parsed as Json. + * @example + * ```ts + * const result = ensureJsonParsable('{ "foo": "bar" }') + * // result is '{ "foo": "bar" }' + * + * const result = ensureJsonParsable('foo') + * // throws TypeAssertionError + * + * const result = ensureJsonParsable('1') + * // result is '1' + * + * const result = ensureJsonParsable('true') + * // result is 'true' + * + * const result = ensureJsonParsable('null') + * // result is 'null' + * + * const result = ensureJsonParsable('undefined') + * // throws TypeAssertionError + * ``` + */ +export const ensureJsonParsable: TypeEnsureOf = createEnsure( + isJsonParsable, + errorMessage('JsonParsable'), +) + +/** + * Fallbacks to default value if a value is a string that can be parsed as Json. + * + * @param target The value to check. + * @param defaultValue The default value to return if the value is not a string that can be parsed as Json. + * @return The value if it is a string that can be parsed as Json, the default value otherwise. + * @example + * ```ts + * const result = fallbackJsonParsable('{ "foo": "bar" }', '{ "baz": "qux" }') + * // result is '{ "foo": "bar" }' + * + * const result = fallbackJsonParsable('foo', '{ "baz": "qux" }') + * // result is '{ "baz": "qux" }' + * + * const result = fallbackJsonParsable('1', '{ "baz": "qux" }') + * // result is '1' + * + * const result = fallbackJsonParsable('true', '{ "baz": "qux" }') + * // result is 'true' + * + * const result = fallbackJsonParsable('null', '{ "baz": "qux" }') + * // result is 'null' + * + * const result = fallbackJsonParsable('undefined', '{ "baz": "qux" }') + * // result is '{ "baz": "qux" }' + * ``` + */ +export const fallbackJsonParsable: TypeFallbackOf = createFallback(isJsonParsable) + +interface CoerceJson { + /** + * If the value specified in the argument is a string, it parses it to Json. + * Otherwise, if it is equivalent to a Json object (Json primitive), it returns that value. + * Throws a TypeAssertionError in any case. + * @param target The value to coerce to Json. + * @param message (optional) The error message to throw if the value cannot be coerced to Json. + * @throws A TypeAssertionError with the given message if the value cannot be coerced to Json. + * @returns The value coerced to Json. + * @example + * ```ts + * function fetchData() { return { foo: 'bar' }} + * + * const result = coerceJson(fetchData()) + * // result is { foo: 'bar' } + * + * function fetchData2() { return '{ "foo": "bar" }' } + * + * const result2 = coerceJson(fetchData2()) + * // result2 is { foo: 'bar' } + * ``` + */ + (target: T, message?: TypeErrorMessage): unknown extends T + ? JsonValue + : T extends JsonParsable + ? ParseJson + : T extends Jsonifiable + ? Jsonify + : T extends WeakJsonParsable | WeakJsonifiable + ? JsonValue + : never + + /** + * If the value specified in the argument is a string, it parses it to Json. + * Otherwise, if it is equivalent to a Json object (Json primitive), it returns that value. + * Throws a TypeAssertionError in any case. + * @param target The value to coerce to Json. + * @param message (optional) The error message to throw if the value cannot be coerced to Json. + * @throws A TypeAssertionError with the given message if the value cannot be coerced to Json. + * @returns The value coerced to Json. + * @example + * ```ts + * function fetchData() { return { foo: 'bar' }} + * + * const result = coerceJson(fetchData()) + * // result is { foo: 'bar' } + * + * function fetchData2() { return '{ "foo": "bar" }' } + * + * const result2 = coerceJson(fetchData2()) + * // result2 is { foo: 'bar' } + * ``` + */ + // (target: T | NotJsonifiable, message?: TypeErrorMessage): Jsonify + + /** + * If the value specified in the argument is a string, it parses it to Json. + * Otherwise, if it is equivalent to a Json object (Json primitive), it returns that value. + * Throws a TypeAssertionError in any case. + * @param target The value to coerce to Json. + * @param message (optional) The error message to throw if the value cannot be coerced to Json. + * @throws A TypeAssertionError with the given message if the value cannot be coerced to Json. + * @returns The value coerced to Json. + * @example + * ```ts + * function fetchData() { return { foo: 'bar' }} + * + * const result = coerceJson(fetchData()) + * // result is { foo: 'bar' } + * + * function fetchData2() { return '{ "foo": "bar" }' } + * + * const result2 = coerceJson(fetchData2()) + * // result2 is { foo: 'bar' } + * ``` + */ + (target: unknown, message?: TypeErrorMessage): JsonValue +} + +export const coerceJson: CoerceJson = (target: unknown, message?: TypeErrorMessage): JsonValue => { + const { parsed, result, cause } = commonTest(target) + + if (result) { + return parsed + } + + if (isJson(target)) { + return JSON.parse(JSON.stringify(target)) + } + + const m = typeof message === 'string' ? message : message?.(target) ?? errorMessage('JsonParsable')(target) + throw new TypeAssertionError(m, target, { cause }) +} + +interface FixJson { + /** + * If the value specified in the argument is a string, it parses it to Json. + * Otherwise, if it is equivalent to a Json object (Json primitive), it returns that value. + * Otherwise, it returns the default value. + * @param target The value to coerce to Json. + * @param defaultValue The default value to return if the value cannot be coerced to Json. + * @returns The value coerced to Json or the default value. + * @example + * ```ts + * function fetchData() { return { foo: 'bar' }} + * + * const result = fixJson(fetchData(), { baz: 'qux' }) + * // result is { foo: 'bar' } | { baz: 'qux' } + * + * function fetchData2() { return '{ "foo": "bar" }' } + * + * const result2 = fixJson(fetchData2(), { baz: 'qux' }) + * // result2 is { foo: 'bar' } | { baz: 'qux' } + * ``` + */ + (target: T, defaultValue: V): ParseJson | V + + /** + * If the value specified in the argument is a string, it parses it to Json. + * Otherwise, if it is equivalent to a Json object (Json primitive), it returns that value. + * Otherwise, it returns the default value. + * @param target The value to coerce to Json. + * @param defaultValue The default value to return if the value cannot be coerced to Json. + * @returns The value coerced to Json or the default value. + * @example + * ```ts + * function fetchData() { return { foo: 'bar' }} + * + * const result = fixJson(fetchData(), { baz: 'qux' }) + * // result is { foo: 'bar' } | { baz: 'qux' } + * + * function fetchData2() { return '{ "foo": "bar" }' } + * + * const result2 = fixJson(fetchData2(), { baz: 'qux' }) + * // result2 is { foo: 'bar' } | { baz: 'qux' } + * ``` + */ + (target: W, defaultValue: X): Jsonify | X + + /** + * If the value specified in the argument is a string, it parses it to Json. + * Otherwise, if it is equivalent to a Json object (Json primitive), it returns that value. + * Otherwise, it returns the default value. + * @param target The value to coerce to Json. + * @param defaultValue The default value to return if the value cannot be coerced to Json. + * @returns The value coerced to Json or the default value. + * @example + * ```ts + * function fetchData() { return { foo: 'bar' }} + * + * const result = fixJson(fetchData(), { baz: 'qux' }) + * // result is { foo: 'bar' } | { baz: 'qux' } + * + * function fetchData2() { return '{ "foo": "bar" }' } + * + * const result2 = fixJson(fetchData2(), { baz: 'qux' }) + * // result2 is { foo: 'bar' } | { baz: 'qux' } + * ``` + */ + (target: unknown, defaultValue: JsonValue): JsonValue +} + +export const fixJson: FixJson = (target: unknown, defaultValue: JsonValue): JsonValue => { + const { parsed, result } = commonTest(target) + + if (result) { + return parsed + } + + if (isJson(target)) { + return JSON.parse(JSON.stringify(target)) + } + + return defaultValue +} diff --git a/src/typeGuards/json-parsable/index.ts b/src/typeGuards/json-parsable/index.ts new file mode 100644 index 0000000..0bddd1b --- /dev/null +++ b/src/typeGuards/json-parsable/index.ts @@ -0,0 +1,2 @@ +export * from './guards' +export type { ParseJson, JsonParsable } from './type' diff --git a/src/typeGuards/json-parsable/type.ts b/src/typeGuards/json-parsable/type.ts new file mode 100644 index 0000000..3685f01 --- /dev/null +++ b/src/typeGuards/json-parsable/type.ts @@ -0,0 +1,37 @@ +import type { JsonValue } from '~/lib' + +export type JsonParsable = JsonStrPrimitive | JsonStrArray | JsonStrObject + +/** + * Type that cannot be inferred strictly + */ +export type WeakJsonParsable = string + +type JsonStrPrimitive = `${number}` | `${boolean}` | `${null}` + +// TODO: Can't express with current typescript +type JsonStrArray = `[${string}]` + +// TODO: Can't express with current typescript +type ParseJsonStrArray<_T extends JsonStrArray> = JsonValue[] + +// TODO: Can't express with current typescript +type JsonStrObject = `{${string}}` + +// TODO: Can't express with current typescript +type ParseJsonStrObject<_T extends JsonStrObject> = JsonValue + +export type ParseJson = T extends `${infer U extends number}` + ? U + : T extends `${infer V extends boolean}` + ? V + : T extends `${infer W extends null}` + ? W + : T extends `{${string}}` + ? ParseJsonStrObject + : T extends `[${string}]` + ? ParseJsonStrArray + : JsonValue + +// biome-ignore lint/suspicious/noExplicitAny: +export type NotJsonParsable = Exclude diff --git a/src/typeGuards/json/assert.spec-d.ts b/src/typeGuards/json/assert.spec-d.ts new file mode 100644 index 0000000..c429886 --- /dev/null +++ b/src/typeGuards/json/assert.spec-d.ts @@ -0,0 +1,50 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { assertJson } from './guards' +import type { Jsonifiable, JsonifiableArray, JsonifiableObject } from './type' + +describe('assert definite types', () => { + test.skip('should assert as JSONifiable for some object.', () => { + const target = {} as object | string + assertJson(target) + // @ts-ignore FIXME: This is a bug + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as JSONifiable for strict object.', () => { + const target = { foo: 'bar' } + assertJson(target) + expectTypeOf(target).toEqualTypeOf<{ foo: string }>() + }) + + test('assert union types', () => { + const target = { foo: 'bar' } as Jsonifiable | string | number + assertJson(target) + expectTypeOf(target).toEqualTypeOf() + }) +}) + +describe('assert unknown types', () => { + test('should assert as JSONifiable for unknown type value.', () => { + const target = { foo: 'bar' } as unknown + assertJson(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as JSONifiable when type argument is set.', () => { + const target = { foo: 'bar' } as unknown + assertJson<{ foo: string }>(target) + expectTypeOf(target).toEqualTypeOf<{ foo: string }>() + }) +}) + +describe('type error', () => { + test.skip('should result in a TypeScript type error when the type argument is not a JSONifiable', () => { + assertJson< + // // @ts-expect-error FIXME: This is a bug + Promise + >( + // @ts-ignore FIXME: This is a bug + { foo: 'bar' }, + ) + }) +}) diff --git a/src/typeGuards/json/ensure.spec-d.ts b/src/typeGuards/json/ensure.spec-d.ts new file mode 100644 index 0000000..2f47459 --- /dev/null +++ b/src/typeGuards/json/ensure.spec-d.ts @@ -0,0 +1,50 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { ensureJson } from './guards' +import type { Jsonifiable, JsonifiableArray, JsonifiableObject } from './type' + +describe('ensure definite types', () => { + test.skip('should ensure as JSONifiable for some object.', () => { + const target = { foo: 'bar' } as object | string + const result = ensureJson(target) + // @ts-ignore FIXME: This is a bug + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure as JSONifiable for strict object.', () => { + const target = { foo: 'bar' } + const result = ensureJson(target) + expectTypeOf(result).toEqualTypeOf<{ foo: string }>() + }) + + test('should strictly ensure as JSONifiable for union types.', () => { + const target = { foo: 'bar' } as Jsonifiable | string | number + const result = ensureJson(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('ensure unknown types', () => { + test('should ensure as JSONifiable for unknown type value.', () => { + const target = { foo: 'bar' } as unknown + const result = ensureJson(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure as JSONifiable when type argument is set.', () => { + const target = { foo: 'bar' } as unknown + const result = ensureJson<{ foo: string }>(target) + expectTypeOf(result).toEqualTypeOf<{ foo: string }>() + }) +}) + +describe('type error', () => { + test.skip('should result in a TypeScript type error when the type argument is not a JSONifiable', () => { + ensureJson< + // // @ts-expect-error FIXME: This is a bug + Promise + >( + // @ts-ignore FIXME: This is a bug + { foo: 'bar' }, + ) + }) +}) diff --git a/src/typeGuards/json/fallback.spec-d.ts b/src/typeGuards/json/fallback.spec-d.ts new file mode 100644 index 0000000..fd291e1 --- /dev/null +++ b/src/typeGuards/json/fallback.spec-d.ts @@ -0,0 +1,60 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { fallbackJson } from './guards' +import type { Jsonifiable } from './type' + +describe('fallback definite types', () => { + test.skip('should fallback to JSONifiable for some object.', () => { + const target = { foo: 'bar' } as object | string + const result = fallbackJson(target, { baz: 'qux' }) + // @ts-ignore FIXME: This is a bug + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback to JSONifiable for strict object.', () => { + const target = { foo: 'bar' } + const result = fallbackJson(target, { baz: 'qux' }) + expectTypeOf(result).toEqualTypeOf<{ foo: string } | { baz: string }>() + }) + + test('should strictly fallback to JSONifiable for union types.', () => { + const target = { foo: 'bar' } as Jsonifiable | string | number + const result = fallbackJson(target, { baz: 'qux' }) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('fallback unknown types', () => { + test('should fallback to JSONifiable for unknown type value.', () => { + const target = { foo: 'bar' } as unknown + const result = fallbackJson(target, { baz: 'qux' }) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback to JSONifiable when type argument is set.', () => { + const target = { foo: 'bar' } as unknown + const result = fallbackJson<{ foo: string }>(target, { foo: 'baz' }) + expectTypeOf(result).toEqualTypeOf<{ foo: string }>() + }) +}) + +describe('type error', () => { + test.skip('should result in a TypeScript type error when the type argument is not a JSONifiable', () => { + fallbackJson( + // + { foo: 'bar' }, + // @ts-ignore FIXME: This is a bug + { baz: 'qux' }, + ) + }) + + test('should result in a TypeScript type error when the argument is not a JSONifiable', () => { + fallbackJson<{ foo: string }>( + { foo: 'bar' }, + { + // @ts-expect-error + baz: 'qux', + }, + ) + }) +}) diff --git a/src/typeGuards/json/guard.spec-d.ts b/src/typeGuards/json/guard.spec-d.ts new file mode 100644 index 0000000..ec415d1 --- /dev/null +++ b/src/typeGuards/json/guard.spec-d.ts @@ -0,0 +1,80 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { isJson } from './guards' +import type { Jsonifiable, JsonifiableArray, JsonifiableObject } from './type' + +describe('guard definite types', () => { + test('should guard as JSONifiable for some object.', () => { + const target = {} as object | string + if (isJson(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as JSONifiable for strictly object.', () => { + const target = {} as { foo?: string } | Promise + if (isJson(target)) { + expectTypeOf(target).toEqualTypeOf<{ foo?: string }>() + } else { + expectTypeOf(target).toEqualTypeOf>() + } + }) + + test('should strictly guard as JSONifiable for union types.', () => { + const target = {} as { foo?: string } | Date | unknown[] | null | (() => void) | undefined + if (isJson(target)) { + expectTypeOf(target).toEqualTypeOf<{ foo?: string } | Date | Jsonifiable[] | null>() + } else { + expectTypeOf(target).toEqualTypeOf void) | unknown[]>() + } + }) + + test('should strictly guard as JSONifiable for class instance', () => { + class Foo { + bar = 'bar' + baz(): string { + return 'baz' + } + } + const target = new Foo() + if (isJson(target)) { + // @ts-ignore FIXME: This is a bug + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('guard unknown types', () => { + test('should guard as JSONifiable for unknown type value.', () => { + const target = 'string' as unknown + if (isJson(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as JSONifiable when type argument is set.', () => { + const target = 'string' as unknown + if (isJson<{ foo: string }>(target)) { + expectTypeOf(target).toEqualTypeOf<{ foo: string }>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('type errors', () => { + test.skip('should result in a TypeScript type error when the type argument is not a JSONifiable', () => { + // FIXME: This test should pass, but it fails. + // @ ts-expect-error + isJson>({}) + + // FIXME: This test should pass, but it fails. + // @ ts-expect-error + isJson<{ foo(): string }>({}) + }) +}) diff --git a/src/typeGuards/json/guards.spec.ts b/src/typeGuards/json/guards.spec.ts new file mode 100644 index 0000000..fc28ffa --- /dev/null +++ b/src/typeGuards/json/guards.spec.ts @@ -0,0 +1,54 @@ +import { describe } from 'vitest' +import { ValueType, testAssert, testEnsure, testFallback, testGuard } from '~/lib-test' +import { assertJson, ensureJson, fallbackJson, isJson } from './guards' + +const expected = [ + ValueType.JsonifiableObject, + ValueType.JsonifiableObjectInArray, + ValueType.True, + ValueType.False, + ValueType.BooleanObject, + ValueType.StringObject, + ValueType.PositiveNumber, + ValueType.NegativeNumber, + ValueType.Null, + ValueType.Zero, + ValueType.NumberObject, + ValueType.Array, + ValueType.EmptyArray, + ValueType.ArrayLike, + ValueType.Object, + ValueType.EmptyObject, + ValueType.BlankObject, + ValueType.WellKnownSymbolObject, + ValueType.IterableObject, + ValueType.AsyncIterableObject, + ValueType.Date, + ValueType.Proxy, + ValueType.ObjectToPrimitiveBoolean, + ValueType.ObjectToPrimitiveNumber, + ValueType.ObjectToPrimitiveNull, + ValueType.ObjectToPrimitiveBigInt, + ValueType.ObjectToPrimitiveString, + ValueType.ObjectToPrimitiveSymbol, + ValueType.ObjectToPrimitiveUndefined, +] + +describe('isJSON', () => { + testGuard(isJson, expected, { parsableString: true }) +}) + +describe('assertJSON', () => { + testAssert(assertJson, expected, { parsableString: true }) +}) + +describe('ensureJSON', () => { + testEnsure(ensureJson, expected, { parsableString: true }) +}) + +describe('fallbackJSON', () => { + testFallback(fallbackJson, expected, { + parsableString: true, + fallbackValue: [{ foo: 'bar' }], + }) +}) diff --git a/src/typeGuards/json/guards.ts b/src/typeGuards/json/guards.ts new file mode 100644 index 0000000..a172594 --- /dev/null +++ b/src/typeGuards/json/guards.ts @@ -0,0 +1,154 @@ +import { + type TypeAssert, + type TypeEnsure, + type TypeErrorMessage, + type TypeFallback, + type TypeGuard, + createAssertion, + createEnsure, + createFallback, + errorMessage, +} from '~/lib' +import { isBoolean } from '~/typeGuards/boolean' +import { isNumber } from '~/typeGuards/number' +import { deepJsonEqual, isJsonPrimitive } from './internals' +import type { JsonGuard, Jsonifiable, NotJsonifiable } from './type' + +export interface JsonTypeGuard extends TypeGuard { + (target: T | NotJsonifiable): target is JsonGuard +} + +export interface JsonTypeAssert extends TypeAssert { + (target: T | NotJsonifiable, message?: TypeErrorMessage): asserts target is JsonGuard +} + +export interface JsonTypeEnsure extends TypeEnsure { + (target: T, message?: TypeErrorMessage): JsonGuard +} + +export interface JsonTypeFallback extends TypeFallback { + (target: T, defaultValue: F): JsonGuard | JsonGuard +} + +/** + * Checks if a value can be serialized to Json. + * + * If the argument value is an object, it is determined by whether it is the same as the result serialized to Json. In other words, if it contains Function, it will be false. + * + * @param target The value to check. + * @returns True if the value is an Json, false otherwise. + * @example + * ```ts + * const result = isJson({"foo":"bar"}) + * // result is true + * + * const result = isJson({ foo: () => 'bar' }) + * // result is false + * + * const result = isJson('{"foo":"bar"}') + * // result is false + * + * const result = isJson(new Date()) + * // result is true, because it has toJson method + * ``` + */ + +export const isJson = ((target: unknown): target is Jsonifiable => { + if (isBoolean(target) || target === null) { + return true + } + + if (isNumber(target)) { + return !Number.isNaN(target) && Number.isFinite(target) + } + + if (!!target && typeof target === 'object') { + try { + const parsed = JSON.parse(JSON.stringify(target)) + if (isJsonPrimitive(parsed)) { + return true + } + + return deepJsonEqual(target, parsed) + } catch { + return false + } + } + + try { + return JSON.stringify(target) === String(target) + } catch { + return false + } +}) as JsonTypeGuard + +/** + * Asserts that a value can be serialized to Json. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not an Json. + * @throws A TypeError with the given message if the value is not an Json. + * @example + * ```ts + * assertJson({"foo":"bar"}) + * // target is Json + * + * assertJson({ foo: () => 'bar' }) + * // throws TypeAssertionError + * + * assertJson('{"foo":"bar"}') + * // throws TypeAssertionError + * + * assertJson(new Date()) + * // target is Json, because it has toJson method + * ``` + */ + +export const assertJson: JsonTypeAssert = createAssertion(isJson, errorMessage('Json')) + +/** + * Enxures that a value can be serialized to Json. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not an Json. + * @throws A TypeError with the given message if the value is not an Json. + * @returns The value if it is an Json. + * @example + * ```ts + * const result = ensureJson({"foo":"bar"}) + * // result is {"foo":"bar"} + * + * const result = ensureJson({ foo: () => 'bar' }) + * // throws TypeAssertionError + * + * const result = ensureJson('{"foo":"bar"}') + * // throws TypeAssertionError + * + * const result = ensureJson(new Date()) + * // result is Json, because it has toJson method + * ``` + */ +export const ensureJson = createEnsure(isJson, errorMessage('Json')) as JsonTypeEnsure + +/** + * Fallbacks to a default value if the value is not an Json. + * + * @param target The value to check. + * @param defaultValue The default value to fallback to. + * @return The value if it is an Json, the default value otherwise. + * @example + * ```ts + * const result = fallbackJson({"foo":"bar"}, {}) + * // result is Json + * + * const result = fallbackJson({ foo: () => 'bar' }, {}) + * // result is {} + * + * const result = fallbackJson('{"foo":"bar"}', {}) + * // result is {} + * + * const result = fallbackJson(new Date(), {}) + * // result is Json, because it has toJson method + * ``` + */ +export const fallbackJson: JsonTypeFallback = createFallback(isJson) diff --git a/src/typeGuards/json/index.ts b/src/typeGuards/json/index.ts new file mode 100644 index 0000000..2de266d --- /dev/null +++ b/src/typeGuards/json/index.ts @@ -0,0 +1,2 @@ +export * from './guards' +export type { Jsonifiable, NotJsonifiable, Jsonify } from './type' diff --git a/src/typeGuards/json/internals.spec.ts b/src/typeGuards/json/internals.spec.ts new file mode 100644 index 0000000..2497630 --- /dev/null +++ b/src/typeGuards/json/internals.spec.ts @@ -0,0 +1,65 @@ +import { describe, expect, test } from 'vitest' +import { deepJSONEqual, hasToJSON } from './internals' + +describe('hasToJSON', () => { + test('should returns true if the value has a toJSON method', () => { + // biome-ignore lint/style/useNamingConvention: + expect(hasToJSON({ toJSON: () => 'foo' })).toBe(true) + }) + + test('should returns false if the value does not have a toJSON method', () => { + expect(hasToJSON({})).toBe(false) + }) + + test('should returns false if the value is null', () => { + expect(hasToJSON(null)).toBe(false) + }) +}) + +describe('deepJSONEqual', () => { + test('should returns true if the values are equal', () => { + expect(deepJSONEqual('foo', 'foo')).toBe(true) + }) + + test('should returns false if the values are not equal', () => { + expect(deepJSONEqual('foo', 'bar')).toBe(false) + }) + + test('should returns true if the values are equal objects', () => { + expect(deepJSONEqual({ foo: 'bar' }, { foo: 'bar' })).toBe(true) + }) + + test('should returns false if the values are not equal objects', () => { + expect(deepJSONEqual({ foo: 'bar' }, { foo: 'baz' })).toBe(false) + }) + + test('should returns true if the values are equal arrays', () => { + expect(deepJSONEqual([1, 2, 3], [1, 2, 3])).toBe(true) + }) + + test('should returns false if the values are not equal arrays', () => { + expect(deepJSONEqual([1, 2, 3], [1, 2, 4])).toBe(false) + }) + + test('should returns true if the values are equal objects with toJSON methods', () => { + // biome-ignore lint/style/useNamingConvention: + expect(deepJSONEqual({ foo: { toJSON: (k: string) => `${k} ${k}` } }, { foo: 'foo foo' })).toBe(true) + + // biome-ignore lint/style/useNamingConvention: + expect(deepJSONEqual({ foo: 'foo foo' }, { foo: { toJSON: (k: string) => `${k} ${k}` } })).toBe(true) + }) + + test('should returns true if the values are equal arrays with toJSON methods', () => { + // biome-ignore lint/style/useNamingConvention: + expect(deepJSONEqual([{ toJSON: (k: string) => `${k} ${k}` }], ['0 0'])).toBe(true) + + // biome-ignore lint/style/useNamingConvention: + expect(deepJSONEqual(['0 0'], [{ toJSON: (k: string) => `${k} ${k}` }])).toBe(true) + }) + + describe('edge case', () => { + test('should verify that array audits are performed correctly when an empty array is passed.', () => { + expect(deepJSONEqual(Array(3), JSON.parse(JSON.stringify(Array(3))))).toBe(false) + }) + }) +}) diff --git a/src/typeGuards/json/internals.ts b/src/typeGuards/json/internals.ts new file mode 100644 index 0000000..f0d31ce --- /dev/null +++ b/src/typeGuards/json/internals.ts @@ -0,0 +1,94 @@ +import { isArray } from '~/typeGuards/array' +import { isBoolean } from '~/typeGuards/boolean' +import { isNumber } from '~/typeGuards/number' +import { isObject } from '~/typeGuards/object' +import { isString } from '~/typeGuards/string' + +export function hasToJson(value: unknown): value is { toJson: (key: string | number | symbol) => unknown } { + return isObject(value) && typeof (value as { toJson: unknown }).toJson === 'function' +} + +function getValueByObject(key: string | number | symbol, target: unknown): unknown { + if (isJsonPrimitive(target) || target === undefined) { + return target + } + + if (hasToJson(target)) { + return target.toJson(key) + } + + // biome-ignore lint/suspicious/noExplicitAny: + if ('valueof' in (target as any)) { + return target + } + + const value = (target as object).valueOf() + if (target !== value) { + return value + } + + return target +} + +export function deepJsonEqual(a: unknown, b: unknown): boolean { + if (a === b) { + return true + } + + if (typeof a !== typeof b) { + return false + } + + if (isObject(a) && isObject(b)) { + return objectEquals(a, b) + } + + if (isArray(a) && isArray(b)) { + return arrayEquals(a, b) + } + + return false +} + +function getKeys(a: Record): Array { + if (a.constructor && Object !== a.constructor) { + return Reflect.ownKeys(a.constructor.prototype) + } + + return Object.keys(a) +} + +function objectEquals( + a: Record, + b: Record, +): boolean { + const aKeys = getKeys(a) + const bKeys = getKeys(b) + const keys = Array.from(new Set([...aKeys, ...bKeys])) + + if (keys.length !== aKeys.length || keys.length !== bKeys.length) { + return false + } + + let result = true + for (const key of keys) { + result &&= deepJsonEqual(getValueByObject(key, a[key]), getValueByObject(key, b[key])) + } + return result +} + +function arrayEquals(a: unknown[], b: unknown[]): boolean { + if (a.length !== b.length) { + return false + } + + let result = true + for (let index = 0; index < a.length; index++) { + result &&= deepJsonEqual(getValueByObject(index, a[index]), getValueByObject(index, b[index])) + } + return result +} + +export function isJsonPrimitive(target: unknown): target is number | string | boolean | null { + return isNumber(target) || isString(target) || isBoolean(target) || target === null +} diff --git a/src/typeGuards/json/type.ts b/src/typeGuards/json/type.ts new file mode 100644 index 0000000..8d06fbc --- /dev/null +++ b/src/typeGuards/json/type.ts @@ -0,0 +1,23 @@ +import type { JsonPrimitive } from '~/lib' + +export type Jsonifiable = JsonPrimitive | JsonifiableArray | JsonifiableObject + +/** + * Type that cannot be inferred strictly + */ +export type WeakJsonifiable = JsonPrimitive | object + +export type JsonifiableArray = Jsonifiable[] | readonly Jsonifiable[] + +// biome-ignore lint/suspicious/noExplicitAny: +export type NotJsonifiable = Exclude + +export type JsonifiableObject = + | ({ [Key in string]: Jsonifiable } & { [Key in string]?: Jsonifiable | undefined }) + // biome-ignore lint/style/useNamingConvention: + | { toJSON: () => Jsonifiable } + +export type JsonGuard = T extends Jsonifiable ? T : unknown extends T ? Jsonifiable : never + +// FIXME: Can't express with current typescript +export type Jsonify = JsonGuard diff --git a/src/typeGuards/nil/assert.spec-d.ts b/src/typeGuards/nil/assert.spec-d.ts deleted file mode 100644 index acaf2e9..0000000 --- a/src/typeGuards/nil/assert.spec-d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { assertNil, assertNotNil } from '.' - -describe('assertNil type tests', () => { - test('guard definite types', () => { - const targetNull = null as null | string - assertNil(targetNull) - assertType(targetNull) - }) - - test('guard definite types 2', () => { - const targetUndef = undefined as undefined | string - assertNil(targetUndef) - assertType(targetUndef) - }) - - test('guard definite types 3', () => { - const targetConstString = 'string' as null | 'string' - assertNil(targetConstString) - assertType(targetConstString) - }) - - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertNil(targetUnknown) - assertType(targetUnknown) - }) -}) - -describe('assertNotNil type tests', () => { - test('guard definite types', () => { - const targetNull = null as null | string - assertNotNil(targetNull) - assertType(targetNull) - }) - - test('guard definite types 2', () => { - const targetUndef = undefined as undefined | string - assertNotNil(targetUndef) - assertType(targetUndef) - }) - - test('guard definite types 3', () => { - const targetConstString = 'string' as 'string' | null - assertNotNil(targetConstString) - assertType<'string'>(targetConstString) - }) - - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertNotNil(targetUnknown) - assertType(targetUnknown) - }) -}) diff --git a/src/typeGuards/nil/ensure.spec-d.ts b/src/typeGuards/nil/ensure.spec-d.ts deleted file mode 100644 index 0bcb2b1..0000000 --- a/src/typeGuards/nil/ensure.spec-d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { ensureNil, ensureNotNil } from '.' - -describe('ensureNil type tests', () => { - test('ensureNil is not definition', () => { - assertType(ensureNil) - }) -}) - -describe('ensureNotNil type tests', () => { - test('guard definite types', () => { - const targetNull = null as null | string - assertType(ensureNotNil(targetNull)) - }) - - test('guard definite types 2', () => { - const targetUndef = undefined as undefined | string - assertType(ensureNotNil(targetUndef)) - }) - - test('guard definite types 3', () => { - const targetConstString = 'string' as 'string' | null - assertType<'string'>(ensureNotNil(targetConstString)) - }) - - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(ensureNotNil(targetUnknown)) - }) -}) diff --git a/src/typeGuards/nil/fallback.spec-d.ts b/src/typeGuards/nil/fallback.spec-d.ts deleted file mode 100644 index 27e556d..0000000 --- a/src/typeGuards/nil/fallback.spec-d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { fallbackNil, fallbackNotNil } from '.' - -describe('fallbackNil type tests', () => { - test('fallbackNil is not definition', () => { - assertType(fallbackNil) - }) -}) - -describe('fallbackNotNil type tests', () => { - test('fallbackNotNil is not definition', () => { - assertType(fallbackNotNil) - }) -}) diff --git a/src/typeGuards/nil/guard.spec-d.ts b/src/typeGuards/nil/guard.spec-d.ts index 8d29f37..94368ea 100644 --- a/src/typeGuards/nil/guard.spec-d.ts +++ b/src/typeGuards/nil/guard.spec-d.ts @@ -1,79 +1,49 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { isNil, isNotNil } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { isNil } from './guards' -describe('isNil type tests', () => { - test('guard definite types', () => { - const targetNull = null as null | string - if (isNil(targetNull)) { - assertType(targetNull) +describe('guard type tests', () => { + test('should guard as nil for some values with null.', () => { + const target = null as null | string + if (isNil(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetNull) + expectTypeOf(target).toEqualTypeOf() } }) - test('guard definite types 2', () => { - const targetUndef = undefined as undefined | string - if (isNil(targetUndef)) { - assertType(targetUndef) + test('should guard as nil for some values wiht undefined.', () => { + const target = undefined as undefined | string + if (isNil(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetUndef) - } - }) - - test('guard definite types 3', () => { - const targetConstString = 'string' as null | 'string' - if (isNil(targetConstString)) { - assertType(targetConstString) - } else { - assertType<'string'>(targetConstString) - } - }) - - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isNil(targetUnknown)) { - assertType(targetUnknown) - } else { - assertType(targetUnknown) + expectTypeOf(target).toEqualTypeOf() } }) }) -describe('isNotNil type tests', () => { - test('guard definite types', () => { - const targetNull = null as null | string - if (isNotNil(targetNull)) { - assertType(targetNull) +describe('guard unknown types', () => { + test('should guard as nil for unknown type value.', () => { + const target = 'string' as unknown + if (isNil(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetNull) + expectTypeOf(target).toEqualTypeOf() } }) - test('guard definite types 2', () => { - const targetUndef = undefined as undefined | string - if (isNotNil(targetUndef)) { - assertType(targetUndef) + test('should strictly guard as nil when type argument is set.', () => { + const target = 'string' as unknown + if (isNil(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetUndef) - } - }) - - test('guard definite types 3', () => { - const targetConstString = 'string' as null | 'string' - if (isNotNil(targetConstString)) { - assertType<'string'>(targetConstString) - } else { - assertType(targetConstString) + expectTypeOf(target).toEqualTypeOf() } }) +}) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isNotNil(targetUnknown)) { - assertType(targetUnknown) - } else { - assertType(targetUnknown) - } +describe('type error', () => { + test('should result in TypeScript type error when the type argument is not a "nil"', () => { + // @ts-expect-error + isNil('string') }) }) diff --git a/src/typeGuards/nil/guards.spec.ts b/src/typeGuards/nil/guards.spec.ts new file mode 100644 index 0000000..a7213da --- /dev/null +++ b/src/typeGuards/nil/guards.spec.ts @@ -0,0 +1,8 @@ +import expected from 'lodash/isNil.js' +import { describe } from 'vitest' +import { testEquivalentGuard } from '~/lib-test' +import { isNil } from './guards' + +describe('isNil', () => { + testEquivalentGuard(isNil, expected) +}) diff --git a/src/typeGuards/nil/guards.ts b/src/typeGuards/nil/guards.ts new file mode 100644 index 0000000..f294318 --- /dev/null +++ b/src/typeGuards/nil/guards.ts @@ -0,0 +1,36 @@ +import type { TypeGuard } from '~/lib' + +export type Nil = null | undefined + +/** + * Checks if a value is null or undefined. + * + * @param target The value to check. + * @returns True if the value is null or undefined, false otherwise. + * @example + * ```ts + * const target = getTarget() // undefined | string + * if (isNil(target)) { + * // target is undefined + * } + * ``` + */ +export const isNil = ((target: unknown) => target == null) as TypeGuard + +/** + * `assertNil` is not needed because it is not useful. + * @deprecated + */ +export declare const assertNil: never + +/** + * `ensureNil` is not needed because it is not useful. + * @deprecated + */ +export declare const ensureNil: never + +/** + * `fallbackNil` is not needed because it is not useful. + * @deprecated + */ +export declare const fallbackNil: never diff --git a/src/typeGuards/nil/index.spec.ts b/src/typeGuards/nil/index.spec.ts deleted file mode 100644 index 3cffb29..0000000 --- a/src/typeGuards/nil/index.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import { describe } from 'vitest' -import expected from 'lodash/isNil.js' -import { isNil, assertNil, assertNotNil, ensureNotNil, isNotNil } from '.' -import { testAssert, testEnsure, testGuard } from '../../lib/test' - -describe('isNil', () => { - testGuard(isNil, expected) -}) - -describe('assertNil', () => { - testAssert(assertNil, expected) -}) - -describe('assertNotNil', () => { - testAssert(assertNotNil, expected, { negative: true }) -}) - -describe('ensureNotNil', () => { - testEnsure(ensureNotNil, expected, { negative: true }) -}) - -describe('isNotNil', () => { - testGuard(isNotNil, expected, { negative: true }) -}) diff --git a/src/typeGuards/nil/index.ts b/src/typeGuards/nil/index.ts index 23455e2..882c4db 100644 --- a/src/typeGuards/nil/index.ts +++ b/src/typeGuards/nil/index.ts @@ -1,110 +1,2 @@ -import { errorMessage } from '../../lib/error' -import { createAssertion, createEnsure, not } from '../../lib/factory' -import { InvertedTypeAssertOf, InvertedTypeEnsureOf, TypeAssertOf, TypeGuard } from '../../lib/type' - -/** - * Checks if a value is null or undefined. - * @param target The value to check. - * @returns True if the value is null or undefined, false otherwise. - * @example - * ```ts - * const target = getTarget() // undefined | string - * if (isNil(target)) { - * // target is undefined - * } - * ``` - */ -export const isNil = ((target: unknown): target is null | undefined => target == null) as TypeGuard< - null | undefined -> - -type IsNil = typeof isNil - -/** - * Asserts that a value is null or undefined. - * @param target The value to check.` - * @param message (optional) The error message to throw if the value is not null or undefined. - * @throws A TypeError with the given message if the value is not null or undefined. - * @example - * ```ts - * const target = getTarget() // undefined | string - * assertNil(target, 'target must be null or undefined') - * // target is undefined - * ``` - */ -export const assertNil: TypeAssertOf = createAssertion( - isNil, - errorMessage('null or undefined') -) - -/** - * `ensureNil` is not needed because it is not useful. - * @deprecated - */ -export declare const ensureNil: never - -/** - * `fallbackNil` is not needed because it is not useful. - * @deprecated - */ -export declare const fallbackNil: never - -/** - * Checks if a value is not null or undefined. - * - * In an if statement, it is simpler to use ! operator is simpler, - * but this method is useful in cases where the argument is a type guard function, such as Array.prototype.filter. - * @param target The value to check. - * @returns True if the value is not null or undefined, false otherwise. - * @example - * ```ts - * const targets = getTargets() // Array - * const result = targets.filter(isNotNil) - * // result is string[] - * ``` - */ -export const isNotNil = not(isNil) - -/** - * Asserts that a value is not null or undefined. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is null or undefined. - * @throws A TypeError with the given message if the value is null or undefined. - * @example - * ```ts - * const target = getTarget() // undefined | string - * assertNotNil(target, 'target must not be null or undefined') - * // target is string - * ``` - */ -export const assertNotNil: InvertedTypeAssertOf = createAssertion( - not(isNil), - errorMessage('null or undefined', { not: true }) -) - -/** - * Ensures that a value is not null or undefined. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is null or undefined. - * @returns The value if it is not null or undefined. - * @throws A TypeError with the given message if the value is null or undefined. - * @example - * ```ts - * const target = getTarget() // undefined | string - * const result = ensureNotNil(target, 'target must not be null or undefined') - * // result is string - * ``` - */ -export const ensureNotNil: InvertedTypeEnsureOf = createEnsure(not(isNil), errorMessage('null or undefined', { not: true })) - -/** - * `fallbackNotNil` is not needed because it is not useful. - * @deprecated use ?? operator instead - * @example - * ```ts - * const target = getTarget() // undefined | string - * const result = target ?? 'default' // use ?? operator instead - * // result is string - * ``` - */ -export declare const fallbackNotNil: never +export * from './guards' +export * from './not' diff --git a/src/typeGuards/nil/not/assert.spec-d.ts b/src/typeGuards/nil/not/assert.spec-d.ts new file mode 100644 index 0000000..71c7c31 --- /dev/null +++ b/src/typeGuards/nil/not/assert.spec-d.ts @@ -0,0 +1,42 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { assertNotNil } from './guards' + +describe('assert definite types', () => { + test('should assert as not nil for some values with null.', () => { + const target = 'string' as null | string + assertNotNil(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should assert as not nil for some values wiht undefined.', () => { + const target = 'string' as undefined | string + assertNotNil(target) + expectTypeOf(target).toEqualTypeOf() + }) +}) + +describe('assert unknown types', () => { + test('should assert as not nil for unknown type value.', () => { + const target = 'string' as unknown + assertNotNil(target) + // biome-ignore lint/complexity/noBannedTypes: + expectTypeOf(target).toEqualTypeOf<{}>() + }) + + test.skip('should strictly assert as not nil when type argument is set.', () => { + const target = 'string' as unknown + // FIXME: assertNotNil argument type should not inferred. + // @ts-ignore + assertNotNil(target) + expectTypeOf(target).toEqualTypeOf() + }) +}) + +describe('type error', () => { + test.skip('should result in TypeScript type error when the type argument is not a "non-nil"', () => { + // FIXME: should type error + assertNotNil('string') + // FIXME: should type error + assertNotNil('string') + }) +}) diff --git a/src/typeGuards/nil/not/ensure.spec-d.ts b/src/typeGuards/nil/not/ensure.spec-d.ts new file mode 100644 index 0000000..6628435 --- /dev/null +++ b/src/typeGuards/nil/not/ensure.spec-d.ts @@ -0,0 +1,42 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { ensureNotNil } from './guards' + +describe('ensure definite types', () => { + test('should ensure as not nil for some values with null.', () => { + const target = 'string' as null | string + const result = ensureNotNil(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should ensure as not nil for some values wiht undefined.', () => { + const target = 'string' as undefined | string + const result = ensureNotNil(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('ensure unknown types', () => { + test('should ensure as not nil for unknown type value.', () => { + const target = 'string' as unknown + const result = ensureNotNil(target) + // biome-ignore lint/complexity/noBannedTypes: + expectTypeOf(result).toEqualTypeOf<{}>() + }) + + test.skip('should strictly ensure as not nil when type argument is set.', () => { + const target = 'string' as unknown + // FIXME: ensureNotNil argument type should not inferred. + // @ts-ignore + const result = ensureNotNil(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('type error', () => { + test.skip('should result in TypeScript type error when the type argument is not a "non-nil"', () => { + // FIXME: should type error + ensureNotNil('string') + // FIXME: should type error + ensureNotNil('string') + }) +}) diff --git a/src/typeGuards/nil/not/guard.spec-d.ts b/src/typeGuards/nil/not/guard.spec-d.ts new file mode 100644 index 0000000..e9a2135 --- /dev/null +++ b/src/typeGuards/nil/not/guard.spec-d.ts @@ -0,0 +1,54 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { isNotNil } from './guards' + +describe('guard definite types', () => { + test('should guard as not nil for some values with null.', () => { + const target = null as null | string + if (isNotNil(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should guard as not nil for some values wiht undefined.', () => { + const target = undefined as undefined | string + if (isNotNil(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('guard unknown types', () => { + test('should guard as not nil for unknown type value.', () => { + const target = 'string' as unknown + if (isNotNil(target)) { + // biome-ignore lint/complexity/noBannedTypes: + expectTypeOf(target).toEqualTypeOf<{}>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test.skip('should strictly guard as not nil when type argument is set.', () => { + const target = 'string' as unknown + // FIXME: isNotNil argument type should not inferred. + // @ts-ignore + if (isNotNil(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('type error', () => { + test.skip('should result in TypeScript type error when the type argument is not a "non-nil"', () => { + // FIXME: should type error + isNotNil('string') + // FIXME: should type error + isNotNil('string') + }) +}) diff --git a/src/typeGuards/nil/not/guards.spec.ts b/src/typeGuards/nil/not/guards.spec.ts new file mode 100644 index 0000000..22d20ef --- /dev/null +++ b/src/typeGuards/nil/not/guards.spec.ts @@ -0,0 +1,16 @@ +import expected from 'lodash/isNil.js' +import { describe } from 'vitest' +import { testEquivalentAssert, testEquivalentEnsure, testEquivalentGuard } from '~/lib-test' +import { assertNotNil, ensureNotNil, isNotNil } from '.' + +describe('assertNotNil', () => { + testEquivalentAssert(assertNotNil, expected, { negative: true }) +}) + +describe('ensureNotNil', () => { + testEquivalentEnsure(ensureNotNil, expected, { negative: true }) +}) + +describe('isNotNil', () => { + testEquivalentGuard(isNotNil, expected, { negative: true }) +}) diff --git a/src/typeGuards/nil/not/guards.ts b/src/typeGuards/nil/not/guards.ts new file mode 100644 index 0000000..5457205 --- /dev/null +++ b/src/typeGuards/nil/not/guards.ts @@ -0,0 +1,76 @@ +import { type TypeErrorMessage, createAssertion, createEnsure, errorMessage, not } from '~/lib' + +import { type Nil, isNil } from '../guards' + +interface GuardNotNil { + // biome-ignore lint/complexity/noBannedTypes: + (target: T | {}): target is unknown extends T ? {} : Exclude +} + +interface AssertNotNil { + // biome-ignore lint/complexity/noBannedTypes: + (target: T | {}, message?: TypeErrorMessage): asserts target is unknown extends T ? {} : Exclude +} + +interface EnsureNotNil { + // biome-ignore lint/complexity/noBannedTypes: + (target: T | {}, message?: TypeErrorMessage): unknown extends T ? {} : Exclude +} + +/** + * Checks if a value is not null or undefined. + * @param target The value to check. + * @returns True if the value is not null or undefined, false otherwise. + * @example + * ```ts + * const value = await getValue() // Response | undefined + * + * if (isNotNil(value)) { + * // value is Response + * } + * ``` + */ +export const isNotNil = not(isNil) as GuardNotNil + +/** + * Asserts that a value is not null or undefined. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is null or undefined. + * @throws A TypeError with the given message if the value is null or undefined. + * @example + * ```ts + * const target = getTarget() // undefined | string + * assertNotNil(target, 'target must not be null or undefined') + * // target is string + * ``` + */ +export const assertNotNil: AssertNotNil = createAssertion(not(isNil), errorMessage('null or undefined', { not: true })) + +/** + * Ensures that a value is not null or undefined. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is null or undefined. + * @returns The value if it is not null or undefined. + * @throws A TypeError with the given message if the value is null or undefined. + * @example + * ```ts + * const target = getTarget() // undefined | string + * const result = ensureNotNil(target, 'target must not be null or undefined') + * // result is string + * ``` + */ +export const ensureNotNil: EnsureNotNil = createEnsure(not(isNil), errorMessage('null or undefined', { not: true })) + +/** + * `fallbackNotNil` is not needed because it is not useful. + * @deprecated use ?? operator instead + * @example + * ```ts + * const target = getTarget() // undefined | string + * const result = target ?? 'default' // use ?? operator instead + * // result is string + * ``` + */ +export declare const fallbackNotNil: never diff --git a/src/typeGuards/nil/not/index.ts b/src/typeGuards/nil/not/index.ts new file mode 100644 index 0000000..2bfb9a1 --- /dev/null +++ b/src/typeGuards/nil/not/index.ts @@ -0,0 +1 @@ +export * from './guards' diff --git a/src/typeGuards/number-parsable/assert.spec-d.ts b/src/typeGuards/number-parsable/assert.spec-d.ts new file mode 100644 index 0000000..86a451e --- /dev/null +++ b/src/typeGuards/number-parsable/assert.spec-d.ts @@ -0,0 +1,47 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { type NumberParsable, assertNumberParsable } from './guards' + +describe('assert definite types', () => { + test('should assert as NumberParsable type for NumberParsable type values.', () => { + const target = '1' as string | number + assertNumberParsable(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as NumberParsable type for string literal types.', () => { + const target = '1' as '1' | 1 | 'a' | boolean + assertNumberParsable(target) + expectTypeOf(target).toEqualTypeOf<1 | '1'>() + }) + + test('should strictly assert as NumberParsable type for Branded type.', () => { + type Branded = T & { __brand: 'branded' } + const target = '1' as Branded<'1'> | Branded<1> | Branded<'one'> | Branded + assertNumberParsable(target) + expectTypeOf(target).toEqualTypeOf>() + }) +}) + +describe('assert unknown types', () => { + test('should assert as NumberParsable type for unknown type value.', () => { + const target = '3' as unknown + assertNumberParsable(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as NumberParsable type when type argument is set.', () => { + const target = '3' as unknown + assertNumberParsable<3>(target) + expectTypeOf(target).toEqualTypeOf<3>() + }) +}) + +describe('type error', () => { + test('should result in a TypeScript type error when the type argument is not parsable string', () => { + assertNumberParsable( + // + 123, + ) + }) +}) diff --git a/src/typeGuards/number-parsable/coerce.spec-d.ts b/src/typeGuards/number-parsable/coerce.spec-d.ts new file mode 100644 index 0000000..5734344 --- /dev/null +++ b/src/typeGuards/number-parsable/coerce.spec-d.ts @@ -0,0 +1,48 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { coerceNumber } from './guards' + +describe('coerce definite types', () => { + test('should coerce as number for NumberParable type values.', () => { + const target = '1' as string | number + const result = coerceNumber(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly coerce as number for string literal types.', () => { + const target = '1' as '1' | '2' | 'a' + const result = coerceNumber(target) + expectTypeOf(result).toEqualTypeOf<1 | 2>() + }) + + test('should strictly coerce as number for string literal types with dot.', () => { + const target = '1.1' as '1.1' | '2' | 'a' + const result = coerceNumber(target) + expectTypeOf(result).toEqualTypeOf<1.1 | 2>() + }) + + test.skip('should strictly coerce as number for Branded type.', () => { + type Branded = T & { __brand: 'branded' } + const target = '1' as Branded<'1'> | Branded<1> | Branded<'one'> | Branded + const result = coerceNumber(target) + // FIXME: This should be Branded<1> + // @ts-ignore + expectTypeOf(result).toEqualTypeOf>() + }) +}) + +describe('coerce unknown types', () => { + test('should coerce as number for unknown type value.', () => { + const target = '3' as unknown + const result = coerceNumber(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test.skip('should strictly coerce as number when type argument is set.', () => { + type Type = 1 | 2 | 3 + const target = '3' as unknown + // FIXME: argument can pass any type + // @ts-ignore + const result = coerceNumber(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) diff --git a/src/typeGuards/number-parsable/ensure.spec-d.ts b/src/typeGuards/number-parsable/ensure.spec-d.ts new file mode 100644 index 0000000..4c9148a --- /dev/null +++ b/src/typeGuards/number-parsable/ensure.spec-d.ts @@ -0,0 +1,48 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { type NumberParsable, ensureNumberParsable } from './guards' + +describe('ensure definite types', () => { + test('should ensure as NumberParsable type for NumberParsable type values.', () => { + const target = 1 as number | string + const result = ensureNumberParsable(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure as NumberParsable type for string literal types.', () => { + const target = 1 as 1 | '2' | 'a' + const result = ensureNumberParsable(target) + expectTypeOf(result).toEqualTypeOf<1 | '2'>() + }) + + test('should strictly ensure as NumberParsable type for Branded type.', () => { + type Branded = T & { __brand: 'branded' } + const target = '1' as Branded<'1'> | Branded<2> | Branded<'three'> | Branded + const result = ensureNumberParsable(target) + expectTypeOf(result).toEqualTypeOf>() + }) +}) + +describe('ensure unknown types', () => { + test('should ensure as NumberParsable type for unknown type value.', () => { + const target = '3' as unknown + const result = ensureNumberParsable(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure as NumberParsable type when type argument is set.', () => { + type Type = '1' | '2' | '3' + const target = '3' as unknown + const result = ensureNumberParsable(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('type error', () => { + test('should result in a TypeScript type error when the type argument is not parsable string', () => { + ensureNumberParsable( + // + 123, + ) + }) +}) diff --git a/src/typeGuards/number-parsable/fallback.spec-d.ts b/src/typeGuards/number-parsable/fallback.spec-d.ts new file mode 100644 index 0000000..34011e0 --- /dev/null +++ b/src/typeGuards/number-parsable/fallback.spec-d.ts @@ -0,0 +1,61 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { type NumberParsable, fallbackNumberParsable } from './guards' + +describe('fallback definite types', () => { + test('should fallback as NumberParsable type for NumberParsable type values.', () => { + const target = 1 as number | string + const result = fallbackNumberParsable(target, 3) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback as NumberParsable type for string literal and union types.', () => { + const target = 1 as 1 | '2' | 'a' + const result1 = fallbackNumberParsable(target, 3) + expectTypeOf(result1).toEqualTypeOf<1 | '2' | 3>() + + const result2 = fallbackNumberParsable(target, '3') + expectTypeOf(result2).toEqualTypeOf<1 | '2' | '3'>() + }) + + test('should strictly fallback as NumberParsable type for Branded type.', () => { + type Branded = T & { __brand: 'branded' } + type Four = true + + const target = '1' as Branded<'1'> | Branded<2> | Branded<'three'> | Branded + const result = fallbackNumberParsable(target, 0 as Branded<0>) + expectTypeOf(result).toEqualTypeOf>() + }) +}) + +describe('fallback unknown types', () => { + test('should fallback as NumberParsable type for unknown type value.', () => { + const target = '3' as unknown + const result = fallbackNumberParsable(target, 3) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback as NumberParsable type when type argument is set.', () => { + const target = '3' as unknown + const result = fallbackNumberParsable<3>(target, 3) + expectTypeOf(result).toEqualTypeOf<3>() + }) +}) + +describe('type error', () => { + test('should result in a TypeScript type error when the type argument is not parsable string', () => { + fallbackNumberParsable( + // + 123, + 3, + ) + }) + + test('should result in a TypeScript type error when the argument is not parsable string', () => { + fallbackNumberParsable( + 'string', + // @ts-expect-error + 'a', + ) + }) +}) diff --git a/src/typeGuards/number-parsable/fix.spec-d.ts b/src/typeGuards/number-parsable/fix.spec-d.ts new file mode 100644 index 0000000..25f3523 --- /dev/null +++ b/src/typeGuards/number-parsable/fix.spec-d.ts @@ -0,0 +1,67 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { fixNumber } from './guards' + +describe('fix definite types', () => { + test('should fix as number for NumberParsable type values.', () => { + const target = '1' as string | number + const result = fixNumber(target, 3) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fix as number for union types.', () => { + type One = true + const target = '1' as 1 | '1' | 'one' | One + const result = fixNumber(target, 3) + expectTypeOf(result).toEqualTypeOf<1 | 3>() + }) + + test(`should return type as number when the first argument is a union type \ + and the second argument is a non-representable number like NaN`, () => { + type One = true + const target = '1' as 1 | '1' | 'one' | One + const result = fixNumber(target, NaN) + expectTypeOf(result).toEqualTypeOf() + }) + + test.skip('should strictly fix as number for Branded type.', () => { + type Branded = T & { __brand: 'branded' } + const target = '1' as Branded<'1'> | Branded<1> | Branded<'one'> | Branded + const result = fixNumber(target, 3 as Branded<3>) + // FIXME: This test should pass, but it fails. + // @ts-ignore + expectTypeOf(result).toEqualTypeOf>() + }) +}) + +describe('fix number string convert to number', () => { + test('should fix as number for number parsable string including dot', () => { + const target = '2.1' as const + const result = fixNumber(target, 3) + expectTypeOf(result).toEqualTypeOf<2.1 | 3>() + }) + + test('should fix as number for number parsable string including minus', () => { + const target = '-2' as const + const result = fixNumber(target, 3) + expectTypeOf(result).toEqualTypeOf<-2 | 3>() + }) +}) + +describe('fix unknown types', () => { + test('should fix as number for unknown type value.', () => { + const target = 'string' as unknown + const result = fixNumber(target, NaN) + expectTypeOf(result).toEqualTypeOf() + }) + + test.skip('should strictly fix as number when type argument is set.', () => { + type Type = 1 | 2 | 3 + + const target = '1' as unknown + // FIXME: This test should pass, but it fails. + // @ts-ignore + const result = fixNumber(target, 3) + // @ts-ignore + expectTypeOf(result).toEqualTypeOf() + }) +}) diff --git a/src/typeGuards/number-parsable/guard.spec-d.ts b/src/typeGuards/number-parsable/guard.spec-d.ts new file mode 100644 index 0000000..1f2047f --- /dev/null +++ b/src/typeGuards/number-parsable/guard.spec-d.ts @@ -0,0 +1,71 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { type NumberParsable, isNumberParsable } from './guards' + +describe('guard definite types', () => { + test('should guard as NumberParsable type for NumberParsable type values.', () => { + const target = '1' as string | number + if (isNumberParsable(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as NumberParsable type for string literal types.', () => { + type Four = true + const target = '1' as '1' | 2 | 'three' | Four + if (isNumberParsable(target)) { + expectTypeOf(target).toEqualTypeOf<'1' | 2>() + } else { + expectTypeOf(target).toEqualTypeOf<'three' | Four>() + } + }) + + test('should strictly guard as NumberParsable type for Branded type.', () => { + type Branded = T & { __brand: 'branded' } + const target = '1' as Branded<'1'> | Branded<1> | Branded<'one'> | Branded + if (isNumberParsable(target)) { + expectTypeOf(target).toEqualTypeOf | Branded<'1'>>() + } else { + expectTypeOf(target).toEqualTypeOf | Branded>() + } + }) +}) + +describe('guard unknown types', () => { + test('should guard as NumberParsable type for unknown type value.', () => { + const target = 'string' as unknown + if (isNumberParsable(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as NumberParsable type when type argument is set.', () => { + const target = '1' as unknown + if (isNumberParsable<1>(target)) { + expectTypeOf(target).toEqualTypeOf<1>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('type error', () => { + test('should result in a TypeScript type error when the type argument is "string"', () => { + isNumberParsable( + // + 123, + ) + }) + + test('should result in a TypeScript type error when the type argument is not a NumberParsable', () => { + isNumberParsable( + // + '123', + ) + }) +}) diff --git a/src/typeGuards/number-parsable/guards.spec.ts b/src/typeGuards/number-parsable/guards.spec.ts new file mode 100644 index 0000000..9a303b4 --- /dev/null +++ b/src/typeGuards/number-parsable/guards.spec.ts @@ -0,0 +1,121 @@ +import { describe, expect, test } from 'vitest' +import { TypeAssertionError } from '~/lib' +import { ValueType, getGenerator, testAssert, testEnsure, testFallback, testGuard, testTypes } from '~/lib-test' +import { + assertNumberParsable, + coerceNumber, + ensureNumberParsable, + fallbackNumberParsable, + fixNumber, + isNumberParsable, +} from './guards' + +const expected = [ + ValueType.True, + ValueType.False, + ValueType.BooleanObject, + ValueType.ObjectToPrimitiveBoolean, + ValueType.ObjectValueOfBoolean, + ValueType.NumberObject, + ValueType.PositiveNumber, + ValueType.NegativeNumber, + ValueType.Zero, + ValueType.PositiveInfinity, + ValueType.NegativeInfinity, + ValueType.NumberParsablePositiveInt, + ValueType.NumberStringLeadingZero, + ValueType.NumberParsablePositiveFloat, + ValueType.NumberParsablePositiveInfinity, + ValueType.NumberParsableNegativeInt, + ValueType.NumberParsableNegativeFloat, + ValueType.NumberParsableNegativeInfinity, + ValueType.ObjectToPrimitiveNumber, + ValueType.ObjectValueOfNumber, + ValueType.PositiveBigInt, + ValueType.NegativeBigInt, + ValueType.BigIntObject, + ValueType.ObjectToPrimitiveBigInt, + ValueType.ObjectValueOfBigInt, + ValueType.Null, + ValueType.ObjectToPrimitiveNull, + ValueType.ObjectValueOfNull, + ValueType.EmptyString, + ValueType.EmptyArray, + ValueType.EmptyBuffer, + ValueType.Date, +] + +describe('isNumberParsable', () => { + testGuard(isNumberParsable, expected, { parsableString: true }) +}) + +describe('assertNumberParsable', () => { + testAssert(assertNumberParsable, expected, { parsableString: true }) +}) + +describe('ensureNumberParsable', () => { + testEnsure(ensureNumberParsable, expected, { parsableString: true }) +}) + +describe('fallbackNumberParsable', () => { + testFallback(fallbackNumberParsable, expected, { parsableString: true, fallbackValue: 12345 }) +}) + +describe('coerceNumber', () => { + const caseNumbers = [123, 123.456, Infinity, -123, -123.456, -Infinity, 0] + + test.each(caseNumbers)('should coerce number when argument is %s', (value) => { + expect(coerceNumber(value)).toBe(value) + }) + + const caseNumberLikeStrings = [ + { input: '123', expected: 123 }, + { input: '123.456', expected: 123.456 }, + { input: 'Infinity', expected: Infinity }, + { input: '-123', expected: -123 }, + { input: '-123.456', expected: -123.456 }, + { input: '-Infinity', expected: -Infinity }, + { input: '0', expected: 0 }, + ] + + test.each(caseNumberLikeStrings)('should coerce number when argument is $input', ({ input, expected }) => { + expect(coerceNumber(input)).toBe(expected) + }) + + const caseThrown = testTypes(expected).filter((type) => !expected.includes(type)) + + test.each(caseThrown)('should throw error when argument is %s', (type) => { + const value = getGenerator(type)() + expect(() => coerceNumber(value)).toThrow(TypeAssertionError) + }) +}) + +describe('fixNumber', () => { + const caseNumbers = [123, 123.456, Infinity, -123, -123.456, -Infinity, 0] + + test.each(caseNumbers)('should fix number when argument is %s', (value) => { + expect(fixNumber(value, NaN)).toBe(value) + }) + + const caseNumberLikeStrings = [ + { input: '123', expected: 123 }, + { input: '123.456', expected: 123.456 }, + { input: 'Infinity', expected: Infinity }, + { input: '-123', expected: -123 }, + { input: '-123.456', expected: -123.456 }, + { input: '-Infinity', expected: -Infinity }, + { input: '0', expected: 0 }, + ] + + test.each(caseNumberLikeStrings)('should fix number when argument is $input', ({ input, expected }) => { + expect(fixNumber(input, NaN)).toBe(expected) + }) + + const caseThrown = testTypes(expected).filter((type) => !expected.includes(type)) + + test.each(caseThrown)('should return fallback value when argument is %s', (type) => { + const value = getGenerator(type)() + expect(fixNumber(value, NaN)).toBe(NaN) + expect(fixNumber(value, 123)).toBe(123) + }) +}) diff --git a/src/typeGuards/number-parsable/guards.ts b/src/typeGuards/number-parsable/guards.ts new file mode 100644 index 0000000..2f0bbbd --- /dev/null +++ b/src/typeGuards/number-parsable/guards.ts @@ -0,0 +1,192 @@ +import { + type TypeAssertOf, + TypeAssertionError, + type TypeEnsureOf, + type TypeErrorMessage, + type TypeFallbackOf, + type TypeGuard, + createAssertion, + createEnsure, + createFallback, + errorMessage, +} from '~/lib' +import { isNumber } from '~/typeGuards/number/guards' + +export type NumberParsable = number | `${number}` + +type Parse = N extends `${infer R extends number}` ? R : N + +type Result = { parsed: number; result: boolean } + +function commonTest(target: unknown): Result { + if (isNumber(target)) { + return { parsed: target, result: true } + } + + const parsed = (() => { + try { + return Number(target) + } catch { + return NaN + } + })() + + return { parsed, result: !Number.isNaN(parsed) } +} + +/** + * Checks if a value is number or number string. + * + * @param target The value to check. + * @returns True if the value is number, false otherwise. + * @example + * ```ts + * const target = getTarget() // number | string + * if (isNumberString(target)) { + * // target is number or number string (number | `${number}`) + * } + * ``` + */ +export const isNumberParsable = ((target: unknown) => commonTest(target).result) as TypeGuard + +type IsNumberParsable = typeof isNumberParsable + +/** + * Asserts that a value is number or number string. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not number or number string. + * @throws A TypeAssertionError with the given message if the value is not number or number string. + * @example + * ```ts + * const target = getTarget() // number | string + * assertNumberParsable(target, 'target must be number or number string') + * // target is number or number string (number | `${number}`) + * ``` + */ + +export const assertNumberParsable: TypeAssertOf = createAssertion( + isNumberParsable, + errorMessage('number'), +) + +/** + * Ensures that a value is number or number string. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not number or number string. + * @throws A TypeAssertionError with the given message if the value is not number or number string. + * @returns The value if it is number or number string. + * @example + * ```ts + * const target = getTarget() // number | string + * const result = ensureNumberParsable(target, 'target must be number or number string') + * // result is number or number string (number | `${number}`) + * ``` + */ +export const ensureNumberParsable: TypeEnsureOf = createEnsure( + isNumberParsable, + errorMessage('number parsable'), +) + +/** + * Fallbacks to a default value if the value is not number or number string. + * + * @param target The value to check. + * @param defaultValue The default value to fallback to. + * @example + * ```ts + * const target = getTarget() // number | string + * const result = fallbackNumberParsable(target, '300') + * // result is number or number string (number | `${number}`) + * ``` + */ +export const fallbackNumberParsable: TypeFallbackOf = createFallback(isNumberParsable) + +interface CoerceNumber { + /** + * Coerces a value to number. + * Throws a TypeAssertionError if the value is not number or number string. + * + * @param target The value to coerce. + * @param message (optional) The error message to throw if the value is not number or number string. + * @throws A TypeAssertionError if the value is not number or number string. + * @returns The value as number. + * @example + * ```ts + * const target = getTarget() // string | number + * const result = coerceNumber(target) + * // result is number + * ``` + */ + (target: N, message?: TypeErrorMessage | string): unknown extends N ? number : Parse> + + /** + * Coerces a value to number. + * Throws a TypeAssertionError if the value is not number or number string. + * + * @param target The value to coerce. + * @param message (optional) The error message to throw if the value is not number or number string. + * @throws A TypeAssertionError if the value is not number or number string. + * @returns The value as number. + * @example + * ```ts + * const target = getTarget() // string | number + * const result = coerceNumber(target) + * // result is number + * ``` + */ + (target: unknown, message?: TypeErrorMessage | string): number +} + +export const coerceNumber: CoerceNumber = (target: unknown, message?: TypeErrorMessage | string): number => { + const { parsed, result } = commonTest(target) + if (result) { + return parsed + } + const m = typeof message === 'string' ? message : message?.(target) ?? errorMessage('number')(target) + throw new TypeAssertionError(m, target) +} + +interface FixNumber { + /** + * Fixes a value to number. + * + * @param target The value to fix. + * @param defaultValue The fallback value to return if the value is not number or number string. + * @returns The value as number, the fallback value otherwise. + * @example + * ```ts + * const result = fixNumber('1', 0) + * // result is 1 + * + * const result = fixNumber('a', 0) + * // result is 0 + * ``` + */ + (target: N, defaultValue: F): + | (unknown extends N ? number : Parse>) + | F + + /** + * Fixes a value to number. + * + * @param target The value to fix. + * @param defaultValue The fallback value to return if the value is not number or number string. + * @returns The value as number, the fallback value otherwise. + * @example + * ```ts + * const result = fixNumber('1', 0) + * // result is 1 + * + * const result = fixNumber('a', 0) + * // result is 0 + * ``` + */ + (target: unknown, defaultValue: number): number +} + +export const fixNumber: FixNumber = (target: unknown, defaultValue: number): number => { + const { parsed, result } = commonTest(target) + return result ? parsed : defaultValue +} diff --git a/src/typeGuards/number-parsable/index.ts b/src/typeGuards/number-parsable/index.ts new file mode 100644 index 0000000..2bfb9a1 --- /dev/null +++ b/src/typeGuards/number-parsable/index.ts @@ -0,0 +1 @@ +export * from './guards' diff --git a/src/typeGuards/number/assert.spec-d.ts b/src/typeGuards/number/assert.spec-d.ts index c18adc9..ee58d0c 100644 --- a/src/typeGuards/number/assert.spec-d.ts +++ b/src/typeGuards/number/assert.spec-d.ts @@ -1,43 +1,45 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { assertNumber, assertNotNumber } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { assertNumber } from './guards' -describe('assertNumber type tests', () => { - test('guard definite types', () => { - const targetNumber = 1 as number | string - assertNumber(targetNumber) - assertType(targetNumber) +describe('assert definite types', () => { + test('should assert as number for number type values.', () => { + const target = 1 as number | string + assertNumber(target) + expectTypeOf(target).toEqualTypeOf() }) - test('guard definite types 2', () => { - const targetConstNumber = 1 as 1 | '1' - assertNumber(targetConstNumber) - assertType<1>(targetConstNumber) + test('should strictly assert as number for number literal types.', () => { + const target = 1 as 1 | '1' + assertNumber(target) + expectTypeOf(target).toEqualTypeOf<1>() }) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertNumber(targetUnknown) - assertType(targetUnknown) + test('should strictly assert as number for Branded number type', () => { + type BrandedNumber = number & { __brand: 'branded' } + const target = 1 as BrandedNumber | string + assertNumber(target) + expectTypeOf(target).toEqualTypeOf() }) }) -describe('assertNotNumber type tests', () => { - test('guard definite types', () => { - const targetNumber = 1 as number | string - assertNotNumber(targetNumber) - assertType(targetNumber) +describe('assert unknown types', () => { + test('should assert as number for unknown type value.', () => { + const target = 123 as unknown + assertNumber(target) + expectTypeOf(target).toEqualTypeOf() }) - test('guard definite types 2', () => { - const targetConstNumber = 1 as 1 | '1' - assertNotNumber(targetConstNumber) - assertType<'1'>(targetConstNumber) + test('should strictly assert as number when type argument is set.', () => { + type Type = 1 | 2 | 3 + const target = 123 as unknown + assertNumber(target) + expectTypeOf(target).toEqualTypeOf() }) +}) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertNotNumber(targetUnknown) - assertType(targetUnknown) +describe('type error', () => { + test('should result in TypeScript type error when the type argument is not a number', () => { + // @ts-expect-error + assertNumber(123) }) }) diff --git a/src/typeGuards/number/ensure.spec-d.ts b/src/typeGuards/number/ensure.spec-d.ts index 47abfc4..bd9884f 100644 --- a/src/typeGuards/number/ensure.spec-d.ts +++ b/src/typeGuards/number/ensure.spec-d.ts @@ -1,37 +1,45 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { ensureNumber, ensureNotNumber } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { ensureNumber } from './guards' -describe('ensureNumber type tests', () => { - test('guard definite types', () => { - const targetNumber = 1 as number | string - assertType(ensureNumber(targetNumber)) +describe('ensure definite types', () => { + test('should ensure as number for number type values.', () => { + const target = 1 as number | string + const result = ensureNumber(target) + expectTypeOf(result).toEqualTypeOf() }) - test('guard definite types 2', () => { - const targetConstNumber = 1 as 1 | '1' - assertType<1>(ensureNumber(targetConstNumber)) + test('should strictly ensure as number for number literal types.', () => { + const target = 1 as 1 | '1' + const result = ensureNumber(target) + expectTypeOf(result).toEqualTypeOf<1>() }) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(ensureNumber(targetUnknown)) + test('should strictly ensure as number for Branded number type', () => { + type BrandedNumber = number & { __brand: 'branded' } + const target = 1 as BrandedNumber | string + const result = ensureNumber(target) + expectTypeOf(result).toEqualTypeOf() }) }) -describe('ensureNotNumber type tests', () => { - test('guard definite types', () => { - const targetNumber = 1 as number | string - assertType(ensureNotNumber(targetNumber)) +describe('ensure unknown types', () => { + test('should ensure as number for unknown type value.', () => { + const target = 123 as unknown + const result = ensureNumber(target) + expectTypeOf(result).toEqualTypeOf() }) - test('guard definite types 2', () => { - const targetConstNumber = 1 as 1 | '1' - assertType<'1'>(ensureNotNumber(targetConstNumber)) + test('should strictly ensure as number when type argument is set.', () => { + type Type = 1 | 2 | 3 + const target = 123 as unknown + const result = ensureNumber(target) + expectTypeOf(result).toEqualTypeOf() }) +}) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(ensureNotNumber(targetUnknown)) +describe('type error', () => { + test('should result in TypeScript type error when the type argument is not a number', () => { + // @ts-expect-error + ensureNumber(123) }) }) diff --git a/src/typeGuards/number/fallback.spec-d.ts b/src/typeGuards/number/fallback.spec-d.ts index 22284cb..e8478d7 100644 --- a/src/typeGuards/number/fallback.spec-d.ts +++ b/src/typeGuards/number/fallback.spec-d.ts @@ -1,47 +1,50 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { fallbackNumber, fallbackNotNumber } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { fallbackNumber } from './guards' -describe('fallbackNumber type tests', () => { - test('guard definite types', () => { - const targetNumber = 1 as number | string - assertType(fallbackNumber(targetNumber, 3)) +describe('fallback definite types', () => { + test('should fallback as number for number type values.', () => { + const target = 1 as number | string + const result = fallbackNumber(target, 3) + expectTypeOf(result).toEqualTypeOf() }) - test('guard definite types 2', () => { - const targetConstNumber = 1 as 1 | '1' - assertType<1 | 3>(fallbackNumber(targetConstNumber, 3)) + test('should strictly fallback as number for number literal types.', () => { + const target = 1 as 1 | '1' + const result = fallbackNumber(target, 3) + expectTypeOf(result).toEqualTypeOf<1 | 3>() }) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(fallbackNumber(targetUnknown, 3)) - }) - - test('uncorrect fallback types', () => { - // @ts-expect-error - fallbackNumber('string', '1') + test('should strictly fallback as number for Branded number type', () => { + type BrandedNumber = number & { __brand: 'branded' } + const target = 1 as BrandedNumber | string + const result = fallbackNumber(target, 3) + expectTypeOf(result).toEqualTypeOf() }) }) -describe('fallbackNotNumber type tests', () => { - test('guard definite types', () => { - const targetNumber = 1 as number | string - assertType(fallbackNotNumber(targetNumber, 'string')) +describe('fallback unknown types', () => { + test('should fallback as number for unknown type value.', () => { + const target = 'string' as unknown + const result = fallbackNumber(target, 3) + expectTypeOf(result).toEqualTypeOf() }) - test('guard definite types 2', () => { - const targetConstNumber = 1 as 1 | '1' - assertType<'1' | 'string'>(fallbackNotNumber(targetConstNumber, 'string')) + test('should strictly fallback as number when type argument is set.', () => { + type Type = 1 | 2 | 3 + const target = 'string' as unknown + const result = fallbackNumber(target, 3) + expectTypeOf(result).toEqualTypeOf() }) +}) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(fallbackNotNumber(targetUnknown, 'string')) +describe('type error', () => { + test('should result in TypeScript type error when the type argument is not a number', () => { + // @ts-expect-error + fallbackNumber('string', '1') }) - test('uncorrect fallback types', () => { + test('should result in TypeScript type error when the fallback value is not a number', () => { // @ts-expect-error - fallbackNotNumber('string', 1) + fallbackNumber('string', '1') }) }) diff --git a/src/typeGuards/number/guard.spec-d.ts b/src/typeGuards/number/guard.spec-d.ts index 485574f..ae77c86 100644 --- a/src/typeGuards/number/guard.spec-d.ts +++ b/src/typeGuards/number/guard.spec-d.ts @@ -1,61 +1,60 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { isNumber, isNotNumber } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { isNumber } from './guards' -describe('isNumber type tests', () => { - test('guard definite types', () => { - const targetNumber = 1 as number | string - if (isNumber(targetNumber)) { - assertType(targetNumber) +describe('guard definite types', () => { + test('should guard as number for number type values.', () => { + const target = 1 as number | string + if (isNumber(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetNumber) + expectTypeOf(target).toEqualTypeOf() } }) - test('guard definite types 2', () => { - const targetConstNumber = 1 as 1 | '1' - if (isNumber(targetConstNumber)) { - assertType<1>(targetConstNumber) + test('should strictly guard as number for number literal types.', () => { + const target = 1 as 1 | '1' + if (isNumber(target)) { + expectTypeOf(target).toEqualTypeOf<1>() } else { - assertType<'1'>(targetConstNumber) + expectTypeOf(target).toEqualTypeOf<'1'>() } }) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isNumber(targetUnknown)) { - assertType(targetUnknown) + test('should strictly guard as number for Branded number type', () => { + type BrandedNumber = number & { __brand: 'branded' } + const target = 1 as BrandedNumber | string + if (isNumber(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetUnknown) + expectTypeOf(target).toEqualTypeOf() } }) }) -describe('isNotNumber type tests', () => { - test('guard definite types', () => { - const targetNumber = 1 as number | string - if (isNotNumber(targetNumber)) { - assertType(targetNumber) +describe('guard unknown types', () => { + test('should guard as number for unknown type value.', () => { + const target = 'string' as unknown + if (isNumber(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetNumber) + expectTypeOf(target).toEqualTypeOf() } }) - test('guard definite types 2', () => { - const targetConstNumber = 1 as 1 | '1' - if (isNotNumber(targetConstNumber)) { - assertType<'1'>(targetConstNumber) + test('should strictly guard as number when type argument is set.', () => { + type Type = 1 | 2 | 3 + const target = 'string' as unknown + if (isNumber(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType<1>(targetConstNumber) + expectTypeOf(target).toEqualTypeOf() } }) +}) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isNotNumber(targetUnknown)) { - assertType(targetUnknown) - } else { - assertType(targetUnknown) - } +describe('type error', () => { + test('should result in TypeScript type error when the type argument is not a number', () => { + // @ts-expect-error + isNumber('string') }) }) diff --git a/src/typeGuards/number/guards.spec.ts b/src/typeGuards/number/guards.spec.ts new file mode 100644 index 0000000..0bc47b6 --- /dev/null +++ b/src/typeGuards/number/guards.spec.ts @@ -0,0 +1,27 @@ +import { describe } from 'vitest' +import { ValueType, testAssert, testEnsure, testFallback, testGuard } from '~/lib-test' +import { assertNumber, ensureNumber, fallbackNumber, isNumber } from './guards' + +const expected = [ + ValueType.PositiveNumber, + ValueType.NegativeNumber, + ValueType.Zero, + ValueType.PositiveInfinity, + ValueType.NegativeInfinity, +] + +describe('isNumber', () => { + testGuard(isNumber, expected) +}) + +describe('assertNumber', () => { + testAssert(assertNumber, expected) +}) + +describe('ensureNumber', () => { + testEnsure(ensureNumber, expected) +}) + +describe('fallbackNumber', () => { + testFallback(fallbackNumber, expected, { fallbackValue: [123] }) +}) diff --git a/src/typeGuards/number/guards.ts b/src/typeGuards/number/guards.ts new file mode 100644 index 0000000..abaaa9d --- /dev/null +++ b/src/typeGuards/number/guards.ts @@ -0,0 +1,75 @@ +import { + type TypeAssertOf, + type TypeEnsureOf, + type TypeFallbackOf, + type TypeGuard, + createAssertion, + createEnsure, + createFallback, + errorMessage, +} from '~/lib' + +/** + * Checks if a value is a number. NaN is not considered a number. + * @param target The value to check. + * @returns True if the value is a number, false otherwise. + * @example + * ```ts + * const result = isNumber(123) + * // true + * + * const result = isNumber('123') + * // false + * + * const result = isNumber(NaN) + * // false + * ``` + */ +export const isNumber = ((target: unknown) => typeof target === 'number' && !Number.isNaN(target)) as TypeGuard + +type IsNumber = typeof isNumber + +/** + * Asserts that a value is a number. + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a number. + * @throws A TypeError with the given message if the value is not a number. + * @example + * ```ts + * const target = getTarget() // number | string + * assertNumber(target, 'target must be a number') + * // target is number + * ``` + */ + +export const assertNumber: TypeAssertOf = createAssertion(isNumber, errorMessage('number')) + +/** + * Ensures that a value is a number. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a number. + * @throws A TypeError with the given message if the value is not a number. + * @returns The value if it is a number. + * @example + * ```ts + * const target = getTarget() // number | string + * const result = ensureNumber(target, 'target must be a number') + * // result is number + * ``` + */ +export const ensureNumber: TypeEnsureOf = createEnsure(isNumber, errorMessage('number')) + +/** + * Fallbacks to a default value if the value is not a number. + * + * @param target The value to check. + * @param defaultValue The default value to fallback to. + * @example + * ```ts + * const target = getTarget() // number | string + * const result = fallbackNumber(target, ['default']) + * // result is number | string + * ``` + */ +export const fallbackNumber: TypeFallbackOf = createFallback(isNumber) diff --git a/src/typeGuards/number/index.spec.ts b/src/typeGuards/number/index.spec.ts deleted file mode 100644 index f4b74b9..0000000 --- a/src/typeGuards/number/index.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { describe } from 'vitest' -import expected from 'lodash/isNumber.js' -import { - assertNotNumber, - assertNumber, - ensureNotNumber, - ensureNumber, - fallbackNotNumber, - fallbackNumber, - isNumber, - isNotNumber -} from '.' -import { testAssert, testEnsure, testFallback, testGuard } from '../../lib/test' - -describe('isNumber', () => { - testGuard(isNumber, expected) -}) - -describe('assertNumber', () => { - testAssert(assertNumber, expected) -}) - -describe('ensureNumber', () => { - testEnsure(ensureNumber, expected) -}) - -describe('fallbackNumber', () => { - testFallback(fallbackNumber, expected, { fallbackValue: [123] }) -}) - -describe('isNotNumber', () => { - testGuard(isNotNumber, expected, { negative: true }) -}) - -describe('assertNotNumber', () => { - testAssert(assertNotNumber, expected, { negative: true }) -}) - -describe('ensureNotNumber', () => { - testEnsure(ensureNotNumber, expected, { negative: true }) -}) - -describe('fallbackNotNumber', () => { - testFallback(fallbackNotNumber, expected, { negative: true, fallbackValue: 'fallback' }) -}) diff --git a/src/typeGuards/number/index.ts b/src/typeGuards/number/index.ts index 8a4ae18..2bfb9a1 100644 --- a/src/typeGuards/number/index.ts +++ b/src/typeGuards/number/index.ts @@ -1,136 +1 @@ -import { createAssertion, createEnsure, createFallback, not } from '../../lib/factory' -import { - InvertedTypeAssertOf, - InvertedTypeEnsureOf, - InvertedTypeFallbackOf, - TypeAssertOf, - TypeEnsureOf, - TypeFallbackOf, - TypeGuard -} from '../../lib/type' -import { errorMessage } from '../../lib/error' - -/** - * Checks if a value is an number. - * @param target The value to check. - * @returns True if the value is an number, false otherwise. - * @example - * ```ts - * const target = getTarget() // number | string - * if (isNumber(target)) { - * // target is number - * } - * ``` - */ -export const isNumber = ((target: unknown): target is number => - typeof target === 'number') as TypeGuard - -type IsNumber = typeof isNumber - -/** - * Asserts that a value is an number. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is not an number. - * @throws A TypeError with the given message if the value is not an number. - * @example - * ```ts - * const target = getTarget() // number | string - * assertNumber(target, 'target must be an number') - * // target is number - * ``` - */ - -export const assertNumber: TypeAssertOf = createAssertion( - isNumber, - errorMessage('number') -) - -/** - * Ensures that a value is an number. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is not an number. - * @throws A TypeError with the given message if the value is not an number. - * @returns The value if it is an number. - * @example - * ```ts - * const target = getTarget() // number | string - * const result = ensureNumber(target, 'target must be an number') - * // result is number - * ``` - */ -export const ensureNumber: TypeEnsureOf = createEnsure(isNumber, errorMessage('number')) - -/** - * Fallbacks to a default value if the value is not an number. - * @param target The value to check. - * @param defaultValue The default value to fallback to. - * @example - * ```ts - * const target = getTarget() // number | string - * const result = fallbackNumber(target, ['default']) - * // result is number | string - * ``` - */ -export const fallbackNumber: TypeFallbackOf = createFallback(isNumber) - -/** - * Checks if a value is not an number. - * - * In an if statement, it is simpler to use ! operator is simpler, - * but this method is useful in cases where the argument is a type guard function, such as Array.prototype.filter. - * @param target The value to check. - * @returns True if the value is not an number, false otherwise. - * @example - * ```ts - * const targets = getTargets() // Array - * const result = targets.filter(isNotNumber) - * // result is string[] - * ``` - */ -export const isNotNumber = not(isNumber) - -/** - * Asserts that a value is not an number. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is an number. - * @throws A TypeError with the given message if the value is an number. - * @example - * ```ts - * const target = getTarget() // string | number - * assertNotNumber(target, 'target must not be an number') - * // target is string - * ``` - */ -export const assertNotNumber: InvertedTypeAssertOf = createAssertion( - not(isNumber), - errorMessage('number', { not: true }) -) - -/** - * Enxures that a value is not an number. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is an number. - * @throws A TypeError with the given message if the value is an number. - * @returns The value if it is not an number. - * @example - * ```ts - * const target = getTarget() // string | number - * const result = ensureNotNumber(target, 'target must not be an number') - * // result is string - * ``` - */ -export const ensureNotNumber: InvertedTypeEnsureOf = createEnsure(not(isNumber), errorMessage('number', { not: true })) - -/** - * Fallbacks to a default value if the value is not an number. - * @param target The value to check. - * @param defaultValue The default value to fallback to. - * @return The value if it is not an number, the default value otherwise. - * @example - * ```ts - * const target = getTarget() // string | number - * const result = fallbackNotNumber(target, 'default') - * // result is string - * ``` - */ -export const fallbackNotNumber: InvertedTypeFallbackOf = createFallback(not(isNumber)) +export * from './guards' diff --git a/src/typeGuards/object/assert.spec-d.ts b/src/typeGuards/object/assert.spec-d.ts index c099500..137ed9b 100644 --- a/src/typeGuards/object/assert.spec-d.ts +++ b/src/typeGuards/object/assert.spec-d.ts @@ -1,55 +1,52 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { assertObject, assertNotObject } from '.' - -describe('assertObject type tests', () => { - test('guard definite types', () => { - const targetObject = {} as object | string - assertObject(targetObject) - assertType(targetObject) - }) - - test('guard definite types 2', () => { - const targetConstObject = {} as { foo?: string } | '1' - assertObject(targetConstObject) - assertType<{ foo?: string }>(targetConstObject) - }) - - test('guard definite types 3', () => { - const targetConstObject = {} as { foo?: string } | Date | unknown[] - assertObject(targetConstObject) - assertType<{ foo?: string } | Date | unknown[]>(targetConstObject) - }) - - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertObject(targetUnknown) - assertType(targetUnknown) +import { describe, expectTypeOf, test } from 'vitest' +import { assertObject } from './guards' + +describe('assert definite types', () => { + test('should assert object for object type values.', () => { + const target = {} as object | string + assertObject(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert object for strict object type values.', () => { + const target = {} as { foo?: string } | '1' + assertObject(target) + expectTypeOf(target).toEqualTypeOf<{ foo?: string }>() + }) + + test('should strictly assert object for union types.', () => { + const target = { foo: 'bar' } as + | { foo?: string } + | Date + | unknown[] + | null + | string + | (() => void) + | undefined + | typeof String + assertObject(target) + expectTypeOf(target).toEqualTypeOf<{ foo?: string } | Date>() }) }) -describe('assertNotObject type tests', () => { - test('guard definite types', () => { - const targetObject = {} as object | string - assertNotObject(targetObject) - assertType(targetObject) +describe('assert unknown types', () => { + test('should assert object for unknown type value.', () => { + const target = { foo: 'bar' } as unknown + assertObject(target) + expectTypeOf(target).toEqualTypeOf>() }) - test('guard definite types 2', () => { - const targetConstObject = {} as { foo?: string } | '1' - assertNotObject(targetConstObject) - assertType<'1'>(targetConstObject) - }) - - test('guard definite types 3', () => { - const targetConstObject = {} as { foo?: string } | Date | unknown[] - assertNotObject(targetConstObject) - assertType(targetConstObject) + test('should strictly assert object when type argument is set.', () => { + const target = {} as unknown + assertObject>(target) + expectTypeOf(target).toEqualTypeOf>() }) +}) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertNotObject(targetUnknown) - assertType(targetUnknown) +describe('type error', () => { + test.skip('should result in a TypeScript type error when the type argument is not a object', () => { + // FIXME: error not occured. + // @ ts-expect-error + assertObject(123) }) }) diff --git a/src/typeGuards/object/ensure.spec-d.ts b/src/typeGuards/object/ensure.spec-d.ts index aa0a431..f12b5f8 100644 --- a/src/typeGuards/object/ensure.spec-d.ts +++ b/src/typeGuards/object/ensure.spec-d.ts @@ -1,47 +1,52 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { ensureObject, ensureNotObject } from '.' - -describe('ensureObject type tests', () => { - test('guard definite types', () => { - const targetObject = {} as object | string - assertType(ensureObject(targetObject)) - }) - - test('guard definite types 2', () => { - const targetConstObject = {} as { foo?: string } | '1' - assertType<{ foo?: string }>(ensureObject(targetConstObject)) - }) - - test('guard definite types 3', () => { - const targetConstObject = {} as { foo?: string } | Date | unknown[] - assertType<{ foo?: string } | Date | unknown[]>(ensureObject(targetConstObject)) - }) - - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(ensureObject(targetUnknown)) +import { describe, expectTypeOf, test } from 'vitest' +import { ensureObject } from './guards' + +describe('ensure definite types', () => { + test('should ensure object for object type values.', () => { + const target = {} as object | string + const result = ensureObject(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure object for strict object type values.', () => { + const target = {} as { foo?: string } | '1' + const result = ensureObject(target) + expectTypeOf(result).toEqualTypeOf<{ foo?: string }>() + }) + + test('should strictly ensure object for union types.', () => { + const target = { foo: 'bar' } as + | { foo?: string } + | Date + | unknown[] + | null + | string + | (() => void) + | undefined + | typeof String + const result = ensureObject(target) + expectTypeOf(result).toEqualTypeOf<{ foo?: string } | Date>() }) }) -describe('ensureNotObject type tests', () => { - test('guard definite types', () => { - const targetObject = {} as object | string - assertType(ensureNotObject(targetObject)) +describe('ensure unknown types', () => { + test('should ensure object for unknown type value.', () => { + const target = { foo: 'bar' } as unknown + const result = ensureObject(target) + expectTypeOf(result).toEqualTypeOf>() }) - test('guard definite types 2', () => { - const targetConstObject = {} as { foo?: string } | '1' - assertType<'1'>(ensureNotObject(targetConstObject)) - }) - - test('guard definite types 3', () => { - const targetConstObject = {} as { foo?: string } | Date | unknown[] - assertType(ensureNotObject(targetConstObject)) + test('should strictly ensure object when type argument is set.', () => { + const target = {} as unknown + const result = ensureObject>(target) + expectTypeOf(result).toEqualTypeOf>() }) +}) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(ensureNotObject(targetUnknown)) +describe('type error', () => { + test.skip('should result in a TypeScript type error when the type argument is not a object', () => { + // FIXME: error not occured. + // @ ts-expect-error + ensureObject(123) }) }) diff --git a/src/typeGuards/object/fallback.spec-d.ts b/src/typeGuards/object/fallback.spec-d.ts index 5bfc9f4..8453602 100644 --- a/src/typeGuards/object/fallback.spec-d.ts +++ b/src/typeGuards/object/fallback.spec-d.ts @@ -1,59 +1,52 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { fallbackObject, fallbackNotObject } from '.' - -describe('fallbackObject type tests', () => { - test('guard definite types', () => { - const targetObject = {} as object | string - assertType(fallbackObject(targetObject, { foo: 'bar' })) - }) - - test('guard definite types 2', () => { - const targetConstObject = {} as { foo?: string } | '1' - assertType<{ foo?: string }>(fallbackObject(targetConstObject, { foo: 'bar' })) - }) - - test('guard definite types 3', () => { - const targetConstObject = {} as { foo?: string } | Date | unknown[] - assertType<{ foo?: string } | Date | unknown[]>( - fallbackObject(targetConstObject, { foo: 'bar' }) - ) - }) - - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(fallbackObject(targetUnknown, { foo: 'bar' })) - }) - - test('uncorrect fallback value', () => { - // @ts-expect-error - assertType(fallbackObject({}, 'bar')) +import { describe, expectTypeOf, test } from 'vitest' +import { fallbackObject } from './guards' + +describe('fallback definite types', () => { + test('should fallback to default value for object type values.', () => { + const target = {} as object | string + const result = fallbackObject(target, { foo: 'bar' }) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback to default value for strict object type values.', () => { + const target = { foo: 'bar' } as { foo?: string } | '1' + const result = fallbackObject(target, { baz: 'qux' }) + expectTypeOf(result).toEqualTypeOf<{ foo?: string } | { baz: string }>() + }) + + test('should strictly fallback to default value for union types.', () => { + const target = { foo: 'bar' } as + | { foo?: string } + | Date + | unknown[] + | null + | string + | (() => void) + | undefined + | typeof String + const result = fallbackObject(target, { foo: 'bar' }) + expectTypeOf(result).toEqualTypeOf<{ foo?: string } | Date>() }) }) -describe('fallbackNotObject type tests', () => { - test('guard definite types', () => { - const targetObject = {} as object | string - assertType(fallbackNotObject(targetObject, 'bar')) - }) - - test('guard definite types 2', () => { - const targetConstObject = {} as { foo?: string } | '1' - assertType<'1' | 'bar'>(fallbackNotObject(targetConstObject, 'bar')) +describe('fallback unknown types', () => { + test('should fallback to default value for unknown type value.', () => { + const target = 'string' as unknown + const result = fallbackObject(target, { foo: 'bar' }) + expectTypeOf(result).toEqualTypeOf>() }) - test('guard definite types 3', () => { - const targetConstObject = {} as { foo?: string } | Date | unknown[] - assertType<'bar'>(fallbackNotObject(targetConstObject, 'bar')) - }) - - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(fallbackNotObject(targetUnknown, 'bar')) + test('should strictly fallback to default value when type argument is set.', () => { + const target = {} as unknown + const result = fallbackObject>(target, { foo: 'bar' }) + expectTypeOf(result).toEqualTypeOf>() }) +}) - test('uncorrect fallback value', () => { - // @ts-expect-error - assertType(fallbackNotObject({}, { foo: 'bar' })) +describe('type error', () => { + test.skip('should result in a TypeScript type error when the type argument is not a object', () => { + // FIXME: error not occured. + // @ ts-expect-error + fallbackObject(123, 456) }) }) diff --git a/src/typeGuards/object/guard.spec-d.ts b/src/typeGuards/object/guard.spec-d.ts index f07e7f1..e046370 100644 --- a/src/typeGuards/object/guard.spec-d.ts +++ b/src/typeGuards/object/guard.spec-d.ts @@ -1,91 +1,68 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { isObject, isNotObject } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { isObject } from './guards' -describe('isObject type tests', () => { - test('guard definite types', () => { - const targetObject = {} as object | string - if (isObject(targetObject)) { - assertType(targetObject) +describe('guard definite types', () => { + test('should guard as object for object type values.', () => { + const target = {} as object | string + if (isObject(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetObject) + // object type includes Array, null, but isObject checkes truthy object. + expectTypeOf(target).toEqualTypeOf() } }) - test('guard definite types 2', () => { - const targetConstObject = {} as { foo?: string } | '1' - if (isObject(targetConstObject)) { - assertType<{ foo?: string }>(targetConstObject) + test('should strictly guard as object for strict object type values.', () => { + const target = {} as { foo?: string } | '1' + if (isObject(target)) { + expectTypeOf(target).toEqualTypeOf<{ foo?: string }>() } else { - assertType<'1'>(targetConstObject) + expectTypeOf(target).toEqualTypeOf<'1'>() } }) - test('guard definite types 3', () => { - const targetConstObject = {} as - | { foo?: string } + test('should strictly guard as object for union types.', () => { + const target = { foo: 'bar' } as + | { foo: string } | Date + | typeof String | unknown[] | null + | string | (() => void) | undefined - if (isObject(targetConstObject)) { - assertType<{ foo?: string } | Date | unknown[] | (() => void)>(targetConstObject) + if (isObject(target)) { + expectTypeOf(target).toEqualTypeOf<{ foo: string } | Date>() } else { - assertType(targetConstObject) - } - }) - - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isObject(targetUnknown)) { - assertType(targetUnknown) - } else { - assertType(targetUnknown) + expectTypeOf(target).toEqualTypeOf void) | typeof String>() } }) }) -describe('isNotObject type tests', () => { - test('guard definite types', () => { - const targetObject = {} as object | string - if (isNotObject(targetObject)) { - assertType(targetObject) - } else { - assertType(targetObject) - } - }) - - test('guard definite types 2', () => { - const targetConstObject = {} as { foo?: string } | '1' - if (isNotObject(targetConstObject)) { - assertType<'1'>(targetConstObject) +describe('guard unknown types', () => { + test('should guard as object for unknown type value.', () => { + const target = 'string' as unknown + if (isObject(target)) { + expectTypeOf(target).toEqualTypeOf>() } else { - assertType<{ foo?: string }>(targetConstObject) + expectTypeOf(target).toEqualTypeOf() } }) - test('guard definite types 3', () => { - const targetConstObject = {} as - | { foo?: string } - | Date - | unknown[] - | null - | (() => void) - | undefined - if (isNotObject(targetConstObject)) { - assertType(targetConstObject) + test('should strictly guard as object when type argument is set.', () => { + const target = {} as unknown + if (isObject>(target)) { + expectTypeOf(target).toEqualTypeOf>() } else { - assertType<{ foo?: string } | Date | unknown[] | (() => void)>(targetConstObject) + expectTypeOf(target).toEqualTypeOf() } }) +}) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isNotObject(targetUnknown)) { - assertType(targetUnknown) - } else { - assertType(targetUnknown) - } +describe('type errors', () => { + test.skip('should result in a TypeScript type error when the type argument is not a object', () => { + // FIXME: error not occured. + // @ ts-expect-error + isObject<3>(123) }) }) diff --git a/src/typeGuards/object/guards.spec.ts b/src/typeGuards/object/guards.spec.ts new file mode 100644 index 0000000..d69802a --- /dev/null +++ b/src/typeGuards/object/guards.spec.ts @@ -0,0 +1,71 @@ +import { describe } from 'vitest' +import { ValueType, testAssert, testEnsure, testFallback, testGuard } from '~/lib-test' +import { assertObject, ensureObject, fallbackObject, isObject } from './guards' + +const expected = [ + ValueType.BooleanObject, + ValueType.ObjectToPrimitiveBoolean, + ValueType.ObjectValueOfBoolean, + ValueType.ObjectToPrimitiveBigInt, + ValueType.ObjectValueOfBigInt, + ValueType.NumberObject, + ValueType.ObjectToPrimitiveNumber, + ValueType.ObjectValueOfNumber, + ValueType.StringObject, + ValueType.ObjectToPrimitiveString, + ValueType.ObjectValueOfString, + ValueType.ObjectToString, + ValueType.ObjectValueOfNull, + ValueType.ObjectToPrimitiveNull, + ValueType.ObjectToPrimitiveUndefined, + ValueType.ObjectValueOfUndefined, + ValueType.ArrayLike, + ValueType.ArrayBuffer, + ValueType.SharedArrayBuffer, + ValueType.DataView, + ValueType.EmptyDataView, + ValueType.Buffer, + ValueType.EmptyBuffer, + ValueType.Object, + ValueType.EmptyObject, + ValueType.BlankObject, + ValueType.RecursiveObject, + ValueType.WellKnownSymbolObject, + ValueType.IterableObject, + ValueType.AsyncIterableObject, + ValueType.RegExp, + ValueType.Proxy, + ValueType.Promise, + ValueType.ThenableObject, + ValueType.ThenableInstance, + ValueType.Awaited, + ValueType.Date, + ValueType.Error, + ValueType.ClassInstance, + ValueType.Map, + ValueType.EmptyMap, + ValueType.WeakMap, + ValueType.EmptyWeakMap, + ValueType.Set, + ValueType.EmptySet, + ValueType.WeakSet, + ValueType.EmptyWeakSet, + ValueType.ObjectToPrimitiveSymbol, + ValueType.ObjectValueOfSymbol, +] + +describe('isObject', () => { + testGuard(isObject, expected) +}) + +describe('assertObject', () => { + testAssert(assertObject, expected) +}) + +describe('ensureObject', () => { + testEnsure(ensureObject, expected) +}) + +describe('fallbackObject', () => { + testFallback(fallbackObject, expected, { fallbackValue: [{ foo: 'bar' }] }) +}) diff --git a/src/typeGuards/object/guards.ts b/src/typeGuards/object/guards.ts new file mode 100644 index 0000000..5503a5b --- /dev/null +++ b/src/typeGuards/object/guards.ts @@ -0,0 +1,124 @@ +import { + type TypeAssertOf, + type TypeEnsureOf, + type TypeErrorMessage, + type TypeFallbackOf, + type TypeGuard, + createAssertion, + createEnsure, + createFallback, + errorMessage, +} from '~/lib' + +// biome-ignore lint/complexity/noBannedTypes: +// biome-ignore lint/suspicious/noExplicitAny: +type AnyFunction = Function | ((...args: any[]) => any) + +// biome-ignore lint/suspicious/noExplicitAny: +type AnyArray = any[] | readonly any[] + +type DefinitelyObject = unknown extends T + ? Record + : Exclude, AnyFunction | AnyArray> extends infer R + ? R extends never + ? T extends object + ? Record + : never + : R + : never + +type NotObject = string | number | boolean | symbol | bigint | null | undefined | AnyFunction | AnyArray + +// biome-ignore lint/suspicious/noExplicitAny: +interface ObjectTypeGuard extends TypeGuard> { + (target: T | NotObject): target is DefinitelyObject & Exclude + + // biome-ignore lint/suspicious/noExplicitAny: + >(target: unknown): target is V +} + +interface ObjectTypeAssert extends TypeAssertOf { + (target: T | NotObject, message?: TypeErrorMessage): asserts target is DefinitelyObject & Exclude +} + +interface ObjectTypeEnsure extends TypeEnsureOf { + (target: T | NotObject, message?: TypeErrorMessage): DefinitelyObject & Exclude +} + +interface ObjectTypeFallback extends TypeFallbackOf { + (target: T | NotObject, defaultValue: F): + | (DefinitelyObject & Exclude) + | Exclude, T> +} + +/** + * Checks if a value is a object or a class instance. + * function, array, null, undefined, etc. are not considered Object. + * + * @param target The value to check. + * @returns True if the value is a object, false otherwise. + * @example + * ```ts + * const target = getTarget() // Object | string + * if (isObject(target)) { + * // target is Object + * } + * ``` + */ +export const isObject = ((target: unknown): boolean => + target !== null && !Array.isArray(target) && typeof target === 'object') as ObjectTypeGuard + +const date = new Date() as Date | { foo: string } | null | undefined | (() => void) | unknown[] +if (isObject(date)) { + date + // true +} + +/** + * Asserts that a value is a object or a class instance. + * function, array, null, undefined, etc. are not considered Object. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a object. + * @throws A TypeError with the given message if the value is not a object. + * @example + * ```ts + * const target = getTarget() // Object | string + * assertObject(target, 'target must be a object') + * // target is Object + * ``` + */ + +export const assertObject: ObjectTypeAssert = createAssertion(isObject, errorMessage('object')) + +/** + * Ensures that a value is a object or a class instance. + * function, array, null, undefined, etc. are not considered Object. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a object. + * @throws A TypeError with the given message if the value is not a object. + * @returns The value if it is a object. + * @example + * ```ts + * const target = getTarget() // Object | string + * const result = ensureObject(target, 'target must be a object') + * // result is Object + * ``` + */ +export const ensureObject: ObjectTypeEnsure = createEnsure(isObject, errorMessage('object')) + +/** + * Fallbacks to a default value if the value is not a object or a class instance. + * function, array, null, undefined, etc. are not considered Object. + * + * @param target The value to check. + * @param defaultValue The default value to fallback to. + * @example + * ```ts + * const target = getTarget() // Object | string + * const result = fallbackObject(target, ['default']) + * // result is Object | string + * ``` + */ +export const fallbackObject: ObjectTypeFallback = createFallback(isObject) diff --git a/src/typeGuards/object/index.spec.ts b/src/typeGuards/object/index.spec.ts deleted file mode 100644 index 68646c7..0000000 --- a/src/typeGuards/object/index.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { describe } from 'vitest' -import expected from 'lodash/isObject.js' -import { - assertNotObject, - assertObject, - ensureNotObject, - ensureObject, - fallbackNotObject, - fallbackObject, - isObject, - isNotObject -} from '.' -import { testAssert, testEnsure, testFallback, testGuard } from '../../lib/test' - -describe('isObject', () => { - testGuard(isObject, expected) -}) - -describe('assertObject', () => { - testAssert(assertObject, expected) -}) - -describe('ensureObject', () => { - testEnsure(ensureObject, expected) -}) - -describe('fallbackObject', () => { - testFallback(fallbackObject, expected, { fallbackValue: [{ foo: 'bar' }] }) -}) - -describe('isNotObject', () => { - testGuard(isNotObject, expected, { negative: true }) -}) - -describe('assertNotObject', () => { - testAssert(assertNotObject, expected, { negative: true }) -}) - -describe('ensureNotObject', () => { - testEnsure(ensureNotObject, expected, { negative: true }) -}) - -describe('fallbackNotObject', () => { - testFallback(fallbackNotObject, expected, { negative: true, fallbackValue: 'fallback' }) -}) diff --git a/src/typeGuards/object/index.ts b/src/typeGuards/object/index.ts index a2d4b47..2bfb9a1 100644 --- a/src/typeGuards/object/index.ts +++ b/src/typeGuards/object/index.ts @@ -1,138 +1 @@ -import { createAssertion, createEnsure, createFallback, not } from '../../lib/factory' -import { - InvertedTypeAssertOf, - InvertedTypeEnsureOf, - InvertedTypeFallbackOf, - TypeAssertOf, - TypeEnsureOf, - TypeFallbackOf, - TypeGuard -} from '../../lib/type' -import { errorMessage } from '../../lib/error' - -/** - * Checks if a value is an Object (excluding null, arrays, functions, and undefined). - * @param target The value to check. - * @returns True if the value is an Object, false otherwise. - * @example - * ```ts - * const target = getTarget() // Object | string - * if (isObject(target)) { - * // target is Object - * } - * ``` - */ -export const isObject = (>(target: unknown): target is T => { - const type = typeof target - return target !== null && ['object', 'function'].includes(type) -}) as TypeGuard - -type IsObject = typeof isObject - -/** - * Asserts that a value is an Object. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is not an Object. - * @throws A TypeError with the given message if the value is not an Object. - * @example - * ```ts - * const target = getTarget() // Object | string - * assertObject(target, 'target must be an Object') - * // target is Object - * ``` - */ - -export const assertObject: TypeAssertOf = createAssertion( - isObject, - errorMessage('object') -) - -/** - * Ensures that a value is an Object. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is not an Object. - * @throws A TypeError with the given message if the value is not an Object. - * @returns The value if it is an Object. - * @example - * ```ts - * const target = getTarget() // Object | string - * const result = ensureObject(target, 'target must be an Object') - * // result is Object - * ``` - */ -export const ensureObject: TypeEnsureOf = createEnsure(isObject, errorMessage('object')) - -/** - * Fallbacks to a default value if the value is not an Object. - * @param target The value to check. - * @param defaultValue The default value to fallback to. - * @example - * ```ts - * const target = getTarget() // Object | string - * const result = fallbackObject(target, ['default']) - * // result is Object | string - * ``` - */ -export const fallbackObject: TypeFallbackOf = createFallback(isObject) - -/** - * Checks if a value is not an Object. - * - * In an if statement, it is simpler to use ! operator is simpler, - * but this method is useful in cases where the argument is a type guard function, such as Array.prototype.filter. - * @param target The value to check. - * @returns True if the value is not an Object, false otherwise. - * @example - * ```ts - * const targets = getTargets() // Array - * const result = targets.filter(isNotObject) - * // result is string[] - * ``` - */ -export const isNotObject = not(isObject) - -/** - * Asserts that a value is not an Object. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is an Object. - * @throws A TypeError with the given message if the value is an Object. - * @example - * ```ts - * const target = getTarget() // string | Object - * assertNotObject(target, 'target must not be an Object') - * // target is string - * ``` - */ -export const assertNotObject: InvertedTypeAssertOf = createAssertion( - not(isObject), - errorMessage('object', { not: true }) -) - -/** - * Enxures that a value is not an Object. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is an Object. - * @throws A TypeError with the given message if the value is an Object. - * @returns The value if it is not an Object. - * @example - * ```ts - * const target = getTarget() // string | Object - * const result = ensureNotObject(target, 'target must not be an Object') - * // result is string - * ``` - */ -export const ensureNotObject: InvertedTypeEnsureOf = createEnsure(not(isObject), errorMessage('object', { not: true })) - -/** - * Fallbacks to a default value if the value is not an Object. - * @param target The value to check. - * @param defaultValue The default value to fallback to. - * @return The value if it is not an Object, the default value otherwise. - * @example - * ```ts - * const target = getTarget() // string | Object - * const result = fallbackNotObject(target, 'default') - * // result is string - * ``` - */ -export const fallbackNotObject: InvertedTypeFallbackOf = createFallback(not(isObject)) +export * from './guards' diff --git a/src/typeGuards/promise/assert.spec-d.ts b/src/typeGuards/promise/assert.spec-d.ts new file mode 100644 index 0000000..861e240 --- /dev/null +++ b/src/typeGuards/promise/assert.spec-d.ts @@ -0,0 +1,47 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { assertPromise } from './guards' + +describe('assert definite types', () => { + test('should assert as Promise for Promise type values.', () => { + const target = Promise.resolve() as Promise | void + assertPromise(target) + expectTypeOf(target).toEqualTypeOf>() + }) + + test('should strictly assert as Promise for Extended Promise type values.', () => { + type ExtendedPromise = Promise & { extra: string } + const target = Promise.resolve() as ExtendedPromise | void + assertPromise(target) + expectTypeOf(target).toEqualTypeOf>() + }) + + test('should strictly assert as Promise for union type values.', () => { + const target = Promise.resolve() as unknown as Promise | string | number + assertPromise(target) + expectTypeOf(target).toEqualTypeOf>() + }) +}) + +describe('assert unknown types', () => { + test('assert unknown types', () => { + const target = Promise.resolve() as unknown + assertPromise(target) + expectTypeOf(target).toEqualTypeOf>() + }) + + test('should strictly assert as Promise when type argument is set.', () => { + const target = Promise.resolve() as unknown + assertPromise>(target) + expectTypeOf(target).toEqualTypeOf>() + }) +}) + +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a Promise', () => { + assertPromise( + // + Promise.resolve(), + ) + }) +}) diff --git a/src/typeGuards/promise/ensure.spec-d.ts b/src/typeGuards/promise/ensure.spec-d.ts new file mode 100644 index 0000000..e867e1d --- /dev/null +++ b/src/typeGuards/promise/ensure.spec-d.ts @@ -0,0 +1,44 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { ensurePromise } from './guards' + +describe('ensure definite types', () => { + test('should ensure as Promise for Promise type values.', () => { + const target = Promise.resolve() as Promise | void + const result = ensurePromise(target) + expectTypeOf(result).toEqualTypeOf>() + }) + + test('should strictly ensure as Promise for Extended Promise type values.', () => { + type ExtendedPromise = Promise & { extra: string } + const target = Promise.resolve() as ExtendedPromise | void + const result = ensurePromise(target) + expectTypeOf(result).toEqualTypeOf>() + }) + + test('should strictly ensure as Promise for union types.', () => { + const target = Promise.resolve() as unknown as Promise | string | number + const result = ensurePromise(target) + expectTypeOf(result).toEqualTypeOf>() + }) +}) + +describe('ensure unknown types', () => { + test('should ensure as Promise for unknown type value.', () => { + const target = Promise.resolve() as unknown + const result = ensurePromise(target) + expectTypeOf(result).toEqualTypeOf>() + }) + + test('should strictly ensure as Promise when type argument is set.', () => { + const target = Promise.resolve() as unknown + const result = ensurePromise>(target) + expectTypeOf(result).toEqualTypeOf>() + }) +}) + +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a Promise', () => { + ensurePromise(Promise.resolve()) + }) +}) diff --git a/src/typeGuards/promise/fallback.spec-d.ts b/src/typeGuards/promise/fallback.spec-d.ts new file mode 100644 index 0000000..809d88b --- /dev/null +++ b/src/typeGuards/promise/fallback.spec-d.ts @@ -0,0 +1,98 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { fallbackPromise } from './guards' + +describe('fallback definite types', () => { + test('should fallback as Promise for Promise type values.', async () => { + const target = Promise.resolve('return') as Promise | string + const result = fallbackPromise(target, Promise.resolve('fallback')) + expectTypeOf(result).toEqualTypeOf>() + + const awaitedResult = await result + expectTypeOf(awaitedResult).toEqualTypeOf() + }) + + test('should strictly fallback as Promise for union type values. (Promise | Promise)', async () => { + const target = Promise.resolve('return') as Promise | string + const result = fallbackPromise(target, Promise.resolve(3)) + expectTypeOf(result).toEqualTypeOf | Promise>() + + const awaitedResult = await result + expectTypeOf(awaitedResult).toEqualTypeOf() + }) + + test('should strictly fallback as Promise for union type values. (Promise)', async () => { + const target = Promise.resolve(3) as Promise | string | number + const result = fallbackPromise(target, Promise.resolve('fallback' as const)) + expectTypeOf(result).toEqualTypeOf | Promise<'fallback'>>() + + const awaitedResult = await result + expectTypeOf(awaitedResult).toEqualTypeOf() + }) + + test('should strictly fallback as Promise for union type values. (Promise)', async () => { + type Type = 'foo' | 'bar' + const target = Promise.resolve('foo') as Promise | Type + const result = fallbackPromise>(target, Promise.resolve('bar')) + expectTypeOf(result).toEqualTypeOf>() + + const awaitedResult = await result + expectTypeOf(awaitedResult).toEqualTypeOf() + }) + + test('should strictly fallback as Promise for Extended Promise type values.', async () => { + type ExtendedPromise = Promise & { extra: string } + const target = Promise.resolve('return') as ExtendedPromise | string + const result = fallbackPromise(target, Promise.resolve('fallback') as ExtendedPromise) + expectTypeOf(result).toEqualTypeOf>() + + const awaitedResult = await result + expectTypeOf(awaitedResult).toEqualTypeOf() + }) +}) + +describe('fallback unknown types', () => { + test('should fallback as Promise for unknown type value.', async () => { + const target = 'string' as unknown + const result = fallbackPromise(target, Promise.resolve('fallback')) + expectTypeOf(result).toEqualTypeOf | Promise>() + + const awaitedResult = await result + expectTypeOf(awaitedResult).toEqualTypeOf() + }) +}) + +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a Promise', () => { + fallbackPromise( + // + 'string', + Promise.resolve('fallback'), + ) + }) + + test('should result in a TypeScript type error when the type argument not match the fallback value.', () => { + type Type = 'foo' | 'bar' + fallbackPromise>( + Promise.resolve('foo'), + // @ts-expect-error + Promise.resolve('baz'), + ) + }) + + test('should result in a TypeScript type error when the fallback value is unknown type.', () => { + fallbackPromise( + Promise.resolve('return'), + // @ts-expect-error + 'fallback' as unknown, + ) + }) + + test('should result in a TypeScript type error when the fallback value is not a Promise.', () => { + fallbackPromise( + Promise.resolve('return'), + // @ts-expect-error + 'return', + ) + }) +}) diff --git a/src/typeGuards/promise/guard.spec-d.ts b/src/typeGuards/promise/guard.spec-d.ts new file mode 100644 index 0000000..569e596 --- /dev/null +++ b/src/typeGuards/promise/guard.spec-d.ts @@ -0,0 +1,64 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { isPromise } from './guards' + +describe('guard definite types', () => { + test('should guard as Promise for Promise type values.', () => { + const target = Promise.resolve() as Promise | void + if (isPromise(target)) { + expectTypeOf(target).toEqualTypeOf>() + } else { + // biome-ignore lint/suspicious/noConfusingVoidType: + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as Promise for Extended Promise type values.', () => { + type ExtendedPromise = Promise & { extra: string } + const target = Promise.resolve() as ExtendedPromise | void + if (isPromise(target)) { + expectTypeOf(target).toEqualTypeOf>() + } else { + // biome-ignore lint/suspicious/noConfusingVoidType: + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as Promise for union types.', () => { + const target = Promise.resolve() as unknown as Promise | string | number + if (isPromise(target)) { + expectTypeOf(target).toEqualTypeOf>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('guard unknown types', () => { + test('should guard as Promise for unknown type value.', () => { + const target = 'string' as unknown + if (isPromise(target)) { + expectTypeOf(target).toEqualTypeOf>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as Promise when type argument is set.', () => { + const target = Promise.resolve() as unknown + if (isPromise>(target)) { + expectTypeOf(target).toEqualTypeOf>() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a Promise', () => { + isPromise( + // + Promise.resolve(), + ) + }) +}) diff --git a/src/typeGuards/promise/guards.spec.ts b/src/typeGuards/promise/guards.spec.ts new file mode 100644 index 0000000..857ba9a --- /dev/null +++ b/src/typeGuards/promise/guards.spec.ts @@ -0,0 +1,21 @@ +import { describe } from 'vitest' +import { ValueType, testAssert, testEnsure, testFallback, testGuard } from '~/lib-test' +import { assertPromise, ensurePromise, fallbackPromise, isPromise } from './guards' + +const expectedValueTypes = [ValueType.Promise, ValueType.Awaited] + +describe('isPromise', () => { + testGuard(isPromise, expectedValueTypes) +}) + +describe('assertPromise', () => { + testAssert(assertPromise, expectedValueTypes) +}) + +describe('ensurePromise', () => { + testEnsure(ensurePromise, expectedValueTypes) +}) + +describe('fallbackPromise', () => { + testFallback(fallbackPromise, expectedValueTypes, { fallbackValue: Promise.resolve() }) +}) diff --git a/src/typeGuards/promise/guards.ts b/src/typeGuards/promise/guards.ts new file mode 100644 index 0000000..82c6d4e --- /dev/null +++ b/src/typeGuards/promise/guards.ts @@ -0,0 +1,75 @@ +import { + type TypeAssertOf, + type TypeEnsureOf, + type TypeFallbackOf, + type TypeGuard, + createAssertion, + createEnsure, + createFallback, + errorMessage, +} from '~/lib' + +/** + * Checks if a value is a Promise. (excluding PromiseLike) + * + * @param target The value to check. + * @returns True if the value is a Promise, false otherwise. + * @example + * ```ts + * const target = getTarget() // Promise | string + * if (isPromise(target)) { + * // target is Promise + * } + * ``` + */ +export const isPromise = ((target: unknown): target is Promise => { + return target instanceof Promise +}) as TypeGuard> + +type IsPromise = typeof isPromise + +/** + * Asserts that a value is a Promise. (excluding PromiseLike) + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a Promise. + * @throws A TypeError with the given message if the value is not a Promise. + * @example + * ```ts + * const target = getTarget() // Promise | string + * assertPromise(target, 'target must be a Promise') + * // target is Promise + * ``` + */ + +export const assertPromise: TypeAssertOf = createAssertion(isPromise, errorMessage('promise')) + +/** + * Ensures that a value is a Promise. (excluding PromiseLike) + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a Promise. + * @throws A TypeError with the given message if the value is not a Promise. + * @returns The value if it is a Promise. + * @example + * ```ts + * const target = getTarget() // Promise | string + * const result = ensurePromise(target, 'target must be a Promise') + * // result is Promise + * ``` + */ +export const ensurePromise: TypeEnsureOf = createEnsure(isPromise, errorMessage('promise')) + +/** + * Fallbacks to a default value if the value is not a Promise. (excluding PromiseLike) + * + * @param target The value to check. + * @param defaultValue The default value to fallback to. + * @example + * ```ts + * const target = getTarget() // Promise | string + * const result = fallbackPromise(target, ['default']) + * // result is Promise | string + * ``` + */ +export const fallbackPromise: TypeFallbackOf = createFallback(isPromise) diff --git a/src/typeGuards/promise/index.ts b/src/typeGuards/promise/index.ts new file mode 100644 index 0000000..2bfb9a1 --- /dev/null +++ b/src/typeGuards/promise/index.ts @@ -0,0 +1 @@ +export * from './guards' diff --git a/src/typeGuards/string/assert.spec-d.ts b/src/typeGuards/string/assert.spec-d.ts index 5c9e21b..793817a 100644 --- a/src/typeGuards/string/assert.spec-d.ts +++ b/src/typeGuards/string/assert.spec-d.ts @@ -1,55 +1,53 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { assertString, assertNotString } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { assertString } from './guards' -describe('assertString type tests', () => { - test('guard definite types', () => { - const targetString = 'string' as string | object - assertString(targetString) - assertType(targetString) +describe('assert definite types', () => { + test('should assert as string for string type values.', () => { + const target = 'string' as string | object + assertString(target) + expectTypeOf(target).toEqualTypeOf() }) - test('guard definite types 2', () => { - const targetConstString = 'string' as 'string' | object - assertString(targetConstString) - assertType<'string'>(targetConstString) + test('should strictly assert as string for string literal types.', () => { + const target = 'string' as 'string' | object + assertString(target) + expectTypeOf(target).toEqualTypeOf<'string'>() }) - test('guard definite types 3', () => { - const targetConstString = '3' as `${number}` | number - assertString(targetConstString) - assertType<`${number}`>(targetConstString) + test('should strictly assert as string for dynamic string literal types.', () => { + const target = '3' as `${number}` | number + assertString(target) + expectTypeOf(target).toEqualTypeOf<`${number}`>() }) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertString(targetUnknown) - assertType(targetUnknown) + test('should strictly assert as string for Branded string type', () => { + type BrandedString = string & { __brand: 'branded' } + const target = 'string' as BrandedString | object + assertString(target) + expectTypeOf(target).toEqualTypeOf() }) }) -describe('assertNotString type tests', () => { - test('guard definite types', () => { - const targetString = 'string' as string | object - assertNotString(targetString) - assertType(targetString) +describe('assert unknown types', () => { + test('should assert as string for unknown type value.', () => { + const target = 'string' as unknown + assertString(target) + expectTypeOf(target).toEqualTypeOf() }) - test('guard definite types 2', () => { - const targetConstString = 'string' as 'string' | object - assertNotString(targetConstString) - assertType(targetConstString) - }) - - test('guard definite types 3', () => { - const targetConstString = '3' as `${number}` | number - assertNotString(targetConstString) - assertType(targetConstString) + test('should strictly assert as string when type argument is set.', () => { + const target = 'string' as unknown + assertString<'string'>(target) + expectTypeOf(target).toEqualTypeOf<'string'>() }) +}) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertNotString(targetUnknown) - assertType(targetUnknown) +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a string', () => { + assertString( + // + 'string', + ) }) }) diff --git a/src/typeGuards/string/ensure.spec-d.ts b/src/typeGuards/string/ensure.spec-d.ts index 378dba1..ec609c4 100644 --- a/src/typeGuards/string/ensure.spec-d.ts +++ b/src/typeGuards/string/ensure.spec-d.ts @@ -1,47 +1,53 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { ensureString, ensureNotString } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { ensureString } from './guards' -describe('ensureString type tests', () => { - test('guard definite types', () => { - const targetString = 'string' as string | object - assertType(ensureString(targetString)) +describe('ensure definite types', () => { + test('should ensure as string for string type values.', () => { + const target = 'string' as string | object + const result = ensureString(target) + expectTypeOf(result).toEqualTypeOf() }) - test('guard definite types 2', () => { - const targetConstString = 'string' as 'string' | object - assertType<'string'>(ensureString(targetConstString)) + test('should strictly ensure as string for string literal types.', () => { + const target = 'string' as 'string' | object + const result = ensureString(target) + expectTypeOf(result).toEqualTypeOf<'string'>() }) - test('guard definite types 3', () => { - const targetConstString = '3' as `${number}` | number - assertType<`${number}`>(ensureString(targetConstString)) + test('should strictly ensure as string for dynamic string literal types.', () => { + const target = '3' as `${number}` | number + const result = ensureString(target) + expectTypeOf(result).toEqualTypeOf<`${number}`>() }) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(ensureString(targetUnknown)) + test('should strictly ensure as string for Branded string type', () => { + type BrandedString = string & { __brand: 'branded' } + const target = 'string' as BrandedString | object + const result = ensureString(target) + expectTypeOf(result).toEqualTypeOf() }) }) -describe('ensureNotString type tests', () => { - test('guard definite types', () => { - const targetString = 'string' as string | object - assertType(ensureNotString(targetString)) +describe('ensure unknown types', () => { + test('should ensure as string for unknown type value.', () => { + const target = 'string' as unknown + const result = ensureString(target) + expectTypeOf(result).toEqualTypeOf() }) - test('guard definite types 2', () => { - const targetConstString = 'string' as 'string' | object - assertType(ensureNotString(targetConstString)) - }) - - test('guard definite types 3', () => { - const targetConstString = '3' as `${number}` | number - assertType(ensureNotString(targetConstString)) + test('should strictly ensure as string when type argument is set.', () => { + const target = 'string' as unknown + const result = ensureString<'foo'>(target) + expectTypeOf(result).toEqualTypeOf<'foo'>() }) +}) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(ensureNotString(targetUnknown)) +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a string', () => { + ensureString( + // + 'string', + ) }) }) diff --git a/src/typeGuards/string/fallback.spec-d.ts b/src/typeGuards/string/fallback.spec-d.ts index ba05fc9..0e98bbe 100644 --- a/src/typeGuards/string/fallback.spec-d.ts +++ b/src/typeGuards/string/fallback.spec-d.ts @@ -1,52 +1,79 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { fallbackString, fallbackNotString } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { fallbackString } from './guards' -describe('fallbackString type tests', () => { - test('guard definite types', () => { - const targetString = 'string' as string | object - assertType(fallbackString(targetString, 'fallback')) +describe('fallback definite types', () => { + test('should fallback as string for string type values.', () => { + const target = 'string' as string | object + const result = fallbackString(target, 'fallback') + expectTypeOf(result).toEqualTypeOf() }) - test('guard definite types 2', () => { - const targetConstString = 'string' as 'string' | object - assertType<'string' | 'fallback'>(fallbackString(targetConstString, 'fallback')) + test('should strictly fallback as string for string literal types.', () => { + const target = 'string' as 'string' | object + const result = fallbackString(target, 'fallback') + expectTypeOf(result).toEqualTypeOf<'string' | 'fallback'>() }) - test('guard definite types 3', () => { - const targetConstString = '3' as `${number}` | number - assertType<`${number}`>(fallbackString(targetConstString, '3')) + test('should strictly fallback as string for dynamic string literal types.', () => { + const target = '3' as `${number}` | number + const result = fallbackString(target, '3') + expectTypeOf(result).toEqualTypeOf<`${number}`>() }) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(fallbackString(targetUnknown, 'fallback')) + test('should strictly fallback as string for Branded string type', () => { + type BrandedString = string & { __brand: 'branded' } + const target = 'string' as BrandedString | object + const result = fallbackString(target, 'fallback') + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('fallback unknown types', () => { + test('should fallback as string for unknown type value.', () => { + const target = 'string' as unknown + const result = fallbackString(target, 'fallback') + expectTypeOf(result).toEqualTypeOf() }) - test('uncorrect fallback type', () => { - // @ts-expect-error - fallbackString('string', 3) + test('should strictly fallback as string when type argument is set.', () => { + type Type = 'foo' | 'bar' + const target = 'string' as unknown + const result = fallbackString(target, 'bar') + expectTypeOf(result).toEqualTypeOf() }) }) -describe('fallbackNotString type tests', () => { - test('guard definite types', () => { - const targetString = 'string' as string | object - assertType(fallbackNotString(targetString, { foo: 'bar' })) +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a string', () => { + fallbackString( + // + 'string', + 'fallback', + ) }) - test('guard definite types 2', () => { - const targetConstString = 'string' as 'string' | 3 - assertType<3 | 5>(fallbackNotString(targetConstString, 5)) + test('should result in a TypeScript type error when the type argument not match the fallback value.', () => { + fallbackString<'foo'>( + 'foo', + // @ts-expect-error + 'bar', + ) }) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - assertType(fallbackNotString(targetUnknown, 3)) + test('should result in a TypeScript type error when the fallback value is unknown type.', () => { + fallbackString( + 'string', + // @ts-expect-error + 'fallback' as unknown, + ) }) - test('uncorrect fallback type', () => { - // @ts-expect-error - fallbackNotString('string', 'fallback') + test('should result in a TypeScript type error when the fallback value is not a string.', () => { + fallbackString( + 'string', + // @ts-expect-error + 3, + ) }) }) diff --git a/src/typeGuards/string/guard.spec-d.ts b/src/typeGuards/string/guard.spec-d.ts index 115cedd..c2d14d5 100644 --- a/src/typeGuards/string/guard.spec-d.ts +++ b/src/typeGuards/string/guard.spec-d.ts @@ -1,79 +1,68 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import { test, describe, assertType } from 'vitest' -import { isString, isNotString } from '.' +import { describe, expectTypeOf, test } from 'vitest' +import { isString } from './guards' -describe('isString type tests', () => { - test('guard definite types', () => { - const targetString = 'string' as string | object - if (isString(targetString)) { - assertType(targetString) +describe('guard definite types', () => { + test('should guard as string for string type values.', () => { + const target = 'string' as string | object + if (isString(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetString) + expectTypeOf(target).toEqualTypeOf() } }) - test('guard definite types 2', () => { - const targetConstString = 'string' as 'string' | object - if (isString(targetConstString)) { - assertType<'string'>(targetConstString) + test('should strictly guard as string for string literal types.', () => { + const target = 'string' as 'string' | object + if (isString(target)) { + expectTypeOf(target).toEqualTypeOf<'string'>() } else { - assertType(targetConstString) + expectTypeOf(target).toEqualTypeOf() } }) - test('guard definite types 3', () => { - const targetConstString = '3' as `${number}` | number - if (isString(targetConstString)) { - assertType<`${number}`>(targetConstString) + test('should strictly guard as string for dynamic string literal types.', () => { + const target = '3' as `${number}` | number + if (isString(target)) { + expectTypeOf(target).toEqualTypeOf<`${number}`>() } else { - assertType(targetConstString) + expectTypeOf(target).toEqualTypeOf() } }) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isString(targetUnknown)) { - assertType(targetUnknown) + test('should strictly guard as string for Branded string type', () => { + type BrandedString = string & { __brand: 'branded' } + const target = 'string' as BrandedString | object + if (isString(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetUnknown) + expectTypeOf(target).toEqualTypeOf() } }) }) -describe('isNotString type tests', () => { - test('guard definite types', () => { - const targetString = 'string' as string | object - if (isNotString(targetString)) { - assertType(targetString) +describe('guard unknown types', () => { + test('should guard as string for unknown type value.', () => { + const target = 'string' as unknown + if (isString(target)) { + expectTypeOf(target).toEqualTypeOf() } else { - assertType(targetString) + expectTypeOf(target).toEqualTypeOf() } }) - test('guard definite types 2', () => { - const targetConstString = 'string' as 'string' | object - if (isNotString(targetConstString)) { - assertType(targetConstString) + test('should strictly guard as string when type argument is set.', () => { + const target = 'string' as unknown + if (isString<'string'>(target)) { + expectTypeOf(target).toEqualTypeOf<'string'>() } else { - assertType<'string'>(targetConstString) - } - }) - - test('guard definite types 3', () => { - const targetConstString = '3' as `${number}` | number - if (isNotString(targetConstString)) { - assertType(targetConstString) - } else { - assertType<`${number}`>(targetConstString) + expectTypeOf(target).toEqualTypeOf() } }) +}) - test('guard unknown types', () => { - const targetUnknown = 'string' as unknown - if (isNotString(targetUnknown)) { - assertType(targetUnknown) - } else { - assertType(targetUnknown) - } +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a string', () => { + isString('string') }) }) diff --git a/src/typeGuards/string/guards.spec.ts b/src/typeGuards/string/guards.spec.ts new file mode 100644 index 0000000..8ffed18 --- /dev/null +++ b/src/typeGuards/string/guards.spec.ts @@ -0,0 +1,21 @@ +import { describe } from 'vitest' +import { ValueType, testAssert, testEnsure, testFallback, testGuard } from '~/lib-test' +import { assertString, ensureString, fallbackString, isString } from './guards' + +const expected = [ValueType.String, ValueType.EmptyString, ValueType.NumberStringLeadingZero] + +describe('isString', () => { + testGuard(isString, expected) +}) + +describe('assertString', () => { + testAssert(assertString, expected) +}) + +describe('ensureString', () => { + testEnsure(ensureString, expected) +}) + +describe('fallbackString', () => { + testFallback(fallbackString, expected, { fallbackValue: 'fallback' }) +}) diff --git a/src/typeGuards/string/guards.ts b/src/typeGuards/string/guards.ts new file mode 100644 index 0000000..9b612e7 --- /dev/null +++ b/src/typeGuards/string/guards.ts @@ -0,0 +1,73 @@ +import { + type TypeAssertOf, + type TypeEnsureOf, + type TypeFallbackOf, + type TypeGuard, + createAssertion, + createEnsure, + createFallback, + errorMessage, +} from '~/lib' + +/** + * Checks if a value is a string. + * + * @param target The value to check. + * @returns True if the value is a string, false otherwise. + * @example + * ```ts + * const target = getTarget() // string | number + * if (isString(target)) { + * // target is string + * } + * ``` + */ +export const isString = ((target: unknown) => typeof target === 'string') as TypeGuard + +type IsString = typeof isString + +/** + * Asserts that a value is a string. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a string. + * @throws A TypeError with the given message if the value is not a string. + * @example + * ```ts + * const target = getTarget() // string | number + * assertString(target, 'target must be a string') + * // target is string + * ``` + */ +export const assertString: TypeAssertOf = createAssertion(isString, errorMessage('string')) + +/** + * Ensures that a value is a string. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a string. + * @throws A TypeError with the given message if the value is not a string. + * @returns The value if it is a string. + * @example + * ```ts + * const target = getTarget() // string | number + * const result = ensureString(target, 'target must be a string') + * // result is string + * ``` + */ +export const ensureString: TypeEnsureOf = createEnsure(isString, errorMessage('string')) + +/** + * Returns a fallback value if a value is not a string. + * + * @param target The value to check. + * @param fallback The fallback value to return if the value is not a string. + * @returns The value if it is a string, or the fallback value if it is not a string. + * @example + * ```ts + * const target = getTarget() // string | number + * const result = fallbackString(target, 'fallback') + * // result is string | 'fallback' + * ``` + */ +export const fallbackString: TypeFallbackOf = createFallback(isString) diff --git a/src/typeGuards/string/index.spec.ts b/src/typeGuards/string/index.spec.ts deleted file mode 100644 index e284221..0000000 --- a/src/typeGuards/string/index.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { describe } from 'vitest' -import expected from 'lodash/isString.js' -import { - assertNotString, - assertString, - ensureNotString, - ensureString, - fallbackNotString, - fallbackString, - isString, - isNotString -} from '.' -import { testAssert, testEnsure, testFallback, testGuard } from '../../lib/test' - -describe('isString', () => { - testGuard(isString, expected) -}) - -describe('assertString', () => { - testAssert(assertString, expected) -}) - -describe('ensureString', () => { - testEnsure(ensureString, expected) -}) - -describe('fallbackString', () => { - testFallback(fallbackString, expected, { fallbackValue: 'fallback' }) -}) - -describe('isNotString', () => { - testGuard(isNotString, expected, { negative: true }) -}) - -describe('assertNotString', () => { - testAssert(assertNotString, expected, { negative: true }) -}) - -describe('ensureNotString', () => { - testEnsure(ensureNotString, expected, { negative: true }) -}) - -describe('fallbackNotString', () => { - testFallback(fallbackNotString, expected, { negative: true, fallbackValue: 123 }) -}) diff --git a/src/typeGuards/string/index.ts b/src/typeGuards/string/index.ts index a9627d8..2bfb9a1 100644 --- a/src/typeGuards/string/index.ts +++ b/src/typeGuards/string/index.ts @@ -1,136 +1 @@ -import { errorMessage } from '../../lib/error' -import { createAssertion, createEnsure, createFallback, not } from '../../lib/factory' -import { - InvertedTypeAssertOf, - InvertedTypeEnsureOf, - InvertedTypeFallbackOf, - TypeAssertOf, - TypeEnsureOf, - TypeFallbackOf, - TypeGuard -} from '../../lib/type' - -/** - * Checks if a value is a string. - * @param target The value to check. - * @returns True if the value is a string, false otherwise. - * @example - * ```ts - * const target = getTarget() // string | number - * if (isString(target)) { - * // target is string - * } - * ``` - */ -export const isString = ((target: unknown): target is string => - typeof target === 'string') as TypeGuard - -type IsString = typeof isString - -/** - * Asserts that a value is a string. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is not a string. - * @throws A TypeError with the given message if the value is not a string. - * @example - * ```ts - * const target = getTarget() // string | number - * assertString(target, 'target must be a string') - * // target is string - * ``` - */ -export const assertString: TypeAssertOf = createAssertion( - isString, - errorMessage('string') -) - -/** - * Ensures that a value is a string. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is not a string. - * @throws A TypeError with the given message if the value is not a string. - * @returns The value if it is a string. - * @example - * ```ts - * const target = getTarget() // string | number - * const result = ensureString(target, 'target must be a string') - * // result is string - * ``` - */ -export const ensureString: TypeEnsureOf = createEnsure(isString, errorMessage('string')) - -/** - * Returns a fallback value if a value is not a string. - * @param target The value to check. - * @param fallback The fallback value to return if the value is not a string. - * @returns The value if it is a string, or the fallback value if it is not a string. - * @example - * ```ts - * const target = getTarget() // string | number - * const result = fallbackString(target, 'fallback') - * // result is string | 'fallback' - * ``` - */ -export const fallbackString: TypeFallbackOf = createFallback(isString) - -/** - * Checks if a value is not a string. - * - * In an if statement, it is simpler to use ! operator is simpler, - * but this method is useful in cases where the argument is a type guard function, such as Array.prototype.filter. - * @param target The value to check. - * @returns True if the value is not a string, false otherwise. - * @example - * ```ts - * const targets = getTargets() // Array - * const result = targets.filter(isNotString) - * // result is number[] - * ``` - */ -export const isNotString = not(isString) - -/** - * Asserts that a value is not a string. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is a string. - * @throws A TypeError with the given message if the value is a string. - * @example - * ```ts - * const target = getTarget() // string | number - * assertNotString(target, 'target must not be a string') - * // target is number - * ``` - */ -export const assertNotString: InvertedTypeAssertOf = createAssertion( - not(isString), - errorMessage('string', { not: true }) -) - -/** - * Ensures that a value is not a string. - * @param target The value to check. - * @param message (optional) The error message to throw if the value is a string. - * @throws A TypeError with the given message if the value is a string. - * @returns The value if it is not a string. - * @example - * ```ts - * const target = getTarget() // string | number - * const result = ensureNotString(target, 'target must not be a string') - * // result is number - * ``` - */ -export const ensureNotString: InvertedTypeEnsureOf = createEnsure(not(isString), errorMessage('string', { not: true })) - -/** - * Returns a fallback value if a value is a string. - * @param target The value to check. - * @param fallback The fallback value to return if the value is a string. - * @returns The value if it is not a string, or the fallback value if it is a string. - * @example - * ```ts - * const target = getTarget() // string | number - * const result = fallbackNotString(target, -1) - * // result is number | -1 - * ``` - */ -export const fallbackNotString: InvertedTypeFallbackOf = createFallback(not(isString)) +export * from './guards' diff --git a/src/typeGuards/symbol/assert.spec-d.ts b/src/typeGuards/symbol/assert.spec-d.ts new file mode 100644 index 0000000..1989f70 --- /dev/null +++ b/src/typeGuards/symbol/assert.spec-d.ts @@ -0,0 +1,56 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { assertSymbol } from './guards' + +describe('assert definite types', () => { + test('should assert as symbol for symbol type values.', () => { + const target = Symbol() as symbol | string + assertSymbol(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as symbol for unique symbol type values.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + const uniqueSymbol2: unique symbol = Symbol('target') + type UniqueSymbol = typeof uniqueSymbol + type UniqueSymbol2 = typeof uniqueSymbol2 + const target = uniqueSymbol as UniqueSymbol | UniqueSymbol2 | string + assertSymbol(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as symbol for extended symbol type values.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + type SuperSymbol = typeof uniqueSymbol & { __brand: 'superSymbol' } + + const target = uniqueSymbol as SuperSymbol | string + assertSymbol(target) + expectTypeOf(target).toEqualTypeOf() + }) +}) + +describe('assert unknown types', () => { + test('should assert as symbol for unknown type value.', () => { + const target = Symbol() as unknown + assertSymbol(target) + expectTypeOf(target).toEqualTypeOf() + }) + + test('should strictly assert as symbol when type argument is set.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + type UniqueSymbol = typeof uniqueSymbol + + const target = Symbol() as unknown + assertSymbol(target) + expectTypeOf(target).toEqualTypeOf() + }) +}) + +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a symbol', () => { + assertSymbol( + // + Symbol(), + ) + }) +}) diff --git a/src/typeGuards/symbol/ensure.spec-d.ts b/src/typeGuards/symbol/ensure.spec-d.ts new file mode 100644 index 0000000..f904c0a --- /dev/null +++ b/src/typeGuards/symbol/ensure.spec-d.ts @@ -0,0 +1,59 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { ensureSymbol } from './guards' + +describe('ensure definite types', () => { + test('should ensure as symbol for symbol type values.', () => { + const target = Symbol() as symbol | string + const result = ensureSymbol(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure as symbol for unique symbol type values.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + const uniqueSymbol2: unique symbol = Symbol('target') + type UniqueSymbol = typeof uniqueSymbol + type UniqueSymbol2 = typeof uniqueSymbol2 + + const target = uniqueSymbol as UniqueSymbol | UniqueSymbol2 | string + const result = ensureSymbol(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly ensure as symbol for extended symbol type values.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + type SuperSymbol = typeof uniqueSymbol & { __brand: 'superSymbol' } + + const target = uniqueSymbol as SuperSymbol | string + const result = ensureSymbol(target) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('ensure unknown types', () => { + test('should ensure as symbol for unknown type value.', () => { + const target = Symbol() as unknown + const result = ensureSymbol(target) + expectTypeOf(result).toEqualTypeOf() + }) + + test.skip('should strictly ensure as symbol when type argument is set.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + type UniqueSymbol = typeof uniqueSymbol + + const target = Symbol() as unknown + // TODO: result should be UniqueSymbol. + const result = ensureSymbol(target) + // @ts-ignore + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a symbol', () => { + ensureSymbol( + // + Symbol(), + ) + }) +}) diff --git a/src/typeGuards/symbol/fallback.spec-d.ts b/src/typeGuards/symbol/fallback.spec-d.ts new file mode 100644 index 0000000..b139ece --- /dev/null +++ b/src/typeGuards/symbol/fallback.spec-d.ts @@ -0,0 +1,76 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { fallbackSymbol } from './guards' + +describe('fallback definite types', () => { + test('should fallback as symbol for symbol type values.', () => { + const target = Symbol() as symbol | string + const result = fallbackSymbol(target, Symbol('fallback')) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback as symbol for unique symbol type values.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + const fallback: unique symbol = Symbol('target') + type UniqueSymbol = typeof uniqueSymbol + type FallbackSymbol = typeof fallback + const target = uniqueSymbol as UniqueSymbol | string + const result = fallbackSymbol(target, fallback) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback as symbol for extended symbol type values.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + type SuperSymbol = typeof uniqueSymbol & { __brand: 'superSymbol' } + + const target = uniqueSymbol as SuperSymbol | string + const result = fallbackSymbol(target, Symbol('fallback')) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('fallback unknown types', () => { + test('should fallback as symbol for unknown type value.', () => { + const target = 'string' as unknown + const result = fallbackSymbol(target, Symbol('fallback')) + expectTypeOf(result).toEqualTypeOf() + }) + + test('should strictly fallback as symbol when type argument is set.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + const fallback: unique symbol = Symbol('target') + type UniqueSymbol = typeof uniqueSymbol + type FallbackSymbol = typeof fallback + type Type = UniqueSymbol | FallbackSymbol + + const target = 'string' as unknown + const result = fallbackSymbol(target, fallback) + expectTypeOf(result).toEqualTypeOf() + }) +}) + +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a symbol', () => { + fallbackSymbol( + // + 'string', + Symbol('fallback'), + ) + }) + + test('should result in a TypeScript type error when the type argument is unknown.', () => { + fallbackSymbol( + 'string', + // @ts-expect-error + 'fallback' as unknown, + ) + }) + + test('should result in a TypeScript type error when the type argument not match the fallback value.', () => { + fallbackSymbol( + 'string', + // @ts-expect-error + 3, + ) + }) +}) diff --git a/src/typeGuards/symbol/guard.spec-d.ts b/src/typeGuards/symbol/guard.spec-d.ts new file mode 100644 index 0000000..11c79bf --- /dev/null +++ b/src/typeGuards/symbol/guard.spec-d.ts @@ -0,0 +1,71 @@ +import { describe, expectTypeOf, test } from 'vitest' +import { isSymbol } from './guards' + +describe('guard definite types', () => { + test('should guard as symbol for symbol type values.', () => { + const target = Symbol() as symbol | string + if (isSymbol(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as symbol for unique symbol type values.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + const uniqueSymbol2: unique symbol = Symbol('target') + type UniqueSymbol = typeof uniqueSymbol + type UniqueSymbol2 = typeof uniqueSymbol2 + const target = uniqueSymbol as UniqueSymbol | UniqueSymbol2 | string + if (isSymbol(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as symbol for extended symbol type values.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + type SuperSymbol = typeof uniqueSymbol & { __brand: 'superSymbol' } + + const target = uniqueSymbol as SuperSymbol | string + if (isSymbol(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('guard unknown types', () => { + test('should guard as symbol for unknown type value.', () => { + const target = Symbol() as unknown + if (isSymbol(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) + + test('should strictly guard as symbol when type argument is set.', () => { + const uniqueSymbol: unique symbol = Symbol('target') + type UniqueSymbol = typeof uniqueSymbol + + const target = Symbol() as unknown + if (isSymbol(target)) { + expectTypeOf(target).toEqualTypeOf() + } else { + expectTypeOf(target).toEqualTypeOf() + } + }) +}) + +describe('type errors', () => { + test('should result in a TypeScript type error when the type argument is not a symbol', () => { + isSymbol( + // + Symbol(), + ) + }) +}) diff --git a/src/typeGuards/symbol/guards.spec.ts b/src/typeGuards/symbol/guards.spec.ts new file mode 100644 index 0000000..e53643c --- /dev/null +++ b/src/typeGuards/symbol/guards.spec.ts @@ -0,0 +1,21 @@ +import { describe } from 'vitest' +import { ValueType, testAssert, testEnsure, testFallback, testGuard } from '~/lib-test' +import { assertSymbol, ensureSymbol, fallbackSymbol, isSymbol } from './guards' + +const expected = [ValueType.Symbol] + +describe('isSymbol', () => { + testGuard(isSymbol, expected) +}) + +describe('assertSymbol', () => { + testAssert(assertSymbol, expected) +}) + +describe('ensureSymbol', () => { + testEnsure(ensureSymbol, expected) +}) + +describe('fallbackSymbol', () => { + testFallback(fallbackSymbol, expected, { fallbackValue: 'fallback' }) +}) diff --git a/src/typeGuards/symbol/guards.ts b/src/typeGuards/symbol/guards.ts new file mode 100644 index 0000000..29fe67a --- /dev/null +++ b/src/typeGuards/symbol/guards.ts @@ -0,0 +1,73 @@ +import { + type TypeAssertOf, + type TypeEnsureOf, + type TypeFallbackOf, + type TypeGuard, + createAssertion, + createEnsure, + createFallback, + errorMessage, +} from '~/lib' + +/** + * Checks if a value is a symbol. + * + * @param target The value to check. + * @returns True if the value is a symbol, false otherwise. + * @example + * ```ts + * const target = getTarget() // symbol | number + * if (isSymbol(target)) { + * // target is symbol + * } + * ``` + */ +export const isSymbol = ((target: unknown) => typeof target === 'symbol') as TypeGuard + +type IsSymbol = typeof isSymbol + +/** + * Asserts that a value is a symbol. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a symbol. + * @throws A TypeError with the given message if the value is not a symbol. + * @example + * ```ts + * const target = getTarget() // symbol | number + * assertSymbol(target, 'target must be a symbol') + * // target is symbol + * ``` + */ +export const assertSymbol: TypeAssertOf = createAssertion(isSymbol, errorMessage('symbol')) + +/** + * Ensures that a value is a symbol. + * + * @param target The value to check. + * @param message (optional) The error message to throw if the value is not a symbol. + * @throws A TypeError with the given message if the value is not a symbol. + * @returns The value if it is a symbol. + * @example + * ```ts + * const target = getTarget() // symbol | number + * const result = ensureSymbol(target, 'target must be a symbol') + * // result is symbol + * ``` + */ +export const ensureSymbol: TypeEnsureOf = createEnsure(isSymbol, errorMessage('symbol')) + +/** + * Returns a fallback value if a value is not a symbol. + * + * @param target The value to check. + * @param fallback The fallback value to return if the value is not a symbol. + * @returns The value if it is a symbol, or the fallback value if it is not a symbol. + * @example + * ```ts + * const target = getTarget() // symbol | number + * const result = fallbackSymbol(target, 'fallback') + * // result is symbol | 'fallback' + * ``` + */ +export const fallbackSymbol: TypeFallbackOf = createFallback(isSymbol) diff --git a/src/typeGuards/symbol/index.ts b/src/typeGuards/symbol/index.ts new file mode 100644 index 0000000..2bfb9a1 --- /dev/null +++ b/src/typeGuards/symbol/index.ts @@ -0,0 +1 @@ +export * from './guards' diff --git a/tsconfig.json b/tsconfig.json index c871061..3db4f11 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,6 +18,7 @@ "inlineSources": false, "isolatedModules": true, + "verbatimModuleSyntax": true, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, "noImplicitOverride": true, @@ -33,7 +34,11 @@ "strictBindCallApply": true, "strictNullChecks": true, "strictPropertyInitialization": true, - "useDefineForClassFields": true + "useDefineForClassFields": true, + + "paths": { + "~/*": ["./src/*"], + } }, - "include": ["src/**/*"], + "include": ["src/**/*"] } diff --git a/tsup.config.ts b/tsup.config.ts index 084c5d9..817e937 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,12 +1,13 @@ import { defineConfig } from 'tsup' import config from './package.json' -export default defineConfig({ +// biome-ignore lint/nursery/noDefaultExport: +export default defineConfig({ name: config.name, entry: ['src/index.ts'], format: ['cjs', 'esm'], dts: true, treeshake: true, sourcemap: true, - clean: true + clean: true, }) diff --git a/vitest.config.ts b/vitest.config.ts index 84466ed..186523d 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from 'vitest/config' -export default defineConfig({ +// biome-ignore lint/nursery/noDefaultExport: +export default defineConfig({ test: { include: ['src/**/*.{test,spec}.ts'], typecheck: { diff --git a/yarn.lock b/yarn.lock index bb2533c..969c4d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,10 +5,189 @@ __metadata: version: 8 cacheKey: 10c0 -"@aashutoshrathi/word-wrap@npm:^1.2.3": - version: 1.2.6 - resolution: "@aashutoshrathi/word-wrap@npm:1.2.6" - checksum: 53c2b231a61a46792b39a0d43bc4f4f776bb4542aa57ee04930676802e5501282c2fc8aac14e4cd1f1120ff8b52616b6ff5ab539ad30aa2277d726444b71619f +"@ampproject/remapping@npm:^2.2.0, @ampproject/remapping@npm:^2.2.1": + version: 2.2.1 + resolution: "@ampproject/remapping@npm:2.2.1" + dependencies: + "@jridgewell/gen-mapping": "npm:^0.3.0" + "@jridgewell/trace-mapping": "npm:^0.3.9" + checksum: 92ce5915f8901d8c7cd4f4e6e2fe7b9fd335a29955b400caa52e0e5b12ca3796ada7c2f10e78c9c5b0f9c2539dff0ffea7b19850a56e1487aa083531e1e46d43 + languageName: node + linkType: hard + +"@astrojs/check@npm:^0.3.1": + version: 0.3.1 + resolution: "@astrojs/check@npm:0.3.1" + dependencies: + "@astrojs/language-server": "npm:^2.5.2" + chokidar: "npm:^3.5.3" + fast-glob: "npm:^3.3.1" + kleur: "npm:^4.1.5" + yargs: "npm:^17.7.2" + peerDependencies: + typescript: ^5.0.0 + bin: + astro-check: dist/bin.js + checksum: 33b16c7cc02e7d7fc4761544a55fb3f83b6b7e29b0c7124faf172a88dc9f6c255388d20c77ba4d7aa44311104f6a6145a5800b922c20ef16f363f453b5f2790b + languageName: node + linkType: hard + +"@astrojs/compiler@npm:^2.2.2, @astrojs/compiler@npm:^2.3.0": + version: 2.3.2 + resolution: "@astrojs/compiler@npm:2.3.2" + checksum: e883e5d8c1a314b32e5435fe774d6b65c43a9d9b986d5540dbeb95a21a180a9cf9c095c9abe4bfc9d925f9db76862d1a345e40b3c85a121d00daf84b123286cb + languageName: node + linkType: hard + +"@astrojs/internal-helpers@npm:0.2.1": + version: 0.2.1 + resolution: "@astrojs/internal-helpers@npm:0.2.1" + checksum: 226c99a70e32d5aa14d01614d873696b32a36be8dd6cdaedfe3dca45308a98ba7b3635fe962d41298aa08121bcaefada1fd632075f70daf9bea2b4bddcf6c721 + languageName: node + linkType: hard + +"@astrojs/language-server@npm:^2.5.2": + version: 2.5.2 + resolution: "@astrojs/language-server@npm:2.5.2" + dependencies: + "@astrojs/compiler": "npm:^2.2.2" + "@jridgewell/sourcemap-codec": "npm:^1.4.15" + "@volar/kit": "npm:~1.10.9" + "@volar/language-core": "npm:~1.10.9" + "@volar/language-server": "npm:~1.10.9" + "@volar/language-service": "npm:~1.10.9" + "@volar/source-map": "npm:~1.10.9" + "@volar/typescript": "npm:~1.10.9" + fast-glob: "npm:^3.2.12" + muggle-string: "npm:^0.3.1" + volar-service-css: "npm:0.0.16" + volar-service-emmet: "npm:0.0.16" + volar-service-html: "npm:0.0.16" + volar-service-prettier: "npm:0.0.16" + volar-service-typescript: "npm:0.0.16" + volar-service-typescript-twoslash-queries: "npm:0.0.16" + vscode-html-languageservice: "npm:^5.1.0" + vscode-uri: "npm:^3.0.8" + peerDependencies: + prettier: ^3.0.0 + prettier-plugin-astro: ">=0.11.0" + peerDependenciesMeta: + prettier: + optional: true + prettier-plugin-astro: + optional: true + bin: + astro-ls: bin/nodeServer.js + checksum: b0a4625871164f111713eb5685ac146ab452d6da2c1fa8ef642e0dc470372fcd808dfa35eb227fce4d63a9ce21524679b1f410ac9c169a76b183e0b43bca5c0e + languageName: node + linkType: hard + +"@astrojs/markdown-remark@npm:3.5.0": + version: 3.5.0 + resolution: "@astrojs/markdown-remark@npm:3.5.0" + dependencies: + "@astrojs/prism": "npm:^3.0.0" + github-slugger: "npm:^2.0.0" + import-meta-resolve: "npm:^3.0.0" + mdast-util-definitions: "npm:^6.0.0" + rehype-raw: "npm:^6.1.1" + rehype-stringify: "npm:^9.0.4" + remark-gfm: "npm:^3.0.1" + remark-parse: "npm:^10.0.2" + remark-rehype: "npm:^10.1.0" + remark-smartypants: "npm:^2.0.0" + shikiji: "npm:^0.6.8" + unified: "npm:^10.1.2" + unist-util-visit: "npm:^4.1.2" + vfile: "npm:^5.3.7" + peerDependencies: + astro: ^3.0.0 + checksum: 01ea61a575c39912863408e652d74a4de44a2c25800576c6570e6f2211a26506ce5c3f3a351e7a4db9bc167ddc3bd3e575bf5044c00a7e650b0f89e0c96c36b2 + languageName: node + linkType: hard + +"@astrojs/mdx@npm:^1.1.0": + version: 1.1.5 + resolution: "@astrojs/mdx@npm:1.1.5" + dependencies: + "@astrojs/markdown-remark": "npm:3.5.0" + "@mdx-js/mdx": "npm:^2.3.0" + acorn: "npm:^8.10.0" + es-module-lexer: "npm:^1.3.0" + estree-util-visit: "npm:^1.2.1" + github-slugger: "npm:^2.0.0" + gray-matter: "npm:^4.0.3" + hast-util-to-html: "npm:^8.0.4" + kleur: "npm:^4.1.4" + rehype-raw: "npm:^6.1.1" + remark-gfm: "npm:^3.0.1" + remark-smartypants: "npm:^2.0.0" + source-map: "npm:^0.7.4" + unist-util-visit: "npm:^4.1.2" + vfile: "npm:^5.3.7" + peerDependencies: + astro: ^3.0.0 + checksum: 717aa79e09ff7a3939b625a0c7fda4501dc8485e0d0376cc0efb4a337af46e0772d8c2e56681eb5c42ff84b4d43c9dce040b8d81e2dcf29577ffbb615a0eb53c + languageName: node + linkType: hard + +"@astrojs/prism@npm:^3.0.0": + version: 3.0.0 + resolution: "@astrojs/prism@npm:3.0.0" + dependencies: + prismjs: "npm:^1.29.0" + checksum: 84e2eefcf42fabbafcae9187ea2c7e76f1bf8e128120b1f322d2de8cc034c09fdac93c552490cfd495afeff0a90dca843d35acfec0051c55b79505412564e1ac + languageName: node + linkType: hard + +"@astrojs/sitemap@npm:^3.0.3": + version: 3.0.3 + resolution: "@astrojs/sitemap@npm:3.0.3" + dependencies: + sitemap: "npm:^7.1.1" + zod: "npm:^3.22.4" + checksum: 8f785c6f3430e3d9c7e60a0012a6aabdb4b8d9b5499df830ec09eb77572f615739992d46d1be31b368cac627c6cbf967d3d4e110940d0e41c14ea2806758ec98 + languageName: node + linkType: hard + +"@astrojs/starlight@npm:^0.14.0": + version: 0.14.0 + resolution: "@astrojs/starlight@npm:0.14.0" + dependencies: + "@astrojs/mdx": "npm:^1.1.0" + "@astrojs/sitemap": "npm:^3.0.3" + "@pagefind/default-ui": "npm:^1.0.3" + "@types/mdast": "npm:^3.0.11" + astro-expressive-code: "npm:^0.29.0" + bcp-47: "npm:^2.1.0" + execa: "npm:^8.0.1" + hast-util-select: "npm:^5.0.5" + hastscript: "npm:^7.2.0" + pagefind: "npm:^1.0.3" + rehype: "npm:^12.0.1" + remark-directive: "npm:^2.0.1" + unified: "npm:^10.1.2" + unist-util-remove: "npm:^3.1.1" + unist-util-visit: "npm:^4.1.2" + vfile: "npm:^5.3.7" + peerDependencies: + astro: ^3.2.0 + checksum: c6d9a684f1ef3864d1099753f3a8d91c7ea8a452deac2d88c67dfd29142f91ad52ac8bff3c70ab142dc4870be2408573f96be8083b483722c96366d40c1dc9d7 + languageName: node + linkType: hard + +"@astrojs/telemetry@npm:3.0.4": + version: 3.0.4 + resolution: "@astrojs/telemetry@npm:3.0.4" + dependencies: + ci-info: "npm:^3.8.0" + debug: "npm:^4.3.4" + dlv: "npm:^1.1.3" + dset: "npm:^3.1.2" + is-docker: "npm:^3.0.0" + is-wsl: "npm:^3.0.0" + which-pm-runs: "npm:^1.1.0" + checksum: 06d1d33de20bc5d652436fe21df4c491845f5599c326cc1a8fac06883a1d9c10f5fcc93847bca666fd17c042865e1895da2c3cdf19ca269ec3b4e6bee1a1aa8a languageName: node linkType: hard @@ -21,6 +200,169 @@ __metadata: languageName: node linkType: hard +"@babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.23.5": + version: 7.23.5 + resolution: "@babel/code-frame@npm:7.23.5" + dependencies: + "@babel/highlight": "npm:^7.23.4" + chalk: "npm:^2.4.2" + checksum: a10e843595ddd9f97faa99917414813c06214f4d9205294013e20c70fbdf4f943760da37dec1d998bf3e6fc20fa2918a47c0e987a7e458663feb7698063ad7c6 + languageName: node + linkType: hard + +"@babel/compat-data@npm:^7.22.9": + version: 7.23.5 + resolution: "@babel/compat-data@npm:7.23.5" + checksum: 081278ed46131a890ad566a59c61600a5f9557bd8ee5e535890c8548192532ea92590742fd74bd9db83d74c669ef8a04a7e1c85cdea27f960233e3b83c3a957c + languageName: node + linkType: hard + +"@babel/core@npm:^7.22.10": + version: 7.23.5 + resolution: "@babel/core@npm:7.23.5" + dependencies: + "@ampproject/remapping": "npm:^2.2.0" + "@babel/code-frame": "npm:^7.23.5" + "@babel/generator": "npm:^7.23.5" + "@babel/helper-compilation-targets": "npm:^7.22.15" + "@babel/helper-module-transforms": "npm:^7.23.3" + "@babel/helpers": "npm:^7.23.5" + "@babel/parser": "npm:^7.23.5" + "@babel/template": "npm:^7.22.15" + "@babel/traverse": "npm:^7.23.5" + "@babel/types": "npm:^7.23.5" + convert-source-map: "npm:^2.0.0" + debug: "npm:^4.1.0" + gensync: "npm:^1.0.0-beta.2" + json5: "npm:^2.2.3" + semver: "npm:^6.3.1" + checksum: 311a512a870ee330a3f9a7ea89e5df790b2b5af0b1bd98b10b4edc0de2ac440f0df4d69ea2c0ee38a4b89041b9a495802741d93603be7d4fd834ec8bb6970bd2 + languageName: node + linkType: hard + +"@babel/generator@npm:^7.22.10, @babel/generator@npm:^7.23.5": + version: 7.23.5 + resolution: "@babel/generator@npm:7.23.5" + dependencies: + "@babel/types": "npm:^7.23.5" + "@jridgewell/gen-mapping": "npm:^0.3.2" + "@jridgewell/trace-mapping": "npm:^0.3.17" + jsesc: "npm:^2.5.1" + checksum: 14c6e874f796c4368e919bed6003bb0adc3ce837760b08f9e646d20aeb5ae7d309723ce6e4f06bcb4a2b5753145446c8e4425851380f695e40e71e1760f49e7b + languageName: node + linkType: hard + +"@babel/helper-annotate-as-pure@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" + dependencies: + "@babel/types": "npm:^7.22.5" + checksum: 5a80dc364ddda26b334bbbc0f6426cab647381555ef7d0cd32eb284e35b867c012ce6ce7d52a64672ed71383099c99d32765b3d260626527bb0e3470b0f58e45 + languageName: node + linkType: hard + +"@babel/helper-compilation-targets@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/helper-compilation-targets@npm:7.22.15" + dependencies: + "@babel/compat-data": "npm:^7.22.9" + "@babel/helper-validator-option": "npm:^7.22.15" + browserslist: "npm:^4.21.9" + lru-cache: "npm:^5.1.1" + semver: "npm:^6.3.1" + checksum: 45b9286861296e890f674a3abb199efea14a962a27d9b8adeb44970a9fd5c54e73a9e342e8414d2851cf4f98d5994537352fbce7b05ade32e9849bbd327f9ff1 + languageName: node + linkType: hard + +"@babel/helper-environment-visitor@npm:^7.22.20": + version: 7.22.20 + resolution: "@babel/helper-environment-visitor@npm:7.22.20" + checksum: e762c2d8f5d423af89bd7ae9abe35bd4836d2eb401af868a63bbb63220c513c783e25ef001019418560b3fdc6d9a6fb67e6c0b650bcdeb3a2ac44b5c3d2bdd94 + languageName: node + linkType: hard + +"@babel/helper-function-name@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/helper-function-name@npm:7.23.0" + dependencies: + "@babel/template": "npm:^7.22.15" + "@babel/types": "npm:^7.23.0" + checksum: d771dd1f3222b120518176733c52b7cadac1c256ff49b1889dbbe5e3fed81db855b8cc4e40d949c9d3eae0e795e8229c1c8c24c0e83f27cfa6ee3766696c6428 + languageName: node + linkType: hard + +"@babel/helper-hoist-variables@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-hoist-variables@npm:7.22.5" + dependencies: + "@babel/types": "npm:^7.22.5" + checksum: 60a3077f756a1cd9f14eb89f0037f487d81ede2b7cfe652ea6869cd4ec4c782b0fb1de01b8494b9a2d2050e3d154d7d5ad3be24806790acfb8cbe2073bf1e208 + languageName: node + linkType: hard + +"@babel/helper-module-imports@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/helper-module-imports@npm:7.22.15" + dependencies: + "@babel/types": "npm:^7.22.15" + checksum: 4e0d7fc36d02c1b8c8b3006dfbfeedf7a367d3334a04934255de5128115ea0bafdeb3e5736a2559917f0653e4e437400d54542da0468e08d3cbc86d3bbfa8f30 + languageName: node + linkType: hard + +"@babel/helper-module-transforms@npm:^7.23.3": + version: 7.23.3 + resolution: "@babel/helper-module-transforms@npm:7.23.3" + dependencies: + "@babel/helper-environment-visitor": "npm:^7.22.20" + "@babel/helper-module-imports": "npm:^7.22.15" + "@babel/helper-simple-access": "npm:^7.22.5" + "@babel/helper-split-export-declaration": "npm:^7.22.6" + "@babel/helper-validator-identifier": "npm:^7.22.20" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 211e1399d0c4993671e8e5c2b25383f08bee40004ace5404ed4065f0e9258cc85d99c1b82fd456c030ce5cfd4d8f310355b54ef35de9924eabfc3dff1331d946 + languageName: node + linkType: hard + +"@babel/helper-plugin-utils@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-plugin-utils@npm:7.22.5" + checksum: d2c4bfe2fa91058bcdee4f4e57a3f4933aed7af843acfd169cd6179fab8d13c1d636474ecabb2af107dc77462c7e893199aa26632bac1c6d7e025a17cbb9d20d + languageName: node + linkType: hard + +"@babel/helper-simple-access@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-simple-access@npm:7.22.5" + dependencies: + "@babel/types": "npm:^7.22.5" + checksum: f0cf81a30ba3d09a625fd50e5a9069e575c5b6719234e04ee74247057f8104beca89ed03e9217b6e9b0493434cedc18c5ecca4cea6244990836f1f893e140369 + languageName: node + linkType: hard + +"@babel/helper-split-export-declaration@npm:^7.22.6": + version: 7.22.6 + resolution: "@babel/helper-split-export-declaration@npm:7.22.6" + dependencies: + "@babel/types": "npm:^7.22.5" + checksum: d83e4b623eaa9622c267d3c83583b72f3aac567dc393dda18e559d79187961cb29ae9c57b2664137fc3d19508370b12ec6a81d28af73a50e0846819cb21c6e44 + languageName: node + linkType: hard + +"@babel/helper-string-parser@npm:^7.23.4": + version: 7.23.4 + resolution: "@babel/helper-string-parser@npm:7.23.4" + checksum: f348d5637ad70b6b54b026d6544bd9040f78d24e7ec245a0fc42293968181f6ae9879c22d89744730d246ce8ec53588f716f102addd4df8bbc79b73ea10004ac + languageName: node + linkType: hard + +"@babel/helper-validator-identifier@npm:^7.22.20": + version: 7.22.20 + resolution: "@babel/helper-validator-identifier@npm:7.22.20" + checksum: dcad63db345fb110e032de46c3688384b0008a42a4845180ce7cd62b1a9c0507a1bed727c4d1060ed1a03ae57b4d918570259f81724aaac1a5b776056f37504e + languageName: node + linkType: hard + "@babel/helper-validator-identifier@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-validator-identifier@npm:7.22.5" @@ -28,6 +370,24 @@ __metadata: languageName: node linkType: hard +"@babel/helper-validator-option@npm:^7.22.15": + version: 7.23.5 + resolution: "@babel/helper-validator-option@npm:7.23.5" + checksum: af45d5c0defb292ba6fd38979e8f13d7da63f9623d8ab9ededc394f67eb45857d2601278d151ae9affb6e03d5d608485806cd45af08b4468a0515cf506510e94 + languageName: node + linkType: hard + +"@babel/helpers@npm:^7.23.5": + version: 7.23.5 + resolution: "@babel/helpers@npm:7.23.5" + dependencies: + "@babel/template": "npm:^7.22.15" + "@babel/traverse": "npm:^7.23.5" + "@babel/types": "npm:^7.23.5" + checksum: a37e2728eb4378a4888e5d614e28de7dd79b55ac8acbecd0e5c761273e2a02a8f33b34b1932d9069db55417ace2937cbf8ec37c42f1030ce6d228857d7ccaa4f + languageName: node + linkType: hard + "@babel/highlight@npm:^7.22.5": version: 7.22.5 resolution: "@babel/highlight@npm:7.22.5" @@ -39,6 +399,52 @@ __metadata: languageName: node linkType: hard +"@babel/highlight@npm:^7.23.4": + version: 7.23.4 + resolution: "@babel/highlight@npm:7.23.4" + dependencies: + "@babel/helper-validator-identifier": "npm:^7.22.20" + chalk: "npm:^2.4.2" + js-tokens: "npm:^4.0.0" + checksum: fbff9fcb2f5539289c3c097d130e852afd10d89a3a08ac0b5ebebbc055cc84a4bcc3dcfed463d488cde12dd0902ef1858279e31d7349b2e8cee43913744bda33 + languageName: node + linkType: hard + +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.22.10, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.23.3, @babel/parser@npm:^7.23.5": + version: 7.23.5 + resolution: "@babel/parser@npm:7.23.5" + bin: + parser: ./bin/babel-parser.js + checksum: 3356aa90d7bafb4e2c7310e7c2c3d443c4be4db74913f088d3d577a1eb914ea4188e05fd50a47ce907a27b755c4400c4e3cbeee73dbeb37761f6ca85954f5a20 + languageName: node + linkType: hard + +"@babel/plugin-syntax-jsx@npm:^7.23.3": + version: 7.23.3 + resolution: "@babel/plugin-syntax-jsx@npm:7.23.3" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.22.5" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 563bb7599b868773f1c7c1d441ecc9bc53aeb7832775da36752c926fc402a1fa5421505b39e724f71eb217c13e4b93117e081cac39723b0e11dac4c897f33c3e + languageName: node + linkType: hard + +"@babel/plugin-transform-react-jsx@npm:^7.22.5": + version: 7.23.4 + resolution: "@babel/plugin-transform-react-jsx@npm:7.23.4" + dependencies: + "@babel/helper-annotate-as-pure": "npm:^7.22.5" + "@babel/helper-module-imports": "npm:^7.22.15" + "@babel/helper-plugin-utils": "npm:^7.22.5" + "@babel/plugin-syntax-jsx": "npm:^7.23.3" + "@babel/types": "npm:^7.23.4" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 8851b3adc515cd91bdb06ff3a23a0f81f0069cfef79dfb3fa744da4b7a82e3555ccb6324c4fa71ecf22508db13b9ff6a0ed96675f95fc87903b9fc6afb699580 + languageName: node + linkType: hard + "@babel/runtime@npm:^7.20.1, @babel/runtime@npm:^7.5.5": version: 7.22.5 resolution: "@babel/runtime@npm:7.22.5" @@ -48,6 +454,124 @@ __metadata: languageName: node linkType: hard +"@babel/template@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/template@npm:7.22.15" + dependencies: + "@babel/code-frame": "npm:^7.22.13" + "@babel/parser": "npm:^7.22.15" + "@babel/types": "npm:^7.22.15" + checksum: 9312edd37cf1311d738907003f2aa321a88a42ba223c69209abe4d7111db019d321805504f606c7fd75f21c6cf9d24d0a8223104cd21ebd207e241b6c551f454 + languageName: node + linkType: hard + +"@babel/traverse@npm:^7.22.10, @babel/traverse@npm:^7.23.5": + version: 7.23.5 + resolution: "@babel/traverse@npm:7.23.5" + dependencies: + "@babel/code-frame": "npm:^7.23.5" + "@babel/generator": "npm:^7.23.5" + "@babel/helper-environment-visitor": "npm:^7.22.20" + "@babel/helper-function-name": "npm:^7.23.0" + "@babel/helper-hoist-variables": "npm:^7.22.5" + "@babel/helper-split-export-declaration": "npm:^7.22.6" + "@babel/parser": "npm:^7.23.5" + "@babel/types": "npm:^7.23.5" + debug: "npm:^4.1.0" + globals: "npm:^11.1.0" + checksum: c5ea793080ca6719b0a1612198fd25e361cee1f3c14142d7a518d2a1eeb5c1d21f7eec1b26c20ea6e1ddd8ed12ab50b960ff95ffd25be353b6b46e1b54d6f825 + languageName: node + linkType: hard + +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.22.10, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.3, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.5, @babel/types@npm:^7.8.3": + version: 7.23.5 + resolution: "@babel/types@npm:7.23.5" + dependencies: + "@babel/helper-string-parser": "npm:^7.23.4" + "@babel/helper-validator-identifier": "npm:^7.22.20" + to-fast-properties: "npm:^2.0.0" + checksum: 7dd5e2f59828ed046ad0b06b039df2524a8b728d204affb4fc08da2502b9dd3140b1356b5166515d229dc811539a8b70dcd4bc507e06d62a89f4091a38d0b0fb + languageName: node + linkType: hard + +"@bcoe/v8-coverage@npm:^0.2.3": + version: 0.2.3 + resolution: "@bcoe/v8-coverage@npm:0.2.3" + checksum: 6b80ae4cb3db53f486da2dc63b6e190a74c8c3cca16bb2733f234a0b6a9382b09b146488ae08e2b22cf00f6c83e20f3e040a2f7894f05c045c946d6a090b1d52 + languageName: node + linkType: hard + +"@biomejs/biome@npm:^1.4.1": + version: 1.4.1 + resolution: "@biomejs/biome@npm:1.4.1" + dependencies: + "@biomejs/cli-darwin-arm64": "npm:1.4.1" + "@biomejs/cli-darwin-x64": "npm:1.4.1" + "@biomejs/cli-linux-arm64": "npm:1.4.1" + "@biomejs/cli-linux-x64": "npm:1.4.1" + "@biomejs/cli-win32-arm64": "npm:1.4.1" + "@biomejs/cli-win32-x64": "npm:1.4.1" + dependenciesMeta: + "@biomejs/cli-darwin-arm64": + optional: true + "@biomejs/cli-darwin-x64": + optional: true + "@biomejs/cli-linux-arm64": + optional: true + "@biomejs/cli-linux-x64": + optional: true + "@biomejs/cli-win32-arm64": + optional: true + "@biomejs/cli-win32-x64": + optional: true + bin: + biome: bin/biome + checksum: 11d3a6d0ac0e31c6f5e5e33a46a77b4e1f0846a1d6c023b597a472266e911ce5ad0513b1946eedc37d31547785909c87110e803c69f564a36d4ff045d01ed243 + languageName: node + linkType: hard + +"@biomejs/cli-darwin-arm64@npm:1.4.1": + version: 1.4.1 + resolution: "@biomejs/cli-darwin-arm64@npm:1.4.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@biomejs/cli-darwin-x64@npm:1.4.1": + version: 1.4.1 + resolution: "@biomejs/cli-darwin-x64@npm:1.4.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@biomejs/cli-linux-arm64@npm:1.4.1": + version: 1.4.1 + resolution: "@biomejs/cli-linux-arm64@npm:1.4.1" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@biomejs/cli-linux-x64@npm:1.4.1": + version: 1.4.1 + resolution: "@biomejs/cli-linux-x64@npm:1.4.1" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@biomejs/cli-win32-arm64@npm:1.4.1": + version: 1.4.1 + resolution: "@biomejs/cli-win32-arm64@npm:1.4.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@biomejs/cli-win32-x64@npm:1.4.1": + version: 1.4.1 + resolution: "@biomejs/cli-win32-x64@npm:1.4.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@changesets/apply-release-plan@npm:^6.1.4": version: 6.1.4 resolution: "@changesets/apply-release-plan@npm:6.1.4" @@ -305,6 +829,38 @@ __metadata: languageName: node linkType: hard +"@ctrl/tinycolor@npm:^3.6.0": + version: 3.6.1 + resolution: "@ctrl/tinycolor@npm:3.6.1" + checksum: 444d81612cd8c5c802a3d1253df83d5f77d3db87f351861655683a4743990e6b38976bf2e4129591c5a258607b63574b3c7bed702cf6a0eb7912222edf4570e9 + languageName: node + linkType: hard + +"@emmetio/abbreviation@npm:^2.3.3": + version: 2.3.3 + resolution: "@emmetio/abbreviation@npm:2.3.3" + dependencies: + "@emmetio/scanner": "npm:^1.0.4" + checksum: 835b460706d5920a6f9a569a44b7d98e88d5530e3983af3678b44fa38b4cbdf68b5df933476d72e340779b16e7e7962ffa63142db8d2f59b1175a11c30c14635 + languageName: node + linkType: hard + +"@emmetio/css-abbreviation@npm:^2.1.8": + version: 2.1.8 + resolution: "@emmetio/css-abbreviation@npm:2.1.8" + dependencies: + "@emmetio/scanner": "npm:^1.0.4" + checksum: b5b3b39e773185d848b634e48e1b520e6ebffd28bfd0ba34fbcf877ca77e0edb8c7bbf58230cb0621f80f579bd7fd0265f00ab5e09ac482a835897cbdb6182a6 + languageName: node + linkType: hard + +"@emmetio/scanner@npm:^1.0.4": + version: 1.0.4 + resolution: "@emmetio/scanner@npm:1.0.4" + checksum: ae6244e563caaff0f88d7afefc33fd6cfb7cc767ce914b54d35b46002637948cfc65951dba6d6941328afa54c721c225836fafce2de40fb7643660ba09fe7372 + languageName: node + linkType: hard + "@esbuild/android-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-arm64@npm:0.18.20" @@ -319,6 +875,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/android-arm64@npm:0.19.9" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/android-arm@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-arm@npm:0.18.20" @@ -333,6 +896,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/android-arm@npm:0.19.9" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + "@esbuild/android-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-x64@npm:0.18.20" @@ -347,6 +917,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-x64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/android-x64@npm:0.19.9" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + "@esbuild/darwin-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/darwin-arm64@npm:0.18.20" @@ -361,6 +938,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-arm64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/darwin-arm64@npm:0.19.9" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/darwin-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/darwin-x64@npm:0.18.20" @@ -375,6 +959,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-x64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/darwin-x64@npm:0.19.9" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + "@esbuild/freebsd-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/freebsd-arm64@npm:0.18.20" @@ -389,6 +980,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-arm64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/freebsd-arm64@npm:0.19.9" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/freebsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/freebsd-x64@npm:0.18.20" @@ -403,6 +1001,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-x64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/freebsd-x64@npm:0.19.9" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/linux-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-arm64@npm:0.18.20" @@ -417,6 +1022,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/linux-arm64@npm:0.19.9" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/linux-arm@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-arm@npm:0.18.20" @@ -431,6 +1043,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/linux-arm@npm:0.19.9" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + "@esbuild/linux-ia32@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-ia32@npm:0.18.20" @@ -445,6 +1064,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ia32@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/linux-ia32@npm:0.19.9" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/linux-loong64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-loong64@npm:0.18.20" @@ -459,6 +1085,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-loong64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/linux-loong64@npm:0.19.9" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + "@esbuild/linux-mips64el@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-mips64el@npm:0.18.20" @@ -473,6 +1106,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-mips64el@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/linux-mips64el@npm:0.19.9" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + "@esbuild/linux-ppc64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-ppc64@npm:0.18.20" @@ -487,6 +1127,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ppc64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/linux-ppc64@npm:0.19.9" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/linux-riscv64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-riscv64@npm:0.18.20" @@ -501,6 +1148,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-riscv64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/linux-riscv64@npm:0.19.9" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + "@esbuild/linux-s390x@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-s390x@npm:0.18.20" @@ -515,6 +1169,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-s390x@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/linux-s390x@npm:0.19.9" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + "@esbuild/linux-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-x64@npm:0.18.20" @@ -529,6 +1190,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-x64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/linux-x64@npm:0.19.9" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + "@esbuild/netbsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/netbsd-x64@npm:0.18.20" @@ -543,6 +1211,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/netbsd-x64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/netbsd-x64@npm:0.19.9" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/openbsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/openbsd-x64@npm:0.18.20" @@ -557,6 +1232,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/openbsd-x64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/openbsd-x64@npm:0.19.9" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/sunos-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/sunos-x64@npm:0.18.20" @@ -571,6 +1253,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/sunos-x64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/sunos-x64@npm:0.19.9" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + "@esbuild/win32-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-arm64@npm:0.18.20" @@ -585,6 +1274,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-arm64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/win32-arm64@npm:0.19.9" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/win32-ia32@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-ia32@npm:0.18.20" @@ -599,6 +1295,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-ia32@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/win32-ia32@npm:0.19.9" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/win32-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-x64@npm:0.18.20" @@ -613,77 +1316,54 @@ __metadata: languageName: node linkType: hard -"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0": - version: 4.4.0 - resolution: "@eslint-community/eslint-utils@npm:4.4.0" - dependencies: - eslint-visitor-keys: "npm:^3.3.0" - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - checksum: 7e559c4ce59cd3a06b1b5a517b593912e680a7f981ae7affab0d01d709e99cd5647019be8fafa38c350305bc32f1f7d42c7073edde2ab536c745e365f37b607e - languageName: node - linkType: hard - -"@eslint-community/regexpp@npm:^4.5.1": - version: 4.6.1 - resolution: "@eslint-community/regexpp@npm:4.6.1" - checksum: 4ab30d948881ad01311a24866afb30cf7481c594ac6aecebf7fbea2f29bd42d403d5676b69790df3d333620d863df29358a0282f10726f3506e5ef52471204be - languageName: node - linkType: hard - -"@eslint-community/regexpp@npm:^4.6.1": - version: 4.6.2 - resolution: "@eslint-community/regexpp@npm:4.6.2" - checksum: da800788298f8419f4c4e04eaa4e3c97e7f57537e822e7b150de662e420e3d437816b863e490807bd0b00e715b0989f9d8864bf54357cbcfa84e4255b910789d +"@esbuild/win32-x64@npm:0.19.9": + version: 0.19.9 + resolution: "@esbuild/win32-x64@npm:0.19.9" + conditions: os=win32 & cpu=x64 languageName: node linkType: hard -"@eslint/eslintrc@npm:^2.1.3": - version: 2.1.3 - resolution: "@eslint/eslintrc@npm:2.1.3" +"@expressive-code/core@npm:^0.29.2": + version: 0.29.2 + resolution: "@expressive-code/core@npm:0.29.2" dependencies: - ajv: "npm:^6.12.4" - debug: "npm:^4.3.2" - espree: "npm:^9.6.0" - globals: "npm:^13.19.0" - ignore: "npm:^5.2.0" - import-fresh: "npm:^3.2.1" - js-yaml: "npm:^4.1.0" - minimatch: "npm:^3.1.2" - strip-json-comments: "npm:^3.1.1" - checksum: f4103f4346126292eb15581c5a1d12bef03410fd3719dedbdb92e1f7031d46a5a2d60de8566790445d5d4b70b75ba050876799a11f5fff8265a91ee3fa77dab0 - languageName: node - linkType: hard - -"@eslint/js@npm:8.54.0": - version: 8.54.0 - resolution: "@eslint/js@npm:8.54.0" - checksum: d61fb4a0be6af2d8cb290121c329697664a75d6255a29926d5454fb02aeb02b87112f67fdf218d10abac42f90c570ac366126751baefc5405d0e017ed0c946c5 + "@ctrl/tinycolor": "npm:^3.6.0" + hast-util-to-html: "npm:^8.0.4" + hastscript: "npm:^7.2.0" + postcss: "npm:^8.4.21" + postcss-nested: "npm:^6.0.1" + checksum: 2b3a03d043ba5b52d2c5bad78420838f1155b20f7651099287415665aab76713bd6781f98a25b67c36aec2d11237b7df8434a700dda439db2c3f269478c8825b languageName: node linkType: hard -"@humanwhocodes/config-array@npm:^0.11.13": - version: 0.11.13 - resolution: "@humanwhocodes/config-array@npm:0.11.13" +"@expressive-code/plugin-frames@npm:^0.29.2": + version: 0.29.2 + resolution: "@expressive-code/plugin-frames@npm:0.29.2" dependencies: - "@humanwhocodes/object-schema": "npm:^2.0.1" - debug: "npm:^4.1.1" - minimatch: "npm:^3.0.5" - checksum: d76ca802d853366094d0e98ff0d0994117fc8eff96649cd357b15e469e428228f597cd2e929d54ab089051684949955f16ee905bb19f7b2f0446fb377157be7a + "@expressive-code/core": "npm:^0.29.2" + hastscript: "npm:^7.2.0" + checksum: ec3fbeb36c2bc26b0ead59bba6f4dda99ad953a218e167691966769ca699d17a3b7efc52e5ddbc0f894e09d6a22d71a9f59526d05de7a2249bcd1154545cde9b languageName: node linkType: hard -"@humanwhocodes/module-importer@npm:^1.0.1": - version: 1.0.1 - resolution: "@humanwhocodes/module-importer@npm:1.0.1" - checksum: 909b69c3b86d482c26b3359db16e46a32e0fb30bd306a3c176b8313b9e7313dba0f37f519de6aa8b0a1921349e505f259d19475e123182416a506d7f87e7f529 +"@expressive-code/plugin-shiki@npm:^0.29.2": + version: 0.29.2 + resolution: "@expressive-code/plugin-shiki@npm:0.29.2" + dependencies: + "@expressive-code/core": "npm:^0.29.2" + shiki: "npm:^0.14.1" + checksum: ea5a0077f47f5fd2a3a4e59dc47c2c3b11d3ca5382282d27d1313f3cca8808433e112131106a812205ae50d3d8f4cb0921bb901b9b626f641929db6b2f271d14 languageName: node linkType: hard -"@humanwhocodes/object-schema@npm:^2.0.1": - version: 2.0.1 - resolution: "@humanwhocodes/object-schema@npm:2.0.1" - checksum: 9dba24e59fdb4041829d92b693aacb778add3b6f612aaa9c0774f3b650c11a378cc64f042a59da85c11dae33df456580a3c36837b953541aed6ff94294f97fac +"@expressive-code/plugin-text-markers@npm:^0.29.2": + version: 0.29.2 + resolution: "@expressive-code/plugin-text-markers@npm:0.29.2" + dependencies: + "@expressive-code/core": "npm:^0.29.2" + hastscript: "npm:^7.2.0" + unist-util-visit-parents: "npm:^5.1.3" + checksum: 4657c8bea449ebe5930c4029a377ad8593a513fd50920772f0c789a8871f7e76a4f71c57e1efa97f0ae79e20ca354161b64c758ec1cb3b6ba9465a79733ce971 languageName: node linkType: hard @@ -701,22 +1381,64 @@ __metadata: languageName: node linkType: hard -"@jest/schemas@npm:^29.6.0": - version: 29.6.0 - resolution: "@jest/schemas@npm:29.6.0" +"@istanbuljs/schema@npm:^0.1.2": + version: 0.1.3 + resolution: "@istanbuljs/schema@npm:0.1.3" + checksum: 61c5286771676c9ca3eb2bd8a7310a9c063fb6e0e9712225c8471c582d157392c88f5353581c8c9adbe0dff98892317d2fdfc56c3499aa42e0194405206a963a + languageName: node + linkType: hard + +"@jest/schemas@npm:^29.6.3": + version: 29.6.3 + resolution: "@jest/schemas@npm:29.6.3" dependencies: "@sinclair/typebox": "npm:^0.27.8" - checksum: 8671b1fb59c4296204d335190e8451e1983d9f2db6dbbd38f838c6c273fd222fc11e4e0df04adfb6169d36acfb9693d525db136653ec04e6884180f45a131d8f + checksum: b329e89cd5f20b9278ae1233df74016ebf7b385e0d14b9f4c1ad18d096c4c19d1e687aa113a9c976b16ec07f021ae53dea811fb8c1248a50ac34fbe009fdf6be + languageName: node + linkType: hard + +"@jridgewell/gen-mapping@npm:^0.3.0, @jridgewell/gen-mapping@npm:^0.3.2": + version: 0.3.3 + resolution: "@jridgewell/gen-mapping@npm:0.3.3" + dependencies: + "@jridgewell/set-array": "npm:^1.0.1" + "@jridgewell/sourcemap-codec": "npm:^1.4.10" + "@jridgewell/trace-mapping": "npm:^0.3.9" + checksum: 376fc11cf5a967318ba3ddd9d8e91be528eab6af66810a713c49b0c3f8dc67e9949452c51c38ab1b19aa618fb5e8594da5a249977e26b1e7fea1ee5a1fcacc74 + languageName: node + linkType: hard + +"@jridgewell/resolve-uri@npm:^3.1.0": + version: 3.1.1 + resolution: "@jridgewell/resolve-uri@npm:3.1.1" + checksum: 0dbc9e29bc640bbbdc5b9876d2859c69042bfcf1423c1e6421bcca53e826660bff4e41c7d4bcb8dbea696404231a6f902f76ba41835d049e20f2dd6cffb713bf + languageName: node + linkType: hard + +"@jridgewell/set-array@npm:^1.0.1": + version: 1.1.2 + resolution: "@jridgewell/set-array@npm:1.1.2" + checksum: bc7ab4c4c00470de4e7562ecac3c0c84f53e7ee8a711e546d67c47da7febe7c45cd67d4d84ee3c9b2c05ae8e872656cdded8a707a283d30bd54fbc65aef821ab languageName: node linkType: hard -"@jridgewell/sourcemap-codec@npm:^1.4.15": +"@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" checksum: 0c6b5ae663087558039052a626d2d7ed5208da36cfd707dcc5cea4a07cfc918248403dcb5989a8f7afaf245ce0573b7cc6fd94c4a30453bd10e44d9363940ba5 languageName: node linkType: hard +"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.9": + version: 0.3.20 + resolution: "@jridgewell/trace-mapping@npm:0.3.20" + dependencies: + "@jridgewell/resolve-uri": "npm:^3.1.0" + "@jridgewell/sourcemap-codec": "npm:^1.4.14" + checksum: 0ea0b2675cf513ec44dc25605616a3c9b808b9832e74b5b63c44260d66b58558bba65764f81928fc1033ead911f8718dca1134049c3e7a93937faf436671df31 + languageName: node + linkType: hard + "@manypkg/find-root@npm:^1.1.0": version: 1.1.0 resolution: "@manypkg/find-root@npm:1.1.0" @@ -743,6 +1465,31 @@ __metadata: languageName: node linkType: hard +"@mdx-js/mdx@npm:^2.3.0": + version: 2.3.0 + resolution: "@mdx-js/mdx@npm:2.3.0" + dependencies: + "@types/estree-jsx": "npm:^1.0.0" + "@types/mdx": "npm:^2.0.0" + estree-util-build-jsx: "npm:^2.0.0" + estree-util-is-identifier-name: "npm:^2.0.0" + estree-util-to-js: "npm:^1.1.0" + estree-walker: "npm:^3.0.0" + hast-util-to-estree: "npm:^2.0.0" + markdown-extensions: "npm:^1.0.0" + periscopic: "npm:^3.0.0" + remark-mdx: "npm:^2.0.0" + remark-parse: "npm:^10.0.0" + remark-rehype: "npm:^10.0.0" + unified: "npm:^10.0.0" + unist-util-position-from-estree: "npm:^1.0.0" + unist-util-stringify-position: "npm:^3.0.0" + unist-util-visit: "npm:^4.0.0" + vfile: "npm:^5.0.0" + checksum: 719384d8e72abd3e83aa2fd3010394636e32cc0e5e286b6414427ef03121397586ce97ec816afcc4d2b22ba65939c3801a8198e04cf921dd597c0aa9fd75dbb4 + languageName: node + linkType: hard + "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5" @@ -760,7 +1507,7 @@ __metadata: languageName: node linkType: hard -"@nodelib/fs.walk@npm:^1.2.3, @nodelib/fs.walk@npm:^1.2.8": +"@nodelib/fs.walk@npm:^1.2.3": version: 1.2.8 resolution: "@nodelib/fs.walk@npm:1.2.8" dependencies: @@ -779,6 +1526,48 @@ __metadata: languageName: node linkType: hard +"@pagefind/darwin-arm64@npm:1.0.4": + version: 1.0.4 + resolution: "@pagefind/darwin-arm64@npm:1.0.4" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@pagefind/darwin-x64@npm:1.0.4": + version: 1.0.4 + resolution: "@pagefind/darwin-x64@npm:1.0.4" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@pagefind/default-ui@npm:^1.0.3": + version: 1.0.4 + resolution: "@pagefind/default-ui@npm:1.0.4" + checksum: 7945c15cd65426624cdf48a0d7236bf1f682dfd597a6a3078e27a126b0c2af61825c2a70a8ca8d46b1770926424e6a28f9dc908461e48293b62e128b388019df + languageName: node + linkType: hard + +"@pagefind/linux-arm64@npm:1.0.4": + version: 1.0.4 + resolution: "@pagefind/linux-arm64@npm:1.0.4" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@pagefind/linux-x64@npm:1.0.4": + version: 1.0.4 + resolution: "@pagefind/linux-x64@npm:1.0.4" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@pagefind/windows-x64@npm:1.0.4": + version: 1.0.4 + resolution: "@pagefind/windows-x64@npm:1.0.4" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@pkgjs/parseargs@npm:^0.11.0": version: 0.11.0 resolution: "@pkgjs/parseargs@npm:0.11.0" @@ -786,6 +1575,13 @@ __metadata: languageName: node linkType: hard +"@polka/url@npm:^1.0.0-next.20": + version: 1.0.0-next.24 + resolution: "@polka/url@npm:1.0.0-next.24" + checksum: 97d98fa911857158514457bedad8c36084c1f608302458f580ab300a25c3abf456d1d54fcf2ea7927464bee0858baf5e8e5b374b95c3375b9eb3784d81411ebd + languageName: node + linkType: hard + "@rollup/rollup-android-arm-eabi@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-android-arm-eabi@npm:4.5.0" @@ -793,6 +1589,13 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-android-arm-eabi@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.7.0" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + "@rollup/rollup-android-arm64@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-android-arm64@npm:4.5.0" @@ -800,6 +1603,13 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-android-arm64@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-android-arm64@npm:4.7.0" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + "@rollup/rollup-darwin-arm64@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-darwin-arm64@npm:4.5.0" @@ -807,6 +1617,13 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-darwin-arm64@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-darwin-arm64@npm:4.7.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + "@rollup/rollup-darwin-x64@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-darwin-x64@npm:4.5.0" @@ -814,6 +1631,13 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-darwin-x64@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-darwin-x64@npm:4.7.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + "@rollup/rollup-linux-arm-gnueabihf@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.5.0" @@ -821,6 +1645,13 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-linux-arm-gnueabihf@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.7.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + "@rollup/rollup-linux-arm64-gnu@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.5.0" @@ -828,6 +1659,13 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-linux-arm64-gnu@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.7.0" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + "@rollup/rollup-linux-arm64-musl@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-linux-arm64-musl@npm:4.5.0" @@ -835,6 +1673,20 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-linux-arm64-musl@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.7.0" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-linux-riscv64-gnu@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.7.0" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + "@rollup/rollup-linux-x64-gnu@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-linux-x64-gnu@npm:4.5.0" @@ -842,6 +1694,13 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-linux-x64-gnu@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.7.0" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + "@rollup/rollup-linux-x64-musl@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-linux-x64-musl@npm:4.5.0" @@ -849,6 +1708,13 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-linux-x64-musl@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.7.0" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + "@rollup/rollup-win32-arm64-msvc@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.5.0" @@ -856,6 +1722,13 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-win32-arm64-msvc@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.7.0" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + "@rollup/rollup-win32-ia32-msvc@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.5.0" @@ -863,6 +1736,13 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-win32-ia32-msvc@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.7.0" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + "@rollup/rollup-win32-x64-msvc@npm:4.5.0": version: 4.5.0 resolution: "@rollup/rollup-win32-x64-msvc@npm:4.5.0" @@ -870,6 +1750,13 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-win32-x64-msvc@npm:4.7.0": + version: 4.7.0 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.7.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@sinclair/typebox@npm:^0.27.8": version: 0.27.8 resolution: "@sinclair/typebox@npm:0.27.8" @@ -884,19 +1771,96 @@ __metadata: languageName: node linkType: hard -"@types/chai-subset@npm:^1.3.3": - version: 1.3.3 - resolution: "@types/chai-subset@npm:1.3.3" +"@types/acorn@npm:^4.0.0": + version: 4.0.6 + resolution: "@types/acorn@npm:4.0.6" + dependencies: + "@types/estree": "npm:*" + checksum: 5a65a1d7e91fc95703f0a717897be60fa7ccd34b17f5462056274a246e6690259fe0a1baabc86fd3260354f87245cb3dc483346d7faad2b78fc199763978ede9 + languageName: node + linkType: hard + +"@types/babel__core@npm:^7.20.1": + version: 7.20.5 + resolution: "@types/babel__core@npm:7.20.5" + dependencies: + "@babel/parser": "npm:^7.20.7" + "@babel/types": "npm:^7.20.7" + "@types/babel__generator": "npm:*" + "@types/babel__template": "npm:*" + "@types/babel__traverse": "npm:*" + checksum: bdee3bb69951e833a4b811b8ee9356b69a61ed5b7a23e1a081ec9249769117fa83aaaf023bb06562a038eb5845155ff663e2d5c75dd95c1d5ccc91db012868ff + languageName: node + linkType: hard + +"@types/babel__generator@npm:*": + version: 7.6.7 + resolution: "@types/babel__generator@npm:7.6.7" + dependencies: + "@babel/types": "npm:^7.0.0" + checksum: 2427203864ef231857e102eeb32b731a419164863983119cdd4dac9f1503c2831eb4262d05ade95d4574aa410b94c16e54e36a616758452f685a34881f4596d9 + languageName: node + linkType: hard + +"@types/babel__template@npm:*": + version: 7.4.4 + resolution: "@types/babel__template@npm:7.4.4" + dependencies: + "@babel/parser": "npm:^7.1.0" + "@babel/types": "npm:^7.0.0" + checksum: cc84f6c6ab1eab1427e90dd2b76ccee65ce940b778a9a67be2c8c39e1994e6f5bbc8efa309f6cea8dc6754994524cd4d2896558df76d92e7a1f46ecffee7112b + languageName: node + linkType: hard + +"@types/babel__traverse@npm:*": + version: 7.20.4 + resolution: "@types/babel__traverse@npm:7.20.4" + dependencies: + "@babel/types": "npm:^7.20.7" + checksum: e76cb4974c7740fd61311152dc497e7b05c1c46ba554aab875544ab0a7457f343cafcad34ba8fb2ff543ab0e012ef2d3fa0c13f1a4e9a4cd9c4c703c7a2a8d62 + languageName: node + linkType: hard + +"@types/debug@npm:^4.0.0": + version: 4.1.12 + resolution: "@types/debug@npm:4.1.12" + dependencies: + "@types/ms": "npm:*" + checksum: 5dcd465edbb5a7f226e9a5efd1f399c6172407ef5840686b73e3608ce135eeca54ae8037dcd9f16bdb2768ac74925b820a8b9ecc588a58ca09eca6acabe33e2f + languageName: node + linkType: hard + +"@types/estree-jsx@npm:^1.0.0": + version: 1.0.3 + resolution: "@types/estree-jsx@npm:1.0.3" + dependencies: + "@types/estree": "npm:*" + checksum: 41742a7b0874f63e61396d87a46d3ca531850a0e2cd7cec304339b8df439b6371d5e8758f34de9b5d9e940486ea21305b2f74cb420754838ecdfdaba918afc66 + languageName: node + linkType: hard + +"@types/estree@npm:*, @types/estree@npm:^1.0.0": + version: 1.0.5 + resolution: "@types/estree@npm:1.0.5" + checksum: b3b0e334288ddb407c7b3357ca67dbee75ee22db242ca7c56fe27db4e1a31989cb8af48a84dd401deb787fe10cc6b2ab1ee82dc4783be87ededbe3d53c79c70d + languageName: node + linkType: hard + +"@types/hast@npm:^2.0.0": + version: 2.3.8 + resolution: "@types/hast@npm:2.3.8" dependencies: - "@types/chai": "npm:*" - checksum: 2dfb3210ce8d872288bb44329a44d4d1b7be360c72e8eb570a535c0e97246a4bd0209df304427d0e179c9e1c659d5dba07c25bdae13ef983edf41db81278fda5 + "@types/unist": "npm:^2" + checksum: 0b358a65135922df8465f5daabed08602afc9098cf9065439f2fa46a5757d1630c88c4ad208b9ff0114bed95d468a75eeed49a099615096a9ad3bb1a85d8a3a1 languageName: node linkType: hard -"@types/chai@npm:*, @types/chai@npm:^4.3.5": - version: 4.3.5 - resolution: "@types/chai@npm:4.3.5" - checksum: 816b3081e067c6e332be313e2e9a518b117c9eac51201cac749de0d6fcf7cb3238d0def37690b6539b3a928bd87b2f5f777914248447889ebc6f630a0d00e0e5 +"@types/hast@npm:^3.0.0": + version: 3.0.3 + resolution: "@types/hast@npm:3.0.3" + dependencies: + "@types/unist": "npm:*" + checksum: 0779740926efc1f856976abd95fcb04f4b45d885ec65ef148505722e15cd8fdf4e84d93bf29908131ae6b040f3ca1c1f0cf9fef1b35d52c90c76ff90cfc1214f languageName: node linkType: hard @@ -909,17 +1873,10 @@ __metadata: languageName: node linkType: hard -"@types/json-schema@npm:^7.0.12": - version: 7.0.12 - resolution: "@types/json-schema@npm:7.0.12" - checksum: 2c39946ae321fe42d085c61a85872a81bbee70f9b2054ad344e8811dfc478fdbaf1ebf5f2989bb87c895ba2dfc3b1dcba85db11e467bbcdc023708814207791c - languageName: node - linkType: hard - -"@types/json5@npm:^0.0.29": - version: 0.0.29 - resolution: "@types/json5@npm:0.0.29" - checksum: 6bf5337bc447b706bb5b4431d37686aa2ea6d07cfd6f79cc31de80170d6ff9b1c7384a9c0ccbc45b3f512bae9e9f75c2e12109806a15331dc94e8a8db6dbb4ac +"@types/istanbul-lib-coverage@npm:^2.0.1": + version: 2.0.6 + resolution: "@types/istanbul-lib-coverage@npm:2.0.6" + checksum: 3948088654f3eeb45363f1db158354fb013b362dba2a5c2c18c559484d5eb9f6fd85b23d66c0a7c2fcfab7308d0a585b14dadaca6cc8bf89ebfdc7f8f5102fb7 languageName: node linkType: hard @@ -930,6 +1887,31 @@ __metadata: languageName: node linkType: hard +"@types/mdast@npm:^3.0.0, @types/mdast@npm:^3.0.11": + version: 3.0.15 + resolution: "@types/mdast@npm:3.0.15" + dependencies: + "@types/unist": "npm:^2" + checksum: fcbf716c03d1ed5465deca60862e9691414f9c43597c288c7d2aefbe274552e1bbd7aeee91b88a02597e88a28c139c57863d0126fcf8416a95fdc681d054ee3d + languageName: node + linkType: hard + +"@types/mdast@npm:^4.0.0": + version: 4.0.3 + resolution: "@types/mdast@npm:4.0.3" + dependencies: + "@types/unist": "npm:*" + checksum: e6994404f5ce58073aa6c1a37ceac3060326470a464e2d751580a9f89e2dbca3a2a6222b849bdaaa5bffbe89033c50a886d17e49fca3b040a4ffcf970e387a0c + languageName: node + linkType: hard + +"@types/mdx@npm:^2.0.0": + version: 2.0.10 + resolution: "@types/mdx@npm:2.0.10" + checksum: a2a5d71967c44c650e883eaaeb61db9c0758b9c1d675e04b7a3cfeeaee6efd5044dc9c78d780aa3fe408a2f85680bf3b723c92a1772bb6c2da35ef346d766de2 + languageName: node + linkType: hard + "@types/minimist@npm:^1.2.0": version: 1.2.2 resolution: "@types/minimist@npm:1.2.2" @@ -937,6 +1919,22 @@ __metadata: languageName: node linkType: hard +"@types/ms@npm:*": + version: 0.7.34 + resolution: "@types/ms@npm:0.7.34" + checksum: ac80bd90012116ceb2d188fde62d96830ca847823e8ca71255616bc73991aa7d9f057b8bfab79e8ee44ffefb031ddd1bcce63ea82f9e66f7c31ec02d2d823ccc + languageName: node + linkType: hard + +"@types/nlcst@npm:^1.0.0": + version: 1.0.4 + resolution: "@types/nlcst@npm:1.0.4" + dependencies: + "@types/unist": "npm:^2" + checksum: 27c60d3330a0f2f94b12f16b55947bf1e87ffdf63c80daa0b9e1eb28811df2051e43a1f6813a54b838b86e7dddced53ae53910354bb6645f130a3968518d5b38 + languageName: node + linkType: hard + "@types/node@npm:*, @types/node@npm:^12.7.1": version: 12.20.55 resolution: "@types/node@npm:12.20.55" @@ -944,6 +1942,13 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^17.0.5": + version: 17.0.45 + resolution: "@types/node@npm:17.0.45" + checksum: 0db377133d709b33a47892581a21a41cd7958f22723a3cc6c71d55ac018121382de42fbfc7970d5ae3e7819dbe5f40e1c6a5174aedf7e7964e9cb8fa72b580b0 + languageName: node + linkType: hard + "@types/normalize-package-data@npm:^2.4.0": version: 2.4.1 resolution: "@types/normalize-package-data@npm:2.4.1" @@ -951,192 +1956,233 @@ __metadata: languageName: node linkType: hard -"@types/semver@npm:^7.5.0": - version: 7.5.0 - resolution: "@types/semver@npm:7.5.0" - checksum: ca4ba4642b5972b6e88e73c5bc02bbaceb8d76bce71748d86e3e95042d4e5a44603113a1dcd2cb9b73ad6f91f6e4ab73185eb41bbfc9c73b11f0ed3db3b7443a +"@types/parse5@npm:^6.0.0": + version: 6.0.3 + resolution: "@types/parse5@npm:6.0.3" + checksum: a7c7ef6625974b74b93c1105953003a2291897e453369efcadc569b907de2784d61d4e6905de3ef959fa07f3278f41ed0c22ead0173776023fc43b6ed31042d0 languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^6.11.0": - version: 6.11.0 - resolution: "@typescript-eslint/eslint-plugin@npm:6.11.0" +"@types/sax@npm:^1.2.1": + version: 1.2.7 + resolution: "@types/sax@npm:1.2.7" dependencies: - "@eslint-community/regexpp": "npm:^4.5.1" - "@typescript-eslint/scope-manager": "npm:6.11.0" - "@typescript-eslint/type-utils": "npm:6.11.0" - "@typescript-eslint/utils": "npm:6.11.0" - "@typescript-eslint/visitor-keys": "npm:6.11.0" - debug: "npm:^4.3.4" - graphemer: "npm:^1.4.0" - ignore: "npm:^5.2.4" - natural-compare: "npm:^1.4.0" - semver: "npm:^7.5.4" - ts-api-utils: "npm:^1.0.1" - peerDependencies: - "@typescript-eslint/parser": ^6.0.0 || ^6.0.0-alpha - eslint: ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 6645aa09b9d51c5e3ea781eaf74da75b94f83f3e2d7b3dd988d5ce7eb82dd87e3509471cf2ee8c6b2428d907df5f1b02f29dbd04f54c2653f9566c8c4ce98009 + "@types/node": "npm:*" + checksum: d077a761a0753b079bf8279b3993948030ca86ed9125437b9b29c1de40db9b2deb7fddc369f014b58861d450e8b8cc75f163aa29dc8cea81952efbfd859168cf + languageName: node + linkType: hard + +"@types/semver@npm:^7.5.0": + version: 7.5.0 + resolution: "@types/semver@npm:7.5.0" + checksum: ca4ba4642b5972b6e88e73c5bc02bbaceb8d76bce71748d86e3e95042d4e5a44603113a1dcd2cb9b73ad6f91f6e4ab73185eb41bbfc9c73b11f0ed3db3b7443a + languageName: node + linkType: hard + +"@types/unist@npm:*, @types/unist@npm:^3.0.0": + version: 3.0.2 + resolution: "@types/unist@npm:3.0.2" + checksum: 39f220ce184a773c55c18a127062bfc4d0d30c987250cd59bab544d97be6cfec93717a49ef96e81f024b575718f798d4d329eb81c452fc57d6d051af8b043ebf + languageName: node + linkType: hard + +"@types/unist@npm:^2, @types/unist@npm:^2.0.0": + version: 2.0.10 + resolution: "@types/unist@npm:2.0.10" + checksum: 5f247dc2229944355209ad5c8e83cfe29419fa7f0a6d557421b1985a1500444719cc9efcc42c652b55aab63c931813c88033e0202c1ac684bcd4829d66e44731 + languageName: node + linkType: hard + +"@ungap/structured-clone@npm:^1.0.0": + version: 1.2.0 + resolution: "@ungap/structured-clone@npm:1.2.0" + checksum: 8209c937cb39119f44eb63cf90c0b73e7c754209a6411c707be08e50e29ee81356dca1a848a405c8bdeebfe2f5e4f831ad310ae1689eeef65e7445c090c6657d languageName: node linkType: hard -"@typescript-eslint/parser@npm:^6.11.0": - version: 6.11.0 - resolution: "@typescript-eslint/parser@npm:6.11.0" +"@vitest/coverage-v8@npm:^1.0.4": + version: 1.0.4 + resolution: "@vitest/coverage-v8@npm:1.0.4" dependencies: - "@typescript-eslint/scope-manager": "npm:6.11.0" - "@typescript-eslint/types": "npm:6.11.0" - "@typescript-eslint/typescript-estree": "npm:6.11.0" - "@typescript-eslint/visitor-keys": "npm:6.11.0" + "@ampproject/remapping": "npm:^2.2.1" + "@bcoe/v8-coverage": "npm:^0.2.3" debug: "npm:^4.3.4" + istanbul-lib-coverage: "npm:^3.2.2" + istanbul-lib-report: "npm:^3.0.1" + istanbul-lib-source-maps: "npm:^4.0.1" + istanbul-reports: "npm:^3.1.6" + magic-string: "npm:^0.30.5" + magicast: "npm:^0.3.2" + picocolors: "npm:^1.0.0" + std-env: "npm:^3.5.0" + test-exclude: "npm:^6.0.0" + v8-to-istanbul: "npm:^9.2.0" peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: e7caeb20069102e21f468fc0dbe7ff6fb6b1efa9e72f4c9f39d4a865ed0633f39130b593ef9ae8f394ca1d70563e15410faf30a482a97809951eaac6ed3a67da + vitest: ^1.0.0 + checksum: e4fb7e7f818a320dcef451193a6aba7b4173a3246695fb5c7b406251c860e10a02f41c3a9678301d6d14e9453bef16de5624658bc3abc11775c708bb20f15ace languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:6.11.0": - version: 6.11.0 - resolution: "@typescript-eslint/scope-manager@npm:6.11.0" +"@vitest/expect@npm:1.0.4": + version: 1.0.4 + resolution: "@vitest/expect@npm:1.0.4" dependencies: - "@typescript-eslint/types": "npm:6.11.0" - "@typescript-eslint/visitor-keys": "npm:6.11.0" - checksum: d8999e2d1a4cbde8a79df5e3ec416f0e3db9532d39f2f4bb5a0ebdf954ae75c183d3277579ba05268fe2c88e88ef87f0fa12f02bb8d95d9e67d92e411241f3a3 + "@vitest/spy": "npm:1.0.4" + "@vitest/utils": "npm:1.0.4" + chai: "npm:^4.3.10" + checksum: a5f3d0ab334938cd70f4d2b44205885532d3d24466617a3c4a230378b6cfa0b5de5f5d9ce80e48508c3cc02dfde1f064ea1126912d7e9f46e18b305b41417f2a languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:6.11.0": - version: 6.11.0 - resolution: "@typescript-eslint/type-utils@npm:6.11.0" +"@vitest/runner@npm:1.0.4": + version: 1.0.4 + resolution: "@vitest/runner@npm:1.0.4" dependencies: - "@typescript-eslint/typescript-estree": "npm:6.11.0" - "@typescript-eslint/utils": "npm:6.11.0" - debug: "npm:^4.3.4" - ts-api-utils: "npm:^1.0.1" - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: ff68f2e052b8d688f1dc1a0050746704c8e0ab6263b47f1f52da73a7d251678e4950af23a95e1cd8e3fcea2457e6e5294ddbe01d29dafa2fdfb5b11ed9452a3f + "@vitest/utils": "npm:1.0.4" + p-limit: "npm:^5.0.0" + pathe: "npm:^1.1.1" + checksum: 4e60471997cbac61c2b7f5e8c701a7459ed51177c709f27c53ffa1e889097782132d21ed816c10cf3bf5dadf82e973c65d6e2210f77aba19f8be9d5e9a1a1002 languageName: node linkType: hard -"@typescript-eslint/types@npm:6.11.0": - version: 6.11.0 - resolution: "@typescript-eslint/types@npm:6.11.0" - checksum: 23182813db39a5e9b9bcc1e85306c953f7b8b22d3885e41fcac0bd725c170fbcb70f4ce55633678cc5921dcf062fa0e55635eb39480c118a4411a00354820223 +"@vitest/snapshot@npm:1.0.4": + version: 1.0.4 + resolution: "@vitest/snapshot@npm:1.0.4" + dependencies: + magic-string: "npm:^0.30.5" + pathe: "npm:^1.1.1" + pretty-format: "npm:^29.7.0" + checksum: 77fc4a7b74f4bce56bfa7ff5bfefa5d9a7511988d3e7e7fc798a877325ed3db4a3252fa343adff1c77482bc18e69f7279290d165fe5688d8f63a4266d2d716a8 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:6.11.0": - version: 6.11.0 - resolution: "@typescript-eslint/typescript-estree@npm:6.11.0" +"@vitest/spy@npm:1.0.4": + version: 1.0.4 + resolution: "@vitest/spy@npm:1.0.4" dependencies: - "@typescript-eslint/types": "npm:6.11.0" - "@typescript-eslint/visitor-keys": "npm:6.11.0" - debug: "npm:^4.3.4" - globby: "npm:^11.1.0" - is-glob: "npm:^4.0.3" - semver: "npm:^7.5.4" - ts-api-utils: "npm:^1.0.1" - peerDependenciesMeta: - typescript: - optional: true - checksum: 3e183e554e1bc74f065da3015f7137eb40c262f989c547701b1e3f4f20134e574e56b749288cd00d77b9d1ddb705546613c2457661ffc63b6060ffa97ba3aac8 + tinyspy: "npm:^2.2.0" + checksum: dece5db1aabc667a549d6e0a382d338fa0bfee684aadf4695d0633e1e30e11ad244d0be2163238598e615dfea683b73b2b095e89cc4854a2a2d6cb528c4bfca8 languageName: node linkType: hard -"@typescript-eslint/utils@npm:6.11.0": - version: 6.11.0 - resolution: "@typescript-eslint/utils@npm:6.11.0" +"@vitest/ui@npm:^1.0.4": + version: 1.0.4 + resolution: "@vitest/ui@npm:1.0.4" dependencies: - "@eslint-community/eslint-utils": "npm:^4.4.0" - "@types/json-schema": "npm:^7.0.12" - "@types/semver": "npm:^7.5.0" - "@typescript-eslint/scope-manager": "npm:6.11.0" - "@typescript-eslint/types": "npm:6.11.0" - "@typescript-eslint/typescript-estree": "npm:6.11.0" - semver: "npm:^7.5.4" + "@vitest/utils": "npm:1.0.4" + fast-glob: "npm:^3.3.2" + fflate: "npm:^0.8.1" + flatted: "npm:^3.2.9" + pathe: "npm:^1.1.1" + picocolors: "npm:^1.0.0" + sirv: "npm:^2.0.3" peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - checksum: c91eb4578607959acc2b43ddc791571682e45601a19b25d5d120786ed4af607656f83c5c1fa71972e549ddfb5542acf2f7d443ae93b32ee28192c22c106b8883 + vitest: ^1.0.0 + checksum: a1b005966f238ba68882bcc1eab8f13814fbc4828116c44c2a1adbd25c2ba56b8ad402a4030337ac1365442b2322d445435ae6ce506f1d60c9d85193d978a989 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:6.11.0": - version: 6.11.0 - resolution: "@typescript-eslint/visitor-keys@npm:6.11.0" +"@vitest/utils@npm:1.0.4": + version: 1.0.4 + resolution: "@vitest/utils@npm:1.0.4" dependencies: - "@typescript-eslint/types": "npm:6.11.0" - eslint-visitor-keys: "npm:^3.4.1" - checksum: 5f48329422b7f286196661d39e93e9defd7c5cf80e6c84c8d03459853f5d9f86a5e91c5e80ea572dcdb907ebbe503bbcc77aeb8b468c294b2aa7b3ccfc81cb88 + diff-sequences: "npm:^29.6.3" + loupe: "npm:^2.3.7" + pretty-format: "npm:^29.7.0" + checksum: 4a87f98b9192f544a6d52232ed1605ac9a6d7418e35de40b4ef36d0d0f6905112a9a21f1393e16f47838e67992399958d524e6b99f6a3583c0a0527fa7557e49 languageName: node linkType: hard -"@ungap/structured-clone@npm:^1.2.0": - version: 1.2.0 - resolution: "@ungap/structured-clone@npm:1.2.0" - checksum: 8209c937cb39119f44eb63cf90c0b73e7c754209a6411c707be08e50e29ee81356dca1a848a405c8bdeebfe2f5e4f831ad310ae1689eeef65e7445c090c6657d +"@volar/kit@npm:~1.10.9": + version: 1.10.10 + resolution: "@volar/kit@npm:1.10.10" + dependencies: + "@volar/language-service": "npm:1.10.10" + typesafe-path: "npm:^0.2.2" + vscode-languageserver-textdocument: "npm:^1.0.11" + vscode-uri: "npm:^3.0.8" + peerDependencies: + typescript: "*" + checksum: 38905c486560404cd6232c9ab5e23d23c925536c2b6be068a1b78f72334f3110cc52b3e3a545e5145f9a7c5887fa0a26daa5ee64b12767b72bd2ff3eeebaae57 languageName: node linkType: hard -"@vitest/expect@npm:0.34.6": - version: 0.34.6 - resolution: "@vitest/expect@npm:0.34.6" +"@volar/language-core@npm:1.10.10, @volar/language-core@npm:~1.10.9": + version: 1.10.10 + resolution: "@volar/language-core@npm:1.10.10" dependencies: - "@vitest/spy": "npm:0.34.6" - "@vitest/utils": "npm:0.34.6" - chai: "npm:^4.3.10" - checksum: d68abc53d673c2c98cad84da4fa73bd407d59a1098ca528c6925c202321d4eeecde5eaf512980614a755200ae1aa6b648d44da09b78ce4cc95aa78eff8ee558a + "@volar/source-map": "npm:1.10.10" + checksum: 286f43bffd8b67230f4a66211d14bb6a15f7adbcd88342a1b2c2a2f283dae33c7aa4be62f58d8e268aee808c0ebe32cf135f76b4f4f952d542ccef2accba7efd languageName: node linkType: hard -"@vitest/runner@npm:0.34.6": - version: 0.34.6 - resolution: "@vitest/runner@npm:0.34.6" +"@volar/language-server@npm:~1.10.9": + version: 1.10.10 + resolution: "@volar/language-server@npm:1.10.10" dependencies: - "@vitest/utils": "npm:0.34.6" - p-limit: "npm:^4.0.0" - pathe: "npm:^1.1.1" - checksum: d00d8c399513693eb6c82fd08b0e32fcf486bede5b88805e8dea90e156d502418477788b501b1c078abd38f0147e99a187061b2da81819e8d5c162a63edf5b40 + "@volar/language-core": "npm:1.10.10" + "@volar/language-service": "npm:1.10.10" + "@volar/typescript": "npm:1.10.10" + "@vscode/l10n": "npm:^0.0.16" + path-browserify: "npm:^1.0.1" + request-light: "npm:^0.7.0" + vscode-languageserver: "npm:^9.0.1" + vscode-languageserver-protocol: "npm:^3.17.5" + vscode-languageserver-textdocument: "npm:^1.0.11" + vscode-uri: "npm:^3.0.8" + checksum: 2863151a14fe41480b5ed1f21e1a93e9bff34f12aab72cf65de7950e1f6ada59729153535a94823d2e68ee3aa3ae8c30106c3f6db3f9d79afb37dda17e79980e languageName: node linkType: hard -"@vitest/snapshot@npm:0.34.6": - version: 0.34.6 - resolution: "@vitest/snapshot@npm:0.34.6" +"@volar/language-service@npm:1.10.10, @volar/language-service@npm:~1.10.9": + version: 1.10.10 + resolution: "@volar/language-service@npm:1.10.10" dependencies: - magic-string: "npm:^0.30.1" - pathe: "npm:^1.1.1" - pretty-format: "npm:^29.5.0" - checksum: 08dbfb3cb6d202116e981abf421096eae920d65bca867c38651b02d2623e25a18e2ead6e5de13a49ebe9f2f9d007b2f692714aa6a5c9f18c3ff17b9f8726dbab + "@volar/language-core": "npm:1.10.10" + "@volar/source-map": "npm:1.10.10" + vscode-languageserver-protocol: "npm:^3.17.5" + vscode-languageserver-textdocument: "npm:^1.0.11" + vscode-uri: "npm:^3.0.8" + checksum: 392ac9f8aae58e81f1f044b939e19c57f6a97d30e9d03a27572eb9c6f326d70d0a8c0e917392e6a00abf36d3cb7b2c0975650e4dcc5ed925098a6ffe7666a757 languageName: node linkType: hard -"@vitest/spy@npm:0.34.6": - version: 0.34.6 - resolution: "@vitest/spy@npm:0.34.6" +"@volar/source-map@npm:1.10.10, @volar/source-map@npm:~1.10.9": + version: 1.10.10 + resolution: "@volar/source-map@npm:1.10.10" dependencies: - tinyspy: "npm:^2.1.1" - checksum: ea36d31c521f4c458f7e439ceeb0d1e5c2e9298aaafad7c9bc5ebe75f36c9b871c1f3a6dcb5bfd6c4e83b34979d511f9a7830fa8720b7e1faa18ef121845e9d5 + muggle-string: "npm:^0.3.1" + checksum: 9ef9b3411ef4281c5fe0d57c04e4c54d5d1ccaaab2355359169789e2b2ee43d2f60774b43104825bbd80bbe934619437c74cfdde6f2a06bd7b499ba4f19a4c26 languageName: node linkType: hard -"@vitest/utils@npm:0.34.6": - version: 0.34.6 - resolution: "@vitest/utils@npm:0.34.6" +"@volar/typescript@npm:1.10.10, @volar/typescript@npm:~1.10.9": + version: 1.10.10 + resolution: "@volar/typescript@npm:1.10.10" dependencies: - diff-sequences: "npm:^29.4.3" - loupe: "npm:^2.3.6" - pretty-format: "npm:^29.5.0" - checksum: 6f32f086b8bf0e8125a11b26cad4ce77ad90943590b55cd1ebb1424412d1feb6d404ee4ded523c346a8f222c265251652b4888f2ede769e3d7fce6fb1ee0a620 + "@volar/language-core": "npm:1.10.10" + path-browserify: "npm:^1.0.1" + checksum: 055bb5c377fcd7298653fa13f945046100ca3976132c6a0e779b5d8f6dec9911789e5ae8e5710479d5611002506b1735e0f9b4e7f17695fc4de39dc78d6ee7fd + languageName: node + linkType: hard + +"@vscode/emmet-helper@npm:^2.9.2": + version: 2.9.2 + resolution: "@vscode/emmet-helper@npm:2.9.2" + dependencies: + emmet: "npm:^2.4.3" + jsonc-parser: "npm:^2.3.0" + vscode-languageserver-textdocument: "npm:^1.0.1" + vscode-languageserver-types: "npm:^3.15.1" + vscode-uri: "npm:^2.1.2" + checksum: f6742e5290341b53d8f13ec04fb112ae659ac8cd5e909cbb81bee1f6fd381a27f56f39e0b06873ea2dc1a3e9af2ea15a24f963038ece68ee1d61eac74325bcb7 + languageName: node + linkType: hard + +"@vscode/l10n@npm:^0.0.16": + version: 0.0.16 + resolution: "@vscode/l10n@npm:0.0.16" + checksum: eca5c65eb1023165f63cf98ee7e7af1c57e32097f8a8ba7590065d8664322b4116f6f467dfa14360b376200bfdacb5612be344f265c217484688a377173fb647 languageName: node linkType: hard @@ -1147,7 +2193,7 @@ __metadata: languageName: node linkType: hard -"acorn-jsx@npm:^5.3.2": +"acorn-jsx@npm:^5.0.0": version: 5.3.2 resolution: "acorn-jsx@npm:5.3.2" peerDependencies: @@ -1156,28 +2202,28 @@ __metadata: languageName: node linkType: hard -"acorn-walk@npm:^8.2.0": - version: 8.2.0 - resolution: "acorn-walk@npm:8.2.0" - checksum: dbe92f5b2452c93e960c5594e666dd1fae141b965ff2cb4a1e1d0381e3e4db4274c5ce4ffa3d681a86ca2a8d4e29d5efc0670a08e23fd2800051ea387df56ca2 +"acorn-walk@npm:^8.3.0": + version: 8.3.1 + resolution: "acorn-walk@npm:8.3.1" + checksum: a23d2f7c6b6cad617f4c77f14dfeb062a239208d61753e9ba808d916c550add92b39535467d2e6028280761ac4f5a904cc9df21530b84d3f834e3edef74ddde5 languageName: node linkType: hard -"acorn@npm:^8.8.2": - version: 8.8.2 - resolution: "acorn@npm:8.8.2" +"acorn@npm:^8.0.0, acorn@npm:^8.10.0": + version: 8.11.2 + resolution: "acorn@npm:8.11.2" bin: acorn: bin/acorn - checksum: b5c54e736af5ed753911c6752fafd02d0a74cf4d55be606bd81fe71faba4f986dc090952329931ac2aba165803fd0005c59eeef08f9c6c689e8dc420031f3df0 + checksum: a3ed76c761b75ec54b1ec3068fb7f113a182e95aea7f322f65098c2958d232e3d211cb6dac35ff9c647024b63714bc528a26d54a925d1fef2c25585b4c8e4017 languageName: node linkType: hard -"acorn@npm:^8.9.0": - version: 8.10.0 - resolution: "acorn@npm:8.10.0" +"acorn@npm:^8.8.2": + version: 8.8.2 + resolution: "acorn@npm:8.8.2" bin: acorn: bin/acorn - checksum: deaeebfbea6e40f6c0e1070e9b0e16e76ba484de54cbd735914d1d41d19169a450de8630b7a3a0c4e271a3b0c0b075a3427ad1a40d8a69f8747c0e8cb02ee3e2 + checksum: b5c54e736af5ed753911c6752fafd02d0a74cf4d55be606bd81fe71faba4f986dc090952329931ac2aba165803fd0005c59eeef08f9c6c689e8dc420031f3df0 languageName: node linkType: hard @@ -1211,15 +2257,12 @@ __metadata: languageName: node linkType: hard -"ajv@npm:^6.12.4": - version: 6.12.6 - resolution: "ajv@npm:6.12.6" +"ansi-align@npm:^3.0.1": + version: 3.0.1 + resolution: "ansi-align@npm:3.0.1" dependencies: - fast-deep-equal: "npm:^3.1.1" - fast-json-stable-stringify: "npm:^2.0.0" - json-schema-traverse: "npm:^0.4.1" - uri-js: "npm:^4.2.2" - checksum: 41e23642cbe545889245b9d2a45854ebba51cda6c778ebced9649420d9205f2efb39cb43dbc41e358409223b1ea43303ae4839db682c848b891e4811da1a5a71 + string-width: "npm:^4.1.0" + checksum: ad8b755a253a1bc8234eb341e0cec68a857ab18bf97ba2bda529e86f6e30460416523e0ec58c32e5c21f0ca470d779503244892873a5895dbd0c39c788e82467 languageName: node linkType: hard @@ -1230,13 +2273,6 @@ __metadata: languageName: node linkType: hard -"ansi-regex@npm:^2.0.0": - version: 2.1.1 - resolution: "ansi-regex@npm:2.1.1" - checksum: 78cebaf50bce2cb96341a7230adf28d804611da3ce6bf338efa7b72f06cc6ff648e29f80cd95e582617ba58d5fdbec38abfeed3500a98bce8381a9daec7c548b - languageName: node - linkType: hard - "ansi-regex@npm:^5.0.1": version: 5.0.1 resolution: "ansi-regex@npm:5.0.1" @@ -1251,10 +2287,10 @@ __metadata: languageName: node linkType: hard -"ansi-styles@npm:^2.2.1": - version: 2.2.1 - resolution: "ansi-styles@npm:2.2.1" - checksum: 7c68aed4f1857389e7a12f85537ea5b40d832656babbf511cc7ecd9efc52889b9c3e5653a71a6aade783c3c5e0aa223ad4ff8e83c27ac8a666514e6c79068cab +"ansi-sequence-parser@npm:^1.1.0": + version: 1.1.1 + resolution: "ansi-sequence-parser@npm:1.1.1" + checksum: ab2259ccf69f145ecf1418d4e71524158828f44afdf37c7536677871f4cebaa8b176fcb95de8f94a68129357dddc59586597da25f9d4ebf9968f6ef022bf0b31 languageName: node linkType: hard @@ -1324,6 +2360,13 @@ __metadata: languageName: node linkType: hard +"arg@npm:^5.0.0": + version: 5.0.2 + resolution: "arg@npm:5.0.2" + checksum: ccaf86f4e05d342af6666c569f844bec426595c567d32a8289715087825c2ca7edd8a3d204e4d2fb2aa4602e09a57d0c13ea8c9eea75aac3dbb4af5514e6800e + languageName: node + linkType: hard + "argparse@npm:^1.0.7": version: 1.0.10 resolution: "argparse@npm:1.0.10" @@ -1350,16 +2393,10 @@ __metadata: languageName: node linkType: hard -"array-includes@npm:^3.1.7": - version: 3.1.7 - resolution: "array-includes@npm:3.1.7" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - get-intrinsic: "npm:^1.2.1" - is-string: "npm:^1.0.7" - checksum: 692907bd7f19d06dc58ccb761f34b58f5dc0b437d2b47a8fe42a1501849a5cf5c27aed3d521a9702667827c2c85a7e75df00a402c438094d87fc43f39ebf9b2b +"array-iterate@npm:^2.0.0": + version: 2.0.1 + resolution: "array-iterate@npm:2.0.1" + checksum: 756c08334f95e290f03ab2141b034514af1311ef7b62f15b0f5ea6f8f3033ee9cc6a8f1c3e9ff4803d4d723cf992aa61460acf5fce884936972db966b1da287d languageName: node linkType: hard @@ -1370,19 +2407,6 @@ __metadata: languageName: node linkType: hard -"array.prototype.findlastindex@npm:^1.2.3": - version: 1.2.3 - resolution: "array.prototype.findlastindex@npm:1.2.3" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - es-shim-unscopables: "npm:^1.0.0" - get-intrinsic: "npm:^1.2.1" - checksum: 2c5c4d3f07512d6729f728f6260a314c00f2eb0a243123092661fa1bc65dce90234c3b483b5f978396eccef6f69c50f0bea248448aaf9cdfcd1cedad6217acbb - languageName: node - linkType: hard - "array.prototype.flat@npm:^1.2.3": version: 1.3.1 resolution: "array.prototype.flat@npm:1.3.1" @@ -1395,45 +2419,6 @@ __metadata: languageName: node linkType: hard -"array.prototype.flat@npm:^1.3.2": - version: 1.3.2 - resolution: "array.prototype.flat@npm:1.3.2" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - es-shim-unscopables: "npm:^1.0.0" - checksum: a578ed836a786efbb6c2db0899ae80781b476200617f65a44846cb1ed8bd8b24c8821b83703375d8af639c689497b7b07277060024b9919db94ac3e10dc8a49b - languageName: node - linkType: hard - -"array.prototype.flatmap@npm:^1.3.2": - version: 1.3.2 - resolution: "array.prototype.flatmap@npm:1.3.2" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - es-shim-unscopables: "npm:^1.0.0" - checksum: 67b3f1d602bb73713265145853128b1ad77cc0f9b833c7e1e056b323fbeac41a4ff1c9c99c7b9445903caea924d9ca2450578d9011913191aa88cc3c3a4b54f4 - languageName: node - linkType: hard - -"arraybuffer.prototype.slice@npm:^1.0.2": - version: 1.0.2 - resolution: "arraybuffer.prototype.slice@npm:1.0.2" - dependencies: - array-buffer-byte-length: "npm:^1.0.0" - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - get-intrinsic: "npm:^1.2.1" - is-array-buffer: "npm:^3.0.2" - is-shared-array-buffer: "npm:^1.0.2" - checksum: 96b6e40e439678ffb7fa266398510074d33c3980fbb475490b69980cca60adec3b0777047ef377068a29862157f83edef42efc64ce48ce38977d04d68de5b7fb - languageName: node - linkType: hard - "arrify@npm:^1.0.1": version: 1.0.1 resolution: "arrify@npm:1.0.1" @@ -1448,6 +2433,98 @@ __metadata: languageName: node linkType: hard +"astring@npm:^1.8.0": + version: 1.8.6 + resolution: "astring@npm:1.8.6" + bin: + astring: bin/astring + checksum: 31f09144597048c11072417959a412f208f8f95ba8dce408dfbc3367acb929f31fbcc00ed5eb61ccbf7c2f1173b9ac8bfcaaa37134a9455050c669b2b036ed88 + languageName: node + linkType: hard + +"astro-expressive-code@npm:^0.29.0": + version: 0.29.2 + resolution: "astro-expressive-code@npm:0.29.2" + dependencies: + remark-expressive-code: "npm:^0.29.2" + peerDependencies: + astro: ^3.0.0-beta + checksum: dd7600d1157850006e9517ef36cd72df4cb236740416ff5b031b6315e96cace98c922aa7f96e3b6f44e95c6e36ec2e7c2d6cf43768f5e19c2c07e0925c13b1cd + languageName: node + linkType: hard + +"astro@npm:^3.6.4": + version: 3.6.4 + resolution: "astro@npm:3.6.4" + dependencies: + "@astrojs/compiler": "npm:^2.3.0" + "@astrojs/internal-helpers": "npm:0.2.1" + "@astrojs/markdown-remark": "npm:3.5.0" + "@astrojs/telemetry": "npm:3.0.4" + "@babel/core": "npm:^7.22.10" + "@babel/generator": "npm:^7.22.10" + "@babel/parser": "npm:^7.22.10" + "@babel/plugin-transform-react-jsx": "npm:^7.22.5" + "@babel/traverse": "npm:^7.22.10" + "@babel/types": "npm:^7.22.10" + "@types/babel__core": "npm:^7.20.1" + acorn: "npm:^8.10.0" + boxen: "npm:^7.1.1" + chokidar: "npm:^3.5.3" + ci-info: "npm:^3.8.0" + clsx: "npm:^2.0.0" + common-ancestor-path: "npm:^1.0.1" + cookie: "npm:^0.5.0" + debug: "npm:^4.3.4" + deterministic-object-hash: "npm:^1.3.1" + devalue: "npm:^4.3.2" + diff: "npm:^5.1.0" + es-module-lexer: "npm:^1.3.0" + esbuild: "npm:^0.19.2" + estree-walker: "npm:^3.0.3" + execa: "npm:^8.0.1" + fast-glob: "npm:^3.3.1" + github-slugger: "npm:^2.0.0" + gray-matter: "npm:^4.0.3" + html-escaper: "npm:^3.0.3" + http-cache-semantics: "npm:^4.1.1" + js-yaml: "npm:^4.1.0" + kleur: "npm:^4.1.4" + magic-string: "npm:^0.30.3" + mdast-util-to-hast: "npm:12.3.0" + mime: "npm:^3.0.0" + ora: "npm:^7.0.1" + p-limit: "npm:^4.0.0" + p-queue: "npm:^7.4.1" + path-to-regexp: "npm:^6.2.1" + preferred-pm: "npm:^3.1.2" + probe-image-size: "npm:^7.2.3" + prompts: "npm:^2.4.2" + rehype: "npm:^12.0.1" + resolve: "npm:^1.22.4" + semver: "npm:^7.5.4" + server-destroy: "npm:^1.0.1" + sharp: "npm:^0.32.5" + shikiji: "npm:^0.6.8" + string-width: "npm:^6.1.0" + strip-ansi: "npm:^7.1.0" + tsconfck: "npm:^3.0.0" + unist-util-visit: "npm:^4.1.2" + vfile: "npm:^5.3.7" + vite: "npm:^4.4.9" + vitefu: "npm:^0.2.4" + which-pm: "npm:^2.1.1" + yargs-parser: "npm:^21.1.1" + zod: "npm:^3.22.4" + dependenciesMeta: + sharp: + optional: true + bin: + astro: astro.js + checksum: 316c4328d597658f81e57731a748b6c866baac1e52b072b20f071065cfc0994c3f216321ac27288169bdfc94706fef0405b7a79c1fdab247f168e64c38f1fcf0 + languageName: node + linkType: hard + "available-typed-arrays@npm:^1.0.5": version: 1.0.5 resolution: "available-typed-arrays@npm:1.0.5" @@ -1455,6 +2532,20 @@ __metadata: languageName: node linkType: hard +"b4a@npm:^1.6.4": + version: 1.6.4 + resolution: "b4a@npm:1.6.4" + checksum: a0af707430c3643fd8d9418c732849d3626f1c9281489e021fcad969fb4808fb9f67b224de36b59c9c3b5a13d853482fee0c0eb53f7aec12d540fa67f63648b6 + languageName: node + linkType: hard + +"bail@npm:^2.0.0": + version: 2.0.2 + resolution: "bail@npm:2.0.2" + checksum: 25cbea309ef6a1f56214187004e8f34014eb015713ea01fa5b9b7e9e776ca88d0fdffd64143ac42dc91966c915a4b7b683411b56e14929fad16153fc026ffb8b + languageName: node + linkType: hard + "balanced-match@npm:^1.0.0": version: 1.0.2 resolution: "balanced-match@npm:1.0.2" @@ -1462,6 +2553,31 @@ __metadata: languageName: node linkType: hard +"base64-js@npm:^1.3.1": + version: 1.5.1 + resolution: "base64-js@npm:1.5.1" + checksum: f23823513b63173a001030fae4f2dabe283b99a9d324ade3ad3d148e218134676f1ee8568c877cd79ec1c53158dcf2d2ba527a97c606618928ba99dd930102bf + languageName: node + linkType: hard + +"bcp-47-match@npm:^2.0.0": + version: 2.0.3 + resolution: "bcp-47-match@npm:2.0.3" + checksum: ae5c202854df8a9ad4777dc3b49562578495a69164869f365a88c1a089837a9fbbce4c0c44f6f1a5e44c7841f47e91fe6fea00306ca49ce5ec95a7eb71f839c4 + languageName: node + linkType: hard + +"bcp-47@npm:^2.1.0": + version: 2.1.0 + resolution: "bcp-47@npm:2.1.0" + dependencies: + is-alphabetical: "npm:^2.0.0" + is-alphanumerical: "npm:^2.0.0" + is-decimal: "npm:^2.0.0" + checksum: 0b461b6d5bad215665e59bc57c4e1489312da541612558629e4f3d3538b16ce6c2709a4b62ec9ed6fca7a339740c27df6a454d5821a849b3df5ff7e697372885 + languageName: node + linkType: hard + "better-path-resolve@npm:1.0.0": version: 1.0.0 resolution: "better-path-resolve@npm:1.0.0" @@ -1478,6 +2594,51 @@ __metadata: languageName: node linkType: hard +"bl@npm:^4.0.3": + version: 4.1.0 + resolution: "bl@npm:4.1.0" + dependencies: + buffer: "npm:^5.5.0" + inherits: "npm:^2.0.4" + readable-stream: "npm:^3.4.0" + checksum: 02847e1d2cb089c9dc6958add42e3cdeaf07d13f575973963335ac0fdece563a50ac770ac4c8fa06492d2dd276f6cc3b7f08c7cd9c7a7ad0f8d388b2a28def5f + languageName: node + linkType: hard + +"bl@npm:^5.0.0": + version: 5.1.0 + resolution: "bl@npm:5.1.0" + dependencies: + buffer: "npm:^6.0.3" + inherits: "npm:^2.0.4" + readable-stream: "npm:^3.4.0" + checksum: 528a9c3d7d6b87af98c46f10a887654d027c28c503c7f7de87440e643f0056d7a2319a967762b8ec18150c64799d2825a277147a752a0570a7407c0b705b0d01 + languageName: node + linkType: hard + +"boolbase@npm:^1.0.0": + version: 1.0.0 + resolution: "boolbase@npm:1.0.0" + checksum: e4b53deb4f2b85c52be0e21a273f2045c7b6a6ea002b0e139c744cb6f95e9ec044439a52883b0d74dedd1ff3da55ed140cfdddfed7fb0cccbed373de5dce1bcf + languageName: node + linkType: hard + +"boxen@npm:^7.1.1": + version: 7.1.1 + resolution: "boxen@npm:7.1.1" + dependencies: + ansi-align: "npm:^3.0.1" + camelcase: "npm:^7.0.1" + chalk: "npm:^5.2.0" + cli-boxes: "npm:^3.0.0" + string-width: "npm:^5.1.2" + type-fest: "npm:^2.13.0" + widest-line: "npm:^4.0.1" + wrap-ansi: "npm:^8.1.0" + checksum: 3a9891dc98ac40d582c9879e8165628258e2c70420c919e70fff0a53ccc7b42825e73cda6298199b2fbc1f41f5d5b93b492490ad2ae27623bed3897ddb4267f8 + languageName: node + linkType: hard + "brace-expansion@npm:^1.1.7": version: 1.1.11 resolution: "brace-expansion@npm:1.1.11" @@ -1515,6 +2676,40 @@ __metadata: languageName: node linkType: hard +"browserslist@npm:^4.21.9": + version: 4.22.2 + resolution: "browserslist@npm:4.22.2" + dependencies: + caniuse-lite: "npm:^1.0.30001565" + electron-to-chromium: "npm:^1.4.601" + node-releases: "npm:^2.0.14" + update-browserslist-db: "npm:^1.0.13" + bin: + browserslist: cli.js + checksum: 2a331aab90503130043ca41dd5d281fa1e89d5e076d07a2d75e76bf4d693bd56e73d5abcd8c4f39119da6328d450578c216cf1cd5c99b82d8a90a2ae6271b465 + languageName: node + linkType: hard + +"buffer@npm:^5.5.0": + version: 5.7.1 + resolution: "buffer@npm:5.7.1" + dependencies: + base64-js: "npm:^1.3.1" + ieee754: "npm:^1.1.13" + checksum: 27cac81cff434ed2876058d72e7c4789d11ff1120ef32c9de48f59eab58179b66710c488987d295ae89a228f835fc66d088652dffeb8e3ba8659f80eb091d55e + languageName: node + linkType: hard + +"buffer@npm:^6.0.3": + version: 6.0.3 + resolution: "buffer@npm:6.0.3" + dependencies: + base64-js: "npm:^1.3.1" + ieee754: "npm:^1.2.1" + checksum: 2a905fbbcde73cc5d8bd18d1caa23715d5f83a5935867c2329f0ac06104204ba7947be098fe1317fbd8830e26090ff8e764f08cd14fefc977bb248c3487bcbd0 + languageName: node + linkType: hard + "bundle-require@npm:^4.0.0": version: 4.0.1 resolution: "bundle-require@npm:4.0.1" @@ -1563,24 +2758,6 @@ __metadata: languageName: node linkType: hard -"call-bind@npm:^1.0.4, call-bind@npm:^1.0.5": - version: 1.0.5 - resolution: "call-bind@npm:1.0.5" - dependencies: - function-bind: "npm:^1.1.2" - get-intrinsic: "npm:^1.2.1" - set-function-length: "npm:^1.1.1" - checksum: a6172c168fd6dacf744fcde745099218056bd755c50415b592655dcd6562157ed29f130f56c3f6db2250f67e4bd62e5c218cdc56d7bfd76e0bda50770fce2d10 - languageName: node - linkType: hard - -"callsites@npm:^3.0.0": - version: 3.1.0 - resolution: "callsites@npm:3.1.0" - checksum: fff92277400eb06c3079f9e74f3af120db9f8ea03bad0e84d9aede54bbe2d44a56cccb5f6cf12211f93f52306df87077ecec5b712794c5a9b5dac6d615a3f301 - languageName: node - linkType: hard - "camelcase-keys@npm:^6.2.2": version: 6.2.2 resolution: "camelcase-keys@npm:6.2.2" @@ -1599,6 +2776,27 @@ __metadata: languageName: node linkType: hard +"camelcase@npm:^7.0.1": + version: 7.0.1 + resolution: "camelcase@npm:7.0.1" + checksum: 3adfc9a0e96d51b3a2f4efe90a84dad3e206aaa81dfc664f1bd568270e1bf3b010aad31f01db16345b4ffe1910e16ab411c7273a19a859addd1b98ef7cf4cfbd + languageName: node + linkType: hard + +"caniuse-lite@npm:^1.0.30001565": + version: 1.0.30001566 + resolution: "caniuse-lite@npm:1.0.30001566" + checksum: cd163075b1a9feaf9c9f657c3551279fcdac471471d67ee57ab2286c7b5480168e6336e359741b469fa40e94716f0f95ec185d87bd57d58894d66d8c21d7db04 + languageName: node + linkType: hard + +"ccount@npm:^2.0.0": + version: 2.0.1 + resolution: "ccount@npm:2.0.1" + checksum: 3939b1664390174484322bc3f45b798462e6c07ee6384cb3d645e0aa2f318502d174845198c1561930e1d431087f74cf1fe291ae9a4722821a9f4ba67e574350 + languageName: node + linkType: hard + "chai@npm:^4.3.10": version: 4.3.10 resolution: "chai@npm:4.3.10" @@ -1614,20 +2812,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^1.1.3": - version: 1.1.3 - resolution: "chalk@npm:1.1.3" - dependencies: - ansi-styles: "npm:^2.2.1" - escape-string-regexp: "npm:^1.0.2" - has-ansi: "npm:^2.0.0" - strip-ansi: "npm:^3.0.0" - supports-color: "npm:^2.0.0" - checksum: 28c3e399ec286bb3a7111fd4225ebedb0d7b813aef38a37bca7c498d032459c265ef43404201d5fbb8d888d29090899c95335b4c0cda13e8b126ff15c541cef8 - languageName: node - linkType: hard - -"chalk@npm:^2.0.0, chalk@npm:^2.1.0": +"chalk@npm:^2.0.0, chalk@npm:^2.1.0, chalk@npm:^2.4.2": version: 2.4.2 resolution: "chalk@npm:2.4.2" dependencies: @@ -1638,7 +2823,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^4.0.0, chalk@npm:^4.1.2": +"chalk@npm:^4.1.2": version: 4.1.2 resolution: "chalk@npm:4.1.2" dependencies: @@ -1648,6 +2833,41 @@ __metadata: languageName: node linkType: hard +"chalk@npm:^5.0.0, chalk@npm:^5.2.0, chalk@npm:^5.3.0": + version: 5.3.0 + resolution: "chalk@npm:5.3.0" + checksum: 8297d436b2c0f95801103ff2ef67268d362021b8210daf8ddbe349695333eb3610a71122172ff3b0272f1ef2cf7cc2c41fdaa4715f52e49ffe04c56340feed09 + languageName: node + linkType: hard + +"character-entities-html4@npm:^2.0.0": + version: 2.1.0 + resolution: "character-entities-html4@npm:2.1.0" + checksum: fe61b553f083400c20c0b0fd65095df30a0b445d960f3bbf271536ae6c3ba676f39cb7af0b4bf2755812f08ab9b88f2feed68f9aebb73bb153f7a115fe5c6e40 + languageName: node + linkType: hard + +"character-entities-legacy@npm:^3.0.0": + version: 3.0.0 + resolution: "character-entities-legacy@npm:3.0.0" + checksum: ec4b430af873661aa754a896a2b55af089b4e938d3d010fad5219299a6b6d32ab175142699ee250640678cd64bdecd6db3c9af0b8759ab7b155d970d84c4c7d1 + languageName: node + linkType: hard + +"character-entities@npm:^2.0.0": + version: 2.0.2 + resolution: "character-entities@npm:2.0.2" + checksum: b0c645a45bcc90ff24f0e0140f4875a8436b8ef13b6bcd31ec02cfb2ca502b680362aa95386f7815bdc04b6464d48cf191210b3840d7c04241a149ede591a308 + languageName: node + linkType: hard + +"character-reference-invalid@npm:^2.0.0": + version: 2.0.1 + resolution: "character-reference-invalid@npm:2.0.1" + checksum: 2ae0dec770cd8659d7e8b0ce24392d83b4c2f0eb4a3395c955dce5528edd4cc030a794cfa06600fcdd700b3f2de2f9b8e40e309c0011c4180e3be64a0b42e6a1 + languageName: node + linkType: hard + "chardet@npm:^0.7.0": version: 0.7.0 resolution: "chardet@npm:0.7.0" @@ -1664,7 +2884,7 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:^3.5.1": +"chokidar@npm:^3.5.1, chokidar@npm:^3.5.3": version: 3.5.3 resolution: "chokidar@npm:3.5.3" dependencies: @@ -1683,6 +2903,13 @@ __metadata: languageName: node linkType: hard +"chownr@npm:^1.1.1": + version: 1.1.4 + resolution: "chownr@npm:1.1.4" + checksum: ed57952a84cc0c802af900cf7136de643d3aba2eecb59d29344bc2f3f9bf703a301b9d84cdc71f82c3ffc9ccde831b0d92f5b45f91727d6c9da62f23aef9d9db + languageName: node + linkType: hard + "chownr@npm:^2.0.0": version: 2.0.0 resolution: "chownr@npm:2.0.0" @@ -1697,6 +2924,13 @@ __metadata: languageName: node linkType: hard +"ci-info@npm:^3.8.0": + version: 3.9.0 + resolution: "ci-info@npm:3.9.0" + checksum: 6f0109e36e111684291d46123d491bc4e7b7a1934c3a20dea28cba89f1d4a03acd892f5f6a81ed3855c38647e285a150e3c9ba062e38943bef57fee6c1554c3a + languageName: node + linkType: hard + "clean-stack@npm:^2.0.0": version: 2.2.0 resolution: "clean-stack@npm:2.2.0" @@ -1704,10 +2938,33 @@ __metadata: languageName: node linkType: hard -"cliui@npm:^6.0.0": - version: 6.0.0 - resolution: "cliui@npm:6.0.0" - dependencies: +"cli-boxes@npm:^3.0.0": + version: 3.0.0 + resolution: "cli-boxes@npm:3.0.0" + checksum: 4db3e8fbfaf1aac4fb3a6cbe5a2d3fa048bee741a45371b906439b9ffc821c6e626b0f108bdcd3ddf126a4a319409aedcf39a0730573ff050fdd7b6731e99fb9 + languageName: node + linkType: hard + +"cli-cursor@npm:^4.0.0": + version: 4.0.0 + resolution: "cli-cursor@npm:4.0.0" + dependencies: + restore-cursor: "npm:^4.0.0" + checksum: e776e8c3c6727300d0539b0d25160b2bb56aed1a63942753ba1826b012f337a6f4b7ace3548402e4f2f13b5e16bfd751be672c44b203205e7eca8be94afec42c + languageName: node + linkType: hard + +"cli-spinners@npm:^2.9.0": + version: 2.9.2 + resolution: "cli-spinners@npm:2.9.2" + checksum: 907a1c227ddf0d7a101e7ab8b300affc742ead4b4ebe920a5bf1bc6d45dce2958fcd195eb28fa25275062fe6fa9b109b93b63bc8033396ed3bcb50297008b3a3 + languageName: node + linkType: hard + +"cliui@npm:^6.0.0": + version: 6.0.0 + resolution: "cliui@npm:6.0.0" + dependencies: string-width: "npm:^4.2.0" strip-ansi: "npm:^6.0.0" wrap-ansi: "npm:^6.2.0" @@ -1733,6 +2990,13 @@ __metadata: languageName: node linkType: hard +"clsx@npm:^2.0.0": + version: 2.0.0 + resolution: "clsx@npm:2.0.0" + checksum: c09f43b3144a0b7826b6b11b6a111b2c7440831004eecc02d333533c5e58ef0aa5f2dce071d3b25fbb8c8ea97b45df96c74bcc1d51c8c2027eb981931107b0cd + languageName: node + linkType: hard + "color-convert@npm:^1.9.0": version: 1.9.3 resolution: "color-convert@npm:1.9.3" @@ -1758,13 +3022,23 @@ __metadata: languageName: node linkType: hard -"color-name@npm:~1.1.4": +"color-name@npm:^1.0.0, color-name@npm:~1.1.4": version: 1.1.4 resolution: "color-name@npm:1.1.4" checksum: a1a3f914156960902f46f7f56bc62effc6c94e84b2cae157a526b1c1f74b677a47ec602bf68a61abfa2b42d15b7c5651c6dbe72a43af720bc588dff885b10f95 languageName: node linkType: hard +"color-string@npm:^1.9.0": + version: 1.9.1 + resolution: "color-string@npm:1.9.1" + dependencies: + color-name: "npm:^1.0.0" + simple-swizzle: "npm:^0.2.2" + checksum: b0bfd74c03b1f837f543898b512f5ea353f71630ccdd0d66f83028d1f0924a7d4272deb278b9aef376cacf1289b522ac3fb175e99895283645a2dc3a33af2404 + languageName: node + linkType: hard + "color-support@npm:^1.1.3": version: 1.1.3 resolution: "color-support@npm:1.1.3" @@ -1774,6 +3048,23 @@ __metadata: languageName: node linkType: hard +"color@npm:^4.2.3": + version: 4.2.3 + resolution: "color@npm:4.2.3" + dependencies: + color-convert: "npm:^2.0.1" + color-string: "npm:^1.9.0" + checksum: 7fbe7cfb811054c808349de19fb380252e5e34e61d7d168ec3353e9e9aacb1802674bddc657682e4e9730c2786592a4de6f8283e7e0d3870b829bb0b7b2f6118 + languageName: node + linkType: hard + +"comma-separated-tokens@npm:^2.0.0": + version: 2.0.3 + resolution: "comma-separated-tokens@npm:2.0.3" + checksum: 91f90f1aae320f1755d6957ef0b864fe4f54737f3313bd95e0802686ee2ca38bff1dd381964d00ae5db42912dd1f4ae5c2709644e82706ffc6f6842a813cdd67 + languageName: node + linkType: hard + "commander@npm:^4.0.0": version: 4.1.1 resolution: "commander@npm:4.1.1" @@ -1781,6 +3072,13 @@ __metadata: languageName: node linkType: hard +"common-ancestor-path@npm:^1.0.1": + version: 1.0.1 + resolution: "common-ancestor-path@npm:1.0.1" + checksum: 390c08d2a67a7a106d39499c002d827d2874966d938012453fd7ca34cd306881e2b9d604f657fa7a8e6e4896d67f39ebc09bf1bfd8da8ff318e0fb7a8752c534 + languageName: node + linkType: hard + "concat-map@npm:0.0.1": version: 0.0.1 resolution: "concat-map@npm:0.0.1" @@ -1795,13 +3093,17 @@ __metadata: languageName: node linkType: hard -"cross-spawn@npm:^4.0.0": - version: 4.0.2 - resolution: "cross-spawn@npm:4.0.2" - dependencies: - lru-cache: "npm:^4.0.1" - which: "npm:^1.2.9" - checksum: 4de7254653b658776be8e1050473349723d2ac8bc10b912fbeb159ad32d06c7fa2135b04b896b7cbe0141d274dae9d7543cc6e5c9c919e2062e44a66c2184665 +"convert-source-map@npm:^2.0.0": + version: 2.0.0 + resolution: "convert-source-map@npm:2.0.0" + checksum: 8f2f7a27a1a011cc6cc88cc4da2d7d0cfa5ee0369508baae3d98c260bb3ac520691464e5bbe4ae7cdf09860c1d69ecc6f70c63c6e7c7f7e3f18ec08484dc7d9b + languageName: node + linkType: hard + +"cookie@npm:^0.5.0": + version: 0.5.0 + resolution: "cookie@npm:0.5.0" + checksum: c01ca3ef8d7b8187bae434434582288681273b5a9ed27521d4d7f9f7928fe0c920df0decd9f9d3bbd2d14ac432b8c8cf42b98b3bdd5bfe0e6edddeebebe8b61d languageName: node linkType: hard @@ -1816,7 +3118,7 @@ __metadata: languageName: node linkType: hard -"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": +"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" dependencies: @@ -1827,6 +3129,22 @@ __metadata: languageName: node linkType: hard +"css-selector-parser@npm:^1.0.0": + version: 1.4.1 + resolution: "css-selector-parser@npm:1.4.1" + checksum: 4a89a7b61072cf0e4d09e8abbb9a77bc661232b6fe6a6fe51ba775757bae0e3fc462b0db4c9a857da55afb89a1c1746a7b2ec1200f639c539556ebdc758b0101 + languageName: node + linkType: hard + +"cssesc@npm:^3.0.0": + version: 3.0.0 + resolution: "cssesc@npm:3.0.0" + bin: + cssesc: bin/cssesc + checksum: 6bcfd898662671be15ae7827120472c5667afb3d7429f1f917737f3bf84c4176003228131b643ae74543f17a394446247df090c597bb9a728cce298606ed0aa7 + languageName: node + linkType: hard + "csv-generate@npm:^3.4.3": version: 3.4.3 resolution: "csv-generate@npm:3.4.3" @@ -1867,7 +3185,16 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": +"debug@npm:2": + version: 2.6.9 + resolution: "debug@npm:2.6.9" + dependencies: + ms: "npm:2.0.0" + checksum: 121908fb839f7801180b69a7e218a40b5a0b718813b886b7d6bdb82001b931c938e2941d1e4450f33a1b1df1da653f5f7a0440c197f29fbf8a6e9d45ff6ef589 + languageName: node + linkType: hard + +"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.3, debug@npm:^4.3.4": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -1879,7 +3206,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:^3.2.7": +"debug@npm:^3.2.6": version: 3.2.7 resolution: "debug@npm:3.2.7" dependencies: @@ -1905,6 +3232,24 @@ __metadata: languageName: node linkType: hard +"decode-named-character-reference@npm:^1.0.0": + version: 1.0.2 + resolution: "decode-named-character-reference@npm:1.0.2" + dependencies: + character-entities: "npm:^2.0.0" + checksum: 66a9fc5d9b5385a2b3675c69ba0d8e893393d64057f7dbbb585265bb4fc05ec513d76943b8e5aac7d8016d20eea4499322cbf4cd6d54b466976b78f3a7587a4c + languageName: node + linkType: hard + +"decompress-response@npm:^6.0.0": + version: 6.0.0 + resolution: "decompress-response@npm:6.0.0" + dependencies: + mimic-response: "npm:^3.1.0" + checksum: bd89d23141b96d80577e70c54fb226b2f40e74a6817652b80a116d7befb8758261ad073a8895648a29cc0a5947021ab66705cb542fa9c143c82022b27c5b175e + languageName: node + linkType: hard + "deep-eql@npm:^4.1.3": version: 4.1.3 resolution: "deep-eql@npm:4.1.3" @@ -1914,10 +3259,10 @@ __metadata: languageName: node linkType: hard -"deep-is@npm:^0.1.3": - version: 0.1.4 - resolution: "deep-is@npm:0.1.4" - checksum: 7f0ee496e0dff14a573dc6127f14c95061b448b87b995fc96c017ce0a1e66af1675e73f1d6064407975bc4ea6ab679497a29fff7b5b9c4e99cb10797c1ad0b4c +"deep-extend@npm:^0.6.0": + version: 0.6.0 + resolution: "deep-extend@npm:0.6.0" + checksum: 1c6b0abcdb901e13a44c7d699116d3d4279fdb261983122a3783e7273844d5f2537dc2e1c454a23fcf645917f93fbf8d07101c1d03c015a87faa662755212566 languageName: node linkType: hard @@ -1930,18 +3275,7 @@ __metadata: languageName: node linkType: hard -"define-data-property@npm:^1.0.1, define-data-property@npm:^1.1.1": - version: 1.1.1 - resolution: "define-data-property@npm:1.1.1" - dependencies: - get-intrinsic: "npm:^1.2.1" - gopd: "npm:^1.0.1" - has-property-descriptors: "npm:^1.0.0" - checksum: 77ef6e0bceb515e05b5913ab635a84d537cee84f8a7c37c77fdcb31fc5b80f6dbe81b33375e4b67d96aa04e6a0d8d4ea099e431d83f089af8d93adfb584bcb94 - languageName: node - linkType: hard - -"define-properties@npm:^1.1.3, define-properties@npm:^1.1.4, define-properties@npm:^1.2.0": +"define-properties@npm:^1.1.3, define-properties@npm:^1.1.4": version: 1.2.0 resolution: "define-properties@npm:1.2.0" dependencies: @@ -1965,6 +3299,13 @@ __metadata: languageName: node linkType: hard +"dequal@npm:^2.0.0": + version: 2.0.3 + resolution: "dequal@npm:2.0.3" + checksum: f98860cdf58b64991ae10205137c0e97d384c3a4edc7f807603887b7c4b850af1224a33d88012009f150861cbee4fa2d322c4cc04b9313bee312e47f6ecaa888 + languageName: node + linkType: hard + "detect-indent@npm:^6.0.0": version: 6.1.0 resolution: "detect-indent@npm:6.1.0" @@ -1972,10 +3313,47 @@ __metadata: languageName: node linkType: hard -"diff-sequences@npm:^29.4.3": - version: 29.4.3 - resolution: "diff-sequences@npm:29.4.3" - checksum: 183800b9fd8523a05a3a50ade0fafe81d4b8a8ac113b077d2bc298052ccdc081e3b896f19bf65768b536daebd8169a493c4764cb70a2195e14c442c12538d121 +"detect-libc@npm:^2.0.0, detect-libc@npm:^2.0.2": + version: 2.0.2 + resolution: "detect-libc@npm:2.0.2" + checksum: a9f4ffcd2701525c589617d98afe5a5d0676c8ea82bcc4ed6f3747241b79f781d36437c59a5e855254c864d36a3e9f8276568b6b531c28d6e53b093a15703f11 + languageName: node + linkType: hard + +"deterministic-object-hash@npm:^1.3.1": + version: 1.3.1 + resolution: "deterministic-object-hash@npm:1.3.1" + checksum: 9cbb5c8840c819b526d8507953b1edcd0301223298c0149aa370f0aef2a72eaffb062c21ef863d2d029f52bcdf12d31a10d65931deb13a94ebd4bd4e36e574f7 + languageName: node + linkType: hard + +"devalue@npm:^4.3.2": + version: 4.3.2 + resolution: "devalue@npm:4.3.2" + checksum: ea654d4670efa8a9c8cd2d445226a44570921d62597b3460ae3ead3d556cd445c9bad8dd13c15dadd866ddb5e54f37d9afa7549da27591586a94b01de897182d + languageName: node + linkType: hard + +"devlop@npm:^1.0.0": + version: 1.1.0 + resolution: "devlop@npm:1.1.0" + dependencies: + dequal: "npm:^2.0.0" + checksum: e0928ab8f94c59417a2b8389c45c55ce0a02d9ac7fd74ef62d01ba48060129e1d594501b77de01f3eeafc7cb00773819b0df74d96251cf20b31c5b3071f45c0e + languageName: node + linkType: hard + +"diff-sequences@npm:^29.6.3": + version: 29.6.3 + resolution: "diff-sequences@npm:29.6.3" + checksum: 32e27ac7dbffdf2fb0eb5a84efd98a9ad084fbabd5ac9abb8757c6770d5320d2acd172830b28c4add29bb873d59420601dfc805ac4064330ce59b1adfd0593b2 + languageName: node + linkType: hard + +"diff@npm:^5.0.0, diff@npm:^5.1.0": + version: 5.1.0 + resolution: "diff@npm:5.1.0" + checksum: 77a0d9beb9ed54796154ac2511872288432124ac90a1cabb1878783c9b4d81f1847f3b746a0630b1e836181461d2c76e1e6b95559bef86ed16294d114862e364 languageName: node linkType: hard @@ -1988,21 +3366,19 @@ __metadata: languageName: node linkType: hard -"doctrine@npm:^2.1.0": - version: 2.1.0 - resolution: "doctrine@npm:2.1.0" - dependencies: - esutils: "npm:^2.0.2" - checksum: b6416aaff1f380bf56c3b552f31fdf7a69b45689368deca72d28636f41c16bb28ec3ebc40ace97db4c1afc0ceeb8120e8492fe0046841c94c2933b2e30a7d5ac +"direction@npm:^2.0.0": + version: 2.0.1 + resolution: "direction@npm:2.0.1" + bin: + direction: cli.js + checksum: dce809431cad978e0778769a3818ea797ebe0bd542c85032ad9ad98971e2021a146be62feb259d7ffe4b76739e07b23e861b29c3f184ac8d38cc6ba956d5c586 languageName: node linkType: hard -"doctrine@npm:^3.0.0": - version: 3.0.0 - resolution: "doctrine@npm:3.0.0" - dependencies: - esutils: "npm:^2.0.2" - checksum: c96bdccabe9d62ab6fea9399fdff04a66e6563c1d6fb3a3a063e8d53c3bb136ba63e84250bbf63d00086a769ad53aef92d2bd483f03f837fc97b71cbee6b2520 +"dlv@npm:^1.1.3": + version: 1.1.3 + resolution: "dlv@npm:1.1.3" + checksum: 03eb4e769f19a027fd5b43b59e8a05e3fd2100ac239ebb0bf9a745de35d449e2f25cfaf3aa3934664551d72856f4ae8b7822016ce5c42c2d27c18ae79429ec42 languageName: node linkType: hard @@ -2013,10 +3389,10 @@ __metadata: languageName: node linkType: hard -"duplexer@npm:~0.1.1": - version: 0.1.2 - resolution: "duplexer@npm:0.1.2" - checksum: c57bcd4bdf7e623abab2df43a7b5b23d18152154529d166c1e0da6bee341d84c432d157d7e97b32fecb1bf3a8b8857dd85ed81a915789f550637ed25b8e64fc2 +"dset@npm:^3.1.2": + version: 3.1.3 + resolution: "dset@npm:3.1.3" + checksum: b1ff68f1f42af373baa85b00b04d89094cd0d7f74f94bd11364cba575f2762ed52a0a0503bbfcc92eccd07c6d55426813c8a7a6cfa020338eaea1f4edfd332c2 languageName: node linkType: hard @@ -2027,6 +3403,30 @@ __metadata: languageName: node linkType: hard +"electron-to-chromium@npm:^1.4.601": + version: 1.4.601 + resolution: "electron-to-chromium@npm:1.4.601" + checksum: 345226e9edff5b72bd431b5bec1eaabc3c85e430fa0171586b539c64e5bde7c161cad6387e657ab8e0f197a894c1679f19c60f687baad12118a06e1db543cf95 + languageName: node + linkType: hard + +"emmet@npm:^2.4.3": + version: 2.4.6 + resolution: "emmet@npm:2.4.6" + dependencies: + "@emmetio/abbreviation": "npm:^2.3.3" + "@emmetio/css-abbreviation": "npm:^2.1.8" + checksum: 3dff4465e678de35ecd60e7b7bcd9ec4f53d41de687eb07c14a420c619c6742829bca81cd1cc12c5ef189b798ba4a2ebd3b920db813093f36ade79b03409bf9d + languageName: node + linkType: hard + +"emoji-regex@npm:^10.2.1": + version: 10.3.0 + resolution: "emoji-regex@npm:10.3.0" + checksum: b4838e8dcdceb44cf47f59abe352c25ff4fe7857acaf5fb51097c427f6f75b44d052eb907a7a3b86f86bc4eae3a93f5c2b7460abe79c407307e6212d65c91163 + languageName: node + linkType: hard + "emoji-regex@npm:^8.0.0": version: 8.0.0 resolution: "emoji-regex@npm:8.0.0" @@ -2050,6 +3450,15 @@ __metadata: languageName: node linkType: hard +"end-of-stream@npm:^1.1.0, end-of-stream@npm:^1.4.1": + version: 1.4.4 + resolution: "end-of-stream@npm:1.4.4" + dependencies: + once: "npm:^1.4.0" + checksum: 870b423afb2d54bb8d243c63e07c170409d41e20b47eeef0727547aea5740bd6717aca45597a9f2745525667a6b804c1e7bede41f856818faee5806dd9ff3975 + languageName: node + linkType: hard + "enquirer@npm:^2.3.0": version: 2.3.6 resolution: "enquirer@npm:2.3.6" @@ -2059,6 +3468,13 @@ __metadata: languageName: node linkType: hard +"entities@npm:^4.4.0": + version: 4.5.0 + resolution: "entities@npm:4.5.0" + checksum: 5b039739f7621f5d1ad996715e53d964035f75ad3b9a4d38c6b3804bb226e282ffeae2443624d8fdd9c47d8e926ae9ac009c54671243f0c3294c26af7cc85250 + languageName: node + linkType: hard + "env-paths@npm:^2.2.0": version: 2.2.1 resolution: "env-paths@npm:2.2.1" @@ -2073,7 +3489,7 @@ __metadata: languageName: node linkType: hard -"error-ex@npm:^1.2.0, error-ex@npm:^1.3.1": +"error-ex@npm:^1.3.1": version: 1.3.2 resolution: "error-ex@npm:1.3.2" dependencies: @@ -2124,50 +3540,10 @@ __metadata: languageName: node linkType: hard -"es-abstract@npm:^1.22.1": - version: 1.22.3 - resolution: "es-abstract@npm:1.22.3" - dependencies: - array-buffer-byte-length: "npm:^1.0.0" - arraybuffer.prototype.slice: "npm:^1.0.2" - available-typed-arrays: "npm:^1.0.5" - call-bind: "npm:^1.0.5" - es-set-tostringtag: "npm:^2.0.1" - es-to-primitive: "npm:^1.2.1" - function.prototype.name: "npm:^1.1.6" - get-intrinsic: "npm:^1.2.2" - get-symbol-description: "npm:^1.0.0" - globalthis: "npm:^1.0.3" - gopd: "npm:^1.0.1" - has-property-descriptors: "npm:^1.0.0" - has-proto: "npm:^1.0.1" - has-symbols: "npm:^1.0.3" - hasown: "npm:^2.0.0" - internal-slot: "npm:^1.0.5" - is-array-buffer: "npm:^3.0.2" - is-callable: "npm:^1.2.7" - is-negative-zero: "npm:^2.0.2" - is-regex: "npm:^1.1.4" - is-shared-array-buffer: "npm:^1.0.2" - is-string: "npm:^1.0.7" - is-typed-array: "npm:^1.1.12" - is-weakref: "npm:^1.0.2" - object-inspect: "npm:^1.13.1" - object-keys: "npm:^1.1.1" - object.assign: "npm:^4.1.4" - regexp.prototype.flags: "npm:^1.5.1" - safe-array-concat: "npm:^1.0.1" - safe-regex-test: "npm:^1.0.0" - string.prototype.trim: "npm:^1.2.8" - string.prototype.trimend: "npm:^1.0.7" - string.prototype.trimstart: "npm:^1.0.7" - typed-array-buffer: "npm:^1.0.0" - typed-array-byte-length: "npm:^1.0.0" - typed-array-byte-offset: "npm:^1.0.0" - typed-array-length: "npm:^1.0.4" - unbox-primitive: "npm:^1.0.2" - which-typed-array: "npm:^1.1.13" - checksum: da31ec43b1c8eb47ba8a17693cac143682a1078b6c3cd883ce0e2062f135f532e93d873694ef439670e1f6ca03195118f43567ba6f33fb0d6c7daae750090236 +"es-module-lexer@npm:^1.3.0": + version: 1.4.1 + resolution: "es-module-lexer@npm:1.4.1" + checksum: b7260a138668554d3f0ddcc728cb4b60c2fa463f15545cf155ecbdd5450a1348952d58298a7f48642e900ee579f21d7f5304b6b3c61b3d9fc2d4b2109b5a9dff languageName: node linkType: hard @@ -2356,6 +3732,83 @@ __metadata: languageName: node linkType: hard +"esbuild@npm:^0.19.3": + version: 0.19.9 + resolution: "esbuild@npm:0.19.9" + dependencies: + "@esbuild/android-arm": "npm:0.19.9" + "@esbuild/android-arm64": "npm:0.19.9" + "@esbuild/android-x64": "npm:0.19.9" + "@esbuild/darwin-arm64": "npm:0.19.9" + "@esbuild/darwin-x64": "npm:0.19.9" + "@esbuild/freebsd-arm64": "npm:0.19.9" + "@esbuild/freebsd-x64": "npm:0.19.9" + "@esbuild/linux-arm": "npm:0.19.9" + "@esbuild/linux-arm64": "npm:0.19.9" + "@esbuild/linux-ia32": "npm:0.19.9" + "@esbuild/linux-loong64": "npm:0.19.9" + "@esbuild/linux-mips64el": "npm:0.19.9" + "@esbuild/linux-ppc64": "npm:0.19.9" + "@esbuild/linux-riscv64": "npm:0.19.9" + "@esbuild/linux-s390x": "npm:0.19.9" + "@esbuild/linux-x64": "npm:0.19.9" + "@esbuild/netbsd-x64": "npm:0.19.9" + "@esbuild/openbsd-x64": "npm:0.19.9" + "@esbuild/sunos-x64": "npm:0.19.9" + "@esbuild/win32-arm64": "npm:0.19.9" + "@esbuild/win32-ia32": "npm:0.19.9" + "@esbuild/win32-x64": "npm:0.19.9" + dependenciesMeta: + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 85cf167596f52ec5cde47ec27013d49f04e3052e6b00cd4534095cd74a776955040b03b326d54a9588921dc631f76b97ebda76b52bb5152f3ef4a45cfba81dca + languageName: node + linkType: hard + "escalade@npm:^3.1.1": version: 3.1.1 resolution: "escalade@npm:3.1.1" @@ -2363,218 +3816,91 @@ __metadata: languageName: node linkType: hard -"escape-string-regexp@npm:^1.0.2, escape-string-regexp@npm:^1.0.5": +"escape-string-regexp@npm:^1.0.5": version: 1.0.5 resolution: "escape-string-regexp@npm:1.0.5" checksum: a968ad453dd0c2724e14a4f20e177aaf32bb384ab41b674a8454afe9a41c5e6fe8903323e0a1052f56289d04bd600f81278edf140b0fcc02f5cac98d0f5b5371 languageName: node linkType: hard -"escape-string-regexp@npm:^4.0.0": - version: 4.0.0 - resolution: "escape-string-regexp@npm:4.0.0" - checksum: 9497d4dd307d845bd7f75180d8188bb17ea8c151c1edbf6b6717c100e104d629dc2dfb687686181b0f4b7d732c7dfdc4d5e7a8ff72de1b0ca283a75bbb3a9cd9 +"escape-string-regexp@npm:^5.0.0": + version: 5.0.0 + resolution: "escape-string-regexp@npm:5.0.0" + checksum: 6366f474c6f37a802800a435232395e04e9885919873e382b157ab7e8f0feb8fed71497f84a6f6a81a49aab41815522f5839112bd38026d203aea0c91622df95 languageName: node linkType: hard -"eslint-config-prettier@npm:^9.0.0": - version: 9.0.0 - resolution: "eslint-config-prettier@npm:9.0.0" - peerDependencies: - eslint: ">=7.0.0" +"esprima@npm:^4.0.0": + version: 4.0.1 + resolution: "esprima@npm:4.0.1" bin: - eslint-config-prettier: bin/cli.js - checksum: bc1f661915845c631824178942e5d02f858fe6d0ea796f0050d63e0f681927b92696e81139dd04714c08c3e7de580fd079c66162e40070155ba79eaee78ab5d0 - languageName: node - linkType: hard - -"eslint-import-resolver-node@npm:^0.3.9": - version: 0.3.9 - resolution: "eslint-import-resolver-node@npm:0.3.9" - dependencies: - debug: "npm:^3.2.7" - is-core-module: "npm:^2.13.0" - resolve: "npm:^1.22.4" - checksum: 0ea8a24a72328a51fd95aa8f660dcca74c1429806737cf10261ab90cfcaaf62fd1eff664b76a44270868e0a932711a81b250053942595bcd00a93b1c1575dd61 + esparse: ./bin/esparse.js + esvalidate: ./bin/esvalidate.js + checksum: ad4bab9ead0808cf56501750fd9d3fb276f6b105f987707d059005d57e182d18a7c9ec7f3a01794ebddcca676773e42ca48a32d67a250c9d35e009ca613caba3 languageName: node linkType: hard -"eslint-module-utils@npm:^2.8.0": - version: 2.8.0 - resolution: "eslint-module-utils@npm:2.8.0" +"estree-util-attach-comments@npm:^2.0.0": + version: 2.1.1 + resolution: "estree-util-attach-comments@npm:2.1.1" dependencies: - debug: "npm:^3.2.7" - peerDependenciesMeta: - eslint: - optional: true - checksum: c7a8d1a58d76ec8217a8fea49271ec8132d1b9390965a75f6a4ecbc9e5983d742195b46d2e4378231d2186801439fe1aa5700714b0bfd4eb17aac6e1b65309df - languageName: node - linkType: hard - -"eslint-plugin-import@npm:^2.29.0": - version: 2.29.0 - resolution: "eslint-plugin-import@npm:2.29.0" - dependencies: - array-includes: "npm:^3.1.7" - array.prototype.findlastindex: "npm:^1.2.3" - array.prototype.flat: "npm:^1.3.2" - array.prototype.flatmap: "npm:^1.3.2" - debug: "npm:^3.2.7" - doctrine: "npm:^2.1.0" - eslint-import-resolver-node: "npm:^0.3.9" - eslint-module-utils: "npm:^2.8.0" - hasown: "npm:^2.0.0" - is-core-module: "npm:^2.13.1" - is-glob: "npm:^4.0.3" - minimatch: "npm:^3.1.2" - object.fromentries: "npm:^2.0.7" - object.groupby: "npm:^1.0.1" - object.values: "npm:^1.1.7" - semver: "npm:^6.3.1" - tsconfig-paths: "npm:^3.14.2" - peerDependencies: - eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 - checksum: 761a4e1fbc2cd318e62350bed4c448f8b11ed83091d6bb7776f096556363a09debd9922b39fd2714c895edc9aaea82e08e684eb632283f880c58a91e4bae6733 + "@types/estree": "npm:^1.0.0" + checksum: cdb5fdb5809b376ca4a96afbcd916c3570b4bbf5d0115b8a9e1e8a10885d8d9fb549df0a16c077abb42ee35fa33192b69714bac25d4f3c43a36092288c9a64fd languageName: node linkType: hard -"eslint-scope@npm:^7.2.2": - version: 7.2.2 - resolution: "eslint-scope@npm:7.2.2" +"estree-util-build-jsx@npm:^2.0.0": + version: 2.2.2 + resolution: "estree-util-build-jsx@npm:2.2.2" dependencies: - esrecurse: "npm:^4.3.0" - estraverse: "npm:^5.2.0" - checksum: 613c267aea34b5a6d6c00514e8545ef1f1433108097e857225fed40d397dd6b1809dffd11c2fde23b37ca53d7bf935fe04d2a18e6fc932b31837b6ad67e1c116 - languageName: node - linkType: hard - -"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1": - version: 3.4.1 - resolution: "eslint-visitor-keys@npm:3.4.1" - checksum: b4ebd35aed5426cd81b1fb92487825f1acf47a31e91d76597a3ee0664d69627140c4dafaf9b319cfeb1f48c1113a393e21a734c669e6565a72e6fcc311bd9911 + "@types/estree-jsx": "npm:^1.0.0" + estree-util-is-identifier-name: "npm:^2.0.0" + estree-walker: "npm:^3.0.0" + checksum: 2cef6ad6747f51934eba0601c3477ba08c98331cfe616635e08dfc89d06b9bbd370c4d80e87fe7d42d82776fa7840868201f48491b0ef9c808039f15fe4667e1 languageName: node linkType: hard -"eslint-visitor-keys@npm:^3.4.3": - version: 3.4.3 - resolution: "eslint-visitor-keys@npm:3.4.3" - checksum: 92708e882c0a5ffd88c23c0b404ac1628cf20104a108c745f240a13c332a11aac54f49a22d5762efbffc18ecbc9a580d1b7ad034bf5f3cc3307e5cbff2ec9820 - languageName: node - linkType: hard - -"eslint@npm:^8.54.0": - version: 8.54.0 - resolution: "eslint@npm:8.54.0" - dependencies: - "@eslint-community/eslint-utils": "npm:^4.2.0" - "@eslint-community/regexpp": "npm:^4.6.1" - "@eslint/eslintrc": "npm:^2.1.3" - "@eslint/js": "npm:8.54.0" - "@humanwhocodes/config-array": "npm:^0.11.13" - "@humanwhocodes/module-importer": "npm:^1.0.1" - "@nodelib/fs.walk": "npm:^1.2.8" - "@ungap/structured-clone": "npm:^1.2.0" - ajv: "npm:^6.12.4" - chalk: "npm:^4.0.0" - cross-spawn: "npm:^7.0.2" - debug: "npm:^4.3.2" - doctrine: "npm:^3.0.0" - escape-string-regexp: "npm:^4.0.0" - eslint-scope: "npm:^7.2.2" - eslint-visitor-keys: "npm:^3.4.3" - espree: "npm:^9.6.1" - esquery: "npm:^1.4.2" - esutils: "npm:^2.0.2" - fast-deep-equal: "npm:^3.1.3" - file-entry-cache: "npm:^6.0.1" - find-up: "npm:^5.0.0" - glob-parent: "npm:^6.0.2" - globals: "npm:^13.19.0" - graphemer: "npm:^1.4.0" - ignore: "npm:^5.2.0" - imurmurhash: "npm:^0.1.4" - is-glob: "npm:^4.0.0" - is-path-inside: "npm:^3.0.3" - js-yaml: "npm:^4.1.0" - json-stable-stringify-without-jsonify: "npm:^1.0.1" - levn: "npm:^0.4.1" - lodash.merge: "npm:^4.6.2" - minimatch: "npm:^3.1.2" - natural-compare: "npm:^1.4.0" - optionator: "npm:^0.9.3" - strip-ansi: "npm:^6.0.1" - text-table: "npm:^0.2.0" - bin: - eslint: bin/eslint.js - checksum: 4f205f832bdbd0218cde374b067791f4f76d7abe8de86b2dc849c273899051126d912ebf71531ee49b8eeaa22cad77febdc8f2876698dc2a76e84a8cb976af22 +"estree-util-is-identifier-name@npm:^2.0.0": + version: 2.1.0 + resolution: "estree-util-is-identifier-name@npm:2.1.0" + checksum: cc241a6998d30f4e8775ec34b042ef93e0085cd1bdf692a01f22e9b748f0866c76679475ff87935be1d8d5b1a7648be8cba366dc60866b372269f35feec756fe languageName: node linkType: hard -"espree@npm:^9.6.0, espree@npm:^9.6.1": - version: 9.6.1 - resolution: "espree@npm:9.6.1" +"estree-util-to-js@npm:^1.1.0": + version: 1.2.0 + resolution: "estree-util-to-js@npm:1.2.0" dependencies: - acorn: "npm:^8.9.0" - acorn-jsx: "npm:^5.3.2" - eslint-visitor-keys: "npm:^3.4.1" - checksum: 1a2e9b4699b715347f62330bcc76aee224390c28bb02b31a3752e9d07549c473f5f986720483c6469cf3cfb3c9d05df612ffc69eb1ee94b54b739e67de9bb460 - languageName: node - linkType: hard - -"esprima@npm:^4.0.0": - version: 4.0.1 - resolution: "esprima@npm:4.0.1" - bin: - esparse: ./bin/esparse.js - esvalidate: ./bin/esvalidate.js - checksum: ad4bab9ead0808cf56501750fd9d3fb276f6b105f987707d059005d57e182d18a7c9ec7f3a01794ebddcca676773e42ca48a32d67a250c9d35e009ca613caba3 + "@types/estree-jsx": "npm:^1.0.0" + astring: "npm:^1.8.0" + source-map: "npm:^0.7.0" + checksum: ad9c99dc34b0510ab813b485251acbf0abd06361c07b13c08da5d1611c279bee02ec09f2c269ae30b8d2da587115fc1fad4fa9f2f5ba69e094e758a3a4de7069 languageName: node linkType: hard -"esquery@npm:^1.4.2": - version: 1.5.0 - resolution: "esquery@npm:1.5.0" +"estree-util-visit@npm:^1.0.0, estree-util-visit@npm:^1.2.1": + version: 1.2.1 + resolution: "estree-util-visit@npm:1.2.1" dependencies: - estraverse: "npm:^5.1.0" - checksum: a084bd049d954cc88ac69df30534043fb2aee5555b56246493f42f27d1e168f00d9e5d4192e46f10290d312dc30dc7d58994d61a609c579c1219d636996f9213 + "@types/estree-jsx": "npm:^1.0.0" + "@types/unist": "npm:^2.0.0" + checksum: 3c47086ab25947a889fca9f58a842e0d27edadcad24dc393fdd7c9ad3419fe05b3c63b6fc9d6c9d8f50d32bca615cd0a3fe8d0e6b300fb94f74c91210b55ea5d languageName: node linkType: hard -"esrecurse@npm:^4.3.0": - version: 4.3.0 - resolution: "esrecurse@npm:4.3.0" +"estree-walker@npm:^3.0.0, estree-walker@npm:^3.0.3": + version: 3.0.3 + resolution: "estree-walker@npm:3.0.3" dependencies: - estraverse: "npm:^5.2.0" - checksum: 81a37116d1408ded88ada45b9fb16dbd26fba3aadc369ce50fcaf82a0bac12772ebd7b24cd7b91fc66786bf2c1ac7b5f196bc990a473efff972f5cb338877cf5 + "@types/estree": "npm:^1.0.0" + checksum: c12e3c2b2642d2bcae7d5aa495c60fa2f299160946535763969a1c83fc74518ffa9c2cd3a8b69ac56aea547df6a8aac25f729a342992ef0bbac5f1c73e78995d languageName: node linkType: hard -"estraverse@npm:^5.1.0, estraverse@npm:^5.2.0": - version: 5.3.0 - resolution: "estraverse@npm:5.3.0" - checksum: 1ff9447b96263dec95d6d67431c5e0771eb9776427421260a3e2f0fdd5d6bd4f8e37a7338f5ad2880c9f143450c9b1e4fc2069060724570a49cf9cf0312bd107 - languageName: node - linkType: hard - -"esutils@npm:^2.0.2": - version: 2.0.3 - resolution: "esutils@npm:2.0.3" - checksum: 9a2fe69a41bfdade834ba7c42de4723c97ec776e40656919c62cbd13607c45e127a003f05f724a1ea55e5029a4cf2de444b13009f2af71271e42d93a637137c7 - languageName: node - linkType: hard - -"event-stream@npm:=3.3.4": - version: 3.3.4 - resolution: "event-stream@npm:3.3.4" - dependencies: - duplexer: "npm:~0.1.1" - from: "npm:~0" - map-stream: "npm:~0.1.0" - pause-stream: "npm:0.0.11" - split: "npm:0.3" - stream-combiner: "npm:~0.0.4" - through: "npm:~2.3.1" - checksum: c3ec4e1efc27ab3e73a98923f0a2fa9a19051b87068fea2f3d53d2e4e8c5cfdadf8c8a115b17f3d90b16a46432d396bad91b6e8d0cceb3e449be717a03b75209 +"eventemitter3@npm:^5.0.1": + version: 5.0.1 + resolution: "eventemitter3@npm:5.0.1" + checksum: 4ba5c00c506e6c786b4d6262cfbce90ddc14c10d4667e5c83ae993c9de88aa856033994dd2b35b83e8dc1170e224e66a319fa80adc4c32adcd2379bbc75da814 languageName: node linkType: hard @@ -2595,6 +3921,30 @@ __metadata: languageName: node linkType: hard +"execa@npm:^8.0.1": + version: 8.0.1 + resolution: "execa@npm:8.0.1" + dependencies: + cross-spawn: "npm:^7.0.3" + get-stream: "npm:^8.0.1" + human-signals: "npm:^5.0.0" + is-stream: "npm:^3.0.0" + merge-stream: "npm:^2.0.0" + npm-run-path: "npm:^5.1.0" + onetime: "npm:^6.0.0" + signal-exit: "npm:^4.1.0" + strip-final-newline: "npm:^3.0.0" + checksum: 2c52d8775f5bf103ce8eec9c7ab3059909ba350a5164744e9947ed14a53f51687c040a250bda833f906d1283aa8803975b84e6c8f7a7c42f99dc8ef80250d1af + languageName: node + linkType: hard + +"expand-template@npm:^2.0.3": + version: 2.0.3 + resolution: "expand-template@npm:2.0.3" + checksum: 1c9e7afe9acadf9d373301d27f6a47b34e89b3391b1ef38b7471d381812537ef2457e620ae7f819d2642ce9c43b189b3583813ec395e2938319abe356a9b2f51 + languageName: node + linkType: hard + "exponential-backoff@npm:^3.1.1": version: 3.1.1 resolution: "exponential-backoff@npm:3.1.1" @@ -2602,6 +3952,34 @@ __metadata: languageName: node linkType: hard +"expressive-code@npm:^0.29.2": + version: 0.29.2 + resolution: "expressive-code@npm:0.29.2" + dependencies: + "@expressive-code/core": "npm:^0.29.2" + "@expressive-code/plugin-frames": "npm:^0.29.2" + "@expressive-code/plugin-shiki": "npm:^0.29.2" + "@expressive-code/plugin-text-markers": "npm:^0.29.2" + checksum: 165815cf1ae3d97cfd11eac3b4c2f2e4b28aef1bfbd89ddd4604f090662e4ce379abd053d0cbb0992d1f94594258e52ce5811ff473c3974e932396938e55285b + languageName: node + linkType: hard + +"extend-shallow@npm:^2.0.1": + version: 2.0.1 + resolution: "extend-shallow@npm:2.0.1" + dependencies: + is-extendable: "npm:^0.1.0" + checksum: ee1cb0a18c9faddb42d791b2d64867bd6cfd0f3affb711782eb6e894dd193e2934a7f529426aac7c8ddb31ac5d38000a00aa2caf08aa3dfc3e1c8ff6ba340bd9 + languageName: node + linkType: hard + +"extend@npm:^3.0.0": + version: 3.0.2 + resolution: "extend@npm:3.0.2" + checksum: 73bf6e27406e80aa3e85b0d1c4fd987261e628064e170ca781125c0b635a3dabad5e05adbf07595ea0cf1e6c5396cacb214af933da7cbaf24fe75ff14818e8f9 + languageName: node + linkType: hard + "extendable-error@npm:^0.1.5": version: 0.1.7 resolution: "extendable-error@npm:0.1.7" @@ -2620,10 +3998,23 @@ __metadata: 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" - checksum: 40dedc862eb8992c54579c66d914635afbec43350afbbe991235fdcb4e3a8d5af1b23ae7e79bef7d4882d0ecee06c3197488026998fb19f72dc95acff1d1b1d0 +"fast-fifo@npm:^1.1.0, fast-fifo@npm:^1.2.0": + version: 1.3.2 + resolution: "fast-fifo@npm:1.3.2" + checksum: d53f6f786875e8b0529f784b59b4b05d4b5c31c651710496440006a398389a579c8dbcd2081311478b5bf77f4b0b21de69109c5a4eabea9d8e8783d1eb864e4c + languageName: node + linkType: hard + +"fast-glob@npm:^3.2.12, fast-glob@npm:^3.3.1, fast-glob@npm:^3.3.2": + version: 3.3.2 + resolution: "fast-glob@npm:3.3.2" + dependencies: + "@nodelib/fs.stat": "npm:^2.0.2" + "@nodelib/fs.walk": "npm:^1.2.3" + glob-parent: "npm:^5.1.2" + merge2: "npm:^1.3.0" + micromatch: "npm:^4.0.4" + checksum: 42baad7b9cd40b63e42039132bde27ca2cb3a4950d0a0f9abe4639ea1aa9d3e3b40f98b1fe31cbc0cc17b664c9ea7447d911a152fa34ec5b72977b125a6fc845 languageName: node linkType: hard @@ -2640,20 +4031,6 @@ __metadata: languageName: node linkType: hard -"fast-json-stable-stringify@npm:^2.0.0": - version: 2.1.0 - resolution: "fast-json-stable-stringify@npm:2.1.0" - checksum: 7f081eb0b8a64e0057b3bb03f974b3ef00135fbf36c1c710895cd9300f13c94ba809bb3a81cf4e1b03f6e5285610a61abbd7602d0652de423144dfee5a389c9b - languageName: node - linkType: hard - -"fast-levenshtein@npm:^2.0.6": - version: 2.0.6 - resolution: "fast-levenshtein@npm:2.0.6" - checksum: 111972b37338bcb88f7d9e2c5907862c280ebf4234433b95bc611e518d192ccb2d38119c4ac86e26b668d75f7f3894f4ff5c4982899afced7ca78633b08287c4 - languageName: node - linkType: hard - "fastq@npm:^1.6.0": version: 1.15.0 resolution: "fastq@npm:1.15.0" @@ -2663,12 +4040,10 @@ __metadata: languageName: node linkType: hard -"file-entry-cache@npm:^6.0.1": - version: 6.0.1 - resolution: "file-entry-cache@npm:6.0.1" - dependencies: - flat-cache: "npm:^3.0.4" - checksum: 58473e8a82794d01b38e5e435f6feaf648e3f36fdb3a56e98f417f4efae71ad1c0d4ebd8a9a7c50c3ad085820a93fc7494ad721e0e4ebc1da3573f4e1c3c7cdd +"fflate@npm:^0.8.1": + version: 0.8.1 + resolution: "fflate@npm:0.8.1" + checksum: c8e8e118738cdbbe7b38d0afebd9166539ce71bbc42cc78e497b58b173f7b7d2efc80f6ed77199283c3665e2e606e56a9f5019a32ceb4ffe5a6fa680dfd9648b languageName: node linkType: hard @@ -2681,16 +4056,6 @@ __metadata: languageName: node linkType: hard -"find-up@npm:^1.0.0": - version: 1.1.2 - resolution: "find-up@npm:1.1.2" - dependencies: - path-exists: "npm:^2.0.0" - pinkie-promise: "npm:^2.0.0" - checksum: 51e35c62d9b7efe82d7d5cce966bfe10c2eaa78c769333f8114627e3a8a4a4f50747f5f50bff50b1094cbc6527776f0d3b9ff74d3561ef714a5290a17c80c2bc - languageName: node - linkType: hard - "find-up@npm:^4.0.0, find-up@npm:^4.1.0": version: 4.1.0 resolution: "find-up@npm:4.1.0" @@ -2721,20 +4086,10 @@ __metadata: languageName: node linkType: hard -"flat-cache@npm:^3.0.4": - version: 3.0.4 - resolution: "flat-cache@npm:3.0.4" - dependencies: - flatted: "npm:^3.1.0" - rimraf: "npm:^3.0.2" - checksum: f274dcbadb09ad8d7b6edf2ee9b034bc40bf0c12638f6c4084e9f1d39208cb104a5ebbb24b398880ef048200eaa116852f73d2d8b72e8c9627aba8c3e27ca057 - languageName: node - linkType: hard - -"flatted@npm:^3.1.0": - version: 3.2.7 - resolution: "flatted@npm:3.2.7" - checksum: 207a87c7abfc1ea6928ea16bac84f9eaa6d44d365620ece419e5c41cf44a5e9902b4c1f59c9605771b10e4565a0cb46e99d78e0464e8aabb42c97de880642257 +"flatted@npm:^3.2.9": + version: 3.2.9 + resolution: "flatted@npm:3.2.9" + checksum: 5c91c5a0a21bbc0b07b272231e5b4efe6b822bcb4ad317caf6bb06984be4042a9e9045026307da0fdb4583f1f545e317a67ef1231a59e71f7fced3cc429cfc53 languageName: node linkType: hard @@ -2757,10 +4112,10 @@ __metadata: languageName: node linkType: hard -"from@npm:~0": - version: 0.1.7 - resolution: "from@npm:0.1.7" - checksum: 3aab5aea8fe8e1f12a5dee7f390d46a93431ce691b6222dcd5701c5d34378e51ca59b44967da1105a0f90fcdf5d7629d963d51e7ccd79827d19693bdcfb688d4 +"fs-constants@npm:^1.0.0": + version: 1.0.0 + resolution: "fs-constants@npm:1.0.0" + checksum: a0cde99085f0872f4d244e83e03a46aa387b74f5a5af750896c6b05e9077fac00e9932fdf5aef84f2f16634cd473c63037d7a512576da7d5c2b9163d1909f3a8 languageName: node linkType: hard @@ -2821,6 +4176,16 @@ __metadata: languageName: node linkType: hard +"fsevents@npm:~2.3.3": + version: 2.3.3 + resolution: "fsevents@npm:2.3.3" + dependencies: + node-gyp: "npm:latest" + checksum: a1f0c44595123ed717febbc478aa952e47adfc28e2092be66b8ab1635147254ca6cfe1df792a8997f22716d4cbafc73309899ff7bfac2ac3ad8cf2e4ecc3ec60 + conditions: os=darwin + languageName: node + linkType: hard + "fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin": version: 2.3.2 resolution: "fsevents@patch:fsevents@npm%3A2.3.2#optional!builtin::version=2.3.2&hash=df0bf1" @@ -2830,6 +4195,15 @@ __metadata: languageName: node linkType: hard +"fsevents@patch:fsevents@npm%3A~2.3.3#optional!builtin": + version: 2.3.3 + resolution: "fsevents@patch:fsevents@npm%3A2.3.3#optional!builtin::version=2.3.3&hash=df0bf1" + dependencies: + node-gyp: "npm:latest" + conditions: os=darwin + languageName: node + linkType: hard + "function-bind@npm:^1.1.1": version: 1.1.1 resolution: "function-bind@npm:1.1.1" @@ -2837,13 +4211,6 @@ __metadata: languageName: node linkType: hard -"function-bind@npm:^1.1.2": - version: 1.1.2 - resolution: "function-bind@npm:1.1.2" - checksum: d8680ee1e5fcd4c197e4ac33b2b4dce03c71f4d91717292785703db200f5c21f977c568d28061226f9b5900cbcd2c84463646134fd5337e7925e0942bc3f46d5 - languageName: node - linkType: hard - "function.prototype.name@npm:^1.1.5": version: 1.1.5 resolution: "function.prototype.name@npm:1.1.5" @@ -2856,19 +4223,7 @@ __metadata: languageName: node linkType: hard -"function.prototype.name@npm:^1.1.6": - version: 1.1.6 - resolution: "function.prototype.name@npm:1.1.6" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - functions-have-names: "npm:^1.2.3" - checksum: 9eae11294905b62cb16874adb4fc687927cda3162285e0ad9612e6a1d04934005d46907362ea9cdb7428edce05a2f2c3dabc3b2d21e9fd343e9bb278230ad94b - languageName: node - linkType: hard - -"functions-have-names@npm:^1.2.2, functions-have-names@npm:^1.2.3": +"functions-have-names@npm:^1.2.2": version: 1.2.3 resolution: "functions-have-names@npm:1.2.3" checksum: 33e77fd29bddc2d9bb78ab3eb854c165909201f88c75faa8272e35899e2d35a8a642a15e7420ef945e1f64a9670d6aa3ec744106b2aa42be68ca5114025954ca @@ -2891,6 +4246,13 @@ __metadata: languageName: node linkType: hard +"gensync@npm:^1.0.0-beta.2": + version: 1.0.0-beta.2 + resolution: "gensync@npm:1.0.0-beta.2" + checksum: 782aba6cba65b1bb5af3b095d96249d20edbe8df32dbf4696fd49be2583faf676173bf4809386588828e4dd76a3354fcbeb577bab1c833ccd9fc4577f26103f8 + languageName: node + linkType: hard + "get-caller-file@npm:^2.0.1, get-caller-file@npm:^2.0.5": version: 2.0.5 resolution: "get-caller-file@npm:2.0.5" @@ -2898,7 +4260,7 @@ __metadata: languageName: node linkType: hard -"get-func-name@npm:^2.0.0, get-func-name@npm:^2.0.2": +"get-func-name@npm:^2.0.0, get-func-name@npm:^2.0.1, get-func-name@npm:^2.0.2": version: 2.0.2 resolution: "get-func-name@npm:2.0.2" checksum: 89830fd07623fa73429a711b9daecdb304386d237c71268007f788f113505ef1d4cc2d0b9680e072c5082490aec9df5d7758bf5ac6f1c37062855e8e3dc0b9df @@ -2916,30 +4278,6 @@ __metadata: languageName: node linkType: hard -"get-intrinsic@npm:^1.2.1": - version: 1.2.1 - resolution: "get-intrinsic@npm:1.2.1" - dependencies: - function-bind: "npm:^1.1.1" - has: "npm:^1.0.3" - has-proto: "npm:^1.0.1" - has-symbols: "npm:^1.0.3" - checksum: 49eab47f9de8f1a4f9b458b8b74ee5199fb2614414a91973eb175e07db56b52b6df49b255cc7ff704cb0786490fb93bfe8f2ad138b590a8de09b47116a366bc9 - languageName: node - linkType: hard - -"get-intrinsic@npm:^1.2.2": - version: 1.2.2 - resolution: "get-intrinsic@npm:1.2.2" - dependencies: - function-bind: "npm:^1.1.2" - has-proto: "npm:^1.0.1" - has-symbols: "npm:^1.0.3" - hasown: "npm:^2.0.0" - checksum: 4e7fb8adc6172bae7c4fe579569b4d5238b3667c07931cd46b4eee74bbe6ff6b91329bec311a638d8e60f5b51f44fe5445693c6be89ae88d4b5c49f7ff12db0b - languageName: node - linkType: hard - "get-stream@npm:^6.0.0": version: 6.0.1 resolution: "get-stream@npm:6.0.1" @@ -2947,6 +4285,13 @@ __metadata: languageName: node linkType: hard +"get-stream@npm:^8.0.1": + version: 8.0.1 + resolution: "get-stream@npm:8.0.1" + checksum: 5c2181e98202b9dae0bb4a849979291043e5892eb40312b47f0c22b9414fc9b28a3b6063d2375705eb24abc41ecf97894d9a51f64ff021511b504477b27b4290 + languageName: node + linkType: hard + "get-symbol-description@npm:^1.0.0": version: 1.0.0 resolution: "get-symbol-description@npm:1.0.0" @@ -2957,6 +4302,20 @@ __metadata: languageName: node linkType: hard +"github-from-package@npm:0.0.0": + version: 0.0.0 + resolution: "github-from-package@npm:0.0.0" + checksum: 737ee3f52d0a27e26332cde85b533c21fcdc0b09fb716c3f8e522cfaa9c600d4a631dec9fcde179ec9d47cca89017b7848ed4d6ae6b6b78f936c06825b1fcc12 + languageName: node + linkType: hard + +"github-slugger@npm:^2.0.0": + version: 2.0.0 + resolution: "github-slugger@npm:2.0.0" + checksum: 21b912b6b1e48f1e5a50b2292b48df0ff6abeeb0691b161b3d93d84f4ae6b1acd6ae23702e914af7ea5d441c096453cf0f621b72d57893946618d21dd1a1c486 + languageName: node + linkType: hard + "glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2": version: 5.1.2 resolution: "glob-parent@npm:5.1.2" @@ -2966,15 +4325,6 @@ __metadata: languageName: node linkType: hard -"glob-parent@npm:^6.0.2": - version: 6.0.2 - resolution: "glob-parent@npm:6.0.2" - dependencies: - is-glob: "npm:^4.0.3" - checksum: 317034d88654730230b3f43bb7ad4f7c90257a426e872ea0bf157473ac61c99bf5d205fad8f0185f989be8d2fa6d3c7dce1645d99d545b6ea9089c39f838e7f8 - languageName: node - linkType: hard - "glob@npm:7.1.6, glob@npm:^7.1.3": version: 7.1.6 resolution: "glob@npm:7.1.6" @@ -3018,12 +4368,10 @@ __metadata: languageName: node linkType: hard -"globals@npm:^13.19.0": - version: 13.20.0 - resolution: "globals@npm:13.20.0" - dependencies: - type-fest: "npm:^0.20.2" - checksum: 9a028f136f1e7a3574689f430f7d57faa0d699c4c7e92ade00b02882a892be31c314d50dff07b48e607283013117bb8a997406d03a1f7ab4a33a005eb16efd6c +"globals@npm:^11.1.0": + version: 11.12.0 + resolution: "globals@npm:11.12.0" + checksum: 758f9f258e7b19226bd8d4af5d3b0dcf7038780fb23d82e6f98932c44e239f884847f1766e8fa9cc5635ccb3204f7fa7314d4408dd4002a5e8ea827b4018f0a1 languageName: node linkType: hard @@ -3036,7 +4384,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^11.0.0, globby@npm:^11.0.3, globby@npm:^11.1.0": +"globby@npm:^11.0.0, globby@npm:^11.0.3": version: 11.1.0 resolution: "globby@npm:11.1.0" dependencies: @@ -3073,10 +4421,15 @@ __metadata: languageName: node linkType: hard -"graphemer@npm:^1.4.0": - version: 1.4.0 - resolution: "graphemer@npm:1.4.0" - checksum: e951259d8cd2e0d196c72ec711add7115d42eb9a8146c8eeda5b8d3ac91e5dd816b9cd68920726d9fd4490368e7ed86e9c423f40db87e2d8dfafa00fa17c3a31 +"gray-matter@npm:^4.0.3": + version: 4.0.3 + resolution: "gray-matter@npm:4.0.3" + dependencies: + js-yaml: "npm:^3.13.1" + kind-of: "npm:^6.0.2" + section-matter: "npm:^1.0.0" + strip-bom-string: "npm:^1.0.0" + checksum: e38489906dad4f162ca01e0dcbdbed96d1a53740cef446b9bf76d80bec66fa799af07776a18077aee642346c5e1365ed95e4c91854a12bf40ba0d4fb43a625a6 languageName: node linkType: hard @@ -3087,15 +4440,6 @@ __metadata: languageName: node linkType: hard -"has-ansi@npm:^2.0.0": - version: 2.0.0 - resolution: "has-ansi@npm:2.0.0" - dependencies: - ansi-regex: "npm:^2.0.0" - checksum: f54e4887b9f8f3c4bfefd649c48825b3c093987c92c27880ee9898539e6f01aed261e82e73153c3f920fde0db5bf6ebd58deb498ed1debabcb4bc40113ccdf05 - languageName: node - linkType: hard - "has-bigints@npm:^1.0.1, has-bigints@npm:^1.0.2": version: 1.0.2 resolution: "has-bigints@npm:1.0.2" @@ -3165,12 +4509,264 @@ __metadata: languageName: node linkType: hard -"hasown@npm:^2.0.0": +"hast-util-from-parse5@npm:^7.0.0": + version: 7.1.2 + resolution: "hast-util-from-parse5@npm:7.1.2" + dependencies: + "@types/hast": "npm:^2.0.0" + "@types/unist": "npm:^2.0.0" + hastscript: "npm:^7.0.0" + property-information: "npm:^6.0.0" + vfile: "npm:^5.0.0" + vfile-location: "npm:^4.0.0" + web-namespaces: "npm:^2.0.0" + checksum: c1002816d0235ff0a1e888d71c191d3ecfbaba510aaef86eec00edcba8803a3e0ad901bb0e5430a9d2aee2d52c31aabacae8282394dc519c333017a46c68d1c8 + languageName: node + linkType: hard + +"hast-util-from-parse5@npm:^8.0.0": + version: 8.0.1 + resolution: "hast-util-from-parse5@npm:8.0.1" + dependencies: + "@types/hast": "npm:^3.0.0" + "@types/unist": "npm:^3.0.0" + devlop: "npm:^1.0.0" + hastscript: "npm:^8.0.0" + property-information: "npm:^6.0.0" + vfile: "npm:^6.0.0" + vfile-location: "npm:^5.0.0" + web-namespaces: "npm:^2.0.0" + checksum: 4a30bb885cff1f0e023c429ae3ece73fe4b03386f07234bf23f5555ca087c2573ff4e551035b417ed7615bde559f394cdaf1db2b91c3b7f0575f3563cd238969 + languageName: node + linkType: hard + +"hast-util-has-property@npm:^2.0.0": + version: 2.0.1 + resolution: "hast-util-has-property@npm:2.0.1" + checksum: 0e3956ae8ad40148d908be94717c04bd237cabaf5a72093e1992a17cc9f143fd1524b27ae9af229893797babbaaa666f8735e83636523859c935a3d6b230c2ff + languageName: node + linkType: hard + +"hast-util-parse-selector@npm:^3.0.0": + version: 3.1.1 + resolution: "hast-util-parse-selector@npm:3.1.1" + dependencies: + "@types/hast": "npm:^2.0.0" + checksum: 34ac1707a477fd9764e328087163f1f21857bdb0f8d425bf41f6def7baf840e50e4bca2eb03072e3da4e39856de28893c4b688dcba0cc305160d53afcece4df4 + languageName: node + linkType: hard + +"hast-util-parse-selector@npm:^4.0.0": + version: 4.0.0 + resolution: "hast-util-parse-selector@npm:4.0.0" + dependencies: + "@types/hast": "npm:^3.0.0" + checksum: 5e98168cb44470dc274aabf1a28317e4feb09b1eaf7a48bbaa8c1de1b43a89cd195cb1284e535698e658e3ec26ad91bc5e52c9563c36feb75abbc68aaf68fb9f + languageName: node + linkType: hard + +"hast-util-raw@npm:^7.0.0, hast-util-raw@npm:^7.2.0": + version: 7.2.3 + resolution: "hast-util-raw@npm:7.2.3" + dependencies: + "@types/hast": "npm:^2.0.0" + "@types/parse5": "npm:^6.0.0" + hast-util-from-parse5: "npm:^7.0.0" + hast-util-to-parse5: "npm:^7.0.0" + html-void-elements: "npm:^2.0.0" + parse5: "npm:^6.0.0" + unist-util-position: "npm:^4.0.0" + unist-util-visit: "npm:^4.0.0" + vfile: "npm:^5.0.0" + web-namespaces: "npm:^2.0.0" + zwitch: "npm:^2.0.0" + checksum: c7bf994938cbc1acaaeb337f99773773b51ad77695b559c6352cba5c35b26610e6de2936b5086ef8bc53b436dd8032a3860e7357f28b6bb0365f751919745398 + languageName: node + linkType: hard + +"hast-util-raw@npm:^9.0.0": + version: 9.0.1 + resolution: "hast-util-raw@npm:9.0.1" + dependencies: + "@types/hast": "npm:^3.0.0" + "@types/unist": "npm:^3.0.0" + "@ungap/structured-clone": "npm:^1.0.0" + hast-util-from-parse5: "npm:^8.0.0" + hast-util-to-parse5: "npm:^8.0.0" + html-void-elements: "npm:^3.0.0" + mdast-util-to-hast: "npm:^13.0.0" + parse5: "npm:^7.0.0" + unist-util-position: "npm:^5.0.0" + unist-util-visit: "npm:^5.0.0" + vfile: "npm:^6.0.0" + web-namespaces: "npm:^2.0.0" + zwitch: "npm:^2.0.0" + checksum: 60ee6495681f020930380649af58b2a6ca081bec1abd1089f58b0ee892eac2c87dc2077fb30370e51848734b58d2d539e3cde5148c18aa70a89f2c7285e57c91 + languageName: node + linkType: hard + +"hast-util-select@npm:^5.0.5": + version: 5.0.5 + resolution: "hast-util-select@npm:5.0.5" + dependencies: + "@types/hast": "npm:^2.0.0" + "@types/unist": "npm:^2.0.0" + bcp-47-match: "npm:^2.0.0" + comma-separated-tokens: "npm:^2.0.0" + css-selector-parser: "npm:^1.0.0" + direction: "npm:^2.0.0" + hast-util-has-property: "npm:^2.0.0" + hast-util-to-string: "npm:^2.0.0" + hast-util-whitespace: "npm:^2.0.0" + not: "npm:^0.1.0" + nth-check: "npm:^2.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + unist-util-visit: "npm:^4.0.0" + zwitch: "npm:^2.0.0" + checksum: af9b27bacfbb1c0423e64d9ef4a717c7a5f36de3f35b0173b0b13cec514c4eff2b62c8c5c7fb155eb81e65f35206860fb9965d49474a17daa341fd5ef09ec6c5 + languageName: node + linkType: hard + +"hast-util-to-estree@npm:^2.0.0": + version: 2.3.3 + resolution: "hast-util-to-estree@npm:2.3.3" + dependencies: + "@types/estree": "npm:^1.0.0" + "@types/estree-jsx": "npm:^1.0.0" + "@types/hast": "npm:^2.0.0" + "@types/unist": "npm:^2.0.0" + comma-separated-tokens: "npm:^2.0.0" + estree-util-attach-comments: "npm:^2.0.0" + estree-util-is-identifier-name: "npm:^2.0.0" + hast-util-whitespace: "npm:^2.0.0" + mdast-util-mdx-expression: "npm:^1.0.0" + mdast-util-mdxjs-esm: "npm:^1.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + style-to-object: "npm:^0.4.1" + unist-util-position: "npm:^4.0.0" + zwitch: "npm:^2.0.0" + checksum: 5947b5030a6d20c193f5ea576cc751507e0b30d00f91e40a5208ca3a7add03a3862795a83600c0fdadf19c8b051917c7904715fa7dd358f04603d67a36341c38 + languageName: node + linkType: hard + +"hast-util-to-html@npm:^8.0.0, hast-util-to-html@npm:^8.0.4": + version: 8.0.4 + resolution: "hast-util-to-html@npm:8.0.4" + dependencies: + "@types/hast": "npm:^2.0.0" + "@types/unist": "npm:^2.0.0" + ccount: "npm:^2.0.0" + comma-separated-tokens: "npm:^2.0.0" + hast-util-raw: "npm:^7.0.0" + hast-util-whitespace: "npm:^2.0.0" + html-void-elements: "npm:^2.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + stringify-entities: "npm:^4.0.0" + zwitch: "npm:^2.0.4" + checksum: a9dd87cdd710dcd151d144152ec6d2c6d20377b8258b31776e1387868fab8e3e0552d237c337d84dc94407b935a47e2e344b1cf8bd3ce16541c934004879c33f + languageName: node + linkType: hard + +"hast-util-to-html@npm:^9.0.0": + version: 9.0.0 + resolution: "hast-util-to-html@npm:9.0.0" + dependencies: + "@types/hast": "npm:^3.0.0" + "@types/unist": "npm:^3.0.0" + ccount: "npm:^2.0.0" + comma-separated-tokens: "npm:^2.0.0" + hast-util-raw: "npm:^9.0.0" + hast-util-whitespace: "npm:^3.0.0" + html-void-elements: "npm:^3.0.0" + mdast-util-to-hast: "npm:^13.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + stringify-entities: "npm:^4.0.0" + zwitch: "npm:^2.0.4" + checksum: 9fa64c09cfc27653fea814fec38ae579741f498d5db1495f908be15ec898a6c25f43029b2db0fd42eece47a9bdf2a693adb0b4501cd8d24ad858a63dc29e2cdb + languageName: node + linkType: hard + +"hast-util-to-parse5@npm:^7.0.0": + version: 7.1.0 + resolution: "hast-util-to-parse5@npm:7.1.0" + dependencies: + "@types/hast": "npm:^2.0.0" + comma-separated-tokens: "npm:^2.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + web-namespaces: "npm:^2.0.0" + zwitch: "npm:^2.0.0" + checksum: 2a96302b8f25fa2d5b657a94bb20a3d9a1a81e66c2f81582a242c5634dd850e3bd95313a7471eef8282b597f2129551fef5a1631f4ce14c41aab646281b339a0 + languageName: node + linkType: hard + +"hast-util-to-parse5@npm:^8.0.0": + version: 8.0.0 + resolution: "hast-util-to-parse5@npm:8.0.0" + dependencies: + "@types/hast": "npm:^3.0.0" + comma-separated-tokens: "npm:^2.0.0" + devlop: "npm:^1.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + web-namespaces: "npm:^2.0.0" + zwitch: "npm:^2.0.0" + checksum: 3c0c7fba026e0c4be4675daf7277f9ff22ae6da801435f1b7104f7740de5422576f1c025023c7b3df1d0a161e13a04c6ab8f98ada96eb50adb287b537849a2bd + languageName: node + linkType: hard + +"hast-util-to-string@npm:^2.0.0": version: 2.0.0 - resolution: "hasown@npm:2.0.0" + resolution: "hast-util-to-string@npm:2.0.0" + dependencies: + "@types/hast": "npm:^2.0.0" + checksum: 9cf78d0de776e379476408d8363eeb690421e1b042919cfd97651eb968dbfe4ca9f5e4e23478a8d2c0d84a5432478d02d4c8ceef294b903becc5e8b71fa12849 + languageName: node + linkType: hard + +"hast-util-whitespace@npm:^2.0.0": + version: 2.0.1 + resolution: "hast-util-whitespace@npm:2.0.1" + checksum: dcf6ebab091c802ffa7bb3112305c7631c15adb6c07a258f5528aefbddf82b4e162c8310ef426c48dc1dc623982cc33920e6dde5a50015d307f2778dcf6c2487 + languageName: node + linkType: hard + +"hast-util-whitespace@npm:^3.0.0": + version: 3.0.0 + resolution: "hast-util-whitespace@npm:3.0.0" + dependencies: + "@types/hast": "npm:^3.0.0" + checksum: b898bc9fe27884b272580d15260b6bbdabe239973a147e97fa98c45fa0ffec967a481aaa42291ec34fb56530dc2d484d473d7e2bae79f39c83f3762307edfea8 + languageName: node + linkType: hard + +"hastscript@npm:^7.0.0, hastscript@npm:^7.2.0": + version: 7.2.0 + resolution: "hastscript@npm:7.2.0" + dependencies: + "@types/hast": "npm:^2.0.0" + comma-separated-tokens: "npm:^2.0.0" + hast-util-parse-selector: "npm:^3.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + checksum: 579912b03ff4a5b19eb609df7403c6dba2505ef1a1e2bc47cbf467cbd7cffcd51df40e74d882de1ccdda40aaf18487f82619eb9cb9f2077cba778017e95e868e + languageName: node + linkType: hard + +"hastscript@npm:^8.0.0": + version: 8.0.0 + resolution: "hastscript@npm:8.0.0" dependencies: - function-bind: "npm:^1.1.2" - checksum: 5d415b114f410661208c95e7ab4879f1cc2765b8daceff4dc8718317d1cb7b9ffa7c5d1eafd9a4389c9aab7445d6ea88e05f3096cb1e529618b55304956b87fc + "@types/hast": "npm:^3.0.0" + comma-separated-tokens: "npm:^2.0.0" + hast-util-parse-selector: "npm:^4.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + checksum: f0b54bbdd710854b71c0f044612db0fe1b5e4d74fa2001633dc8c535c26033269f04f536f9fd5b03f234de1111808f9e230e9d19493bf919432bb24d541719e0 languageName: node linkType: hard @@ -3181,6 +4777,34 @@ __metadata: languageName: node linkType: hard +"html-escaper@npm:^2.0.0": + version: 2.0.2 + resolution: "html-escaper@npm:2.0.2" + checksum: 208e8a12de1a6569edbb14544f4567e6ce8ecc30b9394fcaa4e7bb1e60c12a7c9a1ed27e31290817157e8626f3a4f29e76c8747030822eb84a6abb15c255f0a0 + languageName: node + linkType: hard + +"html-escaper@npm:^3.0.3": + version: 3.0.3 + resolution: "html-escaper@npm:3.0.3" + checksum: a042fa4139127ff7546513e90ea39cc9161a1938ce90122dbc4260d4b7252c9aa8452f4509c0c2889901b8ae9a8699179150f1f99d3f80bcf7317573c5f08f4e + languageName: node + linkType: hard + +"html-void-elements@npm:^2.0.0": + version: 2.0.1 + resolution: "html-void-elements@npm:2.0.1" + checksum: 1079c9e9fdb3b6a2481f2a282098a0183f3d45bf2b9d76c7dfc1671ee1857d7bacdd04fd8c6e2418f5ff550c30cabf97a010fe31ec402d0c89189807b48e6d79 + languageName: node + linkType: hard + +"html-void-elements@npm:^3.0.0": + version: 3.0.0 + resolution: "html-void-elements@npm:3.0.0" + checksum: a8b9ec5db23b7c8053876dad73a0336183e6162bf6d2677376d8b38d654fdc59ba74fdd12f8812688f7db6fad451210c91b300e472afc0909224e0a44c8610d2 + languageName: node + linkType: hard + "http-cache-semantics@npm:^4.1.1": version: 4.1.1 resolution: "http-cache-semantics@npm:4.1.1" @@ -3223,6 +4847,13 @@ __metadata: languageName: node linkType: hard +"human-signals@npm:^5.0.0": + version: 5.0.0 + resolution: "human-signals@npm:5.0.0" + checksum: 5a9359073fe17a8b58e5a085e9a39a950366d9f00217c4ff5878bd312e09d80f460536ea6a3f260b5943a01fe55c158d1cea3fc7bee3d0520aeef04f6d915c82 + languageName: node + linkType: hard + "humanize-ms@npm:^1.2.1": version: 1.2.1 resolution: "humanize-ms@npm:1.2.1" @@ -3232,7 +4863,7 @@ __metadata: languageName: node linkType: hard -"iconv-lite@npm:^0.4.24": +"iconv-lite@npm:^0.4.24, iconv-lite@npm:^0.4.4": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24" dependencies: @@ -3250,20 +4881,24 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^5.2.0, ignore@npm:^5.2.4": +"ieee754@npm:^1.1.13, ieee754@npm:^1.2.1": + version: 1.2.1 + resolution: "ieee754@npm:1.2.1" + checksum: b0782ef5e0935b9f12883a2e2aa37baa75da6e66ce6515c168697b42160807d9330de9a32ec1ed73149aea02e0d822e572bca6f1e22bdcbd2149e13b050b17bb + languageName: node + linkType: hard + +"ignore@npm:^5.2.0": version: 5.2.4 resolution: "ignore@npm:5.2.4" checksum: 7c7cd90edd9fea6e037f9b9da4b01bf0a86b198ce78345f9bbd983929d68ff14830be31111edc5d70c264921f4962404d75b7262b4d9cc3bc12381eccbd03096 languageName: node linkType: hard -"import-fresh@npm:^3.2.1": - version: 3.3.0 - resolution: "import-fresh@npm:3.3.0" - dependencies: - parent-module: "npm:^1.0.0" - resolve-from: "npm:^4.0.0" - checksum: 7f882953aa6b740d1f0e384d0547158bc86efbf2eea0f1483b8900a6f65c5a5123c2cf09b0d542cc419d0b98a759ecaeb394237e97ea427f2da221dc3cd80cc3 +"import-meta-resolve@npm:^3.0.0": + version: 3.1.1 + resolution: "import-meta-resolve@npm:3.1.1" + checksum: 75545f3f0f4f789f15b91a541b2d3e9d5b25fc9e8c60e8423cbdef4fff226f45520bd040219c63eee001878f075e82b52e436ca0d7d05e6c4fdc0348b7f251dd languageName: node linkType: hard @@ -3291,13 +4926,27 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2, inherits@npm:^2.0.3": +"inherits@npm:2, inherits@npm:^2.0.3, inherits@npm:^2.0.4": version: 2.0.4 resolution: "inherits@npm:2.0.4" checksum: 4e531f648b29039fb7426fb94075e6545faa1eb9fe83c29f0b6d9e7263aceb4289d2d4557db0d428188eeb449cc7c5e77b0a0b2c4e248ff2a65933a0dee49ef2 languageName: node linkType: hard +"ini@npm:~1.3.0": + version: 1.3.8 + resolution: "ini@npm:1.3.8" + checksum: ec93838d2328b619532e4f1ff05df7909760b6f66d9c9e2ded11e5c1897d6f2f9980c54dd638f88654b00919ce31e827040631eab0a3969e4d1abefa0719516a + languageName: node + linkType: hard + +"inline-style-parser@npm:0.1.1": + version: 0.1.1 + resolution: "inline-style-parser@npm:0.1.1" + checksum: 08832a533f51a1e17619f2eabf2f5ec5e956d6dcba1896351285c65df022c9420de61d73256e1dca8015a52abf96cc84ddc3b73b898b22de6589d3962b5e501b + languageName: node + linkType: hard + "internal-slot@npm:^1.0.5": version: 1.0.5 resolution: "internal-slot@npm:1.0.5" @@ -3316,6 +4965,23 @@ __metadata: languageName: node linkType: hard +"is-alphabetical@npm:^2.0.0": + version: 2.0.1 + resolution: "is-alphabetical@npm:2.0.1" + checksum: 932367456f17237533fd1fc9fe179df77957271020b83ea31da50e5cc472d35ef6b5fb8147453274ffd251134472ce24eb6f8d8398d96dee98237cdb81a6c9a7 + languageName: node + linkType: hard + +"is-alphanumerical@npm:^2.0.0": + version: 2.0.1 + resolution: "is-alphanumerical@npm:2.0.1" + dependencies: + is-alphabetical: "npm:^2.0.0" + is-decimal: "npm:^2.0.0" + checksum: 4b35c42b18e40d41378293f82a3ecd9de77049b476f748db5697c297f686e1e05b072a6aaae2d16f54d2a57f85b00cbbe755c75f6d583d1c77d6657bd0feb5a2 + languageName: node + linkType: hard + "is-array-buffer@npm:^3.0.1, is-array-buffer@npm:^3.0.2": version: 3.0.2 resolution: "is-array-buffer@npm:3.0.2" @@ -3334,6 +5000,13 @@ __metadata: languageName: node linkType: hard +"is-arrayish@npm:^0.3.1": + version: 0.3.2 + resolution: "is-arrayish@npm:0.3.2" + checksum: f59b43dc1d129edb6f0e282595e56477f98c40278a2acdc8b0a5c57097c9eff8fe55470493df5775478cf32a4dc8eaf6d3a749f07ceee5bc263a78b2434f6a54 + languageName: node + linkType: hard + "is-bigint@npm:^1.0.1": version: 1.0.4 resolution: "is-bigint@npm:1.0.4" @@ -3362,6 +5035,13 @@ __metadata: languageName: node linkType: hard +"is-buffer@npm:^2.0.0": + version: 2.0.5 + resolution: "is-buffer@npm:2.0.5" + checksum: e603f6fced83cf94c53399cff3bda1a9f08e391b872b64a73793b0928be3e5f047f2bcece230edb7632eaea2acdbfcb56c23b33d8a20c820023b230f1485679a + languageName: node + linkType: hard + "is-callable@npm:^1.1.3, is-callable@npm:^1.1.4, is-callable@npm:^1.2.7": version: 1.2.7 resolution: "is-callable@npm:1.2.7" @@ -3398,15 +5078,6 @@ __metadata: languageName: node linkType: hard -"is-core-module@npm:^2.13.1": - version: 2.13.1 - resolution: "is-core-module@npm:2.13.1" - dependencies: - hasown: "npm:^2.0.0" - checksum: 2cba9903aaa52718f11c4896dabc189bab980870aae86a62dc0d5cedb546896770ee946fb14c84b7adf0735f5eaea4277243f1b95f5cefa90054f92fbcac2518 - languageName: node - linkType: hard - "is-date-object@npm:^1.0.1": version: 1.0.5 resolution: "is-date-object@npm:1.0.5" @@ -3416,6 +5087,29 @@ __metadata: languageName: node linkType: hard +"is-decimal@npm:^2.0.0": + version: 2.0.1 + resolution: "is-decimal@npm:2.0.1" + checksum: 8085dd66f7d82f9de818fba48b9e9c0429cb4291824e6c5f2622e96b9680b54a07a624cfc663b24148b8e853c62a1c987cfe8b0b5a13f5156991afaf6736e334 + languageName: node + linkType: hard + +"is-docker@npm:^3.0.0": + version: 3.0.0 + resolution: "is-docker@npm:3.0.0" + bin: + is-docker: cli.js + checksum: d2c4f8e6d3e34df75a5defd44991b6068afad4835bb783b902fa12d13ebdb8f41b2a199dcb0b5ed2cb78bfee9e4c0bbdb69c2d9646f4106464674d3e697a5856 + languageName: node + linkType: hard + +"is-extendable@npm:^0.1.0": + version: 0.1.1 + resolution: "is-extendable@npm:0.1.1" + checksum: dd5ca3994a28e1740d1e25192e66eed128e0b2ff161a7ea348e87ae4f616554b486854de423877a2a2c171d5f7cd6e8093b91f54533bc88a59ee1c9838c43879 + languageName: node + linkType: hard + "is-extglob@npm:^2.1.1": version: 2.1.1 resolution: "is-extglob@npm:2.1.1" @@ -3430,7 +5124,7 @@ __metadata: languageName: node linkType: hard -"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:^4.0.3, is-glob@npm:~4.0.1": +"is-glob@npm:^4.0.1, is-glob@npm:~4.0.1": version: 4.0.3 resolution: "is-glob@npm:4.0.3" dependencies: @@ -3439,6 +5133,31 @@ __metadata: languageName: node linkType: hard +"is-hexadecimal@npm:^2.0.0": + version: 2.0.1 + resolution: "is-hexadecimal@npm:2.0.1" + checksum: 3eb60fe2f1e2bbc760b927dcad4d51eaa0c60138cf7fc671803f66353ad90c301605b502c7ea4c6bb0548e1c7e79dfd37b73b632652e3b76030bba603a7e9626 + languageName: node + linkType: hard + +"is-inside-container@npm:^1.0.0": + version: 1.0.0 + resolution: "is-inside-container@npm:1.0.0" + dependencies: + is-docker: "npm:^3.0.0" + bin: + is-inside-container: cli.js + checksum: a8efb0e84f6197e6ff5c64c52890fa9acb49b7b74fed4da7c95383965da6f0fa592b4dbd5e38a79f87fc108196937acdbcd758fcefc9b140e479b39ce1fcd1cd + languageName: node + linkType: hard + +"is-interactive@npm:^2.0.0": + version: 2.0.0 + resolution: "is-interactive@npm:2.0.0" + checksum: 801c8f6064f85199dc6bf99b5dd98db3282e930c3bc197b32f2c5b89313bb578a07d1b8a01365c4348c2927229234f3681eb861b9c2c92bee72ff397390fa600 + languageName: node + linkType: hard + "is-lambda@npm:^1.0.1": version: 1.0.1 resolution: "is-lambda@npm:1.0.1" @@ -3469,13 +5188,6 @@ __metadata: languageName: node linkType: hard -"is-path-inside@npm:^3.0.3": - version: 3.0.3 - resolution: "is-path-inside@npm:3.0.3" - checksum: cf7d4ac35fb96bab6a1d2c3598fe5ebb29aafb52c0aaa482b5a3ed9d8ba3edc11631e3ec2637660c44b3ce0e61a08d54946e8af30dec0b60a7c27296c68ffd05 - languageName: node - linkType: hard - "is-plain-obj@npm:^1.1.0": version: 1.1.0 resolution: "is-plain-obj@npm:1.1.0" @@ -3483,6 +5195,22 @@ __metadata: languageName: node linkType: hard +"is-plain-obj@npm:^4.0.0": + version: 4.1.0 + resolution: "is-plain-obj@npm:4.1.0" + checksum: 32130d651d71d9564dc88ba7e6fda0e91a1010a3694648e9f4f47bb6080438140696d3e3e15c741411d712e47ac9edc1a8a9de1fe76f3487b0d90be06ac9975e + languageName: node + linkType: hard + +"is-reference@npm:^3.0.0": + version: 3.0.2 + resolution: "is-reference@npm:3.0.2" + dependencies: + "@types/estree": "npm:*" + checksum: 652d31b405e8e8269071cee78fe874b072745012eba202c6dc86880fd603a65ae043e3160990ab4a0a4b33567cbf662eecf3bc6b3c2c1550e6c2b6cf885ce5aa + languageName: node + linkType: hard + "is-regex@npm:^1.1.4": version: 1.1.4 resolution: "is-regex@npm:1.1.4" @@ -3509,6 +5237,13 @@ __metadata: languageName: node linkType: hard +"is-stream@npm:^3.0.0": + version: 3.0.0 + resolution: "is-stream@npm:3.0.0" + checksum: eb2f7127af02ee9aa2a0237b730e47ac2de0d4e76a4a905a50a11557f2339df5765eaea4ceb8029f1efa978586abe776908720bfcb1900c20c6ec5145f6f29d8 + languageName: node + linkType: hard + "is-string@npm:^1.0.5, is-string@npm:^1.0.7": version: 1.0.7 resolution: "is-string@npm:1.0.7" @@ -3549,19 +5284,10 @@ __metadata: languageName: node linkType: hard -"is-typed-array@npm:^1.1.12": - version: 1.1.12 - resolution: "is-typed-array@npm:1.1.12" - dependencies: - which-typed-array: "npm:^1.1.11" - checksum: 9863e9cc7223c6fc1c462a2c3898a7beff6b41b1ee0fabb03b7d278ae7de670b5bcbc8627db56bb66ed60902fa37d53fe5cce0fd2f7d73ac64fe5da6f409b6ae - languageName: node - linkType: hard - -"is-utf8@npm:^0.2.0": - version: 0.2.1 - resolution: "is-utf8@npm:0.2.1" - checksum: 3ed45e5b4ddfa04ed7e32c63d29c61b980ecd6df74698f45978b8c17a54034943bcbffb6ae243202e799682a66f90fef526f465dd39438745e9fe70794c1ef09 +"is-unicode-supported@npm:^1.1.0, is-unicode-supported@npm:^1.3.0": + version: 1.3.0 + resolution: "is-unicode-supported@npm:1.3.0" + checksum: b8674ea95d869f6faabddc6a484767207058b91aea0250803cbf1221345cb0c56f466d4ecea375dc77f6633d248d33c47bd296fb8f4cdba0b4edba8917e83d8a languageName: node linkType: hard @@ -3581,10 +5307,12 @@ __metadata: languageName: node linkType: hard -"isarray@npm:^2.0.5": - version: 2.0.5 - resolution: "isarray@npm:2.0.5" - checksum: 4199f14a7a13da2177c66c31080008b7124331956f47bca57dd0b6ea9f11687aa25e565a2c7a2b519bc86988d10398e3049a1f5df13c9f6b7664154690ae79fd +"is-wsl@npm:^3.0.0": + version: 3.1.0 + resolution: "is-wsl@npm:3.1.0" + dependencies: + is-inside-container: "npm:^1.0.0" + checksum: d3317c11995690a32c362100225e22ba793678fe8732660c6de511ae71a0ff05b06980cf21f98a6bf40d7be0e9e9506f859abe00a1118287d63e53d0a3d06947 languageName: node linkType: hard @@ -3595,6 +5323,45 @@ __metadata: languageName: node linkType: hard +"istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.2": + version: 3.2.2 + resolution: "istanbul-lib-coverage@npm:3.2.2" + checksum: 6c7ff2106769e5f592ded1fb418f9f73b4411fd5a084387a5410538332b6567cd1763ff6b6cadca9b9eb2c443cce2f7ea7d7f1b8d315f9ce58539793b1e0922b + languageName: node + linkType: hard + +"istanbul-lib-report@npm:^3.0.0, istanbul-lib-report@npm:^3.0.1": + version: 3.0.1 + resolution: "istanbul-lib-report@npm:3.0.1" + dependencies: + istanbul-lib-coverage: "npm:^3.0.0" + make-dir: "npm:^4.0.0" + supports-color: "npm:^7.1.0" + checksum: 84323afb14392de8b6a5714bd7e9af845cfbd56cfe71ed276cda2f5f1201aea673c7111901227ee33e68e4364e288d73861eb2ed48f6679d1e69a43b6d9b3ba7 + languageName: node + linkType: hard + +"istanbul-lib-source-maps@npm:^4.0.1": + version: 4.0.1 + resolution: "istanbul-lib-source-maps@npm:4.0.1" + dependencies: + debug: "npm:^4.1.1" + istanbul-lib-coverage: "npm:^3.0.0" + source-map: "npm:^0.6.1" + checksum: 19e4cc405016f2c906dff271a76715b3e881fa9faeb3f09a86cb99b8512b3a5ed19cadfe0b54c17ca0e54c1142c9c6de9330d65506e35873994e06634eebeb66 + languageName: node + linkType: hard + +"istanbul-reports@npm:^3.1.6": + version: 3.1.6 + resolution: "istanbul-reports@npm:3.1.6" + dependencies: + html-escaper: "npm:^2.0.0" + istanbul-lib-report: "npm:^3.0.0" + checksum: ec3f1bdbc51b3e0b325a5b9f4ad31a247697f31001df4e81075f7980413f14da1b5adfec574fd156efd3b0464023f61320f6718efc66ee72b32d89611cef99dd + languageName: node + linkType: hard + "jackspeak@npm:^2.0.3": version: 2.2.2 resolution: "jackspeak@npm:2.2.2" @@ -3645,6 +5412,15 @@ __metadata: languageName: node linkType: hard +"jsesc@npm:^2.5.1": + version: 2.5.2 + resolution: "jsesc@npm:2.5.2" + bin: + jsesc: bin/jsesc + checksum: dbf59312e0ebf2b4405ef413ec2b25abb5f8f4d9bc5fb8d9f90381622ebca5f2af6a6aa9a8578f65903f9e33990a6dc798edd0ce5586894bf0e9e31803a1de88 + languageName: node + linkType: hard + "json-parse-even-better-errors@npm:^2.3.0": version: 2.3.1 resolution: "json-parse-even-better-errors@npm:2.3.1" @@ -3652,28 +5428,19 @@ __metadata: languageName: node linkType: hard -"json-schema-traverse@npm:^0.4.1": - version: 0.4.1 - resolution: "json-schema-traverse@npm:0.4.1" - checksum: 108fa90d4cc6f08243aedc6da16c408daf81793bf903e9fd5ab21983cda433d5d2da49e40711da016289465ec2e62e0324dcdfbc06275a607fe3233fde4942ce - languageName: node - linkType: hard - -"json-stable-stringify-without-jsonify@npm:^1.0.1": - version: 1.0.1 - resolution: "json-stable-stringify-without-jsonify@npm:1.0.1" - checksum: cb168b61fd4de83e58d09aaa6425ef71001bae30d260e2c57e7d09a5fd82223e2f22a042dedaab8db23b7d9ae46854b08bb1f91675a8be11c5cffebef5fb66a5 +"json5@npm:^2.2.3": + version: 2.2.3 + resolution: "json5@npm:2.2.3" + bin: + json5: lib/cli.js + checksum: 5a04eed94810fa55c5ea138b2f7a5c12b97c3750bc63d11e511dcecbfef758003861522a070c2272764ee0f4e3e323862f386945aeb5b85b87ee43f084ba586c languageName: node linkType: hard -"json5@npm:^1.0.2": - version: 1.0.2 - resolution: "json5@npm:1.0.2" - dependencies: - minimist: "npm:^1.2.0" - bin: - json5: lib/cli.js - checksum: 9ee316bf21f000b00752e6c2a3b79ecf5324515a5c60ee88983a1910a45426b643a4f3461657586e8aeca87aaf96f0a519b0516d2ae527a6c3e7eed80f68717f +"jsonc-parser@npm:^2.3.0": + version: 2.3.1 + resolution: "jsonc-parser@npm:2.3.1" + checksum: b5e823612f6518a4d35e65d3c642e87b994c52a71b6d83d306d59f9b57003a1f6c64659808f0f1c3448991c28916d56faca45222f31ddb1a32effecdef0f0485 languageName: node linkType: hard @@ -3696,27 +5463,24 @@ __metadata: languageName: node linkType: hard -"kind-of@npm:^6.0.3": +"kind-of@npm:^6.0.0, kind-of@npm:^6.0.2, kind-of@npm:^6.0.3": version: 6.0.3 resolution: "kind-of@npm:6.0.3" checksum: 61cdff9623dabf3568b6445e93e31376bee1cdb93f8ba7033d86022c2a9b1791a1d9510e026e6465ebd701a6dd2f7b0808483ad8838341ac52f003f512e0b4c4 languageName: node linkType: hard -"kleur@npm:^4.1.5": - version: 4.1.5 - resolution: "kleur@npm:4.1.5" - checksum: e9de6cb49657b6fa70ba2d1448fd3d691a5c4370d8f7bbf1c2f64c24d461270f2117e1b0afe8cb3114f13bbd8e51de158c2a224953960331904e636a5e4c0f2a +"kleur@npm:^3.0.3": + version: 3.0.3 + resolution: "kleur@npm:3.0.3" + checksum: cd3a0b8878e7d6d3799e54340efe3591ca787d9f95f109f28129bdd2915e37807bf8918bb295ab86afb8c82196beec5a1adcaf29042ce3f2bd932b038fe3aa4b languageName: node linkType: hard -"levn@npm:^0.4.1": - version: 0.4.1 - resolution: "levn@npm:0.4.1" - dependencies: - prelude-ls: "npm:^1.2.1" - type-check: "npm:~0.4.0" - checksum: effb03cad7c89dfa5bd4f6989364bfc79994c2042ec5966cb9b95990e2edee5cd8969ddf42616a0373ac49fac1403437deaf6e9050fbbaa3546093a59b9ac94e +"kleur@npm:^4.0.3, kleur@npm:^4.1.4, kleur@npm:^4.1.5": + version: 4.1.5 + resolution: "kleur@npm:4.1.5" + checksum: e9de6cb49657b6fa70ba2d1448fd3d691a5c4370d8f7bbf1c2f64c24d461270f2117e1b0afe8cb3114f13bbd8e51de158c2a224953960331904e636a5e4c0f2a languageName: node linkType: hard @@ -3734,19 +5498,6 @@ __metadata: languageName: node linkType: hard -"load-json-file@npm:^1.0.0": - version: 1.1.0 - resolution: "load-json-file@npm:1.1.0" - dependencies: - graceful-fs: "npm:^4.1.2" - parse-json: "npm:^2.2.0" - pify: "npm:^2.0.0" - pinkie-promise: "npm:^2.0.0" - strip-bom: "npm:^2.0.0" - checksum: 2a5344c2d88643735a938fdca8582c0504e1c290577faa74f56b9cc187fa443832709a15f36e5771f779ec0878215a03abc8faf97ec57bb86092ceb7e0caef22 - languageName: node - linkType: hard - "load-tsconfig@npm:^0.2.3": version: 0.2.5 resolution: "load-tsconfig@npm:0.2.5" @@ -3766,10 +5517,13 @@ __metadata: languageName: node linkType: hard -"local-pkg@npm:^0.4.3": - version: 0.4.3 - resolution: "local-pkg@npm:0.4.3" - checksum: 361c77d7873a629f09c9e86128926227171ee0fe3435d282fb80303ff255bb4d3c053b555d47e953b4f41d2561f2a7bc0e53e9ca5c9bc9607226a77c91ea4994 +"local-pkg@npm:^0.5.0": + version: 0.5.0 + resolution: "local-pkg@npm:0.5.0" + dependencies: + mlly: "npm:^1.4.2" + pkg-types: "npm:^1.0.3" + checksum: f61cbd00d7689f275558b1a45c7ff2a3ddf8472654123ed880215677b9adfa729f1081e50c27ffb415cdb9fa706fb755fec5e23cdd965be375c8059e87ff1cc9 languageName: node linkType: hard @@ -3819,6 +5573,23 @@ __metadata: languageName: node linkType: hard +"log-symbols@npm:^5.1.0": + version: 5.1.0 + resolution: "log-symbols@npm:5.1.0" + dependencies: + chalk: "npm:^5.0.0" + is-unicode-supported: "npm:^1.1.0" + checksum: c14f8567c6618a7f96209c4c4b9fb3b794187116904712f7b526e465a5c9535728aec983735a5bef919247d0e54b9b72b6680a7fb9fc72d76b945dac4865e669 + languageName: node + linkType: hard + +"longest-streak@npm:^3.0.0": + version: 3.1.0 + resolution: "longest-streak@npm:3.1.0" + checksum: 7c2f02d0454b52834d1bcedef79c557bd295ee71fdabb02d041ff3aa9da48a90b5df7c0409156dedbc4df9b65da18742652aaea4759d6ece01f08971af6a7eaa + languageName: node + linkType: hard + "loupe@npm:^2.3.6": version: 2.3.6 resolution: "loupe@npm:2.3.6" @@ -3828,122 +5599,926 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^4.0.1": - version: 4.1.5 - resolution: "lru-cache@npm:4.1.5" +"loupe@npm:^2.3.7": + version: 2.3.7 + resolution: "loupe@npm:2.3.7" + dependencies: + get-func-name: "npm:^2.0.1" + checksum: 71a781c8fc21527b99ed1062043f1f2bb30bdaf54fa4cf92463427e1718bc6567af2988300bc243c1f276e4f0876f29e3cbf7b58106fdc186915687456ce5bf4 + languageName: node + linkType: hard + +"lru-cache@npm:^4.0.1": + version: 4.1.5 + resolution: "lru-cache@npm:4.1.5" + dependencies: + pseudomap: "npm:^1.0.2" + yallist: "npm:^2.1.2" + checksum: 1ca5306814e5add9ec63556d6fd9b24a4ecdeaef8e9cea52cbf30301e6b88c8d8ddc7cab45b59b56eb763e6c45af911585dc89925a074ab65e1502e3fe8103cf + languageName: node + linkType: hard + +"lru-cache@npm:^5.1.1": + version: 5.1.1 + resolution: "lru-cache@npm:5.1.1" + dependencies: + yallist: "npm:^3.0.2" + checksum: 89b2ef2ef45f543011e38737b8a8622a2f8998cddf0e5437174ef8f1f70a8b9d14a918ab3e232cb3ba343b7abddffa667f0b59075b2b80e6b4d63c3de6127482 + languageName: node + linkType: hard + +"lru-cache@npm:^6.0.0": + version: 6.0.0 + resolution: "lru-cache@npm:6.0.0" + dependencies: + yallist: "npm:^4.0.0" + checksum: cb53e582785c48187d7a188d3379c181b5ca2a9c78d2bce3e7dee36f32761d1c42983da3fe12b55cb74e1779fa94cdc2e5367c028a9b35317184ede0c07a30a9 + languageName: node + linkType: hard + +"lru-cache@npm:^7.7.1": + version: 7.18.3 + resolution: "lru-cache@npm:7.18.3" + checksum: b3a452b491433db885beed95041eb104c157ef7794b9c9b4d647be503be91769d11206bb573849a16b4cc0d03cbd15ffd22df7960997788b74c1d399ac7a4fed + languageName: node + linkType: hard + +"lru-cache@npm:^9.1.1 || ^10.0.0": + version: 10.0.0 + resolution: "lru-cache@npm:10.0.0" + checksum: 347b7b391091e9f91182b6f683ce04329932a542376a2d7d300637213b99f06c222a3bb0f0db59adf246dac6cef1bb509cab352451a96621d07c41b10a20495f + languageName: node + linkType: hard + +"magic-string@npm:^0.30.3, magic-string@npm:^0.30.5": + version: 0.30.5 + resolution: "magic-string@npm:0.30.5" + dependencies: + "@jridgewell/sourcemap-codec": "npm:^1.4.15" + checksum: 38ac220ca7539e96da7ea2f38d85796bdf5c69b6bcae728c4bc2565084e6dc326b9174ee9770bea345cf6c9b3a24041b767167874fab5beca874d2356a9d1520 + languageName: node + linkType: hard + +"magicast@npm:^0.3.2": + version: 0.3.2 + resolution: "magicast@npm:0.3.2" + dependencies: + "@babel/parser": "npm:^7.23.3" + "@babel/types": "npm:^7.23.3" + source-map-js: "npm:^1.0.2" + checksum: cd157b250d962ccdb313f250509220f10ad63f673d88a0a001d201fd2b2dae90c6c65c4e9b6ce164f05c25c400139715edce750e3e2f41b5a249e29225d6c4fb + languageName: node + linkType: hard + +"make-dir@npm:^4.0.0": + version: 4.0.0 + resolution: "make-dir@npm:4.0.0" + dependencies: + semver: "npm:^7.5.3" + checksum: 69b98a6c0b8e5c4fe9acb61608a9fbcfca1756d910f51e5dbe7a9e5cfb74fca9b8a0c8a0ffdf1294a740826c1ab4871d5bf3f62f72a3049e5eac6541ddffed68 + languageName: node + linkType: hard + +"make-fetch-happen@npm:^11.0.3": + version: 11.1.1 + resolution: "make-fetch-happen@npm:11.1.1" + dependencies: + agentkeepalive: "npm:^4.2.1" + cacache: "npm:^17.0.0" + http-cache-semantics: "npm:^4.1.1" + http-proxy-agent: "npm:^5.0.0" + https-proxy-agent: "npm:^5.0.0" + is-lambda: "npm:^1.0.1" + lru-cache: "npm:^7.7.1" + minipass: "npm:^5.0.0" + minipass-fetch: "npm:^3.0.0" + minipass-flush: "npm:^1.0.5" + minipass-pipeline: "npm:^1.2.4" + negotiator: "npm:^0.6.3" + promise-retry: "npm:^2.0.1" + socks-proxy-agent: "npm:^7.0.0" + ssri: "npm:^10.0.0" + checksum: c161bde51dbc03382f9fac091734526a64dd6878205db6c338f70d2133df797b5b5166bff3091cf7d4785869d4b21e99a58139c1790c2fb1b5eec00f528f5f0b + languageName: node + linkType: hard + +"map-obj@npm:^1.0.0": + version: 1.0.1 + resolution: "map-obj@npm:1.0.1" + checksum: ccca88395e7d38671ed9f5652ecf471ecd546924be2fb900836b9da35e068a96687d96a5f93dcdfa94d9a27d649d2f10a84595590f89a347fb4dda47629dcc52 + languageName: node + linkType: hard + +"map-obj@npm:^4.0.0": + version: 4.3.0 + resolution: "map-obj@npm:4.3.0" + checksum: 1c19e1c88513c8abdab25c316367154c6a0a6a0f77e3e8c391bb7c0e093aefed293f539d026dc013d86219e5e4c25f23b0003ea588be2101ccd757bacc12d43b + languageName: node + linkType: hard + +"markdown-extensions@npm:^1.0.0": + version: 1.1.1 + resolution: "markdown-extensions@npm:1.1.1" + checksum: eb9154016502ad1fb4477683ddb5cae8ba3ca06451b381b04dc4c34e91d8d168129d50d404b717d6bf7d458e13088c109303fc72d57cee7151a6082b0e7bba71 + languageName: node + linkType: hard + +"markdown-table@npm:^3.0.0": + version: 3.0.3 + resolution: "markdown-table@npm:3.0.3" + checksum: 47433a3f31e4637a184e38e873ab1d2fadfb0106a683d466fec329e99a2d8dfa09f091fa42202c6f13ec94aef0199f449a684b28042c636f2edbc1b7e1811dcd + languageName: node + linkType: hard + +"mdast-util-definitions@npm:^5.0.0": + version: 5.1.2 + resolution: "mdast-util-definitions@npm:5.1.2" + dependencies: + "@types/mdast": "npm:^3.0.0" + "@types/unist": "npm:^2.0.0" + unist-util-visit: "npm:^4.0.0" + checksum: da9049c15562e44ee4ea4a36113d98c6c9eaa3d8a17d6da2aef6a0626376dcd01d9ec007d77a8dfcad6d0cbd5c32a4abbad72a3f48c3172a55934c7d9a916480 + languageName: node + linkType: hard + +"mdast-util-definitions@npm:^6.0.0": + version: 6.0.0 + resolution: "mdast-util-definitions@npm:6.0.0" + dependencies: + "@types/mdast": "npm:^4.0.0" + "@types/unist": "npm:^3.0.0" + unist-util-visit: "npm:^5.0.0" + checksum: a2e0e51122a3eff4f35379de2c50ee3d8a89bea58488a390b1b40ada95727eb769f87d4bc885e5935d61820d19e0567bc047876db302a2139f3a29668b612b80 + languageName: node + linkType: hard + +"mdast-util-directive@npm:^2.0.0": + version: 2.2.4 + resolution: "mdast-util-directive@npm:2.2.4" + dependencies: + "@types/mdast": "npm:^3.0.0" + "@types/unist": "npm:^2.0.0" + mdast-util-from-markdown: "npm:^1.3.0" + mdast-util-to-markdown: "npm:^1.5.0" + parse-entities: "npm:^4.0.0" + stringify-entities: "npm:^4.0.0" + unist-util-visit-parents: "npm:^5.1.3" + checksum: ec426a547e83fdbc1e93d65e2fa1a39c2915ddacdf0685bbc9fa8b73a8761d3ef323e2d71bad4f0d0f3b1f994054d3521c8346072a59c1fa1aaeaa44342f3c80 + languageName: node + linkType: hard + +"mdast-util-find-and-replace@npm:^2.0.0": + version: 2.2.2 + resolution: "mdast-util-find-and-replace@npm:2.2.2" + dependencies: + "@types/mdast": "npm:^3.0.0" + escape-string-regexp: "npm:^5.0.0" + unist-util-is: "npm:^5.0.0" + unist-util-visit-parents: "npm:^5.0.0" + checksum: ce935f4bd4aeab47f91531a7f09dfab89aaeea62ad31029b43185c5b626921357703d8e5093c13073c097fdabfc57cb2f884d7dfad83dbe7239e351375d6797c + languageName: node + linkType: hard + +"mdast-util-from-markdown@npm:^1.0.0, mdast-util-from-markdown@npm:^1.1.0, mdast-util-from-markdown@npm:^1.3.0": + version: 1.3.1 + resolution: "mdast-util-from-markdown@npm:1.3.1" + dependencies: + "@types/mdast": "npm:^3.0.0" + "@types/unist": "npm:^2.0.0" + decode-named-character-reference: "npm:^1.0.0" + mdast-util-to-string: "npm:^3.1.0" + micromark: "npm:^3.0.0" + micromark-util-decode-numeric-character-reference: "npm:^1.0.0" + micromark-util-decode-string: "npm:^1.0.0" + micromark-util-normalize-identifier: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + unist-util-stringify-position: "npm:^3.0.0" + uvu: "npm:^0.5.0" + checksum: f4e901bf2a2e93fe35a339e0cff581efacce2f7117cd5652e9a270847bd7e2508b3e717b7b4156af54d4f896d63033e06ff9fafbf59a1d46fe17dd5e2a3f7846 + languageName: node + linkType: hard + +"mdast-util-gfm-autolink-literal@npm:^1.0.0": + version: 1.0.3 + resolution: "mdast-util-gfm-autolink-literal@npm:1.0.3" + dependencies: + "@types/mdast": "npm:^3.0.0" + ccount: "npm:^2.0.0" + mdast-util-find-and-replace: "npm:^2.0.0" + micromark-util-character: "npm:^1.0.0" + checksum: 750e312eae73c3f2e8aa0e8c5232cb1b905357ff37ac236927f1af50cdbee7c2cfe2379b148ac32fa4137eeb3b24601e1bb6135084af926c7cd808867804193f + languageName: node + linkType: hard + +"mdast-util-gfm-footnote@npm:^1.0.0": + version: 1.0.2 + resolution: "mdast-util-gfm-footnote@npm:1.0.2" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-to-markdown: "npm:^1.3.0" + micromark-util-normalize-identifier: "npm:^1.0.0" + checksum: 767973e46b9e2ae44e80e51a5e38ad0b032fc7f06a1a3095aa96c2886ba333941c764474a56b82e7db05efc56242a4789bc7fbbcc753d61512750e86a4192fe8 + languageName: node + linkType: hard + +"mdast-util-gfm-strikethrough@npm:^1.0.0": + version: 1.0.3 + resolution: "mdast-util-gfm-strikethrough@npm:1.0.3" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-to-markdown: "npm:^1.3.0" + checksum: 29616b3dfdd33d3cd13f9b3181a8562fa2fbacfcb04a37dba3c690ba6829f0231b145444de984726d9277b2bc90dd7d96fb9df9f6292d5e77d65a8659ee2f52b + languageName: node + linkType: hard + +"mdast-util-gfm-table@npm:^1.0.0": + version: 1.0.7 + resolution: "mdast-util-gfm-table@npm:1.0.7" + dependencies: + "@types/mdast": "npm:^3.0.0" + markdown-table: "npm:^3.0.0" + mdast-util-from-markdown: "npm:^1.0.0" + mdast-util-to-markdown: "npm:^1.3.0" + checksum: a37a05a936292c4f48394123332d3c034a6e1b15bb3e7f3b94e6bce3260c9184fd388abbc4100827edd5485a6563098306994d15a729bde3c96de7a62ed5720b + languageName: node + linkType: hard + +"mdast-util-gfm-task-list-item@npm:^1.0.0": + version: 1.0.2 + resolution: "mdast-util-gfm-task-list-item@npm:1.0.2" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-to-markdown: "npm:^1.3.0" + checksum: 91fa91f7d1a8797bf129008dab12d23917015ad12df00044e275b4459e8b383fbec6234338953a0089ef9c3a114d0a360c3e652eb0ebf6ece7e7a8fd3b5977c6 + languageName: node + linkType: hard + +"mdast-util-gfm@npm:^2.0.0": + version: 2.0.2 + resolution: "mdast-util-gfm@npm:2.0.2" + dependencies: + mdast-util-from-markdown: "npm:^1.0.0" + mdast-util-gfm-autolink-literal: "npm:^1.0.0" + mdast-util-gfm-footnote: "npm:^1.0.0" + mdast-util-gfm-strikethrough: "npm:^1.0.0" + mdast-util-gfm-table: "npm:^1.0.0" + mdast-util-gfm-task-list-item: "npm:^1.0.0" + mdast-util-to-markdown: "npm:^1.0.0" + checksum: 5b7f7f98a90a2962d7e0787e080c4e55b70119100c7685bbdb772d8d7865524aeffd1757edba5afba434250e0246b987c0617c2c635baaf51c26dbbb3b72dbec + languageName: node + linkType: hard + +"mdast-util-mdx-expression@npm:^1.0.0": + version: 1.3.2 + resolution: "mdast-util-mdx-expression@npm:1.3.2" + dependencies: + "@types/estree-jsx": "npm:^1.0.0" + "@types/hast": "npm:^2.0.0" + "@types/mdast": "npm:^3.0.0" + mdast-util-from-markdown: "npm:^1.0.0" + mdast-util-to-markdown: "npm:^1.0.0" + checksum: 01f306ee809d28825cbec23b3c80376a0fbe69601b6b2843d23beb5662a31ec7560995f52b96b13093cc03de1130404a47f139d16f58c3f54e91e88f4bdd82d2 + languageName: node + linkType: hard + +"mdast-util-mdx-jsx@npm:^2.0.0": + version: 2.1.4 + resolution: "mdast-util-mdx-jsx@npm:2.1.4" + dependencies: + "@types/estree-jsx": "npm:^1.0.0" + "@types/hast": "npm:^2.0.0" + "@types/mdast": "npm:^3.0.0" + "@types/unist": "npm:^2.0.0" + ccount: "npm:^2.0.0" + mdast-util-from-markdown: "npm:^1.1.0" + mdast-util-to-markdown: "npm:^1.3.0" + parse-entities: "npm:^4.0.0" + stringify-entities: "npm:^4.0.0" + unist-util-remove-position: "npm:^4.0.0" + unist-util-stringify-position: "npm:^3.0.0" + vfile-message: "npm:^3.0.0" + checksum: b0c16e56a99c5167e60c98dbdbe82645549630fb529688642c4664ca5557ff0b3029c75146f5657cadb7908d5fa99810eacc5dcc51676d0877c8b4dcebb11cbe + languageName: node + linkType: hard + +"mdast-util-mdx@npm:^2.0.0": + version: 2.0.1 + resolution: "mdast-util-mdx@npm:2.0.1" + dependencies: + mdast-util-from-markdown: "npm:^1.0.0" + mdast-util-mdx-expression: "npm:^1.0.0" + mdast-util-mdx-jsx: "npm:^2.0.0" + mdast-util-mdxjs-esm: "npm:^1.0.0" + mdast-util-to-markdown: "npm:^1.0.0" + checksum: 3b5e55781a7b7b4b7e71728a84afbec63516f251b3556efec52dbb4824c0733f5ebaa907d21211d008e5cb1a8265e6704bc062ee605f4c09e90fbfa2c6fbba3b + languageName: node + linkType: hard + +"mdast-util-mdxjs-esm@npm:^1.0.0": + version: 1.3.1 + resolution: "mdast-util-mdxjs-esm@npm:1.3.1" + dependencies: + "@types/estree-jsx": "npm:^1.0.0" + "@types/hast": "npm:^2.0.0" + "@types/mdast": "npm:^3.0.0" + mdast-util-from-markdown: "npm:^1.0.0" + mdast-util-to-markdown: "npm:^1.0.0" + checksum: 2ff0af34ea62004d39f15bd45b79e3008e68cae7e2510c9281e24a17e2c3f55d004524796166ef5aa3378798ca7f6c5f88883238f413577619bbaf41026b7e62 + languageName: node + linkType: hard + +"mdast-util-phrasing@npm:^3.0.0": + version: 3.0.1 + resolution: "mdast-util-phrasing@npm:3.0.1" + dependencies: + "@types/mdast": "npm:^3.0.0" + unist-util-is: "npm:^5.0.0" + checksum: 5e00e303652a7581593549dbce20dfb69d687d79a972f7928f6ca1920ef5385bceb737a3d5292ab6d937ed8c67bb59771e80e88f530b78734fe7d155f833e32b + languageName: node + linkType: hard + +"mdast-util-to-hast@npm:12.3.0, mdast-util-to-hast@npm:^12.1.0": + version: 12.3.0 + resolution: "mdast-util-to-hast@npm:12.3.0" + dependencies: + "@types/hast": "npm:^2.0.0" + "@types/mdast": "npm:^3.0.0" + mdast-util-definitions: "npm:^5.0.0" + micromark-util-sanitize-uri: "npm:^1.1.0" + trim-lines: "npm:^3.0.0" + unist-util-generated: "npm:^2.0.0" + unist-util-position: "npm:^4.0.0" + unist-util-visit: "npm:^4.0.0" + checksum: 0753e45bfcce423f7a13979ac720a23ed8d6bafed174c387f43bbe8baf3838f3a043cd8006975b71e5c4068b7948f83f1348acea79801101af31eaec4e7a499a + languageName: node + linkType: hard + +"mdast-util-to-hast@npm:^13.0.0": + version: 13.0.2 + resolution: "mdast-util-to-hast@npm:13.0.2" + dependencies: + "@types/hast": "npm:^3.0.0" + "@types/mdast": "npm:^4.0.0" + "@ungap/structured-clone": "npm:^1.0.0" + devlop: "npm:^1.0.0" + micromark-util-sanitize-uri: "npm:^2.0.0" + trim-lines: "npm:^3.0.0" + unist-util-position: "npm:^5.0.0" + unist-util-visit: "npm:^5.0.0" + checksum: f6e9a5b1ab94483ce1cf2ef229578fde4fe7d085f8b9d88a048823da5f93f9469adc98839e8db73f7475e8128a6df30eccad9cd0f9ee0a1d410e74db19b82d8c + languageName: node + linkType: hard + +"mdast-util-to-markdown@npm:^1.0.0, mdast-util-to-markdown@npm:^1.3.0, mdast-util-to-markdown@npm:^1.5.0": + version: 1.5.0 + resolution: "mdast-util-to-markdown@npm:1.5.0" + dependencies: + "@types/mdast": "npm:^3.0.0" + "@types/unist": "npm:^2.0.0" + longest-streak: "npm:^3.0.0" + mdast-util-phrasing: "npm:^3.0.0" + mdast-util-to-string: "npm:^3.0.0" + micromark-util-decode-string: "npm:^1.0.0" + unist-util-visit: "npm:^4.0.0" + zwitch: "npm:^2.0.0" + checksum: 9831d14aa6c097750a90c7b87b4e814b040731c30606a794c9b136dc746633dd9ec07154ca97d4fec4eaf732cf89d14643424e2581732d6ee18c9b0e51ff7664 + languageName: node + linkType: hard + +"mdast-util-to-string@npm:^3.0.0, mdast-util-to-string@npm:^3.1.0": + version: 3.2.0 + resolution: "mdast-util-to-string@npm:3.2.0" + dependencies: + "@types/mdast": "npm:^3.0.0" + checksum: 112f4bf0f6758dcb95deffdcf37afba7eaecdfe2ee13252de031723094d4d55220e147326690a8b91244758e2d678e7aeb1fdd0fa6ef3317c979bc42effd9a21 + languageName: node + linkType: hard + +"meow@npm:^6.0.0": + version: 6.1.1 + resolution: "meow@npm:6.1.1" + dependencies: + "@types/minimist": "npm:^1.2.0" + camelcase-keys: "npm:^6.2.2" + decamelize-keys: "npm:^1.1.0" + hard-rejection: "npm:^2.1.0" + minimist-options: "npm:^4.0.2" + normalize-package-data: "npm:^2.5.0" + read-pkg-up: "npm:^7.0.1" + redent: "npm:^3.0.0" + trim-newlines: "npm:^3.0.0" + type-fest: "npm:^0.13.1" + yargs-parser: "npm:^18.1.3" + checksum: ceece1e5e09a53d7bf298ef137477e395a0dd30c8ed1a9980a52caad02eccffd6bce1a5cad4596cd694e7e924e949253f0cc1e7c22073c07ce7b06cfefbcf8be + languageName: node + linkType: hard + +"merge-stream@npm:^2.0.0": + version: 2.0.0 + resolution: "merge-stream@npm:2.0.0" + checksum: 867fdbb30a6d58b011449b8885601ec1690c3e41c759ecd5a9d609094f7aed0096c37823ff4a7190ef0b8f22cc86beb7049196ff68c016e3b3c671d0dac91ce5 + languageName: node + linkType: hard + +"merge2@npm:^1.3.0, merge2@npm:^1.4.1": + version: 1.4.1 + resolution: "merge2@npm:1.4.1" + checksum: 254a8a4605b58f450308fc474c82ac9a094848081bf4c06778200207820e5193726dc563a0d2c16468810516a5c97d9d3ea0ca6585d23c58ccfff2403e8dbbeb + languageName: node + linkType: hard + +"micromark-core-commonmark@npm:^1.0.0, micromark-core-commonmark@npm:^1.0.1": + version: 1.1.0 + resolution: "micromark-core-commonmark@npm:1.1.0" + dependencies: + decode-named-character-reference: "npm:^1.0.0" + micromark-factory-destination: "npm:^1.0.0" + micromark-factory-label: "npm:^1.0.0" + micromark-factory-space: "npm:^1.0.0" + micromark-factory-title: "npm:^1.0.0" + micromark-factory-whitespace: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-chunked: "npm:^1.0.0" + micromark-util-classify-character: "npm:^1.0.0" + micromark-util-html-tag-name: "npm:^1.0.0" + micromark-util-normalize-identifier: "npm:^1.0.0" + micromark-util-resolve-all: "npm:^1.0.0" + micromark-util-subtokenize: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.1" + uvu: "npm:^0.5.0" + checksum: b3bf7b7004ce7dbb3ae151dcca4db1d12546f1b943affb2418da4b90b9ce59357373c433ee2eea4c868aee0791dafa355aeed19f5ef2b0acaf271f32f1ecbe6a + languageName: node + linkType: hard + +"micromark-extension-directive@npm:^2.0.0": + version: 2.2.1 + resolution: "micromark-extension-directive@npm:2.2.1" + dependencies: + micromark-factory-space: "npm:^1.0.0" + micromark-factory-whitespace: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + parse-entities: "npm:^4.0.0" + uvu: "npm:^0.5.0" + checksum: 9034298c99e904d92aec154de03328016b9c6f76d5659fa866e6a409cf598af7a63ba08a6144c202950464220a13c63106674d4e6b74a75c033bd95620efffef + languageName: node + linkType: hard + +"micromark-extension-gfm-autolink-literal@npm:^1.0.0": + version: 1.0.5 + resolution: "micromark-extension-gfm-autolink-literal@npm:1.0.5" + dependencies: + micromark-util-character: "npm:^1.0.0" + micromark-util-sanitize-uri: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 4964a52605ac36d24501d427e2d173fa39b5e0402275cb45068eba4898f4cb9cc57f7007b21b7514f0ab5f7b371b1701a5156a10b6ac8e77a7f36e830cf481d4 + languageName: node + linkType: hard + +"micromark-extension-gfm-footnote@npm:^1.0.0": + version: 1.1.2 + resolution: "micromark-extension-gfm-footnote@npm:1.1.2" + dependencies: + micromark-core-commonmark: "npm:^1.0.0" + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-normalize-identifier: "npm:^1.0.0" + micromark-util-sanitize-uri: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: b8090876cc3da5436c6253b0b40e39ceaa470c2429f699c19ee4163cef3102c4cd16c4ac2ec8caf916037fad310cfb52a9ef182c75d50fca7419ba08faad9b39 + languageName: node + linkType: hard + +"micromark-extension-gfm-strikethrough@npm:^1.0.0": + version: 1.0.7 + resolution: "micromark-extension-gfm-strikethrough@npm:1.0.7" + dependencies: + micromark-util-chunked: "npm:^1.0.0" + micromark-util-classify-character: "npm:^1.0.0" + micromark-util-resolve-all: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: b45fe93a7a412fc44bae7a183b92a988e17b49ed9d683bd80ee4dde96d462e1ca6b316dd64bda7759e4086d6d8686790a711e53c244f1f4d2b37e1cfe852884d + languageName: node + linkType: hard + +"micromark-extension-gfm-table@npm:^1.0.0": + version: 1.0.7 + resolution: "micromark-extension-gfm-table@npm:1.0.7" + dependencies: + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: 38b5af80ecab8206845a057338235bee6f47fb6cb904208be4b76e87906765821683e25bef85dfa485809f931eaf8cd55f16cd2f4d6e33b84f56edfaf1dfb129 + languageName: node + linkType: hard + +"micromark-extension-gfm-tagfilter@npm:^1.0.0": + version: 1.0.2 + resolution: "micromark-extension-gfm-tagfilter@npm:1.0.2" + dependencies: + micromark-util-types: "npm:^1.0.0" + checksum: 7e1bf278255cf2a8d2dda9de84bc238b39c53100e25ba8d7168220d5b00dc74869a6cb038fbf2e76b8ae89efc66906762311797a906d7d9cdd71e07bfe1ed505 + languageName: node + linkType: hard + +"micromark-extension-gfm-task-list-item@npm:^1.0.0": + version: 1.0.5 + resolution: "micromark-extension-gfm-task-list-item@npm:1.0.5" + dependencies: + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: 2179742fa2cbb243cc06bd9e43fbb94cd98e4814c9d368ddf8b4b5afa0348023f335626ae955e89d679e2c2662a7f82c315117a3b060c87bdb4420fee5a219d1 + languageName: node + linkType: hard + +"micromark-extension-gfm@npm:^2.0.0": + version: 2.0.3 + resolution: "micromark-extension-gfm@npm:2.0.3" + dependencies: + micromark-extension-gfm-autolink-literal: "npm:^1.0.0" + micromark-extension-gfm-footnote: "npm:^1.0.0" + micromark-extension-gfm-strikethrough: "npm:^1.0.0" + micromark-extension-gfm-table: "npm:^1.0.0" + micromark-extension-gfm-tagfilter: "npm:^1.0.0" + micromark-extension-gfm-task-list-item: "npm:^1.0.0" + micromark-util-combine-extensions: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 53056376d14caf3fab2cc44881c1ad49d975776cc2267bca74abda2cb31f2a77ec0fb2bdb2dd97565f0d9943ad915ff192b89c1cee5d9d727569a5e38505799b + languageName: node + linkType: hard + +"micromark-extension-mdx-expression@npm:^1.0.0": + version: 1.0.8 + resolution: "micromark-extension-mdx-expression@npm:1.0.8" + dependencies: + "@types/estree": "npm:^1.0.0" + micromark-factory-mdx-expression: "npm:^1.0.0" + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-events-to-acorn: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: 99e2997a54caafc4258979c0591b3fe8e31018079df833d559768092fec41e57a71225d423f4179cea4e8bc1af2f52f5c9ae640673619d8fe142ded875240da3 + languageName: node + linkType: hard + +"micromark-extension-mdx-jsx@npm:^1.0.0": + version: 1.0.5 + resolution: "micromark-extension-mdx-jsx@npm:1.0.5" + dependencies: + "@types/acorn": "npm:^4.0.0" + "@types/estree": "npm:^1.0.0" + estree-util-is-identifier-name: "npm:^2.0.0" + micromark-factory-mdx-expression: "npm:^1.0.0" + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + vfile-message: "npm:^3.0.0" + checksum: 1b4bfbe60b9cabfabfb870f70ded8da0caacbaa3be6bdf07f6db25cc5a14c6bc970c34c60e5c80da1e97766064a117feb8160b6d661d69e530a4cc7ec97305de + languageName: node + linkType: hard + +"micromark-extension-mdx-md@npm:^1.0.0": + version: 1.0.1 + resolution: "micromark-extension-mdx-md@npm:1.0.1" + dependencies: + micromark-util-types: "npm:^1.0.0" + checksum: 9ad70b3a5e842fd7ebd93c8c48a32fd3d05fe77be06a08ef32462ea53e97d8f297e2c1c4b30a6929dbd05125279fe98bb04e9cc0bb686c691bdcf7d36c6e51b0 + languageName: node + linkType: hard + +"micromark-extension-mdxjs-esm@npm:^1.0.0": + version: 1.0.5 + resolution: "micromark-extension-mdxjs-esm@npm:1.0.5" + dependencies: + "@types/estree": "npm:^1.0.0" + micromark-core-commonmark: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-events-to-acorn: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + unist-util-position-from-estree: "npm:^1.1.0" + uvu: "npm:^0.5.0" + vfile-message: "npm:^3.0.0" + checksum: 612028bced78e882641a43c78fc4813a573b383dc0a7b90db75ed88b37bf5b5997dc7ead4a1011315b34f17bc76b7f4419de6ad9532a088102ab1eea0245d380 + languageName: node + linkType: hard + +"micromark-extension-mdxjs@npm:^1.0.0": + version: 1.0.1 + resolution: "micromark-extension-mdxjs@npm:1.0.1" + dependencies: + acorn: "npm:^8.0.0" + acorn-jsx: "npm:^5.0.0" + micromark-extension-mdx-expression: "npm:^1.0.0" + micromark-extension-mdx-jsx: "npm:^1.0.0" + micromark-extension-mdx-md: "npm:^1.0.0" + micromark-extension-mdxjs-esm: "npm:^1.0.0" + micromark-util-combine-extensions: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 3f123e4afea9674c96934c9ea6a057ec9e5584992c50c36c173a2e331d272b1f4e2a8552364a0e2cb50703d0218831fdae1a17b563f0009aac6a35350e6a7b77 + languageName: node + linkType: hard + +"micromark-factory-destination@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-factory-destination@npm:1.1.0" + dependencies: + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 71ebd9089bf0c9689b98ef42215c04032ae2701ae08c3546b663628553255dca18e5310dbdacddad3acd8de4f12a789835fff30dadc4da3c4e30387a75e6b488 + languageName: node + linkType: hard + +"micromark-factory-label@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-factory-label@npm:1.1.0" + dependencies: + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: 5e2cd2d8214bb92a34dfcedf9c7aecf565e3648650a3a6a0495ededf15f2318dd214dc069e3026402792cd5839d395313f8ef9c2e86ca34a8facaa0f75a77753 + languageName: node + linkType: hard + +"micromark-factory-mdx-expression@npm:^1.0.0": + version: 1.0.9 + resolution: "micromark-factory-mdx-expression@npm:1.0.9" + dependencies: + "@types/estree": "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-events-to-acorn: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + unist-util-position-from-estree: "npm:^1.0.0" + uvu: "npm:^0.5.0" + vfile-message: "npm:^3.0.0" + checksum: b28bd8e072f37ca91446fe8d113e4ae64baaef013b0cde4aa224add0ee40963ce3584b9709f7662d30491f875ae7104b897d37efa26cdaecf25082ed5bac7b8c + languageName: node + linkType: hard + +"micromark-factory-space@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-factory-space@npm:1.1.0" + dependencies: + micromark-util-character: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 3da81187ce003dd4178c7adc4674052fb8befc8f1a700ae4c8227755f38581a4ae963866dc4857488d62d1dc9837606c9f2f435fa1332f62a0f1c49b83c6a822 + languageName: node + linkType: hard + +"micromark-factory-title@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-factory-title@npm:1.1.0" + dependencies: + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: cf8c687d1d5c3928846a4791d4a7e2f1d7bdd2397051e20d60f06b7565a48bf85198ab6f85735e997ab3f0cbb80b8b6391f4f7ebc0aae2f2f8c3a08541257bf6 + languageName: node + linkType: hard + +"micromark-factory-whitespace@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-factory-whitespace@npm:1.1.0" + dependencies: + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 7248cc4534f9befb38c6f398b6e38efd3199f1428fc214c9cb7ed5b6e9fa7a82c0d8cdfa9bcacde62887c9a7c8c46baf5c318b2ae8f701afbccc8ad702e92dce + languageName: node + linkType: hard + +"micromark-util-character@npm:^1.0.0": + version: 1.2.0 + resolution: "micromark-util-character@npm:1.2.0" + dependencies: + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 3390a675a50731b58a8e5493cd802e190427f10fa782079b455b00f6b54e406e36882df7d4a3bd32b709f7a2c3735b4912597ebc1c0a99566a8d8d0b816e2cd4 + languageName: node + linkType: hard + +"micromark-util-character@npm:^2.0.0": + version: 2.0.1 + resolution: "micromark-util-character@npm:2.0.1" + dependencies: + micromark-util-symbol: "npm:^2.0.0" + micromark-util-types: "npm:^2.0.0" + checksum: 5b91c90f29c8873a9f2f2385bbeb70f481b0e56c26092451d1796cd323257927a69eccca19b079d83d5751ec6fc92964214a3c868114555f87631426631df6b9 + languageName: node + linkType: hard + +"micromark-util-chunked@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-chunked@npm:1.1.0" + dependencies: + micromark-util-symbol: "npm:^1.0.0" + checksum: 59534cf4aaf481ed58d65478d00eae0080df9b5816673f79b5ddb0cea263e5a9ee9cbb6cc565daf1eb3c8c4ff86fc4e25d38a0577539655cda823a4249efd358 + languageName: node + linkType: hard + +"micromark-util-classify-character@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-classify-character@npm:1.1.0" + dependencies: + micromark-util-character: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 3266453dc0fdaf584e24c9b3c91d1ed180f76b5856699c51fd2549305814fcab7ec52afb4d3e83d002a9115cd2d2b2ffdc9c0b38ed85120822bf515cc00636ec + languageName: node + linkType: hard + +"micromark-util-combine-extensions@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-combine-extensions@npm:1.1.0" + dependencies: + micromark-util-chunked: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + checksum: 0bc572fab3fe77f533c29aa1b75cb847b9fc9455f67a98623ef9740b925c0b0426ad9f09bbb56f1e844ea9ebada7873d1f06d27f7c979a917692b273c4b69e31 + languageName: node + linkType: hard + +"micromark-util-decode-numeric-character-reference@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-decode-numeric-character-reference@npm:1.1.0" + dependencies: + micromark-util-symbol: "npm:^1.0.0" + checksum: 64ef2575e3fc2426976c19e16973348f20b59ddd5543f1467ac2e251f29e0a91f12089703d29ae985b0b9a408ee0d72f06d04ed3920811aa2402aabca3bdf9e4 + languageName: node + linkType: hard + +"micromark-util-decode-string@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-decode-string@npm:1.1.0" + dependencies: + decode-named-character-reference: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-decode-numeric-character-reference: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + checksum: 757a0aaa5ad6c50c7480bd75371d407ac75f5022cd4404aba07adadf1448189502aea9bb7b2d09d25e18745e0abf72b95506b6beb184bcccabe919e48e3a5df7 + languageName: node + linkType: hard + +"micromark-util-encode@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-encode@npm:1.1.0" + checksum: 9878c9bc96999d45626a7597fffac85348ea842dce75d2417345cbf070a9941c62477bd0963bef37d4f0fd29f2982be6ddf416d62806f00ccb334af9d6ee87e7 + languageName: node + linkType: hard + +"micromark-util-encode@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-encode@npm:2.0.0" + checksum: ebdaafff23100bbf4c74e63b4b1612a9ddf94cd7211d6a076bc6fb0bc32c1b48d6fb615aa0953e607c62c97d849f97f1042260d3eb135259d63d372f401bbbb2 + languageName: node + linkType: hard + +"micromark-util-events-to-acorn@npm:^1.0.0": + version: 1.2.3 + resolution: "micromark-util-events-to-acorn@npm:1.2.3" dependencies: - pseudomap: "npm:^1.0.2" - yallist: "npm:^2.1.2" - checksum: 1ca5306814e5add9ec63556d6fd9b24a4ecdeaef8e9cea52cbf30301e6b88c8d8ddc7cab45b59b56eb763e6c45af911585dc89925a074ab65e1502e3fe8103cf + "@types/acorn": "npm:^4.0.0" + "@types/estree": "npm:^1.0.0" + "@types/unist": "npm:^2.0.0" + estree-util-visit: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + vfile-message: "npm:^3.0.0" + checksum: cd3af7365806a0b22efb83cb7726cb835725c0bc22e04f7ea83f2f38a09e7132413eff6ab6d53652b969a7ec30e442731c3abbbe8a74dc2081c51fd10223c269 languageName: node linkType: hard -"lru-cache@npm:^6.0.0": - version: 6.0.0 - resolution: "lru-cache@npm:6.0.0" - dependencies: - yallist: "npm:^4.0.0" - checksum: cb53e582785c48187d7a188d3379c181b5ca2a9c78d2bce3e7dee36f32761d1c42983da3fe12b55cb74e1779fa94cdc2e5367c028a9b35317184ede0c07a30a9 +"micromark-util-html-tag-name@npm:^1.0.0": + version: 1.2.0 + resolution: "micromark-util-html-tag-name@npm:1.2.0" + checksum: 15421869678d36b4fe51df453921e8186bff514a14e9f79f32b7e1cdd67874e22a66ad34a7f048dd132cbbbfc7c382ae2f777a2bfd1f245a47705dc1c6d4f199 languageName: node linkType: hard -"lru-cache@npm:^7.7.1": - version: 7.18.3 - resolution: "lru-cache@npm:7.18.3" - checksum: b3a452b491433db885beed95041eb104c157ef7794b9c9b4d647be503be91769d11206bb573849a16b4cc0d03cbd15ffd22df7960997788b74c1d399ac7a4fed +"micromark-util-normalize-identifier@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-normalize-identifier@npm:1.1.0" + dependencies: + micromark-util-symbol: "npm:^1.0.0" + checksum: a9657321a2392584e4d978061882117a84db7d2c2c1c052c0f5d25da089d463edb9f956d5beaf7f5768984b6f72d046d59b5972951ec7bf25397687a62b8278a languageName: node linkType: hard -"lru-cache@npm:^9.1.1 || ^10.0.0": - version: 10.0.0 - resolution: "lru-cache@npm:10.0.0" - checksum: 347b7b391091e9f91182b6f683ce04329932a542376a2d7d300637213b99f06c222a3bb0f0db59adf246dac6cef1bb509cab352451a96621d07c41b10a20495f +"micromark-util-resolve-all@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-resolve-all@npm:1.1.0" + dependencies: + micromark-util-types: "npm:^1.0.0" + checksum: b5c95484c06e87bbbb60d8430eb030a458733a5270409f4c67892d1274737087ca6a7ca888987430e57cf1dcd44bb16390d3b3936a2bf07f7534ec8f52ce43c9 languageName: node linkType: hard -"magic-string@npm:^0.30.1": - version: 0.30.1 - resolution: "magic-string@npm:0.30.1" +"micromark-util-sanitize-uri@npm:^1.0.0, micromark-util-sanitize-uri@npm:^1.1.0": + version: 1.2.0 + resolution: "micromark-util-sanitize-uri@npm:1.2.0" dependencies: - "@jridgewell/sourcemap-codec": "npm:^1.4.15" - checksum: 30471bbe363196a57795f903025166ba9930f9a98ea4e23d2cfbb379756414aff01309eaa06d3ae23d3cc0497babf5c5d7d98c7aeca726335cddf2d9cd873e1c + micromark-util-character: "npm:^1.0.0" + micromark-util-encode: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + checksum: dbdb98248e9f0408c7a00f1c1cd805775b41d213defd659533835f34b38da38e8f990bf7b3f782e96bffbc549aec9c3ecdab197d4ad5adbfe08f814a70327b6e languageName: node linkType: hard -"make-fetch-happen@npm:^11.0.3": - version: 11.1.1 - resolution: "make-fetch-happen@npm:11.1.1" +"micromark-util-sanitize-uri@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-sanitize-uri@npm:2.0.0" dependencies: - agentkeepalive: "npm:^4.2.1" - cacache: "npm:^17.0.0" - http-cache-semantics: "npm:^4.1.1" - http-proxy-agent: "npm:^5.0.0" - https-proxy-agent: "npm:^5.0.0" - is-lambda: "npm:^1.0.1" - lru-cache: "npm:^7.7.1" - minipass: "npm:^5.0.0" - minipass-fetch: "npm:^3.0.0" - minipass-flush: "npm:^1.0.5" - minipass-pipeline: "npm:^1.2.4" - negotiator: "npm:^0.6.3" - promise-retry: "npm:^2.0.1" - socks-proxy-agent: "npm:^7.0.0" - ssri: "npm:^10.0.0" - checksum: c161bde51dbc03382f9fac091734526a64dd6878205db6c338f70d2133df797b5b5166bff3091cf7d4785869d4b21e99a58139c1790c2fb1b5eec00f528f5f0b + micromark-util-character: "npm:^2.0.0" + micromark-util-encode: "npm:^2.0.0" + micromark-util-symbol: "npm:^2.0.0" + checksum: 74763ca1c927dd520d3ab8fd9856a19740acf76fc091f0a1f5d4e99c8cd5f1b81c5a0be3efb564941a071fb6d85fd951103f2760eb6cff77b5ab3abe08341309 languageName: node linkType: hard -"map-obj@npm:^1.0.0": - version: 1.0.1 - resolution: "map-obj@npm:1.0.1" - checksum: ccca88395e7d38671ed9f5652ecf471ecd546924be2fb900836b9da35e068a96687d96a5f93dcdfa94d9a27d649d2f10a84595590f89a347fb4dda47629dcc52 +"micromark-util-subtokenize@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-subtokenize@npm:1.1.0" + dependencies: + micromark-util-chunked: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.0" + uvu: "npm:^0.5.0" + checksum: f292b1b162845db50d36255c9d4c4c6d47931fbca3ac98a80c7e536d2163233fd662f8ca0479ee2b80f145c66a1394c7ed17dfce801439741211015e77e3901e languageName: node linkType: hard -"map-obj@npm:^4.0.0": - version: 4.3.0 - resolution: "map-obj@npm:4.3.0" - checksum: 1c19e1c88513c8abdab25c316367154c6a0a6a0f77e3e8c391bb7c0e093aefed293f539d026dc013d86219e5e4c25f23b0003ea588be2101ccd757bacc12d43b +"micromark-util-symbol@npm:^1.0.0": + version: 1.1.0 + resolution: "micromark-util-symbol@npm:1.1.0" + checksum: 10ceaed33a90e6bfd3a5d57053dbb53f437d4809cc11430b5a09479c0ba601577059be9286df4a7eae6e350a60a2575dc9fa9d9872b5b8d058c875e075c33803 languageName: node linkType: hard -"map-stream@npm:~0.1.0": - version: 0.1.0 - resolution: "map-stream@npm:0.1.0" - checksum: 7dd6debe511c1b55d9da75e1efa65a28b1252a2d8357938d2e49b412713c478efbaefb0cdf0ee0533540c3bf733e8f9f71e1a15aa0fe74bf71b64e75bf1576bd +"micromark-util-symbol@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-symbol@npm:2.0.0" + checksum: 4e76186c185ce4cefb9cea8584213d9ffacd77099d1da30c0beb09fa21f46f66f6de4c84c781d7e34ff763fe3a06b530e132fa9004882afab9e825238d0aa8b3 languageName: node linkType: hard -"meow@npm:^6.0.0": - version: 6.1.1 - resolution: "meow@npm:6.1.1" - dependencies: - "@types/minimist": "npm:^1.2.0" - camelcase-keys: "npm:^6.2.2" - decamelize-keys: "npm:^1.1.0" - hard-rejection: "npm:^2.1.0" - minimist-options: "npm:^4.0.2" - normalize-package-data: "npm:^2.5.0" - read-pkg-up: "npm:^7.0.1" - redent: "npm:^3.0.0" - trim-newlines: "npm:^3.0.0" - type-fest: "npm:^0.13.1" - yargs-parser: "npm:^18.1.3" - checksum: ceece1e5e09a53d7bf298ef137477e395a0dd30c8ed1a9980a52caad02eccffd6bce1a5cad4596cd694e7e924e949253f0cc1e7c22073c07ce7b06cfefbcf8be +"micromark-util-types@npm:^1.0.0, micromark-util-types@npm:^1.0.1": + version: 1.1.0 + resolution: "micromark-util-types@npm:1.1.0" + checksum: a9749cb0a12a252ff536baabcb7012421b6fad4d91a5fdd80d7b33dc7b4c22e2d0c4637dfe5b902d00247fe6c9b01f4a24fce6b572b16ccaa4da90e6ce2a11e4 languageName: node linkType: hard -"merge-stream@npm:^2.0.0": +"micromark-util-types@npm:^2.0.0": version: 2.0.0 - resolution: "merge-stream@npm:2.0.0" - checksum: 867fdbb30a6d58b011449b8885601ec1690c3e41c759ecd5a9d609094f7aed0096c37823ff4a7190ef0b8f22cc86beb7049196ff68c016e3b3c671d0dac91ce5 + resolution: "micromark-util-types@npm:2.0.0" + checksum: d74e913b9b61268e0d6939f4209e3abe9dada640d1ee782419b04fd153711112cfaaa3c4d5f37225c9aee1e23c3bb91a1f5223e1e33ba92d33e83956a53e61de languageName: node linkType: hard -"merge2@npm:^1.3.0, merge2@npm:^1.4.1": - version: 1.4.1 - resolution: "merge2@npm:1.4.1" - checksum: 254a8a4605b58f450308fc474c82ac9a094848081bf4c06778200207820e5193726dc563a0d2c16468810516a5c97d9d3ea0ca6585d23c58ccfff2403e8dbbeb +"micromark@npm:^3.0.0": + version: 3.2.0 + resolution: "micromark@npm:3.2.0" + dependencies: + "@types/debug": "npm:^4.0.0" + debug: "npm:^4.0.0" + decode-named-character-reference: "npm:^1.0.0" + micromark-core-commonmark: "npm:^1.0.1" + micromark-factory-space: "npm:^1.0.0" + micromark-util-character: "npm:^1.0.0" + micromark-util-chunked: "npm:^1.0.0" + micromark-util-combine-extensions: "npm:^1.0.0" + micromark-util-decode-numeric-character-reference: "npm:^1.0.0" + micromark-util-encode: "npm:^1.0.0" + micromark-util-normalize-identifier: "npm:^1.0.0" + micromark-util-resolve-all: "npm:^1.0.0" + micromark-util-sanitize-uri: "npm:^1.0.0" + micromark-util-subtokenize: "npm:^1.0.0" + micromark-util-symbol: "npm:^1.0.0" + micromark-util-types: "npm:^1.0.1" + uvu: "npm:^0.5.0" + checksum: f243e805d1b3cc699fddae2de0b1492bc82462f1a709d7ae5c82039f88b1e009c959100184717e748be057b5f88603289d5681679a4e6fbabcd037beb34bc744 languageName: node linkType: hard @@ -3957,6 +6532,15 @@ __metadata: languageName: node linkType: hard +"mime@npm:^3.0.0": + version: 3.0.0 + resolution: "mime@npm:3.0.0" + bin: + mime: cli.js + checksum: 402e792a8df1b2cc41cb77f0dcc46472b7944b7ec29cb5bbcd398624b6b97096728f1239766d3fdeb20551dd8d94738344c195a6ea10c4f906eb0356323b0531 + languageName: node + linkType: hard + "mimic-fn@npm:^2.1.0": version: 2.1.0 resolution: "mimic-fn@npm:2.1.0" @@ -3964,6 +6548,20 @@ __metadata: languageName: node linkType: hard +"mimic-fn@npm:^4.0.0": + version: 4.0.0 + resolution: "mimic-fn@npm:4.0.0" + checksum: de9cc32be9996fd941e512248338e43407f63f6d497abe8441fa33447d922e927de54d4cc3c1a3c6d652857acd770389d5a3823f311a744132760ce2be15ccbf + languageName: node + linkType: hard + +"mimic-response@npm:^3.1.0": + version: 3.1.0 + resolution: "mimic-response@npm:3.1.0" + checksum: 0d6f07ce6e03e9e4445bee655202153bdb8a98d67ee8dc965ac140900d7a2688343e6b4c9a72cfc9ef2f7944dfd76eef4ab2482eb7b293a68b84916bac735362 + languageName: node + linkType: hard + "min-indent@npm:^1.0.0": version: 1.0.1 resolution: "min-indent@npm:1.0.1" @@ -3971,7 +6569,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^3.0.2, minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": +"minimatch@npm:^3.0.4, minimatch@npm:^3.1.1": version: 3.1.2 resolution: "minimatch@npm:3.1.2" dependencies: @@ -4000,7 +6598,7 @@ __metadata: languageName: node linkType: hard -"minimist@npm:^1.2.0, minimist@npm:^1.2.6": +"minimist@npm:^1.2.0, minimist@npm:^1.2.3": version: 1.2.8 resolution: "minimist@npm:1.2.8" checksum: 19d3fcdca050087b84c2029841a093691a91259a47def2f18222f41e7645a0b7c44ef4b40e88a1e58a40c84d2ef0ee6047c55594d298146d0eb3f6b737c20ce6 @@ -4098,6 +6696,13 @@ __metadata: languageName: node linkType: hard +"mkdirp-classic@npm:^0.5.2, mkdirp-classic@npm:^0.5.3": + version: 0.5.3 + resolution: "mkdirp-classic@npm:0.5.3" + checksum: 95371d831d196960ddc3833cc6907e6b8f67ac5501a6582f47dfae5eb0f092e9f8ce88e0d83afcae95d6e2b61a01741ba03714eeafb6f7a6e9dcc158ac85b168 + languageName: node + linkType: hard + "mkdirp@npm:^1.0.3": version: 1.0.4 resolution: "mkdirp@npm:1.0.4" @@ -4119,15 +6724,36 @@ __metadata: languageName: node linkType: hard -"mlly@npm:^1.4.0": - version: 1.4.0 - resolution: "mlly@npm:1.4.0" +"mlly@npm:^1.4.2": + version: 1.4.2 + resolution: "mlly@npm:1.4.2" dependencies: - acorn: "npm:^8.9.0" + acorn: "npm:^8.10.0" pathe: "npm:^1.1.1" pkg-types: "npm:^1.0.3" - ufo: "npm:^1.1.2" - checksum: 911060724d94acc9139b58758f29861314e77883269e320eec383bd5859f11273119116798e2d9a2bd0df6de4f8a52e051ac282ac586167942d11ce15d0f30b9 + ufo: "npm:^1.3.0" + checksum: 905e3a704c7d3bcaad55f31d6efe9f680eab5be053ab7f8b299b8dbc027041f741fa6a93db9a3c461be2552632f3831b6c43c50af530f5fb2e9cd6273bc9d642 + languageName: node + linkType: hard + +"mri@npm:^1.1.0": + version: 1.2.0 + resolution: "mri@npm:1.2.0" + checksum: a3d32379c2554cf7351db6237ddc18dc9e54e4214953f3da105b97dc3babe0deb3ffe99cf409b38ea47cc29f9430561ba6b53b24ab8f9ce97a4b50409e4a50e7 + languageName: node + linkType: hard + +"mrmime@npm:^1.0.0": + version: 1.0.1 + resolution: "mrmime@npm:1.0.1" + checksum: ab071441da76fd23b3b0d1823d77aacf8679d379a4a94cacd83e487d3d906763b277f3203a594c613602e31ab5209c26a8119b0477c4541ef8555b293a9db6d3 + languageName: node + linkType: hard + +"ms@npm:2.0.0": + version: 2.0.0 + resolution: "ms@npm:2.0.0" + checksum: f8fda810b39fd7255bbdc451c46286e549794fcc700dc9cd1d25658bbc4dc2563a5de6fe7c60f798a16a60c6ceb53f033cb353f493f0cf63e5199b702943159d languageName: node linkType: hard @@ -4145,6 +6771,13 @@ __metadata: languageName: node linkType: hard +"muggle-string@npm:^0.3.1": + version: 0.3.1 + resolution: "muggle-string@npm:0.3.1" + checksum: 489b0575fa76e30914393915a36638590052409fca2206a6bef0fb0ad7b181c1cbf99761191bfd16fe402c6f5a3164897965422fa32ef20ada1b44024ba46ab6 + languageName: node + linkType: hard + "mz@npm:^2.7.0": version: 2.7.0 resolution: "mz@npm:2.7.0" @@ -4165,10 +6798,32 @@ __metadata: languageName: node linkType: hard -"natural-compare@npm:^1.4.0": - version: 1.4.0 - resolution: "natural-compare@npm:1.4.0" - checksum: f5f9a7974bfb28a91afafa254b197f0f22c684d4a1731763dda960d2c8e375b36c7d690e0d9dc8fba774c537af14a7e979129bca23d88d052fbeb9466955e447 +"nanoid@npm:^3.3.7": + version: 3.3.7 + resolution: "nanoid@npm:3.3.7" + bin: + nanoid: bin/nanoid.cjs + checksum: e3fb661aa083454f40500473bb69eedb85dc160e763150b9a2c567c7e9ff560ce028a9f833123b618a6ea742e311138b591910e795614a629029e86e180660f3 + languageName: node + linkType: hard + +"napi-build-utils@npm:^1.0.1": + version: 1.0.2 + resolution: "napi-build-utils@npm:1.0.2" + checksum: 37fd2cd0ff2ad20073ce78d83fd718a740d568b225924e753ae51cb69d68f330c80544d487e5e5bd18e28702ed2ca469c2424ad948becd1862c1b0209542b2e9 + languageName: node + linkType: hard + +"needle@npm:^2.5.2": + version: 2.9.1 + resolution: "needle@npm:2.9.1" + dependencies: + debug: "npm:^3.2.6" + iconv-lite: "npm:^0.4.4" + sax: "npm:^1.2.4" + bin: + needle: ./bin/needle + checksum: 65a7eaeaf4ca3410de492957474592af9838e02875273d9232ff6cff331393c58a95e48c592bd9a05f575e5bb9b08543d6cfd19eb96595dbd3d7da2c5fe1accb languageName: node linkType: hard @@ -4179,6 +6834,33 @@ __metadata: languageName: node linkType: hard +"nlcst-to-string@npm:^3.0.0": + version: 3.1.1 + resolution: "nlcst-to-string@npm:3.1.1" + dependencies: + "@types/nlcst": "npm:^1.0.0" + checksum: 949f4dd3843ddc3e0ea34581ce72157ba2ad7f08c3a845249423c99c6884282f9d89cf2d0abed732e41a6aaf7210d676f31dc02e9f51f173f0fe2f3edc9936ce + languageName: node + linkType: hard + +"node-abi@npm:^3.3.0": + version: 3.51.0 + resolution: "node-abi@npm:3.51.0" + dependencies: + semver: "npm:^7.3.5" + checksum: 2f0a56a9923bd21ff13650b6e8d2caebda211795761b40ae0ec3ea08e6687f6722535302cde87c928d6959a6afec196db3c54f8ae2db0bbaa401459dcf0f073c + languageName: node + linkType: hard + +"node-addon-api@npm:^6.1.0": + version: 6.1.0 + resolution: "node-addon-api@npm:6.1.0" + dependencies: + node-gyp: "npm:latest" + checksum: d2699c4ad15740fd31482a3b6fca789af7723ab9d393adc6ac45250faaee72edad8f0b10b2b9d087df0de93f1bdc16d97afdd179b26b9ebc9ed68b569faa4bac + languageName: node + linkType: hard + "node-fetch@npm:^2.5.0": version: 2.6.12 resolution: "node-fetch@npm:2.6.12" @@ -4214,6 +6896,13 @@ __metadata: languageName: node linkType: hard +"node-releases@npm:^2.0.14": + version: 2.0.14 + resolution: "node-releases@npm:2.0.14" + checksum: 199fc93773ae70ec9969bc6d5ac5b2bbd6eb986ed1907d751f411fef3ede0e4bfdb45ceb43711f8078bea237b6036db8b1bf208f6ff2b70c7d615afd157f3ab9 + languageName: node + linkType: hard + "nopt@npm:^6.0.0": version: 6.0.0 resolution: "nopt@npm:6.0.0" @@ -4225,7 +6914,7 @@ __metadata: languageName: node linkType: hard -"normalize-package-data@npm:^2.3.2, normalize-package-data@npm:^2.5.0": +"normalize-package-data@npm:^2.5.0": version: 2.5.0 resolution: "normalize-package-data@npm:2.5.0" dependencies: @@ -4244,6 +6933,13 @@ __metadata: languageName: node linkType: hard +"not@npm:^0.1.0": + version: 0.1.0 + resolution: "not@npm:0.1.0" + checksum: b75d7b2e41d73e2e1cb3327826d53667b41bc6ff7d7ff1d8014ad3bf410d4ecd46f512683b22a4c043e03cbb2b0a483aa69232d4bf9c0e2ee1a9127fe02f047a + languageName: node + linkType: hard + "npm-run-path@npm:^4.0.1": version: 4.0.1 resolution: "npm-run-path@npm:4.0.1" @@ -4253,6 +6949,15 @@ __metadata: languageName: node linkType: hard +"npm-run-path@npm:^5.1.0": + version: 5.1.0 + resolution: "npm-run-path@npm:5.1.0" + dependencies: + path-key: "npm:^4.0.0" + checksum: ff6d77514489f47fa1c3b1311d09cd4b6d09a874cc1866260f9dea12cbaabda0436ed7f8c2ee44d147bf99a3af29307c6f63b0f83d242b0b6b0ab25dff2629e3 + languageName: node + linkType: hard + "npmlog@npm:^6.0.0": version: 6.0.2 resolution: "npmlog@npm:6.0.2" @@ -4265,6 +6970,15 @@ __metadata: languageName: node linkType: hard +"nth-check@npm:^2.0.0": + version: 2.1.1 + resolution: "nth-check@npm:2.1.1" + dependencies: + boolbase: "npm:^1.0.0" + checksum: 5fee7ff309727763689cfad844d979aedd2204a817fbaaf0e1603794a7c20db28548d7b024692f953557df6ce4a0ee4ae46cd8ebd9b36cfb300b9226b567c479 + languageName: node + linkType: hard + "object-assign@npm:^4.0.1": version: 4.1.1 resolution: "object-assign@npm:4.1.1" @@ -4279,13 +6993,6 @@ __metadata: languageName: node linkType: hard -"object-inspect@npm:^1.13.1": - version: 1.13.1 - resolution: "object-inspect@npm:1.13.1" - checksum: fad603f408e345c82e946abdf4bfd774260a5ed3e5997a0b057c44153ac32c7271ff19e3a5ae39c858da683ba045ccac2f65245c12763ce4e8594f818f4a648d - languageName: node - linkType: hard - "object-keys@npm:^1.1.1": version: 1.1.1 resolution: "object-keys@npm:1.1.1" @@ -4305,41 +7012,7 @@ __metadata: languageName: node linkType: hard -"object.fromentries@npm:^2.0.7": - version: 2.0.7 - resolution: "object.fromentries@npm:2.0.7" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - checksum: 071745c21f6fc9e6c914691f2532c1fb60ad967e5ddc52801d09958b5de926566299d07ae14466452a7efd29015f9145d6c09c573d93a0dc6f1683ee0ec2b93b - languageName: node - linkType: hard - -"object.groupby@npm:^1.0.1": - version: 1.0.1 - resolution: "object.groupby@npm:1.0.1" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - get-intrinsic: "npm:^1.2.1" - checksum: 61e41fbf08cc04ed860363db9629eedeaa590fce243c0960e948fd7b11f78a9d4350065c339936d118a2dd8775d7259e26207340cc8ce688bec66cb615fec6fe - languageName: node - linkType: hard - -"object.values@npm:^1.1.7": - version: 1.1.7 - resolution: "object.values@npm:1.1.7" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - checksum: e869d6a37fb7afdd0054dea49036d6ccebb84854a8848a093bbd1bc516f53e690bba88f0bc3e83fdfa74c601469ee6989c9b13359cda9604144c6e732fad3b6b - languageName: node - linkType: hard - -"once@npm:^1.3.0": +"once@npm:^1.3.0, once@npm:^1.3.1, once@npm:^1.4.0": version: 1.4.0 resolution: "once@npm:1.4.0" dependencies: @@ -4348,7 +7021,7 @@ __metadata: languageName: node linkType: hard -"onetime@npm:^5.1.2": +"onetime@npm:^5.1.0, onetime@npm:^5.1.2": version: 5.1.2 resolution: "onetime@npm:5.1.2" dependencies: @@ -4357,17 +7030,29 @@ __metadata: languageName: node linkType: hard -"optionator@npm:^0.9.3": - version: 0.9.3 - resolution: "optionator@npm:0.9.3" +"onetime@npm:^6.0.0": + version: 6.0.0 + resolution: "onetime@npm:6.0.0" + dependencies: + mimic-fn: "npm:^4.0.0" + checksum: 4eef7c6abfef697dd4479345a4100c382d73c149d2d56170a54a07418c50816937ad09500e1ed1e79d235989d073a9bade8557122aee24f0576ecde0f392bb6c + languageName: node + linkType: hard + +"ora@npm:^7.0.1": + version: 7.0.1 + resolution: "ora@npm:7.0.1" dependencies: - "@aashutoshrathi/word-wrap": "npm:^1.2.3" - deep-is: "npm:^0.1.3" - fast-levenshtein: "npm:^2.0.6" - levn: "npm:^0.4.1" - prelude-ls: "npm:^1.2.1" - type-check: "npm:^0.4.0" - checksum: 66fba794d425b5be51353035cf3167ce6cfa049059cbb93229b819167687e0f48d2bc4603fcb21b091c99acb516aae1083624675b15c4765b2e4693a085e959c + chalk: "npm:^5.3.0" + cli-cursor: "npm:^4.0.0" + cli-spinners: "npm:^2.9.0" + is-interactive: "npm:^2.0.0" + is-unicode-supported: "npm:^1.3.0" + log-symbols: "npm:^5.1.0" + stdin-discarder: "npm:^0.1.0" + string-width: "npm:^6.1.0" + strip-ansi: "npm:^7.1.0" + checksum: 9412cd96436b94738f9d11a00dba3654d3cb6d91dfbcca71554fbcb76dc897145fa4ba0d2009e492256a21228ab565512e5e93a36a205ccd38f9e99a417358cb languageName: node linkType: hard @@ -4421,6 +7106,15 @@ __metadata: languageName: node linkType: hard +"p-limit@npm:^5.0.0": + version: 5.0.0 + resolution: "p-limit@npm:5.0.0" + dependencies: + yocto-queue: "npm:^1.0.0" + checksum: 574e93b8895a26e8485eb1df7c4b58a1a6e8d8ae41b1750cc2cc440922b3d306044fc6e9a7f74578a883d46802d9db72b30f2e612690fcef838c173261b1ed83 + languageName: node + linkType: hard + "p-locate@npm:^4.1.0": version: 4.1.0 resolution: "p-locate@npm:4.1.0" @@ -4455,6 +7149,23 @@ __metadata: languageName: node linkType: hard +"p-queue@npm:^7.4.1": + version: 7.4.1 + resolution: "p-queue@npm:7.4.1" + dependencies: + eventemitter3: "npm:^5.0.1" + p-timeout: "npm:^5.0.2" + checksum: 6dbd22780133bbf9cddd2be344609e23cb813f5c6f1693336a52da26631cf931702d5cfd01818b562079502f796b382fab0c1645124c81e2f509b739a35d1562 + languageName: node + linkType: hard + +"p-timeout@npm:^5.0.2": + version: 5.1.0 + resolution: "p-timeout@npm:5.1.0" + checksum: 1b026cf9d5878c64bec4341ca9cda8ec6b8b3aea8a57885ca0fe2b35753a20d767fb6f9d3aa41e1252f42bc95432c05ea33b6b18f271fb10bfb0789591850a41 + languageName: node + linkType: hard + "p-try@npm:^2.0.0": version: 2.2.0 resolution: "p-try@npm:2.2.0" @@ -4462,21 +7173,45 @@ __metadata: languageName: node linkType: hard -"parent-module@npm:^1.0.0": - version: 1.0.1 - resolution: "parent-module@npm:1.0.1" +"pagefind@npm:^1.0.3": + version: 1.0.4 + resolution: "pagefind@npm:1.0.4" dependencies: - callsites: "npm:^3.0.0" - checksum: c63d6e80000d4babd11978e0d3fee386ca7752a02b035fd2435960ffaa7219dc42146f07069fb65e6e8bf1caef89daf9af7535a39bddf354d78bf50d8294f556 + "@pagefind/darwin-arm64": "npm:1.0.4" + "@pagefind/darwin-x64": "npm:1.0.4" + "@pagefind/linux-arm64": "npm:1.0.4" + "@pagefind/linux-x64": "npm:1.0.4" + "@pagefind/windows-x64": "npm:1.0.4" + dependenciesMeta: + "@pagefind/darwin-arm64": + optional: true + "@pagefind/darwin-x64": + optional: true + "@pagefind/linux-arm64": + optional: true + "@pagefind/linux-x64": + optional: true + "@pagefind/windows-x64": + optional: true + bin: + pagefind: lib/runner/bin.cjs + checksum: aff7170792298230d895757ab553ba55f04637ccfd536ad5b573cab861cc764ed74383ea6c846a6917cd816bf2ade7b72aa5330778acc0bac191522b777fef6c languageName: node linkType: hard -"parse-json@npm:^2.2.0": - version: 2.2.0 - resolution: "parse-json@npm:2.2.0" +"parse-entities@npm:^4.0.0": + version: 4.0.1 + resolution: "parse-entities@npm:4.0.1" dependencies: - error-ex: "npm:^1.2.0" - checksum: 7a90132aa76016f518a3d5d746a21b3f1ad0f97a68436ed71b6f995b67c7151141f5464eea0c16c59aec9b7756519a0e3007a8f98cf3714632d509ec07736df6 + "@types/unist": "npm:^2.0.0" + character-entities: "npm:^2.0.0" + character-entities-legacy: "npm:^3.0.0" + character-reference-invalid: "npm:^2.0.0" + decode-named-character-reference: "npm:^1.0.0" + is-alphanumerical: "npm:^2.0.0" + is-decimal: "npm:^2.0.0" + is-hexadecimal: "npm:^2.0.0" + checksum: 9dfa3b0dc43a913c2558c4bd625b1abcc2d6c6b38aa5724b141ed988471977248f7ad234eed57e1bc70b694dd15b0d710a04f66c2f7c096e35abd91962b7d926 languageName: node linkType: hard @@ -4492,12 +7227,37 @@ __metadata: languageName: node linkType: hard -"path-exists@npm:^2.0.0": - version: 2.1.0 - resolution: "path-exists@npm:2.1.0" +"parse-latin@npm:^5.0.0": + version: 5.0.1 + resolution: "parse-latin@npm:5.0.1" + dependencies: + nlcst-to-string: "npm:^3.0.0" + unist-util-modify-children: "npm:^3.0.0" + unist-util-visit-children: "npm:^2.0.0" + checksum: 7da3059ffd71217233c0a65be75696b16297aa7eda4a5dd5a2c96d32738002afd81ce084821ab8f8e3e2724b719d2124ae0fff8383000989b2fda08dec8454fe + languageName: node + linkType: hard + +"parse5@npm:^6.0.0": + version: 6.0.1 + resolution: "parse5@npm:6.0.1" + checksum: 595821edc094ecbcfb9ddcb46a3e1fe3a718540f8320eff08b8cf6742a5114cce2d46d45f95c26191c11b184dcaf4e2960abcd9c5ed9eb9393ac9a37efcfdecb + languageName: node + linkType: hard + +"parse5@npm:^7.0.0": + version: 7.1.2 + resolution: "parse5@npm:7.1.2" dependencies: - pinkie-promise: "npm:^2.0.0" - checksum: 87352f1601c085d5a6eb202f60e5c016c1b790bd0bc09398af446ed3f5c4510b4531ff99cf8acac2d91868886e792927b4292f768b35a83dce12588fb7cbb46e + entities: "npm:^4.4.0" + checksum: 297d7af8224f4b5cb7f6617ecdae98eeaed7f8cbd78956c42785e230505d5a4f07cef352af10d3006fa5c1544b76b57784d3a22d861ae071bbc460c649482bf4 + languageName: node + linkType: hard + +"path-browserify@npm:^1.0.1": + version: 1.0.1 + resolution: "path-browserify@npm:1.0.1" + checksum: 8b8c3fd5c66bd340272180590ae4ff139769e9ab79522e2eb82e3d571a89b8117c04147f65ad066dccfb42fcad902e5b7d794b3d35e0fd840491a8ddbedf8c66 languageName: node linkType: hard @@ -4522,6 +7282,13 @@ __metadata: languageName: node linkType: hard +"path-key@npm:^4.0.0": + version: 4.0.0 + resolution: "path-key@npm:4.0.0" + checksum: 794efeef32863a65ac312f3c0b0a99f921f3e827ff63afa5cb09a377e202c262b671f7b3832a4e64731003fa94af0263713962d317b9887bd1e0c48a342efba3 + languageName: node + linkType: hard + "path-parse@npm:^1.0.7": version: 1.0.7 resolution: "path-parse@npm:1.0.7" @@ -4539,14 +7306,10 @@ __metadata: languageName: node linkType: hard -"path-type@npm:^1.0.0": - version: 1.1.0 - resolution: "path-type@npm:1.1.0" - dependencies: - graceful-fs: "npm:^4.1.2" - pify: "npm:^2.0.0" - pinkie-promise: "npm:^2.0.0" - checksum: 2b8c348cb52bbc0c0568afa10a0a5d8f6233adfe5ae75feb56064f6aed6324ab74185c61c2545f4e52ca08acdc76005f615da4e127ed6eecb866002cf491f350 +"path-to-regexp@npm:^6.2.1": + version: 6.2.1 + resolution: "path-to-regexp@npm:6.2.1" + checksum: 7a73811ca703e5c199e5b50b9649ab8f6f7b458a37f7dff9ea338815203f5b1f95fe8cb24d4fdfe2eab5d67ce43562d92534330babca35cdf3231f966adb9360 languageName: node linkType: hard @@ -4578,12 +7341,14 @@ __metadata: languageName: node linkType: hard -"pause-stream@npm:0.0.11": - version: 0.0.11 - resolution: "pause-stream@npm:0.0.11" +"periscopic@npm:^3.0.0": + version: 3.1.0 + resolution: "periscopic@npm:3.1.0" dependencies: - through: "npm:~2.3" - checksum: 86f12c64cdaaa8e45ebaca4e39a478e1442db8b4beabc280b545bfaf79c0e2f33c51efb554aace5c069cc441c7b924ba484837b345eaa4ba6fc940d62f826802 + "@types/estree": "npm:^1.0.0" + estree-walker: "npm:^3.0.0" + is-reference: "npm:^3.0.0" + checksum: fb5ce7cd810c49254cdf1cd3892811e6dd1a1dfbdf5f10a0a33fb7141baac36443c4cad4f0e2b30abd4eac613f6ab845c2bc1b7ce66ae9694c7321e6ada5bd96 languageName: node linkType: hard @@ -4597,37 +7362,14 @@ __metadata: "picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" - checksum: 26c02b8d06f03206fc2ab8d16f19960f2ff9e81a658f831ecb656d8f17d9edc799e8364b1f4a7873e89d9702dff96204be0fa26fe4181f6843f040f819dac4be - languageName: node - linkType: hard - -"pify@npm:^2.0.0": - version: 2.3.0 - resolution: "pify@npm:2.3.0" - checksum: 551ff8ab830b1052633f59cb8adc9ae8407a436e06b4a9718bcb27dc5844b83d535c3a8512b388b6062af65a98c49bdc0dd523d8b2617b188f7c8fee457158dc - languageName: node - linkType: hard - -"pify@npm:^4.0.1": - version: 4.0.1 - resolution: "pify@npm:4.0.1" - checksum: 6f9d404b0d47a965437403c9b90eca8bb2536407f03de165940e62e72c8c8b75adda5516c6b9b23675a5877cc0bcac6bdfb0ef0e39414cd2476d5495da40e7cf - languageName: node - linkType: hard - -"pinkie-promise@npm:^2.0.0, pinkie-promise@npm:^2.0.1": - version: 2.0.1 - resolution: "pinkie-promise@npm:2.0.1" - dependencies: - pinkie: "npm:^2.0.0" - checksum: 11b5e5ce2b090c573f8fad7b517cbca1bb9a247587306f05ae71aef6f9b2cd2b923c304aa9663c2409cfde27b367286179f1379bc4ec18a3fbf2bb0d473b160a + checksum: 26c02b8d06f03206fc2ab8d16f19960f2ff9e81a658f831ecb656d8f17d9edc799e8364b1f4a7873e89d9702dff96204be0fa26fe4181f6843f040f819dac4be languageName: node linkType: hard -"pinkie@npm:^2.0.0": - version: 2.0.4 - resolution: "pinkie@npm:2.0.4" - checksum: 25228b08b5597da42dc384221aa0ce56ee0fbf32965db12ba838e2a9ca0193c2f0609c45551ee077ccd2060bf109137fdb185b00c6d7e0ed7e35006d20fdcbc6 +"pify@npm:^4.0.1": + version: 4.0.1 + resolution: "pify@npm:4.0.1" + checksum: 6f9d404b0d47a965437403c9b90eca8bb2536407f03de165940e62e72c8c8b75adda5516c6b9b23675a5877cc0bcac6bdfb0ef0e39414cd2476d5495da40e7cf languageName: node linkType: hard @@ -4687,6 +7429,38 @@ __metadata: languageName: node linkType: hard +"postcss-nested@npm:^6.0.1": + version: 6.0.1 + resolution: "postcss-nested@npm:6.0.1" + dependencies: + postcss-selector-parser: "npm:^6.0.11" + peerDependencies: + postcss: ^8.2.14 + checksum: 2a50aa36d5d103c2e471954830489f4c024deed94fa066169101db55171368d5f80b32446b584029e0471feee409293d0b6b1d8ede361f6675ba097e477b3cbd + languageName: node + linkType: hard + +"postcss-selector-parser@npm:^6.0.11": + version: 6.0.13 + resolution: "postcss-selector-parser@npm:6.0.13" + dependencies: + cssesc: "npm:^3.0.0" + util-deprecate: "npm:^1.0.2" + checksum: 51f099b27f7c7198ea1826470ef0adfa58b3bd3f59b390fda123baa0134880a5fa9720137b6009c4c1373357b144f700b0edac73335d0067422063129371444e + languageName: node + linkType: hard + +"postcss@npm:^8.4.21, postcss@npm:^8.4.32": + version: 8.4.32 + resolution: "postcss@npm:8.4.32" + dependencies: + nanoid: "npm:^3.3.7" + picocolors: "npm:^1.0.0" + source-map-js: "npm:^1.0.2" + checksum: 39308a9195fa34d4dbdd7b58a896cff0c7809f84f7a4ac1b95b68ca86c9138a395addff33075668ed3983d41b90aac05754c445237a9365eb1c3a5602ebd03ad + languageName: node + linkType: hard + "postcss@npm:^8.4.27": version: 8.4.31 resolution: "postcss@npm:8.4.31" @@ -4698,6 +7472,28 @@ __metadata: languageName: node linkType: hard +"prebuild-install@npm:^7.1.1": + version: 7.1.1 + resolution: "prebuild-install@npm:7.1.1" + dependencies: + detect-libc: "npm:^2.0.0" + expand-template: "npm:^2.0.3" + github-from-package: "npm:0.0.0" + minimist: "npm:^1.2.3" + mkdirp-classic: "npm:^0.5.3" + napi-build-utils: "npm:^1.0.1" + node-abi: "npm:^3.3.0" + pump: "npm:^3.0.0" + rc: "npm:^1.2.7" + simple-get: "npm:^4.0.0" + tar-fs: "npm:^2.0.0" + tunnel-agent: "npm:^0.6.0" + bin: + prebuild-install: bin.js + checksum: 6dc70f36b0f4adcb2fe0ed38d874ab28b571fb1a9725d769e8ba3f64a15831e58462de09f3e6e64569bcc4a3e03b9328b56faa0d45fe10ae1574478814536c76 + languageName: node + linkType: hard + "preferred-pm@npm:^3.0.0": version: 3.0.3 resolution: "preferred-pm@npm:3.0.3" @@ -4710,10 +7506,15 @@ __metadata: languageName: node linkType: hard -"prelude-ls@npm:^1.2.1": - version: 1.2.1 - resolution: "prelude-ls@npm:1.2.1" - checksum: b00d617431e7886c520a6f498a2e14c75ec58f6d93ba48c3b639cf241b54232d90daa05d83a9e9b9fef6baa63cb7e1e4602c2372fea5bc169668401eb127d0cd +"preferred-pm@npm:^3.1.2": + version: 3.1.2 + resolution: "preferred-pm@npm:3.1.2" + dependencies: + find-up: "npm:^5.0.0" + find-yarn-workspace-root2: "npm:1.2.16" + path-exists: "npm:^4.0.0" + which-pm: "npm:2.0.0" + checksum: 0c1a876461d41ddd8c5ecdcb4be2b8c93b408857c8b7ff7a14312920301b7458061d620b476da90e16b27a2d7d19688a51bdeddf200557ad1d925658f05796f8 languageName: node linkType: hard @@ -4726,23 +7527,32 @@ __metadata: languageName: node linkType: hard -"prettier@npm:^3.1.0": - version: 3.1.0 - resolution: "prettier@npm:3.1.0" - bin: - prettier: bin/prettier.cjs - checksum: a45ea70aa97fde162ea4c4aba3dfc7859aa6a732a1db34458d9535dc3c2c16d3bc3fb5689e6cd76aa835562555303b02d9449fd2e15af3b73c8053557e25c5b6 +"pretty-format@npm:^29.7.0": + version: 29.7.0 + resolution: "pretty-format@npm:29.7.0" + dependencies: + "@jest/schemas": "npm:^29.6.3" + ansi-styles: "npm:^5.0.0" + react-is: "npm:^18.0.0" + checksum: edc5ff89f51916f036c62ed433506b55446ff739358de77207e63e88a28ca2894caac6e73dcb68166a606e51c8087d32d400473e6a9fdd2dbe743f46c9c0276f + languageName: node + linkType: hard + +"prismjs@npm:^1.29.0": + version: 1.29.0 + resolution: "prismjs@npm:1.29.0" + checksum: d906c4c4d01b446db549b4f57f72d5d7e6ccaca04ecc670fb85cea4d4b1acc1283e945a9cbc3d81819084a699b382f970e02f9d1378e14af9808d366d9ed7ec6 languageName: node linkType: hard -"pretty-format@npm:^29.5.0": - version: 29.6.1 - resolution: "pretty-format@npm:29.6.1" +"probe-image-size@npm:^7.2.3": + version: 7.2.3 + resolution: "probe-image-size@npm:7.2.3" dependencies: - "@jest/schemas": "npm:^29.6.0" - ansi-styles: "npm:^5.0.0" - react-is: "npm:^18.0.0" - checksum: decb4ca86b34e53a08e525d2b50be19ef4bffa4bb4122787740b012c11490311879de53dee8b669a82376b6fec06040ec546831f2c3ce0df963c00d743cce664 + lodash.merge: "npm:^4.6.2" + needle: "npm:^2.5.2" + stream-parser: "npm:~0.3.1" + checksum: bebe3b050889794565b66ea9749cb21fee4f3e99fea41a328e39f2929f2432ebb50ac974148c35c66dec5becc849b3185a7a6f39d3ff75247e8be0a2759c9627 languageName: node linkType: hard @@ -4756,14 +7566,20 @@ __metadata: languageName: node linkType: hard -"ps-tree@npm:^1.0.1": - version: 1.2.0 - resolution: "ps-tree@npm:1.2.0" +"prompts@npm:^2.4.2": + version: 2.4.2 + resolution: "prompts@npm:2.4.2" dependencies: - event-stream: "npm:=3.3.4" - bin: - ps-tree: ./bin/ps-tree.js - checksum: 9d1c159e0890db5aa05f84d125193c2190a6c4ecd457596fd25e7611f8f747292a846459dcc0244e27d45529d4cea6d1010c3a2a087fad02624d12fdb7d97c22 + kleur: "npm:^3.0.3" + sisteransi: "npm:^1.0.5" + checksum: 16f1ac2977b19fe2cf53f8411cc98db7a3c8b115c479b2ca5c82b5527cd937aa405fa04f9a5960abeb9daef53191b53b4d13e35c1f5d50e8718c76917c5f1ea4 + languageName: node + linkType: hard + +"property-information@npm:^6.0.0": + version: 6.4.0 + resolution: "property-information@npm:6.4.0" + checksum: 48ba202f12c6abc82d37135452377dd528fae90a151bcffb28582d58d9db6e42ce835c91e2fcb12e875200b32bcaed90de4807dfb37c687f7cccf2597ccb55e1 languageName: node linkType: hard @@ -4774,6 +7590,16 @@ __metadata: languageName: node linkType: hard +"pump@npm:^3.0.0": + version: 3.0.0 + resolution: "pump@npm:3.0.0" + dependencies: + end-of-stream: "npm:^1.1.0" + once: "npm:^1.3.1" + checksum: bbdeda4f747cdf47db97428f3a135728669e56a0ae5f354a9ac5b74556556f5446a46f720a8f14ca2ece5be9b4d5d23c346db02b555f46739934cc6c093a5478 + languageName: node + linkType: hard + "punycode@npm:^2.1.0": version: 2.3.0 resolution: "punycode@npm:2.3.0" @@ -4788,6 +7614,13 @@ __metadata: languageName: node linkType: hard +"queue-tick@npm:^1.0.1": + version: 1.0.1 + resolution: "queue-tick@npm:1.0.1" + checksum: 0db998e2c9b15215317dbcf801e9b23e6bcde4044e115155dae34f8e7454b9a783f737c9a725528d677b7a66c775eb7a955cf144fe0b87f62b575ce5bfd515a9 + languageName: node + linkType: hard + "quick-lru@npm:^4.0.1": version: 4.0.1 resolution: "quick-lru@npm:4.0.1" @@ -4795,6 +7628,20 @@ __metadata: languageName: node linkType: hard +"rc@npm:^1.2.7": + version: 1.2.8 + resolution: "rc@npm:1.2.8" + dependencies: + deep-extend: "npm:^0.6.0" + ini: "npm:~1.3.0" + minimist: "npm:^1.2.0" + strip-json-comments: "npm:~2.0.1" + bin: + rc: ./cli.js + checksum: 24a07653150f0d9ac7168e52943cc3cb4b7a22c0e43c7dff3219977c2fdca5a2760a304a029c20811a0e79d351f57d46c9bde216193a0f73978496afc2b85b15 + languageName: node + linkType: hard + "react-is@npm:^18.0.0": version: 18.2.0 resolution: "react-is@npm:18.2.0" @@ -4802,16 +7649,6 @@ __metadata: languageName: node linkType: hard -"read-pkg-up@npm:^1.0.1": - version: 1.0.1 - resolution: "read-pkg-up@npm:1.0.1" - dependencies: - find-up: "npm:^1.0.0" - read-pkg: "npm:^1.0.0" - checksum: 36c4fc8bd73edf77a4eeb497b6e43010819ea4aef64cbf8e393439fac303398751c5a299feab84e179a74507e3a1416e1ed033a888b1dac3463bf46d1765f7ac - languageName: node - linkType: hard - "read-pkg-up@npm:^7.0.1": version: 7.0.1 resolution: "read-pkg-up@npm:7.0.1" @@ -4823,17 +7660,6 @@ __metadata: languageName: node linkType: hard -"read-pkg@npm:^1.0.0, read-pkg@npm:^1.1.0": - version: 1.1.0 - resolution: "read-pkg@npm:1.1.0" - dependencies: - load-json-file: "npm:^1.0.0" - normalize-package-data: "npm:^2.3.2" - path-type: "npm:^1.0.0" - checksum: 51fce9f7066787dc7688ea7014324cedeb9f38daa7dace4f1147d526f22354a07189ef728710bc97e27fcf5ed3a03b68ad8b60afb4251984640b6f09c180d572 - languageName: node - linkType: hard - "read-pkg@npm:^5.2.0": version: 5.2.0 resolution: "read-pkg@npm:5.2.0" @@ -4858,7 +7684,7 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^3.6.0": +"readable-stream@npm:^3.1.1, readable-stream@npm:^3.4.0, readable-stream@npm:^3.6.0": version: 3.6.2 resolution: "readable-stream@npm:3.6.2" dependencies: @@ -4906,14 +7732,135 @@ __metadata: languageName: node linkType: hard -"regexp.prototype.flags@npm:^1.5.1": - version: 1.5.1 - resolution: "regexp.prototype.flags@npm:1.5.1" +"rehype-parse@npm:^8.0.0": + version: 8.0.5 + resolution: "rehype-parse@npm:8.0.5" dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - set-function-name: "npm:^2.0.0" - checksum: 1de7d214c0a726c7c874a7023e47b0e27b9f7fdb64175bfe1861189de1704aaeca05c3d26c35aa375432289b99946f3cf86651a92a8f7601b90d8c226a23bcd8 + "@types/hast": "npm:^2.0.0" + hast-util-from-parse5: "npm:^7.0.0" + parse5: "npm:^6.0.0" + unified: "npm:^10.0.0" + checksum: 6ab741830d74d381ae46849a61edb9539b16667ed03c4cf74d4aa6003947e14d35398f745649dd2b83cc1c6de8db1f9dbd46cbb76048c22bbb3d1200967ac1e3 + languageName: node + linkType: hard + +"rehype-raw@npm:^6.1.1": + version: 6.1.1 + resolution: "rehype-raw@npm:6.1.1" + dependencies: + "@types/hast": "npm:^2.0.0" + hast-util-raw: "npm:^7.2.0" + unified: "npm:^10.0.0" + checksum: c68b460d313cad877e731d83770913417e4759b3d7a824ffc0e60a7a62cdd7e24c461ead9b081760005382dd4510330e3bb961370e58dfeed09732675037a1a9 + languageName: node + linkType: hard + +"rehype-stringify@npm:^9.0.0, rehype-stringify@npm:^9.0.4": + version: 9.0.4 + resolution: "rehype-stringify@npm:9.0.4" + dependencies: + "@types/hast": "npm:^2.0.0" + hast-util-to-html: "npm:^8.0.0" + unified: "npm:^10.0.0" + checksum: 8c8bc118c3e3242a6126456c35af5f902a168ec8daab7b97f6bfeafa5ced2c23fbe2807776908ecec8ed17a9ef67c6f6d473ff54c28c1d6a711624505a551078 + languageName: node + linkType: hard + +"rehype@npm:^12.0.1": + version: 12.0.1 + resolution: "rehype@npm:12.0.1" + dependencies: + "@types/hast": "npm:^2.0.0" + rehype-parse: "npm:^8.0.0" + rehype-stringify: "npm:^9.0.0" + unified: "npm:^10.0.0" + checksum: 9a0a2cccc80f302c2ed1c4fd2d8a23779696fc7ebab8149c23c6f551a26371bfb4a80736c1a98bc1e04115e6cb9e1ef0badb11f41fb9f624bdb07f5226272ed9 + languageName: node + linkType: hard + +"remark-directive@npm:^2.0.1": + version: 2.0.1 + resolution: "remark-directive@npm:2.0.1" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-directive: "npm:^2.0.0" + micromark-extension-directive: "npm:^2.0.0" + unified: "npm:^10.0.0" + checksum: b968a753d9c9472f3da9c47ce61d5e77b2ddc2805e887255bb5be502d3471ff88a33730763ca586813cd9c1c54e31d7e971458340c7bb2503a3eda95f45df563 + languageName: node + linkType: hard + +"remark-expressive-code@npm:^0.29.2": + version: 0.29.2 + resolution: "remark-expressive-code@npm:0.29.2" + dependencies: + expressive-code: "npm:^0.29.2" + hast-util-to-html: "npm:^8.0.4" + unist-util-visit: "npm:^4.1.2" + checksum: 791d1049765401203430cb028c9ee45ae2d2ac1520cb68c956ef8fc333f7be8639907a72c05d3bec44f00f1e60dab443253d658e761050b9e08b4e7d2466921f + languageName: node + linkType: hard + +"remark-gfm@npm:^3.0.1": + version: 3.0.1 + resolution: "remark-gfm@npm:3.0.1" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-gfm: "npm:^2.0.0" + micromark-extension-gfm: "npm:^2.0.0" + unified: "npm:^10.0.0" + checksum: 53c4e82204f82f81949a170efdeb49d3c45137b7bca06a7ff857a483aac1a44b55ef0de8fb1bbe4f1292f2a378058e2e42e644f2c61f3e0cdc3e56afa4ec2a2c + languageName: node + linkType: hard + +"remark-mdx@npm:^2.0.0": + version: 2.3.0 + resolution: "remark-mdx@npm:2.3.0" + dependencies: + mdast-util-mdx: "npm:^2.0.0" + micromark-extension-mdxjs: "npm:^1.0.0" + checksum: 2688bbf03094a9cd17cc86afb6cf0270e86ffc696a2fe25ccb1befb84eb0864d281388dc560b585e05e20f94a994c9fa88492430d2ba703a2fef6918bca4c36b + languageName: node + linkType: hard + +"remark-parse@npm:^10.0.0, remark-parse@npm:^10.0.2": + version: 10.0.2 + resolution: "remark-parse@npm:10.0.2" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-from-markdown: "npm:^1.0.0" + unified: "npm:^10.0.0" + checksum: 30cb8f2790380b1c7370a1c66cda41f33a7dc196b9e440a00e2675037bca55aea868165a8204e0cdbacc27ef4a3bdb7d45879826bd6efa07d9fdf328cb67a332 + languageName: node + linkType: hard + +"remark-rehype@npm:^10.0.0, remark-rehype@npm:^10.1.0": + version: 10.1.0 + resolution: "remark-rehype@npm:10.1.0" + dependencies: + "@types/hast": "npm:^2.0.0" + "@types/mdast": "npm:^3.0.0" + mdast-util-to-hast: "npm:^12.1.0" + unified: "npm:^10.0.0" + checksum: 803e658c9b51a9b53ee2ada42ff82e8e570444bb97c873e0d602c2d8dcb69a774fd22bd6f26643dfd5ab4c181059ea6c9fb9a99a2d7f9665f3f11bef1a1489bd + languageName: node + linkType: hard + +"remark-smartypants@npm:^2.0.0": + version: 2.0.0 + resolution: "remark-smartypants@npm:2.0.0" + dependencies: + retext: "npm:^8.1.0" + retext-smartypants: "npm:^5.1.0" + unist-util-visit: "npm:^4.1.0" + checksum: 9097d9ab1c078f69a00484e00b88420c906b39f91030bebae630b80a7453c83a846f9af8d6969eef43d072bc3b95af3e54dc472f2c9279c888f6ac65ce782ddd + languageName: node + linkType: hard + +"request-light@npm:^0.7.0": + version: 0.7.0 + resolution: "request-light@npm:0.7.0" + checksum: 1c98f0d74b8a28a6fecb96d4b30c255a27b402f5e10b2696b67ede7257389a7533fba9e8ea122ccec9a7c6f06db36eab5d0b563bd5ff27b15aaa9d3910e31894 languageName: node linkType: hard @@ -4931,13 +7878,6 @@ __metadata: languageName: node linkType: hard -"resolve-from@npm:^4.0.0": - version: 4.0.0 - resolution: "resolve-from@npm:4.0.0" - checksum: 8408eec31a3112ef96e3746c37be7d64020cda07c03a920f5024e77290a218ea758b26ca9529fd7b1ad283947f34b2291c1c0f6aa0ed34acfdda9c6014c8d190 - languageName: node - linkType: hard - "resolve-from@npm:^5.0.0": version: 5.0.0 resolution: "resolve-from@npm:5.0.0" @@ -4997,6 +7937,63 @@ __metadata: languageName: node linkType: hard +"restore-cursor@npm:^4.0.0": + version: 4.0.0 + resolution: "restore-cursor@npm:4.0.0" + dependencies: + onetime: "npm:^5.1.0" + signal-exit: "npm:^3.0.2" + checksum: 6f7da8c5e422ac26aa38354870b1afac09963572cf2879443540449068cb43476e9cbccf6f8de3e0171e0d6f7f533c2bc1a0a008003c9a525bbc098e89041318 + languageName: node + linkType: hard + +"retext-latin@npm:^3.0.0": + version: 3.1.0 + resolution: "retext-latin@npm:3.1.0" + dependencies: + "@types/nlcst": "npm:^1.0.0" + parse-latin: "npm:^5.0.0" + unherit: "npm:^3.0.0" + unified: "npm:^10.0.0" + checksum: c4cf0798ebdb5d9fa2862ced646ac3361969be3e76a2925cfb39e5fd92b687ff2b1fc2b0140309d0c7e712e80b75f362867207d3487892b3d1710ed61920157e + languageName: node + linkType: hard + +"retext-smartypants@npm:^5.1.0": + version: 5.2.0 + resolution: "retext-smartypants@npm:5.2.0" + dependencies: + "@types/nlcst": "npm:^1.0.0" + nlcst-to-string: "npm:^3.0.0" + unified: "npm:^10.0.0" + unist-util-visit: "npm:^4.0.0" + checksum: 446e7649f3886e79aa5ed3f625e4f2cd2001b592123b576e358284f4ac5835f17bc851220b64938e08e854095c77cbdb184a850ae416493284f423c5d200a9ed + languageName: node + linkType: hard + +"retext-stringify@npm:^3.0.0": + version: 3.1.0 + resolution: "retext-stringify@npm:3.1.0" + dependencies: + "@types/nlcst": "npm:^1.0.0" + nlcst-to-string: "npm:^3.0.0" + unified: "npm:^10.0.0" + checksum: 3bd8ff275f37b917fbae412a393d0a2fbff87f6c5d5dd387e7c949a627a33dddb88ea803e965cc943b3bb404aedaa931d08072b495941e0fd5f54c2757419be2 + languageName: node + linkType: hard + +"retext@npm:^8.1.0": + version: 8.1.0 + resolution: "retext@npm:8.1.0" + dependencies: + "@types/nlcst": "npm:^1.0.0" + retext-latin: "npm:^3.0.0" + retext-stringify: "npm:^3.0.0" + unified: "npm:^10.0.0" + checksum: aec880d16feeb47b2d21dd639c5f2717424a4d6b2f4fe21521159572f610caa02f376a75fcc8d35fa6ac91f2dc44f76a7da2be4e1f41976f707cbdf48bd4e63f + languageName: node + linkType: hard + "retry@npm:^0.12.0": version: 0.12.0 resolution: "retry@npm:0.12.0" @@ -5022,9 +8019,9 @@ __metadata: languageName: node linkType: hard -"rollup@npm:^3.28.0": - version: 3.29.1 - resolution: "rollup@npm:3.29.1" +"rollup@npm:^3.27.1": + version: 3.29.4 + resolution: "rollup@npm:3.29.4" dependencies: fsevents: "npm:~2.3.2" dependenciesMeta: @@ -5032,7 +8029,7 @@ __metadata: optional: true bin: rollup: dist/bin/rollup - checksum: 9a04803aa55b844d95458b48734ec4b7716e3cefdb2c08a4ccd71f55b83a9afb970e3c667d114fef08ae640e67f8d1928cf668ba8c30fe3df77a810d50e1b077 + checksum: 65eddf84bf389ea8e4d4c1614b1c6a298d08f8ae785c0c087e723a879190c8aaddbab4aa3b8a0524551b9036750c9f8bfea27b377798accfd2ba5084ceff5aaa languageName: node linkType: hard @@ -5086,6 +8083,59 @@ __metadata: languageName: node linkType: hard +"rollup@npm:^4.2.0": + version: 4.7.0 + resolution: "rollup@npm:4.7.0" + dependencies: + "@rollup/rollup-android-arm-eabi": "npm:4.7.0" + "@rollup/rollup-android-arm64": "npm:4.7.0" + "@rollup/rollup-darwin-arm64": "npm:4.7.0" + "@rollup/rollup-darwin-x64": "npm:4.7.0" + "@rollup/rollup-linux-arm-gnueabihf": "npm:4.7.0" + "@rollup/rollup-linux-arm64-gnu": "npm:4.7.0" + "@rollup/rollup-linux-arm64-musl": "npm:4.7.0" + "@rollup/rollup-linux-riscv64-gnu": "npm:4.7.0" + "@rollup/rollup-linux-x64-gnu": "npm:4.7.0" + "@rollup/rollup-linux-x64-musl": "npm:4.7.0" + "@rollup/rollup-win32-arm64-msvc": "npm:4.7.0" + "@rollup/rollup-win32-ia32-msvc": "npm:4.7.0" + "@rollup/rollup-win32-x64-msvc": "npm:4.7.0" + fsevents: "npm:~2.3.2" + dependenciesMeta: + "@rollup/rollup-android-arm-eabi": + optional: true + "@rollup/rollup-android-arm64": + optional: true + "@rollup/rollup-darwin-arm64": + optional: true + "@rollup/rollup-darwin-x64": + optional: true + "@rollup/rollup-linux-arm-gnueabihf": + optional: true + "@rollup/rollup-linux-arm64-gnu": + optional: true + "@rollup/rollup-linux-arm64-musl": + optional: true + "@rollup/rollup-linux-riscv64-gnu": + optional: true + "@rollup/rollup-linux-x64-gnu": + optional: true + "@rollup/rollup-linux-x64-musl": + optional: true + "@rollup/rollup-win32-arm64-msvc": + optional: true + "@rollup/rollup-win32-ia32-msvc": + optional: true + "@rollup/rollup-win32-x64-msvc": + optional: true + fsevents: + optional: true + bin: + rollup: dist/bin/rollup + checksum: 1226252168e701aa50d8e71fc42f0561f16388b83f224fdf48aea20784143a668c897c5a8f80dc15f684fab4ece689f9d99ac3e3deab02d6b9d5dd1637b38428 + languageName: node + linkType: hard + "run-parallel@npm:^1.1.9": version: 1.2.0 resolution: "run-parallel@npm:1.2.0" @@ -5095,19 +8145,16 @@ __metadata: languageName: node linkType: hard -"safe-array-concat@npm:^1.0.1": - version: 1.0.1 - resolution: "safe-array-concat@npm:1.0.1" +"sade@npm:^1.7.3": + version: 1.8.1 + resolution: "sade@npm:1.8.1" dependencies: - call-bind: "npm:^1.0.2" - get-intrinsic: "npm:^1.2.1" - has-symbols: "npm:^1.0.3" - isarray: "npm:^2.0.5" - checksum: 4b15ce5fce5ce4d7e744a63592cded88d2f27806ed229eadb2e42629cbcd40e770f7478608e75f455e7fe341acd8c0a01bdcd7146b10645ea7411c5e3c1d1dd8 + mri: "npm:^1.1.0" + checksum: da8a3a5d667ad5ce3bf6d4f054bbb9f711103e5df21003c5a5c1a8a77ce12b640ed4017dd423b13c2307ea7e645adee7c2ae3afe8051b9db16a6f6d3da3f90b1 languageName: node linkType: hard -"safe-buffer@npm:~5.2.0": +"safe-buffer@npm:^5.0.1, safe-buffer@npm:~5.2.0": version: 5.2.1 resolution: "safe-buffer@npm:5.2.1" checksum: 6501914237c0a86e9675d4e51d89ca3c21ffd6a31642efeba25ad65720bce6921c9e7e974e5be91a786b25aa058b5303285d3c15dbabf983a919f5f630d349f3 @@ -5132,6 +8179,23 @@ __metadata: languageName: node linkType: hard +"sax@npm:^1.2.4": + version: 1.3.0 + resolution: "sax@npm:1.3.0" + checksum: 599dbe0ba9d8bd55e92d920239b21d101823a6cedff71e542589303fa0fa8f3ece6cf608baca0c51be846a2e88365fac94a9101a9c341d94b98e30c4deea5bea + languageName: node + linkType: hard + +"section-matter@npm:^1.0.0": + version: 1.0.0 + resolution: "section-matter@npm:1.0.0" + dependencies: + extend-shallow: "npm:^2.0.1" + kind-of: "npm:^6.0.0" + checksum: 8007f91780adc5aaa781a848eaae50b0f680bbf4043b90cf8a96778195b8fab690c87fe7a989e02394ce69890e330811ec8dab22397d384673ce59f7d750641d + languageName: node + linkType: hard + "semver@npm:2 || 3 || 4 || 5": version: 5.7.2 resolution: "semver@npm:5.7.2" @@ -5150,7 +8214,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.3.5, semver@npm:^7.5.3, semver@npm:^7.5.4": +"semver@npm:^7.3.5, semver@npm:^7.3.8, semver@npm:^7.5.3, semver@npm:^7.5.4": version: 7.5.4 resolution: "semver@npm:7.5.4" dependencies: @@ -5161,6 +8225,13 @@ __metadata: languageName: node linkType: hard +"server-destroy@npm:^1.0.1": + version: 1.0.1 + resolution: "server-destroy@npm:1.0.1" + checksum: ab771f12b24cde1bc622cce0c14a1365f3ab0685937c641c762916fb43aa7a03d6c577cc4375ea5361d6bc1bb20ab689ec5723086e5798c6781edb61287e24b8 + languageName: node + linkType: hard + "set-blocking@npm:^2.0.0": version: 2.0.0 resolution: "set-blocking@npm:2.0.0" @@ -5168,26 +8239,20 @@ __metadata: languageName: node linkType: hard -"set-function-length@npm:^1.1.1": - version: 1.1.1 - resolution: "set-function-length@npm:1.1.1" - dependencies: - define-data-property: "npm:^1.1.1" - get-intrinsic: "npm:^1.2.1" - gopd: "npm:^1.0.1" - has-property-descriptors: "npm:^1.0.0" - checksum: a29e255c116c29e3323b851c4f46c58c91be9bb8b065f191e2ea1807cb2c839df56e3175732a498e0c6d54626ba6b6fef896bf699feb7ab70c42dc47eb247c95 - languageName: node - linkType: hard - -"set-function-name@npm:^2.0.0": - version: 2.0.1 - resolution: "set-function-name@npm:2.0.1" +"sharp@npm:^0.32.5": + version: 0.32.6 + resolution: "sharp@npm:0.32.6" dependencies: - define-data-property: "npm:^1.0.1" - functions-have-names: "npm:^1.2.3" - has-property-descriptors: "npm:^1.0.0" - checksum: 6be7d3e15be47f4db8a5a563a35c60b5e7c4af91cc900e8972ffad33d3aaa227900faa55f60121cdb04b85866a734bb7fe4cd91f654c632861cc86121a48312a + color: "npm:^4.2.3" + detect-libc: "npm:^2.0.2" + node-addon-api: "npm:^6.1.0" + node-gyp: "npm:latest" + prebuild-install: "npm:^7.1.1" + semver: "npm:^7.5.4" + simple-get: "npm:^4.0.1" + tar-fs: "npm:^3.0.4" + tunnel-agent: "npm:^0.6.0" + checksum: f6a756fec5051ef2f9341e0543cde1da4e822982dd5398010baad92e2262bd177e08b753eb19b2fbee30f2fcb0e8756f24088fafc48293a364e9a8f8dc65a300 languageName: node linkType: hard @@ -5223,10 +8288,24 @@ __metadata: languageName: node linkType: hard -"shell-quote@npm:^1.6.1": - version: 1.8.1 - resolution: "shell-quote@npm:1.8.1" - checksum: 8cec6fd827bad74d0a49347057d40dfea1e01f12a6123bf82c4649f3ef152fc2bc6d6176e6376bffcd205d9d0ccb4f1f9acae889384d20baff92186f01ea455a +"shiki@npm:^0.14.1": + version: 0.14.5 + resolution: "shiki@npm:0.14.5" + dependencies: + ansi-sequence-parser: "npm:^1.1.0" + jsonc-parser: "npm:^3.2.0" + vscode-oniguruma: "npm:^1.7.0" + vscode-textmate: "npm:^8.0.0" + checksum: 50d33bd30c5b96a93f5ac07dc55eba4fdf4d2b373cb36f8f6559cceae52acc3290d91bce250753d3e6010bc4093af7b3a9f254ec93731545ce4d27565c24dad3 + languageName: node + linkType: hard + +"shikiji@npm:^0.6.8": + version: 0.6.13 + resolution: "shikiji@npm:0.6.13" + dependencies: + hast-util-to-html: "npm:^9.0.0" + checksum: fa3405607173c798df6b8d68cabb953817d6bee5b7b0b7aabb3d0cb823b6eb763b8a9a8511f205de28975688af812bb57582394fba671eada19e61b61649591f languageName: node linkType: hard @@ -5262,6 +8341,72 @@ __metadata: languageName: node linkType: hard +"signal-exit@npm:^4.1.0": + version: 4.1.0 + resolution: "signal-exit@npm:4.1.0" + checksum: 41602dce540e46d599edba9d9860193398d135f7ff72cab629db5171516cfae628d21e7bfccde1bbfdf11c48726bc2a6d1a8fb8701125852fbfda7cf19c6aa83 + languageName: node + linkType: hard + +"simple-concat@npm:^1.0.0": + version: 1.0.1 + resolution: "simple-concat@npm:1.0.1" + checksum: 62f7508e674414008910b5397c1811941d457dfa0db4fd5aa7fa0409eb02c3609608dfcd7508cace75b3a0bf67a2a77990711e32cd213d2c76f4fd12ee86d776 + languageName: node + linkType: hard + +"simple-get@npm:^4.0.0, simple-get@npm:^4.0.1": + version: 4.0.1 + resolution: "simple-get@npm:4.0.1" + dependencies: + decompress-response: "npm:^6.0.0" + once: "npm:^1.3.1" + simple-concat: "npm:^1.0.0" + checksum: b0649a581dbca741babb960423248899203165769747142033479a7dc5e77d7b0fced0253c731cd57cf21e31e4d77c9157c3069f4448d558ebc96cf9e1eebcf0 + languageName: node + linkType: hard + +"simple-swizzle@npm:^0.2.2": + version: 0.2.2 + resolution: "simple-swizzle@npm:0.2.2" + dependencies: + is-arrayish: "npm:^0.3.1" + checksum: df5e4662a8c750bdba69af4e8263c5d96fe4cd0f9fe4bdfa3cbdeb45d2e869dff640beaaeb1ef0e99db4d8d2ec92f85508c269f50c972174851bc1ae5bd64308 + languageName: node + linkType: hard + +"sirv@npm:^2.0.3": + version: 2.0.3 + resolution: "sirv@npm:2.0.3" + dependencies: + "@polka/url": "npm:^1.0.0-next.20" + mrmime: "npm:^1.0.0" + totalist: "npm:^3.0.0" + checksum: 333bd665ee5ac3805047ea47757e04e2b18ca562749b9a07f5bbbee6dabd99ff00011604689b1ada3d22e46a4198c61e05e2d1abd5454d94da483ce3a3813205 + languageName: node + linkType: hard + +"sisteransi@npm:^1.0.5": + version: 1.0.5 + resolution: "sisteransi@npm:1.0.5" + checksum: 230ac975cca485b7f6fe2b96a711aa62a6a26ead3e6fb8ba17c5a00d61b8bed0d7adc21f5626b70d7c33c62ff4e63933017a6462942c719d1980bb0b1207ad46 + languageName: node + linkType: hard + +"sitemap@npm:^7.1.1": + version: 7.1.1 + resolution: "sitemap@npm:7.1.1" + dependencies: + "@types/node": "npm:^17.0.5" + "@types/sax": "npm:^1.2.1" + arg: "npm:^5.0.0" + sax: "npm:^1.2.4" + bin: + sitemap: dist/cli.js + checksum: d25abe5c78f08e6014792e0f4d59353042a5a795788decdd87cb03bda736d248426a618e5028e18325f04b3e9d0ecb02d126ed6177365aa2703fa77df8f4f4e0 + languageName: node + linkType: hard + "slash@npm:^3.0.0": version: 3.0.0 resolution: "slash@npm:3.0.0" @@ -5329,6 +8474,27 @@ __metadata: languageName: node linkType: hard +"source-map@npm:^0.6.1": + version: 0.6.1 + resolution: "source-map@npm:0.6.1" + checksum: ab55398007c5e5532957cb0beee2368529618ac0ab372d789806f5718123cc4367d57de3904b4e6a4170eb5a0b0f41373066d02ca0735a0c4d75c7d328d3e011 + languageName: node + linkType: hard + +"source-map@npm:^0.7.0, source-map@npm:^0.7.4": + version: 0.7.4 + resolution: "source-map@npm:0.7.4" + checksum: dc0cf3768fe23c345ea8760487f8c97ef6fca8a73c83cd7c9bf2fde8bc2c34adb9c0824d6feb14bc4f9e37fb522e18af621543f1289038a66ac7586da29aa7dc + languageName: node + linkType: hard + +"space-separated-tokens@npm:^2.0.0": + version: 2.0.2 + resolution: "space-separated-tokens@npm:2.0.2" + checksum: 6173e1d903dca41dcab6a2deed8b4caf61bd13b6d7af8374713500570aa929ff9414ae09a0519f4f8772df993300305a395d4871f35bc4ca72b6db57e1f30af8 + languageName: node + linkType: hard + "spawndamnit@npm:^2.0.0": version: 2.0.0 resolution: "spawndamnit@npm:2.0.0" @@ -5373,15 +8539,6 @@ __metadata: languageName: node linkType: hard -"split@npm:0.3": - version: 0.3.3 - resolution: "split@npm:0.3.3" - dependencies: - through: "npm:2" - checksum: 88c09b1b4de84953bf5d6c153123a1fbb20addfea9381f70d27b4eb6b2bfbadf25d313f8f5d3fd727d5679b97bfe54da04766b91010f131635bf49e51d5db3fc - languageName: node - linkType: hard - "sprintf-js@npm:~1.0.2": version: 1.0.3 resolution: "sprintf-js@npm:1.0.3" @@ -5405,19 +8562,28 @@ __metadata: languageName: node linkType: hard -"std-env@npm:^3.3.3": - version: 3.3.3 - resolution: "std-env@npm:3.3.3" - checksum: d80656542889958982427a5891b4d266f0e531060b249c3fc882e1c1b1cec58160b9e3cab9cf5635d58a2c23692237170b3fa45be738866518b8be77a7658b89 +"std-env@npm:^3.5.0": + version: 3.6.0 + resolution: "std-env@npm:3.6.0" + checksum: a540b8cb011bef4bf5905e1e28f24ce37124f9d001c69224ee0025d3600144e6847bac62cd38fbd98148ab4d26ab0682b9b4d42bc863cd1cca0b9807f18aadba + languageName: node + linkType: hard + +"stdin-discarder@npm:^0.1.0": + version: 0.1.0 + resolution: "stdin-discarder@npm:0.1.0" + dependencies: + bl: "npm:^5.0.0" + checksum: 3bbf7f8107e49c05b4a46bd739afdd34605cf1f06a038c8b2a33d034bf146344fc0ebc5149df1e6422510dd219971a220f25b1102413ef5128fe267683fbef9d languageName: node linkType: hard -"stream-combiner@npm:~0.0.4": - version: 0.0.4 - resolution: "stream-combiner@npm:0.0.4" +"stream-parser@npm:~0.3.1": + version: 0.3.1 + resolution: "stream-parser@npm:0.3.1" dependencies: - duplexer: "npm:~0.1.1" - checksum: 8075a94c0eb0f20450a8236cb99d4ce3ea6e6a4b36d8baa7440b1a08cde6ffd227debadffaecd80993bd334282875d0e927ab5b88484625e01970dd251004ff5 + debug: "npm:2" + checksum: 585508801423bd6c53f6dda9d78e4b743a08ab72e8e2680431fa855ef950e59c849ec2838f2a00c59af655ff8463e90f660f9169a816e63a3ca159cf713bae5c languageName: node linkType: hard @@ -5430,6 +8596,16 @@ __metadata: languageName: node linkType: hard +"streamx@npm:^2.15.0": + version: 2.15.5 + resolution: "streamx@npm:2.15.5" + dependencies: + fast-fifo: "npm:^1.1.0" + queue-tick: "npm:^1.0.1" + checksum: 7998d1fa3324131ed94efc4a4e8b22e0f60267b21d8f8fac8c605eaa1a6d6358adbc38c35b407be0eb8cc09a223c641962afb0db29ecbe92118242118946d93c + languageName: node + linkType: hard + "string-width-cjs@npm:string-width@^4.2.0, string-width@npm:^1.0.2 || 2 || 3 || 4, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3": version: 4.2.3 resolution: "string-width@npm:4.2.3" @@ -5452,14 +8628,14 @@ __metadata: languageName: node linkType: hard -"string.prototype.padend@npm:^3.0.0": - version: 3.1.4 - resolution: "string.prototype.padend@npm:3.1.4" +"string-width@npm:^6.1.0": + version: 6.1.0 + resolution: "string-width@npm:6.1.0" dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.1.4" - es-abstract: "npm:^1.20.4" - checksum: 11feb9ae51a32febc73bb3b38d29900405c736f47613badff773ab830f23faad796c43d51e18090cada975b82831f66bdcb6b5353739a019b7fcc321900205ad + eastasianwidth: "npm:^0.2.0" + emoji-regex: "npm:^10.2.1" + strip-ansi: "npm:^7.0.1" + checksum: 7b2991ea7c946a43042070787b85af454079116dfd6d853aab4ff8a6d4ac717cdc18656cfee15b7a7a78286669202a4a56385728f0740cb1e15001c71807b361 languageName: node linkType: hard @@ -5474,17 +8650,6 @@ __metadata: languageName: node linkType: hard -"string.prototype.trim@npm:^1.2.8": - version: 1.2.8 - resolution: "string.prototype.trim@npm:1.2.8" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - checksum: 4f76c583908bcde9a71208ddff38f67f24c9ec8093631601666a0df8b52fad44dad2368c78895ce83eb2ae8e7068294cc96a02fc971ab234e4d5c9bb61ea4e34 - languageName: node - linkType: hard - "string.prototype.trimend@npm:^1.0.6": version: 1.0.6 resolution: "string.prototype.trimend@npm:1.0.6" @@ -5496,17 +8661,6 @@ __metadata: languageName: node linkType: hard -"string.prototype.trimend@npm:^1.0.7": - version: 1.0.7 - resolution: "string.prototype.trimend@npm:1.0.7" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - checksum: 53c24911c7c4d8d65f5ef5322de23a3d5b6b4db73273e05871d5ab4571ae5638f38f7f19d71d09116578fb060e5a145cc6a208af2d248c8baf7a34f44d32ce57 - languageName: node - linkType: hard - "string.prototype.trimstart@npm:^1.0.6": version: 1.0.6 resolution: "string.prototype.trimstart@npm:1.0.6" @@ -5518,17 +8672,6 @@ __metadata: languageName: node linkType: hard -"string.prototype.trimstart@npm:^1.0.7": - version: 1.0.7 - resolution: "string.prototype.trimstart@npm:1.0.7" - dependencies: - call-bind: "npm:^1.0.2" - define-properties: "npm:^1.2.0" - es-abstract: "npm:^1.22.1" - checksum: 0bcf391b41ea16d4fda9c9953d0a7075171fe090d33b4cf64849af94944c50862995672ac03e0c5dba2940a213ad7f53515a668dac859ce22a0276289ae5cf4f - languageName: node - linkType: hard - "string_decoder@npm:^1.1.1": version: 1.3.0 resolution: "string_decoder@npm:1.3.0" @@ -5538,6 +8681,16 @@ __metadata: languageName: node linkType: hard +"stringify-entities@npm:^4.0.0": + version: 4.0.3 + resolution: "stringify-entities@npm:4.0.3" + dependencies: + character-entities-html4: "npm:^2.0.0" + character-entities-legacy: "npm:^3.0.0" + checksum: e4582cd40b082e95bc2075bed656dcbc24e83538830f15cb5a025f1ba8d341adbdb3c66efb6a5bfd6860a3ea426322135aa666cf128bf03c961553e2f9f2d4ed + languageName: node + linkType: hard + "strip-ansi-cjs@npm:strip-ansi@^6.0.1, strip-ansi@npm:^6.0.0, strip-ansi@npm:^6.0.1": version: 6.0.1 resolution: "strip-ansi@npm:6.0.1" @@ -5547,16 +8700,7 @@ __metadata: languageName: node linkType: hard -"strip-ansi@npm:^3.0.0": - version: 3.0.1 - resolution: "strip-ansi@npm:3.0.1" - dependencies: - ansi-regex: "npm:^2.0.0" - checksum: f6e7fbe8e700105dccf7102eae20e4f03477537c74b286fd22cfc970f139002ed6f0d9c10d0e21aa9ed9245e0fa3c9275930e8795c5b947da136e4ecb644a70f - languageName: node - linkType: hard - -"strip-ansi@npm:^7.0.1": +"strip-ansi@npm:^7.0.1, strip-ansi@npm:^7.1.0": version: 7.1.0 resolution: "strip-ansi@npm:7.1.0" dependencies: @@ -5565,12 +8709,10 @@ __metadata: languageName: node linkType: hard -"strip-bom@npm:^2.0.0": - version: 2.0.0 - resolution: "strip-bom@npm:2.0.0" - dependencies: - is-utf8: "npm:^0.2.0" - checksum: 4fcbb248af1d5c1f2d710022b7d60245077e7942079bfb7ef3fc8c1ae78d61e96278525ba46719b15ab12fced5c7603777105bc898695339d7c97c64d300ed0b +"strip-bom-string@npm:^1.0.0": + version: 1.0.0 + resolution: "strip-bom-string@npm:1.0.0" + checksum: 5c5717e2643225aa6a6d659d34176ab2657037f1fe2423ac6fcdb488f135e14fef1022030e426d8b4d0989e09adbd5c3288d5d3b9c632abeefd2358dfc512bca languageName: node linkType: hard @@ -5588,6 +8730,13 @@ __metadata: languageName: node linkType: hard +"strip-final-newline@npm:^3.0.0": + version: 3.0.0 + resolution: "strip-final-newline@npm:3.0.0" + checksum: a771a17901427bac6293fd416db7577e2bc1c34a19d38351e9d5478c3c415f523f391003b42ed475f27e33a78233035df183525395f731d3bfb8cdcbd4da08ce + languageName: node + linkType: hard + "strip-indent@npm:^3.0.0": version: 3.0.0 resolution: "strip-indent@npm:3.0.0" @@ -5597,19 +8746,28 @@ __metadata: languageName: node linkType: hard -"strip-json-comments@npm:^3.1.1": - version: 3.1.1 - resolution: "strip-json-comments@npm:3.1.1" - checksum: 9681a6257b925a7fa0f285851c0e613cc934a50661fa7bb41ca9cbbff89686bb4a0ee366e6ecedc4daafd01e83eee0720111ab294366fe7c185e935475ebcecd +"strip-json-comments@npm:~2.0.1": + version: 2.0.1 + resolution: "strip-json-comments@npm:2.0.1" + checksum: b509231cbdee45064ff4f9fd73609e2bcc4e84a4d508e9dd0f31f70356473fde18abfb5838c17d56fb236f5a06b102ef115438de0600b749e818a35fbbc48c43 languageName: node linkType: hard -"strip-literal@npm:^1.0.1": - version: 1.0.1 - resolution: "strip-literal@npm:1.0.1" +"strip-literal@npm:^1.3.0": + version: 1.3.0 + resolution: "strip-literal@npm:1.3.0" dependencies: - acorn: "npm:^8.8.2" - checksum: 287ccf57f139f58908324a9115b9dd6a6f6876f16543ecc3eb9b646e67f86c633634c842a5319b8b7e15ee7169dfb4ebcfd91601085d038322f5b1146fe90eaf + acorn: "npm:^8.10.0" + checksum: 3c0c9ee41eb346e827eede61ef288457f53df30e3e6ff8b94fa81b636933b0c13ca4ea5c97d00a10d72d04be326da99ac819f8769f0c6407ba8177c98344a916 + languageName: node + linkType: hard + +"style-to-object@npm:^0.4.1": + version: 0.4.4 + resolution: "style-to-object@npm:0.4.4" + dependencies: + inline-style-parser: "npm:0.1.1" + checksum: 3a733080da66952881175b17d65f92985cf94c1ca358a92cf21b114b1260d49b94a404ed79476047fb95698d64c7e366ca7443f0225939e2fb34c38bbc9c7639 languageName: node linkType: hard @@ -5630,13 +8788,6 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:^2.0.0": - version: 2.0.0 - resolution: "supports-color@npm:2.0.0" - checksum: 570e0b63be36cccdd25186350a6cb2eaad332a95ff162fa06d9499982315f2fe4217e69dd98e862fbcd9c81eaff300a825a1fe7bf5cc752e5b84dfed042b0dda - languageName: node - linkType: hard - "supports-color@npm:^5.3.0": version: 5.5.0 resolution: "supports-color@npm:5.5.0" @@ -5662,6 +8813,53 @@ __metadata: languageName: node linkType: hard +"tar-fs@npm:^2.0.0": + version: 2.1.1 + resolution: "tar-fs@npm:2.1.1" + dependencies: + chownr: "npm:^1.1.1" + mkdirp-classic: "npm:^0.5.2" + pump: "npm:^3.0.0" + tar-stream: "npm:^2.1.4" + checksum: 871d26a934bfb7beeae4c4d8a09689f530b565f79bd0cf489823ff0efa3705da01278160da10bb006d1a793fa0425cf316cec029b32a9159eacbeaff4965fb6d + languageName: node + linkType: hard + +"tar-fs@npm:^3.0.4": + version: 3.0.4 + resolution: "tar-fs@npm:3.0.4" + dependencies: + mkdirp-classic: "npm:^0.5.2" + pump: "npm:^3.0.0" + tar-stream: "npm:^3.1.5" + checksum: 120f026d891e5b4f7147a5ae5816e3a9b7f2c5b4ca61714dab3fe1244961607dccca40c11cafc584e625838c57d1308da5bb28b13d70b85ab566bc4c9f1c88b1 + languageName: node + linkType: hard + +"tar-stream@npm:^2.1.4": + version: 2.2.0 + resolution: "tar-stream@npm:2.2.0" + dependencies: + bl: "npm:^4.0.3" + end-of-stream: "npm:^1.4.1" + fs-constants: "npm:^1.0.0" + inherits: "npm:^2.0.3" + readable-stream: "npm:^3.1.1" + checksum: 2f4c910b3ee7196502e1ff015a7ba321ec6ea837667220d7bcb8d0852d51cb04b87f7ae471008a6fb8f5b1a1b5078f62f3a82d30c706f20ada1238ac797e7692 + languageName: node + linkType: hard + +"tar-stream@npm:^3.1.5": + version: 3.1.6 + resolution: "tar-stream@npm:3.1.6" + dependencies: + b4a: "npm:^1.6.4" + fast-fifo: "npm:^1.2.0" + streamx: "npm:^2.15.0" + checksum: 7d52d1a56eb25b8434c9544becb737eb6c4f0ed19d205e739fdd2537ad8d1d623a6c93f7f8e58d9028cb0cdf86c0d8b67164e070cd1702cc78b8ab7cba0f3702 + languageName: node + linkType: hard + "tar@npm:^6.1.11, tar@npm:^6.1.2": version: 6.1.15 resolution: "tar@npm:6.1.15" @@ -5683,10 +8881,14 @@ __metadata: languageName: node linkType: hard -"text-table@npm:^0.2.0": - version: 0.2.0 - resolution: "text-table@npm:0.2.0" - checksum: 02805740c12851ea5982686810702e2f14369a5f4c5c40a836821e3eefc65ffeec3131ba324692a37608294b0fd8c1e55a2dd571ffed4909822787668ddbee5c +"test-exclude@npm:^6.0.0": + version: 6.0.0 + resolution: "test-exclude@npm:6.0.0" + dependencies: + "@istanbuljs/schema": "npm:^0.1.2" + glob: "npm:^7.1.4" + minimatch: "npm:^3.0.4" + checksum: 019d33d81adff3f9f1bfcff18125fb2d3c65564f437d9be539270ee74b994986abb8260c7c2ce90e8f30162178b09dbbce33c6389273afac4f36069c48521f57 languageName: node linkType: hard @@ -5708,31 +8910,24 @@ __metadata: languageName: node linkType: hard -"through@npm:2, through@npm:~2.3, through@npm:~2.3.1": - version: 2.3.8 - resolution: "through@npm:2.3.8" - checksum: 4b09f3774099de0d4df26d95c5821a62faee32c7e96fb1f4ebd54a2d7c11c57fe88b0a0d49cf375de5fee5ae6bf4eb56dbbf29d07366864e2ee805349970d3cc - languageName: node - linkType: hard - -"tinybench@npm:^2.5.0": - version: 2.5.0 - resolution: "tinybench@npm:2.5.0" - checksum: 9c8b8630fe86784d5931833ee33d02d72d66c35f7e5f94479c4e21413b97acbf6f44439c4d806793f6178fbfaa3bce32801e108c5b56587119ac112f25e3ca17 +"tinybench@npm:^2.5.1": + version: 2.5.1 + resolution: "tinybench@npm:2.5.1" + checksum: 9c55ef25ce1689c3e2fdb89cacbf27dada4d04f846cac70023fe97fc35d2122816d8bbc5b20253e071d13688cf006355d59f0096d22958b818e1e2fe60e5165b languageName: node linkType: hard -"tinypool@npm:^0.7.0": - version: 0.7.0 - resolution: "tinypool@npm:0.7.0" - checksum: ecb35d9f74e72722c059acb1947ffc3c2caccb45266b89b72f74be2d28f0784d948b50bd9c6c68fa4159afd423ac5f5a07271a5f516d18a565dd06af0a37bc44 +"tinypool@npm:^0.8.1": + version: 0.8.1 + resolution: "tinypool@npm:0.8.1" + checksum: d965c057a1866c9d83716f4e434f7be18b2a067ed3b32cc2de3b3bf34ca1756ac1c35bd04433e2086c8cc2afa75b328e4b17baa6b4e6292dba2ce31cc76770e0 languageName: node linkType: hard -"tinyspy@npm:^2.1.1": - version: 2.1.1 - resolution: "tinyspy@npm:2.1.1" - checksum: 0e7186fd380cbc594c35a0f6270f61b79ed22d1d960cac6064c3a5ebcf8a3a70d6590ff2049cba1d58631c3c556b1a67896d0db136381da7855a37087a90fbc5 +"tinyspy@npm:^2.2.0": + version: 2.2.0 + resolution: "tinyspy@npm:2.2.0" + checksum: 8c7b70748dd8590e85d52741db79243746c15bc03c92d75c23160a762142db577e7f53e360ba7300e321b12bca5c42dd2522a8dbeec6ba3830302573dd8516bc languageName: node linkType: hard @@ -5745,6 +8940,13 @@ __metadata: languageName: node linkType: hard +"to-fast-properties@npm:^2.0.0": + version: 2.0.0 + resolution: "to-fast-properties@npm:2.0.0" + checksum: b214d21dbfb4bce3452b6244b336806ffea9c05297148d32ebb428d5c43ce7545bdfc65a1ceb58c9ef4376a65c0cb2854d645f33961658b3e3b4f84910ddcdd7 + languageName: node + linkType: hard + "to-regex-range@npm:^5.0.1": version: 5.0.1 resolution: "to-regex-range@npm:5.0.1" @@ -5754,6 +8956,13 @@ __metadata: languageName: node linkType: hard +"totalist@npm:^3.0.0": + version: 3.0.1 + resolution: "totalist@npm:3.0.1" + checksum: 4bb1fadb69c3edbef91c73ebef9d25b33bbf69afe1e37ce544d5f7d13854cda15e47132f3e0dc4cafe300ddb8578c77c50a65004d8b6e97e77934a69aa924863 + languageName: node + linkType: hard + "tr46@npm:^1.0.1": version: 1.0.1 resolution: "tr46@npm:1.0.1" @@ -5779,6 +8988,13 @@ __metadata: languageName: node linkType: hard +"trim-lines@npm:^3.0.0": + version: 3.0.1 + resolution: "trim-lines@npm:3.0.1" + checksum: 3a1611fa9e52aa56a94c69951a9ea15b8aaad760eaa26c56a65330dc8adf99cb282fc07cc9d94968b7d4d88003beba220a7278bbe2063328eb23fb56f9509e94 + languageName: node + linkType: hard + "trim-newlines@npm:^3.0.0": version: 3.0.1 resolution: "trim-newlines@npm:3.0.1" @@ -5786,12 +9002,10 @@ __metadata: languageName: node linkType: hard -"ts-api-utils@npm:^1.0.1": - version: 1.0.1 - resolution: "ts-api-utils@npm:1.0.1" - peerDependencies: - typescript: ">=4.2.0" - checksum: 8e8a54afb44df31c413e6f5b817a305a37780726125db26e85d01d553efc31aacb3ccad111a14844b584776f24e71bcd4db2f2d3e9bce8031a329dc78f3e46e2 +"trough@npm:^2.0.0": + version: 2.1.0 + resolution: "trough@npm:2.1.0" + checksum: 9a973f0745fa69b9d34f29fe8123599abb6915350a5f4e9e9c9026156219f8774af062d916f4ec327b796149188719170ad87f0d120f1e94271a1843366efcc3 languageName: node linkType: hard @@ -5802,15 +9016,17 @@ __metadata: languageName: node linkType: hard -"tsconfig-paths@npm:^3.14.2": - version: 3.14.2 - resolution: "tsconfig-paths@npm:3.14.2" - dependencies: - "@types/json5": "npm:^0.0.29" - json5: "npm:^1.0.2" - minimist: "npm:^1.2.6" - strip-bom: "npm:^3.0.0" - checksum: fdc92bb7b18b31c0e76f8ec4f98d07236b09590fd6578e587ad024792c8b2235d65125a8fd007fa47a84400f84ceccbf33f24e5198d953249e7204f4cef3517c +"tsconfck@npm:^3.0.0": + version: 3.0.0 + resolution: "tsconfck@npm:3.0.0" + peerDependencies: + typescript: ^5.0.0 + peerDependenciesMeta: + typescript: + optional: true + bin: + tsconfck: bin/tsconfck.js + checksum: 3614f52675b6c279c6e3d72f4dfdc8bb80c7b051e6d3227bcc67c6af9e8a4449a3eee9c6cf92b6720906bb32df03bc85830786fc7cf9ed3a9a98edb21b2ccc90 languageName: node linkType: hard @@ -5870,24 +9086,33 @@ __metadata: languageName: node linkType: hard +"tunnel-agent@npm:^0.6.0": + version: 0.6.0 + resolution: "tunnel-agent@npm:0.6.0" + dependencies: + safe-buffer: "npm:^5.0.1" + checksum: 4c7a1b813e7beae66fdbf567a65ec6d46313643753d0beefb3c7973d66fcec3a1e7f39759f0a0b4465883499c6dc8b0750ab8b287399af2e583823e40410a17a + languageName: node + linkType: hard + "type-assurer@workspace:.": version: 0.0.0-use.local resolution: "type-assurer@workspace:." dependencies: + "@astrojs/check": "npm:^0.3.1" + "@astrojs/starlight": "npm:^0.14.0" + "@biomejs/biome": "npm:^1.4.1" "@changesets/changelog-github": "npm:^0.4.8" "@changesets/cli": "npm:^2.26.2" "@types/lodash": "npm:^4.14.201" - "@typescript-eslint/eslint-plugin": "npm:^6.11.0" - "@typescript-eslint/parser": "npm:^6.11.0" - eslint: "npm:^8.54.0" - eslint-config-prettier: "npm:^9.0.0" - eslint-plugin-import: "npm:^2.29.0" + "@vitest/coverage-v8": "npm:^1.0.4" + "@vitest/ui": "npm:^1.0.4" + astro: "npm:^3.6.4" lodash: "npm:^4.17.21" - prettier: "npm:^3.1.0" + sharp: "npm:^0.32.5" tsup: "npm:^8.0.0" - typescript: "npm:^5.2.2" - vitest: "npm:^0.34.6" - yarn-run-all: "npm:latest" + typescript: "npm:^5.3.2" + vitest: "npm:^1.0.0" peerDependencies: typescript: ">= 4.0.0" peerDependenciesMeta: @@ -5896,15 +9121,6 @@ __metadata: languageName: unknown linkType: soft -"type-check@npm:^0.4.0, type-check@npm:~0.4.0": - version: 0.4.0 - resolution: "type-check@npm:0.4.0" - dependencies: - prelude-ls: "npm:^1.2.1" - checksum: 7b3fd0ed43891e2080bf0c5c504b418fbb3e5c7b9708d3d015037ba2e6323a28152ec163bcb65212741fa5d2022e3075ac3c76440dbd344c9035f818e8ecee58 - languageName: node - linkType: hard - "type-detect@npm:^4.0.0, type-detect@npm:^4.0.8": version: 4.0.8 resolution: "type-detect@npm:4.0.8" @@ -5919,13 +9135,6 @@ __metadata: languageName: node linkType: hard -"type-fest@npm:^0.20.2": - version: 0.20.2 - resolution: "type-fest@npm:0.20.2" - checksum: dea9df45ea1f0aaa4e2d3bed3f9a0bfe9e5b2592bddb92eb1bf06e50bcf98dbb78189668cd8bc31a0511d3fc25539b4cd5c704497e53e93e2d40ca764b10bfc3 - languageName: node - linkType: hard - "type-fest@npm:^0.6.0": version: 0.6.0 resolution: "type-fest@npm:0.6.0" @@ -5940,114 +9149,275 @@ __metadata: languageName: node linkType: hard -"typed-array-buffer@npm:^1.0.0": - version: 1.0.0 - resolution: "typed-array-buffer@npm:1.0.0" +"type-fest@npm:^2.13.0": + version: 2.19.0 + resolution: "type-fest@npm:2.19.0" + checksum: a5a7ecf2e654251613218c215c7493574594951c08e52ab9881c9df6a6da0aeca7528c213c622bc374b4e0cb5c443aa3ab758da4e3c959783ce884c3194e12cb + languageName: node + linkType: hard + +"typed-array-length@npm:^1.0.4": + version: 1.0.4 + resolution: "typed-array-length@npm:1.0.4" + dependencies: + call-bind: "npm:^1.0.2" + for-each: "npm:^0.3.3" + is-typed-array: "npm:^1.1.9" + checksum: c5163c0103d07fefc8a2ad0fc151f9ca9a1f6422098c00f695d55f9896e4d63614cd62cf8d8a031c6cee5f418e8980a533796597174da4edff075b3d275a7e23 + languageName: node + linkType: hard + +"typesafe-path@npm:^0.2.2": + version: 0.2.2 + resolution: "typesafe-path@npm:0.2.2" + checksum: 05027ea6a52a1e879da39c53fae7f5059e50cf578d586cc6c7741c3eca0b37ee2da4ef16d35ecf9f60cd0e8ca5aca98ea47902672907a19470f2260e8769b933 + languageName: node + linkType: hard + +"typescript-auto-import-cache@npm:^0.3.0": + version: 0.3.0 + resolution: "typescript-auto-import-cache@npm:0.3.0" + dependencies: + semver: "npm:^7.3.8" + checksum: 806b31ac062306e8fb506e6aa3e52c54ad5ee2f7f6801523e588a4a3256060f1850b74921691164dd0687d03ea35adba021a3d5cb55398d6655250837de44b4b + languageName: node + linkType: hard + +"typescript@npm:^5.3.2": + version: 5.3.2 + resolution: "typescript@npm:5.3.2" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: d7dbe1fbe19039e36a65468ea64b5d338c976550394ba576b7af9c68ed40c0bc5d12ecce390e4b94b287a09a71bd3229f19c2d5680611f35b7c53a3898791159 + languageName: node + linkType: hard + +"typescript@patch:typescript@npm%3A^5.3.2#optional!builtin": + version: 5.3.2 + resolution: "typescript@patch:typescript@npm%3A5.3.2#optional!builtin::version=5.3.2&hash=e012d7" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 73c8bad74e732d93211c9d77f28b03307e2f5fc6a0afc73f4b783261ab567686a16d6ae958bdaef383a00be1b0b8c8b6741dd6ca3d13af4963fa7e47456d49c7 + languageName: node + linkType: hard + +"ufo@npm:^1.1.1": + version: 1.1.1 + resolution: "ufo@npm:1.1.1" + checksum: 825993f027791ea533225b23fb923d4fafab544d7fb26f0833de246a00835a3de58c505248368a729a4272de3120c673951103423026858903b58a0679af7ee3 + languageName: node + linkType: hard + +"ufo@npm:^1.3.0": + version: 1.3.2 + resolution: "ufo@npm:1.3.2" + checksum: 180f3dfcdf319b54fe0272780841c93cb08a024fc2ee5f95e63285c2a3c42d8b671cd3641e9a53aafccf100cf8466aa8c040ddfa0efea1fc1968c9bfb250a661 + languageName: node + linkType: hard + +"unbox-primitive@npm:^1.0.2": + version: 1.0.2 + resolution: "unbox-primitive@npm:1.0.2" + dependencies: + call-bind: "npm:^1.0.2" + has-bigints: "npm:^1.0.2" + has-symbols: "npm:^1.0.3" + which-boxed-primitive: "npm:^1.0.2" + checksum: 81ca2e81134167cc8f75fa79fbcc8a94379d6c61de67090986a2273850989dd3bae8440c163121b77434b68263e34787a675cbdcb34bb2f764c6b9c843a11b66 + languageName: node + linkType: hard + +"unherit@npm:^3.0.0": + version: 3.0.1 + resolution: "unherit@npm:3.0.1" + checksum: cc08d9fa55e380604bd2991d75f1ae0f8e0a3cca140ae2cc88a9faaec6f844c7affd3cffb6afc4508c07940582ce4beda8df8ddc8161cef1dbcec5c56bc04077 + languageName: node + linkType: hard + +"unified@npm:^10.0.0, unified@npm:^10.1.2": + version: 10.1.2 + resolution: "unified@npm:10.1.2" + dependencies: + "@types/unist": "npm:^2.0.0" + bail: "npm:^2.0.0" + extend: "npm:^3.0.0" + is-buffer: "npm:^2.0.0" + is-plain-obj: "npm:^4.0.0" + trough: "npm:^2.0.0" + vfile: "npm:^5.0.0" + checksum: da9195e3375a74ab861a65e1d7b0454225d17a61646697911eb6b3e97de41091930ed3d167eb11881d4097c51deac407091d39ddd1ee8bf1fde3f946844a17a7 + languageName: node + linkType: hard + +"unique-filename@npm:^3.0.0": + version: 3.0.0 + resolution: "unique-filename@npm:3.0.0" + dependencies: + unique-slug: "npm:^4.0.0" + checksum: 6363e40b2fa758eb5ec5e21b3c7fb83e5da8dcfbd866cc0c199d5534c42f03b9ea9ab069769cc388e1d7ab93b4eeef28ef506ab5f18d910ef29617715101884f + languageName: node + linkType: hard + +"unique-slug@npm:^4.0.0": + version: 4.0.0 + resolution: "unique-slug@npm:4.0.0" + dependencies: + imurmurhash: "npm:^0.1.4" + checksum: cb811d9d54eb5821b81b18205750be84cb015c20a4a44280794e915f5a0a70223ce39066781a354e872df3572e8155c228f43ff0cce94c7cbf4da2cc7cbdd635 + languageName: node + linkType: hard + +"unist-util-generated@npm:^2.0.0": + version: 2.0.1 + resolution: "unist-util-generated@npm:2.0.1" + checksum: 6f052dd47a7280785f3787f52cdfe8819e1de50317a1bcf7c9346c63268cf2cebc61a5980e7ca734a54735e27dbb73091aa0361a98504ab7f9409fb75f1b16bb + languageName: node + linkType: hard + +"unist-util-is@npm:^5.0.0": + version: 5.2.1 + resolution: "unist-util-is@npm:5.2.1" + dependencies: + "@types/unist": "npm:^2.0.0" + checksum: a2376910b832bb10653d2167c3cd85b3610a5fd53f5169834c08b3c3a720fae9043d75ad32d727eedfc611491966c26a9501d428ec62467edc17f270feb5410b + languageName: node + linkType: hard + +"unist-util-is@npm:^6.0.0": + version: 6.0.0 + resolution: "unist-util-is@npm:6.0.0" + dependencies: + "@types/unist": "npm:^3.0.0" + checksum: 9419352181eaa1da35eca9490634a6df70d2217815bb5938a04af3a662c12c5607a2f1014197ec9c426fbef18834f6371bfdb6f033040fa8aa3e965300d70e7e + languageName: node + linkType: hard + +"unist-util-modify-children@npm:^3.0.0": + version: 3.1.1 + resolution: "unist-util-modify-children@npm:3.1.1" + dependencies: + "@types/unist": "npm:^2.0.0" + array-iterate: "npm:^2.0.0" + checksum: 8a74fb4b48f7442680c32ab8562c443f0366ae0e2c8b3c6ad2323a72c36447dfc1df2eeaebf5457efeb682cff64de4fb09655b49aa11d0915719f50dba349730 + languageName: node + linkType: hard + +"unist-util-position-from-estree@npm:^1.0.0, unist-util-position-from-estree@npm:^1.1.0": + version: 1.1.2 + resolution: "unist-util-position-from-estree@npm:1.1.2" dependencies: - call-bind: "npm:^1.0.2" - get-intrinsic: "npm:^1.2.1" - is-typed-array: "npm:^1.1.10" - checksum: ebad66cdf00c96b1395dffc7873169cf09801fca5954507a484f41f253feb1388d815db297b0b3bb8ce7421eac6f7ff45e2ec68450a3d68408aa4ae02fcf3a6c + "@types/unist": "npm:^2.0.0" + checksum: 1d95d0b2b05efcec07a4e6745a6950cd498f6100fb900615b252937baed5140df1c6319b9a67364c8a6bd891c58b3c9a52a22e8e1d3422c50bb785d7e3ad7484 languageName: node linkType: hard -"typed-array-byte-length@npm:^1.0.0": - version: 1.0.0 - resolution: "typed-array-byte-length@npm:1.0.0" +"unist-util-position@npm:^4.0.0": + version: 4.0.4 + resolution: "unist-util-position@npm:4.0.4" dependencies: - call-bind: "npm:^1.0.2" - for-each: "npm:^0.3.3" - has-proto: "npm:^1.0.1" - is-typed-array: "npm:^1.1.10" - checksum: 6696435d53ce0e704ff6760c57ccc35138aec5f87859e03eb2a3246336d546feae367952dbc918116f3f0dffbe669734e3cbd8960283c2fa79aac925db50d888 + "@types/unist": "npm:^2.0.0" + checksum: e506d702e25a0fb47a64502054f709a6ff5db98993bf139eec868cd11eb7de34392b781c6c2002e2c24d97aa398c14b32a47076129f36e4b894a2c1351200888 languageName: node linkType: hard -"typed-array-byte-offset@npm:^1.0.0": - version: 1.0.0 - resolution: "typed-array-byte-offset@npm:1.0.0" +"unist-util-position@npm:^5.0.0": + version: 5.0.0 + resolution: "unist-util-position@npm:5.0.0" dependencies: - available-typed-arrays: "npm:^1.0.5" - call-bind: "npm:^1.0.2" - for-each: "npm:^0.3.3" - has-proto: "npm:^1.0.1" - is-typed-array: "npm:^1.1.10" - checksum: 4036ce007ae9752931bed3dd61e0d6de2a3e5f6a5a85a05f3adb35388d2c0728f9b1a1e638d75579f168e49c289bfb5417f00e96d4ab081f38b647fc854ff7a5 + "@types/unist": "npm:^3.0.0" + checksum: dde3b31e314c98f12b4dc6402f9722b2bf35e96a4f2d463233dd90d7cde2d4928074a7a11eff0a5eb1f4e200f27fc1557e0a64a7e8e4da6558542f251b1b7400 languageName: node linkType: hard -"typed-array-length@npm:^1.0.4": - version: 1.0.4 - resolution: "typed-array-length@npm:1.0.4" +"unist-util-remove-position@npm:^4.0.0": + version: 4.0.2 + resolution: "unist-util-remove-position@npm:4.0.2" dependencies: - call-bind: "npm:^1.0.2" - for-each: "npm:^0.3.3" - is-typed-array: "npm:^1.1.9" - checksum: c5163c0103d07fefc8a2ad0fc151f9ca9a1f6422098c00f695d55f9896e4d63614cd62cf8d8a031c6cee5f418e8980a533796597174da4edff075b3d275a7e23 + "@types/unist": "npm:^2.0.0" + unist-util-visit: "npm:^4.0.0" + checksum: 17371b1e53c52d1b00656c9c6fe1bb044846e7067022195823ed3d1a8d8b965d4f9a79b286b8a841e68731b4ec93afd563b81ae92151f80c28534ba51e9dc18f languageName: node linkType: hard -"typescript@npm:^5.2.2": - version: 5.2.2 - resolution: "typescript@npm:5.2.2" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: 91ae3e6193d0ddb8656d4c418a033f0f75dec5e077ebbc2bd6d76439b93f35683936ee1bdc0e9cf94ec76863aa49f27159b5788219b50e1cd0cd6d110aa34b07 +"unist-util-remove@npm:^3.1.1": + version: 3.1.1 + resolution: "unist-util-remove@npm:3.1.1" + dependencies: + "@types/unist": "npm:^2.0.0" + unist-util-is: "npm:^5.0.0" + unist-util-visit-parents: "npm:^5.0.0" + checksum: c0dae9fd9f2b119d3fa56e4937499858b9d81a1bd91eb85e6e5a1b053f8ffc5e319c410baa4968f062557380c0d1d29ec0c7622c83f54303a54c668c18d68c53 languageName: node linkType: hard -"typescript@patch:typescript@npm%3A^5.2.2#optional!builtin": - version: 5.2.2 - resolution: "typescript@patch:typescript@npm%3A5.2.2#optional!builtin::version=5.2.2&hash=f3b441" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: 062c1cee1990e6b9419ce8a55162b8dc917eb87f807e4de0327dbc1c2fa4e5f61bc0dd4e034d38ff541d1ed0479b53bcee8e4de3a4075c51a1724eb6216cb6f5 +"unist-util-stringify-position@npm:^3.0.0": + version: 3.0.3 + resolution: "unist-util-stringify-position@npm:3.0.3" + dependencies: + "@types/unist": "npm:^2.0.0" + checksum: 14550027825230528f6437dad7f2579a841780318569851291be6c8a970bae6f65a7feb24dabbcfce0e5e68cacae85bf12cbda3f360f7c873b4db602bdf7bb21 languageName: node linkType: hard -"ufo@npm:^1.1.1": - version: 1.1.1 - resolution: "ufo@npm:1.1.1" - checksum: 825993f027791ea533225b23fb923d4fafab544d7fb26f0833de246a00835a3de58c505248368a729a4272de3120c673951103423026858903b58a0679af7ee3 +"unist-util-stringify-position@npm:^4.0.0": + version: 4.0.0 + resolution: "unist-util-stringify-position@npm:4.0.0" + dependencies: + "@types/unist": "npm:^3.0.0" + checksum: dfe1dbe79ba31f589108cb35e523f14029b6675d741a79dea7e5f3d098785045d556d5650ec6a8338af11e9e78d2a30df12b1ee86529cded1098da3f17ee999e languageName: node linkType: hard -"ufo@npm:^1.1.2": - version: 1.1.2 - resolution: "ufo@npm:1.1.2" - checksum: f19c5e0093447dbebb33cb84bfc2073e4a8a5d3535f44ca3aaa1470a93f394f14896b3a11cd4258fb986ba86b566543ea079244205a06ce35a480d4e613aca6e +"unist-util-visit-children@npm:^2.0.0": + version: 2.0.2 + resolution: "unist-util-visit-children@npm:2.0.2" + dependencies: + "@types/unist": "npm:^2.0.0" + checksum: d43d80f35b6845a37d6a52ff8b9065401e779c30ba7323e83fb54b980007483027db955ae6a34904754b8b1b5e7d764d921546251b85096203ca5116c1b05596 languageName: node linkType: hard -"unbox-primitive@npm:^1.0.2": - version: 1.0.2 - resolution: "unbox-primitive@npm:1.0.2" +"unist-util-visit-parents@npm:^5.0.0, unist-util-visit-parents@npm:^5.1.1, unist-util-visit-parents@npm:^5.1.3": + version: 5.1.3 + resolution: "unist-util-visit-parents@npm:5.1.3" dependencies: - call-bind: "npm:^1.0.2" - has-bigints: "npm:^1.0.2" - has-symbols: "npm:^1.0.3" - which-boxed-primitive: "npm:^1.0.2" - checksum: 81ca2e81134167cc8f75fa79fbcc8a94379d6c61de67090986a2273850989dd3bae8440c163121b77434b68263e34787a675cbdcb34bb2f764c6b9c843a11b66 + "@types/unist": "npm:^2.0.0" + unist-util-is: "npm:^5.0.0" + checksum: f6829bfd8f2eddf63a32e2c302cd50978ef0c194b792c6fe60c2b71dfd7232415a3c5941903972543e9d34e6a8ea69dee9ccd95811f4a795495ed2ae855d28d0 languageName: node linkType: hard -"unique-filename@npm:^3.0.0": - version: 3.0.0 - resolution: "unique-filename@npm:3.0.0" +"unist-util-visit-parents@npm:^6.0.0": + version: 6.0.1 + resolution: "unist-util-visit-parents@npm:6.0.1" dependencies: - unique-slug: "npm:^4.0.0" - checksum: 6363e40b2fa758eb5ec5e21b3c7fb83e5da8dcfbd866cc0c199d5534c42f03b9ea9ab069769cc388e1d7ab93b4eeef28ef506ab5f18d910ef29617715101884f + "@types/unist": "npm:^3.0.0" + unist-util-is: "npm:^6.0.0" + checksum: 51b1a5b0aa23c97d3e03e7288f0cdf136974df2217d0999d3de573c05001ef04cccd246f51d2ebdfb9e8b0ed2704451ad90ba85ae3f3177cf9772cef67f56206 languageName: node linkType: hard -"unique-slug@npm:^4.0.0": - version: 4.0.0 - resolution: "unique-slug@npm:4.0.0" +"unist-util-visit@npm:^4.0.0, unist-util-visit@npm:^4.1.0, unist-util-visit@npm:^4.1.2": + version: 4.1.2 + resolution: "unist-util-visit@npm:4.1.2" dependencies: - imurmurhash: "npm:^0.1.4" - checksum: cb811d9d54eb5821b81b18205750be84cb015c20a4a44280794e915f5a0a70223ce39066781a354e872df3572e8155c228f43ff0cce94c7cbf4da2cc7cbdd635 + "@types/unist": "npm:^2.0.0" + unist-util-is: "npm:^5.0.0" + unist-util-visit-parents: "npm:^5.1.1" + checksum: 56a1f49a4d8e321e75b3c7821d540a45165a031dd06324bb0e8c75e7737bc8d73bdddbf0b0ca82000f9708a4c36861c6ebe88d01f7cf00e925f5d75f13a3a017 + languageName: node + linkType: hard + +"unist-util-visit@npm:^5.0.0": + version: 5.0.0 + resolution: "unist-util-visit@npm:5.0.0" + dependencies: + "@types/unist": "npm:^3.0.0" + unist-util-is: "npm:^6.0.0" + unist-util-visit-parents: "npm:^6.0.0" + checksum: 51434a1d80252c1540cce6271a90fd1a106dbe624997c09ed8879279667fb0b2d3a685e02e92bf66598dcbe6cdffa7a5f5fb363af8fdf90dda6c855449ae39a5 languageName: node linkType: hard @@ -6058,22 +9428,52 @@ __metadata: languageName: node linkType: hard -"uri-js@npm:^4.2.2": - version: 4.4.1 - resolution: "uri-js@npm:4.4.1" +"update-browserslist-db@npm:^1.0.13": + version: 1.0.13 + resolution: "update-browserslist-db@npm:1.0.13" dependencies: - punycode: "npm:^2.1.0" - checksum: 4ef57b45aa820d7ac6496e9208559986c665e49447cb072744c13b66925a362d96dd5a46c4530a6b8e203e5db5fe849369444440cb22ecfc26c679359e5dfa3c + escalade: "npm:^3.1.1" + picocolors: "npm:^1.0.0" + peerDependencies: + browserslist: ">= 4.21.0" + bin: + update-browserslist-db: cli.js + checksum: e52b8b521c78ce1e0c775f356cd16a9c22c70d25f3e01180839c407a5dc787fb05a13f67560cbaf316770d26fa99f78f1acd711b1b54a4f35d4820d4ea7136e6 languageName: node linkType: hard -"util-deprecate@npm:^1.0.1": +"util-deprecate@npm:^1.0.1, util-deprecate@npm:^1.0.2": version: 1.0.2 resolution: "util-deprecate@npm:1.0.2" checksum: 41a5bdd214df2f6c3ecf8622745e4a366c4adced864bc3c833739791aeeeb1838119af7daed4ba36428114b5c67dcda034a79c882e97e43c03e66a4dd7389942 languageName: node linkType: hard +"uvu@npm:^0.5.0": + version: 0.5.6 + resolution: "uvu@npm:0.5.6" + dependencies: + dequal: "npm:^2.0.0" + diff: "npm:^5.0.0" + kleur: "npm:^4.0.3" + sade: "npm:^1.7.3" + bin: + uvu: bin.js + checksum: ad32eb5f7d94bdeb71f80d073003f0138e24f61ed68cecc8e15d2f30838f44c9670577bb1775c8fac894bf93d1bc1583d470a9195e49bfa6efa14cc6f4942bff + languageName: node + linkType: hard + +"v8-to-istanbul@npm:^9.2.0": + version: 9.2.0 + resolution: "v8-to-istanbul@npm:9.2.0" + dependencies: + "@jridgewell/trace-mapping": "npm:^0.3.12" + "@types/istanbul-lib-coverage": "npm:^2.0.1" + convert-source-map: "npm:^2.0.0" + checksum: e691ba4dd0dea4a884e52c37dbda30cce6f9eeafe9b26721e449429c6bb0f4b6d1e33fabe7711d0f67f7a34c3bfd56c873f7375bba0b1534e6a2843ce99550e5 + languageName: node + linkType: hard + "validate-npm-package-license@npm:^3.0.1": version: 3.0.4 resolution: "validate-npm-package-license@npm:3.0.4" @@ -6084,32 +9484,94 @@ __metadata: languageName: node linkType: hard -"vite-node@npm:0.34.6": - version: 0.34.6 - resolution: "vite-node@npm:0.34.6" +"vfile-location@npm:^4.0.0": + version: 4.1.0 + resolution: "vfile-location@npm:4.1.0" + dependencies: + "@types/unist": "npm:^2.0.0" + vfile: "npm:^5.0.0" + checksum: 77097e819579214d3346aaa2b06e4d23e2413221ac4914679d312cf64973011b76f0e2424fa8f18987befcd6ed60f4f6c4c6ebd5d5326062173a95f6b4445a96 + languageName: node + linkType: hard + +"vfile-location@npm:^5.0.0": + version: 5.0.2 + resolution: "vfile-location@npm:5.0.2" + dependencies: + "@types/unist": "npm:^3.0.0" + vfile: "npm:^6.0.0" + checksum: cfc7e49de93ac5be6f3c9a9fe77676756e00d33a6c69d9c1ce279b06eedafa67fe5d0da2334b40e97963c43b014501bca2f829dfd6622a3290fb6f7dd2b9339e + languageName: node + linkType: hard + +"vfile-message@npm:^3.0.0": + version: 3.1.4 + resolution: "vfile-message@npm:3.1.4" + dependencies: + "@types/unist": "npm:^2.0.0" + unist-util-stringify-position: "npm:^3.0.0" + checksum: c4ccf9c0ced92d657846fd067fefcf91c5832cdbe2ecc431bb67886e8c959bf7fc05a9dbbca5551bc34c9c87a0a73854b4249f65c64ddfebc4d59ea24a18b996 + languageName: node + linkType: hard + +"vfile-message@npm:^4.0.0": + version: 4.0.2 + resolution: "vfile-message@npm:4.0.2" + dependencies: + "@types/unist": "npm:^3.0.0" + unist-util-stringify-position: "npm:^4.0.0" + checksum: 07671d239a075f888b78f318bc1d54de02799db4e9dce322474e67c35d75ac4a5ac0aaf37b18801d91c9f8152974ea39678aa72d7198758b07f3ba04fb7d7514 + languageName: node + linkType: hard + +"vfile@npm:^5.0.0, vfile@npm:^5.3.7": + version: 5.3.7 + resolution: "vfile@npm:5.3.7" + dependencies: + "@types/unist": "npm:^2.0.0" + is-buffer: "npm:^2.0.0" + unist-util-stringify-position: "npm:^3.0.0" + vfile-message: "npm:^3.0.0" + checksum: c36bd4c3f16ec0c6cbad0711ca99200316bbf849d6b07aa4cb5d9062cc18ae89249fe62af9521926e9659c0e6bc5c2c1da0fe26b41fb71e757438297e1a41da4 + languageName: node + linkType: hard + +"vfile@npm:^6.0.0": + version: 6.0.1 + resolution: "vfile@npm:6.0.1" + dependencies: + "@types/unist": "npm:^3.0.0" + unist-util-stringify-position: "npm:^4.0.0" + vfile-message: "npm:^4.0.0" + checksum: 443bda43e5ad3b73c5976e987dba2b2d761439867ba7d5d7c5f4b01d3c1cb1b976f5f0e6b2399a00dc9b4eaec611bd9984ce9ce8a75a72e60aed518b10a902d2 + languageName: node + linkType: hard + +"vite-node@npm:1.0.4": + version: 1.0.4 + resolution: "vite-node@npm:1.0.4" dependencies: cac: "npm:^6.7.14" debug: "npm:^4.3.4" - mlly: "npm:^1.4.0" pathe: "npm:^1.1.1" picocolors: "npm:^1.0.0" - vite: "npm:^3.0.0 || ^4.0.0 || ^5.0.0-0" + vite: "npm:^5.0.0" bin: vite-node: vite-node.mjs - checksum: 0e804eab1ae5f0d98014f0a933ec08bfc287228283c3c4792f5f8b8fec6657896e513498e8436449e3116839a5592f9b497cf0b982b8da1152d7d419ccc306f1 + checksum: 3be4f8045a2c39afb57fdf83450791f872b10f883728eb58495640eed8d370f062a8bf25622afd005be8b375a1b4ac5731ca4fa0ae7c962742acf8f904f7748a languageName: node linkType: hard -"vite@npm:^3.0.0 || ^4.0.0 || ^5.0.0-0": - version: 5.0.0-beta.2 - resolution: "vite@npm:5.0.0-beta.2" +"vite@npm:^4.4.9": + version: 4.5.0 + resolution: "vite@npm:4.5.0" dependencies: esbuild: "npm:^0.18.10" fsevents: "npm:~2.3.2" postcss: "npm:^8.4.27" - rollup: "npm:^3.28.0" + rollup: "npm:^3.27.1" peerDependencies: - "@types/node": ^18.0.0 || >=20.0.0 + "@types/node": ">= 14" less: "*" lightningcss: ^1.21.0 sass: "*" @@ -6136,18 +9598,18 @@ __metadata: optional: true bin: vite: bin/vite.js - checksum: 966d67b96834d693312e87abaaeac52afff38e4810b7ebb53053c431998d27fbc6bb014851dae548bf58bffe329f7d38a0b3f5df366ed31064e72d52bbef62d7 + checksum: 7e21e9e4b80656ae5ee61e8c5edb5e8f589139c2b22c43e89d054c65a0194f1c1ef066fbc770204173c7eb244c798265042f988adda5880ad74337a053b28b7f languageName: node linkType: hard -"vite@npm:^3.1.0 || ^4.0.0 || ^5.0.0-0": - version: 5.0.0-beta.1 - resolution: "vite@npm:5.0.0-beta.1" +"vite@npm:^5.0.0": + version: 5.0.7 + resolution: "vite@npm:5.0.7" dependencies: - esbuild: "npm:^0.18.10" - fsevents: "npm:~2.3.2" - postcss: "npm:^8.4.27" - rollup: "npm:^3.28.0" + esbuild: "npm:^0.19.3" + fsevents: "npm:~2.3.3" + postcss: "npm:^8.4.32" + rollup: "npm:^4.2.0" peerDependencies: "@types/node": ^18.0.0 || >=20.0.0 less: "*" @@ -6176,50 +9638,59 @@ __metadata: optional: true bin: vite: bin/vite.js - checksum: 874e05072aee343d129eabb6161a44367f07416f63fe3e22a09b83913dd4d73f64b271ead9cff337841a20753ee3a7f3315e878518a6657cc024d5822c624f08 + checksum: ae3a54bcb7933bc1420c54f7d72dfa88b80e53557e7de19dee018d5e8e2545d967bcbd6af48fa96dd132229f25334ff61df42621c034fe8275d9076dadb3ad7f languageName: node linkType: hard -"vitest@npm:^0.34.6": - version: 0.34.6 - resolution: "vitest@npm:0.34.6" - dependencies: - "@types/chai": "npm:^4.3.5" - "@types/chai-subset": "npm:^1.3.3" - "@types/node": "npm:*" - "@vitest/expect": "npm:0.34.6" - "@vitest/runner": "npm:0.34.6" - "@vitest/snapshot": "npm:0.34.6" - "@vitest/spy": "npm:0.34.6" - "@vitest/utils": "npm:0.34.6" - acorn: "npm:^8.9.0" - acorn-walk: "npm:^8.2.0" +"vitefu@npm:^0.2.4": + version: 0.2.5 + resolution: "vitefu@npm:0.2.5" + peerDependencies: + vite: ^3.0.0 || ^4.0.0 || ^5.0.0 + peerDependenciesMeta: + vite: + optional: true + checksum: 5781ece3025b6be0eb87ee7d97760a7721b1c6c5ad60ede5f37c86393ece3c8fce4245472f62368eb192448034086e25bdcadf098eefc271277176ab9a430204 + languageName: node + linkType: hard + +"vitest@npm:^1.0.0": + version: 1.0.4 + resolution: "vitest@npm:1.0.4" + dependencies: + "@vitest/expect": "npm:1.0.4" + "@vitest/runner": "npm:1.0.4" + "@vitest/snapshot": "npm:1.0.4" + "@vitest/spy": "npm:1.0.4" + "@vitest/utils": "npm:1.0.4" + acorn-walk: "npm:^8.3.0" cac: "npm:^6.7.14" chai: "npm:^4.3.10" debug: "npm:^4.3.4" - local-pkg: "npm:^0.4.3" - magic-string: "npm:^0.30.1" + execa: "npm:^8.0.1" + local-pkg: "npm:^0.5.0" + magic-string: "npm:^0.30.5" pathe: "npm:^1.1.1" picocolors: "npm:^1.0.0" - std-env: "npm:^3.3.3" - strip-literal: "npm:^1.0.1" - tinybench: "npm:^2.5.0" - tinypool: "npm:^0.7.0" - vite: "npm:^3.1.0 || ^4.0.0 || ^5.0.0-0" - vite-node: "npm:0.34.6" + std-env: "npm:^3.5.0" + strip-literal: "npm:^1.3.0" + tinybench: "npm:^2.5.1" + tinypool: "npm:^0.8.1" + vite: "npm:^5.0.0" + vite-node: "npm:1.0.4" why-is-node-running: "npm:^2.2.2" peerDependencies: "@edge-runtime/vm": "*" - "@vitest/browser": "*" - "@vitest/ui": "*" + "@types/node": ^18.0.0 || >=20.0.0 + "@vitest/browser": ^1.0.0 + "@vitest/ui": ^1.0.0 happy-dom: "*" jsdom: "*" - playwright: "*" - safaridriver: "*" - webdriverio: "*" peerDependenciesMeta: "@edge-runtime/vm": optional: true + "@types/node": + optional: true "@vitest/browser": optional: true "@vitest/ui": @@ -6228,15 +9699,202 @@ __metadata: optional: true jsdom: optional: true - playwright: + bin: + vitest: vitest.mjs + checksum: 401cd3f7bc716269ed2e4d6304b3377a3957370f9ca1565d0fb328b3eb0017ba627e0357ccf7bf29126750ef312cc9e5319af8b5cfa87c3f746732480bebb813 + languageName: node + linkType: hard + +"volar-service-css@npm:0.0.16": + version: 0.0.16 + resolution: "volar-service-css@npm:0.0.16" + dependencies: + vscode-css-languageservice: "npm:^6.2.10" + vscode-uri: "npm:^3.0.8" + peerDependencies: + "@volar/language-service": ~1.10.0 + peerDependenciesMeta: + "@volar/language-service": + optional: true + checksum: dd3862e89e5930264ae542b8665fdd2e8dc917a49df6070bf31c0b217f20e1714f76c306450f5ee7f2abc999d5990f9ce5252d4bf338e9728492b36606bce345 + languageName: node + linkType: hard + +"volar-service-emmet@npm:0.0.16": + version: 0.0.16 + resolution: "volar-service-emmet@npm:0.0.16" + dependencies: + "@vscode/emmet-helper": "npm:^2.9.2" + volar-service-html: "npm:0.0.16" + peerDependencies: + "@volar/language-service": ~1.10.0 + peerDependenciesMeta: + "@volar/language-service": + optional: true + checksum: d03d246229ce43287a822404aa067f4e67e00f4acb68bf95b4b5cf320bd34387541adffe27894f98f0ef0e6ab7c98b9a4abf2ad34c65ad83431e66c3cc2326ae + languageName: node + linkType: hard + +"volar-service-html@npm:0.0.16": + version: 0.0.16 + resolution: "volar-service-html@npm:0.0.16" + dependencies: + vscode-html-languageservice: "npm:^5.1.0" + vscode-uri: "npm:^3.0.8" + peerDependencies: + "@volar/language-service": ~1.10.0 + peerDependenciesMeta: + "@volar/language-service": + optional: true + checksum: 64ea9637871f115f0960768cf8eafb21a8db114a515657a4bb89cd81af5276c1c77373dc4fc16cbc2925fc0ca3ca4ae638c53031aa903c61dbfcc14d6e295fd4 + languageName: node + linkType: hard + +"volar-service-prettier@npm:0.0.16": + version: 0.0.16 + resolution: "volar-service-prettier@npm:0.0.16" + peerDependencies: + "@volar/language-service": ~1.10.0 + prettier: ^2.2 || ^3.0 + peerDependenciesMeta: + "@volar/language-service": + optional: true + prettier: optional: true - safaridriver: + checksum: 952c592369e30409141589e9a8dff8af3ca8eb7e22284d3585950a248bb87db9ca1770f7378ca73a4061df0818aeb540217ff8df22ffdf72191c25cad6facffd + languageName: node + linkType: hard + +"volar-service-typescript-twoslash-queries@npm:0.0.16": + version: 0.0.16 + resolution: "volar-service-typescript-twoslash-queries@npm:0.0.16" + peerDependencies: + "@volar/language-service": ~1.10.0 + peerDependenciesMeta: + "@volar/language-service": optional: true - webdriverio: + checksum: d1bc56749735dac924ef072398ac3baf94858f1602df78a5636cd9837bd48b6a5fe5c607f0bab1721f7bff53d481601949525c367d6be5e6dac6e10de4a0f984 + languageName: node + linkType: hard + +"volar-service-typescript@npm:0.0.16": + version: 0.0.16 + resolution: "volar-service-typescript@npm:0.0.16" + dependencies: + path-browserify: "npm:^1.0.1" + semver: "npm:^7.5.4" + typescript-auto-import-cache: "npm:^0.3.0" + vscode-languageserver-textdocument: "npm:^1.0.11" + vscode-nls: "npm:^5.2.0" + vscode-uri: "npm:^3.0.8" + peerDependencies: + "@volar/language-service": ~1.10.0 + "@volar/typescript": ~1.10.0 + peerDependenciesMeta: + "@volar/language-service": optional: true + checksum: c47c70aa0065e5075103a56631a0e34255bc73dbab141feeee89d8e07e117707e53d050350594fa9ce117dd8d9a8b52bf84026c5fc2a602e34f79667fc891d17 + languageName: node + linkType: hard + +"vscode-css-languageservice@npm:^6.2.10": + version: 6.2.11 + resolution: "vscode-css-languageservice@npm:6.2.11" + dependencies: + "@vscode/l10n": "npm:^0.0.16" + vscode-languageserver-textdocument: "npm:^1.0.11" + vscode-languageserver-types: "npm:3.17.5" + vscode-uri: "npm:^3.0.8" + checksum: 50f01722e47c74b923a63ce6ab491ab519bce8f48a30071464bb50fda51d225b414b864ac8d532ed23eeb32294403fe0e3e2ab33288c2a079f4c63a01e1a8b84 + languageName: node + linkType: hard + +"vscode-html-languageservice@npm:^5.1.0": + version: 5.1.1 + resolution: "vscode-html-languageservice@npm:5.1.1" + dependencies: + "@vscode/l10n": "npm:^0.0.16" + vscode-languageserver-textdocument: "npm:^1.0.11" + vscode-languageserver-types: "npm:^3.17.5" + vscode-uri: "npm:^3.0.8" + checksum: 19fdc50088c0e944534019b8fe2b61aa19a7fcfe1ec4a0e0dc047d52a634ca27c5fe97e7fda39b48f42f72c58d809a13db23f788fbbf0776d8202ab9d43a54f0 + languageName: node + linkType: hard + +"vscode-jsonrpc@npm:8.2.0": + version: 8.2.0 + resolution: "vscode-jsonrpc@npm:8.2.0" + checksum: 0789c227057a844f5ead55c84679206227a639b9fb76e881185053abc4e9848aa487245966cc2393fcb342c4541241b015a1a2559fddd20ac1e68945c95344e6 + languageName: node + linkType: hard + +"vscode-languageserver-protocol@npm:3.17.5, vscode-languageserver-protocol@npm:^3.17.5": + version: 3.17.5 + resolution: "vscode-languageserver-protocol@npm:3.17.5" + dependencies: + vscode-jsonrpc: "npm:8.2.0" + vscode-languageserver-types: "npm:3.17.5" + checksum: 5f38fd80da9868d706eaa4a025f4aff9c3faad34646bcde1426f915cbd8d7e8b6c3755ce3fef6eebd256ba3145426af1085305f8a76e34276d2e95aaf339a90b + languageName: node + linkType: hard + +"vscode-languageserver-textdocument@npm:^1.0.1, vscode-languageserver-textdocument@npm:^1.0.11": + version: 1.0.11 + resolution: "vscode-languageserver-textdocument@npm:1.0.11" + checksum: 1996a38e24571e05aa21dd4f46e0a6849e22301c9a66996762e77d9c6df3622de0bd31cd5742a0c0c47fb9dfd00b310ad08c44d08241873ea571edacd5238da6 + languageName: node + linkType: hard + +"vscode-languageserver-types@npm:3.17.5, vscode-languageserver-types@npm:^3.15.1, vscode-languageserver-types@npm:^3.17.5": + version: 3.17.5 + resolution: "vscode-languageserver-types@npm:3.17.5" + checksum: 1e1260de79a2cc8de3e46f2e0182cdc94a7eddab487db5a3bd4ee716f67728e685852707d72c059721ce500447be9a46764a04f0611e94e4321ffa088eef36f8 + languageName: node + linkType: hard + +"vscode-languageserver@npm:^9.0.1": + version: 9.0.1 + resolution: "vscode-languageserver@npm:9.0.1" + dependencies: + vscode-languageserver-protocol: "npm:3.17.5" bin: - vitest: vitest.mjs - checksum: 7b5e87875991a66fe5cca62477f21447d7cdf4d101ac381ca02a16f4223b1ae5d0bc17ce42616d6dc74742757730ed511ada05aaa7090b6075e304c883cf0bc3 + installServerIntoExtension: bin/installServerIntoExtension + checksum: 8a0838d77c98a211c76e54bd3a6249fc877e4e1a73322673fb0e921168d8e91de4f170f1d4ff7e8b6289d0698207afc6aba6662d4c1cd8e4bd7cae96afd6b0c2 + languageName: node + linkType: hard + +"vscode-nls@npm:^5.2.0": + version: 5.2.0 + resolution: "vscode-nls@npm:5.2.0" + checksum: dc9e48f58ebbc807f435d351008813a2ea0c9432d51e778bcac9163c0642f929ddb518411ad654e775ce31e24d6acfa8fb7db8893c05b42c2019894e08b050f9 + languageName: node + linkType: hard + +"vscode-oniguruma@npm:^1.7.0": + version: 1.7.0 + resolution: "vscode-oniguruma@npm:1.7.0" + checksum: bef0073c665ddf8c86e51da94529c905856559e9aba97a9882f951acd572da560384775941ab6e7e8db94d9c578b25fefb951e4b73c37e8712e16b0231de2689 + languageName: node + linkType: hard + +"vscode-textmate@npm:^8.0.0": + version: 8.0.0 + resolution: "vscode-textmate@npm:8.0.0" + checksum: 836f7fe73fc94998a38ca193df48173a2b6eab08b4943d83c8cac9a2a0c3546cfdab4cf1b10b890ec4a4374c5bee03a885ef0e83e7fd2bd618cf00781c017c04 + languageName: node + linkType: hard + +"vscode-uri@npm:^2.1.2": + version: 2.1.2 + resolution: "vscode-uri@npm:2.1.2" + checksum: 4ed01e79f8caee5518d7dce567280001a00c87ff75c29421ac3693c735834f17950e79f818981c591e58c6efe681e13928470037b6ae75c948bec9b398e4c8db + languageName: node + linkType: hard + +"vscode-uri@npm:^3.0.8": + version: 3.0.8 + resolution: "vscode-uri@npm:3.0.8" + checksum: f7f217f526bf109589969fe6e66b71e70b937de1385a1d7bb577ca3ee7c5e820d3856a86e9ff2fa9b7a0bc56a3dd8c3a9a557d3fedd7df414bc618d5e6b567f9 languageName: node linkType: hard @@ -6249,6 +9907,13 @@ __metadata: languageName: node linkType: hard +"web-namespaces@npm:^2.0.0": + version: 2.0.1 + resolution: "web-namespaces@npm:2.0.1" + checksum: df245f466ad83bd5cd80bfffc1674c7f64b7b84d1de0e4d2c0934fb0782e0a599164e7197a4bce310ee3342fd61817b8047ff04f076a1ce12dd470584142a4bd + languageName: node + linkType: hard + "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" @@ -6304,6 +9969,13 @@ __metadata: languageName: node linkType: hard +"which-pm-runs@npm:^1.1.0": + version: 1.1.0 + resolution: "which-pm-runs@npm:1.1.0" + checksum: b8f2f230aa49babe21cb93f169f5da13937f940b8cc7a47d2078d9d200950c0dba5ac5659bc01bdbe401e6db3adec6a97b6115215a4ca8e87fd714aebd0cabc6 + languageName: node + linkType: hard + "which-pm@npm:2.0.0": version: 2.0.0 resolution: "which-pm@npm:2.0.0" @@ -6314,16 +9986,13 @@ __metadata: languageName: node linkType: hard -"which-typed-array@npm:^1.1.11, which-typed-array@npm:^1.1.13": - version: 1.1.13 - resolution: "which-typed-array@npm:1.1.13" +"which-pm@npm:^2.1.1": + version: 2.1.1 + resolution: "which-pm@npm:2.1.1" dependencies: - available-typed-arrays: "npm:^1.0.5" - call-bind: "npm:^1.0.4" - for-each: "npm:^0.3.3" - gopd: "npm:^1.0.1" - has-tostringtag: "npm:^1.0.0" - checksum: 9f5f1c42918df3d5b91c4315ed0051d5d874370998bf095c9ae0df374f0881f85094e3c384b8fb08ab7b4d4f54ba81c0aff75da6226e7c0589b83dfbec1cd4c9 + load-yaml-file: "npm:^0.2.0" + path-exists: "npm:^4.0.0" + checksum: 13222d6342832ca8d8c9f6148dbea9d44829422ce1e6e0cf5abb3d43c045947cb98f8c908a8de1b7ed0e2094e315a4bdb869129a58bfb09c44f77d8f8b4df183 languageName: node linkType: hard @@ -6384,6 +10053,15 @@ __metadata: languageName: node linkType: hard +"widest-line@npm:^4.0.1": + version: 4.0.1 + resolution: "widest-line@npm:4.0.1" + dependencies: + string-width: "npm:^5.0.1" + checksum: 7da9525ba45eaf3e4ed1a20f3dcb9b85bd9443962450694dae950f4bdd752839747bbc14713522b0b93080007de8e8af677a61a8c2114aa553ad52bde72d0f9c + languageName: node + linkType: hard + "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0, wrap-ansi@npm:^7.0.0": version: 7.0.0 resolution: "wrap-ansi@npm:7.0.0" @@ -6445,6 +10123,13 @@ __metadata: languageName: node linkType: hard +"yallist@npm:^3.0.2": + version: 3.1.1 + resolution: "yallist@npm:3.1.1" + checksum: c66a5c46bc89af1625476f7f0f2ec3653c1a1791d2f9407cfb4c2ba812a1e1c9941416d71ba9719876530e3340a99925f697142989371b72d93b9ee628afd8c1 + languageName: node + linkType: hard + "yallist@npm:^4.0.0": version: 4.0.0 resolution: "yallist@npm:4.0.0" @@ -6495,7 +10180,7 @@ __metadata: languageName: node linkType: hard -"yargs@npm:^17.7.1": +"yargs@npm:^17.7.1, yargs@npm:^17.7.2": version: 17.7.2 resolution: "yargs@npm:17.7.2" dependencies: @@ -6510,28 +10195,6 @@ __metadata: languageName: node linkType: hard -"yarn-run-all@npm:latest": - version: 3.1.1 - resolution: "yarn-run-all@npm:3.1.1" - dependencies: - chalk: "npm:^1.1.3" - cross-spawn: "npm:^4.0.0" - minimatch: "npm:^3.0.2" - object-assign: "npm:^4.0.1" - pinkie-promise: "npm:^2.0.1" - ps-tree: "npm:^1.0.1" - read-pkg: "npm:^1.1.0" - read-pkg-up: "npm:^1.0.1" - shell-quote: "npm:^1.6.1" - string.prototype.padend: "npm:^3.0.0" - bin: - npm-run-all: bin/npm-run-all/index.js - run-p: bin/run-p/index.js - run-s: bin/run-s/index.js - checksum: af285b53eb560f595e585cd27a569f4965804657f5cffcdae4c7a15fcc63dab4bbb81fc01f049a1f671431fe461a9b94776f02c02f4216752cf24611a77852e9 - languageName: node - linkType: hard - "yocto-queue@npm:^0.1.0": version: 0.1.0 resolution: "yocto-queue@npm:0.1.0" @@ -6545,3 +10208,17 @@ __metadata: checksum: 856117aa15cf5103d2a2fb173f0ab4acb12b4b4d0ed3ab249fdbbf612e55d1cadfd27a6110940e24746fb0a78cf640b522cc8bca76f30a3b00b66e90cf82abe0 languageName: node linkType: hard + +"zod@npm:^3.22.4": + version: 3.22.4 + resolution: "zod@npm:3.22.4" + checksum: 7578ab283dac0eee66a0ad0fc4a7f28c43e6745aadb3a529f59a4b851aa10872b3890398b3160f257f4b6817b4ce643debdda4fb21a2c040adda7862cab0a587 + languageName: node + linkType: hard + +"zwitch@npm:^2.0.0, zwitch@npm:^2.0.4": + version: 2.0.4 + resolution: "zwitch@npm:2.0.4" + checksum: 3c7830cdd3378667e058ffdb4cf2bb78ac5711214e2725900873accb23f3dfe5f9e7e5a06dcdc5f29605da976fc45c26d9a13ca334d6eea2245a15e77b8fc06e + languageName: node + linkType: hard