Create bundle default sources under /src

@param {string} bundle
@param {object} project
517454
function() {
        var conf = self.conf
        var src = self.root +'/'+ conf.src;
        var sample = new _(GINA_PATH +'/template/samples/bundle/');
        var target = _(src);
        sample.cp(target, function done(err) {
            if (err) {
                rollback(err)
            }
            // Browse, parse and replace keys
            self.source = _(target);
            browse(self.source)
        })
    }
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
933731
function createBundle(skyPagesConfig, webpack) {
  const webpackConfig = require('../config/webpack/build-public-library.webpack.config');
  const config = webpackConfig.getWebpackConfig(skyPagesConfig);
  return runCompiler(webpack, config);
}
1128305
function makeBundleJS(psModule) {
  const bundleOutput = psModule.options.bundleOutput;

  const name = psModule.name;

  const srcDir = psModule.srcDir;

  const escaped = jsStringEscape(path.relative(srcDir, bundleOutput));

  const result = `module.exports = require("${escaped}")["${name}"]`;

  return Promise.resolve(result);
}
807413
function bundleApp(codeList, ns, domload, compile, before, npmTree, o) {
  var l = []
    , usedBuiltIns = npmTree._builtIns
    , len = 0;
  delete npmTree._builtIns;

  // 1. construct the global namespace object
  l.push("window." + ns + " = {data:{}, path:{}};");

  // 2. attach path code to the namespace object so that require.js can efficiently resolve paths
  l.push('\n// include npm::path');
  var pathCode = read(join(builtInDir, 'path.posix.js'));
  l.push('(function (exports) {\n ' + pathCode + '\n}(window.' + ns + '.path));');

  // 3. pull in serialized data
  Object.keys(o.data).forEach(function (name) {
    return l.push(ns + ".data." + name + " = " + o.data[name] + ";");
  });

  // 4. attach require code
  var config = {
    namespace : ns
  , domains   : Object.keys(o.domains) // TODO: remove npm from here
  , arbiters  : o.arbiters
  , logging   : o.logLevel
  , npmTree   : npmTree
  , builtIns  : builtIns
  , slash     : '/' //TODO: figure out if different types can coexist, if so, determine in resolver, and on client
  };

  l.push(anonWrap(read(join(dir, 'require.js'))
    .replace(/VERSION/, JSON.parse(read(join(dir, '..', 'package.json'))).version)
    .replace(/REQUIRECONFIG/, JSON.stringify(config))
  ));

  // 5. include CommonJS compatible code in the order they have to be defined
  var defineWrap = function (exportName, domain, code) {
    return ns + ".define('" + exportName + "','" + domain + "',function (require, module, exports) {\n" + code + "\n});";
  };

  // 6. harvest function splits code into app and non-app code and defineWraps
  var harvest = function (onlyMain) {
    codeList.forEach(function (pair) {
      var dom = pair[0]
        , file = pair[1]
        , basename = file.split('.')[0];
      if ((dom === 'app') !== onlyMain) {
        return;
      }
      var code = before(compile(join(o.domains[dom], file)));
      l.push(defineWrap(basename, dom, code));
    });
  };

  // 7.a) include required builtIns
  l.push("\n// node builtins\n");
  len = l.length;
  usedBuiltIns.forEach(function (b) {
    if (b === 'path') { // already included
      return;
    }
    l.push(defineWrap(b, 'npm', read(join(builtInDir, b + '.js'))));
  });
  if (l.length === len) {
    l.pop();
  }

  // 7.b) include modules not on the app domain
  l.push("\n// shared code\n");
  len = l.length;
  harvest(false);
  if (l.length === len) {
    l.pop();
  }

  // 7.c) include modules on the app domain, and wait for domloader if set
  l.push("\n// app code - safety wrapped\n\n");
  domload(harvest(true));

  // 8. use a closure to encapsulate the private internal data and APIs
  return anonWrap(l.join('\n'));
}
767858
function makeBundle(assetsToBundle, incomingType) {
      if (assetsToBundle.length === 0) {
        throw new Error('makeBundle: Bundle must contain at least one asset');
      } else if (assetsToBundle.length === 1) {
        // Shortcut
        return [assetsToBundle[0]];
      }

      const type = assetsToBundle[0].type;

      let parseTree;
      if (type === 'JavaScript') {
        parseTree = combineJavaScriptAsts(
          assetsToBundle.map(asset => asset.parseTree)
        );
      } else {
        // type === 'Css'
        parseTree = postcss.parse('');
        // Make sure that all @import rules go at the top of the bundle:
        const importRules = [];
        for (const asset of assetsToBundle) {
          const topLevelNodes = asset.parseTree.nodes;
          for (let i = 0; i < topLevelNodes.length; i += 1) {
            const topLevelNode = topLevelNodes[i];
            topLevelNode.parent = parseTree;
            if (
              topLevelNode.type === 'atrule' &&
              topLevelNode.name === 'import'
            ) {
              importRules.push(topLevelNode);
              topLevelNodes.splice(i, 1);
              i -= 1;
            }
          }
          parseTree.nodes.push(...topLevelNodes);
        }
        if (importRules.length > 0) {
          parseTree.nodes.unshift(...importRules);
        }
      }

      const bundleAsset = assetGraph.addAsset({
        type,
        parseTree,
        baseName: 'bundle',
        outgoingRelations: assetGraph.findRelations({
          from: { id: { $in: assetsToBundle.map(asset => asset.id) } }
        }),
        lastKnownByteLength: assetsToBundle.reduce(
          (sumOfLastKnownByteLengths, asset) => {
            return sumOfLastKnownByteLengths + asset.lastKnownByteLength;
          },
          0
        ),
        _toBeMinified: assetsToBundle.every(asset => asset._toBeMinified),
        isPretty: assetsToBundle.every(asset => asset.isPretty)
      });

      const seenReferringAssets = new Set();
      const incomingRelations = assetGraph.findRelations({
        type: incomingType,
        to: { id: { $in: assetsToBundle.map(asset => asset.id) } }
      });

      // Point at the bundled asset with a root-relative href if at least one of the relations
      // being bundled have a more specific hrefType than 'relative':
      const bundleRelationHrefType = incomingRelations.some(
        incomingRelation =>
          !['relative', 'inline'].includes(incomingRelation.hrefType)
      )
        ? 'rootRelative'
        : 'relative';

      const combinedAssetGraphConditions = {};
      // Reverse iteration for HtmlScript relations to ensure bundle insertion at tail end
      for (const incomingRelation of incomingType === 'HtmlScript'
        ? incomingRelations.slice().reverse()
        : incomingRelations) {
        if (!seenReferringAssets.has(incomingRelation.from)) {
          const bundleRelation = incomingRelation.from.addRelation(
            {
              type: incomingType,
              hrefType: bundleRelationHrefType,
              media: incomingRelation.media, // Only used for HtmlStyle
              async: incomingRelation.async, // Only used for HtmlScript
              defer: incomingRelation.defer, // Only used for HtmlScript
              to: bundleAsset
            },
            'before',
            incomingRelation
          );
          if (incomingRelation.from.type === 'Html') {
            let commonNonce;
            let nonceIsUnique = true;
            for (const relation of incomingRelations) {
              if (relation.from === incomingRelation.from) {
                if (relation.node.hasAttribute('nonce')) {
                  const nonce = relation.node.getAttribute('nonce');
                  if (typeof commonNonce === 'undefined') {
                    commonNonce = nonce;
                  } else if (commonNonce !== nonce) {
                    nonceIsUnique = false;
                  }
                }
              }
              const conditions = assetGraphConditions.parse(relation.node);
              if (conditions) {
                for (const conditionName of Object.keys(conditions)) {
                  if (
                    Array.isArray(combinedAssetGraphConditions[conditionName])
                  ) {
                    combinedAssetGraphConditions[conditionName].push(
                      conditions[conditionName]
                    );
                  } else {
                    combinedAssetGraphConditions[conditionName] = [
                      conditions[conditionName]
                    ];
                  }
                }
              }
            }
            if (typeof commonNonce !== 'undefined' && nonceIsUnique) {
              bundleRelation.node.setAttribute('nonce', commonNonce);
              bundleRelation.from.markDirty();
            }
            const conditionNames = Object.keys(combinedAssetGraphConditions);
            if (conditionNames.length > 0) {
              for (const conditionName of conditionNames) {
                const uniqueValues = _.uniq(
                  combinedAssetGraphConditions[conditionName]
                );
                if (uniqueValues.length === 1) {
                  combinedAssetGraphConditions[conditionName] = uniqueValues[0];
                } else {
                  combinedAssetGraphConditions[conditionName] = uniqueValues;
                }
              }
              bundleRelation.node.setAttribute(
                'data-assetgraph-conditions',
                assetGraphConditions.stringify(combinedAssetGraphConditions)
              );
            }
          }
          seenReferringAssets.add(incomingRelation.from);
        }
        incomingRelation.detach();
      }

      for (const outgoingRelation of assetGraph.findRelations({
        from: bundleAsset
      })) {
        outgoingRelation.refreshHref();
      }

      for (const asset of assetsToBundle) {
        if (
          assetGraph.findRelations({
            to: asset,
            type: { $not: 'SourceMapFile' }
          }).length === 0
        ) {
          for (const sourceMapFileRelation of assetGraph.findRelations({
            to: asset,
            type: 'SourceMapFile'
          })) {
            sourceMapFileRelation.remove();
          }
          assetGraph.removeAsset(asset);
        }
      }
      return bundleAsset;
    }
