Build a bundle dependency graph, such that when a JS bundle is requested, the server can know what other files will be requested once the bundle loads in the client browser.
553198
function buildPushManifest (bundles, manifestFilename) {
      const manifestableBundles = filter(bundles, bundle => bundle.module);

      const bundlesByModuleId = chain(manifestableBundles)
        .map(bundle => [ bundle.module.id, bundle ])
        .fromPairs()
        .value();

      const bundleDepGraph = chain(manifestableBundles)
        .map(bundle => {
          const deepDependencyFilenames = map(bundle.module.deepDependencies,
            dependency => bundlesByModuleId[dependency.id].dest
          );
          return [ bundle.dest, deepDependencyFilenames ];
        })
        .fromPairs()
        .value();

      const output = pushManifestPretty ?
        JSON.stringify(bundleDepGraph, null, 2) :
        JSON.stringify(bundleDepGraph);

      return {
        raw: output,
        dest: manifestFilename
      };
    }
743339
function entries(client, assetType) {

      var _entries = [],
          bundler = getBundler(client),
          includeType,
          bundle;

      switch(assetType) {
        case 'css':
          includeType = 'css';
          bundle = 'css';
          client.paths['css'].forEach(pushMainEntries);
          break;

        case 'js':
        case 'worker':
          var loader = bundler.module('loader');
          var libs = bundler.module('libs');
          var mods = bundler.module.apply(bundler, Object.keys(system.assets.modules));

          _entries = _entries.concat(loader).concat(libs).concat(mods);
          includeType = false;
          bundle = 'js';
          //TODO worker instead of code ?
          client.paths.code.forEach(pushMainEntries);
          if (options.startInBundle) {
            _entries = _entries.concat(bundler.module('start'));
          }
          break;

        case 'tmpl':
          includeType = 'html';
          bundle = 'tmpl';
          client.paths.tmpl.forEach(pushMainEntries);
          break;
      }

      function pushMainEntries(from) {
        var p = path.join(ss.root,from);
        if (!fs.existsSync(p) || fs.statSync(p).isFile()) {
          p = from;
        } else {
          p = path.join(from,'**','*');
        }
        return glob.sync(p, {cwd:ss.root}).forEach(function(file) {
          var extension = path.extname(file);
          extension = extension && extension.substring(1); // argh!
          var assetType = bundle==='tmpl'? 'html':bundle;
          var entry = {file:file,importedBy:from,includeType:includeType,ext:extension,bundle:bundle,assetType:assetType};
          if (isAssetType(entry)) {
            _entries.push(entry);
          }
        });
      }

      function isAssetType(entry) {
        if (ss.client.formatters == null) {
          return false;
        }
        var formatter = ss.client.formatters[entry.ext];
        if (formatter == null) {
          return false;
        }
        if (formatter.assetType === undefined) {
          throw new Error('Unable to render \''+entry.file+'\' as the formatter has no asset type.');
        }
        return formatter.assetType === entry.assetType;
      }

      // entries with blank ones stripped out
      return _entries.filter(function(entry) {
        return !!entry;
      });
    }
221151
function (destPath, srcPaths, options) {
    let stream,
        b,
        finalPaths = [];
    return new Promise(function (resolve, reject) {
        _.each(srcPaths, function (path) {
            // deal with file globs
            if (glob.hasMagic(path)) {
                glob.sync(path).forEach((p) => {
                    p = utils.scopePaths(p);
                    finalPaths.push(p);
                });
            } else {
                path = utils.scopePaths(path);
                finalPaths.push(path);
            }
        });

        // add required parameters for watchify
        options.cache = {};
        options.packageCache = {};

        options.debug = options.watch;

        b = browserify(options);

        b.transform(envify({
            _: 'purge',
            NODE_ENV: options.env
        }), {global: true});

        // must add each path individual unfortunately.
        finalPaths.forEach(function (path) {
            b.add(path);
        });

        options.ignore.forEach((file) => {
            b.ignore(file);
        });
        options.exclude.forEach((file) => {
            b.exclude(file);
        });

        // require global files
        _.each(options.requires, function (path, id) {
            // options.requires can be an array of strings or an object
            id = typeof id == "string" ? id : path;
            b.require(path, {expose: id});
        });

        if (options.watch) {
            b.plugin(watchify);
            // re-bundle when updated
            b.on('update', function () {
                console.log('file updated!');
                b.bundle();
            });
        }


        b.on('bundle', function (stream) {
            console.log('browserifying bundle...');
            writeBrowserifyBundleStreamToFile(stream, destPath)
                .then(function () {
                    console.log('done browserifying bundle!');
                    resolve();
                })
                .catch(function (e) {
                    console.log('browserifying failed');
                    console.log(e);
                    reject(e);
                });
        });

        stream = b.bundle();

    }.bind(this));
}
565133
function bundle() {
  return browserify( config.inputDir + config.inputFile ).bundle()
    .pipe(
      source( config.outputFile )
    )
    .pipe(
      rename( config.outputFile )
    )
    .pipe(
      gulp.dest( config.outputDir ) // Create the .devel.js
    )
    .pipe(
      streamify( jsmin() )
    )
    .pipe(
      rename( config.outputFileMin )
    )
    .pipe(
      gulp.dest( config.outputDir ) // Create the .min.js
    )
    .pipe(
      streamify( gzip() )
    )
    .pipe(
      rename( config.outputFileMinGz )
    )
    .pipe(
      gulp.dest( config.outputDir ) // Create the .min.gz
    );
}
876028
function bundle() {
    return bundler.bundle()
        // log errors if they happen
        .on('error', gutil.log.bind(gutil, 'Browserify Error'))
        .pipe(source('nutella_lib.js'))
        .pipe(gulp.dest('./dist'));
}
1090511
def download_bundle_view(self, request, pk):
        """"""

        return self._download_response(request, pk, bundle=True)
