The browserify pipeline

This documentation is based on browserify v10.1.x. This is very much a work in progress.

Introduction

The basic premise of the browserify pipeline is that objects (call them row or rec) with certain properties are pushed or written to the beginning ("top") or middle and bundles come out the end ("bottom").

There are 2 types of rows: those representing files to include in the bundle, and those representing transforms. This document will focus on file rows.

Pushing rows

So how do you push rows to the browserify pipeline? There are several ways listed below (b is a browserify instance, row is an object). This list is meant to be illustrative, not exhaustive. See the documentation for these methods for more information.

Row properties

What are the properties of rows? The best way to explain this is the table below that documents what properties are relevant to what phases of the pipeline and how.

Definitions

Terms used in this document:

b
The browserify instance.
opts
Options passed to the constructor when creating b.
basedir
The contextually relevant basedir value.
prePipeline
The methods browserify()|b.add()|b.require().
args
Refers to the arguments to the relevant prePipeline function. For example, in the context of b.require(file, opts), args.file and args.opts refer to the arguments.
filePath|filePaths
Strings or arrays of such strings indicating files to push to the pipeline.
fileObj|fileObjs
An object or array of such objects indicating files to push to the pipeline.
rootFile|rootFiles
filePath|filePaths|fileObj|fileObjs passed to prePipeline.
row
An object pushed to the pipeline.
inRow
Refers to the row that enters the phase.
outRow
Refers to the row that exits the phase

inRow|outRow may or may not be the same object, but these names will be used to distinguish whether the value of a property refers to the value it had coming in or the value it has going out. For example, "the same value as outRow.file" means the value the file property has in the row coming out of the phase.

Pipeline Phases