The actual rebundle process
779254
function () {
    var start = Date.now();
    bundler.bundle()
      .on('error', gutil.log)
      .pipe(source(options.name))
      .pipe(gulpif(options.uglify, streamify(uglify())))
      .pipe(gulp.dest(options.dest))
      .pipe(notify(function () {

        // Fix for requirejs
        var fs = require('fs');
        var file = fs.readFileSync(options.dest + '/' + options.name).toString();
        file = file.replace('define([],e)', 'define(["react"],e)');
        fs.writeFileSync(options.dest + '/' + options.name, file);

        console.log('Built in ' + (Date.now() - start) + 'ms');

      }));

  }
680033
public function processBundles()
    {
        $loader = $this->getLoader();
        $view = $this->ensureView($this->owner);

        foreach (array_keys($view->assetBundles) as $name) {
            $loader->registerAssetBundle($name);
        }
    }
1373635
public function registerBundles()
    {
        //==============================================================================
        // SYMFONY CORE
        $bundles[] = new Symfony\Bundle\FrameworkBundle\FrameworkBundle();
        $bundles[] = new Symfony\Bundle\SecurityBundle\SecurityBundle();
        $bundles[] = new Symfony\Bundle\TwigBundle\TwigBundle();
        $bundles[] = new Symfony\Bundle\MonologBundle\MonologBundle();

        //==============================================================================
        // DOCTRINE CORE
        $bundles[] = new Doctrine\Bundle\DoctrineBundle\DoctrineBundle();

        //==============================================================================
        // SPLASH PHP BUNDLE
        $bundles[] = new Splash\Bundle\SplashBundle();

        //==============================================================================
        // SPLASH CONNECTORS BUNDLE
        $bundles[] = new Splash\Connectors\Faker\FakerBundle();

        //==============================================================================
        // TEST & DEV BUNDLES
        if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();

            if ('dev' === $this->getEnvironment()) {
                $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            }

            if (('dev' === $this->getEnvironment()) && class_exists('\\Symfony\\Bundle\\WebServerBundle\\WebServerBundle')) {
                $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
            }
        }

        return $bundles;
    }
769181
function reduceBundles(bundles, dependencies, maxBundles) {
    while (anyMainExceedsMaxBundles(bundles, maxBundles)) {
        var merge = findLeastCostMerge(bundles, dependencies, maxBundles);
        mergeBundles(merge.bundle1Name, merge.bundle2Name, bundles);
    }
    return bundles;
}
896692
@Override
	public synchronized void rebuildDirtyBundles() {

		if (LOGGER.isDebugEnabled()) {
			LOGGER.debug("Rebuild dirty bundles");
		}

		StopWatch stopWatch = new StopWatch();
		ThreadLocalJawrContext.setStopWatch(stopWatch);

		// Initialize the Thread local for the Jawr context
		ThreadLocalJawrContext.setJawrConfigMgrObjectName(JmxUtils.getMBeanObjectName(servletContext, resourceType,
				jawrConfig.getProperty(JawrConstant.JAWR_JMX_MBEAN_PREFIX)));

		try {
			if (bundlesHandler != null) {
				bundlesHandler.rebuildModifiedBundles();
			}

			if (LOGGER.isDebugEnabled()) {
				LOGGER.debug("Jawr configuration successfully reloaded. ");
			}
			if (PERF_PROCESSING_LOGGER.isDebugEnabled()) {
				PERF_PROCESSING_LOGGER.debug(stopWatch.prettyPrint());
			}

		} catch (InterruptBundlingProcessException e) {
			if (LOGGER.isInfoEnabled()) {
				LOGGER.info("Bundling processed stopped");
			}
		} catch (Exception e) {
			throw new BundlingProcessException("Error while rebuilding dirty bundles : " + e.getMessage(), e);

		} finally {

			// Reset the Thread local for the Jawr context
			ThreadLocalJawrContext.reset();
		}
	}
