fix(es/codegen): Fix codegen of string literals (#4037)

This commit is contained in:
Alexander Akait 2022-03-16 17:25:26 +03:00 committed by GitHub
parent 48cbf5d235
commit bd444c0ceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
347 changed files with 1193 additions and 914 deletions

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
console.log("🤭 \xfc");
console.log("\uD83E\uDD2D \xfc");

View File

@ -1,6 +1,6 @@
import React from "react";
export var HelloWorld = function() {
return /*#__PURE__*/ React.createElement("div", {
title: "您好SWC"
title: "\u60A8\u597DSWC"
});
};

View File

@ -9,6 +9,6 @@ const AnElement = ({ prop1 , prop2 , prop3 , num , data })=>{
prop2: true,
/* istanbul ignore if */ style: num > 0 ? data.name : undefined
}), // istanbul ignore next
!(num > 0) && data.name && /*#__PURE__*/ React.createElement(React.Fragment, null, "\"Hello\""));
!(num > 0) && data.name && /*#__PURE__*/ React.createElement(React.Fragment, null, '"Hello"'));
};
exports.AnElement = AnElement;

View File

@ -1 +1 @@
var USTAR = "ustar\x0000";
var USTAR = "ustar\000";

View File

@ -1 +1 @@
var USTAR = "ustar\x0000";
var USTAR = "ustar\000";

View File

@ -1,9 +1,8 @@
{
"mappings": "kEAAA,MAAM,SAAS,QAAQ,CAACA,CAAU,CAAC,CAAQ,CAAE,CAAC,IAATC,CAAI,CAAN,CAAQ,CAANA,IAAI,CACrC,MAAM,qBAAEC,CAAG,UAAED,CAAI,CAACE,GAAG,CACzB,CAAC,CAED,MAAM,UAAgBC,cAAc,UAAdA,CAAc,gCAAdA,CAAc,UAAdA,CAAc,2BAA7B,QAAQ,IAAwB,CAAC,uFAC7B,CAAC,AACJC,KAAK,CAAE,CAAC,AACJJ,IAAI,CAAE,CAAC,AACHE,GAAG,CAAE,CAAK,IACd,CAAC,AACL,CAAC,AACL,CAAC,uCACL,CAAC",
"mappings": "kEAAA,MAAM,SAAS,QAAQ,CAACA,CAAU,CAAC,CAAQ,CAAE,CAAC,IAATC,CAAI,CAAN,CAAQ,CAANA,IAAI,CACrC,MAAM,gCAAOA,CAAI,CAACC,GAAG,CACzB,CAAC,CAED,MAAM,UAAgBC,cAAc,UAAdA,CAAc,gCAAdA,CAAc,UAAdA,CAAc,2BAA7B,QAAQ,IAAwB,CAAC,uFAC7B,CAAC,AACJC,KAAK,CAAE,CAAC,AACJH,IAAI,CAAE,CAAC,AACHC,GAAG,MACP,CAAC,AACL,CAAC,AACL,CAAC,uCACL,CAAC",
"names": [
"StaticPage",
"data",
"div",
"foo",
"getStaticProps",
"props"

View File

@ -1,5 +1,5 @@
{
"mappings": "CEACA,IAAI,CAAC,gBAAkB,GAAIA,IAAI,CAAC,gBAAkB,IAAK,CAAC,CAAC,EAAEC,IAAI,CAAC,CAAC;IAAA,CAAC;AAAA,WAAG;IAAA,CAAC;IAAE,CAAC;AAEhE,YAAI,EACH,QAAQ,CAAEC,CAAuB,EAAEC,CAAmB,EAAEC,CAAmB,EAAE,CAAC;YAE7E,CAAY,WAAA,CAAC;gBFJvBC,CAAO,GAAP,QAAA,CAAOC,CAAA,EAAA,CAAA;gBAAM,GAAK,CAAAC,CAAA,GAAAD,CAAA,CAAAC,IAAA;gBAAlB,MAAA,KAAAC,CAAA,CAAAC,GAAA,EAAA,CAAA,MAAA,CAAA;oBACDC,QAAA,EAAAH,CAAA,CAAAI,GAAA;gBAAA,CAAA;YAAA,CAAA;YAIWP,CAAmB,CAACQ,CAAC,CAACT,CAAmB,GAC5BC,CAAmB,CAACS,CAAC,CAACV,CAAmB,EAAE,CAAC;gBAC1C,CAAS,UAAE,QAAQ,GAAI,CAAC;oBAAC,MAAM,CAAeW,CAAO;gBAAE,CAAC;gBACxD,CAAS,UAAE,QAAQ,GAAI,CAAC;oBAAC,MAAM,CAAeT,CAAU;gBAAE,CAAC;YAE1E,CAAC,CAXb;YAYyB,GAAG,CAACG,CAA8C,GAAGJ,CAAmB,CAAC,IAAI,GAZzDU,CAAA,IAAA,CAAA;QAE5C,CAAA;AAAA,YAAA,ECDD,QAAA,CAAAZ,CAAA,EAAAa,CAAA,EAAAX,CAAA,EAAA,CAAA;aAGAY,MAAe,CAAAC,QAAA,GAAAD,MAAQ,CAAAC,QAA8B,IAAA,CAAA,CAAA,EAAAhB,IAAA,CAAA,CAAA;gBACrD,CAAA;gBACA,QAAA,GAAA,CAAA;oBAKK,MAAA,CAAAG,CAAA,CAAA,IAAA;gBACL,CAAA;YAAA,CAAA,CAAA,CAAA;QAAA,CAAA;IAAA,CAAA;IAAA,QAAA,CAAAA,CAAA,EAAA,CAAA;QAAAA,CAAA,CAAAc,CAAA,CAAA,CAAA,EAAA,CAAA;AAAA,eAAA;AAAA,eAAA;AAAA,eAAA;QAAA,CAAA,EAAA,QAAA,GAAA,CAAA;YAAA,MAAA,CAAAd,CAAA,CAAAA,CAAA,CAAAe,CAAA,GAAA,IAAA;QAAA,CAAA,GAAAC,IAAA,GAAAhB,CAAA,CAAAc,CAAA,EAZA;IAYA,CAAA;AAAA,CAAA,CAAA,CAAA",
"mappings": "CEACA,IAAI,CAAC,gBAAkB,GAAIA,IAAI,CAAC,gBAAkB,IAAK,CAAC,CAAC,EAAEC,IAAI,CAAC,CAAC;IAAA,CAAC;AAAA,WAAG;IAAA,CAAC;IAAE,CAAC;AAEhE,YAAI,EACH,QAAQ,CAAEC,CAAuB,EAAEC,CAAmB,EAAEC,CAAmB,EAAE,CAAC;wBAEjE,CAAC;gBFJvBC,CAAO,GAAP,QAAA,CAAOC,CAAA,EAAA,CAAA;gBAAM,GAAK,CAAAC,CAAA,GAAAD,CAAA,CAAAC,IAAA;gBAAlB,MAAA,KAAAC,CAAA,CAAAC,GAAA,SAAA,CAAA;oBACDC,QAAA,EAAAH,CAAA,CAAAI,GAAA;gBAAA,CAAA;YAAA,CAAA;YAIWP,CAAmB,CAACQ,CAAC,CAACT,CAAmB,GAC5BC,CAAmB,CAACS,CAAC,CAACV,CAAmB,EAAE,CAAC;2BAC/B,QAAQ,GAAI,CAAC;oBAAC,MAAM,CAAeW,CAAO;gBAAE,CAAC;2BAC7C,QAAQ,GAAI,CAAC;oBAAC,MAAM,CAAeT,CAAU;gBAAE,CAAC;YAE1E,CAAC,CAXb;YAYyB,GAAG,CAACG,CAA8C,GAAGJ,CAAmB,CAAC,IAAI,GAZzDU,CAAA,IAAA,CAAA;QAE5C,CAAA;AAAA,YAAA,ECDD,QAAA,CAAAZ,CAAA,EAAAa,CAAA,EAAAX,CAAA,EAAA,CAAA;aAGAY,MAAe,CAAAC,QAAA,GAAAD,MAAQ,CAAAC,QAA8B,IAAA,CAAA,CAAA,EAAAhB,IAAA,CAAA,CAAA;;gBAErD,QAAA,GAAA,CAAA;oBAKK,MAAA,CAAAG,CAAA,CAAA,IAAA;gBACL,CAAA;YAAA,CAAA,CAAA,CAAA;QAAA,CAAA;IAAA,CAAA;IAAA,QAAA,CAAAA,CAAA,EAAA,CAAA;QAAAA,CAAA,CAAAc,CAAA,CAAA,CAAA,EAAA,CAAA;AAAA,eAAA;AAAA,eAAA;AAAA,eAAA;QAAA,CAAA,EAAA,QAAA,GAAA,CAAA;YAAA,MAAA,CAAAd,CAAA,CAAAA,CAAA,CAAAe,CAAA,GAAA,IAAA;QAAA,CAAA,GAAAC,IAAA,GAAAhB,CAAA,CAAAc,CAAA,EAZA;IAYA,CAAA;AAAA,CAAA,CAAA,CAAA",
"names": [
"self",
"push",

View File

@ -7,11 +7,11 @@ var Foo2;
Foo2["hello"] = "42";
})(Foo2 || (Foo2 = {}));
console.log(Foo.hello, Foo2.hello);
console.log("hello", "こんにちは", '안녕하세요', "你好");
console.log("hello", "\u3053\u3093\u306B\u3061\u306F", '\uC548\uB155\uD558\uC138\uC694', "\u4F60\u597D");
var Hello;
(function(Hello) {
Hello["en"] = "hello";
Hello['ja-JP'] = "こんにちは";
Hello["ko-KR"] = '안녕하세요';
Hello["zh-CN"] = "你好";
Hello['ja-JP'] = "\u3053\u3093\u306B\u3061\u306F";
Hello["ko-KR"] = '\uC548\uB155\uD558\uC138\uC694';
Hello["zh-CN"] = "\u4F60\u597D";
})(Hello || (Hello = {}));

View File

@ -94,7 +94,7 @@ var TypeScript;
result += "\\r";
break;
case 34:
result += "\\\"";
result += '\\"';
break;
case 39:
result += "\\'";

View File

@ -95,7 +95,7 @@ import * as swcHelpers from "@swc/helpers";
result += "\\r";
break;
case 34:
result += "\\\"";
result += '\\"';
break;
case 39:
result += "\\'";

View File

@ -1,3 +1,3 @@
eval("\xa0var x\xa0= 1\xa0"), 1 !== x && $ERROR("#1: eval(\"\\u00A0var x\\u00A0= 1\\u00A0\"); x === 1. Actual: " + x);
eval("\xa0var x\xa0= 1\xa0"), 1 !== x && $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + x);
var x = 1;
1 !== x && $ERROR("#2: \xa0var x\xa0= 1\xa0; x === 1. Actual: " + x);

View File

@ -1,3 +1,3 @@
eval("\xa0var x\xa0= 1\xa0"), 1 !== x && $ERROR("#1: eval(\"\\u00A0var x\\u00A0= 1\\u00A0\"); x === 1. Actual: " + x);
eval("\xa0var x\xa0= 1\xa0"), 1 !== x && $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + x);
var x = 1;
1 !== x && $ERROR("#2: \xa0var x\xa0= 1\xa0; x === 1. Actual: " + x);

