Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-object-super

Package Overview
Dependencies
Maintainers
4
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-object-super - npm Package Compare versions

Comparing version 7.22.5 to 7.23.3

35

lib/index.js

@@ -18,7 +18,23 @@ "use strict";

}
var _default = (0, _helperPluginUtils.declare)(api => {
var _default = exports.default = (0, _helperPluginUtils.declare)(api => {
api.assertVersion(7);
const newLets = new Set();
return {
name: "transform-object-super",
visitor: {
Loop: {
exit(path) {
newLets.forEach(v => {
if (v.scopePath === path) {
path.scope.push({
id: v.id,
kind: "let"
});
path.scope.crawl();
path.requeue();
newLets.delete(v);
}
});
}
},
ObjectExpression(path, state) {

@@ -32,5 +48,15 @@ let objectRef;

if (objectRef) {
path.scope.push({
id: _core.types.cloneNode(objectRef)
});
const scopePath = path.findParent(p => p.isFunction() || p.isProgram() || p.isLoop());
const useLet = scopePath.isLoop();
if (useLet) {
newLets.add({
scopePath,
id: _core.types.cloneNode(objectRef)
});
} else {
path.scope.push({
id: _core.types.cloneNode(objectRef),
kind: "var"
});
}
path.replaceWith(_core.types.assignmentExpression("=", _core.types.cloneNode(objectRef), path.node));

@@ -42,4 +68,3 @@ }

});
exports.default = _default;
//# sourceMappingURL=index.js.map

6

package.json
{
"name": "@babel/plugin-transform-object-super",
"version": "7.22.5",
"version": "7.23.3",
"description": "Compile ES2015 object super to ES5",

@@ -21,3 +21,3 @@ "repository": {

"@babel/helper-plugin-utils": "^7.22.5",
"@babel/helper-replace-supers": "^7.22.5"
"@babel/helper-replace-supers": "^7.22.20"
},

@@ -28,3 +28,3 @@ "peerDependencies": {

"devDependencies": {
"@babel/core": "^7.22.5",
"@babel/core": "^7.23.3",
"@babel/helper-plugin-test-runner": "^7.22.5"

@@ -31,0 +31,0 @@ },

@@ -5,3 +5,3 @@ # @babel/plugin-transform-object-super

See our website [@babel/plugin-transform-object-super](https://babeljs.io/docs/en/babel-plugin-transform-object-super) for more information.
See our website [@babel/plugin-transform-object-super](https://babeljs.io/docs/babel-plugin-transform-object-super) for more information.

@@ -8,0 +8,0 @@ ## Install

Sorry, the diff of this file is not supported yet

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