How to use the @parcel/utils.validateSchema.diagnostic function in @parcel/utils

To help you get started, we’ve selected a few @parcel/utils 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 parcel-bundler / parcel / packages / core / core / src / TargetResolver.js View on Github external
function parseDescriptor(
  targetName: string,
  descriptor: mixed,
  pkgPath: ?FilePath,
  pkgContents: string | mixed,
): TargetDescriptor | PackageTargetDescriptor {
  validateSchema.diagnostic(
    DESCRIPTOR_SCHEMA,
    descriptor,
    pkgPath,
    pkgContents,
    '@parcel/core',
    `/targets/${targetName}`,
    `Invalid target descriptor for target "${targetName}"`,
  );

  // $FlowFixMe we just verified this
  return descriptor;
}
github parcel-bundler / parcel / packages / core / core / src / TargetResolver.js View on Github external
function parseEngines(
  engines: mixed,
  pkgPath: ?FilePath,
  pkgContents: string | mixed,
  prependKey: string,
  message: string,
): Engines | typeof undefined {
  if (engines === undefined) {
    return engines;
  } else {
    validateSchema.diagnostic(
      ENGINES_SCHEMA,
      engines,
      pkgPath,
      pkgContents,
      '@parcel/core',
      prependKey,
      message,
    );

    // $FlowFixMe we just verified this
    return engines;
  }
}