Skip to content

Commit

Permalink
fix: migrate to vike
Browse files Browse the repository at this point in the history
BREAKING CHANGE: use npm package `vike` instead of `vite-plugin-ssr`,
see https://vite-plugin-ssr.com/vike
  • Loading branch information
brillout committed Sep 24, 2023
1 parent ce54bec commit ade8904
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/pages/+config.h.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/pages/star-wars/@id/+onBeforeRender.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion examples/ssr-spa/README.md
Original file line number Diff line number Diff line change
@@ -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 [email protected]:magne4000/vike-solid
Expand Down
2 changes: 1 addition & 1 deletion examples/ssr-spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion examples/ssr-spa/pages/+config.h.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion examples/ssr-spa/pages/spa/+config.h.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Config } from "vite-plugin-ssr/types";
import type { Config } from "vike/types";

export default {
ssr: false, // SPA
Expand Down
8 changes: 4 additions & 4 deletions vike-solid/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[<img src="https://avatars.githubusercontent.com/u/86403530?s=200&v=4" align="right" width="64" height="64">](https://vite-plugin-ssr.com)
[<img src="https://avatars.githubusercontent.com/u/86403530?s=200&v=4" align="right" width="64" height="64">](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).
2 changes: 1 addition & 1 deletion vike-solid/cli/build.ts
Original file line number Diff line number Diff line change
@@ -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();

Expand Down
4 changes: 2 additions & 2 deletions vike-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
"*": {
Expand Down
6 changes: 3 additions & 3 deletions vike-solid/renderer/+config.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion vike-solid/renderer/+onRenderClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
4 changes: 2 additions & 2 deletions vike-solid/renderer/+onRenderHtml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion vike-solid/renderer/PageContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
2 changes: 1 addition & 1 deletion vike-solid/renderer/getPageElement.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion vike-solid/renderer/getTitle.ts
Original file line number Diff line number Diff line change
@@ -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") {
Expand Down
4 changes: 2 additions & 2 deletions vike-solid/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -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: [
Expand Down
2 changes: 1 addition & 1 deletion vike-solid/vite-plugin-vike-solid.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit ade8904

Please sign in to comment.