@defold-typescript/library-types 0.23.0 → 0.25.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 (130) hide show
  1. package/NOTICE +2 -3
  2. package/api-doc/boom.json +3872 -0
  3. package/api-doc/bridge.json +10 -5
  4. package/api-doc/bzAnim.json +338 -0
  5. package/api-doc/checkpoint.json +127 -0
  6. package/api-doc/decore.json +1 -1
  7. package/api-doc/defcon.json +150 -0
  8. package/api-doc/{defmath.defmath.json → defmath.json} +6 -46
  9. package/api-doc/defsave.json +518 -0
  10. package/api-doc/deftest.json +745 -0
  11. package/api-doc/{dicebag.dicebag.json → dicebag.json} +19 -1
  12. package/api-doc/druid.json +90 -92
  13. package/api-doc/event.json +16 -16
  14. package/api-doc/gooey.json +2050 -0
  15. package/api-doc/in.accelerometer.json +75 -1
  16. package/api-doc/in.button.json +17 -10
  17. package/api-doc/in.cursor.json +26 -0
  18. package/api-doc/in.gesture.json +401 -6
  19. package/api-doc/in.keyboard.json +2 -0
  20. package/api-doc/in.mapper.json +12 -8
  21. package/api-doc/in.onscreen.json +61 -5
  22. package/api-doc/in.state.json +61 -13
  23. package/api-doc/in.textbox.json +23 -12
  24. package/api-doc/in.triggers.json +336 -0
  25. package/api-doc/lang.json +5 -5
  26. package/api-doc/log.json +1 -1
  27. package/api-doc/metrics.fps.json +61 -2
  28. package/api-doc/metrics.mem.json +61 -2
  29. package/api-doc/monarch.monarch.json +249 -7
  30. package/api-doc/monarch.transitions.easings.json +19 -26
  31. package/api-doc/monarch.transitions.gui.json +782 -79
  32. package/api-doc/nakama.engine.defold.json +31 -18
  33. package/api-doc/{nakama.nakama.json → nakama.json} +4752 -2554
  34. package/api-doc/nakama.session.json +315 -0
  35. package/api-doc/nakama.socket.json +3356 -0
  36. package/api-doc/nakama.util.log.json +32 -4
  37. package/api-doc/narrator.json +1 -1
  38. package/api-doc/openapi/nakama.nakama.json +7680 -0
  39. package/api-doc/orthographic.camera.json +96 -98
  40. package/api-doc/orthographic.json +602 -0
  41. package/api-doc/panthera.json +1183 -0
  42. package/api-doc/{persist.persist.json → persist.json} +26 -1
  43. package/api-doc/{platypus.platypus.json → platypus.json} +68 -14
  44. package/api-doc/{rendy.rendy.json → rendy.json} +46 -99
  45. package/api-doc/richtext.color.json +77 -0
  46. package/api-doc/richtext.richtext.json +375 -5
  47. package/api-doc/saver.saver.json +2 -1
  48. package/api-doc/saver.storage.json +2 -1
  49. package/api-doc/shutter.json +551 -0
  50. package/api-doc/{yagames.yagames.json → yagames.json} +784 -189
  51. package/api-doc/{zzfx.api.json → zzfx.json} +9 -9
  52. package/authored-targets.json +433 -0
  53. package/generated/{boom.boom.d.ts → boom.d.ts} +14 -0
  54. package/generated/bridge.d.ts +5 -5
  55. package/generated/{bzAnim.bzLibrary.d.ts → bzAnim.d.ts} +6 -0
  56. package/generated/checkpoint.d.ts +62 -0
  57. package/generated/decore.d.ts +1 -1
  58. package/generated/defcon.d.ts +43 -0
  59. package/generated/{defmath.defmath.d.ts → defmath.d.ts} +3 -2
  60. package/generated/defsave.d.ts +144 -0
  61. package/generated/{dicebag.dicebag.d.ts → dicebag.d.ts} +25 -0
  62. package/generated/druid.d.ts +81 -79
  63. package/generated/event.d.ts +15 -15
  64. package/generated/{gooey.gooey.d.ts → gooey.d.ts} +61 -6
  65. package/generated/in.onscreen.d.ts +5 -0
  66. package/generated/in.textbox.d.ts +4 -0
  67. package/generated/lang.d.ts +5 -5
  68. package/generated/log.d.ts +1 -1
  69. package/generated/metrics.fps.d.ts +19 -1
  70. package/generated/metrics.mem.d.ts +19 -1
  71. package/generated/monarch.monarch.d.ts +44 -1
  72. package/generated/monarch.transitions.easings.d.ts +0 -1
  73. package/generated/monarch.transitions.gui.d.ts +96 -12
  74. package/generated/nakama.d.ts +1158 -0
  75. package/generated/nakama.engine.defold.d.ts +3 -1
  76. package/generated/nakama.session.d.ts +95 -0
  77. package/generated/nakama.socket.d.ts +706 -0
  78. package/generated/nakama.util.log.d.ts +6 -0
  79. package/generated/narrator.d.ts +1 -1
  80. package/generated/openapi/nakama.nakama.d.ts +884 -0
  81. package/generated/orthographic.camera.d.ts +24 -38
  82. package/generated/orthographic.d.ts +155 -0
  83. package/generated/panthera.d.ts +170 -0
  84. package/generated/{persist.persist.d.ts → persist.d.ts} +3 -0
  85. package/generated/{platypus.platypus.d.ts → platypus.d.ts} +9 -0
  86. package/generated/proto.d.ts +4 -4
  87. package/generated/{rendy.rendy.d.ts → rendy.d.ts} +33 -80
  88. package/generated/richtext.color.d.ts +15 -0
  89. package/generated/saver.saver.d.ts +2 -0
  90. package/generated/saver.storage.d.ts +2 -0
  91. package/generated/shutter.d.ts +183 -0
  92. package/generated/{yagames.yagames.d.ts → yagames.d.ts} +151 -29
  93. package/generated/{zzfx.api.d.ts → zzfx.d.ts} +7 -0
  94. package/library-classification.json +0 -156
  95. package/library-targets.json +1 -218
  96. package/luals-targets.json +56 -3
  97. package/openapi-targets.json +17 -0
  98. package/package.json +7 -57
  99. package/scripts/__snapshots__/parse-luals.test.ts.snap +164 -10
  100. package/scripts/apply-luals-overrides.ts +39 -7
  101. package/scripts/authored-parity.ts +718 -0
  102. package/scripts/emit-library-dts.ts +94 -17
  103. package/scripts/extract-api-doc.ts +214 -42
  104. package/scripts/fidelity-floor.ts +178 -0
  105. package/scripts/import-upstream-docs.ts +125 -0
  106. package/scripts/lower-api-doc.ts +21 -3
  107. package/scripts/luals-fidelity.ts +16 -11
  108. package/scripts/map-luals-types.ts +52 -21
  109. package/scripts/parse-lua-surface.ts +187 -0
  110. package/scripts/parse-luals.ts +50 -4
  111. package/scripts/parse-markdown-api.ts +247 -0
  112. package/scripts/parse-openapi-api.ts +313 -0
  113. package/scripts/sync-authored-types.ts +249 -0
  114. package/scripts/sync-library-types.ts +99 -3
  115. package/scripts/sync-luals-types.ts +14 -1
  116. package/scripts/sync-markdown-types.ts +761 -0
  117. package/scripts/sync-openapi-types.ts +308 -0
  118. package/scripts/sync-script-api-types.ts +16 -17
  119. package/api-doc/boom.boom.json +0 -26
  120. package/api-doc/bzAnim.bzLibrary.json +0 -156
  121. package/api-doc/defcon.console.json +0 -109
  122. package/api-doc/defsave.defsave.json +0 -175
  123. package/api-doc/deftest.deftest.json +0 -71
  124. package/api-doc/gooey.gooey.json +0 -963
  125. package/api-doc/starly.starly.json +0 -488
  126. package/generated/defcon.console.d.ts +0 -24
  127. package/generated/defsave.defsave.d.ts +0 -31
  128. package/generated/nakama.nakama.d.ts +0 -594
  129. package/generated/starly.starly.d.ts +0 -148
  130. /package/generated/{deftest.deftest.d.ts → deftest.d.ts} +0 -0