View File

@ -8,133 +8,133 @@
*/ //CHECK#А-Я
var А = 1;
if (А !== 1) {
$ERROR('#А');
$ERROR('#\u0410');
}
var Б = 1;
if (Б !== 1) {
$ERROR('#Б');
$ERROR('#\u0411');
}
var В = 1;
if (В !== 1) {
$ERROR('#В');
$ERROR('#\u0412');
}
var Г = 1;
if (Г !== 1) {
$ERROR('#Г');
$ERROR('#\u0413');
}
var Д = 1;
if (Д !== 1) {
$ERROR('#Д');
$ERROR('#\u0414');
}
var Е = 1;
if (Е !== 1) {
$ERROR('#Е');
$ERROR('#\u0415');
}
var Ж = 1;
if (Ж !== 1) {
$ERROR('#Ж');
$ERROR('#\u0416');
}
var З = 1;
if (З !== 1) {
$ERROR('#З');
$ERROR('#\u0417');
}
var И = 1;
if (И !== 1) {
$ERROR('#И');
$ERROR('#\u0418');
}
var Й = 1;
if (Й !== 1) {
$ERROR('#Й');
$ERROR('#\u0419');
}
var К = 1;
if (К !== 1) {
$ERROR('#К');
$ERROR('#\u041A');
}
var Л = 1;
if (Л !== 1) {
$ERROR('#Л');
$ERROR('#\u041B');
}
var М = 1;
if (М !== 1) {
$ERROR('#М');
$ERROR('#\u041C');
}
var Н = 1;
if (Н !== 1) {
$ERROR('#Н');
$ERROR('#\u041D');
}
var О = 1;
if (О !== 1) {
$ERROR('#О');
$ERROR('#\u041E');
}
var П = 1;
if (П !== 1) {
$ERROR('#П');
$ERROR('#\u041F');
}
var Р = 1;
if (Р !== 1) {
$ERROR('#Р');
$ERROR('#\u0420');
}
var С = 1;
if (С !== 1) {
$ERROR('#С');
$ERROR('#\u0421');
}
var Т = 1;
if (Т !== 1) {
$ERROR('#Т');
$ERROR('#\u0422');
}
var У = 1;
if (У !== 1) {
$ERROR('#У');
$ERROR('#\u0423');
}
var Ф = 1;
if (Ф !== 1) {
$ERROR('#Ф');
$ERROR('#\u0424');
}
var Х = 1;
if (Х !== 1) {
$ERROR('#Х');
$ERROR('#\u0425');
}
var Ц = 1;
if (Ц !== 1) {
$ERROR('#Ц');
$ERROR('#\u0426');
}
var Ч = 1;
if (Ч !== 1) {
$ERROR('#Ч');
$ERROR('#\u0427');
}
var Ш = 1;
if (Ш !== 1) {
$ERROR('#Ш');
$ERROR('#\u0428');
}
var Щ = 1;
if (Щ !== 1) {
$ERROR('#Щ');
$ERROR('#\u0429');
}
var Ъ = 1;
if (Ъ !== 1) {
$ERROR('#Ъ');
$ERROR('#\u042A');
}
var Ы = 1;
if (Ы !== 1) {
$ERROR('#Ы');
$ERROR('#\u042B');
}
var Ь = 1;
if (Ь !== 1) {
$ERROR('#Ь');
$ERROR('#\u042C');
}
var Э = 1;
if (Э !== 1) {
$ERROR('#Э');
$ERROR('#\u042D');
}
var Ю = 1;
if (Ю !== 1) {
$ERROR('#Ю');
$ERROR('#\u042E');
}
var Я = 1;
if (Я !== 1) {
$ERROR('#Я');
$ERROR('#\u042F');
}
var Ё = 1;
if (Ё !== 1) {
$ERROR('#Ё');
$ERROR('#\u0401');
}

View File

@ -6,7 +6,7 @@ var Formatting;
var result = this.GetIndentationEditsWorker(token, nextToken, node, sameLineIndent);
if (this.logger.information()) for(var i = 0; i < result.count(); i++){
var edit = result.get(i);
this.logger.log("edit: minChar=" + edit.position + ", limChar=" + (edit.position + edit.length) + ", text=\"" + TypeScript.stringToLiteral(edit.replaceWith, 30) + "\"");
this.logger.log("edit: minChar=" + edit.position + ", limChar=" + (edit.position + edit.length) + ', text="' + TypeScript.stringToLiteral(edit.replaceWith, 30) + '"');
}
return result;
}

View File

@ -12,7 +12,7 @@ import * as swcHelpers from "@swc/helpers";
var result = this.GetIndentationEditsWorker(token, nextToken, node, sameLineIndent);
if (this.logger.information()) for(var i = 0; i < result.count(); i++){
var edit = result.get(i);
this.logger.log("edit: minChar=" + edit.position + ", limChar=" + (edit.position + edit.length) + ", text=\"" + TypeScript.stringToLiteral(edit.replaceWith, 30) + "\"");
this.logger.log("edit: minChar=" + edit.position + ", limChar=" + (edit.position + edit.length) + ', text="' + TypeScript.stringToLiteral(edit.replaceWith, 30) + '"');
}
return result;
}, _proto.GetIndentationEditsWorker = function(token, nextToken, node, sameLineIndent) {

View File

@ -1,3 +1,3 @@
eval("\xa0var x\xa0= 1\xa0"), 1 !== x && $ERROR("#1: eval(\"\\u00A0var x\\u00A0= 1\\u00A0\"); x === 1. Actual: " + x);
eval("\xa0var x\xa0= 1\xa0"), 1 !== x && $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + x);
var x = 1;
1 !== x && $ERROR("#2: \xa0var x\xa0= 1\xa0; x === 1. Actual: " + x);

View File

@ -1,3 +1,3 @@
eval("\xa0var x\xa0= 1\xa0"), 1 !== x && $ERROR("#1: eval(\"\\u00A0var x\\u00A0= 1\\u00A0\"); x === 1. Actual: " + x);
eval("\xa0var x\xa0= 1\xa0"), 1 !== x && $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + x);
var x = 1;
1 !== x && $ERROR("#2: \xa0var x\xa0= 1\xa0; x === 1. Actual: " + x);

View File

@ -8,133 +8,133 @@
*/ //CHECK#А-Я
var А = 1;
if (А !== 1) {
$ERROR('#А');
$ERROR('#\u0410');
}
var Б = 1;
if (Б !== 1) {
$ERROR('#Б');
$ERROR('#\u0411');
}
var В = 1;
if (В !== 1) {
$ERROR('#В');
$ERROR('#\u0412');
}
var Г = 1;
if (Г !== 1) {
$ERROR('#Г');
$ERROR('#\u0413');
}
var Д = 1;
if (Д !== 1) {
$ERROR('#Д');
$ERROR('#\u0414');
}
var Е = 1;
if (Е !== 1) {
$ERROR('#Е');
$ERROR('#\u0415');
}
var Ж = 1;
if (Ж !== 1) {
$ERROR('#Ж');
$ERROR('#\u0416');
}
var З = 1;
if (З !== 1) {
$ERROR('#З');
$ERROR('#\u0417');
}
var И = 1;
if (И !== 1) {
$ERROR('#И');
$ERROR('#\u0418');
}
var Й = 1;
if (Й !== 1) {
$ERROR('#Й');
$ERROR('#\u0419');
}
var К = 1;
if (К !== 1) {
$ERROR('#К');
$ERROR('#\u041A');
}
var Л = 1;
if (Л !== 1) {
$ERROR('#Л');
$ERROR('#\u041B');
}
var М = 1;
if (М !== 1) {
$ERROR('#М');
$ERROR('#\u041C');
}
var Н = 1;
if (Н !== 1) {
$ERROR('#Н');
$ERROR('#\u041D');
}
var О = 1;
if (О !== 1) {
$ERROR('#О');
$ERROR('#\u041E');
}
var П = 1;
if (П !== 1) {
$ERROR('#П');
$ERROR('#\u041F');
}
var Р = 1;
if (Р !== 1) {
$ERROR('#Р');
$ERROR('#\u0420');
}
var С = 1;
if (С !== 1) {
$ERROR('#С');
$ERROR('#\u0421');
}
var Т = 1;
if (Т !== 1) {
$ERROR('#Т');
$ERROR('#\u0422');
}
var У = 1;
if (У !== 1) {
$ERROR('#У');
$ERROR('#\u0423');
}
var Ф = 1;
if (Ф !== 1) {
$ERROR('#Ф');
$ERROR('#\u0424');
}
var Х = 1;
if (Х !== 1) {
$ERROR('#Х');
$ERROR('#\u0425');
}
var Ц = 1;
if (Ц !== 1) {
$ERROR('#Ц');
$ERROR('#\u0426');
}
var Ч = 1;
if (Ч !== 1) {
$ERROR('#Ч');
$ERROR('#\u0427');
}
var Ш = 1;
if (Ш !== 1) {
$ERROR('#Ш');
$ERROR('#\u0428');
}
var Щ = 1;
if (Щ !== 1) {
$ERROR('#Щ');
$ERROR('#\u0429');
}
var Ъ = 1;
if (Ъ !== 1) {
$ERROR('#Ъ');
$ERROR('#\u042A');
}
var Ы = 1;
if (Ы !== 1) {
$ERROR('#Ы');
$ERROR('#\u042B');
}
var Ь = 1;
if (Ь !== 1) {
$ERROR('#Ь');
$ERROR('#\u042C');
}
var Э = 1;
if (Э !== 1) {
$ERROR('#Э');
$ERROR('#\u042D');
}
var Ю = 1;
if (Ю !== 1) {
$ERROR('#Ю');
$ERROR('#\u042E');
}
var Я = 1;
if (Я !== 1) {
$ERROR('#Я');
$ERROR('#\u042F');
}
var Ё = 1;
if (Ё !== 1) {
$ERROR('#Ё');
$ERROR('#\u0401');
}

View File

@ -1,2 +1,2 @@
// @target: es6
var x = "\x00\x00\x00 0 00 0000";
var x = "\0\0\0 0 00 0000";

View File

@ -1 +1 @@
var x = "\x00\x00\x00 0 00 0000";
var x = "\0\0\0 0 00 0000";

View File

@ -1 +1 @@
"\t\v\f \xa0";
"\t\v\f \xa0\uFEFF";

View File

@ -1 +1 @@
"\t\v\f \xa0";
"\t\v\f \xa0\uFEFF";

View File

@ -15,5 +15,5 @@ var M;
y: ""
}));
// Quotes
var x = /*#__PURE__*/ React.createElement("div", null, "This \"quote\" thing");
var x = /*#__PURE__*/ React.createElement("div", null, 'This "quote" thing');
})(M || (M = {}));

