cluaupp 1.5.0 → 1.5.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.
Files changed (323) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +10 -5
  3. package/api/CHANGELOG.md +3 -0
  4. package/api/chat.js +74 -0
  5. package/api/fixtures/roblox/README.md +6 -0
  6. package/api/fixtures/roblox/aux/sample.d.luau +6 -0
  7. package/api/fixtures/roblox/mini/Mini-API-Dump.json +72 -0
  8. package/api/generated/bench-latest.json +39 -0
  9. package/api/generated/capability-profile.json +76 -0
  10. package/api/generated/lsp-index.json +1 -0
  11. package/api/generated/luau/classes.d.luau +11221 -0
  12. package/api/generated/luau/datatypes.d.luau +327 -0
  13. package/api/generated/luau/enums.d.luau +4918 -0
  14. package/api/generated/luau/globals.d.luau +12 -0
  15. package/api/manifests/roblox-target.manifest.json +22 -0
  16. package/api/normalized/roblox-target.profile.json +237461 -0
  17. package/api/overrides/classes.json +8 -0
  18. package/api/overrides/compatibility.json +9 -0
  19. package/api/overrides/datatypes.json +1579 -0
  20. package/api/overrides/enums.json +8 -0
  21. package/api/overrides/globals.json +8 -0
  22. package/api/overrides/type-mappings.json +9 -0
  23. package/api/roblox-api.lock.json +9 -0
  24. package/data/Mini-API-Dump.json +1 -0
  25. package/editors/vscode/README.md +12 -10
  26. package/editors/vscode/extension.js +82 -0
  27. package/editors/vscode/icons/axiom.svg +4 -0
  28. package/editors/vscode/icons/bloom.svg +5 -0
  29. package/editors/vscode/icons/helm.svg +4 -0
  30. package/editors/vscode/icons/hive.svg +5 -0
  31. package/editors/vscode/icons/mint.svg +4 -0
  32. package/editors/vscode/icons/shift.svg +6 -0
  33. package/editors/vscode/language-configuration-schema.json +24 -0
  34. package/editors/vscode/package.json +172 -12
  35. package/editors/vscode/snippets/axiom.json +12 -0
  36. package/editors/vscode/snippets/bloom.json +12 -0
  37. package/editors/vscode/snippets/helm.json +12 -0
  38. package/editors/vscode/snippets/hive.json +12 -0
  39. package/editors/vscode/snippets/mint.json +12 -0
  40. package/editors/vscode/snippets/shift.json +17 -0
  41. package/editors/vscode/syntaxes/axiom.tmLanguage.json +5 -0
  42. package/editors/vscode/syntaxes/bloom.tmLanguage.json +5 -0
  43. package/editors/vscode/syntaxes/helm.tmLanguage.json +5 -0
  44. package/editors/vscode/syntaxes/hive.tmLanguage.json +5 -0
  45. package/editors/vscode/syntaxes/mint.tmLanguage.json +5 -0
  46. package/editors/vscode/syntaxes/schema.tmLanguage.json +89 -0
  47. package/editors/vscode/syntaxes/shift.tmLanguage.json +5 -0
  48. package/examples/game/.cluaupp/compile-cache/ReplicatedStorage__Shared__Constants__Datas__TemplateData.clh.json +1 -0
  49. package/examples/game/.cluaupp/compile-cache/ServerScriptService__Boot__DataBoot.server.clpp.json +1 -0
  50. package/examples/game/.cluaupp/compile-cache/ServerScriptService__Configuration__ServerConfig.clp.json +1 -0
  51. package/examples/game/.cluaupp/compile-cache/ServerScriptService__Handlers__Guard.server.clpp.json +1 -0
  52. package/examples/game/.cluaupp/compile-cache/ServerScriptService__Handlers__PlayerHandler.server.clpp.json +1 -0
  53. package/examples/game/.cluaupp/compile-cache/StarterPlayer__StarterCharacterScripts__Character__CharacterReady.client.clpp.json +1 -0
  54. package/examples/game/.cluaupp/compile-cache/StarterPlayer__StarterPlayerScripts__Controllers__DataController.client.clpp.json +1 -0
  55. package/examples/game/.cluaupp/compile-cache/index.json +12 -0
  56. package/examples/game/.cluaupp/datamodel-profile.json +94 -0
  57. package/examples/game/.vscode/settings.json +12 -1
  58. package/examples/game/include/clpp/datatypes.clh +337 -373
  59. package/examples/game/include/clpp/generated/datamodel.clh +25 -0
  60. package/examples/game/include/clpp/generated/enums.clh +1 -1
  61. package/examples/game/include/clpp/generated/instances.clh +41135 -41064
  62. package/examples/game/include/clpp/libs/axiom.clh +1 -1
  63. package/examples/game/include/clpp/libs/math.clh +14 -0
  64. package/examples/game/include/clpp/libs/spring.clh +17 -0
  65. package/examples/game/include/clpp/libs/ward.clh +1 -0
  66. package/examples/game/include/clpp/roblox.clh +3 -4
  67. package/examples/game/libs/ArrayIndexer/init.luau +209 -0
  68. package/examples/game/libs/Axiom/init.luau +608 -0
  69. package/examples/game/libs/Bloom/init.luau +433 -0
  70. package/examples/game/libs/Coil/init.luau +215 -0
  71. package/examples/game/libs/Crest/init.luau +426 -0
  72. package/examples/game/libs/Echo/init.luau +417 -0
  73. package/examples/game/libs/Ember/init.luau +365 -0
  74. package/examples/game/libs/Flare/init.luau +717 -0
  75. package/examples/game/libs/Gleam/init.luau +729 -0
  76. package/examples/game/libs/Guide/init.luau +215 -0
  77. package/examples/game/libs/Helm/init.luau +377 -0
  78. package/examples/game/libs/Hive/init.luau +241 -0
  79. package/examples/game/libs/Keep/Client.luau +114 -0
  80. package/examples/game/libs/Keep/Data.luau +883 -0
  81. package/examples/game/libs/Keep/Engine.luau +211 -0
  82. package/examples/game/libs/Keep/Enum.luau +6 -0
  83. package/examples/game/libs/Keep/Enums.luau +10 -0
  84. package/examples/game/libs/Keep/Path.luau +236 -0
  85. package/examples/game/libs/Keep/Replicator.luau +298 -0
  86. package/examples/game/libs/Keep/Server.luau +251 -0
  87. package/examples/game/libs/Keep/Store.luau +652 -0
  88. package/examples/game/libs/Keep/Trade.luau +455 -0
  89. package/examples/game/libs/Keep/init.luau +205 -0
  90. package/examples/game/libs/Lens/init.luau +609 -0
  91. package/examples/game/libs/Mint/init.luau +279 -0
  92. package/examples/game/libs/Net/init.luau +156 -0
  93. package/examples/game/libs/Net/src/codec.luau +224 -0
  94. package/examples/game/libs/Occlude/init.luau +117 -0
  95. package/examples/game/libs/Pin/init.luau +309 -0
  96. package/examples/game/libs/Promise/LICENSE +21 -0
  97. package/examples/game/libs/Promise/_impl/LICENSE +21 -0
  98. package/examples/game/libs/Promise/_impl/init.lua +1991 -0
  99. package/examples/game/libs/Promise/init.lua +1990 -0
  100. package/examples/game/libs/Promise/init.luau +13 -0
  101. package/examples/game/libs/Promise/types.luau +46 -0
  102. package/examples/game/libs/Roster/init.luau +686 -0
  103. package/examples/game/libs/SOURCES.md +31 -0
  104. package/examples/game/libs/Shift/init.luau +238 -0
  105. package/examples/game/libs/Spark/init.luau +487 -0
  106. package/examples/game/libs/Stage/init.luau +178 -0
  107. package/examples/game/libs/Sweep/init.luau +259 -0
  108. package/examples/game/libs/Trace/init.luau +213 -0
  109. package/examples/game/libs/Ward/init.luau +211 -0
  110. package/examples/game/out/ReplicatedStorage/Shared/Constants/Datas/TemplateData.luau +29 -0
  111. package/examples/game/out/ReplicatedStorage/Shared/Constants/Datas/TemplateData.luau.map.json +13 -0
  112. package/examples/game/out/ReplicatedStorage/Shared/Net/Net.luau +83 -0
  113. package/examples/game/out/ReplicatedStorage/Shared/Net/Net.luau.map.json +13 -0
  114. package/examples/game/out/ServerScriptService/Boot/DataBoot.server.luau +18 -0
  115. package/examples/game/out/ServerScriptService/Boot/DataBoot.server.luau.map.json +13 -0
  116. package/examples/game/out/ServerScriptService/Configuration/ServerConfig.luau +14 -0
  117. package/examples/game/out/ServerScriptService/Configuration/ServerConfig.luau.map.json +13 -0
  118. package/examples/game/out/ServerScriptService/Handlers/Guard.server.luau +15 -0
  119. package/examples/game/out/ServerScriptService/Handlers/Guard.server.luau.map.json +13 -0
  120. package/examples/game/out/ServerScriptService/Handlers/PlayerHandler.server.luau +50 -0
  121. package/examples/game/out/ServerScriptService/Handlers/PlayerHandler.server.luau.map.json +13 -0
  122. package/examples/game/out/StarterPlayer/StarterCharacterScripts/Character/CharacterReady.client.luau +12 -0
  123. package/examples/game/out/StarterPlayer/StarterCharacterScripts/Character/CharacterReady.client.luau.map.json +13 -0
  124. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Controllers/DataController.client.luau +16 -0
  125. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Controllers/DataController.client.luau.map.json +13 -0
  126. package/examples/game/src/ReplicatedStorage/Shared/Net/Net.clh +26 -0
  127. package/examples/game/src/ServerScriptService/Boot/DataBoot.server.clpp +1 -1
  128. package/examples/game/src/ServerScriptService/Handlers/PlayerHandler.server.clpp +1 -1
  129. package/examples/game/stylua.toml +9 -0
  130. package/generated/api/build-profile.js +115 -0
  131. package/generated/api/cache.js +44 -0
  132. package/generated/api/coverage.js +32 -0
  133. package/generated/api/diff.js +125 -0
  134. package/generated/api/generators/clpp-headers.js +353 -0
  135. package/generated/api/generators/docs-reference.js +7 -0
  136. package/generated/api/generators/lsp-index.js +81 -0
  137. package/generated/api/generators/luau-defs.js +94 -0
  138. package/generated/api/ide.js +76 -0
  139. package/generated/api/identifier.js +47 -0
  140. package/generated/api/index.js +324 -0
  141. package/generated/api/loader.js +57 -0
  142. package/generated/api/merge.js +88 -0
  143. package/generated/api/model.js +5 -0
  144. package/generated/api/normalize.js +231 -0
  145. package/generated/api/overrides-validate.js +58 -0
  146. package/generated/api/perf.js +12 -0
  147. package/generated/api/registry.js +136 -0
  148. package/generated/api/release.js +44 -0
  149. package/generated/api/resolver.js +250 -0
  150. package/generated/api/sources/aux-types-diff.js +75 -0
  151. package/generated/api/sources/client-tracker.js +11 -0
  152. package/generated/api/sources/creator-docs.js +42 -0
  153. package/generated/api/sources/luau-types.js +34 -0
  154. package/generated/api/sources/mini-dump.js +17 -0
  155. package/generated/api/sources/studio-api.js +8 -0
  156. package/generated/api/sources/studio-apiv2.js +11 -0
  157. package/generated/api/sources/studio-full-api.js +8 -0
  158. package/generated/api/studio-smoke.js +80 -0
  159. package/generated/api/type-parse.js +49 -0
  160. package/generated/api/understander.js +51 -0
  161. package/generated/api/validate.js +135 -0
  162. package/generated/api-cli.js +421 -0
  163. package/generated/cli.js +16 -5
  164. package/generated/clpp/contract.js +3 -3
  165. package/generated/clpp/format-luau.js +236 -0
  166. package/generated/clpp/index.js +13 -1
  167. package/generated/clpp/modules.js +227 -0
  168. package/generated/clpp/postprocess.js +86 -5
  169. package/generated/clpp/rewrite-janitor.js +145 -0
  170. package/generated/clpp/runner.js +14 -2
  171. package/generated/compile.js +82 -0
  172. package/generated/flare/parse.js +12 -1
  173. package/generated/intellisense.js +57 -1
  174. package/generated/native/index.js +217 -16
  175. package/generated/target/authority-check.js +136 -0
  176. package/generated/target/authority-graph.js +74 -0
  177. package/generated/target/build-cache.js +112 -0
  178. package/generated/target/capabilities.js +89 -0
  179. package/generated/target/capability-profile.js +30 -0
  180. package/generated/target/component-contracts.js +60 -0
  181. package/generated/target/context-check.js +160 -0
  182. package/generated/target/datamodel-check.js +170 -0
  183. package/generated/target/datamodel-generate.js +74 -0
  184. package/generated/target/datamodel.js +233 -0
  185. package/generated/target/diagnostics.js +63 -0
  186. package/generated/target/doctor.js +152 -0
  187. package/generated/target/flare-version.js +58 -0
  188. package/generated/target/get-service.js +69 -0
  189. package/generated/target/lifetime-check.js +47 -0
  190. package/generated/target/luau-stamp.js +39 -0
  191. package/generated/target/optimizer-advise.js +88 -0
  192. package/generated/target/optimizer-apply.js +44 -0
  193. package/generated/target/optimizer-soa.js +254 -0
  194. package/generated/target/parallel-check.js +136 -0
  195. package/generated/target/pgo.js +148 -0
  196. package/generated/target/project-docs.js +69 -0
  197. package/generated/target/project-graph.js +71 -0
  198. package/generated/target/roblox.js +63 -0
  199. package/generated/target/security-check.js +41 -0
  200. package/generated/target/source-map.js +25 -0
  201. package/generated/target/studio-bridge.js +112 -0
  202. package/generated/utils/project.js +178 -8
  203. package/generated/utils/rojo-mapper.js +11 -3
  204. package/include/clpp/datatypes.clh +337 -373
  205. package/include/clpp/generated/enums.clh +1 -1
  206. package/include/clpp/generated/instances.clh +41135 -41064
  207. package/include/clpp/libs/axiom.clh +1 -1
  208. package/include/clpp/libs/hive.clh +1 -0
  209. package/include/clpp/libs/keep.clh +2 -0
  210. package/include/clpp/libs/math.clh +14 -0
  211. package/include/clpp/libs/spring.clh +17 -0
  212. package/include/clpp/libs/ward.clh +1 -0
  213. package/include/clpp/roblox.clh +3 -4
  214. package/package.json +10 -3
  215. package/plugins/CluauppNav/Plugin.luau +207 -0
  216. package/plugins/CluauppNav/ProfileLogger.luau +27 -0
  217. package/plugins/CluauppNav/README.md +24 -0
  218. package/runtime/Axiom/init.luau +10 -7
  219. package/runtime/Coil/init.luau +8 -2
  220. package/runtime/Crest/init.luau +1 -0
  221. package/runtime/Flare/init.luau +2 -1
  222. package/runtime/Gleam/init.luau +15 -4
  223. package/runtime/Hive/init.luau +36 -14
  224. package/runtime/Pin/init.luau +5 -2
  225. package/runtime/Roster/init.luau +2 -0
  226. package/runtime/Spark/init.luau +3 -0
  227. package/runtime/Sweep/init.luau +2 -0
  228. package/runtime/Trace/init.luau +3 -0
  229. package/runtime/Ward/init.luau +38 -5
  230. package/scripts/postinstall-editor.js +17 -0
  231. package/skills/README.md +13 -0
  232. package/skills/clpp-hive-flare/SKILL.md +79 -0
  233. package/skills/clpp-language/SKILL.md +123 -0
  234. package/skills/clpp-language/compiler.md +89 -0
  235. package/skills/clpp-style/SKILL.md +95 -0
  236. package/src/api/build-profile.ts +138 -0
  237. package/src/api/cache.ts +45 -0
  238. package/src/api/coverage.ts +46 -0
  239. package/src/api/diff.ts +143 -0
  240. package/src/api/generators/clpp-headers.ts +377 -0
  241. package/src/api/generators/docs-reference.ts +11 -0
  242. package/src/api/generators/lsp-index.ts +106 -0
  243. package/src/api/generators/luau-defs.ts +98 -0
  244. package/src/api/ide.ts +87 -0
  245. package/src/api/identifier.ts +47 -0
  246. package/src/api/index.ts +269 -0
  247. package/src/api/loader.ts +60 -0
  248. package/src/api/merge.ts +126 -0
  249. package/src/api/model.ts +283 -0
  250. package/src/api/normalize.ts +257 -0
  251. package/src/api/overrides-validate.ts +58 -0
  252. package/src/api/perf.ts +15 -0
  253. package/src/api/registry.ts +162 -0
  254. package/src/api/release.ts +47 -0
  255. package/src/api/resolver.ts +255 -0
  256. package/src/api/sources/aux-types-diff.ts +81 -0
  257. package/src/api/sources/client-tracker.ts +10 -0
  258. package/src/api/sources/creator-docs.ts +37 -0
  259. package/src/api/sources/luau-types.ts +30 -0
  260. package/src/api/sources/mini-dump.ts +50 -0
  261. package/src/api/sources/studio-api.ts +7 -0
  262. package/src/api/sources/studio-apiv2.ts +10 -0
  263. package/src/api/sources/studio-full-api.ts +7 -0
  264. package/src/api/studio-smoke.ts +82 -0
  265. package/src/api/type-parse.ts +48 -0
  266. package/src/api/understander.ts +72 -0
  267. package/src/api/validate.ts +160 -0
  268. package/src/api-cli.ts +493 -0
  269. package/src/api.generated.js +37 -22
  270. package/src/cli.ts +21 -6
  271. package/src/clpp/contract.ts +34 -3
  272. package/src/clpp/format-luau.ts +262 -0
  273. package/src/clpp/index.ts +13 -2
  274. package/src/clpp/modules.ts +252 -0
  275. package/src/clpp/postprocess.ts +100 -5
  276. package/src/clpp/rewrite-janitor.ts +156 -0
  277. package/src/clpp/runner.ts +14 -2
  278. package/src/compile.ts +87 -0
  279. package/src/flare/parse.ts +14 -1
  280. package/src/flare/types.ts +2 -0
  281. package/src/intellisense.ts +58 -1
  282. package/src/native/index.ts +225 -16
  283. package/src/target/authority-check.ts +162 -0
  284. package/src/target/authority-graph.ts +80 -0
  285. package/src/target/build-cache.ts +129 -0
  286. package/src/target/capabilities.ts +115 -0
  287. package/src/target/capability-profile.ts +25 -0
  288. package/src/target/component-contracts.ts +64 -0
  289. package/src/target/context-check.ts +177 -0
  290. package/src/target/datamodel-check.ts +188 -0
  291. package/src/target/datamodel-generate.ts +78 -0
  292. package/src/target/datamodel.ts +261 -0
  293. package/src/target/diagnostics.ts +67 -0
  294. package/src/target/doctor.ts +171 -0
  295. package/src/target/flare-version.ts +61 -0
  296. package/src/target/get-service.ts +85 -0
  297. package/src/target/lifetime-check.ts +45 -0
  298. package/src/target/luau-stamp.ts +33 -0
  299. package/src/target/optimizer-advise.ts +93 -0
  300. package/src/target/optimizer-apply.ts +63 -0
  301. package/src/target/optimizer-soa.ts +270 -0
  302. package/src/target/parallel-check.ts +135 -0
  303. package/src/target/pgo.ts +157 -0
  304. package/src/target/project-docs.ts +68 -0
  305. package/src/target/project-graph.ts +75 -0
  306. package/src/target/roblox.ts +78 -0
  307. package/src/target/security-check.ts +40 -0
  308. package/src/target/source-map.ts +36 -0
  309. package/src/target/studio-bridge.ts +140 -0
  310. package/src/types.ts +14 -0
  311. package/src/utils/project.ts +183 -9
  312. package/src/utils/rojo-mapper.ts +12 -3
  313. package/stylua.toml +9 -0
  314. package/templates/game/.vscode/settings.json +7 -1
  315. package/templates/game/include/clpp/datatypes.clh +337 -373
  316. package/templates/game/include/clpp/generated/enums.clh +1 -1
  317. package/templates/game/include/clpp/generated/instances.clh +41135 -41064
  318. package/templates/game/include/clpp/libs/axiom.clh +1 -1
  319. package/templates/game/include/clpp/libs/ward.clh +1 -0
  320. package/templates/game/include/clpp/roblox.clh +3 -4
  321. package/templates/game/src/ServerScriptService/Boot/DataBoot.server.clpp +1 -1
  322. package/templates/game/src/ServerScriptService/Handlers/PlayerHandler.server.clpp +1 -1
  323. package/templates/game/stylua.toml +9 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  // Axiom — combat / camera / HUD math. Every function returns a concrete type.
