@defold-typescript/types 0.29.0 → 0.31.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/package.json
CHANGED
package/scripts/regen.ts
CHANGED
|
@@ -699,7 +699,10 @@ export function generateVersionIndex(
|
|
|
699
699
|
]
|
|
700
700
|
.map((module) => `import "./${module}";`)
|
|
701
701
|
.join("\n");
|
|
702
|
-
|
|
702
|
+
// A pinned consumer names this surface in `types` and never loads the
|
|
703
|
+
// package entrypoint, so the stdlib directives have to lead here too. A
|
|
704
|
+
// runtime surface is LuaJIT, so it takes both lines.
|
|
705
|
+
return `${LUA_STDLIB_REFERENCES}${imports}\n\nexport {};\n`;
|
|
703
706
|
}
|
|
704
707
|
|
|
705
708
|
// The `src/`-relative prefix a kind index living in `<generatedDir>/kinds/` needs
|
package/src/index.ts
CHANGED
package/src/url-parameters.ts
CHANGED
|
@@ -6,8 +6,10 @@ import type { ApiModule } from "./api-doc";
|
|
|
6
6
|
// naming a mesh inside the model asset), so a slot is classified only
|
|
7
7
|
// deliberately. The first three address the scene graph; `gui-node` names a node
|
|
8
8
|
// inside the one `.gui` that owns the script, which is not an address at all;
|
|
9
|
-
// `animation` names a block inside
|
|
10
|
-
//
|
|
9
|
+
// `animation` names a block inside an atlas reached through a *companion*
|
|
10
|
+
// parameter of the same call — the sibling literal addressing a sprite
|
|
11
|
+
// component, or the gui node whose scene declares its textures — which is why
|
|
12
|
+
// it is the one class needing a companion;
|
|
11
13
|
// `resource-path` names a project file outright, so it is scoped by the
|
|
12
14
|
// extensions its entry declares rather than by anything in the scene graph;
|
|
13
15
|
// `config-key` names a `<section>.<key>` entry in the project's own
|
|
@@ -28,6 +30,13 @@ export type UrlParameterClass =
|
|
|
28
30
|
| "config-key"
|
|
29
31
|
| "action-id";
|
|
30
32
|
|
|
33
|
+
// Whether an address slot resolves its literal through the message bus, which
|
|
34
|
+
// crosses collection-proxy worlds, or through an instance/component handle,
|
|
35
|
+
// which does not. `msg.post("mylevel:/hero#script", ...)` is the documented
|
|
36
|
+
// proxy idiom; `go.get_position("mylevel:/hero")` fails in the engine's
|
|
37
|
+
// instance resolution.
|
|
38
|
+
export type SocketScope = "same-world" | "cross-world";
|
|
39
|
+
|
|
31
40
|
export interface UrlParameterEntry {
|
|
32
41
|
fqn: string;
|
|
33
42
|
parameter: string;
|
|
@@ -38,6 +47,12 @@ export interface UrlParameterEntry {
|
|
|
38
47
|
// shape would fan the table's one interface out into a union for a single
|
|
39
48
|
// optional field.
|
|
40
49
|
addressParameter?: string;
|
|
50
|
+
// The alternative to `addressParameter`: the parameter naming the gui node
|
|
51
|
+
// this call animates, which scopes the candidates to the `.gui` scene owning
|
|
52
|
+
// the script rather than to a component a sibling literal addresses. An
|
|
53
|
+
// `animation` entry declares exactly one of the two, enforced by the same
|
|
54
|
+
// drift guard and for the same reason.
|
|
55
|
+
nodeParameter?: string;
|
|
41
56
|
// The file extensions this slot's literal may name, each written with its
|
|
42
57
|
// leading dot. Required for `resource-path` and absent otherwise — enforced by
|
|
43
58
|
// the drift guard for the same reason `addressParameter` is. Recorded per
|
|
@@ -51,6 +66,14 @@ export interface UrlParameterEntry {
|
|
|
51
66
|
// is. Unlike `addressParameter` this names a parameter of the surrounding
|
|
52
67
|
// *hook*, not of the classified function.
|
|
53
68
|
comparedParameter?: string;
|
|
69
|
+
// Whether this slot accepts a socket-qualified address naming another world.
|
|
70
|
+
// Required for `game-object`, `component` and `either` and absent otherwise —
|
|
71
|
+
// enforced by the drift guard rather than the type, for the same reason
|
|
72
|
+
// `addressParameter` is. Never defaulted: a slot whose behaviour cannot be
|
|
73
|
+
// established from the engine is `cross-world`, because a wrong `same-world`
|
|
74
|
+
// is a false warning about correct code while a wrong `cross-world` only
|
|
75
|
+
// loses a finding.
|
|
76
|
+
socketScope?: SocketScope;
|
|
54
77
|
// `"generated"` for a slot the emitter derives from the ref-doc, otherwise a
|
|
55
78
|
// package-relative path to the hand-authored `.d.ts` that declares it,
|
|
56
79
|
// resolved against the `packages/types` package root. Not repo-relative: the
|
|
@@ -172,3 +195,19 @@ export function classifyUrlParameter(
|
|
|
172
195
|
}
|
|
173
196
|
return "none";
|
|
174
197
|
}
|
|
198
|
+
|
|
199
|
+
// Whether a socket-qualified address naming a foreign world is legal in this
|
|
200
|
+
// slot. Fails open — an unclassified slot, and a classified one carrying no
|
|
201
|
+
// judgment, both accept — so nothing is reported on a slot nobody judged.
|
|
202
|
+
export function slotAcceptsForeignSocket(
|
|
203
|
+
table: UrlParameterTable,
|
|
204
|
+
fqn: string,
|
|
205
|
+
parameter: string,
|
|
206
|
+
): boolean {
|
|
207
|
+
for (const entry of table) {
|
|
208
|
+
if (entry.fqn === fqn && entry.parameter === parameter) {
|
|
209
|
+
return entry.socketScope !== "same-world";
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return true;
|
|
213
|
+
}
|
package/url-parameters.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"fqn": "go.get_position",
|
|
4
4
|
"parameter": "id",
|
|
5
5
|
"class": "game-object",
|
|
6
|
+
"socketScope": "same-world",
|
|
6
7
|
"source": "generated",
|
|
7
8
|
"evidence": "id of the game object instance to get the position for"
|
|
8
9
|
},
|
|
@@ -10,6 +11,7 @@
|
|
|
10
11
|
"fqn": "go.get_rotation",
|
|
11
12
|
"parameter": "id",
|
|
12
13
|
"class": "game-object",
|
|
14
|
+
"socketScope": "same-world",
|
|
13
15
|
"source": "generated",
|
|
14
16
|
"evidence": "id of the game object instance to get the rotation for"
|
|
15
17
|
},
|
|
@@ -17,6 +19,7 @@
|
|
|
17
19
|
"fqn": "go.get_scale",
|
|
18
20
|
"parameter": "id",
|
|
19
21
|
"class": "game-object",
|
|
22
|
+
"socketScope": "same-world",
|
|
20
23
|
"source": "generated",
|
|
21
24
|
"evidence": "id of the game object instance to get the scale for"
|
|
22
25
|
},
|
|
@@ -24,6 +27,7 @@
|
|
|
24
27
|
"fqn": "go.get_scale_uniform",
|
|
25
28
|
"parameter": "id",
|
|
26
29
|
"class": "game-object",
|
|
30
|
+
"socketScope": "same-world",
|
|
27
31
|
"source": "generated",
|
|
28
32
|
"evidence": "id of the game object instance to get the uniform scale for"
|
|
29
33
|
},
|
|
@@ -31,6 +35,7 @@
|
|
|
31
35
|
"fqn": "go.set_position",
|
|
32
36
|
"parameter": "id",
|
|
33
37
|
"class": "game-object",
|
|
38
|
+
"socketScope": "same-world",
|
|
34
39
|
"source": "generated",
|
|
35
40
|
"evidence": "id of the game object instance to set the position for"
|
|
36
41
|
},
|
|
@@ -38,6 +43,7 @@
|
|
|
38
43
|
"fqn": "go.set_rotation",
|
|
39
44
|
"parameter": "id",
|
|
40
45
|
"class": "game-object",
|
|
46
|
+
"socketScope": "same-world",
|
|
41
47
|
"source": "generated",
|
|
42
48
|
"evidence": "id of the game object instance to get the rotation for"
|
|
43
49
|
},
|
|
@@ -45,6 +51,7 @@
|
|
|
45
51
|
"fqn": "go.set_scale",
|
|
46
52
|
"parameter": "id",
|
|
47
53
|
"class": "game-object",
|
|
54
|
+
"socketScope": "same-world",
|
|
48
55
|
"source": "generated",
|
|
49
56
|
"evidence": "id of the game object instance to get the scale for"
|
|
50
57
|
},
|
|
@@ -52,6 +59,7 @@
|
|
|
52
59
|
"fqn": "go.set_scale_xy",
|
|
53
60
|
"parameter": "id",
|
|
54
61
|
"class": "game-object",
|
|
62
|
+
"socketScope": "same-world",
|
|
55
63
|
"source": "generated",
|
|
56
64
|
"evidence": "id of the game object instance to get the scale for"
|
|
57
65
|
},
|
|
@@ -59,6 +67,7 @@
|
|
|
59
67
|
"fqn": "go.set_parent",
|
|
60
68
|
"parameter": "id",
|
|
61
69
|
"class": "game-object",
|
|
70
|
+
"socketScope": "same-world",
|
|
62
71
|
"source": "generated",
|
|
63
72
|
"evidence": "id of the game object instance to set parent for"
|
|
64
73
|
},
|
|
@@ -66,6 +75,7 @@
|
|
|
66
75
|
"fqn": "go.set_parent",
|
|
67
76
|
"parameter": "parent_id",
|
|
68
77
|
"class": "game-object",
|
|
78
|
+
"socketScope": "same-world",
|
|
69
79
|
"source": "generated",
|
|
70
80
|
"evidence": "id of the new parent game object"
|
|
71
81
|
},
|
|
@@ -73,6 +83,7 @@
|
|
|
73
83
|
"fqn": "go.get_parent",
|
|
74
84
|
"parameter": "id",
|
|
75
85
|
"class": "game-object",
|
|
86
|
+
"socketScope": "same-world",
|
|
76
87
|
"source": "generated",
|
|
77
88
|
"evidence": "id of the game object instance to get parent for"
|
|
78
89
|
},
|
|
@@ -80,6 +91,7 @@
|
|
|
80
91
|
"fqn": "go.get_world_position",
|
|
81
92
|
"parameter": "id",
|
|
82
93
|
"class": "game-object",
|
|
94
|
+
"socketScope": "same-world",
|
|
83
95
|
"source": "generated",
|
|
84
96
|
"evidence": "id of the game object instance to get the world position for"
|
|
85
97
|
},
|
|
@@ -87,6 +99,7 @@
|
|
|
87
99
|
"fqn": "go.get_world_rotation",
|
|
88
100
|
"parameter": "id",
|
|
89
101
|
"class": "game-object",
|
|
102
|
+
"socketScope": "same-world",
|
|
90
103
|
"source": "generated",
|
|
91
104
|
"evidence": "id of the game object instance to get the world rotation for"
|
|
92
105
|
},
|
|
@@ -94,6 +107,7 @@
|
|
|
94
107
|
"fqn": "go.get_world_scale",
|
|
95
108
|
"parameter": "id",
|
|
96
109
|
"class": "game-object",
|
|
110
|
+
"socketScope": "same-world",
|
|
97
111
|
"source": "generated",
|
|
98
112
|
"evidence": "id of the game object instance to get the world scale for"
|
|
99
113
|
},
|
|
@@ -101,6 +115,7 @@
|
|
|
101
115
|
"fqn": "go.get_world_scale_uniform",
|
|
102
116
|
"parameter": "id",
|
|
103
117
|
"class": "game-object",
|
|
118
|
+
"socketScope": "same-world",
|
|
104
119
|
"source": "generated",
|
|
105
120
|
"evidence": "id of the game object instance to get the world scale for"
|
|
106
121
|
},
|
|
@@ -108,6 +123,7 @@
|
|
|
108
123
|
"fqn": "go.get_world_transform",
|
|
109
124
|
"parameter": "id",
|
|
110
125
|
"class": "game-object",
|
|
126
|
+
"socketScope": "same-world",
|
|
111
127
|
"source": "generated",
|
|
112
128
|
"evidence": "id of the game object instance to get the world transform for"
|
|
113
129
|
},
|
|
@@ -115,6 +131,7 @@
|
|
|
115
131
|
"fqn": "go.update_world_transform",
|
|
116
132
|
"parameter": "id",
|
|
117
133
|
"class": "game-object",
|
|
134
|
+
"socketScope": "same-world",
|
|
118
135
|
"source": "generated",
|
|
119
136
|
"evidence": "id of the game object instance to update"
|
|
120
137
|
},
|
|
@@ -122,6 +139,7 @@
|
|
|
122
139
|
"fqn": "go.delete",
|
|
123
140
|
"parameter": "id",
|
|
124
141
|
"class": "game-object",
|
|
142
|
+
"socketScope": "same-world",
|
|
125
143
|
"source": "generated",
|
|
126
144
|
"evidence": "id or table of id's of the instance(s) to delete"
|
|
127
145
|
},
|
|
@@ -129,6 +147,7 @@
|
|
|
129
147
|
"fqn": "go.exists",
|
|
130
148
|
"parameter": "url",
|
|
131
149
|
"class": "game-object",
|
|
150
|
+
"socketScope": "same-world",
|
|
132
151
|
"source": "generated",
|
|
133
152
|
"evidence": "url of the game object to check"
|
|
134
153
|
},
|
|
@@ -136,6 +155,7 @@
|
|
|
136
155
|
"fqn": "go.world_to_local_position",
|
|
137
156
|
"parameter": "url",
|
|
138
157
|
"class": "game-object",
|
|
158
|
+
"socketScope": "same-world",
|
|
139
159
|
"source": "generated",
|
|
140
160
|
"evidence": "url of the game object which coordinate system convert to"
|
|
141
161
|
},
|
|
@@ -143,6 +163,7 @@
|
|
|
143
163
|
"fqn": "go.world_to_local_transform",
|
|
144
164
|
"parameter": "url",
|
|
145
165
|
"class": "game-object",
|
|
166
|
+
"socketScope": "same-world",
|
|
146
167
|
"source": "generated",
|
|
147
168
|
"evidence": "url of the game object which coordinate system convert to"
|
|
148
169
|
},
|
|
@@ -150,6 +171,7 @@
|
|
|
150
171
|
"fqn": "go.animate",
|
|
151
172
|
"parameter": "url",
|
|
152
173
|
"class": "either",
|
|
174
|
+
"socketScope": "same-world",
|
|
153
175
|
"source": "generated",
|
|
154
176
|
"evidence": "url of the game object or component having the property"
|
|
155
177
|
},
|
|
@@ -157,6 +179,7 @@
|
|
|
157
179
|
"fqn": "go.cancel_animations",
|
|
158
180
|
"parameter": "url",
|
|
159
181
|
"class": "either",
|
|
182
|
+
"socketScope": "same-world",
|
|
160
183
|
"source": "generated",
|
|
161
184
|
"evidence": "url of the game object or component"
|
|
162
185
|
},
|
|
@@ -164,24 +187,28 @@
|
|
|
164
187
|
"fqn": "go.get",
|
|
165
188
|
"parameter": "url",
|
|
166
189
|
"class": "either",
|
|
190
|
+
"socketScope": "same-world",
|
|
167
191
|
"source": "src/go-overloads.d.ts"
|
|
168
192
|
},
|
|
169
193
|
{
|
|
170
194
|
"fqn": "go.set",
|
|
171
195
|
"parameter": "url",
|
|
172
196
|
"class": "either",
|
|
197
|
+
"socketScope": "same-world",
|
|
173
198
|
"source": "src/go-overloads.d.ts"
|
|
174
199
|
},
|
|
175
200
|
{
|
|
176
201
|
"fqn": "msg.post",
|
|
177
202
|
"parameter": "receiver",
|
|
178
203
|
"class": "either",
|
|
204
|
+
"socketScope": "cross-world",
|
|
179
205
|
"source": "src/msg-overloads.d.ts"
|
|
180
206
|
},
|
|
181
207
|
{
|
|
182
208
|
"fqn": "msg.url",
|
|
183
209
|
"parameter": "urlstring",
|
|
184
210
|
"class": "either",
|
|
211
|
+
"socketScope": "cross-world",
|
|
185
212
|
"source": "src/msg-overloads.d.ts"
|
|
186
213
|
},
|
|
187
214
|
{
|
|
@@ -199,6 +226,22 @@
|
|
|
199
226
|
"source": "generated",
|
|
200
227
|
"evidence": "hashed id of the animation to play"
|
|
201
228
|
},
|
|
229
|
+
{
|
|
230
|
+
"fqn": "gui.play_flipbook",
|
|
231
|
+
"parameter": "animation",
|
|
232
|
+
"class": "animation",
|
|
233
|
+
"nodeParameter": "node",
|
|
234
|
+
"source": "generated",
|
|
235
|
+
"evidence": "animation id"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"fqn": "model.play_anim",
|
|
239
|
+
"parameter": "anim_id",
|
|
240
|
+
"class": "animation",
|
|
241
|
+
"addressParameter": "url",
|
|
242
|
+
"source": "generated",
|
|
243
|
+
"evidence": "id of the animation to play"
|
|
244
|
+
},
|
|
202
245
|
{
|
|
203
246
|
"fqn": "resource.atlas",
|
|
204
247
|
"parameter": "path",
|