browserify-rfr
Advanced tools
| #! /usr/bin/env node | ||
| require('rfr').setRoot(__dirname); | ||
| module.exports = rfr('t1/test'); |
+11
-0
@@ -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 @@ } |
+1
-1
| { | ||
| "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", |
+21
-1
@@ -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(); | ||
| }); | ||
| }); | ||
| }); | ||
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
6158
18.04%10
11.11%123
25.51%