Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies

Overview

Perseus

BookCrate PageAPI DocumentationContributing

Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies, reactivity without a virtual DOM, and extreme customizability. It wraps the lower-level capabilities of Sycamore and provides a NextJS-like API!

  • Supports static generation (serving only static resources)
  • Supports server-side rendering (serving dynamic resources)
  • Supports revalidation after time and/or with custom logic (updating rendered pages)
  • Supports incremental regeneration (build on demand)
  • Open build matrix (use any rendering strategy with anything else, mostly)
  • CLI harness that lets you build apps with ease and confidence
  • Full i18n support out-of-the-box with Fluent

How to use

Check out the docs here for how to use Perseus.

Aim

Support every major rendering strategy and provide developers the ability to efficiently create super-fast apps with Rust and a fantastic developer experience!

Motivation

There is a sore lack of Rust frameworks for frontend development that support more than just SPAs and client-side rendering, and so Perseus was born. We need something like NextJS for WASM.

Roadmap

Pre-stable

These tasks still need to be done before Perseus can be pushed to v1.0.0.

  • Create a custom CLI as a harness for apps without ridiculous amounts of configuration needed
  • Support custom template hierarchies
  • Support i18n out of the box
  • (Maybe) Implement custom router
  • Pre-built integrations for Actix Web (done) and AWS Lambda (todo)

Beyond

These tasks will be done after Perseus is stable.

  • Integrations for other platforms

Contributing

We appreciate all kinds of contributions, check out our contributing guidelines for more information! Also, please be sure to follow our code of conduct.

You can also chat about Perseus at our Gitter link, or (for Sycamore-related stuff) on our channel on Sycamore's Discord server.

License

See LICENSE.

Comments
  • Tokio build fails in v0.3.x

    Tokio build fails in v0.3.x

    I'm trying to build the Perseus hello-world example following:

    https://framesurge.sh/perseus/en-US/docs/0.3.4/tutorials/hello-world

    I get:

    PS F:\SoftwareProjects\Rust\my-perseus-app> perseus serve
    ⠈ [1/4]  Generating your app...
      [2/4]  Building your app to Wasm...failed!
    ⠂ [3/4]  Building server...
    [INFO]: Checking for the Wasm target...
    [INFO]: Compiling to Wasm...
       Compiling proc-macro2 v1.0.43
       Compiling unicode-ident v1.0.4
       Compiling quote v1.0.21
       Compiling syn v1.0.99
       Compiling autocfg v1.1.0
       Compiling serde_derive v1.0.144
       Compiling serde v1.0.144
       Compiling cfg-if v1.0.0
       Compiling wasm-bindgen-shared v0.2.83
       Compiling log v0.4.17
       Compiling once_cell v1.14.0
       Compiling serde_json v1.0.85
       Compiling bumpalo v3.11.0
       Compiling wasm-bindgen v0.2.83
       Compiling itoa v1.0.3
       Compiling ryu v1.0.11
       Compiling memchr v2.5.0
       Compiling version_check v0.9.4
       Compiling static_assertions v1.1.0
       Compiling futures-core v0.3.24
       Compiling futures-task v0.3.24
       Compiling pin-project-lite v0.2.9
       Compiling futures-channel v0.3.24
       Compiling futures-util v0.3.24
       Compiling fnv v1.0.7
       Compiling strsim v0.10.0
       Compiling hashbrown v0.12.3
       Compiling ident_case v1.0.1
       Compiling futures-sink v0.3.24
       Compiling libc v0.2.132
       Compiling futures-io v0.3.24
       Compiling minimal-lexical v0.2.1
       Compiling thiserror v1.0.35
       Compiling smallvec v1.9.0
       Compiling utf8-width v0.1.6
       Compiling pin-utils v0.1.0
       Compiling bytes v1.2.1
       Compiling async-trait v0.1.57
       Compiling paste v1.0.9
       Compiling unicode-xid v0.2.3
       Compiling fmterr v0.1.1
       Compiling urlencoding v2.1.2
       Compiling getrandom v0.2.7
       Compiling lexical-util v0.8.5
       Compiling indexmap v1.9.1
       Compiling slab v0.4.7
       Compiling num-traits v0.2.15
       Compiling tokio v1.21.1
       Compiling num-integer v0.1.45
       Compiling html-escape v0.2.11
       Compiling ahash v0.7.6
       Compiling http v0.2.8
       Compiling lexical-write-integer v0.8.5
       Compiling lexical-parse-integer v0.8.6
       Compiling time v0.1.44
       Compiling nom v7.1.1
    error: Only features sync,macros,io-util,rt,time are supported on wasm.
       --> C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.21.1\src\lib.rs:462:1
        |
    462 | compile_error!("Only features sync,macros,io-util,rt,time are supported on wasm.");
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
       Compiling lexical-write-float v0.8.5
       Compiling lexical-parse-float v0.8.5
    error: could not compile `tokio` due to previous error
    warning: build failed, waiting for other jobs to finish...
      [1/4]  Generating your app...success!
      [2/4]  Building your app to Wasm...failed!
    ⠈ [3/4]  Building server...
    

    My cargo.toml:

    [package]
    name = "my-perseus-app"
    version = "0.1.0"
    edition = "2021"
    
    # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    
    [dependencies]
    perseus = { version = "0.3.5", features = [ "hydrate" ] }
    sycamore = "0.7"
    

    The lib.rs code is the same as what's in the link.

    This is on Windows 10.

    opened by coruscateor 23
  • <!--#--> in web title when translation string is used

    in web title when translation string is used

    Describe the bug Recently, a regression is introduced when displaying a head title. It occurs when the translation marco t!() is used within the head title tag of a page and instead of displaying only a translated string, comment tags are inserted, thus, the final translated string is displayed in a browser as <!--#-->translated string<!--/-->.

    I don't know is it due to sycamore or perseus but since it occurs when t! macro is used, I report it here. When an ordinary string variable is used, everything is fine.

    To Reproduce

    One can use the i18n example, and add the head function with the title:

    pub fn get_template<G: Html>() -> Template<G> {
        Template::new("about")
            .template(about_page)
            .head(head)
    }
    
    #[perseus::head]
    pub fn head() -> View<SsrNode> {
        view! {
             title { (t!("about")) }
        }
    }
    
    

    Expected behavior A translated string is displayed without comment tags.

    Environment (please complete the following information):

    • Perseus Version: 0.3.1
    • Sycamore Version: 0.7
    • OS: GNU/Linux
    • Browser: Firefox
    • Browser Version: 95
    C-bug A-i18n A-templates P-high 
    opened by adundovi 20
  • Adapt bonnie.toml for windows

    Adapt bonnie.toml for windows

    I could not test is, as I have an error on 'setup'

       Compiling web-sys v0.3.55
       Compiling wasm-bindgen-futures v0.4.28
       Compiling actix-web v4.0.0-beta.15
       Compiling perseus-cli v0.3.2 (S:\Simon\Rust\perseus\packages\perseus-cli)
    error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
       --> C:\Users\Maz\.cargo\registry\src\github.com-1ecc6299db9ec823\actix-web-4.0.0-beta.15\src\service.rs:288:6
        |
    288 | impl Resource<Url> for ServiceRequest {
        |      ^^^^^^^^----- help: remove these generics
        |      |
        |      expected 0 generic arguments
        |
    note: trait defined here, with 0 generic parameters
       --> C:\Users\Maz\.cargo\registry\src\github.com-1ecc6299db9ec823\actix-router-0.5.0-rc.1\src\resource_path.rs:5:11
        |
    5   | pub trait Resource {
        |           ^^^^^^^^
    
    error[E0046]: not all trait items implemented, missing: `Path`
       --> C:\Users\Maz\.cargo\registry\src\github.com-1ecc6299db9ec823\actix-web-4.0.0-beta.15\src\service.rs:288:1
        |
    288 | impl Resource<Url> for ServiceRequest {
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Path` in implementation
        |
        = help: implement the missing item: `type Path = Type;`
    
    Some errors have detailed explanations: E0046, E0107.
    For more information about an error, try `rustc --explain E0046`.
    error: could not compile `actix-web` due to 2 previous errors
    warning: build failed, waiting for other jobs to finish...
    error: build failed
    
    opened by Mazwak 17
  • `0.3.0-beta.14` `perseus deploy` fails consistently

    `0.3.0-beta.14` `perseus deploy` fails consistently

    Describe the bug Ever since 0.3.0-beta.14 is out perseus deploy consistently fails with two different errors on two different machines, locally and on a VPS. Right now, in the same way as described bellow, it's also impossible to deploy previous version 0.3.0-beta.13, which worked before the 0.3.0-beta.14 release. The Dockerfile bellow is standalone and does attempt to deploy the tiny example of this repo.

    To Reproduce Dockerfile

    # get the base image
    FROM rust:1.55-slim AS build
    
    # install build dependencies
    RUN apt update \
      && apt install -y --no-install-recommends lsb-release apt-transport-https \
      build-essential curl
    
    # vars
    ENV PERSEUS_VERSION=0.3.0-beta.14 \
        WEE_ALLOC_VERSION=0.4
    
    # prepare root project dir
    WORKDIR /app
    
    # download the target for wasm
    RUN rustup target add wasm32-unknown-unknown
    
    # install wasm-pack
    RUN cargo install wasm-pack
    
    # retrieve the src dir
    RUN curl https://codeload.github.com/arctic-hen7/perseus/tar.gz/main | tar -xz --strip=2 perseus-main/examples/tiny
    
    # go to src dir
    WORKDIR /app/tiny
    
    # install perseus-cli
    RUN cargo install perseus-cli --version $PERSEUS_VERSION
    
    # clean app
    RUN perseus clean
    
    # specify deps in app config
    RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml \
      && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml \
      && echo ' \n\
    [profile.release] \n\
    codegen-units = 1 \n\
    opt-level = "s" \n\
    lto = true ' >> ./Cargo.toml \
      && cat ./Cargo.toml
    
    # modify and prepend lib.rs
    RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs \
      && echo '#[global_allocator] \n\
    static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; \n\
    ' | cat - ./src/lib.rs > ./src/lib.rs.tmp \
      && mv ./src/lib.rs.tmp ./src/lib.rs \
      && cat ./src/lib.rs
    
    # prep and eject app
    RUN perseus prep && perseus eject
    
    # adjust and append perseus config
    RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" .perseus/Cargo.toml \
      && echo ' \n\n\
    [profile.release] \n\
    codegen-units = 1 \n\
    opt-level = "s" ' >> .perseus/Cargo.toml \
      && cat .perseus/Cargo.toml
    
    # deploy app
    RUN perseus deploy
    
    # prepare deployment image
    FROM bitnami/minideb:buster
    
    WORKDIR /app
    
    COPY --from=build /app/tiny/pkg /app/
    
    ENV PERSEUS_STANDALONE=true
    
    ENV HOST=0.0.0.0
    
    CMD ["./server"]
    

    Part of docker build output from local machine

    ...
    Step 9/21 : RUN cargo install perseus-cli --version $PERSEUS_VERSION
     ---> Running in 48b225eaec3e
     Downloading crates ...
      Downloaded perseus-cli v0.3.0-beta.14
        Updating crates.io index
      Installing perseus-cli v0.3.0-beta.14
     Downloading crates ...
      Downloaded strsim v0.10.0
      Downloaded textwrap v0.14.2
      Downloaded clap v3.0.0-beta.5
      Downloaded proc-macro-hack v0.5.19
      Downloaded fmterr v0.1.1
      Downloaded glob v0.3.0
      Downloaded anyhow v1.0.44
      Downloaded include_dir_impl v0.6.2
      Downloaded clap_derive v3.0.0-beta.5
      Downloaded console v0.14.1
      Downloaded include_dir v0.6.2
      Downloaded number_prefix v0.4.0
      Downloaded cargo_toml v0.9.2
      Downloaded os_str_bytes v4.2.0
      Downloaded indicatif v0.17.0-beta.1
      Downloaded fs_extra v1.2.0
       Compiling proc-macro2 v1.0.32
       Compiling unicode-xid v0.2.2
       Compiling syn v1.0.81
       Compiling version_check v0.9.3
       Compiling libc v0.2.105
       Compiling serde v1.0.130
       Compiling anyhow v1.0.44
       Compiling memchr v2.4.1
       Compiling proc-macro-hack v0.5.19
       Compiling autocfg v1.0.1
       Compiling regex-syntax v0.6.25
       Compiling unicode-segmentation v1.8.0
       Compiling ryu v1.0.5
       Compiling lazy_static v1.4.0
       Compiling serde_derive v1.0.130
       Compiling unicode-width v0.1.9
       Compiling hashbrown v0.11.2
       Compiling serde_json v1.0.68
       Compiling once_cell v1.8.0
       Compiling itoa v0.4.8
       Compiling strsim v0.10.0
       Compiling termcolor v1.1.2
       Compiling number_prefix v0.4.0
       Compiling bitflags v1.3.2
       Compiling glob v0.3.0
       Compiling fs_extra v1.2.0
       Compiling fmterr v0.1.1
       Compiling proc-macro-error-attr v1.0.4
       Compiling proc-macro-error v1.0.4
       Compiling unicase v2.6.0
       Compiling textwrap v0.14.2
       Compiling indexmap v1.7.0
       Compiling heck v0.3.3
       Compiling regex v1.5.4
       Compiling os_str_bytes v4.2.0
       Compiling quote v1.0.10
       Compiling terminal_size v0.1.17
       Compiling atty v0.2.14
       Compiling console v0.15.0
       Compiling console v0.14.1
       Compiling indicatif v0.17.0-beta.1
       Compiling toml v0.5.8
       Compiling thiserror-impl v1.0.30
       Compiling clap_derive v3.0.0-beta.5
       Compiling include_dir_impl v0.6.2
       Compiling include_dir v0.6.2
       Compiling thiserror v1.0.30
       Compiling clap v3.0.0-beta.5
       Compiling cargo_toml v0.9.2
       Compiling perseus-cli v0.3.0-beta.14
        Finished release [optimized] target(s) in 1m 04s
      Installing /usr/local/cargo/bin/perseus
       Installed package `perseus-cli v0.3.0-beta.14` (executable `perseus`)
    Removing intermediate container 48b225eaec3e
     ---> 54bf07daf838
    Step 10/21 : RUN perseus clean
     ---> Running in 276dcb6cc379
    Removing intermediate container 276dcb6cc379
     ---> e63df3b90eaf
    Step 11/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml   && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml   && echo ' \n[profile.release] \ncodegen-units = 1 \nopt-level = "s" \nlto = true ' >> ./Cargo.toml   && cat ./Cargo.toml
     ---> Running in ff387002e768
    [package]
    name = "perseus-example-tiny"
    version = "0.3.0-beta.14"
    edition = "2018"
    
    # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    
    [dependencies]
    wee_alloc = "0.4"
    perseus = "0.3.0-beta.14"
    sycamore = "0.6"
     
    [profile.release] 
    codegen-units = 1 
    opt-level = "s" 
    lto = true 
    Removing intermediate container ff387002e768
     ---> b87a86f93ac4
    Step 12/21 : RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs   && echo '#[global_allocator] \nstatic ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; \n' | cat - ./src/lib.rs > ./src/lib.rs.tmp   && mv ./src/lib.rs.tmp ./src/lib.rs   && cat ./src/lib.rs
     ---> Running in cd0981669fb5
    #[global_allocator] 
    static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; 
    
    use perseus::{define_app, ErrorPages, Template};
    use sycamore::template;
    define_app! {
        templates: [
            Template::<G>::new("index").template(|_| {
                template! {
                    p { "世界您好 !" }
                }
            })
        ],
        error_pages: ErrorPages::new(|url, status, err, _| {
            template! {
                p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
            }
        })
    }
    Removing intermediate container cd0981669fb5
     ---> ad243ddb97cf
    Step 13/21 : RUN perseus prep && perseus eject
     ---> Running in 296f9f98d805
    Removing intermediate container 296f9f98d805
     ---> b1dcbfb61541
    Step 14/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" .perseus/Cargo.toml   && echo ' \n\n[profile.release] \ncodegen-units = 1 \nopt-level = "s" ' >> .perseus/Cargo.toml   && cat .perseus/Cargo.toml
     ---> Running in 368ed86f1eda
    # This crate defines the user's app in terms that Wasm can understand, making development significantly simpler.
    # IMPORTANT: spacing matters in this file for runtime replacements, do NOT change it!
    
    [package]
    name = "perseus-engine"
    version = "0.3.0-beta.14"
    edition = "2018"
    
    # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    
    [dependencies]
    # We alias here because the package name will change based on whatever's in the user's manifest
    app = { package = "perseus-example-tiny", path = "../" }
    
    perseus = "0.3.0-beta.14"
    sycamore = { version = "0.6", features = ["ssr"] }
    sycamore-router = "0.6"
    web-sys = { version = "0.3", features = ["Event", "Headers", "Request", "RequestInit", "RequestMode", "Response", "ReadableStream", "Window"] }
    wasm-bindgen = "0.2"
    wasm-bindgen-futures = "0.4"
    console_error_panic_hook = "0.1.6"
    
    # This section is needed for Wasm Pack (which we use instead of Trunk for flexibility)
    [lib]
    crate-type = ["cdylib", "rlib"]
    
    [workspace] 
    
    [profile.release] 
    codegen-units = 1 
    opt-level = "s" 
    Removing intermediate container 368ed86f1eda
     ---> 711943076fd5
    Step 15/21 : RUN perseus deploy
     ---> Running in 37ea51568596
    Error: couldn't move `.perseus/pkg/` to `.perseus/dist/pkg/` (run `perseus clean` if this persists)
    
    Caused by:
    	Invalid cross-device link (os error 18)
    The command '/bin/sh -c perseus deploy' returned a non-zero code: 1
    

    Part of docker build output from VPS

    ...
    Step 9/21 : RUN cargo install perseus-cli --version $PERSEUS_VERSION
     ---> Running in cd545af5bdf3
     Downloading crates ...
      Downloaded perseus-cli v0.3.0-beta.14
        Updating crates.io index
      Installing perseus-cli v0.3.0-beta.14
     Downloading crates ...
      Downloaded cargo_toml v0.9.2
      Downloaded include_dir v0.6.2
      Downloaded fmterr v0.1.1
      Downloaded os_str_bytes v4.2.0
      Downloaded strsim v0.10.0
      Downloaded proc-macro-hack v0.5.19
      Downloaded number_prefix v0.4.0
      Downloaded include_dir_impl v0.6.2
      Downloaded indicatif v0.17.0-beta.1
      Downloaded glob v0.3.0
      Downloaded fs_extra v1.2.0
      Downloaded console v0.14.1
      Downloaded anyhow v1.0.44
      Downloaded clap_derive v3.0.0-beta.5
      Downloaded clap v3.0.0-beta.5
      Downloaded textwrap v0.14.2
       Compiling proc-macro2 v1.0.32
       Compiling unicode-xid v0.2.2
       Compiling syn v1.0.81
       Compiling version_check v0.9.3
       Compiling libc v0.2.105
       Compiling serde v1.0.130
       Compiling anyhow v1.0.44
       Compiling proc-macro-hack v0.5.19
       Compiling autocfg v1.0.1
       Compiling memchr v2.4.1
       Compiling unicode-segmentation v1.8.0
       Compiling ryu v1.0.5
       Compiling unicode-width v0.1.9
       Compiling lazy_static v1.4.0
       Compiling regex-syntax v0.6.25
       Compiling serde_derive v1.0.130
       Compiling once_cell v1.8.0
       Compiling serde_json v1.0.68
       Compiling hashbrown v0.11.2
       Compiling strsim v0.10.0
       Compiling itoa v0.4.8
       Compiling glob v0.3.0
       Compiling number_prefix v0.4.0
       Compiling bitflags v1.3.2
       Compiling termcolor v1.1.2
       Compiling fmterr v0.1.1
       Compiling fs_extra v1.2.0
       Compiling proc-macro-error-attr v1.0.4
       Compiling proc-macro-error v1.0.4
       Compiling unicase v2.6.0
       Compiling indexmap v1.7.0
       Compiling heck v0.3.3
       Compiling textwrap v0.14.2
       Compiling regex v1.5.4
       Compiling quote v1.0.10
       Compiling terminal_size v0.1.17
       Compiling atty v0.2.14
       Compiling toml v0.5.8
       Compiling os_str_bytes v4.2.0
       Compiling console v0.15.0
       Compiling console v0.14.1
       Compiling indicatif v0.17.0-beta.1
       Compiling thiserror-impl v1.0.30
       Compiling include_dir_impl v0.6.2
       Compiling clap_derive v3.0.0-beta.5
       Compiling thiserror v1.0.30
       Compiling include_dir v0.6.2
       Compiling clap v3.0.0-beta.5
       Compiling cargo_toml v0.9.2
       Compiling perseus-cli v0.3.0-beta.14
        Finished release [optimized] target(s) in 2m 43s
      Installing /usr/local/cargo/bin/perseus
       Installed package `perseus-cli v0.3.0-beta.14` (executable `perseus`)
    Removing intermediate container cd545af5bdf3
     ---> 25f00239fd3c
    Step 10/21 : RUN perseus clean
     ---> Running in 9d5e3832deba
    Removing intermediate container 9d5e3832deba
     ---> 27b455fc37f8
    Step 11/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml   && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml   && echo ' \n[profile.release] \ncodegen-units = 1 \nopt-level = "s" \nlto = true ' >> ./Cargo.toml   && cat ./Cargo.toml
     ---> Running in 81363b9ea235
    [package]
    name = "perseus-example-tiny"
    version = "0.3.0-beta.14"
    edition = "2018"
    
    # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    
    [dependencies]
    wee_alloc = "0.4"
    perseus = "0.3.0-beta.14"
    sycamore = "0.6"
     
    [profile.release] 
    codegen-units = 1 
    opt-level = "s" 
    lto = true 
    Removing intermediate container 81363b9ea235
     ---> aa2e155c1003
    Step 12/21 : RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs   && echo '#[global_allocator] \nstatic ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; \n' | cat - ./src/lib.rs > ./src/lib.rs.tmp   && mv ./src/lib.rs.tmp ./src/lib.rs   && cat ./src/lib.rs
     ---> Running in 593b24317e72
    #[global_allocator] 
    static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; 
    
    use perseus::{define_app, ErrorPages, Template};
    use sycamore::template;
    define_app! {
        templates: [
            Template::<G>::new("index").template(|_| {
                template! {
                    p { "世界您好 !" }
                }
            })
        ],
        error_pages: ErrorPages::new(|url, status, err, _| {
            template! {
                p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
            }
        })
    }
    Removing intermediate container 593b24317e72
     ---> cc3e7f0c4a12
    Step 13/21 : RUN perseus prep && perseus eject
     ---> Running in 44ca42cbfb56
    Removing intermediate container 44ca42cbfb56
     ---> 6956cf16c8b0
    Step 14/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" .perseus/Cargo.toml   && echo ' \n\n[profile.release] \ncodegen-units = 1 \nopt-level = "s" ' >> .perseus/Cargo.toml   && cat .perseus/Cargo.toml
     ---> Running in 36fce3a82248
    # This crate defines the user's app in terms that Wasm can understand, making development significantly simpler.
    # IMPORTANT: spacing matters in this file for runtime replacements, do NOT change it!
    
    [package]
    name = "perseus-engine"
    version = "0.3.0-beta.14"
    edition = "2018"
    
    # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    
    [dependencies]
    # We alias here because the package name will change based on whatever's in the user's manifest
    app = { package = "perseus-example-tiny", path = "../" }
    
    perseus = "0.3.0-beta.14"
    sycamore = { version = "0.6", features = ["ssr"] }
    sycamore-router = "0.6"
    web-sys = { version = "0.3", features = ["Event", "Headers", "Request", "RequestInit", "RequestMode", "Response", "ReadableStream", "Window"] }
    wasm-bindgen = "0.2"
    wasm-bindgen-futures = "0.4"
    console_error_panic_hook = "0.1.6"
    
    # This section is needed for Wasm Pack (which we use instead of Trunk for flexibility)
    [lib]
    crate-type = ["cdylib", "rlib"]
    
    [workspace] 
    
    [profile.release] 
    codegen-units = 1 
    opt-level = "s" 
    Removing intermediate container 36fce3a82248
     ---> ae1fa886efa7
    Step 15/21 : RUN perseus deploy
     ---> Running in 89e40bbf8aac
        Updating crates.io index
        Blocking waiting for file lock on package cache
        Blocking waiting for file lock on package cache
     Downloading crates ...
      Downloaded actix-connect v2.0.0
      Downloaded rustc_version v0.3.3
      Downloaded serde_urlencoded v0.7.0
      Downloaded time-macros-impl v0.1.2
      Downloaded tracing-futures v0.2.5
      Downloaded const_fn v0.4.8
      Downloaded opaque-debug v0.3.0
      Downloaded version_check v0.1.5
      Downloaded ucd-trie v0.1.3
      Downloaded trust-dns-proto v0.19.7
      Downloaded pin-project-internal v1.0.8
      Downloaded pin-project-lite v0.1.12
      Downloaded rand v0.7.3
      Downloaded brotli-sys v0.3.2
      Downloaded actix-testing v1.0.1
      Downloaded actix-service v1.0.6
      Downloaded actix-router v0.2.7
      Downloaded bytestring v1.0.0
      Downloaded actix-web v3.3.2
      Downloaded digest v0.9.0
      Downloaded v_escape v0.15.0
      Downloaded pin-project v0.4.28
      Downloaded semver v0.11.0
      Downloaded time-macros v0.1.1
      Downloaded time v0.2.27
      Downloaded v_htmlescape v0.12.0
      Downloaded trust-dns-resolver v0.19.7
      Downloaded pin-project-internal v0.4.28
      Downloaded tokio-util v0.3.1
      Downloaded tokio v0.2.25
      Downloaded standback v0.2.17
      Downloaded perseus-actix-web v0.3.0-beta.14
      Downloaded lru-cache v0.1.2
      Downloaded generic-array v0.14.4
      Downloaded actix-rt v1.1.1
      Downloaded pest v2.1.3
      Downloaded match_cfg v0.1.0
      Downloaded language-tags v0.2.2
      Downloaded block-buffer v0.9.0
      Downloaded convert_case v0.4.0
      Downloaded actix-server v1.0.4
      Downloaded rand_core v0.5.1
      Downloaded semver-parser v0.10.2
      Downloaded brotli2 v0.3.2
      Downloaded derive_more v0.99.16
      Downloaded h2 v0.2.7
      Downloaded bytes v0.5.6
      Downloaded awc v2.0.3
      Downloaded actix-files v0.5.0
      Downloaded ppv-lite86 v0.2.15
      Downloaded pin-project v1.0.8
      Downloaded nom v4.2.3
      Downloaded tracing-core v0.1.21
      Downloaded enum-as-inner v0.3.3
      Downloaded linked-hash-map v0.5.4
      Downloaded getrandom v0.1.16
      Downloaded cookie v0.14.4
      Downloaded base64 v0.13.0
      Downloaded actix-utils v2.0.0
      Downloaded typenum v1.14.0
      Downloaded tracing v0.1.29
      Downloaded buf-min v0.4.0
      Downloaded v_escape_derive v0.8.5
      Downloaded rand_chacha v0.2.2
      Downloaded mio-uds v0.6.8
      Downloaded hostname v0.3.1
      Downloaded fxhash v0.2.1
      Downloaded cpufeatures v0.2.1
      Downloaded copyless v0.1.5
      Downloaded actix-web-codegen v0.4.0
      Downloaded actix-tls v2.0.0
      Downloaded actix-threadpool v0.3.3
      Downloaded actix-macros v0.1.3
      Downloaded threadpool v1.8.1
      Downloaded signal-hook-registry v1.4.0
      Downloaded sha-1 v0.9.8
      Downloaded resolv-conf v0.7.0
      Downloaded actix-codec v0.3.0
      Downloaded actix-http v2.2.1
      Downloaded socket2 v0.3.19
        Blocking waiting for file lock on package cache
       Compiling proc-macro2 v1.0.32
       Compiling unicode-xid v0.2.2
       Compiling syn v1.0.81
       Compiling libc v0.2.105
       Compiling cfg-if v1.0.0
       Compiling version_check v0.9.3
       Compiling autocfg v1.0.1
       Compiling log v0.4.14
       Compiling memchr v2.4.1
       Compiling proc-macro-hack v0.5.19
       Compiling futures-core v0.3.17
       Compiling slab v0.4.5
       Compiling serde_derive v1.0.130
       Compiling futures-sink v0.3.17
       Compiling serde v1.0.130
       Compiling ryu v1.0.5
       Compiling futures-channel v0.3.17
       Compiling pin-project-lite v0.2.7
       Compiling cfg-if v0.1.10
       Compiling futures-task v0.3.17
       Compiling proc-macro-nested v0.1.7
       Compiling itoa v0.4.8
       Compiling smallvec v1.7.0
       Compiling pin-utils v0.1.0
       Compiling futures-io v0.3.17
       Compiling lazy_static v1.4.0
       Compiling serde_json v1.0.68
       Compiling bytes v0.5.6
       Compiling wasm-bindgen-shared v0.2.78
       Compiling pin-project-lite v0.1.12
       Compiling bumpalo v3.8.0
       Compiling parking_lot_core v0.8.5
       Compiling pin-project-internal v0.4.28
       Compiling scopeguard v1.1.0
       Compiling getrandom v0.1.16
       Compiling convert_case v0.4.0
       Compiling bytes v1.1.0
       Compiling static_assertions v1.1.0
       Compiling wasm-bindgen v0.2.78
       Compiling hashbrown v0.11.2
       Compiling async-trait v0.1.51
       Compiling matches v0.1.9
       Compiling fnv v1.0.7
       Compiling percent-encoding v2.1.0
       Compiling tinyvec_macros v0.1.0
       Compiling typenum v1.14.0
       Compiling bitflags v1.3.2
       Compiling copyless v0.1.5
       Compiling either v1.6.1
       Compiling ppv-lite86 v0.2.15
       Compiling unicode-bidi v0.3.7
       Compiling unicode-segmentation v1.8.0
       Compiling const_fn v0.4.8
       Compiling cc v1.0.71
       Compiling match_cfg v0.1.0
       Compiling ident_case v1.0.1
       Compiling strsim v0.10.0
       Compiling quick-error v1.2.3
       Compiling once_cell v1.8.0
       Compiling version_check v0.1.5
       Compiling linked-hash-map v0.5.4
       Compiling crc32fast v1.2.1
       Compiling minimal-lexical v0.1.4
       Compiling encoding_rs v0.8.29
       Compiling utf8-width v0.1.5
       Compiling regex-syntax v0.6.25
       Compiling adler v1.0.2
       Compiling httparse v1.5.1
       Compiling byteorder v1.4.3
       Compiling mime v0.3.16
       Compiling opaque-debug v0.3.0
       Compiling cpufeatures v0.2.1
       Compiling v_escape v0.15.0
       Compiling language-tags v0.2.2
       Compiling base64 v0.13.0
       Compiling wee_alloc v0.4.5
       Compiling fmterr v0.1.1
       Compiling urlencoding v2.1.0
       Compiling v_htmlescape v0.12.0
       Compiling memory_units v0.4.0
       Compiling instant v0.1.12
       Compiling standback v0.2.17
    error: could not compile `regex-syntax`
    
    Caused by:
      process didn't exit successfully: `rustc --crate-name regex_syntax --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.6.25/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="unicode"' --cfg 'feature="unicode-age"' --cfg 'feature="unicode-bool"' --cfg 'feature="unicode-case"' --cfg 'feature="unicode-gencat"' --cfg 'feature="unicode-perl"' --cfg 'feature="unicode-script"' --cfg 'feature="unicode-segment"' -C metadata=09d5543a3c98c8ca -C extra-filename=-09d5543a3c98c8ca --out-dir /app/tiny/.perseus/server/target/release/deps -L dependency=/app/tiny/.perseus/server/target/release/deps --cap-lints allow` (signal: 9, SIGKILL: kill)
    warning: build failed, waiting for other jobs to finish...
    error: build failed
    [INFO]: Checking for the Wasm target...
    [INFO]: Compiling to Wasm...
       Compiling proc-macro2 v1.0.32
       Compiling unicode-xid v0.2.2
       Compiling syn v1.0.81
       Compiling autocfg v1.0.1
       Compiling serde_derive v1.0.130
       Compiling serde v1.0.130
       Compiling ryu v1.0.5
       Compiling log v0.4.14
       Compiling wasm-bindgen-shared v0.2.78
       Compiling serde_json v1.0.68
       Compiling cfg-if v1.0.0
       Compiling bumpalo v3.8.0
       Compiling lazy_static v1.4.0
       Compiling version_check v0.9.3
       Compiling itoa v0.4.8
       Compiling memchr v2.4.1
       Compiling wasm-bindgen v0.2.78
       Compiling static_assertions v1.1.0
       Compiling futures-core v0.3.17
       Compiling proc-macro-hack v0.5.19
       Compiling proc-macro-nested v0.1.7
       Compiling futures-task v0.3.17
       Compiling futures-channel v0.3.17
       Compiling libc v0.2.105
       Compiling futures-sink v0.3.17
       Compiling once_cell v1.8.0
       Compiling ident_case v1.0.1
       Compiling fnv v1.0.7
       Compiling hashbrown v0.11.2
       Compiling strsim v0.10.0
       Compiling pin-utils v0.1.0
       Compiling slab v0.4.5
       Compiling futures-io v0.3.17
       Compiling pin-project-lite v0.2.7
       Compiling smallvec v1.7.0
       Compiling minimal-lexical v0.1.4
       Compiling utf8-width v0.1.5
       Compiling async-trait v0.1.51
       Compiling bytes v1.1.0
       Compiling wee_alloc v0.4.5
       Compiling fmterr v0.1.1
       Compiling cfg-if v0.1.10
       Compiling urlencoding v2.1.0
       Compiling memory_units v0.4.0
       Compiling indexmap v1.7.0
       Compiling futures-macro v0.3.17
       Compiling num-traits v0.2.14
       Compiling futures-util v0.3.17
       Compiling num-integer v0.1.44
       Compiling ahash v0.7.6
       Compiling nom v7.0.0
       Compiling lexical-util v0.8.1
       Compiling html-escape v0.2.9
       Compiling http v0.2.5
       Compiling lexical-write-integer v0.8.0
       Compiling lexical-parse-integer v0.8.0
       Compiling quote v1.0.10
       Compiling time v0.1.43
       Compiling lexical-write-float v0.8.2
       Compiling lexical-parse-float v0.8.2
       Compiling lexical-core v0.8.2
       Compiling chrono v0.4.19
       Compiling lexical v6.0.1
       Compiling wasm-bindgen-backend v0.2.78
       Compiling darling_core v0.13.0
    error: could not compile `syn`
    
    Caused by:
      process didn't exit successfully: `rustc --crate-name syn --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.81/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="clone-impls"' --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="extra-traits"' --cfg 'feature="full"' --cfg 'feature="parsing"' --cfg 'feature="printing"' --cfg 'feature="proc-macro"' --cfg 'feature="quote"' --cfg 'feature="visit"' --cfg 'feature="visit-mut"' -C metadata=9e13baa20de7a851 -C extra-filename=-9e13baa20de7a851 --out-dir /app/tiny/.perseus/target/release/deps -L dependency=/app/tiny/.perseus/target/release/deps --extern proc_macro2=/app/tiny/.perseus/target/release/deps/libproc_macro2-cab6106af7d326c8.rmeta --extern quote=/app/tiny/.perseus/target/release/deps/libquote-06c3e2dc93d8e69e.rmeta --extern unicode_xid=/app/tiny/.perseus/target/release/deps/libunicode_xid-0770809ab462d12c.rmeta --cap-lints allow --cfg syn_no_negative_literal_parse --cfg syn_disable_nightly_tests` (signal: 9, SIGKILL: kill)
    warning: build failed, waiting for other jobs to finish...
    error: build failed
    Error: Compiling your crate to WebAssembly failed
    Caused by: failed to execute `cargo build`: exited with exit status: 101
      full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
    ERROR: Service 'perseus' failed to build : The command '/bin/sh -c perseus deploy' returned a non-zero code: 1
    

    Expected behavior perseus deploy to perform successfully at least for the version 0.3.0-beta.14.

    Screenshots None.

    Environment (please complete the following information):

    • Perseus Version: 0.3.0-beta.14
    • Sycamore Version: 0.6.0
    • OS: both docker hosts run debian 10
    • Browser: Not relevant
    • Browser Version: Not relevant

    Additional context The Dockerfile above isn't using the perseus-size-opt plugin, but instead adds wee_alloc optimizations manually.

    opened by phaleth 16
  • wasm-bindgen failed to build : version mismatch

    wasm-bindgen failed to build : version mismatch

    This issue is reporting a bug in the code of Perseus. Details of the scope will be available in issue labels. The author described their issue as follows:

    wasm-bindgen failed to build: version mismatch

    The steps to reproduce this issue are as follows:

    while testing the example at: https://github.com/arctic-hen7/perseus/tree/main/examples/demos/auth I had an error while calling perseus serve Trying to upgrade/downgrade web-sys or wasm-bindgen didnt' help. The error seems to happen from the global_state while trying to use web_sys

    The details of the log report is as follow

     perseus serve
      [1/4] 🔨 Generating your app...✅
      [2/4] 🏗️  Building your app to Wasm...❌
      [3/4] 📡 Building server...✅
    error:
    
    it looks like the Rust project used to create this wasm file was linked against
    version of wasm-bindgen that uses a different bindgen format than this binary:
    
      rust wasm file schema version: 0.2.82
         this binary schema version: 0.2.81 (062aa5f70)
    
    Currently the bindgen format is unstable enough that these two schema versions
    must exactly match. You can accomplish this by either updating the wasm-bindgen
    dependency or this binary.
    
    You should be able to update the wasm-bindgen dependency with:
    
        cargo update -p wasm-bindgen
    
    or you can update the binary with
    
        cargo install -f wasm-bindgen-cli
    
    if this warning fails to go away though and you're not sure what to do feel free
    to open an issue at https://github.com/rustwasm/wasm-bindgen/issues!
    

    A minimum reproducible example is available at <>.

    • Hydration-related: false
    • The author is willing to attempt a fix: false
    Tribble internal data

    dHJpYmJsZS1yZXBvcnRlZCxDLWJ1ZyxBLWNsaQ==

    C-bug A-cli tribble-reported 
    opened by afidegnum 15
  • Disabling optimizations for specific packages in Cargo.toml?

    Disabling optimizations for specific packages in Cargo.toml?

    Describe the bug I've encountered the following bug in Rust, i.e., when building a package with perseus build (or serve or test), the "Building your app to Wasm..." step never ends (finally being killed by the OOM killer). It only happens for the --release target of wasm32, not for x86_64 and wasm32 without --release.

    A workaround for this bug is to disable optimizations for fluent-bundle.

    How do I specify opt-level = 0 for the fluent-bundle package in Cargo.toml so that perseus-cli picks it up and builds the package with the option present? I tried just putting in Cargo.toml, but it didn't work. It would be great to see in Perseus' docs how to do this...

    Environment:

    • Perseus Version: 0.3.0-beta.17
    • Sycamore Version: 0.6
    • OS: Linux
    opened by adundovi 14
  • `--integration actix-web` flag causes `perseus deploy` to fail

    `--integration actix-web` flag causes `perseus deploy` to fail

    Perseus 0.3.2 has a problem with actix-web integration. Seems like there is already a fix on the main branch. Mind doing a 0.3.3 patch release? Bellow is the end of the trace.

    No clue how to disable the hydrate feature. I guess it's not related.

    ...
       Compiling zstd v0.9.2+zstd.1.5.1
       Compiling actix-http v3.0.0-beta.16
       Compiling sycamore-reactive v0.7.1
       Compiling sycamore v0.7.1
       Compiling actix-web v4.0.0-beta.15
       Compiling sycamore-router v0.7.1
       Compiling perseus v0.3.2
    error: could not compile `actix-web` due to 7 previous errors
    warning: build failed, waiting for other jobs to finish...
    error: build failed
    The command '/bin/sh -c perseus deploy --integration actix-web' returned a non-zero code: 1
    

    The steps to reproduce this issue are as follows:

    Call perseus deploy --integration actix-web

    A minimum reproducible example is available at <>.

    • Hydration-related: false
    • The author is willing to attempt a fix: false
    Tribble internal data

    dHJpYmJsZS1yZXBvcnRlZCxDLWJ1ZyxBLWRlcGxveW1lbnQ=

    C-bug A-deployment tribble-reported 
    opened by phaleth 13
  • `perseus serve` crashes with no error on Arch Linux

    `perseus serve` crashes with no error on Arch Linux

    Describe the bug The bug consists of 2 bugs. But I think the first bug is already described in #74. It basicly crashes with the serve command. I Think I found a workaround by not building the package with serve. The second bug(the reason why I created a new issue) is the webpage crashes in the Hello World example. Presumably because of an example in the package.

    To Reproduce Steps to reproduce the behavior:

    1. create project according to hello world example in https://arctic-hen7.github.io/perseus/en-US/docs/0.2.x/hello-world
    2. $perseus build
    3. $perseus serve 3.1 this stops with this output which is unexpected but I think this is related to #74
        [1/4] 🔨 Generating your app...✅
    ⠠ [3/4] 📡 Building server...
    
    1. $perseus serve --no-build
    2. goto localhost:8080
    3. see Hello World for a second which disappears.
    4. open console and see the additional info

    Expected behavior See a hello word

    Screenshots None

    Environment (please complete the following information):

    • Perseus Version: v0.2.0
    • Sycamore Version: v0.6.0
    • OS: manjaro
    • Browser: firefox
    • Browser Version: 94.0

    Additional context

    $perseus -v                                       
    You are currently running the Perseus CLI v0.2.3! You can see the latest release at https://github.com/arctic-hen7/perseus/releases.
    

    Console Output

    panicked at 'called `Option::unwrap()` on a `None` value', /home/arctic_hen7/Coding/Projects/perseus/examples/basic/src/templates/index.rs:41:63
    
    Stack:
    
    init/imports.wbg.__wbg_new_59cb74e423758ede@http://localhost:8080/.perseus/bundle.js:327:19              bundle.js:340:13
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[317]:0x42255
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[1012]:0x5b3f8
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[525]:0x52361
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[597]:0x5545b
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[825]:0x5a17d
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[792]:0x59af6
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[826]:0x5a1b3
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[767]:0x59476
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[162]:0x28513
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[798]:0x59c69
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[250]:0x39bc8
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[158]:0x2705c
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[415]:0x4b37e
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[259]:0x3b177
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[987]:0x5b2da
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[91]:0x24e1
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[475]:0x4f6ca
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[438]:0x4ce36
    @http://localhost:8080/.perseus/bundle.wasm:wasm-function[893]:0x5ac1b
    __wbg_adapter_23@http://localhost:8080/.perseus/bundle.js:210:10
    real@http://localhost:8080/.perseus/bundle.js:191:20
    
    
    
        __wbg_error_4bb6c2a97407129a http://localhost:8080/.perseus/bundle.js:340
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:271185
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:373752
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:336737
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:349275
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:369021
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:367350
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:369075
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:365686
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:165139
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:367721
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:236488
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:159836
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:308094
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:242039
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:373466
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:9441
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:325322
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:314934
        <anonymous> http://localhost:8080/.perseus/bundle.wasm:371739
        __wbg_adapter_23 http://localhost:8080/.perseus/bundle.js:210
        real http://localhost:8080/.perseus/bundle.js:191
        
       --------------------------------------------------------------------------
    Uncaught (in promise) RuntimeError: unreachable executed                                                  bundle.wasm:336791:1
        __wbg_adapter_23 http://localhost:8080/.perseus/bundle.js:210
        real http://localhost:8080/.perseus/bundle.js:191
    
    
    C-bug P-high S-waiting-on-author 
    opened by njittam 13
  • Some errors in compilation/execution don't appear in the CLI output

    Some errors in compilation/execution don't appear in the CLI output

    Describe the bug I ran cargo check, everything works well with no error but when I ran persus serve the servers compiles then exits

    this is the current state from the shell

    Finished dev [unoptimized + debuginfo] target(s) in 29.30s Running target/debug/perseus-builder [1/4] 🔨 Generating your app...❌ [2/4] 🏗️ Building your app to Wasm...✅ [3/4] 📡 Building server...✅

    Expected behavior Is there a way to print the error log?

    Environment (please complete the following information):

    [package]
    name = "emlfront"
    version = "0.3.0-beta.3"
    edition = "2018"
    
    # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    
    [dependencies]
    perseus = "0.3.0-beta.17"
    sycamore = "0.6.3"
    sycamore-router = "0.6.3"
    serde = { version = "1", features = ["derive"] }
    serde_json = "1"
    fluent-bundle = "0.15"
    walkdir = "2"
    pulldown-cmark = "0.8"
    lazy_static = "1"
    web-sys = { version = "0.3", features = [ "Event", "EventTarget" ] }
    wasm-bindgen = "0.2"
    perseus-size-opt = "0.1"
    
    # [lib]
    # crate-type = ["cdylib", "rlib"]
    
    C-bug A-cli D-medium P-high S-waiting-on-author 
    opened by afidegnum 13
  • Add website node modules install step to `bonnie setup`

    Add website node modules install step to `bonnie setup`

    Without the npm i --prefix ./website step prior to bonnie site run an error as bellow is thrown and styles on the website are all out of place.

    (node:17003) UnhandledPromiseRejectionWarning: Error: Cannot find module 'tailwindcss/defaultTheme'
    Require stack:
    - /home/user/perseus/website/tailwind.config.js
    - /home/user/emsdk/node/14.15.5_64bit/lib/node_modules/tailwindcss/lib/cli.js
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
        at Function.Module._load (internal/modules/cjs/loader.js:725:27)
        at Module.require (internal/modules/cjs/loader.js:952:19)
        at require (internal/modules/cjs/helpers.js:88:18)
        at Object.<anonymous> (/home/user/perseus/website/tailwind.config.js:1:22)
        at Module._compile (internal/modules/cjs/loader.js:1063:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
        at Module.load (internal/modules/cjs/loader.js:928:32)
        at Function.Module._load (internal/modules/cjs/loader.js:769:14)
        at Module.require (internal/modules/cjs/loader.js:952:19)
    (Use `node --trace-warnings ...` to show where the warning was created)
    (node:17003) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
    (node:17003) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    
    opened by phaleth 12
  • build_state_fn doesn't work after perseus::autoserde(build_state) (Sync required)

    build_state_fn doesn't work after perseus::autoserde(build_state) (Sync required)

    Describe the bug

    Since the newest beta, or after 0.3.0beta18, I believe, and now with newly released 0.3.0, I encounter the following error when building with perseus:

    error: future cannot be shared between threads safely
       --> src/templates/pages/about.rs:23:25
        |
    23  |         .build_state_fn(get_build_props)
        |                         ^^^^^^^^^^^^^^^ future returned by `get_build_props` is not `Sync`
        |
        = help: the trait `Sync` is not implemented for `(dyn Future<Output = Result<surf::Response, surf::Error>> + Send + 'static)`
    note: future is not `Sync` as this value is used across an await
       --> src/templates/components/markdown.rs:39:23
        |
    39  |         let content = surf::get(url).recv_string().await.unwrap();
        |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ first, await occurs here, with `surf::get(url)` maybe used later...
    note: `surf::get(url)` is later dropped here
       --> src/templates/components/markdown.rs:39:66
        |
    39  |         let content = surf::get(url).recv_string().await.unwrap();
        |                       --------------                             ^
        |                       |
        |                       has type `RequestBuilder` which is not `Sync`
    note: required by a bound in `Template::<G>::build_state_fn`
       --> .cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0/src/template.rs:510:19
        |
    510 |         val: impl GetBuildStateFnType + Send + Sync + 'static,
        |                   ^^^^^^^^^^^^^^^^^^^ required by this bound in `Template::<G>::build_state_fn`
    

    I see that the problem is related to surf, but this worked a few versions ago, before the introduction #[perseus::autoserde(build_state)]. How to fix this?

    Here is a sample:

    #[perseus::template(AboutPage)]
    #[component(AboutPage<G>)]
    pub fn about_page(props: MarkdownPageProps) -> View<G> {
          view! {
              MainLayout(
                  view!{ MarkdownProse(props) }
              )
          }
    }
      
    pub fn get_template<G: Html>() -> Template<G> {
          Template::new("about")
              .build_state_fn(get_build_props)
              .template(about_page)
              .head(|_| {
                view! {
                      title { "Some title" }
                  }
              })
    }
      
    #[perseus::autoserde(build_state)]
      pub async fn get_build_props(_path: String, locale: String) -> RenderFnResultWithCause<MarkdownPageProps> {
          Ok(MarkdownPageProps::fetch(&format!(
                  "(...)/{loc}/about.md",
                  loc = locale
              )
          ).await)
      }
    
    #[derive(Serialize, Deserialize, Debug)]
    pub struct MarkdownPageProps {
        pub text: String,
    }
    
    impl MarkdownPageProps {
        #[cfg(not(target_arch = "wasm32"))]
        pub async fn fetch(url: &str) -> MarkdownPageProps {
            let content = surf::get(url).recv_string().await.unwrap();
            MarkdownPageProps { text: content }
        }
    

    Environment (please complete the following information):

    • Perseus Version: 0.3.0
    • Sycamore Version: 0.7.1
    • OS: GNU/Linux
    opened by adundovi 12
  • CLI Generated sample program does not work

    CLI Generated sample program does not work

    This issue is reporting a bug in the code of Perseus. Details of the scope will be available in issue labels. The author described their issue as follows:

    I have created an app with perseus new (cli version = 0.4.0.beta.11). Then I attempt to start it with perseus serve. It fails to build.

    The steps to reproduce this issue are as follows:

    1. perseus new client
    1. cd client && perseus serve

    A minimum reproducible example is available at <>.

    • Hydration-related: false
    • The author is willing to attempt a fix: false
    Tribble internal data

    dHJpYmJsZS1yZXBvcnRlZCxDLWJ1ZyxBLWNsaQ==

    C-bug A-cli tribble-reported 
    opened by HBnetDE 24
  • [Meta] Fix i18n end-to-end test

    [Meta] Fix i18n end-to-end test

    For about a year now, the i18n end-to-end test has been extremely patchy, and, since GHA automatically stops other test runs if one fails, it's not uncommon for a PR or commit to get failing tests even if it's perfectly valid, just because the i18n test fails. Others have failed in the past (false negatives are an unavoidable side-effect of full headless browser end-to-end tests, I get that), but none as frequently as the i18n one (to my observation).

    In terms of fixing this, I think the first step is to try to get GHA to push ahead and run all the tests, even if a few fail, which would also provide far better debugging capability, and make re-runs much speedier (we usually just re-run failing tests, and if there's only one rather than 14 others that were cancelled, that's much quicker!). Beyond that, I'll have a look in the coming days at any possible improvements that could be made to the test itself to prevent the weird failure.

    TODO actual error log when I have time to extract it from GHA

    C-bug P-medium S-in-design author-willing-to-impl 
    opened by arctic-hen7 5
  • Cookies Feature

    Cookies Feature

    This issue is requesting an enhancement to Perseus. Details of the scope will be available in issue labels. The user described the problem related to this request as follows:

    Easy access in setting cookies and reading cookies from server side.

    The user described the issue as follows:

    request_state should allow for reading cookies from the Request type without parsing them yourself as well as setting them.

    • The author is willing to attempt an implementation: true
    Tribble internal data

    dHJpYmJsZS1yZXBvcnRlZCxDLWVuaGFuY2VtZW50LGF1dGhvci13aWxsaW5nLXRvLWltcGw=

    PR In context: https://github.com/framesurge/perseus/pull/158

    C-enhancement author-willing-to-impl tribble-reported 
    opened by danielnehrig 0
  • GZIP Compression

    GZIP Compression

    This issue is requesting an enhancement to Perseus. Details of the scope will be available in issue labels. The user described the problem related to this request as follows:

    server responses to the client can be quite big and adding another proxy infront of the app to gzip compress the response introduces additional cost on the infrastructure if might not needed.

    The user described the issue as follows:

    I recommend adding gzip compression to perseus responses

    • The author is willing to attempt an implementation: true
    Tribble internal data

    dHJpYmJsZS1yZXBvcnRlZCxDLWVuaGFuY2VtZW50LGF1dGhvci13aWxsaW5nLXRvLWltcGw=

    C-enhancement author-willing-to-impl tribble-reported 
    opened by danielnehrig 15
  • New routing system

    New routing system

    This issue is requesting an enhancement to Perseus. Details of the scope will be available in issue labels. The user described the problem related to this request as follows:

    Right now, Perseus' routing system is good, but not good enough. In particular, I made the decision early on to not embrace the flexibility of the de facto routing paradigm: support for statements like /user/<param>/blah/<..param>. While achieving the same thing is possible in Perseus using incremental generation, it's far from easy.

    The user described the issue as follows:

    Perseus should support parameter-based routing through template names. Specifically, <param> should be interpreted as single path component that can vary, and <..param>/<param..> should be interpreted as a series of path components (like incremental generation works today). This would be very similar to the way Sycamore's router handles routing, though integrated with Perseus' incremental generation and broader state management systems. This will be complex, but not too difficult I don't think --- the only things that will need to change are possibly the render config format (file that tells Perseus how routes work in an app), and the routing logic. Right now, the routing logic is surprisingly simple, and this would probably mean some fundamental changes to it, but a lot of this could be based on Sycamore's routing systems. (I may even end up using them under the hood, as we used to in v0.1.0.)

    • The author is willing to attempt an implementation: true
    Tribble internal data

    dHJpYmJsZS1yZXBvcnRlZCxDLWVuaGFuY2VtZW50LGF1dGhvci13aWxsaW5nLXRvLWltcGw=

    C-enhancement author-willing-to-impl tribble-reported 
    opened by arctic-hen7 0
  • SWR in page serving

    SWR in page serving

    This issue is requesting an enhancement to Perseus. Details of the scope will be available in issue labels. The user described the problem related to this request as follows:

    Revalidation would be better if users could let the server automatically revalidate the page after each request: essentially stale-while-revalidate for pages.

    The user described the issue as follows:

    Just that: inbuilt SWR support for after the server has already served the existing version of the page.

    • The author is willing to attempt an implementation: true
    Tribble internal data

    dHJpYmJsZS1yZXBvcnRlZCxDLWVuaGFuY2VtZW50LGF1dGhvci13aWxsaW5nLXRvLWltcGw=

    C-enhancement author-willing-to-impl tribble-reported 
    opened by arctic-hen7 0
Releases(v0.4.0-beta.14)
Owner
arctic_hen7
Hi! I'm a human that likes building cool stuff with code!
arctic_hen7
Code template for a production Web Application using Axum: The AwesomeApp Blueprint for Professional Web Development.

AwesomeApp rust-web-app More info at: https://awesomeapp.dev/rust-web-app/ rust-web-app YouTube episodes: Episode 01 - Rust Web App - Course to Produc

null 45 Sep 6, 2023
Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix 16.2k Jan 2, 2023
example of a full stack web app (backend and frontend) wrtiten in Rust

rust-fullstack-example An example of creating a full stack web application (backend and frontend) using Rust. Backend Go to ./backend and start the se

mario 41 Dec 16, 2022
A GUI frontend in Rust based on web-view

neutrino I am not working anymore on this project. If you want to become a maintainer of neutrino, please answer to this issue. Preamble Docs | Repo |

null 287 Nov 25, 2022
A simple authentication flow using Rust and Actix-web, with a PostgreSQL database and a sveltekit frontend.

Rust-auth-example This repository aims to represent a simple authentication flow using Rust and Actix-web, with a PostgreSQL database and a sveltekit

Kival Mahadew 4 Feb 19, 2023
A highly customizable, full scale web backend for web-rwkv, built on axum with websocket protocol.

web-rwkv-axum A axum web backend for web-rwkv, built on websocket. Supports BNF-constrained grammar, CFG sampling, etc., all streamed over network. St

Li Junyu 12 Sep 25, 2023
Ergonomic and modular web framework built with Tokio, Tower, and Hyper

axum axum is a web application framework that focuses on ergonomics and modularity. More information about this crate can be found in the crate docume

Tokio 7.9k Dec 31, 2022
Sauron is an html web framework for building web-apps. It is heavily inspired by elm.

sauron Guide Sauron is an web framework for creating fast and interactive client side web application, as well as server-side rendering for back-end w

Jovansonlee Cesar 1.7k Dec 26, 2022
A blazingly fast HTTP client with a magnificent request building syntax, made for humans.

?? glue Make requests, select JSON responses, nest them in other requests: A magnificent syntax for blazingly fast cli HTTP calls, made for humans. Ta

Michele Esposito 4 Dec 7, 2022
A (flash) message framework for actix-web. A port to Rust of Django's message framework.

actix-web-flash-messages Flash messages for actix-web Web applications sometimes need to show a one-time notification to the user - e.g. an error mess

Luca Palmieri 31 Dec 29, 2022
Thruster - An fast and intuitive rust web framework

A fast, middleware based, web framework written in Rust

null 913 Dec 27, 2022
Seed is a Rust front-end framework for creating fast and reliable web apps with an Elm-like architecture.

Seed is a Rust front-end framework for creating fast and reliable web apps with an Elm-like architecture.

null 3.6k Jan 6, 2023
Super Fast & High Performance minimalist web framework for rust

Super Fast & High Performance minimalist web framework for rust

null 6 Oct 12, 2022
Quick demo of a REST frontend with a Redis session store.

axum-rest-starter-example Important Tasks Ensure session UUID is unique Protect /api/ with JWT Add CSRF CORS? Dev Setup (1) Run docker compose up to f

Michael de Silva 23 Dec 31, 2022
Hot reload static web server for deploying mutiple static web site with version control.

SPA-SERVER It is to provide a static web http server with cache and hot reload. 中文 README Feature Built with Hyper and Warp, fast and small! SSL with

null 7 Dec 18, 2022
A Rust web framework

cargonauts - a Rust web framework Documentation cargonauts is a Rust web framework intended for building maintainable, well-factored web apps. This pr

null 179 Dec 25, 2022
A rust web framework with safety and speed in mind.

darpi A web api framework with speed and safety in mind. One of the big goals is to catch all errors at compile time, if possible. The framework uses

null 32 Apr 11, 2022
A web framework for Rust.

Rocket Rocket is an async web framework for Rust with a focus on usability, security, extensibility, and speed. #[macro_use] extern crate rocket; #[g

Sergio Benitez 19.4k Jan 4, 2023
Rust / Wasm framework for building client web apps

Yew Rust / Wasm client web app framework Documentation (stable) | Documentation (latest) | Examples | Changelog | Roadmap | 简体中文文档 | 繁體中文文檔 | ドキュメント A

Yew Stack 25.8k Jan 2, 2023