@gasket/core
Advanced tools
Comparing version 7.3.0-canary.3 to 7.3.0-canary.4
@@ -56,3 +56,5 @@ "use strict"; | ||
this._pluginMap = plugins.reduce((acc, plugin)=>{ | ||
// TODO: throw if plugin is not an object | ||
if (typeof plugin !== 'object' || Array.isArray(plugin)) { | ||
throw new Error(`Plugin ${plugin.name} must be an object`); | ||
} | ||
const { name, hooks } = plugin; | ||
@@ -65,2 +67,13 @@ if (!name) { | ||
} | ||
// Add base metadata hook if not present | ||
if (!plugin.hooks.metadata) { | ||
plugin.hooks.metadata = function() { | ||
var _ref = _async_to_generator(function*(_, metadata) { | ||
return metadata; | ||
}); | ||
return function(_, metadata) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
} | ||
acc[name] = plugin; | ||
@@ -67,0 +80,0 @@ return acc; |
@@ -37,3 +37,6 @@ import debugPkg from 'debug'; | ||
.reduce((acc, plugin) => { | ||
// TODO: throw if plugin is not an object | ||
if (typeof plugin !== 'object' || Array.isArray(plugin)) { | ||
throw new Error(`Plugin ${plugin.name} must be an object`); | ||
} | ||
const { name, hooks } = plugin; | ||
@@ -47,2 +50,7 @@ if (!name) { | ||
// Add base metadata hook if not present | ||
if (!plugin.hooks.metadata) { | ||
plugin.hooks.metadata = async (_, metadata) => metadata; | ||
} | ||
acc[name] = plugin; | ||
@@ -49,0 +57,0 @@ return acc; |
{ | ||
"name": "@gasket/core", | ||
"version": "7.3.0-canary.3", | ||
"version": "7.3.0-canary.4", | ||
"description": "Entry point to setting up Gasket instances", | ||
@@ -91,3 +91,3 @@ "exports": { | ||
"type": "module", | ||
"gitHead": "eb3615e527b7c04639a6616c1f017c4ed750fcd7" | ||
"gitHead": "2abf9afba3b1d1f9a77efe01377a2e12cfeda02c" | ||
} |
54721
1339