618519
private function UpdateBundleVersions()
    {
        $this->ClearInstalledBundles();
        $bundles = PathUtil::Bundles();
        foreach ($bundles as $bundle)
        {
            if (!array_key_exists($bundle, $this->failedBundles))
            {
                $this->UpdateBundleVersion($bundle);
            }    
        }
    }
323328
def _bse_cli_create_bundle(args):
    ''''''
    bundle.create_bundle(args.bundle_file, args.fmt, args.reffmt, args.archive_type, args.data_dir)
    return "Created " + args.bundle_file
681717
protected function process()
    {

        // add the SKU => entity ID/store view code mapping
        $this->addSkuEntityIdMapping($sku = $this->getValue(ColumnKeys::SKU));
        $this->addSkuStoreViewCodeMapping($sku, $this->getSubject()->getStoreViewCode(StoreViewCodes::ADMIN));

        // clean-up the repositories etc. to free memory
        $this->getProductBunchProcessor()->cleanUp();

        // temporary persist the SKU
        $this->setLastSku($sku);
    }
862132
@RequirePOST
    public void doDownload(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException {
        doGenerateAllBundles(req, rsp);
    }
487113
public function initializeBundles()
    {
        $config = $this->getContainer()->singleton('kernel.config');
        $routing = $this->getContainer()->singleton('kernel.routing');

        $this->bundles = $this->registerBundles();

        foreach ($this->bundles as $bundle) {
            $bundle->setContainer($this->getContainer());
            $bundle->registerRouting($routing, $this->getEnvironment());
            $bundle->registerConfiguration($config, $this->getEnvironment());
        }

        unset($config, $routing);
    }
1323662
@Override
	public void processBundles(GlobalPostProcessingContext ctx, List<JoinableResourceBundle> bundles) {

		if (ctx.hasBundleToBeProcessed()) {
			String workingDir = ctx.getRsReaderHandler().getWorkingDirectory();

			if (srcDir == null || destDir == null || tempDir == null || srcZipDir == null || destZipDir == null) {
				srcDir = ctx.getBundleHandler().getBundleTextDirPath();
				srcZipDir = ctx.getBundleHandler().getBundleZipDirPath();
				destDir = workingDir + GOOGLE_CLOSURE_RESULT_TEXT_DIR;
				destZipDir = workingDir + GOOGLE_CLOSURE_RESULT_ZIP_DIR;
				tempDir = workingDir + GOOGLE_CLOSURE_TEMP_DIR;
			}

			// Create result directory
			File dir = new File(destDir);
			if (!dir.exists() && !dir.mkdirs()) {
				throw new BundlingProcessException("Impossible to create temporary directory :" + destDir);
			}

			// Create result directory
			dir = new File(destZipDir);
			if (!dir.exists() && !dir.mkdirs()) {
				throw new BundlingProcessException("Impossible to create temporary directory :" + destZipDir);
			}

			// Create temporary directory
			dir = new File(tempDir);
			if (!dir.exists() && !dir.mkdirs()) {
				throw new BundlingProcessException("Impossible to create temporary directory :" + tempDir);
			}

			// Copy the bundle files in a temp directory
			try {
				FileUtils.copyDirectory(new File(srcDir), new File(tempDir));

				Map<String, String> resultBundleMapping = new HashMap<>();
				JawrClosureCommandLineRunner cmdRunner = new JawrClosureCommandLineRunner(ctx, bundles,
						resultBundleMapping);
				cmdRunner.doRun();
				// Copy compiled bundles
				FileUtils.copyDirectory(new File(destDir), new File(srcDir));

				// Copy zipped compiled bundles
				FileUtils.copyDirectory(new File(destZipDir), new File(srcZipDir));

			} catch (Exception e) {

				throw new BundlingProcessException(e);
			}
		}
	}
1072474
function bundler(loader, options, modules) {
  var stack    = modules.slice(0);
  var mods     = [];
  var finished = {};

  function processModule(mod) {
    if (finished.hasOwnProperty(mod.id)) {
      return;
    }

    mod = loader.getModule(mod.id);

    // browser pack chunk
    var browserpack = {
      id     : mod.id,
      source : mod.source,
      deps   : {}
    };

    // Gather up all dependencies
    var i, length, dep;
    for (i = 0, length = mod.deps.length; i < length; i++) {
      dep = mod.deps[i];
      stack.push(dep);
      browserpack.deps[dep.id] = dep.id;
    }

    finished[mod.id] = browserpack;
    mods.unshift(browserpack);
  }

  // Process all modules
  while (stack.length) {
    processModule(stack.pop());
  }

  var stream = browserPack(options).setEncoding("utf8");
  var promise = pstream(stream);

  stream.end(JSON.stringify(mods));
  return promise;
}
683982
function (cb) {
    this.reset();
    var bundle = this.bundle;
    var self = this;
    async.waterfall([
      function (wfCb) {
        if (self.noclean) {
          wfCb();
        } else {
          // Remove the output directory if it exists
          existsCompat(self.outputTo, function (exists) {
            if (exists) {
              if (self.verbose) {
                console.log('compileAssets: removing output directory: ' + self.outputTo);
              }
              rimraf(self.outputTo, wfCb);
            } else {
              wfCb();
            }
          });
        }
      },
      function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting asset discovery phase.');
        }
        executePhase(self.phases.discovery, bundle, wfCb);
      },
      function (b, wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting compilation phase.');
        }
        try {
          // Get the correct order of asset dependencies
          var orderedAssets = bundle.getProcessingOrder().map(function (assetFilePath) {
            return bundle.getAsset(assetFilePath);
          });
          async.eachSeries(orderedAssets, function (asset, eachCb) {
            setImmediateCompat(function() {
              executePhase(self.phases.compilation, asset, eachCb);
            });
          }, wfCb);
        }
        catch (e) {
          wfCb(e);
        }
      }, function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting post-compilation phase.');
        }
        async.eachLimit(bundle.getAllAssets(), 50, function (asset, eachCb) {
          executePhase(self.phases.postCompilation, asset, eachCb);
        }, wfCb);
      }, function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting output phase.');
        }
        async.eachLimit(bundle.getAllAssets(), 50, function (asset, eachCb) {
          executePhase(self.phases.output, asset, eachCb);
        }, wfCb);
      }
    ], cb);
  }
