deprecated.js 958 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.deprecationWarning = undefined;
  6. var _utils;
  7. function _load_utils() {
  8. return (_utils = require('./utils'));
  9. }
  10. /**
  11. * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  12. *
  13. * This source code is licensed under the MIT license found in the
  14. * LICENSE file in the root directory of this source tree.
  15. *
  16. *
  17. */
  18. const deprecationMessage = (message, options) => {
  19. const comment = options.comment;
  20. const name =
  21. (options.title && options.title.deprecation) ||
  22. (_utils || _load_utils()).DEPRECATION;
  23. (0, (_utils || _load_utils()).logValidationWarning)(name, message, comment);
  24. };
  25. const deprecationWarning = (exports.deprecationWarning = (
  26. config,
  27. option,
  28. deprecatedOptions,
  29. options
  30. ) => {
  31. if (option in deprecatedOptions) {
  32. deprecationMessage(deprecatedOptions[option](config), options);
  33. return true;
  34. }
  35. return false;
  36. });