@defold-typescript/types 0.11.3 → 0.11.5

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/index.d.ts CHANGED
@@ -81,3 +81,8 @@ export {
81
81
  type ScriptProperty,
82
82
  } from "./src/lifecycle";
83
83
  export { type WrapOptions, wrapAsAmbientGlobal } from "./src/publish-dts";
84
+ export {
85
+ lookupSignature,
86
+ type SignatureOverride,
87
+ type SignatureStore,
88
+ } from "./src/signature-store";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defold-typescript/types",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "description": "TypeScript types for the Defold engine's Lua APIs.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/scripts/regen.ts CHANGED
@@ -148,6 +148,10 @@ export interface MessagesManifestEntry {
148
148
  readonly outFile: string;
149
149
  }
150
150
 
151
+ // Unlike MODULE_MANIFEST, this surface is hand-maintained: Defold ships no
152
+ // machine-readable export for built-in message ids, so refresh fixtures/
153
+ // messages_doc.json by hand from the Defold API reference. The
154
+ // message-payload-drift test guards the payload shapes against drift.
151
155
  export const MESSAGES_MANIFEST: MessagesManifestEntry = {
152
156
  doc: messagesDoc,
153
157
  outFile: "builtin-messages.d.ts",
@@ -0,0 +1,33 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { resolve } from "node:path";
3
+ import type { SignatureStore } from "../src/signature-store";
4
+
5
+ // Build-time only: lives under `scripts/` (never reachable from the shipped
6
+ // `src/index.ts` graph) so its `node:fs` import cannot leak into a consumer's
7
+ // typecheck. `src/signature-store.ts` stays pure for exactly that reason.
8
+ export const IO_SIGNATURES_PATH = resolve(import.meta.dir, "..", "signatures", "io.json");
9
+ export const STRING_SIGNATURES_PATH = resolve(import.meta.dir, "..", "signatures", "string.json");
10
+ export const TABLE_SIGNATURES_PATH = resolve(import.meta.dir, "..", "signatures", "table.json");
11
+ export const OS_SIGNATURES_PATH = resolve(import.meta.dir, "..", "signatures", "os.json");
12
+ export const COROUTINE_SIGNATURES_PATH = resolve(
13
+ import.meta.dir,
14
+ "..",
15
+ "signatures",
16
+ "coroutine.json",
17
+ );
18
+ export const MATH_SIGNATURES_PATH = resolve(import.meta.dir, "..", "signatures", "math.json");
19
+ export const BIT_SIGNATURES_PATH = resolve(import.meta.dir, "..", "signatures", "bit.json");
20
+ export const DEBUG_SIGNATURES_PATH = resolve(import.meta.dir, "..", "signatures", "debug.json");
21
+ export const PACKAGE_SIGNATURES_PATH = resolve(import.meta.dir, "..", "signatures", "package.json");
22
+ export const BASE_SIGNATURES_PATH = resolve(import.meta.dir, "..", "signatures", "base.json");
23
+ export const SOCKET_SIGNATURES_PATH = resolve(import.meta.dir, "..", "signatures", "socket.json");
24
+
25
+ export function loadSignatureFile(path: string): SignatureStore {
26
+ let raw: string;
27
+ try {
28
+ raw = readFileSync(path, "utf8");
29
+ } catch {
30
+ return {};
31
+ }
32
+ return JSON.parse(raw) as SignatureStore;
33
+ }
@@ -1,6 +1,10 @@
1
1
  /** @noSelfInFile */
2
2
  import type * as Core from "./core-types";
3
3
 
4
+ // Hand-maintained surface: Defold ships no machine-readable export for the
5
+ // prefixless globals, so add or remove entries here from the Defold API
6
+ // reference and mirror the change in fixtures/globals_doc.json — the
7
+ // engine-globals test fails if the two fall out of sync.
4
8
  declare global {
5
9
  type Hash = Core.Hash;
6
10
  function hash(s: string): Core.Hash;
@@ -1,18 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { resolve } from "node:path";
3
- import type { SignatureStore } from "../src/signature-store";
4
-
5
- // Build-time only: lives under `scripts/` (never reachable from the shipped
6
- // `src/index.ts` graph) so its `node:fs` import cannot leak into a consumer's
7
- // typecheck. `src/signature-store.ts` stays pure for exactly that reason.
8
- const IO_SIGNATURES_PATH = resolve(import.meta.dir, "..", "signatures", "io.json");
9
-
10
- export function loadSignatures(path: string = IO_SIGNATURES_PATH): SignatureStore {
11
- let raw: string;
12
- try {
13
- raw = readFileSync(path, "utf8");
14
- } catch {
15
- return {};
16
- }
17
- return JSON.parse(raw) as SignatureStore;
18
- }