Socket
Socket
Sign inDemoInstall

buble

Package Overview
Dependencies
Maintainers
2
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buble - npm Package Compare versions

Comparing version 0.15.1 to 0.15.2

6

CHANGELOG.md
# buble changelog
## 0.15.2
* Don't create function names for object methods with `namedFunctionExpressions: false`
* Simplify destructuring assignment statements
* Give unique names to methods that shadow free variables ([#166](https://gitlab.com/Rich-Harris/buble/issues/166))
## 0.15.1

@@ -4,0 +10,0 @@

2

package.json
{
"name": "buble",
"version": "0.15.1",
"version": "0.15.2",
"description": "The blazing fast, batteries-included ES2015 compiler",

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

@@ -69,2 +69,18 @@ import wrap from './wrap.js';

unparenthesizedParent () {
let node = this.parent;
while ( node && node.type === 'ParenthesizedExpression' ) {
node = node.parent;
}
return node;
}
unparenthesize () {
let node = this;
while ( node.type === 'ParenthesizedExpression' ) {
node = node.expression;
}
return node;
}
findScope ( functionScope ) {

@@ -71,0 +87,0 @@ return this.parent.findScope( functionScope );

@@ -146,3 +146,10 @@ import Node from '../Node.js';

code.insertRight( start, `${text}, ${assign})` );
if ( this.unparenthesizedParent().type === 'ExpressionStatement' ) {
// no rvalue needed for expression statement
code.insertRight( start, `${text})` );
} else {
// destructuring is part of an expression - need an rvalue
code.insertRight( start, `${text}, ${assign})` );
}
code.remove( start, this.right.start );

@@ -171,4 +178,3 @@

let left = this.left;
while ( left.type === 'ParenthesizedExpression' ) left = left.expression;
const left = this.left.unparenthesize();

@@ -175,0 +181,0 @@ if ( left.type === 'Identifier' ) {

@@ -89,3 +89,5 @@ import Node from '../Node.js';

let methodName = method.key.name;
if ( reserved[ methodName ] ) methodName = scope.createIdentifier( methodName );
if ( reserved[ methodName ] || method.value.body.scope.references[methodName] ) {
methodName = scope.createIdentifier( methodName );
}

@@ -144,3 +146,4 @@ // when method name is a string or a number let's pretend it's a computed method

const rhs = ( isAccessor ? `.${method.kind}` : '' ) + ` = function` + ( method.value.generator ? '* ' : ' ' ) + ( method.computed || isAccessor || !namedFunctions ? '' : `${methodName} ` );
const funcName = method.computed || isAccessor || !namedFunctions ? '' : `${methodName} `;
const rhs = ( isAccessor ? `.${method.kind}` : '' ) + ` = function` + ( method.value.generator ? '* ' : ' ' ) + funcName;
code.remove( c, method.value.start );

@@ -147,0 +150,0 @@ code.insertRight( method.value.start, rhs );

@@ -10,17 +10,22 @@ import Node from '../Node.js';

} else if ( this.method ) {
let name;
if ( this.key.type === 'Literal' && typeof this.key.value === 'number' ) {
name = "";
} else if ( this.key.type === 'Identifier' ) {
if ( reserved[ this.key.name ] || ! /^[a-z_$][a-z0-9_$]*$/i.test( this.key.name ) ) {
name = this.findScope( true ).createIdentifier( this.key.name );
let name = '';
if ( this.program.options.namedFunctionExpressions !== false ) {
if ( this.key.type === 'Literal' && typeof this.key.value === 'number' ) {
name = "";
} else if ( this.key.type === 'Identifier' ) {
if ( reserved[ this.key.name ] ||
! /^[a-z_$][a-z0-9_$]*$/i.test( this.key.name ) ||
this.value.body.scope.references[this.key.name] ) {
name = this.findScope( true ).createIdentifier( this.key.name );
} else {
name = this.key.name;
}
} else {
name = this.key.name;
name = this.findScope( true ).createIdentifier( this.key.value );
}
} else {
name = this.findScope( true ).createIdentifier( this.key.value );
name = ' ' + name;
}
if ( this.value.generator ) code.remove( this.start, this.key.start );
code.insertLeft( this.key.end, `: function${this.value.generator ? '*' : ''} ${name}` );
code.insertLeft( this.key.end, `: function${this.value.generator ? '*' : ''}${name}` );
}

@@ -27,0 +32,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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