Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(es/utils): More uniqure name for alias #6399

Merged
merged 2 commits into from Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
@@ -1,6 +1,6 @@
import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs";
function a(param) {
var _b = param.b, b = _b === void 0 ? [] : _b;
var _param_b = param.b, b = _param_b === void 0 ? [] : _param_b;
var t = useMemo(function() {
return(// Cmt1
_to_consumable_array(a.slice(0, 1)).concat(// Cmt2
Expand Down
4 changes: 2 additions & 2 deletions crates/swc/tests/fixture/issues-1xxx/1107/1/output/index.js
@@ -1,13 +1,13 @@
import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
export var Class1 = function Class1(param) {
"use strict";
var _name = param.name, name = _name === void 0 ? "" : _name;
var _param_name = param.name, name = _param_name === void 0 ? "" : _param_name;
_class_call_check(this, Class1);
console.log(name);
};
export var Class2 = function Class2(param) {
"use strict";
var _name = param.name, name = _name === void 0 ? "" : _name;
var _param_name = param.name, name = _param_name === void 0 ? "" : _param_name;
_class_call_check(this, Class2);
console.log(name);
};
Expand Up @@ -271,9 +271,9 @@ class Shard extends _utils.Emitter {
* Called whenever the websocket opens.
* @private
*/ _open() {
var ref;
var _class_private_field_get;
this.status = _utils.Status.HANDSHAKING;
this._debug(`Connected. ${(ref = _classPrivateFieldGet(this, _ws1)) === null || ref === void 0 ? void 0 : ref.url} in ${Date.now() - this.connectedAt}`);
this._debug(`Connected. ${(_class_private_field_get = _classPrivateFieldGet(this, _ws1)) === null || _class_private_field_get === void 0 ? void 0 : _class_private_field_get.url} in ${Date.now() - this.connectedAt}`);
if (_classPrivateFieldGet(this, _queue).length) {
this._debug(`${_classPrivateFieldGet(this, _queue).length} packets waiting... sending all now.`);
while(_classPrivateFieldGet(this, _queue).length){
Expand All @@ -300,8 +300,8 @@ class Shard extends _utils.Emitter {
* @param {WebSocket.CloseEvent} evt
* @private
*/ _close(evt) {
var ref;
const reason = (ref = evt.reason || _utils.GatewayCloseCode[evt.code]) !== null && ref !== void 0 ? ref : "unknown";
var _ref;
const reason = (_ref = evt.reason || _utils.GatewayCloseCode[evt.code]) !== null && _ref !== void 0 ? _ref : "unknown";
this._debug(`Closed; Code = ${evt.code}, Clean? = ${evt.wasClean}, Reason = ${reason}`);
if (_classPrivateFieldGet(this, _seq) !== -1) {
_classPrivateFieldSet(this, _closingSeq, _classPrivateFieldGet(this, _seq));
Expand Down
Expand Up @@ -59,8 +59,8 @@ class RequestHandler {
].includes(p) ? match : `/${p}/:id`).replace(/\/reactions\/[^/]+/g, "/reactions/:id").replace(/\/webhooks\/(\d+)\/[\w-]{64,}/, "webhooks/$1/:token").replace(/\?.*$/, "");
let ending = ";";
if (method === "delete" && route.endsWith("/message/:id")) {
var ref;
const id = (ref = /\d{16,19}$/.exec(route)) === null || ref === void 0 ? void 0 : ref[0];
var _exec;
const id = (_exec = /\d{16,19}$/.exec(route)) === null || _exec === void 0 ? void 0 : _exec[0];
const snowflake = _utils.Snowflake.deconstruct(id);
if (Date.now() - snowflake.timestamp > 1000 * 60 * 60 * 24 * 14) {
ending += "deletes-old";
Expand All @@ -73,8 +73,8 @@ class RequestHandler {
* @param {Response} res
* @return {* | Promise<any>}
*/ static async parseResponse(res) {
var ref;
if ((ref = res.headers.get("Content-Type")) === null || ref === void 0 ? void 0 : ref.startsWith("application/json")) {
var _res_headers_get;
if ((_res_headers_get = res.headers.get("Content-Type")) === null || _res_headers_get === void 0 ? void 0 : _res_headers_get.startsWith("application/json")) {
return await res.json();
}
return res.buffer();
Expand Down
Expand Up @@ -6,9 +6,9 @@ function foo() {
}
function _foo() {
_foo = _async_to_generator(function() {
var tmp, ref, ref;
var tmp, _ref, _ref;
return _ts_generator(this, function(_state) {
tmp = baz.bar, ref = tmp === void 0 ? {} : tmp, ref = ref !== null ? ref : _throw(new TypeError("Cannot destructure undefined"));
tmp = baz.bar, _ref = tmp === void 0 ? {} : tmp, _ref = _ref !== null ? _ref : _throw(new TypeError("Cannot destructure undefined"));
return [
2
];
Expand Down
Expand Up @@ -6,9 +6,9 @@ function f(a, b) {
}
function _f() {
_f = _async_to_generator(function(a, b) {
var ref, ref1, tmp, a_;
var _JSON_parse, _JSON_parse_, tmp, a_;
return _ts_generator(this, function(_state) {
ref = _sliced_to_array(JSON.parse(b), 1), ref1 = ref[0], tmp = ref1.a, a_ = tmp === void 0 ? 1 : tmp;
_JSON_parse = _sliced_to_array(JSON.parse(b), 1), _JSON_parse_ = _JSON_parse[0], tmp = _JSON_parse_.a, a_ = tmp === void 0 ? 1 : tmp;
return [
2
];
Expand Down
@@ -1,6 +1,6 @@
import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs";
function Bar() {
var ref = _sliced_to_array(useState(0), 2), foo = ref[0], setFoo = ref[1];
var _useState = _sliced_to_array(useState(0), 2), foo = _useState[0], setFoo = _useState[1];
// @refresh reset
React.useEffect(function() {});
return /*#__PURE__*/ React.createElement("h1", null, foo, " ");
Expand Down
4 changes: 2 additions & 2 deletions crates/swc/tests/fixture/issues-2xxx/2063/output/index.js
@@ -1,7 +1,7 @@
var _value, ref;
var _myVar_target_value, _myVar_target_value_toLowerCase;
var myVar = {
target: {
value: "ABC"
}
};
console.log((ref = (_value = myVar.target.value).toLowerCase) === null || ref === void 0 ? void 0 : ref.call(_value));
console.log((_myVar_target_value_toLowerCase = (_myVar_target_value = myVar.target.value).toLowerCase) === null || _myVar_target_value_toLowerCase === void 0 ? void 0 : _myVar_target_value_toLowerCase.call(_myVar_target_value));
6 changes: 3 additions & 3 deletions crates/swc/tests/fixture/issues-2xxx/2139/output/index.tsx
Expand Up @@ -8,7 +8,7 @@ class ReusablePayments extends PureComponent {
}
}
setDefaultReusablePayment(skipPaymentSource) {
var _props = this.props, reusablePaymentSources = _props.reusablePaymentSources, selectedReusablePayment = _props.selectedReusablePayment, onChange = _props.onChange;
var _this_props = this.props, reusablePaymentSources = _this_props.reusablePaymentSources, selectedReusablePayment = _this_props.selectedReusablePayment, onChange = _this_props.onChange;
var validReusablePaymentSources = reusablePaymentSources.filter((ps)=>ps.__typename === "StripePaymentSource" && ps !== skipPaymentSource);
if (selectedReusablePayment === null) {
return;
Expand All @@ -25,7 +25,7 @@ class ReusablePayments extends PureComponent {
onChange(ps || validReusablePaymentSources[0]);
}
render() {
var _props = this.props, selectedReusablePayment = _props.selectedReusablePayment, reusablePaymentSources = _props.reusablePaymentSources;
var _this_props = this.props, selectedReusablePayment = _this_props.selectedReusablePayment, reusablePaymentSources = _this_props.reusablePaymentSources;
var stripePaymentSources = reusablePaymentSources.filter((ps)=>ps.__typename === "StripePaymentSource");
if (!stripePaymentSources.length) {
return null;
Expand Down Expand Up @@ -85,7 +85,7 @@ class ReusablePayments extends PureComponent {
return this.props.onChange(selected);
};
this.handleDeletePaymentSource = (id, deletePaymentSource)=>{
var _props = this.props, selectedReusablePayment = _props.selectedReusablePayment, onChange = _props.onChange;
var _this_props = this.props, selectedReusablePayment = _this_props.selectedReusablePayment, onChange = _this_props.onChange;
if (onChange && selectedReusablePayment && selectedReusablePayment.id === id) {
this.setDefaultReusablePayment(selectedReusablePayment);
}
Expand Down
Expand Up @@ -13,9 +13,9 @@ var Foo = /*#__PURE__*/ function() {
key: "sendSomeMessage",
value: function sendSomeMessage(_parent, _param, _param1) {
return _async_to_generator(function() {
var _input, toNumber, messageBody, all, dataSources;
var _param_input, toNumber, messageBody, all, dataSources;
return _ts_generator(this, function(_state) {
_input = _param.input, toNumber = _input.toNumber, messageBody = _input.messageBody, all = _object_without_properties(_param.input, [
_param_input = _param.input, toNumber = _param_input.toNumber, messageBody = _param_input.messageBody, all = _object_without_properties(_param.input, [
"toNumber",
"messageBody"
]), dataSources = _param1.dataSources;
Expand Down
Expand Up @@ -4,9 +4,9 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs";
var resolver = {
sendSomeMessage: function sendSomeMessage(_parent, _param, _param1) {
return _async_to_generator(function() {
var _input, toNumber, messageBody, all, dataSources;
var _param_input, toNumber, messageBody, all, dataSources;
return _ts_generator(this, function(_state) {
_input = _param.input, toNumber = _input.toNumber, messageBody = _input.messageBody, all = _object_without_properties(_param.input, [
_param_input = _param.input, toNumber = _param_input.toNumber, messageBody = _param_input.messageBody, all = _object_without_properties(_param.input, [
"toNumber",
"messageBody"
]), dataSources = _param1.dataSources;
Expand Down
8 changes: 4 additions & 4 deletions crates/swc/tests/fixture/issues-2xxx/2336/output/input.tsx
@@ -1,5 +1,5 @@
import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs";
var ref = _sliced_to_array(createQuery(), 2);
export var useQuery = ref[0], query = ref[1].query;
var ref1 = _sliced_to_array(createMutation(), 2);
export var useMutation = ref1[0], mutate = ref1[1].mutate;
var _createQuery = _sliced_to_array(createQuery(), 2);
export var useQuery = _createQuery[0], query = _createQuery[1].query;
var _createMutation = _sliced_to_array(createMutation(), 2);
export var useMutation = _createMutation[0], mutate = _createMutation[1].mutate;
Expand Up @@ -2,7 +2,7 @@ export function App() {
return React.createElement(Form, null);
}
export function Form(param) {
var _onChange = param.onChange, onChange = _onChange === void 0 ? function() {} : _onChange;
var _param_onChange = param.onChange, onChange = _param_onChange === void 0 ? function() {} : _param_onChange;
return React.createElement("input", {
onChange: function onChange1() {
onChange();
Expand Down
8 changes: 4 additions & 4 deletions crates/swc/tests/fixture/issues-2xxx/2858/1/output/index.js
@@ -1,9 +1,9 @@
var ref = {
var _ref = {
a: 1,
b: 2
}, a1 = ref.a, b1 = ref.b;
var ref1 = {
}, a1 = _ref.a, b1 = _ref.b;
var _ref1 = {
a: 1,
b: 2
};
export var a2 = ref1.a, b2 = ref1.b;
export var a2 = _ref1.a, b2 = _ref1.b;
8 changes: 4 additions & 4 deletions crates/swc/tests/fixture/issues-2xxx/2858/2/output/index.js
Expand Up @@ -16,12 +16,12 @@ _export(exports, {
return b2;
}
});
var ref = {
var _ref = {
a: 1,
b: 2
}, a1 = ref.a, b1 = ref.b;
var ref1 = {
}, a1 = _ref.a, b1 = _ref.b;
var _ref1 = {
a: 1,
b: 2
};
var a2 = ref1.a, b2 = ref1.b;
var a2 = _ref1.a, b2 = _ref1.b;
8 changes: 4 additions & 4 deletions crates/swc/tests/fixture/issues-4xxx/4108/1/output/index.ts
Expand Up @@ -484,7 +484,7 @@ export var sendTransaction = function() {
}();
export var sendTransactionWithRetry = function() {
var _ref = _async_to_generator(function(connection, wallet, instructions, signers) {
var commitment, includesFeePayer, block, beforeSend, transaction, _tmp, _transaction, _transaction1, _transaction2, ref, txid, slot;
var commitment, includesFeePayer, block, beforeSend, transaction, _tmp, _transaction, _transaction1, _transaction2, _ref, txid, slot;
var _arguments = arguments;
return _ts_generator(this, function(_state) {
switch(_state.label){
Expand Down Expand Up @@ -550,7 +550,7 @@ export var sendTransactionWithRetry = function() {
})
];
case 5:
ref = _state.sent(), txid = ref.txid, slot = ref.slot;
_ref = _state.sent(), txid = _ref.txid, slot = _ref.slot;
return [
2,
{
Expand All @@ -574,11 +574,11 @@ export function sendSignedTransaction(_) {
}
function _sendSignedTransaction() {
_sendSignedTransaction = _async_to_generator(function(param) {
var signedTransaction, connection, _timeout, timeout, rawTransaction, startTime, slot, txid, done, confirmation, err, simulateResult, e, i, line;
var signedTransaction, connection, _param_timeout, timeout, rawTransaction, startTime, slot, txid, done, confirmation, err, simulateResult, e, i, line;
return _ts_generator(this, function(_state) {
switch(_state.label){
case 0:
signedTransaction = param.signedTransaction, connection = param.connection, _timeout = param.timeout, timeout = _timeout === void 0 ? DEFAULT_TIMEOUT : _timeout;
signedTransaction = param.signedTransaction, connection = param.connection, _param_timeout = param.timeout, timeout = _param_timeout === void 0 ? DEFAULT_TIMEOUT : _param_timeout;
rawTransaction = signedTransaction.serialize();
startTime = getUnixTs();
slot = 0;
Expand Down
22 changes: 11 additions & 11 deletions crates/swc/tests/fixture/issues-5xxx/5102/output/index.js
Expand Up @@ -4,22 +4,22 @@ var a = function a() {
"use strict";
_class_call_check(this, a);
};
var ref = [
var _ref = [
function _class() {
"use strict";
_class_call_check(this, _class);
}
], b = ref[0];
var ref1 = [], tmp = ref1[0], c = tmp === void 0 ? function c() {
], b = _ref[0];
var _ref1 = [], tmp = _ref1[0], c = tmp === void 0 ? function c() {
"use strict";
_class_call_check(this, c);
} : tmp;
var ref2 = [
var _ref2 = [
function _class() {
"use strict";
_class_call_check(this, _class);
}
], tmp1 = ref2[0], d = tmp1 === void 0 ? function d() {
], tmp1 = _ref2[0], d = tmp1 === void 0 ? function d() {
"use strict";
_class_call_check(this, d);
} : tmp1;
Expand All @@ -29,20 +29,20 @@ var e = {
_class_call_check(this, e);
}
}.e;
var ref3 = {}, _f = ref3.f, f = _f === void 0 ? function f() {
var _ref3 = {}, _ref_f = _ref3.f, f = _ref_f === void 0 ? function f() {
"use strict";
_class_call_check(this, f);
} : _f;
var ref4 = {
} : _ref_f;
var _ref4 = {
g: function g() {
"use strict";
_class_call_check(this, g);
}
}, _g = ref4.g, g = _g === void 0 ? function g() {
}, _ref_g = _ref4.g, g = _ref_g === void 0 ? function g() {
"use strict";
_class_call_check(this, g);
} : _g;
var ref5 = {}, tmp2 = ref5._, h = tmp2 === void 0 ? function h() {
} : _ref_g;
var _ref5 = {}, tmp2 = _ref5._, h = tmp2 === void 0 ? function h() {
"use strict";
_class_call_check(this, h);
} : tmp2;
Expand Down