Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-runtime

Package Overview
Dependencies
Maintainers
5
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-runtime - npm Package Compare versions

Comparing version 7.5.5 to 7.6.0

36

lib/index.js

@@ -147,3 +147,10 @@ "use strict";

function isNamespaced(path) {
const binding = path.scope.getBinding(path.node.name);
if (!binding) return false;
return binding.path.isImportNamespaceSpecifier();
}
function maybeNeedsPolyfill(path, methods, name) {
if (isNamespaced(path.get("object"))) return false;
if (!methods[name].types) return true;

@@ -156,2 +163,12 @@ const typeAnnotation = path.get("object").getTypeAnnotation();

function resolvePropertyName(path, computed) {
const {
node
} = path;
if (!computed) return node.name;
if (path.isStringLiteral()) return node.value;
const result = path.evaluate();
return result.value;
}
if (has(options, "useBuiltIns")) {

@@ -267,6 +284,5 @@ if (options.useBuiltIns) {

const {
object,
property
object
} = callee;
const propertyName = property.name;
const propertyName = resolvePropertyName(path.get("callee.property"), callee.computed);

@@ -316,14 +332,8 @@ if (injectCoreJS3 && !hasStaticMapping(object.name, propertyName)) {

const {
object,
property
object
} = node;
if (!_core().types.isReferenced(object, node)) return;
if (node.computed) {
if (injectCoreJS2) return;
if (path.get("property").matchesPattern("Symbol.iterator")) {
path.replaceWith(_core().types.callExpression(this.addDefaultImport(`${moduleName}/core-js/get-iterator-method`, "getIteratorMethod"), [object]));
}
if (!injectCoreJS2 && node.computed && path.get("property").matchesPattern("Symbol.iterator")) {
path.replaceWith(_core().types.callExpression(this.addDefaultImport(`${moduleName}/core-js/get-iterator-method`, "getIteratorMethod"), [object]));
return;

@@ -333,3 +343,3 @@ }

const objectName = object.name;
const propertyName = property.name;
const propertyName = resolvePropertyName(path.get("property"), node.computed);

@@ -336,0 +346,0 @@ if (path.scope.getBindingIdentifier(objectName) || !hasStaticMapping(objectName, propertyName)) {

{
"name": "@babel/plugin-transform-runtime",
"version": "7.5.5",
"version": "7.6.0",
"description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals",

@@ -24,12 +24,12 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime",

"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/core": "^7.6.0",
"@babel/helper-plugin-test-runner": "^7.0.0",
"@babel/helpers": "^7.5.5",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/runtime": "^7.5.5",
"@babel/template": "^7.4.4",
"@babel/helpers": "^7.6.0",
"@babel/plugin-transform-runtime": "^7.6.0",
"@babel/preset-env": "^7.6.0",
"@babel/runtime": "^7.6.0",
"@babel/template": "^7.6.0",
"@babel/types": "7.0.0-beta.53"
},
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43"
"gitHead": "cbd5a26e57758e3f748174ff84aa570e8780e85d"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc