Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

chore(build): declare the desktop assembler's types

esengine8b831ccb35da
diff --git a/build-tools/utils/desktopApp.d.ts b/build-tools/utils/desktopApp.d.ts
new file mode 100644
index 000000000..87a4d49b1
--- /dev/null
+++ b/build-tools/utils/desktopApp.d.ts
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+//
+// Types for desktopApp.js, which is plain ESM so the CLI runs it unbuilt.
+
+export interface DesktopAppIdentity {
+ id: string;
+ name: string;
+ version: string;
+ versionCode: number;
+}
+
+export function assembleMacApp(options: {
+ /** An installed macos runtime template. */
+ templateDir: string;
+ /** The export: cooked content plus the two configs. */
+ contentDir: string;
+ /** Where `<name>.app` is written. */
+ outDir: string;
+ app: DesktopAppIdentity;
+ /** Square PNG; the template's mark is used when absent. */
+ iconPng?: string;
+ macosMin?: string;
+ /** codesign identity; ad-hoc when absent. */
+ signIdentity?: string;
+ /** Told when the bundle could not be signed (assembling off macOS). */
+ warn?: (message: string) => void;
+}): Promise<string>;
diff --git a/build-tools/utils/icns.d.ts b/build-tools/utils/icns.d.ts
new file mode 100644
index 000000000..57981c3c4
--- /dev/null
+++ b/build-tools/utils/icns.d.ts
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+//
+// Types for icns.js, which is plain ESM so the CLI runs it unbuilt.
+
+/** A PNG's pixel size, from IHDR. Throws when the bytes are not a PNG. */
+export function pngSize(bytes: Uint8Array | Buffer): { width: number; height: number };
+
+/** Wrap a square PNG as a macOS `.icns`. Nothing is resized; the slot is the
+ * largest standard size the image covers. Throws when it cannot be wrapped
+ * honestly (not square, not a PNG, smaller than the smallest slot). */
+export function pngToIcns(png: Uint8Array | Buffer): Buffer;
diff --git a/build-tools/utils/nativeTemplate.d.ts b/build-tools/utils/nativeTemplate.d.ts
index 22e00a6a3..2158dc991 100644
--- a/build-tools/utils/nativeTemplate.d.ts
+++ b/build-tools/utils/nativeTemplate.d.ts
@@ -4,7 +4,10 @@
// Types for nativeTemplate.js — the module is plain ESM so the CLI can run it
// unbuilt, and this is how the editor's TypeScript sees it.
-export type NativePlatform = 'android' | 'ios';
+/** Every platform a runtime template exists for. `macos` is one of them because a
+ * desktop package is assembled from a template exactly as a phone's is — that
+ * sameness is the point (see docs/REARCH_STEAM.md §6.0). */
+export type NativePlatform = 'android' | 'ios' | 'macos';
export interface NativeTemplateManifest {
kind: 'estella-native-template';
@@ -113,6 +116,14 @@ export function androidTemplateSources(dir: string): {
bytecode: string;
};
+export function desktopTemplateSources(dir: string): {
+ /** The runtime binary; the assembler renames it to the app. */
+ executable: string;
+ infoPlistIn: string;
+ icon: string;
+ bytecode: string;
+};
+
export function iosTemplateSources(dir: string): {
xcframework: string;
mainM: string;