Add npm man page, --clean flag for bundle:compile, fix subclass checks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-12-09 21:16:16 +00:00
parent 46b45e6762
commit d71f7a6615
6 changed files with 315 additions and 26 deletions

View File

@@ -16,7 +16,8 @@ class Bundle_Compile_Command extends Command
*/
protected $signature = 'rsx:bundle:compile
{bundle? : Bundle class name to compile (optional, compiles all if not specified)}
{--build-debug : Enable verbose build output (shows detailed compilation steps)}';
{--build-debug : Enable verbose build output (shows detailed compilation steps)}
{--clean : Clear all caches before compiling (runs rsx:clean first)}';
/**
* The console command description.
@@ -47,6 +48,24 @@ class Bundle_Compile_Command extends Command
// Prevent being called via $this->call() - must use passthru for fresh process
$this->prevent_call_from_another_command();
// Handle --clean flag: run rsx:clean then re-invoke without --clean
if ($this->option('clean')) {
$this->info('Clearing caches before compile...');
passthru('php artisan rsx:clean');
// Build command with all args except --clean
$cmd = 'php artisan rsx:bundle:compile';
if ($this->argument('bundle')) {
$cmd .= ' ' . escapeshellarg($this->argument('bundle'));
}
if ($this->option('build-debug')) {
$cmd .= ' --build-debug';
}
passthru($cmd, $exit_code);
exit($exit_code);
}
$bundle_arg = $this->argument('bundle');
// Get all MODULE bundle classes from manifest (not asset bundles)
@@ -56,11 +75,10 @@ class Bundle_Compile_Command extends Command
$bundle_classes = [];
foreach ($manifest_data as $file_info) {
if (isset($file_info['extends']) && $file_info['extends'] === 'Rsx_Module_Bundle_Abstract') {
$fqcn = $file_info['fqcn'] ?? $file_info['class'] ?? null;
if ($fqcn) {
$bundle_classes[$fqcn] = $file_info['class'] ?? $fqcn;
}
$class_name = $file_info['class'] ?? null;
if ($class_name && Manifest::php_is_subclass_of($class_name, 'Rsx_Module_Bundle_Abstract')) {
$fqcn = $file_info['fqcn'] ?? $class_name;
$bundle_classes[$fqcn] = $class_name;
}
}
@@ -180,14 +198,22 @@ class Bundle_Compile_Command extends Command
$this->line(' JS: ' . $this->format_size($js_size) . " → app.{$bundle_hash}.js");
$this->line(' CSS: ' . $this->format_size($css_size) . " → app.{$bundle_hash}.css");
} else {
// In dev mode, show the actual split files
// In dev mode, show the actual split files (vendor and app)
if (isset($compiled['vendor_js_bundle_path'])) {
$vendor_js_size = filesize("{$bundle_dir}/{$compiled['vendor_js_bundle_path']}");
$this->line(' Vendor JS: ' . $this->format_size($vendor_js_size) . ' → ' . basename($compiled['vendor_js_bundle_path']));
}
if (isset($compiled['vendor_css_bundle_path'])) {
$vendor_css_size = filesize("{$bundle_dir}/{$compiled['vendor_css_bundle_path']}");
$this->line(' Vendor CSS: ' . $this->format_size($vendor_css_size) . ' → ' . basename($compiled['vendor_css_bundle_path']));
}
if (isset($compiled['app_js_bundle_path'])) {
$app_js_size = filesize("{$bundle_dir}/{$compiled['app_js_bundle_path']}");
$this->line(' JS: ' . $this->format_size($app_js_size) . ' → ' . basename($compiled['app_js_bundle_path']));
$this->line(' App JS: ' . $this->format_size($app_js_size) . ' → ' . basename($compiled['app_js_bundle_path']));
}
if (isset($compiled['app_css_bundle_path'])) {
$app_css_size = filesize("{$bundle_dir}/{$compiled['app_css_bundle_path']}");
$this->line(' CSS: ' . $this->format_size($app_css_size) . ' → ' . basename($compiled['app_css_bundle_path']));
$this->line(' App CSS: ' . $this->format_size($app_css_size) . ' → ' . basename($compiled['app_css_bundle_path']));
}
}