reforged-types 1.0.0-alpha.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/3.0.0/blizzard.j.d.ts +12135 -0
- package/3.0.0/common.ai.d.ts +5078 -0
- package/3.0.0/common.j.d.ts +26193 -0
- package/3.0.0.d.ts +9 -0
- package/LICENSE +22 -0
- package/README.md +91 -0
- package/async-natives.json +69 -0
- package/lua-runtime.d.ts +21 -0
- package/package.json +62 -0
package/3.0.0.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
// Generated by reforged-types: the entry of game version 3.0.0, Patch 3.0.0.24268.
|
|
3
|
+
// Source: jass-history tag Reforged-v3.0.0.24268-w3-3a9d8f2, commit a392fc3d5e6c37980accbfc560b28387fc7d01bc.
|
|
4
|
+
// Do not edit: curate the Overlay, then run `pnpm --filter reforged-types typings:generate`.
|
|
5
|
+
// common.ai is not referenced here: add `reforged-types/3.0.0/common.ai` to `types` to use it.
|
|
6
|
+
/// <reference types="lua-types/5.3" resolution-mode="require" />
|
|
7
|
+
/// <reference path="./lua-runtime.d.ts" />
|
|
8
|
+
/// <reference path="./3.0.0/common.j.d.ts" />
|
|
9
|
+
/// <reference path="./3.0.0/blizzard.j.d.ts" />
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 trigger
|
|
4
|
+
Copyright (c) 2026 Paulo H. A. Leite
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# reforged-types
|
|
2
|
+
|
|
3
|
+
TypeScript declarations for the Natives of Warcraft III Reforged, generated from the game's own Patch files, for map scripts compiled to Lua with [typescript-to-lua](https://typescripttolua.github.io/).
|
|
4
|
+
|
|
5
|
+
**Supported Patch: 3.0.0.24268** (Game version 3.0.0). The `reforged.patch` field of `package.json` carries the same Build.
|
|
6
|
+
|
|
7
|
+
<!-- The release's version step (release:version) stamps the docs version of each release into these links: docs/release.md. -->
|
|
8
|
+
|
|
9
|
+
**For AI agents:** the documentation of this version as Markdown: [llms.txt](https://phmilk.github.io/reforged-ts/docs/next/llms.txt) links each page, and [llms-full.txt](https://phmilk.github.io/reforged-ts/docs/next/llms-full.txt) holds them all in one file.
|
|
10
|
+
|
|
11
|
+
**Build phase.** Until 1.0.0, every version is an alpha (`1.0.0-alpha.N`) published under the `next` dist-tag. Install with `@next`: `pnpm add -D reforged-types@next`. npm gave `latest` to the first alpha, so `latest` stays on `1.0.0-alpha.0` until 1.0.0 is published, and moves to 1.0.0 then.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install --save-dev reforged-types@next
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Add the entry of your Game version to `types` in `tsconfig.json`, next to the typescript-to-lua language extensions:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"compilerOptions": {
|
|
24
|
+
"types": ["@typescript-to-lua/language-extensions", "reforged-types/3.0.0"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
That one line declares every `common.j` Native, type and global, the `Blizzard.j` functions and globals, the Lua runtime globals the game adds (`FourCC`, `__jarray`) and the Lua 5.3 standard library (through `lua-types`, a dependency of this package).
|
|
30
|
+
|
|
31
|
+
The AI Natives of `common.ai` are valid only in AI scripts, so the entry leaves them out. To opt in, add their file as well:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
"types": ["@typescript-to-lua/language-extensions", "reforged-types/3.0.0", "reforged-types/3.0.0/common.ai"]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
What the declarations give you:
|
|
38
|
+
|
|
39
|
+
- Handle types are branded interfaces that mirror the Patch hierarchy (`framehandle extends agent`), so a `timer` passed where a `unit` is expected is a compile error.
|
|
40
|
+
- A Native that can return nothing returns `T | undefined`; one the game guarantees returns `T`.
|
|
41
|
+
- Callbacks are typed with `this: void` and every file is `@noSelfInFile`, so typescript-to-lua emits plain Lua functions.
|
|
42
|
+
- Jass arrays (`bj_*` array globals) are `Record<number, T>`, indexed from 0 as in Jass.
|
|
43
|
+
- Each Native's hover shows its Jass types (`integer (32-bit)`, `real`), `@async` when its value is valid only for the local player, `@deprecated` with the reason, `@patch` for the Patch that added it, and a link to its reference page.
|
|
44
|
+
|
|
45
|
+
`async-natives.json` lists the Natives marked `@async`, for lint rules that read the same facts.
|
|
46
|
+
|
|
47
|
+
## The Overlay
|
|
48
|
+
|
|
49
|
+
The Patch files give names, parameters and types, but not whether a Native can return nothing, which Natives are async, or what is deprecated. The Overlay holds those facts: one hand-curated JSON file per Native and global (nullability of the return and of each parameter, async, deprecation, notes, the Patch that added it), kept in the [repository](https://github.com/phmilk/reforged-ts/tree/master/packages/reforged-types/overlay). The generator merges it with the Patch files and fails on any declaration without an entry, so every nullable type in these Typings is a reviewed decision. To correct one, change that Native's Overlay file in a pull request.
|
|
50
|
+
|
|
51
|
+
## Attribution
|
|
52
|
+
|
|
53
|
+
The Overlay was seeded with the nullability decisions of [war3-types-strict](https://github.com/TinkerWorX/war3-types-strict), used under its MIT license:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
MIT License
|
|
57
|
+
|
|
58
|
+
Copyright (c) 2021 Nikolaj Mariager
|
|
59
|
+
|
|
60
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
61
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
62
|
+
in the Software without restriction, including without limitation the rights
|
|
63
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
64
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
65
|
+
furnished to do so, subject to the following conditions:
|
|
66
|
+
|
|
67
|
+
The above copyright notice and this permission notice shall be included in all
|
|
68
|
+
copies or substantial portions of the Software.
|
|
69
|
+
|
|
70
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
71
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
72
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
73
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
74
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
75
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
76
|
+
SOFTWARE.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The Patch files are taken from [jass-history](https://github.com/Luashine/jass-history); the provenance file of each vendored Patch records the tag, commit and sha256 of every file.
|
|
80
|
+
|
|
81
|
+
## Legal position
|
|
82
|
+
|
|
83
|
+
The Typings are derived from Blizzard's Patch files, which the repository vendors as every community mirror does: Blizzard's EULA grants no right to redistribute them, and no enforcement against such mirrors has been found.
|
|
84
|
+
|
|
85
|
+
## Regenerating
|
|
86
|
+
|
|
87
|
+
From a clone of the repository, `pnpm --filter reforged-types typings:generate <jass-history tag>` vendors a Patch and regenerates; without a tag it regenerates from the vendored Patch files. The loop for a new Patch is in [`AGENTS.md`](https://github.com/phmilk/reforged-ts/blob/master/packages/reforged-types/AGENTS.md).
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
[
|
|
2
|
+
"BlzCameraGetCameraType",
|
|
3
|
+
"BlzFrameGetAlpha",
|
|
4
|
+
"BlzFrameGetChild",
|
|
5
|
+
"BlzFrameGetChildrenCount",
|
|
6
|
+
"BlzFrameGetEnable",
|
|
7
|
+
"BlzFrameGetHeight",
|
|
8
|
+
"BlzFrameGetParent",
|
|
9
|
+
"BlzFrameGetText",
|
|
10
|
+
"BlzFrameGetValue",
|
|
11
|
+
"BlzFrameGetWidth",
|
|
12
|
+
"BlzFrameIsVisible",
|
|
13
|
+
"BlzFrameToPixelX",
|
|
14
|
+
"BlzFrameToPixelY",
|
|
15
|
+
"BlzGetAbilityActivatedExtendedTooltip",
|
|
16
|
+
"BlzGetAbilityActivatedTooltip",
|
|
17
|
+
"BlzGetAbilityExtendedTooltip",
|
|
18
|
+
"BlzGetAbilityResearchExtendedTooltip",
|
|
19
|
+
"BlzGetAbilityResearchTooltip",
|
|
20
|
+
"BlzGetAbilityTooltip",
|
|
21
|
+
"BlzGetItemDescription",
|
|
22
|
+
"BlzGetItemExtendedTooltip",
|
|
23
|
+
"BlzGetItemTooltip",
|
|
24
|
+
"BlzGetLocalClientHeight",
|
|
25
|
+
"BlzGetLocalClientWidth",
|
|
26
|
+
"BlzGetLocalSpecialEffectX",
|
|
27
|
+
"BlzGetLocalSpecialEffectY",
|
|
28
|
+
"BlzGetLocalSpecialEffectZ",
|
|
29
|
+
"BlzGetLocalUnitZ",
|
|
30
|
+
"BlzGetLocale",
|
|
31
|
+
"BlzGetMouseFocusUnit",
|
|
32
|
+
"BlzGetMouseScreenPosX",
|
|
33
|
+
"BlzGetMouseScreenPosY",
|
|
34
|
+
"BlzGetUnitZ",
|
|
35
|
+
"BlzIsKeyPressed",
|
|
36
|
+
"BlzIsLocalClientActive",
|
|
37
|
+
"BlzIsMetaKeyPressed",
|
|
38
|
+
"BlzIsMouseButtonPressed",
|
|
39
|
+
"BlzPixelToFrameX",
|
|
40
|
+
"BlzPixelToFrameY",
|
|
41
|
+
"GetAllyColorFilterState",
|
|
42
|
+
"GetCameraBoundMaxX",
|
|
43
|
+
"GetCameraBoundMaxY",
|
|
44
|
+
"GetCameraBoundMinX",
|
|
45
|
+
"GetCameraBoundMinY",
|
|
46
|
+
"GetCameraEyePositionLoc",
|
|
47
|
+
"GetCameraEyePositionX",
|
|
48
|
+
"GetCameraEyePositionY",
|
|
49
|
+
"GetCameraEyePositionZ",
|
|
50
|
+
"GetCameraField",
|
|
51
|
+
"GetCameraFieldControlledByInput",
|
|
52
|
+
"GetCameraTargetPositionLoc",
|
|
53
|
+
"GetCameraTargetPositionX",
|
|
54
|
+
"GetCameraTargetPositionY",
|
|
55
|
+
"GetCameraTargetPositionZ",
|
|
56
|
+
"GetCreepCampFilterState",
|
|
57
|
+
"GetDestructableName",
|
|
58
|
+
"GetItemName",
|
|
59
|
+
"GetLocalPlayer",
|
|
60
|
+
"GetLocalizedHotkey",
|
|
61
|
+
"GetLocalizedString",
|
|
62
|
+
"GetLocationZ",
|
|
63
|
+
"GetObjectName",
|
|
64
|
+
"GetSoundDuration",
|
|
65
|
+
"GetSoundFileDuration",
|
|
66
|
+
"GetSoundIsPlaying",
|
|
67
|
+
"GetUnitName",
|
|
68
|
+
"IsMultiboardMinimized"
|
|
69
|
+
]
|
package/lua-runtime.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
// Hand-written: the globals the Warcraft III Lua runtime defines besides the
|
|
3
|
+
// Natives and the Lua 5.3 standard library, limited to what the probe map
|
|
4
|
+
// confirmed (#9) and the library needs. TypeDefine is left out until its
|
|
5
|
+
// signature is established.
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The integer id of a four-character rawcode, as the Natives take it.
|
|
9
|
+
*
|
|
10
|
+
* @param id - four-character rawcode, such as `"hfoo"`
|
|
11
|
+
* @returns integer (32-bit)
|
|
12
|
+
*/
|
|
13
|
+
declare function FourCC(id: string): number;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A table whose missing keys read as `defaultValue`: the Lua form of a Jass
|
|
17
|
+
* array, as the World Editor emits it for GUI variables.
|
|
18
|
+
*
|
|
19
|
+
* @param defaultValue - the value of every index not yet written
|
|
20
|
+
*/
|
|
21
|
+
declare function __jarray<T>(defaultValue: T): Record<number, T>;
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "reforged-types",
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
|
+
"description": "TypeScript declarations for the Warcraft III Reforged natives, generated from the game's Patch files.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"warcraft",
|
|
9
|
+
"wc3",
|
|
10
|
+
"reforged",
|
|
11
|
+
"typescript-to-lua"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://phmilk.github.io/reforged-ts",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/phmilk/reforged-ts.git",
|
|
17
|
+
"directory": "packages/reforged-types"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/phmilk/reforged-ts/issues"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=22.13"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"reforged": {
|
|
29
|
+
"patch": "3.0.0.24268"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"/[0-9]*.d.ts",
|
|
33
|
+
"/[0-9]*/*.d.ts",
|
|
34
|
+
"/lua-runtime.d.ts",
|
|
35
|
+
"/async-natives.json",
|
|
36
|
+
"/LICENSE",
|
|
37
|
+
"/README.md"
|
|
38
|
+
],
|
|
39
|
+
"sideEffects": false,
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"lua-types": "^2.14.1"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@typescript-to-lua/language-extensions": "^1.19.0",
|
|
45
|
+
"@types/node": "^24.0.0",
|
|
46
|
+
"typescript": "6.0.2",
|
|
47
|
+
"typescript-to-lua": "^1.37.1",
|
|
48
|
+
"vitest": "^5.0.1"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsc -p tsconfig.json && pnpm run typings:typecheck && pnpm run scripts:typecheck",
|
|
52
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && pnpm run typings:typecheck && pnpm run scripts:typecheck",
|
|
53
|
+
"typings:typecheck": "tsc -p tsconfig.typings.json",
|
|
54
|
+
"scripts:typecheck": "tsc -p tsconfig.scripts.json",
|
|
55
|
+
"test": "vitest run --root ../.. --project reforged-types && pnpm run typings:check",
|
|
56
|
+
"vendor": "node build/cli/vendor.js",
|
|
57
|
+
"verify": "node build/cli/verify.js",
|
|
58
|
+
"typings:generate": "tsc -p tsconfig.json && node build/cli/generate.js",
|
|
59
|
+
"typings:check": "tsc -p tsconfig.json && node build/cli/check.js",
|
|
60
|
+
"seed:war3-types-strict": "node --experimental-strip-types scripts/seed-from-war3-types-strict.ts"
|
|
61
|
+
}
|
|
62
|
+
}
|