Skip to content

Commit

Permalink
Connection: Load connection JS bundle via connection PHP package (#38…
Browse files Browse the repository at this point in the history
…877)

* Mark connection js package being external to extract it as a dependency

* Bundle connection js package inside php connection package

* Register connect bundle as a script handle for dependents to use

* Add changelog

* Fix E2E tests

* Fix more e2e tests

* Fix jetpack-admin css dependency because it does not use Assets::register_script

* Update webpack.config.js

Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>

---------

Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10676566246

Upstream-Ref: Automattic/jetpack@33068b8
  • Loading branch information
manzoorwanijk authored and matticbot committed Sep 3, 2024
1 parent 918c190 commit 0c30661
Show file tree
Hide file tree
Showing 40 changed files with 274 additions and 202 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This is an alpha version! The changes listed here are not final.
- General: indicate compatibility with the upcoming version of WordPress - 6.6.
- Remove the 'jetpack-identity-crisis' dependency.
- Update composer lock file
- Updated connection js to load its bundle via connection package

### Removed
- General: update WordPress version requirements to WordPress 6.5.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"automattic/jetpack-autoloader": "^3.0.10",
"automattic/jetpack-composer-plugin": "^2.0.3",
"automattic/jetpack-config": "^2.0.4",
"automattic/jetpack-connection": "^2.12.5",
"automattic/jetpack-connection": "^2.13.0-alpha",
"automattic/jetpack-my-jetpack": "^4.34.0",
"automattic/jetpack-search": "^0.45.0",
"automattic/jetpack-stats": "^0.13.1",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-boost-core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.0",
"automattic/jetpack-connection": "^2.12.5"
"automattic/jetpack-connection": "^2.13.0-alpha"
},
"require-dev": {
"yoast/phpunit-polyfills": "^1.1.1",
Expand Down
8 changes: 8 additions & 0 deletions jetpack_vendor/automattic/jetpack-connection/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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).

## [2.13.0-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Changed
- Updated connection js to load its bundle via connection package

