Browserify's transform function for polymerize
@param  {String} filepath
@param  {Object} [options]
@return {Stream}
968196
function transform(filepath, options) {

  // Normalize options
  options = extend({
    match: /bower_components.*\.html$/
  }, options || {})

  if(!(options.match instanceof RegExp)) {
    options.match  = RegExp.apply(null, Array.isArray(options.match) ? options.match : [options.match])
  }

  // Shim polymer.js
  if(/polymer\/polymer\.js$/.test(filepath)) {
    return fixpolymer();
  }

  // Transform only source that vulcanize can handle
  if(!options.match.test(filepath) || !/\.html$/.test(filepath)) {
    return through();
  }

  // Bufferize and polymerize
  var src = '';
  return through(
    function(chunk) { src += chunk.toString() },
    function() {
      this.queue(polymerize(src, filepath, options))
      this.queue(null)
    }
  );
}
935594
function process (filePath, complete) {
        var filename = path.basename(filePath),
            pathParts = path.dirname(filePath).split(path.sep)

        // we'll get an empty arrary if we overslice
        pathParts = pathParts.slice(transform.by)
        pathParts.push(filename)

        var newPath = pathParts.join(path.sep),
            fileData = files[filePath]

        // don't need the old fileData anymore,
        // since we are re-adding with the new path
        delete files[filePath]
        files[newPath] = fileData

        complete()
      }
1203096
function deleteFile(filePath) {
  return new Promise((resolve, reject) => {
    fs.unlink(filePath, (err) => {
      if (err) {
        reject(err);
        return;
      }
      resolve(filePath);
    });
  });
}
746676
function(filePath, baseURL, System) {
      // Convert file paths to module name by stripping the baseURL and the ".js" extension
      if (System.defaultJSExtensions) {
        filePath = filePath.replace(/\.js$/, '');
      }
      return filePath
        .replace(new RegExp('^' + baseURL.replace('/', '\/')), '');
    }
