mirror of
https://github.com/crazy-max/ghaction-upx.git
synced 2025-12-15 01:10:40 -07:00
Update node_modules
This commit is contained in:
265
node_modules/@babel/parser/lib/plugins/estree.js
generated
vendored
Normal file
265
node_modules/@babel/parser/lib/plugins/estree.js
generated
vendored
Normal file
@@ -0,0 +1,265 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _types = require("../tokenizer/types");
|
||||
|
||||
var N = _interopRequireWildcard(require("../types"));
|
||||
|
||||
var _scopeflags = require("../util/scopeflags");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function isSimpleProperty(node) {
|
||||
return node != null && node.type === "Property" && node.kind === "init" && node.method === false;
|
||||
}
|
||||
|
||||
var _default = superClass => class extends superClass {
|
||||
estreeParseRegExpLiteral({
|
||||
pattern,
|
||||
flags
|
||||
}) {
|
||||
let regex = null;
|
||||
|
||||
try {
|
||||
regex = new RegExp(pattern, flags);
|
||||
} catch (e) {}
|
||||
|
||||
const node = this.estreeParseLiteral(regex);
|
||||
node.regex = {
|
||||
pattern,
|
||||
flags
|
||||
};
|
||||
return node;
|
||||
}
|
||||
|
||||
estreeParseBigIntLiteral(value) {
|
||||
const bigInt = typeof BigInt !== "undefined" ? BigInt(value) : null;
|
||||
const node = this.estreeParseLiteral(bigInt);
|
||||
node.bigint = String(node.value || value);
|
||||
return node;
|
||||
}
|
||||
|
||||
estreeParseLiteral(value) {
|
||||
return this.parseLiteral(value, "Literal");
|
||||
}
|
||||
|
||||
directiveToStmt(directive) {
|
||||
const directiveLiteral = directive.value;
|
||||
const stmt = this.startNodeAt(directive.start, directive.loc.start);
|
||||
const expression = this.startNodeAt(directiveLiteral.start, directiveLiteral.loc.start);
|
||||
expression.value = directiveLiteral.value;
|
||||
expression.raw = directiveLiteral.extra.raw;
|
||||
stmt.expression = this.finishNodeAt(expression, "Literal", directiveLiteral.end, directiveLiteral.loc.end);
|
||||
stmt.directive = directiveLiteral.extra.raw.slice(1, -1);
|
||||
return this.finishNodeAt(stmt, "ExpressionStatement", directive.end, directive.loc.end);
|
||||
}
|
||||
|
||||
initFunction(node, isAsync) {
|
||||
super.initFunction(node, isAsync);
|
||||
node.expression = false;
|
||||
}
|
||||
|
||||
checkDeclaration(node) {
|
||||
if (isSimpleProperty(node)) {
|
||||
this.checkDeclaration(node.value);
|
||||
} else {
|
||||
super.checkDeclaration(node);
|
||||
}
|
||||
}
|
||||
|
||||
checkGetterSetterParams(method) {
|
||||
const prop = method;
|
||||
const paramCount = prop.kind === "get" ? 0 : 1;
|
||||
const start = prop.start;
|
||||
|
||||
if (prop.value.params.length !== paramCount) {
|
||||
if (prop.kind === "get") {
|
||||
this.raise(start, "getter must not have any formal parameters");
|
||||
} else {
|
||||
this.raise(start, "setter must have exactly one formal parameter");
|
||||
}
|
||||
} else if (prop.kind === "set" && prop.value.params[0].type === "RestElement") {
|
||||
this.raise(start, "setter function argument must not be a rest parameter");
|
||||
}
|
||||
}
|
||||
|
||||
checkLVal(expr, bindingType = _scopeflags.BIND_NONE, checkClashes, contextDescription, disallowLetBinding) {
|
||||
switch (expr.type) {
|
||||
case "ObjectPattern":
|
||||
expr.properties.forEach(prop => {
|
||||
this.checkLVal(prop.type === "Property" ? prop.value : prop, bindingType, checkClashes, "object destructuring pattern", disallowLetBinding);
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
super.checkLVal(expr, bindingType, checkClashes, contextDescription, disallowLetBinding);
|
||||
}
|
||||
}
|
||||
|
||||
checkDuplicatedProto(prop, protoRef) {
|
||||
if (prop.type === "SpreadElement" || prop.computed || prop.method || prop.shorthand) {
|
||||
return;
|
||||
}
|
||||
|
||||
const key = prop.key;
|
||||
const name = key.type === "Identifier" ? key.name : String(key.value);
|
||||
|
||||
if (name === "__proto__" && prop.kind === "init") {
|
||||
if (protoRef.used && !protoRef.start) {
|
||||
protoRef.start = key.start;
|
||||
}
|
||||
|
||||
protoRef.used = true;
|
||||
}
|
||||
}
|
||||
|
||||
isValidDirective(stmt) {
|
||||
return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && (!stmt.expression.extra || !stmt.expression.extra.parenthesized);
|
||||
}
|
||||
|
||||
stmtToDirective(stmt) {
|
||||
const directive = super.stmtToDirective(stmt);
|
||||
const value = stmt.expression.value;
|
||||
directive.value.value = value;
|
||||
return directive;
|
||||
}
|
||||
|
||||
parseBlockBody(node, allowDirectives, topLevel, end) {
|
||||
super.parseBlockBody(node, allowDirectives, topLevel, end);
|
||||
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);
|
||||
}
|
||||
|
||||
parseExprAtom(refShorthandDefaultPos) {
|
||||
switch (this.state.type) {
|
||||
case _types.types.num:
|
||||
case _types.types.string:
|
||||
return this.estreeParseLiteral(this.state.value);
|
||||
|
||||
case _types.types.regexp:
|
||||
return this.estreeParseRegExpLiteral(this.state.value);
|
||||
|
||||
case _types.types.bigint:
|
||||
return this.estreeParseBigIntLiteral(this.state.value);
|
||||
|
||||
case _types.types._null:
|
||||
return this.estreeParseLiteral(null);
|
||||
|
||||
case _types.types._true:
|
||||
return this.estreeParseLiteral(true);
|
||||
|
||||
case _types.types._false:
|
||||
return this.estreeParseLiteral(false);
|
||||
|
||||
default:
|
||||
return super.parseExprAtom(refShorthandDefaultPos);
|
||||
}
|
||||
}
|
||||
|
||||
parseLiteral(value, type, startPos, startLoc) {
|
||||
const node = super.parseLiteral(value, type, startPos, startLoc);
|
||||
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;
|
||||
type = type === "ClassMethod" ? "MethodDefinition" : type;
|
||||
return this.finishNode(node, type);
|
||||
}
|
||||
|
||||
parseObjectMethod(prop, isGenerator, isAsync, isPattern, containsEsc) {
|
||||
const node = super.parseObjectMethod(prop, isGenerator, isAsync, isPattern, containsEsc);
|
||||
|
||||
if (node) {
|
||||
node.type = "Property";
|
||||
if (node.kind === "method") node.kind = "init";
|
||||
node.shorthand = false;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
parseObjectProperty(prop, startPos, startLoc, isPattern, refShorthandDefaultPos) {
|
||||
const node = super.parseObjectProperty(prop, startPos, startLoc, isPattern, refShorthandDefaultPos);
|
||||
|
||||
if (node) {
|
||||
node.kind = "init";
|
||||
node.type = "Property";
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
toAssignable(node, isBinding, contextDescription) {
|
||||
if (isSimpleProperty(node)) {
|
||||
this.toAssignable(node.value, isBinding, contextDescription);
|
||||
return node;
|
||||
}
|
||||
|
||||
return super.toAssignable(node, isBinding, contextDescription);
|
||||
}
|
||||
|
||||
toAssignableObjectExpressionProp(prop, isBinding, isLast) {
|
||||
if (prop.kind === "get" || prop.kind === "set") {
|
||||
throw this.raise(prop.key.start, "Object pattern can't contain getter or setter");
|
||||
} else if (prop.method) {
|
||||
throw this.raise(prop.key.start, "Object pattern can't contain methods");
|
||||
} else {
|
||||
super.toAssignableObjectExpressionProp(prop, isBinding, isLast);
|
||||
}
|
||||
}
|
||||
|
||||
finishCallExpression(node, optional) {
|
||||
super.finishCallExpression(node, optional);
|
||||
|
||||
if (node.callee.type === "Import") {
|
||||
node.type = "ImportExpression";
|
||||
node.source = node.arguments[0];
|
||||
delete node.arguments;
|
||||
delete node.callee;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
toReferencedListDeep(exprList, isParenthesizedExpr) {
|
||||
if (!exprList) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.toReferencedListDeep(exprList, isParenthesizedExpr);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
2689
node_modules/@babel/parser/lib/plugins/flow.js
generated
vendored
Normal file
2689
node_modules/@babel/parser/lib/plugins/flow.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
516
node_modules/@babel/parser/lib/plugins/jsx/index.js
generated
vendored
Normal file
516
node_modules/@babel/parser/lib/plugins/jsx/index.js
generated
vendored
Normal file
@@ -0,0 +1,516 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _xhtml = _interopRequireDefault(require("./xhtml"));
|
||||
|
||||
var _types = require("../../tokenizer/types");
|
||||
|
||||
var _context = require("../../tokenizer/context");
|
||||
|
||||
var N = _interopRequireWildcard(require("../../types"));
|
||||
|
||||
var _identifier = require("../../util/identifier");
|
||||
|
||||
var _whitespace = require("../../util/whitespace");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const HEX_NUMBER = /^[\da-fA-F]+$/;
|
||||
const DECIMAL_NUMBER = /^\d+$/;
|
||||
_context.types.j_oTag = new _context.TokContext("<tag", false);
|
||||
_context.types.j_cTag = new _context.TokContext("</tag", false);
|
||||
_context.types.j_expr = new _context.TokContext("<tag>...</tag>", true, true);
|
||||
_types.types.jsxName = new _types.TokenType("jsxName");
|
||||
_types.types.jsxText = new _types.TokenType("jsxText", {
|
||||
beforeExpr: true
|
||||
});
|
||||
_types.types.jsxTagStart = new _types.TokenType("jsxTagStart", {
|
||||
startsExpr: true
|
||||
});
|
||||
_types.types.jsxTagEnd = new _types.TokenType("jsxTagEnd");
|
||||
|
||||
_types.types.jsxTagStart.updateContext = function () {
|
||||
this.state.context.push(_context.types.j_expr);
|
||||
this.state.context.push(_context.types.j_oTag);
|
||||
this.state.exprAllowed = false;
|
||||
};
|
||||
|
||||
_types.types.jsxTagEnd.updateContext = function (prevType) {
|
||||
const out = this.state.context.pop();
|
||||
|
||||
if (out === _context.types.j_oTag && prevType === _types.types.slash || out === _context.types.j_cTag) {
|
||||
this.state.context.pop();
|
||||
this.state.exprAllowed = this.curContext() === _context.types.j_expr;
|
||||
} else {
|
||||
this.state.exprAllowed = true;
|
||||
}
|
||||
};
|
||||
|
||||
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 extends superClass {
|
||||
jsxReadToken() {
|
||||
let out = "";
|
||||
let chunkStart = this.state.pos;
|
||||
|
||||
for (;;) {
|
||||
if (this.state.pos >= this.length) {
|
||||
throw this.raise(this.state.start, "Unterminated JSX contents");
|
||||
}
|
||||
|
||||
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.exprAllowed) {
|
||||
++this.state.pos;
|
||||
return this.finishToken(_types.types.jsxTagStart);
|
||||
}
|
||||
|
||||
return super.getTokenFromCode(ch);
|
||||
}
|
||||
|
||||
out += this.input.slice(chunkStart, this.state.pos);
|
||||
return this.finishToken(_types.types.jsxText, out);
|
||||
|
||||
case 38:
|
||||
out += this.input.slice(chunkStart, this.state.pos);
|
||||
out += this.jsxReadEntity();
|
||||
chunkStart = this.state.pos;
|
||||
break;
|
||||
|
||||
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(this.state.start, "Unterminated string constant");
|
||||
}
|
||||
|
||||
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++);
|
||||
return this.finishToken(_types.types.string, out);
|
||||
}
|
||||
|
||||
jsxReadEntity() {
|
||||
let str = "";
|
||||
let count = 0;
|
||||
let entity;
|
||||
let ch = this.input[this.state.pos];
|
||||
const startPos = ++this.state.pos;
|
||||
|
||||
while (this.state.pos < this.length && count++ < 10) {
|
||||
ch = this.input[this.state.pos++];
|
||||
|
||||
if (ch === ";") {
|
||||
if (str[0] === "#") {
|
||||
if (str[1] === "x") {
|
||||
str = str.substr(2);
|
||||
|
||||
if (HEX_NUMBER.test(str)) {
|
||||
entity = String.fromCodePoint(parseInt(str, 16));
|
||||
}
|
||||
} else {
|
||||
str = str.substr(1);
|
||||
|
||||
if (DECIMAL_NUMBER.test(str)) {
|
||||
entity = String.fromCodePoint(parseInt(str, 10));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
entity = _xhtml.default[str];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
str += ch;
|
||||
}
|
||||
|
||||
if (!entity) {
|
||||
this.state.pos = startPos;
|
||||
return "&";
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
jsxReadWord() {
|
||||
let ch;
|
||||
const start = this.state.pos;
|
||||
|
||||
do {
|
||||
ch = this.input.charCodeAt(++this.state.pos);
|
||||
} while ((0, _identifier.isIdentifierChar)(ch) || ch === 45);
|
||||
|
||||
return this.finishToken(_types.types.jsxName, this.input.slice(start, this.state.pos));
|
||||
}
|
||||
|
||||
jsxParseIdentifier() {
|
||||
const node = this.startNode();
|
||||
|
||||
if (this.match(_types.types.jsxName)) {
|
||||
node.name = this.state.value;
|
||||
} else if (this.state.type.keyword) {
|
||||
node.name = this.state.type.keyword;
|
||||
} else {
|
||||
this.unexpected();
|
||||
}
|
||||
|
||||
this.next();
|
||||
return this.finishNode(node, "JSXIdentifier");
|
||||
}
|
||||
|
||||
jsxParseNamespacedName() {
|
||||
const startPos = this.state.start;
|
||||
const startLoc = this.state.startLoc;
|
||||
const name = this.jsxParseIdentifier();
|
||||
if (!this.eat(_types.types.colon)) return name;
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
node.namespace = name;
|
||||
node.name = this.jsxParseIdentifier();
|
||||
return this.finishNode(node, "JSXNamespacedName");
|
||||
}
|
||||
|
||||
jsxParseElementName() {
|
||||
const startPos = this.state.start;
|
||||
const startLoc = this.state.startLoc;
|
||||
let node = this.jsxParseNamespacedName();
|
||||
|
||||
if (node.type === "JSXNamespacedName") {
|
||||
return node;
|
||||
}
|
||||
|
||||
while (this.eat(_types.types.dot)) {
|
||||
const newNode = this.startNodeAt(startPos, startLoc);
|
||||
newNode.object = node;
|
||||
newNode.property = this.jsxParseIdentifier();
|
||||
node = this.finishNode(newNode, "JSXMemberExpression");
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
jsxParseAttributeValue() {
|
||||
let node;
|
||||
|
||||
switch (this.state.type) {
|
||||
case _types.types.braceL:
|
||||
node = this.startNode();
|
||||
this.next();
|
||||
node = this.jsxParseExpressionContainer(node);
|
||||
|
||||
if (node.expression.type === "JSXEmptyExpression") {
|
||||
this.raise(node.start, "JSX attributes must only be assigned a non-empty expression");
|
||||
}
|
||||
|
||||
return node;
|
||||
|
||||
case _types.types.jsxTagStart:
|
||||
case _types.types.string:
|
||||
return this.parseExprAtom();
|
||||
|
||||
default:
|
||||
throw this.raise(this.state.start, "JSX value should be either an expression or a quoted JSX text");
|
||||
}
|
||||
}
|
||||
|
||||
jsxParseEmptyExpression() {
|
||||
const node = this.startNodeAt(this.state.lastTokEnd, this.state.lastTokEndLoc);
|
||||
return this.finishNodeAt(node, "JSXEmptyExpression", this.state.start, this.state.startLoc);
|
||||
}
|
||||
|
||||
jsxParseSpreadChild(node) {
|
||||
this.next();
|
||||
node.expression = this.parseExpression();
|
||||
this.expect(_types.types.braceR);
|
||||
return this.finishNode(node, "JSXSpreadChild");
|
||||
}
|
||||
|
||||
jsxParseExpressionContainer(node) {
|
||||
if (this.match(_types.types.braceR)) {
|
||||
node.expression = this.jsxParseEmptyExpression();
|
||||
} else {
|
||||
node.expression = this.parseExpression();
|
||||
}
|
||||
|
||||
this.expect(_types.types.braceR);
|
||||
return this.finishNode(node, "JSXExpressionContainer");
|
||||
}
|
||||
|
||||
jsxParseAttribute() {
|
||||
const node = this.startNode();
|
||||
|
||||
if (this.eat(_types.types.braceL)) {
|
||||
this.expect(_types.types.ellipsis);
|
||||
node.argument = this.parseMaybeAssign();
|
||||
this.expect(_types.types.braceR);
|
||||
return this.finishNode(node, "JSXSpreadAttribute");
|
||||
}
|
||||
|
||||
node.name = this.jsxParseNamespacedName();
|
||||
node.value = this.eat(_types.types.eq) ? this.jsxParseAttributeValue() : null;
|
||||
return this.finishNode(node, "JSXAttribute");
|
||||
}
|
||||
|
||||
jsxParseOpeningElementAt(startPos, startLoc) {
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
|
||||
if (this.match(_types.types.jsxTagEnd)) {
|
||||
this.expect(_types.types.jsxTagEnd);
|
||||
return this.finishNode(node, "JSXOpeningFragment");
|
||||
}
|
||||
|
||||
node.name = this.jsxParseElementName();
|
||||
return this.jsxParseOpeningElementAfterName(node);
|
||||
}
|
||||
|
||||
jsxParseOpeningElementAfterName(node) {
|
||||
const attributes = [];
|
||||
|
||||
while (!this.match(_types.types.slash) && !this.match(_types.types.jsxTagEnd)) {
|
||||
attributes.push(this.jsxParseAttribute());
|
||||
}
|
||||
|
||||
node.attributes = attributes;
|
||||
node.selfClosing = this.eat(_types.types.slash);
|
||||
this.expect(_types.types.jsxTagEnd);
|
||||
return this.finishNode(node, "JSXOpeningElement");
|
||||
}
|
||||
|
||||
jsxParseClosingElementAt(startPos, startLoc) {
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
|
||||
if (this.match(_types.types.jsxTagEnd)) {
|
||||
this.expect(_types.types.jsxTagEnd);
|
||||
return this.finishNode(node, "JSXClosingFragment");
|
||||
}
|
||||
|
||||
node.name = this.jsxParseElementName();
|
||||
this.expect(_types.types.jsxTagEnd);
|
||||
return this.finishNode(node, "JSXClosingElement");
|
||||
}
|
||||
|
||||
jsxParseElementAt(startPos, startLoc) {
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
const children = [];
|
||||
const openingElement = this.jsxParseOpeningElementAt(startPos, startLoc);
|
||||
let closingElement = null;
|
||||
|
||||
if (!openingElement.selfClosing) {
|
||||
contents: for (;;) {
|
||||
switch (this.state.type) {
|
||||
case _types.types.jsxTagStart:
|
||||
startPos = this.state.start;
|
||||
startLoc = this.state.startLoc;
|
||||
this.next();
|
||||
|
||||
if (this.eat(_types.types.slash)) {
|
||||
closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
|
||||
break contents;
|
||||
}
|
||||
|
||||
children.push(this.jsxParseElementAt(startPos, startLoc));
|
||||
break;
|
||||
|
||||
case _types.types.jsxText:
|
||||
children.push(this.parseExprAtom());
|
||||
break;
|
||||
|
||||
case _types.types.braceL:
|
||||
{
|
||||
const node = this.startNode();
|
||||
this.next();
|
||||
|
||||
if (this.match(_types.types.ellipsis)) {
|
||||
children.push(this.jsxParseSpreadChild(node));
|
||||
} else {
|
||||
children.push(this.jsxParseExpressionContainer(node));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw this.unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
if (isFragment(openingElement) && !isFragment(closingElement)) {
|
||||
this.raise(closingElement.start, "Expected corresponding JSX closing tag for <>");
|
||||
} else if (!isFragment(openingElement) && isFragment(closingElement)) {
|
||||
this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">");
|
||||
} else if (!isFragment(openingElement) && !isFragment(closingElement)) {
|
||||
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
|
||||
this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isFragment(openingElement)) {
|
||||
node.openingFragment = openingElement;
|
||||
node.closingFragment = closingElement;
|
||||
} else {
|
||||
node.openingElement = openingElement;
|
||||
node.closingElement = closingElement;
|
||||
}
|
||||
|
||||
node.children = children;
|
||||
|
||||
if (this.isRelational("<")) {
|
||||
throw this.raise(this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag. " + "Did you want a JSX fragment <>...</>?");
|
||||
}
|
||||
|
||||
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
|
||||
}
|
||||
|
||||
jsxParseElement() {
|
||||
const startPos = this.state.start;
|
||||
const startLoc = this.state.startLoc;
|
||||
this.next();
|
||||
return this.jsxParseElementAt(startPos, startLoc);
|
||||
}
|
||||
|
||||
parseExprAtom(refShortHandDefaultPos) {
|
||||
if (this.match(_types.types.jsxText)) {
|
||||
return this.parseLiteral(this.state.value, "JSXText");
|
||||
} else if (this.match(_types.types.jsxTagStart)) {
|
||||
return this.jsxParseElement();
|
||||
} else if (this.isRelational("<") && this.input.charCodeAt(this.state.pos) !== 33) {
|
||||
this.finishToken(_types.types.jsxTagStart);
|
||||
return this.jsxParseElement();
|
||||
} else {
|
||||
return super.parseExprAtom(refShortHandDefaultPos);
|
||||
}
|
||||
}
|
||||
|
||||
getTokenFromCode(code) {
|
||||
if (this.state.inPropertyName) return super.getTokenFromCode(code);
|
||||
const context = this.curContext();
|
||||
|
||||
if (context === _context.types.j_expr) {
|
||||
return this.jsxReadToken();
|
||||
}
|
||||
|
||||
if (context === _context.types.j_oTag || context === _context.types.j_cTag) {
|
||||
if ((0, _identifier.isIdentifierStart)(code)) {
|
||||
return this.jsxReadWord();
|
||||
}
|
||||
|
||||
if (code === 62) {
|
||||
++this.state.pos;
|
||||
return this.finishToken(_types.types.jsxTagEnd);
|
||||
}
|
||||
|
||||
if ((code === 34 || code === 39) && context === _context.types.j_oTag) {
|
||||
return this.jsxReadString(code);
|
||||
}
|
||||
}
|
||||
|
||||
if (code === 60 && this.state.exprAllowed && this.input.charCodeAt(this.state.pos + 1) !== 33) {
|
||||
++this.state.pos;
|
||||
return this.finishToken(_types.types.jsxTagStart);
|
||||
}
|
||||
|
||||
return super.getTokenFromCode(code);
|
||||
}
|
||||
|
||||
updateContext(prevType) {
|
||||
if (this.match(_types.types.braceL)) {
|
||||
const curContext = this.curContext();
|
||||
|
||||
if (curContext === _context.types.j_oTag) {
|
||||
this.state.context.push(_context.types.braceExpression);
|
||||
} else if (curContext === _context.types.j_expr) {
|
||||
this.state.context.push(_context.types.templateQuasi);
|
||||
} else {
|
||||
super.updateContext(prevType);
|
||||
}
|
||||
|
||||
this.state.exprAllowed = true;
|
||||
} else if (this.match(_types.types.slash) && prevType === _types.types.jsxTagStart) {
|
||||
this.state.context.length -= 2;
|
||||
this.state.context.push(_context.types.j_cTag);
|
||||
this.state.exprAllowed = false;
|
||||
} else {
|
||||
return super.updateContext(prevType);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
263
node_modules/@babel/parser/lib/plugins/jsx/xhtml.js
generated
vendored
Normal file
263
node_modules/@babel/parser/lib/plugins/jsx/xhtml.js
generated
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
const entities = {
|
||||
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;
|
||||
204
node_modules/@babel/parser/lib/plugins/placeholders.js
generated
vendored
Normal file
204
node_modules/@babel/parser/lib/plugins/placeholders.js
generated
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _types = require("../tokenizer/types");
|
||||
|
||||
var N = _interopRequireWildcard(require("../types"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
_types.types.placeholder = new _types.TokenType("%%", {
|
||||
startsExpr: true
|
||||
});
|
||||
|
||||
var _default = superClass => class extends superClass {
|
||||
parsePlaceholder(expectedNode) {
|
||||
if (this.match(_types.types.placeholder)) {
|
||||
const node = this.startNode();
|
||||
this.next();
|
||||
this.assertNoSpace("Unexpected space in placeholder.");
|
||||
node.name = super.parseIdentifier(true);
|
||||
this.assertNoSpace("Unexpected space in placeholder.");
|
||||
this.expect(_types.types.placeholder);
|
||||
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) {
|
||||
return this.finishOp(_types.types.placeholder, 2);
|
||||
}
|
||||
|
||||
return super.getTokenFromCode(...arguments);
|
||||
}
|
||||
|
||||
parseExprAtom() {
|
||||
return this.parsePlaceholder("Expression") || super.parseExprAtom(...arguments);
|
||||
}
|
||||
|
||||
parseIdentifier() {
|
||||
return this.parsePlaceholder("Identifier") || super.parseIdentifier(...arguments);
|
||||
}
|
||||
|
||||
checkReservedWord(word) {
|
||||
if (word !== undefined) super.checkReservedWord(...arguments);
|
||||
}
|
||||
|
||||
parseBindingAtom() {
|
||||
return this.parsePlaceholder("Pattern") || super.parseBindingAtom(...arguments);
|
||||
}
|
||||
|
||||
checkLVal(expr) {
|
||||
if (expr.type !== "Placeholder") super.checkLVal(...arguments);
|
||||
}
|
||||
|
||||
toAssignable(node) {
|
||||
if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
|
||||
node.expectedNode = "Pattern";
|
||||
return node;
|
||||
}
|
||||
|
||||
return super.toAssignable(...arguments);
|
||||
}
|
||||
|
||||
verifyBreakContinue(node) {
|
||||
if (node.label && node.label.type === "Placeholder") return;
|
||||
super.verifyBreakContinue(...arguments);
|
||||
}
|
||||
|
||||
parseExpressionStatement(node, expr) {
|
||||
if (expr.type !== "Placeholder" || expr.extra && expr.extra.parenthesized) {
|
||||
return super.parseExpressionStatement(...arguments);
|
||||
}
|
||||
|
||||
if (this.match(_types.types.colon)) {
|
||||
const stmt = node;
|
||||
stmt.label = this.finishPlaceholder(expr, "Identifier");
|
||||
this.next();
|
||||
stmt.body = this.parseStatement("label");
|
||||
return this.finishNode(stmt, "LabeledStatement");
|
||||
}
|
||||
|
||||
this.semicolon();
|
||||
node.name = expr.name;
|
||||
return this.finishPlaceholder(node, "Statement");
|
||||
}
|
||||
|
||||
parseBlock() {
|
||||
return this.parsePlaceholder("BlockStatement") || super.parseBlock(...arguments);
|
||||
}
|
||||
|
||||
parseFunctionId() {
|
||||
return this.parsePlaceholder("Identifier") || super.parseFunctionId(...arguments);
|
||||
}
|
||||
|
||||
parseClass(node, isStatement, optionalId) {
|
||||
const type = isStatement ? "ClassDeclaration" : "ClassExpression";
|
||||
this.next();
|
||||
this.takeDecorators(node);
|
||||
const placeholder = this.parsePlaceholder("Identifier");
|
||||
|
||||
if (placeholder) {
|
||||
if (this.match(_types.types._extends) || this.match(_types.types.placeholder) || this.match(_types.types.braceL)) {
|
||||
node.id = placeholder;
|
||||
} else if (optionalId || !isStatement) {
|
||||
node.id = null;
|
||||
node.body = this.finishPlaceholder(placeholder, "ClassBody");
|
||||
return this.finishNode(node, type);
|
||||
} else {
|
||||
this.unexpected(null, "A class name is required");
|
||||
}
|
||||
} else {
|
||||
this.parseClassId(node, isStatement, optionalId);
|
||||
}
|
||||
|
||||
this.parseClassSuper(node);
|
||||
node.body = this.parsePlaceholder("ClassBody") || this.parseClassBody(!!node.superClass);
|
||||
return this.finishNode(node, type);
|
||||
}
|
||||
|
||||
parseExport(node) {
|
||||
const placeholder = this.parsePlaceholder("Identifier");
|
||||
if (!placeholder) return super.parseExport(...arguments);
|
||||
|
||||
if (!this.isContextual("from") && !this.match(_types.types.comma)) {
|
||||
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);
|
||||
}
|
||||
|
||||
maybeParseExportDefaultSpecifier(node) {
|
||||
if (node.specifiers && node.specifiers.length > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.maybeParseExportDefaultSpecifier(...arguments);
|
||||
}
|
||||
|
||||
checkExport(node) {
|
||||
const {
|
||||
specifiers
|
||||
} = node;
|
||||
|
||||
if (specifiers && 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(...arguments);
|
||||
node.specifiers = [];
|
||||
|
||||
if (!this.isContextual("from") && !this.match(_types.types.comma)) {
|
||||
node.source = this.finishPlaceholder(placeholder, "StringLiteral");
|
||||
this.semicolon();
|
||||
return this.finishNode(node, "ImportDeclaration");
|
||||
}
|
||||
|
||||
const specifier = this.startNodeAtNode(placeholder);
|
||||
specifier.local = placeholder;
|
||||
this.finishNode(specifier, "ImportDefaultSpecifier");
|
||||
node.specifiers.push(specifier);
|
||||
|
||||
if (this.eat(_types.types.comma)) {
|
||||
const hasStarImport = this.maybeParseStarImportSpecifier(node);
|
||||
if (!hasStarImport) this.parseNamedImportSpecifiers(node);
|
||||
}
|
||||
|
||||
this.expectContextual("from");
|
||||
node.source = this.parseImportSource();
|
||||
this.semicolon();
|
||||
return this.finishNode(node, "ImportDeclaration");
|
||||
}
|
||||
|
||||
parseImportSource() {
|
||||
return this.parsePlaceholder("StringLiteral") || super.parseImportSource(...arguments);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
2076
node_modules/@babel/parser/lib/plugins/typescript/index.js
generated
vendored
Normal file
2076
node_modules/@babel/parser/lib/plugins/typescript/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
94
node_modules/@babel/parser/lib/plugins/typescript/scope.js
generated
vendored
Normal file
94
node_modules/@babel/parser/lib/plugins/typescript/scope.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _scope = _interopRequireWildcard(require("../../util/scope"));
|
||||
|
||||
var _scopeflags = require("../../util/scopeflags");
|
||||
|
||||
var N = _interopRequireWildcard(require("../../types"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
class TypeScriptScope extends _scope.Scope {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
this.types = [];
|
||||
this.enums = [];
|
||||
this.constEnums = [];
|
||||
this.classes = [];
|
||||
this.exportOnlyBindings = [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TypeScriptScopeHandler extends _scope.default {
|
||||
createScope(flags) {
|
||||
return new TypeScriptScope(flags);
|
||||
}
|
||||
|
||||
declareName(name, bindingType, pos) {
|
||||
const scope = this.currentScope();
|
||||
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_TS_EXPORT_ONLY) {
|
||||
this.maybeExportDefined(scope, name);
|
||||
scope.exportOnlyBindings.push(name);
|
||||
return;
|
||||
}
|
||||
|
||||
super.declareName(...arguments);
|
||||
|
||||
if (bindingType & _scopeflags.BIND_KIND_TYPE) {
|
||||
if (!(bindingType & _scopeflags.BIND_KIND_VALUE)) {
|
||||
this.checkRedeclarationInScope(scope, name, bindingType, pos);
|
||||
this.maybeExportDefined(scope, name);
|
||||
}
|
||||
|
||||
scope.types.push(name);
|
||||
}
|
||||
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_TS_ENUM) scope.enums.push(name);
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_TS_CONST_ENUM) scope.constEnums.push(name);
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_CLASS) scope.classes.push(name);
|
||||
}
|
||||
|
||||
isRedeclaredInScope(scope, name, bindingType) {
|
||||
if (scope.enums.indexOf(name) > -1) {
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_TS_ENUM) {
|
||||
const isConst = !!(bindingType & _scopeflags.BIND_FLAGS_TS_CONST_ENUM);
|
||||
const wasConst = scope.constEnums.indexOf(name) > -1;
|
||||
return isConst !== wasConst;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_CLASS && scope.classes.indexOf(name) > -1) {
|
||||
if (scope.lexical.indexOf(name) > -1) {
|
||||
return !!(bindingType & _scopeflags.BIND_KIND_VALUE);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (bindingType & _scopeflags.BIND_KIND_TYPE && scope.types.indexOf(name) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.isRedeclaredInScope(...arguments);
|
||||
}
|
||||
|
||||
checkLocalExport(id) {
|
||||
if (this.scopeStack[0].types.indexOf(id.name) === -1 && this.scopeStack[0].exportOnlyBindings.indexOf(id.name) === -1) {
|
||||
super.checkLocalExport(id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = TypeScriptScopeHandler;
|
||||
43
node_modules/@babel/parser/lib/plugins/v8intrinsic.js
generated
vendored
Normal file
43
node_modules/@babel/parser/lib/plugins/v8intrinsic.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _types = require("../tokenizer/types");
|
||||
|
||||
var N = _interopRequireWildcard(require("../types"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
var _default = superClass => class extends superClass {
|
||||
parseV8Intrinsic() {
|
||||
if (this.match(_types.types.modulo)) {
|
||||
const v8IntrinsicStart = this.state.start;
|
||||
const node = this.startNode();
|
||||
this.eat(_types.types.modulo);
|
||||
|
||||
if (this.match(_types.types.name)) {
|
||||
const name = this.parseIdentifierName(this.state.start);
|
||||
const identifier = this.createIdentifier(node, name);
|
||||
identifier.type = "V8IntrinsicIdentifier";
|
||||
|
||||
if (this.match(_types.types.parenL)) {
|
||||
return identifier;
|
||||
}
|
||||
}
|
||||
|
||||
this.unexpected(v8IntrinsicStart);
|
||||
}
|
||||
}
|
||||
|
||||
parseExprAtom() {
|
||||
return this.parseV8Intrinsic() || super.parseExprAtom(...arguments);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
Reference in New Issue
Block a user