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

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.
@@ -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,18 +30,27 @@ 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
56
  self.log("DEBUG", `[{tag}][{app}] {message}`, data, debug.traceback(nil, 3))
@@ -49,9 +59,7 @@ do
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}`
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.2",
4
4
  "description": "An App Manager for Vide",
5
5
  "main": "out/init.lua",
6
6
  "types": "out/index.d.ts",