@wordpress/deprecated 3.2.2 → 3.3.1

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.3.0 (2022-01-27)
6
+
5
7
  ## 3.2.0 (2021-07-21)
6
8
 
7
9
  ## 3.1.0 (2021-05-20)
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2021 by the contributors
3
+ Copyright 2016-2022 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
package/README.md CHANGED
@@ -78,4 +78,10 @@ _Type_
78
78
 
79
79
  <!-- END TOKEN(Autogenerated API docs) -->
80
80
 
81
- <br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
81
+ ## Contributing to this package
82
+
83
+ This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.
84
+
85
+ To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).
86
+
87
+ <br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
package/build/index.js CHANGED
@@ -49,7 +49,8 @@ const logged = Object.create(null);
49
49
 
50
50
  exports.logged = logged;
51
51
 
52
- function deprecated(feature, options = {}) {
52
+ function deprecated(feature) {
53
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
53
54
  const {
54
55
  since,
55
56
  version,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/deprecated/src/index.js"],"names":["logged","Object","create","deprecated","feature","options","since","version","alternative","plugin","link","hint","pluginMessage","sinceMessage","versionMessage","useInsteadMessage","linkMessage","hintMessage","message","console","warn"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,MAAM,GAAGC,MAAM,CAACC,MAAP,CAAe,IAAf,CAAf;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACe,SAASC,UAAT,CAAqBC,OAArB,EAA8BC,OAAO,GAAG,EAAxC,EAA6C;AAC3D,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA,MAA/B;AAAuCC,IAAAA,IAAvC;AAA6CC,IAAAA;AAA7C,MAAsDN,OAA5D;AAEA,QAAMO,aAAa,GAAGH,MAAM,GAAI,SAASA,MAAQ,EAArB,GAAyB,EAArD;AACA,QAAMI,YAAY,GAAGP,KAAK,GAAI,kBAAkBA,KAAO,EAA7B,GAAiC,EAA3D;AACA,QAAMQ,cAAc,GAAGP,OAAO,GAC1B,uBAAuBK,aAAe,eAAeL,OAAS,EADpC,GAE3B,EAFH;AAGA,QAAMQ,iBAAiB,GAAGP,WAAW,GACjC,eAAeA,WAAa,WADK,GAElC,EAFH;AAGA,QAAMQ,WAAW,GAAGN,IAAI,GAAI,SAASA,IAAM,EAAnB,GAAuB,EAA/C;AACA,QAAMO,WAAW,GAAGN,IAAI,GAAI,UAAUA,IAAM,EAApB,GAAwB,EAAhD;AACA,QAAMO,OAAO,GAAI,GAAGd,OAAS,iBAAiBS,YAAc,GAAGC,cAAgB,IAAIC,iBAAmB,GAAGC,WAAa,GAAGC,WAAa,EAAtI,CAb2D,CAe3D;;AACA,MAAKC,OAAO,IAAIlB,MAAhB,EAAyB;AACxB;AACA;AAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACC,uBAAU,YAAV,EAAwBI,OAAxB,EAAiCC,OAAjC,EAA0Ca,OAA1C,EAjC2D,CAmC3D;;AACAC,EAAAA,OAAO,CAACC,IAAR,CAAcF,OAAd;AAEAlB,EAAAA,MAAM,CAAEkB,OAAF,CAAN,GAAoB,IAApB;AACA;AAED","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 *\n * @type {Record<string, true | undefined>}\n */\nexport const logged = Object.create( null );\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 {Object} [options] Personalisation options\n * @param {string} [options.since] Version in which the feature was deprecated.\n * @param {string} [options.version] Version in which the feature will be removed.\n * @param {string} [options.alternative] Feature to use instead\n * @param {string} [options.plugin] Plugin name if it's a plugin feature\n * @param {string} [options.link] Link to documentation\n * @param {string} [options.hint] Additional message to help transition away from the deprecated feature.\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( feature, options = {} ) {\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 {?Object} options Personalisation options\n\t * @param {string} options.since Version in which the feature was deprecated.\n\t * @param {?string} options.version Version in which the feature will be removed.\n\t * @param {?string} options.alternative Feature to use instead\n\t * @param {?string} options.plugin Plugin name if it's a plugin feature\n\t * @param {?string} options.link Link to documentation\n\t * @param {?string} options.hint Additional message to help transition away from the deprecated feature.\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\n/** @typedef {import('utility-types').NonUndefined<Parameters<typeof deprecated>[1]>} DeprecatedOptions */\n"]}
1
+ {"version":3,"sources":["@wordpress/deprecated/src/index.js"],"names":["logged","Object","create","deprecated","feature","options","since","version","alternative","plugin","link","hint","pluginMessage","sinceMessage","versionMessage","useInsteadMessage","linkMessage","hintMessage","message","console","warn"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,MAAM,GAAGC,MAAM,CAACC,MAAP,CAAe,IAAf,CAAf;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACe,SAASC,UAAT,CAAqBC,OAArB,EAA6C;AAAA,MAAfC,OAAe,uEAAL,EAAK;AAC3D,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA,MAA/B;AAAuCC,IAAAA,IAAvC;AAA6CC,IAAAA;AAA7C,MAAsDN,OAA5D;AAEA,QAAMO,aAAa,GAAGH,MAAM,GAAI,SAASA,MAAQ,EAArB,GAAyB,EAArD;AACA,QAAMI,YAAY,GAAGP,KAAK,GAAI,kBAAkBA,KAAO,EAA7B,GAAiC,EAA3D;AACA,QAAMQ,cAAc,GAAGP,OAAO,GAC1B,uBAAuBK,aAAe,eAAeL,OAAS,EADpC,GAE3B,EAFH;AAGA,QAAMQ,iBAAiB,GAAGP,WAAW,GACjC,eAAeA,WAAa,WADK,GAElC,EAFH;AAGA,QAAMQ,WAAW,GAAGN,IAAI,GAAI,SAASA,IAAM,EAAnB,GAAuB,EAA/C;AACA,QAAMO,WAAW,GAAGN,IAAI,GAAI,UAAUA,IAAM,EAApB,GAAwB,EAAhD;AACA,QAAMO,OAAO,GAAI,GAAGd,OAAS,iBAAiBS,YAAc,GAAGC,cAAgB,IAAIC,iBAAmB,GAAGC,WAAa,GAAGC,WAAa,EAAtI,CAb2D,CAe3D;;AACA,MAAKC,OAAO,IAAIlB,MAAhB,EAAyB;AACxB;AACA;AAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACC,uBAAU,YAAV,EAAwBI,OAAxB,EAAiCC,OAAjC,EAA0Ca,OAA1C,EAjC2D,CAmC3D;;AACAC,EAAAA,OAAO,CAACC,IAAR,CAAcF,OAAd;AAEAlB,EAAAA,MAAM,CAAEkB,OAAF,CAAN,GAAoB,IAApB;AACA;AAED","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 *\n * @type {Record<string, true | undefined>}\n */\nexport const logged = Object.create( null );\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 {Object} [options] Personalisation options\n * @param {string} [options.since] Version in which the feature was deprecated.\n * @param {string} [options.version] Version in which the feature will be removed.\n * @param {string} [options.alternative] Feature to use instead\n * @param {string} [options.plugin] Plugin name if it's a plugin feature\n * @param {string} [options.link] Link to documentation\n * @param {string} [options.hint] Additional message to help transition away from the deprecated feature.\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( feature, options = {} ) {\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 {?Object} options Personalisation options\n\t * @param {string} options.since Version in which the feature was deprecated.\n\t * @param {?string} options.version Version in which the feature will be removed.\n\t * @param {?string} options.alternative Feature to use instead\n\t * @param {?string} options.plugin Plugin name if it's a plugin feature\n\t * @param {?string} options.link Link to documentation\n\t * @param {?string} options.hint Additional message to help transition away from the deprecated feature.\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\n/** @typedef {import('utility-types').NonUndefined<Parameters<typeof deprecated>[1]>} DeprecatedOptions */\n"]}
@@ -38,7 +38,8 @@ export const logged = Object.create(null);
38
38
  * ```
39
39
  */
40
40
 
41
- export default function deprecated(feature, options = {}) {
41
+ export default function deprecated(feature) {
42
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
42
43
  const {
43
44
  since,
44
45
  version,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/deprecated/src/index.js"],"names":["doAction","logged","Object","create","deprecated","feature","options","since","version","alternative","plugin","link","hint","pluginMessage","sinceMessage","versionMessage","useInsteadMessage","linkMessage","hintMessage","message","console","warn"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,kBAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,MAAM,GAAGC,MAAM,CAACC,MAAP,CAAe,IAAf,CAAf;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,UAAT,CAAqBC,OAArB,EAA8BC,OAAO,GAAG,EAAxC,EAA6C;AAC3D,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA,MAA/B;AAAuCC,IAAAA,IAAvC;AAA6CC,IAAAA;AAA7C,MAAsDN,OAA5D;AAEA,QAAMO,aAAa,GAAGH,MAAM,GAAI,SAASA,MAAQ,EAArB,GAAyB,EAArD;AACA,QAAMI,YAAY,GAAGP,KAAK,GAAI,kBAAkBA,KAAO,EAA7B,GAAiC,EAA3D;AACA,QAAMQ,cAAc,GAAGP,OAAO,GAC1B,uBAAuBK,aAAe,eAAeL,OAAS,EADpC,GAE3B,EAFH;AAGA,QAAMQ,iBAAiB,GAAGP,WAAW,GACjC,eAAeA,WAAa,WADK,GAElC,EAFH;AAGA,QAAMQ,WAAW,GAAGN,IAAI,GAAI,SAASA,IAAM,EAAnB,GAAuB,EAA/C;AACA,QAAMO,WAAW,GAAGN,IAAI,GAAI,UAAUA,IAAM,EAApB,GAAwB,EAAhD;AACA,QAAMO,OAAO,GAAI,GAAGd,OAAS,iBAAiBS,YAAc,GAAGC,cAAgB,IAAIC,iBAAmB,GAAGC,WAAa,GAAGC,WAAa,EAAtI,CAb2D,CAe3D;;AACA,MAAKC,OAAO,IAAIlB,MAAhB,EAAyB;AACxB;AACA;AAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACCD,EAAAA,QAAQ,CAAE,YAAF,EAAgBK,OAAhB,EAAyBC,OAAzB,EAAkCa,OAAlC,CAAR,CAjC2D,CAmC3D;;AACAC,EAAAA,OAAO,CAACC,IAAR,CAAcF,OAAd;AAEAlB,EAAAA,MAAM,CAAEkB,OAAF,CAAN,GAAoB,IAApB;AACA;AAED","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 *\n * @type {Record<string, true | undefined>}\n */\nexport const logged = Object.create( null );\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 {Object} [options] Personalisation options\n * @param {string} [options.since] Version in which the feature was deprecated.\n * @param {string} [options.version] Version in which the feature will be removed.\n * @param {string} [options.alternative] Feature to use instead\n * @param {string} [options.plugin] Plugin name if it's a plugin feature\n * @param {string} [options.link] Link to documentation\n * @param {string} [options.hint] Additional message to help transition away from the deprecated feature.\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( feature, options = {} ) {\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 {?Object} options Personalisation options\n\t * @param {string} options.since Version in which the feature was deprecated.\n\t * @param {?string} options.version Version in which the feature will be removed.\n\t * @param {?string} options.alternative Feature to use instead\n\t * @param {?string} options.plugin Plugin name if it's a plugin feature\n\t * @param {?string} options.link Link to documentation\n\t * @param {?string} options.hint Additional message to help transition away from the deprecated feature.\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\n/** @typedef {import('utility-types').NonUndefined<Parameters<typeof deprecated>[1]>} DeprecatedOptions */\n"]}
1
+ {"version":3,"sources":["@wordpress/deprecated/src/index.js"],"names":["doAction","logged","Object","create","deprecated","feature","options","since","version","alternative","plugin","link","hint","pluginMessage","sinceMessage","versionMessage","useInsteadMessage","linkMessage","hintMessage","message","console","warn"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,kBAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,MAAM,GAAGC,MAAM,CAACC,MAAP,CAAe,IAAf,CAAf;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,UAAT,CAAqBC,OAArB,EAA6C;AAAA,MAAfC,OAAe,uEAAL,EAAK;AAC3D,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA,MAA/B;AAAuCC,IAAAA,IAAvC;AAA6CC,IAAAA;AAA7C,MAAsDN,OAA5D;AAEA,QAAMO,aAAa,GAAGH,MAAM,GAAI,SAASA,MAAQ,EAArB,GAAyB,EAArD;AACA,QAAMI,YAAY,GAAGP,KAAK,GAAI,kBAAkBA,KAAO,EAA7B,GAAiC,EAA3D;AACA,QAAMQ,cAAc,GAAGP,OAAO,GAC1B,uBAAuBK,aAAe,eAAeL,OAAS,EADpC,GAE3B,EAFH;AAGA,QAAMQ,iBAAiB,GAAGP,WAAW,GACjC,eAAeA,WAAa,WADK,GAElC,EAFH;AAGA,QAAMQ,WAAW,GAAGN,IAAI,GAAI,SAASA,IAAM,EAAnB,GAAuB,EAA/C;AACA,QAAMO,WAAW,GAAGN,IAAI,GAAI,UAAUA,IAAM,EAApB,GAAwB,EAAhD;AACA,QAAMO,OAAO,GAAI,GAAGd,OAAS,iBAAiBS,YAAc,GAAGC,cAAgB,IAAIC,iBAAmB,GAAGC,WAAa,GAAGC,WAAa,EAAtI,CAb2D,CAe3D;;AACA,MAAKC,OAAO,IAAIlB,MAAhB,EAAyB;AACxB;AACA;AAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACCD,EAAAA,QAAQ,CAAE,YAAF,EAAgBK,OAAhB,EAAyBC,OAAzB,EAAkCa,OAAlC,CAAR,CAjC2D,CAmC3D;;AACAC,EAAAA,OAAO,CAACC,IAAR,CAAcF,OAAd;AAEAlB,EAAAA,MAAM,CAAEkB,OAAF,CAAN,GAAoB,IAApB;AACA;AAED","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 *\n * @type {Record<string, true | undefined>}\n */\nexport const logged = Object.create( null );\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 {Object} [options] Personalisation options\n * @param {string} [options.since] Version in which the feature was deprecated.\n * @param {string} [options.version] Version in which the feature will be removed.\n * @param {string} [options.alternative] Feature to use instead\n * @param {string} [options.plugin] Plugin name if it's a plugin feature\n * @param {string} [options.link] Link to documentation\n * @param {string} [options.hint] Additional message to help transition away from the deprecated feature.\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( feature, options = {} ) {\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 {?Object} options Personalisation options\n\t * @param {string} options.since Version in which the feature was deprecated.\n\t * @param {?string} options.version Version in which the feature will be removed.\n\t * @param {?string} options.alternative Feature to use instead\n\t * @param {?string} options.plugin Plugin name if it's a plugin feature\n\t * @param {?string} options.link Link to documentation\n\t * @param {?string} options.hint Additional message to help transition away from the deprecated feature.\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\n/** @typedef {import('utility-types').NonUndefined<Parameters<typeof deprecated>[1]>} DeprecatedOptions */\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/deprecated",
3
- "version": "3.2.2",
3
+ "version": "3.3.1",
4
4
  "description": "Deprecation utility for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,11 +27,11 @@
27
27
  "types": "build-types",
28
28
  "sideEffects": false,
29
29
  "dependencies": {
30
- "@babel/runtime": "^7.13.10",
31
- "@wordpress/hooks": "^3.2.1"
30
+ "@babel/runtime": "^7.16.0",
31
+ "@wordpress/hooks": "^3.3.1"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "8f7f052bc04e3f4eb50f479ced14be1489b9fa79"
36
+ "gitHead": "2e4922861e49f5a090f9dc52056165092cfba163"
37
37
  }