Skip to content

Commit

Permalink
[AssetMapper] Fix JavaScriptImportPathCompiler regression in regex
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilETaylor authored and nicolas-grekas committed Feb 29, 2024
1 parent 038e28c commit ae16b2d
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@
final class JavaScriptImportPathCompiler implements AssetCompilerInterface
{
/**
* @see https://regex101.com/r/1iBAIb/1
* @see https://regex101.com/r/1iBAIb/2
*/
private const IMPORT_PATTERN = '/
^
(?:\/\/.*) # Lines that start with comments
^(?:\/\/.*) # Lines that start with comments
|
(?:
\'(?:[^\'\\\\\n]|\\\\.)*\' # Strings enclosed in single quotes
\'(?:[^\'\\\\\n]|\\\\.)*+\' # Strings enclosed in single quotes
|
"(?:[^"\\\\\n]|\\\\.)*" # Strings enclosed in double quotes
"(?:[^"\\\\\n]|\\\\.)*+" # Strings enclosed in double quotes
)
|
(?: # Import statements (script captured)
Expand All @@ -49,7 +48,7 @@ final class JavaScriptImportPathCompiler implements AssetCompilerInterface
|
\bimport\(
)
\s*[\'"`](\.\/[^\'"`\n]+|(\.\.\/)*[^\'"`\n]+)[\'"`]\s*[;\)]
\s*[\'"`](\.\/[^\'"`\n]++|(\.\.\/)*+[^\'"`\n]++)[\'"`]\s*[;\)]
?
/mx';

Expand Down

0 comments on commit ae16b2d

Please sign in to comment.