Skip to content

Commit e1ec10c

Browse files
committed
Merge branch 'trunk' into add/site-health-check-for-od-rest-api
2 parents a2baa65 + 1be4573 commit e1ec10c

File tree

8 files changed

+11
-58
lines changed

8 files changed

+11
-58
lines changed

.github/workflows/deploy-plugins.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ jobs:
6969
- name: Install npm dependencies
7070
run: npm ci
7171

72-
- name: Check plugin versions
73-
run: npm run versions -- --plugin=${{ matrix.plugin }}
74-
7572
- name: Build plugin
7673
run: npm run build:plugin:${{ matrix.plugin }}
7774

@@ -101,6 +98,10 @@ jobs:
10198
10299
echo "deploy=true" >> $GITHUB_OUTPUT
103100
101+
- name: Check plugin version integrity
102+
if: steps.check-deployment.outputs.deploy == 'true'
103+
run: npm run versions -- --plugin=${{ matrix.plugin }}
104+
104105
- name: Create zip file
105106
if: steps.check-deployment.outputs.deploy == 'true'
106107
run: |

plugins/embed-optimizer/hooks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function embed_optimizer_filter_extension_module_urls( $extension_module_urls ):
121121
if ( ! is_array( $extension_module_urls ) ) {
122122
$extension_module_urls = array();
123123
}
124-
$extension_module_urls[] = add_query_arg( 'ver', EMBED_OPTIMIZER_VERSION, plugin_dir_url( __FILE__ ) . embed_optimizer_get_asset_path( 'detect.js' ) );
124+
$extension_module_urls[] = plugins_url( add_query_arg( 'ver', EMBED_OPTIMIZER_VERSION, embed_optimizer_get_asset_path( 'detect.js' ) ), __FILE__ );
125125
return $extension_module_urls;
126126
}
127127

plugins/image-prioritizer/detect.js

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,6 @@ function log( ...message ) {
4343
console.log( consoleLogPrefix, ...message );
4444
}
4545