821262
function bundle(srcFiles, destDir, optionsFn) {
    return gulp.src(srcFiles, {
        read: false
    })
    .pipe(tap(function(file) {
        var options = {};
        if (optionsFn) options = optionsFn(file);
        var fileName = options.fileName || path.basename(file.path);

        if (options.standalone)
            console.log(`Creating ${options.standalone} in ${destDir}/${fileName}`);
        else
            console.log(`Creating ${destDir}/${fileName}`);

        file.contents = browserify(file.path, options)
            .ignore("buffer")
            .ignore("dotenv")
        .bundle()
            .on("error", function (err) {
                console.log(err);
            });
        file.path = path.join(file.base, fileName);
    }))
    .pipe(buffer())
    .pipe(sourcemaps.init({
        loadMaps: true
    }))
    .pipe(uglify({
        preserveComments: function(node, comment) {
            return comment.value.includes("Copyright Arm");
        }
    }))
    .pipe(sourcemaps.write(".", {
        sourceRoot: path.relative(destDir, nodeDir)
    }))
    .pipe(gulp.dest(destDir));
}
741027
function transformFile(from, to, modulesDirectory) {
  var contents = fs.readFileSync(from, 'utf8');

  // modules
  var modules = getModules(contents);
  for (var index in modules) {
    var module = modules[index];
    if (modulesManifest.hasOwnProperty(module)) {
      continue;
    }
    var modulePath = path_util.modulePath(module, node_modules);
    if (modulePath === null) {
      continue;
    }
    var targetPath = path_util.targetPath(modulePath, node_modules, modulesDirectory);
    modulesManifest[module] = path.relative(process.cwd(), targetPath);
    if (!fs.existsSync(targetPath)) {
      transformFile(modulePath, targetPath, modulesDirectory);
    }
    var relativePath = path_util.relativePath(to, targetPath);
    var re = eval('\/require\\\(\[\'\"\]' + module + '\[\'\"\]\\\)\/ig');
    contents = contents.replace(re, 'require(\'' + relativePath + '\')');
  }

  // requires
  var requires = getRequires(contents);
  for (var index in requires) {
    var require = requires[index];
    var requirePath = path_util.requirePath(from, require);
    if (requirePath === null) {
      continue;
    }
    if (requiresManifest.hasOwnProperty(requirePath)) {
      continue;
    } else {
      requiresManifest[requirePath] = true;
    }
    var targetPath = path_util.targetPath(requirePath, node_modules, modulesDirectory);
    if (!fs.existsSync(targetPath)) {
      transformFile(requirePath, targetPath, modulesDirectory);
    }
  }

  var dirname = path.dirname(to);
  fs.mkdirsSync(dirname);
  fs.writeFileSync(to, contents, 'utf8');
}
297743
function (filePath) {
                    var
                        me = this,
                        extName = _path.extname(filePath).toLowerCase(),
                        size,
                        stream;
                    _fs.stat(filePath, function (err, stats) {
                        var mimeType;
                        if (err) {
                            me._response.plain(500,
                                "Unable to access file (" + err + ")");
                            return;
                        }
                        if (stats.isDirectory()) {
                            me._response.plain(200, "Directory.");
                            return;
                        } else if (!stats.isFile()) {
                            me._response.plain(200, "Not a file.");
                            return;
                        }
                        size = stats.size;
                        mimeType = gpf.http.getMimeType(extName);
                        if (me._options.verbose) {
                            console.log("\tMime type  : " + mimeType);
                            console.log("\tFile size  : " + size);
                        }
                        me._response.writeHead(200, {
                            "content-type": mimeType,
                            "content-length": size
                        });
                        stream = _fs.createReadStream(filePath);
                        //stream.on("data", function (chunk) {
                        //    if (!me._response.write(chunk)) {
                        //        stream.pause();
                        //        me._response.once("drain", function () {
                        //            stream.resume();
                        //        });
                        //    }
                        //});
                        stream.on("end", function () {
                            if (me._options.verbose) {
                                console.log("\tEnd      t+: "
                                + ((new Date()) - me._startTimeStamp)
                                + "ms");
                            }
                            me._response.statusCode = 200;
                            me._response.end();
                        });
                        stream.pipe(me._response);
                    });
                }
129496
async function filesInDirectories(dirPaths, options) {
  let files = await Promise.all(makeArray(dirPaths).map(dirPath=>_filesInDirectory(dirPath, options)));
  return flattenDeep(files);
}
682168
function onNextTransform (transform, next) {
      // check if we should handle this filePath
      function shouldProcess (filePath, done) {
        done(!!multimatch(filePath, transform.pattern, transform.opts).length)
      }

      // transform the path
      function process (filePath, complete) {
        var filename = path.basename(filePath),
            pathParts = path.dirname(filePath).split(path.sep)

        // we'll get an empty arrary if we overslice
        pathParts = pathParts.slice(transform.by)
        pathParts.push(filename)

        var newPath = pathParts.join(path.sep),
            fileData = files[filePath]

        // don't need the old fileData anymore,
        // since we are re-adding with the new path
        delete files[filePath]
        files[newPath] = fileData

        complete()
      }

      // we do this for each option as the last may have modified the collection
      async.filter(Object.keys(files), shouldProcess, function (results) {
        async.each(results, process, next)
      })
    }