416706
function bundle(location, opts, callback) {
    var b
    if (opts.watchify) {
        b = getFromCache(location, opts);
    } else {
        b = getBundle(location, opts)
    }

    b.bundle(function onPayload(err, payload) {
        if (err) {
            return callback(err);
        }

        payload = embedNodeEnv() + payload;

        callback(null, payload);
    });
}
254145
protected function processInstall()
    {
        $result = $this->install->process($this->getSubmitted());
        $this->redirect($result['redirect'], $result['message'], $result['severity']);
    }
765351
function createUnpackedBundle() {
  fs.mkdirp(unpackedDir, err => {
    if (err && err.code !== 'EEXIST') {
      console.log(err);
      throw err;
    }

    let unpackedFile = path.join(__dirname, 'unpacked.js');
    let b = browserify(unpackedFile).bundle();
    b.on('error', console.error);
    let unpackedBundleFile = path.join(unpackedDir, 'unpacked-bundle.js');
    const bundleFileStream = fs.createWriteStream(unpackedBundleFile);
    bundleFileStream.on('finish', () => {
      console.log('Wrote bundled JS into ' + unpackedBundleFile);
    });
    bundleFileStream.on('pipe', () => {
      console.log('Writing bundled JS...');
    });
    bundleFileStream.on('error', console.error);
    b.pipe(bundleFileStream);
    // bundleFileStream.end();  // do not do this prematurely!
  });
}
859913
function writeBundles(done) {
		debug('writeBundles()');
		async.forEachSeries(incBundles, function(packet, next) {
			packet.write(options, next);
		}, done);
	}