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(export): reject failed video transcoding for wasm targets
yhh6c7305c10306
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b150dc766..dd17f6d7d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,8 @@ published separately; it ships inside the editor.### Fixed+- **WASM video exports fail when required transcoding fails.** An unavailable or failed video converter no longer stages an original MP4 that the target's WASM decoder cannot play. The cook reports the failed asset, and mini-game exports propagate asset cooking failures as build errors instead of reporting a usable package.+- **Repeated exports remove obsolete cooked assets and packs.** Web and mini-game exports compare the previous and current asset manifests, deleting old texture hashes, removed assets, and packs no longer referenced by the build. Shared current packs, project sources, and unlisted output files are preserved.- **Repeated Web exports drop obsolete runtime files.** Rebuilding into the same output replaces the shipped SDK and WASM trees, removing modules the project no longer needs and old SDK chunks. Turning off source maps removes maps from the previous build. Output-root configuration files are preserved, and a runtime output overlapping its input is rejected before removing that tree.diff --git a/pipeline/src/assets/cookAssets.ts b/pipeline/src/assets/cookAssets.tsindex 87fa43a09..f943f2b0d 100644--- a/pipeline/src/assets/cookAssets.ts+++ b/pipeline/src/assets/cookAssets.ts@@ -798,8 +798,7 @@ export async function cookAssets(ext = '.esv';videoAudio = res.audio;} else {- data = await readFile(path.join(root, entry.path));- warnings.push(`${entry.path}: shipped untranscoded — this video will NOT play on the wasm decode path (WeChat)`);+ throw new Error('video transcode failed — the original video cannot play on this target\'s WASM decoder');}}// Materials: relative refs → logical project paths (see rewriteMaterialRefs).diff --git a/pipeline/src/export/exportMiniGame.ts b/pipeline/src/export/exportMiniGame.tsindex 7ab4090ea..dd3ba0e55 100644--- a/pipeline/src/export/exportMiniGame.ts+++ b/pipeline/src/export/exportMiniGame.ts@@ -378,6 +378,7 @@ export async function exportMiniGame(profile: MiniGameExportProfile, opts: {// Settings under this key, so a vendor must cook against ITS OWN overrides.const cook = await cookAssets(opts.root, { entryScenes: scenes.map((s) => s.path), outDir: absOut, contentAddressed: opts.contentAddressed ?? true, compressTextures: opts.compressTextures, compressAudio: opts.compressAudio, atlasTextures: opts.atlasTextures, transcodeVideo: true, platform: profile.id, textureDecoderBytes: textureDecoderBytes(opts.wasmDir) });warnings.push(...cook.warnings);+ for (const file of cook.failed) errors.push(`asset not packaged — ${file}`);// 1a. Anything the packer will not upload ships as `<name>.<ext>.bin`. Scenes// have their own transform below (`<x>.esscene` → `scenes/<name>.json`).diff --git a/pipeline/tests/export-wechat.test.ts b/pipeline/tests/export-wechat.test.tsindex da5f3d097..79a192b80 100644--- a/pipeline/tests/export-wechat.test.ts+++ b/pipeline/tests/export-wechat.test.ts@@ -64,6 +64,31 @@ beforeAll(() => {afterAll(() => rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }));describe('exportGame (wechat)', () => {+ it('fails instead of shipping a video the WASM decoder cannot play', async () => {+ const video = '99999999-9999-4999-8999-999999999999';+ writeFileSync(path.join(root, 'assets/broken.mp4'), 'NOT A VIDEO');+ writeFileSync(path.join(root, 'assets/broken.mp4.meta'), meta(video, 'video'));+ const entry = 'scenes/broken-video.esscene';+ writeFileSync(path.join(root, entry), JSON.stringify({ version: '1.0', entities: [+ { id: 0, components: [{ type: 'Video', data: { source: `@uuid:${video}` } }] },+ ] }));+ writeFileSync(path.join(root, `${entry}.meta`), meta('88888888-8888-4888-8888-888888888888', 'scene'));+ const dir = path.join(root, 'dist-wechat-broken-video');+ try {+ const result = await exportGame({ root, entryScene: entry,+ hostsDir: 'unused-for-wechat', packagesDir: OFFICIAL_PACKAGES,+ sdkDistDir: path.join(root, '_sdk'), wasmDir: path.join(root, '_wxwasm'), outDir: dir, platform: 'wechat' });+ expect(result.ok).toBe(false);+ expect(result.errors.join('\n')).toMatch(/asset not packaged.*broken\.mp4/);+ const manifest = JSON.parse(readFileSync(path.join(dir, 'asset-manifest.json'), 'utf8'));+ expect(manifest.groups.main.assets[video]).toBeUndefined();+ } finally {+ for (const file of ['assets/broken.mp4', 'assets/broken.mp4.meta', entry, `${entry}.meta`]) {+ rmSync(path.join(root, file), { force: true });+ }+ }+ }, 60_000);+it('removes the old texture file when re-exporting changed art', async () => {const dir = path.join(root, 'dist-wechat-recook');const source = path.join(root, 'assets/hero.png');diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex ab0c2433d..87c54a532 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -28,6 +28,8 @@ export const NOTES_FLOOR = 'v0.65.0';* the reader recognises anyway.*/export const NOTED = {+ 'fix(export): reject failed video transcoding for wasm targets':+ { note: 'WASM video exports fail when required transcoding fails.' },'fix(export): prune obsolete cooked assets and packs':{ note: 'Repeated exports remove obsolete cooked assets and packs.' },'fix(export): remove obsolete web runtime files on rebuild':