@defold-typescript/types 0.28.3 → 0.30.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.
@@ -955,7 +955,7 @@
955
955
  "physics\u0000FUNCTION\u0000physics.get_joint_reaction_force\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"vector3\"],\"isOptional\":false}]": "function get_joint_reaction_force(collisionobject: string | Hash | Url, joint_id: string | Hash): Vector3;",
956
956
  "physics\u0000FUNCTION\u0000physics.get_joint_reaction_torque\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"number\"],\"isOptional\":false}]": "function get_joint_reaction_torque(collisionobject: string | Hash | Url, joint_id: string | Hash): number;",
957
957
  "physics\u0000FUNCTION\u0000physics.get_maskbit\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"string\"],\"isOptional\":false}]->[{\"types\":[\"boolean\"],\"isOptional\":false}]": "function get_maskbit(url: string | Hash | Url, group: string): boolean;",
958
- "physics\u0000FUNCTION\u0000physics.get_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"table\"],\"isOptional\":false}]": "function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter: number; dimensions: Vector3; diameter: number; height: number };",
958
+ "physics\u0000FUNCTION\u0000physics.get_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"table\"],\"isOptional\":false}]": "function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter?: number; dimensions?: Vector3; height?: number };",
959
959
  "physics\u0000FUNCTION\u0000physics.raycast\u0000[{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":true}]->[{\"types\":[\"nil\",\"table\"],\"isOptional\":false}]": "function raycast(from: Vector3, to: Vector3, groups: Hash[], options?: { all?: boolean }): { fraction: number; position: Vector3; normal: Vector3; id: Hash; group: Hash; request_id: number }[] | undefined;",
960
960
  "physics\u0000FUNCTION\u0000physics.raycast_async\u0000[{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false},{\"types\":[\"number\"],\"isOptional\":true}]->[]": "function raycast_async(from: Vector3, to: Vector3, groups: Hash[], request_id?: number): void;",
961
961
  "physics\u0000FUNCTION\u0000physics.set_event_listener\u0000[{\"types\":[\"function(self, events)\",\"nil\"],\"isOptional\":false}]->[]": "function set_event_listener(callback?: (self: unknown, events: unknown) => void): void;",
@@ -964,7 +964,7 @@
964
964
  "physics\u0000FUNCTION\u0000physics.set_hflip\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"boolean\"],\"isOptional\":false}]->[]": "function set_hflip(url: string | Hash | Url, flip: boolean): void;",
965
965
  "physics\u0000FUNCTION\u0000physics.set_joint_properties\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false}]->[]": "function set_joint_properties(collisionobject: string | Hash | Url, joint_id: string | Hash, properties: { collide_connected?: boolean }): void;",
966
966
  "physics\u0000FUNCTION\u0000physics.set_maskbit\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"string\"],\"isOptional\":false},{\"types\":[\"boolean\"],\"isOptional\":false}]->[]": "function set_maskbit(url: string | Hash | Url, group: string, maskbit: boolean): void;",
967
- "physics\u0000FUNCTION\u0000physics.set_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false}]->[]": "function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; diameter?: number; height?: number }): void;",
967
+ "physics\u0000FUNCTION\u0000physics.set_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false}]->[]": "function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; height?: number }): void;",
968
968
  "physics\u0000FUNCTION\u0000physics.set_vflip\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"boolean\"],\"isOptional\":false}]->[]": "function set_vflip(url: string | Hash | Url, flip: boolean): void;",
969
969
  "physics\u0000FUNCTION\u0000physics.update_mass\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"number\"],\"isOptional\":false}]->[]": "function update_mass(collisionobject: string | Hash | Url, mass: number): void;",
970
970
  "physics\u0000FUNCTION\u0000physics.wakeup\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false}]->[]": "function wakeup(url: string | Hash | Url): void;",
@@ -2266,7 +2266,7 @@
2266
2266
  "physics\u0000FUNCTION\u0000physics.get_joint_reaction_force\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"vector3\"],\"isOptional\":false}]": "function get_joint_reaction_force(collisionobject: string | Hash | Url, joint_id: string | Hash): Vector3;",
2267
2267
  "physics\u0000FUNCTION\u0000physics.get_joint_reaction_torque\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"number\"],\"isOptional\":false}]": "function get_joint_reaction_torque(collisionobject: string | Hash | Url, joint_id: string | Hash): number;",
2268
2268
  "physics\u0000FUNCTION\u0000physics.get_maskbit\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"string\"],\"isOptional\":false}]->[{\"types\":[\"boolean\"],\"isOptional\":false}]": "function get_maskbit(url: string | Hash | Url, group: string): boolean;",
2269
- "physics\u0000FUNCTION\u0000physics.get_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"table\"],\"isOptional\":false}]": "function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter: number; dimensions: Vector3; diameter: number; height: number };",
2269
+ "physics\u0000FUNCTION\u0000physics.get_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"table\"],\"isOptional\":false}]": "function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter?: number; dimensions?: Vector3; height?: number };",
2270
2270
  "physics\u0000FUNCTION\u0000physics.raycast\u0000[{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":true}]->[{\"types\":[\"nil\",\"table\"],\"isOptional\":false}]": "function raycast(from: Vector3, to: Vector3, groups: Hash[], options?: { all?: boolean }): { fraction: number; position: Vector3; normal: Vector3; id: Hash; group: Hash; request_id: number }[] | undefined;",
2271
2271
  "physics\u0000FUNCTION\u0000physics.raycast_async\u0000[{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false},{\"types\":[\"number\"],\"isOptional\":true}]->[]": "function raycast_async(from: Vector3, to: Vector3, groups: Hash[], request_id?: number): void;",
2272
2272
  "physics\u0000FUNCTION\u0000physics.set_event_listener\u0000[{\"types\":[\"function(self, events)\",\"nil\"],\"isOptional\":false}]->[]": "function set_event_listener(callback?: (self: unknown, events: unknown) => void): void;",
@@ -2275,7 +2275,7 @@
2275
2275
  "physics\u0000FUNCTION\u0000physics.set_hflip\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"boolean\"],\"isOptional\":false}]->[]": "function set_hflip(url: string | Hash | Url, flip: boolean): void;",
2276
2276
  "physics\u0000FUNCTION\u0000physics.set_joint_properties\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false}]->[]": "function set_joint_properties(collisionobject: string | Hash | Url, joint_id: string | Hash, properties: { collide_connected?: boolean }): void;",
2277
2277
  "physics\u0000FUNCTION\u0000physics.set_maskbit\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"string\"],\"isOptional\":false},{\"types\":[\"boolean\"],\"isOptional\":false}]->[]": "function set_maskbit(url: string | Hash | Url, group: string, maskbit: boolean): void;",
2278
- "physics\u0000FUNCTION\u0000physics.set_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false}]->[]": "function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; diameter?: number; height?: number }): void;",
2278
+ "physics\u0000FUNCTION\u0000physics.set_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false}]->[]": "function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; height?: number }): void;",
2279
2279
  "physics\u0000FUNCTION\u0000physics.set_vflip\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"boolean\"],\"isOptional\":false}]->[]": "function set_vflip(url: string | Hash | Url, flip: boolean): void;",
2280
2280
  "physics\u0000FUNCTION\u0000physics.update_mass\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"number\"],\"isOptional\":false}]->[]": "function update_mass(collisionobject: string | Hash | Url, mass: number): void;",
2281
2281
  "physics\u0000FUNCTION\u0000physics.wakeup\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false}]->[]": "function wakeup(url: string | Hash | Url): void;",
@@ -3279,7 +3279,7 @@
3279
3279
  "physics\u0000FUNCTION\u0000physics.get_joint_reaction_force\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"vector3\"],\"isOptional\":false}]": "function get_joint_reaction_force(collisionobject: string | Hash | Url, joint_id: string | Hash): Vector3;",
3280
3280
  "physics\u0000FUNCTION\u0000physics.get_joint_reaction_torque\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"number\"],\"isOptional\":false}]": "function get_joint_reaction_torque(collisionobject: string | Hash | Url, joint_id: string | Hash): number;",
3281
3281
  "physics\u0000FUNCTION\u0000physics.get_maskbit\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"string\"],\"isOptional\":false}]->[{\"types\":[\"boolean\"],\"isOptional\":false}]": "function get_maskbit(url: string | Hash | Url, group: string): boolean;",
3282
- "physics\u0000FUNCTION\u0000physics.get_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"table\"],\"isOptional\":false}]": "function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter: number; dimensions: Vector3; diameter: number; height: number };",
3282
+ "physics\u0000FUNCTION\u0000physics.get_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false}]->[{\"types\":[\"table\"],\"isOptional\":false}]": "function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter?: number; dimensions?: Vector3; height?: number };",
3283
3283
  "physics\u0000FUNCTION\u0000physics.raycast\u0000[{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":true}]->[{\"types\":[\"nil\",\"table\"],\"isOptional\":false}]": "function raycast(from: Vector3, to: Vector3, groups: Hash[], options?: { all?: boolean }): { fraction: number; position: Vector3; normal: Vector3; id: Hash; group: Hash; request_id: number }[] | undefined;",
3284
3284
  "physics\u0000FUNCTION\u0000physics.raycast_async\u0000[{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"vector3\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false},{\"types\":[\"number\"],\"isOptional\":true}]->[]": "function raycast_async(from: Vector3, to: Vector3, groups: Hash[], request_id?: number): void;",
3285
3285
  "physics\u0000FUNCTION\u0000physics.set_event_listener\u0000[{\"types\":[\"function(self, events)\",\"nil\"],\"isOptional\":false}]->[]": "function set_event_listener(callback?: (self: unknown, events: unknown) => void): void;",
@@ -3288,7 +3288,7 @@
3288
3288
  "physics\u0000FUNCTION\u0000physics.set_hflip\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"boolean\"],\"isOptional\":false}]->[]": "function set_hflip(url: string | Hash | Url, flip: boolean): void;",
3289
3289
  "physics\u0000FUNCTION\u0000physics.set_joint_properties\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false}]->[]": "function set_joint_properties(collisionobject: string | Hash | Url, joint_id: string | Hash, properties: { collide_connected?: boolean }): void;",
3290
3290
  "physics\u0000FUNCTION\u0000physics.set_maskbit\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"string\"],\"isOptional\":false},{\"types\":[\"boolean\"],\"isOptional\":false}]->[]": "function set_maskbit(url: string | Hash | Url, group: string, maskbit: boolean): void;",
3291
- "physics\u0000FUNCTION\u0000physics.set_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false}]->[]": "function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; diameter?: number; height?: number }): void;",
3291
+ "physics\u0000FUNCTION\u0000physics.set_shape\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"hash\",\"string\"],\"isOptional\":false},{\"types\":[\"table\"],\"isOptional\":false}]->[]": "function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; height?: number }): void;",
3292
3292
  "physics\u0000FUNCTION\u0000physics.set_vflip\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"boolean\"],\"isOptional\":false}]->[]": "function set_vflip(url: string | Hash | Url, flip: boolean): void;",
3293
3293
  "physics\u0000FUNCTION\u0000physics.update_mass\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false},{\"types\":[\"number\"],\"isOptional\":false}]->[]": "function update_mass(collisionobject: string | Hash | Url, mass: number): void;",
3294
3294
  "physics\u0000FUNCTION\u0000physics.wakeup\u0000[{\"types\":[\"hash\",\"string\",\"url\"],\"isOptional\":false}]->[]": "function wakeup(url: string | Hash | Url): void;",
@@ -181,7 +181,7 @@ declare global {
181
181
  * end
182
182
  * `
183
183
  */
184
- function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter: number; dimensions: Vector3; diameter: number; height: number };
184
+ function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter?: number; dimensions?: Vector3; height?: number };
185
185
  /**
186
186
  * Ray casts are used to test for intersections against collision objects in the physics world.
187
187
  * Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
@@ -472,7 +472,7 @@ declare global {
472
472
  * end
473
473
  * `
474
474
  */
475
- function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; diameter?: number; height?: number }): void;
475
+ function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; height?: number }): void;
476
476
  /**
477
477
  * Flips the collision shapes vertically for a collision object
478
478
  *
@@ -1,3 +1,5 @@
1
+ /// <reference types="lua-types/5.1" />
2
+ /// <reference types="lua-types/special/jit-only" />
1
3
  import "./b2d";
2
4
  import "./b2d_body";
3
5
  import "./buffer";
@@ -183,7 +183,7 @@ declare global {
183
183
  * end
184
184
  * `
185
185
  */
