mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Enhance script handling and UI consistency
- Added support for encoding the RunContext property in the Script class to determine file suffixes (.server.luau, .client.luau, .plugin.luau, .legacy.luau). - Updated the Confirming.lua file to improve UI consistency in the confirmation message display. - Modified snapshot middleware and syncback logic to accommodate new file extensions and ensure proper handling of plugin scripts. - Refactored tests to align with the new naming conventions for script suffixes and improved path uniqueness checks.
This commit is contained in:
parent
38cbc582f4
commit
18a74c8e4d
7 changed files with 95 additions and 87 deletions
|
|
@ -39,6 +39,7 @@ pub fn name_for_inst<'old>(
|
|||
| Middleware::ServerScriptDir
|
||||
| Middleware::ClientScriptDir
|
||||
| Middleware::ModuleScriptDir
|
||||
| Middleware::PluginScriptDir
|
||||
| Middleware::LocalScriptDir
|
||||
| Middleware::LegacyScriptDir => {
|
||||
let name = if encode_invalid_chars {
|
||||
|
|
@ -110,6 +111,7 @@ pub fn extension_for_middleware(middleware: Middleware) -> &'static str {
|
|||
| Middleware::ServerScriptDir
|
||||
| Middleware::ClientScriptDir
|
||||
| Middleware::ModuleScriptDir
|
||||
| Middleware::PluginScriptDir
|
||||
| Middleware::LocalScriptDir
|
||||
| Middleware::LegacyScriptDir => {
|
||||
unimplemented!("directory middleware requires special treatment")
|
||||
|
|
|
|||
|
|
@ -383,7 +383,7 @@ pub fn get_best_middleware(snapshot: &SyncbackSnapshot) -> Middleware {
|
|||
Middleware::ServerScript => Middleware::ServerScriptDir,
|
||||
Middleware::ClientScript => Middleware::ClientScriptDir,
|
||||
Middleware::ModuleScript => Middleware::ModuleScriptDir,
|
||||
Middleware::PluginScript => Middleware::ServerScriptDir, // Plugin scripts with children use server script dir for now
|
||||
Middleware::PluginScript => Middleware::PluginScriptDir,
|
||||
Middleware::LegacyScript => Middleware::LegacyScriptDir,
|
||||
Middleware::LocalScript => Middleware::LocalScriptDir,
|
||||
Middleware::Csv => Middleware::CsvDir,
|
||||
|
|
|
|||
|
|
@ -71,7 +71,10 @@ fn compute_refs_with_duplicate_siblings(dom: &WeakDom) -> HashSet<Ref> {
|
|||
let mut name_to_refs: HashMap<&str, Vec<Ref>> = HashMap::new();
|
||||
for child_ref in inst.children() {
|
||||
if let Some(child) = dom.get_by_ref(*child_ref) {
|
||||
name_to_refs.entry(&child.name).or_default().push(*child_ref);
|
||||
name_to_refs
|
||||
.entry(&child.name)
|
||||
.or_default()
|
||||
.push(*child_ref);
|
||||
}
|
||||
queue.push_back(*child_ref);
|
||||
}
|
||||
|
|
@ -157,9 +160,9 @@ pub fn collect_referents(dom: &WeakDom, pre_prune_paths: &HashMap<Ref, String>)
|
|||
// Check if target exists in current DOM
|
||||
if let Some(_target) = dom.get_by_ref(*target_ref) {
|
||||
// Target exists - check if path is unique (with caching)
|
||||
let is_unique = *path_unique_cache
|
||||
.entry(*target_ref)
|
||||
.or_insert_with(|| is_path_unique_with_cache(dom, *target_ref, &has_duplicate_siblings));
|
||||
let is_unique = *path_unique_cache.entry(*target_ref).or_insert_with(|| {
|
||||
is_path_unique_with_cache(dom, *target_ref, &has_duplicate_siblings)
|
||||
});
|
||||
|
||||
if is_unique {
|
||||
// Path is unique - use path-based system
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue