mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
pushing this waypoint...
This commit is contained in:
parent
55e794dbe5
commit
4b0fabd7cb
4 changed files with 82 additions and 11 deletions
|
@ -1097,6 +1097,33 @@ Expressions
|
|||
Change Log
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">
|
||||
<a href="https://github.com/jashkenas/coffee-script/compare/1.1.3...1.2.0">1.2.0</a>
|
||||
<span class="timestamp"> – <small>Dec. 18, 2011</small></span>
|
||||
</b>
|
||||
<ul>
|
||||
<li>
|
||||
Multiple improvements to <tt>coffee --watch</tt> and <tt>--join</tt>.
|
||||
You may now use both together, as well as add and remove
|
||||
files and directories within a <tt>--watch</tt>'d folder.
|
||||
</li>
|
||||
<li>
|
||||
The <tt>throw</tt> statement can now be used as part of an expression.
|
||||
</li>
|
||||
<li>
|
||||
Block comments at the top of the file will now appear outside of the
|
||||
safety closure wrapper.
|
||||
</li>
|
||||
<li>
|
||||
Fixed a number of minor 1.1.3 regressions having to do with trailing
|
||||
operators and unfinished lines, and a more major 1.1.3 regression that
|
||||
caused bound functions <i>within</i> bound class functions to have the incorrect
|
||||
<tt>this</tt>.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">
|
||||
<a href="https://github.com/jashkenas/coffee-script/compare/1.1.2...1.1.3">1.1.3</a>
|
||||
|
|
27
index.html
27
index.html
|
@ -2225,6 +2225,33 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
Change Log
|
||||
</h2>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">
|
||||
<a href="https://github.com/jashkenas/coffee-script/compare/1.1.3...1.2.0">1.2.0</a>
|
||||
<span class="timestamp"> – <small>Dec. 18, 2011</small></span>
|
||||
</b>
|
||||
<ul>
|
||||
<li>
|
||||
Multiple improvements to <tt>coffee --watch</tt> and <tt>--join</tt>.
|
||||
You may now use both together, as well as add and remove
|
||||
files and directories within a <tt>--watch</tt>'d folder.
|
||||
</li>
|
||||
<li>
|
||||
The <tt>throw</tt> statement can now be used as part of an expression.
|
||||
</li>
|
||||
<li>
|
||||
Block comments at the top of the file will now appear outside of the
|
||||
safety closure wrapper.
|
||||
</li>
|
||||
<li>
|
||||
Fixed a number of minor 1.1.3 regressions having to do with trailing
|
||||
operators and unfinished lines, and a more major 1.1.3 regression that
|
||||
caused bound functions <i>within</i> bound class functions to have the incorrect
|
||||
<tt>this</tt>.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b class="header" style="margin-top: 20px;">
|
||||
<a href="https://github.com/jashkenas/coffee-script/compare/1.1.2...1.1.3">1.1.3</a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(function() {
|
||||
var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, forkNode, fs, helpers, lint, loadRequires, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, usage, version, watch, watchDir, watchers, writeJs, _ref;
|
||||
var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, forkNode, fs, helpers, lint, loadRequires, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, usage, version, wait, watch, watchDir, watchers, writeJs, _ref;
|
||||
|
||||
fs = require('fs');
|
||||
|
||||
|
@ -201,7 +201,7 @@
|
|||
};
|
||||
compile = function() {
|
||||
clearTimeout(compileTimeout);
|
||||
return compileTimeout = setTimeout(function() {
|
||||
return compileTimeout = wait(25, function() {
|
||||
return fs.stat(source, function(err, stats) {
|
||||
if (err) return watchErr(err);
|
||||
if (prevStats && (stats.size === prevStats.size && stats.mtime.getTime() === prevStats.mtime.getTime())) {
|
||||
|
@ -213,7 +213,12 @@
|
|||
return compileScript(source, code.toString(), base);
|
||||
});
|
||||
});
|
||||
}, 25);
|
||||
});
|
||||
};
|
||||
watchErr = function(e) {
|
||||
if (e.code !== 'ENOENT') throw e;
|
||||
removeSource(source, base, true);
|
||||
return compileJoin();
|
||||
};
|
||||
try {
|
||||
return watcher = fs.watch(source, callback = function(event) {
|
||||
|
@ -221,14 +226,14 @@
|
|||
return compile();
|
||||
} else if (event === 'rename') {
|
||||
watcher.close();
|
||||
return setTimeout(function() {
|
||||
return wait(250, function() {
|
||||
compile();
|
||||
try {
|
||||
return watcher = fs.watch(source, callback);
|
||||
} catch (e) {
|
||||
return watchErr(e);
|
||||
}
|
||||
}, 250);
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
|
@ -351,6 +356,10 @@
|
|||
});
|
||||
};
|
||||
|
||||
wait = function(milliseconds, func) {
|
||||
return setTimeout(func, milliseconds);
|
||||
};
|
||||
|
||||
timeLog = function(message) {
|
||||
return console.log("" + ((new Date).toLocaleTimeString()) + " - " + message);
|
||||
};
|
||||
|
|
|
@ -178,7 +178,7 @@ watch = (source, base) ->
|
|||
|
||||
compile = ->
|
||||
clearTimeout compileTimeout
|
||||
compileTimeout = setTimeout ->
|
||||
compileTimeout = wait 25, ->
|
||||
fs.stat source, (err, stats) ->
|
||||
return watchErr err if err
|
||||
return if prevStats and (stats.size is prevStats.size and
|
||||
|
@ -187,7 +187,11 @@ watch = (source, base) ->
|
|||
fs.readFile source, (err, code) ->
|
||||
return watchErr err if err
|
||||
compileScript(source, code.toString(), base)
|
||||
, 25
|
||||
|
||||
watchErr = (e) ->
|
||||
throw e unless e.code is 'ENOENT'
|
||||
removeSource source, base, yes
|
||||
compileJoin()
|
||||
|
||||
try
|
||||
watcher = fs.watch source, callback = (event) ->
|
||||
|
@ -195,13 +199,14 @@ watch = (source, base) ->
|
|||
compile()
|
||||
else if event is 'rename'
|
||||
watcher.close()
|
||||
setTimeout ->
|
||||
wait 250, ->
|
||||
compile()
|
||||
try
|
||||
watcher = fs.watch source, callback
|
||||
catch e then watchErr e
|
||||
, 250
|
||||
catch e then watchErr e
|
||||
catch e
|
||||
watchErr e
|
||||
catch e
|
||||
watchErr e
|
||||
|
||||
|
||||
# Watch a directory of files for new additions.
|
||||
|
@ -266,6 +271,9 @@ writeJs = (source, js, base) ->
|
|||
timeLog "compiled #{source}"
|
||||
path.exists jsDir, (exists) ->
|
||||
if exists then compile() else exec "mkdir -p #{jsDir}", compile
|
||||
|
||||
# Convenience for cleaner setTimeouts.
|
||||
wait = (milliseconds, func) -> setTimeout func, milliseconds
|
||||
|
||||
# When watching scripts, it's useful to log changes with the timestamp.
|
||||
timeLog = (message) ->
|
||||
|
|
Loading…
Add table
Reference in a new issue