Commit Graph

327 Commits

Author SHA1 Message Date
Wilson Lin 8ff5bc3768 Minor reformatting; minor README wording improvements 2020-09-20 20:50:22 +10:00
Wilson Lin 9968dd4649 Add comment and a few more tests 2020-09-02 17:13:09 +10:00
Wilson Lin 9baa4c1a9e Allow < followed by invalid char to be content 2020-09-02 17:07:02 +10:00
Wilson Lin cf02e8265c Minor refactoring of Rust API `copy` example 2020-08-26 14:42:42 +10:00
Wilson Lin 693c847563 Add documentation comments to Rust API 2020-08-25 00:36:27 +10:00
Wilson Lin a415045ae6 Fix hex numeric entity parsing 2020-08-24 21:48:58 +10:00
Wilson Lin d7ddda3f21 Do not allow unmatched closing tag at root 2020-07-30 20:17:55 +10:00
Wilson Lin d024d21274 Refactoring 2020-07-30 19:51:43 +10:00
Wilson Lin 0eddabcb89 Remove unused function 2020-07-30 14:41:33 +10:00
Wilson Lin ed72690463 Allow omitted tags in source 2020-07-30 14:38:40 +10:00
Wilson Lin d2bffe8005 Allow case insensitive closing tag names for script and style 2020-07-30 12:46:18 +10:00
Wilson Lin abfc4bceaa Make tag and attribute names case insensitive 2020-07-30 12:32:53 +10:00
Wilson Lin 08a2f39108 Fix debug repr line boundaries check; reduce debug repr output by stopping at read position; provide expected and actual tag names for closing tag mismatch error 2020-07-30 00:28:57 +10:00
Wilson Lin 8badd30b40 Minor fix: support numeric entities with more than 256 digits 2020-07-27 18:33:31 +10:00
Wilson Lin 2eb1bea077 Bang -> bang 2020-07-27 18:09:49 +10:00
Wilson Lin e5245acc31 Inline most functions; use aho-corasick for comments and instructions too 2020-07-27 18:08:53 +10:00
Wilson Lin e8726c2ed1 Fix boundary bugs 2020-07-27 17:56:19 +10:00
Wilson Lin 009e91d094 Use aho-corasick for faster and simpler end tag matching 2020-07-27 00:27:52 +10:00
Wilson Lin e76c12a9db Avoid cloning script data before passing to esbuild 2020-07-25 14:18:23 +10:00
Wilson Lin 9627921cb2 Do not minify non-JS script data 2020-07-25 13:22:39 +10:00
Wilson Lin 9f40000527 Omit closing tags for html, head, body 2020-07-24 19:05:29 +10:00
Wilson Lin e1e18bb1a7 Fix race condition from not releasing Mutex guard and Arc ref on async JS min jobs 2020-07-22 21:33:52 +10:00
Wilson Lin cc98a61bc2 Fix </script> end tag escaping in JS 2020-07-22 21:33:09 +10:00
Wilson Lin e9ea7bc378 Separate out and simplify debug repr; reimplement with_friendly_error; fix JS copying 2020-07-22 18:57:47 +10:00
Wilson Lin 1847eca6b6 Fix type errors 2020-07-22 17:45:47 +10:00
Wilson Lin 1826e980f7 Fix JS finishing; temporarily remove friendly function 2020-07-21 23:27:56 +10:00
Wilson Lin 6f3e1254de Conditionally compile JS feature code 2020-07-21 17:59:56 +10:00
Wilson Lin b967e338ca Use named error struct instead of tuple; use async JS minification; fix old JS package names 2020-07-21 17:57:39 +10:00
Wilson Lin c71a9169a7 Add str helper function 2020-07-12 16:05:49 +10:00
Wilson Lin dc376d7c7f Rename to minify-html 2020-07-12 01:29:34 +10:00
Wilson Lin a15c0e76f9 Remove dependence on regex 2020-07-11 22:52:27 +10:00
Wilson Lin 56edbac338 Make JS library optional 2020-07-11 22:20:17 +10:00
Wilson Lin ced0e82515 Add support for configuration and JS minification using esbuild 2020-07-11 01:15:56 +10:00
Wilson Lin 0787bb83f1 Clean up dead code 2020-07-10 21:07:30 +10:00
Wilson Lin 9ffb7b1d98 Add unit tests and fix various bugs 2020-07-10 20:40:33 +10:00
Wilson Lin 26b6c47d06 Use lookup tables for code points 2020-07-09 17:06:08 +10:00
Wilson Lin 2ffb626573 Fix entity normalisation 2020-07-07 21:09:04 +10:00
Wilson Lin 3ca6ae3d8e Improve performance of char specs 2020-07-07 21:08:39 +10:00
Wilson Lin bcbb048762 Fix not writing closing tag on encoded '<' in content 2020-07-07 21:08:15 +10:00
Wilson Lin a35641445d Use much simpler read-time entity decoding; fix longest prefix matching; fix transparent nodes not being interpreted as such 2020-07-04 20:33:02 +10:00
Wilson Lin 38084e2894 Fix missing space at end of self-closing SVG tags when last attribute is unquoted 2020-07-04 15:58:35 +10:00
Wilson Lin 1ee193de1b Fix tricky subtle bugs in trie matching 2020-07-03 22:32:16 +10:00
Wilson Lin a519394c3a Use regex crate for substring searches 2020-07-03 20:37:52 +10:00
Wilson Lin 2a010088fa Use lazy_static instead of phf due to phf incompatibility with latest Rust versions 2020-07-03 17:32:09 +10:00
Wilson Lin 9605c34e66 Compact tries even more 2020-06-19 18:12:55 +10:00
Wilson Lin cefdc8fdd9 Wire up new generated code 2020-06-19 17:58:16 +10:00
Wilson Lin 7a52bd7add Extract CLI to own package 2020-06-19 09:54:56 +10:00
Wilson Lin 360bfbba8d Fix typos 2020-05-12 17:26:13 +10:00
Wilson Lin 26157908a6 Add friendlier Rust functions; improve examples 2020-05-12 17:12:29 +10:00
Wilson Lin ab28f51b3c Fix incorrect encoding of `>` instead of `<` 2020-03-01 14:04:20 +11:00
Wilson Lin aaf57a9c22 Improve performance through inlining and direct arrays 2020-01-31 23:15:35 +11:00
Wilson Lin 2ebfb9d017 Remove comments 2020-01-26 23:26:47 +13:00
Wilson Lin 3aa752e46b Restructure enums and matching for performance 2020-01-26 22:32:06 +13:00
Wilson Lin 212e4257d1 Fix bugs relating to entities decoding and encoding 2020-01-26 18:38:23 +13:00
Wilson Lin ead4917fb7 Minor cleanup of Processor 2020-01-26 13:49:43 +13:00
Wilson Lin ee2d9e22cf Reformatting 2020-01-26 13:35:57 +13:00
Wilson Lin 90148f5f9b Support stdin/out for CLI; use friendlier CLI error messages; clarify replacement character usage 2020-01-26 13:30:41 +13:00
Wilson Lin 71a3e3927b Create through matching condition; show code context on error when using CLI 2020-01-26 03:25:07 +13:00
Wilson Lin 0a094dfed0 Implement more effective `>` encoding; restructure internal APIs 2020-01-26 01:05:07 +13:00
Wilson Lin 24c1639a82 Remove unused errors; order imports 2020-01-25 20:07:52 +13:00
Wilson Lin 8988ff1e3a Create simplified unified matching API 2020-01-25 20:04:02 +13:00
Wilson 6ec509945a Minify area[shape] attr; simplify NS code 2020-01-24 15:17:46 +13:00
Wilson 54b65bbd0c Minify SVG attributes; minor QoL improvements 2020-01-24 03:53:09 +13:00
Wilson Lin 6b2b8cf552 Handle comments correctly 2020-01-19 11:44:11 +11:00
Wilson Lin 9f93a5d6de Fix content whitespace trimming 2020-01-19 11:32:38 +11:00
Wilson Lin 3c4b71612e Fix text minification 2020-01-18 22:39:33 +11:00
Wilson Lin b88e96e97e Significantly clarify code; handle whitespace minification and tag omission at root 2020-01-18 22:19:06 +11:00
Wilson Lin b4f8a041b2 Mention attr with default value removal in README; add <style> default attr values 2020-01-18 11:47:38 +11:00
Wilson Lin 27af2368ff Remove attrs with default values; create minified comparison script; remove `=` from boolean attrs; fix closing tag writing before collapsed whitespace; rebuild hyperbuild only in bench build script instead of all dependencies; conservatively collapse whitespace for html-minifier to match hyperbuild behaviour; update bench results 2020-01-18 11:42:01 +11:00
Wilson Lin ba5fbc68f7 Simplify and improve performance of whitespace minification strategy config 2020-01-17 19:27:34 +11:00
Wilson Lin 3a9877534f Minor code reformatting 2020-01-17 00:07:04 +11:00
Wilson Lin 5b78526230 Handle edge case in attribute value minification 2020-01-17 00:05:48 +11:00
Wilson Lin 4eeb70639a Rename classname attr; update bench results; mention decoding to U+FFFD 2020-01-15 22:57:47 +11:00
Wilson Lin f8b0bbe3e0 Fix various parsing bugs 2020-01-15 22:09:16 +11:00
Wilson Lin 7dcd7442e8 Remove redundant attributes with empty values 2020-01-15 00:58:33 +11:00
Wilson Lin 37115fef7a Allow more whitespace w.r.t. attributes; do not format bench test pages 2020-01-14 21:10:49 +11:00
Wilson Lin ba3e1917ce Support unquoted attribute values 2020-01-14 20:47:42 +11:00
Wilson Lin 8a92d4281a Remove incorrect comment and unused function 2020-01-14 17:56:13 +11:00
Wilson Lin 0fa6d660e6 Handle malformed entities 2020-01-14 17:55:27 +11:00
Wilson Lin 6a0b60db7d Remove unused code 2020-01-12 22:49:41 +11:00
Wilson Lin 20c59769fe Do not handle extremely rare escaped states in <script>; simplify graph to show single average 2020-01-12 17:39:23 +11:00
Wilson Lin 52592997fb Use fastrie 2020-01-12 16:29:41 +11:00
Wilson Lin 03b230cea7 Fix typos 2020-01-10 18:45:06 +11:00
Wilson Lin e966f9a23b Remove unused code; handle escaped and double-escaped script data; allow using buffer instead of string source for bench; enforce matching tags 2020-01-10 18:30:49 +11:00
Wilson Lin 8553b09eb3 Fix handling of <script> and <style>; do not minify JS and CSS code 2020-01-10 00:12:21 +11:00
Wilson Lin 68c43ab486 Also bench hyperbuild Rust; improve graphs; remove default values for html-minifier config 2020-01-09 22:40:04 +11:00
Wilson Lin 1cb9bf9817 Improve closing tag minification; update bench results 2020-01-09 20:45:14 +11:00
Wilson Lin 8b4ec884b6 Handle ++/-- better 2020-01-09 00:57:14 +11:00
Wilson Lin ba4b3f09f3 Fix typo in error name 2020-01-09 00:49:17 +11:00
Wilson Lin 204bd950a4 Improve handling of JS 2020-01-09 00:42:03 +11:00
Wilson Lin 407acf01a6 Improve parsing attributes reliability 2020-01-09 00:34:59 +11:00
Wilson Lin a9eab38d88 Ensure JS RegExp does not contain line terminators 2020-01-09 00:34:35 +11:00
Wilson Lin da830939d7 Handle processing instructions 2020-01-08 23:00:23 +11:00
Wilson Lin 11adb24f00 Refactor JS parsing 2020-01-08 22:34:04 +11:00
Wilson Lin 3744e13a4d Attempt to handle RegExp literals in JS 2020-01-08 22:19:16 +11:00
Wilson Lin a9bb4c924f Minify JS/CSS comments; faster removal of boolean attr values; sorted generated JSON objects 2020-01-08 11:40:06 +11:00
Wilson Lin 9a9b543b26 Remove boolean attribute values 2020-01-08 00:38:42 +11:00
Wilson Lin e63f8734b4 More minification 2020-01-07 20:56:37 +11:00
Wilson Lin bab73243d7 Erase JS MIME types 2020-01-07 00:28:35 +11:00
Wilson Lin 3c90daa644 Implement closing tag omission 2020-01-06 23:36:05 +11:00