(dir, reporter)
| 2793 | } |
| 2794 | |
| 2795 | static fromDirectory(dir, reporter) { |
| 2796 | return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { |
| 2797 | // read the manifest in this directory |
| 2798 | const lockfileLoc = path.join(dir, (_constants || _load_constants()).LOCKFILE_FILENAME); |
| 2799 | |
| 2800 | let lockfile; |
| 2801 | let rawLockfile = ''; |
| 2802 | let parseResult; |
| 2803 | |
| 2804 | if (yield (_fs || _load_fs()).exists(lockfileLoc)) { |
| 2805 | rawLockfile = yield (_fs || _load_fs()).readFile(lockfileLoc); |
| 2806 | parseResult = (0, (_parse2 || _load_parse2()).default)(rawLockfile, lockfileLoc); |
| 2807 | |
| 2808 | if (reporter) { |
| 2809 | if (parseResult.type === 'merge') { |
| 2810 | reporter.info(reporter.lang('lockfileMerged')); |
| 2811 | } else if (parseResult.type === 'conflict') { |
| 2812 | reporter.warn(reporter.lang('lockfileConflict')); |
| 2813 | } |
| 2814 | } |
| 2815 | |
| 2816 | lockfile = parseResult.object; |
| 2817 | } else if (reporter) { |
| 2818 | reporter.info(reporter.lang('noLockfileFound')); |
| 2819 | } |
| 2820 | |
| 2821 | return new Lockfile({ cache: lockfile, source: rawLockfile, parseResultType: parseResult && parseResult.type }); |
| 2822 | })(); |
| 2823 | } |
| 2824 | |
| 2825 | getLocked(pattern) { |
| 2826 | const cache = this.cache; |
no test coverage detected