Skip to content

Commit 59f8eae

Browse files
committed
remove old swc code, no js minification for now
1 parent c11a938 commit 59f8eae

File tree

2 files changed

+3
-40
lines changed

2 files changed

+3
-40
lines changed

Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ pulldown-cmark = { version = "0.9.2", git = "https://github.com/SergioBenitez/pu
3030
emojis = "0.5.2"
3131
cached = "0.42.0"
3232
serde_yaml = "0.9.17"
33-
# swc = "0.273.23"
34-
# swc_common = "0.34.4"
3533
anyhow = "1.0.68"
3634
minify-html = "0.15.0"
3735
lightningcss = "1.0.0-alpha.57"

src/html/process.rs

+3-38
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
use lightningcss::stylesheet::{ParserOptions, PrinterOptions};
2-
// use swc::{try_with_handler, HandlerOpts, config::{JsMinifyOptions, Options}, BoolOrDataConfig};
3-
// use swc_common::{SourceMap, GLOBALS, FileName};
42

53
pub fn minify_html(input: String) -> Result<String, String> {
64
String::from_utf8(minify_html::minify(
@@ -13,42 +11,9 @@ pub fn minify_html(input: String) -> Result<String, String> {
1311
}
1412

1513
pub fn minify_js(input: String) -> Result<String, String> {
16-
// minify
17-
return Ok(input);
18-
// let cm = Arc::<SourceMap>::default();
19-
// let c = swc::Compiler::new(cm.clone());
20-
21-
// GLOBALS.set(&Default::default(), || {
22-
// try_with_handler(
23-
// cm.clone(),
24-
// HandlerOpts {
25-
// ..Default::default()
26-
// },
27-
// |handler| {
28-
// let mut fm = cm.new_source_file(FileName::Anon, input);
29-
// let output = c.process_js_file(
30-
// fm.clone(),
31-
// handler,
32-
// &Options {
33-
// ..Default::default()
34-
// }
35-
// )?;
36-
// // idk if there's a better way to do this lol
37-
// fm = cm.new_source_file(FileName::Anon, output.code);
38-
// c.minify(
39-
// fm,
40-
// handler,
41-
// &JsMinifyOptions {
42-
// compress: BoolOrDataConfig::from_bool(true),
43-
// mangle: BoolOrDataConfig::from_bool(true),
44-
// ..Default::default()
45-
// },
46-
// )
47-
// }
48-
// )
49-
// })
50-
// .map(|o| o.code)
51-
// .map_err(|e| format!("{e}"))
14+
// TODO: implement this
15+
// swc is a stupidly big dependency, and minify_js fails with an assertion
16+
Ok(input)
5217
}
5318

5419
pub fn minify_css(input: String) -> Result<String, String> {

0 commit comments

Comments
 (0)