dominus-cli 2.0.0 → 2.1.1

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.
Binary file
@@ -1,117 +0,0 @@
1
- --[[
2
- Code executor: safely run Luau code in the Studio plugin context
3
- ]]
4
-
5
- local Executor = {}
6
-
7
- function Executor.run(code)
8
- local output = {}
9
- local startTime = os.clock()
10
-
11
- -- Capture prints by temporarily overriding
12
- local oldPrint = print
13
- local oldWarn = warn
14
- local capturedOutput = {}
15
-
16
- local env = setmetatable({
17
- print = function(...)
18
- local args = table.pack(...)
19
- local parts = {}
20
- for i = 1, args.n do
21
- table.insert(parts, tostring(args[i]))
22
- end
23
- local line = table.concat(parts, "\t")
24
- table.insert(capturedOutput, line)
25
- oldPrint(...)
26
- end,
27
- warn = function(...)
28
- local args = table.pack(...)
29
- local parts = {}
30
- for i = 1, args.n do
31
- table.insert(parts, tostring(args[i]))
32
- end
33
- local line = "WARN: " .. table.concat(parts, "\t")
34
- table.insert(capturedOutput, line)
35
- oldWarn(...)
36
- end,
37
- game = game,
38
- workspace = workspace,
39
- script = script,
40
- require = require,
41
- task = task,
42
- wait = task.wait,
43
- delay = task.delay,
44
- spawn = task.spawn,
45
- typeof = typeof,
46
- Instance = Instance,
47
- Enum = Enum,
48
- Vector2 = Vector2,
49
- Vector3 = Vector3,
50
- CFrame = CFrame,
51
- Color3 = Color3,
52
- BrickColor = BrickColor,
53
- UDim2 = UDim2,
54
- UDim = UDim,
55
- Ray = Ray,
56
- Region3 = Region3,
57
- NumberRange = NumberRange,
58
- NumberSequence = NumberSequence,
59
- ColorSequence = ColorSequence,
60
- Rect = Rect,
61
- TweenInfo = TweenInfo,
62
- math = math,
63
- string = string,
64
- table = table,
65
- coroutine = coroutine,
66
- os = os,
67
- tostring = tostring,
68
- tonumber = tonumber,
69
- type = type,
70
- pairs = pairs,
71
- ipairs = ipairs,
72
- next = next,
73
- select = select,
74
- unpack = unpack or table.unpack,
75
- pcall = pcall,
76
- xpcall = xpcall,
77
- error = error,
78
- assert = assert,
79
- rawget = rawget,
80
- rawset = rawset,
81
- setmetatable = setmetatable,
82
- getmetatable = getmetatable,
83
- }, {
84
- __index = function(_, key)
85
- return game:GetService(key)
86
- end,
87
- })
88
-
89
- local fn, compileErr = loadstring(code)
90
- if not fn then
91
- return {
92
- output = table.concat(capturedOutput, "\n"),
93
- error = "Compile error: " .. tostring(compileErr),
94
- duration = os.clock() - startTime,
95
- }
96
- end
97
-
98
- setfenv(fn, env)
99
- local ok, runtimeErr = pcall(fn)
100
-
101
- local duration = os.clock() - startTime
102
-
103
- if not ok then
104
- return {
105
- output = table.concat(capturedOutput, "\n"),
106
- error = "Runtime error: " .. tostring(runtimeErr),
107
- duration = duration,
108
- }
109
- end
110
-
111
- return {
112
- output = table.concat(capturedOutput, "\n"),
113
- duration = duration,
114
- }
115
- end
116
-
117
- return Executor