JavaScript: Enhance `DEFINE_RE` to broaden supported syntaxes

This commit is contained in:
Johannes Meyer 2021-03-02 14:26:10 +01:00
parent b17be671bc
commit 4a2ab4740c
1 changed files with 2 additions and 1 deletions

View File

@ -12,7 +12,8 @@ use JShrink\Minifier;
class JavaScript
{
/** @var string */
const DEFINE_RE = '/(?<!\.)define\(\s*([\'"][^\'"]*[\'"])?[,\s]*(\[[^]]*\])?[,\s]*(function\s*\([^)]*\)|[^=]*=>)/';
const DEFINE_RE =
'/(?<!\.)define\(\s*([\'"][^\'"]*[\'"])?[,\s]*(\[[^]]*\])?[,\s]*((?>function\s*\([^)]*\)|[^=]*=>|\w+).*)/';
protected static $jsFiles = [
'js/helpers.js',