186
- function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter: number; dimensions: Vector3; diameter: number; height: number };
186
+ function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter?: number; dimensions?: Vector3; height?: number };
187
187
  /**
188
188
  * Ray casts are used to test for intersections against collision objects in the physics world.
189
189
  * Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
@@ -474,7 +474,7 @@ declare global {
474
474
  * end
475
475
  * `
476
476
  */
477
- function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; diameter?: number; height?: number }): void;
477
+ function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; height?: number }): void;
478
478
  /**
479
479
  * Flips the collision shapes vertically for a collision object
480
480
  *
@@ -1,3 +1,5 @@
1
+ /// <reference types="lua-types/5.1" />
2
+ /// <reference types="lua-types/special/jit-only" />
1
3
  import "./b2d";
2
4
  import "./b2d_body";
3
5
  import "./b2d_chain";
@@ -181,7 +181,7 @@ declare global {
181
181
  * end
182
182
  * `
183
183
  */
184
- function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter: number; dimensions: Vector3; diameter: number; height: number };
184
+ function get_shape(url: string | Hash | Url, shape: string | Hash): { type: number; diameter?: number; dimensions?: Vector3; height?: number };
185
185
  /**
186
186
  * Ray casts are used to test for intersections against collision objects in the physics world.
187
187
  * Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
@@ -472,7 +472,7 @@ declare global {
472
472
  * end
473
473
  * `
474
474
  */
