mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
[CS2] Require Node 6.9.1+ (#4341)
* Node 6 deprecated `new Buffer` in favor of `Buffer.from` and `Buffer.alloc`; update our calls, and set the required version of Node to be >= 6.9.0, and set this to be 2.0.0-alpha for now * Bump to Node version 6.9.1
This commit is contained in:
parent
01890cd415
commit
8b50fd0461
6 changed files with 12 additions and 12 deletions
|
@ -26,7 +26,7 @@
|
|||
base64encode = function(src) {
|
||||
switch (false) {
|
||||
case typeof Buffer !== 'function':
|
||||
return new Buffer(src).toString('base64');
|
||||
return Buffer.from(src).toString('base64');
|
||||
case typeof btoa !== 'function':
|
||||
return btoa(src);
|
||||
default:
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
stat = fs.statSync(filename);
|
||||
size = Math.min(maxSize, stat.size);
|
||||
readFd = fs.openSync(filename, 'r');
|
||||
buffer = new Buffer(size);
|
||||
buffer = Buffer.alloc(size);
|
||||
fs.readSync(readFd, buffer, 0, size, stat.size - size);
|
||||
fs.closeSync(readFd);
|
||||
repl.rli.history = buffer.toString().split('\n').reverse();
|
||||
|
@ -174,8 +174,8 @@
|
|||
ref1 = process.versions.node.split('.').map(function(n) {
|
||||
return parseInt(n);
|
||||
}), major = ref1[0], minor = ref1[1], build = ref1[2];
|
||||
if (major === 0 && minor < 8) {
|
||||
console.warn("Node 0.8.0+ required for CoffeeScript REPL");
|
||||
if (major < 6) {
|
||||
console.warn("Node 6+ required for CoffeeScript REPL");
|
||||
process.exit(1);
|
||||
}
|
||||
CoffeeScript.register();
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
"compiler"
|
||||
],
|
||||
"author": "Jeremy Ashkenas",
|
||||
"version": "1.11.1",
|
||||
"version": "2.0.0-alpha",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
"node": ">=6.9.1"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "./lib/coffee-script"
|
||||
|
|
|
@ -22,7 +22,7 @@ exports.helpers = helpers
|
|||
# Function that allows for btoa in both nodejs and the browser.
|
||||
base64encode = (src) -> switch
|
||||
when typeof Buffer is 'function'
|
||||
new Buffer(src).toString('base64')
|
||||
Buffer.from(src).toString('base64')
|
||||
when typeof btoa is 'function'
|
||||
btoa(src)
|
||||
else
|
||||
|
|
|
@ -106,7 +106,7 @@ addHistory = (repl, filename, maxSize) ->
|
|||
size = Math.min maxSize, stat.size
|
||||
# Read last `size` bytes from the file
|
||||
readFd = fs.openSync filename, 'r'
|
||||
buffer = new Buffer(size)
|
||||
buffer = Buffer.alloc size
|
||||
fs.readSync readFd, buffer, 0, size, stat.size - size
|
||||
fs.closeSync readFd
|
||||
# Set the history on the interpreter
|
||||
|
@ -144,8 +144,8 @@ module.exports =
|
|||
start: (opts = {}) ->
|
||||
[major, minor, build] = process.versions.node.split('.').map (n) -> parseInt(n)
|
||||
|
||||
if major is 0 and minor < 8
|
||||
console.warn "Node 0.8.0+ required for CoffeeScript REPL"
|
||||
if major < 6
|
||||
console.warn "Node 6+ required for CoffeeScript REPL"
|
||||
process.exit 1
|
||||
|
||||
CoffeeScript.register()
|
||||
|
|
|
@ -13,7 +13,7 @@ class MockInputStream extends Stream
|
|||
resume: ->
|
||||
|
||||
emitLine: (val) ->
|
||||
@emit 'data', new Buffer("#{val}\n")
|
||||
@emit 'data', Buffer.from("#{val}\n")
|
||||
|
||||
class MockOutputStream extends Stream
|
||||
constructor: ->
|
||||
|
@ -21,7 +21,7 @@ class MockOutputStream extends Stream
|
|||
@written = []
|
||||
|
||||
write: (data) ->
|
||||
#console.log 'output write', arguments
|
||||
# console.log 'output write', arguments
|
||||
@written.push data
|
||||
|
||||
lastWrite: (fromEnd = -1) ->
|
||||
|
|
Loading…
Reference in a new issue