## [2.12.5] - 2024-08-29
### Changed
- Sync: Remove the checksum for active plugins if present when sync is not active, so it gets recalculated when sync gets activated [#39098]
Expand Down Expand Up @@ -1167,6 +1174,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Separate the connection library into its own package.

[2.13.0-alpha]: https://github.com/Automattic/jetpack-connection/compare/v2.12.5...v2.13.0-alpha
[2.12.5]: https://github.com/Automattic/jetpack-connection/compare/v2.12.4...v2.12.5
[2.12.4]: https://github.com/Automattic/jetpack-connection/compare/v2.12.3...v2.12.4
[2.12.3]: https://github.com/Automattic/jetpack-connection/compare/v2.12.2...v2.12.3
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-connection/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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.13.x-dev"
},
"dependencies": {
"test-only": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'a57e6a841c06301bc4cd');
<?php return array('dependencies' => array('react', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'f6bce0e6b8e0527839ee');

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('jetpack-script-data', 'react', 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => '633f5b84c0735e749fc1');

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Exposes number format capability
*
* @copyright Copyright (c) 2013 Kevin van Zonneveld (http://kvz.io) and Contributors (http://phpjs.org/authors).
* @license See CREDITS.md
* @see https://github.com/kvz/phpjs/blob/ffe1356af23a6f2512c84c954dd4e828e92579fa/functions/strings/number_format.js
*/

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* Connection_Assets.
*
* @package automattic/jetpack-connection
*/

namespace Automattic\Jetpack\Connection;

use Automattic\Jetpack\Assets;

/**
* Connection_Assets class.
*/
class Connection_Assets {

/**
* Initialize the class.
*/
public static function configure() {
add_action( 'wp_loaded', array( __CLASS__, 'register_assets' ) );

add_filter( 'jetpack_admin_js_script_data', array( Initial_State::class, 'set_connection_script_data' ), 10, 1 );
}

/**
* Register assets.
*/
public static function register_assets() {

Assets::register_script(
'jetpack-connection',
'../dist/jetpack-connection.js',
__FILE__,
array(
'in_footer' => true,
'textdomain' => 'jetpack-connection',
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public static function configure() {
// Initial Partner management.
Partner::init();

add_filter( 'jetpack_admin_js_script_data', array( Initial_State::class, 'set_connection_script_data' ), 10, 1 );
Connection_Assets::configure();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Package_Version {

const PACKAGE_VERSION = '2.12.5';
const PACKAGE_VERSION = '2.13.0-alpha';

const PACKAGE_SLUG = 'connection';

Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-explat/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.0",
"automattic/jetpack-connection": "^2.12.5"
"automattic/jetpack-connection": "^2.13.0-alpha"
},
"require-dev": {
"yoast/phpunit-polyfills": "^1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-jitm/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"php": ">=7.0",
"automattic/jetpack-a8c-mc-stats": "^2.0.2",
"automattic/jetpack-assets": "^2.3.5",
"automattic/jetpack-connection": "^2.12.5",
"automattic/jetpack-connection": "^2.13.0-alpha",
"automattic/jetpack-device-detection": "^2.1.4",
"automattic/jetpack-logo": "^2.0.4",
"automattic/jetpack-redirect": "^2.0.3",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-licensing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.0",
"automattic/jetpack-connection": "^2.12.5"
"automattic/jetpack-connection": "^2.13.0-alpha"
},
"require-dev": {
"automattic/wordbless": "@dev",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('jetpack-script-data', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '095ab5b068026c70ac0f');
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '46558a6ed67bc74eda64');

Large diffs are not rendered by default.

98 changes: 49 additions & 49 deletions jetpack_vendor/automattic/jetpack-my-jetpack/build/index.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-my-jetpack/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"automattic/jetpack-admin-ui": "^0.4.4",
"automattic/jetpack-assets": "^2.3.5",
"automattic/jetpack-boost-speed-score": "^0.3.12",
"automattic/jetpack-connection": "^2.12.5",
"automattic/jetpack-connection": "^2.13.0-alpha",
"automattic/jetpack-explat": "^0.1.5",
"automattic/jetpack-jitm": "^3.1.19",
"automattic/jetpack-licensing": "^2.0.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.0",
"automattic/jetpack-connection": "^2.12.5",
"automattic/jetpack-connection": "^2.13.0-alpha",
"automattic/jetpack-plugins-installer": "^0.4.2",
"automattic/jetpack-sync": "^3.9.0",
"automattic/jetpack-protect-models": "^0.2.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('jetpack-script-data', 'react', 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '58e7dbabb8eea061c818');
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'react', 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '48e1e39499a9722074c9');

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-search/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.0",
"automattic/jetpack-connection": "^2.12.5",
"automattic/jetpack-connection": "^2.13.0-alpha",
"automattic/jetpack-assets": "^2.3.5",
"automattic/jetpack-constants": "^2.0.4",
"automattic/jetpack-status": "^3.3.4",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-stats/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.0",
"automattic/jetpack-connection": "^2.12.5",
"automattic/jetpack-connection": "^2.13.0-alpha",
"automattic/jetpack-constants": "^2.0.4",
"automattic/jetpack-status": "^3.3.4"
},
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-sync/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.0",
"automattic/jetpack-connection": "^2.12.5",
"automattic/jetpack-connection": "^2.13.0-alpha",
"automattic/jetpack-constants": "^2.0.4",
"automattic/jetpack-password-checker": "^0.3.2",
"automattic/jetpack-ip": "^0.2.3",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/i18n-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
),
'jetpack-connection' => array(
'path' => 'jetpack_vendor/automattic/jetpack-connection',
'ver' => '2.12.5',
'ver' => '2.13.0-alpha1725337798',
),
'jetpack-explat' => array(
'path' => 'jetpack_vendor/automattic/jetpack-explat',
Expand Down
2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-plans/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.0",
"automattic/jetpack-connection": "^2.12.5"
"automattic/jetpack-connection": "^2.13.0-alpha"
},
"require-dev": {
"yoast/phpunit-polyfills": "^1.1.1",
Expand Down
1 change: 1 addition & 0 deletions vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'Automattic\\Jetpack\\Config' => $baseDir . '/jetpack_vendor/automattic/jetpack-config/src/class-config.php',
'Automattic\\Jetpack\\Connection\\Authorize_Json_Api' => $baseDir . '/jetpack_vendor/automattic/jetpack-connection/src/class-authorize-json-api.php',
'Automattic\\Jetpack\\Connection\\Client' => $baseDir . '/jetpack_vendor/automattic/jetpack-connection/src/class-client.php',
'Automattic\\Jetpack\\Connection\\Connection_Assets' => $baseDir . '/jetpack_vendor/automattic/jetpack-connection/src/class-connection-assets.php',
'Automattic\\Jetpack\\Connection\\Connection_Notice' => $baseDir . '/jetpack_vendor/automattic/jetpack-connection/src/class-connection-notice.php',
'Automattic\\Jetpack\\Connection\\Error_Handler' => $baseDir . '/jetpack_vendor/automattic/jetpack-connection/src/class-error-handler.php',
'Automattic\\Jetpack\\Connection\\Initial_State' => $baseDir . '/jetpack_vendor/automattic/jetpack-connection/src/class-initial-state.php',
Expand Down
1 change: 1 addition & 0 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class ComposerStaticInitb462338fb66be23595d68a93345c9e3d_jetpack_searchⓥ3_0_0_
'Automattic\\Jetpack\\Config' => __DIR__ . '/../..' . '/jetpack_vendor/automattic/jetpack-config/src/class-config.php',
'Automattic\\Jetpack\\Connection\\Authorize_Json_Api' => __DIR__ . '/../..' . '/jetpack_vendor/automattic/jetpack-connection/src/class-authorize-json-api.php',
'Automattic\\Jetpack\\Connection\\Client' => __DIR__ . '/../..' . '/jetpack_vendor/automattic/jetpack-connection/src/class-client.php',
'Automattic\\Jetpack\\Connection\\Connection_Assets' => __DIR__ . '/../..' . '/jetpack_vendor/automattic/jetpack-connection/src/class-connection-assets.php',
'Automattic\\Jetpack\\Connection\\Connection_Notice' => __DIR__ . '/../..' . '/jetpack_vendor/automattic/jetpack-connection/src/class-connection-notice.php',
'Automattic\\Jetpack\\Connection\\Error_Handler' => __DIR__ . '/../..' . '/jetpack_vendor/automattic/jetpack-connection/src/class-error-handler.php',
'Automattic\\Jetpack\\Connection\\Initial_State' => __DIR__ . '/../..' . '/jetpack_vendor/automattic/jetpack-connection/src/class-initial-state.php',
Expand Down
Loading

0 comments on commit 0c30661

Please sign in to comment.