source: imaps-frontend/node_modules/babel-plugin-polyfill-corejs3/lib/utils.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 2.7 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports.BABEL_RUNTIME = void 0;
5exports.callMethod = callMethod;
6exports.coreJSModule = coreJSModule;
7exports.coreJSPureHelper = coreJSPureHelper;
8exports.isCoreJSSource = isCoreJSSource;
9var _babel = _interopRequireWildcard(require("@babel/core"));
10var _entries = _interopRequireDefault(require("../core-js-compat/entries.js"));
11function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12function _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); }
13function _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; }
14const {
15 types: t
16} = _babel.default || _babel;
17const BABEL_RUNTIME = "@babel/runtime-corejs3";
18exports.BABEL_RUNTIME = BABEL_RUNTIME;
19function 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}
34function 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}
40function coreJSModule(name) {
41 return `core-js/modules/${name}.js`;
42}
43function coreJSPureHelper(name, useBabelRuntime, ext) {
44 return useBabelRuntime ? `${BABEL_RUNTIME}/core-js/${name}${ext}` : `core-js-pure/features/${name}.js`;
45}
Note: See TracBrowser for help on using the repository browser.