mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
feat: upgrade handlebars to 5.0 (#8615)
This commit is contained in:
@@ -27,7 +27,7 @@ serde = { version = "1.0", features = [ "derive" ] }
|
||||
strsim = "0.10.0"
|
||||
tar = "0.4.40"
|
||||
walkdir = "2"
|
||||
handlebars = "4.5"
|
||||
handlebars = "5.0"
|
||||
tempfile = "3.8.1"
|
||||
log = { version = "0.4.20", features = [ "kv_unstable" ] }
|
||||
dirs-next = "2.0"
|
||||
|
||||
@@ -485,7 +485,7 @@ fn build_nsis_app_installer(
|
||||
}
|
||||
|
||||
fn handlebars_or(
|
||||
h: &handlebars::Helper<'_, '_>,
|
||||
h: &handlebars::Helper<'_>,
|
||||
_: &Handlebars<'_>,
|
||||
_: &handlebars::Context,
|
||||
_: &mut handlebars::RenderContext<'_, '_>,
|
||||
@@ -503,7 +503,7 @@ fn handlebars_or(
|
||||
}
|
||||
|
||||
fn association_description(
|
||||
h: &handlebars::Helper<'_, '_>,
|
||||
h: &handlebars::Helper<'_>,
|
||||
_: &Handlebars<'_>,
|
||||
_: &handlebars::Context,
|
||||
_: &mut handlebars::RenderContext<'_, '_>,
|
||||
|
||||
20
tooling/cli/Cargo.lock
generated
20
tooling/cli/Cargo.lock
generated
@@ -477,7 +477,7 @@ dependencies = [
|
||||
"embed-resource",
|
||||
"english-numbers",
|
||||
"freedesktop_entry_parser",
|
||||
"handlebars",
|
||||
"handlebars 4.5.0",
|
||||
"heck",
|
||||
"home",
|
||||
"ignore",
|
||||
@@ -1745,6 +1745,20 @@ dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "handlebars"
|
||||
version = "5.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94eae21d01d20dabef65d8eda734d83df6e2dea8166788804be9bd6bc92448fa"
|
||||
dependencies = [
|
||||
"log",
|
||||
"pest",
|
||||
"pest_derive",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
@@ -4720,7 +4734,7 @@ dependencies = [
|
||||
"dirs-next",
|
||||
"dunce",
|
||||
"glob",
|
||||
"handlebars",
|
||||
"handlebars 5.0.0",
|
||||
"heck",
|
||||
"hex",
|
||||
"image",
|
||||
@@ -4770,7 +4784,7 @@ dependencies = [
|
||||
"dialoguer",
|
||||
"duct",
|
||||
"env_logger",
|
||||
"handlebars",
|
||||
"handlebars 5.0.0",
|
||||
"heck",
|
||||
"html5ever",
|
||||
"ignore",
|
||||
|
||||
@@ -63,7 +63,7 @@ tauri-utils = { version = "2.0.0-alpha.12", path = "../../core/tauri-utils", fea
|
||||
tauri-utils-v1 = { version = "1", package = "tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] }
|
||||
toml = "0.8"
|
||||
jsonschema = "0.17"
|
||||
handlebars = "4.4"
|
||||
handlebars = "5.0"
|
||||
include_dir = "0.7"
|
||||
minisign = "=0.7.5"
|
||||
base64 = "0.21.5"
|
||||
|
||||
@@ -18,7 +18,9 @@ use cargo_mobile2::{
|
||||
relativize_path,
|
||||
},
|
||||
};
|
||||
use handlebars::{Context, Handlebars, Helper, HelperResult, Output, RenderContext, RenderError};
|
||||
use handlebars::{
|
||||
Context, Handlebars, Helper, HelperResult, Output, RenderContext, RenderError, RenderErrorReason,
|
||||
};
|
||||
|
||||
use std::{
|
||||
env::{current_dir, var, var_os},
|
||||
@@ -299,7 +301,9 @@ fn join(
|
||||
out
|
||||
.write(
|
||||
&get_str_array(helper, |s| s.to_string())
|
||||
.ok_or_else(|| RenderError::new("`join` helper wasn't given an array"))?
|
||||
.ok_or_else(|| {
|
||||
RenderErrorReason::ParamTypeMismatchForName("join", "0".to_owned(), "array".to_owned())
|
||||
})?
|
||||
.join(", "),
|
||||
)
|
||||
.map_err(Into::into)
|
||||
@@ -315,7 +319,13 @@ fn quote_and_join(
|
||||
out
|
||||
.write(
|
||||
&get_str_array(helper, |s| format!("{s:?}"))
|
||||
.ok_or_else(|| RenderError::new("`quote-and-join` helper wasn't given an array"))?
|
||||
.ok_or_else(|| {
|
||||
RenderErrorReason::ParamTypeMismatchForName(
|
||||
"quote-and-join",
|
||||
"0".to_owned(),
|
||||
"array".to_owned(),
|
||||
)
|
||||
})?
|
||||
.join(", "),
|
||||
)
|
||||
.map_err(Into::into)
|
||||
@@ -332,7 +342,11 @@ fn quote_and_join_colon_prefix(
|
||||
.write(
|
||||
&get_str_array(helper, |s| format!("{:?}", format!(":{s}")))
|
||||
.ok_or_else(|| {
|
||||
RenderError::new("`quote-and-join-colon-prefix` helper wasn't given an array")
|
||||
RenderErrorReason::ParamTypeMismatchForName(
|
||||
"quote-and-join-colon-prefix",
|
||||
"0".to_owned(),
|
||||
"array".to_owned(),
|
||||
)
|
||||
})?
|
||||
.join(", "),
|
||||
)
|
||||
@@ -381,12 +395,14 @@ fn app_root(ctx: &Context) -> Result<&str, RenderError> {
|
||||
let app_root = ctx
|
||||
.data()
|
||||
.get("app")
|
||||
.ok_or_else(|| RenderError::new("`app` missing from template data."))?
|
||||
.ok_or_else(|| RenderErrorReason::Other("`app` missing from template data.".to_owned()))?
|
||||
.get("root-dir")
|
||||
.ok_or_else(|| RenderError::new("`app.root-dir` missing from template data."))?;
|
||||
app_root
|
||||
.as_str()
|
||||
.ok_or_else(|| RenderError::new("`app.root-dir` contained invalid UTF-8."))
|
||||
.ok_or_else(|| {
|
||||
RenderErrorReason::Other("`app.root-dir` missing from template data.".to_owned())
|
||||
})?;
|
||||
app_root.as_str().ok_or_else(|| {
|
||||
RenderErrorReason::Other("`app.root-dir` contained invalid UTF-8.".to_owned()).into()
|
||||
})
|
||||
}
|
||||
|
||||
fn prefix_path(
|
||||
@@ -401,8 +417,8 @@ fn prefix_path(
|
||||
util::prefix_path(app_root(ctx)?, get_str(helper))
|
||||
.to_str()
|
||||
.ok_or_else(|| {
|
||||
RenderError::new(
|
||||
"Either the `app.root-dir` or the specified path contained invalid UTF-8.",
|
||||
RenderErrorReason::Other(
|
||||
"Either the `app.root-dir` or the specified path contained invalid UTF-8.".to_owned(),
|
||||
)
|
||||
})?,
|
||||
)
|
||||
@@ -420,12 +436,14 @@ fn unprefix_path(
|
||||
.write(
|
||||
util::unprefix_path(app_root(ctx)?, get_str(helper))
|
||||
.map_err(|_| {
|
||||
RenderError::new("Attempted to unprefix a path that wasn't in the app root dir.")
|
||||
RenderErrorReason::Other(
|
||||
"Attempted to unprefix a path that wasn't in the app root dir.".to_owned(),
|
||||
)
|
||||
})?
|
||||
.to_str()
|
||||
.ok_or_else(|| {
|
||||
RenderError::new(
|
||||
"Either the `app.root-dir` or the specified path contained invalid UTF-8.",
|
||||
RenderErrorReason::Other(
|
||||
"Either the `app.root-dir` or the specified path contained invalid UTF-8.".to_owned(),
|
||||
)
|
||||
})?,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user