roc
Version:
Build modern web applications easily
46 lines (41 loc) • 1.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = buildExtensionTree;
var _hooks = require('../../hooks');
var _actions = require('../../hooks/actions');
var _helpers = require('./helpers');
/**
* Builds the complete configuration objects.
*
* @param {string[]} packages - The packages to load into Roc.
* @param {string[]} plugins - The plugins to load into Roc.
* @param {rocConfig} baseConfig - The base configuration.
* @param {rocMetaConfig} baseMeta - The base meta configuration.
* @param {string} [directory=process.cwd()] - The directory to resolve relative paths from.
* @param {boolean} [verbose=true] - If verbose mode should be enabled, logs some extra information.
* @param {boolean} [checkDependencies=true] - If dependencies should be verified in extensions.
*
* @returns {Object} - The final state after loading all extensions.
* @property {rocConfig} config - The final configuration, with application configuration.
* @property {rocMetaConfig} meta - The merged meta configuration.
* @property {Object[]} projectExtensions - The extensions that was loaded successfully from the project.
* @property {Object[]} usedExtensions - All of the loaded extensions.
*/
function buildExtensionTree(packages, plugins, baseConfig, baseMeta, directory, verbose, checkDependencies) {
return [(0, _helpers.getExtensions)('package')(packages, directory), (0, _helpers.getExtensions)('plugin')(plugins, directory), _helpers.runPostInits].reduce((state, process) => process(state),
// Initial state
{
checkDependencies,
verbose,
config: baseConfig,
meta: baseMeta,
postInits: [],
projectExtensions: [],
usedExtensions: [],
actions: (0, _actions.getActions)(),
hooks: (0, _hooks.getHooks)()
});
}
//# sourceMappingURL=index.js.map