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.2.2 to 0.3.0

src/program/types/ExportDefaultDeclaration.js

5

CHANGELOG.md
# buble changelog
## 0.3.0
* (Very) basic CLI
* Handle `export default class ...`
## 0.2.2

@@ -4,0 +9,0 @@

23

dist/buble.es.js

@@ -42,2 +42,7 @@ import { parse } from 'acorn';

getIndentation () {
const lastLine = /\n(.+)$/.exec( this.program.magicString.original.slice( 0, this.start ) );
return lastLine ? /^[ \t]*/.exec( lastLine[1] )[0] : '';
}
initialise () {

@@ -154,4 +159,3 @@ //console.log( 'init', this.type )

const match = /[ \t]+$/.exec( magicString.original.slice( 0, this.start ) );
const indentation = match ? match[0] : '';
const indentation = this.getIndentation();
const indentStr = magicString.indentStr;

@@ -183,4 +187,2 @@

let lastIndex = this.body.start;

@@ -215,2 +217,14 @@

class ExportDefaultDeclaration extends Node {
transpile () {
super.transpile();
if ( this.declaration.type === 'ClassDeclaration' ) {
this.program.magicString.insert( this.end, `\n\n${this.getIndentation()}` );
this.program.magicString.move( this.start, this.declaration.start, this.end );
this.program.magicString.insert( this.end, `${this.declaration.id.name};` );
}
}
}
function extractNames ( node ) {

@@ -594,2 +608,3 @@ const names = [];

ClassDeclaration,
ExportDefaultDeclaration,
ForStatement,

@@ -596,0 +611,0 @@ FunctionDeclaration,

@@ -46,2 +46,7 @@ (function (global, factory) {

getIndentation () {
const lastLine = /\n(.+)$/.exec( this.program.magicString.original.slice( 0, this.start ) );
return lastLine ? /^[ \t]*/.exec( lastLine[1] )[0] : '';
}
initialise () {

@@ -158,4 +163,3 @@ //console.log( 'init', this.type )

const match = /[ \t]+$/.exec( magicString.original.slice( 0, this.start ) );
const indentation = match ? match[0] : '';
const indentation = this.getIndentation();
const indentStr = magicString.indentStr;

@@ -187,4 +191,2 @@

let lastIndex = this.body.start;

@@ -219,2 +221,14 @@

class ExportDefaultDeclaration extends Node {
transpile () {
super.transpile();
if ( this.declaration.type === 'ClassDeclaration' ) {
this.program.magicString.insert( this.end, `\n\n${this.getIndentation()}` );
this.program.magicString.move( this.start, this.declaration.start, this.end );
this.program.magicString.insert( this.end, `${this.declaration.id.name};` );
}
}
}
function extractNames ( node ) {

@@ -598,2 +612,3 @@ const names = [];

ClassDeclaration,
ExportDefaultDeclaration,
ForStatement,

@@ -600,0 +615,0 @@ FunctionDeclaration,

{
"name": "buble",
"version": "0.2.2",
"version": "0.3.0",
"description": "Common sense JavaScript transpilation",

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

},
"bin": {
"buble": "./bin/buble"
},
"repository": {

@@ -45,2 +48,3 @@ "type": "git",

"rollup": "^0.25.8",
"rollup-plugin-buble": "^0.2.3",
"source-map-support": "^0.4.0"

@@ -47,0 +51,0 @@ },

@@ -41,2 +41,7 @@ import { walk } from 'estree-walker';

getIndentation () {
const lastLine = /\n(.+)$/.exec( this.program.magicString.original.slice( 0, this.start ) );
return lastLine ? /^[ \t]*/.exec( lastLine[1] )[0] : '';
}
initialise () {

@@ -43,0 +48,0 @@ //console.log( 'init', this.type )

5

src/program/types/ClassDeclaration.js

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

const match = /[ \t]+$/.exec( magicString.original.slice( 0, this.start ) );
const indentation = match ? match[0] : '';
const indentation = this.getIndentation();
const indentStr = magicString.indentStr;

@@ -46,4 +45,2 @@

let lastIndex = this.body.start;

@@ -50,0 +47,0 @@

import AssignmentExpression from './AssignmentExpression.js';
import ArrowFunctionExpression from './ArrowFunctionExpression.js';
import ClassDeclaration from './ClassDeclaration.js';
import ExportDefaultDeclaration from './ExportDefaultDeclaration.js';
import ForStatement from './ForStatement.js';

@@ -22,2 +23,3 @@ import FunctionDeclaration from './FunctionDeclaration.js';

ClassDeclaration,
ExportDefaultDeclaration,
ForStatement,

@@ -24,0 +26,0 @@ FunctionDeclaration,

Sorry, the diff of this file is not supported yet

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