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
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { build } from 'esbuild';
import { mkdir, mkdtemp, rm } from 'node:fs/promises';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const out = path.resolve(process.argv[2] ?? path.join(root, 'output/cache-budget/render'));
const channel = process.argv[3];
if (!channel) throw Error('usage: node tools/cache-budget-render-fixture.mjs <output> <debug-channel-url>');
await mkdir(path.join(root, 'pipeline/src'), { recursive: true });
const scratch = await mkdtemp(path.join(root, 'pipeline/src/.build-cache-render-'));
try {
const bundle = path.join(scratch, 'fixture.mjs');
await build({ entryPoints: [path.join(root, 'tools/fixtures/cache-budget-render-fixture.ts')], outfile: bundle,
bundle: true, format: 'esm', platform: 'node', packages: 'external' });
const { run } = await import(pathToFileURL(bundle).href);
console.log(JSON.stringify(await run(root, out, channel)));
} finally { await rm(scratch, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 }); }