From 246f239d9f40f633160f0c18f87a20922d4e77bb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:06:37 +0200 Subject: Merging debian version 1.65.0+dfsg1-2. Signed-off-by: Daniel Baumann --- vendor/minifier/.cargo-checksum.json | 2 +- vendor/minifier/Cargo.lock | 2 +- vendor/minifier/Cargo.toml | 2 +- vendor/minifier/src/css/token.rs | 51 ++++++++++++++++++++++-------------- 4 files changed, 34 insertions(+), 23 deletions(-) (limited to 'vendor/minifier') diff --git a/vendor/minifier/.cargo-checksum.json b/vendor/minifier/.cargo-checksum.json index 4760bcb0d..6ca9569c2 100644 --- a/vendor/minifier/.cargo-checksum.json +++ b/vendor/minifier/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"adb64b1e8820e83bebfc867d6e5846154743bc324754d50a2bb13742f682f1b9","Cargo.toml":"d5c1e43fffcf2a4a384ea0adfacac7c08b41bd3b05937e7e2ad1aeb0ea2aad62","LICENSE":"d64fe3199be0c90d1f88b363e6b567d5812f64c01accc8957e71381598a3d670","README.md":"7ce7cc43ebca972096db97b9f8bd211e5ac0c688f01b1732d5e2243e8c32d02d","src/css/mod.rs":"afbab7f8a657871fb567b25c5c87cb3e1c9e88d486335e154873b8c818370506","src/css/tests.rs":"056d1d3d927be4c7cece4033b48b28fe3a142939ac2f71cb10ca93f2a28a4477","src/css/token.rs":"b9fff49884a74423e11a913f49dd923b2f8c28e5a29894b08c9d1b2fbc06b85f","src/html.rs":"7b78e2c7d1b0d85065de7e6ab7e0407a74590e23ad1d20fe106c2361f5b09447","src/js/mod.rs":"b63e9cac9cc2cf7063f1eb598892fde3aa55081d0bf926df85c008e35d8e5a30","src/js/token.rs":"81918762068fba64a53dc0328222e74e8c922e657be46bb431ae4a3ac0e9fce9","src/js/tools.rs":"50e9581d6cfa2aebf2928f3df63bbb8a72149c7a40a687f248c108cf154a74ab","src/js/utils.rs":"54d97e766cb38ca1ac7c661a376f8e01c735486f2b78ae149794bb735e8f787b","src/json/json_minifier.rs":"83b5868bff0692aa655973596ad6ff34d215001be47c5c9adad8049faeec87bb","src/json/mod.rs":"e4ff2108ba01d5e937e22108c467c1c191ffc55fffedebd9c86d2a9789abb5e4","src/json/read/byte_to_char.rs":"633cdff14eb99fe7e2ba72594444b2c681a7ec13f557fecfc791b11ce8b9f130","src/json/read/internal_buffer.rs":"459e17fcc86039dd5000dbf9e8c834bfaa02cba2a2afbd19c067c9d621ba7d0b","src/json/read/internal_reader.rs":"37d9f8a31fd6477bbed676ce923a85568e9a96ef5d46db02e92e65ba13c65dea","src/json/read/json_read.rs":"dbc2c729c0c07109860e5a7c69f4fea2c4721fc17f764622392c54bd2afb1b55","src/json/string.rs":"9b9b3a40bfdb6fcbe2f3215a0506b8edfab577dd79e4a404c492fbc486896567","src/lib.rs":"ec53713f3903f80439c83a835d46b562c3cae119f2354d7a5558c0603c86c1a7","src/main.rs":"10c62d1d5544896506962d569d1507d3396bf894f501c26586a561b904956c47","tests/files/main.js":"18f43c7672eb75f532bc7f99dd2b6d644b3a11e19662774e93405928fde4d4d4","tests/files/minified_main.js":"0952e8cff3fae6c91b13a15f2923d922ccd9bce339419cc4bd52b5314180dabb","tests/files/test.json":"e07a148ef24385057cb7420209a630758c6ce80970bd54c8ffee5be207205608","tests/js_minify.rs":"66de1b596668a5f8d11e0b65d42ace3da6bc0b2b997b2d9e2fc09a488624c5af"},"package":"ac96d1e7a65f206443f95afff6de8f1690c77c97d6fc9c9bb2d2cd0662e9ff9f"} \ No newline at end of file +{"files":{"Cargo.lock":"57dc07ee7630f30d86a9f9729eda1a2df49abcfbd82eaa850d1583de0507a57a","Cargo.toml":"1d804870b80ebb2d7361ab20144152a8593f97b37377834fa4c0f5c399281626","LICENSE":"d64fe3199be0c90d1f88b363e6b567d5812f64c01accc8957e71381598a3d670","README.md":"7ce7cc43ebca972096db97b9f8bd211e5ac0c688f01b1732d5e2243e8c32d02d","src/css/mod.rs":"afbab7f8a657871fb567b25c5c87cb3e1c9e88d486335e154873b8c818370506","src/css/tests.rs":"056d1d3d927be4c7cece4033b48b28fe3a142939ac2f71cb10ca93f2a28a4477","src/css/token.rs":"3f949eb966daab620df03a2fb9e8309fae0f48ad4b3012603f7daa363ab9d62f","src/html.rs":"7b78e2c7d1b0d85065de7e6ab7e0407a74590e23ad1d20fe106c2361f5b09447","src/js/mod.rs":"b63e9cac9cc2cf7063f1eb598892fde3aa55081d0bf926df85c008e35d8e5a30","src/js/token.rs":"81918762068fba64a53dc0328222e74e8c922e657be46bb431ae4a3ac0e9fce9","src/js/tools.rs":"50e9581d6cfa2aebf2928f3df63bbb8a72149c7a40a687f248c108cf154a74ab","src/js/utils.rs":"54d97e766cb38ca1ac7c661a376f8e01c735486f2b78ae149794bb735e8f787b","src/json/json_minifier.rs":"83b5868bff0692aa655973596ad6ff34d215001be47c5c9adad8049faeec87bb","src/json/mod.rs":"e4ff2108ba01d5e937e22108c467c1c191ffc55fffedebd9c86d2a9789abb5e4","src/json/read/byte_to_char.rs":"633cdff14eb99fe7e2ba72594444b2c681a7ec13f557fecfc791b11ce8b9f130","src/json/read/internal_buffer.rs":"459e17fcc86039dd5000dbf9e8c834bfaa02cba2a2afbd19c067c9d621ba7d0b","src/json/read/internal_reader.rs":"37d9f8a31fd6477bbed676ce923a85568e9a96ef5d46db02e92e65ba13c65dea","src/json/read/json_read.rs":"dbc2c729c0c07109860e5a7c69f4fea2c4721fc17f764622392c54bd2afb1b55","src/json/string.rs":"9b9b3a40bfdb6fcbe2f3215a0506b8edfab577dd79e4a404c492fbc486896567","src/lib.rs":"ec53713f3903f80439c83a835d46b562c3cae119f2354d7a5558c0603c86c1a7","src/main.rs":"10c62d1d5544896506962d569d1507d3396bf894f501c26586a561b904956c47","tests/files/main.js":"18f43c7672eb75f532bc7f99dd2b6d644b3a11e19662774e93405928fde4d4d4","tests/files/minified_main.js":"0952e8cff3fae6c91b13a15f2923d922ccd9bce339419cc4bd52b5314180dabb","tests/files/test.json":"e07a148ef24385057cb7420209a630758c6ce80970bd54c8ffee5be207205608","tests/js_minify.rs":"66de1b596668a5f8d11e0b65d42ace3da6bc0b2b997b2d9e2fc09a488624c5af"},"package":"8eb022374af2f446981254e6bf9efb6e2c9e1a53176d395fca02792fd4435729"} \ No newline at end of file diff --git a/vendor/minifier/Cargo.lock b/vendor/minifier/Cargo.lock index 9f5453ee1..2b0a9ea5c 100644 --- a/vendor/minifier/Cargo.lock +++ b/vendor/minifier/Cargo.lock @@ -19,7 +19,7 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "minifier" -version = "0.2.1" +version = "0.2.2" dependencies = [ "regex", ] diff --git a/vendor/minifier/Cargo.toml b/vendor/minifier/Cargo.toml index be981e4d0..a7f02a37c 100644 --- a/vendor/minifier/Cargo.toml +++ b/vendor/minifier/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2021" name = "minifier" -version = "0.2.1" +version = "0.2.2" authors = ["Guillaume Gomez "] description = "Minifier tool/lib for JS/CSS/JSON files" documentation = "https://docs.rs/minifier-rs" diff --git a/vendor/minifier/src/css/token.rs b/vendor/minifier/src/css/token.rs index d2d738840..58e416fcd 100644 --- a/vendor/minifier/src/css/token.rs +++ b/vendor/minifier/src/css/token.rs @@ -571,9 +571,17 @@ pub(super) fn tokenize<'a>(source: &'a str) -> Result, &'static str> } fn clean_tokens(mut v: Vec>) -> Vec> { + // This function may remove multiple elements from the vector. Ideally we'd + // use `Vec::retain`, but the traversal requires inspecting the previously + // retained token and the next token, which `Vec::retain` doesn't allow. So + // we have to use a lower-level mechanism. let mut i = 0; + // Index of the previous retained token, if there is one. + let mut ip: Option = None; let mut is_in_calc = false; let mut paren = 0; + // A vector of bools indicating which elements are to be retained. + let mut b = Vec::with_capacity(v.len()); while i < v.len() { if v[i] == Token::Other("calc") { @@ -587,39 +595,42 @@ fn clean_tokens(mut v: Vec>) -> Vec> { } } + let mut retain = true; if v[i].is_useless() { - if i > 0 && v[i - 1] == Token::Char(ReservedChar::CloseBracket) { + #[allow(clippy::if_same_then_else)] + if ip.is_some() && v[ip.unwrap()] == Token::Char(ReservedChar::CloseBracket) { if i + 1 < v.len() && (v[i + 1].is_useless() || v[i + 1] == Token::Char(ReservedChar::OpenCurlyBrace)) { - v.remove(i); - continue; + retain = false; } - } else if i > 0 - && (v[i - 1] == Token::Other("and") - || v[i - 1] == Token::Other("or") - || v[i - 1] == Token::Other("not")) - { + } else if ip.is_some() && matches!(v[ip.unwrap()], Token::Other("and" | "or" | "not")) { // retain the space after "and", "or" or "not" - } else if (is_in_calc && v[i - 1].is_useless()) - || !is_in_calc - && ((i > 0 - && ((v[i - 1].is_char() - && v[i - 1] != Token::Char(ReservedChar::CloseParenthese)) - || v[i - 1].is_a_media() - || v[i - 1].is_a_license())) - || (i < v.len() - 1 && v[i + 1].is_char())) + } else if is_in_calc && v[ip.unwrap()].is_useless() { + retain = false; + } else if !is_in_calc + && ((ip.is_some() && { + let prev = &v[ip.unwrap()]; + (prev.is_char() && prev != &Token::Char(ReservedChar::CloseParenthese)) + || prev.is_a_media() + || prev.is_a_license() + }) || (i < v.len() - 1 && v[i + 1].is_char())) { - v.remove(i); - continue; + retain = false; } } else if v[i].is_comment() { - v.remove(i); - continue; + retain = false; + } + if retain { + ip = Some(i); } + b.push(retain); i += 1; } + assert_eq!(v.len(), b.len()); + let mut b = b.into_iter(); + v.retain(|_| b.next().unwrap()); v } -- cgit v1.2.3