You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@wordpress/deprecated

Package Overview
Dependencies
Maintainers
23
Versions
227
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/deprecated - npm Package Compare versions

Comparing version
4.36.1-next.738bb1424.0
to
4.36.1-next.76cff8c98.0
+24
build-module/index.mjs
// 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": []
}
+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)**

{
"name": "@wordpress/deprecated",
"version": "4.36.1-next.738bb1424.0",
"version": "4.36.1-next.76cff8c98.0",
"description": "Deprecation utility for WordPress.",

@@ -32,9 +32,8 @@ "author": "The WordPress Contributors",

],
"type": "module",
"main": "build/index.cjs",
"module": "build-module/index.js",
"module": "build-module/index.mjs",
"exports": {
".": {
"types": "./build-types/index.d.ts",
"import": "./build-module/index.js",
"import": "./build-module/index.mjs",
"require": "./build/index.cjs"

@@ -50,3 +49,3 @@ },

"dependencies": {
"@wordpress/hooks": "^4.36.1-next.738bb1424.0"
"@wordpress/hooks": "^4.36.1-next.76cff8c98.0"
},

@@ -56,3 +55,3 @@ "publishConfig": {

},
"gitHead": "ab1b004c0d61c295aa34bc86ea07f979343983ce"
"gitHead": "368727f14b858e75179e140967c2d9ec965c8790"
}
// 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": []
}