46-
/**
47-
* Logs a warning.
48-
*
49-
* @since 0.3.0
50-
*
51-
* @param {...*} message
52-
*/
53-
function warn( ...message ) {
54-
// eslint-disable-next-line no-console
55-
console.warn( consoleLogPrefix, ...message );
56-
}
57-
5846
/**
5947
* Initializes extension.
6048
*
@@ -77,27 +65,6 @@ export async function initialize( { isDebug, onLCP } ) {
7765
);
7866
}
7967

80-
/**
81-
* Gets the performance resource entry for a given URL.
82-
*
83-
* @since 0.3.0
84-
*
85-
* @param {string} url - Resource URL.
86-
* @return {PerformanceResourceTiming|null} Resource entry or null.
87-
*/
88-
function getPerformanceResourceByURL( url ) {
89-
const entries =
90-
/** @type PerformanceResourceTiming[] */ performance.getEntriesByType(
91-
'resource'
92-
);
93-
for ( const entry of entries ) {
94-
if ( entry.name === url ) {
95-
return entry;
96-
}
97-
}
98-
return null;
99-
}
100-
10168
/**
10269
* Handles a new LCP metric being reported.
10370
*
@@ -129,21 +96,6 @@ function handleLCPMetric( metric, isDebug ) {
12996
continue;
13097
}
13198

132-
// Now only consider proceeding with the URL if its loading was initiated with stylesheet or preload link.
133-
const resourceEntry = getPerformanceResourceByURL( entry.url );
134-
if (
135-
! resourceEntry ||
136-
! [ 'css', 'link' ].includes( resourceEntry.initiatorType )
137-
) {
138-
if ( isDebug ) {
139-
warn(
140-
`Skipped considering URL (${ entry.url }) due to unexpected performance resource timing entry:`,
141-
resourceEntry
142-
);
143-
}
144-
return;
145-
}
146-
14799
// Skip URLs that are excessively long. This is the maxLength defined in image_prioritizer_add_element_item_schema_properties().
148100
if ( entry.url.length > 500 ) {
149101
if ( isDebug ) {

plugins/image-prioritizer/helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function image_prioritizer_filter_extension_module_urls( $extension_module_urls
9393
if ( ! is_array( $extension_module_urls ) ) {
9494
$extension_module_urls = array();
9595
}
96-
$extension_module_urls[] = add_query_arg( 'ver', IMAGE_PRIORITIZER_VERSION, plugin_dir_url( __FILE__ ) . image_prioritizer_get_asset_path( 'detect.js' ) );
96+
$extension_module_urls[] = plugins_url( add_query_arg( 'ver', IMAGE_PRIORITIZER_VERSION, image_prioritizer_get_asset_path( 'detect.js' ) ), __FILE__ );
9797
return $extension_module_urls;
9898
}
9999

plugins/optimization-detective/detection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function od_get_cache_purge_post_id(): ?int {
7171
*/
7272
function od_get_detection_script( string $slug, OD_URL_Metric_Group_Collection $group_collection ): string {
7373
$web_vitals_lib_data = require __DIR__ . '/build/web-vitals.asset.php';
74-
$web_vitals_lib_src = add_query_arg( 'ver', $web_vitals_lib_data['version'], plugin_dir_url( __FILE__ ) . 'build/web-vitals.js' );
74+
$web_vitals_lib_src = plugins_url( add_query_arg( 'ver', $web_vitals_lib_data['version'], 'build/web-vitals.js' ), __FILE__ );
7575

7676
/**
7777
* Filters the list of extension script module URLs to import when performing detection.
@@ -118,7 +118,7 @@ static function ( OD_URL_Metric_Group $group ): array {
118118
return wp_get_inline_script_tag(
119119
sprintf(
120120
'import detect from %s; detect( %s );',
121-
wp_json_encode( add_query_arg( 'ver', OPTIMIZATION_DETECTIVE_VERSION, plugin_dir_url( __FILE__ ) . od_get_asset_path( 'detect.js' ) ) ),
121+
wp_json_encode( plugins_url( add_query_arg( 'ver', OPTIMIZATION_DETECTIVE_VERSION, od_get_asset_path( 'detect.js' ) ), __FILE__ ) ),
122122
wp_json_encode( $detect_args )
123123
),
124124
array( 'type' => 'module' )

plugins/optimization-detective/readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ For example:
257257
add_filter(
258258
'od_extension_module_urls',
259259
static function ( array $extension_module_urls ): array {
260-
$extension_module_urls[] = add_query_arg( 'ver', '1.0', plugin_dir_url( __FILE__ ) . 'detect.js' );
260+
$extension_module_urls[] = plugins_url( add_query_arg( 'ver', '1.0', 'detect.js' ), __FILE__ );
261261
return $extension_module_urls;
262262
}
263263
);

plugins/performance-lab/includes/admin/load.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ function perflab_enqueue_features_page_scripts(): void {
264264
// Enqueue plugin activate AJAX script and localize script data.
265265
wp_enqueue_script(
266266
'perflab-plugin-activate-ajax',
267-
plugin_dir_url( PERFLAB_MAIN_FILE ) . perflab_get_asset_path( 'includes/admin/plugin-activate-ajax.js' ),
267+
plugins_url( perflab_get_asset_path( 'includes/admin/plugin-activate-ajax.js' ), PERFLAB_MAIN_FILE ),
268268
array( 'wp-i18n', 'wp-a11y', 'wp-api-fetch' ),
269269
PERFLAB_VERSION,
270270
true

plugins/web-worker-offloading/helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function plwwo_get_configuration(): array {
2323
$config = array(
2424
// The source code in the build directory is compiled from <https://github.com/BuilderIO/partytown/tree/main/src/lib>.
2525
// See webpack config in the WordPress/performance repo: <https://github.com/WordPress/performance/blob/282a068f3eb2575d37aeb9034e894e7140fcddca/webpack.config.js#L84-L130>.
26-
'lib' => wp_parse_url( plugin_dir_url( __FILE__ ), PHP_URL_PATH ) . 'build/',
26+
'lib' => wp_parse_url( plugins_url( 'build/', __FILE__ ), PHP_URL_PATH ),
2727
);
2828

2929
if ( WP_DEBUG && SCRIPT_DEBUG ) {

0 commit comments

Comments
 (0)