1 | "use strict";
|
---|
2 |
|
---|
3 | exports.__esModule = true;
|
---|
4 | exports.BABEL_RUNTIME = void 0;
|
---|
5 | exports.callMethod = callMethod;
|
---|
6 | exports.coreJSModule = coreJSModule;
|
---|
7 | exports.coreJSPureHelper = coreJSPureHelper;
|
---|
8 | exports.isCoreJSSource = isCoreJSSource;
|
---|
9 | var _babel = _interopRequireWildcard(require("@babel/core"));
|
---|
10 | var _entries = _interopRequireDefault(require("../core-js-compat/entries.js"));
|
---|
11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
12 | function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
---|
13 | function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
---|
14 | const {
|
---|
15 | types: t
|
---|
16 | } = _babel.default || _babel;
|
---|
17 | const BABEL_RUNTIME = "@babel/runtime-corejs3";
|
---|
18 | exports.BABEL_RUNTIME = BABEL_RUNTIME;
|
---|
19 | function callMethod(path, id) {
|
---|
20 | const {
|
---|
21 | object
|
---|
22 | } = path.node;
|
---|
23 | let context1, context2;
|
---|
24 | if (t.isIdentifier(object)) {
|
---|
25 | context1 = object;
|
---|
26 | context2 = t.cloneNode(object);
|
---|
27 | } else {
|
---|
28 | context1 = path.scope.generateDeclaredUidIdentifier("context");
|
---|
29 | context2 = t.assignmentExpression("=", t.cloneNode(context1), object);
|
---|
30 | }
|
---|
31 | path.replaceWith(t.memberExpression(t.callExpression(id, [context2]), t.identifier("call")));
|
---|
32 | path.parentPath.unshiftContainer("arguments", context1);
|
---|
33 | }
|
---|
34 | function isCoreJSSource(source) {
|
---|
35 | if (typeof source === "string") {
|
---|
36 | source = source.replace(/\\/g, "/").replace(/(\/(index)?)?(\.js)?$/i, "").toLowerCase();
|
---|
37 | }
|
---|
38 | return Object.prototype.hasOwnProperty.call(_entries.default, source) && _entries.default[source];
|
---|
39 | }
|
---|
40 | function coreJSModule(name) {
|
---|
41 | return `core-js/modules/${name}.js`;
|
---|
42 | }
|
---|
43 | function coreJSPureHelper(name, useBabelRuntime, ext) {
|
---|
44 | return useBabelRuntime ? `${BABEL_RUNTIME}/core-js/${name}${ext}` : `core-js-pure/features/${name}.js`;
|
---|
45 | } |
---|