From 422da05d427f9018313f46ff08bae1f7075137a5 Mon Sep 17 00:00:00 2001 From: Jinx <61403813+Jokergga@users.noreply.github.com> Date: Wed, 20 Sep 2023 16:14:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(valtio):=20=E2=9C=A8=20add=20ref=E3=80=81w?= =?UTF-8?q?atch=20api=20and=20upgrades=20valtio=20(#11644)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(valtio): ✨ add ref、watch api and upgrades valtio * build: 🔧 add lock --- examples/with-valtio/.umirc.ts | 2 +- libs/valtio/package.json | 2 +- libs/valtio/src/index.ts | 3 ++- packages/plugins/src/valtio.ts | 2 ++ pnpm-lock.yaml | 14 +++++++++----- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/examples/with-valtio/.umirc.ts b/examples/with-valtio/.umirc.ts index 00dc1e91653b..66e1a689b1c3 100644 --- a/examples/with-valtio/.umirc.ts +++ b/examples/with-valtio/.umirc.ts @@ -1,4 +1,4 @@ export default { plugins: ['@umijs/plugins/dist/valtio'], - mfsu: false, + valtio: {}, }; diff --git a/libs/valtio/package.json b/libs/valtio/package.json index 6c0776e82cb4..1a1267de6106 100644 --- a/libs/valtio/package.json +++ b/libs/valtio/package.json @@ -23,7 +23,7 @@ "test": "jest" }, "dependencies": { - "valtio": "1.10.5" + "valtio": "1.11.2" }, "publishConfig": { "access": "public" diff --git a/libs/valtio/src/index.ts b/libs/valtio/src/index.ts index aabe873e2a4c..73a598024465 100644 --- a/libs/valtio/src/index.ts +++ b/libs/valtio/src/index.ts @@ -1,4 +1,4 @@ -export { proxy, snapshot, subscribe, useSnapshot } from 'valtio'; +export { proxy, ref, snapshot, subscribe, useSnapshot } from 'valtio'; export { derive, devtools as proxyWithDevtools, @@ -9,6 +9,7 @@ export { subscribeKey, underive, useProxy, + watch, } from 'valtio/utils'; // TODO: diff --git a/packages/plugins/src/valtio.ts b/packages/plugins/src/valtio.ts index bf50d730d160..4fcdb9283d39 100644 --- a/packages/plugins/src/valtio.ts +++ b/packages/plugins/src/valtio.ts @@ -40,6 +40,8 @@ export { derive, underive, useProxy, + ref, + watch, } from '${libPath}'; `, }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f6d376ea5e08..cb949a77d72f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1688,8 +1688,8 @@ importers: libs/valtio: dependencies: valtio: - specifier: 1.10.5 - version: 1.10.5(react@18.1.0) + specifier: 1.11.2 + version: 1.11.2(@types/react@18.0.26)(react@18.1.0) packages/ast: dependencies: @@ -44736,7 +44736,7 @@ packages: resolution: {integrity: sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==} hasBin: true peerDependencies: - browserslist: 4.21.5 + browserslist: '>= 4.21.0' dependencies: browserslist: 4.21.5 escalade: 3.1.1 @@ -45067,15 +45067,19 @@ packages: use-sync-external-store: 1.2.0(react@18.1.0) dev: false - /valtio@1.10.5(react@18.1.0): - resolution: {integrity: sha512-jTp0k63VXf4r5hPoaC6a6LCG4POkVSh629WLi1+d5PlajLsbynTMd7qAgEiOSPxzoX5iNvbN7iZ/k/g29wrNiQ==} + /valtio@1.11.2(@types/react@18.0.26)(react@18.1.0): + resolution: {integrity: sha512-1XfIxnUXzyswPAPXo1P3Pdx2mq/pIqZICkWN60Hby0d9Iqb+MEIpqgYVlbflvHdrp2YR/q3jyKWRPJJ100yxaw==} engines: {node: '>=12.20.0'} peerDependencies: + '@types/react': '>=16.8' react: '>=16.8' peerDependenciesMeta: + '@types/react': + optional: true react: optional: true dependencies: + '@types/react': 18.0.26 proxy-compare: 2.5.1 react: 18.1.0 use-sync-external-store: 1.2.0(react@18.1.0)