Creates a layer from the installed requirements.
@return {Promise} the combined promise for requirements layer.
420239
function layerRequirements() {
  if (!this.options.layer) {
    return BbPromise.resolve();
  }

  this.serverless.cli.log('Packaging Python Requirements Lambda Layer...');

  return BbPromise.bind(this)
    .then(zipRequirements)
    .then(createLayers);
}
585614
function() {
		var that = this;
		return new Promise(function(resolve, reject) {
			that.resolve(function(err, val) {
				if (err) {
					reject(err);
				} else {
					resolve(val);
				}
			});
		});
	}
199488
function(layersContext) {
        var layers = [];
        for (var i=0, len=layersContext.length; i<len; i++) {
            var layer = this.getLayerFromContext(layersContext[i]);
            if (layer !== null) {
                layers.push(layer);
            }
        }
        return layers;
    }
1191343
public static Requirement build(Semver requirement) {
        return new Requirement(new Range(requirement, Range.RangeOperator.EQ), null, null, null);
    }
483328
function buildLayers() {
            dataByDateFormatted = dataByDate
                .map(d => assign({}, d, d.values))
                .map(d => {
                    Object.keys(d).forEach(k => {
                        const entry = d[k];

                        if (entry && entry.name) {
                            d[entry.name] = entry.value;
                        }
                    });

                    return assign({}, d, {
                        date: new Date(d['key'])
                    });
                });

            dataByDateZeroed = dataByDate
                .map(d => assign({}, d, d.values))
                .map(d => {
                    Object.keys(d).forEach(k => {
                        const entry = d[k];

                        if (entry && entry.name) {
                            d[entry.name] = 0;
                        }
                    });

                    return assign({}, d, {
                        date: new Date(d['key'])
                    });
                });

            let initialTotalsObject = uniq(data.map(getName))
                                        .reduce((memo, key) => (
                                            assign({}, memo, {[key]: 0})
                                        ), {});

            let totals = data
                .reduce((memo, item) => (
                    assign({}, memo, {[item.name]: memo[item.name] += item.value})
                ), initialTotalsObject);

            order = topicsOrder || formatOrder(totals);

            let stack3 = d3Shape.stack()
                .keys(order)
                .order(d3Shape.stackOrderNone)
                .offset(d3Shape.stackOffsetNone);

            layersInitial = stack3(dataByDateZeroed);
            layers = stack3(dataByDateFormatted);
        }
232077
function makePromise(fn) {
                    return new WinJS.Promise(function init(completeDispatch, errorDispatch) {
                        fn(function successCb(results) {
                            completeDispatch(results);
                        }, function errorCb(error) {
                            errorDispatch(error);
                        });
                    });
                }
837809
function requestBundles(requestedLangs = navigator.languages) {
    const newLangs = negotiateLanguages(
      requestedLangs, availableLangs, { defaultLocale }
    );

    const bundles = newLangs.map(
      lang => new ResourceBundle(lang, resIds)
    );

    return Promise.resolve(bundles);
  }
120413
private HtmlContainer getOrCreateLayerContainer(Layer layer) {
		if (layerContainers.containsKey(layer)) {
			return layerContainers.get(layer);
		}
		HtmlContainer layerContainer = new HtmlGroup();
		layerContainer.asWidget().getElement().setId(layer.getId());
		layersModelContainer.add(layerContainer);
		layerContainers.put(layer, layerContainer);
		return layerContainer;
	}
