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.

feat(build): a target states its size caps before you package

esenginedac0ccb185da
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7c982201a..5b8abc74c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,10 @@ published separately; it ships inside the editor.
## [Unreleased]
+### Added
+
+- **The build dialog states a platform's size caps before you package.** They were reported only after a package existed, in the size panel, so the ceiling a build had to fit under was visible only once it was too late to plan around — and the difference matters: a package that fits WeChat's 30MB is 10MB over Douyin's 20MB. Each target's caps now sit under its description, and hovering them gives the platform's own wording rather than our paraphrase. A platform a project defines itself states the caps it declared.
+
### Fixed
- **A Douyin package could not start.** It shipped the browser engine artifact, which is an ES module, and a mini-game host loads its JavaScript with `require` — so `game.js` threw `SyntaxError: Unexpected token 'export'` on its first line and the package never reached a frame. Every mini-game host takes the same engine build, and now every mini-game target asks for it: the two built-in vendors, and a platform a project defines itself, which had the same browser default. The export also refuses an ES module engine by reading the file rather than trusting its name, since the name was the thing that was wrong.
diff --git a/desktop b/desktop
index 8418686ce..2c1d52ebe 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 8418686ced3e07e0c87d3c3623bfff19590870a0
+Subproject commit 2c1d52ebeaa24f8925bc92d35b4e26e8ea5c4533
diff --git a/pipeline/src/export/platformCatalog.ts b/pipeline/src/export/platformCatalog.ts
index ad277ee8a..e88e8d913 100644
--- a/pipeline/src/export/platformCatalog.ts
+++ b/pipeline/src/export/platformCatalog.ts
@@ -31,6 +31,7 @@ import {
type PlayableAdProfile,
} from './playableAdProfile';
import { BUILTIN_PLATFORMS, DESKTOP_OSES, compileTargetFor, desktopTemplateFor, type PlatformPrereq } from '../project/platforms';
+import type { SizeBudget } from '../project/sizeBudget';
import { promisesCompilation } from '../bundle/buildCompiledSystems';
import { resolveNativeTemplate } from './nativeTemplates';
import { templateId } from '../../../build-tools/utils/nativeTemplate.js';
@@ -70,6 +71,10 @@ export interface PlatformStatus {
* imported. The row appears so the user can see it exists and go approve it,
* rather than wondering why the target never showed up. */
needsTrust?: boolean;
+ /** Project platforms only — the caps this vendor declared, so the build dialog
+ * can state them before a package exists. A built-in target's are the
+ * platform's rule and live in sizeBudget.ts, which the renderer reads. */
+ sizeBudgets?: readonly SizeBudget[];
}
// =============================================================================
@@ -692,6 +697,7 @@ export async function listPlatforms(
label: mod.label,
blurb: mod.blurb,
defaultOut: mod.defaultOut ?? `dist-${mod.id}`,
+ sizeBudgets: mod.sizeBudgets,
prereq: ready
? undefined
// No command: the editor does not know how this project builds its own
diff --git a/pipeline/tests/platform-catalog.test.ts b/pipeline/tests/platform-catalog.test.ts
index 98f7ad7ae..8c367f7c2 100644
--- a/pipeline/tests/platform-catalog.test.ts
+++ b/pipeline/tests/platform-catalog.test.ts
@@ -332,6 +332,20 @@ describe('loadProjectPlatform — the profile handed to exportMiniGame', () => {
expect(acme!.ready).toBe(true);
});
+ // A cap nobody can see until the package exists is a cap nobody builds
+ // against, so the row carries the vendor's own — the built-ins' come from
+ // sizeBudget.ts, which the dialog reads directly.
+ it('carries the caps a project vendor declared, so the dialog can state them', async () => {
+ writePlatform('acme.mjs', `export default {
+ id: 'acme', label: 'A', emitConfigFiles: () => [],
+ sizeBudgets: [{ scope: 'initial', maxBytes: 3145728, note: 'ACME caps the main package at 3MB' }],
+ };`);
+ const acme = (await platforms(root)).find((r) => r.id === 'acme');
+ expect(acme?.sizeBudgets).toEqual([
+ { scope: 'initial', maxBytes: 3145728, note: 'ACME caps the main package at 3MB' },
+ ]);
+ });
+
it('is null for a built-in id, so the built-in pipeline keeps it', async () => {
expect(await loadProjectPlatform(root, 'wechat', dirs())).toBeNull();
expect(await loadProjectPlatform(root, 'nope', dirs())).toBeNull();
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index a97a473ed..cd78e657b 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -698,6 +698,8 @@ export const NOTED = {
{ internal: "a manual page's import line, following the move it documents" },
'refactor(play): the play realm asks for the whole import map by name':
{ internal: "the editor's preview page names the same subpaths it always did" },
+ 'feat(build): a target states its size caps before you package':
+ { note: "The build dialog states a platform's size caps before you package." },
'fix(export): a mini-game takes the engine build a mini-game host can load':
{ note: 'A Douyin package could not start.' },
'fix(export): every mini-game target gets the mini-game engine runtime':