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.4KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. var _ref = global && global.process,
  12. emitWarning = _ref.emitWarning; // This will throw in Jest if `warning` is an Error instance due to
  13. // https://github.com/facebook/jest/issues/2549
  14. if (emitWarning) emitWarning(warning, type);else {
  15. // eslint-disable-next-line no-console
  16. console.warn(type ? "".concat(type, ": ").concat(warning) : warning);
  17. }
  18. }
  19. function warnFileDeprecation(filename) {
  20. if (global && global._YAML_SILENCE_DEPRECATION_WARNINGS) return;
  21. var path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/');
  22. warn("The endpoint 'yaml/".concat(path, "' will be removed in a future release."), 'DeprecationWarning');
  23. }
  24. var warned = {};
  25. function warnOptionDeprecation(name, alternative) {
  26. if (global && global._YAML_SILENCE_DEPRECATION_WARNINGS) return;
  27. if (warned[name]) return;
  28. warned[name] = true;
  29. var msg = "The option '".concat(name, "' will be removed in a future release");
  30. msg += alternative ? ", use '".concat(alternative, "' instead.") : '.';
  31. warn(msg, 'DeprecationWarning');
  32. }