lib/index.js
function sourcemapify (browserify, options) {
  options = options || browserify._options || {};

  function write (data) {
    if (options.base) {
      // Determine the relative path
      // from the bundle file's directory to the source file
      let base = path.resolve(process.cwd(), options.base);
      data.sourceFile = path.relative(base, data.file);
    }

    if (options.root) {
      // Prepend the root path to the file path
      data.sourceFile = joinURL(options.root, data.sourceFile);
    }

    // Output normalized URL paths
    data.sourceFile = normalizeSeparators(data.sourceFile);
    this.queue(data);
  }

  // Add our transform stream to Browserify's "debug" pipeline
  // https://github.com/substack/node-browserify#bpipeline
  configurePipeline();
  browserify.on("reset", configurePipeline);

  function configurePipeline () {
    browserify.pipeline.get("debug").push(new Through(write));
  }

  return this;
}
function sourcemapify (browserify, options) {
  options = options || browserify._options || {};

  function write (data) {
    if (options.base) {
      // Determine the relative path
      // from the bundle file's directory to the source file
      let base = path.resolve(process.cwd(), options.base);
      data.sourceFile = path.relative(base, data.file);
    }

    if (options.root) {
      // Prepend the root path to the file path
      data.sourceFile = joinURL(options.root, data.sourceFile);
    }

    // Output normalized URL paths
    data.sourceFile = normalizeSeparators(data.sourceFile);
    this.queue(data);
  }

  // Add our transform stream to Browserify's "debug" pipeline
  // https://github.com/substack/node-browserify#bpipeline
  configurePipeline();
  browserify.on("reset", configurePipeline);

  function configurePipeline () {
    browserify.pipeline.get("debug").push(new Through(write));
  }

  return this;
}
function sourcemapify ( browserify , options ) { options = options || browserify . _options || { } ; function write ( data ) { if ( options . base ) { // Determine the relative path // from the bundle file's directory to the source file let base = path . resolve ( process . cwd ( ) , options . base ) ; data . sourceFile = path . relative ( base , data . file ) ; } if ( options . root ) { // Prepend the root path to the file path data . sourceFile = joinURL ( options . root , data . sourceFile ) ; } // Output normalized URL paths data . sourceFile = normalizeSeparators ( data . sourceFile ) ; this . queue ( data ) ; } // Add our transform stream to Browserify's "debug" pipeline // https://github.com/substack/node-browserify#bpipeline configurePipeline ( ) ; browserify . on ( "reset" , configurePipeline ) ; function configurePipeline ( ) { browserify . pipeline . get ( "debug" ) . push ( new Through ( write ) ) ; } return this ; }
Transforms the browserify sourcemap

@param {object} browserify - The Browserify instance
@param {object} [options] - Plugin options
Transforms the browserify sourcemap