@rbxts/app-forge 0.7.2-alpha.1 → 0.7.2-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -162,7 +162,6 @@ do
162
162
  end
163
163
  self.debug:time("render", name)
164
164
  if not (self.loaded[name] ~= nil) then
165
- self.debug:logTag("render", name, "Creating render instance")
166
165
  local render = appClass.constructor.new(props, name):render()
167
166
  apply(render)({
168
167
  Name = "Render",
@@ -19,6 +19,7 @@ local function ParentRule(entry, forge)
19
19
  return nil
20
20
  end
21
21
  forge.debug:logTag("rules", entry, "Closing child app (parent closed)", {
22
+ parent = entry,
22
23
  child = name,
23
24
  })
24
25
  forge:close(name, false)
@@ -1,12 +1,15 @@
1
- export type DebugTag = string;
1
+ export type DebugTag = "render" | "rules" | "state" | "px" | "lifecycle";
2
2
  type LogFn = (level: "DEBUG" | "PERF", message: string, data?: unknown, traceback?: string) => void;
3
3
  export default class Debugger {
4
4
  private readonly log;
5
- private enabled;
6
5
  private timers;
6
+ private enabled;
7
+ private allEnabled;
7
8
  constructor(log: LogFn);
8
9
  enable(tag: DebugTag): void;
9
10
  disable(tag: DebugTag): void;
11
+ enableAll(): void;
12
+ disableAll(): void;
10
13
  isEnabled(tag: DebugTag): boolean;
11
14
  logTag(tag: DebugTag, app: AppNames, message: string, data?: unknown): void;
12
15
  time(tag: DebugTag, app: AppNames): void;
@@ -16,8 +16,9 @@ do
16
16
  end
17
17
  function Debugger:constructor(log)
18
18
  self.log = log
19
- self.enabled = {}
20
19
  self.timers = {}
20
+ self.enabled = {}
21
+ self.allEnabled = false
21
22
  end
22
23
  function Debugger:enable(tag)
23
24
  local _enabled = self.enabled
@@ -29,29 +30,36 @@ do
29
30
  local _tag = tag
30
31
  _enabled[_tag] = nil
31
32
  end
33
+ function Debugger:enableAll()
34
+ self.allEnabled = true
35
+ end
36
+ function Debugger:disableAll()
37
+ self.allEnabled = false
38
+ table.clear(self.enabled)
39
+ end
32
40
  function Debugger:isEnabled(tag)
33
- local _enabled = self.enabled
34
- local _tag = tag
35
- return _enabled[_tag] ~= nil
41
+ local _condition = self.allEnabled
42
+ if not _condition then
43
+ local _enabled = self.enabled
44
+ local _tag = tag
45
+ _condition = _enabled[_tag] ~= nil
46
+ end
47
+ return _condition
36
48
  end
37
49
  function Debugger:logTag(tag, app, message, data)
38
50
  if not RunService:IsStudio() then
39
51
  return nil
40
52
  end
41
- local _enabled = self.enabled
42
- local _tag = tag
43
- if not (_enabled[_tag] ~= nil) then
53
+ if not self:isEnabled(tag) then
44
54
  return nil
45
55
  end
46
- self.log("DEBUG", `[{tag}][{app}] {message}`, data, debug.traceback(nil, 3))
56
+ self.log("DEBUG", `[{tag}][{app}] {message}`, data)
47
57
  end
48
58
  function Debugger:time(tag, app)
49
59
  if not RunService:IsStudio() then
50
60
  return nil
51
61
  end
52
- local _enabled = self.enabled
53
- local _tag = tag
54
- if not (_enabled[_tag] ~= nil) then
62
+ if not self:isEnabled(tag) then
55
63
  return nil
56
64
  end
57
65
  local _timers = self.timers
@@ -63,9 +71,7 @@ do
63
71
  if not RunService:IsStudio() then
64
72
  return nil
65
73
  end
66
- local _enabled = self.enabled
67
- local _tag = tag
68
- if not (_enabled[_tag] ~= nil) then
74
+ if not self:isEnabled(tag) then
69
75
  return nil
70
76
  end
71
77
  local key = `{tag}:{app}`
@@ -29,12 +29,6 @@ local function App(props)
29
29
  logger:log("ERROR", "Attempted to register App without a name", props)
30
30
  error("App registration failed: missing app name", 2)
31
31
  end
32
- logger:log("DEBUG", "Registering App", {
33
- name = props.name,
34
- renderGroup = props.renderGroup,
35
- visible = props.visible,
36
- rules = props.rules,
37
- })
38
32
  local _name_1 = props.name
39
33
  local _arg1 = {
40
34
  constructor = constructor,
@@ -74,11 +74,6 @@ local function usePx(target, baseResolution, minScale)
74
74
  return nil
75
75
  end
76
76
  INITIALIZED = true
77
- logger:log("DEBUG", "Initializing px scaling", {
78
- target = target,
79
- baseResolution = baseResolution,
80
- minScale = minScale,
81
- })
82
77
  if baseResolution then
83
78
  BASE_RESOLUTION(baseResolution)
84
79
  end
@@ -4,6 +4,7 @@ local TS = _G[script]
4
4
  local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
5
5
  -- Packages
6
6
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
7
+ local Vide = _vide
7
8
  local apply = _vide.apply
8
9
  local create = _vide.create
9
10
  local effect = _vide.effect
@@ -109,11 +110,26 @@ do
109
110
  local _name = name
110
111
  local _value = value
111
112
  _sources[_name] = _value
113
+ local prev
114
+ local log = function()
115
+ return self.debug:logTag("state", name, "Visibility changed", {
116
+ from = prev,
117
+ to = value,
118
+ })
119
+ end
120
+ local count = 0
112
121
  effect(function()
113
- value()
122
+ count += 1
123
+ prev = value
114
124
  untrack(function()
115
125
  return self:checkRules(name)
116
126
  end)
127
+ if Vide.strict and count == 1 then
128
+ log()
129
+ count = 0
130
+ else
131
+ log()
132
+ end
117
133
  end)
118
134
  else
119
135
  self.logger:log("WARN", "forge.bind called while game is running", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/app-forge",
3
- "version": "0.7.2-alpha.1",
3
+ "version": "0.7.2-alpha.10",
4
4
  "description": "An App Manager for Vide",
5
5
  "main": "out/init.lua",
6
6
  "types": "out/index.d.ts",