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

Implement new @swc/helpers #7182

Merged
merged 9 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/swc/tests/vercel/full/d3-color/1/output/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import t from "@swc/helpers/src/_instanceof.mjs";
import { _ as t } from "@swc/helpers/_/_instanceof";
import i, { extend as h } from "./define.js";
import { Color as e, rgbConvert as s, Rgb as r, darker as n, brighter as o } from "./color.js";
import { deg2rad as a, rad2deg as u } from "./math.js";
Expand Down
44 changes: 22 additions & 22 deletions crates/swc/tests/vercel/full/d3-time-format/1/output/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import n from "@swc/helpers/src/_instanceof.mjs";
import { _ as n } from "@swc/helpers/_/_instanceof";
import { timeDay as t, timeSunday as e, timeMonday as r, timeThursday as u, timeYear as c, utcDay as i, utcSunday as o, utcMonday as f, utcThursday as a, utcYear as l } from "d3-time";
function g(n) {
if (0 <= n.y && n.y < 100) {
Expand Down Expand Up @@ -48,11 +48,11 @@ export default function v(e) {
for(var u, c, i = 0, o = t.length, f = e.length; i < o;){
if (r >= f) return -1;
if (37 === (u = t.charCodeAt(i++))) {
if (!(c = nI[(u = t.charAt(i++)) in y ? t.charAt(i++) : u]) || (r = c(n, e, r)) < 0) return -1;
if (!(c = nG[(u = t.charAt(i++)) in y ? t.charAt(i++) : u]) || (r = c(n, e, r)) < 0) return -1;
} else if (u != e.charCodeAt(r++)) return -1;
}
return r;
}, a = e.dateTime, l = e.date, v = e.time, C = e.periods, U = e.days, d = e.shortDays, D = e.months, x = e.shortMonths, nn = T(C), nx = m(C), nA = T(U), nV = m(U), nW = T(d), nj = m(d), nq = T(D), nQ = m(D), nX = T(x), nb = m(x), nB = {
}, a = e.dateTime, l = e.date, v = e.time, C = e.periods, U = e.days, d = e.shortDays, D = e.months, x = e.shortMonths, nn = T(C), nx = m(C), nA = T(U), nV = m(U), nW = T(d), nj = m(d), nq = T(D), nQ = m(D), nX = T(x), n_ = m(x), nb = {
a: function(n) {
return d[n.getDay()];
},
Expand All @@ -66,12 +66,12 @@ export default function v(e) {
return D[n.getMonth()];
},
c: null,
d: $,
e: $,
d: I,
e: I,
f: P,
g: nc,
G: no,
H: _,
H: $,
I: z,
j: E,
L: O,
Expand All @@ -97,7 +97,7 @@ export default function v(e) {
Y: ni,
Z: nf,
"%": nY
}, nG = {
}, nB = {
a: function(n) {
return d[n.getUTCDay()];
},
Expand Down Expand Up @@ -142,7 +142,7 @@ export default function v(e) {
Y: nH,
Z: nS,
"%": nY
}, nI = {
}, nG = {
a: function(n, t, e) {
var r = nW.exec(t.slice(e));
return r ? (n.w = nj.get(r[0].toLowerCase()), e + r[0].length) : -1;
Expand All @@ -153,7 +153,7 @@ export default function v(e) {
},
b: function(n, t, e) {
var r = nX.exec(t.slice(e));
return r ? (n.m = nb.get(r[0].toLowerCase()), e + r[0].length) : -1;
return r ? (n.m = n_.get(r[0].toLowerCase()), e + r[0].length) : -1;
},
B: function(n, t, e) {
var r = nq.exec(t.slice(e));
Expand All @@ -164,7 +164,7 @@ export default function v(e) {
},
d: V,
e: V,
f: b,
f: _,
g: Y,
G: S,
H: j,
Expand All @@ -178,8 +178,8 @@ export default function v(e) {
return r ? (n.p = nx.get(r[0].toLowerCase()), e + r[0].length) : -1;
},
q: Z,
Q: G,
s: I,
Q: B,
s: G,
S: Q,
u: M,
U: p,
Expand All @@ -195,11 +195,11 @@ export default function v(e) {
y: Y,
Y: S,
Z: F,
"%": B
"%": b
};
return nB.x = u(l, nB), nB.X = u(v, nB), nB.c = u(a, nB), nG.x = u(l, nG), nG.X = u(v, nG), nG.c = u(a, nG), {
return nb.x = u(l, nb), nb.X = u(v, nb), nb.c = u(a, nb), nB.x = u(l, nB), nB.X = u(v, nB), nB.c = u(a, nB), {
format: function(n) {
var t = u(n += "", nB);
var t = u(n += "", nb);
return t.toString = function() {
return n;
}, t;
Expand All @@ -211,7 +211,7 @@ export default function v(e) {
}, t;
},
utcFormat: function(n) {
var t = u(n += "", nG);
var t = u(n += "", nB);
return t.toString = function() {
return n;
}, t;
Expand Down Expand Up @@ -311,26 +311,26 @@ function X(n, t, e) {
var r = C.exec(t.slice(e, e + 3));
return r ? (n.L = +r[0], e + r[0].length) : -1;
}
function b(n, t, e) {
function _(n, t, e) {
var r = C.exec(t.slice(e, e + 6));
return r ? (n.L = Math.floor(r[0] / 1000), e + r[0].length) : -1;
}
function B(n, t, e) {
function b(n, t, e) {
var r = U.exec(t.slice(e, e + 1));
return r ? e + r[0].length : -1;
}
function G(n, t, e) {
function B(n, t, e) {
var r = C.exec(t.slice(e));
return r ? (n.Q = +r[0], e + r[0].length) : -1;
}
function I(n, t, e) {
function G(n, t, e) {
var r = C.exec(t.slice(e));
return r ? (n.s = +r[0], e + r[0].length) : -1;
}
function $(n, t) {
function I(n, t) {
return D(n.getDate(), t, 2);
}
function _(n, t) {
function $(n, t) {
return D(n.getHours(), t, 2);
}
function z(n, t) {
Expand Down
6 changes: 3 additions & 3 deletions crates/swc/tests/vercel/full/next-31419/1/output/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import r from "@swc/helpers/src/_async_to_generator.mjs";
import n from "@swc/helpers/src/_ts_generator.mjs";
import t from "@swc/helpers/src/_ts_values.mjs";
import { _ as r } from "@swc/helpers/_/_async_to_generator";
import { _ as n } from "@swc/helpers/_/_ts_generator";
import { _ as t } from "@swc/helpers/_/_ts_values";
Promise.all(assignAll).then(function() {
var e = r(function(r) {
var e, s, i, c, o;
Expand Down
28 changes: 14 additions & 14 deletions crates/swc/tests/vercel/full/next-31419/2/output/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import r from "@swc/helpers/src/_async_to_generator.mjs";
import { _ as n } from "@swc/helpers/_/_async_to_generator";
Promise.all(assignAll).then(function() {
var n = r(function*(r) {
for(let r in obj){
let n = obj[r];
n.id, (yield listOfUser(n.id)).forEach((r)=>{
insertQuery += `INSERT INTO "TABLE"("UUID", id, other_ids_here) VALUES ('${uuidv4()}', '${n.id}', now());`;
var r = n(function*(n) {
for(let n in obj){
let r = obj[n];
r.id, (yield listOfUser(r.id)).forEach((n)=>{
insertQuery += `INSERT INTO "TABLE"("UUID", id, other_ids_here) VALUES ('${uuidv4()}', '${r.id}', now());`;
});
}
});
return function(r) {
return n.apply(this, arguments);
return function(n) {
return r.apply(this, arguments);
};
}());
export const listOfUser = function(n) {
export const listOfUser = function(r) {
var e;
return new Promise((e = r(function*(r, e) {
let t = `Select Distinct id from "TABLE" Where id = '${n}' And user_id IS not null`;
postgreSQL.query(t, null, function(n, t) {
n ? e(n) : r(t.rows);
return new Promise((e = n(function*(n, e) {
let t = `Select Distinct id from "TABLE" Where id = '${r}' And user_id IS not null`;
postgreSQL.query(t, null, function(r, t) {
r ? e(r) : n(t.rows);
});
}), function(r, n) {
}), function(n, r) {
return e.apply(this, arguments);
}));
};