1081966
public void installBundles(final BundleContext bContext,
                               final BundleList bundleList,
                               final BundleInstallStatus installStatus,
                               final int minStartLevel, final int defaultStartLevel,
                               final int defaultInitialStartLevel,
                               final WsLocationAdmin locSvc) {

        if (bundleList == null || bundleList.isEmpty())
            return;
        final FrameworkWiring fwkWiring = featureManager.bundleContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class);
        final File bootFile = getBootJar();
        bundleList.foreach(new BundleList.FeatureResourceHandler() {
            @Override
            @FFDCIgnore({ IllegalStateException.class, Exception.class })
            public boolean handle(FeatureResource fr) {
                Bundle bundle = null;
                WsResource resource = null;
                String urlString = fr.getLocation();

                try {
                    String bundleRepositoryType = fr.getBundleRepositoryType();
                    BundleRepositoryHolder bundleRepositoryHolder = featureManager.getBundleRepositoryHolder(bundleRepositoryType);
                    if (bundleRepositoryHolder == null) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Bundle repository not found for type=" + bundleRepositoryType);
                        }
                        Tr.error(tc, "UPDATE_MISSING_BUNDLE_ERROR", fr.getMatchString());
                        installStatus.addMissingBundle(fr);
                        return true;
                    }
                    // Get the product name for which the bundles are being installed.
                    String productName = bundleRepositoryHolder.getFeatureType();

                    if (libertyBoot) {
                        bundle = installLibertyBootBundle(productName, fr, fwkWiring);
                    } else {
                        bundle = installFeatureBundle(urlString, productName, bundleRepositoryHolder, fr);
                    }
                    if (bundle == null) {
                        return true;
                    }

                    BundleStartLevel bsl = bundle.adapt(BundleStartLevel.class);
                    BundleRevision bRev = bundle.adapt(BundleRevision.class);

                    int level = 0;

                    // For non-fragment bundles set the bundle startLevel then
                    // add to the list of bundles to be started.
                    // The order is important because the bundles are sorted by
                    // start level to preserve the start level ordering during
                    // dynamic feature additions.
                    if ((bRev.getTypes() & BundleRevision.TYPE_FRAGMENT) != BundleRevision.TYPE_FRAGMENT) {

                        level = bsl.getStartLevel();

                        // Set the start level on the bundle to the selected value
                        // if it hasn't been set before
                        if (level == defaultInitialStartLevel) {
                            int sl = fr.getStartLevel();
                            int newLevel = (sl == 0) ? defaultStartLevel : (sl < minStartLevel) ? minStartLevel : sl;
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(this, tc, "Changing the start level of bundle {0} from {1} to the current level of {2}", bundle, level, newLevel);
                            }
                            level = newLevel;
                            bsl.setStartLevel(level);
                        }

                        installStatus.addBundleToStart(bundle);
                    }

                    // need to get a resource for the bundle list createAssociation
                    // call, if we end up with a null resource then bad things
                    // happen, like we fail to uninstall bundles when we should
                    File bundleFile = getBundleFile(bundle);
                    resource = locSvc.asResource(bundleFile, bundleFile.isFile());

                    // Update bundle list with resolved information
                    bundleList.createAssociation(fr, bundle, resource, level);
                } catch (IllegalStateException e) {
                    // The framework is stopping: this is an expected but not ideal occurrence.
                    installStatus.markContextInvalid(e);
                    return false;
                } catch (Exception e) {
                    // We encountered an error installing a bundle, add it to
                    // the status, and continue. The caller will handle as appropriate
                    installStatus.addInstallException("INSTALL " + urlString + " (resolved from: " + fr + ")", e);
                }
                return true;
            }

            private File getBundleFile(Bundle bundle) {
                if (libertyBoot) {
                    return bootFile;
                }
                // make sure we have a File for the bundle that is already
                // installed. Get this by processing the location. We
                // need to get past the reference:file: part of the URL.
                String location = bundle.getLocation();
                int index = location.indexOf(BUNDLE_LOC_REFERENCE_TAG);
                location = location.substring(index + BUNDLE_LOC_REFERENCE_TAG.length());
                // This file path is URL form, convert it back to a valid system File path
                return new File(URI.create(location));
            }

            private Bundle installLibertyBootBundle(String productName, FeatureResource fr, FrameworkWiring fwkWiring) throws BundleException, IOException {
                //getting the LibertyBootRuntime instance and installing the boot bundle
                LibertyBootRuntime libertyBoot = featureManager.getLibertyBoot();
                if (libertyBoot == null) {
                    throw new IllegalStateException("No LibertBootRuntime service available!");
                }

                Bundle bundle = libertyBoot.installBootBundle(fr.getSymbolicName(), fr.getVersionRange(), BUNDLE_LOC_FEATURE_TAG);
                if (bundle == null) {
                    installStatus.addMissingBundle(fr);
                    return null;
                }

                Region productRegion = getProductRegion(productName);
                Region current = featureManager.getDigraph().getRegion(bundle);
                if (!productRegion.equals(current)) {
                    current.removeBundle(bundle);
                    productRegion.addBundle(bundle);
                }
                return bundle;
            }

            private Bundle installFeatureBundle(String urlString, String productName, BundleRepositoryHolder bundleRepositoryHolder,
                                                FeatureResource fr) throws BundleException, IOException {
                Bundle bundle = fetchInstalledBundle(urlString, productName);
                if (bundle == null) {
                    ContentBasedLocalBundleRepository lbr = bundleRepositoryHolder.getBundleRepository();
                    // Try to find the file, hopefully using the cached path
                    File bundleFile = lbr.selectBundle(urlString, fr.getSymbolicName(), fr.getVersionRange());

                    if (bundleFile == null) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Bundle not matched", lbr, fr);
                        }
                        Tr.error(tc, "UPDATE_MISSING_BUNDLE_ERROR", fr.getMatchString());
                        installStatus.addMissingBundle(fr);
                        return null;
                    }

                    // Get URL from filename
                    URI uri = bundleFile.toURI();
                    urlString = uri.toURL().toString();

                    urlString = PathUtils.normalize(urlString);

                    // Install this bundle as a "reference"-- this means that the
                    // framework will not copy this bundle into it's private cache,
                    // it will run from the actual jar (wherever it is).
                    urlString = BUNDLE_LOC_REFERENCE_TAG + urlString;

                    // Get the bundle location.
                    // The location format being returned must match the format in SchemaBundle and BundleList.
                    String location = getBundleLocation(urlString, productName);

                    Region productRegion = getProductRegion(productName);
                    // Bundle will just be returned if something from this location exists already.
                    bundle = productRegion.installBundleAtLocation(location, new URL(urlString).openStream());
                }
                return bundle;
            }

            private Bundle fetchInstalledBundle(String urlString, String productName) {
                // We install bundles as references so we need to ensure that we add reference: to the file url.
                String location = getBundleLocation(BUNDLE_LOC_REFERENCE_TAG + urlString, productName);
                Bundle b = featureManager.bundleContext.getBundle(location);

                if (b != null && b.getState() == Bundle.UNINSTALLED) {
                    b = null;
                }

                return b;
            }
        });
    }
