@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.
Files changed (86) hide show
  1. package/api-availability.json +2755 -0
  2. package/api-migrations.json +31 -0
  3. package/api-signatures.json +2324 -0
  4. package/api-targets.json +493 -45
  5. package/generated/b2d.d.ts +6 -0
  6. package/generated/b2d_body.d.ts +329 -1
  7. package/generated/b2d_chain.d.ts +106 -0
  8. package/generated/b2d_fixture.d.ts +155 -0
  9. package/generated/b2d_joint.d.ts +823 -0
  10. package/generated/b2d_shape.d.ts +215 -0
  11. package/generated/b2d_world.d.ts +314 -0
  12. package/generated/builtin-messages.d.ts +18 -0
  13. package/generated/camera.d.ts +62 -5
  14. package/generated/compute.d.ts +306 -0
  15. package/generated/go.d.ts +29 -4
  16. package/generated/graphics.d.ts +95 -0
  17. package/generated/gui.d.ts +1 -3
  18. package/generated/json.d.ts +2 -2
  19. package/generated/kinds/gui-script.d.ts +7 -0
  20. package/generated/kinds/render-script.d.ts +7 -0
  21. package/generated/kinds/script.d.ts +7 -0
  22. package/generated/label.d.ts +1 -1
  23. package/generated/liveupdate.d.ts +22 -4
  24. package/generated/material.d.ts +444 -0
  25. package/generated/model.d.ts +46 -5
  26. package/generated/physics.d.ts +1 -3
  27. package/generated/profiler.d.ts +2 -3
  28. package/generated/render.d.ts +25 -9
  29. package/generated/resource.d.ts +2 -2
  30. package/generated/sprite.d.ts +15 -1
  31. package/generated/tilemap.d.ts +14 -0
  32. package/generated/versions/defold-1.12.4/b2d.d.ts +27 -0
  33. package/generated/versions/defold-1.12.4/b2d_body.d.ts +348 -0
  34. package/generated/versions/defold-1.12.4/buffer.d.ts +176 -0
  35. package/generated/versions/defold-1.12.4/camera.d.ts +245 -0
  36. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +146 -0
  37. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +71 -0
  38. package/generated/versions/defold-1.12.4/crash.d.ts +143 -0
  39. package/generated/versions/defold-1.12.4/factory.d.ts +123 -0
  40. package/generated/versions/defold-1.12.4/font.d.ts +81 -0
  41. package/generated/versions/defold-1.12.4/go.d.ts +1029 -0
  42. package/generated/versions/defold-1.12.4/graphics.d.ts +226 -0
  43. package/generated/versions/defold-1.12.4/gui.d.ts +2372 -0
  44. package/generated/versions/defold-1.12.4/html5.d.ts +53 -0
  45. package/generated/versions/defold-1.12.4/http.d.ts +84 -0
  46. package/generated/versions/defold-1.12.4/iac.d.ts +18 -0
  47. package/generated/versions/defold-1.12.4/iap.d.ts +60 -0
  48. package/generated/versions/defold-1.12.4/image.d.ts +139 -0
  49. package/generated/versions/defold-1.12.4/index.d.ts +41 -0
  50. package/generated/versions/defold-1.12.4/json.d.ts +76 -0
  51. package/generated/versions/defold-1.12.4/label.d.ts +94 -0
  52. package/generated/versions/defold-1.12.4/liveupdate.d.ts +122 -0
  53. package/generated/versions/defold-1.12.4/model.d.ts +205 -0
  54. package/generated/versions/defold-1.12.4/msg.d.ts +10 -0
  55. package/generated/versions/defold-1.12.4/particlefx.d.ts +166 -0
  56. package/generated/versions/defold-1.12.4/physics.d.ts +547 -0
  57. package/generated/versions/defold-1.12.4/profiler.d.ts +234 -0
  58. package/generated/versions/defold-1.12.4/push.d.ts +66 -0
  59. package/generated/versions/defold-1.12.4/render.d.ts +1149 -0
  60. package/generated/versions/defold-1.12.4/resource.d.ts +1518 -0
  61. package/generated/versions/defold-1.12.4/socket.d.ts +795 -0
  62. package/generated/versions/defold-1.12.4/sound.d.ts +291 -0
  63. package/generated/versions/defold-1.12.4/sprite.d.ts +143 -0
  64. package/generated/versions/defold-1.12.4/sys.d.ts +695 -0
  65. package/generated/versions/defold-1.12.4/tilemap.d.ts +181 -0
  66. package/generated/versions/defold-1.12.4/timer.d.ts +114 -0
  67. package/generated/versions/defold-1.12.4/types.d.ts +61 -0
  68. package/generated/versions/defold-1.12.4/vmath.d.ts +806 -0
  69. package/generated/versions/defold-1.12.4/webview.d.ts +68 -0
  70. package/generated/versions/defold-1.12.4/window.d.ts +198 -0
  71. package/generated/versions/defold-1.12.4/zlib.d.ts +40 -0
  72. package/index.d.ts +22 -0
  73. package/package.json +8 -1
  74. package/scripts/fidelity-audit.ts +69 -12
  75. package/scripts/fidelity-baseline.json +56 -0
  76. package/scripts/generate-api-availability.ts +139 -0
  77. package/scripts/generate-api-signatures.ts +66 -0
  78. package/scripts/import-defold-release.ts +480 -0
  79. package/scripts/regen.ts +53 -6
  80. package/scripts/sync-api-docs.ts +89 -41
  81. package/src/api-availability.ts +0 -0
  82. package/src/core-types.ts +9 -0
  83. package/src/emit-dts.ts +674 -17
  84. package/src/emit-messages.ts +72 -2
  85. package/src/index.ts +26 -1
  86. package/src/lifecycle.ts +43 -2
