From 944a330d326db9947dedc2ef3e30ebda16e95bf7 Mon Sep 17 00:00:00 2001 From: Romuald Brillout Date: Sun, 24 Sep 2023 11:25:45 +0200 Subject: [PATCH] fix: migrate to `vike` BREAKING CHANGE: use npm package `vike` instead of `vite-plugin-ssr`, see https://vite-plugin-ssr.com/vike --- examples/basic/package.json | 2 +- examples/basic/pages/+config.h.ts | 2 +- .../pages/star-wars/@id/+onBeforeRender.ts | 2 +- examples/ssr-spa/README.md | 2 +- examples/ssr-spa/package.json | 2 +- examples/ssr-spa/pages/+config.h.ts | 2 +- examples/ssr-spa/pages/spa/+config.h.ts | 2 +- pnpm-lock.yaml | 60 +++++++++---------- vike-solid/README.md | 8 +-- vike-solid/cli/build.ts | 2 +- vike-solid/package.json | 4 +- vike-solid/renderer/+config.ts | 6 +- vike-solid/renderer/+onRenderClient.tsx | 2 +- vike-solid/renderer/+onRenderHtml.tsx | 4 +- vike-solid/renderer/PageContextProvider.tsx | 2 +- vike-solid/renderer/getPageElement.tsx | 2 +- vike-solid/renderer/getTitle.ts | 2 +- vike-solid/rollup.config.js | 4 +- vike-solid/vite-plugin-vike-solid.ts | 2 +- 19 files changed, 56 insertions(+), 56 deletions(-) diff --git a/examples/basic/package.json b/examples/basic/package.json index 9c8fec2..6d937ea 100644 --- a/examples/basic/package.json +++ b/examples/basic/package.json @@ -11,7 +11,7 @@ "node-fetch": "^3.3.2", "solid-js": "^1.7.11", "vike-solid": "workspace:*", - "vite-plugin-ssr": "^0.4.142" + "vike": "^0.4.142" }, "devDependencies": { "typescript": "^5.1.6" diff --git a/examples/basic/pages/+config.h.ts b/examples/basic/pages/+config.h.ts index ddc1cf4..a316842 100644 --- a/examples/basic/pages/+config.h.ts +++ b/examples/basic/pages/+config.h.ts @@ -1,4 +1,4 @@ -import type { Config } from "vite-plugin-ssr/types"; +import type { Config } from "vike/types"; import vikeSolid from "vike-solid"; import Layout from "../layouts/LayoutDefault"; import Head from "./Head"; diff --git a/examples/basic/pages/star-wars/@id/+onBeforeRender.ts b/examples/basic/pages/star-wars/@id/+onBeforeRender.ts index e50f803..a215b48 100644 --- a/examples/basic/pages/star-wars/@id/+onBeforeRender.ts +++ b/examples/basic/pages/star-wars/@id/+onBeforeRender.ts @@ -1,7 +1,7 @@ export default onBeforeRender; import fetch from "cross-fetch"; -import type { PageContext } from "vite-plugin-ssr/types"; +import type { PageContext } from "vike/types"; import { filterMovieData } from "../filterMovieData"; import type { MovieDetails } from "../types"; diff --git a/examples/ssr-spa/README.md b/examples/ssr-spa/README.md index 3b1f803..aacf39f 100644 --- a/examples/ssr-spa/README.md +++ b/examples/ssr-spa/README.md @@ -1,5 +1,5 @@ Example of selecting SPA or SSR on a per-page basis. See -[SPA vs SSR (and more)](https://vite-plugin-ssr.com/SPA-vs-SSR). +[SPA vs SSR (and more)](https://vike.dev/SPA-vs-SSR). ```bash git clone git@github.com:magne4000/vike-solid diff --git a/examples/ssr-spa/package.json b/examples/ssr-spa/package.json index 4a1964d..3e2522b 100644 --- a/examples/ssr-spa/package.json +++ b/examples/ssr-spa/package.json @@ -9,7 +9,7 @@ "dependencies": { "solid-js": "^1.7.11", "vike-solid": "workspace:*", - "vite-plugin-ssr": "^0.4.142" + "vike": "^0.4.142" }, "devDependencies": { "typescript": "^5.1.6" diff --git a/examples/ssr-spa/pages/+config.h.ts b/examples/ssr-spa/pages/+config.h.ts index 1d99ea8..64687dc 100644 --- a/examples/ssr-spa/pages/+config.h.ts +++ b/examples/ssr-spa/pages/+config.h.ts @@ -1,4 +1,4 @@ -import type { Config } from "vite-plugin-ssr/types"; +import type { Config } from "vike/types"; import vikeSolid from "vike-solid"; import Layout from "../layouts/LayoutDefault"; import Head from "./Head"; diff --git a/examples/ssr-spa/pages/spa/+config.h.ts b/examples/ssr-spa/pages/spa/+config.h.ts index c8e7287..0803436 100644 --- a/examples/ssr-spa/pages/spa/+config.h.ts +++ b/examples/ssr-spa/pages/spa/+config.h.ts @@ -1,4 +1,4 @@ -import type { Config } from "vite-plugin-ssr/types"; +import type { Config } from "vike/types"; export default { ssr: false, // SPA diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0c200ff..47944c5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,12 +19,12 @@ importers: solid-js: specifier: ^1.7.11 version: 1.7.11 + vike: + specifier: ^0.4.142 + version: 0.4.142(vite@4.4.9) vike-solid: specifier: workspace:* version: link:../../vike-solid - vite-plugin-ssr: - specifier: ^0.4.142 - version: 0.4.142(vite@4.4.9) devDependencies: typescript: specifier: ^5.1.6 @@ -35,12 +35,12 @@ importers: solid-js: specifier: ^1.7.11 version: 1.7.11 + vike: + specifier: ^0.4.142 + version: 0.4.142(vite@4.4.9) vike-solid: specifier: workspace:* version: link:../../vike-solid - vite-plugin-ssr: - specifier: ^0.4.142 - version: 0.4.142(vite@4.4.9) devDependencies: typescript: specifier: ^5.1.6 @@ -91,12 +91,12 @@ importers: typescript: specifier: ^5.2.2 version: 5.2.2 + vike: + specifier: ^0.4.142 + version: 0.4.142(vite@4.4.9) vite: specifier: ^4.4.9 version: 4.4.9(@types/node@18.17.4) - vite-plugin-ssr: - specifier: ^0.4.142 - version: 0.4.142(vite@4.4.9) packages: @@ -2913,27 +2913,8 @@ packages: /validate-html-nesting@1.2.2: resolution: {integrity: sha512-hGdgQozCsQJMyfK5urgFcWEqsSSrK63Awe0t/IMR0bZ0QMtnuaiHzThW81guu3qx9abLi99NEuiaN6P9gVYsNg==} - /vite-plugin-solid@2.7.0(solid-js@1.7.12)(vite@4.4.9): - resolution: {integrity: sha512-avp/Jl5zOp/Itfo67xtDB2O61U7idviaIp4mLsjhCa13PjKNasz+IID0jYTyqUp9SFx6/PmBr6v4KgDppqompg==} - peerDependencies: - solid-js: ^1.7.2 - vite: ^3.0.0 || ^4.0.0 - dependencies: - '@babel/core': 7.22.20 - '@babel/preset-typescript': 7.22.15(@babel/core@7.22.20) - '@types/babel__core': 7.20.1 - babel-preset-solid: 1.7.12(@babel/core@7.22.20) - merge-anything: 5.1.7 - solid-js: 1.7.12 - solid-refresh: 0.5.3(solid-js@1.7.12) - vite: 4.4.9(@types/node@18.17.4) - vitefu: 0.2.4(vite@4.4.9) - transitivePeerDependencies: - - supports-color - dev: false - - /vite-plugin-ssr@0.4.142(vite@4.4.9): - resolution: {integrity: sha512-ZDgpocnTEUmhYxGgMah8ZNK1Sfy5CFVcdXu+Ll3zRtGIPyWT5vYvASs2BLYEneqantHpde2b31Khzb0hxmP62w==} + /vike@0.4.142(vite@4.4.9): + resolution: {integrity: sha512-eciryBs3k29SwSQM2esZzjt9Fyig/tNAgQ5xlduw9XVNUnd1hdWPr8CBi7yzvWgeavggPmywbt+Da1OLBoO8Kg==} engines: {node: '>=16.0.0'} hasBin: true peerDependencies: @@ -2957,6 +2938,25 @@ packages: source-map-support: 0.5.21 vite: 4.4.9(@types/node@18.17.4) + /vite-plugin-solid@2.7.0(solid-js@1.7.12)(vite@4.4.9): + resolution: {integrity: sha512-avp/Jl5zOp/Itfo67xtDB2O61U7idviaIp4mLsjhCa13PjKNasz+IID0jYTyqUp9SFx6/PmBr6v4KgDppqompg==} + peerDependencies: + solid-js: ^1.7.2 + vite: ^3.0.0 || ^4.0.0 + dependencies: + '@babel/core': 7.22.20 + '@babel/preset-typescript': 7.22.15(@babel/core@7.22.20) + '@types/babel__core': 7.20.1 + babel-preset-solid: 1.7.12(@babel/core@7.22.20) + merge-anything: 5.1.7 + solid-js: 1.7.12 + solid-refresh: 0.5.3(solid-js@1.7.12) + vite: 4.4.9(@types/node@18.17.4) + vitefu: 0.2.4(vite@4.4.9) + transitivePeerDependencies: + - supports-color + dev: false + /vite@4.4.9(@types/node@18.17.4): resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==} engines: {node: ^14.18.0 || >=16.0.0} diff --git a/vike-solid/README.md b/vike-solid/README.md index 38b81ed..4274fcc 100644 --- a/vike-solid/README.md +++ b/vike-solid/README.md @@ -1,12 +1,12 @@ -[](https://vite-plugin-ssr.com) +[](https://vike.dev) [![npm version](https://img.shields.io/npm/v/vike-solid)](https://www.npmjs.com/package/vike-solid) # `vike-solid` -SolidJS integration for [Vike](https://github.com/brillout/vite-plugin-ssr/issues/736) (using the -[V1 design](https://vite-plugin-ssr.com/migration/v1-design)). +SolidJS integration for [Vike](https://github.com/vikejs/vike/issues/736) (using the +[V1 design](https://vike.dev/migration/v1-design)). > [!NOTE] -> For integrations with React and Vue, see the other [`vike-*` packages](https://vite-plugin-ssr.com/vike-packages). +> For integrations with React and Vue, see the other [`vike-*` packages](https://vike.dev/vike-packages). See [examples/](https://github.com/magne4000/vike-solid/tree/main/examples). diff --git a/vike-solid/cli/build.ts b/vike-solid/cli/build.ts index fd816ed..9858d7c 100644 --- a/vike-solid/cli/build.ts +++ b/vike-solid/cli/build.ts @@ -1,6 +1,6 @@ import { build } from "vite"; import config from "../vite.config"; -// import { prerender } from 'vite-plugin-ssr/prerender' +// import { prerender } from 'vike/prerender' main(); diff --git a/vike-solid/package.json b/vike-solid/package.json index b4b31e9..267135f 100644 --- a/vike-solid/package.json +++ b/vike-solid/package.json @@ -20,7 +20,7 @@ "peerDependencies": { "solid-js": "^1.7.12", "vite": "^4.4.9", - "vite-plugin-ssr": "^0.4.142" + "vike": "^0.4.142" }, "devDependencies": { "@babel/core": "^7.22.20", @@ -37,7 +37,7 @@ "tslib": "^2.6.2", "typescript": "^5.2.2", "vite": "^4.4.9", - "vite-plugin-ssr": "^0.4.142" + "vike": "^0.4.142" }, "typesVersions": { "*": { diff --git a/vike-solid/renderer/+config.ts b/vike-solid/renderer/+config.ts index dc7cbd2..e202384 100644 --- a/vike-solid/renderer/+config.ts +++ b/vike-solid/renderer/+config.ts @@ -1,8 +1,8 @@ -import type { Config, ConfigEffect, PageContext } from "vite-plugin-ssr/types"; +import type { Config, ConfigEffect, PageContext } from "vike/types"; // Depending on the value of `config.meta.ssr`, set other config options' `env` // accordingly. -// See https://vite-plugin-ssr.com/meta#modify-existing-configurations +// See https://vike.dev/meta#modify-existing-configurations const toggleSsrRelatedConfig: ConfigEffect = ({ configDefinedAt, configValue, @@ -74,7 +74,7 @@ declare global { * If false, render mode is SPA. In other words, the page will only be * rendered in the browser. * - * See https://vite-plugin-ssr.com/render-modes + * See https://vike.dev/render-modes * * @default true * diff --git a/vike-solid/renderer/+onRenderClient.tsx b/vike-solid/renderer/+onRenderClient.tsx index 53319a4..f73db5c 100644 --- a/vike-solid/renderer/+onRenderClient.tsx +++ b/vike-solid/renderer/+onRenderClient.tsx @@ -2,7 +2,7 @@ export default onRenderClient; import { hydrate, render } from "solid-js/web"; import { getTitle } from "./getTitle"; -import type { PageContextClient } from "vite-plugin-ssr/types"; +import type { PageContextClient } from "vike/types"; import { getPageElement } from "./getPageElement"; import { createStore, reconcile } from "solid-js/store"; diff --git a/vike-solid/renderer/+onRenderHtml.tsx b/vike-solid/renderer/+onRenderHtml.tsx index 7a91cad..2596cfa 100644 --- a/vike-solid/renderer/+onRenderHtml.tsx +++ b/vike-solid/renderer/+onRenderHtml.tsx @@ -8,10 +8,10 @@ import { escapeInject, dangerouslySkipEscape, stampPipe, -} from "vite-plugin-ssr/server"; +} from "vike/server"; import { getTitle } from "./getTitle"; import { getPageElement } from "./getPageElement"; -import type { PageContext } from "vite-plugin-ssr/types"; +import type { PageContext } from "vike/types"; import { PageContextProvider } from "./PageContextProvider"; async function onRenderHtml(pageContext: PageContext) { diff --git a/vike-solid/renderer/PageContextProvider.tsx b/vike-solid/renderer/PageContextProvider.tsx index b0906bf..adc08ac 100644 --- a/vike-solid/renderer/PageContextProvider.tsx +++ b/vike-solid/renderer/PageContextProvider.tsx @@ -3,7 +3,7 @@ export { usePageContext }; import { useContext, createContext, type JSX } from "solid-js"; import { type Store } from "solid-js/store"; -import type { PageContext } from "vite-plugin-ssr/types"; +import type { PageContext } from "vike/types"; import { getGlobalObject } from "./utils/getGlobalObject"; const { Context } = getGlobalObject("PageContextProvider.ts", { diff --git a/vike-solid/renderer/getPageElement.tsx b/vike-solid/renderer/getPageElement.tsx index cae7e75..a931b8e 100644 --- a/vike-solid/renderer/getPageElement.tsx +++ b/vike-solid/renderer/getPageElement.tsx @@ -1,6 +1,6 @@ export { getPageElement }; -import type { PageContext } from "vite-plugin-ssr/types"; +import type { PageContext } from "vike/types"; import { PageContextProvider, usePageContext } from "./PageContextProvider"; import type { JSX } from "solid-js"; import { Dynamic } from "solid-js/web"; diff --git a/vike-solid/renderer/getTitle.ts b/vike-solid/renderer/getTitle.ts index 38cf9dd..b54cfb6 100644 --- a/vike-solid/renderer/getTitle.ts +++ b/vike-solid/renderer/getTitle.ts @@ -1,6 +1,6 @@ export { getTitle }; -import type { PageContext } from "vite-plugin-ssr/types"; +import type { PageContext } from "vike/types"; function getTitle(pageContext: PageContext): null | string { if (typeof pageContext.title === "string") { diff --git a/vike-solid/rollup.config.js b/vike-solid/rollup.config.js index 92dd47a..7aafd04 100644 --- a/vike-solid/rollup.config.js +++ b/vike-solid/rollup.config.js @@ -11,7 +11,7 @@ export default [ "./cli/index.ts", ], ssr: true, - external: ["vite-plugin-ssr/server", "vite-plugin-ssr/plugin"], + external: ["vike/server", "vike/plugin"], }), withSolid({ input: [ @@ -20,7 +20,7 @@ export default [ "./cli/index.ts", ], ssr: false, - external: ["vite-plugin-ssr/server", "vite-plugin-ssr/plugin"], + external: ["vike/server", "vike/plugin"], }), { input: [ diff --git a/vike-solid/vite-plugin-vike-solid.ts b/vike-solid/vite-plugin-vike-solid.ts index 7f08fee..59c9cff 100644 --- a/vike-solid/vite-plugin-vike-solid.ts +++ b/vike-solid/vite-plugin-vike-solid.ts @@ -1,5 +1,5 @@ import solidPlugin, { type Options as SolidOptions } from "vite-plugin-solid"; -import ssr, { UserConfig } from "vite-plugin-ssr/plugin"; +import ssr, { UserConfig } from "vike/plugin"; import { mergeConfig, type Plugin } from "vite"; export interface Options {