Use a modified version of edit-site lock-unlock module to make it CYS… (#40884)
This commit is contained in:
commit
585fa841c0
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
|
||||
|
||||
let consentString =
|
||||
'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.';
|
||||
|
||||
if ( window.wcSettings && window.wcSettings.wpVersion ) {
|
||||
// Parse the version string as a floating-point number
|
||||
const wpVersion = parseFloat( window.wcSettings.wpVersion );
|
||||
if ( ! isNaN( wpVersion ) && wpVersion >= 6.4 ) {
|
||||
consentString =
|
||||
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.';
|
||||
}
|
||||
}
|
||||
|
||||
export const { lock, unlock } =
|
||||
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
||||
consentString,
|
||||
'@wordpress/edit-site'
|
||||
);
|
||||
//# sourceMappingURL=lock-unlock.js.map
|
|
@ -10,6 +10,8 @@ const BundleAnalyzerPlugin =
|
|||
const MomentTimezoneDataPlugin = require( 'moment-timezone-data-webpack-plugin' );
|
||||
const ForkTsCheckerWebpackPlugin = require( 'fork-ts-checker-webpack-plugin' );
|
||||
const ReactRefreshWebpackPlugin = require( '@pmmmwh/react-refresh-webpack-plugin' );
|
||||
const NormalModuleReplacementPlugin =
|
||||
require( 'webpack' ).NormalModuleReplacementPlugin;
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -168,6 +170,14 @@ const webpackConfig = {
|
|||
},
|
||||
},
|
||||
plugins: [
|
||||
// Workaround for Gutenberg private API consent string differences between WP 6.3 and 6.4+
|
||||
// The modified version checks for the WP version and replaces the consent string with the correct one.
|
||||
// This can be removed once we drop support for WP 6.3 in the "Customize Your Store" task.
|
||||
// See this PR for details: https://github.com/woocommerce/woocommerce/pull/40884
|
||||
new NormalModuleReplacementPlugin(
|
||||
/@wordpress\/edit-site\/build-module\/lock-unlock\.js/,
|
||||
path.resolve( __dirname, 'bin/modified-editsite-lock-unlock.js' )
|
||||
),
|
||||
...styleConfig.plugins,
|
||||
// Runs TypeScript type checker on a separate process.
|
||||
! process.env.STORYBOOK && new ForkTsCheckerWebpackPlugin(),
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: tweak
|
||||
|
||||
Replace the original lock-unlock module with a modified version to make Customize your store task compatible with both WP 6.4 and earlier versions.
|
Loading…
Reference in New Issue