425864
async function build( inputOpts, outputOpts ) {

  // create a bundle
  const bundle = await rollup.rollup( inputOpts );

  // generate code and a sourcemap
  const { code, map } = await bundle.generate( outputOpts );

  console.log( 'Writing file: ' + outputOpts.file );
  writeFile( outputOpts.file, code );

  console.log( 'Generated bundle: ', bundle.getTimings()[ '# GENERATE' ] );

}
248864
function bundle () {
    var didError = false
    const outStream = fs.createWriteStream(outFile)
    const bStream = w.bundle()

    bStream.on('error', function (err) {
      console.error('[bundle]', String(err))
      didError = true
      outStream.end('console.error(' + JSON.stringify(String(err)) + ')')
    })

    // if we're not splitting vendor files, include them in the bundle
    if (!shouldSplitVendor && vendorFiles.length) {
      multistream(vendorFiles.map(createReadStream).concat(bStream))
        .pipe(outStream)
    } else {
      bStream.pipe(outStream)
    }

    outStream.on('error', function (err) {
      console.error('[bundle]', err)
    })

    outStream.on('close', function () {
      if (verbose && !didError) {
        // TODO: also display size of vendor files
        console.error(
          '[bundle] %d bytes written to %s (%s seconds)',
          bytes, outFile, (time / 1000).toFixed(2)
        )
      }
    })
  }
