0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

188 Commits

Author SHA1 Message Date
isaacs
49e0f14a2f Cache modules based on filename rather than ID
This is ever so slightly less efficient than caching based on ID, since the
filename has to be looked up before we can check the cache.  However, it's
the most minimal approach possible to get this change in place.  Since
require() is a blocking startup-time operation anyway, a bit of slowness is
not a huge problem.

A test involving require.paths modification and absolute loading. Here's the
gist of it.

Files: /p1/foo.js /p2/foo.js

  1. Add "/p1" to require.paths.
  2. foo1 = require("foo")
  3. assert foo1 === require("/p1/foo") (fail)
  4. Remove /p1 from require.paths.
  5. Add /p2 to require.paths.
  6. foo2 = require("foo")
  7. assert foo1 !== foo2 (fail)
  8. assert foo2 === require("/p2/foo") (fail)

It's an edge case, but it affects how dependencies are mapped by npm.
If your module requires foo-1.2.3, and my module requires foo-2.3.4,
then you should expect to have require("foo") give you foo-1.2.3, and
I should expect require("foo") to give me foo-2.3.4.  However, with
module ID based caching, if your code loads *first*, then your "foo"
is THE "foo", so I'll get your version instead of mine.

It hasn't yet been a problem, but only because there are so few
modules, and everyone pretty much uses the latest version all the
time.  But as things start to get to the 1.x and 2.x versions, it'll
be an issue, I'm sure.  Dependency hell isn't fun, so this is a way to
avoid it before it strikes.
2010-07-19 14:17:22 -07:00
Benjamin Fritsch
0ed3532699 added test for Issue #214 2010-07-19 10:16:31 -07:00
Ryan Dahl
9fd5e3c89c Update tests to work with module contexts 2010-07-15 14:21:31 -07:00
Blake Mizerany
8c8534046c fix whitespace errors 2010-06-29 23:59:24 -07:00
Ryan Dahl
ba792ea202 :%s/sys.puts/console.log/g
and there was much rejoicing
2010-06-23 20:05:29 -07:00
Peter Griess
8f0b4e9111 Send and receive file descriptors through net.Stream.
a) create a layer of indirection in net.Stream to allow swapping in
different read/write implementations and

b) emit an 'fd' event when file descriptors are received over a UNIX pipe,
as finally as a tangential benefit

c) remove a bunch of conditionals from the primary codepaths for
ease-of-reading.
2010-06-02 18:16:53 -07:00
Orlando Vazquez
92da636b97 Add a parameter to spawn() that sets the child's stdio file descriptors.
After the child is forked, these file descriptors will get dup2()'d to STDIN,
STDIO, and STDERR.

(API may be changed.)
2010-06-02 10:41:24 -07:00
Ryan Dahl
8840ce340d Bugfix: fs.ReadStream.setEncoding
Improve test-fs-read-stream test.
2010-05-26 18:33:38 -07:00
Ryan Dahl
e232f09d38 fs.WriteStream.write should support buffer
Also re-adding the callback parameter.
2010-05-17 19:44:14 -07:00
Elijah Insua
976926376d Handle empty files with fs.readFile 2010-05-13 12:42:17 -07:00
Ryan Dahl
ab068db9b1 Improve error reporting
- No more single line "node.js:176:9" errors
- No more strange output when error happens on first line due to
  module wrapper function.
- A few tests to check these things
2010-05-09 13:55:42 -07:00
Ryan Dahl
d7762dffe3 Forgot to add child_process_should_emit_error.js 2010-05-08 23:24:24 -07:00
Felix Geisendörfer
f8a3cf980f Properly handle child process exit codes
The child process 'exit' was returning the status of the process, rather than
the exit code. This patch properly deconstructs the status into the exit code
and the term signal a process may have received.

See:
http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Watcher_Specific_Functions_and_Data_-5
and waitpid(2)
2010-04-28 13:54:17 -07:00
Felix Geisendörfer
76f98c27de Get rid of coupling for stdout 2010-04-27 17:27:34 -07:00
Jonas Pfenniger
df07a713bd New test-case: signal unregistration
The default signal-handler should be restored if no handlers are
assigned.
2010-04-25 23:14:07 -07:00
Ryan Dahl
d70474dc10 SIGPIPE on stdout should kill the process by default 2010-04-22 14:25:13 -07:00
Rhys Jones
144200435f Merge branch 'master' into openssl
Conflicts:
	lib/net.js
	wscript
2010-04-14 07:31:33 +01:00
Herbert Vojcik
c16508c87a Better require.async throw test 2010-04-08 08:17:58 -07:00
Herbert Vojcik
d36bb6536e Better require.async tests 2010-04-07 11:47:45 -07:00
Rhys Jones
c55c0a1fca Add SSL tests 2010-04-02 17:14:03 -07:00
Ryan Dahl
94644d743c Remove multipart library
Too messy, unmaintainable. Pull it out of the history if you need it.
2010-04-02 16:01:16 -07:00
Ryan Dahl
025116f8d0 Move Buffer into own module 2010-03-19 20:58:24 -07:00
Ryan Dahl
04c06b9149 child process now use net.Socket 2010-03-17 14:00:17 -07:00
Ryan Dahl
28211519b6 Merge branch 'master' into HEAD
Conflicts:
	lib/fs.js
	wscript
2010-03-12 12:42:15 -08:00
Tim-Smart
0c17067d87 Add require.registerExtension 2010-03-11 22:00:55 -08:00
isaacs
976983960d More ini parser features.
Update the ini parser to support some more whitespace cases, turn lines
without an equal sign into a "flag" that's just true if set, and support
comments.
2010-03-10 21:44:59 -08:00
Ryan Dahl
faffee0c62 Merge branch 'master' into net2 2010-03-09 10:45:06 -08:00
isaacs
5861db8a69 Remove process.mixin dependency from all tests. 2010-03-08 17:57:04 -08:00
Ryan Dahl
681733d905 Merge branch 'master' into net2 2010-03-05 20:51:26 -08:00
Rob Ellis
5c78c45fa3 Added Parse INI to Node, tests 2010-03-05 16:17:57 -08:00
Ryan Dahl
71d237e6a0 Move net2 tests into test/simple 2010-02-26 12:13:33 -08:00
arlolra
3497da370b Decoupled readdir test. 2010-02-25 18:49:10 -08:00
arlolra
04fac19822 Split tests. 2010-02-25 11:41:11 -08:00
Ryan
3fed1a0954 Use v8's test runner 2009-06-22 14:08:42 +02:00
Ryan
8b49cef10b Modify the tests to use onExit hook.
No need to rely on stdout output now.
onExit callbacks should print stack trace from onExit failure
2009-06-08 19:10:36 +02:00
Ryan
f6a7fe2657 Implement onExit() hook for modules.
onExit() is similar to the onLoad() callback. onExit() is called on each
module just before the process exits. This can be used to check state in
unit tests, but not to perform I/O. The process will forcibly exit as soon
as all of the onExit callbacks are made.
2009-06-08 16:17:33 +02:00
Ryan
b6fe4aec50 Module system refactor
There is one major API change in the refactor: filename extensions are now
required when requiring or including modules.

Added extra test to test-module-loading.js.
2009-06-08 15:34:15 +02:00
Ryan
408526a1c1 debugging/improving the module framework 2009-04-21 13:52:21 +02:00