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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(api-surface): make the surface snapshot machine-independent
yhh456c91710810
diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.mdindex 6e35d7e44..d79a8c946 100644--- a/sdk/etc/index.api.md+++ b/sdk/etc/index.api.md@@ -3362,7 +3362,7 @@ toVersion: string## MissingAssetCallback — type```-(missing: import('./asset/Assets').MissingAsset[]) => void+(missing: MissingAsset[]) => void```## MissingAssetsError — class@@ -3371,7 +3371,7 @@ message: stringmissing: MissingAsset[]name: stringstack: string | undefined-static new (missing: import("./asset/Assets").MissingAsset[]): MissingAssetsError+static new (missing: MissingAsset[]): MissingAssetsErrorstatic prototype: MissingAssetsError```@@ -3940,7 +3940,7 @@ _physics_updateBodyProperties: (entityId: number, bodyType: number, gravityScale```bindInputEvents: (callbacks: InputEventCallbacks, target?: unknown) => voidclearStorage: (prefix: string) => void-createAudioBackend: () => import("../audio/PlatformAudioBackend").PlatformAudioBackend+createAudioBackend: () => PlatformAudioBackendcreateCanvas: (width: number, height: number) => HTMLCanvasElement | OffscreenCanvascreateImage: () => HTMLImageElementcreateSocket: ((options: PlatformSocketOptions) => PlatformSocket) | undefined@@ -7882,7 +7882,7 @@ PerceptionPlugin## platformFetch — function```-(url: string, options?: import("./types").PlatformRequestOptions): Promise<import("./types").PlatformResponse>+(url: string, options?: PlatformRequestOptions): Promise<PlatformResponse>```## platformFileExists — function@@ -7892,7 +7892,7 @@ PerceptionPlugin## platformInstantiateWasm — function```-(pathOrBuffer: string | ArrayBuffer, imports: WebAssembly.Imports): Promise<import("./types").WasmInstantiateResult>+(pathOrBuffer: string | ArrayBuffer, imports: WebAssembly.Imports): Promise<WasmInstantiateResult>```## platformReadFile — functiondiff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.mdindex bda110503..bfbbe6137 100644--- a/sdk/etc/index.node.api.md+++ b/sdk/etc/index.node.api.md@@ -3357,7 +3357,7 @@ toVersion: string## MissingAssetCallback — type```-(missing: import('./asset/Assets').MissingAsset[]) => void+(missing: MissingAsset[]) => void```## MissingAssetsError — class@@ -3366,7 +3366,7 @@ message: stringmissing: MissingAsset[]name: stringstack: string | undefined-static new (missing: import("./asset/Assets").MissingAsset[]): MissingAssetsError+static new (missing: MissingAsset[]): MissingAssetsErrorstatic prototype: MissingAssetsError```@@ -3935,7 +3935,7 @@ _physics_updateBodyProperties: (entityId: number, bodyType: number, gravityScale```bindInputEvents: (callbacks: InputEventCallbacks, target?: unknown) => voidclearStorage: (prefix: string) => void-createAudioBackend: () => import("../audio/PlatformAudioBackend").PlatformAudioBackend+createAudioBackend: () => PlatformAudioBackendcreateCanvas: (width: number, height: number) => HTMLCanvasElement | OffscreenCanvascreateImage: () => HTMLImageElementcreateSocket: ((options: PlatformSocketOptions) => PlatformSocket) | undefined@@ -7887,7 +7887,7 @@ PerceptionPlugin## platformFetch — function```-(url: string, options?: import("./types").PlatformRequestOptions): Promise<import("./types").PlatformResponse>+(url: string, options?: PlatformRequestOptions): Promise<PlatformResponse>```## platformFileExists — function@@ -7897,7 +7897,7 @@ PerceptionPlugin## platformInstantiateWasm — function```-(pathOrBuffer: string | ArrayBuffer, imports: WebAssembly.Imports): Promise<import("./types").WasmInstantiateResult>+(pathOrBuffer: string | ArrayBuffer, imports: WebAssembly.Imports): Promise<WasmInstantiateResult>```## platformReadFile — functiondiff --git a/tools/api-surface.mjs b/tools/api-surface.mjsindex e33c196e4..5d969ba05 100644--- a/tools/api-surface.mjs+++ b/tools/api-surface.mjs@@ -64,9 +64,15 @@ const errors = [];// Helpers// ----------------------------------------------------------------------------/** Absolute source paths leak into typeToString via import("...") — relativize. */+/** Absolute source paths leak into typeToString via import("...") — strip them so the+ * snapshot is machine-independent (a Windows `F:/…` and a Linux `/home/…` for the same+ * symbol must not read as drift). First collapse our own SDK path to `~`, then drop the+ * `import("<any path>").` qualifier entirely — the trailing type name is what identifies+ * the symbol, and the path is environment noise. */function normalizeType(text) {- return text.split(SDK.replace(/\\/g, '/')).join('~').replace(/import\("~\/(.*?)"\)\./g, '');+ return text+ .split(SDK.replace(/\\/g, '/')).join('~')+ .replace(/import\((['"]).*?\1\)\./g, '');}const fileTagCache = new Map();@@ -235,6 +241,17 @@ for (const [entryName, entryPath] of Object.entries(ENTRIES)) {if (existing !== report) {drift++;console.error(`DRIFT: ${entryName} — public API changed but sdk/etc/${entryName}.api.md was not updated.`);+ // Show WHICH lines drifted (set difference — order-independent, so it+ // survives insertions) so the guard is self-explanatory in CI logs.+ const was = new Set(existing.split('\n'));+ const now = new Set(report.split('\n'));+ const removed = [...was].filter((l) => !now.has(l) && l.trim());+ const added = [...now].filter((l) => !was.has(l) && l.trim());+ for (const l of removed.slice(0, 25)) console.error(` - ${l}`);+ for (const l of added.slice(0, 25)) console.error(` + ${l}`);+ if (removed.length > 25 || added.length > 25) {+ console.error(` … (${removed.length} removed, ${added.length} added lines total)`);+ }}}}