MCPcopy
hub / github.com/vercel/hyper / onComment

Method onComment

bin/yarn-standalone.js:34575–34590  ·  view source on GitHub ↗
(token)

Source from the content-addressed store, hash-verified

34573 }
34574
34575 onComment(token) {
34576 const value = token.value;
34577 (0, (_invariant || _load_invariant()).default)(typeof value === 'string', 'expected token value to be a string');
34578
34579 const comment = value.trim();
34580
34581 const versionMatch = comment.match(VERSION_REGEX);
34582 if (versionMatch) {
34583 const version = +versionMatch[1];
34584 if (version > (_constants || _load_constants()).LOCKFILE_VERSION) {
34585 throw new (_errors || _load_errors()).MessageError(`Can't install from a lockfile of version ${version} as you're on an old yarn version that only supports ` + `versions up to ${(_constants || _load_constants()).LOCKFILE_VERSION}. Run \`$ yarn self-update\` to upgrade to the latest version.`);
34586 }
34587 }
34588
34589 this.comments.push(comment);
34590 }
34591
34592 next() {
34593 const item = this.tokens.next();

Callers 1

nextMethod · 0.95

Calls 5

_load_invariantFunction · 0.85
_load_constantsFunction · 0.85
_load_errorsFunction · 0.85
matchMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected