@trioforge/crucible 0.0.0-stage → 0.2.0

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.
Files changed (183) hide show
  1. package/LICENSE +21 -0
  2. package/client/package.json +4 -0
  3. package/emit/package.json +4 -0
  4. package/out/all.d.ts +7 -0
  5. package/out/all.luau +2 -0
  6. package/out/attribute.d.ts +7 -0
  7. package/out/attribute.luau +7 -0
  8. package/out/client/index.d.ts +10 -0
  9. package/out/client/init.luau +55 -0
  10. package/out/configs.d.ts +37 -0
  11. package/out/configs.luau +46 -0
  12. package/out/crucible-behaviour.d.ts +16 -0
  13. package/out/crucible-behaviour.luau +78 -0
  14. package/out/crucible-object.d.ts +10 -0
  15. package/out/crucible-object.luau +69 -0
  16. package/out/data.d.ts +224 -0
  17. package/out/data.luau +97 -0
  18. package/out/emit/configs.d.ts +4 -0
  19. package/out/emit/configs.luau +22 -0
  20. package/out/emit/data.d.ts +6 -0
  21. package/out/emit/data.luau +19 -0
  22. package/out/emit/index.d.ts +45 -0
  23. package/out/emit/init.luau +101 -0
  24. package/out/emit/network.d.ts +6 -0
  25. package/out/emit/network.luau +36 -0
  26. package/out/emit/replicated.d.ts +4 -0
  27. package/out/emit/replicated.luau +13 -0
  28. package/out/index.d.ts +20 -0
  29. package/out/init.luau +34 -0
  30. package/out/inject.d.ts +1 -0
  31. package/out/inject.luau +7 -0
  32. package/out/internal/binding.d.ts +1 -0
  33. package/out/internal/binding.luau +615 -0
  34. package/out/internal/boot.d.ts +1 -0
  35. package/out/internal/boot.luau +562 -0
  36. package/out/internal/configs/limits.d.ts +10 -0
  37. package/out/internal/configs/limits.luau +25 -0
  38. package/out/internal/configs/port.d.ts +29 -0
  39. package/out/internal/configs/port.luau +99 -0
  40. package/out/internal/configs/runtime.d.ts +21 -0
  41. package/out/internal/configs/runtime.luau +981 -0
  42. package/out/internal/construction-claim.d.ts +1 -0
  43. package/out/internal/construction-claim.luau +26 -0
  44. package/out/internal/data/admission.d.ts +1 -0
  45. package/out/internal/data/admission.luau +673 -0
  46. package/out/internal/data/declarations.d.ts +1 -0
  47. package/out/internal/data/declarations.luau +384 -0
  48. package/out/internal/data/envelope.d.ts +1 -0
  49. package/out/internal/data/envelope.luau +318 -0
  50. package/out/internal/data/handles.d.ts +1 -0
  51. package/out/internal/data/handles.luau +255 -0
  52. package/out/internal/data/inbox-transforms.d.ts +1 -0
  53. package/out/internal/data/inbox-transforms.luau +458 -0
  54. package/out/internal/data/inbox.d.ts +1 -0
  55. package/out/internal/data/inbox.luau +437 -0
  56. package/out/internal/data/lease.d.ts +1 -0
  57. package/out/internal/data/lease.luau +304 -0
  58. package/out/internal/data/limits.d.ts +1 -0
  59. package/out/internal/data/limits.luau +234 -0
  60. package/out/internal/data/messages.d.ts +1 -0
  61. package/out/internal/data/messages.luau +69 -0
  62. package/out/internal/data/operation-id.d.ts +1 -0
  63. package/out/internal/data/operation-id.luau +61 -0
  64. package/out/internal/data/paths.d.ts +2 -0
  65. package/out/internal/data/paths.luau +323 -0
  66. package/out/internal/data/port.d.ts +1 -0
  67. package/out/internal/data/port.luau +290 -0
  68. package/out/internal/data/profiles.d.ts +1 -0
  69. package/out/internal/data/profiles.luau +862 -0
  70. package/out/internal/data/receipts.d.ts +1 -0
  71. package/out/internal/data/receipts.luau +190 -0
  72. package/out/internal/data/record-bindings.d.ts +1 -0
  73. package/out/internal/data/record-bindings.luau +92 -0
  74. package/out/internal/data/record-declarations.d.ts +1 -0
  75. package/out/internal/data/record-declarations.luau +140 -0
  76. package/out/internal/data/records.d.ts +1 -0
  77. package/out/internal/data/records.luau +400 -0
  78. package/out/internal/data/runtime.d.ts +1 -0
  79. package/out/internal/data/runtime.luau +918 -0
  80. package/out/internal/data/scheduler.d.ts +1 -0
  81. package/out/internal/data/scheduler.luau +507 -0
  82. package/out/internal/data/session.d.ts +1 -0
  83. package/out/internal/data/session.luau +234 -0
  84. package/out/internal/data/shutdown.d.ts +1 -0
  85. package/out/internal/data/shutdown.luau +91 -0
  86. package/out/internal/data/waiters.d.ts +1 -0
  87. package/out/internal/data/waiters.luau +65 -0
  88. package/out/internal/dense-list.d.ts +1 -0
  89. package/out/internal/dense-list.luau +155 -0
  90. package/out/internal/diagnostics.d.ts +1 -0
  91. package/out/internal/diagnostics.luau +29 -0
  92. package/out/internal/hooks.d.ts +1 -0
  93. package/out/internal/hooks.luau +53 -0
  94. package/out/internal/implementers.d.ts +1 -0
  95. package/out/internal/implementers.luau +119 -0
  96. package/out/internal/lifecycle.d.ts +1 -0
  97. package/out/internal/lifecycle.luau +912 -0
  98. package/out/internal/log-output.d.ts +1 -0
  99. package/out/internal/log-output.luau +106 -0
  100. package/out/internal/network/catalog.d.ts +26 -0
  101. package/out/internal/network/catalog.luau +182 -0
  102. package/out/internal/network/claims.d.ts +1 -0
  103. package/out/internal/network/claims.luau +154 -0
  104. package/out/internal/network/client-session.d.ts +1 -0
  105. package/out/internal/network/client-session.luau +403 -0
  106. package/out/internal/network/codec.d.ts +63 -0
  107. package/out/internal/network/codec.luau +1183 -0
  108. package/out/internal/network/envelope.d.ts +1 -0
  109. package/out/internal/network/envelope.luau +247 -0
  110. package/out/internal/network/limits.d.ts +26 -0
  111. package/out/internal/network/limits.luau +55 -0
  112. package/out/internal/network/port.d.ts +1 -0
  113. package/out/internal/network/port.luau +19 -0
  114. package/out/internal/network/roblox-network-port.d.ts +1 -0
  115. package/out/internal/network/roblox-network-port.luau +105 -0
  116. package/out/internal/network/schema.d.ts +72 -0
  117. package/out/internal/network/schema.luau +386 -0
  118. package/out/internal/network/server-session.d.ts +1 -0
  119. package/out/internal/network/server-session.luau +393 -0
  120. package/out/internal/network/session.d.ts +1 -0
  121. package/out/internal/network/session.luau +266 -0
  122. package/out/internal/port.d.ts +1 -0
  123. package/out/internal/port.luau +12 -0
  124. package/out/internal/reactive/context.d.ts +1 -0
  125. package/out/internal/reactive/context.luau +149 -0
  126. package/out/internal/reactive/flush.d.ts +1 -0
  127. package/out/internal/reactive/flush.luau +355 -0
  128. package/out/internal/reactive/graph.d.ts +1 -0
  129. package/out/internal/reactive/graph.luau +626 -0
  130. package/out/internal/reactive/limits.d.ts +1 -0
  131. package/out/internal/reactive/limits.luau +54 -0
  132. package/out/internal/reactive/ownership.d.ts +1 -0
  133. package/out/internal/reactive/ownership.luau +626 -0
  134. package/out/internal/registry.d.ts +1 -0
  135. package/out/internal/registry.luau +455 -0
  136. package/out/internal/roblox-port.d.ts +1 -0
  137. package/out/internal/roblox-port.luau +117 -0
  138. package/out/internal/runner.d.ts +1 -0
  139. package/out/internal/runner.luau +86 -0
  140. package/out/internal/scheduler.d.ts +1 -0
  141. package/out/internal/scheduler.luau +207 -0
  142. package/out/internal/state.d.ts +1 -0
  143. package/out/internal/state.luau +41 -0
  144. package/out/internal/sync/client-sync.d.ts +1 -0
  145. package/out/internal/sync/client-sync.luau +157 -0
  146. package/out/internal/sync/declarations.d.ts +1 -0
  147. package/out/internal/sync/declarations.luau +276 -0
  148. package/out/internal/sync/frame.d.ts +1 -0
  149. package/out/internal/sync/frame.luau +91 -0
  150. package/out/internal/sync/server-sync.d.ts +1 -0
  151. package/out/internal/sync/server-sync.luau +502 -0
  152. package/out/internal/sync/values.d.ts +1 -0
  153. package/out/internal/sync/values.luau +930 -0
  154. package/out/log-level.d.ts +7 -0
  155. package/out/log-level.luau +21 -0
  156. package/out/logging.d.ts +34 -0
  157. package/out/logging.luau +233 -0
  158. package/out/network.d.ts +66 -0
  159. package/out/network.luau +24 -0
  160. package/out/reactive.d.ts +76 -0
  161. package/out/reactive.luau +136 -0
  162. package/out/replicated.d.ts +38 -0
  163. package/out/replicated.luau +45 -0
  164. package/out/server/data.d.ts +54 -0
  165. package/out/server/data.luau +44 -0
  166. package/out/server/index.d.ts +18 -0
  167. package/out/server/init.luau +62 -0
  168. package/out/server/publish.d.ts +20 -0
  169. package/out/server/publish.luau +24 -0
  170. package/out/subsystem.d.ts +4 -0
  171. package/out/subsystem.luau +30 -0
  172. package/out/vide/index.d.ts +7 -0
  173. package/out/vide/init.luau +50 -0
  174. package/package.json +52 -5
  175. package/server/package.json +4 -0
  176. package/transformer/data.cjs +72 -0
  177. package/transformer/declarations.cjs +153 -0
  178. package/transformer/diagnostics.cjs +19 -0
  179. package/transformer/index.js +741 -0
  180. package/transformer/network.cjs +961 -0
  181. package/transformer/type-id.cjs +80 -0
  182. package/vide/package.json +4 -0
  183. package/README.md +0 -3
