Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Commit

Permalink
removed unused
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictarr committed Dec 15, 2010
1 parent 6eb2522 commit e1c1413
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 175 deletions.
1 change: 1 addition & 0 deletions loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var internalModuleCache = {}
};

function loadResolvedModule (id,filename,parent,makeR,moduleCache){
// console.log("::::::::: load " + id + "::::::::::")
//moduleCache = moduleCache || cache
// console.log("CACHE (loadResolvedModule):" + moduleCache)
assert.ok(moduleCache,"loadResolvedModule needs a moduleCache")
Expand Down
58 changes: 0 additions & 58 deletions remap.js

This file was deleted.

28 changes: 15 additions & 13 deletions remapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,34 @@ module.exports = Remapper
function Remapper (_module,remaps){
var self = this
modules = modules.useCache({})

self.flatLoaded = [1,2,3]
var super = self

function Maker (depends,loaded,remaps){
var self = this
var _depends = {}
loaded = loaded || {}

self.resolve = function (request,module){
log("request = ", request)
if(remaps[request]){
log("REMAP :", request, " -> ", remaps[request])
if(remaps.hasOwnProperty(request) && remaps[request]){
// log("REMAP :", request, " -> ", remaps[request])
request = remaps[request]
}
return resolve.resolveModuleFilename(request,module)
}

self.load = function (id, filename, parent, makeR ){
if(!loaded[id])
loaded[id] = {}
if(loaded[parent.id]){
loaded[parent.id][id] = loaded[id]

if(!loaded[id]) { loaded[id] = {} }

if(loaded[parent.id]) { loaded[parent.id][id] = loaded[id] }

if(-1 == super.flatLoaded.indexOf(id)){
console.log("ID",id)
super.flatLoaded.push(id)
}
return modules.defaultLoad(id, filename, parent, makeR)

return modules.defaultLoad(id, filename, parent, makeR)
}

self.make = function (thisModule){
Expand All @@ -55,9 +60,6 @@ function Maker (depends,loaded,remaps){

self.require = make()

console.log("remaps")
console.log(self.remaps)

function make(){
return modules.makeMake(new Maker(self.depends,self.loaded,self.remaps))(_module)
}
Expand Down
21 changes: 9 additions & 12 deletions test/modules.asynct.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ var modules = require('remap/modules')
; // a semi-colon for Ryan Gahl

//var Xexports = {}

exports['Require2 can load a module'] = function (test){

var a1 = require2('./.examples/a')

test.finish()
}



exports['loads a module with different module, require'] = function (test){

var mirror = require2('./.examples/mirror')
Expand Down Expand Up @@ -60,15 +58,14 @@ exports['modules.loadModule accepts a function which is assigned to module and c
return r
}

/* applications of this crazy module:
1. reroute resolve, so that it loads a different module.
2. return before calling loadModule, i.e. return a mock instead.
3. modify module loaded.
i.e. wrap it and record what is called.
or wrap all db queries in a transaction and revert it after the test.
4. change the makeRequire method for children...
*/

/* applications of this crazy module:
1. reroute resolve, so that it loads a different module.
2. return before calling loadModule, i.e. return a mock instead.
3. modify module loaded.
i.e. wrap it and record what is called.
or wrap all db queries in a transaction and revert it after the test.
4. change the makeRequire method for children...
*/
}

exports['modules can uncache a loaded module'] = function (test){
Expand Down
89 changes: 0 additions & 89 deletions test/remap.asynct.js

This file was deleted.

5 changes: 4 additions & 1 deletion test/remapper.depends.asynct.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var Remapper = require('remap/remapper')
, describe = require('should').describe
, helper = require('./.helper/helper')
, inspect = require('util').inspect //require('inspect')
, log = console.log
, log = require('logger')
, a_fn = 'remap/test/.examples/a'
, b_fn = 'remap/test/.examples/b'
, c_fn = 'remap/test/.examples/c'
Expand Down Expand Up @@ -124,6 +124,9 @@ exports ['can retrive the dependencies of multiple require()s (more complex)'] =
shouldLoaded(r,'remap/test/.examples/d',d)
shouldLoaded(r,'remap/test/.examples/e',e)

log('depends\n',r.depends)


shouldDepends(r,e_fn,depends,loaded)

test.finish()
Expand Down
2 changes: 0 additions & 2 deletions test/remapper.remaps.asynct.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ exports ['can remap the dependencies of a single require()'] = function (test){
test.finish()
}



exports ['can remap the dependencies of multiple require()s'] = function (test){

var remaps = {'./c': './a' }
Expand Down

0 comments on commit e1c1413

Please sign in to comment.