Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.3.2 #5110

Merged
merged 3 commits into from Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 20 additions & 17 deletions docs/v2/annotated-source/command.html
Expand Up @@ -875,8 +875,11 @@ <h1>command.coffee</h1>
</div>

<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">try</span>
<span class="hljs-built_in">require</span> <span class="hljs-string">'babel-core'</span>
<span class="hljs-keyword">catch</span></pre></div></div>
<span class="hljs-built_in">require</span> <span class="hljs-string">'@babel/core'</span>
<span class="hljs-keyword">catch</span>
<span class="hljs-keyword">try</span>
<span class="hljs-built_in">require</span> <span class="hljs-string">'babel-core'</span>
<span class="hljs-keyword">catch</span></pre></div></div>

</li>

Expand All @@ -892,21 +895,21 @@ <h1>command.coffee</h1>

</div>

<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-built_in">require</span>.resolve(<span class="hljs-string">'.'</span>).indexOf(process.cwd()) <span class="hljs-keyword">is</span> <span class="hljs-number">0</span>
<span class="hljs-built_in">console</span>.error <span class="hljs-string">'''
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
'''</span>
<span class="hljs-keyword">else</span>
<span class="hljs-built_in">console</span>.error <span class="hljs-string">'''
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
'''</span>
process.exit <span class="hljs-number">1</span>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> <span class="hljs-built_in">require</span>.resolve(<span class="hljs-string">'.'</span>).indexOf(process.cwd()) <span class="hljs-keyword">is</span> <span class="hljs-number">0</span>
<span class="hljs-built_in">console</span>.error <span class="hljs-string">'''
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
'''</span>
<span class="hljs-keyword">else</span>
<span class="hljs-built_in">console</span>.error <span class="hljs-string">'''
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
'''</span>
process.exit <span class="hljs-number">1</span>

opts.transpile = {} <span class="hljs-keyword">unless</span> <span class="hljs-keyword">typeof</span> opts.transpile <span class="hljs-keyword">is</span> <span class="hljs-string">'object'</span></pre></div></div>

Expand Down
4 changes: 3 additions & 1 deletion docs/v2/annotated-source/grammar.html
Expand Up @@ -442,6 +442,7 @@ <h2 id="grammatical-rules">Grammatical Rules</h2>
Yield: [
o <span class="hljs-string">'YIELD'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">1</span>, <span class="hljs-keyword">new</span> Value <span class="hljs-keyword">new</span> Literal <span class="hljs-string">''</span>
o <span class="hljs-string">'YIELD Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">1</span>, $<span class="hljs-number">2</span>
o <span class="hljs-string">'YIELD INDENT Object OUTDENT'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
o <span class="hljs-string">'YIELD FROM Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">1.</span>concat($<span class="hljs-number">2</span>), $<span class="hljs-number">3</span>
]</pre></div></div>

Expand Down Expand Up @@ -1733,7 +1734,8 @@ <h2 id="grammatical-rules">Grammatical Rules</h2>
o <span class="hljs-string">'- Expression'</span>, (<span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op <span class="hljs-string">'-'</span>, $<span class="hljs-number">2</span>), prec: <span class="hljs-string">'UNARY_MATH'</span>
o <span class="hljs-string">'+ Expression'</span>, (<span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op <span class="hljs-string">'+'</span>, $<span class="hljs-number">2</span>), prec: <span class="hljs-string">'UNARY_MATH'</span>

o <span class="hljs-string">'AWAIT Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">1</span> , $<span class="hljs-number">2</span>
o <span class="hljs-string">'AWAIT Expression'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">1</span>, $<span class="hljs-number">2</span>
o <span class="hljs-string">'AWAIT INDENT Object OUTDENT'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>

o <span class="hljs-string">'-- SimpleAssignable'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op <span class="hljs-string">'--'</span>, $<span class="hljs-number">2</span>
o <span class="hljs-string">'++ SimpleAssignable'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-keyword">new</span> Op <span class="hljs-string">'++'</span>, $<span class="hljs-number">2</span>
Expand Down
9 changes: 6 additions & 3 deletions docs/v2/annotated-source/index.html
Expand Up @@ -128,8 +128,11 @@ <h1>index.coffee</h1>

CoffeeScript.transpile = <span class="hljs-function"><span class="hljs-params">(js, options)</span> -&gt;</span>
<span class="hljs-keyword">try</span>
babel = <span class="hljs-built_in">require</span> <span class="hljs-string">'babel-core'</span>
<span class="hljs-keyword">catch</span></pre></div></div>
babel = <span class="hljs-built_in">require</span> <span class="hljs-string">'@babel/core'</span>
<span class="hljs-keyword">catch</span>
<span class="hljs-keyword">try</span>
babel = <span class="hljs-built_in">require</span> <span class="hljs-string">'babel-core'</span>
<span class="hljs-keyword">catch</span></pre></div></div>

</li>

Expand All @@ -145,7 +148,7 @@ <h1>index.coffee</h1>

</div>

