Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2681471
D25571.1734642786.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
D25571.1734642786.diff
View Options
diff --git a/externals/JsShrink/jsShrink.php b/externals/JsShrink/jsShrink.php
--- a/externals/JsShrink/jsShrink.php
+++ b/externals/JsShrink/jsShrink.php
@@ -11,7 +11,8 @@
function jsShrink($input) {
return preg_replace_callback('(
(?:
- (^|[-+\([{}=,:;!%^&*|?~]|/(?![/*])|return|throw) # context before regexp
+ (`(?:\\\\.|[^`\\\\])*`) # template literal
+ |(^|[-+\([{}=,:;!%^&*|?~]|/(?![/*])|return|throw) # context before regexp
(?:\s|//[^\n]*+\n|/\*(?:[^*]|\*(?!/))*+\*/)* # optional space
(/(?![/*])(?:
\\\\[^\n]
@@ -31,9 +32,11 @@
function jsShrinkCallback($match) {
static $last = '';
- $match += array_fill(1, 5, null); // avoid E_NOTICE
- list(, $context, $regexp, $result, $word, $operator) = $match;
- if ($word != '') {
+ $match += array_fill(1, 7, null); // avoid E_NOTICE
+ list(, $template, $context, $regexp, $result, $word, $operator) = $match;
+ if ($template) {
+ $result = $template;
+ } elseif ($word != '') {
$result = ($last == 'word' ? "\n" : ($last == 'return' ? " " : "")) . $result;
$last = ($word == 'return' || $word == 'throw' || $word == 'break' || $word == 'async' ? 'return' : 'word');
} elseif ($operator) {
diff --git a/src/applications/celerity/__tests__/transformer/min.js b/src/applications/celerity/__tests__/transformer/min.js
new file mode 100644
--- /dev/null
+++ b/src/applications/celerity/__tests__/transformer/min.js
@@ -0,0 +1,45 @@
+minify=1
+~~~~~~
+/**
+ * @provides templateliteral
+ */
+class TemplateLiteral {
+ static Init() {
+ this.Test1();
+ this.Test2();
+ }
+
+ static Test1() {
+ let object = "template literal";
+ let message = `This is a single-lined ${object}`;
+ alert(message);
+ }
+
+ static Test2() {
+ let object = "template literal";
+ let message = `This
+ is
+ a
+ multilined
+ ${object}`;
+ alert(message);
+ }
+}
+
+window.addEventListener("load", function () {
+ TemplateLiteral.Init();
+});
+~~~
+class
+TemplateLiteral{static
+Init(){this.Test1();this.Test2();}static
+Test1(){let
+object="template literal";let
+message=`This is a single-lined ${object}`;alert(message);}static
+Test2(){let
+object="template literal";let
+message=`This
+ is
+ a
+ multilined
+ ${object}`;alert(message);}}window.addEventListener("load",function(){TemplateLiteral.Init();});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 21:13 (17 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1015626
Default Alt Text
D25571.1734642786.diff (2 KB)
Attached To
Mode
D25571: T15774: Celerity: javascript minification issue with template literals (backticked strings)
Attached
Detach File
Event Timeline
Log In to Comment