Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate to vike #17

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
60 changes: 30 additions & 30 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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,10 +1,10 @@
import type { Config, ConfigEffect, PageContext } from "vite-plugin-ssr/types";
import type { Config, ConfigEffect, PageContext } from "vike/types";
// We purposely define the ConfigVikeSolid interface in this file: that way we ensure it's always applied whenever the user `import vikeSolid from 'vike-solid'`
import type { Component } from "./types.js";

// 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,4 +1,4 @@
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