Commit Graph
281 Commits
Author SHA1 Message Date
Gabi dfc359cdfb adds feature server_fn_axum that compiles for wasm target (#3840)
The current `axum` feature and `server` feature are incompatible with wasm32-unknown-unknown target
due to:
1. depends on axum features not compatible with wasm
2. SSR requires reading the filesystem for index.html

With this patch I add the `server_fn_axum` feature which disables SSR and enables targeting
wasm32-unknown-unknown with server functions enabled.

Note that for this to work, `server_fn` depends on `inventory` and as stated in this docs depending on
the context you might need to expose and call [`__wasm_call_ctors`](https://docs.rs/inventory/latest/inventory/#webassembly-and-constructors)
(I needed that specifically for cloudflare workers)

change axum_server_fn feature for axum_wasm and include SSR tools there

This change additionaly make axum_server_fn feature additive by exposing a different
`DioxusRouterWasmExt` with only the wasm-compatible parts instead of exposing the
`DioxusRouter` trait under the same name.

Docs are updated to reflect this change.

rename axum_wasm to axum_core and update docs

fix typo

re-enable default-features for axum in dioxus-cli

re-enable axum default-features for liveview

re-enable default-features for axum for playwright-tests
2025-03-27 00:51:53 -06:00
Evan Almloff 09a4b5eb4e Return a 404 when paring the route fails (#3860)
* return a 404 when paring the route fails

* add a playwright test for fullstack routing status codes

* Fix new playwright test

* document SSRError

* Make SSRError public and fix clippy

* Move the error display bound to the routable trait

* fix clippy

* return a more generic 404 message

* fix router tests
2025-03-14 00:51:44 -07:00
hackartist 7b7357037f fix(server): Provide GoogleBot compatibility. (#3851) 2025-03-11 09:14:53 -07:00
hackartist 64106ba9af fix(fullstack): correct suspense handling in SSR renderer (#3829)
Move suspense handling to the correct position in the SSR renderer to ensure proper rendering when streaming is disabled.
2025-03-05 12:41:31 -06:00
Evan Almloff 8dbb652628 update the server function crate to 0.7 (#3560) 2025-03-04 14:29:56 -06:00
Evan Almloff 1fa172486b Add helper methods to provide a single clone server only context (#3483)
* Add helper methods to provide a single clone server only context

* fix clippy
2025-02-27 10:19:16 -08:00
Evan Almloff 2d188452ae Fix additional attributes for js renderers (#3625) 2025-01-31 14:31:31 -08:00
Evan Almloff aba2e73025 Simplify fullstack auth example (#3598) 2025-01-20 16:35:19 -08:00
James BenzeandJonathan Kelley d5a04c69ba Add server context to suspense resolution (#3552)
* Add server context to suspense resolution

While this was done correctly in the streaming case, non-streaming
suspense resolution didn't recieve the server context.  This meant that
anything that required the context after the point of suspension would
find it missing.

* fmt

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-01-13 12:30:00 -08:00
Evan AlmloffandJonathan Kelley d41ab3a756 Fix hydration of suspense fragments that contain text nodes (#3287)
* Fix hydration of suspense fragments that contain text nodes

* fix release builds

* disable link deduplication

* restore meta tag deduplication

* Add a test for the failed hydration case

* make changes to the document trait non-breaking

* remove info log from server future hook

* restore default implementation - this was also a breaking change

* fix semver breakage

* clean up server_future

* Cleanup unused code

* fix clippy

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-01-07 19:47:23 -08:00
Jonathan Kelley bb3fd38231 feat: document and re-export dioxus-cli-config (#3515)
* feat: document and re-export dioxus-cli-config
2025-01-07 15:39:14 -08:00
Jonathan Kelley 040dc54200 add helpful message for obscure cargo failures (#3380) 2024-12-17 15:14:28 -08:00
Evan Almloff 38cb2759e8 Fix enable_out_of_order_streaming doc example and manganis macro remote example (#3317) 2024-12-09 11:58:10 -08:00
Jonathan Kelley 66a50240bc Update all docs links to 0.6, release 0.6 (#3225)
* update doc links to 0.6
* add new splash pages for crates
* update keyword features
* remove some unnecessary links
2024-12-06 19:15:15 -08:00
Jonathan Kelley 7d490dc3bd feat: integrate dioxus-logger inline (#3302)
* feat: integrate dioxus-logger inline

* remove log/simple logger references

* fix: add dioxus-data-id-0 to root elements to not emit errors internally

* drop config.toml and use cargo.toml profiles instead

* make clippy happy with the unit value lint

* feat: better presentation for logging
2024-12-06 16:27:05 -08:00
Evan Almloff 29a7325bb7 Expose streaming options to choose between full prerendering and out of order streaming (#3288)
* expose streaming options to choose between full prerendering and out of order streaming

* add examples to streaming_mode
2024-12-04 13:25:08 -08:00
Evan Almloff 9dc567255a Fix fullstack axum integration docs (#3263)
* Fix broken fullstack doc tests

* include all features in doc test

* fix clippy
2024-12-02 11:35:13 -08:00
Evan Almloff 3d62fbf021 Fix base path on web and fullstack (#3247)
* Create a crate for constant serialization of config structs for manganis

* use SerializeConst for the image asset builder

* switch to a declarative macro for assets

* clean up asset macro a bit

* add serializable options for each asset type

* serialize const vec

* Add unique path formatting

* implement the new manganis macro

* optimize assets in the CLI

* Fix clippy

* Fix assets with dioxus formattable

* reduce fuzzing test limits

* use the new syntax in examples

* fix formatting

* Final doc and test pass on const-serialize

* fix avif support

* Fix manganis doc tests

* cache asset optimization

* Split out asset and bundled asset

* make hash pointer width independent

* remove const serialize cargo lock

* Fix manganis macro docs

* all tests passing

* add constvec::is_empty method to fix clippy lint

* remove nasm feature

* simplify test_rsplit_once test so typos passes

* fix range syntax for stable

* revert example change from clippy fix

* remove dioxus-static-site-generation workspace dependency

* always accept unix paths

* fix windows path seperator

* fix folder asset hash

* Optimize assets in a blocking task

* Fix asset options docs

* Document Asset and BundledAsset

* move manganis back into it's own folder

* simplify the linker macro a bit

* add more docs to AssetParser expansion

* fix manganis core doc test

* add image format helpers

* Fill in new cargo.tomls

* fix folders with explicit options

* Split by  both unix and windows path separators and take the smallest one

* fix string length

* Fix base path on web and fullstack

* Fix assets with base path

* fix fullstack base route with trailing slash

* fix clippy
2024-11-27 10:40:55 +03:00
Jonathan Kelley 992c2b0b9c feat: add keep-symbols flag, change ssg format to Vec<String> (#3217) 2024-11-15 02:06:01 -05:00
Jonathan Kelley ac3e33af46 cli json output, dx bundle fix, dx serve --platform android, race condition, drop ssg platform (#3186)
* clean up logging to avoid random extra trace

* fix race condition with updates

* properly wire up verbose

* fix bundling (macos) and logging

* Add structured output

* clean up clap names

* extract out wire format

* switch structured key to json

* fix random println, fallback to `dioxus/platform`

* clean up logging for run/build

* clean up logging around project

* remove manual exits

* fix tokio runtime for mobile

* rework dog app

* rip out ssg

* Switch dioxus/axum to dioxus/server

* add android template inline

* pre restructure for bundle prep

* add the whole res directory

* Better theme for the app

* remove mobile demo now that most apps work natively

* self-referential android

* only use deep linking for assets

* fix imports for android

* clippy, fixup ios and android

* I'm not boxing compiler message you can't make me

* fix clippy on unix
2024-11-12 09:01:01 -05:00
Evan Almloff 416811ba3a Fix providing context to server functions (#3174)
* Fix providing context to server functions

* Fix fullstack context test
2024-11-06 13:30:41 -05:00
Evan Almloff bb0de9a55a Fix isg streaming (#3156) 2024-11-01 13:01:04 -07:00
Evan Almloff 412f0b5c44 Fix the current route in ssr fullstack rendering (#3153) 2024-11-01 11:30:52 -07:00
Jonathan Kelley 7ec3453ca3 Fix bundling/path errors, sidecar support, iOS/Android simulator support, asset hotreload fixes, serverfn hotrelad, native tailwind support (#2779)
* wip: fix manganis import path
* upgrade tauri bundler, convert todo!() to unimplemented!()
* feat: mobile hotreloading + ios asset configuration
* remove oid demo and its associated env vars
* nuke all the things that cause cache thrashing
* swap to Asset type
* add some more logs
* display impl for attrvalue
* dont panic on collect failure
* cut down web deps to 150
* clean up deps in a lot of places, simplify build scripts
* clean up asset resolution and cli-dev profile
* wire up absolute paths for manganis asset in a particular mode
* move document related things around to shorten compile times
* move most things to `document::Item` and then decompose the cli-config
* switch link to stylesheet for clarity in examples
* move manganis workspace example to examples folder
* decompose manganis-cli-support
* dont need mobile demo anymore
* remove gloo dialogs
* html doesnt need document
* rename hotreload to devtools
* really clean up the html crate
* fix weird rsx spacing
* clean up desktop to use callback
* clean up document a bit
* re-wire up devsocket
* fix utf css
* yeeeet that js out of here
* synthetic web system works
* web crate almost done being cleaned up
* desktop mostly cleaned up too
* clean up cli a bit
* more cli cleanup
* cli builds again
* clean up cli, inline structs, cut down number of unique types where possible
* hotreload works again for desktop and this time, mobile too
* cfg out tungstenite
* devserver err
* more refactor to cli builder
* switch to unbounded_send
* new structure is much cleaner
* add http serve subcommand
* bundled hotreload
* kick stylsheets
* clean up a bit more, split up eventloop
* amazingly serve seems done
* change from pub to pub(crate) in cli
* remove tools
* bit more polish to cli
* fix issue with join
* gracefully handle fullstack without a server
* fullstack mobile demo
* fix launch function, move projects into example-projects folder
* hoist examples
* add "run" command
* clean up launch
* remove old manual websocket receiver
* doctor command
* allow desktop to scroll
* cut apart router crate
* dont put launch in prelude
* use dioxus::launch where possible
* rename rsx, cut out hotreload tests
* remove liveview project
* bump native
* fix compile for renderers
* move sync event response out of interpreter
* move render in serve
* rollback settings change
* cli compiles, huzzah!
* change uris for asset
* fix asset
* new tui screen
* new cargo-like tui works
* very very verty close
* it works! very small bug with incorrect grapheme calc
* Clean up devserver a bit
* status sytem
* tidy up debug filters
* clean up logging situation
* Fix a number of bugs with log printing
* new printing system is more reliable
* wire up more stuff
* things working but fullstack is having issues
* fullstack works again!
* hotreloading bundled assets works again
* bundled hotreload and beginnings of macos bundling
* Hotreload desktop
* combined server builds
* add build handle
* fix fullstack assets
* make open async, add some hooks for ios
* migrate filemap to runner
* wip global crate system
* fixup bundles + organize asset
* fix asset location bug
* all the bundled reloading!
* open ios simulator!
* full hotreload support for mobile + serverfn
* basic cleanups
* clean up dx
* Move filemap
* fix cutting of newlines
* assets workibg, some android
* hoist wry/tao
* use sync locks and headers to fix issues with android
* desktop -> mac/win/linux with alias
* better logging
* feat: workspace (entire computer!) hotreload
* should rebuild toggle, ios simulator bootup
* proper mobile support in launch
* more robust handling of assets
* fix cargo
* bring back some of tauri bundle
* make warnings go away, clippy happy on cli
* some final clippy cleanups
* fmt
* move manganis to its own folder
* upgrade bundle to stable
* drastically slim down manganis, prepping for merge
* typos, failing test, docsrs config
* remove static gen test
* nix static gen test
* we use --platform web instead of --platform fullstack now
* only bind dev urls in desktop/mobile
* install gtk
* nix static gen
* split build dir by app name
2024-10-25 17:23:45 -07:00
Chung 3f8c32d1ff fix fullstack doc (#3071) 2024-10-20 15:32:54 -04:00
Evan AlmloffandJonathan Kelley 519ec9d294 Move the document trait into a separate crate (#3035)
* add a default head method through eval
* remove the old document trait
* implement document for each platform
* pull out document into a dedicated crate to cut down on shared dependencies
---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-10-14 10:33:37 -07:00
Evan AlmloffandJonathan Kelley 20d146d9bd Simplify the launch builder (#2967)
* improve documentation for the fullstack server context

* Add a section about axum integration to the crate root docs

* make serve_dioxus_application accept the cfg builder directly

* remove unused server_fn module

* improve fullstack config docs

* improve documentation for the server function macro

* fix axum router extension link

* Fix doc tests

* Fix launch builder

* Simplify the launch builder

* don't re-export launch in the prelude

* refactor fullstack launch

* Fix fullstack launch builder

* Update static generation with the new builder api

* fix some formatting/overly broad launch replacements

* fix custom menu example

* fix fullstack/static generation examples

* Fix static generation launch

* A few small formatting fixes

* Fix a few doc tests

* implement LaunchConfig for serve configs

* fix fullstack launch with separate web and server launch methods

* fix check with all features

* dont expose inner core module

* clippy and check

* fix readme

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-10-10 16:00:58 -07:00
Evan Almloff 6a0c1c392b Improve documentation for the fullstack crate (#2952)
* improve documentation for the fullstack server context

* Add a section about axum integration to the crate root docs

* make serve_dioxus_application accept the cfg builder directly

* remove unused server_fn module

* improve fullstack config docs

* improve documentation for the server function macro

* fix axum router extension link

* Fix doc tests

* Fix launch builder

* Remove redundant server_only inside server function

* Fix isrg config path
2024-10-10 13:40:11 -07:00
Evan Almloff 95976d9a17 Extend head components with global attributes (#2888)
* Fix hot reloading components with keys

* include component formatted segment keys, but not dynamic component value

* extend each head component with the corresponding element

* Allow spreading custom attributes into components

* Fix component_literal_dyn_idx index

* add a new test for hot reloading components with keys

* FIx script without body warning and rendering styles with a href set

* fix clippy
2024-10-01 10:24:22 -05:00
Jonathan Kelley 3fb1f739d1 Simplify cli-config, hotreload -> devtools (drop to 0 deps, fast compile times) (#2975)
* simplify cli-config crate
* clean up configs
* add devtools crate, update cargo imports
* fix serve addr, fix websocket proxy issue
* add comment about opt profiles
* rename hot-reload to devtools
2024-09-17 17:18:23 -07:00
Jonathan Kelley 143ad749ea Split out isrg from ssr and reorient build graph to make interpreter build 2x faster (#2969)
* split out isrg and core-types to speed up interpreter build
2024-09-16 16:49:06 -07:00
Jonathan KelleyandEvan Almloff 983fcfc616 Chore: hoist example projects for discoverability (#2959)
* hoist example projects, remove oidc

* move over example projects from the separate repo

* Update ecommerce site to the latest version of dioxus

* update wifi scanner to 0.5

* drop the chatbot example; might be restored in a separate PR

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2024-09-16 09:11:33 -05:00
Jonathan Kelley c7124e41fb Add space between rsx and exclamation point (#2956) 2024-09-13 08:31:39 -05:00
Chung 9bf94a1636 remove unused logic in fullstack launch (#2949) 2024-09-11 07:32:46 -05:00
Evan Almloff 7bb53fe835 Parse trailing route slash (#2896)
* Parse trailing route slash

* Fix typo
2024-09-07 13:34:57 -05:00
Evan Almloff 5a7a91323a Make desktop fullstack work with the CLI (#2862)
* Make desktop fullstack work with the CLI
* Simplify desktop fullstack example
* move the profiles to the workspace
2024-08-20 14:57:51 -07:00
Jonathan KelleyandEvan Almloff 0de3bf7aeb Fix nested rsx expansion by not using template titles (#2799)
* Fix nested rsx expansion by not using template titles

* fix writers with nameless templates

* fix clippy

* dont commit vscode fix

* fix release mode, pull out __template_name

* fix axum_desktop

* Fix core tests

* Make most fields of HotReloadedTemplate public for testing

* wip: formatting, compare all diff cases

* slightly smarter diffing for dynamic nodes

* add a comment about generic node diffing

* clean up mutations a bit

* fix load template

* simplify maybe_rebuild

* Restore write mutations flag in web

* write_mutations -> skip_mutations

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2024-08-13 01:59:04 +00:00
Evan Almloff eeccb741d3 Re-export the axum feature flag under "server" (#2786)
* re-export the axum feature flag under "server"
* remove the axum prefix from all the fullstack examples
2024-08-06 21:35:04 +00:00
Evan Almloff b0a2e2418c Bubble errors from the server to the client on suspense boundaries (#2772)
* Bubble errors from the server to the client on suspense boundaries

* make resolving suspense boundaries O(n)
2024-08-02 19:01:55 -07:00
Miles Murgaw f42ca65931 Fix Links & Add Link Checker (#2769)
* feat: link checker
2024-08-02 10:46:18 -07:00
Evan Almloff e5e578d27b Add liveview support to the CLI and make fullstack runnable from dist (#2759)
* add liveview cli support
* Fix TUI fullstack deadlock
* look for fullstack assets in the public directory
* Fix fullstack with the CLI
* Fix static generation server
2024-08-01 17:46:35 -07:00
Jonathan Kelley c5fb69f9f1 release: 0.6.0-alpha.1 (improve docs.rs for fullstack, dioxus) (#2760) 2024-07-31 21:43:13 -07:00
Jonathan Kelley 0cbcef735f Pre-release 0.6.0-alpha.0 (#2755)
* CI: add docsrs to ci

* add env vars

* no need for tokio things

* whoops, wrong rust nightly

* add swc

* bump crate versions to 0.6.0-alpha.0

* hoist up warnings and shuffle cargo.toml

* update cargos and disable warnings from ci

* attempt fix of aws

* attempt disabling aws_lc_sys globally

* pull in lc-sys

* add fips feature to fix docs

* turn on features for aws-lc-sys on cargo-doc-all

* pass along more args

* fix cfg docs

* fix: flakey gen box test

* fix: doc_cfg in static gen

* dont include readme

* fix error on static gen

* remove random line

* temporarily disable warnings

* simplify axum desktop so it doesnt count as a lib

* fix binstall link

* bump locks

* lock fixes

* revert axum desktop

* dont publish some crates
2024-07-31 22:37:39 -05:00
Evan AlmloffandJonathan Kelley c6a2e5b6c8 Use head elements and new manganis syntax in examples (#2688)
* use head elements and new manganis syntax in examples
* only enable desktop workspace example scraping during a dioxus release

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-07-25 21:58:00 +00:00
Evan Almloff bd484842bd Fix playwright tests (#2695) 2024-07-24 12:48:30 -07:00
Tristan F.andJonathan Kelley 9167cd9dec fix most typos, add crate-ci/typos to CI (#2653)
* fix most typos, add crate-ci/typos to CI

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-07-23 17:49:33 -07:00
Jonathan Kelley 8b5ad5d925 Fix some CI (windows + nasm, core-macro error) (#2676)
* Moves index.html creation until after wasm creation so the webserver doesn't prematurely serve the page
* sets up nasm for windows builds (to be superseded by Remove Dioxus CLI NASM dependency #2666 #2682)
* puts magnanis-cli-support in a blocking task to prevent threadlocking during sequential builds
* changes order of client/server builds such that the client is built before the server so the webserver doesn't prematurely serve invalid client code
* declobbers "serve" such that each project gets a different dir in the target folder
* uses nest_service instead of fallback so the router doesn't respond with fallback codes
* reincorporates doge's fix from Fix hot-reloading on Windows #2544
2024-07-23 09:58:13 -07:00
Evan Almloff ba64ee04c2 fix fullstack with the server feature enabled but the axum feature disabled 2024-07-18 11:47:45 -07:00
Evan Almloff e794be5d78 Improve warnings when trying to update outside of pending suspense boundaries on the server (#2575)
* Improve warnings when trying to update outside of pending suspense boundaries on the server

* remove suspense resolve log
2024-07-17 19:32:33 -07:00
88af3e7eff Hotreloading of for/if/body, formatted strings, literals, component props, nested rsx, light CLI rewrite, cli TUI (#2258)
Hotreload the contents of for loops, if chains, component bodies, props, attributes, and any literals discovered in rsx!
Add a TUI renderer to the CLI.
Improve the CLI build system to be async and parallel.
Refactor RSX to allow partial expansion of expressions.
Merge autofmt implementations for consistency.
Merge the representation of elements and components under the hood.
Add a diagnostics system for rsx for improved error messages.
Drop interprocess and move to websockets for communication between the CLI and the server.
Assign IDs to nodes and attributes in a stable way to be used in non compiler contexts.
Add hotreloading to any body of component/for loop/if chain/etc.

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
Co-authored-by: Liam Mitchell <liamkarlmitchell@gmail.com>
2024-07-17 19:11:18 -07:00