@makano/rew 1.1.73 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/coffeescript/browser.js +144 -139
- package/lib/coffeescript/cake.js +132 -133
- package/lib/coffeescript/coffeescript.js +437 -381
- package/lib/coffeescript/command.js +806 -724
- package/lib/coffeescript/grammar.js +1908 -2474
- package/lib/coffeescript/helpers.js +509 -473
- package/lib/coffeescript/index.js +228 -215
- package/lib/coffeescript/lexer.js +2282 -1909
- package/lib/coffeescript/nodes.js +9782 -9202
- package/lib/coffeescript/optparse.js +255 -227
- package/lib/coffeescript/parser.js +20305 -1265
- package/lib/coffeescript/register.js +107 -87
- package/lib/coffeescript/repl.js +307 -284
- package/lib/coffeescript/rewriter.js +1389 -1079
- package/lib/coffeescript/scope.js +176 -172
- package/lib/coffeescript/sourcemap.js +242 -227
- package/lib/rew/cli/cli.js +288 -186
- package/lib/rew/cli/log.js +31 -32
- package/lib/rew/cli/run.js +10 -12
- package/lib/rew/cli/utils.js +344 -176
- package/lib/rew/const/config_path.js +4 -0
- package/lib/rew/const/default.js +38 -35
- package/lib/rew/const/files.js +9 -9
- package/lib/rew/const/opt.js +8 -8
- package/lib/rew/css/theme.css +2 -2
- package/lib/rew/functions/core.js +55 -57
- package/lib/rew/functions/curl.js +23 -0
- package/lib/rew/functions/emitter.js +52 -55
- package/lib/rew/functions/exec.js +25 -21
- package/lib/rew/functions/export.js +18 -20
- package/lib/rew/functions/fs.js +55 -54
- package/lib/rew/functions/future.js +29 -21
- package/lib/rew/functions/id.js +8 -9
- package/lib/rew/functions/import.js +107 -93
- package/lib/rew/functions/map.js +13 -16
- package/lib/rew/functions/match.js +35 -26
- package/lib/rew/functions/path.js +8 -8
- package/lib/rew/functions/require.js +32 -33
- package/lib/rew/functions/sleep.js +2 -2
- package/lib/rew/functions/stdout.js +20 -20
- package/lib/rew/functions/types.js +96 -95
- package/lib/rew/html/ui.html +12 -13
- package/lib/rew/html/ui.js +205 -168
- package/lib/rew/main.js +14 -14
- package/lib/rew/misc/bin.js +37 -0
- package/lib/rew/misc/findAppInfo.js +16 -0
- package/lib/rew/misc/findAppPath.js +21 -0
- package/lib/rew/misc/req.js +7 -0
- package/lib/rew/misc/seededid.js +13 -0
- package/lib/rew/models/enum.js +12 -12
- package/lib/rew/models/struct.js +30 -32
- package/lib/rew/modules/compiler.js +237 -177
- package/lib/rew/modules/context.js +35 -22
- package/lib/rew/modules/fs.js +10 -10
- package/lib/rew/modules/runtime.js +17 -21
- package/lib/rew/modules/yaml.js +27 -30
- package/lib/rew/pkgs/conf.js +82 -75
- package/lib/rew/pkgs/data.js +12 -7
- package/lib/rew/pkgs/date.js +27 -28
- package/lib/rew/pkgs/env.js +6 -8
- package/lib/rew/pkgs/modules/data/bintree.js +52 -52
- package/lib/rew/pkgs/modules/data/doublylinked.js +85 -85
- package/lib/rew/pkgs/modules/data/linkedList.js +73 -73
- package/lib/rew/pkgs/modules/data/queue.js +19 -20
- package/lib/rew/pkgs/modules/data/stack.js +19 -19
- package/lib/rew/pkgs/modules/threads/worker.js +36 -26
- package/lib/rew/pkgs/modules/ui/classes.js +182 -178
- package/lib/rew/pkgs/pkgs.js +9 -10
- package/lib/rew/pkgs/rune.js +400 -0
- package/lib/rew/pkgs/threads.js +57 -53
- package/lib/rew/pkgs/ui.js +148 -136
- package/lib/rew/qrew/compile.js +12 -0
- package/package.json +11 -4
package/lib/coffeescript/repl.js
CHANGED
@@ -1,305 +1,328 @@
|
|
1
1
|
// Generated by CoffeeScript 2.7.0
|
2
|
-
(function() {
|
3
|
-
|
2
|
+
(function () {
|
3
|
+
var CoffeeScript,
|
4
|
+
addHistory,
|
5
|
+
addMultilineHandler,
|
6
|
+
fs,
|
7
|
+
getCommandId,
|
8
|
+
merge,
|
9
|
+
nodeREPL,
|
10
|
+
path,
|
11
|
+
replDefaults,
|
12
|
+
runInContext,
|
13
|
+
sawSIGINT,
|
14
|
+
transpile,
|
15
|
+
updateSyntaxError,
|
16
|
+
vm;
|
4
17
|
|
5
|
-
|
18
|
+
fs = require('fs');
|
6
19
|
|
7
|
-
|
20
|
+
path = require('path');
|
8
21
|
|
9
|
-
|
22
|
+
vm = require('vm');
|
10
23
|
|
11
|
-
|
24
|
+
nodeREPL = require('repl');
|
12
25
|
|
13
|
-
|
26
|
+
CoffeeScript = require('./');
|
14
27
|
|
15
|
-
|
28
|
+
({ merge, updateSyntaxError } = require('./helpers'));
|
16
29
|
|
17
|
-
|
30
|
+
sawSIGINT = false;
|
18
31
|
|
19
|
-
|
32
|
+
transpile = false;
|
20
33
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
34
|
+
replDefaults = {
|
35
|
+
prompt: 'coffee> ',
|
36
|
+
historyFile: (function () {
|
37
|
+
var historyPath;
|
38
|
+
historyPath = process.env.XDG_CACHE_HOME || process.env.HOME;
|
39
|
+
if (historyPath) {
|
40
|
+
return path.join(historyPath, '.coffee_history');
|
41
|
+
}
|
42
|
+
})(),
|
43
|
+
historyMaxInputSize: 10240,
|
44
|
+
eval: function (input, context, filename, cb) {
|
45
|
+
var Assign, Block, Call, Code, Literal, Root, Value, ast, err, isAsync, js, ref, ref1, referencedVars, result, token, tokens;
|
46
|
+
// XXX: multiline hack.
|
47
|
+
input = input.replace(/\uFF00/g, '\n');
|
48
|
+
// Node's REPL sends the input ending with a newline and then wrapped in
|
49
|
+
// parens. Unwrap all that.
|
50
|
+
input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1');
|
51
|
+
// Node's REPL v6.9.1+ sends the input wrapped in a try/catch statement.
|
52
|
+
// Unwrap that too.
|
53
|
+
input = input.replace(/^\s*try\s*{([\s\S]*)}\s*catch.*$/m, '$1');
|
54
|
+
// Require AST nodes to do some AST manipulation.
|
55
|
+
({ Block, Assign, Value, Literal, Call, Code, Root } = require('./nodes'));
|
56
|
+
try {
|
57
|
+
// Tokenize the clean input.
|
58
|
+
tokens = CoffeeScript.tokens(input);
|
59
|
+
// Filter out tokens generated just to hold comments.
|
60
|
+
if (
|
61
|
+
tokens.length >= 2 &&
|
62
|
+
tokens[0].generated &&
|
63
|
+
((ref = tokens[0].comments) != null ? ref.length : void 0) !== 0 &&
|
64
|
+
`${tokens[0][1]}` === '' &&
|
65
|
+
tokens[1][0] === 'TERMINATOR'
|
66
|
+
) {
|
67
|
+
tokens = tokens.slice(2);
|
68
|
+
}
|
69
|
+
if (
|
70
|
+
tokens.length >= 1 &&
|
71
|
+
tokens[tokens.length - 1].generated &&
|
72
|
+
((ref1 = tokens[tokens.length - 1].comments) != null ? ref1.length : void 0) !== 0 &&
|
73
|
+
`${tokens[tokens.length - 1][1]}` === ''
|
74
|
+
) {
|
75
|
+
tokens.pop();
|
76
|
+
}
|
77
|
+
// Collect referenced variable names just like in `CoffeeScript.compile`.
|
78
|
+
referencedVars = (function () {
|
79
|
+
var i, len, results;
|
80
|
+
results = [];
|
81
|
+
for (i = 0, len = tokens.length; i < len; i++) {
|
82
|
+
token = tokens[i];
|
83
|
+
if (token[0] === 'IDENTIFIER') {
|
84
|
+
results.push(token[1]);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
return results;
|
88
|
+
})();
|
89
|
+
// Generate the AST of the tokens.
|
90
|
+
ast = CoffeeScript.nodes(tokens).body;
|
91
|
+
// Add assignment to `__` variable to force the input to be an expression.
|
92
|
+
ast = new Block([new Assign(new Value(new Literal('__')), ast, '=')]);
|
93
|
+
// Wrap the expression in a closure to support top-level `await`.
|
94
|
+
ast = new Code([], ast);
|
95
|
+
isAsync = ast.isAsync;
|
96
|
+
// Invoke the wrapping closure.
|
97
|
+
ast = new Root(new Block([new Call(ast)]));
|
98
|
+
js = ast.compile({
|
99
|
+
bare: true,
|
100
|
+
locals: Object.keys(context),
|
101
|
+
referencedVars,
|
102
|
+
sharedScope: true,
|
103
|
+
});
|
104
|
+
if (transpile) {
|
105
|
+
js = transpile.transpile(js, transpile.options).code;
|
106
|
+
// Strip `"use strict"`, to avoid an exception on assigning to
|
107
|
+
// undeclared variable `__`.
|
108
|
+
js = js.replace(/^"use strict"|^'use strict'/, '');
|
109
|
+
}
|
110
|
+
result = runInContext(js, context, filename);
|
111
|
+
// Await an async result, if necessary.
|
112
|
+
if (isAsync) {
|
113
|
+
result.then(function (resolvedResult) {
|
114
|
+
if (!sawSIGINT) {
|
115
|
+
return cb(null, resolvedResult);
|
116
|
+
}
|
117
|
+
});
|
118
|
+
return (sawSIGINT = false);
|
119
|
+
} else {
|
120
|
+
return cb(null, result);
|
121
|
+
}
|
122
|
+
} catch (error) {
|
123
|
+
err = error;
|
124
|
+
// AST's `compile` does not add source code information to syntax errors.
|
125
|
+
updateSyntaxError(err, input);
|
126
|
+
return cb(err);
|
127
|
+
}
|
128
|
+
},
|
129
|
+
};
|
106
130
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
131
|
+
runInContext = function (js, context, filename) {
|
132
|
+
if (context === global) {
|
133
|
+
return vm.runInThisContext(js, filename);
|
134
|
+
} else {
|
135
|
+
return vm.runInContext(js, context, filename);
|
136
|
+
}
|
137
|
+
};
|
114
138
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
139
|
+
addMultilineHandler = function (repl) {
|
140
|
+
var inputStream, multiline, nodeLineListener, origPrompt, outputStream, ref;
|
141
|
+
({ inputStream, outputStream } = repl);
|
142
|
+
// Node 0.11.12 changed API, prompt is now _prompt.
|
143
|
+
origPrompt = (ref = repl._prompt) != null ? ref : repl.prompt;
|
144
|
+
multiline = {
|
145
|
+
enabled: false,
|
146
|
+
initialPrompt: origPrompt.replace(/^[^> ]*/, function (x) {
|
147
|
+
return x.replace(/./g, '-');
|
148
|
+
}),
|
149
|
+
prompt: origPrompt.replace(/^[^> ]*>?/, function (x) {
|
150
|
+
return x.replace(/./g, '.');
|
151
|
+
}),
|
152
|
+
buffer: '',
|
153
|
+
};
|
154
|
+
// Proxy node's line listener
|
155
|
+
nodeLineListener = repl.listeners('line')[0];
|
156
|
+
repl.removeListener('line', nodeLineListener);
|
157
|
+
repl.on('line', function (cmd) {
|
158
|
+
if (multiline.enabled) {
|
159
|
+
multiline.buffer += `${cmd}\n`;
|
160
|
+
repl.setPrompt(multiline.prompt);
|
161
|
+
repl.prompt(true);
|
162
|
+
} else {
|
163
|
+
repl.setPrompt(origPrompt);
|
164
|
+
nodeLineListener(cmd);
|
165
|
+
}
|
166
|
+
});
|
167
|
+
// Handle Ctrl-v
|
168
|
+
return inputStream.on('keypress', function (char, key) {
|
169
|
+
if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'v')) {
|
170
|
+
return;
|
171
|
+
}
|
172
|
+
if (multiline.enabled) {
|
173
|
+
// allow arbitrarily switching between modes any time before multiple lines are entered
|
174
|
+
if (!multiline.buffer.match(/\n/)) {
|
175
|
+
multiline.enabled = !multiline.enabled;
|
176
|
+
repl.setPrompt(origPrompt);
|
177
|
+
repl.prompt(true);
|
178
|
+
return;
|
179
|
+
}
|
180
|
+
// no-op unless the current line is empty
|
181
|
+
if (repl.line != null && !repl.line.match(/^\s*$/)) {
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
// eval, print, loop
|
185
|
+
multiline.enabled = !multiline.enabled;
|
186
|
+
repl.line = '';
|
187
|
+
repl.cursor = 0;
|
188
|
+
repl.output.cursorTo(0);
|
189
|
+
repl.output.clearLine(1);
|
190
|
+
// XXX: multiline hack
|
191
|
+
multiline.buffer = multiline.buffer.replace(/\n/g, '\uFF00');
|
192
|
+
repl.emit('line', multiline.buffer);
|
193
|
+
multiline.buffer = '';
|
194
|
+
} else {
|
195
|
+
multiline.enabled = !multiline.enabled;
|
196
|
+
repl.setPrompt(multiline.initialPrompt);
|
197
|
+
repl.prompt(true);
|
198
|
+
}
|
199
|
+
});
|
200
|
+
};
|
177
201
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
202
|
+
// Store and load command history from a file
|
203
|
+
addHistory = function (repl, filename, maxSize) {
|
204
|
+
var buffer, fd, lastLine, readFd, size, stat;
|
205
|
+
lastLine = null;
|
206
|
+
try {
|
207
|
+
// Get file info and at most maxSize of command history
|
208
|
+
stat = fs.statSync(filename);
|
209
|
+
size = Math.min(maxSize, stat.size);
|
210
|
+
// Read last `size` bytes from the file
|
211
|
+
readFd = fs.openSync(filename, 'r');
|
212
|
+
buffer = Buffer.alloc(size);
|
213
|
+
fs.readSync(readFd, buffer, 0, size, stat.size - size);
|
214
|
+
fs.closeSync(readFd);
|
215
|
+
// Set the history on the interpreter
|
216
|
+
repl.history = buffer.toString().split('\n').reverse();
|
217
|
+
if (stat.size > maxSize) {
|
218
|
+
// If the history file was truncated we should pop off a potential partial line
|
219
|
+
repl.history.pop();
|
220
|
+
}
|
221
|
+
if (repl.history[0] === '') {
|
222
|
+
// Shift off the final blank newline
|
223
|
+
repl.history.shift();
|
224
|
+
}
|
225
|
+
repl.historyIndex = -1;
|
226
|
+
lastLine = repl.history[0];
|
227
|
+
} catch (error) {}
|
228
|
+
fd = fs.openSync(filename, 'a');
|
229
|
+
repl.addListener('line', function (code) {
|
230
|
+
if (code && code.length && code !== '.history' && code !== '.exit' && lastLine !== code) {
|
231
|
+
// Save the latest command in the file
|
232
|
+
fs.writeSync(fd, `${code}\n`);
|
233
|
+
return (lastLine = code);
|
234
|
+
}
|
235
|
+
});
|
236
|
+
// XXX: The SIGINT event from REPLServer is undocumented, so this is a bit fragile
|
237
|
+
repl.on('SIGINT', function () {
|
238
|
+
return (sawSIGINT = true);
|
239
|
+
});
|
240
|
+
repl.on('exit', function () {
|
241
|
+
return fs.closeSync(fd);
|
242
|
+
});
|
243
|
+
// Add a command to show the history stack
|
244
|
+
return (repl.commands[getCommandId(repl, 'history')] = {
|
245
|
+
help: 'Show command history',
|
246
|
+
action: function () {
|
247
|
+
repl.outputStream.write(`${repl.history.slice(0).reverse().join('\n')}\n`);
|
248
|
+
return repl.displayPrompt();
|
249
|
+
},
|
250
|
+
});
|
251
|
+
};
|
228
252
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
253
|
+
getCommandId = function (repl, commandName) {
|
254
|
+
var commandsHaveLeadingDot;
|
255
|
+
// Node 0.11 changed API, a command such as '.help' is now stored as 'help'
|
256
|
+
commandsHaveLeadingDot = repl.commands['.help'] != null;
|
257
|
+
if (commandsHaveLeadingDot) {
|
258
|
+
return `.${commandName}`;
|
259
|
+
} else {
|
260
|
+
return commandName;
|
261
|
+
}
|
262
|
+
};
|
239
263
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
264
|
+
module.exports = {
|
265
|
+
start: function (opts = {}) {
|
266
|
+
var Module, build, major, minor, originalModuleLoad, repl;
|
267
|
+
[major, minor, build] = process.versions.node.split('.').map(function (n) {
|
268
|
+
return parseInt(n, 10);
|
269
|
+
});
|
270
|
+
if (major < 6) {
|
271
|
+
console.warn('Node 6+ required for CoffeeScript REPL');
|
272
|
+
process.exit(1);
|
273
|
+
}
|
274
|
+
CoffeeScript.register();
|
275
|
+
process.argv = ['coffee'].concat(process.argv.slice(2));
|
276
|
+
if (opts.transpile) {
|
277
|
+
transpile = {};
|
278
|
+
try {
|
279
|
+
transpile.transpile = require('@babel/core').transform;
|
280
|
+
} catch (error) {
|
281
|
+
try {
|
282
|
+
transpile.transpile = require('babel-core').transform;
|
283
|
+
} catch (error) {
|
284
|
+
console.error(`To use --transpile with an interactive REPL, @babel/core must be installed either in the current folder or globally:
|
261
285
|
npm install --save-dev @babel/core
|
262
286
|
or
|
263
287
|
npm install --global @babel/core
|
264
288
|
And you must save options to configure Babel in one of the places it looks to find its options.
|
265
289
|
See https://coffeescript.org/#transpilation`);
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
290
|
+
process.exit(1);
|
291
|
+
}
|
292
|
+
}
|
293
|
+
transpile.options = {
|
294
|
+
filename: path.resolve(process.cwd(), '<repl>'),
|
295
|
+
};
|
296
|
+
// Since the REPL compilation path is unique (in `eval` above), we need
|
297
|
+
// another way to get the `options` object attached to a module so that
|
298
|
+
// it knows later on whether it needs to be transpiled. In the case of
|
299
|
+
// the REPL, the only applicable option is `transpile`.
|
300
|
+
Module = require('module');
|
301
|
+
originalModuleLoad = Module.prototype.load;
|
302
|
+
Module.prototype.load = function (filename) {
|
303
|
+
this.options = {
|
304
|
+
transpile: transpile.options,
|
305
|
+
};
|
306
|
+
return originalModuleLoad.call(this, filename);
|
307
|
+
};
|
308
|
+
}
|
309
|
+
opts = merge(replDefaults, opts);
|
310
|
+
repl = nodeREPL.start(opts);
|
311
|
+
if (opts.prelude) {
|
312
|
+
runInContext(opts.prelude, repl.context, 'prelude');
|
313
|
+
}
|
314
|
+
repl.on('exit', function () {
|
315
|
+
if (!repl.closed) {
|
316
|
+
return repl.outputStream.write('\n');
|
317
|
+
}
|
318
|
+
});
|
319
|
+
addMultilineHandler(repl);
|
320
|
+
if (opts.historyFile) {
|
321
|
+
addHistory(repl, opts.historyFile, opts.historyMaxInputSize);
|
322
|
+
}
|
323
|
+
// Adapt help inherited from the node REPL
|
324
|
+
repl.commands[getCommandId(repl, 'load')].help = 'Load code from a file into this REPL session';
|
325
|
+
return repl;
|
326
|
+
},
|
327
|
+
};
|
305
328
|
}).call(this);
|