Updating NPM dependencies
This commit is contained in:
28
node_modules/@babel/parser/lib/plugins/jsx/index.js
generated
vendored
28
node_modules/@babel/parser/lib/plugins/jsx/index.js
generated
vendored
@@ -17,6 +17,8 @@ var _identifier = require("../../util/identifier");
|
||||
|
||||
var _whitespace = require("../../util/whitespace");
|
||||
|
||||
var _error = require("../../parser/error");
|
||||
|
||||
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; }
|
||||
@@ -25,6 +27,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
|
||||
const HEX_NUMBER = /^[\da-fA-F]+$/;
|
||||
const DECIMAL_NUMBER = /^\d+$/;
|
||||
const JsxErrors = Object.freeze({
|
||||
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression",
|
||||
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>",
|
||||
MissingClosingTagElement: "Expected corresponding JSX closing tag for <%0>",
|
||||
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 <>...</>?"
|
||||
});
|
||||
_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);
|
||||
@@ -81,7 +91,7 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
for (;;) {
|
||||
if (this.state.pos >= this.length) {
|
||||
throw this.raise(this.state.start, "Unterminated JSX contents");
|
||||
throw this.raise(this.state.start, JsxErrors.UnterminatedJsxContent);
|
||||
}
|
||||
|
||||
const ch = this.input.charCodeAt(this.state.pos);
|
||||
@@ -143,7 +153,7 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
for (;;) {
|
||||
if (this.state.pos >= this.length) {
|
||||
throw this.raise(this.state.start, "Unterminated string constant");
|
||||
throw this.raise(this.state.start, _error.Errors.UnterminatedString);
|
||||
}
|
||||
|
||||
const ch = this.input.charCodeAt(this.state.pos);
|
||||
@@ -275,7 +285,7 @@ var _default = superClass => class extends superClass {
|
||||
node = this.jsxParseExpressionContainer(node);
|
||||
|
||||
if (node.expression.type === "JSXEmptyExpression") {
|
||||
this.raise(node.start, "JSX attributes must only be assigned a non-empty expression");
|
||||
this.raise(node.start, JsxErrors.AttributeIsEmpty);
|
||||
}
|
||||
|
||||
return node;
|
||||
@@ -285,7 +295,7 @@ var _default = superClass => class extends superClass {
|
||||
return this.parseExprAtom();
|
||||
|
||||
default:
|
||||
throw this.raise(this.state.start, "JSX value should be either an expression or a quoted JSX text");
|
||||
throw this.raise(this.state.start, JsxErrors.UnsupportedJsxValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +327,7 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
if (this.eat(_types.types.braceL)) {
|
||||
this.expect(_types.types.ellipsis);
|
||||
node.argument = this.parseMaybeAssign();
|
||||
node.argument = this.parseMaybeAssignAllowIn();
|
||||
this.expect(_types.types.braceR);
|
||||
return this.finishNode(node, "JSXSpreadAttribute");
|
||||
}
|
||||
@@ -411,12 +421,12 @@ var _default = superClass => class extends superClass {
|
||||
}
|
||||
|
||||
if (isFragment(openingElement) && !isFragment(closingElement)) {
|
||||
this.raise(closingElement.start, "Expected corresponding JSX closing tag for <>");
|
||||
this.raise(closingElement.start, JsxErrors.MissingClosingTagFragment);
|
||||
} else if (!isFragment(openingElement) && isFragment(closingElement)) {
|
||||
this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">");
|
||||
this.raise(closingElement.start, JsxErrors.MissingClosingTagElement, 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) + ">");
|
||||
this.raise(closingElement.start, JsxErrors.MissingClosingTagElement, getQualifiedJSXName(openingElement.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,7 +442,7 @@ var _default = superClass => class extends superClass {
|
||||
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 <>...</>?");
|
||||
throw this.raise(this.state.start, JsxErrors.UnwrappedAdjacentJSXElements);
|
||||
}
|
||||
|
||||
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
|
||||
|
||||
Reference in New Issue
Block a user