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

Method resolve

bin/yarn-standalone.js:50681–50737  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50679 }
50680
50681 resolve() {
50682 var _this = this;
50683
50684 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
50685 let loc = _this.loc;
50686 if (!(_path || _load_path()).default.isAbsolute(loc)) {
50687 loc = (_path || _load_path()).default.resolve(_this.config.lockfileFolder, loc);
50688 }
50689
50690 if (_this.config.linkFileDependencies) {
50691 const registry = 'npm';
50692 const manifest = { _uid: '', name: '', version: '0.0.0', _registry: registry };
50693 manifest._remote = {
50694 type: 'link',
50695 registry,
50696 hash: null,
50697 reference: loc
50698 };
50699 manifest._uid = manifest.version;
50700 return manifest;
50701 }
50702 if (!(yield (_fs || _load_fs()).exists(loc))) {
50703 throw new (_errors || _load_errors()).MessageError(_this.reporter.lang('doesntExist', loc, _this.pattern.split('@')[0]));
50704 }
50705
50706 const manifest = yield (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
50707 try {
50708 return yield _this.config.readManifest(loc, _this.registry);
50709 } catch (e) {
50710 if (e.code === 'ENOENT') {
50711 return {
50712 // This is just the default, it can be overridden with key of dependencies
50713 name: (_path || _load_path()).default.dirname(loc),
50714 version: '0.0.0',
50715 _uid: '0.0.0',
50716 _registry: 'npm'
50717 };
50718 }
50719
50720 throw e;
50721 }
50722 })();
50723 const registry = manifest._registry;
50724 (0, (_invariant || _load_invariant()).default)(registry, 'expected registry');
50725
50726 manifest._remote = {
50727 type: 'copy',
50728 registry,
50729 hash: `${(_uuid || _load_uuid()).default.v4()}-${new Date().getTime()}`,
50730 reference: loc
50731 };
50732
50733 manifest._uid = manifest.version;
50734
50735 return manifest;
50736 })();
50737 }
50738}

Callers

nothing calls this directly

Calls 9

_load_asyncToGeneratorFunction · 0.85
_load_pathFunction · 0.85
_load_fsFunction · 0.85
_load_errorsFunction · 0.85
_load_invariantFunction · 0.85
_load_uuidFunction · 0.85
readManifestMethod · 0.80
resolveMethod · 0.45
langMethod · 0.45

Tested by

no test coverage detected