@defold-typescript/types 0.24.0 → 0.26.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/api-availability.json +333 -306
- package/api-signatures.json +47 -46
- package/api-targets.json +66 -2
- package/generated/collectionproxy.d.ts +22 -0
- package/generated/editor-vm/http.d.ts +56 -0
- package/generated/editor-vm/image.d.ts +48 -0
- package/generated/editor-vm/json.d.ts +10 -0
- package/generated/editor-vm/localization.d.ts +42 -0
- package/generated/editor-vm/tilemap_tiles.d.ts +80 -0
- package/generated/editor-vm/zip.d.ts +10 -0
- package/generated/editor-vm/zlib.d.ts +24 -0
- package/generated/editor.d.ts +1111 -0
- package/generated/go.d.ts +22 -22
- package/generated/gui.d.ts +35 -6
- package/generated/kinds/editor-script.d.ts +14 -0
- package/generated/kinds/gui-script.d.ts +1 -0
- package/generated/kinds/render-script.d.ts +1 -0
- package/generated/kinds/script.d.ts +1 -0
- package/generated/material.d.ts +4 -0
- package/generated/versions/defold-1.12.4/go.d.ts +22 -22
- package/generated/versions/defold-1.12.4/gui.d.ts +43 -43
- package/index.d.ts +9 -0
- package/package.json +9 -1
- package/scripts/import-defold-release.ts +10 -0
- package/scripts/materialize-version.ts +54 -13
- package/scripts/regen.ts +425 -42
- package/scripts/sync-api-docs.ts +86 -9
- package/src/api-availability.ts +0 -0
- package/src/core-types.ts +15 -1
- package/src/editor-overloads.d.ts +33 -0
- package/src/editor-vm-globals.d.ts +200 -0
- package/src/editor-vm-types.ts +44 -0
- package/src/editor.ts +117 -16
- package/src/emit-dts.ts +298 -79
- package/src/engine-globals.d.ts +2 -2
- package/src/go-overloads.d.ts +6 -6
- package/src/index.ts +15 -0
- package/src/msg-overloads.d.ts +3 -3
- package/src/scene-addresses.d.ts +62 -0
- package/src/url-parameters.ts +174 -0
- package/url-parameters.json +285 -0
package/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import "./src/msg-overloads";
|
|
|
5
5
|
import "./src/message-guard";
|
|
6
6
|
import "./src/window-event-guard";
|
|
7
7
|
import "./src/message-dispatch";
|
|
8
|
+
import "./src/scene-addresses";
|
|
8
9
|
import "./src/engine-globals";
|
|
9
10
|
import "./generated/b2d";
|
|
10
11
|
import "./generated/b2d_body";
|
|
@@ -60,13 +61,16 @@ export {
|
|
|
60
61
|
type ApiSymbolIdentity,
|
|
61
62
|
type AvailabilityLabel,
|
|
62
63
|
type AvailabilityLabelKind,
|
|
64
|
+
type AvailabilityLabelOptions,
|
|
63
65
|
availabilityLabel,
|
|
64
66
|
deriveAvailabilityMatrix,
|
|
65
67
|
groupByLogicalName,
|
|
66
68
|
isSignatureTransition,
|
|
67
69
|
type LogicalNameGroup,
|
|
68
70
|
normalizedFunctionSignature,
|
|
71
|
+
signatureTransitionNames,
|
|
69
72
|
symbolIdentityKey,
|
|
73
|
+
symbolNameKey,
|
|
70
74
|
type VersionSurface,
|
|
71
75
|
} from "./src/api-availability";
|
|
72
76
|
export type { ApiFunction, ApiModule, ApiParameter, ApiVariable } from "./src/api-doc";
|
|
@@ -131,3 +135,8 @@ export {
|
|
|
131
135
|
type SignatureOverride,
|
|
132
136
|
type SignatureStore,
|
|
133
137
|
} from "./src/signature-store";
|
|
138
|
+
export type {
|
|
139
|
+
UrlParameterClass,
|
|
140
|
+
UrlParameterEntry,
|
|
141
|
+
UrlParameterTable,
|
|
142
|
+
} from "./src/url-parameters";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defold-typescript/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "TypeScript types for the Defold engine's Lua APIs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,17 +27,24 @@
|
|
|
27
27
|
"./render-script": {
|
|
28
28
|
"types": "./generated/kinds/render-script.d.ts"
|
|
29
29
|
},
|
|
30
|
+
"./editor-script": {
|
|
31
|
+
"types": "./generated/kinds/editor-script.d.ts"
|
|
32
|
+
},
|
|
30
33
|
"./core-types": {
|
|
31
34
|
"types": "./src/core-types.ts"
|
|
32
35
|
},
|
|
33
36
|
"./lifecycle": {
|
|
34
37
|
"types": "./src/lifecycle.ts"
|
|
35
38
|
},
|
|
39
|
+
"./editor": {
|
|
40
|
+
"types": "./src/editor.ts"
|
|
41
|
+
},
|
|
36
42
|
"./timers": {
|
|
37
43
|
"types": "./src/timers.d.ts"
|
|
38
44
|
},
|
|
39
45
|
"./api-availability.json": "./api-availability.json",
|
|
40
46
|
"./api-signatures.json": "./api-signatures.json",
|
|
47
|
+
"./url-parameters.json": "./url-parameters.json",
|
|
41
48
|
"./package.json": "./package.json"
|
|
42
49
|
},
|
|
43
50
|
"files": [
|
|
@@ -48,6 +55,7 @@
|
|
|
48
55
|
"api-migrations.json",
|
|
49
56
|
"api-availability.json",
|
|
50
57
|
"api-signatures.json",
|
|
58
|
+
"url-parameters.json",
|
|
51
59
|
"index.d.ts",
|
|
52
60
|
"!src/**/*.test.ts",
|
|
53
61
|
"!scripts/**/*.test.ts",
|
|
@@ -4,6 +4,7 @@ import { isKnownDefoldTypeToken } from "../src/emit-dts";
|
|
|
4
4
|
import { refDocCacheDir, resolveRefDoc } from "./doc-source";
|
|
5
5
|
import {
|
|
6
6
|
apiElementIdentity,
|
|
7
|
+
EDITOR_MANIFEST,
|
|
7
8
|
IGNORED_UPSTREAM,
|
|
8
9
|
mergeApiDocs,
|
|
9
10
|
readZip,
|
|
@@ -15,6 +16,14 @@ const EXACT_VERSION = /^\d+\.\d+\.\d+$/;
|
|
|
15
16
|
const LUA_NAMESPACE = /^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)*$/;
|
|
16
17
|
const PACKAGE_ROOT = resolve(import.meta.dir, "..");
|
|
17
18
|
|
|
19
|
+
// Editor-scripting namespaces are mapped, but not by `api-targets.json`: they
|
|
20
|
+
// emit through `EDITOR_MODULE_MANIFEST` rather than the runtime module set the
|
|
21
|
+
// baseline is built from, so the baseline can never vouch for them. Only
|
|
22
|
+
// `EDITOR_MANIFEST` is consulted — `EDITOR_VM_MANIFEST` entries are split out of
|
|
23
|
+
// the editor document and never surface as an upstream `info.namespace`, so
|
|
24
|
+
// excusing their bare names would suppress a real runtime namespace instead.
|
|
25
|
+
const EDITOR_MAPPED_NAMESPACES = new Set(EDITOR_MANIFEST.map((source) => source.namespace));
|
|
26
|
+
|
|
18
27
|
// The set of namespaces promoted into the generated surface at Defold 1.13.0.
|
|
19
28
|
// Held here rather than derived from the root release model because the
|
|
20
29
|
// per-package `rootDir` boundary forbids importing outside this package tree;
|
|
@@ -325,6 +334,7 @@ export function buildReleaseImportPlan(input: {
|
|
|
325
334
|
(source) =>
|
|
326
335
|
source.functionCount > 0 &&
|
|
327
336
|
!baselineByNamespace.has(source.namespace) &&
|
|
337
|
+
!EDITOR_MAPPED_NAMESPACES.has(source.namespace) &&
|
|
328
338
|
!IGNORED_UPSTREAM.has(source.namespace),
|
|
329
339
|
)
|
|
330
340
|
.map((source) => ({
|
|
@@ -1,34 +1,61 @@
|
|
|
1
1
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { resolve } from "node:path";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
3
|
import {
|
|
4
4
|
type ApiTarget,
|
|
5
5
|
generateModuleDeclaration,
|
|
6
6
|
generateVersionIndex,
|
|
7
7
|
KIND_MODULE_MANIFEST,
|
|
8
|
-
|
|
8
|
+
type KindManifestEntry,
|
|
9
|
+
kindStdlibReferences,
|
|
10
|
+
loadTargetEditorModules,
|
|
9
11
|
type ResolveTargetOptions,
|
|
10
12
|
resolveTargetModules,
|
|
11
13
|
} from "./regen";
|
|
12
14
|
|
|
13
|
-
export {
|
|
15
|
+
export { RUNTIME_KIND_MANIFEST, targetKindManifest } from "./regen";
|
|
14
16
|
|
|
15
17
|
export interface RenderMaterializedKindIndexOptions {
|
|
16
18
|
readonly kind: string;
|
|
17
19
|
readonly universalModules: readonly string[];
|
|
18
20
|
readonly restrictedModule: string | null;
|
|
21
|
+
// Set for a kind built from the target's own editor documents. It replaces
|
|
22
|
+
// the universal set outright — an editor kind is disjoint from the runtime
|
|
23
|
+
// surface, not a narrowing of it.
|
|
24
|
+
readonly editorModules?: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// The installed subpath a materialized kind re-exports its factory from: the
|
|
28
|
+
// surface has no relative `src/<module>` to reach, but the package publishes
|
|
29
|
+
// each factory module under its own name.
|
|
30
|
+
function installedFactoryModule(entry: KindManifestEntry): string {
|
|
31
|
+
const module = (entry.factoryFrom ?? "../../src/lifecycle").split("/").pop();
|
|
32
|
+
return `@defold-typescript/types/${module}`;
|
|
19
33
|
}
|
|
20
34
|
|
|
21
35
|
// Render one per-kind subpath for the materialized surface, mirroring
|
|
22
36
|
// `generateKindIndex` but re-exporting the factory from the installed
|
|
23
|
-
// `@defold-typescript/types
|
|
24
|
-
// relative `src/lifecycle` to reach). Pure: returns a string, no FS.
|
|
37
|
+
// `@defold-typescript/types/<module>` subpath. Pure: returns a string, no FS.
|
|
25
38
|
export function renderMaterializedKindIndex(opts: RenderMaterializedKindIndexOptions): string {
|
|
26
39
|
const entry = KIND_MODULE_MANIFEST.find((e) => e.kind === opts.kind);
|
|
27
40
|
if (!entry) throw new Error(`unknown script kind: ${opts.kind}`);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
41
|
+
const modules =
|
|
42
|
+
entry.only === undefined
|
|
43
|
+
? [...new Set(["engine-globals", ...opts.universalModules])].sort()
|
|
44
|
+
: [...(opts.editorModules ?? [])];
|
|
45
|
+
const lines = modules.map((mod) => `import "../${mod}";`);
|
|
46
|
+
if (entry.only === undefined && opts.restrictedModule) {
|
|
47
|
+
lines.push(`import "../${opts.restrictedModule}";`);
|
|
48
|
+
}
|
|
49
|
+
const from = installedFactoryModule(entry);
|
|
50
|
+
const values = [entry.factory, ...(entry.extraExports ?? [])].join(", ");
|
|
51
|
+
const typeExports = entry.extraTypeExports?.length
|
|
52
|
+
? `\nexport type { ${entry.extraTypeExports.join(", ")} } from "${from}";`
|
|
53
|
+
: "";
|
|
54
|
+
const properties =
|
|
55
|
+
entry.propertyTypes === false
|
|
56
|
+
? ""
|
|
57
|
+
: `\nexport type { ScriptProperties, ScriptProperty } from "${from}";`;
|
|
58
|
+
return `${kindStdlibReferences(entry)}${lines.join("\n")}\n\nexport { ${values} } from "${from}";${typeExports}${properties}\n`;
|
|
32
59
|
}
|
|
33
60
|
|
|
34
61
|
export interface BuildVersionedSurfaceOptions {
|
|
@@ -60,15 +87,25 @@ export async function buildVersionedSurfaceFiles(
|
|
|
60
87
|
opts: BuildVersionedSurfaceOptions = {},
|
|
61
88
|
): Promise<VersionedSurfaceFile[]> {
|
|
62
89
|
const exclude = new Set(opts.excludeModules ?? []);
|
|
63
|
-
const
|
|
64
|
-
|
|
90
|
+
const kept = (outFile: string): boolean => !exclude.has(outFile.replace(/\.d\.ts$/, ""));
|
|
91
|
+
const modules = (await resolveTargetModules(target, opts.resolveOpts ?? {})).filter((entry) =>
|
|
92
|
+
kept(entry.outFile),
|
|
65
93
|
);
|
|
94
|
+
// The editor documents a target declares are always committed fixtures — the
|
|
95
|
+
// ref-doc zip carries no editor surface — so they resolve from disk whatever
|
|
96
|
+
// the target's `source` says.
|
|
97
|
+
const editorModules = loadTargetEditorModules(
|
|
98
|
+
target,
|
|
99
|
+
opts.resolveOpts?.packageRoot ?? undefined,
|
|
100
|
+
).filter((entry) => kept(entry.outFile));
|
|
66
101
|
|
|
67
|
-
const files: VersionedSurfaceFile[] = modules.map((entry) => ({
|
|
102
|
+
const files: VersionedSurfaceFile[] = [...modules, ...editorModules].map((entry) => ({
|
|
68
103
|
path: entry.outFile,
|
|
69
104
|
contents: generateModuleDeclaration(entry).contents,
|
|
70
105
|
}));
|
|
71
106
|
|
|
107
|
+
// The aggregate entrypoint stays the runtime surface: importing the editor VM
|
|
108
|
+
// there would drag it into every program that pins this version.
|
|
72
109
|
const versioned = modules.map((entry) => ({ ...entry, versionId: target.id }));
|
|
73
110
|
files.push({ path: "index.d.ts", contents: generateVersionIndex(target.id, versioned) });
|
|
74
111
|
|
|
@@ -94,6 +131,10 @@ export async function materializeVersionedSurface(
|
|
|
94
131
|
const files = await buildVersionedSurfaceFiles(target, opts);
|
|
95
132
|
mkdirSync(opts.destDir, { recursive: true });
|
|
96
133
|
for (const file of files) {
|
|
97
|
-
|
|
134
|
+
const out = resolve(opts.destDir, file.path);
|
|
135
|
+
// An editor VM module lands in its own subdirectory, so the sink cannot
|
|
136
|
+
// assume every file is a direct child of the surface root.
|
|
137
|
+
mkdirSync(dirname(out), { recursive: true });
|
|
138
|
+
writeFileSync(out, file.contents);
|
|
98
139
|
}
|
|
99
140
|
}
|