From 59f8eae47abad4ac6182a3274cf18e3d1d58a542 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Tue, 9 Jul 2024 14:17:29 -0300 Subject: [PATCH] remove old swc code, no js minification for now --- Cargo.toml | 2 -- src/html/process.rs | 41 +++-------------------------------------- 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2dc00ca..59d5276 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,8 +30,6 @@ pulldown-cmark = { version = "0.9.2", git = "https://github.com/SergioBenitez/pu emojis = "0.5.2" cached = "0.42.0" serde_yaml = "0.9.17" -# swc = "0.273.23" -# swc_common = "0.34.4" anyhow = "1.0.68" minify-html = "0.15.0" lightningcss = "1.0.0-alpha.57" diff --git a/src/html/process.rs b/src/html/process.rs index 28aa588..24d8dd4 100644 --- a/src/html/process.rs +++ b/src/html/process.rs @@ -1,6 +1,4 @@ use lightningcss::stylesheet::{ParserOptions, PrinterOptions}; -// use swc::{try_with_handler, HandlerOpts, config::{JsMinifyOptions, Options}, BoolOrDataConfig}; -// use swc_common::{SourceMap, GLOBALS, FileName}; pub fn minify_html(input: String) -> Result { String::from_utf8(minify_html::minify( @@ -13,42 +11,9 @@ pub fn minify_html(input: String) -> Result { } pub fn minify_js(input: String) -> Result { - // minify - return Ok(input); - // let cm = Arc::::default(); - // let c = swc::Compiler::new(cm.clone()); - - // GLOBALS.set(&Default::default(), || { - // try_with_handler( - // cm.clone(), - // HandlerOpts { - // ..Default::default() - // }, - // |handler| { - // let mut fm = cm.new_source_file(FileName::Anon, input); - // let output = c.process_js_file( - // fm.clone(), - // handler, - // &Options { - // ..Default::default() - // } - // )?; - // // idk if there's a better way to do this lol - // fm = cm.new_source_file(FileName::Anon, output.code); - // c.minify( - // fm, - // handler, - // &JsMinifyOptions { - // compress: BoolOrDataConfig::from_bool(true), - // mangle: BoolOrDataConfig::from_bool(true), - // ..Default::default() - // }, - // ) - // } - // ) - // }) - // .map(|o| o.code) - // .map_err(|e| format!("{e}")) + // TODO: implement this + // swc is a stupidly big dependency, and minify_js fails with an assertion + Ok(input) } pub fn minify_css(input: String) -> Result {