8000 [AssetMapper] Fix `JavaScriptImportPathCompiler` regression in regex · symfony/symfony@ae16b2d · GitHub
[go: up one dir, main page]

Skip to content

Commit ae16b2d

Browse files
PhilETaylornicolas-grekas
authored andcommitted
[AssetMapper] Fix JavaScriptImportPathCompiler regression in regex
1 parent 038e28c commit ae16b2d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Symfony/Component/AssetMapper/Compiler/JavaScriptImportPathCompiler.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,15 @@
2828
final class JavaScriptImportPathCompiler implements AssetCompilerInterface
2929
{
3030
/**
31-
* @see https://regex101.com/r/1iBAIb/1
31+
* @see https://regex101.com/r/1iBAIb/2
3232
*/
3333
private const IMPORT_PATTERN = '/
34-
^
35-
(?:\/\/.*) # Lines that start with comments
34+
^(?:\/\/.*) # Lines that start with comments
3635
|
3736
(?:
38-
\'(?:[^\'\\\\\n]|\\\\.)*\' # Strings enclosed in single quotes
37+
\'(?:[^\'\\\\\n]|\\\\.)*+\' # Strings enclosed in single quotes
3938
|
40-
"(?:[^"\\\\\n]|\\\\.)*" # Strings enclosed in double quotes
39+
"(?:[^"\\\\\n]|\\\\.)*+" # Strings enclosed in double quotes
4140
)
4241
|
4342
(?: # Import statements (script captured)
@@ -49,7 +48,7 @@ final class JavaScriptImportPathCompiler implements AssetCompilerInterface
4948
|
5049
\bimport\(
5150
)
52-
\s*[\'"`](\.\/[^\'"`\n]+|(\.\.\/)*[^\'"`\n]+)[\'"`]\s*[;\)]
51+
\s*[\'"`](\.\/[^\'"`\n]++|(\.\.\/)*+[^\'"`\n]++)[\'"`]\s*[;\)]
5352
?
5453
/mx';
5554

0 commit comments

Comments
 (0)
0