preprocessors/index.js
function preprocessorcery(infile, info, callback) {
  applicable(infile, info, (err, preprocessors) => {
    if (err) return callback(err);

    const q = queue(1);
    preprocessors.forEach((preprocessor) => {
      const outfile = newfile(infile);
      q.defer((next) => {
        preprocessor(infile, outfile, (err) => {
          if (err) return next(err);
          infile = outfile;
          next();
        });
      });
    });

    q.await((err) => {
      if (err) return callback(err);

      // infile has been changed to the output file by this point
      callback(null, infile);
    });
  });
}
function preprocessorcery(infile, info, callback) {
  applicable(infile, info, (err, preprocessors) => {
    if (err) return callback(err);

    const q = queue(1);
    preprocessors.forEach((preprocessor) => {
      const outfile = newfile(infile);
      q.defer((next) => {
        preprocessor(infile, outfile, (err) => {
          if (err) return next(err);
          infile = outfile;
          next();
        });
      });
    });

    q.await((err) => {
      if (err) return callback(err);

      // infile has been changed to the output file by this point
      callback(null, infile);
    });
  });
}
function preprocessorcery ( infile , info , callback ) { applicable ( infile , info , ( err , preprocessors ) => { if ( err ) return callback ( err ) ; const q = queue ( 1 ) ; preprocessors . forEach ( ( preprocessor ) => { const outfile = newfile ( infile ) ; q . defer ( ( next ) => { preprocessor ( infile , outfile , ( err ) => { if ( err ) return next ( err ) ; infile = outfile ; next ( ) ; } ) ; } ) ; } ) ; q . await ( ( err ) => { if ( err ) return callback ( err ) ; // infile has been changed to the output file by this point callback ( null , infile ) ; } ) ; } ) ; }
Finds applicable preprocessors and runs each `info` is expected to be an fs.Stat object + .filetype determined by mapbox-file-sniff callback returns the post-preprocessed filepath
Finds applicable preprocessors and runs each info is expected to be an fs . Stat object + . filetype determined by mapbox - file - sniff callback returns the post - preprocessed filepath