From befcbec3937c00a69b524ed3dff152f04beade6c Mon Sep 17 00:00:00 2001 From: Connor Hudson Date: Thu, 21 Jun 2018 15:01:00 -0400 Subject: [PATCH] Create extensions list in serialize function Removed runtime argument from serializeTarget call because it wasn't used --- src/serialization/sb3.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/serialization/sb3.js b/src/serialization/sb3.js index 1b5c56336..99c6ec226 100644 --- a/src/serialization/sb3.js +++ b/src/serialization/sb3.js @@ -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';