View File

@ -15,5 +15,5 @@ var M;
y: ""
}));
// Quotes
var x = /*#__PURE__*/ React.createElement("div", null, "This \"quote\" thing");
var x = /*#__PURE__*/ React.createElement("div", null, 'This "quote" thing');
})(M || (M = {}));

View File

@ -1,11 +1,11 @@
/*#__PURE__*/ React.createElement("div", null, "Dot goes here: \xb7 &notAnEntity; ");
/*#__PURE__*/ React.createElement("div", null, "Be careful of \"-ed strings!");
/*#__PURE__*/ React.createElement("div", null, 'Be careful of "-ed strings!');
/*#__PURE__*/ React.createElement("div", null, "{{braces}}");
// Escapes do nothing
/*#__PURE__*/ React.createElement("div", null, "\\n");
// Also works in string literal attributes
/*#__PURE__*/ React.createElement("div", {
attr: "{}\\"
attr: "{\u2026}\\"
});
// Does not happen for a string literal that happens to be inside an attribute (and escapes then work)
/*#__PURE__*/ React.createElement("div", {
@ -13,7 +13,7 @@
});
// Preserves single quotes
/*#__PURE__*/ React.createElement("div", {
attr: "\""
attr: '"'
});
// https://github.com/microsoft/TypeScript/issues/35732
/*#__PURE__*/ React.createElement("div", null, "🐈🐕🐇🐑");
/*#__PURE__*/ React.createElement("div", null, "\u{1F408}\u{1F415}\u{1F407}\u{1F411}");

View File

@ -1,11 +1,11 @@
/*#__PURE__*/ React.createElement("div", null, "Dot goes here: \xb7 &notAnEntity; ");
/*#__PURE__*/ React.createElement("div", null, "Be careful of \"-ed strings!");
/*#__PURE__*/ React.createElement("div", null, 'Be careful of "-ed strings!');
/*#__PURE__*/ React.createElement("div", null, "{{braces}}");
// Escapes do nothing
/*#__PURE__*/ React.createElement("div", null, "\\n");
// Also works in string literal attributes
/*#__PURE__*/ React.createElement("div", {
attr: "{}\\"
attr: "{\u2026}\\"
});
// Does not happen for a string literal that happens to be inside an attribute (and escapes then work)
/*#__PURE__*/ React.createElement("div", {
@ -13,7 +13,7 @@
});
// Preserves single quotes
/*#__PURE__*/ React.createElement("div", {
attr: "\""
attr: '"'
});
// https://github.com/microsoft/TypeScript/issues/35732
/*#__PURE__*/ React.createElement("div", null, "🐈🐕🐇🐑");
/*#__PURE__*/ React.createElement("div", null, "\uD83D\uDC08\uD83D\uDC15\uD83D\uDC07\uD83D\uDC11");

View File

@ -1,2 +1,2 @@
// @target: es5
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es6
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es5
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es6
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es5
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es6
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es5
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es6
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es5
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es6
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es5
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es6
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es5
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es6
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es5
var x = "\x00";
var x = "\0";

View File

@ -1,2 +1,2 @@
// @target: es6
var x = "\x00";
var x = "\0";

View File

