Permalink
...
Comparing changes
Open a pull request
- 10 commits
- 72 files changed
- 0 commit comments
- 6 contributors
Commits on Dec 09, 2016
|
|
murrayju |
7704cf5
|
Commits on Dec 13, 2016
|
|
murrayju |
2858543
|
|||
|
|
jashkenas |
|
aee27fb
|
Commits on Dec 16, 2016
|
|
haberbyte |
|
8117418
|
||
|
|
mdcb |
|
07d6eb6
|
||
|
|
GeoffreyBooth |
|
be0f1cb
|
||
|
|
GeoffreyBooth |
|
e620434
|
||
|
|
GeoffreyBooth |
8c81c4a
|
|||
|
|
GeoffreyBooth |
e2a3a5b
|
|||
|
|
lydell |
|
de180dc
|
Unified
Split
Showing
with
4,691 additions
and 6,212 deletions.
- +1 −3 .gitignore
- +97 −96 Cakefile
- +0 −1 docs/v1/.gitignore
- +73 −198 docs/v1/annotated-source/coffee-script.html
- +60 −44 docs/v1/annotated-source/repl.html
- +388 −389 docs/v1/browser-compiler/coffee-script.js
- +1,193 −2,729 docs/v1/index.html
- +1,186 −0 docs/v1/test.html
- +15 −2,529 documentation/index.html
- +13 −0 documentation/sections/books.md
- +11 −0 documentation/sections/cake.md
- +517 −0 documentation/sections/changelog.md
- +5 −0 documentation/sections/chat.md
- +20 −0 documentation/sections/classes.md
- +7 −0 documentation/sections/comparisons.md
- +9 −0 documentation/sections/conditionals.md
- +39 −0 documentation/sections/destructuring.md
- +21 −0 documentation/sections/embedded.md
- +11 −0 documentation/sections/examples.md
- +17 −0 documentation/sections/existential_operator.md
- +29 −0 documentation/sections/expressions.md
- +27 −0 documentation/sections/fat_arrow.md
- +13 −0 documentation/sections/functions.md
- +7 −0 documentation/sections/heregexes.md
- +27 −0 documentation/sections/installation.md
- +11 −0 documentation/sections/introduction.md
- +10 −0 documentation/sections/language.md
- +15 −0 documentation/sections/lexical_scope.md
- +7 −0 documentation/sections/literate.md
- +47 −0 documentation/sections/loops.md
- +11 −0 documentation/sections/modules.md
- +19 −0 documentation/sections/objects_and_arrays.md
- +149 −0 documentation/sections/operators.md
- +7 −0 documentation/sections/overview.md
- +23 −0 documentation/sections/resources.md
- +5 −0 documentation/sections/screencasts.md
- +7 −0 documentation/sections/scripts.md
- +15 −0 documentation/sections/slices.md
- +5 −0 documentation/sections/source_maps.md
- +7 −0 documentation/sections/splats.md
- +27 −0 documentation/sections/strings.md
- +15 −0 documentation/sections/switch.md
- +9 −0 documentation/sections/tagged_template_literals.md
- +7 −0 documentation/sections/try.md
- +179 −0 documentation/sections/usage.md
- +2 −0 documentation/test.html
- +155 −0 documentation/v1/body.html
- +25 −0 documentation/v1/code.coffee
- +92 −0 documentation/v1/docs.coffee
- +13 −8 documentation/{css → v1}/docs.css
- +6 −0 documentation/v1/scripts.html
- +4 −0 documentation/v1/styles.html
- +2 −8 documentation/{css → v1}/tomorrow.css
- +1 −1 lib/coffee-script/browser.js
- +1 −1 lib/coffee-script/cake.js
- +5 −98 lib/coffee-script/coffee-script.js
- +1 −1 lib/coffee-script/command.js
- +1 −1 lib/coffee-script/grammar.js
- +1 −1 lib/coffee-script/helpers.js
- +1 −1 lib/coffee-script/index.js
- +1 −1 lib/coffee-script/lexer.js
- +1 −1 lib/coffee-script/nodes.js
- +1 −1 lib/coffee-script/optparse.js
- +1 −1 lib/coffee-script/register.js
- +2 −1 lib/coffee-script/repl.js
- +1 −1 lib/coffee-script/rewriter.js
- +1 −1 lib/coffee-script/scope.js
- +1 −1 lib/coffee-script/sourcemap.js
- +4 −3 package.json
- +4 −81 src/coffee-script.coffee
- +3 −0 src/repl.coffee
- +0 −11 test/error_messages.coffee
View
4
.gitignore
| @@ -3,8 +3,6 @@ presentation | ||
| test.coffee | ||
| test.litcoffee | ||
| parser.output | ||
| -test/fixtures/underscore | ||
| test/*.js | ||
| -examples/beautiful_code/parse.coffee | ||
| -*.gem | ||
| /node_modules | ||
| +npm-debug.log | ||
View
193
Cakefile
| @@ -25,7 +25,7 @@ header = """ | ||
| """ | ||
| # Used in folder names like docs/v1 | ||
| -majorVersion = CoffeeScript.VERSION.split('.')[0] | ||
| +majorVersion = parseInt CoffeeScript.VERSION.split('.')[0], 10 | ||
| # Build the CoffeeScript language from source. | ||
| build = (cb) -> | ||
| @@ -90,7 +90,11 @@ task 'build:parser', 'rebuild the Jison parser (run build first)', -> | ||
| task 'build:browser', 'rebuild the merged script for inclusion in the browser', -> | ||
| - code = '' | ||
| + code = """ | ||
| + require['../../package.json'] = (function() { | ||
| + return #{fs.readFileSync "./package.json"}; | ||
| + })(); | ||
| + """ | ||
| for name in ['helpers', 'rewriter', 'lexer', 'parser', 'scope', 'nodes', 'sourcemap', 'coffee-script', 'browser'] | ||
| code += """ | ||
| require['./#{name}'] = (function() { | ||
| @@ -115,87 +119,109 @@ task 'build:browser', 'rebuild the merged script for inclusion in the browser', | ||
| }(this)); | ||
| """ | ||
| unless process.env.MINIFY is 'false' | ||
| - {compiledCode} = require('google-closure-compiler-js').compile | ||
| + {compiledCode: code} = require('google-closure-compiler-js').compile | ||
| jsCode: [ | ||
| src: code | ||
| languageOut: if majorVersion is 1 then 'ES5' else 'ES6' | ||
| ] | ||
| outputFolder = "docs/v#{majorVersion}/browser-compiler" | ||
| fs.mkdirSync outputFolder unless fs.existsSync outputFolder | ||
| - fs.writeFileSync "#{outputFolder}/coffee-script.js", header + '\n' + compiledCode | ||
| + fs.writeFileSync "#{outputFolder}/coffee-script.js", header + '\n' + code | ||
| console.log "built ... running browser tests:" | ||
| invoke 'test:browser' | ||
| task 'doc:site', 'watch and continually rebuild the documentation for the website', -> | ||
| + # Constants | ||
| + indexFile = 'documentation/index.html' | ||
| + versionedSourceFolder = "documentation/v#{majorVersion}" | ||
| + sectionsSourceFolder = 'documentation/sections' | ||
| + examplesSourceFolder = 'documentation/examples' | ||
| + outputFolder = "docs/v#{majorVersion}" | ||
| + | ||
| # Helpers | ||
| - css = fs.readFileSync('./documentation/css/docs.css', 'utf-8') + '\n' + | ||
| - fs.readFileSync('./documentation/css/tomorrow.css', 'utf-8') | ||
| - | ||
| - logo = fs.readFileSync './documentation/images/logo.svg', 'utf-8' | ||
| - | ||
| - codeFor = -> | ||
| - counter = 0 | ||
| - hljs = require 'highlight.js' | ||
| - hljs.configure classPrefix: '' | ||
| - (file, executable = false, showLoad = true) -> | ||
| - counter++ | ||
| - return unless fs.existsSync "docs/v#{majorVersion}/examples/#{file}.js" | ||
| - cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8' | ||
| - js = fs.readFileSync "docs/v#{majorVersion}/examples/#{file}.js", 'utf-8' | ||
| - js = js.replace /^\/\/ generated.*?\n/i, '' | ||
| - | ||
| - cshtml = "<pre><code>#{hljs.highlight('coffeescript', cs).value}</code></pre>" | ||
| - # Temporary fix until highlight.js adds support for newer CoffeeScript keywords | ||
| - # Added in https://github.com/isagalaev/highlight.js/pull/1357, awaiting release | ||
| - if file in ['generator_iteration', 'generators', 'modules'] | ||
| - cshtml = cshtml.replace /(yield|import|export|from|as|default) /g, '<span class="keyword">$1</span> ' | ||
| - jshtml = "<pre><code>#{hljs.highlight('javascript', js).value}</code></pre>" | ||
| - append = if executable is yes then '' else "alert(#{executable});".replace /"/g, '"' | ||
| - if executable and executable isnt yes | ||
| - cs.replace /(\S)\s*\Z/m, "$1\n\nalert #{executable}" | ||
| - run = if executable is true then 'run' else "run: #{executable}" | ||
| - name = "example#{counter}" | ||
| - script = "<script>window.#{name} = #{JSON.stringify cs}</script>" | ||
| - load = if showLoad then "<div class='minibutton load' onclick='javascript: loadConsole(#{name});'>load</div>" else '' | ||
| - button = if executable then """<div class="minibutton ok" onclick="javascript: #{js.replace /"/g, '"'};#{append}">#{run}</div>""" else '' | ||
| - "<div class='code'>#{cshtml}#{jshtml}#{script}#{load}#{button}<br class='clear' /></div>" | ||
| - | ||
| - monthNames = [ | ||
| - 'January' | ||
| - 'February' | ||
| - 'March' | ||
| - 'April' | ||
| - 'May' | ||
| - 'June' | ||
| - 'July' | ||
| - 'August' | ||
| - 'September' | ||
| - 'October' | ||
| - 'November' | ||
| - 'December' | ||
| - ] | ||
| - | ||
| - formatDate = (date) -> | ||
| - date.replace /^(\d\d\d\d)-(\d\d)-(\d\d)$/, (match, $1, $2, $3) -> | ||
| - "#{monthNames[$2 - 1]} #{+$3}, #{$1}" | ||
| - | ||
| - releaseHeader = (date, version, prevVersion) -> """ | ||
| - <div class="anchor" id="#{version}"></div> | ||
| - <b class="header"> | ||
| - #{prevVersion and "<a href=\"https://github.com/jashkenas/coffeescript/compare/#{prevVersion}...#{version}\">#{version}</a>" or version} | ||
| - <span class="timestamp"> — <time datetime="#{date}">#{formatDate date}</time></span> | ||
| - </b> | ||
| - """ | ||
| + releaseHeader = (date, version, prevVersion) -> | ||
| + monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] | ||
| + | ||
| + formatDate = (date) -> | ||
| + date.replace /^(\d\d\d\d)-(\d\d)-(\d\d)$/, (match, $1, $2, $3) -> | ||
| + "#{monthNames[$2 - 1]} #{+$3}, #{$1}" | ||
| + """ | ||
| + <div class="anchor" id="#{version}"></div> | ||
| + <h2 class="header"> | ||
| + #{prevVersion and "<a href=\"https://github.com/jashkenas/coffeescript/compare/#{prevVersion}...#{version}\">#{version}</a>" or version} | ||
| + <span class="timestamp"> — <time datetime="#{date}">#{formatDate date}</time></span> | ||
| + </h2> | ||
| + """ | ||
| + | ||
| + codeFor = require "./documentation/v#{majorVersion}/code.coffee" | ||
| + | ||
| + htmlFor = -> | ||
| + marked = require 'marked' | ||
| + markdownRenderer = new marked.Renderer() | ||
| + markdownRenderer.heading = (text, level) -> | ||
| + "<h#{level}>#{text}</h#{level}>" # Don’t let marked add an id | ||
| + markdownRenderer.code = (code) -> | ||
| + if code.indexOf('codeFor(') is 0 or code.indexOf('releaseHeader(') is 0 | ||
| + "<%= #{code} %>" | ||
| + else | ||
| + "<pre><code>#{code}</code></pre>" # Default | ||
| + | ||
| + (file, bookmark) -> | ||
| + md = fs.readFileSync "#{sectionsSourceFolder}/#{file}.md", 'utf-8' | ||
| + md = md.replace /<%= releaseHeader %>/g, releaseHeader | ||
| + md = md.replace /<%= majorVersion %>/g, majorVersion | ||
| + md = md.replace /<%= fullVersion %>/g, CoffeeScript.VERSION | ||
| + html = marked md, renderer: markdownRenderer | ||
| + html = _.template(html) | ||
| + codeFor: codeFor() | ||
| + releaseHeader: releaseHeader | ||
| + | ||
| + include = -> | ||
| + (file) -> | ||
| + file = "#{versionedSourceFolder}/#{file}" if file.indexOf('/') is -1 | ||
| + output = fs.readFileSync file, 'utf-8' | ||
| + if /\.html$/.test(file) | ||
| + render = _.template output | ||
| + output = render | ||
| + releaseHeader: releaseHeader | ||
| + majorVersion: majorVersion | ||
| + fullVersion: CoffeeScript.VERSION | ||
| + htmlFor: htmlFor() | ||
| + codeFor: codeFor() | ||
| + include: include() | ||
| + output | ||
| + | ||
| + # Task | ||
| + do renderIndex = -> | ||
| + render = _.template fs.readFileSync(indexFile, 'utf-8') | ||
| + output = render | ||
| + include: include() | ||
| + fs.writeFileSync "#{outputFolder}/index.html", output | ||
| + log 'compiled', green, "#{indexFile} → #{outputFolder}/index.html" | ||
| + try | ||
| + fs.symlinkSync "v#{majorVersion}/index.html", 'docs/index.html' | ||
| + catch exception | ||
| + | ||
| + for target in [indexFile, versionedSourceFolder, examplesSourceFolder, sectionsSourceFolder] | ||
| + fs.watch target, interval: 200, renderIndex | ||
| + log 'watching...' , green | ||
| + | ||
| + | ||
| +task 'doc:test', 'watch and continually rebuild the browser-based tests', -> | ||
| + # Constants | ||
| + testFile = 'documentation/test.html' | ||
| + testsSourceFolder = 'test' | ||
| + outputFolder = "docs/v#{majorVersion}" | ||
| + | ||
| + # Included in test.html | ||
| testHelpers = fs.readFileSync('test/support/helpers.coffee', 'utf-8').replace /exports\./g, '@' | ||
| + # Helpers | ||
| testsInScriptBlocks = -> | ||
| output = '' | ||
| - excludedTestFiles = ['error_messages.coffee'] | ||
| - for filename in fs.readdirSync 'test' | ||
| - continue if filename in excludedTestFiles | ||
| - | ||
| + for filename in fs.readdirSync testsSourceFolder | ||
| if filename.indexOf('.coffee') isnt -1 | ||
| type = 'coffeescript' | ||
| else if filename.indexOf('.litcoffee') isnt -1 | ||
| @@ -213,41 +239,16 @@ task 'doc:site', 'watch and continually rebuild the documentation for the websit | ||
| output | ||
| # Task | ||
| - examplesSourceFolder = 'documentation/examples' | ||
| - examplesOutputFolder = "docs/v#{majorVersion}/examples" | ||
| - fs.mkdirSync examplesOutputFolder unless fs.existsSync examplesOutputFolder | ||
| - do renderExamples = -> | ||
| - execSync "bin/coffee -bc -o #{examplesOutputFolder} #{examplesSourceFolder}/*.coffee" | ||
| - | ||
| - indexFile = 'documentation/index.html' | ||
| - do renderIndex = -> | ||
| - render = _.template fs.readFileSync(indexFile, 'utf-8') | ||
| - output = render | ||
| - css: css | ||
| - logo: logo | ||
| - codeFor: codeFor() | ||
| - releaseHeader: releaseHeader | ||
| - majorVersion: majorVersion | ||
| - fullVersion: CoffeeScript.VERSION | ||
| - fs.writeFileSync "docs/v#{majorVersion}/index.html", output | ||
| - log 'compiled', green, "#{indexFile} → docs/v#{majorVersion}/index.html" | ||
| - | ||
| - testFile = 'documentation/test.html' | ||
| do renderTest = -> | ||
| render = _.template fs.readFileSync(testFile, 'utf-8') | ||
| output = render | ||
| testHelpers: testHelpers | ||
| tests: testsInScriptBlocks() | ||
| - majorVersion: majorVersion | ||
| - fs.writeFileSync "docs/v#{majorVersion}/test.html", output | ||
| - log 'compiled', green, "#{testFile} → docs/v#{majorVersion}/test.html" | ||
| - | ||
| - fs.watch examplesSourceFolder, interval: 200, -> | ||
| - renderExamples() | ||
| - renderIndex() | ||
| - fs.watch indexFile, interval: 200, renderIndex | ||
| - fs.watch testFile, interval: 200, renderTest | ||
| - fs.watch 'test', interval: 200, renderTest | ||
| + fs.writeFileSync "#{outputFolder}/test.html", output | ||
| + log 'compiled', green, "#{testFile} → #{outputFolder}/test.html" | ||
| + | ||
| + for target in [testFile, testsSourceFolder] | ||
| + fs.watch target, interval: 200, renderTest | ||
| log 'watching...' , green | ||
View
1
docs/v1/.gitignore
| @@ -1 +0,0 @@ | ||
| -examples/ |
Oops, something went wrong.