Nathan Rajlich
bdb9d09aef
Print out `undefined` on the REPL when returned.
util.inspect() has a special case for "undefined", so it's nice to be able to
distinguish visually that undefined is the result of an expression.
13 years ago
isaacs
2d02e6a992
Add useGlobal flag for standard node repl
13 years ago
isaacs
caf70f5e94
Revert "Don't use a separate context for the repl."
This reverts commit b70fed48a7
.
13 years ago
Nathan Rajlich
95d530f2b4
repl: print out `undefined`
util.inspect() has a special case for "undefined", so it's nice to be able to
distinguish visually that undefined is the result of an expression.
13 years ago
isaacs
b70fed48a7
Don't use a separate context for the repl.
Fix #1484
Fix #1834
Fix #1482
Fix #771
It's been a while now, and we've seen how this separate context thing
works. It constantly confuses people, and no one actually uses '.clear'
anyway, so the benefit of that feature does not justify the constant
WTFery.
This makes repl.context actually be a getter that returns the global
object, and prints a deprecation warning. The '.clear' command is gone,
and will report that it's an invalid repl keyword. Tests updated to
allow the require, module, and exports globals, which are still
available in the repl just like they were before, by making them global.
13 years ago
Colton Baker
87286cc737
Fixed a lot of jslint errors.
Fixes #1831
13 years ago
Bert Belder
81425598db
Enable console colors on windows by default
13 years ago
Fedor Indutny
67706b8bb7
Export disableColors from repl, share with debugger
13 years ago
Fedor Indutny
2010071339
readline: custom streams support
13 years ago
Fedor Indutny
1e37efb08b
initial tests
* Don't buffer command, before it's execution (repl)
* `quit` command, custom streams for .start, stubbed out test, disable
history repeation for non-tty (debugger)
13 years ago
isaacs
e06ce7562c
Fix #1707 hasOwnProperty usage
If hasOwnProperty is overridden, then calling `obj.hasOwnProperty(prop)`
can fail. Any time a dictionary of user-generated items is built, we
cannot rely on hasOwnProperty being safe, so must call it from the
Object.prototype explicitly.
13 years ago
isaacs
98990b9779
Fix #1707 hasOwnProperty usage
13 years ago
Fedor Indutny
41a41825f6
micro-refactor, use rli.output.write instead of rli.write ('line' event was emitted for those writes)
13 years ago
Fedor Indutny
57388d8b2e
[repl] add error handling for async scope fetching
13 years ago
Fedor Indutny
df480e0357
fix syntax error handling for 'throw ...', fix return value assertion
13 years ago
Fedor Indutny
e13ed4a8d0
[repl, readline] refactor async completion and execution
14 years ago
Fedor Indutny
0d4dc3a8b5
[repl] let self.eval be configurable on REPLServer initialization
14 years ago
Fedor Indutny
eab65e214e
[repl] Async global completion
14 years ago
Fedor Indutny
71a9aefa0f
[readline, repl] Fix completion grouping, fix parens eval results
handling
14 years ago
Fedor Indutny
42b8b77d9f
[repl, readline] async interface
Add async completion and execution interface for repl and readline
14 years ago
Nathan Rajlich
cf24f561a3
repl: don't eval twice when an Error is thrown
14 years ago
Nathan Rajlich
8ec31a3362
Use Object.getPrototypeOf() on the object in the REPL tab-completion.
Some people use __proto__ to augment an Object's prototype after it's been created.
This patch helps make the "new" prototype properties visible if necessary.
This is also more consistent with the while logic below.
14 years ago
Robert Mustacchi
de0b8d601c
jslint cleanup: path.js, readline.js, repl.js, tls.js, tty_win32.js, url.js
14 years ago
isaacs
c050d0fa19
Finish removing require.paths
Fix require() completion bug in repl, and correct man output
14 years ago
isaacs
bbffd9e502
Close #983 Better JSON.parse error detection
Previous pattern would only catch ILLEGAL, not { or other
known-but-unexpected JSON tokens.
14 years ago
Tim Baumann
6c7c4aeab6
Don't overwrite an user-specified repl.writer
14 years ago
Wade Simmons
d00739ce56
make it possible to do repl.start('', stream)
14 years ago
isaacs
0b3ecc05a6
Close #955 Change ^C handling in REPL
Press with text on the line: Cancels
Press on a bare line: Print a message
Press again on a bare line: Exit
14 years ago
Ben Weaver
d63a551f86
Update how REPLServer uses contexts
* Always use `this.context` or `self.context`.
* Move `resetContext` to `REPLServer.createContext`.
* Add `REPLServer.resetContext`, memoize `context` here.
* Memoize `exports.repl` in `start`.
Closes GH-851.
14 years ago
Ryan Dahl
55048cdf79
Update copyright headers
14 years ago
isaacs
a48f73d0d3
Closes GH-232 Make the repl's global the right thing
14 years ago
isaacs
2cfe7b847d
Closes GH-184 Clear require cache on repl .clear
14 years ago
isaacs
f07041e6cd
Make the repl respect node_modules folders.
This is important so that in the future, this will work:
$ cd ~/dev/js/some-project
$ npm install redis
$ node
> require.resolve('redis')
'/Users/isaacs/dev/js/some-project/node_modules/redis/index.js'
14 years ago
Ryan Dahl
192d2e0803
REPL: disable colors in windows for now
14 years ago
Ryan Dahl
9e976abad9
lint
14 years ago
Ryan Dahl
ba80d4d8a9
Transfer data gathering responsibility to readline
Fixes non-raw REPL/Debugger on Posix.
14 years ago
Bert Belder
4475b76535
Readline: use symbolic key names instead of ascii control codes
14 years ago
Ryan Dahl
5a05992155
Lint
14 years ago
Bert Belder
1ac133ea6f
Replace string magic + path.join by path.resolve
Because path.resolve is more elegant and windows-safe.
14 years ago
Ryan Dahl
b6dafc1a47
Allow for two streams in REPL
Towards windows compatibility.
14 years ago
Ryan Dahl
feb77eab65
Fix REPL for named functions
add some tests.
14 years ago
Ryan Dahl
c82fe30ca1
repl.js style
14 years ago
Ryan Dahl
00974df3e5
Allow for evaling statements in REPL too
14 years ago
Ryan Dahl
b45698e676
Improve how REPL commands are evaled
Before:
> {a: 1}
1
> (function() {
... // foo
... return 1;
... })();
...
Now:
> {a: 1}
{ a : 1 }
> (function() {
... // foo
... return 1;
... })();
1
>
14 years ago
Brian White
6d75c06e64
Add os module to repl's built-in lib list
14 years ago
Brian White
e41e078159
Make sure REPL doesn't get borked when invalid REPL keywords are entered
14 years ago
Ryan Dahl
e232f6e735
more lint
14 years ago
Marco Rogers
118b88e44f
update repl to distinguish JSON.parse SyntaxErrors from the rest
14 years ago
Brian White
5908bdab9a
Make sure raw mode is disabled when exiting a terminal-based REPL.
14 years ago
Ryan Dahl
8e09b1e2e1
Simplify REPL displayPrompt
Now that we insert \r into the stream and aren't switching back and forth
between termios modes, not need to worry about when to display the prompt.
14 years ago