@ -11,9 +11,9 @@ Promise.all(assignAll).then(function() {
e += "'".concat(a.id, "', ");
var c = yield listOfUser(a.id);
c.forEach(function(b) {
insertQuery += "INSERT INTO \"TABLE\"(\"UUID\", id, other_ids_here) VALUES ('".concat(uuidv4(), "', '").concat(a.id, "', now());");
insertQuery += 'INSERT INTO "TABLE"("UUID", id, other_ids_here) VALUES (\''.concat(uuidv4(), "', '").concat(a.id, "', now());");
});
}, e = "DELETE FROM \"TABLE\" WHERE \"UUID\" IN ( ", obj)d(f);
}, e = 'DELETE FROM "TABLE" WHERE "UUID" IN ( ', obj)d(f);
case 3:
case "end":
return a.stop();
@ -31,7 +31,7 @@ export var listOfUser = function(d) {
return b.wrap(function(a) {
for(;;)switch(a.prev = a.next){
case 0:
f = "Select Distinct id from \"TABLE\" Where id = '".concat(d, "' And user_id IS not null"), postgreSQL.query(f, null, function(a, b) {
f = 'Select Distinct id from "TABLE" Where id = \''.concat(d, "' And user_id IS not null"), postgreSQL.query(f, null, function(a, b) {
a ? e(a) : c(b.rows);
});
case 2:

View File

@ -1,7 +1,7 @@
import * as a from "@swc/helpers";
Promise.all(assignAll).then(function() {
var b = a.asyncToGenerator(function*(e) {
let b = "DELETE FROM \"TABLE\" WHERE \"UUID\" IN ( ";
let b = 'DELETE FROM "TABLE" WHERE "UUID" IN ( ';
for(let c in obj){
let a = obj[c];
b += `'${a.id}', `;

View File

@ -108,7 +108,7 @@ export default function Home() {
className: styles.card,
children: [
/*#__PURE__*/ _jsxDEV("h2", {
children: "Documentation "
children: "Documentation \u2192"
}, void 0, false, {
fileName: "$DIR/tests/vercel/loader-only/next-33291/1-automatic/input/index.js",
lineNumber: 37,
@ -132,7 +132,7 @@ export default function Home() {
className: styles.card,
children: [
/*#__PURE__*/ _jsxDEV("h2", {
children: "Learn "
children: "Learn \u2192"
}, void 0, false, {
fileName: "$DIR/tests/vercel/loader-only/next-33291/1-automatic/input/index.js",
lineNumber: 42,
@ -156,7 +156,7 @@ export default function Home() {
className: styles.card,
children: [
/*#__PURE__*/ _jsxDEV("h2", {
children: "Examples "
children: "Examples \u2192"
}, void 0, false, {
fileName: "$DIR/tests/vercel/loader-only/next-33291/1-automatic/input/index.js",
lineNumber: 50,
@ -180,7 +180,7 @@ export default function Home() {
className: styles.card,
children: [
/*#__PURE__*/ _jsxDEV("h2", {
children: "Deploy "
children: "Deploy \u2192"
}, void 0, false, {
fileName: "$DIR/tests/vercel/loader-only/next-33291/1-automatic/input/index.js",
lineNumber: 58,

View File

@ -126,7 +126,7 @@ export default function Home() {
columnNumber: 13
},
__self: this
}, "Documentation "), /*#__PURE__*/ React.createElement("p", {
}, "Documentation \u2192"), /*#__PURE__*/ React.createElement("p", {
__source: {
fileName: "$DIR/tests/vercel/loader-only/next-33291/2-classic/input/index.js",
lineNumber: 38,
@ -149,7 +149,7 @@ export default function Home() {
columnNumber: 13
},
__self: this
}, "Learn "), /*#__PURE__*/ React.createElement("p", {
}, "Learn \u2192"), /*#__PURE__*/ React.createElement("p", {
__source: {
fileName: "$DIR/tests/vercel/loader-only/next-33291/2-classic/input/index.js",
lineNumber: 43,
@ -172,7 +172,7 @@ export default function Home() {
columnNumber: 13
},
__self: this
}, "Examples "), /*#__PURE__*/ React.createElement("p", {
}, "Examples \u2192"), /*#__PURE__*/ React.createElement("p", {
__source: {
fileName: "$DIR/tests/vercel/loader-only/next-33291/2-classic/input/index.js",
lineNumber: 51,
@ -195,7 +195,7 @@ export default function Home() {
columnNumber: 13
},
__self: this
}, "Deploy "), /*#__PURE__*/ React.createElement("p", {
}, "Deploy \u2192"), /*#__PURE__*/ React.createElement("p", {
__source: {
fileName: "$DIR/tests/vercel/loader-only/next-33291/2-classic/input/index.js",
lineNumber: 59,

View File

@ -13,7 +13,7 @@ mod tests {
assert_min("false", "false");
assert_min("42", "42");
assert_min("3.14", "3.14");
assert_min(r#" 'foobar' "#, r#"'foobar'"#);
assert_min(r#" 'foobar' "#, r#""foobar""#);
}
#[test]

View File

@ -492,42 +492,49 @@ where
fn emit_str_lit(&mut self, node: &Str) -> Result {
self.emit_leading_comments_of_span(node.span(), false)?;
let (single_quote, value) = match node.kind {
match node.kind {
StrKind::Normal { contains_quote } => {
let single_quote = if contains_quote {
is_single_quote(&self.cm, node.span)
let is_invalid_use_strict = node.has_escape && &*node.value == "use strict";
if self.cfg.minify && !is_invalid_use_strict {
let value = get_quoted_utf16(&node.value, self.wr.target(), false, false, true);
self.wr.write_str_lit(DUMMY_SP, &value)?;
} else {
None
};
let single_quote = if contains_quote {
is_single_quote(&self.cm, node.span)
} else {
None
};
let value = escape_with_source(
&self.cm,
self.wr.target(),
node.span,
&node.value,
single_quote,
);
let value = escape_with_source(
&self.cm,
self.wr.target(),
node.span,
&node.value,
single_quote,
is_invalid_use_strict,
);
(single_quote.unwrap_or(false), value)
let single_quote = single_quote.unwrap_or(false);
if single_quote {
punct!(node.span, "'");
self.wr.write_str_lit(DUMMY_SP, &value)?;
punct!("'");
} else {
punct!(node.span, "\"");
self.wr.write_str_lit(DUMMY_SP, &value)?;
punct!("\"");
}
}
}
StrKind::Synthesized => {
let single_quote = false;
let value =
escape_without_source(&node.value, self.wr.target(), single_quote, false);
let value = get_quoted_utf16(&node.value, self.wr.target(), false, false, true);
(single_quote, value)
self.wr.write_str_lit(DUMMY_SP, &value)?;
}
};
if single_quote {
punct!(node.span, "'");
self.wr.write_str_lit(DUMMY_SP, &value)?;
punct!("'");
} else {
punct!(node.span, "\"");
self.wr.write_str_lit(DUMMY_SP, &value)?;
punct!("\"");
}
}
#[emitter]
@ -3120,45 +3127,65 @@ fn unescape_tpl_lit(s: &str, is_synthesized: bool) -> String {
result
}
fn escape_without_source(
fn get_quoted_utf16(
v: &str,
target: EsVersion,
single_quote: bool,
emit_non_ascii_as_unicode: bool,
pure_quotes: bool,
) -> String {
let mut buf = String::with_capacity(v.len());
let mut iter = v.chars().peekable();
let mut sq = 0;
let mut dq = 0;
while let Some(c) = iter.next() {
match c {
'\x00' => {
let next = iter.peek();
match next {
Some('1'..='9') => buf.push_str("\\x00"),
_ => buf.push_str("\\0"),
}
}
'\u{0008}' => buf.push_str("\\b"),
'\u{000c}' => buf.push_str("\\f"),
'\n' => buf.push_str("\\n"),
'\r' => buf.push_str("\\r"),
'\t' => buf.push_str("\\t"),
'\u{000b}' => buf.push_str("\\v"),
'\0' => buf.push_str("\\x00"),
'\t' => buf.push_str("\\t"),
'\\' => buf.push_str("\\\\"),
'\'' => {
if pure_quotes {
sq += 1;
'\\' => {
if iter.peek() == Some(&'\0') {
buf.push('\\');
iter.next();
buf.push('\'');
} else if single_quote {
buf.push_str("\\'");
} else {
buf.push_str("\\\\")
buf.push('\'');
}
}
'\'' if single_quote => buf.push_str("\\'"),
'"' if !single_quote => buf.push_str("\\\""),
'"' => {
if pure_quotes {
dq += 1;
buf.push('"');
} else if !single_quote {
buf.push_str("\\\"");
} else {
buf.push('\"');
}
}
'\x01'..='\x0f' => {
let _ = write!(buf, "\\x0{:x}", c as u8);
}
'\x10'..='\x1f' => {
let _ = write!(buf, "\\x{:x}", c as u8);
}
'\x20'..='\x7e' => {
//
buf.push(c);
}
'\u{7f}'..='\u{ff}' => {
@ -3170,8 +3197,11 @@ fn escape_without_source(
'\u{2029}' => {
buf.push_str("\\u2029");
}
'\u{FEFF}' => {
buf.push_str("\\uFEFF");
}
_ => {
if !emit_non_ascii_as_unicode || c.is_ascii() {
if c.is_ascii() {
buf.push(c);
} else if c > '\u{FFFF}' {
// if we've got this far the char isn't reserved and if the callee has specified
@ -3195,7 +3225,15 @@ fn escape_without_source(
}
}
buf
if pure_quotes {
if dq > sq {
format!("'{}'", buf.replace('\'', "\\'"))
} else {
format!("\"{}\"", buf.replace('"', "\\\""))
}
} else {
buf
}
}
fn escape_with_source(
@ -3204,34 +3242,36 @@ fn escape_with_source(
span: Span,
s: &str,
single_quote: Option<bool>,
is_invalid_use_strict: bool,
) -> String {
if span.is_dummy() {
return escape_without_source(s, target, single_quote.unwrap_or(false), false);
return get_quoted_utf16(s, target, single_quote.unwrap_or(false), false, false);
}
let orig = cm.span_to_snippet(span);
let orig = match orig {
Ok(orig) => orig,
Err(v) => {
return escape_without_source(s, target, single_quote.unwrap_or(false), false);
return get_quoted_utf16(s, target, single_quote.unwrap_or(false), false, false);
}
};
if is_invalid_use_strict {
return orig[1..orig.len() - 1].to_string();
}
if target <= EsVersion::Es5 {
let emit_non_ascii_as_unicode = orig.contains("\\u");
return escape_without_source(
return get_quoted_utf16(
s,
target,
single_quote.unwrap_or(false),
emit_non_ascii_as_unicode,
false,
);
}
if single_quote.is_some() && orig.len() <= 2 {
return escape_without_source(s, target, single_quote.unwrap_or(false), false);
}
let mut orig = &*orig;
if (single_quote == Some(true) && orig.starts_with('\''))
@ -3239,7 +3279,7 @@ fn escape_with_source(
{
orig = &orig[1..orig.len() - 1];
} else if single_quote.is_some() {
return escape_without_source(s, target, single_quote.unwrap_or(false), false);
return get_quoted_utf16(s, target, single_quote.unwrap_or(false), false, false);
}
let mut buf = String::with_capacity(s.len());

View File

@ -106,7 +106,7 @@ mod tests {
fn import() {
assert_min(
"import colors, { color } from 'patterns/colors';",
"import colors,{color}from'patterns/colors'",
"import colors,{color}from\"patterns/colors\"",
);
assert_pretty(
"import colors, { color } from 'patterns/colors';",
@ -116,12 +116,12 @@ mod tests {
#[test]
fn issue_204_01() {
assert_min(r#"'\r\n';"#, r#"'\r\n'"#);
assert_min(r#"'\r\n';"#, r#""\r\n""#);
}
#[test]
fn issue_204_02() {
assert_min(r#"const a = fn() + '\r\n';"#, r#"const a=fn()+'\r\n'"#);
assert_min(r#"const a = fn() + '\r\n';"#, r#"const a=fn()+"\r\n""#);
}
#[test]
@ -148,7 +148,7 @@ const Link = 'Boo';",
fn issue_266() {
assert_min(
"'Q' + +x1 + ',' + +y1 + ',' + (this._x1 = +x) + ',' + (this._y1 = +y);",
"'Q'+ +x1+','+ +y1+','+(this._x1=+x)+','+(this._y1=+y)",
"\"Q\"+ +x1+\",\"+ +y1+\",\"+(this._x1=+x)+\",\"+(this._y1=+y)",
);
}
}

View File

@ -133,7 +133,7 @@ pub(crate) fn assert_pretty(from: &str, to: &str) {
);
println!("Expected: {:?}", to);
println!("Actaul: {:?}", out);
println!("Actual: {:?}", out);
assert_eq!(DebugUsingDisplay(out.trim()), DebugUsingDisplay(to),);
}
@ -252,7 +252,7 @@ fn empty_named_export_from() {
fn empty_named_export_from_min() {
test_from_to_custom_config(
"export { } from 'foo';",
"export{}from'foo'",
"export{}from\"foo\"",
Config { minify: true },
Default::default(),
);
@ -267,7 +267,7 @@ fn named_export_from() {
fn named_export_from_min() {
test_from_to_custom_config(
"export { bar } from 'foo';",
"export{bar}from'foo'",
"export{bar}from\"foo\"",
Config { minify: true },
Default::default(),
);
@ -289,7 +289,7 @@ fn export_namespace_from() {
fn export_namespace_from_min() {
test_from_to_custom_config(
"export * as Foo from 'foo';",
"export*as Foo from'foo'",
"export*as Foo from\"foo\"",
Config { minify: true },
Syntax::Es(EsConfig {
..EsConfig::default()
@ -313,7 +313,7 @@ fn named_and_namespace_export_from() {
fn named_and_namespace_export_from_min() {
test_from_to_custom_config(
"export * as Foo, { bar } from 'foo';",
"export*as Foo,{bar}from'foo'",
"export*as Foo,{bar}from\"foo\"",
Config { minify: true },
Syntax::Es(EsConfig {
..EsConfig::default()
@ -551,24 +551,24 @@ CONTENT\r
}
#[test]
fn test_escape_without_source() {
fn test_get_quoted_utf16() {
fn es2020(src: &str, expected: &str) {
assert_eq!(
super::escape_without_source(src, EsVersion::Es2020, true, false),
super::get_quoted_utf16(src, EsVersion::Es2020, true, false, false),
expected
)
}
fn es2020_nonascii(src: &str, expected: &str) {
assert_eq!(
super::escape_without_source(src, EsVersion::Es2020, true, true),
super::get_quoted_utf16(src, EsVersion::Es2020, true, true, false),
expected
)
}
fn es5(src: &str, expected: &str) {
assert_eq!(
super::escape_without_source(src, EsVersion::Es5, true, true),
super::get_quoted_utf16(src, EsVersion::Es5, true, true, false),
expected
)
}
@ -576,7 +576,7 @@ fn test_escape_without_source() {
es2020("abcde", "abcde");
es2020(
"\x00\r\n\u{85}\u{2028}\u{2029};",
"\\x00\\r\\n\\x85\\u2028\\u2029;",
"\\0\\r\\n\\x85\\u2028\\u2029;",
);
es2020("\n", "\\n");
@ -584,12 +584,14 @@ fn test_escape_without_source() {
es2020("'string'", "\\'string\\'");
es2020("\u{0}", "\\x00");
es2020("\u{0}", "\\0");
es2020("\u{1}", "\\x01");
es2020("\u{1000}", "\u{1000}");
es2020("\u{1000}", "\\u1000");
es2020("\u{ff}", "\\xff");
es2020("\u{10ffff}", "\u{10ffff}");
es2020("\u{10ffff}", "\\u{10FFFF}");
es2020("😀", "\\u{1F600}");
es5("", "\\uD7FB");
es2020_nonascii("\u{FEFF}abc", "\\uFEFFabc");
es2020_nonascii("\u{10ffff}", "\\u{10FFFF}");
@ -597,6 +599,8 @@ fn test_escape_without_source() {
es5("\u{FEFF}abc", "\\uFEFFabc");
es5("\u{10ffff}", "\\uDBFF\\uDFFF");
es5("\u{FFFF}", "\\uFFFF");
es5("😀", "\\uD83D\\uDE00");
es5("", "\\uD7FB");
}
#[test]
@ -616,7 +620,7 @@ fn issue_1452_1() {
fn issue_1619_1() {
assert_min_target(
"\"\\x00\" + \"\\x31\"",
"\"\\x00\"+\"\\x31\"",
"\"\\0\"+\"1\"",
EsVersion::latest(),
);
}
@ -625,7 +629,7 @@ fn issue_1619_1() {
fn issue_1619_2() {
assert_min_target(
"\"\\x00\" + \"\\x31\"",
"\"\\x00\"+\"\\x31\"",
"\"\\0\"+\"1\"",
EsVersion::latest(),
);
}
@ -633,7 +637,7 @@ fn issue_1619_2() {
#[test]
fn issue_1619_3() {
assert_eq!(
escape_without_source("\x00\x31", EsVersion::Es3, true, false),
get_quoted_utf16("\x00\x31", EsVersion::Es3, true, false, false),
"\\x001"
);
}

View File

@ -1 +1 @@
import other from'other';const[foo]=other;export var __N_SSG=true;export default function Home(){return __jsx('div',null)}
import other from"other";const[foo]=other;export var __N_SSG=true;export default function Home(){return __jsx("div",null)}

View File

@ -1 +1 @@
import other from'other';const{a,cat:bar}=other;export var __N_SSG=true;export default function Home(){return __jsx('div',null)}
import other from"other";const{a,cat:bar}=other;export var __N_SSG=true;export default function Home(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export class MyClass{}export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export class MyClass{}export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export function Noop(){}export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export function Noop(){}export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export const foo=2;export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export const foo=2;export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export{foo,bar as baz}from'.';export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export{foo,bar as baz}from".";export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
import keep_me from'hello';import{keep_me2}from'hello2';import*as keep_me3 from'hello3';import{but_not_me}from'bar';var leave_me_alone=1;function dont_bug_me_either(){}export var __N_SSG=true;export default function Test(){return __jsx('div',null)}
import keep_me from"hello";import{keep_me2}from"hello2";import*as keep_me3 from"hello3";import{but_not_me}from"bar";var leave_me_alone=1;function dont_bug_me_either(){}export var __N_SSG=true;export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
const a=2;export var __N_SSG=true;export default function Test(){return __jsx('div',null)}
const a=2;export var __N_SSG=true;export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export default function Test(){return __jsx('div',null)}
export var __N_SSG=true;export default function Test(){return __jsx("div",null)}

View File

@ -1 +1 @@
export var __N_SSG=true;export default function Home(){return __jsx('div',null)}
export var __N_SSG=true;export default function Home(){return __jsx("div",null)}

View File

@ -1 +1 @@
class Test extends React.Component{render(){return __jsx('div',null)}}export var __N_SSG=true;export default Test
class Test extends React.Component{render(){return __jsx("div",null)}}export var __N_SSG=true;export default Test

View File

@ -1 +1 @@
export var __N_SSG=true;export default class Test extends React.Component{render(){return __jsx('div',null)}}
export var __N_SSG=true;export default class Test extends React.Component{render(){return __jsx("div",null)}}

View File

@ -1 +1 @@
class El extends React.Component{render(){return __jsx('div',null)}}const a=5;export var __N_SSG=true;export{El as default,a}
class El extends React.Component{render(){return __jsx("div",null)}}const a=5;export var __N_SSG=true;export{El as default,a}

View File

@ -1 +1 @@
function El(){return __jsx('div',null)}const a=5;export var __N_SSG=true;export{El as default,a}
function El(){return __jsx("div",null)}const a=5;export var __N_SSG=true;export{El as default,a}

View File

@ -1 +1 @@
export var __N_SSG=true;export{default}from'a'
export var __N_SSG=true;export{default}from"a"

View File

@ -1 +1 @@
function El(){return __jsx('div',null)}export var __N_SSG=true;export{El as default}
function El(){return __jsx("div",null)}export var __N_SSG=true;export{El as default}

View File

@ -0,0 +1,103 @@
const string1 = "test";
const string2 = 'test';
const string3 = 'te"st';
const string4 = "te'st";
const string5 = "test\ntest\ntest";
const string6 = `Yet another string primitive`;
const string7 = "This is a very long string which needs \
to wrap across multiple lines because \
otherwise my code is unreadable.";
const string8 = "中文 español English हिन्दी العربية português বাংলা русский 日本語 ਪੰਜਾਬੀ 한국어 தமிழ்";
const string9 = ``;
const string10 = `xx\`x`;
const string11 = `${ foo + 2 }`;
const string12 = ` foo ${ bar + `baz ${ qux }` }`;
const string13 = String.raw`foo`;
const string14 = foo `bar`;
const string15 = `foo
bar
ↂωↂ`;
const string16 = `\``;
const string17 = `${4 + 4} equals 4 + 4`;
const string18 = `This is ${undefined}`;
const string19 = `This is ${NaN}`;
const string20 = `This is ${null}`;
const string21 = `This is ${Infinity}`;
const string22 = "This is ${1/0}";
const string23 = 'This is ${1/0}';
const string24 = "This is ${NaN}";
const string25 = "This is ${null}";
const string26 = `This is ${1/0}`;
const string27 = `This is ${0/0}`;
const string28 = "This is ${0/0}";
const string29 = 'This is ${0/0}';
const string30 = `${4**11}`;
const string31 = `${4**12}`;
const string32 = `${4**14}`;
const string33 = '';
const string34 = '\b';
const string35 = '\f';
const string36 = '\t';
const string37 = '\v';
const string38 = '\n';
const string39 = '\\n';
const string40 = '\\';
const string41 = '\\"';
const string42 = '\'\"';
const string43 = '\\\\';
const string44 = '\x00';
const string45 = '\x00!';
const string46 = '\x001';
const string47 = '\\0';
const string48 = '\\0!';
const string49 = '\x07';
const string50 = '\x07!';
const string51 = '\x071';
const string52 = '\7';
const string53 = '\\7';
const string54 = '\\7!';
const string55 = '\\01';
const string56 = '\x10';
const string57 = '\\x10';
const string58 = '\x1B';
const string59 = '\\x1B';
const string60 = '\uABCD';
const string61 = '\uABCD';
const string62 = '\U000123AB';
const string63 = '\u{123AB}';
const string64 = '\uD808\uDFAB';
const string65 = '\uD808';
const string66 = '\uD808X';
const string67 = '\uDFAB';
const string68 = '\uDFABX';
const string69 = '\x80';
const string70 = '\xFF';
const string71 = '\xF0\x9F\x8D\x95';
const string72 = '\uD801\uDC02\uDC03\uD804';
const string73 = 'π';
const = '🐈';
const 貓abc = '🐈';
const abc貓 = '🐈';
const string74 = '\u2028';
const string75 = '\u2029';
const string76 = '\uFEFF';
const string77 = '\x10';
const string78 = '\x20';
const string79 = ' ';
const string80 = '\x32';
const string81 = '\x16';
const string82 = '\x06';
const string83 = '\0a';
const string84 = "\"test\"test\"test"
const string85 = "\"test\'test\'test"
const string86 = '\"test\"test\"test';
const string87 = '\'test\'test\'test';
const string88 = '😄';
const string89 = new RegExp("\r").test("\r");
const string90 = new RegExp(" ").test(" ");
const string91 = new RegExp("\x1b").test("[" + "\x1b" + "]");
const string92 = new RegExp("\\x1b").test("\x1b");
const string93 = new RegExp("").test("");
const string94 = '퟿';
const string95 = 'ퟻ';
const string96 = sql`'#ERROR'`;

View File

@ -0,0 +1,103 @@
const string1 = "test";
const string2 = 'test';
const string3 = 'te"st';
const string4 = "te'st";
const string5 = "test\ntest\ntest";
const string6 = `Yet another string primitive`;
const string7 = "This is a very long string which needs \
to wrap across multiple lines because \
otherwise my code is unreadable.";
const string8 = "中文 español English हिन्दी العربية português বাংলা русский 日本語 ਪੰਜਾਬੀ 한국어 தமிழ்";
const string9 = ``;
const string10 = `xx\`x`;
const string11 = `${foo + 2}`;
const string12 = ` foo ${bar + `baz ${qux}`}`;
const string13 = String.raw`foo`;
const string14 = foo`bar`;
const string15 = `foo
bar
ↂωↂ`;
const string16 = `\``;
const string17 = `${4 + 4} equals 4 + 4`;
const string18 = `This is ${undefined}`;
const string19 = `This is ${NaN}`;
const string20 = `This is ${null}`;
const string21 = `This is ${Infinity}`;
const string22 = "This is ${1/0}";
const string23 = 'This is ${1/0}';
const string24 = "This is ${NaN}";
const string25 = "This is ${null}";
const string26 = `This is ${1 / 0}`;
const string27 = `This is ${0 / 0}`;
const string28 = "This is ${0/0}";
const string29 = 'This is ${0/0}';
const string30 = `${4 ** 11}`;
const string31 = `${4 ** 12}`;
const string32 = `${4 ** 14}`;
const string33 = '';
const string34 = '\b';
const string35 = '\f';
const string36 = '\t';
const string37 = '\v';
const string38 = '\n';
const string39 = '\\n';
const string40 = '\\';
const string41 = '\\"';
const string42 = '\'\"';
const string43 = '\\\\';
const string44 = '\x00';
const string45 = '\x00!';
const string46 = '\x001';
const string47 = '\\0';
const string48 = '\\0!';
const string49 = '\x07';
const string50 = '\x07!';
const string51 = '\x071';
const string52 = '\7';
const string53 = '\\7';
const string54 = '\\7!';
const string55 = '\\01';
const string56 = '\x10';
const string57 = '\\x10';
const string58 = '\x1B';
const string59 = '\\x1B';
const string60 = '\uABCD';
const string61 = '\uABCD';
const string62 = '\U000123AB';
const string63 = '\u{123AB}';
const string64 = '\uD808\uDFAB';
const string65 = '\uD808';
const string66 = '\uD808X';
const string67 = '\uDFAB';
const string68 = '\uDFABX';
const string69 = '\x80';
const string70 = '\xFF';
const string71 = '\xF0\x9F\x8D\x95';
const string72 = '\uD801\uDC02\uDC03\uD804';
const string73 = 'π';
const = '🐈';
const 貓abc = '🐈';
const abc貓 = '🐈';
const string74 = '\u2028';
const string75 = '\u2029';
const string76 = '\uFEFF';
const string77 = '\x10';
const string78 = '\x20';
const string79 = ' ';
const string80 = '\x32';
const string81 = '\x16';
const string82 = '\x06';
const string83 = '\0a';
const string84 = "\"test\"test\"test";
const string85 = "\"test\'test\'test";
const string86 = '\"test\"test\"test';
const string87 = '\'test\'test\'test';
const string88 = '😄';
const string89 = new RegExp("\r").test("\r");
const string90 = new RegExp(" ").test(" ");
const string91 = new RegExp("\x1b").test("[" + "\x1b" + "]");
const string92 = new RegExp("\\x1b").test("\x1b");
const string93 = new RegExp("").test("");
const string94 = '퟿';
const string95 = 'ퟻ';
const string96 = sql`'#ERROR'`;

View File

@ -0,0 +1,3 @@
const string1="test";const string2="test";const string3='te"st';const string4="te'st";const string5="test\ntest\ntest";const string6=`Yet another string primitive`;const string7="This is a very long string which needs to wrap across multiple lines because otherwise my code is unreadable.";const string8="\u4E2D\u6587 espa\xf1ol English \u0939\u093F\u0928\u094D\u0926\u0940 \u0627\u0644\u0639\u0631\u0628\u064A\u0629 portugu\xeas \u09AC\u09BE\u0982\u09B2\u09BE \u0440\u0443\u0441\u0441\u043A\u0438\u0439 \u65E5\u672C\u8A9E \u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40 \uD55C\uAD6D\uC5B4 \u0BA4\u0BAE\u0BBF\u0BB4\u0BCD";const string9=``;const string10=`xx\`x`;const string11=`${foo+2}`;const string12=` foo ${bar+`baz ${qux}`}`;const string13=String.raw`foo`;const string14=foo`bar`;const string15=`foo
bar
ↂωↂ`;const string16=`\``;const string17=`${4+4} equals 4 + 4`;const string18=`This is ${undefined}`;const string19=`This is ${NaN}`;const string20=`This is ${null}`;const string21=`This is ${Infinity}`;const string22="This is ${1/0}";const string23="This is ${1/0}";const string24="This is ${NaN}";const string25="This is ${null}";const string26=`This is ${1/0}`;const string27=`This is ${0/0}`;const string28="This is ${0/0}";const string29="This is ${0/0}";const string30=`${4**11}`;const string31=`${4**12}`;const string32=`${4**14}`;const string33="";const string34="\b";const string35="\f";const string36="\t";const string37="\v";const string38="\n";const string39="\\n";const string40="\\";const string41='\\"';const string42="'\"";const string43="\\\\";const string44="\0";const string45="\0!";const string46="\x001";const string47="\\0";const string48="\\0!";const string49="\x07";const string50="\x07!";const string51="\x071";const string52="\x07";const string53="\\7";const string54="\\7!";const string55="\\01";const string56="\x10";const string57="\\x10";const string58="\x1b";const string59="\\x1B";const string60="\uABCD";const string61="\uABCD";const string62="U000123AB";const string63="\u{123AB}";const string64="\\\0ud808\\\0udfab";const string65="\\\0ud808";const string66="\\\0ud808X";const string67="\\\0udfab";const string68="\\\0udfabX";const string69="\x80";const string70="\xff";const string71="\xf0\x9f\x8d\x95";const string72="\\\0ud801\\\0udc02\\\0udc03\\\0ud804";const string73="\u03C0";const ="\u{1F408}";const 貓abc="\u{1F408}";const abc貓="\u{1F408}";const string74="\u2028";const string75="\u2029";const string76="\uFEFF";const string77="\x10";const string78=" ";const string79=" ";const string80="2";const string81="\x16";const string82="\x06";const string83="\0a";const string84='"test"test"test';const string85="\"test'test'test";const string86='"test"test"test';const string87="'test'test'test";const string88="\u{1F604}";const string89=new RegExp("\r").test("\r");const string90=new RegExp(" ").test(" ");const string91=new RegExp("\x1b").test("["+"\x1b"+"]");const string92=new RegExp("\\x1b").test("\x1b");const string93=new RegExp("\x1b").test("\x1b");const string94="\uD7FF";const string95="\uD7FB";const string96=sql`'#ERROR'`

View File

@ -1 +1 @@
a.b('c').d('e',function(f){return f}).g('h',function(i){return i})
a.b("c").d("e",function(f){return f}).g("h",function(i){return i})

View File

@ -1 +1 @@
(function(){var a;eval('a');function b(){a=a+=1}}())
(function(){var a;eval("a");function b(){a=a+=1}}())

View File

@ -1 +1 @@
new a("aa, [bb]",'return aa;');new a("aa, {bb}",'return aa;');new a("[[aa]], [{bb}]",'return aa;')
new a("aa, [bb]","return aa;");new a("aa, {bb}","return aa;");new a("[[aa]], [{bb}]","return aa;")

View File

@ -1 +1 @@
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe'+a
"\0\x01\x02\x03\x04\x05\x06\x07\b\t\n\v\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe"+a

View File

@ -1 +1 @@
"Hello\012World"
"Hello\nWorld"

View File

@ -1 +1 @@
do{}while(false)a()
do{}while(false);a()

View File

@ -1 +1 @@
"Hello\ \nworld"
"Helloworld"

View File

@ -1 +1 @@
do{a()}while(false)b()
do{a()}while(false);b()

View File

@ -1 +1 @@
'use strict';a()
"use strict";a()

View File

@ -1 +1 @@
'use strict';var a={'0':'b'}
"use strict";var a={"0":"b"}

View File

@ -1 +1 @@
function a(){'use strict';0}
function a(){"use strict";0}

View File

@ -1 +1 @@
var a='very cute'
var a="very cute"

View File

@ -1 +1 @@
for(var a in b)(function(){c('d')}())
for(var a in b)(function(){c("d")}())

View File

@ -1 +1 @@
void'test string'
void"test string"

View File

@ -1 +1 @@
a(b(c+'d'),b('d'+c))
a(b(c+"d"),b("d"+c))

View File

@ -1 +1 @@
(function(){'use\nstrict';with(a);}())
(function(){"use\nstrict";with(a);}())

View File

@ -1 +1 @@
"Hello\312World"
"Hello\xcaWorld"

View File

@ -1 +1 @@
('\u{10FFFF}')
("\uDBFF\uDFFF")

View File

@ -1 +1 @@
if(a){(function(){b('c')}());try{b("d")}catch(e){}}
if(a){(function(){b("c")}());try{b("d")}catch(e){}}

Some files were not shown because too many files have changed in this diff Show More