From f8452fc1d3750693b5fd1556da64fceec930e21c Mon Sep 17 00:00:00 2001 From: Romuald Brillout Date: Fri, 27 Dec 2024 15:50:45 +0100 Subject: [PATCH 1/6] fix: stop overriding Wrapper meta --- packages/vike-react-antd/{Wrapper.tsx => Wrapper.server.tsx} | 0 packages/vike-react-antd/config.ts | 3 --- packages/vike-react-antd/package.json | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) rename packages/vike-react-antd/{Wrapper.tsx => Wrapper.server.tsx} (100%) diff --git a/packages/vike-react-antd/Wrapper.tsx b/packages/vike-react-antd/Wrapper.server.tsx similarity index 100% rename from packages/vike-react-antd/Wrapper.tsx rename to packages/vike-react-antd/Wrapper.server.tsx diff --git a/packages/vike-react-antd/config.ts b/packages/vike-react-antd/config.ts index 1118ace2..05760107 100644 --- a/packages/vike-react-antd/config.ts +++ b/packages/vike-react-antd/config.ts @@ -13,9 +13,6 @@ const config = { onBeforeRenderHtml: 'import:vike-react-antd/__internal/onBeforeRenderHtml:onBeforeRenderHtml', Wrapper: 'import:vike-react-antd/__internal/Wrapper:Wrapper', meta: { - Wrapper: { - env: { server: true }, - }, antd: { env: { server: true, diff --git a/packages/vike-react-antd/package.json b/packages/vike-react-antd/package.json index e272dcf8..18495994 100644 --- a/packages/vike-react-antd/package.json +++ b/packages/vike-react-antd/package.json @@ -6,7 +6,7 @@ "./config": "./dist/config.js", "./__internal/onAfterRenderHtml": "./dist/onAfterRenderHtml.js", "./__internal/onBeforeRenderHtml": "./dist/onBeforeRenderHtml.js", - "./__internal/Wrapper": "./dist/Wrapper.js" + "./__internal/Wrapper": "./dist/Wrapper.server.js" }, "scripts": { "dev": "tsc --watch", From 5063795c3f7bc5a9b6879704a122f6d7be39023d Mon Sep 17 00:00:00 2001 From: Muhammad Date: Sat, 28 Dec 2024 15:45:48 +0700 Subject: [PATCH 2/6] test --- examples/full/package.json | 3 +++ examples/full/pages/+config.ts | 3 ++- examples/full/pages/index/+Page.tsx | 5 +++++ packages/vike-react-antd/Wrapper.server.tsx | 5 ++--- pnpm-lock.yaml | 9 +++++++++ 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/examples/full/package.json b/examples/full/package.json index 6661629f..80bb1713 100644 --- a/examples/full/package.json +++ b/examples/full/package.json @@ -5,9 +5,11 @@ "preview": "vite build && vite preview" }, "dependencies": { + "@ant-design/cssinjs": "^1.22.1", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@vitejs/plugin-react": "^4.3.1", + "antd": "^5.22.5", "node-fetch": "^3.3.2", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -15,6 +17,7 @@ "typescript": "^5.5.4", "vike": "^0.4.203", "vike-react": "^0.5.11", + "vike-react-antd": "^0.0.0", "vite": "^5.4.0" }, "type": "module" diff --git a/examples/full/pages/+config.ts b/examples/full/pages/+config.ts index 05d71c61..6f411159 100644 --- a/examples/full/pages/+config.ts +++ b/examples/full/pages/+config.ts @@ -2,6 +2,7 @@ export { config } import type { Config } from 'vike/types' import vikeReact from 'vike-react/config' +import vikeReactAntd from 'vike-react-antd/config' // Default configs (can be overridden by pages) const config = { @@ -14,5 +15,5 @@ const config = { bodyAttributes: { class: 'dark' }, viewport: 999, // https://vike.dev/extends - extends: vikeReact, + extends: [vikeReact, vikeReactAntd], } satisfies Config diff --git a/examples/full/pages/index/+Page.tsx b/examples/full/pages/index/+Page.tsx index e909569b..36eb50dc 100644 --- a/examples/full/pages/index/+Page.tsx +++ b/examples/full/pages/index/+Page.tsx @@ -4,6 +4,7 @@ import React from 'react' import { Counter } from '../../components/Counter' import image from '../../assets/logo-new.svg' import { Config } from 'vike-react/Config' +import { Button, Flex } from 'antd' function Page() { // Will be printed on the server and in the browser: @@ -20,6 +21,10 @@ function Page() { Interactive. + + + + ) } diff --git a/packages/vike-react-antd/Wrapper.server.tsx b/packages/vike-react-antd/Wrapper.server.tsx index 12c26bbb..d6a5718e 100644 --- a/packages/vike-react-antd/Wrapper.server.tsx +++ b/packages/vike-react-antd/Wrapper.server.tsx @@ -7,14 +7,13 @@ import { usePageContext } from 'vike-react/usePageContext' function Wrapper({ children }: { children: ReactNode }) { const pageContext = usePageContext() const { antd } = pageContext.config - const cache = 'antd' in pageContext ? pageContext.antd?.cache : undefined - if (antd === null || !cache) { + if (antd === null) { return <>{children} } return ( - + {children} ) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4286aca0..71ad8489 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -77,6 +77,9 @@ importers: examples/full: dependencies: + '@ant-design/cssinjs': + specifier: ^1.22.1 + version: 1.22.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@types/react': specifier: ^18.3.3 version: 18.3.3 @@ -86,6 +89,9 @@ importers: '@vitejs/plugin-react': specifier: ^4.3.1 version: 4.3.1(vite@5.4.0(@types/node@20.11.17)) + antd: + specifier: ^5.22.5 + version: 5.22.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1) node-fetch: specifier: ^3.3.2 version: 3.3.2 @@ -107,6 +113,9 @@ importers: vike-react: specifier: link:../../packages/vike-react version: link:../../packages/vike-react + vike-react-antd: + specifier: link:../../packages/vike-react-antd + version: link:../../packages/vike-react-antd vite: specifier: ^5.4.0 version: 5.4.0(@types/node@20.11.17) From 3faeeef90770601429a0a54aa75d26984c52414d Mon Sep 17 00:00:00 2001 From: Romuald Brillout Date: Sat, 28 Dec 2024 12:46:37 +0100 Subject: [PATCH 3/6] chore: bump vike --- examples/apollo/package.json | 2 +- examples/full/package.json | 2 +- examples/react-query/package.json | 2 +- packages/vike-react-antd/package.json | 2 +- packages/vike-react-apollo/package.json | 2 +- packages/vike-react-chakra/package.json | 2 +- packages/vike-react-query/package.json | 2 +- .../vike-react-styled-components/package.json | 2 +- packages/vike-react-styled-jsx/package.json | 2 +- packages/vike-react/package.json | 2 +- pnpm-lock.yaml | 82 ++++++++++++++----- 11 files changed, 72 insertions(+), 30 deletions(-) diff --git a/examples/apollo/package.json b/examples/apollo/package.json index 465fc57e..5e93f2ba 100644 --- a/examples/apollo/package.json +++ b/examples/apollo/package.json @@ -11,7 +11,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "typescript": "^5.3.3", - "vike": "^0.4.203", + "vike": "^0.4.211", "vike-react": "^0.5.11", "vike-react-apollo": "^0.1.1", "@apollo/client": "^3.10.8", diff --git a/examples/full/package.json b/examples/full/package.json index 80bb1713..e15b3de7 100644 --- a/examples/full/package.json +++ b/examples/full/package.json @@ -15,7 +15,7 @@ "react-dom": "^18.3.1", "react-streaming": "^0.3.43", "typescript": "^5.5.4", - "vike": "^0.4.203", + "vike": "^0.4.211", "vike-react": "^0.5.11", "vike-react-antd": "^0.0.0", "vite": "^5.4.0" diff --git a/examples/react-query/package.json b/examples/react-query/package.json index d92df817..a43b8c89 100644 --- a/examples/react-query/package.json +++ b/examples/react-query/package.json @@ -10,7 +10,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "typescript": "^5.5.3", - "vike": "^0.4.203", + "vike": "^0.4.211", "vike-react": "^0.5.11", "vike-react-query": "^0.1.3", "@tanstack/react-query": "^5.20.1", diff --git a/packages/vike-react-antd/package.json b/packages/vike-react-antd/package.json index 18495994..f8f407c0 100644 --- a/packages/vike-react-antd/package.json +++ b/packages/vike-react-antd/package.json @@ -30,7 +30,7 @@ "react": "^18.3.1", "rimraf": "^5.0.5", "typescript": "^5.5.3", - "vike": "^0.4.203", + "vike": "^0.4.211", "vike-react": "^0.5.11", "vite": "^5.4.0" }, diff --git a/packages/vike-react-apollo/package.json b/packages/vike-react-apollo/package.json index fb884374..d2763bbe 100644 --- a/packages/vike-react-apollo/package.json +++ b/packages/vike-react-apollo/package.json @@ -38,7 +38,7 @@ "react-streaming": "^0.3.43", "rimraf": "^5.0.5", "typescript": "^5.3.3", - "vike": "^0.4.203", + "vike": "^0.4.211", "vike-react": "^0.5.11", "vite": "^5.4.0" }, diff --git a/packages/vike-react-chakra/package.json b/packages/vike-react-chakra/package.json index b7920096..fdc99645 100644 --- a/packages/vike-react-chakra/package.json +++ b/packages/vike-react-chakra/package.json @@ -28,7 +28,7 @@ "react": "^18.3.1", "rimraf": "^5.0.5", "typescript": "^5.5.3", - "vike": "^0.4.203", + "vike": "^0.4.211", "vike-react": "^0.5.11", "vite": "^5.4.0" }, diff --git a/packages/vike-react-query/package.json b/packages/vike-react-query/package.json index de6cd2dd..1e15b55e 100644 --- a/packages/vike-react-query/package.json +++ b/packages/vike-react-query/package.json @@ -35,7 +35,7 @@ "react-streaming": "^0.3.43", "rimraf": "^5.0.5", "typescript": "^5.5.3", - "vike": "^0.4.203", + "vike": "^0.4.211", "vike-react": "^0.5.11", "vite": "^5.4.0", "vitest": "^1.2.2" diff --git a/packages/vike-react-styled-components/package.json b/packages/vike-react-styled-components/package.json index 2c1aabbf..614fb126 100644 --- a/packages/vike-react-styled-components/package.json +++ b/packages/vike-react-styled-components/package.json @@ -28,7 +28,7 @@ "rimraf": "^5.0.5", "styled-components": "^6.1.13", "typescript": "^5.5.3", - "vike": "^0.4.203", + "vike": "^0.4.211", "vike-react": "^0.5.11", "vite": "^5.4.0" }, diff --git a/packages/vike-react-styled-jsx/package.json b/packages/vike-react-styled-jsx/package.json index fcc70f93..cfe5159c 100644 --- a/packages/vike-react-styled-jsx/package.json +++ b/packages/vike-react-styled-jsx/package.json @@ -28,7 +28,7 @@ "rimraf": "^5.0.5", "styled-jsx": "^5.1.6", "typescript": "^5.5.3", - "vike": "^0.4.203", + "vike": "^0.4.211", "vike-react": "^0.5.11", "vite": "^5.4.0" }, diff --git a/packages/vike-react/package.json b/packages/vike-react/package.json index 147246f3..1f78cb6f 100644 --- a/packages/vike-react/package.json +++ b/packages/vike-react/package.json @@ -53,7 +53,7 @@ "react-streaming": "^0.3.43", "rimraf": "^5.0.5", "typescript": "^5.5.4", - "vike": "^0.4.203", + "vike": "^0.4.211", "vite": "^5.4.0" }, "typesVersions": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 71ad8489..f18cfca2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -63,8 +63,8 @@ importers: specifier: ^5.3.3 version: 5.5.3 vike: - specifier: ^0.4.203 - version: 0.4.203(react-streaming@0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) + specifier: ^0.4.211 + version: 0.4.211(react-streaming@0.3.43(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) vike-react: specifier: link:../../packages/vike-react version: link:../../packages/vike-react @@ -108,8 +108,8 @@ importers: specifier: ^5.5.4 version: 5.5.4 vike: - specifier: ^0.4.203 - version: 0.4.203(react-streaming@0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) + specifier: ^0.4.211 + version: 0.4.211(react-streaming@0.3.43(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) vike-react: specifier: link:../../packages/vike-react version: link:../../packages/vike-react @@ -165,8 +165,8 @@ importers: specifier: ^5.5.3 version: 5.5.3 vike: - specifier: ^0.4.203 - version: 0.4.203(react-streaming@0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) + specifier: ^0.4.211 + version: 0.4.211(react-streaming@0.3.43(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) vike-react: specifier: link:../../packages/vike-react version: link:../../packages/vike-react @@ -211,8 +211,8 @@ importers: specifier: ^5.5.4 version: 5.5.4 vike: - specifier: ^0.4.203 - version: 0.4.203(react-streaming@0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) + specifier: ^0.4.211 + version: 0.4.211(react-streaming@0.3.43(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) vite: specifier: ^5.4.0 version: 5.4.0(@types/node@20.11.17) @@ -241,8 +241,8 @@ importers: specifier: ^5.5.3 version: 5.5.4 vike: - specifier: ^0.4.203 - version: 0.4.203(react-streaming@0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) + specifier: ^0.4.211 + version: 0.4.211(react-streaming@0.3.43(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) vike-react: specifier: link:../vike-react version: link:../vike-react @@ -293,8 +293,8 @@ importers: specifier: ^5.3.3 version: 5.5.3 vike: - specifier: ^0.4.203 - version: 0.4.203(react-streaming@0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) + specifier: ^0.4.211 + version: 0.4.211(react-streaming@0.3.43(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) vike-react: specifier: link:../vike-react version: link:../vike-react @@ -326,8 +326,8 @@ importers: specifier: ^5.5.3 version: 5.5.4 vike: - specifier: ^0.4.203 - version: 0.4.203(react-streaming@0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) + specifier: ^0.4.211 + version: 0.4.211(react-streaming@0.3.43(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) vike-react: specifier: link:../vike-react version: link:../vike-react @@ -375,8 +375,8 @@ importers: specifier: ^5.5.3 version: 5.5.3 vike: - specifier: ^0.4.203 - version: 0.4.203(react-streaming@0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) + specifier: ^0.4.211 + version: 0.4.211(react-streaming@0.3.43(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) vike-react: specifier: link:../vike-react version: link:../vike-react @@ -408,8 +408,8 @@ importers: specifier: ^5.5.3 version: 5.5.4 vike: - specifier: ^0.4.203 - version: 0.4.203(react-streaming@0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) + specifier: ^0.4.211 + version: 0.4.211(react-streaming@0.3.43(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) vike-react: specifier: link:../vike-react version: link:../vike-react @@ -438,8 +438,8 @@ importers: specifier: ^5.5.3 version: 5.5.4 vike: - specifier: ^0.4.203 - version: 0.4.203(react-streaming@0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) + specifier: ^0.4.211 + version: 0.4.211(react-streaming@0.3.43(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)) vike-react: specifier: link:../vike-react version: link:../vike-react @@ -839,6 +839,9 @@ packages: '@brillout/json-serializer@0.5.13': resolution: {integrity: sha512-9FpmgpuoSISw6fAPVB2qwW1dGAADN28YbWpfwOErfcZxpBH4lsnejuY89qcivInnWXYJvyyPwghCuOTbtuaYFg==} + '@brillout/json-serializer@0.5.15': + resolution: {integrity: sha512-iLAyV1HNC3nG07ypBwCJohFrajY1HeZdfBBgGuRtMH/JPddgG9bPmoSI18A1RBx67vRmY6/8rgisjR5YfTvZHA==} + '@brillout/part-regex@0.1.3': resolution: {integrity: sha512-ZyqtOYHvQs3Ca0xt9fb2OlGzCrKwXtMcAATDObkFmI4jKuObEORjWrqAslWTelquXlyEYLz7h1nt6jp50LDyJA==} @@ -874,6 +877,9 @@ packages: '@brillout/vite-plugin-server-entry@0.5.1': resolution: {integrity: sha512-ZoXt8D/Z1E6e8ylKm5z8VzuxtIqPfLoWvsKkeK08LIpfCnRMxRJQLBZ1i3s9gGxE5+PvzY2dU5pBr7dL9aM8bg==} + '@brillout/vite-plugin-server-entry@0.5.6': + resolution: {integrity: sha512-lxgvTQhQBucZehhkvq9x2C7IUfrkAhp+YkW8S0MVR5EYkf6EWBg+bYZWB0//mDfbmUcc8aAEe3uRto7pOg35Ig==} + '@chakra-ui/react@3.0.2': resolution: {integrity: sha512-xfW0tGCLJSvNkMFrz4zyjvImugwVb4gYvsGOT9hISMhDvh20ciS3WEI8S+jia4ytkl5yI4H0KPyuMjQt/gM69Q==} peerDependencies: @@ -3623,6 +3629,17 @@ packages: react-streaming: optional: true + vike@0.4.211: + resolution: {integrity: sha512-W7HbzTqwuIhLm/HmOl5rjCX4ZuOhxTgI/h0bqBkVOeCwrO8Ixo545oQJeXQ+3MojpDThLQFMeBvwdN9T03wVrw==} + engines: {node: '>=18.0.0'} + hasBin: true + peerDependencies: + react-streaming: '>=0.3.42' + vite: '>=5.1.0' + peerDependenciesMeta: + react-streaming: + optional: true + vite-node@1.2.2: resolution: {integrity: sha512-1as4rDTgVWJO3n1uHmUYqq7nsFgINQ9u+mRcXpjeOMJUmviqNKjcZB7UfRZrlM7MjYXMKpuWp5oGkjaFLnjawg==} engines: {node: ^18.0.0 || >=20.0.0} @@ -4316,6 +4333,8 @@ snapshots: '@brillout/json-serializer@0.5.13': {} + '@brillout/json-serializer@0.5.15': {} + '@brillout/part-regex@0.1.3': {} '@brillout/picocolors@1.0.10': {} @@ -4363,6 +4382,11 @@ snapshots: dependencies: '@brillout/import': 0.2.3 + '@brillout/vite-plugin-server-entry@0.5.6': + dependencies: + '@brillout/import': 0.2.3 + '@brillout/picocolors': 1.0.15 + '@chakra-ui/react@3.0.2(@emotion/react@11.13.3(@types/react@18.3.3)(react@18.3.1))(@internationalized/date@3.5.6)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@ark-ui/anatomy': 3.5.0(@internationalized/date@3.5.6) @@ -7741,6 +7765,24 @@ snapshots: optionalDependencies: react-streaming: 0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + vike@0.4.211(react-streaming@0.3.43(react@18.3.1))(vite@5.4.0(@types/node@20.11.17)): + dependencies: + '@brillout/import': 0.2.3 + '@brillout/json-serializer': 0.5.15 + '@brillout/picocolors': 1.0.15 + '@brillout/require-shim': 0.1.2 + '@brillout/vite-plugin-server-entry': 0.5.6 + acorn: 8.11.2 + cac: 6.7.14 + es-module-lexer: 1.4.1 + esbuild: 0.21.5 + fast-glob: 3.3.2 + semver: 7.6.2 + source-map-support: 0.5.21 + vite: 5.4.0(@types/node@20.11.17) + optionalDependencies: + react-streaming: 0.3.43(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + vite-node@1.2.2(@types/node@20.11.17): dependencies: cac: 6.7.14 From f0bbbbc296bc9f302d4ae1244ff26b6294c7660a Mon Sep 17 00:00:00 2001 From: Muhammad Date: Sat, 28 Dec 2024 23:27:15 +0700 Subject: [PATCH 4/6] Revert "test" This reverts commit 5063795c3f7bc5a9b6879704a122f6d7be39023d. --- examples/full/package.json | 3 --- examples/full/pages/+config.ts | 3 +-- examples/full/pages/index/+Page.tsx | 5 ----- packages/vike-react-antd/Wrapper.server.tsx | 5 +++-- pnpm-lock.yaml | 9 --------- 5 files changed, 4 insertions(+), 21 deletions(-) diff --git a/examples/full/package.json b/examples/full/package.json index e15b3de7..fef6872a 100644 --- a/examples/full/package.json +++ b/examples/full/package.json @@ -5,11 +5,9 @@ "preview": "vite build && vite preview" }, "dependencies": { - "@ant-design/cssinjs": "^1.22.1", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@vitejs/plugin-react": "^4.3.1", - "antd": "^5.22.5", "node-fetch": "^3.3.2", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -17,7 +15,6 @@ "typescript": "^5.5.4", "vike": "^0.4.211", "vike-react": "^0.5.11", - "vike-react-antd": "^0.0.0", "vite": "^5.4.0" }, "type": "module" diff --git a/examples/full/pages/+config.ts b/examples/full/pages/+config.ts index 6f411159..05d71c61 100644 --- a/examples/full/pages/+config.ts +++ b/examples/full/pages/+config.ts @@ -2,7 +2,6 @@ export { config } import type { Config } from 'vike/types' import vikeReact from 'vike-react/config' -import vikeReactAntd from 'vike-react-antd/config' // Default configs (can be overridden by pages) const config = { @@ -15,5 +14,5 @@ const config = { bodyAttributes: { class: 'dark' }, viewport: 999, // https://vike.dev/extends - extends: [vikeReact, vikeReactAntd], + extends: vikeReact, } satisfies Config diff --git a/examples/full/pages/index/+Page.tsx b/examples/full/pages/index/+Page.tsx index 36eb50dc..e909569b 100644 --- a/examples/full/pages/index/+Page.tsx +++ b/examples/full/pages/index/+Page.tsx @@ -4,7 +4,6 @@ import React from 'react' import { Counter } from '../../components/Counter' import image from '../../assets/logo-new.svg' import { Config } from 'vike-react/Config' -import { Button, Flex } from 'antd' function Page() { // Will be printed on the server and in the browser: @@ -21,10 +20,6 @@ function Page() { Interactive. - - - - ) } diff --git a/packages/vike-react-antd/Wrapper.server.tsx b/packages/vike-react-antd/Wrapper.server.tsx index d6a5718e..12c26bbb 100644 --- a/packages/vike-react-antd/Wrapper.server.tsx +++ b/packages/vike-react-antd/Wrapper.server.tsx @@ -7,13 +7,14 @@ import { usePageContext } from 'vike-react/usePageContext' function Wrapper({ children }: { children: ReactNode }) { const pageContext = usePageContext() const { antd } = pageContext.config + const cache = 'antd' in pageContext ? pageContext.antd?.cache : undefined - if (antd === null) { + if (antd === null || !cache) { return <>{children} } return ( - + {children} ) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f18cfca2..db2121dd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -77,9 +77,6 @@ importers: examples/full: dependencies: - '@ant-design/cssinjs': - specifier: ^1.22.1 - version: 1.22.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@types/react': specifier: ^18.3.3 version: 18.3.3 @@ -89,9 +86,6 @@ importers: '@vitejs/plugin-react': specifier: ^4.3.1 version: 4.3.1(vite@5.4.0(@types/node@20.11.17)) - antd: - specifier: ^5.22.5 - version: 5.22.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1) node-fetch: specifier: ^3.3.2 version: 3.3.2 @@ -113,9 +107,6 @@ importers: vike-react: specifier: link:../../packages/vike-react version: link:../../packages/vike-react - vike-react-antd: - specifier: link:../../packages/vike-react-antd - version: link:../../packages/vike-react-antd vite: specifier: ^5.4.0 version: 5.4.0(@types/node@20.11.17) From ddcab7c21742b3701909b3698dca21b89c3dfebc Mon Sep 17 00:00:00 2001 From: Muhammad Date: Sun, 29 Dec 2024 00:01:32 +0700 Subject: [PATCH 5/6] fix: stop overriding Wrapper meta --- packages/vike-react-antd/config.ts | 2 +- packages/vike-react-antd/package.json | 2 +- .../{Wrapper.tsx => Wrapper.server.tsx} | 0 packages/vike-react-styled-components/config.ts | 5 +---- packages/vike-react-styled-components/package.json | 4 ++-- .../{Wrapper.tsx => Wrapper.server.tsx} | 0 packages/vike-react-styled-jsx/config.ts | 5 +---- packages/vike-react-styled-jsx/package.json | 4 ++-- 8 files changed, 8 insertions(+), 14 deletions(-) rename packages/vike-react-styled-components/{Wrapper.tsx => Wrapper.server.tsx} (100%) rename packages/vike-react-styled-jsx/{Wrapper.tsx => Wrapper.server.tsx} (100%) diff --git a/packages/vike-react-antd/config.ts b/packages/vike-react-antd/config.ts index 05760107..922e3dc4 100644 --- a/packages/vike-react-antd/config.ts +++ b/packages/vike-react-antd/config.ts @@ -6,7 +6,7 @@ import type { Config } from 'vike/types' const config = { name: 'vike-react-antd', require: { - vike: '>=0.4.203', + vike: '>=0.4.211', 'vike-react': '>=0.4.13', }, onAfterRenderHtml: 'import:vike-react-antd/__internal/onAfterRenderHtml:onAfterRenderHtml', diff --git a/packages/vike-react-antd/package.json b/packages/vike-react-antd/package.json index f8f407c0..b83af7d2 100644 --- a/packages/vike-react-antd/package.json +++ b/packages/vike-react-antd/package.json @@ -46,7 +46,7 @@ "dist/onBeforeRenderHtml.d.ts" ], "__internal/Wrapper": [ - "dist/Wrapper.d.ts" + "dist/Wrapper.server.d.ts" ] } }, diff --git a/packages/vike-react-styled-components/Wrapper.tsx b/packages/vike-react-styled-components/Wrapper.server.tsx similarity index 100% rename from packages/vike-react-styled-components/Wrapper.tsx rename to packages/vike-react-styled-components/Wrapper.server.tsx diff --git a/packages/vike-react-styled-components/config.ts b/packages/vike-react-styled-components/config.ts index 17396bd5..9874b53d 100644 --- a/packages/vike-react-styled-components/config.ts +++ b/packages/vike-react-styled-components/config.ts @@ -6,16 +6,13 @@ import type { Config } from 'vike/types' const config = { name: 'vike-react-styled-components', require: { - vike: '>=0.4.203', + vike: '>=0.4.211', 'vike-react': '>=0.4.13', }, onAfterRenderHtml: 'import:vike-react-styled-components/__internal/onAfterRenderHtml:onAfterRenderHtml', onBeforeRenderHtml: 'import:vike-react-styled-components/__internal/onBeforeRenderHtml:onBeforeRenderHtml', Wrapper: 'import:vike-react-styled-components/__internal/Wrapper:Wrapper', meta: { - Wrapper: { - env: { server: true }, - }, styledComponents: { env: { server: true, diff --git a/packages/vike-react-styled-components/package.json b/packages/vike-react-styled-components/package.json index 614fb126..7dff366a 100644 --- a/packages/vike-react-styled-components/package.json +++ b/packages/vike-react-styled-components/package.json @@ -6,7 +6,7 @@ "./config": "./dist/config.js", "./__internal/onAfterRenderHtml": "./dist/onAfterRenderHtml.js", "./__internal/onBeforeRenderHtml": "./dist/onBeforeRenderHtml.js", - "./__internal/Wrapper": "./dist/Wrapper.js" + "./__internal/Wrapper": "./dist/Wrapper.server.js" }, "scripts": { "dev": "tsc --watch", @@ -44,7 +44,7 @@ "dist/onBeforeRenderHtml.d.ts" ], "__internal/Wrapper": [ - "dist/Wrapper.d.ts" + "dist/Wrapper.server.d.ts" ] } }, diff --git a/packages/vike-react-styled-jsx/Wrapper.tsx b/packages/vike-react-styled-jsx/Wrapper.server.tsx similarity index 100% rename from packages/vike-react-styled-jsx/Wrapper.tsx rename to packages/vike-react-styled-jsx/Wrapper.server.tsx diff --git a/packages/vike-react-styled-jsx/config.ts b/packages/vike-react-styled-jsx/config.ts index dfcbb2fb..8aa50c68 100644 --- a/packages/vike-react-styled-jsx/config.ts +++ b/packages/vike-react-styled-jsx/config.ts @@ -6,7 +6,7 @@ import type { StyledJsxStyleRegistry } from 'styled-jsx' const config = { name: 'vike-react-styled-jsx', require: { - vike: '>=0.4.203', + vike: '>=0.4.211', 'vike-react': '>=0.4.13', }, onBeforeRenderHtml: 'import:vike-react-styled-jsx/__internal/onBeforeRenderHtml:onBeforeRenderHtml', @@ -16,9 +16,6 @@ const config = { styledJsx: { env: { server: true }, }, - Wrapper: { - env: { server: true }, - }, }, } satisfies Config diff --git a/packages/vike-react-styled-jsx/package.json b/packages/vike-react-styled-jsx/package.json index cfe5159c..e1e6b0c1 100644 --- a/packages/vike-react-styled-jsx/package.json +++ b/packages/vike-react-styled-jsx/package.json @@ -6,7 +6,7 @@ "./config": "./dist/config.js", "./__internal/onAfterRenderHtml": "./dist/onAfterRenderHtml.js", "./__internal/onBeforeRenderHtml": "./dist/onBeforeRenderHtml.js", - "./__internal/Wrapper": "./dist/Wrapper.js" + "./__internal/Wrapper": "./dist/Wrapper.server.js" }, "scripts": { "dev": "tsc --watch", @@ -44,7 +44,7 @@ "dist/onBeforeRenderHtml.d.ts" ], "__internal/Wrapper": [ - "dist/Wrapper.d.ts" + "dist/Wrapper.server.d.ts" ] } }, From d67da3646e13f0b4c7493ff8c193e50c6f5ca15e Mon Sep 17 00:00:00 2001 From: Muhammad Date: Sun, 29 Dec 2024 00:13:31 +0700 Subject: [PATCH 6/6] fix: simplify condition checks --- packages/vike-react-antd/Wrapper.server.tsx | 5 ++--- packages/vike-react-styled-components/Wrapper.server.tsx | 5 ++--- packages/vike-react-styled-jsx/Wrapper.server.tsx | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/vike-react-antd/Wrapper.server.tsx b/packages/vike-react-antd/Wrapper.server.tsx index 12c26bbb..2812ffdd 100644 --- a/packages/vike-react-antd/Wrapper.server.tsx +++ b/packages/vike-react-antd/Wrapper.server.tsx @@ -7,14 +7,13 @@ import { usePageContext } from 'vike-react/usePageContext' function Wrapper({ children }: { children: ReactNode }) { const pageContext = usePageContext() const { antd } = pageContext.config - const cache = 'antd' in pageContext ? pageContext.antd?.cache : undefined - if (antd === null || !cache) { + if (antd === null) { return <>{children} } return ( - + {children} ) diff --git a/packages/vike-react-styled-components/Wrapper.server.tsx b/packages/vike-react-styled-components/Wrapper.server.tsx index 72d69bfc..3dad9351 100644 --- a/packages/vike-react-styled-components/Wrapper.server.tsx +++ b/packages/vike-react-styled-components/Wrapper.server.tsx @@ -7,14 +7,13 @@ import { usePageContext } from 'vike-react/usePageContext' function Wrapper({ children }: { children: ReactNode }) { const pageContext = usePageContext() const { styledComponents } = pageContext.config - const sheet = 'styledComponents' in pageContext ? pageContext.styledComponents?.sheet : undefined - if (styledComponents === null || !sheet) { + if (styledComponents === null) { return <>{children} } return ( - + {children} ) diff --git a/packages/vike-react-styled-jsx/Wrapper.server.tsx b/packages/vike-react-styled-jsx/Wrapper.server.tsx index e54b7745..76a3f287 100644 --- a/packages/vike-react-styled-jsx/Wrapper.server.tsx +++ b/packages/vike-react-styled-jsx/Wrapper.server.tsx @@ -7,11 +7,10 @@ import { usePageContext } from 'vike-react/usePageContext' function Wrapper({ children }: { children: ReactNode }) { const pageContext = usePageContext() const { styledJsx } = pageContext.config - const registry = 'styledJsx' in pageContext ? pageContext.styledJsx?.registry : undefined - if (styledJsx === null || !registry) { + if (styledJsx === null) { return <>{children} } - return {children} + return {children} }