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

Create capsules system and rewrite just about everything #224

Merged
merged 102 commits into from
Dec 30, 2022

Conversation

arctic-hen7
Copy link
Member

@arctic-hen7 arctic-hen7 commented Nov 9, 2022

This creates the capsules system as per #4.

This will take a while before it's completely ready!

Closes #4.

That example will evolve substantially over the course of building this feature.
This is intended to allow a clean merge from `main`, after which these
changes will be re-implemented.

This reverts commit 5f592b3.
This introduces `Turbine`, which replaces all build, export, error page
export, tinker, and serving logic. Capsules have been introduced as an
integral part of these new processes.

This is *extremely* messy right now! (But the core compiles on the engine-side!)
BREAKING CHANGE: plugins can no longer add templates (provide the
functions to the user for them to manually add)
BREAKING CHANGE: `G` parameter removed entirely from plugins
It and the core now compile (not for the browser-side yet though). This
also brings nearly all the server-side logic into the core, which should
make authoring future integrations a trivial matter of just extracting
the correct data.

This currently uses a deliberate memory leak to get a `&'static Turbine`
to avoid the use of an `Arc`. So far, I see no issues with this, since
it only happens once, but this API may change to an `Arc`.
This also reduces the Actix Web and Axum integrations to single files,
in a universalized format that will be soon documented. Integrations
should be as simple as possible.
They are now all single-file (except for one extra handler Warp needs),
structured, and using the new turbine system. (I'll bet they're a lot
faster to, since only Warp needs one `Arc`).
Still a work-in-progress, but this will make the browser-side much more maintainable!
This makes error handling *much* cleaner, and removes a very large
number of panics that hypothetically wouldn't have been executed on the
browser-side, but the invariants were not rigorously guaranteed. They
now are, and errors are gracefully returned for handling.

This involves *substantial* import restructuring, and a greater
dependence on `perseus::prelude` for end users.
This is nowhere near complete, and full of compilation errors, but we
have the basics of a system!
This includes a crash plugin action.
The engine-side now compiles.
Apart from 3 lifetime errors, the browser-side now compiles. That's down
from 159...
For the first time in two weeks, the entire Perseus core, both
engine-side and browser-side, actually compile!!!
@arctic-hen7 arctic-hen7 changed the title Create capsules system Create capsules system and rewrite just about everything Dec 11, 2022
The browser-side widget component is also now ready (fetching not yet implemented).
This will allow both arbitrary executions (e.g. crash reports) and the
rendering of a proper popup message.
Custom error types are now fully permissible. I still want to make
infallible ones more ergonomic though.
This also affected thawing. There's a 'closure invoked recursively or
destroyed' error popping up, which I suspect is to do with live
reloading, but it doesn't seem to be causing any actual issues.
@arctic-hen7
Copy link
Member Author

There's a very odd issue on CI at the moment to do with wasm-opt versions not being able to be parsed, so I'm running the tests locally for now.

@arctic-hen7 arctic-hen7 marked this pull request as ready for review December 23, 2022 00:09
@arctic-hen7
Copy link
Member Author

No matter what CI says, all tests are now passing (including doctests and usual checks).

@arctic-hen7
Copy link
Member Author

Basic capsules functionality is now ready, and I'm just adding some further examples/tests for request-time behaviors like revalidation and incremental generation of widgets. Once that all works, there's still one thing I want to improve with incremental widget rendering to avoid an unnecessary build reschedule, and then this will be ready to merge!

The subsequent load fix was a little heavy-handed, and broke initial loads.
This lets us modify them to keep them up to date in PRs.
I am astonished this has never been caught: any incremental generation
using more than one level (e.g. `__capsule/number/*`) failed due to a
roge `else` clause that should never have been there.
This led to some really weird bugs, just because of a heavy-handed early bailout.
Note that this was the moment I realized incremental generation with
widgets can be used with reactivity to reactively command the server to
generate widgets in advance. That is unreasomably cool, and would allow
something like generating the widgets that back product pages on an
e-commerce website through the flipping search bar. The pieces are
coming together...
This avoids unnecessary reschedules, and brings the capsules system to
feature-completion, for now!
This was completely dysfunctional because I apparently didn't knw the
difference between a file and a directory.
@arctic-hen7 arctic-hen7 merged commit a4c59f2 into main Dec 30, 2022
@arctic-hen7 arctic-hen7 deleted the feat-capsules branch December 30, 2022 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add capsules system
1 participant