@wordpress/deprecated
Advanced tools
| // packages/deprecated/src/index.ts | ||
| import { doAction } from "@wordpress/hooks"; | ||
| var logged = /* @__PURE__ */ Object.create(null); | ||
| 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}`; | ||
| if (message in logged) { | ||
| return; | ||
| } | ||
| doAction("deprecated", feature, options, message); | ||
| console.warn(message); | ||
| logged[message] = true; | ||
| } | ||
| export { | ||
| deprecated as default, | ||
| logged | ||
| }; | ||
| //# sourceMappingURL=index.mjs.map |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { doAction } from '@wordpress/hooks';\n\n/**\n * Object map tracking messages which have been logged, for use in ensuring a\n * message is only logged once.\n */\nexport const logged: Record< string, true > = Object.create( null );\n\ntype DeprecatedOptions = {\n\t/**\n\t * Version in which the feature was deprecated.\n\t */\n\tsince?: string;\n\t/**\n\t * Version in which the feature will be removed.\n\t */\n\tversion?: string;\n\t/**\n\t * Feature to use instead.\n\t */\n\talternative?: string;\n\t/**\n\t * Plugin name if it's a plugin feature.\n\t */\n\tplugin?: string;\n\t/**\n\t * Link to documentation.\n\t */\n\tlink?: string;\n\t/**\n\t * Additional message to help transition away from the deprecated feature.\n\t */\n\thint?: string;\n};\n\n/**\n * Logs a message to notify developers about a deprecated feature.\n *\n * @param {string} feature Name of the deprecated feature.\n * @param {DeprecatedOptions} [options] Personalisation options\n *\n * @example\n * ```js\n * import deprecated from '@wordpress/deprecated';\n *\n * deprecated( 'Eating meat', {\n * \tsince: '2019.01.01',\n * \tversion: '2020.01.01',\n * \talternative: 'vegetables',\n * \tplugin: 'the earth',\n * \thint: 'You may find it beneficial to transition gradually.',\n * } );\n *\n * // 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.'\n * ```\n */\nexport default function deprecated(\n\tfeature: string,\n\toptions: DeprecatedOptions = {}\n) {\n\tconst { since, version, alternative, plugin, link, hint } = options;\n\n\tconst pluginMessage = plugin ? ` from ${ plugin }` : '';\n\tconst sinceMessage = since ? ` since version ${ since }` : '';\n\tconst versionMessage = version\n\t\t? ` and will be removed${ pluginMessage } in version ${ version }`\n\t\t: '';\n\tconst useInsteadMessage = alternative\n\t\t? ` Please use ${ alternative } instead.`\n\t\t: '';\n\tconst linkMessage = link ? ` See: ${ link }` : '';\n\tconst hintMessage = hint ? ` Note: ${ hint }` : '';\n\tconst message = `${ feature } is deprecated${ sinceMessage }${ versionMessage }.${ useInsteadMessage }${ linkMessage }${ hintMessage }`;\n\n\t// Skip if already logged.\n\tif ( message in logged ) {\n\t\treturn;\n\t}\n\n\t/**\n\t * Fires whenever a deprecated feature is encountered\n\t *\n\t * @param {string} feature Name of the deprecated feature.\n\t * @param {DeprecatedOptions} options Personalisation options\n\t * @param {string} message Message sent to console.warn\n\t */\n\tdoAction( 'deprecated', feature, options, message );\n\n\t// eslint-disable-next-line no-console\n\tconsole.warn( message );\n\n\tlogged[ message ] = true;\n}\n"], | ||
| "mappings": ";AAGA,SAAS,gBAAgB;AAMlB,IAAM,SAAiC,uBAAO,OAAQ,IAAK;AAkDnD,SAAR,WACN,SACA,UAA6B,CAAC,GAC7B;AACD,QAAM,EAAE,OAAO,SAAS,aAAa,QAAQ,MAAM,KAAK,IAAI;AAE5D,QAAM,gBAAgB,SAAS,SAAU,MAAO,KAAK;AACrD,QAAM,eAAe,QAAQ,kBAAmB,KAAM,KAAK;AAC3D,QAAM,iBAAiB,UACpB,uBAAwB,aAAc,eAAgB,OAAQ,KAC9D;AACH,QAAM,oBAAoB,cACvB,eAAgB,WAAY,cAC5B;AACH,QAAM,cAAc,OAAO,SAAU,IAAK,KAAK;AAC/C,QAAM,cAAc,OAAO,UAAW,IAAK,KAAK;AAChD,QAAM,UAAU,GAAI,OAAQ,iBAAkB,YAAa,GAAI,cAAe,IAAK,iBAAkB,GAAI,WAAY,GAAI,WAAY;AAGrI,MAAK,WAAW,QAAS;AACxB;AAAA,EACD;AASA,WAAU,cAAc,SAAS,SAAS,OAAQ;AAGlD,UAAQ,KAAM,OAAQ;AAEtB,SAAQ,OAAQ,IAAI;AACrB;", | ||
| "names": [] | ||
| } |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // packages/deprecated/src/index.ts | ||
| var index_exports = {}; | ||
| __export(index_exports, { | ||
| default: () => deprecated, | ||
| logged: () => logged | ||
| }); | ||
| module.exports = __toCommonJS(index_exports); | ||
| var import_hooks = require("@wordpress/hooks"); | ||
| var logged = /* @__PURE__ */ Object.create(null); | ||
| 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}`; | ||
| if (message in logged) { | ||
| return; | ||
| } | ||
| (0, import_hooks.doAction)("deprecated", feature, options, message); | ||
| console.warn(message); | ||
| logged[message] = true; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| logged | ||
| }); | ||
| //# sourceMappingURL=index.cjs.map |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { doAction } from '@wordpress/hooks';\n\n/**\n * Object map tracking messages which have been logged, for use in ensuring a\n * message is only logged once.\n */\nexport const logged: Record< string, true > = Object.create( null );\n\ntype DeprecatedOptions = {\n\t/**\n\t * Version in which the feature was deprecated.\n\t */\n\tsince?: string;\n\t/**\n\t * Version in which the feature will be removed.\n\t */\n\tversion?: string;\n\t/**\n\t * Feature to use instead.\n\t */\n\talternative?: string;\n\t/**\n\t * Plugin name if it's a plugin feature.\n\t */\n\tplugin?: string;\n\t/**\n\t * Link to documentation.\n\t */\n\tlink?: string;\n\t/**\n\t * Additional message to help transition away from the deprecated feature.\n\t */\n\thint?: string;\n};\n\n/**\n * Logs a message to notify developers about a deprecated feature.\n *\n * @param {string} feature Name of the deprecated feature.\n * @param {DeprecatedOptions} [options] Personalisation options\n *\n * @example\n * ```js\n * import deprecated from '@wordpress/deprecated';\n *\n * deprecated( 'Eating meat', {\n * \tsince: '2019.01.01',\n * \tversion: '2020.01.01',\n * \talternative: 'vegetables',\n * \tplugin: 'the earth',\n * \thint: 'You may find it beneficial to transition gradually.',\n * } );\n *\n * // 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.'\n * ```\n */\nexport default function deprecated(\n\tfeature: string,\n\toptions: DeprecatedOptions = {}\n) {\n\tconst { since, version, alternative, plugin, link, hint } = options;\n\n\tconst pluginMessage = plugin ? ` from ${ plugin }` : '';\n\tconst sinceMessage = since ? ` since version ${ since }` : '';\n\tconst versionMessage = version\n\t\t? ` and will be removed${ pluginMessage } in version ${ version }`\n\t\t: '';\n\tconst useInsteadMessage = alternative\n\t\t? ` Please use ${ alternative } instead.`\n\t\t: '';\n\tconst linkMessage = link ? ` See: ${ link }` : '';\n\tconst hintMessage = hint ? ` Note: ${ hint }` : '';\n\tconst message = `${ feature } is deprecated${ sinceMessage }${ versionMessage }.${ useInsteadMessage }${ linkMessage }${ hintMessage }`;\n\n\t// Skip if already logged.\n\tif ( message in logged ) {\n\t\treturn;\n\t}\n\n\t/**\n\t * Fires whenever a deprecated feature is encountered\n\t *\n\t * @param {string} feature Name of the deprecated feature.\n\t * @param {DeprecatedOptions} options Personalisation options\n\t * @param {string} message Message sent to console.warn\n\t */\n\tdoAction( 'deprecated', feature, options, message );\n\n\t// eslint-disable-next-line no-console\n\tconsole.warn( message );\n\n\tlogged[ message ] = true;\n}\n"], | ||
| "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAyB;AAMlB,IAAM,SAAiC,uBAAO,OAAQ,IAAK;AAkDnD,SAAR,WACN,SACA,UAA6B,CAAC,GAC7B;AACD,QAAM,EAAE,OAAO,SAAS,aAAa,QAAQ,MAAM,KAAK,IAAI;AAE5D,QAAM,gBAAgB,SAAS,SAAU,MAAO,KAAK;AACrD,QAAM,eAAe,QAAQ,kBAAmB,KAAM,KAAK;AAC3D,QAAM,iBAAiB,UACpB,uBAAwB,aAAc,eAAgB,OAAQ,KAC9D;AACH,QAAM,oBAAoB,cACvB,eAAgB,WAAY,cAC5B;AACH,QAAM,cAAc,OAAO,SAAU,IAAK,KAAK;AAC/C,QAAM,cAAc,OAAO,UAAW,IAAK,KAAK;AAChD,QAAM,UAAU,GAAI,OAAQ,iBAAkB,YAAa,GAAI,cAAe,IAAK,iBAAkB,GAAI,WAAY,GAAI,WAAY;AAGrI,MAAK,WAAW,QAAS;AACxB;AAAA,EACD;AASA,6BAAU,cAAc,SAAS,SAAS,OAAQ;AAGlD,UAAQ,KAAM,OAAQ;AAEtB,SAAQ,OAAQ,IAAI;AACrB;", | ||
| "names": [] | ||
| } |
+0
-2
@@ -5,4 +5,2 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. --> | ||
| ## 4.37.0 (2025-12-23) | ||
| ## 4.36.0 (2025-11-26) | ||
@@ -9,0 +7,0 @@ |
+1
-1
| ## Gutenberg | ||
| Copyright 2016-2025 by the contributors | ||
| Copyright 2016-2026 by the contributors | ||
@@ -5,0 +5,0 @@ **License for Contributions (on and after April 15, 2021)** |
+14
-7
| { | ||
| "name": "@wordpress/deprecated", | ||
| "version": "4.37.0", | ||
| "version": "4.37.1-next.79a2f3cdd.0", | ||
| "description": "Deprecation utility for WordPress.", | ||
@@ -25,9 +25,16 @@ "author": "The WordPress Contributors", | ||
| }, | ||
| "main": "build/index.js", | ||
| "module": "build-module/index.js", | ||
| "files": [ | ||
| "src", | ||
| "build", | ||
| "build-module", | ||
| "build-types", | ||
| "*.md" | ||
| ], | ||
| "main": "build/index.cjs", | ||
| "module": "build-module/index.mjs", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./build-types/index.d.ts", | ||
| "import": "./build-module/index.js", | ||
| "require": "./build/index.js" | ||
| "import": "./build-module/index.mjs", | ||
| "require": "./build/index.cjs" | ||
| }, | ||
@@ -42,3 +49,3 @@ "./package.json": "./package.json" | ||
| "dependencies": { | ||
| "@wordpress/hooks": "^4.37.0" | ||
| "@wordpress/hooks": "^4.37.1-next.79a2f3cdd.0" | ||
| }, | ||
@@ -48,3 +55,3 @@ "publishConfig": { | ||
| }, | ||
| "gitHead": "2cf13ec6cf86153c9b3cf369bf5c59046f5cd950" | ||
| "gitHead": "6a324496a37d9a333a11d4d7fe5fb93b8152a5ba" | ||
| } |
| // packages/deprecated/src/index.ts | ||
| import { doAction } from "@wordpress/hooks"; | ||
| var logged = /* @__PURE__ */ Object.create(null); | ||
| 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}`; | ||
| if (message in logged) { | ||
| return; | ||
| } | ||
| doAction("deprecated", feature, options, message); | ||
| console.warn(message); | ||
| logged[message] = true; | ||
| } | ||
| export { | ||
| deprecated as default, | ||
| logged | ||
| }; | ||
| //# sourceMappingURL=index.js.map |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { doAction } from '@wordpress/hooks';\n\n/**\n * Object map tracking messages which have been logged, for use in ensuring a\n * message is only logged once.\n */\nexport const logged: Record< string, true > = Object.create( null );\n\ntype DeprecatedOptions = {\n\t/**\n\t * Version in which the feature was deprecated.\n\t */\n\tsince?: string;\n\t/**\n\t * Version in which the feature will be removed.\n\t */\n\tversion?: string;\n\t/**\n\t * Feature to use instead.\n\t */\n\talternative?: string;\n\t/**\n\t * Plugin name if it's a plugin feature.\n\t */\n\tplugin?: string;\n\t/**\n\t * Link to documentation.\n\t */\n\tlink?: string;\n\t/**\n\t * Additional message to help transition away from the deprecated feature.\n\t */\n\thint?: string;\n};\n\n/**\n * Logs a message to notify developers about a deprecated feature.\n *\n * @param {string} feature Name of the deprecated feature.\n * @param {DeprecatedOptions} [options] Personalisation options\n *\n * @example\n * ```js\n * import deprecated from '@wordpress/deprecated';\n *\n * deprecated( 'Eating meat', {\n * \tsince: '2019.01.01',\n * \tversion: '2020.01.01',\n * \talternative: 'vegetables',\n * \tplugin: 'the earth',\n * \thint: 'You may find it beneficial to transition gradually.',\n * } );\n *\n * // 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.'\n * ```\n */\nexport default function deprecated(\n\tfeature: string,\n\toptions: DeprecatedOptions = {}\n) {\n\tconst { since, version, alternative, plugin, link, hint } = options;\n\n\tconst pluginMessage = plugin ? ` from ${ plugin }` : '';\n\tconst sinceMessage = since ? ` since version ${ since }` : '';\n\tconst versionMessage = version\n\t\t? ` and will be removed${ pluginMessage } in version ${ version }`\n\t\t: '';\n\tconst useInsteadMessage = alternative\n\t\t? ` Please use ${ alternative } instead.`\n\t\t: '';\n\tconst linkMessage = link ? ` See: ${ link }` : '';\n\tconst hintMessage = hint ? ` Note: ${ hint }` : '';\n\tconst message = `${ feature } is deprecated${ sinceMessage }${ versionMessage }.${ useInsteadMessage }${ linkMessage }${ hintMessage }`;\n\n\t// Skip if already logged.\n\tif ( message in logged ) {\n\t\treturn;\n\t}\n\n\t/**\n\t * Fires whenever a deprecated feature is encountered\n\t *\n\t * @param {string} feature Name of the deprecated feature.\n\t * @param {DeprecatedOptions} options Personalisation options\n\t * @param {string} message Message sent to console.warn\n\t */\n\tdoAction( 'deprecated', feature, options, message );\n\n\t// eslint-disable-next-line no-console\n\tconsole.warn( message );\n\n\tlogged[ message ] = true;\n}\n"], | ||
| "mappings": ";AAGA,SAAS,gBAAgB;AAMlB,IAAM,SAAiC,uBAAO,OAAQ,IAAK;AAkDnD,SAAR,WACN,SACA,UAA6B,CAAC,GAC7B;AACD,QAAM,EAAE,OAAO,SAAS,aAAa,QAAQ,MAAM,KAAK,IAAI;AAE5D,QAAM,gBAAgB,SAAS,SAAU,MAAO,KAAK;AACrD,QAAM,eAAe,QAAQ,kBAAmB,KAAM,KAAK;AAC3D,QAAM,iBAAiB,UACpB,uBAAwB,aAAc,eAAgB,OAAQ,KAC9D;AACH,QAAM,oBAAoB,cACvB,eAAgB,WAAY,cAC5B;AACH,QAAM,cAAc,OAAO,SAAU,IAAK,KAAK;AAC/C,QAAM,cAAc,OAAO,UAAW,IAAK,KAAK;AAChD,QAAM,UAAU,GAAI,OAAQ,iBAAkB,YAAa,GAAI,cAAe,IAAK,iBAAkB,GAAI,WAAY,GAAI,WAAY;AAGrI,MAAK,WAAW,QAAS;AACxB;AAAA,EACD;AASA,WAAU,cAAc,SAAS,SAAS,OAAQ;AAGlD,UAAQ,KAAM,OAAQ;AAEtB,SAAQ,OAAQ,IAAI;AACrB;", | ||
| "names": [] | ||
| } |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // packages/deprecated/src/index.ts | ||
| var index_exports = {}; | ||
| __export(index_exports, { | ||
| default: () => deprecated, | ||
| logged: () => logged | ||
| }); | ||
| module.exports = __toCommonJS(index_exports); | ||
| var import_hooks = require("@wordpress/hooks"); | ||
| var logged = /* @__PURE__ */ Object.create(null); | ||
| 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}`; | ||
| if (message in logged) { | ||
| return; | ||
| } | ||
| (0, import_hooks.doAction)("deprecated", feature, options, message); | ||
| console.warn(message); | ||
| logged[message] = true; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| logged | ||
| }); | ||
| //# sourceMappingURL=index.js.map |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { doAction } from '@wordpress/hooks';\n\n/**\n * Object map tracking messages which have been logged, for use in ensuring a\n * message is only logged once.\n */\nexport const logged: Record< string, true > = Object.create( null );\n\ntype DeprecatedOptions = {\n\t/**\n\t * Version in which the feature was deprecated.\n\t */\n\tsince?: string;\n\t/**\n\t * Version in which the feature will be removed.\n\t */\n\tversion?: string;\n\t/**\n\t * Feature to use instead.\n\t */\n\talternative?: string;\n\t/**\n\t * Plugin name if it's a plugin feature.\n\t */\n\tplugin?: string;\n\t/**\n\t * Link to documentation.\n\t */\n\tlink?: string;\n\t/**\n\t * Additional message to help transition away from the deprecated feature.\n\t */\n\thint?: string;\n};\n\n/**\n * Logs a message to notify developers about a deprecated feature.\n *\n * @param {string} feature Name of the deprecated feature.\n * @param {DeprecatedOptions} [options] Personalisation options\n *\n * @example\n * ```js\n * import deprecated from '@wordpress/deprecated';\n *\n * deprecated( 'Eating meat', {\n * \tsince: '2019.01.01',\n * \tversion: '2020.01.01',\n * \talternative: 'vegetables',\n * \tplugin: 'the earth',\n * \thint: 'You may find it beneficial to transition gradually.',\n * } );\n *\n * // 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.'\n * ```\n */\nexport default function deprecated(\n\tfeature: string,\n\toptions: DeprecatedOptions = {}\n) {\n\tconst { since, version, alternative, plugin, link, hint } = options;\n\n\tconst pluginMessage = plugin ? ` from ${ plugin }` : '';\n\tconst sinceMessage = since ? ` since version ${ since }` : '';\n\tconst versionMessage = version\n\t\t? ` and will be removed${ pluginMessage } in version ${ version }`\n\t\t: '';\n\tconst useInsteadMessage = alternative\n\t\t? ` Please use ${ alternative } instead.`\n\t\t: '';\n\tconst linkMessage = link ? ` See: ${ link }` : '';\n\tconst hintMessage = hint ? ` Note: ${ hint }` : '';\n\tconst message = `${ feature } is deprecated${ sinceMessage }${ versionMessage }.${ useInsteadMessage }${ linkMessage }${ hintMessage }`;\n\n\t// Skip if already logged.\n\tif ( message in logged ) {\n\t\treturn;\n\t}\n\n\t/**\n\t * Fires whenever a deprecated feature is encountered\n\t *\n\t * @param {string} feature Name of the deprecated feature.\n\t * @param {DeprecatedOptions} options Personalisation options\n\t * @param {string} message Message sent to console.warn\n\t */\n\tdoAction( 'deprecated', feature, options, message );\n\n\t// eslint-disable-next-line no-console\n\tconsole.warn( message );\n\n\tlogged[ message ] = true;\n}\n"], | ||
| "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAyB;AAMlB,IAAM,SAAiC,uBAAO,OAAQ,IAAK;AAkDnD,SAAR,WACN,SACA,UAA6B,CAAC,GAC7B;AACD,QAAM,EAAE,OAAO,SAAS,aAAa,QAAQ,MAAM,KAAK,IAAI;AAE5D,QAAM,gBAAgB,SAAS,SAAU,MAAO,KAAK;AACrD,QAAM,eAAe,QAAQ,kBAAmB,KAAM,KAAK;AAC3D,QAAM,iBAAiB,UACpB,uBAAwB,aAAc,eAAgB,OAAQ,KAC9D;AACH,QAAM,oBAAoB,cACvB,eAAgB,WAAY,cAC5B;AACH,QAAM,cAAc,OAAO,SAAU,IAAK,KAAK;AAC/C,QAAM,cAAc,OAAO,UAAW,IAAK,KAAK;AAChD,QAAM,UAAU,GAAI,OAAQ,iBAAkB,YAAa,GAAI,cAAe,IAAK,iBAAkB,GAAI,WAAY,GAAI,WAAY;AAGrI,MAAK,WAAW,QAAS;AACxB;AAAA,EACD;AASA,6BAAU,cAAc,SAAS,SAAS,OAAQ;AAGlD,UAAQ,KAAM,OAAQ;AAEtB,SAAQ,OAAQ,IAAI;AACrB;", | ||
| "names": [] | ||
| } |
| { | ||
| "$schema": "https://json.schemastore.org/tsconfig.json", | ||
| "extends": "../../tsconfig.base.json", | ||
| "references": [ { "path": "../hooks" } ] | ||
| } |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
62430
-21%12
-14.29%300
-1.64%1
Infinity%