| @@ -1,122 +1 @@ | ||
| 1 | -/******/ (function() { // webpackBootstrap | |
| 2 | -/******/ "use strict"; | |
| 3 | -/******/ // The require scope | |
| 4 | -/******/ var __webpack_require__ = {}; | |
| 5 | -/******/ | |
| 6 | -/************************************************************************/ | |
| 7 | -/******/ /* webpack/runtime/define property getters */ | |
| 8 | -/******/ !function() { | |
| 9 | -/******/ // define getter functions for harmony exports | |
| 10 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 11 | -/******/ for(var key in definition) { | |
| 12 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 13 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 14 | -/******/ } | |
| 15 | -/******/ } | |
| 16 | -/******/ }; | |
| 17 | -/******/ }(); | |
| 18 | -/******/ | |
| 19 | -/******/ /* webpack/runtime/hasOwnProperty shorthand */ | |
| 20 | -/******/ !function() { | |
| 21 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 22 | -/******/ }(); | |
| 23 | -/******/ | |
| 24 | -/************************************************************************/ | |
| 25 | -var __webpack_exports__ = {}; | |
| 26 | - | |
| 27 | -// EXPORTS | |
| 28 | -__webpack_require__.d(__webpack_exports__, { | |
| 29 | - "default": function() { return /* binding */ deprecated; } | |
| 30 | -}); | |
| 31 | - | |
| 32 | -// UNUSED EXPORTS: logged | |
| 33 | - | |
| 34 | -;// CONCATENATED MODULE: external ["wp","hooks"] | |
| 35 | -var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; | |
| 36 | -;// CONCATENATED MODULE: ./packages/deprecated/build-module/index.js | |
| 37 | -/** | |
| 38 | - * WordPress dependencies | |
| 39 | - */ | |
| 40 | - | |
| 41 | -/** | |
| 42 | - * Object map tracking messages which have been logged, for use in ensuring a | |
| 43 | - * message is only logged once. | |
| 44 | - * | |
| 45 | - * @type {Record<string, true | undefined>} | |
| 46 | - */ | |
| 47 | - | |
| 48 | -const logged = Object.create(null); | |
| 49 | -/** | |
| 50 | - * Logs a message to notify developers about a deprecated feature. | |
| 51 | - * | |
| 52 | - * @param {string} feature Name of the deprecated feature. | |
| 53 | - * @param {Object} [options] Personalisation options | |
| 54 | - * @param {string} [options.since] Version in which the feature was deprecated. | |
| 55 | - * @param {string} [options.version] Version in which the feature will be removed. | |
| 56 | - * @param {string} [options.alternative] Feature to use instead | |
| 57 | - * @param {string} [options.plugin] Plugin name if it's a plugin feature | |
| 58 | - * @param {string} [options.link] Link to documentation | |
| 59 | - * @param {string} [options.hint] Additional message to help transition away from the deprecated feature. | |
| 60 | - * | |
| 61 | - * @example | |
| 62 | - * ```js | |
| 63 | - * import deprecated from '@wordpress/deprecated'; | |
| 64 | - * | |
| 65 | - * deprecated( 'Eating meat', { | |
| 66 | - * since: '2019.01.01' | |
| 67 | - * version: '2020.01.01', | |
| 68 | - * alternative: 'vegetables', | |
| 69 | - * plugin: 'the earth', | |
| 70 | - * hint: 'You may find it beneficial to transition gradually.', | |
| 71 | - * } ); | |
| 72 | - * | |
| 73 | - * // 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.' | |
| 74 | - * ``` | |
| 75 | - */ | |
| 76 | - | |
| 77 | -function deprecated(feature) { | |
| 78 | - let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
| 79 | - const { | |
| 80 | - since, | |
| 81 | - version, | |
| 82 | - alternative, | |
| 83 | - plugin, | |
| 84 | - link, | |
| 85 | - hint | |
| 86 | - } = options; | |
| 87 | - const pluginMessage = plugin ? ` from ${plugin}` : ''; | |
| 88 | - const sinceMessage = since ? ` since version ${since}` : ''; | |
| 89 | - const versionMessage = version ? ` and will be removed${pluginMessage} in version ${version}` : ''; | |
| 90 | - const useInsteadMessage = alternative ? ` Please use ${alternative} instead.` : ''; | |
| 91 | - const linkMessage = link ? ` See: ${link}` : ''; | |
| 92 | - const hintMessage = hint ? ` Note: ${hint}` : ''; | |
| 93 | - const message = `${feature} is deprecated${sinceMessage}${versionMessage}.${useInsteadMessage}${linkMessage}${hintMessage}`; // Skip if already logged. | |
| 94 | - | |
| 95 | - if (message in logged) { | |
| 96 | - return; | |
| 97 | - } | |
| 98 | - /** | |
| 99 | - * Fires whenever a deprecated feature is encountered | |
| 100 | - * | |
| 101 | - * @param {string} feature Name of the deprecated feature. | |
| 102 | - * @param {?Object} options Personalisation options | |
| 103 | - * @param {string} options.since Version in which the feature was deprecated. | |
| 104 | - * @param {?string} options.version Version in which the feature will be removed. | |
| 105 | - * @param {?string} options.alternative Feature to use instead | |
| 106 | - * @param {?string} options.plugin Plugin name if it's a plugin feature | |
| 107 | - * @param {?string} options.link Link to documentation | |
| 108 | - * @param {?string} options.hint Additional message to help transition away from the deprecated feature. | |
| 109 | - * @param {?string} message Message sent to console.warn | |
| 110 | - */ | |
| 111 | - | |
| 112 | - | |
| 113 | - (0,external_wp_hooks_namespaceObject.doAction)('deprecated', feature, options, message); // eslint-disable-next-line no-console | |
| 114 | - | |
| 115 | - console.warn(message); | |
| 116 | - logged[message] = true; | |
| 117 | -} | |
| 118 | -/** @typedef {import('utility-types').NonUndefined<Parameters<typeof deprecated>[1]>} DeprecatedOptions */ | |
| 119 | -//# sourceMappingURL=index.js.map | |
| 120 | -(window.wp = window.wp || {}).deprecated = __webpack_exports__["default"]; | |
| 121 | -/******/ })() | |
| 122 | -; | |
| 1 | +this.wp=this.wp||{},this.wp.deprecated=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=358)}({32:function(e,t){!function(){e.exports=this.wp.hooks}()},358:function(e,t,n){"use strict";n.r(t),n.d(t,"logged",(function(){return o})),n.d(t,"default",(function(){return c}));var r=n(32),o=Object.create(null);function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.version,c=t.alternative,i=t.plugin,u=t.link,a=t.hint,l=i?" from ".concat(i):"",f=n?" and will be removed".concat(l," in version ").concat(n):"",d=c?" Please use ".concat(c," instead."):"",s=u?" See: ".concat(u):"",p=a?" Note: ".concat(a):"",b="".concat(e," is deprecated").concat(f,".").concat(d).concat(s).concat(p);b in o||(Object(r.doAction)("deprecated",e,t,b),console.warn(b),o[b]=!0)}}}).default; | |