cluaupp 1.5.2 → 2.0.0-beta.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.
Files changed (210) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +29 -41
  3. package/api/generated/bench-latest.json +43 -21
  4. package/api/generated/lsp-index.json +1 -1
  5. package/api/manifests/roblox-target.manifest.json +5 -5
  6. package/api/normalized/roblox-target.profile.json +8729 -267
  7. package/api/roblox/luau-builtins.d.luau +185 -0
  8. package/api/roblox/surface.json +1 -0
  9. package/api/roblox-api.lock.json +11 -2
  10. package/bin/cluaupp.js +38 -0
  11. package/editors/vscode/README.md +1 -1
  12. package/editors/vscode/package.json +50 -15
  13. package/editors/vscode/snippets/flare.json +1 -1
  14. package/editors/vscode/snippets/hive.json +1 -1
  15. package/editors/vscode/syntaxes/clpp.tmLanguage.json +211 -0
  16. package/examples/README.md +9 -9
  17. package/examples/game/cluaupp.config.json +2 -2
  18. package/examples/game/default.project.json +4 -15
  19. package/examples/game/out/ReplicatedStorage/Shared/GameInfo.luau +8 -0
  20. package/examples/game/out/ReplicatedStorage/Shared/GameInfo.luau.map.json +13 -0
  21. package/examples/game/out/ServerScriptService/Leaderstats.server.luau +26 -0
  22. package/examples/game/out/ServerScriptService/Leaderstats.server.luau.map.json +13 -0
  23. package/examples/game/out/ServerScriptService/Main.server.luau +15 -0
  24. package/examples/game/out/ServerScriptService/Main.server.luau.map.json +13 -0
  25. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Main.client.luau +10 -0
  26. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Main.client.luau.map.json +13 -0
  27. package/examples/game/src/ReplicatedStorage/Shared/GameInfo.clp +1 -0
  28. package/examples/game/src/ServerScriptService/Leaderstats.server.clp +18 -0
  29. package/examples/game/src/ServerScriptService/Main.server.clp +9 -0
  30. package/examples/game/src/StarterPlayer/StarterPlayerScripts/Main.client.clp +4 -0
  31. package/generated/api/build-profile.js +1 -1
  32. package/generated/api/loader.js +2 -2
  33. package/generated/api/surface/build.js +328 -0
  34. package/generated/api/surface/luau-defs.js +595 -0
  35. package/generated/api/surface/model.js +8 -0
  36. package/generated/api-cli.js +2 -2
  37. package/generated/cli.js +18 -17
  38. package/generated/clpp/contract.js +6 -3
  39. package/generated/clpp/handshake.js +36 -0
  40. package/generated/clpp/modules.js +20 -9
  41. package/generated/clpp/runner.js +62 -31
  42. package/generated/compile.js +18 -1
  43. package/generated/compiler/ast.js +3 -0
  44. package/generated/compiler/checker/calls.js +999 -0
  45. package/generated/compiler/checker/checker.js +1215 -0
  46. package/generated/compiler/checker/exprs.js +791 -0
  47. package/generated/compiler/checker/flow.js +168 -0
  48. package/generated/compiler/checker/members.js +763 -0
  49. package/generated/compiler/checker/statements.js +792 -0
  50. package/generated/compiler/checker/symbols.js +90 -0
  51. package/generated/compiler/checker/typeops.js +348 -0
  52. package/generated/compiler/checker/yields.js +115 -0
  53. package/generated/compiler/diagnostics.js +138 -0
  54. package/generated/compiler/emit/emitter.js +2356 -0
  55. package/generated/compiler/emit/luau-types.js +137 -0
  56. package/generated/compiler/emit/names.js +130 -0
  57. package/generated/compiler/emit/runtime.js +432 -0
  58. package/generated/compiler/lexer.js +403 -0
  59. package/generated/compiler/parser.js +1881 -0
  60. package/generated/compiler/project.js +332 -0
  61. package/generated/compiler/roblox/api.js +388 -0
  62. package/generated/compiler/roblox/context.js +100 -0
  63. package/generated/compiler/source.js +59 -0
  64. package/generated/compiler/stdlib.js +232 -0
  65. package/generated/compiler/types.js +250 -0
  66. package/generated/intellisense.js +1 -15
  67. package/generated/lsp.js +1 -1
  68. package/generated/target/build-cache.js +4 -4
  69. package/generated/target/datamodel-generate.js +12 -0
  70. package/generated/target/gen-rojo-tree.js +15 -0
  71. package/generated/target/source-map.js +61 -8
  72. package/generated/target/studio-bridge.js +1 -0
  73. package/generated/utils/project.js +104 -31
  74. package/include/README.md +5 -0
  75. package/native/bin/.gitkeep +1 -0
  76. package/package.json +17 -6
  77. package/plugins/CluauppNav/Plugin.luau +28 -4
  78. package/rust/cluaupp/Cargo.lock +795 -0
  79. package/rust/cluaupp/Cargo.toml +17 -0
  80. package/rust/cluaupp/src/main.rs +717 -0
  81. package/scripts/postinstall-native.js +56 -0
  82. package/skills/README.md +3 -3
  83. package/skills/clpp-hive-flare/SKILL.md +30 -26
  84. package/skills/clpp-language/SKILL.md +67 -74
  85. package/skills/clpp-language/compiler.md +24 -36
  86. package/skills/clpp-style/SKILL.md +31 -44
  87. package/src/api/build-profile.ts +1 -1
  88. package/src/api/loader.ts +2 -2
  89. package/src/api/surface/build.ts +374 -0
  90. package/src/api/surface/luau-defs.ts +635 -0
  91. package/src/api/surface/model.ts +96 -0
  92. package/src/api-cli.ts +2 -2
  93. package/src/cli.ts +19 -18
  94. package/src/clpp/contract.ts +20 -3
  95. package/src/clpp/handshake.ts +25 -0
  96. package/src/clpp/modules.ts +17 -10
  97. package/src/clpp/runner.ts +52 -34
  98. package/src/compile.ts +20 -2
  99. package/src/compiler/ast.ts +336 -0
  100. package/src/compiler/checker/calls.ts +1025 -0
  101. package/src/compiler/checker/checker.ts +1352 -0
  102. package/src/compiler/checker/exprs.ts +805 -0
  103. package/src/compiler/checker/flow.ts +174 -0
  104. package/src/compiler/checker/members.ts +793 -0
  105. package/src/compiler/checker/statements.ts +802 -0
  106. package/src/compiler/checker/symbols.ts +219 -0
  107. package/src/compiler/checker/typeops.ts +355 -0
  108. package/src/compiler/checker/yields.ts +120 -0
  109. package/src/compiler/diagnostics.ts +163 -0
  110. package/src/compiler/emit/emitter.ts +2486 -0
  111. package/src/compiler/emit/luau-types.ts +143 -0
  112. package/src/compiler/emit/names.ts +130 -0
  113. package/src/compiler/emit/runtime.ts +438 -0
  114. package/src/compiler/lexer.ts +444 -0
  115. package/src/compiler/parser.ts +1943 -0
  116. package/src/compiler/project.ts +354 -0
  117. package/src/compiler/roblox/api.ts +408 -0
  118. package/src/compiler/roblox/context.ts +108 -0
  119. package/src/compiler/source.ts +67 -0
  120. package/src/compiler/stdlib.ts +256 -0
  121. package/src/compiler/types.ts +313 -0
  122. package/src/intellisense.ts +1 -13
  123. package/src/lsp.ts +1 -1
  124. package/src/target/build-cache.ts +5 -8
  125. package/src/target/datamodel-generate.ts +12 -1
  126. package/src/target/gen-rojo-tree.ts +15 -0
  127. package/src/target/source-map.ts +65 -27
  128. package/src/target/studio-bridge.ts +3 -0
  129. package/src/types.ts +3 -0
  130. package/src/utils/project.ts +99 -37
  131. package/templates/README.md +7 -0
  132. package/templates/{game → game-modern}/cluaupp.config.json +2 -2
  133. package/templates/{game → game-modern}/package.json +1 -2
  134. package/templates/game-modern/rokit.toml +2 -0
  135. package/templates/game-modern/src/ReplicatedStorage/Shared/GameInfo.clp +1 -0
  136. package/templates/game-modern/src/ServerScriptService/Handlers/Guard.server.clp +4 -0
  137. package/templates/game-modern/src/ServerScriptService/Main.server.clp +8 -0
  138. package/templates/game-modern/src/StarterPlayer/StarterPlayerScripts/Main.client.clp +4 -0
  139. package/examples/game/out/ReplicatedStorage/Shared/Constants/Datas/TemplateData.luau +0 -29
  140. package/examples/game/out/ReplicatedStorage/Shared/Constants/Datas/TemplateData.luau.map.json +0 -13
  141. package/examples/game/out/ReplicatedStorage/Shared/Net/Net.luau +0 -83
  142. package/examples/game/out/ReplicatedStorage/Shared/Net/Net.luau.map.json +0 -13
  143. package/examples/game/out/ServerScriptService/Boot/DataBoot.server.luau +0 -18
  144. package/examples/game/out/ServerScriptService/Boot/DataBoot.server.luau.map.json +0 -13
  145. package/examples/game/out/ServerScriptService/Configuration/ServerConfig.luau +0 -14
  146. package/examples/game/out/ServerScriptService/Configuration/ServerConfig.luau.map.json +0 -13
  147. package/examples/game/out/ServerScriptService/Handlers/Guard.server.luau +0 -15
  148. package/examples/game/out/ServerScriptService/Handlers/Guard.server.luau.map.json +0 -13
  149. package/examples/game/out/ServerScriptService/Handlers/PlayerHandler.server.luau +0 -50
  150. package/examples/game/out/ServerScriptService/Handlers/PlayerHandler.server.luau.map.json +0 -13
  151. package/examples/game/out/StarterPlayer/StarterCharacterScripts/Character/CharacterReady.client.luau +0 -12
  152. package/examples/game/out/StarterPlayer/StarterCharacterScripts/Character/CharacterReady.client.luau.map.json +0 -13
  153. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Controllers/DataController.client.luau +0 -16
  154. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Controllers/DataController.client.luau.map.json +0 -13
  155. package/examples/game/src/Client/Controllers/DataController.client.clpp +0 -7
  156. package/examples/game/src/Client/Main.client.clpp +0 -4
  157. package/examples/game/src/Declarations/Net.flare +0 -5
  158. package/examples/game/src/Include/GameTypes.clh +0 -40
  159. package/examples/game/src/Modules/Core/Guard.server.clpp +0 -7
  160. package/examples/game/src/Modules/Core/PlayerHandler.server.clpp +0 -23
  161. package/examples/game/src/Server/Boot/DataBoot.server.clpp +0 -13
  162. package/examples/game/src/Server/Main.server.clpp +0 -4
  163. package/templates/game/.clangd +0 -25
  164. package/templates/game/.vscode/extensions.json +0 -8
  165. package/templates/game/.vscode/settings.json +0 -17
  166. package/templates/game/Packages/.gitkeep +0 -0
  167. package/templates/game/compile_flags.txt +0 -6
  168. package/templates/game/default.project.json +0 -41
  169. package/templates/game/include/clpp/datatypes.clh +0 -575
  170. package/templates/game/include/clpp/generated/enums.clh +0 -4920
  171. package/templates/game/include/clpp/generated/instances.clh +0 -87182
  172. package/templates/game/include/clpp/libs/arrayindexer.clh +0 -12
  173. package/templates/game/include/clpp/libs/axiom.clh +0 -154
  174. package/templates/game/include/clpp/libs/bloom.clh +0 -58
  175. package/templates/game/include/clpp/libs/coil.clh +0 -37
  176. package/templates/game/include/clpp/libs/crest.clh +0 -22
  177. package/templates/game/include/clpp/libs/echo.clh +0 -52
  178. package/templates/game/include/clpp/libs/ember.clh +0 -17
  179. package/templates/game/include/clpp/libs/flare.clh +0 -65
  180. package/templates/game/include/clpp/libs/gleam.clh +0 -111
  181. package/templates/game/include/clpp/libs/guide.clh +0 -42
  182. package/templates/game/include/clpp/libs/helm.clh +0 -31
  183. package/templates/game/include/clpp/libs/hive.clh +0 -20
  184. package/templates/game/include/clpp/libs/keep.clh +0 -158
  185. package/templates/game/include/clpp/libs/lens.clh +0 -24
  186. package/templates/game/include/clpp/libs/mint.clh +0 -28
  187. package/templates/game/include/clpp/libs/net.clh +0 -31
  188. package/templates/game/include/clpp/libs/occlude.clh +0 -15
  189. package/templates/game/include/clpp/libs/pin.clh +0 -28
  190. package/templates/game/include/clpp/libs/promise.clh +0 -24
  191. package/templates/game/include/clpp/libs/roster.clh +0 -123
  192. package/templates/game/include/clpp/libs/shift.clh +0 -22
  193. package/templates/game/include/clpp/libs/spark.clh +0 -28
  194. package/templates/game/include/clpp/libs/stage.clh +0 -23
  195. package/templates/game/include/clpp/libs/sweep.clh +0 -23
  196. package/templates/game/include/clpp/libs/trace.clh +0 -18
  197. package/templates/game/include/clpp/libs/ward.clh +0 -19
  198. package/templates/game/include/clpp/libs.clh +0 -31
  199. package/templates/game/include/clpp/roblox.clh +0 -41
  200. package/templates/game/rokit.toml +0 -5
  201. package/templates/game/src/Client/Controllers/DataController.client.clpp +0 -7
  202. package/templates/game/src/Client/Main.client.clpp +0 -4
  203. package/templates/game/src/Declarations/Net.flare +0 -5
  204. package/templates/game/src/Include/GameTypes.clh +0 -40
  205. package/templates/game/src/Modules/Core/Guard.server.clpp +0 -7
  206. package/templates/game/src/Modules/Core/PlayerHandler.server.clpp +0 -24
  207. package/templates/game/src/Server/Boot/DataBoot.server.clpp +0 -13
  208. package/templates/game/src/Server/Main.server.clpp +0 -4
  209. package/templates/game/stylua.toml +0 -9
  210. package/templates/game/wally.toml +0 -12
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
- "profileHash": "81e280ef74182ccfe3087e5ded99e51d85cf9368e5d01102b19bda788a5f10bb",
3
+ "profileHash": "dd9f48a67175481b1270c36bbb55a1b7d22e9290f8d3e6475b2b37682242300d",
4
4
  "overridesHash": "4d9132f0307a553e92b8863663295b0ddb9fc7cad57db75a8fb7b7d1ab258f46",
