Skip to content

Commit 8c9e248

Browse files
committed
Merge branch 'master' into 2
# Conflicts: # bin/cake # bin/coffee # documentation/sections/changelog.md # documentation/sections/installation.md # documentation/sections/introduction.md # lib/coffee-script/index.js # lib/coffee-script/nodes.js # lib/coffee-script/rewriter.js # lib/coffee-script/sourcemap.js # lib/coffeescript/browser.js # lib/coffeescript/cake.js # lib/coffeescript/coffeescript.js # lib/coffeescript/command.js # lib/coffeescript/grammar.js # lib/coffeescript/helpers.js # lib/coffeescript/lexer.js # lib/coffeescript/optparse.js # lib/coffeescript/register.js # lib/coffeescript/repl.js # lib/coffeescript/scope.js # package.json
2 parents b449e1b + f0e9837 commit 8c9e248

File tree

10 files changed

+874
-557
lines changed

10 files changed

+874
-557
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CoffeeScript is a little language that compiles into JavaScript.
2222

2323
## Installation
2424

25-
If you have the node package manager, npm, installed:
25+
Once you have Node.js installed:
2626

2727
```shell
2828
npm install --global coffeescript

docs/v1/annotated-source/lexer.html

+137-77
Large diffs are not rendered by default.

docs/v1/annotated-source/nodes.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -4450,7 +4450,8 @@ <h3 id="parens">Parens</h3>
44504450
<span class="hljs-keyword">return</span> expr.compileToFragments o
44514451
fragments = expr.compileToFragments o, LEVEL_PAREN
44524452
bare = o.level &lt; LEVEL_OP <span class="hljs-keyword">and</span> (expr <span class="hljs-keyword">instanceof</span> Op <span class="hljs-keyword">or</span> expr <span class="hljs-keyword">instanceof</span> Call <span class="hljs-keyword">or</span>
4453-
(expr <span class="hljs-keyword">instanceof</span> For <span class="hljs-keyword">and</span> expr.returns))
4453+
(expr <span class="hljs-keyword">instanceof</span> For <span class="hljs-keyword">and</span> expr.returns)) <span class="hljs-keyword">and</span> (o.level &lt; LEVEL_COND <span class="hljs-keyword">or</span>
4454+
fragments.length &lt;= <span class="hljs-number">3</span>)
44544455
<span class="hljs-keyword">if</span> bare <span class="hljs-keyword">then</span> fragments <span class="hljs-keyword">else</span> @wrapInBraces fragments</pre></div></div>
44554456

44564457
</li>

docs/v1/annotated-source/repl.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ <h1>repl.coffee</h1>
585585

586586
<span class="hljs-built_in">module</span>.exports =
587587
start: <span class="hljs-function"><span class="hljs-params">(opts = {})</span> -&gt;</span>
588-
[major, minor, build] = process.versions.node.split(<span class="hljs-string">'.'</span>).map (n) -&gt; parseInt(n)
588+
[major, minor, build] = process.versions.node.split(<span class="hljs-string">'.'</span>).map (n) -&gt; parseInt(n, <span class="hljs-number">10</span>)
589589

590590
<span class="hljs-keyword">if</span> major <span class="hljs-keyword">is</span> <span class="hljs-number">0</span> <span class="hljs-keyword">and</span> minor &lt; <span class="hljs-number">8</span>
591591
<span class="hljs-built_in">console</span>.warn <span class="hljs-string">"Node 0.8.0+ required for CoffeeScript REPL"</span>

docs/v1/annotated-source/rewriter.html

+83-64
Large diffs are not rendered by default.

docs/v1/browser-compiler/coffee-script.js

+399-394
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/v1/index.html

+23-9
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,8 @@
612612
<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>
613613
<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>
614614
<p>The CoffeeScript compiler goes to great lengths to generate output JavaScript that runs in every JavaScript runtime, but there are exceptions. Use <a href="#generator-functions">generator functions</a>, <a href="#generator-iteration"><code>for…from</code></a>, or <a href="#tagged-template-literals">tagged template literals</a> only if you know that your <a href="http://kangax.github.io/compat-table/es6/">target runtimes can support them</a>. If you use <a href="#modules">modules</a>, you will need to <a href="#modules-note">use an additional tool to resolve them</a>.</p>
615-
<p><strong>Latest Version:</strong> <a href="https://github.com/jashkenas/coffeescript/tarball/1.12.5">1.12.5</a></p>
616-
<blockquote class="uneditable-code-block"><pre><code class="language-bash">npm install -g coffee-script
615+
<p><strong>Latest Version:</strong> <a href="https://github.com/jashkenas/coffeescript/tarball/1.12.6">1.12.6</a></p>
616+
<blockquote class="uneditable-code-block"><pre><code class="language-bash">npm install -g coffeescript
617617
</code></pre>
618618
</blockquote><p><strong>CoffeeScript 2 is coming!</strong> It adds support for <a href="/v2/#classes">ES2015 classes</a>, <a href="/v2/#fat-arrow"><code>async</code>/<code>await</code></a>, and generates JavaScript using ES2015+ syntax. <a href="/v2/">Learn more</a>.</p></p>
619619

@@ -740,12 +740,14 @@ <h2>Overview</h2>
740740
<h2>Installation</h2>
741741
<p>The command-line version of <code>coffee</code> is available as a <a href="https://nodejs.org/">Node.js</a> utility. The <a href="/v1/browser-compiler/coffee-script.js">core compiler</a> however, does not depend on Node, and can be run in any JavaScript environment, or in the browser (see <a href="#try">Try CoffeeScript</a>).</p>
742742
<p>To install, first make sure you have a working copy of the latest stable version of <a href="https://nodejs.org/">Node.js</a>. You can then install CoffeeScript globally with <a href="https://www.npmjs.com/">npm</a>:</p>
743-
<blockquote class="uneditable-code-block"><pre><code class="language-bash">npm install --global coffee-script
743+
<blockquote class="uneditable-code-block"><pre><code class="language-bash">npm install --global coffeescript
744744
</code></pre>
745-
</blockquote><p>When you need CoffeeScript as a dependency of a project, within that project’s folder you can install it locally:</p>
746-
<blockquote class="uneditable-code-block"><pre><code class="language-bash">npm install --save coffee-script
745+
</blockquote><p>This will make the <code>coffee</code> and <code>cake</code> commands available globally.</p>
746+
<p>When you need CoffeeScript as a dependency of a project, within that project’s folder you can install it locally:</p>
747+
<blockquote class="uneditable-code-block"><pre><code class="language-bash">npm install --save coffeescript
747748
</code></pre>
748-
</blockquote>
749+
</blockquote><p>The <code>coffee</code> and <code>cake</code> commands will first look in the current folder to see if CoffeeScript is installed locally, and use that version if so. This allows different versions of CoffeeScript to be installed globally and locally.</p>
750+
749751
<span class="bookmark" id="usage"></span>
750752
<h2>Usage</h2>
751753
<p>Once installed, you should have access to the <code>coffee</code> command, which can execute scripts, compile <code>.coffee</code> files into <code>.js</code>, and provide an interactive REPL. The <code>coffee</code> command takes the following options:</p>
@@ -2320,7 +2322,7 @@ <h2>Block Regular Expressions</h2>
23202322
<h2>Modules</h2>
23212323
<p>ES2015 modules are supported in CoffeeScript, with very similar <code>import</code> and <code>export</code> syntax:</p>
23222324
<div class='code'><pre><code><span class="keyword">import</span> <span class="string">'local-file.coffee'</span>
2323-
<span class="keyword">import</span> <span class="string">'coffee-script'</span>
2325+
<span class="keyword">import</span> <span class="string">'coffeescript'</span>
23242326

23252327
<span class="keyword">import</span> _ <span class="keyword">from</span> <span class="string">'underscore'</span>
23262328
<span class="keyword">import</span> * <span class="keyword">as</span> underscore <span class="keyword">from</span> <span class="string">'underscore'</span>
@@ -2343,7 +2345,7 @@ <h2>Modules</h2>
23432345
<span class="keyword">export</span> { max, min } <span class="keyword">from</span> <span class="string">'underscore'</span>
23442346
</code></pre><pre><code><span class="keyword">import</span> <span class="string">'local-file.coffee'</span>;
23452347

2346-
<span class="keyword">import</span> <span class="string">'coffee-script'</span>;
2348+
<span class="keyword">import</span> <span class="string">'coffeescript'</span>;
23472349

23482350
<span class="keyword">import</span> _ <span class="keyword">from</span> <span class="string">'underscore'</span>;
23492351

@@ -2406,7 +2408,7 @@ <h2>Modules</h2>
24062408
max,
24072409
min
24082410
} <span class="keyword">from</span> <span class="string">'underscore'</span>;
2409-
</code></pre><script>window.example1 = "import 'local-file.coffee'\nimport 'coffee-script'\n\nimport _ from 'underscore'\nimport * as underscore from 'underscore'\n\nimport { now } from 'underscore'\nimport { now as currentTimestamp } from 'underscore'\nimport { first, last } from 'underscore'\nimport utilityBelt, { each } from 'underscore'\n\nexport default Math\nexport square = (x) -> x * x\nexport class Mathematics\n least: (x, y) -> if x < y then x else y\n\nexport { sqrt }\nexport { sqrt as squareRoot }\nexport { Mathematics as default, sqrt as squareRoot }\n\nexport * from 'underscore'\nexport { max, min } from 'underscore'\n"</script><div class='minibutton load' onclick='javascript: loadConsole(example1);'>load</div><br class='clear' /></div><div id="modules-note" class="bookmark"></div>
2411+
</code></pre><script>window.example1 = "import 'local-file.coffee'\nimport 'coffeescript'\n\nimport _ from 'underscore'\nimport * as underscore from 'underscore'\n\nimport { now } from 'underscore'\nimport { now as currentTimestamp } from 'underscore'\nimport { first, last } from 'underscore'\nimport utilityBelt, { each } from 'underscore'\n\nexport default Math\nexport square = (x) -> x * x\nexport class Mathematics\n least: (x, y) -> if x < y then x else y\n\nexport { sqrt }\nexport { sqrt as squareRoot }\nexport { Mathematics as default, sqrt as squareRoot }\n\nexport * from 'underscore'\nexport { max, min } from 'underscore'\n"</script><div class='minibutton load' onclick='javascript: loadConsole(example1);'>load</div><br class='clear' /></div><div id="modules-note" class="bookmark"></div>
24102412
<p>Note that the CoffeeScript compiler <strong>does not resolve modules</strong>; writing an <code>import</code> or <code>export</code> statement in CoffeeScript will produce an <code>import</code> or <code>export</code> statement in the resulting output. It is your responsibility attach another transpiler, such as <a href="https://github.com/google/traceur-compiler">Traceur Compiler</a>, <a href="http://babeljs.io/">Babel</a> or <a href="https://github.com/rollup/rollup">Rollup</a>, to convert this ES2015 syntax into code that will work in your target runtimes.</p>
24112413
<p>Also note that any file with an <code>import</code> or <code>export</code> statement will be output without a <a href="#lexical-scope">top-level function safety wrapper</a>; in other words, importing or exporting modules will automatically trigger <a href="#usage">bare</a> mode for that file. This is because per the ES2015 spec, <code>import</code> or <code>export</code> statements must occur at the topmost scope.</p>
24122414

@@ -2532,6 +2534,18 @@ <h2>Web Chat (IRC)</h2>
25322534

25332535
<span class="bookmark" id="changelog"></span>
25342536
<h2>Change Log</h2>
2537+
<div class="anchor" id="1.12.6"></div>
2538+
<h2 class="header">
2539+
<a href="https://github.com/jashkenas/coffeescript/compare/1.12.5...1.12.6">1.12.6</a>
2540+
<span class="timestamp"> &mdash; <time datetime="2017-05-15">May 15, 2017</time></span>
2541+
</h2><ul>
2542+
<li>The <code>return</code> and <code>export</code> keywords can now accept implicit objects (defined by indentation, without needing braces).</li>
2543+
<li>Support Unicode code point escapes (e.g. <code>\u{1F4A9}</code>).</li>
2544+
<li>The <code>coffee</code> command now first looks to see if CoffeeScript is installed under <code>node_modules</code> in the current folder, and executes the <code>coffee</code> 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 <code>cake</code> command.)</li>
2545+
<li>Bugfixes for chained function calls not closing implicit objects or ternaries.</li>
2546+
<li>Bugfixes for incorrect code generated by the <code>?</code> operator within a termary <code>if</code> statement.</li>
2547+
<li>Fixed some tests, and failing tests now result in a nonzero exit code.</li>
2548+
</ul>
25352549
<div class="anchor" id="1.12.5"></div>
25362550
<h2 class="header">
25372551
<a href="https://github.com/jashkenas/coffeescript/compare/1.12.4...1.12.5">1.12.5</a>

0 commit comments

Comments
 (0)