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

rollup

Package Overview
Dependencies
Maintainers
1
Versions
834
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

5

CHANGELOG.md
# rollup changelog
## 0.8.1
* Anonymous functions that are exported as default are converted to named function declarations for correct hoisting, rather than being bound to functions ([#29](https://github.com/rollup/rollup/issues/29))
* Automatically-generated default export names are deconflicted with local definitions ([#29](https://github.com/rollup/rollup/issues/29))
## 0.8.0

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

25

dist/rollup.js

@@ -1044,2 +1044,4 @@ 'use strict';

var isDeclaration = /Declaration$/.test(node.declaration.type);
var isAnonymous = /(?:Class|Function)Expression$/.test(node.declaration.type);
var declaredName = isDeclaration && node.declaration.id.name;

@@ -1055,2 +1057,3 @@ var identifier = node.declaration.type === 'Identifier' && node.declaration.name;

isDeclaration: isDeclaration,
isAnonymous: isAnonymous,
isModified: false // in case of `export default foo; foo = somethingElse`

@@ -1384,6 +1387,15 @@ };

Module.prototype.suggestName = function suggestName(exportName, suggestion) {
if (!this.suggestedNames[exportName]) {
this.suggestedNames[exportName] = makeLegalIdentifier(suggestion);
Module.prototype.suggestName = function suggestName(defaultOrBatch, suggestion) {
// deconflict anonymous default exports with this module's definitions
var shouldDeconflict = this.exports.default && this.exports.default.isAnonymous;
if (shouldDeconflict) {
while (suggestion in this.definitions) {
suggestion = '_' + suggestion;
}
}
if (!this.suggestedNames[defaultOrBatch]) {
this.suggestedNames[defaultOrBatch] = makeLegalIdentifier(suggestion);
}
};

@@ -1800,3 +1812,8 @@

source.overwrite(statement.node.start, statement.node.declaration.start, 'var ' + canonicalName + ' = ');
// anonymous functions should be converted into declarations
if (statement.node.declaration.type === 'FunctionExpression') {
source.overwrite(statement.node.start, statement.node.declaration.start + 8, 'function ' + canonicalName);
} else {
source.overwrite(statement.node.start, statement.node.declaration.start, 'var ' + canonicalName + ' = ');
}
} else {

@@ -1803,0 +1820,0 @@ throw new Error('Unhandled export');

2

package.json
{
"name": "rollup",
"version": "0.8.0",
"version": "0.8.1",
"description": "Next-generation ES6 module bundler",

@@ -5,0 +5,0 @@ "main": "dist/rollup.js",

@@ -294,3 +294,8 @@ import { basename, dirname, extname, relative, resolve } from 'path';

source.overwrite( statement.node.start, statement.node.declaration.start, `var ${canonicalName} = ` );
// anonymous functions should be converted into declarations
if ( statement.node.declaration.type === 'FunctionExpression' ) {
source.overwrite( statement.node.start, statement.node.declaration.start + 8, `function ${canonicalName}` );
} else {
source.overwrite( statement.node.start, statement.node.declaration.start, `var ${canonicalName} = ` );
}
}

@@ -297,0 +302,0 @@

@@ -130,2 +130,4 @@ import { Promise } from 'sander';

const isDeclaration = /Declaration$/.test( node.declaration.type );
const isAnonymous = /(?:Class|Function)Expression$/.test( node.declaration.type );
const declaredName = isDeclaration && node.declaration.id.name;

@@ -141,2 +143,3 @@ const identifier = node.declaration.type === 'Identifier' && node.declaration.name;

isDeclaration,
isAnonymous,
isModified: false // in case of `export default foo; foo = somethingElse`

@@ -469,7 +472,16 @@ };

suggestName ( exportName, suggestion ) {
if ( !this.suggestedNames[ exportName ] ) {
this.suggestedNames[ exportName ] = makeLegalIdentifier( suggestion );
suggestName ( defaultOrBatch, suggestion ) {
// deconflict anonymous default exports with this module's definitions
const shouldDeconflict = this.exports.default && this.exports.default.isAnonymous;
if ( shouldDeconflict ) {
while ( suggestion in this.definitions ) {
suggestion = `_${suggestion}`;
}
}
if ( !this.suggestedNames[ defaultOrBatch ] ) {
this.suggestedNames[ defaultOrBatch ] = makeLegalIdentifier( suggestion );
}
}
}
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