fix(es/codegen): Use Str.raw for es5 (#8873)

**Related issue:**

 - Closes #8871
This commit is contained in:
Donny/강동윤 2024-04-23 10:48:33 +09:00 committed by GitHub
parent f5e50c2c6e
commit c7a06b1a5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
942 changed files with 3192 additions and 3083 deletions

View File

@ -2,4 +2,4 @@ console.log(true);
if (true) {
console.log("Pass");
}
console.log("foo");
console.log('foo');

View File

@ -1 +1 @@
var foo = "\xa0";
var foo = "\u{a0}";

View File

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

View File

@ -17,7 +17,7 @@ function _templateObject1() {
};
return data;
}
import styled from "styled-components";
import styled from 'styled-components';
var C1 = styled.div(_templateObject());
var C2 = styled.div(_templateObject1());
var debug = eval("");
var debug = eval('');

View File

@ -17,7 +17,7 @@ function _templateObject1() {
};
return n;
}
import styled from "styled-components";
import styled from 'styled-components';
var C1 = styled.div(_templateObject());
var C2 = styled.div(_templateObject1());
var debug = eval("");
var debug = eval('');

View File

@ -1 +1 @@
console.log("exists");
console.log('exists');

View File

@ -5,9 +5,9 @@ x = function x1() {
var y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(app) {
return {
schedule: {
interval: "1m",
type: "all",
disable: app.config.env === "local"
interval: '1m',
type: 'all',
disable: app.config.env === 'local'
},
task: function task(ctx) {
var res;
@ -16,8 +16,8 @@ x = function x1() {
case 0:
return [
4,
ctx.curl("http://www.api.com/cache", {
contentType: "json"
ctx.curl('http://www.api.com/cache', {
contentType: 'json'
})
];
case 1:

View File

@ -1,2 +1,2 @@
var foo = function o() {};
console.log("PASS");
console.log('PASS');

View File

@ -2,7 +2,7 @@ import "core-js/modules/es.array.at.js";
import "core-js/modules/es.regexp.exec.js";
import "core-js/modules/es.string.at-alternative.js";
import "core-js/modules/es.string.split.js";
"1.2.3".split(".").at(-1);
'1.2.3'.split('.').at(-1);
[
123,
456

View File

@ -1,2 +1,2 @@
"use client";
'use client';
foo(function() {});

View File

@ -1,4 +1,4 @@
"use client";
'use client';
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _create_class } from "@swc/helpers/_/_create_class";
export var Foo = /*#__PURE__*/ function() {

View File

@ -1,4 +1,4 @@
"use client";
'use client';
export var Foo = {
foo: function foo() {}
};

View File

@ -4,8 +4,8 @@ import "core-js/modules/es.string.at-alternative.js";
import "core-js/modules/es.string.replace-all.js";
import "core-js/modules/es.string.replace.js";
import "core-js/modules/es.string.split.js";
"test".replaceAll("", "");
"1.2.3".split(".").at(-1);
'test'.replaceAll('', '');
'1.2.3'.split('.').at(-1);
[
123
].at(1);

View File

@ -6,13 +6,13 @@ _async_to_generator(function() {
_loop = function(i) {
var value = arr[i];
setTimeout(function() {
console.log("value", value);
console.log('value', value);
}, 0);
};
arr = [
"value1",
"value2",
"value3"
'value1',
'value2',
'value3'
];
// for (const value of arr) {
for(i = 0; i < arr.length; i++)_loop(i);

View File

@ -3,8 +3,8 @@ import { _ as _create_class } from "@swc/helpers/_/_create_class";
import { _ as _inherits } from "@swc/helpers/_/_inherits";
import { _ as _create_super } from "@swc/helpers/_/_create_super";
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
import React from "react";
import { withRouter } from "react-router-dom";
import React from 'react';
import { withRouter } from 'react-router-dom';
var App = function(_React_Component) {
"use strict";
_inherits(App, _React_Component);

View File

@ -8,6 +8,6 @@ Object.defineProperty(exports, "__esModule", {
}
});
var _obj, _default = ((_obj = {
\u3131: "\u11B0",
\u3141: "\u11B1"
})["\u3142"] = "\u11B2", _obj);
\u3131: '\u11B0',
\u3141: '\u11B1'
})['\u3142'] = '\u11B2', _obj);

View File

@ -2,4 +2,4 @@ var bmRnd;
function a() {
bmRnd = function bmRnd1() {};
}
eval("");
eval('');

View File

@ -1,5 +1,5 @@
import { _ as _inherits } from "@swc/helpers/_/_inherits";
import { ClassName } from "./some-file";
import { ClassName } from './some-file';
export default {
field: /*#__PURE__*/ function(ClassName) {
"use strict";

View File

@ -2,16 +2,16 @@
1,
2
], [
"foo",
'foo',
3
], [
4
], [
"bar",
'bar',
5
], [
[
"baz",
'baz',
6
],
7,

View File

@ -2,28 +2,28 @@ var SUPPORTED_LOCALE = {
tr: {
regexp: /\u0130|\u0049|\u0049\u0307/g,
map: {
\u0130: "i",
\u0130: "\u0069",
I: "\u0131",
I\u0307: "i"
I\u0307: "\u0069"
}
},
az: {
regexp: /\u0130/g,
map: {
\u0130: "i",
\u0130: "\u0069",
I: "\u0131",
I\u0307: "i"
I\u0307: "\u0069"
}
},
lt: {
regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
map: {
I: "i\u0307",
J: "j\u0307",
I: "\u0069\u0307",
J: "\u006A\u0307",
\u012E: "\u012F\u0307",
"\xcc": "i\u0307\u0300",
"\xcd": "i\u0307\u0301",
\u0128: "i\u0307\u0303"
"\xcc": "\u0069\u0307\u0300",
"\xcd": "\u0069\u0307\u0301",
\u0128: "\u0069\u0307\u0303"
}
}
};

View File

@ -7,7 +7,7 @@ var Blocks = {
},
Layout1: function() {
return [
"Block1"
'Block1'
].map(function(e) {
return Blocks[e];
});

View File

@ -2,9 +2,9 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
var a = function() {
var _define_property1 = 1;
var fn = function() {
return console.log(_define_property({}, prop, "test"));
return console.log(_define_property({}, prop, 'test'));
};
};
var b = function() {
return eval("console.log()");
return eval('console.log()');
};

View File

@ -1,4 +1,4 @@
(function hello() {
console.log("outer stack", new Error().stack);
console.log('outer stack', new Error().stack);
})();
eval("");

View File

@ -2,16 +2,16 @@ require("core-js/modules/es.object.create.js");
require("core-js/modules/esnext.object.group-by.js");
var data = [
{
name: "a",
type: "a"
name: 'a',
type: 'a'
},
{
name: "b",
type: "a"
name: 'b',
type: 'a'
},
{
name: "c",
type: "b"
name: 'c',
type: 'b'
}
];
var result = Object.groupBy(data, function(param) {

View File

@ -1,2 +1,2 @@
var data = "\\ud";
var data = '\\ud';
console.log(data);

View File

@ -1,6 +1,6 @@
var e;
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _create_class } from "@swc/helpers/_/_create_class";
(e = window.parcelRequire).register("module1", function() {}), e.register("module2", function() {
console.log("test");
(e = window.parcelRequire).register('module1', function() {}), e.register('module2', function() {
console.log('test');
});

View File

@ -15,5 +15,5 @@
return a;
}
});
let a = "";
let a = '';
});

View File

@ -1,6 +1,6 @@
var Module = (function() {
var _scriptDir = typeof document !== "undefined" && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== "undefined") _scriptDir || (_scriptDir = __filename);
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir || (_scriptDir = __filename);
return function() {
var moduleArg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
var Module = moduleArg;
@ -13,7 +13,7 @@ var Module = (function() {
return moduleArg;
};
})()();
if (typeof exports === "object" && typeof module === "object") module.exports = Module;
else if (typeof define === "function" && define["amd"]) define([], function() {
if (typeof exports === 'object' && typeof module === 'object') module.exports = Module;
else if (typeof define === 'function' && define['amd']) define([], function() {
return Module;
});

View File

@ -3,7 +3,7 @@ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
import { Test } from "@nestjs/testing";
import { AppController } from "./app.controller";
import { AppService } from "./app.service";
describe("AppController", function() {
describe('AppController', function() {
var app;
beforeAll(/*#__PURE__*/ _async_to_generator(function() {
return _ts_generator(this, function(_state) {
@ -28,10 +28,10 @@ describe("AppController", function() {
}
});
}));
describe("getHello", function() {
describe('getHello', function() {
it('should return "Hello World!"', function() {
var appController = app.get(AppController);
expect(appController.getHello()).toBe("Hello World!");
expect(appController.getHello()).toBe('Hello World!');
});
});
});

View File

@ -11,7 +11,7 @@ export var AppService = /*#__PURE__*/ function() {
{
key: "getHello",
value: function getHello() {
return "Hello World!";
return 'Hello World!';
}
}
]);

View File

@ -0,0 +1,19 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": false
},
"target": "es5",
"loose": false,
"minify": {
"compress": false,
"mangle": false
}
},
"module": {
"type": "es6"
},
"minify": false,
"isModule": true
}

View File

@ -0,0 +1 @@
`pattern="\x5cd"`;

View File

@ -0,0 +1 @@
'pattern="\\d"';

View File

@ -0,0 +1,25 @@
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": false
},
"loose": true,
"minify": {
"compress": false,
"mangle": false
},
"transform": {
"react": {
"runtime": "classic",
"development": false
}
},
"target": "es5"
},
"module": {
"type": "es6"
},
"minify": false,
"isModule": true
}

View File

@ -0,0 +1,5 @@
const x = "</" + "script>"
const y = "<\/script>"
const z = "\/\/ \\"
export { x, y, z }

View File

@ -0,0 +1,4 @@
var x = "</" + "script>";
var y = "<\/script>";
var z = "\/\/ \\";
export { x, y, z };

View File

@ -3,7 +3,7 @@ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
import { Test } from "@nestjs/testing";
import { UsersController } from "./users.controller";
import { UsersService } from "./users.service";
describe("UsersController", function() {
describe('UsersController', function() {
var controller;
beforeEach(/*#__PURE__*/ _async_to_generator(function() {
var module;
@ -30,7 +30,7 @@ describe("UsersController", function() {
}
});
}));
it("should be defined", function() {
it('should be defined', function() {
expect(controller).toBeDefined();
});
});

View File

@ -53,18 +53,18 @@ _ts_decorate([
Get()
], UsersController.prototype, "findAll", null);
_ts_decorate([
Get(":id"),
_ts_param(0, Param("id"))
Get(':id'),
_ts_param(0, Param('id'))
], UsersController.prototype, "findOne", null);
_ts_decorate([
Patch(":id"),
_ts_param(0, Param("id")),
Patch(':id'),
_ts_param(0, Param('id')),
_ts_param(1, Body())
], UsersController.prototype, "update", null);
_ts_decorate([
Delete(":id"),
_ts_param(0, Param("id"))
Delete(':id'),
_ts_param(0, Param('id'))
], UsersController.prototype, "remove", null);
UsersController = _ts_decorate([
Controller("users")
Controller('users')
], UsersController);

View File

@ -2,7 +2,7 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
import { Test } from "@nestjs/testing";
import { UsersService } from "./users.service";
describe("UsersService", function() {
describe('UsersService', function() {
var service;
beforeEach(/*#__PURE__*/ _async_to_generator(function() {
var module;
@ -26,7 +26,7 @@ describe("UsersService", function() {
}
});
}));
it("should be defined", function() {
it('should be defined', function() {
expect(service).toBeDefined();
});
});

View File

@ -11,7 +11,7 @@ export var UsersService = /*#__PURE__*/ function() {
{
key: "create",
value: function create(createUserDto) {
return "This action adds a new user";
return 'This action adds a new user';
}
},
{

View File

@ -3,7 +3,7 @@ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
import { Test } from "@nestjs/testing";
import { UsersController } from "./users.controller";
import { UsersService } from "./users.service";
describe("UsersController", function() {
describe('UsersController', function() {
var controller;
beforeEach(/*#__PURE__*/ _async_to_generator(function() {
var module;
@ -30,7 +30,7 @@ describe("UsersController", function() {
}
});
}));
it("should be defined", function() {
it('should be defined', function() {
expect(controller).toBeDefined();
});
});

View File

@ -53,18 +53,18 @@ _ts_decorate([
Get()
], UsersController.prototype, "findAll", null);
_ts_decorate([
Get(":id"),
_ts_param(0, Param("id"))
Get(':id'),
_ts_param(0, Param('id'))
], UsersController.prototype, "findOne", null);
_ts_decorate([
Patch(":id"),
_ts_param(0, Param("id")),
Patch(':id'),
_ts_param(0, Param('id')),
_ts_param(1, Body())
], UsersController.prototype, "update", null);
_ts_decorate([
Delete(":id"),
_ts_param(0, Param("id"))
Delete(':id'),
_ts_param(0, Param('id'))
], UsersController.prototype, "remove", null);
UsersController = _ts_decorate([
Controller("users")
Controller('users')
], UsersController);

View File

@ -2,7 +2,7 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
import { Test } from "@nestjs/testing";
import { UsersService } from "./users.service";
describe("UsersService", function() {
describe('UsersService', function() {
var service;
beforeEach(/*#__PURE__*/ _async_to_generator(function() {
var module;
@ -26,7 +26,7 @@ describe("UsersService", function() {
}
});
}));
it("should be defined", function() {
it('should be defined', function() {
expect(service).toBeDefined();
});
});

View File

@ -11,7 +11,7 @@ export var UsersService = /*#__PURE__*/ function() {
{
key: "create",
value: function create(createUserDto) {
return "This action adds a new user";
return 'This action adds a new user';
}
},
{

View File

@ -1,9 +1,9 @@
import { nanoid } from "nanoid";
import { fnv1a } from "../fnv1a";
export var VERCEL_AUTHENTICATED_PREFIX = "v_";
export var VERCEL_AUTHENTICATED_PREFIX = 'v_';
/**
* 1.0 -- random IDs from nanoid() with default length. Authenticated IDs are v_vercelUserID.
*/ export var IDENTITY_VERSION = "1.0";
*/ export var IDENTITY_VERSION = '1.0';
export function generateRandomID() {
return nanoid();
}

View File

@ -22,12 +22,12 @@ export var customAlphabet = function(alphabet) {
var _arguments = arguments;
return _ts_generator(this, function(_state) {
size = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : defaultSize;
id = "";
id = '';
while(true){
bytes = crypto.getRandomValues(new Uint8Array(step));
i = step;
while(i--){
id += alphabet[bytes[i] & mask] || "";
id += alphabet[bytes[i] & mask] || '';
if (id.length === size) return [
2,
id
@ -46,7 +46,7 @@ export var nanoid = function() {
var _arguments = arguments;
return _ts_generator(this, function(_state) {
size = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : 21;
id = "";
id = '';
bytes = crypto.getRandomValues(new Uint8Array(size));
while(size--){
byte = bytes[size] & 63;
@ -55,9 +55,9 @@ export var nanoid = function() {
} else if (byte < 62) {
id += (byte - 26).toString(36).toUpperCase();
} else if (byte < 63) {
id += "_";
id += '_';
} else {
id += "-";
id += '-';
}
}
return [

View File

@ -20,20 +20,20 @@ export var customAlphabet = function(alphabet) {
return random(step).then(function(bytes) {
var i = step;
while(i--){
id += alphabet[bytes[i] & mask] || "";
id += alphabet[bytes[i] & mask] || '';
if (id.length === size) return id;
}
return tick(id, size);
});
};
return function(size) {
return tick("", size);
return tick('', size);
};
};
export var nanoid = function() {
var size = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21;
return random(size).then(function(bytes) {
var id = "";
var id = '';
while(size--){
id += urlAlphabet[bytes[size] & 63];
}

View File

@ -10,20 +10,20 @@ export var customAlphabet = function(alphabet) {
return random(step).then(function(bytes) {
var i = step;
while(i--){
id += alphabet[bytes[i] & mask] || "";
id += alphabet[bytes[i] & mask] || '';
if (id.length === size) return id;
}
return tick(id, size);
});
};
return function(size) {
return tick("", size);
return tick('', size);
};
};
export var nanoid = function() {
var size = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21;
return random(size).then(function(bytes) {
var id = "";
var id = '';
while(size--){
id += urlAlphabet[bytes[size] & 63];
}

View File

@ -1,30 +1,30 @@
#!/usr/bin/env node
import { nanoid, customAlphabet } from "../index.js";
function print(msg) {
process.stdout.write(msg + "\n");
process.stdout.write(msg + '\n');
}
function error(msg) {
process.stderr.write(msg + "\n");
process.stderr.write(msg + '\n');
process.exit(1);
}
if (process.argv.includes("--help") || process.argv.includes("-h")) {
if (process.argv.includes('--help') || process.argv.includes('-h')) {
print("\n Usage\n $ nanoid [options]\n Options\n -s, --size Generated ID size\n -a, --alphabet Alphabet to use\n -h, --help Show this help\n Examples\n $ nanoid --s 15\n S9sBF77U6sDB8Yg\n $ nanoid --size 10 --alphabet abc\n bcabababca");
process.exit();
}
var alphabet, size;
for(var i = 2; i < process.argv.length; i++){
var arg = process.argv[i];
if (arg === "--size" || arg === "-s") {
if (arg === '--size' || arg === '-s') {
size = Number(process.argv[i + 1]);
i += 1;
if (Number.isNaN(size) || size <= 0) {
error("Size must be positive integer");
error('Size must be positive integer');
}
} else if (arg === "--alphabet" || arg === "-a") {
} else if (arg === '--alphabet' || arg === '-a') {
alphabet = process.argv[i + 1];
i += 1;
} else {
error("Unknown argument " + arg);
error('Unknown argument ' + arg);
}
}
if (alphabet) {

View File

@ -7,12 +7,12 @@ export var customRandom = function(alphabet, defaultSize, getRandom) {
var step = -~(1.6 * mask * defaultSize / alphabet.length);
return function() {
var size = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultSize;
var id = "";
var id = '';
while(true){
var bytes = getRandom(step);
var j = step;
while(j--){
id += alphabet[bytes[j] & mask] || "";
id += alphabet[bytes[j] & mask] || '';
if (id.length === size) return id;
}
}
@ -31,10 +31,10 @@ export var nanoid = function() {
} else if (byte < 62) {
id += (byte - 26).toString(36).toUpperCase();
} else if (byte > 62) {
id += "-";
id += '-';
} else {
id += "_";
id += '_';
}
return id;
}, "");
}, '');
};

View File

@ -23,12 +23,12 @@ export var customRandom = function(alphabet, defaultSize, getRandom) {
var step = Math.ceil(1.6 * mask * defaultSize / alphabet.length);
return function() {
var size = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultSize;
var id = "";
var id = '';
while(true){
var bytes = getRandom(step);
var i = step;
while(i--){
id += alphabet[bytes[i] & mask] || "";
id += alphabet[bytes[i] & mask] || '';
if (id.length === size) return id;
}
}
@ -41,7 +41,7 @@ export var customAlphabet = function(alphabet) {
export var nanoid = function() {
var size = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21;
fillPool(size -= 0);
var id = "";
var id = '';
for(var i = poolOffset - size; i < poolOffset; i++){
id += urlAlphabet[pool[i] & 63];
}

View File

@ -1,9 +1,9 @@
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
var urlAlphabet = 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
export var customAlphabet = function(alphabet) {
var defaultSize = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 21;
return function() {
var size = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultSize;
var id = "";
var id = '';
var i = size;
while(i--){
id += alphabet[Math.random() * alphabet.length | 0];
@ -13,7 +13,7 @@ export var customAlphabet = function(alphabet) {
};
export var nanoid = function() {
var size = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21;
var id = "";
var id = '';
var i = size;
while(i--){
id += urlAlphabet[Math.random() * 64 | 0];

View File

@ -1 +1 @@
export var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
export var urlAlphabet = 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';

View File

@ -1 +1 @@
export var shouldNotBeOctal = "\x001";
export var shouldNotBeOctal = '\x001';

View File

@ -1 +1 @@
export * as Foo from 'bar';
export * as Foo from "bar";

View File

@ -12,7 +12,7 @@ var clodule = /*#__PURE__*/ function() {
}();
(function(clodule) {
function fn(x, y) {
return clodule.sfn("a");
return clodule.sfn('a');
}
// error: duplicate identifier expected
clodule.fn = fn;

View File

@ -9,5 +9,5 @@ var clodule, clodule1 = function() {
}, clodule;
}();
(clodule = clodule1 || (clodule1 = {})).fn = function(x, y) {
return clodule.sfn("a");
return clodule.sfn('a');
};

View File

@ -1,8 +1,8 @@
//// [ES5For-of1.ts]
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++){
var v = _iter[_i];
console.log(v);

View File

@ -1,6 +1,6 @@
//// [ES5For-of1.ts]
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++)console.log(_iter[_i]);

View File

@ -1,8 +1,8 @@
//// [ES5For-of13.ts]
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++){
var v = _iter[_i];
var x = v;

View File

@ -1,6 +1,6 @@
//// [ES5For-of13.ts]
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++)_iter[_i];

View File

@ -1,8 +1,8 @@
//// [ES5For-of3.ts]
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++){
var v = _iter[_i];
var x = v;

View File

@ -1,6 +1,6 @@
//// [ES5For-of3.ts]
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++)_iter[_i];

View File

@ -1,8 +1,8 @@
//// [ES5For-of33.ts]
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++){
var v = _iter[_i];
console.log(v);

View File

@ -1,6 +1,6 @@
//// [ES5For-of33.ts]
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++)console.log(_iter[_i]);

View File

@ -5,9 +5,9 @@ function foo() {
};
}
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++){
foo().x = _iter[_i];
var p = foo().x;

View File

@ -1,6 +1,6 @@
//// [ES5For-of34.ts]
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++)_iter[_i];

View File

@ -17,11 +17,11 @@ for(var _i = 0, _iter = [
]; _i1 < _iter1.length; _i1++){
var j = _iter1[_i1];
if (i === 2) {
throw new Error("ERR");
throw new Error('ERR');
}
}
console.log(i);
} catch (err) {
console.log("E %s %s", i, err);
console.log('E %s %s', i, err);
}
}

View File

@ -12,9 +12,9 @@ for(var _i = 0, _iter = [
1,
2,
3
]; _i1 < _iter1.length; _i1++)if (_iter1[_i1], 2 === i) throw Error("ERR");
]; _i1 < _iter1.length; _i1++)if (_iter1[_i1], 2 === i) throw Error('ERR');
console.log(i);
} catch (err) {
console.log("E %s %s", i, err);
console.log('E %s %s', i, err);
}
}

View File

@ -5,9 +5,9 @@ function foo() {
};
}
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++){
foo().x = _iter[_i];
var p = foo().x;

View File

@ -1,6 +1,6 @@
//// [ES5For-of8.ts]
for(var _i = 0, _iter = [
"a",
"b",
"c"
'a',
'b',
'c'
]; _i < _iter.length; _i++)_iter[_i];

View File

@ -1,7 +1,7 @@
//// [ES5For-ofTypeCheck13.ts]
var strSet = new Set();
strSet.add("Hello");
strSet.add("World");
strSet.add('Hello');
strSet.add('World');
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
try {
for(var _iterator = strSet[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){

View File

@ -1,6 +1,6 @@
//// [ES5For-ofTypeCheck13.ts]
var strSet = new Set();
strSet.add("Hello"), strSet.add("World");
strSet.add('Hello'), strSet.add('World');
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
try {
for(var _step, _iterator = strSet[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)_step.value;

View File

@ -1,7 +1,7 @@
//// [ModuleWithExportedAndNonExportedVariables.ts]
var A;
(function(A) {
A.x = "hello world";
A.x = 'hello world';
var y = 12;
})(A || (A = {}));
var x;

View File

@ -1,3 +1,3 @@
//// [ModuleWithExportedAndNonExportedVariables.ts]
var A;
(A || (A = {})).x = "hello world", A.x, A.y;
(A || (A = {})).x = 'hello world', A.x, A.y;

View File

@ -21,4 +21,4 @@ var C = /*#__PURE__*/ function() {
return C;
}();
var c;
var r = c.x(""); // string
var r = c.x(''); // string

View File

@ -2,4 +2,4 @@
var c;
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _create_class } from "@swc/helpers/_/_create_class";
c.x("");
c.x('');

View File

@ -41,10 +41,10 @@ var r13 = a + new C();
var r14 = a + E;
var r15 = a + 0;
var r16 = a + M;
var r17 = a + "";
var r17 = a + '';
var r18 = a + 123;
var r19 = a + {
a: ""
a: ''
};
var r20 = a + function(a) {
return a;

View File

@ -18,7 +18,7 @@ var r6 = null + c;
var r7 = null + d;
var r8 = null + true;
var r9 = null + {
a: ""
a: ''
};
var r10 = null + foo();
var r11 = null + function() {};

View File

@ -26,6 +26,6 @@ var r11 = 0 + null;
var r12 = 0 + null;
// null + string
var r13 = null + d;
var r14 = null + "";
var r14 = null + '';
var r15 = d + null;
var r16 = "" + null;
var r16 = '' + null;

View File

@ -33,9 +33,9 @@ var r14 = g + x;
// other cases
var r15 = x + E;
var r16 = x + 0;
var r17 = x + "";
var r17 = x + '';
var r18 = x + 0;
var r19 = x + {
a: ""
a: ''
};
var r20 = x + [];

View File

@ -18,7 +18,7 @@ var r6 = undefined + c;
var r7 = undefined + d;
var r8 = undefined + true;
var r9 = undefined + {
a: ""
a: ''
};
var r10 = undefined + foo();
var r11 = undefined + function() {};

View File

@ -26,6 +26,6 @@ var r11 = 0 + undefined;
var r12 = 0 + undefined;
// undefined + string
var r13 = undefined + d;
var r14 = undefined + "";
var r14 = undefined + '';
var r15 = d + undefined;
var r16 = "" + undefined;
var r16 = '' + undefined;

View File

@ -1,18 +1,18 @@
//// [allowUnescapedParagraphAndLineSeparatorsInStringLiteral.ts]
// Strings containing unescaped line / paragraph separators
// Using both single quotes, double quotes and template literals
var stringContainingUnescapedLineSeparator1 = "\u2028STRING_CONTENT\u2028";
var stringContainingUnescapedParagraphSeparator1 = "\u2029STRING_CONTENT\u2029";
var stringContainingUnescapedLineSeparator2 = "\u2028STRING_CONTENT\u2028";
var stringContainingUnescapedParagraphSeparator2 = "\u2029STRING_CONTENT\u2029";
var stringContainingUnescapedLineSeparator1 = "STRING_CONTENT";
var stringContainingUnescapedParagraphSeparator1 = "STRING_CONTENT";
var stringContainingUnescapedLineSeparator2 = 'STRING_CONTENT';
var stringContainingUnescapedParagraphSeparator2 = 'STRING_CONTENT';
var stringContainingUnescapedLineSeparator3 = "\u2028STRING_CONTENT\u2028";
var stringContainingUnescapedParagraphSeparator3 = "\u2029STRING_CONTENT\u2029";
// Array of unescaped line / paragraph separators
var arr = [
"\u2029\u2028STRING_CONTENT\u2028\u2029",
"\u2028\u2029\u2029STRING_CONTENT\u2029\u2029\u2028",
"STRING_CONTENT\u2029",
"\u2028STRING_CONTENT",
"STRING_CONTENT",
"STRING_CONTENT",
"STRING_CONTENT",
"STRING_CONTENT",
"",
"\u2028"
''
];

View File

@ -3,7 +3,7 @@
// can be called except with type arguments which is an error
var x;
var a = new x();
var b = new x("hello");
var b = new x('hello');
var c = new x(x);
// grammar allows this for constructors
var d = new x(x); // no error

View File

@ -1,3 +1,3 @@
//// [anyAsConstructor.ts]
var x;
new x(), new x("hello"), new x(x), new x(x);
new x(), new x('hello'), new x(x), new x(x);

View File

@ -3,5 +3,5 @@
// can be called except with type arguments which is an error
var x;
var a = x();
var b = x("hello");
var b = x('hello');
var c = x(x);

View File

@ -1,3 +1,3 @@
//// [anyAsFunctionCall.ts]
var x;
x(), x("hello"), x(x);
x(), x('hello'), x(x);

View File

@ -4,7 +4,7 @@
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
var x;
var a = x();
var b = x("hello");
var b = x('hello');
var C = function C() {
"use strict";
_class_call_check(this, C);

View File

@ -1,4 +1,4 @@
//// [anyAsGenericFunctionCall.ts]
var x;
import "@swc/helpers/_/_class_call_check";
x(), x("hello"), x(x), x(x);
x(), x('hello'), x(x), x(x);

View File

@ -1,8 +1,8 @@
//// [anyPropertyAccess.ts]
var x;
var a = x.foo;
var b = x["foo"];
var c = x["fn"]();
var b = x['foo'];
var c = x['fn']();
var d = x.bar.baz;
var e = x[0].foo;
var f = x["0"].bar;
var f = x['0'].bar;

View File

@ -1,3 +1,3 @@
//// [anyPropertyAccess.ts]
var x;
x.foo, x.foo, x.fn(), x.bar.baz, x[0].foo, x["0"].bar;
x.foo, x.foo, x.fn(), x.bar.baz, x[0].foo, x['0'].bar;

View File

@ -9,7 +9,7 @@ var arr1 = [
1
],
[
""
''
]
];
var arr2 = [
@ -20,20 +20,20 @@ var arr2 = [
1
],
[
""
''
]
];
// Array literal with elements of only EveryType E has type E[]
var stringArrArr = [
[
""
''
],
[
""
]
];
var stringArr = [
"",
'',
""
];
var numberArr = [
@ -65,9 +65,9 @@ var classTypeArray; // Should OK, not be a parse error
// Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[]
var context1 = [
{
a: "",
a: '',
b: 0,
c: ""
c: ''
},
{
a: "",
@ -77,9 +77,9 @@ var context1 = [
];
var context2 = [
{
a: "",
a: '',
b: 0,
c: ""
c: ''
},
{
a: "",

View File

@ -26,7 +26,7 @@ var z = [
c
];
var r4 = z[0];
var r5 = r4(""); // any not string
var r5 = r4(''); // any not string
var r5b = r4(1);
var a2;
var b2;
@ -37,4 +37,4 @@ var z2 = [
c2
];
var r6 = z2[0];
var r7 = r6(""); // any not string
var r7 = r6(''); // any not string

View File

@ -8,8 +8,8 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
function() {}
][0](), new function C() {
_class_call_check(this, C);
}(), a(""), a(1), (0, [
}(), a(''), a(1), (0, [
a2,
b2,
c2
][0])("");
][0])('');

View File

@ -50,60 +50,60 @@ f1.apply(void 0, [
]);
var x21 = f2.apply(void 0, [
1,
"foo"
'foo'
]);
var x22 = f2.apply(void 0, [
true,
1,
"foo"
'foo'
]);
var x23 = f2.apply(void 0, [
1,
"foo"
'foo'
]);
var x24 = f2.apply(void 0, [
true,
1,
"foo"
'foo'
]);
var x31 = f3.apply(void 0, [
1,
"foo"
'foo'
]);
var x32 = f3.apply(void 0, [
true,
1,
"foo"
'foo'
]);
var x33 = f3.apply(void 0, [
1,
"foo"
'foo'
]);
var x34 = f3.apply(void 0, [
true,
1,
"foo"
'foo'
]);
var x41 = f4.apply(void 0, [
1,
"foo"
'foo'
]);
var x42 = f4.apply(void 0, [
true,
1,
"foo"
'foo'
]);
var x43 = f4.apply(void 0, [
1,
"foo"
'foo'
]);
var x44 = f4.apply(void 0, [
true,
1,
"foo"
'foo'
]);
(_action = action).run.apply(_action, [
100,
"foo"
'foo'
] // error
);

View File

@ -44,47 +44,47 @@ f1.apply(void 0, [
6
]), f2.apply(void 0, [
1,
"foo"
'foo'
]), f2.apply(void 0, [
!0,
1,
"foo"
'foo'
]), f2.apply(void 0, [
1,
"foo"
'foo'
]), f2.apply(void 0, [
!0,
1,
"foo"
'foo'
]), f3.apply(void 0, [
1,
"foo"
'foo'
]), f3.apply(void 0, [
!0,
1,
"foo"
'foo'
]), f3.apply(void 0, [
1,
"foo"
'foo'
]), f3.apply(void 0, [
!0,
1,
"foo"
'foo'
]), f4.apply(void 0, [
1,
"foo"
'foo'
]), f4.apply(void 0, [
!0,
1,
"foo"
'foo'
]), f4.apply(void 0, [
1,
"foo"
'foo'
]), f4.apply(void 0, [
!0,
1,
"foo"
'foo'
]), (_action = action).run.apply(_action, [
100,
"foo"
'foo'
]);

View File

@ -108,7 +108,7 @@ function someFn() {
// Arrow function used in function
function someOtherFn() {
var arr = function(n) {
return "" + n;
return '' + n;
};
arr(4).charAt(0);
}
@ -129,7 +129,7 @@ var f = function(n) {
};
return fn(4);
};
var g = f("")();
var g = f('')();
var g;
// Arrow function used in nested function in arrow function in nested function
function someOuterFn() {
@ -143,7 +143,7 @@ function someOuterFn() {
};
return arr;
}
var h = someOuterFn()("")()();
var h = someOuterFn()('')()();
h.toExponential();
// Arrow function used in try/catch/finally in function
function tryCatchFn() {
@ -158,7 +158,7 @@ function tryCatchFn() {
};
} finally{
var m = function() {
return _this + "";
return _this + '';
};
}
}

View File

@ -5,4 +5,4 @@ var y = null.length;
var z = Date;
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
var j = 32;
j = "";
j = '';

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