     dump "uncaught exception: #{error}"
 
 
+loadedContent = []
+evalContentCache = {}
+contentInfoCache = {}
+evalFile = 'coffee-script.js'
+evalLine = null
+
+
+getEvalLine = ->
+  return evalLine if evalLine
+
+  for line, i in (getEvalContent evalFile).split '\n'
+    if line.match /\beval\(/
+      evalLine = i
+      break
+
+  if evalLine is null
+    throw new Error "unable to determine eval line for file #{evalFile}"
+
+  return evalLine
+
+getContent = (uri) ->
+  xhr = new XMLHttpRequest()
+
+  xhr.open 'GET', uri, false
+  try
+    xhr.send null
+  catch e
+    # uh oh, 404?
+    return null
+
+  if xhr.status in [0, 200]
+    xhr.responseText
+  else
+    null
+
+getEvalContent = (uri) ->
+  return evalContentCache[uri] if evalContentCache[uri]
+
+  content = getContent uri
+  return unless content
+
+  if /\.coffee$/.test uri
+    try
+      content = CoffeeScript.compile content
+    catch e
+      dump "!! Unable to compile CoffeeScript file: #{uri}: #{e}\n"
+      return null
+
+  evalContentCache[uri] = content
+
+getContentInfo = (uri) ->
+  return contentInfoCache[uri] if contentInfoCache[uri]
+
+  content = getEvalContent uri
+  return unless content
+
+  offset = getEvalLine()
+  lines  = content.split('\n').length
+  evalLine += lines
+
+  {content, offset, lines}
+
+
 wesabe =
   #
   # Creates nested modules as given by the module.

    uris.concat(wesabe._getUrisForParts(parts[0...parts.length-1], scheme, true, false))

  #
  # All the Uris loaded by _loadUri.
  # @private
  #
  _loadedUris: []

  #
  # File offset in number of lines.
  #
  _locOffset: null

  #
  # The line number of the eval statement in this file.
  #
  _evalOffset: null

  #
  # Returns the file and line number that the evaled code at a given line is from.
  #
  fileAndLineFromEvalLine: (lineno) ->
    for uri in wesabe._loadedUris
      if lineno > uri.offset and lineno <= uri.offset+uri.loc
        return file: uri.file, lineno: lineno-uri.offset

  #
  # Loads (and evals) the JS file at +uri+. Returns true on success.
  # @method _loadUri
  # @param uri {String} The uri to the JS file to load and eval.
  # @private
  #
  _loadUri: (uri, module) ->
    if wesabe._loadedUris[uri]
      return true

    contents = wesabe._getEvalText(uri)
    return false unless contents

    # figure out LOC offset and EVAL offset
    if wesabe._locOffset is null
      lines = wesabe._getEvalText(wesabe.getMyURI()).split(/\n/)
      for line, i in lines
        # can't actually use the same value we're looking for, or this'll be found first
        if /_{2}EVAL_{2}/.test(lines[i])
          wesabe._evalOffset = i
          break

      wesabe._locOffset = lines.length
      wesabe._loadedUris[wesabe.getMyURI()] =
        offset: 0
        loc: lines.length
        file: wesabe.getMyURI()

      wesabe._loadedUris.push wesabe._loadedUris[wesabe.getMyURI()]

    loc = contents.split(/\n/).length

    wesabe._loadedUris[uri] =
      offset: wesabe._locOffset
      loc: loc
      file: uri

    wesabe._loadedUris.push wesabe._loadedUris[uri]

    __FILE__ = uri
    padding = new Array(wesabe._locOffset-wesabe._evalOffset+1).join('\n')
    wesabe._locOffset += loc

    try
      _exportsOriginal = module.exports
      exports = module.exports
      require = wesabe.CommonJSRequire

      name: module
      parts: parts

    return result

  baseUrlForScheme: (scheme) ->
