diff --git a/crates/dbg-swc/scripts/reduce-list.sh b/crates/dbg-swc/scripts/reduce-list.sh new file mode 100755 index 00000000000..4cee50e98f9 --- /dev/null +++ b/crates/dbg-swc/scripts/reduce-list.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -eu + +cat list.txt | xargs -L 1 -I {} ./scripts/reduce-size.sh {} \ No newline at end of file diff --git a/crates/dbg-swc/src/minify/ensure_size.rs b/crates/dbg-swc/src/minify/ensure_size.rs index f069cb10658..2784cca29c0 100644 --- a/crates/dbg-swc/src/minify/ensure_size.rs +++ b/crates/dbg-swc/src/minify/ensure_size.rs @@ -48,7 +48,22 @@ impl EnsureSize { return Ok(()); } for report in &results { + println!(); println!("{}", report.fm.name); + + if let Some(terser) = &report.terser { + if report.swc.mangled_size > terser.mangled_size { + println!(" Mangled"); + println!(" swc: {} bytes", report.swc.mangled_size); + println!(" terser: {} bytes", terser.mangled_size); + } + + if report.swc.no_mangle_size > terser.no_mangle_size { + println!(" No-mangle"); + println!(" swc: {} bytes", report.swc.no_mangle_size); + println!(" terser: {} bytes", terser.no_mangle_size); + } + } } bail!("found some issues") diff --git a/crates/swc_ecma_minifier/tests/full/size/.05f3b568bfaa8ece7f1eb857ea288eb8c696fb04/input.js b/crates/swc_ecma_minifier/tests/full/size/05f3b568bfaa8ece7f1eb857ea288eb8c696fb04/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.05f3b568bfaa8ece7f1eb857ea288eb8c696fb04/input.js rename to crates/swc_ecma_minifier/tests/full/size/05f3b568bfaa8ece7f1eb857ea288eb8c696fb04/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.07135b51c260c4d625d923239df66176ae42be80/input.js b/crates/swc_ecma_minifier/tests/full/size/07135b51c260c4d625d923239df66176ae42be80/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.07135b51c260c4d625d923239df66176ae42be80/input.js rename to crates/swc_ecma_minifier/tests/full/size/07135b51c260c4d625d923239df66176ae42be80/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.1307ecae57445459527af71fb229e8ed8213bad9/input.js b/crates/swc_ecma_minifier/tests/full/size/1307ecae57445459527af71fb229e8ed8213bad9/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.1307ecae57445459527af71fb229e8ed8213bad9/input.js rename to crates/swc_ecma_minifier/tests/full/size/1307ecae57445459527af71fb229e8ed8213bad9/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.183435826ca7dac36bdd1f6e603ba738fc710a1b/input.js b/crates/swc_ecma_minifier/tests/full/size/183435826ca7dac36bdd1f6e603ba738fc710a1b/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.183435826ca7dac36bdd1f6e603ba738fc710a1b/input.js rename to crates/swc_ecma_minifier/tests/full/size/183435826ca7dac36bdd1f6e603ba738fc710a1b/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.24ba4747cd0b1c8200a359bc28b0040cc47a3f09/input.js b/crates/swc_ecma_minifier/tests/full/size/24ba4747cd0b1c8200a359bc28b0040cc47a3f09/input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.24ba4747cd0b1c8200a359bc28b0040cc47a3f09/input.js rename to crates/swc_ecma_minifier/tests/full/size/24ba4747cd0b1c8200a359bc28b0040cc47a3f09/input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/24ba4747cd0b1c8200a359bc28b0040cc47a3f09/output.js b/crates/swc_ecma_minifier/tests/full/size/24ba4747cd0b1c8200a359bc28b0040cc47a3f09/output.js new file mode 100644 index 00000000000..327b7edaecb --- /dev/null +++ b/crates/swc_ecma_minifier/tests/full/size/24ba4747cd0b1c8200a359bc28b0040cc47a3f09/output.js @@ -0,0 +1 @@ +[]({a(){window}}) diff --git a/crates/swc_ecma_minifier/tests/full/size/.34c8af5de1b84b8283dbd651a03571c7f243e8b2/input.js b/crates/swc_ecma_minifier/tests/full/size/34c8af5de1b84b8283dbd651a03571c7f243e8b2/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.34c8af5de1b84b8283dbd651a03571c7f243e8b2/input.js rename to crates/swc_ecma_minifier/tests/full/size/34c8af5de1b84b8283dbd651a03571c7f243e8b2/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.36260571a27136b062437bddc1782e84b71055f6/input.js b/crates/swc_ecma_minifier/tests/full/size/36260571a27136b062437bddc1782e84b71055f6/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.36260571a27136b062437bddc1782e84b71055f6/input.js rename to crates/swc_ecma_minifier/tests/full/size/36260571a27136b062437bddc1782e84b71055f6/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.37f0ab9950257024a9116d933f4ad3c72b88471e/input.js b/crates/swc_ecma_minifier/tests/full/size/37f0ab9950257024a9116d933f4ad3c72b88471e/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.37f0ab9950257024a9116d933f4ad3c72b88471e/input.js rename to crates/swc_ecma_minifier/tests/full/size/37f0ab9950257024a9116d933f4ad3c72b88471e/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.39ee86af2a2157bccd42915ff69b6d3abff2b725/input.js b/crates/swc_ecma_minifier/tests/full/size/39ee86af2a2157bccd42915ff69b6d3abff2b725/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.39ee86af2a2157bccd42915ff69b6d3abff2b725/input.js rename to crates/swc_ecma_minifier/tests/full/size/39ee86af2a2157bccd42915ff69b6d3abff2b725/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.3a405a6fe7e6e52e8e46ad447ea34ed3bb2c89a8/input.js b/crates/swc_ecma_minifier/tests/full/size/3a405a6fe7e6e52e8e46ad447ea34ed3bb2c89a8/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.3a405a6fe7e6e52e8e46ad447ea34ed3bb2c89a8/input.js rename to crates/swc_ecma_minifier/tests/full/size/3a405a6fe7e6e52e8e46ad447ea34ed3bb2c89a8/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.3b335e237f275bec488d72f8934589b74346a0c1/input.js b/crates/swc_ecma_minifier/tests/full/size/3b335e237f275bec488d72f8934589b74346a0c1/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.3b335e237f275bec488d72f8934589b74346a0c1/input.js rename to crates/swc_ecma_minifier/tests/full/size/3b335e237f275bec488d72f8934589b74346a0c1/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.3f1b1f240dbfc9585d82094d944515c068eac6dc/input.js b/crates/swc_ecma_minifier/tests/full/size/3f1b1f240dbfc9585d82094d944515c068eac6dc/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.3f1b1f240dbfc9585d82094d944515c068eac6dc/input.js rename to crates/swc_ecma_minifier/tests/full/size/3f1b1f240dbfc9585d82094d944515c068eac6dc/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.40a586d8ac72ba5686c4b250184acfa11620d814/input.js b/crates/swc_ecma_minifier/tests/full/size/40a586d8ac72ba5686c4b250184acfa11620d814/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.40a586d8ac72ba5686c4b250184acfa11620d814/input.js rename to crates/swc_ecma_minifier/tests/full/size/40a586d8ac72ba5686c4b250184acfa11620d814/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.4dfc0f7ca994bdaddd4ac283d2bb75a232047f70/input.js b/crates/swc_ecma_minifier/tests/full/size/4dfc0f7ca994bdaddd4ac283d2bb75a232047f70/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.4dfc0f7ca994bdaddd4ac283d2bb75a232047f70/input.js rename to crates/swc_ecma_minifier/tests/full/size/4dfc0f7ca994bdaddd4ac283d2bb75a232047f70/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.54531ba076299b43c00a0d234240369f93371a41/input.js b/crates/swc_ecma_minifier/tests/full/size/54531ba076299b43c00a0d234240369f93371a41/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.54531ba076299b43c00a0d234240369f93371a41/input.js rename to crates/swc_ecma_minifier/tests/full/size/54531ba076299b43c00a0d234240369f93371a41/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.5cf31de5417c846f70f5ce592351197f764d753b/input.js b/crates/swc_ecma_minifier/tests/full/size/5cf31de5417c846f70f5ce592351197f764d753b/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.5cf31de5417c846f70f5ce592351197f764d753b/input.js rename to crates/swc_ecma_minifier/tests/full/size/5cf31de5417c846f70f5ce592351197f764d753b/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.6d4d9a62f2b2a45ed97871a54c3871f6535d66e1/input.js b/crates/swc_ecma_minifier/tests/full/size/6d4d9a62f2b2a45ed97871a54c3871f6535d66e1/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.6d4d9a62f2b2a45ed97871a54c3871f6535d66e1/input.js rename to crates/swc_ecma_minifier/tests/full/size/6d4d9a62f2b2a45ed97871a54c3871f6535d66e1/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.6d52ebcc72a64f1f1ef2594baecb5dcab49b1a32/input.js b/crates/swc_ecma_minifier/tests/full/size/6d52ebcc72a64f1f1ef2594baecb5dcab49b1a32/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.6d52ebcc72a64f1f1ef2594baecb5dcab49b1a32/input.js rename to crates/swc_ecma_minifier/tests/full/size/6d52ebcc72a64f1f1ef2594baecb5dcab49b1a32/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.80eb9c2dd2f825dd3583cd0f1ffbd56b8c6191bb/input.js b/crates/swc_ecma_minifier/tests/full/size/80eb9c2dd2f825dd3583cd0f1ffbd56b8c6191bb/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.80eb9c2dd2f825dd3583cd0f1ffbd56b8c6191bb/input.js rename to crates/swc_ecma_minifier/tests/full/size/80eb9c2dd2f825dd3583cd0f1ffbd56b8c6191bb/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.827a2682618668d02cb6e4ad6e17bd62cdba0dd2/input.js b/crates/swc_ecma_minifier/tests/full/size/827a2682618668d02cb6e4ad6e17bd62cdba0dd2/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.827a2682618668d02cb6e4ad6e17bd62cdba0dd2/input.js rename to crates/swc_ecma_minifier/tests/full/size/827a2682618668d02cb6e4ad6e17bd62cdba0dd2/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.991835278eecab695ad3515447b5747adcdfe1b4/input.js b/crates/swc_ecma_minifier/tests/full/size/991835278eecab695ad3515447b5747adcdfe1b4/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.991835278eecab695ad3515447b5747adcdfe1b4/input.js rename to crates/swc_ecma_minifier/tests/full/size/991835278eecab695ad3515447b5747adcdfe1b4/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.a83cc6221479cbf2ab203169588b1e39b76a4a61/input.js b/crates/swc_ecma_minifier/tests/full/size/a83cc6221479cbf2ab203169588b1e39b76a4a61/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.a83cc6221479cbf2ab203169588b1e39b76a4a61/input.js rename to crates/swc_ecma_minifier/tests/full/size/a83cc6221479cbf2ab203169588b1e39b76a4a61/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.b44e25a2b8c64cd1d2a448bc214c8f9a589b1245/input.js b/crates/swc_ecma_minifier/tests/full/size/b44e25a2b8c64cd1d2a448bc214c8f9a589b1245/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.b44e25a2b8c64cd1d2a448bc214c8f9a589b1245/input.js rename to crates/swc_ecma_minifier/tests/full/size/b44e25a2b8c64cd1d2a448bc214c8f9a589b1245/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.b57e4ca6d118a9480312f6f3ac809245bbed8115/input.js b/crates/swc_ecma_minifier/tests/full/size/b57e4ca6d118a9480312f6f3ac809245bbed8115/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.b57e4ca6d118a9480312f6f3ac809245bbed8115/input.js rename to crates/swc_ecma_minifier/tests/full/size/b57e4ca6d118a9480312f6f3ac809245bbed8115/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.bfb48fed563e5fb468b88b6a6670972c3ca7ee38/input.js b/crates/swc_ecma_minifier/tests/full/size/bfb48fed563e5fb468b88b6a6670972c3ca7ee38/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.bfb48fed563e5fb468b88b6a6670972c3ca7ee38/input.js rename to crates/swc_ecma_minifier/tests/full/size/bfb48fed563e5fb468b88b6a6670972c3ca7ee38/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.c284f333b99f5a7b22676723103375bc8a307869/input.js b/crates/swc_ecma_minifier/tests/full/size/c284f333b99f5a7b22676723103375bc8a307869/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.c284f333b99f5a7b22676723103375bc8a307869/input.js rename to crates/swc_ecma_minifier/tests/full/size/c284f333b99f5a7b22676723103375bc8a307869/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.cb3806c635e59c15d84ee6c6cae3db9c9fce06cc/input.js b/crates/swc_ecma_minifier/tests/full/size/cb3806c635e59c15d84ee6c6cae3db9c9fce06cc/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.cb3806c635e59c15d84ee6c6cae3db9c9fce06cc/input.js rename to crates/swc_ecma_minifier/tests/full/size/cb3806c635e59c15d84ee6c6cae3db9c9fce06cc/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.cb540d49b738ee81973607e264bc9872f88acda8/input.js b/crates/swc_ecma_minifier/tests/full/size/cb540d49b738ee81973607e264bc9872f88acda8/input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.cb540d49b738ee81973607e264bc9872f88acda8/input.js rename to crates/swc_ecma_minifier/tests/full/size/cb540d49b738ee81973607e264bc9872f88acda8/input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/cb540d49b738ee81973607e264bc9872f88acda8/output.js b/crates/swc_ecma_minifier/tests/full/size/cb540d49b738ee81973607e264bc9872f88acda8/output.js new file mode 100644 index 00000000000..c9b050205c3 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/full/size/cb540d49b738ee81973607e264bc9872f88acda8/output.js @@ -0,0 +1 @@ +[]({a(){}}) diff --git a/crates/swc_ecma_minifier/tests/full/size/.de4c599f0856587c5478f4f8d3cce9d91f9c8937/input.js b/crates/swc_ecma_minifier/tests/full/size/de4c599f0856587c5478f4f8d3cce9d91f9c8937/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.de4c599f0856587c5478f4f8d3cce9d91f9c8937/input.js rename to crates/swc_ecma_minifier/tests/full/size/de4c599f0856587c5478f4f8d3cce9d91f9c8937/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.e4dd4373c192c6fe2fc929bc55d1ed625b974338/input.js b/crates/swc_ecma_minifier/tests/full/size/e4dd4373c192c6fe2fc929bc55d1ed625b974338/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.e4dd4373c192c6fe2fc929bc55d1ed625b974338/input.js rename to crates/swc_ecma_minifier/tests/full/size/e4dd4373c192c6fe2fc929bc55d1ed625b974338/.input.js diff --git a/crates/swc_ecma_minifier/tests/full/size/.ecbeb82a70cef8575c7f48355f383c6c4cc1bca4/input.js b/crates/swc_ecma_minifier/tests/full/size/ecbeb82a70cef8575c7f48355f383c6c4cc1bca4/.input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/full/size/.ecbeb82a70cef8575c7f48355f383c6c4cc1bca4/input.js rename to crates/swc_ecma_minifier/tests/full/size/ecbeb82a70cef8575c7f48355f383c6c4cc1bca4/.input.js