diff options
Diffstat (limited to 'node_modules/@babel/helpers')
| -rw-r--r-- | node_modules/@babel/helpers/README.md | 56 | ||||
| -rw-r--r-- | node_modules/@babel/helpers/lib/helpers.js | 954 | ||||
| -rw-r--r-- | node_modules/@babel/helpers/lib/index.js | 293 | ||||
| -rw-r--r-- | node_modules/@babel/helpers/package.json | 18 |
4 files changed, 0 insertions, 1321 deletions
diff --git a/node_modules/@babel/helpers/README.md b/node_modules/@babel/helpers/README.md deleted file mode 100644 index ce5288bf..00000000 --- a/node_modules/@babel/helpers/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# @babel/helpers - -> Collection of helper functions used by Babel transforms. - -## Install - -```sh -npm install --save-dev @babel/helpers -``` - -## Usage - -Direct: - -```js -import * as helpers from '@babel/helpers'; -import * as t from '@babel/types'; - -const typeofHelper = helpers.get('typeof'); - -t.isExpressionStatement(typeofHelper); -// true -``` - -Inside a plugin: - -```js -export default { - visitor: { - UnaryExpression(path) { - // The .addHelper function adds, if needed, the helper to the file - // and returns an expression which references the helper - const typeofHelper = this.addHelper("typeof"); - t.isExpression(typeofHelper); // true - } -}; -``` - -## Defining Helpers - -> **NOTE**: This package is only meant to be used by the packages inluded in this repository. There is currently no way for third-party plugins to define an helper. - -Helpers are defined in the `src/helpers.js` file, and they must be valid modules which follow these guidelines: - - They must have a default export, which is their entry-point. - - They can import other helpers, exclusively by using default imports. - - They can't have named exports. - -```js -helpers.customHelper = defineHelper(` - import dep from "dependency"; - const foo = 2; - export default function getFooTimesDepPlusX(x) { - return foo * dep() + x; - } -`); -``` diff --git a/node_modules/@babel/helpers/lib/helpers.js b/node_modules/@babel/helpers/lib/helpers.js deleted file mode 100644 index a8977ab8..00000000 --- a/node_modules/@babel/helpers/lib/helpers.js +++ /dev/null @@ -1,954 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -function _template() { - const data = _interopRequireDefault(require("@babel/template")); - - _template = function _template() { - return data; - }; - - return data; -} - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const helpers = {}; -var _default = helpers; -exports.default = _default; - -helpers.typeof = () => _template().default.program.ast` - export default function _typeof(obj) { - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { return typeof obj; }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype - ? "symbol" - : typeof obj; - }; - } - - return _typeof(obj); - } -`; - -helpers.jsx = () => _template().default.program.ast` - 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; - } - - var defaultProps = type && type.defaultProps; - var childrenLength = arguments.length - 3; - - if (!props && childrenLength !== 0) { - // If we're going to assign props.children, we create a new object now - // to avoid mutating defaultProps. - props = { - children: void 0, - }; - } - 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) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = new Array(childrenLength); - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 3]; - } - props.children = childArray; - } - - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: key === undefined ? null : '' + key, - ref: null, - props: props, - _owner: null, - }; - } -`; - -helpers.asyncIterator = () => _template().default.program.ast` - export default function _asyncIterator(iterable) { - var method - if (typeof Symbol === "function") { - if (Symbol.asyncIterator) { - method = iterable[Symbol.asyncIterator] - if (method != null) return method.call(iterable); - } - if (Symbol.iterator) { - method = iterable[Symbol.iterator] - if (method != null) return method.call(iterable); - } - } - throw new TypeError("Object is not async iterable"); - } -`; - -helpers.AwaitValue = () => _template().default.program.ast` - export default function _AwaitValue(value) { - this.wrapped = value; - } -`; - -helpers.AsyncGenerator = () => _template().default.program.ast` - import AwaitValue from "AwaitValue"; - - export default function AsyncGenerator(gen) { - var front, back; - - function send(key, arg) { - return new Promise(function (resolve, reject) { - var request = { - key: key, - arg: arg, - resolve: resolve, - reject: reject, - next: null, - }; - - if (back) { - back = back.next = request; - } else { - front = back = request; - resume(key, arg); - } - }); - } - - function resume(key, arg) { - try { - var result = gen[key](arg) - var value = result.value; - var wrappedAwait = value instanceof AwaitValue; - - Promise.resolve(wrappedAwait ? value.wrapped : value).then( - function (arg) { - if (wrappedAwait) { - resume("next", arg); - return - } - - settle(result.done ? "return" : "normal", arg); - }, - function (err) { resume("throw", err); }); - } catch (err) { - settle("throw", err); - } - } - - function settle(type, value) { - switch (type) { - case "return": - front.resolve({ value: value, done: true }); - break; - case "throw": - front.reject(value); - break; - default: - front.resolve({ value: value, done: false }); - break; - } - - front = front.next; - if (front) { - resume(front.key, front.arg); - } else { - back = null; - } - } - - this._invoke = send; - - // Hide "return" method if generator return is not supported - if (typeof gen.return !== "function") { - this.return = undefined; - } - } - - if (typeof Symbol === "function" && Symbol.asyncIterator) { - AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; - } - - AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }; - AsyncGenerator.prototype.throw = function (arg) { return this._invoke("throw", arg); }; - AsyncGenerator.prototype.return = function (arg) { return this._invoke("return", arg); }; -`; - -helpers.wrapAsyncGenerator = () => _template().default.program.ast` - import AsyncGenerator from "AsyncGenerator"; - - export default function _wrapAsyncGenerator(fn) { - return function () { - return new AsyncGenerator(fn.apply(this, arguments)); - }; - } -`; - -helpers.awaitAsyncGenerator = () => _template().default.program.ast` - import AwaitValue from "AwaitValue"; - - export default function _awaitAsyncGenerator(value) { - return new AwaitValue(value); - } -`; - -helpers.asyncGeneratorDelegate = () => _template().default.program.ast` - export default function _asyncGeneratorDelegate(inner, awaitWrap) { - var iter = {}, waiting = false; - - function pump(key, value) { - waiting = true; - value = new Promise(function (resolve) { resolve(inner[key](value)); }); - return { done: false, value: awaitWrap(value) }; - }; - - if (typeof Symbol === "function" && Symbol.iterator) { - iter[Symbol.iterator] = function () { return this; }; - } - - iter.next = function (value) { - if (waiting) { - waiting = false; - return value; - } - return pump("next", value); - }; - - if (typeof inner.throw === "function") { - iter.throw = function (value) { - if (waiting) { - waiting = false; - throw value; - } - return pump("throw", value); - }; - } - - if (typeof inner.return === "function") { - iter.return = function (value) { - return pump("return", value); - }; - } - - return iter; - } -`; - -helpers.asyncToGenerator = () => _template().default.program.ast` - export default function _asyncToGenerator(fn) { - return function () { - var self = this, args = arguments; - return new Promise(function (resolve, reject) { - var gen = fn.apply(self, args); - function step(key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - - if (info.done) { - resolve(value); - } else { - Promise.resolve(value).then(_next, _throw); - } - } - function _next(value) { step("next", value); } - function _throw(err) { step("throw", err); } - - _next(); - }); - }; - } -`; - -helpers.classCallCheck = () => _template().default.program.ast` - export default function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } -`; - -helpers.createClass = () => _template().default.program.ast` - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i ++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - export default function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } -`; - -helpers.defineEnumerableProperties = () => _template().default.program.ast` - export default function _defineEnumerableProperties(obj, descs) { - for (var key in descs) { - var desc = descs[key]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, key, desc); - } - - // Symbols are not enumerated over by for-in loops. If native - // Symbols are available, fetch all of the descs object's own - // symbol properties and define them on our target object too. - if (Object.getOwnPropertySymbols) { - var objectSymbols = Object.getOwnPropertySymbols(descs); - for (var i = 0; i < objectSymbols.length; i++) { - var sym = objectSymbols[i]; - var desc = descs[sym]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, sym, desc); - } - } - return obj; - } -`; - -helpers.defaults = () => _template().default.program.ast` - export default function _defaults(obj, defaults) { - var keys = Object.getOwnPropertyNames(defaults); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = Object.getOwnPropertyDescriptor(defaults, key); - if (value && value.configurable && obj[key] === undefined) { - Object.defineProperty(obj, key, value); - } - } - return obj; - } -`; - -helpers.defineProperty = () => _template().default.program.ast` - export default function _defineProperty(obj, key, value) { - // Shortcircuit the slow defineProperty path when possible. - // We are trying to avoid issues where setters defined on the - // prototype cause side effects under the fast path of simple - // assignment. By checking for existence of the property with - // the in operator, we can optimize most of this overhead away. - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; - } -`; - -helpers.extends = () => _template().default.program.ast` - export default function _extends() { - _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - return target; - }; - - return _extends.apply(this, arguments); - } -`; - -helpers.objectSpread = () => _template().default.program.ast` - 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 ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - ownKeys.forEach(function(key) { - defineProperty(target, key, source[key]); - }); - } - return target; - } -`; - -helpers.inherits = () => _template().default.program.ast` - import setPrototypeOf from "setPrototypeOf"; - - export default function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - setPrototypeOf(subClass.prototype, superClass && superClass.prototype); - if (superClass) setPrototypeOf(subClass, superClass); - } -`; - -helpers.inheritsLoose = () => _template().default.program.ast` - export default function _inheritsLoose(subClass, superClass) { - subClass.prototype.__proto__ = superClass && superClass.prototype; - subClass.__proto__ = superClass; - } -`; - -helpers.getPrototypeOf = () => _template().default.program.ast` - export default function _getPrototypeOf(o) { - _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { - return o.__proto__; - }; - return _getPrototypeOf(o); - } -`; - -helpers.setPrototypeOf = () => _template().default.program.ast` - export default function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - return _setPrototypeOf(o, p); - } -`; - -helpers.construct = () => _template().default.program.ast` - import setPrototypeOf from "setPrototypeOf"; - - export default function _construct(Parent, args, Class) { - if (typeof Reflect !== "undefined" && Reflect.construct) { - _construct = Reflect.construct; - } else { - _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Parent.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) setPrototypeOf(instance, Class.prototype); - return instance; - }; - } - // Avoid issues with Class being present but undefined when it wasn't - // present in the original call. - return _construct.apply(null, arguments); - } -`; - -helpers.wrapNativeSuper = () => _template().default.program.ast` - import _gPO from "getPrototypeOf"; - import _sPO from "setPrototypeOf"; - import construct from "construct"; - - export default function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - - _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - _cache.set(Class, Wrapper); - } - function Wrapper() {} - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true, - } - }); - return _sPO( - Wrapper, - _sPO( - function Super() { - return construct(Class, arguments, _gPO(this).constructor); - }, - Class - ) - ); - } - - return _wrapNativeSuper(Class) - } -`; - -helpers.instanceof = () => _template().default.program.ast` - export default function _instanceof(left, right) { - if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { - return right[Symbol.hasInstance](left); - } else { - return left instanceof right; - } - } -`; - -helpers.interopRequireDefault = () => _template().default.program.ast` - export default function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { default: obj }; - } -`; - -helpers.interopRequireWildcard = () => _template().default.program.ast` - export default function _interopRequireWildcard(obj) { - if (obj && obj.__esModule) { - return obj; - } else { - var newObj = {}; - if (obj != null) { - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = Object.defineProperty && Object.getOwnPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : {}; - if (desc.get || desc.set) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - } - newObj.default = obj; - return newObj; - } - } -`; - -helpers.newArrowCheck = () => _template().default.program.ast` - export default function _newArrowCheck(innerThis, boundThis) { - if (innerThis !== boundThis) { - throw new TypeError("Cannot instantiate an arrow function"); - } - } -`; - -helpers.objectDestructuringEmpty = () => _template().default.program.ast` - export default function _objectDestructuringEmpty(obj) { - if (obj == null) throw new TypeError("Cannot destructure undefined"); - } -`; - -helpers.objectWithoutProperties = () => _template().default.program.ast` - export default function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } - - return target; - } -`; - -helpers.assertThisInitialized = () => _template().default.program.ast` - export default function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return self; - } -`; - -helpers.possibleConstructorReturn = () => _template().default.program.ast` - import assertThisInitialized from "assertThisInitialized"; - - export default function _possibleConstructorReturn(self, call) { - if (call && (typeof call === "object" || typeof call === "function")) { - return call; - } - return assertThisInitialized(self); - } -`; - -helpers.superPropBase = () => _template().default.program.ast` - import getPrototypeOf from "getPrototypeOf"; - - export default function _superPropBase(object, property) { - // Yes, this throws if object is null to being with, that's on purpose. - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = getPrototypeOf(object); - if (object === null) break; - } - return object; - } -`; - -helpers.get = () => _template().default.program.ast` - import getPrototypeOf from "getPrototypeOf"; - import superPropBase from "superPropBase"; - - export default function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get; - } else { - _get = function _get(target, property, receiver) { - var base = superPropBase(target, property); - - if (!base) return; - - var desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.get) { - return desc.get.call(receiver); - } - - return desc.value; - }; - } - return _get(target, property, receiver || target); - } -`; - -helpers.set = () => _template().default.program.ast` - import getPrototypeOf from "getPrototypeOf"; - import superPropBase from "superPropBase"; - import defineProperty from "defineProperty"; - - function set(target, property, value, receiver) { - if (typeof Reflect !== "undefined" && Reflect.set) { - set = Reflect.set; - } else { - set = function set(target, property, value, receiver) { - var base = superPropBase(target, property); - var desc; - - if (base) { - desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.set) { - desc.set.call(receiver, value); - return true; - } else if (!desc.writable) { - // Both getter and non-writable fall into this. - return false; - } - } - - // Without a super that defines the property, spec boils down to - // "define on receiver" for some reason. - desc = Object.getOwnPropertyDescriptor(receiver, property); - if (desc) { - if (!desc.writable) { - // Setter, getter, and non-writable fall into this. - return false; - } - - desc.value = value; - Object.defineProperty(receiver, property, desc); - } else { - // Avoid setters that may be defined on Sub's prototype, but not on - // the instance. - defineProperty(receiver, property, value); - } - - return true; - }; - } - - return set(target, property, value, receiver); - } - - export default function _set(target, property, value, receiver, isStrict) { - var s = set(target, property, value, receiver || target); - if (!s && isStrict) { - throw new Error('failed to set property'); - } - - return value; - } -`; - -helpers.taggedTemplateLiteral = () => _template().default.program.ast` - export default function _taggedTemplateLiteral(strings, raw) { - if (!raw) { raw = strings.slice(0); } - return Object.freeze(Object.defineProperties(strings, { - raw: { value: Object.freeze(raw) } - })); - } -`; - -helpers.taggedTemplateLiteralLoose = () => _template().default.program.ast` - export default function _taggedTemplateLiteralLoose(strings, raw) { - if (!raw) { raw = strings.slice(0); } - strings.raw = raw; - return strings; - } -`; - -helpers.temporalRef = () => _template().default.program.ast` - import undef from "temporalUndefined"; - - export default function _temporalRef(val, name) { - if (val === undef) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); - } else { - return val; - } - } -`; - -helpers.readOnlyError = () => _template().default.program.ast` - export default function _readOnlyError(name) { - throw new Error("\\"" + name + "\\" is read-only"); - } -`; - -helpers.classNameTDZError = () => _template().default.program.ast` - export default function _classNameTDZError(name) { - throw new Error("Class \\"" + name + "\\" cannot be referenced in computed property keys."); - } -`; - -helpers.temporalUndefined = () => _template().default.program.ast` - export default {}; -`; - -helpers.slicedToArray = () => _template().default.program.ast` - import arrayWithHoles from "arrayWithHoles"; - import iterableToArrayLimit from "iterableToArrayLimit"; - import nonIterableRest from "nonIterableRest"; - - export default function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest(); - } -`; - -helpers.slicedToArrayLoose = () => _template().default.program.ast` - import arrayWithHoles from "arrayWithHoles"; - import iterableToArrayLimitLoose from "iterableToArrayLimitLoose"; - import nonIterableRest from "nonIterableRest"; - - export default function _slicedToArrayLoose(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || nonIterableRest(); - } -`; - -helpers.toArray = () => _template().default.program.ast` - import arrayWithHoles from "arrayWithHoles"; - import iterableToArray from "iterableToArray"; - import nonIterableRest from "nonIterableRest"; - - export default function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || nonIterableRest(); - } -`; - -helpers.toConsumableArray = () => _template().default.program.ast` - import arrayWithoutHoles from "arrayWithoutHoles"; - import iterableToArray from "iterableToArray"; - import nonIterableSpread from "nonIterableSpread"; - - export default function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); - } -`; - -helpers.arrayWithoutHoles = () => _template().default.program.ast` - 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; - } - } -`; - -helpers.arrayWithHoles = () => _template().default.program.ast` - export default function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; - } -`; - -helpers.iterableToArray = () => _template().default.program.ast` - export default function _iterableToArray(iter) { - if ( - Symbol.iterator in Object(iter) || - Object.prototype.toString.call(iter) === "[object Arguments]" - ) return Array.from(iter); - } -`; - -helpers.iterableToArrayLimit = () => _template().default.program.ast` - export default function _iterableToArrayLimit(arr, i) { - // this is an expanded form of \`for...of\` that properly supports abrupt completions of - // iterators etc. variable names have been minimised to reduce the size of this massive - // helper. sometimes spec compliancy is annoying :( - // - // _n = _iteratorNormalCompletion - // _d = _didIteratorError - // _e = _iteratorError - // _i = _iterator - // _s = _step - - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - return _arr; - } -`; - -helpers.iterableToArrayLimitLoose = () => _template().default.program.ast` - export default function _iterableToArrayLimitLoose(arr, i) { - var _arr = []; - for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { - _arr.push(_step.value); - if (i && _arr.length === i) break; - } - return _arr; - } -`; - -helpers.nonIterableSpread = () => _template().default.program.ast` - export default function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); - } -`; - -helpers.nonIterableRest = () => _template().default.program.ast` - export default function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - } -`; - -helpers.skipFirstGeneratorNext = () => _template().default.program.ast` - export default function _skipFirstGeneratorNext(fn) { - return function () { - var it = fn.apply(this, arguments); - it.next(); - return it; - } - } -`; - -helpers.toPropertyKey = () => _template().default.program.ast` - export default function _toPropertyKey(key) { - if (typeof key === "symbol") { - return key; - } else { - return String(key); - } - } -`; - -helpers.initializerWarningHelper = () => _template().default.program.ast` - 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.' - ); - } -`; - -helpers.initializerDefineProperty = () => _template().default.program.ast` - export default function _initializerDefineProperty(target, property, descriptor, context){ - if (!descriptor) return; - - Object.defineProperty(target, property, { - enumerable: descriptor.enumerable, - configurable: descriptor.configurable, - writable: descriptor.writable, - value: descriptor.initializer ? descriptor.initializer.call(context) : void 0, - }); - } -`; - -helpers.applyDecoratedDescriptor = () => _template().default.program.ast` - export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context){ - var desc = {}; - Object['ke' + 'ys'](descriptor).forEach(function(key){ - desc[key] = descriptor[key]; - }); - desc.enumerable = !!desc.enumerable; - desc.configurable = !!desc.configurable; - if ('value' in desc || desc.initializer){ - desc.writable = true; - } - - desc = decorators.slice().reverse().reduce(function(desc, decorator){ - return decorator(target, property, desc) || desc; - }, desc); - - if (context && desc.initializer !== void 0){ - desc.value = desc.initializer ? desc.initializer.call(context) : void 0; - desc.initializer = undefined; - } - - if (desc.initializer === void 0){ - // This is a hack to avoid this being processed by 'transform-runtime'. - // See issue #9. - Object['define' + 'Property'](target, property, desc); - desc = null; - } - - return desc; - } -`;
\ No newline at end of file diff --git a/node_modules/@babel/helpers/lib/index.js b/node_modules/@babel/helpers/lib/index.js deleted file mode 100644 index f60b67c8..00000000 --- a/node_modules/@babel/helpers/lib/index.js +++ /dev/null @@ -1,293 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.get = get; -exports.getDependencies = getDependencies; -exports.default = exports.list = void 0; - -function _traverse() { - const data = _interopRequireDefault(require("@babel/traverse")); - - _traverse = function _traverse() { - return data; - }; - - return data; -} - -function t() { - const data = _interopRequireWildcard(require("@babel/types")); - - t = function t() { - return data; - }; - - return data; -} - -var _helpers = _interopRequireDefault(require("./helpers")); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function makePath(path) { - const parts = []; - - for (; path.parentPath; path = path.parentPath) { - parts.push(path.key); - if (path.inList) parts.push(path.listKey); - } - - return parts.reverse().join("."); -} - -function getHelperMetadata(file) { - const globals = new Set(); - const localBindingNames = new Set(); - const dependencies = new Map(); - let exportName; - let exportPath; - const exportBindingAssignments = []; - const importPaths = []; - const importBindingsReferences = []; - (0, _traverse().default)(file, { - ImportDeclaration(child) { - const name = child.node.source.value; - - if (!_helpers.default[name]) { - throw child.buildCodeFrameError(`Unknown helper ${name}`); - } - - if (child.get("specifiers").length !== 1 || !child.get("specifiers.0").isImportDefaultSpecifier()) { - throw child.buildCodeFrameError("Helpers can only import a default value"); - } - - const bindingIdentifier = child.node.specifiers[0].local; - dependencies.set(bindingIdentifier, name); - importPaths.push(makePath(child)); - }, - - ExportDefaultDeclaration(child) { - const decl = child.get("declaration"); - - if (decl.isFunctionDeclaration()) { - if (!decl.node.id) { - throw decl.buildCodeFrameError("Helpers should give names to their exported func declaration"); - } - - exportName = decl.node.id.name; - } - - exportPath = makePath(child); - }, - - ExportAllDeclaration(child) { - throw child.buildCodeFrameError("Helpers can only export default"); - }, - - ExportNamedDeclaration(child) { - throw child.buildCodeFrameError("Helpers can only export default"); - }, - - Statement(child) { - if (child.isModuleDeclaration()) return; - child.skip(); - } - - }); - (0, _traverse().default)(file, { - Program(path) { - const bindings = path.scope.getAllBindings(); - Object.keys(bindings).forEach(name => { - if (name === exportName) return; - if (dependencies.has(bindings[name].identifier)) return; - localBindingNames.add(name); - }); - }, - - ReferencedIdentifier(child) { - const name = child.node.name; - const binding = child.scope.getBinding(name, true); - - if (!binding) { - globals.add(name); - } else if (dependencies.has(binding.identifier)) { - importBindingsReferences.push(makePath(child)); - } - }, - - AssignmentExpression(child) { - const left = child.get("left"); - if (!(exportName in left.getBindingIdentifiers())) return; - - if (!left.isIdentifier()) { - throw left.buildCodeFrameError("Only simple assignments to exports are allowed in helpers"); - } - - const binding = child.scope.getBinding(exportName); - - if (binding && binding.scope.path.isProgram()) { - exportBindingAssignments.push(makePath(child)); - } - } - - }); - if (!exportPath) throw new Error("Helpers must default-export something."); - exportBindingAssignments.reverse(); - return { - globals: Array.from(globals), - localBindingNames: Array.from(localBindingNames), - dependencies, - exportBindingAssignments, - exportPath, - exportName, - importBindingsReferences, - importPaths - }; -} - -function permuteHelperAST(file, metadata, id, localBindings, getDependency) { - if (localBindings && !id) { - throw new Error("Unexpected local bindings for module-based helpers."); - } - - if (!id) return; - const localBindingNames = metadata.localBindingNames, - dependencies = metadata.dependencies, - exportBindingAssignments = metadata.exportBindingAssignments, - exportPath = metadata.exportPath, - exportName = metadata.exportName, - importBindingsReferences = metadata.importBindingsReferences, - importPaths = metadata.importPaths; - const dependenciesRefs = {}; - dependencies.forEach((name, id) => { - dependenciesRefs[id.name] = typeof getDependency === "function" && getDependency(name) || id; - }); - const toRename = {}; - const bindings = new Set(localBindings || []); - localBindingNames.forEach(name => { - let newName = name; - - while (bindings.has(newName)) newName = "_" + newName; - - if (newName !== name) toRename[name] = newName; - }); - - if (id.type === "Identifier" && exportName !== id.name) { - toRename[exportName] = id.name; - } - - (0, _traverse().default)(file, { - Program(path) { - const exp = path.get(exportPath); - const imps = importPaths.map(p => path.get(p)); - const impsBindingRefs = importBindingsReferences.map(p => path.get(p)); - const decl = exp.get("declaration"); - - if (id.type === "Identifier") { - if (decl.isFunctionDeclaration()) { - exp.replaceWith(decl); - } else { - exp.replaceWith(t().variableDeclaration("var", [t().variableDeclarator(id, decl.node)])); - } - } else if (id.type === "MemberExpression") { - if (decl.isFunctionDeclaration()) { - exportBindingAssignments.forEach(assignPath => { - const assign = path.get(assignPath); - assign.replaceWith(t().assignmentExpression("=", id, assign.node)); - }); - exp.replaceWith(decl); - path.pushContainer("body", t().expressionStatement(t().assignmentExpression("=", id, t().identifier(exportName)))); - } else { - exp.replaceWith(t().expressionStatement(t().assignmentExpression("=", id, decl.node))); - } - } else { - throw new Error("Unexpected helper format."); - } - - Object.keys(toRename).forEach(name => { - path.scope.rename(name, toRename[name]); - }); - - for (var _iterator = imps, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - const path = _ref; - path.remove(); - } - - for (var _iterator2 = impsBindingRefs, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { - var _ref2; - - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref2 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref2 = _i2.value; - } - - const path = _ref2; - const node = t().cloneNode(dependenciesRefs[path.node.name]); - path.replaceWith(node); - } - - path.stop(); - } - - }); -} - -const helperData = {}; - -function loadHelper(name) { - if (!helperData[name]) { - if (!_helpers.default[name]) throw new ReferenceError(`Unknown helper ${name}`); - - const fn = () => { - return t().file(_helpers.default[name]()); - }; - - const metadata = getHelperMetadata(fn()); - helperData[name] = { - build(getDependency, id, localBindings) { - const file = fn(); - permuteHelperAST(file, metadata, id, localBindings, getDependency); - return { - nodes: file.program.body, - globals: metadata.globals - }; - }, - - dependencies: metadata.dependencies - }; - } - - return helperData[name]; -} - -function get(name, getDependency, id, localBindings) { - return loadHelper(name).build(getDependency, id, localBindings); -} - -function getDependencies(name) { - return Array.from(loadHelper(name).dependencies.values()); -} - -const list = Object.keys(_helpers.default).map(name => name.replace(/^_/, "")).filter(name => name !== "__esModule"); -exports.list = list; -var _default = get; -exports.default = _default;
\ No newline at end of file diff --git a/node_modules/@babel/helpers/package.json b/node_modules/@babel/helpers/package.json deleted file mode 100644 index ccdb8d32..00000000 --- a/node_modules/@babel/helpers/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "@babel/helpers", - "version": "7.0.0-beta.47", - "description": "Collection of helper functions used by Babel transforms.", - "author": "Sebastian McKenzie <sebmck@gmail.com>", - "homepage": "https://babeljs.io/", - "license": "MIT", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-helpers", - "main": "lib/index.js", - "dependencies": { - "@babel/template": "7.0.0-beta.47", - "@babel/traverse": "7.0.0-beta.47", - "@babel/types": "7.0.0-beta.47" - }, - "devDependencies": { - "@babel/helper-plugin-test-runner": "7.0.0-beta.47" - } -} |