20914
function bundler(options) {
        var allFiles = {};
        var bundles = {};
        var dir = options.src;
        var dest = options.dest;
        var resourcesFile = options.resourceJson;
        var indexBundles = options.indexBundles;
        var titleIndexBnudles = {};
        var traversed_bundles = {}, traversed_files = {}, excluded_bundles = {};
        var resourcesJs = {};
        for (var key in options) {
            resourcesJs[key] = options[key];
        }
        resourcesJs.bundles = bundles;

        function getFiles(packageName, files, bundledFile, includedBundles) {
            if (!traversed_bundles[packageName] && !excluded_bundles[packageName]) {
                traversed_bundles[packageName] = true;
                var bundle = resourcesJs.bundles[packageName];
                if (bundle) {
                    bundle.bundled = bundle.bundled || [];
                    bundle.bundled_html = bundle.bundled_html || [];
                    bundle.in = bundle.in || [];
                    for (var i in bundle.on) {
                        files = getFiles(bundle.on[i], files, bundledFile, includedBundles);
                    }
                    for (var j in bundle.js) {
                        var _file2 = cleanURL(dir + "/" + bundle.js[j]);
                        if (!traversed_files[_file2]) {
                            files.js.push(_file2);
                            traversed_files[_file2] = packageName;
                        }
                    }
                    if (files.js.length > 0) {
                        bundle.bundled.push(bundledFile + ".js");
                    }

                    for (var i in bundle.html) {
                        var _file = cleanURL(dir + "/" + bundle.html[i]);
                        if (!traversed_files[_file]) {
                            files.html.push(_file);
                            traversed_files[_file] = packageName;
                        }
                    }
                    if (files.html.length > 0) {
                        bundle.bundled_html.push(bundledFile + ".html");
                    }

                    includedBundles.push(packageName);
                }
            }
            return files;
        }

        if (TASK_BUNDLIFY || TASK_SCAN) {
            grunt.file.recurse(dir, function(abspath, rootdir, subdir, filename) {
                if (filename === "module.json" && abspath.indexOf(dest) !== 0) {
                    var packageInfo = {};
                    if (grunt.file.exists(subdir + "/.bower.json")) {
                        var bowerJson = grunt.file.readJSON(subdir + "/.bower.json");
                        packageInfo.bowerName = bowerJson.name;
                        packageInfo.bowerVersion = bowerJson.version;
                    }
                    if (grunt.file.exists(subdir + "/composer.json")) {
                        var composerJson = grunt.file.readJSON(subdir + "/composer.json");
                        packageInfo.composerName = composerJson.name;
                        packageInfo.composerVersion = composerJson.version;
                    }
                    var _bundles = grunt.file.readJSON(abspath);
                    var packageName = _bundles.name;
                    if (_bundles.exclude) {
                        for (var i in _bundles.exclude) {
                            excluded_bundles[_bundles.exclude[i]] = true;
                        }
                    }
                    if (packageName !== undefined) {
                        titleIndexBnudles[packageName] = [];
                        for (var bundleName in _bundles) {
                            if ((bundleName === packageName || bundleName.indexOf(packageName + "/") === 0) && !excluded_bundles[bundleName]) {
                                if (bundles[bundleName]) {
                                    console.log("====Duplicate Package", bundleName);
                                } else if (!toIgnore(bundleName)) {
                                    titleIndexBnudles[packageName].push(bundleName);
                                }
                                bundles[bundleName] = { js: [], on: [], css: [], html: [], packageInfo: packageInfo};
                                for (var file_i in _bundles[bundleName].js) {
                                    var js_file = subdir + "/" + _bundles[bundleName].js[file_i];
                                    bundles[bundleName].js.push(js_file);
                                    if (!allFiles[js_file]) {
                                        allFiles[js_file] = js_file;
                                    } else {
                                        console.log("====Duplicate File" + js_file);
                                    }
                                }
                                for (var file_j in _bundles[bundleName].css) {
                                    var css_file = subdir + "/" + _bundles[bundleName].css[file_j];
                                    bundles[bundleName].css.push(css_file);
                                    if (!allFiles[css_file]) {
                                        allFiles[css_file] = css_file;
                                    } else {
                                        console.log("====Duplicate File" + css_file);
                                    }
                                }
                                for (var file_k in _bundles[bundleName].html) {
                                    var html_file = subdir + "/" + _bundles[bundleName].html[file_k];
                                    bundles[bundleName].html.push(html_file);
                                    if (!allFiles[html_file]) {
                                        allFiles[html_file] = html_file;
                                    } else {
                                        console.log("====Duplicate File" + html_file);
                                    }
                                }
                                bundles[bundleName].on = _bundles[bundleName].on || [];
                                console.log("╬═╬ Module.json", abspath);
                                //console.log(bundleName, _bundles[bundleName].on);
                            }
                        }
                    }
                }
            });


            var titleIndexBnudlesNames = Object.keys(titleIndexBnudles);

            if (options.modulize) {
                titleIndexBnudlesNames.map(function(bundName) {
                    if (!bundles[bundName] && !toIgnore(bundName)) {
                        bundles[bundName] = { js: [], on: titleIndexBnudles[bundName], css: [], html: [], packageInfo: {}};
                        console.log("New Package ", bundName, bundles[bundName]);
                    }
                });
            }

            for (var packageKey in excluded_bundles) {
                delete bundles[packageKey];
            }

            var firstIndexBundled = null;

            if (!TASK_SKIP_INIT) {
                var myIndexBnudles = indexBundles;
                if (TASK_BUNDLIFY) {

                    var moreBundles = Object.keys(bundles);

                    if (options.sort) {
                        moreBundles = moreBundles.sort();
                    }

                    if (options.projectPrefix !== undefined) {
                        myIndexBnudles = uniqueArray(myIndexBnudles.concat(titleIndexBnudlesNames.concat(moreBundles).filter(function(bundleName) {
                            return bundleName.indexOf(options.projectPrefix) === 0;
                        })));
                    }

                    myIndexBnudles = uniqueArray(myIndexBnudles.concat(titleIndexBnudlesNames.concat(moreBundles))).filter(function(bundleName) {
                        return !toIgnore(bundleName);
                    });

                }
                console.log("Bundles in Order", myIndexBnudles);

                var prevBundle = null;
                myIndexBnudles.forEach(function(bundleName) {
                    var _bundleMap = {};
                    var includedBundles = [];
                    var bundledFile = dest + "/bootloader_bundled/" + bundleName.split("/").join(".");
                    var bundledFile_js = bundledFile + ".js";
                    var files = getFiles(bundleName, {js: [], html: []}, bundledFile, includedBundles);
                    var js_files = uniqueArray(files.js.reverse()).reverse();
                    if (js_files.length > 0) {
                        if (!firstIndexBundled && options.resourcesInline) {
                            firstIndexBundled = bundleName;
                            js_files.unshift(resourcesFile + ".js");
                        }
                        _bundleMap[bundledFile_js] = js_files;
                        //console.log("files",bundleName,files.length,files);
                        setBundleConfig(bundleName, _bundleMap, includedBundles, bundledFile_js);

                        if (prevBundle && options.order) {
                            var bundle = resourcesJs.bundles[bundleName];
                            if (bundle) {
                                bundle.on = [prevBundle].concat(bundle.on);
                            }
                        }
                        prevBundle = bundleName;

                    } else console.log("╬═╬ No File in bundle to bundlify thus skipping ", bundleName);

                    var html_files = uniqueArray(files.html.reverse()).reverse();
                    if (html_files.length) {
                        var html_file_content = "";
                        for (var i in html_files) {
                            html_file_content += '<script type="text/html" src="' + html_files[i] + '">' + grunt.file.read(html_files[i]).split("\t").join("")
                                .split("\n").join(" ")
                                .split(">").map(function(v) {
                                    return v.trim();
                                }).join(">") + '</script>';
                        }
                        grunt.file.write(bundledFile + ".html", html_file_content);
                    }

                });

                resourcesJs.gitinfo = grunt.config().gitinfo;
                if (firstIndexBundled) {
                    var resJsonString = JSON.stringify({
                        RESOURCES_JSON: resourcesJs,
                        RESOURCES_FILE: resourcesFile
                    }).replace(/\r?\n|\r|\\n/g, ' ');

                    var packed = resJsonString;
                    var unpack = "";
                    if(options.jsonpack){
                        var jsonpack = require('jsonpack/main');
                        var fs = require("fs");
                        unpack = grunt.file.read('node_modules/jsonpack/main.js');
                        packed =('(jsonpack.unpack(\''+jsonpack.pack(resJsonString)+'\'))');
                    }

                    grunt.file.write(resourcesFile + ".js", unpack+";var _BOOTLOADER_CONFIG_=" + packed);
                    resourcesJs.bundles[firstIndexBundled].js.unshift(resourcesFile + ".js");
                }

                grunt.task.run("uglify");
            }

            grunt.file.write(resourcesFile, JSON.stringify(resourcesJs));

        }
    }