5
5
  "robloxApiVersion": "1",
6
6
  "files": {
7
- "api/generated/lsp-index.json": "58651ae79c0ce9a0abba227d5e53706eb7f2527c55dc7a9daf6a7d7cfa76ec11"
7
+ "include/clpp/generated/enums.clh": "9b86e6325e405acee840eb4a19551e7bff0812a724b0312ee5b597482ecfa0c2",
8
+ "include/clpp/datatypes.clh": "4c188f9d60f4fda8a6dce947ca16d23abff988bfd2e4d6ebfee567f16489079f",
9
+ "include/clpp/generated/instances.clh": "63ec7b18880ec345b9ede43ecbf0cf8e80bc5d7f2fd3e0e60aad827bef5c3ec3",
10
+ "include/clpp/roblox.clh": "5bb8ac8cd84ca662da9a8e14329875612707160b231c1a9d5fab759d21b824af",
11
+ "src/api.generated.js": "1443cb1fd7f8bbc51835cc0ef09b11d569f94ec3d6e734ff92f7c7ffb6fbe93f",
12
+ "api/generated/luau/enums.d.luau": "b59709c0cead596e2512fad56a8efb8d2e1a07488aa678218bce69f2a5b1ca0d",
13
+ "api/generated/luau/datatypes.d.luau": "555ce875e7c491a5a3c2eb90c4c2db7b56c7d3d41f10d9a7c2c667eb07f4fccc",
14
+ "api/generated/luau/classes.d.luau": "b1faf83c53c88217370094764d5e1f6a30a05501dd916f1b759ac37cb590e6b8",
15
+ "api/generated/luau/globals.d.luau": "44673b0daa8306aa2dd2e7c08c0c97c6e18a51926b00237ce0f1d262821d0f35",
16
+ "api/generated/lsp-index.json": "ba3190b92e8b38bb8e48dddca31712f3bfc15de59d475d2f810be84b4134ef28"
8
17
  }
