cluaupp 0.1.5 → 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.
- package/CHANGELOG.md +12 -0
- package/README.md +6 -1
- package/bin/cluau.js +1 -1
- package/bin/cluaupp.js +1 -1
- package/docs/architecture.md +26 -1
- package/docs/cli.md +27 -6
- package/docs/examples/index.md +2 -0
- package/docs/getting-started.md +5 -4
- package/docs/intellisense.md +49 -31
- package/docs/intro.md +1 -1
- package/editors/vscode/extension.js +97 -146
- package/editors/vscode/package.json +6 -6
- package/examples/README.md +18 -0
- package/examples/game/.clangd +25 -0
- package/examples/game/.vscode/c_cpp_properties.json +27 -0
- package/examples/game/.vscode/extensions.json +5 -0
- package/examples/game/.vscode/settings.json +27 -0
- package/examples/game/Packages/.gitkeep +0 -0
- package/examples/game/cluaupp.config.json +6 -0
- package/examples/game/compile_flags.txt +6 -0
- package/examples/game/default.project.json +39 -0
- package/examples/game/package.json +9 -0
- package/examples/game/rokit.toml +5 -0
- package/examples/game/src/client/hud.client.cpp +12 -0
- package/{src → examples/game/src}/client/init.client.cpp +1 -0
- package/examples/game/src/server/combat.server.cpp +23 -0
- package/{src → examples/game/src}/server/leaderstats.server.cpp +1 -0
- package/examples/game/wally.toml +11 -0
- package/generated/api.js +51 -0
- package/generated/architecture.js +473 -0
- package/generated/ast.js +2 -0
- package/generated/cli.js +191 -0
- package/generated/compile.js +115 -0
- package/generated/editor-install.js +170 -0
- package/generated/emit.js +503 -0
- package/generated/emitter/luau-codegen.js +167 -0
- package/generated/emitter/translators.js +164 -0
- package/generated/headers.js +220 -0
- package/generated/index.html +49 -0
- package/generated/intellisense.js +277 -0
- package/generated/layout.js +112 -0
- package/generated/lex.js +146 -0
- package/generated/libs.js +484 -0
- package/generated/lsp.js +55 -0
- package/generated/package-info.js +11 -0
- package/generated/parse.js +607 -0
- package/generated/parser/collector.js +100 -0
- package/generated/parser/index.js +30 -0
- package/generated/preprocess.js +181 -0
- package/generated/system-understander.js +443 -0
- package/generated/transpile.js +66 -0
- package/generated/types.js +2 -0
- package/generated/understand.js +298 -0
- package/generated/utils/process-orchestrator.js +63 -0
- package/generated/utils/project.js +491 -0
- package/generated/utils/rojo-mapper.js +181 -0
- package/generated/utils/safe-paths.js +104 -0
- package/package.json +25 -8
- package/src/api.ts +53 -0
- package/src/{architecture.js → architecture.ts} +9 -10
- package/src/ast.ts +37 -0
- package/src/cli.ts +214 -0
- package/src/compile.ts +118 -0
- package/src/editor-install.ts +182 -0
- package/src/{emit.js → emit.ts} +4 -5
- package/src/emitter/luau-codegen.ts +187 -0
- package/src/emitter/translators.ts +168 -0
- package/src/{headers.js → headers.ts} +4 -5
- package/src/intellisense.ts +286 -0
- package/src/{layout.js → layout.ts} +114 -129
- package/src/{lex.js → lex.ts} +4 -6
- package/src/{libs.js → libs.ts} +9 -4
- package/src/lsp.ts +60 -0
- package/src/package-info.ts +7 -0
- package/src/{parse.js → parse.ts} +3 -4
- package/src/parser/collector.ts +115 -0
- package/src/parser/index.ts +27 -0
- package/src/{preprocess.js → preprocess.ts} +22 -37
- package/src/system-understander.ts +501 -0
- package/src/transpile.ts +64 -0
- package/src/tree-sitter-cpp.d.ts +4 -0
- package/src/types.ts +81 -0
- package/src/{understand.js → understand.ts} +19 -210
- package/src/utils/process-orchestrator.ts +72 -0
- package/src/utils/project.ts +506 -0
- package/src/utils/rojo-mapper.ts +190 -0
- package/src/utils/safe-paths.ts +98 -0
- package/templates/game/.clangd +9 -0
- package/templates/game/.vscode/c_cpp_properties.json +1 -1
- package/templates/game/.vscode/extensions.json +5 -6
- package/templates/game/.vscode/settings.json +7 -6
- package/templates/game/compile_flags.txt +1 -0
- package/templates/game/rokit.toml +5 -0
- package/src/api.js +0 -57
- package/src/cli.js +0 -473
- package/src/compile.js +0 -110
- package/src/editor-install.js +0 -218
- package/src/intellisense.js +0 -1368
- package/src/lsp.js +0 -227
- /package/{src → examples/game/src}/shared/config.cpp +0 -0
- /package/{src → examples/game/src}/shared/config.h +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"configurations": [
|
|
3
|
+
{
|
|
4
|
+
"name": "Cluaupp",
|
|
5
|
+
"compilerPath": "clang++",
|
|
6
|
+
"cStandard": "c17",
|
|
7
|
+
"cppStandard": "c++20",
|
|
8
|
+
"intelliSenseMode": "windows-clang-x64",
|
|
9
|
+
"includePath": [
|
|
10
|
+
"${workspaceFolder}/include",
|
|
11
|
+
"${workspaceFolder}/src"
|
|
12
|
+
],
|
|
13
|
+
"forcedInclude": [
|
|
14
|
+
"${workspaceFolder}/include/cluaupp/roblox.hpp"
|
|
15
|
+
],
|
|
16
|
+
"compileCommands": "${workspaceFolder}/compile_commands.json",
|
|
17
|
+
"browse": {
|
|
18
|
+
"path": [
|
|
19
|
+
"${workspaceFolder}/include",
|
|
20
|
+
"${workspaceFolder}/src"
|
|
21
|
+
],
|
|
22
|
+
"limitSymbolsToIncludedHeaders": true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"version": 4
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"C_Cpp.intelliSenseEngine": "Disabled",
|
|
3
|
+
"C_Cpp.default.cppStandard": "c++20",
|
|
4
|
+
"C_Cpp.default.cStandard": "c17",
|
|
5
|
+
"C_Cpp.default.compilerPath": "clang++",
|
|
6
|
+
"C_Cpp.default.intelliSenseMode": "windows-clang-x64",
|
|
7
|
+
"C_Cpp.default.includePath": [
|
|
8
|
+
"${workspaceFolder}/include",
|
|
9
|
+
"${workspaceFolder}/src"
|
|
10
|
+
],
|
|
11
|
+
"clangd.enable": true,
|
|
12
|
+
"clangd.arguments": [
|
|
13
|
+
"--compile-commands-dir=${workspaceFolder}",
|
|
14
|
+
"--header-insertion=never",
|
|
15
|
+
"--query-driver=**/clang++*,**/clang++.exe,**/g++*,**/g++.exe"
|
|
16
|
+
],
|
|
17
|
+
"files.associations": {
|
|
18
|
+
"*.hpp": "cpp",
|
|
19
|
+
"*.h": "cpp",
|
|
20
|
+
"*.server.cpp": "cpp",
|
|
21
|
+
"*.client.cpp": "cpp",
|
|
22
|
+
"*.plugin.cpp": "cpp",
|
|
23
|
+
"*.legacy.cpp": "cpp",
|
|
24
|
+
"*.legacy.server.cpp": "cpp",
|
|
25
|
+
"*.legacy.client.cpp": "cpp"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cluaupp-game",
|
|
3
|
+
"tree": {
|
|
4
|
+
"$className": "DataModel",
|
|
5
|
+
"ServerScriptService": {
|
|
6
|
+
"$className": "ServerScriptService",
|
|
7
|
+
"Cluaupp": {
|
|
8
|
+
"$path": "out/server"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"ReplicatedStorage": {
|
|
12
|
+
"$className": "ReplicatedStorage",
|
|
13
|
+
"Cluaupp": {
|
|
14
|
+
"$path": "out/shared"
|
|
15
|
+
},
|
|
16
|
+
"CluauppLibs": {
|
|
17
|
+
"$path": "libs"
|
|
18
|
+
},
|
|
19
|
+
"Packages": {
|
|
20
|
+
"$path": "Packages"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"StarterPlayer": {
|
|
24
|
+
"$className": "StarterPlayer",
|
|
25
|
+
"StarterPlayerScripts": {
|
|
26
|
+
"$className": "StarterPlayerScripts",
|
|
27
|
+
"Cluaupp": {
|
|
28
|
+
"$path": "out/client"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"HttpService": {
|
|
33
|
+
"$className": "HttpService",
|
|
34
|
+
"$properties": {
|
|
35
|
+
"HttpEnabled": true
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#pragma strict
|
|
2
|
+
#include <cluaupp/roblox.hpp>
|
|
3
|
+
|
|
4
|
+
void init() {
|
|
5
|
+
auto* playerGui = GetService<Players>()->LocalPlayer->FindFirstChild("PlayerGui");
|
|
6
|
+
auto* screen = new ScreenGui();
|
|
7
|
+
screen->Name = "Hud";
|
|
8
|
+
auto* coins = new TextLabel();
|
|
9
|
+
coins->Name = "Coins";
|
|
10
|
+
coins->Parent = screen;
|
|
11
|
+
print("hud ready");
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#pragma strict
|
|
2
|
+
#include <cluaupp/roblox.hpp>
|
|
3
|
+
|
|
4
|
+
void ApplyDamage(Player* player, int amount) {
|
|
5
|
+
auto* character = player->Character;
|
|
6
|
+
if (character == nullptr) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
auto* humanoid = character->FindFirstChildOfClass("Humanoid");
|
|
10
|
+
if (humanoid == nullptr) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
humanoid->TakeDamage(amount);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
void OnPlayer(Player* player) {
|
|
17
|
+
ApplyDamage(player, 0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
void init() {
|
|
21
|
+
auto* players = GetService<Players>();
|
|
22
|
+
players->PlayerAdded.Connect(OnPlayer);
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "kartzdev/cluaupp-game"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
registry = "https://github.com/UpliftGames/wally-index"
|
|
5
|
+
realm = "shared"
|
|
6
|
+
|
|
7
|
+
# CluauppLibs already ships Janitor, Promise, Fusion, Iris, Cmdr, TopbarPlus,
|
|
8
|
+
# Chrono, DataServiceV2, EzVisualz, StateMachine, Spring, Display, Module3D,
|
|
9
|
+
# FormatNumber. Add Wally entries only for extra packages.
|
|
10
|
+
|
|
11
|
+
[dependencies]
|
package/generated/api.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DATATYPES = exports.METHODS = exports.SERVICES = exports.INSTANCE_TYPES = void 0;
|
|
7
|
+
exports.isInstanceType = isInstanceType;
|
|
8
|
+
exports.isService = isService;
|
|
9
|
+
exports.isMethod = isMethod;
|
|
10
|
+
exports.isDatatype = isDatatype;
|
|
11
|
+
exports.luauType = luauType;
|
|
12
|
+
const node_module_1 = require("node:module");
|
|
13
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
+
const projectRoot = node_path_1.default.resolve(__dirname, "..");
|
|
15
|
+
const requireGenerated = (0, node_module_1.createRequire)(node_path_1.default.join(projectRoot, "src", "api.generated.js"));
|
|
16
|
+
const generated = requireGenerated("./api.generated.js");
|
|
17
|
+
exports.INSTANCE_TYPES = new Set(generated.INSTANCE_TYPES);
|
|
18
|
+
exports.SERVICES = new Set(generated.SERVICES);
|
|
19
|
+
exports.METHODS = new Set(generated.METHODS);
|
|
20
|
+
exports.DATATYPES = new Set(generated.DATATYPES);
|
|
21
|
+
const LUAU_TYPES = {
|
|
22
|
+
void: "()",
|
|
23
|
+
int: "number",
|
|
24
|
+
float: "number",
|
|
25
|
+
double: "number",
|
|
26
|
+
bool: "boolean",
|
|
27
|
+
string: "string",
|
|
28
|
+
auto: null,
|
|
29
|
+
};
|
|
30
|
+
function isInstanceType(name) {
|
|
31
|
+
return exports.INSTANCE_TYPES.has(name);
|
|
32
|
+
}
|
|
33
|
+
function isService(name) {
|
|
34
|
+
return exports.SERVICES.has(name);
|
|
35
|
+
}
|
|
36
|
+
function isMethod(name) {
|
|
37
|
+
return exports.METHODS.has(name);
|
|
38
|
+
}
|
|
39
|
+
function isDatatype(name) {
|
|
40
|
+
return exports.DATATYPES.has(name);
|
|
41
|
+
}
|
|
42
|
+
function luauType(name) {
|
|
43
|
+
if (!name) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const cleaned = String(name).replace(/\*+$/, "").replace(/^const\s+/, "").replace(/^Enum::/, "Enum.");
|
|
47
|
+
if (cleaned in LUAU_TYPES) {
|
|
48
|
+
return LUAU_TYPES[cleaned];
|
|
49
|
+
}
|
|
50
|
+
return cleaned;
|
|
51
|
+
}
|