238547
function bundle (ids = []) {
      ids.forEach((id) => {
        if (!muted.has(id)) {
          console.info(chalk.cyan('change:'), path.relative(process.cwd(), id))
          muted.add(id)
        }
      })

      const exampleName = path.basename(path.dirname(file))
      const output = dstPattern.replace('**', exampleName)
      const parentDir = path.dirname(output)

      mkdirp.sync(parentDir)

      console.info(chalk.grey(`⏳ building: ${path.relative(process.cwd(), file)}`))

      b
        .bundle()
        .on('error', onError)
        .pipe(createStream(output))
        .on('finish', () => {
          console.info(chalk.green(`✓ built: ${path.relative(process.cwd(), file)}`))
        })
    }
451736
function getBundles(buildObj) {
		var _self = self;
		var bundles = (buildObj.bundles || []);
		return bundles.map(function(bundle) {
			bundle = project.replaceProperties(bundle);
			var dir = project.resolveFile(bundle + Packages.java.io.File.separator + "web");
			if (!dir.exists() || !dir.isDirectory()) {
				_self.log("Bundle folder " + dir.getPath() + " does not exist", Project.MSG_WARN);
				return null;
			}
			_self.log("Found bundle web folder: " + dir.getPath());
			return { bundle: bundle,  web: dir };
		}).filter(function(b) {
			return !!b;
		});
	}
