From 18026f2d0a5715ea104b80473f8e4434560080a6 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Sat, 20 Jul 2024 00:01:48 +0530 Subject: [PATCH 01/31] WIP --- pnpm-lock.yaml | 9 + .../js-packages/initial-state/.eslintrc.js | 6 + .../js-packages/initial-state/.gitattributes | 7 + projects/js-packages/initial-state/.gitignore | 2 + projects/js-packages/initial-state/README.md | 15 ++ .../js-packages/initial-state/composer.json | 34 ++++ .../js-packages/initial-state/package.json | 23 +++ .../js-packages/initial-state/src/index.ts | 2 + .../js-packages/initial-state/src/types.ts | 27 +++ .../js-packages/initial-state/src/utils.ts | 39 +++++ .../js-packages/initial-state/tsconfig.json | 5 + .../js-packages/webpack-config/src/webpack.js | 27 ++- projects/packages/assets/actions.php | 6 + projects/packages/assets/package.json | 3 + .../assets/src/class-initial-state.php | 160 ++++++++++++++++++ .../packages/assets/src/js/initial-state.js | 1 + projects/packages/assets/webpack.config.js | 67 +++++--- .../connection/src/class-initial-state.php | 24 +++ .../packages/connection/src/class-manager.php | 2 + .../hooks/use-my-jetpack-connection/index.ts | 11 +- projects/packages/my-jetpack/package.json | 1 + 21 files changed, 445 insertions(+), 26 deletions(-) create mode 100644 projects/js-packages/initial-state/.eslintrc.js create mode 100644 projects/js-packages/initial-state/.gitattributes create mode 100644 projects/js-packages/initial-state/.gitignore create mode 100644 projects/js-packages/initial-state/README.md create mode 100644 projects/js-packages/initial-state/composer.json create mode 100644 projects/js-packages/initial-state/package.json create mode 100644 projects/js-packages/initial-state/src/index.ts create mode 100644 projects/js-packages/initial-state/src/types.ts create mode 100644 projects/js-packages/initial-state/src/utils.ts create mode 100644 projects/js-packages/initial-state/tsconfig.json create mode 100644 projects/packages/assets/src/class-initial-state.php create mode 100644 projects/packages/assets/src/js/initial-state.js diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9fd6f9d5a3471..2d7ca38775088 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -742,6 +742,8 @@ importers: specifier: 4.9.1 version: 4.9.1(webpack@5.76.0) + projects/js-packages/initial-state: {} + projects/js-packages/licensing: dependencies: '@automattic/jetpack-analytics': @@ -1585,6 +1587,10 @@ importers: projects/packages/admin-ui: {} projects/packages/assets: + dependencies: + '@automattic/jetpack-initial-state': + specifier: workspace:* + version: link:../../js-packages/initial-state devDependencies: '@automattic/jetpack-webpack-config': specifier: workspace:* @@ -2348,6 +2354,9 @@ importers: '@automattic/jetpack-connection': specifier: workspace:* version: link:../../js-packages/connection + '@automattic/jetpack-initial-state': + specifier: workspace:* + version: link:../../js-packages/initial-state '@automattic/jetpack-licensing': specifier: workspace:* version: link:../../js-packages/licensing diff --git a/projects/js-packages/initial-state/.eslintrc.js b/projects/js-packages/initial-state/.eslintrc.js new file mode 100644 index 0000000000000..5c01a9cb70333 --- /dev/null +++ b/projects/js-packages/initial-state/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + extends: [ require.resolve( 'jetpack-js-tools/eslintrc/base' ) ], + parserOptions: { + requireConfigFile: false, + }, +}; diff --git a/projects/js-packages/initial-state/.gitattributes b/projects/js-packages/initial-state/.gitattributes new file mode 100644 index 0000000000000..7e44bd96454e9 --- /dev/null +++ b/projects/js-packages/initial-state/.gitattributes @@ -0,0 +1,7 @@ +# Files not needed to be distributed in the package. +.gitattributes export-ignore +node_modules export-ignore + +# Files to exclude from the mirror repo +/changelog/** production-exclude +/.eslintrc.cjs production-exclude diff --git a/projects/js-packages/initial-state/.gitignore b/projects/js-packages/initial-state/.gitignore new file mode 100644 index 0000000000000..140fd587d2d52 --- /dev/null +++ b/projects/js-packages/initial-state/.gitignore @@ -0,0 +1,2 @@ +vendor/ +node_modules/ diff --git a/projects/js-packages/initial-state/README.md b/projects/js-packages/initial-state/README.md new file mode 100644 index 0000000000000..d4c3c313cfa31 --- /dev/null +++ b/projects/js-packages/initial-state/README.md @@ -0,0 +1,15 @@ +# Initial State + +A library to provide initial state and the corresponding utility functions for Jetpack. + +## Contribute + +## Get Help + +## Security + +Need to report a security vulnerability? Go to [https://automattic.com/security/](https://automattic.com/security/) or directly to our security bug bounty site [https://hackerone.com/automattic](https://hackerone.com/automattic). + +## License + +publicize is licensed under [GNU General Public License v2 (or later)](./LICENSE.txt) diff --git a/projects/js-packages/initial-state/composer.json b/projects/js-packages/initial-state/composer.json new file mode 100644 index 0000000000000..766345eb70eb2 --- /dev/null +++ b/projects/js-packages/initial-state/composer.json @@ -0,0 +1,34 @@ +{ + "name": "automattic/jetpack-initial-state", + "description": "A library to provide initial state and the corresponding utility functions for Jetpack.", + "type": "library", + "license": "GPL-2.0-or-later", + "require": {}, + "require-dev": { + "automattic/jetpack-changelogger": "@dev" + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "scripts": {}, + "repositories": [ + { + "type": "path", + "url": "../../packages/*", + "options": { + "monorepo": true + } + } + ], + "minimum-stability": "dev", + "prefer-stable": true, + "extra": { + "mirror-repo": "Automattic/jetpack-initial-state", + "changelogger": { + "link-template": "https://github.com/Automattic/jetpack-initial-state/compare/v${old}...v${new}" + }, + "autotagger": true + } +} diff --git a/projects/js-packages/initial-state/package.json b/projects/js-packages/initial-state/package.json new file mode 100644 index 0000000000000..f2a5296478ae7 --- /dev/null +++ b/projects/js-packages/initial-state/package.json @@ -0,0 +1,23 @@ +{ + "private": true, + "name": "@automattic/jetpack-initial-state", + "version": "0.0.1", + "description": "A library to provide initial state and the corresponding utility functions for Jetpack.", + "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/initial-state/#readme", + "bugs": { + "url": "https://github.com/Automattic/jetpack/labels/[JS Package] Initial State" + }, + "repository": { + "type": "git", + "url": "https://github.com/Automattic/jetpack.git", + "directory": "projects/js-packages/initial-state" + }, + "license": "GPL-2.0-or-later", + "author": "Automattic", + "scripts": {}, + "dependencies": {}, + "devDependencies": {}, + "exports": { + ".": "./src/index.ts" + } +} diff --git a/projects/js-packages/initial-state/src/index.ts b/projects/js-packages/initial-state/src/index.ts new file mode 100644 index 0000000000000..6d5a6ef495dd6 --- /dev/null +++ b/projects/js-packages/initial-state/src/index.ts @@ -0,0 +1,2 @@ +export * from './types'; +export * from './utils'; diff --git a/projects/js-packages/initial-state/src/types.ts b/projects/js-packages/initial-state/src/types.ts new file mode 100644 index 0000000000000..e0426e7684b47 --- /dev/null +++ b/projects/js-packages/initial-state/src/types.ts @@ -0,0 +1,27 @@ +export interface SiteData { + admin_url: string; + blog_id: number; + rest_nonce: string; + rest_root: string; + title: string; +} + +export interface CurrentUserData { + id: number; + display_name: string; +} + +export interface UserData { + current_user: CurrentUserData; +} + +export interface JetpackInitialState { + site: SiteData; + user: UserData; +} + +declare global { + interface Window { + JETPACK_INITIAL_STATE: JetpackInitialState; + } +} diff --git a/projects/js-packages/initial-state/src/utils.ts b/projects/js-packages/initial-state/src/utils.ts new file mode 100644 index 0000000000000..1cccab8b4f568 --- /dev/null +++ b/projects/js-packages/initial-state/src/utils.ts @@ -0,0 +1,39 @@ +/** + * Get the initial state from the window object. + * + * @returns {import('./types').JetpackInitialState} The initial state. + */ +export function getInitialState() { + return window.JETPACK_INITIAL_STATE; +} + +/** + * Get the site data from the initial state. + * + * @returns {import('./types').SiteData} The site data. + */ +export function getSiteData() { + return getInitialState().site; +} + +/** + * Get the admin URL from the initial state. + * + * @param {string} [path] - The path to append to the admin URL. + * + * @returns {string} The admin URL. + */ +export function getAdminUrl( path = '' ) { + return `${ getInitialState().site.admin_url }${ path }`; +} + +/** + * Get the url for the My Jetpack page. + * + * @param {string} [section] - The section to append to the My Jetpack URL. + * + * @returns {string} The My Jetpack URL. + */ +export function getMyJetpackUrl( section = '' ) { + return getAdminUrl( `admin.php?page=my-jetpack${ section }` ); +} diff --git a/projects/js-packages/initial-state/tsconfig.json b/projects/js-packages/initial-state/tsconfig.json new file mode 100644 index 0000000000000..9bc81f75a76ce --- /dev/null +++ b/projects/js-packages/initial-state/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "jetpack-js-tools/tsconfig.base.json", + // List all sources and source-containing subdirs. + "include": [ "./src" ] +} diff --git a/projects/js-packages/webpack-config/src/webpack.js b/projects/js-packages/webpack-config/src/webpack.js index caa64d98f278f..c88cd542433df 100644 --- a/projects/js-packages/webpack-config/src/webpack.js +++ b/projects/js-packages/webpack-config/src/webpack.js @@ -105,7 +105,32 @@ const DefinePlugin = defines => [ } ), ]; -const DependencyExtractionPlugin = options => [ new DependencyExtractionWebpackPlugin( options ) ]; +const defaultRequestMap = { + '@automattic/jetpack-initial-state': { + external: 'JetpackInitialState', + handle: 'jetpack-initial-state', + }, +}; + +const DependencyExtractionPlugin = ( { requestMap, ...options } = {} ) => { + const finalRequestMap = { ...defaultRequestMap, ...requestMap }; + + const requestToExternal = request => { + return finalRequestMap[ request ]?.external; + }; + + const requestToHandle = request => { + return finalRequestMap[ request ]?.handle; + }; + + return [ + new DependencyExtractionWebpackPlugin( { + requestToExternal, + requestToHandle, + ...options, + } ), + ]; +}; const DuplicatePackageCheckerPlugin = options => [ new DuplicatePackageCheckerWebpackPlugin( options ), diff --git a/projects/packages/assets/actions.php b/projects/packages/assets/actions.php index 1c8becda51ff9..f49b973ee9246 100644 --- a/projects/packages/assets/actions.php +++ b/projects/packages/assets/actions.php @@ -9,6 +9,7 @@ // drop data into `$wp_filter` for `WP_Hook::build_preinitialized_hooks()`. if ( function_exists( 'add_action' ) ) { add_action( 'wp_default_scripts', array( Automattic\Jetpack\Assets::class, 'wp_default_scripts_hook' ) ); + add_action( 'plugins_loaded', array( Automattic\Jetpack\Initial_State::instance(), 'configure' ), 1 ); } else { global $wp_filter; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited @@ -16,4 +17,9 @@ 'accepted_args' => 1, 'function' => array( Automattic\Jetpack\Assets::class, 'wp_default_scripts_hook' ), ); + // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited + $wp_filter['plugins_loaded'][1][] = array( + 'accepted_args' => 0, + 'function' => array( Automattic\Jetpack\Initial_State::instance(), 'configure' ), + ); } diff --git a/projects/packages/assets/package.json b/projects/packages/assets/package.json index 71fc967d70e21..7a66231e05e2e 100644 --- a/projects/packages/assets/package.json +++ b/projects/packages/assets/package.json @@ -10,6 +10,9 @@ "test": "jest tests", "validate": "pnpm exec validate-es build/" }, + "dependencies": { + "@automattic/jetpack-initial-state": "workspace:*" + }, "devDependencies": { "@automattic/jetpack-webpack-config": "workspace:*", "@wordpress/browserslist-config": "6.2.0", diff --git a/projects/packages/assets/src/class-initial-state.php b/projects/packages/assets/src/class-initial-state.php new file mode 100644 index 0000000000000..46b05ca117d84 --- /dev/null +++ b/projects/packages/assets/src/class-initial-state.php @@ -0,0 +1,160 @@ + 'jetpack-assets', + ) + ); + } + } + + /** + * Render the initial state using an inline script. + * + * @return void + */ + public function render_initial_state() { + + // If the initial state has already been added, don't add it again. + // This can happen if this methd is called explicitly. + if ( wp_scripts()->get_data( self::SCRIPT_HANDLE, 'Jetpack::InitialState::added' ) ) { + return; + } + + $initial_state = wp_json_encode( + self::get_initial_state(), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE + ); + + wp_add_inline_script( + self::SCRIPT_HANDLE, + sprintf( 'var JETPACK_INITIAL_STATE = %s;', $initial_state ), + 'before' + ); + + wp_script_add_data( self::SCRIPT_HANDLE, 'Jetpack::InitialState::added', true ); + } + + /** + * Get the initial state. + * + * @return array + */ + public static function get_initial_state() { + + global $wp_version; + + $state = array( + 'site' => array( + 'admin_url' => esc_url_raw( admin_url() ), + 'blog_id' => Jetpack_Options::get_option( 'id', 0 ), + 'rest_nonce' => wp_create_nonce( 'wp_rest' ), + 'rest_root' => esc_url_raw( rest_url() ), + 'title' => self::get_site_title(), + 'wp_version' => $wp_version, + ), + 'user' => array( + 'current_user' => self::get_current_user_data(), + ), + ); + + /** + * Filter the initial state. + * + * @param array $state The initial state. + * @param Initial_State $instance The Initial_State instance. + */ + return apply_filters( 'jetpack_js_initial_state', $state, self::instance() ); + } + + /** + * Get the site title. + * + * @return string + */ + public static function get_site_title() { + $title = get_bloginfo( 'name' ); + + return $title ? $title : esc_url_raw( ( get_site_url() ) ); + } + + /** + * Get the current user data. + * + * @return array + */ + public static function get_current_user_data() { + $current_user = wp_get_current_user(); + + return array( + 'display_name' => $current_user->display_name, + 'id' => $current_user->ID, + ); + } +} diff --git a/projects/packages/assets/src/js/initial-state.js b/projects/packages/assets/src/js/initial-state.js new file mode 100644 index 0000000000000..8a46d298ace86 --- /dev/null +++ b/projects/packages/assets/src/js/initial-state.js @@ -0,0 +1 @@ +export * from '@automattic/jetpack-initial-state'; diff --git a/projects/packages/assets/webpack.config.js b/projects/packages/assets/webpack.config.js index df39af1d2683b..060ab597c3896 100644 --- a/projects/packages/assets/webpack.config.js +++ b/projects/packages/assets/webpack.config.js @@ -1,8 +1,33 @@ const path = require( 'path' ); const jetpackWebpackConfig = require( '@automattic/jetpack-webpack-config/webpack' ); +const sharedCOnfig = { + mode: jetpackWebpackConfig.mode, + devtool: jetpackWebpackConfig.devtool, + output: { + ...jetpackWebpackConfig.output, + path: path.resolve( './build' ), + }, + optimization: { + ...jetpackWebpackConfig.optimization, + }, + resolve: { + ...jetpackWebpackConfig.resolve, + }, + node: false, + plugins: [ ...jetpackWebpackConfig.StandardPlugins() ], + module: { + strictExportPresence: true, + rules: [ + // Transpile JavaScript, including node_modules. + jetpackWebpackConfig.TranspileRule(), + ], + }, +}; + module.exports = [ { + ...sharedCOnfig, entry: { 'i18n-loader': { import: './src/js/i18n-loader.js', @@ -12,26 +37,28 @@ module.exports = [ }, }, }, - mode: jetpackWebpackConfig.mode, - devtool: jetpackWebpackConfig.devtool, - output: { - ...jetpackWebpackConfig.output, - path: path.resolve( './build' ), - }, - optimization: { - ...jetpackWebpackConfig.optimization, - }, - resolve: { - ...jetpackWebpackConfig.resolve, - }, - node: false, - plugins: [ ...jetpackWebpackConfig.StandardPlugins() ], - module: { - strictExportPresence: true, - rules: [ - // Transpile JavaScript, including node_modules. - jetpackWebpackConfig.TranspileRule(), - ], + }, + { + ...sharedCOnfig, + entry: { + 'jetpack-initial-state': { + import: './src/js/initial-state.js', + library: { + name: 'JetpackInitialState', + type: 'umd', + }, + }, }, + plugins: [ + ...jetpackWebpackConfig.StandardPlugins( { + MiniCssExtractPlugin: { filename: '[name].css' }, + DependencyExtractionPlugin: { + requestMap: { + // We don't want to externalize this package, we rather want to bundle it. + '@automattic/jetpack-initial-state': {}, + }, + }, + } ), + ], }, ]; diff --git a/projects/packages/connection/src/class-initial-state.php b/projects/packages/connection/src/class-initial-state.php index 5d23562d91684..a7e5463bde9d5 100644 --- a/projects/packages/connection/src/class-initial-state.php +++ b/projects/packages/connection/src/class-initial-state.php @@ -39,6 +39,30 @@ private static function get_data() { ); } + /** + * Set the initial state. + * + * @param array $initial_state The initial state. + * + * @return array + */ + public static function set_initial_state( $initial_state ) { + + $status = new Status(); + + $initial_state['connection'] = array( + 'connectionStatus' => REST_Connector::connection_status( false ), + 'userConnectionData' => REST_Connector::get_user_connection_data( false ), + 'connectedPlugins' => REST_Connector::get_connection_plugins( false ), + 'siteSuffix' => $status->get_site_suffix(), + 'connectionErrors' => Error_Handler::get_instance()->get_verified_errors(), + 'isOfflineMode' => $status->is_offline_mode(), + 'calypsoEnv' => ( new Status\Host() )->get_calypso_env(), + ); + + return $initial_state; + } + /** * Render the initial state into a JavaScript variable. * diff --git a/projects/packages/connection/src/class-manager.php b/projects/packages/connection/src/class-manager.php index 3765b8779e95c..639a690fa2708 100644 --- a/projects/packages/connection/src/class-manager.php +++ b/projects/packages/connection/src/class-manager.php @@ -140,6 +140,8 @@ public static function configure() { add_action( 'deleted_user', array( $manager, 'disconnect_user_force' ), 9, 1 ); add_action( 'remove_user_from_blog', array( $manager, 'disconnect_user_force' ), 9, 1 ); + add_action( 'jetpack_js_initial_state', array( Initial_State::class, 'set_initial_state' ) ); + // Set up package version hook. add_filter( 'jetpack_package_versions', __NAMESPACE__ . '\Package_Version::send_package_version_to_tracker' ); diff --git a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts index a5101c7bab0e1..3c23fd7d0ccc8 100644 --- a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts +++ b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts @@ -1,7 +1,7 @@ import { useConnection } from '@automattic/jetpack-connection'; +import { getSiteData } from '@automattic/jetpack-initial-state'; import { getMyJetpackWindowInitialState, - getMyJetpackWindowRestState, getMyJetpackWindowConnectionState, } from '../../data/utils/get-my-jetpack-window-state'; /** @@ -24,17 +24,18 @@ interface MyJetpackConnection { } const useMyJetpackConnection = (): MyJetpackConnection => { - const { apiRoot, apiNonce } = getMyJetpackWindowRestState(); + const { rest_root, rest_nonce } = getSiteData(); + const { topJetpackMenuItemUrl, blogID } = getMyJetpackWindowInitialState(); - const connectionData = useConnection( { apiRoot, apiNonce } ); + const connectionData = useConnection( { apiRoot: rest_root, apiNonce: rest_nonce } ); const { registrationNonce } = getMyJetpackWindowConnectionState(); // Alias: https://github.com/Automattic/jetpack/blob/trunk/projects/packages/connection/src/class-rest-connector.php/#L315 const isSiteConnected = connectionData.isRegistered; return { - apiNonce, - apiRoot, + apiNonce: rest_nonce, + apiRoot: rest_root, blogID, registrationNonce, ...connectionData, diff --git a/projects/packages/my-jetpack/package.json b/projects/packages/my-jetpack/package.json index 90cbc42d35ee0..86e41b9cb124f 100644 --- a/projects/packages/my-jetpack/package.json +++ b/projects/packages/my-jetpack/package.json @@ -29,6 +29,7 @@ "@automattic/jetpack-boost-score-api": "workspace:*", "@automattic/jetpack-components": "workspace:*", "@automattic/jetpack-connection": "workspace:*", + "@automattic/jetpack-initial-state": "workspace:*", "@automattic/jetpack-licensing": "workspace:*", "@tanstack/react-query": "5.20.5", "@wordpress/api-fetch": "7.2.0", From a4e0b93a742d184350a9980eb3264e6a59800e30 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Mon, 22 Jul 2024 23:05:12 +0530 Subject: [PATCH 02/31] Make the whole class static --- projects/packages/assets/actions.php | 4 +- .../assets/src/class-initial-state.php | 55 +++++-------------- 2 files changed, 16 insertions(+), 43 deletions(-) diff --git a/projects/packages/assets/actions.php b/projects/packages/assets/actions.php index f49b973ee9246..49e747d72bbab 100644 --- a/projects/packages/assets/actions.php +++ b/projects/packages/assets/actions.php @@ -9,7 +9,7 @@ // drop data into `$wp_filter` for `WP_Hook::build_preinitialized_hooks()`. if ( function_exists( 'add_action' ) ) { add_action( 'wp_default_scripts', array( Automattic\Jetpack\Assets::class, 'wp_default_scripts_hook' ) ); - add_action( 'plugins_loaded', array( Automattic\Jetpack\Initial_State::instance(), 'configure' ), 1 ); + add_action( 'plugins_loaded', array( Automattic\Jetpack\Initial_State::class, 'configure' ), 1 ); } else { global $wp_filter; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited @@ -20,6 +20,6 @@ // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $wp_filter['plugins_loaded'][1][] = array( 'accepted_args' => 0, - 'function' => array( Automattic\Jetpack\Initial_State::instance(), 'configure' ), + 'function' => array( Automattic\Jetpack\Initial_State::class, 'configure' ), ); } diff --git a/projects/packages/assets/src/class-initial-state.php b/projects/packages/assets/src/class-initial-state.php index 46b05ca117d84..e2e85e4c1f275 100644 --- a/projects/packages/assets/src/class-initial-state.php +++ b/projects/packages/assets/src/class-initial-state.php @@ -7,8 +7,6 @@ namespace Automattic\Jetpack; -use Jetpack_Options; - /** * Class Initial State */ @@ -16,50 +14,25 @@ class Initial_State { const SCRIPT_HANDLE = 'jetpack-initial-state'; - /** - * The singleton instance of this class. - * - * @var Initial_State - */ - protected static $instance; - - /** - * Constructor. - * - * Static-only class, so nothing here. - */ - private function __construct() {} - - /** - * Get the singleton instance of the class. - * - * @return Initial_State - */ - public static function instance() { - if ( ! isset( self::$instance ) ) { - self::$instance = new Initial_State(); - } - - return self::$instance; - } - /** * Configure. */ - public function configure() { + public static function configure() { // Ensure that assets are registered on wp load, // so that when dependent scripts are enqueued, the scripts here are already registered. - add_action( 'wp_loaded', array( $this, 'register_assets' ) ); + add_action( 'wp_loaded', array( self::class, 'register_assets' ) ); // We want to render the initial state as late as possible, // so that it can be filtered when plugins want to decide whether they need to enqueue their scripts or not. - add_action( 'admin_enqueue_scripts', array( $this, 'render_initial_state' ), 999999 ); + add_action( 'admin_enqueue_scripts', array( self::class, 'render_initial_state' ), 999999 ); } /** * Register assets. + * + * @access private */ - public function register_assets() { + public static function register_assets() { if ( ! wp_script_is( self::SCRIPT_HANDLE, 'registered' ) ) { @@ -77,9 +50,11 @@ public function register_assets() { /** * Render the initial state using an inline script. * + * @access private + * * @return void */ - public function render_initial_state() { + public static function render_initial_state() { // If the initial state has already been added, don't add it again. // This can happen if this methd is called explicitly. @@ -106,14 +81,13 @@ public function render_initial_state() { * * @return array */ - public static function get_initial_state() { + protected static function get_initial_state() { global $wp_version; $state = array( 'site' => array( 'admin_url' => esc_url_raw( admin_url() ), - 'blog_id' => Jetpack_Options::get_option( 'id', 0 ), 'rest_nonce' => wp_create_nonce( 'wp_rest' ), 'rest_root' => esc_url_raw( rest_url() ), 'title' => self::get_site_title(), @@ -127,10 +101,9 @@ public static function get_initial_state() { /** * Filter the initial state. * - * @param array $state The initial state. - * @param Initial_State $instance The Initial_State instance. + * @param array $state The initial state. */ - return apply_filters( 'jetpack_js_initial_state', $state, self::instance() ); + return apply_filters( 'jetpack_js_initial_state', $state ); } /** @@ -138,7 +111,7 @@ public static function get_initial_state() { * * @return string */ - public static function get_site_title() { + protected static function get_site_title() { $title = get_bloginfo( 'name' ); return $title ? $title : esc_url_raw( ( get_site_url() ) ); @@ -149,7 +122,7 @@ public static function get_site_title() { * * @return array */ - public static function get_current_user_data() { + protected static function get_current_user_data() { $current_user = wp_get_current_user(); return array( From 2c677a3bb69a0818d9b156371d1fd57946db538e Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Mon, 22 Jul 2024 23:08:27 +0530 Subject: [PATCH 03/31] Use `in-footer` --- projects/packages/assets/src/class-initial-state.php | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/packages/assets/src/class-initial-state.php b/projects/packages/assets/src/class-initial-state.php index e2e85e4c1f275..79ea1dbac2f8e 100644 --- a/projects/packages/assets/src/class-initial-state.php +++ b/projects/packages/assets/src/class-initial-state.php @@ -41,6 +41,7 @@ public static function register_assets() { '../build/jetpack-initial-state.js', __FILE__, array( + 'in_footer' => true, 'textdomain' => 'jetpack-assets', ) ); From bb905148b53bd808180f066ab7cd2e7a72e558c9 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Mon, 22 Jul 2024 23:12:17 +0530 Subject: [PATCH 04/31] Reset my-jetpack from trunk --- pnpm-lock.yaml | 3 --- .../_inc/hooks/use-my-jetpack-connection/index.ts | 11 +++++------ projects/packages/my-jetpack/package.json | 1 - 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2d7ca38775088..ae64adcd68589 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2354,9 +2354,6 @@ importers: '@automattic/jetpack-connection': specifier: workspace:* version: link:../../js-packages/connection - '@automattic/jetpack-initial-state': - specifier: workspace:* - version: link:../../js-packages/initial-state '@automattic/jetpack-licensing': specifier: workspace:* version: link:../../js-packages/licensing diff --git a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts index 3c23fd7d0ccc8..a5101c7bab0e1 100644 --- a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts +++ b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts @@ -1,7 +1,7 @@ import { useConnection } from '@automattic/jetpack-connection'; -import { getSiteData } from '@automattic/jetpack-initial-state'; import { getMyJetpackWindowInitialState, + getMyJetpackWindowRestState, getMyJetpackWindowConnectionState, } from '../../data/utils/get-my-jetpack-window-state'; /** @@ -24,18 +24,17 @@ interface MyJetpackConnection { } const useMyJetpackConnection = (): MyJetpackConnection => { - const { rest_root, rest_nonce } = getSiteData(); - + const { apiRoot, apiNonce } = getMyJetpackWindowRestState(); const { topJetpackMenuItemUrl, blogID } = getMyJetpackWindowInitialState(); - const connectionData = useConnection( { apiRoot: rest_root, apiNonce: rest_nonce } ); + const connectionData = useConnection( { apiRoot, apiNonce } ); const { registrationNonce } = getMyJetpackWindowConnectionState(); // Alias: https://github.com/Automattic/jetpack/blob/trunk/projects/packages/connection/src/class-rest-connector.php/#L315 const isSiteConnected = connectionData.isRegistered; return { - apiNonce: rest_nonce, - apiRoot: rest_root, + apiNonce, + apiRoot, blogID, registrationNonce, ...connectionData, diff --git a/projects/packages/my-jetpack/package.json b/projects/packages/my-jetpack/package.json index 86e41b9cb124f..90cbc42d35ee0 100644 --- a/projects/packages/my-jetpack/package.json +++ b/projects/packages/my-jetpack/package.json @@ -29,7 +29,6 @@ "@automattic/jetpack-boost-score-api": "workspace:*", "@automattic/jetpack-components": "workspace:*", "@automattic/jetpack-connection": "workspace:*", - "@automattic/jetpack-initial-state": "workspace:*", "@automattic/jetpack-licensing": "workspace:*", "@tanstack/react-query": "5.20.5", "@wordpress/api-fetch": "7.2.0", From 59dc46cfb83af1eedf32d3b605f2c8649504d549 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Mon, 22 Jul 2024 23:16:04 +0530 Subject: [PATCH 05/31] Remove unnecessary checks for asset registration --- .../assets/src/class-initial-state.php | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/projects/packages/assets/src/class-initial-state.php b/projects/packages/assets/src/class-initial-state.php index 79ea1dbac2f8e..0f68e2ba5cd6c 100644 --- a/projects/packages/assets/src/class-initial-state.php +++ b/projects/packages/assets/src/class-initial-state.php @@ -34,18 +34,15 @@ public static function configure() { */ public static function register_assets() { - if ( ! wp_script_is( self::SCRIPT_HANDLE, 'registered' ) ) { - - Assets::register_script( - self::SCRIPT_HANDLE, - '../build/jetpack-initial-state.js', - __FILE__, - array( - 'in_footer' => true, - 'textdomain' => 'jetpack-assets', - ) - ); - } + Assets::register_script( + self::SCRIPT_HANDLE, + '../build/jetpack-initial-state.js', + __FILE__, + array( + 'in_footer' => true, + 'textdomain' => 'jetpack-assets', + ) + ); } /** @@ -57,12 +54,6 @@ public static function register_assets() { */ public static function render_initial_state() { - // If the initial state has already been added, don't add it again. - // This can happen if this methd is called explicitly. - if ( wp_scripts()->get_data( self::SCRIPT_HANDLE, 'Jetpack::InitialState::added' ) ) { - return; - } - $initial_state = wp_json_encode( self::get_initial_state(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE @@ -73,8 +64,6 @@ public static function render_initial_state() { sprintf( 'var JETPACK_INITIAL_STATE = %s;', $initial_state ), 'before' ); - - wp_script_add_data( self::SCRIPT_HANDLE, 'Jetpack::InitialState::added', true ); } /** From 5b0ac8a3b7a394952fc05e7a5a9acc02d35967c9 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Mon, 22 Jul 2024 23:18:08 +0530 Subject: [PATCH 06/31] Add changelog --- projects/js-packages/initial-state/CHANGELOG.md | 6 ++++++ .../initial-state/changelog/add-consolidate-initial-state | 4 ++++ .../webpack-config/changelog/add-consolidate-initial-state | 4 ++++ .../packages/assets/changelog/add-consolidate-initial-state | 4 ++++ .../connection/changelog/add-consolidate-initial-state | 4 ++++ 5 files changed, 22 insertions(+) create mode 100644 projects/js-packages/initial-state/CHANGELOG.md create mode 100644 projects/js-packages/initial-state/changelog/add-consolidate-initial-state create mode 100644 projects/js-packages/webpack-config/changelog/add-consolidate-initial-state create mode 100644 projects/packages/assets/changelog/add-consolidate-initial-state create mode 100644 projects/packages/connection/changelog/add-consolidate-initial-state diff --git a/projects/js-packages/initial-state/CHANGELOG.md b/projects/js-packages/initial-state/CHANGELOG.md new file mode 100644 index 0000000000000..03a962f457f66 --- /dev/null +++ b/projects/js-packages/initial-state/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/projects/js-packages/initial-state/changelog/add-consolidate-initial-state b/projects/js-packages/initial-state/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..6f421510aa313 --- /dev/null +++ b/projects/js-packages/initial-state/changelog/add-consolidate-initial-state @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Added jetpack-initial-state package to consolidate the logic for Initial state diff --git a/projects/js-packages/webpack-config/changelog/add-consolidate-initial-state b/projects/js-packages/webpack-config/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..6f421510aa313 --- /dev/null +++ b/projects/js-packages/webpack-config/changelog/add-consolidate-initial-state @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Added jetpack-initial-state package to consolidate the logic for Initial state diff --git a/projects/packages/assets/changelog/add-consolidate-initial-state b/projects/packages/assets/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..6f421510aa313 --- /dev/null +++ b/projects/packages/assets/changelog/add-consolidate-initial-state @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Added jetpack-initial-state package to consolidate the logic for Initial state diff --git a/projects/packages/connection/changelog/add-consolidate-initial-state b/projects/packages/connection/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..6f421510aa313 --- /dev/null +++ b/projects/packages/connection/changelog/add-consolidate-initial-state @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Added jetpack-initial-state package to consolidate the logic for Initial state From 713c90937bb94a52cae65ec38e5cef69d35ee4a7 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Mon, 22 Jul 2024 23:47:21 +0530 Subject: [PATCH 07/31] Delete .eslintrc.js --- projects/js-packages/initial-state/.eslintrc.js | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 projects/js-packages/initial-state/.eslintrc.js diff --git a/projects/js-packages/initial-state/.eslintrc.js b/projects/js-packages/initial-state/.eslintrc.js deleted file mode 100644 index 5c01a9cb70333..0000000000000 --- a/projects/js-packages/initial-state/.eslintrc.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - extends: [ require.resolve( 'jetpack-js-tools/eslintrc/base' ) ], - parserOptions: { - requireConfigFile: false, - }, -}; From ac4b37ba74aebd9b5f45bf683f1661c176cfb4dc Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Mon, 22 Jul 2024 23:47:32 +0530 Subject: [PATCH 08/31] Set type to module --- projects/js-packages/initial-state/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/js-packages/initial-state/package.json b/projects/js-packages/initial-state/package.json index f2a5296478ae7..3ff12a7e1ba00 100644 --- a/projects/js-packages/initial-state/package.json +++ b/projects/js-packages/initial-state/package.json @@ -14,6 +14,7 @@ }, "license": "GPL-2.0-or-later", "author": "Automattic", + "type": "module", "scripts": {}, "dependencies": {}, "devDependencies": {}, From d32dc2d4ab4ad7427e3831f5ea8614748bf0fb1f Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 23 Jul 2024 22:32:52 +0530 Subject: [PATCH 09/31] Fix case --- projects/packages/assets/webpack.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/packages/assets/webpack.config.js b/projects/packages/assets/webpack.config.js index 060ab597c3896..2bffb120a329e 100644 --- a/projects/packages/assets/webpack.config.js +++ b/projects/packages/assets/webpack.config.js @@ -1,7 +1,7 @@ const path = require( 'path' ); const jetpackWebpackConfig = require( '@automattic/jetpack-webpack-config/webpack' ); -const sharedCOnfig = { +const sharedConfig = { mode: jetpackWebpackConfig.mode, devtool: jetpackWebpackConfig.devtool, output: { @@ -27,7 +27,7 @@ const sharedCOnfig = { module.exports = [ { - ...sharedCOnfig, + ...sharedConfig, entry: { 'i18n-loader': { import: './src/js/i18n-loader.js', @@ -39,7 +39,7 @@ module.exports = [ }, }, { - ...sharedCOnfig, + ...sharedConfig, entry: { 'jetpack-initial-state': { import: './src/js/initial-state.js', From 1ba5b7d5e48b67a7c70b3993ac6544646ce199a9 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 23 Jul 2024 22:36:28 +0530 Subject: [PATCH 10/31] Update pnpm-lock.yaml --- pnpm-lock.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5e85dc2b38a0d..1babbe5cc94a8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,7 +4,7 @@ settings: autoInstallPeers: false excludeLinksFromLockfile: false -pnpmfileChecksum: bjkzupj7mgxhpr4jv54264ts6e +pnpmfileChecksum: hogs2xjgnkyiea7znn3abfx4o4 importers: @@ -1591,6 +1591,9 @@ importers: '@automattic/jetpack-initial-state': specifier: workspace:* version: link:../../js-packages/initial-state + react: + specifier: 18.3.1 + version: 18.3.1 devDependencies: '@automattic/jetpack-webpack-config': specifier: workspace:* @@ -2354,6 +2357,9 @@ importers: '@automattic/jetpack-connection': specifier: workspace:* version: link:../../js-packages/connection + '@automattic/jetpack-explat': + specifier: workspace:* + version: link:../explat '@automattic/jetpack-licensing': specifier: workspace:* version: link:../../js-packages/licensing From 436c43636dc59f2303da8df7659e2041ee9201a5 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 25 Jul 2024 10:53:16 +0530 Subject: [PATCH 11/31] Silence filemtime warning --- projects/packages/assets/src/class-assets.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/packages/assets/src/class-assets.php b/projects/packages/assets/src/class-assets.php index d06fa6a144816..303c9459282d7 100644 --- a/projects/packages/assets/src/class-assets.php +++ b/projects/packages/assets/src/class-assets.php @@ -379,7 +379,8 @@ function ( $d ) { ); $ver = $options['version'] ?? $asset['version']; } else { - $ver = $options['version'] ?? filemtime( "$dir/$path" ); + // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged + $ver = $options['version'] ?? @filemtime( "$dir/$path" ); } if ( $options['async'] && '' === $options['strategy'] ) { // Handle the deprecated `async` option From 7acde2b9398ed842b02f96a427549f3474bcd137 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 26 Jul 2024 12:24:52 +0530 Subject: [PATCH 12/31] Use print_scripts hook instead of enqueue_scripts to render initial state --- projects/packages/assets/src/class-initial-state.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/packages/assets/src/class-initial-state.php b/projects/packages/assets/src/class-initial-state.php index 0f68e2ba5cd6c..4e88555355486 100644 --- a/projects/packages/assets/src/class-initial-state.php +++ b/projects/packages/assets/src/class-initial-state.php @@ -22,9 +22,10 @@ public static function configure() { // so that when dependent scripts are enqueued, the scripts here are already registered. add_action( 'wp_loaded', array( self::class, 'register_assets' ) ); - // We want to render the initial state as late as possible, - // so that it can be filtered when plugins want to decide whether they need to enqueue their scripts or not. - add_action( 'admin_enqueue_scripts', array( self::class, 'render_initial_state' ), 999999 ); + // We want to render the initial state on print + // so that the hook callbacks have enough time and information + // to decide whether to update the initial state or not. + add_action( 'admin_print_scripts', array( self::class, 'render_initial_state' ), 1 ); } /** From 14a1cd64e6d8ce3421633c6eec59f9305e01705e Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 26 Jul 2024 12:25:52 +0530 Subject: [PATCH 13/31] Reset changes in connection package --- .../connection/src/class-initial-state.php | 24 ------------------- .../packages/connection/src/class-manager.php | 2 -- 2 files changed, 26 deletions(-) diff --git a/projects/packages/connection/src/class-initial-state.php b/projects/packages/connection/src/class-initial-state.php index a7e5463bde9d5..5d23562d91684 100644 --- a/projects/packages/connection/src/class-initial-state.php +++ b/projects/packages/connection/src/class-initial-state.php @@ -39,30 +39,6 @@ private static function get_data() { ); } - /** - * Set the initial state. - * - * @param array $initial_state The initial state. - * - * @return array - */ - public static function set_initial_state( $initial_state ) { - - $status = new Status(); - - $initial_state['connection'] = array( - 'connectionStatus' => REST_Connector::connection_status( false ), - 'userConnectionData' => REST_Connector::get_user_connection_data( false ), - 'connectedPlugins' => REST_Connector::get_connection_plugins( false ), - 'siteSuffix' => $status->get_site_suffix(), - 'connectionErrors' => Error_Handler::get_instance()->get_verified_errors(), - 'isOfflineMode' => $status->is_offline_mode(), - 'calypsoEnv' => ( new Status\Host() )->get_calypso_env(), - ); - - return $initial_state; - } - /** * Render the initial state into a JavaScript variable. * diff --git a/projects/packages/connection/src/class-manager.php b/projects/packages/connection/src/class-manager.php index 639a690fa2708..3765b8779e95c 100644 --- a/projects/packages/connection/src/class-manager.php +++ b/projects/packages/connection/src/class-manager.php @@ -140,8 +140,6 @@ public static function configure() { add_action( 'deleted_user', array( $manager, 'disconnect_user_force' ), 9, 1 ); add_action( 'remove_user_from_blog', array( $manager, 'disconnect_user_force' ), 9, 1 ); - add_action( 'jetpack_js_initial_state', array( Initial_State::class, 'set_initial_state' ) ); - // Set up package version hook. add_filter( 'jetpack_package_versions', __NAMESPACE__ . '\Package_Version::send_package_version_to_tracker' ); From 745918a526474940137ff45912f5d3b660d2b6f1 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 26 Jul 2024 14:25:14 +0530 Subject: [PATCH 14/31] Have separate filters for admin and public scripts --- .../assets/src/class-initial-state.php | 64 +++++++++++++++---- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/projects/packages/assets/src/class-initial-state.php b/projects/packages/assets/src/class-initial-state.php index 4e88555355486..8d996cc79a345 100644 --- a/projects/packages/assets/src/class-initial-state.php +++ b/projects/packages/assets/src/class-initial-state.php @@ -18,14 +18,26 @@ class Initial_State { * Configure. */ public static function configure() { - // Ensure that assets are registered on wp load, - // so that when dependent scripts are enqueued, the scripts here are already registered. + /** + * Ensure that assets are registered on wp_loaded, + * which is fired before *_enqueue_scripts actions. + * It means that when the dependent scripts are registered, + * the scripts here are already registered. + */ add_action( 'wp_loaded', array( self::class, 'register_assets' ) ); - // We want to render the initial state on print - // so that the hook callbacks have enough time and information - // to decide whether to update the initial state or not. - add_action( 'admin_print_scripts', array( self::class, 'render_initial_state' ), 1 ); + /** + * Notes: + * 1. wp_print_scripts action is fired on both admin and public pages. + * On admin pages, it's fired before admin_enqueue_scripts action, + * which can be a problem if the consumer package uses admin_enqueue_scripts + * to hook into the initial state. Thus, we prefer to use admin_print_scripts on admin pages. + * 2. We want to render the initial state on print, instead of init or enqueue actions, + * so that the hook callbacks have enough time and information + * to decide whether to update the initial state or not. + */ + $hook = is_admin() ? 'admin_print_scripts' : 'wp_print_scripts'; + add_action( $hook, array( self::class, 'render_initial_state' ), 1 ); } /** @@ -55,8 +67,10 @@ public static function register_assets() { */ public static function render_initial_state() { + $initial_state = is_admin() ? self::get_admin_initial_state() : self::get_public_initial_state(); + $initial_state = wp_json_encode( - self::get_initial_state(), + $initial_state, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE ); @@ -68,11 +82,11 @@ public static function render_initial_state() { } /** - * Get the initial state. + * Get the admin initial state. * * @return array */ - protected static function get_initial_state() { + protected static function get_admin_initial_state() { global $wp_version; @@ -90,11 +104,39 @@ protected static function get_initial_state() { ); /** - * Filter the initial state. + * Filter the admin initial state. + * + * When using this filter, ensure that the data is added only if it is used by some script. + * This filter may be called on almost every admin page load. So, one should check if the data is needed/used on that page. + * For example, the social (publicize) data is used only on Social admin page, Jetpack settings page and the post editor. + * So, the social data should be added only on those pages. + * + * @param array $state The initial state. + */ + return apply_filters( 'jetpack_admin_js_initial_state', $state ); + } + + /** + * Get the admin initial state. + * + * @return array + */ + protected static function get_public_initial_state() { + + $state = array( + 'site' => array( + 'title' => self::get_site_title(), + ), + ); + + /** + * Filter the public initial state. + * + * See the docs for `jetpack_admin_js_initial_state` filter for more information. * * @param array $state The initial state. */ - return apply_filters( 'jetpack_js_initial_state', $state ); + return apply_filters( 'jetpack_public_js_initial_state', $state ); } /** From 066270ebe5d8f24d418a709ca5ffeef0c12ff7e8 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Mon, 29 Jul 2024 17:38:05 +0530 Subject: [PATCH 15/31] Add more common fields and update types --- .../js-packages/initial-state/src/types.ts | 28 +++++++++++++-- .../js-packages/initial-state/src/utils.ts | 24 +++++++++++-- .../assets/src/class-initial-state.php | 36 ++++++++++++++++--- 3 files changed, 78 insertions(+), 10 deletions(-) diff --git a/projects/js-packages/initial-state/src/types.ts b/projects/js-packages/initial-state/src/types.ts index e0426e7684b47..43c4069bdf8d3 100644 --- a/projects/js-packages/initial-state/src/types.ts +++ b/projects/js-packages/initial-state/src/types.ts @@ -1,11 +1,33 @@ -export interface SiteData { - admin_url: string; +export interface SitePlan { + product_slug: string; + features?: { + active: Array< string >; + available?: Record< string, Array< string > >; + }; +} + +export interface WPCOMSiteData { blog_id: number; +} + +export interface PublicSiteData { + icon: string; + title: string; +} + +export interface AdminSiteData { + admin_url: string; + date_format: string; + is_multisite: boolean; + plan: SitePlan; rest_nonce: string; rest_root: string; - title: string; + wp_version: string; + wpcom: WPCOMSiteData; } +export interface SiteData extends PublicSiteData, Partial< AdminSiteData > {} + export interface CurrentUserData { id: number; display_name: string; diff --git a/projects/js-packages/initial-state/src/utils.ts b/projects/js-packages/initial-state/src/utils.ts index 1cccab8b4f568..751083bdb80f7 100644 --- a/projects/js-packages/initial-state/src/utils.ts +++ b/projects/js-packages/initial-state/src/utils.ts @@ -19,7 +19,7 @@ export function getSiteData() { /** * Get the admin URL from the initial state. * - * @param {string} [path] - The path to append to the admin URL. + * @param {string} [path] - The path to append to the admin URL. e.g. `admin.php?page=jetpack`. * * @returns {string} The admin URL. */ @@ -27,13 +27,33 @@ export function getAdminUrl( path = '' ) { return `${ getInitialState().site.admin_url }${ path }`; } +/** + * Get the url for the Jetpack admin page. + * + * @param {string} [section] - The section to append to the My Jetpack URL. e.g. `#/settings`. + * + * @returns {string} The Jetpack admin page URL. + */ +export function getJetpackAdminPageUrl( section = '' ) { + return getAdminUrl( `admin.php?page=jetpack${ section }` ); +} + /** * Get the url for the My Jetpack page. * - * @param {string} [section] - The section to append to the My Jetpack URL. + * @param {string} [section] - The section to append to the My Jetpack URL. e.g. `#/connection`. * * @returns {string} The My Jetpack URL. */ export function getMyJetpackUrl( section = '' ) { return getAdminUrl( `admin.php?page=my-jetpack${ section }` ); } + +/** + * Get the current user data from the initial state. + * + * @returns {import('./types').SitePlan['features']['active']} The active features. + */ +export function getActiveFeatures() { + return getInitialState().site.plan?.features?.active ?? []; +} diff --git a/projects/packages/assets/src/class-initial-state.php b/projects/packages/assets/src/class-initial-state.php index 8d996cc79a345..9e3ddecfb0070 100644 --- a/projects/packages/assets/src/class-initial-state.php +++ b/projects/packages/assets/src/class-initial-state.php @@ -92,11 +92,23 @@ protected static function get_admin_initial_state() { $state = array( 'site' => array( - 'admin_url' => esc_url_raw( admin_url() ), - 'rest_nonce' => wp_create_nonce( 'wp_rest' ), - 'rest_root' => esc_url_raw( rest_url() ), - 'title' => self::get_site_title(), - 'wp_version' => $wp_version, + 'admin_url' => esc_url_raw( admin_url() ), + 'date_format' => get_option( 'date_format' ), + 'icon' => self::get_site_icon(), + 'is_multisite' => is_multisite(), + 'plan' => array( + // The properties here should be updated by the consumer package/plugin. + // It includes properties like 'product_slug', 'features', etc. + 'product_slug' => '', + ), + 'rest_nonce' => wp_create_nonce( 'wp_rest' ), + 'rest_root' => esc_url_raw( rest_url() ), + 'title' => self::get_site_title(), + 'wp_version' => $wp_version, + 'wpcom' => array( + // This should contain the connected site details like blog_id, is_atomic etc. + 'blog_id' => 0, + ), ), 'user' => array( 'current_user' => self::get_current_user_data(), @@ -125,6 +137,7 @@ protected static function get_public_initial_state() { $state = array( 'site' => array( + 'icon' => self::get_site_icon(), 'title' => self::get_site_title(), ), ); @@ -150,6 +163,19 @@ protected static function get_site_title() { return $title ? $title : esc_url_raw( ( get_site_url() ) ); } + /** + * Get the site icon. + * + * @return string + */ + protected static function get_site_icon() { + if ( ! has_site_icon() ) { + return ''; + } + + return apply_filters( 'jetpack_photon_url', get_site_icon_url(), array( 'w' => 64 ) ); + } + /** * Get the current user data. * From aadfeb3d8a5985e899948448466455de48a7f88f Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 30 Jul 2024 11:42:28 +0530 Subject: [PATCH 16/31] Fix up versions --- projects/js-packages/initial-state/package.json | 2 +- projects/js-packages/webpack-config/package.json | 2 +- projects/packages/assets/composer.json | 2 +- projects/packages/connection/composer.json | 2 +- .../packages/connection/src/class-package-version.php | 2 +- .../changelog/add-consolidate-initial-state | 5 +++++ .../plugins/automattic-for-agencies-client/composer.lock | 8 ++++---- .../backup/changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/backup/composer.lock | 8 ++++---- .../plugins/boost/changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/boost/composer.lock | 8 ++++---- .../changelog/add-consolidate-initial-state | 5 +++++ .../plugins/classic-theme-helper-plugin/composer.lock | 4 ++-- .../plugins/crm/changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/crm/composer.lock | 4 ++-- .../inspect/changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/inspect/composer.lock | 8 ++++---- .../jetpack/changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/jetpack/composer.lock | 8 ++++---- .../migration/changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/migration/composer.lock | 8 ++++---- .../changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/mu-wpcom-plugin/composer.lock | 8 ++++---- .../protect/changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/protect/composer.lock | 8 ++++---- .../search/changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/search/composer.lock | 8 ++++---- .../social/changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/social/composer.lock | 8 ++++---- .../changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/starter-plugin/composer.lock | 8 ++++---- .../videopress/changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/videopress/composer.lock | 8 ++++---- .../wpcomsh/changelog/add-consolidate-initial-state | 5 +++++ projects/plugins/wpcomsh/composer.lock | 8 ++++---- 35 files changed, 136 insertions(+), 61 deletions(-) create mode 100644 projects/plugins/automattic-for-agencies-client/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/backup/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/boost/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/classic-theme-helper-plugin/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/crm/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/inspect/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/jetpack/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/migration/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/mu-wpcom-plugin/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/protect/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/search/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/social/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/starter-plugin/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/videopress/changelog/add-consolidate-initial-state create mode 100644 projects/plugins/wpcomsh/changelog/add-consolidate-initial-state diff --git a/projects/js-packages/initial-state/package.json b/projects/js-packages/initial-state/package.json index 3ff12a7e1ba00..3cbddf624d3f7 100644 --- a/projects/js-packages/initial-state/package.json +++ b/projects/js-packages/initial-state/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-initial-state", - "version": "0.0.1", + "version": "0.1.0-alpha", "description": "A library to provide initial state and the corresponding utility functions for Jetpack.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/initial-state/#readme", "bugs": { diff --git a/projects/js-packages/webpack-config/package.json b/projects/js-packages/webpack-config/package.json index a2dda6f8efa4f..320134eae4321 100644 --- a/projects/js-packages/webpack-config/package.json +++ b/projects/js-packages/webpack-config/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-webpack-config", - "version": "3.2.11", + "version": "3.3.0-alpha", "description": "Library of pieces for webpack config in Jetpack projects.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/webpack-config/#readme", "bugs": { diff --git a/projects/packages/assets/composer.json b/projects/packages/assets/composer.json index 57987fec7a97a..ddd58c954f41f 100644 --- a/projects/packages/assets/composer.json +++ b/projects/packages/assets/composer.json @@ -60,7 +60,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } } } diff --git a/projects/packages/connection/composer.json b/projects/packages/connection/composer.json index b820e1b799a7a..78d4bb88cfcef 100644 --- a/projects/packages/connection/composer.json +++ b/projects/packages/connection/composer.json @@ -70,7 +70,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/packages/connection/src/class-package-version.php b/projects/packages/connection/src/class-package-version.php index 9662160145401..274689d8be36c 100644 --- a/projects/packages/connection/src/class-package-version.php +++ b/projects/packages/connection/src/class-package-version.php @@ -12,7 +12,7 @@ */ class Package_Version { - const PACKAGE_VERSION = '2.11.2'; + const PACKAGE_VERSION = '2.12.0-alpha'; const PACKAGE_SLUG = 'connection'; diff --git a/projects/plugins/automattic-for-agencies-client/changelog/add-consolidate-initial-state b/projects/plugins/automattic-for-agencies-client/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/automattic-for-agencies-client/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/automattic-for-agencies-client/composer.lock b/projects/plugins/automattic-for-agencies-client/composer.lock index 3f8db4e218e78..0cf9fc83d4d05 100644 --- a/projects/plugins/automattic-for-agencies-client/composer.lock +++ b/projects/plugins/automattic-for-agencies-client/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -383,7 +383,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -418,7 +418,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/backup/changelog/add-consolidate-initial-state b/projects/plugins/backup/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/backup/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/backup/composer.lock b/projects/plugins/backup/composer.lock index 2774dcc20ff67..9a04314fc5d42 100644 --- a/projects/plugins/backup/composer.lock +++ b/projects/plugins/backup/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -665,7 +665,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -700,7 +700,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/boost/changelog/add-consolidate-initial-state b/projects/plugins/boost/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/boost/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/boost/composer.lock b/projects/plugins/boost/composer.lock index b83adb234cf08..911a04699e40d 100644 --- a/projects/plugins/boost/composer.lock +++ b/projects/plugins/boost/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -521,7 +521,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -556,7 +556,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/classic-theme-helper-plugin/changelog/add-consolidate-initial-state b/projects/plugins/classic-theme-helper-plugin/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/classic-theme-helper-plugin/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/classic-theme-helper-plugin/composer.lock b/projects/plugins/classic-theme-helper-plugin/composer.lock index 2a1362a0fad1e..b9980c22802c7 100644 --- a/projects/plugins/classic-theme-helper-plugin/composer.lock +++ b/projects/plugins/classic-theme-helper-plugin/composer.lock @@ -62,7 +62,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -86,7 +86,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { diff --git a/projects/plugins/crm/changelog/add-consolidate-initial-state b/projects/plugins/crm/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/crm/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/crm/composer.lock b/projects/plugins/crm/composer.lock index 5f341c00431b5..044ad5fb853b3 100644 --- a/projects/plugins/crm/composer.lock +++ b/projects/plugins/crm/composer.lock @@ -12,7 +12,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -36,7 +36,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { diff --git a/projects/plugins/inspect/changelog/add-consolidate-initial-state b/projects/plugins/inspect/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/inspect/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/inspect/composer.lock b/projects/plugins/inspect/composer.lock index 9aa6b5c472609..3b5a3e68c9d94 100644 --- a/projects/plugins/inspect/composer.lock +++ b/projects/plugins/inspect/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -383,7 +383,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -418,7 +418,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/jetpack/changelog/add-consolidate-initial-state b/projects/plugins/jetpack/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..a1c1831fa1ef7 --- /dev/null +++ b/projects/plugins/jetpack/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Updated composer.lock. + + diff --git a/projects/plugins/jetpack/composer.lock b/projects/plugins/jetpack/composer.lock index 1f63a75ddbc1e..4284736b3c3ec 100644 --- a/projects/plugins/jetpack/composer.lock +++ b/projects/plugins/jetpack/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -907,7 +907,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -942,7 +942,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/migration/changelog/add-consolidate-initial-state b/projects/plugins/migration/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/migration/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/migration/composer.lock b/projects/plugins/migration/composer.lock index 4f5f0620f5232..cfa8b00ee64cb 100644 --- a/projects/plugins/migration/composer.lock +++ b/projects/plugins/migration/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -665,7 +665,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -700,7 +700,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/mu-wpcom-plugin/changelog/add-consolidate-initial-state b/projects/plugins/mu-wpcom-plugin/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/mu-wpcom-plugin/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/mu-wpcom-plugin/composer.lock b/projects/plugins/mu-wpcom-plugin/composer.lock index eb52a1a568894..1a31effafd1f7 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.lock +++ b/projects/plugins/mu-wpcom-plugin/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -494,7 +494,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -529,7 +529,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/protect/changelog/add-consolidate-initial-state b/projects/plugins/protect/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/protect/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/protect/composer.lock b/projects/plugins/protect/composer.lock index 581a49cbfeb2f..cd542b33b1c9f 100644 --- a/projects/plugins/protect/composer.lock +++ b/projects/plugins/protect/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -578,7 +578,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -613,7 +613,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/search/changelog/add-consolidate-initial-state b/projects/plugins/search/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/search/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/search/composer.lock b/projects/plugins/search/composer.lock index 235f86dbb59d5..7dee110fda961 100644 --- a/projects/plugins/search/composer.lock +++ b/projects/plugins/search/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -521,7 +521,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -556,7 +556,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/social/changelog/add-consolidate-initial-state b/projects/plugins/social/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/social/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/social/composer.lock b/projects/plugins/social/composer.lock index 5ee5a4db55302..439ad201839c9 100644 --- a/projects/plugins/social/composer.lock +++ b/projects/plugins/social/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -521,7 +521,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -556,7 +556,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/starter-plugin/changelog/add-consolidate-initial-state b/projects/plugins/starter-plugin/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/starter-plugin/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/starter-plugin/composer.lock b/projects/plugins/starter-plugin/composer.lock index 7997e296902c6..6d400e15ba8d2 100644 --- a/projects/plugins/starter-plugin/composer.lock +++ b/projects/plugins/starter-plugin/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -521,7 +521,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -556,7 +556,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/videopress/changelog/add-consolidate-initial-state b/projects/plugins/videopress/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/videopress/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/videopress/composer.lock b/projects/plugins/videopress/composer.lock index 919b97236bb86..6801afb5d5911 100644 --- a/projects/plugins/videopress/composer.lock +++ b/projects/plugins/videopress/composer.lock @@ -124,7 +124,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -521,7 +521,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -556,7 +556,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/wpcomsh/changelog/add-consolidate-initial-state b/projects/plugins/wpcomsh/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/add-consolidate-initial-state @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/wpcomsh/composer.lock b/projects/plugins/wpcomsh/composer.lock index 9aee4e3f31fc6..7666946d89676 100644 --- a/projects/plugins/wpcomsh/composer.lock +++ b/projects/plugins/wpcomsh/composer.lock @@ -189,7 +189,7 @@ "dist": { "type": "path", "url": "../../packages/assets", - "reference": "f5fd9602849fa481571e1bb6c46b3460dad33095" + "reference": "9a9e8b6703e074750408f276c14011262b388ddc" }, "require": { "automattic/jetpack-constants": "@dev", @@ -213,7 +213,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.2.x-dev" + "dev-trunk": "2.3.x-dev" } }, "autoload": { @@ -631,7 +631,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "6d990be4aaded35f3ee203c976d16b9334419882" + "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -666,7 +666,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" }, "dependencies": { "test-only": [ From 948e8ff3c3d03d2bb3a0505161589dfab371ba85 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 30 Jul 2024 12:02:30 +0530 Subject: [PATCH 17/31] Create .gitkeep --- projects/js-packages/initial-state/changelog/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 projects/js-packages/initial-state/changelog/.gitkeep diff --git a/projects/js-packages/initial-state/changelog/.gitkeep b/projects/js-packages/initial-state/changelog/.gitkeep new file mode 100644 index 0000000000000..e69de29bb2d1d From 29daeafcdb8e8e3791337acf321ea82763a429b6 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 30 Jul 2024 16:20:35 +0530 Subject: [PATCH 18/31] Fix up versions --- projects/js-packages/ai-client/package.json | 2 +- projects/js-packages/publicize-components/package.json | 2 +- projects/packages/jetpack-mu-wpcom/composer.json | 2 +- projects/packages/jetpack-mu-wpcom/package.json | 2 +- .../packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php | 2 +- projects/packages/my-jetpack/package.json | 2 +- projects/packages/my-jetpack/src/class-initializer.php | 2 +- projects/packages/videopress/package.json | 2 +- projects/packages/videopress/src/class-package-version.php | 2 +- .../changelog/add-consolidate-initial-state#2 | 5 +++++ projects/plugins/mu-wpcom-plugin/composer.json | 2 +- projects/plugins/mu-wpcom-plugin/composer.lock | 4 ++-- projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php | 2 +- projects/plugins/mu-wpcom-plugin/package.json | 2 +- .../wpcomsh/changelog/add-consolidate-initial-state#2 | 5 +++++ projects/plugins/wpcomsh/composer.json | 2 +- projects/plugins/wpcomsh/composer.lock | 4 ++-- projects/plugins/wpcomsh/package.json | 2 +- projects/plugins/wpcomsh/wpcomsh.php | 4 ++-- 19 files changed, 30 insertions(+), 20 deletions(-) create mode 100644 projects/plugins/mu-wpcom-plugin/changelog/add-consolidate-initial-state#2 create mode 100644 projects/plugins/wpcomsh/changelog/add-consolidate-initial-state#2 diff --git a/projects/js-packages/ai-client/package.json b/projects/js-packages/ai-client/package.json index d4670009a0f77..e81446ecdc71f 100644 --- a/projects/js-packages/ai-client/package.json +++ b/projects/js-packages/ai-client/package.json @@ -1,7 +1,7 @@ { "private": false, "name": "@automattic/jetpack-ai-client", - "version": "0.16.0", + "version": "0.16.1-alpha", "description": "A JS client for consuming Jetpack AI services", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/ai-client/#readme", "bugs": { diff --git a/projects/js-packages/publicize-components/package.json b/projects/js-packages/publicize-components/package.json index cb05fc7f83773..1897a5481b46d 100644 --- a/projects/js-packages/publicize-components/package.json +++ b/projects/js-packages/publicize-components/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-publicize-components", - "version": "0.57.0", + "version": "0.58.0-alpha", "description": "A library of JS components required by the Publicize editor plugin", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/publicize-components/#readme", "bugs": { diff --git a/projects/packages/jetpack-mu-wpcom/composer.json b/projects/packages/jetpack-mu-wpcom/composer.json index 04b4ff41f807f..14e966c6f40de 100644 --- a/projects/packages/jetpack-mu-wpcom/composer.json +++ b/projects/packages/jetpack-mu-wpcom/composer.json @@ -62,7 +62,7 @@ }, "autotagger": true, "branch-alias": { - "dev-trunk": "5.51.x-dev" + "dev-trunk": "5.52.x-dev" }, "textdomain": "jetpack-mu-wpcom", "version-constants": { diff --git a/projects/packages/jetpack-mu-wpcom/package.json b/projects/packages/jetpack-mu-wpcom/package.json index 45b0d1f3f8e20..396f76c697818 100644 --- a/projects/packages/jetpack-mu-wpcom/package.json +++ b/projects/packages/jetpack-mu-wpcom/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-mu-wpcom", - "version": "5.51.0", + "version": "5.52.0-alpha", "description": "Enhances your site with features powered by WordPress.com", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/jetpack-mu-wpcom/#readme", "bugs": { diff --git a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php index 151d0c59e86e6..2c4cc857e3ebf 100644 --- a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php +++ b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php @@ -13,7 +13,7 @@ * Jetpack_Mu_Wpcom main class. */ class Jetpack_Mu_Wpcom { - const PACKAGE_VERSION = '5.51.0'; + const PACKAGE_VERSION = '5.52.0-alpha'; const PKG_DIR = __DIR__ . '/../'; const BASE_DIR = __DIR__ . '/'; const BASE_FILE = __FILE__; diff --git a/projects/packages/my-jetpack/package.json b/projects/packages/my-jetpack/package.json index c18a50e1b0c88..88f9043204d4f 100644 --- a/projects/packages/my-jetpack/package.json +++ b/projects/packages/my-jetpack/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-my-jetpack", - "version": "4.30.0", + "version": "4.30.1-alpha", "description": "WP Admin page with information and configuration shared among all Jetpack stand-alone plugins", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/my-jetpack/#readme", "bugs": { diff --git a/projects/packages/my-jetpack/src/class-initializer.php b/projects/packages/my-jetpack/src/class-initializer.php index 20ef06cc7a4d8..13634e2addae2 100644 --- a/projects/packages/my-jetpack/src/class-initializer.php +++ b/projects/packages/my-jetpack/src/class-initializer.php @@ -41,7 +41,7 @@ class Initializer { * * @var string */ - const PACKAGE_VERSION = '4.30.0'; + const PACKAGE_VERSION = '4.30.1-alpha'; /** * HTML container ID for the IDC screen on My Jetpack page. diff --git a/projects/packages/videopress/package.json b/projects/packages/videopress/package.json index a886678761c8e..a7661afe049af 100644 --- a/projects/packages/videopress/package.json +++ b/projects/packages/videopress/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-videopress", - "version": "0.23.29", + "version": "0.23.30-alpha", "description": "VideoPress package", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/videopress/#readme", "bugs": { diff --git a/projects/packages/videopress/src/class-package-version.php b/projects/packages/videopress/src/class-package-version.php index d89bada217daf..16629ed952118 100644 --- a/projects/packages/videopress/src/class-package-version.php +++ b/projects/packages/videopress/src/class-package-version.php @@ -11,7 +11,7 @@ * The Package_Version class. */ class Package_Version { - const PACKAGE_VERSION = '0.23.29'; + const PACKAGE_VERSION = '0.23.30-alpha'; const PACKAGE_SLUG = 'videopress'; diff --git a/projects/plugins/mu-wpcom-plugin/changelog/add-consolidate-initial-state#2 b/projects/plugins/mu-wpcom-plugin/changelog/add-consolidate-initial-state#2 new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/mu-wpcom-plugin/changelog/add-consolidate-initial-state#2 @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/mu-wpcom-plugin/composer.json b/projects/plugins/mu-wpcom-plugin/composer.json index 6508004317ec5..284b15ddddcdd 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.json +++ b/projects/plugins/mu-wpcom-plugin/composer.json @@ -46,6 +46,6 @@ ] }, "config": { - "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_5_2" + "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_5_3_alpha" } } diff --git a/projects/plugins/mu-wpcom-plugin/composer.lock b/projects/plugins/mu-wpcom-plugin/composer.lock index 1a31effafd1f7..a49bf64fbe9b3 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.lock +++ b/projects/plugins/mu-wpcom-plugin/composer.lock @@ -1005,7 +1005,7 @@ "dist": { "type": "path", "url": "../../packages/jetpack-mu-wpcom", - "reference": "2827550808c6c48c4760c787ce52592d9012059e" + "reference": "a9ffd2d847bb68899b38f0b6916a33e917fe2c90" }, "require": { "automattic/jetpack-assets": "@dev", @@ -1039,7 +1039,7 @@ }, "autotagger": true, "branch-alias": { - "dev-trunk": "5.51.x-dev" + "dev-trunk": "5.52.x-dev" }, "textdomain": "jetpack-mu-wpcom", "version-constants": { diff --git a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php index 43dc9301cb7cd..60fd1f098ca8e 100644 --- a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php +++ b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php @@ -3,7 +3,7 @@ * * Plugin Name: WordPress.com Features * Description: Test plugin for the jetpack-mu-wpcom package - * Version: 2.5.2 + * Version: 2.5.3-alpha * Author: Automattic * License: GPLv2 or later * Text Domain: jetpack-mu-wpcom-plugin diff --git a/projects/plugins/mu-wpcom-plugin/package.json b/projects/plugins/mu-wpcom-plugin/package.json index 527941b01f3c4..fdab5b4842b9f 100644 --- a/projects/plugins/mu-wpcom-plugin/package.json +++ b/projects/plugins/mu-wpcom-plugin/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-mu-wpcom-plugin", - "version": "2.5.2", + "version": "2.5.3-alpha", "description": "Test plugin for the jetpack-mu-wpcom package", "homepage": "https://jetpack.com", "bugs": { diff --git a/projects/plugins/wpcomsh/changelog/add-consolidate-initial-state#2 b/projects/plugins/wpcomsh/changelog/add-consolidate-initial-state#2 new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/add-consolidate-initial-state#2 @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/wpcomsh/composer.json b/projects/plugins/wpcomsh/composer.json index b2a1a96dcd4a8..2f905ff13f9a1 100644 --- a/projects/plugins/wpcomsh/composer.json +++ b/projects/plugins/wpcomsh/composer.json @@ -128,7 +128,7 @@ "composer/installers": true, "roots/wordpress-core-installer": true }, - "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ5_1_0" + "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ5_1_1_alpha" }, "extra": { "mirror-repo": "Automattic/wpcom-site-helper", diff --git a/projects/plugins/wpcomsh/composer.lock b/projects/plugins/wpcomsh/composer.lock index 7666946d89676..b3fd5e95760f4 100644 --- a/projects/plugins/wpcomsh/composer.lock +++ b/projects/plugins/wpcomsh/composer.lock @@ -1142,7 +1142,7 @@ "dist": { "type": "path", "url": "../../packages/jetpack-mu-wpcom", - "reference": "2827550808c6c48c4760c787ce52592d9012059e" + "reference": "a9ffd2d847bb68899b38f0b6916a33e917fe2c90" }, "require": { "automattic/jetpack-assets": "@dev", @@ -1176,7 +1176,7 @@ }, "autotagger": true, "branch-alias": { - "dev-trunk": "5.51.x-dev" + "dev-trunk": "5.52.x-dev" }, "textdomain": "jetpack-mu-wpcom", "version-constants": { diff --git a/projects/plugins/wpcomsh/package.json b/projects/plugins/wpcomsh/package.json index d45d9ea27a76f..2c7064c1ad0c4 100644 --- a/projects/plugins/wpcomsh/package.json +++ b/projects/plugins/wpcomsh/package.json @@ -3,7 +3,7 @@ "name": "@automattic/jetpack-wpcomsh", "description": "A helper for connecting WordPress.com sites to external host infrastructure.", "homepage": "https://jetpack.com", - "version": "5.1.0", + "version": "5.1.1-alpha", "bugs": { "url": "https://github.com/Automattic/jetpack/labels/[Plugin] Wpcomsh" }, diff --git a/projects/plugins/wpcomsh/wpcomsh.php b/projects/plugins/wpcomsh/wpcomsh.php index 2b99c9570789e..6f6d12ba4197b 100644 --- a/projects/plugins/wpcomsh/wpcomsh.php +++ b/projects/plugins/wpcomsh/wpcomsh.php @@ -2,14 +2,14 @@ /** * Plugin Name: WordPress.com Site Helper * Description: A helper for connecting WordPress.com sites to external host infrastructure. - * Version: 5.1.0 + * Version: 5.1.1-alpha * Author: Automattic * Author URI: http://automattic.com/ * * @package wpcomsh */ -define( 'WPCOMSH_VERSION', '5.1.0' ); +define( 'WPCOMSH_VERSION', '5.1.1-alpha' ); // If true, Typekit fonts will be available in addition to Google fonts add_filter( 'jetpack_fonts_enable_typekit', '__return_true' ); From 7a0834f644b6c6ee1ab86d0cd1509f02ba03bcf7 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 30 Jul 2024 16:34:21 +0530 Subject: [PATCH 19/31] Reset messed up versions --- .../connection/changelog/add-consolidate-initial-state | 4 ---- projects/packages/connection/composer.json | 2 +- projects/packages/connection/src/class-package-version.php | 2 +- .../plugins/automattic-for-agencies-client/composer.lock | 4 ++-- .../changelog/add-consolidate-initial-state#2 | 0 projects/plugins/backup/composer.lock | 4 ++-- projects/plugins/boost/composer.lock | 4 ++-- projects/plugins/inspect/composer.lock | 4 ++-- projects/plugins/jetpack/composer.lock | 4 ++-- projects/plugins/migration/composer.lock | 4 ++-- projects/plugins/mu-wpcom-plugin/composer.lock | 4 ++-- projects/plugins/protect/composer.lock | 4 ++-- projects/plugins/search/composer.lock | 4 ++-- projects/plugins/social/composer.lock | 4 ++-- projects/plugins/starter-plugin/composer.lock | 4 ++-- projects/plugins/videopress/composer.lock | 4 ++-- .../wpcomsh/changelog/add-consolidate-initial-state#2 | 5 ----- projects/plugins/wpcomsh/composer.lock | 4 ++-- 18 files changed, 28 insertions(+), 37 deletions(-) delete mode 100644 projects/packages/connection/changelog/add-consolidate-initial-state rename projects/plugins/{mu-wpcom-plugin => backup}/changelog/add-consolidate-initial-state#2 (100%) delete mode 100644 projects/plugins/wpcomsh/changelog/add-consolidate-initial-state#2 diff --git a/projects/packages/connection/changelog/add-consolidate-initial-state b/projects/packages/connection/changelog/add-consolidate-initial-state deleted file mode 100644 index 6f421510aa313..0000000000000 --- a/projects/packages/connection/changelog/add-consolidate-initial-state +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -Added jetpack-initial-state package to consolidate the logic for Initial state diff --git a/projects/packages/connection/composer.json b/projects/packages/connection/composer.json index 78d4bb88cfcef..b820e1b799a7a 100644 --- a/projects/packages/connection/composer.json +++ b/projects/packages/connection/composer.json @@ -70,7 +70,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/packages/connection/src/class-package-version.php b/projects/packages/connection/src/class-package-version.php index 274689d8be36c..9662160145401 100644 --- a/projects/packages/connection/src/class-package-version.php +++ b/projects/packages/connection/src/class-package-version.php @@ -12,7 +12,7 @@ */ class Package_Version { - const PACKAGE_VERSION = '2.12.0-alpha'; + const PACKAGE_VERSION = '2.11.2'; const PACKAGE_SLUG = 'connection'; diff --git a/projects/plugins/automattic-for-agencies-client/composer.lock b/projects/plugins/automattic-for-agencies-client/composer.lock index 0cf9fc83d4d05..0214e728dcba5 100644 --- a/projects/plugins/automattic-for-agencies-client/composer.lock +++ b/projects/plugins/automattic-for-agencies-client/composer.lock @@ -383,7 +383,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -418,7 +418,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/mu-wpcom-plugin/changelog/add-consolidate-initial-state#2 b/projects/plugins/backup/changelog/add-consolidate-initial-state#2 similarity index 100% rename from projects/plugins/mu-wpcom-plugin/changelog/add-consolidate-initial-state#2 rename to projects/plugins/backup/changelog/add-consolidate-initial-state#2 diff --git a/projects/plugins/backup/composer.lock b/projects/plugins/backup/composer.lock index 9a04314fc5d42..87ab2c1c10dea 100644 --- a/projects/plugins/backup/composer.lock +++ b/projects/plugins/backup/composer.lock @@ -665,7 +665,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -700,7 +700,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/boost/composer.lock b/projects/plugins/boost/composer.lock index 911a04699e40d..d165a2841dbd7 100644 --- a/projects/plugins/boost/composer.lock +++ b/projects/plugins/boost/composer.lock @@ -521,7 +521,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -556,7 +556,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/inspect/composer.lock b/projects/plugins/inspect/composer.lock index 3b5a3e68c9d94..58dcaa89d3a99 100644 --- a/projects/plugins/inspect/composer.lock +++ b/projects/plugins/inspect/composer.lock @@ -383,7 +383,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -418,7 +418,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/jetpack/composer.lock b/projects/plugins/jetpack/composer.lock index 4284736b3c3ec..349db470a1540 100644 --- a/projects/plugins/jetpack/composer.lock +++ b/projects/plugins/jetpack/composer.lock @@ -907,7 +907,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -942,7 +942,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/migration/composer.lock b/projects/plugins/migration/composer.lock index cfa8b00ee64cb..45ce3365b718b 100644 --- a/projects/plugins/migration/composer.lock +++ b/projects/plugins/migration/composer.lock @@ -665,7 +665,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -700,7 +700,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/mu-wpcom-plugin/composer.lock b/projects/plugins/mu-wpcom-plugin/composer.lock index a49bf64fbe9b3..618be87831a9d 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.lock +++ b/projects/plugins/mu-wpcom-plugin/composer.lock @@ -494,7 +494,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -529,7 +529,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/protect/composer.lock b/projects/plugins/protect/composer.lock index cd542b33b1c9f..a2ceb8ece9c15 100644 --- a/projects/plugins/protect/composer.lock +++ b/projects/plugins/protect/composer.lock @@ -578,7 +578,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -613,7 +613,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/search/composer.lock b/projects/plugins/search/composer.lock index 7dee110fda961..8c6cd9d876ea4 100644 --- a/projects/plugins/search/composer.lock +++ b/projects/plugins/search/composer.lock @@ -521,7 +521,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -556,7 +556,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/social/composer.lock b/projects/plugins/social/composer.lock index 439ad201839c9..f25e3aeebfeb5 100644 --- a/projects/plugins/social/composer.lock +++ b/projects/plugins/social/composer.lock @@ -521,7 +521,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -556,7 +556,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/starter-plugin/composer.lock b/projects/plugins/starter-plugin/composer.lock index 6d400e15ba8d2..609cd40b7601d 100644 --- a/projects/plugins/starter-plugin/composer.lock +++ b/projects/plugins/starter-plugin/composer.lock @@ -521,7 +521,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -556,7 +556,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/videopress/composer.lock b/projects/plugins/videopress/composer.lock index 6801afb5d5911..768a7bb382f55 100644 --- a/projects/plugins/videopress/composer.lock +++ b/projects/plugins/videopress/composer.lock @@ -521,7 +521,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -556,7 +556,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ diff --git a/projects/plugins/wpcomsh/changelog/add-consolidate-initial-state#2 b/projects/plugins/wpcomsh/changelog/add-consolidate-initial-state#2 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/wpcomsh/changelog/add-consolidate-initial-state#2 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - diff --git a/projects/plugins/wpcomsh/composer.lock b/projects/plugins/wpcomsh/composer.lock index b3fd5e95760f4..21cd35f66b50d 100644 --- a/projects/plugins/wpcomsh/composer.lock +++ b/projects/plugins/wpcomsh/composer.lock @@ -631,7 +631,7 @@ "dist": { "type": "path", "url": "../../packages/connection", - "reference": "2e4a3b9a72cb4f590de3ffcbd5ea0146d584483e" + "reference": "6d990be4aaded35f3ee203c976d16b9334419882" }, "require": { "automattic/jetpack-a8c-mc-stats": "@dev", @@ -666,7 +666,7 @@ "link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.12.x-dev" + "dev-trunk": "2.11.x-dev" }, "dependencies": { "test-only": [ From acaef37165c38a8fa362accdd66c44b701b0d7f6 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 30 Jul 2024 16:46:44 +0530 Subject: [PATCH 20/31] Add the unnecessary changelog --- .../ai-client/changelog/add-consolidate-initial-state | 4 ++++ .../changelog/add-consolidate-initial-state | 4 ++++ .../jetpack-mu-wpcom/changelog/add-consolidate-initial-state | 4 ++++ .../my-jetpack/changelog/add-consolidate-initial-state | 4 ++++ .../videopress/changelog/add-consolidate-initial-state | 4 ++++ 5 files changed, 20 insertions(+) create mode 100644 projects/js-packages/ai-client/changelog/add-consolidate-initial-state create mode 100644 projects/js-packages/publicize-components/changelog/add-consolidate-initial-state create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/add-consolidate-initial-state create mode 100644 projects/packages/my-jetpack/changelog/add-consolidate-initial-state create mode 100644 projects/packages/videopress/changelog/add-consolidate-initial-state diff --git a/projects/js-packages/ai-client/changelog/add-consolidate-initial-state b/projects/js-packages/ai-client/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..3fb98d489bffb --- /dev/null +++ b/projects/js-packages/ai-client/changelog/add-consolidate-initial-state @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Consolidated initial state diff --git a/projects/js-packages/publicize-components/changelog/add-consolidate-initial-state b/projects/js-packages/publicize-components/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..3fb98d489bffb --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/add-consolidate-initial-state @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Consolidated initial state diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-consolidate-initial-state b/projects/packages/jetpack-mu-wpcom/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..3fb98d489bffb --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/add-consolidate-initial-state @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Consolidated initial state diff --git a/projects/packages/my-jetpack/changelog/add-consolidate-initial-state b/projects/packages/my-jetpack/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..3fb98d489bffb --- /dev/null +++ b/projects/packages/my-jetpack/changelog/add-consolidate-initial-state @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Consolidated initial state diff --git a/projects/packages/videopress/changelog/add-consolidate-initial-state b/projects/packages/videopress/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..3fb98d489bffb --- /dev/null +++ b/projects/packages/videopress/changelog/add-consolidate-initial-state @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Consolidated initial state From d0fc2d6c248fad841e414c7d9499fe797edac50f Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Wed, 31 Jul 2024 10:31:04 +0530 Subject: [PATCH 21/31] Remove unnecessary noise of changelogs --- .../ai-client/changelog/add-consolidate-initial-state | 4 ---- .../changelog/add-consolidate-initial-state | 4 ---- .../jetpack-mu-wpcom/changelog/add-consolidate-initial-state | 4 ---- .../my-jetpack/changelog/add-consolidate-initial-state | 4 ---- .../videopress/changelog/add-consolidate-initial-state | 4 ---- .../plugins/backup/changelog/add-consolidate-initial-state#2 | 5 ----- 6 files changed, 25 deletions(-) delete mode 100644 projects/js-packages/ai-client/changelog/add-consolidate-initial-state delete mode 100644 projects/js-packages/publicize-components/changelog/add-consolidate-initial-state delete mode 100644 projects/packages/jetpack-mu-wpcom/changelog/add-consolidate-initial-state delete mode 100644 projects/packages/my-jetpack/changelog/add-consolidate-initial-state delete mode 100644 projects/packages/videopress/changelog/add-consolidate-initial-state delete mode 100644 projects/plugins/backup/changelog/add-consolidate-initial-state#2 diff --git a/projects/js-packages/ai-client/changelog/add-consolidate-initial-state b/projects/js-packages/ai-client/changelog/add-consolidate-initial-state deleted file mode 100644 index 3fb98d489bffb..0000000000000 --- a/projects/js-packages/ai-client/changelog/add-consolidate-initial-state +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: added - -Consolidated initial state diff --git a/projects/js-packages/publicize-components/changelog/add-consolidate-initial-state b/projects/js-packages/publicize-components/changelog/add-consolidate-initial-state deleted file mode 100644 index 3fb98d489bffb..0000000000000 --- a/projects/js-packages/publicize-components/changelog/add-consolidate-initial-state +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: added - -Consolidated initial state diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-consolidate-initial-state b/projects/packages/jetpack-mu-wpcom/changelog/add-consolidate-initial-state deleted file mode 100644 index 3fb98d489bffb..0000000000000 --- a/projects/packages/jetpack-mu-wpcom/changelog/add-consolidate-initial-state +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: added - -Consolidated initial state diff --git a/projects/packages/my-jetpack/changelog/add-consolidate-initial-state b/projects/packages/my-jetpack/changelog/add-consolidate-initial-state deleted file mode 100644 index 3fb98d489bffb..0000000000000 --- a/projects/packages/my-jetpack/changelog/add-consolidate-initial-state +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: added - -Consolidated initial state diff --git a/projects/packages/videopress/changelog/add-consolidate-initial-state b/projects/packages/videopress/changelog/add-consolidate-initial-state deleted file mode 100644 index 3fb98d489bffb..0000000000000 --- a/projects/packages/videopress/changelog/add-consolidate-initial-state +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: added - -Consolidated initial state diff --git a/projects/plugins/backup/changelog/add-consolidate-initial-state#2 b/projects/plugins/backup/changelog/add-consolidate-initial-state#2 deleted file mode 100644 index 9aa70e3ec1f75..0000000000000 --- a/projects/plugins/backup/changelog/add-consolidate-initial-state#2 +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: changed -Comment: Updated composer.lock. - - From 78271ff74d0a0fd50ca93c57a727cda70fa7008f Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 1 Aug 2024 17:50:30 +0530 Subject: [PATCH 22/31] Use JetpackInitialState --- projects/js-packages/initial-state/src/types.ts | 2 +- projects/js-packages/initial-state/src/utils.ts | 2 +- projects/packages/assets/src/class-initial-state.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/js-packages/initial-state/src/types.ts b/projects/js-packages/initial-state/src/types.ts index 43c4069bdf8d3..9bab7f3ea3ee6 100644 --- a/projects/js-packages/initial-state/src/types.ts +++ b/projects/js-packages/initial-state/src/types.ts @@ -44,6 +44,6 @@ export interface JetpackInitialState { declare global { interface Window { - JETPACK_INITIAL_STATE: JetpackInitialState; + JetpackInitialState: JetpackInitialState; } } diff --git a/projects/js-packages/initial-state/src/utils.ts b/projects/js-packages/initial-state/src/utils.ts index 751083bdb80f7..591e05b02b588 100644 --- a/projects/js-packages/initial-state/src/utils.ts +++ b/projects/js-packages/initial-state/src/utils.ts @@ -4,7 +4,7 @@ * @returns {import('./types').JetpackInitialState} The initial state. */ export function getInitialState() { - return window.JETPACK_INITIAL_STATE; + return window.JetpackInitialState; } /** diff --git a/projects/packages/assets/src/class-initial-state.php b/projects/packages/assets/src/class-initial-state.php index 9e3ddecfb0070..3d4d58a10e4dc 100644 --- a/projects/packages/assets/src/class-initial-state.php +++ b/projects/packages/assets/src/class-initial-state.php @@ -76,7 +76,7 @@ public static function render_initial_state() { wp_add_inline_script( self::SCRIPT_HANDLE, - sprintf( 'var JETPACK_INITIAL_STATE = %s;', $initial_state ), + sprintf( 'window.JetpackInitialState = %s;', $initial_state ), 'before' ); } From c625bfea3cc9dce9e9b34b7ad88ef10c933d90cf Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 1 Aug 2024 17:55:50 +0530 Subject: [PATCH 23/31] Update doc blocks --- projects/packages/assets/src/class-initial-state.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/packages/assets/src/class-initial-state.php b/projects/packages/assets/src/class-initial-state.php index 3d4d58a10e4dc..49d1154997374 100644 --- a/projects/packages/assets/src/class-initial-state.php +++ b/projects/packages/assets/src/class-initial-state.php @@ -123,6 +123,8 @@ protected static function get_admin_initial_state() { * For example, the social (publicize) data is used only on Social admin page, Jetpack settings page and the post editor. * So, the social data should be added only on those pages. * + * @since $$next-version$$ + * * @param array $state The initial state. */ return apply_filters( 'jetpack_admin_js_initial_state', $state ); @@ -147,6 +149,8 @@ protected static function get_public_initial_state() { * * See the docs for `jetpack_admin_js_initial_state` filter for more information. * + * @since $$next-version$$ + * * @param array $state The initial state. */ return apply_filters( 'jetpack_public_js_initial_state', $state ); @@ -173,6 +177,14 @@ protected static function get_site_icon() { return ''; } + /** + * Filters the site icon using Photon. + * + * @see https://developer.wordpress.com/docs/photon/ + * + * @param string $url The URL of the site icon. + * @param array|string $args An array of arguments, e.g. array( 'w' => '300', 'resize' => array( 123, 456 ) ), or in string form (w=123&h=456). + */ return apply_filters( 'jetpack_photon_url', get_site_icon_url(), array( 'w' => 64 ) ); } From 2276331a30d4c60c767ac9e13753e5b04f780ddc Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 1 Aug 2024 18:07:42 +0530 Subject: [PATCH 24/31] Fix up versions --- projects/plugins/social/composer.json | 2 +- projects/plugins/social/jetpack-social.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/plugins/social/composer.json b/projects/plugins/social/composer.json index 169ed193d0cdf..e69671c8e9e6f 100644 --- a/projects/plugins/social/composer.json +++ b/projects/plugins/social/composer.json @@ -84,6 +84,6 @@ "automattic/jetpack-autoloader": true, "automattic/jetpack-composer-plugin": true }, - "autoloader-suffix": "c4802e05bbcf59fd3b6350e8d3e5482c_socialⓥ5_0_0" + "autoloader-suffix": "c4802e05bbcf59fd3b6350e8d3e5482c_socialⓥ5_0_1_alpha" } } diff --git a/projects/plugins/social/jetpack-social.php b/projects/plugins/social/jetpack-social.php index 9c469b8838a63..5e57e1eec8547 100644 --- a/projects/plugins/social/jetpack-social.php +++ b/projects/plugins/social/jetpack-social.php @@ -4,7 +4,7 @@ * Plugin Name: Jetpack Social * Plugin URI: https://wordpress.org/plugins/jetpack-social * Description: Share your site’s posts on several social media networks automatically when you publish a new post. - * Version: 5.0.0 + * Version: 5.0.1-alpha * Author: Automattic - Jetpack Social team * Author URI: https://jetpack.com/social/ * License: GPLv2 or later From 76022bfef5d4db73f15d87c397f3ed56a877d079 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 2 Aug 2024 20:48:03 +0530 Subject: [PATCH 25/31] Rename the package to `script-data` --- .../changelog/add-consolidate-initial-state | 4 ---- .../.gitattributes | 0 .../{initial-state => script-data}/.gitignore | 0 .../CHANGELOG.md | 0 .../{initial-state => script-data}/README.md | 4 ++-- .../changelog/.gitkeep | 0 .../changelog/add-consolidate-initial-state | 4 ++++ .../composer.json | 8 ++++---- .../package.json | 10 +++++----- .../src/index.ts | 0 .../src/types.ts | 4 ++-- .../src/utils.ts | 20 +++++++++---------- .../tsconfig.json | 0 13 files changed, 27 insertions(+), 27 deletions(-) delete mode 100644 projects/js-packages/initial-state/changelog/add-consolidate-initial-state rename projects/js-packages/{initial-state => script-data}/.gitattributes (100%) rename projects/js-packages/{initial-state => script-data}/.gitignore (100%) rename projects/js-packages/{initial-state => script-data}/CHANGELOG.md (100%) rename projects/js-packages/{initial-state => script-data}/README.md (76%) rename projects/js-packages/{initial-state => script-data}/changelog/.gitkeep (100%) create mode 100644 projects/js-packages/script-data/changelog/add-consolidate-initial-state rename projects/js-packages/{initial-state => script-data}/composer.json (58%) rename projects/js-packages/{initial-state => script-data}/package.json (63%) rename projects/js-packages/{initial-state => script-data}/src/index.ts (100%) rename projects/js-packages/{initial-state => script-data}/src/types.ts (90%) rename projects/js-packages/{initial-state => script-data}/src/utils.ts (68%) rename projects/js-packages/{initial-state => script-data}/tsconfig.json (100%) diff --git a/projects/js-packages/initial-state/changelog/add-consolidate-initial-state b/projects/js-packages/initial-state/changelog/add-consolidate-initial-state deleted file mode 100644 index 6f421510aa313..0000000000000 --- a/projects/js-packages/initial-state/changelog/add-consolidate-initial-state +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -Added jetpack-initial-state package to consolidate the logic for Initial state diff --git a/projects/js-packages/initial-state/.gitattributes b/projects/js-packages/script-data/.gitattributes similarity index 100% rename from projects/js-packages/initial-state/.gitattributes rename to projects/js-packages/script-data/.gitattributes diff --git a/projects/js-packages/initial-state/.gitignore b/projects/js-packages/script-data/.gitignore similarity index 100% rename from projects/js-packages/initial-state/.gitignore rename to projects/js-packages/script-data/.gitignore diff --git a/projects/js-packages/initial-state/CHANGELOG.md b/projects/js-packages/script-data/CHANGELOG.md similarity index 100% rename from projects/js-packages/initial-state/CHANGELOG.md rename to projects/js-packages/script-data/CHANGELOG.md diff --git a/projects/js-packages/initial-state/README.md b/projects/js-packages/script-data/README.md similarity index 76% rename from projects/js-packages/initial-state/README.md rename to projects/js-packages/script-data/README.md index d4c3c313cfa31..79d51d33bb8ec 100644 --- a/projects/js-packages/initial-state/README.md +++ b/projects/js-packages/script-data/README.md @@ -1,6 +1,6 @@ -# Initial State +# Scrip Helpers -A library to provide initial state and the corresponding utility functions for Jetpack. +A library to provide data for script handles and the corresponding utility functions for Jetpack. ## Contribute diff --git a/projects/js-packages/initial-state/changelog/.gitkeep b/projects/js-packages/script-data/changelog/.gitkeep similarity index 100% rename from projects/js-packages/initial-state/changelog/.gitkeep rename to projects/js-packages/script-data/changelog/.gitkeep diff --git a/projects/js-packages/script-data/changelog/add-consolidate-initial-state b/projects/js-packages/script-data/changelog/add-consolidate-initial-state new file mode 100644 index 0000000000000..3f32249189e3e --- /dev/null +++ b/projects/js-packages/script-data/changelog/add-consolidate-initial-state @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Added jetpack-script-data package to consolidate the logic for Jetpack Initial state diff --git a/projects/js-packages/initial-state/composer.json b/projects/js-packages/script-data/composer.json similarity index 58% rename from projects/js-packages/initial-state/composer.json rename to projects/js-packages/script-data/composer.json index 766345eb70eb2..e019f6691a5d6 100644 --- a/projects/js-packages/initial-state/composer.json +++ b/projects/js-packages/script-data/composer.json @@ -1,6 +1,6 @@ { - "name": "automattic/jetpack-initial-state", - "description": "A library to provide initial state and the corresponding utility functions for Jetpack.", + "name": "automattic/jetpack-script-data", + "description": "A library to provide data for script handles and the corresponding utility functions for Jetpack.", "type": "library", "license": "GPL-2.0-or-later", "require": {}, @@ -25,9 +25,9 @@ "minimum-stability": "dev", "prefer-stable": true, "extra": { - "mirror-repo": "Automattic/jetpack-initial-state", + "mirror-repo": "Automattic/jetpack-script-data", "changelogger": { - "link-template": "https://github.com/Automattic/jetpack-initial-state/compare/v${old}...v${new}" + "link-template": "https://github.com/Automattic/jetpack-script-data/compare/v${old}...v${new}" }, "autotagger": true } diff --git a/projects/js-packages/initial-state/package.json b/projects/js-packages/script-data/package.json similarity index 63% rename from projects/js-packages/initial-state/package.json rename to projects/js-packages/script-data/package.json index 3cbddf624d3f7..4ac99169506c8 100644 --- a/projects/js-packages/initial-state/package.json +++ b/projects/js-packages/script-data/package.json @@ -1,16 +1,16 @@ { "private": true, - "name": "@automattic/jetpack-initial-state", + "name": "@automattic/jetpack-script-data", "version": "0.1.0-alpha", - "description": "A library to provide initial state and the corresponding utility functions for Jetpack.", - "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/initial-state/#readme", + "description": "A library to provide data for script handles and the corresponding utility functions for Jetpack.", + "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/script-data/#readme", "bugs": { - "url": "https://github.com/Automattic/jetpack/labels/[JS Package] Initial State" + "url": "https://github.com/Automattic/jetpack/labels/[JS Package] Script Data" }, "repository": { "type": "git", "url": "https://github.com/Automattic/jetpack.git", - "directory": "projects/js-packages/initial-state" + "directory": "projects/js-packages/script-data" }, "license": "GPL-2.0-or-later", "author": "Automattic", diff --git a/projects/js-packages/initial-state/src/index.ts b/projects/js-packages/script-data/src/index.ts similarity index 100% rename from projects/js-packages/initial-state/src/index.ts rename to projects/js-packages/script-data/src/index.ts diff --git a/projects/js-packages/initial-state/src/types.ts b/projects/js-packages/script-data/src/types.ts similarity index 90% rename from projects/js-packages/initial-state/src/types.ts rename to projects/js-packages/script-data/src/types.ts index 9bab7f3ea3ee6..66374b83fcb65 100644 --- a/projects/js-packages/initial-state/src/types.ts +++ b/projects/js-packages/script-data/src/types.ts @@ -37,13 +37,13 @@ export interface UserData { current_user: CurrentUserData; } -export interface JetpackInitialState { +export interface JetpackScriptData { site: SiteData; user: UserData; } declare global { interface Window { - JetpackInitialState: JetpackInitialState; + JetpackScriptData: JetpackScriptData; } } diff --git a/projects/js-packages/initial-state/src/utils.ts b/projects/js-packages/script-data/src/utils.ts similarity index 68% rename from projects/js-packages/initial-state/src/utils.ts rename to projects/js-packages/script-data/src/utils.ts index 591e05b02b588..e23463e308d06 100644 --- a/projects/js-packages/initial-state/src/utils.ts +++ b/projects/js-packages/script-data/src/utils.ts @@ -1,30 +1,30 @@ /** - * Get the initial state from the window object. + * Get the script data from the window object. * - * @returns {import('./types').JetpackInitialState} The initial state. + * @returns {import('./types').JetpackScriptData} The script data. */ -export function getInitialState() { - return window.JetpackInitialState; +export function getScriptData() { + return window.JetpackScriptData; } /** - * Get the site data from the initial state. + * Get the site data from the script data. * * @returns {import('./types').SiteData} The site data. */ export function getSiteData() { - return getInitialState().site; + return getScriptData().site; } /** - * Get the admin URL from the initial state. + * Get the admin URL from the script data. * * @param {string} [path] - The path to append to the admin URL. e.g. `admin.php?page=jetpack`. * * @returns {string} The admin URL. */ export function getAdminUrl( path = '' ) { - return `${ getInitialState().site.admin_url }${ path }`; + return `${ getScriptData().site.admin_url }${ path }`; } /** @@ -50,10 +50,10 @@ export function getMyJetpackUrl( section = '' ) { } /** - * Get the current user data from the initial state. + * Get active features from the site plan. * * @returns {import('./types').SitePlan['features']['active']} The active features. */ export function getActiveFeatures() { - return getInitialState().site.plan?.features?.active ?? []; + return getScriptData().site.plan?.features?.active ?? []; } diff --git a/projects/js-packages/initial-state/tsconfig.json b/projects/js-packages/script-data/tsconfig.json similarity index 100% rename from projects/js-packages/initial-state/tsconfig.json rename to projects/js-packages/script-data/tsconfig.json From 5fb45531521f480bbf60fe771312772f42c40008 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 2 Aug 2024 20:52:11 +0530 Subject: [PATCH 26/31] Update build config --- .../js-packages/webpack-config/src/webpack.js | 6 +-- projects/packages/assets/actions.php | 4 +- projects/packages/assets/package.json | 2 +- ...nitial-state.php => class-script-data.php} | 52 +++++++++---------- projects/packages/assets/webpack.config.js | 8 +-- 5 files changed, 36 insertions(+), 36 deletions(-) rename projects/packages/assets/src/{class-initial-state.php => class-script-data.php} (74%) diff --git a/projects/js-packages/webpack-config/src/webpack.js b/projects/js-packages/webpack-config/src/webpack.js index 11deaacb1e4bd..8545f82334018 100644 --- a/projects/js-packages/webpack-config/src/webpack.js +++ b/projects/js-packages/webpack-config/src/webpack.js @@ -106,9 +106,9 @@ const DefinePlugin = defines => [ ]; const defaultRequestMap = { - '@automattic/jetpack-initial-state': { - external: 'JetpackInitialState', - handle: 'jetpack-initial-state', + '@automattic/jetpack-script-data': { + external: 'JetpackScriptData', + handle: 'jetpack-script-data', }, }; diff --git a/projects/packages/assets/actions.php b/projects/packages/assets/actions.php index 49e747d72bbab..f6632da3006e8 100644 --- a/projects/packages/assets/actions.php +++ b/projects/packages/assets/actions.php @@ -9,7 +9,7 @@ // drop data into `$wp_filter` for `WP_Hook::build_preinitialized_hooks()`. if ( function_exists( 'add_action' ) ) { add_action( 'wp_default_scripts', array( Automattic\Jetpack\Assets::class, 'wp_default_scripts_hook' ) ); - add_action( 'plugins_loaded', array( Automattic\Jetpack\Initial_State::class, 'configure' ), 1 ); + add_action( 'plugins_loaded', array( Automattic\Jetpack\Script_Data::class, 'configure' ), 1 ); } else { global $wp_filter; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited @@ -20,6 +20,6 @@ // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $wp_filter['plugins_loaded'][1][] = array( 'accepted_args' => 0, - 'function' => array( Automattic\Jetpack\Initial_State::class, 'configure' ), + 'function' => array( Automattic\Jetpack\Script_Data::class, 'configure' ), ); } diff --git a/projects/packages/assets/package.json b/projects/packages/assets/package.json index b0068a56478fc..7280f0d1d619c 100644 --- a/projects/packages/assets/package.json +++ b/projects/packages/assets/package.json @@ -11,7 +11,7 @@ "validate": "pnpm exec validate-es build/" }, "dependencies": { - "@automattic/jetpack-initial-state": "workspace:*", + "@automattic/jetpack-script-data": "workspace:*", "react": "18.3.1" }, "devDependencies": { diff --git a/projects/packages/assets/src/class-initial-state.php b/projects/packages/assets/src/class-script-data.php similarity index 74% rename from projects/packages/assets/src/class-initial-state.php rename to projects/packages/assets/src/class-script-data.php index 49d1154997374..3f6df1de4dad3 100644 --- a/projects/packages/assets/src/class-initial-state.php +++ b/projects/packages/assets/src/class-script-data.php @@ -1,6 +1,6 @@ true, @@ -59,34 +59,34 @@ public static function register_assets() { } /** - * Render the initial state using an inline script. + * Render the script data using an inline script. * * @access private * * @return void */ - public static function render_initial_state() { + public static function render_script_data() { - $initial_state = is_admin() ? self::get_admin_initial_state() : self::get_public_initial_state(); + $script_data = is_admin() ? self::get_admin_script_data() : self::get_public_script_data(); - $initial_state = wp_json_encode( - $initial_state, + $script_data = wp_json_encode( + $script_data, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE ); wp_add_inline_script( self::SCRIPT_HANDLE, - sprintf( 'window.JetpackInitialState = %s;', $initial_state ), + sprintf( 'window.JetpackScriptData = %s;', $script_data ), 'before' ); } /** - * Get the admin initial state. + * Get the admin script data. * * @return array */ - protected static function get_admin_initial_state() { + protected static function get_admin_script_data() { global $wp_version; @@ -116,7 +116,7 @@ protected static function get_admin_initial_state() { ); /** - * Filter the admin initial state. + * Filter the admin script data. * * When using this filter, ensure that the data is added only if it is used by some script. * This filter may be called on almost every admin page load. So, one should check if the data is needed/used on that page. @@ -125,17 +125,17 @@ protected static function get_admin_initial_state() { * * @since $$next-version$$ * - * @param array $state The initial state. + * @param array $state The script data. */ - return apply_filters( 'jetpack_admin_js_initial_state', $state ); + return apply_filters( 'jetpack_admin_js_script_data', $state ); } /** - * Get the admin initial state. + * Get the admin script data. * * @return array */ - protected static function get_public_initial_state() { + protected static function get_public_script_data() { $state = array( 'site' => array( @@ -145,15 +145,15 @@ protected static function get_public_initial_state() { ); /** - * Filter the public initial state. + * Filter the public script data. * - * See the docs for `jetpack_admin_js_initial_state` filter for more information. + * See the docs for `jetpack_admin_js_script_data` filter for more information. * * @since $$next-version$$ * - * @param array $state The initial state. + * @param array $state The script data. */ - return apply_filters( 'jetpack_public_js_initial_state', $state ); + return apply_filters( 'jetpack_public_js_script_data', $state ); } /** diff --git a/projects/packages/assets/webpack.config.js b/projects/packages/assets/webpack.config.js index 7d83a12ff4fb3..9104fd7120eee 100644 --- a/projects/packages/assets/webpack.config.js +++ b/projects/packages/assets/webpack.config.js @@ -41,10 +41,10 @@ module.exports = [ { ...sharedConfig, entry: { - 'jetpack-initial-state': { - import: './src/js/initial-state.js', + 'jetpack-script-data': { + import: './src/js/script-data.js', library: { - name: 'JetpackInitialState', + name: 'JetpackScriptData', type: 'umd', }, }, @@ -55,7 +55,7 @@ module.exports = [ DependencyExtractionPlugin: { requestMap: { // We don't want to externalize this package, we rather want to bundle it. - '@automattic/jetpack-initial-state': {}, + '@automattic/jetpack-script-data': {}, }, }, } ), From df778a81ebf76aa9d8e915e3906dd6c7f2a38dee Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 2 Aug 2024 21:02:55 +0530 Subject: [PATCH 27/31] Update js-package name --- projects/packages/assets/src/js/initial-state.js | 1 - projects/packages/assets/src/js/script-data.js | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 projects/packages/assets/src/js/initial-state.js create mode 100644 projects/packages/assets/src/js/script-data.js diff --git a/projects/packages/assets/src/js/initial-state.js b/projects/packages/assets/src/js/initial-state.js deleted file mode 100644 index 8a46d298ace86..0000000000000 --- a/projects/packages/assets/src/js/initial-state.js +++ /dev/null @@ -1 +0,0 @@ -export * from '@automattic/jetpack-initial-state'; diff --git a/projects/packages/assets/src/js/script-data.js b/projects/packages/assets/src/js/script-data.js new file mode 100644 index 0000000000000..99a6b8feca7ef --- /dev/null +++ b/projects/packages/assets/src/js/script-data.js @@ -0,0 +1 @@ +export * from '@automattic/jetpack-script-data'; From 659bea063424783d3ec6d4effc46006a03bc73c9 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 2 Aug 2024 21:10:54 +0530 Subject: [PATCH 28/31] Use separate global variables for data and module --- projects/js-packages/webpack-config/src/webpack.js | 2 +- projects/packages/assets/webpack.config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/js-packages/webpack-config/src/webpack.js b/projects/js-packages/webpack-config/src/webpack.js index 8545f82334018..7a925aa435d96 100644 --- a/projects/js-packages/webpack-config/src/webpack.js +++ b/projects/js-packages/webpack-config/src/webpack.js @@ -107,7 +107,7 @@ const DefinePlugin = defines => [ const defaultRequestMap = { '@automattic/jetpack-script-data': { - external: 'JetpackScriptData', + external: 'JetpackScriptDataModule', handle: 'jetpack-script-data', }, }; diff --git a/projects/packages/assets/webpack.config.js b/projects/packages/assets/webpack.config.js index 9104fd7120eee..8a40e14b66367 100644 --- a/projects/packages/assets/webpack.config.js +++ b/projects/packages/assets/webpack.config.js @@ -44,7 +44,7 @@ module.exports = [ 'jetpack-script-data': { import: './src/js/script-data.js', library: { - name: 'JetpackScriptData', + name: 'JetpackScriptDataModule', type: 'umd', }, }, From 84d5a5aaba04c1468799990e248a1690f428b31d Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 2 Aug 2024 21:19:13 +0530 Subject: [PATCH 29/31] Update lockfile --- pnpm-lock.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 32b258f345198..cd6fec5b28542 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -824,8 +824,6 @@ importers: specifier: 4.9.1 version: 4.9.1(webpack@5.76.0) - projects/js-packages/initial-state: {} - projects/js-packages/licensing: dependencies: '@automattic/jetpack-analytics': @@ -1239,6 +1237,8 @@ importers: specifier: 5.0.4 version: 5.0.4 + projects/js-packages/script-data: {} + projects/js-packages/shared-extension-utils: dependencies: '@automattic/jetpack-analytics': @@ -1670,9 +1670,9 @@ importers: projects/packages/assets: dependencies: - '@automattic/jetpack-initial-state': + '@automattic/jetpack-script-data': specifier: workspace:* - version: link:../../js-packages/initial-state + version: link:../../js-packages/script-data react: specifier: 18.3.1 version: 18.3.1 From ea919383af8a38d85b98d26a3622de5e4258c551 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Mon, 5 Aug 2024 16:44:47 +0530 Subject: [PATCH 30/31] Fix up versions --- projects/plugins/wpcomsh/composer.json | 2 +- projects/plugins/wpcomsh/package.json | 2 +- projects/plugins/wpcomsh/wpcomsh.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/plugins/wpcomsh/composer.json b/projects/plugins/wpcomsh/composer.json index ab294d06d404e..bfcb8ca3e89a2 100644 --- a/projects/plugins/wpcomsh/composer.json +++ b/projects/plugins/wpcomsh/composer.json @@ -128,7 +128,7 @@ "composer/installers": true, "roots/wordpress-core-installer": true }, - "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ5_2_0" + "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ5_2_1_alpha" }, "extra": { "mirror-repo": "Automattic/wpcom-site-helper", diff --git a/projects/plugins/wpcomsh/package.json b/projects/plugins/wpcomsh/package.json index db07cb230f2c4..a814014e13f69 100644 --- a/projects/plugins/wpcomsh/package.json +++ b/projects/plugins/wpcomsh/package.json @@ -3,7 +3,7 @@ "name": "@automattic/jetpack-wpcomsh", "description": "A helper for connecting WordPress.com sites to external host infrastructure.", "homepage": "https://jetpack.com", - "version": "5.2.0", + "version": "5.2.1-alpha", "bugs": { "url": "https://github.com/Automattic/jetpack/labels/[Plugin] Wpcomsh" }, diff --git a/projects/plugins/wpcomsh/wpcomsh.php b/projects/plugins/wpcomsh/wpcomsh.php index f366ba8d70c08..f037467f5099a 100644 --- a/projects/plugins/wpcomsh/wpcomsh.php +++ b/projects/plugins/wpcomsh/wpcomsh.php @@ -2,14 +2,14 @@ /** * Plugin Name: WordPress.com Site Helper * Description: A helper for connecting WordPress.com sites to external host infrastructure. - * Version: 5.2.0 + * Version: 5.2.1-alpha * Author: Automattic * Author URI: http://automattic.com/ * * @package wpcomsh */ -define( 'WPCOMSH_VERSION', '5.2.0' ); +define( 'WPCOMSH_VERSION', '5.2.1-alpha' ); // If true, Typekit fonts will be available in addition to Google fonts add_filter( 'jetpack_fonts_enable_typekit', '__return_true' ); From 5ac15db433395efc62899917582a2b9cf7c9f120 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Tue, 6 Aug 2024 08:54:58 +0530 Subject: [PATCH 31/31] Fix up versions --- projects/plugins/mu-wpcom-plugin/composer.json | 2 +- projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php | 2 +- projects/plugins/mu-wpcom-plugin/package.json | 2 +- projects/plugins/wpcomsh/composer.json | 2 +- projects/plugins/wpcomsh/package.json | 2 +- projects/plugins/wpcomsh/wpcomsh.php | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/projects/plugins/mu-wpcom-plugin/composer.json b/projects/plugins/mu-wpcom-plugin/composer.json index 7346c56033dff..b81b22a4edca5 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.json +++ b/projects/plugins/mu-wpcom-plugin/composer.json @@ -46,6 +46,6 @@ ] }, "config": { - "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_5_4" + "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_5_5_alpha" } } diff --git a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php index d8e2208c072cf..1c56f38491d9f 100644 --- a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php +++ b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php @@ -3,7 +3,7 @@ * * Plugin Name: WordPress.com Features * Description: Test plugin for the jetpack-mu-wpcom package - * Version: 2.5.4 + * Version: 2.5.5-alpha * Author: Automattic * License: GPLv2 or later * Text Domain: jetpack-mu-wpcom-plugin diff --git a/projects/plugins/mu-wpcom-plugin/package.json b/projects/plugins/mu-wpcom-plugin/package.json index 087cf5b73a7a4..d204e724a0cd8 100644 --- a/projects/plugins/mu-wpcom-plugin/package.json +++ b/projects/plugins/mu-wpcom-plugin/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-mu-wpcom-plugin", - "version": "2.5.4", + "version": "2.5.5-alpha", "description": "Test plugin for the jetpack-mu-wpcom package", "homepage": "https://jetpack.com", "bugs": { diff --git a/projects/plugins/wpcomsh/composer.json b/projects/plugins/wpcomsh/composer.json index 9fe6b8f0445c5..47b34fff16c76 100644 --- a/projects/plugins/wpcomsh/composer.json +++ b/projects/plugins/wpcomsh/composer.json @@ -128,7 +128,7 @@ "composer/installers": true, "roots/wordpress-core-installer": true }, - "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ5_2_1" + "autoloader-suffix": "26841ac2064774301cbe06d174833bfc_wpcomshⓥ5_2_2_alpha" }, "extra": { "mirror-repo": "Automattic/wpcom-site-helper", diff --git a/projects/plugins/wpcomsh/package.json b/projects/plugins/wpcomsh/package.json index f2794d3755d2e..a5010ed0aecc2 100644 --- a/projects/plugins/wpcomsh/package.json +++ b/projects/plugins/wpcomsh/package.json @@ -3,7 +3,7 @@ "name": "@automattic/jetpack-wpcomsh", "description": "A helper for connecting WordPress.com sites to external host infrastructure.", "homepage": "https://jetpack.com", - "version": "5.2.1", + "version": "5.2.2-alpha", "bugs": { "url": "https://github.com/Automattic/jetpack/labels/[Plugin] Wpcomsh" }, diff --git a/projects/plugins/wpcomsh/wpcomsh.php b/projects/plugins/wpcomsh/wpcomsh.php index 7291023f6c477..4025dbdd769aa 100644 --- a/projects/plugins/wpcomsh/wpcomsh.php +++ b/projects/plugins/wpcomsh/wpcomsh.php @@ -2,14 +2,14 @@ /** * Plugin Name: WordPress.com Site Helper * Description: A helper for connecting WordPress.com sites to external host infrastructure. - * Version: 5.2.1 + * Version: 5.2.2-alpha * Author: Automattic * Author URI: http://automattic.com/ * * @package wpcomsh */ -define( 'WPCOMSH_VERSION', '5.2.1' ); +define( 'WPCOMSH_VERSION', '5.2.2-alpha' ); // If true, Typekit fonts will be available in addition to Google fonts add_filter( 'jetpack_fonts_enable_typekit', '__return_true' );