4
4
  // Groups: Scalar Lerp Vector CFrame Easing Bezier Geometry Trig Probability Noise Color
5
- // .axiom schema calls Axiom.Select({ "Scalar", "Lerp" }) from generated Luau.
5
+ // .axiom schema: group Lerp (whole pack) or fn LerpVector2 (one function). Axiom.Select accepts both.
6
6
 
7
7
  namespace Axiom {
8
8
  double Clamp(double value, double min, double max);
@@ -9,6 +9,7 @@ struct HiveWorld {
9
9
  bool Has(int entity, int componentId);
10
10
  auto Query();
11
11
  buffer Snapshot(int componentId);
12
+ buffer Snapshot(auto component);
12
13
  };
13
14
 
14
15
  namespace Hive {
@@ -47,6 +47,8 @@ struct DataServiceOptions {
47
47
  };
48
48
 
49
49
  struct Data {
50
+ // IntelliSense only. Do not type fields as Data — CL++ maps it to DataService
51
+ // and errors CLPP0605. Store the session as `auto Session = null;`.
50
52
  RBXScriptSignal Changed;
51
53
  bool Destroyed;
52
54
 
@@ -0,0 +1,14 @@
1
+ #pragma once
2
+
3
+ namespace MathUtils {
4
+ double Lerp(double a, double b, double alpha);
5
+ double Map(double value, double inMin, double inMax, double outMin, double outMax);
6
+ double Clamp(double value, double min, double max);
7
+ double Round(double value);
8
+ double Round(double value, int digits);
9
+ double AngleDiff(double a, double b);
10
+ double LerpAngle(double a, double b, double alpha);
11
+ double Random(double min, double max);
12
+ int Weighted(LuaArray<double> weights);
13
+ Vector3 LerpVector(Vector3 a, Vector3 b, double alpha);
14
+ }
@@ -0,0 +1,17 @@
1
+ #pragma once
2
+
3
+ // nightcycle/spring — Fraktality-style damped spring, vendored into CluauppLibs.Spring
4
+ struct Spring {
5
+ double Damping;
6
+ double Frequency;
7
+ double Goal;
8
+ double Position;
9
+ double Velocity;
10
+ Spring(double dampingRatio, double frequency, double position);
11
+ void Set(double goal);
12
+ double Get();
13
+ void Step(double dt);
14
+ void Impulse(double velocity);
15
+ void SetGoal(double target);
16
+ double Update(double dt);
17
+ };
@@ -2,6 +2,7 @@
2
2
 
3
3
  // Ward — server anti-cheat. Rate-limit remotes, cap packet size, speed strikes.
4
4
  // Runtime: CluauppLibs.Ward. Call Ward.Start() once on the server.
5
+ // Spawn/respawn are graced automatically. Studio does not Kick unless KickInStudio.
5
6
 
6
7
  namespace Ward {
7
8
  void Start();
@@ -1,8 +1,6 @@
1
1
  #pragma once
2
- // Cluaupp — Roblox API stubs for CL++ IntelliSense.
3
- // Source: official client dump + datatypes from create.roblox.com
4
- // clpp emits Luau (Vector3.new, Instance.new, :GetPlayers, ...).
5
- // CL++ has no default arguments — use overloads (wait / wait(seconds)).
2
+ // Cluaupp — Roblox API stubs for CL++ IntelliSense (generated projection).
3
+ // Source of truth: RobloxTargetProfile registry — not this header.
6
4
 
7
5
  #include <clpp/generated/enums.clh>
8
6
  #include <clpp/datatypes.clh>
@@ -39,4 +37,5 @@ namespace task {
39
37
  void defer(func callback);
40
38
  void synchronize();
41
39
  void desynchronize();
40
+ void spawn(func callback);
42
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cluaupp",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Cluaupp toolchain — compile CL++ to Luau with Rojo and CluauppLibs.",
5
5
  "author": "KartzDev",
6
6
  "license": "MIT",
@@ -22,9 +22,15 @@
22
22
  "examples",
23
23
  "editors",
24
24
  "runtime",
25
+ "skills",
26
+ "api",
27
+ "data",
28
+ "plugins",
29
+ "scripts/postinstall-editor.js",
25
30
  "README.md",
26
31
  "LICENSE",
27
- "CHANGELOG.md"
32
+ "CHANGELOG.md",
33
+ "stylua.toml"
28
34
  ],
29
35
  "workspaces": [
30
36
  "docs"
@@ -36,7 +42,8 @@
36
42
  "build:cli": "tsc",
37
43
  "dev:cli": "tsx src/cli.ts",
38
44
  "prepare": "tsc",
39
- "test": "node test/security.test.js && node test/understander.test.js && node test/out.test.js && node test/types.test.js && node test/modules.test.js && node test/clpp.test.js && node test/flare.test.js && node test/native.test.js",
45
+ "postinstall": "node scripts/postinstall-editor.js",
46
+ "test": "node test/security.test.js && node test/understander.test.js && node test/out.test.js && node test/types.test.js && node test/modules.test.js && node test/modules-import.test.js && node test/get-service.test.js && node test/clpp.test.js && node test/flare.test.js && node test/native.test.js && node test/postprocess.test.js && node test/api.test.js && node test/api-reuse.test.js && node test/context-safety.test.js && node test/datamodel.test.js && node test/platform-analyzers.test.js && node test/platform-extras.test.js && node test/generator.test.js && node test/studio/smoke.test.js",
40
47
  "test:clpp-contract": "node test/clpp.test.js",
41
48
  "generate-api": "node scripts/generate-api.js",
42
49
  "vendor-libs": "node scripts/vendor-libs.js",
@@ -0,0 +1,207 @@
1
+ -- Cluaupp Studio plugin: nav + debug panel + IDE bridge.
2
+ -- Install: copy plugins/CluauppNav into Roblox Plugins folder.
3
+ -- Bridge: run `cluaupp bridge` in the game root (http://127.0.0.1:3847).
4
+
5
+ local HttpService = game:GetService("HttpService")
6
+ local ScriptContext = game:GetService("ScriptContext")
7
+ local Selection = game:GetService("Selection")
8
+ local RunService = game:GetService("RunService")
9
+
10
+ local BRIDGE = "http://127.0.0.1:3847"
11
+
12
+ local toolbar = plugin:CreateToolbar("Cluaupp")
13
+ local btnSource = toolbar:CreateButton("Source", "Show CL++ path for selected Script", "")
14
+ local btnOpenIde = toolbar:CreateButton("Open IDE", "Ask IDE bridge to open CL++ source", "")
15
+ local btnPanel = toolbar:CreateButton("Debug", "Toggle Cluaupp debug panel", "")
16
+
17
+ local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Right, false, false, 320, 420, 260, 200)
18
+ local widget = plugin:CreateDockWidgetPluginGui("CluauppDebug", widgetInfo)
19
+ widget.Title = "Cluaupp Debug"
20
+
21
+ local root = Instance.new("Frame")
22
+ root.Size = UDim2.fromScale(1, 1)
23
+ root.BackgroundColor3 = Color3.fromRGB(30, 30, 34)
24
+ root.BorderSizePixel = 0
25
+ root.Parent = widget
26
+
27
+ local title = Instance.new("TextLabel")
28
+ title.Size = UDim2.new(1, -12, 0, 28)
29
+ title.Position = UDim2.fromOffset(6, 4)
30
+ title.BackgroundTransparency = 1
31
+ title.TextXAlignment = Enum.TextXAlignment.Left
32
+ title.Font = Enum.Font.GothamBold
33
+ title.TextSize = 14
34
+ title.TextColor3 = Color3.fromRGB(230, 230, 235)
35
+ title.Text = "Cluaupp Debug"
36
+ title.Parent = root
37
+
38
+ local pathLabel = Instance.new("TextLabel")
39
+ pathLabel.Size = UDim2.new(1, -12, 0, 48)
40
+ pathLabel.Position = UDim2.fromOffset(6, 36)
41
+ pathLabel.BackgroundTransparency = 1
42
+ pathLabel.TextXAlignment = Enum.TextXAlignment.Left
43
+ pathLabel.TextYAlignment = Enum.TextYAlignment.Top
44
+ pathLabel.TextWrapped = true
45
+ pathLabel.Font = Enum.Font.Code
46
+ pathLabel.TextSize = 12
47
+ pathLabel.TextColor3 = Color3.fromRGB(180, 220, 180)
48
+ pathLabel.Text = "(select a Script)"
49
+ pathLabel.Parent = root
50
+
51
+ local logBox = Instance.new("ScrollingFrame")
52
+ logBox.Size = UDim2.new(1, -12, 1, -100)
53
+ logBox.Position = UDim2.fromOffset(6, 92)
54
+ logBox.BackgroundColor3 = Color3.fromRGB(22, 22, 26)
55
+ logBox.BorderSizePixel = 0
56
+ logBox.ScrollBarThickness = 6
57
+ logBox.CanvasSize = UDim2.new(0, 0, 0, 0)
58
+ logBox.AutomaticCanvasSize = Enum.AutomaticSize.Y
59
+ logBox.Parent = root
60
+
61
+ local logLayout = Instance.new("UIListLayout")
62
+ logLayout.Parent = logBox
63
+ logLayout.SortOrder = Enum.SortOrder.LayoutOrder
64
+ logLayout.Padding = UDim.new(0, 4)
65
+
66
+ local function appendLog(text: string, color: Color3?)
67
+ local row = Instance.new("TextLabel")
68
+ row.Size = UDim2.new(1, -8, 0, 0)
69
+ row.AutomaticSize = Enum.AutomaticSize.Y
70
+ row.BackgroundTransparency = 1
71
+ row.TextXAlignment = Enum.TextXAlignment.Left
72
+ row.TextYAlignment = Enum.TextYAlignment.Top
73
+ row.TextWrapped = true
74
+ row.Font = Enum.Font.Code
75
+ row.TextSize = 11
76
+ row.TextColor3 = color or Color3.fromRGB(200, 200, 210)
77
+ row.Text = text
78
+ row.Parent = logBox
79
+ end
80
+
81
+ local function findSourceComment(source: string): string?
82
+ for line in string.gmatch(source, "[^\r\n]+") do
83
+ local p = string.match(line, "^%-%-%s*cluaupp%-source:%s*(.+)%s*$")
84
+ if p then
85
+ return p
86
+ end
87
+ if not string.match(line, "^%-%-") then
88
+ break
89
+ end
90
+ end
91
+ return nil
92
+ end
93
+
94
+ local function currentClppPath(): (string?, LuaSourceContainer?)
95
+ local sel = Selection:Get()
96
+ local scriptInst = sel[1]
97
+ if not scriptInst or not scriptInst:IsA("LuaSourceContainer") then
98
+ return nil, nil
99
+ end
100
+ local ok, source = pcall(function()
101
+ return (scriptInst :: LuaSourceContainer).Source
102
+ end)
103
+ if not ok or typeof(source) ~= "string" then
104
+ return nil, scriptInst :: LuaSourceContainer
105
+ end
106
+ local p = findSourceComment(source)
107
+ if p then
108
+ (scriptInst :: Instance):SetAttribute("CluauppSource", p)
109
+ end
110
+ return p, scriptInst :: LuaSourceContainer
111
+ end
112
+
113
+ local function postBridge(payload: { [string]: any })
114
+ task.spawn(function()
115
+ local ok, err = pcall(function()
116
+ HttpService:RequestAsync({
117
+ Url = BRIDGE .. "/open",
118
+ Method = "POST",
119
+ Headers = { ["Content-Type"] = "application/json" },
120
+ Body = HttpService:JSONEncode(payload),
121
+ })
122
+ end)
123
+ if not ok then
124
+ appendLog("bridge offline — run `cluaupp bridge`\n" .. tostring(err), Color3.fromRGB(255, 160, 120))
125
+ else
126
+ appendLog("→ IDE " .. tostring(payload.path or payload.message), Color3.fromRGB(140, 200, 255))
127
+ end
128
+ end)
129
+ end
130
+
131
+ local function refreshSelection()
132
+ local p, inst = currentClppPath()
133
+ if p then
134
+ pathLabel.Text = p
135
+ if inst then
136
+ pathLabel.Text ..= "\n(" .. inst:GetFullName() .. ")"
137
+ end
138
+ else
139
+ pathLabel.Text = "(no cluaupp-source stamp — rebuild)"
140
+ end
141
+ end
142
+
143
+ btnSource.Click:Connect(function()
144
+ refreshSelection()
145
+ local p = select(1, currentClppPath())
146
+ if p then
147
+ print("[Cluaupp] CL++ source:", p)
148
+ appendLog("source " .. p)
149
+ else
150
+ warn("[Cluaupp] Select a Script with -- cluaupp-source:")
151
+ end
152
+ end)
153
+
154
+ btnOpenIde.Click:Connect(function()
155
+ refreshSelection()
156
+ local p, inst = currentClppPath()
157
+ if not p then
158
+ warn("[Cluaupp] No CL++ path on selection")
159
+ return
160
+ end
161
+ postBridge({
162
+ type = "open",
163
+ path = p,
164
+ instancePath = inst and inst:GetFullName() or nil,
165
+ })
166
+ end)
167
+
168
+ btnPanel.Click:Connect(function()
169
+ widget.Enabled = not widget.Enabled
170
+ if widget.Enabled then
171
+ refreshSelection()
172
+ end
173
+ end)
174
+
175
+ Selection.SelectionChanged:Connect(function()
176
+ if widget.Enabled then
177
+ refreshSelection()
178
+ end
179
+ end)
180
+
181
+ -- Error → CL++ remap (Studio debugger helper)
182
+ ScriptContext.Error:Connect(function(message, stack, scriptInst)
183
+ if not scriptInst or not scriptInst:IsA("LuaSourceContainer") then
184
+ return
185
+ end
186
+ local ok, source = pcall(function()
187
+ return (scriptInst :: LuaSourceContainer).Source
188
+ end)
189
+ local clpp = ok and typeof(source) == "string" and findSourceComment(source) or nil
190
+ local line = tonumber(string.match(stack or "", ":(%d+)")) or 1
191
+ local text = string.format("[error] %s\n luau: %s\n clpp: %s:%d", tostring(message), scriptInst:GetFullName(), tostring(clpp or "?"), line)
192
+ appendLog(text, Color3.fromRGB(255, 120, 120))
193
+ if clpp then
194
+ postBridge({
195
+ type = "error",
196
+ path = clpp,
197
+ line = line,
198
+ message = tostring(message),
199
+ instancePath = scriptInst:GetFullName(),
200
+ })
201
+ end
202
+ end)
203
+
204
+ appendLog("Ready. Enable HttpService + run cluaupp bridge for IDE sync.")
205
+ if not RunService:IsEdit() then
206
+ appendLog("Play mode: errors remap to CL++ paths.")
207
+ end
@@ -0,0 +1,27 @@
1
+ -- Studio / playtest PGO logger stub.
2
+ -- Paste into a Script during profiling sessions, or require from ReplicatedStorage.
3
+ -- Dump Output lines starting with CLUAUPP_PGO into a .jsonl file, then:
4
+ -- cluaupp profile ingest ./playtest.jsonl
5
+
6
+ local Profile = {}
7
+
8
+ local counts: { [string]: number } = {}
9
+
10
+ function Profile.Hit(symbol: string, n: number?)
11
+ local add = n or 1
12
+ counts[symbol] = (counts[symbol] or 0) + add
13
+ print(string.format('CLUAUPP_PGO {"symbol":%q,"count":%d}', symbol, add))
14
+ end
15
+
16
+ function Profile.Dump()
17
+ local lines = {}
18
+ for symbol, count in counts do
19
+ table.insert(lines, string.format('{"symbol":%q,"count":%d}', symbol, count))
20
+ end
21
+ print("CLUAUPP_PGO_DUMP_BEGIN")
22
+ print(table.concat(lines, "\n"))
23
+ print("CLUAUPP_PGO_DUMP_END")
24
+ return counts
25
+ end
26
+
27
+ return Profile
@@ -0,0 +1,24 @@
1
+ # Cluaupp Studio tools (Nav + Debug + IDE bridge)
2
+
3
+ ## Install
4
+
5
+ 1. Copy this folder to your Roblox Plugins directory.
6
+ 2. In Studio: **Game Settings → Security → Allow HTTP Requests** (for IDE bridge).
7
+ 3. In the game root: `cluaupp bridge` (listens on `127.0.0.1:3847`).
8
+ 4. Rebuild so Luau has `-- cluaupp-source: …`.
9
+
10
+ ## Toolbar
11
+
12
+ | Button | Action |
13
+ | --- | --- |
14
+ | **Source** | Print / show CL++ path for selected Script |
15
+ | **Open IDE** | POST path to `cluaupp bridge` → Cursor/VS Code opens the file |
16
+ | **Debug** | Dock panel: selection path + runtime errors remapped to CL++ |
17
+
18
+ ## PGO
19
+
20
+ Use `ProfileLogger.luau` during playtests, then `cluaupp profile --ingest hits.jsonl`.
21
+
22
+ ## SoA
23
+
24
+ `cluaupp optimize --apply --layout` writes `#pragma layout soa` and emits `.cluaupp/generated/soa/*Soa.luau`.
@@ -576,15 +576,18 @@ Axiom.Groups = {
576
576
  Color = { "FromHSV", "Contrast", "LerpHSV" },
577
577
  } :: { [string]: { string } }
578
578
 
579
- function Axiom.Select(groupNames: { string }): typeof(Axiom)
579
+ function Axiom.Select(names: { string }): typeof(Axiom)
580
580
  local selected: { [string]: unknown } = {}
581
- for _, group in groupNames do
582
- local names = Axiom.Groups[group]
583
- if not names then
584
- error(`[Axiom.Select] unknown group "{group}"`)
585
- end
586
- for _, name in names do
581
+ for _, name in names do
582
+ local groupFns = Axiom.Groups[name]
583
+ if groupFns then
584
+ for _, fnName in groupFns do
585
+ selected[fnName] = Axiom[fnName]
586
+ end
587
+ elseif typeof(Axiom[name]) == "function" then
587
588
  selected[name] = Axiom[name]
589
+ else
590
+ error(`[Axiom.Select] unknown group or function "{name}"`)
588
591
  end
589
592
  end
590
593
  if selected.LerpVector3 ~= nil then
@@ -174,10 +174,14 @@ function Coil:Impulse(velocity: any)
174
174
  end
175
175
 
176
176
  function Coil:Step(dt: number)
177
- if dt ~= dt or dt <= 0 then
177
+ if typeof(dt) ~= "number" or dt ~= dt or dt <= 0 then
178
178
  return
179
179
  end
180
- local omega = self.Frequency * TAU
180
+ local frequency = self.Frequency
181
+ if typeof(frequency) ~= "number" then
182
+ return
183
+ end
184
+ local omega = frequency * TAU
181
185
  if omega <= 0 then
182
186
  return
183
187
  end
@@ -206,4 +210,6 @@ function Coil:Update(dt: number): any
206
210
  return self.Position
207
211
  end
208
212
 
213
+ Coil.New = Coil.new
214
+
209
215
  return Coil
@@ -403,6 +403,7 @@ function Crest:Destroy()
403
403
  self._button:Destroy()
404
404
  end
405
405
 
406
+ Crest.new_ = Crest.new
406
407
  Crest.SetLabel = Crest.setLabel
407
408
  Crest.SetImage = Crest.setImage
408
409
  Crest.SetEnabled = Crest.setEnabled
@@ -577,8 +577,9 @@ function Flare.open(host: ModuleScript)
577
577
  if not Ward.Allow(player, "flare:query", 10, 20) then
578
578
  return bufferCreate(0)
579
579
  end
580
+ local packedInstances = table.pack(...) :: any
580
581
  local results = table.pack(pcall(function()
581
- local incoming = fromBuffer(buf, table.pack(...) :: any)
582
+ local incoming = fromBuffer(buf, packedInstances)
582
583
  local id = Flare.readu8(incoming)
583
584
  local spec = queryById[id]
584
585
  local handler = queryHandlers[id]
@@ -41,6 +41,16 @@ local pending: { [Scope]: boolean } = {}
41
41
  local SETTLE = 0.0005
42
42
 
43
43
  local ACTION_FLAG = "_gleamAction"
44
+ -- cluaupp: weak-table Sweep (Instance cannot take _gleamSweep)
45
+ local sweeps: { [Instance]: any } = setmetatable({}, { __mode = "k" }) :: any
46
+
47
+ local function getSweep(instance: Instance): any?
48
+ return sweeps[instance]
49
+ end
50
+
51
+ local function setSweep(instance: Instance, sweep: any)
52
+ sweeps[instance] = sweep
53
+ end
44
54
 
45
55
  local function peek(): Scope?
46
56
  return stack[#stack]
@@ -270,8 +280,9 @@ local function destroyNode(node: any)
270
280
  return
271
281
  end
272
282
  if typeof(node) == "Instance" then
273
- local sweep = (node :: any)._gleamSweep
283
+ local sweep = getSweep(node)
274
284
  if sweep then
285
+ sweeps[node] = nil
275
286
  sweep:Destroy()
276
287
  else
277
288
  node:Destroy()
@@ -421,7 +432,7 @@ function Gleam.Create(className: string, props: { [any]: any }?): Instance
421
432
  local sweep = Sweep.new()
422
433
  sweep:Add(instance, "Destroy")
423
434
  sweep:LinkToInstance(instance)
424
- ;(instance :: any)._gleamSweep = sweep
435
+ setSweep(instance, sweep)
425
436
 
426
437
  local parent = peek()
427
438
  pushSweepScope(sweep)
@@ -695,11 +706,11 @@ end
695
706
 
696
707
  function Gleam.Apply(instance: Instance): (props: { [any]: any }) -> Instance
697
708
  return function(props)
698
- local sweep = (instance :: any)._gleamSweep
709
+ local sweep = getSweep(instance)
699
710
  if not sweep then
700
711
  sweep = Sweep.new()
701
712
  sweep:LinkToInstance(instance)
702
- ;(instance :: any)._gleamSweep = sweep
713
+ setSweep(instance, sweep)
703
714
  end
704
715
  pushSweepScope(sweep)
705
716
  applyProps(instance, props)
@@ -106,6 +106,22 @@ local function canWrite(self: any): boolean
106
106
  return RunService:IsServer()
107
107
  end
108
108
 
109
+ -- Generated .hive schemas export Health = { Id = 2, Fields = ... }.
110
+ -- Headers still say const int Health = 2. Accept both.
111
+ local function resolveComponentId(componentId: any): number
112
+ local kind = typeof(componentId)
113
+ if kind == "number" then
114
+ return componentId
115
+ end
116
+ if kind == "table" then
117
+ local id = (componentId :: any).Id
118
+ if typeof(id) == "number" then
119
+ return id
120
+ end
121
+ end
122
+ error("[Hive] component id must be a number or { Id = number }, got " .. kind)
123
+ end
124
+
109
125
  function Hive:Entity(): number
110
126
  if not canWrite(self) then
111
127
  return 0
@@ -116,28 +132,29 @@ function Hive:Entity(): number
116
132
  return id
117
133
  end
118
134
 
119
- function Hive:Set(entity: number, componentId: number, value: any)
135
+ function Hive:Set(entity: number, componentId: any, value: any)
120
136
  if not canWrite(self) then
121
137
  return
122
138
  end
123
- local column = self.Columns[componentId]
139
+ local id = resolveComponentId(componentId)
140
+ local column = self.Columns[id]
124
141
  if not column then
125
142
  column = {}
126
- self.Columns[componentId] = column
143
+ self.Columns[id] = column
127
144
  end
128
145
  column[entity] = value
129
146
  end
130
147
 
131
- function Hive:Get(entity: number, componentId: number): any
132
- local column = self.Columns[componentId]
148
+ function Hive:Get(entity: number, componentId: any): any
149
+ local column = self.Columns[resolveComponentId(componentId)]
133
150
  return column and column[entity]
134
151
  end
135
152
 
136
- function Hive:Remove(entity: number, componentId: number)
153
+ function Hive:Remove(entity: number, componentId: any)
137
154
  if not canWrite(self) then
138
155
  return
139
156
  end
140
- local column = self.Columns[componentId]
157
+ local column = self.Columns[resolveComponentId(componentId)]
141
158
  if column then
142
159
  column[entity] = nil
143
160
  end
@@ -153,13 +170,17 @@ function Hive:Despawn(entity: number)
153
170
  end
154
171
  end
155
172
 
156
- function Hive:Has(entity: number, componentId: number): boolean
157
- local column = self.Columns[componentId]
173
+ function Hive:Has(entity: number, componentId: any): boolean
174
+ local column = self.Columns[resolveComponentId(componentId)]
158
175
  return column ~= nil and column[entity] ~= nil
159
176
  end
160
177
 
161
- function Hive:Query(...: number): () -> (...any)
162
- local ids = { ... }
178
+ function Hive:Query(...: any): () -> (...any)
179
+ local raw = { ... }
180
+ local ids = table.create(#raw)
181
+ for index, componentId in raw do
182
+ ids[index] = resolveComponentId(componentId)
183
+ end
163
184
  if #ids == 0 then
164
185
  local entity: number? = nil
165
186
  return function()
@@ -195,14 +216,15 @@ function Hive:Query(...: number): () -> (...any)
195
216
  end
196
217
  end
197
218
 
198
- function Hive:Snapshot(componentId: number): buffer
199
- local column = self.Columns[componentId] or {}
219
+ function Hive:Snapshot(componentId: any): buffer
220
+ local id = resolveComponentId(componentId)
221
+ local column = self.Columns[id] or {}
200
222
  local count = 0
201
223
  for _ in column do
202
224
  count += 1
203
225
  end
204
226
  local buf = buffer.create(math.max(64, 5 + count * 16))
205
- buffer.writeu8(buf, 0, componentId)
227
+ buffer.writeu8(buf, 0, id)
206
228
  buffer.writeu32(buf, 1, count)
207
229
  local cursor = 5
208
230
  for entity, value in column do
@@ -156,7 +156,7 @@ function Pin.new(adornee: Instance, gui: GuiObject, options: Options?): Pin
156
156
  billboard.StudsOffset = opts.StudsOffset or Vector3.new(0, 2, 0)
157
157
  billboard.StudsOffsetWorldSpace = opts.StudsOffsetWorldSpace or Vector3.zero
158
158
  billboard.MaxDistance = opts.MaxDistance or 120
159
- billboard.MinDistance = opts.MinDistance or 0
159
+ -- BillboardGui has MaxDistance only; MinDistance in PinOptions is reserved / ignored.
160
160
  billboard.AlwaysOnTop = if opts.AlwaysOnTop == nil then true else opts.AlwaysOnTop
161
161
  billboard.LightInfluence = opts.LightInfluence or 0
162
162
  billboard.ResetOnSpawn = false
@@ -185,6 +185,7 @@ function Pin.new(adornee: Instance, gui: GuiObject, options: Options?): Pin
185
185
  _fade = if opts.Fade == nil then true else opts.Fade,
186
186
  _scale = if opts.Scale == nil then true else opts.Scale,
187
187
  _baseSize = baseSize,
188
+ _minDistance = opts.MinDistance or 0,
188
189
  _canvas = canvas,
189
190
  }, Pin)
190
191
 
@@ -213,7 +214,7 @@ function Pin.new(adornee: Instance, gui: GuiObject, options: Options?): Pin
213
214
  if maxDistance <= 0 then
214
215
  maxDistance = 1e9
215
216
  end
216
- local minDistance = billboard.MinDistance
217
+ local minDistance = self._minDistance
217
218
 
218
219
  if self._occlude then
219
220
  self._occluded = isOccluded(origin, goal, billboard.Adornee or adornee)
@@ -303,4 +304,6 @@ function Pin:Destroy()
303
304
  table.clear(self._janitor)
304
305
  end
305
306
 
307
+ Pin.new_ = Pin.new
308
+
306
309
  return Pin
@@ -277,6 +277,8 @@ function Roster.new<T>(initial: { T }?): Roster<T>
277
277
  return setmetatable({ Data = initial or {} }, Roster)
278
278
  end
279
279
 
280
+ Roster.New = Roster.new
281
+
280
282
  function Roster.Size(source: any): number
281
283
  local count = 0
282
284
  for _ in unwrap(source) do
@@ -350,6 +350,9 @@ function Spark.IsDestroyed(self: SparkImpl): boolean
350
350
  end
351
351
 
352
352
  function Spark.DisconnectAll(self: SparkImpl)
353
+ if not self then
354
+ return
355
+ end
353
356
  local item = self._head
354
357
  self._head = nil
355
358
  self._tail = nil
@@ -248,6 +248,8 @@ Sweep.AddPromise = function(self: Sweep, promise: any, index: any?): any
248
248
  return self:Add(promise, "Cancel", index)
249
249
  end
250
250
 
251
+ Sweep.New = Sweep.new
252
+
251
253
  setmetatable(Sweep, {
252
254
  __call = function()
253
255
  return Sweep.new()