@defold-typescript/types 0.19.4 → 0.20.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/api-availability.json +2755 -0
- package/api-migrations.json +31 -0
- package/api-signatures.json +2324 -0
- package/api-targets.json +493 -45
- package/generated/b2d.d.ts +6 -0
- package/generated/b2d_body.d.ts +329 -1
- package/generated/b2d_chain.d.ts +106 -0
- package/generated/b2d_fixture.d.ts +155 -0
- package/generated/b2d_joint.d.ts +823 -0
- package/generated/b2d_shape.d.ts +215 -0
- package/generated/b2d_world.d.ts +314 -0
- package/generated/builtin-messages.d.ts +18 -0
- package/generated/camera.d.ts +62 -5
- package/generated/compute.d.ts +306 -0
- package/generated/go.d.ts +29 -4
- package/generated/graphics.d.ts +95 -0
- package/generated/gui.d.ts +1 -3
- package/generated/json.d.ts +2 -2
- package/generated/kinds/gui-script.d.ts +7 -0
- package/generated/kinds/render-script.d.ts +7 -0
- package/generated/kinds/script.d.ts +7 -0
- package/generated/label.d.ts +1 -1
- package/generated/liveupdate.d.ts +22 -4
- package/generated/material.d.ts +444 -0
- package/generated/model.d.ts +46 -5
- package/generated/physics.d.ts +1 -3
- package/generated/profiler.d.ts +2 -3
- package/generated/render.d.ts +25 -9
- package/generated/resource.d.ts +2 -2
- package/generated/sprite.d.ts +15 -1
- package/generated/tilemap.d.ts +14 -0
- package/generated/versions/defold-1.12.4/b2d.d.ts +27 -0
- package/generated/versions/defold-1.12.4/b2d_body.d.ts +348 -0
- package/generated/versions/defold-1.12.4/buffer.d.ts +176 -0
- package/generated/versions/defold-1.12.4/camera.d.ts +245 -0
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +146 -0
- package/generated/versions/defold-1.12.4/collectionproxy.d.ts +71 -0
- package/generated/versions/defold-1.12.4/crash.d.ts +143 -0
- package/generated/versions/defold-1.12.4/factory.d.ts +123 -0
- package/generated/versions/defold-1.12.4/font.d.ts +81 -0
- package/generated/versions/defold-1.12.4/go.d.ts +1029 -0
- package/generated/versions/defold-1.12.4/graphics.d.ts +226 -0
- package/generated/versions/defold-1.12.4/gui.d.ts +2372 -0
- package/generated/versions/defold-1.12.4/html5.d.ts +53 -0
- package/generated/versions/defold-1.12.4/http.d.ts +84 -0
- package/generated/versions/defold-1.12.4/iac.d.ts +18 -0
- package/generated/versions/defold-1.12.4/iap.d.ts +60 -0
- package/generated/versions/defold-1.12.4/image.d.ts +139 -0
- package/generated/versions/defold-1.12.4/index.d.ts +41 -0
- package/generated/versions/defold-1.12.4/json.d.ts +76 -0
- package/generated/versions/defold-1.12.4/label.d.ts +94 -0
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +122 -0
- package/generated/versions/defold-1.12.4/model.d.ts +205 -0
- package/generated/versions/defold-1.12.4/msg.d.ts +10 -0
- package/generated/versions/defold-1.12.4/particlefx.d.ts +166 -0
- package/generated/versions/defold-1.12.4/physics.d.ts +547 -0
- package/generated/versions/defold-1.12.4/profiler.d.ts +234 -0
- package/generated/versions/defold-1.12.4/push.d.ts +66 -0
- package/generated/versions/defold-1.12.4/render.d.ts +1149 -0
- package/generated/versions/defold-1.12.4/resource.d.ts +1518 -0
- package/generated/versions/defold-1.12.4/socket.d.ts +795 -0
- package/generated/versions/defold-1.12.4/sound.d.ts +291 -0
- package/generated/versions/defold-1.12.4/sprite.d.ts +143 -0
- package/generated/versions/defold-1.12.4/sys.d.ts +695 -0
- package/generated/versions/defold-1.12.4/tilemap.d.ts +181 -0
- package/generated/versions/defold-1.12.4/timer.d.ts +114 -0
- package/generated/versions/defold-1.12.4/types.d.ts +61 -0
- package/generated/versions/defold-1.12.4/vmath.d.ts +806 -0
- package/generated/versions/defold-1.12.4/webview.d.ts +68 -0
- package/generated/versions/defold-1.12.4/window.d.ts +198 -0
- package/generated/versions/defold-1.12.4/zlib.d.ts +40 -0
- package/index.d.ts +22 -0
- package/package.json +8 -1
- package/scripts/fidelity-audit.ts +69 -12
- package/scripts/fidelity-baseline.json +56 -0
- package/scripts/generate-api-availability.ts +139 -0
- package/scripts/generate-api-signatures.ts +66 -0
- package/scripts/import-defold-release.ts +480 -0
- package/scripts/regen.ts +53 -6
- package/scripts/sync-api-docs.ts +89 -41
- package/src/api-availability.ts +0 -0
- package/src/core-types.ts +9 -0
- package/src/emit-dts.ts +674 -17
- package/src/emit-messages.ts +72 -2
- package/src/index.ts +26 -1
- package/src/lifecycle.ts +43 -2
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
declare global {
|
|
3
|
+
/**
|
|
4
|
+
* Functions and constants for interacting with webview APIs
|
|
5
|
+
*/
|
|
6
|
+
namespace webview {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a webview instance. It can show HTML pages as well as evaluate Javascript. The view remains hidden until the first call. There can exist a maximum of 4 webviews at the same time.
|
|
9
|
+
* On iOS, the callback will never get a `webview.CALLBACK_RESULT_EVAL_ERROR`, due to the iOS SDK implementation."
|
|
10
|
+
*
|
|
11
|
+
* @param callback - A callback which receives info about finished requests taking the following parameters:
|
|
12
|
+
*/
|
|
13
|
+
function create(callback: (...args: unknown[]) => unknown): void;
|
|
14
|
+
/**
|
|
15
|
+
* Destroys an instance of a webview.
|
|
16
|
+
*
|
|
17
|
+
* @param webview_id - The webview id (returned by the `webview.create()` call)
|
|
18
|
+
*/
|
|
19
|
+
function destroy(webview_id: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* Evaluates JavaScript within the context of the currently loaded page (if any). Once the request is done, the callback (registered in `webview.create()`) is invoked. The callback will get the result in the `data["result"]` field.
|
|
22
|
+
*
|
|
23
|
+
* @param webview_id - The webview id
|
|
24
|
+
* @param code - The JavaScript code to evaluate
|
|
25
|
+
*/
|
|
26
|
+
function eval(webview_id: number, code: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the visibility state of the webview.
|
|
29
|
+
*
|
|
30
|
+
* @param webview_id - The webview id
|
|
31
|
+
*/
|
|
32
|
+
function is_visible(webview_id: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Opens a web page in the webview, using HTML data. Once the request is done, the callback (registered in `webview.create()`) is invoked.
|
|
35
|
+
*
|
|
36
|
+
* @param webview_id - The webview id
|
|
37
|
+
* @param html - The HTML data to display
|
|
38
|
+
* @param options - A table of options for the request. See `webview.open()`
|
|
39
|
+
*/
|
|
40
|
+
function open_raw(webview_id: number, html: string, options: Record<string | number, unknown>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the position and size of the webview
|
|
43
|
+
*
|
|
44
|
+
* @param webview_id - The webview id
|
|
45
|
+
* @param x - The x position of the webview
|
|
46
|
+
* @param y - The y position of the webview
|
|
47
|
+
* @param width - The width of the webview (-1 to match screen width)
|
|
48
|
+
* @param height - The height of the webview (-1 to match screen height)
|
|
49
|
+
*/
|
|
50
|
+
function set_position(webview_id: number, x: number, y: number, width: number, height: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* Set transparency of webview background
|
|
53
|
+
*
|
|
54
|
+
* @param webview_id - The webview id
|
|
55
|
+
* @param transparent - If `true`, the webview background becomes transparent, otherwise opaque.
|
|
56
|
+
*/
|
|
57
|
+
function set_transparent(webview_id: number, transparent: boolean): void;
|
|
58
|
+
/**
|
|
59
|
+
* Shows or hides a webview
|
|
60
|
+
*
|
|
61
|
+
* @param webview_id - The webview id
|
|
62
|
+
* @param visible - If `0`, hides the webview. If non zero, shows the view
|
|
63
|
+
*/
|
|
64
|
+
function set_visible(webview_id: number, visible: number): void;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Opaque } from "../../../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Functions and constants to access the window, window event listeners
|
|
7
|
+
* and screen dimming.
|
|
8
|
+
*/
|
|
9
|
+
namespace window {
|
|
10
|
+
/**
|
|
11
|
+
* Dimming mode is used to control whether or not a mobile device should dim the screen after a period without user interaction.
|
|
12
|
+
*/
|
|
13
|
+
const DIMMING_OFF: number & { readonly __brand: "window.DIMMING_OFF" };
|
|
14
|
+
/**
|
|
15
|
+
* Dimming mode is used to control whether or not a mobile device should dim the screen after a period without user interaction.
|
|
16
|
+
*/
|
|
17
|
+
const DIMMING_ON: number & { readonly __brand: "window.DIMMING_ON" };
|
|
18
|
+
/**
|
|
19
|
+
* Dimming mode is used to control whether or not a mobile device should dim the screen after a period without user interaction.
|
|
20
|
+
* This mode indicates that the dim mode can't be determined, or that the platform doesn't support dimming.
|
|
21
|
+
*/
|
|
22
|
+
const DIMMING_UNKNOWN: number & { readonly __brand: "window.DIMMING_UNKNOWN" };
|
|
23
|
+
/**
|
|
24
|
+
* This event is sent to a window event listener when the game window or app screen is
|
|
25
|
+
* restored after being iconified.
|
|
26
|
+
*/
|
|
27
|
+
const WINDOW_EVENT_DEICONIFIED: number & { readonly __brand: "window.WINDOW_EVENT_DEICONIFIED" };
|
|
28
|
+
/**
|
|
29
|
+
* This event is sent to a window event listener when the game window or app screen has
|
|
30
|
+
* gained focus.
|
|
31
|
+
* This event is also sent at game startup and the engine gives focus to the game.
|
|
32
|
+
*/
|
|
33
|
+
const WINDOW_EVENT_FOCUS_GAINED: number & { readonly __brand: "window.WINDOW_EVENT_FOCUS_GAINED" };
|
|
34
|
+
/**
|
|
35
|
+
* This event is sent to a window event listener when the game window or app screen has lost focus.
|
|
36
|
+
*/
|
|
37
|
+
const WINDOW_EVENT_FOCUS_LOST: number & { readonly __brand: "window.WINDOW_EVENT_FOCUS_LOST" };
|
|
38
|
+
/**
|
|
39
|
+
* This event is sent to a window event listener when the game window or app screen is
|
|
40
|
+
* iconified (reduced to an application icon in a toolbar, application tray or similar).
|
|
41
|
+
*/
|
|
42
|
+
const WINDOW_EVENT_ICONFIED: number & { readonly __brand: "window.WINDOW_EVENT_ICONFIED" };
|
|
43
|
+
/**
|
|
44
|
+
* This event is sent to a window event listener when the game window or app screen is resized.
|
|
45
|
+
* The new size is passed along in the data field to the event listener.
|
|
46
|
+
*/
|
|
47
|
+
const WINDOW_EVENT_RESIZED: number & { readonly __brand: "window.WINDOW_EVENT_RESIZED" };
|
|
48
|
+
/**
|
|
49
|
+
* Returns the current dimming mode set on a mobile device.
|
|
50
|
+
* The dimming mode specifies whether or not a mobile device should dim the screen after a period without user interaction.
|
|
51
|
+
* On platforms that does not support dimming, `window.DIMMING_UNKNOWN` is always returned.
|
|
52
|
+
*
|
|
53
|
+
* @returns The mode for screen dimming
|
|
54
|
+
*
|
|
55
|
+
* - `window.DIMMING_UNKNOWN`
|
|
56
|
+
*
|
|
57
|
+
* - `window.DIMMING_ON`
|
|
58
|
+
*
|
|
59
|
+
* - `window.DIMMING_OFF`
|
|
60
|
+
*/
|
|
61
|
+
function get_dim_mode(): Opaque<"constant">;
|
|
62
|
+
/**
|
|
63
|
+
* This returns the content scale of the current display.
|
|
64
|
+
*
|
|
65
|
+
* @returns The display scale
|
|
66
|
+
*/
|
|
67
|
+
function get_display_scale(): number;
|
|
68
|
+
/**
|
|
69
|
+
* This returns the current lock state of the mouse cursor
|
|
70
|
+
*
|
|
71
|
+
* @returns The lock state
|
|
72
|
+
*/
|
|
73
|
+
function get_mouse_lock(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* This returns the safe area rectangle (x, y, width, height) and the inset
|
|
76
|
+
* values relative to the window edges. On platforms without a safe area,
|
|
77
|
+
* this returns the full window size and zero insets.
|
|
78
|
+
*
|
|
79
|
+
* @returns safe area data
|
|
80
|
+
*
|
|
81
|
+
* `safe_area`
|
|
82
|
+
* table table containing these keys:
|
|
83
|
+
*
|
|
84
|
+
* - number `x`
|
|
85
|
+
*
|
|
86
|
+
* - number `y`
|
|
87
|
+
*
|
|
88
|
+
* - number `width`
|
|
89
|
+
*
|
|
90
|
+
* - number `height`
|
|
91
|
+
*
|
|
92
|
+
* - number `inset_left`
|
|
93
|
+
*
|
|
94
|
+
* - number `inset_top`
|
|
95
|
+
*
|
|
96
|
+
* - number `inset_right`
|
|
97
|
+
*
|
|
98
|
+
* - number `inset_bottom`
|
|
99
|
+
*/
|
|
100
|
+
function get_safe_area(): { safe_area: { x: number; y: number; width: number; height: number; inset_left: number; inset_top: number; inset_right: number; inset_bottom: number } };
|
|
101
|
+
/**
|
|
102
|
+
* This returns the current window size (width and height).
|
|
103
|
+
*/
|
|
104
|
+
function get_size(): LuaMultiReturn<[number, number]>;
|
|
105
|
+
/**
|
|
106
|
+
* Sets the dimming mode on a mobile device.
|
|
107
|
+
* The dimming mode specifies whether or not a mobile device should dim the screen after a period without user interaction. The dimming mode will only affect the mobile device while the game is in focus on the device, but not when the game is running in the background.
|
|
108
|
+
* This function has no effect on platforms that does not support dimming.
|
|
109
|
+
*
|
|
110
|
+
* @param mode - The mode for screen dimming
|
|
111
|
+
*
|
|
112
|
+
* - `window.DIMMING_ON`
|
|
113
|
+
*
|
|
114
|
+
* - `window.DIMMING_OFF`
|
|
115
|
+
*/
|
|
116
|
+
function set_dim_mode(mode: Opaque<"constant">): void;
|
|
117
|
+
/**
|
|
118
|
+
* Sets a window event listener. Only one window event listener can be set at a time.
|
|
119
|
+
*
|
|
120
|
+
* @param callback - A callback which receives info about window events. Pass an empty function or `nil` if you no longer wish to receive callbacks.
|
|
121
|
+
*
|
|
122
|
+
* `self`
|
|
123
|
+
* object The calling script
|
|
124
|
+
* `event`
|
|
125
|
+
* constant The type of event. Can be one of these:
|
|
126
|
+
*
|
|
127
|
+
* - `window.WINDOW_EVENT_FOCUS_LOST`
|
|
128
|
+
*
|
|
129
|
+
* - `window.WINDOW_EVENT_FOCUS_GAINED`
|
|
130
|
+
*
|
|
131
|
+
* - `window.WINDOW_EVENT_RESIZED`
|
|
132
|
+
*
|
|
133
|
+
* - `window.WINDOW_EVENT_ICONIFIED`
|
|
134
|
+
*
|
|
135
|
+
* - `window.WINDOW_EVENT_DEICONIFIED`
|
|
136
|
+
*
|
|
137
|
+
* `data`
|
|
138
|
+
* table The callback value `data` is a table which currently holds these values
|
|
139
|
+
*
|
|
140
|
+
* - number `width`: The width of a resize event. nil otherwise.
|
|
141
|
+
*
|
|
142
|
+
* - number `height`: The height of a resize event. nil otherwise.
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* function window_callback(self, event, data) {
|
|
146
|
+
* if (event === window.WINDOW_EVENT_FOCUS_LOST) {
|
|
147
|
+
* print("window.WINDOW_EVENT_FOCUS_LOST");
|
|
148
|
+
* } else if (event === window.WINDOW_EVENT_FOCUS_GAINED) {
|
|
149
|
+
* print("window.WINDOW_EVENT_FOCUS_GAINED");
|
|
150
|
+
* } else if (event === window.WINDOW_EVENT_ICONFIED) {
|
|
151
|
+
* print("window.WINDOW_EVENT_ICONFIED");
|
|
152
|
+
* } else if (event === window.WINDOW_EVENT_DEICONIFIED) {
|
|
153
|
+
* print("window.WINDOW_EVENT_DEICONIFIED");
|
|
154
|
+
* } else if (event === window.WINDOW_EVENT_RESIZED) {
|
|
155
|
+
* print("Window resized: ", data.width, data.height);
|
|
156
|
+
* }
|
|
157
|
+
* }
|
|
158
|
+
*
|
|
159
|
+
* export default defineScript({
|
|
160
|
+
* init() {
|
|
161
|
+
* window.set_listener(window_callback);
|
|
162
|
+
* },
|
|
163
|
+
* });
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
function set_listener(callback?: (self: unknown, event: typeof WINDOW_EVENT_FOCUS_LOST | typeof WINDOW_EVENT_FOCUS_GAINED | typeof WINDOW_EVENT_RESIZED | typeof WINDOW_EVENT_ICONFIED | typeof WINDOW_EVENT_DEICONIFIED, data: Record<string | number, unknown>) => void): void;
|
|
167
|
+
/**
|
|
168
|
+
* Set the locking state for current mouse cursor on a PC platform.
|
|
169
|
+
* This function locks or unlocks the mouse cursor to the center point of the window. While the cursor is locked,
|
|
170
|
+
* mouse position updates will still be sent to the scripts as usual.
|
|
171
|
+
*
|
|
172
|
+
* @param flag - The lock state for the mouse cursor
|
|
173
|
+
*/
|
|
174
|
+
function set_mouse_lock(flag: boolean): void;
|
|
175
|
+
/**
|
|
176
|
+
* Sets the window position.
|
|
177
|
+
*
|
|
178
|
+
* @param x - Horizontal position of window
|
|
179
|
+
* @param y - Vertical position of window
|
|
180
|
+
*/
|
|
181
|
+
function set_position(x: number, y: number): void;
|
|
182
|
+
/**
|
|
183
|
+
* Sets the window size. Works on desktop platforms only.
|
|
184
|
+
*
|
|
185
|
+
* @param width - Width of window
|
|
186
|
+
* @param height - Height of window
|
|
187
|
+
*/
|
|
188
|
+
function set_size(width: number, height: number): void;
|
|
189
|
+
/**
|
|
190
|
+
* Sets the window title. Works on desktop platforms.
|
|
191
|
+
*
|
|
192
|
+
* @param title - The title, encoded as UTF-8
|
|
193
|
+
*/
|
|
194
|
+
function set_title(title: string): void;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
declare global {
|
|
3
|
+
/**
|
|
4
|
+
* Functions for compression and decompression of string buffers.
|
|
5
|
+
*/
|
|
6
|
+
namespace zlib {
|
|
7
|
+
/**
|
|
8
|
+
* A lua error is raised is on error
|
|
9
|
+
*
|
|
10
|
+
* @param buf - buffer to deflate
|
|
11
|
+
* @returns deflated buffer
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const data = "This is a string with uncompressed data.";
|
|
15
|
+
* const compressed_data = zlib.deflate(data);
|
|
16
|
+
* let s = "";
|
|
17
|
+
* for (const c of compressed_data) {
|
|
18
|
+
* s = s + "\\" + c.charCodeAt(0);
|
|
19
|
+
* }
|
|
20
|
+
* print(s); //> \120\94\11\201\200\44\86\0\162\68\133\226\146\162 ...
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function deflate(buf: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* A lua error is raised is on error
|
|
26
|
+
*
|
|
27
|
+
* @param buf - buffer to inflate
|
|
28
|
+
* @returns inflated buffer
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const data = "\120\94\11\201\200\44\86\0\162\68\133\226\146\162\204\188\116\133\242\204\146\12\133\210\188\228\252\220\130\162\212\226\226\212\20\133\148\196\146\68\61\0\44\67\14\201";
|
|
32
|
+
* const uncompressed_data = zlib.inflate(data);
|
|
33
|
+
* print(uncompressed_data); //> This is a string with uncompressed data.
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
function inflate(buf: string): string;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -7,10 +7,17 @@ import "./src/window-event-guard";
|
|
|
7
7
|
import "./src/message-dispatch";
|
|
8
8
|
import "./src/engine-globals";
|
|
9
9
|
import "./generated/b2d";
|
|
10
|
+
import "./generated/b2d_body";
|
|
11
|
+
import "./generated/b2d_chain";
|
|
12
|
+
import "./generated/b2d_fixture";
|
|
13
|
+
import "./generated/b2d_joint";
|
|
14
|
+
import "./generated/b2d_shape";
|
|
15
|
+
import "./generated/b2d_world";
|
|
10
16
|
import "./generated/buffer";
|
|
11
17
|
import "./generated/camera";
|
|
12
18
|
import "./generated/collectionfactory";
|
|
13
19
|
import "./generated/collectionproxy";
|
|
20
|
+
import "./generated/compute";
|
|
14
21
|
import "./generated/crash";
|
|
15
22
|
import "./generated/factory";
|
|
16
23
|
import "./generated/go";
|
|
@@ -25,6 +32,7 @@ import "./generated/image";
|
|
|
25
32
|
import "./generated/json";
|
|
26
33
|
import "./generated/label";
|
|
27
34
|
import "./generated/liveupdate";
|
|
35
|
+
import "./generated/material";
|
|
28
36
|
import "./generated/model";
|
|
29
37
|
import "./generated/msg";
|
|
30
38
|
import "./generated/particlefx";
|
|
@@ -47,6 +55,20 @@ import "./generated/webview";
|
|
|
47
55
|
import "./generated/window";
|
|
48
56
|
import "./generated/zlib";
|
|
49
57
|
|
|
58
|
+
export {
|
|
59
|
+
type ApiAvailability,
|
|
60
|
+
type ApiSymbolIdentity,
|
|
61
|
+
type AvailabilityLabel,
|
|
62
|
+
type AvailabilityLabelKind,
|
|
63
|
+
availabilityLabel,
|
|
64
|
+
deriveAvailabilityMatrix,
|
|
65
|
+
groupByLogicalName,
|
|
66
|
+
isSignatureTransition,
|
|
67
|
+
type LogicalNameGroup,
|
|
68
|
+
normalizedFunctionSignature,
|
|
69
|
+
symbolIdentityKey,
|
|
70
|
+
type VersionSurface,
|
|
71
|
+
} from "./src/api-availability";
|
|
50
72
|
export type { ApiFunction, ApiModule, ApiParameter, ApiVariable } from "./src/api-doc";
|
|
51
73
|
export { parseDefoldApiDoc } from "./src/api-doc";
|
|
52
74
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defold-typescript/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "TypeScript types for the Defold engine's Lua APIs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
"./timers": {
|
|
37
37
|
"types": "./src/timers.d.ts"
|
|
38
38
|
},
|
|
39
|
+
"./api-availability.json": "./api-availability.json",
|
|
40
|
+
"./api-signatures.json": "./api-signatures.json",
|
|
39
41
|
"./package.json": "./package.json"
|
|
40
42
|
},
|
|
41
43
|
"files": [
|
|
@@ -43,6 +45,9 @@
|
|
|
43
45
|
"generated",
|
|
44
46
|
"scripts",
|
|
45
47
|
"api-targets.json",
|
|
48
|
+
"api-migrations.json",
|
|
49
|
+
"api-availability.json",
|
|
50
|
+
"api-signatures.json",
|
|
46
51
|
"index.d.ts",
|
|
47
52
|
"!src/**/*.test.ts",
|
|
48
53
|
"!scripts/**/*.test.ts",
|
|
@@ -55,6 +60,8 @@
|
|
|
55
60
|
"build": "tsc -p tsconfig.build.json",
|
|
56
61
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
57
62
|
"regen": "bun scripts/regen.ts",
|
|
63
|
+
"generate-api-availability": "bun scripts/generate-api-availability.ts",
|
|
64
|
+
"import-defold-release": "bun scripts/import-defold-release.ts",
|
|
58
65
|
"sync-api-docs": "bun scripts/sync-api-docs.ts",
|
|
59
66
|
"ref-doc-delta": "bun scripts/ref-doc-delta.ts --target defold-1.9.8 --namespace label --present label.get_text --absent label.set_text"
|
|
60
67
|
},
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
2
|
import { DEFOLD_TYPE_MAP } from "../src/core-types";
|
|
3
3
|
import {
|
|
4
|
+
ARBITRARY_TABLE_SLOT_KEYS,
|
|
4
5
|
ARBITRARY_TABLE_SLOTS,
|
|
6
|
+
applyFieldTypeOverrides,
|
|
5
7
|
applyNestedFieldCurations,
|
|
6
8
|
buildTableDocResolver,
|
|
7
9
|
HANDLE_METHOD_LOCAL,
|
|
8
10
|
HOMOGENEOUS_ARRAY_SLOTS,
|
|
11
|
+
isRecordsCollectionSlot,
|
|
12
|
+
isSlotLevelList,
|
|
9
13
|
MAPPING_TABLE_SLOTS,
|
|
10
14
|
type NestedMapping,
|
|
11
15
|
OVERLOAD_COVERED_SKIPS,
|
|
@@ -18,9 +22,9 @@ import {
|
|
|
18
22
|
import { parseMessagesDoc } from "../src/emit-messages";
|
|
19
23
|
import {
|
|
20
24
|
collectConstantFqns,
|
|
25
|
+
FIDELITY_BASELINE_MANIFEST,
|
|
21
26
|
generateModuleDeclaration,
|
|
22
27
|
MESSAGES_MANIFEST,
|
|
23
|
-
MODULE_MANIFEST,
|
|
24
28
|
type ModuleManifestEntry,
|
|
25
29
|
} from "./regen";
|
|
26
30
|
|
|
@@ -163,10 +167,10 @@ function auditEntry(
|
|
|
163
167
|
for (const field of tableSlotCuration.value) {
|
|
164
168
|
if (field.fields !== undefined) {
|
|
165
169
|
for (const nested of field.fields) {
|
|
166
|
-
if (nested.numberList === true) continue;
|
|
170
|
+
if (nested.numberList === true || nested.tsType !== undefined) continue;
|
|
167
171
|
considerTypes(nested.types);
|
|
168
172
|
}
|
|
169
|
-
} else if (field.numberList !== true) {
|
|
173
|
+
} else if (field.numberList !== true && field.tsType === undefined) {
|
|
170
174
|
considerTypes(field.types);
|
|
171
175
|
}
|
|
172
176
|
}
|
|
@@ -197,15 +201,37 @@ function auditEntry(
|
|
|
197
201
|
for (const field of tableSlotCuration.fields) {
|
|
198
202
|
if (field.fields !== undefined) {
|
|
199
203
|
for (const nested of field.fields) {
|
|
200
|
-
if (nested.numberList === true) continue;
|
|
204
|
+
if (nested.numberList === true || nested.tsType !== undefined) continue;
|
|
201
205
|
considerTypes(nested.types);
|
|
202
206
|
}
|
|
203
|
-
} else if (field.numberList !== true) {
|
|
207
|
+
} else if (field.numberList !== true && field.tsType === undefined) {
|
|
204
208
|
considerTypes(field.types);
|
|
205
209
|
}
|
|
206
210
|
}
|
|
207
211
|
continue;
|
|
208
212
|
}
|
|
213
|
+
// A keyed-object slot is recovered by emit-dts into `Record<string, { … }>`
|
|
214
|
+
// where the inner fields are parser-recovered — not a bare `Record`, so
|
|
215
|
+
// don't count it. Feed the parsed inner field types back through
|
|
216
|
+
// considerTypes so an unmapped inner token still surfaces under
|
|
217
|
+
// unknownTokens (mirrors the parser-recovered branch below).
|
|
218
|
+
if (tableSlotCuration?.kind === "keyed-object") {
|
|
219
|
+
const rawParsed = doc !== undefined ? parseTableFields(doc, resolver) : null;
|
|
220
|
+
if (rawParsed !== null && slot !== undefined) {
|
|
221
|
+
const parsed = applyFieldTypeOverrides(slot.element, slot.kind, slot.name, rawParsed);
|
|
222
|
+
for (const field of parsed) {
|
|
223
|
+
if (field.fields !== undefined) {
|
|
224
|
+
for (const nested of field.fields) {
|
|
225
|
+
if (nested.numberList === true || nested.tsType !== undefined) continue;
|
|
226
|
+
considerTypes(nested.types);
|
|
227
|
+
}
|
|
228
|
+
} else if (field.numberList !== true && field.tsType === undefined) {
|
|
229
|
+
considerTypes(field.types);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
209
235
|
if (homogeneousElement !== undefined) {
|
|
210
236
|
considerTypes(
|
|
211
237
|
typeof homogeneousElement === "string" ? [homogeneousElement] : homogeneousElement,
|
|
@@ -215,7 +241,12 @@ function auditEntry(
|
|
|
215
241
|
const parsed = doc !== undefined ? parseTableFields(doc, resolver) : null;
|
|
216
242
|
const fields =
|
|
217
243
|
parsed !== null && slot !== undefined
|
|
218
|
-
?
|
|
244
|
+
? applyFieldTypeOverrides(
|
|
245
|
+
slot.element,
|
|
246
|
+
slot.kind,
|
|
247
|
+
slot.name,
|
|
248
|
+
applyNestedFieldCurations(slot.element, slot.kind, slot.name, parsed),
|
|
249
|
+
)
|
|
219
250
|
: parsed;
|
|
220
251
|
if (fields !== null) {
|
|
221
252
|
// A recovered field carrying nested fields (the mixed `<dl>`+`<ul>`
|
|
@@ -232,23 +263,49 @@ function auditEntry(
|
|
|
232
263
|
for (const field of fields) {
|
|
233
264
|
if (field.fields !== undefined) {
|
|
234
265
|
for (const nested of field.fields) {
|
|
235
|
-
if (nested.numberList === true) continue;
|
|
266
|
+
if (nested.numberList === true || nested.tsType !== undefined) continue;
|
|
236
267
|
considerTypes(nested.types, undefined, arbitraryTable);
|
|
237
268
|
}
|
|
238
|
-
} else if (field.numberList === true) {
|
|
239
|
-
// Recovered as `number[]`
|
|
240
|
-
//
|
|
241
|
-
//
|
|
269
|
+
} else if (field.numberList === true || field.tsType !== undefined) {
|
|
270
|
+
// Recovered as `number[]` (numberList) or pinned via a field-type
|
|
271
|
+
// override (tsType) by inlineTableType — no longer a `Record`, so
|
|
272
|
+
// skip it. Re-counting its `table` token here would double-count a
|
|
273
|
+
// slot the emitted surface no longer loses.
|
|
242
274
|
} else {
|
|
243
275
|
considerTypes(field.types, undefined, arbitraryTable);
|
|
244
276
|
}
|
|
245
277
|
}
|
|
278
|
+
// A records-collection return slot ("… of tables" / "table of tables")
|
|
279
|
+
// whose inner record the parser recovered but the emitter did not wrap
|
|
280
|
+
// (isSlotLevelList false) still lost its outer array layer — the emitted
|
|
281
|
+
// shape is a bare object. The oracle (isRecordsCollectionSlot) is
|
|
282
|
+
// intentionally broader than the emitter's wrap trigger (isSlotLevelList):
|
|
283
|
+
// a records-collection wording the trigger stops recognizing re-surfaces
|
|
284
|
+
// here as a counted loss, keeping the gate coupled to the emitted surface.
|
|
285
|
+
// array / array-object / mapping / homogeneous curations already
|
|
286
|
+
// `continue`d above, so reaching here means none applied.
|
|
287
|
+
if (
|
|
288
|
+
slot?.kind === "return" &&
|
|
289
|
+
doc !== undefined &&
|
|
290
|
+
isRecordsCollectionSlot(doc) &&
|
|
291
|
+
!isSlotLevelList(doc)
|
|
292
|
+
) {
|
|
293
|
+
recordTables += 1;
|
|
294
|
+
}
|
|
246
295
|
continue;
|
|
247
296
|
}
|
|
248
297
|
// A slot on a serialization/JSON passthrough function is a genuinely
|
|
249
298
|
// arbitrary lua table — its emitted `Record<string | number, unknown>`
|
|
250
299
|
// is faithful, not a loss — so it is not counted under recordTables.
|
|
251
300
|
if (arbitraryTable) continue;
|
|
301
|
+
// A per-slot arbitrary allowlist entry (an undocumented table slot on an
|
|
302
|
+
// otherwise-documented element) is faithful `Record` too — not a loss.
|
|
303
|
+
if (
|
|
304
|
+
slot !== undefined &&
|
|
305
|
+
ARBITRARY_TABLE_SLOT_KEYS.has(`${slot.element}:${slot.kind}:${slot.name}`)
|
|
306
|
+
) {
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
252
309
|
recordTables += 1;
|
|
253
310
|
continue;
|
|
254
311
|
}
|
|
@@ -382,7 +439,7 @@ function tableSlotKey(elementName: string, slotKind: "param" | "return", slotNam
|
|
|
382
439
|
}
|
|
383
440
|
|
|
384
441
|
export function buildFidelityReport(
|
|
385
|
-
manifest: readonly ModuleManifestEntry[] =
|
|
442
|
+
manifest: readonly ModuleManifestEntry[] = FIDELITY_BASELINE_MANIFEST,
|
|
386
443
|
): Record<string, FidelityEntry> {
|
|
387
444
|
const report: Record<string, FidelityEntry> = {};
|
|
388
445
|
const knownConstantFqns = collectConstantFqns(manifest);
|
|
@@ -15,6 +15,46 @@
|
|
|
15
15
|
"droppedMembers": 0,
|
|
16
16
|
"optionalAsRequired": 0
|
|
17
17
|
},
|
|
18
|
+
"b2d.chain": {
|
|
19
|
+
"droppedElements": 0,
|
|
20
|
+
"unknownTokens": [],
|
|
21
|
+
"recordTables": 0,
|
|
22
|
+
"multiReturn": 0,
|
|
23
|
+
"droppedMembers": 0,
|
|
24
|
+
"optionalAsRequired": 0
|
|
25
|
+
},
|
|
26
|
+
"b2d.fixture": {
|
|
27
|
+
"droppedElements": 0,
|
|
28
|
+
"unknownTokens": [],
|
|
29
|
+
"recordTables": 0,
|
|
30
|
+
"multiReturn": 0,
|
|
31
|
+
"droppedMembers": 0,
|
|
32
|
+
"optionalAsRequired": 0
|
|
33
|
+
},
|
|
34
|
+
"b2d.joint": {
|
|
35
|
+
"droppedElements": 0,
|
|
36
|
+
"unknownTokens": [],
|
|
37
|
+
"recordTables": 0,
|
|
38
|
+
"multiReturn": 0,
|
|
39
|
+
"droppedMembers": 0,
|
|
40
|
+
"optionalAsRequired": 0
|
|
41
|
+
},
|
|
42
|
+
"b2d.shape": {
|
|
43
|
+
"droppedElements": 0,
|
|
44
|
+
"unknownTokens": [],
|
|
45
|
+
"recordTables": 0,
|
|
46
|
+
"multiReturn": 0,
|
|
47
|
+
"droppedMembers": 0,
|
|
48
|
+
"optionalAsRequired": 0
|
|
49
|
+
},
|
|
50
|
+
"b2d.world": {
|
|
51
|
+
"droppedElements": 0,
|
|
52
|
+
"unknownTokens": [],
|
|
53
|
+
"recordTables": 0,
|
|
54
|
+
"multiReturn": 0,
|
|
55
|
+
"droppedMembers": 0,
|
|
56
|
+
"optionalAsRequired": 0
|
|
57
|
+
},
|
|
18
58
|
"buffer": {
|
|
19
59
|
"droppedElements": 0,
|
|
20
60
|
"unknownTokens": [],
|
|
@@ -47,6 +87,14 @@
|
|
|
47
87
|
"droppedMembers": 0,
|
|
48
88
|
"optionalAsRequired": 0
|
|
49
89
|
},
|
|
90
|
+
"compute": {
|
|
91
|
+
"droppedElements": 0,
|
|
92
|
+
"unknownTokens": [],
|
|
93
|
+
"recordTables": 0,
|
|
94
|
+
"multiReturn": 0,
|
|
95
|
+
"droppedMembers": 0,
|
|
96
|
+
"optionalAsRequired": 0
|
|
97
|
+
},
|
|
50
98
|
"crash": {
|
|
51
99
|
"droppedElements": 0,
|
|
52
100
|
"unknownTokens": [],
|
|
@@ -159,6 +207,14 @@
|
|
|
159
207
|
"droppedMembers": 0,
|
|
160
208
|
"optionalAsRequired": 0
|
|
161
209
|
},
|
|
210
|
+
"material": {
|
|
211
|
+
"droppedElements": 0,
|
|
212
|
+
"unknownTokens": [],
|
|
213
|
+
"recordTables": 0,
|
|
214
|
+
"multiReturn": 0,
|
|
215
|
+
"droppedMembers": 0,
|
|
216
|
+
"optionalAsRequired": 0
|
|
217
|
+
},
|
|
162
218
|
"model": {
|
|
163
219
|
"droppedElements": 0,
|
|
164
220
|
"unknownTokens": [],
|