Skip to content

Commit

Permalink
All fixtures use external helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Oct 31, 2024
1 parent 65400df commit 5663771
Show file tree
Hide file tree
Showing 66 changed files with 620 additions and 812 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const FILTER_OUT_PLUGINS = [
'transform-destructuring'
];

// Copied from `@babel/helper-transform-fixture-test-runner`
const EXTERNAL_HELPERS_VERSION = "7.100.0";

await mkdir(DEST_DIR_PATH, {recursive: true});
await rm(DEST_DIR_PATH, {recursive: true});
await cp(SRC_DIR_PATH, DEST_DIR_PATH, {recursive: true});
Expand Down Expand Up @@ -166,7 +169,7 @@ async function transform(inputPath, outputPath, options) {
} else {
options.plugins = [];
}
options.plugins.push('@babel/plugin-external-helpers');
options.plugins.push(['@babel/plugin-external-helpers', {helperVersion: EXTERNAL_HELPERS_VERSION}]);

const {code} = await transformFileAsync(inputPath, options);
await writeFile(outputPath, code);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
"use strict";

function _applyDecs(e, t, n, r, o, i) { var a, c, u, s, f, l, p, d = Symbol.metadata || Symbol.for("Symbol.metadata"), m = Object.defineProperty, h = Object.create, y = [h(null), h(null)], v = t.length; function g(t, n, r) { return function (o, i) { n && (i = o, o = e); for (var a = 0; a < t.length; a++) i = t[a].apply(o, r ? [i] : []); return r ? i : o; }; } function b(e, t, n, r) { if ("function" != typeof e && (r || void 0 !== e)) throw new TypeError(t + " must " + (n || "be") + " a function" + (r ? "" : " or undefined")); return e; } function applyDec(e, t, n, r, o, i, u, s, f, l, p) { function d(e) { if (!p(e)) throw new TypeError("Attempted to access private element on non-instance"); } var h = [].concat(t[0]), v = t[3], w = !u, D = 1 === o, S = 3 === o, j = 4 === o, E = 2 === o; function I(t, n, r) { return function (o, i) { return n && (i = o, o = e), r && r(o), P[t].call(o, i); }; } if (!w) { var P = {}, k = [], F = S ? "get" : j || D ? "set" : "value"; if (f ? (l || D ? P = { get: _setFunctionName(function () { return v(this); }, r, "get"), set: function (e) { t[4](this, e); } } : P[F] = v, l || _setFunctionName(P[F], r, E ? "" : F)) : l || (P = Object.getOwnPropertyDescriptor(e, r)), !l && !f) { if ((c = y[+s][r]) && 7 != (c ^ o)) throw Error("Decorating two elements with the same name (" + P[F].name + ") is not supported yet"); y[+s][r] = o < 3 ? 1 : o; } } for (var N = e, O = h.length - 1; O >= 0; O -= n ? 2 : 1) { var T = b(h[O], "A decorator", "be", !0), z = n ? h[O - 1] : void 0, A = {}, H = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: r, metadata: a, addInitializer: function (e, t) { if (e.v) throw new TypeError("attempted to call addInitializer after decoration was finished"); b(t, "An initializer", "be", !0), i.push(t); }.bind(null, A) }; if (w) c = T.call(z, N, H), A.v = 1, b(c, "class decorators", "return") && (N = c);else if (H.static = s, H.private = f, c = H.access = { has: f ? p.bind() : function (e) { return r in e; } }, j || (c.get = f ? E ? function (e) { return d(e), P.value; } : I("get", 0, d) : function (e) { return e[r]; }), E || S || (c.set = f ? I("set", 0, d) : function (e, t) { e[r] = t; }), N = T.call(z, D ? { get: P.get, set: P.set } : P[F], H), A.v = 1, D) { if ("object" == typeof N && N) (c = b(N.get, "accessor.get")) && (P.get = c), (c = b(N.set, "accessor.set")) && (P.set = c), (c = b(N.init, "accessor.init")) && k.unshift(c);else if (void 0 !== N) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined"); } else b(N, (l ? "field" : "method") + " decorators", "return") && (l ? k.unshift(N) : P[F] = N); } return o < 2 && u.push(g(k, s, 1), g(i, s, 0)), l || w || (f ? D ? u.splice(-1, 0, I("get", s), I("set", s)) : u.push(E ? P[F] : b.call.bind(P[F])) : m(e, r, P)), N; } function w(e) { return m(e, d, { configurable: !0, enumerable: !0, value: a }); } return void 0 !== i && (a = i[d]), a = h(null == a ? null : a), f = [], l = function (e) { e && f.push(g(e)); }, p = function (t, r) { for (var i = 0; i < n.length; i++) { var a = n[i], c = a[1], l = 7 & c; if ((8 & c) == t && !l == r) { var p = a[2], d = !!a[3], m = 16 & c; applyDec(t ? e : e.prototype, a, m, d ? "#" + p : _toPropertyKey(p), l, l < 2 ? [] : t ? s = s || [] : u = u || [], f, !!t, d, r, t && d ? function (t) { return _checkInRHS(t) === e; } : o); } } }, p(8, 0), p(0, 0), p(8, 1), p(0, 1), l(u), l(s), c = f, v || w(e), { e: c, get c() { var n = []; return v && [w(e = applyDec(e, [t], r, e.name, 5, n)), g(n, 1)]; } }; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
class Hello {
constructor() {
return () => () => "hello";
Expand All @@ -22,7 +17,7 @@ class Outer extends Hello {
}
}
_Inner = Inner;
[_init_hello, _init_extra_hello] = _applyDecs(_Inner, [], [[_helloDecs, 0, "hello"]]).e;
[_init_hello, _init_extra_hello] = babelHelpers.applyDecs2311(_Inner, [], [[_helloDecs, 0, "hello"]]).e;
return new Inner();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
"use strict";

function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
class Hello {
toString() {
return 'hello';
Expand All @@ -17,16 +10,16 @@ class Outer extends Hello {
let _computedKey;
super();
var _A = /*#__PURE__*/new WeakMap();
_computedKey = _toPropertyKey(super.toString());
_computedKey = babelHelpers.toPropertyKey(super.toString());
class Inner {
constructor() {
_classPrivateFieldInitSpec(this, _A, 'hello');
babelHelpers.classPrivateFieldInitSpec(this, _A, 'hello');
}
get [_computedKey]() {
return _classPrivateFieldGet(_A, this);
return babelHelpers.classPrivateFieldGet2(_A, this);
}
set [_computedKey](v) {
_classPrivateFieldSet(_A, this, v);
babelHelpers.classPrivateFieldSet2(_A, this, v);
}
}
return new Inner();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
"use strict";

function _applyDecs(e, t, n, r, o, i) { var a, c, u, s, f, l, p, d = Symbol.metadata || Symbol.for("Symbol.metadata"), m = Object.defineProperty, h = Object.create, y = [h(null), h(null)], v = t.length; function g(t, n, r) { return function (o, i) { n && (i = o, o = e); for (var a = 0; a < t.length; a++) i = t[a].apply(o, r ? [i] : []); return r ? i : o; }; } function b(e, t, n, r) { if ("function" != typeof e && (r || void 0 !== e)) throw new TypeError(t + " must " + (n || "be") + " a function" + (r ? "" : " or undefined")); return e; } function applyDec(e, t, n, r, o, i, u, s, f, l, p) { function d(e) { if (!p(e)) throw new TypeError("Attempted to access private element on non-instance"); } var h = [].concat(t[0]), v = t[3], w = !u, D = 1 === o, S = 3 === o, j = 4 === o, E = 2 === o; function I(t, n, r) { return function (o, i) { return n && (i = o, o = e), r && r(o), P[t].call(o, i); }; } if (!w) { var P = {}, k = [], F = S ? "get" : j || D ? "set" : "value"; if (f ? (l || D ? P = { get: _setFunctionName(function () { return v(this); }, r, "get"), set: function (e) { t[4](this, e); } } : P[F] = v, l || _setFunctionName(P[F], r, E ? "" : F)) : l || (P = Object.getOwnPropertyDescriptor(e, r)), !l && !f) { if ((c = y[+s][r]) && 7 != (c ^ o)) throw Error("Decorating two elements with the same name (" + P[F].name + ") is not supported yet"); y[+s][r] = o < 3 ? 1 : o; } } for (var N = e, O = h.length - 1; O >= 0; O -= n ? 2 : 1) { var T = b(h[O], "A decorator", "be", !0), z = n ? h[O - 1] : void 0, A = {}, H = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: r, metadata: a, addInitializer: function (e, t) { if (e.v) throw new TypeError("attempted to call addInitializer after decoration was finished"); b(t, "An initializer", "be", !0), i.push(t); }.bind(null, A) }; if (w) c = T.call(z, N, H), A.v = 1, b(c, "class decorators", "return") && (N = c);else if (H.static = s, H.private = f, c = H.access = { has: f ? p.bind() : function (e) { return r in e; } }, j || (c.get = f ? E ? function (e) { return d(e), P.value; } : I("get", 0, d) : function (e) { return e[r]; }), E || S || (c.set = f ? I("set", 0, d) : function (e, t) { e[r] = t; }), N = T.call(z, D ? { get: P.get, set: P.set } : P[F], H), A.v = 1, D) { if ("object" == typeof N && N) (c = b(N.get, "accessor.get")) && (P.get = c), (c = b(N.set, "accessor.set")) && (P.set = c), (c = b(N.init, "accessor.init")) && k.unshift(c);else if (void 0 !== N) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined"); } else b(N, (l ? "field" : "method") + " decorators", "return") && (l ? k.unshift(N) : P[F] = N); } return o < 2 && u.push(g(k, s, 1), g(i, s, 0)), l || w || (f ? D ? u.splice(-1, 0, I("get", s), I("set", s)) : u.push(E ? P[F] : b.call.bind(P[F])) : m(e, r, P)), N; } function w(e) { return m(e, d, { configurable: !0, enumerable: !0, value: a }); } return void 0 !== i && (a = i[d]), a = h(null == a ? null : a), f = [], l = function (e) { e && f.push(g(e)); }, p = function (t, r) { for (var i = 0; i < n.length; i++) { var a = n[i], c = a[1], l = 7 & c; if ((8 & c) == t && !l == r) { var p = a[2], d = !!a[3], m = 16 & c; applyDec(t ? e : e.prototype, a, m, d ? "#" + p : _toPropertyKey(p), l, l < 2 ? [] : t ? s = s || [] : u = u || [], f, !!t, d, r, t && d ? function (t) { return _checkInRHS(t) === e; } : o); } } }, p(8, 0), p(0, 0), p(8, 1), p(0, 1), l(u), l(s), c = f, v || w(e), { e: c, get c() { var n = []; return v && [w(e = applyDec(e, [t], r, e.name, 5, n)), g(n, 1)]; } }; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
class Hello {
dec() {
return () => "hello";
Expand All @@ -23,7 +18,7 @@ class Outer extends Hello {
}
}
_Inner = Inner;
[_init_hello, _init_extra_hello] = _applyDecs(_Inner, [], [[_helloDecs, 16, "hello"]]).e;
[_init_hello, _init_extra_hello] = babelHelpers.applyDecs2311(_Inner, [], [[_helloDecs, 16, "hello"]]).e;
return new Inner();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
function _toSetter(t, e, n) { e || (e = []); var r = e.length++; return Object.defineProperty({}, "_", { set: function (o) { e[r] = o, t.apply(n, e); } }); }
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
var _arr = /*#__PURE__*/new WeakMap();
class D {
constructor() {
_classPrivateFieldInitSpec(this, _arr, void 0);
babelHelpers.classPrivateFieldInitSpec(this, _arr, void 0);
}
f() {
for (const el of _classPrivateFieldGet(_arr, this));
for (const el of babelHelpers.classPrivateFieldGet2(_arr, this));
}
}
var _p = /*#__PURE__*/new WeakMap();
class C {
constructor() {
_classPrivateFieldInitSpec(this, _p, void 0);
babelHelpers.classPrivateFieldInitSpec(this, _p, void 0);
}
m() {
for (_toSetter(_classPrivateFieldSet, [_p, this])._ of []);
for (babelHelpers.toSetter(babelHelpers.classPrivateFieldSet2, [_p, this])._ of []);
}
}
var _arr2 = /*#__PURE__*/new WeakMap();
class E {
constructor() {
_classPrivateFieldInitSpec(this, _arr2, void 0);
babelHelpers.classPrivateFieldInitSpec(this, _arr2, void 0);
}
f() {
for (_toSetter(_classPrivateFieldSet, [_arr2, this])._ of [1, 2]);
for (babelHelpers.toSetter(babelHelpers.classPrivateFieldSet2, [_arr2, this])._ of [1, 2]);
}
}
var _ar = /*#__PURE__*/new WeakMap();
class F {
constructor() {
_classPrivateFieldInitSpec(this, _ar, void 0);
babelHelpers.classPrivateFieldInitSpec(this, _ar, void 0);
}
g() {
for (_toSetter(_classPrivateFieldSet, [_ar, this])._ in [1, 2, 3]);
for (babelHelpers.toSetter(babelHelpers.classPrivateFieldSet2, [_ar, this])._ in [1, 2, 3]);
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
var _foo = /*#__PURE__*/new WeakMap();
class Foo {
constructor() {
_classPrivateFieldInitSpec(this, _foo, 0);
babelHelpers.classPrivateFieldInitSpec(this, _foo, 0);
}
test(other) {
var _other$obj;
_classPrivateFieldSet(_foo, this, _classPrivateFieldGet(_foo, this) + 1);
_classPrivateFieldSet(_foo, this, 2);
_classPrivateFieldSet(_foo, _other$obj = other.obj, _classPrivateFieldGet(_foo, _other$obj) + 1);
_classPrivateFieldSet(_foo, other.obj, 2);
babelHelpers.classPrivateFieldSet2(_foo, this, babelHelpers.classPrivateFieldGet2(_foo, this) + 1);
babelHelpers.classPrivateFieldSet2(_foo, this, 2);
babelHelpers.classPrivateFieldSet2(_foo, _other$obj = other.obj, babelHelpers.classPrivateFieldGet2(_foo, _other$obj) + 1);
babelHelpers.classPrivateFieldSet2(_foo, other.obj, 2);
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
var _foo = /*#__PURE__*/new WeakMap();
class Foo {
constructor() {
_classPrivateFieldInitSpec(this, _foo, function () {
babelHelpers.classPrivateFieldInitSpec(this, _foo, function () {
return this;
});
}
test(other) {
var _other$obj;
_classPrivateFieldGet(_foo, this).call(this);
_classPrivateFieldGet(_foo, _other$obj = other.obj).call(_other$obj);
babelHelpers.classPrivateFieldGet2(_foo, this).call(this);
babelHelpers.classPrivateFieldGet2(_foo, _other$obj = other.obj).call(_other$obj);
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
var _x = /*#__PURE__*/new WeakMap();
var _y = /*#__PURE__*/new WeakMap();
class Point {
constructor(x = 0, y = 0) {
_classPrivateFieldInitSpec(this, _x, void 0);
_classPrivateFieldInitSpec(this, _y, void 0);
_classPrivateFieldSet(_x, this, +x);
_classPrivateFieldSet(_y, this, +y);
babelHelpers.classPrivateFieldInitSpec(this, _x, void 0);
babelHelpers.classPrivateFieldInitSpec(this, _y, void 0);
babelHelpers.classPrivateFieldSet2(_x, this, +x);
babelHelpers.classPrivateFieldSet2(_y, this, +y);
}
get x() {
return _classPrivateFieldGet(_x, this);
return babelHelpers.classPrivateFieldGet2(_x, this);
}
set x(value) {
_classPrivateFieldSet(_x, this, +value);
babelHelpers.classPrivateFieldSet2(_x, this, +value);
}
get y() {
return _classPrivateFieldGet(_y, this);
return babelHelpers.classPrivateFieldGet2(_y, this);
}
set y(value) {
_classPrivateFieldSet(_y, this, +value);
babelHelpers.classPrivateFieldSet2(_y, this, +value);
}
equals(p) {
return _classPrivateFieldGet(_x, this) === _classPrivateFieldGet(_x, p) && _classPrivateFieldGet(_y, this) === _classPrivateFieldGet(_y, p);
return babelHelpers.classPrivateFieldGet2(_x, this) === babelHelpers.classPrivateFieldGet2(_x, p) && babelHelpers.classPrivateFieldGet2(_y, this) === babelHelpers.classPrivateFieldGet2(_y, p);
}
toString() {
return `Point<${_classPrivateFieldGet(_x, this)},${_classPrivateFieldGet(_y, this)}>`;
return `Point<${babelHelpers.classPrivateFieldGet2(_x, this)},${babelHelpers.classPrivateFieldGet2(_y, this)}>`;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
var foo = "bar";
var _bar = /*#__PURE__*/new WeakMap();
class Foo {
constructor() {
_classPrivateFieldInitSpec(this, _bar, foo);
babelHelpers.classPrivateFieldInitSpec(this, _bar, foo);
var _foo = "foo";
}
}
Loading

0 comments on commit 5663771

Please sign in to comment.