New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

broccoli-babel-transpiler

Package Overview
Dependencies
Maintainers
3
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-babel-transpiler - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0

fixtures/fixtures-es6.es6

7

index.js

@@ -14,2 +14,3 @@ 'use strict';

this.options = options || {};
this.extensions = this.options.filterExtensions || ['js'];
}

@@ -36,5 +37,9 @@

Babel.prototype.copyOptions = function() {
return clone(this.options);
var cloned = clone(this.options);
if (cloned.filterExtensions) {
delete cloned.filterExtensions;
}
return cloned;
};
module.exports = Babel;

2

package.json
{
"name": "broccoli-babel-transpiler",
"version": "4.0.1",
"version": "4.1.0",
"description": "A Broccoli plugin which transpile ES6 to readable ES5 by using babel.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -30,1 +30,15 @@ # broccoli-babel-transpiler

separate source map feature, welcome to submit a pull request.
## Advanced usage
`filterExtensions` is an option to limit (or expand) the set of file extensions that
will be transformed.
The default `filterExtension` is `js`
```js
var esTranspiler = require('broccoli-babel-transpiler');
var scriptTree = esTranspiler(inputTree, {
filterExtensions:['js', 'es6'] // babelize both .js and .es6 files
});
```

@@ -19,4 +19,2 @@ 'use strict';

describe('options', function() {
var options, babel;

@@ -29,6 +27,7 @@

baz: 1
}
},
filterExtensions: ['es6']
};
babel = new Babel('', options);
babel = new Babel('', options);
});

@@ -72,4 +71,17 @@

});
})
it('does not propogate validExtensions', function () {
var transpilerOptions;
babel.transform = function(string, options) {
transpilerOptions = options;
return { code: {} };
};
expect(transpilerOptions).to.eql(undefined);
babel.processString('path', 'relativePath');
expect(transpilerOptions.filterExtensions).to.eql(undefined);
});
});
describe('transpile ES6 to ES5', function() {

@@ -81,3 +93,6 @@ afterEach(function () {

it('basic', function () {
return build(inputPath, {}).then(function(results) {
return build(inputPath, {
inputSourceMap:false,
sourceMap: false
}).then(function(results) {
var outputPath = results.directory;

@@ -105,1 +120,42 @@

});
describe('filters files to transform', function() {
afterEach(function () {
builder.cleanup();
});
it('default', function () {
return build(inputPath, {
inputSourceMap:false,
sourceMap: false
}).then(function(results) {
var outputPath = results.directory;
var output = fs.readFileSync(path.join(outputPath, 'fixtures.js')).toString();
var input = fs.readFileSync(path.join(inputPath, 'expected.js')).toString();
expect(output).to.eql(input);
// Verify that .es6 file was not transformed
expect(fs.existsSync(path.join(outputPath, 'fixtures-es6.es6'))).to.be.ok;
});
});
it('uses specified filter', function () {
return build(inputPath, {
filterExtensions: ['es6'],
inputSourceMap:false,
sourceMap: false
}).then(function(results) {
var outputPath = results.directory;
var output = fs.readFileSync(path.join(outputPath, 'fixtures-es6.js')).toString();
var input = fs.readFileSync(path.join(inputPath, 'expected.js')).toString();
expect(output).to.eql(input);
// Verify that .es6 file was not transformed
expect(fs.existsSync(path.join(outputPath, 'fixtures-es6.es6'))).to.not.be.ok;
});
});
});
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