PluginProbe
Web Worker Offloading / 0.3.0
Web Worker Offloading v0.3.0
trunk 0.1.0 0.1.1 0.2.0 0.2.1 0.3.0
web-worker-offloading / load.php

load.php in Web Worker Offloading 0.3.0, at load.php

54 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Web Worker Offloading
4 * Plugin URI: https://github.com/WordPress/performance/issues/176
5 * Description: Offloads select JavaScript execution to a Web Worker to reduce work on the main thread and improve the Interaction to Next Paint (INP) metric.
6 * Requires at least: 6.9
7 * Requires PHP: 7.4
8 * Version: 0.3.0
9 * Author: WordPress Performance Team
10 * Author URI: https://make.wordpress.org/performance/
11 * License: GPLv2 or later
12 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
13 * Text Domain: web-worker-offloading
14 *
15 * @package web-worker-offloading
16 */
17
18 declare( strict_types = 1 );
19
20 // @codeCoverageIgnoreStart
21 if ( ! defined( 'ABSPATH' ) ) {
22 exit; // Exit if accessed directly.
23 }
24
25 // Define the constant.
26 if ( defined( 'WEB_WORKER_OFFLOADING_VERSION' ) ) {
27 return;
28 }
29
30 if (
31 ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) &&
32 ! file_exists( __DIR__ . '/build/partytown.asset.php' )
33 ) {
34 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
35 trigger_error(
36 esc_html(
37 sprintf(
38 /* translators: 1: File path. 2: CLI command. */
39 '[Web Worker Offloading] ' . __( 'Unable to load %1$s. Please make sure you have run %2$s.', 'web-worker-offloading' ),
40 'build/partytown.asset.php',
41 '`npm install && npm run build:plugin:web-worker-offloading`'
42 )
43 ),
44 E_USER_ERROR
45 );
46 }
47
48 define( 'WEB_WORKER_OFFLOADING_VERSION', '0.3.0' );
49
50 require_once __DIR__ . '/helper.php';
51 require_once __DIR__ . '/hooks.php';
52 require_once __DIR__ . '/third-party.php';
53 // @codeCoverageIgnoreEnd
54