 # FUNCTIONS
 toJson = (obj) -> JSON.stringify(obj, null, 2)
 
-parsedToObj = (parsed) -> 
+parsedToObj = (parsed, codeTransformer) -> 
   switch parsed.type
     when "Literal"
       return parsed.value


# This object will be written out as JSON at the end 
outputObj = 
  version: OUTPUT_VERSION
  model: {}
  layout: {}
  actions: {}


# Tools are a JS file that needs to be parsed
parsedTools = esprima.parse(fs.readFileSync(path.join(inputDir, "tools.js"), { encoding: "utf8" }))
# Replace "this" references with tools 
outputObj.tools = parsedToObj(parsedTools.body[0].expression, (code) -> code.replace(/this./g, "tools."))

# Create data-URI encoded versions of all assets
assetMap = JSON.parse(fs.readFileSync(path.join(inputDir, "assets.json"), { encoding: "utf8" }))
