$data = Unicode::
convertToUtf8($data,
$js_asset['attributes'
]['charset'
]);
} // Remove comments, whitespace, and optional braces.
try { $ast = Peast::
latest($data)->
parse();
$renderer =
new Renderer();
$renderer->
setFormatter(new CompactFormatter());
return $renderer->
render($ast);
} catch (\Exception
$exception) { if ($exception instanceof PeastSyntaxException
) { $position =
$exception->
getPosition();
Error::
logException($this->logger,
$exception, 'Syntax error: @message, File: @asset_file, Line: @asset_line, Column: @asset_column, Index: @asset_index',
[ '@asset_file' =>
$js_asset['data'
],
'@asset_line' =>
$position->
getLine(),
'@asset_column' =>
$position->
getColumn(),
'@asset_index' =>
$position->
getIndex(),
]);
} else { Error::
logException($this->logger,
$exception);
} return $data;
}