9
18
  }
package/bin/cluaupp.js CHANGED
@@ -1,4 +1,42 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
 
4
+ const fs = require("node:fs");
5
+ const path = require("node:path");
6
+ const { spawnSync } = require("node:child_process");
7
+
8
+ function exeName() {
9
+ return process.platform === "win32" ? "cluaupp.exe" : "cluaupp";
10
+ }
11
+
12
+ function nativeCandidates(pkgRoot) {
13
+ const platform = process.platform;
14
+ const arch = process.arch;
15
+ return [
16
+ process.env.CLUAUPP_NATIVE_BIN,
17
+ path.join(pkgRoot, "native", "bin", exeName()),
18
+ path.join(pkgRoot, "native", `${platform}-${arch}`, exeName()),
19
+ ].filter(Boolean);
20
+ }
21
+
22
+ function runNativeIfPresent() {
23
+ const pkgRoot = path.resolve(__dirname, "..");
24
+ process.env.CLUAUPP_HOME = process.env.CLUAUPP_HOME || pkgRoot;
25
+ for (const bin of nativeCandidates(pkgRoot)) {
26
+ if (!fs.existsSync(bin)) continue;
27
+ const result = spawnSync(bin, process.argv.slice(2), { stdio: "inherit", windowsHide: true });
28
+ if (typeof result.status === "number") {
29
+ process.exit(result.status);
30
+ }
31
+ if (result.error) {
32
+ console.warn("cluaupp: native failed, falling back to Node:", result.error.message);
33
+ break;
34
+ }
35
+ }
36
+ return false;
37
+ }
38
+
39
+ // The Rust launcher still uses the removed `clpp api compile` protocol. Keep it opt-in
40
+ // until it uses the in-package Roblox compiler too.
41
+ if (process.env.CLUAUPP_USE_NATIVE === "1") runNativeIfPresent();
4
42
  require("../generated/cli.js");
