Comparing version 0.9.1 to 0.9.2
@@ -43,5 +43,5 @@ var chalk = require( 'chalk' ); | ||
console.error( 'Type ' + chalk.cyan( 'rollup --help' ) + ' for help, or visit https://github.com/rollup/rollup/wiki' ); | ||
console.error( 'Type ' + chalk.cyan( 'buble --help' ) + ' for help, or visit https://buble.surge.sh/guide/' ); | ||
process.exit( 1 ); | ||
}; |
# buble changelog | ||
## 0.9.2 | ||
* Allow class to have accessors and no constructor ([#48](https://gitlab.com/Rich-Harris/buble/issues/48)) | ||
* Fix help message in CLI | ||
## 0.9.1 | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "buble", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "The blazing fast, batteries-included ES2015 compiler", | ||
@@ -5,0 +5,0 @@ "main": "dist/buble.umd.js", |
@@ -9,15 +9,13 @@ import Node from '../Node.js'; | ||
const penultimateElement = this.elements[ this.elements.length - 2 ]; | ||
const argument = lastElement.argument; | ||
code.insertLeft( this.end, '.concat(' ); | ||
code.move( argument.start, argument.end, this.end ); | ||
code.insertRight( this.end, ')' ); | ||
if ( penultimateElement ) { | ||
code.overwrite( penultimateElement.end, lastElement.start, ` ].concat( ` ); | ||
code.remove( penultimateElement.end, argument.start ); | ||
} else { | ||
code.insertLeft( this.start + 1, `].concat(` ); | ||
code.remove( this.start + 1, this.end - 1 ); | ||
} | ||
code.remove( lastElement.start, lastElement.start + 3 ); | ||
let charIndex = lastElement.end; | ||
while ( code.original[ charIndex ] !== ']' ) charIndex += 1; | ||
code.overwrite( charIndex, charIndex + 1, ')' ); | ||
} | ||
@@ -24,0 +22,0 @@ } |
@@ -11,25 +11,17 @@ import Node from '../Node.js'; | ||
if ( transforms.arrow ) { | ||
if ( this.params.length === 0 ) { | ||
code.overwrite( this.start, this.body.start, 'function () ' ); | ||
} else { | ||
let parenthesised = false; | ||
let charIndex = this.start; | ||
while ( charIndex < this.params[0].start ) { | ||
if ( code.original[ charIndex ] === '(' ) { | ||
parenthesised = true; | ||
break; | ||
} | ||
} | ||
// remove arrow | ||
let charIndex = this.body.start; | ||
while ( code.original[ charIndex ] !== '=' ) { | ||
charIndex -= 1; | ||
} | ||
code.remove( charIndex, this.body.start ); | ||
let start = 'function '; | ||
if ( !parenthesised ) start += '( '; | ||
// wrap naked parameter | ||
if ( this.params.length === 1 && this.start === this.params[0].start ) { | ||
code.insertRight( this.params[0].start, '(' ); | ||
code.insertLeft( this.params[0].end, ')' ); | ||
} | ||
code.insertRight( this.start, start ); | ||
charIndex = this.params[ this.params.length -1 ].end; | ||
while ( code.original[ charIndex ] !== '=' ) charIndex += 1; | ||
// remove the `=> ` | ||
code.overwrite( charIndex, this.body.start, parenthesised ? '' : ') ' ); | ||
} | ||
// add function | ||
code.insertRight( this.start, 'function ' ); | ||
} | ||
@@ -36,0 +28,0 @@ |
@@ -17,2 +17,5 @@ import Node from '../Node.js'; | ||
let introBlock = ''; | ||
let outroBlock = ''; | ||
if ( this.body.length ) { | ||
@@ -42,3 +45,3 @@ code.remove( this.start, this.body[0].start ); | ||
if ( constructor ) { | ||
code.insertLeft( constructor.end, `\n\n${i0}` + inheritanceBlock ); | ||
introBlock += `\n\n${i0}` + inheritanceBlock; | ||
} else { | ||
@@ -50,3 +53,3 @@ const fn = `function ${name} () {` + ( superName ? | ||
inheritanceBlock = fn + inheritanceBlock; | ||
code.insertRight( this.start, inheritanceBlock + `\n\n${i0}` ); | ||
introBlock += inheritanceBlock + `\n\n${i0}`; | ||
} | ||
@@ -58,3 +61,3 @@ } else if ( !constructor ) { | ||
code.insertRight( this.start, fn ); | ||
introBlock += fn; | ||
} | ||
@@ -130,10 +133,16 @@ | ||
if ( constructor ) { | ||
code.insertLeft( constructor.end, `\n\n${i0}${intro.join( `\n${i0}` )}` ); | ||
} else { | ||
code.insertRight( this.start, `${intro.join( `\n${i0}` )}\n\n${i0}` ); | ||
} | ||
if ( constructor ) introBlock += `\n\n${i0}`; | ||
introBlock += intro.join( `\n${i0}` ); | ||
if ( !constructor ) introBlock += `\n\n${i0}`; | ||
code.insertLeft( this.end, `\n\n${i0}${outro.join( `\n${i0}` )}` ); | ||
outroBlock += `\n\n${i0}` + outro.join( `\n${i0}` ); | ||
} | ||
if ( constructor ) { | ||
code.insertLeft( constructor.end, introBlock ); | ||
} else { | ||
code.insertRight( this.start, introBlock ); | ||
} | ||
code.insertLeft( this.end, outroBlock ); | ||
} | ||
@@ -140,0 +149,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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1247267
11433