530846
function compileBundle(_ref) {
  var customWebConfig = _ref.customWebConfig,
      architecture = _ref.architecture;

  var workingDir = _tmp.default.dirSync().name;

  _winston.default.info('Compiling application bundle'); // Generate Meteor build


  _winston.default.debug('generate meteor build');

  _shelljs.default.exec(`meteor build ${workingDir} --directory --server-only --architecture os.windows.x86_${architecture}`); // Add custom web config


  if (customWebConfig !== undefined) {
    _winston.default.debug('add custom web config');

    try {
      _shelljs.default.cp(customWebConfig, _path.default.join(workingDir, 'bundle', 'web.config'));
    } catch (error) {
      throw new Error(`Could not read web config file at '${customWebConfig}'`);
    }
  } else {
    _winston.default.warn('Using default web config');
  } // Cleanup broken symlinks


  _winston.default.debug('checking for broken symlinks');

  _shelljs.default.find(_path.default.join(workingDir, 'bundle')).forEach(function (symlinkPath) {
    // Matches symlinks that do not exist
    if (_shelljs.default.test('-L', symlinkPath) && !_shelljs.default.test('-e', symlinkPath)) {
      // Delete file
      _shelljs.default.rm('-f', symlinkPath);

      _winston.default.debug(`deleted symlink at '${symlinkPath}'`);
    }
  }); // Create tarball


  _winston.default.debug('create tarball');

  var tarballPath = _path.default.join(workingDir, 'bundle.tar.gz');

  _tar.default.c({
    file: tarballPath,
    sync: true,
    follow: true,
    gzip: true,
    cwd: workingDir
  }, ['bundle']);

  return tarballPath;
}
431143
def new_bundle(name, scriptmap, filemap=None):

    """"""

    #logger.debug('new bundle %s' % name)
    if name in BUNDLEMAP:
        logger.warn('overwriting bundle %s' % name)
    BUNDLEMAP[name] = Bundle(scriptmap, filemap)
846515
function bundleRelease(minify) {
  var bundler = browserify({
    entries: ['./src/' + entryFileName],
    standalone: standaloneName,
    debug: !minify
  });

  if(minify) {
    bundler = bundler.plugin(collapse);
  }

  var stream = bundler.bundle()
    .on('error', logError);

  if(!minify) {
    stream = stream.pipe(exorcist('./dist/' + bundleFileName + '.map'));
  }

  stream = stream.pipe(source(bundleFileName))
    .pipe(buffer())
    .pipe(derequire())
    .pipe(strip());

  if(minify) {
    return stream.pipe(rename({extname: '.min.js'}))
      .pipe(uglify())
      .pipe(gulp.dest('./dist/'));
  } else {
    return stream.pipe(gulp.dest('./dist/'));
  }
}
757564
def bundle
      content = @assets.map(&:content).join("\n")

      hash = JAPR::Pipeline.hash(@source, @manifest, @options)
      @assets = [JAPR::Asset.new(content, "#{@prefix}-#{hash}#{@type}")]
    end
874448
private void startBundle( final Bundle bundle )
        throws BundleException
    {
        // Don't start if bundle already active
        int bundleState = bundle.getState();
        if( bundleState == Bundle.ACTIVE )
        {
            return;
        }

        // Don't start if bundle is a fragment bundle
        Dictionary bundleHeaders = bundle.getHeaders();
        if( bundleHeaders.get( Constants.FRAGMENT_HOST ) != null )
        {
            return;
        }

        // Start bundle
        bundle.start();

        bundleState = bundle.getState();
        if( bundleState != Bundle.ACTIVE )
        {
            long bundleId = bundle.getBundleId();
            String bundleName = bundle.getSymbolicName();
            String bundleStateStr = bundleStateToString( bundleState );
            throw new BundleException(
                "Bundle (" + bundleId + ", " + bundleName + ") not started (still " + bundleStateStr + ")"
            );
        }
    }