       hookedExts.push ext
       require.extensions[ext] = (module, filename) ->
         code = ''
+        deps = {}
         cmp = module._compile
-        module.__required = {}
+        module.__boiler_hook = (resolve, path, opt={}) ->
+          config =
+            parent:config
+            exclude:(x for x in config.exclude)
+            excluded:config.excluded or path in config.exclude
+          config.path = path
+          config.parent.deps = deps
+          deps[path] = resolve path
+          if opt.exclude
+            config.exclude.push path for path in opt.exclude # when (filename=resolve path) not in config.exclude
+          #console.dir config
         module._compile = (content, filename) ->
           code = content
           cmp.call this,
             """
             require = function(req) {
-              var require = function(alias) {
-                module.__required[alias] = req.resolve(alias);
-                return req.apply(this, arguments);
+              var require = function(path, opt) {
+                module.__boiler_hook(req.resolve, path, opt);
+                return req.call(this, path);
               };
               for (var i in req) {
                 require[i] = req[i];

path = require 'path'
fs = require 'fs'
file = path.resolve process.argv[2]
pathIdMap = {}
id = 0
pathToId = (path) ->
  pathIdMap[path] = id+=1 if path not of pathIdMap
  pathIdMap[path]
toDict = (kvps) ->
  dict = {}
  dict[kvp[0]] = kvp[1] for kvp in kvps
  dict
boil = (id, aliasIdMap, code, filename) ->
  """
  // file: #{path.relative __dirname, filename}
  register.call(this,#{id},#{JSON.stringify aliasIdMap},
  function(require,exports,module){
  #{code}
  });
  """

            """, filename
        try
          func module, filename
        #  console.log "loaded #{config.path}:#{filename} is loading #{deps}"
        #catch error
        #  console.log 'error in '+filename+': '+error

        if not config.excluded
          #  console.log "boiling #{config.path}:#{filename}"
          pathIdMap = toDict([path, filenameToId fn] for path, fn of deps)
          everything += boil filenameToId(filename), pathIdMap, code, filename
        #else
        #  console.log 'excluded '+filename
        config = config.parent if config.parent
        updateExtensions()

updateExtensions()
