xray16 1.3.4 → 1.5.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.
Files changed (84) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +112 -106
  3. package/package.json +45 -42
  4. package/plugins/built_at_info.d.ts +1 -1
  5. package/plugins/from_cast_utils.d.ts +1 -1
  6. package/plugins/global_declarations_transform.d.ts +1 -1
  7. package/plugins/inject_file_meta.d.ts +1 -1
  8. package/plugins/inject_tracy_zones.d.ts +1 -1
  9. package/plugins/inject_tracy_zones.js +2 -2
  10. package/plugins/strip_lua_logger.d.ts +1 -1
  11. package/plugins/strip_lua_logger.js +1 -1
  12. package/plugins/transform_luabind_class/plugin.d.ts +1 -1
  13. package/plugins/transform_luabind_class/transformation/class_declaration.d.ts +3 -3
  14. package/plugins/transform_luabind_class/transformation/decorators.d.ts +5 -2
  15. package/plugins/transform_luabind_class/transformation/decorators.js +3 -0
  16. package/plugins/transform_luabind_class/transformation/members/accessors.d.ts +1 -1
  17. package/plugins/transform_luabind_class/transformation/members/constructor.d.ts +2 -2
  18. package/plugins/transform_luabind_class/transformation/members/constructor.js +2 -2
  19. package/plugins/transform_luabind_class/transformation/members/fields.d.ts +5 -2
  20. package/plugins/transform_luabind_class/transformation/members/fields.js +5 -2
  21. package/plugins/transform_luabind_class/transformation/members/method.d.ts +6 -3
  22. package/plugins/transform_luabind_class/transformation/members/method.js +4 -1
  23. package/plugins/transform_luabind_class/transformation/new.d.ts +7 -3
  24. package/plugins/transform_luabind_class/transformation/new.js +5 -1
  25. package/plugins/transform_luabind_class/transformation/setup.d.ts +9 -3
  26. package/plugins/transform_luabind_class/transformation/setup.js +22 -6
  27. package/plugins/transform_luabind_class/transformation/super.d.ts +19 -3
  28. package/plugins/transform_luabind_class/transformation/super.js +17 -1
  29. package/plugins/transform_luabind_class/transformation/utils.d.ts +27 -4
  30. package/plugins/transform_luabind_class/transformation/utils.js +25 -2
  31. package/plugins/utils/ast.d.ts +1 -1
  32. package/plugins/utils/diagnostics.d.ts +9 -5
  33. package/plugins/utils/diagnostics.js +5 -1
  34. package/plugins/utils/tracy.d.ts +1 -1
  35. package/types/index.d.ts +55 -55
  36. package/types/xr_ai/xr_action.d.ts +1802 -510
  37. package/types/xr_ai/xr_alife.d.ts +1870 -566
  38. package/types/xr_ai/xr_enemy_evaluation.d.ts +134 -41
  39. package/types/xr_ai/xr_goap.d.ts +1116 -668
  40. package/types/xr_ai/xr_graph.d.ts +135 -47
  41. package/types/xr_ai/xr_memory.d.ts +382 -148
  42. package/types/xr_lib/xr_animation.d.ts +252 -81
  43. package/types/xr_lib/xr_bitwise.d.ts +44 -21
  44. package/types/xr_lib/xr_color.d.ts +142 -40
  45. package/types/xr_lib/xr_debug.d.ts +181 -77
  46. package/types/xr_lib/xr_dialog.d.ts +132 -40
  47. package/types/xr_lib/xr_flags.d.ts +592 -148
  48. package/types/xr_lib/xr_fs.d.ts +539 -148
  49. package/types/xr_lib/xr_game.d.ts +362 -158
  50. package/types/xr_lib/xr_hit.d.ts +125 -41
  51. package/types/xr_lib/xr_ini.d.ts +473 -188
  52. package/types/xr_lib/xr_level.d.ts +795 -225
  53. package/types/xr_lib/xr_luabind.d.ts +90 -59
  54. package/types/xr_lib/xr_map.d.ts +192 -61
  55. package/types/xr_lib/xr_math.d.ts +871 -233
  56. package/types/xr_lib/xr_multiplayer.d.ts +1079 -351
  57. package/types/xr_lib/xr_profile.d.ts +272 -160
  58. package/types/xr_lib/xr_properties.d.ts +610 -166
  59. package/types/xr_lib/xr_relation.d.ts +231 -84
  60. package/types/xr_lib/xr_render.d.ts +167 -69
  61. package/types/xr_lib/xr_save.d.ts +833 -223
  62. package/types/xr_lib/xr_sound.d.ts +515 -151
  63. package/types/xr_lib/xr_stats.ts +49 -20
  64. package/types/xr_lib/xr_task.d.ts +388 -111
  65. package/types/xr_lib/xr_time.d.ts +177 -61
  66. package/types/xr_lib/xr_type.d.ts +75 -75
  67. package/types/xr_object/client/xr_anomaly.d.ts +70 -50
  68. package/types/xr_object/client/xr_artefact.d.ts +153 -98
  69. package/types/xr_object/client/xr_client_object.d.ts +207 -76
  70. package/types/xr_object/client/xr_creature.d.ts +243 -164
  71. package/types/xr_object/client/xr_item.d.ts +370 -264
  72. package/types/xr_object/client/xr_level.d.ts +753 -285
  73. package/types/xr_object/client/xr_physic.d.ts +644 -214
  74. package/types/xr_object/client/xr_zone.d.ts +85 -47
  75. package/types/xr_object/script/xr_script_interface.d.ts +819 -584
  76. package/types/xr_object/script/xr_script_object.d.ts +5728 -1390
  77. package/types/xr_object/script/xr_script_trade.d.ts +51 -26
  78. package/types/xr_object/server/xr_server_object.d.ts +1486 -792
  79. package/types/xr_ui/xr_ui_asset.d.ts +364 -123
  80. package/types/xr_ui/xr_ui_core.d.ts +424 -97
  81. package/types/xr_ui/xr_ui_event.d.ts +1449 -381
  82. package/types/xr_ui/xr_ui_interface.d.ts +2447 -903
  83. package/types/xr_ui/xr_ui_menu.d.ts +385 -142
  84. package/types/xrf_plugin.d.ts +89 -51
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 stalker-xrts
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 stalker-xrts
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,106 +1,112 @@
1
- # [📡 XRay-16 engine typescript definitions](https://github.com/xray-forge/xray-16-types)
2
-
3
- [![types](https://img.shields.io/badge/docs-types-blue.svg?style=flat)](https://xray-forge.github.io/xray-16-types/index.html)
4
- [![book](https://img.shields.io/badge/docs-book-blue.svg?style=flat)](https://xray-forge.github.io/stalker-xrf-book)
5
- <br/>
6
- [![Node.js CI](https://github.com/xray-forge/xray-16-types/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/xray-forge/xray-16-types/actions/workflows/build_and_test.yml)
7
-
8
- X-Ray16 engine bindings documentation and types. <br/>
9
- For usage with [TypeScriptToLua](https://typescripttolua.github.io/docs/getting-started).
10
-
11
- <p>
12
- Module contains xray engine globals typedefs for typescript. <br/>
13
- By default x-ray export many bindings that can be used from lua scripts, but without game API documentation.
14
-
15
- To check more details / correct typing you always can reference X-Ray source code.
16
-
17
- </p>
18
-
19
- ## 🗻 Docs
20
-
21
- Types documentation can be checked [here](https://xray-forge.github.io/xray-16-types/modules.html).
22
-
23
- ## 🧱 Usage
24
-
25
- Types are used with [xrf template](https://github.com/xray-forge/stalker-xrf-engine) and can be referenced as an example.
26
-
27
- ## 🎮 Updating types
28
-
29
- For easier navigation over codebase and typing following rules are applied:
30
-
31
- - Type declaration should have \@source docblock with matching c++ counterpart signature
32
- - Variable and class namings follow c++ conventions for easier binding and matching engine codebase
33
- - XRay types should be prefixed with IXR or TXR if they do not have runtime representation
34
-
35
- ## 📦Extending C++ classes and overriding virtual methods
36
-
37
- ### Lua
38
-
39
- <p>
40
- C++ classes can be extended in Lua code with 'class' keyword.
41
- Class declaration registers table as userdata and adds constructor/destructor metamethods. <br/>
42
- </p>
43
-
44
- ### Typescript
45
-
46
- <p>
47
- In TS codebase 'LuabindClass' decorator can be used to modify transformation and enable virtual calls. <br/>
48
- Separate transformer is needed to build luabind classes instead of table-based classes.
49
- </p>
50
-
51
- ## 🧱 Getting up-to-date LUA bindings
52
-
53
- - Run game engine with `-dump_bindings` flag
54
- - Check userdata folder _(where game saves are stored)_ `scriptbindings_*.txt` files
55
-
56
- ## 🧲 References
57
-
58
- - X-Ray C++ source code
59
- - LuaBind sources and docs
60
- - LuaJit sources and docs
61
-
62
- ## 🧱 Plugins
63
-
64
- Package includes plugins for typescript-to-lua for easier work with xray16 typings. <br/>
65
- Following ones are available:
66
-
67
- - transform_luabind_class - transforms LuaBind decorated classes in a specific way
68
- - built_at_info - adds build information in resulting files
69
- - from_cast_utils - additional utils that should be removed in runtime
70
- - global_declarations_transform - transforms xray16 imports and removes them from runtime
71
- - inject_filename - adds $filename global variable to access current file name
72
- - strip_lua_logger - removes lua logger from runtime (if path param is provided or ENV variable is set)
73
- - inject_tracy_zones - removes lua logger from runtime (if path param is provided or ENV variable is set)
74
-
75
- Path params:
76
-
77
- - `--no-lua-logs`
78
- - `--inject-tracy-zones`
79
-
80
- Env variables:
81
-
82
- - `XR_NO_LUA_LOGS `
83
- - `XR_INJECT_TRACY_ZONES `
84
-
85
- export const IS_LUA_LOGGER_DISABLED: boolean = process.argv.includes("--no-lua-logs")
86
- || process.env.NO_LUA_LOGS === "true";
87
- export const IS_TRACY_ZONES_INJECTION_ENABLED: boolean = process.argv.includes("--inject-tracy-zones")
88
- || process.env.INJECT_TRACY_ZONES === "true";
89
-
90
- Plugins can be included in tsconfig file as following:
91
-
92
- ```json
93
- {
94
- "tstl": {
95
- "luaPlugins": [
96
- { "name": "xray16/plugins/transform_luabind_class/plugin" },
97
- { "name": "xray16/plugins/global_declarations_transform" },
98
- { "name": "xray16/plugins/built_at_info" },
99
- { "name": "xray16/plugins/strip_lua_logger" },
100
- { "name": "xray16/plugins/inject_filename" },
101
- { "name": "xray16/plugins/from_cast_utils" },
102
- { "name": "xray16/plugins/inject_tracy_zones" }
103
- ]
104
- }
105
- }
106
- ```
1
+ # [📡 XRay-16 engine typescript definitions](https://github.com/xray-forge/xray-16-types)
2
+
3
+ [![types](https://img.shields.io/badge/docs-types-blue.svg?style=flat)](https://xray-forge.github.io/xray-16-types/index.html)
4
+ [![book](https://img.shields.io/badge/docs-book-blue.svg?style=flat)](https://xray-forge.github.io/stalker-xrf-book)
5
+ <br/>
6
+ [![Node.js CI](https://github.com/xray-forge/xray-16-types/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/xray-forge/xray-16-types/actions/workflows/build_and_test.yml)
7
+
8
+ X-Ray16 engine bindings documentation and types. <br/>
9
+ For usage with [TypeScriptToLua](https://typescripttolua.github.io/docs/getting-started).
10
+
11
+ <p>
12
+ Module contains xray engine globals typedefs for typescript. <br/>
13
+ By default x-ray export bindings that can be accessed from lua scripts, but without any API documentation.
14
+
15
+ To check more details / correct typing you always can reference X-Ray source code.
16
+
17
+ </p>
18
+
19
+ ## 🗻 Docs
20
+
21
+ Types documentation can be checked [here](https://xray-forge.github.io/xray-16-types/modules.html).
22
+
23
+ ## 🧱 Usage
24
+
25
+ Types are used with [xrf template](https://github.com/xray-forge/stalker-xrf-engine) and can be referenced as an example.
26
+
27
+ ## 📦Extending C++ classes and overriding virtual methods
28
+
29
+ ### Lua
30
+
31
+ <p>
32
+ C++ classes can be extended in Lua code with 'class' keyword.
33
+ Class declaration registers table as userdata and adds constructor/destructor metamethods. <br/>
34
+ </p>
35
+
36
+ ### Typescript
37
+
38
+ <p>
39
+ In TS codebase 'LuabindClass' decorator can be used to modify transformation and enable virtual calls. <br/>
40
+ Separate transformer is needed to build luabind classes instead of table-based classes.
41
+ </p>
42
+
43
+ ## 🧱 Getting up-to-date LUA bindings
44
+
45
+ - Run game engine with `-dump_bindings` flag
46
+ - Check userdata folder _(where game saves are stored)_ `scriptbindings_*.txt` files
47
+
48
+ ## 🧲 Plugins
49
+
50
+ Package includes plugins for typescript-to-lua for easier work with xray16 typings.\
51
+ Plugins can be included in [tstl tsconfig](https://typescripttolua.github.io/docs/configuration) file as following section:
52
+
53
+ ```json
54
+ {
55
+ "tstl": {
56
+ "luaPlugins": [
57
+ { "name": "xray16/plugins/transform_luabind_class/plugin" },
58
+ { "name": "xray16/plugins/global_declarations_transform" },
59
+ { "name": "xray16/plugins/built_at_info" },
60
+ { "name": "xray16/plugins/strip_lua_logger" },
61
+ { "name": "xray16/plugins/inject_filename" },
62
+ { "name": "xray16/plugins/from_cast_utils" },
63
+ { "name": "xray16/plugins/inject_tracy_zones" }
64
+ ]
65
+ }
66
+ }
67
+ ```
68
+
69
+ Arguments for TSTL:
70
+
71
+ - `--no-lua-logs`
72
+ - `--inject-tracy-zones`
73
+
74
+ Env variables for custom CLI scripts:
75
+
76
+ - `XR_NO_LUA_LOGS`
77
+ - `XR_INJECT_TRACY_ZONES `
78
+
79
+ ### transform_luabind_class
80
+
81
+ Custom plugin overriding transformation of classes marked with `@LuaClass` decorator.\
82
+ Instead of using prototypes and metatables use luabind API to declare such classes.\
83
+
84
+ ### built_at_info
85
+
86
+ Plugin injecting time and generic metadata on top of built lua scripts.
87
+
88
+ ### global_declarations_transform
89
+
90
+ Plugin stripping all the runtime imports from `xray16` package.
91
+ Default `tstl` behaviour does not work well with engine imports and I tried to avoid implicit globals.
92
+
93
+ ### strip_lua_logger
94
+
95
+ Plugin to strip all `LuaLogger` calls from runtime if env variable is set or path param is provided.\
96
+ Logger can consume a lot of processing time that does not benefit player.
97
+
98
+ ### inject_filename
99
+
100
+ Plugin adding `$filename` global variable replaced with actual file name on build time.\
101
+ Lua does not provide convenient API do get filename in runtime and static step is much simpler.
102
+
103
+ ### from_cast_utils
104
+
105
+ Plugin to simplify casting from `LuaTable` to typescript array/map objects.\
106
+ All the calls are completely gets stripped and removed from runtime.
107
+
108
+ ### from_cast_utils
109
+
110
+ Plugin designed to work specifically with [tracy profiler](https://github.com/wolfpld/tracy).\
111
+ Once it is enabled with env variable or path parameter, tracy zone marking calls are injected for every method.\
112
+ This way you will be able to build profiling bundle to understand bottlenecks and what takes CPU time.
package/package.json CHANGED
@@ -1,42 +1,45 @@
1
- {
2
- "name": "xray16",
3
- "version": "1.3.4",
4
- "author": "Neloreck",
5
- "repository": "https://github.com/stalker-xrts/xray-16-types",
6
- "private": false,
7
- "main": "types/index.d.ts",
8
- "types": "types/index.d.ts",
9
- "scripts": {
10
- "prepublish": "npm run build:plugins",
11
- "build:plugins": "tsc -p ./src/tsconfig.json",
12
- "build:types": "typedoc",
13
- "typecheck": "tsc --noEmit",
14
- "typedoc": "typedoc",
15
- "format": "prettier --write \"**/*.(js|ts|tsx|md)\" && eslint . --ext .ts,.tsx,.js --fix",
16
- "lint": "eslint . --ext .ts,.tsx,.js"
17
- },
18
- "peerDependencies": {
19
- "typescript-to-lua": "^1.28.1"
20
- },
21
- "devDependencies": {
22
- "@types/node": "22.10.2",
23
- "@typescript-eslint/eslint-plugin": "^5.54.0",
24
- "@typescript-eslint/parser": "^5.54.0",
25
- "@typescript-to-lua/language-extensions": "1.0.0",
26
- "eslint": "^8.49.0",
27
- "eslint-config-standard-with-typescript": "^34.0.0",
28
- "eslint-plugin-import": "^2.28.1",
29
- "eslint-plugin-jest": "^27.2.1",
30
- "eslint-plugin-jsdoc": "^46.8.0",
31
- "eslint-plugin-sort-keys-fix": "^1.1.2",
32
- "prettier": "^3.4.2",
33
- "typedoc": "^0.27.5",
34
- "typescript": "^5.7.2"
35
- },
36
- "files": [
37
- "plugins/**/*",
38
- "types/**/*",
39
- "README.md",
40
- "LICENSE"
41
- ]
42
- }
1
+ {
2
+ "name": "xray16",
3
+ "version": "1.5.0",
4
+ "author": "Neloreck",
5
+ "repository": "https://github.com/xray-forge/xray-16-types",
6
+ "private": false,
7
+ "main": "types/index.d.ts",
8
+ "types": "types/index.d.ts",
9
+ "scripts": {
10
+ "prepublish": "npm run build:plugins",
11
+ "build:plugins": "tsc -p ./src/tsconfig.json",
12
+ "build:types": "typedoc",
13
+ "typecheck": "tsc --noEmit",
14
+ "typedoc": "typedoc",
15
+ "format": "prettier --write \"**/*.(js|ts|tsx|md)\" && eslint . --fix",
16
+ "lint": "eslint ."
17
+ },
18
+ "peerDependencies": {
19
+ "typescript-to-lua": "^1.28.1"
20
+ },
21
+ "devDependencies": {
22
+ "@eslint/js": "^9.39.4",
23
+ "@types/node": "22.10.2",
24
+ "@typescript-eslint/eslint-plugin": "^8.62.0",
25
+ "@typescript-eslint/parser": "^8.62.0",
26
+ "@typescript-to-lua/language-extensions": "1.0.0",
27
+ "eslint": "^9.39.4",
28
+ "eslint-config-prettier": "^10.1.8",
29
+ "eslint-plugin-import": "^2.32.0",
30
+ "eslint-plugin-jest": "^29.15.2",
31
+ "eslint-plugin-jsdoc": "^63.0.7",
32
+ "globals": "^17.7.0",
33
+ "prettier": "^3.4.2",
34
+ "typedoc": "^0.27.5",
35
+ "typescript": "5.7.2",
36
+ "typescript-eslint": "^8.62.0",
37
+ "typescript-to-lua": "1.28.1"
38
+ },
39
+ "files": [
40
+ "plugins/**/*",
41
+ "types/**/*",
42
+ "README.md",
43
+ "LICENSE"
44
+ ]
45
+ }
@@ -1,3 +1,3 @@
1
- import { Plugin } from "typescript-to-lua";
1
+ import { type Plugin } from "typescript-to-lua";
2
2
  declare const plugin: Plugin;
3
3
  export default plugin;
@@ -1,4 +1,4 @@
1
- import { Plugin } from "typescript-to-lua";
1
+ import { type Plugin } from "typescript-to-lua";
2
2
  /**
3
3
  * Plugin for transformation of casting methods.
4
4
  * Simplifies TS/Lua testing and interoperation.
@@ -1,4 +1,4 @@
1
- import { Plugin } from "typescript-to-lua";
1
+ import { type Plugin } from "typescript-to-lua";
2
2
  /**
3
3
  * Plugin that removes imports from 'global' libraries like engine typedefs.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { Plugin } from "typescript-to-lua";
1
+ import { type Plugin } from "typescript-to-lua";
2
2
  /**
3
3
  * Plugin that injects FILE_NAME in compile-time.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { Plugin } from "typescript-to-lua";
1
+ import { type Plugin } from "typescript-to-lua";
2
2
  /**
3
3
  * Plugin that injects FILE_NAME in compile-time.
4
4
  */
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const path = require("path");
4
4
  const typescript_1 = require("typescript");
5
- const tracy_1 = require("./utils/tracy");
5
+ const sourceFile_1 = require("typescript-to-lua/dist/transformation/visitors/sourceFile");
6
6
  const ast_1 = require("./utils/ast");
7
7
  const environment_1 = require("./utils/environment");
8
- const sourceFile_1 = require("typescript-to-lua/dist/transformation/visitors/sourceFile");
8
+ const tracy_1 = require("./utils/tracy");
9
9
  /**
10
10
  * Plugin that injects FILE_NAME in compile-time.
11
11
  */
@@ -1,4 +1,4 @@
1
- import { Plugin } from "typescript-to-lua";
1
+ import { type Plugin } from "typescript-to-lua";
2
2
  /**
3
3
  * Plugin that removes all LuaLogger instance creations and calls when possible.
4
4
  */
@@ -17,7 +17,7 @@ const plugin = {
17
17
  const checker = context.program.getTypeChecker();
18
18
  const typeSymbol = checker.getTypeAtLocation(it);
19
19
  if (typeSymbol.symbol?.name === LUA_LOGGER_STRIP_TARGET) {
20
- // nothing
20
+ // Nothing
21
21
  }
22
22
  else {
23
23
  nodes.push(it);
@@ -1,4 +1,4 @@
1
- import { Plugin } from "typescript-to-lua";
1
+ import { type Plugin } from "typescript-to-lua";
2
2
  /**
3
3
  * Plugin that transform TS classes marked with decorator to luabind class declaration.
4
4
  */
@@ -1,6 +1,6 @@
1
- import { ClassLikeDeclaration, ExpressionWithTypeArguments } from "typescript";
1
+ import { type ClassLikeDeclaration, type ExpressionWithTypeArguments } from "typescript";
2
2
  import * as tstl from "typescript-to-lua";
3
- import { TransformationContext } from "typescript-to-lua";
3
+ import { type TransformationContext } from "typescript-to-lua";
4
4
  export interface ITransformationContext extends TransformationContext {
5
5
  classSuperInfos: Array<ClassSuperInfo>;
6
6
  }
@@ -13,6 +13,6 @@ export interface ClassSuperInfo {
13
13
  extendedTypeNode?: ExpressionWithTypeArguments;
14
14
  }
15
15
  export declare function transformClassLikeDeclaration(classDeclaration: ClassLikeDeclaration, context: ITransformationContext, nameOverride?: tstl.Identifier): {
16
- statements: tstl.Statement[];
16
+ statements: Array<tstl.Statement>;
17
17
  name: tstl.Identifier;
18
18
  };
@@ -1,6 +1,9 @@
1
- import { Decorator } from "typescript";
2
- import { TransformationContext } from "typescript-to-lua";
1
+ import { type Decorator } from "typescript";
2
+ import { type TransformationContext } from "typescript-to-lua";
3
3
  /**
4
4
  * Transform decorator call expressions for luabind class.
5
+ *
6
+ * @param context - Active transformation context.
7
+ * @param decorator - Class decorator to validate.
5
8
  */
6
9
  export declare function checkLuabindClassDecoratorExpression(context: TransformationContext, decorator: Decorator): void;
@@ -5,6 +5,9 @@ const constants_1 = require("./constants");
5
5
  const errors_1 = require("./errors");
6
6
  /**
7
7
  * Transform decorator call expressions for luabind class.
8
+ *
9
+ * @param context - Active transformation context.
10
+ * @param decorator - Class decorator to validate.
8
11
  */
9
12
  function checkLuabindClassDecoratorExpression(context, decorator) {
10
13
  const expression = decorator.expression;
@@ -1,3 +1,3 @@
1
- import { AllAccessorDeclarations, TransformationContext } from "typescript-to-lua";
1
+ import { type AllAccessorDeclarations, type TransformationContext } from "typescript-to-lua";
2
2
  import * as lua from "typescript-to-lua";
3
3
  export declare function transformAccessorDeclarations(context: TransformationContext, { firstAccessor, getAccessor, setAccessor }: AllAccessorDeclarations, className: lua.Identifier): lua.Statement | undefined;
@@ -1,5 +1,5 @@
1
- import { ClassLikeDeclaration, ConstructorDeclaration, PropertyDeclaration } from "typescript";
2
- import { TransformationContext } from "typescript-to-lua";
1
+ import { type ClassLikeDeclaration, type ConstructorDeclaration, type PropertyDeclaration } from "typescript";
2
+ import { type TransformationContext } from "typescript-to-lua";
3
3
  import * as lua from "typescript-to-lua";
4
4
  export declare function createConstructorName(className: lua.Identifier): lua.TableIndexExpression;
5
5
  export declare function transformConstructorDeclaration(context: TransformationContext, statement: ConstructorDeclaration, className: lua.Identifier, instanceFields: Array<PropertyDeclaration>, classDeclaration: ClassLikeDeclaration): lua.Statement | undefined;
@@ -45,11 +45,11 @@ function transformConstructorDeclaration(context, statement, className, instance
45
45
  // Add in instance field declarations
46
46
  for (const declaration of constructorFieldsDeclarations) {
47
47
  if ((0, typescript_1.isIdentifier)(declaration.name)) {
48
- // self.declarationName = declarationName
48
+ // Self.declarationName = declarationName
49
49
  const assignment = lua.createAssignmentStatement(lua.createTableIndexExpression((0, lua_ast_1.createSelfIdentifier)(), lua.createStringLiteral(declaration.name.text)), (0, identifier_1.transformIdentifier)(context, declaration.name));
50
50
  bodyWithFieldInitializers.push(assignment);
51
51
  }
52
- // else { TypeScript error: A parameter property may not be declared using a binding pattern }
52
+ // Else { TypeScript error: A parameter property may not be declared using a binding pattern }
53
53
  }
54
54
  bodyWithFieldInitializers.push(...classInstanceFields);
55
55
  bodyWithFieldInitializers.push(...body);
@@ -1,8 +1,11 @@
1
- import { AccessorDeclaration, PropertyDeclaration } from "typescript";
2
- import { TransformationContext } from "typescript-to-lua";
1
+ import { type AccessorDeclaration, type PropertyDeclaration } from "typescript";
2
+ import { type TransformationContext } from "typescript-to-lua";
3
3
  import * as tstl from "typescript-to-lua";
4
4
  /**
5
5
  * Verify whether decorators provided for luabind class.
6
+ *
7
+ * @param context - Active transformation context.
8
+ * @param node - Class property or accessor to inspect.
6
9
  */
7
10
  export declare function verifyPropertyDecoratingExpression(context: TransformationContext, node: PropertyDeclaration | AccessorDeclaration): void;
8
11
  export declare function transformClassInstanceFields(context: TransformationContext, instanceFields: Array<PropertyDeclaration>): Array<tstl.Statement>;
@@ -10,6 +10,9 @@ const literal_1 = require("typescript-to-lua/dist/transformation/visitors/litera
10
10
  const errors_1 = require("../errors");
11
11
  /**
12
12
  * Verify whether decorators provided for luabind class.
13
+ *
14
+ * @param context - Active transformation context.
15
+ * @param node - Class property or accessor to inspect.
13
16
  */
14
17
  function verifyPropertyDecoratingExpression(context, node) {
15
18
  if (!(0, typescript_1.canHaveDecorators)(node))
@@ -28,9 +31,9 @@ function transformClassInstanceFields(context, instanceFields) {
28
31
  // Get identifier
29
32
  const fieldName = (0, literal_1.transformPropertyName)(context, f.name);
30
33
  const value = f.initializer ? context.transformExpression(f.initializer) : undefined;
31
- // self[fieldName]
34
+ // Self[fieldName]
32
35
  const selfIndex = tstl.createTableIndexExpression((0, lua_ast_1.createSelfIdentifier)(), fieldName);
33
- // self[fieldName] = value
36
+ // Self[fieldName] = value
34
37
  const assignClassField = tstl.createAssignmentStatement(selfIndex, value, f);
35
38
  return assignClassField;
36
39
  });
@@ -1,10 +1,13 @@
1
- import { AccessorDeclaration, MethodDeclaration, PropertyDeclaration } from "typescript";
2
- import { TransformationContext } from "typescript-to-lua";
1
+ import { type AccessorDeclaration, type MethodDeclaration, type PropertyDeclaration } from "typescript";
2
+ import { type TransformationContext } from "typescript-to-lua";
3
3
  import * as lua from "typescript-to-lua";
4
4
  export declare function transformMemberExpressionOwnerName(node: PropertyDeclaration | MethodDeclaration | AccessorDeclaration, className: lua.Identifier): lua.Expression;
5
5
  export declare function transformMethodName(context: TransformationContext, node: MethodDeclaration): lua.Expression;
6
6
  export declare function transformMethodDeclaration(context: TransformationContext, node: MethodDeclaration, className: lua.Identifier): lua.Statement | undefined;
7
7
  /**
8
- * Verify that method statement is not using decorators for methods/parameters.
8
+ * Verify that a method does not use method or parameter decorators.
9
+ *
10
+ * @param context - Active transformation context.
11
+ * @param node - Class method to inspect.
9
12
  */
10
13
  export declare function verifyMethodDecoratingExpression(context: TransformationContext, node: MethodDeclaration): void;
@@ -35,7 +35,10 @@ function transformMethodDeclaration(context, node, className) {
35
35
  return lua.createAssignmentStatement(lua.createTableIndexExpression(methodTable, methodName), functionExpression, node);
36
36
  }
37
37
  /**
38
- * Verify that method statement is not using decorators for methods/parameters.
38
+ * Verify that a method does not use method or parameter decorators.
39
+ *
40
+ * @param context - Active transformation context.
41
+ * @param node - Class method to inspect.
39
42
  */
40
43
  function verifyMethodDecoratingExpression(context, node) {
41
44
  node.parameters.flatMap((parameter, index) => {
@@ -1,7 +1,11 @@
1
- import { NewExpression } from "typescript";
1
+ import { type NewExpression } from "typescript";
2
2
  import * as tstl from "typescript-to-lua";
3
- import { ITransformationContext } from "./index";
3
+ import { type ITransformationContext } from "./index";
4
4
  /**
5
- * Transform new call for luabind class as ClassConstructor() instead of TS_NEW from tstl.
5
+ * Transform a new expression into a luabind constructor call.
6
+ *
7
+ * @param expression - New expression to transform.
8
+ * @param context - Active transformation context.
9
+ * @returns Lua call expression for the class constructor.
6
10
  */
7
11
  export declare function transformNewCallExpression(expression: NewExpression, context: ITransformationContext): tstl.CallExpression;
@@ -4,7 +4,11 @@ exports.transformNewCallExpression = transformNewCallExpression;
4
4
  const tstl = require("typescript-to-lua");
5
5
  const call_1 = require("typescript-to-lua/dist/transformation/visitors/call");
6
6
  /**
7
- * Transform new call for luabind class as ClassConstructor() instead of TS_NEW from tstl.
7
+ * Transform a new expression into a luabind constructor call.
8
+ *
9
+ * @param expression - New expression to transform.
10
+ * @param context - Active transformation context.
11
+ * @returns Lua call expression for the class constructor.
8
12
  */
9
13
  function transformNewCallExpression(expression, context) {
10
14
  return tstl.createCallExpression(context.transformExpression(expression.expression), (0, call_1.transformArguments)(context, expression.arguments ?? []));
@@ -1,8 +1,14 @@
1
- import { ClassLikeDeclarationBase } from "typescript";
1
+ import { type ClassLikeDeclarationBase } from "typescript";
2
2
  import * as tstl from "typescript-to-lua";
3
- import { TransformationContext } from "typescript-to-lua";
3
+ import { type TransformationContext } from "typescript-to-lua";
4
4
  /**
5
- * Create full class setup statement with name/super calls/methods/declaration/fields etc.
5
+ * Build the full set of statements that define a luabind class.
6
+ *
7
+ * @param context - Active transformation context.
8
+ * @param statement - Class declaration being transformed.
9
+ * @param className - Exported class identifier.
10
+ * @param localClassName - Local class identifier.
11
+ * @returns Lua statements that set up the class.
6
12
  */
7
13
  export declare function createClassSetup(context: TransformationContext, statement: ClassLikeDeclarationBase, className: tstl.Identifier, localClassName: tstl.Identifier): tstl.Statement[];
8
14
  export declare function getReflectionClassName(declaration: ClassLikeDeclarationBase, className: tstl.Identifier): tstl.Expression;