Comparing version 0.8.1 to 0.8.2
# buble changelog | ||
## 0.8.2 | ||
* More robust version of ([!22](https://gitlab.com/Rich-Harris/buble/merge_requests/22)) | ||
## 0.8.1 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "buble", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "The blazing fast, batteries-included ES2015 compiler", | ||
@@ -5,0 +5,0 @@ "main": "dist/buble.umd.js", |
@@ -18,5 +18,13 @@ import Node from '../Node.js'; | ||
const indentation = this.getIndentation(); | ||
const indentStr = code.getIndentString(); | ||
const i0 = this.getIndentation(); | ||
const i1 = i0 + code.getIndentString(); | ||
// if this is an export default statement, we have to move the export to | ||
// after the declaration, because `export default var Foo = ...` is illegal | ||
const syntheticDefaultExport = this.parent.type === 'ExportDefaultDeclaration' ? | ||
`\n\n${i0}export default ${this.id.name};` : | ||
''; | ||
if ( syntheticDefaultExport ) code.remove( this.parent.start, this.start ); | ||
code.overwrite( this.start, this.id.start, 'var ' ); | ||
@@ -26,3 +34,3 @@ | ||
code.overwrite( this.id.end, this.superClass.start, ' = ' ); | ||
code.overwrite( this.superClass.end, this.body.start, `(function (${superName}) {\n${indentation}${indentStr}` ); | ||
code.overwrite( this.superClass.end, this.body.start, `(function (${superName}) {\n${i1}` ); | ||
} else { | ||
@@ -35,5 +43,7 @@ code.overwrite( this.id.end, this.body.start, ' = ' ); | ||
if ( this.superClass ) { | ||
code.insertLeft( this.end, `\n\n${indentation}${indentStr}return ${this.name};\n${indentation}}(` ); | ||
code.insertLeft( this.end, `\n\n${i1}return ${this.name};\n${i0}}(` ); | ||
code.move( this.superClass.start, this.superClass.end, this.end ); | ||
code.insertRight( this.end, '));' ); | ||
code.insertRight( this.end, `));${syntheticDefaultExport}` ); | ||
} else if ( syntheticDefaultExport ) { | ||
code.insertRight( this.end, syntheticDefaultExport ); | ||
} | ||
@@ -40,0 +50,0 @@ } |
@@ -9,11 +9,2 @@ import Node from '../Node.js'; | ||
} | ||
transpile ( code, transforms ) { | ||
super.transpile( code, transforms ); | ||
if ( this.declaration.type === 'ClassDeclaration' ) { | ||
code.remove( this.start, this.declaration.start ); | ||
code.insertRight( this.end, `\n\n${this.getIndentation()}export default ${this.declaration.id.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
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
1238752
11204