@@ -0,0 +1,455 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local hooks = TS.import(script, script.Parent, "hooks").hooks
4
+ local ImplementerSet = TS.import(script, script.Parent, "implementers").ImplementerSet
5
+ local drain = TS.import(script, script.Parent, "lifecycle").drain
6
+ --* @internal
7
+ --* @internal
8
+ --* @internal
9
+ --* @internal
10
+ --* @internal
11
+ --* @internal
12
+ --* @internal
13
+ --* @internal
14
+ --* @internal
15
+ --* @internal
16
+ --* @internal
17
+ --* @internal
18
+ local registered = {}
19
+ local byClass = {}
20
+ local duplicates = {}
21
+ local sets = {}
22
+ local sealed
23
+ --* @internal
24
+ local function define(klass, emitted, first)
25
+ if first == nil then
26
+ first = false
27
+ end
28
+ if sealed ~= nil then
29
+ error(`Crucible: {emitted.id} registered after boot; it would never be constructed or bound`)
30
+ end
31
+ local id = emitted.id
32
+ -- ▼ ReadonlyArray.some ▼
33
+ local _result = false
34
+ local _callback = function(record)
35
+ return record.id == id
36
+ end
37
+ for _k, _v in registered do
38
+ if _callback(_v, _k - 1, registered) then
39
+ _result = true
40
+ break
41
+ end
42
+ end
43
+ -- ▲ ReadonlyArray.some ▲
44
+ if _result then
45
+ table.insert(duplicates, id)
46
+ end
47
+ local statics = klass
48
+ local _object = {
49
+ id = id,
50
+ klass = klass,
51
+ hooks = hooks().overrides(klass),
52
+ }
53
+ local _left = "deps"
54
+ local _exp = emitted.deps
55
+ -- ▼ ReadonlyArray.map ▼
56
+ local _newValue = table.create(#_exp)
57
+ local _callback_1 = function(dep)
58
+ local _dep = dep
59
+ return if type(_dep) == "string" then {
60
+ id = dep,
61
+ all = false,
62
+ } else {
63
+ id = dep.all,
64
+ all = true,
65
+ }
66
+ end
67
+ for _k, _v in _exp do
68
+ _newValue[_k] = _callback_1(_v, _k - 1, _exp)
69
+ end
70
+ -- ▲ ReadonlyArray.map ▲
71
+ _object[_left] = _newValue
72
+ local _left_1 = "provides"
73
+ local _array = { id }
74
+ local _length = #_array
75
+ local _exp_1 = emitted.provides
76
+ -- ▼ ReadonlyArray.map ▼
77
+ local _newValue_1 = table.create(#_exp_1)
78
+ local _callback_2 = function(provided)
79
+ return provided
80
+ end
81
+ for _k, _v in _exp_1 do
82
+ _newValue_1[_k] = _callback_2(_v, _k - 1, _exp_1)
83
+ end
84
+ -- ▲ ReadonlyArray.map ▲
85
+ table.move(_newValue_1, 1, #_newValue_1, _length + 1, _array)
86
+ _object[_left_1] = _array
87
+ _object.renderPriority = statics.renderPriority
88
+ _object.resolved = {}
89
+ _object.memberOf = {}
90
+ local base = _object
91
+ local record
92
+ if emitted.kind == "subsystem" then
93
+ local _object_1 = table.clone(base)
94
+ setmetatable(_object_1, nil)
95
+ _object_1.kind = 0
96
+ _object_1.first = first
97
+ record = _object_1
98
+ else
99
+ local tag = emitted.tag
100
+ klass.tag = tag
101
+ local attributes
102
+ if emitted.attributes ~= nil then
103
+ attributes = {}
104
+ for name, check in pairs(emitted.attributes) do
105
+ attributes[name] = check
106
+ end
107
+ end
108
+ local _object_1 = table.clone(base)
109
+ setmetatable(_object_1, nil)
110
+ _object_1.kind = 1
111
+ _object_1.tag = tag
112
+ _object_1.instanceClasses = emitted.instance
113
+ _object_1.attributes = attributes
114
+ _object_1.bound = {}
115
+ _object_1.suppressed = {}
116
+ record = _object_1
117
+ end
118
+ local _record = record
119
+ table.insert(registered, _record)
120
+ local _klass = klass
121
+ local _record_1 = record
122
+ byClass[_klass] = _record_1
123
+ end
124
+ --* @internal
125
+ local function plan(records, side)
126
+ local problems = {}
127
+ local providers = {}
128
+ for _, record in records do
129
+ for _1, id in record.provides do
130
+ local list = providers[id]
131
+ if list == nil then
132
+ local _arg1 = { record }
133
+ providers[id] = _arg1
134
+ else
135
+ table.insert(list, record)
136
+ end
137
+ end
138
+ end
139
+ local single = {}
140
+ for _, record in records do
141
+ local edges = {}
142
+ for _1, dep in record.deps do
143
+ if dep.all then
144
+ continue
145
+ end
146
+ local _id = dep.id
147
+ local _condition = providers[_id]
148
+ if _condition == nil then
149
+ _condition = {}
150
+ end
151
+ local candidates = _condition
152
+ -- ▼ ReadonlyArray.filter ▼
153
+ local _newValue = {}
154
+ local _callback = function(candidate)
155
+ return candidate.kind == 0
156
+ end
157
+ local _length = 0
158
+ for _k, _v in candidates do
159
+ if _callback(_v, _k - 1, candidates) == true then
160
+ _length += 1
161
+ _newValue[_length] = _v
162
+ end
163
+ end
164
+ -- ▲ ReadonlyArray.filter ▲
165
+ local subsystems = _newValue
166
+ if #candidates == 0 then
167
+ local _arg0 = {
168
+ kind = "missing",
169
+ needer = record.id,
170
+ dep = dep.id,
171
+ }
172
+ table.insert(problems, _arg0)
173
+ elseif #subsystems == 0 then
174
+ local _arg0 = {
175
+ kind = "behaviour-dependency",
176
+ needer = record.id,
177
+ dep = dep.id,
178
+ }
179
+ table.insert(problems, _arg0)
180
+ elseif #candidates > 1 then
181
+ local _object = {
182
+ kind = "ambiguous",
183
+ needer = record.id,
184
+ dep = dep.id,
185
+ }
186
+ local _left = "providers"
187
+ -- ▼ ReadonlyArray.map ▼
188
+ local _newValue_1 = table.create(#candidates)
189
+ local _callback_1 = function(c)
190
+ return c.id
191
+ end
192
+ for _k, _v in candidates do
193
+ _newValue_1[_k] = _callback_1(_v, _k - 1, candidates)
194
+ end
195
+ -- ▲ ReadonlyArray.map ▲
196
+ _object[_left] = _newValue_1
197
+ table.insert(problems, _object)
198
+ else
199
+ local _arg0 = subsystems[1]
200
+ table.insert(edges, _arg0)
201
+ end
202
+ end
203
+ single[record] = edges
204
+ local renders = (bit32.band(record.hooks, (bit32.lshift(1, 0)))) ~= 0 or record.renderPriority ~= nil
205
+ if not side.renders and renders then
206
+ local _arg0 = {
207
+ kind = "render-on-server",
208
+ id = record.id,
209
+ priority = record.renderPriority,
210
+ }
211
+ table.insert(problems, _arg0)
212
+ end
213
+ end
214
+ local order = {}
215
+ local colour = {}
216
+ local path = {}
217
+ local visit
218
+ visit = function(record)
219
+ local _record = record
220
+ local seen = colour[_record]
221
+ if seen == "black" then
222
+ return nil
223
+ end
224
+ if seen == "grey" then
225
+ local _record_1 = record
226
+ local from = (table.find(path, _record_1) or 0) - 1
227
+ local cycle = {}
228
+ do
229
+ local i = from
230
+ local _shouldIncrement = false
231
+ while true do
232
+ if _shouldIncrement then
233
+ i += 1
234
+ else
235
+ _shouldIncrement = true
236
+ end
237
+ if not (i < #path) then
238
+ break
239
+ end
240
+ local _id = path[i + 1].id
241
+ table.insert(cycle, _id)
242
+ end
243
+ end
244
+ local _id = record.id
245
+ table.insert(cycle, _id)
246
+ local _arg0 = {
247
+ kind = "cycle",
248
+ path = cycle,
249
+ }
250
+ table.insert(problems, _arg0)
251
+ return nil
252
+ end
253
+ local _record_1 = record
254
+ colour[_record_1] = "grey"
255
+ local _record_2 = record
256
+ table.insert(path, _record_2)
257
+ local _record_3 = record
258
+ local _condition = single[_record_3]
259
+ if _condition == nil then
260
+ _condition = {}
261
+ end
262
+ for _, dep in _condition do
263
+ visit(dep)
264
+ end
265
+ path[#path] = nil
266
+ local _record_4 = record
267
+ colour[_record_4] = "black"
268
+ local _record_5 = record
269
+ table.insert(order, _record_5)
270
+ end
271
+ for _, record in records do
272
+ if record.kind == 0 and record.first then
273
+ visit(record)
274
+ end
275
+ end
276
+ for _, record in records do
277
+ if record.kind == 0 then
278
+ visit(record)
279
+ end
280
+ end
281
+ if #problems > 0 then
282
+ return {
283
+ ok = false,
284
+ problems = problems,
285
+ }
286
+ end
287
+ return {
288
+ ok = true,
289
+ plan = {
290
+ providers = providers,
291
+ subsystemOrder = order,
292
+ },
293
+ }
294
+ end
295
+ local function describe(problem)
296
+ local _exp = problem.kind
297
+ repeat
298
+ if _exp == "duplicate" then
299
+ return `{problem.id} is registered twice`
300
+ end
301
+ if _exp == "missing" then
302
+ return `{problem.needer} needs {problem.dep}, which nothing provides`
303
+ end
304
+ if _exp == "ambiguous" then
305
+ return `{problem.needer} needs one {problem.dep}, but {table.concat(problem.providers, ", ")} all provide it`
306
+ end
307
+ if _exp == "behaviour-dependency" then
308
+ return `{problem.needer} needs {problem.dep}, which only behaviours provide; take All<T> or call X.get(instance)`
309
+ end
310
+ if _exp == "cycle" then
311
+ return `dependency cycle {table.concat(problem.path, " -> ")}; break it with All<T>`
312
+ end
313
+ if _exp == "render-on-server" then
314
+ return `{problem.id} renders but is loaded on the server`
315
+ end
316
+ until true
317
+ end
318
+ --* @internal
319
+ local setFor
320
+ local function seal(side)
321
+ if sealed ~= nil then
322
+ error("Crucible: boot already ran on this side")
323
+ end
324
+ local result = plan(registered, side)
325
+ local problems = {}
326
+ for _, id in duplicates do
327
+ local _arg0 = {
328
+ kind = "duplicate",
329
+ id = id,
330
+ }
331
+ table.insert(problems, _arg0)
332
+ end
333
+ if not result.ok then
334
+ for _, problem in result.problems do
335
+ table.insert(problems, problem)
336
+ end
337
+ end
338
+ if #problems > 0 then
339
+ -- ▼ ReadonlyArray.map ▼
340
+ local _newValue = table.create(#problems)
341
+ for _k, _v in problems do
342
+ _newValue[_k] = describe(_v, _k - 1, problems)
343
+ end
344
+ -- ▲ ReadonlyArray.map ▲
345
+ error(`Crucible could not boot:\n {table.concat(_newValue, "\n ")}`)
346
+ end
347
+ if not result.ok then
348
+ return {}
349
+ end
350
+ local _binding = result.plan
351
+ local providers = _binding.providers
352
+ local subsystemOrder = _binding.subsystemOrder
353
+ for _, record in registered do
354
+ local _exp = record.deps
355
+ -- ▼ ReadonlyArray.map ▼
356
+ local _newValue = table.create(#_exp)
357
+ local _callback = function(dep)
358
+ if dep.all then
359
+ return {
360
+ all = true,
361
+ set = setFor(dep.id),
362
+ }
363
+ end
364
+ local _object = {
365
+ all = false,
366
+ }
367
+ local _left = "record"
368
+ local _id = dep.id
369
+ local _condition = providers[_id]
370
+ if _condition == nil then
371
+ _condition = {}
372
+ end
373
+ _object[_left] = _condition[1]
374
+ return _object
375
+ end
376
+ for _k, _v in _exp do
377
+ _newValue[_k] = _callback(_v, _k - 1, _exp)
378
+ end
379
+ -- ▲ ReadonlyArray.map ▲
380
+ record.resolved = _newValue
381
+ local _exp_1 = record.provides
382
+ -- ▼ ReadonlyArray.map ▼
383
+ local _newValue_1 = table.create(#_exp_1)
384
+ for _k, _v in _exp_1 do
385
+ _newValue_1[_k] = setFor(_v, _k - 1, _exp_1)
386
+ end
387
+ -- ▲ ReadonlyArray.map ▲
388
+ record.memberOf = _newValue_1
389
+ end
390
+ sealed = result.plan
391
+ return subsystemOrder
392
+ end
393
+ --* @internal
394
+ local function records()
395
+ return registered
396
+ end
397
+ --* @internal
398
+ local function recordOf(klass)
399
+ local _klass = klass
400
+ return byClass[_klass]
401
+ end
402
+ --* @internal
403
+ local function resolveOne(id)
404
+ drain()
405
+ local plan = sealed or error(`inject<{id}>() called before boot`)
406
+ local _providers = plan.providers
407
+ local _id = id
408
+ local _condition = _providers[_id]
409
+ if _condition == nil then
410
+ _condition = {}
411
+ end
412
+ local candidates = _condition
413
+ local provider = candidates[1]
414
+ if #candidates ~= 1 or provider.kind ~= 0 then
415
+ error(`inject<{id}>(): {#candidates} providers; inject needs exactly one subsystem`)
416
+ end
417
+ local state = provider.state
418
+ local _result = state
419
+ if _result ~= nil then
420
+ _result = _result.phase
421
+ end
422
+ if _result == 5 then
423
+ error(`inject<{id}>(): provider {provider.id} is Faulted`)
424
+ end
425
+ local _object = state
426
+ if _object ~= nil then
427
+ _object = _object.object
428
+ end
429
+ local object = _object
430
+ if state == nil or object == nil or state.phase == 0 or state.phase == 1 then
431
+ error(`inject<{id}>(): {provider.id} is not awake yet; call inject from start or later, or take a constructor parameter`)
432
+ end
433
+ return object
434
+ end
435
+ --* @internal
436
+ function setFor(id)
437
+ local _id = id
438
+ local set = sets[_id]
439
+ if set == nil then
440
+ set = ImplementerSet.new(id)
441
+ local _id_1 = id
442
+ local _set = set
443
+ sets[_id_1] = _set
444
+ end
445
+ return set
446
+ end
447
+ return {
448
+ define = define,
449
+ plan = plan,
450
+ seal = seal,
451
+ records = records,
452
+ recordOf = recordOf,
453
+ resolveOne = resolveOne,
454
+ setFor = setFor,
455
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,117 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ --* @internal
3
+ --* @internal
4
+ local robloxBindingPort
5
+ local function robloxPort()
6
+ local runService = game:GetService("RunService")
7
+ local events = {
8
+ [0] = runService.PreRender,
9
+ [1] = runService.PreSimulation,
10
+ [2] = runService.PostSimulation,
11
+ [3] = runService.RenderStepped,
12
+ [4] = runService.PreAnimation,
13
+ [5] = runService.Heartbeat,
14
+ }
15
+ local _object = table.clone(robloxBindingPort())
16
+ setmetatable(_object, nil)
17
+ _object.onFrame = function(event, listener)
18
+ local connection = events[event]:Connect(listener)
19
+ return function()
20
+ return connection:Disconnect()
21
+ end
22
+ end
23
+ _object.bindRenderStep = function(name, priority, listener)
24
+ runService:BindToRenderStep(name, priority, listener)
25
+ return function()
26
+ return runService:UnbindFromRenderStep(name)
27
+ end
28
+ end
29
+ _object.defer = function(callback)
30
+ task.defer(callback)
31
+ end
32
+ _object.cancel = function(thread)
33
+ return task.cancel(thread)
34
+ end
35
+ _object.spawn = function(callback)
36
+ task.spawn(callback)
37
+ end
38
+ _object.clock = function()
39
+ return os.clock()
40
+ end
41
+ _object.wait = function()
42
+ task.wait()
43
+ end
44
+ _object.bindToClose = function(callback)
45
+ return game:BindToClose(callback)
46
+ end
47
+ return _object
48
+ end
49
+ --* @internal
50
+ --* @internal
51
+ function robloxBindingPort()
52
+ local collection = game:GetService("CollectionService")
53
+ local excluded = { game:GetService("ServerStorage"), game:GetService("ReplicatedStorage"), game:GetService("ServerScriptService"), game:GetService("StarterGui"), game:GetService("StarterPack"), game:GetService("StarterPlayer") }
54
+ return {
55
+ hasTag = function(instance, tag)
56
+ return collection:HasTag(instance, tag)
57
+ end,
58
+ tagged = function(tag)
59
+ return collection:GetTagged(tag)
60
+ end,
61
+ onTagAdded = function(tag, listener)
62
+ local c = collection:GetInstanceAddedSignal(tag):Connect(listener)
63
+ return function()
64
+ return c:Disconnect()
65
+ end
66
+ end,
67
+ onTagRemoved = function(tag, listener)
68
+ local c = collection:GetInstanceRemovedSignal(tag):Connect(listener)
69
+ return function()
70
+ return c:Disconnect()
71
+ end
72
+ end,
73
+ inWorld = function(instance)
74
+ return instance:IsDescendantOf(game)
75
+ end,
76
+ isA = function(instance, name)
77
+ return instance:IsA(name)
78
+ end,
79
+ bindingScope = function(instance)
80
+ -- ▼ ReadonlyArray.some ▼
81
+ local _result = false
82
+ local _callback = function(container)
83
+ return instance == container or instance:IsDescendantOf(container)
84
+ end
85
+ for _k, _v in excluded do
86
+ if _callback(_v, _k - 1, excluded) then
87
+ _result = true
88
+ break
89
+ end
90
+ end
91
+ -- ▲ ReadonlyArray.some ▲
92
+ return not _result
93
+ end,
94
+ onAncestryChanged = function(instance, listener)
95
+ local c = instance.AncestryChanged:Connect(listener)
96
+ return function()
97
+ return c:Disconnect()
98
+ end
99
+ end,
100
+ getAttribute = function(instance, name)
101
+ return instance:GetAttribute(name)
102
+ end,
103
+ onAttributeChanged = function(instance, name, listener)
104
+ local c = instance:GetAttributeChangedSignal(name):Connect(listener)
105
+ return function()
106
+ return c:Disconnect()
107
+ end
108
+ end,
109
+ describe = function(instance)
110
+ return instance:GetFullName()
111
+ end,
112
+ }
113
+ end
114
+ return {
115
+ robloxPort = robloxPort,
116
+ robloxBindingPort = robloxBindingPort,
117
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,86 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ --* @internal
3
+ --* @internal The error value of a call that yielded.
4
+ local YIELDED = "yielded; only start may yield"
5
+ local DONE = {}
6
+ local free = {}
7
+ local owners = {}
8
+ local function loop(work, a, b)
9
+ while true do
10
+ -- The only resumer is `call`, which always passes a function and its two arguments.
11
+ local result = work(a, b)
12
+ -- A parked worker must not keep its last arguments alive.
13
+ work = nil
14
+ a = nil
15
+ b = nil
16
+ local nextWork, nextA, nextB = coroutine.yield(DONE, result)
17
+ work = nextWork
18
+ a = nextA
19
+ b = nextB
20
+ end
21
+ end
22
+ --[[
23
+ *
24
+ * @internal
25
+ * Runs every callback that must not yield: hooks other than `start`, constructors, `accepts`, and `All<T>`
26
+ * callbacks. A pool of parked worker coroutines (GoodSignal's free-runner trick) detects a yield, which
27
+ * `pcall` cannot. A worker returns to the pool after a call that returned, so steady-state calls allocate
28
+ * nothing. A throw kills its worker, and a yield gets its worker cancelled, so only failures allocate a new
29
+ * one. A callback that calls `call` again takes another worker, and the pool grows to the deepest nesting.
30
+ *
31
+ * `owner` becomes the worker's owner for the call, which is what `current()` reads. Without one the call is
32
+ * ownerless. Returns the callback's result on Ok, or the error (with a traceback) on Threw and Yielded.
33
+
34
+ ]]
35
+ local function call(work, a, b, owner)
36
+ -- ▼ Array.pop ▼
37
+ local _length = #free
38
+ local _result = free[_length]
39
+ free[_length] = nil
40
+ -- ▲ Array.pop ▲
41
+ local _condition = _result
42
+ if _condition == nil then
43
+ _condition = coroutine.create(loop)
44
+ end
45
+ local worker = _condition
46
+ if owner ~= nil then
47
+ local _owner = owner
48
+ owners[worker] = _owner
49
+ end
50
+ local ok, marker, value = coroutine.resume(worker, work, a, b)
51
+ owners[worker] = nil
52
+ if not ok then
53
+ return 1, debug.traceback(worker, tostring(marker))
54
+ end
55
+ if marker ~= DONE then
56
+ local trace = debug.traceback(worker, YIELDED)
57
+ -- A failed cancel leaves the worker suspended, so it never returns to the pool.
58
+ local cancelled, err = pcall(task.cancel, worker)
59
+ return 2, if cancelled then trace else `{trace}\ncancellation failed: {err}`
60
+ end
61
+ table.insert(free, worker)
62
+ return 0, value
63
+ end
64
+ --* @internal The object that owns `thread`: a runner worker during an owned call, or a start thread for its life.
65
+ local function ownerOf(thread)
66
+ local _thread = thread
67
+ return owners[_thread]
68
+ end
69
+ --* @internal
70
+ local function own(thread, owner)
71
+ local _thread = thread
72
+ local _owner = owner
73
+ owners[_thread] = _owner
74
+ end
75
+ --* @internal
76
+ local function disown(thread)
77
+ local _thread = thread
78
+ owners[_thread] = nil
79
+ end
80
+ return {
81
+ call = call,
82
+ ownerOf = ownerOf,
83
+ own = own,
84
+ disown = disown,
85
+ YIELDED = YIELDED,
86
+ }
@@ -0,0 +1 @@
1
+ export {};