Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

Implement building Rust functions for server side rendering #22

Merged
merged 11 commits into from
Nov 1, 2020

Conversation

kaleidawave
Copy link
Owner

@kaleidawave kaleidawave commented Oct 23, 2020

This PR will add support for compiling Rust functions that server side render Prism components and pages as part of #19

So given a Prism component or application the following will be possible:

npx @kaleidawave/prism compile-component --projectPath ./someComponent.prism --backendLanguage rust

And that component will be able to be rendered to a string of HTML will can then be used with a server to perform dynamic rendering:

...
mod some_component_prism

#[get("/")]
fn index() -> Html<String> {
        Html(some_component_prism::render_some_component())
}
...

…der output

- Isolated generation of ts module
- Added abstract module that will apply to other language module types
- Changes IStatement to be a union type. Not sure whether this helps anything
- Made a bunch of properties public to Component bc of new isolated thing
@kaleidawave kaleidawave added enhancement New feature or request server-side-rendering Server based render methods labels Oct 23, 2020
@kaleidawave kaleidawave self-assigned this Oct 23, 2020
The result of compiling a node to be server rendered is non specific to a language (at templating level, expressions are still js ast nodes). Converted ts module compilation to accept this middle step. Renamed some chef interfaces
- IValue -> ValueTypes
- Statements -> StatementTypes
…nder and started on creation of rust server modules
…ructs for server module compilation.

Made a few changes to JS variable utils, added "use" ast structure and borrow operation
…alls.

Reworked the way stages of parsing template.html, the shell for which every prism app exists in. Added rust prism server module compilation. Output still needs some tweaking and testing
- Fixes some issues with decorators and functions
- Implemented the decorator for swaping a function with rust code
- Seperated decorator from class.ts and renamed some chef stuff
- Added rust metadata string compilation and  reshuffled server render stages between component and component server module creation
@kaleidawave kaleidawave marked this pull request as ready for review November 1, 2020 17:39
@kaleidawave kaleidawave merged commit 95a49e0 into main Nov 1, 2020
@kaleidawave kaleidawave deleted the rust-ssr-functions branch November 1, 2020 17:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request server-side-rendering Server based render methods
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant