This commit is contained in:
2023-08-11 10:45:20 +08:00
commit 161ca982f3
31850 changed files with 2706500 additions and 0 deletions

340
node_modules/@babel/parser/lib/plugins/estree.js generated vendored Normal file
View File

@ -0,0 +1,340 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _parseError = require("../parse-error");
const {
defineProperty
} = Object;
const toUnenumerable = (object, key) => defineProperty(object, key, {
enumerable: false,
value: object[key]
});
function toESTreeLocation(node) {
node.loc.start && toUnenumerable(node.loc.start, "index");
node.loc.end && toUnenumerable(node.loc.end, "index");
return node;
}
var _default = superClass => class ESTreeParserMixin extends superClass {
parse() {
const file = toESTreeLocation(super.parse());
if (this.options.tokens) {
file.tokens = file.tokens.map(toESTreeLocation);
}
return file;
}
parseRegExpLiteral({
pattern,
flags
}) {
let regex = null;
try {
regex = new RegExp(pattern, flags);
} catch (e) {}
const node = this.estreeParseLiteral(regex);
node.regex = {
pattern,
flags
};
return node;
}
parseBigIntLiteral(value) {
let bigInt;
try {
bigInt = BigInt(value);
} catch (_unused) {
bigInt = null;
}
const node = this.estreeParseLiteral(bigInt);
node.bigint = String(node.value || value);
return node;
}
parseDecimalLiteral(value) {
const decimal = null;
const node = this.estreeParseLiteral(decimal);
node.decimal = String(node.value || value);
return node;
}
estreeParseLiteral(value) {
return this.parseLiteral(value, "Literal");
}
parseStringLiteral(value) {
return this.estreeParseLiteral(value);
}
parseNumericLiteral(value) {
return this.estreeParseLiteral(value);
}
parseNullLiteral() {
return this.estreeParseLiteral(null);
}
parseBooleanLiteral(value) {
return this.estreeParseLiteral(value);
}
directiveToStmt(directive) {
const expression = directive.value;
delete directive.value;
expression.type = "Literal";
expression.raw = expression.extra.raw;
expression.value = expression.extra.expressionValue;
const stmt = directive;
stmt.type = "ExpressionStatement";
stmt.expression = expression;
stmt.directive = expression.extra.rawValue;
delete expression.extra;
return stmt;
}
initFunction(node, isAsync) {
super.initFunction(node, isAsync);
node.expression = false;
}
checkDeclaration(node) {
if (node != null && this.isObjectProperty(node)) {
this.checkDeclaration(node.value);
} else {
super.checkDeclaration(node);
}
}
getObjectOrClassMethodParams(method) {
return method.value.params;
}
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);
}
parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {
super.parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse);
const directiveStatements = node.directives.map(d => this.directiveToStmt(d));
node.body = directiveStatements.concat(node.body);
delete node.directives;
}
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true);
if (method.typeParameters) {
method.value.typeParameters = method.typeParameters;
delete method.typeParameters;
}
classBody.body.push(method);
}
parsePrivateName() {
const node = super.parsePrivateName();
{
if (!this.getPluginOption("estree", "classFeatures")) {
return node;
}
}
return this.convertPrivateNameToPrivateIdentifier(node);
}
convertPrivateNameToPrivateIdentifier(node) {
const name = super.getPrivateNameSV(node);
node = node;
delete node.id;
node.name = name;
node.type = "PrivateIdentifier";
return node;
}
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;
}
parseLiteral(value, type) {
const node = super.parseLiteral(value, type);
node.raw = node.extra.raw;
delete node.extra;
return node;
}
parseFunctionBody(node, allowExpression, isMethod = false) {
super.parseFunctionBody(node, allowExpression, isMethod);
node.expression = node.body.type !== "BlockStatement";
}
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
let funcNode = this.startNode();
funcNode.kind = node.kind;
funcNode = super.parseMethod(funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
funcNode.type = "FunctionExpression";
delete funcNode.kind;
node.value = funcNode;
if (type === "ClassPrivateMethod") {
node.computed = false;
}
return this.finishNode(node, "MethodDefinition");
}
parseClassProperty(...args) {
const propertyNode = super.parseClassProperty(...args);
{
if (!this.getPluginOption("estree", "classFeatures")) {
return propertyNode;
}
}
propertyNode.type = "PropertyDefinition";
return propertyNode;
}
parseClassPrivateProperty(...args) {
const propertyNode = super.parseClassPrivateProperty(...args);
{
if (!this.getPluginOption("estree", "classFeatures")) {
return propertyNode;
}
}
propertyNode.type = "PropertyDefinition";
propertyNode.computed = false;
return propertyNode;
}
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
const node = super.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor);
if (node) {
node.type = "Property";
if (node.kind === "method") {
node.kind = "init";
}
node.shorthand = false;
}
return node;
}
parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) {
const node = super.parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors);
if (node) {
node.kind = "init";
node.type = "Property";
}
return node;
}
isValidLVal(type, isUnparenthesizedInAssign, binding) {
return type === "Property" ? "value" : super.isValidLVal(type, isUnparenthesizedInAssign, binding);
}
isAssignable(node, isBinding) {
if (node != null && this.isObjectProperty(node)) {
return this.isAssignable(node.value, isBinding);
}
return super.isAssignable(node, isBinding);
}
toAssignable(node, isLHS = false) {
if (node != null && this.isObjectProperty(node)) {
const {
key,
value
} = node;
if (this.isPrivateName(key)) {
this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start);
}
this.toAssignable(value, isLHS);
} else {
super.toAssignable(node, isLHS);
}
}
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
if (prop.kind === "get" || prop.kind === "set") {
this.raise(_parseError.Errors.PatternHasAccessor, {
at: prop.key
});
} else if (prop.method) {
this.raise(_parseError.Errors.PatternHasMethod, {
at: prop.key
});
} else {
super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
}
}
finishCallExpression(unfinished, optional) {
const node = super.finishCallExpression(unfinished, optional);
if (node.callee.type === "Import") {
node.type = "ImportExpression";
node.source = node.arguments[0];
if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
var _node$arguments$;
node.attributes = (_node$arguments$ = node.arguments[1]) != null ? _node$arguments$ : null;
}
delete node.arguments;
delete node.callee;
}
return node;
}
toReferencedArguments(node) {
if (node.type === "ImportExpression") {
return;
}
super.toReferencedArguments(node);
}
parseExport(unfinished, decorators) {
const exportStartLoc = this.state.lastTokStartLoc;
const node = super.parseExport(unfinished, decorators);
switch (node.type) {
case "ExportAllDeclaration":
node.exported = null;
break;
case "ExportNamedDeclaration":
if (node.specifiers.length === 1 && node.specifiers[0].type === "ExportNamespaceSpecifier") {
node.type = "ExportAllDeclaration";
node.exported = node.specifiers[0].exported;
delete node.specifiers;
}
case "ExportDefaultDeclaration":
{
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) {
this.resetStartLocation(node, exportStartLoc);
}
}
break;
}
return node;
}
parseSubscript(base, startLoc, noCalls, state) {
const node = super.parseSubscript(base, startLoc, noCalls, state);
if (state.optionalChainMember) {
if (node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression") {
node.type = node.type.substring(8);
}
if (state.stop) {
const chain = this.startNodeAtNode(node);
chain.expression = node;
return this.finishNode(chain, "ChainExpression");
}
} else if (node.type === "MemberExpression" || node.type === "CallExpression") {
node.optional = false;
}
return node;
}
hasPropertyAsPrivateName(node) {
if (node.type === "ChainExpression") {
node = node.expression;
}
return super.hasPropertyAsPrivateName(node);
}
isObjectProperty(node) {
return node.type === "Property" && node.kind === "init" && !node.method;
}
isObjectMethod(node) {
return node.method || node.kind === "get" || node.kind === "set";
}
finishNodeAt(node, type, endLoc) {
return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
}
resetStartLocation(node, startLoc) {
super.resetStartLocation(node, startLoc);
toESTreeLocation(node);
}
resetEndLocation(node, endLoc = this.state.lastTokEndLoc) {
super.resetEndLocation(node, endLoc);
toESTreeLocation(node);
}
};
exports.default = _default;
//# sourceMappingURL=estree.js.map