<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">'To use the transpile option, you must have the \'babel-core\' module installed'</span>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">'To use the transpile option, you must have the \'@babel/core\' module installed'</span>
babel.transform js, options</pre></div></div>

</li>
Expand Down
2 changes: 2 additions & 0 deletions docs/v2/annotated-source/lexer.html
Expand Up @@ -465,6 +465,8 @@ <h2 id="tokenizers">Tokenizers</h2>
@tokens.length &gt; <span class="hljs-number">1</span> <span class="hljs-keyword">and</span> @tokens[@tokens.length - <span class="hljs-number">2</span>][<span class="hljs-number">0</span>] <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> [<span class="hljs-string">'.'</span>, <span class="hljs-string">'?.'</span>, <span class="hljs-string">'@'</span>]
@error <span class="hljs-string">"'<span class="hljs-subst">#{prev[<span class="hljs-number">1</span>]}</span>' cannot be used as a keyword, or as a function call
without parentheses"</span>, prev[<span class="hljs-number">2</span>]
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> prev[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'.'</span> <span class="hljs-keyword">and</span> @tokens.length &gt; <span class="hljs-number">1</span> <span class="hljs-keyword">and</span> (prevprev = @tokens[@tokens.length - <span class="hljs-number">2</span>])[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'UNARY'</span> <span class="hljs-keyword">and</span> prevprev[<span class="hljs-number">1</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'new'</span>
prevprev[<span class="hljs-number">0</span>] = <span class="hljs-string">'IDENTIFIER'</span>
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> @tokens.length &gt; <span class="hljs-number">2</span>
prevprev = @tokens[@tokens.length - <span class="hljs-number">2</span>]
<span class="hljs-keyword">if</span> prev[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> [<span class="hljs-string">'@'</span>, <span class="hljs-string">'THIS'</span>] <span class="hljs-keyword">and</span> prevprev <span class="hljs-keyword">and</span> prevprev.spaced <span class="hljs-keyword">and</span>
Expand Down
20 changes: 16 additions & 4 deletions docs/v2/annotated-source/nodes.html
Expand Up @@ -2117,6 +2117,7 @@ <h3 id="value">Value</h3>
</div>

<div class="content"><div class='highlight'><pre> compileNode: <span class="hljs-function"><span class="hljs-params">(o)</span> -&gt;</span>
@checkNewTarget o
@base.front = @front
props = @properties
<span class="hljs-keyword">if</span> props.length <span class="hljs-keyword">and</span> @base.cached?</pre></div></div>
Expand Down Expand Up @@ -2147,7 +2148,15 @@ <h3 id="value">Value</h3>
<span class="hljs-keyword">for</span> prop <span class="hljs-keyword">in</span> props
fragments.push (prop.compileToFragments o)...

fragments</pre></div></div>
fragments

checkNewTarget: <span class="hljs-function"><span class="hljs-params">(o)</span> -&gt;</span>
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> @base <span class="hljs-keyword">instanceof</span> IdentifierLiteral <span class="hljs-keyword">and</span> @base.value <span class="hljs-keyword">is</span> <span class="hljs-string">'new'</span> <span class="hljs-keyword">and</span> @properties.length
<span class="hljs-keyword">if</span> @properties[<span class="hljs-number">0</span>] <span class="hljs-keyword">instanceof</span> Access <span class="hljs-keyword">and</span> @properties[<span class="hljs-number">0</span>].name.value <span class="hljs-keyword">is</span> <span class="hljs-string">'target'</span>
<span class="hljs-keyword">unless</span> o.scope.parent?
@error <span class="hljs-string">"new.target can only occur inside functions"</span>
<span class="hljs-keyword">else</span>
@error <span class="hljs-string">"the only valid meta property for new is new.target"</span></pre></div></div>

</li>

Expand Down Expand Up @@ -7071,7 +7080,8 @@ <h3 id="stringwithinterpolations">StringWithInterpolations</h3>
<span class="hljs-keyword">else</span>
fragments.push @makeCode <span class="hljs-string">'$'</span> <span class="hljs-keyword">unless</span> @csx
code = element.compileToFragments(o, LEVEL_PAREN)
<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> @isNestedTag(element) <span class="hljs-keyword">or</span> code.some(<span class="hljs-function"><span class="hljs-params">(fragment)</span> -&gt;</span> fragment.comments?)
<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> @isNestedTag(element) <span class="hljs-keyword">or</span>
code.some(<span class="hljs-function"><span class="hljs-params">(fragment)</span> -&gt;</span> fragment.comments?.some(<span class="hljs-function"><span class="hljs-params">(comment)</span> -&gt;</span> comment.here <span class="hljs-keyword">is</span> <span class="hljs-literal">no</span>))
code = @wrapInBraces code</pre></div></div>

</li>
Expand All @@ -7085,8 +7095,10 @@ <h3 id="stringwithinterpolations">StringWithInterpolations</h3>
</div>
<p>Flag the <code>{</code> and <code>}</code> fragments as having been generated by this
<code>StringWithInterpolations</code> node, so that <code>compileComments</code> knows
to treat them as bounds. Don’t trust <code>fragment.type</code>, which can
report minified variable names when this compiler is minified.</p>
to treat them as bounds. But the braces are unnecessary if all of
the enclosed comments are <code>/* */</code> comments. Don’t trust
<code>fragment.type</code>, which can report minified variable names when
this compiler is minified.</p>

</div>

Expand Down
25 changes: 14 additions & 11 deletions docs/v2/annotated-source/repl.html
Expand Up @@ -699,19 +699,22 @@ <h1>repl.coffee</h1>
CoffeeScript.register()
process.argv = [<span class="hljs-string">'coffee'</span>].concat process.argv[<span class="hljs-number">2.</span>.]
<span class="hljs-keyword">if</span> opts.transpile
transpile = {}
<span class="hljs-keyword">try</span>
transpile = {}
transpile.transpile = <span class="hljs-built_in">require</span>(<span class="hljs-string">'babel-core'</span>).transform
transpile.transpile = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@babel/core'</span>).transform
<span class="hljs-keyword">catch</span>
<span class="hljs-built_in">console</span>.error <span class="hljs-string">'''
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
'''</span>
process.exit <span class="hljs-number">1</span>
<span class="hljs-keyword">try</span>
transpile.transpile = <span class="hljs-built_in">require</span>(<span class="hljs-string">'babel-core'</span>).transform
<span class="hljs-keyword">catch</span>
<span class="hljs-built_in">console</span>.error <span class="hljs-string">'''
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
'''</span>
process.exit <span class="hljs-number">1</span>
transpile.options =
filename: path.resolve process.cwd(), <span class="hljs-string">'&lt;repl&gt;'</span></pre></div></div>

Expand Down
4 changes: 2 additions & 2 deletions docs/v2/browser-compiler/coffeescript.js

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions docs/v2/index.html
Expand Up @@ -693,7 +693,7 @@
<section id="introduction">
<p><strong>CoffeeScript is a little language that compiles into JavaScript.</strong> 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.</p>
<p>The golden rule of CoffeeScript is: <em>“It’s just JavaScript.”</em> 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.</p>
<p><strong>Latest Version:</strong> <a href="https://github.com/jashkenas/coffeescript/tarball/2.3.1">2.3.1</a></p>
<p><strong>Latest Version:</strong> <a href="https://github.com/jashkenas/coffeescript/tarball/2.3.2">2.3.2</a></p>
<blockquote class="uneditable-code-block"><pre><code class="language-bash"><span class="comment"># Install locally for a project:</span>
npm install --save-dev coffeescript

Expand Down Expand Up @@ -4845,7 +4845,7 @@ <h2>Web Chat (IRC)</h2>
</section>
<section id="annotated-source">
<h2>Annotated Source</h2>
<p>You can browse the CoffeeScript 2.3.1 source in readable, annotated form <a href="annotated-source/">here</a>. You can also jump directly to a particular source file:</p>
<p>You can browse the CoffeeScript 2.3.2 source in readable, annotated form <a href="annotated-source/">here</a>. You can also jump directly to a particular source file:</p>
<ul>
<li><a href="annotated-source/grammar.html">Grammar Rules — src/grammar</a></li>
<li><a href="annotated-source/lexer.html">Lexing Tokens — src/lexer</a></li>
Expand Down Expand Up @@ -5523,6 +5523,17 @@ <h3>Argument parsing and shebang (<code>#!</code>) lines</h3>
<section id="changelog">
<h2>Changelog</h2>

<section id="2.3.2">
<h3><a href="https://github.com/jashkenas/coffeescript/compare/2.3.1...2.3.2">2.3.2</a>
<span class="timestamp"> &mdash; <time datetime="2018-09-19">2018-09-19</time></span>
</h3><ul>
<li>Babel 7 is now supported. With version 7, the Babel team moved from <code>babel-core</code> on NPM to <code>@babel/core</code>. Now the CoffeeScript <code>--transpile</code> option will first search for <code>@babel/core</code> (Babel versions 7 and above) and then search for <code>babel-core</code> (versions 6 and below) to try to find an installed version of Babel to use for transpilation.</li>
<li>The syntax <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target"><code>new.target</code></a> is now supported.</li>
<li>You can now follow the keyword <code>yield</code> with an indented object, like has already been allowed for <code>return</code> and other keywords.</li>
<li>Previously, any comments inside a JSX tag or attribute would cause interpolation braces (<code>{</code> and <code>}</code>) to be output. This is only necessary for line (<code>#</code>, or <code>//</code> in JavaScript) comments, not here (<code>###</code>, or <code>/* */</code>) 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.</li>
</ul>

</section>
<section id="2.3.1">
<h3><a href="https://github.com/jashkenas/coffeescript/compare/2.3.0...2.3.1">2.3.1</a>
<span class="timestamp"> &mdash; <time datetime="2018-05-21">2018-05-21</time></span>
Expand Down