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ize@4.0.4/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/customize@4.0.4/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*!\n * customize <https://github.com/nknapp/ride-over>\n *\n * Copyright (c) 2015 Nils Knappmeier.\n * Released under the MIT license.\n */\n\n'use strict'\n\n/*\n * Use the `debug`-module to provide debug output if needed\n */\nconst debug = require('debug')('customize:base')\nconst debugState = require('debug')('customize:state')\nconst debugVersions = require('debug')('customize:versions')\nconst deep = require('deep-aplus')(Promise)\nconst mergeWith = require('lodash.mergewith')\n\nconst util = require('./lib/util')\nconst mapValues = util.mapValues\nconst isString = util.isString\nconst constant = util.constant\n\n/**\n * The configuration file is defined (and validated) by a JSON-schema\n * (see [the config-schema file](./config-schema.js)) for details.\n * We use the `jsonschema` module for validation, and add the\n * function-validator of `jsonschema-extra` because configurations\n * usually include functions\n *  from https://gitlab.com/jksdua/jsonschema-extra/blob/master/types.js#L16\n * @private\n */\nconst jsonschema = require('jsonschema')\nconst validator = new jsonschema.Validator()\nvalidator.types = Object.create(validator.types)\nvalidator.types.function = function testFunction(fn) {\n  return typeof fn === 'function'\n}\n\n/**\n * Create a new Customize object with an empty configuration\n *\n * @module customize\n */\nmodule.exports = customize\n\n/**\n * For coverage testing: Expose the debugState object so it can be enabled an disabled in testcases\n */\nmodule.exports.debugState = debugState\n\n/**\n * For coverage testing: Expose the debug object so it can be enabled an disabled in testcases\n */\nmodule.exports.debug = debug\n\n/**\n * Exposes the constructor of the `customize` object\n * @type {customize}\n */\nmodule.exports.Customize = Customize\n\n/**\n * Custom overrider-function (that is used as `customizer` in (lodash#merge)[https://lodash.com/docs#merge]\n * @type {customOverrider}\n */\nmodule.exports.overrider = customOverrider\n\n/**\n * @returns {Customize}\n * @api public\n */\nfunction customize() {\n  return new Customize({}, {}, {})\n}\n\n/**\n * This class does the actual work. When calling\n * `require('customize')()` a new instance of this\n * class is returned with an empty configuration, so\n * `new Customize(...)` should never be called outside\n * this module\n * `config` and `parentConfig` are of the form\n *\n * ```js\n * { engine: { config: ..., watched: [ ... ] } }\n * ```\n *\n * @constructor\n */\nfunction Customize(config, parentConfig, engines) {\n  const _config = mergeWith({}, parentConfig, config, customOverrider)\n\n  // Debug logging\n  if (debugState.enabled) {\n    deep(_config).then(\n      function(config) {\n        debugState('New configuration', config)\n      } /* istanbul ignore next */,\n      function(e) {\n        console.error('Error while debug-logging the built configuration ' + e.stack) // eslint-disable-line no-console\n      }\n    )\n  }\n\n  /**\n   * Register an engine\n   * @param {string} id the identifier of the engine. This identifier is also used\n   *  within the config as key within the configuration object to identify the\n   *  sub-configuration stored for this engine.\n   * @param {object} engine  a customize engine that is registered\n   * @param {object=} engine.defaultConfig the default configuration of the engine\n   * @param {function(object):object=} engine.preprocessConfig a preprocessor to convert a merge-configuration to the internal format of the engine\n   * @param {function(object):object} engine.run the execution function of the engine (the merged config is passed as parameter\n   * @param {function(object):object} engine.run the execution function of the engine (the merged config is passed as parameter)\n   * @param {object=} engine.schema a JSON-schema to validate the merge-configurations against.\n   *\n   * @public\n   */\n  this.registerEngine = function(id, engine) {\n    debug(\"Registering engine '\" + id + \"'\")\n    if (typeof id !== 'string') {\n      throw new Error('Engine-id must be a string, but is ' + id)\n    }\n    if (id.substr(0, 1) === '_') {\n      throw new Error('Engine-id may not start with an underscore (\"_\"), but is ' + id)\n    }\n    if (engine.run == null) {\n      throw new Error('Engine ' + id + ' needs a run method')\n    }\n\n    // This is only allowed if no engine with the same id exists.\n    if (engines[id] != null || _config[id] != null) {\n      const error = new Error(\"Engine '\" + id + \"' already registered.\", 'ERR_ENGINE_EXISTS')\n      error.engine = engines[id]\n      error.config = _config[id]\n      throw error\n    }\n\n    const _engines = mapValues(engines) // clone\n    _engines[id] = engine\n    const _defaultConfig = {}\n    _defaultConfig[id] = {\n      config: engine.defaultConfig || {},\n      watched: engine.defaultWatched || []\n    }\n    return new Customize(_defaultConfig, _config, _engines)\n  }\n\n  /**\n   * Returns the JSON-schema that configuration objects must match for this\n   * configuration. The schema does not contain main description property\n   */\n  this.configSchema = function() {\n    return {\n      id: 'http://json-schema.org/draft-04/schema#',\n      $schema: 'http://json-schema.org/draft-04/schema#',\n      type: 'object',\n      properties: mapValues(engines, function(engine) {\n        return (\n          engine.schema || {\n            type: 'object',\n            description: 'No expicit schema has been provided for this engine'\n          }\n        )\n      })\n    }\n  }\n\n  /**\n   * Creates a new instance of Customize. The configuration values of the current Customize\n   * are used as default values and are overridden by the configuration provided as parameter.\n   * @param {object} config configuration overriding the current configuration\n   * @return {Customize} the new Customize instance\n   * @api public\n   */\n  this.merge = function(config) {\n    if (config == null) {\n      throw new Error(\"Cannot merge undefined 'config'\")\n    }\n\n    debug('Calling merge', config)\n\n    // Assert that for each key in the other configuration, there is an engine present\n    // Apply engine preprocessor to each config\n    const preprocessedConfig = mapValues(config, function(engineConf, engineName) {\n      const engine = engines[engineName]\n      if (engine == null) {\n        throw new Error(\"Engine '\" + engineName + \"' not found. Refusing to store configuration\")\n      }\n      // Load preprocessor with identity as default\n      const preprocessor =\n        engine.preprocessConfig ||\n        function(a) {\n          return a\n        }\n      // Watch no files by default (constant [])\n      const watched = engine.watched || constant([])\n\n      return Promise.resolve(engineConf)\n        .then(function(engineConf) {\n          if (engine.schema) {\n            debug('Validating schema for ', engineName)\n            /**\n             * The overriding configuration must validate against the [JSON-schema for configurations](./config-schema.html)\n             * Otherwise we refuse to proceed.\n             */\n            const validationErrors = validator.validate(engineConf, engine.schema).errors\n            if (validationErrors.length > 0) {\n              debug(\"Error while validating config for engine '\" + engineName + \"': \", engineConf)\n              debug('Errors: ', validationErrors.map(String).join('\\n'))\n              const error = new Error('Error while validating Customize configuration')\n              error.validationErrors = validationErrors\n              throw error\n            }\n          }\n\n          return {\n            config: preprocessor(engineConf),\n            watched: watched(engineConf).filter(isString)\n          }\n        })\n        .then(function(config) {\n          debug('Merging preprocessed config', config)\n          return config\n        })\n    })\n\n    return new Customize(preprocessedConfig, _config, engines)\n  }\n\n  /**\n   * Inherit configuration config from another module.\n   * a Customizer-module usually exports a `function(Customize):Customize`\n   * which in tern calls `Customize.merge` to create a new Customize instance.\n   * This function needs to be passed in here.\n   *\n   * A new Customize will be returned that overrides the current configuration\n   * with the configuration of the module.\n   * @param {function(Customize):Customize} customizeModule  that receives a Customize as paramater\n   *  and returns a Customize with changed configuration.\n   * @return {Customize} the Customize instance returned by the module\n   * @public\n   */\n  this.load = function(customizeModule) {\n    // Container for configuration metadata (e.g. versions of loaded modules)\n    const _metadata = {\n      config: {\n        modules: []\n      }\n    }\n    if (customizeModule.package) {\n      debugVersions('Loading', customizeModule.package.name, customizeModule.package.version)\n      _metadata.config.modules.push(customizeModule.package)\n    }\n\n    return customizeModule(new Customize({ _metadata: _metadata }, _config, engines))\n  }\n\n  /**\n   * Return a promise for the merged configuration.\n   * This functions is only needed to inspect intermediate configuration results\n   * (i.e. for testing and documentation purposes)\n   * @return {Promise<object>} a promise for the whole configuration\n   * @public\n   */\n  this.buildConfig = function() {\n    return deep(_config)\n      .then(function(config) {\n        return mapValues(config, 'config')\n      })\n      .then(function(config) {\n        debug('Building', config)\n        return config\n      })\n  }\n\n  /**\n   * Return a promise for the files needing to be watched in watch-mode,\n   * indexed by engine.\n   * @return {Promise<object<string[]>>} a promise for the files to be watched.\n   *\n   * @public\n   */\n  this.watched = function() {\n    return deep(_config)\n      .then(function(config) {\n        return mapValues(config, 'watched')\n      })\n      .then(function(watchedFiles) {\n        debug('Watched files', watchedFiles)\n        return watchedFiles\n      })\n  }\n\n  /**\n   * Run each engine with its part of the config.\n   *\n   * @param {object=} options optional paramters\n   * @param {string=} options.onlyEngine the name of an engine if only a single engine should\n   *  be executed\n   * @return {Promise<object>} an object containing on property per registered engine\n   *  (the key is the engine-id) containing the result of each engine\n   * @public\n   */\n  this.run = function(options) {\n    const onlyEngine = options && options.onlyEngine\n    return this.buildConfig().then(function(resolvedConfig) {\n      const result = mapValues(engines, function(engine, key) {\n        // if \"onlyEngine\" is set to a value, execute on the engine with the same name\n        if (!onlyEngine || onlyEngine === key) {\n          return engine.run(resolvedConfig[key])\n        }\n      })\n      return deep(result)\n    })\n  }\n}\n\n/**\n * Wrap a function so that if it overrides another function, that function will\n * be available as `this.parent`\n * @param fn\n * @api public\n * @readonly\n */\nmodule.exports.withParent = require('./lib/withParent')\n\n/**\n * Create a promise that is regarded as leaf in the configuration tree.\n * That means, that the overrider is not resolving this promise when overriding values.\n * Promised object values will not be merged but replaced.\n * @param {*} promiseOrValue a promise or a valude that represents the leaf\n * @returns {Promise}\n * @public\n * @readonly\n */\nmodule.exports.leaf = require('./lib/leaf')\n\n/**\n * Customize has predefined override rules for merging configs.\n *\n * * If the overriding object has a `_customize_custom_overrider` function-property,\n *   it isk called to perform the merger.\n * * Arrays are concatenated\n * * Promises are resolved and the results are merged\n *\n *\n * @param a the overridden value\n * @param b the overriding value\n * @param propertyName the property name\n * @returns {*} the merged value\n * @private\n * @readonly\n */\nfunction customOverrider(a, b, propertyName) {\n  if (b == null) {\n    return a\n  }\n\n  if (a == null) {\n    // Invoke default overrider\n    return undefined\n  }\n\n  // Some objects have custom overriders\n  if (b._customize_custom_overrider && b._customize_custom_overrider instanceof Function) {\n    return b._customize_custom_overrider(a, b, propertyName)\n  }\n\n  // Arrays should be concatenated\n  if (Array.isArray(a)) {\n    return a.concat(b)\n  }\n\n  // Merge values resolving promises, if they are not leaf-promises\n  if (isPromiseAlike(a) || isPromiseAlike(b)) {\n    return Promise.all([a, b]).then(function([_a, _b]) {\n      // Merge the promise results\n      return mergeWith({}, { x: _a }, { x: _b }, customOverrider).x\n    })\n  }\n  // None of these options apply. Implicit \"undefined\" return value to invoke default overrider.\n}\n\n/**\n * Check if this is something like a promise (taken from the Q-module)\n * @param {*} obj the object to check for being a promise\n * @returns {boolean} true, if the object is a promise\n * @private\n */\nfunction isPromiseAlike(obj) {\n  return obj === Object(obj) && typeof obj.then === 'function'\n}\n"]}