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.4.0 to 7.4.3

24

lib/helpers.js

@@ -7,2 +7,3 @@ "use strict";

exports.hasMinVersion = hasMinVersion;
exports.typeAnnotationToString = typeAnnotationToString;

@@ -19,2 +20,12 @@ function _semver() {

function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -26,2 +37,15 @@

return !_semver().default.intersects(`<${minVersion}`, runtimeVersion) && !_semver().default.intersects(`>=8.0.0`, runtimeVersion);
}
function typeAnnotationToString(node) {
switch (node.type) {
case "GenericTypeAnnotation":
if (_core().types.isIdentifier(node.id, {
name: "Array"
})) return "array";
break;
case "StringTypeAnnotation":
return "string";
}
}

14

lib/index.js

@@ -62,2 +62,4 @@ "use strict";

var _helpers = require("./helpers");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -146,2 +148,10 @@

function maybeNeedsPolyfill(path, methods, name) {
if (!methods[name].types) return true;
const typeAnnotation = path.get("object").getTypeAnnotation();
const type = (0, _helpers.typeAnnotationToString)(typeAnnotation);
if (!type) return true;
return methods[name].types.some(name => name === type);
}
if (has(options, "useBuiltIns")) {

@@ -263,3 +273,3 @@ if (options.useBuiltIns) {

if (injectCoreJS3 && !hasStaticMapping(object.name, propertyName)) {
if (hasMapping(InstanceProperties, propertyName)) {
if (hasMapping(InstanceProperties, propertyName) && maybeNeedsPolyfill(path.get("callee"), InstanceProperties, propertyName)) {
let context1, context2;

@@ -325,3 +335,3 @@

if (path.scope.getBindingIdentifier(objectName) || !hasStaticMapping(objectName, propertyName)) {
if (injectCoreJS3 && hasMapping(InstanceProperties, propertyName)) {
if (injectCoreJS3 && hasMapping(InstanceProperties, propertyName) && maybeNeedsPolyfill(path, InstanceProperties, propertyName)) {
path.replaceWith(_core().types.callExpression(this.addDefaultImport(`${moduleName}/${corejsRoot}/instance/${InstanceProperties[propertyName].path}`, `${propertyName}InstanceProperty`), [object]));

@@ -328,0 +338,0 @@ }

3

lib/runtime-corejs3-definitions.js

@@ -559,3 +559,4 @@ "use strict";

stable: true,
path: "concat"
path: "concat",
types: ["array"]
},

@@ -562,0 +563,0 @@ copyWithin: {

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

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

"devDependencies": {
"@babel/core": "^7.4.0",
"@babel/core": "^7.4.3",
"@babel/helper-plugin-test-runner": "^7.0.0",
"@babel/helpers": "^7.4.0",
"@babel/plugin-transform-member-expression-literals": "^7.2.0",
"@babel/plugin-transform-property-literals": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.4.0",
"@babel/preset-env": "^7.4.0",
"@babel/runtime": "^7.4.0",
"@babel/helpers": "^7.4.3",
"@babel/plugin-transform-runtime": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@babel/runtime": "^7.4.3",
"@babel/template": "^7.4.0",
"@babel/types": "7.0.0-beta.53"
},
"gitHead": "f1328fb913b5a93d54dfc6e3728b1f56c8f4a804"
"gitHead": "508fde4009f31883f318b9e6546459ac1b086a91"
}
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