How to use the @yarnpkg/parsers.parseResolution function in @yarnpkg/parsers

To help you get started, we’ve selected a few @yarnpkg/parsers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yarnpkg / berry / packages / yarnpkg-core / sources / Manifest.ts View on Github external
const descriptor = structUtils.parseDescriptor(pattern);
        const peerDependencyMeta = this.ensurePeerDependencyMeta(descriptor);

        Object.assign(peerDependencyMeta, meta);
      }
    }

    if (typeof data.resolutions === `object` && data.resolutions !== null) {
      for (const [pattern, reference] of Object.entries(data.resolutions)) {
        if (typeof reference !== `string`) {
          errors.push(new Error(`Invalid resolution entry for '${pattern}'`));
          continue;
        }

        try {
          this.resolutions.push({pattern: parseResolution(pattern), reference});
        } catch (error) {
          errors.push(error);
          continue;
        }
      }
    }

    if (Array.isArray(data.files) && data.files.length !== 0) {
      this.files = new Set();

      for (const filename of data.files) {
        if (typeof filename !== `string`) {
          errors.push(new Error(`Invalid files entry for '${filename}'`));
          continue;
        }

@yarnpkg/parsers

BSD-2-Clause
Latest version published 8 months ago

Package Health Score

93 / 100
Full package analysis

Similar packages