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
package/src/api/model.ts
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/** Canonical Roblox API model for Cluaupp (RobloxTargetProfile schemaVersion 2). */
|
|
2
|
+
|
|
3
|
+
export const ROBLOX_TARGET_SCHEMA_VERSION = 2 as const;
|
|
4
|
+
|
|
5
|
+
export type CanonicalTypeKind =
|
|
6
|
+
| "Primitive"
|
|
7
|
+
| "Class"
|
|
8
|
+
| "Enum"
|
|
9
|
+
| "Datatype"
|
|
10
|
+
| "Array"
|
|
11
|
+
| "Dictionary"
|
|
12
|
+
| "Map"
|
|
13
|
+
| "Tuple"
|
|
14
|
+
| "Function"
|
|
15
|
+
| "Union"
|
|
16
|
+
| "Intersection"
|
|
17
|
+
| "Optional"
|
|
18
|
+
| "GenericParameter"
|
|
19
|
+
| "TypePack"
|
|
20
|
+
| "Singleton"
|
|
21
|
+
| "Unknown"
|
|
22
|
+
| "Any"
|
|
23
|
+
| "Never"
|
|
24
|
+
| "Buffer"
|
|
25
|
+
| "Vector"
|
|
26
|
+
| "Unsupported";
|
|
27
|
+
|
|
28
|
+
export type CanonicalType =
|
|
29
|
+
| { kind: "Primitive"; name: string }
|
|
30
|
+
| { kind: "Class"; name: string }
|
|
31
|
+
| { kind: "Enum"; name: string }
|
|
32
|
+
| { kind: "Datatype"; name: string }
|
|
33
|
+
| { kind: "Array"; element: CanonicalType }
|
|
34
|
+
| { kind: "Dictionary"; key: CanonicalType; value: CanonicalType }
|
|
35
|
+
| { kind: "Map"; key: CanonicalType; value: CanonicalType }
|
|
36
|
+
| { kind: "Tuple"; elements: CanonicalType[] }
|
|
37
|
+
| { kind: "Function"; parameters: CanonicalType[]; returns: CanonicalType[]; variadic?: boolean }
|
|
38
|
+
| { kind: "Union"; members: CanonicalType[] }
|
|
39
|
+
| { kind: "Intersection"; members: CanonicalType[] }
|
|
40
|
+
| { kind: "Optional"; inner: CanonicalType }
|
|
41
|
+
| { kind: "GenericParameter"; name: string }
|
|
42
|
+
| { kind: "TypePack"; name: string }
|
|
43
|
+
| { kind: "Singleton"; value: string | number | boolean }
|
|
44
|
+
| { kind: "Unknown" }
|
|
45
|
+
| { kind: "Any" }
|
|
46
|
+
| { kind: "Never" }
|
|
47
|
+
| { kind: "Buffer" }
|
|
48
|
+
| { kind: "Vector" }
|
|
49
|
+
| { kind: "Unsupported"; raw: string; reason: string };
|
|
50
|
+
|
|
51
|
+
export type DefaultKind = "Null" | "Boolean" | "Number" | "String" | "EnumItem" | "Literal" | "Unknown";
|
|
52
|
+
|
|
53
|
+
export interface ParameterDefinition {
|
|
54
|
+
name: string;
|
|
55
|
+
type: CanonicalType;
|
|
56
|
+
optional: boolean;
|
|
57
|
+
default?: string;
|
|
58
|
+
defaultKind?: DefaultKind;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type ThreadSafety = "Unsafe" | "ReadSafe" | "LocalSafe" | "Safe" | "Unknown";
|
|
62
|
+
|
|
63
|
+
export interface SecurityPair {
|
|
64
|
+
read?: string;
|
|
65
|
+
write?: string;
|
|
66
|
+
call?: string;
|
|
67
|
+
listen?: string;
|
|
68
|
+
create?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface DeprecationInfo {
|
|
72
|
+
deprecated: boolean;
|
|
73
|
+
message?: string;
|
|
74
|
+
replacement?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface PropertyDefinition {
|
|
78
|
+
name: string;
|
|
79
|
+
owner: string;
|
|
80
|
+
valueType: CanonicalType;
|
|
81
|
+
readable: boolean;
|
|
82
|
+
writable: boolean;
|
|
83
|
+
readSecurity?: string;
|
|
84
|
+
writeSecurity?: string;
|
|
85
|
+
/** Roblox Parallel Luau thread safety (from API dump). */
|
|
86
|
+
threadSafety?: ThreadSafety;
|
|
87
|
+
tags: string[];
|
|
88
|
+
defaultValue?: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
deprecated?: DeprecationInfo;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface MethodDefinition {
|
|
94
|
+
name: string;
|
|
95
|
+
owner: string;
|
|
96
|
+
overloadIndex: number;
|
|
97
|
+
parameters: ParameterDefinition[];
|
|
98
|
+
returnTypes: CanonicalType[];
|
|
99
|
+
canYield: boolean;
|
|
100
|
+
security?: string;
|
|
101
|
+
threadSafety?: ThreadSafety;
|
|
102
|
+
tags: string[];
|
|
103
|
+
deprecated?: DeprecationInfo;
|
|
104
|
+
description?: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface EventDefinition {
|
|
108
|
+
name: string;
|
|
109
|
+
owner: string;
|
|
110
|
+
parameters: ParameterDefinition[];
|
|
111
|
+
listenSecurity?: string;
|
|
112
|
+
threadSafety?: ThreadSafety;
|
|
113
|
+
tags: string[];
|
|
114
|
+
description?: string;
|
|
115
|
+
deprecated?: DeprecationInfo;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface CallbackDefinition {
|
|
119
|
+
name: string;
|
|
120
|
+
owner: string;
|
|
121
|
+
parameters: ParameterDefinition[];
|
|
122
|
+
returnTypes: CanonicalType[];
|
|
123
|
+
canYield: boolean;
|
|
124
|
+
security?: string;
|
|
125
|
+
threadSafety?: ThreadSafety;
|
|
126
|
+
tags: string[];
|
|
127
|
+
description?: string;
|
|
128
|
+
deprecated?: DeprecationInfo;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface ConstructorDefinition {
|
|
132
|
+
owner: string;
|
|
133
|
+
overloadIndex: number;
|
|
134
|
+
parameters: ParameterDefinition[];
|
|
135
|
+
tags: string[];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export type CreationKind = "creatable" | "service" | "abstract" | "pluginOnly" | "unknown";
|
|
139
|
+
|
|
140
|
+
export interface CreationPolicy {
|
|
141
|
+
kind: CreationKind;
|
|
142
|
+
creatable: boolean;
|
|
143
|
+
service: boolean;
|
|
144
|
+
abstract: boolean;
|
|
145
|
+
pluginOnly: boolean;
|
|
146
|
+
security?: string;
|
|
147
|
+
notes?: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface ClassDefinition {
|
|
151
|
+
name: string;
|
|
152
|
+
superclass: string | null;
|
|
153
|
+
subclasses: string[];
|
|
154
|
+
tags: string[];
|
|
155
|
+
description?: string;
|
|
156
|
+
deprecated?: DeprecationInfo;
|
|
157
|
+
security?: SecurityPair;
|
|
158
|
+
creatable: boolean;
|
|
159
|
+
service: boolean;
|
|
160
|
+
preferredParent?: string;
|
|
161
|
+
creation: CreationPolicy;
|
|
162
|
+
properties: PropertyDefinition[];
|
|
163
|
+
methods: MethodDefinition[];
|
|
164
|
+
events: EventDefinition[];
|
|
165
|
+
callbacks: CallbackDefinition[];
|
|
166
|
+
constructors: ConstructorDefinition[];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface EnumItemDefinition {
|
|
170
|
+
name: string;
|
|
171
|
+
numericValue: number;
|
|
172
|
+
description?: string;
|
|
173
|
+
tags: string[];
|
|
174
|
+
deprecated?: DeprecationInfo;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface EnumDefinition {
|
|
178
|
+
name: string;
|
|
179
|
+
description?: string;
|
|
180
|
+
items: EnumItemDefinition[];
|
|
181
|
+
tags: string[];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface DatatypeDefinition {
|
|
185
|
+
name: string;
|
|
186
|
+
summary?: string;
|
|
187
|
+
fields: Array<{ name: string; type: CanonicalType }>;
|
|
188
|
+
constructors: ConstructorDefinition[];
|
|
189
|
+
staticProperties: string[];
|
|
190
|
+
staticMethods: MethodDefinition[];
|
|
191
|
+
instanceMethods: MethodDefinition[];
|
|
192
|
+
source: "dump" | "override" | "inferred";
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface ServiceDefinition {
|
|
196
|
+
name: string;
|
|
197
|
+
className: string;
|
|
198
|
+
kind: "service";
|
|
199
|
+
accessor: string;
|
|
200
|
+
singleton: true;
|
|
201
|
+
type: CanonicalType;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface GlobalDefinition {
|
|
205
|
+
name: string;
|
|
206
|
+
type: CanonicalType;
|
|
207
|
+
layer: "luau-core" | "roblox-engine" | "cluaupp-runtime";
|
|
208
|
+
description?: string;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface LibraryDefinition {
|
|
212
|
+
name: string;
|
|
213
|
+
layer: "luau-core" | "roblox-engine" | "cluaupp-runtime";
|
|
214
|
+
bind?: string;
|
|
215
|
+
file?: string;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface UnsupportedRepresentation {
|
|
219
|
+
symbol: string;
|
|
220
|
+
source: string;
|
|
221
|
+
reason: string;
|
|
222
|
+
fallback: string;
|
|
223
|
+
severity: "error" | "warning" | "info";
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface SourceMeta {
|
|
227
|
+
id: string;
|
|
228
|
+
path?: string;
|
|
229
|
+
hash: string;
|
|
230
|
+
loadedAt: string;
|
|
231
|
+
version?: string | number;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export interface RobloxTargetProfile {
|
|
235
|
+
target: "roblox";
|
|
236
|
+
schemaVersion: typeof ROBLOX_TARGET_SCHEMA_VERSION;
|
|
237
|
+
robloxApiVersion?: string;
|
|
238
|
+
studioVersion?: string;
|
|
239
|
+
generatorVersion: string;
|
|
240
|
+
sources: Record<string, SourceMeta>;
|
|
241
|
+
classes: Record<string, ClassDefinition>;
|
|
242
|
+
enums: Record<string, EnumDefinition>;
|
|
243
|
+
datatypes: Record<string, DatatypeDefinition>;
|
|
244
|
+
globals: Record<string, GlobalDefinition>;
|
|
245
|
+
libraries: Record<string, LibraryDefinition>;
|
|
246
|
+
services: Record<string, ServiceDefinition>;
|
|
247
|
+
aliases: Record<string, string>;
|
|
248
|
+
constructors: Record<string, ConstructorDefinition[]>;
|
|
249
|
+
security: Record<string, SecurityPair>;
|
|
250
|
+
deprecations: Record<string, DeprecationInfo>;
|
|
251
|
+
unsupported: UnsupportedRepresentation[];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface OverrideEntry {
|
|
255
|
+
reason: string;
|
|
256
|
+
source: string;
|
|
257
|
+
introducedAt: string;
|
|
258
|
+
reviewAfter?: string;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export type DiffKind =
|
|
262
|
+
| "ADDED_CLASS"
|
|
263
|
+
| "REMOVED_CLASS"
|
|
264
|
+
| "CHANGED_SUPERCLASS"
|
|
265
|
+
| "ADDED_PROPERTY"
|
|
266
|
+
| "REMOVED_PROPERTY"
|
|
267
|
+
| "CHANGED_PROPERTY_TYPE"
|
|
268
|
+
| "ADDED_METHOD_OVERLOAD"
|
|
269
|
+
| "REMOVED_METHOD_OVERLOAD"
|
|
270
|
+
| "ADDED_EVENT"
|
|
271
|
+
| "CHANGED_EVENT_SIGNATURE"
|
|
272
|
+
| "ADDED_ENUM"
|
|
273
|
+
| "REMOVED_ENUM"
|
|
274
|
+
| "ADDED_ENUM_ITEM"
|
|
275
|
+
| "REMOVED_ENUM_ITEM"
|
|
276
|
+
| "DEPRECATED_MEMBER";
|
|
277
|
+
|
|
278
|
+
export interface ApiDiffEntry {
|
|
279
|
+
kind: DiffKind;
|
|
280
|
+
symbol: string;
|
|
281
|
+
oldValue?: string;
|
|
282
|
+
newValue?: string;
|
|
283
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CallbackDefinition,
|
|
3
|
+
CanonicalType,
|
|
4
|
+
ClassDefinition,
|
|
5
|
+
CreationPolicy,
|
|
6
|
+
EnumDefinition,
|
|
7
|
+
EventDefinition,
|
|
8
|
+
MethodDefinition,
|
|
9
|
+
ParameterDefinition,
|
|
10
|
+
PropertyDefinition,
|
|
11
|
+
ThreadSafety,
|
|
12
|
+
UnsupportedRepresentation,
|
|
13
|
+
} from "./model.js";
|
|
14
|
+
import { mapParameter, mapRobloxType } from "./resolver.js";
|
|
15
|
+
import type { MiniApiDump, MiniDumpClass, MiniDumpMember } from "./sources/mini-dump.js";
|
|
16
|
+
|
|
17
|
+
function tagsOf(member: MiniDumpMember | MiniDumpClass): string[] {
|
|
18
|
+
return Array.isArray(member.Tags)
|
|
19
|
+
? member.Tags.map((t) => (typeof t === "string" ? t : String((t as { PreferredDescriptorName?: string }).PreferredDescriptorName || JSON.stringify(t))))
|
|
20
|
+
: [];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function hasTag(tags: string[], tag: string): boolean {
|
|
24
|
+
return tags.some((t) => t.toLowerCase() === tag.toLowerCase());
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function securityString(sec: MiniDumpMember["Security"]): string | undefined {
|
|
28
|
+
if (!sec) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
if (typeof sec === "string") {
|
|
32
|
+
return sec;
|
|
33
|
+
}
|
|
34
|
+
return sec.Read || sec.Write;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function mapThreadSafety(raw: string | undefined): ThreadSafety | undefined {
|
|
38
|
+
if (!raw) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
switch (raw) {
|
|
42
|
+
case "Unsafe":
|
|
43
|
+
case "ReadSafe":
|
|
44
|
+
case "LocalSafe":
|
|
45
|
+
case "Safe":
|
|
46
|
+
return raw;
|
|
47
|
+
default:
|
|
48
|
+
return "Unknown";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function creationPolicy(tags: string[]): CreationPolicy {
|
|
53
|
+
const service = hasTag(tags, "Service");
|
|
54
|
+
const notCreatable = hasTag(tags, "NotCreatable");
|
|
55
|
+
const deprecated = hasTag(tags, "Deprecated");
|
|
56
|
+
const pluginOnly = hasTag(tags, "PluginSecurity") || hasTag(tags, "NotBrowsable");
|
|
57
|
+
return {
|
|
58
|
+
kind: service ? "service" : notCreatable ? "abstract" : "creatable",
|
|
59
|
+
creatable: !notCreatable && !service,
|
|
60
|
+
service,
|
|
61
|
+
abstract: notCreatable && !service,
|
|
62
|
+
pluginOnly,
|
|
63
|
+
notes: deprecated ? "deprecated" : undefined,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function parseParams(member: MiniDumpMember): ParameterDefinition[] {
|
|
68
|
+
return (member.Parameters || []).map((p, i) => mapParameter(p, i));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function returnTypes(member: MiniDumpMember): CanonicalType[] {
|
|
72
|
+
if (member.ReturnType) {
|
|
73
|
+
return [mapRobloxType(member.ReturnType)];
|
|
74
|
+
}
|
|
75
|
+
return [{ kind: "Primitive", name: "void" }];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function collectUnsupported(type: CanonicalType, symbol: string, unsupported: UnsupportedRepresentation[]): void {
|
|
79
|
+
if (type.kind === "Unsupported") {
|
|
80
|
+
unsupported.push({
|
|
81
|
+
symbol,
|
|
82
|
+
source: "mini-api-dump",
|
|
83
|
+
reason: type.reason,
|
|
84
|
+
fallback: "auto",
|
|
85
|
+
severity: "warning",
|
|
86
|
+
});
|
|
87
|
+
} else if (type.kind === "Optional") {
|
|
88
|
+
collectUnsupported(type.inner, symbol, unsupported);
|
|
89
|
+
} else if (type.kind === "Array") {
|
|
90
|
+
collectUnsupported(type.element, symbol, unsupported);
|
|
91
|
+
} else if (type.kind === "Dictionary" || type.kind === "Map") {
|
|
92
|
+
collectUnsupported(type.key, symbol, unsupported);
|
|
93
|
+
collectUnsupported(type.value, symbol, unsupported);
|
|
94
|
+
} else if (type.kind === "Union" || type.kind === "Intersection" || type.kind === "Tuple") {
|
|
95
|
+
const members = type.kind === "Tuple" ? type.elements : type.members;
|
|
96
|
+
for (const m of members) {
|
|
97
|
+
collectUnsupported(m, symbol, unsupported);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function normalizeClass(raw: MiniDumpClass, unsupported: UnsupportedRepresentation[]): ClassDefinition {
|
|
103
|
+
const tags = tagsOf(raw);
|
|
104
|
+
const creation = creationPolicy(tags);
|
|
105
|
+
const properties: PropertyDefinition[] = [];
|
|
106
|
+
const methods: MethodDefinition[] = [];
|
|
107
|
+
const events: EventDefinition[] = [];
|
|
108
|
+
const callbacks: CallbackDefinition[] = [];
|
|
109
|
+
const methodOverloads = new Map<string, number>();
|
|
110
|
+
|
|
111
|
+
for (const member of raw.Members || []) {
|
|
112
|
+
const mTags = tagsOf(member);
|
|
113
|
+
const deprecated = hasTag(mTags, "Deprecated")
|
|
114
|
+
? { deprecated: true as const, message: "Deprecated in Roblox API dump" }
|
|
115
|
+
: undefined;
|
|
116
|
+
const symbol = `${raw.Name}.${member.Name}`;
|
|
117
|
+
|
|
118
|
+
switch (member.MemberType) {
|
|
119
|
+
case "Property": {
|
|
120
|
+
const valueType = mapRobloxType(member.ValueType);
|
|
121
|
+
collectUnsupported(valueType, symbol, unsupported);
|
|
122
|
+
const sec = typeof member.Security === "object" ? member.Security : undefined;
|
|
123
|
+
properties.push({
|
|
124
|
+
name: member.Name,
|
|
125
|
+
owner: raw.Name,
|
|
126
|
+
valueType,
|
|
127
|
+
readable: !hasTag(mTags, "WriteOnly"),
|
|
128
|
+
writable: !hasTag(mTags, "ReadOnly"),
|
|
129
|
+
readSecurity: sec?.Read || (typeof member.Security === "string" ? member.Security : undefined),
|
|
130
|
+
writeSecurity: sec?.Write,
|
|
131
|
+
threadSafety: mapThreadSafety(member.ThreadSafety),
|
|
132
|
+
tags: mTags,
|
|
133
|
+
defaultValue: member.Default,
|
|
134
|
+
deprecated,
|
|
135
|
+
});
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case "Function":
|
|
139
|
+
case "Method": {
|
|
140
|
+
const idx = methodOverloads.get(member.Name) || 0;
|
|
141
|
+
methodOverloads.set(member.Name, idx + 1);
|
|
142
|
+
const parameters = parseParams(member);
|
|
143
|
+
const returns = returnTypes(member);
|
|
144
|
+
for (const p of parameters) {
|
|
145
|
+
collectUnsupported(p.type, `${symbol}(${p.name})`, unsupported);
|
|
146
|
+
}
|
|
147
|
+
for (const r of returns) {
|
|
148
|
+
collectUnsupported(r, `${symbol}:return`, unsupported);
|
|
149
|
+
}
|
|
150
|
+
methods.push({
|
|
151
|
+
name: member.Name,
|
|
152
|
+
owner: raw.Name,
|
|
153
|
+
overloadIndex: idx,
|
|
154
|
+
parameters,
|
|
155
|
+
returnTypes: returns,
|
|
156
|
+
canYield: hasTag(mTags, "Yields") || hasTag(mTags, "CanYield"),
|
|
157
|
+
security: securityString(member.Security),
|
|
158
|
+
threadSafety: mapThreadSafety(member.ThreadSafety),
|
|
159
|
+
tags: mTags,
|
|
160
|
+
deprecated,
|
|
161
|
+
});
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
case "Event": {
|
|
165
|
+
const parameters = parseParams(member);
|
|
166
|
+
for (const p of parameters) {
|
|
167
|
+
collectUnsupported(p.type, `${symbol}(${p.name})`, unsupported);
|
|
168
|
+
}
|
|
169
|
+
events.push({
|
|
170
|
+
name: member.Name,
|
|
171
|
+
owner: raw.Name,
|
|
172
|
+
parameters,
|
|
173
|
+
listenSecurity: securityString(member.Security),
|
|
174
|
+
threadSafety: mapThreadSafety(member.ThreadSafety),
|
|
175
|
+
tags: mTags,
|
|
176
|
+
deprecated,
|
|
177
|
+
});
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
case "Callback": {
|
|
181
|
+
const parameters = parseParams(member);
|
|
182
|
+
const returns = returnTypes(member);
|
|
183
|
+
callbacks.push({
|
|
184
|
+
name: member.Name,
|
|
185
|
+
owner: raw.Name,
|
|
186
|
+
parameters,
|
|
187
|
+
returnTypes: returns,
|
|
188
|
+
canYield: hasTag(mTags, "Yields"),
|
|
189
|
+
security: securityString(member.Security),
|
|
190
|
+
threadSafety: mapThreadSafety(member.ThreadSafety),
|
|
191
|
+
tags: mTags,
|
|
192
|
+
deprecated,
|
|
193
|
+
});
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
default:
|
|
197
|
+
unsupported.push({
|
|
198
|
+
symbol,
|
|
199
|
+
source: "mini-api-dump",
|
|
200
|
+
reason: `Unhandled MemberType ${member.MemberType}`,
|
|
201
|
+
fallback: "skip",
|
|
202
|
+
severity: "info",
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
name: raw.Name,
|
|
209
|
+
superclass: raw.Superclass && raw.Superclass !== "<<<ROOT>>>" ? raw.Superclass : null,
|
|
210
|
+
subclasses: [],
|
|
211
|
+
tags,
|
|
212
|
+
deprecated: hasTag(tags, "Deprecated") ? { deprecated: true } : undefined,
|
|
213
|
+
creatable: creation.creatable,
|
|
214
|
+
service: creation.service,
|
|
215
|
+
creation,
|
|
216
|
+
properties,
|
|
217
|
+
methods,
|
|
218
|
+
events,
|
|
219
|
+
callbacks,
|
|
220
|
+
constructors: [],
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export function normalizeMiniDump(dump: MiniApiDump): {
|
|
225
|
+
classes: Record<string, ClassDefinition>;
|
|
226
|
+
enums: Record<string, EnumDefinition>;
|
|
227
|
+
unsupported: UnsupportedRepresentation[];
|
|
228
|
+
} {
|
|
229
|
+
const unsupported: UnsupportedRepresentation[] = [];
|
|
230
|
+
const classes: Record<string, ClassDefinition> = {};
|
|
231
|
+
for (const raw of dump.Classes) {
|
|
232
|
+
classes[raw.Name] = normalizeClass(raw, unsupported);
|
|
233
|
+
}
|
|
234
|
+
for (const cls of Object.values(classes)) {
|
|
235
|
+
if (cls.superclass && classes[cls.superclass]) {
|
|
236
|
+
classes[cls.superclass].subclasses.push(cls.name);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
for (const cls of Object.values(classes)) {
|
|
240
|
+
cls.subclasses.sort();
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const enums: Record<string, EnumDefinition> = {};
|
|
244
|
+
for (const e of dump.Enums) {
|
|
245
|
+
enums[e.Name] = {
|
|
246
|
+
name: e.Name,
|
|
247
|
+
items: (e.Items || []).map((item) => ({
|
|
248
|
+
name: item.Name,
|
|
249
|
+
numericValue: item.Value,
|
|
250
|
+
tags: [],
|
|
251
|
+
})),
|
|
252
|
+
tags: [],
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return { classes, enums, unsupported };
|
|
257
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { projectRoot } from "../package-info.js";
|
|
4
|
+
import type { OverrideEntry } from "./model.js";
|
|
5
|
+
|
|
6
|
+
export interface OverrideValidationIssue {
|
|
7
|
+
file: string;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Validate override JSON files carry audit metadata. */
|
|
12
|
+
export function validateOverrides(): OverrideValidationIssue[] {
|
|
13
|
+
const dir = path.join(projectRoot, "api", "overrides");
|
|
14
|
+
const issues: OverrideValidationIssue[] = [];
|
|
15
|
+
if (!fs.existsSync(dir)) {
|
|
16
|
+
return [{ file: "api/overrides", message: "overrides directory missing" }];
|
|
17
|
+
}
|
|
18
|
+
for (const name of fs.readdirSync(dir).sort()) {
|
|
19
|
+
if (!name.endsWith(".json")) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const full = path.join(dir, name);
|
|
23
|
+
const parsed = JSON.parse(fs.readFileSync(full, "utf8")) as { _meta?: OverrideEntry };
|
|
24
|
+
if (!parsed._meta) {
|
|
25
|
+
issues.push({ file: name, message: "missing _meta" });
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
for (const key of ["reason", "source", "introducedAt"] as const) {
|
|
29
|
+
if (!parsed._meta[key]) {
|
|
30
|
+
issues.push({ file: name, message: `missing _meta.${key}` });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return issues;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function diffOverrideFiles(beforeDir: string, afterDir: string): string[] {
|
|
38
|
+
const before = new Set(fs.existsSync(beforeDir) ? fs.readdirSync(beforeDir).filter((f) => f.endsWith(".json")) : []);
|
|
39
|
+
const after = new Set(fs.existsSync(afterDir) ? fs.readdirSync(afterDir).filter((f) => f.endsWith(".json")) : []);
|
|
40
|
+
const changes: string[] = [];
|
|
41
|
+
for (const f of after) {
|
|
42
|
+
if (!before.has(f)) {
|
|
43
|
+
changes.push(`ADDED ${f}`);
|
|
44
|
+
} else {
|
|
45
|
+
const a = fs.readFileSync(path.join(beforeDir, f), "utf8");
|
|
46
|
+
const b = fs.readFileSync(path.join(afterDir, f), "utf8");
|
|
47
|
+
if (a !== b) {
|
|
48
|
+
changes.push(`CHANGED ${f}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for (const f of before) {
|
|
53
|
+
if (!after.has(f)) {
|
|
54
|
+
changes.push(`REMOVED ${f}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return changes;
|
|
58
|
+
}
|
package/src/api/perf.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Cold/warm timing helpers for API generate / LSP-ish lookups. */
|
|
2
|
+
export interface PerfSample {
|
|
3
|
+
label: string;
|
|
4
|
+
ms: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function timeCall<T>(label: string, fn: () => T): { value: T; sample: PerfSample } {
|
|
8
|
+
const started = Date.now();
|
|
9
|
+
const value = fn();
|
|
10
|
+
return { value, sample: { label, ms: Date.now() - started } };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function formatPerf(samples: PerfSample[]): string {
|
|
14
|
+
return samples.map((s) => `${s.label}=${s.ms}ms`).join(" ");
|
|
15
|
+
}
|