"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createManifestJson = createManifestJson;

var _findInitialFileNames = require("./findInitialFileNames");

var _addFilesNamesToManifestJson = require("./addFilesNamesToManifestJson");

var _createInitialEntries = require("./createInitialEntries");

function createManifestJson({
  option,
  hashDigestLength,
  compilation,
  assets
}) {
  const manifestJson = {};

  if (option.needInitialEntries) {
    const initialFileNames = (0, _findInitialFileNames.findInitialFileNames)(compilation);
    const initialEntries = (0, _createInitialEntries.createInitialEntriesForManifestJson)(initialFileNames, hashDigestLength);
    manifestJson.initialEntries = initialEntries;
  }

  const outputJson = (0, _addFilesNamesToManifestJson.addFilesNamesToManifestJson)({
    manifestJson,
    option,
    assets,
    hashDigestLength
  });
  return outputJson;
}