Allow extending untranspiled classes (#8656)

This commit is contained in:
Nicolò Ribaudo
2020-03-16 23:59:15 +01:00
committed by GitHub
parent a875560c31
commit f6c7bf36ce
152 changed files with 1013 additions and 265 deletions

View File

@@ -1,6 +1,6 @@
{
"plugins": [
"external-helpers",
["external-helpers", { "helperVersion": "7.100.0" }],
"proposal-class-properties",
"transform-classes"
]

View File

@@ -13,13 +13,15 @@ let Hello = function Hello() {
let Outer = /*#__PURE__*/function (_Hello) {
babelHelpers.inherits(Outer, _Hello);
var _super = babelHelpers.createSuper(Outer);
function Outer() {
let _this2;
var _this;
babelHelpers.classCallCheck(this, Outer);
_this2 = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Outer).call(this));
_this2 = _this = _super.call(this);
let Inner = function Inner() {
babelHelpers.classCallCheck(this, Inner);

View File

@@ -17,13 +17,15 @@ let Hello = /*#__PURE__*/function () {
let Outer = /*#__PURE__*/function (_Hello) {
babelHelpers.inherits(Outer, _Hello);
var _super = babelHelpers.createSuper(Outer);
function Outer() {
let _babelHelpers$get$cal;
var _this;
babelHelpers.classCallCheck(this, Outer);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Outer).call(this));
_this = _super.call(this);
_babelHelpers$get$cal = babelHelpers.get(babelHelpers.getPrototypeOf(Outer.prototype), "toString", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this));
let Inner = function Inner() {

View File

@@ -3,19 +3,21 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _this;
babelHelpers.classCallCheck(this, Foo);
if (condition) {
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this));
_this = _super.call(this);
Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, {
writable: true,
value: "foo"
});
} else {
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this));
_this = _super.call(this);
Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, {
writable: true,
value: "foo"

View File

@@ -15,11 +15,13 @@ var Bar = /*#__PURE__*/function (_Foo) {
babelHelpers.inherits(Bar, _Foo);
var _super = babelHelpers.createSuper(Bar);
function Bar(...args) {
var _this;
babelHelpers.classCallCheck(this, Bar);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Bar).call(this, ...args));
_this = _super.call(this, ...args);
Object.defineProperty(babelHelpers.assertThisInitialized(_this), _prop2, {
writable: true,
value: "bar"

View File

@@ -3,11 +3,13 @@ var Child = /*#__PURE__*/function (_Parent) {
babelHelpers.inherits(Child, _Parent);
var _super = babelHelpers.createSuper(Child);
function Child() {
var _this;
babelHelpers.classCallCheck(this, Child);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Child).call(this));
_this = _super.call(this);
Object.defineProperty(babelHelpers.assertThisInitialized(_this), _scopedFunctionWithThis, {
writable: true,
value: function value() {

View File

@@ -1,11 +1,6 @@
{
"plugins": [
[
"external-helpers",
{
"helperVersion": "7.0.2"
}
],
["external-helpers", { "helperVersion": "7.100.0" }],
["proposal-class-properties", { "loose": true }],
"transform-classes",
"transform-block-scoping",

View File

@@ -10,9 +10,11 @@ var Outer = function Outer() {
var Test = /*#__PURE__*/function (_babelHelpers$classPr) {
babelHelpers.inherits(Test, _babelHelpers$classPr);
var _super = babelHelpers.createSuper(Test);
function Test() {
babelHelpers.classCallCheck(this, Test);
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Test).apply(this, arguments));
return _super.apply(this, arguments);
}
return Test;

View File

@@ -3,11 +3,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _temp, _this;
babelHelpers.classCallCheck(this, Foo);
foo((_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)), Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, {
foo((_temp = _this = _super.call(this), Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, {
writable: true,
value: "foo"
}), _temp));

View File

@@ -3,11 +3,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _this;
babelHelpers.classCallCheck(this, Foo);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this));
_this = _super.call(this);
Object.defineProperty(babelHelpers.assertThisInitialized(_this), _bar, {
writable: true,
value: "foo"

View File

@@ -3,20 +3,22 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _this;
babelHelpers.classCallCheck(this, Foo);
if (condition) {
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this));
_this = _super.call(this);
_bar.set(babelHelpers.assertThisInitialized(_this), {
writable: true,
value: "foo"
});
} else {
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this));
_this = _super.call(this);
_bar.set(babelHelpers.assertThisInitialized(_this), {
writable: true,

View File

@@ -16,11 +16,13 @@ var Bar = /*#__PURE__*/function (_Foo) {
babelHelpers.inherits(Bar, _Foo);
var _super = babelHelpers.createSuper(Bar);
function Bar(...args) {
var _this;
babelHelpers.classCallCheck(this, Bar);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Bar).call(this, ...args));
_this = _super.call(this, ...args);
_prop2.set(babelHelpers.assertThisInitialized(_this), {
writable: true,

View File

@@ -3,11 +3,13 @@ var Child = /*#__PURE__*/function (_Parent) {
babelHelpers.inherits(Child, _Parent);
var _super = babelHelpers.createSuper(Child);
function Child() {
var _this;
babelHelpers.classCallCheck(this, Child);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Child).call(this));
_this = _super.call(this);
_scopedFunctionWithThis.set(babelHelpers.assertThisInitialized(_this), {
writable: true,

View File

@@ -1,11 +1,6 @@
{
"plugins": [
[
"external-helpers",
{
"helperVersion": "7.4.4"
}
],
["external-helpers", { "helperVersion": "7.100.0" }],
"proposal-class-properties",
"transform-classes",
"transform-block-scoping",

View File

@@ -11,9 +11,11 @@ var Outer = function Outer() {
var Test = /*#__PURE__*/function (_babelHelpers$classPr) {
babelHelpers.inherits(Test, _babelHelpers$classPr);
var _super = babelHelpers.createSuper(Test);
function Test() {
babelHelpers.classCallCheck(this, Test);
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Test).apply(this, arguments));
return _super.apply(this, arguments);
}
return Test;

View File

@@ -19,11 +19,13 @@ var B = /*#__PURE__*/function (_A) {
babelHelpers.inherits(B, _A);
var _super = babelHelpers.createSuper(B);
function B(...args) {
var _this;
babelHelpers.classCallCheck(this, B);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).call(this, ...args));
_this = _super.call(this, ...args);
_foo.set(babelHelpers.assertThisInitialized(_this), {
writable: true,

View File

@@ -3,11 +3,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _temp, _this;
babelHelpers.classCallCheck(this, Foo);
foo((_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)), _bar.set(babelHelpers.assertThisInitialized(_this), {
foo((_temp = _this = _super.call(this), _bar.set(babelHelpers.assertThisInitialized(_this), {
writable: true,
value: "foo"
}), _temp));

View File

@@ -3,11 +3,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _this;
babelHelpers.classCallCheck(this, Foo);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this));
_this = _super.call(this);
_bar.set(babelHelpers.assertThisInitialized(_this), {
writable: true,

View File

@@ -3,11 +3,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo(...args) {
var _this;
babelHelpers.classCallCheck(this, Foo);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this, ...args));
_this = _super.call(this, ...args);
_this.bar = "foo";
return _this;
}

View File

@@ -1,6 +1,6 @@
{
"plugins": [
"external-helpers",
["external-helpers", { "helperVersion": "7.100.0" }],
["proposal-class-properties", { "loose": true }]
],
"presets": ["env"]

View File

@@ -3,11 +3,13 @@ var Child = /*#__PURE__*/function (_Parent) {
babelHelpers.inherits(Child, _Parent);
var _super = babelHelpers.createSuper(Child);
function Child() {
var _this;
babelHelpers.classCallCheck(this, Child);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Child).call(this));
_this = _super.call(this);
_this.scopedFunctionWithThis = function () {
_this.name = {};

View File

@@ -1,6 +1,6 @@
{
"plugins": [
"external-helpers",
["external-helpers", { "helperVersion": "7.100.0" }],
["proposal-class-properties", { "loose": true }],
"transform-classes",
"transform-block-scoping",

View File

@@ -6,9 +6,11 @@ function withContext(ComposedComponent) {
babelHelpers.inherits(WithContext, _Component);
var _super = babelHelpers.createSuper(WithContext);
function WithContext() {
babelHelpers.classCallCheck(this, WithContext);
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(WithContext).apply(this, arguments));
return _super.apply(this, arguments);
}
return WithContext;

View File

@@ -11,9 +11,11 @@ var B = /*#__PURE__*/function (_A) {
babelHelpers.inherits(B, _A);
var _super = babelHelpers.createSuper(B);
function B() {
babelHelpers.classCallCheck(this, B);
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).apply(this, arguments));
return _super.apply(this, arguments);
}
return B;

View File

@@ -19,11 +19,13 @@ var B = /*#__PURE__*/function (_A) {
babelHelpers.inherits(B, _A);
var _super = babelHelpers.createSuper(B);
function B(...args) {
var _this;
babelHelpers.classCallCheck(this, B);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).call(this, ...args));
_this = _super.call(this, ...args);
_this.foo = babelHelpers.get(babelHelpers.getPrototypeOf(B.prototype), "foo", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this));
return _this;
}

View File

@@ -3,11 +3,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _temp, _this;
babelHelpers.classCallCheck(this, Foo);
foo((_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)), _this.bar = "foo", _temp));
foo((_temp = _this = _super.call(this), _this.bar = "foo", _temp));
return _this;
}

View File

@@ -3,11 +3,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _this;
babelHelpers.classCallCheck(this, Foo);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this));
_this = _super.call(this);
_this.bar = "foo";
return _this;
}

View File

@@ -3,16 +3,18 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _this;
babelHelpers.classCallCheck(this, Foo);
if (condition) {
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this));
_this = _super.call(this);
babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo");
} else {
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this));
_this = _super.call(this);
babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo");
}

View File

@@ -3,11 +3,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo(...args) {
var _this;
babelHelpers.classCallCheck(this, Foo);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this, ...args));
_this = _super.call(this, ...args);
babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo");
return _this;
}

View File

@@ -1,13 +1,19 @@
function _createSuper(Derived) { return function () { var Super = babelHelpers.getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
var Child = /*#__PURE__*/function (_Parent) {
"use strict";
babelHelpers.inherits(Child, _Parent);
var _super = _createSuper(Child);
function Child() {
var _this;
babelHelpers.classCallCheck(this, Child);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Child).call(this));
_this = _super.call(this);
babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "scopedFunctionWithThis", function () {
_this.name = {};
});

View File

@@ -1,6 +1,6 @@
{
"plugins": [
"external-helpers",
["external-helpers", { "helperVersion": "7.100.0" }],
"proposal-class-properties",
"transform-classes",
"transform-block-scoping",

View File

@@ -6,9 +6,11 @@ function withContext(ComposedComponent) {
babelHelpers.inherits(WithContext, _Component);
var _super = babelHelpers.createSuper(WithContext);
function WithContext() {
babelHelpers.classCallCheck(this, WithContext);
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(WithContext).apply(this, arguments));
return _super.apply(this, arguments);
}
return WithContext;

View File

@@ -11,9 +11,11 @@ var B = /*#__PURE__*/function (_A) {
babelHelpers.inherits(B, _A);
var _super = babelHelpers.createSuper(B);
function B() {
babelHelpers.classCallCheck(this, B);
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).apply(this, arguments));
return _super.apply(this, arguments);
}
return B;

View File

@@ -19,11 +19,13 @@ var B = /*#__PURE__*/function (_A) {
babelHelpers.inherits(B, _A);
var _super = babelHelpers.createSuper(B);
function B(...args) {
var _this;
babelHelpers.classCallCheck(this, B);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(B).call(this, ...args));
_this = _super.call(this, ...args);
babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "foo", babelHelpers.get(babelHelpers.getPrototypeOf(B.prototype), "foo", babelHelpers.assertThisInitialized(_this)).call(babelHelpers.assertThisInitialized(_this)));
return _this;
}

View File

@@ -3,11 +3,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _temp, _this;
babelHelpers.classCallCheck(this, Foo);
foo((_temp = _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this)), babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo"), _temp));
foo((_temp = _this = _super.call(this), babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo"), _temp));
return _this;
}

View File

@@ -3,11 +3,13 @@ var Foo = /*#__PURE__*/function (_Bar) {
babelHelpers.inherits(Foo, _Bar);
var _super = babelHelpers.createSuper(Foo);
function Foo() {
var _this;
babelHelpers.classCallCheck(this, Foo);
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Foo).call(this));
_this = _super.call(this);
babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo");
return _this;
}

View File

@@ -1,9 +1,13 @@
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
@@ -26,9 +30,9 @@ var Test = function Test() {
var Other = /*#__PURE__*/function (_Test) {
_inherits(Other, _Test);
function Other() {
var _getPrototypeOf2;
var _super = _createSuper(Other);
function Other() {
var _this;
_classCallCheck(this, Other);
@@ -37,7 +41,7 @@ var Test = function Test() {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Other)).call.apply(_getPrototypeOf2, [this].concat(args)));
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "a", function () {
return _get(_getPrototypeOf(Other.prototype), "test", _assertThisInitialized(_this));

View File

@@ -1,6 +1,6 @@
{
"plugins": [
"external-helpers",
["external-helpers", { "helperVersion": "7.100.0" }],
["proposal-class-properties", { "loose": true }],
"transform-classes",
"transform-block-scoping",

View File

@@ -6,9 +6,11 @@ function withContext(ComposedComponent) {
babelHelpers.inherits(WithContext, _Component);
var _super = babelHelpers.createSuper(WithContext);
function WithContext() {
babelHelpers.classCallCheck(this, WithContext);
return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(WithContext).apply(this, arguments));
return _super.apply(this, arguments);
}
return WithContext;