@wordpress/build 0.4.1-next.8fd3f8831.0 → 0.5.1-next.79a2f3cdd.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,8 @@ foreach ( $routes as $route ) {
28
28
  // Helper function to register routes for a page
29
29
  $register_routes_callback = function ( $page_routes, $page_slug_underscore, $register_function_name ) {
30
30
  return function () use ( $page_routes, $page_slug_underscore, $register_function_name ) {
31
+ // Load build constants
32
+ $build_constants = require __DIR__ . '/constants.php';
31
33
  foreach ( $page_routes as $route ) {
32
34
  $content_handle = null;
33
35
  $route_handle = null;
@@ -41,7 +43,7 @@ $register_routes_callback = function ( $page_routes, $page_slug_underscore, $reg
41
43
  $extension = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.js' : '.min.js';
42
44
  wp_register_script_module(
43
45
  $content_handle,
44
- {{BASE_URL}} . '/routes/' . $route['name'] . '/content' . $extension,
46
+ $build_constants['build_url'] . 'routes/' . $route['name'] . '/content' . $extension,
45
47
  $content_asset['module_dependencies'] ?? array(),
46
48
  $content_asset['version'] ?? false
47
49
  );
@@ -57,7 +59,7 @@ $register_routes_callback = function ( $page_routes, $page_slug_underscore, $reg
57
59
  $extension = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.js' : '.min.js';
58
60
  wp_register_script_module(
59
61
  $route_handle,
60
- {{BASE_URL}} . '/routes/' . $route['name'] . '/route' . $extension,
62
+ $build_constants['build_url'] . 'routes/' . $route['name'] . '/route' . $extension,
61
63
  $route_asset['module_dependencies'] ?? array(),
62
64
  $route_asset['version'] ?? false
63
65
  );
@@ -53,7 +53,9 @@ if ( ! function_exists( '{{PREFIX}}_register_package_scripts' ) ) {
53
53
  * Register all package scripts.
54
54
  */
55
55
  function {{PREFIX}}_register_package_scripts( $scripts ) {
56
- $default_version = defined( '{{VERSION_CONSTANT}}' ) && ! SCRIPT_DEBUG ? {{VERSION_CONSTANT}} : time();
56
+ // Load build constants
57
+ $build_constants = require __DIR__ . '/constants.php';
58
+ $default_version = ! SCRIPT_DEBUG ? $build_constants['version'] : time();
57
59
  $extension = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.js' : '.min.js';
58
60
 
59
61
  $scripts_dir = __DIR__ . '/scripts';
@@ -75,7 +77,7 @@ if ( ! function_exists( '{{PREFIX}}_register_package_scripts' ) ) {
75
77
  {{PREFIX}}_override_script(
76
78
  $scripts,
77
79
  $script_data['handle'],
78
- {{BASE_URL}} . '/scripts/' . $script_data['path'] . $extension,
80
+ $build_constants['build_url'] . 'scripts/' . $script_data['path'] . $extension,
79
81
  $dependencies,
80
82
  $version,
81
83
  true
@@ -43,7 +43,10 @@ if ( ! function_exists( '{{PREFIX}}_register_package_styles' ) ) {
43
43
  * @param WP_Styles $styles WP_Styles instance.
44
44
  */
45
45
  function {{PREFIX}}_register_package_styles( $styles ) {
46
- $default_version = defined( '{{VERSION_CONSTANT}}' ) && ! SCRIPT_DEBUG ? {{VERSION_CONSTANT}} : time();
46
+ // Load build constants
47
+ $build_constants = require __DIR__ . '/constants.php';
48
+ $default_version = ! SCRIPT_DEBUG ? $build_constants['version'] : time();
49
+ $suffix = SCRIPT_DEBUG ? '' : '.min';
47
50
 
48
51
  $styles_dir = __DIR__ . '/styles';
49
52
  $styles_file = $styles_dir . '/index.php';
@@ -59,13 +62,14 @@ if ( ! function_exists( '{{PREFIX}}_register_package_styles' ) ) {
59
62
  {{PREFIX}}_override_style(
60
63
  $styles,
61
64
  $style_data['handle'],
62
- {{BASE_URL}} . '/styles/' . $style_data['path'] . '.css',
65
+ $build_constants['build_url'] . 'styles/' . $style_data['path'] . $suffix . '.css',
63
66
  $style_data['dependencies'],
64
67
  $default_version
65
68
  );
66
69
 
67
70
  // Enable RTL support (WordPress automatically loads -rtl.css variant)
68
71
  $styles->add_data( $style_data['handle'], 'rtl', 'replace' );
72
+ $styles->add_data( $style_data['handle'], 'suffix', $suffix );
69
73
  }
70
74
  }
71
75
 
@@ -1,11 +0,0 @@
1
- <?php
2
- /**
3
- * Plugin version constant - Auto-generated by build process.
4
- * Do not edit this file manually.
5
- *
6
- * @package {{PREFIX}}
7
- */
8
-
9
- if ( ! defined( '{{VERSION_CONSTANT}}' ) ) {
10
- define( '{{VERSION_CONSTANT}}', '{{VERSION}}' );
11
- }