@@ -16,4 +16,4 @@ Installed by `cluaupp intellisense` into `~/.cursor/extensions` and `~/.vscode/e
16
16
  | `.shift` | states / transitions | snippets |
17
17
  | `.axiom` | groups | snippets |
18
18
 
19
- CL++ (`.clpp` / `.clp` / `.clh`) highlighting still comes from `clpp setup`.
19
+ CL++ .clp language support is installed separately through the CL++ editor extension. The clpp 0.10 VM has no setup or install subcommand. Legacy .clpp/.clh associations are retained for older projects.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cluaupp-flare",
3
3
  "displayName": "Cluaupp",
4
- "description": "Highlighting and IntelliSense for Cluaupp schemas: .flare, .hive, .mint, .bloom, .helm, .shift, .axiom. CL++ (.clpp) still comes from clpp setup.",
4
+ "description": "Highlighting and IntelliSense for Cluaupp schemas: .flare, .hive, .mint, .bloom, .helm, .shift, .axiom. CL++ language support is installed separately.",
5
5
  "version": "1.5.1",
6
6
  "publisher": "kartzdev",
7
7
  "engines": {
@@ -37,8 +37,13 @@
37
37
  "languages": [
38
38
  {
39
39
  "id": "flare",
40
- "aliases": ["Flare", "flare"],
41
- "extensions": [".flare"],
40
+ "aliases": [
41
+ "Flare",
42
+ "flare"
43
+ ],
44
+ "extensions": [
45
+ ".flare"
46
+ ],
42
47
  "configuration": "./language-configuration.json",
43
48
  "icon": {
44
49
  "light": "./icons/flare.svg",
@@ -47,8 +52,13 @@
47
52
  },
48
53
  {
49
54
  "id": "hive",
50
- "aliases": ["Hive", "hive"],
51
- "extensions": [".hive"],
55
+ "aliases": [
56
+ "Hive",
57
+ "hive"
58
+ ],
59
+ "extensions": [
60
+ ".hive"
61
+ ],
52
62
  "configuration": "./language-configuration-schema.json",
53
63
  "icon": {
54
64
  "light": "./icons/hive.svg",
@@ -57,8 +67,13 @@
57
67
  },
58
68
  {
59
69
  "id": "mint",
60
- "aliases": ["Mint", "mint"],
61
- "extensions": [".mint"],
70
+ "aliases": [
71
+ "Mint",
72
+ "mint"
73
+ ],
74
+ "extensions": [
75
+ ".mint"
76
+ ],
62
77
  "configuration": "./language-configuration-schema.json",
63
78
  "icon": {
64
79
  "light": "./icons/mint.svg",
@@ -67,8 +82,13 @@
67
82
  },
68
83
  {
69
84
  "id": "bloom",
70
- "aliases": ["Bloom", "bloom"],
71
- "extensions": [".bloom"],
85
+ "aliases": [
86
+ "Bloom",
87
+ "bloom"
88
+ ],
89
+ "extensions": [
90
+ ".bloom"
91
+ ],
72
92
  "configuration": "./language-configuration-schema.json",
73
93
  "icon": {
74
94
  "light": "./icons/bloom.svg",
@@ -77,8 +97,13 @@
77
97
  },
78
98
  {
79
99
  "id": "helm",
80
- "aliases": ["Helm", "helm"],
81
- "extensions": [".helm"],
100
+ "aliases": [
101
+ "Helm",
102
+ "helm"
103
+ ],
104
+ "extensions": [
105
+ ".helm"
106
+ ],
82
107
  "configuration": "./language-configuration-schema.json",
83
108
  "icon": {
84
109
  "light": "./icons/helm.svg",
@@ -87,8 +112,13 @@
87
112
  },
88
113
  {
89
114
  "id": "shift",
90
- "aliases": ["Shift", "shift"],
91
- "extensions": [".shift"],
115
+ "aliases": [
116
+ "Shift",
117
+ "shift"
118
+ ],
119
+ "extensions": [
120
+ ".shift"
121
+ ],
92
122
  "configuration": "./language-configuration-schema.json",
93
123
  "icon": {
94
124
  "light": "./icons/shift.svg",
@@ -97,8 +127,13 @@
97
127
  },
98
128
  {
99
129
  "id": "axiom",
100
- "aliases": ["Axiom", "axiom"],
101
- "extensions": [".axiom"],
130
+ "aliases": [
131
+ "Axiom",
132
+ "axiom"
133
+ ],
134
+ "extensions": [
135
+ ".axiom"
136
+ ],
102
137
  "configuration": "./language-configuration-schema.json",
103
138
  "icon": {
104
139
  "light": "./icons/axiom.svg",
@@ -22,6 +22,6 @@
22
22
  "opt name": {
23
23
  "prefix": "opt",
24
24
  "body": "opt name = ${1:Net}",
25
- "description": "Generated module name (Net.clh / Net.Hit)"
25
+ "description": "Generated module name (Net runtime module / Net.Hit)"
26
26
  }
27
27
  }
@@ -2,7 +2,7 @@
2
2
  "opt name": {
3
3
  "prefix": "opt",
4
4
  "body": "opt name = ${1:PlayerECS}",
5
- "description": "Generated module name (PlayerECS.clh / PlayerECS.Health)"
5
+ "description": "Generated module name (PlayerECS runtime module / PlayerECS.Health)"
6
6
  },
7
7
  "Component": {
8
8
  "prefix": "component",
@@ -0,0 +1,211 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3
+ "name": "CL++",
4
+ "scopeName": "source.clpp",
5
+ "patterns": [
6
+ { "include": "#comments" },
7
+ { "include": "#directives" },
8
+ { "include": "#link" },
9
+ { "include": "#attributes" },
10
+ { "include": "#strings" },
11
+ { "include": "#receiver" },
12
+ { "include": "#keywords" },
13
+ { "include": "#types" },
14
+ { "include": "#constants" },
15
+ { "include": "#numbers" },
16
+ { "include": "#operators" },
17
+ { "include": "#properties" },
18
+ { "include": "#functions" }
19
+ ],
20
+ "repository": {
21
+ "comments": {
22
+ "patterns": [
23
+ {
24
+ "name": "comment.line.clpp",
25
+ "match": "<<.*$"
26
+ },
27
+ {
28
+ "name": "comment.block.clpp",
29
+ "begin": "<<\\[",
30
+ "end": "\\]>>"
31
+ },
32
+ {
33
+ "name": "comment.line.legacy.clpp",
34
+ "match": "//.*$"
35
+ }
36
+ ]
37
+ },
38
+ "directives": {
39
+ "patterns": [
40
+ {
41
+ "match": "^\\s*#pragma\\b.*$",
42
+ "name": "meta.preprocessor.clpp"
43
+ }
44
+ ]
45
+ },
46
+ "link": {
47
+ "patterns": [
48
+ {
49
+ "name": "keyword.control.link.clpp",
50
+ "match": "^\\s*\\blink\\b"
51
+ },
52
+ {
53
+ "name": "keyword.control.link.as.clpp",
54
+ "match": "\\b(as|from)\\b"
55
+ },
56
+ {
57
+ "name": "support.namespace.clpp",
58
+ "match": "@(?:clpp|game|[A-Z][A-Za-z0-9_]*)(?:\\.[A-Za-z_][A-Za-z0-9_]*)*"
59
+ }
60
+ ]
61
+ },
62
+ "attributes": {
63
+ "name": "support.type.annotation.clpp",
64
+ "match": "\\[\\[(server|client|shared)\\]\\]|@(server|client|parallel)\\b"
65
+ },
66
+ "strings": {
67
+ "patterns": [
68
+ {
69
+ "name": "string.quoted.double.clpp",
70
+ "begin": "\"",
71
+ "end": "\"",
72
+ "patterns": [
73
+ { "name": "constant.character.escape.clpp", "match": "\\\\." }
74
+ ]
75
+ },
76
+ {
77
+ "name": "string.quoted.single.clpp",
78
+ "begin": "'",
79
+ "end": "'",
80
+ "patterns": [
81
+ { "name": "constant.character.escape.clpp", "match": "\\\\." }
82
+ ]
83
+ },
84
+ {
85
+ "name": "string.quoted.other.clpp",
86
+ "begin": "`",
87
+ "end": "`",
88
+ "patterns": [
89
+ { "name": "constant.character.escape.clpp", "match": "\\\\[\\\\`{}]" },
90
+ {
91
+ "name": "meta.interpolation.clpp",
92
+ "begin": "\\{",
93
+ "end": "\\}",
94
+ "patterns": [
95
+ { "include": "#receiver" },
96
+ { "include": "#keywords" },
97
+ { "include": "#types" },
98
+ { "include": "#constants" },
99
+ { "include": "#numbers" },
100
+ { "include": "#operators" },
101
+ { "include": "#properties" }
102
+ ]
103
+ }
104
+ ]
105
+ }
106
+ ]
107
+ },
108
+ "keywords": {
109
+ "patterns": [
110
+ {
111
+ "name": "keyword.control.clpp",
112
+ "match": "\\b(if|else|guard|for|in|while|switch|case|default|break|return|match|spawn|parallel|async|await|link|as|from)\\b"
113
+ },
114
+ {
115
+ "name": "keyword.other.clpp",
116
+ "match": "\\b(struct|class|namespace|using|template|typedef|enum|public|private|protected|static|const|constexpr|inline|extern|new)\\b"
117
+ },
118
+ {
119
+ "name": "storage.modifier.clpp",
120
+ "match": "\\b(observable|signal|func)\\b"
121
+ },
122
+ {
123
+ "name": "support.function.builtin.clpp",
124
+ "match": "\\b(post|warn|report|GetService|static_cast|pcall|xpcall|to_string|to_number|to_bool|string_concat)\\b"
125
+ }
126
+ ]
127
+ },
128
+ "types": {
129
+ "patterns": [
130
+ {
131
+ "name": "storage.type.clpp",
132
+ "match": "\\b(void|int|float|double|bool|string|auto|func|array|dictionary|map|optional)\\b"
133
+ },
134
+ {
135
+ "name": "entity.name.type.clpp",
136
+ "match": "\\b([A-Z][A-Za-z0-9_]*)(?=\\s+[A-Za-z_])"
137
+ },
138
+ {
139
+ "name": "entity.name.type.clpp",
140
+ "match": "\\b([A-Z][A-Za-z0-9_]*)(?=\\s*::)"
141
+ },
142
+ {
143
+ "name": "entity.name.type.clpp",
144
+ "match": "(?<=\\b(?:struct|class|enum|new)\\s+)([A-Z][A-Za-z0-9_]*)"
145
+ },
146
+ {
147
+ "name": "entity.name.type.clpp",
148
+ "match": "(?<=<)\\s*(?:void|int|float|double|bool|string|[A-Z][A-Za-z0-9_]*)(?=\\s*>)"
149
+ }
150
+ ]
151
+ },
152
+ "constants": {
153
+ "name": "constant.language.clpp",
154
+ "match": "\\b(true|false|null|nullptr)\\b"
155
+ },
156
+ "numbers": {
157
+ "name": "constant.numeric.clpp",
158
+ "match": "\\b\\d+(\\.\\d+)?\\b"
159
+ },
160
+ "receiver": {
161
+ "patterns": [
162
+ {
163
+ "name": "keyword.other.receiver.clpp",
164
+ "match": "@this\\b"
165
+ },
166
+ {
167
+ "match": "(@)([A-Za-z_][A-Za-z0-9_]*)",
168
+ "captures": {
169
+ "1": { "name": "keyword.other.receiver.clpp" },
170
+ "2": { "name": "variable.other.property.receiver.clpp" }
171
+ }
172
+ },
173
+ {
174
+ "name": "keyword.other.receiver.clpp",
175
+ "match": "\\bthis\\b"
176
+ }
177
+ ]
178
+ },
179
+ "operators": {
180
+ "patterns": [
181
+ { "name": "keyword.operator.concat.clpp", "match": "\\.:" },
182
+ { "name": "keyword.operator.cleanup.clpp", "match": "~>" },
183
+ { "name": "keyword.operator.scope.clpp", "match": "::" },
184
+ { "name": "keyword.operator.arrow.clpp", "match": "=>" },
185
+ { "name": "keyword.operator.comparison.clpp", "match": "==|!=|<=|>=|<|>" },
186
+ { "name": "keyword.operator.logical.clpp", "match": "&&|\\|\\||!" },
187
+ { "name": "keyword.operator.assignment.clpp", "match": "\\+=|-=|\\*=|/=|=" }
188
+ ]
189
+ },
190
+ "properties": {
191
+ "patterns": [
192
+ {
193
+ "match": "\\.(?![:.])([A-Za-z_][A-Za-z0-9_]*)",
194
+ "captures": {
195
+ "1": { "name": "variable.other.property.clpp" }
196
+ }
197
+ },
198
+ {
199
+ "match": "(?<![.:]):(?![:])([A-Za-z_][A-Za-z0-9_]*)",
200
+ "captures": {
201
+ "1": { "name": "variable.other.property.clpp" }
202
+ }
203
+ }
204
+ ]
205
+ },
206
+ "functions": {
207
+ "name": "entity.name.function.clpp",
208
+ "match": "\\b([A-Za-z_][A-Za-z0-9_]*)\\s*(?=\\()"
209
+ }
210
+ }
211
+ }
@@ -1,15 +1,15 @@
1
- # Sample game
1
+ # Roblox example
2
2
 
