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

Method init

bin/yarn-standalone.js:103060–103194  ·  view source on GitHub ↗
(seedPatterns)

Source from the content-addressed store, hash-verified

103058 }
103059
103060 init(seedPatterns) {
103061 var _this6 = this;
103062
103063 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
103064 const workQueue = new Set();
103065 const installed = new Set();
103066 const pkgs = _this6.resolver.getTopologicalManifests(seedPatterns);
103067 let installablePkgs = 0;
103068 // A map to keep track of what files exist before installation
103069 const beforeFilesMap = new Map();
103070 for (var _iterator9 = pkgs, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) {
103071 var _ref14;
103072
103073 if (_isArray9) {
103074 if (_i9 >= _iterator9.length) break;
103075 _ref14 = _iterator9[_i9++];
103076 } else {
103077 _i9 = _iterator9.next();
103078 if (_i9.done) break;
103079 _ref14 = _i9.value;
103080 }
103081
103082 const pkg = _ref14;
103083
103084 if (_this6.packageCanBeInstalled(pkg)) {
103085 const ref = pkg._reference;
103086 invariant(ref, 'expected reference');
103087 yield Promise.all(ref.locations.map((() => {
103088 var _ref19 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) {
103089 beforeFilesMap.set(loc, (yield _this6.walk(loc)));
103090 installablePkgs += 1;
103091 });
103092
103093 return function (_x6) {
103094 return _ref19.apply(this, arguments);
103095 };
103096 })()));
103097 }
103098 workQueue.add(pkg);
103099 }
103100
103101 const set = _this6.reporter.activitySet(installablePkgs, Math.min(installablePkgs, _this6.config.childConcurrency));
103102
103103 // waitQueue acts like a semaphore to allow workers to register to be notified
103104 // when there are more work added to the work queue
103105 const waitQueue = new Set();
103106 yield Promise.all(set.spinners.map(function (spinner) {
103107 return _this6.worker(spinner, workQueue, installed, waitQueue);
103108 }));
103109 // generate built package as prebuilt one for offline mirror
103110 const offlineMirrorPath = _this6.config.getOfflineMirrorPath();
103111 if (_this6.config.packBuiltPackages && offlineMirrorPath) {
103112 for (var _iterator10 = pkgs, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) {
103113 var _ref15;
103114
103115 if (_isArray10) {
103116 if (_i10 >= _iterator10.length) break;
103117 _ref15 = _iterator10[_i10++];

Callers

nothing calls this directly

Calls 15

getHashMethod · 0.95
_load_asyncToGeneratorFunction · 0.85
invariantFunction · 0.85
_load_fsFunction · 0.85
_load_packageNameUtilsFunction · 0.85
_load_packFunction · 0.85
_load_cryptoFunction · 0.85
resolveFunction · 0.85
packageCanBeInstalledMethod · 0.80
setMethod · 0.80
walkMethod · 0.80

Tested by

no test coverage detected