Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@putout/plugin-convert-commonjs-to-esm

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/plugin-convert-commonjs-to-esm - npm Package Compare versions

Comparing version 1.7.0 to 2.0.0

47

lib/exports/index.js

@@ -35,13 +35,5 @@ 'use strict';

const isObject = (path) => path.isIdentifier({
name:'module',
});
const isExports = (path) => path.isIdentifier({
name: 'exports',
});
module.exports.traverse = ({push}) => {
return {
AssignmentExpression(path) {
'module.exports = __'(path) {
const {parentPath} = path;

@@ -52,31 +44,24 @@

const leftPath = path.get('left');
const rightPath = path.get('right');
if (!leftPath.isMemberExpression()) {
return;
}
push({
path,
rightPath,
});
},
'module.exports.__ = __'(path) {
const {parentPath} = path;
const objectPath = leftPath.get('object');
const propertyPath = leftPath.get('property');
if (isObject(objectPath) && isExports(propertyPath))
return push({
path,
rightPath,
});
if (!objectPath.isMemberExpression())
if (parentPath.isSequenceExpression())
return;
const nestedObjectPath = objectPath.get('object');
const nestedPropertyPath = objectPath.get('property');
const rightPath = path.get('right');
const propertyPath = path.get('left.property');
const {name} = propertyPath.node;
if (isObject(nestedObjectPath) && isExports(nestedPropertyPath))
return push({
name,
path,
rightPath,
});
return push({
name,
path,
rightPath,
});
},

@@ -83,0 +68,0 @@ };

{
"name": "@putout/plugin-convert-commonjs-to-esm",
"version": "1.7.0",
"version": "2.0.0",
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

@@ -35,14 +35,13 @@ "description": "putout plugin adds ability to convert commonjs to ecma script module",

"coveralls": "^3.0.0",
"eslint": "^6.0.0-rc.0",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-putout": "^1.5.0",
"eslint": "^6.2.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-putout": "^2.0.0",
"lerna": "^3.8.5",
"madrun": "^2.0.0",
"madrun": "^3.0.0",
"nodemon": "^1.14.12",
"nyc": "^14.0.0",
"putout": "^4.31.0",
"supertape": "^1.0.3"
},
"peerDependencies": {
"putout": ">=4.31"
"putout": ">=5.14"
},

@@ -49,0 +48,0 @@ "license": "MIT",

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