From d867e84fd491ef60468bb8af6dae30ba281b9fe3 Mon Sep 17 00:00:00 2001 From: Surmon Date: Thu, 5 Sep 2024 22:30:13 +0800 Subject: [PATCH] feat: v1.0.0 --- package.json | 8 +- pnpm-lock.yaml | 570 +++++++++-------------------------- src/_utils.ts | 45 --- src/watch-bak/patch.ts | 83 ----- src/watch-bak/type.ts | 21 -- src/watch-bak/watch.ts | 285 ------------------ src/watch-bak/watchEffect.ts | 113 ------- tests/effectScope.spec.ts | 16 +- tests/watch.spec.ts | 15 +- tests/watchEffect.spec.ts | 14 +- vite.config.ts | 2 +- 11 files changed, 180 insertions(+), 992 deletions(-) delete mode 100644 src/watch-bak/patch.ts delete mode 100644 src/watch-bak/type.ts delete mode 100644 src/watch-bak/watch.ts delete mode 100644 src/watch-bak/watchEffect.ts diff --git a/package.json b/package.json index da05bc6..c6b370c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "veact", - "version": "1.0.0-rc.1", + "version": "1.0.0", "description": "Mutable state enhancer library for React by @vue/reactivity", "keywords": [ "React", @@ -50,7 +50,7 @@ "react-dom": "^16.8.0 || ^17 || ^18 || ^19" }, "dependencies": { - "@vue/reactivity": "^3.5.0-rc.1" + "@vue/reactivity": ">=3.5" }, "devDependencies": { "@eslint/js": "^9.x", @@ -64,14 +64,14 @@ "eslint-config-prettier": "^9.x", "eslint-plugin-prettier": "^5.x", "globals": "^15.9.0", - "jsdom": "^25.x", + "happy-dom": "^15.x", "prettier": "^3.x", "react": "^18.x", "react-dom": "^18.x", "typescript": "^5.5.4", "typescript-eslint": "^8.x", "vite": "^5.x", - "vite-plugin-dts": "^4.0.3", + "vite-plugin-dts": "^4.1.0", "vitest": "^2.x" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ad83717..5d20d2b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@vue/reactivity': - specifier: ^3.5.0-rc.1 - version: 3.5.0-rc.1 + specifier: '>=3.5' + version: 3.5.2 devDependencies: '@eslint/js': specifier: ^9.x @@ -29,10 +29,10 @@ importers: version: 18.3.0 '@vitejs/plugin-react': specifier: ^4.x - version: 4.3.1(vite@5.4.2) + version: 4.3.1(vite@5.4.3) '@vitest/coverage-v8': specifier: ^2.0.5 - version: 2.0.5(vitest@2.0.5(jsdom@25.0.0)) + version: 2.0.5(vitest@2.0.5(happy-dom@15.7.3)) eslint: specifier: ^9.x version: 9.9.1 @@ -45,9 +45,9 @@ importers: globals: specifier: ^15.9.0 version: 15.9.0 - jsdom: - specifier: ^25.x - version: 25.0.0 + happy-dom: + specifier: ^15.x + version: 15.7.3 prettier: specifier: ^3.x version: 3.3.3 @@ -62,16 +62,16 @@ importers: version: 5.5.4 typescript-eslint: specifier: ^8.x - version: 8.3.0(eslint@9.9.1)(typescript@5.5.4) + version: 8.4.0(eslint@9.9.1)(typescript@5.5.4) vite: specifier: ^5.x - version: 5.4.2 + version: 5.4.3 vite-plugin-dts: - specifier: ^4.0.3 - version: 4.0.3(rollup@4.21.2)(typescript@5.5.4)(vite@5.4.2) + specifier: ^4.1.0 + version: 4.1.0(rollup@4.21.2)(typescript@5.5.4)(vite@5.4.3) vitest: specifier: ^2.x - version: 2.0.5(jsdom@25.0.0) + version: 2.0.5(happy-dom@15.7.3) packages: @@ -570,8 +570,8 @@ packages: '@types/react@18.3.5': resolution: {integrity: sha512-WeqMfGJLGuLCqHGYRGHxnKrXcTitc6L/nBUWfWPcTarG3t9PsquqUMuVeXZeca+mglY4Vo5GZjCi0A3Or2lnxA==} - '@typescript-eslint/eslint-plugin@8.3.0': - resolution: {integrity: sha512-FLAIn63G5KH+adZosDYiutqkOkYEx0nvcwNNfJAf+c7Ae/H35qWwTYvPZUKFj5AS+WfHG/WJJfWnDnyNUlp8UA==} + '@typescript-eslint/eslint-plugin@8.4.0': + resolution: {integrity: sha512-rg8LGdv7ri3oAlenMACk9e+AR4wUV0yrrG+XKsGKOK0EVgeEDqurkXMPILG2836fW4ibokTB5v4b6Z9+GYQDEw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 @@ -581,8 +581,8 @@ packages: typescript: optional: true - '@typescript-eslint/parser@8.3.0': - resolution: {integrity: sha512-h53RhVyLu6AtpUzVCYLPhZGL5jzTD9fZL+SYf/+hYOx2bDkyQXztXSc4tbvKYHzfMXExMLiL9CWqJmVz6+78IQ==} + '@typescript-eslint/parser@8.4.0': + resolution: {integrity: sha512-NHgWmKSgJk5K9N16GIhQ4jSobBoJwrmURaLErad0qlLjrpP5bECYg+wxVTGlGZmJbU03jj/dfnb6V9bw+5icsA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -591,12 +591,12 @@ packages: typescript: optional: true - '@typescript-eslint/scope-manager@8.3.0': - resolution: {integrity: sha512-mz2X8WcN2nVu5Hodku+IR8GgCOl4C0G/Z1ruaWN4dgec64kDBabuXyPAr+/RgJtumv8EEkqIzf3X2U5DUKB2eg==} + '@typescript-eslint/scope-manager@8.4.0': + resolution: {integrity: sha512-n2jFxLeY0JmKfUqy3P70rs6vdoPjHK8P/w+zJcV3fk0b0BwRXC/zxRTEnAsgYT7MwdQDt/ZEbtdzdVC+hcpF0A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@8.3.0': - resolution: {integrity: sha512-wrV6qh//nLbfXZQoj32EXKmwHf4b7L+xXLrP3FZ0GOUU72gSvLjeWUl5J5Ue5IwRxIV1TfF73j/eaBapxx99Lg==} + '@typescript-eslint/type-utils@8.4.0': + resolution: {integrity: sha512-pu2PAmNrl9KX6TtirVOrbLPLwDmASpZhK/XU7WvoKoCUkdtq9zF7qQ7gna0GBZFN0hci0vHaSusiL2WpsQk37A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -604,12 +604,12 @@ packages: typescript: optional: true - '@typescript-eslint/types@8.3.0': - resolution: {integrity: sha512-y6sSEeK+facMaAyixM36dQ5NVXTnKWunfD1Ft4xraYqxP0lC0POJmIaL/mw72CUMqjY9qfyVfXafMeaUj0noWw==} + '@typescript-eslint/types@8.4.0': + resolution: {integrity: sha512-T1RB3KQdskh9t3v/qv7niK6P8yvn7ja1mS7QK7XfRVL6wtZ8/mFs/FHf4fKvTA0rKnqnYxl/uHFNbnEt0phgbw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.3.0': - resolution: {integrity: sha512-Mq7FTHl0R36EmWlCJWojIC1qn/ZWo2YiWYc1XVtasJ7FIgjo0MVv9rZWXEE7IK2CGrtwe1dVOxWwqXUdNgfRCA==} + '@typescript-eslint/typescript-estree@8.4.0': + resolution: {integrity: sha512-kJ2OIP4dQw5gdI4uXsaxUZHRwWAGpREJ9Zq6D5L0BweyOrWsL6Sz0YcAZGWhvKnH7fm1J5YFE1JrQL0c9dd53A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -617,14 +617,14 @@ packages: typescript: optional: true - '@typescript-eslint/utils@8.3.0': - resolution: {integrity: sha512-F77WwqxIi/qGkIGOGXNBLV7nykwfjLsdauRB/DOFPdv6LTF3BHHkBpq81/b5iMPSF055oO2BiivDJV4ChvNtXA==} + '@typescript-eslint/utils@8.4.0': + resolution: {integrity: sha512-swULW8n1IKLjRAgciCkTCafyTHHfwVQFt8DovmaF69sKbOxTSFMmIZaSHjqO9i/RV0wIblaawhzvtva8Nmm7lQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 - '@typescript-eslint/visitor-keys@8.3.0': - resolution: {integrity: sha512-RmZwrTbQ9QveF15m/Cl28n0LXD6ea2CjkhH5rQ55ewz3H24w+AMCJHPVYaZ8/0HoG8Z3cLLFFycRXxeO2tz9FA==} + '@typescript-eslint/visitor-keys@8.4.0': + resolution: {integrity: sha512-zTQD6WLNTre1hj5wp09nBIDiOc2U5r/qmzo7wxPn4ZgAjHql09EofqhF9WF+fZHzL5aCyaIpPcT2hyxl73kr9A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@vitejs/plugin-react@4.3.1': @@ -656,20 +656,20 @@ packages: '@vitest/utils@2.0.5': resolution: {integrity: sha512-d8HKbqIcya+GR67mkZbrzhS5kKhtp8dQLcmRZLGTscGVg7yImT82cIrhtn2L8+VujWcy6KZweApgNmPsTAO/UQ==} - '@volar/language-core@2.4.1': - resolution: {integrity: sha512-9AKhC7Qn2mQYxj7Dz3bVxeOk7gGJladhWixUYKef/o0o7Bm4an+A3XvmcTHVqZ8stE6lBVH++g050tBtJ4TZPQ==} + '@volar/language-core@2.4.2': + resolution: {integrity: sha512-sONt5RLvLL1SlBdhyUSthZzuKePbJ7DwFFB9zT0eyWpDl+v7GXGh/RkPxxWaR22bIhYtTzp4Ka1MWatl/53Riw==} - '@volar/source-map@2.4.1': - resolution: {integrity: sha512-Xq6ep3OZg9xUqN90jEgB9ztX5SsTz1yiV8wiQbcYNjWkek+Ie3dc8l7AVt3EhDm9mSIR58oWczHkzM2H6HIsmQ==} + '@volar/source-map@2.4.2': + resolution: {integrity: sha512-qiGfGgeZ5DEarPX3S+HcFktFCjfDrFPCXKeXNbrlB7v8cvtPRm8YVwoXOdGG1NhaL5rMlv5BZPVQyu4EdWWIvA==} - '@volar/typescript@2.4.1': - resolution: {integrity: sha512-UoRzC0PXcwajFQTu8XxKSYNsWNBtVja6Y9gC8eLv7kYm+UEKJCcZ8g7dialsOYA0HKs3Vpg57MeCsawFLC6m9Q==} + '@volar/typescript@2.4.2': + resolution: {integrity: sha512-m2uZduhaHO1SZuagi30OsjI/X1gwkaEAC+9wT/nCNAtJ5FqXEkKvUncHmffG7ESDZPlFFUBK4vJ0D9Hfr+f2EA==} - '@vue/compiler-core@3.4.38': - resolution: {integrity: sha512-8IQOTCWnLFqfHzOGm9+P8OPSEDukgg3Huc92qSG49if/xI2SAwLHQO2qaPQbjCWPBcQoO1WYfXfTACUrWV3c5A==} + '@vue/compiler-core@3.5.2': + resolution: {integrity: sha512-1aP7FL2GkqfcskHWGg3lfWQpJnrmewKc+rNJ/hq9WNaAw4BEyJ5QbNChnqmbw+tJ409zdy1XWmUeXXMrCKJcQQ==} - '@vue/compiler-dom@3.4.38': - resolution: {integrity: sha512-Osc/c7ABsHXTsETLgykcOwIxFktHfGSUDkb05V61rocEfsFDcjDLH/IHJSNJP+/Sv9KeN2Lx1V6McZzlSb9EhQ==} + '@vue/compiler-dom@3.5.2': + resolution: {integrity: sha512-QY4DpT8ZIUyu/ZA5gErpSEDocGNEbHmpkZIC/d5jbp/rUF0iOJNigAy3HCCKc0PMMhDlrcysO3ufQ6Ab4MpEcQ==} '@vue/compiler-vue2@2.7.16': resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==} @@ -682,14 +682,11 @@ packages: typescript: optional: true - '@vue/reactivity@3.5.0-rc.1': - resolution: {integrity: sha512-aE5Yvz/2oez2b02LvB9INUQLhjAMYYK87LjvzKkCDXjBQOdW8vzATJ4MJ1Rxm9RdNN5KQI8yK8F2hStycvULWg==} - - '@vue/shared@3.4.38': - resolution: {integrity: sha512-q0xCiLkuWWQLzVrecPb0RMsNWyxICOjPrcrwxTUEHb1fsnvni4dcuyG7RT/Ie7VPTvnjzIaWzRMUBsrqNj/hhw==} + '@vue/reactivity@3.5.2': + resolution: {integrity: sha512-lJwWL5bNht+2vIwU/+lnGdH+FKFxzz6z8WkoIJityPLiasWU+HDUvEsC7gm3JFwbTf7Kk+Nr9kJMaPy0HXwwxQ==} - '@vue/shared@3.5.0-rc.1': - resolution: {integrity: sha512-iulYMVPJ+gYaK+PjkM7mNXr+DKkniGH0F3LyuyBak3X2amiG/gMDbnqTEH5ScTbV5DuzpQJMuFgW6VtIzKprTg==} + '@vue/shared@3.5.2': + resolution: {integrity: sha512-Ce89WNFBzcDca/AgFTxgX4/K4iAyF7oFIp8Z5aBbFBNbtpwnQr+5pZOoHndxnjE2h+YFcipVMzs9UL11XB6dwA==} acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} @@ -701,10 +698,6 @@ packages: engines: {node: '>=0.4.0'} hasBin: true - agent-base@7.1.1: - resolution: {integrity: sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==} - engines: {node: '>= 14'} - ajv-draft-04@1.0.0: resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==} peerDependencies: @@ -767,9 +760,6 @@ packages: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} - asynckit@0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -796,8 +786,8 @@ packages: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} - caniuse-lite@1.0.30001655: - resolution: {integrity: sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg==} + caniuse-lite@1.0.30001657: + resolution: {integrity: sha512-DPbJAlP8/BAXy3IgiWmZKItubb3TYGP0WscQQlVGIfT4s/YlFYVuJgyOsQNP7rJRChx/qdMeLJQJP0Sgg2yjNA==} chai@5.1.1: resolution: {integrity: sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA==} @@ -828,10 +818,6 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - combined-stream@1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} - compare-versions@6.1.1: resolution: {integrity: sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==} @@ -851,17 +837,9 @@ packages: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} - cssstyle@4.0.1: - resolution: {integrity: sha512-8ZYiJ3A/3OkDd093CBT/0UKDWry7ak4BdPTFP2+QEP7cmhouyq/Up709ASSj2cK02BbZiMgk7kYjZNS4QP5qrQ==} - engines: {node: '>=18'} - csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} - data-urls@5.0.0: - resolution: {integrity: sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==} - engines: {node: '>=18'} - de-indent@1.0.2: resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==} @@ -874,9 +852,6 @@ packages: supports-color: optional: true - decimal.js@10.4.3: - resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} - deep-eql@5.0.2: resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} engines: {node: '>=6'} @@ -884,10 +859,6 @@ packages: deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} - delayed-stream@1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} - dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} @@ -898,8 +869,8 @@ packages: eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - electron-to-chromium@1.5.13: - resolution: {integrity: sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q==} + electron-to-chromium@1.5.14: + resolution: {integrity: sha512-bEfPECb3fJ15eaDnu9LEJ2vPGD6W1vt7vZleSVyFhYuMIKm3vz/g9lt7IvEzgdwj58RjbPKUF2rXTCN/UW47tQ==} emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -1042,10 +1013,6 @@ packages: resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} engines: {node: '>=14'} - form-data@4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} - engines: {node: '>= 6'} - fs-extra@7.0.1: resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} engines: {node: '>=6 <7 || >=8'} @@ -1099,6 +1066,10 @@ packages: graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + happy-dom@15.7.3: + resolution: {integrity: sha512-w3RUaYNXFJX5LiNVhOJLK4GqCB1bFj1FvELtpon3HrN8gUpS09V0Vvm4/BBRRj7mLUE1+ch8PKv1JxEp/0IHjA==} + engines: {node: '>=18.0.0'} + has-flag@3.0.0: resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} engines: {node: '>=4'} @@ -1115,29 +1086,13 @@ packages: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} hasBin: true - html-encoding-sniffer@4.0.0: - resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==} - engines: {node: '>=18'} - html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} - http-proxy-agent@7.0.2: - resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} - engines: {node: '>= 14'} - - https-proxy-agent@7.0.5: - resolution: {integrity: sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==} - engines: {node: '>= 14'} - human-signals@5.0.0: resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} engines: {node: '>=16.17.0'} - iconv-lite@0.6.3: - resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} - engines: {node: '>=0.10.0'} - ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} @@ -1178,9 +1133,6 @@ packages: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} engines: {node: '>=8'} - is-potential-custom-element-name@1.0.1: - resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} - is-stream@3.0.0: resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -1217,15 +1169,6 @@ packages: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true - jsdom@25.0.0: - resolution: {integrity: sha512-OhoFVT59T7aEq75TVw9xxEfkXgacpqAhQaYgP9y/fDqWQCMB/b1H66RfmPm/MaeaAIU9nDwMOVTlPN51+ao6CQ==} - engines: {node: '>=18'} - peerDependencies: - canvas: ^2.11.2 - peerDependenciesMeta: - canvas: - optional: true - jsesc@2.5.2: resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} engines: {node: '>=4'} @@ -1317,14 +1260,6 @@ packages: resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} engines: {node: '>=8.6'} - mime-db@1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - - mime-types@2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} - mimic-fn@4.0.0: resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} engines: {node: '>=12'} @@ -1367,9 +1302,6 @@ packages: resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - nwsapi@2.2.12: - resolution: {integrity: sha512-qXDmcVlZV4XRtKFzddidpfVP4oMSGhga+xdMc25mv8kaLUHtgzCDhUxkrN8exkGdTlLNaXj7CV3GtON7zuGZ+w==} - onetime@6.0.0: resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} engines: {node: '>=12'} @@ -1393,9 +1325,6 @@ packages: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} - parse5@7.1.2: - resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} - path-browserify@1.0.1: resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} @@ -1425,8 +1354,8 @@ packages: resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} engines: {node: '>= 14.16'} - picocolors@1.0.1: - resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + picocolors@1.1.0: + resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} @@ -1435,8 +1364,8 @@ packages: pkg-types@1.2.0: resolution: {integrity: sha512-+ifYuSSqOQ8CqP4MbZA5hDpb97n3E8SVWdJe+Wms9kj745lmd3b7EZJiqvmLwAlmRfjrI7Hi5z3kdBJ93lFNPA==} - postcss@8.4.41: - resolution: {integrity: sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==} + postcss@8.4.45: + resolution: {integrity: sha512-7KTLTdzdZZYscUc65XmjFiB73vBhBfbPztCYdUNvlaso9PrzjzcmjqBPR0lNGkcVlcO4BjiO5rK/qNz+XAen1Q==} engines: {node: ^10 || ^12 || >=14} prelude-ls@1.2.1: @@ -1456,16 +1385,10 @@ packages: resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} - psl@1.9.0: - resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} - punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} - querystringify@2.2.0: - resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} - queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -1492,9 +1415,6 @@ packages: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} engines: {node: '>=0.10.0'} - requires-port@1.0.0: - resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} - resolve-from@4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} @@ -1512,22 +1432,9 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true - rrweb-cssom@0.6.0: - resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} - - rrweb-cssom@0.7.1: - resolution: {integrity: sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==} - run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - safer-buffer@2.1.2: - resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - - saxes@6.0.0: - resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} - engines: {node: '>=v12.22.7'} - scheduler@0.23.2: resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==} @@ -1621,9 +1528,6 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} - symbol-tree@3.2.4: - resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} - synckit@0.9.1: resolution: {integrity: sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==} engines: {node: ^14.18.0 || >=16.0.0} @@ -1658,14 +1562,6 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} - tough-cookie@4.1.4: - resolution: {integrity: sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==} - engines: {node: '>=6'} - - tr46@5.0.0: - resolution: {integrity: sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==} - engines: {node: '>=18'} - ts-api-utils@1.3.0: resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} engines: {node: '>=16'} @@ -1679,8 +1575,8 @@ packages: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} - typescript-eslint@8.3.0: - resolution: {integrity: sha512-EvWjwWLwwKDIJuBjk2I6UkV8KEQcwZ0VM10nR1rIunRDIP67QJTZAHBXTX0HW/oI1H10YESF8yWie8fRQxjvFA==} + typescript-eslint@8.4.0: + resolution: {integrity: sha512-67qoc3zQZe3CAkO0ua17+7aCLI0dU+sSQd1eKPGq06QE4rfQjstVXR6woHO5qQvGUa550NfGckT4tzh3b3c8Pw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -1705,10 +1601,6 @@ packages: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} - universalify@0.2.0: - resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} - engines: {node: '>= 4.0.0'} - update-browserslist-db@1.1.0: resolution: {integrity: sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==} hasBin: true @@ -1718,16 +1610,13 @@ packages: uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - url-parse@1.5.10: - resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} - vite-node@2.0.5: resolution: {integrity: sha512-LdsW4pxj0Ot69FAoXZ1yTnA9bjGohr2yNBU7QKRxpz8ITSkhuDl6h3zS/tvgz4qrNjeRnvrWeXQ8ZF7Um4W00Q==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true - vite-plugin-dts@4.0.3: - resolution: {integrity: sha512-+xnTsaONwU2kV6zhRjtbRJSGN41uFR/whqmcb4k4fftLFDJElxthp0PP5Fq8gMeM9ytWMt1yk5gGgekLREWYQQ==} + vite-plugin-dts@4.1.0: + resolution: {integrity: sha512-sRlmt9k2q8MrX4F2058N3KmB6WyJ3Ao6QaExOv1X99F3j0GhPziEz1zscWQ1q2r1PeFc96L7GIUu8Pl2DPr2Hg==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -1736,8 +1625,8 @@ packages: vite: optional: true - vite@5.4.2: - resolution: {integrity: sha512-dDrQTRHp5C1fTFzcSaMxjk6vdpKvT+2/mIdE07Gw2ykehT49O0z/VHS3zZ8iV/Gh8BJJKHWOe5RjaNrW5xf/GA==} + vite@5.4.3: + resolution: {integrity: sha512-IH+nl64eq9lJjFqU+/yrRnrHPVTlgy42/+IzbOdaFDVlyLgI/wDlf+FCobXLX1cT0X5+7LMyH1mIy2xJdLfo8Q==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -1801,25 +1690,13 @@ packages: peerDependencies: typescript: '>=5.0.0' - w3c-xmlserializer@5.0.0: - resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==} - engines: {node: '>=18'} - webidl-conversions@7.0.0: resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} engines: {node: '>=12'} - whatwg-encoding@3.1.1: - resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==} - engines: {node: '>=18'} - - whatwg-mimetype@4.0.0: - resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==} - engines: {node: '>=18'} - - whatwg-url@14.0.0: - resolution: {integrity: sha512-1lfMEm2IEr7RIV+f4lUNPOqfFL+pO+Xw3fJSqmjX9AbXcXcYOkCe1P6+9VBZB6n94af16NfZf+sSk0JCBZC9aw==} - engines: {node: '>=18'} + whatwg-mimetype@3.0.0: + resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} + engines: {node: '>=12'} which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} @@ -1843,25 +1720,6 @@ packages: resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} engines: {node: '>=12'} - ws@8.18.0: - resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - - xml-name-validator@5.0.0: - resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==} - engines: {node: '>=18'} - - xmlchars@2.2.0: - resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} - yallist@3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} @@ -1882,7 +1740,7 @@ snapshots: '@babel/code-frame@7.24.7': dependencies: '@babel/highlight': 7.24.7 - picocolors: 1.0.1 + picocolors: 1.1.0 '@babel/compat-data@7.25.4': {} @@ -1963,7 +1821,7 @@ snapshots: '@babel/helper-validator-identifier': 7.24.7 chalk: 2.4.2 js-tokens: 4.0.0 - picocolors: 1.0.1 + picocolors: 1.1.0 '@babel/parser@7.25.6': dependencies: @@ -2347,14 +2205,14 @@ snapshots: '@types/prop-types': 15.7.12 csstype: 3.1.3 - '@typescript-eslint/eslint-plugin@8.3.0(@typescript-eslint/parser@8.3.0(eslint@9.9.1)(typescript@5.5.4))(eslint@9.9.1)(typescript@5.5.4)': + '@typescript-eslint/eslint-plugin@8.4.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1)(typescript@5.5.4))(eslint@9.9.1)(typescript@5.5.4)': dependencies: '@eslint-community/regexpp': 4.11.0 - '@typescript-eslint/parser': 8.3.0(eslint@9.9.1)(typescript@5.5.4) - '@typescript-eslint/scope-manager': 8.3.0 - '@typescript-eslint/type-utils': 8.3.0(eslint@9.9.1)(typescript@5.5.4) - '@typescript-eslint/utils': 8.3.0(eslint@9.9.1)(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 8.3.0 + '@typescript-eslint/parser': 8.4.0(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/scope-manager': 8.4.0 + '@typescript-eslint/type-utils': 8.4.0(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/utils': 8.4.0(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.4.0 eslint: 9.9.1 graphemer: 1.4.0 ignore: 5.3.2 @@ -2365,12 +2223,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.3.0(eslint@9.9.1)(typescript@5.5.4)': + '@typescript-eslint/parser@8.4.0(eslint@9.9.1)(typescript@5.5.4)': dependencies: - '@typescript-eslint/scope-manager': 8.3.0 - '@typescript-eslint/types': 8.3.0 - '@typescript-eslint/typescript-estree': 8.3.0(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 8.3.0 + '@typescript-eslint/scope-manager': 8.4.0 + '@typescript-eslint/types': 8.4.0 + '@typescript-eslint/typescript-estree': 8.4.0(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.4.0 debug: 4.3.6 eslint: 9.9.1 optionalDependencies: @@ -2378,15 +2236,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.3.0': + '@typescript-eslint/scope-manager@8.4.0': dependencies: - '@typescript-eslint/types': 8.3.0 - '@typescript-eslint/visitor-keys': 8.3.0 + '@typescript-eslint/types': 8.4.0 + '@typescript-eslint/visitor-keys': 8.4.0 - '@typescript-eslint/type-utils@8.3.0(eslint@9.9.1)(typescript@5.5.4)': + '@typescript-eslint/type-utils@8.4.0(eslint@9.9.1)(typescript@5.5.4)': dependencies: - '@typescript-eslint/typescript-estree': 8.3.0(typescript@5.5.4) - '@typescript-eslint/utils': 8.3.0(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/typescript-estree': 8.4.0(typescript@5.5.4) + '@typescript-eslint/utils': 8.4.0(eslint@9.9.1)(typescript@5.5.4) debug: 4.3.6 ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: @@ -2395,12 +2253,12 @@ snapshots: - eslint - supports-color - '@typescript-eslint/types@8.3.0': {} + '@typescript-eslint/types@8.4.0': {} - '@typescript-eslint/typescript-estree@8.3.0(typescript@5.5.4)': + '@typescript-eslint/typescript-estree@8.4.0(typescript@5.5.4)': dependencies: - '@typescript-eslint/types': 8.3.0 - '@typescript-eslint/visitor-keys': 8.3.0 + '@typescript-eslint/types': 8.4.0 + '@typescript-eslint/visitor-keys': 8.4.0 debug: 4.3.6 fast-glob: 3.3.2 is-glob: 4.0.3 @@ -2412,34 +2270,34 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.3.0(eslint@9.9.1)(typescript@5.5.4)': + '@typescript-eslint/utils@8.4.0(eslint@9.9.1)(typescript@5.5.4)': dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.9.1) - '@typescript-eslint/scope-manager': 8.3.0 - '@typescript-eslint/types': 8.3.0 - '@typescript-eslint/typescript-estree': 8.3.0(typescript@5.5.4) + '@typescript-eslint/scope-manager': 8.4.0 + '@typescript-eslint/types': 8.4.0 + '@typescript-eslint/typescript-estree': 8.4.0(typescript@5.5.4) eslint: 9.9.1 transitivePeerDependencies: - supports-color - typescript - '@typescript-eslint/visitor-keys@8.3.0': + '@typescript-eslint/visitor-keys@8.4.0': dependencies: - '@typescript-eslint/types': 8.3.0 + '@typescript-eslint/types': 8.4.0 eslint-visitor-keys: 3.4.3 - '@vitejs/plugin-react@4.3.1(vite@5.4.2)': + '@vitejs/plugin-react@4.3.1(vite@5.4.3)': dependencies: '@babel/core': 7.25.2 '@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.25.2) '@babel/plugin-transform-react-jsx-source': 7.24.7(@babel/core@7.25.2) '@types/babel__core': 7.20.5 react-refresh: 0.14.2 - vite: 5.4.2 + vite: 5.4.3 transitivePeerDependencies: - supports-color - '@vitest/coverage-v8@2.0.5(vitest@2.0.5(jsdom@25.0.0))': + '@vitest/coverage-v8@2.0.5(vitest@2.0.5(happy-dom@15.7.3))': dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 0.2.3 @@ -2453,7 +2311,7 @@ snapshots: std-env: 3.7.0 test-exclude: 7.0.1 tinyrainbow: 1.2.0 - vitest: 2.0.5(jsdom@25.0.0) + vitest: 2.0.5(happy-dom@15.7.3) transitivePeerDependencies: - supports-color @@ -2490,30 +2348,30 @@ snapshots: loupe: 3.1.1 tinyrainbow: 1.2.0 - '@volar/language-core@2.4.1': + '@volar/language-core@2.4.2': dependencies: - '@volar/source-map': 2.4.1 + '@volar/source-map': 2.4.2 - '@volar/source-map@2.4.1': {} + '@volar/source-map@2.4.2': {} - '@volar/typescript@2.4.1': + '@volar/typescript@2.4.2': dependencies: - '@volar/language-core': 2.4.1 + '@volar/language-core': 2.4.2 path-browserify: 1.0.1 vscode-uri: 3.0.8 - '@vue/compiler-core@3.4.38': + '@vue/compiler-core@3.5.2': dependencies: '@babel/parser': 7.25.6 - '@vue/shared': 3.4.38 + '@vue/shared': 3.5.2 entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.0 - '@vue/compiler-dom@3.4.38': + '@vue/compiler-dom@3.5.2': dependencies: - '@vue/compiler-core': 3.4.38 - '@vue/shared': 3.4.38 + '@vue/compiler-core': 3.5.2 + '@vue/shared': 3.5.2 '@vue/compiler-vue2@2.7.16': dependencies: @@ -2522,10 +2380,10 @@ snapshots: '@vue/language-core@2.0.29(typescript@5.5.4)': dependencies: - '@volar/language-core': 2.4.1 - '@vue/compiler-dom': 3.4.38 + '@volar/language-core': 2.4.2 + '@vue/compiler-dom': 3.5.2 '@vue/compiler-vue2': 2.7.16 - '@vue/shared': 3.4.38 + '@vue/shared': 3.5.2 computeds: 0.0.1 minimatch: 9.0.5 muggle-string: 0.4.1 @@ -2533,13 +2391,11 @@ snapshots: optionalDependencies: typescript: 5.5.4 - '@vue/reactivity@3.5.0-rc.1': + '@vue/reactivity@3.5.2': dependencies: - '@vue/shared': 3.5.0-rc.1 + '@vue/shared': 3.5.2 - '@vue/shared@3.4.38': {} - - '@vue/shared@3.5.0-rc.1': {} + '@vue/shared@3.5.2': {} acorn-jsx@5.3.2(acorn@8.12.1): dependencies: @@ -2547,12 +2403,6 @@ snapshots: acorn@8.12.1: {} - agent-base@7.1.1: - dependencies: - debug: 4.3.6 - transitivePeerDependencies: - - supports-color - ajv-draft-04@1.0.0(ajv@8.13.0): optionalDependencies: ajv: 8.13.0 @@ -2610,8 +2460,6 @@ snapshots: assertion-error@2.0.1: {} - asynckit@0.4.0: {} - balanced-match@1.0.2: {} brace-expansion@1.1.11: @@ -2629,8 +2477,8 @@ snapshots: browserslist@4.23.3: dependencies: - caniuse-lite: 1.0.30001655 - electron-to-chromium: 1.5.13 + caniuse-lite: 1.0.30001657 + electron-to-chromium: 1.5.14 node-releases: 2.0.18 update-browserslist-db: 1.1.0(browserslist@4.23.3) @@ -2638,7 +2486,7 @@ snapshots: callsites@3.1.0: {} - caniuse-lite@1.0.30001655: {} + caniuse-lite@1.0.30001657: {} chai@5.1.1: dependencies: @@ -2673,10 +2521,6 @@ snapshots: color-name@1.1.4: {} - combined-stream@1.0.8: - dependencies: - delayed-stream: 1.0.0 - compare-versions@6.1.1: {} computeds@0.0.1: {} @@ -2693,38 +2537,25 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 - cssstyle@4.0.1: - dependencies: - rrweb-cssom: 0.6.0 - csstype@3.1.3: {} - data-urls@5.0.0: - dependencies: - whatwg-mimetype: 4.0.0 - whatwg-url: 14.0.0 - de-indent@1.0.2: {} debug@4.3.6: dependencies: ms: 2.1.2 - decimal.js@10.4.3: {} - deep-eql@5.0.2: {} deep-is@0.1.4: {} - delayed-stream@1.0.0: {} - dequal@2.0.3: {} dom-accessibility-api@0.5.16: {} eastasianwidth@0.2.0: {} - electron-to-chromium@1.5.13: {} + electron-to-chromium@1.5.14: {} emoji-regex@8.0.0: {} @@ -2907,12 +2738,6 @@ snapshots: cross-spawn: 7.0.3 signal-exit: 4.1.0 - form-data@4.0.0: - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - fs-extra@7.0.1: dependencies: graceful-fs: 4.2.11 @@ -2957,6 +2782,12 @@ snapshots: graphemer@1.4.0: {} + happy-dom@15.7.3: + dependencies: + entities: 4.5.0 + webidl-conversions: 7.0.0 + whatwg-mimetype: 3.0.0 + has-flag@3.0.0: {} has-flag@4.0.0: {} @@ -2967,32 +2798,10 @@ snapshots: he@1.2.0: {} - html-encoding-sniffer@4.0.0: - dependencies: - whatwg-encoding: 3.1.1 - html-escaper@2.0.2: {} - http-proxy-agent@7.0.2: - dependencies: - agent-base: 7.1.1 - debug: 4.3.6 - transitivePeerDependencies: - - supports-color - - https-proxy-agent@7.0.5: - dependencies: - agent-base: 7.1.1 - debug: 4.3.6 - transitivePeerDependencies: - - supports-color - human-signals@5.0.0: {} - iconv-lite@0.6.3: - dependencies: - safer-buffer: 2.1.2 - ignore@5.3.2: {} import-fresh@3.3.0: @@ -3020,8 +2829,6 @@ snapshots: is-path-inside@3.0.3: {} - is-potential-custom-element-name@1.0.1: {} - is-stream@3.0.0: {} isexe@2.0.0: {} @@ -3061,34 +2868,6 @@ snapshots: dependencies: argparse: 2.0.1 - jsdom@25.0.0: - dependencies: - cssstyle: 4.0.1 - data-urls: 5.0.0 - decimal.js: 10.4.3 - form-data: 4.0.0 - html-encoding-sniffer: 4.0.0 - http-proxy-agent: 7.0.2 - https-proxy-agent: 7.0.5 - is-potential-custom-element-name: 1.0.1 - nwsapi: 2.2.12 - parse5: 7.1.2 - rrweb-cssom: 0.7.1 - saxes: 6.0.0 - symbol-tree: 3.2.4 - tough-cookie: 4.1.4 - w3c-xmlserializer: 5.0.0 - webidl-conversions: 7.0.0 - whatwg-encoding: 3.1.1 - whatwg-mimetype: 4.0.0 - whatwg-url: 14.0.0 - ws: 8.18.0 - xml-name-validator: 5.0.0 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - jsesc@2.5.2: {} json-buffer@3.0.1: {} @@ -3172,12 +2951,6 @@ snapshots: braces: 3.0.3 picomatch: 2.3.1 - mime-db@1.52.0: {} - - mime-types@2.1.35: - dependencies: - mime-db: 1.52.0 - mimic-fn@4.0.0: {} minimatch@3.0.8: @@ -3215,8 +2988,6 @@ snapshots: dependencies: path-key: 4.0.0 - nwsapi@2.2.12: {} - onetime@6.0.0: dependencies: mimic-fn: 4.0.0 @@ -3244,10 +3015,6 @@ snapshots: dependencies: callsites: 3.1.0 - parse5@7.1.2: - dependencies: - entities: 4.5.0 - path-browserify@1.0.1: {} path-exists@4.0.0: {} @@ -3267,7 +3034,7 @@ snapshots: pathval@2.0.0: {} - picocolors@1.0.1: {} + picocolors@1.1.0: {} picomatch@2.3.1: {} @@ -3277,10 +3044,10 @@ snapshots: mlly: 1.7.1 pathe: 1.1.2 - postcss@8.4.41: + postcss@8.4.45: dependencies: nanoid: 3.3.7 - picocolors: 1.0.1 + picocolors: 1.1.0 source-map-js: 1.2.0 prelude-ls@1.2.1: {} @@ -3297,12 +3064,8 @@ snapshots: ansi-styles: 5.2.0 react-is: 17.0.2 - psl@1.9.0: {} - punycode@2.3.1: {} - querystringify@2.2.0: {} - queue-microtask@1.2.3: {} react-dom@18.3.1(react@18.3.1): @@ -3323,8 +3086,6 @@ snapshots: require-from-string@2.0.2: {} - requires-port@1.0.0: {} - resolve-from@4.0.0: {} resolve@1.22.8: @@ -3357,20 +3118,10 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.21.2 fsevents: 2.3.3 - rrweb-cssom@0.6.0: {} - - rrweb-cssom@0.7.1: {} - run-parallel@1.2.0: dependencies: queue-microtask: 1.2.3 - safer-buffer@2.1.2: {} - - saxes@6.0.0: - dependencies: - xmlchars: 2.2.0 - scheduler@0.23.2: dependencies: loose-envify: 1.4.0 @@ -3443,8 +3194,6 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - symbol-tree@3.2.4: {} - synckit@0.9.1: dependencies: '@pkgr/core': 0.1.1 @@ -3472,17 +3221,6 @@ snapshots: dependencies: is-number: 7.0.0 - tough-cookie@4.1.4: - dependencies: - psl: 1.9.0 - punycode: 2.3.1 - universalify: 0.2.0 - url-parse: 1.5.10 - - tr46@5.0.0: - dependencies: - punycode: 2.3.1 - ts-api-utils@1.3.0(typescript@5.5.4): dependencies: typescript: 5.5.4 @@ -3493,11 +3231,11 @@ snapshots: dependencies: prelude-ls: 1.2.1 - typescript-eslint@8.3.0(eslint@9.9.1)(typescript@5.5.4): + typescript-eslint@8.4.0(eslint@9.9.1)(typescript@5.5.4): dependencies: - '@typescript-eslint/eslint-plugin': 8.3.0(@typescript-eslint/parser@8.3.0(eslint@9.9.1)(typescript@5.5.4))(eslint@9.9.1)(typescript@5.5.4) - '@typescript-eslint/parser': 8.3.0(eslint@9.9.1)(typescript@5.5.4) - '@typescript-eslint/utils': 8.3.0(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.4.0(@typescript-eslint/parser@8.4.0(eslint@9.9.1)(typescript@5.5.4))(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/parser': 8.4.0(eslint@9.9.1)(typescript@5.5.4) + '@typescript-eslint/utils': 8.4.0(eslint@9.9.1)(typescript@5.5.4) optionalDependencies: typescript: 5.5.4 transitivePeerDependencies: @@ -3512,30 +3250,23 @@ snapshots: universalify@0.1.2: {} - universalify@0.2.0: {} - update-browserslist-db@1.1.0(browserslist@4.23.3): dependencies: browserslist: 4.23.3 escalade: 3.2.0 - picocolors: 1.0.1 + picocolors: 1.1.0 uri-js@4.4.1: dependencies: punycode: 2.3.1 - url-parse@1.5.10: - dependencies: - querystringify: 2.2.0 - requires-port: 1.0.0 - vite-node@2.0.5: dependencies: cac: 6.7.14 debug: 4.3.6 pathe: 1.1.2 tinyrainbow: 1.2.0 - vite: 5.4.2 + vite: 5.4.3 transitivePeerDependencies: - '@types/node' - less @@ -3547,11 +3278,11 @@ snapshots: - supports-color - terser - vite-plugin-dts@4.0.3(rollup@4.21.2)(typescript@5.5.4)(vite@5.4.2): + vite-plugin-dts@4.1.0(rollup@4.21.2)(typescript@5.5.4)(vite@5.4.3): dependencies: '@microsoft/api-extractor': 7.47.4 '@rollup/pluginutils': 5.1.0(rollup@4.21.2) - '@volar/typescript': 2.4.1 + '@volar/typescript': 2.4.2 '@vue/language-core': 2.0.29(typescript@5.5.4) compare-versions: 6.1.1 debug: 4.3.6 @@ -3561,21 +3292,21 @@ snapshots: typescript: 5.5.4 vue-tsc: 2.0.29(typescript@5.5.4) optionalDependencies: - vite: 5.4.2 + vite: 5.4.3 transitivePeerDependencies: - '@types/node' - rollup - supports-color - vite@5.4.2: + vite@5.4.3: dependencies: esbuild: 0.21.5 - postcss: 8.4.41 + postcss: 8.4.45 rollup: 4.21.2 optionalDependencies: fsevents: 2.3.3 - vitest@2.0.5(jsdom@25.0.0): + vitest@2.0.5(happy-dom@15.7.3): dependencies: '@ampproject/remapping': 2.3.0 '@vitest/expect': 2.0.5 @@ -3593,11 +3324,11 @@ snapshots: tinybench: 2.9.0 tinypool: 1.0.1 tinyrainbow: 1.2.0 - vite: 5.4.2 + vite: 5.4.3 vite-node: 2.0.5 why-is-node-running: 2.3.0 optionalDependencies: - jsdom: 25.0.0 + happy-dom: 15.7.3 transitivePeerDependencies: - less - lightningcss @@ -3612,27 +3343,14 @@ snapshots: vue-tsc@2.0.29(typescript@5.5.4): dependencies: - '@volar/typescript': 2.4.1 + '@volar/typescript': 2.4.2 '@vue/language-core': 2.0.29(typescript@5.5.4) semver: 7.6.3 typescript: 5.5.4 - w3c-xmlserializer@5.0.0: - dependencies: - xml-name-validator: 5.0.0 - webidl-conversions@7.0.0: {} - whatwg-encoding@3.1.1: - dependencies: - iconv-lite: 0.6.3 - - whatwg-mimetype@4.0.0: {} - - whatwg-url@14.0.0: - dependencies: - tr46: 5.0.0 - webidl-conversions: 7.0.0 + whatwg-mimetype@3.0.0: {} which@2.0.2: dependencies: @@ -3657,12 +3375,6 @@ snapshots: string-width: 5.1.2 strip-ansi: 7.1.0 - ws@8.18.0: {} - - xml-name-validator@5.0.0: {} - - xmlchars@2.2.0: {} - yallist@3.1.1: {} yallist@4.0.0: {} diff --git a/src/_utils.ts b/src/_utils.ts index b8158d2..1104ea2 100644 --- a/src/_utils.ts +++ b/src/_utils.ts @@ -10,48 +10,3 @@ export type IfAny = 0 extends 1 & T ? Y : N export const increment = (s: number) => s + 1 export const useForceUpdate = () => useReducer(increment, 0)[1] - -// compare whether a value has changed, accounting for NaN. -export const hasChanged = (value: any, oldValue: any): boolean => { - return value !== oldValue && (value === value || oldValue === oldValue) -} - -export const isArray = Array.isArray -export const objectToString = Object.prototype.toString -export const toTypeString = (value: unknown): string => { - return objectToString.call(value) -} -export const isMap = (value: unknown): value is Map => { - return toTypeString(value) === '[object Map]' -} -export const isSet = (value: unknown): value is Set => { - return toTypeString(value) === '[object Set]' -} -export const isDate = (value: unknown): value is Date => { - return value instanceof Date -} -export const isFunction = (value: unknown): value is (...args: any[]) => any => { - return typeof value === 'function' -} -export const isString = (value: unknown): value is string => { - return typeof value === 'string' -} -export const isSymbol = (value: unknown): value is symbol => { - return typeof value === 'symbol' -} -export const isObject = (value: unknown): value is Record => { - return value !== null && typeof value === 'object' -} -export const isPlainObject = (value: unknown): value is object => { - return toTypeString(value) === '[object Object]' -} -export const isPromise = (value: unknown): value is Promise => { - return isObject(value) && isFunction(value.then) && isFunction(value.catch) -} - -export const removeArrayItem = (array: T[], element: T) => { - const i = array.indexOf(element) - if (i > -1) { - array.splice(i, 1) - } -} diff --git a/src/watch-bak/patch.ts b/src/watch-bak/patch.ts deleted file mode 100644 index 481aabd..0000000 --- a/src/watch-bak/patch.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @module veact.watch.patch - * @author Surmon - */ - -import { isRef, ReactiveFlags } from '@vue/reactivity' -import { isArray, isObject, isSet, isMap, isFunction, isPromise, isPlainObject } from '../_utils' -import { logger } from '../_logger' - -export const NOOP_FN = () => {} - -// fork form: https://github.com/vuejs/core/blob/main/packages/runtime-core/src/errorHandling.ts -export const WATCH_GETTER_ERROR = 'watcher getter' -export const WATCH_CLEANUP_ERROR = 'watcher cleanup function' -export const WATCH_CALLBACK_ERROR = 'watcher callback' - -// fork from: https://github.com/vuejs/vue-next/blob/main/packages/runtime-core/src/errorHandling.ts -export function callWithErrorHandling(fn: Function, errorString: string, args?: unknown[]) { - try { - return args ? fn(...args) : fn() - } catch (error) { - logger.error(error, errorString) - } -} - -export function callWithAsyncErrorHandling( - fn: Function | Function[], - errorString: string, - args?: unknown[], -): any { - if (isFunction(fn)) { - const result = callWithErrorHandling(fn, errorString, args) - if (result && isPromise(result)) { - result.catch((error) => { - logger.error(error, errorString) - }) - } - return result - } - - if (isArray(fn)) { - const values = [] - for (let i = 0; i < fn.length; i++) { - values.push(callWithAsyncErrorHandling(fn[i], errorString, args)) - } - return values - } -} - -// fork form: https://github.com/vuejs/core/blob/main/packages/runtime-core/src/apiWatch.ts#L466 -export function traverse(value: unknown, depth: number = Infinity, seen?: Set): unknown { - if (depth <= 0 || !isObject(value) || (value as any)[ReactiveFlags.SKIP]) { - return value - } - - seen = seen || new Set() - if (seen.has(value)) { - return value - } - seen.add(value) - depth-- - if (isRef(value)) { - traverse(value.value, depth, seen) - } else if (isArray(value)) { - for (let i = 0; i < value.length; i++) { - traverse(value[i], depth, seen) - } - } else if (isSet(value) || isMap(value)) { - value.forEach((v: any) => { - traverse(v, depth, seen) - }) - } else if (isPlainObject(value)) { - for (const key in value) { - traverse(value[key], depth, seen) - } - for (const key of Object.getOwnPropertySymbols(value)) { - if (Object.prototype.propertyIsEnumerable.call(value, key)) { - traverse(value[key as any], depth, seen) - } - } - } - return value -} diff --git a/src/watch-bak/type.ts b/src/watch-bak/type.ts deleted file mode 100644 index 45b41d0..0000000 --- a/src/watch-bak/type.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @module veact.watch.type - * @author Surmon - */ - -import type { ReactiveEffect, EffectScope as _EffectScope } from '@vue/reactivity' - -export type OnCleanup = (cleanupFn: () => void) => void - -export type WatchStopHandle = () => void -export interface WatchHandle extends WatchStopHandle { - pause: () => void - resume: () => void - stop: () => void -} - -export interface EffectScope extends _EffectScope { - parent: any - cleanups: any[] - effects: ReactiveEffect[] -} diff --git a/src/watch-bak/watch.ts b/src/watch-bak/watch.ts deleted file mode 100644 index a54e9c7..0000000 --- a/src/watch-bak/watch.ts +++ /dev/null @@ -1,285 +0,0 @@ -/** - * @module veact.watch.watch - * @author Surmon - */ - -import { useState as useReactState } from 'react' -import { isRef, isShallow, isReactive, getCurrentScope, EffectFlags, ReactiveEffect } from '@vue/reactivity' -import type { Ref, ComputedRef, ReactiveMarker, EffectScheduler, DebuggerOptions } from '@vue/reactivity' -import { onBeforeUnmount } from '../lifecycle' -import { logger } from '../_logger' -import { hasChanged, isArray, isFunction, removeArrayItem } from '../_utils' -import type { EffectScope, WatchHandle, OnCleanup } from './type' -import { - traverse, - NOOP_FN, - WATCH_GETTER_ERROR, - WATCH_CLEANUP_ERROR, - WATCH_CALLBACK_ERROR, - callWithErrorHandling, - callWithAsyncErrorHandling, -} from './patch' - -// fork form: https://github.com/vuejs/core/blob/main/packages/runtime-core/src/apiWatch.ts -// commits: https://github.com/vuejs/core/commits/main/packages/runtime-core/src/apiWatch.ts -// changelog: https://github.com/vuejs/core/blob/main/CHANGELOG.md - -// initial value for watchers to trigger on undefined initial values -const INITIAL_WATCHER_VALUE = {} - -const warnInvalidSource = (source: unknown) => { - logger.warn( - `Invalid watch source: `, - source, - `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`, - ) -} - -export interface WatchOptions extends DebuggerOptions { - immediate?: Immediate - deep?: boolean | number - once?: boolean - // The `flush` option is not supported in react at the moment. - // flush?: 'pre' | 'post' | 'sync' -} - -type WatchFn = () => T -export type WatchSource = Ref | ComputedRef | WatchFn -export type MultiWatchSources = (WatchSource | object)[] -export type WatchCallback = ( - value: Value, - oldValue: OldValue, - onCleanup: OnCleanup, -) => any - -type MaybeUndefined = I extends true ? T | undefined : T -type MapSources = { - [K in keyof T]: T[K] extends WatchSource - ? MaybeUndefined - : T[K] extends object - ? MaybeUndefined - : never -} - -/** - * Watches one or more reactive data sources and invokes a callback function when the sources change. - * - * @param source - The watcher's source. - * @param callback - This function will be called when the source is changed. - * @param options - An optional options object that does not support the `flush` option compared to Vue (3.5.0). - * @see {@link https://vuejs.org/api/reactivity-core.html#watch Vue `watch()`} - * - * @example - * ```js - * const count = ref(0) - * watch(count, (count, prevCount) => { - * // ... - * }) - * ``` - */ - -// overload: single source + cb -export function watch = false>( - source: WatchSource, - callback: WatchCallback>, - options?: WatchOptions, -): WatchHandle - -// overload: reactive array or tuple of multiple sources + cb -export function watch, Immediate extends Readonly = false>( - sources: readonly [...T] | T, - callback: [T] extends [ReactiveMarker] - ? WatchCallback> - : WatchCallback, MapSources>, - options?: WatchOptions, -): WatchHandle - -// overload: array of multiple sources + cb -export function watch = false>( - sources: [...T], - callback: WatchCallback, MapSources>, - options?: WatchOptions, -): WatchHandle - -// overload: watching reactive object w/ cb -export function watch = false>( - source: T, - callback: WatchCallback>, - options?: WatchOptions, -): WatchHandle - -// implementation -export function watch = false>( - source: T | WatchSource, - callback: WatchCallback, - options: WatchOptions = {}, -): WatchHandle { - const { immediate, deep, once, onTrack, onTrigger } = options - const reactiveGetter = (source: object) => { - // traverse will happen in wrapped getter below - if (deep) return source - // for `deep: false | 0` or shallow reactive, only traverse root-level properties - if (isShallow(source) || deep === false || deep === 0) return traverse(source, 1) - // for `deep: undefined` on a reactive object, deeply traverse all properties - return traverse(source) - } - - let watchHandle: WatchHandle - let getter: WatchFn - let forceTrigger = false - let isMultiSource = false - let effect: ReactiveEffect - - // In an SSR environment, callbacks need to be wrapped - if (once) { - const _callback = callback - callback = (...args) => { - _callback(...args) - watchHandle() - } - } - - if (isRef(source)) { - getter = () => source.value - forceTrigger = isShallow(source) - } else if (isReactive(source)) { - // @ts-ignore - getter = () => reactiveGetter(source) - forceTrigger = true - } else if (isArray(source)) { - isMultiSource = true - forceTrigger = source.some((s) => isReactive(s) || isShallow(s)) - getter = () => { - return source.map((s) => { - if (isRef(s)) { - return s.value - } else if (isReactive(s)) { - return reactiveGetter(s) - } else if (isFunction(s)) { - return callWithErrorHandling(s, WATCH_GETTER_ERROR) - } else { - warnInvalidSource(s) - } - }) - } - } else if (isFunction(source)) { - getter = () => callWithErrorHandling(source, WATCH_GETTER_ERROR) - } else { - getter = NOOP_FN - warnInvalidSource(source) - } - - if (deep) { - const baseGetter = getter - const depth = deep === true ? Infinity : deep - getter = () => traverse(baseGetter(), depth) - } - - let cleanup: (() => void) | undefined - let onCleanup: OnCleanup = (fn: () => void) => { - cleanup = effect.onStop = () => { - callWithErrorHandling(fn, WATCH_CLEANUP_ERROR) - cleanup = effect.onStop = undefined - } - } - - // in SSR there is no need to setup an actual effect, and it should be noop, unless it's eager. - // if (isSSR) { - // // we will also not call the invalidate callback (+ runner is not set up) - // onCleanup = NOOP_FN - // if (immediate) { - // callWithAsyncErrorHandling(callback, WATCH_CALLBACK_ERROR, [ - // getter(), - // isMultiSource ? [] : undefined, - // onCleanup, - // ]) - // } - // watchHandle = () => {} - // watchHandle.stop = NOOP_FN - // watchHandle.resume = NOOP_FN - // watchHandle.pause = NOOP_FN - // return watchHandle - // } - - let oldValue: any = isMultiSource - ? new Array((source as []).length).fill(INITIAL_WATCHER_VALUE) - : INITIAL_WATCHER_VALUE - - const scheduler: EffectScheduler = (immediateFirstRun?: boolean) => { - if (!((effect as any).flags & EffectFlags.ACTIVE) || (!effect.dirty && !immediateFirstRun)) { - return - } - const newValue = effect.run() - if ( - deep || - forceTrigger || - (isMultiSource - ? (newValue as any[]).some((v, i) => hasChanged(v, oldValue[i])) - : hasChanged(newValue, oldValue)) - ) { - // cleanup before running cb again - cleanup?.() - callWithAsyncErrorHandling(callback, WATCH_CALLBACK_ERROR, [ - newValue, - // pass undefined as the old value when it's changed for the first time - oldValue === INITIAL_WATCHER_VALUE - ? undefined - : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE - ? [] - : oldValue, - onCleanup, - ]) - oldValue = newValue - } - } - - effect = new ReactiveEffect(getter) - effect.scheduler = scheduler - effect.onTrack = onTrack - effect.onTrigger = onTrigger - - const scope = getCurrentScope() - // @ts-ignore - watchHandle = () => { - effect.stop() - if (scope) { - removeArrayItem((scope as EffectScope).effects, effect) - } - } - - watchHandle.pause = effect.pause.bind(effect) - watchHandle.resume = effect.resume.bind(effect) - watchHandle.stop = watchHandle - - // initial run - if (immediate) { - scheduler(true) - } else { - oldValue = effect.run() - } - - // stop handle - return watchHandle -} - -/** - * Watches one or more reactive data sources and invokes a callback function when the sources change. - * - * @param source - The watcher's source. - * @param callback - This function will be called when the source is changed. - * @param options - An optional options object that does not support the `flush` option compared to Vue (3.5.0). - * @see {@link https://vuejs.org/api/reactivity-core.html#watch Vue `watch()`} - * - * @example - * ```js - * const count = useRef(0) - * useWatch(count, (count, prevCount) => { - * // ... - * }) - * ``` - */ -export const useWatch: typeof watch = (source: any, callback: any, options = {}) => { - const [watchHandle] = useReactState(() => watch(source as any, callback, options)) - onBeforeUnmount(() => watchHandle.stop()) - return watchHandle -} diff --git a/src/watch-bak/watchEffect.ts b/src/watch-bak/watchEffect.ts deleted file mode 100644 index f2264a9..0000000 --- a/src/watch-bak/watchEffect.ts +++ /dev/null @@ -1,113 +0,0 @@ -/** - * @module veact.watch.watchEffect - * @author Surmon - */ - -// DOC: https://vuejs.org/api/reactivity-core.html#watcheffect -// fork form: https://github.com/vuejs/core/blob/main/packages/runtime-core/src/apiWatch.ts#L82 -import { useState as useReactState } from 'react' -import { getCurrentScope, EffectFlags, ReactiveEffect } from '@vue/reactivity' -import type { DebuggerOptions, EffectScheduler } from '@vue/reactivity' -import { onBeforeUnmount } from '../lifecycle' -import { removeArrayItem } from '../_utils' -import type { OnCleanup, EffectScope, WatchHandle } from './type' -import { - WATCH_CLEANUP_ERROR, - WATCH_CALLBACK_ERROR, - callWithErrorHandling, - callWithAsyncErrorHandling, -} from './patch' - -export type WatchEffectOptions = DebuggerOptions -export type WatchEffect = (onCleanup: OnCleanup) => void - -/** - * Runs a function immediately while reactively tracking its dependencies and re-runs it whenever the dependencies are changed. - * - * @param effectFn - The effect function to run. - * @param options - An optional options object that can be used to adjust the effect's flush timing or to debug the effect's dependencies; the `flush` option is not supported compared to Vue (3.5.0). - * @see {@link https://vuejs.org/api/reactivity-core.html#watcheffect Vue `watchEffect()`} - * - * @example - * ```js - * const count = ref(0) - * watchEffect(() => console.log(count.value)) - * // -> logs 0 - * - * count.value++ - * // -> logs 1 - * ``` - */ -export function watchEffect(effectFn: WatchEffect, options: WatchEffectOptions = {}): WatchHandle { - let effect: ReactiveEffect - let watchHandle: WatchHandle - let cleanup: (() => void) | undefined - - const onCleanup: OnCleanup = (fn: () => void) => { - cleanup = effect.onStop = () => { - callWithErrorHandling(fn, WATCH_CLEANUP_ERROR) - cleanup = effect.onStop = undefined - } - } - - const getter = () => { - // cleanup before running cb again - cleanup?.() - return callWithAsyncErrorHandling(effectFn, WATCH_CALLBACK_ERROR, [onCleanup]) - } - - const scheduler: EffectScheduler = () => { - if (!((effect as any).flags & EffectFlags.ACTIVE) || !effect.dirty) { - return - } - effect.run() - } - - // effect - effect = new ReactiveEffect(getter) - effect.scheduler = scheduler - effect.onTrack = options.onTrack - effect.onTrigger = options.onTrigger - - const scope = getCurrentScope() - // @ts-ignore - watchHandle = () => { - effect.stop() - if (scope) { - removeArrayItem((scope as EffectScope).effects, effect) - } - } - - watchHandle.pause = effect.pause.bind(effect) - watchHandle.resume = effect.resume.bind(effect) - watchHandle.stop = watchHandle - - // initial run - effect.run() - - // stop handle - return watchHandle -} - -/** - * Runs a function immediately while reactively tracking its dependencies and re-runs it whenever the dependencies are changed. - * - * @param effect - The effect function to run. - * @param options - An optional options object that can be used to adjust the effect's flush timing or to debug the effect's dependencies; the `flush` option is not supported compared to Vue (3.5.0). - * @see {@link https://vuejs.org/api/reactivity-core.html#watcheffect Vue `watchEffect()`} - * - * @example - * ```js - * const count = useRef(0) - * useWatchEffect(() => console.log(count.value)) - * // -> logs 0 - * - * count.value++ - * // -> logs 1 - * ``` - */ -export const useWatchEffect: typeof watchEffect = (effect: any, options?: any) => { - const [watchHandle] = useReactState(() => watchEffect(effect, options)) - onBeforeUnmount(() => watchHandle.stop()) - return watchHandle -} diff --git a/tests/effectScope.spec.ts b/tests/effectScope.spec.ts index 71f17f4..c7fe906 100644 --- a/tests/effectScope.spec.ts +++ b/tests/effectScope.spec.ts @@ -1,6 +1,16 @@ import { test, expect } from 'vitest' import { renderHook, act } from '@testing-library/react' -import { ref, reactive, useRef, watch, EffectScope, onUpdated, useEffectScope, onScopeDispose } from '../src' +import { + ref, + reactive, + useRef, + watch, + EffectScope, + onUpdated, + useEffectScope, + getCurrentScope, + onScopeDispose, +} from '../src' test('', () => { let renderCount = 0 @@ -27,6 +37,10 @@ test('', () => { onScopeDispose(() => { scopeDisposed = true }) + + const currentScope = getCurrentScope() + expect(currentScope).toBeDefined() + expect(getCurrentScope()).toBe(currentScope) }) return { diff --git a/tests/watch.spec.ts b/tests/watch.spec.ts index 310e87a..d93c068 100644 --- a/tests/watch.spec.ts +++ b/tests/watch.spec.ts @@ -1,14 +1,15 @@ import { test, expect } from 'vitest' import { renderHook, act } from '@testing-library/react' -import { ref, reactive, watch, useRef, useWatch, onUpdated } from '../src' +import { ref, reactive, watch, useRef, useWatch, onUpdated, onWatcherCleanup } from '../src' -test(' onCleanup / watchHandle', () => { +test(' watchHandle / onCleanup / onWatcherCleanup', () => { const logs: any[] = [] const count = ref(0) const watchHandle = watch(count, (value, _, onCleanup) => { logs.push(value) onCleanup(() => logs.push('onCleanup')) + onWatcherCleanup(() => logs.push('onWatcherCleanup')) }) expect(logs.length).toBe(0) @@ -30,14 +31,18 @@ test(' onCleanup / watchHandle', () => { watchHandle.resume() count.value = 3 expect(logs.at(-1)).toBe(3) + expect(logs.length).toBe(7) watchHandle() - expect(logs.at(-2)).toBe(3) - expect(logs.at(-1)).toBe('onCleanup') + expect(logs.length).toBe(9) + expect(logs.at(-1)).toBe('onWatcherCleanup') + expect(logs.at(-2)).toBe('onCleanup') + expect(logs.at(-3)).toBe(3) count.value = 4 expect(count.value).toBe(4) - expect(logs.at(-1)).toBe('onCleanup') + expect(logs.length).toBe(9) + expect(logs.at(-1)).toBe('onWatcherCleanup') }) test(' { immediate: true }', () => { diff --git a/tests/watchEffect.spec.ts b/tests/watchEffect.spec.ts index 8159b49..32ae926 100644 --- a/tests/watchEffect.spec.ts +++ b/tests/watchEffect.spec.ts @@ -1,13 +1,14 @@ import { test, expect } from 'vitest' import { renderHook, act } from '@testing-library/react' -import { ref, watchEffect, useWatchEffect } from '../src' +import { ref, watchEffect, useWatchEffect, onEffectCleanup } from '../src' -test('', () => { +test(' watchHandle / onCleanup / onEffectCleanup', () => { const logs: any[] = [] const count = ref(0) const watchHandle = watchEffect((onCleanup) => { logs.push(count.value) onCleanup(() => logs.push('onCleanup')) + onEffectCleanup(() => logs.push('onEffectCleanup')) }) expect(logs.length).toBe(1) @@ -17,6 +18,7 @@ test('', () => { expect(count.value).toBe(1) expect(logs.at(-1)).toBe(1) expect(logs.at(-2)).toBe('onCleanup') + expect(logs.at(-3)).toBe('onEffectCleanup') count.value++ expect(count.value).toBe(2) @@ -25,20 +27,22 @@ test('', () => { watchHandle.pause() count.value++ - expect(logs.length).toBe(5) + expect(logs.length).toBe(7) watchHandle.resume() count.value++ expect(logs.at(-1)).toBe(4) watchHandle() - expect(logs.at(-2)).toBe(4) expect(logs.at(-1)).toBe('onCleanup') + expect(logs.at(-2)).toBe('onEffectCleanup') + expect(logs.at(-3)).toBe(4) count.value++ expect(count.value).toBe(5) - expect(logs.length).toBe(10) + expect(logs.length).toBe(15) expect(logs.at(-1)).toBe('onCleanup') + expect(logs.at(-2)).toBe('onEffectCleanup') }) test('', () => { diff --git a/vite.config.ts b/vite.config.ts index 4b69257..0206637 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -23,7 +23,7 @@ export default defineConfig({ // https://github.com/qmhc/vite-plugin-dts plugins: [viteReact(), viteDts({ rollupTypes: true })], test: { - environment: 'jsdom', + environment: 'happy-dom', coverage: { include: ['src/**/*'], },