1
node_modules/@babel/parser/lib/plugins/estree.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2474
node_modules/@babel/parser/lib/plugins/flow/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

44
node_modules/@babel/parser/lib/plugins/flow/scope.js generated vendored Normal file
View File

@ -0,0 +1,44 @@
"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();
}
}
class FlowScopeHandler extends _scope.default {
createScope(flags) {
return new FlowScope(flags);
}
declareName(name, bindingType, loc) {
const scope = this.currentScope();
if (bindingType & _scopeflags.BindingFlag.FLAG_FLOW_DECLARE_FN) {
this.checkRedeclarationInScope(scope, name, bindingType, loc);
this.maybeExportDefined(scope, name);
scope.declareFunctions.add(name);
return;
}
super.declareName(name, bindingType, loc);
}
isRedeclaredInScope(scope, name, bindingType) {
if (super.isRedeclaredInScope(scope, name, bindingType)) return true;
if (bindingType & _scopeflags.BindingFlag.FLAG_FLOW_DECLARE_FN) {
return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name));
}
return false;
}
checkLocalExport(id) {
if (!this.scopeStack[0].declareFunctions.has(id.name)) {
super.checkLocalExport(id);
}
}
}
exports.default = FlowScopeHandler;
//# sourceMappingURL=scope.js.map

View File

