mirror of
https://github.com/littensy/charm.git
synced 2026-10-20 17:51:37 +00:00
fix: set strict flags if RunService.IsStudio is true
This commit is contained in:
parent
573533058f
commit
d09fb5536b
4 changed files with 10 additions and 10 deletions
|
|
@ -602,7 +602,7 @@ Charm exposes the following global flags to customize behavior:
|
||||||
| frozen | `true`\* | Enforces data immutability by deep-freezing tables passed to signals, excluding objects with metatables. |
|
| frozen | `true`\* | Enforces data immutability by deep-freezing tables passed to signals, excluding objects with metatables. |
|
||||||
| trackInnerEffects | `true` | Whether nested effects should be tracked and cleaned up when the parent effect re-runs. This should only be disabled to debug issues during migration. |
|
| trackInnerEffects | `true` | Whether nested effects should be tracked and cleaned up when the parent effect re-runs. This should only be disabled to debug issues during migration. |
|
||||||
|
|
||||||
The `strict` and `frozen` flags are automatically enabled in Roblox Studio and other development environments where the Luau optimization level is `O1` or lower.
|
The `strict` and `frozen` flags are automatically enabled in Roblox Studio.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
4
packages/charm/src/index.d.ts
vendored
4
packages/charm/src/index.d.ts
vendored
|
|
@ -50,12 +50,12 @@ export const flags: {
|
||||||
/**
|
/**
|
||||||
* Enforces synchronous, non-yielding behavior in signals and effects.
|
* Enforces synchronous, non-yielding behavior in signals and effects.
|
||||||
* Also enables state validation in Charm Sync to catch sync errors early.
|
* Also enables state validation in Charm Sync to catch sync errors early.
|
||||||
* Enabled if the optimization level is below 2, which is true in studio.
|
* Enabled by default in Roblox Studio.
|
||||||
*/
|
*/
|
||||||
strict: boolean;
|
strict: boolean;
|
||||||
/**
|
/**
|
||||||
* Enforces immutability of tables by deep-freezing table values. Enabled
|
* Enforces immutability of tables by deep-freezing table values. Enabled
|
||||||
* if the optimization level is below 2, which is true in studio.
|
* by default in Roblox Studio.
|
||||||
*/
|
*/
|
||||||
frozen: boolean;
|
frozen: boolean;
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -68,22 +68,22 @@ local batchDepth = 0
|
||||||
-- Dependencies accessed during this time will link to the active subscriber.
|
-- Dependencies accessed during this time will link to the active subscriber.
|
||||||
local activeSub: ReactiveNode?
|
local activeSub: ReactiveNode?
|
||||||
|
|
||||||
local function isO2(): boolean
|
local function isStudio(): boolean
|
||||||
return debug.info(1, "n") ~= "isO2"
|
return game ~= nil and game:GetService("RunService"):IsStudio()
|
||||||
end
|
end
|
||||||
|
|
||||||
local flags = {
|
local flags = {
|
||||||
--[[
|
--[[
|
||||||
Enforces synchronous, non-yielding behavior in signals and effects.
|
Enforces synchronous, non-yielding behavior in signals and effects.
|
||||||
Also enables state validation in Charm Sync to catch sync errors early.
|
Also enables state validation in Charm Sync to catch sync errors early.
|
||||||
Enabled if the optimization level is below 2, which is true in studio.
|
Enabled by default in Roblox Studio.
|
||||||
]]
|
]]
|
||||||
strict = not isO2(),
|
strict = isStudio(),
|
||||||
--[[
|
--[[
|
||||||
Enforces immutability of tables by deep-freezing table values. Enabled
|
Enforces immutability of tables by deep-freezing table values. Enabled
|
||||||
if the optimization level is below 2, which is true in studio.
|
by default in Roblox Studio.
|
||||||
]]
|
]]
|
||||||
frozen = not isO2(),
|
frozen = isStudio(),
|
||||||
--[[
|
--[[
|
||||||
Whether parent effects should track inner effects and clean them up
|
Whether parent effects should track inner effects and clean them up
|
||||||
when the parent effect re-runs. This is usually desirable, but can be
|
when the parent effect re-runs. This is usually desirable, but can be
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[tools]
|
[tools]
|
||||||
wally = "UpliftGames/wally@0.3.2"
|
wally = "UpliftGames/wally@0.3.2"
|
||||||
rojo = "rojo-rbx/rojo@7.6.1"
|
rojo = "rojo-rbx/rojo@7.7.0-rc.1"
|
||||||
stylua = "johnnymorganz/stylua@2.5.2"
|
stylua = "johnnymorganz/stylua@2.5.2"
|
||||||
luau-lsp = "johnnymorganz/luau-lsp@1.68.1"
|
luau-lsp = "johnnymorganz/luau-lsp@1.68.1"
|
||||||
lute = "luau-lang/lute@1.0.0"
|
lute = "luau-lang/lute@1.0.0"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue