Socket
Socket
Sign inDemoInstall

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 0.10.0 to 0.10.1

4

CHANGELOG.md
# buble changelog
## 0.10.1
* Fix handling of literals inside JSX
## 0.10.0

@@ -4,0 +8,0 @@

2

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

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

import Node from '../Node.js';
function normalise ( str, removeTrailingWhitespace ) {
str = str
.replace( /^\s+/gm, '' ) // remove leading whitespace
.replace( /\s+\n\r?/gm, ' ' ); // replace newlines with spaces
if ( removeTrailingWhitespace ) {
str = str.replace( /\s+$/, '' );
}
// TODO prefer single quotes?
return JSON.stringify( str );
}
export default class JSXElement extends Node {
transpile ( code, transforms ) {
code.insertLeft( this.end, `)` );
super.transpile( code, transforms );

@@ -14,10 +25,22 @@

if ( children.length ) {
code.insertLeft( this.openingElement.end, ',' );
let c = this.openingElement.end;
for ( let i = 0; i < children.length - 1; i += 1 ) {
let i;
for ( i = 0; i < children.length; i += 1 ) {
const child = children[i];
code.insertLeft( child.end, ',' );
const tail = code.original[ c ] === '\n' && child.type !== 'Literal' ? '' : ' ';
code.insertLeft( c, `,${tail}` );
if ( child.type === 'Literal' ) {
const str = normalise( child.value, i === children.length - 1 );
code.overwrite( child.start, child.end, str );
}
c = child.end;
}
}
code.insertLeft( this.end, this.children.length && code.original[ this.end ] !== '\n' ? ` )` : `)` );
}
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc