Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browserify-rfr

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-rfr - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

test/fixtures/shebang.js

11

lib/index.js

@@ -47,2 +47,3 @@ var _ = require('lodash');

var content = "";
if (/\.json$/.test(file)) return through();

@@ -56,2 +57,10 @@ return through(function write (buf) {

function callTransform(_content) {
var shebang = "";
if (_content[0] == '#') {
var lines = _content.split('\n');
shebang = lines[0];
_content = lines.slice(1).join('\n');
}
var data = "";

@@ -74,2 +83,4 @@ var transform = transforms[i];

i = i + 1;
if (shebang) data = shebang+'\n'+data;
callTransform(data);

@@ -76,0 +87,0 @@ }

2

package.json
{
"name": "browserify-rfr",
"version": "1.0.0",
"version": "1.0.1",
"homepage": "https://github.com/SamyPesse/browserify-rfr",

@@ -5,0 +5,0 @@ "description": "Require From project Root tool for browserify",

@@ -8,4 +8,5 @@ var expect = require('chai').expect;

describe('browserify-rfr', function() {
var fixtures = path.resolve(__dirname, 'fixtures');
it('should correctly replaced "rfr()" calls', function(done) {
var fixtures = path.resolve(__dirname, 'fixtures');
var b = browserify();

@@ -28,3 +29,22 @@

});
it('should correctly handle file starting with shebang', function(done) {
var b = browserify();
b.transform(rfr, {
root: fixtures
})
.add(path.resolve(fixtures, 'shebang.js'));
b.bundle(function(err, data) {
if (err) return done(err);
data = data.toString();
expect(data).to.contain('module.exports = 1;');
expect(data).to.contain('module.exports = require("./../t2");');
done();
});
});
});
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