try
- require 'babel-core'
- catch
diff --git a/docs/v2/annotated-source/command.html b/docs/v2/annotated-source/command.html index a344d23c..c98d4a44 100644 --- a/docs/v2/annotated-source/command.html +++ b/docs/v2/annotated-source/command.html @@ -875,8 +875,11 @@ browsers) or use a proper build chain like Gulp or Webpack.
try
- require 'babel-core'
- catch
if require.resolve('.').indexOf(process.cwd()) is 0
- console.error '''
- To use --transpile, you must have babel-core installed:
- npm install --save-dev babel-core
- And you must save options to configure Babel in one of the places it looks to find its options.
- See https://coffeescript.org/#transpilation
- '''
- else
- console.error '''
- To use --transpile with globally-installed CoffeeScript, you must have babel-core installed globally:
- npm install --global babel-core
- And you must save options to configure Babel in one of the places it looks to find its options, relative to the file being compiled or to the current folder.
- See https://coffeescript.org/#transpilation
- '''
- process.exit 1
+ if require.resolve('.').indexOf(process.cwd()) is 0
+ console.error '''
+ To use --transpile, you must have @babel/core installed:
+ npm install --save-dev @babel/core
+ And you must save options to configure Babel in one of the places it looks to find its options.
+ See https://coffeescript.org/#transpilation
+ '''
+ else
+ console.error '''
+ To use --transpile with globally-installed CoffeeScript, you must have @babel/core installed globally:
+ npm install --global @babel/core
+ And you must save options to configure Babel in one of the places it looks to find its options, relative to the file being compiled or to the current folder.
+ See https://coffeescript.org/#transpilation
+ '''
+ process.exit 1
opts.transpile = {} unless typeof opts.transpile is 'object'
diff --git a/docs/v2/annotated-source/grammar.html b/docs/v2/annotated-source/grammar.html
index dfbf23c5..3fa8e8bd 100644
--- a/docs/v2/annotated-source/grammar.html
+++ b/docs/v2/annotated-source/grammar.html
@@ -442,6 +442,7 @@ wrapped in braces: E.g a = b if do -> f a is 1
, if f (a) -
Yield: [
o 'YIELD', -> new Op $1, new Value new Literal ''
o 'YIELD Expression', -> new Op $1, $2
+ o 'YIELD INDENT Object OUTDENT', -> new Op $1, $3
o 'YIELD FROM Expression', -> new Op $1.concat($2), $3
]
throw new Error 'To use the transpile option, you must have the \'babel-core\' module installed'
+ throw new Error 'To use the transpile option, you must have the \'@babel/core\' module installed'
babel.transform js, options
diff --git a/docs/v2/annotated-source/lexer.html b/docs/v2/annotated-source/lexer.html
index ffc8f793..3bae3f88 100644
--- a/docs/v2/annotated-source/lexer.html
+++ b/docs/v2/annotated-source/lexer.html
@@ -465,6 +465,8 @@ what CoffeeScript would normally interpret as calls to functions named
@tokens.length > 1 and @tokens[@tokens.length - 2][0] not in ['.', '?.', '@']
@error "'#{prev[1]}' cannot be used as a keyword, or as a function call
without parentheses", prev[2]
+ else if prev[0] is '.' and @tokens.length > 1 and (prevprev = @tokens[@tokens.length - 2])[0] is 'UNARY' and prevprev[1] is 'new'
+ prevprev[0] = 'IDENTIFIER'
else if @tokens.length > 2
prevprev = @tokens[@tokens.length - 2]
if prev[0] in ['@', 'THIS'] and prevprev and prevprev.spaced and
diff --git a/docs/v2/annotated-source/nodes.html b/docs/v2/annotated-source/nodes.html
index f377536f..03ef211d 100644
--- a/docs/v2/annotated-source/nodes.html
+++ b/docs/v2/annotated-source/nodes.html
@@ -2117,6 +2117,7 @@ evaluate anything twice when building the soak chain.
compileNode: (o) ->
+ @checkNewTarget o
@base.front = @front
props = @properties
if props.length and @base.cached?
StringWithInterpolations.compileNode
i
else
fragments.push @makeCode '$' unless @csx
code = element.compileToFragments(o, LEVEL_PAREN)
- if not @isNestedTag(element) or code.some((fragment) -> fragment.comments?)
+ if not @isNestedTag(element) or
+ code.some((fragment) -> fragment.comments?.some((comment) -> comment.here is no))
code = @wrapInBraces code
@@ -7085,8 +7095,10 @@ and using @body.compileNode. StringWithInterpolations.compileNode
i
Flag the {
and }
fragments as having been generated by this
StringWithInterpolations
node, so that compileComments
knows
-to treat them as bounds. Don’t trust fragment.type
, which can
-report minified variable names when this compiler is minified.
/* */
comments. Don’t trust
+fragment.type
, which can report minified variable names when
+this compiler is minified.
diff --git a/docs/v2/annotated-source/repl.html b/docs/v2/annotated-source/repl.html
index 1fa86c67..cebc74ea 100644
--- a/docs/v2/annotated-source/repl.html
+++ b/docs/v2/annotated-source/repl.html
@@ -699,19 +699,22 @@ undeclared variable __
.
CoffeeScript.register()
process.argv = ['coffee'].concat process.argv[2..]
if opts.transpile
+ transpile = {}
try
- transpile = {}
- transpile.transpile = require('babel-core').transform
+ transpile.transpile = require('@babel/core').transform
catch
- console.error '''
- To use --transpile with an interactive REPL, babel-core must be installed either in the current folder or globally:
- npm install --save-dev babel-core
- or
- npm install --global babel-core
- And you must save options to configure Babel in one of the places it looks to find its options.
- See https://coffeescript.org/#transpilation
- '''
- process.exit 1
+ try
+ transpile.transpile = require('babel-core').transform
+ catch
+ console.error '''
+ To use --transpile with an interactive REPL, @babel/core must be installed either in the current folder or globally:
+ npm install --save-dev @babel/core
+ or
+ npm install --global @babel/core
+ And you must save options to configure Babel in one of the places it looks to find its options.
+ See https://coffeescript.org/#transpilation
+ '''
+ process.exit 1
transpile.options =
filename: path.resolve process.cwd(), '<repl>'
diff --git a/docs/v2/browser-compiler/coffeescript.js b/docs/v2/browser-compiler/coffeescript.js
index 2e4539ab..08b5e3a4 100644
--- a/docs/v2/browser-compiler/coffeescript.js
+++ b/docs/v2/browser-compiler/coffeescript.js
@@ -1,8 +1,8 @@
/**
- * CoffeeScript Compiler v2.3.1
+ * CoffeeScript Compiler v2.3.2
* https://coffeescript.org
*
* Copyright 2011, Jeremy Ashkenas
* Released under the MIT License
*/
-var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_get=function get(object,property,receiver){null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===void 0){var parent=Object.getPrototypeOf(object);return null===parent?void 0:get(parent,property,receiver)}if("value"in desc)return desc.value;var getter=desc.get;return void 0===getter?void 0:getter.call(receiver)},_slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!(i&&_arr.length===i));_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i["return"]&&_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_createClass=function(){function defineProperties(target,props){for(var i=0,descriptor;iCoffeeScript 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.
-Latest Version: 2.3.1
+Latest Version: 2.3.2
# Install locally for a project: npm install --save-dev coffeescript @@ -4845,7 +4845,7 @@ The CoffeeScript logo is available in SVG for use in presentations.
Annotated Source
-You can browse the CoffeeScript 2.3.1 source in readable, annotated form here. You can also jump directly to a particular source file:
+You can browse the CoffeeScript 2.3.2 source in readable, annotated form here. You can also jump directly to a particular source file:
- Grammar Rules — src/grammar
- Lexing Tokens — src/lexer
@@ -5523,6 +5523,17 @@ x = 2 + 2Changelog
++ 2.3.2 +
++
+ +- Babel 7 is now supported. With version 7, the Babel team moved from
+babel-core
on NPM to@babel/core
. Now the CoffeeScript--transpile
option will first search for@babel/core
(Babel versions 7 and above) and then search forbabel-core
(versions 6 and below) to try to find an installed version of Babel to use for transpilation.- The syntax
+new.target
is now supported.- You can now follow the keyword
+yield
with an indented object, like has already been allowed forreturn
and other keywords.- Previously, any comments inside a JSX tag or attribute would cause interpolation braces (
+{
and}
) to be output. This is only necessary for line (#
, or//
in JavaScript) comments, not here (###
, or/* */
) comments; so now the compiler checks if all the comments that would trigger the braces are here comments, and if so it doesn’t generate the unnecessary interpolation braces.2.3.1
diff --git a/docs/v2/test.html b/docs/v2/test.html index 3b69a5ab..e9ff2bf1 100644 --- a/docs/v2/test.html +++ b/docs/v2/test.html @@ -1552,6 +1552,14 @@ test "async methods in classes", -> eq await Child.static(), 1 eq await new Child().method(), 2 +test "#3199: await multiline implicit object", -> + do -> + y = + if no then await + type: 'a' + msg: 'b' + eq undefined, y +