feat: updates & github event support

This commit is contained in:
Joel Male
2024-03-28 12:00:41 +10:00
parent 8561675bfc
commit 3cee2ba3f1
1640 changed files with 100049 additions and 152370 deletions
+5 -4
View File
@@ -1,4 +1,5 @@
/* eslint-disable no-param-reassign*/
/* eslint no-param-reassign: 0 -- stylistic choice */
import TokenTranslator from "./token-translator.js";
import { normalizeOptions } from "./options.js";
@@ -109,7 +110,7 @@ export default () => Parser => {
allowReturnOutsideFunction: options.allowReturnOutsideFunction,
// Collect tokens
onToken: token => {
onToken(token) {
if (tokenTranslator) {
// Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.
@@ -121,7 +122,7 @@ export default () => Parser => {
},
// Collect comments
onComment: (block, text, start, end, startLoc, endLoc) => {
onComment(block, text, start, end, startLoc, endLoc) {
if (state.comments) {
const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code);
@@ -314,7 +315,7 @@ export default () => Parser => {
* 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
jsx_readString(quote) { // eslint-disable-line camelcase -- required by API
const result = super.jsx_readString(quote);
if (this.type === tokTypes.string) {
+2 -1
View File
@@ -18,7 +18,8 @@ const SUPPORTED_VERSIONS = [
11, // 2020
12, // 2021
13, // 2022
14 // 2023
14, // 2023
15 // 2024
];
/**
+5 -7
View File
@@ -2,7 +2,6 @@
* @fileoverview Translates tokens between Acorn format and Esprima format.
* @author Nicholas C. Zakas
*/
/* eslint no-underscore-dangle: 0 */
//------------------------------------------------------------------------------
// Requirements
@@ -180,8 +179,7 @@ TokenTranslator.prototype = {
*/
onToken(token, extra) {
const that = this,
tt = this._acornTokTypes,
const tt = this._acornTokTypes,
tokens = extra.tokens,
templateTokens = this._tokens;
@@ -191,10 +189,10 @@ TokenTranslator.prototype = {
* @returns {void}
* @private
*/
function translateTemplateTokens() {
tokens.push(convertTemplatePart(that._tokens, that._code));
that._tokens = [];
}
const translateTemplateTokens = () => {
tokens.push(convertTemplatePart(this._tokens, this._code));
this._tokens = [];
};
if (token.type === tt.eof) {