1284426
private void renderBundleDependenciesLinks(String requestedPath, BundleRendererContext ctx, Writer out,
			boolean debugOn, List<JoinableResourceBundle> dependencies) throws IOException {

		if (dependencies != null && !dependencies.isEmpty()) {
			for (JoinableResourceBundle dependencyBundle : dependencies) {
				if (debugOn) {
					addComment("Start adding dependency '" + dependencyBundle.getId() + "'", out);
				}
				renderBundleLinks(dependencyBundle, requestedPath, ctx, out, debugOn, false);
				if (debugOn) {
					addComment("Finished adding dependency '" + dependencyBundle.getId() + "'", out);
				}
			}
		}
	}
261467
function getDependencies(platform, bundleEntry) {
    return packagerServer.getDependencies({
      platform: platform,
      dev: true,
      hot: true,
      entryFile: bundleEntry,
    }).then(response => {
      const {getModuleId} = response;

      // for each dependency builds the object:
      // `{path: '/a/b/c.js', deps: ['modA', 'modB', ...]}`
      return Promise.all(Object.values(response.dependencies).map(dep => {
        return dep.getName().then(depName => {
          if (dep.isAsset() || dep.isAsset_DEPRECATED() || dep.isJSON()) {
            return Promise.resolve({path: dep.path, deps: []});
          }
          return packagerServer.getShallowDependencies({
            platform: platform,
            dev: true,
            hot: true,
            entryFile: dep.path
          })
            .then(deps => {
              return {
                path: dep.path,
                name: depName,
                deps,
              };
            });
        });
      }))
      .then(deps => {
        // list with all the dependencies' filenames the bundle entry has
        const dependenciesCache = response.dependencies.map(dep => dep.path);

        // map from module name to path
        const moduleToFilenameCache = Object.create(null);
        deps.forEach(dep => {
          moduleToFilenameCache[dep.name] = dep.path;
        });

        // map that indicates the shallow dependency each file included on the
        // bundle has
        const shallowDependencies = Object.create(null);
        deps.forEach(dep => {
          shallowDependencies[dep.path] = dep.deps;
        });

        // map from module name to the modules' dependencies the bundle entry
        // has
        const dependenciesModulesCache = Object.create(null);
        response.dependencies.forEach(dep => {
          dependenciesModulesCache[getModuleId(dep)] = dep;
        });


        const inverseDependenciesCache = Object.create(null);
        const inverseDependencies = getInverseDependencies(response);
        for (const [module, dependents] of inverseDependencies) {
          inverseDependenciesCache[getModuleId(module)] =
            Array.from(dependents).map(getModuleId);
        }

        return {
          dependenciesCache,
          dependenciesModulesCache,
          shallowDependencies,
          inverseDependenciesCache,
          resolutionResponse: response,
        };
      });
    });
  }
