diff --git a/.github/workflows/cli_release.yml b/.github/workflows/cli_release.yml
index c6c2b81e8..4cd33f47e 100644
--- a/.github/workflows/cli_release.yml
+++ b/.github/workflows/cli_release.yml
@@ -29,7 +29,7 @@ jobs:
toolchain: "1.70.0",
}
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@master
with:
diff --git a/.github/workflows/docs stable.yml b/.github/workflows/docs stable.yml
index 069d4308a..642216f0f 100644
--- a/.github/workflows/docs stable.yml
+++ b/.github/workflows/docs stable.yml
@@ -23,7 +23,7 @@ jobs:
- name: Setup mdBook
run: |
cargo install mdbook --git https://github.com/Demonthos/mdBook.git --branch master
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Build
run: cd docs &&
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 3a452e770..107ad9638 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -28,7 +28,7 @@ jobs:
- name: Setup mdBook
run: |
cargo install mdbook --git https://github.com/Demonthos/mdBook.git --branch master
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Build
run: cd docs &&
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 04f367b8e..037525557 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -41,7 +41,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: sudo apt-get update
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- run: cargo check --all --examples --tests
test:
@@ -56,7 +56,7 @@ jobs:
- uses: davidB/rust-cargo-make@v1
- uses: browser-actions/setup-firefox@latest
- uses: jetli/wasm-pack-action@v0.4.0
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- run: cargo make tests
fmt:
@@ -67,7 +67,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: rustup component add rustfmt
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- run: cargo fmt --all -- --check
clippy:
@@ -80,7 +80,7 @@ jobs:
- run: sudo apt-get update
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev
- run: rustup component add clippy
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- run: cargo clippy --workspace --examples --tests -- -D warnings
matrix_test:
@@ -124,7 +124,7 @@ jobs:
}
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: install stable
uses: dtolnay/rust-toolchain@master
@@ -154,7 +154,7 @@ jobs:
# options: --security-opt seccomp=unconfined
# steps:
# - name: Checkout repository
- # uses: actions/checkout@v3
+ # uses: actions/checkout@v4
# - name: Generate code coverage
# run: |
# apt-get update &&\
diff --git a/.github/workflows/miri.yml b/.github/workflows/miri.yml
index b1d772512..4a467b9b2 100644
--- a/.github/workflows/miri.yml
+++ b/.github/workflows/miri.yml
@@ -69,7 +69,7 @@ jobs:
if: runner.os == 'Linux'
run: echo "MIRIFLAGS=-Zmiri-tag-gc=1" >> $GITHUB_ENV
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@master
with:
diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml
index dba32d257..500d41564 100644
--- a/.github/workflows/playwright.yml
+++ b/.github/workflows/playwright.yml
@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
# Do our best to cache the toolchain and node install steps
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
diff --git a/Cargo.toml b/Cargo.toml
index 54c54ebf1..6378d9983 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -82,7 +82,8 @@ generational-box = { path = "packages/generational-box" }
dioxus-hot-reload = { path = "packages/hot-reload", version = "0.4.0" }
dioxus-fullstack = { path = "packages/fullstack", version = "0.4.1" }
dioxus_server_macro = { path = "packages/server-macro", version = "0.4.1" }
-log = "0.4.19"
+tracing = "0.1.37"
+tracing-futures = "0.2.5"
tokio = "1.28"
slab = "0.4.2"
futures-channel = "0.3.21"
diff --git a/docs/guide/src/en/getting_started/web.md b/docs/guide/src/en/getting_started/web.md
index 48818bf8f..07139cce6 100644
--- a/docs/guide/src/en/getting_started/web.md
+++ b/docs/guide/src/en/getting_started/web.md
@@ -25,7 +25,7 @@ The Web is the best-supported target platform for Dioxus.
To develop your Dioxus app for the web, you'll need a tool to build and serve your assets. We recommend using [dioxus-cli](https://github.com/DioxusLabs/dioxus/tree/master/packages/cli) which includes a build system, Wasm optimization, a dev server, and support hot reloading:
```shell
-cargo install dioxus-cli
+cargo install dioxus-cli --locked
```
Make sure the `wasm32-unknown-unknown` target for rust is installed:
diff --git a/examples/PWA-example/README.md b/examples/PWA-example/README.md
index d42a61311..d501df212 100644
--- a/examples/PWA-example/README.md
+++ b/examples/PWA-example/README.md
@@ -7,12 +7,13 @@ It is also very much usable as a template for your projects, if you're aiming to
## Try the example
-Make sure you have Dioxus CLI installed (if you're unsure, run `cargo install dioxus-cli`).
+Make sure you have Dioxus CLI installed (if you're unsure, run `cargo install dioxus-cli --locked`).
You can run `dx serve` in this directory to start the web server locally, or run
`dx build --release` to build the project so you can deploy it on a separate web-server.
## Project Structure
+
```
├── Cargo.toml
├── Dioxus.toml
@@ -33,12 +34,12 @@ You can run `dx serve` in this directory to start the web server locally, or run
If you're just getting started with PWAs, here are some useful resources:
-* [PWABuilder docs](https://docs.pwabuilder.com/#/)
-* [MDN article on PWAs](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps)
+- [PWABuilder docs](https://docs.pwabuilder.com/#/)
+- [MDN article on PWAs](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps)
For service worker scripting (in JavaScript):
-* [Service worker guide from PWABuilder](https://docs.pwabuilder.com/#/home/sw-intro)
-* [Service worker examples, also from PWABuilder](https://github.com/pwa-builder/pwabuilder-serviceworkers)
+- [Service worker guide from PWABuilder](https://docs.pwabuilder.com/#/home/sw-intro)
+- [Service worker examples, also from PWABuilder](https://github.com/pwa-builder/pwabuilder-serviceworkers)
If you want to stay as close to 100% Rust as possible, you can try using [wasi-worker](https://github.com/dunnock/wasi-worker) to replace the JS service worker file. The JSON manifest will still be required though.
diff --git a/packages/autofmt/src/collect_macros.rs b/packages/autofmt/src/collect_macros.rs
index 10e0d185c..841af1316 100644
--- a/packages/autofmt/src/collect_macros.rs
+++ b/packages/autofmt/src/collect_macros.rs
@@ -17,7 +17,15 @@ struct MacroCollector<'a, 'b> {
impl<'a, 'b> Visit<'b> for MacroCollector<'a, 'b> {
fn visit_macro(&mut self, i: &'b Macro) {
- self.macros.push(i);
+ if let Some("rsx" | "render") = i
+ .path
+ .segments
+ .last()
+ .map(|i| i.ident.to_string())
+ .as_deref()
+ {
+ self.macros.push(i)
+ }
}
}
diff --git a/packages/cli/Cargo.toml b/packages/cli/Cargo.toml
index a37798eee..f325430aa 100644
--- a/packages/cli/Cargo.toml
+++ b/packages/cli/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "dioxus-cli"
-version = { workspace = true }
+version = "0.4.1"
authors = ["Jonathan Kelley"]
edition = "2021"
description = "CLI tool for developing, testing, and publishing Dioxus apps"
@@ -36,7 +36,7 @@ chrono = "0.4.19"
anyhow = "1.0.53"
hyper = "0.14.17"
hyper-rustls = "0.23.2"
-indicatif = "0.17.0-rc.11"
+indicatif = "0.17.5"
subprocess = "0.2.9"
axum = { version = "0.5.1", features = ["ws", "headers"] }
@@ -75,11 +75,10 @@ gitignore = "1.0.7"
open = "4.1.0"
cargo-generate = "0.18"
toml_edit = "0.19.11"
-# dioxus-rsx = "0.0.1"
# bundling
-tauri-bundler = { version = "1.2", features = ["native-tls-vendored"] }
-tauri-utils = "1.3"
+tauri-bundler = { version = "=1.3.0", features = ["native-tls-vendored"] }
+tauri-utils = "=1.4.*"
dioxus-autofmt = { workspace = true }
dioxus-check = { workspace = true }
diff --git a/packages/cli/Dioxus.toml b/packages/cli/Dioxus.toml
index 792a15165..323f17da2 100644
--- a/packages/cli/Dioxus.toml
+++ b/packages/cli/Dioxus.toml
@@ -1,29 +1,31 @@
[application]
-# dioxus project name
-name = "dioxus-cli"
+# App name
+name = "project_name"
-# default platfrom
-# you can also use `dx serve/build --platform XXX` to use other platform
-# value: web | desktop
-default_platform = "desktop"
+# The Dioxus platform to default to
+default_platform = "web"
-# Web `build` & `serve` dist path
+# `build` & `serve` output path
out_dir = "dist"
-# resource (static) file folder
+# The static resource path
asset_dir = "public"
[web.app]
# HTML title tag content
-title = "dioxus | ⛺"
+title = "project_name"
[web.watcher]
-watch_path = ["src"]
+# When watcher is triggered, regenerate the `index.html`
+reload_html = true
-# include `assets` in web platform
+# Which files or dirs will be monitored
+watch_path = ["src", "public"]
+
+# Include style or script assets
[web.resource]
# CSS style file
@@ -34,12 +36,13 @@ script = []
[web.resource.dev]
-# Javascript code file
-# serve: [dev-server] only
+# Same as [web.resource], but for development servers
+
+# CSS style file
+style = []
+
+# JavaScript files
script = []
-[application.tools]
-
-# use binaryen.wasm-opt for output Wasm file
-# binaryen just will trigger in `web` platform
-binaryen = { wasm_opt = true }
+[[web.proxy]]
+backend = "http://localhost:8000/api/"
\ No newline at end of file
diff --git a/packages/cli/README.md b/packages/cli/README.md
index 3167a6746..d868b1c9d 100644
--- a/packages/cli/README.md
+++ b/packages/cli/README.md
@@ -1,43 +1,71 @@
-
-
📦✨ Dioxus CLI
+
+
📦✨ Dioxus CLI
Tooling to supercharge Dioxus projects
-**dioxus-cli** (inspired by wasm-pack and webpack) is a tool for getting Dioxus projects up and running.
-It handles all build, bundling, development and publishing to simplify web development.
+The **dioxus-cli** (inspired by wasm-pack and webpack) is a tool for getting Dioxus projects up and running.
+It handles all building, bundling, development and publishing to simplify development.
## Installation
-### Install stable version
+### Install the stable version (recommended)
+
```
-cargo install dioxus-cli
+cargo install dioxus-cli --locked
```
-### Install from git repository
+
+### Install the latest development build through git
+
+To get the latest bug fixes and features, you can install the development version from git.
+However, this is not fully tested.
+That means you're probably going to have more bugs despite having the latest bug fixes.
+
```
cargo install --git https://github.com/DioxusLabs/dioxus dioxus-cli
```
+
+This will download the CLI from the master branch,
+and install it in Cargo's global binary directory (`~/.cargo/bin/` by default).
+
### Install from local folder
+
```
cargo install --path . --debug
```
+## Get started
-## Get Started
-
-Use `dx create project-name` to initialize a new Dioxus project.
-
+Use `dx create project-name` to initialize a new Dioxus project.
It will be cloned from the [dioxus-template](https://github.com/DioxusLabs/dioxus-template) repository.
-
-
Alternatively, you can specify the template path:
```
dx create hello --template gh:dioxuslabs/dioxus-template
```
-## Dioxus Config File
+Run `dx --help` for a list of all the available commands.
+Furthermore, you can run `dx --help` to get help with a specific command.
-Dioxus CLI will use `Dioxus.toml` file to Identify some project info and switch some cli feature.
+## Dioxus config file
-You can get more configure information from [Dioxus CLI Document](https://dioxuslabs.com/cli/configure.html).
+You can use the `Dioxus.toml` file for further configuration.
+Some fields are mandatory, but the CLI tool will tell you which ones are missing.
+You can create a `Dioxus.toml` with all fields already set using `dx config init project-name`,
+or you can use this bare-bones template (only mandatory fields) to get started:
+
+```toml
+[application]
+name = "project-name"
+# Currently supported platforms: web, desktop
+default_platform = "web"
+
+[web.app]
+title = "Hello"
+
+[web.watcher]
+
+[web.resource.dev]
+```
+
+The full anatomy of `Dioxus.toml` is shown on the [Dioxus website](https://dioxuslabs.com/learn/0.4/CLI/configure).
diff --git a/packages/cli/docs/book.toml b/packages/cli/docs/book.toml
index c5c216fe4..a1e57f634 100644
--- a/packages/cli/docs/book.toml
+++ b/packages/cli/docs/book.toml
@@ -3,4 +3,4 @@ authors = ["YuKun Liu"]
language = "en"
multilingual = false
src = "src"
-title = "Dioxus Cli"
+title = "Dioxus CLI"
diff --git a/packages/cli/docs/src/SUMMARY.md b/packages/cli/docs/src/SUMMARY.md
index b5e3b91ae..98a66ae21 100644
--- a/packages/cli/docs/src/SUMMARY.md
+++ b/packages/cli/docs/src/SUMMARY.md
@@ -2,17 +2,12 @@
- [Introduction](./introduction.md)
- [Installation](./installation.md)
-- [Create a Project](./creating.md)
-- [Configure Project](./configure.md)
-- [Commands](./cmd/README.md)
- - [Build](./cmd/build.md)
- - [Serve](./cmd/serve.md)
- - [Clean](./cmd/clean.md)
- - [Translate](./cmd/translate.md)
-- [Plugin Development](./plugin/README.md)
- - [API.Log](./plugin/interface/log.md)
- - [API.Command](./plugin/interface/command.md)
- - [API.OS](./plugin/interface/os.md)
- - [API.Directories](./plugin/interface/dirs.md)
- - [API.Network](./plugin/interface/network.md)
- - [API.Path](./plugin/interface/path.md)
\ No newline at end of file
+- [Create a project](./creating.md)
+- [Configure a project](./configure.md)
+- [Plugin development](./plugin/README.md)
+ - [API.Log](plugin/interface/log.md)
+ - [API.Command](plugin/interface/command.md)
+ - [API.OS](plugin/interface/os.md)
+ - [API.Directories](plugin/interface/dirs.md)
+ - [API.Network](plugin/interface/network.md)
+ - [API.Path](plugin/interface/path.md)
\ No newline at end of file
diff --git a/packages/cli/docs/src/cmd/README.md b/packages/cli/docs/src/cmd/README.md
deleted file mode 100644
index 735794635..000000000
--- a/packages/cli/docs/src/cmd/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Commands
-
-In this chapter we will introduce all `dioxus-cli` commands.
-
-> You can also use `dx --help` to get cli help info.
-
-```
-Build, Bundle & Ship Dioxus Apps
-
-Usage: dx [OPTIONS]
-
-Commands:
- build Build the Rust WASM app and all of its assets
- translate Translate some source file into Dioxus code
- serve Build, watch & serve the Rust WASM app and all of its assets
- create Init a new project for Dioxus
- clean Clean output artifacts
- bundle Bundle the Rust desktop app and all of its assets
- version Print the version of this extension
- fmt Format some rsx
- check Check the Rust files in the project for issues
- config Dioxus config file controls
- help Print this message or the help of the given subcommand(s)
-
-Options:
- -v Enable verbose logging
- --bin Specify bin target
- -h, --help Print help
- -V, --version Print version
-```
diff --git a/packages/cli/docs/src/cmd/build.md b/packages/cli/docs/src/cmd/build.md
deleted file mode 100644
index 6109d14f1..000000000
--- a/packages/cli/docs/src/cmd/build.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# Build
-
-The `dx build` command can help you `pack & build` a dioxus project.
-
-```
-dioxus-build
-Build the Rust WASM app and all of its assets
-
-USAGE:
- dx build [OPTIONS]
-
-OPTIONS:
- --example [default: ""]
- --platform [default: "default_platform"]
- --release [default: false]
- --bin [default: None]
-```
-
-You can use this command to build a project:
-
-```
-dx build --release
-```
-
-## Target platform
-
-Use the `platform` option to choose your target platform:
-
-```
-# for desktop project
-dx build --platform desktop
-```
-
-`platform` currently only supports `desktop` & `web`.
-
-```
-# for web project
-dx build --platform web
-```
-
-## Specify workspace bin
-
-You can add the `--bin` option to select which crate you want Dioxus to build:
-
-```
-dx build --bin app
-```
-
-## Build Example
-
-You can use the `example` option to select a example to build:
-
-```
-# build the `test` example
-dx build --exmaple test
-```
diff --git a/packages/cli/docs/src/cmd/clean.md b/packages/cli/docs/src/cmd/clean.md
deleted file mode 100644
index ef938d245..000000000
--- a/packages/cli/docs/src/cmd/clean.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# Clean
-
-`dx clean` will clear the build artifacts (the out_dir and the cargo cache)
-
-```
-dioxus-clean
-Clean build artifacts
-
-USAGE:
- dx clean [OPTIONS]
-
-OPTIONS:
- --bin [default: None]
-```
-
-# Example
-
-```
-dx clean
-```
-
-# Specify workspace bin
-You can add the `--bin` option to select which crate you want Dioxus to clean artifacts from:
-
-```
-dx clean --bin app
-```
diff --git a/packages/cli/docs/src/cmd/serve.md b/packages/cli/docs/src/cmd/serve.md
deleted file mode 100644
index d8b4e0d42..000000000
--- a/packages/cli/docs/src/cmd/serve.md
+++ /dev/null
@@ -1,70 +0,0 @@
-# Serve
-
-The `dx serve` can start a dev server with hot-reloading
-
-```
-dioxus-serve
-Build, watch & serve the Rust WASM app and all of its assets
-
-USAGE:
- dx serve [OPTIONS]
-
-OPTIONS:
- --example [default: ""]
- --platform [default: "default_platform"]
- --release [default: false]
- --hot-reload [default: false]
- --bin [default: None]
-```
-
-You can use this command to build project and start a dev server:
-
-```
-dx serve
-```
-
-## Serve Example
-
-You can use the `example` option to serve a example:
-
-```
-# serve the `test` example
-dx serve --exmaple test
-```
-
-## Specify workspace bin
-
-You can add the `--bin` option to select which crate you want Dioxus to build and serve:
-
-```
-dx serve --bin app
-```
-
-## Open Browser
-
-You can add the `--open` option to open system default browser when server startup:
-
-```
-dx serve --open
-```
-
-## RSX Hot Reloading
-
-You can add the `--hot-reload` flag to enable [rsx hot reloading](https://dioxuslabs.com/docs/0.3/guide/en/getting_started/hot_reload.html). This will allow you to reload some rsx changes without a full recompile:
-
-```
-dx serve --open
-```
-
-## Cross Origin Policy
-
-You can add the `cross-origin-policy` option to change cross-origin header to:
-
-```
- Cross-Origin-Opener-Policy: same-origin
- Cross-Origin-Embedder-Policy: require-corp
-```
-
-```
-dx serve --corss-origin-policy
-```
diff --git a/packages/cli/docs/src/cmd/translate.md b/packages/cli/docs/src/cmd/translate.md
deleted file mode 100644
index b03b4422c..000000000
--- a/packages/cli/docs/src/cmd/translate.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# Translate
-
-`dx translate` can translate some `html` file into a Dioxus compoent
-
-```
-dioxus-translate
-Translate some source file into a Dioxus component
-
-USAGE:
- dx translate [OPTIONS] [OUTPUT]
-
-ARGS:
-