diff --git a/.eslintrc.js b/.eslintrc.js
index a4884fbb7fde5..77c4e0eaa7003 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -46,25 +46,29 @@ module.exports = {
selector: 'ImportDeclaration[source.value=/^components$/]',
message: 'Use @wordpress/components as import path instead.',
},
+ {
+ selector: 'ImportDeclaration[source.value=/^data$/]',
+ message: 'Use @wordpress/data as import path instead.',
+ },
{
selector: 'ImportDeclaration[source.value=/^date$/]',
message: 'Use @wordpress/date as import path instead.',
},
{
- selector: 'ImportDeclaration[source.value=/^editor$/]',
- message: 'Use @wordpress/editor as import path instead.',
+ selector: 'ImportDeclaration[source.value=/^deprecated/]',
+ message: 'Use @wordpress/deprecated as import path instead.',
},
{
- selector: 'ImportDeclaration[source.value=/^element$/]',
- message: 'Use @wordpress/element as import path instead.',
+ selector: 'ImportDeclaration[source.value=/^dom$/]',
+ message: 'Use @wordpress/dom as import path instead.',
},
{
- selector: 'ImportDeclaration[source.value=/^data$/]',
- message: 'Use @wordpress/data as import path instead.',
+ selector: 'ImportDeclaration[source.value=/^editor$/]',
+ message: 'Use @wordpress/editor as import path instead.',
},
{
- selector: 'ImportDeclaration[source.value=/^dom$/]',
- message: 'Use @wordpress/dom as import path instead.',
+ selector: 'ImportDeclaration[source.value=/^element$/]',
+ message: 'Use @wordpress/element as import path instead.',
},
{
selector: 'ImportDeclaration[source.value=/^utils$/]',
diff --git a/blocks/api/registration.js b/blocks/api/registration.js
index 1ce6fb13ac1ae..b8aecb72dd9a9 100644
--- a/blocks/api/registration.js
+++ b/blocks/api/registration.js
@@ -10,7 +10,7 @@ import { get, set, isFunction, some } from 'lodash';
*/
import { applyFilters } from '@wordpress/hooks';
import { select, dispatch } from '@wordpress/data';
-import { deprecated } from '@wordpress/utils';
+import deprecated from '@wordpress/deprecated';
/**
* Defined behavior of a block type.
diff --git a/core-blocks/index.js b/core-blocks/index.js
index a6c83b08da036..75f6b509eed70 100644
--- a/core-blocks/index.js
+++ b/core-blocks/index.js
@@ -6,7 +6,7 @@ import {
setDefaultBlockName,
setUnknownTypeHandlerName,
} from '@wordpress/blocks';
-import { deprecated } from '@wordpress/utils';
+import deprecated from '@wordpress/deprecated';
/**
* Internal dependencies
diff --git a/data/persist.js b/data/persist.js
index 0a76097173377..63d800f4ee1c1 100644
--- a/data/persist.js
+++ b/data/persist.js
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
-import { deprecated } from '@wordpress/utils';
+import deprecated from '@wordpress/deprecated';
/**
* External dependencies
diff --git a/data/test/index.js b/data/test/index.js
index 7042011e9b006..d437e81dd790a 100644
--- a/data/test/index.js
+++ b/data/test/index.js
@@ -29,10 +29,6 @@ import {
toAsyncIterable,
} from '../';
-jest.mock( '@wordpress/utils', () => ( {
- deprecated: jest.fn(),
-} ) );
-
// Mock data store to prevent self-initialization, as it needs to be reset
// between tests of `registerResolvers` by replacement (new `registerStore`).
jest.mock( '../store', () => () => {} );
diff --git a/docs/reference/deprecated.md b/docs/reference/deprecated.md
index 5422e71ce22fd..db44a598613ee 100644
--- a/docs/reference/deprecated.md
+++ b/docs/reference/deprecated.md
@@ -4,6 +4,7 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo
- `wp.data.withRehydratation` has been renamed to `wp.data.withRehydration`.
- The `wp.editor.ImagePlaceholder` component is removed. Please use `wp.editor.MediaPlaceholder` instead.
+ - `wp.utils.deprecated` function removed. Please use `wp.deprecated` instead.
## 3.1.0
@@ -11,7 +12,7 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo
- `wp.blocks.withEditorSettings` is removed. Please use the data module to access the editor settings `wp.data.select( "core/editor" ).getEditorSettings()`.
- All DOM utils in `wp.utils.*` are removed. Please use `wp.dom.*` instead.
- `isPrivate: true` has been removed from the Block API. Please use `supports.inserter: false` instead.
- - `wp.utils.isExtraSmall` function removed. Please use `wp.viewport.*` instead.
+ - `wp.utils.isExtraSmall` function removed. Please use `wp.viewport.isExtraSmall` instead.
## 3.0.0
diff --git a/editor/components/image-placeholder/index.js b/editor/components/image-placeholder/index.js
index 335f4c21bbe28..1edf4adf09417 100644
--- a/editor/components/image-placeholder/index.js
+++ b/editor/components/image-placeholder/index.js
@@ -3,7 +3,7 @@
*/
import { Component } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
-import { deprecated } from '@wordpress/utils';
+import deprecated from '@wordpress/deprecated';
/**
* Internal dependencies
diff --git a/editor/components/rich-text/index.js b/editor/components/rich-text/index.js
index b65eb2eabe27f..238dae578486b 100644
--- a/editor/components/rich-text/index.js
+++ b/editor/components/rich-text/index.js
@@ -24,10 +24,10 @@ import {
getRectangleFromRange,
getScrollContainer,
} from '@wordpress/dom';
+import deprecated from '@wordpress/deprecated';
import {
keycodes,
createBlobURL,
- deprecated,
} from '@wordpress/utils';
import { withInstanceId, withSafeTimeout, Slot } from '@wordpress/components';
import { withSelect } from '@wordpress/data';
diff --git a/editor/deprecated.js b/editor/deprecated.js
index f1e130c825cbd..0135f7c71a66c 100644
--- a/editor/deprecated.js
+++ b/editor/deprecated.js
@@ -7,7 +7,7 @@ import { forEach } from 'lodash';
* WordPress dependencies
*/
import { Component } from '@wordpress/element';
-import { deprecated } from '@wordpress/utils';
+import deprecated from '@wordpress/deprecated';
import { withSelect } from '@wordpress/data';
import {
diff --git a/lib/client-assets.php b/lib/client-assets.php
index bcb5cebb9f290..789fe04c211fb 100644
--- a/lib/client-assets.php
+++ b/lib/client-assets.php
@@ -115,10 +115,17 @@ function gutenberg_register_scripts_and_styles() {
);
// Editor Scripts.
+ wp_register_script(
+ 'wp-deprecated',
+ gutenberg_url( 'build/deprecated/index.js' ),
+ array(),
+ filemtime( gutenberg_dir_path() . 'build/deprecated/index.js' ),
+ true
+ );
wp_register_script(
'wp-data',
gutenberg_url( 'build/data/index.js' ),
- array( 'wp-element', 'wp-utils', 'wp-is-shallow-equal', 'lodash' ),
+ array( 'wp-deprecated', 'wp-element', 'wp-is-shallow-equal', 'lodash' ),
filemtime( gutenberg_dir_path() . 'build/data/index.js' ),
true
);
@@ -139,7 +146,7 @@ function gutenberg_register_scripts_and_styles() {
wp_register_script(
'wp-utils',
gutenberg_url( 'build/utils/index.js' ),
- array( 'lodash', 'wp-dom' ),
+ array( 'lodash', 'wp-deprecated', 'wp-dom' ),
filemtime( gutenberg_dir_path() . 'build/utils/index.js' ),
true
);
@@ -206,7 +213,7 @@ function gutenberg_register_scripts_and_styles() {
wp_register_script(
'wp-blocks',
gutenberg_url( 'build/blocks/index.js' ),
- array( 'wp-dom', 'wp-element', 'wp-utils', 'wp-hooks', 'wp-i18n', 'shortcode', 'wp-data', 'lodash' ),
+ array( 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-utils', 'wp-hooks', 'wp-i18n', 'shortcode', 'wp-data', 'lodash' ),
filemtime( gutenberg_dir_path() . 'build/blocks/index.js' ),
true
);
@@ -234,6 +241,7 @@ function gutenberg_register_scripts_and_styles() {
'wp-blocks',
'wp-components',
'wp-core-data',
+ 'wp-deprecated',
'wp-element',
'wp-editor',
'wp-i18n',
@@ -327,6 +335,7 @@ function gutenberg_register_scripts_and_styles() {
'wp-core-data',
'wp-data',
'wp-date',
+ 'wp-deprecated',
'wp-dom',
'wp-i18n',
'wp-element',
diff --git a/packages/deprecated/.npmrc b/packages/deprecated/.npmrc
new file mode 100644
index 0000000000000..43c97e719a5a8
--- /dev/null
+++ b/packages/deprecated/.npmrc
@@ -0,0 +1 @@
+package-lock=false
diff --git a/packages/deprecated/README.md b/packages/deprecated/README.md
new file mode 100644
index 0000000000000..e00c1276a089a
--- /dev/null
+++ b/packages/deprecated/README.md
@@ -0,0 +1,28 @@
+# @wordpress/deprecated
+
+Logs a message to notify developers about a deprecated feature.
+
+## Installation
+
+Install the module
+
+```bash
+npm install @wordpress/deprecated@next --save
+```
+
+## Usage
+
+```js
+import deprecated from '@wordpress/deprecated';
+
+deprecated( 'Eating meat', {
+ version: 'the future',
+ alternative: 'vegetables',
+ plugin: 'the earth',
+ hint: 'You may find it beneficial to transition gradually.',
+} );
+
+// Logs: 'Eating meat is deprecated and will be removed from the earth in the future. Please use vegetables instead. Note: You may find it beneficial to transition gradually.'
+```
+
+