Comparing version 0.3.2 to 0.3.3
# buble changelog | ||
## 0.3.3 | ||
* Handle quote marks in template literals | ||
## 0.3.2 | ||
@@ -4,0 +8,0 @@ |
@@ -159,3 +159,3 @@ import { parse } from 'acorn'; | ||
const indentation = this.getIndentation(); | ||
const indentStr = magicString.indentStr; | ||
const indentStr = magicString.getIndentString(); | ||
@@ -475,12 +475,13 @@ if ( this.superClass ) { | ||
transpile () { | ||
this.program.magicString.remove( this.start, this.start + 1 ); | ||
this.program.magicString.remove( this.end - 1, this.end ); | ||
const magicString = this.program.magicString; | ||
magicString.remove( this.start, this.start + 1 ); | ||
magicString.remove( this.end - 1, this.end ); | ||
const ordered = this.expressions.concat( this.quasis ).sort( ( a, b ) => a.start - b.start ); | ||
let lastType; | ||
ordered.forEach( ( node, i ) => { | ||
if ( node.type === 'TemplateElement' ) { | ||
this.program.magicString.insert( node.start, i ? ` + '` : `'` ); | ||
this.program.magicString.insert( node.end, `'` ); | ||
if ( i ) magicString.insert( node.start, ' + ' ); | ||
magicString.overwrite( node.start, node.end, JSON.stringify( node.value.cooked ) ); | ||
@@ -493,7 +494,5 @@ // TODO overwrite string content (newlines, escaped quotes etc) | ||
this.program.magicString.overwrite( node.start - 2, node.start, open ); | ||
this.program.magicString.overwrite( node.end, node.end + 1, close ); | ||
magicString.overwrite( node.start - 2, node.start, open ); | ||
magicString.overwrite( node.end, node.end + 1, close ); | ||
} | ||
lastType = node.type; | ||
}); | ||
@@ -500,0 +499,0 @@ |
@@ -163,3 +163,3 @@ (function (global, factory) { | ||
const indentation = this.getIndentation(); | ||
const indentStr = magicString.indentStr; | ||
const indentStr = magicString.getIndentString(); | ||
@@ -479,12 +479,13 @@ if ( this.superClass ) { | ||
transpile () { | ||
this.program.magicString.remove( this.start, this.start + 1 ); | ||
this.program.magicString.remove( this.end - 1, this.end ); | ||
const magicString = this.program.magicString; | ||
magicString.remove( this.start, this.start + 1 ); | ||
magicString.remove( this.end - 1, this.end ); | ||
const ordered = this.expressions.concat( this.quasis ).sort( ( a, b ) => a.start - b.start ); | ||
let lastType; | ||
ordered.forEach( ( node, i ) => { | ||
if ( node.type === 'TemplateElement' ) { | ||
this.program.magicString.insert( node.start, i ? ` + '` : `'` ); | ||
this.program.magicString.insert( node.end, `'` ); | ||
if ( i ) magicString.insert( node.start, ' + ' ); | ||
magicString.overwrite( node.start, node.end, JSON.stringify( node.value.cooked ) ); | ||
@@ -497,7 +498,5 @@ // TODO overwrite string content (newlines, escaped quotes etc) | ||
this.program.magicString.overwrite( node.start - 2, node.start, open ); | ||
this.program.magicString.overwrite( node.end, node.end + 1, close ); | ||
magicString.overwrite( node.start - 2, node.start, open ); | ||
magicString.overwrite( node.end, node.end + 1, close ); | ||
} | ||
lastType = node.type; | ||
}); | ||
@@ -504,0 +503,0 @@ |
{ | ||
"name": "buble", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Common sense JavaScript transpilation", | ||
@@ -5,0 +5,0 @@ "main": "dist/buble.umd.js", |
@@ -18,3 +18,3 @@ import Node from '../Node.js'; | ||
const indentation = this.getIndentation(); | ||
const indentStr = magicString.indentStr; | ||
const indentStr = magicString.getIndentString(); | ||
@@ -21,0 +21,0 @@ if ( this.superClass ) { |
@@ -5,12 +5,13 @@ import Node from '../Node.js'; | ||
transpile () { | ||
this.program.magicString.remove( this.start, this.start + 1 ); | ||
this.program.magicString.remove( this.end - 1, this.end ); | ||
const magicString = this.program.magicString; | ||
magicString.remove( this.start, this.start + 1 ); | ||
magicString.remove( this.end - 1, this.end ); | ||
const ordered = this.expressions.concat( this.quasis ).sort( ( a, b ) => a.start - b.start ); | ||
let lastType; | ||
ordered.forEach( ( node, i ) => { | ||
if ( node.type === 'TemplateElement' ) { | ||
this.program.magicString.insert( node.start, i ? ` + '` : `'` ); | ||
this.program.magicString.insert( node.end, `'` ); | ||
if ( i ) magicString.insert( node.start, ' + ' ); | ||
magicString.overwrite( node.start, node.end, JSON.stringify( node.value.cooked ) ); | ||
@@ -23,7 +24,5 @@ // TODO overwrite string content (newlines, escaped quotes etc) | ||
this.program.magicString.overwrite( node.start - 2, node.start, open ); | ||
this.program.magicString.overwrite( node.end, node.end + 1, close ); | ||
magicString.overwrite( node.start - 2, node.start, open ); | ||
magicString.overwrite( node.end, node.end + 1, close ); | ||
} | ||
lastType = node.type; | ||
}); | ||
@@ -30,0 +29,0 @@ |
Sorry, the diff of this file is not supported yet
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
219219
2247