Every new change
This commit is contained in:
479
node_modules/espree/CHANGELOG.md
generated
vendored
Normal file
479
node_modules/espree/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,479 @@
|
||||
v6.2.1 - March 10, 2020
|
||||
|
||||
* [`d6d7480`](https://github.com/eslint/espree/commit/d6d7480e424960159007caea86f209f696138734) Upgrade: acorn 7.1.1, Regex DOS vuln (fixes #435) (#434) (James)
|
||||
|
||||
v6.2.0 - March 2, 2020
|
||||
|
||||
* [`ced1b68`](https://github.com/eslint/espree/commit/ced1b6810b991531e6d3788ebd5a322fc5c7d463) Update: update acorn-jsx and fix failing test (#432) (Kai Cataldo)
|
||||
* [`acb8776`](https://github.com/eslint/espree/commit/acb8776d369abf9e02f79142879e9b1a4774f938) Update: add latestEcmaVersion & supportedEcmaVersions (#430) (Kai Cataldo)
|
||||
|
||||
v6.1.2 - October 20, 2019
|
||||
|
||||
* [`70c4970`](https://github.com/eslint/espree/commit/70c4970e5eba6f060e1e32a22d231647f2d0e0f8) Fix: misuse token types (fixes #393, refs eslint/eslint#11018) (#426) (Toru Nagashima)
|
||||
|
||||
v6.1.1 - August 23, 2019
|
||||
|
||||
* [`ba81546`](https://github.com/eslint/espree/commit/ba81546e8552ec0f779aae7e03668c334630484e) Upgrade: dev deps to latest (#424) (薛定谔的猫)
|
||||
* [`bbe0119`](https://github.com/eslint/espree/commit/bbe01195fb57e24634d18825d39b820ed1767e95) Upgrade: acorn-jsx@5.0.2 (#423) (薛定谔的猫)
|
||||
* [`c0635ba`](https://github.com/eslint/espree/commit/c0635bac4cd891cb612fb81655012e2579f4e2b1) Docs: update readme to mention ES2020 (#422) (Kai Cataldo)
|
||||
|
||||
v6.1.0 - August 18, 2019
|
||||
|
||||
* [`9870c55`](https://github.com/eslint/espree/commit/9870c553efd3eb1bd22b4b3bb5220896c5cb6933) Update: improve error messaging when validating ecmaVersion (#421) (Kai Cataldo)
|
||||
* [`3f49224`](https://github.com/eslint/espree/commit/3f49224eb05f6b8cb1b996ce424a99c40978b389) Fix: tokenize the latest right curly brace (fixes #403) (#419) (finico)
|
||||
* [`f5e58cc`](https://github.com/eslint/espree/commit/f5e58cc5e9030793baca3426366b8d7286ef5b89) Update: support bigint and dynamic import (#415) (Toru Nagashima)
|
||||
|
||||
v6.0.0 - June 21, 2019
|
||||
|
||||
* [`a988a36`](https://github.com/eslint/espree/commit/a988a36e436a1ab6c84005ba0adb6cf9c262c1ec) Build: add node 12 (#414) (薛定谔的猫)
|
||||
|
||||
v6.0.0-alpha.0 - April 12, 2019
|
||||
|
||||
* [`493d464`](https://github.com/eslint/espree/commit/493d464e1564aea0ea33000389771d42ddece2cb) Breaking: validate parser options (fixes #384) (#412) (薛定谔的猫)
|
||||
|
||||
v5.0.1 - February 15, 2019
|
||||
|
||||
* [`c40e2fc`](https://github.com/eslint/espree/commit/c40e2fcedf81ff06151e82bdf655d2d0d29e71b8) Upgrade: acorn@6.0.7 (#407) (Kai Cataldo)
|
||||
|
||||
v5.0.0 - December 5, 2018
|
||||
|
||||
* [`1bcd563`](https://github.com/eslint/espree/commit/1bcd563d4eb4b4032d2662cc5ccd3bfd841b39d7) Breaking: remove attachComment (#405) (Kai Cataldo)
|
||||
* [`35623ee`](https://github.com/eslint/espree/commit/35623ee07289c9199eef8b735c97cb3d3d08d5b8) Chore: update linting config (#406) (Kai Cataldo)
|
||||
* [`4b86a7d`](https://github.com/eslint/espree/commit/4b86a7dc7c447c11bb6530e46dc43428ce2bd372) Build: add node 11 (#400) (薛定谔的猫)
|
||||
* [`7c278d6`](https://github.com/eslint/espree/commit/7c278d6acc6b5db86b803d0cd21b830deb6f569e) Fix: build failing due to incorrectly super() call (fixes #398) (#399) (薛定谔的猫)
|
||||
* [`6ebc219`](https://github.com/eslint/espree/commit/6ebc21947166399a0b4918d4a1beb9d610650336) Upgrade: eslint & eslint-config-eslint (#387) (薛定谔的猫)
|
||||
|
||||
v4.1.0 - October 24, 2018
|
||||
|
||||
* 8eadb88 Upgrade: acorn 6, acorn-jsx 5, and istanbul (#391) (Toru Nagashima)
|
||||
* 0f2edb8 Upgrade: eslint-release@1.0.0 (#392) (Teddy Katz)
|
||||
* 560b6f7 Update: VisitorKeys depend on eslint-visitor-keys (#389) (othree)
|
||||
* 6bf2ebf Docs: Fix some typos in the README (#386) (Hugo Locurcio)
|
||||
|
||||
v4.0.0 - June 21, 2018
|
||||
|
||||
|
||||
|
||||
v4.0.0-rc.0 - June 9, 2018
|
||||
|
||||
* d8224c4 Build: Adding rc release script to package.json (#383) (Kevin Partington)
|
||||
* 4207773 Build: add node 10 (#381) (薛定谔的猫)
|
||||
* cd9da7e Update: upgrade acorn to support two ES2019 syntax (#380) (Toru Nagashima)
|
||||
* 8cb3ceb Chore: remove Object.assign polyfill (#382) (薛定谔的猫)
|
||||
|
||||
v4.0.0-alpha.1 - May 28, 2018
|
||||
|
||||
* 56c5a9c Fix: remove workarounds for acorn < 4 (#372) (Rouven Weßling)
|
||||
* fd305e5 Upgrade: eslint-release to v0.11.1 (#376) (Teddy Katz)
|
||||
|
||||
v4.0.0-alpha.0 - March 30, 2018
|
||||
|
||||
* 95fa890 Build: fix typos in package.json release scripts (#375) (Teddy Katz)
|
||||
* 6284e09 Breaking: remove experimentalObjectRestSpread option (#374) (Teddy Katz)
|
||||
* 0df063f Breaking: require Node.js 6+, upgrade acorn-jsx@4.1.1 (fixes #345) (#371) (薛定谔的猫)
|
||||
* 0252144 Upgrade: acorn 5.5.1 (#370) (Rouven Weßling)
|
||||
|
||||
v3.5.4 - March 4, 2018
|
||||
|
||||
* 706167b Upgrade: acorn 5.5.0 (#369) (Toru Nagashima)
|
||||
|
||||
v3.5.3 - February 2, 2018
|
||||
|
||||
* 70f9859 Upgrade: acorn 5.4.0 (#367) (Toru Nagashima)
|
||||
* cea4823 Chore: Adding .gitattributes file (#366) (Kevin Partington)
|
||||
* 4160aee Upgrade: acorn v5.3.0 (#365) (Toru Nagashima)
|
||||
|
||||
v3.5.2 - November 10, 2017
|
||||
|
||||
* 019b70a Fix: Remove blockBindings from docs (fixes #307, fixes #339) (#356) (Jan Pilzer)
|
||||
* b2016cb Chore: refactoring rest/spread properties (#361) (Toru Nagashima)
|
||||
* 59c9d06 Chore: upgrade acorn@5.2 (fixes #358) (#360) (Toru Nagashima)
|
||||
* 06c35c9 Chore: add .npmrc (#359) (Toru Nagashima)
|
||||
|
||||
v3.5.1 - September 15, 2017
|
||||
|
||||
* 5eb1388 Fix: Fix parsing of async keyword-named object methods (#352) (#353) (Mark Banner)
|
||||
|
||||
v3.5.0 - August 5, 2017
|
||||
|
||||
* 4d442a1 Update: add initial support for ES2018 (#348) (Teddy Katz)
|
||||
* d4bdcb6 Fix: Make template token objects adhere to token object structure (#343) (Ian Christian Myers)
|
||||
* 9ac671a Upgrade: acorn to 5.1.1 (#347) (Teddy Katz)
|
||||
* 16e1fec Docs: Specify default values of options (fixes #325) (#342) (Jan Pilzer)
|
||||
* be85b8e Fix: async shorthand properties (fixes #340) (#341) (Toru Nagashima)
|
||||
|
||||
v3.4.3 - May 5, 2017
|
||||
|
||||
* 343590a Fix: add AwaitExpression to espree.Syntax (fixes #331) (#332) (Teddy Katz)
|
||||
|
||||
v3.4.2 - April 21, 2017
|
||||
|
||||
* c99e436 Upgrade: eslint to 2.13.1 (#328) (Teddy Katz)
|
||||
* 628cf3a Fix: don't mutate user-provided configs (fixes #329) (#330) (Teddy Katz)
|
||||
|
||||
v3.4.1 - March 31, 2017
|
||||
|
||||
* a3ae0bd Upgrade: acorn to 5.0.1 (#327) (Teddy Katz)
|
||||
* 15ef24f Docs: Add badges (#326) (Jan Pilzer)
|
||||
* 652990a Fix: raise error for trailing commas after rest properties (fixes #310) (#323) (Teddy Katz)
|
||||
* 9d86ba5 Upgrade: acorn to ^4.0.11 (#317) (Toru Nagashima)
|
||||
* a3442b5 Chore: fix tests for Node 6+ (#315) (Teddy Katz)
|
||||
|
||||
v3.4.0 - February 2, 2017
|
||||
|
||||
* f55fa51 Build: Lock acorn to v4.0.4 (#314) (Kai Cataldo)
|
||||
* 58f75be Fix:generic error for invalid ecmaVersion(fixes eslint#7405) (#303) (Scott Stern)
|
||||
* d6b383d Docs: Update license copyright (Nicholas C. Zakas)
|
||||
* e5df542 Update: To support year in ecmaVersion number (fixes #300) (#301) (Gyandeep Singh)
|
||||
|
||||
v3.3.2 - September 29, 2016
|
||||
|
||||
* 7d3e2fc Fix: reset `isAsync` flag for each property (fixes #298) (#299) (Toru Nagashima)
|
||||
|
||||
v3.3.1 - September 26, 2016
|
||||
|
||||
* 80abdce Fix: `}` token followed by template had been lost (fixes #293) (#294) (Toru Nagashima)
|
||||
* 9810bab Fix: parsing error on `async` as property name. (#295) (Toru Nagashima)
|
||||
|
||||
v3.3.0 - September 20, 2016
|
||||
|
||||
* 92b04b1 Update: create-test script (fixes #291) (#292) (Jamund Ferguson)
|
||||
|
||||
v3.2.0 - September 16, 2016
|
||||
|
||||
* 5a37f80 Build: Update release tool (Nicholas C. Zakas)
|
||||
* 9bbcad8 Update: Upgrade Acorn to support ES2017 (fixes #287) (#290) (Jamund Ferguson)
|
||||
* 8d9767d Build: Add CI release scripts (Nicholas C. Zakas)
|
||||
|
||||
v3.1.7 - July 29, 2016
|
||||
|
||||
* 8f6cfbd Build: Add CI release (Nicholas C. Zakas)
|
||||
* ff15922 Fix: Catch ES2016 invalid syntax (fixes #284) (#285) (Nicholas C. Zakas)
|
||||
|
||||
v3.1.6 - June 15, 2016
|
||||
|
||||
* a90edc2 Upgrade: acorn 3.2.0 (fixes #279) (#280) (Toru Nagashima)
|
||||
|
||||
v3.1.5 - May 27, 2016
|
||||
|
||||
* 7df2e4a Fix: Convert ~ and ! prefix tokens to esprima (fixes #274) (#276) (Daniel Tschinder)
|
||||
|
||||
v3.1.4 - April 21, 2016
|
||||
|
||||
* e044705 Fix: remove extra leading comments at node level (fixes #264) (Kai Cataldo)
|
||||
* 25c27fb Chore: Remove jQuery copyright from header of each file (Kai Cataldo)
|
||||
* 10709f0 Chore: Add jQuery Foundation copyright (Nicholas C. Zakas)
|
||||
* d754b32 Upgrade: Acorn 3.1.0 (fixes #270) (Toru Nagashima)
|
||||
* 3a90886 Docs: replace a dead link with the correct contributing guide URL (Shinnosuke Watanabe)
|
||||
* 55184a2 Build: replace optimist with a simple native method (Shinnosuke Watanabe)
|
||||
* c7e5a13 Fix: Disallow namespaces objects in JSX (fixes #261) (Kai Cataldo)
|
||||
* 22290b9 Fix: Add test for leading comments (fixes #136) (Kai Cataldo)
|
||||
|
||||
v3.1.3 - March 18, 2016
|
||||
|
||||
* 98441cb Fix: Fix behavior of ignoring comments within previous nodes (refs #256) (Kai Cataldo)
|
||||
|
||||
v3.1.2 - March 14, 2016
|
||||
|
||||
* a2b23ca Fix: Ensure 'var let' works (fixes #149) (Nicholas C. Zakas)
|
||||
* 5783282 Fix: Make obj.await work in modules (fixes #258) (Nicholas C. Zakas)
|
||||
* d1b4929 Fix: leading comments added from previous node (fixes #256) (Kai Cataldo)
|
||||
|
||||
v3.1.1 - February 26, 2016
|
||||
|
||||
* 3614e81 Fix: exponentiation operator token (fixes #254) (Nicholas C. Zakas)
|
||||
|
||||
v3.1.0 - February 25, 2016
|
||||
|
||||
* da35d98 New: Support ecmaVersion 7 (fixes #246) (Nicholas C. Zakas)
|
||||
|
||||
v3.0.2 - February 19, 2016
|
||||
|
||||
* 0973cda Build: Update release script (Nicholas C. Zakas)
|
||||
* 106000f Fix: use the plugins feature of acorn (fixes #250) (Toru Nagashima)
|
||||
* 36d84c7 Build: Add tests (fixes #243) (Nicholas C. Zakas)
|
||||
|
||||
v3.0.1 - February 2, 2016
|
||||
|
||||
* ecfe4c8 Upgrade: eslint-config-eslint to 3.0.0 (Nicholas C. Zakas)
|
||||
* ea6261e Fix: Object rest/spread in assign (fixes #247) (Nicholas C. Zakas)
|
||||
* 7e57ee0 Docs: fix `options.comment` typo (xuezu)
|
||||
* dd5863e Build: Add prerelease script (Nicholas C. Zakas)
|
||||
* 0b409ee Upgrade: eslint-release to 0.2.0 (Nicholas C. Zakas)
|
||||
|
||||
v3.0.0 - January 20, 2016
|
||||
|
||||
* 5ff65f6 Upgrade: Change Esprima version to latest (Nicholas C. Zakas)
|
||||
* a8badcc Upgrade: eslint-release to 0.1.4 (Nicholas C. Zakas)
|
||||
* 34d195b Build: Switch to eslint-release (Nicholas C. Zakas)
|
||||
* a0ddc30 Breaking: Remove binary scripts (Nicholas C. Zakas)
|
||||
* 02b5284 Build: Fix package.json dependencies (Nicholas C. Zakas)
|
||||
* b07696f Fix: tests for importing keywords (fixes #225) (Toru Nagashima)
|
||||
* 2e2808a Build: Add node@5 to CI (fixes #237) (alberto)
|
||||
* 445c685 Update: Unrecognized license format in package.json (fixes #234) (alberto)
|
||||
* 61cb5ee Update: Remove duplicated acorn-jsx dep (fixes #232) (alberto)
|
||||
* df5b71c Upgrade: eslint and eslint-config-eslint (fixes #231) (alberto)
|
||||
* ef7a06d Fix: lastToken not reset between calls to parse (fixes #229) (alberto)
|
||||
* cdf8407 New: ecmaFeatures.impliedStrict (fixes: #227) (Nick Evans)
|
||||
|
||||
v3.0.0-alpha-2 - December 9, 2015
|
||||
|
||||
* 3.0.0-alpha-2 (Nicholas C. Zakas)
|
||||
* Breaking: move ecmaFeatures into ecmaVersion (fixes #222) (Nicholas C. Zakas)
|
||||
* New: Export VisitorKeys (fixes #220) (Nicholas C. Zakas)
|
||||
|
||||
v3.0.0-alpha-1 - December 1, 2015
|
||||
|
||||
* 3.0.0-alpha-1 (Nicholas C. Zakas)
|
||||
* Fix: parse unicode escapes in identifiers (fixes #181) (Nicholas C. Zakas)
|
||||
* Fix: Ensur object rest works in destructed arg (fixes #213) (Nicholas C. Zakas)
|
||||
* Breaking: Switch to Acorn (fixes #200) (Nicholas C. Zakas)
|
||||
* Update: Add tokens to tests (fixes #203) (Nicholas C. Zakas)
|
||||
* Docs: Update README (Nicholas C. Zakas)
|
||||
|
||||
v2.2.5 - September 15, 2015
|
||||
|
||||
* 2.2.5 (Nicholas C. Zakas)
|
||||
* Fix: Ensure node type is correct for destructured (fixes #195) (Nicholas C. Zakas)
|
||||
|
||||
v2.2.4 - August 13, 2015
|
||||
|
||||
* 2.2.4 (Nicholas C. Zakas)
|
||||
* Fix: newlines in arrow functions (fixes #172) (Jamund Ferguson)
|
||||
* Fix: nested arrow function as default param (fixes #145) (Jamund Ferguson)
|
||||
* Fix: Rest Params & Arrow Functions (fixes #187) (Jamund Ferguson)
|
||||
* Fix: trailing commas in import/export (fixes #148) (Jamund Ferguson)
|
||||
* Build: Added sudo false to Travis to build faster (fixes #177) (KahWee Teng)
|
||||
|
||||
v2.2.3 - July 22, 2015
|
||||
|
||||
* 2.2.3 (Nicholas C. Zakas)
|
||||
* Fix: Incorrect error location (fixes #173) (Nicholas C. Zakas)
|
||||
|
||||
v2.2.2 - July 16, 2015
|
||||
|
||||
* 2.2.2 (Nicholas C. Zakas)
|
||||
* 2.2.1 (Nicholas C. Zakas)
|
||||
* Fix: Yield as identifier in arrow func args (fixes #165) (Nicholas C. Zakas)
|
||||
* Fix: Allow AssignmentExpression in object spread (fixes #167) (Nicholas C. Zakas)
|
||||
|
||||
v2.2.1 - July 16, 2015
|
||||
|
||||
* 2.2.1 (Nicholas C. Zakas)
|
||||
|
||||
v2.2.0 - July 15, 2015
|
||||
|
||||
* 2.2.0 (Nicholas C. Zakas)
|
||||
* New: Add experimental object rest/spread (fixes #163) (Nicholas C. Zakas)
|
||||
* Fix: npm browserify (fixes #156) (Jason Laster)
|
||||
|
||||
v2.1.0 - July 10, 2015
|
||||
|
||||
* 2.1.0 (Nicholas C. Zakas)
|
||||
* Fix: Leading comments for anonymous classes (fixes #155, fixes #158) (Toru Nagashima)
|
||||
* New: Add newTarget option (fixes #157) (Nicholas C. Zakas)
|
||||
|
||||
v2.0.4 - June 26, 2015
|
||||
|
||||
* 2.0.4 (Nicholas C. Zakas)
|
||||
* Docs: added missing `ecmaFeatures.superInFunctions` option from doc (Clément Fiorio)
|
||||
* Fix: "await" is a future reserved word (fixes #151) (Jose Roberto Vidal)
|
||||
|
||||
v2.0.3 - June 2, 2015
|
||||
|
||||
* 2.0.3 (Nicholas C. Zakas)
|
||||
* Fix: Incomplete Switch Statement Hangs (Fixes #146) (Jamund Ferguson)
|
||||
* Docs: Clarify ecmaFeatures usage (Dan Wolff)
|
||||
|
||||
v2.0.2 - April 28, 2015
|
||||
|
||||
* 2.0.2 (Nicholas C. Zakas)
|
||||
* Fix: Allow yield without value as function param (fixes #134) (Nicholas C. Zakas)
|
||||
* Fix: Allow computed generators in classes (fixes #123) (Nicholas C. Zakas)
|
||||
* Fix: Don't allow arrow function rest param (fixes #130) (Nicholas C. Zakas)
|
||||
|
||||
v2.0.1 - April 11, 2015
|
||||
|
||||
* 2.0.1 (Nicholas C. Zakas)
|
||||
* Fix: Yield should parse without an argument (fixes #121) (Nicholas C. Zakas)
|
||||
|
||||
v2.0.0 - April 4, 2015
|
||||
|
||||
* 2.0.0 (Nicholas C. Zakas)
|
||||
* Docs: Update README with latest info (Nicholas C. Zakas)
|
||||
* Breaking: Use ESTree format for default params (fixes #114) (Nicholas C. Zakas)
|
||||
* New: Add Super node (fixes #115) (Nicholas C. Zakas)
|
||||
* Breaking: Switch to RestElement for rest args (fixes #84) (Nicholas C. Zakas)
|
||||
* Docs: Correct license info on README (fixes #117) (AJ Ortega)
|
||||
* Breaking: Remove guardedHandlers/handlers from try (fixes #71) (Nicholas C. Zakas)
|
||||
|
||||
v1.12.3 - March 28, 2015
|
||||
|
||||
* 1.12.3 (Nicholas C. Zakas)
|
||||
* Fix: Tagged template strings (fixes #110) (Nicholas C. Zakas)
|
||||
|
||||
v1.12.2 - March 21, 2015
|
||||
|
||||
* 1.12.2 (Nicholas C. Zakas)
|
||||
* Fix: Destructured arg for catch (fixes #105) (Nicholas C. Zakas)
|
||||
|
||||
v1.12.1 - March 21, 2015
|
||||
|
||||
* 1.12.1 (Nicholas C. Zakas)
|
||||
* Fix: Disallow octals in template strings (fixes #96) (Nicholas C. Zakas)
|
||||
* Fix: Template string parsing (fixes #95) (Nicholas C. Zakas)
|
||||
* Fix: shorthand properties named get or set (fixes #100) (Brandon Mills)
|
||||
* Fix: bad error in parsing invalid class setter (fixes #98) (Marsup)
|
||||
|
||||
v1.12.0 - March 14, 2015
|
||||
|
||||
* 1.12.0 (Nicholas C. Zakas)
|
||||
* Fix: Update broken tests (Nicholas C. Zakas)
|
||||
* New: Add sourceType to Program node (fixes #93) (Nicholas C. Zakas)
|
||||
* Allow spread in more places (fixes #89) (Nicholas C. Zakas)
|
||||
* Fix: Deeply nested template literals (fixes #86) (Nicholas C. Zakas)
|
||||
* Fix: Allow super in classes by default (fixes #87) (Nicholas C. Zakas)
|
||||
* Fix: generator methods in classes (fixes #85) (Jamund Ferguson)
|
||||
* Remove XJS note from Esprima-FB incompatibilities (Joe Lencioni)
|
||||
|
||||
v1.11.0 - March 7, 2015
|
||||
|
||||
* 1.11.0 (Nicholas C. Zakas)
|
||||
* Fix: Don't allow default export class by mistake (fixes #82) (Nicholas C. Zakas)
|
||||
* Fix: Export default function should be FunctionDeclaration (fixes #81) (Nicholas C. Zakas)
|
||||
* Fix: Ensure class declarations must have IDs outside of exports (refs #72) (Nicholas C. Zakas)
|
||||
* Fix: export class expression support (refs #72) (Jamund Ferguson)
|
||||
* Update: Add tests for sourceType=module (refs #72) (Nicholas C. Zakas)
|
||||
* Fix: Class name should be id (fixes #78) (Nicholas C. Zakas)
|
||||
* Fix: disallow import/export in functions (refs #72) (Jamund Ferguson)
|
||||
* Test: strict mode enforced in modules (refs #72) (Jamund Ferguson)
|
||||
* New: Add modules feature flag (refs #72) (Nicholas C. Zakas)
|
||||
* merging upstream and solving conflicts for PR #43 (Caridy Patino)
|
||||
* New: Add ES6 module support (fixes #35) (Caridy Patino)
|
||||
* Update: Add TryStatement.handler (fixes #69) (Brandon Mills)
|
||||
* Fix: Destructured Defaults (fixes #56) (Jamund Ferguson)
|
||||
* Update: Refactor out comment attachment logic (Nicholas C. Zakas)
|
||||
|
||||
v1.10.0 - March 1, 2015
|
||||
|
||||
* 1.10.0 (Nicholas C. Zakas)
|
||||
* New: Support ES6 classes (refs #10) (Nicholas C. Zakas)
|
||||
* Docs: Update README.md (Jamund Ferguson)
|
||||
|
||||
v1.9.1 - February 21, 2015
|
||||
|
||||
* 1.9.1 (Nicholas C. Zakas)
|
||||
* Fix: Allow let/const in switchcase (fixes #54) (Nicholas C. Zakas)
|
||||
|
||||
v1.9.0 - February 21, 2015
|
||||
|
||||
* 1.9.0 (Nicholas C. Zakas)
|
||||
* Fix: Extend property method range and loc to include params (fixes #36) (Brandon Mills)
|
||||
* New: spread operator (refs #10) (Jamund Ferguson)
|
||||
* Fix: incorrectly parsed arrow fragment (refs #58) (Jamund Ferguson)
|
||||
* New: Rest Parameter (refs: #10) (Jamund Ferguson)
|
||||
* New: Destructuring (refs #10) (Jamund Ferguson)
|
||||
|
||||
v1.8.1 - February 7, 2015
|
||||
|
||||
* 1.8.1 (Nicholas C. Zakas)
|
||||
* Build: Add Node.js 0.12 testing (Nicholas C. Zakas)
|
||||
* Fix: Actuall fix tokenization issue with templates (fixes #44) (Nicholas C. Zakas)
|
||||
|
||||
v1.8.0 - February 6, 2015
|
||||
|
||||
* 1.8.0 (Nicholas C. Zakas)
|
||||
* New: Support for Arrow Functions (refs #10) (Jamund Ferguson)
|
||||
* New: Allow super references in functions (refs #10) (Nicholas C. Zakas)
|
||||
* Update create-test.js (Jamund Ferguson)
|
||||
* Fix: Tokenization for template strings (fixes #44) (Nicholas C. Zakas)
|
||||
* New: Allow return in global scope (fixes #46) (Nicholas C. Zakas)
|
||||
|
||||
v1.7.1 - January 23, 2015
|
||||
|
||||
* 1.7.1 (Nicholas C. Zakas)
|
||||
* Fix: When ecmaFeatures.forOf is true, check for operater is "undefined" when match keyword is "in" (fixes #39) (Peter Chanthamynavong)
|
||||
|
||||
v1.7.0 - January 23, 2015
|
||||
|
||||
* 1.7.0 (Nicholas C. Zakas)
|
||||
* New: Add support for template strings (FredKSchott)
|
||||
* New: Add support for default parameters (refs #10) (Jamund Ferguson)
|
||||
* New: Add support for unicode code point escape sequences (FredKSchott)
|
||||
|
||||
v1.6.0 - January 10, 2015
|
||||
|
||||
* 1.6.0 (Nicholas C. Zakas)
|
||||
* Update: Make comment attachment tests look at whole AST (Nicholas C. Zakas)
|
||||
* Docs: Update README to reflect feature flags (Nicholas C. Zakas)
|
||||
* Docs: Add a couple more FAQs to README (Nicholas C. Zakas)
|
||||
* New: Add support for duplicate object literal properties (FredKSchott)
|
||||
* New: Implement generators (refs #10) (Nicholas C. Zakas)
|
||||
|
||||
v1.5.0 - December 29, 2014
|
||||
|
||||
* 1.5.0 (Nicholas C. Zakas)
|
||||
* Docs: Update README with compat info (Nicholas C. Zakas)
|
||||
* Update: Add regex parsing test (Nicholas C. Zakas)
|
||||
* Update: s/XJS/JSX/g (Nicholas C. Zakas)
|
||||
* Build: Update release script (Nicholas C. Zakas)
|
||||
* Update: Move SyntaxTree to ast-node-factory.js (FredKSchott)
|
||||
* New: Add JSX parsing (fixes #26) (Nicholas C. Zakas)
|
||||
* Update: Switch location marker logic (fixes #15) (Nicholas C. Zakas)
|
||||
* 1.4.0 (Nicholas C. Zakas)
|
||||
|
||||
v1.4.0 - December 23, 2014
|
||||
|
||||
* 1.4.0 (Nicholas C. Zakas)
|
||||
* Fix: Parsing issues with property methods (fixes #21) (Nicholas C. Zakas)
|
||||
* New: Add support for shorthand properties (refs #10) (Nicholas C. Zakas)
|
||||
* New: Add support for object literal method shorthand (refs #10) (Nicholas C. Zakas)
|
||||
* Fix: Ensure comments are attached for return (fixes #2) (Nicholas C. Zakas)
|
||||
* Build: Ensure CHANGELOG.md is committed on release (Nicholas C. Zakas)
|
||||
* 1.3.1 (Nicholas C. Zakas)
|
||||
|
||||
v1.3.1 - December 22, 2014
|
||||
|
||||
* 1.3.1 (Nicholas C. Zakas)
|
||||
* Fix: Add all files to npm package (fixes #17) (Nicholas C. Zakas)
|
||||
* Update: Move Messages to separate file (Nicholas C. Zakas)
|
||||
* Docs: Removed unnecessary comment (Nicholas C. Zakas)
|
||||
* 1.3.0 (Nicholas C. Zakas)
|
||||
|
||||
v1.3.0 - December 21, 2014
|
||||
|
||||
* 1.3.0 (Nicholas C. Zakas)
|
||||
* Build: Add release scripts (Nicholas C. Zakas)
|
||||
* New: Add computed object literal properties (refs #10) (Nicholas C. Zakas)
|
||||
* Build: Fix commands in Makefile.js (Nicholas C. Zakas)
|
||||
* Docs: Add FAQ to README (Nicholas C. Zakas)
|
||||
* Fix: Don't allow let/const in for loops (fixes #14) (Nicholas C. Zakas)
|
||||
* New: Support for-of loops (refs #10) (Nicholas C. Zakas)
|
||||
* Update: Change .ast.js files to .result.js files (Nicholas C. Zakas)
|
||||
* New: Support ES6 octal literals (Nicholas C. Zakas)
|
||||
* New: Ability to parse binary literals (Nicholas C. Zakas)
|
||||
* Update: More tests for regex u flag (Nicholas C. Zakas)
|
||||
* Update: Switch to using ecmaFeatures (Nicholas C. Zakas)
|
||||
* Update: Add comment attachment tests (Nicholas C. Zakas)
|
||||
* Update README.md (Jamund Ferguson)
|
||||
* New: Add u and y regex flags (refs #10) (Nicholas C. Zakas)
|
||||
* Update: Cleanup tests (Nicholas C. Zakas)
|
||||
* New: Add ecmascript flag (fixes #7) (Nicholas C. Zakas)
|
||||
* Docs: Update README with build commands (Nicholas C. Zakas)
|
||||
* Update: Move some things around (Nicholas C. Zakas)
|
||||
* Update: Read version number from package.json (Nicholas C. Zakas)
|
||||
* Update: Move AST node types to separate file (Nicholas C. Zakas)
|
||||
* Update: Remove duplicate file (Nicholas C. Zakas)
|
||||
* Update: Move token information to a separate file (Nicholas C. Zakas)
|
||||
* Update: Bring in Makefile.js for linting and browserify (Nicholas C. Zakas)
|
||||
* Update: Fix ESLint warnings, remove check-version (Nicholas C. Zakas)
|
||||
* Update: Move Position and SourceLocation to separate file (Nicholas C. Zakas)
|
||||
* Update: Move syntax checks into separate file (Nicholas C. Zakas)
|
||||
* Update: Remove UMD format (Nicholas C. Zakas)
|
||||
* Docs: Update README with more info (Nicholas C. Zakas)
|
||||
* Update: remove npm-debug.log from tracked files (Brandon Mills)
|
||||
* Docs: Remove redundant 'features' in readme (Matthias Oßwald)
|
||||
* Docs: Fix a link to Wikipedia (Ryuichi Okumura)
|
||||
* Update: Split parsing tests into smaller files (Nicholas C. Zakas)
|
||||
* Update: Normalize values in tests (Nicholas C. Zakas)
|
||||
* Update: CommonJSify test file (Nicholas C. Zakas)
|
22
node_modules/espree/LICENSE
generated
vendored
Normal file
22
node_modules/espree/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Espree
|
||||
Copyright JS Foundation and other contributors, https://js.foundation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
164
node_modules/espree/README.md
generated
vendored
Normal file
164
node_modules/espree/README.md
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
[](https://www.npmjs.com/package/espree)
|
||||
[](https://travis-ci.org/eslint/espree)
|
||||
[](https://www.npmjs.com/package/espree)
|
||||
[](https://www.bountysource.com/trackers/9348450-eslint?utm_source=9348450&utm_medium=shield&utm_campaign=TRACKER_BADGE)
|
||||
|
||||
# Espree
|
||||
|
||||
Espree started out as a fork of [Esprima](http://esprima.org) v1.2.2, the last stable published released of Esprima before work on ECMAScript 6 began. Espree is now built on top of [Acorn](https://github.com/ternjs/acorn), which has a modular architecture that allows extension of core functionality. The goal of Espree is to produce output that is similar to Esprima with a similar API so that it can be used in place of Esprima.
|
||||
|
||||
## Usage
|
||||
|
||||
Install:
|
||||
|
||||
```
|
||||
npm i espree
|
||||
```
|
||||
|
||||
And in your Node.js code:
|
||||
|
||||
```javascript
|
||||
const espree = require("espree");
|
||||
|
||||
const ast = espree.parse(code);
|
||||
```
|
||||
|
||||
There is a second argument to `parse()` that allows you to specify various options:
|
||||
|
||||
```javascript
|
||||
const espree = require("espree");
|
||||
|
||||
// Optional second options argument with the following default settings
|
||||
const ast = espree.parse(code, {
|
||||
|
||||
// attach range information to each node
|
||||
range: false,
|
||||
|
||||
// attach line/column location information to each node
|
||||
loc: false,
|
||||
|
||||
// create a top-level comments array containing all comments
|
||||
comment: false,
|
||||
|
||||
// create a top-level tokens array containing all tokens
|
||||
tokens: false,
|
||||
|
||||
// Set to 3, 5 (default), 6, 7, 8, 9, or 10 to specify the version of ECMAScript syntax you want to use.
|
||||
// You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10), or 2020 (same as 11) to use the year-based naming.
|
||||
ecmaVersion: 5,
|
||||
|
||||
// specify which type of script you're parsing ("script" or "module")
|
||||
sourceType: "script",
|
||||
|
||||
// specify additional language features
|
||||
ecmaFeatures: {
|
||||
|
||||
// enable JSX parsing
|
||||
jsx: false,
|
||||
|
||||
// enable return in global scope
|
||||
globalReturn: false,
|
||||
|
||||
// enable implied strict mode (if ecmaVersion >= 5)
|
||||
impliedStrict: false
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Esprima Compatibility Going Forward
|
||||
|
||||
The primary goal is to produce the exact same AST structure and tokens as Esprima, and that takes precedence over anything else. (The AST structure being the [ESTree](https://github.com/estree/estree) API with JSX extensions.) Separate from that, Espree may deviate from what Esprima outputs in terms of where and how comments are attached, as well as what additional information is available on AST nodes. That is to say, Espree may add more things to the AST nodes than Esprima does but the overall AST structure produced will be the same.
|
||||
|
||||
Espree may also deviate from Esprima in the interface it exposes.
|
||||
|
||||
## Contributing
|
||||
|
||||
Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/espree/issues).
|
||||
|
||||
Espree is licensed under a permissive BSD 2-clause license.
|
||||
|
||||
## Build Commands
|
||||
|
||||
* `npm test` - run all linting and tests
|
||||
* `npm run lint` - run all linting
|
||||
* `npm run browserify` - creates a version of Espree that is usable in a browser
|
||||
|
||||
## Differences from Espree 2.x
|
||||
|
||||
* The `tokenize()` method does not use `ecmaFeatures`. Any string will be tokenized completely based on ECMAScript 6 semantics.
|
||||
* Trailing whitespace no longer is counted as part of a node.
|
||||
* `let` and `const` declarations are no longer parsed by default. You must opt-in by using an `ecmaVersion` newer than `5` or setting `sourceType` to `module`.
|
||||
* The `esparse` and `esvalidate` binary scripts have been removed.
|
||||
* There is no `tolerant` option. We will investigate adding this back in the future.
|
||||
|
||||
## Known Incompatibilities
|
||||
|
||||
In an effort to help those wanting to transition from other parsers to Espree, the following is a list of noteworthy incompatibilities with other parsers. These are known differences that we do not intend to change.
|
||||
|
||||
### Esprima 1.2.2
|
||||
|
||||
* Esprima counts trailing whitespace as part of each AST node while Espree does not. In Espree, the end of a node is where the last token occurs.
|
||||
* Espree does not parse `let` and `const` declarations by default.
|
||||
* Error messages returned for parsing errors are different.
|
||||
* There are two addition properties on every node and token: `start` and `end`. These represent the same data as `range` and are used internally by Acorn.
|
||||
|
||||
### Esprima 2.x
|
||||
|
||||
* Esprima 2.x uses a different comment attachment algorithm that results in some comments being added in different places than Espree. The algorithm Espree uses is the same one used in Esprima 1.2.2.
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### Why another parser
|
||||
|
||||
[ESLint](http://eslint.org) had been relying on Esprima as its parser from the beginning. While that was fine when the JavaScript language was evolving slowly, the pace of development increased dramatically and Esprima had fallen behind. ESLint, like many other tools reliant on Esprima, has been stuck in using new JavaScript language features until Esprima updates, and that caused our users frustration.
|
||||
|
||||
We decided the only way for us to move forward was to create our own parser, bringing us inline with JSHint and JSLint, and allowing us to keep implementing new features as we need them. We chose to fork Esprima instead of starting from scratch in order to move as quickly as possible with a compatible API.
|
||||
|
||||
With Espree 2.0.0, we are no longer a fork of Esprima but rather a translation layer between Acorn and Esprima syntax. This allows us to put work back into a community-supported parser (Acorn) that is continuing to grow and evolve while maintaining an Esprima-compatible parser for those utilities still built on Esprima.
|
||||
|
||||
### Have you tried working with Esprima?
|
||||
|
||||
Yes. Since the start of ESLint, we've regularly filed bugs and feature requests with Esprima and will continue to do so. However, there are some different philosophies around how the projects work that need to be worked through. The initial goal was to have Espree track Esprima and eventually merge the two back together, but we ultimately decided that building on top of Acorn was a better choice due to Acorn's plugin support.
|
||||
|
||||
### Why don't you just use Acorn?
|
||||
|
||||
Acorn is a great JavaScript parser that produces an AST that is compatible with Esprima. Unfortunately, ESLint relies on more than just the AST to do its job. It relies on Esprima's tokens and comment attachment features to get a complete picture of the source code. We investigated switching to Acorn, but the inconsistencies between Esprima and Acorn created too much work for a project like ESLint.
|
||||
|
||||
We are building on top of Acorn, however, so that we can contribute back and help make Acorn even better.
|
||||
|
||||
### What ECMAScript 6 features do you support?
|
||||
|
||||
All of them.
|
||||
|
||||
### What ECMAScript 7/2016 features do you support?
|
||||
|
||||
There is only one ECMAScript 2016 syntax change: the exponentiation operator. Espree supports this.
|
||||
|
||||
### What ECMAScript 2017 features do you support?
|
||||
|
||||
There are two ECMAScript 2017 syntax changes: `async` functions, and trailing commas in function declarations and calls. Espree supports both of them.
|
||||
|
||||
### What ECMAScript 2018 features do you support?
|
||||
|
||||
There are seven ECMAScript 2018 syntax changes:
|
||||
|
||||
* Invalid escape sequences in tagged template literals
|
||||
* Rest/spread properties
|
||||
* Async iteration
|
||||
* RegExp `s` flag
|
||||
* RegExp named capture groups
|
||||
* RegExp lookbehind assertions
|
||||
* RegExp Unicode property escapes
|
||||
|
||||
Espree supports all of them.
|
||||
|
||||
### What ECMAScript 2019 features do you support?
|
||||
|
||||
Because ECMAScript 2019 is still under development, we are implementing features as they are finalized. Currently, Espree supports:
|
||||
|
||||
* Optional `catch` binding
|
||||
* JSON superset (`\u2028` and `\u2029` in string literals)
|
||||
|
||||
### How do you determine which experimental features to support?
|
||||
|
||||
In general, we do not support experimental JavaScript features. We may make exceptions from time to time depending on the maturity of the features.
|
177
node_modules/espree/espree.js
generated
vendored
Normal file
177
node_modules/espree/espree.js
generated
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
/**
|
||||
* @fileoverview Main Espree file that converts Acorn into Esprima output.
|
||||
*
|
||||
* This file contains code from the following MIT-licensed projects:
|
||||
* 1. Acorn
|
||||
* 2. Babylon
|
||||
* 3. Babel-ESLint
|
||||
*
|
||||
* This file also contains code from Esprima, which is BSD licensed.
|
||||
*
|
||||
* Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)
|
||||
* Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)
|
||||
* Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie <sebmck@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* eslint no-undefined:0, no-use-before-define: 0 */
|
||||
|
||||
"use strict";
|
||||
|
||||
const acorn = require("acorn");
|
||||
const jsx = require("acorn-jsx");
|
||||
const astNodeTypes = require("./lib/ast-node-types");
|
||||
const espree = require("./lib/espree");
|
||||
const { getLatestEcmaVersion, getSupportedEcmaVersions } = require("./lib/options");
|
||||
|
||||
// To initialize lazily.
|
||||
const parsers = {
|
||||
_regular: null,
|
||||
_jsx: null,
|
||||
|
||||
get regular() {
|
||||
if (this._regular === null) {
|
||||
this._regular = acorn.Parser.extend(espree());
|
||||
}
|
||||
return this._regular;
|
||||
},
|
||||
|
||||
get jsx() {
|
||||
if (this._jsx === null) {
|
||||
this._jsx = acorn.Parser.extend(jsx(), espree());
|
||||
}
|
||||
return this._jsx;
|
||||
},
|
||||
|
||||
get(options) {
|
||||
const useJsx = Boolean(
|
||||
options &&
|
||||
options.ecmaFeatures &&
|
||||
options.ecmaFeatures.jsx
|
||||
);
|
||||
|
||||
return useJsx ? this.jsx : this.regular;
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Tokenizer
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Tokenizes the given code.
|
||||
* @param {string} code The code to tokenize.
|
||||
* @param {Object} options Options defining how to tokenize.
|
||||
* @returns {Token[]} An array of tokens.
|
||||
* @throws {SyntaxError} If the input code is invalid.
|
||||
* @private
|
||||
*/
|
||||
function tokenize(code, options) {
|
||||
const Parser = parsers.get(options);
|
||||
|
||||
// Ensure to collect tokens.
|
||||
if (!options || options.tokens !== true) {
|
||||
options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign
|
||||
}
|
||||
|
||||
return new Parser(options, code).tokenize();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Parser
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Parses the given code.
|
||||
* @param {string} code The code to tokenize.
|
||||
* @param {Object} options Options defining how to tokenize.
|
||||
* @returns {ASTNode} The "Program" AST node.
|
||||
* @throws {SyntaxError} If the input code is invalid.
|
||||
*/
|
||||
function parse(code, options) {
|
||||
const Parser = parsers.get(options);
|
||||
|
||||
return new Parser(options, code).parse();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
exports.version = require("./package.json").version;
|
||||
|
||||
exports.tokenize = tokenize;
|
||||
|
||||
exports.parse = parse;
|
||||
|
||||
// Deep copy.
|
||||
/* istanbul ignore next */
|
||||
exports.Syntax = (function() {
|
||||
let name,
|
||||
types = {};
|
||||
|
||||
if (typeof Object.create === "function") {
|
||||
types = Object.create(null);
|
||||
}
|
||||
|
||||
for (name in astNodeTypes) {
|
||||
if (Object.hasOwnProperty.call(astNodeTypes, name)) {
|
||||
types[name] = astNodeTypes[name];
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof Object.freeze === "function") {
|
||||
Object.freeze(types);
|
||||
}
|
||||
|
||||
return types;
|
||||
}());
|
||||
|
||||
/* istanbul ignore next */
|
||||
exports.VisitorKeys = (function() {
|
||||
return require("eslint-visitor-keys").KEYS;
|
||||
}());
|
||||
|
||||
exports.latestEcmaVersion = getLatestEcmaVersion();
|
||||
|
||||
exports.supportedEcmaVersions = getSupportedEcmaVersions();
|
96
node_modules/espree/lib/ast-node-types.js
generated
vendored
Normal file
96
node_modules/espree/lib/ast-node-types.js
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* @fileoverview The AST node types produced by the parser.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// None!
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
AssignmentExpression: "AssignmentExpression",
|
||||
AssignmentPattern: "AssignmentPattern",
|
||||
ArrayExpression: "ArrayExpression",
|
||||
ArrayPattern: "ArrayPattern",
|
||||
ArrowFunctionExpression: "ArrowFunctionExpression",
|
||||
AwaitExpression: "AwaitExpression",
|
||||
BlockStatement: "BlockStatement",
|
||||
BinaryExpression: "BinaryExpression",
|
||||
BreakStatement: "BreakStatement",
|
||||
CallExpression: "CallExpression",
|
||||
CatchClause: "CatchClause",
|
||||
ClassBody: "ClassBody",
|
||||
ClassDeclaration: "ClassDeclaration",
|
||||
ClassExpression: "ClassExpression",
|
||||
ConditionalExpression: "ConditionalExpression",
|
||||
ContinueStatement: "ContinueStatement",
|
||||
DoWhileStatement: "DoWhileStatement",
|
||||
DebuggerStatement: "DebuggerStatement",
|
||||
EmptyStatement: "EmptyStatement",
|
||||
ExpressionStatement: "ExpressionStatement",
|
||||
ForStatement: "ForStatement",
|
||||
ForInStatement: "ForInStatement",
|
||||
ForOfStatement: "ForOfStatement",
|
||||
FunctionDeclaration: "FunctionDeclaration",
|
||||
FunctionExpression: "FunctionExpression",
|
||||
Identifier: "Identifier",
|
||||
IfStatement: "IfStatement",
|
||||
Literal: "Literal",
|
||||
LabeledStatement: "LabeledStatement",
|
||||
LogicalExpression: "LogicalExpression",
|
||||
MemberExpression: "MemberExpression",
|
||||
MetaProperty: "MetaProperty",
|
||||
MethodDefinition: "MethodDefinition",
|
||||
NewExpression: "NewExpression",
|
||||
ObjectExpression: "ObjectExpression",
|
||||
ObjectPattern: "ObjectPattern",
|
||||
Program: "Program",
|
||||
Property: "Property",
|
||||
RestElement: "RestElement",
|
||||
ReturnStatement: "ReturnStatement",
|
||||
SequenceExpression: "SequenceExpression",
|
||||
SpreadElement: "SpreadElement",
|
||||
Super: "Super",
|
||||
SwitchCase: "SwitchCase",
|
||||
SwitchStatement: "SwitchStatement",
|
||||
TaggedTemplateExpression: "TaggedTemplateExpression",
|
||||
TemplateElement: "TemplateElement",
|
||||
TemplateLiteral: "TemplateLiteral",
|
||||
ThisExpression: "ThisExpression",
|
||||
ThrowStatement: "ThrowStatement",
|
||||
TryStatement: "TryStatement",
|
||||
UnaryExpression: "UnaryExpression",
|
||||
UpdateExpression: "UpdateExpression",
|
||||
VariableDeclaration: "VariableDeclaration",
|
||||
VariableDeclarator: "VariableDeclarator",
|
||||
WhileStatement: "WhileStatement",
|
||||
WithStatement: "WithStatement",
|
||||
YieldExpression: "YieldExpression",
|
||||
JSXIdentifier: "JSXIdentifier",
|
||||
JSXNamespacedName: "JSXNamespacedName",
|
||||
JSXMemberExpression: "JSXMemberExpression",
|
||||
JSXEmptyExpression: "JSXEmptyExpression",
|
||||
JSXExpressionContainer: "JSXExpressionContainer",
|
||||
JSXElement: "JSXElement",
|
||||
JSXClosingElement: "JSXClosingElement",
|
||||
JSXOpeningElement: "JSXOpeningElement",
|
||||
JSXAttribute: "JSXAttribute",
|
||||
JSXSpreadAttribute: "JSXSpreadAttribute",
|
||||
JSXText: "JSXText",
|
||||
ExportDefaultDeclaration: "ExportDefaultDeclaration",
|
||||
ExportNamedDeclaration: "ExportNamedDeclaration",
|
||||
ExportAllDeclaration: "ExportAllDeclaration",
|
||||
ExportSpecifier: "ExportSpecifier",
|
||||
ImportDeclaration: "ImportDeclaration",
|
||||
ImportSpecifier: "ImportSpecifier",
|
||||
ImportDefaultSpecifier: "ImportDefaultSpecifier",
|
||||
ImportNamespaceSpecifier: "ImportNamespaceSpecifier"
|
||||
};
|
286
node_modules/espree/lib/espree.js
generated
vendored
Normal file
286
node_modules/espree/lib/espree.js
generated
vendored
Normal file
@ -0,0 +1,286 @@
|
||||
"use strict";
|
||||
|
||||
/* eslint-disable no-param-reassign*/
|
||||
const TokenTranslator = require("./token-translator");
|
||||
const { normalizeOptions } = require("./options");
|
||||
|
||||
const STATE = Symbol("espree's internal state");
|
||||
const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode");
|
||||
|
||||
|
||||
/**
|
||||
* Converts an Acorn comment to a Esprima comment.
|
||||
* @param {boolean} block True if it's a block comment, false if not.
|
||||
* @param {string} text The text of the comment.
|
||||
* @param {int} start The index at which the comment starts.
|
||||
* @param {int} end The index at which the comment ends.
|
||||
* @param {Location} startLoc The location at which the comment starts.
|
||||
* @param {Location} endLoc The location at which the comment ends.
|
||||
* @returns {Object} The comment object.
|
||||
* @private
|
||||
*/
|
||||
function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) {
|
||||
const comment = {
|
||||
type: block ? "Block" : "Line",
|
||||
value: text
|
||||
};
|
||||
|
||||
if (typeof start === "number") {
|
||||
comment.start = start;
|
||||
comment.end = end;
|
||||
comment.range = [start, end];
|
||||
}
|
||||
|
||||
if (typeof startLoc === "object") {
|
||||
comment.loc = {
|
||||
start: startLoc,
|
||||
end: endLoc
|
||||
};
|
||||
}
|
||||
|
||||
return comment;
|
||||
}
|
||||
|
||||
module.exports = () => Parser => {
|
||||
const tokTypes = Object.assign({}, Parser.acorn.tokTypes);
|
||||
|
||||
if (Parser.acornJsx) {
|
||||
Object.assign(tokTypes, Parser.acornJsx.tokTypes);
|
||||
}
|
||||
|
||||
return class Espree extends Parser {
|
||||
constructor(opts, code) {
|
||||
if (typeof opts !== "object" || opts === null) {
|
||||
opts = {};
|
||||
}
|
||||
if (typeof code !== "string" && !(code instanceof String)) {
|
||||
code = String(code);
|
||||
}
|
||||
|
||||
const options = normalizeOptions(opts);
|
||||
const ecmaFeatures = options.ecmaFeatures || {};
|
||||
const tokenTranslator =
|
||||
options.tokens === true
|
||||
? new TokenTranslator(tokTypes, code)
|
||||
: null;
|
||||
|
||||
// Initialize acorn parser.
|
||||
super({
|
||||
|
||||
// TODO: use {...options} when spread is supported(Node.js >= 8.3.0).
|
||||
ecmaVersion: options.ecmaVersion,
|
||||
sourceType: options.sourceType,
|
||||
ranges: options.ranges,
|
||||
locations: options.locations,
|
||||
|
||||
// Truthy value is true for backward compatibility.
|
||||
allowReturnOutsideFunction: Boolean(ecmaFeatures.globalReturn),
|
||||
|
||||
// Collect tokens
|
||||
onToken: token => {
|
||||
if (tokenTranslator) {
|
||||
|
||||
// Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.
|
||||
tokenTranslator.onToken(token, this[STATE]);
|
||||
}
|
||||
if (token.type !== tokTypes.eof) {
|
||||
this[STATE].lastToken = token;
|
||||
}
|
||||
},
|
||||
|
||||
// Collect comments
|
||||
onComment: (block, text, start, end, startLoc, endLoc) => {
|
||||
if (this[STATE].comments) {
|
||||
const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc);
|
||||
|
||||
this[STATE].comments.push(comment);
|
||||
}
|
||||
}
|
||||
}, code);
|
||||
|
||||
// Initialize internal state.
|
||||
this[STATE] = {
|
||||
tokens: tokenTranslator ? [] : null,
|
||||
comments: options.comment === true ? [] : null,
|
||||
impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,
|
||||
ecmaVersion: this.options.ecmaVersion,
|
||||
jsxAttrValueToken: false,
|
||||
lastToken: null
|
||||
};
|
||||
}
|
||||
|
||||
tokenize() {
|
||||
do {
|
||||
this.next();
|
||||
} while (this.type !== tokTypes.eof);
|
||||
|
||||
// Consume the final eof token
|
||||
this.next();
|
||||
|
||||
const extra = this[STATE];
|
||||
const tokens = extra.tokens;
|
||||
|
||||
if (extra.comments) {
|
||||
tokens.comments = extra.comments;
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
finishNode(...args) {
|
||||
const result = super.finishNode(...args);
|
||||
|
||||
return this[ESPRIMA_FINISH_NODE](result);
|
||||
}
|
||||
|
||||
finishNodeAt(...args) {
|
||||
const result = super.finishNodeAt(...args);
|
||||
|
||||
return this[ESPRIMA_FINISH_NODE](result);
|
||||
}
|
||||
|
||||
parse() {
|
||||
const extra = this[STATE];
|
||||
const program = super.parse();
|
||||
|
||||
program.sourceType = this.options.sourceType;
|
||||
|
||||
if (extra.comments) {
|
||||
program.comments = extra.comments;
|
||||
}
|
||||
if (extra.tokens) {
|
||||
program.tokens = extra.tokens;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adjust opening and closing position of program to match Esprima.
|
||||
* Acorn always starts programs at range 0 whereas Esprima starts at the
|
||||
* first AST node's start (the only real difference is when there's leading
|
||||
* whitespace or leading comments). Acorn also counts trailing whitespace
|
||||
* as part of the program whereas Esprima only counts up to the last token.
|
||||
*/
|
||||
if (program.range) {
|
||||
program.range[0] = program.body.length ? program.body[0].range[0] : program.range[0];
|
||||
program.range[1] = extra.lastToken ? extra.lastToken.range[1] : program.range[1];
|
||||
}
|
||||
if (program.loc) {
|
||||
program.loc.start = program.body.length ? program.body[0].loc.start : program.loc.start;
|
||||
program.loc.end = extra.lastToken ? extra.lastToken.loc.end : program.loc.end;
|
||||
}
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
parseTopLevel(node) {
|
||||
if (this[STATE].impliedStrict) {
|
||||
this.strict = true;
|
||||
}
|
||||
return super.parseTopLevel(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites the default raise method to throw Esprima-style errors.
|
||||
* @param {int} pos The position of the error.
|
||||
* @param {string} message The error message.
|
||||
* @throws {SyntaxError} A syntax error.
|
||||
* @returns {void}
|
||||
*/
|
||||
raise(pos, message) {
|
||||
const loc = Parser.acorn.getLineInfo(this.input, pos);
|
||||
const err = new SyntaxError(message);
|
||||
|
||||
err.index = pos;
|
||||
err.lineNumber = loc.line;
|
||||
err.column = loc.column + 1; // acorn uses 0-based columns
|
||||
throw err;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites the default raise method to throw Esprima-style errors.
|
||||
* @param {int} pos The position of the error.
|
||||
* @param {string} message The error message.
|
||||
* @throws {SyntaxError} A syntax error.
|
||||
* @returns {void}
|
||||
*/
|
||||
raiseRecoverable(pos, message) {
|
||||
this.raise(pos, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites the default unexpected method to throw Esprima-style errors.
|
||||
* @param {int} pos The position of the error.
|
||||
* @throws {SyntaxError} A syntax error.
|
||||
* @returns {void}
|
||||
*/
|
||||
unexpected(pos) {
|
||||
let message = "Unexpected token";
|
||||
|
||||
if (pos !== null && pos !== void 0) {
|
||||
this.pos = pos;
|
||||
|
||||
if (this.options.locations) {
|
||||
while (this.pos < this.lineStart) {
|
||||
this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1;
|
||||
--this.curLine;
|
||||
}
|
||||
}
|
||||
|
||||
this.nextToken();
|
||||
}
|
||||
|
||||
if (this.end > this.start) {
|
||||
message += ` ${this.input.slice(this.start, this.end)}`;
|
||||
}
|
||||
|
||||
this.raise(this.start, message);
|
||||
}
|
||||
|
||||
/*
|
||||
* Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX
|
||||
* uses regular tt.string without any distinction between this and regular JS
|
||||
* strings. As such, we intercept an attempt to read a JSX string and set a flag
|
||||
* on extra so that when tokens are converted, the next token will be switched
|
||||
* to JSXText via onToken.
|
||||
*/
|
||||
jsx_readString(quote) { // eslint-disable-line camelcase
|
||||
const result = super.jsx_readString(quote);
|
||||
|
||||
if (this.type === tokTypes.string) {
|
||||
this[STATE].jsxAttrValueToken = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs last-minute Esprima-specific compatibility checks and fixes.
|
||||
* @param {ASTNode} result The node to check.
|
||||
* @returns {ASTNode} The finished node.
|
||||
*/
|
||||
[ESPRIMA_FINISH_NODE](result) {
|
||||
|
||||
// Acorn doesn't count the opening and closing backticks as part of templates
|
||||
// so we have to adjust ranges/locations appropriately.
|
||||
if (result.type === "TemplateElement") {
|
||||
|
||||
// additional adjustment needed if ${ is the last token
|
||||
const terminalDollarBraceL = this.input.slice(result.end, result.end + 2) === "${";
|
||||
|
||||
if (result.range) {
|
||||
result.range[0]--;
|
||||
result.range[1] += (terminalDollarBraceL ? 2 : 1);
|
||||
}
|
||||
|
||||
if (result.loc) {
|
||||
result.loc.start.column--;
|
||||
result.loc.end.column += (terminalDollarBraceL ? 2 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (result.type.indexOf("Function") > -1 && !result.generator) {
|
||||
result.generator = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
};
|
29
node_modules/espree/lib/features.js
generated
vendored
Normal file
29
node_modules/espree/lib/features.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @fileoverview The list of feature flags supported by the parser and their default
|
||||
* settings.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// None!
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
|
||||
// React JSX parsing
|
||||
jsx: false,
|
||||
|
||||
// allow return statement in global scope
|
||||
globalReturn: false,
|
||||
|
||||
// allow implied strict mode
|
||||
impliedStrict: false
|
||||
};
|
105
node_modules/espree/lib/options.js
generated
vendored
Normal file
105
node_modules/espree/lib/options.js
generated
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
/**
|
||||
* @fileoverview A collection of methods for processing Espree's options.
|
||||
* @author Kai Cataldo
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const DEFAULT_ECMA_VERSION = 5;
|
||||
const SUPPORTED_VERSIONS = [
|
||||
3,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11
|
||||
];
|
||||
|
||||
/**
|
||||
* Normalize ECMAScript version from the initial config
|
||||
* @param {number} ecmaVersion ECMAScript version from the initial config
|
||||
* @throws {Error} throws an error if the ecmaVersion is invalid.
|
||||
* @returns {number} normalized ECMAScript version
|
||||
*/
|
||||
function normalizeEcmaVersion(ecmaVersion = DEFAULT_ECMA_VERSION) {
|
||||
if (typeof ecmaVersion !== "number") {
|
||||
throw new Error(`ecmaVersion must be a number. Received value of type ${typeof ecmaVersion} instead.`);
|
||||
}
|
||||
|
||||
let version = ecmaVersion;
|
||||
|
||||
// Calculate ECMAScript edition number from official year version starting with
|
||||
// ES2015, which corresponds with ES6 (or a difference of 2009).
|
||||
if (version >= 2015) {
|
||||
version -= 2009;
|
||||
}
|
||||
|
||||
if (!SUPPORTED_VERSIONS.includes(version)) {
|
||||
throw new Error("Invalid ecmaVersion.");
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize sourceType from the initial config
|
||||
* @param {string} sourceType to normalize
|
||||
* @throws {Error} throw an error if sourceType is invalid
|
||||
* @returns {string} normalized sourceType
|
||||
*/
|
||||
function normalizeSourceType(sourceType = "script") {
|
||||
if (sourceType === "script" || sourceType === "module") {
|
||||
return sourceType;
|
||||
}
|
||||
throw new Error("Invalid sourceType.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize parserOptions
|
||||
* @param {Object} options the parser options to normalize
|
||||
* @throws {Error} throw an error if found invalid option.
|
||||
* @returns {Object} normalized options
|
||||
*/
|
||||
function normalizeOptions(options) {
|
||||
const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion);
|
||||
const sourceType = normalizeSourceType(options.sourceType);
|
||||
const ranges = options.range === true;
|
||||
const locations = options.loc === true;
|
||||
|
||||
if (sourceType === "module" && ecmaVersion < 6) {
|
||||
throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");
|
||||
}
|
||||
return Object.assign({}, options, { ecmaVersion, sourceType, ranges, locations });
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the latest ECMAScript version supported by Espree.
|
||||
* @returns {number} The latest ECMAScript version.
|
||||
*/
|
||||
function getLatestEcmaVersion() {
|
||||
return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of ECMAScript versions supported by Espree.
|
||||
* @returns {number[]} An array containing the supported ECMAScript versions.
|
||||
*/
|
||||
function getSupportedEcmaVersions() {
|
||||
return [...SUPPORTED_VERSIONS];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
normalizeOptions,
|
||||
getLatestEcmaVersion,
|
||||
getSupportedEcmaVersions
|
||||
};
|
262
node_modules/espree/lib/token-translator.js
generated
vendored
Normal file
262
node_modules/espree/lib/token-translator.js
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
/**
|
||||
* @fileoverview Translates tokens between Acorn format and Esprima format.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
/* eslint no-underscore-dangle: 0 */
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// none!
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Private
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Esprima Token Types
|
||||
const Token = {
|
||||
Boolean: "Boolean",
|
||||
EOF: "<end>",
|
||||
Identifier: "Identifier",
|
||||
Keyword: "Keyword",
|
||||
Null: "Null",
|
||||
Numeric: "Numeric",
|
||||
Punctuator: "Punctuator",
|
||||
String: "String",
|
||||
RegularExpression: "RegularExpression",
|
||||
Template: "Template",
|
||||
JSXIdentifier: "JSXIdentifier",
|
||||
JSXText: "JSXText"
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts part of a template into an Esprima token.
|
||||
* @param {AcornToken[]} tokens The Acorn tokens representing the template.
|
||||
* @param {string} code The source code.
|
||||
* @returns {EsprimaToken} The Esprima equivalent of the template token.
|
||||
* @private
|
||||
*/
|
||||
function convertTemplatePart(tokens, code) {
|
||||
const firstToken = tokens[0],
|
||||
lastTemplateToken = tokens[tokens.length - 1];
|
||||
|
||||
const token = {
|
||||
type: Token.Template,
|
||||
value: code.slice(firstToken.start, lastTemplateToken.end)
|
||||
};
|
||||
|
||||
if (firstToken.loc) {
|
||||
token.loc = {
|
||||
start: firstToken.loc.start,
|
||||
end: lastTemplateToken.loc.end
|
||||
};
|
||||
}
|
||||
|
||||
if (firstToken.range) {
|
||||
token.start = firstToken.range[0];
|
||||
token.end = lastTemplateToken.range[1];
|
||||
token.range = [token.start, token.end];
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains logic to translate Acorn tokens into Esprima tokens.
|
||||
* @param {Object} acornTokTypes The Acorn token types.
|
||||
* @param {string} code The source code Acorn is parsing. This is necessary
|
||||
* to correct the "value" property of some tokens.
|
||||
* @constructor
|
||||
*/
|
||||
function TokenTranslator(acornTokTypes, code) {
|
||||
|
||||
// token types
|
||||
this._acornTokTypes = acornTokTypes;
|
||||
|
||||
// token buffer for templates
|
||||
this._tokens = [];
|
||||
|
||||
// track the last curly brace
|
||||
this._curlyBrace = null;
|
||||
|
||||
// the source code
|
||||
this._code = code;
|
||||
|
||||
}
|
||||
|
||||
TokenTranslator.prototype = {
|
||||
constructor: TokenTranslator,
|
||||
|
||||
/**
|
||||
* Translates a single Esprima token to a single Acorn token. This may be
|
||||
* inaccurate due to how templates are handled differently in Esprima and
|
||||
* Acorn, but should be accurate for all other tokens.
|
||||
* @param {AcornToken} token The Acorn token to translate.
|
||||
* @param {Object} extra Espree extra object.
|
||||
* @returns {EsprimaToken} The Esprima version of the token.
|
||||
*/
|
||||
translate(token, extra) {
|
||||
|
||||
const type = token.type,
|
||||
tt = this._acornTokTypes;
|
||||
|
||||
if (type === tt.name) {
|
||||
token.type = Token.Identifier;
|
||||
|
||||
// TODO: See if this is an Acorn bug
|
||||
if (token.value === "static") {
|
||||
token.type = Token.Keyword;
|
||||
}
|
||||
|
||||
if (extra.ecmaVersion > 5 && (token.value === "yield" || token.value === "let")) {
|
||||
token.type = Token.Keyword;
|
||||
}
|
||||
|
||||
} else if (type === tt.semi || type === tt.comma ||
|
||||
type === tt.parenL || type === tt.parenR ||
|
||||
type === tt.braceL || type === tt.braceR ||
|
||||
type === tt.dot || type === tt.bracketL ||
|
||||
type === tt.colon || type === tt.question ||
|
||||
type === tt.bracketR || type === tt.ellipsis ||
|
||||
type === tt.arrow || type === tt.jsxTagStart ||
|
||||
type === tt.incDec || type === tt.starstar ||
|
||||
type === tt.jsxTagEnd || type === tt.prefix ||
|
||||
(type.binop && !type.keyword) ||
|
||||
type.isAssign) {
|
||||
|
||||
token.type = Token.Punctuator;
|
||||
token.value = this._code.slice(token.start, token.end);
|
||||
} else if (type === tt.jsxName) {
|
||||
token.type = Token.JSXIdentifier;
|
||||
} else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) {
|
||||
token.type = Token.JSXText;
|
||||
} else if (type.keyword) {
|
||||
if (type.keyword === "true" || type.keyword === "false") {
|
||||
token.type = Token.Boolean;
|
||||
} else if (type.keyword === "null") {
|
||||
token.type = Token.Null;
|
||||
} else {
|
||||
token.type = Token.Keyword;
|
||||
}
|
||||
} else if (type === tt.num) {
|
||||
token.type = Token.Numeric;
|
||||
token.value = this._code.slice(token.start, token.end);
|
||||
} else if (type === tt.string) {
|
||||
|
||||
if (extra.jsxAttrValueToken) {
|
||||
extra.jsxAttrValueToken = false;
|
||||
token.type = Token.JSXText;
|
||||
} else {
|
||||
token.type = Token.String;
|
||||
}
|
||||
|
||||
token.value = this._code.slice(token.start, token.end);
|
||||
} else if (type === tt.regexp) {
|
||||
token.type = Token.RegularExpression;
|
||||
const value = token.value;
|
||||
|
||||
token.regex = {
|
||||
flags: value.flags,
|
||||
pattern: value.pattern
|
||||
};
|
||||
token.value = `/${value.pattern}/${value.flags}`;
|
||||
}
|
||||
|
||||
return token;
|
||||
},
|
||||
|
||||
/**
|
||||
* Function to call during Acorn's onToken handler.
|
||||
* @param {AcornToken} token The Acorn token.
|
||||
* @param {Object} extra The Espree extra object.
|
||||
* @returns {void}
|
||||
*/
|
||||
onToken(token, extra) {
|
||||
|
||||
const that = this,
|
||||
tt = this._acornTokTypes,
|
||||
tokens = extra.tokens,
|
||||
templateTokens = this._tokens;
|
||||
|
||||
/**
|
||||
* Flushes the buffered template tokens and resets the template
|
||||
* tracking.
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function translateTemplateTokens() {
|
||||
tokens.push(convertTemplatePart(that._tokens, that._code));
|
||||
that._tokens = [];
|
||||
}
|
||||
|
||||
if (token.type === tt.eof) {
|
||||
|
||||
// might be one last curlyBrace
|
||||
if (this._curlyBrace) {
|
||||
tokens.push(this.translate(this._curlyBrace, extra));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (token.type === tt.backQuote) {
|
||||
|
||||
// if there's already a curly, it's not part of the template
|
||||
if (this._curlyBrace) {
|
||||
tokens.push(this.translate(this._curlyBrace, extra));
|
||||
this._curlyBrace = null;
|
||||
}
|
||||
|
||||
templateTokens.push(token);
|
||||
|
||||
// it's the end
|
||||
if (templateTokens.length > 1) {
|
||||
translateTemplateTokens();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (token.type === tt.dollarBraceL) {
|
||||
templateTokens.push(token);
|
||||
translateTemplateTokens();
|
||||
return;
|
||||
}
|
||||
if (token.type === tt.braceR) {
|
||||
|
||||
// if there's already a curly, it's not part of the template
|
||||
if (this._curlyBrace) {
|
||||
tokens.push(this.translate(this._curlyBrace, extra));
|
||||
}
|
||||
|
||||
// store new curly for later
|
||||
this._curlyBrace = token;
|
||||
return;
|
||||
}
|
||||
if (token.type === tt.template || token.type === tt.invalidTemplate) {
|
||||
if (this._curlyBrace) {
|
||||
templateTokens.push(this._curlyBrace);
|
||||
this._curlyBrace = null;
|
||||
}
|
||||
|
||||
templateTokens.push(token);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._curlyBrace) {
|
||||
tokens.push(this.translate(this._curlyBrace, extra));
|
||||
this._curlyBrace = null;
|
||||
}
|
||||
|
||||
tokens.push(this.translate(token, extra));
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = TokenTranslator;
|
123
node_modules/espree/lib/visitor-keys.js
generated
vendored
Normal file
123
node_modules/espree/lib/visitor-keys.js
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
/**
|
||||
* @fileoverview The visitor keys for the node types Espree supports
|
||||
* @author Nicholas C. Zakas
|
||||
*
|
||||
* This file contains code from estraverse-fb.
|
||||
*
|
||||
* The MIT license. Copyright (c) 2014 Ingvar Stepanyan
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// None!
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
|
||||
// ECMAScript
|
||||
AssignmentExpression: ["left", "right"],
|
||||
AssignmentPattern: ["left", "right"],
|
||||
ArrayExpression: ["elements"],
|
||||
ArrayPattern: ["elements"],
|
||||
ArrowFunctionExpression: ["params", "body"],
|
||||
BlockStatement: ["body"],
|
||||
BinaryExpression: ["left", "right"],
|
||||
BreakStatement: ["label"],
|
||||
CallExpression: ["callee", "arguments"],
|
||||
CatchClause: ["param", "body"],
|
||||
ClassBody: ["body"],
|
||||
ClassDeclaration: ["id", "superClass", "body"],
|
||||
ClassExpression: ["id", "superClass", "body"],
|
||||
ConditionalExpression: ["test", "consequent", "alternate"],
|
||||
ContinueStatement: ["label"],
|
||||
DebuggerStatement: [],
|
||||
DirectiveStatement: [],
|
||||
DoWhileStatement: ["body", "test"],
|
||||
EmptyStatement: [],
|
||||
ExportAllDeclaration: ["source"],
|
||||
ExportDefaultDeclaration: ["declaration"],
|
||||
ExportNamedDeclaration: ["declaration", "specifiers", "source"],
|
||||
ExportSpecifier: ["exported", "local"],
|
||||
ExpressionStatement: ["expression"],
|
||||
ForStatement: ["init", "test", "update", "body"],
|
||||
ForInStatement: ["left", "right", "body"],
|
||||
ForOfStatement: ["left", "right", "body"],
|
||||
FunctionDeclaration: ["id", "params", "body"],
|
||||
FunctionExpression: ["id", "params", "body"],
|
||||
Identifier: [],
|
||||
IfStatement: ["test", "consequent", "alternate"],
|
||||
ImportDeclaration: ["specifiers", "source"],
|
||||
ImportDefaultSpecifier: ["local"],
|
||||
ImportNamespaceSpecifier: ["local"],
|
||||
ImportSpecifier: ["imported", "local"],
|
||||
Literal: [],
|
||||
LabeledStatement: ["label", "body"],
|
||||
LogicalExpression: ["left", "right"],
|
||||
MemberExpression: ["object", "property"],
|
||||
MetaProperty: ["meta", "property"],
|
||||
MethodDefinition: ["key", "value"],
|
||||
ModuleSpecifier: [],
|
||||
NewExpression: ["callee", "arguments"],
|
||||
ObjectExpression: ["properties"],
|
||||
ObjectPattern: ["properties"],
|
||||
Program: ["body"],
|
||||
Property: ["key", "value"],
|
||||
RestElement: ["argument"],
|
||||
ReturnStatement: ["argument"],
|
||||
SequenceExpression: ["expressions"],
|
||||
SpreadElement: ["argument"],
|
||||
Super: [],
|
||||
SwitchStatement: ["discriminant", "cases"],
|
||||
SwitchCase: ["test", "consequent"],
|
||||
TaggedTemplateExpression: ["tag", "quasi"],
|
||||
TemplateElement: [],
|
||||
TemplateLiteral: ["quasis", "expressions"],
|
||||
ThisExpression: [],
|
||||
ThrowStatement: ["argument"],
|
||||
TryStatement: ["block", "handler", "finalizer"],
|
||||
UnaryExpression: ["argument"],
|
||||
UpdateExpression: ["argument"],
|
||||
VariableDeclaration: ["declarations"],
|
||||
VariableDeclarator: ["id", "init"],
|
||||
WhileStatement: ["test", "body"],
|
||||
WithStatement: ["object", "body"],
|
||||
YieldExpression: ["argument"],
|
||||
|
||||
// JSX
|
||||
JSXIdentifier: [],
|
||||
JSXNamespacedName: ["namespace", "name"],
|
||||
JSXMemberExpression: ["object", "property"],
|
||||
JSXEmptyExpression: [],
|
||||
JSXExpressionContainer: ["expression"],
|
||||
JSXElement: ["openingElement", "closingElement", "children"],
|
||||
JSXClosingElement: ["name"],
|
||||
JSXOpeningElement: ["name", "attributes"],
|
||||
JSXAttribute: ["name", "value"],
|
||||
JSXText: null,
|
||||
JSXSpreadAttribute: ["argument"]
|
||||
};
|
93
node_modules/espree/package.json
generated
vendored
Normal file
93
node_modules/espree/package.json
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
{
|
||||
"_from": "espree@^6.1.2",
|
||||
"_id": "espree@6.2.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==",
|
||||
"_location": "/espree",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "espree@^6.1.2",
|
||||
"name": "espree",
|
||||
"escapedName": "espree",
|
||||
"rawSpec": "^6.1.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.1.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/eslint"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz",
|
||||
"_shasum": "77fc72e1fd744a2052c20f38a5b575832e82734a",
|
||||
"_spec": "espree@^6.1.2",
|
||||
"_where": "/Users/Luca_Schwan/Desktop/DSABot/node_modules/eslint",
|
||||
"author": {
|
||||
"name": "Nicholas C. Zakas",
|
||||
"email": "nicholas+npm@nczconsulting.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/eslint/espree.git"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"acorn": "^7.1.1",
|
||||
"acorn-jsx": "^5.2.0",
|
||||
"eslint-visitor-keys": "^1.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "An Esprima-compatible JavaScript parser built on Acorn",
|
||||
"devDependencies": {
|
||||
"browserify": "^16.5.0",
|
||||
"chai": "^4.2.0",
|
||||
"eslint": "^6.0.1",
|
||||
"eslint-config-eslint": "^5.0.1",
|
||||
"eslint-plugin-node": "^9.1.0",
|
||||
"eslint-release": "^1.0.0",
|
||||
"esprima": "latest",
|
||||
"esprima-fb": "^8001.2001.0-dev-harmony-fb",
|
||||
"json-diff": "^0.5.4",
|
||||
"leche": "^2.3.0",
|
||||
"mocha": "^6.2.0",
|
||||
"nyc": "^14.1.1",
|
||||
"regenerate": "^1.4.0",
|
||||
"shelljs": "^0.3.0",
|
||||
"shelljs-nodecli": "^0.1.1",
|
||||
"unicode-6.3.0": "^0.7.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"espree.js"
|
||||
],
|
||||
"homepage": "https://github.com/eslint/espree",
|
||||
"keywords": [
|
||||
"ast",
|
||||
"ecmascript",
|
||||
"javascript",
|
||||
"parser",
|
||||
"syntax",
|
||||
"acorn"
|
||||
],
|
||||
"license": "BSD-2-Clause",
|
||||
"main": "espree.js",
|
||||
"name": "espree",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/eslint/espree.git"
|
||||
},
|
||||
"scripts": {
|
||||
"browserify": "node Makefile.js browserify",
|
||||
"generate-alpharelease": "eslint-generate-prerelease alpha",
|
||||
"generate-betarelease": "eslint-generate-prerelease beta",
|
||||
"generate-rcrelease": "eslint-generate-prerelease rc",
|
||||
"generate-regex": "node tools/generate-identifier-regex.js",
|
||||
"generate-release": "eslint-generate-release",
|
||||
"lint": "node Makefile.js lint",
|
||||
"publish-release": "eslint-publish-release",
|
||||
"test": "npm run-script lint && node Makefile.js test"
|
||||
},
|
||||
"version": "6.2.1"
|
||||
}
|
Reference in New Issue
Block a user