From 357d45ddc0a778883e11f88919875379d710db74 Mon Sep 17 00:00:00 2001 From: Valerio Ageno <51341197+Valerioageno@users.noreply.github.com> Date: Thu, 27 Jun 2024 11:18:53 +0200 Subject: [PATCH] Add svelte mention (#41) * Add svelte mention in README and docs.rs * Update v8 version to v0.94.0 * update version to v0.5.5 --- Cargo.toml | 4 ++-- README.md | 15 +++++++-------- src/lib.rs | 13 ++++++------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a59d6fd..fd200e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ssr_rs" -version = "0.5.4" +version = "0.5.5" authors = ["Valerio "] edition = "2021" description = "Server side rendering with the v8 engine for parse and evaluate the javascript code" @@ -22,7 +22,7 @@ name = "ssr_rs" path = "src/lib.rs" [dependencies] -v8= "0.93.0" +v8= "0.94.0" [dev-dependencies] diff --git a/README.md b/README.md index c19bac1..51b3e78 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ The crate aims to enable server side rendering on rust servers in the simplest a It uses an embedded version of the [V8](https://v8.dev/) javascript engine (rusty_v8) to parse and evaluate a built bundle file and return a string with the rendered html. -> ℹ️ This project is the backbone of [tuono](https://github.com/Valerioageno/tuono); a fullstack react framework with built in server side rendering. +ℹ️ **This project is the backbone of [tuono](https://github.com/Valerioageno/tuono); a fullstack react framework with built in server side rendering.** -Currently it works with [Vite](https://vitejs.dev/), [Webpack](https://webpack.js.org/), [Rspack](https://www.rspack.dev/) and [React 18](https://react.dev/) - Check the examples folder. +Currently it works with [Vite](https://vitejs.dev/), [Webpack](https://webpack.js.org/), [Rspack](https://www.rspack.dev/), [React 18](https://react.dev/) and [Svelte 4](https://svelte.dev/) - Check the `examples/` folder. > Check here the benchmark results. @@ -17,9 +17,8 @@ Currently it works with [Vite](https://vitejs.dev/), [Webpack](https://webpack.j Add this to your `Cargo.toml`: -```toml -[dependencies] -ssr_rs = "0.5.4" +```bash +cargo add ssr_rs ``` ## Example @@ -63,12 +62,12 @@ In case the bundled JS is an IIFE or the plain object the `entryPoint` is an emp ``` ```javascript -// IIFE varible example | bundle.js -> See webpack-react example +// IIFE variable example | bundle.js -> See webpack-react example var SSR = (() => ({renderToStringFn: (props) => ""}))() // SSR is the entry point ``` ```javascript -// Varible example | bundle.js -> See webpack-react example +// Variable example | bundle.js -> See webpack-react example var SSR = {renderToStringFn: (props) => ""}; // SSR is the entry point ``` @@ -158,7 +157,7 @@ Any helps or suggestions will be appreciated. Known TODOs: - Add examples with other rust backend frameworks -- Add examples with other frontend frameworks (i.e. vue, quik, solid, svelte) +- Add examples with other frontend frameworks (i.e. vue, quik, solid) - Add benchmark setup to test against Deno and Bun - Explore support for V8 snapshots - Explore js copilation to WASM (i.e. [javy](https://github.com/bytecodealliance/javy)) diff --git a/src/lib.rs b/src/lib.rs index bd7d997..fcc7981 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,17 +5,16 @@ //! //! It uses an embedded version of the [V8](https://v8.dev/) javascript engine (rusty_v8) to parse and evaluate a built bundle file and return a string with the rendered html. //! -//! > ℹ️ This project is the backbone of [tuono](https://github.com/Valerioageno/tuono); a fullstack react framework with built in server side rendering. +//! ℹ️ **This project is the backbone of [tuono](https://github.com/Valerioageno/tuono); a fullstack react framework with built in server side rendering.** //! -//! Currently it works with [Vite](https://vitejs.dev/), [Webpack](https://webpack.js.org/), [Rspack](https://www.rspack.dev/) and [React 18](https://react.dev/) - Check the examples folder. +//! Currently it works with [Vite](https://vitejs.dev/), [Webpack](https://webpack.js.org/), [Rspack](https://www.rspack.dev/), [React 18](https://react.dev/) and [Svelte 4](https://svelte.dev/) - Check the examples folder. //! //! > Check here the //! benchmarks results. //! //! # Getting started -//! ```toml -//! [dependencies] -//! ssr_rs = "0.5.4" +//! ```bash +//! cargo add ssr_rs //! ``` //! //! # Example @@ -58,12 +57,12 @@ //! ``` //! ```javascript -//! // IIFE varible example | bundle.js -> See webpack-react example +//! // IIFE variable example | bundle.js -> See webpack-react example //! var SSR = (() => ({renderToStringFn: (props) => ""}))() // SSR is the entry point //! ``` //! ```javascript -//! // Varible example | bundle.js -> See webpack-react example +//! // Variable example | bundle.js -> See webpack-react example //! var SSR = {renderToStringFn: (props) => ""}; // SSR is the entry point //! ``` //!