@wordpress/deprecated 4.33.1 → 4.34.1-next.2f1c7c01b.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/build/index.js
CHANGED
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/deprecated/src/index.ts
|
|
19
21
|
var index_exports = {};
|
|
20
22
|
__export(index_exports, {
|
|
21
23
|
default: () => deprecated,
|
|
@@ -23,7 +25,7 @@ __export(index_exports, {
|
|
|
23
25
|
});
|
|
24
26
|
module.exports = __toCommonJS(index_exports);
|
|
25
27
|
var import_hooks = require("@wordpress/hooks");
|
|
26
|
-
|
|
28
|
+
var logged = /* @__PURE__ */ Object.create(null);
|
|
27
29
|
function deprecated(feature, options = {}) {
|
|
28
30
|
const { since, version, alternative, plugin, link, hint } = options;
|
|
29
31
|
const pluginMessage = plugin ? ` from ${plugin}` : "";
|
package/build/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"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"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build-module/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
// packages/deprecated/src/index.ts
|
|
1
2
|
import { doAction } from "@wordpress/hooks";
|
|
2
|
-
|
|
3
|
+
var logged = /* @__PURE__ */ Object.create(null);
|
|
3
4
|
function deprecated(feature, options = {}) {
|
|
4
5
|
const { since, version, alternative, plugin, link, hint } = options;
|
|
5
6
|
const pluginMessage = plugin ? ` from ${plugin}` : "";
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"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"],
|
|
5
|
-
"mappings": "AAGA,SAAS,gBAAgB;AAMlB,
|
|
5
|
+
"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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/deprecated",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.34.1-next.2f1c7c01b.0",
|
|
4
4
|
"description": "Deprecation utility for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"types": "build-types",
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@wordpress/hooks": "^4.
|
|
41
|
+
"@wordpress/hooks": "^4.34.1-next.2f1c7c01b.0"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "c6ddcdf455bc02567a2c9e03de6862a2061b85e8"
|
|
47
47
|
}
|