From 784bfb0029151c3f6af6df8f8fc2cb791fdfabb8 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 21 Apr 2022 10:07:00 +0800 Subject: [PATCH 01/24] feat: Programmatic building of type-checkable JS and declaration files Also: - feat(`lib/espree`): throws specific error if `jsx_readString` superclass undefined - refactor(`lib/espree`): changes to force EspreeParser constructor to convert string as created with `new String` to plain string (for typing) - refactor(`lib/espree`): checks for existence of `firstNode.range` and `firstNode.loc` in `parse` (as may be absent) - refactor(`lib/espree`): checks for existence of `tokens` in `tokenize` (as may be absent) - refactor(`lib/espree`): checks for existence of `extra.lastToken.range` and `extra.lastToken.loc` in `parse` (as may be absent) - refactor(`lib/token-translator``): checks for existence of `lastTemplateToken.loc` and `lastTemplateToken.range` (as may be absent) - chore: update devDeps. --- .eslintignore | 1 + .eslintrc.cjs | 9 +- .gitignore | 1 + espree.js | 99 ++++- lib/espree.js | 688 +++++++++++++++++++++----------- lib/options.js | 46 ++- lib/token-translator.js | 121 ++++-- package.json | 19 +- tests/lib/espree.js | 16 + tools/intermediate-js-for-ts.js | 295 ++++++++++++++ tsconfig.json | 20 + 11 files changed, 1016 insertions(+), 299 deletions(-) create mode 100644 tests/lib/espree.js create mode 100644 tools/intermediate-js-for-ts.js create mode 100644 tsconfig.json diff --git a/.eslintignore b/.eslintignore index e269a9ac..e413f06b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,3 +2,4 @@ /tests/fixtures /dist tools/create-test-example.js +tmp diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 10c67363..610913e1 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -12,7 +12,7 @@ module.exports = { } }, parserOptions: { - ecmaVersion: 2020, + ecmaVersion: 2022, sourceType: "module" }, overrides: [ @@ -34,5 +34,10 @@ module.exports = { "no-console": "off" } } - ] + ], + rules: { + "jsdoc/check-tag-names": ["error", { + definedTags: ["local", "export"] + }] + } }; diff --git a/.gitignore b/.gitignore index c9e42c6d..3c0be30d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ _test.js .eslint-release-info.json yarn.lock package-lock.json +tmp diff --git a/espree.js b/espree.js index 71e3d47d..c888a456 100644 --- a/espree.js +++ b/espree.js @@ -56,6 +56,57 @@ */ /* eslint no-undefined:0, no-use-before-define: 0 */ +// ---------------------------------------------------------------------------- +// Types exported from file +// ---------------------------------------------------------------------------- +/** + * `jsx.Options` gives us 2 optional properties, so extend it + * + * `allowReserved`, `ranges`, `locations`, `allowReturnOutsideFunction`, + * `onToken`, and `onComment` are as in `acorn.Options` + * + * `ecmaVersion` as in `acorn.Options` though optional + * + * `sourceType` as in `acorn.Options` but also allows `commonjs` + * + * `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options` + * + * `comment` is not in `acorn.Options` and doesn't err without it, but is used + * @typedef {{ + * allowReserved?: boolean | "never", + * ranges?: boolean, + * locations?: boolean, + * allowReturnOutsideFunction?: boolean, + * onToken?: ((token: acorn.Token) => any) | acorn.Token[], + * onComment?: (( + * isBlock: boolean, text: string, start: number, end: number, startLoc?: acorn.Position, + * endLoc?: acorn.Position + * ) => void) | acorn.Comment[], + * ecmaVersion?: acorn.ecmaVersion, + * sourceType?: "script"|"module"|"commonjs", + * ecmaFeatures?: { + * jsx?: boolean, + * globalReturn?: boolean, + * impliedStrict?: boolean + * }, + * range?: boolean, + * loc?: boolean, + * tokens?: boolean | null, + * comment?: boolean, + * } & jsx.Options} ParserOptions + */ + +// ---------------------------------------------------------------------------- +// Local type imports +// ---------------------------------------------------------------------------- +/** + * @local + * @typedef {import('acorn')} acorn + * @typedef {typeof import('acorn-jsx').AcornJsxParser} AcornJsxParser + * @typedef {import('./lib/espree').EnhancedSyntaxError} EnhancedSyntaxError + * @typedef {typeof import('./lib/espree').EspreeParser} IEspreeParser + */ + import * as acorn from "acorn"; import jsx from "acorn-jsx"; import espree from "./lib/espree.js"; @@ -66,23 +117,43 @@ import { getLatestEcmaVersion, getSupportedEcmaVersions } from "./lib/options.js // To initialize lazily. const parsers = { - _regular: null, - _jsx: null, + _regular: /** @type {IEspreeParser|null} */ (null), + _jsx: /** @type {IEspreeParser|null} */ (null), + /** + * Returns regular Parser + * @returns {IEspreeParser} Regular Acorn parser + */ get regular() { if (this._regular === null) { - this._regular = acorn.Parser.extend(espree()); + const espreeParserFactory = espree(); + + // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts + this._regular = espreeParserFactory(/** @type {AcornJsxParser} */ (acorn.Parser)); } return this._regular; }, + /** + * Returns JSX Parser + * @returns {IEspreeParser} JSX Acorn parser + */ get jsx() { if (this._jsx === null) { - this._jsx = acorn.Parser.extend(jsx(), espree()); + const espreeParserFactory = espree(); + const jsxFactory = jsx(); + + // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts + this._jsx = espreeParserFactory(jsxFactory(acorn.Parser)); } return this._jsx; }, + /** + * Returns Regular or JSX Parser + * @param {ParserOptions} options Parser options + * @returns {IEspreeParser} Regular or JSX Acorn parser + */ get(options) { const useJsx = Boolean( options && @@ -101,9 +172,9 @@ const parsers = { /** * 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. + * @param {ParserOptions} options Options defining how to tokenize. + * @returns {acorn.Token[]|null} An array of tokens. + * @throws {EnhancedSyntaxError} If the input code is invalid. * @private */ export function tokenize(code, options) { @@ -124,9 +195,9 @@ export function tokenize(code, options) { /** * 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. + * @param {ParserOptions} options Options defining how to tokenize. + * @returns {acorn.Node} The "Program" AST node. + * @throws {EnhancedSyntaxError} If the input code is invalid. */ export function parse(code, options) { const Parser = parsers.get(options); @@ -148,17 +219,15 @@ export const VisitorKeys = (function() { // Derive node types from VisitorKeys /* istanbul ignore next */ export const Syntax = (function() { - let name, + let /** @type {Object} */ types = {}; if (typeof Object.create === "function") { types = Object.create(null); } - for (name in VisitorKeys) { - if (Object.hasOwnProperty.call(VisitorKeys, name)) { - types[name] = name; - } + for (const name of Object.keys(VisitorKeys)) { + types[name] = name; } if (typeof Object.freeze === "function") { diff --git a/lib/espree.js b/lib/espree.js index 786d89fa..7e92d139 100644 --- a/lib/espree.js +++ b/lib/espree.js @@ -2,27 +2,138 @@ import TokenTranslator from "./token-translator.js"; import { normalizeOptions } from "./options.js"; - const STATE = Symbol("espree's internal state"); const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); +// ---------------------------------------------------------------------------- +// Types exported from file +// ---------------------------------------------------------------------------- +/** + * @typedef {{ + * index?: number; + * lineNumber?: number; + * column?: number; + * } & SyntaxError} EnhancedSyntaxError + */ +/** + * We add `jsxAttrValueToken` ourselves. + * @typedef {{ + * jsxAttrValueToken?: acorn.TokenType; + * } & tokTypesType} EnhancedTokTypes + */ + +// ---------------------------------------------------------------------------- +// Local type imports +// ---------------------------------------------------------------------------- +/** + * @local + * @typedef {import('acorn')} acorn + * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType + * @typedef {typeof import('acorn-jsx').AcornJsxParser} AcornJsxParser + * @typedef {import('../espree').ParserOptions} ParserOptions + */ + +// ---------------------------------------------------------------------------- +// Local types +// ---------------------------------------------------------------------------- +/** + * @local + * + * @typedef {acorn.ecmaVersion} ecmaVersion + * + * @typedef {{ + * generator?: boolean + * } & acorn.Node} EsprimaNode + */ +/** + * Suggests an integer + * @local + * @typedef {number} int + */ +/** + * First three properties as in `acorn.Comment`; next two as in `acorn.Comment` + * but optional. Last is different as has to allow `undefined` + * @local + * + * @typedef {{ + * type: string, + * value: string, + * range?: [number, number], + * start?: number, + * end?: number, + * loc?: { + * start: acorn.Position | undefined, + * end: acorn.Position | undefined + * } + * }} EsprimaComment + * + * @typedef {{ + * comments?: EsprimaComment[] + * } & acorn.Token[]} EspreeTokens + * + * @typedef {{ + * tail?: boolean + * } & acorn.Node} AcornTemplateNode + * + * @typedef {{ + * originalSourceType: "script"|"module"|"commonjs"; + * ecmaVersion: ecmaVersion; + * comments: EsprimaComment[]|null; + * impliedStrict: boolean; + * lastToken: acorn.Token|null; + * templateElements: (AcornTemplateNode)[]; + * jsxAttrValueToken: boolean; + * }} BaseStateObject + * + * @typedef {{ + * tokens: null; + * } & BaseStateObject} StateObject + * + * @typedef {{ + * tokens: EspreeTokens; + * } & BaseStateObject} StateObjectWithTokens + * + * @typedef {{ + * sourceType?: "script"|"module"|"commonjs"; + * comments?: EsprimaComment[]; + * tokens?: acorn.Token[]; + * body: acorn.Node[]; + * } & acorn.Node} EsprimaProgramNode + */ +/** + * Converts an Acorn comment to an Esprima comment. + * + * - block True if it's a block comment, false if not. + * - text The text of the comment. + * - start The index at which the comment starts. + * - end The index at which the comment ends. + * - startLoc The location at which the comment starts. + * - endLoc The location at which the comment ends. + * @local + * @typedef {( + * block: boolean, + * text: string, + * start: int, + * end: int, + * startLoc: acorn.Position | undefined, + * endLoc: acorn.Position | undefined + * ) => EsprimaComment | void} AcornToEsprimaCommentConverter + */ +// ---------------------------------------------------------------------------- +// Utilities +// ---------------------------------------------------------------------------- /** - * 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. + * Converts an Acorn comment to an Esprima comment. + * @type {AcornToEsprimaCommentConverter} + * @returns {EsprimaComment} The comment object. * @private */ function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { - const comment = { + const comment = /** @type {EsprimaComment} */ ({ type: block ? "Block" : "Line", value: text - }; + }); if (typeof start === "number") { comment.start = start; @@ -40,289 +151,378 @@ function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, return comment; } -export default () => 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); - } +// ---------------------------------------------------------------------------- +// Exports +// ---------------------------------------------------------------------------- +/* eslint-disable arrow-body-style -- Need to supply formatted JSDoc for type info */ +export default () => { + + /** + * Returns the Espree parser. + * @param {AcornJsxParser} Parser The Acorn parser + * @returns {typeof EspreeParser} The Espree parser + */ + return Parser => { + const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes)); + + if (Parser.acornJsx) { + Object.assign(tokTypes, Parser.acornJsx.tokTypes); + } - // save original source type in case of commonjs - const originalSourceType = opts.sourceType; - const options = normalizeOptions(opts); - const ecmaFeatures = options.ecmaFeatures || {}; - const tokenTranslator = - options.tokens === true - ? new TokenTranslator(tokTypes, code) - : null; - - // Initialize acorn parser. - super({ - - // do not use spread, because we don't want to pass any unknown options to acorn - ecmaVersion: options.ecmaVersion, - sourceType: options.sourceType, - ranges: options.ranges, - locations: options.locations, - allowReserved: options.allowReserved, - - // Truthy value is true for backward compatibility. - allowReturnOutsideFunction: options.allowReturnOutsideFunction, - - // 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; + /* eslint-disable no-shadow -- Using first class as type */ + /** + * @export + */ + return class EspreeParser extends Parser { + /* eslint-enable no-shadow -- Using first class as type */ + /* eslint-disable jsdoc/check-types -- Allows generic object */ + /** + * Adapted parser for Espree. + * @param {ParserOptions|null} opts Espree options + * @param {string|object} code The source code + */ + constructor(opts, code) { + /* eslint-enable jsdoc/check-types -- Allows generic object */ + + /** @type {ParserOptions} */ + const newOpts = (typeof opts !== "object" || opts === null) + ? {} + : opts; + + const codeString = typeof code === "string" + ? /** @type {string} */ (code) + : String(code); + + // save original source type in case of commonjs + const originalSourceType = newOpts.sourceType; + const options = normalizeOptions(newOpts); + const ecmaFeatures = options.ecmaFeatures || {}; + const tokenTranslator = + options.tokens === true + ? new TokenTranslator(tokTypes, codeString) + : null; + + // Initialize acorn parser. + super({ + + // do not use spread, because we don't want to pass any unknown options to acorn + ecmaVersion: options.ecmaVersion, + sourceType: options.sourceType, + ranges: options.ranges, + locations: options.locations, + allowReserved: options.allowReserved, + + // Truthy value is true for backward compatibility. + allowReturnOutsideFunction: options.allowReturnOutsideFunction, + + // Collect tokens + /** + * Handler for receiving a token + * @param {acorn.Token} token The token + * @returns {void} + */ + onToken: token => { + if (tokenTranslator) { + + // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state. + tokenTranslator.onToken(token, /** @type {StateObjectWithTokens} */ (this[STATE])); + } + if (token.type !== tokTypes.eof) { + this[STATE].lastToken = token; + } + }, + + // Collect comments + /** + * Converts an Acorn comment to an Esprima comment. + * @type {AcornToEsprimaCommentConverter} + */ + onComment: (block, text, start, end, startLoc, endLoc) => { + if (this[STATE].comments) { + const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc); + + const comments = /** @type {EsprimaComment[]} */ (this[STATE].comments); + + comments.push(comment); + } } - }, - - // Collect comments - onComment: (block, text, start, end, startLoc, endLoc) => { - if (this[STATE].comments) { - const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc); + }, codeString); - this[STATE].comments.push(comment); - } + // Force for TypeScript (indicating that `lineStart` is not undefined) + if (!this.lineStart) { + this.lineStart = 0; } - }, code); - /* - * Data that is unique to Espree and is not represented internally in - * Acorn. We put all of this data into a symbol property as a way to - * avoid potential naming conflicts with future versions of Acorn. + /** + * Data that is unique to Espree and is not represented internally in + * Acorn. We put all of this data into a symbol property as a way to + * avoid potential naming conflicts with future versions of Acorn. + * @type {StateObjectWithTokens|StateObject} + */ + this[STATE] = { + originalSourceType: originalSourceType || options.sourceType, + tokens: tokenTranslator ? /** @type {EspreeTokens} */ ([]) : null, + comments: options.comment === true + ? /** @type {EsprimaComment[]} */ ([]) + : null, + impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5, + ecmaVersion: this.options.ecmaVersion, + jsxAttrValueToken: false, + + /** @type {acorn.Token|null} */ + lastToken: null, + + /** @type {(AcornTemplateNode)[]} */ + templateElements: [] + }; + } + + /** + * Returns Espree tokens. + * @returns {EspreeTokens|null} Espree tokens */ - this[STATE] = { - originalSourceType: originalSourceType || options.sourceType, - tokens: tokenTranslator ? [] : null, - comments: options.comment === true ? [] : null, - impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5, - ecmaVersion: this.options.ecmaVersion, - jsxAttrValueToken: false, - lastToken: null, - templateElements: [] - }; - } + tokenize() { + do { + this.next(); + } while (this.type !== tokTypes.eof); - tokenize() { - do { + // Consume the final eof token this.next(); - } while (this.type !== tokTypes.eof); - // Consume the final eof token - this.next(); + const extra = this[STATE]; + const tokens = extra.tokens; - const extra = this[STATE]; - const tokens = extra.tokens; + if (extra.comments && tokens) { + tokens.comments = extra.comments; + } - if (extra.comments) { - tokens.comments = extra.comments; + return tokens; } - 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); - } + /** + * Calls parent. + * @param {acorn.Node} node The node + * @param {string} type The type + * @returns {acorn.Node} The altered Node + */ + finishNode(node, type) { + const result = super.finishNode(node, type); - parse() { - const extra = this[STATE]; - const program = super.parse(); + return this[ESPRIMA_FINISH_NODE](result); + } - program.sourceType = extra.originalSourceType; + /** + * Calls parent. + * @param {acorn.Node} node The node + * @param {string} type The type + * @param {number} pos The position + * @param {acorn.Position} loc The location + * @returns {acorn.Node} The altered Node + */ + finishNodeAt(node, type, pos, loc) { + const result = super.finishNodeAt(node, type, pos, loc); - if (extra.comments) { - program.comments = extra.comments; - } - if (extra.tokens) { - program.tokens = extra.tokens; + return this[ESPRIMA_FINISH_NODE](result); } - /* - * 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. + /** + * Parses. + * @returns {EsprimaProgramNode} The program Node */ - if (program.body.length) { - const [firstNode] = program.body; + parse() { + const extra = this[STATE]; - if (program.range) { - program.range[0] = firstNode.range[0]; + const program = /** @type {EsprimaProgramNode} */ (super.parse()); + + program.sourceType = extra.originalSourceType; + + if (extra.comments) { + program.comments = extra.comments; } - if (program.loc) { - program.loc.start = firstNode.loc.start; + if (extra.tokens) { + program.tokens = extra.tokens; } - program.start = firstNode.start; - } - if (extra.lastToken) { - if (program.range) { - program.range[1] = extra.lastToken.range[1]; + + /* + * 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.body.length) { + const [firstNode] = program.body; + + if (program.range && firstNode.range) { + program.range[0] = firstNode.range[0]; + } + if (program.loc && firstNode.loc) { + program.loc.start = firstNode.loc.start; + } + program.start = firstNode.start; } - if (program.loc) { - program.loc.end = extra.lastToken.loc.end; + if (extra.lastToken) { + if (program.range && extra.lastToken.range) { + program.range[1] = extra.lastToken.range[1]; + } + if (program.loc && extra.lastToken.loc) { + program.loc.end = extra.lastToken.loc.end; + } + program.end = extra.lastToken.end; } - program.end = extra.lastToken.end; - } - /* - * https://github.com/eslint/espree/issues/349 - * Ensure that template elements have correct range information. - * This is one location where Acorn produces a different value - * for its start and end properties vs. the values present in the - * range property. In order to avoid confusion, we set the start - * and end properties to the values that are present in range. - * This is done here, instead of in finishNode(), because Acorn - * uses the values of start and end internally while parsing, making - * it dangerous to change those values while parsing is ongoing. - * By waiting until the end of parsing, we can safely change these - * values without affect any other part of the process. - */ - this[STATE].templateElements.forEach(templateElement => { - const startOffset = -1; - const endOffset = templateElement.tail ? 1 : 2; + /* + * https://github.com/eslint/espree/issues/349 + * Ensure that template elements have correct range information. + * This is one location where Acorn produces a different value + * for its start and end properties vs. the values present in the + * range property. In order to avoid confusion, we set the start + * and end properties to the values that are present in range. + * This is done here, instead of in finishNode(), because Acorn + * uses the values of start and end internally while parsing, making + * it dangerous to change those values while parsing is ongoing. + * By waiting until the end of parsing, we can safely change these + * values without affect any other part of the process. + */ + this[STATE].templateElements.forEach(templateElement => { + const startOffset = -1; + const endOffset = templateElement.tail ? 1 : 2; + + templateElement.start += startOffset; + templateElement.end += endOffset; + + if (templateElement.range) { + templateElement.range[0] += startOffset; + templateElement.range[1] += endOffset; + } - templateElement.start += startOffset; - templateElement.end += endOffset; + if (templateElement.loc) { + templateElement.loc.start.column += startOffset; + templateElement.loc.end.column += endOffset; + } + }); - if (templateElement.range) { - templateElement.range[0] += startOffset; - templateElement.range[1] += endOffset; - } + return program; + } - if (templateElement.loc) { - templateElement.loc.start.column += startOffset; - templateElement.loc.end.column += endOffset; + /** + * Parses top level. + * @param {acorn.Node} node AST Node + * @returns {acorn.Node} The changed node + */ + parseTopLevel(node) { + if (this[STATE].impliedStrict) { + this.strict = true; } - }); + return super.parseTopLevel(node); + } - return program; - } + /** + * 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 {EnhancedSyntaxError} A syntax error. + * @returns {void} + */ + raise(pos, message) { + const loc = Parser.acorn.getLineInfo(this.input, pos); - parseTopLevel(node) { - if (this[STATE].impliedStrict) { - this.strict = true; + /** @type {EnhancedSyntaxError} */ + const err = new SyntaxError(message); + + err.index = pos; + err.lineNumber = loc.line; + err.column = loc.column + 1; // acorn uses 0-based columns + throw err; } - 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 {EnhancedSyntaxError} A syntax error. + * @returns {void} + */ + raiseRecoverable(pos, message) { + this.raise(pos, message); + } - /** - * 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 {EnhancedSyntaxError} A syntax error. + * @returns {void} + */ + unexpected(pos) { + let message = "Unexpected token"; - /** - * 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 (pos !== null && pos !== void 0) { - this.pos = pos; + if (this.options.locations) { + while (this.pos < /** @type {number} */ (this.lineStart)) { - if (this.options.locations) { - while (this.pos < this.lineStart) { - this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1; - --this.curLine; + /** @type {number} */ + this.lineStart = this.input.lastIndexOf("\n", /** @type {number} */ (this.lineStart) - 2) + 1; + --this.curLine; + } } + + this.nextToken(); } - this.nextToken(); - } + if (this.end > this.start) { + message += ` ${this.input.slice(this.start, this.end)}`; + } - if (this.end > this.start) { - message += ` ${this.input.slice(this.start, this.end)}`; + this.raise(this.start, message); } - 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. + * @param {number} quote A character code + * @returns {void} + */ + jsx_readString(quote) { // eslint-disable-line camelcase + if (typeof super.jsx_readString === "undefined") { + throw new Error("Not a JSX parser"); + } + const result = super.jsx_readString(quote); - /* - * 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; + if (this.type === tokTypes.string) { + this[STATE].jsxAttrValueToken = true; + } + return result; } - 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) { + /** + * Performs last-minute Esprima-specific compatibility checks and fixes. + * @param {acorn.Node} result The node to check. + * @returns {EsprimaNode} 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") { + const esprimaResult = /** @type {EsprimaNode} */ (result); - // save template element references to fix start/end later - this[STATE].templateElements.push(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") { - if (result.type.includes("Function") && !result.generator) { - result.generator = false; - } + // save template element references to fix start/end later + this[STATE].templateElements.push(result); + } - return result; - } + if (result.type.includes("Function") && !esprimaResult.generator) { + esprimaResult.generator = false; + } + + return esprimaResult; + } + }; }; }; diff --git a/lib/options.js b/lib/options.js index 87739699..20ab23b8 100644 --- a/lib/options.js +++ b/lib/options.js @@ -3,6 +3,38 @@ * @author Kai Cataldo */ +// ---------------------------------------------------------------------------- +// Local type imports +// ---------------------------------------------------------------------------- +/** + * @local + * @typedef {import('../espree').ParserOptions} ParserOptions + */ + +// ---------------------------------------------------------------------------- +// Local types +// ---------------------------------------------------------------------------- +/** + * @local + * @typedef {{ + * ecmaVersion: 10 | 9 | 8 | 7 | 6 | 5 | 3 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | "latest", + * sourceType: "script"|"module", + * range?: boolean, + * loc?: boolean, + * allowReserved: boolean | "never", + * ecmaFeatures?: { + * jsx?: boolean, + * globalReturn?: boolean, + * impliedStrict?: boolean + * }, + * ranges: boolean, + * locations: boolean, + * allowReturnOutsideFunction: boolean, + * tokens?: boolean | null, + * comment?: boolean + * }} NormalizedParserOptions + */ + //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -38,7 +70,7 @@ export function getSupportedEcmaVersions() { /** * Normalize ECMAScript version from the initial config - * @param {(number|"latest")} ecmaVersion ECMAScript version from the initial config + * @param {number|"latest"} ecmaVersion ECMAScript version from the initial config * @throws {Error} throws an error if the ecmaVersion is invalid. * @returns {number} normalized ECMAScript version */ @@ -65,9 +97,9 @@ function normalizeEcmaVersion(ecmaVersion = 5) { /** * Normalize sourceType from the initial config - * @param {string} sourceType to normalize + * @param {"script"|"module"|"commonjs"} sourceType to normalize * @throws {Error} throw an error if sourceType is invalid - * @returns {string} normalized sourceType + * @returns {"script"|"module"} normalized sourceType */ function normalizeSourceType(sourceType = "script") { if (sourceType === "script" || sourceType === "module") { @@ -83,12 +115,14 @@ function normalizeSourceType(sourceType = "script") { /** * Normalize parserOptions - * @param {Object} options the parser options to normalize + * @param {ParserOptions} options the parser options to normalize * @throws {Error} throw an error if found invalid option. - * @returns {Object} normalized options + * @returns {NormalizedParserOptions} normalized options */ export function normalizeOptions(options) { const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); + + /** @type {"script"|"module"} */ const sourceType = normalizeSourceType(options.sourceType); const ranges = options.range === true; const locations = options.loc === true; @@ -98,6 +132,8 @@ export function normalizeOptions(options) { // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed throw new Error("`allowReserved` is only supported when ecmaVersion is 3"); } + + // Note: value in Acorn can also be "never" but we throw in such a case if (typeof options.allowReserved !== "undefined" && typeof options.allowReserved !== "boolean") { throw new Error("`allowReserved`, when present, must be `true` or `false`"); } diff --git a/lib/token-translator.js b/lib/token-translator.js index 9aa5e22e..a88f5e4f 100644 --- a/lib/token-translator.js +++ b/lib/token-translator.js @@ -4,6 +4,60 @@ */ /* eslint no-underscore-dangle: 0 */ +// ---------------------------------------------------------------------------- +// Local type imports +// ---------------------------------------------------------------------------- +/** + * @local + * @typedef {import('acorn')} acorn + * @typedef {import('../lib/espree').EnhancedTokTypes} EnhancedTokTypes + */ + +// ---------------------------------------------------------------------------- +// Local types +// ---------------------------------------------------------------------------- +/** + * Based on the `acorn.Token` class, but without a fixed `type` (since we need + * it to be a string). Avoiding `type` lets us make one extending interface + * more strict and another more lax. + * + * We could make `value` more strict to `string` even though the original is + * `any`. + * + * `start` and `end` are required in `acorn.Token` + * + * `loc` and `range` are from `acorn.Token` + * + * Adds `regex`. + * @local + * + * @typedef {{ + * value: any; + * start?: number; + * end?: number; + * loc?: acorn.SourceLocation; + * range?: [number, number]; + * regex?: {flags: string, pattern: string}; + * }} BaseEsprimaToken + * + * @typedef {{ + * type: string; + * } & BaseEsprimaToken} EsprimaToken + * + * @typedef {{ + * type: string | acorn.TokenType; + * } & BaseEsprimaToken} EsprimaTokenFlexible + * + * @typedef {{ + * jsxAttrValueToken: boolean; + * ecmaVersion: acorn.ecmaVersion; + * }} ExtraNoTokens + * + * @typedef {{ + * tokens: EsprimaTokenFlexible[] + * } & ExtraNoTokens} Extra + */ + //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ @@ -34,7 +88,7 @@ const Token = { /** * Converts part of a template into an Esprima token. - * @param {AcornToken[]} tokens The Acorn tokens representing the template. + * @param {(acorn.Token)[]} tokens The Acorn tokens representing the template. * @param {string} code The source code. * @returns {EsprimaToken} The Esprima equivalent of the template token. * @private @@ -43,19 +97,20 @@ function convertTemplatePart(tokens, code) { const firstToken = tokens[0], lastTemplateToken = tokens[tokens.length - 1]; + /** @type {EsprimaToken} */ const token = { type: Token.Template, value: code.slice(firstToken.start, lastTemplateToken.end) }; - if (firstToken.loc) { + if (firstToken.loc && lastTemplateToken.loc) { token.loc = { start: firstToken.loc.start, end: lastTemplateToken.loc.end }; } - if (firstToken.range) { + if (firstToken.range && lastTemplateToken.range) { token.start = firstToken.range[0]; token.end = lastTemplateToken.range[1]; token.range = [token.start, token.end]; @@ -66,7 +121,7 @@ function convertTemplatePart(tokens, code) { /** * Contains logic to translate Acorn tokens into Esprima tokens. - * @param {Object} acornTokTypes The Acorn token types. + * @param {EnhancedTokTypes} 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 @@ -77,6 +132,7 @@ function TokenTranslator(acornTokTypes, code) { this._acornTokTypes = acornTokTypes; // token buffer for templates + /** @type {(acorn.Token)[]} */ this._tokens = []; // track the last curly brace @@ -94,29 +150,36 @@ TokenTranslator.prototype = { * 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. + * @param {acorn.Token} token The Acorn token to translate. + * @param {ExtraNoTokens} extra Espree extra object. * @returns {EsprimaToken} The Esprima version of the token. */ translate(token, extra) { const type = token.type, - tt = this._acornTokTypes; + tt = this._acornTokTypes, + + // We use an unknown type because `acorn.Token` is a class whose + // `type` property we cannot override to our desired `string`; + // this also allows us to define a stricter `EsprimaToken` with + // a string-only `type` property + unknownType = /** @type {unknown} */ (token), + newToken = /** @type {EsprimaToken} */ (unknownType); if (type === tt.name) { - token.type = Token.Identifier; + newToken.type = Token.Identifier; // TODO: See if this is an Acorn bug if (token.value === "static") { - token.type = Token.Keyword; + newToken.type = Token.Keyword; } if (extra.ecmaVersion > 5 && (token.value === "yield" || token.value === "let")) { - token.type = Token.Keyword; + newToken.type = Token.Keyword; } } else if (type === tt.privateId) { - token.type = Token.PrivateIdentifier; + newToken.type = Token.PrivateIdentifier; } else if (type === tt.semi || type === tt.comma || type === tt.parenL || type === tt.parenR || @@ -131,51 +194,51 @@ TokenTranslator.prototype = { (type.binop && !type.keyword) || type.isAssign) { - token.type = Token.Punctuator; - token.value = this._code.slice(token.start, token.end); + newToken.type = Token.Punctuator; + newToken.value = this._code.slice(token.start, token.end); } else if (type === tt.jsxName) { - token.type = Token.JSXIdentifier; + newToken.type = Token.JSXIdentifier; } else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) { - token.type = Token.JSXText; + newToken.type = Token.JSXText; } else if (type.keyword) { if (type.keyword === "true" || type.keyword === "false") { - token.type = Token.Boolean; + newToken.type = Token.Boolean; } else if (type.keyword === "null") { - token.type = Token.Null; + newToken.type = Token.Null; } else { - token.type = Token.Keyword; + newToken.type = Token.Keyword; } } else if (type === tt.num) { - token.type = Token.Numeric; - token.value = this._code.slice(token.start, token.end); + newToken.type = Token.Numeric; + newToken.value = this._code.slice(token.start, token.end); } else if (type === tt.string) { if (extra.jsxAttrValueToken) { extra.jsxAttrValueToken = false; - token.type = Token.JSXText; + newToken.type = Token.JSXText; } else { - token.type = Token.String; + newToken.type = Token.String; } - token.value = this._code.slice(token.start, token.end); + newToken.value = this._code.slice(token.start, token.end); } else if (type === tt.regexp) { - token.type = Token.RegularExpression; + newToken.type = Token.RegularExpression; const value = token.value; - token.regex = { + newToken.regex = { flags: value.flags, pattern: value.pattern }; - token.value = `/${value.pattern}/${value.flags}`; + newToken.value = `/${value.pattern}/${value.flags}`; } - return token; + return newToken; }, /** * Function to call during Acorn's onToken handler. - * @param {AcornToken} token The Acorn token. - * @param {Object} extra The Espree extra object. + * @param {acorn.Token} token The Acorn token. + * @param {Extra} extra The Espree extra object. * @returns {void} */ onToken(token, extra) { diff --git a/package.json b/package.json index c4257e32..75a866c8 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "homepage": "https://github.com/eslint/espree", "main": "dist/espree.cjs", "type": "module", + "types": "dist/espree.d.ts", "exports": { ".": [ { @@ -20,6 +21,7 @@ "files": [ "lib", "dist/espree.cjs", + "dist/espree.d.ts", "espree.js" ], "engines": { @@ -36,21 +38,28 @@ "eslint-visitor-keys": "^3.3.0" }, "devDependencies": { + "@es-joy/escodegen": "^3.5.1", + "@es-joy/jsdoc-eslint-parser": "^0.16.0", + "@es-joy/jsdoccomment": "^0.29.0", "@rollup/plugin-commonjs": "^17.1.0", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^11.2.0", - "c8": "^7.11.0", + "ast-types": "^0.14.2", + "c8": "^7.11.2", "chai": "^4.3.6", - "eslint": "^8.13.0", + "eslint": "^8.14.0", "eslint-config-eslint": "^7.0.0", - "eslint-plugin-jsdoc": "^39.2.4", + "eslint-plugin-jsdoc": "^39.2.9", "eslint-plugin-node": "^11.1.0", "eslint-release": "^3.2.0", "esprima-fb": "^8001.2001.0-dev-harmony-fb", + "esquery": "^1.4.0", + "globby": "^13.1.1", "mocha": "^9.2.2", "npm-run-all": "^4.1.5", "rollup": "^2.41.2", - "shelljs": "^0.3.0" + "shelljs": "^0.3.0", + "typescript": "^4.6.3" }, "keywords": [ "ast", @@ -65,6 +74,7 @@ "unit:esm": "c8 mocha --color --reporter progress --timeout 30000 'tests/lib/**/*.js'", "unit:cjs": "mocha --color --reporter progress --timeout 30000 tests/lib/commonjs.cjs", "test": "npm-run-all -p unit lint", + "tsc": "tsc", "lint": "eslint .", "fixlint": "npm run lint -- --fix", "build": "rollup -c rollup.config.js", @@ -72,6 +82,7 @@ "pretest": "npm run build", "prepublishOnly": "npm run update-version && npm run build", "sync-docs": "node sync-docs.js", + "js-for-ts": "node tools/intermediate-js-for-ts.js", "generate-release": "eslint-generate-release", "generate-alpharelease": "eslint-generate-prerelease alpha", "generate-betarelease": "eslint-generate-prerelease beta", diff --git a/tests/lib/espree.js b/tests/lib/espree.js new file mode 100644 index 00000000..15f12ce8 --- /dev/null +++ b/tests/lib/espree.js @@ -0,0 +1,16 @@ +import assert from "assert"; +import * as acorn from "acorn"; +import espree from "../../lib/espree.js"; + +describe("espree", () => { + it("Throws upon `jsx_readString` when not using JSX", () => { + const espreeParserFactory = espree(); + const AcornParser = acorn.Parser; + const EspreeParser = espreeParserFactory(/** @type {EspreeParser} */ (AcornParser)); + const parser = new EspreeParser({}, ""); + + assert.throws(() => { + parser.jsx_readString(); + }); + }); +}); diff --git a/tools/intermediate-js-for-ts.js b/tools/intermediate-js-for-ts.js new file mode 100644 index 00000000..595e90a3 --- /dev/null +++ b/tools/intermediate-js-for-ts.js @@ -0,0 +1,295 @@ +import { readFile, writeFile, mkdir } from "fs/promises"; +import { join, dirname } from "path"; + +import esquery from "esquery"; +import { globby } from "globby"; + +import * as jsdocEslintParser from "@es-joy/jsdoc-eslint-parser/typescript.js"; +import { + estreeToString, jsdocVisitorKeys, jsdocTypeVisitorKeys +} from "@es-joy/jsdoccomment"; + +import * as escodegen from "@es-joy/escodegen"; + +import { builders } from "ast-types"; + +const { + _preprocess_include: include, + _preprocess_exclude: ignoreFiles +} = JSON.parse(await readFile("tsconfig.json")); + +const files = await globby(include, { + ignoreFiles +}); + +await Promise.all(files.map(async file => { + const contents = await readFile(file, "utf8"); + + const tree = jsdocEslintParser.parseForESLint(contents, { + mode: "typescript", + throwOnTypeParsingErrors: true + }); + + const { visitorKeys, ast } = tree; + + const typedefSiblingsOfLocal = "JsdocTag[tag=local] ~ JsdocTag[tag=typedef]"; + const typedefs = esquery.query(ast, typedefSiblingsOfLocal, { + visitorKeys + }); + + // Replace type shorthands with our typedef long form + typedefs.forEach(({ name, parsedType }) => { + const nameNodes = esquery.query(ast, `JsdocTypeName[value=${name}]`, { + visitorKeys + }); + + // Rather than go to the trouble of splicing from a child whose index + // we have to work to find, just copy the keys to the existing object + nameNodes.forEach(nameNode => { + Object.keys(nameNode).forEach(prop => { + if (prop === "parent") { + return; + } + delete nameNode[prop]; + }); + Object.entries(parsedType).forEach(([prop, val]) => { + if (prop === "parent") { + return; + } + nameNode[prop] = val; + }); + }); + }); + + // Remove local typedefs from AST + for (const typedef of typedefs) { + const { tags } = typedef.parent; + const idx = tags.indexOf(typedef); + + tags.splice(idx, 1); + } + + // Now remove the empty locals + const emptyLocals = esquery.query(ast, "JsdocBlock:has(JsdocTag:not([tag!=local]))", { + visitorKeys + }); + + for (const emptyLocal of emptyLocals) { + const idx = ast.jsdocBlocks.indexOf(emptyLocal); + + ast.jsdocBlocks.splice(idx, 1); + } + + const exportBlocks = esquery.query(ast, "JsdocBlock:has(JsdocTag[tag=export])", { + visitorKeys + }); + + /** + * Build a JSDoc type cast. + * @param {Object} extraInfo Extra type info + * @returns {JsdocBlock} The JsdocBlock object + */ + function typeCast(extraInfo) { + return { + type: "JsdocBlock", + initial: "", + delimiter: "/**", + postDelimiter: "", + terminal: "*/", + descriptionLines: [], + tags: [ + { + type: "JsdocTag", + tag: "type", + postTag: " ", + descriptionLines: [], + ...extraInfo, + postType: "", + initial: "", + delimiter: "", + postDelimiter: " " + } + ] + }; + } + + for (const exportBlock of exportBlocks) { + switch (exportBlock.parent.type) { + case "ReturnStatement": { + const parent = exportBlock.parent.argument; + + switch (parent.type) { + case "ClassExpression": { + const classBody = parent.body.body.map(({ + type, kind, key, value, computed, + static: statik + }) => { + if (computed) { + return null; + } + const { jsdoc } = value.parent; + + switch (type) { + case "MethodDefinition": { + const returns = jsdoc.tags.find( + tag => tag.tag === "returns" + ); + const objectExpressionOrOther = !returns || returns.rawType === "void" || + kind === "constructor" + ? builders.identifier("undefined") + : builders.objectExpression([]); + + if (kind !== "constructor") { + objectExpressionOrOther.jsdoc = typeCast({ + parsedType: returns.parsedType + }); + } + + const paramNames = jsdoc.tags.filter( + tag => tag.tag === "param" + ).map( + // eslint-disable-next-line arrow-body-style + tag => { + const identifier = builders.identifier(tag.name); + + // Hack in some needed type casts + if (tag.name === "opts") { + identifier.jsdoc = typeCast({ + typeLines: [ + { + type: "JsdocTypeLine", + initial: "", + delimiter: "", + postDelimiter: "", + rawType: "acorn.Options" + } + ], + rawType: "acorn.Options" + }); + } else if (tag.name === "code") { + identifier.jsdoc = typeCast({ + typeLines: [ + { + type: "JsdocTypeLine", + initial: "", + delimiter: "", + postDelimiter: "", + rawType: "string" + } + ], + rawType: "string" + }); + } + return identifier; + } + ); + const functionExpression = builders.functionExpression( + null, + + paramNames, + + builders.blockStatement([ + kind === "constructor" + ? builders.expressionStatement( + builders.callExpression( + builders.super(), + paramNames + ) + ) + : builders.returnStatement( + objectExpressionOrOther + ) + ]) + ); + + const methodDefinition = builders.methodDefinition( + kind, + key, + functionExpression, + statik + ); + + methodDefinition.jsdoc = jsdoc; + + return methodDefinition; + } default: + throw new Error(`Unknown ${type}`); + } + }).filter(Boolean); + + let superClass = parent.superClass.name; + + // Since we're not tracking types as in using a + // proper TS transformer (like `ttypescript`?), + // we hack this one for now + if (parent.superClass.name === "Parser") { + + // Make import available + ast.body.unshift( + builders.importDeclaration( + [ + builders.importNamespaceSpecifier( + builders.identifier("acorn") + ) + ], + builders.literal("acorn"), + "value" + ) + ); + superClass = "acorn.Parser"; + } + + const classDeclaration = builders.classDeclaration( + builders.identifier(parent.id.name), + builders.classBody(classBody), + + builders.identifier(superClass) + ); + + ast.body.push(builders.exportNamedDeclaration( + classDeclaration + )); + + break; + } default: + throw new Error(`Unsupported type ${parent.type}`); + } + + break; + } default: + throw new Error("Currently unsupported AST export structure"); + } + } + + const generated = escodegen.generate(ast, { + sourceContent: contents, + codegenFactory() { + const { CodeGenerator } = escodegen; + + Object.keys(jsdocVisitorKeys).forEach(method => { + CodeGenerator.Statement[method] = + CodeGenerator.prototype[method] = node => + + // We have to add our own line break, as `jsdoccomment` (nor + // `comment-parser`) keep track of trailing content + (( + node.endLine ? "\n" : "" + ) + estreeToString(node) + + (node.endLine ? `\n${node.initial}` : " ")); + }); + + Object.keys(jsdocTypeVisitorKeys).forEach(method => { + CodeGenerator.Statement[method] = + CodeGenerator.prototype[method] = node => + estreeToString(node); + }); + + return new CodeGenerator(); + } + }); + + const targetFile = join("tmp", file); + + await mkdir(dirname(targetFile), { recursive: true }); + await writeFile(targetFile, generated); +})); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..fd102ce3 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "lib": ["es2020"], + "moduleResolution": "node", + "module": "esnext", + "allowJs": true, + "checkJs": true, + "noEmit": false, + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "strict": true, + "target": "es5", + "outDir": "dist" + }, + "_preprocess_include": ["espree.js", "lib/**/*.js"], + "_preprocess_exclude": ["node_modules"], + "include": ["tmp/espree.js", "tmp/lib/**/*.js"], + "exclude": ["node_modules"] +} From fbe13b311765efdd09f393f507e5e9dec83a3689 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 26 Apr 2022 19:47:57 +0800 Subject: [PATCH 02/24] refactor: fix type Co-authored-by: Milos Djermanovic --- espree.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/espree.js b/espree.js index c888a456..7c3e17fb 100644 --- a/espree.js +++ b/espree.js @@ -73,7 +73,7 @@ * * `comment` is not in `acorn.Options` and doesn't err without it, but is used * @typedef {{ - * allowReserved?: boolean | "never", + * allowReserved?: boolean, * ranges?: boolean, * locations?: boolean, * allowReturnOutsideFunction?: boolean, From 403c9522d4ba084f6ca8374933ed3fd540187fb1 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 26 Apr 2022 19:49:53 +0800 Subject: [PATCH 03/24] refactor: drop undesired types --- espree.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/espree.js b/espree.js index 7c3e17fb..da4e3953 100644 --- a/espree.js +++ b/espree.js @@ -74,14 +74,6 @@ * `comment` is not in `acorn.Options` and doesn't err without it, but is used * @typedef {{ * allowReserved?: boolean, - * ranges?: boolean, - * locations?: boolean, - * allowReturnOutsideFunction?: boolean, - * onToken?: ((token: acorn.Token) => any) | acorn.Token[], - * onComment?: (( - * isBlock: boolean, text: string, start: number, end: number, startLoc?: acorn.Position, - * endLoc?: acorn.Position - * ) => void) | acorn.Comment[], * ecmaVersion?: acorn.ecmaVersion, * sourceType?: "script"|"module"|"commonjs", * ecmaFeatures?: { @@ -93,7 +85,7 @@ * loc?: boolean, * tokens?: boolean | null, * comment?: boolean, - * } & jsx.Options} ParserOptions + * }} ParserOptions */ // ---------------------------------------------------------------------------- From 5b86bcc0f764db0ca8612ac6a035b0d0bef26cc4 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 28 Apr 2022 20:00:35 +0800 Subject: [PATCH 04/24] refactor: simplify since method is not returning a value --- lib/espree.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/espree.js b/lib/espree.js index 7e92d139..4db1ce29 100644 --- a/lib/espree.js +++ b/lib/espree.js @@ -492,12 +492,11 @@ export default () => { if (typeof super.jsx_readString === "undefined") { throw new Error("Not a JSX parser"); } - const result = super.jsx_readString(quote); + super.jsx_readString(quote); if (this.type === tokTypes.string) { this[STATE].jsxAttrValueToken = true; } - return result; } /** From 4309e52d17248921234b1e5cffb5885c68bd33dd Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 28 Apr 2022 21:42:13 +0800 Subject: [PATCH 05/24] refactor: move out tool to own repo and utilize --- package.json | 3 +- tools/intermediate-js-for-ts.js | 295 -------------------------------- tools/js-for-ts.js | 62 +++++++ 3 files changed, 64 insertions(+), 296 deletions(-) delete mode 100644 tools/intermediate-js-for-ts.js create mode 100644 tools/js-for-ts.js diff --git a/package.json b/package.json index 75a866c8..ca63c4ff 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ }, "devDependencies": { "@es-joy/escodegen": "^3.5.1", + "@es-joy/js2ts-assistant": "^0.2.0", "@es-joy/jsdoc-eslint-parser": "^0.16.0", "@es-joy/jsdoccomment": "^0.29.0", "@rollup/plugin-commonjs": "^17.1.0", @@ -82,7 +83,7 @@ "pretest": "npm run build", "prepublishOnly": "npm run update-version && npm run build", "sync-docs": "node sync-docs.js", - "js-for-ts": "node tools/intermediate-js-for-ts.js", + "js-for-ts": "node tools/js-for-ts.js", "generate-release": "eslint-generate-release", "generate-alpharelease": "eslint-generate-prerelease alpha", "generate-betarelease": "eslint-generate-prerelease beta", diff --git a/tools/intermediate-js-for-ts.js b/tools/intermediate-js-for-ts.js deleted file mode 100644 index 595e90a3..00000000 --- a/tools/intermediate-js-for-ts.js +++ /dev/null @@ -1,295 +0,0 @@ -import { readFile, writeFile, mkdir } from "fs/promises"; -import { join, dirname } from "path"; - -import esquery from "esquery"; -import { globby } from "globby"; - -import * as jsdocEslintParser from "@es-joy/jsdoc-eslint-parser/typescript.js"; -import { - estreeToString, jsdocVisitorKeys, jsdocTypeVisitorKeys -} from "@es-joy/jsdoccomment"; - -import * as escodegen from "@es-joy/escodegen"; - -import { builders } from "ast-types"; - -const { - _preprocess_include: include, - _preprocess_exclude: ignoreFiles -} = JSON.parse(await readFile("tsconfig.json")); - -const files = await globby(include, { - ignoreFiles -}); - -await Promise.all(files.map(async file => { - const contents = await readFile(file, "utf8"); - - const tree = jsdocEslintParser.parseForESLint(contents, { - mode: "typescript", - throwOnTypeParsingErrors: true - }); - - const { visitorKeys, ast } = tree; - - const typedefSiblingsOfLocal = "JsdocTag[tag=local] ~ JsdocTag[tag=typedef]"; - const typedefs = esquery.query(ast, typedefSiblingsOfLocal, { - visitorKeys - }); - - // Replace type shorthands with our typedef long form - typedefs.forEach(({ name, parsedType }) => { - const nameNodes = esquery.query(ast, `JsdocTypeName[value=${name}]`, { - visitorKeys - }); - - // Rather than go to the trouble of splicing from a child whose index - // we have to work to find, just copy the keys to the existing object - nameNodes.forEach(nameNode => { - Object.keys(nameNode).forEach(prop => { - if (prop === "parent") { - return; - } - delete nameNode[prop]; - }); - Object.entries(parsedType).forEach(([prop, val]) => { - if (prop === "parent") { - return; - } - nameNode[prop] = val; - }); - }); - }); - - // Remove local typedefs from AST - for (const typedef of typedefs) { - const { tags } = typedef.parent; - const idx = tags.indexOf(typedef); - - tags.splice(idx, 1); - } - - // Now remove the empty locals - const emptyLocals = esquery.query(ast, "JsdocBlock:has(JsdocTag:not([tag!=local]))", { - visitorKeys - }); - - for (const emptyLocal of emptyLocals) { - const idx = ast.jsdocBlocks.indexOf(emptyLocal); - - ast.jsdocBlocks.splice(idx, 1); - } - - const exportBlocks = esquery.query(ast, "JsdocBlock:has(JsdocTag[tag=export])", { - visitorKeys - }); - - /** - * Build a JSDoc type cast. - * @param {Object} extraInfo Extra type info - * @returns {JsdocBlock} The JsdocBlock object - */ - function typeCast(extraInfo) { - return { - type: "JsdocBlock", - initial: "", - delimiter: "/**", - postDelimiter: "", - terminal: "*/", - descriptionLines: [], - tags: [ - { - type: "JsdocTag", - tag: "type", - postTag: " ", - descriptionLines: [], - ...extraInfo, - postType: "", - initial: "", - delimiter: "", - postDelimiter: " " - } - ] - }; - } - - for (const exportBlock of exportBlocks) { - switch (exportBlock.parent.type) { - case "ReturnStatement": { - const parent = exportBlock.parent.argument; - - switch (parent.type) { - case "ClassExpression": { - const classBody = parent.body.body.map(({ - type, kind, key, value, computed, - static: statik - }) => { - if (computed) { - return null; - } - const { jsdoc } = value.parent; - - switch (type) { - case "MethodDefinition": { - const returns = jsdoc.tags.find( - tag => tag.tag === "returns" - ); - const objectExpressionOrOther = !returns || returns.rawType === "void" || - kind === "constructor" - ? builders.identifier("undefined") - : builders.objectExpression([]); - - if (kind !== "constructor") { - objectExpressionOrOther.jsdoc = typeCast({ - parsedType: returns.parsedType - }); - } - - const paramNames = jsdoc.tags.filter( - tag => tag.tag === "param" - ).map( - // eslint-disable-next-line arrow-body-style - tag => { - const identifier = builders.identifier(tag.name); - - // Hack in some needed type casts - if (tag.name === "opts") { - identifier.jsdoc = typeCast({ - typeLines: [ - { - type: "JsdocTypeLine", - initial: "", - delimiter: "", - postDelimiter: "", - rawType: "acorn.Options" - } - ], - rawType: "acorn.Options" - }); - } else if (tag.name === "code") { - identifier.jsdoc = typeCast({ - typeLines: [ - { - type: "JsdocTypeLine", - initial: "", - delimiter: "", - postDelimiter: "", - rawType: "string" - } - ], - rawType: "string" - }); - } - return identifier; - } - ); - const functionExpression = builders.functionExpression( - null, - - paramNames, - - builders.blockStatement([ - kind === "constructor" - ? builders.expressionStatement( - builders.callExpression( - builders.super(), - paramNames - ) - ) - : builders.returnStatement( - objectExpressionOrOther - ) - ]) - ); - - const methodDefinition = builders.methodDefinition( - kind, - key, - functionExpression, - statik - ); - - methodDefinition.jsdoc = jsdoc; - - return methodDefinition; - } default: - throw new Error(`Unknown ${type}`); - } - }).filter(Boolean); - - let superClass = parent.superClass.name; - - // Since we're not tracking types as in using a - // proper TS transformer (like `ttypescript`?), - // we hack this one for now - if (parent.superClass.name === "Parser") { - - // Make import available - ast.body.unshift( - builders.importDeclaration( - [ - builders.importNamespaceSpecifier( - builders.identifier("acorn") - ) - ], - builders.literal("acorn"), - "value" - ) - ); - superClass = "acorn.Parser"; - } - - const classDeclaration = builders.classDeclaration( - builders.identifier(parent.id.name), - builders.classBody(classBody), - - builders.identifier(superClass) - ); - - ast.body.push(builders.exportNamedDeclaration( - classDeclaration - )); - - break; - } default: - throw new Error(`Unsupported type ${parent.type}`); - } - - break; - } default: - throw new Error("Currently unsupported AST export structure"); - } - } - - const generated = escodegen.generate(ast, { - sourceContent: contents, - codegenFactory() { - const { CodeGenerator } = escodegen; - - Object.keys(jsdocVisitorKeys).forEach(method => { - CodeGenerator.Statement[method] = - CodeGenerator.prototype[method] = node => - - // We have to add our own line break, as `jsdoccomment` (nor - // `comment-parser`) keep track of trailing content - (( - node.endLine ? "\n" : "" - ) + estreeToString(node) + - (node.endLine ? `\n${node.initial}` : " ")); - }); - - Object.keys(jsdocTypeVisitorKeys).forEach(method => { - CodeGenerator.Statement[method] = - CodeGenerator.prototype[method] = node => - estreeToString(node); - }); - - return new CodeGenerator(); - } - }); - - const targetFile = join("tmp", file); - - await mkdir(dirname(targetFile), { recursive: true }); - await writeFile(targetFile, generated); -})); diff --git a/tools/js-for-ts.js b/tools/js-for-ts.js new file mode 100644 index 00000000..ba30fdae --- /dev/null +++ b/tools/js-for-ts.js @@ -0,0 +1,62 @@ +import js2tsAssistant from "@es-joy/js2ts-assistant"; + +await js2tsAssistant({ + customClassHandling({ + ast, builders, superClassName + }) { + + // Since we're not tracking types as in using a + // proper TS transformer (like `ttypescript`?), + // we hack this one for now + if (superClassName === "Parser") { + + // Make import available + ast.body.unshift( + builders.importDeclaration( + [ + builders.importNamespaceSpecifier( + builders.identifier("acorn") + ) + ], + builders.literal("acorn"), + "value" + ) + ); + return "acorn.Parser"; + } + return null; + }, + customParamHandling({ + tag, identifier, typeCast + }) { + + // Hack in some needed type casts + if (tag.name === "opts") { + identifier.jsdoc = typeCast({ + typeLines: [ + { + type: "JsdocTypeLine", + initial: "", + delimiter: "", + postDelimiter: "", + rawType: "acorn.Options" + } + ], + rawType: "acorn.Options" + }); + } else if (tag.name === "code") { + identifier.jsdoc = typeCast({ + typeLines: [ + { + type: "JsdocTypeLine", + initial: "", + delimiter: "", + postDelimiter: "", + rawType: "string" + } + ], + rawType: "string" + }); + } + } +}); From deae6c6f0a4d44151bb23ed4d1dd903a18305afc Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 21 Apr 2022 10:07:00 +0800 Subject: [PATCH 06/24] refactor: export to single declaration file Also: - refactor: Can't use `@constructor` jsdoc in this situation, so refactor to class --- lib/token-translator.js | 42 ++++++++++++++++++++--------------------- tsconfig.json | 2 +- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/lib/token-translator.js b/lib/token-translator.js index a88f5e4f..ec0747f8 100644 --- a/lib/token-translator.js +++ b/lib/token-translator.js @@ -119,32 +119,30 @@ function convertTemplatePart(tokens, code) { return token; } -/** - * Contains logic to translate Acorn tokens into Esprima tokens. - * @param {EnhancedTokTypes} 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) { +class TokenTranslator { - // token types - this._acornTokTypes = acornTokTypes; + /** + * Contains logic to translate Acorn tokens into Esprima tokens. + * @param {EnhancedTokTypes} 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(acornTokTypes, code) { - // token buffer for templates - /** @type {(acorn.Token)[]} */ - this._tokens = []; + // token types + this._acornTokTypes = acornTokTypes; - // track the last curly brace - this._curlyBrace = null; + // token buffer for templates + /** @type {(acorn.Token)[]} */ + this._tokens = []; - // the source code - this._code = code; + // 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 @@ -233,7 +231,7 @@ TokenTranslator.prototype = { } return newToken; - }, + } /** * Function to call during Acorn's onToken handler. @@ -319,7 +317,7 @@ TokenTranslator.prototype = { tokens.push(this.translate(token, extra)); } -}; +} //------------------------------------------------------------------------------ // Public diff --git a/tsconfig.json b/tsconfig.json index fd102ce3..4b806d15 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "emitDeclarationOnly": true, "strict": true, "target": "es5", - "outDir": "dist" + "outFile": "dist/espree.d.ts" }, "_preprocess_include": ["espree.js", "lib/**/*.js"], "_preprocess_exclude": ["node_modules"], From 0f1e2a17226885d2fc58fbb84ad0599d5de774c0 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Wed, 4 May 2022 10:28:05 +0800 Subject: [PATCH 07/24] docs: add file header Also: - test: clarify test --- tests/lib/espree.js | 15 ++++++++++++++- tools/js-for-ts.js | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/lib/espree.js b/tests/lib/espree.js index 15f12ce8..487e8761 100644 --- a/tests/lib/espree.js +++ b/tests/lib/espree.js @@ -1,9 +1,22 @@ +/** + * @fileoverview Tests for EspreeParser. + * @author Brett Zamir + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + import assert from "assert"; import * as acorn from "acorn"; import espree from "../../lib/espree.js"; +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + describe("espree", () => { - it("Throws upon `jsx_readString` when not using JSX", () => { + it("Throws upon `jsx_readString` call when not using JSX", () => { const espreeParserFactory = espree(); const AcornParser = acorn.Parser; const EspreeParser = espreeParserFactory(/** @type {EspreeParser} */ (AcornParser)); diff --git a/tools/js-for-ts.js b/tools/js-for-ts.js index ba30fdae..02ade3b2 100644 --- a/tools/js-for-ts.js +++ b/tools/js-for-ts.js @@ -1,5 +1,20 @@ +/** + * @fileoverview Tool to prepare JavaScript (+JSDoc) for TypeScript, inlining + * `@local`-marked `@typedef`'s, and building a faux class for `@export`-marked + * classes so the type can be exported out of a given file. + * @author Brett Zamir + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + import js2tsAssistant from "@es-joy/js2ts-assistant"; +// ---------------------------------------------------------------------------- +// Modify output +// ---------------------------------------------------------------------------- + await js2tsAssistant({ customClassHandling({ ast, builders, superClassName From 2376f8ad433913f5ae7fe62d4cb3c04731c7b27d Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Wed, 4 May 2022 10:37:30 +0800 Subject: [PATCH 08/24] refactor: convert number to `int` type --- lib/espree.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/espree.js b/lib/espree.js index 4db1ce29..57cb1c80 100644 --- a/lib/espree.js +++ b/lib/espree.js @@ -461,10 +461,10 @@ export default () => { this.pos = pos; if (this.options.locations) { - while (this.pos < /** @type {number} */ (this.lineStart)) { + while (this.pos < /** @type {int} */ (this.lineStart)) { - /** @type {number} */ - this.lineStart = this.input.lastIndexOf("\n", /** @type {number} */ (this.lineStart) - 2) + 1; + /** @type {int} */ + this.lineStart = this.input.lastIndexOf("\n", /** @type {int} */ (this.lineStart) - 2) + 1; --this.curLine; } } From 41e0dd062c1665dd6e7ec2526ecbd7ca3479c827 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Wed, 4 May 2022 10:37:30 +0800 Subject: [PATCH 09/24] refactor: revert change to use `outFile`; cannot be used with ESM --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 4b806d15..fd102ce3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "emitDeclarationOnly": true, "strict": true, "target": "es5", - "outFile": "dist/espree.d.ts" + "outDir": "dist" }, "_preprocess_include": ["espree.js", "lib/**/*.js"], "_preprocess_exclude": ["node_modules"], From 855af298f2ffe3a04993e600b05026ee1a2ea7b8 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 5 May 2022 11:16:15 +0800 Subject: [PATCH 10/24] refactor: move notes on types out of typedef blocks --- dist/espree.cjs | 1237 ++++++++++++++++++++++++++++ dist/espree.cjs.map | 1 + dist/espree.d.ts | 41 + dist/espree.d.ts.map | 1 + dist/lib/espree.d.ts | 75 ++ dist/lib/espree.d.ts.map | 1 + dist/lib/token-translator.d.ts.map | 1 + espree.js | 2 + lib/espree.js | 10 +- lib/token-translator.js | 2 + 10 files changed, 1368 insertions(+), 3 deletions(-) create mode 100644 dist/espree.cjs create mode 100644 dist/espree.cjs.map create mode 100644 dist/espree.d.ts create mode 100644 dist/espree.d.ts.map create mode 100644 dist/lib/espree.d.ts create mode 100644 dist/lib/espree.d.ts.map create mode 100644 dist/lib/token-translator.d.ts.map diff --git a/dist/espree.cjs b/dist/espree.cjs new file mode 100644 index 00000000..437d7bf4 --- /dev/null +++ b/dist/espree.cjs @@ -0,0 +1,1237 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var acorn = require('acorn'); +var jsx = require('acorn-jsx'); +var visitorKeys = require('eslint-visitor-keys'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); +} + +var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn); +var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx); +var visitorKeys__namespace = /*#__PURE__*/_interopNamespace(visitorKeys); + +/** + * @fileoverview Translates tokens between Acorn format and Esprima format. + * @author Nicholas C. Zakas + */ +/* eslint no-underscore-dangle: 0 */ + +// ---------------------------------------------------------------------------- +// Local type imports +// ---------------------------------------------------------------------------- +/** + * @local + * @typedef {import('acorn')} acorn + * @typedef {import('../lib/espree').EnhancedTokTypes} EnhancedTokTypes + */ + +// ---------------------------------------------------------------------------- +// Local types +// ---------------------------------------------------------------------------- +/** + * Based on the `acorn.Token` class, but without a fixed `type` (since we need + * it to be a string). Avoiding `type` lets us make one extending interface + * more strict and another more lax. + * + * We could make `value` more strict to `string` even though the original is + * `any`. + * + * `start` and `end` are required in `acorn.Token` + * + * `loc` and `range` are from `acorn.Token` + * + * Adds `regex`. + */ +/** + * @local + * + * @typedef {{ + * value: any; + * start?: number; + * end?: number; + * loc?: acorn.SourceLocation; + * range?: [number, number]; + * regex?: {flags: string, pattern: string}; + * }} BaseEsprimaToken + * + * @typedef {{ + * type: string; + * } & BaseEsprimaToken} EsprimaToken + * + * @typedef {{ + * type: string | acorn.TokenType; + * } & BaseEsprimaToken} EsprimaTokenFlexible + * + * @typedef {{ + * jsxAttrValueToken: boolean; + * ecmaVersion: acorn.ecmaVersion; + * }} ExtraNoTokens + * + * @typedef {{ + * tokens: EsprimaTokenFlexible[] + * } & ExtraNoTokens} Extra + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// none! + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + + +// Esprima Token Types +const Token = { + Boolean: "Boolean", + EOF: "", + Identifier: "Identifier", + PrivateIdentifier: "PrivateIdentifier", + 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 {(acorn.Token)[]} 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]; + + /** @type {EsprimaToken} */ + const token = { + type: Token.Template, + value: code.slice(firstToken.start, lastTemplateToken.end) + }; + + if (firstToken.loc && lastTemplateToken.loc) { + token.loc = { + start: firstToken.loc.start, + end: lastTemplateToken.loc.end + }; + } + + if (firstToken.range && lastTemplateToken.range) { + token.start = firstToken.range[0]; + token.end = lastTemplateToken.range[1]; + token.range = [token.start, token.end]; + } + + return token; +} + +class TokenTranslator { + + /** + * Contains logic to translate Acorn tokens into Esprima tokens. + * @param {EnhancedTokTypes} 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(acornTokTypes, code) { + + // token types + this._acornTokTypes = acornTokTypes; + + // token buffer for templates + /** @type {(acorn.Token)[]} */ + this._tokens = []; + + // track the last curly brace + this._curlyBrace = null; + + // the source code + this._code = code; + + } + + /** + * 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 {acorn.Token} token The Acorn token to translate. + * @param {ExtraNoTokens} extra Espree extra object. + * @returns {EsprimaToken} The Esprima version of the token. + */ + translate(token, extra) { + + const type = token.type, + tt = this._acornTokTypes, + + // We use an unknown type because `acorn.Token` is a class whose + // `type` property we cannot override to our desired `string`; + // this also allows us to define a stricter `EsprimaToken` with + // a string-only `type` property + unknownType = /** @type {unknown} */ (token), + newToken = /** @type {EsprimaToken} */ (unknownType); + + if (type === tt.name) { + newToken.type = Token.Identifier; + + // TODO: See if this is an Acorn bug + if (token.value === "static") { + newToken.type = Token.Keyword; + } + + if (extra.ecmaVersion > 5 && (token.value === "yield" || token.value === "let")) { + newToken.type = Token.Keyword; + } + + } else if (type === tt.privateId) { + newToken.type = Token.PrivateIdentifier; + + } 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 === tt.questionDot || + (type.binop && !type.keyword) || + type.isAssign) { + + newToken.type = Token.Punctuator; + newToken.value = this._code.slice(token.start, token.end); + } else if (type === tt.jsxName) { + newToken.type = Token.JSXIdentifier; + } else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) { + newToken.type = Token.JSXText; + } else if (type.keyword) { + if (type.keyword === "true" || type.keyword === "false") { + newToken.type = Token.Boolean; + } else if (type.keyword === "null") { + newToken.type = Token.Null; + } else { + newToken.type = Token.Keyword; + } + } else if (type === tt.num) { + newToken.type = Token.Numeric; + newToken.value = this._code.slice(token.start, token.end); + } else if (type === tt.string) { + + if (extra.jsxAttrValueToken) { + extra.jsxAttrValueToken = false; + newToken.type = Token.JSXText; + } else { + newToken.type = Token.String; + } + + newToken.value = this._code.slice(token.start, token.end); + } else if (type === tt.regexp) { + newToken.type = Token.RegularExpression; + const value = token.value; + + newToken.regex = { + flags: value.flags, + pattern: value.pattern + }; + newToken.value = `/${value.pattern}/${value.flags}`; + } + + return newToken; + } + + /** + * Function to call during Acorn's onToken handler. + * @param {acorn.Token} token The Acorn token. + * @param {Extra} 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)); + } +} + +/** + * @fileoverview A collection of methods for processing Espree's options. + * @author Kai Cataldo + */ + +// ---------------------------------------------------------------------------- +// Local type imports +// ---------------------------------------------------------------------------- +/** + * @local + * @typedef {import('../espree').ParserOptions} ParserOptions + */ + +// ---------------------------------------------------------------------------- +// Local types +// ---------------------------------------------------------------------------- +/** + * @local + * @typedef {{ + * ecmaVersion: 10 | 9 | 8 | 7 | 6 | 5 | 3 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | "latest", + * sourceType: "script"|"module", + * range?: boolean, + * loc?: boolean, + * allowReserved: boolean | "never", + * ecmaFeatures?: { + * jsx?: boolean, + * globalReturn?: boolean, + * impliedStrict?: boolean + * }, + * ranges: boolean, + * locations: boolean, + * allowReturnOutsideFunction: boolean, + * tokens?: boolean | null, + * comment?: boolean + * }} NormalizedParserOptions + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const SUPPORTED_VERSIONS = [ + 3, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 +]; + +/** + * 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]; +} + +/** + * Normalize ECMAScript version from the initial config + * @param {number|"latest"} 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 = 5) { + + let version = ecmaVersion === "latest" ? getLatestEcmaVersion() : ecmaVersion; + + if (typeof version !== "number") { + throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof ecmaVersion} instead.`); + } + + // 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 {"script"|"module"|"commonjs"} sourceType to normalize + * @throws {Error} throw an error if sourceType is invalid + * @returns {"script"|"module"} normalized sourceType + */ +function normalizeSourceType(sourceType = "script") { + if (sourceType === "script" || sourceType === "module") { + return sourceType; + } + + if (sourceType === "commonjs") { + return "script"; + } + + throw new Error("Invalid sourceType."); +} + +/** + * Normalize parserOptions + * @param {ParserOptions} options the parser options to normalize + * @throws {Error} throw an error if found invalid option. + * @returns {NormalizedParserOptions} normalized options + */ +function normalizeOptions(options) { + const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); + + /** @type {"script"|"module"} */ + const sourceType = normalizeSourceType(options.sourceType); + const ranges = options.range === true; + const locations = options.loc === true; + + if (ecmaVersion !== 3 && options.allowReserved) { + + // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed + throw new Error("`allowReserved` is only supported when ecmaVersion is 3"); + } + + // Note: value in Acorn can also be "never" but we throw in such a case + if (typeof options.allowReserved !== "undefined" && typeof options.allowReserved !== "boolean") { + throw new Error("`allowReserved`, when present, must be `true` or `false`"); + } + const allowReserved = ecmaVersion === 3 ? (options.allowReserved || "never") : false; + const ecmaFeatures = options.ecmaFeatures || {}; + const allowReturnOutsideFunction = options.sourceType === "commonjs" || + Boolean(ecmaFeatures.globalReturn); + + 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, + allowReserved, + allowReturnOutsideFunction + }); +} + +/* eslint-disable no-param-reassign*/ + +const STATE = Symbol("espree's internal state"); +const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); + +// ---------------------------------------------------------------------------- +// Types exported from file +// ---------------------------------------------------------------------------- +/** + * @typedef {{ + * index?: number; + * lineNumber?: number; + * column?: number; + * } & SyntaxError} EnhancedSyntaxError + */ + +// We add `jsxAttrValueToken` ourselves. +/** + * @typedef {{ + * jsxAttrValueToken?: acorn.TokenType; + * } & tokTypesType} EnhancedTokTypes + */ + +// ---------------------------------------------------------------------------- +// Local type imports +// ---------------------------------------------------------------------------- +/** + * @local + * @typedef {import('acorn')} acorn + * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType + * @typedef {typeof import('acorn-jsx').AcornJsxParser} AcornJsxParser + * @typedef {import('../espree').ParserOptions} ParserOptions + */ + +// ---------------------------------------------------------------------------- +// Local types +// ---------------------------------------------------------------------------- +/** + * @local + * + * @typedef {acorn.ecmaVersion} ecmaVersion + * + * @typedef {{ + * generator?: boolean + * } & acorn.Node} EsprimaNode + */ +/** + * Suggests an integer + * @local + * @typedef {number} int + */ + +/** + * First three properties as in `acorn.Comment`; next two as in `acorn.Comment` + * but optional. Last is different as has to allow `undefined` + */ +/** + * @local + * + * @typedef {{ + * type: string, + * value: string, + * range?: [number, number], + * start?: number, + * end?: number, + * loc?: { + * start: acorn.Position | undefined, + * end: acorn.Position | undefined + * } + * }} EsprimaComment + * + * @typedef {{ + * comments?: EsprimaComment[] + * } & acorn.Token[]} EspreeTokens + * + * @typedef {{ + * tail?: boolean + * } & acorn.Node} AcornTemplateNode + * + * @typedef {{ + * originalSourceType: "script"|"module"|"commonjs"; + * ecmaVersion: ecmaVersion; + * comments: EsprimaComment[]|null; + * impliedStrict: boolean; + * lastToken: acorn.Token|null; + * templateElements: (AcornTemplateNode)[]; + * jsxAttrValueToken: boolean; + * }} BaseStateObject + * + * @typedef {{ + * tokens: null; + * } & BaseStateObject} StateObject + * + * @typedef {{ + * tokens: EspreeTokens; + * } & BaseStateObject} StateObjectWithTokens + * + * @typedef {{ + * sourceType?: "script"|"module"|"commonjs"; + * comments?: EsprimaComment[]; + * tokens?: acorn.Token[]; + * body: acorn.Node[]; + * } & acorn.Node} EsprimaProgramNode + */ +/** + * Converts an Acorn comment to an Esprima comment. + * + * - block True if it's a block comment, false if not. + * - text The text of the comment. + * - start The index at which the comment starts. + * - end The index at which the comment ends. + * - startLoc The location at which the comment starts. + * - endLoc The location at which the comment ends. + * @local + * @typedef {( + * block: boolean, + * text: string, + * start: int, + * end: int, + * startLoc: acorn.Position | undefined, + * endLoc: acorn.Position | undefined + * ) => EsprimaComment | void} AcornToEsprimaCommentConverter + */ + +// ---------------------------------------------------------------------------- +// Utilities +// ---------------------------------------------------------------------------- +/** + * Converts an Acorn comment to an Esprima comment. + * @type {AcornToEsprimaCommentConverter} + * @returns {EsprimaComment} The comment object. + * @private + */ +function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { + const comment = /** @type {EsprimaComment} */ ({ + 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; +} + +// ---------------------------------------------------------------------------- +// Exports +// ---------------------------------------------------------------------------- +/* eslint-disable arrow-body-style -- Need to supply formatted JSDoc for type info */ +var espree = () => { + + /** + * Returns the Espree parser. + * @param {AcornJsxParser} Parser The Acorn parser + * @returns {typeof EspreeParser} The Espree parser + */ + return Parser => { + const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes)); + + if (Parser.acornJsx) { + Object.assign(tokTypes, Parser.acornJsx.tokTypes); + } + + /* eslint-disable no-shadow -- Using first class as type */ + /** + * @export + */ + return class EspreeParser extends Parser { + /* eslint-enable no-shadow -- Using first class as type */ + /* eslint-disable jsdoc/check-types -- Allows generic object */ + /** + * Adapted parser for Espree. + * @param {ParserOptions|null} opts Espree options + * @param {string|object} code The source code + */ + constructor(opts, code) { + /* eslint-enable jsdoc/check-types -- Allows generic object */ + + /** @type {ParserOptions} */ + const newOpts = (typeof opts !== "object" || opts === null) + ? {} + : opts; + + const codeString = typeof code === "string" + ? /** @type {string} */ (code) + : String(code); + + // save original source type in case of commonjs + const originalSourceType = newOpts.sourceType; + const options = normalizeOptions(newOpts); + const ecmaFeatures = options.ecmaFeatures || {}; + const tokenTranslator = + options.tokens === true + ? new TokenTranslator(tokTypes, codeString) + : null; + + // Initialize acorn parser. + super({ + + // do not use spread, because we don't want to pass any unknown options to acorn + ecmaVersion: options.ecmaVersion, + sourceType: options.sourceType, + ranges: options.ranges, + locations: options.locations, + allowReserved: options.allowReserved, + + // Truthy value is true for backward compatibility. + allowReturnOutsideFunction: options.allowReturnOutsideFunction, + + // Collect tokens + /** + * Handler for receiving a token + * @param {acorn.Token} token The token + * @returns {void} + */ + onToken: token => { + if (tokenTranslator) { + + // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state. + tokenTranslator.onToken(token, /** @type {StateObjectWithTokens} */ (this[STATE])); + } + if (token.type !== tokTypes.eof) { + this[STATE].lastToken = token; + } + }, + + // Collect comments + /** + * Converts an Acorn comment to an Esprima comment. + * @type {AcornToEsprimaCommentConverter} + */ + onComment: (block, text, start, end, startLoc, endLoc) => { + if (this[STATE].comments) { + const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc); + + const comments = /** @type {EsprimaComment[]} */ (this[STATE].comments); + + comments.push(comment); + } + } + }, codeString); + + // Force for TypeScript (indicating that `lineStart` is not undefined) + if (!this.lineStart) { + this.lineStart = 0; + } + + /** + * Data that is unique to Espree and is not represented internally in + * Acorn. We put all of this data into a symbol property as a way to + * avoid potential naming conflicts with future versions of Acorn. + * @type {StateObjectWithTokens|StateObject} + */ + this[STATE] = { + originalSourceType: originalSourceType || options.sourceType, + tokens: tokenTranslator ? /** @type {EspreeTokens} */ ([]) : null, + comments: options.comment === true + ? /** @type {EsprimaComment[]} */ ([]) + : null, + impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5, + ecmaVersion: this.options.ecmaVersion, + jsxAttrValueToken: false, + + /** @type {acorn.Token|null} */ + lastToken: null, + + /** @type {(AcornTemplateNode)[]} */ + templateElements: [] + }; + } + + /** + * Returns Espree tokens. + * @returns {EspreeTokens|null} Espree tokens + */ + 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) { + tokens.comments = extra.comments; + } + + return tokens; + } + + /** + * Calls parent. + * @param {acorn.Node} node The node + * @param {string} type The type + * @returns {acorn.Node} The altered Node + */ + finishNode(node, type) { + const result = super.finishNode(node, type); + + return this[ESPRIMA_FINISH_NODE](result); + } + + /** + * Calls parent. + * @param {acorn.Node} node The node + * @param {string} type The type + * @param {number} pos The position + * @param {acorn.Position} loc The location + * @returns {acorn.Node} The altered Node + */ + finishNodeAt(node, type, pos, loc) { + const result = super.finishNodeAt(node, type, pos, loc); + + return this[ESPRIMA_FINISH_NODE](result); + } + + /** + * Parses. + * @returns {EsprimaProgramNode} The program Node + */ + parse() { + const extra = this[STATE]; + + const program = /** @type {EsprimaProgramNode} */ (super.parse()); + + program.sourceType = extra.originalSourceType; + + 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.body.length) { + const [firstNode] = program.body; + + if (program.range && firstNode.range) { + program.range[0] = firstNode.range[0]; + } + if (program.loc && firstNode.loc) { + program.loc.start = firstNode.loc.start; + } + program.start = firstNode.start; + } + if (extra.lastToken) { + if (program.range && extra.lastToken.range) { + program.range[1] = extra.lastToken.range[1]; + } + if (program.loc && extra.lastToken.loc) { + program.loc.end = extra.lastToken.loc.end; + } + program.end = extra.lastToken.end; + } + + + /* + * https://github.com/eslint/espree/issues/349 + * Ensure that template elements have correct range information. + * This is one location where Acorn produces a different value + * for its start and end properties vs. the values present in the + * range property. In order to avoid confusion, we set the start + * and end properties to the values that are present in range. + * This is done here, instead of in finishNode(), because Acorn + * uses the values of start and end internally while parsing, making + * it dangerous to change those values while parsing is ongoing. + * By waiting until the end of parsing, we can safely change these + * values without affect any other part of the process. + */ + this[STATE].templateElements.forEach(templateElement => { + const startOffset = -1; + const endOffset = templateElement.tail ? 1 : 2; + + templateElement.start += startOffset; + templateElement.end += endOffset; + + if (templateElement.range) { + templateElement.range[0] += startOffset; + templateElement.range[1] += endOffset; + } + + if (templateElement.loc) { + templateElement.loc.start.column += startOffset; + templateElement.loc.end.column += endOffset; + } + }); + + return program; + } + + /** + * Parses top level. + * @param {acorn.Node} node AST Node + * @returns {acorn.Node} The changed node + */ + 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 {EnhancedSyntaxError} A syntax error. + * @returns {void} + */ + raise(pos, message) { + const loc = Parser.acorn.getLineInfo(this.input, pos); + + /** @type {EnhancedSyntaxError} */ + 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 {EnhancedSyntaxError} 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 {EnhancedSyntaxError} 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 < /** @type {int} */ (this.lineStart)) { + + /** @type {int} */ + this.lineStart = this.input.lastIndexOf("\n", /** @type {int} */ (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. + * @param {number} quote A character code + * @returns {void} + */ + jsx_readString(quote) { // eslint-disable-line camelcase + if (typeof super.jsx_readString === "undefined") { + throw new Error("Not a JSX parser"); + } + super.jsx_readString(quote); + + if (this.type === tokTypes.string) { + this[STATE].jsxAttrValueToken = true; + } + } + + /** + * Performs last-minute Esprima-specific compatibility checks and fixes. + * @param {acorn.Node} result The node to check. + * @returns {EsprimaNode} The finished node. + */ + [ESPRIMA_FINISH_NODE](result) { + + const esprimaResult = /** @type {EsprimaNode} */ (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") { + + // save template element references to fix start/end later + this[STATE].templateElements.push(result); + } + + if (result.type.includes("Function") && !esprimaResult.generator) { + esprimaResult.generator = false; + } + + return esprimaResult; + } + }; + }; +}; + +const version$1 = "main"; + +/** + * @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 + * + * 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 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 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. + */ + + +// To initialize lazily. +const parsers = { + _regular: /** @type {IEspreeParser|null} */ (null), + _jsx: /** @type {IEspreeParser|null} */ (null), + + /** + * Returns regular Parser + * @returns {IEspreeParser} Regular Acorn parser + */ + get regular() { + if (this._regular === null) { + const espreeParserFactory = espree(); + + // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts + this._regular = espreeParserFactory(/** @type {AcornJsxParser} */ (acorn__namespace.Parser)); + } + return this._regular; + }, + + /** + * Returns JSX Parser + * @returns {IEspreeParser} JSX Acorn parser + */ + get jsx() { + if (this._jsx === null) { + const espreeParserFactory = espree(); + const jsxFactory = jsx__default["default"](); + + // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts + this._jsx = espreeParserFactory(jsxFactory(acorn__namespace.Parser)); + } + return this._jsx; + }, + + /** + * Returns Regular or JSX Parser + * @param {ParserOptions} options Parser options + * @returns {IEspreeParser} Regular or JSX Acorn parser + */ + 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 {ParserOptions} options Options defining how to tokenize. + * @returns {acorn.Token[]|null} An array of tokens. + * @throws {EnhancedSyntaxError} 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 {ParserOptions} options Options defining how to tokenize. + * @returns {acorn.Node} The "Program" AST node. + * @throws {EnhancedSyntaxError} If the input code is invalid. + */ +function parse(code, options) { + const Parser = parsers.get(options); + + return new Parser(options, code).parse(); +} + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +const version = version$1; + +/* istanbul ignore next */ +const VisitorKeys = (function() { + return visitorKeys__namespace.KEYS; +}()); + +// Derive node types from VisitorKeys +/* istanbul ignore next */ +const Syntax = (function() { + let /** @type {Object} */ + types = {}; + + if (typeof Object.create === "function") { + types = Object.create(null); + } + + for (const name of Object.keys(VisitorKeys)) { + types[name] = name; + } + + if (typeof Object.freeze === "function") { + Object.freeze(types); + } + + return types; +}()); + +const latestEcmaVersion = getLatestEcmaVersion(); + +const supportedEcmaVersions = getSupportedEcmaVersions(); + +exports.Syntax = Syntax; +exports.VisitorKeys = VisitorKeys; +exports.latestEcmaVersion = latestEcmaVersion; +exports.parse = parse; +exports.supportedEcmaVersions = supportedEcmaVersions; +exports.tokenize = tokenize; +exports.version = version; +//# sourceMappingURL=espree.cjs.map diff --git a/dist/espree.cjs.map b/dist/espree.cjs.map new file mode 100644 index 00000000..1a034863 --- /dev/null +++ b/dist/espree.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"espree.cjs","sources":["../lib/token-translator.js","../lib/options.js","../lib/espree.js","../lib/version.js","../espree.js"],"sourcesContent":["/**\n * @fileoverview Translates tokens between Acorn format and Esprima format.\n * @author Nicholas C. Zakas\n */\n/* eslint no-underscore-dangle: 0 */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('../lib/espree').EnhancedTokTypes} EnhancedTokTypes\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * Based on the `acorn.Token` class, but without a fixed `type` (since we need\n * it to be a string). Avoiding `type` lets us make one extending interface\n * more strict and another more lax.\n *\n * We could make `value` more strict to `string` even though the original is\n * `any`.\n *\n * `start` and `end` are required in `acorn.Token`\n *\n * `loc` and `range` are from `acorn.Token`\n *\n * Adds `regex`.\n */\n/**\n * @local\n *\n * @typedef {{\n * value: any;\n * start?: number;\n * end?: number;\n * loc?: acorn.SourceLocation;\n * range?: [number, number];\n * regex?: {flags: string, pattern: string};\n * }} BaseEsprimaToken\n *\n * @typedef {{\n * type: string;\n * } & BaseEsprimaToken} EsprimaToken\n *\n * @typedef {{\n * type: string | acorn.TokenType;\n * } & BaseEsprimaToken} EsprimaTokenFlexible\n *\n * @typedef {{\n * jsxAttrValueToken: boolean;\n * ecmaVersion: acorn.ecmaVersion;\n * }} ExtraNoTokens\n *\n * @typedef {{\n * tokens: EsprimaTokenFlexible[]\n * } & ExtraNoTokens} Extra\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\n// none!\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n\n// Esprima Token Types\nconst Token = {\n Boolean: \"Boolean\",\n EOF: \"\",\n Identifier: \"Identifier\",\n PrivateIdentifier: \"PrivateIdentifier\",\n Keyword: \"Keyword\",\n Null: \"Null\",\n Numeric: \"Numeric\",\n Punctuator: \"Punctuator\",\n String: \"String\",\n RegularExpression: \"RegularExpression\",\n Template: \"Template\",\n JSXIdentifier: \"JSXIdentifier\",\n JSXText: \"JSXText\"\n};\n\n/**\n * Converts part of a template into an Esprima token.\n * @param {(acorn.Token)[]} tokens The Acorn tokens representing the template.\n * @param {string} code The source code.\n * @returns {EsprimaToken} The Esprima equivalent of the template token.\n * @private\n */\nfunction convertTemplatePart(tokens, code) {\n const firstToken = tokens[0],\n lastTemplateToken = tokens[tokens.length - 1];\n\n /** @type {EsprimaToken} */\n const token = {\n type: Token.Template,\n value: code.slice(firstToken.start, lastTemplateToken.end)\n };\n\n if (firstToken.loc && lastTemplateToken.loc) {\n token.loc = {\n start: firstToken.loc.start,\n end: lastTemplateToken.loc.end\n };\n }\n\n if (firstToken.range && lastTemplateToken.range) {\n token.start = firstToken.range[0];\n token.end = lastTemplateToken.range[1];\n token.range = [token.start, token.end];\n }\n\n return token;\n}\n\nclass TokenTranslator {\n\n /**\n * Contains logic to translate Acorn tokens into Esprima tokens.\n * @param {EnhancedTokTypes} acornTokTypes The Acorn token types.\n * @param {string} code The source code Acorn is parsing. This is necessary\n * to correct the \"value\" property of some tokens.\n */\n constructor(acornTokTypes, code) {\n\n // token types\n this._acornTokTypes = acornTokTypes;\n\n // token buffer for templates\n /** @type {(acorn.Token)[]} */\n this._tokens = [];\n\n // track the last curly brace\n this._curlyBrace = null;\n\n // the source code\n this._code = code;\n\n }\n\n /**\n * Translates a single Esprima token to a single Acorn token. This may be\n * inaccurate due to how templates are handled differently in Esprima and\n * Acorn, but should be accurate for all other tokens.\n * @param {acorn.Token} token The Acorn token to translate.\n * @param {ExtraNoTokens} extra Espree extra object.\n * @returns {EsprimaToken} The Esprima version of the token.\n */\n translate(token, extra) {\n\n const type = token.type,\n tt = this._acornTokTypes,\n\n // We use an unknown type because `acorn.Token` is a class whose\n // `type` property we cannot override to our desired `string`;\n // this also allows us to define a stricter `EsprimaToken` with\n // a string-only `type` property\n unknownType = /** @type {unknown} */ (token),\n newToken = /** @type {EsprimaToken} */ (unknownType);\n\n if (type === tt.name) {\n newToken.type = Token.Identifier;\n\n // TODO: See if this is an Acorn bug\n if (token.value === \"static\") {\n newToken.type = Token.Keyword;\n }\n\n if (extra.ecmaVersion > 5 && (token.value === \"yield\" || token.value === \"let\")) {\n newToken.type = Token.Keyword;\n }\n\n } else if (type === tt.privateId) {\n newToken.type = Token.PrivateIdentifier;\n\n } else if (type === tt.semi || type === tt.comma ||\n type === tt.parenL || type === tt.parenR ||\n type === tt.braceL || type === tt.braceR ||\n type === tt.dot || type === tt.bracketL ||\n type === tt.colon || type === tt.question ||\n type === tt.bracketR || type === tt.ellipsis ||\n type === tt.arrow || type === tt.jsxTagStart ||\n type === tt.incDec || type === tt.starstar ||\n type === tt.jsxTagEnd || type === tt.prefix ||\n type === tt.questionDot ||\n (type.binop && !type.keyword) ||\n type.isAssign) {\n\n newToken.type = Token.Punctuator;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.jsxName) {\n newToken.type = Token.JSXIdentifier;\n } else if (type.label === \"jsxText\" || type === tt.jsxAttrValueToken) {\n newToken.type = Token.JSXText;\n } else if (type.keyword) {\n if (type.keyword === \"true\" || type.keyword === \"false\") {\n newToken.type = Token.Boolean;\n } else if (type.keyword === \"null\") {\n newToken.type = Token.Null;\n } else {\n newToken.type = Token.Keyword;\n }\n } else if (type === tt.num) {\n newToken.type = Token.Numeric;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.string) {\n\n if (extra.jsxAttrValueToken) {\n extra.jsxAttrValueToken = false;\n newToken.type = Token.JSXText;\n } else {\n newToken.type = Token.String;\n }\n\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.regexp) {\n newToken.type = Token.RegularExpression;\n const value = token.value;\n\n newToken.regex = {\n flags: value.flags,\n pattern: value.pattern\n };\n newToken.value = `/${value.pattern}/${value.flags}`;\n }\n\n return newToken;\n }\n\n /**\n * Function to call during Acorn's onToken handler.\n * @param {acorn.Token} token The Acorn token.\n * @param {Extra} extra The Espree extra object.\n * @returns {void}\n */\n onToken(token, extra) {\n\n const that = this,\n tt = this._acornTokTypes,\n tokens = extra.tokens,\n templateTokens = this._tokens;\n\n /**\n * Flushes the buffered template tokens and resets the template\n * tracking.\n * @returns {void}\n * @private\n */\n function translateTemplateTokens() {\n tokens.push(convertTemplatePart(that._tokens, that._code));\n that._tokens = [];\n }\n\n if (token.type === tt.eof) {\n\n // might be one last curlyBrace\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n return;\n }\n\n if (token.type === tt.backQuote) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n\n // it's the end\n if (templateTokens.length > 1) {\n translateTemplateTokens();\n }\n\n return;\n }\n if (token.type === tt.dollarBraceL) {\n templateTokens.push(token);\n translateTemplateTokens();\n return;\n }\n if (token.type === tt.braceR) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n // store new curly for later\n this._curlyBrace = token;\n return;\n }\n if (token.type === tt.template || token.type === tt.invalidTemplate) {\n if (this._curlyBrace) {\n templateTokens.push(this._curlyBrace);\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n return;\n }\n\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n tokens.push(this.translate(token, extra));\n }\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport default TokenTranslator;\n","/**\n * @fileoverview A collection of methods for processing Espree's options.\n * @author Kai Cataldo\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('../espree').ParserOptions} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * ecmaVersion: 10 | 9 | 8 | 7 | 6 | 5 | 3 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | \"latest\",\n * sourceType: \"script\"|\"module\",\n * range?: boolean,\n * loc?: boolean,\n * allowReserved: boolean | \"never\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * ranges: boolean,\n * locations: boolean,\n * allowReturnOutsideFunction: boolean,\n * tokens?: boolean | null,\n * comment?: boolean\n * }} NormalizedParserOptions\n */\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst SUPPORTED_VERSIONS = [\n 3,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13\n];\n\n/**\n * Get the latest ECMAScript version supported by Espree.\n * @returns {number} The latest ECMAScript version.\n */\nexport function getLatestEcmaVersion() {\n return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1];\n}\n\n/**\n * Get the list of ECMAScript versions supported by Espree.\n * @returns {number[]} An array containing the supported ECMAScript versions.\n */\nexport function getSupportedEcmaVersions() {\n return [...SUPPORTED_VERSIONS];\n}\n\n/**\n * Normalize ECMAScript version from the initial config\n * @param {number|\"latest\"} ecmaVersion ECMAScript version from the initial config\n * @throws {Error} throws an error if the ecmaVersion is invalid.\n * @returns {number} normalized ECMAScript version\n */\nfunction normalizeEcmaVersion(ecmaVersion = 5) {\n\n let version = ecmaVersion === \"latest\" ? getLatestEcmaVersion() : ecmaVersion;\n\n if (typeof version !== \"number\") {\n throw new Error(`ecmaVersion must be a number or \"latest\". Received value of type ${typeof ecmaVersion} instead.`);\n }\n\n // Calculate ECMAScript edition number from official year version starting with\n // ES2015, which corresponds with ES6 (or a difference of 2009).\n if (version >= 2015) {\n version -= 2009;\n }\n\n if (!SUPPORTED_VERSIONS.includes(version)) {\n throw new Error(\"Invalid ecmaVersion.\");\n }\n\n return version;\n}\n\n/**\n * Normalize sourceType from the initial config\n * @param {\"script\"|\"module\"|\"commonjs\"} sourceType to normalize\n * @throws {Error} throw an error if sourceType is invalid\n * @returns {\"script\"|\"module\"} normalized sourceType\n */\nfunction normalizeSourceType(sourceType = \"script\") {\n if (sourceType === \"script\" || sourceType === \"module\") {\n return sourceType;\n }\n\n if (sourceType === \"commonjs\") {\n return \"script\";\n }\n\n throw new Error(\"Invalid sourceType.\");\n}\n\n/**\n * Normalize parserOptions\n * @param {ParserOptions} options the parser options to normalize\n * @throws {Error} throw an error if found invalid option.\n * @returns {NormalizedParserOptions} normalized options\n */\nexport function normalizeOptions(options) {\n const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion);\n\n /** @type {\"script\"|\"module\"} */\n const sourceType = normalizeSourceType(options.sourceType);\n const ranges = options.range === true;\n const locations = options.loc === true;\n\n if (ecmaVersion !== 3 && options.allowReserved) {\n\n // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed\n throw new Error(\"`allowReserved` is only supported when ecmaVersion is 3\");\n }\n\n // Note: value in Acorn can also be \"never\" but we throw in such a case\n if (typeof options.allowReserved !== \"undefined\" && typeof options.allowReserved !== \"boolean\") {\n throw new Error(\"`allowReserved`, when present, must be `true` or `false`\");\n }\n const allowReserved = ecmaVersion === 3 ? (options.allowReserved || \"never\") : false;\n const ecmaFeatures = options.ecmaFeatures || {};\n const allowReturnOutsideFunction = options.sourceType === \"commonjs\" ||\n Boolean(ecmaFeatures.globalReturn);\n\n if (sourceType === \"module\" && ecmaVersion < 6) {\n throw new Error(\"sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.\");\n }\n\n return Object.assign({}, options, {\n ecmaVersion,\n sourceType,\n ranges,\n locations,\n allowReserved,\n allowReturnOutsideFunction\n });\n}\n","/* eslint-disable no-param-reassign*/\nimport TokenTranslator from \"./token-translator.js\";\nimport { normalizeOptions } from \"./options.js\";\n\nconst STATE = Symbol(\"espree's internal state\");\nconst ESPRIMA_FINISH_NODE = Symbol(\"espree's esprimaFinishNode\");\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {{\n * index?: number;\n * lineNumber?: number;\n * column?: number;\n * } & SyntaxError} EnhancedSyntaxError\n */\n\n// We add `jsxAttrValueToken` ourselves.\n/**\n * @typedef {{\n * jsxAttrValueToken?: acorn.TokenType;\n * } & tokTypesType} EnhancedTokTypes\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType\n * @typedef {typeof import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('../espree').ParserOptions} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n *\n * @typedef {acorn.ecmaVersion} ecmaVersion\n *\n * @typedef {{\n * generator?: boolean\n * } & acorn.Node} EsprimaNode\n */\n/**\n * Suggests an integer\n * @local\n * @typedef {number} int\n */\n\n/**\n * First three properties as in `acorn.Comment`; next two as in `acorn.Comment`\n * but optional. Last is different as has to allow `undefined`\n */\n/**\n * @local\n *\n * @typedef {{\n * type: string,\n * value: string,\n * range?: [number, number],\n * start?: number,\n * end?: number,\n * loc?: {\n * start: acorn.Position | undefined,\n * end: acorn.Position | undefined\n * }\n * }} EsprimaComment\n *\n * @typedef {{\n * comments?: EsprimaComment[]\n * } & acorn.Token[]} EspreeTokens\n *\n * @typedef {{\n * tail?: boolean\n * } & acorn.Node} AcornTemplateNode\n *\n * @typedef {{\n * originalSourceType: \"script\"|\"module\"|\"commonjs\";\n * ecmaVersion: ecmaVersion;\n * comments: EsprimaComment[]|null;\n * impliedStrict: boolean;\n * lastToken: acorn.Token|null;\n * templateElements: (AcornTemplateNode)[];\n * jsxAttrValueToken: boolean;\n * }} BaseStateObject\n *\n * @typedef {{\n * tokens: null;\n * } & BaseStateObject} StateObject\n *\n * @typedef {{\n * tokens: EspreeTokens;\n * } & BaseStateObject} StateObjectWithTokens\n *\n * @typedef {{\n * sourceType?: \"script\"|\"module\"|\"commonjs\";\n * comments?: EsprimaComment[];\n * tokens?: acorn.Token[];\n * body: acorn.Node[];\n * } & acorn.Node} EsprimaProgramNode\n */\n/**\n * Converts an Acorn comment to an Esprima comment.\n *\n * - block True if it's a block comment, false if not.\n * - text The text of the comment.\n * - start The index at which the comment starts.\n * - end The index at which the comment ends.\n * - startLoc The location at which the comment starts.\n * - endLoc The location at which the comment ends.\n * @local\n * @typedef {(\n * block: boolean,\n * text: string,\n * start: int,\n * end: int,\n * startLoc: acorn.Position | undefined,\n * endLoc: acorn.Position | undefined\n * ) => EsprimaComment | void} AcornToEsprimaCommentConverter\n */\n\n// ----------------------------------------------------------------------------\n// Utilities\n// ----------------------------------------------------------------------------\n/**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n * @returns {EsprimaComment} The comment object.\n * @private\n */\nfunction convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) {\n const comment = /** @type {EsprimaComment} */ ({\n type: block ? \"Block\" : \"Line\",\n value: text\n });\n\n if (typeof start === \"number\") {\n comment.start = start;\n comment.end = end;\n comment.range = [start, end];\n }\n\n if (typeof startLoc === \"object\") {\n comment.loc = {\n start: startLoc,\n end: endLoc\n };\n }\n\n return comment;\n}\n\n// ----------------------------------------------------------------------------\n// Exports\n// ----------------------------------------------------------------------------\n/* eslint-disable arrow-body-style -- Need to supply formatted JSDoc for type info */\nexport default () => {\n\n /**\n * Returns the Espree parser.\n * @param {AcornJsxParser} Parser The Acorn parser\n * @returns {typeof EspreeParser} The Espree parser\n */\n return Parser => {\n const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes));\n\n if (Parser.acornJsx) {\n Object.assign(tokTypes, Parser.acornJsx.tokTypes);\n }\n\n /* eslint-disable no-shadow -- Using first class as type */\n /**\n * @export\n */\n return class EspreeParser extends Parser {\n /* eslint-enable no-shadow -- Using first class as type */\n /* eslint-disable jsdoc/check-types -- Allows generic object */\n /**\n * Adapted parser for Espree.\n * @param {ParserOptions|null} opts Espree options\n * @param {string|object} code The source code\n */\n constructor(opts, code) {\n /* eslint-enable jsdoc/check-types -- Allows generic object */\n\n /** @type {ParserOptions} */\n const newOpts = (typeof opts !== \"object\" || opts === null)\n ? {}\n : opts;\n\n const codeString = typeof code === \"string\"\n ? /** @type {string} */ (code)\n : String(code);\n\n // save original source type in case of commonjs\n const originalSourceType = newOpts.sourceType;\n const options = normalizeOptions(newOpts);\n const ecmaFeatures = options.ecmaFeatures || {};\n const tokenTranslator =\n options.tokens === true\n ? new TokenTranslator(tokTypes, codeString)\n : null;\n\n // Initialize acorn parser.\n super({\n\n // do not use spread, because we don't want to pass any unknown options to acorn\n ecmaVersion: options.ecmaVersion,\n sourceType: options.sourceType,\n ranges: options.ranges,\n locations: options.locations,\n allowReserved: options.allowReserved,\n\n // Truthy value is true for backward compatibility.\n allowReturnOutsideFunction: options.allowReturnOutsideFunction,\n\n // Collect tokens\n /**\n * Handler for receiving a token\n * @param {acorn.Token} token The token\n * @returns {void}\n */\n onToken: token => {\n if (tokenTranslator) {\n\n // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.\n tokenTranslator.onToken(token, /** @type {StateObjectWithTokens} */ (this[STATE]));\n }\n if (token.type !== tokTypes.eof) {\n this[STATE].lastToken = token;\n }\n },\n\n // Collect comments\n /**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n */\n onComment: (block, text, start, end, startLoc, endLoc) => {\n if (this[STATE].comments) {\n const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc);\n\n const comments = /** @type {EsprimaComment[]} */ (this[STATE].comments);\n\n comments.push(comment);\n }\n }\n }, codeString);\n\n // Force for TypeScript (indicating that `lineStart` is not undefined)\n if (!this.lineStart) {\n this.lineStart = 0;\n }\n\n /**\n * Data that is unique to Espree and is not represented internally in\n * Acorn. We put all of this data into a symbol property as a way to\n * avoid potential naming conflicts with future versions of Acorn.\n * @type {StateObjectWithTokens|StateObject}\n */\n this[STATE] = {\n originalSourceType: originalSourceType || options.sourceType,\n tokens: tokenTranslator ? /** @type {EspreeTokens} */ ([]) : null,\n comments: options.comment === true\n ? /** @type {EsprimaComment[]} */ ([])\n : null,\n impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,\n ecmaVersion: this.options.ecmaVersion,\n jsxAttrValueToken: false,\n\n /** @type {acorn.Token|null} */\n lastToken: null,\n\n /** @type {(AcornTemplateNode)[]} */\n templateElements: []\n };\n }\n\n /**\n * Returns Espree tokens.\n * @returns {EspreeTokens|null} Espree tokens\n */\n tokenize() {\n do {\n this.next();\n } while (this.type !== tokTypes.eof);\n\n // Consume the final eof token\n this.next();\n\n const extra = this[STATE];\n const tokens = extra.tokens;\n\n if (extra.comments && tokens) {\n tokens.comments = extra.comments;\n }\n\n return tokens;\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @returns {acorn.Node} The altered Node\n */\n finishNode(node, type) {\n const result = super.finishNode(node, type);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @param {number} pos The position\n * @param {acorn.Position} loc The location\n * @returns {acorn.Node} The altered Node\n */\n finishNodeAt(node, type, pos, loc) {\n const result = super.finishNodeAt(node, type, pos, loc);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Parses.\n * @returns {EsprimaProgramNode} The program Node\n */\n parse() {\n const extra = this[STATE];\n\n const program = /** @type {EsprimaProgramNode} */ (super.parse());\n\n program.sourceType = extra.originalSourceType;\n\n if (extra.comments) {\n program.comments = extra.comments;\n }\n if (extra.tokens) {\n program.tokens = extra.tokens;\n }\n\n /*\n * Adjust opening and closing position of program to match Esprima.\n * Acorn always starts programs at range 0 whereas Esprima starts at the\n * first AST node's start (the only real difference is when there's leading\n * whitespace or leading comments). Acorn also counts trailing whitespace\n * as part of the program whereas Esprima only counts up to the last token.\n */\n if (program.body.length) {\n const [firstNode] = program.body;\n\n if (program.range && firstNode.range) {\n program.range[0] = firstNode.range[0];\n }\n if (program.loc && firstNode.loc) {\n program.loc.start = firstNode.loc.start;\n }\n program.start = firstNode.start;\n }\n if (extra.lastToken) {\n if (program.range && extra.lastToken.range) {\n program.range[1] = extra.lastToken.range[1];\n }\n if (program.loc && extra.lastToken.loc) {\n program.loc.end = extra.lastToken.loc.end;\n }\n program.end = extra.lastToken.end;\n }\n\n\n /*\n * https://github.com/eslint/espree/issues/349\n * Ensure that template elements have correct range information.\n * This is one location where Acorn produces a different value\n * for its start and end properties vs. the values present in the\n * range property. In order to avoid confusion, we set the start\n * and end properties to the values that are present in range.\n * This is done here, instead of in finishNode(), because Acorn\n * uses the values of start and end internally while parsing, making\n * it dangerous to change those values while parsing is ongoing.\n * By waiting until the end of parsing, we can safely change these\n * values without affect any other part of the process.\n */\n this[STATE].templateElements.forEach(templateElement => {\n const startOffset = -1;\n const endOffset = templateElement.tail ? 1 : 2;\n\n templateElement.start += startOffset;\n templateElement.end += endOffset;\n\n if (templateElement.range) {\n templateElement.range[0] += startOffset;\n templateElement.range[1] += endOffset;\n }\n\n if (templateElement.loc) {\n templateElement.loc.start.column += startOffset;\n templateElement.loc.end.column += endOffset;\n }\n });\n\n return program;\n }\n\n /**\n * Parses top level.\n * @param {acorn.Node} node AST Node\n * @returns {acorn.Node} The changed node\n */\n parseTopLevel(node) {\n if (this[STATE].impliedStrict) {\n this.strict = true;\n }\n return super.parseTopLevel(node);\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raise(pos, message) {\n const loc = Parser.acorn.getLineInfo(this.input, pos);\n\n /** @type {EnhancedSyntaxError} */\n const err = new SyntaxError(message);\n\n err.index = pos;\n err.lineNumber = loc.line;\n err.column = loc.column + 1; // acorn uses 0-based columns\n throw err;\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raiseRecoverable(pos, message) {\n this.raise(pos, message);\n }\n\n /**\n * Overwrites the default unexpected method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n unexpected(pos) {\n let message = \"Unexpected token\";\n\n if (pos !== null && pos !== void 0) {\n this.pos = pos;\n\n if (this.options.locations) {\n while (this.pos < /** @type {int} */ (this.lineStart)) {\n\n /** @type {int} */\n this.lineStart = this.input.lastIndexOf(\"\\n\", /** @type {int} */ (this.lineStart) - 2) + 1;\n --this.curLine;\n }\n }\n\n this.nextToken();\n }\n\n if (this.end > this.start) {\n message += ` ${this.input.slice(this.start, this.end)}`;\n }\n\n this.raise(this.start, message);\n }\n\n /**\n * Esprima-FB represents JSX strings as tokens called \"JSXText\", but Acorn-JSX\n * uses regular tt.string without any distinction between this and regular JS\n * strings. As such, we intercept an attempt to read a JSX string and set a flag\n * on extra so that when tokens are converted, the next token will be switched\n * to JSXText via onToken.\n * @param {number} quote A character code\n * @returns {void}\n */\n jsx_readString(quote) { // eslint-disable-line camelcase\n if (typeof super.jsx_readString === \"undefined\") {\n throw new Error(\"Not a JSX parser\");\n }\n super.jsx_readString(quote);\n\n if (this.type === tokTypes.string) {\n this[STATE].jsxAttrValueToken = true;\n }\n }\n\n /**\n * Performs last-minute Esprima-specific compatibility checks and fixes.\n * @param {acorn.Node} result The node to check.\n * @returns {EsprimaNode} The finished node.\n */\n [ESPRIMA_FINISH_NODE](result) {\n\n const esprimaResult = /** @type {EsprimaNode} */ (result);\n\n // Acorn doesn't count the opening and closing backticks as part of templates\n // so we have to adjust ranges/locations appropriately.\n if (result.type === \"TemplateElement\") {\n\n // save template element references to fix start/end later\n this[STATE].templateElements.push(result);\n }\n\n if (result.type.includes(\"Function\") && !esprimaResult.generator) {\n esprimaResult.generator = false;\n }\n\n return esprimaResult;\n }\n };\n };\n};\n","const version = \"main\";\n\nexport default version;\n","/**\n * @fileoverview Main Espree file that converts Acorn into Esprima output.\n *\n * This file contains code from the following MIT-licensed projects:\n * 1. Acorn\n * 2. Babylon\n * 3. Babel-ESLint\n *\n * This file also contains code from Esprima, which is BSD licensed.\n *\n * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)\n * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)\n * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie \n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/* eslint no-undefined:0, no-use-before-define: 0 */\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * `jsx.Options` gives us 2 optional properties, so extend it\n *\n * `allowReserved`, `ranges`, `locations`, `allowReturnOutsideFunction`,\n * `onToken`, and `onComment` are as in `acorn.Options`\n *\n * `ecmaVersion` as in `acorn.Options` though optional\n *\n * `sourceType` as in `acorn.Options` but also allows `commonjs`\n *\n * `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options`\n *\n * `comment` is not in `acorn.Options` and doesn't err without it, but is used\n */\n/**\n * @typedef {{\n * allowReserved?: boolean,\n * ecmaVersion?: acorn.ecmaVersion,\n * sourceType?: \"script\"|\"module\"|\"commonjs\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * range?: boolean,\n * loc?: boolean,\n * tokens?: boolean | null,\n * comment?: boolean,\n * }} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {typeof import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('./lib/espree').EnhancedSyntaxError} EnhancedSyntaxError\n * @typedef {typeof import('./lib/espree').EspreeParser} IEspreeParser\n */\n\nimport * as acorn from \"acorn\";\nimport jsx from \"acorn-jsx\";\nimport espree from \"./lib/espree.js\";\nimport espreeVersion from \"./lib/version.js\";\nimport * as visitorKeys from \"eslint-visitor-keys\";\nimport { getLatestEcmaVersion, getSupportedEcmaVersions } from \"./lib/options.js\";\n\n\n// To initialize lazily.\nconst parsers = {\n _regular: /** @type {IEspreeParser|null} */ (null),\n _jsx: /** @type {IEspreeParser|null} */ (null),\n\n /**\n * Returns regular Parser\n * @returns {IEspreeParser} Regular Acorn parser\n */\n get regular() {\n if (this._regular === null) {\n const espreeParserFactory = espree();\n\n // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts\n this._regular = espreeParserFactory(/** @type {AcornJsxParser} */ (acorn.Parser));\n }\n return this._regular;\n },\n\n /**\n * Returns JSX Parser\n * @returns {IEspreeParser} JSX Acorn parser\n */\n get jsx() {\n if (this._jsx === null) {\n const espreeParserFactory = espree();\n const jsxFactory = jsx();\n\n // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts\n this._jsx = espreeParserFactory(jsxFactory(acorn.Parser));\n }\n return this._jsx;\n },\n\n /**\n * Returns Regular or JSX Parser\n * @param {ParserOptions} options Parser options\n * @returns {IEspreeParser} Regular or JSX Acorn parser\n */\n get(options) {\n const useJsx = Boolean(\n options &&\n options.ecmaFeatures &&\n options.ecmaFeatures.jsx\n );\n\n return useJsx ? this.jsx : this.regular;\n }\n};\n\n//------------------------------------------------------------------------------\n// Tokenizer\n//------------------------------------------------------------------------------\n\n/**\n * Tokenizes the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {acorn.Token[]|null} An array of tokens.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n * @private\n */\nexport function tokenize(code, options) {\n const Parser = parsers.get(options);\n\n // Ensure to collect tokens.\n if (!options || options.tokens !== true) {\n options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign\n }\n\n return new Parser(options, code).tokenize();\n}\n\n//------------------------------------------------------------------------------\n// Parser\n//------------------------------------------------------------------------------\n\n/**\n * Parses the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {acorn.Node} The \"Program\" AST node.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n */\nexport function parse(code, options) {\n const Parser = parsers.get(options);\n\n return new Parser(options, code).parse();\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport const version = espreeVersion;\n\n/* istanbul ignore next */\nexport const VisitorKeys = (function() {\n return visitorKeys.KEYS;\n}());\n\n// Derive node types from VisitorKeys\n/* istanbul ignore next */\nexport const Syntax = (function() {\n let /** @type {Object} */\n types = {};\n\n if (typeof Object.create === \"function\") {\n types = Object.create(null);\n }\n\n for (const name of Object.keys(VisitorKeys)) {\n types[name] = name;\n }\n\n if (typeof Object.freeze === \"function\") {\n Object.freeze(types);\n }\n\n return types;\n}());\n\nexport const latestEcmaVersion = getLatestEcmaVersion();\n\nexport const supportedEcmaVersions = getSupportedEcmaVersions();\n"],"names":["version","acorn","jsx","espreeVersion","visitorKeys"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,KAAK,GAAG;AACd,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,GAAG,EAAE,OAAO;AAChB,IAAI,UAAU,EAAE,YAAY;AAC5B,IAAI,iBAAiB,EAAE,mBAAmB;AAC1C,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,UAAU,EAAE,YAAY;AAC5B,IAAI,MAAM,EAA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C,yBAAyB,CAAC,CAAC;AAChD,MAAM,mBAAmB,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mCAAmC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE;AACxF,IAAI,MAAM,OAAO,kCAAkC;AACnD,QAAQ,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM;AACtC,QAAQ,KAAK,EAAE,IAAI;AACnB,KAAK,CAAC,CAAC;AACP;AACA,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACnC,QAAQ,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AAC9B,QAAQ,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAC1B,QAAQ,OAAO,CAAC,KAAK,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACrC,KAAK;AACL;AACA,IAAI,IAAI,OAAO,QAAQ,KAAK,QAAQ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AAc;AACrC;AACA;AACY,MAAC,WAAW,IAAI,WAAW;AACvC,IAAI,OAAOC,sBAAW,CAAC,IAAI,CAAC;AAC5B,CAAC,EAAE,EAAE;AACL;AACA;AACA;AACY,MAAC,MAAM,IAAI,WAAW;AAClC,IAAI;AACJ,QAAQ,KAAK,GAAG,EAAE,CAAC;AACnB;AACA,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;AAC7C,QAAQ,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,KAAK;AACL;AACA,IAAI,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;AACjD,QAAQ,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAC3B,KAAK;AACL;AACA,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;AAC7C,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7B,KAAK;AACL;AACA,IAAI,OAAO,KAAK,CAAC;AACjB,CAAC,EAAE,EAAE;AACL;AACY,MAAC,iBAAiB,GAAG,oBAAoB,GAAG;AACxD;AACY,MAAC,qBAAqB,GAAG,wBAAwB;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/espree.d.ts b/dist/espree.d.ts new file mode 100644 index 00000000..543ae9b7 --- /dev/null +++ b/dist/espree.d.ts @@ -0,0 +1,41 @@ +/** + * Tokenizes the given code. + * @param {string} code The code to tokenize. + * @param {ParserOptions} options Options defining how to tokenize. + * @returns {import('acorn').Token[] | null} An array of tokens. + * @throws {import('./lib/espree').EnhancedSyntaxError} If the input code is invalid. + * @private + */ +export function tokenize(code: string, options: ParserOptions): import('acorn').Token[] | null; +/** + * Parses the given code. + * @param {string} code The code to tokenize. + * @param {ParserOptions} options Options defining how to tokenize. + * @returns {import('acorn').Node} The "Program" AST node. + * @throws {import('./lib/espree').EnhancedSyntaxError} If the input code is invalid. + */ +export function parse(code: string, options: ParserOptions): import('acorn').Node; +export const version: "main"; +export const VisitorKeys: visitorKeys.VisitorKeys; +export const Syntax: { + [x: string]: string; +}; +export const latestEcmaVersion: number; +export const supportedEcmaVersions: number[]; +export type ParserOptions = { + allowReserved?: boolean; + ecmaVersion?: import('acorn').ecmaVersion; + sourceType?: "script" | "module" | "commonjs"; + ecmaFeatures?: { + jsx?: boolean; + globalReturn?: boolean; + impliedStrict?: boolean; + }; + range?: boolean; + loc?: boolean; + tokens?: boolean | null; + comment?: boolean; +}; +import * as visitorKeys from "eslint-visitor-keys"; +import jsx from "acorn-jsx"; +//# sourceMappingURL=espree.d.ts.map \ No newline at end of file diff --git a/dist/espree.d.ts.map b/dist/espree.d.ts.map new file mode 100644 index 00000000..8e458c43 --- /dev/null +++ b/dist/espree.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"espree.d.ts","sourceRoot":"","sources":["../tmp/espree.js"],"names":[],"mappings":"AAgHA;;;;;;;GAOG;AACH,+BANW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,CAU1C;AAED;;;;;;GAMG;AACH,4BALW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,IAAI,CAMhC;AACD,6BAAqC;AACrC,kDAEI;AACJ;;EAYI;AACJ,uCAAwD;AACxD,6CAAgE;4BAlGnD;IAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,OAAO,EAAE,WAAW,CAAC;IAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IAAC,YAAY,CAAC,EAAE;QAAC,GAAG,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAC"} \ No newline at end of file diff --git a/dist/lib/espree.d.ts b/dist/lib/espree.d.ts new file mode 100644 index 00000000..e1f2868c --- /dev/null +++ b/dist/lib/espree.d.ts @@ -0,0 +1,75 @@ +declare function _default(): (Parser: typeof import('acorn-jsx').AcornJsxParser) => typeof EspreeParser; +export default _default; +export class EspreeParser extends acorn.Parser { + /** + * Adapted parser for Espree. + * @param {import('../espree').ParserOptions | null} opts Espree options + * @param {string | object} code The source code + */ + constructor(opts: import('../espree').ParserOptions | null, code: string | object); + /** + * Returns Espree tokens. + * @returns {{comments?: {type: string; value: string; range?: [number, number]; start?: number; end?: number; loc?: {start: import('acorn').Position | undefined; end: import('acorn').Position | undefined}}[]} & import('acorn').Token[] | null} Espree tokens + */ + tokenize(): { + comments?: { + type: string; + value: string; + range?: [number, number]; + start?: number; + end?: number; + loc?: { + start: import('acorn').Position | undefined; + end: import('acorn').Position | undefined; + }; + }[]; + } & import('acorn').Token[] | null; + /** + * Parses. + * @returns {{sourceType?: "script" | "module" | "commonjs"; comments?: {type: string; value: string; range?: [number, number]; start?: number; end?: number; loc?: {start: import('acorn').Position | undefined; end: import('acorn').Position | undefined}}[]; tokens?: import('acorn').Token[]; body: import('acorn').Node[]} & import('acorn').Node} The program Node + */ + parse(): { + sourceType?: "script" | "module" | "commonjs"; + comments?: { + type: string; + value: string; + range?: [number, number]; + start?: number; + end?: number; + loc?: { + start: import('acorn').Position | undefined; + end: import('acorn').Position | undefined; + }; + }[]; + tokens?: import('acorn').Token[]; + body: import('acorn').Node[]; + } & import('acorn').Node; + /** + * Overwrites the default raise method to throw Esprima-style errors. + * @param {number} pos The position of the error. + * @param {string} message The error message. + * @throws {EnhancedSyntaxError} A syntax error. + * @returns {void} + */ + raiseRecoverable(pos: number, message: string): void; + /** + * 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. + * @param {number} quote A character code + * @returns {void} + */ + jsx_readString(quote: number): void; +} +export type EnhancedSyntaxError = { + index?: number; + lineNumber?: number; + column?: number; +} & SyntaxError; +export type EnhancedTokTypes = { + jsxAttrValueToken?: import('acorn').TokenType; +} & typeof import('acorn-jsx').tokTypes; +import * as acorn from "acorn"; +//# sourceMappingURL=espree.d.ts.map \ No newline at end of file diff --git a/dist/lib/espree.d.ts.map b/dist/lib/espree.d.ts.map new file mode 100644 index 00000000..3be68e3d --- /dev/null +++ b/dist/lib/espree.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"espree.d.ts","sourceRoot":"","sources":["../../tmp/lib/espree.js"],"names":[],"mappings":"AAgDe,sCAIA,cAAc,WAAW,EAAE,cAAc,KACvC,mBAAmB,CA+QnC;;AACD;IAEY;;;;OAIG;IACH,kBAHW,OAAO,WAAW,EAAE,aAAa,GAAG,IAAI,QACxC,MAAM,GAAG,MAAM,EAIjC;IAEO;;;OAGG;IACH,YAFa;QAAC,QAAQ,CAAC,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE;gBAAC,KAAK,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;gBAAC,GAAG,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAA;aAAC,CAAA;SAAC,EAAE,CAAA;KAAC,GAAG,OAAO,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,CAIzP;IAwBO;;;OAGG;IACH,SAFa;QAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;QAAC,QAAQ,CAAC,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE;gBAAC,KAAK,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;gBAAC,GAAG,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAA;aAAC,CAAA;SAAC,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,OAAO,EAAE,KAAK,EAAE,CAAC;QAAC,IAAI,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,CAAA;KAAC,GAAG,OAAO,OAAO,EAAE,IAAI,CAI9V;IAsBO;;;;;;OAMG;IACH,sBALW,MAAM,WACN,MAAM,GAEJ,IAAI,CAIxB;IAYO;;;;;;;;OAQG;IACH,sBAHW,MAAM,GACJ,IAAI,CAIxB;CACJ;kCAzaY;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,WAAW;+BAIpE;IAAC,iBAAiB,CAAC,EAAE,OAAO,OAAO,EAAE,SAAS,CAAA;CAAC,GAAG,cAAc,WAAW,EAAE,QAAQ"} \ No newline at end of file diff --git a/dist/lib/token-translator.d.ts.map b/dist/lib/token-translator.d.ts.map new file mode 100644 index 00000000..8b3d3659 --- /dev/null +++ b/dist/lib/token-translator.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"token-translator.d.ts","sourceRoot":"","sources":["../../tmp/lib/token-translator.js"],"names":[],"mappings":";AA+DA;IAEI;;;;;OAKG;IACH,2BAJW,OAAO,eAAe,EAAE,gBAAgB,QACxC,MAAM,EAQhB;IAJG,yDAAmC;IAC3B,wCAAwC,CAAC,SAA9B,CAAC,OAAO,OAAO,EAAE,KAAK,CAAC,EAAE,CAAsB;IAClE,0CAAuB;IACvB,cAAiB;IAGrB;;;;;;;OAOG;IACH,iBAJW,OAAO,OAAO,EAAE,KAAK,SACrB;QAAC,iBAAiB,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,OAAO,EAAE,WAAW,CAAA;KAAC;cAC7D,MAAM;;eAAY,GAAG;;;;;;mBAAgH,MAAM;qBAAW,MAAM;;MAkD/K;IAED;;;;;OAKG;IACH,eAJW,OAAO,OAAO,EAAE,KAAK;gBACZ,CAAC;YAAC,IAAI,EAAE,MAAM,GAAG,OAAO,OAAO,EAAE,SAAS,CAAA;SAAC,GAAG;YAAC,KAAK,EAAE,GAAG,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,OAAO,OAAO,EAAE,cAAc,CAAC;YAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAAC,KAAK,CAAC,EAAE;gBAAC,KAAK,EAAE,MAAM,CAAC;gBAAC,OAAO,EAAE,MAAM,CAAA;aAAC,CAAA;SAAC,CAAC,EAAE;;2BAAwB,OAAO;qBAAe,OAAO,OAAO,EAAE,WAAW;QACrR,IAAI,CAyDhB;CACJ"} \ No newline at end of file diff --git a/espree.js b/espree.js index da4e3953..84683b8b 100644 --- a/espree.js +++ b/espree.js @@ -72,6 +72,8 @@ * `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options` * * `comment` is not in `acorn.Options` and doesn't err without it, but is used + */ +/** * @typedef {{ * allowReserved?: boolean, * ecmaVersion?: acorn.ecmaVersion, diff --git a/lib/espree.js b/lib/espree.js index 57cb1c80..d0ff4ecc 100644 --- a/lib/espree.js +++ b/lib/espree.js @@ -15,8 +15,9 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * column?: number; * } & SyntaxError} EnhancedSyntaxError */ + +// We add `jsxAttrValueToken` ourselves. /** - * We add `jsxAttrValueToken` ourselves. * @typedef {{ * jsxAttrValueToken?: acorn.TokenType; * } & tokTypesType} EnhancedTokTypes @@ -50,9 +51,12 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * @local * @typedef {number} int */ + +/** + * First three properties as in `acorn.Comment`; next two as in `acorn.Comment` + * but optional. Last is different as has to allow `undefined` + */ /** - * First three properties as in `acorn.Comment`; next two as in `acorn.Comment` - * but optional. Last is different as has to allow `undefined` * @local * * @typedef {{ diff --git a/lib/token-translator.js b/lib/token-translator.js index ec0747f8..a4585691 100644 --- a/lib/token-translator.js +++ b/lib/token-translator.js @@ -29,6 +29,8 @@ * `loc` and `range` are from `acorn.Token` * * Adds `regex`. + */ +/** * @local * * @typedef {{ From b4e7aa7fa45444140f69f52e3f1e246cda68e584 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Mon, 9 May 2022 16:06:31 +0800 Subject: [PATCH 11/24] docs: switch to interface expectation for `AcornJsxParser` per changes in acorn-jsx PR --- dist/lib/espree.d.ts | 2 +- dist/lib/espree.d.ts.map | 2 +- espree.js | 2 +- lib/espree.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/lib/espree.d.ts b/dist/lib/espree.d.ts index e1f2868c..8e0a977b 100644 --- a/dist/lib/espree.d.ts +++ b/dist/lib/espree.d.ts @@ -1,4 +1,4 @@ -declare function _default(): (Parser: typeof import('acorn-jsx').AcornJsxParser) => typeof EspreeParser; +declare function _default(): (Parser: import('acorn-jsx').AcornJsxParser) => typeof EspreeParser; export default _default; export class EspreeParser extends acorn.Parser { /** diff --git a/dist/lib/espree.d.ts.map b/dist/lib/espree.d.ts.map index 3be68e3d..50e3cc78 100644 --- a/dist/lib/espree.d.ts.map +++ b/dist/lib/espree.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"espree.d.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AAC,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;QAAC,QAAQ,CAAC,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE;gBAAC,KAAK,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;gBAAC,GAAG,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAA;aAAC,CAAA;SAAC,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,OAAO,EAAE,KAAK,EAAE,CAAC;QAAC,IAAI,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,CAAA;KAAC,GAAG,OAAO,OAAO,EAAE,IAAI,CAI9V;IAsBO;;;;;;OAMG;IACH,sBALW,MAAM,WACN,MAAM,GAEJ,IAAI,CAIxB;IAYO;;;;;;;;OAQG;IACH,sBAHW,MAAM,GACJ,IAAI,CAIxB;CACJ;kCAzaY;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,WAAW;+BAIpE;IAAC,iBAAiB,CAAC,EAAE,OAAO,OAAO,EAAE,SAAS,CAAA;CAAC,GAAG,cAAc,WAAW,EAAE,QAAQ"} \ No newline at end of file diff --git a/espree.js b/espree.js index 84683b8b..59840c62 100644 --- a/espree.js +++ b/espree.js @@ -96,7 +96,7 @@ /** * @local * @typedef {import('acorn')} acorn - * @typedef {typeof import('acorn-jsx').AcornJsxParser} AcornJsxParser + * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser * @typedef {import('./lib/espree').EnhancedSyntaxError} EnhancedSyntaxError * @typedef {typeof import('./lib/espree').EspreeParser} IEspreeParser */ diff --git a/lib/espree.js b/lib/espree.js index d0ff4ecc..340d668c 100644 --- a/lib/espree.js +++ b/lib/espree.js @@ -30,7 +30,7 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * @local * @typedef {import('acorn')} acorn * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType - * @typedef {typeof import('acorn-jsx').AcornJsxParser} AcornJsxParser + * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser * @typedef {import('../espree').ParserOptions} ParserOptions */ From 894537f091156a83f041edb40bbee66751305c35 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Mon, 9 May 2022 17:43:24 +0800 Subject: [PATCH 12/24] fix: `tokens` not allowed as `null` --- dist/espree.d.ts | 2 +- dist/espree.d.ts.map | 2 +- espree.js | 2 +- lib/options.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/espree.d.ts b/dist/espree.d.ts index 543ae9b7..8e046398 100644 --- a/dist/espree.d.ts +++ b/dist/espree.d.ts @@ -33,7 +33,7 @@ export type ParserOptions = { }; range?: boolean; loc?: boolean; - tokens?: boolean | null; + tokens?: boolean; comment?: boolean; }; import * as visitorKeys from "eslint-visitor-keys"; diff --git a/dist/espree.d.ts.map b/dist/espree.d.ts.map index 8e458c43..811411e0 100644 --- a/dist/espree.d.ts.map +++ b/dist/espree.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"espree.d.ts","sourceRoot":"","sources":["../tmp/espree.js"],"names":[],"mappings":"AAgHA;;;;;;;GAOG;AACH,+BANW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,CAU1C;AAED;;;;;;GAMG;AACH,4BALW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,IAAI,CAMhC;AACD,6BAAqC;AACrC,kDAEI;AACJ;;EAYI;AACJ,uCAAwD;AACxD,6CAAgE;4BAlGnD;IAA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AA;CAAC"} \ No newline at end of file diff --git a/espree.js b/espree.js index 59840c62..83cda548 100644 --- a/espree.js +++ b/espree.js @@ -85,7 +85,7 @@ * }, * range?: boolean, * loc?: boolean, - * tokens?: boolean | null, + * tokens?: boolean, * comment?: boolean, * }} ParserOptions */ diff --git a/lib/options.js b/lib/options.js index 20ab23b8..70f4e355 100644 --- a/lib/options.js +++ b/lib/options.js @@ -30,7 +30,7 @@ * ranges: boolean, * locations: boolean, * allowReturnOutsideFunction: boolean, - * tokens?: boolean | null, + * tokens?: boolean, * comment?: boolean * }} NormalizedParserOptions */ From 9b0348c9958cbbb5e8c0d0cdbcca547ef7ba865e Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 10 May 2022 08:29:27 +0800 Subject: [PATCH 13/24] refactor: resume using `acorn.Parser.extend` --- espree.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/espree.js b/espree.js index 83cda548..3b828a2e 100644 --- a/espree.js +++ b/espree.js @@ -120,10 +120,15 @@ const parsers = { */ get regular() { if (this._regular === null) { - const espreeParserFactory = espree(); + const espreeParserFactory = /** @type {unknown} */ (espree()); - // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts - this._regular = espreeParserFactory(/** @type {AcornJsxParser} */ (acorn.Parser)); + this._regular = /** @type {IEspreeParser} */ ( + acorn.Parser.extend( + + /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */ + (espreeParserFactory) + ) + ); } return this._regular; }, @@ -134,11 +139,17 @@ const parsers = { */ get jsx() { if (this._jsx === null) { - const espreeParserFactory = espree(); + const espreeParserFactory = /** @type {unknown} */ (espree()); const jsxFactory = jsx(); - // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts - this._jsx = espreeParserFactory(jsxFactory(acorn.Parser)); + this._jsx = /** @type {IEspreeParser} */ ( + acorn.Parser.extend( + jsxFactory, + + /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */ + (espreeParserFactory) + ) + ); } return this._jsx; }, From 616deb480b960aa4984ae324a21456fa60195629 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 10 May 2022 09:11:11 +0800 Subject: [PATCH 14/24] refactor: point to own `ecmaVersion` independent of Acorn --- dist/espree.d.ts | 3 ++- dist/espree.d.ts.map | 2 +- dist/lib/token-translator.d.ts.map | 2 +- espree.js | 8 ++++++-- lib/espree.js | 4 +--- lib/options.js | 3 ++- lib/token-translator.js | 5 +++-- 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/dist/espree.d.ts b/dist/espree.d.ts index 8e046398..7a27170e 100644 --- a/dist/espree.d.ts +++ b/dist/espree.d.ts @@ -22,9 +22,10 @@ export const Syntax: { }; export const latestEcmaVersion: number; export const supportedEcmaVersions: number[]; +export type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 'latest'; export type ParserOptions = { allowReserved?: boolean; - ecmaVersion?: import('acorn').ecmaVersion; + ecmaVersion?: ecmaVersion; sourceType?: "script" | "module" | "commonjs"; ecmaFeatures?: { jsx?: boolean; diff --git a/dist/espree.d.ts.map b/dist/espree.d.ts.map index 811411e0..e8e4e438 100644 --- a/dist/espree.d.ts.map +++ b/dist/espree.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"espree.d.ts","sourceRoot":"","sources":["../tmp/espree.js"],"names":[],"mappings":"AAgHA;;;;;;;GAOG;AACH,+BANW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,CAU1C;AAED;;;;;;GAMG;AACH,4BALW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,IAAI,CAMhC;AACD,6BAAqC;AACrC,kDAEI;AACJ;;EAYI;AACJ,uCAAwD;AACxD,6CAAgE;4BAlGnD;IAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,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AAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAC"} \ No newline at end of file diff --git a/dist/lib/token-translator.d.ts.map b/dist/lib/token-translator.d.ts.map index 8b3d3659..4cffda18 100644 --- a/dist/lib/token-translator.d.ts.map +++ b/dist/lib/token-translator.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"token-translator.d.ts","sourceRoot":"","sources":["../../tmp/lib/token-translator.js"],"names":[],"mappings":";AA+DA;IAEI;;;;;OAKG;IACH,2BAJW,OAAO,eAAe,EAAE,gBAAgB,QACxC,MAAM,EAQhB;IAJG,yDAAmC;IAC3B,wCAAwC,CAAC,SAA9B,CAAC,OAAO,OAAO,EAAE,KAAK,CAAC,EAAE,CAAsB;IAClE,0CAAuB;IACvB,cAAiB;IAGrB;;;;;;;OAOG;IACH,iBAJW,OAAO,OAAO,EAAE,KAAK,SACrB;QAAC,iBAAiB,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,OAAO,EAAE,WAAW,CAAA;KAAC;cAC7D,MAAM;;eAAY,GAAG;;;;;;mBAAgH,MAAM;qBAAW,MAAM;;MAkD/K;IAED;;;;;OAKG;IACH,eAJW,OAAO,OAAO,EAAE,KAAK;gBACZ,CAAC;YAAC,IAAI,EAAE,MAAM,GAAG,OAAO,OAAO,EAAE,SAAS,CAAA;SAAC,GAAG;YAAC,KAAK,EAAE,GAAG,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,OAAO,OAAO,EAAE,cAAc,CAAC;YAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAAC,KAAK,CAAC,EAAE;gBAAC,KAAK,EAAE,MAAM,CAAC;gBAAC,OAAO,EAAE,MAAM,CAAA;aAAC,CAAA;SAAC,CAAC,EAAE;;2BAAwB,OAAO;qBAAe,OAAO,OAAO,EAAE,WAAW;QACrR,IAAI,CAyDhB;CACJ"} \ No newline at end of file +{"version":3,"file":"token-translator.d.ts","sourceRoot":"","sources":["../../tmp/lib/token-translator.js"],"names":[],"mappings":";AA+DA;IAEI;;;;;OAKG;IACH,2BAJW,OAAO,UAAU,EAAE,gBAAgB,QACnC,MAAM,EAQhB;IAJG,oDAAmC;IAC3B,wCAAwC,CAAC,SAA9B,CAAC,OAAO,OAAO,EAAE,KAAK,CAAC,EAAE,CAAsB;IAClE,0CAAuB;IACvB,cAAiB;IAGrB;;;;;;;OAOG;IACH,iBAJW,OAAO,OAAO,EAAE,KAAK,SACrB;QAAC,iBAAiB,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,WAAW,EAAE,WAAW,CAAA;KAAC;cACjE,MAAM;;eAAY,GAAG;;;;;;mBAAgH,MAAM;qBAAW,MAAM;;MAkD/K;IAED;;;;;OAKG;IACH,eAJW,OAAO,OAAO,EAAE,KAAK;gBACZ,CAAC;YAAC,IAAI,EAAE,MAAM,GAAG,OAAO,OAAO,EAAE,SAAS,CAAA;SAAC,GAAG;YAAC,KAAK,EAAE,GAAG,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,OAAO,OAAO,EAAE,cAAc,CAAC;YAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAAC,KAAK,CAAC,EAAE;gBAAC,KAAK,EAAE,MAAM,CAAC;gBAAC,OAAO,EAAE,MAAM,CAAA;aAAC,CAAA;SAAC,CAAC,EAAE;;2BAAwB,OAAO;qBAAe,OAAO,WAAW,EAAE,WAAW;QACzR,IAAI,CAyDhB;CACJ"} \ No newline at end of file diff --git a/espree.js b/espree.js index 3b828a2e..1af67fea 100644 --- a/espree.js +++ b/espree.js @@ -59,13 +59,17 @@ // ---------------------------------------------------------------------------- // Types exported from file // ---------------------------------------------------------------------------- +/** + * @typedef {3|5|6|7|8|9|10|11|12|13|2015|2016|2017|2018|2019|2020|2021|2022|'latest'} ecmaVersion + */ + /** * `jsx.Options` gives us 2 optional properties, so extend it * * `allowReserved`, `ranges`, `locations`, `allowReturnOutsideFunction`, * `onToken`, and `onComment` are as in `acorn.Options` * - * `ecmaVersion` as in `acorn.Options` though optional + * `ecmaVersion` currently as in `acorn.Options` though optional * * `sourceType` as in `acorn.Options` but also allows `commonjs` * @@ -76,7 +80,7 @@ /** * @typedef {{ * allowReserved?: boolean, - * ecmaVersion?: acorn.ecmaVersion, + * ecmaVersion?: ecmaVersion, * sourceType?: "script"|"module"|"commonjs", * ecmaFeatures?: { * jsx?: boolean, diff --git a/lib/espree.js b/lib/espree.js index 340d668c..5848bd50 100644 --- a/lib/espree.js +++ b/lib/espree.js @@ -32,6 +32,7 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser * @typedef {import('../espree').ParserOptions} ParserOptions + * @typedef {import('../espree').ecmaVersion} ecmaVersion */ // ---------------------------------------------------------------------------- @@ -39,9 +40,6 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); // ---------------------------------------------------------------------------- /** * @local - * - * @typedef {acorn.ecmaVersion} ecmaVersion - * * @typedef {{ * generator?: boolean * } & acorn.Node} EsprimaNode diff --git a/lib/options.js b/lib/options.js index 70f4e355..40df434e 100644 --- a/lib/options.js +++ b/lib/options.js @@ -9,6 +9,7 @@ /** * @local * @typedef {import('../espree').ParserOptions} ParserOptions + * @typedef {import('../espree').ecmaVersion} ecmaVersion */ // ---------------------------------------------------------------------------- @@ -17,7 +18,7 @@ /** * @local * @typedef {{ - * ecmaVersion: 10 | 9 | 8 | 7 | 6 | 5 | 3 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | "latest", + * ecmaVersion: ecmaVersion, * sourceType: "script"|"module", * range?: boolean, * loc?: boolean, diff --git a/lib/token-translator.js b/lib/token-translator.js index a4585691..062986e4 100644 --- a/lib/token-translator.js +++ b/lib/token-translator.js @@ -10,7 +10,8 @@ /** * @local * @typedef {import('acorn')} acorn - * @typedef {import('../lib/espree').EnhancedTokTypes} EnhancedTokTypes + * @typedef {import('./espree').EnhancedTokTypes} EnhancedTokTypes + * @typedef {import('../espree').ecmaVersion} ecmaVersion */ // ---------------------------------------------------------------------------- @@ -52,7 +53,7 @@ * * @typedef {{ * jsxAttrValueToken: boolean; - * ecmaVersion: acorn.ecmaVersion; + * ecmaVersion: ecmaVersion; * }} ExtraNoTokens * * @typedef {{ From 968d5d90472ef2f25926657a3021638e44229514 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Wed, 11 May 2022 07:41:37 +0800 Subject: [PATCH 15/24] docs: avoid return type of `null` for tokenize --- dist/espree.d.ts | 4 ++-- dist/espree.d.ts.map | 2 +- espree.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/espree.d.ts b/dist/espree.d.ts index 7a27170e..b6ff73ad 100644 --- a/dist/espree.d.ts +++ b/dist/espree.d.ts @@ -2,11 +2,11 @@ * Tokenizes the given code. * @param {string} code The code to tokenize. * @param {ParserOptions} options Options defining how to tokenize. - * @returns {import('acorn').Token[] | null} An array of tokens. + * @returns {import('acorn').Token[]} An array of tokens. * @throws {import('./lib/espree').EnhancedSyntaxError} If the input code is invalid. * @private */ -export function tokenize(code: string, options: ParserOptions): import('acorn').Token[] | null; +export function tokenize(code: string, options: ParserOptions): import('acorn').Token[]; /** * Parses the given code. * @param {string} code The code to tokenize. diff --git a/dist/espree.d.ts.map b/dist/espree.d.ts.map index e8e4e438..e12a2969 100644 --- a/dist/espree.d.ts.map +++ b/dist/espree.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"espree.d.ts","sourceRoot":"","sources":["../tmp/espree.js"],"names":[],"mappings":"AAoHA;;;;;;;GAOG;AACH,+BANW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,CAU1C;AAED;;;;;;GAMG;AACH,4BALW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,IAAI,CAMhC;AACD,6BAAqC;AACrC,kDAEI;AACJ;;EAYI;AACJ,uCAAwD;AACxD,6CAAgE;0BAhHnD,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ;4BAc5G;IAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IAAC,YAAY,CAAC,EAAE;QAAC,GAAG,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAC"} \ No newline at end of file +{"version":3,"file":"espree.d.ts","sourceRoot":"","sources":["../tmp/espree.js"],"names":[],"mappings":"AAoHA;;;;;;;GAOG;AACH,+BANW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,KAAK,EAAE,CAUnC;AAED;;;;;;GAMG;AACH,4BALW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,IAAI,CAMhC;AACD,6BAAqC;AACrC,kDAEI;AACJ;;EAYI;AACJ,uCAAwD;AACxD,6CAAgE;0BAhHnD,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ;4BAc5G;IAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IAAC,YAAY,CAAC,EAAE;QAAC,GAAG,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAC"} \ No newline at end of file diff --git a/espree.js b/espree.js index 1af67fea..94c997cc 100644 --- a/espree.js +++ b/espree.js @@ -182,7 +182,7 @@ const parsers = { * Tokenizes the given code. * @param {string} code The code to tokenize. * @param {ParserOptions} options Options defining how to tokenize. - * @returns {acorn.Token[]|null} An array of tokens. + * @returns {acorn.Token[]} An array of tokens. * @throws {EnhancedSyntaxError} If the input code is invalid. * @private */ @@ -194,7 +194,7 @@ export function tokenize(code, options) { options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign } - return new Parser(options, code).tokenize(); + return /** @type {acorn.Token[]} */ (new Parser(options, code).tokenize()); } //------------------------------------------------------------------------------ From 4680aec013912ffe00d67fa7a3f02f05f4288299 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Wed, 11 May 2022 08:14:33 +0800 Subject: [PATCH 16/24] docs: indicate return of EspreeTokens from `tokenize` --- dist/espree.cjs | 81 +++++++++++++++++------------- dist/espree.cjs.map | 2 +- dist/espree.d.ts | 9 +++- dist/espree.d.ts.map | 2 +- dist/lib/espree.d.ts | 43 ++++++---------- dist/lib/espree.d.ts.map | 2 +- dist/lib/token-translator.d.ts.map | 2 +- espree.js | 18 ++++++- lib/espree.js | 20 ++++---- lib/token-translator.js | 18 +++---- 10 files changed, 106 insertions(+), 91 deletions(-) diff --git a/dist/espree.cjs b/dist/espree.cjs index 437d7bf4..85b38b42 100644 --- a/dist/espree.cjs +++ b/dist/espree.cjs @@ -42,7 +42,8 @@ var visitorKeys__namespace = /*#__PURE__*/_interopNamespace(visitorKeys); /** * @local * @typedef {import('acorn')} acorn - * @typedef {import('../lib/espree').EnhancedTokTypes} EnhancedTokTypes + * @typedef {import('./espree').EnhancedTokTypes} EnhancedTokTypes + * @typedef {import('../espree').ecmaVersion} ecmaVersion */ // ---------------------------------------------------------------------------- @@ -75,23 +76,21 @@ var visitorKeys__namespace = /*#__PURE__*/_interopNamespace(visitorKeys); * }} BaseEsprimaToken * * @typedef {{ - * type: string; - * } & BaseEsprimaToken} EsprimaToken - * - * @typedef {{ - * type: string | acorn.TokenType; - * } & BaseEsprimaToken} EsprimaTokenFlexible - * - * @typedef {{ * jsxAttrValueToken: boolean; - * ecmaVersion: acorn.ecmaVersion; + * ecmaVersion: ecmaVersion; * }} ExtraNoTokens * * @typedef {{ - * tokens: EsprimaTokenFlexible[] + * tokens: EsprimaToken[] * } & ExtraNoTokens} Extra */ +/** + * @typedef {{ + * type: string; + * } & BaseEsprimaToken} EsprimaToken + */ + //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ @@ -179,7 +178,7 @@ class TokenTranslator { } /** - * Translates a single Esprima token to a single Acorn token. This may be + * Translates a single Acorn token to a single Esprima 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 {acorn.Token} token The Acorn token to translate. @@ -364,6 +363,7 @@ class TokenTranslator { /** * @local * @typedef {import('../espree').ParserOptions} ParserOptions + * @typedef {import('../espree').ecmaVersion} ecmaVersion */ // ---------------------------------------------------------------------------- @@ -372,7 +372,7 @@ class TokenTranslator { /** * @local * @typedef {{ - * ecmaVersion: 10 | 9 | 8 | 7 | 6 | 5 | 3 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | "latest", + * ecmaVersion: ecmaVersion, * sourceType: "script"|"module", * range?: boolean, * loc?: boolean, @@ -385,7 +385,7 @@ class TokenTranslator { * ranges: boolean, * locations: boolean, * allowReturnOutsideFunction: boolean, - * tokens?: boolean | null, + * tokens?: boolean, * comment?: boolean * }} NormalizedParserOptions */ @@ -541,8 +541,9 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * @local * @typedef {import('acorn')} acorn * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType - * @typedef {typeof import('acorn-jsx').AcornJsxParser} AcornJsxParser + * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser * @typedef {import('../espree').ParserOptions} ParserOptions + * @typedef {import('../espree').ecmaVersion} ecmaVersion */ // ---------------------------------------------------------------------------- @@ -550,9 +551,6 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); // ---------------------------------------------------------------------------- /** * @local - * - * @typedef {acorn.ecmaVersion} ecmaVersion - * * @typedef {{ * generator?: boolean * } & acorn.Node} EsprimaNode @@ -564,12 +562,6 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); */ /** - * First three properties as in `acorn.Comment`; next two as in `acorn.Comment` - * but optional. Last is different as has to allow `undefined` - */ -/** - * @local - * * @typedef {{ * type: string, * value: string, @@ -581,10 +573,16 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * end: acorn.Position | undefined * } * }} EsprimaComment + */ + +/** + * First two properties as in `acorn.Comment`; next two as in `acorn.Comment` + * but optional. Last is different as has to allow `undefined` + */ +/** + * @local * - * @typedef {{ - * comments?: EsprimaComment[] - * } & acorn.Token[]} EspreeTokens + * @typedef {import('../espree').EspreeTokens} EspreeTokens * * @typedef {{ * tail?: boolean @@ -611,7 +609,7 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * @typedef {{ * sourceType?: "script"|"module"|"commonjs"; * comments?: EsprimaComment[]; - * tokens?: acorn.Token[]; + * tokens?: EspreeTokens; * body: acorn.Node[]; * } & acorn.Node} EsprimaProgramNode */ @@ -1112,10 +1110,15 @@ const parsers = { */ get regular() { if (this._regular === null) { - const espreeParserFactory = espree(); + const espreeParserFactory = /** @type {unknown} */ (espree()); + + this._regular = /** @type {IEspreeParser} */ ( + acorn__namespace.Parser.extend( - // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts - this._regular = espreeParserFactory(/** @type {AcornJsxParser} */ (acorn__namespace.Parser)); + /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */ + (espreeParserFactory) + ) + ); } return this._regular; }, @@ -1126,11 +1129,17 @@ const parsers = { */ get jsx() { if (this._jsx === null) { - const espreeParserFactory = espree(); + const espreeParserFactory = /** @type {unknown} */ (espree()); const jsxFactory = jsx__default["default"](); - // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts - this._jsx = espreeParserFactory(jsxFactory(acorn__namespace.Parser)); + this._jsx = /** @type {IEspreeParser} */ ( + acorn__namespace.Parser.extend( + jsxFactory, + + /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */ + (espreeParserFactory) + ) + ); } return this._jsx; }, @@ -1159,7 +1168,7 @@ const parsers = { * Tokenizes the given code. * @param {string} code The code to tokenize. * @param {ParserOptions} options Options defining how to tokenize. - * @returns {acorn.Token[]|null} An array of tokens. + * @returns {EspreeTokens} An array of tokens. * @throws {EnhancedSyntaxError} If the input code is invalid. * @private */ @@ -1171,7 +1180,7 @@ function tokenize(code, options) { options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign } - return new Parser(options, code).tokenize(); + return /** @type {EspreeTokens} */ (new Parser(options, code).tokenize()); } //------------------------------------------------------------------------------ diff --git a/dist/espree.cjs.map b/dist/espree.cjs.map index 1a034863..e6dc7834 100644 --- a/dist/espree.cjs.map +++ b/dist/espree.cjs.map @@ -1 +1 @@ -{"version":3,"file":"espree.cjs","sources":["../lib/token-translator.js","../lib/options.js","../lib/espree.js","../lib/version.js","../espree.js"],"sourcesContent":["/**\n * @fileoverview Translates tokens between Acorn format and Esprima format.\n * @author Nicholas C. Zakas\n */\n/* eslint no-underscore-dangle: 0 */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('../lib/espree').EnhancedTokTypes} EnhancedTokTypes\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * Based on the `acorn.Token` class, but without a fixed `type` (since we need\n * it to be a string). Avoiding `type` lets us make one extending interface\n * more strict and another more lax.\n *\n * We could make `value` more strict to `string` even though the original is\n * `any`.\n *\n * `start` and `end` are required in `acorn.Token`\n *\n * `loc` and `range` are from `acorn.Token`\n *\n * Adds `regex`.\n */\n/**\n * @local\n *\n * @typedef {{\n * value: any;\n * start?: number;\n * end?: number;\n * loc?: acorn.SourceLocation;\n * range?: [number, number];\n * regex?: {flags: string, pattern: string};\n * }} BaseEsprimaToken\n *\n * @typedef {{\n * type: string;\n * } & BaseEsprimaToken} EsprimaToken\n *\n * @typedef {{\n * type: string | acorn.TokenType;\n * } & BaseEsprimaToken} EsprimaTokenFlexible\n *\n * @typedef {{\n * jsxAttrValueToken: boolean;\n * ecmaVersion: acorn.ecmaVersion;\n * }} ExtraNoTokens\n *\n * @typedef {{\n * tokens: EsprimaTokenFlexible[]\n * } & ExtraNoTokens} Extra\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\n// none!\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n\n// Esprima Token Types\nconst Token = {\n Boolean: \"Boolean\",\n EOF: \"\",\n Identifier: \"Identifier\",\n PrivateIdentifier: \"PrivateIdentifier\",\n Keyword: \"Keyword\",\n Null: \"Null\",\n Numeric: \"Numeric\",\n Punctuator: \"Punctuator\",\n String: \"String\",\n RegularExpression: \"RegularExpression\",\n Template: \"Template\",\n JSXIdentifier: \"JSXIdentifier\",\n JSXText: \"JSXText\"\n};\n\n/**\n * Converts part of a template into an Esprima token.\n * @param {(acorn.Token)[]} tokens The Acorn tokens representing the template.\n * @param {string} code The source code.\n * @returns {EsprimaToken} The Esprima equivalent of the template token.\n * @private\n */\nfunction convertTemplatePart(tokens, code) {\n const firstToken = tokens[0],\n lastTemplateToken = tokens[tokens.length - 1];\n\n /** @type {EsprimaToken} */\n const token = {\n type: Token.Template,\n value: code.slice(firstToken.start, lastTemplateToken.end)\n };\n\n if (firstToken.loc && lastTemplateToken.loc) {\n token.loc = {\n start: firstToken.loc.start,\n end: lastTemplateToken.loc.end\n };\n }\n\n if (firstToken.range && lastTemplateToken.range) {\n token.start = firstToken.range[0];\n token.end = lastTemplateToken.range[1];\n token.range = [token.start, token.end];\n }\n\n return token;\n}\n\nclass TokenTranslator {\n\n /**\n * Contains logic to translate Acorn tokens into Esprima tokens.\n * @param {EnhancedTokTypes} acornTokTypes The Acorn token types.\n * @param {string} code The source code Acorn is parsing. This is necessary\n * to correct the \"value\" property of some tokens.\n */\n constructor(acornTokTypes, code) {\n\n // token types\n this._acornTokTypes = acornTokTypes;\n\n // token buffer for templates\n /** @type {(acorn.Token)[]} */\n this._tokens = [];\n\n // track the last curly brace\n this._curlyBrace = null;\n\n // the source code\n this._code = code;\n\n }\n\n /**\n * Translates a single Esprima token to a single Acorn token. This may be\n * inaccurate due to how templates are handled differently in Esprima and\n * Acorn, but should be accurate for all other tokens.\n * @param {acorn.Token} token The Acorn token to translate.\n * @param {ExtraNoTokens} extra Espree extra object.\n * @returns {EsprimaToken} The Esprima version of the token.\n */\n translate(token, extra) {\n\n const type = token.type,\n tt = this._acornTokTypes,\n\n // We use an unknown type because `acorn.Token` is a class whose\n // `type` property we cannot override to our desired `string`;\n // this also allows us to define a stricter `EsprimaToken` with\n // a string-only `type` property\n unknownType = /** @type {unknown} */ (token),\n newToken = /** @type {EsprimaToken} */ (unknownType);\n\n if (type === tt.name) {\n newToken.type = Token.Identifier;\n\n // TODO: See if this is an Acorn bug\n if (token.value === \"static\") {\n newToken.type = Token.Keyword;\n }\n\n if (extra.ecmaVersion > 5 && (token.value === \"yield\" || token.value === \"let\")) {\n newToken.type = Token.Keyword;\n }\n\n } else if (type === tt.privateId) {\n newToken.type = Token.PrivateIdentifier;\n\n } else if (type === tt.semi || type === tt.comma ||\n type === tt.parenL || type === tt.parenR ||\n type === tt.braceL || type === tt.braceR ||\n type === tt.dot || type === tt.bracketL ||\n type === tt.colon || type === tt.question ||\n type === tt.bracketR || type === tt.ellipsis ||\n type === tt.arrow || type === tt.jsxTagStart ||\n type === tt.incDec || type === tt.starstar ||\n type === tt.jsxTagEnd || type === tt.prefix ||\n type === tt.questionDot ||\n (type.binop && !type.keyword) ||\n type.isAssign) {\n\n newToken.type = Token.Punctuator;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.jsxName) {\n newToken.type = Token.JSXIdentifier;\n } else if (type.label === \"jsxText\" || type === tt.jsxAttrValueToken) {\n newToken.type = Token.JSXText;\n } else if (type.keyword) {\n if (type.keyword === \"true\" || type.keyword === \"false\") {\n newToken.type = Token.Boolean;\n } else if (type.keyword === \"null\") {\n newToken.type = Token.Null;\n } else {\n newToken.type = Token.Keyword;\n }\n } else if (type === tt.num) {\n newToken.type = Token.Numeric;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.string) {\n\n if (extra.jsxAttrValueToken) {\n extra.jsxAttrValueToken = false;\n newToken.type = Token.JSXText;\n } else {\n newToken.type = Token.String;\n }\n\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.regexp) {\n newToken.type = Token.RegularExpression;\n const value = token.value;\n\n newToken.regex = {\n flags: value.flags,\n pattern: value.pattern\n };\n newToken.value = `/${value.pattern}/${value.flags}`;\n }\n\n return newToken;\n }\n\n /**\n * Function to call during Acorn's onToken handler.\n * @param {acorn.Token} token The Acorn token.\n * @param {Extra} extra The Espree extra object.\n * @returns {void}\n */\n onToken(token, extra) {\n\n const that = this,\n tt = this._acornTokTypes,\n tokens = extra.tokens,\n templateTokens = this._tokens;\n\n /**\n * Flushes the buffered template tokens and resets the template\n * tracking.\n * @returns {void}\n * @private\n */\n function translateTemplateTokens() {\n tokens.push(convertTemplatePart(that._tokens, that._code));\n that._tokens = [];\n }\n\n if (token.type === tt.eof) {\n\n // might be one last curlyBrace\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n return;\n }\n\n if (token.type === tt.backQuote) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n\n // it's the end\n if (templateTokens.length > 1) {\n translateTemplateTokens();\n }\n\n return;\n }\n if (token.type === tt.dollarBraceL) {\n templateTokens.push(token);\n translateTemplateTokens();\n return;\n }\n if (token.type === tt.braceR) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n // store new curly for later\n this._curlyBrace = token;\n return;\n }\n if (token.type === tt.template || token.type === tt.invalidTemplate) {\n if (this._curlyBrace) {\n templateTokens.push(this._curlyBrace);\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n return;\n }\n\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n tokens.push(this.translate(token, extra));\n }\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport default TokenTranslator;\n","/**\n * @fileoverview A collection of methods for processing Espree's options.\n * @author Kai Cataldo\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('../espree').ParserOptions} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * ecmaVersion: 10 | 9 | 8 | 7 | 6 | 5 | 3 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | \"latest\",\n * sourceType: \"script\"|\"module\",\n * range?: boolean,\n * loc?: boolean,\n * allowReserved: boolean | \"never\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * ranges: boolean,\n * locations: boolean,\n * allowReturnOutsideFunction: boolean,\n * tokens?: boolean | null,\n * comment?: boolean\n * }} NormalizedParserOptions\n */\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst SUPPORTED_VERSIONS = [\n 3,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13\n];\n\n/**\n * Get the latest ECMAScript version supported by Espree.\n * @returns {number} The latest ECMAScript version.\n */\nexport function getLatestEcmaVersion() {\n return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1];\n}\n\n/**\n * Get the list of ECMAScript versions supported by Espree.\n * @returns {number[]} An array containing the supported ECMAScript versions.\n */\nexport function getSupportedEcmaVersions() {\n return [...SUPPORTED_VERSIONS];\n}\n\n/**\n * Normalize ECMAScript version from the initial config\n * @param {number|\"latest\"} ecmaVersion ECMAScript version from the initial config\n * @throws {Error} throws an error if the ecmaVersion is invalid.\n * @returns {number} normalized ECMAScript version\n */\nfunction normalizeEcmaVersion(ecmaVersion = 5) {\n\n let version = ecmaVersion === \"latest\" ? getLatestEcmaVersion() : ecmaVersion;\n\n if (typeof version !== \"number\") {\n throw new Error(`ecmaVersion must be a number or \"latest\". Received value of type ${typeof ecmaVersion} instead.`);\n }\n\n // Calculate ECMAScript edition number from official year version starting with\n // ES2015, which corresponds with ES6 (or a difference of 2009).\n if (version >= 2015) {\n version -= 2009;\n }\n\n if (!SUPPORTED_VERSIONS.includes(version)) {\n throw new Error(\"Invalid ecmaVersion.\");\n }\n\n return version;\n}\n\n/**\n * Normalize sourceType from the initial config\n * @param {\"script\"|\"module\"|\"commonjs\"} sourceType to normalize\n * @throws {Error} throw an error if sourceType is invalid\n * @returns {\"script\"|\"module\"} normalized sourceType\n */\nfunction normalizeSourceType(sourceType = \"script\") {\n if (sourceType === \"script\" || sourceType === \"module\") {\n return sourceType;\n }\n\n if (sourceType === \"commonjs\") {\n return \"script\";\n }\n\n throw new Error(\"Invalid sourceType.\");\n}\n\n/**\n * Normalize parserOptions\n * @param {ParserOptions} options the parser options to normalize\n * @throws {Error} throw an error if found invalid option.\n * @returns {NormalizedParserOptions} normalized options\n */\nexport function normalizeOptions(options) {\n const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion);\n\n /** @type {\"script\"|\"module\"} */\n const sourceType = normalizeSourceType(options.sourceType);\n const ranges = options.range === true;\n const locations = options.loc === true;\n\n if (ecmaVersion !== 3 && options.allowReserved) {\n\n // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed\n throw new Error(\"`allowReserved` is only supported when ecmaVersion is 3\");\n }\n\n // Note: value in Acorn can also be \"never\" but we throw in such a case\n if (typeof options.allowReserved !== \"undefined\" && typeof options.allowReserved !== \"boolean\") {\n throw new Error(\"`allowReserved`, when present, must be `true` or `false`\");\n }\n const allowReserved = ecmaVersion === 3 ? (options.allowReserved || \"never\") : false;\n const ecmaFeatures = options.ecmaFeatures || {};\n const allowReturnOutsideFunction = options.sourceType === \"commonjs\" ||\n Boolean(ecmaFeatures.globalReturn);\n\n if (sourceType === \"module\" && ecmaVersion < 6) {\n throw new Error(\"sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.\");\n }\n\n return Object.assign({}, options, {\n ecmaVersion,\n sourceType,\n ranges,\n locations,\n allowReserved,\n allowReturnOutsideFunction\n });\n}\n","/* eslint-disable no-param-reassign*/\nimport TokenTranslator from \"./token-translator.js\";\nimport { normalizeOptions } from \"./options.js\";\n\nconst STATE = Symbol(\"espree's internal state\");\nconst ESPRIMA_FINISH_NODE = Symbol(\"espree's esprimaFinishNode\");\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {{\n * index?: number;\n * lineNumber?: number;\n * column?: number;\n * } & SyntaxError} EnhancedSyntaxError\n */\n\n// We add `jsxAttrValueToken` ourselves.\n/**\n * @typedef {{\n * jsxAttrValueToken?: acorn.TokenType;\n * } & tokTypesType} EnhancedTokTypes\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType\n * @typedef {typeof import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('../espree').ParserOptions} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n *\n * @typedef {acorn.ecmaVersion} ecmaVersion\n *\n * @typedef {{\n * generator?: boolean\n * } & acorn.Node} EsprimaNode\n */\n/**\n * Suggests an integer\n * @local\n * @typedef {number} int\n */\n\n/**\n * First three properties as in `acorn.Comment`; next two as in `acorn.Comment`\n * but optional. Last is different as has to allow `undefined`\n */\n/**\n * @local\n *\n * @typedef {{\n * type: string,\n * value: string,\n * range?: [number, number],\n * start?: number,\n * end?: number,\n * loc?: {\n * start: acorn.Position | undefined,\n * end: acorn.Position | undefined\n * }\n * }} EsprimaComment\n *\n * @typedef {{\n * comments?: EsprimaComment[]\n * } & acorn.Token[]} EspreeTokens\n *\n * @typedef {{\n * tail?: boolean\n * } & acorn.Node} AcornTemplateNode\n *\n * @typedef {{\n * originalSourceType: \"script\"|\"module\"|\"commonjs\";\n * ecmaVersion: ecmaVersion;\n * comments: EsprimaComment[]|null;\n * impliedStrict: boolean;\n * lastToken: acorn.Token|null;\n * templateElements: (AcornTemplateNode)[];\n * jsxAttrValueToken: boolean;\n * }} BaseStateObject\n *\n * @typedef {{\n * tokens: null;\n * } & BaseStateObject} StateObject\n *\n * @typedef {{\n * tokens: EspreeTokens;\n * } & BaseStateObject} StateObjectWithTokens\n *\n * @typedef {{\n * sourceType?: \"script\"|\"module\"|\"commonjs\";\n * comments?: EsprimaComment[];\n * tokens?: acorn.Token[];\n * body: acorn.Node[];\n * } & acorn.Node} EsprimaProgramNode\n */\n/**\n * Converts an Acorn comment to an Esprima comment.\n *\n * - block True if it's a block comment, false if not.\n * - text The text of the comment.\n * - start The index at which the comment starts.\n * - end The index at which the comment ends.\n * - startLoc The location at which the comment starts.\n * - endLoc The location at which the comment ends.\n * @local\n * @typedef {(\n * block: boolean,\n * text: string,\n * start: int,\n * end: int,\n * startLoc: acorn.Position | undefined,\n * endLoc: acorn.Position | undefined\n * ) => EsprimaComment | void} AcornToEsprimaCommentConverter\n */\n\n// ----------------------------------------------------------------------------\n// Utilities\n// ----------------------------------------------------------------------------\n/**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n * @returns {EsprimaComment} The comment object.\n * @private\n */\nfunction convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) {\n const comment = /** @type {EsprimaComment} */ ({\n type: block ? \"Block\" : \"Line\",\n value: text\n });\n\n if (typeof start === \"number\") {\n comment.start = start;\n comment.end = end;\n comment.range = [start, end];\n }\n\n if (typeof startLoc === \"object\") {\n comment.loc = {\n start: startLoc,\n end: endLoc\n };\n }\n\n return comment;\n}\n\n// ----------------------------------------------------------------------------\n// Exports\n// ----------------------------------------------------------------------------\n/* eslint-disable arrow-body-style -- Need to supply formatted JSDoc for type info */\nexport default () => {\n\n /**\n * Returns the Espree parser.\n * @param {AcornJsxParser} Parser The Acorn parser\n * @returns {typeof EspreeParser} The Espree parser\n */\n return Parser => {\n const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes));\n\n if (Parser.acornJsx) {\n Object.assign(tokTypes, Parser.acornJsx.tokTypes);\n }\n\n /* eslint-disable no-shadow -- Using first class as type */\n /**\n * @export\n */\n return class EspreeParser extends Parser {\n /* eslint-enable no-shadow -- Using first class as type */\n /* eslint-disable jsdoc/check-types -- Allows generic object */\n /**\n * Adapted parser for Espree.\n * @param {ParserOptions|null} opts Espree options\n * @param {string|object} code The source code\n */\n constructor(opts, code) {\n /* eslint-enable jsdoc/check-types -- Allows generic object */\n\n /** @type {ParserOptions} */\n const newOpts = (typeof opts !== \"object\" || opts === null)\n ? {}\n : opts;\n\n const codeString = typeof code === \"string\"\n ? /** @type {string} */ (code)\n : String(code);\n\n // save original source type in case of commonjs\n const originalSourceType = newOpts.sourceType;\n const options = normalizeOptions(newOpts);\n const ecmaFeatures = options.ecmaFeatures || {};\n const tokenTranslator =\n options.tokens === true\n ? new TokenTranslator(tokTypes, codeString)\n : null;\n\n // Initialize acorn parser.\n super({\n\n // do not use spread, because we don't want to pass any unknown options to acorn\n ecmaVersion: options.ecmaVersion,\n sourceType: options.sourceType,\n ranges: options.ranges,\n locations: options.locations,\n allowReserved: options.allowReserved,\n\n // Truthy value is true for backward compatibility.\n allowReturnOutsideFunction: options.allowReturnOutsideFunction,\n\n // Collect tokens\n /**\n * Handler for receiving a token\n * @param {acorn.Token} token The token\n * @returns {void}\n */\n onToken: token => {\n if (tokenTranslator) {\n\n // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.\n tokenTranslator.onToken(token, /** @type {StateObjectWithTokens} */ (this[STATE]));\n }\n if (token.type !== tokTypes.eof) {\n this[STATE].lastToken = token;\n }\n },\n\n // Collect comments\n /**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n */\n onComment: (block, text, start, end, startLoc, endLoc) => {\n if (this[STATE].comments) {\n const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc);\n\n const comments = /** @type {EsprimaComment[]} */ (this[STATE].comments);\n\n comments.push(comment);\n }\n }\n }, codeString);\n\n // Force for TypeScript (indicating that `lineStart` is not undefined)\n if (!this.lineStart) {\n this.lineStart = 0;\n }\n\n /**\n * Data that is unique to Espree and is not represented internally in\n * Acorn. We put all of this data into a symbol property as a way to\n * avoid potential naming conflicts with future versions of Acorn.\n * @type {StateObjectWithTokens|StateObject}\n */\n this[STATE] = {\n originalSourceType: originalSourceType || options.sourceType,\n tokens: tokenTranslator ? /** @type {EspreeTokens} */ ([]) : null,\n comments: options.comment === true\n ? /** @type {EsprimaComment[]} */ ([])\n : null,\n impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,\n ecmaVersion: this.options.ecmaVersion,\n jsxAttrValueToken: false,\n\n /** @type {acorn.Token|null} */\n lastToken: null,\n\n /** @type {(AcornTemplateNode)[]} */\n templateElements: []\n };\n }\n\n /**\n * Returns Espree tokens.\n * @returns {EspreeTokens|null} Espree tokens\n */\n tokenize() {\n do {\n this.next();\n } while (this.type !== tokTypes.eof);\n\n // Consume the final eof token\n this.next();\n\n const extra = this[STATE];\n const tokens = extra.tokens;\n\n if (extra.comments && tokens) {\n tokens.comments = extra.comments;\n }\n\n return tokens;\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @returns {acorn.Node} The altered Node\n */\n finishNode(node, type) {\n const result = super.finishNode(node, type);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @param {number} pos The position\n * @param {acorn.Position} loc The location\n * @returns {acorn.Node} The altered Node\n */\n finishNodeAt(node, type, pos, loc) {\n const result = super.finishNodeAt(node, type, pos, loc);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Parses.\n * @returns {EsprimaProgramNode} The program Node\n */\n parse() {\n const extra = this[STATE];\n\n const program = /** @type {EsprimaProgramNode} */ (super.parse());\n\n program.sourceType = extra.originalSourceType;\n\n if (extra.comments) {\n program.comments = extra.comments;\n }\n if (extra.tokens) {\n program.tokens = extra.tokens;\n }\n\n /*\n * Adjust opening and closing position of program to match Esprima.\n * Acorn always starts programs at range 0 whereas Esprima starts at the\n * first AST node's start (the only real difference is when there's leading\n * whitespace or leading comments). Acorn also counts trailing whitespace\n * as part of the program whereas Esprima only counts up to the last token.\n */\n if (program.body.length) {\n const [firstNode] = program.body;\n\n if (program.range && firstNode.range) {\n program.range[0] = firstNode.range[0];\n }\n if (program.loc && firstNode.loc) {\n program.loc.start = firstNode.loc.start;\n }\n program.start = firstNode.start;\n }\n if (extra.lastToken) {\n if (program.range && extra.lastToken.range) {\n program.range[1] = extra.lastToken.range[1];\n }\n if (program.loc && extra.lastToken.loc) {\n program.loc.end = extra.lastToken.loc.end;\n }\n program.end = extra.lastToken.end;\n }\n\n\n /*\n * https://github.com/eslint/espree/issues/349\n * Ensure that template elements have correct range information.\n * This is one location where Acorn produces a different value\n * for its start and end properties vs. the values present in the\n * range property. In order to avoid confusion, we set the start\n * and end properties to the values that are present in range.\n * This is done here, instead of in finishNode(), because Acorn\n * uses the values of start and end internally while parsing, making\n * it dangerous to change those values while parsing is ongoing.\n * By waiting until the end of parsing, we can safely change these\n * values without affect any other part of the process.\n */\n this[STATE].templateElements.forEach(templateElement => {\n const startOffset = -1;\n const endOffset = templateElement.tail ? 1 : 2;\n\n templateElement.start += startOffset;\n templateElement.end += endOffset;\n\n if (templateElement.range) {\n templateElement.range[0] += startOffset;\n templateElement.range[1] += endOffset;\n }\n\n if (templateElement.loc) {\n templateElement.loc.start.column += startOffset;\n templateElement.loc.end.column += endOffset;\n }\n });\n\n return program;\n }\n\n /**\n * Parses top level.\n * @param {acorn.Node} node AST Node\n * @returns {acorn.Node} The changed node\n */\n parseTopLevel(node) {\n if (this[STATE].impliedStrict) {\n this.strict = true;\n }\n return super.parseTopLevel(node);\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raise(pos, message) {\n const loc = Parser.acorn.getLineInfo(this.input, pos);\n\n /** @type {EnhancedSyntaxError} */\n const err = new SyntaxError(message);\n\n err.index = pos;\n err.lineNumber = loc.line;\n err.column = loc.column + 1; // acorn uses 0-based columns\n throw err;\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raiseRecoverable(pos, message) {\n this.raise(pos, message);\n }\n\n /**\n * Overwrites the default unexpected method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n unexpected(pos) {\n let message = \"Unexpected token\";\n\n if (pos !== null && pos !== void 0) {\n this.pos = pos;\n\n if (this.options.locations) {\n while (this.pos < /** @type {int} */ (this.lineStart)) {\n\n /** @type {int} */\n this.lineStart = this.input.lastIndexOf(\"\\n\", /** @type {int} */ (this.lineStart) - 2) + 1;\n --this.curLine;\n }\n }\n\n this.nextToken();\n }\n\n if (this.end > this.start) {\n message += ` ${this.input.slice(this.start, this.end)}`;\n }\n\n this.raise(this.start, message);\n }\n\n /**\n * Esprima-FB represents JSX strings as tokens called \"JSXText\", but Acorn-JSX\n * uses regular tt.string without any distinction between this and regular JS\n * strings. As such, we intercept an attempt to read a JSX string and set a flag\n * on extra so that when tokens are converted, the next token will be switched\n * to JSXText via onToken.\n * @param {number} quote A character code\n * @returns {void}\n */\n jsx_readString(quote) { // eslint-disable-line camelcase\n if (typeof super.jsx_readString === \"undefined\") {\n throw new Error(\"Not a JSX parser\");\n }\n super.jsx_readString(quote);\n\n if (this.type === tokTypes.string) {\n this[STATE].jsxAttrValueToken = true;\n }\n }\n\n /**\n * Performs last-minute Esprima-specific compatibility checks and fixes.\n * @param {acorn.Node} result The node to check.\n * @returns {EsprimaNode} The finished node.\n */\n [ESPRIMA_FINISH_NODE](result) {\n\n const esprimaResult = /** @type {EsprimaNode} */ (result);\n\n // Acorn doesn't count the opening and closing backticks as part of templates\n // so we have to adjust ranges/locations appropriately.\n if (result.type === \"TemplateElement\") {\n\n // save template element references to fix start/end later\n this[STATE].templateElements.push(result);\n }\n\n if (result.type.includes(\"Function\") && !esprimaResult.generator) {\n esprimaResult.generator = false;\n }\n\n return esprimaResult;\n }\n };\n };\n};\n","const version = \"main\";\n\nexport default version;\n","/**\n * @fileoverview Main Espree file that converts Acorn into Esprima output.\n *\n * This file contains code from the following MIT-licensed projects:\n * 1. Acorn\n * 2. Babylon\n * 3. Babel-ESLint\n *\n * This file also contains code from Esprima, which is BSD licensed.\n *\n * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)\n * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)\n * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie \n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/* eslint no-undefined:0, no-use-before-define: 0 */\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * `jsx.Options` gives us 2 optional properties, so extend it\n *\n * `allowReserved`, `ranges`, `locations`, `allowReturnOutsideFunction`,\n * `onToken`, and `onComment` are as in `acorn.Options`\n *\n * `ecmaVersion` as in `acorn.Options` though optional\n *\n * `sourceType` as in `acorn.Options` but also allows `commonjs`\n *\n * `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options`\n *\n * `comment` is not in `acorn.Options` and doesn't err without it, but is used\n */\n/**\n * @typedef {{\n * allowReserved?: boolean,\n * ecmaVersion?: acorn.ecmaVersion,\n * sourceType?: \"script\"|\"module\"|\"commonjs\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * range?: boolean,\n * loc?: boolean,\n * tokens?: boolean | null,\n * comment?: boolean,\n * }} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {typeof import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('./lib/espree').EnhancedSyntaxError} EnhancedSyntaxError\n * @typedef {typeof import('./lib/espree').EspreeParser} IEspreeParser\n */\n\nimport * as acorn from \"acorn\";\nimport jsx from \"acorn-jsx\";\nimport espree from \"./lib/espree.js\";\nimport espreeVersion from \"./lib/version.js\";\nimport * as visitorKeys from \"eslint-visitor-keys\";\nimport { getLatestEcmaVersion, getSupportedEcmaVersions } from \"./lib/options.js\";\n\n\n// To initialize lazily.\nconst parsers = {\n _regular: /** @type {IEspreeParser|null} */ (null),\n _jsx: /** @type {IEspreeParser|null} */ (null),\n\n /**\n * Returns regular Parser\n * @returns {IEspreeParser} Regular Acorn parser\n */\n get regular() {\n if (this._regular === null) {\n const espreeParserFactory = espree();\n\n // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts\n this._regular = espreeParserFactory(/** @type {AcornJsxParser} */ (acorn.Parser));\n }\n return this._regular;\n },\n\n /**\n * Returns JSX Parser\n * @returns {IEspreeParser} JSX Acorn parser\n */\n get jsx() {\n if (this._jsx === null) {\n const espreeParserFactory = espree();\n const jsxFactory = jsx();\n\n // Cast the `acorn.Parser` to our own for required properties not specified in *.d.ts\n this._jsx = espreeParserFactory(jsxFactory(acorn.Parser));\n }\n return this._jsx;\n },\n\n /**\n * Returns Regular or JSX Parser\n * @param {ParserOptions} options Parser options\n * @returns {IEspreeParser} Regular or JSX Acorn parser\n */\n get(options) {\n const useJsx = Boolean(\n options &&\n options.ecmaFeatures &&\n options.ecmaFeatures.jsx\n );\n\n return useJsx ? this.jsx : this.regular;\n }\n};\n\n//------------------------------------------------------------------------------\n// Tokenizer\n//------------------------------------------------------------------------------\n\n/**\n * Tokenizes the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {acorn.Token[]|null} An array of tokens.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n * @private\n */\nexport function tokenize(code, options) {\n const Parser = parsers.get(options);\n\n // Ensure to collect tokens.\n if (!options || options.tokens !== true) {\n options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign\n }\n\n return new Parser(options, code).tokenize();\n}\n\n//------------------------------------------------------------------------------\n// Parser\n//------------------------------------------------------------------------------\n\n/**\n * Parses the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {acorn.Node} The \"Program\" AST node.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n */\nexport function parse(code, options) {\n const Parser = parsers.get(options);\n\n return new Parser(options, code).parse();\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport const version = espreeVersion;\n\n/* istanbul ignore next */\nexport const VisitorKeys = (function() {\n return visitorKeys.KEYS;\n}());\n\n// Derive node types from VisitorKeys\n/* istanbul ignore next */\nexport const Syntax = (function() {\n let /** @type {Object} */\n types = {};\n\n if (typeof Object.create === \"function\") {\n types = Object.create(null);\n }\n\n for (const name of Object.keys(VisitorKeys)) {\n types[name] = name;\n }\n\n if (typeof Object.freeze === \"function\") {\n Object.freeze(types);\n }\n\n return types;\n}());\n\nexport const latestEcmaVersion = getLatestEcmaVersion();\n\nexport const supportedEcmaVersions = getSupportedEcmaVersions();\n"],"names":["version","acorn","jsx","espreeVersion","visitorKeys"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,KAAK,GAAG;AACd,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,GAAG,EAAE,OAAO;AAChB,IAAI,UAAU,EAAE,YAAY;AAC5B,IAAI,iBAAiB,EAAE,mBAAmB;AAC1C,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,UAAU,EAAE,YAAY;AAC5B,IAAI,MAAM,EAAE,QAAQ;AACpB,IAAI,iBAAiB,EAAE,mBAAmB;AAC1C,IAAI,QAAQ,EAAE,UAAU;AACxB,IAAI,aAAa,EAAE,eAAe;AAClC,IAAI,OAAO,EAAE,SAAS;AACtB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mBAAmB,CAAC,MAAM,EAAE,IAAI,EAAE;AAC3C,IAAI,MAAM,U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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mCAAmC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE;AACxF,IAAI,MAAM,OAAO,kCAAkC;AACnD,QAAQ,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM;AACtC,QAAQ,KAAK,EAAE,IAAI;AACnB,KAAK,CAAC,CAAC;AACP;AACA,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACnC,QAAQ,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AAC9B,QAAQ,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAC1B,QAAQ,OAAO,CAAC,KAAK,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACrC,KAAK;AACL;AACA,IAAI,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;AACtC,QAAQ,OAAO,CAAC,GAAG,GAAG;AACtB,YAAY,KAAK,EAAE,QAAQ;AAC3B,YAAY,GAAG,EAAE,MAAM;AACvB,SAAS,CAAC;AACV,KAAK;AACL;AACA,IAAI,OAAO,OAAO,CAAC;AACnB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,aAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,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U,EAAE;AAC7C,QAAQ,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,KAAK;AACL;AACA,IAAI,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;AACjD,QAAQ,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAC3B,KAAK;AACL;AACA,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;AAC7C,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7B,KAAK;AACL;AACA,IAAI,OAAO,KAAK,CAAC;AACjB,CAAC,EAAE,EAAE;AACL;AACY,MAAC,iBAAiB,GAAG,oBAAoB,GAAG;AACxD;AACY,MAAC,qBAAqB,GAAG,wBAAwB;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"espree.cjs","sources":["../lib/token-translator.js","../lib/options.js","../lib/espree.js","../lib/version.js","../espree.js"],"sourcesContent":["/**\n * @fileoverview Translates tokens between Acorn format and Esprima format.\n * @author Nicholas C. Zakas\n */\n/* eslint no-underscore-dangle: 0 */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('./espree').EnhancedTokTypes} EnhancedTokTypes\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * Based on the `acorn.Token` class, but without a fixed `type` (since we need\n * it to be a string). Avoiding `type` lets us make one extending interface\n * more strict and another more lax.\n *\n * We could make `value` more strict to `string` even though the original is\n * `any`.\n *\n * `start` and `end` are required in `acorn.Token`\n *\n * `loc` and `range` are from `acorn.Token`\n *\n * Adds `regex`.\n */\n/**\n * @local\n *\n * @typedef {{\n * value: any;\n * start?: number;\n * end?: number;\n * loc?: acorn.SourceLocation;\n * range?: [number, number];\n * regex?: {flags: string, pattern: string};\n * }} BaseEsprimaToken\n *\n * @typedef {{\n * jsxAttrValueToken: boolean;\n * ecmaVersion: ecmaVersion;\n * }} ExtraNoTokens\n *\n * @typedef {{\n * tokens: EsprimaToken[]\n * } & ExtraNoTokens} Extra\n */\n\n/**\n * @typedef {{\n * type: string;\n * } & BaseEsprimaToken} EsprimaToken\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\n// none!\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n\n// Esprima Token Types\nconst Token = {\n Boolean: \"Boolean\",\n EOF: \"\",\n Identifier: \"Identifier\",\n PrivateIdentifier: \"PrivateIdentifier\",\n Keyword: \"Keyword\",\n Null: \"Null\",\n Numeric: \"Numeric\",\n Punctuator: \"Punctuator\",\n String: \"String\",\n RegularExpression: \"RegularExpression\",\n Template: \"Template\",\n JSXIdentifier: \"JSXIdentifier\",\n JSXText: \"JSXText\"\n};\n\n/**\n * Converts part of a template into an Esprima token.\n * @param {(acorn.Token)[]} tokens The Acorn tokens representing the template.\n * @param {string} code The source code.\n * @returns {EsprimaToken} The Esprima equivalent of the template token.\n * @private\n */\nfunction convertTemplatePart(tokens, code) {\n const firstToken = tokens[0],\n lastTemplateToken = tokens[tokens.length - 1];\n\n /** @type {EsprimaToken} */\n const token = {\n type: Token.Template,\n value: code.slice(firstToken.start, lastTemplateToken.end)\n };\n\n if (firstToken.loc && lastTemplateToken.loc) {\n token.loc = {\n start: firstToken.loc.start,\n end: lastTemplateToken.loc.end\n };\n }\n\n if (firstToken.range && lastTemplateToken.range) {\n token.start = firstToken.range[0];\n token.end = lastTemplateToken.range[1];\n token.range = [token.start, token.end];\n }\n\n return token;\n}\n\nclass TokenTranslator {\n\n /**\n * Contains logic to translate Acorn tokens into Esprima tokens.\n * @param {EnhancedTokTypes} acornTokTypes The Acorn token types.\n * @param {string} code The source code Acorn is parsing. This is necessary\n * to correct the \"value\" property of some tokens.\n */\n constructor(acornTokTypes, code) {\n\n // token types\n this._acornTokTypes = acornTokTypes;\n\n // token buffer for templates\n /** @type {(acorn.Token)[]} */\n this._tokens = [];\n\n // track the last curly brace\n this._curlyBrace = null;\n\n // the source code\n this._code = code;\n\n }\n\n /**\n * Translates a single Acorn token to a single Esprima token. This may be\n * inaccurate due to how templates are handled differently in Esprima and\n * Acorn, but should be accurate for all other tokens.\n * @param {acorn.Token} token The Acorn token to translate.\n * @param {ExtraNoTokens} extra Espree extra object.\n * @returns {EsprimaToken} The Esprima version of the token.\n */\n translate(token, extra) {\n\n const type = token.type,\n tt = this._acornTokTypes,\n\n // We use an unknown type because `acorn.Token` is a class whose\n // `type` property we cannot override to our desired `string`;\n // this also allows us to define a stricter `EsprimaToken` with\n // a string-only `type` property\n unknownType = /** @type {unknown} */ (token),\n newToken = /** @type {EsprimaToken} */ (unknownType);\n\n if (type === tt.name) {\n newToken.type = Token.Identifier;\n\n // TODO: See if this is an Acorn bug\n if (token.value === \"static\") {\n newToken.type = Token.Keyword;\n }\n\n if (extra.ecmaVersion > 5 && (token.value === \"yield\" || token.value === \"let\")) {\n newToken.type = Token.Keyword;\n }\n\n } else if (type === tt.privateId) {\n newToken.type = Token.PrivateIdentifier;\n\n } else if (type === tt.semi || type === tt.comma ||\n type === tt.parenL || type === tt.parenR ||\n type === tt.braceL || type === tt.braceR ||\n type === tt.dot || type === tt.bracketL ||\n type === tt.colon || type === tt.question ||\n type === tt.bracketR || type === tt.ellipsis ||\n type === tt.arrow || type === tt.jsxTagStart ||\n type === tt.incDec || type === tt.starstar ||\n type === tt.jsxTagEnd || type === tt.prefix ||\n type === tt.questionDot ||\n (type.binop && !type.keyword) ||\n type.isAssign) {\n\n newToken.type = Token.Punctuator;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.jsxName) {\n newToken.type = Token.JSXIdentifier;\n } else if (type.label === \"jsxText\" || type === tt.jsxAttrValueToken) {\n newToken.type = Token.JSXText;\n } else if (type.keyword) {\n if (type.keyword === \"true\" || type.keyword === \"false\") {\n newToken.type = Token.Boolean;\n } else if (type.keyword === \"null\") {\n newToken.type = Token.Null;\n } else {\n newToken.type = Token.Keyword;\n }\n } else if (type === tt.num) {\n newToken.type = Token.Numeric;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.string) {\n\n if (extra.jsxAttrValueToken) {\n extra.jsxAttrValueToken = false;\n newToken.type = Token.JSXText;\n } else {\n newToken.type = Token.String;\n }\n\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.regexp) {\n newToken.type = Token.RegularExpression;\n const value = token.value;\n\n newToken.regex = {\n flags: value.flags,\n pattern: value.pattern\n };\n newToken.value = `/${value.pattern}/${value.flags}`;\n }\n\n return newToken;\n }\n\n /**\n * Function to call during Acorn's onToken handler.\n * @param {acorn.Token} token The Acorn token.\n * @param {Extra} extra The Espree extra object.\n * @returns {void}\n */\n onToken(token, extra) {\n\n const that = this,\n tt = this._acornTokTypes,\n tokens = extra.tokens,\n templateTokens = this._tokens;\n\n /**\n * Flushes the buffered template tokens and resets the template\n * tracking.\n * @returns {void}\n * @private\n */\n function translateTemplateTokens() {\n tokens.push(convertTemplatePart(that._tokens, that._code));\n that._tokens = [];\n }\n\n if (token.type === tt.eof) {\n\n // might be one last curlyBrace\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n return;\n }\n\n if (token.type === tt.backQuote) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n\n // it's the end\n if (templateTokens.length > 1) {\n translateTemplateTokens();\n }\n\n return;\n }\n if (token.type === tt.dollarBraceL) {\n templateTokens.push(token);\n translateTemplateTokens();\n return;\n }\n if (token.type === tt.braceR) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n // store new curly for later\n this._curlyBrace = token;\n return;\n }\n if (token.type === tt.template || token.type === tt.invalidTemplate) {\n if (this._curlyBrace) {\n templateTokens.push(this._curlyBrace);\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n return;\n }\n\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n tokens.push(this.translate(token, extra));\n }\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport default TokenTranslator;\n","/**\n * @fileoverview A collection of methods for processing Espree's options.\n * @author Kai Cataldo\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * ecmaVersion: ecmaVersion,\n * sourceType: \"script\"|\"module\",\n * range?: boolean,\n * loc?: boolean,\n * allowReserved: boolean | \"never\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * ranges: boolean,\n * locations: boolean,\n * allowReturnOutsideFunction: boolean,\n * tokens?: boolean,\n * comment?: boolean\n * }} NormalizedParserOptions\n */\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst SUPPORTED_VERSIONS = [\n 3,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13\n];\n\n/**\n * Get the latest ECMAScript version supported by Espree.\n * @returns {number} The latest ECMAScript version.\n */\nexport function getLatestEcmaVersion() {\n return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1];\n}\n\n/**\n * Get the list of ECMAScript versions supported by Espree.\n * @returns {number[]} An array containing the supported ECMAScript versions.\n */\nexport function getSupportedEcmaVersions() {\n return [...SUPPORTED_VERSIONS];\n}\n\n/**\n * Normalize ECMAScript version from the initial config\n * @param {number|\"latest\"} ecmaVersion ECMAScript version from the initial config\n * @throws {Error} throws an error if the ecmaVersion is invalid.\n * @returns {number} normalized ECMAScript version\n */\nfunction normalizeEcmaVersion(ecmaVersion = 5) {\n\n let version = ecmaVersion === \"latest\" ? getLatestEcmaVersion() : ecmaVersion;\n\n if (typeof version !== \"number\") {\n throw new Error(`ecmaVersion must be a number or \"latest\". Received value of type ${typeof ecmaVersion} instead.`);\n }\n\n // Calculate ECMAScript edition number from official year version starting with\n // ES2015, which corresponds with ES6 (or a difference of 2009).\n if (version >= 2015) {\n version -= 2009;\n }\n\n if (!SUPPORTED_VERSIONS.includes(version)) {\n throw new Error(\"Invalid ecmaVersion.\");\n }\n\n return version;\n}\n\n/**\n * Normalize sourceType from the initial config\n * @param {\"script\"|\"module\"|\"commonjs\"} sourceType to normalize\n * @throws {Error} throw an error if sourceType is invalid\n * @returns {\"script\"|\"module\"} normalized sourceType\n */\nfunction normalizeSourceType(sourceType = \"script\") {\n if (sourceType === \"script\" || sourceType === \"module\") {\n return sourceType;\n }\n\n if (sourceType === \"commonjs\") {\n return \"script\";\n }\n\n throw new Error(\"Invalid sourceType.\");\n}\n\n/**\n * Normalize parserOptions\n * @param {ParserOptions} options the parser options to normalize\n * @throws {Error} throw an error if found invalid option.\n * @returns {NormalizedParserOptions} normalized options\n */\nexport function normalizeOptions(options) {\n const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion);\n\n /** @type {\"script\"|\"module\"} */\n const sourceType = normalizeSourceType(options.sourceType);\n const ranges = options.range === true;\n const locations = options.loc === true;\n\n if (ecmaVersion !== 3 && options.allowReserved) {\n\n // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed\n throw new Error(\"`allowReserved` is only supported when ecmaVersion is 3\");\n }\n\n // Note: value in Acorn can also be \"never\" but we throw in such a case\n if (typeof options.allowReserved !== \"undefined\" && typeof options.allowReserved !== \"boolean\") {\n throw new Error(\"`allowReserved`, when present, must be `true` or `false`\");\n }\n const allowReserved = ecmaVersion === 3 ? (options.allowReserved || \"never\") : false;\n const ecmaFeatures = options.ecmaFeatures || {};\n const allowReturnOutsideFunction = options.sourceType === \"commonjs\" ||\n Boolean(ecmaFeatures.globalReturn);\n\n if (sourceType === \"module\" && ecmaVersion < 6) {\n throw new Error(\"sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.\");\n }\n\n return Object.assign({}, options, {\n ecmaVersion,\n sourceType,\n ranges,\n locations,\n allowReserved,\n allowReturnOutsideFunction\n });\n}\n","/* eslint-disable no-param-reassign*/\nimport TokenTranslator from \"./token-translator.js\";\nimport { normalizeOptions } from \"./options.js\";\n\nconst STATE = Symbol(\"espree's internal state\");\nconst ESPRIMA_FINISH_NODE = Symbol(\"espree's esprimaFinishNode\");\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {{\n * index?: number;\n * lineNumber?: number;\n * column?: number;\n * } & SyntaxError} EnhancedSyntaxError\n */\n\n// We add `jsxAttrValueToken` ourselves.\n/**\n * @typedef {{\n * jsxAttrValueToken?: acorn.TokenType;\n * } & tokTypesType} EnhancedTokTypes\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * generator?: boolean\n * } & acorn.Node} EsprimaNode\n */\n/**\n * Suggests an integer\n * @local\n * @typedef {number} int\n */\n\n/**\n * @typedef {{\n * type: string,\n * value: string,\n * range?: [number, number],\n * start?: number,\n * end?: number,\n * loc?: {\n * start: acorn.Position | undefined,\n * end: acorn.Position | undefined\n * }\n * }} EsprimaComment\n */\n\n/**\n * First two properties as in `acorn.Comment`; next two as in `acorn.Comment`\n * but optional. Last is different as has to allow `undefined`\n */\n/**\n * @local\n *\n * @typedef {import('../espree').EspreeTokens} EspreeTokens\n *\n * @typedef {{\n * tail?: boolean\n * } & acorn.Node} AcornTemplateNode\n *\n * @typedef {{\n * originalSourceType: \"script\"|\"module\"|\"commonjs\";\n * ecmaVersion: ecmaVersion;\n * comments: EsprimaComment[]|null;\n * impliedStrict: boolean;\n * lastToken: acorn.Token|null;\n * templateElements: (AcornTemplateNode)[];\n * jsxAttrValueToken: boolean;\n * }} BaseStateObject\n *\n * @typedef {{\n * tokens: null;\n * } & BaseStateObject} StateObject\n *\n * @typedef {{\n * tokens: EspreeTokens;\n * } & BaseStateObject} StateObjectWithTokens\n *\n * @typedef {{\n * sourceType?: \"script\"|\"module\"|\"commonjs\";\n * comments?: EsprimaComment[];\n * tokens?: EspreeTokens;\n * body: acorn.Node[];\n * } & acorn.Node} EsprimaProgramNode\n */\n/**\n * Converts an Acorn comment to an Esprima comment.\n *\n * - block True if it's a block comment, false if not.\n * - text The text of the comment.\n * - start The index at which the comment starts.\n * - end The index at which the comment ends.\n * - startLoc The location at which the comment starts.\n * - endLoc The location at which the comment ends.\n * @local\n * @typedef {(\n * block: boolean,\n * text: string,\n * start: int,\n * end: int,\n * startLoc: acorn.Position | undefined,\n * endLoc: acorn.Position | undefined\n * ) => EsprimaComment | void} AcornToEsprimaCommentConverter\n */\n\n// ----------------------------------------------------------------------------\n// Utilities\n// ----------------------------------------------------------------------------\n/**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n * @returns {EsprimaComment} The comment object.\n * @private\n */\nfunction convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) {\n const comment = /** @type {EsprimaComment} */ ({\n type: block ? \"Block\" : \"Line\",\n value: text\n });\n\n if (typeof start === \"number\") {\n comment.start = start;\n comment.end = end;\n comment.range = [start, end];\n }\n\n if (typeof startLoc === \"object\") {\n comment.loc = {\n start: startLoc,\n end: endLoc\n };\n }\n\n return comment;\n}\n\n// ----------------------------------------------------------------------------\n// Exports\n// ----------------------------------------------------------------------------\n/* eslint-disable arrow-body-style -- Need to supply formatted JSDoc for type info */\nexport default () => {\n\n /**\n * Returns the Espree parser.\n * @param {AcornJsxParser} Parser The Acorn parser\n * @returns {typeof EspreeParser} The Espree parser\n */\n return Parser => {\n const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes));\n\n if (Parser.acornJsx) {\n Object.assign(tokTypes, Parser.acornJsx.tokTypes);\n }\n\n /* eslint-disable no-shadow -- Using first class as type */\n /**\n * @export\n */\n return class EspreeParser extends Parser {\n /* eslint-enable no-shadow -- Using first class as type */\n /* eslint-disable jsdoc/check-types -- Allows generic object */\n /**\n * Adapted parser for Espree.\n * @param {ParserOptions|null} opts Espree options\n * @param {string|object} code The source code\n */\n constructor(opts, code) {\n /* eslint-enable jsdoc/check-types -- Allows generic object */\n\n /** @type {ParserOptions} */\n const newOpts = (typeof opts !== \"object\" || opts === null)\n ? {}\n : opts;\n\n const codeString = typeof code === \"string\"\n ? /** @type {string} */ (code)\n : String(code);\n\n // save original source type in case of commonjs\n const originalSourceType = newOpts.sourceType;\n const options = normalizeOptions(newOpts);\n const ecmaFeatures = options.ecmaFeatures || {};\n const tokenTranslator =\n options.tokens === true\n ? new TokenTranslator(tokTypes, codeString)\n : null;\n\n // Initialize acorn parser.\n super({\n\n // do not use spread, because we don't want to pass any unknown options to acorn\n ecmaVersion: options.ecmaVersion,\n sourceType: options.sourceType,\n ranges: options.ranges,\n locations: options.locations,\n allowReserved: options.allowReserved,\n\n // Truthy value is true for backward compatibility.\n allowReturnOutsideFunction: options.allowReturnOutsideFunction,\n\n // Collect tokens\n /**\n * Handler for receiving a token\n * @param {acorn.Token} token The token\n * @returns {void}\n */\n onToken: token => {\n if (tokenTranslator) {\n\n // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.\n tokenTranslator.onToken(token, /** @type {StateObjectWithTokens} */ (this[STATE]));\n }\n if (token.type !== tokTypes.eof) {\n this[STATE].lastToken = token;\n }\n },\n\n // Collect comments\n /**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n */\n onComment: (block, text, start, end, startLoc, endLoc) => {\n if (this[STATE].comments) {\n const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc);\n\n const comments = /** @type {EsprimaComment[]} */ (this[STATE].comments);\n\n comments.push(comment);\n }\n }\n }, codeString);\n\n // Force for TypeScript (indicating that `lineStart` is not undefined)\n if (!this.lineStart) {\n this.lineStart = 0;\n }\n\n /**\n * Data that is unique to Espree and is not represented internally in\n * Acorn. We put all of this data into a symbol property as a way to\n * avoid potential naming conflicts with future versions of Acorn.\n * @type {StateObjectWithTokens|StateObject}\n */\n this[STATE] = {\n originalSourceType: originalSourceType || options.sourceType,\n tokens: tokenTranslator ? /** @type {EspreeTokens} */ ([]) : null,\n comments: options.comment === true\n ? /** @type {EsprimaComment[]} */ ([])\n : null,\n impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,\n ecmaVersion: this.options.ecmaVersion,\n jsxAttrValueToken: false,\n\n /** @type {acorn.Token|null} */\n lastToken: null,\n\n /** @type {(AcornTemplateNode)[]} */\n templateElements: []\n };\n }\n\n /**\n * Returns Espree tokens.\n * @returns {EspreeTokens|null} Espree tokens\n */\n tokenize() {\n do {\n this.next();\n } while (this.type !== tokTypes.eof);\n\n // Consume the final eof token\n this.next();\n\n const extra = this[STATE];\n const tokens = extra.tokens;\n\n if (extra.comments && tokens) {\n tokens.comments = extra.comments;\n }\n\n return tokens;\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @returns {acorn.Node} The altered Node\n */\n finishNode(node, type) {\n const result = super.finishNode(node, type);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @param {number} pos The position\n * @param {acorn.Position} loc The location\n * @returns {acorn.Node} The altered Node\n */\n finishNodeAt(node, type, pos, loc) {\n const result = super.finishNodeAt(node, type, pos, loc);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Parses.\n * @returns {EsprimaProgramNode} The program Node\n */\n parse() {\n const extra = this[STATE];\n\n const program = /** @type {EsprimaProgramNode} */ (super.parse());\n\n program.sourceType = extra.originalSourceType;\n\n if (extra.comments) {\n program.comments = extra.comments;\n }\n if (extra.tokens) {\n program.tokens = extra.tokens;\n }\n\n /*\n * Adjust opening and closing position of program to match Esprima.\n * Acorn always starts programs at range 0 whereas Esprima starts at the\n * first AST node's start (the only real difference is when there's leading\n * whitespace or leading comments). Acorn also counts trailing whitespace\n * as part of the program whereas Esprima only counts up to the last token.\n */\n if (program.body.length) {\n const [firstNode] = program.body;\n\n if (program.range && firstNode.range) {\n program.range[0] = firstNode.range[0];\n }\n if (program.loc && firstNode.loc) {\n program.loc.start = firstNode.loc.start;\n }\n program.start = firstNode.start;\n }\n if (extra.lastToken) {\n if (program.range && extra.lastToken.range) {\n program.range[1] = extra.lastToken.range[1];\n }\n if (program.loc && extra.lastToken.loc) {\n program.loc.end = extra.lastToken.loc.end;\n }\n program.end = extra.lastToken.end;\n }\n\n\n /*\n * https://github.com/eslint/espree/issues/349\n * Ensure that template elements have correct range information.\n * This is one location where Acorn produces a different value\n * for its start and end properties vs. the values present in the\n * range property. In order to avoid confusion, we set the start\n * and end properties to the values that are present in range.\n * This is done here, instead of in finishNode(), because Acorn\n * uses the values of start and end internally while parsing, making\n * it dangerous to change those values while parsing is ongoing.\n * By waiting until the end of parsing, we can safely change these\n * values without affect any other part of the process.\n */\n this[STATE].templateElements.forEach(templateElement => {\n const startOffset = -1;\n const endOffset = templateElement.tail ? 1 : 2;\n\n templateElement.start += startOffset;\n templateElement.end += endOffset;\n\n if (templateElement.range) {\n templateElement.range[0] += startOffset;\n templateElement.range[1] += endOffset;\n }\n\n if (templateElement.loc) {\n templateElement.loc.start.column += startOffset;\n templateElement.loc.end.column += endOffset;\n }\n });\n\n return program;\n }\n\n /**\n * Parses top level.\n * @param {acorn.Node} node AST Node\n * @returns {acorn.Node} The changed node\n */\n parseTopLevel(node) {\n if (this[STATE].impliedStrict) {\n this.strict = true;\n }\n return super.parseTopLevel(node);\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raise(pos, message) {\n const loc = Parser.acorn.getLineInfo(this.input, pos);\n\n /** @type {EnhancedSyntaxError} */\n const err = new SyntaxError(message);\n\n err.index = pos;\n err.lineNumber = loc.line;\n err.column = loc.column + 1; // acorn uses 0-based columns\n throw err;\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raiseRecoverable(pos, message) {\n this.raise(pos, message);\n }\n\n /**\n * Overwrites the default unexpected method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n unexpected(pos) {\n let message = \"Unexpected token\";\n\n if (pos !== null && pos !== void 0) {\n this.pos = pos;\n\n if (this.options.locations) {\n while (this.pos < /** @type {int} */ (this.lineStart)) {\n\n /** @type {int} */\n this.lineStart = this.input.lastIndexOf(\"\\n\", /** @type {int} */ (this.lineStart) - 2) + 1;\n --this.curLine;\n }\n }\n\n this.nextToken();\n }\n\n if (this.end > this.start) {\n message += ` ${this.input.slice(this.start, this.end)}`;\n }\n\n this.raise(this.start, message);\n }\n\n /**\n * Esprima-FB represents JSX strings as tokens called \"JSXText\", but Acorn-JSX\n * uses regular tt.string without any distinction between this and regular JS\n * strings. As such, we intercept an attempt to read a JSX string and set a flag\n * on extra so that when tokens are converted, the next token will be switched\n * to JSXText via onToken.\n * @param {number} quote A character code\n * @returns {void}\n */\n jsx_readString(quote) { // eslint-disable-line camelcase\n if (typeof super.jsx_readString === \"undefined\") {\n throw new Error(\"Not a JSX parser\");\n }\n super.jsx_readString(quote);\n\n if (this.type === tokTypes.string) {\n this[STATE].jsxAttrValueToken = true;\n }\n }\n\n /**\n * Performs last-minute Esprima-specific compatibility checks and fixes.\n * @param {acorn.Node} result The node to check.\n * @returns {EsprimaNode} The finished node.\n */\n [ESPRIMA_FINISH_NODE](result) {\n\n const esprimaResult = /** @type {EsprimaNode} */ (result);\n\n // Acorn doesn't count the opening and closing backticks as part of templates\n // so we have to adjust ranges/locations appropriately.\n if (result.type === \"TemplateElement\") {\n\n // save template element references to fix start/end later\n this[STATE].templateElements.push(result);\n }\n\n if (result.type.includes(\"Function\") && !esprimaResult.generator) {\n esprimaResult.generator = false;\n }\n\n return esprimaResult;\n }\n };\n };\n};\n","const version = \"main\";\n\nexport default version;\n","/**\n * @fileoverview Main Espree file that converts Acorn into Esprima output.\n *\n * This file contains code from the following MIT-licensed projects:\n * 1. Acorn\n * 2. Babylon\n * 3. Babel-ESLint\n *\n * This file also contains code from Esprima, which is BSD licensed.\n *\n * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)\n * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)\n * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie \n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/* eslint no-undefined:0, no-use-before-define: 0 */\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {3|5|6|7|8|9|10|11|12|13|2015|2016|2017|2018|2019|2020|2021|2022|'latest'} ecmaVersion\n */\n\n/**\n * @typedef {import('./lib/token-translator').EsprimaToken} EspreeToken\n */\n\n/**\n * @typedef {import('./lib/espree').EsprimaComment} EspreeComment\n */\n\n/**\n * @typedef {{\n * comments?: EspreeComment[]\n * } & EspreeToken[]} EspreeTokens\n */\n\n/**\n * `jsx.Options` gives us 2 optional properties, so extend it\n *\n * `allowReserved`, `ranges`, `locations`, `allowReturnOutsideFunction`,\n * `onToken`, and `onComment` are as in `acorn.Options`\n *\n * `ecmaVersion` currently as in `acorn.Options` though optional\n *\n * `sourceType` as in `acorn.Options` but also allows `commonjs`\n *\n * `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options`\n *\n * `comment` is not in `acorn.Options` and doesn't err without it, but is used\n */\n/**\n * @typedef {{\n * allowReserved?: boolean,\n * ecmaVersion?: ecmaVersion,\n * sourceType?: \"script\"|\"module\"|\"commonjs\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * range?: boolean,\n * loc?: boolean,\n * tokens?: boolean,\n * comment?: boolean,\n * }} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('./lib/espree').EnhancedSyntaxError} EnhancedSyntaxError\n * @typedef {typeof import('./lib/espree').EspreeParser} IEspreeParser\n */\n\nimport * as acorn from \"acorn\";\nimport jsx from \"acorn-jsx\";\nimport espree from \"./lib/espree.js\";\nimport espreeVersion from \"./lib/version.js\";\nimport * as visitorKeys from \"eslint-visitor-keys\";\nimport { getLatestEcmaVersion, getSupportedEcmaVersions } from \"./lib/options.js\";\n\n\n// To initialize lazily.\nconst parsers = {\n _regular: /** @type {IEspreeParser|null} */ (null),\n _jsx: /** @type {IEspreeParser|null} */ (null),\n\n /**\n * Returns regular Parser\n * @returns {IEspreeParser} Regular Acorn parser\n */\n get regular() {\n if (this._regular === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n\n this._regular = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._regular;\n },\n\n /**\n * Returns JSX Parser\n * @returns {IEspreeParser} JSX Acorn parser\n */\n get jsx() {\n if (this._jsx === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n const jsxFactory = jsx();\n\n this._jsx = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n jsxFactory,\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._jsx;\n },\n\n /**\n * Returns Regular or JSX Parser\n * @param {ParserOptions} options Parser options\n * @returns {IEspreeParser} Regular or JSX Acorn parser\n */\n get(options) {\n const useJsx = Boolean(\n options &&\n options.ecmaFeatures &&\n options.ecmaFeatures.jsx\n );\n\n return useJsx ? this.jsx : this.regular;\n }\n};\n\n//------------------------------------------------------------------------------\n// Tokenizer\n//------------------------------------------------------------------------------\n\n/**\n * Tokenizes the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {EspreeTokens} An array of tokens.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n * @private\n */\nexport function tokenize(code, options) {\n const Parser = parsers.get(options);\n\n // Ensure to collect tokens.\n if (!options || options.tokens !== true) {\n options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign\n }\n\n return /** @type {EspreeTokens} */ (new Parser(options, code).tokenize());\n}\n\n//------------------------------------------------------------------------------\n// Parser\n//------------------------------------------------------------------------------\n\n/**\n * Parses the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {acorn.Node} The \"Program\" AST node.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n */\nexport function parse(code, options) {\n const Parser = parsers.get(options);\n\n return new Parser(options, code).parse();\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport const version = espreeVersion;\n\n/* istanbul ignore next */\nexport const VisitorKeys = (function() {\n return visitorKeys.KEYS;\n}());\n\n// Derive node types from VisitorKeys\n/* istanbul ignore next */\nexport const Syntax = (function() {\n let /** @type {Object} */\n types = {};\n\n if (typeof Object.create === \"function\") {\n types = Object.create(null);\n }\n\n for (const name of Object.keys(VisitorKeys)) {\n types[name] = name;\n }\n\n if (typeof Object.freeze === \"function\") {\n Object.freeze(types);\n }\n\n return types;\n}());\n\nexport const latestEcmaVersion = getLatestEcmaVersion();\n\nexport const supportedEcmaVersions = getSupportedEcmaVersions();\n"],"names":["version","acorn","jsx","espreeVersion","visitorKeys"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,KAA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CAAC;AACxJ,KAAK;AACL;AACA,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE;AACtC,QAAQ,WAAW;AACnB,QAAQ,UAAU;AAClB,QAAQ,MAAM;AACd,QAAQ,SAAS;AACjB,QAAQ,aAAa;AACrB,QAAQ,0BAA0B;AAClC,KAAK,CAAC,CAAC;AACP;;AC7JA;AAGA;AACA,MAAM,KAAK,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAChD,MAAM,mBAAmB,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mCAAmC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE;AACxF,IAAI,MAAM,OAAO,kCAAkC;AACnD,QAAQ,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM;AACtC,QAAQ,KAAK,EAAE,IAAI;AACnB,KAAK,CAAC,CAAC;AACP;AACA,IAAI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.d.ts index b6ff73ad..31af4994 100644 --- a/dist/espree.d.ts +++ b/dist/espree.d.ts @@ -2,11 +2,11 @@ * Tokenizes the given code. * @param {string} code The code to tokenize. * @param {ParserOptions} options Options defining how to tokenize. - * @returns {import('acorn').Token[]} An array of tokens. + * @returns {EspreeTokens} An array of tokens. * @throws {import('./lib/espree').EnhancedSyntaxError} If the input code is invalid. * @private */ -export function tokenize(code: string, options: ParserOptions): import('acorn').Token[]; +export function tokenize(code: string, options: ParserOptions): EspreeTokens; /** * Parses the given code. * @param {string} code The code to tokenize. @@ -23,6 +23,11 @@ export const Syntax: { export const latestEcmaVersion: number; export const supportedEcmaVersions: number[]; export type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 'latest'; +export type EspreeToken = import('./lib/token-translator').EsprimaToken; +export type EspreeComment = import('./lib/espree').EsprimaComment; +export type EspreeTokens = { + comments?: EspreeComment[]; +} & EspreeToken[]; export type ParserOptions = { allowReserved?: boolean; ecmaVersion?: ecmaVersion; diff --git a/dist/espree.d.ts.map b/dist/espree.d.ts.map index e12a2969..b09fe0c2 100644 --- a/dist/espree.d.ts.map +++ b/dist/espree.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"espree.d.ts","sourceRoot":"","sources":["../tmp/espree.js"],"names":[],"mappings":"AAoHA;;;;;;;GAOG;AACH,+BANW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,KAAK,EAAE,CAUnC;AAED;;;;;;GAMG;AACH,4BALW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,IAAI,CAMhC;AACD,6BAAqC;AACrC,kDAEI;AACJ;;EAYI;AACJ,uCAAwD;AACxD,6CAAgE;0BAhHnD,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAA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,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IAAC,YAAY,CAAC,EAAE;QAAC,GAAG,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAC"} \ No newline at end of file diff --git a/dist/lib/espree.d.ts b/dist/lib/espree.d.ts index 8e0a977b..8fc305d9 100644 --- a/dist/lib/espree.d.ts +++ b/dist/lib/espree.d.ts @@ -9,39 +9,17 @@ export class EspreeParser extends acorn.Parser { constructor(opts: import('../espree').ParserOptions | null, code: string | object); /** * Returns Espree tokens. - * @returns {{comments?: {type: string; value: string; range?: [number, number]; start?: number; end?: number; loc?: {start: import('acorn').Position | undefined; end: import('acorn').Position | undefined}}[]} & import('acorn').Token[] | null} Espree tokens + * @returns {import('../espree').EspreeTokens | null} Espree tokens */ - tokenize(): { - comments?: { - type: string; - value: string; - range?: [number, number]; - start?: number; - end?: number; - loc?: { - start: import('acorn').Position | undefined; - end: import('acorn').Position | undefined; - }; - }[]; - } & import('acorn').Token[] | null; + tokenize(): import('../espree').EspreeTokens | null; /** * Parses. - * @returns {{sourceType?: "script" | "module" | "commonjs"; comments?: {type: string; value: string; range?: [number, number]; start?: number; end?: number; loc?: {start: import('acorn').Position | undefined; end: import('acorn').Position | undefined}}[]; tokens?: import('acorn').Token[]; body: import('acorn').Node[]} & import('acorn').Node} The program Node + * @returns {{sourceType?: "script" | "module" | "commonjs"; comments?: EsprimaComment[]; tokens?: import('../espree').EspreeTokens; body: import('acorn').Node[]} & import('acorn').Node} The program Node */ parse(): { sourceType?: "script" | "module" | "commonjs"; - comments?: { - type: string; - value: string; - range?: [number, number]; - start?: number; - end?: number; - loc?: { - start: import('acorn').Position | undefined; - end: import('acorn').Position | undefined; - }; - }[]; - tokens?: import('acorn').Token[]; + comments?: EsprimaComment[]; + tokens?: import('../espree').EspreeTokens; body: import('acorn').Node[]; } & import('acorn').Node; /** @@ -71,5 +49,16 @@ export type EnhancedSyntaxError = { export type EnhancedTokTypes = { jsxAttrValueToken?: import('acorn').TokenType; } & typeof import('acorn-jsx').tokTypes; +export type EsprimaComment = { + type: string; + value: string; + range?: [number, number]; + start?: number; + end?: number; + loc?: { + start: import('acorn').Position | undefined; + end: import('acorn').Position | undefined; + }; +}; import * as acorn from "acorn"; //# sourceMappingURL=espree.d.ts.map \ No newline at end of file diff --git a/dist/lib/espree.d.ts.map b/dist/lib/espree.d.ts.map index 50e3cc78..c4cf4532 100644 --- a/dist/lib/espree.d.ts.map +++ b/dist/lib/espree.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"espree.d.ts","sourceRoot":"","sources":["../../tmp/lib/espree.js"],"names":[],"mappings":"AAgDe,sCAIA,OAAO,WAAW,EAAE,cAAc,KAChC,mBAAmB,CA+QnC;;AACD;IAEY;;;;OAIG;IACH,kBAHW,OAAO,WAAW,EAAE,aAAa,GAAG,IAAI,QACxC,MAAM,GAAG,MAAM,EAIjC;IAEO;;;OAGG;IACH,YAFa;QAAC,QAAQ,CAAC,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE;gBAAC,KAAK,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;gBAAC,GAAG,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,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ib/token-translator.d.ts.map b/dist/lib/token-translator.d.ts.map index 4cffda18..3c683e38 100644 --- a/dist/lib/token-translator.d.ts.map +++ b/dist/lib/token-translator.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"token-translator.d.ts","sourceRoot":"","sources":["../../tmp/lib/token-translator.js"],"names":[],"mappings":";AA+DA;IAEI;;;;;OAKG;IACH,2BAJW,OAAO,UAAU,EAAE,gBAAgB,QACnC,MAAM,EAQhB;IAJG,oDAAmC;IAC3B,wCAAwC,CAAC,SAA9B,CAAC,OAAO,OAAO,EAAE,KAAK,CAAC,EAAE,CAAsB;IAClE,0CAAuB;IACvB,cAAiB;IAGrB;;;;;;;OAOG;IACH,iBAJW,OAAO,OAAO,EAAE,KAAK,SACrB;QAAC,iBAAiB,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,WAAW,EAAE,WAAW,CAAA;KAAC;cACjE,MAAM;;eAAY,GAAG;;;;;;mBAAgH,MAAM;qBAAW,MAAM;;MAkD/K;IAED;;;;;OAKG;IACH,eAJW,OAAO,OAAO,EAAE,KAAK;gBACZ,CAAC;YAAC,IAAI,EAAE,MAAM,GAAG,OAAO,OAAO,EAAE,SAAS,CAAA;SAAC,GAAG;YAAC,KAAK,EAAE,GAAG,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,OAAO,OAAO,EAAE,cAAc,CAAC;YAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAAC,KAAK,CAAC,EAAE;gBAAC,KAAK,EAAE,MAAM,CAAC;gBAAC,OAAO,EAAE,MAAM,CAAA;aAAC,CAAA;SAAC,CAAC,EAAE;;2BAAwB,OAAO;qBAAe,OAAO,WAAW,EAAE,WAAW;QACzR,IAAI,CAyDhB;CACJ"} \ No newline at end of file +{"version":3,"file":"token-translator.d.ts","sourceRoot":"","sources":["../../tmp/lib/token-translator.js"],"names":[],"mappings":";2BAkBa;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,OAAO,EAAE,cAAc,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAA;CAAC;AAiDlL;IAEI;;;;;OAKG;IACH,2BAJW,OAAO,UAAU,EAAE,gBAAgB,QACnC,MAAM,EAQhB;IAJG,oDAAmC;IAC3B,wCAAwC,CAAC,SAA9B,CAAC,OAAO,OAAO,EAAE,KAAK,CAAC,EAAE,CAAsB;IAClE,0CAAuB;IACvB,cAAiB;IAGrB;;;;;;;OAOG;IACH,iBAJW,OAAO,OAAO,EAAE,KAAK,SACrB;QAAC,iBAAiB,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,WAAW,EAAE,WAAW,CAAA;KAAC,GACxE,YAAY,CAkDxB;IAED;;;;;OAKG;IACH,eAJW,OAAO,OAAO,EAAE,KAAK;gBACZ,YAAY,EAAE;;2BAAwB,OAAO;qBAAe,OAAO,WAAW,EAAE,WAAW;QAClG,IAAI,CAyDhB;CACJ"} \ No newline at end of file diff --git a/espree.js b/espree.js index 94c997cc..db4f0452 100644 --- a/espree.js +++ b/espree.js @@ -63,6 +63,20 @@ * @typedef {3|5|6|7|8|9|10|11|12|13|2015|2016|2017|2018|2019|2020|2021|2022|'latest'} ecmaVersion */ +/** + * @typedef {import('./lib/token-translator').EsprimaToken} EspreeToken + */ + +/** + * @typedef {import('./lib/espree').EsprimaComment} EspreeComment + */ + +/** + * @typedef {{ + * comments?: EspreeComment[] + * } & EspreeToken[]} EspreeTokens + */ + /** * `jsx.Options` gives us 2 optional properties, so extend it * @@ -182,7 +196,7 @@ const parsers = { * Tokenizes the given code. * @param {string} code The code to tokenize. * @param {ParserOptions} options Options defining how to tokenize. - * @returns {acorn.Token[]} An array of tokens. + * @returns {EspreeTokens} An array of tokens. * @throws {EnhancedSyntaxError} If the input code is invalid. * @private */ @@ -194,7 +208,7 @@ export function tokenize(code, options) { options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign } - return /** @type {acorn.Token[]} */ (new Parser(options, code).tokenize()); + return /** @type {EspreeTokens} */ (new Parser(options, code).tokenize()); } //------------------------------------------------------------------------------ diff --git a/lib/espree.js b/lib/espree.js index 5848bd50..9e506568 100644 --- a/lib/espree.js +++ b/lib/espree.js @@ -51,12 +51,6 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); */ /** - * First three properties as in `acorn.Comment`; next two as in `acorn.Comment` - * but optional. Last is different as has to allow `undefined` - */ -/** - * @local - * * @typedef {{ * type: string, * value: string, @@ -68,10 +62,16 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * end: acorn.Position | undefined * } * }} EsprimaComment + */ + +/** + * First two properties as in `acorn.Comment`; next two as in `acorn.Comment` + * but optional. Last is different as has to allow `undefined` + */ +/** + * @local * - * @typedef {{ - * comments?: EsprimaComment[] - * } & acorn.Token[]} EspreeTokens + * @typedef {import('../espree').EspreeTokens} EspreeTokens * * @typedef {{ * tail?: boolean @@ -98,7 +98,7 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * @typedef {{ * sourceType?: "script"|"module"|"commonjs"; * comments?: EsprimaComment[]; - * tokens?: acorn.Token[]; + * tokens?: EspreeTokens; * body: acorn.Node[]; * } & acorn.Node} EsprimaProgramNode */ diff --git a/lib/token-translator.js b/lib/token-translator.js index 062986e4..561acfbf 100644 --- a/lib/token-translator.js +++ b/lib/token-translator.js @@ -44,23 +44,21 @@ * }} BaseEsprimaToken * * @typedef {{ - * type: string; - * } & BaseEsprimaToken} EsprimaToken - * - * @typedef {{ - * type: string | acorn.TokenType; - * } & BaseEsprimaToken} EsprimaTokenFlexible - * - * @typedef {{ * jsxAttrValueToken: boolean; * ecmaVersion: ecmaVersion; * }} ExtraNoTokens * * @typedef {{ - * tokens: EsprimaTokenFlexible[] + * tokens: EsprimaToken[] * } & ExtraNoTokens} Extra */ +/** + * @typedef {{ + * type: string; + * } & BaseEsprimaToken} EsprimaToken + */ + //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ @@ -148,7 +146,7 @@ class TokenTranslator { } /** - * Translates a single Esprima token to a single Acorn token. This may be + * Translates a single Acorn token to a single Esprima 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 {acorn.Token} token The Acorn token to translate. From 6f9cdad0338a33e777f656c064d7d2ce1d3653f9 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Wed, 11 May 2022 08:34:18 +0800 Subject: [PATCH 17/24] docs: simplify types and remove unneeded type casts --- dist/espree.cjs | 10 ++++------ dist/espree.cjs.map | 2 +- dist/lib/espree.d.ts | 4 ++-- dist/lib/espree.d.ts.map | 2 +- dist/lib/token-translator.d.ts.map | 2 +- lib/espree.js | 7 +++---- lib/options.js | 1 - lib/token-translator.js | 2 +- 8 files changed, 13 insertions(+), 17 deletions(-) diff --git a/dist/espree.cjs b/dist/espree.cjs index 85b38b42..570ad40e 100644 --- a/dist/espree.cjs +++ b/dist/espree.cjs @@ -166,7 +166,7 @@ class TokenTranslator { this._acornTokTypes = acornTokTypes; // token buffer for templates - /** @type {(acorn.Token)[]} */ + /** @type {acorn.Token[]} */ this._tokens = []; // track the last curly brace @@ -477,7 +477,6 @@ function normalizeSourceType(sourceType = "script") { function normalizeOptions(options) { const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); - /** @type {"script"|"module"} */ const sourceType = normalizeSourceType(options.sourceType); const ranges = options.range === true; const locations = options.loc === true; @@ -609,7 +608,7 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * @typedef {{ * sourceType?: "script"|"module"|"commonjs"; * comments?: EsprimaComment[]; - * tokens?: EspreeTokens; + * tokens?: import('./token-translator').EsprimaToken[]; * body: acorn.Node[]; * } & acorn.Node} EsprimaProgramNode */ @@ -697,13 +696,12 @@ var espree = () => { constructor(opts, code) { /* eslint-enable jsdoc/check-types -- Allows generic object */ - /** @type {ParserOptions} */ const newOpts = (typeof opts !== "object" || opts === null) ? {} : opts; const codeString = typeof code === "string" - ? /** @type {string} */ (code) + ? code : String(code); // save original source type in case of commonjs @@ -785,7 +783,7 @@ var espree = () => { /** @type {acorn.Token|null} */ lastToken: null, - /** @type {(AcornTemplateNode)[]} */ + /** @type {AcornTemplateNode[]} */ templateElements: [] }; } diff --git a/dist/espree.cjs.map b/dist/espree.cjs.map index e6dc7834..b0a5b1da 100644 --- a/dist/espree.cjs.map +++ b/dist/espree.cjs.map @@ -1 +1 @@ -{"version":3,"file":"espree.cjs","sources":["../lib/token-translator.js","../lib/options.js","../lib/espree.js","../lib/version.js","../espree.js"],"sourcesContent":["/**\n * @fileoverview Translates tokens between Acorn format and Esprima format.\n * @author Nicholas C. Zakas\n */\n/* eslint no-underscore-dangle: 0 */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('./espree').EnhancedTokTypes} EnhancedTokTypes\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * Based on the `acorn.Token` class, but without a fixed `type` (since we need\n * it to be a string). Avoiding `type` lets us make one extending interface\n * more strict and another more lax.\n *\n * We could make `value` more strict to `string` even though the original is\n * `any`.\n *\n * `start` and `end` are required in `acorn.Token`\n *\n * `loc` and `range` are from `acorn.Token`\n *\n * Adds `regex`.\n */\n/**\n * @local\n *\n * @typedef {{\n * value: any;\n * start?: number;\n * end?: number;\n * loc?: acorn.SourceLocation;\n * range?: [number, number];\n * regex?: {flags: string, pattern: string};\n * }} BaseEsprimaToken\n *\n * @typedef {{\n * jsxAttrValueToken: boolean;\n * ecmaVersion: ecmaVersion;\n * }} ExtraNoTokens\n *\n * @typedef {{\n * tokens: EsprimaToken[]\n * } & ExtraNoTokens} Extra\n */\n\n/**\n * @typedef {{\n * type: string;\n * } & BaseEsprimaToken} EsprimaToken\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\n// none!\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n\n// Esprima Token Types\nconst Token = {\n Boolean: \"Boolean\",\n EOF: \"\",\n Identifier: \"Identifier\",\n PrivateIdentifier: \"PrivateIdentifier\",\n Keyword: \"Keyword\",\n Null: \"Null\",\n Numeric: \"Numeric\",\n Punctuator: \"Punctuator\",\n String: \"String\",\n RegularExpression: \"RegularExpression\",\n Template: \"Template\",\n JSXIdentifier: \"JSXIdentifier\",\n JSXText: \"JSXText\"\n};\n\n/**\n * Converts part of a template into an Esprima token.\n * @param {(acorn.Token)[]} tokens The Acorn tokens representing the template.\n * @param {string} code The source code.\n * @returns {EsprimaToken} The Esprima equivalent of the template token.\n * @private\n */\nfunction convertTemplatePart(tokens, code) {\n const firstToken = tokens[0],\n lastTemplateToken = tokens[tokens.length - 1];\n\n /** @type {EsprimaToken} */\n const token = {\n type: Token.Template,\n value: code.slice(firstToken.start, lastTemplateToken.end)\n };\n\n if (firstToken.loc && lastTemplateToken.loc) {\n token.loc = {\n start: firstToken.loc.start,\n end: lastTemplateToken.loc.end\n };\n }\n\n if (firstToken.range && lastTemplateToken.range) {\n token.start = firstToken.range[0];\n token.end = lastTemplateToken.range[1];\n token.range = [token.start, token.end];\n }\n\n return token;\n}\n\nclass TokenTranslator {\n\n /**\n * Contains logic to translate Acorn tokens into Esprima tokens.\n * @param {EnhancedTokTypes} acornTokTypes The Acorn token types.\n * @param {string} code The source code Acorn is parsing. This is necessary\n * to correct the \"value\" property of some tokens.\n */\n constructor(acornTokTypes, code) {\n\n // token types\n this._acornTokTypes = acornTokTypes;\n\n // token buffer for templates\n /** @type {(acorn.Token)[]} */\n this._tokens = [];\n\n // track the last curly brace\n this._curlyBrace = null;\n\n // the source code\n this._code = code;\n\n }\n\n /**\n * Translates a single Acorn token to a single Esprima token. This may be\n * inaccurate due to how templates are handled differently in Esprima and\n * Acorn, but should be accurate for all other tokens.\n * @param {acorn.Token} token The Acorn token to translate.\n * @param {ExtraNoTokens} extra Espree extra object.\n * @returns {EsprimaToken} The Esprima version of the token.\n */\n translate(token, extra) {\n\n const type = token.type,\n tt = this._acornTokTypes,\n\n // We use an unknown type because `acorn.Token` is a class whose\n // `type` property we cannot override to our desired `string`;\n // this also allows us to define a stricter `EsprimaToken` with\n // a string-only `type` property\n unknownType = /** @type {unknown} */ (token),\n newToken = /** @type {EsprimaToken} */ (unknownType);\n\n if (type === tt.name) {\n newToken.type = Token.Identifier;\n\n // TODO: See if this is an Acorn bug\n if (token.value === \"static\") {\n newToken.type = Token.Keyword;\n }\n\n if (extra.ecmaVersion > 5 && (token.value === \"yield\" || token.value === \"let\")) {\n newToken.type = Token.Keyword;\n }\n\n } else if (type === tt.privateId) {\n newToken.type = Token.PrivateIdentifier;\n\n } else if (type === tt.semi || type === tt.comma ||\n type === tt.parenL || type === tt.parenR ||\n type === tt.braceL || type === tt.braceR ||\n type === tt.dot || type === tt.bracketL ||\n type === tt.colon || type === tt.question ||\n type === tt.bracketR || type === tt.ellipsis ||\n type === tt.arrow || type === tt.jsxTagStart ||\n type === tt.incDec || type === tt.starstar ||\n type === tt.jsxTagEnd || type === tt.prefix ||\n type === tt.questionDot ||\n (type.binop && !type.keyword) ||\n type.isAssign) {\n\n newToken.type = Token.Punctuator;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.jsxName) {\n newToken.type = Token.JSXIdentifier;\n } else if (type.label === \"jsxText\" || type === tt.jsxAttrValueToken) {\n newToken.type = Token.JSXText;\n } else if (type.keyword) {\n if (type.keyword === \"true\" || type.keyword === \"false\") {\n newToken.type = Token.Boolean;\n } else if (type.keyword === \"null\") {\n newToken.type = Token.Null;\n } else {\n newToken.type = Token.Keyword;\n }\n } else if (type === tt.num) {\n newToken.type = Token.Numeric;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.string) {\n\n if (extra.jsxAttrValueToken) {\n extra.jsxAttrValueToken = false;\n newToken.type = Token.JSXText;\n } else {\n newToken.type = Token.String;\n }\n\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.regexp) {\n newToken.type = Token.RegularExpression;\n const value = token.value;\n\n newToken.regex = {\n flags: value.flags,\n pattern: value.pattern\n };\n newToken.value = `/${value.pattern}/${value.flags}`;\n }\n\n return newToken;\n }\n\n /**\n * Function to call during Acorn's onToken handler.\n * @param {acorn.Token} token The Acorn token.\n * @param {Extra} extra The Espree extra object.\n * @returns {void}\n */\n onToken(token, extra) {\n\n const that = this,\n tt = this._acornTokTypes,\n tokens = extra.tokens,\n templateTokens = this._tokens;\n\n /**\n * Flushes the buffered template tokens and resets the template\n * tracking.\n * @returns {void}\n * @private\n */\n function translateTemplateTokens() {\n tokens.push(convertTemplatePart(that._tokens, that._code));\n that._tokens = [];\n }\n\n if (token.type === tt.eof) {\n\n // might be one last curlyBrace\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n return;\n }\n\n if (token.type === tt.backQuote) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n\n // it's the end\n if (templateTokens.length > 1) {\n translateTemplateTokens();\n }\n\n return;\n }\n if (token.type === tt.dollarBraceL) {\n templateTokens.push(token);\n translateTemplateTokens();\n return;\n }\n if (token.type === tt.braceR) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n // store new curly for later\n this._curlyBrace = token;\n return;\n }\n if (token.type === tt.template || token.type === tt.invalidTemplate) {\n if (this._curlyBrace) {\n templateTokens.push(this._curlyBrace);\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n return;\n }\n\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n tokens.push(this.translate(token, extra));\n }\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport default TokenTranslator;\n","/**\n * @fileoverview A collection of methods for processing Espree's options.\n * @author Kai Cataldo\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * ecmaVersion: ecmaVersion,\n * sourceType: \"script\"|\"module\",\n * range?: boolean,\n * loc?: boolean,\n * allowReserved: boolean | \"never\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * ranges: boolean,\n * locations: boolean,\n * allowReturnOutsideFunction: boolean,\n * tokens?: boolean,\n * comment?: boolean\n * }} NormalizedParserOptions\n */\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst SUPPORTED_VERSIONS = [\n 3,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13\n];\n\n/**\n * Get the latest ECMAScript version supported by Espree.\n * @returns {number} The latest ECMAScript version.\n */\nexport function getLatestEcmaVersion() {\n return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1];\n}\n\n/**\n * Get the list of ECMAScript versions supported by Espree.\n * @returns {number[]} An array containing the supported ECMAScript versions.\n */\nexport function getSupportedEcmaVersions() {\n return [...SUPPORTED_VERSIONS];\n}\n\n/**\n * Normalize ECMAScript version from the initial config\n * @param {number|\"latest\"} ecmaVersion ECMAScript version from the initial config\n * @throws {Error} throws an error if the ecmaVersion is invalid.\n * @returns {number} normalized ECMAScript version\n */\nfunction normalizeEcmaVersion(ecmaVersion = 5) {\n\n let version = ecmaVersion === \"latest\" ? getLatestEcmaVersion() : ecmaVersion;\n\n if (typeof version !== \"number\") {\n throw new Error(`ecmaVersion must be a number or \"latest\". Received value of type ${typeof ecmaVersion} instead.`);\n }\n\n // Calculate ECMAScript edition number from official year version starting with\n // ES2015, which corresponds with ES6 (or a difference of 2009).\n if (version >= 2015) {\n version -= 2009;\n }\n\n if (!SUPPORTED_VERSIONS.includes(version)) {\n throw new Error(\"Invalid ecmaVersion.\");\n }\n\n return version;\n}\n\n/**\n * Normalize sourceType from the initial config\n * @param {\"script\"|\"module\"|\"commonjs\"} sourceType to normalize\n * @throws {Error} throw an error if sourceType is invalid\n * @returns {\"script\"|\"module\"} normalized sourceType\n */\nfunction normalizeSourceType(sourceType = \"script\") {\n if (sourceType === \"script\" || sourceType === \"module\") {\n return sourceType;\n }\n\n if (sourceType === \"commonjs\") {\n return \"script\";\n }\n\n throw new Error(\"Invalid sourceType.\");\n}\n\n/**\n * Normalize parserOptions\n * @param {ParserOptions} options the parser options to normalize\n * @throws {Error} throw an error if found invalid option.\n * @returns {NormalizedParserOptions} normalized options\n */\nexport function normalizeOptions(options) {\n const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion);\n\n /** @type {\"script\"|\"module\"} */\n const sourceType = normalizeSourceType(options.sourceType);\n const ranges = options.range === true;\n const locations = options.loc === true;\n\n if (ecmaVersion !== 3 && options.allowReserved) {\n\n // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed\n throw new Error(\"`allowReserved` is only supported when ecmaVersion is 3\");\n }\n\n // Note: value in Acorn can also be \"never\" but we throw in such a case\n if (typeof options.allowReserved !== \"undefined\" && typeof options.allowReserved !== \"boolean\") {\n throw new Error(\"`allowReserved`, when present, must be `true` or `false`\");\n }\n const allowReserved = ecmaVersion === 3 ? (options.allowReserved || \"never\") : false;\n const ecmaFeatures = options.ecmaFeatures || {};\n const allowReturnOutsideFunction = options.sourceType === \"commonjs\" ||\n Boolean(ecmaFeatures.globalReturn);\n\n if (sourceType === \"module\" && ecmaVersion < 6) {\n throw new Error(\"sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.\");\n }\n\n return Object.assign({}, options, {\n ecmaVersion,\n sourceType,\n ranges,\n locations,\n allowReserved,\n allowReturnOutsideFunction\n });\n}\n","/* eslint-disable no-param-reassign*/\nimport TokenTranslator from \"./token-translator.js\";\nimport { normalizeOptions } from \"./options.js\";\n\nconst STATE = Symbol(\"espree's internal state\");\nconst ESPRIMA_FINISH_NODE = Symbol(\"espree's esprimaFinishNode\");\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {{\n * index?: number;\n * lineNumber?: number;\n * column?: number;\n * } & SyntaxError} EnhancedSyntaxError\n */\n\n// We add `jsxAttrValueToken` ourselves.\n/**\n * @typedef {{\n * jsxAttrValueToken?: acorn.TokenType;\n * } & tokTypesType} EnhancedTokTypes\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * generator?: boolean\n * } & acorn.Node} EsprimaNode\n */\n/**\n * Suggests an integer\n * @local\n * @typedef {number} int\n */\n\n/**\n * @typedef {{\n * type: string,\n * value: string,\n * range?: [number, number],\n * start?: number,\n * end?: number,\n * loc?: {\n * start: acorn.Position | undefined,\n * end: acorn.Position | undefined\n * }\n * }} EsprimaComment\n */\n\n/**\n * First two properties as in `acorn.Comment`; next two as in `acorn.Comment`\n * but optional. Last is different as has to allow `undefined`\n */\n/**\n * @local\n *\n * @typedef {import('../espree').EspreeTokens} EspreeTokens\n *\n * @typedef {{\n * tail?: boolean\n * } & acorn.Node} AcornTemplateNode\n *\n * @typedef {{\n * originalSourceType: \"script\"|\"module\"|\"commonjs\";\n * ecmaVersion: ecmaVersion;\n * comments: EsprimaComment[]|null;\n * impliedStrict: boolean;\n * lastToken: acorn.Token|null;\n * templateElements: (AcornTemplateNode)[];\n * jsxAttrValueToken: boolean;\n * }} BaseStateObject\n *\n * @typedef {{\n * tokens: null;\n * } & BaseStateObject} StateObject\n *\n * @typedef {{\n * tokens: EspreeTokens;\n * } & BaseStateObject} StateObjectWithTokens\n *\n * @typedef {{\n * sourceType?: \"script\"|\"module\"|\"commonjs\";\n * comments?: EsprimaComment[];\n * tokens?: EspreeTokens;\n * body: acorn.Node[];\n * } & acorn.Node} EsprimaProgramNode\n */\n/**\n * Converts an Acorn comment to an Esprima comment.\n *\n * - block True if it's a block comment, false if not.\n * - text The text of the comment.\n * - start The index at which the comment starts.\n * - end The index at which the comment ends.\n * - startLoc The location at which the comment starts.\n * - endLoc The location at which the comment ends.\n * @local\n * @typedef {(\n * block: boolean,\n * text: string,\n * start: int,\n * end: int,\n * startLoc: acorn.Position | undefined,\n * endLoc: acorn.Position | undefined\n * ) => EsprimaComment | void} AcornToEsprimaCommentConverter\n */\n\n// ----------------------------------------------------------------------------\n// Utilities\n// ----------------------------------------------------------------------------\n/**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n * @returns {EsprimaComment} The comment object.\n * @private\n */\nfunction convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) {\n const comment = /** @type {EsprimaComment} */ ({\n type: block ? \"Block\" : \"Line\",\n value: text\n });\n\n if (typeof start === \"number\") {\n comment.start = start;\n comment.end = end;\n comment.range = [start, end];\n }\n\n if (typeof startLoc === \"object\") {\n comment.loc = {\n start: startLoc,\n end: endLoc\n };\n }\n\n return comment;\n}\n\n// ----------------------------------------------------------------------------\n// Exports\n// ----------------------------------------------------------------------------\n/* eslint-disable arrow-body-style -- Need to supply formatted JSDoc for type info */\nexport default () => {\n\n /**\n * Returns the Espree parser.\n * @param {AcornJsxParser} Parser The Acorn parser\n * @returns {typeof EspreeParser} The Espree parser\n */\n return Parser => {\n const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes));\n\n if (Parser.acornJsx) {\n Object.assign(tokTypes, Parser.acornJsx.tokTypes);\n }\n\n /* eslint-disable no-shadow -- Using first class as type */\n /**\n * @export\n */\n return class EspreeParser extends Parser {\n /* eslint-enable no-shadow -- Using first class as type */\n /* eslint-disable jsdoc/check-types -- Allows generic object */\n /**\n * Adapted parser for Espree.\n * @param {ParserOptions|null} opts Espree options\n * @param {string|object} code The source code\n */\n constructor(opts, code) {\n /* eslint-enable jsdoc/check-types -- Allows generic object */\n\n /** @type {ParserOptions} */\n const newOpts = (typeof opts !== \"object\" || opts === null)\n ? {}\n : opts;\n\n const codeString = typeof code === \"string\"\n ? /** @type {string} */ (code)\n : String(code);\n\n // save original source type in case of commonjs\n const originalSourceType = newOpts.sourceType;\n const options = normalizeOptions(newOpts);\n const ecmaFeatures = options.ecmaFeatures || {};\n const tokenTranslator =\n options.tokens === true\n ? new TokenTranslator(tokTypes, codeString)\n : null;\n\n // Initialize acorn parser.\n super({\n\n // do not use spread, because we don't want to pass any unknown options to acorn\n ecmaVersion: options.ecmaVersion,\n sourceType: options.sourceType,\n ranges: options.ranges,\n locations: options.locations,\n allowReserved: options.allowReserved,\n\n // Truthy value is true for backward compatibility.\n allowReturnOutsideFunction: options.allowReturnOutsideFunction,\n\n // Collect tokens\n /**\n * Handler for receiving a token\n * @param {acorn.Token} token The token\n * @returns {void}\n */\n onToken: token => {\n if (tokenTranslator) {\n\n // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.\n tokenTranslator.onToken(token, /** @type {StateObjectWithTokens} */ (this[STATE]));\n }\n if (token.type !== tokTypes.eof) {\n this[STATE].lastToken = token;\n }\n },\n\n // Collect comments\n /**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n */\n onComment: (block, text, start, end, startLoc, endLoc) => {\n if (this[STATE].comments) {\n const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc);\n\n const comments = /** @type {EsprimaComment[]} */ (this[STATE].comments);\n\n comments.push(comment);\n }\n }\n }, codeString);\n\n // Force for TypeScript (indicating that `lineStart` is not undefined)\n if (!this.lineStart) {\n this.lineStart = 0;\n }\n\n /**\n * Data that is unique to Espree and is not represented internally in\n * Acorn. We put all of this data into a symbol property as a way to\n * avoid potential naming conflicts with future versions of Acorn.\n * @type {StateObjectWithTokens|StateObject}\n */\n this[STATE] = {\n originalSourceType: originalSourceType || options.sourceType,\n tokens: tokenTranslator ? /** @type {EspreeTokens} */ ([]) : null,\n comments: options.comment === true\n ? /** @type {EsprimaComment[]} */ ([])\n : null,\n impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,\n ecmaVersion: this.options.ecmaVersion,\n jsxAttrValueToken: false,\n\n /** @type {acorn.Token|null} */\n lastToken: null,\n\n /** @type {(AcornTemplateNode)[]} */\n templateElements: []\n };\n }\n\n /**\n * Returns Espree tokens.\n * @returns {EspreeTokens|null} Espree tokens\n */\n tokenize() {\n do {\n this.next();\n } while (this.type !== tokTypes.eof);\n\n // Consume the final eof token\n this.next();\n\n const extra = this[STATE];\n const tokens = extra.tokens;\n\n if (extra.comments && tokens) {\n tokens.comments = extra.comments;\n }\n\n return tokens;\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @returns {acorn.Node} The altered Node\n */\n finishNode(node, type) {\n const result = super.finishNode(node, type);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @param {number} pos The position\n * @param {acorn.Position} loc The location\n * @returns {acorn.Node} The altered Node\n */\n finishNodeAt(node, type, pos, loc) {\n const result = super.finishNodeAt(node, type, pos, loc);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Parses.\n * @returns {EsprimaProgramNode} The program Node\n */\n parse() {\n const extra = this[STATE];\n\n const program = /** @type {EsprimaProgramNode} */ (super.parse());\n\n program.sourceType = extra.originalSourceType;\n\n if (extra.comments) {\n program.comments = extra.comments;\n }\n if (extra.tokens) {\n program.tokens = extra.tokens;\n }\n\n /*\n * Adjust opening and closing position of program to match Esprima.\n * Acorn always starts programs at range 0 whereas Esprima starts at the\n * first AST node's start (the only real difference is when there's leading\n * whitespace or leading comments). Acorn also counts trailing whitespace\n * as part of the program whereas Esprima only counts up to the last token.\n */\n if (program.body.length) {\n const [firstNode] = program.body;\n\n if (program.range && firstNode.range) {\n program.range[0] = firstNode.range[0];\n }\n if (program.loc && firstNode.loc) {\n program.loc.start = firstNode.loc.start;\n }\n program.start = firstNode.start;\n }\n if (extra.lastToken) {\n if (program.range && extra.lastToken.range) {\n program.range[1] = extra.lastToken.range[1];\n }\n if (program.loc && extra.lastToken.loc) {\n program.loc.end = extra.lastToken.loc.end;\n }\n program.end = extra.lastToken.end;\n }\n\n\n /*\n * https://github.com/eslint/espree/issues/349\n * Ensure that template elements have correct range information.\n * This is one location where Acorn produces a different value\n * for its start and end properties vs. the values present in the\n * range property. In order to avoid confusion, we set the start\n * and end properties to the values that are present in range.\n * This is done here, instead of in finishNode(), because Acorn\n * uses the values of start and end internally while parsing, making\n * it dangerous to change those values while parsing is ongoing.\n * By waiting until the end of parsing, we can safely change these\n * values without affect any other part of the process.\n */\n this[STATE].templateElements.forEach(templateElement => {\n const startOffset = -1;\n const endOffset = templateElement.tail ? 1 : 2;\n\n templateElement.start += startOffset;\n templateElement.end += endOffset;\n\n if (templateElement.range) {\n templateElement.range[0] += startOffset;\n templateElement.range[1] += endOffset;\n }\n\n if (templateElement.loc) {\n templateElement.loc.start.column += startOffset;\n templateElement.loc.end.column += endOffset;\n }\n });\n\n return program;\n }\n\n /**\n * Parses top level.\n * @param {acorn.Node} node AST Node\n * @returns {acorn.Node} The changed node\n */\n parseTopLevel(node) {\n if (this[STATE].impliedStrict) {\n this.strict = true;\n }\n return super.parseTopLevel(node);\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raise(pos, message) {\n const loc = Parser.acorn.getLineInfo(this.input, pos);\n\n /** @type {EnhancedSyntaxError} */\n const err = new SyntaxError(message);\n\n err.index = pos;\n err.lineNumber = loc.line;\n err.column = loc.column + 1; // acorn uses 0-based columns\n throw err;\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raiseRecoverable(pos, message) {\n this.raise(pos, message);\n }\n\n /**\n * Overwrites the default unexpected method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n unexpected(pos) {\n let message = \"Unexpected token\";\n\n if (pos !== null && pos !== void 0) {\n this.pos = pos;\n\n if (this.options.locations) {\n while (this.pos < /** @type {int} */ (this.lineStart)) {\n\n /** @type {int} */\n this.lineStart = this.input.lastIndexOf(\"\\n\", /** @type {int} */ (this.lineStart) - 2) + 1;\n --this.curLine;\n }\n }\n\n this.nextToken();\n }\n\n if (this.end > this.start) {\n message += ` ${this.input.slice(this.start, this.end)}`;\n }\n\n this.raise(this.start, message);\n }\n\n /**\n * Esprima-FB represents JSX strings as tokens called \"JSXText\", but Acorn-JSX\n * uses regular tt.string without any distinction between this and regular JS\n * strings. As such, we intercept an attempt to read a JSX string and set a flag\n * on extra so that when tokens are converted, the next token will be switched\n * to JSXText via onToken.\n * @param {number} quote A character code\n * @returns {void}\n */\n jsx_readString(quote) { // eslint-disable-line camelcase\n if (typeof super.jsx_readString === \"undefined\") {\n throw new Error(\"Not a JSX parser\");\n }\n super.jsx_readString(quote);\n\n if (this.type === tokTypes.string) {\n this[STATE].jsxAttrValueToken = true;\n }\n }\n\n /**\n * Performs last-minute Esprima-specific compatibility checks and fixes.\n * @param {acorn.Node} result The node to check.\n * @returns {EsprimaNode} The finished node.\n */\n [ESPRIMA_FINISH_NODE](result) {\n\n const esprimaResult = /** @type {EsprimaNode} */ (result);\n\n // Acorn doesn't count the opening and closing backticks as part of templates\n // so we have to adjust ranges/locations appropriately.\n if (result.type === \"TemplateElement\") {\n\n // save template element references to fix start/end later\n this[STATE].templateElements.push(result);\n }\n\n if (result.type.includes(\"Function\") && !esprimaResult.generator) {\n esprimaResult.generator = false;\n }\n\n return esprimaResult;\n }\n };\n };\n};\n","const version = \"main\";\n\nexport default version;\n","/**\n * @fileoverview Main Espree file that converts Acorn into Esprima output.\n *\n * This file contains code from the following MIT-licensed projects:\n * 1. Acorn\n * 2. Babylon\n * 3. Babel-ESLint\n *\n * This file also contains code from Esprima, which is BSD licensed.\n *\n * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)\n * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)\n * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie \n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/* eslint no-undefined:0, no-use-before-define: 0 */\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {3|5|6|7|8|9|10|11|12|13|2015|2016|2017|2018|2019|2020|2021|2022|'latest'} ecmaVersion\n */\n\n/**\n * @typedef {import('./lib/token-translator').EsprimaToken} EspreeToken\n */\n\n/**\n * @typedef {import('./lib/espree').EsprimaComment} EspreeComment\n */\n\n/**\n * @typedef {{\n * comments?: EspreeComment[]\n * } & EspreeToken[]} EspreeTokens\n */\n\n/**\n * `jsx.Options` gives us 2 optional properties, so extend it\n *\n * `allowReserved`, `ranges`, `locations`, `allowReturnOutsideFunction`,\n * `onToken`, and `onComment` are as in `acorn.Options`\n *\n * `ecmaVersion` currently as in `acorn.Options` though optional\n *\n * `sourceType` as in `acorn.Options` but also allows `commonjs`\n *\n * `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options`\n *\n * `comment` is not in `acorn.Options` and doesn't err without it, but is used\n */\n/**\n * @typedef {{\n * allowReserved?: boolean,\n * ecmaVersion?: ecmaVersion,\n * sourceType?: \"script\"|\"module\"|\"commonjs\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * range?: boolean,\n * loc?: boolean,\n * tokens?: boolean,\n * comment?: boolean,\n * }} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('./lib/espree').EnhancedSyntaxError} EnhancedSyntaxError\n * @typedef {typeof import('./lib/espree').EspreeParser} IEspreeParser\n */\n\nimport * as acorn from \"acorn\";\nimport jsx from \"acorn-jsx\";\nimport espree from \"./lib/espree.js\";\nimport espreeVersion from \"./lib/version.js\";\nimport * as visitorKeys from \"eslint-visitor-keys\";\nimport { getLatestEcmaVersion, getSupportedEcmaVersions } from \"./lib/options.js\";\n\n\n// To initialize lazily.\nconst parsers = {\n _regular: /** @type {IEspreeParser|null} */ (null),\n _jsx: /** @type {IEspreeParser|null} */ (null),\n\n /**\n * Returns regular Parser\n * @returns {IEspreeParser} Regular Acorn parser\n */\n get regular() {\n if (this._regular === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n\n this._regular = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._regular;\n },\n\n /**\n * Returns JSX Parser\n * @returns {IEspreeParser} JSX Acorn parser\n */\n get jsx() {\n if (this._jsx === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n const jsxFactory = jsx();\n\n this._jsx = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n jsxFactory,\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._jsx;\n },\n\n /**\n * Returns Regular or JSX Parser\n * @param {ParserOptions} options Parser options\n * @returns {IEspreeParser} Regular or JSX Acorn parser\n */\n get(options) {\n const useJsx = Boolean(\n options &&\n options.ecmaFeatures &&\n options.ecmaFeatures.jsx\n );\n\n return useJsx ? this.jsx : this.regular;\n }\n};\n\n//------------------------------------------------------------------------------\n// Tokenizer\n//------------------------------------------------------------------------------\n\n/**\n * Tokenizes the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {EspreeTokens} An array of tokens.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n * @private\n */\nexport function tokenize(code, options) {\n const Parser = parsers.get(options);\n\n // Ensure to collect tokens.\n if (!options || options.tokens !== true) {\n options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign\n }\n\n return /** @type {EspreeTokens} */ (new Parser(options, code).tokenize());\n}\n\n//------------------------------------------------------------------------------\n// Parser\n//------------------------------------------------------------------------------\n\n/**\n * Parses the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {acorn.Node} The \"Program\" AST node.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n */\nexport function parse(code, options) {\n const Parser = parsers.get(options);\n\n return new Parser(options, code).parse();\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport const version = espreeVersion;\n\n/* istanbul ignore next */\nexport const VisitorKeys = (function() {\n return visitorKeys.KEYS;\n}());\n\n// Derive node types from VisitorKeys\n/* istanbul ignore next */\nexport const Syntax = (function() {\n let /** @type {Object} */\n types = {};\n\n if (typeof Object.create === \"function\") {\n types = Object.create(null);\n }\n\n for (const name of Object.keys(VisitorKeys)) {\n types[name] = name;\n }\n\n if (typeof Object.freeze === \"function\") {\n Object.freeze(types);\n }\n\n return types;\n}());\n\nexport const latestEcmaVersion = getLatestEcmaVersion();\n\nexport const supportedEcmaVersions = getSupportedEcmaVersions();\n"],"names":["version","acorn","jsx","espreeVersion","visitorKeys"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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EAAE;AACpD,QAAQ,MAAM,IAAI,KAAK,CAAC,8HAA8H,CAAC,CAAC;AACxJ,KAAK;AACL;AACA,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE;AACtC,QAAQ,WAAW;AACnB,QAAQ,UAAU;AAClB,QAAQ,MAAM;AACd,QAAQ,SAAS;AACjB,QAAQ,aAAa;AACrB,QAAQ,0BAA0B;AAClC,KAAK,CAAC,CAAC;AACP;;AC7JA;AAGA;AACA,MAAM,KAAK,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAChD,MAAM,mBAAmB,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mCAAmC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE;AACxF,IAAI,MAAM,OAAO,kCAAkC;AACnD,QAAQ,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM;AACtC,QAAQ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AAwB;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"espree.cjs","sources":["../lib/token-translator.js","../lib/options.js","../lib/espree.js","../lib/version.js","../espree.js"],"sourcesContent":["/**\n * @fileoverview Translates tokens between Acorn format and Esprima format.\n * @author Nicholas C. Zakas\n */\n/* eslint no-underscore-dangle: 0 */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('./espree').EnhancedTokTypes} EnhancedTokTypes\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * Based on the `acorn.Token` class, but without a fixed `type` (since we need\n * it to be a string). Avoiding `type` lets us make one extending interface\n * more strict and another more lax.\n *\n * We could make `value` more strict to `string` even though the original is\n * `any`.\n *\n * `start` and `end` are required in `acorn.Token`\n *\n * `loc` and `range` are from `acorn.Token`\n *\n * Adds `regex`.\n */\n/**\n * @local\n *\n * @typedef {{\n * value: any;\n * start?: number;\n * end?: number;\n * loc?: acorn.SourceLocation;\n * range?: [number, number];\n * regex?: {flags: string, pattern: string};\n * }} BaseEsprimaToken\n *\n * @typedef {{\n * jsxAttrValueToken: boolean;\n * ecmaVersion: ecmaVersion;\n * }} ExtraNoTokens\n *\n * @typedef {{\n * tokens: EsprimaToken[]\n * } & ExtraNoTokens} Extra\n */\n\n/**\n * @typedef {{\n * type: string;\n * } & BaseEsprimaToken} EsprimaToken\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\n// none!\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n\n// Esprima Token Types\nconst Token = {\n Boolean: \"Boolean\",\n EOF: \"\",\n Identifier: \"Identifier\",\n PrivateIdentifier: \"PrivateIdentifier\",\n Keyword: \"Keyword\",\n Null: \"Null\",\n Numeric: \"Numeric\",\n Punctuator: \"Punctuator\",\n String: \"String\",\n RegularExpression: \"RegularExpression\",\n Template: \"Template\",\n JSXIdentifier: \"JSXIdentifier\",\n JSXText: \"JSXText\"\n};\n\n/**\n * Converts part of a template into an Esprima token.\n * @param {(acorn.Token)[]} tokens The Acorn tokens representing the template.\n * @param {string} code The source code.\n * @returns {EsprimaToken} The Esprima equivalent of the template token.\n * @private\n */\nfunction convertTemplatePart(tokens, code) {\n const firstToken = tokens[0],\n lastTemplateToken = tokens[tokens.length - 1];\n\n /** @type {EsprimaToken} */\n const token = {\n type: Token.Template,\n value: code.slice(firstToken.start, lastTemplateToken.end)\n };\n\n if (firstToken.loc && lastTemplateToken.loc) {\n token.loc = {\n start: firstToken.loc.start,\n end: lastTemplateToken.loc.end\n };\n }\n\n if (firstToken.range && lastTemplateToken.range) {\n token.start = firstToken.range[0];\n token.end = lastTemplateToken.range[1];\n token.range = [token.start, token.end];\n }\n\n return token;\n}\n\nclass TokenTranslator {\n\n /**\n * Contains logic to translate Acorn tokens into Esprima tokens.\n * @param {EnhancedTokTypes} acornTokTypes The Acorn token types.\n * @param {string} code The source code Acorn is parsing. This is necessary\n * to correct the \"value\" property of some tokens.\n */\n constructor(acornTokTypes, code) {\n\n // token types\n this._acornTokTypes = acornTokTypes;\n\n // token buffer for templates\n /** @type {acorn.Token[]} */\n this._tokens = [];\n\n // track the last curly brace\n this._curlyBrace = null;\n\n // the source code\n this._code = code;\n\n }\n\n /**\n * Translates a single Acorn token to a single Esprima token. This may be\n * inaccurate due to how templates are handled differently in Esprima and\n * Acorn, but should be accurate for all other tokens.\n * @param {acorn.Token} token The Acorn token to translate.\n * @param {ExtraNoTokens} extra Espree extra object.\n * @returns {EsprimaToken} The Esprima version of the token.\n */\n translate(token, extra) {\n\n const type = token.type,\n tt = this._acornTokTypes,\n\n // We use an unknown type because `acorn.Token` is a class whose\n // `type` property we cannot override to our desired `string`;\n // this also allows us to define a stricter `EsprimaToken` with\n // a string-only `type` property\n unknownType = /** @type {unknown} */ (token),\n newToken = /** @type {EsprimaToken} */ (unknownType);\n\n if (type === tt.name) {\n newToken.type = Token.Identifier;\n\n // TODO: See if this is an Acorn bug\n if (token.value === \"static\") {\n newToken.type = Token.Keyword;\n }\n\n if (extra.ecmaVersion > 5 && (token.value === \"yield\" || token.value === \"let\")) {\n newToken.type = Token.Keyword;\n }\n\n } else if (type === tt.privateId) {\n newToken.type = Token.PrivateIdentifier;\n\n } else if (type === tt.semi || type === tt.comma ||\n type === tt.parenL || type === tt.parenR ||\n type === tt.braceL || type === tt.braceR ||\n type === tt.dot || type === tt.bracketL ||\n type === tt.colon || type === tt.question ||\n type === tt.bracketR || type === tt.ellipsis ||\n type === tt.arrow || type === tt.jsxTagStart ||\n type === tt.incDec || type === tt.starstar ||\n type === tt.jsxTagEnd || type === tt.prefix ||\n type === tt.questionDot ||\n (type.binop && !type.keyword) ||\n type.isAssign) {\n\n newToken.type = Token.Punctuator;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.jsxName) {\n newToken.type = Token.JSXIdentifier;\n } else if (type.label === \"jsxText\" || type === tt.jsxAttrValueToken) {\n newToken.type = Token.JSXText;\n } else if (type.keyword) {\n if (type.keyword === \"true\" || type.keyword === \"false\") {\n newToken.type = Token.Boolean;\n } else if (type.keyword === \"null\") {\n newToken.type = Token.Null;\n } else {\n newToken.type = Token.Keyword;\n }\n } else if (type === tt.num) {\n newToken.type = Token.Numeric;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.string) {\n\n if (extra.jsxAttrValueToken) {\n extra.jsxAttrValueToken = false;\n newToken.type = Token.JSXText;\n } else {\n newToken.type = Token.String;\n }\n\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.regexp) {\n newToken.type = Token.RegularExpression;\n const value = token.value;\n\n newToken.regex = {\n flags: value.flags,\n pattern: value.pattern\n };\n newToken.value = `/${value.pattern}/${value.flags}`;\n }\n\n return newToken;\n }\n\n /**\n * Function to call during Acorn's onToken handler.\n * @param {acorn.Token} token The Acorn token.\n * @param {Extra} extra The Espree extra object.\n * @returns {void}\n */\n onToken(token, extra) {\n\n const that = this,\n tt = this._acornTokTypes,\n tokens = extra.tokens,\n templateTokens = this._tokens;\n\n /**\n * Flushes the buffered template tokens and resets the template\n * tracking.\n * @returns {void}\n * @private\n */\n function translateTemplateTokens() {\n tokens.push(convertTemplatePart(that._tokens, that._code));\n that._tokens = [];\n }\n\n if (token.type === tt.eof) {\n\n // might be one last curlyBrace\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n return;\n }\n\n if (token.type === tt.backQuote) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n\n // it's the end\n if (templateTokens.length > 1) {\n translateTemplateTokens();\n }\n\n return;\n }\n if (token.type === tt.dollarBraceL) {\n templateTokens.push(token);\n translateTemplateTokens();\n return;\n }\n if (token.type === tt.braceR) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n // store new curly for later\n this._curlyBrace = token;\n return;\n }\n if (token.type === tt.template || token.type === tt.invalidTemplate) {\n if (this._curlyBrace) {\n templateTokens.push(this._curlyBrace);\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n return;\n }\n\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n tokens.push(this.translate(token, extra));\n }\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport default TokenTranslator;\n","/**\n * @fileoverview A collection of methods for processing Espree's options.\n * @author Kai Cataldo\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * ecmaVersion: ecmaVersion,\n * sourceType: \"script\"|\"module\",\n * range?: boolean,\n * loc?: boolean,\n * allowReserved: boolean | \"never\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * ranges: boolean,\n * locations: boolean,\n * allowReturnOutsideFunction: boolean,\n * tokens?: boolean,\n * comment?: boolean\n * }} NormalizedParserOptions\n */\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst SUPPORTED_VERSIONS = [\n 3,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13\n];\n\n/**\n * Get the latest ECMAScript version supported by Espree.\n * @returns {number} The latest ECMAScript version.\n */\nexport function getLatestEcmaVersion() {\n return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1];\n}\n\n/**\n * Get the list of ECMAScript versions supported by Espree.\n * @returns {number[]} An array containing the supported ECMAScript versions.\n */\nexport function getSupportedEcmaVersions() {\n return [...SUPPORTED_VERSIONS];\n}\n\n/**\n * Normalize ECMAScript version from the initial config\n * @param {number|\"latest\"} ecmaVersion ECMAScript version from the initial config\n * @throws {Error} throws an error if the ecmaVersion is invalid.\n * @returns {number} normalized ECMAScript version\n */\nfunction normalizeEcmaVersion(ecmaVersion = 5) {\n\n let version = ecmaVersion === \"latest\" ? getLatestEcmaVersion() : ecmaVersion;\n\n if (typeof version !== \"number\") {\n throw new Error(`ecmaVersion must be a number or \"latest\". Received value of type ${typeof ecmaVersion} instead.`);\n }\n\n // Calculate ECMAScript edition number from official year version starting with\n // ES2015, which corresponds with ES6 (or a difference of 2009).\n if (version >= 2015) {\n version -= 2009;\n }\n\n if (!SUPPORTED_VERSIONS.includes(version)) {\n throw new Error(\"Invalid ecmaVersion.\");\n }\n\n return version;\n}\n\n/**\n * Normalize sourceType from the initial config\n * @param {\"script\"|\"module\"|\"commonjs\"} sourceType to normalize\n * @throws {Error} throw an error if sourceType is invalid\n * @returns {\"script\"|\"module\"} normalized sourceType\n */\nfunction normalizeSourceType(sourceType = \"script\") {\n if (sourceType === \"script\" || sourceType === \"module\") {\n return sourceType;\n }\n\n if (sourceType === \"commonjs\") {\n return \"script\";\n }\n\n throw new Error(\"Invalid sourceType.\");\n}\n\n/**\n * Normalize parserOptions\n * @param {ParserOptions} options the parser options to normalize\n * @throws {Error} throw an error if found invalid option.\n * @returns {NormalizedParserOptions} normalized options\n */\nexport function normalizeOptions(options) {\n const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion);\n\n const sourceType = normalizeSourceType(options.sourceType);\n const ranges = options.range === true;\n const locations = options.loc === true;\n\n if (ecmaVersion !== 3 && options.allowReserved) {\n\n // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed\n throw new Error(\"`allowReserved` is only supported when ecmaVersion is 3\");\n }\n\n // Note: value in Acorn can also be \"never\" but we throw in such a case\n if (typeof options.allowReserved !== \"undefined\" && typeof options.allowReserved !== \"boolean\") {\n throw new Error(\"`allowReserved`, when present, must be `true` or `false`\");\n }\n const allowReserved = ecmaVersion === 3 ? (options.allowReserved || \"never\") : false;\n const ecmaFeatures = options.ecmaFeatures || {};\n const allowReturnOutsideFunction = options.sourceType === \"commonjs\" ||\n Boolean(ecmaFeatures.globalReturn);\n\n if (sourceType === \"module\" && ecmaVersion < 6) {\n throw new Error(\"sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.\");\n }\n\n return Object.assign({}, options, {\n ecmaVersion,\n sourceType,\n ranges,\n locations,\n allowReserved,\n allowReturnOutsideFunction\n });\n}\n","/* eslint-disable no-param-reassign*/\nimport TokenTranslator from \"./token-translator.js\";\nimport { normalizeOptions } from \"./options.js\";\n\nconst STATE = Symbol(\"espree's internal state\");\nconst ESPRIMA_FINISH_NODE = Symbol(\"espree's esprimaFinishNode\");\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {{\n * index?: number;\n * lineNumber?: number;\n * column?: number;\n * } & SyntaxError} EnhancedSyntaxError\n */\n\n// We add `jsxAttrValueToken` ourselves.\n/**\n * @typedef {{\n * jsxAttrValueToken?: acorn.TokenType;\n * } & tokTypesType} EnhancedTokTypes\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * generator?: boolean\n * } & acorn.Node} EsprimaNode\n */\n/**\n * Suggests an integer\n * @local\n * @typedef {number} int\n */\n\n/**\n * @typedef {{\n * type: string,\n * value: string,\n * range?: [number, number],\n * start?: number,\n * end?: number,\n * loc?: {\n * start: acorn.Position | undefined,\n * end: acorn.Position | undefined\n * }\n * }} EsprimaComment\n */\n\n/**\n * First two properties as in `acorn.Comment`; next two as in `acorn.Comment`\n * but optional. Last is different as has to allow `undefined`\n */\n/**\n * @local\n *\n * @typedef {import('../espree').EspreeTokens} EspreeTokens\n *\n * @typedef {{\n * tail?: boolean\n * } & acorn.Node} AcornTemplateNode\n *\n * @typedef {{\n * originalSourceType: \"script\"|\"module\"|\"commonjs\";\n * ecmaVersion: ecmaVersion;\n * comments: EsprimaComment[]|null;\n * impliedStrict: boolean;\n * lastToken: acorn.Token|null;\n * templateElements: (AcornTemplateNode)[];\n * jsxAttrValueToken: boolean;\n * }} BaseStateObject\n *\n * @typedef {{\n * tokens: null;\n * } & BaseStateObject} StateObject\n *\n * @typedef {{\n * tokens: EspreeTokens;\n * } & BaseStateObject} StateObjectWithTokens\n *\n * @typedef {{\n * sourceType?: \"script\"|\"module\"|\"commonjs\";\n * comments?: EsprimaComment[];\n * tokens?: import('./token-translator').EsprimaToken[];\n * body: acorn.Node[];\n * } & acorn.Node} EsprimaProgramNode\n */\n/**\n * Converts an Acorn comment to an Esprima comment.\n *\n * - block True if it's a block comment, false if not.\n * - text The text of the comment.\n * - start The index at which the comment starts.\n * - end The index at which the comment ends.\n * - startLoc The location at which the comment starts.\n * - endLoc The location at which the comment ends.\n * @local\n * @typedef {(\n * block: boolean,\n * text: string,\n * start: int,\n * end: int,\n * startLoc: acorn.Position | undefined,\n * endLoc: acorn.Position | undefined\n * ) => EsprimaComment | void} AcornToEsprimaCommentConverter\n */\n\n// ----------------------------------------------------------------------------\n// Utilities\n// ----------------------------------------------------------------------------\n/**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n * @returns {EsprimaComment} The comment object.\n * @private\n */\nfunction convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) {\n const comment = /** @type {EsprimaComment} */ ({\n type: block ? \"Block\" : \"Line\",\n value: text\n });\n\n if (typeof start === \"number\") {\n comment.start = start;\n comment.end = end;\n comment.range = [start, end];\n }\n\n if (typeof startLoc === \"object\") {\n comment.loc = {\n start: startLoc,\n end: endLoc\n };\n }\n\n return comment;\n}\n\n// ----------------------------------------------------------------------------\n// Exports\n// ----------------------------------------------------------------------------\n/* eslint-disable arrow-body-style -- Need to supply formatted JSDoc for type info */\nexport default () => {\n\n /**\n * Returns the Espree parser.\n * @param {AcornJsxParser} Parser The Acorn parser\n * @returns {typeof EspreeParser} The Espree parser\n */\n return Parser => {\n const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes));\n\n if (Parser.acornJsx) {\n Object.assign(tokTypes, Parser.acornJsx.tokTypes);\n }\n\n /* eslint-disable no-shadow -- Using first class as type */\n /**\n * @export\n */\n return class EspreeParser extends Parser {\n /* eslint-enable no-shadow -- Using first class as type */\n /* eslint-disable jsdoc/check-types -- Allows generic object */\n /**\n * Adapted parser for Espree.\n * @param {ParserOptions|null} opts Espree options\n * @param {string|object} code The source code\n */\n constructor(opts, code) {\n /* eslint-enable jsdoc/check-types -- Allows generic object */\n\n const newOpts = (typeof opts !== \"object\" || opts === null)\n ? {}\n : opts;\n\n const codeString = typeof code === \"string\"\n ? code\n : String(code);\n\n // save original source type in case of commonjs\n const originalSourceType = newOpts.sourceType;\n const options = normalizeOptions(newOpts);\n const ecmaFeatures = options.ecmaFeatures || {};\n const tokenTranslator =\n options.tokens === true\n ? new TokenTranslator(tokTypes, codeString)\n : null;\n\n // Initialize acorn parser.\n super({\n\n // do not use spread, because we don't want to pass any unknown options to acorn\n ecmaVersion: options.ecmaVersion,\n sourceType: options.sourceType,\n ranges: options.ranges,\n locations: options.locations,\n allowReserved: options.allowReserved,\n\n // Truthy value is true for backward compatibility.\n allowReturnOutsideFunction: options.allowReturnOutsideFunction,\n\n // Collect tokens\n /**\n * Handler for receiving a token\n * @param {acorn.Token} token The token\n * @returns {void}\n */\n onToken: token => {\n if (tokenTranslator) {\n\n // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.\n tokenTranslator.onToken(token, /** @type {StateObjectWithTokens} */ (this[STATE]));\n }\n if (token.type !== tokTypes.eof) {\n this[STATE].lastToken = token;\n }\n },\n\n // Collect comments\n /**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n */\n onComment: (block, text, start, end, startLoc, endLoc) => {\n if (this[STATE].comments) {\n const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc);\n\n const comments = /** @type {EsprimaComment[]} */ (this[STATE].comments);\n\n comments.push(comment);\n }\n }\n }, codeString);\n\n // Force for TypeScript (indicating that `lineStart` is not undefined)\n if (!this.lineStart) {\n this.lineStart = 0;\n }\n\n /**\n * Data that is unique to Espree and is not represented internally in\n * Acorn. We put all of this data into a symbol property as a way to\n * avoid potential naming conflicts with future versions of Acorn.\n * @type {StateObjectWithTokens|StateObject}\n */\n this[STATE] = {\n originalSourceType: originalSourceType || options.sourceType,\n tokens: tokenTranslator ? /** @type {EspreeTokens} */ ([]) : null,\n comments: options.comment === true\n ? /** @type {EsprimaComment[]} */ ([])\n : null,\n impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,\n ecmaVersion: this.options.ecmaVersion,\n jsxAttrValueToken: false,\n\n /** @type {acorn.Token|null} */\n lastToken: null,\n\n /** @type {AcornTemplateNode[]} */\n templateElements: []\n };\n }\n\n /**\n * Returns Espree tokens.\n * @returns {EspreeTokens|null} Espree tokens\n */\n tokenize() {\n do {\n this.next();\n } while (this.type !== tokTypes.eof);\n\n // Consume the final eof token\n this.next();\n\n const extra = this[STATE];\n const tokens = extra.tokens;\n\n if (extra.comments && tokens) {\n tokens.comments = extra.comments;\n }\n\n return tokens;\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @returns {acorn.Node} The altered Node\n */\n finishNode(node, type) {\n const result = super.finishNode(node, type);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @param {number} pos The position\n * @param {acorn.Position} loc The location\n * @returns {acorn.Node} The altered Node\n */\n finishNodeAt(node, type, pos, loc) {\n const result = super.finishNodeAt(node, type, pos, loc);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Parses.\n * @returns {EsprimaProgramNode} The program Node\n */\n parse() {\n const extra = this[STATE];\n\n const program = /** @type {EsprimaProgramNode} */ (super.parse());\n\n program.sourceType = extra.originalSourceType;\n\n if (extra.comments) {\n program.comments = extra.comments;\n }\n if (extra.tokens) {\n program.tokens = extra.tokens;\n }\n\n /*\n * Adjust opening and closing position of program to match Esprima.\n * Acorn always starts programs at range 0 whereas Esprima starts at the\n * first AST node's start (the only real difference is when there's leading\n * whitespace or leading comments). Acorn also counts trailing whitespace\n * as part of the program whereas Esprima only counts up to the last token.\n */\n if (program.body.length) {\n const [firstNode] = program.body;\n\n if (program.range && firstNode.range) {\n program.range[0] = firstNode.range[0];\n }\n if (program.loc && firstNode.loc) {\n program.loc.start = firstNode.loc.start;\n }\n program.start = firstNode.start;\n }\n if (extra.lastToken) {\n if (program.range && extra.lastToken.range) {\n program.range[1] = extra.lastToken.range[1];\n }\n if (program.loc && extra.lastToken.loc) {\n program.loc.end = extra.lastToken.loc.end;\n }\n program.end = extra.lastToken.end;\n }\n\n\n /*\n * https://github.com/eslint/espree/issues/349\n * Ensure that template elements have correct range information.\n * This is one location where Acorn produces a different value\n * for its start and end properties vs. the values present in the\n * range property. In order to avoid confusion, we set the start\n * and end properties to the values that are present in range.\n * This is done here, instead of in finishNode(), because Acorn\n * uses the values of start and end internally while parsing, making\n * it dangerous to change those values while parsing is ongoing.\n * By waiting until the end of parsing, we can safely change these\n * values without affect any other part of the process.\n */\n this[STATE].templateElements.forEach(templateElement => {\n const startOffset = -1;\n const endOffset = templateElement.tail ? 1 : 2;\n\n templateElement.start += startOffset;\n templateElement.end += endOffset;\n\n if (templateElement.range) {\n templateElement.range[0] += startOffset;\n templateElement.range[1] += endOffset;\n }\n\n if (templateElement.loc) {\n templateElement.loc.start.column += startOffset;\n templateElement.loc.end.column += endOffset;\n }\n });\n\n return program;\n }\n\n /**\n * Parses top level.\n * @param {acorn.Node} node AST Node\n * @returns {acorn.Node} The changed node\n */\n parseTopLevel(node) {\n if (this[STATE].impliedStrict) {\n this.strict = true;\n }\n return super.parseTopLevel(node);\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raise(pos, message) {\n const loc = Parser.acorn.getLineInfo(this.input, pos);\n\n /** @type {EnhancedSyntaxError} */\n const err = new SyntaxError(message);\n\n err.index = pos;\n err.lineNumber = loc.line;\n err.column = loc.column + 1; // acorn uses 0-based columns\n throw err;\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raiseRecoverable(pos, message) {\n this.raise(pos, message);\n }\n\n /**\n * Overwrites the default unexpected method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n unexpected(pos) {\n let message = \"Unexpected token\";\n\n if (pos !== null && pos !== void 0) {\n this.pos = pos;\n\n if (this.options.locations) {\n while (this.pos < /** @type {int} */ (this.lineStart)) {\n\n /** @type {int} */\n this.lineStart = this.input.lastIndexOf(\"\\n\", /** @type {int} */ (this.lineStart) - 2) + 1;\n --this.curLine;\n }\n }\n\n this.nextToken();\n }\n\n if (this.end > this.start) {\n message += ` ${this.input.slice(this.start, this.end)}`;\n }\n\n this.raise(this.start, message);\n }\n\n /**\n * Esprima-FB represents JSX strings as tokens called \"JSXText\", but Acorn-JSX\n * uses regular tt.string without any distinction between this and regular JS\n * strings. As such, we intercept an attempt to read a JSX string and set a flag\n * on extra so that when tokens are converted, the next token will be switched\n * to JSXText via onToken.\n * @param {number} quote A character code\n * @returns {void}\n */\n jsx_readString(quote) { // eslint-disable-line camelcase\n if (typeof super.jsx_readString === \"undefined\") {\n throw new Error(\"Not a JSX parser\");\n }\n super.jsx_readString(quote);\n\n if (this.type === tokTypes.string) {\n this[STATE].jsxAttrValueToken = true;\n }\n }\n\n /**\n * Performs last-minute Esprima-specific compatibility checks and fixes.\n * @param {acorn.Node} result The node to check.\n * @returns {EsprimaNode} The finished node.\n */\n [ESPRIMA_FINISH_NODE](result) {\n\n const esprimaResult = /** @type {EsprimaNode} */ (result);\n\n // Acorn doesn't count the opening and closing backticks as part of templates\n // so we have to adjust ranges/locations appropriately.\n if (result.type === \"TemplateElement\") {\n\n // save template element references to fix start/end later\n this[STATE].templateElements.push(result);\n }\n\n if (result.type.includes(\"Function\") && !esprimaResult.generator) {\n esprimaResult.generator = false;\n }\n\n return esprimaResult;\n }\n };\n };\n};\n","const version = \"main\";\n\nexport default version;\n","/**\n * @fileoverview Main Espree file that converts Acorn into Esprima output.\n *\n * This file contains code from the following MIT-licensed projects:\n * 1. Acorn\n * 2. Babylon\n * 3. Babel-ESLint\n *\n * This file also contains code from Esprima, which is BSD licensed.\n *\n * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)\n * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)\n * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie \n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/* eslint no-undefined:0, no-use-before-define: 0 */\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {3|5|6|7|8|9|10|11|12|13|2015|2016|2017|2018|2019|2020|2021|2022|'latest'} ecmaVersion\n */\n\n/**\n * @typedef {import('./lib/token-translator').EsprimaToken} EspreeToken\n */\n\n/**\n * @typedef {import('./lib/espree').EsprimaComment} EspreeComment\n */\n\n/**\n * @typedef {{\n * comments?: EspreeComment[]\n * } & EspreeToken[]} EspreeTokens\n */\n\n/**\n * `jsx.Options` gives us 2 optional properties, so extend it\n *\n * `allowReserved`, `ranges`, `locations`, `allowReturnOutsideFunction`,\n * `onToken`, and `onComment` are as in `acorn.Options`\n *\n * `ecmaVersion` currently as in `acorn.Options` though optional\n *\n * `sourceType` as in `acorn.Options` but also allows `commonjs`\n *\n * `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options`\n *\n * `comment` is not in `acorn.Options` and doesn't err without it, but is used\n */\n/**\n * @typedef {{\n * allowReserved?: boolean,\n * ecmaVersion?: ecmaVersion,\n * sourceType?: \"script\"|\"module\"|\"commonjs\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * range?: boolean,\n * loc?: boolean,\n * tokens?: boolean,\n * comment?: boolean,\n * }} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('./lib/espree').EnhancedSyntaxError} EnhancedSyntaxError\n * @typedef {typeof import('./lib/espree').EspreeParser} IEspreeParser\n */\n\nimport * as acorn from \"acorn\";\nimport jsx from \"acorn-jsx\";\nimport espree from \"./lib/espree.js\";\nimport espreeVersion from \"./lib/version.js\";\nimport * as visitorKeys from \"eslint-visitor-keys\";\nimport { getLatestEcmaVersion, getSupportedEcmaVersions } from \"./lib/options.js\";\n\n\n// To initialize lazily.\nconst parsers = {\n _regular: /** @type {IEspreeParser|null} */ (null),\n _jsx: /** @type {IEspreeParser|null} */ (null),\n\n /**\n * Returns regular Parser\n * @returns {IEspreeParser} Regular Acorn parser\n */\n get regular() {\n if (this._regular === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n\n this._regular = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._regular;\n },\n\n /**\n * Returns JSX Parser\n * @returns {IEspreeParser} JSX Acorn parser\n */\n get jsx() {\n if (this._jsx === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n const jsxFactory = jsx();\n\n this._jsx = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n jsxFactory,\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._jsx;\n },\n\n /**\n * Returns Regular or JSX Parser\n * @param {ParserOptions} options Parser options\n * @returns {IEspreeParser} Regular or JSX Acorn parser\n */\n get(options) {\n const useJsx = Boolean(\n options &&\n options.ecmaFeatures &&\n options.ecmaFeatures.jsx\n );\n\n return useJsx ? this.jsx : this.regular;\n }\n};\n\n//------------------------------------------------------------------------------\n// Tokenizer\n//------------------------------------------------------------------------------\n\n/**\n * Tokenizes the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {EspreeTokens} An array of tokens.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n * @private\n */\nexport function tokenize(code, options) {\n const Parser = parsers.get(options);\n\n // Ensure to collect tokens.\n if (!options || options.tokens !== true) {\n options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign\n }\n\n return /** @type {EspreeTokens} */ (new Parser(options, code).tokenize());\n}\n\n//------------------------------------------------------------------------------\n// Parser\n//------------------------------------------------------------------------------\n\n/**\n * Parses the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {acorn.Node} The \"Program\" AST node.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n */\nexport function parse(code, options) {\n const Parser = parsers.get(options);\n\n return new Parser(options, code).parse();\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport const version = espreeVersion;\n\n/* istanbul ignore next */\nexport const VisitorKeys = (function() {\n return visitorKeys.KEYS;\n}());\n\n// Derive node types from VisitorKeys\n/* istanbul ignore next */\nexport const Syntax = (function() {\n let /** @type {Object} */\n types = {};\n\n if (typeof Object.create === \"function\") {\n types = Object.create(null);\n }\n\n for (const name of Object.keys(VisitorKeys)) {\n types[name] = name;\n }\n\n if (typeof Object.freeze === \"function\") {\n Object.freeze(types);\n }\n\n return types;\n}());\n\nexport const latestEcmaVersion = getLatestEcmaVersion();\n\nexport const supportedEcmaVersions = getSupportedEcmaVersions();\n"],"names":["version","acorn","jsx","espreeVersion","visitorKeys"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,KAAK,GAAG;AACd,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,GAAG,EAAE,OAAO;AAChB,IAAI,UAAU,EAAE,YAAY;AAC5B,IAAI,iBAAiB,EAAE,mBAAmB;AAC1C,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,UAAU,EAAE,YAAY;AAC5B,IAAI,MAAM,EAAE,QAAQ;AACpB,IAAI,iBAAiB,EAAE,mBAAmB;AAC1C,IAAI,QAAQ,EAAE,UAAU;AACxB,IAAI,aAAa,EAAE,eAAe;AAClC,IAAI,OAAO,EAAE,SAAS;AACtB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mBAAmB,CAAC,MAAM,EAAE,IAAI,EAAE;AAC3C,IAAI,MAAM,UAAU,GAAG,MAAM,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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mCAAmC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE;AACxF,IAAI,MAAM,OAAO,kCAAkC;AACnD,QAAQ,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM;AACtC,QAAQ,KAAK,EAAE,IAAI;AACnB,KAAK,CAAC,CAAC;AACP;AACA,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACnC,QAAQ,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AAC9B,QAAQ,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAC1B,QAAQ,OAAO,CAAC,KAAK,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACrC,KAAK;AACL;AACA,IAAI,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;AACtC,QAAQ,OAAO,CAAC,GAAG,GAAG;AACtB,YAAY,KAAK,EAAE,QAAQ;AAC3B,YAAY,GAAG,EAAE,MAAM;AACvB,SAAS,CAAC;AACV,KAAK;AACL;AACA,IAAI,OAAO,OAAO,CAAC;AACnB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,aAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,MAAM,IAAI;AACrB,QAA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IAAI;AACJ,QAAQ,KAAK,GAAG,EAAE,CAAC;AACnB;AACA,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;AAC7C,QAAQ,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,KAAK;AACL;AACA,IAAI,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;AACjD,QAAQ,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAC3B,KAAK;AACL;AACA,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;AAC7C,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7B,KAAK;AACL;AACA,IAAI,OAAO,KAAK,CAAC;AACjB,CAAC,EAAE,EAAE;AACL;AACY,MAAC,iBAAiB,GAAG,oBAAoB,GAAG;AACxD;AACY,MAAC,qBAAqB,GAAG,wBAAwB;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/lib/espree.d.ts b/dist/lib/espree.d.ts index 8fc305d9..35351eef 100644 --- a/dist/lib/espree.d.ts +++ b/dist/lib/espree.d.ts @@ -14,12 +14,12 @@ export class EspreeParser extends acorn.Parser { tokenize(): import('../espree').EspreeTokens | null; /** * Parses. - * @returns {{sourceType?: "script" | "module" | "commonjs"; comments?: EsprimaComment[]; tokens?: import('../espree').EspreeTokens; body: import('acorn').Node[]} & import('acorn').Node} The program Node + * @returns {{sourceType?: "script" | "module" | "commonjs"; comments?: EsprimaComment[]; tokens?: import('./token-translator').EsprimaToken[]; body: import('acorn').Node[]} & import('acorn').Node} The program Node */ parse(): { sourceType?: "script" | "module" | "commonjs"; comments?: EsprimaComment[]; - tokens?: import('../espree').EspreeTokens; + tokens?: import('./token-translator').EsprimaToken[]; body: import('acorn').Node[]; } & import('acorn').Node; /** diff --git a/dist/lib/espree.d.ts.map b/dist/lib/espree.d.ts.map index c4cf4532..056e587c 100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E,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE;QAAC,KAAK,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;QAAC,GAAG,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAA;KAAC,CAAA;CAAC"} \ No newline at end of file diff --git a/dist/lib/token-translator.d.ts.map b/dist/lib/token-translator.d.ts.map index 3c683e38..99d979f3 100644 --- a/dist/lib/token-translator.d.ts.map +++ b/dist/lib/token-translator.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"token-translator.d.ts","sourceRoot":"","sources":["../../tmp/lib/token-translator.js"],"names":[],"mappings":";2BAkBa;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,OAAO,EAAE,cAAc,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAA;CAAC;AAiDlL;IAEI;;;;;OAKG;IACH,2BAJW,OAAO,UAAU,EAAE,gBAAgB,QACnC,MAAM,EAQhB;IAJG,oDAAmC;IAC3B,wCAAwC,CAAC,SAA9B,CAAC,OAAO,OAAO,EAAE,KAAK,CAAC,EAAE,CAAsB;IAClE,0CAAuB;IACvB,cAAiB;IAGrB;;;;;;;OAOG;IACH,iBAJW,OAAO,OAAO,EAAE,KAAK,SACrB;QAAC,iBAAiB,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,WAAW,EAAE,WAAW,CAAA;KAAC,GACxE,YAAY,CAkDxB;IAED;;;;;OAKG;IACH,eAJW,OAAO,OAAO,EAAE,KAAK;gBACZ,YAAY,EAAE;;2BAAwB,OAAO;qBAAe,OAAO,WAAW,EAAE,WAAW;QAClG,IAAI,CAyDhB;CACJ"} \ No newline at end of file +{"version":3,"file":"token-translator.d.ts","sourceRoot":"","sources":["../../tmp/lib/token-translator.js"],"names":[],"mappings":";2BAkBa;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,OAAO,EAAE,cAAc,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAA;CAAC;AAiDlL;IAEI;;;;;OAKG;IACH,2BAJW,OAAO,UAAU,EAAE,gBAAgB,QACnC,MAAM,EAQhB;IAJG,oDAAmC;IAC3B,sCAAsC,CAAC,SAA5B,OAAO,OAAO,EAAE,KAAK,EAAE,CAAsB;IAChE,0CAAuB;IACvB,cAAiB;IAGrB;;;;;;;OAOG;IACH,iBAJW,OAAO,OAAO,EAAE,KAAK,SACrB;QAAC,iBAAiB,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,WAAW,EAAE,WAAW,CAAA;KAAC,GACxE,YAAY,CAkDxB;IAED;;;;;OAKG;IACH,eAJW,OAAO,OAAO,EAAE,KAAK;gBACZ,YAAY,EAAE;;2BAAwB,OAAO;qBAAe,OAAO,WAAW,EAAE,WAAW;QAClG,IAAI,CAyDhB;CACJ"} \ No newline at end of file diff --git a/lib/espree.js b/lib/espree.js index 9e506568..130a6025 100644 --- a/lib/espree.js +++ b/lib/espree.js @@ -98,7 +98,7 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * @typedef {{ * sourceType?: "script"|"module"|"commonjs"; * comments?: EsprimaComment[]; - * tokens?: EspreeTokens; + * tokens?: import('./token-translator').EsprimaToken[]; * body: acorn.Node[]; * } & acorn.Node} EsprimaProgramNode */ @@ -186,13 +186,12 @@ export default () => { constructor(opts, code) { /* eslint-enable jsdoc/check-types -- Allows generic object */ - /** @type {ParserOptions} */ const newOpts = (typeof opts !== "object" || opts === null) ? {} : opts; const codeString = typeof code === "string" - ? /** @type {string} */ (code) + ? code : String(code); // save original source type in case of commonjs @@ -274,7 +273,7 @@ export default () => { /** @type {acorn.Token|null} */ lastToken: null, - /** @type {(AcornTemplateNode)[]} */ + /** @type {AcornTemplateNode[]} */ templateElements: [] }; } diff --git a/lib/options.js b/lib/options.js index 40df434e..679c0167 100644 --- a/lib/options.js +++ b/lib/options.js @@ -123,7 +123,6 @@ function normalizeSourceType(sourceType = "script") { export function normalizeOptions(options) { const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); - /** @type {"script"|"module"} */ const sourceType = normalizeSourceType(options.sourceType); const ranges = options.range === true; const locations = options.loc === true; diff --git a/lib/token-translator.js b/lib/token-translator.js index 561acfbf..b40c85c0 100644 --- a/lib/token-translator.js +++ b/lib/token-translator.js @@ -134,7 +134,7 @@ class TokenTranslator { this._acornTokTypes = acornTokTypes; // token buffer for templates - /** @type {(acorn.Token)[]} */ + /** @type {acorn.Token[]} */ this._tokens = []; // track the last curly brace From 5e4ccb94f0b9609c92f02282d11befb031ea0a8e Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 12 May 2022 09:21:45 +0800 Subject: [PATCH 18/24] docs: add more descriprtive comments --- tools/js-for-ts.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/js-for-ts.js b/tools/js-for-ts.js index 02ade3b2..88a0292e 100644 --- a/tools/js-for-ts.js +++ b/tools/js-for-ts.js @@ -5,9 +5,9 @@ * @author Brett Zamir */ -//------------------------------------------------------------------------------ +//----------------------------------------------------------------------------- // Requirements -//------------------------------------------------------------------------------ +//----------------------------------------------------------------------------- import js2tsAssistant from "@es-joy/js2ts-assistant"; @@ -20,9 +20,12 @@ await js2tsAssistant({ ast, builders, superClassName }) { - // Since we're not tracking types as in using a - // proper TS transformer (like `ttypescript`?), - // we hack this one for now + // Since we're not tracking types as in using a proper TS transformer + // (like `ttypescript`?), we hack this one for now; for generating + // our dummy version of the private + // `class EspreeParser extends Parser`, we ensure `acorn` exists to be + // imported and that we extend from a reference accessible at the root + // level of the module if (superClassName === "Parser") { // Make import available @@ -45,7 +48,8 @@ await js2tsAssistant({ tag, identifier, typeCast }) { - // Hack in some needed type casts + // Since the super class is more restrictive, we hack in some type + // casts which would be difficult for `js2tsAssistant` to auto-detect if (tag.name === "opts") { identifier.jsdoc = typeCast({ typeLines: [ From 9b8080235ad15702e1bf225e4fbf3af2f19a0a2c Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 12 May 2022 11:32:50 +0800 Subject: [PATCH 19/24] refactor: update per current acorn-jsx PR update --- dist/espree.cjs | 2 +- dist/espree.cjs.map | 2 +- dist/lib/espree.d.ts | 2 +- dist/lib/espree.d.ts.map | 2 +- lib/espree.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/espree.cjs b/dist/espree.cjs index 570ad40e..4b009f21 100644 --- a/dist/espree.cjs +++ b/dist/espree.cjs @@ -539,7 +539,7 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); /** * @local * @typedef {import('acorn')} acorn - * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType + * @typedef {import('acorn-jsx').TokTypes} tokTypesType * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser * @typedef {import('../espree').ParserOptions} ParserOptions * @typedef {import('../espree').ecmaVersion} ecmaVersion diff --git a/dist/espree.cjs.map b/dist/espree.cjs.map index b0a5b1da..ce020f80 100644 --- a/dist/espree.cjs.map +++ b/dist/espree.cjs.map @@ -1 +1 @@ -{"version":3,"file":"espree.cjs","sources":["../lib/token-translator.js","../lib/options.js","../lib/espree.js","../lib/version.js","../espree.js"],"sourcesContent":["/**\n * @fileoverview Translates tokens between Acorn format and Esprima format.\n * @author Nicholas C. Zakas\n */\n/* eslint no-underscore-dangle: 0 */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('./espree').EnhancedTokTypes} EnhancedTokTypes\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * Based on the `acorn.Token` class, but without a fixed `type` (since we need\n * it to be a string). Avoiding `type` lets us make one extending interface\n * more strict and another more lax.\n *\n * We could make `value` more strict to `string` even though the original is\n * `any`.\n *\n * `start` and `end` are required in `acorn.Token`\n *\n * `loc` and `range` are from `acorn.Token`\n *\n * Adds `regex`.\n */\n/**\n * @local\n *\n * @typedef {{\n * value: any;\n * start?: number;\n * end?: number;\n * loc?: acorn.SourceLocation;\n * range?: [number, number];\n * regex?: {flags: string, pattern: string};\n * }} BaseEsprimaToken\n *\n * @typedef {{\n * jsxAttrValueToken: boolean;\n * ecmaVersion: ecmaVersion;\n * }} ExtraNoTokens\n *\n * @typedef {{\n * tokens: EsprimaToken[]\n * } & ExtraNoTokens} Extra\n */\n\n/**\n * @typedef {{\n * type: string;\n * } & BaseEsprimaToken} EsprimaToken\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\n// none!\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n\n// Esprima Token Types\nconst Token = {\n Boolean: \"Boolean\",\n EOF: \"\",\n Identifier: \"Identifier\",\n PrivateIdentifier: \"PrivateIdentifier\",\n Keyword: \"Keyword\",\n Null: \"Null\",\n Numeric: \"Numeric\",\n Punctuator: \"Punctuator\",\n String: \"String\",\n RegularExpression: \"RegularExpression\",\n Template: \"Template\",\n JSXIdentifier: \"JSXIdentifier\",\n JSXText: \"JSXText\"\n};\n\n/**\n * Converts part of a template into an Esprima token.\n * @param {(acorn.Token)[]} tokens The Acorn tokens representing the template.\n * @param {string} code The source code.\n * @returns {EsprimaToken} The Esprima equivalent of the template token.\n * @private\n */\nfunction convertTemplatePart(tokens, code) {\n const firstToken = tokens[0],\n lastTemplateToken = tokens[tokens.length - 1];\n\n /** @type {EsprimaToken} */\n const token = {\n type: Token.Template,\n value: code.slice(firstToken.start, lastTemplateToken.end)\n };\n\n if (firstToken.loc && lastTemplateToken.loc) {\n token.loc = {\n start: firstToken.loc.start,\n end: lastTemplateToken.loc.end\n };\n }\n\n if (firstToken.range && lastTemplateToken.range) {\n token.start = firstToken.range[0];\n token.end = lastTemplateToken.range[1];\n token.range = [token.start, token.end];\n }\n\n return token;\n}\n\nclass TokenTranslator {\n\n /**\n * Contains logic to translate Acorn tokens into Esprima tokens.\n * @param {EnhancedTokTypes} acornTokTypes The Acorn token types.\n * @param {string} code The source code Acorn is parsing. This is necessary\n * to correct the \"value\" property of some tokens.\n */\n constructor(acornTokTypes, code) {\n\n // token types\n this._acornTokTypes = acornTokTypes;\n\n // token buffer for templates\n /** @type {acorn.Token[]} */\n this._tokens = [];\n\n // track the last curly brace\n this._curlyBrace = null;\n\n // the source code\n this._code = code;\n\n }\n\n /**\n * Translates a single Acorn token to a single Esprima token. This may be\n * inaccurate due to how templates are handled differently in Esprima and\n * Acorn, but should be accurate for all other tokens.\n * @param {acorn.Token} token The Acorn token to translate.\n * @param {ExtraNoTokens} extra Espree extra object.\n * @returns {EsprimaToken} The Esprima version of the token.\n */\n translate(token, extra) {\n\n const type = token.type,\n tt = this._acornTokTypes,\n\n // We use an unknown type because `acorn.Token` is a class whose\n // `type` property we cannot override to our desired `string`;\n // this also allows us to define a stricter `EsprimaToken` with\n // a string-only `type` property\n unknownType = /** @type {unknown} */ (token),\n newToken = /** @type {EsprimaToken} */ (unknownType);\n\n if (type === tt.name) {\n newToken.type = Token.Identifier;\n\n // TODO: See if this is an Acorn bug\n if (token.value === \"static\") {\n newToken.type = Token.Keyword;\n }\n\n if (extra.ecmaVersion > 5 && (token.value === \"yield\" || token.value === \"let\")) {\n newToken.type = Token.Keyword;\n }\n\n } else if (type === tt.privateId) {\n newToken.type = Token.PrivateIdentifier;\n\n } else if (type === tt.semi || type === tt.comma ||\n type === tt.parenL || type === tt.parenR ||\n type === tt.braceL || type === tt.braceR ||\n type === tt.dot || type === tt.bracketL ||\n type === tt.colon || type === tt.question ||\n type === tt.bracketR || type === tt.ellipsis ||\n type === tt.arrow || type === tt.jsxTagStart ||\n type === tt.incDec || type === tt.starstar ||\n type === tt.jsxTagEnd || type === tt.prefix ||\n type === tt.questionDot ||\n (type.binop && !type.keyword) ||\n type.isAssign) {\n\n newToken.type = Token.Punctuator;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.jsxName) {\n newToken.type = Token.JSXIdentifier;\n } else if (type.label === \"jsxText\" || type === tt.jsxAttrValueToken) {\n newToken.type = Token.JSXText;\n } else if (type.keyword) {\n if (type.keyword === \"true\" || type.keyword === \"false\") {\n newToken.type = Token.Boolean;\n } else if (type.keyword === \"null\") {\n newToken.type = Token.Null;\n } else {\n newToken.type = Token.Keyword;\n }\n } else if (type === tt.num) {\n newToken.type = Token.Numeric;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.string) {\n\n if (extra.jsxAttrValueToken) {\n extra.jsxAttrValueToken = false;\n newToken.type = Token.JSXText;\n } else {\n newToken.type = Token.String;\n }\n\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.regexp) {\n newToken.type = Token.RegularExpression;\n const value = token.value;\n\n newToken.regex = {\n flags: value.flags,\n pattern: value.pattern\n };\n newToken.value = `/${value.pattern}/${value.flags}`;\n }\n\n return newToken;\n }\n\n /**\n * Function to call during Acorn's onToken handler.\n * @param {acorn.Token} token The Acorn token.\n * @param {Extra} extra The Espree extra object.\n * @returns {void}\n */\n onToken(token, extra) {\n\n const that = this,\n tt = this._acornTokTypes,\n tokens = extra.tokens,\n templateTokens = this._tokens;\n\n /**\n * Flushes the buffered template tokens and resets the template\n * tracking.\n * @returns {void}\n * @private\n */\n function translateTemplateTokens() {\n tokens.push(convertTemplatePart(that._tokens, that._code));\n that._tokens = [];\n }\n\n if (token.type === tt.eof) {\n\n // might be one last curlyBrace\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n return;\n }\n\n if (token.type === tt.backQuote) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n\n // it's the end\n if (templateTokens.length > 1) {\n translateTemplateTokens();\n }\n\n return;\n }\n if (token.type === tt.dollarBraceL) {\n templateTokens.push(token);\n translateTemplateTokens();\n return;\n }\n if (token.type === tt.braceR) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n // store new curly for later\n this._curlyBrace = token;\n return;\n }\n if (token.type === tt.template || token.type === tt.invalidTemplate) {\n if (this._curlyBrace) {\n templateTokens.push(this._curlyBrace);\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n return;\n }\n\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n tokens.push(this.translate(token, extra));\n }\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport default TokenTranslator;\n","/**\n * @fileoverview A collection of methods for processing Espree's options.\n * @author Kai Cataldo\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * ecmaVersion: ecmaVersion,\n * sourceType: \"script\"|\"module\",\n * range?: boolean,\n * loc?: boolean,\n * allowReserved: boolean | \"never\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * ranges: boolean,\n * locations: boolean,\n * allowReturnOutsideFunction: boolean,\n * tokens?: boolean,\n * comment?: boolean\n * }} NormalizedParserOptions\n */\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst SUPPORTED_VERSIONS = [\n 3,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13\n];\n\n/**\n * Get the latest ECMAScript version supported by Espree.\n * @returns {number} The latest ECMAScript version.\n */\nexport function getLatestEcmaVersion() {\n return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1];\n}\n\n/**\n * Get the list of ECMAScript versions supported by Espree.\n * @returns {number[]} An array containing the supported ECMAScript versions.\n */\nexport function getSupportedEcmaVersions() {\n return [...SUPPORTED_VERSIONS];\n}\n\n/**\n * Normalize ECMAScript version from the initial config\n * @param {number|\"latest\"} ecmaVersion ECMAScript version from the initial config\n * @throws {Error} throws an error if the ecmaVersion is invalid.\n * @returns {number} normalized ECMAScript version\n */\nfunction normalizeEcmaVersion(ecmaVersion = 5) {\n\n let version = ecmaVersion === \"latest\" ? getLatestEcmaVersion() : ecmaVersion;\n\n if (typeof version !== \"number\") {\n throw new Error(`ecmaVersion must be a number or \"latest\". Received value of type ${typeof ecmaVersion} instead.`);\n }\n\n // Calculate ECMAScript edition number from official year version starting with\n // ES2015, which corresponds with ES6 (or a difference of 2009).\n if (version >= 2015) {\n version -= 2009;\n }\n\n if (!SUPPORTED_VERSIONS.includes(version)) {\n throw new Error(\"Invalid ecmaVersion.\");\n }\n\n return version;\n}\n\n/**\n * Normalize sourceType from the initial config\n * @param {\"script\"|\"module\"|\"commonjs\"} sourceType to normalize\n * @throws {Error} throw an error if sourceType is invalid\n * @returns {\"script\"|\"module\"} normalized sourceType\n */\nfunction normalizeSourceType(sourceType = \"script\") {\n if (sourceType === \"script\" || sourceType === \"module\") {\n return sourceType;\n }\n\n if (sourceType === \"commonjs\") {\n return \"script\";\n }\n\n throw new Error(\"Invalid sourceType.\");\n}\n\n/**\n * Normalize parserOptions\n * @param {ParserOptions} options the parser options to normalize\n * @throws {Error} throw an error if found invalid option.\n * @returns {NormalizedParserOptions} normalized options\n */\nexport function normalizeOptions(options) {\n const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion);\n\n const sourceType = normalizeSourceType(options.sourceType);\n const ranges = options.range === true;\n const locations = options.loc === true;\n\n if (ecmaVersion !== 3 && options.allowReserved) {\n\n // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed\n throw new Error(\"`allowReserved` is only supported when ecmaVersion is 3\");\n }\n\n // Note: value in Acorn can also be \"never\" but we throw in such a case\n if (typeof options.allowReserved !== \"undefined\" && typeof options.allowReserved !== \"boolean\") {\n throw new Error(\"`allowReserved`, when present, must be `true` or `false`\");\n }\n const allowReserved = ecmaVersion === 3 ? (options.allowReserved || \"never\") : false;\n const ecmaFeatures = options.ecmaFeatures || {};\n const allowReturnOutsideFunction = options.sourceType === \"commonjs\" ||\n Boolean(ecmaFeatures.globalReturn);\n\n if (sourceType === \"module\" && ecmaVersion < 6) {\n throw new Error(\"sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.\");\n }\n\n return Object.assign({}, options, {\n ecmaVersion,\n sourceType,\n ranges,\n locations,\n allowReserved,\n allowReturnOutsideFunction\n });\n}\n","/* eslint-disable no-param-reassign*/\nimport TokenTranslator from \"./token-translator.js\";\nimport { normalizeOptions } from \"./options.js\";\n\nconst STATE = Symbol(\"espree's internal state\");\nconst ESPRIMA_FINISH_NODE = Symbol(\"espree's esprimaFinishNode\");\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {{\n * index?: number;\n * lineNumber?: number;\n * column?: number;\n * } & SyntaxError} EnhancedSyntaxError\n */\n\n// We add `jsxAttrValueToken` ourselves.\n/**\n * @typedef {{\n * jsxAttrValueToken?: acorn.TokenType;\n * } & tokTypesType} EnhancedTokTypes\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * generator?: boolean\n * } & acorn.Node} EsprimaNode\n */\n/**\n * Suggests an integer\n * @local\n * @typedef {number} int\n */\n\n/**\n * @typedef {{\n * type: string,\n * value: string,\n * range?: [number, number],\n * start?: number,\n * end?: number,\n * loc?: {\n * start: acorn.Position | undefined,\n * end: acorn.Position | undefined\n * }\n * }} EsprimaComment\n */\n\n/**\n * First two properties as in `acorn.Comment`; next two as in `acorn.Comment`\n * but optional. Last is different as has to allow `undefined`\n */\n/**\n * @local\n *\n * @typedef {import('../espree').EspreeTokens} EspreeTokens\n *\n * @typedef {{\n * tail?: boolean\n * } & acorn.Node} AcornTemplateNode\n *\n * @typedef {{\n * originalSourceType: \"script\"|\"module\"|\"commonjs\";\n * ecmaVersion: ecmaVersion;\n * comments: EsprimaComment[]|null;\n * impliedStrict: boolean;\n * lastToken: acorn.Token|null;\n * templateElements: (AcornTemplateNode)[];\n * jsxAttrValueToken: boolean;\n * }} BaseStateObject\n *\n * @typedef {{\n * tokens: null;\n * } & BaseStateObject} StateObject\n *\n * @typedef {{\n * tokens: EspreeTokens;\n * } & BaseStateObject} StateObjectWithTokens\n *\n * @typedef {{\n * sourceType?: \"script\"|\"module\"|\"commonjs\";\n * comments?: EsprimaComment[];\n * tokens?: import('./token-translator').EsprimaToken[];\n * body: acorn.Node[];\n * } & acorn.Node} EsprimaProgramNode\n */\n/**\n * Converts an Acorn comment to an Esprima comment.\n *\n * - block True if it's a block comment, false if not.\n * - text The text of the comment.\n * - start The index at which the comment starts.\n * - end The index at which the comment ends.\n * - startLoc The location at which the comment starts.\n * - endLoc The location at which the comment ends.\n * @local\n * @typedef {(\n * block: boolean,\n * text: string,\n * start: int,\n * end: int,\n * startLoc: acorn.Position | undefined,\n * endLoc: acorn.Position | undefined\n * ) => EsprimaComment | void} AcornToEsprimaCommentConverter\n */\n\n// ----------------------------------------------------------------------------\n// Utilities\n// ----------------------------------------------------------------------------\n/**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n * @returns {EsprimaComment} The comment object.\n * @private\n */\nfunction convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) {\n const comment = /** @type {EsprimaComment} */ ({\n type: block ? \"Block\" : \"Line\",\n value: text\n });\n\n if (typeof start === \"number\") {\n comment.start = start;\n comment.end = end;\n comment.range = [start, end];\n }\n\n if (typeof startLoc === \"object\") {\n comment.loc = {\n start: startLoc,\n end: endLoc\n };\n }\n\n return comment;\n}\n\n// ----------------------------------------------------------------------------\n// Exports\n// ----------------------------------------------------------------------------\n/* eslint-disable arrow-body-style -- Need to supply formatted JSDoc for type info */\nexport default () => {\n\n /**\n * Returns the Espree parser.\n * @param {AcornJsxParser} Parser The Acorn parser\n * @returns {typeof EspreeParser} The Espree parser\n */\n return Parser => {\n const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes));\n\n if (Parser.acornJsx) {\n Object.assign(tokTypes, Parser.acornJsx.tokTypes);\n }\n\n /* eslint-disable no-shadow -- Using first class as type */\n /**\n * @export\n */\n return class EspreeParser extends Parser {\n /* eslint-enable no-shadow -- Using first class as type */\n /* eslint-disable jsdoc/check-types -- Allows generic object */\n /**\n * Adapted parser for Espree.\n * @param {ParserOptions|null} opts Espree options\n * @param {string|object} code The source code\n */\n constructor(opts, code) {\n /* eslint-enable jsdoc/check-types -- Allows generic object */\n\n const newOpts = (typeof opts !== \"object\" || opts === null)\n ? {}\n : opts;\n\n const codeString = typeof code === \"string\"\n ? code\n : String(code);\n\n // save original source type in case of commonjs\n const originalSourceType = newOpts.sourceType;\n const options = normalizeOptions(newOpts);\n const ecmaFeatures = options.ecmaFeatures || {};\n const tokenTranslator =\n options.tokens === true\n ? new TokenTranslator(tokTypes, codeString)\n : null;\n\n // Initialize acorn parser.\n super({\n\n // do not use spread, because we don't want to pass any unknown options to acorn\n ecmaVersion: options.ecmaVersion,\n sourceType: options.sourceType,\n ranges: options.ranges,\n locations: options.locations,\n allowReserved: options.allowReserved,\n\n // Truthy value is true for backward compatibility.\n allowReturnOutsideFunction: options.allowReturnOutsideFunction,\n\n // Collect tokens\n /**\n * Handler for receiving a token\n * @param {acorn.Token} token The token\n * @returns {void}\n */\n onToken: token => {\n if (tokenTranslator) {\n\n // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.\n tokenTranslator.onToken(token, /** @type {StateObjectWithTokens} */ (this[STATE]));\n }\n if (token.type !== tokTypes.eof) {\n this[STATE].lastToken = token;\n }\n },\n\n // Collect comments\n /**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n */\n onComment: (block, text, start, end, startLoc, endLoc) => {\n if (this[STATE].comments) {\n const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc);\n\n const comments = /** @type {EsprimaComment[]} */ (this[STATE].comments);\n\n comments.push(comment);\n }\n }\n }, codeString);\n\n // Force for TypeScript (indicating that `lineStart` is not undefined)\n if (!this.lineStart) {\n this.lineStart = 0;\n }\n\n /**\n * Data that is unique to Espree and is not represented internally in\n * Acorn. We put all of this data into a symbol property as a way to\n * avoid potential naming conflicts with future versions of Acorn.\n * @type {StateObjectWithTokens|StateObject}\n */\n this[STATE] = {\n originalSourceType: originalSourceType || options.sourceType,\n tokens: tokenTranslator ? /** @type {EspreeTokens} */ ([]) : null,\n comments: options.comment === true\n ? /** @type {EsprimaComment[]} */ ([])\n : null,\n impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,\n ecmaVersion: this.options.ecmaVersion,\n jsxAttrValueToken: false,\n\n /** @type {acorn.Token|null} */\n lastToken: null,\n\n /** @type {AcornTemplateNode[]} */\n templateElements: []\n };\n }\n\n /**\n * Returns Espree tokens.\n * @returns {EspreeTokens|null} Espree tokens\n */\n tokenize() {\n do {\n this.next();\n } while (this.type !== tokTypes.eof);\n\n // Consume the final eof token\n this.next();\n\n const extra = this[STATE];\n const tokens = extra.tokens;\n\n if (extra.comments && tokens) {\n tokens.comments = extra.comments;\n }\n\n return tokens;\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @returns {acorn.Node} The altered Node\n */\n finishNode(node, type) {\n const result = super.finishNode(node, type);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @param {number} pos The position\n * @param {acorn.Position} loc The location\n * @returns {acorn.Node} The altered Node\n */\n finishNodeAt(node, type, pos, loc) {\n const result = super.finishNodeAt(node, type, pos, loc);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Parses.\n * @returns {EsprimaProgramNode} The program Node\n */\n parse() {\n const extra = this[STATE];\n\n const program = /** @type {EsprimaProgramNode} */ (super.parse());\n\n program.sourceType = extra.originalSourceType;\n\n if (extra.comments) {\n program.comments = extra.comments;\n }\n if (extra.tokens) {\n program.tokens = extra.tokens;\n }\n\n /*\n * Adjust opening and closing position of program to match Esprima.\n * Acorn always starts programs at range 0 whereas Esprima starts at the\n * first AST node's start (the only real difference is when there's leading\n * whitespace or leading comments). Acorn also counts trailing whitespace\n * as part of the program whereas Esprima only counts up to the last token.\n */\n if (program.body.length) {\n const [firstNode] = program.body;\n\n if (program.range && firstNode.range) {\n program.range[0] = firstNode.range[0];\n }\n if (program.loc && firstNode.loc) {\n program.loc.start = firstNode.loc.start;\n }\n program.start = firstNode.start;\n }\n if (extra.lastToken) {\n if (program.range && extra.lastToken.range) {\n program.range[1] = extra.lastToken.range[1];\n }\n if (program.loc && extra.lastToken.loc) {\n program.loc.end = extra.lastToken.loc.end;\n }\n program.end = extra.lastToken.end;\n }\n\n\n /*\n * https://github.com/eslint/espree/issues/349\n * Ensure that template elements have correct range information.\n * This is one location where Acorn produces a different value\n * for its start and end properties vs. the values present in the\n * range property. In order to avoid confusion, we set the start\n * and end properties to the values that are present in range.\n * This is done here, instead of in finishNode(), because Acorn\n * uses the values of start and end internally while parsing, making\n * it dangerous to change those values while parsing is ongoing.\n * By waiting until the end of parsing, we can safely change these\n * values without affect any other part of the process.\n */\n this[STATE].templateElements.forEach(templateElement => {\n const startOffset = -1;\n const endOffset = templateElement.tail ? 1 : 2;\n\n templateElement.start += startOffset;\n templateElement.end += endOffset;\n\n if (templateElement.range) {\n templateElement.range[0] += startOffset;\n templateElement.range[1] += endOffset;\n }\n\n if (templateElement.loc) {\n templateElement.loc.start.column += startOffset;\n templateElement.loc.end.column += endOffset;\n }\n });\n\n return program;\n }\n\n /**\n * Parses top level.\n * @param {acorn.Node} node AST Node\n * @returns {acorn.Node} The changed node\n */\n parseTopLevel(node) {\n if (this[STATE].impliedStrict) {\n this.strict = true;\n }\n return super.parseTopLevel(node);\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raise(pos, message) {\n const loc = Parser.acorn.getLineInfo(this.input, pos);\n\n /** @type {EnhancedSyntaxError} */\n const err = new SyntaxError(message);\n\n err.index = pos;\n err.lineNumber = loc.line;\n err.column = loc.column + 1; // acorn uses 0-based columns\n throw err;\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raiseRecoverable(pos, message) {\n this.raise(pos, message);\n }\n\n /**\n * Overwrites the default unexpected method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n unexpected(pos) {\n let message = \"Unexpected token\";\n\n if (pos !== null && pos !== void 0) {\n this.pos = pos;\n\n if (this.options.locations) {\n while (this.pos < /** @type {int} */ (this.lineStart)) {\n\n /** @type {int} */\n this.lineStart = this.input.lastIndexOf(\"\\n\", /** @type {int} */ (this.lineStart) - 2) + 1;\n --this.curLine;\n }\n }\n\n this.nextToken();\n }\n\n if (this.end > this.start) {\n message += ` ${this.input.slice(this.start, this.end)}`;\n }\n\n this.raise(this.start, message);\n }\n\n /**\n * Esprima-FB represents JSX strings as tokens called \"JSXText\", but Acorn-JSX\n * uses regular tt.string without any distinction between this and regular JS\n * strings. As such, we intercept an attempt to read a JSX string and set a flag\n * on extra so that when tokens are converted, the next token will be switched\n * to JSXText via onToken.\n * @param {number} quote A character code\n * @returns {void}\n */\n jsx_readString(quote) { // eslint-disable-line camelcase\n if (typeof super.jsx_readString === \"undefined\") {\n throw new Error(\"Not a JSX parser\");\n }\n super.jsx_readString(quote);\n\n if (this.type === tokTypes.string) {\n this[STATE].jsxAttrValueToken = true;\n }\n }\n\n /**\n * Performs last-minute Esprima-specific compatibility checks and fixes.\n * @param {acorn.Node} result The node to check.\n * @returns {EsprimaNode} The finished node.\n */\n [ESPRIMA_FINISH_NODE](result) {\n\n const esprimaResult = /** @type {EsprimaNode} */ (result);\n\n // Acorn doesn't count the opening and closing backticks as part of templates\n // so we have to adjust ranges/locations appropriately.\n if (result.type === \"TemplateElement\") {\n\n // save template element references to fix start/end later\n this[STATE].templateElements.push(result);\n }\n\n if (result.type.includes(\"Function\") && !esprimaResult.generator) {\n esprimaResult.generator = false;\n }\n\n return esprimaResult;\n }\n };\n };\n};\n","const version = \"main\";\n\nexport default version;\n","/**\n * @fileoverview Main Espree file that converts Acorn into Esprima output.\n *\n * This file contains code from the following MIT-licensed projects:\n * 1. Acorn\n * 2. Babylon\n * 3. Babel-ESLint\n *\n * This file also contains code from Esprima, which is BSD licensed.\n *\n * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)\n * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)\n * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie \n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/* eslint no-undefined:0, no-use-before-define: 0 */\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {3|5|6|7|8|9|10|11|12|13|2015|2016|2017|2018|2019|2020|2021|2022|'latest'} ecmaVersion\n */\n\n/**\n * @typedef {import('./lib/token-translator').EsprimaToken} EspreeToken\n */\n\n/**\n * @typedef {import('./lib/espree').EsprimaComment} EspreeComment\n */\n\n/**\n * @typedef {{\n * comments?: EspreeComment[]\n * } & EspreeToken[]} EspreeTokens\n */\n\n/**\n * `jsx.Options` gives us 2 optional properties, so extend it\n *\n * `allowReserved`, `ranges`, `locations`, `allowReturnOutsideFunction`,\n * `onToken`, and `onComment` are as in `acorn.Options`\n *\n * `ecmaVersion` currently as in `acorn.Options` though optional\n *\n * `sourceType` as in `acorn.Options` but also allows `commonjs`\n *\n * `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options`\n *\n * `comment` is not in `acorn.Options` and doesn't err without it, but is used\n */\n/**\n * @typedef {{\n * allowReserved?: boolean,\n * ecmaVersion?: ecmaVersion,\n * sourceType?: \"script\"|\"module\"|\"commonjs\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * range?: boolean,\n * loc?: boolean,\n * tokens?: boolean,\n * comment?: boolean,\n * }} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('./lib/espree').EnhancedSyntaxError} EnhancedSyntaxError\n * @typedef {typeof import('./lib/espree').EspreeParser} IEspreeParser\n */\n\nimport * as acorn from \"acorn\";\nimport jsx from \"acorn-jsx\";\nimport espree from \"./lib/espree.js\";\nimport espreeVersion from \"./lib/version.js\";\nimport * as visitorKeys from \"eslint-visitor-keys\";\nimport { getLatestEcmaVersion, getSupportedEcmaVersions } from \"./lib/options.js\";\n\n\n// To initialize lazily.\nconst parsers = {\n _regular: /** @type {IEspreeParser|null} */ (null),\n _jsx: /** @type {IEspreeParser|null} */ (null),\n\n /**\n * Returns regular Parser\n * @returns {IEspreeParser} Regular Acorn parser\n */\n get regular() {\n if (this._regular === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n\n this._regular = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._regular;\n },\n\n /**\n * Returns JSX Parser\n * @returns {IEspreeParser} JSX Acorn parser\n */\n get jsx() {\n if (this._jsx === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n const jsxFactory = jsx();\n\n this._jsx = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n jsxFactory,\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._jsx;\n },\n\n /**\n * Returns Regular or JSX Parser\n * @param {ParserOptions} options Parser options\n * @returns {IEspreeParser} Regular or JSX Acorn parser\n */\n get(options) {\n const useJsx = Boolean(\n options &&\n options.ecmaFeatures &&\n options.ecmaFeatures.jsx\n );\n\n return useJsx ? this.jsx : this.regular;\n }\n};\n\n//------------------------------------------------------------------------------\n// Tokenizer\n//------------------------------------------------------------------------------\n\n/**\n * Tokenizes the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {EspreeTokens} An array of tokens.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n * @private\n */\nexport function tokenize(code, options) {\n const Parser = parsers.get(options);\n\n // Ensure to collect tokens.\n if (!options || options.tokens !== true) {\n options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign\n }\n\n return /** @type {EspreeTokens} */ (new Parser(options, code).tokenize());\n}\n\n//------------------------------------------------------------------------------\n// Parser\n//------------------------------------------------------------------------------\n\n/**\n * Parses the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {acorn.Node} The \"Program\" AST node.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n */\nexport function parse(code, options) {\n const Parser = parsers.get(options);\n\n return new Parser(options, code).parse();\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport const version = espreeVersion;\n\n/* istanbul ignore next */\nexport const VisitorKeys = (function() {\n return visitorKeys.KEYS;\n}());\n\n// Derive node types from VisitorKeys\n/* istanbul ignore next */\nexport const Syntax = (function() {\n let /** @type {Object} */\n types = {};\n\n if (typeof Object.create === \"function\") {\n types = Object.create(null);\n }\n\n for (const name of Object.keys(VisitorKeys)) {\n types[name] = name;\n }\n\n if (typeof Object.freeze === \"function\") {\n Object.freeze(types);\n }\n\n return types;\n}());\n\nexport const latestEcmaVersion = getLatestEcmaVersion();\n\nexport const supportedEcmaVersions = getSupportedEcmaVersions();\n"],"names":["version","acorn","jsx","espreeVersion","visitorKeys"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,KAAK,GAAG;AACd,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,GAAG,EAAE,OAAO;AAChB,IAAI,UAAU,EAAE,YAAY;AAC5B,IAAI,iBAAiB,EAAE,mBAAmB;AAC1C,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,UAAU,EAAE,YAAY;AAC5B,IAAI,MAAM,EAAE,QAAQ;AACpB,IAAI,iBAAiB,EAAE,mBAAmB;AAC1C,IAAI,QAAQ,EAAE,UAAU;AACxB,IAAI,aAAa,EAAE,eAAe;AAClC,IAAI,OAAO,EAAE,SAAS;AACtB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mBAAmB,CAAC,MAAM,EAAE,IAAI,EAAE;AAC3C,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,C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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mCAAmC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE;AACxF,IAAI,MAAM,OAAO,kCAAkC;AACnD,QAAQ,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM;AACtC,QAAQ,KAAK,EAAE,IAAI;AACnB,KAAK,CAAC,CAAC;AACP;AACA,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACnC,QAAQ,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AAC9B,QAAQ,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAC1B,QAAQ,OAAO,CAAC,KAAK,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACrC,KAAK;AACL;AACA,IAAI,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;AACtC,QAAQ,OAAO,CAAC,GAAG,GAAG;AACtB,YAAY,KAAK,EAAE,QAAQ;AAC3B,YAAY,GAAG,EAAE,MAAM;AACvB,SAAS,CAAC;AACV,KAAK;AACL;AACA,IAAI,OAAO,OAAO,CAAC;AACnB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,aAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,MAAM,IAAI;AACrB,QAAQ,MAAM,QAA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AAQ,KAAK,GAAG,EAAE,CAAC;AACnB;AACA,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;AAC7C,QAAQ,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,KAAK;AACL;AACA,IAAI,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;AACjD,QAAQ,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAC3B,KAAK;AACL;AACA,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;AAC7C,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7B,KAAK;AACL;AACA,IAAI,OAAO,KAAK,CAAC;AACjB,CAAC,EAAE,EAAE;AACL;AACY,MAAC,iBAAiB,GAAG,oBAAoB,GAAG;AACxD;AACY,MAAC,qBAAqB,GAAG,wBAAwB;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"espree.cjs","sources":["../lib/token-translator.js","../lib/options.js","../lib/espree.js","../lib/version.js","../espree.js"],"sourcesContent":["/**\n * @fileoverview Translates tokens between Acorn format and Esprima format.\n * @author Nicholas C. Zakas\n */\n/* eslint no-underscore-dangle: 0 */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('./espree').EnhancedTokTypes} EnhancedTokTypes\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * Based on the `acorn.Token` class, but without a fixed `type` (since we need\n * it to be a string). Avoiding `type` lets us make one extending interface\n * more strict and another more lax.\n *\n * We could make `value` more strict to `string` even though the original is\n * `any`.\n *\n * `start` and `end` are required in `acorn.Token`\n *\n * `loc` and `range` are from `acorn.Token`\n *\n * Adds `regex`.\n */\n/**\n * @local\n *\n * @typedef {{\n * value: any;\n * start?: number;\n * end?: number;\n * loc?: acorn.SourceLocation;\n * range?: [number, number];\n * regex?: {flags: string, pattern: string};\n * }} BaseEsprimaToken\n *\n * @typedef {{\n * jsxAttrValueToken: boolean;\n * ecmaVersion: ecmaVersion;\n * }} ExtraNoTokens\n *\n * @typedef {{\n * tokens: EsprimaToken[]\n * } & ExtraNoTokens} Extra\n */\n\n/**\n * @typedef {{\n * type: string;\n * } & BaseEsprimaToken} EsprimaToken\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\n// none!\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n\n// Esprima Token Types\nconst Token = {\n Boolean: \"Boolean\",\n EOF: \"\",\n Identifier: \"Identifier\",\n PrivateIdentifier: \"PrivateIdentifier\",\n Keyword: \"Keyword\",\n Null: \"Null\",\n Numeric: \"Numeric\",\n Punctuator: \"Punctuator\",\n String: \"String\",\n RegularExpression: \"RegularExpression\",\n Template: \"Template\",\n JSXIdentifier: \"JSXIdentifier\",\n JSXText: \"JSXText\"\n};\n\n/**\n * Converts part of a template into an Esprima token.\n * @param {(acorn.Token)[]} tokens The Acorn tokens representing the template.\n * @param {string} code The source code.\n * @returns {EsprimaToken} The Esprima equivalent of the template token.\n * @private\n */\nfunction convertTemplatePart(tokens, code) {\n const firstToken = tokens[0],\n lastTemplateToken = tokens[tokens.length - 1];\n\n /** @type {EsprimaToken} */\n const token = {\n type: Token.Template,\n value: code.slice(firstToken.start, lastTemplateToken.end)\n };\n\n if (firstToken.loc && lastTemplateToken.loc) {\n token.loc = {\n start: firstToken.loc.start,\n end: lastTemplateToken.loc.end\n };\n }\n\n if (firstToken.range && lastTemplateToken.range) {\n token.start = firstToken.range[0];\n token.end = lastTemplateToken.range[1];\n token.range = [token.start, token.end];\n }\n\n return token;\n}\n\nclass TokenTranslator {\n\n /**\n * Contains logic to translate Acorn tokens into Esprima tokens.\n * @param {EnhancedTokTypes} acornTokTypes The Acorn token types.\n * @param {string} code The source code Acorn is parsing. This is necessary\n * to correct the \"value\" property of some tokens.\n */\n constructor(acornTokTypes, code) {\n\n // token types\n this._acornTokTypes = acornTokTypes;\n\n // token buffer for templates\n /** @type {acorn.Token[]} */\n this._tokens = [];\n\n // track the last curly brace\n this._curlyBrace = null;\n\n // the source code\n this._code = code;\n\n }\n\n /**\n * Translates a single Acorn token to a single Esprima token. This may be\n * inaccurate due to how templates are handled differently in Esprima and\n * Acorn, but should be accurate for all other tokens.\n * @param {acorn.Token} token The Acorn token to translate.\n * @param {ExtraNoTokens} extra Espree extra object.\n * @returns {EsprimaToken} The Esprima version of the token.\n */\n translate(token, extra) {\n\n const type = token.type,\n tt = this._acornTokTypes,\n\n // We use an unknown type because `acorn.Token` is a class whose\n // `type` property we cannot override to our desired `string`;\n // this also allows us to define a stricter `EsprimaToken` with\n // a string-only `type` property\n unknownType = /** @type {unknown} */ (token),\n newToken = /** @type {EsprimaToken} */ (unknownType);\n\n if (type === tt.name) {\n newToken.type = Token.Identifier;\n\n // TODO: See if this is an Acorn bug\n if (token.value === \"static\") {\n newToken.type = Token.Keyword;\n }\n\n if (extra.ecmaVersion > 5 && (token.value === \"yield\" || token.value === \"let\")) {\n newToken.type = Token.Keyword;\n }\n\n } else if (type === tt.privateId) {\n newToken.type = Token.PrivateIdentifier;\n\n } else if (type === tt.semi || type === tt.comma ||\n type === tt.parenL || type === tt.parenR ||\n type === tt.braceL || type === tt.braceR ||\n type === tt.dot || type === tt.bracketL ||\n type === tt.colon || type === tt.question ||\n type === tt.bracketR || type === tt.ellipsis ||\n type === tt.arrow || type === tt.jsxTagStart ||\n type === tt.incDec || type === tt.starstar ||\n type === tt.jsxTagEnd || type === tt.prefix ||\n type === tt.questionDot ||\n (type.binop && !type.keyword) ||\n type.isAssign) {\n\n newToken.type = Token.Punctuator;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.jsxName) {\n newToken.type = Token.JSXIdentifier;\n } else if (type.label === \"jsxText\" || type === tt.jsxAttrValueToken) {\n newToken.type = Token.JSXText;\n } else if (type.keyword) {\n if (type.keyword === \"true\" || type.keyword === \"false\") {\n newToken.type = Token.Boolean;\n } else if (type.keyword === \"null\") {\n newToken.type = Token.Null;\n } else {\n newToken.type = Token.Keyword;\n }\n } else if (type === tt.num) {\n newToken.type = Token.Numeric;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.string) {\n\n if (extra.jsxAttrValueToken) {\n extra.jsxAttrValueToken = false;\n newToken.type = Token.JSXText;\n } else {\n newToken.type = Token.String;\n }\n\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.regexp) {\n newToken.type = Token.RegularExpression;\n const value = token.value;\n\n newToken.regex = {\n flags: value.flags,\n pattern: value.pattern\n };\n newToken.value = `/${value.pattern}/${value.flags}`;\n }\n\n return newToken;\n }\n\n /**\n * Function to call during Acorn's onToken handler.\n * @param {acorn.Token} token The Acorn token.\n * @param {Extra} extra The Espree extra object.\n * @returns {void}\n */\n onToken(token, extra) {\n\n const that = this,\n tt = this._acornTokTypes,\n tokens = extra.tokens,\n templateTokens = this._tokens;\n\n /**\n * Flushes the buffered template tokens and resets the template\n * tracking.\n * @returns {void}\n * @private\n */\n function translateTemplateTokens() {\n tokens.push(convertTemplatePart(that._tokens, that._code));\n that._tokens = [];\n }\n\n if (token.type === tt.eof) {\n\n // might be one last curlyBrace\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n return;\n }\n\n if (token.type === tt.backQuote) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n\n // it's the end\n if (templateTokens.length > 1) {\n translateTemplateTokens();\n }\n\n return;\n }\n if (token.type === tt.dollarBraceL) {\n templateTokens.push(token);\n translateTemplateTokens();\n return;\n }\n if (token.type === tt.braceR) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n // store new curly for later\n this._curlyBrace = token;\n return;\n }\n if (token.type === tt.template || token.type === tt.invalidTemplate) {\n if (this._curlyBrace) {\n templateTokens.push(this._curlyBrace);\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n return;\n }\n\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n tokens.push(this.translate(token, extra));\n }\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport default TokenTranslator;\n","/**\n * @fileoverview A collection of methods for processing Espree's options.\n * @author Kai Cataldo\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * ecmaVersion: ecmaVersion,\n * sourceType: \"script\"|\"module\",\n * range?: boolean,\n * loc?: boolean,\n * allowReserved: boolean | \"never\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * ranges: boolean,\n * locations: boolean,\n * allowReturnOutsideFunction: boolean,\n * tokens?: boolean,\n * comment?: boolean\n * }} NormalizedParserOptions\n */\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst SUPPORTED_VERSIONS = [\n 3,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13\n];\n\n/**\n * Get the latest ECMAScript version supported by Espree.\n * @returns {number} The latest ECMAScript version.\n */\nexport function getLatestEcmaVersion() {\n return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1];\n}\n\n/**\n * Get the list of ECMAScript versions supported by Espree.\n * @returns {number[]} An array containing the supported ECMAScript versions.\n */\nexport function getSupportedEcmaVersions() {\n return [...SUPPORTED_VERSIONS];\n}\n\n/**\n * Normalize ECMAScript version from the initial config\n * @param {number|\"latest\"} ecmaVersion ECMAScript version from the initial config\n * @throws {Error} throws an error if the ecmaVersion is invalid.\n * @returns {number} normalized ECMAScript version\n */\nfunction normalizeEcmaVersion(ecmaVersion = 5) {\n\n let version = ecmaVersion === \"latest\" ? getLatestEcmaVersion() : ecmaVersion;\n\n if (typeof version !== \"number\") {\n throw new Error(`ecmaVersion must be a number or \"latest\". Received value of type ${typeof ecmaVersion} instead.`);\n }\n\n // Calculate ECMAScript edition number from official year version starting with\n // ES2015, which corresponds with ES6 (or a difference of 2009).\n if (version >= 2015) {\n version -= 2009;\n }\n\n if (!SUPPORTED_VERSIONS.includes(version)) {\n throw new Error(\"Invalid ecmaVersion.\");\n }\n\n return version;\n}\n\n/**\n * Normalize sourceType from the initial config\n * @param {\"script\"|\"module\"|\"commonjs\"} sourceType to normalize\n * @throws {Error} throw an error if sourceType is invalid\n * @returns {\"script\"|\"module\"} normalized sourceType\n */\nfunction normalizeSourceType(sourceType = \"script\") {\n if (sourceType === \"script\" || sourceType === \"module\") {\n return sourceType;\n }\n\n if (sourceType === \"commonjs\") {\n return \"script\";\n }\n\n throw new Error(\"Invalid sourceType.\");\n}\n\n/**\n * Normalize parserOptions\n * @param {ParserOptions} options the parser options to normalize\n * @throws {Error} throw an error if found invalid option.\n * @returns {NormalizedParserOptions} normalized options\n */\nexport function normalizeOptions(options) {\n const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion);\n\n const sourceType = normalizeSourceType(options.sourceType);\n const ranges = options.range === true;\n const locations = options.loc === true;\n\n if (ecmaVersion !== 3 && options.allowReserved) {\n\n // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed\n throw new Error(\"`allowReserved` is only supported when ecmaVersion is 3\");\n }\n\n // Note: value in Acorn can also be \"never\" but we throw in such a case\n if (typeof options.allowReserved !== \"undefined\" && typeof options.allowReserved !== \"boolean\") {\n throw new Error(\"`allowReserved`, when present, must be `true` or `false`\");\n }\n const allowReserved = ecmaVersion === 3 ? (options.allowReserved || \"never\") : false;\n const ecmaFeatures = options.ecmaFeatures || {};\n const allowReturnOutsideFunction = options.sourceType === \"commonjs\" ||\n Boolean(ecmaFeatures.globalReturn);\n\n if (sourceType === \"module\" && ecmaVersion < 6) {\n throw new Error(\"sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.\");\n }\n\n return Object.assign({}, options, {\n ecmaVersion,\n sourceType,\n ranges,\n locations,\n allowReserved,\n allowReturnOutsideFunction\n });\n}\n","/* eslint-disable no-param-reassign*/\nimport TokenTranslator from \"./token-translator.js\";\nimport { normalizeOptions } from \"./options.js\";\n\nconst STATE = Symbol(\"espree's internal state\");\nconst ESPRIMA_FINISH_NODE = Symbol(\"espree's esprimaFinishNode\");\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {{\n * index?: number;\n * lineNumber?: number;\n * column?: number;\n * } & SyntaxError} EnhancedSyntaxError\n */\n\n// We add `jsxAttrValueToken` ourselves.\n/**\n * @typedef {{\n * jsxAttrValueToken?: acorn.TokenType;\n * } & tokTypesType} EnhancedTokTypes\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('acorn-jsx').TokTypes} tokTypesType\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * generator?: boolean\n * } & acorn.Node} EsprimaNode\n */\n/**\n * Suggests an integer\n * @local\n * @typedef {number} int\n */\n\n/**\n * @typedef {{\n * type: string,\n * value: string,\n * range?: [number, number],\n * start?: number,\n * end?: number,\n * loc?: {\n * start: acorn.Position | undefined,\n * end: acorn.Position | undefined\n * }\n * }} EsprimaComment\n */\n\n/**\n * First two properties as in `acorn.Comment`; next two as in `acorn.Comment`\n * but optional. Last is different as has to allow `undefined`\n */\n/**\n * @local\n *\n * @typedef {import('../espree').EspreeTokens} EspreeTokens\n *\n * @typedef {{\n * tail?: boolean\n * } & acorn.Node} AcornTemplateNode\n *\n * @typedef {{\n * originalSourceType: \"script\"|\"module\"|\"commonjs\";\n * ecmaVersion: ecmaVersion;\n * comments: EsprimaComment[]|null;\n * impliedStrict: boolean;\n * lastToken: acorn.Token|null;\n * templateElements: (AcornTemplateNode)[];\n * jsxAttrValueToken: boolean;\n * }} BaseStateObject\n *\n * @typedef {{\n * tokens: null;\n * } & BaseStateObject} StateObject\n *\n * @typedef {{\n * tokens: EspreeTokens;\n * } & BaseStateObject} StateObjectWithTokens\n *\n * @typedef {{\n * sourceType?: \"script\"|\"module\"|\"commonjs\";\n * comments?: EsprimaComment[];\n * tokens?: import('./token-translator').EsprimaToken[];\n * body: acorn.Node[];\n * } & acorn.Node} EsprimaProgramNode\n */\n/**\n * Converts an Acorn comment to an Esprima comment.\n *\n * - block True if it's a block comment, false if not.\n * - text The text of the comment.\n * - start The index at which the comment starts.\n * - end The index at which the comment ends.\n * - startLoc The location at which the comment starts.\n * - endLoc The location at which the comment ends.\n * @local\n * @typedef {(\n * block: boolean,\n * text: string,\n * start: int,\n * end: int,\n * startLoc: acorn.Position | undefined,\n * endLoc: acorn.Position | undefined\n * ) => EsprimaComment | void} AcornToEsprimaCommentConverter\n */\n\n// ----------------------------------------------------------------------------\n// Utilities\n// ----------------------------------------------------------------------------\n/**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n * @returns {EsprimaComment} The comment object.\n * @private\n */\nfunction convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) {\n const comment = /** @type {EsprimaComment} */ ({\n type: block ? \"Block\" : \"Line\",\n value: text\n });\n\n if (typeof start === \"number\") {\n comment.start = start;\n comment.end = end;\n comment.range = [start, end];\n }\n\n if (typeof startLoc === \"object\") {\n comment.loc = {\n start: startLoc,\n end: endLoc\n };\n }\n\n return comment;\n}\n\n// ----------------------------------------------------------------------------\n// Exports\n// ----------------------------------------------------------------------------\n/* eslint-disable arrow-body-style -- Need to supply formatted JSDoc for type info */\nexport default () => {\n\n /**\n * Returns the Espree parser.\n * @param {AcornJsxParser} Parser The Acorn parser\n * @returns {typeof EspreeParser} The Espree parser\n */\n return Parser => {\n const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes));\n\n if (Parser.acornJsx) {\n Object.assign(tokTypes, Parser.acornJsx.tokTypes);\n }\n\n /* eslint-disable no-shadow -- Using first class as type */\n /**\n * @export\n */\n return class EspreeParser extends Parser {\n /* eslint-enable no-shadow -- Using first class as type */\n /* eslint-disable jsdoc/check-types -- Allows generic object */\n /**\n * Adapted parser for Espree.\n * @param {ParserOptions|null} opts Espree options\n * @param {string|object} code The source code\n */\n constructor(opts, code) {\n /* eslint-enable jsdoc/check-types -- Allows generic object */\n\n const newOpts = (typeof opts !== \"object\" || opts === null)\n ? {}\n : opts;\n\n const codeString = typeof code === \"string\"\n ? code\n : String(code);\n\n // save original source type in case of commonjs\n const originalSourceType = newOpts.sourceType;\n const options = normalizeOptions(newOpts);\n const ecmaFeatures = options.ecmaFeatures || {};\n const tokenTranslator =\n options.tokens === true\n ? new TokenTranslator(tokTypes, codeString)\n : null;\n\n // Initialize acorn parser.\n super({\n\n // do not use spread, because we don't want to pass any unknown options to acorn\n ecmaVersion: options.ecmaVersion,\n sourceType: options.sourceType,\n ranges: options.ranges,\n locations: options.locations,\n allowReserved: options.allowReserved,\n\n // Truthy value is true for backward compatibility.\n allowReturnOutsideFunction: options.allowReturnOutsideFunction,\n\n // Collect tokens\n /**\n * Handler for receiving a token\n * @param {acorn.Token} token The token\n * @returns {void}\n */\n onToken: token => {\n if (tokenTranslator) {\n\n // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.\n tokenTranslator.onToken(token, /** @type {StateObjectWithTokens} */ (this[STATE]));\n }\n if (token.type !== tokTypes.eof) {\n this[STATE].lastToken = token;\n }\n },\n\n // Collect comments\n /**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n */\n onComment: (block, text, start, end, startLoc, endLoc) => {\n if (this[STATE].comments) {\n const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc);\n\n const comments = /** @type {EsprimaComment[]} */ (this[STATE].comments);\n\n comments.push(comment);\n }\n }\n }, codeString);\n\n // Force for TypeScript (indicating that `lineStart` is not undefined)\n if (!this.lineStart) {\n this.lineStart = 0;\n }\n\n /**\n * Data that is unique to Espree and is not represented internally in\n * Acorn. We put all of this data into a symbol property as a way to\n * avoid potential naming conflicts with future versions of Acorn.\n * @type {StateObjectWithTokens|StateObject}\n */\n this[STATE] = {\n originalSourceType: originalSourceType || options.sourceType,\n tokens: tokenTranslator ? /** @type {EspreeTokens} */ ([]) : null,\n comments: options.comment === true\n ? /** @type {EsprimaComment[]} */ ([])\n : null,\n impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,\n ecmaVersion: this.options.ecmaVersion,\n jsxAttrValueToken: false,\n\n /** @type {acorn.Token|null} */\n lastToken: null,\n\n /** @type {AcornTemplateNode[]} */\n templateElements: []\n };\n }\n\n /**\n * Returns Espree tokens.\n * @returns {EspreeTokens|null} Espree tokens\n */\n tokenize() {\n do {\n this.next();\n } while (this.type !== tokTypes.eof);\n\n // Consume the final eof token\n this.next();\n\n const extra = this[STATE];\n const tokens = extra.tokens;\n\n if (extra.comments && tokens) {\n tokens.comments = extra.comments;\n }\n\n return tokens;\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @returns {acorn.Node} The altered Node\n */\n finishNode(node, type) {\n const result = super.finishNode(node, type);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @param {number} pos The position\n * @param {acorn.Position} loc The location\n * @returns {acorn.Node} The altered Node\n */\n finishNodeAt(node, type, pos, loc) {\n const result = super.finishNodeAt(node, type, pos, loc);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Parses.\n * @returns {EsprimaProgramNode} The program Node\n */\n parse() {\n const extra = this[STATE];\n\n const program = /** @type {EsprimaProgramNode} */ (super.parse());\n\n program.sourceType = extra.originalSourceType;\n\n if (extra.comments) {\n program.comments = extra.comments;\n }\n if (extra.tokens) {\n program.tokens = extra.tokens;\n }\n\n /*\n * Adjust opening and closing position of program to match Esprima.\n * Acorn always starts programs at range 0 whereas Esprima starts at the\n * first AST node's start (the only real difference is when there's leading\n * whitespace or leading comments). Acorn also counts trailing whitespace\n * as part of the program whereas Esprima only counts up to the last token.\n */\n if (program.body.length) {\n const [firstNode] = program.body;\n\n if (program.range && firstNode.range) {\n program.range[0] = firstNode.range[0];\n }\n if (program.loc && firstNode.loc) {\n program.loc.start = firstNode.loc.start;\n }\n program.start = firstNode.start;\n }\n if (extra.lastToken) {\n if (program.range && extra.lastToken.range) {\n program.range[1] = extra.lastToken.range[1];\n }\n if (program.loc && extra.lastToken.loc) {\n program.loc.end = extra.lastToken.loc.end;\n }\n program.end = extra.lastToken.end;\n }\n\n\n /*\n * https://github.com/eslint/espree/issues/349\n * Ensure that template elements have correct range information.\n * This is one location where Acorn produces a different value\n * for its start and end properties vs. the values present in the\n * range property. In order to avoid confusion, we set the start\n * and end properties to the values that are present in range.\n * This is done here, instead of in finishNode(), because Acorn\n * uses the values of start and end internally while parsing, making\n * it dangerous to change those values while parsing is ongoing.\n * By waiting until the end of parsing, we can safely change these\n * values without affect any other part of the process.\n */\n this[STATE].templateElements.forEach(templateElement => {\n const startOffset = -1;\n const endOffset = templateElement.tail ? 1 : 2;\n\n templateElement.start += startOffset;\n templateElement.end += endOffset;\n\n if (templateElement.range) {\n templateElement.range[0] += startOffset;\n templateElement.range[1] += endOffset;\n }\n\n if (templateElement.loc) {\n templateElement.loc.start.column += startOffset;\n templateElement.loc.end.column += endOffset;\n }\n });\n\n return program;\n }\n\n /**\n * Parses top level.\n * @param {acorn.Node} node AST Node\n * @returns {acorn.Node} The changed node\n */\n parseTopLevel(node) {\n if (this[STATE].impliedStrict) {\n this.strict = true;\n }\n return super.parseTopLevel(node);\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raise(pos, message) {\n const loc = Parser.acorn.getLineInfo(this.input, pos);\n\n /** @type {EnhancedSyntaxError} */\n const err = new SyntaxError(message);\n\n err.index = pos;\n err.lineNumber = loc.line;\n err.column = loc.column + 1; // acorn uses 0-based columns\n throw err;\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raiseRecoverable(pos, message) {\n this.raise(pos, message);\n }\n\n /**\n * Overwrites the default unexpected method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n unexpected(pos) {\n let message = \"Unexpected token\";\n\n if (pos !== null && pos !== void 0) {\n this.pos = pos;\n\n if (this.options.locations) {\n while (this.pos < /** @type {int} */ (this.lineStart)) {\n\n /** @type {int} */\n this.lineStart = this.input.lastIndexOf(\"\\n\", /** @type {int} */ (this.lineStart) - 2) + 1;\n --this.curLine;\n }\n }\n\n this.nextToken();\n }\n\n if (this.end > this.start) {\n message += ` ${this.input.slice(this.start, this.end)}`;\n }\n\n this.raise(this.start, message);\n }\n\n /**\n * Esprima-FB represents JSX strings as tokens called \"JSXText\", but Acorn-JSX\n * uses regular tt.string without any distinction between this and regular JS\n * strings. As such, we intercept an attempt to read a JSX string and set a flag\n * on extra so that when tokens are converted, the next token will be switched\n * to JSXText via onToken.\n * @param {number} quote A character code\n * @returns {void}\n */\n jsx_readString(quote) { // eslint-disable-line camelcase\n if (typeof super.jsx_readString === \"undefined\") {\n throw new Error(\"Not a JSX parser\");\n }\n super.jsx_readString(quote);\n\n if (this.type === tokTypes.string) {\n this[STATE].jsxAttrValueToken = true;\n }\n }\n\n /**\n * Performs last-minute Esprima-specific compatibility checks and fixes.\n * @param {acorn.Node} result The node to check.\n * @returns {EsprimaNode} The finished node.\n */\n [ESPRIMA_FINISH_NODE](result) {\n\n const esprimaResult = /** @type {EsprimaNode} */ (result);\n\n // Acorn doesn't count the opening and closing backticks as part of templates\n // so we have to adjust ranges/locations appropriately.\n if (result.type === \"TemplateElement\") {\n\n // save template element references to fix start/end later\n this[STATE].templateElements.push(result);\n }\n\n if (result.type.includes(\"Function\") && !esprimaResult.generator) {\n esprimaResult.generator = false;\n }\n\n return esprimaResult;\n }\n };\n };\n};\n","const version = \"main\";\n\nexport default version;\n","/**\n * @fileoverview Main Espree file that converts Acorn into Esprima output.\n *\n * This file contains code from the following MIT-licensed projects:\n * 1. Acorn\n * 2. Babylon\n * 3. Babel-ESLint\n *\n * This file also contains code from Esprima, which is BSD licensed.\n *\n * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)\n * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)\n * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie \n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/* eslint no-undefined:0, no-use-before-define: 0 */\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {3|5|6|7|8|9|10|11|12|13|2015|2016|2017|2018|2019|2020|2021|2022|'latest'} ecmaVersion\n */\n\n/**\n * @typedef {import('./lib/token-translator').EsprimaToken} EspreeToken\n */\n\n/**\n * @typedef {import('./lib/espree').EsprimaComment} EspreeComment\n */\n\n/**\n * @typedef {{\n * comments?: EspreeComment[]\n * } & EspreeToken[]} EspreeTokens\n */\n\n/**\n * `jsx.Options` gives us 2 optional properties, so extend it\n *\n * `allowReserved`, `ranges`, `locations`, `allowReturnOutsideFunction`,\n * `onToken`, and `onComment` are as in `acorn.Options`\n *\n * `ecmaVersion` currently as in `acorn.Options` though optional\n *\n * `sourceType` as in `acorn.Options` but also allows `commonjs`\n *\n * `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options`\n *\n * `comment` is not in `acorn.Options` and doesn't err without it, but is used\n */\n/**\n * @typedef {{\n * allowReserved?: boolean,\n * ecmaVersion?: ecmaVersion,\n * sourceType?: \"script\"|\"module\"|\"commonjs\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * range?: boolean,\n * loc?: boolean,\n * tokens?: boolean,\n * comment?: boolean,\n * }} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('./lib/espree').EnhancedSyntaxError} EnhancedSyntaxError\n * @typedef {typeof import('./lib/espree').EspreeParser} IEspreeParser\n */\n\nimport * as acorn from \"acorn\";\nimport jsx from \"acorn-jsx\";\nimport espree from \"./lib/espree.js\";\nimport espreeVersion from \"./lib/version.js\";\nimport * as visitorKeys from \"eslint-visitor-keys\";\nimport { getLatestEcmaVersion, getSupportedEcmaVersions } from \"./lib/options.js\";\n\n\n// To initialize lazily.\nconst parsers = {\n _regular: /** @type {IEspreeParser|null} */ (null),\n _jsx: /** @type {IEspreeParser|null} */ (null),\n\n /**\n * Returns regular Parser\n * @returns {IEspreeParser} Regular Acorn parser\n */\n get regular() {\n if (this._regular === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n\n this._regular = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._regular;\n },\n\n /**\n * Returns JSX Parser\n * @returns {IEspreeParser} JSX Acorn parser\n */\n get jsx() {\n if (this._jsx === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n const jsxFactory = jsx();\n\n this._jsx = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n jsxFactory,\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._jsx;\n },\n\n /**\n * Returns Regular or JSX Parser\n * @param {ParserOptions} options Parser options\n * @returns {IEspreeParser} Regular or JSX Acorn parser\n */\n get(options) {\n const useJsx = Boolean(\n options &&\n options.ecmaFeatures &&\n options.ecmaFeatures.jsx\n );\n\n return useJsx ? this.jsx : this.regular;\n }\n};\n\n//------------------------------------------------------------------------------\n// Tokenizer\n//------------------------------------------------------------------------------\n\n/**\n * Tokenizes the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {EspreeTokens} An array of tokens.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n * @private\n */\nexport function tokenize(code, options) {\n const Parser = parsers.get(options);\n\n // Ensure to collect tokens.\n if (!options || options.tokens !== true) {\n options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign\n }\n\n return /** @type {EspreeTokens} */ (new Parser(options, code).tokenize());\n}\n\n//------------------------------------------------------------------------------\n// Parser\n//------------------------------------------------------------------------------\n\n/**\n * Parses the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {acorn.Node} The \"Program\" AST node.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n */\nexport function parse(code, options) {\n const Parser = parsers.get(options);\n\n return new Parser(options, code).parse();\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport const version = espreeVersion;\n\n/* istanbul ignore next */\nexport const VisitorKeys = (function() {\n return visitorKeys.KEYS;\n}());\n\n// Derive node types from VisitorKeys\n/* istanbul ignore next */\nexport const Syntax = (function() {\n let /** @type {Object} */\n types = {};\n\n if (typeof Object.create === \"function\") {\n types = Object.create(null);\n }\n\n for (const name of Object.keys(VisitorKeys)) {\n types[name] = name;\n }\n\n if (typeof Object.freeze === \"function\") {\n Object.freeze(types);\n }\n\n return types;\n}());\n\nexport const latestEcmaVersion = getLatestEcmaVersion();\n\nexport const supportedEcmaVersions = getSupportedEcmaVersions();\n"],"names":["version","acorn","jsx","espreeVersion","visitorKeys"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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I,KAAK,CAAC,8HAA8H,CAAC,CAAC;AACxJ,KAAK;AACL;AACA,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE;AACtC,QAAQ,WAAW;AACnB,QAAQ,UAAU;AAClB,QAAQ,MAAM;AACd,QAAQ,SAAS;AACjB,QAAQ,aAAa;AACrB,QAAQ,0BAA0B;AAClC,KAAK,CAAC,CAAC;AACP;;AC5JA;AAGA;AACA,MAAM,KAAK,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAChD,MAAM,mBAAmB,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mCAAmC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE;AACxF,IAAI,MAAM,OAAO,kCAAkC;AACnD,QAAQ,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM;AACtC,QAAQ,KAAK,EAAE,IAAI;AACnB,KAA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ff --git a/dist/lib/espree.d.ts b/dist/lib/espree.d.ts index 35351eef..928000c3 100644 --- a/dist/lib/espree.d.ts +++ b/dist/lib/espree.d.ts @@ -48,7 +48,7 @@ export type EnhancedSyntaxError = { } & SyntaxError; export type EnhancedTokTypes = { jsxAttrValueToken?: import('acorn').TokenType; -} & typeof import('acorn-jsx').tokTypes; +} & import('acorn-jsx').TokTypes; export type EsprimaComment = { type: string; value: string; diff --git a/dist/lib/espree.d.ts.map b/dist/lib/espree.d.ts.map index 056e587c..21d9c88d 100644 --- a/dist/lib/espree.d.ts.map +++ b/dist/lib/espree.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"espree.d.ts","sourceRoot":"","sources":["../../tmp/lib/espree.js"],"names":[],"mappings":"AAoDe,sCAIA,OAAO,WAAW,EAAE,cAAc,KAChC,mBAAmB,CA+QnC;;AACD;IAEY;;;;OAIG;IACH,kBAHW,OAAO,WAAW,EAAE,aAAa,GAAG,IAAI,QACxC,MAAM,GAAG,MAAM,EAIjC;IAEO;;;OAGG;IACH,YAFa,OAAO,WAAW,EAAE,YAAY,GAAG,IAAI,CAI3D;IAwBO;;;OAGG;IACH,SAFa;QAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;QAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,oBAAoB,EAAE,YAAY,EAAE,CAAC;QAAC,IAAI,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,CAAA;KAAC,GAAG,OAAO,OAAO,EAAE,IAAI,CAI3M;IAsBO;;;;;;OAMG;IACH,sBALW,MAAM,WACN,MAAM,GAEJ,IAAI,CAIxB;IAYO;;;;;;;;OAQG;IACH,sBAHW,MAAM,GACJ,IAAI,CAIxB;CACJ;kCA7aY;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA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IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,WAAW;+BAIpE;IAAC,iBAAiB,CAAC,EAAE,OAAO,OAAO,EAAE,SAAS,CAAA;CAAC,GAAG,OAAO,WAAW,EAAE,QAAQ;6BAI9E;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE;QAAC,KAAK,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;QAAC,GAAG,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAA;KAAC,CAAA;CAAC"} \ No newline at end of file diff --git a/lib/espree.js b/lib/espree.js index 130a6025..2d160f07 100644 --- a/lib/espree.js +++ b/lib/espree.js @@ -29,7 +29,7 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); /** * @local * @typedef {import('acorn')} acorn - * @typedef {typeof import('acorn-jsx').tokTypes} tokTypesType + * @typedef {import('acorn-jsx').TokTypes} tokTypesType * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser * @typedef {import('../espree').ParserOptions} ParserOptions * @typedef {import('../espree').ecmaVersion} ecmaVersion From ce0bf22bfe68fedb6fc4cb558f111eb431bbc45a Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 12 May 2022 11:50:01 +0800 Subject: [PATCH 20/24] ensure type files are all included --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index ca63c4ff..e2cb0408 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,7 @@ "version": "9.3.1", "files": [ "lib", - "dist/espree.cjs", - "dist/espree.d.ts", + "dist", "espree.js" ], "engines": { From 90e11f5464a6842f6db16bd69fcf6b63d3162246 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 12 May 2022 11:52:30 +0800 Subject: [PATCH 21/24] refactor: remove committed dist files (dist is already gitignored) --- dist/espree.cjs | 1244 ---------------------------- dist/espree.cjs.map | 1 - dist/espree.d.ts | 47 -- dist/espree.d.ts.map | 1 - dist/lib/espree.d.ts | 64 -- dist/lib/espree.d.ts.map | 1 - dist/lib/token-translator.d.ts.map | 1 - 7 files changed, 1359 deletions(-) delete mode 100644 dist/espree.cjs delete mode 100644 dist/espree.cjs.map delete mode 100644 dist/espree.d.ts delete mode 100644 dist/espree.d.ts.map delete mode 100644 dist/lib/espree.d.ts delete mode 100644 dist/lib/espree.d.ts.map delete mode 100644 dist/lib/token-translator.d.ts.map diff --git a/dist/espree.cjs b/dist/espree.cjs deleted file mode 100644 index 4b009f21..00000000 --- a/dist/espree.cjs +++ /dev/null @@ -1,1244 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var acorn = require('acorn'); -var jsx = require('acorn-jsx'); -var visitorKeys = require('eslint-visitor-keys'); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); -} - -var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn); -var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx); -var visitorKeys__namespace = /*#__PURE__*/_interopNamespace(visitorKeys); - -/** - * @fileoverview Translates tokens between Acorn format and Esprima format. - * @author Nicholas C. Zakas - */ -/* eslint no-underscore-dangle: 0 */ - -// ---------------------------------------------------------------------------- -// Local type imports -// ---------------------------------------------------------------------------- -/** - * @local - * @typedef {import('acorn')} acorn - * @typedef {import('./espree').EnhancedTokTypes} EnhancedTokTypes - * @typedef {import('../espree').ecmaVersion} ecmaVersion - */ - -// ---------------------------------------------------------------------------- -// Local types -// ---------------------------------------------------------------------------- -/** - * Based on the `acorn.Token` class, but without a fixed `type` (since we need - * it to be a string). Avoiding `type` lets us make one extending interface - * more strict and another more lax. - * - * We could make `value` more strict to `string` even though the original is - * `any`. - * - * `start` and `end` are required in `acorn.Token` - * - * `loc` and `range` are from `acorn.Token` - * - * Adds `regex`. - */ -/** - * @local - * - * @typedef {{ - * value: any; - * start?: number; - * end?: number; - * loc?: acorn.SourceLocation; - * range?: [number, number]; - * regex?: {flags: string, pattern: string}; - * }} BaseEsprimaToken - * - * @typedef {{ - * jsxAttrValueToken: boolean; - * ecmaVersion: ecmaVersion; - * }} ExtraNoTokens - * - * @typedef {{ - * tokens: EsprimaToken[] - * } & ExtraNoTokens} Extra - */ - -/** - * @typedef {{ - * type: string; - * } & BaseEsprimaToken} EsprimaToken - */ - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -// none! - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - - -// Esprima Token Types -const Token = { - Boolean: "Boolean", - EOF: "", - Identifier: "Identifier", - PrivateIdentifier: "PrivateIdentifier", - 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 {(acorn.Token)[]} 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]; - - /** @type {EsprimaToken} */ - const token = { - type: Token.Template, - value: code.slice(firstToken.start, lastTemplateToken.end) - }; - - if (firstToken.loc && lastTemplateToken.loc) { - token.loc = { - start: firstToken.loc.start, - end: lastTemplateToken.loc.end - }; - } - - if (firstToken.range && lastTemplateToken.range) { - token.start = firstToken.range[0]; - token.end = lastTemplateToken.range[1]; - token.range = [token.start, token.end]; - } - - return token; -} - -class TokenTranslator { - - /** - * Contains logic to translate Acorn tokens into Esprima tokens. - * @param {EnhancedTokTypes} 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(acornTokTypes, code) { - - // token types - this._acornTokTypes = acornTokTypes; - - // token buffer for templates - /** @type {acorn.Token[]} */ - this._tokens = []; - - // track the last curly brace - this._curlyBrace = null; - - // the source code - this._code = code; - - } - - /** - * Translates a single Acorn token to a single Esprima 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 {acorn.Token} token The Acorn token to translate. - * @param {ExtraNoTokens} extra Espree extra object. - * @returns {EsprimaToken} The Esprima version of the token. - */ - translate(token, extra) { - - const type = token.type, - tt = this._acornTokTypes, - - // We use an unknown type because `acorn.Token` is a class whose - // `type` property we cannot override to our desired `string`; - // this also allows us to define a stricter `EsprimaToken` with - // a string-only `type` property - unknownType = /** @type {unknown} */ (token), - newToken = /** @type {EsprimaToken} */ (unknownType); - - if (type === tt.name) { - newToken.type = Token.Identifier; - - // TODO: See if this is an Acorn bug - if (token.value === "static") { - newToken.type = Token.Keyword; - } - - if (extra.ecmaVersion > 5 && (token.value === "yield" || token.value === "let")) { - newToken.type = Token.Keyword; - } - - } else if (type === tt.privateId) { - newToken.type = Token.PrivateIdentifier; - - } 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 === tt.questionDot || - (type.binop && !type.keyword) || - type.isAssign) { - - newToken.type = Token.Punctuator; - newToken.value = this._code.slice(token.start, token.end); - } else if (type === tt.jsxName) { - newToken.type = Token.JSXIdentifier; - } else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) { - newToken.type = Token.JSXText; - } else if (type.keyword) { - if (type.keyword === "true" || type.keyword === "false") { - newToken.type = Token.Boolean; - } else if (type.keyword === "null") { - newToken.type = Token.Null; - } else { - newToken.type = Token.Keyword; - } - } else if (type === tt.num) { - newToken.type = Token.Numeric; - newToken.value = this._code.slice(token.start, token.end); - } else if (type === tt.string) { - - if (extra.jsxAttrValueToken) { - extra.jsxAttrValueToken = false; - newToken.type = Token.JSXText; - } else { - newToken.type = Token.String; - } - - newToken.value = this._code.slice(token.start, token.end); - } else if (type === tt.regexp) { - newToken.type = Token.RegularExpression; - const value = token.value; - - newToken.regex = { - flags: value.flags, - pattern: value.pattern - }; - newToken.value = `/${value.pattern}/${value.flags}`; - } - - return newToken; - } - - /** - * Function to call during Acorn's onToken handler. - * @param {acorn.Token} token The Acorn token. - * @param {Extra} 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)); - } -} - -/** - * @fileoverview A collection of methods for processing Espree's options. - * @author Kai Cataldo - */ - -// ---------------------------------------------------------------------------- -// Local type imports -// ---------------------------------------------------------------------------- -/** - * @local - * @typedef {import('../espree').ParserOptions} ParserOptions - * @typedef {import('../espree').ecmaVersion} ecmaVersion - */ - -// ---------------------------------------------------------------------------- -// Local types -// ---------------------------------------------------------------------------- -/** - * @local - * @typedef {{ - * ecmaVersion: ecmaVersion, - * sourceType: "script"|"module", - * range?: boolean, - * loc?: boolean, - * allowReserved: boolean | "never", - * ecmaFeatures?: { - * jsx?: boolean, - * globalReturn?: boolean, - * impliedStrict?: boolean - * }, - * ranges: boolean, - * locations: boolean, - * allowReturnOutsideFunction: boolean, - * tokens?: boolean, - * comment?: boolean - * }} NormalizedParserOptions - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const SUPPORTED_VERSIONS = [ - 3, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13 -]; - -/** - * 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]; -} - -/** - * Normalize ECMAScript version from the initial config - * @param {number|"latest"} 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 = 5) { - - let version = ecmaVersion === "latest" ? getLatestEcmaVersion() : ecmaVersion; - - if (typeof version !== "number") { - throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof ecmaVersion} instead.`); - } - - // 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 {"script"|"module"|"commonjs"} sourceType to normalize - * @throws {Error} throw an error if sourceType is invalid - * @returns {"script"|"module"} normalized sourceType - */ -function normalizeSourceType(sourceType = "script") { - if (sourceType === "script" || sourceType === "module") { - return sourceType; - } - - if (sourceType === "commonjs") { - return "script"; - } - - throw new Error("Invalid sourceType."); -} - -/** - * Normalize parserOptions - * @param {ParserOptions} options the parser options to normalize - * @throws {Error} throw an error if found invalid option. - * @returns {NormalizedParserOptions} 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 (ecmaVersion !== 3 && options.allowReserved) { - - // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed - throw new Error("`allowReserved` is only supported when ecmaVersion is 3"); - } - - // Note: value in Acorn can also be "never" but we throw in such a case - if (typeof options.allowReserved !== "undefined" && typeof options.allowReserved !== "boolean") { - throw new Error("`allowReserved`, when present, must be `true` or `false`"); - } - const allowReserved = ecmaVersion === 3 ? (options.allowReserved || "never") : false; - const ecmaFeatures = options.ecmaFeatures || {}; - const allowReturnOutsideFunction = options.sourceType === "commonjs" || - Boolean(ecmaFeatures.globalReturn); - - 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, - allowReserved, - allowReturnOutsideFunction - }); -} - -/* eslint-disable no-param-reassign*/ - -const STATE = Symbol("espree's internal state"); -const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); - -// ---------------------------------------------------------------------------- -// Types exported from file -// ---------------------------------------------------------------------------- -/** - * @typedef {{ - * index?: number; - * lineNumber?: number; - * column?: number; - * } & SyntaxError} EnhancedSyntaxError - */ - -// We add `jsxAttrValueToken` ourselves. -/** - * @typedef {{ - * jsxAttrValueToken?: acorn.TokenType; - * } & tokTypesType} EnhancedTokTypes - */ - -// ---------------------------------------------------------------------------- -// Local type imports -// ---------------------------------------------------------------------------- -/** - * @local - * @typedef {import('acorn')} acorn - * @typedef {import('acorn-jsx').TokTypes} tokTypesType - * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser - * @typedef {import('../espree').ParserOptions} ParserOptions - * @typedef {import('../espree').ecmaVersion} ecmaVersion - */ - -// ---------------------------------------------------------------------------- -// Local types -// ---------------------------------------------------------------------------- -/** - * @local - * @typedef {{ - * generator?: boolean - * } & acorn.Node} EsprimaNode - */ -/** - * Suggests an integer - * @local - * @typedef {number} int - */ - -/** - * @typedef {{ - * type: string, - * value: string, - * range?: [number, number], - * start?: number, - * end?: number, - * loc?: { - * start: acorn.Position | undefined, - * end: acorn.Position | undefined - * } - * }} EsprimaComment - */ - -/** - * First two properties as in `acorn.Comment`; next two as in `acorn.Comment` - * but optional. Last is different as has to allow `undefined` - */ -/** - * @local - * - * @typedef {import('../espree').EspreeTokens} EspreeTokens - * - * @typedef {{ - * tail?: boolean - * } & acorn.Node} AcornTemplateNode - * - * @typedef {{ - * originalSourceType: "script"|"module"|"commonjs"; - * ecmaVersion: ecmaVersion; - * comments: EsprimaComment[]|null; - * impliedStrict: boolean; - * lastToken: acorn.Token|null; - * templateElements: (AcornTemplateNode)[]; - * jsxAttrValueToken: boolean; - * }} BaseStateObject - * - * @typedef {{ - * tokens: null; - * } & BaseStateObject} StateObject - * - * @typedef {{ - * tokens: EspreeTokens; - * } & BaseStateObject} StateObjectWithTokens - * - * @typedef {{ - * sourceType?: "script"|"module"|"commonjs"; - * comments?: EsprimaComment[]; - * tokens?: import('./token-translator').EsprimaToken[]; - * body: acorn.Node[]; - * } & acorn.Node} EsprimaProgramNode - */ -/** - * Converts an Acorn comment to an Esprima comment. - * - * - block True if it's a block comment, false if not. - * - text The text of the comment. - * - start The index at which the comment starts. - * - end The index at which the comment ends. - * - startLoc The location at which the comment starts. - * - endLoc The location at which the comment ends. - * @local - * @typedef {( - * block: boolean, - * text: string, - * start: int, - * end: int, - * startLoc: acorn.Position | undefined, - * endLoc: acorn.Position | undefined - * ) => EsprimaComment | void} AcornToEsprimaCommentConverter - */ - -// ---------------------------------------------------------------------------- -// Utilities -// ---------------------------------------------------------------------------- -/** - * Converts an Acorn comment to an Esprima comment. - * @type {AcornToEsprimaCommentConverter} - * @returns {EsprimaComment} The comment object. - * @private - */ -function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { - const comment = /** @type {EsprimaComment} */ ({ - 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; -} - -// ---------------------------------------------------------------------------- -// Exports -// ---------------------------------------------------------------------------- -/* eslint-disable arrow-body-style -- Need to supply formatted JSDoc for type info */ -var espree = () => { - - /** - * Returns the Espree parser. - * @param {AcornJsxParser} Parser The Acorn parser - * @returns {typeof EspreeParser} The Espree parser - */ - return Parser => { - const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes)); - - if (Parser.acornJsx) { - Object.assign(tokTypes, Parser.acornJsx.tokTypes); - } - - /* eslint-disable no-shadow -- Using first class as type */ - /** - * @export - */ - return class EspreeParser extends Parser { - /* eslint-enable no-shadow -- Using first class as type */ - /* eslint-disable jsdoc/check-types -- Allows generic object */ - /** - * Adapted parser for Espree. - * @param {ParserOptions|null} opts Espree options - * @param {string|object} code The source code - */ - constructor(opts, code) { - /* eslint-enable jsdoc/check-types -- Allows generic object */ - - const newOpts = (typeof opts !== "object" || opts === null) - ? {} - : opts; - - const codeString = typeof code === "string" - ? code - : String(code); - - // save original source type in case of commonjs - const originalSourceType = newOpts.sourceType; - const options = normalizeOptions(newOpts); - const ecmaFeatures = options.ecmaFeatures || {}; - const tokenTranslator = - options.tokens === true - ? new TokenTranslator(tokTypes, codeString) - : null; - - // Initialize acorn parser. - super({ - - // do not use spread, because we don't want to pass any unknown options to acorn - ecmaVersion: options.ecmaVersion, - sourceType: options.sourceType, - ranges: options.ranges, - locations: options.locations, - allowReserved: options.allowReserved, - - // Truthy value is true for backward compatibility. - allowReturnOutsideFunction: options.allowReturnOutsideFunction, - - // Collect tokens - /** - * Handler for receiving a token - * @param {acorn.Token} token The token - * @returns {void} - */ - onToken: token => { - if (tokenTranslator) { - - // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state. - tokenTranslator.onToken(token, /** @type {StateObjectWithTokens} */ (this[STATE])); - } - if (token.type !== tokTypes.eof) { - this[STATE].lastToken = token; - } - }, - - // Collect comments - /** - * Converts an Acorn comment to an Esprima comment. - * @type {AcornToEsprimaCommentConverter} - */ - onComment: (block, text, start, end, startLoc, endLoc) => { - if (this[STATE].comments) { - const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc); - - const comments = /** @type {EsprimaComment[]} */ (this[STATE].comments); - - comments.push(comment); - } - } - }, codeString); - - // Force for TypeScript (indicating that `lineStart` is not undefined) - if (!this.lineStart) { - this.lineStart = 0; - } - - /** - * Data that is unique to Espree and is not represented internally in - * Acorn. We put all of this data into a symbol property as a way to - * avoid potential naming conflicts with future versions of Acorn. - * @type {StateObjectWithTokens|StateObject} - */ - this[STATE] = { - originalSourceType: originalSourceType || options.sourceType, - tokens: tokenTranslator ? /** @type {EspreeTokens} */ ([]) : null, - comments: options.comment === true - ? /** @type {EsprimaComment[]} */ ([]) - : null, - impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5, - ecmaVersion: this.options.ecmaVersion, - jsxAttrValueToken: false, - - /** @type {acorn.Token|null} */ - lastToken: null, - - /** @type {AcornTemplateNode[]} */ - templateElements: [] - }; - } - - /** - * Returns Espree tokens. - * @returns {EspreeTokens|null} Espree tokens - */ - 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) { - tokens.comments = extra.comments; - } - - return tokens; - } - - /** - * Calls parent. - * @param {acorn.Node} node The node - * @param {string} type The type - * @returns {acorn.Node} The altered Node - */ - finishNode(node, type) { - const result = super.finishNode(node, type); - - return this[ESPRIMA_FINISH_NODE](result); - } - - /** - * Calls parent. - * @param {acorn.Node} node The node - * @param {string} type The type - * @param {number} pos The position - * @param {acorn.Position} loc The location - * @returns {acorn.Node} The altered Node - */ - finishNodeAt(node, type, pos, loc) { - const result = super.finishNodeAt(node, type, pos, loc); - - return this[ESPRIMA_FINISH_NODE](result); - } - - /** - * Parses. - * @returns {EsprimaProgramNode} The program Node - */ - parse() { - const extra = this[STATE]; - - const program = /** @type {EsprimaProgramNode} */ (super.parse()); - - program.sourceType = extra.originalSourceType; - - 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.body.length) { - const [firstNode] = program.body; - - if (program.range && firstNode.range) { - program.range[0] = firstNode.range[0]; - } - if (program.loc && firstNode.loc) { - program.loc.start = firstNode.loc.start; - } - program.start = firstNode.start; - } - if (extra.lastToken) { - if (program.range && extra.lastToken.range) { - program.range[1] = extra.lastToken.range[1]; - } - if (program.loc && extra.lastToken.loc) { - program.loc.end = extra.lastToken.loc.end; - } - program.end = extra.lastToken.end; - } - - - /* - * https://github.com/eslint/espree/issues/349 - * Ensure that template elements have correct range information. - * This is one location where Acorn produces a different value - * for its start and end properties vs. the values present in the - * range property. In order to avoid confusion, we set the start - * and end properties to the values that are present in range. - * This is done here, instead of in finishNode(), because Acorn - * uses the values of start and end internally while parsing, making - * it dangerous to change those values while parsing is ongoing. - * By waiting until the end of parsing, we can safely change these - * values without affect any other part of the process. - */ - this[STATE].templateElements.forEach(templateElement => { - const startOffset = -1; - const endOffset = templateElement.tail ? 1 : 2; - - templateElement.start += startOffset; - templateElement.end += endOffset; - - if (templateElement.range) { - templateElement.range[0] += startOffset; - templateElement.range[1] += endOffset; - } - - if (templateElement.loc) { - templateElement.loc.start.column += startOffset; - templateElement.loc.end.column += endOffset; - } - }); - - return program; - } - - /** - * Parses top level. - * @param {acorn.Node} node AST Node - * @returns {acorn.Node} The changed node - */ - 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 {EnhancedSyntaxError} A syntax error. - * @returns {void} - */ - raise(pos, message) { - const loc = Parser.acorn.getLineInfo(this.input, pos); - - /** @type {EnhancedSyntaxError} */ - 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 {EnhancedSyntaxError} 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 {EnhancedSyntaxError} 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 < /** @type {int} */ (this.lineStart)) { - - /** @type {int} */ - this.lineStart = this.input.lastIndexOf("\n", /** @type {int} */ (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. - * @param {number} quote A character code - * @returns {void} - */ - jsx_readString(quote) { // eslint-disable-line camelcase - if (typeof super.jsx_readString === "undefined") { - throw new Error("Not a JSX parser"); - } - super.jsx_readString(quote); - - if (this.type === tokTypes.string) { - this[STATE].jsxAttrValueToken = true; - } - } - - /** - * Performs last-minute Esprima-specific compatibility checks and fixes. - * @param {acorn.Node} result The node to check. - * @returns {EsprimaNode} The finished node. - */ - [ESPRIMA_FINISH_NODE](result) { - - const esprimaResult = /** @type {EsprimaNode} */ (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") { - - // save template element references to fix start/end later - this[STATE].templateElements.push(result); - } - - if (result.type.includes("Function") && !esprimaResult.generator) { - esprimaResult.generator = false; - } - - return esprimaResult; - } - }; - }; -}; - -const version$1 = "main"; - -/** - * @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 - * - * 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 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 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. - */ - - -// To initialize lazily. -const parsers = { - _regular: /** @type {IEspreeParser|null} */ (null), - _jsx: /** @type {IEspreeParser|null} */ (null), - - /** - * Returns regular Parser - * @returns {IEspreeParser} Regular Acorn parser - */ - get regular() { - if (this._regular === null) { - const espreeParserFactory = /** @type {unknown} */ (espree()); - - this._regular = /** @type {IEspreeParser} */ ( - acorn__namespace.Parser.extend( - - /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */ - (espreeParserFactory) - ) - ); - } - return this._regular; - }, - - /** - * Returns JSX Parser - * @returns {IEspreeParser} JSX Acorn parser - */ - get jsx() { - if (this._jsx === null) { - const espreeParserFactory = /** @type {unknown} */ (espree()); - const jsxFactory = jsx__default["default"](); - - this._jsx = /** @type {IEspreeParser} */ ( - acorn__namespace.Parser.extend( - jsxFactory, - - /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */ - (espreeParserFactory) - ) - ); - } - return this._jsx; - }, - - /** - * Returns Regular or JSX Parser - * @param {ParserOptions} options Parser options - * @returns {IEspreeParser} Regular or JSX Acorn parser - */ - 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 {ParserOptions} options Options defining how to tokenize. - * @returns {EspreeTokens} An array of tokens. - * @throws {EnhancedSyntaxError} 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 /** @type {EspreeTokens} */ (new Parser(options, code).tokenize()); -} - -//------------------------------------------------------------------------------ -// Parser -//------------------------------------------------------------------------------ - -/** - * Parses the given code. - * @param {string} code The code to tokenize. - * @param {ParserOptions} options Options defining how to tokenize. - * @returns {acorn.Node} The "Program" AST node. - * @throws {EnhancedSyntaxError} If the input code is invalid. - */ -function parse(code, options) { - const Parser = parsers.get(options); - - return new Parser(options, code).parse(); -} - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -const version = version$1; - -/* istanbul ignore next */ -const VisitorKeys = (function() { - return visitorKeys__namespace.KEYS; -}()); - -// Derive node types from VisitorKeys -/* istanbul ignore next */ -const Syntax = (function() { - let /** @type {Object} */ - types = {}; - - if (typeof Object.create === "function") { - types = Object.create(null); - } - - for (const name of Object.keys(VisitorKeys)) { - types[name] = name; - } - - if (typeof Object.freeze === "function") { - Object.freeze(types); - } - - return types; -}()); - -const latestEcmaVersion = getLatestEcmaVersion(); - -const supportedEcmaVersions = getSupportedEcmaVersions(); - -exports.Syntax = Syntax; -exports.VisitorKeys = VisitorKeys; -exports.latestEcmaVersion = latestEcmaVersion; -exports.parse = parse; -exports.supportedEcmaVersions = supportedEcmaVersions; -exports.tokenize = tokenize; -exports.version = version; -//# sourceMappingURL=espree.cjs.map diff --git a/dist/espree.cjs.map b/dist/espree.cjs.map deleted file mode 100644 index ce020f80..00000000 --- a/dist/espree.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"espree.cjs","sources":["../lib/token-translator.js","../lib/options.js","../lib/espree.js","../lib/version.js","../espree.js"],"sourcesContent":["/**\n * @fileoverview Translates tokens between Acorn format and Esprima format.\n * @author Nicholas C. Zakas\n */\n/* eslint no-underscore-dangle: 0 */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('./espree').EnhancedTokTypes} EnhancedTokTypes\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * Based on the `acorn.Token` class, but without a fixed `type` (since we need\n * it to be a string). Avoiding `type` lets us make one extending interface\n * more strict and another more lax.\n *\n * We could make `value` more strict to `string` even though the original is\n * `any`.\n *\n * `start` and `end` are required in `acorn.Token`\n *\n * `loc` and `range` are from `acorn.Token`\n *\n * Adds `regex`.\n */\n/**\n * @local\n *\n * @typedef {{\n * value: any;\n * start?: number;\n * end?: number;\n * loc?: acorn.SourceLocation;\n * range?: [number, number];\n * regex?: {flags: string, pattern: string};\n * }} BaseEsprimaToken\n *\n * @typedef {{\n * jsxAttrValueToken: boolean;\n * ecmaVersion: ecmaVersion;\n * }} ExtraNoTokens\n *\n * @typedef {{\n * tokens: EsprimaToken[]\n * } & ExtraNoTokens} Extra\n */\n\n/**\n * @typedef {{\n * type: string;\n * } & BaseEsprimaToken} EsprimaToken\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\n// none!\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n\n// Esprima Token Types\nconst Token = {\n Boolean: \"Boolean\",\n EOF: \"\",\n Identifier: \"Identifier\",\n PrivateIdentifier: \"PrivateIdentifier\",\n Keyword: \"Keyword\",\n Null: \"Null\",\n Numeric: \"Numeric\",\n Punctuator: \"Punctuator\",\n String: \"String\",\n RegularExpression: \"RegularExpression\",\n Template: \"Template\",\n JSXIdentifier: \"JSXIdentifier\",\n JSXText: \"JSXText\"\n};\n\n/**\n * Converts part of a template into an Esprima token.\n * @param {(acorn.Token)[]} tokens The Acorn tokens representing the template.\n * @param {string} code The source code.\n * @returns {EsprimaToken} The Esprima equivalent of the template token.\n * @private\n */\nfunction convertTemplatePart(tokens, code) {\n const firstToken = tokens[0],\n lastTemplateToken = tokens[tokens.length - 1];\n\n /** @type {EsprimaToken} */\n const token = {\n type: Token.Template,\n value: code.slice(firstToken.start, lastTemplateToken.end)\n };\n\n if (firstToken.loc && lastTemplateToken.loc) {\n token.loc = {\n start: firstToken.loc.start,\n end: lastTemplateToken.loc.end\n };\n }\n\n if (firstToken.range && lastTemplateToken.range) {\n token.start = firstToken.range[0];\n token.end = lastTemplateToken.range[1];\n token.range = [token.start, token.end];\n }\n\n return token;\n}\n\nclass TokenTranslator {\n\n /**\n * Contains logic to translate Acorn tokens into Esprima tokens.\n * @param {EnhancedTokTypes} acornTokTypes The Acorn token types.\n * @param {string} code The source code Acorn is parsing. This is necessary\n * to correct the \"value\" property of some tokens.\n */\n constructor(acornTokTypes, code) {\n\n // token types\n this._acornTokTypes = acornTokTypes;\n\n // token buffer for templates\n /** @type {acorn.Token[]} */\n this._tokens = [];\n\n // track the last curly brace\n this._curlyBrace = null;\n\n // the source code\n this._code = code;\n\n }\n\n /**\n * Translates a single Acorn token to a single Esprima token. This may be\n * inaccurate due to how templates are handled differently in Esprima and\n * Acorn, but should be accurate for all other tokens.\n * @param {acorn.Token} token The Acorn token to translate.\n * @param {ExtraNoTokens} extra Espree extra object.\n * @returns {EsprimaToken} The Esprima version of the token.\n */\n translate(token, extra) {\n\n const type = token.type,\n tt = this._acornTokTypes,\n\n // We use an unknown type because `acorn.Token` is a class whose\n // `type` property we cannot override to our desired `string`;\n // this also allows us to define a stricter `EsprimaToken` with\n // a string-only `type` property\n unknownType = /** @type {unknown} */ (token),\n newToken = /** @type {EsprimaToken} */ (unknownType);\n\n if (type === tt.name) {\n newToken.type = Token.Identifier;\n\n // TODO: See if this is an Acorn bug\n if (token.value === \"static\") {\n newToken.type = Token.Keyword;\n }\n\n if (extra.ecmaVersion > 5 && (token.value === \"yield\" || token.value === \"let\")) {\n newToken.type = Token.Keyword;\n }\n\n } else if (type === tt.privateId) {\n newToken.type = Token.PrivateIdentifier;\n\n } else if (type === tt.semi || type === tt.comma ||\n type === tt.parenL || type === tt.parenR ||\n type === tt.braceL || type === tt.braceR ||\n type === tt.dot || type === tt.bracketL ||\n type === tt.colon || type === tt.question ||\n type === tt.bracketR || type === tt.ellipsis ||\n type === tt.arrow || type === tt.jsxTagStart ||\n type === tt.incDec || type === tt.starstar ||\n type === tt.jsxTagEnd || type === tt.prefix ||\n type === tt.questionDot ||\n (type.binop && !type.keyword) ||\n type.isAssign) {\n\n newToken.type = Token.Punctuator;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.jsxName) {\n newToken.type = Token.JSXIdentifier;\n } else if (type.label === \"jsxText\" || type === tt.jsxAttrValueToken) {\n newToken.type = Token.JSXText;\n } else if (type.keyword) {\n if (type.keyword === \"true\" || type.keyword === \"false\") {\n newToken.type = Token.Boolean;\n } else if (type.keyword === \"null\") {\n newToken.type = Token.Null;\n } else {\n newToken.type = Token.Keyword;\n }\n } else if (type === tt.num) {\n newToken.type = Token.Numeric;\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.string) {\n\n if (extra.jsxAttrValueToken) {\n extra.jsxAttrValueToken = false;\n newToken.type = Token.JSXText;\n } else {\n newToken.type = Token.String;\n }\n\n newToken.value = this._code.slice(token.start, token.end);\n } else if (type === tt.regexp) {\n newToken.type = Token.RegularExpression;\n const value = token.value;\n\n newToken.regex = {\n flags: value.flags,\n pattern: value.pattern\n };\n newToken.value = `/${value.pattern}/${value.flags}`;\n }\n\n return newToken;\n }\n\n /**\n * Function to call during Acorn's onToken handler.\n * @param {acorn.Token} token The Acorn token.\n * @param {Extra} extra The Espree extra object.\n * @returns {void}\n */\n onToken(token, extra) {\n\n const that = this,\n tt = this._acornTokTypes,\n tokens = extra.tokens,\n templateTokens = this._tokens;\n\n /**\n * Flushes the buffered template tokens and resets the template\n * tracking.\n * @returns {void}\n * @private\n */\n function translateTemplateTokens() {\n tokens.push(convertTemplatePart(that._tokens, that._code));\n that._tokens = [];\n }\n\n if (token.type === tt.eof) {\n\n // might be one last curlyBrace\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n return;\n }\n\n if (token.type === tt.backQuote) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n\n // it's the end\n if (templateTokens.length > 1) {\n translateTemplateTokens();\n }\n\n return;\n }\n if (token.type === tt.dollarBraceL) {\n templateTokens.push(token);\n translateTemplateTokens();\n return;\n }\n if (token.type === tt.braceR) {\n\n // if there's already a curly, it's not part of the template\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n }\n\n // store new curly for later\n this._curlyBrace = token;\n return;\n }\n if (token.type === tt.template || token.type === tt.invalidTemplate) {\n if (this._curlyBrace) {\n templateTokens.push(this._curlyBrace);\n this._curlyBrace = null;\n }\n\n templateTokens.push(token);\n return;\n }\n\n if (this._curlyBrace) {\n tokens.push(this.translate(this._curlyBrace, extra));\n this._curlyBrace = null;\n }\n\n tokens.push(this.translate(token, extra));\n }\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport default TokenTranslator;\n","/**\n * @fileoverview A collection of methods for processing Espree's options.\n * @author Kai Cataldo\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * ecmaVersion: ecmaVersion,\n * sourceType: \"script\"|\"module\",\n * range?: boolean,\n * loc?: boolean,\n * allowReserved: boolean | \"never\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * ranges: boolean,\n * locations: boolean,\n * allowReturnOutsideFunction: boolean,\n * tokens?: boolean,\n * comment?: boolean\n * }} NormalizedParserOptions\n */\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst SUPPORTED_VERSIONS = [\n 3,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13\n];\n\n/**\n * Get the latest ECMAScript version supported by Espree.\n * @returns {number} The latest ECMAScript version.\n */\nexport function getLatestEcmaVersion() {\n return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1];\n}\n\n/**\n * Get the list of ECMAScript versions supported by Espree.\n * @returns {number[]} An array containing the supported ECMAScript versions.\n */\nexport function getSupportedEcmaVersions() {\n return [...SUPPORTED_VERSIONS];\n}\n\n/**\n * Normalize ECMAScript version from the initial config\n * @param {number|\"latest\"} ecmaVersion ECMAScript version from the initial config\n * @throws {Error} throws an error if the ecmaVersion is invalid.\n * @returns {number} normalized ECMAScript version\n */\nfunction normalizeEcmaVersion(ecmaVersion = 5) {\n\n let version = ecmaVersion === \"latest\" ? getLatestEcmaVersion() : ecmaVersion;\n\n if (typeof version !== \"number\") {\n throw new Error(`ecmaVersion must be a number or \"latest\". Received value of type ${typeof ecmaVersion} instead.`);\n }\n\n // Calculate ECMAScript edition number from official year version starting with\n // ES2015, which corresponds with ES6 (or a difference of 2009).\n if (version >= 2015) {\n version -= 2009;\n }\n\n if (!SUPPORTED_VERSIONS.includes(version)) {\n throw new Error(\"Invalid ecmaVersion.\");\n }\n\n return version;\n}\n\n/**\n * Normalize sourceType from the initial config\n * @param {\"script\"|\"module\"|\"commonjs\"} sourceType to normalize\n * @throws {Error} throw an error if sourceType is invalid\n * @returns {\"script\"|\"module\"} normalized sourceType\n */\nfunction normalizeSourceType(sourceType = \"script\") {\n if (sourceType === \"script\" || sourceType === \"module\") {\n return sourceType;\n }\n\n if (sourceType === \"commonjs\") {\n return \"script\";\n }\n\n throw new Error(\"Invalid sourceType.\");\n}\n\n/**\n * Normalize parserOptions\n * @param {ParserOptions} options the parser options to normalize\n * @throws {Error} throw an error if found invalid option.\n * @returns {NormalizedParserOptions} normalized options\n */\nexport function normalizeOptions(options) {\n const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion);\n\n const sourceType = normalizeSourceType(options.sourceType);\n const ranges = options.range === true;\n const locations = options.loc === true;\n\n if (ecmaVersion !== 3 && options.allowReserved) {\n\n // a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed\n throw new Error(\"`allowReserved` is only supported when ecmaVersion is 3\");\n }\n\n // Note: value in Acorn can also be \"never\" but we throw in such a case\n if (typeof options.allowReserved !== \"undefined\" && typeof options.allowReserved !== \"boolean\") {\n throw new Error(\"`allowReserved`, when present, must be `true` or `false`\");\n }\n const allowReserved = ecmaVersion === 3 ? (options.allowReserved || \"never\") : false;\n const ecmaFeatures = options.ecmaFeatures || {};\n const allowReturnOutsideFunction = options.sourceType === \"commonjs\" ||\n Boolean(ecmaFeatures.globalReturn);\n\n if (sourceType === \"module\" && ecmaVersion < 6) {\n throw new Error(\"sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.\");\n }\n\n return Object.assign({}, options, {\n ecmaVersion,\n sourceType,\n ranges,\n locations,\n allowReserved,\n allowReturnOutsideFunction\n });\n}\n","/* eslint-disable no-param-reassign*/\nimport TokenTranslator from \"./token-translator.js\";\nimport { normalizeOptions } from \"./options.js\";\n\nconst STATE = Symbol(\"espree's internal state\");\nconst ESPRIMA_FINISH_NODE = Symbol(\"espree's esprimaFinishNode\");\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {{\n * index?: number;\n * lineNumber?: number;\n * column?: number;\n * } & SyntaxError} EnhancedSyntaxError\n */\n\n// We add `jsxAttrValueToken` ourselves.\n/**\n * @typedef {{\n * jsxAttrValueToken?: acorn.TokenType;\n * } & tokTypesType} EnhancedTokTypes\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('acorn-jsx').TokTypes} tokTypesType\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('../espree').ParserOptions} ParserOptions\n * @typedef {import('../espree').ecmaVersion} ecmaVersion\n */\n\n// ----------------------------------------------------------------------------\n// Local types\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {{\n * generator?: boolean\n * } & acorn.Node} EsprimaNode\n */\n/**\n * Suggests an integer\n * @local\n * @typedef {number} int\n */\n\n/**\n * @typedef {{\n * type: string,\n * value: string,\n * range?: [number, number],\n * start?: number,\n * end?: number,\n * loc?: {\n * start: acorn.Position | undefined,\n * end: acorn.Position | undefined\n * }\n * }} EsprimaComment\n */\n\n/**\n * First two properties as in `acorn.Comment`; next two as in `acorn.Comment`\n * but optional. Last is different as has to allow `undefined`\n */\n/**\n * @local\n *\n * @typedef {import('../espree').EspreeTokens} EspreeTokens\n *\n * @typedef {{\n * tail?: boolean\n * } & acorn.Node} AcornTemplateNode\n *\n * @typedef {{\n * originalSourceType: \"script\"|\"module\"|\"commonjs\";\n * ecmaVersion: ecmaVersion;\n * comments: EsprimaComment[]|null;\n * impliedStrict: boolean;\n * lastToken: acorn.Token|null;\n * templateElements: (AcornTemplateNode)[];\n * jsxAttrValueToken: boolean;\n * }} BaseStateObject\n *\n * @typedef {{\n * tokens: null;\n * } & BaseStateObject} StateObject\n *\n * @typedef {{\n * tokens: EspreeTokens;\n * } & BaseStateObject} StateObjectWithTokens\n *\n * @typedef {{\n * sourceType?: \"script\"|\"module\"|\"commonjs\";\n * comments?: EsprimaComment[];\n * tokens?: import('./token-translator').EsprimaToken[];\n * body: acorn.Node[];\n * } & acorn.Node} EsprimaProgramNode\n */\n/**\n * Converts an Acorn comment to an Esprima comment.\n *\n * - block True if it's a block comment, false if not.\n * - text The text of the comment.\n * - start The index at which the comment starts.\n * - end The index at which the comment ends.\n * - startLoc The location at which the comment starts.\n * - endLoc The location at which the comment ends.\n * @local\n * @typedef {(\n * block: boolean,\n * text: string,\n * start: int,\n * end: int,\n * startLoc: acorn.Position | undefined,\n * endLoc: acorn.Position | undefined\n * ) => EsprimaComment | void} AcornToEsprimaCommentConverter\n */\n\n// ----------------------------------------------------------------------------\n// Utilities\n// ----------------------------------------------------------------------------\n/**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n * @returns {EsprimaComment} The comment object.\n * @private\n */\nfunction convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) {\n const comment = /** @type {EsprimaComment} */ ({\n type: block ? \"Block\" : \"Line\",\n value: text\n });\n\n if (typeof start === \"number\") {\n comment.start = start;\n comment.end = end;\n comment.range = [start, end];\n }\n\n if (typeof startLoc === \"object\") {\n comment.loc = {\n start: startLoc,\n end: endLoc\n };\n }\n\n return comment;\n}\n\n// ----------------------------------------------------------------------------\n// Exports\n// ----------------------------------------------------------------------------\n/* eslint-disable arrow-body-style -- Need to supply formatted JSDoc for type info */\nexport default () => {\n\n /**\n * Returns the Espree parser.\n * @param {AcornJsxParser} Parser The Acorn parser\n * @returns {typeof EspreeParser} The Espree parser\n */\n return Parser => {\n const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes));\n\n if (Parser.acornJsx) {\n Object.assign(tokTypes, Parser.acornJsx.tokTypes);\n }\n\n /* eslint-disable no-shadow -- Using first class as type */\n /**\n * @export\n */\n return class EspreeParser extends Parser {\n /* eslint-enable no-shadow -- Using first class as type */\n /* eslint-disable jsdoc/check-types -- Allows generic object */\n /**\n * Adapted parser for Espree.\n * @param {ParserOptions|null} opts Espree options\n * @param {string|object} code The source code\n */\n constructor(opts, code) {\n /* eslint-enable jsdoc/check-types -- Allows generic object */\n\n const newOpts = (typeof opts !== \"object\" || opts === null)\n ? {}\n : opts;\n\n const codeString = typeof code === \"string\"\n ? code\n : String(code);\n\n // save original source type in case of commonjs\n const originalSourceType = newOpts.sourceType;\n const options = normalizeOptions(newOpts);\n const ecmaFeatures = options.ecmaFeatures || {};\n const tokenTranslator =\n options.tokens === true\n ? new TokenTranslator(tokTypes, codeString)\n : null;\n\n // Initialize acorn parser.\n super({\n\n // do not use spread, because we don't want to pass any unknown options to acorn\n ecmaVersion: options.ecmaVersion,\n sourceType: options.sourceType,\n ranges: options.ranges,\n locations: options.locations,\n allowReserved: options.allowReserved,\n\n // Truthy value is true for backward compatibility.\n allowReturnOutsideFunction: options.allowReturnOutsideFunction,\n\n // Collect tokens\n /**\n * Handler for receiving a token\n * @param {acorn.Token} token The token\n * @returns {void}\n */\n onToken: token => {\n if (tokenTranslator) {\n\n // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.\n tokenTranslator.onToken(token, /** @type {StateObjectWithTokens} */ (this[STATE]));\n }\n if (token.type !== tokTypes.eof) {\n this[STATE].lastToken = token;\n }\n },\n\n // Collect comments\n /**\n * Converts an Acorn comment to an Esprima comment.\n * @type {AcornToEsprimaCommentConverter}\n */\n onComment: (block, text, start, end, startLoc, endLoc) => {\n if (this[STATE].comments) {\n const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc);\n\n const comments = /** @type {EsprimaComment[]} */ (this[STATE].comments);\n\n comments.push(comment);\n }\n }\n }, codeString);\n\n // Force for TypeScript (indicating that `lineStart` is not undefined)\n if (!this.lineStart) {\n this.lineStart = 0;\n }\n\n /**\n * Data that is unique to Espree and is not represented internally in\n * Acorn. We put all of this data into a symbol property as a way to\n * avoid potential naming conflicts with future versions of Acorn.\n * @type {StateObjectWithTokens|StateObject}\n */\n this[STATE] = {\n originalSourceType: originalSourceType || options.sourceType,\n tokens: tokenTranslator ? /** @type {EspreeTokens} */ ([]) : null,\n comments: options.comment === true\n ? /** @type {EsprimaComment[]} */ ([])\n : null,\n impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,\n ecmaVersion: this.options.ecmaVersion,\n jsxAttrValueToken: false,\n\n /** @type {acorn.Token|null} */\n lastToken: null,\n\n /** @type {AcornTemplateNode[]} */\n templateElements: []\n };\n }\n\n /**\n * Returns Espree tokens.\n * @returns {EspreeTokens|null} Espree tokens\n */\n tokenize() {\n do {\n this.next();\n } while (this.type !== tokTypes.eof);\n\n // Consume the final eof token\n this.next();\n\n const extra = this[STATE];\n const tokens = extra.tokens;\n\n if (extra.comments && tokens) {\n tokens.comments = extra.comments;\n }\n\n return tokens;\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @returns {acorn.Node} The altered Node\n */\n finishNode(node, type) {\n const result = super.finishNode(node, type);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Calls parent.\n * @param {acorn.Node} node The node\n * @param {string} type The type\n * @param {number} pos The position\n * @param {acorn.Position} loc The location\n * @returns {acorn.Node} The altered Node\n */\n finishNodeAt(node, type, pos, loc) {\n const result = super.finishNodeAt(node, type, pos, loc);\n\n return this[ESPRIMA_FINISH_NODE](result);\n }\n\n /**\n * Parses.\n * @returns {EsprimaProgramNode} The program Node\n */\n parse() {\n const extra = this[STATE];\n\n const program = /** @type {EsprimaProgramNode} */ (super.parse());\n\n program.sourceType = extra.originalSourceType;\n\n if (extra.comments) {\n program.comments = extra.comments;\n }\n if (extra.tokens) {\n program.tokens = extra.tokens;\n }\n\n /*\n * Adjust opening and closing position of program to match Esprima.\n * Acorn always starts programs at range 0 whereas Esprima starts at the\n * first AST node's start (the only real difference is when there's leading\n * whitespace or leading comments). Acorn also counts trailing whitespace\n * as part of the program whereas Esprima only counts up to the last token.\n */\n if (program.body.length) {\n const [firstNode] = program.body;\n\n if (program.range && firstNode.range) {\n program.range[0] = firstNode.range[0];\n }\n if (program.loc && firstNode.loc) {\n program.loc.start = firstNode.loc.start;\n }\n program.start = firstNode.start;\n }\n if (extra.lastToken) {\n if (program.range && extra.lastToken.range) {\n program.range[1] = extra.lastToken.range[1];\n }\n if (program.loc && extra.lastToken.loc) {\n program.loc.end = extra.lastToken.loc.end;\n }\n program.end = extra.lastToken.end;\n }\n\n\n /*\n * https://github.com/eslint/espree/issues/349\n * Ensure that template elements have correct range information.\n * This is one location where Acorn produces a different value\n * for its start and end properties vs. the values present in the\n * range property. In order to avoid confusion, we set the start\n * and end properties to the values that are present in range.\n * This is done here, instead of in finishNode(), because Acorn\n * uses the values of start and end internally while parsing, making\n * it dangerous to change those values while parsing is ongoing.\n * By waiting until the end of parsing, we can safely change these\n * values without affect any other part of the process.\n */\n this[STATE].templateElements.forEach(templateElement => {\n const startOffset = -1;\n const endOffset = templateElement.tail ? 1 : 2;\n\n templateElement.start += startOffset;\n templateElement.end += endOffset;\n\n if (templateElement.range) {\n templateElement.range[0] += startOffset;\n templateElement.range[1] += endOffset;\n }\n\n if (templateElement.loc) {\n templateElement.loc.start.column += startOffset;\n templateElement.loc.end.column += endOffset;\n }\n });\n\n return program;\n }\n\n /**\n * Parses top level.\n * @param {acorn.Node} node AST Node\n * @returns {acorn.Node} The changed node\n */\n parseTopLevel(node) {\n if (this[STATE].impliedStrict) {\n this.strict = true;\n }\n return super.parseTopLevel(node);\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raise(pos, message) {\n const loc = Parser.acorn.getLineInfo(this.input, pos);\n\n /** @type {EnhancedSyntaxError} */\n const err = new SyntaxError(message);\n\n err.index = pos;\n err.lineNumber = loc.line;\n err.column = loc.column + 1; // acorn uses 0-based columns\n throw err;\n }\n\n /**\n * Overwrites the default raise method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @param {string} message The error message.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n raiseRecoverable(pos, message) {\n this.raise(pos, message);\n }\n\n /**\n * Overwrites the default unexpected method to throw Esprima-style errors.\n * @param {int} pos The position of the error.\n * @throws {EnhancedSyntaxError} A syntax error.\n * @returns {void}\n */\n unexpected(pos) {\n let message = \"Unexpected token\";\n\n if (pos !== null && pos !== void 0) {\n this.pos = pos;\n\n if (this.options.locations) {\n while (this.pos < /** @type {int} */ (this.lineStart)) {\n\n /** @type {int} */\n this.lineStart = this.input.lastIndexOf(\"\\n\", /** @type {int} */ (this.lineStart) - 2) + 1;\n --this.curLine;\n }\n }\n\n this.nextToken();\n }\n\n if (this.end > this.start) {\n message += ` ${this.input.slice(this.start, this.end)}`;\n }\n\n this.raise(this.start, message);\n }\n\n /**\n * Esprima-FB represents JSX strings as tokens called \"JSXText\", but Acorn-JSX\n * uses regular tt.string without any distinction between this and regular JS\n * strings. As such, we intercept an attempt to read a JSX string and set a flag\n * on extra so that when tokens are converted, the next token will be switched\n * to JSXText via onToken.\n * @param {number} quote A character code\n * @returns {void}\n */\n jsx_readString(quote) { // eslint-disable-line camelcase\n if (typeof super.jsx_readString === \"undefined\") {\n throw new Error(\"Not a JSX parser\");\n }\n super.jsx_readString(quote);\n\n if (this.type === tokTypes.string) {\n this[STATE].jsxAttrValueToken = true;\n }\n }\n\n /**\n * Performs last-minute Esprima-specific compatibility checks and fixes.\n * @param {acorn.Node} result The node to check.\n * @returns {EsprimaNode} The finished node.\n */\n [ESPRIMA_FINISH_NODE](result) {\n\n const esprimaResult = /** @type {EsprimaNode} */ (result);\n\n // Acorn doesn't count the opening and closing backticks as part of templates\n // so we have to adjust ranges/locations appropriately.\n if (result.type === \"TemplateElement\") {\n\n // save template element references to fix start/end later\n this[STATE].templateElements.push(result);\n }\n\n if (result.type.includes(\"Function\") && !esprimaResult.generator) {\n esprimaResult.generator = false;\n }\n\n return esprimaResult;\n }\n };\n };\n};\n","const version = \"main\";\n\nexport default version;\n","/**\n * @fileoverview Main Espree file that converts Acorn into Esprima output.\n *\n * This file contains code from the following MIT-licensed projects:\n * 1. Acorn\n * 2. Babylon\n * 3. Babel-ESLint\n *\n * This file also contains code from Esprima, which is BSD licensed.\n *\n * Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)\n * Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)\n * Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie \n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/* eslint no-undefined:0, no-use-before-define: 0 */\n\n// ----------------------------------------------------------------------------\n// Types exported from file\n// ----------------------------------------------------------------------------\n/**\n * @typedef {3|5|6|7|8|9|10|11|12|13|2015|2016|2017|2018|2019|2020|2021|2022|'latest'} ecmaVersion\n */\n\n/**\n * @typedef {import('./lib/token-translator').EsprimaToken} EspreeToken\n */\n\n/**\n * @typedef {import('./lib/espree').EsprimaComment} EspreeComment\n */\n\n/**\n * @typedef {{\n * comments?: EspreeComment[]\n * } & EspreeToken[]} EspreeTokens\n */\n\n/**\n * `jsx.Options` gives us 2 optional properties, so extend it\n *\n * `allowReserved`, `ranges`, `locations`, `allowReturnOutsideFunction`,\n * `onToken`, and `onComment` are as in `acorn.Options`\n *\n * `ecmaVersion` currently as in `acorn.Options` though optional\n *\n * `sourceType` as in `acorn.Options` but also allows `commonjs`\n *\n * `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options`\n *\n * `comment` is not in `acorn.Options` and doesn't err without it, but is used\n */\n/**\n * @typedef {{\n * allowReserved?: boolean,\n * ecmaVersion?: ecmaVersion,\n * sourceType?: \"script\"|\"module\"|\"commonjs\",\n * ecmaFeatures?: {\n * jsx?: boolean,\n * globalReturn?: boolean,\n * impliedStrict?: boolean\n * },\n * range?: boolean,\n * loc?: boolean,\n * tokens?: boolean,\n * comment?: boolean,\n * }} ParserOptions\n */\n\n// ----------------------------------------------------------------------------\n// Local type imports\n// ----------------------------------------------------------------------------\n/**\n * @local\n * @typedef {import('acorn')} acorn\n * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser\n * @typedef {import('./lib/espree').EnhancedSyntaxError} EnhancedSyntaxError\n * @typedef {typeof import('./lib/espree').EspreeParser} IEspreeParser\n */\n\nimport * as acorn from \"acorn\";\nimport jsx from \"acorn-jsx\";\nimport espree from \"./lib/espree.js\";\nimport espreeVersion from \"./lib/version.js\";\nimport * as visitorKeys from \"eslint-visitor-keys\";\nimport { getLatestEcmaVersion, getSupportedEcmaVersions } from \"./lib/options.js\";\n\n\n// To initialize lazily.\nconst parsers = {\n _regular: /** @type {IEspreeParser|null} */ (null),\n _jsx: /** @type {IEspreeParser|null} */ (null),\n\n /**\n * Returns regular Parser\n * @returns {IEspreeParser} Regular Acorn parser\n */\n get regular() {\n if (this._regular === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n\n this._regular = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._regular;\n },\n\n /**\n * Returns JSX Parser\n * @returns {IEspreeParser} JSX Acorn parser\n */\n get jsx() {\n if (this._jsx === null) {\n const espreeParserFactory = /** @type {unknown} */ (espree());\n const jsxFactory = jsx();\n\n this._jsx = /** @type {IEspreeParser} */ (\n acorn.Parser.extend(\n jsxFactory,\n\n /** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */\n (espreeParserFactory)\n )\n );\n }\n return this._jsx;\n },\n\n /**\n * Returns Regular or JSX Parser\n * @param {ParserOptions} options Parser options\n * @returns {IEspreeParser} Regular or JSX Acorn parser\n */\n get(options) {\n const useJsx = Boolean(\n options &&\n options.ecmaFeatures &&\n options.ecmaFeatures.jsx\n );\n\n return useJsx ? this.jsx : this.regular;\n }\n};\n\n//------------------------------------------------------------------------------\n// Tokenizer\n//------------------------------------------------------------------------------\n\n/**\n * Tokenizes the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {EspreeTokens} An array of tokens.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n * @private\n */\nexport function tokenize(code, options) {\n const Parser = parsers.get(options);\n\n // Ensure to collect tokens.\n if (!options || options.tokens !== true) {\n options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign\n }\n\n return /** @type {EspreeTokens} */ (new Parser(options, code).tokenize());\n}\n\n//------------------------------------------------------------------------------\n// Parser\n//------------------------------------------------------------------------------\n\n/**\n * Parses the given code.\n * @param {string} code The code to tokenize.\n * @param {ParserOptions} options Options defining how to tokenize.\n * @returns {acorn.Node} The \"Program\" AST node.\n * @throws {EnhancedSyntaxError} If the input code is invalid.\n */\nexport function parse(code, options) {\n const Parser = parsers.get(options);\n\n return new Parser(options, code).parse();\n}\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nexport const version = espreeVersion;\n\n/* istanbul ignore next */\nexport const VisitorKeys = (function() {\n return visitorKeys.KEYS;\n}());\n\n// Derive node types from VisitorKeys\n/* istanbul ignore next */\nexport const Syntax = (function() {\n let /** @type {Object} */\n types = {};\n\n if (typeof Object.create === \"function\") {\n types = Object.create(null);\n }\n\n for (const name of Object.keys(VisitorKeys)) {\n types[name] = name;\n }\n\n if (typeof Object.freeze === \"function\") {\n Object.freeze(types);\n }\n\n return types;\n}());\n\nexport const latestEcmaVersion = getLatestEcmaVersion();\n\nexport const supportedEcmaVersions = getSupportedEcmaVersions();\n"],"names":["version","acorn","jsx","espreeVersion","visitorKeys"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,KAAK,GAAG;AACd,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,GAAG,EAAE,OAAO;AAChB,IAAI,UAAU,EAAE,YAAY;AAC5B,IAAI,iBAAiB,EAAE,mBAAmB;AAC1C,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,UAAU,EAAE,YAAY;AAC5B,IAAI,MAAM,EAAE,QAAQ;AACpB,IAAI,iBAAiB,EAAE,mBAAmB;AAC1C,IAAI,QAAQ,EAAE,UAAU;AACxB,IAAI,aAAa,EAAE,eAAe;AAClC,IAAI,OAAO,EAAE,SAAS;AACtB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mBAAmB,CAAC,MAAM,EAAE,IAAI,EAAE;AAC3C,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC;AAChC,QAAQ,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACtD;AACA;AAC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C,QAAQ,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,KAAK;AACL;AACA,IAAI,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;AACjD,QAAQ,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAC3B,KAAK;AACL;AACA,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;AAC7C,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7B,KAAK;AACL;AACA,IAAI,OAAO,KAAK,CAAC;AACjB,CAAC,EAAE,EAAE;AACL;AACY,MAAC,iBAAiB,GAAG,oBAAoB,GAAG;AACxD;AACY,MAAC,qBAAqB,GAAG,wBAAwB;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/espree.d.ts b/dist/espree.d.ts deleted file mode 100644 index 31af4994..00000000 --- a/dist/espree.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Tokenizes the given code. - * @param {string} code The code to tokenize. - * @param {ParserOptions} options Options defining how to tokenize. - * @returns {EspreeTokens} An array of tokens. - * @throws {import('./lib/espree').EnhancedSyntaxError} If the input code is invalid. - * @private - */ -export function tokenize(code: string, options: ParserOptions): EspreeTokens; -/** - * Parses the given code. - * @param {string} code The code to tokenize. - * @param {ParserOptions} options Options defining how to tokenize. - * @returns {import('acorn').Node} The "Program" AST node. - * @throws {import('./lib/espree').EnhancedSyntaxError} If the input code is invalid. - */ -export function parse(code: string, options: ParserOptions): import('acorn').Node; -export const version: "main"; -export const VisitorKeys: visitorKeys.VisitorKeys; -export const Syntax: { - [x: string]: string; -}; -export const latestEcmaVersion: number; -export const supportedEcmaVersions: number[]; -export type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 'latest'; -export type EspreeToken = import('./lib/token-translator').EsprimaToken; -export type EspreeComment = import('./lib/espree').EsprimaComment; -export type EspreeTokens = { - comments?: EspreeComment[]; -} & EspreeToken[]; -export type ParserOptions = { - allowReserved?: boolean; - ecmaVersion?: ecmaVersion; - sourceType?: "script" | "module" | "commonjs"; - ecmaFeatures?: { - jsx?: boolean; - globalReturn?: boolean; - impliedStrict?: boolean; - }; - range?: boolean; - loc?: boolean; - tokens?: boolean; - comment?: boolean; -}; -import * as visitorKeys from "eslint-visitor-keys"; -import jsx from "acorn-jsx"; -//# sourceMappingURL=espree.d.ts.map \ No newline at end of file diff --git a/dist/espree.d.ts.map b/dist/espree.d.ts.map deleted file mode 100644 index b09fe0c2..00000000 --- a/dist/espree.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"espree.d.ts","sourceRoot":"","sources":["../tmp/espree.js"],"names":[],"mappings":"AAgIA;;;;;;;GAOG;AACH,+BANW,MAAM,WACN,aAAa,GACX,YAAY,CAUxB;AAED;;;;;;GAMG;AACH,4BALW,MAAM,WACN,aAAa,GACX,OAAO,OAAO,EAAE,IAAI,CAMhC;AACD,6BAAqC;AACrC,kDAEI;AACJ;;EAYI;AACJ,uCAAwD;AACxD,6CAAgE;0BA5HnD,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ;0BAI5G,OAAO,wBAAwB,EAAE,YAAY;4BAI7C,OAAO,cAAc,EAAE,cAAc;2BAIrC;IAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAA;CAAC,GAAG,WAAW,EAAE;4BAc5C;IAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IAAC,YAAY,CAAC,EAAE;QAAC,GAAG,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAC"} \ No newline at end of file diff --git a/dist/lib/espree.d.ts b/dist/lib/espree.d.ts deleted file mode 100644 index 928000c3..00000000 --- a/dist/lib/espree.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -declare function _default(): (Parser: import('acorn-jsx').AcornJsxParser) => typeof EspreeParser; -export default _default; -export class EspreeParser extends acorn.Parser { - /** - * Adapted parser for Espree. - * @param {import('../espree').ParserOptions | null} opts Espree options - * @param {string | object} code The source code - */ - constructor(opts: import('../espree').ParserOptions | null, code: string | object); - /** - * Returns Espree tokens. - * @returns {import('../espree').EspreeTokens | null} Espree tokens - */ - tokenize(): import('../espree').EspreeTokens | null; - /** - * Parses. - * @returns {{sourceType?: "script" | "module" | "commonjs"; comments?: EsprimaComment[]; tokens?: import('./token-translator').EsprimaToken[]; body: import('acorn').Node[]} & import('acorn').Node} The program Node - */ - parse(): { - sourceType?: "script" | "module" | "commonjs"; - comments?: EsprimaComment[]; - tokens?: import('./token-translator').EsprimaToken[]; - body: import('acorn').Node[]; - } & import('acorn').Node; - /** - * Overwrites the default raise method to throw Esprima-style errors. - * @param {number} pos The position of the error. - * @param {string} message The error message. - * @throws {EnhancedSyntaxError} A syntax error. - * @returns {void} - */ - raiseRecoverable(pos: number, message: string): void; - /** - * 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. - * @param {number} quote A character code - * @returns {void} - */ - jsx_readString(quote: number): void; -} -export type EnhancedSyntaxError = { - index?: number; - lineNumber?: number; - column?: number; -} & SyntaxError; -export type EnhancedTokTypes = { - jsxAttrValueToken?: import('acorn').TokenType; -} & import('acorn-jsx').TokTypes; -export type EsprimaComment = { - type: string; - value: string; - range?: [number, number]; - start?: number; - end?: number; - loc?: { - start: import('acorn').Position | undefined; - end: import('acorn').Position | undefined; - }; -}; -import * as acorn from "acorn"; -//# sourceMappingURL=espree.d.ts.map \ No newline at end of file diff --git a/dist/lib/espree.d.ts.map b/dist/lib/espree.d.ts.map deleted file mode 100644 index 21d9c88d..00000000 --- a/dist/lib/espree.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"espree.d.ts","sourceRoot":"","sources":["../../tmp/lib/espree.js"],"names":[],"mappings":"AAoDe,sCAIA,OAAO,WAAW,EAAE,cAAc,KAChC,mBAAmB,CA+QnC;;AACD;IAEY;;;;OAIG;IACH,kBAHW,OAAO,WAAW,EAAE,aAAa,GAAG,IAAI,QACxC,MAAM,GAAG,MAAM,EAIjC;IAEO;;;OAGG;IACH,YAFa,OAAO,WAAW,EAAE,YAAY,GAAG,IAAI,CAI3D;IAwBO;;;OAGG;IACH,SAFa;QAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;QAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,oBAAoB,EAAE,YAAY,EAAE,CAAC;QAAC,IAAI,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,CAAA;KAAC,GAAG,OAAO,OAAO,EAAE,IAAI,CAI3M;IAsBO;;;;;;OAMG;IACH,sBALW,MAAM,WACN,MAAM,GAEJ,IAAI,CAIxB;IAYO;;;;;;;;OAQG;IACH,sBAHW,MAAM,GACJ,IAAI,CAIxB;CACJ;kCA7aY;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,WAAW;+BAIpE;IAAC,iBAAiB,CAAC,EAAE,OAAO,OAAO,EAAE,SAAS,CAAA;CAAC,GAAG,OAAO,WAAW,EAAE,QAAQ;6BAI9E;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE;QAAC,KAAK,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;QAAC,GAAG,EAAE,OAAO,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAA;KAAC,CAAA;CAAC"} \ No newline at end of file diff --git a/dist/lib/token-translator.d.ts.map b/dist/lib/token-translator.d.ts.map deleted file mode 100644 index 99d979f3..00000000 --- a/dist/lib/token-translator.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"token-translator.d.ts","sourceRoot":"","sources":["../../tmp/lib/token-translator.js"],"names":[],"mappings":";2BAkBa;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,OAAO,EAAE,cAAc,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAA;CAAC;AAiDlL;IAEI;;;;;OAKG;IACH,2BAJW,OAAO,UAAU,EAAE,gBAAgB,QACnC,MAAM,EAQhB;IAJG,oDAAmC;IAC3B,sCAAsC,CAAC,SAA5B,OAAO,OAAO,EAAE,KAAK,EAAE,CAAsB;IAChE,0CAAuB;IACvB,cAAiB;IAGrB;;;;;;;OAOG;IACH,iBAJW,OAAO,OAAO,EAAE,KAAK,SACrB;QAAC,iBAAiB,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,WAAW,EAAE,WAAW,CAAA;KAAC,GACxE,YAAY,CAkDxB;IAED;;;;;OAKG;IACH,eAJW,OAAO,OAAO,EAAE,KAAK;gBACZ,YAAY,EAAE;;2BAAwB,OAAO;qBAAe,OAAO,WAAW,EAAE,WAAW;QAClG,IAAI,CAyDhB;CACJ"} \ No newline at end of file From 5d69eef7fffe1f628310744b0cc2b83366688107 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 12 May 2022 20:52:01 +0800 Subject: [PATCH 22/24] refactor: add `allowSyntheticDefaultImports: true` per latest acorn-jsx PR --- tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tsconfig.json b/tsconfig.json index fd102ce3..df1b84f4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "noEmit": false, "declaration": true, "declarationMap": true, + "allowSyntheticDefaultImports": true, "emitDeclarationOnly": true, "strict": true, "target": "es5", From 84cc0eda046f09909d7218f7a9f5afc559cd6313 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Sun, 15 May 2022 12:09:05 +0800 Subject: [PATCH 23/24] refactor: update types per latest acorn-jsx PR; remove unused local typedef --- espree.js | 1 - lib/espree.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/espree.js b/espree.js index db4f0452..35b49250 100644 --- a/espree.js +++ b/espree.js @@ -114,7 +114,6 @@ /** * @local * @typedef {import('acorn')} acorn - * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser * @typedef {import('./lib/espree').EnhancedSyntaxError} EnhancedSyntaxError * @typedef {typeof import('./lib/espree').EspreeParser} IEspreeParser */ diff --git a/lib/espree.js b/lib/espree.js index 2d160f07..425e8025 100644 --- a/lib/espree.js +++ b/lib/espree.js @@ -30,7 +30,7 @@ const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); * @local * @typedef {import('acorn')} acorn * @typedef {import('acorn-jsx').TokTypes} tokTypesType - * @typedef {import('acorn-jsx').AcornJsxParser} AcornJsxParser + * @typedef {import('acorn-jsx').AcornJsxParserCtor} AcornJsxParserCtor * @typedef {import('../espree').ParserOptions} ParserOptions * @typedef {import('../espree').ecmaVersion} ecmaVersion */ @@ -161,7 +161,7 @@ export default () => { /** * Returns the Espree parser. - * @param {AcornJsxParser} Parser The Acorn parser + * @param {AcornJsxParserCtor} Parser The Acorn parser * @returns {typeof EspreeParser} The Espree parser */ return Parser => { From 86f5690506192133a7daef39f241936325b3962f Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 19 May 2022 15:41:19 +0800 Subject: [PATCH 24/24] chore: update devDeps. --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index e2cb0408..bc401429 100644 --- a/package.json +++ b/package.json @@ -39,17 +39,17 @@ "devDependencies": { "@es-joy/escodegen": "^3.5.1", "@es-joy/js2ts-assistant": "^0.2.0", - "@es-joy/jsdoc-eslint-parser": "^0.16.0", - "@es-joy/jsdoccomment": "^0.29.0", + "@es-joy/jsdoc-eslint-parser": "^0.17.0", + "@es-joy/jsdoccomment": "^0.30.0", "@rollup/plugin-commonjs": "^17.1.0", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^11.2.0", "ast-types": "^0.14.2", - "c8": "^7.11.2", + "c8": "^7.11.3", "chai": "^4.3.6", - "eslint": "^8.14.0", + "eslint": "^8.15.0", "eslint-config-eslint": "^7.0.0", - "eslint-plugin-jsdoc": "^39.2.9", + "eslint-plugin-jsdoc": "^39.3.0", "eslint-plugin-node": "^11.1.0", "eslint-release": "^3.2.0", "esprima-fb": "^8001.2001.0-dev-harmony-fb", @@ -59,7 +59,7 @@ "npm-run-all": "^4.1.5", "rollup": "^2.41.2", "shelljs": "^0.3.0", - "typescript": "^4.6.3" + "typescript": "^4.6.4" }, "keywords": [ "ast",