feat: add keep-symbols flag, change ssg format to Vec<String> (#3217)
This commit is contained in:
1 parent
af53354b28
commit
992c2b0b9c
3 files changed
+17
-8
No files matched your search
@@ -562,8 +562,12 @@ impl AppBundle {
|
|||||||
let input_path = input_path.to_path_buf();
|
let input_path = input_path.to_path_buf();
|
||||||
let bindgen_outdir = bindgen_outdir.to_path_buf();
|
let bindgen_outdir = bindgen_outdir.to_path_buf();
|
||||||
let name = self.build.krate.executable_name().to_string();
|
let name = self.build.krate.executable_name().to_string();
|
||||||
let keep_debug = self.build.krate.config.web.wasm_opt.debug;
|
|
||||||
let reference_types = self.build.krate.config.web.wasm_opt.reference_types;
|
let reference_types = self.build.krate.config.web.wasm_opt.reference_types;
|
||||||
|
let keep_debug =
|
||||||
|
// if we're in debug mode, or we're generating debug symbols, keep debug info
|
||||||
|
(self.build.krate.config.web.wasm_opt.debug || self.build.build.debug_symbols)
|
||||||
|
// but only if we're not in release mode
|
||||||
|
&& !self.build.build.release;
|
||||||
|
|
||||||
let start = std::time::Instant::now();
|
let start = std::time::Instant::now();
|
||||||
tokio::task::spawn_blocking(move || {
|
tokio::task::spawn_blocking(move || {
|
||||||
@@ -574,9 +578,9 @@ impl AppBundle {
|
|||||||
.debug(keep_debug)
|
.debug(keep_debug)
|
||||||
.demangle(keep_debug)
|
.demangle(keep_debug)
|
||||||
.keep_debug(keep_debug)
|
.keep_debug(keep_debug)
|
||||||
.reference_types(reference_types)
|
.reference_types(keep_debug || reference_types)
|
||||||
.remove_name_section(true)
|
.remove_name_section(!keep_debug)
|
||||||
.remove_producers_section(true)
|
.remove_producers_section(!keep_debug)
|
||||||
.out_name(&name)
|
.out_name(&name)
|
||||||
.generate(&bindgen_outdir)
|
.generate(&bindgen_outdir)
|
||||||
})
|
})
|
||||||
@@ -669,11 +673,10 @@ impl AppBundle {
|
|||||||
.context("Failed to get static routes from server")?
|
.context("Failed to get static routes from server")?
|
||||||
.text()
|
.text()
|
||||||
.await
|
.await
|
||||||
.map(|raw| serde_json::from_str::<String>(&raw).unwrap())
|
.map(|raw| serde_json::from_str::<Vec<String>>(&raw).unwrap())
|
||||||
.inspect(|text| tracing::debug!("Got static routes: {text:?}"))
|
.inspect(|text| tracing::debug!("Got static routes: {text:?}"))
|
||||||
.context("Failed to parse static routes from server")?
|
.context("Failed to parse static routes from server")?
|
||||||
.lines()
|
.into_iter()
|
||||||
.map(|line| line.to_string())
|
|
||||||
.map(|line| async move {
|
.map(|line| async move {
|
||||||
tracing::info!("SSG: {line}");
|
tracing::info!("SSG: {line}");
|
||||||
reqwest::Client::builder()
|
reqwest::Client::builder()
|
||||||
|
|||||||
@@ -51,6 +51,13 @@ pub(crate) struct BuildArgs {
|
|||||||
#[clap(long, default_value_t = true)]
|
#[clap(long, default_value_t = true)]
|
||||||
pub(crate) inject_loading_scripts: bool,
|
pub(crate) inject_loading_scripts: bool,
|
||||||
|
|
||||||
|
/// Generate debug symbols for the wasm binary [default: true]
|
||||||
|
///
|
||||||
|
/// This will make the binary larger and take longer to compile, but will allow you to debug the
|
||||||
|
/// wasm binary
|
||||||
|
#[clap(long, default_value_t = true)]
|
||||||
|
pub(crate) debug_symbols: bool,
|
||||||
|
|
||||||
/// Information about the target to build
|
/// Information about the target to build
|
||||||
#[clap(flatten)]
|
#[clap(flatten)]
|
||||||
pub(crate) target_args: TargetArgs,
|
pub(crate) target_args: TargetArgs,
|
||||||
|
|||||||
@@ -175,7 +175,6 @@ impl SsrRendererPool {
|
|||||||
virtual_dom.provide_root_context(document.clone() as std::rc::Rc<dyn Document>);
|
virtual_dom.provide_root_context(document.clone() as std::rc::Rc<dyn Document>);
|
||||||
|
|
||||||
// poll the future, which may call server_context()
|
// poll the future, which may call server_context()
|
||||||
tracing::info!("Rebuilding vdom");
|
|
||||||
with_server_context(server_context.clone(), || virtual_dom.rebuild_in_place());
|
with_server_context(server_context.clone(), || virtual_dom.rebuild_in_place());
|
||||||
|
|
||||||
let mut pre_body = String::new();
|
let mut pre_body = String::new();
|
||||||
|
|||||||
Reference in new issue
Block a user