@@ -14,17 +14,63 @@ window.staticReadFileSync = function(path) {
14
14
15
15
console . log ( 'file not found (add to preloadedFilenames list): ' , path ) ;
16
16
return path
17
- }
17
+ } ;
18
+
19
+ var preloadedReaddirSyncs = {
20
+ '/node_modules/npm/node_modules/npm-registry-client/lib' : [
21
+ // node_modules/npm/node_modules/npm-registry-client/lib|perl -pe'chomp;$_=" \"$_\",\n"'
22
+ "access.js" ,
23
+ "adduser.js" ,
24
+ "attempt.js" ,
25
+ "authify.js" ,
26
+ "deprecate.js" ,
27
+ "dist-tags" ,
28
+ "fetch.js" ,
29
+ "get.js" ,
30
+ "initialize.js" ,
31
+ "publish.js" ,
32
+ "request.js" ,
33
+ "star.js" ,
34
+ "stars.js" ,
35
+ "tag.js" ,
36
+ "unpublish.js" ,
37
+ "whoami.js" ,
38
+ ] ,
39
+ } ;
18
40
19
41
// TODO: https://github.com/substack/brfs/issues/19
20
42
window . staticReaddirSync = function ( path ) {
21
43
console . log ( 'readdirSync' , path ) ;
44
+ if ( path in preloadedReaddirSyncs )
45
+ return preloadedReaddirSyncs [ path ] ;
22
46
23
47
return [ ] ;
24
48
} ;
25
49
50
+ window . npmRegistryClientRequire = function ( path ) {
51
+ console . log ( 'npm-registry-client require' , path ) ;
52
+ // ls node_modules/npm/node_modules/npm-registry-client/lib|perl -pe's/.js//g'|perl -pe'chomp;$_=" if (path===\"/node_modules/npm/node_modules/npm-registry-client/lib/$_.js\") return require(\"npm/node_modules/npm-registry-client/lib/$_\");\n"'
53
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/access.js" ) return require ( "npm/node_modules/npm-registry-client/lib/access" ) ;
54
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/adduser.js" ) return require ( "npm/node_modules/npm-registry-client/lib/adduser" ) ;
55
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/attempt.js" ) return require ( "npm/node_modules/npm-registry-client/lib/attempt" ) ;
56
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/authify.js" ) return require ( "npm/node_modules/npm-registry-client/lib/authify" ) ;
57
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/deprecate.js" ) return require ( "npm/node_modules/npm-registry-client/lib/deprecate" ) ;
58
+ //if (path==="/node_modules/npm/node_modules/npm-registry-client/lib/dist-tags.js") return require("npm/node_modules/npm-registry-client/lib/dist-tags");
59
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/fetch.js" ) return require ( "npm/node_modules/npm-registry-client/lib/fetch" ) ;
60
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/get.js" ) return require ( "npm/node_modules/npm-registry-client/lib/get" ) ;
61
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/initialize.js" ) return require ( "npm/node_modules/npm-registry-client/lib/initialize" ) ;
62
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/publish.js" ) return require ( "npm/node_modules/npm-registry-client/lib/publish" ) ;
63
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/request.js" ) return require ( "npm/node_modules/npm-registry-client/lib/request" ) ;
64
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/star.js" ) return require ( "npm/node_modules/npm-registry-client/lib/star" ) ;
65
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/stars.js" ) return require ( "npm/node_modules/npm-registry-client/lib/stars" ) ;
66
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/tag.js" ) return require ( "npm/node_modules/npm-registry-client/lib/tag" ) ;
67
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/unpublish.js" ) return require ( "npm/node_modules/npm-registry-client/lib/unpublish" ) ;
68
+ if ( path === "/node_modules/npm/node_modules/npm-registry-client/lib/whoami.js" ) return require ( "npm/node_modules/npm-registry-client/lib/whoami" ) ;
69
+ console . log ( 'not found, add to npmRegistryClientRequire:' , path ) ;
70
+ } ;
71
+
26
72
window . npmCommandRequire = function ( path ) {
27
- console . log ( 'npm require' , path ) ;
73
+ console . log ( 'npm command require' , path ) ;
28
74
// ls node_modules/npm/lib/|perl -pe's/.js//g'|perl -pe'chomp;$_=" if (path===\"/node_modules/npm/lib/$_.js\") return require(\"npm/lib/$_\");\n"'
29
75
if ( path === "/node_modules/npm/lib/access.js" ) return require ( "npm/lib/access" ) ;
30
76
if ( path === "/node_modules/npm/lib/adduser.js" ) return require ( "npm/lib/adduser" ) ;
@@ -91,6 +137,7 @@ fs.statSync = function(file) {
91
137
return {
92
138
isFile : function ( ) { return true ; } ,
93
139
isFIFO : function ( ) { return false ; } ,
140
+ isDirectory : function ( ) { return false ; } ,
94
141
} ;
95
142
} ;
96
143
0 commit comments