Comparing version 0.11.2 to 0.11.3
# buble changelog | ||
## 0.11.3 | ||
* Ensure inserted statements follow use strict pragma ([#72](https://gitlab.com/Rich-Harris/buble/issues/72)) | ||
## 0.11.2 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "buble", | ||
"version": "0.11.2", | ||
"version": "0.11.3", | ||
"description": "The blazing fast, batteries-included ES2015 compiler", | ||
@@ -5,0 +5,0 @@ "main": "dist/buble.umd.js", |
@@ -7,2 +7,9 @@ import wrap from './wrap.js'; | ||
function isUseStrict ( node ) { | ||
if ( !node ) return false; | ||
if ( node.type !== 'ExpressionStatement' ) return false; | ||
if ( node.expression.type !== 'Literal' ) return false; | ||
return node.expression.value === 'use strict'; | ||
} | ||
export default class BlockStatement extends Node { | ||
@@ -113,4 +120,2 @@ createScope () { | ||
transpile ( code, transforms ) { | ||
const start = this.parent.type === 'Root' || this.synthetic ? this.start : this.start + 1; | ||
const indentation = this.getIndentation(); | ||
@@ -172,2 +177,11 @@ | ||
let start; | ||
if ( isUseStrict( this.body[0] ) ) { | ||
start = this.body[0].end; | ||
} else if ( this.synthetic || this.parent.type === 'Root' ) { | ||
start = this.start; | ||
} else { | ||
start = this.start + 1; | ||
} | ||
let prefix = `\n${indentation}`; | ||
@@ -174,0 +188,0 @@ let suffix = ''; |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
1653087
77
15511
0
29