@gasket/core
Advanced tools
Comparing version 7.0.0-next.34 to 7.0.0-next.35
@@ -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; |
@@ -43,2 +43,4 @@ declare module '@gasket/core' { | ||
name: string; | ||
version: string; | ||
description: string; | ||
dependencies?: Array<string>; | ||
@@ -45,0 +47,0 @@ hooks: { |
{ | ||
"name": "@gasket/core", | ||
"version": "7.0.0-next.34", | ||
"version": "7.0.0-next.35", | ||
"description": "Entry point to setting up Gasket instances", | ||
@@ -10,3 +10,4 @@ "exports": { | ||
"types": "./lib/index.d.ts" | ||
} | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
@@ -91,3 +92,3 @@ "types": "lib/index.d.ts", | ||
"type": "module", | ||
"gitHead": "219ddcd68d2d6efd13a8324da31a7dc51cf2b78a" | ||
"gitHead": "c79ee342a46ad0f222f2912a50e61a4d90a89fc4" | ||
} |
54720
1339