Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

warnings.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.warn = warn;
  6. exports.warnFileDeprecation = warnFileDeprecation;
  7. exports.warnOptionDeprecation = warnOptionDeprecation;
  8. /* global global, console */
  9. function warn(warning, type) {
  10. if (global && global._YAML_SILENCE_WARNINGS) return;
  11. const {
  12. emitWarning
  13. } = global && global.process; // This will throw in Jest if `warning` is an Error instance due to
  14. // https://github.com/facebook/jest/issues/2549
  15. if (emitWarning) emitWarning(warning, type);else {
  16. // eslint-disable-next-line no-console
  17. console.warn(type ? `${type}: ${warning}` : warning);
  18. }
  19. }
  20. function warnFileDeprecation(filename) {
  21. if (global && global._YAML_SILENCE_DEPRECATION_WARNINGS) return;
  22. const path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/');
  23. warn(`The endpoint 'yaml/${path}' will be removed in a future release.`, 'DeprecationWarning');
  24. }
  25. const warned = {};
  26. function warnOptionDeprecation(name, alternative) {
  27. if (global && global._YAML_SILENCE_DEPRECATION_WARNINGS) return;
  28. if (warned[name]) return;
  29. warned[name] = true;
  30. let msg = `The option '${name}' will be removed in a future release`;
  31. msg += alternative ? `, use '${alternative}' instead.` : '.';
  32. warn(msg, 'DeprecationWarning');
  33. }