Permalink
Browse files

Allow configuring transformKey option for module-deps

1 parent c3a4424 commit bf061d8d8cd7769c3a74ef4569d7adda60ef3f4f @laurynasl-wix laurynasl-wix committed Jan 2, 2017
View
@@ -434,7 +434,7 @@ Browserify.prototype._createDeps = function (opts) {
self._extensions = mopts.extensions;
mopts.transform = [];
- mopts.transformKey = [ 'browserify', 'transform' ];
+ mopts.transformKey = defined(opts.transformKey, [ 'browserify', 'transform' ]);
mopts.postFilter = function (id, file, pkg) {
if (opts.postFilter && !opts.postFilter(id, file, pkg)) return false;
if (self._external.indexOf(file) >= 0) return false;
@@ -0,0 +1,17 @@
+var browserify = require('../');
+var test = require('tap').test;
+var vm = require('vm');
+
+test('ignore transform', function(t) {
+ t.plan(1);
+
+ var b = browserify({
+ transformKey: false
+ });
+ b.add(__dirname + '/ignore_transform_key/main.js');
+
+ b.bundle(function(err, src) {
+ if (err) t.fail(err);
+ vm.runInNewContext(src, {t: t});
+ });
+});
@@ -0,0 +1,3 @@
+var a = require('a');
+
+t.equal(a, 'good');
@@ -0,0 +1 @@
+module.exports = 'good';
@@ -0,0 +1,10 @@
+{
+ "name": "a",
+ "version": "1.0.0",
+ "private": true,
+ "browserify": {
+ "transform": [
+ "evil-transform"
+ ]
+ }
+}
@@ -0,0 +1,12 @@
+const through2 = require('through2');
+
+module.exports = function() {
+
+ return through2.obj(function(row, enc, next) {
+ return next();
+ },
+ function(next) {
+ next(null, "module.exports = 'evil';");
+ }
+ )
+};
@@ -0,0 +1,5 @@
+{
+ "name": "evil-transform",
+ "version": "1.0.0",
+ "private": true
+}

0 comments on commit bf061d8

Please sign in to comment.