babel-compat
Advanced tools
Comparing version 0.22.1 to 0.22.2-alpha.0
@@ -18,2 +18,3 @@ /* | ||
'applyDecoratedDescriptor', | ||
'arrayLikeToArray', | ||
'arrayWithHoles', | ||
@@ -28,5 +29,13 @@ 'arrayWithoutHoles', | ||
'classNameTDZError', | ||
'classPrivateFieldDestructureSet', | ||
'classPrivateMethodGet', | ||
'classPrivateMethodSet', | ||
'classStaticPrivateFieldSpecGet', | ||
'classStaticPrivateFieldSpecSet', | ||
'classStaticPrivateMethodGet', | ||
'classStaticPrivateMethodSet', | ||
'createClass', | ||
'createForOfIteratorHelper', | ||
'createForOfIteratorHelperLoose', | ||
'createSuper', | ||
'decorate', | ||
@@ -50,2 +59,3 @@ 'defaults', | ||
'isNativeFunction', | ||
'isNativeReflectConstruct', | ||
'iterableToArray', | ||
@@ -55,2 +65,3 @@ 'iterableToArrayLimit', | ||
'jsx', | ||
'maybeArrayLike', | ||
@@ -62,2 +73,3 @@ 'newArrowCheck', | ||
'objectSpread', | ||
'objectSpread2', | ||
'objectWithoutProperties', | ||
@@ -73,2 +85,3 @@ 'objectWithoutPropertiesLoose', | ||
'taggedTemplateLiteralLoose', | ||
'tdz', | ||
'temporalRef', | ||
@@ -78,6 +91,10 @@ 'temporalUndefined', | ||
'toConsumableArray', | ||
'toPrimitive', | ||
'toPropertyKey', | ||
'typeof', | ||
'unsupportedIterableToArray', | ||
'wrapAsyncGenerator', | ||
'wrapNativeSuper', | ||
'wrapRegExp', | ||
'writeOnlyError', | ||
]; | ||
@@ -84,0 +101,0 @@ |
export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { | ||
var desc = {}; | ||
Object['ke' + 'ys'](descriptor).forEach(function (key) { | ||
Object.keys(descriptor).forEach(function (key) { | ||
desc[key] = descriptor[key]; | ||
@@ -23,3 +23,3 @@ }); | ||
if (desc.initializer === void 0) { | ||
Object['define' + 'Property'](target, property, desc); | ||
Object.defineProperty(target, property, desc); | ||
desc = null; | ||
@@ -26,0 +26,0 @@ } |
@@ -0,7 +1,4 @@ | ||
import arrayLikeToArray from "./arrayLikeToArray"; | ||
export default function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
if (Array.isArray(arr)) return arrayLikeToArray(arr); | ||
} |
@@ -31,3 +31,3 @@ import AwaitValue from "./AwaitValue"; | ||
if (wrappedAwait) { | ||
resume("next", arg); | ||
resume(key === "return" ? "return" : "next", arg); | ||
return; | ||
@@ -34,0 +34,0 @@ } |
@@ -46,2 +46,7 @@ export default function _asyncGeneratorDelegate(inner, awaitWrap) { | ||
iter.return = function (value) { | ||
if (waiting) { | ||
waiting = false; | ||
return value; | ||
} | ||
return pump("return", value); | ||
@@ -48,0 +53,0 @@ }; |
export default function _asyncIterator(iterable) { | ||
var method; | ||
if (typeof Symbol === "function") { | ||
if (typeof Symbol !== "undefined") { | ||
if (Symbol.asyncIterator) { | ||
@@ -6,0 +6,0 @@ method = iterable[Symbol.asyncIterator]; |
@@ -6,3 +6,7 @@ export default function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { | ||
if (descriptor.get) { | ||
return descriptor.get.call(receiver); | ||
} | ||
return descriptor.value; | ||
} |
@@ -6,8 +6,13 @@ export default function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { | ||
if (!descriptor.writable) { | ||
throw new TypeError("attempted to set read only private field"); | ||
if (descriptor.set) { | ||
descriptor.set.call(receiver, value); | ||
} else { | ||
if (!descriptor.writable) { | ||
throw new TypeError("attempted to set read only private field"); | ||
} | ||
descriptor.value = value; | ||
} | ||
descriptor.value = value; | ||
return value; | ||
} |
import setPrototypeOf from "./setPrototypeOf"; | ||
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; | ||
} | ||
} | ||
import isNativeReflectConstruct from "./isNativeReflectConstruct"; | ||
export default function _construct(Parent, args, Class) { | ||
@@ -17,0 +4,0 @@ if (isNativeReflectConstruct()) { |
import toArray from "./toArray"; | ||
export default function _decorate(decorators, factory, superClass) { | ||
import toPropertyKey from "./toPropertyKey"; | ||
export default function _decorate(decorators, factory, superClass, mixins) { | ||
var api = _getDecoratorsApi(); | ||
if (mixins) { | ||
for (var i = 0; i < mixins.length; i++) { | ||
api = mixins[i](api); | ||
} | ||
} | ||
var r = factory(function initialize(O) { | ||
_initializeInstanceElements(O, decorated.elements); | ||
api.initializeInstanceElements(O, decorated.elements); | ||
}, superClass); | ||
var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); | ||
api.initializeClassElements(r.F, decorated.elements); | ||
return api.runClassFinishers(r.F, decorated.finishers); | ||
} | ||
var decorated = _decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); | ||
function _getDecoratorsApi() { | ||
_getDecoratorsApi = function () { | ||
return api; | ||
}; | ||
_initializeClassElements(r.F, decorated.elements); | ||
var api = { | ||
elementsDefinitionOrder: [["method"], ["field"]], | ||
initializeInstanceElements: function (O, elements) { | ||
["method", "field"].forEach(function (kind) { | ||
elements.forEach(function (element) { | ||
if (element.kind === kind && element.placement === "own") { | ||
this.defineClassElement(O, element); | ||
} | ||
}, this); | ||
}, this); | ||
}, | ||
initializeClassElements: function (F, elements) { | ||
var proto = F.prototype; | ||
["method", "field"].forEach(function (kind) { | ||
elements.forEach(function (element) { | ||
var placement = element.placement; | ||
return _runClassFinishers(r.F, decorated.finishers); | ||
if (element.kind === kind && (placement === "static" || placement === "prototype")) { | ||
var receiver = placement === "static" ? F : proto; | ||
this.defineClassElement(receiver, element); | ||
} | ||
}, this); | ||
}, this); | ||
}, | ||
defineClassElement: function (receiver, element) { | ||
var descriptor = element.descriptor; | ||
if (element.kind === "field") { | ||
var initializer = element.initializer; | ||
descriptor = { | ||
enumerable: descriptor.enumerable, | ||
writable: descriptor.writable, | ||
configurable: descriptor.configurable, | ||
value: initializer === void 0 ? void 0 : initializer.call(receiver) | ||
}; | ||
} | ||
Object.defineProperty(receiver, element.key, descriptor); | ||
}, | ||
decorateClass: function (elements, decorators) { | ||
var newElements = []; | ||
var finishers = []; | ||
var placements = { | ||
static: [], | ||
prototype: [], | ||
own: [] | ||
}; | ||
elements.forEach(function (element) { | ||
this.addElementPlacement(element, placements); | ||
}, this); | ||
elements.forEach(function (element) { | ||
if (!_hasDecorators(element)) return newElements.push(element); | ||
var elementFinishersExtras = this.decorateElement(element, placements); | ||
newElements.push(elementFinishersExtras.element); | ||
newElements.push.apply(newElements, elementFinishersExtras.extras); | ||
finishers.push.apply(finishers, elementFinishersExtras.finishers); | ||
}, this); | ||
if (!decorators) { | ||
return { | ||
elements: newElements, | ||
finishers: finishers | ||
}; | ||
} | ||
var result = this.decorateConstructor(newElements, decorators); | ||
finishers.push.apply(finishers, result.finishers); | ||
result.finishers = finishers; | ||
return result; | ||
}, | ||
addElementPlacement: function (element, placements, silent) { | ||
var keys = placements[element.placement]; | ||
if (!silent && keys.indexOf(element.key) !== -1) { | ||
throw new TypeError("Duplicated element (" + element.key + ")"); | ||
} | ||
keys.push(element.key); | ||
}, | ||
decorateElement: function (element, placements) { | ||
var extras = []; | ||
var finishers = []; | ||
for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { | ||
var keys = placements[element.placement]; | ||
keys.splice(keys.indexOf(element.key), 1); | ||
var elementObject = this.fromElementDescriptor(element); | ||
var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); | ||
element = elementFinisherExtras.element; | ||
this.addElementPlacement(element, placements); | ||
if (elementFinisherExtras.finisher) { | ||
finishers.push(elementFinisherExtras.finisher); | ||
} | ||
var newExtras = elementFinisherExtras.extras; | ||
if (newExtras) { | ||
for (var j = 0; j < newExtras.length; j++) { | ||
this.addElementPlacement(newExtras[j], placements); | ||
} | ||
extras.push.apply(extras, newExtras); | ||
} | ||
} | ||
return { | ||
element: element, | ||
finishers: finishers, | ||
extras: extras | ||
}; | ||
}, | ||
decorateConstructor: function (elements, decorators) { | ||
var finishers = []; | ||
for (var i = decorators.length - 1; i >= 0; i--) { | ||
var obj = this.fromClassDescriptor(elements); | ||
var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj); | ||
if (elementsAndFinisher.finisher !== undefined) { | ||
finishers.push(elementsAndFinisher.finisher); | ||
} | ||
if (elementsAndFinisher.elements !== undefined) { | ||
elements = elementsAndFinisher.elements; | ||
for (var j = 0; j < elements.length - 1; j++) { | ||
for (var k = j + 1; k < elements.length; k++) { | ||
if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { | ||
throw new TypeError("Duplicated element (" + elements[j].key + ")"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return { | ||
elements: elements, | ||
finishers: finishers | ||
}; | ||
}, | ||
fromElementDescriptor: function (element) { | ||
var obj = { | ||
kind: element.kind, | ||
key: element.key, | ||
placement: element.placement, | ||
descriptor: element.descriptor | ||
}; | ||
var desc = { | ||
value: "Descriptor", | ||
configurable: true | ||
}; | ||
Object.defineProperty(obj, Symbol.toStringTag, desc); | ||
if (element.kind === "field") obj.initializer = element.initializer; | ||
return obj; | ||
}, | ||
toElementDescriptors: function (elementObjects) { | ||
if (elementObjects === undefined) return; | ||
return toArray(elementObjects).map(function (elementObject) { | ||
var element = this.toElementDescriptor(elementObject); | ||
this.disallowProperty(elementObject, "finisher", "An element descriptor"); | ||
this.disallowProperty(elementObject, "extras", "An element descriptor"); | ||
return element; | ||
}, this); | ||
}, | ||
toElementDescriptor: function (elementObject) { | ||
var kind = String(elementObject.kind); | ||
if (kind !== "method" && kind !== "field") { | ||
throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"'); | ||
} | ||
var key = toPropertyKey(elementObject.key); | ||
var placement = String(elementObject.placement); | ||
if (placement !== "static" && placement !== "prototype" && placement !== "own") { | ||
throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"'); | ||
} | ||
var descriptor = elementObject.descriptor; | ||
this.disallowProperty(elementObject, "elements", "An element descriptor"); | ||
var element = { | ||
kind: kind, | ||
key: key, | ||
placement: placement, | ||
descriptor: Object.assign({}, descriptor) | ||
}; | ||
if (kind !== "field") { | ||
this.disallowProperty(elementObject, "initializer", "A method descriptor"); | ||
} else { | ||
this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); | ||
this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); | ||
this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); | ||
element.initializer = elementObject.initializer; | ||
} | ||
return element; | ||
}, | ||
toElementFinisherExtras: function (elementObject) { | ||
var element = this.toElementDescriptor(elementObject); | ||
var finisher = _optionalCallableProperty(elementObject, "finisher"); | ||
var extras = this.toElementDescriptors(elementObject.extras); | ||
return { | ||
element: element, | ||
finisher: finisher, | ||
extras: extras | ||
}; | ||
}, | ||
fromClassDescriptor: function (elements) { | ||
var obj = { | ||
kind: "class", | ||
elements: elements.map(this.fromElementDescriptor, this) | ||
}; | ||
var desc = { | ||
value: "Descriptor", | ||
configurable: true | ||
}; | ||
Object.defineProperty(obj, Symbol.toStringTag, desc); | ||
return obj; | ||
}, | ||
toClassDescriptor: function (obj) { | ||
var kind = String(obj.kind); | ||
if (kind !== "class") { | ||
throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"'); | ||
} | ||
this.disallowProperty(obj, "key", "A class descriptor"); | ||
this.disallowProperty(obj, "placement", "A class descriptor"); | ||
this.disallowProperty(obj, "descriptor", "A class descriptor"); | ||
this.disallowProperty(obj, "initializer", "A class descriptor"); | ||
this.disallowProperty(obj, "extras", "A class descriptor"); | ||
var finisher = _optionalCallableProperty(obj, "finisher"); | ||
var elements = this.toElementDescriptors(obj.elements); | ||
return { | ||
elements: elements, | ||
finisher: finisher | ||
}; | ||
}, | ||
runClassFinishers: function (constructor, finishers) { | ||
for (var i = 0; i < finishers.length; i++) { | ||
var newConstructor = (0, finishers[i])(constructor); | ||
if (newConstructor !== undefined) { | ||
if (typeof newConstructor !== "function") { | ||
throw new TypeError("Finishers must return a constructor."); | ||
} | ||
constructor = newConstructor; | ||
} | ||
} | ||
return constructor; | ||
}, | ||
disallowProperty: function (obj, name, objectType) { | ||
if (obj[name] !== undefined) { | ||
throw new TypeError(objectType + " can't have a ." + name + " property."); | ||
} | ||
} | ||
}; | ||
return api; | ||
} | ||
function _createElementDescriptor(def) { | ||
var key = toPropertyKey(def.key); | ||
var descriptor; | ||
@@ -40,3 +320,3 @@ | ||
writable: true, | ||
enumerable: false | ||
enumerable: true | ||
}; | ||
@@ -47,3 +327,3 @@ } | ||
kind: def.kind === "field" ? "field" : "method", | ||
key: def.key, | ||
key: key, | ||
placement: def.static ? "static" : def.kind === "field" ? "own" : "prototype", | ||
@@ -110,287 +390,2 @@ descriptor: descriptor | ||
function _initializeClassElements(F, elements) { | ||
var proto = F.prototype; | ||
["method", "field"].forEach(function (kind) { | ||
elements.forEach(function (element) { | ||
var placement = element.placement; | ||
if (element.kind === kind && (placement === "static" || placement === "prototype")) { | ||
var receiver = placement === "static" ? F : proto; | ||
_defineClassElement(receiver, element); | ||
} | ||
}); | ||
}); | ||
} | ||
function _initializeInstanceElements(O, elements) { | ||
["method", "field"].forEach(function (kind) { | ||
elements.forEach(function (element) { | ||
if (element.kind === kind && element.placement === "own") { | ||
_defineClassElement(O, element); | ||
} | ||
}); | ||
}); | ||
} | ||
function _defineClassElement(receiver, element) { | ||
var descriptor = element.descriptor; | ||
if (element.kind === "field") { | ||
var initializer = element.initializer; | ||
descriptor = { | ||
enumerable: descriptor.enumerable, | ||
writable: descriptor.writable, | ||
configurable: descriptor.configurable, | ||
value: initializer === void 0 ? void 0 : initializer.call(receiver) | ||
}; | ||
} | ||
Object.defineProperty(receiver, element.key, descriptor); | ||
} | ||
function _decorateClass(elements, decorators) { | ||
var newElements = []; | ||
var finishers = []; | ||
var placements = { | ||
static: [], | ||
prototype: [], | ||
own: [] | ||
}; | ||
elements.forEach(function (element) { | ||
_addElementPlacement(element, placements); | ||
}); | ||
elements.forEach(function (element) { | ||
if (!_hasDecorators(element)) return newElements.push(element); | ||
var elementFinishersExtras = _decorateElement(element, placements); | ||
newElements.push(elementFinishersExtras.element); | ||
newElements.push.apply(newElements, elementFinishersExtras.extras); | ||
finishers.push.apply(finishers, elementFinishersExtras.finishers); | ||
}); | ||
if (!decorators) { | ||
return { | ||
elements: newElements, | ||
finishers: finishers | ||
}; | ||
} | ||
var result = _decorateConstructor(newElements, decorators); | ||
finishers.push.apply(finishers, result.finishers); | ||
result.finishers = finishers; | ||
return result; | ||
} | ||
function _addElementPlacement(element, placements, silent) { | ||
var keys = placements[element.placement]; | ||
if (!silent && keys.indexOf(element.key) !== -1) { | ||
throw new TypeError("Duplicated element (" + element.key + ")"); | ||
} | ||
keys.push(element.key); | ||
} | ||
function _decorateElement(element, placements) { | ||
var extras = []; | ||
var finishers = []; | ||
for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { | ||
var keys = placements[element.placement]; | ||
keys.splice(keys.indexOf(element.key), 1); | ||
var elementObject = _fromElementDescriptor(element); | ||
var elementFinisherExtras = _toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); | ||
element = elementFinisherExtras.element; | ||
_addElementPlacement(element, placements); | ||
if (elementFinisherExtras.finisher) { | ||
finishers.push(elementFinisherExtras.finisher); | ||
} | ||
var newExtras = elementFinisherExtras.extras; | ||
if (newExtras) { | ||
for (var j = 0; j < newExtras.length; j++) { | ||
_addElementPlacement(newExtras[j], placements); | ||
} | ||
extras.push.apply(extras, newExtras); | ||
} | ||
} | ||
return { | ||
element: element, | ||
finishers: finishers, | ||
extras: extras | ||
}; | ||
} | ||
function _decorateConstructor(elements, decorators) { | ||
var finishers = []; | ||
for (var i = decorators.length - 1; i >= 0; i--) { | ||
var obj = _fromClassDescriptor(elements); | ||
var elementsAndFinisher = _toClassDescriptor((0, decorators[i])(obj) || obj); | ||
if (elementsAndFinisher.finisher !== undefined) { | ||
finishers.push(elementsAndFinisher.finisher); | ||
} | ||
if (elementsAndFinisher.elements !== undefined) { | ||
elements = elementsAndFinisher.elements; | ||
for (var j = 0; j < elements.length - 1; j++) { | ||
for (var k = j + 1; k < elements.length; k++) { | ||
if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { | ||
throw new TypeError("Duplicated element (" + elements[j].key + ")"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return { | ||
elements: elements, | ||
finishers: finishers | ||
}; | ||
} | ||
function _fromElementDescriptor(element) { | ||
var obj = { | ||
kind: element.kind, | ||
key: element.key, | ||
placement: element.placement, | ||
descriptor: element.descriptor | ||
}; | ||
var desc = { | ||
value: "Descriptor", | ||
configurable: true | ||
}; | ||
Object.defineProperty(obj, Symbol.toStringTag, desc); | ||
if (element.kind === "field") obj.initializer = element.initializer; | ||
return obj; | ||
} | ||
function _toElementDescriptors(elementObjects) { | ||
if (elementObjects === undefined) return; | ||
return toArray(elementObjects).map(function (elementObject) { | ||
var element = _toElementDescriptor(elementObject); | ||
_disallowProperty(elementObject, "finisher", "An element descriptor"); | ||
_disallowProperty(elementObject, "extras", "An element descriptor"); | ||
return element; | ||
}); | ||
} | ||
function _toElementDescriptor(elementObject) { | ||
var kind = String(elementObject.kind); | ||
if (kind !== "method" && kind !== "field") { | ||
throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"'); | ||
} | ||
var key = elementObject.key; | ||
if (typeof key !== "string" && typeof key !== "symbol") key = String(key); | ||
var placement = String(elementObject.placement); | ||
if (placement !== "static" && placement !== "prototype" && placement !== "own") { | ||
throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"'); | ||
} | ||
var descriptor = elementObject.descriptor; | ||
_disallowProperty(elementObject, "elements", "An element descriptor"); | ||
var element = { | ||
kind: kind, | ||
key: key, | ||
placement: placement, | ||
descriptor: Object.assign({}, descriptor) | ||
}; | ||
if (kind !== "field") { | ||
_disallowProperty(elementObject, "initializer", "A method descriptor"); | ||
} else { | ||
_disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); | ||
_disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); | ||
_disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); | ||
element.initializer = elementObject.initializer; | ||
} | ||
return element; | ||
} | ||
function _toElementFinisherExtras(elementObject) { | ||
var element = _toElementDescriptor(elementObject); | ||
var finisher = _optionalCallableProperty(elementObject, "finisher"); | ||
var extras = _toElementDescriptors(elementObject.extras); | ||
return { | ||
element: element, | ||
finisher: finisher, | ||
extras: extras | ||
}; | ||
} | ||
function _fromClassDescriptor(elements) { | ||
var obj = { | ||
kind: "class", | ||
elements: elements.map(_fromElementDescriptor) | ||
}; | ||
var desc = { | ||
value: "Descriptor", | ||
configurable: true | ||
}; | ||
Object.defineProperty(obj, Symbol.toStringTag, desc); | ||
return obj; | ||
} | ||
function _toClassDescriptor(obj) { | ||
var kind = String(obj.kind); | ||
if (kind !== "class") { | ||
throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"'); | ||
} | ||
_disallowProperty(obj, "key", "A class descriptor"); | ||
_disallowProperty(obj, "placement", "A class descriptor"); | ||
_disallowProperty(obj, "descriptor", "A class descriptor"); | ||
_disallowProperty(obj, "initializer", "A class descriptor"); | ||
_disallowProperty(obj, "extras", "A class descriptor"); | ||
var finisher = _optionalCallableProperty(obj, "finisher"); | ||
var elements = _toElementDescriptors(obj.elements); | ||
return { | ||
elements: elements, | ||
finisher: finisher | ||
}; | ||
} | ||
function _disallowProperty(obj, name, objectType) { | ||
if (obj[name] !== undefined) { | ||
throw new TypeError(objectType + " can't have a ." + name + " property."); | ||
} | ||
} | ||
function _optionalCallableProperty(obj, name) { | ||
@@ -404,18 +399,2 @@ var value = obj[name]; | ||
return value; | ||
} | ||
function _runClassFinishers(constructor, finishers) { | ||
for (var i = 0; i < finishers.length; i++) { | ||
var newConstructor = (0, finishers[i])(constructor); | ||
if (newConstructor !== undefined) { | ||
if (typeof newConstructor !== "function") { | ||
throw new TypeError("Finishers must return a constructor."); | ||
} | ||
constructor = newConstructor; | ||
} | ||
} | ||
return constructor; | ||
} |
@@ -1,2 +0,1 @@ | ||
import getPrototypeOf from "./getPrototypeOf"; | ||
import superPropBase from "./superPropBase"; | ||
@@ -3,0 +2,0 @@ export default function _get(target, property, receiver) { |
@@ -0,5 +1,6 @@ | ||
import setPrototypeOf from "./setPrototypeOf"; | ||
export default function _inheritsLoose(subClass, superClass) { | ||
subClass.prototype = Object.create(superClass.prototype); | ||
subClass.prototype.constructor = subClass; | ||
subClass.__proto__ = superClass; | ||
setPrototypeOf(subClass, superClass); | ||
} |
export default function _initializerWarningHelper(descriptor, context) { | ||
throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and set to use loose mode. ' + 'To use proposal-class-properties in spec mode with decorators, wait for ' + 'the next major version of decorators in stage 2.'); | ||
throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); | ||
} |
export default function _instanceof(left, right) { | ||
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { | ||
return right[Symbol.hasInstance](left); | ||
return !!right[Symbol.hasInstance](left); | ||
} else { | ||
@@ -5,0 +5,0 @@ return left instanceof right; |
export default function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); | ||
} |
export default function _iterableToArrayLimit(arr, i) { | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; | ||
var _arr = []; | ||
@@ -3,0 +4,0 @@ var _n = true; |
export default function _iterableToArrayLimitLoose(arr, i) { | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; | ||
var _arr = []; | ||
@@ -3,0 +4,0 @@ |
var REACT_ELEMENT_TYPE; | ||
export default function _createRawReactElement(type, props, key, children) { | ||
if (!REACT_ELEMENT_TYPE) { | ||
REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7; | ||
REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7; | ||
} | ||
@@ -16,12 +16,2 @@ | ||
if (props && defaultProps) { | ||
for (var propName in defaultProps) { | ||
if (props[propName] === void 0) { | ||
props[propName] = defaultProps[propName]; | ||
} | ||
} | ||
} else if (!props) { | ||
props = defaultProps || {}; | ||
} | ||
if (childrenLength === 1) { | ||
@@ -39,2 +29,12 @@ props.children = children; | ||
if (props && defaultProps) { | ||
for (var propName in defaultProps) { | ||
if (props[propName] === void 0) { | ||
props[propName] = defaultProps[propName]; | ||
} | ||
} | ||
} else if (!props) { | ||
props = defaultProps || {}; | ||
} | ||
return { | ||
@@ -41,0 +41,0 @@ $$typeof: REACT_ELEMENT_TYPE, |
export default function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} |
export default function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} |
import defineProperty from "./defineProperty"; | ||
export default function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var source = arguments[i] != null ? Object(arguments[i]) : {}; | ||
var ownKeys = Object.keys(source); | ||
@@ -6,0 +6,0 @@ |
export default function _readOnlyError(name) { | ||
throw new Error("\"" + name + "\" is read-only"); | ||
throw new TypeError("\"" + name + "\" is read-only"); | ||
} |
@@ -1,2 +0,1 @@ | ||
import getPrototypeOf from "./getPrototypeOf"; | ||
import superPropBase from "./superPropBase"; | ||
@@ -3,0 +2,0 @@ import defineProperty from "./defineProperty"; |
import arrayWithHoles from "./arrayWithHoles"; | ||
import iterableToArrayLimit from "./iterableToArrayLimit"; | ||
import unsupportedIterableToArray from "./unsupportedIterableToArray"; | ||
import nonIterableRest from "./nonIterableRest"; | ||
export default function _slicedToArray(arr, i) { | ||
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest(); | ||
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); | ||
} |
import arrayWithHoles from "./arrayWithHoles"; | ||
import iterableToArrayLimitLoose from "./iterableToArrayLimitLoose"; | ||
import unsupportedIterableToArray from "./unsupportedIterableToArray"; | ||
import nonIterableRest from "./nonIterableRest"; | ||
export default function _slicedToArrayLoose(arr, i) { | ||
return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || nonIterableRest(); | ||
return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); | ||
} |
import undef from "./temporalUndefined"; | ||
import err from "./tdz"; | ||
export default function _temporalRef(val, name) { | ||
if (val === undef) { | ||
throw new ReferenceError(name + " is not defined - temporal dead zone"); | ||
} else { | ||
return val; | ||
} | ||
return val === undef ? err(name) : val; | ||
} |
@@ -1,1 +0,1 @@ | ||
export default {}; | ||
export default function _temporalUndefined() {} |
import arrayWithHoles from "./arrayWithHoles"; | ||
import iterableToArray from "./iterableToArray"; | ||
import unsupportedIterableToArray from "./unsupportedIterableToArray"; | ||
import nonIterableRest from "./nonIterableRest"; | ||
export default function _toArray(arr) { | ||
return arrayWithHoles(arr) || iterableToArray(arr) || nonIterableRest(); | ||
return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); | ||
} |
import arrayWithoutHoles from "./arrayWithoutHoles"; | ||
import iterableToArray from "./iterableToArray"; | ||
import unsupportedIterableToArray from "./unsupportedIterableToArray"; | ||
import nonIterableSpread from "./nonIterableSpread"; | ||
export default function _toConsumableArray(arr) { | ||
return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); | ||
return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); | ||
} |
@@ -1,7 +0,5 @@ | ||
export default function _toPropertyKey(key) { | ||
if (typeof key === "symbol") { | ||
return key; | ||
} else { | ||
return String(key); | ||
} | ||
import toPrimitive from "./toPrimitive"; | ||
export default function _toPropertyKey(arg) { | ||
var key = toPrimitive(arg, "string"); | ||
return typeof key === "symbol" ? key : String(key); | ||
} |
export default function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
@@ -3,0 +5,0 @@ _typeof = function (obj) { |
{ | ||
"name": "babel-compat", | ||
"version": "0.22.1", | ||
"version": "0.22.2-alpha.0", | ||
"main": "build/index.js", | ||
@@ -12,9 +12,9 @@ "description": "Babel helpers customized for COMPAT", | ||
"dependencies": { | ||
"@babel/core": "7.1.0", | ||
"@babel/generator": "7.0.0", | ||
"@babel/helpers": "7.1.0", | ||
"@babel/types": "7.0.0", | ||
"@babel/core": "7.13.8", | ||
"@babel/generator": "7.13.9", | ||
"@babel/helpers": "7.13.0", | ||
"@babel/types": "7.13.0", | ||
"regenerator-runtime": "^0.12.0" | ||
}, | ||
"gitHead": "f581ee5d0b11b8bb0dfc4f33b6d32250551dbc3b" | ||
"gitHead": "262077fff9c4c0634eec4d07c10f47674f24dbfe" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
67145
81
1886
+ Added@babel/compat-data@7.26.2(transitive)
+ Added@babel/core@7.13.8(transitive)
+ Added@babel/generator@7.13.9(transitive)
+ Added@babel/helper-compilation-targets@7.25.9(transitive)
+ Added@babel/helper-module-imports@7.25.9(transitive)
+ Added@babel/helper-module-transforms@7.26.0(transitive)
+ Added@babel/helper-validator-option@7.25.9(transitive)
+ Added@babel/helpers@7.13.0(transitive)
+ Added@babel/types@7.13.0(transitive)
+ Addedbrowserslist@4.24.2(transitive)
+ Addedcaniuse-lite@1.0.30001684(transitive)
+ Addedelectron-to-chromium@1.5.65(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedgensync@1.0.0-beta.2(transitive)
+ Addedjson5@2.2.3(transitive)
+ Addedlru-cache@5.1.1(transitive)
+ Addednode-releases@2.0.18(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedupdate-browserslist-db@1.1.1(transitive)
+ Addedyallist@3.1.1(transitive)
- Removed@babel/core@7.1.0(transitive)
- Removed@babel/generator@7.0.0(transitive)
- Removed@babel/helpers@7.1.0(transitive)
- Removed@babel/types@7.0.0(transitive)
- Removeddebug@3.2.7(transitive)
- Removedesutils@2.0.3(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedjson5@0.5.1(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedresolve@1.22.8(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedtrim-right@1.0.1(transitive)
Updated@babel/core@7.13.8
Updated@babel/generator@7.13.9
Updated@babel/helpers@7.13.0
Updated@babel/types@7.13.0