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.

fix(ci): the mini-game host only refuses to make a BigInt64Array, and the unoffered ops are not asked of the text

yhhc6fc3ad2e1e7
diff --git a/pipeline/src/modeling/index.ts b/pipeline/src/modeling/index.ts
index 2b0024387..fd75c2537 100644
--- a/pipeline/src/modeling/index.ts
+++ b/pipeline/src/modeling/index.ts
@@ -5,7 +5,7 @@
* Pure: no filesystem and no engine instance, so the editor and a test run the same code.
*/
export {
- MODEL_OPS, MODEL_SOURCE_EXT, MODEL_SOURCE_VERSION, ModelBuildError, applyModelEdits, buildPolyMesh, describeModelOps, validateModelSource,
+ MODEL_OPS, MODEL_SOURCE_EXT, MODEL_SOURCE_VERSION, ModelBuildError, UNOFFERED_OPS, applyModelEdits, buildPolyMesh, describeModelOps, validateModelSource,
type ModelEdit, type ModelSource, type NormalBakeSource, type ModelStep, type StepReport,
} from './modelSource';
export { organic, ORGANIC_DEFAULT_RESOLUTION, ORGANIC_MAX_RESOLUTION, type OrganicParams, type OrganicPart } from './organic';
diff --git a/pipeline/src/modeling/modelSource.ts b/pipeline/src/modeling/modelSource.ts
index 4fbb66ef3..3d817f554 100644
--- a/pipeline/src/modeling/modelSource.ts
+++ b/pipeline/src/modeling/modelSource.ts
@@ -618,7 +618,7 @@ export function applyModelEdits(source: ModelSource, edits: readonly ModelEdit[]
return validateModelSource(next);
}
-const UNOFFERED_OPS: ReadonlySet<string> = new Set(['humanoid', 'garment']);
+export const UNOFFERED_OPS: ReadonlySet<string> = new Set(['humanoid', 'garment']);
/** The op vocabulary as text, for what a tool tells its caller. */
export const describeModelOps = (): string => Object.entries(MODEL_OPS)
diff --git a/pipeline/tests/modeling.test.ts b/pipeline/tests/modeling.test.ts
index 897907a40..353973683 100644
--- a/pipeline/tests/modeling.test.ts
+++ b/pipeline/tests/modeling.test.ts
@@ -8,7 +8,7 @@
import { describe, expect, it } from 'vitest';
import { decodeMesh, encodeMesh, MeshChannel } from 'esengine';
import {
- applyModelEdits, bakeModel, describeModelOps, MODEL_OPS, ModelBuildError, renderModelSheet, validateModelSource,
+ applyModelEdits, bakeModel, describeModelOps, UNOFFERED_OPS, MODEL_OPS, ModelBuildError, renderModelSheet, validateModelSource,
type BakedModel, type ModelStep,
} from '../src/modeling';
@@ -328,7 +328,11 @@ describe('the source format', () => {
it('every op is described, so the tool cannot offer one it does not explain', () => {
const text = describeModelOps();
- for (const name of Object.keys(MODEL_OPS)) expect(text).toContain(`${name}(`);
+ for (const name of Object.keys(MODEL_OPS)) {
+ // A ready body is not offered, as a model handed one copies it; it still runs for what uses it.
+ if (UNOFFERED_OPS.has(name)) expect(text).not.toContain(`${name}(`);
+ else expect(text).toContain(`${name}(`);
+ }
});
});
diff --git a/tools/launchers/minigameHost.mjs b/tools/launchers/minigameHost.mjs
index 608489527..e6d5ebea1 100644
--- a/tools/launchers/minigameHost.mjs
+++ b/tools/launchers/minigameHost.mjs
@@ -103,9 +103,14 @@ export const HOST_PAGE = (entry, failSubpackage = null) => `<!doctype html>
const log = (m) => console.log('[minigame] ' + m);
// Not every mini-game realm has these: WeChat DevTools' does not, nor does
// JavaScriptCore before iOS 15. A glue that builds a view from them fails here too
- // rather than only on the host it reaches a user through.
- delete globalThis.BigInt64Array;
- delete globalThis.BigUint64Array;
+ // rather than only on the host it reaches a user through. Named still, as a test
+ // driver's own script asks instanceof of them: only making one is what fails.
+ for (const name of ['BigInt64Array', 'BigUint64Array']) {
+ const real = globalThis[name];
+ const absent = function () { throw new ReferenceError(name + ' is not defined'); };
+ absent.prototype = real.prototype;
+ globalThis[name] = absent;
+ }
// Vendor contract: the FIRST createCanvas() hands back the on-screen canvas and
// every call after it is offscreen scratch. Hand the engine a fresh offscreen
// one instead and the game runs perfectly, drawing where nobody can see.