module-deps
Advanced tools
Comparing version 0.3.0 to 0.4.0
37
index.js
@@ -124,4 +124,3 @@ var fs = require('fs'); | ||
function makeTransform (file, tr) { | ||
if (/\s/.test(tr)) return cmdTransform(file, tr); | ||
if (typeof tr === 'function') return tr(file); | ||
var tout = through(), tin = through(); | ||
@@ -133,6 +132,7 @@ tin.pause(); | ||
if (err) return output.emit('error', err); | ||
var t = res | ||
? require(res)(file) | ||
: cmdTransform(file, tr) | ||
; | ||
if (!res) return output.emit('error', [ | ||
'cannot find transform module ', tr, | ||
' while transforming ', file | ||
].join('')); | ||
var t = require(res)(file); | ||
t.pipe(tout); | ||
@@ -144,27 +144,2 @@ tin.pipe(t); | ||
} | ||
function cmdTransform (file, tr) { | ||
var cmd = parseShell(tr); | ||
var env = Object.create(process.env); | ||
env._ = tr; | ||
env.FILENAME = file; | ||
var current = { id: file, filename: file, paths: [] }; | ||
var ps = spawn(cmd[0], cmd.slice(1), { | ||
cwd: path.dirname(file), | ||
env: env | ||
}); | ||
var error = ''; | ||
ps.stderr.on('data', function (buf) { error += buf }); | ||
ps.on('close', function (code) { | ||
if (code !== 0) { | ||
return output.emit('error', [ | ||
'process ' + tr + ' exited with code ' + code, | ||
' while parsing ' + file + '\n', | ||
error.split('\n').join('\n ') | ||
].join('')); | ||
} | ||
}); | ||
return duplexer(ps.stdin, ps.stdout); | ||
} | ||
}; |
{ | ||
"name": "module-deps", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "walk the dependency graph to generate json output that can be fed into browser-pack", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
{ | ||
"main": "index.js", | ||
"browserify": { | ||
"transform": "sed s/GGG/111/g" | ||
"transform": "./tr_g.js" | ||
} | ||
} |
@@ -9,3 +9,3 @@ var mdeps = require('../'); | ||
var p = mdeps(__dirname + '/files/tr_sh/main.js', { | ||
transform: [ 'sed s/AAA/5/', 'sed s/BBB/50/' ], | ||
transform: [ './tr_a.js', './tr_b.js' ], | ||
transformKey: [ 'browserify', 'transform' ] | ||
@@ -12,0 +12,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
17028
36
327
3
129