🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

buble

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buble - npm Package Compare versions

Comparing version

to
0.10.3

7

CHANGELOG.md
# buble changelog
## 0.10.3
* Disable intelligent destructuring, temporarily ([#53](https://gitlab.com/Rich-Harris/buble/issues/53))
* Fix whitespace in JSX literals ([!39](https://gitlab.com/Rich-Harris/buble/merge_requests/39))
* Add `: true` to value-less JSX attributes ([!40](https://gitlab.com/Rich-Harris/buble/merge_requests/40))
* Quote invalid attribute names ([!41](https://gitlab.com/Rich-Harris/buble/merge_requests/41))
## 0.10.2

@@ -4,0 +11,0 @@

2

package.json
{
"name": "buble",
"version": "0.10.2",
"version": "0.10.3",
"description": "The blazing fast, batteries-included ES2015 compiler",

@@ -5,0 +5,0 @@ "main": "dist/buble.umd.js",

import Node from '../Node.js';
const IS_DATA_ATTRIBUTE = /-/;
export default class JSXAttribute extends Node {
transpile ( code, transforms ) {
code.overwrite( this.name.end, this.value.start, ': ' );
if ( this.value ) {
code.overwrite( this.name.end, this.value.start, ': ' );
} else {
// tag without value
code.overwrite( this.name.start, this.name.end, `${this.name.name}: true`)
}
if ( IS_DATA_ATTRIBUTE.test( this.name.name ) ) {
code.overwrite( this.name.start, this.name.end, `'${this.name.name}'` );
}
super.transpile( code, transforms );
}
}
import Node from '../Node.js';
function containsNewLine ( node ) {
return node.type === 'Literal' && !/\S/.test( node.value ) && /\n/.test( node.value );
}
export default class JSXClosingElement extends Node {
transpile ( code, transforms ) {
code.remove( this.start, this.end );
let spaceBeforeParen = true;
const lastChild = this.parent.children[ this.parent.children.length - 1 ];
// omit space before closing paren if
// a) this is on a separate line, or
// b) there are no children but there are attributes
if ( ( lastChild && containsNewLine( lastChild ) ) || ( this.parent.openingElement.attributes.length ) ) {
spaceBeforeParen = false;
}
code.overwrite( this.start, this.end, spaceBeforeParen ? ' )' : ')' );
}
}

@@ -5,4 +5,4 @@ import Node from '../Node.js';

str = str
.replace( /^\s+/gm, '' ) // remove leading whitespace
.replace( /\s+\n\r?/gm, ' ' ); // replace newlines with spaces
.replace( /^\n\r?\s+/, '' ) // remove leading newline + space
.replace( /\s*\n\r?\s*/gm, ' ' ); // replace newlines with spaces

@@ -43,8 +43,3 @@ if ( removeTrailingWhitespace ) {

}
const hasChildren = this.children.length;
const followedByNewline = code.original[ this.end ] !== '\n';
code.insertLeft( this.end, hasChildren && followedByNewline ? ` )` : `)` );
}
}

@@ -29,5 +29,10 @@ import Node from '../Node.js';

code.remove( c, this.end );
super.transpile( code, transforms );
if ( this.selfClosing ) {
code.overwrite( c, this.end, this.attributes.length ? `)` : ` )` );
} else {
code.remove( c, this.end );
}
}
}

@@ -28,17 +28,7 @@ const handlers = {

// if the declaration is only referenced once, we rewrite the
// reference rather than adding a new declaration
if ( onlyHasOneReference( declaration ) ) {
const instance = declaration.instances[0];
code.remove( node.start, node.end );
code.overwrite( instance.start, instance.end, expr );
}
else {
statementGenerators.push( ( start, prefix, suffix ) => {
code.insertRight( node.start, `${prefix}var ` );
code.insertLeft( node.end, ` = ${expr};${suffix}` );
code.move( node.start, node.end, start );
});
}
statementGenerators.push( ( start, prefix, suffix ) => {
code.insertRight( node.start, `${prefix}var ` );
code.insertLeft( node.end, ` = ${expr};${suffix}` );
code.move( node.start, node.end, start );
});
} else if ( node.type === 'AssignmentPattern' ) {

@@ -45,0 +35,0 @@ statementGenerators.push( ( start, prefix, 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