@@ -4140,6 +4140,7 @@ Create text node with druid: \`text = druid:new_text(node_name, [initial_value],
4140
4140
  },
4141
4141
  {
4142
4142
  "brief": "Set text to text field",
4143
+ "deprecated": "",
4143
4144
  "generics": [],
4144
4145
  "name": "set_to",
4145
4146
  "params": [
@@ -9461,7 +9462,16 @@ Create layout component with druid: \`layout = druid:new_layout(node, layout_typ
9461
9462
  "isVararg": false,
9462
9463
  "name": "",
9463
9464
  "types": [
9464
- "number, number",
9465
+ "number",
9466
+ ],
9467
+ },
9468
+ {
9469
+ "doc": "",
9470
+ "isOptional": false,
9471
+ "isVararg": false,
9472
+ "name": "",
9473
+ "types": [
9474
+ "number",
9465
9475
  ],
9466
9476
  },
9467
9477
  ],
@@ -13118,7 +13128,25 @@ If color_id is not found in palette and not a hex string, returns white."
13118
13128
  "isVararg": false,
13119
13129
  "name": "",
13120
13130
  "types": [
13121
- "number, number, number",
13131
+ "number",
13132
+ ],
13133
+ },
13134
+ {
13135
+ "doc": "",
13136
+ "isOptional": false,
13137
+ "isVararg": false,
13138
+ "name": "",
13139
+ "types": [
13140
+ "number",
13141
+ ],
13142
+ },
13143
+ {
13144
+ "doc": "",
13145
+ "isOptional": false,
13146
+ "isVararg": false,
13147
+ "name": "",
13148
+ "types": [
13149
+ "number",
13122
13150
  ],
13123
13151
  },
13124
13152
  ],
@@ -13210,7 +13238,34 @@ If color_id is not found in palette and not a hex string, returns white."
13210
13238
  "isVararg": false,
13211
13239
  "name": "",
13212
13240
  "types": [
13213
- "number, number, number, number",
13241
+ "number",
13242
+ ],
13243
+ },
13244
+ {
13245
+ "doc": "",
13246
+ "isOptional": false,
13247
+ "isVararg": false,
13248
+ "name": "",
13249
+ "types": [
13250
+ "number",
13251
+ ],
13252
+ },
13253
+ {
13254
+ "doc": "",
13255
+ "isOptional": false,
13256
+ "isVararg": false,
13257
+ "name": "",
13258
+ "types": [
13259
+ "number",
13260
+ ],
13261
+ },
13262
+ {
13263
+ "doc": "",
13264
+ "isOptional": false,
13265
+ "isVararg": false,
13266
+ "name": "",
13267
+ "types": [
13268
+ "number",
13214
13269
  ],
13215
13270
  },
13216
13271
  ],
@@ -13265,7 +13320,34 @@ If color_id is not found in palette and not a hex string, returns white."
13265
13320
  "isVararg": false,
13266
13321
  "name": "",
13267
13322
  "types": [
13268
- "number, number, number, number|nil",
13323
+ "number",
13324
+ ],
13325
+ },
13326
+ {
13327
+ "doc": "",
13328
+ "isOptional": false,
13329
+ "isVararg": false,
13330
+ "name": "",
13331
+ "types": [
13332
+ "number",
13333
+ ],
13334
+ },
13335
+ {
13336
+ "doc": "",
13337
+ "isOptional": false,
13338
+ "isVararg": false,
13339
+ "name": "",
13340
+ "types": [
13341
+ "number",
13342
+ ],
13343
+ },
13344
+ {
13345
+ "doc": "",
13346
+ "isOptional": false,
13347
+ "isVararg": false,
13348
+ "name": "",
13349
+ "types": [
13350
+ "number|nil",
13269
13351
  ],
13270
13352
  },
13271
13353
  ],
@@ -14354,7 +14436,16 @@ Only one widget can be set per game object."
14354
14436
  "isVararg": false,
14355
14437
  "name": "",
14356
14438
  "types": [
14357
- "table|nil, string|nil",
14439
+ "table|nil",
14440
+ ],
14441
+ },
14442
+ {
14443
+ "doc": "",
14444
+ "isOptional": false,
14445
+ "isVararg": false,
14446
+ "name": "",
14447
+ "types": [
14448
+ "string|nil",
14358
14449
  ],
14359
14450
  },
14360
14451
  ],
@@ -14393,7 +14484,16 @@ The path file extension will be used to determine the Defold format (*.atlas, *.
14393
14484
  "isVararg": false,
14394
14485
  "name": "",
14395
14486
  "types": [
14396
- "boolean, string|nil",
14487
+ "boolean",
14488
+ ],
14489
+ },
14490
+ {
14491
+ "doc": "",
14492
+ "isOptional": false,
14493
+ "isVararg": false,
14494
+ "name": "",
14495
+ "types": [
14496
+ "string|nil",
14397
14497
  ],
14398
14498
  },
14399
14499
  ],
@@ -14664,13 +14764,22 @@ The path file extension will be used to determine the Defold format (*.atlas, *.
14664
14764
  },
14665
14765
  ],
14666
14766
  "returns": [
14767
+ {
14768
+ "doc": "",
14769
+ "isOptional": false,
14770
+ "isVararg": false,
14771
+ "name": "",
14772
+ "types": [
14773
+ "string|nil",
14774
+ ],
14775
+ },
14667
14776
  {
14668
14777
  "doc": "@success, reason",
14669
14778
  "isOptional": false,
14670
14779
  "isVararg": false,
14671
14780
  "name": "",
14672
14781
  "types": [
14673
- "string|nil, string|nil",
14782
+ "string|nil",
14674
14783
  ],
14675
14784
  },
14676
14785
  ],
@@ -14700,13 +14809,22 @@ The path file extension will be used to determine the Defold format (*.atlas, *.
14700
14809
  },
14701
14810
  ],
14702
14811
  "returns": [
14812
+ {
14813
+ "doc": "",
14814
+ "isOptional": false,
14815
+ "isVararg": false,
14816
+ "name": "",
14817
+ "types": [
14818
+ "boolean",
14819
+ ],
14820
+ },
14703
14821
  {
14704
14822
  "doc": "@success, reason",
14705
14823
  "isOptional": false,
14706
14824
  "isVararg": false,
14707
14825
  "name": "",
14708
14826
  "types": [
14709
- "boolean, string|nil",
14827
+ "string|nil",
14710
14828
  ],
14711
14829
  },
14712
14830
  ],
@@ -14744,13 +14862,40 @@ The path file extension will be used to determine the Defold format (*.atlas, *.
14744
14862
  },
14745
14863
  ],
14746
14864
  "returns": [
14865
+ {
14866
+ "doc": "",
14867
+ "isOptional": false,
14868
+ "isVararg": false,
14869
+ "name": "",
14870
+ "types": [
14871
+ "string",
14872
+ ],
14873
+ },
14874
+ {
14875
+ "doc": "",
14876
+ "isOptional": false,
14877
+ "isVararg": false,
14878
+ "name": "",
14879
+ "types": [
14880
+ "string",
14881
+ ],
14882
+ },
14883
+ {
14884
+ "doc": "",
14885
+ "isOptional": false,
14886
+ "isVararg": false,
14887
+ "name": "",
14888
+ "types": [
14889
+ "string",
14890
+ ],
14891
+ },
14747
14892
  {
14748
14893
  "doc": "@new_object_name, name, value, end_struct_flag",
14749
14894
  "isOptional": false,
14750
14895
  "isVararg": false,
14751
14896
  "name": "",
14752
14897
  "types": [
14753
- "string, string, string, boolean",
14898
+ "boolean",
14754
14899
  ],
14755
14900
  },
14756
14901
  ],
@@ -15705,13 +15850,22 @@ Offset shown in [-0.5 .. 0.5] range, where -0.5 is left or bottom, 0.5 is right
15705
15850
  },
15706
15851
  ],
15707
15852
  "returns": [
15853
+ {
15854
+ "doc": "",
15855
+ "isOptional": false,
15856
+ "isVararg": false,
15857
+ "name": "",
15858
+ "types": [
15859
+ "string",
15860
+ ],
15861
+ },
15708
15862
  {
15709
15863
  "doc": "String representation of table, Is max string length reached",
15710
15864
  "isOptional": false,
15711
15865
  "isVararg": false,
15712
15866
  "name": "result",
15713
15867
  "types": [
15714
- "string, boolean",
15868
+ "boolean",
15715
15869
  ],
15716
15870
  },
15717
15871
  ],
@@ -2,19 +2,29 @@
2
2
  * Per-target corrections applied to a parsed `LibraryModel` after the merge, for the
3
3
  * cases where upstream LuaLS annotations diverge from the library's runtime and the
4
4
  * fixtures freeze the annotation verbatim (so it is not hand-patchable in the fixture
5
- * or the emitted `.d.ts`). The two shapes covered are a module function whose trailing
6
- * parameter is runtime-optional despite a non-`|nil` `@param`, and an interface method
7
- * whose `@return` omits an alternative arm. Every named target must exist a missing
8
- * function, param, interface, or method throws naming the absent key, mirroring
9
- * `buildTargetModel`'s loud-fail on an absent `ownFile`, so a stale override never
10
- * degrades into a silent no-op.
5
+ * or the emitted `.d.ts`). The five shapes covered are a module function whose trailing
6
+ * parameter is runtime-optional despite a non-`|nil` `@param`, an interface method
7
+ * whose `@return` omits an alternative arm, an interface field whose type token is
8
+ * wrong or underspecified (a stray character, or an untyped `fun(...)` callback), an
9
+ * interface method parameter with the same underspecification, and an interface field
10
+ * that only restates a member inherited from a parent, incompatibly enough that the
11
+ * emitted redeclaration would not type-check (`drop`). Every named target
12
+ * must exist — a missing function, param, interface, field, or method throws naming the
13
+ * absent key, mirroring `buildTargetModel`'s loud-fail on an absent `ownFile`, so a
14
+ * stale override never degrades into a silent no-op.
11
15
  */
12
16
 
13
17
  import type { LibraryModel } from "./parse-luals";
14
18
 
15
19
  export interface AnnotationOverrides {
16
20
  moduleFunctions?: Record<string, { params?: Record<string, { optional?: boolean }> }>;
17
- interfaces?: Record<string, { methods?: Record<string, { return?: string }> }>;
21
+ interfaces?: Record<
22
+ string,
23
+ {
24
+ fields?: Record<string, { type?: string; drop?: boolean }>;
25
+ methods?: Record<string, { return?: string; params?: Record<string, { type?: string }> }>;
26
+ }
27
+ >;
18
28
  }
19
29
 
20
30
  export function applyAnnotationOverrides(
@@ -45,6 +55,19 @@ export function applyAnnotationOverrides(
45
55
  `applyAnnotationOverrides: interface "${ifaceName}" is absent from the model.`,
46
56
  );
47
57
  }
58
+ for (const [fieldName, fieldOverride] of Object.entries(ifaceOverride.fields ?? {})) {
59
+ const field = iface.fields.find((f) => f.name === fieldName);
60
+ if (!field) {
61
+ throw new Error(
62
+ `applyAnnotationOverrides: field "${fieldName}" of interface "${ifaceName}" is absent from the model.`,
63
+ );
64
+ }
65
+ if (fieldOverride.drop) {
66
+ iface.fields.splice(iface.fields.indexOf(field), 1);
67
+ continue;
68
+ }
69
+ if (fieldOverride.type !== undefined) field.types = [fieldOverride.type];
70
+ }
48
71
  for (const [methodName, methodOverride] of Object.entries(ifaceOverride.methods ?? {})) {
49
72
  const method = iface.methods.find((m) => m.name === methodName);
50
73
  if (!method) {
@@ -57,6 +80,15 @@ export function applyAnnotationOverrides(
57
80
  { name: "", types: [methodOverride.return], doc: "", isOptional: false, isVararg: false },
58
81
  ];
59
82
  }
83
+ for (const [paramName, paramOverride] of Object.entries(methodOverride.params ?? {})) {
84
+ const param = method.params.find((p) => p.name === paramName);
85
+ if (!param) {
86
+ throw new Error(
87
+ `applyAnnotationOverrides: param "${paramName}" of method "${methodName}" of interface "${ifaceName}" is absent from the model.`,
88
+ );
89
+ }
90
+ if (paramOverride.type !== undefined) param.types = [paramOverride.type];
91
+ }
60
92
  }
61
93
  }
62
94
  return model;