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

rollup-plugin-commonjs

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-commonjs - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

4

CHANGELOG.md
# rollup-plugin-commonjs changelog
## 2.2.0
* Rewrite top-level `this` expressions to mean the same as `global` ([#31](https://github.com/rollup/rollup-plugin-commonjs/issues/31))
## 2.1.0

@@ -4,0 +8,0 @@

@@ -145,5 +145,8 @@ 'use strict';

var scopeDepth = 0;
estreeWalker.walk(ast, {
enter: function enter(node, parent) {
if (node.scope) scope = node.scope;
if (/^Function/.test(node.type)) scopeDepth += 1;

@@ -185,2 +188,8 @@ if (sourceMap) {

if (node.type === 'ThisExpression' && scopeDepth === 0) {
uses.global = true;
magicString.overwrite(node.start, node.end, '__commonjs_global', true);
return;
}
if (node.type !== 'CallExpression') return;

@@ -212,2 +221,3 @@ if (node.callee.name !== 'require' || scope.contains('require')) return;

if (node.scope) scope = scope.parent;
if (/^Function/.test(node.type)) scopeDepth -= 1;
}

@@ -214,0 +224,0 @@ });

@@ -141,5 +141,8 @@ import { statSync } from 'fs';

var scopeDepth = 0;
walk(ast, {
enter: function enter(node, parent) {
if (node.scope) scope = node.scope;
if (/^Function/.test(node.type)) scopeDepth += 1;

@@ -181,2 +184,8 @@ if (sourceMap) {

if (node.type === 'ThisExpression' && scopeDepth === 0) {
uses.global = true;
magicString.overwrite(node.start, node.end, '__commonjs_global', true);
return;
}
if (node.type !== 'CallExpression') return;

@@ -208,2 +217,3 @@ if (node.callee.name !== 'require' || scope.contains('require')) return;

if (node.scope) scope = scope.parent;
if (/^Function/.test(node.type)) scopeDepth -= 1;
}

@@ -210,0 +220,0 @@ });

2

package.json
{
"name": "rollup-plugin-commonjs",
"version": "2.1.0",
"version": "2.2.0",
"description": "Convert CommonJS modules to ES2015",

@@ -5,0 +5,0 @@ "devDependencies": {

@@ -107,5 +107,8 @@ import { statSync } from 'fs';

let scopeDepth = 0;
walk( ast, {
enter ( node, parent ) {
if ( node.scope ) scope = node.scope;
if ( /^Function/.test( node.type ) ) scopeDepth += 1;

@@ -147,2 +150,8 @@ if ( sourceMap ) {

if ( node.type === 'ThisExpression' && scopeDepth === 0 ) {
uses.global = true;
magicString.overwrite( node.start, node.end, `__commonjs_global`, true );
return;
}
if ( node.type !== 'CallExpression' ) return;

@@ -175,2 +184,3 @@ if ( node.callee.name !== 'require' || scope.contains( 'require' ) ) return;

if ( node.scope ) scope = scope.parent;
if ( /^Function/.test( node.type ) ) scopeDepth -= 1;
}

@@ -177,0 +187,0 @@ });

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