 OB = require "./serialize"
 compilers = require "./compilers"
 assetUrlParse = require "./asseturlparse"
+
+toGlobals = (globals) ->
+  code = ""
+  for k, v of globals
+    code += "window['#{ k }'] = #{ OB.stringify v };\n"
+  code
 
 
 extension = (filename) ->

  pilers =
    raw: (ob, cb) -> cb null, ob.raw
    object: (ob, cb) ->
      code = ""
      for k, v of ob.object
        code += "window['#{ k }'] = #{ OB.stringify v };\n"
      cb null, code
    exec: (ob, cb) ->
      cb null, executableFrom ob.object
    file: (ob, cb) ->

  Type: JSPile
  contentType: "application/javascript"


  addOb: defNs (ns, ob) ->
    pile = @getPile ns
    pile.addOb ob
