UNPKG

@uni-ku/bundle-optimizer

Version:
1 lines 934 kB
{"version":3,"file":"index.mjs","names":["levels: LogLevel[]","process","name","matches","bodyNode","node","parse","arrowExpression","result","left","type","expr","startLoc","init","isPrivate","next","defaultExports: ExportDefaultDeclaration[]","imports: Array<{\n path: unknown\n node: CallExpression\n isStatic: boolean\n }>","result: Record<string, unknown>","name","name","Buffer","Buffer","base64url","base64url","path","alias: Alias[]","vitePathResolver: ((source: string, relative?: boolean) => string) | null","process","process","obj: Record<string, unknown> | undefined","res: any","path","oObj: Record<string, unknown>","process","platform","subPkgsInfo: ISubPkgsInfo[]","moduleIdProcessor","_moduleIdProcessor","name","mergedManualChunks: ManualChunksOption","result: string[]","getRelated","mainFlag: false | string","parse","process","SubPackagesOptimization","AsyncImportProcessor","AsyncComponentProcessor"],"sources":["../package.json","../src/common/Logger.ts","../src/common/ParseOptions.ts","../src/constants.ts","../node_modules/.pnpm/@babel+parser@7.28.5/node_modules/@babel/parser/lib/index.js","../node_modules/.pnpm/ast-kit@2.2.0/node_modules/ast-kit/dist/index.js","../src/utils/ast/common.ts","../src/utils/ast/constant.ts","../src/utils/ast/component-placeholder.ts","../src/utils/ast/macro.ts","../src/utils/uniapp/common.ts","../src/utils/base64url/pad-string.ts","../src/utils/base64url/index.ts","../src/utils/uniapp/virtual.ts","../src/utils/vite/path-resolver.ts","../src/utils/vue/parseSFC.ts","../src/utils/index.ts","../src/plugin/async-component-processor.ts","../src/plugin/async-import-processor.ts","../src/plugin/subpackages-optimization.ts","../src/index.ts"],"sourcesContent":["","/* eslint-disable no-console */\nimport chalk from 'chalk'\n\nenum LogLevel {\n DEBUG = 'DEBUG',\n INFO = 'INFO',\n WARN = 'WARN',\n ERROR = 'ERROR',\n}\n\nexport class Logger {\n private level: LogLevel\n private context: string\n /** TODO: 可以使用其他的 debug 日志库 */\n private Debugger = null\n /** 全局兜底:是否是隐式log */\n private isImplicit: boolean\n public onLog?: (context: string, level: `${LogLevel}`, message: string, timestamp: number) => void\n\n constructor(level: LogLevel = LogLevel.INFO, context: string = 'Plugin', isImplicit = false) {\n this.level = level\n this.context = context\n this.isImplicit = isImplicit\n }\n\n private log(level: LogLevel, message: string, isImplicit?: boolean) {\n if (this.shouldLog(level)) {\n const coloredMessage = this.getColoredMessage(level, message)\n this.onLog?.(this.context, level, message, Date.now())\n if (isImplicit ?? this.isImplicit) {\n // TODO: 相关的隐式log,需要通过外部环境变量启用\n // 此处暂时不显示\n }\n else {\n const c = 69\n const colorCode = `\\u001B[3${c < 8 ? c : `8;5;${c}`};1m`\n console.log(` ${chalk(`${colorCode}${this.context}`)} ${coloredMessage}`)\n }\n }\n }\n\n private shouldLog(level: LogLevel): boolean {\n const levels: LogLevel[] = [LogLevel.DEBUG, LogLevel.INFO, LogLevel.WARN, LogLevel.ERROR]\n return levels.indexOf(level) >= levels.indexOf(this.level)\n }\n\n private getColoredMessage(level: LogLevel, message: string): string {\n switch (level) {\n case LogLevel.DEBUG:\n return chalk.blue(`[${level}] ${message}`)\n case LogLevel.INFO:\n return chalk.green(`[${level}] ${message}`)\n case LogLevel.WARN:\n return chalk.yellow(`[${level}] ${message}`)\n case LogLevel.ERROR:\n return chalk.red(`[${level}] ${message}`)\n default:\n return message\n }\n }\n\n debug(message: string, isImplicit?: boolean) {\n this.log(LogLevel.DEBUG, message, isImplicit)\n }\n\n info(message: string, isImplicit?: boolean) {\n this.log(LogLevel.INFO, message, isImplicit)\n }\n\n warn(message: string, isImplicit?: boolean) {\n this.log(LogLevel.WARN, message, isImplicit)\n }\n\n error(message: string, isImplicit?: boolean) {\n this.log(LogLevel.ERROR, message, isImplicit)\n }\n}\n\nexport const logger = new Logger(LogLevel.INFO, 'uni-ku:bundle-optimizer')\n","import type { Enable, IOptions } from '../type'\n\nexport class ParseOptions {\n options: IOptions\n\n constructor(options: IOptions) {\n this.options = options\n }\n\n get enable() {\n const { enable: origin = true } = this.options\n\n return typeof origin === 'boolean'\n ? {\n 'optimization': origin,\n 'async-component': origin,\n 'async-import': origin,\n }\n : {\n 'optimization': origin.optimization ?? true,\n 'async-component': origin['async-component'] ?? true,\n 'async-import': origin['async-import'] ?? true,\n }\n }\n\n get logger() {\n const { logger: origin = false } = this.options\n const _ = ['optimization', 'async-component', 'async-import']\n const temp = typeof origin === 'boolean'\n ? origin ? _ : false\n : origin\n\n return Object.fromEntries(_.map(item => [item, (temp || []).includes(item)])) as Record<Enable, boolean>\n }\n}\n","import process from 'node:process'\nimport { diffStrings } from './utils'\n\n/**\n * `js`|`jsx`|`ts`|`uts`|`tsx`|`mjs`|`json`\n * @description json 文件会被处理成 js 模块\n */\nexport const EXTNAME_JS_RE = /\\.(js|jsx|ts|uts|tsx|mjs|json)$/\nexport const JS_TYPES_RE = /\\.(?:j|t)sx?$|\\.mjs$/\n\nexport const knownJsSrcRE\n = /\\.(?:[jt]sx?|m[jt]s|vue|marko|svelte|astro|imba|mdx)(?:$|\\?)/\n\nexport const CSS_LANGS_RE\n = /\\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\\?)/\n\n/** `assets` 或者 `./assets` 开头的文件夹 */\nexport const ASSETS_DIR_RE = /^(\\.?\\/)?assets\\//\n\n/** `src` 或者 `./src` 开头的文件夹 */\nexport const SRC_DIR_RE = /^(\\.?\\/)?src\\//\n\n/** 文件后缀 */\nexport const EXT_RE = /\\.\\w+$/\n\nexport function isCSSRequest(request: string): boolean {\n return CSS_LANGS_RE.test(request)\n}\n\n/**\n * 项目根路径\n *\n * // TODO: 后续自实现项目根路径的查找\n */\nexport const ROOT_DIR = process.env.VITE_ROOT_DIR!\nif (!ROOT_DIR) {\n throw new Error('`ROOT_DIR` is not defined')\n}\n\n/**\n * Uniapp 业务源码入口\n */\nexport const UNI_INPUT_DIR = process.env.UNI_INPUT_DIR!\nif (!UNI_INPUT_DIR) {\n throw new Error('`UNI_INPUT_DIR` is not defined')\n}\n\n// UNI_INPUT_DIR 必须包含于 ROOT_DIR\nif (!(`${UNI_INPUT_DIR}/`).startsWith(ROOT_DIR)) {\n throw new Error('`UNI_INPUT_DIR` need startsWith `ROOT_DIR`')\n}\n\n/**\n * Uniapp 输出目录\n */\nexport const UNI_OUTPUT_DIR = process.env.UNI_OUTPUT_DIR!\nif (!UNI_OUTPUT_DIR) {\n throw new Error('`UNI_OUTPUT_DIR` is not defined')\n}\n\nconst pathDiff = diffStrings(ROOT_DIR, UNI_INPUT_DIR)\n/**\n * uniapp 业务源码路径与项目根路径的差异\n */\nexport const UNI_SRC_DIFF_PATH = !pathDiff.diffA && !pathDiff.suffix && pathDiff.prefix === ROOT_DIR ? pathDiff.diffB : ''\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nfunction _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (-1 !== e.indexOf(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nclass Position {\n constructor(line, col, index) {\n this.line = void 0;\n this.column = void 0;\n this.index = void 0;\n this.line = line;\n this.column = col;\n this.index = index;\n }\n}\nclass SourceLocation {\n constructor(start, end) {\n this.start = void 0;\n this.end = void 0;\n this.filename = void 0;\n this.identifierName = void 0;\n this.start = start;\n this.end = end;\n }\n}\nfunction createPositionWithColumnOffset(position, columnOffset) {\n const {\n line,\n column,\n index\n } = position;\n return new Position(line, column + columnOffset, index + columnOffset);\n}\nconst code = \"BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED\";\nvar ModuleErrors = {\n ImportMetaOutsideModule: {\n message: `import.meta may appear only with 'sourceType: \"module\"'`,\n code\n },\n ImportOutsideModule: {\n message: `'import' and 'export' may appear only with 'sourceType: \"module\"'`,\n code\n }\n};\nconst NodeDescriptions = {\n ArrayPattern: \"array destructuring pattern\",\n AssignmentExpression: \"assignment expression\",\n AssignmentPattern: \"assignment expression\",\n ArrowFunctionExpression: \"arrow function expression\",\n ConditionalExpression: \"conditional expression\",\n CatchClause: \"catch clause\",\n ForOfStatement: \"for-of statement\",\n ForInStatement: \"for-in statement\",\n ForStatement: \"for-loop\",\n FormalParameters: \"function parameter list\",\n Identifier: \"identifier\",\n ImportSpecifier: \"import specifier\",\n ImportDefaultSpecifier: \"import default specifier\",\n ImportNamespaceSpecifier: \"import namespace specifier\",\n ObjectPattern: \"object destructuring pattern\",\n ParenthesizedExpression: \"parenthesized expression\",\n RestElement: \"rest element\",\n UpdateExpression: {\n true: \"prefix operation\",\n false: \"postfix operation\"\n },\n VariableDeclarator: \"variable declaration\",\n YieldExpression: \"yield expression\"\n};\nconst toNodeDescription = node => node.type === \"UpdateExpression\" ? NodeDescriptions.UpdateExpression[`${node.prefix}`] : NodeDescriptions[node.type];\nvar StandardErrors = {\n AccessorIsGenerator: ({\n kind\n }) => `A ${kind}ter cannot be a generator.`,\n ArgumentsInClass: \"'arguments' is only allowed in functions and class methods.\",\n AsyncFunctionInSingleStatementContext: \"Async functions can only be declared at the top level or inside a block.\",\n AwaitBindingIdentifier: \"Can not use 'await' as identifier inside an async function.\",\n AwaitBindingIdentifierInStaticBlock: \"Can not use 'await' as identifier inside a static block.\",\n AwaitExpressionFormalParameter: \"'await' is not allowed in async function parameters.\",\n AwaitUsingNotInAsyncContext: \"'await using' is only allowed within async functions and at the top levels of modules.\",\n AwaitNotInAsyncContext: \"'await' is only allowed within async functions and at the top levels of modules.\",\n BadGetterArity: \"A 'get' accessor must not have any formal parameters.\",\n BadSetterArity: \"A 'set' accessor must have exactly one formal parameter.\",\n BadSetterRestParameter: \"A 'set' accessor function argument must not be a rest parameter.\",\n ConstructorClassField: \"Classes may not have a field named 'constructor'.\",\n ConstructorClassPrivateField: \"Classes may not have a private field named '#constructor'.\",\n ConstructorIsAccessor: \"Class constructor may not be an accessor.\",\n ConstructorIsAsync: \"Constructor can't be an async function.\",\n ConstructorIsGenerator: \"Constructor can't be a generator.\",\n DeclarationMissingInitializer: ({\n kind\n }) => `Missing initializer in ${kind} declaration.`,\n DecoratorArgumentsOutsideParentheses: \"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.\",\n DecoratorBeforeExport: \"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.\",\n DecoratorsBeforeAfterExport: \"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.\",\n DecoratorConstructor: \"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?\",\n DecoratorExportClass: \"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.\",\n DecoratorSemicolon: \"Decorators must not be followed by a semicolon.\",\n DecoratorStaticBlock: \"Decorators can't be used with a static block.\",\n DeferImportRequiresNamespace: 'Only `import defer * as x from \"./module\"` is valid.',\n DeletePrivateField: \"Deleting a private field is not allowed.\",\n DestructureNamedImport: \"ES2015 named imports do not destructure. Use another statement for destructuring after the import.\",\n DuplicateConstructor: \"Duplicate constructor in the same class.\",\n DuplicateDefaultExport: \"Only one default export allowed per module.\",\n DuplicateExport: ({\n exportName\n }) => `\\`${exportName}\\` has already been exported. Exported identifiers must be unique.`,\n DuplicateProto: \"Redefinition of __proto__ property.\",\n DuplicateRegExpFlags: \"Duplicate regular expression flag.\",\n ElementAfterRest: \"Rest element must be last element.\",\n EscapedCharNotAnIdentifier: \"Invalid Unicode escape.\",\n ExportBindingIsString: ({\n localName,\n exportName\n }) => `A string literal cannot be used as an exported binding without \\`from\\`.\\n- Did you mean \\`export { '${localName}' as '${exportName}' } from 'some-module'\\`?`,\n ExportDefaultFromAsIdentifier: \"'from' is not allowed as an identifier after 'export default'.\",\n ForInOfLoopInitializer: ({\n type\n }) => `'${type === \"ForInStatement\" ? \"for-in\" : \"for-of\"}' loop variable declaration may not have an initializer.`,\n ForInUsing: \"For-in loop may not start with 'using' declaration.\",\n ForOfAsync: \"The left-hand side of a for-of loop may not be 'async'.\",\n ForOfLet: \"The left-hand side of a for-of loop may not start with 'let'.\",\n GeneratorInSingleStatementContext: \"Generators can only be declared at the top level or inside a block.\",\n IllegalBreakContinue: ({\n type\n }) => `Unsyntactic ${type === \"BreakStatement\" ? \"break\" : \"continue\"}.`,\n IllegalLanguageModeDirective: \"Illegal 'use strict' directive in function with non-simple parameter list.\",\n IllegalReturn: \"'return' outside of function.\",\n ImportAttributesUseAssert: \"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.\",\n ImportBindingIsString: ({\n importName\n }) => `A string literal cannot be used as an imported binding.\\n- Did you mean \\`import { \"${importName}\" as foo }\\`?`,\n ImportCallArity: `\\`import()\\` requires exactly one or two arguments.`,\n ImportCallNotNewExpression: \"Cannot use new with import(...).\",\n ImportCallSpreadArgument: \"`...` is not allowed in `import()`.\",\n ImportJSONBindingNotDefault: \"A JSON module can only be imported with `default`.\",\n ImportReflectionHasAssertion: \"`import module x` cannot have assertions.\",\n ImportReflectionNotBinding: 'Only `import module x from \"./module\"` is valid.',\n IncompatibleRegExpUVFlags: \"The 'u' and 'v' regular expression flags cannot be enabled at the same time.\",\n InvalidBigIntLiteral: \"Invalid BigIntLiteral.\",\n InvalidCodePoint: \"Code point out of bounds.\",\n InvalidCoverDiscardElement: \"'void' must be followed by an expression when not used in a binding position.\",\n InvalidCoverInitializedName: \"Invalid shorthand property initializer.\",\n InvalidDecimal: \"Invalid decimal.\",\n InvalidDigit: ({\n radix\n }) => `Expected number in radix ${radix}.`,\n InvalidEscapeSequence: \"Bad character escape sequence.\",\n InvalidEscapeSequenceTemplate: \"Invalid escape sequence in template.\",\n InvalidEscapedReservedWord: ({\n reservedWord\n }) => `Escape sequence in keyword ${reservedWord}.`,\n InvalidIdentifier: ({\n identifierName\n }) => `Invalid identifier ${identifierName}.`,\n InvalidLhs: ({\n ancestor\n }) => `Invalid left-hand side in ${toNodeDescription(ancestor)}.`,\n InvalidLhsBinding: ({\n ancestor\n }) => `Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`,\n InvalidLhsOptionalChaining: ({\n ancestor\n }) => `Invalid optional chaining in the left-hand side of ${toNodeDescription(ancestor)}.`,\n InvalidNumber: \"Invalid number.\",\n InvalidOrMissingExponent: \"Floating-point numbers require a valid exponent after the 'e'.\",\n InvalidOrUnexpectedToken: ({\n unexpected\n }) => `Unexpected character '${unexpected}'.`,\n InvalidParenthesizedAssignment: \"Invalid parenthesized assignment pattern.\",\n InvalidPrivateFieldResolution: ({\n identifierName\n }) => `Private name #${identifierName} is not defined.`,\n InvalidPropertyBindingPattern: \"Binding member expression.\",\n InvalidRecordProperty: \"Only properties and spread elements are allowed in record definitions.\",\n InvalidRestAssignmentPattern: \"Invalid rest operator's argument.\",\n LabelRedeclaration: ({\n labelName\n }) => `Label '${labelName}' is already declared.`,\n LetInLexicalBinding: \"'let' is disallowed as a lexically bound name.\",\n LineTerminatorBeforeArrow: \"No line break is allowed before '=>'.\",\n MalformedRegExpFlags: \"Invalid regular expression flag.\",\n MissingClassName: \"A class name is required.\",\n MissingEqInAssignment: \"Only '=' operator can be used for specifying default value.\",\n MissingSemicolon: \"Missing semicolon.\",\n MissingPlugin: ({\n missingPlugin\n }) => `This experimental syntax requires enabling the parser plugin: ${missingPlugin.map(name => JSON.stringify(name)).join(\", \")}.`,\n MissingOneOfPlugins: ({\n missingPlugin\n }) => `This experimental syntax requires enabling one of the following parser plugin(s): ${missingPlugin.map(name => JSON.stringify(name)).join(\", \")}.`,\n MissingUnicodeEscape: \"Expecting Unicode escape sequence \\\\uXXXX.\",\n MixingCoalesceWithLogical: \"Nullish coalescing operator(??) requires parens when mixing with logical operators.\",\n ModuleAttributeDifferentFromType: \"The only accepted module attribute is `type`.\",\n ModuleAttributeInvalidValue: \"Only string literals are allowed as module attribute values.\",\n ModuleAttributesWithDuplicateKeys: ({\n key\n }) => `Duplicate key \"${key}\" is not allowed in module attributes.`,\n ModuleExportNameHasLoneSurrogate: ({\n surrogateCharCode\n }) => `An export name cannot include a lone surrogate, found '\\\\u${surrogateCharCode.toString(16)}'.`,\n ModuleExportUndefined: ({\n localName\n }) => `Export '${localName}' is not defined.`,\n MultipleDefaultsInSwitch: \"Multiple default clauses.\",\n NewlineAfterThrow: \"Illegal newline after throw.\",\n NoCatchOrFinally: \"Missing catch or finally clause.\",\n NumberIdentifier: \"Identifier directly after number.\",\n NumericSeparatorInEscapeSequence: \"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.\",\n ObsoleteAwaitStar: \"'await*' has been removed from the async functions proposal. Use Promise.all() instead.\",\n OptionalChainingNoNew: \"Constructors in/after an Optional Chain are not allowed.\",\n OptionalChainingNoTemplate: \"Tagged Template Literals are not allowed in optionalChain.\",\n OverrideOnConstructor: \"'override' modifier cannot appear on a constructor declaration.\",\n ParamDupe: \"Argument name clash.\",\n PatternHasAccessor: \"Object pattern can't contain getter or setter.\",\n PatternHasMethod: \"Object pattern can't contain methods.\",\n PrivateInExpectedIn: ({\n identifierName\n }) => `Private names are only allowed in property accesses (\\`obj.#${identifierName}\\`) or in \\`in\\` expressions (\\`#${identifierName} in obj\\`).`,\n PrivateNameRedeclaration: ({\n identifierName\n }) => `Duplicate private name #${identifierName}.`,\n RecordExpressionBarIncorrectEndSyntaxType: \"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.\",\n RecordExpressionBarIncorrectStartSyntaxType: \"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.\",\n RecordExpressionHashIncorrectStartSyntaxType: \"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.\",\n RecordNoProto: \"'__proto__' is not allowed in Record expressions.\",\n RestTrailingComma: \"Unexpected trailing comma after rest element.\",\n SloppyFunction: \"In non-strict mode code, functions can only be declared at top level or inside a block.\",\n SloppyFunctionAnnexB: \"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.\",\n SourcePhaseImportRequiresDefault: 'Only `import source x from \"./module\"` is valid.',\n StaticPrototype: \"Classes may not have static property named prototype.\",\n SuperNotAllowed: \"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?\",\n SuperPrivateField: \"Private fields can't be accessed on super.\",\n TrailingDecorator: \"Decorators must be attached to a class element.\",\n TupleExpressionBarIncorrectEndSyntaxType: \"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.\",\n TupleExpressionBarIncorrectStartSyntaxType: \"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.\",\n TupleExpressionHashIncorrectStartSyntaxType: \"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.\",\n UnexpectedArgumentPlaceholder: \"Unexpected argument placeholder.\",\n UnexpectedAwaitAfterPipelineBody: 'Unexpected \"await\" after pipeline body; await must have parentheses in minimal proposal.',\n UnexpectedDigitAfterHash: \"Unexpected digit after hash token.\",\n UnexpectedImportExport: \"'import' and 'export' may only appear at the top level.\",\n UnexpectedKeyword: ({\n keyword\n }) => `Unexpected keyword '${keyword}'.`,\n UnexpectedLeadingDecorator: \"Leading decorators must be attached to a class declaration.\",\n UnexpectedLexicalDeclaration: \"Lexical declaration cannot appear in a single-statement context.\",\n UnexpectedNewTarget: \"`new.target` can only be used in functions or class properties.\",\n UnexpectedNumericSeparator: \"A numeric separator is only allowed between two digits.\",\n UnexpectedPrivateField: \"Unexpected private name.\",\n UnexpectedReservedWord: ({\n reservedWord\n }) => `Unexpected reserved word '${reservedWord}'.`,\n UnexpectedSuper: \"'super' is only allowed in object methods and classes.\",\n UnexpectedToken: ({\n expected,\n unexpected\n }) => `Unexpected token${unexpected ? ` '${unexpected}'.` : \"\"}${expected ? `, expected \"${expected}\"` : \"\"}`,\n UnexpectedTokenUnaryExponentiation: \"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.\",\n UnexpectedUsingDeclaration: \"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.\",\n UnexpectedVoidPattern: \"Unexpected void binding.\",\n UnsupportedBind: \"Binding should be performed on object property.\",\n UnsupportedDecoratorExport: \"A decorated export must export a class declaration.\",\n UnsupportedDefaultExport: \"Only expressions, functions or classes are allowed as the `default` export.\",\n UnsupportedImport: \"`import` can only be used in `import()` or `import.meta`.\",\n UnsupportedMetaProperty: ({\n target,\n onlyValidPropertyName\n }) => `The only valid meta property for ${target} is ${target}.${onlyValidPropertyName}.`,\n UnsupportedParameterDecorator: \"Decorators cannot be used to decorate parameters.\",\n UnsupportedPropertyDecorator: \"Decorators cannot be used to decorate object literal properties.\",\n UnsupportedSuper: \"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).\",\n UnterminatedComment: \"Unterminated comment.\",\n UnterminatedRegExp: \"Unterminated regular expression.\",\n UnterminatedString: \"Unterminated string constant.\",\n UnterminatedTemplate: \"Unterminated template.\",\n UsingDeclarationExport: \"Using declaration cannot be exported.\",\n UsingDeclarationHasBindingPattern: \"Using declaration cannot have destructuring patterns.\",\n VarRedeclaration: ({\n identifierName\n }) => `Identifier '${identifierName}' has already been declared.`,\n VoidPatternCatchClauseParam: \"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.\",\n VoidPatternInitializer: \"A void binding may not have an initializer.\",\n YieldBindingIdentifier: \"Can not use 'yield' as identifier inside a generator.\",\n YieldInParameter: \"Yield expression is not allowed in formal parameters.\",\n YieldNotInGeneratorFunction: \"'yield' is only allowed within generator functions.\",\n ZeroDigitNumericSeparator: \"Numeric separator can not be used after leading 0.\"\n};\nvar StrictModeErrors = {\n StrictDelete: \"Deleting local variable in strict mode.\",\n StrictEvalArguments: ({\n referenceName\n }) => `Assigning to '${referenceName}' in strict mode.`,\n StrictEvalArgumentsBinding: ({\n bindingName\n }) => `Binding '${bindingName}' in strict mode.`,\n StrictFunction: \"In strict mode code, functions can only be declared at top level or inside a block.\",\n StrictNumericEscape: \"The only valid numeric escape in strict mode is '\\\\0'.\",\n StrictOctalLiteral: \"Legacy octal literals are not allowed in strict mode.\",\n StrictWith: \"'with' in strict mode.\"\n};\nvar ParseExpressionErrors = {\n ParseExpressionEmptyInput: \"Unexpected parseExpression() input: The input is empty or contains only comments.\",\n ParseExpressionExpectsEOF: ({\n unexpected\n }) => `Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \\`${String.fromCodePoint(unexpected)}\\`.`\n};\nconst UnparenthesizedPipeBodyDescriptions = new Set([\"ArrowFunctionExpression\", \"AssignmentExpression\", \"ConditionalExpression\", \"YieldExpression\"]);\nvar PipelineOperatorErrors = Object.assign({\n PipeBodyIsTighter: \"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.\",\n PipeTopicRequiresHackPipes: 'Topic reference is used, but the pipelineOperator plugin was not passed a \"proposal\": \"hack\" or \"smart\" option.',\n PipeTopicUnbound: \"Topic reference is unbound; it must be inside a pipe body.\",\n PipeTopicUnconfiguredToken: ({\n token\n }) => `Invalid topic token ${token}. In order to use ${token} as a topic reference, the pipelineOperator plugin must be configured with { \"proposal\": \"hack\", \"topicToken\": \"${token}\" }.`,\n PipeTopicUnused: \"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.\",\n PipeUnparenthesizedBody: ({\n type\n }) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({\n type\n })}; please wrap it in parentheses.`\n}, {\n PipelineBodyNoArrow: 'Unexpected arrow \"=>\" after pipeline body; arrow function in pipeline body must be parenthesized.',\n PipelineBodySequenceExpression: \"Pipeline body may not be a comma-separated sequence expression.\",\n PipelineHeadSequenceExpression: \"Pipeline head should not be a comma-separated sequence expression.\",\n PipelineTopicUnused: \"Pipeline is in topic style but does not use topic reference.\",\n PrimaryTopicNotAllowed: \"Topic reference was used in a lexical context without topic binding.\",\n PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a \"proposal\": \"hack\" or \"smart\" option.'\n});\nconst _excluded = [\"message\"];\nfunction defineHidden(obj, key, value) {\n Object.defineProperty(obj, key, {\n enumerable: false,\n configurable: true,\n value\n });\n}\nfunction toParseErrorConstructor({\n toMessage,\n code,\n reasonCode,\n syntaxPlugin\n}) {\n const hasMissingPlugin = reasonCode === \"MissingPlugin\" || reasonCode === \"MissingOneOfPlugins\";\n {\n const oldReasonCodes = {\n AccessorCannotDeclareThisParameter: \"AccesorCannotDeclareThisParameter\",\n AccessorCannotHaveTypeParameters: \"AccesorCannotHaveTypeParameters\",\n ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: \"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference\",\n SetAccessorCannotHaveOptionalParameter: \"SetAccesorCannotHaveOptionalParameter\",\n SetAccessorCannotHaveRestParameter: \"SetAccesorCannotHaveRestParameter\",\n SetAccessorCannotHaveReturnType: \"SetAccesorCannotHaveReturnType\"\n };\n if (oldReasonCodes[reasonCode]) {\n reasonCode = oldReasonCodes[reasonCode];\n }\n }\n return function constructor(loc, details) {\n const error = new SyntaxError();\n error.code = code;\n error.reasonCode = reasonCode;\n error.loc = loc;\n error.pos = loc.index;\n error.syntaxPlugin = syntaxPlugin;\n if (hasMissingPlugin) {\n error.missingPlugin = details.missingPlugin;\n }\n defineHidden(error, \"clone\", function clone(overrides = {}) {\n var _overrides$loc;\n const {\n line,\n column,\n index\n } = (_overrides$loc = overrides.loc) != null ? _overrides$loc : loc;\n return constructor(new Position(line, column, index), Object.assign({}, details, overrides.details));\n });\n defineHidden(error, \"details\", details);\n Object.defineProperty(error, \"message\", {\n configurable: true,\n get() {\n const message = `${toMessage(details)} (${loc.line}:${loc.column})`;\n this.message = message;\n return message;\n },\n set(value) {\n Object.defineProperty(this, \"message\", {\n value,\n writable: true\n });\n }\n });\n return error;\n };\n}\nfunction ParseErrorEnum(argument, syntaxPlugin) {\n if (Array.isArray(argument)) {\n return parseErrorTemplates => ParseErrorEnum(parseErrorTemplates, argument[0]);\n }\n const ParseErrorConstructors = {};\n for (const reasonCode of Object.keys(argument)) {\n const template = argument[reasonCode];\n const _ref = typeof template === \"string\" ? {\n message: () => template\n } : typeof template === \"function\" ? {\n message: template\n } : template,\n {\n message\n } = _ref,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n const toMessage = typeof message === \"string\" ? () => message : message;\n ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({\n code: \"BABEL_PARSER_SYNTAX_ERROR\",\n reasonCode,\n toMessage\n }, syntaxPlugin ? {\n syntaxPlugin\n } : {}, rest));\n }\n return ParseErrorConstructors;\n}\nconst Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(ParseExpressionErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));\nfunction createDefaultOptions() {\n return {\n sourceType: \"script\",\n sourceFilename: undefined,\n startIndex: 0,\n startColumn: 0,\n startLine: 1,\n allowAwaitOutsideFunction: false,\n allowReturnOutsideFunction: false,\n allowNewTargetOutsideFunction: false,\n allowImportExportEverywhere: false,\n allowSuperOutsideMethod: false,\n allowUndeclaredExports: false,\n allowYieldOutsideFunction: false,\n plugins: [],\n strictMode: undefined,\n ranges: false,\n tokens: false,\n createImportExpressions: false,\n createParenthesizedExpressions: false,\n errorRecovery: false,\n attachComment: true,\n annexB: true\n };\n}\nfunction getOptions(opts) {\n const options = createDefaultOptions();\n if (opts == null) {\n return options;\n }\n if (opts.annexB != null && opts.annexB !== false) {\n throw new Error(\"The `annexB` option can only be set to `false`.\");\n }\n for (const key of Object.keys(options)) {\n if (opts[key] != null) options[key] = opts[key];\n }\n if (options.startLine === 1) {\n if (opts.startIndex == null && options.startColumn > 0) {\n options.startIndex = options.startColumn;\n } else if (opts.startColumn == null && options.startIndex > 0) {\n options.startColumn = options.startIndex;\n }\n } else if (opts.startColumn == null || opts.startIndex == null) {\n if (opts.startIndex != null) {\n throw new Error(\"With a `startLine > 1` you must also specify `startIndex` and `startColumn`.\");\n }\n }\n if (options.sourceType === \"commonjs\") {\n if (opts.allowAwaitOutsideFunction != null) {\n throw new Error(\"The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.\");\n }\n if (opts.allowReturnOutsideFunction != null) {\n throw new Error(\"`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.\");\n }\n if (opts.allowNewTargetOutsideFunction != null) {\n throw new Error(\"`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.\");\n }\n }\n return options;\n}\nconst {\n defineProperty\n} = Object;\nconst toUnenumerable = (object, key) => {\n if (object) {\n defineProperty(object, key, {\n enumerable: false,\n value: object[key]\n });\n }\n};\nfunction toESTreeLocation(node) {\n toUnenumerable(node.loc.start, \"index\");\n toUnenumerable(node.loc.end, \"index\");\n return node;\n}\nvar estree = superClass => class ESTreeParserMixin extends superClass {\n parse() {\n const file = toESTreeLocation(super.parse());\n if (this.optionFlags & 256) {\n file.tokens = file.tokens.map(toESTreeLocation);\n }\n return file;\n }\n parseRegExpLiteral({\n pattern,\n flags\n }) {\n let regex = null;\n try {\n regex = new RegExp(pattern, flags);\n } catch (_) {}\n const node = this.estreeParseLiteral(regex);\n node.regex = {\n pattern,\n flags\n };\n return node;\n }\n parseBigIntLiteral(value) {\n let bigInt;\n try {\n bigInt = BigInt(value);\n } catch (_unused) {\n bigInt = null;\n }\n const node = this.estreeParseLiteral(bigInt);\n node.bigint = String(node.value || value);\n return node;\n }\n parseDecimalLiteral(value) {\n const decimal = null;\n const node = this.estreeParseLiteral(decimal);\n node.decimal = String(node.value || value);\n return node;\n }\n estreeParseLiteral(value) {\n return this.parseLiteral(value, \"Literal\");\n }\n parseStringLiteral(value) {\n return this.estreeParseLiteral(value);\n }\n parseNumericLiteral(value) {\n return this.estreeParseLiteral(value);\n }\n parseNullLiteral() {\n return this.estreeParseLiteral(null);\n }\n parseBooleanLiteral(value) {\n return this.estreeParseLiteral(value);\n }\n estreeParseChainExpression(node, endLoc) {\n const chain = this.startNodeAtNode(node);\n chain.expression = node;\n return this.finishNodeAt(chain, \"ChainExpression\", endLoc);\n }\n directiveToStmt(directive) {\n const expression = directive.value;\n delete directive.value;\n this.castNodeTo(expression, \"Literal\");\n expression.raw = expression.extra.raw;\n expression.value = expression.extra.expressionValue;\n const stmt = this.castNodeTo(directive, \"ExpressionStatement\");\n stmt.expression = expression;\n stmt.directive = expression.extra.rawValue;\n delete expression.extra;\n return stmt;\n }\n fillOptionalPropertiesForTSESLint(node) {}\n cloneEstreeStringLiteral(node) {\n const {\n start,\n end,\n loc,\n range,\n raw,\n value\n } = node;\n const cloned = Object.create(node.constructor.prototype);\n cloned.type = \"Literal\";\n cloned.start = start;\n cloned.end = end;\n cloned.loc = loc;\n cloned.range = range;\n cloned.raw = raw;\n cloned.value = value;\n return cloned;\n }\n initFunction(node, isAsync) {\n super.initFunction(node, isAsync);\n node.expression = false;\n }\n checkDeclaration(node) {\n if (node != null && this.isObjectProperty(node)) {\n this.checkDeclaration(node.value);\n } else {\n super.checkDeclaration(node);\n }\n }\n getObjectOrClassMethodParams(method) {\n return method.value.params;\n }\n isValidDirective(stmt) {\n var _stmt$expression$extr;\n return stmt.type === \"ExpressionStatement\" && stmt.expression.type === \"Literal\" && typeof stmt.expression.value === \"string\" && !((_stmt$expression$extr = stmt.expression.extra) != null && _stmt$expression$extr.parenthesized);\n }\n parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {\n super.parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse);\n const directiveStatements = node.directives.map(d => this.directiveToStmt(d));\n node.body = directiveStatements.concat(node.body);\n delete node.directives;\n }\n parsePrivateName() {\n const node = super.parsePrivateName();\n {\n if (!this.getPluginOption(\"estree\", \"classFeatures\")) {\n return node;\n }\n }\n return this.convertPrivateNameToPrivateIdentifier(node);\n }\n convertPrivateNameToPrivateIdentifier(node) {\n const name = super.getPrivateNameSV(node);\n delete node.id;\n node.name = name;\n return this.castNodeTo(node, \"PrivateIdentifier\");\n }\n isPrivateName(node) {\n {\n if (!this.getPluginOption(\"estree\", \"classFeatures\")) {\n return super.isPrivateName(node);\n }\n }\n return node.type === \"PrivateIdentifier\";\n }\n getPrivateNameSV(node) {\n {\n if (!this.getPluginOption(\"estree\", \"classFeatures\")) {\n return super.getPrivateNameSV(node);\n }\n }\n return node.name;\n }\n parseLiteral(value, type) {\n const node = super.parseLiteral(value, type);\n node.raw = node.extra.raw;\n delete node.extra;\n return node;\n }\n parseFunctionBody(node, allowExpression, isMethod = false) {\n super.parseFunctionBody(node, allowExpression, isMethod);\n node.expression = node.body.type !== \"BlockStatement\";\n }\n parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {\n let funcNode = this.startNode();\n funcNode.kind = node.kind;\n funcNode = super.parseMethod(funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);\n delete funcNode.kind;\n const {\n typeParameters\n } = node;\n if (typeParameters) {\n delete node.typeParameters;\n funcNode.typeParameters = typeParameters;\n this.resetStartLocationFromNode(funcNode, typeParameters);\n }\n const valueNode = this.castNodeTo(funcNode, \"FunctionExpression\");\n node.value = valueNode;\n if (type === \"ClassPrivateMethod\") {\n node.computed = false;\n }\n if (type === \"ObjectMethod\") {\n if (node.kind === \"method\") {\n node.kind = \"init\";\n }\n node.shorthand = false;\n return this.finishNode(node, \"Property\");\n } else {\n return this.finishNode(node, \"MethodDefinition\");\n }\n }\n nameIsConstructor(key) {\n if (key.type === \"Literal\") return key.value === \"constructor\";\n return super.nameIsConstructor(key);\n }\n parseClassProperty(...args) {\n const propertyNode = super.parseClassProperty(...args);\n {\n if (!this.getPluginOption(\"estree\", \"classFeatures\")) {\n return propertyNode;\n }\n }\n {\n this.castNodeTo(propertyNode, \"PropertyDefinition\");\n }\n return propertyNode;\n }\n parseClassPrivateProperty(...args) {\n const propertyNode = super.parseClassPrivateProperty(...args);\n {\n if (!this.getPluginOption(\"estree\", \"classFeatures\")) {\n return propertyNode;\n }\n }\n {\n this.castNodeTo(propertyNode, \"PropertyDefinition\");\n }\n propertyNode.computed = false;\n return propertyNode;\n }\n parseClassAccessorProperty(node) {\n const accessorPropertyNode = super.parseClassAccessorProperty(node);\n {\n if (!this.getPluginOption(\"estree\", \"classFeatures\")) {\n return accessorPropertyNode;\n }\n }\n if (accessorPropertyNode.abstract && this.hasPlugin(\"typescript\")) {\n delete accessorPropertyNode.abstract;\n this.castNodeTo(accessorPropertyNode, \"TSAbstractAccessorProperty\");\n } else {\n this.castNodeTo(accessorPropertyNode, \"AccessorProperty\");\n }\n return accessorPropertyNode;\n }\n parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) {\n const node = super.parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors);\n if (node) {\n node.kind = \"init\";\n this.castNodeTo(node, \"Property\");\n }\n return node;\n }\n finishObjectProperty(node) {\n node.kind = \"init\";\n return this.finishNode(node, \"Property\");\n }\n isValidLVal(type, disallowCallExpression, isUnparenthesizedInAssign, binding) {\n return type === \"Property\" ? \"value\" : super.isValidLVal(type, disallowCallExpression, isUnparenthesizedInAssign, binding);\n }\n isAssignable(node, isBinding) {\n if (node != null && this.isObjectProperty(node)) {\n return this.isAssignable(node.value, isBinding);\n }\n return super.isAssignable(node, isBinding);\n }\n toAssignable(node, isLHS = false) {\n if (node != null && this.isObjectProperty(node)) {\n const {\n key,\n value\n } = node;\n if (this.isPrivateName(key)) {\n this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start);\n }\n this.toAssignable(value, isLHS);\n } else {\n super.toAssignable(node, isLHS);\n }\n }\n toAssignableObjectExpressionProp(prop, isLast, isLHS) {\n if (prop.type === \"Property\" && (prop.kind === \"get\" || prop.kind === \"set\")) {\n this.raise(Errors.PatternHasAccessor, prop.key);\n } else if (prop.type === \"Property\" && prop.method) {\n this.raise(Errors.PatternHasMethod, prop.key);\n } else {\n super.toAssignableObjectExpressionProp(prop, isLast, isLHS);\n }\n }\n finishCallExpression(unfinished, optional) {\n const node = super.finishCallExpression(unfinished, optional);\n if (node.callee.type === \"Import\") {\n var _ref;\n this.castNodeTo(node, \"ImportExpression\");\n node.source = node.arguments[0];\n node.options = (_ref = node.arguments[1]) != null ? _ref : null;\n {\n var _ref2;\n node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;\n }\n delete node.arguments;\n delete node.callee;\n } else if (node.type === \"OptionalCallExpression\") {\n this.castNodeTo(node, \"CallExpression\");\n } else {\n node.optional = false;\n }\n return node;\n }\n toReferencedArguments(node) {\n if (node.type === \"ImportExpression\") {\n return;\n }\n super.toReferencedArguments(node);\n }\n parseExport(unfinished, decorators) {\n const exportStartLoc = this.state.lastTokStartLoc;\n const node = super.parseExport(unfinished, decorators);\n switch (node.type) {\n case \"ExportAllDeclaration\":\n node.exported = null;\n break;\n case \"ExportNamedDeclaration\":\n if (node.specifiers.length === 1 && node.specifiers[0].type === \"ExportNamespaceSpecifier\") {\n this.castNodeTo(node, \"ExportAllDeclaration\");\n node.exported = node.specifiers[0].exported;\n delete node.specifiers;\n }\n case \"ExportDefaultDeclaration\":\n {\n var _declaration$decorato;\n const {\n declaration\n } = node;\n if ((declaration == null ? void 0 : declaration.type) === \"ClassDeclaration\" && ((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0 && declaration.start === node.start) {\n this.resetStartLocation(node, exportStartLoc);\n }\n }\n break;\n }\n return node;\n }\n stopParseSubscript(base, state) {\n const node = super.stopParseSubscript(base, state);\n if (state.optionalChainMember) {\n return this.estreeParseChainExpression(node, base.loc.end);\n }\n return node;\n }\n parseMember(base, startLoc, state, computed, optional) {\n const node = super.parseMember(base, startLoc, state, computed, optional);\n if (node.type === \"OptionalMemberExpression\") {\n this.castNodeTo(node, \"MemberExpression\");\n } else {\n node.optional = false;\n }\n return node;\n }\n isOptionalMemberExpression(node) {\n if (node.type === \"ChainExpression\") {\n return node.expression.type === \"MemberExpression\";\n }\n return super.isOptionalMemberExpression(node);\n }\n hasPropertyAsPrivateName(node) {\n if (node.type === \"ChainExpression\") {\n node = node.expression;\n }\n return super.hasPropertyAsPrivateName(node);\n }\n isObjectProperty(node) {\n return node.type === \"Property\" && node.kind === \"init\" && !node.method;\n }\n isObjectMethod(node) {\n return node.type === \"Property\" && (node.method || node.kind === \"get\" || node.kind === \"set\");\n }\n castNodeTo(node, type) {\n const result = super.castNodeTo(node, type);\n this.fillOptionalPropertiesForTSESLint(result);\n return result;\n }\n cloneIdentifier(node) {\n const cloned = super.cloneIdentifier(node);\n this.fillOptionalPropertiesForTSESLint(cloned);\n return cloned;\n }\n cloneStringLiteral(node) {\n if (node.type === \"Literal\") {\n return this.cloneEstreeStringLiteral(node);\n }\n return super.cloneStringLiteral(node);\n }\n finishNodeAt(node, type, endLoc) {\n return toESTreeLocation(super.finishNodeAt(node, type, endLoc));\n }\n finishNode(node, type) {\n const result = super.finishNode(node, type);\n this.fillOptionalPropertiesForTSESLint(result);\n return result;\n }\n resetStartLocation(node, startLoc) {\n super.resetStartLocation(node, startLoc);\n toESTreeLocation(node);\n }\n resetEndLocation(node, endLoc = this.state.lastTokEndLoc) {\n super.resetEndLocation(node, endLoc);\n toESTreeLocation(node);\n }\n};\nclass TokContext {\n constructor(token, preserveSpace) {\n this.token = void 0;\n this.preserveSpace = void 0;\n this.token = token;\n this.preserveSpace = !!preserveSpace;\n }\n}\nconst types = {\n brace: new TokContext(\"{\"),\n j_oTag: new TokContext(\"<tag\"),\n j_cTag: new TokContext(\"</tag\"),\n j_expr: new TokContext(\"<tag>...</tag>\", true)\n};\n{\n types.template = new TokContext(\"`\", true);\n}\nconst beforeExpr = true;\nconst startsExpr = true;\nconst isLoop = true;\nconst isAssign = true;\nconst prefix = true;\nconst postfix = true;\nclass ExportedTokenType {\n constructor(label, conf = {}) {\n this.label = void 0;\n this.keyword = void 0;\n this.beforeExpr = void 0;\n this.startsExpr = void 0;\n this.rightAssociative = void 0;\n this.isLoop = void 0;\n this.isAssign = void 0;\n this.prefix = void 0;\n this.postfix = void 0;\n this.binop = void 0;\n this.label = label;\n this.keyword = conf.keyword;\n this.beforeExpr = !!conf.beforeExpr;\n this.startsExpr = !!conf.startsExpr;\n this.rightAssociative = !!conf.rightAssociative;\n this.isLoop = !!conf.isLoop;\n this.isAssign = !!conf.isAssign;\n this.prefix = !!conf.prefix;\n this.postfix = !!conf.postfix;\n this.binop = conf.binop != null ? conf.binop : null;\n {\n this.updateContext = null;\n }\n }\n}\nconst keywords$1 = new Map();\nfunction createKeyword(name, options = {}) {\n options.keyword = name;\n const token = createToken(name, options);\n keywords$1.set(name, token);\n return token;\n}\nfunction createBinop(name, binop) {\n return createToken(name, {\n beforeExpr,\n binop\n });\n}\nlet tokenTypeCounter = -1;\nconst tokenTypes = [];\nconst tokenLabels = [];\nconst tokenBinops = [];\nconst tokenBeforeExprs = [];\nconst tokenStartsExprs = [];\nconst tokenPrefixes = [];\nfunction createToken(name, options = {}) {\n var _options$binop, _options$beforeExpr, _options$startsExpr, _options$prefix;\n ++tokenTypeCounter;\n tokenLabels.push(name);\n tokenBinops.push((_options$binop = options.binop) != null ? _options$binop : -1);\n tokenBeforeExprs.push((_options$beforeExpr = options.beforeExpr) != null ? _options$beforeExpr : false);\n tokenStartsExprs.push((_options$startsExpr = options.startsExpr) != null ? _options$startsExpr : false);\n tokenPrefixes.push((_options$prefix = options.prefix) != null ? _options$prefix : false);\n tokenTypes.push(new ExportedTokenType(name, options));\n return tokenTypeCounter;\n}\nfunction createKeywordLike(name, options = {}) {\n var _options$binop2, _options$beforeExpr2, _options$startsExpr2, _options$prefix2;\n ++tokenTypeCounter;\n keywords$1.set(name, tokenTypeCounter);\n tokenLabels.push(name);\n tokenBinops.push((_options$binop2 = options.binop) != null ? _options$binop2 : -1);\n tokenBeforeExprs.push((_options$beforeExpr2 = options.beforeExpr) != null ? _options$beforeExpr2 : false);\n tokenStartsExprs.push((_options$startsExpr2 = options.startsExpr) != null ? _options$startsExpr2 : false);\n tokenPrefixes.push((_options$prefix2 = options.prefix) != null ? _options$prefix2 : false);\n tokenTypes.push(new ExportedTokenType(\"name\", options));\n return tokenTyp