@ -0,0 +1 @@
{"version":3,"names":["_scope","require","_scopeflags","FlowScope","Scope","constructor","args","declareFunctions","Set","FlowScopeHandler","ScopeHandler","createScope","flags","declareName","name","bindingType","loc","scope","currentScope","BindingFlag","FLAG_FLOW_DECLARE_FN","checkRedeclarationInScope","maybeExportDefined","add","isRedeclaredInScope","has","lexical","functions","checkLocalExport","id","scopeStack","exports","default"],"sources":["../../../src/plugins/flow/scope.ts"],"sourcesContent":["import type { Position } from \"../../util/location\";\nimport ScopeHandler, { Scope } from \"../../util/scope\";\nimport {\n BindingFlag,\n type ScopeFlag,\n type BindingTypes,\n} from \"../../util/scopeflags\";\nimport type * as N from \"../../types\";\n\n// Reference implementation: https://github.com/facebook/flow/blob/23aeb2a2ef6eb4241ce178fde5d8f17c5f747fb5/src/typing/env.ml#L536-L584\nclass FlowScope extends Scope {\n // declare function foo(): type;\n declareFunctions: Set<string> = new Set();\n}\n\nexport default class FlowScopeHandler extends ScopeHandler<FlowScope> {\n createScope(flags: ScopeFlag): FlowScope {\n return new FlowScope(flags);\n }\n\n declareName(name: string, bindingType: BindingTypes, loc: Position) {\n const scope = this.currentScope();\n if (bindingType & BindingFlag.FLAG_FLOW_DECLARE_FN) {\n this.checkRedeclarationInScope(scope, name, bindingType, loc);\n this.maybeExportDefined(scope, name);\n scope.declareFunctions.add(name);\n return;\n }\n\n super.declareName(name, bindingType, loc);\n }\n\n isRedeclaredInScope(\n scope: FlowScope,\n name: string,\n bindingType: BindingTypes,\n ): boolean {\n if (super.isRedeclaredInScope(scope, name, bindingType)) return true;\n\n if (bindingType & BindingFlag.FLAG_FLOW_DECLARE_FN) {\n return (\n !scope.declareFunctions.has(name) &&\n (scope.lexical.has(name) || scope.functions.has(name))\n );\n }\n\n return false;\n }\n\n checkLocalExport(id: N.Identifier) {\n if (!this.scopeStack[0].declareFunctions.has(id.name)) {\n super.checkLocalExport(id);\n }\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAQA,MAAME,SAAS,SAASC,YAAK,CAAC;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA,KAE5BC,gBAAgB,GAAgB,IAAIC,GAAG,CAAC,CAAC;EAAA;AAC3C;AAEe,MAAMC,gBAAgB,SAASC,cAAY,CAAY;EACpEC,WAAWA,CAACC,KAAgB,EAAa;IACvC,OAAO,IAAIT,SAAS,CAACS,KAAK,CAAC;EAC7B;EAEAC,WAAWA,CAACC,IAAY,EAAEC,WAAyB,EAAEC,GAAa,EAAE;IAClE,MAAMC,KAAK,GAAG,IAAI,CAACC,YAAY,CAAC,CAAC;IACjC,IAAIH,WAAW,GAAGI,uBAAW,CAACC,oBAAoB,EAAE;MAClD,IAAI,CAACC,yBAAyB,CAACJ,KAAK,EAAEH,IAAI,EAAEC,WAAW,EAAEC,GAAG,CAAC;MAC7D,IAAI,CAACM,kBAAkB,CAACL,KAAK,EAAEH,IAAI,CAAC;MACpCG,KAAK,CAACV,gBAAgB,CAACgB,GAAG,CAACT,IAAI,CAAC;MAChC;IACF;IAEA,KAAK,CAACD,WAAW,CAACC,IAAI,EAAEC,WAAW,EAAEC,GAAG,CAAC;EAC3C;EAEAQ,mBAAmBA,CACjBP,KAAgB,EAChBH,IAAY,EACZC,WAAyB,EAChB;IACT,IAAI,KAAK,CAACS,mBAAmB,CAACP,KAAK,EAAEH,IAAI,EAAEC,WAAW,CAAC,EAAE,OAAO,IAAI;IAEpE,IAAIA,WAAW,GAAGI,uBAAW,CAACC,oBAAoB,EAAE;MAClD,OACE,CAACH,KAAK,CAACV,gBAAgB,CAACkB,GAAG,CAACX,IAAI,CAAC,KAChCG,KAAK,CAACS,OAAO,CAACD,GAAG,CAACX,IAAI,CAAC,IAAIG,KAAK,CAACU,SAAS,CAACF,GAAG,CAACX,IAAI,CAAC,CAAC;IAE1D;IAEA,OAAO,KAAK;EACd;EAEAc,gBAAgBA,CAACC,EAAgB,EAAE;IACjC,IAAI,CAAC,IAAI,CAACC,UAAU,CAAC,CAAC,CAAC,CAACvB,gBAAgB,CAACkB,GAAG,CAACI,EAAE,CAACf,IAAI,CAAC,EAAE;MACrD,KAAK,CAACc,gBAAgB,CAACC,EAAE,CAAC;IAC5B;EACF;AACF;AAACE,OAAA,CAAAC,OAAA,GAAAvB,gBAAA"}

444
node_modules/@babel/parser/lib/plugins/jsx/index.js generated vendored Normal file
View File

@ -0,0 +1,444 @@
"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`({
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
MissingClosingTagElement: ({
openingTagName
}) => `Expected corresponding JSX closing tag for <${openingTagName}>.`,
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.",
UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",
UnexpectedToken: ({
unexpected,
HTMLEntity
}) => `Unexpected token \`${unexpected}\`. Did you mean \`${HTMLEntity}\` or \`{'${unexpected}'}\`?`,
UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text.",
UnterminatedJsxContent: "Unterminated JSX contents.",
UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
});
function isFragment(object) {
return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
}
function getQualifiedJSXName(object) {
if (object.type === "JSXIdentifier") {
return object.name;
}
if (object.type === "JSXNamespacedName") {
return object.namespace.name + ":" + object.name.name;
}
if (object.type === "JSXMemberExpression") {
return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
}
throw new Error("Node had unexpected type: " + object.type);
}
var _default = superClass => class JSXParserMixin extends superClass {
jsxReadToken() {
let out = "";
let chunkStart = this.state.pos;
for (;;) {
if (this.state.pos >= this.length) {
throw this.raise(JsxErrors.UnterminatedJsxContent, {
at: this.state.startLoc
});
}
const ch = this.input.charCodeAt(this.state.pos);
switch (ch) {
case 60:
case 123:
if (this.state.pos === this.state.start) {
if (ch === 60 && this.state.canStartJSXElement) {
++this.state.pos;
this.finishToken(140);
} else {
super.getTokenFromCode(ch);
}
return;
}
out += this.input.slice(chunkStart, this.state.pos);
this.finishToken(139, out);
return;
case 38:
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadEntity();
chunkStart = this.state.pos;
break;
case 62:
case 125:
;
default:
if ((0, _whitespace.isNewLine)(ch)) {
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadNewLine(true);
chunkStart = this.state.pos;
} else {
++this.state.pos;
}
}
}
}
jsxReadNewLine(normalizeCRLF) {
const ch = this.input.charCodeAt(this.state.pos);
let out;
++this.state.pos;
if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) {
++this.state.pos;
out = normalizeCRLF ? "\n" : "\r\n";
} else {
out = String.fromCharCode(ch);
}
++this.state.curLine;
this.state.lineStart = this.state.pos;
return out;
}
jsxReadString(quote) {
let out = "";
let chunkStart = ++this.state.pos;
for (;;) {
if (this.state.pos >= this.length) {
throw this.raise(_parseError.Errors.UnterminatedString, {
at: this.state.startLoc
});
}
const ch = this.input.charCodeAt(this.state.pos);
if (ch === quote) break;
if (ch === 38) {
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadEntity();
chunkStart = this.state.pos;
} else if ((0, _whitespace.isNewLine)(ch)) {
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadNewLine(false);
chunkStart = this.state.pos;
} else {
++this.state.pos;
}
}
out += this.input.slice(chunkStart, this.state.pos++);
this.finishToken(131, out);
}
jsxReadEntity() {
const startPos = ++this.state.pos;
if (this.codePointAtPos(this.state.pos) === 35) {
++this.state.pos;
let radix = 10;
if (this.codePointAtPos(this.state.pos) === 120) {
radix = 16;
++this.state.pos;
}
const codePoint = this.readInt(radix, undefined, false, "bail");
if (codePoint !== null && this.codePointAtPos(this.state.pos) === 59) {
++this.state.pos;
return String.fromCodePoint(codePoint);
}
} else {
let count = 0;
let semi = false;
while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos) == 59)) {
++this.state.pos;
}
if (semi) {
const desc = this.input.slice(startPos, this.state.pos);
const entity = _xhtml.default[desc];
++this.state.pos;
if (entity) {
return entity;
}
}
}
this.state.pos = startPos;
return "&";
}
jsxReadWord() {
let ch;
const start = this.state.pos;
do {
ch = this.input.charCodeAt(++this.state.pos);
} while ((0, _identifier.isIdentifierChar)(ch) || ch === 45);
this.finishToken(138, this.input.slice(start, this.state.pos));
}
jsxParseIdentifier() {
const node = this.startNode();
if (this.match(138)) {
node.name = this.state.value;
} else if ((0, _types.tokenIsKeyword)(this.state.type)) {
node.name = (0, _types.tokenLabelName)(this.state.type);
} else {
this.unexpected();
}
this.next();
return this.finishNode(node, "JSXIdentifier");
}
jsxParseNamespacedName() {
const startLoc = this.state.startLoc;
const name = this.jsxParseIdentifier();
if (!this.eat(14)) return name;
const node = this.startNodeAt(startLoc);
node.namespace = name;
node.name = this.jsxParseIdentifier();
return this.finishNode(node, "JSXNamespacedName");
}
jsxParseElementName() {
const startLoc = this.state.startLoc;
let node = this.jsxParseNamespacedName();
if (node.type === "JSXNamespacedName") {
return node;
}
while (this.eat(16)) {
const newNode = this.startNodeAt(startLoc);
newNode.object = node;
newNode.property = this.jsxParseIdentifier();
node = this.finishNode(newNode, "JSXMemberExpression");
}
return node;
}
jsxParseAttributeValue() {
let node;
switch (this.state.type) {
case 5:
node = this.startNode();
this.setContext(_context.types.brace);
this.next();
node = this.jsxParseExpressionContainer(node, _context.types.j_oTag);
if (node.expression.type === "JSXEmptyExpression") {
this.raise(JsxErrors.AttributeIsEmpty, {
at: node
});
}
return node;
case 140:
case 131:
return this.parseExprAtom();
default:
throw this.raise(JsxErrors.UnsupportedJsxValue, {
at: this.state.startLoc
});
}
}
jsxParseEmptyExpression() {
const node = this.startNodeAt(this.state.lastTokEndLoc);
return this.finishNodeAt(node, "JSXEmptyExpression", this.state.startLoc);
}
jsxParseSpreadChild(node) {
this.next();
node.expression = this.parseExpression();
this.setContext(_context.types.j_expr);
this.state.canStartJSXElement = true;
this.expect(8);
return this.finishNode(node, "JSXSpreadChild");
}
jsxParseExpressionContainer(node, previousContext) {
if (this.match(8)) {
node.expression = this.jsxParseEmptyExpression();
} else {
const expression = this.parseExpression();
;
node.expression = expression;
}
this.setContext(previousContext);
this.state.canStartJSXElement = true;
this.expect(8);
return this.finishNode(node, "JSXExpressionContainer");
}
jsxParseAttribute() {
const node = this.startNode();
if (this.match(5)) {
this.setContext(_context.types.brace);
this.next();
this.expect(21);
node.argument = this.parseMaybeAssignAllowIn();
this.setContext(_context.types.j_oTag);
this.state.canStartJSXElement = true;
this.expect(8);
return this.finishNode(node, "JSXSpreadAttribute");
}
node.name = this.jsxParseNamespacedName();
node.value = this.eat(29) ? this.jsxParseAttributeValue() : null;
return this.finishNode(node, "JSXAttribute");
}
jsxParseOpeningElementAt(startLoc) {
const node = this.startNodeAt(startLoc);
if (this.eat(141)) {
return this.finishNode(node, "JSXOpeningFragment");
}
node.name = this.jsxParseElementName();
return this.jsxParseOpeningElementAfterName(node);
}
jsxParseOpeningElementAfterName(node) {
const attributes = [];
while (!this.match(56) && !this.match(141)) {
attributes.push(this.jsxParseAttribute());
}
node.attributes = attributes;
node.selfClosing = this.eat(56);
this.expect(141);
return this.finishNode(node, "JSXOpeningElement");
}
jsxParseClosingElementAt(startLoc) {
const node = this.startNodeAt(startLoc);
if (this.eat(141)) {
return this.finishNode(node, "JSXClosingFragment");
}
node.name = this.jsxParseElementName();
this.expect(141);
return this.finishNode(node, "JSXClosingElement");
}
jsxParseElementAt(startLoc) {
const node = this.startNodeAt(startLoc);
const children = [];
const openingElement = this.jsxParseOpeningElementAt(startLoc);
let closingElement = null;
if (!openingElement.selfClosing) {
contents: for (;;) {
switch (this.state.type) {
case 140:
startLoc = this.state.startLoc;
this.next();
if (this.eat(56)) {
closingElement = this.jsxParseClosingElementAt(startLoc);
break contents;
}
children.push(this.jsxParseElementAt(startLoc));
break;
case 139:
children.push(this.parseExprAtom());
break;
case 5:
{
const node = this.startNode();
this.setContext(_context.types.brace);
this.next();
if (this.match(21)) {
children.push(this.jsxParseSpreadChild(node));
} else {
children.push(this.jsxParseExpressionContainer(node, _context.types.j_expr));
}
break;
}
default:
this.unexpected();
}
}
if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) {
this.raise(JsxErrors.MissingClosingTagFragment, {
at: closingElement
});
} else if (!isFragment(openingElement) && isFragment(closingElement)) {
this.raise(JsxErrors.MissingClosingTagElement, {
at: closingElement,
openingTagName: getQualifiedJSXName(openingElement.name)
});
} else if (!isFragment(openingElement) && !isFragment(closingElement)) {
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
this.raise(JsxErrors.MissingClosingTagElement, {
at: closingElement,
openingTagName: getQualifiedJSXName(openingElement.name)
});
}
}
}
if (isFragment(openingElement)) {
node.openingFragment = openingElement;
node.closingFragment = closingElement;
} else {
node.openingElement = openingElement;
node.closingElement = closingElement;
}
node.children = children;
if (this.match(47)) {
throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, {
at: this.state.startLoc
});
}
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
}
jsxParseElement() {
const startLoc = this.state.startLoc;
this.next();
return this.jsxParseElementAt(startLoc);
}
setContext(newContext) {
const {
context
} = this.state;
context[context.length - 1] = newContext;
}
parseExprAtom(refExpressionErrors) {
if (this.match(139)) {
return this.parseLiteral(this.state.value, "JSXText");
} else if (this.match(140)) {
return this.jsxParseElement();
} else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
this.replaceToken(140);
return this.jsxParseElement();
} else {
return super.parseExprAtom(refExpressionErrors);
}
}
skipSpace() {
const curContext = this.curContext();
if (!curContext.preserveSpace) super.skipSpace();
}
getTokenFromCode(code) {
const context = this.curContext();
if (context === _context.types.j_expr) {
this.jsxReadToken();
return;
}
if (context === _context.types.j_oTag || context === _context.types.j_cTag) {
if ((0, _identifier.isIdentifierStart)(code)) {
this.jsxReadWord();
return;
}
if (code === 62) {
++this.state.pos;
this.finishToken(141);
return;
}
if ((code === 34 || code === 39) && context === _context.types.j_oTag) {
this.jsxReadString(code);
return;
}
}
if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
++this.state.pos;
this.finishToken(140);
return;
}
super.getTokenFromCode(code);
}
updateContext(prevType) {
const {
context,
type
} = this.state;
if (type === 56 && prevType === 140) {
context.splice(-2, 2, _context.types.j_cTag);
this.state.canStartJSXElement = false;
} else if (type === 140) {
context.push(_context.types.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) {
context.pop();
this.state.canStartJSXElement = context[context.length - 1] === _context.types.j_expr;
} else {
this.setContext(_context.types.j_expr);
this.state.canStartJSXElement = true;
}
} else {
this.state.canStartJSXElement = (0, _types.tokenComesBeforeExpression)(type);
}
}
};
exports.default = _default;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

266
node_modules/@babel/parser/lib/plugins/jsx/xhtml.js generated vendored Normal file
View File

@ -0,0 +1,266 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const entities = {
__proto__: null,
quot: "\u0022",
amp: "&",
apos: "\u0027",
lt: "<",
gt: ">",
nbsp: "\u00A0",
iexcl: "\u00A1",
cent: "\u00A2",
pound: "\u00A3",
curren: "\u00A4",
yen: "\u00A5",
brvbar: "\u00A6",
sect: "\u00A7",
uml: "\u00A8",
copy: "\u00A9",
ordf: "\u00AA",
laquo: "\u00AB",
not: "\u00AC",
shy: "\u00AD",
reg: "\u00AE",
macr: "\u00AF",
deg: "\u00B0",
plusmn: "\u00B1",
sup2: "\u00B2",
sup3: "\u00B3",
acute: "\u00B4",
micro: "\u00B5",
para: "\u00B6",
middot: "\u00B7",
cedil: "\u00B8",
sup1: "\u00B9",
ordm: "\u00BA",
raquo: "\u00BB",
frac14: "\u00BC",
frac12: "\u00BD",
frac34: "\u00BE",
iquest: "\u00BF",
Agrave: "\u00C0",
Aacute: "\u00C1",
Acirc: "\u00C2",
Atilde: "\u00C3",
Auml: "\u00C4",
Aring: "\u00C5",
AElig: "\u00C6",
Ccedil: "\u00C7",
Egrave: "\u00C8",
Eacute: "\u00C9",
Ecirc: "\u00CA",
Euml: "\u00CB",
Igrave: "\u00CC",
Iacute: "\u00CD",
Icirc: "\u00CE",
Iuml: "\u00CF",
ETH: "\u00D0",
Ntilde: "\u00D1",
Ograve: "\u00D2",
Oacute: "\u00D3",
Ocirc: "\u00D4",
Otilde: "\u00D5",
Ouml: "\u00D6",
times: "\u00D7",
Oslash: "\u00D8",
Ugrave: "\u00D9",
Uacute: "\u00DA",
Ucirc: "\u00DB",
Uuml: "\u00DC",
Yacute: "\u00DD",
THORN: "\u00DE",
szlig: "\u00DF",
agrave: "\u00E0",
aacute: "\u00E1",
acirc: "\u00E2",
atilde: "\u00E3",
auml: "\u00E4",
aring: "\u00E5",
aelig: "\u00E6",
ccedil: "\u00E7",
egrave: "\u00E8",
eacute: "\u00E9",
ecirc: "\u00EA",
euml: "\u00EB",
igrave: "\u00EC",
iacute: "\u00ED",
icirc: "\u00EE",
iuml: "\u00EF",
eth: "\u00F0",
ntilde: "\u00F1",
ograve: "\u00F2",
oacute: "\u00F3",
ocirc: "\u00F4",
otilde: "\u00F5",
ouml: "\u00F6",
divide: "\u00F7",
oslash: "\u00F8",
ugrave: "\u00F9",
uacute: "\u00FA",
ucirc: "\u00FB",
uuml: "\u00FC",
yacute: "\u00FD",
thorn: "\u00FE",
yuml: "\u00FF",
OElig: "\u0152",
oelig: "\u0153",
Scaron: "\u0160",
scaron: "\u0161",
Yuml: "\u0178",
fnof: "\u0192",
circ: "\u02C6",
tilde: "\u02DC",
Alpha: "\u0391",
Beta: "\u0392",
Gamma: "\u0393",
Delta: "\u0394",
Epsilon: "\u0395",
Zeta: "\u0396",
Eta: "\u0397",
Theta: "\u0398",
Iota: "\u0399",
Kappa: "\u039A",
Lambda: "\u039B",
Mu: "\u039C",
Nu: "\u039D",
Xi: "\u039E",
Omicron: "\u039F",
Pi: "\u03A0",
Rho: "\u03A1",
Sigma: "\u03A3",
Tau: "\u03A4",
Upsilon: "\u03A5",
Phi: "\u03A6",
Chi: "\u03A7",
Psi: "\u03A8",
Omega: "\u03A9",
alpha: "\u03B1",
beta: "\u03B2",
gamma: "\u03B3",
delta: "\u03B4",
epsilon: "\u03B5",
zeta: "\u03B6",
eta: "\u03B7",
theta: "\u03B8",
iota: "\u03B9",
kappa: "\u03BA",
lambda: "\u03BB",
mu: "\u03BC",
nu: "\u03BD",
xi: "\u03BE",
omicron: "\u03BF",
pi: "\u03C0",
rho: "\u03C1",
sigmaf: "\u03C2",
sigma: "\u03C3",
tau: "\u03C4",
upsilon: "\u03C5",
phi: "\u03C6",
chi: "\u03C7",
psi: "\u03C8",
omega: "\u03C9",
thetasym: "\u03D1",
upsih: "\u03D2",
piv: "\u03D6",
ensp: "\u2002",
emsp: "\u2003",
thinsp: "\u2009",
zwnj: "\u200C",
zwj: "\u200D",
lrm: "\u200E",
rlm: "\u200F",
ndash: "\u2013",
mdash: "\u2014",
lsquo: "\u2018",
rsquo: "\u2019",
sbquo: "\u201A",
ldquo: "\u201C",
rdquo: "\u201D",
bdquo: "\u201E",
dagger: "\u2020",
Dagger: "\u2021",
bull: "\u2022",
hellip: "\u2026",
permil: "\u2030",
prime: "\u2032",
Prime: "\u2033",
lsaquo: "\u2039",
rsaquo: "\u203A",
oline: "\u203E",
frasl: "\u2044",
euro: "\u20AC",
image: "\u2111",
weierp: "\u2118",
real: "\u211C",
trade: "\u2122",
alefsym: "\u2135",
larr: "\u2190",
uarr: "\u2191",
rarr: "\u2192",
darr: "\u2193",
harr: "\u2194",
crarr: "\u21B5",
lArr: "\u21D0",
uArr: "\u21D1",
rArr: "\u21D2",
dArr: "\u21D3",
hArr: "\u21D4",
forall: "\u2200",
part: "\u2202",
exist: "\u2203",
empty: "\u2205",
nabla: "\u2207",
isin: "\u2208",
notin: "\u2209",
ni: "\u220B",
prod: "\u220F",
sum: "\u2211",
minus: "\u2212",
lowast: "\u2217",
radic: "\u221A",
prop: "\u221D",
infin: "\u221E",
ang: "\u2220",
and: "\u2227",
or: "\u2228",
cap: "\u2229",
cup: "\u222A",
int: "\u222B",
there4: "\u2234",
sim: "\u223C",
cong: "\u2245",
asymp: "\u2248",
ne: "\u2260",
equiv: "\u2261",
le: "\u2264",
ge: "\u2265",
sub: "\u2282",
sup: "\u2283",
nsub: "\u2284",
sube: "\u2286",
supe: "\u2287",
oplus: "\u2295",
otimes: "\u2297",
perp: "\u22A5",
sdot: "\u22C5",
lceil: "\u2308",
rceil: "\u2309",
lfloor: "\u230A",
rfloor: "\u230B",
lang: "\u2329",
rang: "\u232A",
loz: "\u25CA",
spades: "\u2660",
clubs: "\u2663",
hearts: "\u2665",
diams: "\u2666"
};
var _default = entities;
exports.default = _default;
//# sourceMappingURL=xhtml.js.map

File diff suppressed because one or more lines are too long

198
node_modules/@babel/parser/lib/plugins/placeholders.js generated vendored Normal file
View File

@ -0,0 +1,198 @@
"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`({
ClassNameIsRequired: "A class name is required.",
UnexpectedSpace: "Unexpected space in placeholder."
});
var _default = superClass => class PlaceholdersParserMixin extends superClass {
parsePlaceholder(expectedNode) {
if (this.match(142)) {
const node = this.startNode();
this.next();
this.assertNoSpace();
node.name = super.parseIdentifier(true);
this.assertNoSpace();
this.expect(142);
return this.finishPlaceholder(node, expectedNode);
}
}
finishPlaceholder(node, expectedNode) {
const isFinished = !!(node.expectedNode && node.type === "Placeholder");
node.expectedNode = expectedNode;
return isFinished ? node : this.finishNode(node, "Placeholder");
}
getTokenFromCode(code) {
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
this.finishOp(142, 2);
} else {
super.getTokenFromCode(code);
}
}
parseExprAtom(refExpressionErrors) {
return this.parsePlaceholder("Expression") || super.parseExprAtom(refExpressionErrors);
}
parseIdentifier(liberal) {
return this.parsePlaceholder("Identifier") || super.parseIdentifier(liberal);
}
checkReservedWord(word, startLoc, checkKeywords, isBinding) {
if (word !== undefined) {
super.checkReservedWord(word, startLoc, checkKeywords, isBinding);
}
}
parseBindingAtom() {
return this.parsePlaceholder("Pattern") || super.parseBindingAtom();
}
isValidLVal(type, isParenthesized, binding) {
return type === "Placeholder" || super.isValidLVal(type, isParenthesized, binding);
}
toAssignable(node, isLHS) {
if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
node.expectedNode = "Pattern";
} else {
super.toAssignable(node, isLHS);
}
}
chStartsBindingIdentifier(ch, pos) {
if (super.chStartsBindingIdentifier(ch, pos)) {
return true;
}
const nextToken = this.lookahead();
if (nextToken.type === 142) {
return true;
}
return false;
}
verifyBreakContinue(node, isBreak) {
if (node.label && node.label.type === "Placeholder") return;
super.verifyBreakContinue(node, isBreak);
}
parseExpressionStatement(node, expr) {
var _expr$extra;
if (expr.type !== "Placeholder" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) {
return super.parseExpressionStatement(node, expr);
}
if (this.match(14)) {
const stmt = node;
stmt.label = this.finishPlaceholder(expr, "Identifier");
this.next();
stmt.body = super.parseStatementOrSloppyAnnexBFunctionDeclaration();
return this.finishNode(stmt, "LabeledStatement");
}
this.semicolon();
node.name = expr.name;
return this.finishPlaceholder(node, "Statement");
}
parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse) {
return this.parsePlaceholder("BlockStatement") || super.parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse);
}
parseFunctionId(requireId) {
return this.parsePlaceholder("Identifier") || super.parseFunctionId(requireId);
}
parseClass(node, isStatement, optionalId) {
const type = isStatement ? "ClassDeclaration" : "ClassExpression";
this.next();
const oldStrict = this.state.strict;
const placeholder = this.parsePlaceholder("Identifier");
if (placeholder) {
if (this.match(81) || this.match(142) || this.match(5)) {
node.id = placeholder;
} else if (optionalId || !isStatement) {
node.id = null;
node.body = this.finishPlaceholder(placeholder, "ClassBody");
return this.finishNode(node, type);
} else {
throw this.raise(PlaceholderErrors.ClassNameIsRequired, {
at: this.state.startLoc
});
}
} else {
this.parseClassId(node, isStatement, optionalId);
}
super.parseClassSuper(node);
node.body = this.parsePlaceholder("ClassBody") || super.parseClassBody(!!node.superClass, oldStrict);
return this.finishNode(node, type);
}
parseExport(node, decorators) {
const placeholder = this.parsePlaceholder("Identifier");
if (!placeholder) return super.parseExport(node, decorators);
if (!this.isContextual(97) && !this.match(12)) {
node.specifiers = [];
node.source = null;
node.declaration = this.finishPlaceholder(placeholder, "Declaration");
return this.finishNode(node, "ExportNamedDeclaration");
}
this.expectPlugin("exportDefaultFrom");
const specifier = this.startNode();
specifier.exported = placeholder;
node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
return super.parseExport(node, decorators);
}
isExportDefaultSpecifier() {
if (this.match(65)) {
const next = this.nextTokenStart();
if (this.isUnparsedContextual(next, "from")) {
if (this.input.startsWith((0, _types.tokenLabelName)(142), this.nextTokenStartSince(next + 4))) {
return true;
}
}
}
return super.isExportDefaultSpecifier();
}
maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
var _specifiers;
if ((_specifiers = node.specifiers) != null && _specifiers.length) {
return true;
}
return super.maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier);
}
checkExport(node) {
const {
specifiers
} = node;
if (specifiers != null && specifiers.length) {
node.specifiers = specifiers.filter(node => node.exported.type === "Placeholder");
}
super.checkExport(node);
node.specifiers = specifiers;
}
parseImport(node) {
const placeholder = this.parsePlaceholder("Identifier");
if (!placeholder) return super.parseImport(node);
node.specifiers = [];
if (!this.isContextual(97) && !this.match(12)) {
node.source = this.finishPlaceholder(placeholder, "StringLiteral");
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
}
const specifier = this.startNodeAtNode(placeholder);
specifier.local = placeholder;
node.specifiers.push(this.finishNode(specifier, "ImportDefaultSpecifier"));
if (this.eat(12)) {
const hasStarImport = this.maybeParseStarImportSpecifier(node);
if (!hasStarImport) this.parseNamedImportSpecifiers(node);
}
this.expectContextual(97);
node.source = this.parseImportSource();
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
}
parseImportSource() {
return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
}
assertNoSpace() {
if (this.state.start > this.state.lastTokEndLoc.index) {
this.raise(PlaceholderErrors.UnexpectedSpace, {
at: this.state.lastTokEndLoc
});
}
}
};
exports.default = _default;
//# sourceMappingURL=placeholders.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,121 @@
"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();
}
}
class TypeScriptScopeHandler extends _scope.default {
constructor(...args) {
super(...args);
this.importsStack = [];
}
createScope(flags) {
this.importsStack.push(new Set());
return new TypeScriptScope(flags);
}
enter(flags) {
if (flags == _scopeflags.ScopeFlag.TS_MODULE) {
this.importsStack.push(new Set());
}
super.enter(flags);
}
exit() {
const flags = super.exit();
if (flags == _scopeflags.ScopeFlag.TS_MODULE) {
this.importsStack.pop();
}
return flags;
}
hasImport(name, allowShadow) {
const len = this.importsStack.length;
if (this.importsStack[len - 1].has(name)) {
return true;
}
if (!allowShadow && len > 1) {
for (let i = 0; i < len - 1; i++) {
if (this.importsStack[i].has(name)) return true;
}
}
return false;
}
declareName(name, bindingType, loc) {
if (bindingType & _scopeflags.BindingFlag.FLAG_TS_IMPORT) {
if (this.hasImport(name, true)) {
this.parser.raise(_parseError.Errors.VarRedeclaration, {
at: loc,
identifierName: name
});
}
this.importsStack[this.importsStack.length - 1].add(name);
return;
}
const scope = this.currentScope();
if (bindingType & _scopeflags.BindingFlag.FLAG_TS_EXPORT_ONLY) {
this.maybeExportDefined(scope, name);
scope.exportOnlyBindings.add(name);
return;
}
super.declareName(name, bindingType, loc);
if (bindingType & _scopeflags.BindingFlag.KIND_TYPE) {
if (!(bindingType & _scopeflags.BindingFlag.KIND_VALUE)) {
this.checkRedeclarationInScope(scope, name, bindingType, loc);
this.maybeExportDefined(scope, name);
}
scope.types.add(name);
}
if (bindingType & _scopeflags.BindingFlag.FLAG_TS_ENUM) scope.enums.add(name);
if (bindingType & _scopeflags.BindingFlag.FLAG_TS_CONST_ENUM) {
scope.constEnums.add(name);
}
if (bindingType & _scopeflags.BindingFlag.FLAG_CLASS) scope.classes.add(name);
}
isRedeclaredInScope(scope, name, bindingType) {
if (scope.enums.has(name)) {
if (bindingType & _scopeflags.BindingFlag.FLAG_TS_ENUM) {
const isConst = !!(bindingType & _scopeflags.BindingFlag.FLAG_TS_CONST_ENUM);
const wasConst = scope.constEnums.has(name);
return isConst !== wasConst;
}
return true;
}
if (bindingType & _scopeflags.BindingFlag.FLAG_CLASS && scope.classes.has(name)) {
if (scope.lexical.has(name)) {
return !!(bindingType & _scopeflags.BindingFlag.KIND_VALUE);
} else {
return false;
}
}
if (bindingType & _scopeflags.BindingFlag.KIND_TYPE && scope.types.has(name)) {
return true;
}
return super.isRedeclaredInScope(scope, name, bindingType);
}
checkLocalExport(id) {
const {
name
} = id;
if (this.hasImport(name)) return;
const len = this.scopeStack.length;
for (let i = len - 1; i >= 0; i--) {
const scope = this.scopeStack[i];
if (scope.types.has(name) || scope.exportOnlyBindings.has(name)) return;
}
super.checkLocalExport(id);
}
}
exports.default = TypeScriptScopeHandler;
//# sourceMappingURL=scope.js.map

File diff suppressed because one or more lines are too long

31
node_modules/@babel/parser/lib/plugins/v8intrinsic.js generated vendored Normal file
View File

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _types = require("../tokenizer/types");
var _default = superClass => class V8IntrinsicMixin extends superClass {
parseV8Intrinsic() {
if (this.match(54)) {
const v8IntrinsicStartLoc = this.state.startLoc;
const node = this.startNode();
this.next();
if ((0, _types.tokenIsIdentifier)(this.state.type)) {
const name = this.parseIdentifierName();
const identifier = this.createIdentifier(node, name);
identifier.type = "V8IntrinsicIdentifier";
if (this.match(10)) {
return identifier;
}
}
this.unexpected(v8IntrinsicStartLoc);
}
}
parseExprAtom(refExpressionErrors) {
return this.parseV8Intrinsic() || super.parseExprAtom(refExpressionErrors);
}
};
exports.default = _default;
//# sourceMappingURL=v8intrinsic.js.map

View File

@ -0,0 +1 @@
{"version":3,"names":["_types","require","_default","superClass","V8IntrinsicMixin","parseV8Intrinsic","match","v8IntrinsicStartLoc","state","startLoc","node","startNode","next","tokenIsIdentifier","type","name","parseIdentifierName","identifier","createIdentifier","unexpected","parseExprAtom","refExpressionErrors","exports","default"],"sources":["../../src/plugins/v8intrinsic.ts"],"sourcesContent":["import type Parser from \"../parser\";\nimport { tokenIsIdentifier, tt } from \"../tokenizer/types\";\nimport type * as N from \"../types\";\nimport type { ExpressionErrors } from \"../parser/util\";\n\nexport default (superClass: typeof Parser) =>\n class V8IntrinsicMixin extends superClass implements Parser {\n parseV8Intrinsic(): N.Expression {\n if (this.match(tt.modulo)) {\n const v8IntrinsicStartLoc = this.state.startLoc;\n // let the `loc` of Identifier starts from `%`\n const node = this.startNode<N.Identifier>();\n this.next(); // eat '%'\n if (tokenIsIdentifier(this.state.type)) {\n const name = this.parseIdentifierName();\n const identifier = this.createIdentifier(node, name);\n // @ts-expect-error: avoid mutating AST types\n identifier.type = \"V8IntrinsicIdentifier\";\n if (this.match(tt.parenL)) {\n return identifier;\n }\n }\n this.unexpected(v8IntrinsicStartLoc);\n }\n }\n\n /* ============================================================ *\n * parser/expression.js *\n * ============================================================ */\n\n parseExprAtom(refExpressionErrors?: ExpressionErrors | null): N.Expression {\n return (\n this.parseV8Intrinsic() || super.parseExprAtom(refExpressionErrors)\n );\n }\n };\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAA2D,IAAAC,QAAA,GAI3CC,UAAyB,IACvC,MAAMC,gBAAgB,SAASD,UAAU,CAAmB;EAC1DE,gBAAgBA,CAAA,EAAiB;IAC/B,IAAI,IAAI,CAACC,KAAK,GAAU,CAAC,EAAE;MACzB,MAAMC,mBAAmB,GAAG,IAAI,CAACC,KAAK,CAACC,QAAQ;MAE/C,MAAMC,IAAI,GAAG,IAAI,CAACC,SAAS,CAAe,CAAC;MAC3C,IAAI,CAACC,IAAI,CAAC,CAAC;MACX,IAAI,IAAAC,wBAAiB,EAAC,IAAI,CAACL,KAAK,CAACM,IAAI,CAAC,EAAE;QACtC,MAAMC,IAAI,GAAG,IAAI,CAACC,mBAAmB,CAAC,CAAC;QACvC,MAAMC,UAAU,GAAG,IAAI,CAACC,gBAAgB,CAACR,IAAI,EAAEK,IAAI,CAAC;QAEpDE,UAAU,CAACH,IAAI,GAAG,uBAAuB;QACzC,IAAI,IAAI,CAACR,KAAK,GAAU,CAAC,EAAE;UACzB,OAAOW,UAAU;QACnB;MACF;MACA,IAAI,CAACE,UAAU,CAACZ,mBAAmB,CAAC;IACtC;EACF;EAMAa,aAAaA,CAACC,mBAA6C,EAAgB;IACzE,OACE,IAAI,CAAChB,gBAAgB,CAAC,CAAC,IAAI,KAAK,CAACe,aAAa,CAACC,mBAAmB,CAAC;EAEvE;AACF,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAArB,QAAA"}