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 3.0.2 to 3.1.0

5

CHANGELOG.md
# rollup-plugin-commonjs changelog
## 3.1.0
* Replace `typeof require` with `'function'` ([#38](https://github.com/rollup/rollup-plugin-commonjs/issues/38))
* Don't attempt to resolve entry file relative to importer ([#63](https://github.com/rollup/rollup-plugin-commonjs/issues/63))
## 3.0.2

@@ -4,0 +9,0 @@

13

dist/rollup-plugin-commonjs.cjs.js

@@ -118,5 +118,4 @@ 'use strict';

if ( importee === HELPERS_ID ) return importee;
if ( importee[0] !== '.' || !importer ) return; // not our problem
if ( importee[0] !== '.' ) return; // not our problem
var resolved = path.resolve( path.dirname( importer ), importee );

@@ -206,2 +205,12 @@ var candidates = getCandidates( resolved, extensions );

// To allow consumption of UMD modules, transform `typeof require` to `'function'`
if ( node.type === 'UnaryExpression' && node.operator === 'typeof' && node.argument.type === 'Identifier' ) {
var name$1 = node.argument.name;
if ( name$1 === 'require' && !scope.contains( name$1 ) ) {
magicString.overwrite( node.start, node.end, "'function'" );
return;
}
}
if ( node.type === 'Identifier' ) {

@@ -208,0 +217,0 @@ if ( ( node.name in uses ) && isReference( node, parent ) && !scope.contains( node.name ) ) {

@@ -114,5 +114,4 @@ import { statSync } from 'fs';

if ( importee === HELPERS_ID ) return importee;
if ( importee[0] !== '.' || !importer ) return; // not our problem
if ( importee[0] !== '.' ) return; // not our problem
var resolved = resolve( dirname( importer ), importee );

@@ -202,2 +201,12 @@ var candidates = getCandidates( resolved, extensions );

// To allow consumption of UMD modules, transform `typeof require` to `'function'`
if ( node.type === 'UnaryExpression' && node.operator === 'typeof' && node.argument.type === 'Identifier' ) {
var name$1 = node.argument.name;
if ( name$1 === 'require' && !scope.contains( name$1 ) ) {
magicString.overwrite( node.start, node.end, "'function'" );
return;
}
}
if ( node.type === 'Identifier' ) {

@@ -204,0 +213,0 @@ if ( ( node.name in uses ) && isReference( node, parent ) && !scope.contains( node.name ) ) {

4

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

@@ -32,3 +32,3 @@ "devDependencies": {

"resolve": "^1.1.7",
"rollup-pluginutils": "^1.5.0"
"rollup-pluginutils": "^1.5.1"
},

@@ -35,0 +35,0 @@ "repository": {

@@ -84,5 +84,4 @@ import { statSync } from 'fs';

if ( importee === HELPERS_ID ) return importee;
if ( importee[0] !== '.' || !importer ) return; // not our problem
if ( importee[0] !== '.' ) return; // not our problem
const resolved = resolve( dirname( importer ), importee );

@@ -172,2 +171,12 @@ const candidates = getCandidates( resolved, extensions );

// To allow consumption of UMD modules, transform `typeof require` to `'function'`
if ( node.type === 'UnaryExpression' && node.operator === 'typeof' && node.argument.type === 'Identifier' ) {
const name = node.argument.name;
if ( name === 'require' && !scope.contains( name ) ) {
magicString.overwrite( node.start, node.end, `'function'` );
return;
}
}
if ( node.type === 'Identifier' ) {

@@ -174,0 +183,0 @@ if ( ( node.name in uses ) && isReference( node, parent ) && !scope.contains( node.name ) ) {

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