| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 46063b8 commit aa22dc8
18 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,7 +53,7 @@ The externally maintained libraries used by Node.js are: | |||
| 53 | 53 | ||
| 54 | 54 | - Acorn, located at deps/acorn, is licensed as follows: | |
| 55 | 55 | """ | |
| 56 | - Copyright (C) 2012-2017 by various contributors (see AUTHORS) | ||
| 56 | + Copyright (C) 2012-2018 by various contributors (see AUTHORS) | ||
| 57 | 57 | ||
| 58 | 58 | Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 59 | 59 | of this software and associated documentation files (the "Software"), to deal | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,6 @@ | |||
| 1 | 1 | List of Acorn contributors. Updated before every release. | |
| 2 | 2 | ||
| 3 | + Adrian Heine | ||
| 3 | 4 | Adrian Rakovsky | |
| 4 | 5 | Alistair Braidwood | |
| 5 | 6 | Amila Welihinda | |
@@ -8,14 +9,19 @@ Angelo | |||
| 8 | 9 | Aparajita Fishman | |
| 9 | 10 | Arian Stolwijk | |
| 10 | 11 | Artem Govorov | |
| 12 | + Boopesh Mahendran | ||
| 11 | 13 | Bradley Heinz | |
| 12 | 14 | Brandon Mills | |
| 13 | 15 | Charles Hughes | |
| 16 | + Charmander | ||
| 17 | + Chris McKnight | ||
| 14 | 18 | Conrad Irwin | |
| 15 | 19 | Daniel Tschinder | |
| 16 | 20 | David Bonnet | |
| 17 | 21 | Domenico Matteo | |
| 18 | 22 | ehmicky | |
| 23 | + Eugene Obrezkov | ||
| 24 | + Felix Maier | ||
| 19 | 25 | Forbes Lindesay | |
| 20 | 26 | Gilad Peleg | |
| 21 | 27 | impinball | |
@@ -34,6 +40,7 @@ Keheliya Gallaba | |||
| 34 | 40 | Kevin Irish | |
| 35 | 41 | Kevin Kwok | |
| 36 | 42 | krator | |
| 43 | + laosb | ||
| 37 | 44 | Marek | |
| 38 | 45 | Marijn Haverbeke | |
| 39 | 46 | Martin Carlberg | |
@@ -60,6 +67,7 @@ Richard Gibson | |||
| 60 | 67 | Rich Harris | |
| 61 | 68 | Sebastian McKenzie | |
| 62 | 69 | Shahar Soel | |
| 70 | + Sheel Bedi | ||
| 63 | 71 | Simen Bekkhus | |
| 64 | 72 | Teddy Katz | |
| 65 | 73 | Timothy Gu | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,129 @@ | |||
| 1 | + ## 5.7.2 (2018-08-24) | ||
| 2 | + | ||
| 3 | + ### Bug fixes | ||
| 4 | + | ||
| 5 | + Properly handle `allowAwaitOutsideFunction` in for statements. | ||
| 6 | + | ||
| 7 | + Treat function declarations at the top level of modules like let bindings. | ||
| 8 | + | ||
| 9 | + Don't allow async function declarations as the only statement under a label. | ||
| 10 | + | ||
| 11 | + ## 5.7.1 (2018-06-15) | ||
| 12 | + | ||
| 13 | + ### Bug fixes | ||
| 14 | + | ||
| 15 | + Make sure the walker and bin files are rebuilt on release (the previous release didn't get the up-to-date versions). | ||
| 16 | + | ||
| 17 | + ## 5.7.0 (2018-06-15) | ||
| 18 | + | ||
| 19 | + ### Bug fixes | ||
| 20 | + | ||
| 21 | + Fix crash in walker when walking a binding-less catch node. | ||
| 22 | + | ||
| 23 | + ### New features | ||
| 24 | + | ||
| 25 | + Upgraded to Unicode 11. | ||
| 26 | + | ||
| 27 | + ## 5.6.2 (2018-06-05) | ||
| 28 | + | ||
| 29 | + ### Bug fixes | ||
| 30 | + | ||
| 31 | + In the walker, go back to allowing the `baseVisitor` argument to be null to default to the default base everywhere. | ||
| 32 | + | ||
| 33 | + ## 5.6.1 (2018-06-01) | ||
| 34 | + | ||
| 35 | + ### Bug fixes | ||
| 36 | + | ||
| 37 | + Fix regression when passing `null` as fourth argument to `walk.recursive`. | ||
| 38 | + | ||
| 39 | + ## 5.6.0 (2018-05-31) | ||
| 40 | + | ||
| 41 | + ### Bug fixes | ||
| 42 | + | ||
| 43 | + Fix a bug in the walker that caused a crash when walking an object pattern spread. | ||
| 44 | + | ||
| 45 | + ### New features | ||
| 46 | + | ||
| 47 | + Allow U+2028 and U+2029 in string when ECMAVersion >= 10. | ||
| 48 | + | ||
| 49 | + Allow binding-less catch statements when ECMAVersion >= 10. | ||
| 50 | + | ||
| 51 | + Add `allowAwaitOutsideFunction` option for parsing top-level `await`. | ||
| 52 | + | ||
| 53 | + ## 5.5.3 (2018-03-08) | ||
| 54 | + | ||
| 55 | + ### Bug fixes | ||
| 56 | + | ||
| 57 | + A _second_ republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps. | ||
| 58 | + | ||
| 59 | + ## 5.5.2 (2018-03-08) | ||
| 60 | + | ||
| 61 | + ### Bug fixes | ||
| 62 | + | ||
| 63 | + A republish of the code in 5.5.1 in an attempt to solve an issue with the file timestamps in the npm package being 0. | ||
| 64 | + | ||
| 65 | + ## 5.5.1 (2018-03-06) | ||
| 66 | + | ||
| 67 | + ### Bug fixes | ||
| 68 | + | ||
| 69 | + Fix regression in walker causing property values in object patterns to be walked as expressions. | ||
| 70 | + | ||
| 71 | + Fix misleading error message for octal escapes in template strings. | ||
| 72 | + | ||
| 73 | + ## 5.5.0 (2018-02-27) | ||
| 74 | + | ||
| 75 | + ### Bug fixes | ||
| 76 | + | ||
| 77 | + Support object spread in the AST walker. | ||
| 78 | + | ||
| 79 | + ### New features | ||
| 80 | + | ||
| 81 | + The identifier character categorization is now based on Unicode version 10. | ||
| 82 | + | ||
| 83 | + Acorn will now validate the content of regular expressions, including new ES9 features. | ||
| 84 | + | ||
| 85 | + ## 5.4.1 (2018-02-02) | ||
| 86 | + | ||
| 87 | + ### Bug fixes | ||
| 88 | + | ||
| 89 | + 5.4.0 somehow accidentally included an old version of walk.js. | ||
| 90 | + | ||
| 91 | + ## 5.4.0 (2018-02-01) | ||
| 92 | + | ||
| 93 | + ### Bug fixes | ||
| 94 | + | ||
| 95 | + Disallow duplicate or escaped flags on regular expressions. | ||
| 96 | + | ||
| 97 | + Disallow octal escapes in strings in strict mode. | ||
| 98 | + | ||
| 99 | + ### New features | ||
| 100 | + | ||
| 101 | + Add support for async iteration. | ||
| 102 | + | ||
| 103 | + Add support for object spread and rest. | ||
| 104 | + | ||
| 105 | + ## 5.3.0 (2017-12-28) | ||
| 106 | + | ||
| 107 | + ### Bug fixes | ||
| 108 | + | ||
| 109 | + Fix parsing of floating point literals with leading zeroes in loose mode. | ||
| 110 | + | ||
| 111 | + Allow duplicate property names in object patterns. | ||
| 112 | + | ||
| 113 | + Don't allow static class methods named `prototype`. | ||
| 114 | + | ||
| 115 | + Disallow async functions directly under `if` or `else`. | ||
| 116 | + | ||
| 117 | + Parse right-hand-side of `for`/`of` as an assignment expression. | ||
| 118 | + | ||
| 119 | + Stricter parsing of `for`/`in`. | ||
| 120 | + | ||
| 121 | + Don't allow unicode escapes in contextual keywords. | ||
| 122 | + | ||
| 123 | + ### New features | ||
| 124 | + | ||
| 125 | + Parsing class members was factored into smaller methods to allow plugins to hook into it. | ||
| 126 | + | ||
| 1 | 127 | ## 5.2.1 (2017-10-30) | |
| 2 | 128 | ||
| 3 | 129 | ### Bug fixes | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - Copyright (C) 2012-2017 by various contributors (see AUTHORS) | ||
| 1 | + Copyright (C) 2012-2018 by various contributors (see AUTHORS) | ||
| 2 | 2 | ||
| 3 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 4 | 4 | of this software and associated documentation files (the "Software"), to deal | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | # Acorn | |
| 2 | 2 | ||
| 3 | - [](https://travis-ci.org/ternjs/acorn) | ||
| 3 | + [](https://travis-ci.org/acornjs/acorn) | ||
| 4 | 4 | [](https://www.npmjs.com/package/acorn) | |
| 5 | 5 | [](https://cdnjs.com/libraries/acorn) | |
| 6 | 6 | [Author funding status: ](https://marijnhaverbeke.nl/fund/) | |
@@ -10,11 +10,11 @@ A tiny, fast JavaScript parser, written completely in JavaScript. | |||
| 10 | 10 | ## Community | |
| 11 | 11 | ||
| 12 | 12 | Acorn is open source software released under an | |
| 13 | - [MIT license](https://github.com/ternjs/acorn/blob/master/LICENSE). | ||
| 13 | + [MIT license](https://github.com/acornjs/acorn/blob/master/LICENSE). | ||
| 14 | 14 | ||
| 15 | 15 | You are welcome to | |
| 16 | - [report bugs](https://github.com/ternjs/acorn/issues) or create pull | ||
| 17 | - requests on [github](https://github.com/ternjs/acorn). For questions | ||
| 16 | + [report bugs](https://github.com/acornjs/acorn/issues) or create pull | ||
| 17 | + requests on [github](https://github.com/acornjs/acorn). For questions | ||
| 18 | 18 | and discussion, please use the | |
| 19 | 19 | [Tern discussion forum](https://discuss.ternjs.net). | |
| 20 | 20 | ||
@@ -28,10 +28,13 @@ The easiest way to install acorn is with [`npm`][npm]. | |||
| 28 | 28 | npm install acorn | |
| 29 | 29 | ``` | |
| 30 | 30 | ||
| 31 | - Alternately, download the source. | ||
| 31 | + Alternately, you can download the source and build acorn yourself: | ||
| 32 | 32 | ||
| 33 | 33 | ```sh | |
| 34 | - git clone https://github.com/ternjs/acorn.git | ||
| 34 | + git clone https://github.com/acornjs/acorn.git | ||
| 35 | + cd acorn | ||
| 36 | + npm install | ||
| 37 | + npm run build | ||
| 35 | 38 | ``` | |
| 36 | 39 | ||
| 37 | 40 | ## Components | |
@@ -63,7 +66,7 @@ object referring to that same position. | |||
| 63 | 66 | [estree]: https://github.com/estree/estree | |
| 64 | 67 | ||
| 65 | 68 | - **ecmaVersion**: Indicates the ECMAScript version to parse. Must be | |
| 66 | - either 3, 5, 6 (2015), 7 (2016), 8 (2017), or 9 (2018, partial | ||
| 69 | + either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018) or 10 (2019, partial | ||
| 67 | 70 | support). This influences support for strict mode, the set of | |
| 68 | 71 | reserved words, and support for new syntax features. Default is 7. | |
| 69 | 72 | ||
@@ -97,6 +100,8 @@ object referring to that same position. | |||
| 97 | 100 | declarations can only appear at a program's top level. Setting this | |
| 98 | 101 | option to `true` allows them anywhere where a statement is allowed. | |
| 99 | 102 | ||
| 103 | + - **allowAwaitOutsideFunction**: By default, `await` expressions can only appear inside `async` functions. Setting this option to `true` allows to have top-level `await` expressions. They are still not allowed in non-`async` functions, though. | ||
| 104 | + | ||
| 100 | 105 | - **allowHashBang**: When this is enabled (off by default), if the | |
| 101 | 106 | code starts with the characters `#!` (as in a shellscript), the | |
| 102 | 107 | first line will be treated as a comment. | |
@@ -351,7 +356,7 @@ The `bin/acorn` utility can be used to parse a file from the command | |||
| 351 | 356 | line. It accepts as arguments its input file and the following | |
| 352 | 357 | options: | |
| 353 | 358 | ||
| 354 | - - `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9`: Sets the ECMAScript version | ||
| 359 | + - `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version | ||
| 355 | 360 | to parse. Default is version 7. | |
| 356 | 361 | ||
| 357 | 362 | - `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise. | |
@@ -443,10 +448,20 @@ looseParser.extend("readToken", function(nextMethod) { | |||
| 443 | 448 | ### Existing plugins | |
| 444 | 449 | ||
| 445 | 450 | - [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx) | |
| 446 | - - [`acorn-es7-plugin`](https://github.com/MatAtBread/acorn-es7-plugin/): Parse [async/await syntax proposal](https://github.com/tc39/ecmascript-asyncawait) | ||
| 447 | - - [`acorn-object-spread`](https://github.com/UXtemple/acorn-object-spread): Parse [object spread syntax proposal](https://github.com/sebmarkbage/ecmascript-rest-spread) | ||
| 448 | - - [`acorn-es7`](https://www.npmjs.com/package/acorn-es7): Parse [decorator syntax proposal](https://github.com/wycats/javascript-decorators) | ||
| 449 | - - [`acorn-objj`](https://www.npmjs.com/package/acorn-objj): [Objective-J](http://www.cappuccino-project.org/learn/objective-j.html) language parser built as Acorn plugin | ||
| 450 | - - [`acorn-object-rest-spread`](https://github.com/victor-homyakov/acorn-object-rest-spread) Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread), works with latest Acorn version (5.0.3) | ||
| 451 | - - [`acorn-static-class-property-initializer`](https://github.com/victor-homyakov/acorn-static-class-property-initializer) Partial support for static class properties from [ES Class Fields & Static Properties Proposal](https://github.com/tc39/proposal-class-public-fields) to support static property initializers in [React components written as ES6+ classes](https://babeljs.io/blog/2015/06/07/react-on-es6-plus) | ||
| 451 | + - [`acorn-objj`](https://github.com/cappuccino/acorn-objj): [Objective-J](http://www.cappuccino-project.org/learn/objective-j.html) language parser built as Acorn plugin | ||
| 452 | 452 | ||
| 453 | + Plugins for ECMAScript proposals: | ||
| 454 | + | ||
| 455 | + - [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling: | ||
| 456 | + - [`acorn-async-iteration`](https://github.com/acornjs/acorn-async-iteration): Parse [async iteration proposal](https://github.com/tc39/proposal-async-iteration) | ||
| 457 | + - [`acorn-bigint`](https://github.com/acornjs/acorn-bigint): Parse [BigInt proposal](https://github.com/tc39/proposal-bigint) | ||
| 458 | + - [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields) | ||
| 459 | + - [`acorn-dynamic-import`](https://github.com/kesne/acorn-dynamic-import): Parse [import() proposal](https://github.com/tc39/proposal-dynamic-import) | ||
| 460 | + - [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta) | ||
| 461 | + - [`acorn-numeric-separator`](https://github.com/acornjs/acorn-numeric-separator): Parse [numeric separator proposal](https://github.com/tc39/proposal-numeric-separator) | ||
| 462 | + - [`acorn-optional-catch-binding`](https://github.com/acornjs/acorn-optional-catch-binding): Parse [optional catch binding proposal](https://github.com/tc39/proposal-optional-catch-binding) | ||
| 463 | + - [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods) | ||
| 464 | + - [`acorn5-object-spread`](https://github.com/adrianheine/acorn5-object-spread): Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread) | ||
| 465 | + - [`acorn-object-rest-spread`](https://github.com/victor-homyakov/acorn-object-rest-spread): Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread) | ||
| 466 | + - [`acorn-es7`](https://github.com/angelozerr/acorn-es7): Parse [decorator syntax proposal](https://github.com/wycats/javascript-decorators) | ||
| 467 | + - [`acorn-static-class-property-initializer`](https://github.com/victor-homyakov/acorn-static-class-property-initializer): Partial support for static class properties from [ES Class Fields & Static Properties Proposal](https://github.com/tc39/proposal-class-public-fields) to support static property initializers in [React components written as ES6+ classes](https://babeljs.io/blog/2015/06/07/react-on-es6-plus) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,69 @@ | |||
| 1 | + #!/usr/bin/env node | ||
| 2 | + 'use strict'; | ||
| 3 | + | ||
| 4 | + var path = require('path'); | ||
| 5 | + var fs = require('fs'); | ||
| 6 | + var acorn = require('../dist/acorn.js'); | ||
| 7 | + | ||
| 8 | + var infile; | ||
| 9 | + var forceFile; | ||
| 10 | + var silent = false; | ||
| 11 | + var compact = false; | ||
| 12 | + var tokenize = false; | ||
| 13 | + var options = {}; | ||
| 14 | + | ||
| 15 | + function help(status) { | ||
| 16 | + var print = (status === 0) ? console.log : console.error; | ||
| 17 | + print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]"); | ||
| 18 | + print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]"); | ||
| 19 | + process.exit(status); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + for (var i = 2; i < process.argv.length; ++i) { | ||
| 23 | + var arg = process.argv[i]; | ||
| 24 | + if ((arg === "-" || arg[0] !== "-") && !infile) { infile = arg; } | ||
| 25 | + else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; } | ||
| 26 | + else if (arg === "--locations") { options.locations = true; } | ||
| 27 | + else if (arg === "--allow-hash-bang") { options.allowHashBang = true; } | ||
| 28 | + else if (arg === "--silent") { silent = true; } | ||
| 29 | + else if (arg === "--compact") { compact = true; } | ||
| 30 | + else if (arg === "--help") { help(0); } | ||
| 31 | + else if (arg === "--tokenize") { tokenize = true; } | ||
| 32 | + else if (arg === "--module") { options.sourceType = "module"; } | ||
| 33 | + else { | ||
| 34 | + var match = arg.match(/^--ecma(\d+)$/); | ||
| 35 | + if (match) | ||
| 36 | + { options.ecmaVersion = +match[1]; } | ||
| 37 | + else | ||
| 38 | + { help(1); } | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + function run(code) { | ||
| 43 | + var result; | ||
| 44 | + try { | ||
| 45 | + if (!tokenize) { | ||
| 46 | + result = acorn.parse(code, options); | ||
| 47 | + } else { | ||
| 48 | + result = []; | ||
| 49 | + var tokenizer$$1 = acorn.tokenizer(code, options), token; | ||
| 50 | + do { | ||
| 51 | + token = tokenizer$$1.getToken(); | ||
| 52 | + result.push(token); | ||
| 53 | + } while (token.type !== acorn.tokTypes.eof) | ||
| 54 | + } | ||
| 55 | + } catch (e) { | ||
| 56 | + console.error(e.message); | ||
| 57 | + process.exit(1); | ||
| 58 | + } | ||
| 59 | + if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); } | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + if (forceFile || infile && infile !== "-") { | ||
| 63 | + run(fs.readFileSync(infile, "utf8")); | ||
| 64 | + } else { | ||
| 65 | + var code = ""; | ||
| 66 | + process.stdin.resume(); | ||
| 67 | + process.stdin.on("data", function (chunk) { return code += chunk; }); | ||
| 68 | + process.stdin.on("end", function () { return run(code); }); | ||
| 69 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments