├── .github └── workflows │ └── test.yml ├── .gitignore ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── assets └── logo.png ├── benchs ├── complex.mjs ├── memoryUsage.mjs └── propagate.mjs ├── build.js ├── package.json ├── pnpm-lock.yaml ├── src ├── index.ts └── system.ts ├── tests ├── build.spec.ts ├── computed.spec.ts ├── effect.spec.ts ├── effectScope.spec.ts ├── issue_48.spec.ts ├── topology.spec.ts └── untrack.spec.ts ├── tsconfig.json └── tsslint.config.ts /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: testing 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | runs-on: ${{ matrix.os }} 8 | 9 | strategy: 10 | matrix: 11 | node-version: [22] 12 | os: [macos-latest] 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | 17 | - uses: pnpm/action-setup@v4 18 | 19 | - name: Use Node.js ${{ matrix.node-version }} 20 | uses: actions/setup-node@v1 21 | with: 22 | node-version: ${{ matrix.node-version }} 23 | 24 | # install pnpm 25 | - run: pnpm install --frozen-lockfile 26 | - run: pnpm run build 27 | - run: pnpm run test 28 | - run: pnpm run lint 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | cjs 3 | esm 4 | types 5 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.format.semicolons": "insert", 3 | "editor.insertSpaces": false, 4 | "editor.detectIndentation": false, 5 | "json.format.keepLines": true, 6 | "typescript.tsdk": "node_modules/typescript/lib", 7 | "[typescript]": { 8 | "editor.defaultFormatter": "vscode.typescript-language-features" 9 | }, 10 | "[javascript]": { 11 | "editor.defaultFormatter": "vscode.typescript-language-features" 12 | }, 13 | "[json]": { 14 | "editor.defaultFormatter": "vscode.json-language-features" 15 | }, 16 | "[jsonc]": { 17 | "editor.defaultFormatter": "vscode.json-language-features" 18 | } 19 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024-present Johnson Chu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |
3 |

4 | 5 |

6 | npm package 7 | Ask DeepWiki 8 |

