diff --git a/.swcrc b/.swcrc index f9008a8..0171ee4 100644 --- a/.swcrc +++ b/.swcrc @@ -1,12 +1,5 @@ { - "env": { - "targets": [ - "edge >= 13", - "safari >= 10", - "chrome >= 49", - "opera >= 36", - "firefox >= 45", - "ios_saf >= 10" - ] + "jsc": { + "loose": true } } diff --git a/README.md b/README.md index b1ea08b..ac344e1 100644 --- a/README.md +++ b/README.md @@ -36,10 +36,7 @@ - React Native - Taro - Electron - -| Edge
Edge | Chrome
Chrome | Firefox
Firefox | Safari
Safari | iOS Safari
iOS Safari | Opera
Opera | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| 13+ | 49+ | 45+ | 10+ | 10+ | 36+ | +- ios 8+ # 安装 diff --git a/docs/home.md b/docs/home.md index 5003dfd..87d6519 100644 --- a/docs/home.md +++ b/docs/home.md @@ -22,10 +22,7 @@ - React Native - Taro - Electron - -| Edge
Edge | Chrome
Chrome | Firefox
Firefox | Safari
Safari | iOS Safari
iOS Safari | Opera
Opera | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| 13+ | 49+ | 45+ | 10+ | 10+ | 36+ | +- ios 8+ # 特性 diff --git a/package.json b/package.json index 5b5d6be..89a56c8 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ } }, "dependencies": { - "immer": "^10.0.2", + "immer": "^9.0.21", "react-redux": "^8.1.2", "redux": "^4.2.1", "topic": "^3.0.2" @@ -70,7 +70,7 @@ "@commitlint/cli": "^17.7.1", "@commitlint/config-conventional": "^17.7.0", "@redux-devtools/extension": "^3.2.5", - "@swc/core": "1.3.71", + "@swc/core": "1.3.83", "@testing-library/react": "^14.0.0", "@types/node": "^20.4.9", "@types/react": "^18.2.20", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5bfab85..1e24e66 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,8 +2,8 @@ lockfileVersion: '6.0' dependencies: immer: - specifier: ^10.0.2 - version: 10.0.2 + specifier: ^9.0.21 + version: 9.0.21 react-redux: specifier: ^8.1.2 version: 8.1.2(@types/react-dom@18.2.7)(@types/react@18.2.20)(react-dom@18.2.0)(react@18.2.0)(redux@4.2.1) @@ -17,7 +17,7 @@ dependencies: devDependencies: '@commitlint/cli': specifier: ^17.7.1 - version: 17.7.1(@swc/core@1.3.71) + version: 17.7.1(@swc/core@1.3.83) '@commitlint/config-conventional': specifier: ^17.7.0 version: 17.7.0 @@ -25,8 +25,8 @@ devDependencies: specifier: ^3.2.5 version: 3.2.5(redux@4.2.1) '@swc/core': - specifier: 1.3.71 - version: 1.3.71 + specifier: 1.3.83 + version: 1.3.83 '@testing-library/react': specifier: ^14.0.0 version: 14.0.0(react-dom@18.2.0)(react@18.2.0) @@ -77,7 +77,7 @@ devDependencies: version: 1.3.0 tsup: specifier: ^7.2.0 - version: 7.2.0(@swc/core@1.3.71)(ts-node@10.9.1)(typescript@5.1.6) + version: 7.2.0(@swc/core@1.3.83)(ts-node@10.9.1)(typescript@5.1.6) typescript: specifier: ^5.1.6 version: 5.1.6 @@ -127,14 +127,14 @@ packages: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true - /@commitlint/cli@17.7.1(@swc/core@1.3.71): + /@commitlint/cli@17.7.1(@swc/core@1.3.83): resolution: {integrity: sha512-BCm/AT06SNCQtvFv921iNhudOHuY16LswT0R3OeolVGLk8oP+Rk9TfQfgjH7QPMjhvp76bNqGFEcpKojxUNW1g==} engines: {node: '>=v14'} hasBin: true dependencies: '@commitlint/format': 17.4.4 '@commitlint/lint': 17.7.0 - '@commitlint/load': 17.7.1(@swc/core@1.3.71) + '@commitlint/load': 17.7.1(@swc/core@1.3.83) '@commitlint/read': 17.5.1 '@commitlint/types': 17.4.4 execa: 5.1.1 @@ -205,7 +205,7 @@ packages: '@commitlint/types': 17.4.4 dev: true - /@commitlint/load@17.7.1(@swc/core@1.3.71): + /@commitlint/load@17.7.1(@swc/core@1.3.83): resolution: {integrity: sha512-S/QSOjE1ztdogYj61p6n3UbkUvweR17FQ0zDbNtoTLc+Hz7vvfS7ehoTMQ27hPSjVBpp7SzEcOQu081RLjKHJQ==} engines: {node: '>=v14'} dependencies: @@ -221,7 +221,7 @@ packages: lodash.merge: 4.6.2 lodash.uniq: 4.5.0 resolve-from: 5.0.0 - ts-node: 10.9.1(@swc/core@1.3.71)(@types/node@20.4.9)(typescript@5.1.6) + ts-node: 10.9.1(@swc/core@1.3.83)(@types/node@20.4.9)(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: - '@swc/core' @@ -589,8 +589,8 @@ packages: engines: {node: '>=6'} dev: true - /@swc/core-darwin-arm64@1.3.71: - resolution: {integrity: sha512-xOm0hDbcO2ShwQu1CjLtq3fwrG9AvhuE0s8vtBc8AsamYExHmR8bo6GQHJUtfPG1FVPk5a8xoQSd1fs09FQjLg==} + /@swc/core-darwin-arm64@1.3.83: + resolution: {integrity: sha512-Plz2IKeveVLivbXTSCC3OZjD2MojyKYllhPrn9RotkDIZEFRYJZtW5/Ik1tJW/2rzu5HVKuGYrDKdScVVTbOxQ==} engines: {node: '>=10'} cpu: [arm64] os: [darwin] @@ -598,8 +598,8 @@ packages: dev: true optional: true - /@swc/core-darwin-x64@1.3.71: - resolution: {integrity: sha512-9sbDXBWgM22w/3Ll5kPhXMPkOiHRoqwMOyxLJBfGtIMnFlh5O+NRN3umRerK3pe4Q6/7hj2M5V+crEHYrXmuxg==} + /@swc/core-darwin-x64@1.3.83: + resolution: {integrity: sha512-FBGVg5IPF/8jQ6FbK60iDUHjv0H5+LwfpJHKH6wZnRaYWFtm7+pzYgreLu3NTsm3m7/1a7t0+7KURwBGUaJCCw==} engines: {node: '>=10'} cpu: [x64] os: [darwin] @@ -607,8 +607,8 @@ packages: dev: true optional: true - /@swc/core-linux-arm-gnueabihf@1.3.71: - resolution: {integrity: sha512-boKdMZsfKvhBs0FDeqH7KQj0lfYe0wCtrL1lv50oYMEeLajY9o4U5xSmc61Sg4HRXjlbR6dlM2cFfL84t7NpAA==} + /@swc/core-linux-arm-gnueabihf@1.3.83: + resolution: {integrity: sha512-EZcsuRYhGkzofXtzwDjuuBC/suiX9s7zeg2YYXOVjWwyebb6BUhB1yad3mcykFQ20rTLO9JUyIaiaMYDHGobqw==} engines: {node: '>=10'} cpu: [arm] os: [linux] @@ -616,8 +616,8 @@ packages: dev: true optional: true - /@swc/core-linux-arm64-gnu@1.3.71: - resolution: {integrity: sha512-yDatyHYMiOVwhyIA/LBwknPs2CUtLYWEMzPZjgLc+56PbgPs3oiEbNWeVUND5onPrfDQgK7NK1y8JeiXZqTgGQ==} + /@swc/core-linux-arm64-gnu@1.3.83: + resolution: {integrity: sha512-khI41szLHrCD/cFOcN4p2SYvZgHjhhHlcMHz5BksRrDyteSJKu0qtWRZITVom0N/9jWoAleoFhMnFTUs0H8IWA==} engines: {node: '>=10'} cpu: [arm64] os: [linux] @@ -625,8 +625,8 @@ packages: dev: true optional: true - /@swc/core-linux-arm64-musl@1.3.71: - resolution: {integrity: sha512-xAdCA0L/hoa0ULL5SR4sMZCxkWk7C90DOU7wJalNVG9qNWYICfq3G7AR0E9Ohphzqyahfb5QJED/nA7N0+XwbQ==} + /@swc/core-linux-arm64-musl@1.3.83: + resolution: {integrity: sha512-zgT7yNOdbjHcGAwvys79mbfNLK65KBlPJWzeig+Yk7I8TVzmaQge7B6ZS/gwF9/p+8TiLYo/tZ5aF2lqlgdSVw==} engines: {node: '>=10'} cpu: [arm64] os: [linux] @@ -634,8 +634,8 @@ packages: dev: true optional: true - /@swc/core-linux-x64-gnu@1.3.71: - resolution: {integrity: sha512-j94qLXP/yqhu2afnABAq/xrJIU8TEqcNkp1TlsAeO3R2nVLYL1w4XX8GW71SPnXmd2bwF102c3Cfv/2ilf2y2A==} + /@swc/core-linux-x64-gnu@1.3.83: + resolution: {integrity: sha512-x+mH0Y3NC/G0YNlFmGi3vGD4VOm7IPDhh+tGrx6WtJp0BsShAbOpxtfU885rp1QweZe4qYoEmGqiEjE2WrPIdA==} engines: {node: '>=10'} cpu: [x64] os: [linux] @@ -643,8 +643,8 @@ packages: dev: true optional: true - /@swc/core-linux-x64-musl@1.3.71: - resolution: {integrity: sha512-YiyU848ql6dLlmt0BHccGAaZ36Cf61VzCAMDKID/gd72snvzWcMCHrwSRW0gEFNXHsjBJrmNl+SLYZHfqoGwUA==} + /@swc/core-linux-x64-musl@1.3.83: + resolution: {integrity: sha512-s5AYhAOmetUwUZwS5g9qb92IYgNHHBGiY2mTLImtEgpAeBwe0LPDj6WrujxCBuZnaS55mKRLLOuiMZE5TpjBNA==} engines: {node: '>=10'} cpu: [x64] os: [linux] @@ -652,8 +652,8 @@ packages: dev: true optional: true - /@swc/core-win32-arm64-msvc@1.3.71: - resolution: {integrity: sha512-1UsJ+6hnIRe/PVdgDPexvgGaN4KpBncT/bAOqlWc9XC7KeBXAWcGA08LrPUz2Ei00DJXzR622IGZVEYOHNkUOw==} + /@swc/core-win32-arm64-msvc@1.3.83: + resolution: {integrity: sha512-yw2rd/KVOGs95lRRB+killLWNaO1dy4uVa8Q3/4wb5txlLru07W1m041fZLzwOg/1Sh0TMjJgGxj0XHGR3ZXhQ==} engines: {node: '>=10'} cpu: [arm64] os: [win32] @@ -661,8 +661,8 @@ packages: dev: true optional: true - /@swc/core-win32-ia32-msvc@1.3.71: - resolution: {integrity: sha512-KnuI89+zojR9lDFELdQYZpxzPZ6pBfLwJfWTSGatnpL1ZHhIsV3tK1jwqIdJK1zkRxpBwc6p6FzSZdZwCSpnJw==} + /@swc/core-win32-ia32-msvc@1.3.83: + resolution: {integrity: sha512-POW+rgZ6KWqBpwPGIRd2/3pcf46P+UrKBm4HLt5IwbHvekJ4avIM8ixJa9kK0muJNVJcDpaZgxaU1ELxtJ1j8w==} engines: {node: '>=10'} cpu: [ia32] os: [win32] @@ -670,8 +670,8 @@ packages: dev: true optional: true - /@swc/core-win32-x64-msvc@1.3.71: - resolution: {integrity: sha512-Pcw7fFirpaBOZsU8fhO48ZCb7NxIjuLnLRPrHqWQ4Mapx1+w9ZNdGya2DKP9n8EAiUrJO20WDsrBNMT2MQSWkA==} + /@swc/core-win32-x64-msvc@1.3.83: + resolution: {integrity: sha512-CiWQtkFnZElXQUalaHp+Wacw0Jd+24ncRYhqaJ9YKnEQP1H82CxIIuQqLM8IFaLpn5dpY6SgzaeubWF46hjcLA==} engines: {node: '>=10'} cpu: [x64] os: [win32] @@ -679,8 +679,8 @@ packages: dev: true optional: true - /@swc/core@1.3.71: - resolution: {integrity: sha512-T8dqj+SV/S8laW/FGmKHhCGw1o4GRUvJ2jHfbYgEwiJpeutT9uavHvG02t39HJvObBJ52EZs/krGtni4U5928Q==} + /@swc/core@1.3.83: + resolution: {integrity: sha512-PccHDgGQlFjpExgJxH91qA3a4aifR+axCFJ4RieCoiI0m5gURE4nBhxzTBY5YU/YKTBmPO8Gc5Q6inE3+NquWg==} engines: {node: '>=10'} requiresBuild: true peerDependencies: @@ -688,17 +688,23 @@ packages: peerDependenciesMeta: '@swc/helpers': optional: true + dependencies: + '@swc/types': 0.1.4 optionalDependencies: - '@swc/core-darwin-arm64': 1.3.71 - '@swc/core-darwin-x64': 1.3.71 - '@swc/core-linux-arm-gnueabihf': 1.3.71 - '@swc/core-linux-arm64-gnu': 1.3.71 - '@swc/core-linux-arm64-musl': 1.3.71 - '@swc/core-linux-x64-gnu': 1.3.71 - '@swc/core-linux-x64-musl': 1.3.71 - '@swc/core-win32-arm64-msvc': 1.3.71 - '@swc/core-win32-ia32-msvc': 1.3.71 - '@swc/core-win32-x64-msvc': 1.3.71 + '@swc/core-darwin-arm64': 1.3.83 + '@swc/core-darwin-x64': 1.3.83 + '@swc/core-linux-arm-gnueabihf': 1.3.83 + '@swc/core-linux-arm64-gnu': 1.3.83 + '@swc/core-linux-arm64-musl': 1.3.83 + '@swc/core-linux-x64-gnu': 1.3.83 + '@swc/core-linux-x64-musl': 1.3.83 + '@swc/core-win32-arm64-msvc': 1.3.83 + '@swc/core-win32-ia32-msvc': 1.3.83 + '@swc/core-win32-x64-msvc': 1.3.83 + dev: true + + /@swc/types@0.1.4: + resolution: {integrity: sha512-z/G02d+59gyyUb7KYhKi9jOhicek6QD2oMaotUyG+lUkybpXoV49dY9bj7Ah5Q+y7knK2jU67UTX9FyfGzaxQg==} dev: true /@szmarczak/http-timer@1.1.2: @@ -1360,7 +1366,7 @@ packages: dependencies: '@types/node': 20.4.7 cosmiconfig: 8.2.0 - ts-node: 10.9.1(@swc/core@1.3.71)(@types/node@20.4.9)(typescript@5.1.6) + ts-node: 10.9.1(@swc/core@1.3.83)(@types/node@20.4.9)(typescript@5.1.6) typescript: 5.1.6 dev: true @@ -2162,8 +2168,8 @@ packages: engines: {node: '>= 4'} dev: true - /immer@10.0.2: - resolution: {integrity: sha512-Rx3CqeqQ19sxUtYV9CU911Vhy8/721wRFnJv3REVGWUmoAcIwzifTsdmJte/MV+0/XpM35LZdQMBGkRIoLPwQA==} + /immer@9.0.21: + resolution: {integrity: sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==} dev: false /immutable@4.3.2: @@ -3188,7 +3194,7 @@ packages: optional: true dependencies: lilconfig: 2.1.0 - ts-node: 10.9.1(@swc/core@1.3.71)(@types/node@20.4.9)(typescript@5.1.6) + ts-node: 10.9.1(@swc/core@1.3.83)(@types/node@20.4.9)(typescript@5.1.6) yaml: 2.3.1 dev: true @@ -3939,7 +3945,7 @@ packages: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} dev: true - /ts-node@10.9.1(@swc/core@1.3.71)(@types/node@20.4.9)(typescript@5.1.6): + /ts-node@10.9.1(@swc/core@1.3.83)(@types/node@20.4.9)(typescript@5.1.6): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -3954,7 +3960,7 @@ packages: optional: true dependencies: '@cspotcode/source-map-support': 0.8.1 - '@swc/core': 1.3.71 + '@swc/core': 1.3.83 '@tsconfig/node10': 1.0.9 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 @@ -3975,7 +3981,7 @@ packages: resolution: {integrity: sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==} dev: true - /tsup@7.2.0(@swc/core@1.3.71)(ts-node@10.9.1)(typescript@5.1.6): + /tsup@7.2.0(@swc/core@1.3.83)(ts-node@10.9.1)(typescript@5.1.6): resolution: {integrity: sha512-vDHlczXbgUvY3rWvqFEbSqmC1L7woozbzngMqTtL2PGBODTtWlRwGDDawhvWzr5c1QjKe4OAKqJGfE1xeXUvtQ==} engines: {node: '>=16.14'} hasBin: true @@ -3991,7 +3997,7 @@ packages: typescript: optional: true dependencies: - '@swc/core': 1.3.71 + '@swc/core': 1.3.83 bundle-require: 4.0.1(esbuild@0.18.20) cac: 6.7.14 chokidar: 3.5.3 diff --git a/src/utils/immer.ts b/src/utils/immer.ts index 6d05c69..9898af6 100644 --- a/src/utils/immer.ts +++ b/src/utils/immer.ts @@ -1,4 +1,11 @@ -import { Immer } from 'immer'; +import { Immer, enableES5 } from 'immer'; + +/** + * 支持ES5,毕竟Proxy无法polyfill。有些用户手机可以10年不换!! + * @link https://immerjs.github.io/immer/docs/installation#pick-your-immer-version + * @since immer@6.0 + */ +enableES5(); export const immer = new Immer({ autoFreeze: false,