Commit Graph

333 Commits

Author SHA1 Message Date
koichik
d6ec8f668e Fix -e/--eval can't load module from node_modules
With -e or --eval, require() can load module using relative path.

    node -e 'require("./foo")'

But it can't load module from node_modules directory.

    node -e 'require("foo")'

Fixes #1196.
2011-06-20 13:47:27 +02:00
Ryan Dahl
55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
Ryan Dahl
2a05fe784d Do not use defineGetter in src/node.js for better crankshaft perf
See: https://groups.google.com/d/topic/nodejs/xJqpp1_s6is/discussion
2011-03-14 12:48:37 -07:00
cloudhead
a91b140963 fix process.on edge case with signal event
When adding a listener for a signal event, removing it, and
adding it back again, it triggers a condition with an
undefined variable.
2011-02-23 12:57:05 -08:00
Tj Holowaychuk
42a369620f Fixed null signal preservation
Closes GH-674.
2011-02-15 16:35:50 -08:00
Ryan Dahl
3ec030535c stderr should be EventEmitter even if it doesn't emit anything 2011-02-07 15:14:21 -08:00
Ryan Dahl
bc23ec8d05 Add process.stderr stream 2011-02-03 14:03:44 -08:00
Ryan Dahl
bfb6a67d60 Another fix for process.assert 2011-01-27 16:59:28 -08:00
Ryan Dahl
f9f0e5c75c Pre-process out assert() 2011-01-27 16:38:49 -08:00
Felix Geisendörfer
91cc2d8c4b Restructure src/node.js startup code
This patch introduces a logical structure and sequence for the
bootstrap code found src/node.js.
2011-01-24 14:52:25 -08:00
Ryan Dahl
9e976abad9 lint 2011-01-24 10:55:30 -08:00
Felix Geisendörfer
5a49f96505 Move commonjs module system into lib/module.js
This de-couples NativeModule from the module system and completes the
main objective of this refactoring.
2011-01-23 14:53:17 -08:00
Bert Belder
0b5bf70bff Use tty.ReadStream and tty.WriteStream for stdio when appropriate 2011-01-18 23:22:38 -08:00
Felix Geisendörfer
0263f01475 Fix test-require-cache-without-stat.js
This path adds an additional cache to the module system for caching the
location of previously required modules. Since it is embedded in the
loop that iterates over all require.paths, this patch also handles the
case where require.paths is being modified.

The patch also cleans up some code around it.

See: https://groups.google.com/forum/#!topic/nodejs-dev/QGGlrvLDHVs
2011-01-16 14:52:55 -08:00
Felix Geisendörfer
f39fdf2610 Isolate native module system again
See: 2e5dfafcb0 (commitcomment-239719)
2011-01-16 14:51:21 -08:00
Ryan Dahl
d9087c10ad style 2011-01-16 00:33:16 -08:00
Ryan Dahl
496be457b6 Allow third party hooks before main module load
Just put a file lib/_third_party_main.js into the build directory and take
it from there.
2011-01-13 16:30:29 -08:00
Felix Geisendörfer
f5fbb707b2 Fix NODE_PATH, was broken after cleanup 2011-01-12 16:07:36 -08:00
Felix Geisendörfer
f61277ecb0 Always init module paths
The previous cleanup patch broke module loading in the the REPL by
not initializing require.paths.
2011-01-12 16:07:07 -08:00
Felix Geisendörfer
2e5dfafcb0 Cleanup node module system code 2011-01-12 13:32:06 -08:00
Ryan Dahl
5342e3e925 expose module wrapper to native modules 2011-01-08 19:09:33 -08:00
Mihai Călin Bazon
0853730c35 realpath files during module load 2011-01-07 13:00:19 -08:00
Ryan Dahl
5a05992155 Lint 2011-01-06 16:06:27 -08:00
Bert Belder
1ac133ea6f Replace string magic + path.join by path.resolve
Because path.resolve is more elegant and windows-safe.
2011-01-06 15:39:51 -08:00
isaacs
48334dc0b1 Fix regression introduced in fe804d9b
It breaks argv[0] on posix systems, and makes it so that npm can't
determine whether node was run from an explicit location, or via "node",
so the configs default improperly.