475
- function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; diameter?: number; height?: number }): void;
475
+ function set_shape(url: string | Hash | Url, shape: string | Hash, table: { type?: number; diameter?: number; dimensions?: Vector3; height?: number }): void;
476
476
  /**
477
477
  * Flips the collision shapes vertically for a collision object
478
478
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defold-typescript/types",
3
- "version": "0.28.3",
3
+ "version": "0.30.0",
4
4
  "description": "TypeScript types for the Defold engine's Lua APIs.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -2,17 +2,25 @@ import { mkdirSync, writeFileSync } from "node:fs";
2
2
  import { dirname, resolve } from "node:path";
3
3
  import {
4
4
  type ApiTarget,
5
+ generateBuiltinMessagesDeclaration,
5
6
  generateModuleDeclaration,
6
7
  generateVersionIndex,
7
8
  KIND_MODULE_MANIFEST,
8
9
  type KindManifestEntry,
9
10
  kindStdlibReferences,
11
+ loadSrcAugmentations,
10
12
  loadTargetEditorModules,
13
+ MESSAGES_MANIFEST,
11
14
  type ResolveTargetOptions,
12
15
  resolveTargetModules,
13
16
  } from "./regen";
14
17
 
15
- export { RUNTIME_KIND_MANIFEST, targetKindManifest } from "./regen";
18
+ export { RUNTIME_KIND_MANIFEST, SRC_AUGMENTATION_MODULES, targetKindManifest } from "./regen";
19
+
20
+ // The surface's own `core-types` module: a re-export of the installed package's,
21
+ // so every declaration in the surface reaches the brand types through a
22
+ // specifier that resolves from the surface root wherever it is written.
23
+ export const CORE_TYPES_REEXPORT = 'export * from "@defold-typescript/types/core-types";\n';
16
24
 
17
25
  export interface RenderMaterializedKindIndexOptions {
18
26
  readonly kind: string;
@@ -64,6 +72,10 @@ export interface BuildVersionedSurfaceOptions {
64
72
  // file and its aggregate-index import. Lets a caller narrow the surface to a
65
73
  // script kind without the generator knowing what a script kind is.
66
74
  readonly excludeModules?: readonly string[];
75
+ // The hand-authored `src/*` augmentations to carry beside the modules.
76
+ // Defaults to reading them from the types package on disk; a caller with no
77
+ // filesystem (a Worker) supplies the bytes and gets an identical file map.
78
+ readonly augmentations?: readonly VersionedSurfaceFile[];
67
79
  }
68
80
 
69
81
  export interface MaterializeVersionedSurfaceOptions extends BuildVersionedSurfaceOptions {
@@ -82,6 +94,15 @@ export interface VersionedSurfaceFile {
82
94
  // the aggregate side-effect entrypoint and a minimal package.json. Pure — no
83
95
  // `node:fs` — so a Worker with no filesystem can serve a version generated at
84
96
  // request time; `materializeVersionedSurface` is the disk sink over the same map.
97
+ // A surface is self-contained: every declaration reaches `core-types` through a
98
+ // specifier relative to the surface root, not through the target's in-repo
99
+ // `coreTypesImport`. An editor VM module sits one directory down and so needs
100
+ // the deeper form.
101
+ function surfaceCoreTypesImport(outFile: string): string {
102
+ const depth = outFile.split("/").length - 1;
103
+ return depth === 0 ? "./core-types" : `${"../".repeat(depth)}core-types`;
104
+ }
105
+
85
106
  export async function buildVersionedSurfaceFiles(
86
107
  target: ApiTarget,
87
108
  opts: BuildVersionedSurfaceOptions = {},
@@ -99,15 +120,46 @@ export async function buildVersionedSurfaceFiles(
99
120
  opts.resolveOpts?.packageRoot ?? undefined,
100
121
  ).filter((entry) => kept(entry.outFile));
101
122
 
123
+ const augmentations = (
124
+ opts.augmentations ?? loadSrcAugmentations(opts.resolveOpts?.packageRoot ?? undefined)
125
+ ).filter((file) => kept(file.path));
126
+
102
127
  const files: VersionedSurfaceFile[] = [...modules, ...editorModules].map((entry) => ({
103
128
  path: entry.outFile,
104
- contents: generateModuleDeclaration(entry).contents,
129
+ contents: generateModuleDeclaration({
130
+ ...entry,
131
+ importsFrom: surfaceCoreTypesImport(entry.outFile),
132
+ }).contents,
105
133
  }));
106
134
 
135
+ files.push(...augmentations);
136
+ files.push({ path: "core-types.d.ts", contents: CORE_TYPES_REEXPORT });
137
+
138
+ // A generated sibling rather than a `src/*` augmentation, so it falls outside
139
+ // `SRC_AUGMENTATION_MODULES` — but the carried `msg-overloads` and
140
+ // `message-guard` reference `BuiltinMessages`, so a surface without it ships
141
+ // dangling names. The emit is version-independent, so render it here.
142
+ const generated = [
143
+ {
144
+ path: MESSAGES_MANIFEST.outFile,
145
+ contents: generateBuiltinMessagesDeclaration(MESSAGES_MANIFEST, {
146
+ importsFrom: surfaceCoreTypesImport(MESSAGES_MANIFEST.outFile),
147
+ }),
148
+ },
149
+ ].filter((file) => kept(file.path));
150
+ files.push(...generated);
151
+
107
152
  // The aggregate entrypoint stays the runtime surface: importing the editor VM
108
- // there would drag it into every program that pins this version.
153
+ // there would drag it into every program that pins this version. `core-types`
154
+ // is type-only and stays out of it, exactly as on the packaged path.
109
155
  const versioned = modules.map((entry) => ({ ...entry, versionId: target.id }));
110
- files.push({ path: "index.d.ts", contents: generateVersionIndex(target.id, versioned) });
156
+ files.push({
157
+ path: "index.d.ts",
158
+ contents: generateVersionIndex(target.id, versioned, [
159
+ ...generated.map((file) => file.path.replace(/\.d\.ts$/, "")),
160
+ ...augmentations.map((file) => file.path.replace(/\.d\.ts$/, "")),
161
+ ]),
162
+ });
111
163
 
112
164
  files.push({
113
165
  path: "package.json",
package/scripts/regen.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  } from "../src/emit-dts";
11
11
  import {
12
12
  applyMessageDeprecations,
13
+ type EmitBuiltinMessagesOptions,
13
14
  emitBuiltinMessages,
14
15
  parseMessagesDoc,
15
16
  } from "../src/emit-messages";
@@ -359,8 +360,11 @@ export const MESSAGES_MANIFEST: MessagesManifestEntry = {
359
360
  outFile: "builtin-messages.d.ts",
360
361
  };
361
362
 
362
- export function generateBuiltinMessagesDeclaration(entry: MessagesManifestEntry): string {
363
- return emitBuiltinMessages(applyMessageDeprecations(parseMessagesDoc(entry.doc)));
363
+ export function generateBuiltinMessagesDeclaration(
364
+ entry: MessagesManifestEntry,
365
+ opts: EmitBuiltinMessagesOptions = {},
366
+ ): string {
367
+ return emitBuiltinMessages(applyMessageDeprecations(parseMessagesDoc(entry.doc)), opts);
364
368
  }
365
369
 
366
370
  export interface GenerateResult {
@@ -551,6 +555,34 @@ const UNIVERSAL_EXTRA_IMPORTS: readonly string[] = [
551
555
  "../../src/vmath-overloads",
552
556
  ];
553
557
 
558
+ const SRC_IMPORT_PREFIX = "../../src/";
559
+
560
+ // The hand-authored `src/*` augmentations a complete script surface needs,
561
+ // derived from the one declaration the generated kind index renders from so a
562
+ // new augmentation reaches every materialization path with no second edit.
563
+ export const SRC_AUGMENTATION_MODULES: readonly string[] = UNIVERSAL_EXTRA_IMPORTS.filter(
564
+ (specifier) => specifier.startsWith(SRC_IMPORT_PREFIX),
565
+ ).map((specifier) => specifier.slice(SRC_IMPORT_PREFIX.length));
566
+
567
+ // Read those augmentations as surface-root files. Mirrors
568
+ // `loadTargetEditorModules`: a missing file throws with its path rather than
569
+ // filtering silently, so a renamed augmentation fails loud instead of vanishing
570
+ // from every materialized surface.
571
+ export function loadSrcAugmentations(
572
+ packageRoot: string = PACKAGE_ROOT,
573
+ ): { path: string; contents: string }[] {
574
+ return SRC_AUGMENTATION_MODULES.map((name) => {
575
+ const from = resolve(packageRoot, "src", `${name}.d.ts`);
576
+ let contents: string;
577
+ try {
578
+ contents = readFileSync(from, "utf8");
579
+ } catch {
580
+ throw new Error(`src augmentation "${name}" not found: ${from}`);
581
+ }
582
+ return { path: `${name}.d.ts`, contents };
583
+ });
584
+ }
585
+
554
586
  const DEFAULT_FACTORY_MODULE = "../../src/lifecycle";
555
587
 
556
588
  export interface KindManifestEntry {
@@ -654,14 +686,23 @@ export function generateKindIndex(kind: string, target: ApiTarget = DEFAULT_TARG
654
686
  export function generateVersionIndex(
655
687
  versionId: string,
656
688
  manifest: readonly VersionedModuleManifestEntry[] = VERSIONED_MODULE_MANIFEST,
689
+ // Bare names appended after the module imports. A materialized surface carries
690
+ // the `src/*` augmentations beside its modules; the in-repo emit does not.
691
+ extraImports: readonly string[] = [],
657
692
  ): string {
658
- const imports = manifest
659
- .filter((entry) => entry.versionId === versionId && entry.editor !== true)
660
- .map((entry) => entry.outFile.replace(/\.d\.ts$/, ""))
661
- .sort()
693
+ const imports = [
694
+ ...manifest
695
+ .filter((entry) => entry.versionId === versionId && entry.editor !== true)
696
+ .map((entry) => entry.outFile.replace(/\.d\.ts$/, ""))
697
+ .sort(),
698
+ ...extraImports,
699
+ ]
662
700
  .map((module) => `import "./${module}";`)
663
701
  .join("\n");
664
- return `${imports}\n\nexport {};\n`;
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`;
665
706
  }
666
707
 
667
708
  // The `src/`-relative prefix a kind index living in `<generatedDir>/kinds/` needs
package/src/emit-dts.ts CHANGED
@@ -392,6 +392,21 @@ const B2D_CAST_HIT_FIELDS: readonly TableField[] = [
392
392
  { name: "fraction", types: ["number"] },
393
393
  ];
394
394
 
395
+ // The physics shape record, shared by `physics.get_shape`'s return and
396
+ // `physics.set_shape`'s cross-referencing `table` param. The ref-doc describes
397
+ // it as one `<dl>` for the common `type` field followed by one `<dl>` per shape
398
+ // kind (sphere: `diameter`; box: `dimensions`; capsule: `diameter` + `height`),
399
+ // which parseTableFields flattens into a single list — emitting `diameter`
400
+ // twice. Field order is the doc's first-occurrence order, and every
401
+ // kind-specific field is optional because only one kind's fields are present
402
+ // per value.
403
+ const PHYSICS_SHAPE_TABLE_FIELDS: readonly TableField[] = [
404
+ { name: "type", types: ["number"] },
405
+ { name: "diameter", types: ["number"], optional: true },
406
+ { name: "dimensions", types: ["vector3"], optional: true },
407
+ { name: "height", types: ["number"], optional: true },
408
+ ];
409
+
395
410
  export const TABLE_SLOT_CURATIONS: ReadonlyMap<string, TableSlotCuration> = new Map([
396
411
  ["collectionfactory.create:return:ids", { kind: "mapping", key: "hash", value: "hash" }],
397
412
  // font.get_info's `info` return is a `<dl>` with `path: hash` and a nested
@@ -1045,6 +1060,8 @@ export const TABLE_SLOT_CURATIONS: ReadonlyMap<string, TableSlotCuration> = new
1045
1060
  ["b2d.world.cast_mover:param:filter", { kind: "object", fields: B2D_MOVER_FILTER_FIELDS }],
1046
1061
  ["b2d.world.collide_mover:param:capsule", { kind: "object", fields: B2D_CAPSULE_FIELDS }],
1047
1062
  ["b2d.world.collide_mover:param:filter", { kind: "object", fields: B2D_MOVER_FILTER_FIELDS }],
1063
+ ["physics.get_shape:return:table", { kind: "object", fields: PHYSICS_SHAPE_TABLE_FIELDS }],
1064
+ ["physics.set_shape:param:table", { kind: "object", fields: PHYSICS_SHAPE_TABLE_FIELDS }],
1048
1065
  ]);
1049
1066
 
1050
1067
  // Slot-keyed (`element:param:name`, mirroring TABLE_SLOT_CURATIONS) replacements
@@ -140,7 +140,17 @@ function parsePayload(raw: unknown): MessageField[] {
140
140
  return fields;
141
141
  }
142
142
 
143
- export function emitBuiltinMessages(catalog: MessageCatalog): string {
143
+ export interface EmitBuiltinMessagesOptions {
144
+ // Where the brand types are reached from. Defaults to the committed
145
+ // `generated/` emit's sibling-relative path; a materialized surface has no
146
+ // `src/` above it and supplies its own surface-root specifier.
147
+ readonly importsFrom?: string;
148
+ }
149
+
150
+ export function emitBuiltinMessages(
151
+ catalog: MessageCatalog,
152
+ opts: EmitBuiltinMessagesOptions = {},
153
+ ): string {
144
154
  const entries = [...catalog.entries].sort((a, b) => a.name.localeCompare(b.name));
145
155
  const body = entries.map(emitEntry).join("\n");
146
156
  const inner = [
@@ -155,8 +165,9 @@ export function emitBuiltinMessages(catalog: MessageCatalog): string {
155
165
  "",
156
166
  ].join("\n");
157
167
  const used = collectEngineTypes(inner);
168
+ const importsFrom = opts.importsFrom ?? "../src/core-types";
158
169
  const importLine =
159
- used.length === 0 ? "" : `import type { ${used.join(", ")} } from "../src/core-types";\n\n`;
170
+ used.length === 0 ? "" : `import type { ${used.join(", ")} } from "${importsFrom}";\n\n`;
160
171
  return `${importLine}${inner}`;
161
172
  }
162
173