Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function collectMrBootstrapBundle(loader, bundler, config) {
var requirePackage = bundler.getPackage({name: "mr"});
var promisePackage = bundler.getPackage({name: "bluebird"});
var bundle = [
requirePackage.files["bootstrap.js"].utf8,
requirePackage.files["require.js"].utf8,
requirePackage.files["browser.js"].utf8,
promisePackage.files["js/browser/bluebird.min.js"].utf8
];
// some of the modules used in bootstrapping get injected into the run-time
// during the same process. to avoid including duplicates of these
// "modules", mark them as already bundled.
loader.getPackage({name: "bluebird"}).getModuleDescriptor("bluebird").bundled = true;
return Bundle.collectBundle(loader, bundler, config, bundle);
}
function bundleHtml(file, config) {
var pkg = file.package,
montagePackage, montageLocation,
requirePackage, requireLocation,
document,
jobs = [];
if (pkg.hasPackage({name: "montage"})) {
montagePackage = pkg.getPackage({name: "montage"});
montageLocation = montagePackage.files['montage.js'].buildLocation;
} else if (pkg.hasPackage({name: "mr"})) {
requirePackage = pkg.getPackage({name: "mr"});
requireLocation = requirePackage.files['bootstrap.js'].buildLocation;
}
try {
document = file.document;
} catch (exception) {
config.out.warn("HTML parse error: " + file.path);
config.out.warn(exception.message);
return;
}
visit(document, function (element) {
if (element.nodeType === Node.ELEMENT_NODE &&
element.tagName === "SCRIPT" &&
element.hasAttribute("src")) {
var src = element.getAttribute("src"),
location = URL.resolve(file.buildLocation, src);