Move mode detection from Rsx_Mode to Rsx class
Simplify ajax batching to be mode-based instead of configurable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@ use App\RSpade\Core\Bundle\Rsx_Asset_Bundle_Abstract;
|
||||
use App\RSpade\Core\Bundle\Rsx_Module_Bundle_Abstract;
|
||||
use App\RSpade\Core\Locks\RsxLocks;
|
||||
use App\RSpade\Core\Manifest\Manifest;
|
||||
use App\RSpade\Core\Mode\Rsx_Mode;
|
||||
use App\RSpade\Core\Rsx;
|
||||
|
||||
/**
|
||||
* BundleCompiler - Compiles RSX bundles into JS and CSS files
|
||||
@@ -124,10 +124,10 @@ class BundleCompiler
|
||||
public function compile(string $bundle_class, array $options = []): array
|
||||
{
|
||||
$this->bundle_name = $this->_get_bundle_name($bundle_class);
|
||||
$this->is_production = Rsx_Mode::is_production_like();
|
||||
$this->is_production = Rsx::is_production();
|
||||
$force_build = $options['force_build'] ?? false;
|
||||
|
||||
console_debug('BUNDLE', "Compiling {$this->bundle_name} (mode: " . Rsx_Mode::get() . ')');
|
||||
console_debug('BUNDLE', "Compiling {$this->bundle_name} (mode: " . Rsx::get_mode() . ')');
|
||||
|
||||
// Step 1: In production-like modes, require pre-built bundles (unless force_build)
|
||||
if ($this->is_production && !$force_build) {
|
||||
@@ -443,7 +443,7 @@ class BundleCompiler
|
||||
$bundle_dir = storage_path('rsx-build/bundles');
|
||||
|
||||
// Look for split vendor/app files (current output format)
|
||||
// Future: support merged files when Rsx_Mode::should_merge_bundles()
|
||||
// Future: support merged files when Manifest::_should_merge_bundles()
|
||||
$vendor_js_pattern = "{$bundle_dir}/{$this->bundle_name}__vendor.*.js";
|
||||
$app_js_pattern = "{$bundle_dir}/{$this->bundle_name}__app.*.js";
|
||||
$vendor_css_pattern = "{$bundle_dir}/{$this->bundle_name}__vendor.*.css";
|
||||
@@ -1951,8 +1951,8 @@ implode("\n", array_map(fn ($f) => ' - ' . str_replace(base_path() . '/', '',
|
||||
|
||||
$js_content = $this->_compile_js_files($js_files);
|
||||
|
||||
// Minify JS in production mode only (strips sourcemaps)
|
||||
if (Rsx_Mode::is_production()) {
|
||||
// Minify JS in strict production only (strips sourcemaps, debug keeps them)
|
||||
if (Rsx::is_production() && !Rsx::is_debug()) {
|
||||
$js_content = Minifier::minify_js($js_content, "{$this->bundle_name}__{$type}.js");
|
||||
}
|
||||
|
||||
@@ -1970,8 +1970,8 @@ implode("\n", array_map(fn ($f) => ' - ' . str_replace(base_path() . '/', '',
|
||||
|
||||
$css_content = $this->_compile_css_files($css_files);
|
||||
|
||||
// Minify CSS in production mode only (strips sourcemaps)
|
||||
if (Rsx_Mode::is_production()) {
|
||||
// Minify CSS in strict production only (strips sourcemaps, debug keeps them)
|
||||
if (Rsx::is_production() && !Rsx::is_debug()) {
|
||||
$css_content = Minifier::minify_css($css_content, "{$this->bundle_name}__{$type}.css");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user