548160
function requireDependencies(dependencies) {
    var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

    var promise = new _es6Promise.Promise(function (succeed, fail) {
        var requirements = {};

        // no requirements
        if (!(dependencies instanceof Array)) {
            return succeed(requirements);
        }

        // check if succeeded
        function checkStatus() {
            if (Object.keys(requirements).length === dependencies.length) {
                succeed(requirements);
            }
        }

        dependencies.forEach(function (dependency) {
            if (packages.has(dependency)) {
                requirements[dependency] = packages.get(dependency);
            } else {
                events.once("load:" + dependency, function (requirement) {
                    requirements[dependency] = requirement;
                    checkStatus();
                });
            }
        });

        // First check
        checkStatus();
    });

    return typeof callback === "function" ? promise.then(callback) : promise;
}
170963
async function create(name, options, api, env) {
  // Grab the cwd and npmClient off of the environment. We can use these to
  // create the folder for the project and for determining what client to use
  // for npm-related commands
  const { CLI_ENV, cwd, npmClient } = env;
  // We support a couple of options for our `create` command, some only exist
  // during development (like link and linkCli).
  const { link, linkCli, plugins = [], presets = [], skip } = options;
  const root = path.join(cwd, name);

  logger.trace('Creating project:', name, 'at:', root);

  if (await fs.exists(root)) {
    throw new Error(`A folder already exists at \`${root}\``);
  }

  // Create the root directory for the new project
  await fs.ensureDir(root);

  const {
    writePackageJson,
    installDependencies,
    linkDependencies,
  } = await createClient(npmClient, root);
  const packageJson = {
    name,
    private: true,
    license: 'MIT',
    scripts: {},
    dependencies: {},
    devDependencies: {},
    toolkit: {},
  };

  // Write the packageJson to the newly created `root` folder
  await writePackageJson(packageJson);

  const installer = linkCli ? linkDependencies : installDependencies;
  await installer(['@carbon/toolkit']);

  if (CLI_ENV === 'production') {
    clearConsole();
  }

  if (skip) {
    displaySuccess(root, name, npmClient);
    return;
  }

  const toolkit = await which('toolkit', { cwd: root });

  if (presets.length > 0) {
    const args = ['add', ...presets, link && '--link'].filter(Boolean);
    await spawn(toolkit, args, {
      cwd: root,
      stdio: 'inherit',
    });
  }

  if (plugins.length > 0) {
    const args = ['add', ...plugins, link && '--link'].filter(Boolean);
    await spawn(toolkit, args, {
      cwd: root,
      stdio: 'inherit',
    });
  }

  displaySuccess(root, name, npmClient);
}
386839
function build (config) {
  return new Promise((resolve, reject) => {
    const compiler = webpack(Object.assign(config, {
      output: { filename: 'file' },
      plugins: [
        new webpack.DefinePlugin({
          'process.env.NODE_ENV': '"production"',
          'process.browser': true
        })
      ]
    }), (err, stats) => {
      if (err || stats.hasErrors()) reject(err || new Error(stats.toString('errors-only')))
      const compilation = stats.compilation
      const compiler = compilation.compiler
      const memoryFs = compiler.outputFileSystem
      const outputFile = compilation.assets.file.existsAt
      resolve(memoryFs.readFileSync(outputFile, 'utf8'))
    })
    compiler.outputFileSystem = new MemoryFs()
  })
}
319346
function makeRequire(m, self) {
    function _require(_path) {
        return m.require(_path);
    }

    _require.resolve = function(request) {
        return _module._resolveFilename(request, self);
    };
    _require.cache = _module._cache;
    _require.extensions = _module._extensions;

    return _require;
}
908642
private function initLayer()
    {
        $this->layerResolver->create($this->getLayerType());

        if ($this->getRequest()->getParam('cat')) {
            $category = $this->categoryFactory->create()->setId($this->getRequest()->getParam('cat'));
            $this->layerResolver->get()->setCurrentCategory($category);
        }

        $this->applyFilters();

        return $this;
    }
899916
function npmInstall(requires, done) {
    var npmBin = path.join(path.dirname(process.argv[0]), 'npm');
    if (process.platform === 'win32') { npmBin += '.cmd'; }
    async.forEachSeries(requires, function(module, next) {
      // skip existing modules
      if (grunt.file.exists(path.join('./node_modules/' + module))) {
        grunt.log.writeln(String('Module "' + module + '" already installed, skipping.').cyan);
        return next();
      }
      grunt.log.writeln('npm install ' + module + ' --save');
      // spawn npm install
      var s = grunt.util.spawn({
        cmd: npmBin,
        args: ['install', module, '--save']
      }, next);
      // write output
      s.stdout.on('data', function(buf) { grunt.log.write(String(buf)); });
      s.stderr.on('data', function(buf) { grunt.log.write(String(buf)); });
    }, done);
  }
35413
function createDir (directoryToCreate) {
  return new Promise((resolve, reject) => {
    mkdirp(directoryToCreate, (err) => {
      if (err) {
        return reject(new Error(err));
      }

      return resolve();
    });
  });
}
1230339
function execDependencyInstall () {

	console.log('\nExecuting npm install command...');

	return new Promise(function(resolve, reject){

		var child = require('child_process').spawn('npm', ['install'], {
			cwd: process.cwd,
			detached: false,
			env: process.env,
			stdio: [process.stdin, process.stdout, process.stderr]
		});

		child.on('error', function (error) {
			console.error(colors.bold.red('ERROR: Could not install the required modules:'));
			console.error(error.stack.toString());
			process.exit(255);
		});

		child.on('close', function (exit_code) {
			if (exit_code !== 0) {
				console.error(colors.bold.red('\nERROR: npm install has been failed.'));
				process.exit(255);
			}
			console.log('\nnpm install has been completed.\n\n');
			resolve(true);
		});

	});

}
666333
function wrapOrCreateObject() {
      if(isFunction(obj) && (exists(obj.$provide) || exists(obj.$inject) || provide || injects)){
        var instance = Object.create(obj.prototype);
        return obj.apply(instance,arguments) || instance;
      }
      return obj;
    }