Create extensions list in serialize function

Removed runtime argument from serializeTarget call because it wasn't used
This commit is contained in:
Connor Hudson 2018-06-21 15:01:00 -04:00
parent 026dd96491
commit befcbec393

View file

@ -466,12 +466,17 @@ const serializeTarget = function (target, extensions) {
const serialize = function (runtime) {
// Fetch targets
const obj = Object.create(null);
// Create extension set to hold extension ids found while serializing targets
const extensions = new Set();
const flattenedOriginalTargets = JSON.parse(JSON.stringify(
runtime.targets.filter(target => target.isOriginal)));
obj.targets = flattenedOriginalTargets.map(t => serializeTarget(t, runtime));
obj.targets = flattenedOriginalTargets.map(t => serializeTarget(t, extensions));
// TODO Serialize monitors
// Assemble extension list
obj.extensions = Array.from(extensions);
// Assemble metadata
const meta = Object.create(null);
meta.semver = '3.0.0';