How to use the @parcel/logger.warn function in @parcel/logger

To help you get started, we’ve selected a few @parcel/logger 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 / parcel-bundler / src / transforms / babel / babelrc.js View on Github external
throw new Error(
            'Conflicting babel versions found in .babelrc. Make sure all of your plugins and presets depend on the same major version of babel.',
          );
        }

        version = range;
        break;
      }
    }
  }

  // Find the maximum major version allowed in the range and use that.
  // e.g. if ^6 || ^7 were specified, use 7.
  version = getMaxMajor(version);
  if (!version) {
    logger.warn(
      `Could not infer babel version. Defaulting to babel 7. Please add either babel-core or @babel/core as a dependency.`,
    );
    version = 7;
  }

  return version;
}
github parcel-bundler / parcel / packages / core / parcel-bundler / src / visitors / fs.js View on Github external
};
      let filename, args, res;

      try {
        [filename, ...args] = path
          .get('arguments')
          .map(arg => evaluate(arg, vars));

        filename = Path.resolve(filename);
        res = fs.readFileSync(filename, ...args);
      } catch (err) {
        if (err instanceof NodeNotEvaluatedError) {
          // Warn using a code frame
          err.fileName = asset.name;
          asset.generateErrorMessage(err);
          logger.warn(err);
          return;
        }

        // Add location info so we log a code frame with the error
        err.loc =
          path.node.arguments.length > 0
            ? path.node.arguments[0].loc.start
            : path.node.loc.start;
        throw err;
      }

      let replacementNode;
      if (Buffer.isBuffer(res)) {
        replacementNode = bufferTemplate({
          CONTENT: t.stringLiteral(res.toString('base64')),
          ENC: t.stringLiteral('base64'),
github parcel-bundler / parcel / packages / core / package-manager / src / Yarn.js View on Github external
.on('data', (message: YarnStdErrMessage) => {
        switch (message.type) {
          case 'warning':
            logger.warn({
              origin: '@parcel/package-manager',
              message: prefix(message.data),
            });
            return;
          case 'error':
            logger.error({
              origin: '@parcel/package-manager',
              message: prefix(message.data),
            });
            return;
          default:
          // ignore
        }
      });
github parcel-bundler / parcel / packages / transformers / babel / src / babelrc.js View on Github external
throw new Error(
            'Conflicting babel versions found in .babelrc. Make sure all of your plugins and presets depend on the same major version of babel.'
          );
        }

        version = range;
        break;
      }
    }
  }

  // Find the maximum major version allowed in the range and use that.
  // e.g. if ^6 || ^7 were specified, use 7.
  version = getMaxMajor(version);
  if (!version) {
    logger.warn(
      `Could not infer babel version. Defaulting to babel 7. Please add either babel-core or @babel/core as a dependency.`
    );
    version = 7;
  }

  return version;
}
github remoteinterview / zero / packages / parcel-bundler / index.js View on Github external
);
  if (!pkg) {
    return;
  }

  try {
    let deps = Object.assign({}, pkg.dependencies, pkg.devDependencies);
    for (let dep in deps) {
      const pattern = /^(@.*\/)?parcel-plugin-.+/;
      if (pattern.test(dep)) {
        let plugin = await localRequire(dep, relative);
        await plugin(this);
      }
    }
  } catch (err) {
    logger.warn(err);
  }
};
github parcel-bundler / parcel / packages / core / workers / src / index.js View on Github external
bus.on('logEvent', (e: LogEvent) => {
    switch (e.level) {
      case 'info':
        invariant(typeof e.message === 'string');
        Logger.info(e.message);
        break;
      case 'progress':
        invariant(typeof e.message === 'string');
        Logger.progress(e.message);
        break;
      case 'verbose':
        invariant(typeof e.message === 'string');
        Logger.verbose(e.message);
        break;
      case 'warn':
        Logger.warn(e.message);
        break;
      case 'error':
        Logger.error(e.message);
        break;
      default:
        throw new Error('Unknown log level');
    }
  });
}
github parcel-bundler / parcel / packages / core / parcel-bundler / src / assets / JSONLDAsset.js View on Github external
collectDependencies() {
    if (!this.options.publicURL.startsWith('http')) {
      logger.warn(
        "Please specify a publicURL using --public-url, otherwise schema assets won't be collected",
      );
      return;
    }

    for (let schemaKey in this.ast) {
      if (SCHEMA_ATTRS.includes(schemaKey)) {
        this.collectFromKey(this.ast, schemaKey);
        this.isAstDirty = true;
      }
    }
  }
github 101arrowz / pwa-manifest / packages / parcel-plugin-pwa-manifest / index.ts View on Github external
    bundler.on('buildEnd', () => logger.warn('Manifest creation disabled'));
    return;