Skip to content

Commit

Permalink
fix(regex): [static] allow spaces after semicolons
Browse files Browse the repository at this point in the history
- https://regex101.com/r/wlYQUN/31

Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Mar 2, 2023
1 parent 1a5db78 commit c23a1c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion __tests__/ts/v4/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"outDir": "../../../dist",
"paths": {
"#src": ["src/index"],
"#src/*": ["src/*"]
"#src/*": ["src/*"],
"#tests/*": ["__tests__/*"]
},
"preserveConstEnums": true,
"preserveSymlinks": false,
Expand Down
2 changes: 1 addition & 1 deletion src/import-static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@
* @const {RegExp} STATIC_IMPORT_REGEX
*/
const STATIC_IMPORT_REGEX: RegExp =
/(?<=^|[\n;]|\n[\t ]+)import\s*(?<type>type(?=\s+))?(?:[\s"']*(?<imports>[\w\t\n\r "$'*,/{}-]+?)\s+from\s*)?["']\s*(?<specifier>(?:(?<='\s*)[^']*[^\s'](?=\s*'))|(?:(?<="\s*)[^"]*[^\s"](?=\s*")))\s*["'](?:\s+assert\s+(?<assertion>{[\w\t\n\r "':]+?}))?(?=[\s;]*)/g
/(?<=^|[\n;](?:[\t ]*(?:\w+ )?)?)import\s*(?<type>type(?=\s+))?(?:[\s"']*(?<imports>[\w\t\n\r "$'*,/{}-]+?)\s+from\s*)?["']\s*(?<specifier>(?:(?<='\s*)[^']*[^\s'](?=\s*'))|(?:(?<="\s*)[^"]*[^\s"](?=\s*")))\s*["'](?:\s+assert\s+(?<assertion>{[\w\t\n\r "':]+?}))?(?=[\s;]*)/g

export default STATIC_IMPORT_REGEX

0 comments on commit c23a1c5

Please sign in to comment.