|
2 | 2 |
|
3 | 3 | import template from "@babel/template";
|
4 | 4 |
|
5 |
| -const helpers = Object.create(null); |
| 5 | +import * as generated from "./helpers-generated"; |
| 6 | + |
| 7 | +const helpers = { __proto__: null, ...generated }; |
6 | 8 | export default helpers;
|
7 | 9 |
|
8 | 10 | const helper = (minVersion: string) => tpl => ({
|
9 | 11 | minVersion,
|
10 | 12 | ast: () => template.program.ast(tpl),
|
11 | 13 | });
|
12 | 14 |
|
13 |
| -helpers.typeof = helper("7.0.0-beta.0")` |
14 |
| - export default function _typeof(obj) { |
15 |
| - "@babel/helpers - typeof"; |
16 |
| -
|
17 |
| - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { |
18 |
| - _typeof = function (obj) { return typeof obj; }; |
19 |
| - } else { |
20 |
| - _typeof = function (obj) { |
21 |
| - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype |
22 |
| - ? "symbol" |
23 |
| - : typeof obj; |
24 |
| - }; |
25 |
| - } |
26 |
| -
|
27 |
| - return _typeof(obj); |
28 |
| - } |
29 |
| -`; |
30 |
| - |
31 |
| -// "for" is a reserved keyword in ES3 so escaping it here for backward compatibility |
32 |
| -helpers.jsx = helper("7.0.0-beta.0")` |
33 |
| - var REACT_ELEMENT_TYPE; |
34 |
| -
|
35 |
| - export default function _createRawReactElement(type, props, key, children) { |
36 |
| - if (!REACT_ELEMENT_TYPE) { |
37 |
| - REACT_ELEMENT_TYPE = ( |
38 |
| - typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") |
39 |
| - ) || 0xeac7; |
40 |
| - } |
41 |
| -
|
42 |
| - var defaultProps = type && type.defaultProps; |
43 |
| - var childrenLength = arguments.length - 3; |
44 |
| -
|
45 |
| - if (!props && childrenLength !== 0) { |
46 |
| - // If we're going to assign props.children, we create a new object now |
47 |
| - // to avoid mutating defaultProps. |
48 |
| - props = { |
49 |
| - children: void 0, |
50 |
| - }; |
51 |
| - } |
52 |
| -
|
53 |
| - if (childrenLength === 1) { |
54 |
| - props.children = children; |
55 |
| - } else if (childrenLength > 1) { |
56 |
| - var childArray = new Array(childrenLength); |
57 |
| - for (var i = 0; i < childrenLength; i++) { |
58 |
| - childArray[i] = arguments[i + 3]; |
59 |
| - } |
60 |
| - props.children = childArray; |
61 |
| - } |
62 |
| -
|
63 |
| - if (props && defaultProps) { |
64 |
| - for (var propName in defaultProps) { |
65 |
| - if (props[propName] === void 0) { |
66 |
| - props[propName] = defaultProps[propName]; |
67 |
| - } |
68 |
| - } |
69 |
| - } else if (!props) { |
70 |
| - props = defaultProps || {}; |
71 |
| - } |
72 |
| -
|
73 |
| - return { |
74 |
| - $$typeof: REACT_ELEMENT_TYPE, |
75 |
| - type: type, |
76 |
| - key: key === undefined ? null : '' + key, |
77 |
| - ref: null, |
78 |
| - props: props, |
79 |
| - _owner: null, |
80 |
| - }; |
81 |
| - } |
82 |
| -`; |
83 |
| - |
84 | 15 | helpers.asyncIterator = helper("7.0.0-beta.0")`
|
85 | 16 | export default function _asyncIterator(iterable) {
|
86 | 17 | var method;
|
@@ -406,48 +337,6 @@ helpers.objectSpread = helper("7.0.0-beta.0")`
|
406 | 337 | }
|
407 | 338 | `;
|
408 | 339 |
|
409 |
| -helpers.objectSpread2 = helper("7.5.0")` |
410 |
| - import defineProperty from "defineProperty"; |
411 |
| -
|
412 |
| - // This function is different to "Reflect.ownKeys". The enumerableOnly |
413 |
| - // filters on symbol properties only. Returned string properties are always |
414 |
| - // enumerable. It is good to use in objectSpread. |
415 |
| -
|
416 |
| - function ownKeys(object, enumerableOnly) { |
417 |
| - var keys = Object.keys(object); |
418 |
| - if (Object.getOwnPropertySymbols) { |
419 |
| - var symbols = Object.getOwnPropertySymbols(object); |
420 |
| - if (enumerableOnly) symbols = symbols.filter(function (sym) { |
421 |
| - return Object.getOwnPropertyDescriptor(object, sym).enumerable; |
422 |
| - }); |
423 |
| - keys.push.apply(keys, symbols); |
424 |
| - } |
425 |
| - return keys; |
426 |
| - } |
427 |
| -
|
428 |
| - export default function _objectSpread2(target) { |
429 |
| - for (var i = 1; i < arguments.length; i++) { |
430 |
| - var source = (arguments[i] != null) ? arguments[i] : {}; |
431 |
| - if (i % 2) { |
432 |
| - ownKeys(Object(source), true).forEach(function (key) { |
433 |
| - defineProperty(target, key, source[key]); |
434 |
| - }); |
435 |
| - } else if (Object.getOwnPropertyDescriptors) { |
436 |
| - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); |
437 |
| - } else { |
438 |
| - ownKeys(Object(source)).forEach(function (key) { |
439 |
| - Object.defineProperty( |
440 |
| - target, |
441 |
| - key, |
442 |
| - Object.getOwnPropertyDescriptor(source, key) |
443 |
| - ); |
444 |
| - }); |
445 |
| - } |
446 |
| - } |
447 |
| - return target; |
448 |
| - } |
449 |
| -`; |
450 |
| - |
451 | 340 | helpers.inherits = helper("7.0.0-beta.0")`
|
452 | 341 | import setPrototypeOf from "setPrototypeOf";
|
453 | 342 |
|
|
0 commit comments