If on windows, don't do this behavior.  On posix, go back to the old
behavior.
2011-01-06 14:39:06 -08:00
Bert Belder
fe6f363837 Revert "realpath files during module load"
This reverts commit 131546e733.

Doesn't work on windows, coming back soon.
2011-01-04 17:04:00 -08:00
Bert Belder
3c330b05b1 Merge branch 'master' of git://github.com/ry/node
Conflicts:
	src/node.cc
	src/node.js
2011-01-05 00:41:59 +01:00
Mihai Călin Bazon
131546e733 realpath files during module load 2011-01-04 12:24:17 -08:00
Ryan Dahl
e4dd5cd6fd NODE_DEBUG uses strings instead of bitflags 2011-01-03 15:41:58 -08:00
Ryan Dahl
6593a96373 Merge branch 'debugger' 2011-01-03 10:27:16 -08:00
Bert Belder
33118df8f9 Merge remote branch 'origin/master'
Conflicts:
	src/node_net.cc
	src/node_os.cc
2011-01-02 22:57:32 +01:00
Ryan Dahl
2e3e95ee89 add process.stdin 2011-01-01 21:54:46 -08:00
Ryan Dahl
29626d8731 Syntax error hack for modules. 2011-01-01 21:14:24 -08:00
Ryan Dahl
1c7cd4aac3 Make syntax error display optional
Fixes GH-543
2011-01-01 16:38:31 -08:00
Ryan Dahl
90e55c3357 Rather have the debugger be parent process 2010-12-30 01:35:13 -08:00
Ryan Dahl
8d82ec2130 Add beginning of build-in debugger
+ test-debugger-client (which is currently broken)
2010-12-30 01:35:11 -08:00
Bert Belder
fe804d9bc7 _Partial_ backslash support in node.js argv directory munging
Doesn't do it when node is started from another drive using a drive-relative path.
E.g:
  d:
  cd nodejs
  c:
  d:node.exe d:test.js
2010-12-20 23:51:27 +01:00
Felix Geisendörfer
e27418ca3f Prefer require.cache over native module cache
This patch changes node's module loading behavior so that the
require.cache is always the first place to consider when loading a
module.

The motivation for this change is to help people who are writing
focused tests for their node.js applications, and need a mechanism
to inject test doubles to replace native node.js modules.
2010-12-13 17:58:24 -08:00
Ryan Dahl
180dfca03f Pretty error message messes up if readFileSync in main module fails.
TODO test/message test for this.
2010-12-07 11:29:20 -08:00
Ryan Dahl
5a21138e37 fix global leak 2010-12-04 13:39:28 -08:00
Anders Conbere
e9c7195471 Reworks the two functions traverser and findModulePath into a more readable form.
This is not the supposed end of these changes, but a first change that
should make future changes easier to reason about.
2010-12-04 13:20:01 -08:00
Ryan Dahl
da96e07bbe fix global leak 2010-12-02 16:45:34 -08:00
Ryan Dahl
558e5ba2b0 lint util.js and src/node.js 2010-12-02 12:27:26 -08:00
Ryan Dahl
70188499b0 Lazy load console object 2010-11-30 11:18:02 -08:00
Ryan Dahl
b6face1dce Remove unnecessary variable def 2010-11-29 15:04:39 -08:00
isaacs
b52b4196ab Fix problem with requireNative not exporting 'module' object
Broke require('constants'). Add unrelated test which breaks it.
2010-11-22 11:55:31 -08:00
Ben Noordhuis
f0b8cc6a94 require() should work with node --eval.
with tests

Fix module path resolve bug.  Normally the module path is taken from
realpath(__filename) but with eval there is (of course) no filename
2010-11-21 20:24:26 -08:00
Herbert Vojčík
3422263414 requireNative made independent on module system 2010-11-21 18:17:44 -08:00
Ryan Dahl
a16b3c3148 Use runInNewContext instead of process.compile 2010-11-21 15:16:02 -08:00
Ryan Dahl
b1088d6bd2 Load 'path' module with requireNative
(now that requireNative does not depend on path module)
2010-11-21 15:07:38 -08:00