From 09b9a1654852d0a46629460efb2edf43d419576e Mon Sep 17 00:00:00 2001 From: Angel M De Miguel Date: Tue, 17 Oct 2023 09:02:51 +0200 Subject: [PATCH] chore: stop using unicode in regexps and fix block one --- kits/javascript/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kits/javascript/src/main.rs b/kits/javascript/src/main.rs index e1f2046..1f4d990 100644 --- a/kits/javascript/src/main.rs +++ b/kits/javascript/src/main.rs @@ -29,11 +29,11 @@ enum JSWorkerType { /// Identify the worker source code to run it properly. fn identify_type(src: &str) -> JSWorkerType { // Detect default exported functions and objects - let default_regex = Regex::new(r"export\s+default\s+\w+;?").unwrap(); + let default_regex = Regex::new(r"(?-u)export\s+default\s+\w+;?").unwrap(); // Detect default exported object - let default_block_regex = Regex::new(r"export\s+default\s*\{(\s.+)*\};?").unwrap(); + let default_block_regex = Regex::new(r"(?-u)export\s+default\s*\{(\s.*)*\};?").unwrap(); // Detect exported functions with the "as" syntax like "export { app as default }"; - let default_as_regex = Regex::new(r"export\s*\{\s*\w+\s+(as default){1}\s*\};?").unwrap(); + let default_as_regex = Regex::new(r"(?-u)export\s*\{\s*\w+\s+(as default){1}\s*\};?").unwrap(); if default_regex.is_match(src) || default_block_regex.is_match(src)