buble
Advanced tools
Comparing version 0.14.1 to 0.14.2
@@ -17,2 +17,3 @@ Bublé version <%= version %> | ||
--jsx Custom JSX pragma | ||
--objectAssign Specify Object.assign or equivalent polyfill | ||
@@ -19,0 +20,0 @@ Examples: |
@@ -37,3 +37,3 @@ var fs = require( 'fs' ); | ||
if ( ext !== '.js' && ext !== '.jsm' && ext !== '.es6' ) return; | ||
if ( ext !== '.js' && ext !== '.jsm' && ext !== '.es6' && ext !== '.jsx') return; | ||
@@ -48,3 +48,4 @@ if ( to ) to = to.slice( 0, -ext.length ) + '.js'; | ||
file: to, | ||
jsx: options.jsx | ||
jsx: options.jsx, | ||
objectAssign: options.objectAssign, | ||
}); | ||
@@ -90,3 +91,4 @@ | ||
transforms: {}, | ||
jsx: command.jsx | ||
jsx: command.jsx, | ||
objectAssign: command.objectAssign === true ? "Object.assign" : command.objectAssign, | ||
}; | ||
@@ -93,0 +95,0 @@ |
# buble changelog | ||
## 0.14.2 | ||
* Allow `.jsx` file extension ([#127](https://gitlab.com/Rich-Harris/buble/issues/127)) | ||
* Handle trailing comma in spread operator ([#133](https://gitlab.com/Rich-Harris/buble/issues/133)) | ||
* Allow empty code blocks in JSX ([#131](https://gitlab.com/Rich-Harris/buble/issues/131)) | ||
* Allow computed shorthand function name with spread in body ([#135](https://gitlab.com/Rich-Harris/buble/issues/135)) | ||
* Add `--objectAssign` CLI option ([#113](https://gitlab.com/Rich-Harris/buble/issues/113)) | ||
* Allow numeric literals as shorthand method keys ([#139](https://gitlab.com/Rich-Harris/buble/issues/139)) | ||
## 0.14.1 | ||
@@ -4,0 +13,0 @@ |
{ | ||
"name": "buble", | ||
"version": "0.14.1", | ||
"version": "0.14.2", | ||
"description": "The blazing fast, batteries-included ES2015 compiler", | ||
@@ -5,0 +5,0 @@ "main": "dist/buble.umd.js", |
@@ -77,2 +77,4 @@ import extractNames from './extractNames.js'; | ||
createIdentifier ( base ) { | ||
if ( typeof base === 'number' ) base = base.toString(); | ||
base = base | ||
@@ -79,0 +81,0 @@ .replace( /\s/g, '' ) |
@@ -23,2 +23,10 @@ import Node from '../Node.js'; | ||
if ( transforms.spreadRest ) { | ||
// erase trailing comma after last array element if not an array hole | ||
if ( this.elements.length ) { | ||
let lastElement = this.elements[ this.elements.length - 1 ]; | ||
if ( lastElement && /\s*,/.test( code.original.slice( lastElement.end, this.end ) ) ) { | ||
code.overwrite( lastElement.end, this.end - 1, ' ' ); | ||
} | ||
} | ||
if ( this.elements.length === 1 ) { | ||
@@ -37,3 +45,2 @@ const element = this.elements[0]; | ||
} | ||
else { | ||
@@ -40,0 +47,0 @@ const hasSpreadElements = spread( code, this.elements, this.start, this.argumentsArrayAlias ); |
@@ -77,3 +77,6 @@ import Node from '../Node.js'; | ||
if ( method.static ) code.remove( method.start, method.start + 7 ); | ||
if ( method.static ) { | ||
const len = code.original[ method.start + 6 ] == ' ' ? 7 : 6; | ||
code.remove( method.start, method.start + len ); | ||
} | ||
@@ -86,2 +89,10 @@ const isAccessor = method.kind !== 'method'; | ||
// when method name is a string or a number let's pretend it's a computed method | ||
let fake_computed = false; | ||
if ( ! method.computed && method.key.type === 'Literal' ) { | ||
fake_computed = true; | ||
method.computed = true; | ||
} | ||
if ( isAccessor ) { | ||
@@ -120,4 +131,9 @@ if ( method.computed ) { | ||
if ( method.computed ) { | ||
while ( code.original[c] !== ']' ) c += 1; | ||
c += 1; | ||
if ( fake_computed ) { | ||
code.insertRight( method.key.start, '[' ); | ||
code.insertLeft( method.key.end, ']' ); | ||
} else { | ||
while ( code.original[c] !== ']' ) c += 1; | ||
c += 1; | ||
} | ||
} | ||
@@ -124,0 +140,0 @@ |
@@ -34,4 +34,8 @@ import Node from '../Node.js'; | ||
const tail = code.original[ c ] === '\n' && child.type !== 'Literal' ? '' : ' '; | ||
code.insertLeft( c, `,${tail}` ); | ||
if ( child.type === 'JSXExpressionContainer' && child.expression.type === 'JSXEmptyExpression' ) { | ||
// empty block is a no op | ||
} else { | ||
const tail = code.original[ c ] === '\n' && child.type !== 'Literal' ? '' : ' '; | ||
code.insertLeft( c, `,${tail}` ); | ||
} | ||
@@ -38,0 +42,0 @@ if ( child.type === 'Literal' ) { |
import Node from '../Node.js'; | ||
import deindent from '../../utils/deindent.js'; | ||
import CompileError from '../../utils/CompileError.js'; | ||
@@ -117,4 +116,2 @@ | ||
} | ||
deindent( prop.value, code ); | ||
} | ||
@@ -121,0 +118,0 @@ } |
@@ -10,3 +10,9 @@ import Node from '../Node.js'; | ||
} else if ( this.method ) { | ||
const name = this.findScope( true ).createIdentifier( this.key.type === 'Identifier' ? this.key.name : this.key.value ); | ||
let name; | ||
if ( this.key.type === 'Literal' && typeof this.key.value === 'number' ) { | ||
name = ""; | ||
} else { | ||
name = this.findScope( true ).createIdentifier( this.key.type === 'Identifier' ? this.key.name : this.key.value ); | ||
} | ||
if ( this.value.generator ) code.remove( this.start, this.key.start ); | ||
@@ -13,0 +19,0 @@ code.insertLeft( this.key.end, `: function${this.value.generator ? '*' : ''} ${name}` ); |
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
2505824
25775