package/scripts/regen.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { resolve } from "node:path";
3
3
  import messagesDoc from "../fixtures/messages_doc.json" with { type: "json" };
4
- import { parseDefoldApiDoc } from "../src/api-doc";
5
- import { emitDeclarations } from "../src/emit-dts";
6
- import { emitBuiltinMessages, parseMessagesDoc } from "../src/emit-messages";
4
+ import { type ApiModule, parseDefoldApiDoc } from "../src/api-doc";
5
+ import { emitDeclarations, emitSymbolSignatures, type SymbolSignature } from "../src/emit-dts";
6
+ import {
7
+ applyMessageDeprecations,
8
+ emitBuiltinMessages,
9
+ parseMessagesDoc,
10
+ } from "../src/emit-messages";
7
11
  import type { TranslationStore } from "../src/example-store";
8
12
  import { wrapAsAmbientGlobal } from "../src/publish-dts";
9
13
  import {
@@ -143,6 +147,15 @@ const DEFAULT_TARGET = API_TARGETS.find((t) => t.default === true) as ApiTarget;
143
147
 
144
148
  export const MODULE_MANIFEST: readonly ModuleManifestEntry[] = loadTargetModules(DEFAULT_TARGET);
145
149
 
150
+ // The fidelity audit runs over the promoted default surface (the `default: true`
151
+ // target) so the 1.13-only modules (b2d.*, compute, material) and the 1.13 model
152
+ // additions are audited too — auditing the older 1.12.4 target left them unseen,
153
+ // which is how the promoted surface shipped opaque `Record` fallbacks while the
154
+ // gate read `recordTables: 0`.
155
+ const FIDELITY_BASELINE_TARGET = DEFAULT_TARGET;
156
+ export const FIDELITY_BASELINE_MANIFEST: readonly ModuleManifestEntry[] =
157
+ loadTargetModules(FIDELITY_BASELINE_TARGET);
158
+
146
159
  export interface MessagesManifestEntry {
147
160
  readonly doc: unknown;
148
161
  readonly outFile: string;
@@ -158,7 +171,7 @@ export const MESSAGES_MANIFEST: MessagesManifestEntry = {
158
171
  };
159
172
 
160
173
  export function generateBuiltinMessagesDeclaration(entry: MessagesManifestEntry): string {
161
- return emitBuiltinMessages(parseMessagesDoc(entry.doc));
174
+ return emitBuiltinMessages(applyMessageDeprecations(parseMessagesDoc(entry.doc)));
162
175
  }
163
176
 
164
177
  export interface GenerateResult {
@@ -185,10 +198,21 @@ export interface GenerateOptions {
185
198
  translations?: TranslationStore;
186
199
  }
187
200
 
188
- export function generateModuleDeclaration(
201
+ interface PreparedGeneratedModule {
202
+ module: ApiModule;
203
+ knownConstantFqns: ReadonlySet<string>;
204
+ translations: TranslationStore;
205
+ dropped: string[];
206
+ }
207
+
208
+ // Parse a manifest entry, apply its `skipFunctions` filter, and resolve the
209
+ // shared constant-brand universe and translations. Both the `.d.ts` emit and
210
+ // the authoritative-signature emit run off this identical prepared module, so a
211
+ // dropped member never appears in either surface.
212
+ function prepareGeneratedModule(
189
213
  entry: ModuleManifestEntry,
190
214
  options?: GenerateOptions,
191
- ): GenerateResult {
215
+ ): PreparedGeneratedModule {
192
216
  const module = parseDefoldApiDoc(entry.doc);
193
217
  const prefix = `${module.namespace}.`;
194
218
  const dropped: string[] = [];
@@ -203,6 +227,17 @@ export function generateModuleDeclaration(
203
227
  });
204
228
  const knownConstantFqns = options?.knownConstantFqns ?? collectConstantFqns();
205
229
  const translations = options?.translations ?? loadTranslations();
230
+ return { module, knownConstantFqns, translations, dropped };
231
+ }
232
+
233
+ export function generateModuleDeclaration(
234
+ entry: ModuleManifestEntry,
235
+ options?: GenerateOptions,
236
+ ): GenerateResult {
237
+ const { module, knownConstantFqns, translations, dropped } = prepareGeneratedModule(
238
+ entry,
239
+ options,
240
+ );
206
241
  const emitted = emitDeclarations(module, { knownConstantFqns, translations });
207
242
  const contents = wrapAsAmbientGlobal({
208
243
  namespace: module.namespace,
@@ -212,6 +247,18 @@ export function generateModuleDeclaration(
212
247
  return { contents, dropped };
213
248
  }
214
249
 
250
+ // The authoritative per-symbol signatures for a manifest entry, rendered through
251
+ // the same prepared module (skip filter + constant branding) as
252
+ // `generateModuleDeclaration`, so every signature corresponds to the committed
253
+ // `.d.ts` byte-for-byte.
254
+ export function generateModuleSignatures(
255
+ entry: ModuleManifestEntry,
256
+ options?: GenerateOptions,
257
+ ): SymbolSignature[] {
258
+ const { module, knownConstantFqns } = prepareGeneratedModule(entry, options);
259
+ return emitSymbolSignatures(module, { knownConstantFqns });
260
+ }
261
+
215
262
  export interface VersionedModuleManifestEntry extends ModuleManifestEntry {
216
263
  readonly versionId: string;
217
264
  }
@@ -6,7 +6,7 @@ import { DEFOLD_TYPE_MAP } from "../src/core-types";
6
6
  import { parseScriptApi } from "../src/script-api";
7
7
  import { MODULE_MANIFEST } from "./regen";
8
8
 
9
- export const DEFOLD_VERSION = "1.12.4";
9
+ export const DEFOLD_VERSION = "1.13.0";
10
10
  export const refDocUrl = (version = DEFOLD_VERSION): string =>
11
11
  `https://github.com/defold/defold/releases/download/${version}/ref-doc.zip`;
12
12
 
@@ -26,52 +26,71 @@ export interface SyncManifestEntry {
26
26
  // so each path is confirmed against the pinned release artifact, not derived.
27
27
  export const SYNC_MANIFEST: readonly SyncManifestEntry[] = [
28
28
  entry("b2d", "doc/scripts-box2d-script_box2d.cpp_doc.json"),
29
- // On-disk name uses underscores to avoid a double-dotted filename; the namespace
30
- // string stays `b2d.body` so /api/b2d.body routes correctly and the emitter
31
- // produces `declare global { namespace b2d.body { ... } }`. Use the non-`_defold`
32
- // variant — the `_defold` variant has duplicate `get_world_center` elements.
33
- entry(
34
- "b2d.body",
35
- "doc/scripts-box2d-script_box2d_body.cpp_doc.json",
36
- "fixtures/b2d_body_doc.json",
37
- ),
29
+ // Box2D 1.13.0 documents the v2 and v3 backends separately. On-disk dotted
30
+ // namespaces use underscores while the namespace itself stays dotted.
31
+ entry("b2d.body", "doc/scripts-box2d-v2-script_box2d_body_v2.cpp_doc.json", undefined, [
32
+ "doc/scripts-box2d-v3-script_box2d_body_v3.cpp_doc.json",
33
+ ]),
34
+ entry("b2d.chain", "doc/scripts-box2d-v3-script_box2d_chain_v3.cpp_doc.json"),
35
+ entry("b2d.fixture", "doc/scripts-box2d-v2-script_box2d_fixture_v2.cpp_doc.json"),
36
+ entry("b2d.joint", "doc/scripts-box2d-v2-script_box2d_joint_v2.cpp_doc.json", undefined, [
37
+ "doc/scripts-box2d-v3-script_box2d_joint_v3.cpp_doc.json",
38
+ ]),
39
+ entry("b2d.shape", "doc/scripts-box2d-v2-script_box2d_shape_v2.cpp_doc.json", undefined, [
40
+ "doc/scripts-box2d-v3-script_box2d_shape_v3.cpp_doc.json",
41
+ ]),
42
+ entry("b2d.world", "doc/scripts-box2d-v2-script_box2d_world_v2.cpp_doc.json", undefined, [
43
+ "doc/scripts-box2d-v3-script_box2d_world_v3.cpp_doc.json",
44
+ ]),
38
45
  entry("buffer", "doc/scripts-script_buffer.cpp_doc.json"),
39
- // camera's Lua surface lives in the render-script doc, not the scripts-script
40
- // one (`doc/scripts-script_camera.cpp_doc.json` is empty upstream in 1.12.4).
41
- entry("camera", "doc/render-render_script_camera.cpp_doc.json"),
46
+ // Camera and component namespaces merge their DDF messages/properties into
47
+ // the callable script API so release snapshots retain every declared symbol.
48
+ entry("camera", "doc/gamesys-camera_ddf.proto_doc.json", undefined, [
49
+ "doc/render-render_script_camera.cpp_doc.json",
50
+ ]),
42
51
  entry("collectionfactory", "doc/scripts-script_collection_factory.cpp_doc.json"),
43
52
  entry("collectionproxy", "doc/scripts-script_collectionproxy.cpp_doc.json"),
53
+ entry("compute", "doc/scripts-script_compute.cpp_doc.json"),
44
54
  entry("crash", "doc/script_crash.cpp_doc.json"),
45
55
  entry("factory", "doc/scripts-script_factory.cpp_doc.json"),
46
56
  entry("font", "doc/scripts-script_font.cpp_doc.json"),
47
- entry("go", "doc/gameobject_script.cpp_doc.json"),
57
+ entry("go", "doc/gameobject-gameobject_ddf.proto_doc.json", undefined, [
58
+ "doc/gameobject_script.cpp_doc.json",
59
+ ]),
48
60
  entry("graphics", "doc/src-script_graphics.cpp_doc.json"),
49
- entry("gui", "doc/gui_script.cpp_doc.json"),
61
+ entry("gui", "doc/gamesys-gui_ddf.proto_doc.json", undefined, ["doc/gui_script.cpp_doc.json"]),
50
62
  entry("html5", "doc/src-script_html5_js.cpp_doc.json"),
51
63
  entry("http", "doc/scripts-script_http.cpp_doc.json"),
52
64
  entry("image", "doc/scripts-script_image.cpp_doc.json"),
53
65
  entry("json", "doc/src-script_json.cpp_doc.json"),
54
- entry("label", "doc/scripts-script_label.cpp_doc.json"),
66
+ entry("label", "doc/gamesys-label_ddf.proto_doc.json", undefined, [
67
+ "doc/scripts-script_label.cpp_doc.json",
68
+ ]),
55
69
  entry("liveupdate", "doc/src-script_liveupdate.h_doc.json"),
56
- entry("model", "doc/scripts-script_model.cpp_doc.json"),
70
+ entry("material", "doc/scripts-script_material.cpp_doc.json"),
71
+ entry("model", "doc/gamesys-model_ddf.proto_doc.json", undefined, [
72
+ "doc/scripts-script_model.cpp_doc.json",
73
+ ]),
57
74
  entry("msg", "doc/src-script_msg.cpp_doc.json"),
58
75
  entry("particlefx", "doc/scripts-script_particlefx.cpp_doc.json"),
59
- entry("physics", "doc/scripts-script_physics.cpp_doc.json"),
76
+ entry("physics", "doc/gamesys-physics_ddf.proto_doc.json", undefined, [
77
+ "doc/scripts-script_physics.cpp_doc.json",
78
+ ]),
60
79
  entry("profiler", "doc/profiler.cpp_doc.json"),
61
- entry("render", "doc/render-render_script.cpp_doc.json"),
80
+ entry("render", "doc/render-render_ddf.proto_doc.json", undefined, [
81
+ "doc/render-render_script.cpp_doc.json",
82
+ ]),
62
83
  entry("resource", "doc/scripts-script_resource.cpp_doc.json"),
63
84
  entry("socket", "doc/luasocket-luasocket.doc_h_doc.json"),
64
85
  entry("sound", "doc/scripts-script_sound.cpp_doc.json"),
65
- entry("sprite", "doc/scripts-script_sprite.cpp_doc.json"),
66
- // The `sys` Lua surface is split across three docs in ref-doc.zip: the core
67
- // (src-script_sys), the gamesys subset (`load_buffer`/`load_buffer_async` plus
68
- // the `REQUEST_STATUS_*` constants), and the engine doc (`set_engine_throttle`/
69
- // `set_render_enable`). `mergeEntries` folds all three into one fixture at sync
70
- // time. The `*_ddf.proto` doc is deliberately excluded — it is message-shaped
71
- // and owned by the builtin-messages catalog.
72
- entry("sys", "doc/src-script_sys.cpp_doc.json", "fixtures/sys_doc.json", [
86
+ entry("sprite", "doc/gamesys-sprite_ddf.proto_doc.json", undefined, [
87
+ "doc/scripts-script_sprite.cpp_doc.json",
88
+ ]),
89
+ // The sys surface spans core, gamesys, engine, and DDF documents in 1.13.0.
90
+ entry("sys", "doc/script-script_engine.cpp_doc.json", undefined, [
91
+ "doc/script-sys_ddf.proto_doc.json",
73
92
  "doc/scripts-script_sys_gamesys.cpp_doc.json",
74
- "doc/script-script_engine.cpp_doc.json",
93
+ "doc/src-script_sys.cpp_doc.json",
75
94
  ]),
76
95
  entry("tilemap", "doc/scripts-script_tilemap.cpp_doc.json"),
77
96
  entry("timer", "doc/src-script_timer.cpp_doc.json"),
@@ -118,7 +137,7 @@ export const IGNORED_UPSTREAM: ReadonlyMap<string, string> = new Map([
118
137
  export const LUA_STDLIB_MANIFEST: readonly SyncManifestEntry[] = [
119
138
  entry("base", "doc/lua_base.doc_h_doc.json"),
120
139
  entry("bit", "doc/src-script_bitop.cpp_doc.json"),
121
- // Core Lua stdlib docs. The 1.12.4 release names these `doc/lua_<ns>.doc_h_doc.json`
140
+ // Core Lua stdlib docs. The 1.13.0 release names these `doc/lua_<ns>.doc_h_doc.json`
122
141
  // (confirmed against the pinned ref-doc.zip, not derived — the naming drifted from
123
142
  // the 1.9.8 `doc/<ns>_doc.json` form). Typed by the lua-types dependency, so docs-only.
124
143
  entry("math", "doc/lua_math.doc_h_doc.json"),
@@ -127,7 +146,7 @@ export const LUA_STDLIB_MANIFEST: readonly SyncManifestEntry[] = [
127
146
  entry("table", "doc/lua_table.doc_h_doc.json"),
128
147
  entry("coroutine", "doc/lua_coroutine.doc_h_doc.json"),
129
148
  // Sandboxed-runtime stdlib surfaces. Defold sandboxes the Lua VM, but the pinned
130
- // 1.12.4 ref-doc.zip documents all three with real function elements; types stay
149
+ // 1.13.0 ref-doc.zip documents all three with real function elements; types stay
131
150
  // owned by lua-types (core/{debug,io}.d.ts + core/modules.d.ts for `package`).
132
151
  entry("debug", "doc/lua_debug.doc_h_doc.json"),
133
152
  entry("io", "doc/lua_io.doc_h_doc.json"),
@@ -137,7 +156,7 @@ export const LUA_STDLIB_MANIFEST: readonly SyncManifestEntry[] = [
137
156
  function entry(
138
157
  namespace: string,
139
158
  zipEntry: string,
140
- fixture: string = `fixtures/${namespace}_doc.json`,
159
+ fixture: string = `fixtures/defold-1.13.0/${namespace.replace(/\./g, "_")}_doc.json`,
141
160
  mergeEntries?: readonly string[],
142
161
  ): SyncManifestEntry {
143
162
  return { namespace, zipEntry, fixture, ...(mergeEntries ? { mergeEntries } : {}) };
@@ -163,7 +182,13 @@ export const EXTENSION_MANIFEST: readonly ExtensionManifestEntry[] = [
163
182
  ];
164
183
 
165
184
  function ext(namespace: string, repo: string, tag: string, path: string): ExtensionManifestEntry {
166
- return { namespace, repo, tag, path, fixture: `fixtures/${namespace}_doc.json` };
185
+ return {
186
+ namespace,
187
+ repo,
188
+ tag,
189
+ path,
190
+ fixture: `fixtures/defold-1.13.0/${namespace}_doc.json`,
191
+ };
167
192
  }
168
193
 
169
194
  export const extensionRawUrl = (e: ExtensionManifestEntry): string =>
@@ -249,22 +274,20 @@ function isRecord(value: unknown): value is Record<string, unknown> {
249
274
  return typeof value === "object" && value !== null && !Array.isArray(value);
250
275
  }
251
276
 
252
- // Concatenate the `elements` of every doc into the first doc, deduping by
253
- // (name, type) with first occurrence winning, and keep the first doc's `info`.
254
- // First-wins guards the `b2d.body` `_defold` duplicate-`get_world_center`
255
- // hazard. Operates on the raw ref-doc JSON shape (`{ info, elements }`), so the
256
- // result is still parseable by `parseDefoldApiDoc`.
277
+ // Concatenate the `elements` of every doc into the first doc, deduping exact
278
+ // API signatures with first occurrence winning, and keep the first doc's
279
+ // `info`. Function signatures include parameters and returns because the same
280
+ // namespace can expose backend-specific overloads under one function name.
257
281
  export function mergeApiDocs(docs: readonly unknown[]): unknown {
258
282
  const first = docs[0];
259
283
  const seen = new Set<string>();
260
284
  const elements: unknown[] = [];
261
285
  for (const doc of docs) {
262
286
  if (!isRecord(doc) || !Array.isArray(doc.elements)) continue;
287
+ const info = isRecord(doc.info) ? doc.info : null;
288
+ const namespace = info && typeof info.namespace === "string" ? info.namespace : "";
263
289
  for (const element of doc.elements) {
264
- const key =
265
- isRecord(element) && typeof element.name === "string" && typeof element.type === "string"
266
- ? `${element.type}${element.name}`
267
- : null;
290
+ const key = apiElementIdentity(namespace, element);
268
291
  if (key !== null) {
269
292
  if (seen.has(key)) continue;
270
293
  seen.add(key);
@@ -275,6 +298,31 @@ export function mergeApiDocs(docs: readonly unknown[]): unknown {
275
298
  return isRecord(first) ? { ...first, elements } : { elements };
276
299
  }
277
300
 
301
+ export function apiElementIdentity(namespace: string, element: unknown): string | null {
302
+ if (!isRecord(element) || typeof element.name !== "string" || typeof element.type !== "string") {
303
+ return null;
304
+ }
305
+ const base = `${namespace}\0${element.type}\0${element.name}`;
306
+ if (element.type !== "FUNCTION") return base;
307
+ return `${base}\0${normalizedArguments(element.parameters)}\0${normalizedArguments(element.returnvalues)}`;
308
+ }
309
+
310
+ function normalizedArguments(value: unknown): string {
311
+ if (!Array.isArray(value)) return "[]";
312
+ return JSON.stringify(
313
+ value.map((argument) => {
314
+ if (!isRecord(argument)) return argument;
315
+ const types = Array.isArray(argument.types)
316
+ ? argument.types.filter((type): type is string => typeof type === "string").sort()
317
+ : [];
318
+ return {
319
+ types,
320
+ ...(argument.is_optional === undefined ? {} : { is_optional: argument.is_optional }),
321
+ };
322
+ }),
323
+ );
324
+ }
325
+
278
326
  export function extractFixtures(
279
327
  zip: ZipAccessor,
280
328
  manifest: readonly SyncManifestEntry[] = SYNC_MANIFEST,
Binary file
package/src/core-types.ts CHANGED
@@ -188,6 +188,9 @@ export const DEFOLD_TYPE_MAP: Readonly<Record<string, string>> = {
188
188
  vector4: "Vector4",
189
189
  quaternion: "Quaternion",
190
190
  matrix4: "Matrix4",
191
+ "vmath.vector3": "Vector3",
192
+ "vmath.vector4": "Vector4",
193
+ "vmath.matrix4": "Matrix4",
191
194
  hash: "Hash",
192
195
  url: "Url",
193
196
  node: 'Opaque<"node">',
@@ -201,6 +204,12 @@ export const DEFOLD_TYPE_MAP: Readonly<Record<string, string>> = {
201
204
  resource: 'Opaque<"resource">',
202
205
  b2World: 'Opaque<"b2World">',
203
206
  b2Body: 'Opaque<"b2Body">',
207
+ b2Chain: 'Opaque<"b2Chain">',
208
+ b2Shape: 'Opaque<"b2Shape">',
209
+ b2Joint: 'Opaque<"b2Joint">',
210
+ b2ContactEdge: 'Opaque<"b2ContactEdge">',
211
+ b2MassData: 'Opaque<"b2MassData">',
212
+ b2Transform: 'Opaque<"b2Transform">',
204
213
  b2BodyType:
205
214
  '(number & { readonly __brand: "b2d.body.B2_DYNAMIC_BODY" }) | (number & { readonly __brand: "b2d.body.B2_KINEMATIC_BODY" }) | (number & { readonly __brand: "b2d.body.B2_STATIC_BODY" })',
206
215
  // socket handle types resolve to the method-bearing `interface <receiver>`