Socket
Socket
Sign inDemoInstall

buble

Package Overview
Dependencies
Maintainers
1
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.12.5 to 0.13.0

5

CHANGELOG.md
# buble changelog
## 0.13.0
* Require an `objectAssign` option to be specified if using object spread operator ([#93](https://gitlab.com/Rich-Harris/buble/issues/93))
* Fix spread operator with expression method calls and template strings ([!74](https://gitlab.com/Rich-Harris/buble/merge_requests/74))
## 0.12.5

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

4

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

@@ -65,3 +65,3 @@ "main": "dist/buble.umd.js",

"dependencies": {
"acorn": "^3.1.0",
"acorn": "3.2.x",
"acorn-jsx": "^3.0.1",

@@ -68,0 +68,0 @@ "acorn-object-spread": "^1.0.0",

@@ -10,3 +10,3 @@ import MagicString from 'magic-string';

this.jsx = options.jsx || 'React.createElement';
this.objectAssign = options.objectAssign || 'Object.assign';
this.objectAssign = options.objectAssign;

@@ -13,0 +13,0 @@ this.source = source;

@@ -41,8 +41,15 @@ import Node from '../Node.js';

context = this.callee.object.name;
} else if ( this.callee.object.type === 'ThisExpression' ) {
context = 'this';
} else {
const statement = this.callee.object;
const i0 = statement.getIndentation();
context = this.findScope( true ).createIdentifier( 'ref' );
code.insertRight( statement.start, `var ${context} = ` );
code.insertLeft( statement.end, `;\n${i0}${context}` );
const callExpression = this.callee.object;
const enclosure = callExpression.findNearest( /Function/ );
const block = enclosure ? enclosure.body.body
: callExpression.findNearest( /^Program$/ ).body;
const lastStatementInBlock = block[ block.length - 1 ];
const i0 = lastStatementInBlock.getIndentation();
code.insertLeft( callExpression.start, `(${context} = ` );
code.insertRight( callExpression.end, `)` );
code.insertRight( lastStatementInBlock.end, `\n${i0}var ${context};` );
}

@@ -75,5 +82,5 @@ } else {

if ( firstArgument.type === 'SpreadElement' ) {
code.insertRight( firstArgument.start, `${context}, ` );
code.insertLeft( firstArgument.start, `${context}, ` );
} else {
code.insertRight( firstArgument.start, `${context}, [ ` );
code.insertLeft( firstArgument.start, `${context}, [ ` );
}

@@ -80,0 +87,0 @@

import Node from '../Node.js';
import CompileError from '../../utils/CompileError.js';

@@ -55,2 +56,5 @@ export default class JSXOpeningElement extends Node {

} else {
if (!this.program.objectAssign) {
throw new CompileError( this, 'Mixed JSX attributes ending in spread requires specified objectAssign option with \'Object.assign\' or polyfill helper.' );
}
before = html ? `', ${this.program.objectAssign}({},` : `, ${this.program.objectAssign}({},`;

@@ -57,0 +61,0 @@ after = ')';

import Node from '../Node.js';
import deindent from '../../utils/deindent.js';
import CompileError from '../../utils/CompileError.js';

@@ -17,2 +18,5 @@ export default class ObjectExpression extends Node {

if ( spreadPropertyCount ) {
if ( !this.program.objectAssign ) {
throw new CompileError( this, 'Object spread operator requires specified objectAssign option with \'Object.assign\' or polyfill helper.' );
}
// enclose run of non-spread properties in curlies

@@ -19,0 +23,0 @@ let i = this.properties.length;

@@ -39,3 +39,3 @@ export function isArguments ( node ) {

} else {
code.insertRight( element.start, '[' );
code.insertLeft( element.start, '[' );
code.insertLeft( element.end, ']' );

@@ -42,0 +42,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