From 37e6513c02891c45e7633f67c9b89b993b2d6f4d Mon Sep 17 00:00:00 2001
From: Geoffrey
Date: Mon, 13 Feb 2017 20:31:58 -0800
Subject: [PATCH 01/11] =?UTF-8?q?Node=20comes=20with=20NPM=20nowadays,=20s?=
=?UTF-8?q?o=20there=E2=80=99s=20not=20really=20a=20reason=20to=20install?=
=?UTF-8?q?=20CoffeeScript=20the=20non-NPM=20way?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Cakefile | 21 ---------------------
README.md | 11 +++--------
2 files changed, 3 insertions(+), 29 deletions(-)
diff --git a/Cakefile b/Cakefile
index 61d46227b1..56714f5e92 100644
--- a/Cakefile
+++ b/Cakefile
@@ -45,27 +45,6 @@ run = (args, cb) ->
log = (message, color, explanation) ->
console.log color + message + reset + ' ' + (explanation or '')
-option '-p', '--prefix [DIR]', 'set the installation prefix for `cake install`'
-
-task 'install', 'install CoffeeScript into /usr/local (or --prefix)', (options) ->
- base = options.prefix or '/usr/local'
- 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"
- exec([
- "mkdir -p #{lib} #{bin}"
- "cp -rf bin lib LICENSE README.md package.json src #{lib}"
- "ln -sfn #{lib}/bin/coffee #{bin}/coffee"
- "ln -sfn #{lib}/bin/cake #{bin}/cake"
- "mkdir -p ~/.node_libraries"
- "ln -sfn #{lib}/lib/coffee-script #{node}"
- ].join(' && '), (err, stdout, stderr) ->
- if err then console.log stderr.trim() else log 'done', green
- )
-
task 'build', 'build the CoffeeScript language from source', build
diff --git a/README.md b/README.md
index 486d7d26db..432c83ce2d 100644
--- a/README.md
+++ b/README.md
@@ -25,15 +25,10 @@ CoffeeScript is a little language that compiles into JavaScript.
If you have the node package manager, npm, installed:
```shell
-npm install -g coffee-script
+npm install --global coffee-script
```
-Leave off the `-g` if you don't wish to install globally. If you don't wish to use npm:
-
-```shell
-git clone https://github.com/jashkenas/coffeescript.git
-sudo coffeescript/bin/cake install
-```
+Leave off the `--global` if you don’t wish to install globally.
## Getting Started
@@ -53,7 +48,7 @@ For documentation, usage, and examples, see: http://coffeescript.org/
To suggest a feature or report a bug: http://github.com/jashkenas/coffeescript/issues
-If you'd like to chat, drop by #coffeescript on Freenode IRC.
+If you’d like to chat, drop by #coffeescript on Freenode IRC.
The source repository: https://github.com/jashkenas/coffeescript.git
From c06a0584ff7c95f282d6eef8f7123135d56efcbf Mon Sep 17 00:00:00 2001
From: Geoffrey
Date: Mon, 13 Feb 2017 20:42:13 -0800
Subject: [PATCH 02/11] The cake documentation tasks should each have build and
watch modes following the same form
---
Cakefile | 46 ++++++++++++++++++++++++++++++++++++----------
1 file changed, 36 insertions(+), 10 deletions(-)
diff --git a/Cakefile b/Cakefile
index 56714f5e92..da176a8d4b 100644
--- a/Cakefile
+++ b/Cakefile
@@ -117,7 +117,7 @@ task 'build:browser', 'rebuild the merged script for inclusion in the browser',
invoke 'test:browser'
-task 'doc:site', 'watch and continually rebuild the documentation for the website', ->
+buildDocs = (watch = no) ->
# Constants
indexFile = 'documentation/index.html'
versionedSourceFolder = "documentation/v#{majorVersion}"
@@ -190,12 +190,19 @@ task 'doc:site', 'watch and continually rebuild the documentation for the websit
fs.symlinkSync "v#{majorVersion}/index.html", 'docs/index.html'
catch exception
- for target in [indexFile, versionedSourceFolder, examplesSourceFolder, sectionsSourceFolder]
- fs.watch target, interval: 200, renderIndex
- log 'watching...' , green
+ if watch
+ for target in [indexFile, versionedSourceFolder, examplesSourceFolder, sectionsSourceFolder]
+ fs.watch target, interval: 200, renderIndex
+ log 'watching...' , green
+task 'doc:site', 'build the documentation for the website', ->
+ buildDocs()
-task 'doc:test', 'watch and continually rebuild the browser-based tests', ->
+task 'doc:site:watch', 'watch and continually rebuild the documentation for the website', ->
+ buildDocs yes
+
+
+buildDocTests = (watch = no) ->
# Constants
testFile = 'documentation/test.html'
testsSourceFolder = 'test'
@@ -233,13 +240,32 @@ task 'doc:test', 'watch and continually rebuild the browser-based tests', ->
fs.writeFileSync "#{outputFolder}/test.html", output
log 'compiled', green, "#{testFile} → #{outputFolder}/test.html"
- for target in [testFile, testsSourceFolder]
- fs.watch target, interval: 200, renderTest
- log 'watching...' , green
+ if watch
+ for target in [testFile, testsSourceFolder]
+ fs.watch target, interval: 200, renderTest
+ log 'watching...' , green
+
+task 'doc:test', 'build the browser-based tests', ->
+ buildDocTests()
+
+task 'doc:test:watch', 'watch and continually rebuild the browser-based tests', ->
+ buildDocTests yes
+
+
+buildAnnotatedSource = (watch = no) ->
+ do generateAnnotatedSource = ->
+ exec "node_modules/docco/bin/docco src/*.*coffee --output docs/v#{majorVersion}/annotated-source", (err) -> throw err if err
+ log 'generated', green, "annotated source in docs/v#{majorVersion}/annotated-source/"
+
+ if watch
+ fs.watch 'src/', interval: 200, generateAnnotatedSource
+ log 'watching...' , green
+task 'doc:source', 'build the annotated source documentation', ->
+ buildAnnotatedSource()
-task 'doc:source', 'rebuild the annotated source documentation', ->
- exec "node_modules/docco/bin/docco src/*.*coffee --output docs/v#{majorVersion}/annotated-source", (err) -> throw err if err
+task 'doc:source:watch', 'watch and continually rebuild the annotated source documentation', ->
+ buildAnnotatedSource yes
task 'bench', 'quick benchmark of compilation time', ->
From 8a271995c7d663a6e21e61637bfdbac799c69c57 Mon Sep 17 00:00:00 2001
From: Geoffrey
Date: Mon, 13 Feb 2017 21:05:12 -0800
Subject: [PATCH 03/11] =?UTF-8?q?Refactor=20the=20build=20tasks=20to=20be?=
=?UTF-8?q?=20more=20foolproof,=20including=20the=20parser=20unless=20it?=
=?UTF-8?q?=E2=80=99s=20explicitly=20excluded?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Cakefile | 49 +++++++++++++++++------------
docs/v1/index.html | 6 ++--
documentation/sections/resources.md | 6 ++--
3 files changed, 35 insertions(+), 26 deletions(-)
diff --git a/Cakefile b/Cakefile
index da176a8d4b..be742734c7 100644
--- a/Cakefile
+++ b/Cakefile
@@ -24,15 +24,34 @@ header = """
*/
"""
-# Used in folder names like docs/v1
+# Used in folder names like `docs/v1`.
majorVersion = parseInt CoffeeScript.VERSION.split('.')[0], 10
+
# Build the CoffeeScript language from source.
-build = (cb) ->
+buildParser = ->
+ helpers.extend global, require 'util'
+ require 'jison'
+ parser = require('./lib/coffee-script/grammar').parser.generate()
+ # Patch Jison’s output, until https://github.com/zaach/jison/pull/339 is accepted,
+ # to ensure that require('fs') is only called where it exists.
+ parser = parser.replace "var source = require('fs')", """
+ var source = '';
+ var fs = require('fs');
+ if (typeof fs !== 'undefined' && fs !== null)
+ source = fs"""
+ fs.writeFileSync 'lib/coffee-script/parser.js', parser
+
+buildExceptParser = (cb) ->
files = fs.readdirSync 'src'
files = ('src/' + file for file in files when file.match(/\.(lit)?coffee$/))
run ['-c', '-o', 'lib/coffee-script'].concat(files), cb
+build = (cb) ->
+ buildParser()
+ buildExceptParser cb
+
+
# Run a CoffeeScript through our node/coffee interpreter.
run = (args, cb) ->
proc = spawn 'node', ['bin/coffee'].concat(args)
@@ -41,14 +60,19 @@ run = (args, cb) ->
process.exit(1) if status isnt 0
cb() if typeof cb is 'function'
+
# Log a message with a color.
log = (message, color, explanation) ->
console.log color + message + reset + ' ' + (explanation or '')
-task 'build', 'build the CoffeeScript language from source', build
+task 'build', 'build the CoffeeScript compiler from source', build
+
+task 'build:parser', 'build the Jison parser only', buildParser
+
+task 'build:except-parser', 'build the CoffeeScript compiler, except for the Jison parser', buildExceptParser
-task 'build:full', 'rebuild the source twice, and run the tests', ->
+task 'build:full', 'build the CoffeeScript compiler from source twice, and run the tests', ->
build ->
build ->
csPath = './lib/coffee-script'
@@ -60,22 +84,7 @@ task 'build:full', 'rebuild the source twice, and run the tests', ->
unless runTests require csPath
process.exit 1
-
-task 'build:parser', 'rebuild the Jison parser (run build first)', ->
- helpers.extend global, require 'util'
- require 'jison'
- parser = require('./lib/coffee-script/grammar').parser.generate()
- # Patch Jison’s output, until https://github.com/zaach/jison/pull/339 is accepted,
- # to ensure that require('fs') is only called where it exists.
- parser = parser.replace "var source = require('fs')", """
- var source = '';
- var fs = require('fs');
- if (typeof fs !== 'undefined' && fs !== null)
- source = fs"""
- fs.writeFileSync 'lib/coffee-script/parser.js', parser
-
-
-task 'build:browser', 'rebuild the merged script for inclusion in the browser', ->
+task 'build:browser', 'build the merged script for inclusion in the browser', ->
code = """
require['../../package.json'] = (function() {
return #{fs.readFileSync "./package.json"};
diff --git a/docs/v1/index.html b/docs/v1/index.html
index c108e6d015..0cd03d5495 100644
--- a/docs/v1/index.html
+++ b/docs/v1/index.html
@@ -2584,9 +2584,9 @@
Resources
Source Code
Use bin/coffee to test your changes, bin/cake test to run the test suite,
-bin/cake build to rebuild the CoffeeScript compiler, and
-bin/cake build:parser to regenerate the Jison parser if you’re working on the grammar.
-
git checkout lib && bin/cake build:full is a good command to run when you’re working on the core language. It’ll refresh the lib directory (in case you broke something), build your altered compiler, use that to rebuild itself (a good sanity test) and then run all of the tests. If they pass, there’s a good chance you’ve made a successful change.
+bin/cake build to rebuild the full CoffeeScript compiler, and
+bin/cake build:except-parser to recompile much faster if you’re not editing grammar.coffee.
+
git checkout lib && bin/cake build:full is a good command to run when you’re working on the core language. It’ll refresh the lib folder (in case you broke something), build your altered compiler, use that to rebuild itself (a good sanity test) and then run all of the tests. If they pass, there’s a good chance you’ve made a successful change.
Browser Tests
Run CoffeeScript’s test suite in your current browser.
diff --git a/documentation/sections/resources.md b/documentation/sections/resources.md
index 9e1e2927a0..bac559e4ee 100644
--- a/documentation/sections/resources.md
+++ b/documentation/sections/resources.md
@@ -3,10 +3,10 @@
* [Source Code](http://github.com/jashkenas/coffeescript/)
Use `bin/coffee` to test your changes,
`bin/cake test` to run the test suite,
- `bin/cake build` to rebuild the CoffeeScript compiler, and
- `bin/cake build:parser` to regenerate the Jison parser if you’re working on the grammar.
+ `bin/cake build` to rebuild the full CoffeeScript compiler, and
+ `bin/cake build:except-parser` to recompile much faster if you’re not editing `grammar.coffee`.
- `git checkout lib && bin/cake build:full` is a good command to run when you’re working on the core language. It’ll refresh the lib directory (in case you broke something), build your altered compiler, use that to rebuild itself (a good sanity test) and then run all of the tests. If they pass, there’s a good chance you’ve made a successful change.
+ `git checkout lib && bin/cake build:full` is a good command to run when you’re working on the core language. It’ll refresh the `lib` folder (in case you broke something), build your altered compiler, use that to rebuild itself (a good sanity test) and then run all of the tests. If they pass, there’s a good chance you’ve made a successful change.
* [Browser Tests](v<%= majorVersion %>/test.html)
Run CoffeeScript’s test suite in your current browser.
* [CoffeeScript Issues](http://github.com/jashkenas/coffeescript/issues)
From 9866224dba1424b9a3bece0bfc36739e540a343c Mon Sep 17 00:00:00 2001
From: Geoffrey
Date: Mon, 13 Feb 2017 21:49:04 -0800
Subject: [PATCH 04/11] Abstract out testing built code, to prepare for
watching the build task
---
Cakefile | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/Cakefile b/Cakefile
index be742734c7..bbf6f34f7f 100644
--- a/Cakefile
+++ b/Cakefile
@@ -51,6 +51,17 @@ build = (cb) ->
buildParser()
buildExceptParser cb
+testBuiltCode = (watch = no) ->
+ csPath = './lib/coffee-script'
+ csDir = path.dirname require.resolve csPath
+
+ for mod of require.cache when csDir is mod[0 ... csDir.length]
+ delete require.cache[mod]
+
+ testResults = runTests require csPath
+ unless watch
+ process.exit 1 unless testResults
+
# Run a CoffeeScript through our node/coffee interpreter.
run = (args, cb) ->
@@ -74,15 +85,7 @@ task 'build:except-parser', 'build the CoffeeScript compiler, except for the Jis
task 'build:full', 'build the CoffeeScript compiler from source twice, and run the tests', ->
build ->
- build ->
- csPath = './lib/coffee-script'
- csDir = path.dirname require.resolve csPath
-
- for mod of require.cache when csDir is mod[0 ... csDir.length]
- delete require.cache[mod]
-
- unless runTests require csPath
- process.exit 1
+ build testBuiltCode
task 'build:browser', 'build the merged script for inclusion in the browser', ->
code = """
@@ -202,7 +205,7 @@ buildDocs = (watch = no) ->
if watch
for target in [indexFile, versionedSourceFolder, examplesSourceFolder, sectionsSourceFolder]
fs.watch target, interval: 200, renderIndex
- log 'watching...' , green
+ log 'watching...', green
task 'doc:site', 'build the documentation for the website', ->
buildDocs()
@@ -252,7 +255,7 @@ buildDocTests = (watch = no) ->
if watch
for target in [testFile, testsSourceFolder]
fs.watch target, interval: 200, renderTest
- log 'watching...' , green
+ log 'watching...', green
task 'doc:test', 'build the browser-based tests', ->
buildDocTests()
@@ -268,7 +271,7 @@ buildAnnotatedSource = (watch = no) ->
if watch
fs.watch 'src/', interval: 200, generateAnnotatedSource
- log 'watching...' , green
+ log 'watching...', green
task 'doc:source', 'build the annotated source documentation', ->
buildAnnotatedSource()
From f4a1172b6f019e4602169202162d085cb2e7aaa0 Mon Sep 17 00:00:00 2001
From: Geoffrey
Date: Mon, 13 Feb 2017 21:58:23 -0800
Subject: [PATCH 05/11] Cake task to cut a new release
---
Cakefile | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Cakefile b/Cakefile
index bbf6f34f7f..5d1a9bcabd 100644
--- a/Cakefile
+++ b/Cakefile
@@ -280,6 +280,13 @@ task 'doc:source:watch', 'watch and continually rebuild the annotated source doc
buildAnnotatedSource yes
+task 'release', 'build and test the CoffeeScript source, and build the documentation', ->
+ invoke 'build:full'
+ invoke 'build:browser'
+ invoke 'doc:site'
+ invoke 'doc:test'
+ invoke 'doc:source'
+
task 'bench', 'quick benchmark of compilation time', ->
{Rewriter} = require './lib/coffee-script/rewriter'
sources = ['coffee-script', 'grammar', 'helpers', 'lexer', 'nodes', 'rewriter']
From 856bf5e68c6dfeb8040f69db0aa7c6aa5ccd2436 Mon Sep 17 00:00:00 2001
From: Geoffrey Booth
Date: Tue, 14 Feb 2017 19:13:41 -0800
Subject: [PATCH 06/11] cake build:watch, based on
https://github.com/GeoffreyBooth/coffeescript-gulp
---
Cakefile | 72 +++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 55 insertions(+), 17 deletions(-)
diff --git a/Cakefile b/Cakefile
index 5d1a9bcabd..3066a1b8d9 100644
--- a/Cakefile
+++ b/Cakefile
@@ -28,6 +28,25 @@ header = """
majorVersion = parseInt CoffeeScript.VERSION.split('.')[0], 10
+# Log a message with a color.
+log = (message, color, explanation) ->
+ console.log color + message + reset + ' ' + (explanation or '')
+
+
+spawnNodeProcess = (args, output = 'stderr', callback) ->
+ relayOutput = (buffer) -> console.log buffer.toString()
+ proc = spawn 'node', args
+ proc.stdout.on 'data', relayOutput if output is 'both' or output is 'stdout'
+ proc.stderr.on 'data', relayOutput if output is 'both' or output is 'stderr'
+ proc.on 'exit', (status) -> callback(status) if typeof callback is 'function'
+
+# Run a CoffeeScript through our node/coffee interpreter.
+run = (args, callback) ->
+ spawnNodeProcess ['bin/coffee'].concat(args), 'stderr', (status) ->
+ process.exit(1) if status isnt 0
+ callback() if typeof callback is 'function'
+
+
# Build the CoffeeScript language from source.
buildParser = ->
helpers.extend global, require 'util'
@@ -42,14 +61,14 @@ buildParser = ->
source = fs"""
fs.writeFileSync 'lib/coffee-script/parser.js', parser
-buildExceptParser = (cb) ->
+buildExceptParser = (callback) ->
files = fs.readdirSync 'src'
files = ('src/' + file for file in files when file.match(/\.(lit)?coffee$/))
- run ['-c', '-o', 'lib/coffee-script'].concat(files), cb
+ run ['-c', '-o', 'lib/coffee-script'].concat(files), callback
-build = (cb) ->
+build = (callback) ->
buildParser()
- buildExceptParser cb
+ buildExceptParser callback
testBuiltCode = (watch = no) ->
csPath = './lib/coffee-script'
@@ -62,19 +81,32 @@ testBuiltCode = (watch = no) ->
unless watch
process.exit 1 unless testResults
-
-# Run a CoffeeScript through our node/coffee interpreter.
-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 isnt 0
- cb() if typeof cb is 'function'
-
-
-# Log a message with a color.
-log = (message, color, explanation) ->
- console.log color + message + reset + ' ' + (explanation or '')
+buildAndTest = (includingParser = yes, harmony = no) ->
+ process.stdout.write '\x1Bc' # Clear terminal screen.
+ execSync 'git checkout lib/*', stdio: [0,1,2] # Reset the generated compiler.
+
+ buildArgs = ['bin/cake']
+ buildArgs.push if includingParser then 'build' else 'build:except-parser'
+ log "building#{if includingParser then ', including parser' else ''}...", green
+ spawnNodeProcess buildArgs, 'both', ->
+ log 'testing...', green
+ testArgs = if harmony then ['--harmony'] else []
+ testArgs = testArgs.concat ['bin/cake', 'test']
+ spawnNodeProcess testArgs, 'both'
+
+watchAndBuildAndTest = (harmony = no) ->
+ buildAndTest yes, harmony
+ fs.watch 'src/', interval: 200, (eventType, filename) ->
+ if eventType is 'change'
+ log "src/#{filename} changed, rebuilding..."
+ buildAndTest (filename is 'grammar.coffee'), harmony
+ fs.watch 'test/',
+ interval: 200
+ recursive: yes
+ , (eventType, filename) ->
+ if eventType is 'change'
+ log "test/#{filename} changed, rebuilding..."
+ buildAndTest no, harmony
task 'build', 'build the CoffeeScript compiler from source', build
@@ -128,6 +160,12 @@ task 'build:browser', 'build the merged script for inclusion in the browser', ->
console.log "built ... running browser tests:"
invoke 'test:browser'
+task 'build:watch', 'watch and continually rebuild the CoffeeScript compiler, running tests on each build', ->
+ watchAndBuildAndTest()
+
+task 'build:watch:harmony', 'watch and continually rebuild the CoffeeScript compiler, running harmony tests on each build', ->
+ watchAndBuildAndTest yes
+
buildDocs = (watch = no) ->
# Constants
From 4547cbac3ab442fab7561fe64f2fb99639b95e5d Mon Sep 17 00:00:00 2001
From: Geoffrey Booth
Date: Tue, 14 Feb 2017 23:30:10 -0800
Subject: [PATCH 07/11] Bump version to 1.12.4 and update changelog
---
documentation/sections/changelog.md | 8 ++++++++
package.json | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/documentation/sections/changelog.md b/documentation/sections/changelog.md
index 0e571bb0cb..a10680df01 100644
--- a/documentation/sections/changelog.md
+++ b/documentation/sections/changelog.md
@@ -1,5 +1,13 @@
## Change Log
+```
+releaseHeader('2017-02-15', '1.12.4', '1.12.3')
+```
+
+* The `cake` commands have been updated, with new `watch` options for most tasks. Clone the [CoffeeScript repo](https://github.com/jashkenas/coffeescript) and run `cake` at the root of the repo to see the options.
+* Fixed a bug where `export`ing a referenced variable was preventing the variable from being declared.
+* Fixed a bug where the `coffee` command wasn’t working for a `.litcoffee` file.
+
```
releaseHeader('2017-01-24', '1.12.3', '1.12.2')
```
diff --git a/package.json b/package.json
index ca21e6756f..a44457966e 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"compiler"
],
"author": "Jeremy Ashkenas",
- "version": "1.12.3",
+ "version": "1.12.4",
"license": "MIT",
"engines": {
"node": ">=0.8.0"
From 94023d88cad00063563a30dcc5afb9739f436797 Mon Sep 17 00:00:00 2001
From: Geoffrey Booth
Date: Tue, 14 Feb 2017 23:30:32 -0800
Subject: [PATCH 08/11] Updated compiled output for 1.12.4
---
docs/v1/browser-compiler/coffee-script.js | 4 ++--
docs/v1/index.html | 13 +++++++++++--
lib/coffee-script/browser.js | 2 +-
lib/coffee-script/cake.js | 2 +-
lib/coffee-script/coffee-script.js | 2 +-
lib/coffee-script/command.js | 2 +-
lib/coffee-script/grammar.js | 2 +-
lib/coffee-script/helpers.js | 2 +-
lib/coffee-script/index.js | 2 +-
lib/coffee-script/lexer.js | 2 +-
lib/coffee-script/nodes.js | 2 +-
lib/coffee-script/optparse.js | 2 +-
lib/coffee-script/register.js | 2 +-
lib/coffee-script/repl.js | 2 +-
lib/coffee-script/rewriter.js | 2 +-
lib/coffee-script/scope.js | 2 +-
lib/coffee-script/sourcemap.js | 2 +-
17 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/docs/v1/browser-compiler/coffee-script.js b/docs/v1/browser-compiler/coffee-script.js
index 652ce86e12..32aab7b886 100644
--- a/docs/v1/browser-compiler/coffee-script.js
+++ b/docs/v1/browser-compiler/coffee-script.js
@@ -1,5 +1,5 @@
/**
- * CoffeeScript Compiler v1.12.3
+ * CoffeeScript Compiler v1.12.4
* http://coffeescript.org
*
* Copyright 2011, Jeremy Ashkenas
@@ -13,7 +13,7 @@ $jscomp.polyfill("Array.prototype.find",function(u){return u?u:function(u,qa){re
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var u=$jscomp.global.Symbol.iterator;u||(u=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[u]&&$jscomp.defineProperty(Array.prototype,u,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};
$jscomp.arrayIterator=function(u){var ya=0;return $jscomp.iteratorPrototype(function(){return ya>>=1,a+=a;return f};g.compact=function(a){var f,c,g,q;q=[];f=0;for(g=a.length;fCoffeeScript is a little language that compiles into JavaScript. Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.
The golden rule of CoffeeScript is: “It’s just JavaScript”. The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. You can use any existing JavaScript library seamlessly from CoffeeScript (and vice-versa). The compiled output is readable, pretty-printed, and tends to run as fast or faster than the equivalent handwritten JavaScript.
The cake commands have been updated, with new watch options for most tasks. Clone the CoffeeScript repo and run cake at the root of the repo to see the options.
+
Fixed a bug where exporting a referenced variable was preventing the variable from being declared.
+
Fixed a bug where the coffee command wasn’t working for a .litcoffee file.
+
+
1.12.3 —
diff --git a/lib/coffee-script/browser.js b/lib/coffee-script/browser.js
index 5840a33e9b..4241e1584b 100644
--- a/lib/coffee-script/browser.js
+++ b/lib/coffee-script/browser.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var CoffeeScript, compile, runScripts,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
diff --git a/lib/coffee-script/cake.js b/lib/coffee-script/cake.js
index f513d853c5..c9d84360e4 100644
--- a/lib/coffee-script/cake.js
+++ b/lib/coffee-script/cake.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
diff --git a/lib/coffee-script/coffee-script.js b/lib/coffee-script/coffee-script.js
index f482620d30..274624c86a 100644
--- a/lib/coffee-script/coffee-script.js
+++ b/lib/coffee-script/coffee-script.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var Lexer, SourceMap, base64encode, compile, ext, fn1, formatSourcePosition, fs, getSourceMap, helpers, i, len, lexer, packageJson, parser, path, ref, sourceMaps, sources, vm, withPrettyErrors,
hasProp = {}.hasOwnProperty;
diff --git a/lib/coffee-script/command.js b/lib/coffee-script/command.js
index 795eaa961c..01f6942ef5 100644
--- a/lib/coffee-script/command.js
+++ b/lib/coffee-script/command.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, findDirectoryIndex, forkNode, fs, helpers, hidden, joinTimeout, makePrelude, mkdirp, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, ref, removeSource, removeSourceDir, silentUnlink, sourceCode, sources, spawn, timeLog, usage, useWinPathSep, version, wait, watch, watchDir, watchedDirs, writeJs,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
diff --git a/lib/coffee-script/grammar.js b/lib/coffee-script/grammar.js
index 88da72aa27..4ba0939a2a 100644
--- a/lib/coffee-script/grammar.js
+++ b/lib/coffee-script/grammar.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
diff --git a/lib/coffee-script/helpers.js b/lib/coffee-script/helpers.js
index cb7f41be87..11d5b58b71 100644
--- a/lib/coffee-script/helpers.js
+++ b/lib/coffee-script/helpers.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var buildLocationData, extend, flatten, ref, repeat, syntaxErrorToString;
diff --git a/lib/coffee-script/index.js b/lib/coffee-script/index.js
index d12469e3df..5433532449 100644
--- a/lib/coffee-script/index.js
+++ b/lib/coffee-script/index.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var key, ref, val;
diff --git a/lib/coffee-script/lexer.js b/lib/coffee-script/lexer.js
index c996c43c7c..ebc878981c 100644
--- a/lib/coffee-script/lexer.js
+++ b/lib/coffee-script/lexer.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HERECOMMENT_ILLEGAL, HEREDOC_DOUBLE, HEREDOC_INDENT, HEREDOC_SINGLE, HEREGEX, HEREGEX_OMIT, HERE_JSTOKEN, IDENTIFIER, INDENTABLE_CLOSERS, INDEXABLE, INVALID_ESCAPE, INVERSES, JSTOKEN, JS_KEYWORDS, LEADING_BLANK_LINE, LINE_BREAK, LINE_CONTINUER, Lexer, MATH, MULTI_DENT, NOT_REGEX, NUMBER, OPERATOR, POSSIBLY_DIVISION, REGEX, REGEX_FLAGS, REGEX_ILLEGAL, RELATION, RESERVED, Rewriter, SHIFT, SIMPLE_STRING_OMIT, STRICT_PROSCRIBED, STRING_DOUBLE, STRING_OMIT, STRING_SINGLE, STRING_START, TRAILING_BLANK_LINE, TRAILING_SPACES, UNARY, UNARY_MATH, VALID_FLAGS, WHITESPACE, compact, count, invertLiterate, isForFrom, isUnassignable, key, locationDataToString, ref, ref1, repeat, starts, throwSyntaxError,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
diff --git a/lib/coffee-script/nodes.js b/lib/coffee-script/nodes.js
index 7d8b50c4e0..1a8d360db1 100644
--- a/lib/coffee-script/nodes.js
+++ b/lib/coffee-script/nodes.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var Access, Arr, Assign, Base, Block, BooleanLiteral, Call, Class, Code, CodeFragment, Comment, Existence, Expansion, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportNamedDeclaration, ExportSpecifier, ExportSpecifierList, Extends, For, IdentifierLiteral, If, ImportClause, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, ImportSpecifierList, In, Index, InfinityLiteral, JS_FORBIDDEN, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, ModuleDeclaration, ModuleSpecifier, ModuleSpecifierList, NEGATE, NO, NaNLiteral, NullLiteral, NumberLiteral, Obj, Op, Param, Parens, PassthroughLiteral, PropertyName, Range, RegexLiteral, RegexWithInterpolations, Return, SIMPLENUM, Scope, Slice, Splat, StatementLiteral, StringLiteral, StringWithInterpolations, SuperCall, Switch, TAB, THIS, TaggedTemplateCall, ThisLiteral, Throw, Try, UTILITIES, UndefinedLiteral, Value, While, YES, YieldReturn, addLocationDataFn, compact, del, ends, extend, flatten, fragmentsToText, isComplexOrAssignable, isLiteralArguments, isLiteralThis, isUnassignable, locationDataToString, merge, multident, ref1, ref2, some, starts, throwSyntaxError, unfoldSoak, utility,
extend1 = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
diff --git a/lib/coffee-script/optparse.js b/lib/coffee-script/optparse.js
index b0ea83c89f..6b7743b505 100644
--- a/lib/coffee-script/optparse.js
+++ b/lib/coffee-script/optparse.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat;
diff --git a/lib/coffee-script/register.js b/lib/coffee-script/register.js
index b2ca5941b6..4a6216cb1c 100644
--- a/lib/coffee-script/register.js
+++ b/lib/coffee-script/register.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, i, len, loadFile, path, ref;
diff --git a/lib/coffee-script/repl.js b/lib/coffee-script/repl.js
index f6ee94c242..4f45535669 100644
--- a/lib/coffee-script/repl.js
+++ b/lib/coffee-script/repl.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, ref, replDefaults, runInContext, updateSyntaxError, vm;
diff --git a/lib/coffee-script/rewriter.js b/lib/coffee-script/rewriter.js
index 8021202c72..2f4941b436 100644
--- a/lib/coffee-script/rewriter.js
+++ b/lib/coffee-script/rewriter.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var BALANCED_PAIRS, CALL_CLOSERS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, k, left, len, ref, rite,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
diff --git a/lib/coffee-script/scope.js b/lib/coffee-script/scope.js
index cd8939fd86..67c9f75c29 100644
--- a/lib/coffee-script/scope.js
+++ b/lib/coffee-script/scope.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var Scope,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
diff --git a/lib/coffee-script/sourcemap.js b/lib/coffee-script/sourcemap.js
index ca396dfdea..91bae76c3d 100644
--- a/lib/coffee-script/sourcemap.js
+++ b/lib/coffee-script/sourcemap.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.12.3
+// Generated by CoffeeScript 1.12.4
(function() {
var LineMap, SourceMap;
From 79d38cc30bb17dfdb7e2102f5518aed21cfd2450 Mon Sep 17 00:00:00 2001
From: Geoffrey Booth
Date: Sat, 18 Feb 2017 02:53:56 -0500
Subject: [PATCH 09/11] Bump dependency version
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index a44457966e..b353a895eb 100644
--- a/package.json
+++ b/package.json
@@ -40,7 +40,7 @@
},
"devDependencies": {
"docco": "~0.7.0",
- "google-closure-compiler-js": "^20161201.0.1",
+ "google-closure-compiler-js": "^20170124.0.0",
"highlight.js": "~9.9.0",
"jison": ">=0.4.17",
"marked": "^0.3.6",
From f018e94be9d46b87d4b85855a977596fc56543f5 Mon Sep 17 00:00:00 2001
From: Geoffrey Booth
Date: Sat, 18 Feb 2017 02:54:15 -0500
Subject: [PATCH 10/11] Update changelog
---
docs/v1/index.html | 3 ++-
documentation/sections/changelog.md | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/docs/v1/index.html b/docs/v1/index.html
index f02456b361..befe5fd034 100644
--- a/docs/v1/index.html
+++ b/docs/v1/index.html
@@ -2612,11 +2612,12 @@
Web Chat (IRC)
Quick help and advice can usually be found in the Coff
The cake commands have been updated, with new watch options for most tasks. Clone the CoffeeScript repo and run cake at the root of the repo to see the options.
Fixed a bug where exporting a referenced variable was preventing the variable from being declared.
Fixed a bug where the coffee command wasn’t working for a .litcoffee file.
+
Bugfixes related to tokens and location data, for better source maps and improved compatibility with downstream tools.
diff --git a/documentation/sections/changelog.md b/documentation/sections/changelog.md
index a10680df01..10f9e90a16 100644
--- a/documentation/sections/changelog.md
+++ b/documentation/sections/changelog.md
@@ -1,12 +1,13 @@
## Change Log
```
-releaseHeader('2017-02-15', '1.12.4', '1.12.3')
+releaseHeader('2017-02-18', '1.12.4', '1.12.3')
```
* The `cake` commands have been updated, with new `watch` options for most tasks. Clone the [CoffeeScript repo](https://github.com/jashkenas/coffeescript) and run `cake` at the root of the repo to see the options.
* Fixed a bug where `export`ing a referenced variable was preventing the variable from being declared.
* Fixed a bug where the `coffee` command wasn’t working for a `.litcoffee` file.
+* Bugfixes related to tokens and location data, for better source maps and improved compatibility with downstream tools.
```
releaseHeader('2017-01-24', '1.12.3', '1.12.2')
From 664c7a4743de3c11259443d6c174d9600fdda1ae Mon Sep 17 00:00:00 2001
From: Geoffrey Booth
Date: Sat, 18 Feb 2017 02:54:41 -0500
Subject: [PATCH 11/11] Update compiled output
---
docs/v1/annotated-source/coffee-script.html | 1 +
docs/v1/annotated-source/lexer.html | 8 +-
docs/v1/annotated-source/nodes.html | 610 ++++++++++----------
docs/v1/annotated-source/scope.html | 4 +-
docs/v1/browser-compiler/coffee-script.js | 507 ++++++++--------
docs/v1/test.html | 98 +++-
6 files changed, 670 insertions(+), 558 deletions(-)
diff --git a/docs/v1/annotated-source/coffee-script.html b/docs/v1/annotated-source/coffee-script.html
index 99a4d22ab0..634839ba53 100644
--- a/docs/v1/annotated-source/coffee-script.html
+++ b/docs/v1/annotated-source/coffee-script.html
@@ -941,6 +941,7 @@
When setting the location, we sometimes need to update the start location to
+account for a newly-discovered new operator to the left of us. This
+expands the range on the left, but not the right.
+
+
+
+
updateLocationDataIfMissing: (locationData) ->
+ if @locationData and @needsUpdatedStartLocation
+ @locationData.first_line = locationData.first_line
+ @locationData.first_column = locationData.first_column
+ base = @variable?.base or @variable
+ if base.needsUpdatedStartLocation
+ @variable.locationData.first_line = locationData.first_line
+ @variable.locationData.first_column = locationData.first_column
+ base.updateLocationDataIfMissing locationData
+ delete @needsUpdatedStartLocation
+ super
If you call a function with a splat, it’s converted into a JavaScript
.apply() call to allow an array of arguments to be passed.
@@ -1551,11 +1579,11 @@
A range literal. Ranges can be used to extract portions (slices) of arrays,
to specify a range for comprehensions, or as a value, to be expanded into the
@@ -1887,11 +1915,11 @@
An array slice literal. Unlike JavaScript’s Array#slice, the second parameter
specifies the index of the end of the slice, just as the first parameter
@@ -2087,11 +2115,11 @@
We have to be careful when trying to slice through the end of the array,
9e9 is used because not all implementations respect undefined or 1/0.
@@ -2106,11 +2134,11 @@
use strict (and other directives) must be the first expression statement(s)
of a function body. This method ensures the prologue is correctly positioned
@@ -2478,11 +2506,11 @@
Instead of generating the JavaScript string directly, we build up the
equivalent syntax tree and compile that, in pieces. You can see the
@@ -2552,11 +2580,11 @@
Compile an assignment, delegating to compilePatternMatch or
compileSplice if appropriate. Keep track of the name of the base object
@@ -2846,11 +2874,11 @@
Brief implementation of recursive pattern matching, when assigning array or
object literals to a value. Peeks at their properties to assign inner names.
When compiling a conditional assignment, take care to ensure that the
operands are only evaluated once, even though we have to reference them
@@ -3125,11 +3153,11 @@
A function definition. This is the only node that creates a new Scope.
When for the purposes of walking the contents of a function body, the Code
@@ -3244,11 +3272,11 @@
Compilation creates a new scope unless explicitly asked to share with the
outer scope. Handles splat parameters in the parameter list by peeking at
@@ -3266,11 +3294,11 @@
A parameter in a function definition. Beyond a typical JavaScript parameter,
these parameters can also attach themselves to the context of the function,
@@ -3417,11 +3445,11 @@
A while loop, the only sort of low-level loop exposed by CoffeeScript. From
it, all other loops can be manufactured. Useful in cases where you need more
@@ -3777,11 +3805,11 @@
The main difference from a JavaScript while is that the CoffeeScript
while can be used as a part of a larger expression – while loops may
@@ -3814,11 +3842,11 @@
Checks a variable for existence – not null and not undefined. This is
similar to .nil? in Ruby, and avoids having to consult a JavaScript truth
@@ -4365,11 +4393,11 @@
An extra set of parentheses, specified explicitly in the source. At one time
we tried to clean up the results by detecting and removing redundant
@@ -4428,11 +4456,11 @@