3
- Same Roblox service tree as `cluaupp init` (`templates/game`). Language samples: [CL++ examples](https://github.com/KartzRbx/CLPP/tree/main/examples).
3
+ [`game`](game/) uses the current CL++ `.clp` syntax and the same service layout as `cluaupp init`. Cluaupp compiles it to Luau without the independent CL++ VM executable.
4
4
 
5
- | Folder | Rojo | Tag |
5
+ | Source | Rojo class | Destination |
6
6
  | --- | --- | --- |
7
- | `src/ServerScriptService/*.server.clpp` | Script | server |
8
- | `src/StarterPlayer/StarterPlayerScripts/*.client.clpp` | LocalScript | client |
9
- | `src/StarterPlayer/StarterCharacterScripts/*.client.clpp` | LocalScript (character) | client |
10
- | `src/ReplicatedStorage/Shared/*.clp` / `*.clh` | ModuleScript | none |
7
+ | `src/ServerScriptService/*.server.clp` | Script | `ServerScriptService` |
8
+ | `src/StarterPlayer/StarterPlayerScripts/*.client.clp` | LocalScript | `StarterPlayerScripts` |
9
+ | `src/ReplicatedStorage/Shared/*.clp` | ModuleScript | `ReplicatedStorage.Shared` |
10
+
11
+ The server and client scripts import the shared module through `link @ReplicatedStorage.Shared.GameInfo as GameInfo;`. Create another `.clp` file in that directory and use its path in a `link`; the next build discovers and emits it automatically.
11
12
 
12
13
  ```bash
13
- cd examples/game
14
- npx cluaupp build .
14
+ node bin/cluaupp.js build examples/game
15
15
  ```
@@ -1,6 +1,6 @@
1
1
  {
2
- "rootDir": "Src",
2
+ "rootDir": "src",
3
3
  "outDir": "out",
4
- "strict": false,
4
+ "strict": true,
5
5
  "architecture": false
6
6
  }
@@ -4,31 +4,20 @@
4
4
  "$className": "DataModel",
5
5
  "ServerScriptService": {
6
6
  "$className": "ServerScriptService",
7
- "$path": "out/Server",
8
- "Parallel": {
9
- "$path": "out/Parallel"
10
- }
7
+ "$path": "out/ServerScriptService"
11
8
  },
12
9
  "ReplicatedStorage": {
13
10
  "$className": "ReplicatedStorage",
14
- "Declarations": {
15
- "$path": "out/Declarations"
16
- },
17
- "Include": {
18
- "$path": "out/Include"
19
- },
20
- "Modules": {
21
- "$path": "out/Modules"
22
- },
23
11
  "CluauppLibs": {
24
12
  "$path": "libs"
25
- }
13
+ },
14
+ "$path": "out/ReplicatedStorage"
26
15
  },