904592
function normalize(filepath) {

    // resolve to an absolute ppath
    if (!path.isAbsolute || !path.isAbsolute(filepath))
        filepath = path.resolve(path.dirname(module.parent.filename), filepath);

    // tack .json on the end if need be
    if (!/\.json$/.test(filepath))
        filepath = filepath + '.json';

    return filepath;
}
565503
function mpify (node, options) {
  var target = options.target; if ( target === void 0 ) target = 'wechat';
  var imports = options.imports; if ( imports === void 0 ) imports = {};
  var transformAssetUrls = options.transformAssetUrls; if ( transformAssetUrls === void 0 ) transformAssetUrls = {};
  var scopeId = options.scopeId; if ( scopeId === void 0 ) scopeId = '';
  sep = "'" + (LIST_TAIL_SEPS[target]) + "'";
  var preset = presets[target];
  var state = new State({
    rootNode: node,
    target: target,
    preset: preset,
    imports: imports,
    transformAssetUrls: transformAssetUrls,
    scopeId: scopeId
  });
  if (scopeId) {
    addAttr$1(node, 'sc_', ("\"" + scopeId + "\""));
  }
  walk(node, state);
}
999352
function transform({ babel, filename, documentFilename }) {
  if (!filename) {
    throw new Error(
      `You must pass a filename to importMDX(). Please see the mdx.macro documentation`,
    )
  }
  let documentPath = path.join(filename, '..', documentFilename);
  let imports = `import React from 'react'\nimport { MDXTag } from '@mdx-js/tag'\n`

  // In development mode, we want to import the original document so that
  // changes will be picked up and cause a re-build.
  // Note: this relies on files with macros *not* being cached by babel.
  if (process.env.NODE_ENV === "development") {
    imports += `import '${documentPath}'\n`
  }

  let source = fs.readFileSync(documentPath, 'utf8');
  let transformedSource =
    babel.transformSync(
      imports+mdx.sync(source),
      {
        presets: [babelPresetReactApp],
        filename: documentPath,
      },
    ).code

  return writeTempFile(documentPath, transformedSource)
}
632762
function (filepath, options) {
    var content = grunt.file.read(filepath);
    if (isPugTemplate(filepath)) {
      var pug = require('pug');
      options.pug.filename = filepath;
      content = pug.render(content, options.pug);
    }

    // Process files as templates if requested.
    var process = options.process;
    if (typeof process === 'function') {
      content = process(content, filepath);
    } else if (process) {
      if (process === true) {
        process = {};
      }
      content = grunt.template.process(content, process);
    }

    if (Object.keys(options.htmlmin).length) {
      try {
        content = minify(content, options.htmlmin);
      } catch (err) {
        grunt.warn(filepath + '\n' + err);
      }
    }

    // trim leading whitespace
    content = content.replace(/(^\s*)/g, '');

    return escapeContent(content, options.quoteChar, options.indentString, options.templatePathInComment ? filepath : '');
  }
741364
function compileSingleFile (filePath, isDebug, options)
{
    var outputPath = "./" + path.dirname(filePath).replace("assets/scss", "public/css");
    gulpUtil.log(gulpUtil.colors.blue("Sass"), pathHelper.makeRelative(filePath), " -> ", outputPath + "/" + path.basename(filePath).replace(/\.scss$/, ".css"));

    var innerPipe = gulp.src(filePath)
        .pipe(plumber());

    if (isDebug)
    {
        innerPipe = innerPipe
            .pipe(watch(filePath));
    }

    innerPipe = innerPipe
        .pipe(sass({
            errLogToConsole: true,
            includePaths: [
                process.env.PWD
            ]
        }))
        .pipe(autoprefixer({
            browsers: options.browsers,
            cascade: false
        }));

    // if not in debug mode, minify
    if (!isDebug)
    {
        innerPipe = innerPipe.pipe(cssMin({
            processImport: false
        }));
    }

    // write auto prefixer
    return innerPipe
        .pipe(gulp.dest(outputPath));
}
513192
function transpile(src, options) {
	return buble.transform(src, {
		target: { ie: 9 },
		transforms: { modules: false }
	});
}
1122936
function rename(filepath, options) {
	var base = filepath.substr(0, filepath.lastIndexOf('.'));
	return base + (options.extname || '.html');
}
1151685
function parseFile (filePath, fileContent) {
  let config = null
  const extension = path.extname(filePath)

  if (extension === '.yml' || extension === '.yaml') {
    config = yaml.safeLoad(replaceEnvironmentVariables(fileContent))
  } else if (extension === '.js') {
    config = require(path.resolve(filePath)) // eslint-disable-line
  } else if (extension === '.json') {
    config = JSON.parse(replaceEnvironmentVariables(fileContent))
  } else {
    throw new Error(`${extension} is not supported as configuration file`)
  }

  return config
}