MCPcopy Index your code
hub / github.com/vercel/hyper / replacePattern

Method replacePattern

bin/yarn-standalone.js:76905–76913  ·  view source on GitHub ↗

* replace pattern in resolver, e.g. `name` is replaced with `name@^1.0.1`

(pattern, newPattern)

Source from the content-addressed store, hash-verified

76903 * replace pattern in resolver, e.g. `name` is replaced with `name@^1.0.1`
76904 */
76905 replacePattern(pattern, newPattern) {
76906 const pkg = this.getResolvedPattern(pattern);
76907 invariant(pkg, `missing package ${pattern}`);
76908 const ref = pkg._reference;
76909 invariant(ref, 'expected package reference');
76910 ref.patterns = [newPattern];
76911 this.addPattern(newPattern, pkg);
76912 this.removePattern(pattern);
76913 }
76914
76915 /**
76916 * Make all versions of this package resolve to it.

Callers 1

preparePatternsMethod · 0.80

Calls 4

getResolvedPatternMethod · 0.95
addPatternMethod · 0.95
removePatternMethod · 0.95
invariantFunction · 0.85

Tested by

no test coverage detected