Page MenuHomePhorge

D25571.1734642786.diff
No OneTemporary

D25571.1734642786.diff

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

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)

Event Timeline