Repository navigation
feat: add legacy script types and auto-infer child pattern in syncRules - #295
Open
mohammadaboalnadar wants to merge 3 commits into
Open
mohammadaboalnadar wants to merge 3 commits into
mohammadaboalnadar wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces explicit support for legacy script types (
LegacyServerScriptandLegacyClientScript) insyncRules, preserves default sync rules when custom rules are defined, and automatically infers directory entry point patterns from rule suffixes.The
LegacyServerScriptandLegacyClientScriptvariants were taken directly from Rojo's implementation to ensure seamless cross-compatibility between project schemas. This was developed primarily for internal use within our development team to achieve full cross-compatibility across our projects, and we are submitting it upstream so the Argon community can take advantage of it.Problem Statement
emitLegacyScripts: falsebecoming standard for modern RunContext workflows, projects still occasionally require true legacyLocalScriptinstances (e.g. forReplicatedFirst, character containers, or legacy tool scripts). Previously, there was no way to force legacy script types viasyncRuleswithout mutating global project flags or adding.meta.jsonfiles.Meta::from_project, defining customsyncRulesin*.project.jsonreplaced the entire rule list, dropping built-in rules likedefault_sync_rules(). As a result, standard libraries usinginit.luau(such asCameraShaker/init.luau) were turned intoFolderinstances with a nestedinitscript instead of a singleModuleScript.Solution
Legacy Script Types in Middleware & ScriptType:
Added
LegacyServerScriptandLegacyClientScriptvariants toMiddlewareandScriptType, adopting the exact naming and semantics from Rojo (legacyServerScriptandlegacyClientScript). These guarantee emission ofLocalScriptand legacyScriptinstances regardless of theemitLegacyScriptsproject setting.Auto-Inference of Directory Child Patterns:
In
Meta::from_project, when a rule specifies asuffix(e.g..local.luau), Argon automatically generates the correspondingchild_pattern(init{suffix}, such asinit.local.luau).Preservation of Built-in Sync Rules:
Meta::from_projectnow appendsdefault_sync_rules()after custom user rules, ensuring built-in conventions (init.luau,init.server.luau, etc.) remain fully functional when custom rules are present.Default Rules for Common Legacy Suffixes:
Added built-in recognition for
*.local.luau,*.legacy.luau,*.local.lua, and*.legacy.luainsrc/constants.rs.Lint Cleanup:
Fixed redundant reference warning in
src/util.rs(useless_borrows_in_formatting).Verification
CameraShaker/init.luauandFinishTPHandler/init.local.luau).AI Disclosure
AI was used to assist in the creation of this pull request body and implementation. I am not an experienced Rust developer personally, so while I understand what is going on, I am not fully aware or experienced in general Rust or specific Argon coding practices, so I trusted my AI for the technical details rather than the high-level design. I am open to making edits and correcting any code if highlighted by someone more experienced.