Sha256: fdd075019e9ba67f4c310aa31cc0e4dcac241af95a30f7ce70315651da34b708

Contents?: true

Size: 902 Bytes

Versions: 7

Compression:

Stored size: 902 Bytes

Contents

var browserify = require('../');
var vm = require('vm');
var through = require('through2');
var test = require('tap').test;

var fs = require('fs');
var sources = {
    1: fs.readFileSync(__dirname + '/entry/main.js', 'utf8'),
    2: fs.readFileSync(__dirname + '/entry/one.js', 'utf8'),
    3: fs.readFileSync(__dirname + '/entry/two.js', 'utf8')
};

var deps = {
    1: { './two': 3, './one': 2 },
    2: {},
    3: {}
};

test('custom packer', function (t) {
    t.plan(7);
    
    var b = browserify(__dirname + '/entry/main.js');
    b.pipeline.get('pack').splice(0,1, through.obj(function (row, enc, next) {
        t.equal(sources[row.id], row.source);
        t.deepEqual(deps[row.id], row.deps);
        this.push(row.id + '\n');
        next();
    }));
    b.pipeline.get('wrap').splice(0);
    b.bundle(function (err, src) {
        t.equal(src.toString('utf8'), '1\n2\n3\n');
    });
});

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
minimum_viable_product-0.0.11 test/dummy/node_modules/browserify/test/pack.js
brwy_rails-0.0.6 test/dummy/node_modules/browserify/test/pack.js
brwy_rails-0.0.5 test/dummy/node_modules/browserify/test/pack.js
brwy_rails-0.0.4 test/dummy/node_modules/browserify/test/pack.js
brwy_rails-0.0.3 test/dummy/node_modules/browserify/test/pack.js
brwy_rails-0.0.2 test/dummy/node_modules/browserify/test/pack.js
brwy_rails-0.0.1 test/dummy/node_modules/browserify/test/pack.js