diff --git a/Cakefile b/Cakefile index a43239a5..f7145f21 100644 --- a/Cakefile +++ b/Cakefile @@ -66,6 +66,27 @@ build = (callback) -> buildParser() buildExceptParser callback +transpile = (code) -> + babel = require 'babel-core' + presets = [] + # Exclude the `modules` plugin in order to not break the `}(this));` + # at the end of the above code block. + presets.push ['env', {modules: no}] unless process.env.TRANSFORM is 'false' + babelOptions = + presets: presets + sourceType: 'script' + { code } = babel.transform code, babelOptions unless presets.length is 0 + # Running Babel twice due to https://github.com/babel/babili/issues/614. + # Once that issue is fixed, move the `babili` preset back up into the + # `presets` array and run Babel once with both presets together. + presets = if process.env.MINIFY is 'false' then [] else ['babili'] + babelOptions = + compact: process.env.MINIFY isnt 'false' + presets: presets + sourceType: 'script' + { code } = babel.transform code, babelOptions unless presets.length is 0 + code + testBuiltCode = (watch = no) -> csPath = './lib/coffeescript' csDir = path.dirname require.resolve csPath @@ -141,24 +162,7 @@ task 'build:browser', 'merge the built scripts into a single file for use in a b } }(this)); """ - babel = require 'babel-core' - presets = [] - # Exclude the `modules` plugin in order to not break the `}(this));` - # at the end of the above code block. - presets.push ['env', {modules: no}] unless process.env.TRANSFORM is 'false' - babelOptions = - presets: presets - sourceType: 'script' - { code } = babel.transform code, babelOptions unless presets.length is 0 - # Running Babel twice due to https://github.com/babel/babili/issues/614. - # Once that issue is fixed, move the `babili` preset back up into the - # `presets` array and run Babel once with both presets together. - presets = if process.env.MINIFY is 'false' then [] else ['babili'] - babelOptions = - compact: process.env.MINIFY isnt 'false' - presets: presets - sourceType: 'script' - { code } = babel.transform code, babelOptions unless presets.length is 0 + code = transpile code outputFolder = "docs/v#{majorVersion}/browser-compiler" fs.mkdirSync outputFolder unless fs.existsSync outputFolder fs.writeFileSync "#{outputFolder}/coffeescript.js", header + '\n' + code @@ -236,9 +240,17 @@ buildDocs = (watch = no) -> codeFor: codeFor() releaseHeader: releaseHeader + includeScript = -> + (file) -> + file = "#{versionedSourceFolder}/#{file}" unless '/' in file + code = fs.readFileSync file, 'utf-8' + code = CoffeeScript.compile code + code = transpile code + code + include = -> (file) -> - file = "#{versionedSourceFolder}/#{file}" if file.indexOf('/') is -1 + file = "#{versionedSourceFolder}/#{file}" unless '/' in file output = fs.readFileSync file, 'utf-8' if /\.html$/.test(file) render = _.template output @@ -249,6 +261,7 @@ buildDocs = (watch = no) -> htmlFor: htmlFor() codeFor: codeFor() include: include() + includeScript: includeScript() output # Task diff --git a/docs/v2/index.html b/docs/v2/index.html index 397a7e15..c4ed852c 100644 --- a/docs/v2/index.html +++ b/docs/v2/index.html @@ -18,8 +18,6 @@ diff --git a/documentation/v2/try.html b/documentation/v2/try.html index aaa33d56..25eef132 100644 --- a/documentation/v2/try.html +++ b/documentation/v2/try.html @@ -9,7 +9,7 @@
-   +
diff --git a/lib/coffeescript/parser.js b/lib/coffeescript/parser.js index 20688b4d..4c5a4d68 100644 --- a/lib/coffeescript/parser.js +++ b/lib/coffeescript/parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17 */ +/* parser generated by jison 0.4.18 */ /* Returns a Parser object of the following structure: @@ -906,13 +906,9 @@ parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { - function _parseError (msg, hash) { - this.message = msg; - this.hash = hash; - } - _parseError.prototype = Error; - - throw new _parseError(str, hash); + var error = new Error(str); + error.hash = hash; + throw error; } }, parse: function parse(input) { diff --git a/package-lock.json b/package-lock.json index dc1acd15..7fad923d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,9 +17,9 @@ "dev": true }, "acorn": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.1.tgz", - "integrity": "sha512-vOk6uEMctu0vQrvuSqFdJyqj1Q0S5VTDL79qtjo+DhRr+1mmaD+tluFSCZqhvi/JUhXSzoZN2BhtstaPEeE8cw==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz", + "integrity": "sha512-o96FZLJBPY1lvTuJylGA9Bk3t/GKPPJG8H0ydQQl01crzwJgspa4AEIq/pVTXigmK0PHVQhiAtn8WMBLL9D2WA==", "dev": true }, "acorn-dynamic-import": { @@ -1247,16 +1247,17 @@ "dev": true }, "browserify-aes": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.6.tgz", - "integrity": "sha1-Xncl297x/Vkw1OurSFZ85FHEigo=", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.8.tgz", + "integrity": "sha512-WYCMOT/PtGTlpOKFht0YJFYcPy6pLCR98CtWfzK13zoynLlBMvAdEMSRGmgnJCw2M2j/5qxBkinZQFobieM8dQ==", "dev": true, "requires": { "buffer-xor": "1.0.3", "cipher-base": "1.0.4", "create-hash": "1.1.3", - "evp_bytestokey": "1.0.2", - "inherits": "2.0.3" + "evp_bytestokey": "1.0.3", + "inherits": "2.0.3", + "safe-buffer": "5.1.1" } }, "browserify-cipher": { @@ -1265,9 +1266,9 @@ "integrity": "sha1-mYgkSHS/XtTijalWZtzWasj8Njo=", "dev": true, "requires": { - "browserify-aes": "1.0.6", + "browserify-aes": "1.0.8", "browserify-des": "1.0.0", - "evp_bytestokey": "1.0.2" + "evp_bytestokey": "1.0.3" } }, "browserify-des": { @@ -1448,6 +1449,12 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, + "codemirror": { + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.29.0.tgz", + "integrity": "sha512-nlG9m0YQ0gFhdEdnKDG+XJRB/bW+K6M9Axs01+LScjVamWtd4dEwgyohf/r4voW1efnGi6U6hHHvDQ9tt9BtoA==", + "dev": true + }, "colors": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/colors/-/colors-0.5.1.tgz", @@ -1891,9 +1898,9 @@ "dev": true }, "evp_bytestokey": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.2.tgz", - "integrity": "sha512-ni0r0lrm7AOzsh2qC5mi9sj8S0gmj5fLNjfFpxN05FB4tAVZEKotbkjOtLPqTCX/CXT7NsUr6juZb4IFJeNNdA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", "dev": true, "requires": { "md5.js": "1.3.4", @@ -3338,9 +3345,9 @@ } }, "jison": { - "version": "0.4.17", - "resolved": "https://registry.npmjs.org/jison/-/jison-0.4.17.tgz", - "integrity": "sha1-vBLUbFhF5v7onM81vSqMxz66F/M=", + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/jison/-/jison-0.4.18.tgz", + "integrity": "sha512-FKkCiJvozgC7VTHhMJ00a0/IApSxhlGsFIshLW6trWJ8ONX2TQJBBz6DlcO1Gffy4w9LT+uL+PA+CVnUSJMF7w==", "dev": true, "requires": { "JSONSelect": "0.4.0", @@ -3892,9 +3899,9 @@ "dev": true, "requires": { "asn1.js": "4.9.1", - "browserify-aes": "1.0.6", + "browserify-aes": "1.0.8", "create-hash": "1.1.3", - "evp_bytestokey": "1.0.2", + "evp_bytestokey": "1.0.3", "pbkdf2": "3.0.13" } }, @@ -4654,12 +4661,12 @@ } }, "webpack": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.5.5.tgz", - "integrity": "sha512-qeUx4nIbeLL53qqNTs3kObPBMkUVDrOjEfp/hTvMlx21qL2MsGNr8/tXCoX/lS12dLl9qtZaXv2qfBEctPScDg==", + "version": "3.5.6", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.5.6.tgz", + "integrity": "sha512-sXnxfx6KoZVrFAGLjdhCCwDtDwkYMfwm8mJjkQv3thr5pjTlbxopVlr/kJwc9Bz317gL+gNjvz++ir9TgG1MDg==", "dev": true, "requires": { - "acorn": "5.1.1", + "acorn": "5.1.2", "acorn-dynamic-import": "2.0.2", "ajv": "5.2.2", "ajv-keywords": "2.1.0", diff --git a/package.json b/package.json index bad79dfd..70a1ab42 100644 --- a/package.json +++ b/package.json @@ -43,12 +43,13 @@ "babel-preset-babili": "~0.1.4", "babel-preset-env": "~1.6.0", "babili": "^0.1.4", + "codemirror": "^5.29.0", "docco": "~0.7.0", "highlight.js": "~9.12.0", - "jison": ">=0.4.17", + "jison": ">=0.4.18", "markdown-it": "~8.4.0", "underscore": "~1.8.3", - "webpack": "~3.5.5" + "webpack": "~3.5.6" }, "dependencies": {} }