aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@babel/plugin-transform-runtime/lib
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@babel/plugin-transform-runtime/lib')
-rw-r--r--node_modules/@babel/plugin-transform-runtime/lib/definitions.js168
-rw-r--r--node_modules/@babel/plugin-transform-runtime/lib/index.js184
2 files changed, 352 insertions, 0 deletions
diff --git a/node_modules/@babel/plugin-transform-runtime/lib/definitions.js b/node_modules/@babel/plugin-transform-runtime/lib/definitions.js
new file mode 100644
index 00000000..a6a4346e
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-runtime/lib/definitions.js
@@ -0,0 +1,168 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+var _default = {
+ builtins: {
+ Symbol: "symbol",
+ Promise: "promise",
+ Map: "map",
+ WeakMap: "weak-map",
+ Set: "set",
+ WeakSet: "weak-set",
+ Observable: "observable",
+ setImmediate: "set-immediate",
+ clearImmediate: "clear-immediate",
+ asap: "asap"
+ },
+ methods: {
+ Array: {
+ copyWithin: "array/copy-within",
+ entries: "array/entries",
+ every: "array/every",
+ fill: "array/fill",
+ filter: "array/filter",
+ findIndex: "array/find-index",
+ find: "array/find",
+ forEach: "array/for-each",
+ from: "array/from",
+ includes: "array/includes",
+ indexOf: "array/index-of",
+ join: "array/join",
+ keys: "array/keys",
+ lastIndexOf: "array/last-index-of",
+ map: "array/map",
+ of: "array/of",
+ reduceRight: "array/reduce-right",
+ reduce: "array/reduce",
+ some: "array/some",
+ sort: "array/sort",
+ splice: "array/splice",
+ values: "array/values"
+ },
+ JSON: {
+ stringify: "json/stringify"
+ },
+ Object: {
+ assign: "object/assign",
+ create: "object/create",
+ defineProperties: "object/define-properties",
+ defineProperty: "object/define-property",
+ entries: "object/entries",
+ freeze: "object/freeze",
+ getOwnPropertyDescriptor: "object/get-own-property-descriptor",
+ getOwnPropertyDescriptors: "object/get-own-property-descriptors",
+ getOwnPropertyNames: "object/get-own-property-names",
+ getOwnPropertySymbols: "object/get-own-property-symbols",
+ getPrototypeOf: "object/get-prototype-of",
+ isExtensible: "object/is-extensible",
+ isFrozen: "object/is-frozen",
+ isSealed: "object/is-sealed",
+ is: "object/is",
+ keys: "object/keys",
+ preventExtensions: "object/prevent-extensions",
+ seal: "object/seal",
+ setPrototypeOf: "object/set-prototype-of",
+ values: "object/values"
+ },
+ Math: {
+ acosh: "math/acosh",
+ asinh: "math/asinh",
+ atanh: "math/atanh",
+ cbrt: "math/cbrt",
+ clz32: "math/clz32",
+ cosh: "math/cosh",
+ expm1: "math/expm1",
+ fround: "math/fround",
+ hypot: "math/hypot",
+ imul: "math/imul",
+ log10: "math/log10",
+ log1p: "math/log1p",
+ log2: "math/log2",
+ sign: "math/sign",
+ sinh: "math/sinh",
+ tanh: "math/tanh",
+ trunc: "math/trunc",
+ iaddh: "math/iaddh",
+ isubh: "math/isubh",
+ imulh: "math/imulh",
+ umulh: "math/umulh"
+ },
+ Symbol: {
+ for: "symbol/for",
+ hasInstance: "symbol/has-instance",
+ isConcatSpreadable: "symbol/is-concat-spreadable",
+ iterator: "symbol/iterator",
+ keyFor: "symbol/key-for",
+ match: "symbol/match",
+ replace: "symbol/replace",
+ search: "symbol/search",
+ species: "symbol/species",
+ split: "symbol/split",
+ toPrimitive: "symbol/to-primitive",
+ toStringTag: "symbol/to-string-tag",
+ unscopables: "symbol/unscopables"
+ },
+ String: {
+ at: "string/at",
+ codePointAt: "string/code-point-at",
+ endsWith: "string/ends-with",
+ fromCodePoint: "string/from-code-point",
+ includes: "string/includes",
+ matchAll: "string/match-all",
+ padStart: "string/pad-start",
+ padEnd: "string/pad-end",
+ raw: "string/raw",
+ repeat: "string/repeat",
+ startsWith: "string/starts-with",
+ trim: "string/trim",
+ trimLeft: "string/trim-left",
+ trimRight: "string/trim-right",
+ trimStart: "string/trim-start",
+ trimEnd: "string/trim-end"
+ },
+ Number: {
+ EPSILON: "number/epsilon",
+ isFinite: "number/is-finite",
+ isInteger: "number/is-integer",
+ isNaN: "number/is-nan",
+ isSafeInteger: "number/is-safe-integer",
+ MAX_SAFE_INTEGER: "number/max-safe-integer",
+ MIN_SAFE_INTEGER: "number/min-safe-integer",
+ parseFloat: "number/parse-float",
+ parseInt: "number/parse-int"
+ },
+ Reflect: {
+ apply: "reflect/apply",
+ construct: "reflect/construct",
+ defineProperty: "reflect/define-property",
+ deleteProperty: "reflect/delete-property",
+ getOwnPropertyDescriptor: "reflect/get-own-property-descriptor",
+ getPrototypeOf: "reflect/get-prototype-of",
+ get: "reflect/get",
+ has: "reflect/has",
+ isExtensible: "reflect/is-extensible",
+ ownKeys: "reflect/own-keys",
+ preventExtensions: "reflect/prevent-extensions",
+ setPrototypeOf: "reflect/set-prototype-of",
+ set: "reflect/set",
+ defineMetadata: "reflect/define-metadata",
+ deleteMetadata: "reflect/delete-metadata",
+ getMetadata: "reflect/get-metadata",
+ getMetadataKeys: "reflect/get-metadata-keys",
+ getOwnMetadata: "reflect/get-own-metadata",
+ getOwnMetadataKeys: "reflect/get-own-metadata-keys",
+ hasMetadata: "reflect/has-metadata",
+ hasOwnMetadata: "reflect/has-own-metadata",
+ metadata: "reflect/metadata"
+ },
+ System: {
+ global: "system/global"
+ },
+ Date: {},
+ Function: {}
+ }
+};
+exports.default = _default; \ No newline at end of file
diff --git a/node_modules/@babel/plugin-transform-runtime/lib/index.js b/node_modules/@babel/plugin-transform-runtime/lib/index.js
new file mode 100644
index 00000000..716e2b0f
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-runtime/lib/index.js
@@ -0,0 +1,184 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "definitions", {
+ enumerable: true,
+ get: function get() {
+ return _definitions.default;
+ }
+});
+exports.default = void 0;
+
+function _helperPluginUtils() {
+ const data = require("@babel/helper-plugin-utils");
+
+ _helperPluginUtils = function _helperPluginUtils() {
+ return data;
+ };
+
+ return data;
+}
+
+function _helperModuleImports() {
+ const data = require("@babel/helper-module-imports");
+
+ _helperModuleImports = function _helperModuleImports() {
+ return data;
+ };
+
+ return data;
+}
+
+function _core() {
+ const data = require("@babel/core");
+
+ _core = function _core() {
+ return data;
+ };
+
+ return data;
+}
+
+var _definitions = _interopRequireDefault(require("./definitions"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var _default = (0, _helperPluginUtils().declare)((api, options) => {
+ api.assertVersion(7);
+ const helpers = options.helpers,
+ _options$moduleName = options.moduleName,
+ moduleName = _options$moduleName === void 0 ? "@babel/runtime" : _options$moduleName,
+ polyfill = options.polyfill,
+ regenerator = options.regenerator,
+ useBuiltIns = options.useBuiltIns,
+ useESModules = options.useESModules;
+ const regeneratorEnabled = regenerator !== false;
+ const notPolyfillOrDoesUseBuiltIns = polyfill === false || useBuiltIns;
+ const isPolyfillAndUseBuiltIns = polyfill && useBuiltIns;
+ const baseHelpersDir = useBuiltIns ? "helpers/builtin" : "helpers";
+ const helpersDir = useESModules ? `${baseHelpersDir}/es6` : baseHelpersDir;
+
+ function has(obj, key) {
+ return Object.prototype.hasOwnProperty.call(obj, key);
+ }
+
+ const HEADER_HELPERS = ["interopRequireWildcard", "interopRequireDefault"];
+ return {
+ pre(file) {
+ if (helpers !== false) {
+ file.set("helperGenerator", name => {
+ const isInteropHelper = HEADER_HELPERS.indexOf(name) !== -1;
+ const blockHoist = isInteropHelper && !(0, _helperModuleImports().isModule)(file.path) ? 4 : undefined;
+ return this.addDefaultImport(`${moduleName}/${helpersDir}/${name}`, name, blockHoist);
+ });
+ }
+
+ if (isPolyfillAndUseBuiltIns) {
+ throw new Error("The polyfill option conflicts with useBuiltIns; use one or the other");
+ }
+
+ this.moduleName = moduleName;
+ const cache = new Map();
+
+ this.addDefaultImport = (source, nameHint, blockHoist) => {
+ const cacheKey = (0, _helperModuleImports().isModule)(file.path);
+ const key = `${source}:${nameHint}:${cacheKey || ""}`;
+ let cached = cache.get(key);
+
+ if (cached) {
+ cached = _core().types.cloneNode(cached);
+ } else {
+ cached = (0, _helperModuleImports().addDefault)(file.path, source, {
+ importedInterop: "uncompiled",
+ nameHint,
+ blockHoist
+ });
+ cache.set(key, cached);
+ }
+
+ return cached;
+ };
+ },
+
+ visitor: {
+ ReferencedIdentifier(path) {
+ const node = path.node,
+ parent = path.parent,
+ scope = path.scope;
+
+ if (node.name === "regeneratorRuntime" && regeneratorEnabled) {
+ path.replaceWith(this.addDefaultImport(`${this.moduleName}/regenerator`, "regeneratorRuntime"));
+ return;
+ }
+
+ if (notPolyfillOrDoesUseBuiltIns) return;
+ if (_core().types.isMemberExpression(parent)) return;
+ if (!has(_definitions.default.builtins, node.name)) return;
+ if (scope.getBindingIdentifier(node.name)) return;
+ path.replaceWith(this.addDefaultImport(`${moduleName}/core-js/${_definitions.default.builtins[node.name]}`, node.name));
+ },
+
+ CallExpression(path) {
+ if (notPolyfillOrDoesUseBuiltIns) return;
+ if (path.node.arguments.length) return;
+ const callee = path.node.callee;
+ if (!_core().types.isMemberExpression(callee)) return;
+ if (!callee.computed) return;
+
+ if (!path.get("callee.property").matchesPattern("Symbol.iterator")) {
+ return;
+ }
+
+ path.replaceWith(_core().types.callExpression(this.addDefaultImport(`${moduleName}/core-js/get-iterator`, "getIterator"), [callee.object]));
+ },
+
+ BinaryExpression(path) {
+ if (notPolyfillOrDoesUseBuiltIns) return;
+ if (path.node.operator !== "in") return;
+ if (!path.get("left").matchesPattern("Symbol.iterator")) return;
+ path.replaceWith(_core().types.callExpression(this.addDefaultImport(`${moduleName}/core-js/is-iterable`, "isIterable"), [path.node.right]));
+ },
+
+ MemberExpression: {
+ enter(path) {
+ if (notPolyfillOrDoesUseBuiltIns) return;
+ if (!path.isReferenced()) return;
+ const node = path.node;
+ const obj = node.object;
+ const prop = node.property;
+ if (!_core().types.isReferenced(obj, node)) return;
+ if (node.computed) return;
+ if (!has(_definitions.default.methods, obj.name)) return;
+ const methods = _definitions.default.methods[obj.name];
+ if (!has(methods, prop.name)) return;
+ if (path.scope.getBindingIdentifier(obj.name)) return;
+
+ if (obj.name === "Object" && prop.name === "defineProperty" && path.parentPath.isCallExpression()) {
+ const call = path.parentPath.node;
+
+ if (call.arguments.length === 3 && _core().types.isLiteral(call.arguments[1])) {
+ return;
+ }
+ }
+
+ path.replaceWith(this.addDefaultImport(`${moduleName}/core-js/${methods[prop.name]}`, `${obj.name}$${prop.name}`));
+ },
+
+ exit(path) {
+ if (notPolyfillOrDoesUseBuiltIns) return;
+ if (!path.isReferenced()) return;
+ const node = path.node;
+ const obj = node.object;
+ if (!has(_definitions.default.builtins, obj.name)) return;
+ if (path.scope.getBindingIdentifier(obj.name)) return;
+ path.replaceWith(_core().types.memberExpression(this.addDefaultImport(`${moduleName}/core-js/${_definitions.default.builtins[obj.name]}`, obj.name), node.property, node.computed));
+ }
+
+ }
+ }
+ };
+});
+
+exports.default = _default; \ No newline at end of file