Skip to content

Commit

Permalink
Update Private API opt-in string for WP 6.6. (#62635)
Browse files Browse the repository at this point in the history
Co-authored-by: peterwilsoncc <[email protected]>
Co-authored-by: talldan <[email protected]>
  • Loading branch information
3 people authored and ellatrix committed Jun 18, 2024
1 parent d3f0e25 commit 557650c
Show file tree
Hide file tree
Showing 25 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/contributors/code/coding-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ do so by opting-in to `@wordpress/private-apis`:
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/block-editor' // Name of the package calling __dangerousOptInToUnstableAPIsOnlyForCoreModules,
// (not the name of the package whose APIs you want to access)
);
Expand Down
2 changes: 1 addition & 1 deletion packages/block-directory/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/block-directory'
);
2 changes: 1 addition & 1 deletion packages/block-editor/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/block-editor'
);
2 changes: 1 addition & 1 deletion packages/block-library/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/block-library'
);
2 changes: 1 addition & 1 deletion packages/blocks/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/blocks'
);
2 changes: 1 addition & 1 deletion packages/commands/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/commands'
);
2 changes: 1 addition & 1 deletion packages/components/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/components'
);
2 changes: 1 addition & 1 deletion packages/core-commands/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/core-commands'
);
2 changes: 1 addition & 1 deletion packages/core-data/src/private-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/core-data'
);
2 changes: 1 addition & 1 deletion packages/customize-widgets/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/customize-widgets'
);
2 changes: 1 addition & 1 deletion packages/data/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/data'
);
2 changes: 1 addition & 1 deletion packages/dataviews/src/lock-unlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/dataviews'
);
2 changes: 1 addition & 1 deletion packages/edit-post/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/edit-post'
);
2 changes: 1 addition & 1 deletion packages/edit-site/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/edit-site'
);
2 changes: 1 addition & 1 deletion packages/edit-widgets/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/edit-widgets'
);
2 changes: 1 addition & 1 deletion packages/editor/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/editor'
);
2 changes: 1 addition & 1 deletion packages/format-library/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/format-library'
);
2 changes: 1 addition & 1 deletion packages/interface/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/interface'
);
2 changes: 1 addition & 1 deletion packages/patterns/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/patterns'
);
2 changes: 1 addition & 1 deletion packages/preferences/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/preferences'
);
5 changes: 3 additions & 2 deletions packages/private-apis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Every `@wordpress` package wanting to privately access or expose experimental AP
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/block-editor' // Name of the package calling __dangerousOptInToUnstableAPIsOnlyForCoreModules,
// (not the name of the package whose APIs you want to access)
);
Expand All @@ -22,7 +22,7 @@ Each package may only opt in once. The function name communicates that plugins a

The function will throw an error if the following conditions are not met:

1. The first argument must exactly match the required consent string: `'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.'`.
1. The first argument must exactly match the required consent string: `'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.'`.
2. The second argument must be a known `@wordpress` package that hasn't yet opted into `@wordpress/private-apis`

Once the opt-in is complete, the obtained `lock()` and `unlock()` utilities enable hiding `__experimental` APIs from the naked eye:
Expand Down Expand Up @@ -120,3 +120,4 @@ The final string in this list is the current version.

1. I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.
2. I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.
3. I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.
2 changes: 1 addition & 1 deletion packages/private-apis/src/implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const registeredPrivateApis = [];
* CHANGE MAY OCCUR IN EITHER A MAJOR OR MINOR RELEASE.
*/
const requiredConsent =
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.';
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.';

/** @type {boolean} */
let allowReRegistration;
Expand Down
2 changes: 1 addition & 1 deletion packages/private-apis/src/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ beforeEach( () => {
} );

const requiredConsent =
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.';
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.';

describe( '__dangerousOptInToUnstableAPIsOnlyForCoreModules', () => {
it( 'Should require a consent string', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/reusable-blocks/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';

export const { unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/reusable-blocks'
);
2 changes: 1 addition & 1 deletion packages/router/src/lock-unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
'@wordpress/router'
);

0 comments on commit 557650c

Please sign in to comment.