1024394
function mergeIntoMasterAndAddBundle(opts) {
	var mains = opts.mains;
	var loader = opts.loader;
	var newGraph = opts.newGraph;
	var bundleName = opts.bundleName;
	var masterGraph = opts.masterGraph;

	for(var name in newGraph) {
		var oldNode = masterGraph[name];
		var newNode = newGraph[name];

		if(!oldNode || hasNewDeps(oldNode, newNode)) {
			masterGraph[name] = newGraph[name];
		}
		// If it's a plugin we'll use the new node but need to copy any previous
		// bundles onto the new node
		else if(masterGraph[name] && masterGraph[name].isPlugin) {
			var oldBundle = masterGraph[name].bundles || [];
			masterGraph[name] = newGraph[name];
			oldBundle.forEach(function(bundle){
				addBundle(masterGraph[name], bundle);
			});
		}
		// If this is the configMain like package.json!npm we need to override
		// the source every time because it continuously changes.
		else if(masterGraph[name] && name === loader.configMain) {
			var node = masterGraph[name];
			node.load.source = newGraph[name].load.source;
		}

		// do not track bundles of entry point modules (a.k.a mains) unless
		// it is its own bundle.
		if (name === bundleName || !includes(mains, name)) {
			addBundle(masterGraph[name], bundleName);
		}
	}
}
1062740
function compileFile( sourceBundle, bundleFile, config, callback ) {
	var fname = sourceBundle + "/bundle.json";
	fs.readFile(fname, 'utf8', function (err,data) {
		if (err) {
			console.error("Unable to load file",fname);
			if (callback) callback( err, null );
			return;
		}

		// Update path if missing
		if (!config['path'])
			config['path'] = path.dirname( sourceBundle );

		// Compile
		compile( JSON.parse(data), bundleFile, config, callback );

	});
}
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));

        }
    }
262642
function bundleJsFiles () {
  return concat(jsFiles)
    .then((output) => {
      const uglified = UglifyJS.minify(output)
      if (uglified.error) {
        throw new Error(uglified.error)
      }
      return uglified.code
    })
}
774436
def depends_on(options, **kwargs):
    
    include_graph = options['include_graph']

    include_graph.render('full_graph')

    result = None

    if 'graph' in kwargs:
        name = kwargs['graph']
        del kwargs['graph']

        result = _Result(kwargs)

        dep_graph = build_dependency_graph(include_graph, **kwargs)

        dep_graph.render(name)

        result.add_result("Rendered dep graph at {}".format(name))

    else:
        result = _Result(kwargs)

        dep_graph = build_dependency_graph(include_graph, **kwargs)

        for node, edges in dep_graph:
            if node not in kwargs:
                result.add_result(node)

    return result
715801
function scripts (watch) {
  var bundler = browserify('./app/client.js', {
    debug: true,
    cache: {}
  });

  if (watch) {
    bundler = watchify(bundler)
  }

  bundler.require('./environment.json', {
    expose: 'environment'
  });

  exposeJS('./app').forEach(function (file) {
    bundler.require(file.path, {
      expose: file.expose
    });
  });

  bundler.transform(reactify);
  bundler.transform({ global: true }, envify);
  bundler.transform({ global: true }, uglifyify);

  /**
   * build application
   * @param {string} file
   */
  function rebundle (file) {
    var stream = bundler.bundle();
    if (file) {
      console.log('[gulp]', chalk.cyan('[watchify] rebundled due to:'), chalk.green(file));
    }

    console.log('[gulp]', chalk.cyan('[watchify] assets'), chalk.red('building'));
    stream
      .on('error', handleError('Browserify'))
      .pipe(source('isomorphic.js'))
      .pipe(buffer())
      .pipe(replace('{{ISOMORPHIC_ENV}}', args.name))
      .pipe(gulpIf(args.uglify, uglify()))
      .pipe(gulp.dest('./public')).on("end", function () {
        console.log('[gulp]', chalk.cyan('[watchify] assets'), chalk.green('complete'));
      });
  };

  bundler.on('update', rebundle);
  return rebundle();
}
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;
    }
360046
function loadDependencies() {
    [
        ...charts,
        ...chartDependencies,
    ].forEach(_safeLoadDependency);

    if (errors.length) {
        domHelpers.showErrors(errors);
    }
}
22747
function(all) {
      var tasks = all? ['load-api']:['pack-prepare','load-api'];
      ss.bundler.forEach(function(bundler){
        if (all) {
          tasks.push(bundler.client.name + ':pack');
        } else if (bundler.packNeeded) {
          tasks.push(bundler.client.name + ':pack-needed');
          tasks.push(bundler.client.name + ':pack');
        } else {
          tasks.push(bundler.client.name + ':pack-unneeded');
        }
      });
      return tasks;
    }