9 | 10 | # alien-signals 11 | 12 | This project explores a push-pull based signal algorithm. Its current implementation is similar to or related to certain other frontend projects: 13 | 14 | - Propagation algorithm of Vue 3 15 | - Preact’s double-linked-list approach (https://preactjs.com/blog/signal-boosting/) 16 | - Inner effects scheduling of Svelte 17 | - Graph-coloring approach of Reactively (https://milomg.dev/2022-12-01/reactivity) 18 | 19 | We impose some constraints (such as not using Array/Set/Map and disallowing function recursion) to ensure performance. We found that under these conditions, maintaining algorithmic simplicity offers more significant improvements than complex scheduling strategies. 20 | 21 | Even though Vue 3.4 is already optimized, alien-signals is still noticeably faster. (I wrote code for both, and since they share similar algorithms, they’re quite comparable.) 22 | 23 | Image 24 | 25 | > Benchmark repo: https://github.com/transitive-bullshit/js-reactivity-benchmark 26 | 27 | ## Background 28 | 29 | I spent considerable time [optimizing Vue 3.4’s reactivity system](https://github.com/vuejs/core/pull/5912), gaining experience along the way. Since Vue 3.5 [switched to a pull-based algorithm similar to Preact](https://github.com/vuejs/core/pull/10397), I decided to continue researching a push-pull based implementation in a separate project. Our end goal is to implement fully incremental AST parsing and virtual code generation in Vue language tools, based on alien-signals. 30 | 31 | ## Other Language Implementations 32 | 33 | - **Dart:** [medz/alien-signals-dart](https://github.com/medz/alien-signals-dart) 2.0.5 34 | - **Lua:** [YanqingXu/alien-signals-in-lua](https://github.com/YanqingXu/alien-signals-in-lua) 2.0.5 35 | - **Luau:** [Nicell/alien-signals-luau](https://github.com/Nicell/alien-signals-luau) 1.0.13 36 | - **Java:** [CTRL-Neo-Studios/java-alien-signals](https://github.com/CTRL-Neo-Studios/java-alien-signals) 1.0.13 37 | - **C#:** [CTRL-Neo-Studios/csharp-alien-signals](https://github.com/CTRL-Neo-Studios/csharp-alien-signals) 1.0.13 38 | - **Go:** [delaneyj/alien-signals-go](https://github.com/delaneyj/alien-signals-go) 1.0.7 39 | 40 | ## Derived Projects 41 | 42 | - [Rajaniraiyn/react-alien-signals](https://github.com/Rajaniraiyn/react-alien-signals): React bindings for the alien-signals API 43 | - [CCherry07/alien-deepsignals](https://github.com/CCherry07/alien-deepsignals): Use alien-signals with the interface of a plain JavaScript object 44 | - [hunghg255/reactjs-signal](https://github.com/hunghg255/reactjs-signal): Share Store State with Signal Pattern 45 | - [gn8-ai/universe-alien-signals](https://github.com/gn8-ai/universe-alien-signals): Enables simple use of the Alien Signals state management system in modern frontend frameworks 46 | - [WebReflection/alien-signals](https://github.com/WebReflection/alien-signals): Preact signals like API and a class based approach for easy brand check 47 | - [@lift-html/alien](https://github.com/JLarky/lift-html/tree/main/packages/alien): Integrating alien-signals into lift-html 48 | 49 | ## Adoption 50 | 51 | - [vuejs/core](https://github.com/vuejs/core): The core algorithm has been ported to v3.6 (PR: https://github.com/vuejs/core/pull/12349) 52 | - [statelyai/xstate](https://github.com/statelyai/xstate): The core algorithm has been ported to implement the atom architecture (PR: https://github.com/statelyai/xstate/pull/5250) 53 | - [flamrdevs/xignal](https://github.com/flamrdevs/xignal): Infrastructure for the reactive system 54 | - [vuejs/language-tools](https://github.com/vuejs/language-tools): Used in the language-core package for virtual code generation 55 | 56 | ## Usage 57 | 58 | #### Basic APIs 59 | 60 | ```ts 61 | import { signal, computed, effect } from 'alien-signals'; 62 | 63 | const count = signal(1); 64 | const doubleCount = computed(() => count() * 2); 65 | 66 | effect(() => { 67 | console.log(`Count is: ${count()}`); 68 | }); // Console: Count is: 1 69 | 70 | console.log(doubleCount()); // 2 71 | 72 | count(2); // Console: Count is: 2 73 | 74 | console.log(doubleCount()); // 4 75 | ``` 76 | 77 | #### Effect Scope 78 | 79 | ```ts 80 | import { signal, effect, effectScope } from 'alien-signals'; 81 | 82 | const count = signal(1); 83 | 84 | const stopScope = effectScope(() => { 85 | effect(() => { 86 | console.log(`Count in scope: ${count()}`); 87 | }); // Console: Count in scope: 1 88 | }); 89 | 90 | count(2); // Console: Count in scope: 2 91 | 92 | stopScope(); 93 | 94 | count(3); // No console output 95 | ``` 96 | 97 | #### Creating Your Own Surface API 98 | 99 | You can reuse alien-signals’ core algorithm via `createReactiveSystem()` to build your own signal API. For implementation examples, see: 100 | 101 | - [Starter template](https://github.com/johnsoncodehk/alien-signals-starter) (implements `.get()` & `.set()` methods like the [Signals proposal](https://github.com/tc39/proposal-signals)) 102 | - [stackblitz/alien-signals/src/index.ts](https://github.com/stackblitz/alien-signals/blob/master/src/index.ts) 103 | - [proposal-signals/signal-polyfill#44](https://github.com/proposal-signals/signal-polyfill/pull/44) 104 | 105 | 106 | ## About `propagate` and `checkDirty` functions 107 | 108 | In order to eliminate recursive calls and improve performance, we record the last link node of the previous loop in `propagate` and `checkDirty` functions, and implement the rollback logic to return to this node. 109 | 110 | This results in code that is difficult to understand, and you don't necessarily get the same performance improvements in other languages, so we record the original implementation without eliminating recursive calls here for reference. 111 | 112 | #### `propagate` 113 | 114 | ```ts 115 | function propagate(link: Link): void { 116 | do { 117 | const sub = link.sub; 118 | 119 | let flags = sub.flags; 120 | 121 | if (flags & (ReactiveFlags.Mutable | ReactiveFlags.Watching)) { 122 | if (!(flags & (ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed | ReactiveFlags.Dirty | ReactiveFlags.Pending))) { 123 | sub.flags = flags | ReactiveFlags.Pending; 124 | } else if (!(flags & (ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed))) { 125 | flags = ReactiveFlags.None; 126 | } else if (!(flags & ReactiveFlags.RecursedCheck)) { 127 | sub.flags = (flags & ~ReactiveFlags.Recursed) | ReactiveFlags.Pending; 128 | } else if (!(flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && isValidLink(link, sub)) { 129 | sub.flags = flags | ReactiveFlags.Recursed | ReactiveFlags.Pending; 130 | flags &= ReactiveFlags.Mutable; 131 | } else { 132 | flags = ReactiveFlags.None; 133 | } 134 | 135 | if (flags & ReactiveFlags.Watching) { 136 | notify(sub); 137 | } 138 | 139 | if (flags & ReactiveFlags.Mutable) { 140 | const subSubs = sub.subs; 141 | if (subSubs !== undefined) { 142 | propagate(subSubs); 143 | } 144 | } 145 | } 146 | 147 | link = link.nextSub!; 148 | } while (link !== undefined); 149 | } 150 | ``` 151 | 152 | #### `checkDirty` 153 | 154 | ```ts 155 | function checkDirty(link: Link, sub: ReactiveNode): boolean { 156 | do { 157 | const dep = link.dep; 158 | const depFlags = dep.flags; 159 | 160 | if (sub.flags & ReactiveFlags.Dirty) { 161 | return true; 162 | } else if ((depFlags & (ReactiveFlags.Mutable | ReactiveFlags.Dirty)) === (ReactiveFlags.Mutable | ReactiveFlags.Dirty)) { 163 | if (update(dep)) { 164 | const subs = dep.subs!; 165 | if (subs.nextSub !== undefined) { 166 | shallowPropagate(subs); 167 | } 168 | return true; 169 | } 170 | } else if ((depFlags & (ReactiveFlags.Mutable | ReactiveFlags.Pending)) === (ReactiveFlags.Mutable | ReactiveFlags.Pending)) { 171 | if (checkDirty(dep.deps!, dep)) { 172 | if (update(dep)) { 173 | const subs = dep.subs!; 174 | if (subs.nextSub !== undefined) { 175 | shallowPropagate(subs); 176 | } 177 | return true; 178 | } 179 | } else { 180 | dep.flags = depFlags & ~ReactiveFlags.Pending; 181 | } 182 | } 183 | 184 | link = link.nextDep!; 185 | } while (link !== undefined); 186 | 187 | return false; 188 | } 189 | ``` 190 | -------------------------------------------------------------------------------- /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stackblitz/alien-signals/ead264f2a05d11fef8ce6f728f47198730232801/assets/logo.png -------------------------------------------------------------------------------- /benchs/complex.mjs: -------------------------------------------------------------------------------- 1 | import { run, bench, boxplot } from 'mitata'; 2 | import { computed, effect, signal } from '../esm/index.mjs'; 3 | 4 | boxplot(() => { 5 | bench('complex: $w * $h', function* (state) { 6 | const w = state.get('w'); 7 | const h = state.get('h'); 8 | const src = signal({ w, h }); 9 | for (let i = 0; i < w; i++) { 10 | let last = src; 11 | for (let j = 0; j < h; j++) { 12 | const prev = last; 13 | last = computed(() => ({ [`${i}-${j}`]: prev() })); 14 | } 15 | effect(() => last()); 16 | } 17 | 18 | yield () => src({ upstream: src() }); 19 | }) 20 | .args('h', [1, 10, 100]) 21 | .args('w', [1, 10, 100]); 22 | }); 23 | 24 | run({ format: 'markdown' }); 25 | -------------------------------------------------------------------------------- /benchs/memoryUsage.mjs: -------------------------------------------------------------------------------- 1 | import { computed, effect, signal } from '../esm/index.mjs'; 2 | 3 | globalThis.gc(); 4 | let start = process.memoryUsage().heapUsed; 5 | 6 | const signals = Array.from({ length: 10000 }, () => signal(0)); 7 | 8 | globalThis.gc(); 9 | let end = process.memoryUsage().heapUsed; 10 | 11 | console.log(`signal: ${((end - start) / 1024).toFixed(2)} KB`); 12 | 13 | start = end; 14 | 15 | const computeds = Array.from({ length: 10000 }, (_, i) => computed(() => signals[i]() + 1)); 16 | 17 | globalThis.gc(); 18 | end = process.memoryUsage().heapUsed; 19 | 20 | console.log(`computed: ${((end - start) / 1024).toFixed(2)} KB`); 21 | 22 | start = end; 23 | 24 | Array.from({ length: 10000 }, (_, i) => effect(() => computeds[i]())); 25 | 26 | globalThis.gc(); 27 | end = process.memoryUsage().heapUsed; 28 | 29 | console.log(`effect: ${((end - start) / 1024).toFixed(2)} KB`); 30 | 31 | start = end; 32 | 33 | const w = 100; 34 | const h = 100; 35 | const src = signal(1); 36 | 37 | for (let i = 0; i < w; i++) { 38 | let last = src; 39 | for (let j = 0; j < h; j++) { 40 | const prev = last; 41 | last = computed(() => prev() + 1); 42 | effect(() => last()); 43 | } 44 | } 45 | 46 | src(src() + 1); 47 | 48 | globalThis.gc(); 49 | end = process.memoryUsage().heapUsed; 50 | 51 | console.log(`tree: ${((end - start) / 1024).toFixed(2)} KB`); 52 | -------------------------------------------------------------------------------- /benchs/propagate.mjs: -------------------------------------------------------------------------------- 1 | import { bench, boxplot, run } from 'mitata'; 2 | import { computed, effect, signal } from '../esm/index.mjs'; 3 | 4 | boxplot(() => { 5 | bench('propagate: $w * $h', function* (state) { 6 | const w = state.get('w'); 7 | const h = state.get('h'); 8 | const src = signal(1); 9 | for (let i = 0; i < w; i++) { 10 | let last = src; 11 | for (let j = 0; j < h; j++) { 12 | const prev = last; 13 | last = computed(() => prev() + 1); 14 | } 15 | effect(() => last()); 16 | } 17 | yield () => src(src() + 1); 18 | }) 19 | .args('h', [1, 10, 100]) 20 | .args('w', [1, 10, 100]); 21 | }); 22 | 23 | run({ format: 'markdown' }); 24 | -------------------------------------------------------------------------------- /build.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | const path = require('path'); 3 | const ts = require('typescript'); 4 | const config = ts.getParsedCommandLineOfConfigFile( 5 | path.join(__dirname, 'tsconfig.json'), 6 | undefined, 7 | { 8 | ...ts.sys, 9 | onUnRecoverableConfigFileDiagnostic: () => { }, 10 | } 11 | ); 12 | 13 | if (config === undefined) { 14 | console.error('Failed to parse tsconfig.json'); 15 | process.exit(1); 16 | } 17 | 18 | const typesProgram = ts.createProgram({ 19 | rootNames: config.fileNames, 20 | options: { 21 | ...config.options, 22 | outDir: 'types', 23 | declaration: true, 24 | emitDeclarationOnly: true, 25 | }, 26 | configFileParsingDiagnostics: config.errors, 27 | }); 28 | const cjsProgram = ts.createProgram({ 29 | rootNames: config.fileNames, 30 | options: { 31 | ...config.options, 32 | outDir: 'cjs', 33 | removeComments: true, 34 | module: ts.ModuleKind.CommonJS, 35 | }, 36 | configFileParsingDiagnostics: config.errors, 37 | }); 38 | const esmProgram = ts.createProgram({ 39 | rootNames: config.fileNames, 40 | options: { 41 | ...config.options, 42 | outDir: 'esm', 43 | removeComments: true, 44 | module: ts.ModuleKind.ESNext, 45 | }, 46 | configFileParsingDiagnostics: config.errors, 47 | }); 48 | 49 | typesProgram.emit(undefined, ts.sys.writeFile); 50 | cjsProgram.emit(undefined, (fileName, text) => { 51 | fileName = fileName.slice(0, -'.js'.length) + '.cjs'; 52 | text = text.replace(/\.\/system\.js/g, './system.cjs'); 53 | ts.sys.writeFile(fileName, text); 54 | }); 55 | esmProgram.emit(undefined, (fileName, text) => { 56 | fileName = fileName.slice(0, -'.js'.length) + '.mjs'; 57 | text = text.replace(/\.\/system\.js/g, './system.mjs'); 58 | ts.sys.writeFile(fileName, text); 59 | }); 60 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "alien-signals", 3 | "version": "2.0.5", 4 | "license": "MIT", 5 | "description": "The lightest signal library.", 6 | "packageManager": "pnpm@9.12.0", 7 | "types": "./types/index.d.ts", 8 | "exports": { 9 | ".": { 10 | "types": "./types/index.d.ts", 11 | "import": "./esm/index.mjs", 12 | "require": "./cjs/index.cjs" 13 | }, 14 | "./cjs": { 15 | "types": "./types/index.d.ts", 16 | "import": "./cjs/index.cjs", 17 | "require": "./cjs/index.cjs" 18 | }, 19 | "./esm": { 20 | "types": "./types/index.d.ts", 21 | "import": "./esm/index.mjs", 22 | "require": "./esm/index.mjs" 23 | }, 24 | "./system": { 25 | "types": "./types/system.d.ts", 26 | "import": "./esm/system.mjs", 27 | "require": "./cjs/system.cjs" 28 | }, 29 | "./cjs/system": { 30 | "types": "./types/system.d.ts", 31 | "import": "./cjs/system.cjs", 32 | "require": "./cjs/system.cjs" 33 | }, 34 | "./esm/system": { 35 | "types": "./types/system.d.ts", 36 | "import": "./esm/system.mjs", 37 | "require": "./esm/system.mjs" 38 | } 39 | }, 40 | "files": [ 41 | "cjs/*.cjs", 42 | "esm/*.mjs", 43 | "types/*.d.ts" 44 | ], 45 | "repository": { 46 | "type": "git", 47 | "url": "git+https://github.com/johnsoncodehk/signals.git" 48 | }, 49 | "scripts": { 50 | "prepublishOnly": "npm run check && npm run test", 51 | "check": "tsc --noEmit", 52 | "build": "node ./build.js", 53 | "test": "npm run build && vitest run", 54 | "lint": "tsslint --project tsconfig.json", 55 | "bench": "npm run build && node --jitless --expose-gc benchs/propagate.mjs", 56 | "memory": "npm run build && node --expose-gc benchs/memoryUsage.mjs" 57 | }, 58 | "devDependencies": { 59 | "@tsslint/cli": "latest", 60 | "@tsslint/config": "latest", 61 | "mitata": "latest", 62 | "typescript": "latest", 63 | "vitest": "latest", 64 | "jest-extended": "latest" 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: '9.0' 2 | 3 | settings: 4 | autoInstallPeers: true 5 | excludeLinksFromLockfile: false 6 | 7 | importers: 8 | 9 | .: 10 | devDependencies: 11 | '@tsslint/cli': 12 | specifier: latest 13 | version: 1.5.11(typescript@5.8.2) 14 | '@tsslint/config': 15 | specifier: latest 16 | version: 1.5.11(typescript@5.8.2) 17 | jest-extended: 18 | specifier: latest 19 | version: 4.0.2 20 | mitata: 21 | specifier: latest 22 | version: 1.0.34 23 | typescript: 24 | specifier: latest 25 | version: 5.8.2 26 | vitest: 27 | specifier: latest 28 | version: 3.0.9 29 | 30 | packages: 31 | 32 | '@clack/core@0.3.5': 33 | resolution: {integrity: sha512-5cfhQNH+1VQ2xLQlmzXMqUoiaH0lRBq9/CLW9lTyMbuKLC3+xEK01tHVvyut++mLOn5urSHmkm6I0Lg9MaJSTQ==} 34 | 35 | '@clack/prompts@0.8.2': 36 | resolution: {integrity: sha512-6b9Ab2UiZwJYA9iMyboYyW9yJvAO9V753ZhS+DHKEjZRKAxPPOb7MXXu84lsPFG+vZt6FRFniZ8rXi+zCIw4yQ==} 37 | 38 | '@esbuild/aix-ppc64@0.25.1': 39 | resolution: {integrity: sha512-kfYGy8IdzTGy+z0vFGvExZtxkFlA4zAxgKEahG9KE1ScBjpQnFsNOX8KTU5ojNru5ed5CVoJYXFtoxaq5nFbjQ==} 40 | engines: {node: '>=18'} 41 | cpu: [ppc64] 42 | os: [aix] 43 | 44 | '@esbuild/android-arm64@0.25.1': 45 | resolution: {integrity: sha512-50tM0zCJW5kGqgG7fQ7IHvQOcAn9TKiVRuQ/lN0xR+T2lzEFvAi1ZcS8DiksFcEpf1t/GYOeOfCAgDHFpkiSmA==} 46 | engines: {node: '>=18'} 47 | cpu: [arm64] 48 | os: [android] 49 | 50 | '@esbuild/android-arm@0.25.1': 51 | resolution: {integrity: sha512-dp+MshLYux6j/JjdqVLnMglQlFu+MuVeNrmT5nk6q07wNhCdSnB7QZj+7G8VMUGh1q+vj2Bq8kRsuyA00I/k+Q==} 52 | engines: {node: '>=18'} 53 | cpu: [arm] 54 | os: [android] 55 | 56 | '@esbuild/android-x64@0.25.1': 57 | resolution: {integrity: sha512-GCj6WfUtNldqUzYkN/ITtlhwQqGWu9S45vUXs7EIYf+7rCiiqH9bCloatO9VhxsL0Pji+PF4Lz2XXCES+Q8hDw==} 58 | engines: {node: '>=18'} 59 | cpu: [x64] 60 | os: [android] 61 | 62 | '@esbuild/darwin-arm64@0.25.1': 63 | resolution: {integrity: sha512-5hEZKPf+nQjYoSr/elb62U19/l1mZDdqidGfmFutVUjjUZrOazAtwK+Kr+3y0C/oeJfLlxo9fXb1w7L+P7E4FQ==} 64 | engines: {node: '>=18'} 65 | cpu: [arm64] 66 | os: [darwin] 67 | 68 | '@esbuild/darwin-x64@0.25.1': 69 | resolution: {integrity: sha512-hxVnwL2Dqs3fM1IWq8Iezh0cX7ZGdVhbTfnOy5uURtao5OIVCEyj9xIzemDi7sRvKsuSdtCAhMKarxqtlyVyfA==} 70 | engines: {node: '>=18'} 71 | cpu: [x64] 72 | os: [darwin] 73 | 74 | '@esbuild/freebsd-arm64@0.25.1': 75 | resolution: {integrity: sha512-1MrCZs0fZa2g8E+FUo2ipw6jw5qqQiH+tERoS5fAfKnRx6NXH31tXBKI3VpmLijLH6yriMZsxJtaXUyFt/8Y4A==} 76 | engines: {node: '>=18'} 77 | cpu: [arm64] 78 | os: [freebsd] 79 | 80 | '@esbuild/freebsd-x64@0.25.1': 81 | resolution: {integrity: sha512-0IZWLiTyz7nm0xuIs0q1Y3QWJC52R8aSXxe40VUxm6BB1RNmkODtW6LHvWRrGiICulcX7ZvyH6h5fqdLu4gkww==} 82 | engines: {node: '>=18'} 83 | cpu: [x64] 84 | os: [freebsd] 85 | 86 | '@esbuild/linux-arm64@0.25.1': 87 | resolution: {integrity: sha512-jaN3dHi0/DDPelk0nLcXRm1q7DNJpjXy7yWaWvbfkPvI+7XNSc/lDOnCLN7gzsyzgu6qSAmgSvP9oXAhP973uQ==} 88 | engines: {node: '>=18'} 89 | cpu: [arm64] 90 | os: [linux] 91 | 92 | '@esbuild/linux-arm@0.25.1': 93 | resolution: {integrity: sha512-NdKOhS4u7JhDKw9G3cY6sWqFcnLITn6SqivVArbzIaf3cemShqfLGHYMx8Xlm/lBit3/5d7kXvriTUGa5YViuQ==} 94 | engines: {node: '>=18'} 95 | cpu: [arm] 96 | os: [linux] 97 | 98 | '@esbuild/linux-ia32@0.25.1': 99 | resolution: {integrity: sha512-OJykPaF4v8JidKNGz8c/q1lBO44sQNUQtq1KktJXdBLn1hPod5rE/Hko5ugKKZd+D2+o1a9MFGUEIUwO2YfgkQ==} 100 | engines: {node: '>=18'} 101 | cpu: [ia32] 102 | os: [linux] 103 | 104 | '@esbuild/linux-loong64@0.25.1': 105 | resolution: {integrity: sha512-nGfornQj4dzcq5Vp835oM/o21UMlXzn79KobKlcs3Wz9smwiifknLy4xDCLUU0BWp7b/houtdrgUz7nOGnfIYg==} 106 | engines: {node: '>=18'} 107 | cpu: [loong64] 108 | os: [linux] 109 | 110 | '@esbuild/linux-mips64el@0.25.1': 111 | resolution: {integrity: sha512-1osBbPEFYwIE5IVB/0g2X6i1qInZa1aIoj1TdL4AaAb55xIIgbg8Doq6a5BzYWgr+tEcDzYH67XVnTmUzL+nXg==} 112 | engines: {node: '>=18'} 113 | cpu: [mips64el] 114 | os: [linux] 115 | 116 | '@esbuild/linux-ppc64@0.25.1': 117 | resolution: {integrity: sha512-/6VBJOwUf3TdTvJZ82qF3tbLuWsscd7/1w+D9LH0W/SqUgM5/JJD0lrJ1fVIfZsqB6RFmLCe0Xz3fmZc3WtyVg==} 118 | engines: {node: '>=18'} 119 | cpu: [ppc64] 120 | os: [linux] 121 | 122 | '@esbuild/linux-riscv64@0.25.1': 123 | resolution: {integrity: sha512-nSut/Mx5gnilhcq2yIMLMe3Wl4FK5wx/o0QuuCLMtmJn+WeWYoEGDN1ipcN72g1WHsnIbxGXd4i/MF0gTcuAjQ==} 124 | engines: {node: '>=18'} 125 | cpu: [riscv64] 126 | os: [linux] 127 | 128 | '@esbuild/linux-s390x@0.25.1': 129 | resolution: {integrity: sha512-cEECeLlJNfT8kZHqLarDBQso9a27o2Zd2AQ8USAEoGtejOrCYHNtKP8XQhMDJMtthdF4GBmjR2au3x1udADQQQ==} 130 | engines: {node: '>=18'} 131 | cpu: [s390x] 132 | os: [linux] 133 | 134 | '@esbuild/linux-x64@0.25.1': 135 | resolution: {integrity: sha512-xbfUhu/gnvSEg+EGovRc+kjBAkrvtk38RlerAzQxvMzlB4fXpCFCeUAYzJvrnhFtdeyVCDANSjJvOvGYoeKzFA==} 136 | engines: {node: '>=18'} 137 | cpu: [x64] 138 | os: [linux] 139 | 140 | '@esbuild/netbsd-arm64@0.25.1': 141 | resolution: {integrity: sha512-O96poM2XGhLtpTh+s4+nP7YCCAfb4tJNRVZHfIE7dgmax+yMP2WgMd2OecBuaATHKTHsLWHQeuaxMRnCsH8+5g==} 142 | engines: {node: '>=18'} 143 | cpu: [arm64] 144 | os: [netbsd] 145 | 146 | '@esbuild/netbsd-x64@0.25.1': 147 | resolution: {integrity: sha512-X53z6uXip6KFXBQ+Krbx25XHV/NCbzryM6ehOAeAil7X7oa4XIq+394PWGnwaSQ2WRA0KI6PUO6hTO5zeF5ijA==} 148 | engines: {node: '>=18'} 149 | cpu: [x64] 150 | os: [netbsd] 151 | 152 | '@esbuild/openbsd-arm64@0.25.1': 153 | resolution: {integrity: sha512-Na9T3szbXezdzM/Kfs3GcRQNjHzM6GzFBeU1/6IV/npKP5ORtp9zbQjvkDJ47s6BCgaAZnnnu/cY1x342+MvZg==} 154 | engines: {node: '>=18'} 155 | cpu: [arm64] 156 | os: [openbsd] 157 | 158 | '@esbuild/openbsd-x64@0.25.1': 159 | resolution: {integrity: sha512-T3H78X2h1tszfRSf+txbt5aOp/e7TAz3ptVKu9Oyir3IAOFPGV6O9c2naym5TOriy1l0nNf6a4X5UXRZSGX/dw==} 160 | engines: {node: '>=18'} 161 | cpu: [x64] 162 | os: [openbsd] 163 | 164 | '@esbuild/sunos-x64@0.25.1': 165 | resolution: {integrity: sha512-2H3RUvcmULO7dIE5EWJH8eubZAI4xw54H1ilJnRNZdeo8dTADEZ21w6J22XBkXqGJbe0+wnNJtw3UXRoLJnFEg==} 166 | engines: {node: '>=18'} 167 | cpu: [x64] 168 | os: [sunos] 169 | 170 | '@esbuild/win32-arm64@0.25.1': 171 | resolution: {integrity: sha512-GE7XvrdOzrb+yVKB9KsRMq+7a2U/K5Cf/8grVFRAGJmfADr/e/ODQ134RK2/eeHqYV5eQRFxb1hY7Nr15fv1NQ==} 172 | engines: {node: '>=18'} 173 | cpu: [arm64] 174 | os: [win32] 175 | 176 | '@esbuild/win32-ia32@0.25.1': 177 | resolution: {integrity: sha512-uOxSJCIcavSiT6UnBhBzE8wy3n0hOkJsBOzy7HDAuTDE++1DJMRRVCPGisULScHL+a/ZwdXPpXD3IyFKjA7K8A==} 178 | engines: {node: '>=18'} 179 | cpu: [ia32] 180 | os: [win32] 181 | 182 | '@esbuild/win32-x64@0.25.1': 183 | resolution: {integrity: sha512-Y1EQdcfwMSeQN/ujR5VayLOJ1BHaK+ssyk0AEzPjC+t1lITgsnccPqFjb6V+LsTp/9Iov4ysfjxLaGJ9RPtkVg==} 184 | engines: {node: '>=18'} 185 | cpu: [x64] 186 | os: [win32] 187 | 188 | '@isaacs/cliui@8.0.2': 189 | resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} 190 | engines: {node: '>=12'} 191 | 192 | '@jest/schemas@29.6.3': 193 | resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} 194 | engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} 195 | 196 | '@jridgewell/sourcemap-codec@1.5.0': 197 | resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} 198 | 199 | '@pkgjs/parseargs@0.11.0': 200 | resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} 201 | engines: {node: '>=14'} 202 | 203 | '@rollup/rollup-android-arm-eabi@4.38.0': 204 | resolution: {integrity: sha512-ldomqc4/jDZu/xpYU+aRxo3V4mGCV9HeTgUBANI3oIQMOL+SsxB+S2lxMpkFp5UamSS3XuTMQVbsS24R4J4Qjg==} 205 | cpu: [arm] 206 | os: [android] 207 | 208 | '@rollup/rollup-android-arm64@4.38.0': 209 | resolution: {integrity: sha512-VUsgcy4GhhT7rokwzYQP+aV9XnSLkkhlEJ0St8pbasuWO/vwphhZQxYEKUP3ayeCYLhk6gEtacRpYP/cj3GjyQ==} 210 | cpu: [arm64] 211 | os: [android] 212 | 213 | '@rollup/rollup-darwin-arm64@4.38.0': 214 | resolution: {integrity: sha512-buA17AYXlW9Rn091sWMq1xGUvWQFOH4N1rqUxGJtEQzhChxWjldGCCup7r/wUnaI6Au8sKXpoh0xg58a7cgcpg==} 215 | cpu: [arm64] 216 | os: [darwin] 217 | 218 | '@rollup/rollup-darwin-x64@4.38.0': 219 | resolution: {integrity: sha512-Mgcmc78AjunP1SKXl624vVBOF2bzwNWFPMP4fpOu05vS0amnLcX8gHIge7q/lDAHy3T2HeR0TqrriZDQS2Woeg==} 220 | cpu: [x64] 221 | os: [darwin] 222 | 223 | '@rollup/rollup-freebsd-arm64@4.38.0': 224 | resolution: {integrity: sha512-zzJACgjLbQTsscxWqvrEQAEh28hqhebpRz5q/uUd1T7VTwUNZ4VIXQt5hE7ncs0GrF+s7d3S4on4TiXUY8KoQA==} 225 | cpu: [arm64] 226 | os: [freebsd] 227 | 228 | '@rollup/rollup-freebsd-x64@4.38.0': 229 | resolution: {integrity: sha512-hCY/KAeYMCyDpEE4pTETam0XZS4/5GXzlLgpi5f0IaPExw9kuB+PDTOTLuPtM10TlRG0U9OSmXJ+Wq9J39LvAg==} 230 | cpu: [x64] 231 | os: [freebsd] 232 | 233 | '@rollup/rollup-linux-arm-gnueabihf@4.38.0': 234 | resolution: {integrity: sha512-mimPH43mHl4JdOTD7bUMFhBdrg6f9HzMTOEnzRmXbOZqjijCw8LA5z8uL6LCjxSa67H2xiLFvvO67PT05PRKGg==} 235 | cpu: [arm] 236 | os: [linux] 237 | 238 | '@rollup/rollup-linux-arm-musleabihf@4.38.0': 239 | resolution: {integrity: sha512-tPiJtiOoNuIH8XGG8sWoMMkAMm98PUwlriOFCCbZGc9WCax+GLeVRhmaxjJtz6WxrPKACgrwoZ5ia/uapq3ZVg==} 240 | cpu: [arm] 241 | os: [linux] 242 | 243 | '@rollup/rollup-linux-arm64-gnu@4.38.0': 244 | resolution: {integrity: sha512-wZco59rIVuB0tjQS0CSHTTUcEde+pXQWugZVxWaQFdQQ1VYub/sTrNdY76D1MKdN2NB48JDuGABP6o6fqos8mA==} 245 | cpu: [arm64] 246 | os: [linux] 247 | 248 | '@rollup/rollup-linux-arm64-musl@4.38.0': 249 | resolution: {integrity: sha512-fQgqwKmW0REM4LomQ+87PP8w8xvU9LZfeLBKybeli+0yHT7VKILINzFEuggvnV9M3x1Ed4gUBmGUzCo/ikmFbQ==} 250 | cpu: [arm64] 251 | os: [linux] 252 | 253 | '@rollup/rollup-linux-loongarch64-gnu@4.38.0': 254 | resolution: {integrity: sha512-hz5oqQLXTB3SbXpfkKHKXLdIp02/w3M+ajp8p4yWOWwQRtHWiEOCKtc9U+YXahrwdk+3qHdFMDWR5k+4dIlddg==} 255 | cpu: [loong64] 256 | os: [linux] 257 | 258 | '@rollup/rollup-linux-powerpc64le-gnu@4.38.0': 259 | resolution: {integrity: sha512-NXqygK/dTSibQ+0pzxsL3r4Xl8oPqVoWbZV9niqOnIHV/J92fe65pOir0xjkUZDRSPyFRvu+4YOpJF9BZHQImw==} 260 | cpu: [ppc64] 261 | os: [linux] 262 | 263 | '@rollup/rollup-linux-riscv64-gnu@4.38.0': 264 | resolution: {integrity: sha512-GEAIabR1uFyvf/jW/5jfu8gjM06/4kZ1W+j1nWTSSB3w6moZEBm7iBtzwQ3a1Pxos2F7Gz+58aVEnZHU295QTg==} 265 | cpu: [riscv64] 266 | os: [linux] 267 | 268 | '@rollup/rollup-linux-riscv64-musl@4.38.0': 269 | resolution: {integrity: sha512-9EYTX+Gus2EGPbfs+fh7l95wVADtSQyYw4DfSBcYdUEAmP2lqSZY0Y17yX/3m5VKGGJ4UmIH5LHLkMJft3bYoA==} 270 | cpu: [riscv64] 271 | os: [linux] 272 | 273 | '@rollup/rollup-linux-s390x-gnu@4.38.0': 274 | resolution: {integrity: sha512-Mpp6+Z5VhB9VDk7RwZXoG2qMdERm3Jw07RNlXHE0bOnEeX+l7Fy4bg+NxfyN15ruuY3/7Vrbpm75J9QHFqj5+Q==} 275 | cpu: [s390x] 276 | os: [linux] 277 | 278 | '@rollup/rollup-linux-x64-gnu@4.38.0': 279 | resolution: {integrity: sha512-vPvNgFlZRAgO7rwncMeE0+8c4Hmc+qixnp00/Uv3ht2x7KYrJ6ERVd3/R0nUtlE6/hu7/HiiNHJ/rP6knRFt1w==} 280 | cpu: [x64] 281 | os: [linux] 282 | 283 | '@rollup/rollup-linux-x64-musl@4.38.0': 284 | resolution: {integrity: sha512-q5Zv+goWvQUGCaL7fU8NuTw8aydIL/C9abAVGCzRReuj5h30TPx4LumBtAidrVOtXnlB+RZkBtExMsfqkMfb8g==} 285 | cpu: [x64] 286 | os: [linux] 287 | 288 | '@rollup/rollup-win32-arm64-msvc@4.38.0': 289 | resolution: {integrity: sha512-u/Jbm1BU89Vftqyqbmxdq14nBaQjQX1HhmsdBWqSdGClNaKwhjsg5TpW+5Ibs1mb8Es9wJiMdl86BcmtUVXNZg==} 290 | cpu: [arm64] 291 | os: [win32] 292 | 293 | '@rollup/rollup-win32-ia32-msvc@4.38.0': 294 | resolution: {integrity: sha512-mqu4PzTrlpNHHbu5qleGvXJoGgHpChBlrBx/mEhTPpnAL1ZAYFlvHD7rLK839LLKQzqEQMFJfGrrOHItN4ZQqA==} 295 | cpu: [ia32] 296 | os: [win32] 297 | 298 | '@rollup/rollup-win32-x64-msvc@4.38.0': 299 | resolution: {integrity: sha512-jjqy3uWlecfB98Psxb5cD6Fny9Fupv9LrDSPTQZUROqjvZmcCqNu4UMl7qqhlUUGpwiAkotj6GYu4SZdcr/nLw==} 300 | cpu: [x64] 301 | os: [win32] 302 | 303 | '@sinclair/typebox@0.27.8': 304 | resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} 305 | 306 | '@tsslint/cli@1.5.11': 307 | resolution: {integrity: sha512-Sm/h2p2i8Cuq58NrJKJTwKM8eHZ+3NhfS6I6VFSmMAfCRXHV2pHhJF/dPvIENWByxYo4lMt2n6wJYHbVOyyxAg==} 308 | hasBin: true 309 | peerDependencies: 310 | typescript: '*' 311 | 312 | '@tsslint/config@1.5.11': 313 | resolution: {integrity: sha512-Ksk+jkvDk1P8Q7jQB8RbzbEEuftzImHz1K9oTuJQI9pjLII6ba2Wa8uSJqJ1NIkuS+OWxNHcy+o1SyoLErAshg==} 314 | 315 | '@tsslint/core@1.5.11': 316 | resolution: {integrity: sha512-QRpMLM4gE61PuDOIR1Wn1kD0A+Sw5R+i+11EoQomF22CqPUFKPKAxL3/YBtTGKjaH3fKdBHV9gbk84KXoEZzZQ==} 317 | 318 | '@tsslint/types@1.5.11': 319 | resolution: {integrity: sha512-bPmik238B6yS03DH7hcdhl37D4HBzDJl0dTFLjgGOd3ekj6qe6V/f0QC1u8EwRqID4j0W132nH/5h5Rj88XZ1A==} 320 | 321 | '@types/estree@1.0.7': 322 | resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==} 323 | 324 | '@vitest/expect@3.0.9': 325 | resolution: {integrity: sha512-5eCqRItYgIML7NNVgJj6TVCmdzE7ZVgJhruW0ziSQV4V7PvLkDL1bBkBdcTs/VuIz0IxPb5da1IDSqc1TR9eig==} 326 | 327 | '@vitest/mocker@3.0.9': 328 | resolution: {integrity: sha512-ryERPIBOnvevAkTq+L1lD+DTFBRcjueL9lOUfXsLfwP92h4e+Heb+PjiqS3/OURWPtywfafK0kj++yDFjWUmrA==} 329 | peerDependencies: 330 | msw: ^2.4.9 331 | vite: ^5.0.0 || ^6.0.0 332 | peerDependenciesMeta: 333 | msw: 334 | optional: true 335 | vite: 336 | optional: true 337 | 338 | '@vitest/pretty-format@3.0.9': 339 | resolution: {integrity: sha512-OW9F8t2J3AwFEwENg3yMyKWweF7oRJlMyHOMIhO5F3n0+cgQAJZBjNgrF8dLwFTEXl5jUqBLXd9QyyKv8zEcmA==} 340 | 341 | '@vitest/runner@3.0.9': 342 | resolution: {integrity: sha512-NX9oUXgF9HPfJSwl8tUZCMP1oGx2+Sf+ru6d05QjzQz4OwWg0psEzwY6VexP2tTHWdOkhKHUIZH+fS6nA7jfOw==} 343 | 344 | '@vitest/snapshot@3.0.9': 345 | resolution: {integrity: sha512-AiLUiuZ0FuA+/8i19mTYd+re5jqjEc2jZbgJ2up0VY0Ddyyxg/uUtBDpIFAy4uzKaQxOW8gMgBdAJJ2ydhu39A==} 346 | 347 | '@vitest/spy@3.0.9': 348 | resolution: {integrity: sha512-/CcK2UDl0aQ2wtkp3YVWldrpLRNCfVcIOFGlVGKO4R5eajsH393Z1yiXLVQ7vWsj26JOEjeZI0x5sm5P4OGUNQ==} 349 | 350 | '@vitest/utils@3.0.9': 351 | resolution: {integrity: sha512-ilHM5fHhZ89MCp5aAaM9uhfl1c2JdxVxl3McqsdVyVNN6JffnEen8UMCdRTzOhGXNQGo5GNL9QugHrz727Wnng==} 352 | 353 | '@volar/language-core@2.4.12': 354 | resolution: {integrity: sha512-RLrFdXEaQBWfSnYGVxvR2WrO6Bub0unkdHYIdC31HzIEqATIuuhRRzYu76iGPZ6OtA4Au1SnW0ZwIqPP217YhA==} 355 | 356 | '@volar/source-map@2.4.12': 357 | resolution: {integrity: sha512-bUFIKvn2U0AWojOaqf63ER0N/iHIBYZPpNGogfLPQ68F5Eet6FnLlyho7BS0y2HJ1jFhSif7AcuTx1TqsCzRzw==} 358 | 359 | '@volar/typescript@2.4.12': 360 | resolution: {integrity: sha512-HJB73OTJDgPc80K30wxi3if4fSsZZAOScbj2fcicMuOPoOkcf9NNAINb33o+DzhBdF9xTKC1gnPmIRDous5S0g==} 361 | 362 | ansi-regex@5.0.1: 363 | resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} 364 | engines: {node: '>=8'} 365 | 366 | ansi-regex@6.1.0: 367 | resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==} 368 | engines: {node: '>=12'} 369 | 370 | ansi-styles@4.3.0: 371 | resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} 372 | engines: {node: '>=8'} 373 | 374 | ansi-styles@5.2.0: 375 | resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} 376 | engines: {node: '>=10'} 377 | 378 | ansi-styles@6.2.1: 379 | resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} 380 | engines: {node: '>=12'} 381 | 382 | assertion-error@2.0.1: 383 | resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} 384 | engines: {node: '>=12'} 385 | 386 | balanced-match@1.0.2: 387 | resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} 388 | 389 | brace-expansion@2.0.1: 390 | resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} 391 | 392 | cac@6.7.14: 393 | resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} 394 | engines: {node: '>=8'} 395 | 396 | chai@5.2.0: 397 | resolution: {integrity: sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw==} 398 | engines: {node: '>=12'} 399 | 400 | chalk@4.1.2: 401 | resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} 402 | engines: {node: '>=10'} 403 | 404 | check-error@2.1.1: 405 | resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} 406 | engines: {node: '>= 16'} 407 | 408 | color-convert@2.0.1: 409 | resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} 410 | engines: {node: '>=7.0.0'} 411 | 412 | color-name@1.1.4: 413 | resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} 414 | 415 | cross-spawn@7.0.6: 416 | resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} 417 | engines: {node: '>= 8'} 418 | 419 | debug@4.4.0: 420 | resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} 421 | engines: {node: '>=6.0'} 422 | peerDependencies: 423 | supports-color: '*' 424 | peerDependenciesMeta: 425 | supports-color: 426 | optional: true 427 | 428 | deep-eql@5.0.2: 429 | resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} 430 | engines: {node: '>=6'} 431 | 432 | diff-sequences@29.6.3: 433 | resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} 434 | engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} 435 | 436 | eastasianwidth@0.2.0: 437 | resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} 438 | 439 | emoji-regex@8.0.0: 440 | resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} 441 | 442 | emoji-regex@9.2.2: 443 | resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} 444 | 445 | error-stack-parser@2.1.4: 446 | resolution: {integrity: sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==} 447 | 448 | es-module-lexer@1.6.0: 449 | resolution: {integrity: sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==} 450 | 451 | esbuild@0.25.1: 452 | resolution: {integrity: sha512-BGO5LtrGC7vxnqucAe/rmvKdJllfGaYWdyABvyMoXQlfYMb2bbRuReWR5tEGE//4LcNJj9XrkovTqNYRFZHAMQ==} 453 | engines: {node: '>=18'} 454 | hasBin: true 455 | 456 | estree-walker@3.0.3: 457 | resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} 458 | 459 | expect-type@1.2.0: 460 | resolution: {integrity: sha512-80F22aiJ3GLyVnS/B3HzgR6RelZVumzj9jkL0Rhz4h0xYbNW9PjlQz5h3J/SShErbXBc295vseR4/MIbVmUbeA==} 461 | engines: {node: '>=12.0.0'} 462 | 463 | foreground-child@3.3.1: 464 | resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} 465 | engines: {node: '>=14'} 466 | 467 | fsevents@2.3.3: 468 | resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} 469 | engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} 470 | os: [darwin] 471 | 472 | glob@10.4.5: 473 | resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} 474 | hasBin: true 475 | 476 | has-flag@4.0.0: 477 | resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} 478 | engines: {node: '>=8'} 479 | 480 | is-fullwidth-code-point@3.0.0: 481 | resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} 482 | engines: {node: '>=8'} 483 | 484 | isexe@2.0.0: 485 | resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} 486 | 487 | jackspeak@3.4.3: 488 | resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} 489 | 490 | jest-diff@29.7.0: 491 | resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} 492 | engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} 493 | 494 | jest-extended@4.0.2: 495 | resolution: {integrity: sha512-FH7aaPgtGYHc9mRjriS0ZEHYM5/W69tLrFTIdzm+yJgeoCmmrSB/luSfMSqWP9O29QWHPEmJ4qmU6EwsZideog==} 496 | engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} 497 | peerDependencies: 498 | jest: '>=27.2.5' 499 | peerDependenciesMeta: 500 | jest: 501 | optional: true 502 | 503 | jest-get-type@29.6.3: 504 | resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==} 505 | engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} 506 | 507 | json5@2.2.3: 508 | resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} 509 | engines: {node: '>=6'} 510 | hasBin: true 511 | 512 | loupe@3.1.3: 513 | resolution: {integrity: sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==} 514 | 515 | lru-cache@10.4.3: 516 | resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} 517 | 518 | magic-string@0.30.17: 519 | resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==} 520 | 521 | minimatch@10.0.1: 522 | resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} 523 | engines: {node: 20 || >=22} 524 | 525 | minimatch@9.0.5: 526 | resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} 527 | engines: {node: '>=16 || 14 >=14.17'} 528 | 529 | minipass@7.1.2: 530 | resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} 531 | engines: {node: '>=16 || 14 >=14.17'} 532 | 533 | mitata@1.0.34: 534 | resolution: {integrity: sha512-Mc3zrtNBKIMeHSCQ0XqRLo1vbdIx1wvFV9c8NJAiyho6AjNfMY8bVhbS12bwciUdd1t4rj8099CH3N3NFahaUA==} 535 | 536 | ms@2.1.3: 537 | resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} 538 | 539 | nanoid@3.3.11: 540 | resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==} 541 | engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} 542 | hasBin: true 543 | 544 | package-json-from-dist@1.0.1: 545 | resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} 546 | 547 | path-browserify@1.0.1: 548 | resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} 549 | 550 | path-key@3.1.1: 551 | resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} 552 | engines: {node: '>=8'} 553 | 554 | path-scurry@1.11.1: 555 | resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} 556 | engines: {node: '>=16 || 14 >=14.18'} 557 | 558 | pathe@2.0.3: 559 | resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} 560 | 561 | pathval@2.0.0: 562 | resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} 563 | engines: {node: '>= 14.16'} 564 | 565 | picocolors@1.1.1: 566 | resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} 567 | 568 | postcss@8.5.3: 569 | resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==} 570 | engines: {node: ^10 || ^12 || >=14} 571 | 572 | pretty-format@29.7.0: 573 | resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} 574 | engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} 575 | 576 | react-is@18.3.1: 577 | resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} 578 | 579 | rollup@4.38.0: 580 | resolution: {integrity: sha512-5SsIRtJy9bf1ErAOiFMFzl64Ex9X5V7bnJ+WlFMb+zmP459OSWCEG7b0ERZ+PEU7xPt4OG3RHbrp1LJlXxYTrw==} 581 | engines: {node: '>=18.0.0', npm: '>=8.0.0'} 582 | hasBin: true 583 | 584 | shebang-command@2.0.0: 585 | resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} 586 | engines: {node: '>=8'} 587 | 588 | shebang-regex@3.0.0: 589 | resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} 590 | engines: {node: '>=8'} 591 | 592 | siginfo@2.0.0: 593 | resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} 594 | 595 | signal-exit@4.1.0: 596 | resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} 597 | engines: {node: '>=14'} 598 | 599 | sisteransi@1.0.5: 600 | resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} 601 | 602 | source-map-js@1.2.1: 603 | resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} 604 | engines: {node: '>=0.10.0'} 605 | 606 | stackback@0.0.2: 607 | resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} 608 | 609 | stackframe@1.3.4: 610 | resolution: {integrity: sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==} 611 | 612 | std-env@3.8.1: 613 | resolution: {integrity: sha512-vj5lIj3Mwf9D79hBkltk5qmkFI+biIKWS2IBxEyEU3AX1tUf7AoL8nSazCOiiqQsGKIq01SClsKEzweu34uwvA==} 614 | 615 | string-width@4.2.3: 616 | resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} 617 | engines: {node: '>=8'} 618 | 619 | string-width@5.1.2: 620 | resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} 621 | engines: {node: '>=12'} 622 | 623 | strip-ansi@6.0.1: 624 | resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} 625 | engines: {node: '>=8'} 626 | 627 | strip-ansi@7.1.0: 628 | resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} 629 | engines: {node: '>=12'} 630 | 631 | supports-color@7.2.0: 632 | resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} 633 | engines: {node: '>=8'} 634 | 635 | tinybench@2.9.0: 636 | resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} 637 | 638 | tinyexec@0.3.2: 639 | resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} 640 | 641 | tinypool@1.0.2: 642 | resolution: {integrity: sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==} 643 | engines: {node: ^18.0.0 || >=20.0.0} 644 | 645 | tinyrainbow@2.0.0: 646 | resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==} 647 | engines: {node: '>=14.0.0'} 648 | 649 | tinyspy@3.0.2: 650 | resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==} 651 | engines: {node: '>=14.0.0'} 652 | 653 | ts-api-utils@2.1.0: 654 | resolution: {integrity: sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==} 655 | engines: {node: '>=18.12'} 656 | peerDependencies: 657 | typescript: '>=4.8.4' 658 | 659 | typescript@5.8.2: 660 | resolution: {integrity: sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==} 661 | engines: {node: '>=14.17'} 662 | hasBin: true 663 | 664 | vite-node@3.0.9: 665 | resolution: {integrity: sha512-w3Gdx7jDcuT9cNn9jExXgOyKmf5UOTb6WMHz8LGAm54eS1Elf5OuBhCxl6zJxGhEeIkgsE1WbHuoL0mj/UXqXg==} 666 | engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} 667 | hasBin: true 668 | 669 | vite@6.2.3: 670 | resolution: {integrity: sha512-IzwM54g4y9JA/xAeBPNaDXiBF8Jsgl3VBQ2YQ/wOY6fyW3xMdSoltIV3Bo59DErdqdE6RxUfv8W69DvUorE4Eg==} 671 | engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} 672 | hasBin: true 673 | peerDependencies: 674 | '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 675 | jiti: '>=1.21.0' 676 | less: '*' 677 | lightningcss: ^1.21.0 678 | sass: '*' 679 | sass-embedded: '*' 680 | stylus: '*' 681 | sugarss: '*' 682 | terser: ^5.16.0 683 | tsx: ^4.8.1 684 | yaml: ^2.4.2 685 | peerDependenciesMeta: 686 | '@types/node': 687 | optional: true 688 | jiti: 689 | optional: true 690 | less: 691 | optional: true 692 | lightningcss: 693 | optional: true 694 | sass: 695 | optional: true 696 | sass-embedded: 697 | optional: true 698 | stylus: 699 | optional: true 700 | sugarss: 701 | optional: true 702 | terser: 703 | optional: true 704 | tsx: 705 | optional: true 706 | yaml: 707 | optional: true 708 | 709 | vitest@3.0.9: 710 | resolution: {integrity: sha512-BbcFDqNyBlfSpATmTtXOAOj71RNKDDvjBM/uPfnxxVGrG+FSH2RQIwgeEngTaTkuU/h0ScFvf+tRcKfYXzBybQ==} 711 | engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} 712 | hasBin: true 713 | peerDependencies: 714 | '@edge-runtime/vm': '*' 715 | '@types/debug': ^4.1.12 716 | '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 717 | '@vitest/browser': 3.0.9 718 | '@vitest/ui': 3.0.9 719 | happy-dom: '*' 720 | jsdom: '*' 721 | peerDependenciesMeta: 722 | '@edge-runtime/vm': 723 | optional: true 724 | '@types/debug': 725 | optional: true 726 | '@types/node': 727 | optional: true 728 | '@vitest/browser': 729 | optional: true 730 | '@vitest/ui': 731 | optional: true 732 | happy-dom: 733 | optional: true 734 | jsdom: 735 | optional: true 736 | 737 | vscode-uri@3.1.0: 738 | resolution: {integrity: sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==} 739 | 740 | which@2.0.2: 741 | resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} 742 | engines: {node: '>= 8'} 743 | hasBin: true 744 | 745 | why-is-node-running@2.3.0: 746 | resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} 747 | engines: {node: '>=8'} 748 | hasBin: true 749 | 750 | wrap-ansi@7.0.0: 751 | resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} 752 | engines: {node: '>=10'} 753 | 754 | wrap-ansi@8.1.0: 755 | resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} 756 | engines: {node: '>=12'} 757 | 758 | snapshots: 759 | 760 | '@clack/core@0.3.5': 761 | dependencies: 762 | picocolors: 1.1.1 763 | sisteransi: 1.0.5 764 | 765 | '@clack/prompts@0.8.2': 766 | dependencies: 767 | '@clack/core': 0.3.5 768 | picocolors: 1.1.1 769 | sisteransi: 1.0.5 770 | 771 | '@esbuild/aix-ppc64@0.25.1': 772 | optional: true 773 | 774 | '@esbuild/android-arm64@0.25.1': 775 | optional: true 776 | 777 | '@esbuild/android-arm@0.25.1': 778 | optional: true 779 | 780 | '@esbuild/android-x64@0.25.1': 781 | optional: true 782 | 783 | '@esbuild/darwin-arm64@0.25.1': 784 | optional: true 785 | 786 | '@esbuild/darwin-x64@0.25.1': 787 | optional: true 788 | 789 | '@esbuild/freebsd-arm64@0.25.1': 790 | optional: true 791 | 792 | '@esbuild/freebsd-x64@0.25.1': 793 | optional: true 794 | 795 | '@esbuild/linux-arm64@0.25.1': 796 | optional: true 797 | 798 | '@esbuild/linux-arm@0.25.1': 799 | optional: true 800 | 801 | '@esbuild/linux-ia32@0.25.1': 802 | optional: true 803 | 804 | '@esbuild/linux-loong64@0.25.1': 805 | optional: true 806 | 807 | '@esbuild/linux-mips64el@0.25.1': 808 | optional: true 809 | 810 | '@esbuild/linux-ppc64@0.25.1': 811 | optional: true 812 | 813 | '@esbuild/linux-riscv64@0.25.1': 814 | optional: true 815 | 816 | '@esbuild/linux-s390x@0.25.1': 817 | optional: true 818 | 819 | '@esbuild/linux-x64@0.25.1': 820 | optional: true 821 | 822 | '@esbuild/netbsd-arm64@0.25.1': 823 | optional: true 824 | 825 | '@esbuild/netbsd-x64@0.25.1': 826 | optional: true 827 | 828 | '@esbuild/openbsd-arm64@0.25.1': 829 | optional: true 830 | 831 | '@esbuild/openbsd-x64@0.25.1': 832 | optional: true 833 | 834 | '@esbuild/sunos-x64@0.25.1': 835 | optional: true 836 | 837 | '@esbuild/win32-arm64@0.25.1': 838 | optional: true 839 | 840 | '@esbuild/win32-ia32@0.25.1': 841 | optional: true 842 | 843 | '@esbuild/win32-x64@0.25.1': 844 | optional: true 845 | 846 | '@isaacs/cliui@8.0.2': 847 | dependencies: 848 | string-width: 5.1.2 849 | string-width-cjs: string-width@4.2.3 850 | strip-ansi: 7.1.0 851 | strip-ansi-cjs: strip-ansi@6.0.1 852 | wrap-ansi: 8.1.0 853 | wrap-ansi-cjs: wrap-ansi@7.0.0 854 | 855 | '@jest/schemas@29.6.3': 856 | dependencies: 857 | '@sinclair/typebox': 0.27.8 858 | 859 | '@jridgewell/sourcemap-codec@1.5.0': {} 860 | 861 | '@pkgjs/parseargs@0.11.0': 862 | optional: true 863 | 864 | '@rollup/rollup-android-arm-eabi@4.38.0': 865 | optional: true 866 | 867 | '@rollup/rollup-android-arm64@4.38.0': 868 | optional: true 869 | 870 | '@rollup/rollup-darwin-arm64@4.38.0': 871 | optional: true 872 | 873 | '@rollup/rollup-darwin-x64@4.38.0': 874 | optional: true 875 | 876 | '@rollup/rollup-freebsd-arm64@4.38.0': 877 | optional: true 878 | 879 | '@rollup/rollup-freebsd-x64@4.38.0': 880 | optional: true 881 | 882 | '@rollup/rollup-linux-arm-gnueabihf@4.38.0': 883 | optional: true 884 | 885 | '@rollup/rollup-linux-arm-musleabihf@4.38.0': 886 | optional: true 887 | 888 | '@rollup/rollup-linux-arm64-gnu@4.38.0': 889 | optional: true 890 | 891 | '@rollup/rollup-linux-arm64-musl@4.38.0': 892 | optional: true 893 | 894 | '@rollup/rollup-linux-loongarch64-gnu@4.38.0': 895 | optional: true 896 | 897 | '@rollup/rollup-linux-powerpc64le-gnu@4.38.0': 898 | optional: true 899 | 900 | '@rollup/rollup-linux-riscv64-gnu@4.38.0': 901 | optional: true 902 | 903 | '@rollup/rollup-linux-riscv64-musl@4.38.0': 904 | optional: true 905 | 906 | '@rollup/rollup-linux-s390x-gnu@4.38.0': 907 | optional: true 908 | 909 | '@rollup/rollup-linux-x64-gnu@4.38.0': 910 | optional: true 911 | 912 | '@rollup/rollup-linux-x64-musl@4.38.0': 913 | optional: true 914 | 915 | '@rollup/rollup-win32-arm64-msvc@4.38.0': 916 | optional: true 917 | 918 | '@rollup/rollup-win32-ia32-msvc@4.38.0': 919 | optional: true 920 | 921 | '@rollup/rollup-win32-x64-msvc@4.38.0': 922 | optional: true 923 | 924 | '@sinclair/typebox@0.27.8': {} 925 | 926 | '@tsslint/cli@1.5.11(typescript@5.8.2)': 927 | dependencies: 928 | '@clack/prompts': 0.8.2 929 | '@tsslint/config': 1.5.11(typescript@5.8.2) 930 | '@tsslint/core': 1.5.11 931 | '@volar/language-core': 2.4.12 932 | '@volar/typescript': 2.4.12 933 | glob: 10.4.5 934 | json5: 2.2.3 935 | typescript: 5.8.2 936 | 937 | '@tsslint/config@1.5.11(typescript@5.8.2)': 938 | dependencies: 939 | '@tsslint/types': 1.5.11 940 | ts-api-utils: 2.1.0(typescript@5.8.2) 941 | transitivePeerDependencies: 942 | - typescript 943 | 944 | '@tsslint/core@1.5.11': 945 | dependencies: 946 | '@tsslint/types': 1.5.11 947 | error-stack-parser: 2.1.4 948 | esbuild: 0.25.1 949 | minimatch: 10.0.1 950 | 951 | '@tsslint/types@1.5.11': {} 952 | 953 | '@types/estree@1.0.7': {} 954 | 955 | '@vitest/expect@3.0.9': 956 | dependencies: 957 | '@vitest/spy': 3.0.9 958 | '@vitest/utils': 3.0.9 959 | chai: 5.2.0 960 | tinyrainbow: 2.0.0 961 | 962 | '@vitest/mocker@3.0.9(vite@6.2.3)': 963 | dependencies: 964 | '@vitest/spy': 3.0.9 965 | estree-walker: 3.0.3 966 | magic-string: 0.30.17 967 | optionalDependencies: 968 | vite: 6.2.3 969 | 970 | '@vitest/pretty-format@3.0.9': 971 | dependencies: 972 | tinyrainbow: 2.0.0 973 | 974 | '@vitest/runner@3.0.9': 975 | dependencies: 976 | '@vitest/utils': 3.0.9 977 | pathe: 2.0.3 978 | 979 | '@vitest/snapshot@3.0.9': 980 | dependencies: 981 | '@vitest/pretty-format': 3.0.9 982 | magic-string: 0.30.17 983 | pathe: 2.0.3 984 | 985 | '@vitest/spy@3.0.9': 986 | dependencies: 987 | tinyspy: 3.0.2 988 | 989 | '@vitest/utils@3.0.9': 990 | dependencies: 991 | '@vitest/pretty-format': 3.0.9 992 | loupe: 3.1.3 993 | tinyrainbow: 2.0.0 994 | 995 | '@volar/language-core@2.4.12': 996 | dependencies: 997 | '@volar/source-map': 2.4.12 998 | 999 | '@volar/source-map@2.4.12': {} 1000 | 1001 | '@volar/typescript@2.4.12': 1002 | dependencies: 1003 | '@volar/language-core': 2.4.12 1004 | path-browserify: 1.0.1 1005 | vscode-uri: 3.1.0 1006 | 1007 | ansi-regex@5.0.1: {} 1008 | 1009 | ansi-regex@6.1.0: {} 1010 | 1011 | ansi-styles@4.3.0: 1012 | dependencies: 1013 | color-convert: 2.0.1 1014 | 1015 | ansi-styles@5.2.0: {} 1016 | 1017 | ansi-styles@6.2.1: {} 1018 | 1019 | assertion-error@2.0.1: {} 1020 | 1021 | balanced-match@1.0.2: {} 1022 | 1023 | brace-expansion@2.0.1: 1024 | dependencies: 1025 | balanced-match: 1.0.2 1026 | 1027 | cac@6.7.14: {} 1028 | 1029 | chai@5.2.0: 1030 | dependencies: 1031 | assertion-error: 2.0.1 1032 | check-error: 2.1.1 1033 | deep-eql: 5.0.2 1034 | loupe: 3.1.3 1035 | pathval: 2.0.0 1036 | 1037 | chalk@4.1.2: 1038 | dependencies: 1039 | ansi-styles: 4.3.0 1040 | supports-color: 7.2.0 1041 | 1042 | check-error@2.1.1: {} 1043 | 1044 | color-convert@2.0.1: 1045 | dependencies: 1046 | color-name: 1.1.4 1047 | 1048 | color-name@1.1.4: {} 1049 | 1050 | cross-spawn@7.0.6: 1051 | dependencies: 1052 | path-key: 3.1.1 1053 | shebang-command: 2.0.0 1054 | which: 2.0.2 1055 | 1056 | debug@4.4.0: 1057 | dependencies: 1058 | ms: 2.1.3 1059 | 1060 | deep-eql@5.0.2: {} 1061 | 1062 | diff-sequences@29.6.3: {} 1063 | 1064 | eastasianwidth@0.2.0: {} 1065 | 1066 | emoji-regex@8.0.0: {} 1067 | 1068 | emoji-regex@9.2.2: {} 1069 | 1070 | error-stack-parser@2.1.4: 1071 | dependencies: 1072 | stackframe: 1.3.4 1073 | 1074 | es-module-lexer@1.6.0: {} 1075 | 1076 | esbuild@0.25.1: 1077 | optionalDependencies: 1078 | '@esbuild/aix-ppc64': 0.25.1 1079 | '@esbuild/android-arm': 0.25.1 1080 | '@esbuild/android-arm64': 0.25.1 1081 | '@esbuild/android-x64': 0.25.1 1082 | '@esbuild/darwin-arm64': 0.25.1 1083 | '@esbuild/darwin-x64': 0.25.1 1084 | '@esbuild/freebsd-arm64': 0.25.1 1085 | '@esbuild/freebsd-x64': 0.25.1 1086 | '@esbuild/linux-arm': 0.25.1 1087 | '@esbuild/linux-arm64': 0.25.1 1088 | '@esbuild/linux-ia32': 0.25.1 1089 | '@esbuild/linux-loong64': 0.25.1 1090 | '@esbuild/linux-mips64el': 0.25.1 1091 | '@esbuild/linux-ppc64': 0.25.1 1092 | '@esbuild/linux-riscv64': 0.25.1 1093 | '@esbuild/linux-s390x': 0.25.1 1094 | '@esbuild/linux-x64': 0.25.1 1095 | '@esbuild/netbsd-arm64': 0.25.1 1096 | '@esbuild/netbsd-x64': 0.25.1 1097 | '@esbuild/openbsd-arm64': 0.25.1 1098 | '@esbuild/openbsd-x64': 0.25.1 1099 | '@esbuild/sunos-x64': 0.25.1 1100 | '@esbuild/win32-arm64': 0.25.1 1101 | '@esbuild/win32-ia32': 0.25.1 1102 | '@esbuild/win32-x64': 0.25.1 1103 | 1104 | estree-walker@3.0.3: 1105 | dependencies: 1106 | '@types/estree': 1.0.7 1107 | 1108 | expect-type@1.2.0: {} 1109 | 1110 | foreground-child@3.3.1: 1111 | dependencies: 1112 | cross-spawn: 7.0.6 1113 | signal-exit: 4.1.0 1114 | 1115 | fsevents@2.3.3: 1116 | optional: true 1117 | 1118 | glob@10.4.5: 1119 | dependencies: 1120 | foreground-child: 3.3.1 1121 | jackspeak: 3.4.3 1122 | minimatch: 9.0.5 1123 | minipass: 7.1.2 1124 | package-json-from-dist: 1.0.1 1125 | path-scurry: 1.11.1 1126 | 1127 | has-flag@4.0.0: {} 1128 | 1129 | is-fullwidth-code-point@3.0.0: {} 1130 | 1131 | isexe@2.0.0: {} 1132 | 1133 | jackspeak@3.4.3: 1134 | dependencies: 1135 | '@isaacs/cliui': 8.0.2 1136 | optionalDependencies: 1137 | '@pkgjs/parseargs': 0.11.0 1138 | 1139 | jest-diff@29.7.0: 1140 | dependencies: 1141 | chalk: 4.1.2 1142 | diff-sequences: 29.6.3 1143 | jest-get-type: 29.6.3 1144 | pretty-format: 29.7.0 1145 | 1146 | jest-extended@4.0.2: 1147 | dependencies: 1148 | jest-diff: 29.7.0 1149 | jest-get-type: 29.6.3 1150 | 1151 | jest-get-type@29.6.3: {} 1152 | 1153 | json5@2.2.3: {} 1154 | 1155 | loupe@3.1.3: {} 1156 | 1157 | lru-cache@10.4.3: {} 1158 | 1159 | magic-string@0.30.17: 1160 | dependencies: 1161 | '@jridgewell/sourcemap-codec': 1.5.0 1162 | 1163 | minimatch@10.0.1: 1164 | dependencies: 1165 | brace-expansion: 2.0.1 1166 | 1167 | minimatch@9.0.5: 1168 | dependencies: 1169 | brace-expansion: 2.0.1 1170 | 1171 | minipass@7.1.2: {} 1172 | 1173 | mitata@1.0.34: {} 1174 | 1175 | ms@2.1.3: {} 1176 | 1177 | nanoid@3.3.11: {} 1178 | 1179 | package-json-from-dist@1.0.1: {} 1180 | 1181 | path-browserify@1.0.1: {} 1182 | 1183 | path-key@3.1.1: {} 1184 | 1185 | path-scurry@1.11.1: 1186 | dependencies: 1187 | lru-cache: 10.4.3 1188 | minipass: 7.1.2 1189 | 1190 | pathe@2.0.3: {} 1191 | 1192 | pathval@2.0.0: {} 1193 | 1194 | picocolors@1.1.1: {} 1195 | 1196 | postcss@8.5.3: 1197 | dependencies: 1198 | nanoid: 3.3.11 1199 | picocolors: 1.1.1 1200 | source-map-js: 1.2.1 1201 | 1202 | pretty-format@29.7.0: 1203 | dependencies: 1204 | '@jest/schemas': 29.6.3 1205 | ansi-styles: 5.2.0 1206 | react-is: 18.3.1 1207 | 1208 | react-is@18.3.1: {} 1209 | 1210 | rollup@4.38.0: 1211 | dependencies: 1212 | '@types/estree': 1.0.7 1213 | optionalDependencies: 1214 | '@rollup/rollup-android-arm-eabi': 4.38.0 1215 | '@rollup/rollup-android-arm64': 4.38.0 1216 | '@rollup/rollup-darwin-arm64': 4.38.0 1217 | '@rollup/rollup-darwin-x64': 4.38.0 1218 | '@rollup/rollup-freebsd-arm64': 4.38.0 1219 | '@rollup/rollup-freebsd-x64': 4.38.0 1220 | '@rollup/rollup-linux-arm-gnueabihf': 4.38.0 1221 | '@rollup/rollup-linux-arm-musleabihf': 4.38.0 1222 | '@rollup/rollup-linux-arm64-gnu': 4.38.0 1223 | '@rollup/rollup-linux-arm64-musl': 4.38.0 1224 | '@rollup/rollup-linux-loongarch64-gnu': 4.38.0 1225 | '@rollup/rollup-linux-powerpc64le-gnu': 4.38.0 1226 | '@rollup/rollup-linux-riscv64-gnu': 4.38.0 1227 | '@rollup/rollup-linux-riscv64-musl': 4.38.0 1228 | '@rollup/rollup-linux-s390x-gnu': 4.38.0 1229 | '@rollup/rollup-linux-x64-gnu': 4.38.0 1230 | '@rollup/rollup-linux-x64-musl': 4.38.0 1231 | '@rollup/rollup-win32-arm64-msvc': 4.38.0 1232 | '@rollup/rollup-win32-ia32-msvc': 4.38.0 1233 | '@rollup/rollup-win32-x64-msvc': 4.38.0 1234 | fsevents: 2.3.3 1235 | 1236 | shebang-command@2.0.0: 1237 | dependencies: 1238 | shebang-regex: 3.0.0 1239 | 1240 | shebang-regex@3.0.0: {} 1241 | 1242 | siginfo@2.0.0: {} 1243 | 1244 | signal-exit@4.1.0: {} 1245 | 1246 | sisteransi@1.0.5: {} 1247 | 1248 | source-map-js@1.2.1: {} 1249 | 1250 | stackback@0.0.2: {} 1251 | 1252 | stackframe@1.3.4: {} 1253 | 1254 | std-env@3.8.1: {} 1255 | 1256 | string-width@4.2.3: 1257 | dependencies: 1258 | emoji-regex: 8.0.0 1259 | is-fullwidth-code-point: 3.0.0 1260 | strip-ansi: 6.0.1 1261 | 1262 | string-width@5.1.2: 1263 | dependencies: 1264 | eastasianwidth: 0.2.0 1265 | emoji-regex: 9.2.2 1266 | strip-ansi: 7.1.0 1267 | 1268 | strip-ansi@6.0.1: 1269 | dependencies: 1270 | ansi-regex: 5.0.1 1271 | 1272 | strip-ansi@7.1.0: 1273 | dependencies: 1274 | ansi-regex: 6.1.0 1275 | 1276 | supports-color@7.2.0: 1277 | dependencies: 1278 | has-flag: 4.0.0 1279 | 1280 | tinybench@2.9.0: {} 1281 | 1282 | tinyexec@0.3.2: {} 1283 | 1284 | tinypool@1.0.2: {} 1285 | 1286 | tinyrainbow@2.0.0: {} 1287 | 1288 | tinyspy@3.0.2: {} 1289 | 1290 | ts-api-utils@2.1.0(typescript@5.8.2): 1291 | dependencies: 1292 | typescript: 5.8.2 1293 | 1294 | typescript@5.8.2: {} 1295 | 1296 | vite-node@3.0.9: 1297 | dependencies: 1298 | cac: 6.7.14 1299 | debug: 4.4.0 1300 | es-module-lexer: 1.6.0 1301 | pathe: 2.0.3 1302 | vite: 6.2.3 1303 | transitivePeerDependencies: 1304 | - '@types/node' 1305 | - jiti 1306 | - less 1307 | - lightningcss 1308 | - sass 1309 | - sass-embedded 1310 | - stylus 1311 | - sugarss 1312 | - supports-color 1313 | - terser 1314 | - tsx 1315 | - yaml 1316 | 1317 | vite@6.2.3: 1318 | dependencies: 1319 | esbuild: 0.25.1 1320 | postcss: 8.5.3 1321 | rollup: 4.38.0 1322 | optionalDependencies: 1323 | fsevents: 2.3.3 1324 | 1325 | vitest@3.0.9: 1326 | dependencies: 1327 | '@vitest/expect': 3.0.9 1328 | '@vitest/mocker': 3.0.9(vite@6.2.3) 1329 | '@vitest/pretty-format': 3.0.9 1330 | '@vitest/runner': 3.0.9 1331 | '@vitest/snapshot': 3.0.9 1332 | '@vitest/spy': 3.0.9 1333 | '@vitest/utils': 3.0.9 1334 | chai: 5.2.0 1335 | debug: 4.4.0 1336 | expect-type: 1.2.0 1337 | magic-string: 0.30.17 1338 | pathe: 2.0.3 1339 | std-env: 3.8.1 1340 | tinybench: 2.9.0 1341 | tinyexec: 0.3.2 1342 | tinypool: 1.0.2 1343 | tinyrainbow: 2.0.0 1344 | vite: 6.2.3 1345 | vite-node: 3.0.9 1346 | why-is-node-running: 2.3.0 1347 | transitivePeerDependencies: 1348 | - jiti 1349 | - less 1350 | - lightningcss 1351 | - msw 1352 | - sass 1353 | - sass-embedded 1354 | - stylus 1355 | - sugarss 1356 | - supports-color 1357 | - terser 1358 | - tsx 1359 | - yaml 1360 | 1361 | vscode-uri@3.1.0: {} 1362 | 1363 | which@2.0.2: 1364 | dependencies: 1365 | isexe: 2.0.0 1366 | 1367 | why-is-node-running@2.3.0: 1368 | dependencies: 1369 | siginfo: 2.0.0 1370 | stackback: 0.0.2 1371 | 1372 | wrap-ansi@7.0.0: 1373 | dependencies: 1374 | ansi-styles: 4.3.0 1375 | string-width: 4.2.3 1376 | strip-ansi: 6.0.1 1377 | 1378 | wrap-ansi@8.1.0: 1379 | dependencies: 1380 | ansi-styles: 6.2.1 1381 | string-width: 5.1.2 1382 | strip-ansi: 7.1.0 1383 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './system.js'; 2 | 3 | import { createReactiveSystem, type ReactiveNode, type ReactiveFlags } from './system.js'; 4 | 5 | const enum EffectFlags { 6 | Queued = 1 << 6, 7 | } 8 | 9 | interface EffectScope extends ReactiveNode { } 10 | 11 | interface Effect extends ReactiveNode { 12 | fn(): void; 13 | } 14 | 15 | interface Computed extends ReactiveNode { 16 | value: T | undefined; 17 | getter: (previousValue?: T) => T; 18 | } 19 | 20 | interface Signal extends ReactiveNode { 21 | previousValue: T; 22 | value: T; 23 | } 24 | 25 | const pauseStack: (ReactiveNode | undefined)[] = []; 26 | const queuedEffects: (Effect | EffectScope | undefined)[] = []; 27 | const { 28 | link, 29 | unlink, 30 | propagate, 31 | checkDirty, 32 | endTracking, 33 | startTracking, 34 | shallowPropagate, 35 | } = createReactiveSystem({ 36 | update(signal: Signal | Computed): boolean { 37 | if ('getter' in signal) { 38 | return updateComputed(signal); 39 | } else { 40 | return updateSignal(signal, signal.value); 41 | } 42 | }, 43 | notify, 44 | unwatched(node: Signal | Computed | Effect | EffectScope) { 45 | if ('getter' in node) { 46 | let toRemove = node.deps; 47 | if (toRemove !== undefined) { 48 | node.flags = 17 as ReactiveFlags.Mutable | ReactiveFlags.Dirty; 49 | do { 50 | toRemove = unlink(toRemove, node); 51 | } while (toRemove !== undefined); 52 | } 53 | } else if (!('previousValue' in node)) { 54 | effectOper.call(node); 55 | } 56 | }, 57 | }); 58 | 59 | export let batchDepth = 0; 60 | 61 | let notifyIndex = 0; 62 | let queuedEffectsLength = 0; 63 | let activeSub: ReactiveNode | undefined; 64 | let activeScope: EffectScope | undefined; 65 | 66 | export function getCurrentSub(): ReactiveNode | undefined { 67 | return activeSub; 68 | } 69 | 70 | export function setCurrentSub(sub: ReactiveNode | undefined) { 71 | const prevSub = activeSub; 72 | activeSub = sub; 73 | return prevSub; 74 | } 75 | 76 | export function getCurrentScope(): EffectScope | undefined { 77 | return activeScope; 78 | } 79 | 80 | export function setCurrentScope(scope: EffectScope | undefined) { 81 | const prevScope = activeScope; 82 | activeScope = scope; 83 | return prevScope; 84 | } 85 | 86 | export function startBatch() { 87 | ++batchDepth; 88 | } 89 | 90 | export function endBatch() { 91 | if (!--batchDepth) { 92 | flush(); 93 | } 94 | } 95 | 96 | /** 97 | * @deprecated Will be removed in the next major version. Use `const pausedSub = setCurrentSub(undefined)` instead for better performance. 98 | */ 99 | export function pauseTracking() { 100 | pauseStack.push(setCurrentSub(undefined)); 101 | } 102 | 103 | /** 104 | * @deprecated Will be removed in the next major version. Use `setCurrentSub(pausedSub)` instead for better performance. 105 | */ 106 | export function resumeTracking() { 107 | setCurrentSub(pauseStack.pop()); 108 | } 109 | 110 | export function signal(): { 111 | (): T | undefined; 112 | (value: T | undefined): void; 113 | }; 114 | export function signal(initialValue: T): { 115 | (): T; 116 | (value: T): void; 117 | }; 118 | export function signal(initialValue?: T): { 119 | (): T | undefined; 120 | (value: T | undefined): void; 121 | } { 122 | return signalOper.bind({ 123 | previousValue: initialValue, 124 | value: initialValue, 125 | subs: undefined, 126 | subsTail: undefined, 127 | flags: 1 satisfies ReactiveFlags.Mutable, 128 | }) as () => T | undefined; 129 | } 130 | 131 | export function computed(getter: (previousValue?: T) => T): () => T { 132 | return computedOper.bind({ 133 | value: undefined, 134 | subs: undefined, 135 | subsTail: undefined, 136 | deps: undefined, 137 | depsTail: undefined, 138 | flags: 17 as ReactiveFlags.Mutable | ReactiveFlags.Dirty, 139 | getter: getter as (previousValue?: unknown) => unknown, 140 | }) as () => T; 141 | } 142 | 143 | export function effect(fn: () => void): () => void { 144 | const e: Effect = { 145 | fn, 146 | subs: undefined, 147 | subsTail: undefined, 148 | deps: undefined, 149 | depsTail: undefined, 150 | flags: 2 satisfies ReactiveFlags.Watching, 151 | }; 152 | if (activeSub !== undefined) { 153 | link(e, activeSub); 154 | } else if (activeScope !== undefined) { 155 | link(e, activeScope); 156 | } 157 | const prev = setCurrentSub(e); 158 | try { 159 | e.fn(); 160 | } finally { 161 | setCurrentSub(prev); 162 | } 163 | return effectOper.bind(e); 164 | } 165 | 166 | export function effectScope(fn: () => void): () => void { 167 | const e: EffectScope = { 168 | deps: undefined, 169 | depsTail: undefined, 170 | subs: undefined, 171 | subsTail: undefined, 172 | flags: 0 satisfies ReactiveFlags.None, 173 | }; 174 | if (activeScope !== undefined) { 175 | link(e, activeScope); 176 | } 177 | const prevSub = setCurrentSub(undefined); 178 | const prevScope = setCurrentScope(e); 179 | try { 180 | fn(); 181 | } finally { 182 | setCurrentScope(prevScope); 183 | setCurrentSub(prevSub); 184 | } 185 | return effectOper.bind(e); 186 | } 187 | 188 | function updateComputed(c: Computed): boolean { 189 | const prevSub = setCurrentSub(c); 190 | startTracking(c); 191 | try { 192 | const oldValue = c.value; 193 | return oldValue !== (c.value = c.getter(oldValue)); 194 | } finally { 195 | setCurrentSub(prevSub); 196 | endTracking(c); 197 | } 198 | } 199 | 200 | function updateSignal(s: Signal, value: any): boolean { 201 | s.flags = 1 satisfies ReactiveFlags.Mutable; 202 | return s.previousValue !== (s.previousValue = value); 203 | } 204 | 205 | function notify(e: Effect | EffectScope) { 206 | const flags = e.flags; 207 | if (!(flags & EffectFlags.Queued)) { 208 | e.flags = flags | EffectFlags.Queued; 209 | const subs = e.subs; 210 | if (subs !== undefined) { 211 | notify(subs.sub as Effect | EffectScope); 212 | } else { 213 | queuedEffects[queuedEffectsLength++] = e; 214 | } 215 | } 216 | } 217 | 218 | function run(e: Effect | EffectScope, flags: ReactiveFlags): void { 219 | if ( 220 | flags & 16 satisfies ReactiveFlags.Dirty 221 | || (flags & 32 satisfies ReactiveFlags.Pending && checkDirty(e.deps!, e)) 222 | ) { 223 | const prev = setCurrentSub(e); 224 | startTracking(e); 225 | try { 226 | (e as Effect).fn(); 227 | } finally { 228 | setCurrentSub(prev); 229 | endTracking(e); 230 | } 231 | return; 232 | } else if (flags & 32 satisfies ReactiveFlags.Pending) { 233 | e.flags = flags & ~(32 satisfies ReactiveFlags.Pending); 234 | } 235 | let link = e.deps; 236 | while (link !== undefined) { 237 | const dep = link.dep; 238 | const depFlags = dep.flags; 239 | if (depFlags & EffectFlags.Queued) { 240 | run(dep, dep.flags = depFlags & ~EffectFlags.Queued); 241 | } 242 | link = link.nextDep; 243 | } 244 | } 245 | 246 | function flush(): void { 247 | while (notifyIndex < queuedEffectsLength) { 248 | const effect = queuedEffects[notifyIndex]!; 249 | queuedEffects[notifyIndex++] = undefined; 250 | run(effect, effect.flags &= ~EffectFlags.Queued); 251 | } 252 | notifyIndex = 0; 253 | queuedEffectsLength = 0; 254 | } 255 | 256 | function computedOper(this: Computed): T { 257 | const flags = this.flags; 258 | if ( 259 | flags & 16 satisfies ReactiveFlags.Dirty 260 | || (flags & 32 satisfies ReactiveFlags.Pending && checkDirty(this.deps!, this)) 261 | ) { 262 | if (updateComputed(this)) { 263 | const subs = this.subs; 264 | if (subs !== undefined) { 265 | shallowPropagate(subs); 266 | } 267 | } 268 | } else if (flags & 32 satisfies ReactiveFlags.Pending) { 269 | this.flags = flags & ~(32 satisfies ReactiveFlags.Pending); 270 | } 271 | if (activeSub !== undefined) { 272 | link(this, activeSub); 273 | } else if (activeScope !== undefined) { 274 | link(this, activeScope); 275 | } 276 | return this.value!; 277 | } 278 | 279 | function signalOper(this: Signal, ...value: [T]): T | void { 280 | if (value.length) { 281 | const newValue = value[0]; 282 | if (this.value !== (this.value = newValue)) { 283 | this.flags = 17 as ReactiveFlags.Mutable | ReactiveFlags.Dirty; 284 | const subs = this.subs; 285 | if (subs !== undefined) { 286 | propagate(subs); 287 | if (!batchDepth) { 288 | flush(); 289 | } 290 | } 291 | } 292 | } else { 293 | const value = this.value; 294 | if (this.flags & 16 satisfies ReactiveFlags.Dirty) { 295 | if (updateSignal(this, value)) { 296 | const subs = this.subs; 297 | if (subs !== undefined) { 298 | shallowPropagate(subs); 299 | } 300 | } 301 | } 302 | if (activeSub !== undefined) { 303 | link(this, activeSub); 304 | } 305 | return value; 306 | } 307 | } 308 | 309 | function effectOper(this: Effect | EffectScope): void { 310 | let dep = this.deps; 311 | while (dep !== undefined) { 312 | dep = unlink(dep, this); 313 | } 314 | const sub = this.subs; 315 | if (sub !== undefined) { 316 | unlink(sub); 317 | } 318 | this.flags = 0 satisfies ReactiveFlags.None; 319 | } 320 | -------------------------------------------------------------------------------- /src/system.ts: -------------------------------------------------------------------------------- 1 | export interface ReactiveNode { 2 | deps?: Link; 3 | depsTail?: Link; 4 | subs?: Link; 5 | subsTail?: Link; 6 | flags: ReactiveFlags; 7 | } 8 | 9 | export interface Link { 10 | dep: ReactiveNode; 11 | sub: ReactiveNode; 12 | prevSub: Link | undefined; 13 | nextSub: Link | undefined; 14 | prevDep: Link | undefined; 15 | nextDep: Link | undefined; 16 | } 17 | 18 | interface Stack { 19 | value: T; 20 | prev: Stack | undefined; 21 | } 22 | 23 | export enum ReactiveFlags { 24 | None = 0, 25 | Mutable = 1 << 0, 26 | Watching = 1 << 1, 27 | RecursedCheck = 1 << 2, 28 | Recursed = 1 << 3, 29 | Dirty = 1 << 4, 30 | Pending = 1 << 5, 31 | } 32 | 33 | export function createReactiveSystem({ 34 | update, 35 | notify, 36 | unwatched, 37 | }: { 38 | update(sub: ReactiveNode): boolean; 39 | notify(sub: ReactiveNode): void; 40 | unwatched(sub: ReactiveNode): void; 41 | }) { 42 | return { 43 | link, 44 | unlink, 45 | propagate, 46 | checkDirty, 47 | endTracking, 48 | startTracking, 49 | shallowPropagate, 50 | }; 51 | 52 | function link(dep: ReactiveNode, sub: ReactiveNode): void { 53 | const prevDep = sub.depsTail; 54 | if (prevDep !== undefined && prevDep.dep === dep) { 55 | return; 56 | } 57 | let nextDep: Link | undefined = undefined; 58 | const recursedCheck = sub.flags & 4 satisfies ReactiveFlags.RecursedCheck; 59 | if (recursedCheck) { 60 | nextDep = prevDep !== undefined ? prevDep.nextDep : sub.deps; 61 | if (nextDep !== undefined && nextDep.dep === dep) { 62 | sub.depsTail = nextDep; 63 | return; 64 | } 65 | } 66 | const prevSub = dep.subsTail; 67 | if ( 68 | prevSub !== undefined 69 | && prevSub.sub === sub 70 | && (!recursedCheck || isValidLink(prevSub, sub)) 71 | ) { 72 | return; 73 | } 74 | const newLink 75 | = sub.depsTail 76 | = dep.subsTail 77 | = { 78 | dep, 79 | sub, 80 | prevDep, 81 | nextDep, 82 | prevSub, 83 | nextSub: undefined, 84 | }; 85 | if (nextDep !== undefined) { 86 | nextDep.prevDep = newLink; 87 | } 88 | if (prevDep !== undefined) { 89 | prevDep.nextDep = newLink; 90 | } else { 91 | sub.deps = newLink; 92 | } 93 | if (prevSub !== undefined) { 94 | prevSub.nextSub = newLink; 95 | } else { 96 | dep.subs = newLink; 97 | } 98 | } 99 | 100 | function unlink(link: Link, sub = link.sub): Link | undefined { 101 | const dep = link.dep; 102 | const prevDep = link.prevDep; 103 | const nextDep = link.nextDep; 104 | const nextSub = link.nextSub; 105 | const prevSub = link.prevSub; 106 | if (nextDep !== undefined) { 107 | nextDep.prevDep = prevDep; 108 | } else { 109 | sub.depsTail = prevDep; 110 | } 111 | if (prevDep !== undefined) { 112 | prevDep.nextDep = nextDep; 113 | } else { 114 | sub.deps = nextDep; 115 | } 116 | if (nextSub !== undefined) { 117 | nextSub.prevSub = prevSub; 118 | } else { 119 | dep.subsTail = prevSub; 120 | } 121 | if (prevSub !== undefined) { 122 | prevSub.nextSub = nextSub; 123 | } else if ((dep.subs = nextSub) === undefined) { 124 | unwatched(dep); 125 | } 126 | return nextDep; 127 | } 128 | 129 | function propagate(link: Link): void { 130 | let next = link.nextSub; 131 | let stack: Stack | undefined; 132 | 133 | top: do { 134 | const sub = link.sub; 135 | 136 | let flags = sub.flags; 137 | 138 | if (flags & 3 as ReactiveFlags.Mutable | ReactiveFlags.Watching) { 139 | if (!(flags & 60 as ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed | ReactiveFlags.Dirty | ReactiveFlags.Pending)) { 140 | sub.flags = flags | 32 satisfies ReactiveFlags.Pending; 141 | } else if (!(flags & 12 as ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed)) { 142 | flags = 0 satisfies ReactiveFlags.None; 143 | } else if (!(flags & 4 satisfies ReactiveFlags.RecursedCheck)) { 144 | sub.flags = (flags & ~(8 satisfies ReactiveFlags.Recursed)) | 32 satisfies ReactiveFlags.Pending; 145 | } else if (!(flags & 48 as ReactiveFlags.Dirty | ReactiveFlags.Pending) && isValidLink(link, sub)) { 146 | sub.flags = flags | 40 as ReactiveFlags.Recursed | ReactiveFlags.Pending; 147 | flags &= 1 satisfies ReactiveFlags.Mutable; 148 | } else { 149 | flags = 0 satisfies ReactiveFlags.None; 150 | } 151 | 152 | if (flags & 2 satisfies ReactiveFlags.Watching) { 153 | notify(sub); 154 | } 155 | 156 | if (flags & 1 satisfies ReactiveFlags.Mutable) { 157 | const subSubs = sub.subs; 158 | if (subSubs !== undefined) { 159 | link = subSubs; 160 | if (subSubs.nextSub !== undefined) { 161 | stack = { value: next, prev: stack }; 162 | next = link.nextSub; 163 | } 164 | continue; 165 | } 166 | } 167 | } 168 | 169 | if ((link = next!) !== undefined) { 170 | next = link.nextSub; 171 | continue; 172 | } 173 | 174 | while (stack !== undefined) { 175 | link = stack.value!; 176 | stack = stack.prev; 177 | if (link !== undefined) { 178 | next = link.nextSub; 179 | continue top; 180 | } 181 | } 182 | 183 | break; 184 | } while (true); 185 | } 186 | 187 | function startTracking(sub: ReactiveNode): void { 188 | sub.depsTail = undefined; 189 | sub.flags = (sub.flags & ~(56 as ReactiveFlags.Recursed | ReactiveFlags.Dirty | ReactiveFlags.Pending)) | 4 satisfies ReactiveFlags.RecursedCheck; 190 | } 191 | 192 | function endTracking(sub: ReactiveNode): void { 193 | const depsTail = sub.depsTail; 194 | let toRemove = depsTail !== undefined ? depsTail.nextDep : sub.deps; 195 | while (toRemove !== undefined) { 196 | toRemove = unlink(toRemove, sub); 197 | } 198 | sub.flags &= ~(4 satisfies ReactiveFlags.RecursedCheck); 199 | } 200 | 201 | function checkDirty(link: Link, sub: ReactiveNode): boolean { 202 | let stack: Stack | undefined; 203 | let checkDepth = 0; 204 | 205 | top: do { 206 | const dep = link.dep; 207 | const depFlags = dep.flags; 208 | 209 | let dirty = false; 210 | 211 | if (sub.flags & 16 satisfies ReactiveFlags.Dirty) { 212 | dirty = true; 213 | } else if ((depFlags & 17 as ReactiveFlags.Mutable | ReactiveFlags.Dirty) === 17 as ReactiveFlags.Mutable | ReactiveFlags.Dirty) { 214 | if (update(dep)) { 215 | const subs = dep.subs!; 216 | if (subs.nextSub !== undefined) { 217 | shallowPropagate(subs); 218 | } 219 | dirty = true; 220 | } 221 | } else if ((depFlags & 33 as ReactiveFlags.Mutable | ReactiveFlags.Pending) === 33 as ReactiveFlags.Mutable | ReactiveFlags.Pending) { 222 | if (link.nextSub !== undefined || link.prevSub !== undefined) { 223 | stack = { value: link, prev: stack }; 224 | } 225 | link = dep.deps!; 226 | sub = dep; 227 | ++checkDepth; 228 | continue; 229 | } 230 | 231 | if (!dirty && link.nextDep !== undefined) { 232 | link = link.nextDep; 233 | continue; 234 | } 235 | 236 | while (checkDepth) { 237 | --checkDepth; 238 | const firstSub = sub.subs!; 239 | const hasMultipleSubs = firstSub.nextSub !== undefined; 240 | if (hasMultipleSubs) { 241 | link = stack!.value; 242 | stack = stack!.prev; 243 | } else { 244 | link = firstSub; 245 | } 246 | if (dirty) { 247 | if (update(sub)) { 248 | if (hasMultipleSubs) { 249 | shallowPropagate(firstSub); 250 | } 251 | sub = link.sub; 252 | continue; 253 | } 254 | } else { 255 | sub.flags &= ~(32 satisfies ReactiveFlags.Pending); 256 | } 257 | sub = link.sub; 258 | if (link.nextDep !== undefined) { 259 | link = link.nextDep; 260 | continue top; 261 | } 262 | dirty = false; 263 | } 264 | 265 | return dirty; 266 | } while (true); 267 | } 268 | 269 | function shallowPropagate(link: Link): void { 270 | do { 271 | const sub = link.sub; 272 | const nextSub = link.nextSub; 273 | const subFlags = sub.flags; 274 | if ((subFlags & 48 as ReactiveFlags.Pending | ReactiveFlags.Dirty) === 32 satisfies ReactiveFlags.Pending) { 275 | sub.flags = subFlags | 16 satisfies ReactiveFlags.Dirty; 276 | if (subFlags & 2 satisfies ReactiveFlags.Watching) { 277 | notify(sub); 278 | } 279 | } 280 | link = nextSub!; 281 | } while (link !== undefined); 282 | } 283 | 284 | function isValidLink(checkLink: Link, sub: ReactiveNode): boolean { 285 | const depsTail = sub.depsTail; 286 | if (depsTail !== undefined) { 287 | let link = sub.deps!; 288 | do { 289 | if (link === checkLink) { 290 | return true; 291 | } 292 | if (link === depsTail) { 293 | break; 294 | } 295 | link = link.nextDep!; 296 | } while (link !== undefined); 297 | } 298 | return false; 299 | } 300 | } 301 | -------------------------------------------------------------------------------- /tests/build.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest'; 2 | import { test } from 'vitest'; 3 | 4 | declare function require(module: string): any; 5 | 6 | test('build: cjs', () => { 7 | const index = require('../cjs/index.cjs'); 8 | const system = require('../cjs/system.cjs'); 9 | 10 | expect(typeof index.createReactiveSystem).toBe('function'); 11 | expect(typeof system.createReactiveSystem).toBe('function'); 12 | }); 13 | 14 | test('build: esm', async () => { 15 | const index = await import('../esm/index.mjs'); 16 | const system = await import('../esm/system.mjs'); 17 | 18 | expect(typeof index.createReactiveSystem).toBe('function'); 19 | expect(typeof system.createReactiveSystem).toBe('function'); 20 | }); 21 | -------------------------------------------------------------------------------- /tests/computed.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest'; 2 | import { computed, signal } from '../src'; 3 | 4 | test('should correctly propagate changes through computed signals', () => { 5 | const src = signal(0); 6 | const c1 = computed(() => src() % 2); 7 | const c2 = computed(() => c1()); 8 | const c3 = computed(() => c2()); 9 | 10 | c3(); 11 | src(1); // c1 -> dirty, c2 -> toCheckDirty, c3 -> toCheckDirty 12 | c2(); // c1 -> none, c2 -> none 13 | src(3); // c1 -> dirty, c2 -> toCheckDirty 14 | 15 | expect(c3()).toBe(1); 16 | }); 17 | 18 | test('should propagate updated source value through chained computations', () => { 19 | const src = signal(0); 20 | const a = computed(() => src()); 21 | const b = computed(() => a() % 2); 22 | const c = computed(() => src()); 23 | const d = computed(() => b() + c()); 24 | 25 | expect(d()).toBe(0); 26 | src(2); 27 | expect(d()).toBe(2); 28 | }); 29 | 30 | test('should handle flags are indirectly updated during checkDirty', () => { 31 | const a = signal(false); 32 | const b = computed(() => a()); 33 | const c = computed(() => { 34 | b(); 35 | return 0; 36 | }); 37 | const d = computed(() => { 38 | c(); 39 | return b(); 40 | }); 41 | 42 | expect(d()).toBe(false); 43 | a(true); 44 | expect(d()).toBe(true); 45 | }); 46 | 47 | test('should not update if the signal value is reverted', () => { 48 | let times = 0; 49 | 50 | const src = signal(0); 51 | const c1 = computed(() => { 52 | times++; 53 | return src(); 54 | }); 55 | c1(); 56 | expect(times).toBe(1); 57 | src(1); 58 | src(0); 59 | c1(); 60 | expect(times).toBe(1); 61 | }); 62 | -------------------------------------------------------------------------------- /tests/effect.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest'; 2 | import { computed, effect, effectScope, endBatch, setCurrentSub, signal, startBatch } from '../src'; 3 | 4 | test('should clear subscriptions when untracked by all subscribers', () => { 5 | let bRunTimes = 0; 6 | 7 | const a = signal(1); 8 | const b = computed(() => { 9 | bRunTimes++; 10 | return a() * 2; 11 | }); 12 | const stopEffect = effect(() => { 13 | b(); 14 | }); 15 | 16 | expect(bRunTimes).toBe(1); 17 | a(2); 18 | expect(bRunTimes).toBe(2); 19 | stopEffect(); 20 | a(3); 21 | expect(bRunTimes).toBe(2); 22 | }); 23 | 24 | test('should not run untracked inner effect', () => { 25 | const a = signal(3); 26 | const b = computed(() => a() > 0); 27 | 28 | effect(() => { 29 | if (b()) { 30 | effect(() => { 31 | if (a() == 0) { 32 | throw new Error("bad"); 33 | } 34 | }); 35 | } 36 | }); 37 | 38 | a(2); 39 | a(1); 40 | a(0); 41 | }); 42 | 43 | test('should run outer effect first', () => { 44 | const a = signal(1); 45 | const b = signal(1); 46 | 47 | effect(() => { 48 | if (a()) { 49 | effect(() => { 50 | b(); 51 | if (a() == 0) { 52 | throw new Error("bad"); 53 | } 54 | }); 55 | } else { 56 | } 57 | }); 58 | 59 | startBatch(); 60 | b(0); 61 | a(0); 62 | endBatch(); 63 | }); 64 | 65 | test('should not trigger inner effect when resolve maybe dirty', () => { 66 | const a = signal(0); 67 | const b = computed(() => a() % 2); 68 | 69 | let innerTriggerTimes = 0; 70 | 71 | effect(() => { 72 | effect(() => { 73 | b(); 74 | innerTriggerTimes++; 75 | if (innerTriggerTimes >= 2) { 76 | throw new Error("bad"); 77 | } 78 | }); 79 | }); 80 | 81 | a(2); 82 | }); 83 | 84 | test('should trigger inner effects in sequence', () => { 85 | const a = signal(0); 86 | const b = signal(0); 87 | const c = computed(() => a() - b()); 88 | const order: string[] = []; 89 | 90 | effect(() => { 91 | c(); 92 | 93 | effect(() => { 94 | order.push('first inner'); 95 | a(); 96 | }); 97 | 98 | effect(() => { 99 | order.push('last inner'); 100 | a(); 101 | b(); 102 | }); 103 | }); 104 | 105 | order.length = 0; 106 | 107 | startBatch(); 108 | b(1); 109 | a(1); 110 | endBatch(); 111 | 112 | expect(order).toEqual(['first inner', 'last inner']); 113 | }); 114 | 115 | test('should trigger inner effects in sequence in effect scope', () => { 116 | const a = signal(0); 117 | const b = signal(0); 118 | const order: string[] = []; 119 | 120 | effectScope(() => { 121 | 122 | effect(() => { 123 | order.push('first inner'); 124 | a(); 125 | }); 126 | 127 | effect(() => { 128 | order.push('last inner'); 129 | a(); 130 | b(); 131 | }); 132 | }); 133 | 134 | order.length = 0; 135 | 136 | startBatch(); 137 | b(1); 138 | a(1); 139 | endBatch(); 140 | 141 | expect(order).toEqual(['first inner', 'last inner']); 142 | }); 143 | 144 | test('should custom effect support batch', () => { 145 | function batchEffect(fn: () => void) { 146 | return effect(() => { 147 | startBatch(); 148 | try { 149 | return fn(); 150 | } finally { 151 | endBatch(); 152 | } 153 | }); 154 | } 155 | 156 | const logs: string[] = []; 157 | const a = signal(0); 158 | const b = signal(0); 159 | 160 | const aa = computed(() => { 161 | logs.push('aa-0'); 162 | if (!a()) { 163 | b(1); 164 | } 165 | logs.push('aa-1'); 166 | }); 167 | 168 | const bb = computed(() => { 169 | logs.push('bb'); 170 | return b(); 171 | }); 172 | 173 | batchEffect(() => { 174 | bb(); 175 | }); 176 | batchEffect(() => { 177 | aa(); 178 | }); 179 | 180 | expect(logs).toEqual(['bb', 'aa-0', 'aa-1', 'bb']); 181 | }); 182 | 183 | test('should duplicate subscribers do not affect the notify order', () => { 184 | const src1 = signal(0); 185 | const src2 = signal(0); 186 | const order: string[] = []; 187 | 188 | effect(() => { 189 | order.push('a'); 190 | const currentSub = setCurrentSub(undefined); 191 | const isOne = src2() === 1; 192 | setCurrentSub(currentSub); 193 | if (isOne) { 194 | src1(); 195 | } 196 | src2(); 197 | src1(); 198 | }); 199 | effect(() => { 200 | order.push('b'); 201 | src1(); 202 | }); 203 | src2(1); // src1.subs: a -> b -> a 204 | 205 | order.length = 0; 206 | src1(src1() + 1); 207 | 208 | expect(order).toEqual(['a', 'b']); 209 | }); 210 | 211 | test('should handle side effect with inner effects', () => { 212 | const a = signal(0); 213 | const b = signal(0); 214 | const order: string[] = []; 215 | 216 | effect(() => { 217 | effect(() => { 218 | a(); 219 | order.push('a'); 220 | }); 221 | effect(() => { 222 | b(); 223 | order.push('b'); 224 | }); 225 | expect(order).toEqual(['a', 'b']); 226 | 227 | order.length = 0; 228 | b(1); 229 | a(1); 230 | expect(order).toEqual(['b', 'a']); 231 | }); 232 | }); 233 | 234 | test('should handle flags are indirectly updated during checkDirty', () => { 235 | const a = signal(false); 236 | const b = computed(() => a()); 237 | const c = computed(() => { 238 | b(); 239 | return 0; 240 | }); 241 | const d = computed(() => { 242 | c(); 243 | return b(); 244 | }); 245 | 246 | let triggers = 0; 247 | 248 | effect(() => { 249 | d(); 250 | triggers++; 251 | }); 252 | expect(triggers).toBe(1); 253 | a(true); 254 | expect(triggers).toBe(2); 255 | }); 256 | -------------------------------------------------------------------------------- /tests/effectScope.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest'; 2 | import { effect, effectScope, signal } from '../src'; 3 | 4 | test('should not trigger after stop', () => { 5 | const count = signal(1); 6 | 7 | let triggers = 0; 8 | let effect1; 9 | 10 | const stopScope = effectScope(() => { 11 | effect1 = effect(() => { 12 | triggers++; 13 | count(); 14 | }); 15 | expect(triggers).toBe(1); 16 | 17 | count(2); 18 | expect(triggers).toBe(2); 19 | }); 20 | 21 | count(3); 22 | expect(triggers).toBe(3); 23 | stopScope(); 24 | count(4); 25 | expect(triggers).toBe(3); 26 | }); 27 | 28 | test('should dispose inner effects if created in an effect', () => { 29 | const source = signal(1); 30 | 31 | let triggers = 0; 32 | 33 | effect(() => { 34 | const dispose = effectScope(() => { 35 | effect(() => { 36 | source(); 37 | triggers++; 38 | }); 39 | }); 40 | expect(triggers).toBe(1); 41 | 42 | source(2); 43 | expect(triggers).toBe(2); 44 | dispose(); 45 | source(3); 46 | expect(triggers).toBe(2); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /tests/issue_48.spec.ts: -------------------------------------------------------------------------------- 1 | import { test } from 'vitest'; 2 | import { computed, effect, setCurrentSub, signal } from '../src'; 3 | 4 | test('#48', () => { 5 | const source = signal(0); 6 | let disposeInner: () => void; 7 | 8 | reaction( 9 | () => source(), 10 | (val) => { 11 | if (val === 1) { 12 | disposeInner = reaction( 13 | () => source(), 14 | () => { } 15 | ); 16 | } else if (val === 2) { 17 | disposeInner!(); 18 | } 19 | } 20 | ); 21 | 22 | source(1); 23 | source(2); 24 | source(3); 25 | }); 26 | 27 | interface ReactionOptions { 28 | fireImmediately?: F; 29 | equals?: F extends true 30 | ? (a: T, b: T | undefined) => boolean 31 | : (a: T, b: T) => boolean; 32 | onError?: (error: unknown) => void; 33 | scheduler?: (fn: () => void) => void; 34 | once?: boolean; 35 | } 36 | 37 | function reaction( 38 | dataFn: () => T, 39 | effectFn: (newValue: T, oldValue: T | undefined) => void, 40 | options: ReactionOptions = {} 41 | ): () => void { 42 | const { 43 | scheduler = (fn) => fn(), 44 | equals = Object.is, 45 | onError, 46 | once = false, 47 | fireImmediately = false, 48 | } = options; 49 | 50 | let prevValue: T | undefined; 51 | let version = 0; 52 | 53 | const tracked = computed(() => { 54 | try { 55 | return dataFn(); 56 | } catch (error) { 57 | untracked(() => onError?.(error)); 58 | return prevValue!; 59 | } 60 | }); 61 | 62 | const dispose = effect(() => { 63 | const current = tracked(); 64 | if (!fireImmediately && !version) { 65 | prevValue = current; 66 | } 67 | version++; 68 | if (equals(current, prevValue!)) return; 69 | const oldValue = prevValue; 70 | prevValue = current; 71 | untracked(() => 72 | scheduler(() => { 73 | try { 74 | effectFn(current, oldValue); 75 | } catch (error) { 76 | onError?.(error); 77 | } finally { 78 | if (once) { 79 | if (fireImmediately && version > 1) dispose(); 80 | else if (!fireImmediately && version > 0) dispose(); 81 | } 82 | } 83 | }) 84 | ); 85 | }); 86 | 87 | return dispose; 88 | } 89 | 90 | function untracked(callback: () => T): T { 91 | const currentSub = setCurrentSub(undefined); 92 | try { 93 | return callback(); 94 | } finally { 95 | setCurrentSub(currentSub); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /tests/topology.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test, vi, describe } from 'vitest'; 2 | import {computed, effect, signal} from '../src'; 3 | 4 | // To give access to .toHaveBeenCalledBefore() 5 | import * as matchers from 'jest-extended'; 6 | 7 | expect.extend(matchers); 8 | 9 | /** Tests adopted with thanks from preact-signals implementation at 10 | * https://github.com/preactjs/signals/blob/main/packages/core/test/signal.test.tsx 11 | * 12 | * The MIT License (MIT) 13 | * 14 | * Copyright (c) 2022-present Preact Team 15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, and to permit persons to whom the Software is 21 | * furnished to do so, subject to the following conditions: 22 | * 23 | * The above copyright notice and this permission notice shall be included in all 24 | * copies or substantial portions of the Software. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE 33 | */ 34 | 35 | describe("graph updates", () => { 36 | 37 | test('should drop A->B->A updates', () => { 38 | // A 39 | // / | 40 | // B | <- Looks like a flag doesn't it? :D 41 | // \ | 42 | // C 43 | // | 44 | // D 45 | const a = signal(2); 46 | 47 | const b = computed(() => a() - 1); 48 | const c = computed(() => a() + b()); 49 | 50 | const compute = vi.fn(() => "d: " + c()); 51 | const d = computed(compute); 52 | 53 | // Trigger read 54 | expect(d()).toBe("d: 3"); 55 | expect(compute).toHaveBeenCalledOnce(); 56 | compute.mockClear(); 57 | 58 | a(4); 59 | d(); 60 | expect(compute).toHaveBeenCalledOnce(); 61 | }); 62 | 63 | test('should only update every signal once (diamond graph)', () => { 64 | // In this scenario "D" should only update once when "A" receives 65 | // an update. This is sometimes referred to as the "diamond" scenario. 66 | // A 67 | // / \ 68 | // B C 69 | // \ / 70 | // D 71 | 72 | const a = signal("a"); 73 | const b = computed(() => a()); 74 | const c = computed(() => a()); 75 | 76 | const spy = vi.fn(() => b() + " " + c()); 77 | const d = computed(spy); 78 | 79 | expect(d()).toBe("a a"); 80 | expect(spy).toHaveBeenCalledOnce(); 81 | 82 | a("aa"); 83 | expect(d()).toBe("aa aa"); 84 | expect(spy).toHaveBeenCalledTimes(2); 85 | }); 86 | 87 | test('should only update every signal once (diamond graph + tail)', () => { 88 | // "E" will be likely updated twice if our mark+sweep logic is buggy. 89 | // A 90 | // / \ 91 | // B C 92 | // \ / 93 | // D 94 | // | 95 | // E 96 | 97 | const a = signal("a"); 98 | const b = computed(() => a()); 99 | const c = computed(() => a()); 100 | 101 | const d = computed(() => b() + " " + c()); 102 | 103 | const spy = vi.fn(() => d()); 104 | const e = computed(spy); 105 | 106 | expect(e()).toBe("a a"); 107 | expect(spy).toHaveBeenCalledOnce(); 108 | 109 | a("aa"); 110 | expect(e()).toBe("aa aa"); 111 | expect(spy).toHaveBeenCalledTimes(2); 112 | }); 113 | 114 | test('should bail out if result is the same', () => { 115 | // Bail out if value of "B" never changes 116 | // A->B->C 117 | const a = signal("a"); 118 | const b = computed(() => { 119 | a(); 120 | return "foo"; 121 | }); 122 | 123 | const spy = vi.fn(() => b()); 124 | const c = computed(spy); 125 | 126 | expect(c()).toBe("foo"); 127 | expect(spy).toHaveBeenCalledOnce(); 128 | 129 | a("aa"); 130 | expect(c()).toBe("foo"); 131 | expect(spy).toHaveBeenCalledOnce(); 132 | }); 133 | 134 | test('should only update every signal once (jagged diamond graph + tails)', () => { 135 | // "F" and "G" will be likely updated twice if our mark+sweep logic is buggy. 136 | // A 137 | // / \ 138 | // B C 139 | // | | 140 | // | D 141 | // \ / 142 | // E 143 | // / \ 144 | // F G 145 | const a = signal("a"); 146 | 147 | const b = computed(() => a()); 148 | const c = computed(() => a()); 149 | 150 | const d = computed(() => c()); 151 | 152 | const eSpy = vi.fn(() => b() + " " + d()); 153 | const e = computed(eSpy); 154 | 155 | const fSpy = vi.fn(() => e()); 156 | const f = computed(fSpy); 157 | const gSpy = vi.fn(() => e()); 158 | const g = computed(gSpy); 159 | 160 | expect(f()).toBe("a a"); 161 | expect(fSpy).toHaveBeenCalledTimes(1); 162 | 163 | expect(g()).toBe("a a"); 164 | expect(gSpy).toHaveBeenCalledTimes(1); 165 | 166 | eSpy.mockClear(); 167 | fSpy.mockClear(); 168 | gSpy.mockClear(); 169 | 170 | a("b"); 171 | 172 | expect(e()).toBe("b b"); 173 | expect(eSpy).toHaveBeenCalledTimes(1); 174 | 175 | expect(f()).toBe("b b"); 176 | expect(fSpy).toHaveBeenCalledTimes(1); 177 | 178 | expect(g()).toBe("b b"); 179 | expect(gSpy).toHaveBeenCalledTimes(1); 180 | 181 | eSpy.mockClear(); 182 | fSpy.mockClear(); 183 | gSpy.mockClear(); 184 | 185 | a("c"); 186 | 187 | expect(e()).toBe("c c"); 188 | expect(eSpy).toHaveBeenCalledTimes(1); 189 | 190 | expect(f()).toBe("c c"); 191 | expect(fSpy).toHaveBeenCalledTimes(1); 192 | 193 | expect(g()).toBe("c c"); 194 | expect(gSpy).toHaveBeenCalledTimes(1); 195 | 196 | // top to bottom 197 | expect(eSpy).toHaveBeenCalledBefore(fSpy); 198 | // left to right 199 | expect(fSpy).toHaveBeenCalledBefore(gSpy); 200 | }); 201 | 202 | test('should only subscribe to signals listened to', () => { 203 | // *A 204 | // / \ 205 | // *B C <- we don't listen to C 206 | const a = signal("a"); 207 | 208 | const b = computed(() => a()); 209 | const spy = vi.fn(() => a()); 210 | computed(spy); 211 | 212 | expect(b()).toBe("a"); 213 | expect(spy).not.toHaveBeenCalled(); 214 | 215 | a("aa"); 216 | expect(b()).toBe("aa"); 217 | expect(spy).not.toHaveBeenCalled(); 218 | }); 219 | 220 | test('should only subscribe to signals listened to II', () => { 221 | // Here both "B" and "C" are active in the beginning, but 222 | // "B" becomes inactive later. At that point it should 223 | // not receive any updates anymore. 224 | // *A 225 | // / \ 226 | // *B D <- we don't listen to C 227 | // | 228 | // *C 229 | const a = signal("a"); 230 | const spyB = vi.fn(() => a()); 231 | const b = computed(spyB); 232 | 233 | const spyC = vi.fn(() => b()); 234 | const c = computed(spyC); 235 | 236 | const d = computed(() => a()); 237 | 238 | let result = ""; 239 | const unsub = effect(() => { 240 | result = c(); 241 | }); 242 | 243 | expect(result).toBe("a"); 244 | expect(d()).toBe("a"); 245 | 246 | spyB.mockClear(); 247 | spyC.mockClear(); 248 | unsub(); 249 | 250 | a("aa"); 251 | 252 | expect(spyB).not.toHaveBeenCalled(); 253 | expect(spyC).not.toHaveBeenCalled(); 254 | expect(d()).toBe("aa"); 255 | }); 256 | 257 | test('should ensure subs update even if one dep unmarks it', () => { 258 | // In this scenario "C" always returns the same value. When "A" 259 | // changes, "B" will update, then "C" at which point its update 260 | // to "D" will be unmarked. But "D" must still update because 261 | // "B" marked it. If "D" isn't updated, then we have a bug. 262 | // A 263 | // / \ 264 | // B *C <- returns same value every time 265 | // \ / 266 | // D 267 | const a = signal("a"); 268 | const b = computed(() => a()); 269 | const c = computed(() => { 270 | a(); 271 | return "c"; 272 | }); 273 | const spy = vi.fn(() => b() + " " + c()); 274 | const d = computed(spy); 275 | 276 | expect(d()).toBe("a c"); 277 | spy.mockClear(); 278 | 279 | a("aa"); 280 | d(); 281 | expect(spy).toHaveReturnedWith("aa c"); 282 | }); 283 | 284 | test('should ensure subs update even if two deps unmark it', () => { 285 | // In this scenario both "C" and "D" always return the same 286 | // value. But "E" must still update because "A" marked it. 287 | // If "E" isn't updated, then we have a bug. 288 | // A 289 | // / | \ 290 | // B *C *D 291 | // \ | / 292 | // E 293 | const a = signal("a"); 294 | const b = computed(() => a()); 295 | const c = computed(() => { 296 | a(); 297 | return "c"; 298 | }); 299 | const d = computed(() => { 300 | a(); 301 | return "d"; 302 | }); 303 | const spy = vi.fn(() => b() + " " + c() + " " + d()); 304 | const e = computed(spy); 305 | 306 | expect(e()).toBe("a c d"); 307 | spy.mockClear(); 308 | 309 | a("aa"); 310 | e(); 311 | expect(spy).toHaveReturnedWith("aa c d"); 312 | }); 313 | 314 | test('should support lazy branches', () => { 315 | const a = signal(0); 316 | const b = computed(() => a()); 317 | const c = computed(() => (a() > 0 ? a() : b())); 318 | 319 | expect(c()).toBe(0); 320 | a(1); 321 | expect(c()).toBe(1); 322 | 323 | a(0); 324 | expect(c()).toBe(0); 325 | }); 326 | 327 | test('should not update a sub if all deps unmark it', () => { 328 | // In this scenario "B" and "C" always return the same value. When "A" 329 | // changes, "D" should not update. 330 | // A 331 | // / \ 332 | // *B *C 333 | // \ / 334 | // D 335 | const a = signal("a"); 336 | const b = computed(() => { 337 | a(); 338 | return "b"; 339 | }); 340 | const c = computed(() => { 341 | a(); 342 | return "c"; 343 | }); 344 | const spy = vi.fn(() => b() + " " + c()); 345 | const d = computed(spy); 346 | 347 | expect(d()).toBe("b c"); 348 | spy.mockClear(); 349 | 350 | a("aa"); 351 | expect(spy).not.toHaveBeenCalled(); 352 | }); 353 | 354 | }); 355 | 356 | describe("error handling", () => { 357 | 358 | test('should keep graph consistent on errors during activation', () => { 359 | const a = signal(0); 360 | const b = computed(() => { 361 | throw new Error("fail"); 362 | }); 363 | const c = computed(() => a()); 364 | 365 | expect(() => b()).toThrow("fail"); 366 | 367 | a(1); 368 | expect(c()).toBe(1); 369 | }); 370 | 371 | test('should keep graph consistent on errors in computeds', () => { 372 | const a = signal(0); 373 | const b = computed(() => { 374 | if (a() === 1) throw new Error("fail"); 375 | return a(); 376 | }); 377 | const c = computed(() => b()); 378 | 379 | expect(c()).toBe(0); 380 | 381 | a(1); 382 | expect(() => b()).toThrow("fail"); 383 | 384 | a(2); 385 | expect(c()).toBe(2); 386 | }); 387 | 388 | }); 389 | -------------------------------------------------------------------------------- /tests/untrack.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'vitest'; 2 | import { computed, effect, effectScope, setCurrentSub, signal } from '../src'; 3 | 4 | test('should pause tracking in computed', () => { 5 | const src = signal(0); 6 | 7 | let computedTriggerTimes = 0; 8 | const c = computed(() => { 9 | computedTriggerTimes++; 10 | const currentSub = setCurrentSub(undefined); 11 | const value = src(); 12 | setCurrentSub(currentSub); 13 | return value; 14 | }); 15 | 16 | expect(c()).toBe(0); 17 | expect(computedTriggerTimes).toBe(1); 18 | 19 | src(1), src(2), src(3); 20 | expect(c()).toBe(0); 21 | expect(computedTriggerTimes).toBe(1); 22 | }); 23 | 24 | test('should pause tracking in effect', () => { 25 | const src = signal(0); 26 | const is = signal(0); 27 | 28 | let effectTriggerTimes = 0; 29 | effect(() => { 30 | effectTriggerTimes++; 31 | if (is()) { 32 | const currentSub = setCurrentSub(undefined); 33 | src(); 34 | setCurrentSub(currentSub); 35 | } 36 | }); 37 | 38 | expect(effectTriggerTimes).toBe(1); 39 | 40 | is(1); 41 | expect(effectTriggerTimes).toBe(2); 42 | 43 | src(1), src(2), src(3); 44 | expect(effectTriggerTimes).toBe(2); 45 | 46 | is(2); 47 | expect(effectTriggerTimes).toBe(3); 48 | 49 | src(4), src(5), src(6); 50 | expect(effectTriggerTimes).toBe(3); 51 | 52 | is(0); 53 | expect(effectTriggerTimes).toBe(4); 54 | 55 | src(7), src(8), src(9); 56 | expect(effectTriggerTimes).toBe(4); 57 | }); 58 | 59 | test('should pause tracking in effect scope', () => { 60 | const src = signal(0); 61 | 62 | let effectTriggerTimes = 0; 63 | effectScope(() => { 64 | effect(() => { 65 | effectTriggerTimes++; 66 | const currentSub = setCurrentSub(undefined); 67 | src(); 68 | setCurrentSub(currentSub); 69 | }); 70 | }); 71 | 72 | expect(effectTriggerTimes).toBe(1); 73 | 74 | src(1), src(2), src(3); 75 | expect(effectTriggerTimes).toBe(1); 76 | }); -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "strict": true, 5 | "noUnusedLocals": true, 6 | "noUnusedParameters": true, 7 | "skipLibCheck": true, 8 | "rootDir": "src", 9 | }, 10 | "include": [ "src" ], 11 | } 12 | -------------------------------------------------------------------------------- /tsslint.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from '@tsslint/config'; 2 | import type * as ts from 'typescript'; 3 | 4 | export default defineConfig({ 5 | rules: { 6 | 'number-equality'({ 7 | typescript: ts, 8 | sourceFile, 9 | reportWarning, 10 | languageService, 11 | }) { 12 | const checker = languageService.getProgram()!.getTypeChecker(); 13 | ts.forEachChild(sourceFile, function visit(node) { 14 | if ( 15 | ts.isBinaryExpression(node) && 16 | node.operatorToken.kind === ts.SyntaxKind.EqualsEqualsEqualsToken && 17 | ts.isNumericLiteral(node.right) && 18 | node.right.text === '0' 19 | ) { 20 | const type = checker.getTypeAtLocation(node.left); 21 | if (type.flags & ts.TypeFlags.Number) { 22 | reportWarning( 23 | `Replace "x === 0" with "!x" for numeric variables to clarify boolean usage.`, 24 | node.getStart(sourceFile), 25 | node.getEnd(), 26 | ).withFix('Use exclamation instead', () => [ 27 | { 28 | fileName: sourceFile.fileName, 29 | textChanges: [ 30 | { 31 | newText: `!(${node.left.getText(sourceFile)})`, 32 | span: { 33 | start: node.getStart(sourceFile), 34 | length: node.getWidth(), 35 | }, 36 | }, 37 | ], 38 | }, 39 | ]); 40 | } 41 | } 42 | ts.forEachChild(node, visit); 43 | }); 44 | }, 45 | 'object-equality'({ 46 | typescript: ts, 47 | sourceFile, 48 | reportWarning, 49 | languageService, 50 | }) { 51 | const checker = languageService.getProgram()!.getTypeChecker(); 52 | const checkFlags = [ts.TypeFlags.Undefined, ts.TypeFlags.Null]; 53 | ts.forEachChild(sourceFile, function visit(node) { 54 | if ( 55 | ts.isPrefixUnaryExpression(node) && 56 | node.operator === ts.SyntaxKind.ExclamationToken 57 | ) { 58 | const type = checker.getTypeAtLocation(node.operand); 59 | for (const checkFlag of checkFlags) { 60 | if (isObjectOrNullableUnion(ts, type, checkFlag)) { 61 | const flagText = 62 | checkFlag === ts.TypeFlags.Undefined ? 'undefined' : 'null'; 63 | if ( 64 | ts.isPrefixUnaryExpression(node.parent) && 65 | node.parent.operator === ts.SyntaxKind.ExclamationToken 66 | ) { 67 | reportWarning( 68 | `Do not use "!!" for a variable of type "object | ${flagText}". Replace with "!== ${flagText}" for clarity.`, 69 | node.parent.getStart(sourceFile), 70 | node.getEnd(), 71 | ).withFix(`Replace with !== ${flagText}`, () => [ 72 | { 73 | fileName: sourceFile.fileName, 74 | textChanges: [ 75 | { 76 | newText: `${node.operand.getText(sourceFile)} !== ${flagText}`, 77 | span: { 78 | start: node.parent.getStart(sourceFile), 79 | length: 80 | node.getEnd() - node.parent.getStart(sourceFile), 81 | }, 82 | }, 83 | ], 84 | }, 85 | ]); 86 | } else { 87 | reportWarning( 88 | `Do not use "!" for a variable of type "object | ${flagText}". Replace with "=== ${flagText}" for clarity.`, 89 | node.getStart(sourceFile), 90 | node.getEnd(), 91 | ).withFix(`Replace with === ${flagText}`, () => [ 92 | { 93 | fileName: sourceFile.fileName, 94 | textChanges: [ 95 | { 96 | newText: `${node.operand.getText(sourceFile)} === ${flagText}`, 97 | span: { 98 | start: node.getStart(sourceFile), 99 | length: node.getWidth(), 100 | }, 101 | }, 102 | ], 103 | }, 104 | ]); 105 | } 106 | } 107 | } 108 | } 109 | ts.forEachChild(node, visit); 110 | }); 111 | }, 112 | }, 113 | }); 114 | 115 | function isObjectOrNullableUnion( 116 | ts: typeof import('typescript'), 117 | type: ts.Type, 118 | nullableFlag: ts.TypeFlags, 119 | ) { 120 | if (!(type.flags & ts.TypeFlags.Union)) return false; 121 | const unionType = type; 122 | let hasObject = false; 123 | let hasNullable = false; 124 | for (const sub of (unionType as ts.UnionType).types) { 125 | if (sub.flags & nullableFlag) { 126 | hasNullable = true; 127 | } else if (sub.flags & ts.TypeFlags.Object) { 128 | hasObject = true; 129 | } else { 130 | return false; 131 | } 132 | } 133 | return hasObject && hasNullable; 134 | } 135 | --------------------------------------------------------------------------------