Commit Graph

81 Commits

Author SHA1 Message Date
Ben Newman
c6bc841386 Bump package patch versions for minimongo and shell-server changes. 2017-12-02 17:49:56 -05:00
Jesse Rosenberger
aec76b766c Only import start from repl instead of the entire module.
It was previously necessary to have more from the `repl` module, but
it's sufficient to just have `start` now since we wrap the default
`eval`.
2017-11-30 19:57:00 +02:00
Jesse Rosenberger
0df8a5a516 Ensure that require and module are always set.
I previously had thought that a duplicate call to `setRequireAndModule`
encountered in code-path would no longer be necessary after some
consolidation in previous steps of this re-factor, but the test failure
seen here made it clear what was happening:

https://circleci.com/gh/meteor/meteor/12445

Specifically, if a module was imported in a piped command (that is to say,
when no TTY is present and the `evaluateAndExit` code-path is taken), as so:

    echo 'import { Meteor } from "meteor/meteor"' | meteor shell

...the `module` and `require` symbols were not set.  Conveniently, this is
the environment in effect when the `meteor self-test` suite is ran since
they do not have a TTY.

This moves the `setAndRequire` from the "interactive-only" function into
the general REPL setup and further harmonizes the code.
2017-11-28 18:35:04 +02:00
Jesse Rosenberger
724a801d70 Remove unnecessary setting of repl.context.
This is superfluous residue that I inadvertently created when splitting the
existing `startREPL` function into `setupREPL` and `enableInteractiveMode`.

The context is already set in `setupREPL` (to the exact same value as
here) by the time that this occurrence in `enableInteractiveMode` is called.
2017-11-28 18:31:26 +02:00
Jesse Rosenberger
c8b5f42d05 Modernization of shell-server package. 2017-11-28 16:58:11 +02:00
Jesse Rosenberger
e0682c553d Wrap default repl "eval" function, rather than duplicating logic.
Addresses feedback from @benjamn.

Rather than copying the `IsRecoverableError` and `isCodeRecoverable`
methods from the Node.js `repl` module source (in order to capture
so-called "Recoverable" errors), wrap the default "eval" function with
our relatively thin logic, thus avoiding the need to continually update
the definition of what's "recoverable" as Node's implementation evolves.
2017-11-28 16:55:27 +02:00
Jesse Rosenberger
15b24ff6d1 Again, correct the context of _ within meteor shell.
A truthy `useGlobal` option when calling Node's `repl.start()` will use
the `global` context, which will allow global Meteor variables (such as
the global `_` provided by the `underscore`) to be available in the context
of the REPL shell.  This sounds desirable, and in fact, the original
implementation set it as such, only to be later changed to `false` in
https://github.com/meteor/meteor/commit/7c7e52f2d2, specifically to
avoid the undesirable behavior of Node REPL stomping on the global `_`
variable with its own special-meaning `_` variable which is set to the
value of the most recently eval'd expression.

This was once again changed to `true` to fix the lost tab-completion
functionality, thanks to https://github.com/meteor/meteor/commit/2443d83226,
which also implelented special mutator on `_` to avoid breaking
it.  As it's probably clear now, this has been a struggle, and because
of Node using its own `Object.defineProperty('_', ...)` as of Node.js 6
(in https://github.com/nodejs/node/pull/5535/files), this problem has
surfaced again, as reported in https://github.com/meteor/meteor/issues/9276.

This changes the behavior to another implementation which starts with
`useGlobal` set to `false`, but then sets the context immediately to
`global`, which seems to avoid the problem.

It's possible that another option might be to set explicitly set the
`underscoreAssigned` attribute on the `repl` after starting it, however
since that's an internal, undocumented property, it might be best to avoid.

This does maintain the existing behavior of our special
double-underscore variable, in order to get the value of the last
REPL expression, in the same manner as `_` would in a normal REPL, by
accessing the internal `last` property.  Since this is also undocumented
(on our end), this seemed reasonable.
2017-11-22 01:12:22 +02:00
Jesse Rosenberger
545a7e1df2 Stop stripping parens from ES classes used in the REPL.
As Node.js 8 natively supports ECMAScript classes, this code shouldn't
be necessary anymore.
2017-11-21 22:28:40 +02:00
Jesse Rosenberger
5849af067b Use the (now) repl-exported Recoverable error.
In order to catch so-called "recoverable" REPL errors (for example,
commands in the process of being inputted which are syntax errors until
they are completed/recovered), it had previously been necessary to
intentionally cause such an error and save the error's prototype for
future use.

Node 6 changed this by exporting the Error directly from the `repl`
module, and this commit represents the changes necessary to remove that
(now unnecessary) behavior.

This also takes the opportunity to update the `isRecoverableError` (and
related) functions which had previously been borrowed from the `repl`
module source, to their newer versions.
2017-11-21 22:28:40 +02:00
Jesse Rosenberger
83eba20918 Remove unused _inTemplateLiteral stored on repl instance. 2017-11-21 22:28:40 +02:00
Ben Newman
0bff81f0b4 Bump package versions for the official 1.6 release. 2017-10-27 13:00:43 -04:00
Ben Newman
b63ab27986 Bump package versions for 1.6-rc.18 release. 2017-10-26 11:37:15 -04:00
Ben Newman
24c80da9ef Bump package versions for 1.6-rc.17 release. 2017-10-24 18:45:30 -04:00
Ben Newman
d317c29319 Bump package versions for 1.6-rc.16 release. 2017-10-20 16:13:31 -04:00
Ben Newman
6d528e334f Bump package versions for 1.6-rc.15 release. 2017-10-18 21:52:17 -04:00
Ben Newman
22930e876e Bump package versions for 1.6-rc.14 release. 2017-10-17 16:29:44 -04:00
Ben Newman
e2db34bdc5 Bump package versions for 1.6-rc.13 release. 2017-10-16 16:04:42 -04:00
Ben Newman
5a8c0f2743 Bump package versions for 1.6-rc.12 release. 2017-10-16 14:07:19 -04:00
Ben Newman
2777f5f6f7 Bump package versions for 1.6-rc.11 release. 2017-10-16 10:00:45 -04:00
Ben Newman
c476188cc6 Bump package versions for 1.6-rc.10 release. 2017-10-14 15:00:41 -04:00
Ben Newman
5d7058dc17 Bump package versions for 1.6-rc.9 release. 2017-10-13 13:54:47 -04:00
Ben Newman
fdaa0f5145 Bump package versions for 1.6-rc.8 release. 2017-10-12 17:42:21 -04:00
Ben Newman
3b93934217 Bump package versions for 1.6-rc.7 release. 2017-10-12 11:23:36 -04:00
Ben Newman
40ecbb27f2 Bump package versions for 1.6-rc.6 release. 2017-10-10 10:05:36 -04:00
Ben Newman
0c7f4b89a7 Bump package versions for 1.6-rc.5 release. 2017-10-08 20:04:53 -04:00
Ben Newman
25e0a54d4e Bump package versions for 1.6-rc.4 release. 2017-10-08 14:37:19 -04:00
Ben Newman
158b6ceb7e Bump package versions for 1.6-rc.3 release. 2017-10-03 12:13:43 -04:00
Ben Newman
ac04df949b Bump package versions for 1.6-rc.2 release. 2017-10-02 13:46:44 -04:00
Ben Newman
3be6913c4d Bump package versions for 1.6-rc.1 release. 2017-09-29 18:17:09 -04:00
Ben Newman
d07ea5e288 Bump package versions for 1.6-rc.0 release. 🎉 2017-09-28 14:43:50 -04:00
Ben Newman
fd3ea1b9e1 Bump package versions for 1.6-beta.32 release. 2017-09-26 14:47:57 -04:00
Ben Newman
6e09542ead Bump package versions for 1.6-beta.31 release. 2017-09-22 18:51:30 -04:00
Ben Newman
bfea51815a Bump package versions for 1.6-beta.30 release. 2017-09-18 17:31:25 -04:00
Ben Newman
c5e2bc3ca1 Bump package versions for 1.6-beta.29 release. 2017-09-18 15:01:07 -04:00
Ben Newman
f9c566fbc6 Bump package versions for 1.6-beta.28 release. 2017-09-18 12:45:53 -04:00
Ben Newman
7d98df9ee6 Bump package versions for 1.6-beta.27 release. 2017-09-14 17:57:22 -04:00
Ben Newman
3ad0034779 Bump package versions for 1.6-beta.26 release. 2017-09-06 12:25:20 -04:00
Ben Newman
844715de88 Bump package versions for 1.6-beta.25 release. 2017-09-05 22:05:58 -04:00
Ben Newman
ba42d791b1 Bump package versions for 1.6-beta.24 release. 2017-08-22 22:15:34 -04:00
Ben Newman
d464b72d7a Bump package versions for 1.6-beta.23 release. 2017-08-17 10:29:56 -04:00
Ben Newman
8822e90f87 Bump package versions for 1.6-beta.22 release. 2017-08-16 14:17:03 -04:00
Ben Newman
b290bcaa1b Bump package versions for 1.6-beta.21 release. 2017-08-15 12:27:21 -04:00
Ben Newman
8e10361721 Bump package versions for 1.6-beta.20 release. 2017-08-14 22:53:13 -04:00
Ben Newman
73b43690ef Bump package versions for 1.6-beta.19 release. 2017-08-11 17:28:19 -04:00
Ben Newman
2c042016fe Bump package versions for 1.6-beta.18 release. 2017-08-10 19:05:35 -04:00
Ben Newman
1e7a7c451d Bump package versions for 1.6-beta.17 release. 2017-08-10 13:46:45 -04:00
Ben Newman
5a8e6b0639 Bump package versions for 1.6-beta.16 release. 2017-08-08 19:33:04 -04:00
Ben Newman
6d8f10ff3a Bump package versions for 1.6-beta.15 release. 2017-07-28 18:48:10 -04:00
Ben Newman
b2ef3be175 Bump package versions for 1.6-beta.14 release. 2017-07-22 22:06:10 -04:00
Ben Newman
7b85cbd746 Bump package versions for 1.6-beta.13 release. 2017-07-22 12:36:12 -04:00