Socket
Socket
Sign inDemoInstall

@babel/parser

Package Overview
Dependencies
0
Maintainers
4
Versions
193
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.22.7 to 8.0.0-alpha.0

lib/index.cjs

19

lib/options.js

@@ -1,9 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.defaultOptions = void 0;
exports.getOptions = getOptions;
const defaultOptions = {
export const defaultOptions = {
sourceType: "script",

@@ -28,5 +21,7 @@ sourceFilename: undefined,

};
exports.defaultOptions = defaultOptions;
function getOptions(opts) {
if (opts && opts.annexB != null && opts.annexB !== false) {
export function getOptions(opts) {
if (opts == null) {
return Object.assign({}, defaultOptions);
}
if (opts.annexB != null && opts.annexB !== false) {
throw new Error("The `annexB` option can only be set to `false`.");

@@ -36,3 +31,3 @@ }

for (const key of Object.keys(defaultOptions)) {
options[key] = opts && opts[key] != null ? opts[key] : defaultOptions[key];
options[key] = opts[key] ?? defaultOptions[key];
}

@@ -39,0 +34,0 @@ return options;

@@ -1,32 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
ParseErrorEnum: true,
Errors: true
};
exports.Errors = void 0;
exports.ParseErrorEnum = ParseErrorEnum;
var _location = require("./util/location");
var _credentials = require("./parse-error/credentials");
Object.keys(_credentials).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _credentials[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _credentials[key];
}
});
});
var _moduleErrors = require("./parse-error/module-errors");
var _standardErrors = require("./parse-error/standard-errors");
var _strictModeErrors = require("./parse-error/strict-mode-errors");
var _pipelineOperatorErrors = require("./parse-error/pipeline-operator-errors");
const _excluded = ["toMessage"],
_excluded2 = ["message"];
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import { Position } from "./util/location.js";
import { instantiate, ParseErrorCode } from "./parse-error/credentials.js";
function toParseErrorConstructor(_ref) {

@@ -41,3 +15,3 @@ let {

}) {
return (0, _credentials.instantiate)(SyntaxError, Object.assign({}, properties, {
return instantiate(SyntaxError, Object.assign({}, properties, {
loc

@@ -48,3 +22,3 @@ }), {

return constructor({
loc: new _location.Position("line" in loc ? loc.line : this.loc.line, "column" in loc ? loc.column : this.loc.column, "index" in loc ? loc.index : this.loc.index),
loc: new Position("line" in loc ? loc.line : this.loc.line, "column" in loc ? loc.column : this.loc.column, "index" in loc ? loc.index : this.loc.index),
details: Object.assign({}, this.details, overrides.details)

@@ -78,3 +52,3 @@ });

}
function ParseErrorEnum(argument, syntaxPlugin) {
export function ParseErrorEnum(argument, syntaxPlugin) {
if (Array.isArray(argument)) {

@@ -97,3 +71,3 @@ return parseErrorTemplates => ParseErrorEnum(parseErrorTemplates, argument[0]);

ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
code: _credentials.ParseErrorCode.SyntaxError,
code: ParseErrorCode.SyntaxError,
reasonCode,

@@ -107,5 +81,9 @@ toMessage

}
const Errors = Object.assign({}, ParseErrorEnum(_moduleErrors.default), ParseErrorEnum(_standardErrors.default), ParseErrorEnum(_strictModeErrors.default), ParseErrorEnum`pipelineOperator`(_pipelineOperatorErrors.default));
exports.Errors = Errors;
import ModuleErrors from "./parse-error/module-errors.js";
import StandardErrors from "./parse-error/standard-errors.js";
import StrictModeErrors from "./parse-error/strict-mode-errors.js";
import PipelineOperatorErrors from "./parse-error/pipeline-operator-errors.js";
export const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
export * from "./parse-error/credentials.js";
//# sourceMappingURL=parse-error.js.map

@@ -1,12 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.instantiate = exports.ParseErrorCode = void 0;
var ParseErrorCode = {
export var ParseErrorCode = {
SyntaxError: "BABEL_PARSER_SYNTAX_ERROR",
SourceTypeModuleError: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"
};
exports.ParseErrorCode = ParseErrorCode;
const reflect = (keys, last = keys.length - 1) => ({

@@ -26,4 +19,4 @@ get() {

}, descriptor)), Object.assign(new constructor(), properties));
exports.instantiate = instantiate;
export { instantiate };
//# sourceMappingURL=credentials.js.map

@@ -1,20 +0,13 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _parseError = require("../parse-error");
var _default = {
import { ParseErrorCode } from "../parse-error.js";
export default {
ImportMetaOutsideModule: {
message: `import.meta may appear only with 'sourceType: "module"'`,
code: _parseError.ParseErrorCode.SourceTypeModuleError
code: ParseErrorCode.SourceTypeModuleError
},
ImportOutsideModule: {
message: `'import' and 'export' may appear only with 'sourceType: "module"'`,
code: _parseError.ParseErrorCode.SourceTypeModuleError
code: ParseErrorCode.SourceTypeModuleError
}
};
exports.default = _default;
//# sourceMappingURL=module-errors.js.map

@@ -1,11 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.UnparenthesizedPipeBodyDescriptions = void 0;
var _toNodeDescription = require("./to-node-description");
const UnparenthesizedPipeBodyDescriptions = new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
exports.UnparenthesizedPipeBodyDescriptions = UnparenthesizedPipeBodyDescriptions;
var _default = {
import toNodeDescription from "./to-node-description.js";
export const UnparenthesizedPipeBodyDescriptions = new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
export default {
PipeBodyIsTighter: "Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",

@@ -20,3 +13,3 @@ PipeTopicRequiresHackPipes: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',

type
}) => `Hack-style pipe body cannot be an unparenthesized ${(0, _toNodeDescription.default)({
}) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({
type

@@ -31,4 +24,3 @@ })}; please wrap it in parentheses.`,

};
exports.default = _default;
//# sourceMappingURL=pipeline-operator-errors.js.map

@@ -1,9 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _toNodeDescription = require("./to-node-description");
var _default = {
import toNodeDescription from "./to-node-description.js";
export default {
AccessorIsGenerator: ({

@@ -97,6 +91,6 @@ kind

ancestor
}) => `Invalid left-hand side in ${(0, _toNodeDescription.default)(ancestor)}.`,
}) => `Invalid left-hand side in ${toNodeDescription(ancestor)}.`,
InvalidLhsBinding: ({
ancestor
}) => `Binding invalid left-hand side in ${(0, _toNodeDescription.default)(ancestor)}.`,
}) => `Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`,
InvalidNumber: "Invalid number.",

@@ -219,4 +213,3 @@ InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",

};
exports.default = _default;
//# sourceMappingURL=standard-errors.js.map

@@ -1,8 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = {
export default {
StrictDelete: "Deleting local variable in strict mode.",

@@ -20,4 +14,3 @@ StrictEvalArguments: ({

};
exports.default = _default;
//# sourceMappingURL=strict-mode-errors.js.map

@@ -1,7 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const NodeDescriptions = {

@@ -36,5 +30,4 @@ ArrayPattern: "array destructuring pattern",

}) => type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[String(prefix)] : NodeDescriptions[type];
var _default = toNodeDescription;
exports.default = _default;
export default toNodeDescription;
//# sourceMappingURL=to-node-description.js.map

@@ -1,12 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
class BaseParser {
constructor() {
this.sawUnambiguousESM = false;
this.ambiguousScriptDifferentAst = false;
}
export default class BaseParser {
sawUnambiguousESM = false;
ambiguousScriptDifferentAst = false;
hasPlugin(pluginConfig) {

@@ -22,3 +14,3 @@ if (typeof pluginConfig === "string") {

for (const key of Object.keys(pluginOptions)) {
if ((actualOptions == null ? void 0 : actualOptions[key]) !== pluginOptions[key]) {
if (actualOptions?.[key] !== pluginOptions[key]) {
return false;

@@ -31,8 +23,6 @@ }

getPluginOption(plugin, name) {
var _this$plugins$get;
return (_this$plugins$get = this.plugins.get(plugin)) == null ? void 0 : _this$plugins$get[name];
return this.plugins.get(plugin)?.[name];
}
}
exports.default = BaseParser;
//# sourceMappingURL=base.js.map

@@ -1,9 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
exports.setInnerComments = setInnerComments;
var _base = require("./base");
import BaseParser from "./base.js";
function setTrailingComments(node, comments) {

@@ -23,3 +16,3 @@ if (node.trailingComments === undefined) {

}
function setInnerComments(node, comments) {
export function setInnerComments(node, comments) {
if (node.innerComments === undefined) {

@@ -43,3 +36,3 @@ node.innerComments = comments;

}
class CommentsParser extends _base.default {
export default class CommentsParser extends BaseParser {
addComment(comment) {

@@ -190,4 +183,3 @@ if (this.filename) comment.loc.filename = this.filename;

}
exports.default = CommentsParser;
//# sourceMappingURL=comments.js.map

@@ -1,20 +0,14 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _types = require("../tokenizer/types");
var _lval = require("./lval");
var _identifier = require("../util/identifier");
var _location = require("../util/location");
var _scopeflags = require("../util/scopeflags");
var _util = require("./util");
var _productionParameter = require("../util/production-parameter");
var _expressionScope = require("../util/expression-scope");
var _parseError = require("../parse-error");
var _pipelineOperatorErrors = require("../parse-error/pipeline-operator-errors");
var _comments = require("./comments");
var _node = require("./node");
class ExpressionParser extends _lval.default {
import { tokenCanStartExpression, tokenIsAssignment, tokenIsIdentifier, tokenIsKeywordOrIdentifier, tokenIsOperator, tokenIsPostfix, tokenIsPrefix, tokenIsRightAssociative, tokenIsTemplate, tokenKeywordOrIdentifierIsKeyword, tokenLabelName, tokenOperatorPrecedence, tt } from "../tokenizer/types.js";
import LValParser from "./lval.js";
import { isKeyword, isReservedWord, isStrictReservedWord, isStrictBindReservedWord, isIdentifierStart, canBeReservedWord } from "../util/identifier.js";
import { createPositionWithColumnOffset } from "../util/location.js";
import { ScopeFlag, BindingFlag } from "../util/scopeflags.js";
import { ExpressionErrors } from "./util.js";
import { PARAM_AWAIT, PARAM_IN, PARAM_RETURN, functionFlags } from "../util/production-parameter.js";
import { newArrowHeadScope, newAsyncArrowScope, newExpressionScope } from "../util/expression-scope.js";
import { Errors } from "../parse-error.js";
import { UnparenthesizedPipeBodyDescriptions } from "../parse-error/pipeline-operator-errors.js";
import { setInnerComments } from "./comments.js";
import { cloneIdentifier } from "./node.js";
export default class ExpressionParser extends LValParser {
checkProto(prop, isRecord, protoRef, refExpressionErrors) {

@@ -28,3 +22,3 @@ if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) {

if (isRecord) {
this.raise(_parseError.Errors.RecordNoProto, {
this.raise(Errors.RecordNoProto, {
at: key

@@ -40,3 +34,3 @@ });

} else {
this.raise(_parseError.Errors.DuplicateProto, {
this.raise(Errors.DuplicateProto, {
at: key

@@ -94,4 +88,3 @@ });

setOptionalParametersError(refExpressionErrors, resultError) {
var _resultError$loc;
refExpressionErrors.optionalParametersLoc = (_resultError$loc = resultError == null ? void 0 : resultError.loc) != null ? _resultError$loc : this.state.startLoc;
refExpressionErrors.optionalParametersLoc = resultError?.loc ?? this.state.startLoc;
}

@@ -113,3 +106,3 @@ parseMaybeAssign(refExpressionErrors, afterLeftParse) {

} else {
refExpressionErrors = new _util.ExpressionErrors();
refExpressionErrors = new ExpressionErrors();
ownExpressionErrors = true;

@@ -120,3 +113,3 @@ }

} = this.state;
if (type === 10 || (0, _types.tokenIsIdentifier)(type)) {
if (type === 10 || tokenIsIdentifier(type)) {
this.state.potentialArrowAt = this.state.start;

@@ -128,3 +121,3 @@ }

}
if ((0, _types.tokenIsAssignment)(this.state.type)) {
if (tokenIsAssignment(this.state.type)) {
const node = this.startNodeAt(startLoc);

@@ -196,4 +189,4 @@ const operator = this.state.value;

const value = this.getPrivateNameSV(left);
if (minPrec >= (0, _types.tokenOperatorPrecedence)(58) || !this.prodParam.hasIn || !this.match(58)) {
this.raise(_parseError.Errors.PrivateInExpectedIn, {
if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
this.raise(Errors.PrivateInExpectedIn, {
at: left,

@@ -206,4 +199,4 @@ identifierName: value

const op = this.state.type;
if ((0, _types.tokenIsOperator)(op) && (this.prodParam.hasIn || !this.match(58))) {
let prec = (0, _types.tokenOperatorPrecedence)(op);
if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(58))) {
let prec = tokenOperatorPrecedence(op);
if (prec > minPrec) {

@@ -223,3 +216,3 @@ if (op === 39) {

if (coalesce) {
prec = (0, _types.tokenOperatorPrecedence)(42);
prec = tokenOperatorPrecedence(42);
}

@@ -231,3 +224,3 @@ this.next();

if (this.state.type === 96 && this.prodParam.hasAwait) {
throw this.raise(_parseError.Errors.UnexpectedAwaitAfterPipelineBody, {
throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, {
at: this.state.startLoc

@@ -241,3 +234,3 @@ });

if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
throw this.raise(_parseError.Errors.MixingCoalesceWithLogical, {
throw this.raise(Errors.MixingCoalesceWithLogical, {
at: this.state.startLoc

@@ -263,3 +256,3 @@ });

if (this.prodParam.hasYield && this.isContextual(106)) {
throw this.raise(_parseError.Errors.PipeBodyIsTighter, {
throw this.raise(Errors.PipeBodyIsTighter, {
at: this.state.startLoc

@@ -281,6 +274,5 @@ });

const startLoc = this.state.startLoc;
return this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, (0, _types.tokenIsRightAssociative)(op) ? prec - 1 : prec);
return this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, tokenIsRightAssociative(op) ? prec - 1 : prec);
}
parseHackPipeBody() {
var _body$extra;
const {

@@ -290,5 +282,5 @@ startLoc

const body = this.parseMaybeAssign();
const requiredParentheses = _pipelineOperatorErrors.UnparenthesizedPipeBodyDescriptions.has(body.type);
if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
this.raise(_parseError.Errors.PipeUnparenthesizedBody, {
const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
if (requiredParentheses && !body.extra?.parenthesized) {
this.raise(Errors.PipeUnparenthesizedBody, {
at: startLoc,

@@ -299,3 +291,3 @@ type: body.type

if (!this.topicReferenceWasUsedInCurrentContext()) {
this.raise(_parseError.Errors.PipeTopicUnused, {
this.raise(Errors.PipeTopicUnused, {
at: startLoc

@@ -308,3 +300,3 @@ });

if (this.match(57)) {
this.raise(_parseError.Errors.UnexpectedTokenUnaryExponentiation, {
this.raise(Errors.UnexpectedTokenUnaryExponentiation, {
at: node.argument

@@ -325,3 +317,3 @@ });

const node = this.startNode();
if ((0, _types.tokenIsPrefix)(this.state.type)) {
if (tokenIsPrefix(this.state.type)) {
node.operator = this.state.value;

@@ -339,7 +331,7 @@ node.prefix = true;

if (arg.type === "Identifier") {
this.raise(_parseError.Errors.StrictDelete, {
this.raise(Errors.StrictDelete, {
at: node
});
} else if (this.hasPropertyAsPrivateName(arg)) {
this.raise(_parseError.Errors.DeletePrivateField, {
this.raise(Errors.DeletePrivateField, {
at: node

@@ -361,5 +353,5 @@ });

} = this.state;
const startsExpr = this.hasPlugin("v8intrinsic") ? (0, _types.tokenCanStartExpression)(type) : (0, _types.tokenCanStartExpression)(type) && !this.match(54);
const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54);
if (startsExpr && !this.isAmbiguousAwait()) {
this.raiseOverwrite(_parseError.Errors.AwaitNotInAsyncContext, {
this.raiseOverwrite(Errors.AwaitNotInAsyncContext, {
at: startLoc

@@ -383,3 +375,3 @@ });

if (this.checkExpressionErrors(refExpressionErrors, false)) return expr;
while ((0, _types.tokenIsPostfix)(this.state.type) && !this.canInsertSemicolon()) {
while (tokenIsPostfix(this.state.type) && !this.canInsertSemicolon()) {
const node = this.startNodeAt(startLoc);

@@ -423,3 +415,3 @@ node.operator = this.state.value;

return this.parseBind(base, startLoc, noCalls, state);
} else if ((0, _types.tokenIsTemplate)(type)) {
} else if (tokenIsTemplate(type)) {
return this.parseTaggedTemplateExpression(base, startLoc, state);

@@ -430,3 +422,3 @@ }

if (noCalls) {
this.raise(_parseError.Errors.OptionalChainingNoNew, {
this.raise(Errors.OptionalChainingNoNew, {
at: this.state.startLoc

@@ -463,3 +455,3 @@ });

if (base.type === "Super") {
this.raise(_parseError.Errors.SuperPrivateField, {
this.raise(Errors.SuperPrivateField, {
at: startLoc

@@ -500,4 +492,4 @@ });

if (maybeAsyncArrow) {
this.expressionScope.enter((0, _expressionScope.newAsyncArrowScope)());
refExpressionErrors = new _util.ExpressionErrors();
this.expressionScope.enter(newAsyncArrowScope());
refExpressionErrors = new ExpressionErrors();
}

@@ -537,3 +529,3 @@ if (optionalChainMember) {

if (state.optionalChainMember) {
this.raise(_parseError.Errors.OptionalChainingNoTemplate, {
this.raise(Errors.OptionalChainingNoTemplate, {
at: startLoc

@@ -556,9 +548,7 @@ });

{
if (!this.hasPlugin("moduleAttributes")) {
this.expectImportAttributesPlugin();
}
this.expectImportAttributesPlugin();
}
}
if (node.arguments.length === 0 || node.arguments.length > 2) {
this.raise(_parseError.Errors.ImportCallArity, {
this.raise(Errors.ImportCallArity, {
at: node,

@@ -570,3 +560,3 @@ maxArgumentCount: this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1

if (arg.type === "SpreadElement") {
this.raise(_parseError.Errors.ImportCallSpreadArgument, {
this.raise(Errors.ImportCallSpreadArgument, {
at: arg

@@ -592,3 +582,3 @@ });

if (dynamicImport && !this.hasPlugin("importAttributes") && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
this.raise(_parseError.Errors.ImportCallArgumentTrailingComma, {
this.raise(Errors.ImportCallArgumentTrailingComma, {
at: this.state.lastTokStartLoc

@@ -613,11 +603,10 @@ });

parseAsyncArrowFromCallExpression(node, call) {
var _call$extra;
this.resetPreviousNodeTrailingComments(call);
this.expect(19);
this.parseArrowExpression(node, call.arguments, true, (_call$extra = call.extra) == null ? void 0 : _call$extra.trailingCommaLoc);
this.parseArrowExpression(node, call.arguments, true, call.extra?.trailingCommaLoc);
if (call.innerComments) {
(0, _comments.setInnerComments)(node, call.innerComments);
setInnerComments(node, call.innerComments);
}
if (call.callee.trailingComments) {
(0, _comments.setInnerComments)(node, call.callee.trailingComments);
setInnerComments(node, call.callee.trailingComments);
}

@@ -646,3 +635,3 @@ return node;

if (!this.match(10)) {
this.raise(_parseError.Errors.UnsupportedImport, {
this.raise(Errors.UnsupportedImport, {
at: this.state.lastTokStartLoc

@@ -723,3 +712,3 @@ });

} else {
throw this.raise(_parseError.Errors.UnsupportedBind, {
throw this.raise(Errors.UnsupportedBind, {
at: callee

@@ -731,3 +720,3 @@ });

{
this.raise(_parseError.Errors.PrivateInExpectedIn, {
this.raise(Errors.PrivateInExpectedIn, {
at: this.state.startLoc,

@@ -765,3 +754,3 @@ identifierName: this.state.value

const lookaheadCh = this.input.codePointAt(this.nextTokenStart());
if ((0, _identifier.isIdentifierStart)(lookaheadCh) || lookaheadCh === 62) {
if (isIdentifierStart(lookaheadCh) || lookaheadCh === 62) {
this.expectOnePlugin(["jsx", "flow", "typescript"]);

@@ -774,3 +763,3 @@ } else {

default:
if ((0, _types.tokenIsIdentifier)(type)) {
if (tokenIsIdentifier(type)) {
if (this.isContextual(125) && this.lookaheadInLineCharCode() === 123) {

@@ -790,3 +779,3 @@ return this.parseModuleExpression();

return this.parseAsyncFunctionExpression(this.startNodeAtNode(id));
} else if ((0, _types.tokenIsIdentifier)(type)) {
} else if (tokenIsIdentifier(type)) {
if (this.lookaheadCharCode() === 61) {

@@ -819,3 +808,3 @@ return this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(id));

this.state.end--;
this.state.endLoc = (0, _location.createPositionWithColumnOffset)(this.state.endLoc, -1);
this.state.endLoc = createPositionWithColumnOffset(this.state.endLoc, -1);
return this.parseTopicReference(pipeProposal);

@@ -837,3 +826,3 @@ } else {

if (!this.topicReferenceIsAllowedInCurrentContext()) {
this.raise(pipeProposal === "smart" ? _parseError.Errors.PrimaryTopicNotAllowed : _parseError.Errors.PipeTopicUnbound, {
this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, {
at: startLoc

@@ -845,5 +834,5 @@ });

} else {
throw this.raise(_parseError.Errors.PipeTopicUnconfiguredToken, {
throw this.raise(Errors.PipeTopicUnconfiguredToken, {
at: startLoc,
token: (0, _types.tokenLabelName)(tokenType)
token: tokenLabelName(tokenType)
});

@@ -857,3 +846,3 @@ }

return this.hasPlugin(["pipelineOperator", {
topicToken: (0, _types.tokenLabelName)(tokenType)
topicToken: tokenLabelName(tokenType)
}]);

@@ -864,3 +853,3 @@ }

default:
throw this.raise(_parseError.Errors.PipeTopicRequiresHackPipes, {
throw this.raise(Errors.PipeTopicRequiresHackPipes, {
at: startLoc

@@ -871,7 +860,7 @@ });

parseAsyncArrowUnaryFunction(node) {
this.prodParam.enter((0, _productionParameter.functionFlags)(true, this.prodParam.hasYield));
this.prodParam.enter(functionFlags(true, this.prodParam.hasYield));
const params = [this.parseIdentifier()];
this.prodParam.exit();
if (this.hasPrecedingLineBreak()) {
this.raise(_parseError.Errors.LineTerminatorBeforeArrow, {
this.raise(Errors.LineTerminatorBeforeArrow, {
at: this.state.curPosition()

@@ -893,3 +882,3 @@ });

if (isAsync) {
this.prodParam.enter(_productionParameter.PARAM_AWAIT);
this.prodParam.enter(PARAM_AWAIT);
node.body = this.parseBlock();

@@ -907,7 +896,7 @@ this.prodParam.exit();

if (this.match(10) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) {
this.raise(_parseError.Errors.SuperNotAllowed, {
this.raise(Errors.SuperNotAllowed, {
at: node
});
} else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) {
this.raise(_parseError.Errors.UnexpectedSuper, {
this.raise(Errors.UnexpectedSuper, {
at: node

@@ -917,3 +906,3 @@ });

if (!this.match(10) && !this.match(0) && !this.match(16)) {
this.raise(_parseError.Errors.UnsupportedSuper, {
this.raise(Errors.UnsupportedSuper, {
at: node

@@ -926,3 +915,3 @@ });

const node = this.startNode();
const id = this.startNodeAt((0, _location.createPositionWithColumnOffset)(this.state.startLoc, 1));
const id = this.startNodeAt(createPositionWithColumnOffset(this.state.startLoc, 1));
const name = this.state.value;

@@ -953,3 +942,3 @@ this.next();

if (node.property.name !== propertyName || containsEsc) {
this.raise(_parseError.Errors.UnsupportedMetaProperty, {
this.raise(Errors.UnsupportedMetaProperty, {
at: node.property,

@@ -967,3 +956,3 @@ target: meta.name,

if (!this.inModule) {
this.raise(_parseError.Errors.ImportMetaOutsideModule, {
this.raise(Errors.ImportMetaOutsideModule, {
at: id

@@ -1020,3 +1009,3 @@ });

this.next();
this.expressionScope.enter((0, _expressionScope.newArrowHeadScope)());
this.expressionScope.enter(newArrowHeadScope());
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;

@@ -1028,3 +1017,3 @@ const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;

const exprList = [];
const refExpressionErrors = new _util.ExpressionErrors();
const refExpressionErrors = new ExpressionErrors();
let first = true;

@@ -1114,3 +1103,3 @@ let spreadStartLoc;

if (!this.scope.inNonArrowFunction && !this.scope.inClass && !this.options.allowNewTargetOutsideFunction) {
this.raise(_parseError.Errors.UnexpectedNewTarget, {
this.raise(Errors.UnexpectedNewTarget, {
at: metaProp

@@ -1137,3 +1126,3 @@ });

if (node.callee.type === "Import") {
this.raise(_parseError.Errors.ImportCallNotNewExpression, {
this.raise(Errors.ImportCallNotNewExpression, {
at: node.callee

@@ -1151,7 +1140,7 @@ });

const elemStart = start + 1;
const elem = this.startNodeAt((0, _location.createPositionWithColumnOffset)(startLoc, 1));
const elem = this.startNodeAt(createPositionWithColumnOffset(startLoc, 1));
if (value === null) {
if (!isTagged) {
this.raise(_parseError.Errors.InvalidEscapeSequenceTemplate, {
at: (0, _location.createPositionWithColumnOffset)(this.state.firstInvalidTemplateEscapePos, 1)
this.raise(Errors.InvalidEscapeSequenceTemplate, {
at: createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1)
});

@@ -1170,3 +1159,3 @@ }

const finishedNode = this.finishNode(elem, "TemplateElement");
this.resetEndLocation(finishedNode, (0, _location.createPositionWithColumnOffset)(this.state.lastTokEndLoc, endOffset));
this.resetEndLocation(finishedNode, createPositionWithColumnOffset(this.state.lastTokEndLoc, endOffset));
return finishedNode;

@@ -1218,3 +1207,3 @@ }

if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
this.raise(_parseError.Errors.InvalidRecordProperty, {
this.raise(Errors.InvalidRecordProperty, {
at: prop

@@ -1249,3 +1238,3 @@ });

if (this.hasPlugin("decorators")) {
this.raise(_parseError.Errors.UnsupportedPropertyDecorator, {
this.raise(Errors.UnsupportedPropertyDecorator, {
at: this.state.startLoc

@@ -1292,3 +1281,3 @@ });

isGenerator = true;
this.raise(_parseError.Errors.AccessorIsGenerator, {
this.raise(Errors.AccessorIsGenerator, {
at: this.state.curPosition(),

@@ -1311,12 +1300,11 @@ kind: keyName

checkGetterSetterParams(method) {
var _params;
const paramCount = this.getGetterSetterExpectedParamCount(method);
const params = this.getObjectOrClassMethodParams(method);
if (params.length !== paramCount) {
this.raise(method.kind === "get" ? _parseError.Errors.BadGetterArity : _parseError.Errors.BadSetterArity, {
this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, {
at: method
});
}
if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") {
this.raise(_parseError.Errors.BadSetterRestParameter, {
if (method.kind === "set" && params[params.length - 1]?.type === "RestElement") {
this.raise(Errors.BadSetterRestParameter, {
at: method

@@ -1348,3 +1336,3 @@ });

if (isPattern) {
prop.value = this.parseMaybeDefault(startLoc, (0, _node.cloneIdentifier)(prop.key));
prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key));
} else if (this.match(29)) {

@@ -1357,9 +1345,9 @@ const shorthandAssignLoc = this.state.startLoc;

} else {
this.raise(_parseError.Errors.InvalidCoverInitializedName, {
this.raise(Errors.InvalidCoverInitializedName, {
at: shorthandAssignLoc
});
}
prop.value = this.parseMaybeDefault(startLoc, (0, _node.cloneIdentifier)(prop.key));
prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key));
} else {
prop.value = (0, _node.cloneIdentifier)(prop.key);
prop.value = cloneIdentifier(prop.key);
}

@@ -1386,3 +1374,3 @@ prop.shorthand = true;

let key;
if ((0, _types.tokenIsKeywordOrIdentifier)(type)) {
if (tokenIsKeywordOrIdentifier(type)) {
key = this.parseIdentifier(true);

@@ -1411,3 +1399,3 @@ } else {

} else {
this.raise(_parseError.Errors.UnexpectedPrivateField, {
this.raise(Errors.UnexpectedPrivateField, {
at: privateKeyLoc

@@ -1438,4 +1426,4 @@ });

node.generator = isGenerator;
this.scope.enter(_scopeflags.SCOPE_FUNCTION | _scopeflags.SCOPE_SUPER | (inClassScope ? _scopeflags.SCOPE_CLASS : 0) | (allowDirectSuper ? _scopeflags.SCOPE_DIRECT_SUPER : 0));
this.prodParam.enter((0, _productionParameter.functionFlags)(isAsync, node.generator));
this.scope.enter(ScopeFlag.FUNCTION | ScopeFlag.SUPER | (inClassScope ? ScopeFlag.CLASS : 0) | (allowDirectSuper ? ScopeFlag.DIRECT_SUPER : 0));
this.prodParam.enter(functionFlags(isAsync, node.generator));
this.parseFunctionParams(node, isConstructor);

@@ -1460,6 +1448,6 @@ const finishedNode = this.parseFunctionBodyAndFinish(node, type, true);

parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
this.scope.enter(_scopeflags.SCOPE_FUNCTION | _scopeflags.SCOPE_ARROW);
let flags = (0, _productionParameter.functionFlags)(isAsync, false);
this.scope.enter(ScopeFlag.FUNCTION | ScopeFlag.ARROW);
let flags = functionFlags(isAsync, false);
if (!this.match(5) && this.prodParam.hasIn) {
flags |= _productionParameter.PARAM_IN;
flags |= PARAM_IN;
}

@@ -1490,3 +1478,3 @@ this.prodParam.enter(flags);

const isExpression = allowExpression && !this.match(5);
this.expressionScope.enter((0, _expressionScope.newExpressionScope)());
this.expressionScope.enter(newExpressionScope());
if (isExpression) {

@@ -1499,7 +1487,7 @@ node.body = this.parseMaybeAssign();

this.state.labels = [];
this.prodParam.enter(this.prodParam.currentFlags() | _productionParameter.PARAM_RETURN);
this.prodParam.enter(this.prodParam.currentFlags() | PARAM_RETURN);
node.body = this.parseBlock(true, false, hasStrictModeDirective => {
const nonSimple = !this.isSimpleParamList(node.params);
if (hasStrictModeDirective && nonSimple) {
this.raise(_parseError.Errors.IllegalLanguageModeDirective, {
this.raise(Errors.IllegalLanguageModeDirective, {
at: (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node

@@ -1511,3 +1499,3 @@ });

if (this.state.strict && node.id) {
this.checkIdentifier(node.id, _scopeflags.BIND_OUTSIDE, strictModeChanged);
this.checkIdentifier(node.id, BindingFlag.TYPE_OUTSIDE, strictModeChanged);
}

@@ -1537,3 +1525,3 @@ });

in: formalParameters,
binding: _scopeflags.BIND_VAR,
binding: BindingFlag.TYPE_VAR,
checkClashes,

@@ -1568,3 +1556,3 @@ strictModeChanged

if (!allowEmpty) {
this.raise(_parseError.Errors.UnexpectedToken, {
this.raise(Errors.UnexpectedToken, {
at: this.state.curPosition(),

@@ -1581,3 +1569,3 @@ unexpected: ","

if (!allowPlaceholder) {
this.raise(_parseError.Errors.UnexpectedArgumentPlaceholder, {
this.raise(Errors.UnexpectedArgumentPlaceholder, {
at: this.state.startLoc

@@ -1610,3 +1598,3 @@ });

} = this.state;
if ((0, _types.tokenIsKeywordOrIdentifier)(type)) {
if (tokenIsKeywordOrIdentifier(type)) {
name = this.state.value;

@@ -1616,3 +1604,3 @@ } else {

}
const tokenIsKeyword = (0, _types.tokenKeywordOrIdentifierIsKeyword)(type);
const tokenIsKeyword = tokenKeywordOrIdentifierIsKeyword(type);
if (liberal) {

@@ -1632,7 +1620,7 @@ if (tokenIsKeyword) {

}
if (!(0, _identifier.canBeReservedWord)(word)) {
if (!canBeReservedWord(word)) {
return;
}
if (checkKeywords && (0, _identifier.isKeyword)(word)) {
this.raise(_parseError.Errors.UnexpectedKeyword, {
if (checkKeywords && isKeyword(word)) {
this.raise(Errors.UnexpectedKeyword, {
at: startLoc,

@@ -1643,5 +1631,5 @@ keyword: word

}
const reservedTest = !this.state.strict ? _identifier.isReservedWord : isBinding ? _identifier.isStrictBindReservedWord : _identifier.isStrictReservedWord;
const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;
if (reservedTest(word, this.inModule)) {
this.raise(_parseError.Errors.UnexpectedReservedWord, {
this.raise(Errors.UnexpectedReservedWord, {
at: startLoc,

@@ -1653,3 +1641,3 @@ reservedWord: word

if (this.prodParam.hasYield) {
this.raise(_parseError.Errors.YieldBindingIdentifier, {
this.raise(Errors.YieldBindingIdentifier, {
at: startLoc

@@ -1661,3 +1649,3 @@ });

if (this.prodParam.hasAwait) {
this.raise(_parseError.Errors.AwaitBindingIdentifier, {
this.raise(Errors.AwaitBindingIdentifier, {
at: startLoc

@@ -1668,3 +1656,3 @@ });

if (this.scope.inStaticBlock) {
this.raise(_parseError.Errors.AwaitBindingIdentifierInStaticBlock, {
this.raise(Errors.AwaitBindingIdentifierInStaticBlock, {
at: startLoc

@@ -1679,3 +1667,3 @@ });

if (this.scope.inClassAndNotInNonArrowFunction) {
this.raise(_parseError.Errors.ArgumentsInClass, {
this.raise(Errors.ArgumentsInClass, {
at: startLoc

@@ -1696,7 +1684,7 @@ });

const node = this.startNodeAt(startLoc);
this.expressionScope.recordParameterInitializerError(_parseError.Errors.AwaitExpressionFormalParameter, {
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, {
at: node
});
if (this.eat(55)) {
this.raise(_parseError.Errors.ObsoleteAwaitStar, {
this.raise(Errors.ObsoleteAwaitStar, {
at: node

@@ -1722,7 +1710,7 @@ });

} = this.state;
return type === 53 || type === 10 || type === 0 || (0, _types.tokenIsTemplate)(type) || type === 101 && !this.state.containsEsc || type === 135 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 101 && !this.state.containsEsc || type === 135 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
}
parseYield() {
const node = this.startNode();
this.expressionScope.recordParameterInitializerError(_parseError.Errors.YieldInParameter, {
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, {
at: node

@@ -1758,3 +1746,3 @@ });

if (left.type === "SequenceExpression") {
this.raise(_parseError.Errors.PipelineHeadSequenceExpression, {
this.raise(Errors.PipelineHeadSequenceExpression, {
at: leftStartLoc

@@ -1789,3 +1777,3 @@ });

if (this.match(19)) {
throw this.raise(_parseError.Errors.PipelineBodyNoArrow, {
throw this.raise(Errors.PipelineBodyNoArrow, {
at: this.state.startLoc

@@ -1795,3 +1783,3 @@ });

if (!this.topicReferenceWasUsedInCurrentContext()) {
this.raise(_parseError.Errors.PipelineTopicUnused, {
this.raise(Errors.PipelineTopicUnused, {
at: startLoc

@@ -1842,5 +1830,5 @@ });

const flags = this.prodParam.currentFlags();
const prodParamToSet = _productionParameter.PARAM_IN & ~flags;
const prodParamToSet = PARAM_IN & ~flags;
if (prodParamToSet) {
this.prodParam.enter(flags | _productionParameter.PARAM_IN);
this.prodParam.enter(flags | PARAM_IN);
try {

@@ -1856,5 +1844,5 @@ return callback();

const flags = this.prodParam.currentFlags();
const prodParamToClear = _productionParameter.PARAM_IN & flags;
const prodParamToClear = PARAM_IN & flags;
if (prodParamToClear) {
this.prodParam.enter(flags & ~_productionParameter.PARAM_IN);
this.prodParam.enter(flags & ~PARAM_IN);
try {

@@ -1906,4 +1894,3 @@ return callback();

}
exports.default = ExpressionParser;
//# sourceMappingURL=expression.js.map

@@ -1,13 +0,7 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _options = require("../options");
var _statement = require("./statement");
var _scope = require("../util/scope");
class Parser extends _statement.default {
import { getOptions } from "../options.js";
import StatementParser from "./statement.js";
import ScopeHandler from "../util/scope.js";
export default class Parser extends StatementParser {
constructor(options, input) {
options = (0, _options.getOptions)(options);
options = getOptions(options);
super(options, input);

@@ -20,3 +14,3 @@ this.options = options;

getScopeHandler() {
return _scope.default;
return ScopeHandler;
}

@@ -34,3 +28,2 @@ parse() {

}
exports.default = Parser;
function pluginsMap(plugins) {

@@ -37,0 +30,0 @@ const pluginMap = new Map();

@@ -1,12 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.ParseBindingListFlags = void 0;
var _types = require("../tokenizer/types");
var _identifier = require("../util/identifier");
var _node = require("./node");
var _scopeflags = require("../util/scopeflags");
var _parseError = require("../parse-error");
import { tt } from "../tokenizer/types.js";
import { isStrictBindOnlyReservedWord, isStrictBindReservedWord } from "../util/identifier.js";
import { NodeUtils } from "./node.js";
import { BindingFlag } from "../util/scopeflags.js";
import { Errors } from "../parse-error.js";
const getOwn = (object, key) => Object.hasOwnProperty.call(object, key) && object[key];

@@ -16,3 +10,3 @@ const unwrapParenthesizedExpression = node => {

};
var ParseBindingListFlags = {
export var ParseBindingListFlags = {
ALLOW_EMPTY: 1,

@@ -22,16 +16,14 @@ IS_FUNCTION_PARAMS: 2,

};
exports.ParseBindingListFlags = ParseBindingListFlags;
class LValParser extends _node.NodeUtils {
export default class LValParser extends NodeUtils {
toAssignable(node, isLHS = false) {
var _node$extra, _node$extra3;
let parenthesized = undefined;
if (node.type === "ParenthesizedExpression" || (_node$extra = node.extra) != null && _node$extra.parenthesized) {
if (node.type === "ParenthesizedExpression" || node.extra?.parenthesized) {
parenthesized = unwrapParenthesizedExpression(node);
if (isLHS) {
if (parenthesized.type === "Identifier") {
this.expressionScope.recordArrowParameterBindingError(_parseError.Errors.InvalidParenthesizedAssignment, {
this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, {
at: node
});
} else if (parenthesized.type !== "MemberExpression") {
this.raise(_parseError.Errors.InvalidParenthesizedAssignment, {
this.raise(Errors.InvalidParenthesizedAssignment, {
at: node

@@ -41,3 +33,3 @@ });

} else {
this.raise(_parseError.Errors.InvalidParenthesizedAssignment, {
this.raise(Errors.InvalidParenthesizedAssignment, {
at: node

@@ -57,8 +49,7 @@ });

for (let i = 0, length = node.properties.length, last = length - 1; i < length; i++) {
var _node$extra2;
const prop = node.properties[i];
const isLast = i === last;
this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
if (isLast && prop.type === "RestElement" && (_node$extra2 = node.extra) != null && _node$extra2.trailingCommaLoc) {
this.raise(_parseError.Errors.RestTrailingComma, {
if (isLast && prop.type === "RestElement" && node.extra?.trailingCommaLoc) {
this.raise(Errors.RestTrailingComma, {
at: node.extra.trailingCommaLoc

@@ -87,7 +78,7 @@ });

node.type = "ArrayPattern";
this.toAssignableList(node.elements, (_node$extra3 = node.extra) == null ? void 0 : _node$extra3.trailingCommaLoc, isLHS);
this.toAssignableList(node.elements, node.extra?.trailingCommaLoc, isLHS);
break;
case "AssignmentExpression":
if (node.operator !== "=") {
this.raise(_parseError.Errors.MissingEqInAssignment, {
this.raise(Errors.MissingEqInAssignment, {
at: node.left.loc.end

@@ -108,3 +99,3 @@ });

if (prop.type === "ObjectMethod") {
this.raise(prop.kind === "get" || prop.kind === "set" ? _parseError.Errors.PatternHasAccessor : _parseError.Errors.PatternHasMethod, {
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, {
at: prop.key

@@ -118,3 +109,3 @@ });

if (!isLast) {
this.raise(_parseError.Errors.RestTrailingComma, {
this.raise(Errors.RestTrailingComma, {
at: prop

@@ -142,7 +133,7 @@ });

if (i < end) {
this.raise(_parseError.Errors.RestTrailingComma, {
this.raise(Errors.RestTrailingComma, {
at: elt
});
} else if (trailingCommaLoc) {
this.raise(_parseError.Errors.RestTrailingComma, {
this.raise(Errors.RestTrailingComma, {
at: trailingCommaLoc

@@ -192,3 +183,3 @@ });

for (const expr of exprList) {
if ((expr == null ? void 0 : expr.type) === "ArrayExpression") {
if (expr?.type === "ArrayExpression") {
this.toReferencedListDeep(expr.elements);

@@ -247,3 +238,3 @@ }

if (this.match(26) && this.hasPlugin("decorators")) {
this.raise(_parseError.Errors.UnsupportedParameterDecorator, {
this.raise(Errors.UnsupportedParameterDecorator, {
at: this.state.startLoc

@@ -297,5 +288,4 @@ });

parseMaybeDefault(startLoc, left) {
var _startLoc, _left;
(_startLoc = startLoc) != null ? _startLoc : startLoc = this.state.startLoc;
left = (_left = left) != null ? _left : this.parseBindingAtom();
startLoc ??= this.state.startLoc;
left = left ?? this.parseBindingAtom();
if (!this.eat(29)) return left;

@@ -319,3 +309,3 @@ const node = this.startNodeAt(startLoc);

in: ancestor,
binding = _scopeflags.BIND_NONE,
binding = BindingFlag.TYPE_NONE,
checkClashes = false,

@@ -325,8 +315,7 @@ strictModeChanged = false,

}) {
var _expression$extra;
const type = expression.type;
if (this.isObjectMethod(expression)) return;
if (type === "MemberExpression") {
if (binding !== _scopeflags.BIND_NONE) {
this.raise(_parseError.Errors.InvalidPropertyBindingPattern, {
if (binding !== BindingFlag.TYPE_NONE) {
this.raise(Errors.InvalidPropertyBindingPattern, {
at: expression

@@ -344,3 +333,3 @@ });

if (checkClashes.has(name)) {
this.raise(_parseError.Errors.ParamDupe, {
this.raise(Errors.ParamDupe, {
at: expression

@@ -354,6 +343,6 @@ });

}
const validity = this.isValidLVal(type, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding);
const validity = this.isValidLVal(type, !(hasParenthesizedAncestor || expression.extra?.parenthesized) && ancestor.type === "AssignmentExpression", binding);
if (validity === true) return;
if (validity === false) {
const ParseErrorClass = binding === _scopeflags.BIND_NONE ? _parseError.Errors.InvalidLhs : _parseError.Errors.InvalidLhsBinding;
const ParseErrorClass = binding === BindingFlag.TYPE_NONE ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
this.raise(ParseErrorClass, {

@@ -382,5 +371,5 @@ at: expression,

checkIdentifier(at, bindingType, strictModeChanged = false) {
if (this.state.strict && (strictModeChanged ? (0, _identifier.isStrictBindReservedWord)(at.name, this.inModule) : (0, _identifier.isStrictBindOnlyReservedWord)(at.name))) {
if (bindingType === _scopeflags.BIND_NONE) {
this.raise(_parseError.Errors.StrictEvalArguments, {
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
if (bindingType === BindingFlag.TYPE_NONE) {
this.raise(Errors.StrictEvalArguments, {
at,

@@ -390,3 +379,3 @@ referenceName: at.name

} else {
this.raise(_parseError.Errors.StrictEvalArgumentsBinding, {
this.raise(Errors.StrictEvalArgumentsBinding, {
at,

@@ -397,8 +386,8 @@ bindingName: at.name

}
if (bindingType & _scopeflags.BIND_FLAGS_NO_LET_IN_LEXICAL && at.name === "let") {
this.raise(_parseError.Errors.LetInLexicalBinding, {
if (bindingType & BindingFlag.FLAG_NO_LET_IN_LEXICAL && at.name === "let") {
this.raise(Errors.LetInLexicalBinding, {
at
});
}
if (!(bindingType & _scopeflags.BIND_NONE)) {
if (!(bindingType & BindingFlag.TYPE_NONE)) {
this.declareNameFromIdentifier(at, bindingType);

@@ -422,3 +411,3 @@ }

default:
this.raise(_parseError.Errors.InvalidRestAssignmentPattern, {
this.raise(Errors.InvalidRestAssignmentPattern, {
at: node

@@ -432,3 +421,3 @@ });

}
this.raise(this.lookaheadCharCode() === close ? _parseError.Errors.RestTrailingComma : _parseError.Errors.ElementAfterRest, {
this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, {
at: this.state.startLoc

@@ -439,4 +428,3 @@ });

}
exports.default = LValParser;
//# sourceMappingURL=lval.js.map

@@ -1,39 +0,19 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.NodeUtils = void 0;
exports.cloneIdentifier = cloneIdentifier;
exports.cloneStringLiteral = cloneStringLiteral;
var _util = require("./util");
var _location = require("../util/location");
import UtilParser from "./util.js";
import { SourceLocation } from "../util/location.js";
class Node {
constructor(parser, pos, loc) {
this.type = "";
this.start = pos;
this.end = 0;
this.loc = new _location.SourceLocation(loc);
if (parser != null && parser.options.ranges) this.range = [pos, 0];
if (parser != null && parser.filename) this.loc.filename = parser.filename;
this.loc = new SourceLocation(loc);
if (parser?.options.ranges) this.range = [pos, 0];
if (parser?.filename) this.loc.filename = parser.filename;
}
type = "";
}
const NodePrototype = Node.prototype;
{
NodePrototype.__clone = function () {
const newNode = new Node(undefined, this.start, this.loc.start);
const keys = Object.keys(this);
for (let i = 0, length = keys.length; i < length; i++) {
const key = keys[i];
if (key !== "leadingComments" && key !== "trailingComments" && key !== "innerComments") {
newNode[key] = this[key];
}
}
return newNode;
};
}
;
function clonePlaceholder(node) {
return cloneIdentifier(node);
}
function cloneIdentifier(node) {
export function cloneIdentifier(node) {
const {

@@ -61,3 +41,3 @@ type,

}
function cloneStringLiteral(node) {
export function cloneStringLiteral(node) {
const {

@@ -88,3 +68,3 @@ type,

}
class NodeUtils extends _util.default {
export class NodeUtils extends UtilParser {
startNode() {

@@ -127,4 +107,3 @@ return new Node(this, this.state.start, this.state.startLoc);

}
exports.NodeUtils = NodeUtils;
//# sourceMappingURL=node.js.map

@@ -1,17 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.ExpressionErrors = void 0;
var _types = require("../tokenizer/types");
var _tokenizer = require("../tokenizer");
var _whitespace = require("../util/whitespace");
var _identifier = require("../util/identifier");
var _classScope = require("../util/class-scope");
var _expressionScope = require("../util/expression-scope");
var _scopeflags = require("../util/scopeflags");
var _productionParameter = require("../util/production-parameter");
var _parseError = require("../parse-error");
class UtilParser extends _tokenizer.default {
import { tokenIsLiteralPropertyName, tt } from "../tokenizer/types.js";
import Tokenizer from "../tokenizer/index.js";
import { lineBreak, skipWhiteSpaceToLineBreak } from "../util/whitespace.js";
import { isIdentifierChar } from "../util/identifier.js";
import ClassScopeHandler from "../util/class-scope.js";
import ExpressionScopeHandler from "../util/expression-scope.js";
import { ScopeFlag } from "../util/scopeflags.js";
import ProductionParameterHandler, { PARAM_AWAIT, PARAM } from "../util/production-parameter.js";
import { Errors } from "../parse-error.js";
export default class UtilParser extends Tokenizer {
addExtra(node, key, value, enumerable = true) {

@@ -36,3 +30,3 @@ if (!node) return;

const nextCh = this.input.charCodeAt(nameEnd);
return !((0, _identifier.isIdentifierChar)(nextCh) || (nextCh & 0xfc00) === 0xd800);
return !(isIdentifierChar(nextCh) || (nextCh & 0xfc00) === 0xd800);
}

@@ -66,7 +60,7 @@ return false;

hasPrecedingLineBreak() {
return _whitespace.lineBreak.test(this.input.slice(this.state.lastTokEndLoc.index, this.state.start));
return lineBreak.test(this.input.slice(this.state.lastTokEndLoc.index, this.state.start));
}
hasFollowingLineBreak() {
_whitespace.skipWhiteSpaceToLineBreak.lastIndex = this.state.end;
return _whitespace.skipWhiteSpaceToLineBreak.test(this.input);
skipWhiteSpaceToLineBreak.lastIndex = this.state.end;
return skipWhiteSpaceToLineBreak.test(this.input);
}

@@ -78,3 +72,3 @@ isLineTerminator() {

if (allowAsi ? this.isLineTerminator() : this.eat(13)) return;
this.raise(_parseError.Errors.MissingSemicolon, {
this.raise(Errors.MissingSemicolon, {
at: this.state.lastTokEndLoc

@@ -151,3 +145,3 @@ });

if (shorthandAssignLoc != null) {
this.raise(_parseError.Errors.InvalidCoverInitializedName, {
this.raise(Errors.InvalidCoverInitializedName, {
at: shorthandAssignLoc

@@ -157,3 +151,3 @@ });

if (doubleProtoLoc != null) {
this.raise(_parseError.Errors.DuplicateProto, {
this.raise(Errors.DuplicateProto, {
at: doubleProtoLoc

@@ -163,3 +157,3 @@ });

if (privateKeyLoc != null) {
this.raise(_parseError.Errors.UnexpectedPrivateField, {
this.raise(Errors.UnexpectedPrivateField, {
at: privateKeyLoc

@@ -173,3 +167,3 @@ });

isLiteralPropertyName() {
return (0, _types.tokenIsLiteralPropertyName)(this.state.type);
return tokenIsLiteralPropertyName(this.state.type);
}

@@ -202,7 +196,7 @@ isPrivateName(node) {

const oldProdParam = this.prodParam;
this.prodParam = new _productionParameter.default();
this.prodParam = new ProductionParameterHandler();
const oldClassScope = this.classScope;
this.classScope = new _classScope.default(this);
this.classScope = new ClassScopeHandler(this);
const oldExpressionScope = this.expressionScope;
this.expressionScope = new _expressionScope.default(this);
this.expressionScope = new ExpressionScopeHandler(this);
return () => {

@@ -219,7 +213,7 @@ this.state.labels = oldLabels;

enterInitialScopes() {
let paramFlags = _productionParameter.PARAM;
let paramFlags = PARAM;
if (this.inModule) {
paramFlags |= _productionParameter.PARAM_AWAIT;
paramFlags |= PARAM_AWAIT;
}
this.scope.enter(_scopeflags.SCOPE_PROGRAM);
this.scope.enter(ScopeFlag.PROGRAM);
this.prodParam.enter(paramFlags);

@@ -236,13 +230,9 @@ }

}
exports.default = UtilParser;
class ExpressionErrors {
constructor() {
this.shorthandAssignLoc = null;
this.doubleProtoLoc = null;
this.privateKeyLoc = null;
this.optionalParametersLoc = null;
}
export class ExpressionErrors {
shorthandAssignLoc = null;
doubleProtoLoc = null;
privateKeyLoc = null;
optionalParametersLoc = null;
}
exports.ExpressionErrors = ExpressionErrors;
//# sourceMappingURL=util.js.map

@@ -1,17 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPluginOption = getPluginOption;
exports.hasPlugin = hasPlugin;
exports.mixinPlugins = exports.mixinPluginNames = void 0;
exports.validatePlugins = validatePlugins;
var _estree = require("./plugins/estree");
var _flow = require("./plugins/flow");
var _jsx = require("./plugins/jsx");
var _typescript = require("./plugins/typescript");
var _placeholders = require("./plugins/placeholders");
var _v8intrinsic = require("./plugins/v8intrinsic");
function hasPlugin(plugins, expectedConfig) {
export function hasPlugin(plugins, expectedConfig) {
const [expectedName, expectedOptions] = typeof expectedConfig === "string" ? [expectedConfig, {}] : expectedConfig;

@@ -37,3 +22,3 @@ const expectedKeys = Object.keys(expectedOptions);

}
function getPluginOption(plugins, name, option) {
export function getPluginOption(plugins, name, option) {
const plugin = plugins.find(plugin => {

@@ -54,3 +39,3 @@ if (Array.isArray(plugin)) {

const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
function validatePlugins(plugins) {
export function validatePlugins(plugins) {
if (hasPlugin(plugins, "decorators")) {

@@ -105,9 +90,3 @@ if (hasPlugin(plugins, "decorators-legacy")) {

{
if (hasPlugin(plugins, "importAssertions") || hasPlugin(plugins, "importAttributes")) {
throw new Error("Cannot combine importAssertions, importAttributes and moduleAttributes plugins.");
}
const moduleAttributesVersionPluginOption = getPluginOption(plugins, "moduleAttributes", "version");
if (moduleAttributesVersionPluginOption !== "may-2020") {
throw new Error("The 'moduleAttributes' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is 'may-2020'.");
}
throw new Error("`moduleAttributes` has been removed in Babel 8, please use `importAttributes` parser plugin, or `@babel/plugin-syntax-import-attributes`.");
}

@@ -127,14 +106,18 @@ }

}
const mixinPlugins = {
estree: _estree.default,
jsx: _jsx.default,
flow: _flow.default,
typescript: _typescript.default,
v8intrinsic: _v8intrinsic.default,
placeholders: _placeholders.default
import estree from "./plugins/estree.js";
import flow from "./plugins/flow/index.js";
import jsx from "./plugins/jsx/index.js";
import typescript from "./plugins/typescript/index.js";
import placeholders from "./plugins/placeholders.js";
import v8intrinsic from "./plugins/v8intrinsic.js";
export const mixinPlugins = {
estree,
jsx,
flow,
typescript,
v8intrinsic,
placeholders
};
exports.mixinPlugins = mixinPlugins;
const mixinPluginNames = Object.keys(mixinPlugins);
exports.mixinPluginNames = mixinPluginNames;
export const mixinPluginNames = Object.keys(mixinPlugins);
//# sourceMappingURL=plugin-utils.js.map

@@ -1,8 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _parseError = require("../parse-error");
import { Errors } from "../parse-error.js";
const {

@@ -20,3 +14,3 @@ defineProperty

}
var _default = superClass => class ESTreeParserMixin extends superClass {
export default (superClass => class ESTreeParserMixin extends superClass {
parse() {

@@ -48,3 +42,3 @@ const file = toESTreeLocation(super.parse());

bigInt = BigInt(value);
} catch (_unused) {
} catch {
bigInt = null;

@@ -105,4 +99,3 @@ }

isValidDirective(stmt) {
var _stmt$expression$extr;
return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && !((_stmt$expression$extr = stmt.expression.extra) != null && _stmt$expression$extr.parenthesized);
return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && !stmt.expression.extra?.parenthesized;
}

@@ -125,7 +118,3 @@ parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {

const node = super.parsePrivateName();
{
if (!this.getPluginOption("estree", "classFeatures")) {
return node;
}
}
;
return this.convertPrivateNameToPrivateIdentifier(node);

@@ -142,15 +131,7 @@ }

isPrivateName(node) {
{
if (!this.getPluginOption("estree", "classFeatures")) {
return super.isPrivateName(node);
}
}
;
return node.type === "PrivateIdentifier";
}
getPrivateNameSV(node) {
{
if (!this.getPluginOption("estree", "classFeatures")) {
return super.getPrivateNameSV(node);
}
}
;
return node.name;

@@ -182,7 +163,3 @@ }

const propertyNode = super.parseClassProperty(...args);
{
if (!this.getPluginOption("estree", "classFeatures")) {
return propertyNode;
}
}
;
propertyNode.type = "PropertyDefinition";

@@ -193,7 +170,3 @@ return propertyNode;

const propertyNode = super.parseClassPrivateProperty(...args);
{
if (!this.getPluginOption("estree", "classFeatures")) {
return propertyNode;
}
}
;
propertyNode.type = "PropertyDefinition";

@@ -247,7 +220,7 @@ propertyNode.computed = false;

if (prop.kind === "get" || prop.kind === "set") {
this.raise(_parseError.Errors.PatternHasAccessor, {
this.raise(Errors.PatternHasAccessor, {
at: prop.key
});
} else if (prop.method) {
this.raise(_parseError.Errors.PatternHasMethod, {
this.raise(Errors.PatternHasMethod, {
at: prop.key

@@ -265,4 +238,3 @@ });

if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
var _node$arguments$;
node.attributes = (_node$arguments$ = node.arguments[1]) != null ? _node$arguments$ : null;
node.attributes = node.arguments[1] ?? null;
}

@@ -295,7 +267,6 @@ delete node.arguments;

{
var _declaration$decorato;
const {
declaration
} = node;
if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && ((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0 && declaration.start === node.start) {
if (declaration?.type === "ClassDeclaration" && declaration.decorators?.length > 0 && declaration.start === node.start) {
this.resetStartLocation(node, exportStartLoc);

@@ -347,5 +318,4 @@ }

}
};
exports.default = _default;
});
//# sourceMappingURL=estree.js.map

@@ -1,16 +0,7 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _scope = require("../../util/scope");
var _scopeflags = require("../../util/scopeflags");
class FlowScope extends _scope.Scope {
constructor(...args) {
super(...args);
this.declareFunctions = new Set();
}
import ScopeHandler, { Scope } from "../../util/scope.js";
import { BindingFlag } from "../../util/scopeflags.js";
class FlowScope extends Scope {
declareFunctions = new Set();
}
class FlowScopeHandler extends _scope.default {
export default class FlowScopeHandler extends ScopeHandler {
createScope(flags) {

@@ -21,3 +12,3 @@ return new FlowScope(flags);

const scope = this.currentScope();
if (bindingType & _scopeflags.BIND_FLAGS_FLOW_DECLARE_FN) {
if (bindingType & BindingFlag.FLAG_FLOW_DECLARE_FN) {
this.checkRedeclarationInScope(scope, name, bindingType, loc);

@@ -32,3 +23,3 @@ this.maybeExportDefined(scope, name);

if (super.isRedeclaredInScope(scope, name, bindingType)) return true;
if (bindingType & _scopeflags.BIND_FLAGS_FLOW_DECLARE_FN) {
if (bindingType & BindingFlag.FLAG_FLOW_DECLARE_FN) {
return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name));

@@ -44,4 +35,3 @@ }

}
exports.default = FlowScopeHandler;
//# sourceMappingURL=scope.js.map

@@ -1,14 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _xhtml = require("./xhtml");
var _types = require("../../tokenizer/types");
var _context = require("../../tokenizer/context");
var _identifier = require("../../util/identifier");
var _whitespace = require("../../util/whitespace");
var _parseError = require("../../parse-error");
const JsxErrors = (0, _parseError.ParseErrorEnum)`jsx`({
import XHTMLEntities from "./xhtml.js";
import { tokenComesBeforeExpression, tokenIsKeyword, tokenLabelName, tt } from "../../tokenizer/types.js";
import { types as tc } from "../../tokenizer/context.js";
import { isIdentifierChar, isIdentifierStart } from "../../util/identifier.js";
import { isNewLine } from "../../util/whitespace.js";
import { Errors, ParseErrorEnum } from "../../parse-error.js";
const JsxErrors = ParseErrorEnum`jsx`({
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",

@@ -43,3 +37,3 @@ MissingClosingTagElement: ({

}
var _default = superClass => class JSXParserMixin extends superClass {
export default (superClass => class JSXParserMixin extends superClass {
jsxReadToken() {

@@ -77,5 +71,11 @@ let out = "";

case 125:
;
{
this.raise(JsxErrors.UnexpectedToken, {
at: this.state.curPosition(),
unexpected: this.input[this.state.pos],
HTMLEntity: ch === 125 ? "&rbrace;" : "&gt;"
});
}
default:
if ((0, _whitespace.isNewLine)(ch)) {
if (isNewLine(ch)) {
out += this.input.slice(chunkStart, this.state.pos);

@@ -109,3 +109,3 @@ out += this.jsxReadNewLine(true);

if (this.state.pos >= this.length) {
throw this.raise(_parseError.Errors.UnterminatedString, {
throw this.raise(Errors.UnterminatedString, {
at: this.state.startLoc

@@ -120,3 +120,3 @@ });

chunkStart = this.state.pos;
} else if ((0, _whitespace.isNewLine)(ch)) {
} else if (isNewLine(ch)) {
out += this.input.slice(chunkStart, this.state.pos);

@@ -154,3 +154,3 @@ out += this.jsxReadNewLine(false);

const desc = this.input.slice(startPos, this.state.pos);
const entity = _xhtml.default[desc];
const entity = XHTMLEntities[desc];
++this.state.pos;

@@ -170,3 +170,3 @@ if (entity) {

ch = this.input.charCodeAt(++this.state.pos);
} while ((0, _identifier.isIdentifierChar)(ch) || ch === 45);
} while (isIdentifierChar(ch) || ch === 45);
this.finishToken(138, this.input.slice(start, this.state.pos));

@@ -178,4 +178,4 @@ }

node.name = this.state.value;
} else if ((0, _types.tokenIsKeyword)(this.state.type)) {
node.name = (0, _types.tokenLabelName)(this.state.type);
} else if (tokenIsKeyword(this.state.type)) {
node.name = tokenLabelName(this.state.type);
} else {

@@ -215,5 +215,5 @@ this.unexpected();

node = this.startNode();
this.setContext(_context.types.brace);
this.setContext(tc.brace);
this.next();
node = this.jsxParseExpressionContainer(node, _context.types.j_oTag);
node = this.jsxParseExpressionContainer(node, tc.j_oTag);
if (node.expression.type === "JSXEmptyExpression") {

@@ -241,3 +241,3 @@ this.raise(JsxErrors.AttributeIsEmpty, {

node.expression = this.parseExpression();
this.setContext(_context.types.j_expr);
this.setContext(tc.j_expr);
this.state.canStartJSXElement = true;

@@ -252,3 +252,9 @@ this.expect(8);

const expression = this.parseExpression();
;
{
if (expression.type === "SequenceExpression" && !expression.extra?.parenthesized) {
this.raise(JsxErrors.UnexpectedSequenceExpression, {
at: expression.expressions[1]
});
}
}
node.expression = expression;

@@ -264,7 +270,7 @@ }

if (this.match(5)) {
this.setContext(_context.types.brace);
this.setContext(tc.brace);
this.next();
this.expect(21);
node.argument = this.parseMaybeAssignAllowIn();
this.setContext(_context.types.j_oTag);
this.setContext(tc.j_oTag);
this.state.canStartJSXElement = true;

@@ -328,3 +334,3 @@ this.expect(8);

const node = this.startNode();
this.setContext(_context.types.brace);
this.setContext(tc.brace);
this.next();

@@ -334,3 +340,3 @@ if (this.match(21)) {

} else {
children.push(this.jsxParseExpressionContainer(node, _context.types.j_expr));
children.push(this.jsxParseExpressionContainer(node, tc.j_expr));
}

@@ -405,8 +411,8 @@ break;

const context = this.curContext();
if (context === _context.types.j_expr) {
if (context === tc.j_expr) {
this.jsxReadToken();
return;
}
if (context === _context.types.j_oTag || context === _context.types.j_cTag) {
if ((0, _identifier.isIdentifierStart)(code)) {
if (context === tc.j_oTag || context === tc.j_cTag) {
if (isIdentifierStart(code)) {
this.jsxReadWord();

@@ -420,3 +426,3 @@ return;

}
if ((code === 34 || code === 39) && context === _context.types.j_oTag) {
if ((code === 34 || code === 39) && context === tc.j_oTag) {
this.jsxReadString(code);

@@ -439,22 +445,21 @@ return;

if (type === 56 && prevType === 140) {
context.splice(-2, 2, _context.types.j_cTag);
context.splice(-2, 2, tc.j_cTag);
this.state.canStartJSXElement = false;
} else if (type === 140) {
context.push(_context.types.j_oTag);
context.push(tc.j_oTag);
} else if (type === 141) {
const out = context[context.length - 1];
if (out === _context.types.j_oTag && prevType === 56 || out === _context.types.j_cTag) {
if (out === tc.j_oTag && prevType === 56 || out === tc.j_cTag) {
context.pop();
this.state.canStartJSXElement = context[context.length - 1] === _context.types.j_expr;
this.state.canStartJSXElement = context[context.length - 1] === tc.j_expr;
} else {
this.setContext(_context.types.j_expr);
this.setContext(tc.j_expr);
this.state.canStartJSXElement = true;
}
} else {
this.state.canStartJSXElement = (0, _types.tokenComesBeforeExpression)(type);
this.state.canStartJSXElement = tokenComesBeforeExpression(type);
}
}
};
exports.default = _default;
});
//# sourceMappingURL=index.js.map

@@ -1,7 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const entities = {

@@ -263,5 +257,4 @@ __proto__: null,

};
var _default = entities;
exports.default = _default;
export default entities;
//# sourceMappingURL=xhtml.js.map

@@ -1,14 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _types = require("../tokenizer/types");
var _parseError = require("../parse-error");
const PlaceholderErrors = (0, _parseError.ParseErrorEnum)`placeholders`({
import { tokenLabelName, tt } from "../tokenizer/types.js";
import { ParseErrorEnum } from "../parse-error.js";
const PlaceholderErrors = ParseErrorEnum`placeholders`({
ClassNameIsRequired: "A class name is required.",
UnexpectedSpace: "Unexpected space in placeholder."
});
var _default = superClass => class PlaceholdersParserMixin extends superClass {
export default (superClass => class PlaceholdersParserMixin extends superClass {
parsePlaceholder(expectedNode) {

@@ -76,3 +70,3 @@ if (this.match(142)) {

parseExpressionStatement(node, expr) {
if (expr.type !== "Placeholder" || expr.extra && expr.extra.parenthesized) {
if (expr.type !== "Placeholder" || expr.extra?.parenthesized) {
return super.parseExpressionStatement(node, expr);

@@ -140,3 +134,3 @@ }

if (this.isUnparsedContextual(next, "from")) {
if (this.input.startsWith((0, _types.tokenLabelName)(142), this.nextTokenStartSince(next + 4))) {
if (this.input.startsWith(tokenLabelName(142), this.nextTokenStartSince(next + 4))) {
return true;

@@ -149,4 +143,3 @@ }

maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
var _specifiers;
if ((_specifiers = node.specifiers) != null && _specifiers.length) {
if (node.specifiers?.length) {
return true;

@@ -160,3 +153,3 @@ }

} = node;
if (specifiers != null && specifiers.length) {
if (specifiers?.length) {
node.specifiers = specifiers.filter(node => node.exported.type === "Placeholder");

@@ -198,5 +191,4 @@ }

}
};
exports.default = _default;
});
//# sourceMappingURL=placeholders.js.map

@@ -1,25 +0,13 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _scope = require("../../util/scope");
var _scopeflags = require("../../util/scopeflags");
var _parseError = require("../../parse-error");
class TypeScriptScope extends _scope.Scope {
constructor(...args) {
super(...args);
this.types = new Set();
this.enums = new Set();
this.constEnums = new Set();
this.classes = new Set();
this.exportOnlyBindings = new Set();
}
import ScopeHandler, { Scope } from "../../util/scope.js";
import { BindingFlag, ScopeFlag } from "../../util/scopeflags.js";
import { Errors } from "../../parse-error.js";
class TypeScriptScope extends Scope {
types = new Set();
enums = new Set();
constEnums = new Set();
classes = new Set();
exportOnlyBindings = new Set();
}
class TypeScriptScopeHandler extends _scope.default {
constructor(...args) {
super(...args);
this.importsStack = [];
}
export default class TypeScriptScopeHandler extends ScopeHandler {
importsStack = [];
createScope(flags) {

@@ -30,3 +18,3 @@ this.importsStack.push(new Set());

enter(flags) {
if (flags == _scopeflags.SCOPE_TS_MODULE) {
if (flags == ScopeFlag.TS_MODULE) {
this.importsStack.push(new Set());

@@ -38,3 +26,3 @@ }

const flags = super.exit();
if (flags == _scopeflags.SCOPE_TS_MODULE) {
if (flags == ScopeFlag.TS_MODULE) {
this.importsStack.pop();

@@ -57,5 +45,5 @@ }

declareName(name, bindingType, loc) {
if (bindingType & _scopeflags.BIND_FLAGS_TS_IMPORT) {
if (bindingType & BindingFlag.FLAG_TS_IMPORT) {
if (this.hasImport(name, true)) {
this.parser.raise(_parseError.Errors.VarRedeclaration, {
this.parser.raise(Errors.VarRedeclaration, {
at: loc,

@@ -69,3 +57,3 @@ identifierName: name

const scope = this.currentScope();
if (bindingType & _scopeflags.BIND_FLAGS_TS_EXPORT_ONLY) {
if (bindingType & BindingFlag.FLAG_TS_EXPORT_ONLY) {
this.maybeExportDefined(scope, name);

@@ -76,4 +64,4 @@ scope.exportOnlyBindings.add(name);

super.declareName(name, bindingType, loc);
if (bindingType & _scopeflags.BIND_KIND_TYPE) {
if (!(bindingType & _scopeflags.BIND_KIND_VALUE)) {
if (bindingType & BindingFlag.KIND_TYPE) {
if (!(bindingType & BindingFlag.KIND_VALUE)) {
this.checkRedeclarationInScope(scope, name, bindingType, loc);

@@ -84,10 +72,12 @@ this.maybeExportDefined(scope, name);

}
if (bindingType & _scopeflags.BIND_FLAGS_TS_ENUM) scope.enums.add(name);
if (bindingType & _scopeflags.BIND_FLAGS_TS_CONST_ENUM) scope.constEnums.add(name);
if (bindingType & _scopeflags.BIND_FLAGS_CLASS) scope.classes.add(name);
if (bindingType & BindingFlag.FLAG_TS_ENUM) scope.enums.add(name);
if (bindingType & BindingFlag.FLAG_TS_CONST_ENUM) {
scope.constEnums.add(name);
}
if (bindingType & BindingFlag.FLAG_CLASS) scope.classes.add(name);
}
isRedeclaredInScope(scope, name, bindingType) {
if (scope.enums.has(name)) {
if (bindingType & _scopeflags.BIND_FLAGS_TS_ENUM) {
const isConst = !!(bindingType & _scopeflags.BIND_FLAGS_TS_CONST_ENUM);
if (bindingType & BindingFlag.FLAG_TS_ENUM) {
const isConst = !!(bindingType & BindingFlag.FLAG_TS_CONST_ENUM);
const wasConst = scope.constEnums.has(name);

@@ -98,5 +88,5 @@ return isConst !== wasConst;

}
if (bindingType & _scopeflags.BIND_FLAGS_CLASS && scope.classes.has(name)) {
if (bindingType & BindingFlag.FLAG_CLASS && scope.classes.has(name)) {
if (scope.lexical.has(name)) {
return !!(bindingType & _scopeflags.BIND_KIND_VALUE);
return !!(bindingType & BindingFlag.KIND_VALUE);
} else {

@@ -106,3 +96,3 @@ return false;

}
if (bindingType & _scopeflags.BIND_KIND_TYPE && scope.types.has(name)) {
if (bindingType & BindingFlag.KIND_TYPE && scope.types.has(name)) {
return true;

@@ -125,4 +115,3 @@ }

}
exports.default = TypeScriptScopeHandler;
//# sourceMappingURL=scope.js.map

@@ -1,9 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _types = require("../tokenizer/types");
var _default = superClass => class V8IntrinsicMixin extends superClass {
import { tokenIsIdentifier, tt } from "../tokenizer/types.js";
export default (superClass => class V8IntrinsicMixin extends superClass {
parseV8Intrinsic() {

@@ -14,3 +8,3 @@ if (this.match(54)) {

this.next();
if ((0, _types.tokenIsIdentifier)(this.state.type)) {
if (tokenIsIdentifier(this.state.type)) {
const name = this.parseIdentifierName();

@@ -29,5 +23,4 @@ const identifier = this.createIdentifier(node, name);

}
};
exports.default = _default;
});
//# sourceMappingURL=v8intrinsic.js.map

@@ -1,16 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.types = exports.TokContext = void 0;
class TokContext {
export class TokContext {
constructor(token, preserveSpace) {
this.token = void 0;
this.preserveSpace = void 0;
this.token = token;
this.preserveSpace = !!preserveSpace;
}
token;
preserveSpace;
}
exports.TokContext = TokContext;
const types = {

@@ -22,7 +15,5 @@ brace: new TokContext("{"),

};
exports.types = types;
{
types.template = new TokContext("`", true);
}
;
export { types };
//# sourceMappingURL=context.js.map

@@ -1,23 +0,17 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.Token = void 0;
var _location = require("../util/location");
var _comments = require("../parser/comments");
var _identifier = require("../util/identifier");
var _types = require("./types");
var _parseError = require("../parse-error");
var _whitespace = require("../util/whitespace");
var _state = require("./state");
var _helperStringParser = require("@babel/helper-string-parser");
const _excluded = ["at"],
_excluded2 = ["at"];
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import { Position, SourceLocation, createPositionWithColumnOffset } from "../util/location.js";
import CommentsParser from "../parser/comments.js";
import { isIdentifierStart, isIdentifierChar } from "../util/identifier.js";
import { tokenIsKeyword, tokenLabelName, tt, keywords as keywordTypes } from "./types.js";
import { Errors } from "../parse-error.js";
import { lineBreakG, isNewLine, isWhitespace, skipWhiteSpace, skipWhiteSpaceInLine } from "../util/whitespace.js";
import State from "./state.js";
import { readInt, readCodePoint, readStringContents } from "@babel/helper-string-parser";
function buildPosition(pos, lineStart, curLine) {
return new _location.Position(curLine, pos - lineStart, pos);
return new Position(curLine, pos - lineStart, pos);
}
const VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100, 118]);
class Token {
export class Token {
constructor(state) {

@@ -28,48 +22,11 @@ this.type = state.type;

this.end = state.end;
this.loc = new _location.SourceLocation(state.startLoc, state.endLoc);
this.loc = new SourceLocation(state.startLoc, state.endLoc);
}
}
exports.Token = Token;
class Tokenizer extends _comments.default {
export default class Tokenizer extends CommentsParser {
isLookahead;
tokens = [];
constructor(options, input) {
super();
this.isLookahead = void 0;
this.tokens = [];
this.errorHandlers_readInt = {
invalidDigit: (pos, lineStart, curLine, radix) => {
if (!this.options.errorRecovery) return false;
this.raise(_parseError.Errors.InvalidDigit, {
at: buildPosition(pos, lineStart, curLine),
radix
});
return true;
},
numericSeparatorInEscapeSequence: this.errorBuilder(_parseError.Errors.NumericSeparatorInEscapeSequence),
unexpectedNumericSeparator: this.errorBuilder(_parseError.Errors.UnexpectedNumericSeparator)
};
this.errorHandlers_readCodePoint = Object.assign({}, this.errorHandlers_readInt, {
invalidEscapeSequence: this.errorBuilder(_parseError.Errors.InvalidEscapeSequence),
invalidCodePoint: this.errorBuilder(_parseError.Errors.InvalidCodePoint)
});
this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
strictNumericEscape: (pos, lineStart, curLine) => {
this.recordStrictModeErrors(_parseError.Errors.StrictNumericEscape, {
at: buildPosition(pos, lineStart, curLine)
});
},
unterminated: (pos, lineStart, curLine) => {
throw this.raise(_parseError.Errors.UnterminatedString, {
at: buildPosition(pos - 1, lineStart, curLine)
});
}
});
this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
strictNumericEscape: this.errorBuilder(_parseError.Errors.StrictNumericEscape),
unterminated: (pos, lineStart, curLine) => {
throw this.raise(_parseError.Errors.UnterminatedTemplate, {
at: buildPosition(pos, lineStart, curLine)
});
}
});
this.state = new _state.default();
this.state = new State();
this.state.init(options);

@@ -136,4 +93,4 @@ this.input = input;

nextTokenStartSince(pos) {
_whitespace.skipWhiteSpace.lastIndex = pos;
return _whitespace.skipWhiteSpace.test(this.input) ? _whitespace.skipWhiteSpace.lastIndex : pos;
skipWhiteSpace.lastIndex = pos;
return skipWhiteSpace.test(this.input) ? skipWhiteSpace.lastIndex : pos;
}

@@ -147,4 +104,4 @@ lookaheadCharCode() {

nextTokenInLineStartSince(pos) {
_whitespace.skipWhiteSpaceInLine.lastIndex = pos;
return _whitespace.skipWhiteSpaceInLine.test(this.input) ? _whitespace.skipWhiteSpaceInLine.lastIndex : pos;
skipWhiteSpaceInLine.lastIndex = pos;
return skipWhiteSpaceInLine.test(this.input) ? skipWhiteSpaceInLine.lastIndex : pos;
}

@@ -192,3 +149,3 @@ lookaheadInLineCharCode() {

if (end === -1) {
throw this.raise(_parseError.Errors.UnterminatedComment, {
throw this.raise(Errors.UnterminatedComment, {
at: this.state.curPosition()

@@ -198,6 +155,6 @@ });

this.state.pos = end + commentEnd.length;
_whitespace.lineBreakG.lastIndex = start + 2;
while (_whitespace.lineBreakG.test(this.input) && _whitespace.lineBreakG.lastIndex <= end) {
lineBreakG.lastIndex = start + 2;
while (lineBreakG.test(this.input) && lineBreakG.lastIndex <= end) {
++this.state.curLine;
this.state.lineStart = _whitespace.lineBreakG.lastIndex;
this.state.lineStart = lineBreakG.lastIndex;
}

@@ -210,3 +167,3 @@ if (this.isLookahead) return;

end: end + commentEnd.length,
loc: new _location.SourceLocation(startLoc, this.state.curPosition())
loc: new SourceLocation(startLoc, this.state.curPosition())
};

@@ -222,3 +179,3 @@ if (this.options.tokens) this.pushToken(comment);

if (this.state.pos < this.length) {
while (!(0, _whitespace.isNewLine)(ch) && ++this.state.pos < this.length) {
while (!isNewLine(ch) && ++this.state.pos < this.length) {
ch = this.input.charCodeAt(this.state.pos);

@@ -235,3 +192,3 @@ }

end,
loc: new _location.SourceLocation(startLoc, this.state.curPosition())
loc: new SourceLocation(startLoc, this.state.curPosition())
};

@@ -288,3 +245,3 @@ if (this.options.tokens) this.pushToken(comment);

default:
if ((0, _whitespace.isWhitespace)(ch)) {
if (isWhitespace(ch)) {
++this.state.pos;

@@ -352,3 +309,3 @@ } else if (ch === 45 && !this.inModule && this.options.annexB) {

if (next >= 48 && next <= 57) {
throw this.raise(_parseError.Errors.UnexpectedDigitAfterHash, {
throw this.raise(Errors.UnexpectedDigitAfterHash, {
at: this.state.curPosition()

@@ -360,3 +317,3 @@ });

if (this.getPluginOption("recordAndTuple", "syntaxType") === "bar") {
throw this.raise(next === 123 ? _parseError.Errors.RecordExpressionHashIncorrectStartSyntaxType : _parseError.Errors.TupleExpressionHashIncorrectStartSyntaxType, {
throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, {
at: this.state.curPosition()

@@ -371,3 +328,3 @@ });

}
} else if ((0, _identifier.isIdentifierStart)(next)) {
} else if (isIdentifierStart(next)) {
++this.state.pos;

@@ -410,3 +367,3 @@ this.finishToken(136, this.readWord1(next));

this.state.pos += 1;
while (!(0, _whitespace.isNewLine)(ch) && ++this.state.pos < this.length) {
while (!isNewLine(ch) && ++this.state.pos < this.length) {
ch = this.input.charCodeAt(this.state.pos);

@@ -450,3 +407,3 @@ }

if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
throw this.raise(_parseError.Errors.RecordExpressionBarIncorrectEndSyntaxType, {
throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, {
at: this.state.curPosition()

@@ -461,3 +418,3 @@ });

if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
throw this.raise(_parseError.Errors.TupleExpressionBarIncorrectEndSyntaxType, {
throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, {
at: this.state.curPosition()

@@ -610,3 +567,3 @@ });

if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
throw this.raise(_parseError.Errors.TupleExpressionBarIncorrectStartSyntaxType, {
throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, {
at: this.state.curPosition()

@@ -629,3 +586,3 @@ });

if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
throw this.raise(_parseError.Errors.RecordExpressionBarIncorrectStartSyntaxType, {
throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, {
at: this.state.curPosition()

@@ -731,3 +688,3 @@ });

default:
if ((0, _identifier.isIdentifierStart)(code)) {
if (isIdentifierStart(code)) {
this.readWord(code);

@@ -737,3 +694,3 @@ return;

}
throw this.raise(_parseError.Errors.InvalidOrUnexpectedToken, {
throw this.raise(Errors.InvalidOrUnexpectedToken, {
at: this.state.curPosition(),

@@ -757,10 +714,10 @@ unexpected: String.fromCodePoint(code)

if (pos >= this.length) {
throw this.raise(_parseError.Errors.UnterminatedRegExp, {
at: (0, _location.createPositionWithColumnOffset)(startLoc, 1)
throw this.raise(Errors.UnterminatedRegExp, {
at: createPositionWithColumnOffset(startLoc, 1)
});
}
const ch = this.input.charCodeAt(pos);
if ((0, _whitespace.isNewLine)(ch)) {
throw this.raise(_parseError.Errors.UnterminatedRegExp, {
at: (0, _location.createPositionWithColumnOffset)(startLoc, 1)
if (isNewLine(ch)) {
throw this.raise(Errors.UnterminatedRegExp, {
at: createPositionWithColumnOffset(startLoc, 1)
});

@@ -784,3 +741,3 @@ }

let mods = "";
const nextPos = () => (0, _location.createPositionWithColumnOffset)(startLoc, pos + 2 - start);
const nextPos = () => createPositionWithColumnOffset(startLoc, pos + 2 - start);
while (pos < this.length) {

@@ -792,3 +749,3 @@ const cp = this.codePointAtPos(pos);

if (mods.includes("u")) {
this.raise(_parseError.Errors.IncompatibleRegExpUVFlags, {
this.raise(Errors.IncompatibleRegExpUVFlags, {
at: nextPos()

@@ -799,3 +756,3 @@ });

if (mods.includes("v")) {
this.raise(_parseError.Errors.IncompatibleRegExpUVFlags, {
this.raise(Errors.IncompatibleRegExpUVFlags, {
at: nextPos()

@@ -806,8 +763,8 @@ });

if (mods.includes(char)) {
this.raise(_parseError.Errors.DuplicateRegExpFlags, {
this.raise(Errors.DuplicateRegExpFlags, {
at: nextPos()
});
}
} else if ((0, _identifier.isIdentifierChar)(cp) || cp === 92) {
this.raise(_parseError.Errors.MalformedRegExpFlags, {
} else if (isIdentifierChar(cp) || cp === 92) {
this.raise(Errors.MalformedRegExpFlags, {
at: nextPos()

@@ -831,3 +788,3 @@ });

pos
} = (0, _helperStringParser.readInt)(this.input, this.state.pos, this.state.lineStart, this.state.curLine, radix, len, forceLen, allowNumSeparator, this.errorHandlers_readInt, false);
} = readInt(this.input, this.state.pos, this.state.lineStart, this.state.curLine, radix, len, forceLen, allowNumSeparator, this.errorHandlers_readInt, false);
this.state.pos = pos;

@@ -842,4 +799,4 @@ return n;

if (val == null) {
this.raise(_parseError.Errors.InvalidDigit, {
at: (0, _location.createPositionWithColumnOffset)(startLoc, 2),
this.raise(Errors.InvalidDigit, {
at: createPositionWithColumnOffset(startLoc, 2),
radix

@@ -853,8 +810,8 @@ });

} else if (next === 109) {
throw this.raise(_parseError.Errors.InvalidDecimal, {
throw this.raise(Errors.InvalidDecimal, {
at: startLoc
});
}
if ((0, _identifier.isIdentifierStart)(this.codePointAtPos(this.state.pos))) {
throw this.raise(_parseError.Errors.NumberIdentifier, {
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
throw this.raise(Errors.NumberIdentifier, {
at: this.state.curPosition()

@@ -879,3 +836,3 @@ });

if (!startsWithDot && this.readInt(10) === null) {
this.raise(_parseError.Errors.InvalidNumber, {
this.raise(Errors.InvalidNumber, {
at: this.state.curPosition()

@@ -887,3 +844,3 @@ });

const integer = this.input.slice(start, this.state.pos);
this.recordStrictModeErrors(_parseError.Errors.StrictOctalLiteral, {
this.recordStrictModeErrors(Errors.StrictOctalLiteral, {
at: startLoc

@@ -894,4 +851,4 @@ });

if (underscorePos > 0) {
this.raise(_parseError.Errors.ZeroDigitNumericSeparator, {
at: (0, _location.createPositionWithColumnOffset)(startLoc, underscorePos)
this.raise(Errors.ZeroDigitNumericSeparator, {
at: createPositionWithColumnOffset(startLoc, underscorePos)
});

@@ -915,3 +872,3 @@ }

if (this.readInt(10) === null) {
this.raise(_parseError.Errors.InvalidOrMissingExponent, {
this.raise(Errors.InvalidOrMissingExponent, {
at: startLoc

@@ -926,3 +883,3 @@ });

if (isFloat || hasLeadingZero) {
this.raise(_parseError.Errors.InvalidBigIntLiteral, {
this.raise(Errors.InvalidBigIntLiteral, {
at: startLoc

@@ -937,3 +894,3 @@ });

if (hasExponent || hasLeadingZero) {
this.raise(_parseError.Errors.InvalidDecimal, {
this.raise(Errors.InvalidDecimal, {
at: startLoc

@@ -945,4 +902,4 @@ });

}
if ((0, _identifier.isIdentifierStart)(this.codePointAtPos(this.state.pos))) {
throw this.raise(_parseError.Errors.NumberIdentifier, {
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
throw this.raise(Errors.NumberIdentifier, {
at: this.state.curPosition()

@@ -967,3 +924,3 @@ });

pos
} = (0, _helperStringParser.readCodePoint)(this.input, this.state.pos, this.state.lineStart, this.state.curLine, throwOnInvalid, this.errorHandlers_readCodePoint);
} = readCodePoint(this.input, this.state.pos, this.state.lineStart, this.state.curLine, throwOnInvalid, this.errorHandlers_readCodePoint);
this.state.pos = pos;

@@ -978,3 +935,3 @@ return code;

lineStart
} = (0, _helperStringParser.readStringContents)(quote === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
} = readStringContents(quote === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
this.state.pos = pos + 1;

@@ -1000,3 +957,3 @@ this.state.lineStart = lineStart;

lineStart
} = (0, _helperStringParser.readStringContents)("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
} = readStringContents("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
this.state.pos = pos + 1;

@@ -1006,3 +963,3 @@ this.state.lineStart = lineStart;

if (firstInvalidLoc) {
this.state.firstInvalidTemplateEscapePos = new _location.Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, firstInvalidLoc.pos);
this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, firstInvalidLoc.pos);
}

@@ -1038,3 +995,3 @@ if (this.input.codePointAt(pos) === 96) {

const ch = this.codePointAtPos(this.state.pos);
if ((0, _identifier.isIdentifierChar)(ch)) {
if (isIdentifierChar(ch)) {
this.state.pos += ch <= 0xffff ? 1 : 2;

@@ -1045,5 +1002,5 @@ } else if (ch === 92) {

const escStart = this.state.curPosition();
const identifierCheck = this.state.pos === start ? _identifier.isIdentifierStart : _identifier.isIdentifierChar;
const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar;
if (this.input.charCodeAt(++this.state.pos) !== 117) {
this.raise(_parseError.Errors.MissingUnicodeEscape, {
this.raise(Errors.MissingUnicodeEscape, {
at: this.state.curPosition()

@@ -1058,3 +1015,3 @@ });

if (!identifierCheck(esc)) {
this.raise(_parseError.Errors.EscapedCharNotAnIdentifier, {
this.raise(Errors.EscapedCharNotAnIdentifier, {
at: escStart

@@ -1074,5 +1031,5 @@ });

const word = this.readWord1(firstCode);
const type = _types.keywords.get(word);
const type = keywordTypes.get(word);
if (type !== undefined) {
this.finishToken(type, (0, _types.tokenLabelName)(type));
this.finishToken(type, tokenLabelName(type));
} else {

@@ -1086,6 +1043,6 @@ this.finishToken(130, word);

} = this.state;
if ((0, _types.tokenIsKeyword)(type) && this.state.containsEsc) {
this.raise(_parseError.Errors.InvalidEscapedReservedWord, {
if (tokenIsKeyword(type) && this.state.containsEsc) {
this.raise(Errors.InvalidEscapedReservedWord, {
at: this.state.startLoc,
reservedWord: (0, _types.tokenLabelName)(type)
reservedWord: tokenLabelName(type)
});

@@ -1099,3 +1056,3 @@ }

details = _objectWithoutPropertiesLoose(raiseProperties, _excluded);
const loc = at instanceof _location.Position ? at : at.loc.start;
const loc = at instanceof Position ? at : at.loc.start;
const error = toParseError({

@@ -1114,3 +1071,3 @@ loc,

details = _objectWithoutPropertiesLoose(raiseProperties, _excluded2);
const loc = at instanceof _location.Position ? at : at.loc.start;
const loc = at instanceof Position ? at : at.loc.start;
const pos = loc.index;

@@ -1132,4 +1089,4 @@ const errors = this.state.errors;

unexpected(loc, type) {
throw this.raise(_parseError.Errors.UnexpectedToken, {
expected: type ? (0, _types.tokenLabelName)(type) : null,
throw this.raise(Errors.UnexpectedToken, {
expected: type ? tokenLabelName(type) : null,
at: loc != null ? loc : this.state.startLoc

@@ -1142,3 +1099,3 @@ });

}
throw this.raise(_parseError.Errors.MissingPlugin, {
throw this.raise(Errors.MissingPlugin, {
at: loc != null ? loc : this.state.startLoc,

@@ -1150,3 +1107,3 @@ missingPlugin: [pluginName]

if (!pluginNames.some(name => this.hasPlugin(name))) {
throw this.raise(_parseError.Errors.MissingOneOfPlugins, {
throw this.raise(Errors.MissingOneOfPlugins, {
at: this.state.startLoc,

@@ -1164,5 +1121,40 @@ missingPlugin: pluginNames

}
errorHandlers_readInt = {
invalidDigit: (pos, lineStart, curLine, radix) => {
if (!this.options.errorRecovery) return false;
this.raise(Errors.InvalidDigit, {
at: buildPosition(pos, lineStart, curLine),
radix
});
return true;
},
numericSeparatorInEscapeSequence: this.errorBuilder(Errors.NumericSeparatorInEscapeSequence),
unexpectedNumericSeparator: this.errorBuilder(Errors.UnexpectedNumericSeparator)
};
errorHandlers_readCodePoint = Object.assign({}, this.errorHandlers_readInt, {
invalidEscapeSequence: this.errorBuilder(Errors.InvalidEscapeSequence),
invalidCodePoint: this.errorBuilder(Errors.InvalidCodePoint)
});
errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
strictNumericEscape: (pos, lineStart, curLine) => {
this.recordStrictModeErrors(Errors.StrictNumericEscape, {
at: buildPosition(pos, lineStart, curLine)
});
},
unterminated: (pos, lineStart, curLine) => {
throw this.raise(Errors.UnterminatedString, {
at: buildPosition(pos - 1, lineStart, curLine)
});
}
});
errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
unterminated: (pos, lineStart, curLine) => {
throw this.raise(Errors.UnterminatedTemplate, {
at: buildPosition(pos, lineStart, curLine)
});
}
});
}
exports.default = Tokenizer;
//# sourceMappingURL=index.js.map

@@ -1,52 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _location = require("../util/location");
var _context = require("./context");
var _types = require("./types");
class State {
constructor() {
this.strict = void 0;
this.curLine = void 0;
this.lineStart = void 0;
this.startLoc = void 0;
this.endLoc = void 0;
this.errors = [];
this.potentialArrowAt = -1;
this.noArrowAt = [];
this.noArrowParamsConversionAt = [];
this.maybeInArrowParameters = false;
this.inType = false;
this.noAnonFunctionType = false;
this.hasFlowComment = false;
this.isAmbientContext = false;
this.inAbstractClass = false;
this.inDisallowConditionalTypesContext = false;
this.topicContext = {
maxNumOfResolvableTopics: 0,
maxTopicIndex: null
};
this.soloAwait = false;
this.inFSharpPipelineDirectBody = false;
this.labels = [];
this.comments = [];
this.commentStack = [];
this.pos = 0;
this.type = 137;
this.value = null;
this.start = 0;
this.end = 0;
this.lastTokEndLoc = null;
this.lastTokStartLoc = null;
this.lastTokStart = 0;
this.context = [_context.types.brace];
this.canStartJSXElement = true;
this.containsEsc = false;
this.firstInvalidTemplateEscapePos = null;
this.strictErrors = new Map();
this.tokensLength = 0;
}
import { Position } from "../util/location.js";
import { types as ct } from "./context.js";
import { tt } from "./types.js";
export default class State {
strict;
curLine;
lineStart;
startLoc;
endLoc;
init({

@@ -61,6 +19,40 @@ strictMode,

this.lineStart = -startColumn;
this.startLoc = this.endLoc = new _location.Position(startLine, startColumn, 0);
this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
}
errors = [];
potentialArrowAt = -1;
noArrowAt = [];
noArrowParamsConversionAt = [];
maybeInArrowParameters = false;
inType = false;
noAnonFunctionType = false;
hasFlowComment = false;
isAmbientContext = false;
inAbstractClass = false;
inDisallowConditionalTypesContext = false;
topicContext = {
maxNumOfResolvableTopics: 0,
maxTopicIndex: null
};
soloAwait = false;
inFSharpPipelineDirectBody = false;
labels = [];
comments = [];
commentStack = [];
pos = 0;
type = 137;
value = null;
start = 0;
end = 0;
lastTokEndLoc = null;
lastTokStartLoc = null;
lastTokStart = 0;
context = [ct.brace];
canStartJSXElement = true;
containsEsc = false;
firstInvalidTemplateEscapePos = null;
strictErrors = new Map();
tokensLength = 0;
curPosition() {
return new _location.Position(this.curLine, this.pos - this.lineStart, this.pos);
return new Position(this.curLine, this.pos - this.lineStart, this.pos);
}

@@ -81,4 +73,3 @@ clone(skipArrays) {

}
exports.default = State;
//# sourceMappingURL=state.js.map

@@ -1,32 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ExportedTokenType = void 0;
exports.getExportedToken = getExportedToken;
exports.isTokenType = isTokenType;
exports.keywords = void 0;
exports.tokenCanStartExpression = tokenCanStartExpression;
exports.tokenComesBeforeExpression = tokenComesBeforeExpression;
exports.tokenIsAssignment = tokenIsAssignment;
exports.tokenIsBinaryOperator = tokenIsBinaryOperator;
exports.tokenIsFlowInterfaceOrTypeOrOpaque = tokenIsFlowInterfaceOrTypeOrOpaque;
exports.tokenIsIdentifier = tokenIsIdentifier;
exports.tokenIsKeyword = tokenIsKeyword;
exports.tokenIsKeywordOrIdentifier = tokenIsKeywordOrIdentifier;
exports.tokenIsLiteralPropertyName = tokenIsLiteralPropertyName;
exports.tokenIsLoop = tokenIsLoop;
exports.tokenIsOperator = tokenIsOperator;
exports.tokenIsPostfix = tokenIsPostfix;
exports.tokenIsPrefix = tokenIsPrefix;
exports.tokenIsRightAssociative = tokenIsRightAssociative;
exports.tokenIsTSDeclarationStart = tokenIsTSDeclarationStart;
exports.tokenIsTSTypeOperator = tokenIsTSTypeOperator;
exports.tokenIsTemplate = tokenIsTemplate;
exports.tokenKeywordOrIdentifierIsKeyword = tokenKeywordOrIdentifierIsKeyword;
exports.tokenLabelName = tokenLabelName;
exports.tokenOperatorPrecedence = tokenOperatorPrecedence;
exports.tt = exports.tokenTypes = void 0;
var _context = require("./context");
import { types as tc } from "./context.js";
const beforeExpr = true;

@@ -38,14 +8,14 @@ const startsExpr = true;

const postfix = true;
class ExportedTokenType {
export class ExportedTokenType {
label;
keyword;
beforeExpr;
startsExpr;
rightAssociative;
isLoop;
isAssign;
prefix;
postfix;
binop;
constructor(label, conf = {}) {
this.label = void 0;
this.keyword = void 0;
this.beforeExpr = void 0;
this.startsExpr = void 0;
this.rightAssociative = void 0;
this.isLoop = void 0;
this.isAssign = void 0;
this.prefix = void 0;
this.postfix = void 0;
this.binop = void 0;
this.label = label;

@@ -61,10 +31,6 @@ this.keyword = conf.keyword;

this.binop = conf.binop != null ? conf.binop : null;
{
this.updateContext = null;
}
;
}
}
exports.ExportedTokenType = ExportedTokenType;
const keywords = new Map();
exports.keywords = keywords;
export const keywords = new Map();
function createKeyword(name, options = {}) {

@@ -83,4 +49,3 @@ options.keyword = name;

let tokenTypeCounter = -1;
const tokenTypes = [];
exports.tokenTypes = tokenTypes;
export const tokenTypes = [];
const tokenLabels = [];

@@ -92,9 +57,8 @@ const tokenBinops = [];

function createToken(name, options = {}) {
var _options$binop, _options$beforeExpr, _options$startsExpr, _options$prefix;
++tokenTypeCounter;
tokenLabels.push(name);
tokenBinops.push((_options$binop = options.binop) != null ? _options$binop : -1);
tokenBeforeExprs.push((_options$beforeExpr = options.beforeExpr) != null ? _options$beforeExpr : false);
tokenStartsExprs.push((_options$startsExpr = options.startsExpr) != null ? _options$startsExpr : false);
tokenPrefixes.push((_options$prefix = options.prefix) != null ? _options$prefix : false);
tokenBinops.push(options.binop ?? -1);
tokenBeforeExprs.push(options.beforeExpr ?? false);
tokenStartsExprs.push(options.startsExpr ?? false);
tokenPrefixes.push(options.prefix ?? false);
tokenTypes.push(new ExportedTokenType(name, options));

@@ -104,14 +68,13 @@ return tokenTypeCounter;

function createKeywordLike(name, options = {}) {
var _options$binop2, _options$beforeExpr2, _options$startsExpr2, _options$prefix2;
++tokenTypeCounter;
keywords.set(name, tokenTypeCounter);
tokenLabels.push(name);
tokenBinops.push((_options$binop2 = options.binop) != null ? _options$binop2 : -1);
tokenBeforeExprs.push((_options$beforeExpr2 = options.beforeExpr) != null ? _options$beforeExpr2 : false);
tokenStartsExprs.push((_options$startsExpr2 = options.startsExpr) != null ? _options$startsExpr2 : false);
tokenPrefixes.push((_options$prefix2 = options.prefix) != null ? _options$prefix2 : false);
tokenBinops.push(options.binop ?? -1);
tokenBeforeExprs.push(options.beforeExpr ?? false);
tokenStartsExprs.push(options.startsExpr ?? false);
tokenPrefixes.push(options.prefix ?? false);
tokenTypes.push(new ExportedTokenType("name", options));
return tokenTypeCounter;
}
const tt = {
export const tt = {
bracketL: createToken("[", {

@@ -505,88 +468,70 @@ beforeExpr,

};
exports.tt = tt;
function tokenIsIdentifier(token) {
export function tokenIsIdentifier(token) {
return token >= 93 && token <= 130;
}
function tokenKeywordOrIdentifierIsKeyword(token) {
export function tokenKeywordOrIdentifierIsKeyword(token) {
return token <= 92;
}
function tokenIsKeywordOrIdentifier(token) {
export function tokenIsKeywordOrIdentifier(token) {
return token >= 58 && token <= 130;
}
function tokenIsLiteralPropertyName(token) {
export function tokenIsLiteralPropertyName(token) {
return token >= 58 && token <= 134;
}
function tokenComesBeforeExpression(token) {
export function tokenComesBeforeExpression(token) {
return tokenBeforeExprs[token];
}
function tokenCanStartExpression(token) {
export function tokenCanStartExpression(token) {
return tokenStartsExprs[token];
}
function tokenIsAssignment(token) {
export function tokenIsAssignment(token) {
return token >= 29 && token <= 33;
}
function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
export function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
return token >= 127 && token <= 129;
}
function tokenIsLoop(token) {
export function tokenIsLoop(token) {
return token >= 90 && token <= 92;
}
function tokenIsKeyword(token) {
export function tokenIsKeyword(token) {
return token >= 58 && token <= 92;
}
function tokenIsOperator(token) {
export function tokenIsOperator(token) {
return token >= 39 && token <= 59;
}
function tokenIsPostfix(token) {
export function tokenIsPostfix(token) {
return token === 34;
}
function tokenIsPrefix(token) {
export function tokenIsPrefix(token) {
return tokenPrefixes[token];
}
function tokenIsTSTypeOperator(token) {
export function tokenIsTSTypeOperator(token) {
return token >= 119 && token <= 121;
}
function tokenIsTSDeclarationStart(token) {
export function tokenIsTSDeclarationStart(token) {
return token >= 122 && token <= 128;
}
function tokenLabelName(token) {
export function tokenLabelName(token) {
return tokenLabels[token];
}
function tokenOperatorPrecedence(token) {
export function tokenOperatorPrecedence(token) {
return tokenBinops[token];
}
function tokenIsBinaryOperator(token) {
export function tokenIsBinaryOperator(token) {
return tokenBinops[token] !== -1;
}
function tokenIsRightAssociative(token) {
export function tokenIsRightAssociative(token) {
return token === 57;
}
function tokenIsTemplate(token) {
export function tokenIsTemplate(token) {
return token >= 24 && token <= 25;
}
function getExportedToken(token) {
export function getExportedToken(token) {
return tokenTypes[token];
}
function isTokenType(obj) {
export function isTokenType(obj) {
return typeof obj === "number";
}
{
tokenTypes[8].updateContext = context => {
context.pop();
};
tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = context => {
context.push(_context.types.brace);
};
tokenTypes[22].updateContext = context => {
if (context[context.length - 1] === _context.types.template) {
context.pop();
} else {
context.push(_context.types.template);
}
};
tokenTypes[140].updateContext = context => {
context.push(_context.types.j_expr, _context.types.j_oTag);
};
}
;
//# sourceMappingURL=types.js.map

@@ -1,22 +0,13 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.ClassScope = void 0;
var _scopeflags = require("./scopeflags");
var _parseError = require("../parse-error");
class ClassScope {
constructor() {
this.privateNames = new Set();
this.loneAccessors = new Map();
this.undefinedPrivateNames = new Map();
}
import { ClassElementType } from "./scopeflags.js";
import { Errors } from "../parse-error.js";
export class ClassScope {
privateNames = new Set();
loneAccessors = new Map();
undefinedPrivateNames = new Map();
}
exports.ClassScope = ClassScope;
class ClassScopeHandler {
export default class ClassScopeHandler {
parser;
stack = [];
undefinedPrivateNames = new Map();
constructor(parser) {
this.parser = void 0;
this.stack = [];
this.undefinedPrivateNames = new Map();
this.parser = parser;

@@ -39,3 +30,3 @@ }

} else {
this.parser.raise(_parseError.Errors.InvalidPrivateFieldResolution, {
this.parser.raise(Errors.InvalidPrivateFieldResolution, {
at: loc,

@@ -54,9 +45,9 @@ identifierName: name

let redefined = privateNames.has(name);
if (elementType & _scopeflags.CLASS_ELEMENT_KIND_ACCESSOR) {
if (elementType & ClassElementType.KIND_ACCESSOR) {
const accessor = redefined && loneAccessors.get(name);
if (accessor) {
const oldStatic = accessor & _scopeflags.CLASS_ELEMENT_FLAG_STATIC;
const newStatic = elementType & _scopeflags.CLASS_ELEMENT_FLAG_STATIC;
const oldKind = accessor & _scopeflags.CLASS_ELEMENT_KIND_ACCESSOR;
const newKind = elementType & _scopeflags.CLASS_ELEMENT_KIND_ACCESSOR;
const oldStatic = accessor & ClassElementType.FLAG_STATIC;
const newStatic = elementType & ClassElementType.FLAG_STATIC;
const oldKind = accessor & ClassElementType.KIND_ACCESSOR;
const newKind = elementType & ClassElementType.KIND_ACCESSOR;
redefined = oldKind === newKind || oldStatic !== newStatic;

@@ -69,3 +60,3 @@ if (!redefined) loneAccessors.delete(name);

if (redefined) {
this.parser.raise(_parseError.Errors.PrivateNameRedeclaration, {
this.parser.raise(Errors.PrivateNameRedeclaration, {
at: loc,

@@ -86,3 +77,3 @@ identifierName: name

} else {
this.parser.raise(_parseError.Errors.InvalidPrivateFieldResolution, {
this.parser.raise(Errors.InvalidPrivateFieldResolution, {
at: loc,

@@ -94,4 +85,3 @@ identifierName: name

}
exports.default = ClassScopeHandler;
//# sourceMappingURL=class-scope.js.map

@@ -1,32 +0,17 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
exports.newArrowHeadScope = newArrowHeadScope;
exports.newAsyncArrowScope = newAsyncArrowScope;
exports.newExpressionScope = newExpressionScope;
exports.newParameterDeclarationScope = newParameterDeclarationScope;
var _parseError = require("../parse-error");
const kExpression = 0,
kMaybeArrowParameterDeclaration = 1,
kMaybeAsyncArrowParameterDeclaration = 2,
kParameterDeclaration = 3;
import { Errors } from "../parse-error.js";
class ExpressionScope {
constructor(type = kExpression) {
this.type = void 0;
constructor(type = 0) {
this.type = type;
}
canBeArrowParameterDeclaration() {
return this.type === kMaybeAsyncArrowParameterDeclaration || this.type === kMaybeArrowParameterDeclaration;
return this.type === 2 || this.type === 1;
}
isCertainlyParameterDeclaration() {
return this.type === kParameterDeclaration;
return this.type === 3;
}
}
class ArrowHeadParsingScope extends ExpressionScope {
declarationErrors = new Map();
constructor(type) {
super(type);
this.declarationErrors = new Map();
}

@@ -46,6 +31,6 @@ recordDeclarationError(ParsingErrorClass, {

}
class ExpressionScopeHandler {
export default class ExpressionScopeHandler {
parser;
stack = [new ExpressionScope()];
constructor(parser) {
this.parser = void 0;
this.stack = [new ExpressionScope()];
this.parser = parser;

@@ -107,4 +92,4 @@ }

while (scope.canBeArrowParameterDeclaration()) {
if (scope.type === kMaybeAsyncArrowParameterDeclaration) {
scope.recordDeclarationError(_parseError.Errors.AwaitBindingIdentifier, {
if (scope.type === 2) {
scope.recordDeclarationError(Errors.AwaitBindingIdentifier, {
at

@@ -135,13 +120,12 @@ });

}
exports.default = ExpressionScopeHandler;
function newParameterDeclarationScope() {
return new ExpressionScope(kParameterDeclaration);
export function newParameterDeclarationScope() {
return new ExpressionScope(3);
}
function newArrowHeadScope() {
return new ArrowHeadParsingScope(kMaybeArrowParameterDeclaration);
export function newArrowHeadScope() {
return new ArrowHeadParsingScope(1);
}
function newAsyncArrowScope() {
return new ArrowHeadParsingScope(kMaybeAsyncArrowParameterDeclaration);
export function newAsyncArrowScope() {
return new ArrowHeadParsingScope(2);
}
function newExpressionScope() {
export function newExpressionScope() {
return new ExpressionScope();

@@ -148,0 +132,0 @@ }

@@ -1,59 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.canBeReservedWord = canBeReservedWord;
Object.defineProperty(exports, "isIdentifierChar", {
enumerable: true,
get: function () {
return _helperValidatorIdentifier.isIdentifierChar;
}
});
Object.defineProperty(exports, "isIdentifierStart", {
enumerable: true,
get: function () {
return _helperValidatorIdentifier.isIdentifierStart;
}
});
exports.isIteratorStart = isIteratorStart;
Object.defineProperty(exports, "isKeyword", {
enumerable: true,
get: function () {
return _helperValidatorIdentifier.isKeyword;
}
});
Object.defineProperty(exports, "isReservedWord", {
enumerable: true,
get: function () {
return _helperValidatorIdentifier.isReservedWord;
}
});
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
enumerable: true,
get: function () {
return _helperValidatorIdentifier.isStrictBindOnlyReservedWord;
}
});
Object.defineProperty(exports, "isStrictBindReservedWord", {
enumerable: true,
get: function () {
return _helperValidatorIdentifier.isStrictBindReservedWord;
}
});
Object.defineProperty(exports, "isStrictReservedWord", {
enumerable: true,
get: function () {
return _helperValidatorIdentifier.isStrictReservedWord;
}
});
exports.keywordRelationalOperator = void 0;
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
const keywordRelationalOperator = /^in(stanceof)?$/;
exports.keywordRelationalOperator = keywordRelationalOperator;
function isIteratorStart(current, next, next2) {
return current === 64 && next === 64 && (0, _helperValidatorIdentifier.isIdentifierStart)(next2);
import { isIdentifierStart } from "@babel/helper-validator-identifier";
export { isIdentifierStart, isIdentifierChar, isReservedWord, isStrictBindOnlyReservedWord, isStrictBindReservedWord, isStrictReservedWord, isKeyword } from "@babel/helper-validator-identifier";
export const keywordRelationalOperator = /^in(stanceof)?$/;
export function isIteratorStart(current, next, next2) {
return current === 64 && next === 64 && isIdentifierStart(next2);
}
const reservedWordLikeSet = new Set(["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "eval", "arguments", "enum", "await"]);
function canBeReservedWord(word) {
export function canBeReservedWord(word) {
return reservedWordLikeSet.has(word);

@@ -60,0 +10,0 @@ }

@@ -1,13 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SourceLocation = exports.Position = void 0;
exports.createPositionWithColumnOffset = createPositionWithColumnOffset;
class Position {
export class Position {
line;
column;
index;
constructor(line, col, index) {
this.line = void 0;
this.column = void 0;
this.index = void 0;
this.line = line;

@@ -18,9 +11,8 @@ this.column = col;

}
exports.Position = Position;
class SourceLocation {
export class SourceLocation {
start;
end;
filename;
identifierName;
constructor(start, end) {
this.start = void 0;
this.end = void 0;
this.filename = void 0;
this.identifierName = void 0;
this.start = start;

@@ -30,4 +22,3 @@ this.end = end;

}
exports.SourceLocation = SourceLocation;
function createPositionWithColumnOffset(position, columnOffset) {
export function createPositionWithColumnOffset(position, columnOffset) {
const {

@@ -34,0 +25,0 @@ line,

@@ -1,9 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.PARAM_YIELD = exports.PARAM_RETURN = exports.PARAM_IN = exports.PARAM_AWAIT = exports.PARAM = void 0;
exports.functionFlags = functionFlags;
const PARAM = 0b0000,
export const PARAM = 0b0000,
PARAM_YIELD = 0b0001,

@@ -13,11 +6,4 @@ PARAM_AWAIT = 0b0010,

PARAM_IN = 0b1000;
exports.PARAM_IN = PARAM_IN;
exports.PARAM_RETURN = PARAM_RETURN;
exports.PARAM_AWAIT = PARAM_AWAIT;
exports.PARAM_YIELD = PARAM_YIELD;
exports.PARAM = PARAM;
class ProductionParameterHandler {
constructor() {
this.stacks = [];
}
export default class ProductionParameterHandler {
stacks = [];
enter(flags) {

@@ -45,4 +31,3 @@ this.stacks.push(flags);

}
exports.default = ProductionParameterHandler;
function functionFlags(isAsync, isGenerator) {
export function functionFlags(isAsync, isGenerator) {
return (isAsync ? PARAM_AWAIT : 0) | (isGenerator ? PARAM_YIELD : 0);

@@ -49,0 +34,0 @@ }

@@ -1,24 +0,17 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.Scope = void 0;
var _scopeflags = require("./scopeflags");
var _parseError = require("../parse-error");
class Scope {
import { ScopeFlag, BindingFlag } from "./scopeflags.js";
import { Errors } from "../parse-error.js";
export class Scope {
var = new Set();
lexical = new Set();
functions = new Set();
constructor(flags) {
this.var = new Set();
this.lexical = new Set();
this.functions = new Set();
this.flags = flags;
}
}
exports.Scope = Scope;
class ScopeHandler {
export default class ScopeHandler {
parser;
scopeStack = [];
inModule;
undefinedExports = new Map();
constructor(parser, inModule) {
this.parser = void 0;
this.scopeStack = [];
this.inModule = void 0;
this.undefinedExports = new Map();
this.parser = parser;

@@ -28,19 +21,19 @@ this.inModule = inModule;

get inTopLevel() {
return (this.currentScope().flags & _scopeflags.SCOPE_PROGRAM) > 0;
return (this.currentScope().flags & ScopeFlag.PROGRAM) > 0;
}
get inFunction() {
return (this.currentVarScopeFlags() & _scopeflags.SCOPE_FUNCTION) > 0;
return (this.currentVarScopeFlags() & ScopeFlag.FUNCTION) > 0;
}
get allowSuper() {
return (this.currentThisScopeFlags() & _scopeflags.SCOPE_SUPER) > 0;
return (this.currentThisScopeFlags() & ScopeFlag.SUPER) > 0;
}
get allowDirectSuper() {
return (this.currentThisScopeFlags() & _scopeflags.SCOPE_DIRECT_SUPER) > 0;
return (this.currentThisScopeFlags() & ScopeFlag.DIRECT_SUPER) > 0;
}
get inClass() {
return (this.currentThisScopeFlags() & _scopeflags.SCOPE_CLASS) > 0;
return (this.currentThisScopeFlags() & ScopeFlag.CLASS) > 0;
}
get inClassAndNotInNonArrowFunction() {
const flags = this.currentThisScopeFlags();
return (flags & _scopeflags.SCOPE_CLASS) > 0 && (flags & _scopeflags.SCOPE_FUNCTION) === 0;
return (flags & ScopeFlag.CLASS) > 0 && (flags & ScopeFlag.FUNCTION) === 0;
}

@@ -52,6 +45,6 @@ get inStaticBlock() {

} = this.scopeStack[i];
if (flags & _scopeflags.SCOPE_STATIC_BLOCK) {
if (flags & ScopeFlag.STATIC_BLOCK) {
return true;
}
if (flags & (_scopeflags.SCOPE_VAR | _scopeflags.SCOPE_CLASS)) {
if (flags & (ScopeFlag.VAR | ScopeFlag.CLASS)) {
return false;

@@ -62,3 +55,3 @@ }

get inNonArrowFunction() {
return (this.currentThisScopeFlags() & _scopeflags.SCOPE_FUNCTION) > 0;
return (this.currentThisScopeFlags() & ScopeFlag.FUNCTION) > 0;
}

@@ -79,9 +72,9 @@ get treatFunctionsAsVar() {

treatFunctionsAsVarInScope(scope) {
return !!(scope.flags & (_scopeflags.SCOPE_FUNCTION | _scopeflags.SCOPE_STATIC_BLOCK) || !this.parser.inModule && scope.flags & _scopeflags.SCOPE_PROGRAM);
return !!(scope.flags & (ScopeFlag.FUNCTION | ScopeFlag.STATIC_BLOCK) || !this.parser.inModule && scope.flags & ScopeFlag.PROGRAM);
}
declareName(name, bindingType, loc) {
let scope = this.currentScope();
if (bindingType & _scopeflags.BIND_SCOPE_LEXICAL || bindingType & _scopeflags.BIND_SCOPE_FUNCTION) {
if (bindingType & BindingFlag.SCOPE_LEXICAL || bindingType & BindingFlag.SCOPE_FUNCTION) {
this.checkRedeclarationInScope(scope, name, bindingType, loc);
if (bindingType & _scopeflags.BIND_SCOPE_FUNCTION) {
if (bindingType & BindingFlag.SCOPE_FUNCTION) {
scope.functions.add(name);

@@ -91,6 +84,6 @@ } else {

}
if (bindingType & _scopeflags.BIND_SCOPE_LEXICAL) {
if (bindingType & BindingFlag.SCOPE_LEXICAL) {
this.maybeExportDefined(scope, name);
}
} else if (bindingType & _scopeflags.BIND_SCOPE_VAR) {
} else if (bindingType & BindingFlag.SCOPE_VAR) {
for (let i = this.scopeStack.length - 1; i >= 0; --i) {

@@ -101,6 +94,6 @@ scope = this.scopeStack[i];

this.maybeExportDefined(scope, name);
if (scope.flags & _scopeflags.SCOPE_VAR) break;
if (scope.flags & ScopeFlag.VAR) break;
}
}
if (this.parser.inModule && scope.flags & _scopeflags.SCOPE_PROGRAM) {
if (this.parser.inModule && scope.flags & ScopeFlag.PROGRAM) {
this.undefinedExports.delete(name);

@@ -110,3 +103,3 @@ }

maybeExportDefined(scope, name) {
if (this.parser.inModule && scope.flags & _scopeflags.SCOPE_PROGRAM) {
if (this.parser.inModule && scope.flags & ScopeFlag.PROGRAM) {
this.undefinedExports.delete(name);

@@ -117,3 +110,3 @@ }

if (this.isRedeclaredInScope(scope, name, bindingType)) {
this.parser.raise(_parseError.Errors.VarRedeclaration, {
this.parser.raise(Errors.VarRedeclaration, {
at: loc,

@@ -125,10 +118,10 @@ identifierName: name

isRedeclaredInScope(scope, name, bindingType) {
if (!(bindingType & _scopeflags.BIND_KIND_VALUE)) return false;
if (bindingType & _scopeflags.BIND_SCOPE_LEXICAL) {
if (!(bindingType & BindingFlag.KIND_VALUE)) return false;
if (bindingType & BindingFlag.SCOPE_LEXICAL) {
return scope.lexical.has(name) || scope.functions.has(name) || scope.var.has(name);
}
if (bindingType & _scopeflags.BIND_SCOPE_FUNCTION) {
if (bindingType & BindingFlag.SCOPE_FUNCTION) {
return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name);
}
return scope.lexical.has(name) && !(scope.flags & _scopeflags.SCOPE_SIMPLE_CATCH && scope.lexical.values().next().value === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name);
return scope.lexical.has(name) && !(scope.flags & ScopeFlag.SIMPLE_CATCH && scope.lexical.values().next().value === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name);
}

@@ -152,3 +145,3 @@ checkLocalExport(id) {

} = this.scopeStack[i];
if (flags & _scopeflags.SCOPE_VAR) {
if (flags & ScopeFlag.VAR) {
return flags;

@@ -163,3 +156,3 @@ }

} = this.scopeStack[i];
if (flags & (_scopeflags.SCOPE_VAR | _scopeflags.SCOPE_CLASS) && !(flags & _scopeflags.SCOPE_ARROW)) {
if (flags & (ScopeFlag.VAR | ScopeFlag.CLASS) && !(flags & ScopeFlag.ARROW)) {
return flags;

@@ -170,4 +163,3 @@ }

}
exports.default = ScopeHandler;
//# sourceMappingURL=scope.js.map

@@ -1,106 +0,58 @@

"use strict";
export var ScopeFlag = {
OTHER: 0,
PROGRAM: 1,
FUNCTION: 2,
ARROW: 4,
SIMPLE_CATCH: 8,
SUPER: 16,
DIRECT_SUPER: 32,
CLASS: 64,
STATIC_BLOCK: 128,
TS_MODULE: 256,
VAR: 387
};
export var BindingFlag = {
KIND_VALUE: 1,
KIND_TYPE: 2,
SCOPE_VAR: 4,
SCOPE_LEXICAL: 8,
SCOPE_FUNCTION: 16,
SCOPE_OUTSIDE: 32,
FLAG_NONE: 64,
FLAG_CLASS: 128,
FLAG_TS_ENUM: 256,
FLAG_TS_CONST_ENUM: 512,
FLAG_TS_EXPORT_ONLY: 1024,
FLAG_FLOW_DECLARE_FN: 2048,
FLAG_TS_IMPORT: 4096,
FLAG_NO_LET_IN_LEXICAL: 8192,
TYPE_CLASS: 8331,
TYPE_LEXICAL: 8201,
TYPE_CATCH_PARAM: 9,
TYPE_VAR: 5,
TYPE_FUNCTION: 17,
TYPE_TS_INTERFACE: 130,
TYPE_TS_TYPE: 2,
TYPE_TS_ENUM: 8459,
TYPE_TS_AMBIENT: 1024,
TYPE_NONE: 64,
TYPE_OUTSIDE: 65,
TYPE_TS_CONST_ENUM: 8971,
TYPE_TS_NAMESPACE: 1024,
TYPE_TS_TYPE_IMPORT: 4098,
TYPE_TS_VALUE_IMPORT: 4096,
TYPE_FLOW_DECLARE_FN: 2048
};
export var ClassElementType = {
OTHER: 0,
FLAG_STATIC: 4,
KIND_GETTER: 2,
KIND_SETTER: 1,
KIND_ACCESSOR: 3,
STATIC_GETTER: 6,
STATIC_SETTER: 5,
INSTANCE_GETTER: 2,
INSTANCE_SETTER: 1
};
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SCOPE_VAR = exports.SCOPE_TS_MODULE = exports.SCOPE_SUPER = exports.SCOPE_STATIC_BLOCK = exports.SCOPE_SIMPLE_CATCH = exports.SCOPE_PROGRAM = exports.SCOPE_OTHER = exports.SCOPE_FUNCTION = exports.SCOPE_DIRECT_SUPER = exports.SCOPE_CLASS = exports.SCOPE_ARROW = exports.CLASS_ELEMENT_STATIC_SETTER = exports.CLASS_ELEMENT_STATIC_GETTER = exports.CLASS_ELEMENT_OTHER = exports.CLASS_ELEMENT_KIND_SETTER = exports.CLASS_ELEMENT_KIND_GETTER = exports.CLASS_ELEMENT_KIND_ACCESSOR = exports.CLASS_ELEMENT_INSTANCE_SETTER = exports.CLASS_ELEMENT_INSTANCE_GETTER = exports.CLASS_ELEMENT_FLAG_STATIC = exports.BIND_VAR = exports.BIND_TS_TYPE_IMPORT = exports.BIND_TS_TYPE = exports.BIND_TS_NAMESPACE = exports.BIND_TS_INTERFACE = exports.BIND_TS_ENUM = exports.BIND_TS_CONST_ENUM = exports.BIND_TS_AMBIENT = exports.BIND_SCOPE_VAR = exports.BIND_SCOPE_OUTSIDE = exports.BIND_SCOPE_LEXICAL = exports.BIND_SCOPE_FUNCTION = exports.BIND_OUTSIDE = exports.BIND_NONE = exports.BIND_LEXICAL = exports.BIND_KIND_VALUE = exports.BIND_KIND_TYPE = exports.BIND_FUNCTION = exports.BIND_FLOW_DECLARE_FN = exports.BIND_FLAGS_TS_IMPORT = exports.BIND_FLAGS_TS_EXPORT_ONLY = exports.BIND_FLAGS_TS_ENUM = exports.BIND_FLAGS_TS_CONST_ENUM = exports.BIND_FLAGS_NO_LET_IN_LEXICAL = exports.BIND_FLAGS_NONE = exports.BIND_FLAGS_FLOW_DECLARE_FN = exports.BIND_FLAGS_CLASS = exports.BIND_CLASS = exports.BIND_CATCH_PARAM = void 0;
const SCOPE_OTHER = 0b000000000,
SCOPE_PROGRAM = 0b000000001,
SCOPE_FUNCTION = 0b000000010,
SCOPE_ARROW = 0b000000100,
SCOPE_SIMPLE_CATCH = 0b000001000,
SCOPE_SUPER = 0b000010000,
SCOPE_DIRECT_SUPER = 0b000100000,
SCOPE_CLASS = 0b001000000,
SCOPE_STATIC_BLOCK = 0b010000000,
SCOPE_TS_MODULE = 0b100000000,
SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION | SCOPE_STATIC_BLOCK | SCOPE_TS_MODULE;
exports.SCOPE_VAR = SCOPE_VAR;
exports.SCOPE_TS_MODULE = SCOPE_TS_MODULE;
exports.SCOPE_STATIC_BLOCK = SCOPE_STATIC_BLOCK;
exports.SCOPE_CLASS = SCOPE_CLASS;
exports.SCOPE_DIRECT_SUPER = SCOPE_DIRECT_SUPER;
exports.SCOPE_SUPER = SCOPE_SUPER;
exports.SCOPE_SIMPLE_CATCH = SCOPE_SIMPLE_CATCH;
exports.SCOPE_ARROW = SCOPE_ARROW;
exports.SCOPE_FUNCTION = SCOPE_FUNCTION;
exports.SCOPE_PROGRAM = SCOPE_PROGRAM;
exports.SCOPE_OTHER = SCOPE_OTHER;
const BIND_KIND_VALUE = 0b0000000000001,
BIND_KIND_TYPE = 0b0000000000010,
BIND_SCOPE_VAR = 0b0000000000100,
BIND_SCOPE_LEXICAL = 0b0000000001000,
BIND_SCOPE_FUNCTION = 0b0000000010000,
BIND_SCOPE_OUTSIDE = 0b0000000100000,
BIND_FLAGS_NONE = 0b00000001000000,
BIND_FLAGS_CLASS = 0b00000010000000,
BIND_FLAGS_TS_ENUM = 0b00000100000000,
BIND_FLAGS_TS_CONST_ENUM = 0b00001000000000,
BIND_FLAGS_TS_EXPORT_ONLY = 0b00010000000000,
BIND_FLAGS_FLOW_DECLARE_FN = 0b00100000000000,
BIND_FLAGS_TS_IMPORT = 0b01000000000000,
BIND_FLAGS_NO_LET_IN_LEXICAL = 0b10000000000000;
exports.BIND_FLAGS_NO_LET_IN_LEXICAL = BIND_FLAGS_NO_LET_IN_LEXICAL;
exports.BIND_FLAGS_TS_IMPORT = BIND_FLAGS_TS_IMPORT;
exports.BIND_FLAGS_FLOW_DECLARE_FN = BIND_FLAGS_FLOW_DECLARE_FN;
exports.BIND_FLAGS_TS_EXPORT_ONLY = BIND_FLAGS_TS_EXPORT_ONLY;
exports.BIND_FLAGS_TS_CONST_ENUM = BIND_FLAGS_TS_CONST_ENUM;
exports.BIND_FLAGS_TS_ENUM = BIND_FLAGS_TS_ENUM;
exports.BIND_FLAGS_CLASS = BIND_FLAGS_CLASS;
exports.BIND_FLAGS_NONE = BIND_FLAGS_NONE;
exports.BIND_SCOPE_OUTSIDE = BIND_SCOPE_OUTSIDE;
exports.BIND_SCOPE_FUNCTION = BIND_SCOPE_FUNCTION;
exports.BIND_SCOPE_LEXICAL = BIND_SCOPE_LEXICAL;
exports.BIND_SCOPE_VAR = BIND_SCOPE_VAR;
exports.BIND_KIND_TYPE = BIND_KIND_TYPE;
exports.BIND_KIND_VALUE = BIND_KIND_VALUE;
const BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_CLASS | BIND_FLAGS_NO_LET_IN_LEXICAL,
BIND_LEXICAL = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | BIND_FLAGS_NO_LET_IN_LEXICAL,
BIND_CATCH_PARAM = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | 0,
BIND_VAR = BIND_KIND_VALUE | 0 | BIND_SCOPE_VAR | 0,
BIND_FUNCTION = BIND_KIND_VALUE | 0 | BIND_SCOPE_FUNCTION | 0,
BIND_TS_INTERFACE = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_CLASS,
BIND_TS_TYPE = 0 | BIND_KIND_TYPE | 0 | 0,
BIND_TS_ENUM = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_TS_ENUM | BIND_FLAGS_NO_LET_IN_LEXICAL,
BIND_TS_AMBIENT = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,
BIND_NONE = 0 | 0 | 0 | BIND_FLAGS_NONE,
BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE,
BIND_TS_CONST_ENUM = BIND_TS_ENUM | BIND_FLAGS_TS_CONST_ENUM,
BIND_TS_NAMESPACE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,
BIND_TS_TYPE_IMPORT = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_TS_IMPORT,
BIND_FLOW_DECLARE_FN = BIND_FLAGS_FLOW_DECLARE_FN;
exports.BIND_FLOW_DECLARE_FN = BIND_FLOW_DECLARE_FN;
exports.BIND_TS_TYPE_IMPORT = BIND_TS_TYPE_IMPORT;
exports.BIND_TS_NAMESPACE = BIND_TS_NAMESPACE;
exports.BIND_TS_CONST_ENUM = BIND_TS_CONST_ENUM;
exports.BIND_OUTSIDE = BIND_OUTSIDE;
exports.BIND_NONE = BIND_NONE;
exports.BIND_TS_AMBIENT = BIND_TS_AMBIENT;
exports.BIND_TS_ENUM = BIND_TS_ENUM;
exports.BIND_TS_TYPE = BIND_TS_TYPE;
exports.BIND_TS_INTERFACE = BIND_TS_INTERFACE;
exports.BIND_FUNCTION = BIND_FUNCTION;
exports.BIND_VAR = BIND_VAR;
exports.BIND_CATCH_PARAM = BIND_CATCH_PARAM;
exports.BIND_LEXICAL = BIND_LEXICAL;
exports.BIND_CLASS = BIND_CLASS;
const CLASS_ELEMENT_FLAG_STATIC = 0b100,
CLASS_ELEMENT_KIND_GETTER = 0b010,
CLASS_ELEMENT_KIND_SETTER = 0b001,
CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER;
exports.CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_ACCESSOR;
exports.CLASS_ELEMENT_KIND_SETTER = CLASS_ELEMENT_KIND_SETTER;
exports.CLASS_ELEMENT_KIND_GETTER = CLASS_ELEMENT_KIND_GETTER;
exports.CLASS_ELEMENT_FLAG_STATIC = CLASS_ELEMENT_FLAG_STATIC;
const CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FLAG_STATIC,
CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_KIND_SETTER | CLASS_ELEMENT_FLAG_STATIC,
CLASS_ELEMENT_INSTANCE_GETTER = CLASS_ELEMENT_KIND_GETTER,
CLASS_ELEMENT_INSTANCE_SETTER = CLASS_ELEMENT_KIND_SETTER,
CLASS_ELEMENT_OTHER = 0;
exports.CLASS_ELEMENT_OTHER = CLASS_ELEMENT_OTHER;
exports.CLASS_ELEMENT_INSTANCE_SETTER = CLASS_ELEMENT_INSTANCE_SETTER;
exports.CLASS_ELEMENT_INSTANCE_GETTER = CLASS_ELEMENT_INSTANCE_GETTER;
exports.CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_STATIC_SETTER;
exports.CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_STATIC_GETTER;
//# sourceMappingURL=scopeflags.js.map

@@ -1,14 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isNewLine = isNewLine;
exports.isWhitespace = isWhitespace;
exports.skipWhiteSpaceToLineBreak = exports.skipWhiteSpaceInLine = exports.skipWhiteSpace = exports.lineBreakG = exports.lineBreak = void 0;
const lineBreak = /\r\n?|[\n\u2028\u2029]/;
exports.lineBreak = lineBreak;
const lineBreakG = new RegExp(lineBreak.source, "g");
exports.lineBreakG = lineBreakG;
function isNewLine(code) {
export const lineBreak = /\r\n?|[\n\u2028\u2029]/;
export const lineBreakG = new RegExp(lineBreak.source, "g");
export function isNewLine(code) {
switch (code) {

@@ -24,9 +14,6 @@ case 10:

}
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
exports.skipWhiteSpace = skipWhiteSpace;
const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;
exports.skipWhiteSpaceInLine = skipWhiteSpaceInLine;
const skipWhiteSpaceToLineBreak = new RegExp("(?=(" + skipWhiteSpaceInLine.source + "))\\1" + /(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source, "y");
exports.skipWhiteSpaceToLineBreak = skipWhiteSpaceToLineBreak;
function isWhitespace(code) {
export const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
export const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;
export const skipWhiteSpaceToLineBreak = new RegExp("(?=(" + skipWhiteSpaceInLine.source + "))\\1" + /(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source, "y");
export function isWhitespace(code) {
switch (code) {

@@ -33,0 +20,0 @@ case 0x0009:

{
"name": "@babel/parser",
"version": "7.22.7",
"version": "8.0.0-alpha.0",
"description": "A JavaScript parser",

@@ -34,14 +34,22 @@ "author": "The Babel Team (https://babel.dev/team)",

"engines": {
"node": ">=6.0.0"
"node": "^16.20.0 || ^18.16.0 || >=20.0.0"
},
"devDependencies": {
"@babel/code-frame": "^7.22.5",
"@babel/helper-check-duplicate-nodes": "^7.22.5",
"@babel/helper-fixtures": "^7.22.6",
"@babel/helper-string-parser": "^7.22.5",
"@babel/helper-validator-identifier": "^7.22.5",
"@babel/code-frame": "^8.0.0-alpha.0",
"@babel/helper-check-duplicate-nodes": "^8.0.0-alpha.0",
"@babel/helper-fixtures": "^8.0.0-alpha.0",
"@babel/helper-string-parser": "^8.0.0-alpha.0",
"@babel/helper-validator-identifier": "^8.0.0-alpha.0",
"charcodes": "^0.2.0"
},
"bin": "./bin/babel-parser.js",
"type": "commonjs"
"exports": {
".": {
"types": "./typings/babel-parser.d.ts",
"require": "./lib/index.cjs",
"default": "./lib/index.js"
},
"./package.json": "./package.json"
},
"type": "module"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc