Refactor filename naming system and apply convention-based renames

Standardize settings file naming and relocate documentation files
Fix code quality violations from rsx:check
Reorganize user_management directory into logical subdirectories
Move Quill Bundle to core and align with Tom Select pattern
Simplify Site Settings page to focus on core site information
Complete Phase 5: Multi-tenant authentication with login flow and site selection
Add route query parameter rule and synchronize filename validation logic
Fix critical bug in UpdateNpmCommand causing missing JavaScript stubs
Implement filename convention rule and resolve VS Code auto-rename conflict
Implement js-sanitizer RPC server to eliminate 900+ Node.js process spawns
Implement RPC server architecture for JavaScript parsing
WIP: Add RPC server infrastructure for JS parsing (partial implementation)
Update jqhtml terminology from destroy to stop, fix datagrid DOM preservation
Add JQHTML-CLASS-01 rule and fix redundant class names
Improve code quality rules and resolve violations
Remove legacy fatal error format in favor of unified 'fatal' error type
Filter internal keys from window.rsxapp output
Update button styling and comprehensive form/modal documentation
Add conditional fly-in animation for modals
Fix non-deterministic bundle compilation

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-13 19:10:02 +00:00
parent fc494c1e08
commit 77b4d10af8
28155 changed files with 2191860 additions and 12967 deletions

View File

@@ -7,6 +7,7 @@ use RecursiveCallbackFilterIterator;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use RuntimeException;
use App\RSpade\Core\Locks\RsxLocks;
use App\RSpade\Core\Manifest\Manifest;
/**
@@ -101,6 +102,11 @@ class BundleCompiler
*/
protected array $babel_file_mapping = [];
/**
* Bundle build lock token (prevents parallel RPC server interference)
*/
protected ?string $bundle_build_lock = null;
/**
* Compile a bundle
*/
@@ -139,8 +145,28 @@ class BundleCompiler
// Step 7-10: Process bundles that need compilation
if (!empty($need_compile)) {
console_debug('BUNDLE', 'Processing bundles: ' . json_encode($need_compile));
$this->_process_bundles($need_compile);
console_debug('BUNDLE', 'Acquiring bundle build lock');
// Get a bundle build lock to prevent parallel RPC server interference
$this->bundle_build_lock = RsxLocks::get_lock(
RsxLocks::SERVER_LOCK,
RsxLocks::LOCK_BUNDLE_BUILD,
RsxLocks::WRITE_LOCK,
config('rsx.locking.timeout', 30)
);
console_debug('BUNDLE', 'Bundle build lock acquired, double-checking cache');
// Double-check cache after acquiring lock (race condition protection)
// Maybe another process just finished compiling while we were waiting
$need_compile = $this->_check_bundle_caches();
if (!empty($need_compile)) {
console_debug('BUNDLE', 'Processing bundles: ' . json_encode($need_compile));
$this->_process_bundles($need_compile);
} else {
console_debug('BUNDLE', 'Cache updated by another process, using cache');
}
} else {
console_debug('BUNDLE', 'No bundles need processing, using cache');
}
@@ -529,17 +555,17 @@ class BundleCompiler
if ($extension === 'js') {
$this->public_assets['js'][] = [
'url' => '/' . $relative_path,
'full_path' => $full_path
'full_path' => $full_path,
];
} elseif ($extension === 'css') {
$this->public_assets['css'][] = [
'url' => '/' . $relative_path,
'full_path' => $full_path
'full_path' => $full_path,
];
} else {
throw new RuntimeException(
"Public asset must be .js or .css file: {$item}\n" .
"Only JavaScript and CSS files can be included via /public/ prefix."
'Only JavaScript and CSS files can be included via /public/ prefix.'
);
}
@@ -634,7 +660,7 @@ class BundleCompiler
throw new RuntimeException(
"'system/app/' is not a valid RSpade path. Use 'app/' instead.\n" .
"Invalid path: {$item}\n" .
"Correct path: " . str_replace('system/app/', 'app/', $item) . "\n\n" .
'Correct path: ' . str_replace('system/app/', 'app/', $item) . "\n\n" .
'From the bundle perspective, framework code is at app/, not system/app/'
);
}
@@ -643,7 +669,7 @@ class BundleCompiler
throw new RuntimeException(
"'system/rsx/' is not a valid RSpade path. Use 'rsx/' instead.\n" .
"Invalid path: {$item}\n" .
"Correct path: " . str_replace('system/rsx/', 'rsx/', $item) . "\n\n" .
'Correct path: ' . str_replace('system/rsx/', 'rsx/', $item) . "\n\n" .
'From the bundle perspective, application code is at rsx/, not system/rsx/'
);
}
@@ -984,7 +1010,8 @@ class BundleCompiler
*/
protected function _write_temp_file(string $content, string $extension): string
{
$path = storage_path('rsx-tmp/bundle_' . uniqid() . '.' . $extension);
$hash = substr(md5($content), 0, 8);
$path = storage_path('rsx-tmp/bundle_' . $this->bundle_name . '_' . $hash . '.' . $extension);
file_put_contents($path, $content);
return $path;
@@ -1360,11 +1387,11 @@ implode("\n", array_map(fn ($f) => ' - ' . str_replace(base_path() . '/', '',
};
// Process all class files
foreach ($class_files as $file) {
if (!isset($visited[$file])) {
$visit($file); //??
}
foreach ($class_files as $file) {
if (!isset($visited[$file])) {
$visit($file); //??
}
}
// try {
// (code above was here)
@@ -1435,7 +1462,7 @@ implode("\n", array_map(fn ($f) => ' - ' . str_replace(base_path() . '/', '',
}
// Use the cache key hash for filenames
$hash = isset($this->cache_keys[$type]) ? substr($this->cache_keys[$type], 0, 8) : substr(md5(uniqid()), 0, 8);
$hash = isset($this->cache_keys[$type]) ? substr($this->cache_keys[$type], 0, 8) : substr(md5($this->bundle_name . '_' . $type), 0, 8);
// Clean old files for this type only
$old_files = glob("{$bundle_dir}/{$this->bundle_name}__{$type}.*");
@@ -1817,7 +1844,7 @@ implode("\n", array_map(fn ($f) => ' - ' . str_replace(base_path() . '/', '',
}
// Write config to temp file
$config_file = storage_path('rsx-tmp/bundle_config_' . uniqid() . '.js');
$config_file = storage_path('rsx-tmp/bundle_config_' . $this->bundle_name . '.js');
file_put_contents($config_file, implode("\n", $config_content) . "\n");
$files_to_concat[] = $config_file;
}
@@ -1842,7 +1869,7 @@ implode("\n", array_map(fn ($f) => ' - ' . str_replace(base_path() . '/', '',
$transformed_code = \App\RSpade\Core\JavaScript\Js_Transformer::transform($file);
// Write transformed code to a temp file
$temp_file = storage_path('rsx-tmp/babel_' . md5($file) . '_' . uniqid() . '.js');
$temp_file = storage_path('rsx-tmp/babel_' . md5($file) . '.js');
file_put_contents($temp_file, $transformed_code);
// Store mapping: original file => babel file
@@ -1865,7 +1892,7 @@ implode("\n", array_map(fn ($f) => ' - ' . str_replace(base_path() . '/', '',
$files_to_concat = array_merge($files_to_concat, $files);
// Use Node.js script to concatenate with source map support
$output_file = storage_path('rsx-tmp/bundle_output_' . uniqid() . '.js');
$output_file = storage_path('rsx-tmp/bundle_output_' . $this->bundle_name . '.js');
$concat_script = base_path('app/RSpade/Core/Bundle/resource/concat-js.js');
// Build the command
@@ -1932,8 +1959,8 @@ implode("\n", array_map(fn ($f) => ' - ' . str_replace(base_path() . '/', '',
*/
protected function _compile_css_files(array $files): string
{
// Use Node.js script to concatenate with source map support (mirrors JS approach)
$output_file = storage_path('rsx-tmp/css_bundle_' . uniqid() . '.css');
// Use Node.js script to concatenate with source map support
$output_file = storage_path('rsx-tmp/css_bundle_' . $this->bundle_name . '.css');
$concat_script = base_path('app/RSpade/Core/Bundle/resource/concat-css.js');
// Build the command