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.
- package/CHANGELOG.md +47 -0
- package/README.md +10 -5
- package/api/CHANGELOG.md +3 -0
- package/api/chat.js +74 -0
- package/api/fixtures/roblox/README.md +6 -0
- package/api/fixtures/roblox/aux/sample.d.luau +6 -0
- package/api/fixtures/roblox/mini/Mini-API-Dump.json +72 -0
- package/api/generated/bench-latest.json +39 -0
- package/api/generated/capability-profile.json +76 -0
- package/api/generated/lsp-index.json +1 -0
- package/api/generated/luau/classes.d.luau +11221 -0
- package/api/generated/luau/datatypes.d.luau +327 -0
- package/api/generated/luau/enums.d.luau +4918 -0
- package/api/generated/luau/globals.d.luau +12 -0
- package/api/manifests/roblox-target.manifest.json +22 -0
- package/api/normalized/roblox-target.profile.json +237461 -0
- package/api/overrides/classes.json +8 -0
- package/api/overrides/compatibility.json +9 -0
- package/api/overrides/datatypes.json +1579 -0
- package/api/overrides/enums.json +8 -0
- package/api/overrides/globals.json +8 -0
- package/api/overrides/type-mappings.json +9 -0
- package/api/roblox-api.lock.json +9 -0
- package/data/Mini-API-Dump.json +1 -0
- package/editors/vscode/README.md +12 -10
- package/editors/vscode/extension.js +82 -0
- package/editors/vscode/icons/axiom.svg +4 -0
- package/editors/vscode/icons/bloom.svg +5 -0
- package/editors/vscode/icons/helm.svg +4 -0
- package/editors/vscode/icons/hive.svg +5 -0
- package/editors/vscode/icons/mint.svg +4 -0
- package/editors/vscode/icons/shift.svg +6 -0
- package/editors/vscode/language-configuration-schema.json +24 -0
- package/editors/vscode/package.json +172 -12
- package/editors/vscode/snippets/axiom.json +12 -0
- package/editors/vscode/snippets/bloom.json +12 -0
- package/editors/vscode/snippets/helm.json +12 -0
- package/editors/vscode/snippets/hive.json +12 -0
- package/editors/vscode/snippets/mint.json +12 -0
- package/editors/vscode/snippets/shift.json +17 -0
- package/editors/vscode/syntaxes/axiom.tmLanguage.json +5 -0
- package/editors/vscode/syntaxes/bloom.tmLanguage.json +5 -0
- package/editors/vscode/syntaxes/helm.tmLanguage.json +5 -0
- package/editors/vscode/syntaxes/hive.tmLanguage.json +5 -0
- package/editors/vscode/syntaxes/mint.tmLanguage.json +5 -0
- package/editors/vscode/syntaxes/schema.tmLanguage.json +89 -0
- package/editors/vscode/syntaxes/shift.tmLanguage.json +5 -0
- package/examples/game/.cluaupp/compile-cache/ReplicatedStorage__Shared__Constants__Datas__TemplateData.clh.json +1 -0
- package/examples/game/.cluaupp/compile-cache/ServerScriptService__Boot__DataBoot.server.clpp.json +1 -0
- package/examples/game/.cluaupp/compile-cache/ServerScriptService__Configuration__ServerConfig.clp.json +1 -0
- package/examples/game/.cluaupp/compile-cache/ServerScriptService__Handlers__Guard.server.clpp.json +1 -0
- package/examples/game/.cluaupp/compile-cache/ServerScriptService__Handlers__PlayerHandler.server.clpp.json +1 -0
- package/examples/game/.cluaupp/compile-cache/StarterPlayer__StarterCharacterScripts__Character__CharacterReady.client.clpp.json +1 -0
- package/examples/game/.cluaupp/compile-cache/StarterPlayer__StarterPlayerScripts__Controllers__DataController.client.clpp.json +1 -0
- package/examples/game/.cluaupp/compile-cache/index.json +12 -0
- package/examples/game/.cluaupp/datamodel-profile.json +94 -0
- package/examples/game/.vscode/settings.json +12 -1
- package/examples/game/include/clpp/datatypes.clh +337 -373
- package/examples/game/include/clpp/generated/datamodel.clh +25 -0
- package/examples/game/include/clpp/generated/enums.clh +1 -1
- package/examples/game/include/clpp/generated/instances.clh +41135 -41064
- package/examples/game/include/clpp/libs/axiom.clh +1 -1
- package/examples/game/include/clpp/libs/math.clh +14 -0
- package/examples/game/include/clpp/libs/spring.clh +17 -0
- package/examples/game/include/clpp/libs/ward.clh +1 -0
- package/examples/game/include/clpp/roblox.clh +3 -4
- package/examples/game/libs/ArrayIndexer/init.luau +209 -0
- package/examples/game/libs/Axiom/init.luau +608 -0
- package/examples/game/libs/Bloom/init.luau +433 -0
- package/examples/game/libs/Coil/init.luau +215 -0
- package/examples/game/libs/Crest/init.luau +426 -0
- package/examples/game/libs/Echo/init.luau +417 -0
- package/examples/game/libs/Ember/init.luau +365 -0
- package/examples/game/libs/Flare/init.luau +717 -0
- package/examples/game/libs/Gleam/init.luau +729 -0
- package/examples/game/libs/Guide/init.luau +215 -0
- package/examples/game/libs/Helm/init.luau +377 -0
- package/examples/game/libs/Hive/init.luau +241 -0
- package/examples/game/libs/Keep/Client.luau +114 -0
- package/examples/game/libs/Keep/Data.luau +883 -0
- package/examples/game/libs/Keep/Engine.luau +211 -0
- package/examples/game/libs/Keep/Enum.luau +6 -0
- package/examples/game/libs/Keep/Enums.luau +10 -0
- package/examples/game/libs/Keep/Path.luau +236 -0
- package/examples/game/libs/Keep/Replicator.luau +298 -0
- package/examples/game/libs/Keep/Server.luau +251 -0
- package/examples/game/libs/Keep/Store.luau +652 -0
- package/examples/game/libs/Keep/Trade.luau +455 -0
- package/examples/game/libs/Keep/init.luau +205 -0
- package/examples/game/libs/Lens/init.luau +609 -0
- package/examples/game/libs/Mint/init.luau +279 -0
- package/examples/game/libs/Net/init.luau +156 -0
- package/examples/game/libs/Net/src/codec.luau +224 -0
- package/examples/game/libs/Occlude/init.luau +117 -0
- package/examples/game/libs/Pin/init.luau +309 -0
- package/examples/game/libs/Promise/LICENSE +21 -0
- package/examples/game/libs/Promise/_impl/LICENSE +21 -0
- package/examples/game/libs/Promise/_impl/init.lua +1991 -0
- package/examples/game/libs/Promise/init.lua +1990 -0
- package/examples/game/libs/Promise/init.luau +13 -0
- package/examples/game/libs/Promise/types.luau +46 -0
- package/examples/game/libs/Roster/init.luau +686 -0
- package/examples/game/libs/SOURCES.md +31 -0
- package/examples/game/libs/Shift/init.luau +238 -0
- package/examples/game/libs/Spark/init.luau +487 -0
- package/examples/game/libs/Stage/init.luau +178 -0
- package/examples/game/libs/Sweep/init.luau +259 -0
- package/examples/game/libs/Trace/init.luau +213 -0
- package/examples/game/libs/Ward/init.luau +211 -0
- package/examples/game/out/ReplicatedStorage/Shared/Constants/Datas/TemplateData.luau +29 -0
- package/examples/game/out/ReplicatedStorage/Shared/Constants/Datas/TemplateData.luau.map.json +13 -0
- package/examples/game/out/ReplicatedStorage/Shared/Net/Net.luau +83 -0
- package/examples/game/out/ReplicatedStorage/Shared/Net/Net.luau.map.json +13 -0
- package/examples/game/out/ServerScriptService/Boot/DataBoot.server.luau +18 -0
- package/examples/game/out/ServerScriptService/Boot/DataBoot.server.luau.map.json +13 -0
- package/examples/game/out/ServerScriptService/Configuration/ServerConfig.luau +14 -0
- package/examples/game/out/ServerScriptService/Configuration/ServerConfig.luau.map.json +13 -0
- package/examples/game/out/ServerScriptService/Handlers/Guard.server.luau +15 -0
- package/examples/game/out/ServerScriptService/Handlers/Guard.server.luau.map.json +13 -0
- package/examples/game/out/ServerScriptService/Handlers/PlayerHandler.server.luau +50 -0
- package/examples/game/out/ServerScriptService/Handlers/PlayerHandler.server.luau.map.json +13 -0
- package/examples/game/out/StarterPlayer/StarterCharacterScripts/Character/CharacterReady.client.luau +12 -0
- package/examples/game/out/StarterPlayer/StarterCharacterScripts/Character/CharacterReady.client.luau.map.json +13 -0
- package/examples/game/out/StarterPlayer/StarterPlayerScripts/Controllers/DataController.client.luau +16 -0
- package/examples/game/out/StarterPlayer/StarterPlayerScripts/Controllers/DataController.client.luau.map.json +13 -0
- package/examples/game/src/ReplicatedStorage/Shared/Net/Net.clh +26 -0
- package/examples/game/src/ServerScriptService/Boot/DataBoot.server.clpp +1 -1
- package/examples/game/src/ServerScriptService/Handlers/PlayerHandler.server.clpp +1 -1
- package/examples/game/stylua.toml +9 -0
- package/generated/api/build-profile.js +115 -0
- package/generated/api/cache.js +44 -0
- package/generated/api/coverage.js +32 -0
- package/generated/api/diff.js +125 -0
- package/generated/api/generators/clpp-headers.js +353 -0
- package/generated/api/generators/docs-reference.js +7 -0
- package/generated/api/generators/lsp-index.js +81 -0
- package/generated/api/generators/luau-defs.js +94 -0
- package/generated/api/ide.js +76 -0
- package/generated/api/identifier.js +47 -0
- package/generated/api/index.js +324 -0
- package/generated/api/loader.js +57 -0
- package/generated/api/merge.js +88 -0
- package/generated/api/model.js +5 -0
- package/generated/api/normalize.js +231 -0
- package/generated/api/overrides-validate.js +58 -0
- package/generated/api/perf.js +12 -0
- package/generated/api/registry.js +136 -0
- package/generated/api/release.js +44 -0
- package/generated/api/resolver.js +250 -0
- package/generated/api/sources/aux-types-diff.js +75 -0
- package/generated/api/sources/client-tracker.js +11 -0
- package/generated/api/sources/creator-docs.js +42 -0
- package/generated/api/sources/luau-types.js +34 -0
- package/generated/api/sources/mini-dump.js +17 -0
- package/generated/api/sources/studio-api.js +8 -0
- package/generated/api/sources/studio-apiv2.js +11 -0
- package/generated/api/sources/studio-full-api.js +8 -0
- package/generated/api/studio-smoke.js +80 -0
- package/generated/api/type-parse.js +49 -0
- package/generated/api/understander.js +51 -0
- package/generated/api/validate.js +135 -0
- package/generated/api-cli.js +421 -0
- package/generated/cli.js +16 -5
- package/generated/clpp/contract.js +3 -3
- package/generated/clpp/format-luau.js +236 -0
- package/generated/clpp/index.js +13 -1
- package/generated/clpp/modules.js +227 -0
- package/generated/clpp/postprocess.js +86 -5
- package/generated/clpp/rewrite-janitor.js +145 -0
- package/generated/clpp/runner.js +14 -2
- package/generated/compile.js +82 -0
- package/generated/flare/parse.js +12 -1
- package/generated/intellisense.js +57 -1
- package/generated/native/index.js +217 -16
- package/generated/target/authority-check.js +136 -0
- package/generated/target/authority-graph.js +74 -0
- package/generated/target/build-cache.js +112 -0
- package/generated/target/capabilities.js +89 -0
- package/generated/target/capability-profile.js +30 -0
- package/generated/target/component-contracts.js +60 -0
- package/generated/target/context-check.js +160 -0
- package/generated/target/datamodel-check.js +170 -0
- package/generated/target/datamodel-generate.js +74 -0
- package/generated/target/datamodel.js +233 -0
- package/generated/target/diagnostics.js +63 -0
- package/generated/target/doctor.js +152 -0
- package/generated/target/flare-version.js +58 -0
- package/generated/target/get-service.js +69 -0
- package/generated/target/lifetime-check.js +47 -0
- package/generated/target/luau-stamp.js +39 -0
- package/generated/target/optimizer-advise.js +88 -0
- package/generated/target/optimizer-apply.js +44 -0
- package/generated/target/optimizer-soa.js +254 -0
- package/generated/target/parallel-check.js +136 -0
- package/generated/target/pgo.js +148 -0
- package/generated/target/project-docs.js +69 -0
- package/generated/target/project-graph.js +71 -0
- package/generated/target/roblox.js +63 -0
- package/generated/target/security-check.js +41 -0
- package/generated/target/source-map.js +25 -0
- package/generated/target/studio-bridge.js +112 -0
- package/generated/utils/project.js +178 -8
- package/generated/utils/rojo-mapper.js +11 -3
- package/include/clpp/datatypes.clh +337 -373
- package/include/clpp/generated/enums.clh +1 -1
- package/include/clpp/generated/instances.clh +41135 -41064
- package/include/clpp/libs/axiom.clh +1 -1
- package/include/clpp/libs/hive.clh +1 -0
- package/include/clpp/libs/keep.clh +2 -0
- package/include/clpp/libs/math.clh +14 -0
- package/include/clpp/libs/spring.clh +17 -0
- package/include/clpp/libs/ward.clh +1 -0
- package/include/clpp/roblox.clh +3 -4
- package/package.json +10 -3
- package/plugins/CluauppNav/Plugin.luau +207 -0
- package/plugins/CluauppNav/ProfileLogger.luau +27 -0
- package/plugins/CluauppNav/README.md +24 -0
- package/runtime/Axiom/init.luau +10 -7
- package/runtime/Coil/init.luau +8 -2
- package/runtime/Crest/init.luau +1 -0
- package/runtime/Flare/init.luau +2 -1
- package/runtime/Gleam/init.luau +15 -4
- package/runtime/Hive/init.luau +36 -14
- package/runtime/Pin/init.luau +5 -2
- package/runtime/Roster/init.luau +2 -0
- package/runtime/Spark/init.luau +3 -0
- package/runtime/Sweep/init.luau +2 -0
- package/runtime/Trace/init.luau +3 -0
- package/runtime/Ward/init.luau +38 -5
- package/scripts/postinstall-editor.js +17 -0
- package/skills/README.md +13 -0
- package/skills/clpp-hive-flare/SKILL.md +79 -0
- package/skills/clpp-language/SKILL.md +123 -0
- package/skills/clpp-language/compiler.md +89 -0
- package/skills/clpp-style/SKILL.md +95 -0
- package/src/api/build-profile.ts +138 -0
- package/src/api/cache.ts +45 -0
- package/src/api/coverage.ts +46 -0
- package/src/api/diff.ts +143 -0
- package/src/api/generators/clpp-headers.ts +377 -0
- package/src/api/generators/docs-reference.ts +11 -0
- package/src/api/generators/lsp-index.ts +106 -0
- package/src/api/generators/luau-defs.ts +98 -0
- package/src/api/ide.ts +87 -0
- package/src/api/identifier.ts +47 -0
- package/src/api/index.ts +269 -0
- package/src/api/loader.ts +60 -0
- package/src/api/merge.ts +126 -0
- package/src/api/model.ts +283 -0
- package/src/api/normalize.ts +257 -0
- package/src/api/overrides-validate.ts +58 -0
- package/src/api/perf.ts +15 -0
- package/src/api/registry.ts +162 -0
- package/src/api/release.ts +47 -0
- package/src/api/resolver.ts +255 -0
- package/src/api/sources/aux-types-diff.ts +81 -0
- package/src/api/sources/client-tracker.ts +10 -0
- package/src/api/sources/creator-docs.ts +37 -0
- package/src/api/sources/luau-types.ts +30 -0
- package/src/api/sources/mini-dump.ts +50 -0
- package/src/api/sources/studio-api.ts +7 -0
- package/src/api/sources/studio-apiv2.ts +10 -0
- package/src/api/sources/studio-full-api.ts +7 -0
- package/src/api/studio-smoke.ts +82 -0
- package/src/api/type-parse.ts +48 -0
- package/src/api/understander.ts +72 -0
- package/src/api/validate.ts +160 -0
- package/src/api-cli.ts +493 -0
- package/src/api.generated.js +37 -22
- package/src/cli.ts +21 -6
- package/src/clpp/contract.ts +34 -3
- package/src/clpp/format-luau.ts +262 -0
- package/src/clpp/index.ts +13 -2
- package/src/clpp/modules.ts +252 -0
- package/src/clpp/postprocess.ts +100 -5
- package/src/clpp/rewrite-janitor.ts +156 -0
- package/src/clpp/runner.ts +14 -2
- package/src/compile.ts +87 -0
- package/src/flare/parse.ts +14 -1
- package/src/flare/types.ts +2 -0
- package/src/intellisense.ts +58 -1
- package/src/native/index.ts +225 -16
- package/src/target/authority-check.ts +162 -0
- package/src/target/authority-graph.ts +80 -0
- package/src/target/build-cache.ts +129 -0
- package/src/target/capabilities.ts +115 -0
- package/src/target/capability-profile.ts +25 -0
- package/src/target/component-contracts.ts +64 -0
- package/src/target/context-check.ts +177 -0
- package/src/target/datamodel-check.ts +188 -0
- package/src/target/datamodel-generate.ts +78 -0
- package/src/target/datamodel.ts +261 -0
- package/src/target/diagnostics.ts +67 -0
- package/src/target/doctor.ts +171 -0
- package/src/target/flare-version.ts +61 -0
- package/src/target/get-service.ts +85 -0
- package/src/target/lifetime-check.ts +45 -0
- package/src/target/luau-stamp.ts +33 -0
- package/src/target/optimizer-advise.ts +93 -0
- package/src/target/optimizer-apply.ts +63 -0
- package/src/target/optimizer-soa.ts +270 -0
- package/src/target/parallel-check.ts +135 -0
- package/src/target/pgo.ts +157 -0
- package/src/target/project-docs.ts +68 -0
- package/src/target/project-graph.ts +75 -0
- package/src/target/roblox.ts +78 -0
- package/src/target/security-check.ts +40 -0
- package/src/target/source-map.ts +36 -0
- package/src/target/studio-bridge.ts +140 -0
- package/src/types.ts +14 -0
- package/src/utils/project.ts +183 -9
- package/src/utils/rojo-mapper.ts +12 -3
- package/stylua.toml +9 -0
- package/templates/game/.vscode/settings.json +7 -1
- package/templates/game/include/clpp/datatypes.clh +337 -373
- package/templates/game/include/clpp/generated/enums.clh +1 -1
- package/templates/game/include/clpp/generated/instances.clh +41135 -41064
- package/templates/game/include/clpp/libs/axiom.clh +1 -1
- package/templates/game/include/clpp/libs/ward.clh +1 -0
- package/templates/game/include/clpp/roblox.clh +3 -4
- package/templates/game/src/ServerScriptService/Boot/DataBoot.server.clpp +1 -1
- package/templates/game/src/ServerScriptService/Handlers/PlayerHandler.server.clpp +1 -1
- package/templates/game/stylua.toml +9 -0
|
@@ -0,0 +1,115 @@
|
|
|
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.buildRobloxTargetProfile = buildRobloxTargetProfile;
|
|
7
|
+
exports.writeProfileCache = writeProfileCache;
|
|
8
|
+
exports.profileContentHash = profileContentHash;
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
const package_info_js_1 = require("../package-info.js");
|
|
12
|
+
const package_info_js_2 = require("../package-info.js");
|
|
13
|
+
const loader_js_1 = require("./loader.js");
|
|
14
|
+
const model_js_1 = require("./model.js");
|
|
15
|
+
const normalize_js_1 = require("./normalize.js");
|
|
16
|
+
const merge_js_1 = require("./merge.js");
|
|
17
|
+
const registry_js_1 = require("./registry.js");
|
|
18
|
+
const resolver_js_1 = require("./resolver.js");
|
|
19
|
+
const mini_dump_js_1 = require("./sources/mini-dump.js");
|
|
20
|
+
const validate_js_1 = require("./validate.js");
|
|
21
|
+
const DEFAULT_GLOBALS = {
|
|
22
|
+
game: { name: "game", type: { kind: "Class", name: "DataModel" }, layer: "roblox-engine" },
|
|
23
|
+
workspace: { name: "workspace", type: { kind: "Class", name: "Workspace" }, layer: "roblox-engine" },
|
|
24
|
+
script: { name: "script", type: { kind: "Class", name: "LuaSourceContainer" }, layer: "roblox-engine" },
|
|
25
|
+
plugin: { name: "plugin", type: { kind: "Class", name: "Plugin" }, layer: "roblox-engine" },
|
|
26
|
+
typeof: { name: "typeof", type: { kind: "Function", parameters: [{ kind: "Any" }], returns: [{ kind: "Primitive", name: "string" }] }, layer: "luau-core" },
|
|
27
|
+
print: { name: "print", type: { kind: "Function", parameters: [{ kind: "Any" }], returns: [{ kind: "Primitive", name: "void" }], variadic: true }, layer: "luau-core" },
|
|
28
|
+
warn: { name: "warn", type: { kind: "Function", parameters: [{ kind: "Any" }], returns: [{ kind: "Primitive", name: "void" }], variadic: true }, layer: "luau-core" },
|
|
29
|
+
error: { name: "error", type: { kind: "Function", parameters: [{ kind: "Any" }], returns: [{ kind: "Never" }], variadic: true }, layer: "luau-core" },
|
|
30
|
+
require: { name: "require", type: { kind: "Function", parameters: [{ kind: "Any" }], returns: [{ kind: "Any" }] }, layer: "luau-core" },
|
|
31
|
+
task: { name: "task", type: { kind: "Any" }, layer: "roblox-engine", description: "Roblox task library" },
|
|
32
|
+
};
|
|
33
|
+
const DEFAULT_LIBRARIES = {
|
|
34
|
+
math: { name: "math", layer: "luau-core" },
|
|
35
|
+
string: { name: "string", layer: "luau-core" },
|
|
36
|
+
table: { name: "table", layer: "luau-core" },
|
|
37
|
+
bit32: { name: "bit32", layer: "luau-core" },
|
|
38
|
+
buffer: { name: "buffer", layer: "luau-core" },
|
|
39
|
+
coroutine: { name: "coroutine", layer: "luau-core" },
|
|
40
|
+
debug: { name: "debug", layer: "luau-core" },
|
|
41
|
+
os: { name: "os", layer: "luau-core" },
|
|
42
|
+
utf8: { name: "utf8", layer: "luau-core" },
|
|
43
|
+
task: { name: "task", layer: "roblox-engine" },
|
|
44
|
+
Hive: { name: "Hive", layer: "cluaupp-runtime", bind: "Hive" },
|
|
45
|
+
Flare: { name: "Flare", layer: "cluaupp-runtime", bind: "Flare" },
|
|
46
|
+
Roster: { name: "Roster", layer: "cluaupp-runtime", bind: "Roster" },
|
|
47
|
+
Ward: { name: "Ward", layer: "cluaupp-runtime", bind: "Ward" },
|
|
48
|
+
Axiom: { name: "Axiom", layer: "cluaupp-runtime", bind: "Axiom" },
|
|
49
|
+
};
|
|
50
|
+
function buildRobloxTargetProfile(options = {}) {
|
|
51
|
+
const loaded = (0, mini_dump_js_1.loadMiniDump)(options.dumpPath);
|
|
52
|
+
const { classes, enums, unsupported } = (0, normalize_js_1.normalizeMiniDump)(loaded.data);
|
|
53
|
+
const datatypeFile = (0, loader_js_1.readOverrideFile)("datatypes.json");
|
|
54
|
+
const datatypes = (0, merge_js_1.applyDatatypeOverrides)({}, datatypeFile.data.datatypes || {});
|
|
55
|
+
const globalsFile = (0, loader_js_1.readOverrideFile)("globals.json");
|
|
56
|
+
const globals = (0, merge_js_1.applyGlobalsOverrides)(DEFAULT_GLOBALS, stripMeta(globalsFile.data));
|
|
57
|
+
const libsFile = (0, loader_js_1.readOverrideFile)("libraries.json");
|
|
58
|
+
const libraries = (0, merge_js_1.applyLibraryOverrides)(DEFAULT_LIBRARIES, stripMeta(libsFile.data));
|
|
59
|
+
const classesFile = (0, loader_js_1.readOverrideFile)("classes.json");
|
|
60
|
+
(0, merge_js_1.applyClassOverrides)(classes, stripMeta(classesFile.data));
|
|
61
|
+
const services = (0, registry_js_1.deriveServices)(classes);
|
|
62
|
+
const sources = {
|
|
63
|
+
[loaded.meta.id]: loaded.meta,
|
|
64
|
+
overrides: {
|
|
65
|
+
id: "overrides",
|
|
66
|
+
hash: (0, loader_js_1.overridesHash)(),
|
|
67
|
+
loadedAt: new Date().toISOString(),
|
|
68
|
+
path: node_path_1.default.join(package_info_js_1.projectRoot, "api", "overrides"),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
const profile = {
|
|
72
|
+
target: "roblox",
|
|
73
|
+
schemaVersion: model_js_1.ROBLOX_TARGET_SCHEMA_VERSION,
|
|
74
|
+
robloxApiVersion: loaded.meta.version != null ? String(loaded.meta.version) : undefined,
|
|
75
|
+
generatorVersion: package_info_js_2.pkg.version,
|
|
76
|
+
sources,
|
|
77
|
+
classes,
|
|
78
|
+
enums,
|
|
79
|
+
datatypes,
|
|
80
|
+
globals,
|
|
81
|
+
libraries,
|
|
82
|
+
services,
|
|
83
|
+
aliases: {},
|
|
84
|
+
constructors: Object.fromEntries(Object.values(datatypes)
|
|
85
|
+
.filter((d) => d.constructors.length)
|
|
86
|
+
.map((d) => [d.name, d.constructors])),
|
|
87
|
+
security: {},
|
|
88
|
+
deprecations: {},
|
|
89
|
+
unsupported,
|
|
90
|
+
};
|
|
91
|
+
if (!options.skipValidate) {
|
|
92
|
+
(0, validate_js_1.assertValid)(profile);
|
|
93
|
+
}
|
|
94
|
+
return profile;
|
|
95
|
+
}
|
|
96
|
+
function stripMeta(data) {
|
|
97
|
+
const { _meta: _, ...rest } = data;
|
|
98
|
+
return rest;
|
|
99
|
+
}
|
|
100
|
+
function writeProfileCache(profile, outPath) {
|
|
101
|
+
const target = outPath || node_path_1.default.join(package_info_js_1.projectRoot, "api", "normalized", "roblox-target.profile.json");
|
|
102
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(target), { recursive: true });
|
|
103
|
+
const json = `${JSON.stringify(profile, null, "\t")}\n`;
|
|
104
|
+
const tmp = `${target}.${process.pid}.tmp`;
|
|
105
|
+
node_fs_1.default.writeFileSync(tmp, json, "utf8");
|
|
106
|
+
node_fs_1.default.renameSync(tmp, target);
|
|
107
|
+
return target;
|
|
108
|
+
}
|
|
109
|
+
function profileContentHash(profile) {
|
|
110
|
+
const clone = { ...profile, sources: { ...profile.sources } };
|
|
111
|
+
for (const key of Object.keys(clone.sources)) {
|
|
112
|
+
clone.sources[key] = { ...clone.sources[key], loadedAt: "" };
|
|
113
|
+
}
|
|
114
|
+
return (0, resolver_js_1.hashBuffer)(JSON.stringify(clone));
|
|
115
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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.computeCacheKey = computeCacheKey;
|
|
7
|
+
exports.cacheDir = cacheDir;
|
|
8
|
+
exports.readCache = readCache;
|
|
9
|
+
exports.writeCache = writeCache;
|
|
10
|
+
exports.cacheKeyHash = cacheKeyHash;
|
|
11
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
13
|
+
const package_info_js_1 = require("../package-info.js");
|
|
14
|
+
const resolver_js_1 = require("../api/resolver.js");
|
|
15
|
+
const loader_js_1 = require("../api/loader.js");
|
|
16
|
+
const build_profile_js_1 = require("../api/build-profile.js");
|
|
17
|
+
function computeCacheKey(generatorVersion, dumpPath) {
|
|
18
|
+
const profile = (0, build_profile_js_1.buildRobloxTargetProfile)({ dumpPath, skipValidate: true });
|
|
19
|
+
return {
|
|
20
|
+
sourceHash: profile.sources["mini-api-dump"]?.hash || (0, build_profile_js_1.profileContentHash)(profile),
|
|
21
|
+
overridesHash: (0, loader_js_1.overridesHash)(),
|
|
22
|
+
generatorVersion,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function cacheDir() {
|
|
26
|
+
return node_path_1.default.join(package_info_js_1.projectRoot, "api", ".cache");
|
|
27
|
+
}
|
|
28
|
+
function readCache(key) {
|
|
29
|
+
const file = node_path_1.default.join(cacheDir(), `${key}.json`);
|
|
30
|
+
if (!node_fs_1.default.existsSync(file)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
|
|
34
|
+
}
|
|
35
|
+
function writeCache(key, value) {
|
|
36
|
+
node_fs_1.default.mkdirSync(cacheDir(), { recursive: true });
|
|
37
|
+
const file = node_path_1.default.join(cacheDir(), `${key}.json`);
|
|
38
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
39
|
+
node_fs_1.default.writeFileSync(tmp, `${JSON.stringify(value)}\n`, "utf8");
|
|
40
|
+
node_fs_1.default.renameSync(tmp, file);
|
|
41
|
+
}
|
|
42
|
+
function cacheKeyHash(parts) {
|
|
43
|
+
return (0, resolver_js_1.hashBuffer)(`${parts.sourceHash}:${parts.overridesHash}:${parts.generatorVersion}`);
|
|
44
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeCoverage = computeCoverage;
|
|
4
|
+
function computeCoverage(registry) {
|
|
5
|
+
let properties = 0;
|
|
6
|
+
let methods = 0;
|
|
7
|
+
let events = 0;
|
|
8
|
+
let callbacks = 0;
|
|
9
|
+
for (const cls of registry.classes.values()) {
|
|
10
|
+
properties += cls.properties.length;
|
|
11
|
+
methods += cls.methods.length;
|
|
12
|
+
events += cls.events.length;
|
|
13
|
+
callbacks += cls.callbacks.length;
|
|
14
|
+
}
|
|
15
|
+
const unsupported = registry.profile.unsupported;
|
|
16
|
+
const totalMembers = properties + methods + events + callbacks;
|
|
17
|
+
const gapCount = unsupported.filter((u) => u.severity !== "info").length;
|
|
18
|
+
const coveragePercent = totalMembers === 0 ? 100 : Math.max(0, Math.round(((totalMembers - gapCount) / totalMembers) * 10000) / 100);
|
|
19
|
+
return {
|
|
20
|
+
classes: registry.classes.size,
|
|
21
|
+
enums: registry.enums.size,
|
|
22
|
+
datatypes: registry.datatypes.size,
|
|
23
|
+
services: registry.services.size,
|
|
24
|
+
properties,
|
|
25
|
+
methods,
|
|
26
|
+
events,
|
|
27
|
+
callbacks,
|
|
28
|
+
unsupported,
|
|
29
|
+
coveragePercent,
|
|
30
|
+
gaps: unsupported.map((u) => `${u.symbol}: ${u.reason}`),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.diffProfiles = diffProfiles;
|
|
4
|
+
const resolver_js_1 = require("./resolver.js");
|
|
5
|
+
function diffProfiles(before, after) {
|
|
6
|
+
const out = [];
|
|
7
|
+
const beforeClasses = new Set(Object.keys(before.classes));
|
|
8
|
+
const afterClasses = new Set(Object.keys(after.classes));
|
|
9
|
+
for (const name of afterClasses) {
|
|
10
|
+
if (!beforeClasses.has(name)) {
|
|
11
|
+
out.push({ kind: "ADDED_CLASS", symbol: name });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
for (const name of beforeClasses) {
|
|
15
|
+
if (!afterClasses.has(name)) {
|
|
16
|
+
out.push({ kind: "REMOVED_CLASS", symbol: name });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
for (const name of afterClasses) {
|
|
20
|
+
if (!beforeClasses.has(name)) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const a = before.classes[name];
|
|
24
|
+
const b = after.classes[name];
|
|
25
|
+
if ((a.superclass || null) !== (b.superclass || null)) {
|
|
26
|
+
out.push({
|
|
27
|
+
kind: "CHANGED_SUPERCLASS",
|
|
28
|
+
symbol: name,
|
|
29
|
+
oldValue: a.superclass || undefined,
|
|
30
|
+
newValue: b.superclass || undefined,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
diffProps(a.name, a.properties, b.properties, out);
|
|
34
|
+
diffMethods(a.name, a.methods, b.methods, out);
|
|
35
|
+
diffEvents(a.name, a.events, b.events, out);
|
|
36
|
+
}
|
|
37
|
+
const beforeEnums = new Set(Object.keys(before.enums));
|
|
38
|
+
const afterEnums = new Set(Object.keys(after.enums));
|
|
39
|
+
for (const name of afterEnums) {
|
|
40
|
+
if (!beforeEnums.has(name)) {
|
|
41
|
+
out.push({ kind: "ADDED_ENUM", symbol: name });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (const name of beforeEnums) {
|
|
45
|
+
if (!afterEnums.has(name)) {
|
|
46
|
+
out.push({ kind: "REMOVED_ENUM", symbol: name });
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const aItems = new Set(before.enums[name].items.map((i) => i.name));
|
|
50
|
+
const bItems = new Set(after.enums[name].items.map((i) => i.name));
|
|
51
|
+
for (const item of bItems) {
|
|
52
|
+
if (!aItems.has(item)) {
|
|
53
|
+
out.push({ kind: "ADDED_ENUM_ITEM", symbol: `${name}.${item}` });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
for (const item of aItems) {
|
|
57
|
+
if (!bItems.has(item)) {
|
|
58
|
+
out.push({ kind: "REMOVED_ENUM_ITEM", symbol: `${name}.${item}` });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
function diffProps(owner, before, after, out) {
|
|
66
|
+
const bMap = new Map(before.map((p) => [p.name, p]));
|
|
67
|
+
const aMap = new Map(after.map((p) => [p.name, p]));
|
|
68
|
+
for (const [name, prop] of aMap) {
|
|
69
|
+
if (!bMap.has(name)) {
|
|
70
|
+
out.push({ kind: "ADDED_PROPERTY", symbol: `${owner}.${name}` });
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const old = bMap.get(name);
|
|
74
|
+
if ((0, resolver_js_1.typeToClpp)(old.valueType) !== (0, resolver_js_1.typeToClpp)(prop.valueType)) {
|
|
75
|
+
out.push({
|
|
76
|
+
kind: "CHANGED_PROPERTY_TYPE",
|
|
77
|
+
symbol: `${owner}.${name}`,
|
|
78
|
+
oldValue: (0, resolver_js_1.typeToClpp)(old.valueType),
|
|
79
|
+
newValue: (0, resolver_js_1.typeToClpp)(prop.valueType),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
for (const name of bMap.keys()) {
|
|
85
|
+
if (!aMap.has(name)) {
|
|
86
|
+
out.push({ kind: "REMOVED_PROPERTY", symbol: `${owner}.${name}` });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function diffMethods(owner, before, after, out) {
|
|
91
|
+
const key = (m) => `${m.name}#${m.overloadIndex}`;
|
|
92
|
+
const bSet = new Set(before.map(key));
|
|
93
|
+
const aSet = new Set(after.map(key));
|
|
94
|
+
for (const k of aSet) {
|
|
95
|
+
if (!bSet.has(k)) {
|
|
96
|
+
out.push({ kind: "ADDED_METHOD_OVERLOAD", symbol: `${owner}.${k}` });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
for (const k of bSet) {
|
|
100
|
+
if (!aSet.has(k)) {
|
|
101
|
+
out.push({ kind: "REMOVED_METHOD_OVERLOAD", symbol: `${owner}.${k}` });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function diffEvents(owner, before, after, out) {
|
|
106
|
+
const bMap = new Map(before.map((e) => [e.name, e]));
|
|
107
|
+
const aMap = new Map(after.map((e) => [e.name, e]));
|
|
108
|
+
for (const [name, ev] of aMap) {
|
|
109
|
+
if (!bMap.has(name)) {
|
|
110
|
+
out.push({ kind: "ADDED_EVENT", symbol: `${owner}.${name}` });
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const oldSig = bMap.get(name).parameters.map((p) => (0, resolver_js_1.typeToClpp)(p.type)).join(",");
|
|
114
|
+
const newSig = ev.parameters.map((p) => (0, resolver_js_1.typeToClpp)(p.type)).join(",");
|
|
115
|
+
if (oldSig !== newSig) {
|
|
116
|
+
out.push({
|
|
117
|
+
kind: "CHANGED_EVENT_SIGNATURE",
|
|
118
|
+
symbol: `${owner}.${name}`,
|
|
119
|
+
oldValue: oldSig,
|
|
120
|
+
newValue: newSig,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
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.generateClppHeaders = generateClppHeaders;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const package_info_js_1 = require("../../package-info.js");
|
|
10
|
+
const identifier_js_1 = require("../identifier.js");
|
|
11
|
+
const registry_js_1 = require("../registry.js");
|
|
12
|
+
const resolver_js_1 = require("../resolver.js");
|
|
13
|
+
function mkdirp(dir) {
|
|
14
|
+
node_fs_1.default.mkdirSync(dir, { recursive: true });
|
|
15
|
+
}
|
|
16
|
+
function atomicWrite(file, contents) {
|
|
17
|
+
mkdirp(node_path_1.default.dirname(file));
|
|
18
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
19
|
+
node_fs_1.default.writeFileSync(tmp, contents, "utf8");
|
|
20
|
+
node_fs_1.default.renameSync(tmp, file);
|
|
21
|
+
}
|
|
22
|
+
function headerType(type, memberName) {
|
|
23
|
+
if (type.kind === "Unsupported") {
|
|
24
|
+
return "auto";
|
|
25
|
+
}
|
|
26
|
+
if (type.kind === "Primitive") {
|
|
27
|
+
if (type.name === "int64") {
|
|
28
|
+
return "long long";
|
|
29
|
+
}
|
|
30
|
+
if (type.name === "boolean") {
|
|
31
|
+
return "bool";
|
|
32
|
+
}
|
|
33
|
+
return type.name;
|
|
34
|
+
}
|
|
35
|
+
if (type.kind === "Datatype" && type.name === "Instances") {
|
|
36
|
+
if (memberName === "GetPlayers" || memberName === "getPlayers" || memberName === "players") {
|
|
37
|
+
return "LuaArray<Player>";
|
|
38
|
+
}
|
|
39
|
+
return "LuaArray<Instance>";
|
|
40
|
+
}
|
|
41
|
+
if (type.kind === "Datatype" && (type.name === "ContentId" || type.name === "BinaryString" || type.name === "ProtectedString" || type.name === "SharedString")) {
|
|
42
|
+
return "string";
|
|
43
|
+
}
|
|
44
|
+
if (type.kind === "Class" || type.kind === "Datatype") {
|
|
45
|
+
return (0, identifier_js_1.escapeIdent)(type.name);
|
|
46
|
+
}
|
|
47
|
+
const mapped = (0, resolver_js_1.typeToClpp)(type);
|
|
48
|
+
if (mapped.includes("void*") || mapped === "auto") {
|
|
49
|
+
return "auto";
|
|
50
|
+
}
|
|
51
|
+
return mapped;
|
|
52
|
+
}
|
|
53
|
+
function emitParams(parameters) {
|
|
54
|
+
const defaults = parameters.map((p) => {
|
|
55
|
+
if (!p.default || String(p.default).includes("__api_dump")) {
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
const raw = String(p.default);
|
|
59
|
+
if (raw === "nil" || raw === "null") {
|
|
60
|
+
return " = null";
|
|
61
|
+
}
|
|
62
|
+
if (raw === "true" || raw === "false") {
|
|
63
|
+
return ` = ${raw}`;
|
|
64
|
+
}
|
|
65
|
+
if (/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(raw)) {
|
|
66
|
+
return ` = ${raw}`;
|
|
67
|
+
}
|
|
68
|
+
if (raw.startsWith("Enum.")) {
|
|
69
|
+
const parts = raw.split(".");
|
|
70
|
+
if (parts.length >= 3) {
|
|
71
|
+
return ` = Enum::${(0, identifier_js_1.escapeIdent)(parts[1])}::${(0, identifier_js_1.escapeIdent)(parts[2])}`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return "";
|
|
75
|
+
});
|
|
76
|
+
const use = parameters.map(() => "");
|
|
77
|
+
for (let i = parameters.length - 1; i >= 0; i--) {
|
|
78
|
+
if (!defaults[i]) {
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
use[i] = defaults[i];
|
|
82
|
+
}
|
|
83
|
+
return parameters
|
|
84
|
+
.map((p, i) => `${headerType(p.type)} ${(0, identifier_js_1.escapeIdent)(p.name)}${use[i]}`)
|
|
85
|
+
.join(", ");
|
|
86
|
+
}
|
|
87
|
+
function generateEnums(enums) {
|
|
88
|
+
let out = `#pragma once
|
|
89
|
+
// Generated from RobloxTargetProfile. Enum.Name.Item → Enum::Name::Item
|
|
90
|
+
namespace Enum {
|
|
91
|
+
`;
|
|
92
|
+
for (const name of Object.keys(enums).sort()) {
|
|
93
|
+
const en = enums[name];
|
|
94
|
+
out += `\tenum class ${(0, identifier_js_1.escapeIdent)(en.name)} {\n`;
|
|
95
|
+
for (const item of en.items) {
|
|
96
|
+
out += `\t\t${(0, identifier_js_1.escapeIdent)(item.name)} = ${item.numericValue},\n`;
|
|
97
|
+
}
|
|
98
|
+
out += `\t};\n`;
|
|
99
|
+
}
|
|
100
|
+
out += `}\n`;
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
function emitDatatype(dt) {
|
|
104
|
+
if (dt.name === "RBXScriptSignal") {
|
|
105
|
+
return `
|
|
106
|
+
// Event. PlayerAdded.Connect(callback) — F matches any listener arity.
|
|
107
|
+
struct RBXScriptSignal {
|
|
108
|
+
template <typename F>
|
|
109
|
+
RBXScriptConnection Connect(F callback);
|
|
110
|
+
template <typename F>
|
|
111
|
+
RBXScriptConnection Once(F callback);
|
|
112
|
+
template <typename F>
|
|
113
|
+
RBXScriptConnection ConnectParallel(F callback);
|
|
114
|
+
LuauValue Wait();
|
|
115
|
+
};
|
|
116
|
+
`;
|
|
117
|
+
}
|
|
118
|
+
let out = `\n// ${dt.summary || dt.name}\nstruct ${(0, identifier_js_1.escapeIdent)(dt.name)} {\n`;
|
|
119
|
+
for (const field of dt.fields) {
|
|
120
|
+
const ty = headerType(field.type);
|
|
121
|
+
if (ty === (0, identifier_js_1.escapeIdent)(dt.name)) {
|
|
122
|
+
out += `\t${(0, identifier_js_1.escapeIdent)(dt.name)} ${(0, identifier_js_1.escapeIdent)(field.name)}() const;\n`;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
out += `\t${ty} ${(0, identifier_js_1.escapeIdent)(field.name)};\n`;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
for (const ctor of dt.constructors) {
|
|
129
|
+
out += `\t${(0, identifier_js_1.escapeIdent)(dt.name)}(${emitParams(ctor.parameters)});\n`;
|
|
130
|
+
}
|
|
131
|
+
for (const st of dt.staticProperties) {
|
|
132
|
+
out += `\tstatic ${(0, identifier_js_1.escapeIdent)(dt.name)} ${(0, identifier_js_1.escapeIdent)(st)};\n`;
|
|
133
|
+
}
|
|
134
|
+
for (const m of dt.staticMethods) {
|
|
135
|
+
out += `\tstatic ${headerType(m.returnTypes[0] || { kind: "Primitive", name: "void" })} ${(0, identifier_js_1.escapeIdent)(m.name)}(${emitParams(m.parameters)});\n`;
|
|
136
|
+
}
|
|
137
|
+
for (const m of dt.instanceMethods) {
|
|
138
|
+
out += `\t${headerType(m.returnTypes[0] || { kind: "Primitive", name: "void" })} ${(0, identifier_js_1.escapeIdent)(m.name)}(${emitParams(m.parameters)});\n`;
|
|
139
|
+
}
|
|
140
|
+
out += `};\n`;
|
|
141
|
+
return out;
|
|
142
|
+
}
|
|
143
|
+
function generateDatatypes(profile) {
|
|
144
|
+
let out = `#pragma once
|
|
145
|
+
#include <clpp/generated/enums.clh>
|
|
146
|
+
using Enum::EasingStyle;
|
|
147
|
+
using Enum::EasingDirection;
|
|
148
|
+
using Enum::Material;
|
|
149
|
+
using Enum::FontWeight;
|
|
150
|
+
using Enum::FontStyle;
|
|
151
|
+
using Enum::RaycastFilterType;
|
|
152
|
+
using Enum::PathWaypointAction;
|
|
153
|
+
using Enum::CatalogSortType;
|
|
154
|
+
using Enum::CatalogSortAggregation;
|
|
155
|
+
using Enum::CatalogCategoryFilter;
|
|
156
|
+
using Enum::SalesTypeFilter;
|
|
157
|
+
using Enum::KeyInterpolationMode;
|
|
158
|
+
using Enum::NormalId;
|
|
159
|
+
using Enum::Axis;
|
|
160
|
+
|
|
161
|
+
using string = const char*;
|
|
162
|
+
|
|
163
|
+
// Variadic join. Cluaupp emits Luau a .. b .. c.
|
|
164
|
+
template <typename... Args>
|
|
165
|
+
string string_concat(Args... args);
|
|
166
|
+
|
|
167
|
+
struct Instance;
|
|
168
|
+
struct Player;
|
|
169
|
+
|
|
170
|
+
// Stand-in for values the C++ IntelliSense stubs cannot name precisely.
|
|
171
|
+
struct LuauValue {
|
|
172
|
+
LuauValue();
|
|
173
|
+
template <typename T>
|
|
174
|
+
LuauValue(const T&);
|
|
175
|
+
template <typename T>
|
|
176
|
+
operator T() const;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
template <typename T>
|
|
180
|
+
struct LuaArray {
|
|
181
|
+
T* _begin;
|
|
182
|
+
T* _end;
|
|
183
|
+
T* begin() const { return _begin; }
|
|
184
|
+
T* end() const { return _end; }
|
|
185
|
+
int Size() const;
|
|
186
|
+
T operator[](int index) const;
|
|
187
|
+
};
|
|
188
|
+
`;
|
|
189
|
+
const skip = new Set(["Function", "Tuple", "Variant", "Array", "Dictionary", "Map", "User", "Instances", "ContentId"]);
|
|
190
|
+
for (const name of Object.keys(profile.datatypes).sort()) {
|
|
191
|
+
out += emitDatatype(profile.datatypes[name]);
|
|
192
|
+
}
|
|
193
|
+
// Stub any datatype-like Class names referenced only as DataType elsewhere — kept empty for now.
|
|
194
|
+
void skip;
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
function isCreatableClass(cls) {
|
|
198
|
+
return (cls.creatable ||
|
|
199
|
+
cls.name === "Folder" ||
|
|
200
|
+
cls.name === "Part" ||
|
|
201
|
+
cls.name === "MeshPart" ||
|
|
202
|
+
cls.name === "Model" ||
|
|
203
|
+
cls.name === "WedgePart" ||
|
|
204
|
+
cls.name === "CornerWedgePart" ||
|
|
205
|
+
cls.name === "TrussPart");
|
|
206
|
+
}
|
|
207
|
+
function emitMethod(clsName, method) {
|
|
208
|
+
const name = (0, identifier_js_1.escapeMember)(clsName, method.name);
|
|
209
|
+
const ret = headerType(method.returnTypes[0] || { kind: "Primitive", name: "void" }, method.name);
|
|
210
|
+
if (method.name === "WaitForChild" && method.parameters.length >= 1) {
|
|
211
|
+
const first = `${headerType(method.parameters[0].type)} ${(0, identifier_js_1.escapeIdent)(method.parameters[0].name)}`;
|
|
212
|
+
return `\t${ret} ${name}(${first});\n\t${ret} ${name}(${first}, double timeOut);\n`;
|
|
213
|
+
}
|
|
214
|
+
return `\t${ret} ${name}(${emitParams(method.parameters)});\n`;
|
|
215
|
+
}
|
|
216
|
+
function generateInstances(profile) {
|
|
217
|
+
const registry = (0, registry_js_1.buildRegistry)(profile);
|
|
218
|
+
let out = `#pragma once
|
|
219
|
+
#include <clpp/datatypes.clh>
|
|
220
|
+
|
|
221
|
+
// Flattened members: IntelliSense view from ClassGraph (does not mutate inheritance).
|
|
222
|
+
// Creatable classes get Class() and Class(Instance parent).
|
|
223
|
+
|
|
224
|
+
`;
|
|
225
|
+
const classNames = Object.keys(profile.classes).sort();
|
|
226
|
+
for (const name of classNames) {
|
|
227
|
+
out += `struct ${(0, identifier_js_1.escapeIdent)(name)};\n`;
|
|
228
|
+
}
|
|
229
|
+
out += "\n";
|
|
230
|
+
for (const name of classNames) {
|
|
231
|
+
const cls = profile.classes[name];
|
|
232
|
+
const superName = cls.superclass && profile.classes[cls.superclass] ? (0, identifier_js_1.escapeIdent)(cls.superclass) : "";
|
|
233
|
+
const parent = superName ? ` : ${superName}` : "";
|
|
234
|
+
out += `struct ${(0, identifier_js_1.escapeIdent)(cls.name)}${parent} {\n`;
|
|
235
|
+
if (isCreatableClass(cls)) {
|
|
236
|
+
out += `\t${(0, identifier_js_1.escapeIdent)(cls.name)}();\n`;
|
|
237
|
+
out += `\t${(0, identifier_js_1.escapeIdent)(cls.name)}(Instance parent);\n`;
|
|
238
|
+
}
|
|
239
|
+
else if (!parent) {
|
|
240
|
+
out += `\t${(0, identifier_js_1.escapeIdent)(cls.name)}() = default;\n`;
|
|
241
|
+
}
|
|
242
|
+
const flat = (0, registry_js_1.flattenMembers)(registry, cls.name);
|
|
243
|
+
for (const prop of flat.properties) {
|
|
244
|
+
out += `\t${headerType(prop.valueType)} ${(0, identifier_js_1.escapeMember)(cls.name, prop.name)};\n`;
|
|
245
|
+
}
|
|
246
|
+
for (const method of flat.methods) {
|
|
247
|
+
out += emitMethod(cls.name, method);
|
|
248
|
+
}
|
|
249
|
+
for (const event of flat.events) {
|
|
250
|
+
const params = event.parameters.map((p) => headerType(p.type)).join(", ");
|
|
251
|
+
out += `\tRBXScriptSignal ${(0, identifier_js_1.escapeMember)(cls.name, event.name)};${params ? ` /* (${params}) */` : ""}\n`;
|
|
252
|
+
}
|
|
253
|
+
for (const cb of cls.callbacks) {
|
|
254
|
+
out += `\tvoid (*${(0, identifier_js_1.escapeMember)(cls.name, cb.name)})();\n`;
|
|
255
|
+
}
|
|
256
|
+
out += `};\n\n`;
|
|
257
|
+
}
|
|
258
|
+
return out;
|
|
259
|
+
}
|
|
260
|
+
function generateApiJs(profile) {
|
|
261
|
+
const instanceTypes = [];
|
|
262
|
+
const services = [];
|
|
263
|
+
const methods = new Set(["Connect", "Once", "Disconnect", "Wait", "GetService"]);
|
|
264
|
+
for (const cls of Object.values(profile.classes)) {
|
|
265
|
+
if (cls.service || cls.creation.service) {
|
|
266
|
+
services.push(cls.name);
|
|
267
|
+
}
|
|
268
|
+
if (isCreatableClass(cls)) {
|
|
269
|
+
instanceTypes.push(cls.name);
|
|
270
|
+
}
|
|
271
|
+
for (const m of cls.methods) {
|
|
272
|
+
methods.add(m.name);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
for (const dt of Object.values(profile.datatypes)) {
|
|
276
|
+
for (const m of dt.instanceMethods) {
|
|
277
|
+
methods.add(m.name);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const datatypes = Object.keys(profile.datatypes).sort();
|
|
281
|
+
return `// Generated from RobloxTargetProfile schemaVersion ${profile.schemaVersion}
|
|
282
|
+
"use strict";
|
|
283
|
+
module.exports = {
|
|
284
|
+
INSTANCE_TYPES: ${JSON.stringify(instanceTypes.sort(), null, "\t")},
|
|
285
|
+
SERVICES: ${JSON.stringify(services.sort(), null, "\t")},
|
|
286
|
+
METHODS: ${JSON.stringify([...methods].sort(), null, "\t")},
|
|
287
|
+
DATATYPES: ${JSON.stringify(datatypes, null, "\t")},
|
|
288
|
+
};
|
|
289
|
+
`;
|
|
290
|
+
}
|
|
291
|
+
function generateUmbrella() {
|
|
292
|
+
return `#pragma once
|
|
293
|
+
// Cluaupp — Roblox API stubs for CL++ IntelliSense (generated projection).
|
|
294
|
+
// Source of truth: RobloxTargetProfile registry — not this header.
|
|
295
|
+
|
|
296
|
+
#include <clpp/generated/enums.clh>
|
|
297
|
+
#include <clpp/datatypes.clh>
|
|
298
|
+
#include <clpp/generated/instances.clh>
|
|
299
|
+
#include <clpp/libs.clh>
|
|
300
|
+
|
|
301
|
+
template <typename T>
|
|
302
|
+
T GetService();
|
|
303
|
+
|
|
304
|
+
template <typename T>
|
|
305
|
+
T GetService(Instance game_);
|
|
306
|
+
|
|
307
|
+
extern DataModel game;
|
|
308
|
+
extern Workspace workspace;
|
|
309
|
+
extern LuaSourceContainer script;
|
|
310
|
+
|
|
311
|
+
void post(string message);
|
|
312
|
+
void warn(string message);
|
|
313
|
+
void report(string message);
|
|
314
|
+
string to_string(auto value);
|
|
315
|
+
double to_number(auto value);
|
|
316
|
+
bool to_bool(auto value);
|
|
317
|
+
|
|
318
|
+
double tick();
|
|
319
|
+
double time();
|
|
320
|
+
double wait();
|
|
321
|
+
double wait(double seconds);
|
|
322
|
+
void delay(double seconds, func callback);
|
|
323
|
+
|
|
324
|
+
namespace task {
|
|
325
|
+
double wait();
|
|
326
|
+
double wait(double seconds);
|
|
327
|
+
void delay(double seconds, func callback);
|
|
328
|
+
void defer(func callback);
|
|
329
|
+
void synchronize();
|
|
330
|
+
void desynchronize();
|
|
331
|
+
void spawn(func callback);
|
|
332
|
+
}
|
|
333
|
+
`;
|
|
334
|
+
}
|
|
335
|
+
function generateClppHeaders(profile, includeRoot = node_path_1.default.join(package_info_js_1.projectRoot, "include", "clpp")) {
|
|
336
|
+
const files = [];
|
|
337
|
+
const enumsPath = node_path_1.default.join(includeRoot, "generated", "enums.clh");
|
|
338
|
+
const dtPath = node_path_1.default.join(includeRoot, "datatypes.clh");
|
|
339
|
+
const instPath = node_path_1.default.join(includeRoot, "generated", "instances.clh");
|
|
340
|
+
const umbrellaPath = node_path_1.default.join(includeRoot, "roblox.clh");
|
|
341
|
+
const apiJs = node_path_1.default.join(package_info_js_1.projectRoot, "src", "api.generated.js");
|
|
342
|
+
atomicWrite(enumsPath, generateEnums(profile.enums));
|
|
343
|
+
files.push(enumsPath);
|
|
344
|
+
atomicWrite(dtPath, generateDatatypes(profile));
|
|
345
|
+
files.push(dtPath);
|
|
346
|
+
atomicWrite(instPath, generateInstances(profile));
|
|
347
|
+
files.push(instPath);
|
|
348
|
+
atomicWrite(umbrellaPath, generateUmbrella());
|
|
349
|
+
files.push(umbrellaPath);
|
|
350
|
+
atomicWrite(apiJs, generateApiJs(profile));
|
|
351
|
+
files.push(apiJs);
|
|
352
|
+
return { files };
|
|
353
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateReferenceDocs = generateReferenceDocs;
|
|
4
|
+
function generateReferenceDocs(_profile, _outDir) {
|
|
5
|
+
// Intentionally a no-op — reuse-first: do not generate class/enum markdown mirrors.
|
|
6
|
+
return [];
|
|
7
|
+
}
|