diff --git a/examples/solid/package.json b/examples/solid/package.json index 5b0f0350..b4097f3d 100644 --- a/examples/solid/package.json +++ b/examples/solid/package.json @@ -9,7 +9,6 @@ "lint:type": "tsc --noEmit" }, "dependencies": { - "@rsbuild/plugin-babel": "^0.3.5", "@webx-kit/runtime": "workspace:^", "solid-js": "^1.8.11" }, diff --git a/packages/storage/e2e/basic.spec.ts b/packages/storage/e2e/basic.spec.ts index e17954d2..c159bb78 100644 --- a/packages/storage/e2e/basic.spec.ts +++ b/packages/storage/e2e/basic.spec.ts @@ -3,6 +3,7 @@ import { ChromeStorage } from '@/index'; declare module globalThis { const __storage: ChromeStorage; + let __log: unknown[]; } test('Set Item', async ({ background }) => { @@ -29,3 +30,13 @@ test('Clear', async ({ background }) => { await expect(background.evaluate(() => globalThis.__storage.getItem('A'))).resolves.toBeNull(); await expect(background.evaluate(() => globalThis.__storage.getItem('B'))).resolves.toBeNull(); }); + +test('Subscribe', async ({ background }) => { + await background.evaluate(() => (globalThis.__log = [])); + await background.evaluate(() => globalThis.__storage.subscribe('A', globalThis.__log.push.bind(globalThis.__log))); + + await background.evaluate(() => globalThis.__storage.setItem('A', 'Hello')); + await background.evaluate(() => globalThis.__storage.removeItem('A')); + + await expect(background.evaluate(() => globalThis.__log)).resolves.toEqual(['Hello', null]); +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 18b806e0..4cea7200 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -118,9 +118,6 @@ importers: examples/solid: dependencies: - '@rsbuild/plugin-babel': - specifier: ^0.3.5 - version: 0.3.5(@rsbuild/core@0.3.5) '@webx-kit/runtime': specifier: workspace:^ version: link:../../packages/runtime @@ -2850,13 +2847,13 @@ packages: '@modern-js/new-action': 2.46.1(typescript@5.3.3) '@modern-js/node-bundle-require': 2.46.1 '@modern-js/plugin': 2.46.1 - '@modern-js/plugin-data-loader': 2.46.1(react-dom@18.2.0)(react@18.2.0) + '@modern-js/plugin-data-loader': 2.46.1 '@modern-js/plugin-i18n': 2.46.1 '@modern-js/plugin-lint': 2.46.1 - '@modern-js/prod-server': 2.46.1(react-dom@18.2.0)(react@18.2.0) - '@modern-js/server': 2.46.1(@babel/traverse@7.23.7) + '@modern-js/prod-server': 2.46.1 + '@modern-js/server': 2.46.1(@babel/traverse@7.23.7)(@rsbuild/core@0.3.4) '@modern-js/server-core': 2.46.1 - '@modern-js/server-utils': 2.46.1(@babel/traverse@7.23.7) + '@modern-js/server-utils': 2.46.1(@babel/traverse@7.23.7)(@rsbuild/core@0.3.4) '@modern-js/types': 2.46.1 '@modern-js/uni-builder': 2.46.1(@babel/traverse@7.23.7)(esbuild@0.17.19)(typescript@5.3.3) '@modern-js/upgrade': 2.46.1 @@ -3093,6 +3090,23 @@ packages: esbuild: 0.17.19 dev: true + /@modern-js/plugin-data-loader@2.46.1: + resolution: {integrity: sha512-YUpj7kQnf8vfXtTBhKQc9LoI7TGZCEmO1Q2S9YTre/vsd8tn25C71AupEhCMrZh5RzyugHPe2RQ+Ad7FbyOftQ==} + engines: {node: '>=14.17.6'} + peerDependencies: + react: '>=17.0.0' + dependencies: + '@babel/core': 7.23.7 + '@modern-js/runtime-utils': 2.46.1 + '@modern-js/utils': 2.46.1 + '@remix-run/node': 1.19.3 + '@swc/helpers': 0.5.3 + path-to-regexp: 6.2.1 + transitivePeerDependencies: + - react-dom + - supports-color + dev: true + /@modern-js/plugin-data-loader@2.46.1(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-YUpj7kQnf8vfXtTBhKQc9LoI7TGZCEmO1Q2S9YTre/vsd8tn25C71AupEhCMrZh5RzyugHPe2RQ+Ad7FbyOftQ==} engines: {node: '>=14.17.6'} @@ -3138,6 +3152,32 @@ packages: '@swc/helpers': 0.5.3 dev: true + /@modern-js/prod-server@2.46.1: + resolution: {integrity: sha512-O2q0G5QbPd80FMkqi7Mf/kD3sznOUCfhfV7BSzJLHM6djFAdxz8l3wytGL2jUADImTwKv30rWgp6f9dcg2+WPA==} + dependencies: + '@modern-js/plugin': 2.46.1 + '@modern-js/runtime-utils': 2.46.1 + '@modern-js/server-core': 2.46.1 + '@modern-js/utils': 2.46.1 + '@swc/helpers': 0.5.3 + cookie: 0.5.0 + etag: 1.8.1 + fresh: 0.5.2 + http-proxy-middleware: 2.0.6 + ignore-styles: 5.0.1 + isbot: 3.8.0 + merge-deep: 3.0.3 + node-html-parser: 6.1.12 + path-to-regexp: 6.2.1 + serve-static: 1.15.0 + transitivePeerDependencies: + - '@types/express' + - debug + - react + - react-dom + - supports-color + dev: true + /@modern-js/prod-server@2.46.1(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-O2q0G5QbPd80FMkqi7Mf/kD3sznOUCfhfV7BSzJLHM6djFAdxz8l3wytGL2jUADImTwKv30rWgp6f9dcg2+WPA==} dependencies: @@ -3164,6 +3204,25 @@ packages: - supports-color dev: true + /@modern-js/runtime-utils@2.46.1: + resolution: {integrity: sha512-/dfd2VOxFlG5zLjpLILaWTJpGpoVufQmIe/zyxUmfmc25hTNvCaYpHgcBJdTuJstqkvo0EsenHWMZ+ESx7WIfw==} + peerDependencies: + react: '>=17.0.0' + react-dom: '>=17.0.0' + peerDependenciesMeta: + react: + optional: true + react-dom: + optional: true + dependencies: + '@modern-js/utils': 2.46.1 + '@remix-run/router': 1.10.0 + '@swc/helpers': 0.5.3 + lru-cache: 6.0.0 + react-router-dom: 6.17.0 + serialize-javascript: 6.0.2 + dev: true + /@modern-js/runtime-utils@2.46.1(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-/dfd2VOxFlG5zLjpLILaWTJpGpoVufQmIe/zyxUmfmc25hTNvCaYpHgcBJdTuJstqkvo0EsenHWMZ+ESx7WIfw==} peerDependencies: @@ -3249,9 +3308,9 @@ packages: dependencies: '@babel/core': 7.23.7 '@babel/register': 7.23.7(@babel/core@7.23.7) - '@modern-js/prod-server': 2.46.1(react-dom@18.2.0)(react@18.2.0) - '@modern-js/runtime-utils': 2.46.1(react-dom@18.2.0)(react@18.2.0) - '@modern-js/server-utils': 2.46.1(@babel/traverse@7.23.7) + '@modern-js/prod-server': 2.46.1 + '@modern-js/runtime-utils': 2.46.1 + '@modern-js/server-utils': 2.46.1(@babel/traverse@7.23.7)(@rsbuild/core@0.3.4) '@modern-js/types': 2.46.1 '@modern-js/utils': 2.46.1 '@swc/helpers': 0.5.3 @@ -3289,8 +3348,8 @@ packages: dependencies: '@babel/core': 7.23.7 '@babel/register': 7.23.7(@babel/core@7.23.7) - '@modern-js/prod-server': 2.46.1(react-dom@18.2.0)(react@18.2.0) - '@modern-js/runtime-utils': 2.46.1(react-dom@18.2.0)(react@18.2.0) + '@modern-js/prod-server': 2.46.1 + '@modern-js/runtime-utils': 2.46.1 '@modern-js/server-utils': 2.46.1(@babel/traverse@7.23.7)(@rsbuild/core@0.3.4) '@modern-js/types': 2.46.1 '@modern-js/utils': 2.46.1 @@ -3487,7 +3546,7 @@ packages: '@babel/core': 7.23.7 '@babel/preset-react': 7.23.3(@babel/core@7.23.7) '@babel/types': 7.23.6 - '@modern-js/prod-server': 2.46.1(react-dom@18.2.0)(react@18.2.0) + '@modern-js/prod-server': 2.46.1 '@modern-js/server': 2.46.1(@babel/traverse@7.23.7)(@rsbuild/core@0.3.4) '@modern-js/utils': 2.46.1 '@pmmmwh/react-refresh-webpack-plugin': 0.5.10(react-refresh@0.14.0)(webpack@5.89.0) @@ -9322,6 +9381,17 @@ packages: - react-dom dev: false + /react-router-dom@6.17.0: + resolution: {integrity: sha512-qWHkkbXQX+6li0COUUPKAUkxjNNqPJuiBd27dVwQGDNsuFBdMbrS6UZ0CLYc4CsbdLYTckn4oB4tGDuPZpPhaQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + react: '>=16.8' + react-dom: '>=16.8' + dependencies: + '@remix-run/router': 1.10.0 + react-router: 6.17.0 + dev: true + /react-router-dom@6.17.0(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-qWHkkbXQX+6li0COUUPKAUkxjNNqPJuiBd27dVwQGDNsuFBdMbrS6UZ0CLYc4CsbdLYTckn4oB4tGDuPZpPhaQ==} engines: {node: '>=14.0.0'} @@ -9335,6 +9405,15 @@ packages: react-router: 6.17.0(react@18.2.0) dev: true + /react-router@6.17.0: + resolution: {integrity: sha512-YJR3OTJzi3zhqeJYADHANCGPUu9J+6fT5GLv82UWRGSxu6oJYCKVmxUcaBQuGm9udpWmPsvpme/CdHumqgsoaA==} + engines: {node: '>=14.0.0'} + peerDependencies: + react: '>=16.8' + dependencies: + '@remix-run/router': 1.10.0 + dev: true + /react-router@6.17.0(react@18.2.0): resolution: {integrity: sha512-YJR3OTJzi3zhqeJYADHANCGPUu9J+6fT5GLv82UWRGSxu6oJYCKVmxUcaBQuGm9udpWmPsvpme/CdHumqgsoaA==} engines: {node: '>=14.0.0'}