1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Merge branch 'master' into 2

# Conflicts:
#	Cakefile
#	package.json
This commit is contained in:
Geoffrey Booth 2016-11-17 22:00:36 -08:00
commit 57ffe14fab
48 changed files with 2052 additions and 9108 deletions

0
.nojekyll Normal file
View file

View file

@ -24,6 +24,9 @@ header = """
*/
"""
# Used in folder names like docs/v1
majorVersion = CoffeeScript.VERSION.split('.')[0]
# Build the CoffeeScript language from source.
build = (cb) ->
files = fs.readdirSync 'src'
@ -35,7 +38,7 @@ run = (args, cb) ->
proc = spawn 'node', ['bin/coffee'].concat(args)
proc.stderr.on 'data', (buffer) -> console.log buffer.toString()
proc.on 'exit', (status) ->
process.exit(1) if status != 0
process.exit(1) if status isnt 0
cb() if typeof cb is 'function'
# Log a message with a color.
@ -59,7 +62,7 @@ codeFor = ->
cshtml = cshtml.replace /(import|export|from|as|default) /g, '<span class="reserved">$1</span> '
jshtml = "<pre><code>#{hljs.highlight('javascript', js).value}</code></pre>"
append = if executable is yes then '' else "alert(#{executable});"
if executable and executable != yes
if executable and executable isnt yes
cs.replace /(\S)\s*\Z/m, "$1\n\nalert #{executable}"
run = if executable is true then 'run' else "run: #{executable}"
name = "example#{counter}"
@ -102,9 +105,9 @@ task 'install', 'install CoffeeScript into /usr/local (or --prefix)', (options)
lib = "#{base}/lib/coffee-script"
bin = "#{base}/bin"
node = "~/.node_libraries/coffee-script"
console.log "Installing CoffeeScript to #{lib}"
console.log "Linking to #{node}"
console.log "Linking 'coffee' to #{bin}/coffee"
console.log "Installing CoffeeScript to #{lib}"
console.log "Linking to #{node}"
console.log "Linking 'coffee' to #{bin}/coffee"
exec([
"mkdir -p #{lib} #{bin}"
"cp -rf bin lib LICENSE README.md package.json src #{lib}"
@ -138,6 +141,7 @@ task 'build:parser', 'rebuild the Jison parser (run build first)', ->
parser = require('./lib/coffee-script/grammar').parser
fs.writeFileSync 'lib/coffee-script/parser.js', parser.generate()
task 'build:browser', 'rebuild the merged script for inclusion in the browser', ->
code = ''
for {name, src} in [{name: 'marked', src: 'lib/marked.js'}]
@ -173,7 +177,7 @@ task 'build:browser', 'rebuild the merged script for inclusion in the browser',
"""
unless process.env.MINIFY is 'false'
{code} = require('uglify-js').minify code, fromString: true
fs.writeFileSync 'extras/coffee-script.js', header + '\n' + code
fs.writeFileSync "docs/v#{majorVersion}/extras/coffee-script.js", header + '\n' + code
console.log "built ... running browser tests:"
invoke 'test:browser'
@ -183,26 +187,22 @@ task 'doc:site', 'watch and continually rebuild the documentation for the websit
exec 'bin/coffee -bc -o documentation/js documentation/coffee/*.coffee'
do renderIndex = ->
codeSnippetCounter = 0
rendered = _.template fs.readFileSync(source, 'utf-8'),
render = _.template fs.readFileSync(source, 'utf-8')
output = render
codeFor: codeFor()
releaseHeader: releaseHeader
fs.writeFileSync 'index.html', rendered
log "compiled", green, "#{source}"
fs.writeFileSync "docs/v#{majorVersion}/index.html", output
log 'compiled', green, "#{source} → docs/v#{majorVersion}/index.html"
fs.watchFile source, interval: 200, renderIndex
log "watching..." , green
log 'watching...' , green
task 'doc:source', 'rebuild the internal documentation', ->
exec 'node_modules/.bin/docco src/*.*coffee && cp -rf docs documentation && rm -r docs', (err) ->
throw err if err
task 'doc:source', 'rebuild the annotated source documentation', ->
for source in ['src/*.*coffee', 'examples/underscore.coffee']
exec "node_modules/docco/bin/docco #{source} --output docs/v#{majorVersion}/annotated-source", (err) -> throw err if err
task 'doc:underscore', 'rebuild the Underscore.coffee documentation page', ->
exec 'node_modules/.bin/docco examples/underscore.coffee && cp -rf docs documentation && rm -r docs', (err) ->
throw err if err
task 'bench', 'quick benchmark of compilation time', ->
{Rewriter} = require './lib/coffee-script/rewriter'
sources = ['coffee-script', 'grammar', 'helpers', 'lexer', 'nodes', 'rewriter']
@ -313,7 +313,7 @@ task 'test', 'run the CoffeeScript language test suite', ->
task 'test:browser', 'run the test suite against the merged browser script', ->
source = fs.readFileSync 'extras/coffee-script.js', 'utf-8'
source = fs.readFileSync "docs/v#{majorVersion}/extras/coffee-script.js", 'utf-8'
result = {}
global.testingBrowser = yes
(-> eval source).call result

View file

1
docs/index.html Symbolic link
View file

@ -0,0 +1 @@
v1/index.html

File diff suppressed because it is too large Load diff

View file

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

View file

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 132 B

View file

Before

Width:  |  Height:  |  Size: 138 B

After

Width:  |  Height:  |  Size: 138 B

View file

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 148 B

View file

Before

Width:  |  Height:  |  Size: 95 B

After

Width:  |  Height:  |  Size: 95 B

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -5,16 +5,16 @@
<title>CoffeeScript</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="canonical" href="http://coffeescript.org" />
<link rel="stylesheet" type="text/css" href="documentation/css/docs.css" />
<link rel="stylesheet" type="text/css" href="documentation/css/tomorrow.css" />
<link rel="shortcut icon" href="documentation/images/favicon.ico" />
<link rel="stylesheet" type="text/css" href="v1/css/docs.css" />
<link rel="stylesheet" type="text/css" href="v1/css/tomorrow.css" />
<link rel="shortcut icon" href="v1/images/favicon.ico" />
</head>
<body>
<div id="fadeout"></div>
<div id="flybar">
<a id="logo" href="#top"><img src="documentation/images/logo.png" width="225" height="39" alt="CoffeeScript" /></a>
<a id="logo" href="#top"><img src="v1/images/logo.png" width="225" height="39" alt="CoffeeScript" /></a>
<div class="navigation toc">
<div class="button">
Table of Contents
@ -75,18 +75,18 @@
Annotated Source
</div>
<div class="contents menu">
<a href="documentation/docs/grammar.html">Grammar Rules &mdash; src/grammar</a>
<a href="documentation/docs/lexer.html">Lexing Tokens &mdash; src/lexer</a>
<a href="documentation/docs/rewriter.html">The Rewriter &mdash; src/rewriter</a>
<a href="documentation/docs/nodes.html">The Syntax Tree &mdash; src/nodes</a>
<a href="documentation/docs/scope.html">Lexical Scope &mdash; src/scope</a>
<a href="documentation/docs/helpers.html">Helpers &amp; Utility Functions &mdash; src/helpers</a>
<a href="documentation/docs/coffee-script.html">The CoffeeScript Module &mdash; src/coffee-script</a>
<a href="documentation/docs/cake.html">Cake &amp; Cakefiles &mdash; src/cake</a>
<a href="documentation/docs/command.html">"coffee" Command-Line Utility &mdash; src/command</a>
<a href="documentation/docs/optparse.html">Option Parsing &mdash; src/optparse</a>
<a href="documentation/docs/repl.html">Interactive REPL &mdash; src/repl</a>
<a href="documentation/docs/sourcemap.html">Source Maps &mdash; src/sourcemap</a>
<a href="v1/annotated-source/grammar.html">Grammar Rules &mdash; src/grammar</a>
<a href="v1/annotated-source/lexer.html">Lexing Tokens &mdash; src/lexer</a>
<a href="v1/annotated-source/rewriter.html">The Rewriter &mdash; src/rewriter</a>
<a href="v1/annotated-source/nodes.html">The Syntax Tree &mdash; src/nodes</a>
<a href="v1/annotated-source/scope.html">Lexical Scope &mdash; src/scope</a>
<a href="v1/annotated-source/helpers.html">Helpers &amp; Utility Functions &mdash; src/helpers</a>
<a href="v1/annotated-source/coffee-script.html">The CoffeeScript Module &mdash; src/coffee-script</a>
<a href="v1/annotated-source/cake.html">Cake &amp; Cakefiles &mdash; src/cake</a>
<a href="v1/annotated-source/command.html">"coffee" Command-Line Utility &mdash; src/command</a>
<a href="v1/annotated-source/optparse.html">Option Parsing &mdash; src/optparse</a>
<a href="v1/annotated-source/repl.html">Interactive REPL &mdash; src/repl</a>
<a href="v1/annotated-source/sourcemap.html">Source Maps &mdash; src/sourcemap</a>
</div>
</div>
</div>
@ -249,7 +249,7 @@ cubes = (function() {
<p>
The CoffeeScript compiler is itself
<a href="documentation/docs/grammar.html">written in CoffeeScript</a>,
<a href="v1/annotated-source/grammar.html">written in CoffeeScript</a>,
using the <a href="http://jison.org">Jison parser generator</a>. The
command-line version of <code>coffee</code> is available as a
<a href="http://nodejs.org/">Node.js</a> utility. The
@ -2339,7 +2339,7 @@ task(<span class="string">'build:parser'</span>, <span class="string">'rebuild t
<code>build</code> before <code>test</code>, you can use the <code>invoke</code> function:
<code>invoke 'build'</code>. Cake tasks are a minimal way to expose your
CoffeeScript functions to the command line, so
<a href="documentation/docs/cake.html">don't expect any fanciness built-in</a>.
<a href="v1/annotated-source/cake.html">don't expect any fanciness built-in</a>.
If you need dependencies, or async callbacks, it's best to put them in your
code itself &mdash; not the cake task.
</p>
@ -2510,7 +2510,7 @@ task(<span class="string">'build:parser'</span>, <span class="string">'rebuild t
a headless, full-stack, faux-browser testing library for Node.js.
</li>
<li>
<b>jashkenas</b>' <a href="documentation/docs/underscore.html">Underscore.coffee</a>, a port
<b>jashkenas</b>' <a href="v1/annotated-source/underscore.html">Underscore.coffee</a>, a port
of the <a href="http://documentcloud.github.com/underscore/">Underscore.js</a>
library of helper functions.
</li>
@ -3947,8 +3947,8 @@ six = -&gt;
</script>
<script src="documentation/vendor/jquery-1.6.4.js"></script>
<script src="extras/coffee-script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="v1/extras/coffee-script.js"></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<title>CoffeeScript</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="canonical" href="http://coffeescript.org" />
<link rel="stylesheet" type="text/css" href="documentation/css/docs.css" />
<link rel="stylesheet" type="text/css" href="documentation/css/tomorrow.css" />
<link rel="shortcut icon" href="documentation/images/favicon.ico" />
<link rel="stylesheet" type="text/css" href="v1/css/docs.css" />
<link rel="stylesheet" type="text/css" href="v1/css/tomorrow.css" />
<link rel="shortcut icon" href="v1/images/favicon.ico" />
</head>
<body>
<div id="fadeout"></div>
<div id="flybar">
<a id="logo" href="#top"><img src="documentation/images/logo.png" width="225" height="39" alt="CoffeeScript" /></a>
<a id="logo" href="#top"><img src="v1/images/logo.png" width="225" height="39" alt="CoffeeScript" /></a>
<div class="navigation toc">
<div class="button">
Table of Contents
@ -75,18 +75,18 @@
Annotated Source
</div>
<div class="contents menu">
<a href="documentation/docs/grammar.html">Grammar Rules &mdash; src/grammar</a>
<a href="documentation/docs/lexer.html">Lexing Tokens &mdash; src/lexer</a>
<a href="documentation/docs/rewriter.html">The Rewriter &mdash; src/rewriter</a>
<a href="documentation/docs/nodes.html">The Syntax Tree &mdash; src/nodes</a>
<a href="documentation/docs/scope.html">Lexical Scope &mdash; src/scope</a>
<a href="documentation/docs/helpers.html">Helpers &amp; Utility Functions &mdash; src/helpers</a>
<a href="documentation/docs/coffee-script.html">The CoffeeScript Module &mdash; src/coffee-script</a>
<a href="documentation/docs/cake.html">Cake &amp; Cakefiles &mdash; src/cake</a>
<a href="documentation/docs/command.html">"coffee" Command-Line Utility &mdash; src/command</a>
<a href="documentation/docs/optparse.html">Option Parsing &mdash; src/optparse</a>
<a href="documentation/docs/repl.html">Interactive REPL &mdash; src/repl</a>
<a href="documentation/docs/sourcemap.html">Source Maps &mdash; src/sourcemap</a>
<a href="v1/annotated-source/grammar.html">Grammar Rules &mdash; src/grammar</a>
<a href="v1/annotated-source/lexer.html">Lexing Tokens &mdash; src/lexer</a>
<a href="v1/annotated-source/rewriter.html">The Rewriter &mdash; src/rewriter</a>
<a href="v1/annotated-source/nodes.html">The Syntax Tree &mdash; src/nodes</a>
<a href="v1/annotated-source/scope.html">Lexical Scope &mdash; src/scope</a>
<a href="v1/annotated-source/helpers.html">Helpers &amp; Utility Functions &mdash; src/helpers</a>
<a href="v1/annotated-source/coffee-script.html">The CoffeeScript Module &mdash; src/coffee-script</a>
<a href="v1/annotated-source/cake.html">Cake &amp; Cakefiles &mdash; src/cake</a>
<a href="v1/annotated-source/command.html">"coffee" Command-Line Utility &mdash; src/command</a>
<a href="v1/annotated-source/optparse.html">Option Parsing &mdash; src/optparse</a>
<a href="v1/annotated-source/repl.html">Interactive REPL &mdash; src/repl</a>
<a href="v1/annotated-source/sourcemap.html">Source Maps &mdash; src/sourcemap</a>
</div>
</div>
</div>
@ -133,7 +133,7 @@
<p>
The CoffeeScript compiler is itself
<a href="documentation/docs/grammar.html">written in CoffeeScript</a>,
<a href="v1/annotated-source/grammar.html">written in CoffeeScript</a>,
using the <a href="http://jison.org">Jison parser generator</a>. The
command-line version of <code>coffee</code> is available as a
<a href="http://nodejs.org/">Node.js</a> utility. The
@ -1013,7 +1013,7 @@ Block
<code>build</code> before <code>test</code>, you can use the <code>invoke</code> function:
<code>invoke 'build'</code>. Cake tasks are a minimal way to expose your
CoffeeScript functions to the command line, so
<a href="documentation/docs/cake.html">don't expect any fanciness built-in</a>.
<a href="v1/annotated-source/cake.html">don't expect any fanciness built-in</a>.
If you need dependencies, or async callbacks, it's best to put them in your
code itself &mdash; not the cake task.
</p>
@ -1184,7 +1184,7 @@ Block
a headless, full-stack, faux-browser testing library for Node.js.
</li>
<li>
<b>jashkenas</b>' <a href="documentation/docs/underscore.html">Underscore.coffee</a>, a port
<b>jashkenas</b>' <a href="v1/annotated-source/underscore.html">Underscore.coffee</a>, a port
of the <a href="http://documentcloud.github.com/underscore/">Underscore.js</a>
library of helper functions.
</li>
@ -2372,8 +2372,8 @@ six = -&gt;
</script>
<script src="documentation/vendor/jquery-1.6.4.js"></script>
<script src="extras/coffee-script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="v1/extras/coffee-script.js"></script>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -41,7 +41,7 @@
"devDependencies": {
"uglify-js": "~2.7",
"jison": ">=0.4.17",
"highlight.js": "~9.7.0",
"highlight.js": "~9.8.0",
"underscore": "~1.8.3",
"docco": "~0.7.0"
},