diff -r 34716fd837a4 -r be944660c56a wp/wp-includes/js/dist/deprecated.js --- a/wp/wp-includes/js/dist/deprecated.js Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-includes/js/dist/deprecated.js Wed Sep 21 18:19:35 2022 +0200 @@ -82,26 +82,19 @@ /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 418); +/******/ return __webpack_require__(__webpack_require__.s = "+BeG"); /******/ }) /************************************************************************/ /******/ ({ -/***/ 32: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["hooks"]; }()); - -/***/ }), - -/***/ 418: +/***/ "+BeG": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logged", function() { return logged; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return deprecated; }); -/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32); +/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("g56x"); /* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__); /** * WordPress dependencies @@ -111,49 +104,54 @@ * Object map tracking messages which have been logged, for use in ensuring a * message is only logged once. * - * @type {Object} + * @type {Record} */ -var logged = Object.create(null); +const logged = Object.create(null); /** * Logs a message to notify developers about a deprecated feature. * - * @param {string} feature Name of the deprecated feature. - * @param {?Object} options Personalisation options - * @param {?string} options.version Version in which the feature will be removed. - * @param {?string} options.alternative Feature to use instead - * @param {?string} options.plugin Plugin name if it's a plugin feature - * @param {?string} options.link Link to documentation - * @param {?string} options.hint Additional message to help transition away from the deprecated feature. + * @param {string} feature Name of the deprecated feature. + * @param {Object} [options] Personalisation options + * @param {string} [options.since] Version in which the feature was deprecated. + * @param {string} [options.version] Version in which the feature will be removed. + * @param {string} [options.alternative] Feature to use instead + * @param {string} [options.plugin] Plugin name if it's a plugin feature + * @param {string} [options.link] Link to documentation + * @param {string} [options.hint] Additional message to help transition away from the deprecated feature. * * @example * ```js * import deprecated from '@wordpress/deprecated'; * * deprecated( 'Eating meat', { - * version: 'the future', + * since: '2019.01.01' + * version: '2020.01.01', * alternative: 'vegetables', * plugin: 'the earth', * hint: 'You may find it beneficial to transition gradually.', * } ); * - * // Logs: 'Eating meat is deprecated and will be removed from the earth in the future. Please use vegetables instead. Note: You may find it beneficial to transition gradually.' + * // Logs: 'Eating meat is deprecated since version 2019.01.01 and will be removed from the earth in version 2020.01.01. Please use vegetables instead. Note: You may find it beneficial to transition gradually.' * ``` */ -function deprecated(feature) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var version = options.version, - alternative = options.alternative, - plugin = options.plugin, - link = options.link, - hint = options.hint; - var pluginMessage = plugin ? " from ".concat(plugin) : ''; - var versionMessage = version ? " and will be removed".concat(pluginMessage, " in version ").concat(version) : ''; - var useInsteadMessage = alternative ? " Please use ".concat(alternative, " instead.") : ''; - var linkMessage = link ? " See: ".concat(link) : ''; - var hintMessage = hint ? " Note: ".concat(hint) : ''; - var message = "".concat(feature, " is deprecated").concat(versionMessage, ".").concat(useInsteadMessage).concat(linkMessage).concat(hintMessage); // Skip if already logged. +function deprecated(feature, options = {}) { + const { + since, + version, + alternative, + plugin, + link, + hint + } = options; + const pluginMessage = plugin ? ` from ${plugin}` : ''; + const sinceMessage = since ? ` since version ${since}` : ''; + const versionMessage = version ? ` and will be removed${pluginMessage} in version ${version}` : ''; + const useInsteadMessage = alternative ? ` Please use ${alternative} instead.` : ''; + const linkMessage = link ? ` See: ${link}` : ''; + const hintMessage = hint ? ` Note: ${hint}` : ''; + const message = `${feature} is deprecated${sinceMessage}${versionMessage}.${useInsteadMessage}${linkMessage}${hintMessage}`; // Skip if already logged. if (message in logged) { return; @@ -163,6 +161,7 @@ * * @param {string} feature Name of the deprecated feature. * @param {?Object} options Personalisation options + * @param {string} options.since Version in which the feature was deprecated. * @param {?string} options.version Version in which the feature will be removed. * @param {?string} options.alternative Feature to use instead * @param {?string} options.plugin Plugin name if it's a plugin feature @@ -177,8 +176,16 @@ console.warn(message); logged[message] = true; } +/** @typedef {import('utility-types').NonUndefined[1]>} DeprecatedOptions */ +/***/ }), + +/***/ "g56x": +/***/ (function(module, exports) { + +(function() { module.exports = window["wp"]["hooks"]; }()); + /***/ }) /******/ })["default"]; \ No newline at end of file