CoffeeScript 2 aims to output as much idiomatic ES2015+ syntax as possible with as few breaking changes from CoffeeScript 1.x as possible. Some breaking changes, unfortunately, were unavoidable.
-
+
Bound (fat arrow) functions
In CoffeeScript 1.x, =>
compiled to a regular function
but with references to this
/@
rewritten to use the outer scope’s this
, or with the inner function bound to the outer scope via .bind
(hence the name “bound function”). In CoffeeScript 2, =>
compiles to ES2015’s =>
, which behaves slightly differently. The largest difference is that in ES2015, =>
functions lack an arguments
object:
Changelog
-
-
+
+
+ 2.3.0
+ —
+
- This release adds support for all the new features and syntaxes in ES2018 that weren’t already possible in CoffeeScript. For all of the below features, make sure that you transpile unless you know that your target runtime(s) support each feature.
- Asynchronous iterators are now supported. You can now
yield
an await
call, e.g. do -> until file.EOF then yield await file.readLine()
.
- Object splats/destructuring, a.k.a. object rest/spread syntax, has been standardized as part of ES2018 and therefore this release removes the polyfill that had previously been supporting this syntax. Code like
{a, b, rest...} = obj
now outputs more or less just like it appears, rather than being converted into an Object.assign
call. Note that there are some subtle differences between the Object.assign
polyfill and the native implementation.
- The exponentiation operator,
**
, and exponentiation assignment operator **=
are new to JavaScript in ES2018. Now code like a ** 3
is output as it appears, rather than being converted into Math.pow(a, 3)
as it was before.
- The
s
(dotAll) flag is now supported in regular expressions.
-
-
+
+ 2.2.4
+ —
+
- When the
by
value in a for
loop is a literal number, e.g. for x in [2..1] by -1
, fewer checks are necessary to determine if the loop is in range.
- Bugfix for regression in 2.2.0 where a statement inside parentheses, e.g.
(fn(); break) while condition
, was compiling. Pure statements like break
or return
cannot turn a parenthesized block into an expression, and should throw an error.
-
-
+
+ 2.2.3
+ —
+
- Bugfix for object destructuring with an empty array as a key’s value:
{ key: [] } = obj
.
- Bugfix for array destructuring onto targets attached to
this
: [ @most... , @penultimate, @last ] = arr
.
-
-
+
+ 2.2.2
+ —
+
- Bugfix for regression in 2.2.0 where a range with a
by
(step) value that increments or decrements in the opposite direction as the range was returning an array containing the first value of the range, whereas it should be returning an empty array. In other words, x for x in [2..1] by 1
should equal []
, not [2]
(because the step value is positive 1, counting up, whereas the range goes from 2 to 1, counting down).
- Bugfixes for allowing backslashes in
import
and export
statements and lines that trigger the start of an indented block, like an if
statement.
-
-
+
+ 2.2.1
+ —
+
- Bugfix for regression in 2.2.0 involving an error thrown by the compiler in certain cases when using destructuring with a splat or expansion in an array.
- Bugfix for regression in 2.2.0 where in certain cases a range iterator variable was declared in the global scope.
-
-
+
+ 2.2.0
+ —
+
- This release fixes all currently open bugs, dating as far back as 2014, 2012 and 2011.
- Potential breaking change: An inline
if
or switch
statement with an ambiguous else
, such as if no then if yes then alert 1 else alert 2
, now compiles where the else
always corresponds to the closest open then
. Previously the behavior of an ambiguous else
was unpredictable. If your code has any if … then
or switch … then
statements with multiple then
s (and one or more else
s) the compiled output might be different now, unless you had resolved ambiguity via parentheses. We made this change because the previous behavior was inconsistent and basically a bug: depending on what grammar was where, for example if there was an inline function or something that implied a block, the else
might bind to an earlier then
rather than a later then
. Now an else
essentially closes a block opened by a then
, similar to closing an open parenthesis.
- When a required
then
is missing, the error more accurately points out the location of the mistake.
@@ -5584,30 +5592,33 @@ - Bugfix for an expression in a property access, e.g.
a[!b in c..]
.
- Bugfix to allow a line continuation backslash (
\
) at any point in a for
line.
-
-
+
+ 2.1.1
+ —
+
- Bugfix to set the correct context for executable class bodies. So in
class @B extends @A then @property = 1
, the @
in @property
now refers to the class, not the global object.
- Bugfix where anonymous classes were getting created using the same automatic variable name. They now each receive unique names, so as not to override each other.
-
-
+
+ 2.1.0
+ —
+
- Computed property keys in object literals are now supported:
obj = { ['key' + i]: 42 }
, or obj = [Symbol.iterator]: -> yield i++
.
- Skipping of array elements, a.k.a. elision, is now supported:
arr = [a, , b]
, or [, protocol] = url.match /^(.*):\/\//
.
- JSX fragments syntax is now supported.
- Bugfix where
///
within a #
line comment inside a ///
block regex was erroneously closing the regex, rather than being treated as part of the comment.
- Bugfix for incorrect output for object rest destructuring inside array destructuring.
-
-
+
+ 2.0.3
+ —
+
- Bugfix for
export default
followed by an implicit object that contains an explicit object, for example exportedMember: { obj... }
.
- Bugfix for
key, val of obj
after an implicit object member, e.g. foo: bar for key, val of obj
.
- Bugfix for combining array and object destructuring, e.g.
[ ..., {a, b} ] = arr
.
@@ -5616,11 +5627,12 @@ - Bugfix for incorrect source maps generated when using
--transpile
with --map
for multiple input files.
- Bugfix for comments at the beginning or end of input into the REPL (
coffee --interactive
).
-
-
+
+ 2.0.2
+ —
+
--transpile
now also applies to require
d or import
ed CoffeeScript files.
--transpile
can be used with the REPL: coffee --interactive --transpile
.
- Improvements to comments output that should now cover all of the Flow comment-based syntax. Inline
###
comments near variable initial assignments are now output in the variable declaration statement, and ###
comments near a class and method names are now output where Flow expects them.
@@ -5631,30 +5643,33 @@ - Bugfix for comments not output before a complex
?
operation, e.g. @a ? b
.
- All tests now pass in Windows.
-
-
+
+ 2.0.1
+ —
+
babel-core
is no longer listed in package.json
, even as an optionalDependency
, to avoid it being automatically installed for most users. If you wish to use --transpile
, simply install babel-core
manually. See Transpilation.
--transpile
now relies on Babel to find its options, i.e. the .babelrc
file in the path of the file(s) being compiled. (Previously the CoffeeScript compiler was duplicating this logic, so nothing has changed from a user’s perspective.) This provides automatic support for additional ways to pass options to Babel in future versions, such as the .babelrc.js
file coming in Babel 7.
- Backticked expressions in a class body, outside any class methods, are now output in the JavaScript class body itself. This allows for passing through experimental JavaScript syntax like the class fields proposal, assuming your transpiler supports it.
-
-
+
+ 2.0.0
+ —
+
- Added
--transpile
flag or transpile
Node API option to tell the CoffeeScript compiler to pipe its output through Babel before saving or returning it; see Transpilation. Also changed the -t
short flag to refer to --transpile
instead of --tokens
.
- Always populate source maps’
sourcesContent
property.
- Bugfixes for destructuring and for comments in JSX.
- Note that these are only the changes between 2.0.0-beta5 and 2.0.0. See below for all changes since 1.x.
-
-
+
+
- Node 6 is now supported, and we will try to maintain that as the minimum required version for CoffeeScript 2 via the
coffee
command or Node API. Older versions of Node, or non-evergreen browsers, can compile via the browser compiler.
- The command line
--output
flag now allows you to specify an output filename, not just an output folder.
- The command line
--require
flag now properly handles filenames or module names that are invalid identifiers (like an NPM module with a hyphen in the name).
@@ -5667,11 +5682,12 @@ - Bugfixes for syntactical edge cases: semicolons after
=
and other “mid-expression” tokens; spaces after ::
; and scripts that begin with :
or *
.
- Bugfixes for source maps generated via the Node API; and stack trace line numbers when compiling CoffeeScript via the Node API from within a
.coffee
file.
-
-
+
+
- This release includes all the changes from 1.12.6 to 1.12.7.
- Line comments (starting with
#
) are now output in the generated JavaScript.
- Block comments (delimited by
###
) are now allowed anywhere, including inline where they previously weren’t possible. This provides support for static type annotations using Flow’s comments-based syntax.
@@ -5685,30 +5701,24 @@ - Bugfixes for object spread syntax in nested properties.
- Bugfixes for destructured function parameter default values.
-
-
-- Fix regressions in 1.12.6 related to chained function calls and indented
return
and throw
arguments.
-- The REPL no longer warns about assigning to
_
.
-
-
-
+
+
- JSX is now supported.
- Object rest/spread properties are now supported.
- Bound (fat arrow) methods are once again supported in classes; though an error will be thrown if you attempt to call the method before it is bound. See breaking changes for classes.
- The REPL no longer warns about assigning to
_
.
- Bugfixes for destructured nested default values and issues related to chaining or continuing expressions across multiple lines.
-
-
+
+
- This release includes all the changes from 1.12.5 to 1.12.6.
- Bound (fat arrow) methods in classes must be declared in the class constructor, after
super()
if the class is extending a parent class. See breaking changes for classes.
- All unnecessary utility helper functions have been removed, including the polyfills for
indexOf
and bind
.
@@ -5721,42 +5731,24 @@ - Calling functions
@get
or @set
no longer throws an error about required parentheses. (Bare get
or set
, not attached to an object or @
, still intentionally throws a compiler error.)
- If
$XDG_CACHE_HOME
is set, the REPL .coffee_history
file is saved there.
-
-
-- The
return
and export
keywords can now accept implicit objects (defined by indentation, without needing braces).
-- Support Unicode code point escapes (e.g.
\u{1F4A9}
).
-- The
coffee
command now first looks to see if CoffeeScript is installed under node_modules
in the current folder, and executes the coffee
binary there if so; or otherwise it runs the globally installed one. This allows you to have one version of CoffeeScript installed globally and a different one installed locally for a particular project. (Likewise for the cake
command.)
-- Bugfixes for chained function calls not closing implicit objects or ternaries.
-- Bugfixes for incorrect code generated by the
?
operator within a termary if
statement.
-- Fixed some tests, and failing tests now result in a nonzero exit code.
-
-
-
+
+
- Initial beta release of CoffeeScript 2. No further breaking changes are anticipated.
- Destructured objects and arrays now output using ES2015+ syntax whenever possible.
- Literate CoffeeScript now has much better support for parsing Markdown, thanks to using Markdown-It to detect Markdown sections rather than just looking at indentation.
- Calling a function named
get
or set
now requires parentheses, to disambiguate from the get
or set
keywords (which are disallowed).
- The compiler now requires Node 7.6+, the first version of Node to support asynchronous functions without requiring a flag.
-
-
-- Better handling of
default
, from
, as
and *
within import
and export
statements. You can now import or export a member named default
and the compiler won’t interpret it as the default
keyword.
-- Fixed a bug where invalid octal escape sequences weren’t throwing errors in the compiler.
-
-
-
+
+
- Initial alpha release of CoffeeScript 2. The CoffeeScript compiler now outputs ES2015+ syntax whenever possible. See breaking changes.
- Classes are output using ES2015
class
and extends
keywords.
- Added support for
async
/await
.
@@ -5770,48 +5762,84 @@ - Browser compiler is now minified using the Google Closure Compiler (JavaScript version).
- Node 7+ required for CoffeeScript 2.
-
-
+
+ 1.12.7
+ —
+
+- Fix regressions in 1.12.6 related to chained function calls and indented
return
and throw
arguments.
+- The REPL no longer warns about assigning to
_
.
+
+
+
+
+ 1.12.6
+ —
+
+- The
return
and export
keywords can now accept implicit objects (defined by indentation, without needing braces).
+- Support Unicode code point escapes (e.g.
\u{1F4A9}
).
+- The
coffee
command now first looks to see if CoffeeScript is installed under node_modules
in the current folder, and executes the coffee
binary there if so; or otherwise it runs the globally installed one. This allows you to have one version of CoffeeScript installed globally and a different one installed locally for a particular project. (Likewise for the cake
command.)
+- Bugfixes for chained function calls not closing implicit objects or ternaries.
+- Bugfixes for incorrect code generated by the
?
operator within a termary if
statement.
+- Fixed some tests, and failing tests now result in a nonzero exit code.
+
+
+
+
+ 1.12.5
+ —
+
+- Better handling of
default
, from
, as
and *
within import
and export
statements. You can now import or export a member named default
and the compiler won’t interpret it as the default
keyword.
+- Fixed a bug where invalid octal escape sequences weren’t throwing errors in the compiler.
+
+
+
+
+ 1.12.4
+ —
+
- 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
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.
-
-
+
+ 1.12.3
+ —
+
@
values can now be used as indices in for
expressions. This loosens the compilation of for
expressions to allow the index variable to be an @
value, e.g. do @visit for @node, @index in nodes
. Within @visit
, the index of the current node (@node
) would be available as @index
.
- CoffeeScript’s patched
Error.prepareStackTrace
has been restored, with some revisions that should prevent the erroneous exceptions that were making life difficult for some downstream projects. This fixes the incorrect line numbers in stack traces since 1.12.2.
- The
//=
operator’s output now wraps parentheses around the right operand, like the other assignment operators.
-
-
+
+ 1.12.2
+ —
+
- The browser compiler can once again be built unminified via
MINIFY=false cake build:browser
.
- The error-prone patched version of
Error.prepareStackTrace
has been removed.
- Command completion in the REPL (pressing tab to get suggestions) has been fixed for Node 6.9.1+.
- The browser-based tests now include all the tests as the Node-based version.
-
-
+
+ 1.12.1
+ —
+
- You can now import a module member named
default
, e.g. import { default } from 'lib'
. Though like in ES2015, you cannot import an entire module and name it default
(so import default from 'lib'
is not allowed).
- Fix regression where
from
as a variable name was breaking for
loop declarations. For the record, from
is not a reserved word in CoffeeScript; you may use it for variable names. from
behaves like a keyword within the context of import
and export
statements, and in the declaration of a for
loop; though you should also be able to use variables named from
in those contexts, and the compiler should be able to tell the difference.
-
-
+
+ 1.12.0
+ —
+
- CoffeeScript now supports ES2015 tagged template literals. Note that using tagged template literals in your code makes you responsible for ensuring that either your runtime supports tagged template literals or that you transpile the output JavaScript further to a version your target runtime(s) support.
- CoffeeScript now provides a
for…from
syntax for outputting ES2015 for…of
. (Sorry they couldn’t match, but we came up with for…of
first for something else.) This allows iterating over generators or any other iterable object. Note that using for…from
in your code makes you responsible for ensuring that either your runtime supports for…of
or that you transpile the output JavaScript further to a version your target runtime(s) support.
- Triple backticks (
```
) allow the creation of embedded JavaScript blocks where escaping single backticks is not required, which should improve interoperability with ES2015 template literals and with Markdown.
@@ -5821,21 +5849,23 @@ - The compiler now throws an error on trying to export an anonymous class.
- Bugfixes related to tokens and location data, for better source maps and improved compatibility with downstream tools.
-
-
+
+ 1.11.1
+ —
+
- Bugfix for shorthand object syntax after interpolated keys.
- Bugfix for indentation-stripping in
"""
strings.
- Bugfix for not being able to use the name “arguments” for a prototype property of class.
- Correctly compile large hexadecimal numbers literals to
2e308
(just like all other large number literals do).
-
-
+
+ 1.11.0
+ —
+
- CoffeeScript now supports ES2015
import
and export
syntax.
- Added the
-M, --inline-map
flag to the compiler, allowing you embed the source map directly into the output JavaScript, rather than as a separate file.
- A bunch of fixes for
yield
:
@@ -5869,11 +5899,12 @@
-
-
+
+ 1.10.0
+ —
+
- CoffeeScript now supports ES2015-style destructuring defaults.
(offsetHeight: height) ->
no longer compiles. That syntax was accidental and partly broken. Use ({offsetHeight: height}) ->
instead. Object destructuring always requires braces.
- Several minor bug fixes, including:
@@ -5885,54 +5916,59 @@
-
-
+
+ 1.9.3
+ —
+
- Bugfix for interpolation in the first key of an object literal in an implicit call.
- Fixed broken error messages in the REPL, as well as a few minor bugs with the REPL.
- Fixed source mappings for tokens at the beginning of lines when compiling with the
--bare
option. This has the nice side effect of generating smaller source maps.
- Slight formatting improvement of compiled block comments.
- Better error messages for
on
, off
, yes
and no
.
-
-
+
+ 1.9.2
+ —
+
- Fixed a watch mode error introduced in 1.9.1 when compiling multiple files with the same filename.
- Bugfix for
yield
around expressions containing this
.
- Added a Ruby-style
-r
option to the REPL, which allows requiring a module before execution with --eval
or --interactive
.
- In
<script type="text/coffeescript">
tags, to avoid possible duplicate browser requests for .coffee files, you can now use the data-src
attribute instead of src
.
- Minor bug fixes for IE8, strict ES5 regular expressions and Browserify.
-
-
+
+ 1.9.1
+ —
+
- Interpolation now works in object literal keys (again). You can use this to dynamically name properties.
- Internal compiler variable names no longer start with underscores. This makes the generated JavaScript a bit prettier, and also fixes an issue with the completely broken and ungodly way that AngularJS “parses” function arguments.
- Fixed a few
yield
-related edge cases with yield return
and yield throw
.
- Minor bug fixes and various improvements to compiler error messages.
-
-
+
+ 1.9.0
+ —
+
- CoffeeScript now supports ES2015 generators. A generator is simply a function that
yield
s.
- More robust parsing and improved error messages for strings and regexes — especially with respect to interpolation.
- Changed strategy for the generation of internal compiler variable names. Note that this means that
@example
function parameters are no longer available as naked example
variables within the function body.
- Fixed REPL compatibility with latest versions of Node and Io.js.
- Various minor bug fixes.
-
-
+
+ 1.8.0
+ —
+
- The
--join
option of the CLI is now deprecated.
- Source maps now use
.js.map
as file extension, instead of just .map
.
- The CLI now exits with the exit code 1 when it fails to write a file to disk.
@@ -5945,18 +5981,20 @@ - The CoffeeScript REPL is now exported and can be required using
require 'coffeescript/repl'
.
- Fixes for the REPL in Node 0.11.
-
-
+
+ 1.7.1
+ —
+
- Fixed a typo that broke node module lookup when running a script directly with the
coffee
binary.
-
-
+
+ 1.7.0
+ —
+
- When requiring CoffeeScript files in Node you must now explicitly register the compiler. This can be done with
require 'coffeescript/register'
or CoffeeScript.register()
. Also for configuration such as Mocha’s, use coffeescript/register.
- Improved error messages, source maps and stack traces. Source maps now use the updated
//#
syntax.
- Leading
.
now closes all open calls, allowing for simpler chaining syntax.
@@ -5968,72 +6006,79 @@ - No more
-p
folders on Windows.
- The
options
object passed to CoffeeScript is no longer mutated.
-
-
+
+ 1.6.3
+ —
+
- The CoffeeScript REPL now remembers your history between sessions. Just like a proper REPL should.
- You can now use
require
in Node to load .coffee.md
Literate CoffeeScript files. In the browser, text/literate-coffeescript
script tags.
- The old
coffee --lint
command has been removed. It was useful while originally working on the compiler, but has been surpassed by JSHint. You may now use -l
to pass literate files in over stdio.
- Bugfixes for Windows path separators,
catch
without naming the error, and executable-class-bodies-with- prototypal-property-attachment.
-
-
+
+ 1.6.2
+ —
+
- Source maps have been used to provide automatic line-mapping when running CoffeeScript directly via the
coffee
command, and for automatic line-mapping when running CoffeeScript directly in the browser. Also, to provide better error messages for semantic errors thrown by the compiler — with colors, even.
- Improved support for mixed literate/vanilla-style CoffeeScript projects, and generating source maps for both at the same time.
- Fixes for 1.6.x regressions with overriding inherited bound functions, and for Windows file path management.
- The
coffee
command can now correctly fork()
both .coffee
and .js
files. (Requires Node.js 0.9+)
-
-
+
+ 1.6.1
+ —
+
- First release of source maps. Pass the
--map
flag to the compiler, and off you go. Direct all your thanks over to Jason Walton.
- Fixed a 1.5.0 regression with multiple implicit calls against an indented implicit object. Combinations of implicit function calls and implicit objects should generally be parsed better now — but it still isn’t good style to nest them too heavily.
.coffee.md
is now also supported as a Literate CoffeeScript file extension, for existing tooling. .litcoffee
remains the canonical one.
- Several minor fixes surrounding member properties, bound methods and
super
in class declarations.
-
-
+
+ 1.5.0
+ —
+
- First release of Literate CoffeeScript.
- The CoffeeScript REPL is now based on the Node.js REPL, and should work better and more familiarly.
- Returning explicit values from constructors is now forbidden. If you want to return an arbitrary value, use a function, not a constructor.
- You can now loop over an array backwards, without having to manually deal with the indexes:
for item in list by -1
- Source locations are now preserved in the CoffeeScript AST, although source maps are not yet being emitted.
-
-
+
+ 1.4.0
+ —
+
- The CoffeeScript compiler now strips Microsoft’s UTF-8 BOM if it exists, allowing you to compile BOM-borked source files.
- Fix Node/compiler deprecation warnings by removing
registerExtension
, and moving from path.exists
to fs.exists
.
- Small tweaks to splat compilation, backticks, slicing, and the error for duplicate keys in object literals.
-
-
+
+ 1.3.3
+ —
+
- Due to the new semantics of JavaScript’s strict mode, CoffeeScript no longer guarantees that constructor functions have names in all runtimes. See #2052 for discussion.
- Inside of a nested function inside of an instance method, it’s now possible to call
super
more reliably (walks recursively up).
- Named loop variables no longer have different scoping heuristics than other local variables. (Reverts #643)
- Fix for splats nested within the LHS of destructuring assignment.
- Corrections to our compile time strict mode forbidding of octal literals.
-
-
+
+ 1.3.1
+ —
+
- CoffeeScript now enforces all of JavaScript’s Strict Mode early syntax errors at compile time. This includes old-style octal literals, duplicate property names in object literals, duplicate parameters in a function definition, deleting naked variables, setting the value of
eval
or arguments
, and more. See a full discussion at #1547.
- The REPL now has a handy new multi-line mode for entering large blocks of code. It’s useful when copy-and-pasting examples into the REPL. Enter multi-line mode with
Ctrl-V
. You may also now pipe input directly into the REPL.
- CoffeeScript now prints a
Generated by CoffeeScript VERSION
header at the top of each compiled file.
@@ -6043,21 +6088,23 @@ - Both endpoints of a slice are now allowed to be omitted for consistency, effectively creating a shallow copy of the list.
- Additional tweaks and improvements to
coffee --watch
under Node’s “new” file watching API. Watch will now beep by default if you introduce a syntax error into a watched script. We also now ignore hidden directories by default when watching recursively.
-
-
+
+ 1.2.0
+ —
+
- Multiple improvements to
coffee --watch
and --join
. You may now use both together, as well as add and remove files and directories within a --watch
’d folder.
- The
throw
statement can now be used as part of an expression.
- Block comments at the top of the file will now appear outside of the safety closure wrapper.
- 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 within bound class functions to have the incorrect
this
.
-
-
+
+ 1.1.3
+ —
+
- Ahh, whitespace. CoffeeScript’s compiled JS now tries to space things out and keep it readable, as you can see in the examples on this page.
- You can now call
super
in class level methods in class bodies, and bound class methods now preserve their correct context.
- JavaScript has always supported octal numbers
010 is 8
, and hexadecimal numbers 0xf is 15
, but CoffeeScript now also supports binary numbers: 0b10 is 2
.
@@ -6066,226 +6113,268 @@ - The
coffee --watch
feature now only works on Node.js 0.6.0 and higher, but now also works properly on Windows.
- Lots of small bug fixes from @michaelficarra, @geraldalewis, @satyr, and @trevorburnham.
-
-Fixes for block comment formatting, ?=
compilation, implicit calls against control structures, implicit invocation of a try/catch block, variadic arguments leaking from local scope, line numbers in syntax errors following heregexes, property access on parenthesized number literals, bound class methods and super with reserved names, a REPL overhaul, consecutive compiled semicolons, block comments in implicitly called objects, and a Chrome bug.
-
-Bugfix release for classes with external constructor functions, see issue #1182.
-
-When running via the coffee
executable, process.argv
and friends now report coffee
instead of node
. Better compatibility with Node.js 0.4.x module lookup changes. The output in the REPL is now colorized, like Node’s is. Giving your concatenated CoffeeScripts a name when using --join
is now mandatory. Fix for lexing compound division /=
as a regex accidentally. All text/coffeescript
tags should now execute in the order they’re included. Fixed an issue with extended subclasses using external constructor functions. Fixed an edge-case infinite loop in addImplicitParentheses
. Fixed exponential slowdown with long chains of function calls. Globals no longer leak into the CoffeeScript REPL. Splatted parameters are declared local to the function.
-
-Fixed a lexer bug with Unicode identifiers. Updated REPL for compatibility with Node.js 0.3.7. Fixed requiring relative paths in the REPL. Trailing return
and return undefined
are now optimized away. Stopped requiring the core Node.js util
module for back-compatibility with Node.js 0.2.5. Fixed a case where a conditional return
would cause fallthrough in a switch
statement. Optimized empty objects in destructuring assignment.
-
-CoffeeScript loops no longer try to preserve block scope when functions are being generated within the loop body. Instead, you can use the do
keyword to create a convenient closure wrapper. Added a --nodejs
flag for passing through options directly to the node
executable. Better behavior around the use of pure statements within expressions. Fixed inclusive slicing through -1
, for all browsers, and splicing with arbitrary expressions as endpoints.
-
-The REPL now properly formats stacktraces, and stays alive through asynchronous exceptions. Using --watch
now prints timestamps as files are compiled. Fixed some accidentally-leaking variables within plucked closure-loops. Constructors now maintain their declaration location within a class body. Dynamic object keys were removed. Nested classes are now supported. Fixes execution context for naked splatted functions. Bugfix for inversion of chained comparisons. Chained class instantiation now works properly with splats.
-
-0.9.5 should be considered the first release candidate for CoffeeScript 1.0. There have been a large number of internal changes since the previous release, many contributed from satyr’s Coco dialect of CoffeeScript. Heregexes (extended regexes) were added. Functions can now have default arguments. Class bodies are now executable code. Improved syntax errors for invalid CoffeeScript. undefined
now works like null
, and cannot be assigned a new value. There was a precedence change with respect to single-line comprehensions: result = i for i in list
+
+
+
+ 1.1.2
+ —
+
Fixes for block comment formatting, ?=
compilation, implicit calls against control structures, implicit invocation of a try/catch block, variadic arguments leaking from local scope, line numbers in syntax errors following heregexes, property access on parenthesized number literals, bound class methods and super with reserved names, a REPL overhaul, consecutive compiled semicolons, block comments in implicitly called objects, and a Chrome bug.
+
+
+
+ 1.1.1
+ —
+
Bugfix release for classes with external constructor functions, see issue #1182.
+
+
+
+ 1.1.0
+ —
+
When running via the coffee
executable, process.argv
and friends now report coffee
instead of node
. Better compatibility with Node.js 0.4.x module lookup changes. The output in the REPL is now colorized, like Node’s is. Giving your concatenated CoffeeScripts a name when using --join
is now mandatory. Fix for lexing compound division /=
as a regex accidentally. All text/coffeescript
tags should now execute in the order they’re included. Fixed an issue with extended subclasses using external constructor functions. Fixed an edge-case infinite loop in addImplicitParentheses
. Fixed exponential slowdown with long chains of function calls. Globals no longer leak into the CoffeeScript REPL. Splatted parameters are declared local to the function.
+
+
+
+ 1.0.1
+ —
+
Fixed a lexer bug with Unicode identifiers. Updated REPL for compatibility with Node.js 0.3.7. Fixed requiring relative paths in the REPL. Trailing return
and return undefined
are now optimized away. Stopped requiring the core Node.js util
module for back-compatibility with Node.js 0.2.5. Fixed a case where a conditional return
would cause fallthrough in a switch
statement. Optimized empty objects in destructuring assignment.
+
+
+
+ 1.0.0
+ —
+
CoffeeScript loops no longer try to preserve block scope when functions are being generated within the loop body. Instead, you can use the do
keyword to create a convenient closure wrapper. Added a --nodejs
flag for passing through options directly to the node
executable. Better behavior around the use of pure statements within expressions. Fixed inclusive slicing through -1
, for all browsers, and splicing with arbitrary expressions as endpoints.
+
+
+
+ 0.9.6
+ —
+
The REPL now properly formats stacktraces, and stays alive through asynchronous exceptions. Using --watch
now prints timestamps as files are compiled. Fixed some accidentally-leaking variables within plucked closure-loops. Constructors now maintain their declaration location within a class body. Dynamic object keys were removed. Nested classes are now supported. Fixes execution context for naked splatted functions. Bugfix for inversion of chained comparisons. Chained class instantiation now works properly with splats.
+
+
+
+ 0.9.5
+ —
+
0.9.5 should be considered the first release candidate for CoffeeScript 1.0. There have been a large number of internal changes since the previous release, many contributed from satyr’s Coco dialect of CoffeeScript. Heregexes (extended regexes) were added. Functions can now have default arguments. Class bodies are now executable code. Improved syntax errors for invalid CoffeeScript. undefined
now works like null
, and cannot be assigned a new value. There was a precedence change with respect to single-line comprehensions: result = i for i in list
used to parse as result = (i for i in list)
by default … it now parses as
(result = i) for i in list
.
-
-CoffeeScript now uses appropriately-named temporary variables, and recycles their references after use. Added require.extensions
support for Node.js 0.3. Loading CoffeeScript in the browser now adds just a single CoffeeScript
object to global scope. Fixes for implicit object and block comment edge cases.
-
-CoffeeScript switch
statements now compile into JS switch
statements — they previously compiled into if/else
chains for JavaScript 1.3 compatibility. Soaking a function invocation is now supported. Users of the RubyMine editor should now be able to use --watch
mode.
-
-Specifying the start and end of a range literal is now optional, eg. array[3..]
. You can now say a not instanceof b
. Fixed important bugs with nested significant and non-significant indentation (Issue #637). Added a --require
flag that allows you to hook into the coffee
command. Added a custom jsl.conf
file for our preferred JavaScriptLint setup. Sped up Jison grammar compilation time by flattening rules for operations. Block comments can now be used with JavaScript-minifier-friendly syntax. Added JavaScript’s compound assignment bitwise operators. Bugfixes to implicit object literals with leading number and string keys, as the subject of implicit calls, and as part of compound assignment.
-
-Bugfix release for 0.9.1. Greatly improves the handling of mixed implicit objects, implicit function calls, and implicit indentation. String and regex interpolation is now strictly #{ … }
(Ruby style). The compiler now takes a --require
flag, which specifies scripts to run before compilation.
-
-The CoffeeScript 0.9 series is considered to be a release candidate for 1.0; let’s give her a shakedown cruise. 0.9.0 introduces a massive backwards-incompatible change: Assignment now uses =
, and object literals use :
, as in JavaScript. This allows us to have implicit object literals, and YAML-style object definitions. Half assignments are removed, in favor of +=
, or=
, and friends. Interpolation now uses a hash mark #
instead of the dollar sign $
— because dollar signs may be part of a valid JS identifier. Downwards range comprehensions are now safe again, and are optimized to straight for loops when created with integer endpoints. A fast, unguarded form of object comprehension was added: for all key, value of object
. Mentioning the super
keyword with no arguments now forwards all arguments passed to the function, as in Ruby. If you extend class B
from parent class A
, if A
has an extended
method defined, it will be called, passing in B
— this enables static inheritance, among other things. Cleaner output for functions bound with the fat arrow. @variables
can now be used in parameter lists, with the parameter being automatically set as a property on the object — useful in constructors and setter functions. Constructor functions can now take splats.
-
-Quick bugfix (right after 0.7.1) for a problem that prevented coffee
command-line options from being parsed in some circumstances.
-
-Block-style comments are now passed through and printed as JavaScript block comments – making them useful for licenses and copyright headers. Better support for running coffee scripts standalone via hashbangs. Improved syntax errors for tokens that are not in the grammar.
-
-Official CoffeeScript variable style is now camelCase, as in JavaScript. Reserved words are now allowed as object keys, and will be quoted for you. Range comprehensions now generate cleaner code, but you have to specify by -1
if you’d like to iterate downward. Reporting of syntax errors is greatly improved from the previous release. Running coffee
with no arguments now launches the REPL, with Readline support. The <-
bind operator has been removed from CoffeeScript. The loop
keyword was added, which is equivalent to a while true
loop. Comprehensions that contain closures will now close over their variables, like the semantics of a forEach
. You can now use bound function in class definitions (bound to the instance). For consistency, a in b
is now an array presence check, and a of b
is an object-key check. Comments are no longer passed through to the generated JavaScript.
-
-The coffee
command will now preserve directory structure when compiling a directory full of scripts. Fixed two omissions that were preventing the CoffeeScript compiler from running live within Internet Explorer. There’s now a syntax for block comments, similar in spirit to CoffeeScript’s heredocs. ECMA Harmony DRY-style pattern matching is now supported, where the name of the property is the same as the name of the value: {name, length}: func
. Pattern matching is now allowed within comprehension variables. unless
is now allowed in block form. until
loops were added, as the inverse of while
loops. switch
statements are now allowed without switch object clauses. Compatible with Node.js v0.1.95.
-
-Upgraded CoffeeScript for compatibility with the new Node.js v0.1.90 series.
-
-Trailing commas are now allowed, a-la Python. Static properties may be assigned directly within class definitions, using @property
notation.
-
-Interpolation can now be used within regular expressions and heredocs, as well as strings. Added the <-
bind operator. Allowing assignment to half-expressions instead of special ||=
-style operators. The arguments object is no longer automatically converted into an array. After requiring coffeescript
, Node.js can now directly load .coffee
files, thanks to registerExtension. Multiple splats can now be used in function calls, arrays, and pattern matching.
-
-String interpolation, contributed by Stan Angeloff. Since --run
has been the default since 0.5.3, updating --stdio
and --eval
to run by default, pass --compile
as well if you’d like to print the result.
-
-Bugfix that corrects the Node.js global constants __filename
and __dirname
. Tweaks for more flexible parsing of nested function literals and improperly-indented comments. Updates for the latest Node.js API.
-
-CoffeeScript now has a syntax for defining classes. Many of the core components (Nodes, Lexer, Rewriter, Scope, Optparse) are using them. Cakefiles can use optparse.coffee
to define options for tasks. --run
is now the default flag for the coffee
command, use --compile
to save JavaScripts. Bugfix for an ambiguity between RegExp literals and chained divisions.
-
-Added a compressed version of the compiler for inclusion in web pages as
+
+
+
+ 0.9.4
+ —
+
CoffeeScript now uses appropriately-named temporary variables, and recycles their references after use. Added require.extensions
support for Node.js 0.3. Loading CoffeeScript in the browser now adds just a single CoffeeScript
object to global scope. Fixes for implicit object and block comment edge cases.
+
+
+
+ 0.9.3
+ —
+
CoffeeScript switch
statements now compile into JS switch
statements — they previously compiled into if/else
chains for JavaScript 1.3 compatibility. Soaking a function invocation is now supported. Users of the RubyMine editor should now be able to use --watch
mode.
+
+
+
+ 0.9.2
+ —
+
Specifying the start and end of a range literal is now optional, eg. array[3..]
. You can now say a not instanceof b
. Fixed important bugs with nested significant and non-significant indentation (Issue #637). Added a --require
flag that allows you to hook into the coffee
command. Added a custom jsl.conf
file for our preferred JavaScriptLint setup. Sped up Jison grammar compilation time by flattening rules for operations. Block comments can now be used with JavaScript-minifier-friendly syntax. Added JavaScript’s compound assignment bitwise operators. Bugfixes to implicit object literals with leading number and string keys, as the subject of implicit calls, and as part of compound assignment.
+
+
+
+ 0.9.1
+ —
+
Bugfix release for 0.9.1. Greatly improves the handling of mixed implicit objects, implicit function calls, and implicit indentation. String and regex interpolation is now strictly #{ … }
(Ruby style). The compiler now takes a --require
flag, which specifies scripts to run before compilation.
+
+
+
+ 0.9.0
+ —
+
The CoffeeScript 0.9 series is considered to be a release candidate for 1.0; let’s give her a shakedown cruise. 0.9.0 introduces a massive backwards-incompatible change: Assignment now uses =
, and object literals use :
, as in JavaScript. This allows us to have implicit object literals, and YAML-style object definitions. Half assignments are removed, in favor of +=
, or=
, and friends. Interpolation now uses a hash mark #
instead of the dollar sign $
— because dollar signs may be part of a valid JS identifier. Downwards range comprehensions are now safe again, and are optimized to straight for loops when created with integer endpoints. A fast, unguarded form of object comprehension was added: for all key, value of object
. Mentioning the super
keyword with no arguments now forwards all arguments passed to the function, as in Ruby. If you extend class B
from parent class A
, if A
has an extended
method defined, it will be called, passing in B
— this enables static inheritance, among other things. Cleaner output for functions bound with the fat arrow. @variables
can now be used in parameter lists, with the parameter being automatically set as a property on the object — useful in constructors and setter functions. Constructor functions can now take splats.
+
+
+
+ 0.7.2
+ —
+
Quick bugfix (right after 0.7.1) for a problem that prevented coffee
command-line options from being parsed in some circumstances.
+
+
+
+ 0.7.1
+ —
+
Block-style comments are now passed through and printed as JavaScript block comments – making them useful for licenses and copyright headers. Better support for running coffee scripts standalone via hashbangs. Improved syntax errors for tokens that are not in the grammar.
+
+
+
+ 0.7.0
+ —
+
Official CoffeeScript variable style is now camelCase, as in JavaScript. Reserved words are now allowed as object keys, and will be quoted for you. Range comprehensions now generate cleaner code, but you have to specify by -1
if you’d like to iterate downward. Reporting of syntax errors is greatly improved from the previous release. Running coffee
with no arguments now launches the REPL, with Readline support. The <-
bind operator has been removed from CoffeeScript. The loop
keyword was added, which is equivalent to a while true
loop. Comprehensions that contain closures will now close over their variables, like the semantics of a forEach
. You can now use bound function in class definitions (bound to the instance). For consistency, a in b
is now an array presence check, and a of b
is an object-key check. Comments are no longer passed through to the generated JavaScript.
+
+
+
+ 0.6.2
+ —
+
The coffee
command will now preserve directory structure when compiling a directory full of scripts. Fixed two omissions that were preventing the CoffeeScript compiler from running live within Internet Explorer. There’s now a syntax for block comments, similar in spirit to CoffeeScript’s heredocs. ECMA Harmony DRY-style pattern matching is now supported, where the name of the property is the same as the name of the value: {name, length}: func
. Pattern matching is now allowed within comprehension variables. unless
is now allowed in block form. until
loops were added, as the inverse of while
loops. switch
statements are now allowed without switch object clauses. Compatible with Node.js v0.1.95.
+
+
+
+ 0.6.1
+ —
+
Upgraded CoffeeScript for compatibility with the new Node.js v0.1.90 series.
+
+
+
+ 0.6.0
+ —
+
Trailing commas are now allowed, a-la Python. Static properties may be assigned directly within class definitions, using @property
notation.
+
+
+
+ 0.5.6
+ —
+
Interpolation can now be used within regular expressions and heredocs, as well as strings. Added the <-
bind operator. Allowing assignment to half-expressions instead of special ||=
-style operators. The arguments object is no longer automatically converted into an array. After requiring coffeescript
, Node.js can now directly load .coffee
files, thanks to registerExtension. Multiple splats can now be used in function calls, arrays, and pattern matching.
+
+
+
+ 0.5.5
+ —
+
String interpolation, contributed by Stan Angeloff. Since --run
has been the default since 0.5.3, updating --stdio
and --eval
to run by default, pass --compile
as well if you’d like to print the result.
+
+
+
+ 0.5.4
+ —
+
Bugfix that corrects the Node.js global constants __filename
and __dirname
. Tweaks for more flexible parsing of nested function literals and improperly-indented comments. Updates for the latest Node.js API.
+
+
+
+ 0.5.3
+ —
+
CoffeeScript now has a syntax for defining classes. Many of the core components (Nodes, Lexer, Rewriter, Scope, Optparse) are using them. Cakefiles can use optparse.coffee
to define options for tasks. --run
is now the default flag for the coffee
command, use --compile
to save JavaScripts. Bugfix for an ambiguity between RegExp literals and chained divisions.
+
+
+
+ 0.5.2
+ —
+
Added a compressed version of the compiler for inclusion in web pages as
/v2/browser-compiler/coffeescript.js
. It’ll automatically run any script tags with type text/coffeescript
for you. Added a --stdio
option to the coffee
command, for piped-in compiles.
-
-Improvements to null soaking with the existential operator, including soaks on indexed properties. Added conditions to while
loops, so you can use them as filters with when
, in the same manner as comprehensions.
-
-CoffeeScript 0.5.0 is a major release, While there are no language changes, the Ruby compiler has been removed in favor of a self-hosting compiler written in pure CoffeeScript.
-
-@property
is now a shorthand for this.property
.
+
+
+
+ 0.5.1
+ —
+
Improvements to null soaking with the existential operator, including soaks on indexed properties. Added conditions to while
loops, so you can use them as filters with when
, in the same manner as comprehensions.
+
+
+
+ 0.5.0
+ —
+
CoffeeScript 0.5.0 is a major release, While there are no language changes, the Ruby compiler has been removed in favor of a self-hosting compiler written in pure CoffeeScript.
+
+
+
+ 0.3.2
+ —
+
@property
is now a shorthand for this.property
.
Switched the default JavaScript engine from Narwhal to Node.js. Pass the --narwhal
flag if you’d like to continue using it.
-
-CoffeeScript 0.3 includes major syntax changes:
+
+
+
+ 0.3.0
+ —
+
CoffeeScript 0.3 includes major syntax changes:
The function symbol was changed to ->
, and the bound function symbol is now =>
.
Parameter lists in function definitions must now be wrapped in parentheses.
Added property soaking, with the ?.
operator.
Made parentheses optional, when invoking functions with arguments.
Removed the obsolete block literal syntax.
-
-Added Python-style chained comparisons, the conditional existence operator ?=
, and some examples from Beautiful Code. Bugfixes relating to statement-to-expression conversion, arguments-to-array conversion, and the TextMate syntax highlighter.
-
-The conditions in switch statements can now take multiple values at once — If any of them are true, the case will run. Added the long arrow ==>
, which defines and immediately binds a function to this
. While loops can now be used as expressions, in the same way that comprehensions can. Splats can be used within pattern matches to soak up the rest of an array.
-
-Added ECMAScript Harmony style destructuring assignment, for dealing with extracting values from nested arrays and objects. Added indentation-sensitive heredocs for nicely formatted strings or chunks of code.
-
-Axed the unsatisfactory ino
keyword, replacing it with of
for object comprehensions. They now look like: for prop, value of object
.
-
-When performing a comprehension over an object, use ino
, instead of in
, which helps us generate smaller, more efficient code at compile time.
+
+
+
+ 0.2.6
+ —
+
Added Python-style chained comparisons, the conditional existence operator ?=
, and some examples from Beautiful Code. Bugfixes relating to statement-to-expression conversion, arguments-to-array conversion, and the TextMate syntax highlighter.
+
+
+
+ 0.2.5
+ —
+
The conditions in switch statements can now take multiple values at once — If any of them are true, the case will run. Added the long arrow ==>
, which defines and immediately binds a function to this
. While loops can now be used as expressions, in the same way that comprehensions can. Splats can be used within pattern matches to soak up the rest of an array.
+
+
+
+ 0.2.4
+ —
+
Added ECMAScript Harmony style destructuring assignment, for dealing with extracting values from nested arrays and objects. Added indentation-sensitive heredocs for nicely formatted strings or chunks of code.
+
+
+
+ 0.2.3
+ —
+
Axed the unsatisfactory ino
keyword, replacing it with of
for object comprehensions. They now look like: for prop, value of object
.
+
+
+
+ 0.2.2
+ —
+
When performing a comprehension over an object, use ino
, instead of in
, which helps us generate smaller, more efficient code at compile time.
Added ::
as a shorthand for saying .prototype.
The “splat” symbol has been changed from a prefix asterisk *
, to a postfix ellipsis ...
Added JavaScript’s in
operator, empty return
statements, and empty while
loops.
Constructor functions that start with capital letters now include a safety check to make sure that the new instance of the object is returned.
The extends
keyword now functions identically to goog.inherits
in Google’s Closure Library.
-
-Arguments objects are now converted into real arrays when referenced.
-
-Major release. Significant whitespace. Better statement-to-expression conversion. Splats. Splice literals. Object comprehensions. Blocks. The existential operator. Many thanks to all the folks who posted issues, with special thanks to Liam O’Connor-Davis for whitespace and expression help.
-
-Bugfix for running coffee --interactive
and --run
from outside of the CoffeeScript directory. Bugfix for nested function/if-statements.
-
-Array slice literals and array comprehensions can now both take Ruby-style ranges to specify the start and end. JavaScript variable declaration is now pushed up to the top of the scope, making all assignment statements into expressions. You can use \
to escape newlines. The coffeescript
command is now called coffee
.
-
-The official CoffeeScript extension is now .coffee
instead of .cs
, which properly belongs to C#. Due to popular demand, you can now also use =
to assign. Unlike JavaScript, =
can also be used within object literals, interchangeably with :
. Made a grammatical fix for chained function calls like func(1)(2)(3)(4)
. Inheritance and super no longer use __proto__
, so they should be IE-compatible now.
-
-The coffee
command now includes --interactive
, which launches an interactive CoffeeScript session, and --run
, which directly compiles and executes a script. Both options depend on a working installation of Narwhal. The aint
keyword has been replaced by isnt
, which goes together a little smoother with is
. Quoted strings are now allowed as identifiers within object literals: eg. {"5+5": 10}
. All assignment operators now use a colon: +:
, -:
, *:
, etc.
-
-Fixed a bug with calling super()
through more than one level of inheritance, with the re-addition of the extends
keyword. Added experimental Narwhal support (as a Tusk package), contributed by Tom Robinson, including bin/cs as a CoffeeScript REPL and interpreter. New --no-wrap
option to suppress the safety function wrapper.
-
-Added instanceof
and typeof
as operators.
-
-Initial CoffeeScript release.
+
+
+ 0.2.1
+ —
+
Arguments objects are now converted into real arrays when referenced.
+
+
+
+ 0.2.0
+ —
+
Major release. Significant whitespace. Better statement-to-expression conversion. Splats. Splice literals. Object comprehensions. Blocks. The existential operator. Many thanks to all the folks who posted issues, with special thanks to Liam O’Connor-Davis for whitespace and expression help.
+
+
+
+ 0.1.6
+ —
+
Bugfix for running coffee --interactive
and --run
from outside of the CoffeeScript directory. Bugfix for nested function/if-statements.
+
+
+
+ 0.1.5
+ —
+
Array slice literals and array comprehensions can now both take Ruby-style ranges to specify the start and end. JavaScript variable declaration is now pushed up to the top of the scope, making all assignment statements into expressions. You can use \
to escape newlines. The coffeescript
command is now called coffee
.
+
+
+
+ 0.1.4
+ —
+
The official CoffeeScript extension is now .coffee
instead of .cs
, which properly belongs to C#. Due to popular demand, you can now also use =
to assign. Unlike JavaScript, =
can also be used within object literals, interchangeably with :
. Made a grammatical fix for chained function calls like func(1)(2)(3)(4)
. Inheritance and super no longer use __proto__
, so they should be IE-compatible now.
+
+
+
+ 0.1.3
+ —
+
The coffee
command now includes --interactive
, which launches an interactive CoffeeScript session, and --run
, which directly compiles and executes a script. Both options depend on a working installation of Narwhal. The aint
keyword has been replaced by isnt
, which goes together a little smoother with is
. Quoted strings are now allowed as identifiers within object literals: eg. {"5+5": 10}
. All assignment operators now use a colon: +:
, -:
, *:
, etc.
+
+
+
+ 0.1.2
+ —
+
Fixed a bug with calling super()
through more than one level of inheritance, with the re-addition of the extends
keyword. Added experimental Narwhal support (as a Tusk package), contributed by Tom Robinson, including bin/cs as a CoffeeScript REPL and interpreter. New --no-wrap
option to suppress the safety function wrapper.
+
+
+
+ 0.1.1
+ —
+
Added instanceof
and typeof
as operators.
+
+
+
+ 0.1.0
+ —
+
Initial CoffeeScript release.
+
+
@@ -6298,7 +6387,7 @@