Skip to content

Commit aa22dc8

Browse files
rubystargos
authored andcommitted
deps: import [email protected]
Imported from the tarball published on npm (https://registry.npmjs.org/acorn/-/acorn-5.7.2.tgz). Update to emcaScript version 10 in order to get support for binding-less catch statements. Also needed to parse node.js lib API in #22405. PR-URL: #22488 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: John-David Dalton <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Bryan English <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 46063b8 commit aa22dc8

18 files changed

+4647
-803
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The externally maintained libraries used by Node.js are:
5353

5454
- Acorn, located at deps/acorn, is licensed as follows:
5555
"""
56-
Copyright (C) 2012-2017 by various contributors (see AUTHORS)
56+
Copyright (C) 2012-2018 by various contributors (see AUTHORS)
5757

5858
Permission is hereby granted, free of charge, to any person obtaining a copy
5959
of this software and associated documentation files (the "Software"), to deal

deps/acorn/AUTHORS

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
List of Acorn contributors. Updated before every release.
22

3+
Adrian Heine
34
Adrian Rakovsky
45
Alistair Braidwood
56
Amila Welihinda
@@ -8,14 +9,19 @@ Angelo
89
Aparajita Fishman
910
Arian Stolwijk
1011
Artem Govorov
12+
Boopesh Mahendran
1113
Bradley Heinz
1214
Brandon Mills
1315
Charles Hughes
16+
Charmander
17+
Chris McKnight
1418
Conrad Irwin
1519
Daniel Tschinder
1620
David Bonnet
1721
Domenico Matteo
1822
ehmicky
23+
Eugene Obrezkov
24+
Felix Maier
1925
Forbes Lindesay
2026
Gilad Peleg
2127
impinball
@@ -34,6 +40,7 @@ Keheliya Gallaba
3440
Kevin Irish
3541
Kevin Kwok
3642
krator
43+
laosb
3744
Marek
3845
Marijn Haverbeke
3946
Martin Carlberg
@@ -60,6 +67,7 @@ Richard Gibson
6067
Rich Harris
6168
Sebastian McKenzie
6269
Shahar Soel
70+
Sheel Bedi
6371
Simen Bekkhus
6472
Teddy Katz
6573
Timothy Gu

deps/acorn/CHANGELOG.md

+126
Original file line numberDiff line numberDiff 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+
1127
## 5.2.1 (2017-10-30)
2128

3129
### Bug fixes

deps/acorn/LICENSE

+1-1
Original file line numberDiff line numberDiff 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)
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

deps/acorn/README.md

+29-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Acorn
22

3-
[![Build Status](https://travis-ci.org/ternjs/acorn.svg?branch=master)](https://travis-ci.org/ternjs/acorn)
3+
[![Build Status](https://travis-ci.org/acornjs/acorn.svg?branch=master)](https://travis-ci.org/acornjs/acorn)
44
[![NPM version](https://img.shields.io/npm/v/acorn.svg)](https://www.npmjs.com/package/acorn)
55
[![CDNJS](https://img.shields.io/cdnjs/v/acorn.svg)](https://cdnjs.com/libraries/acorn)
66
[Author funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png?force)](https://marijnhaverbeke.nl/fund/)
@@ -10,11 +10,11 @@ A tiny, fast JavaScript parser, written completely in JavaScript.
1010
## Community
1111

1212
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).
1414

1515
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
1818
and discussion, please use the
1919
[Tern discussion forum](https://discuss.ternjs.net).
2020

@@ -28,10 +28,13 @@ The easiest way to install acorn is with [`npm`][npm].
2828
npm install acorn
2929
```
3030

31-
Alternately, download the source.
31+
Alternately, you can download the source and build acorn yourself:
3232

3333
```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
3538
```
3639

3740
## Components
@@ -63,7 +66,7 @@ object referring to that same position.
6366
[estree]: https://github.com/estree/estree
6467

6568
- **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
6770
support). This influences support for strict mode, the set of
6871
reserved words, and support for new syntax features. Default is 7.
6972

@@ -97,6 +100,8 @@ object referring to that same position.
97100
declarations can only appear at a program's top level. Setting this
98101
option to `true` allows them anywhere where a statement is allowed.
99102

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+
100105
- **allowHashBang**: When this is enabled (off by default), if the
101106
code starts with the characters `#!` (as in a shellscript), the
102107
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
351356
line. It accepts as arguments its input file and the following
352357
options:
353358

354-
- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9`: Sets the ECMAScript version
359+
- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
355360
to parse. Default is version 7.
356361

357362
- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
@@ -443,10 +448,20 @@ looseParser.extend("readToken", function(nextMethod) {
443448
### Existing plugins
444449

445450
- [`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
452452

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)

deps/acorn/bin/_acorn.js

+69
Original file line numberDiff line numberDiff 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+
}

0 commit comments

Comments
 (0)