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(timeline): importing esengine/timeline installs timelines again, so a mini-game's animated characters leave the bind pose

yhhf2b146884976
diff --git a/sdk/src/platform/nativeModuleRegistry.ts b/sdk/src/platform/nativeModuleRegistry.ts
index 0bab84328..1b318e2d5 100644
--- a/sdk/src/platform/nativeModuleRegistry.ts
+++ b/sdk/src/platform/nativeModuleRegistry.ts
@@ -25,7 +25,7 @@ import * as SpineModule from '../spine';
import * as DragonBonesModule from '../dragonbones';
import * as TilemapModule from '../tilemap';
import * as TerrainModule from '../terrain';
-import * as TimelineModule from '../timeline/entry';
+import * as TimelineModule from '../timeline/api';
import * as FxBasicModule from '../postprocess/fxBasic';
import * as FxAtmosphereModule from '../postprocess/fxAtmosphere';
import * as FxLightingModule from '../postprocess/fxLighting';
diff --git a/sdk/src/timeline/api.ts b/sdk/src/timeline/api.ts
new file mode 100644
index 000000000..2c43e3926
--- /dev/null
+++ b/sdk/src/timeline/api.ts
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+export {
+ TimelinePlugin,
+ timelinePlugin,
+ parseTimelineAsset,
+ Timeline,
+ TimelineAPI,
+ TimelinePlayer,
+ TIMELINE_MOTION,
+ createTimelineMotionDriver,
+ type TimelinePlayerData,
+} from './index';
+export {
+ sampleTimeline, sampleTimelineInWorld, evaluateChannel, applyWrapMode,
+ serializeTimelineAsset, serializeTimelineToJson, resolveChildEntity, parseAnimationClip,
+ TrackType, InterpType, WrapMode, TIMELINE_FORMAT_VERSION,
+ isRootPlacementChannel, sampleRootPlacement, createRootPlacement,
+ playheadRuns, runCrosses, collectCustomEvents,
+ type RootPlacement, type PlayheadRun,
+ type CustomEvent, type CustomEventTrack,
+ type SampleWorld, type SampleDeps, type SampleOptions,
+ type TimelineAsset, type Track, type PropertyTrack, type PropertyChannel, type Keyframe,
+ type SpriteAnimTrack, type AudioTrack, type ActivationTrack, type SpineTrack, type AnimFramesTrack,
+ type CameraClip, type CameraTrack, type SequenceClip, type SequenceTrack,
+ MAX_SEQUENCE_DEPTH, collectSequenceLayers, wouldNestCycle, resolveShot, resolveActiveShot,
+ type SequenceLayer, type SequenceLookup, type ShotState, type ActiveShot,
+} from './index';
diff --git a/sdk/src/timeline/entry.ts b/sdk/src/timeline/entry.ts
index 35b868e08..96d861f50 100644
--- a/sdk/src/timeline/entry.ts
+++ b/sdk/src/timeline/entry.ts
@@ -1,35 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-/**
- * The `esengine/timeline` subpath: the public timeline API, and importing it INSTALLS timelines — see tilemap/index.ts.
- * Named, not `export *`: `./index` also carries what the module keeps to itself.
- */
-export {
- TimelinePlugin,
- timelinePlugin,
- parseTimelineAsset,
- Timeline,
- TimelineAPI,
- TimelinePlayer,
- TIMELINE_MOTION,
- createTimelineMotionDriver,
- type TimelinePlayerData,
-} from './index';
-export {
- sampleTimeline, sampleTimelineInWorld, evaluateChannel, applyWrapMode,
- serializeTimelineAsset, serializeTimelineToJson, resolveChildEntity, parseAnimationClip,
- TrackType, InterpType, WrapMode, TIMELINE_FORMAT_VERSION,
- isRootPlacementChannel, sampleRootPlacement, createRootPlacement,
- playheadRuns, runCrosses, collectCustomEvents,
- type RootPlacement, type PlayheadRun,
- type CustomEvent, type CustomEventTrack,
- type SampleWorld, type SampleDeps, type SampleOptions,
- type TimelineAsset, type Track, type PropertyTrack, type PropertyChannel, type Keyframe,
- type SpriteAnimTrack, type AudioTrack, type ActivationTrack, type SpineTrack, type AnimFramesTrack,
- type CameraClip, type CameraTrack, type SequenceClip, type SequenceTrack,
- MAX_SEQUENCE_DEPTH, collectSequenceLayers, wouldNestCycle, resolveShot, resolveActiveShot,
- type SequenceLayer, type SequenceLookup, type ShotState, type ActiveShot,
-} from './index';
+export * from './api';
import { registerTimelineSupport } from './timelineSupport';
diff --git a/tools/check-dist-side-effect-chunks.mjs b/tools/check-dist-side-effect-chunks.mjs
new file mode 100644
index 000000000..ee6ddfcf0
--- /dev/null
+++ b/tools/check-dist-side-effect-chunks.mjs
@@ -0,0 +1,41 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+import { existsSync, readFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+const SDK = path.join(ROOT, 'sdk');
+const pkg = JSON.parse(readFileSync(path.join(SDK, 'package.json'), 'utf8'));
+const declared = new Set((pkg.sideEffects ?? []).map((p) => path.resolve(SDK, p)));
+
+if (declared.size === 0) {
+ console.error('check-dist-side-effect-chunks: sdk/package.json declares no side-effectful file.');
+ process.exit(1);
+}
+
+const problems = [];
+let checked = 0;
+for (const file of declared) {
+ if (!existsSync(file)) {
+ problems.push(`${path.relative(ROOT, file)} is declared in sideEffects and was not built (run the SDK build first)`);
+ continue;
+ }
+ checked++;
+ const src = readFileSync(file, 'utf8');
+ for (const m of src.matchAll(/^import\s+["']([^"']+)["'];?\s*$/gm)) {
+ const target = path.resolve(path.dirname(file), m[1]);
+ if (declared.has(target) || !existsSync(target)) continue;
+ if (readFileSync(target, 'utf8').trim() === '') continue;
+ problems.push(`${path.relative(ROOT, file)} runs ${path.relative(ROOT, target)} only by importing it bare, `
+ + 'and that file is not in sideEffects: a consumer bundler drops it, and whatever it registers never runs');
+ }
+}
+
+if (problems.length > 0) {
+ for (const p of problems) console.error(` ${p}`);
+ console.error(`check-dist-side-effect-chunks: ${problems.length} published entr(y/ies) lose code to the bundler.`);
+ process.exit(1);
+}
+console.log(`check-dist-side-effect-chunks: ${checked} side-effectful file(s), none runs code through an undeclared chunk.`);
diff --git a/tools/gates.mjs b/tools/gates.mjs
index 8a1a3931c..2349866e3 100644
--- a/tools/gates.mjs
+++ b/tools/gates.mjs
@@ -149,6 +149,7 @@ export const GATES = [
// And the half no text probe can see: `sideEffects` lists FILES, so a prologue
// the bundler puts in an unlisted chunk is dropped while still sitting in dist.
{ id: 'entry-boots', run: 'node tools/check-entry-boots.mjs' },
+ { id: 'dist-side-effect-chunks', run: 'node tools/check-dist-side-effect-chunks.mjs' },
// Replication applies its inbox in arrival order, so reliable+ordered is a
// correctness condition. This compiles the claim: a transport that does not
// make it cannot reach replication.