Update Dependencies with Breaking Changes (#3204)

* Update axum.

* Update base64.

* Update NPM Dependencies.

* Update Translations.

* Make sure all docusaurus dependencies are with the same version.
This commit is contained in:
Kaede Hoshikawa 2023-04-03 00:16:33 +09:00 committed by GitHub
parent 9d7fafa3ff
commit 36aaecc430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 662 additions and 12692 deletions

28
Cargo.lock generated
View File

@ -83,9 +83,9 @@ dependencies = [
[[package]]
name = "axum"
version = "0.5.17"
version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acee9fd5073ab6b045a275b3e709c163dd36c90685219cb21804a147b58dba43"
checksum = "349f8ccfd9221ee7d1f3d4b33e1f8319b3a81ed8f61f2ea40b37b859794b4491"
dependencies = [
"async-trait",
"axum-core",
@ -101,22 +101,23 @@ dependencies = [
"mime",
"percent-encoding",
"pin-project-lite",
"rustversion",
"serde",
"serde_json",
"serde_path_to_error",
"serde_urlencoded",
"sync_wrapper",
"tokio",
"tower",
"tower-http",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum-core"
version = "0.2.9"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e5939e02c56fecd5c017c37df4238c0a839fa76b7f97acdd7efb804fd181cc"
checksum = "b2f958c80c248b34b9a877a643811be8dbca03ca5ba827f2b63baf3a81e5fc4e"
dependencies = [
"async-trait",
"bytes",
@ -124,6 +125,7 @@ dependencies = [
"http",
"http-body",
"mime",
"rustversion",
"tower-layer",
"tower-service",
]
@ -717,7 +719,7 @@ dependencies = [
name = "file_upload"
version = "0.1.0"
dependencies = [
"base64 0.13.1",
"base64 0.21.0",
"gloo",
"js-sys",
"web-sys",
@ -1653,9 +1655,9 @@ dependencies = [
[[package]]
name = "matchit"
version = "0.5.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb"
checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40"
[[package]]
name = "memchr"
@ -2345,6 +2347,15 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_path_to_error"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7f05c1d5476066defcdfacce1f52fc3cae3af1d3089727100c02ae92e5abbe0"
dependencies = [
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@ -2769,7 +2780,6 @@ dependencies = [
"pin-project-lite",
"tokio",
"tokio-util",
"tower",
"tower-layer",
"tower-service",
]

View File

@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
[dependencies]
js-sys = "0.3"
yew = { path = "../../packages/yew", features = ["csr"] }
base64 = "0.13.0"
base64 = "0.21.0"
gloo = "0.8"
[dependencies.web-sys]

View File

@ -1,7 +1,8 @@
extern crate base64;
use std::collections::HashMap;
use base64::encode;
use base64::engine::general_purpose::STANDARD;
use base64::Engine;
use gloo::file::callbacks::FileReader;
use gloo::file::File;
use web_sys::{DragEvent, Event, FileList, HtmlInputElement};
@ -118,10 +119,10 @@ impl App {
<p class="preview-name">{ format!("{}", file.name) }</p>
<div class="preview-media">
if file.file_type.contains("image") {
<img src={format!("data:{};base64,{}", file.file_type, encode(&file.data))} />
<img src={format!("data:{};base64,{}", file.file_type, STANDARD.encode(&file.data))} />
} else if file.file_type.contains("video") {
<video controls={true}>
<source src={format!("data:{};base64,{}", file.file_type, encode(&file.data))} type={file.file_type.clone()}/>
<source src={format!("data:{};base64,{}", file.file_type, STANDARD.encode(&file.data))} type={file.file_type.clone()}/>
</video>
}
</div>

View File

@ -25,7 +25,7 @@ wasm-logger = "0.2"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.26.0", features = ["full"] }
axum = "0.5"
axum = "0.6"
tower = { version = "0.4", features = ["make"] }
tower-http = { version = "0.3", features = ["fs"] }
env_logger = "0.10"

View File

@ -3,14 +3,14 @@ use std::convert::Infallible;
use std::future::Future;
use std::path::PathBuf;
use axum::body::{Body, StreamBody};
use axum::body::StreamBody;
use axum::error_handling::HandleError;
use axum::extract::Query;
use axum::handler::Handler;
use axum::http::{Request, StatusCode};
use axum::extract::{Query, State};
use axum::handler::HandlerWithoutStateExt;
use axum::http::{StatusCode, Uri};
use axum::response::IntoResponse;
use axum::routing::get;
use axum::{Extension, Router};
use axum::Router;
use clap::Parser;
use function_router::{ServerApp, ServerAppProps};
use futures::stream::{self, StreamExt};
@ -32,11 +32,11 @@ struct Opt {
}
async fn render(
Extension((index_html_before, index_html_after)): Extension<(String, String)>,
url: Request<Body>,
url: Uri,
Query(queries): Query<HashMap<String, String>>,
State((index_html_before, index_html_after)): State<(String, String)>,
) -> impl IntoResponse {
let url = url.uri().to_string();
let url = url.to_string();
let renderer = yew::ServerRenderer::<ServerApp>::with_props(move || ServerAppProps {
url: url.into(),
@ -98,22 +98,17 @@ async fn main() {
)
};
let app = Router::new()
.route("/api/test", get(|| async move { "Hello World" }))
.fallback(HandleError::new(
ServeDir::new(opts.dir)
.append_index_html_on_directories(false)
.fallback(
render
.layer(Extension((
index_html_before.clone(),
index_html_after.clone(),
)))
.into_service()
.map_err(|err| -> std::io::Error { match err {} }),
),
handle_error,
));
let app = Router::new().fallback_service(HandleError::new(
ServeDir::new(opts.dir)
.append_index_html_on_directories(false)
.fallback(
get(render)
.with_state((index_html_before.clone(), index_html_after.clone()))
.into_service()
.map_err(|err| -> std::io::Error { match err {} }),
),
handle_error,
));
println!("You can view the website at: http://localhost:8080/");

View File

@ -5,7 +5,7 @@
},
"theme.ErrorPageContent.tryAgain": {
"message": "Try again",
"description": "The label of the button to try again when the page crashed"
"description": "The label of the button to try again rendering when the React error boundary captures an error"
},
"theme.NotFound.title": {
"message": "ページが見つかりません",

View File

@ -30,5 +30,9 @@
"item.label.Playground": {
"message": "Playground",
"description": "Navbar item with label Playground"
},
"logo.alt": {
"message": "Yew Logo",
"description": "The alt text of navbar logo"
}
}

View File

@ -5,7 +5,7 @@
},
"theme.ErrorPageContent.tryAgain": {
"message": "Try again",
"description": "The label of the button to try again when the page crashed"
"description": "The label of the button to try again rendering when the React error boundary captures an error"
},
"theme.NotFound.title": {
"message": "页面找不到啦",

View File

@ -30,5 +30,9 @@
"item.label.Playground": {
"message": "Playground",
"description": "Navbar item with label Playground"
},
"logo.alt": {
"message": "Yew Logo",
"description": "The alt text of navbar logo"
}
}

View File

@ -5,7 +5,7 @@
},
"theme.ErrorPageContent.tryAgain": {
"message": "Try again",
"description": "The label of the button to try again when the page crashed"
"description": "The label of the button to try again rendering when the React error boundary captures an error"
},
"theme.NotFound.title": {
"message": "Page Not Found",

View File

@ -30,5 +30,9 @@
"item.label.Playground": {
"message": "Playground",
"description": "Navbar item with label Playground"
},
"logo.alt": {
"message": "Yew Logo",
"description": "The alt text of navbar logo"
}
}

13246
website/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -17,12 +17,12 @@
"fmt:write": "prettier --write ."
},
"dependencies": {
"@docusaurus/core": "~2.3.0",
"@docusaurus/core": "~2.4.0",
"@docusaurus/plugin-client-redirects": "~2.4.0",
"@docusaurus/plugin-content-docs": "~2.4.0",
"@docusaurus/plugin-content-pages": "~2.4.0",
"@docusaurus/plugin-google-analytics": "~2.3.0",
"@docusaurus/theme-classic": "^2.3.1",
"@docusaurus/plugin-google-analytics": "~2.4.0",
"@docusaurus/theme-classic": "~2.4.0",
"@easyops-cn/docusaurus-search-local": "^0.32.0",
"@mdx-js/react": "^1.6.22",
"@svgr/webpack": "^6.5.1",
@ -47,7 +47,7 @@
]
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.3.0",
"@docusaurus/module-type-aliases": "~2.4.0",
"@tsconfig/docusaurus": "^1.0.7",
"@types/react": "^17.0.43",
"@types/react-helmet": "^6.1.6",