diff options
Diffstat (limited to 'cli/build.rs')
-rw-r--r-- | cli/build.rs | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/cli/build.rs b/cli/build.rs index 5fd6ca4d5..71751fb00 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -266,33 +266,36 @@ mod ts { ) .unwrap(); - let output = create_snapshot(CreateSnapshotOptions { - cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"), - snapshot_path, - startup_snapshot: None, - extensions: vec![deno_tsc::init_ops_and_esm( - op_crate_libs, - build_libs, - path_dts, - )], - // NOTE(bartlomieju): Compressing the TSC snapshot in debug build took - // ~45s on M1 MacBook Pro; without compression it took ~1s. - // Thus we're not not using compressed snapshot, trading off - // a lot of build time for some startup time in debug build. - #[cfg(debug_assertions)] - compression_cb: None, - - #[cfg(not(debug_assertions))] - compression_cb: Some(Box::new(|vec, snapshot_slice| { - eprintln!("Compressing TSC snapshot..."); - vec.extend_from_slice( - &zstd::bulk::compress(snapshot_slice, 22) - .expect("snapshot compression failed"), - ); - })), - with_runtime_cb: None, - skip_op_registration: false, - }); + let output = create_snapshot( + CreateSnapshotOptions { + cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"), + snapshot_path, + startup_snapshot: None, + extensions: vec![deno_tsc::init_ops_and_esm( + op_crate_libs, + build_libs, + path_dts, + )], + // NOTE(bartlomieju): Compressing the TSC snapshot in debug build took + // ~45s on M1 MacBook Pro; without compression it took ~1s. + // Thus we're not not using compressed snapshot, trading off + // a lot of build time for some startup time in debug build. + #[cfg(debug_assertions)] + compression_cb: None, + + #[cfg(not(debug_assertions))] + compression_cb: Some(Box::new(|vec, snapshot_slice| { + eprintln!("Compressing TSC snapshot..."); + vec.extend_from_slice( + &zstd::bulk::compress(snapshot_slice, 22) + .expect("snapshot compression failed"), + ); + })), + with_runtime_cb: None, + skip_op_registration: false, + }, + None, + ); for path in output.files_loaded_during_snapshot { println!("cargo:rerun-if-changed={}", path.display()); } |