27
16
  "StarterPlayer": {
28
17
  "$className": "StarterPlayer",
29
18
  "StarterPlayerScripts": {
30
19
  "$className": "StarterPlayerScripts",
31
- "$path": "out/Client"
20
+ "$path": "out/StarterPlayer/StarterPlayerScripts"
32
21
  }
33
22
  },
34
23
  "HttpService": {
@@ -0,0 +1,8 @@
1
+ --!strict
2
+ --!optimize 2
3
+ -- cluaupp-source: ReplicatedStorage/Shared/GameInfo.clp
4
+ -- Generated by Cluaupp 1.5.2-cf from ReplicatedStorage/Shared/GameInfo.clp. Do not edit: changes are overwritten on build.
5
+
6
+ return table.freeze({
7
+ GAME_NAME = "Cluaupp example",
8
+ })
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 1,
3
+ "file": "GameInfo.luau",
4
+ "sourceRoot": "C:/Users/gtofr/OneDrive/Documentos/GitHub/Cluaupp/examples/game",
5
+ "sources": [
6
+ "ReplicatedStorage/Shared/GameInfo.clp"
7
+ ],
8
+ "mappings": "AAAA",
9
+ "cluaupp": {
10
+ "source": "ReplicatedStorage/Shared/GameInfo.clp",
11
+ "generated": "out/ReplicatedStorage/Shared/GameInfo.luau"
12
+ }
13
+ }
@@ -0,0 +1,26 @@
1
+ --!strict
2
+ --!optimize 2
3
+ -- cluaupp-source: ServerScriptService/Leaderstats.server.clp
4
+ -- Generated by Cluaupp 1.5.2-cf from ServerScriptService/Leaderstats.server.clp. Do not edit: changes are overwritten on build.
5
+
6
+ local Players = game:GetService("Players")
7
+
8
+ local function BindLeaderstats(player: Player)
9
+ if player:FindFirstChild("leaderstats") ~= nil then
10
+ return
11
+ end
12
+ local stats: Folder = Instance.new("Folder")
13
+ stats.Parent = player
14
+ stats.Name = "leaderstats"
15
+ local coins: IntValue = Instance.new("IntValue")
16
+ coins.Parent = stats
17
+ coins.Name = "Coins"
18
+ coins.Value = 0
19
+ end
20
+
21
+ local players: Players = Players
22
+ for _, __item1 in players:GetPlayers() do
23
+ local player = __item1 :: Player
24
+ BindLeaderstats(player)
25
+ end
26
+ players.PlayerAdded:Connect(BindLeaderstats)
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 1,
3
+ "file": "Leaderstats.server.luau",
4
+ "sourceRoot": "C:/Users/gtofr/OneDrive/Documentos/GitHub/Cluaupp/examples/game",
5
+ "sources": [
6
+ "ServerScriptService/Leaderstats.server.clp"
7
+ ],
8
+ "mappings": "AAAA",
9
+ "cluaupp": {
10
+ "source": "ServerScriptService/Leaderstats.server.clp",
11
+ "generated": "out/ServerScriptService/Leaderstats.server.luau"
12
+ }
13
+ }
@@ -0,0 +1,15 @@
1
+ --!strict
2
+ --!optimize 2
3
+ -- cluaupp-source: ServerScriptService/Main.server.clp
4
+ -- Generated by Cluaupp 1.5.2-cf from ServerScriptService/Main.server.clp. Do not edit: changes are overwritten on build.
5
+
6
+ local Players = game:GetService("Players")
7
+ local ReplicatedStorage = game:GetService("ReplicatedStorage")
8
+
9
+ local GameInfo = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("GameInfo") :: ModuleScript)
10
+
11
+ print("Cluaupp example" .. " server ready")
12
+ local players: Players = Players
13
+ players.PlayerAdded:Connect(function(player: Player)
14
+ print(player.Name .. " joined the game")
15
+ end)
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 1,
3
+ "file": "Main.server.luau",
4
+ "sourceRoot": "C:/Users/gtofr/OneDrive/Documentos/GitHub/Cluaupp/examples/game",
5
+ "sources": [
6
+ "ServerScriptService/Main.server.clp"
7
+ ],
8
+ "mappings": "AAAA",
9
+ "cluaupp": {
10
+ "source": "ServerScriptService/Main.server.clp",
11
+ "generated": "out/ServerScriptService/Main.server.luau"
12
+ }
13
+ }
@@ -0,0 +1,10 @@
1
+ --!strict
2
+ --!optimize 2
3
+ -- cluaupp-source: StarterPlayer/StarterPlayerScripts/Main.client.clp
4
+ -- Generated by Cluaupp 1.5.2-cf from StarterPlayer/StarterPlayerScripts/Main.client.clp. Do not edit: changes are overwritten on build.
5
+
6
+ local ReplicatedStorage = game:GetService("ReplicatedStorage")
7
+
8
+ local GameInfo = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("GameInfo") :: ModuleScript)
9
+
10
+ print("Cluaupp example" .. " client ready")
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 1,
3
+ "file": "Main.client.luau",
4
+ "sourceRoot": "C:/Users/gtofr/OneDrive/Documentos/GitHub/Cluaupp/examples/game",
5
+ "sources": [
6
+ "StarterPlayer/StarterPlayerScripts/Main.client.clp"
7
+ ],
8
+ "mappings": "AAAA",
9
+ "cluaupp": {
10
+ "source": "StarterPlayer/StarterPlayerScripts/Main.client.clp",
11
+ "generated": "out/StarterPlayer/StarterPlayerScripts/Main.client.luau"
12
+ }
13
+ }
@@ -0,0 +1 @@
1
+ const GAME_NAME = "Cluaupp example";
@@ -0,0 +1,18 @@
1
+ link @clpp.roblox;
2
+
3
+ func BindLeaderstats(Player player) {
4
+ if (player.FindFirstChild("leaderstats") != null) {
5
+ return;
6
+ }
7
+ Folder stats = new Folder(player);
8
+ stats.Name = "leaderstats";
9
+ IntValue coins = new IntValue(stats);
10
+ coins.Name = "Coins";
11
+ coins.Value = 0;
12
+ }
13
+
14
+ Players players = GetService<Players>();
15
+ for (Player player in players.GetPlayers()) {
16
+ BindLeaderstats(player);
17
+ }
18
+ players.PlayerAdded ~> BindLeaderstats;
@@ -0,0 +1,9 @@
1
+ link @clpp.roblox;
2
+ link @ReplicatedStorage.Shared.GameInfo as GameInfo;
3
+
4
+ post(GameInfo.GAME_NAME .: " server ready");
5
+
6
+ Players players = GetService<Players>();
7
+ players.PlayerAdded ~> func (Player player) {
8
+ post(player.Name .: " joined the game");
9
+ };
@@ -0,0 +1,4 @@
1
+ link @clpp.roblox;
2
+ link @ReplicatedStorage.Shared.GameInfo as GameInfo;
3
+
4
+ post(GameInfo.GAME_NAME .: " client ready");
@@ -109,7 +109,7 @@ function writeProfileCache(profile, outPath) {
109
109
  function profileContentHash(profile) {
110
110
  const clone = { ...profile, sources: { ...profile.sources } };
111
111
  for (const key of Object.keys(clone.sources)) {
112
- clone.sources[key] = { ...clone.sources[key], loadedAt: "" };
112
+ clone.sources[key] = { ...clone.sources[key], loadedAt: "", path: "" };
113
113
  }
114
114
  return (0, resolver_js_1.hashBuffer)(JSON.stringify(clone));
115
115
  }