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.11.6 to 0.12.0

dist/buble.deps.min.js

5

CHANGELOG.md
# buble changelog
## 0.12.0
* Support `u` flag in regular expression literals ([!62](https://gitlab.com/Rich-Harris/buble/merge_requests/62))
* Save `buble/register` transformations to `$HOME/.buble-cache` ([!63](https://gitlab.com/Rich-Harris/buble/merge_requests/63))
## 0.11.6

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

6

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

@@ -52,2 +52,3 @@ "main": "dist/buble.umd.js",

"mocha": "^2.4.5",
"regexpu-core": "^2.0.0",
"rimraf": "^2.5.2",

@@ -68,4 +69,5 @@ "rollup": "^0.26.3",

"magic-string": "^0.14.0",
"minimist": "^1.2.0"
"minimist": "^1.2.0",
"os-homedir": "^1.0.1"
}
}
var fs = require( 'fs' );
var path = require( 'path' );
var crypto = require( 'crypto' );
var homedir = require( 'os-homedir' );
var buble = require( './' );

@@ -9,7 +11,7 @@

var nodeVersion = /(?:0\.)?\d+/.exec( process.version )[0];
var versions = [ '0.10', '0.12', '4', '5' ];
var versions = [ '0.10', '0.12', '4', '5', '6' ];
if ( !~versions.indexOf( nodeVersion ) ) {
if ( +nodeVersion > 5 ) {
nodeVersion = 5;
if ( +nodeVersion > 6 ) {
nodeVersion = 6;
} else {

@@ -26,2 +28,21 @@ throw new Error( 'Unsupported version (' + nodeVersion + '). Please raise an issue at https://gitlab.com/Rich-Harris/buble/issues' );

function mkdirp ( dir ) {
var parent = path.dirname( dir );
if ( dir === parent ) return;
mkdirp( parent );
try {
fs.mkdirSync( dir );
} catch ( err ) {
if ( err.code !== 'EEXIST' ) throw err;
}
}
var home = homedir();
if ( home ) {
var cachedir = path.join( home, '.buble-cache', nodeVersion );
mkdirp( cachedir );
fs.writeFileSync( path.join( home, '.buble-cache/README.txt' ), 'These files enable a faster startup when using buble/register. You can safely delete this folder at any time. See https://buble.surge.sh/guide/ for more information.' );
}
require.extensions[ '.js' ] = function ( m, filename ) {

@@ -31,15 +52,35 @@ if ( nodeModulesPattern.test( filename ) ) return original( m, filename );

var source = fs.readFileSync( filename, 'utf-8' );
var hash = crypto.createHash( 'sha256' );
hash.update( source );
var key = hash.digest( 'hex' ) + '.json';
var cachepath = path.join( cachedir, key );
try {
var compiled = buble.transform( source, options );
} catch ( err ) {
if ( err.snippet ) {
console.log( 'Error compiling ' + filename + ':\n---' );
console.log( err.snippet );
console.log( err.message );
console.log( '' )
process.exit( 1 );
var compiled;
if ( cachedir ) {
try {
compiled = JSON.parse( fs.readFileSync( cachepath, 'utf-8' ) );
} catch ( err ) {
// noop
}
}
throw err;
if ( !compiled ) {
try {
compiled = buble.transform( source, options );
if ( cachedir ) {
fs.writeFileSync( cachepath, JSON.stringify( compiled ) );
}
} catch ( err ) {
if ( err.snippet ) {
console.log( 'Error compiling ' + filename + ':\n---' );
console.log( err.snippet );
console.log( err.message );
console.log( '' )
process.exit( 1 );
}
throw err;
}
}

@@ -46,0 +87,0 @@

import Node from '../Node.js';
import CompileError from '../../utils/CompileError.js';
import rewritePattern from 'regexpu-core';

@@ -14,6 +15,10 @@ export default class Literal extends Node {

if ( this.regex ) {
if ( transforms.unicodeRegExp && /u/.test( this.regex.flags ) ) throw new CompileError( this, 'Regular expression unicode flag is not supported' );
if ( transforms.stickyRegExp && /y/.test( this.regex.flags ) ) throw new CompileError( this, 'Regular expression sticky flag is not supported' );
const { pattern, flags } = this.regex;
if ( transforms.stickyRegExp && /y/.test( flags ) ) throw new CompileError( this, 'Regular expression sticky flag is not supported' );
if ( transforms.unicodeRegExp && /u/.test( flags ) ) {
code.overwrite( this.start, this.end, `/${rewritePattern( pattern, flags )}/${flags.replace( 'u', '' )}` );
}
}
}
}

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