Skip to content

Commit

Permalink
Merge pull request #2123 from MeilCli/update/action
Browse files Browse the repository at this point in the history
update actions
  • Loading branch information
MeilCli authored Dec 16, 2024
2 parents 05af1b2 + f6fa718 commit bd5ba3a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions dist/vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11024,7 +11024,12 @@ var tokenKind = __webpack_require__(590);
*/
function parse(source, options) {
const parser = new Parser(source, options);
return parser.parseDocument();
const document = parser.parseDocument();
Object.defineProperty(document, 'tokenCount', {
enumerable: false,
value: parser.tokenCount,
});
return document;
}
/**
* Given a string containing a GraphQL value (ex. `[42]`), parse the AST for
Expand Down Expand Up @@ -11093,6 +11098,10 @@ class Parser {
this._options = options;
this._tokenCounter = 0;
}

get tokenCount() {
return this._tokenCounter;
}
/**
* Converts a name lex token into a name parse node.
*/
Expand Down Expand Up @@ -12503,10 +12512,10 @@ class Parser {

const token = this._lexer.advance();

if (maxTokens !== undefined && token.kind !== tokenKind/* TokenKind */.Y.EOF) {
if (token.kind !== tokenKind/* TokenKind */.Y.EOF) {
++this._tokenCounter;

if (this._tokenCounter > maxTokens) {
if (maxTokens !== undefined && this._tokenCounter > maxTokens) {
throw (0,syntaxError/* syntaxError */.I)(
this._lexer.source,
token.start,
Expand Down

0 comments on commit bd5ba3a

Please sign in to comment.